Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into hotwax#272-Update-o…
Browse files Browse the repository at this point in the history
…ms-api
  • Loading branch information
R-Sourabh committed Mar 22, 2024
2 parents 0520609 + 6b8cf6c commit 2093080
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 152 deletions.
129 changes: 54 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@capacitor/ios": "^2.5.0",
"@casl/ability": "^6.0.0",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.2.3",
"@hotwax/dxp-components": "1.11.0",
"@hotwax/apps-theme": "^1.2.6",
"@hotwax/dxp-components": "1.12.1",
"@hotwax/oms-api": "^1.13.0",
"@ionic/core": "6.7.5",
"@ionic/vue": "6.7.5",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"back-order": "back-order",
"Back-order": "Back-order",
"Broker orders": "Broker orders",
"Built: ": "Built: {builtDateTime}",
"eCom Store": "eCom Store",
"Cancel": "Cancel",
"Cancel item": "Cancel item",
Expand Down Expand Up @@ -66,6 +67,7 @@
"Excluded ATP": "Excluded ATP",
"from date": "from date",
"Failed to update configuration": "Failed to update configuration",
"Fetching time zones": "Fetching time zones",
"Go to Launchpad": "Go to Launchpad",
"Go to OMS": "Go to OMS",
"History": "History",
Expand Down Expand Up @@ -236,6 +238,7 @@
"Username": "Username",
"variant": "variant",
"variants": "variants",
"Version: ": "Version: {appVersion}",
"When this product entered there was no sellable inventory and was available in": "When this product entered {categoryName} there was no sellable inventory and {poItemATP} was available in {poId}",
"With Hold Pre-order Queue Physical Inventory disabled, the excess inventory is now available for sale online after deducting the queues": "With Hold Pre-order Queue Physical Inventory disabled, the excess inventory is now available for sale online after deducting the queues",
"Would you like to update your time zone to . Your profile is currently set to . This setting can always be changed from the settings menu.": "Would you like to update your time zone to {localTimeZone}. Your profile is currently set to {profileTimeZone}. This setting can always be changed from the settings menu.",
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/locales/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import en from "./en.json"

export default {
"en-US": en
};
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router';
import './registerServiceWorker'

import { IonicVue } from '@ionic/vue';
import i18n from './i18n'
Expand Down Expand Up @@ -34,6 +33,7 @@ import permissionPlugin from '@/authorization';
import permissionRules from '@/authorization/Rules';
import permissionActions from '@/authorization/Actions';
import { getConfig, initialise } from '@/adapter'
import localeMessages from './i18n/locales';

const app = createApp(App)
.use(IonicVue, {
Expand All @@ -53,7 +53,8 @@ const app = createApp(App)
loader,
appLoginUrl: process.env.VUE_APP_LOGIN_URL as string,
getConfig: getConfig,
initialise: initialise
initialise: initialise,
localeMessages
});

// Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters
Expand Down
30 changes: 0 additions & 30 deletions src/registerServiceWorker.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default interface UserState {
token: string;
current: object | null;
permissions: any;
pwaState: any;
instanceUrl: string;
currentEComStore: object;
}
11 changes: 8 additions & 3 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const actions: ActionTree<UserState, RootState> = {
if (permissionId) {
// As the token is not yet set in the state passing token headers explicitly
// TODO Abstract this out, how token is handled should be part of the method not the callee
const hasPermission = appPermissions.some((appPermissionId: any) => appPermissionId === permissionId );
const hasPermission = appPermissions.some((appPermission: any) => appPermission.action === permissionId );
// If there are any errors or permission check fails do not allow user to login
if (hasPermission) {
if (!hasPermission) {
const permissionError = 'You do not have permission to access the app.';
showToast(translate(permissionError));
console.error("error", permissionError);
Expand Down Expand Up @@ -76,7 +76,7 @@ const actions: ActionTree<UserState, RootState> = {
} catch (err: any) {
showToast(translate('Something went wrong'));
console.error("error", err);
return Promise.reject(new Error(err))
return Promise.reject(err instanceof Object ? err :new Error(err));
}
},

Expand Down Expand Up @@ -168,5 +168,10 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_INSTANCE_URL_UPDATED, payload)
updateInstanceUrl(payload)
},

updatePwaState({ commit }, payload) {
commit(types.USER_PWA_STATE_UPDATED, payload);
}

}
export default actions;
3 changes: 3 additions & 0 deletions src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const getters: GetterTree <UserState, RootState> = {
if (!baseURL) baseURL = state.instanceUrl;
return baseURL.startsWith('http') ? baseURL.includes('/api') ? baseURL : `${baseURL}/api/` : `https://${baseURL}.hotwax.io/api/`;
},
getPwaState(state) {
return state.pwaState;
},
getCurrentEComStore(state) {
return state.currentEComStore
}
Expand Down
6 changes: 5 additions & 1 deletion src/store/modules/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const userModule: Module<UserState, RootState> = {
permissions: [],
current: {},
instanceUrl: '',
currentEComStore: {}
currentEComStore: {},
pwaState: {
updateExists: false,
registration: null,
}
},
getters,
actions,
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/user/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const USER_INFO_UPDATED = SN_USER + '/INFO_UPDATED'
export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED'
export const USER_PERMISSIONS_UPDATED = SN_USER + '/PERMISSIONS_UPDATED'
export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED'
export const USER_STORE_RSRV_INV_STATUS_UPDATED = SN_USER + '/STORE_RSRV_INV_STATUS_UPDATED'
export const USER_STORE_RSRV_INV_STATUS_UPDATED = SN_USER + '/STORE_RSRV_INV_STATUS_UPDATED'
export const USER_PWA_STATE_UPDATED = SN_USER + '/PWA_STATE_UPDATED'
6 changes: 5 additions & 1 deletion src/store/modules/user/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const mutations: MutationTree <UserState> = {
},
[types.USER_CURRENT_ECOM_STORE_UPDATED] (state, payload) {
state.currentEComStore = payload;
}
},
[types.USER_PWA_STATE_UPDATED](state, payload) {
state.pwaState.registration = payload.registration;
state.pwaState.updateExists = payload.updateExists;
},
}
export default mutations;
6 changes: 3 additions & 3 deletions src/views/catalog-product-details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="header">
<div class="product-image">
<ion-skeleton-text v-if="!Object.keys(currentVariant).length" animated />
<ShopifyImg v-else :src="currentVariant.mainImageUrl" />
<DxpShopifyImg v-else :src="currentVariant.mainImageUrl" />
</div>

<div class="product-info" v-if="Object.keys(currentVariant).length">
Expand Down Expand Up @@ -397,7 +397,7 @@ import {
shirtOutline
} from "ionicons/icons";
import { useStore } from "@/store";
import { ShopifyImg } from "@hotwax/dxp-components";
import { DxpShopifyImg } from "@hotwax/dxp-components";
import { mapGetters } from "vuex";
import { showToast, getFeature, hasError } from "@/utils";
import { translate } from "@/i18n";
Expand All @@ -416,7 +416,7 @@ import { Actions, hasPermission } from '@/authorization'
export default defineComponent({
name: "catalog-product-details",
components: {
ShopifyImg,
DxpShopifyImg,
IonButtons,
IonBackButton,
IonCard,
Expand Down
Loading

0 comments on commit 2093080

Please sign in to comment.