From 0591c79294d4a42f061640abfdc19da13831575c Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 27 Aug 2024 16:13:49 +0530 Subject: [PATCH 01/11] Implemented: centralized product store selector (#193) --- src/components/DxpProductStoreSelector.vue | 43 ++++++++++++++++ src/components/index.ts | 1 + src/index.ts | 11 ++++- src/store/auth.ts | 7 +++ src/store/user.ts | 57 ++++++++++++++++++++-- 5 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 src/components/DxpProductStoreSelector.vue diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue new file mode 100644 index 00000000..b400877d --- /dev/null +++ b/src/components/DxpProductStoreSelector.vue @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/src/components/index.ts b/src/components/index.ts index 131608c0..5d519130 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -22,6 +22,7 @@ export { default as DxpLogin } from './DxpLogin.vue'; export { default as DxpMenuFooterNavigation } from './DxpMenuFooterNavigation.vue'; export { default as DxpOmsInstanceNavigator } from './DxpOmsInstanceNavigator.vue' export { default as DxpProductIdentifier } from "./DxpProductIdentifier.vue"; +export { default as DxpProductStoreSelector } from "./DxpProductStoreSelector.vue" export { default as DxpShopifyImg } from './DxpShopifyImg.vue'; export { default as DxpUserProfile } from './DxpUserProfile.vue' export { default as DxpTimeZoneSwitcher } from './DxpTimeZoneSwitcher.vue' diff --git a/src/index.ts b/src/index.ts index 74f81851..e0a9cec3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ declare var process: any; import { createPinia } from "pinia"; import { useProductIdentificationStore } from "./store/productIdentification"; import { useAuthStore } from "./store/auth"; -import { DxpAppVersionInfo, DxpGitBookSearch, DxpImage, DxpLanguageSwitcher, DxpLogin, DxpMenuFooterNavigation, DxpOmsInstanceNavigator, DxpProductIdentifier, DxpShopifyImg, DxpTimeZoneSwitcher, DxpUserProfile } from "./components"; +import { DxpAppVersionInfo, DxpGitBookSearch, DxpImage, DxpLanguageSwitcher, DxpLogin, DxpMenuFooterNavigation, DxpOmsInstanceNavigator, DxpProductIdentifier, DxpProductStoreSelector, DxpShopifyImg, DxpTimeZoneSwitcher, DxpUserProfile } from "./components"; import { goToOms, getProductIdentificationValue } from "./utils"; import { initialiseFirebaseApp } from "./utils/firebase" import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' @@ -25,6 +25,7 @@ let loginContext = {} as any let shopifyImgContext = {} as any let appContext = {} as any let productIdentificationContext = {} as any +let productStoreContext = {} as any let notificationContext = {} as any let gitBookContext = {} as any let userContext = {} as any @@ -74,6 +75,7 @@ export let dxpComponents = { app.component('DxpMenuFooterNavigation', DxpMenuFooterNavigation) app.component('DxpOmsInstanceNavigator', DxpOmsInstanceNavigator) app.component('DxpProductIdentifier', DxpProductIdentifier) + app.component('DxpProductStoreSelector', DxpProductStoreSelector) app.component('DxpShopifyImg', DxpShopifyImg) app.component('DxpTimeZoneSwitcher', DxpTimeZoneSwitcher) app.component('DxpUserProfile', DxpUserProfile) @@ -96,7 +98,11 @@ export let dxpComponents = { productIdentificationContext.getProductIdentificationPref = options.getProductIdentificationPref productIdentificationContext.setProductIdentificationPref = options.setProductIdentificationPref - + + productStoreContext.getEComStores = options.getEComStores + productStoreContext.setEComStore = options.setEComStore + productStoreContext.getUserPreference = options.getUserPreference + notificationContext.addNotification = options.addNotification notificationContext.appFirebaseConfig = options.appFirebaseConfig notificationContext.appFirebaseVapidKey = options.appFirebaseVapidKey @@ -135,6 +141,7 @@ export { loginContext, notificationContext, productIdentificationContext, + productStoreContext, shopifyImgContext, translate, useAuthStore, diff --git a/src/store/auth.ts b/src/store/auth.ts index d8a8ca8e..df1e537a 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -1,3 +1,5 @@ +declare const process: any; + import { defineStore } from "pinia"; import { DateTime } from 'luxon' @@ -14,6 +16,11 @@ export const useAuthStore = defineStore('userAuth', { getters: { getToken: (state) => state.token, getOms: (state) => state.oms, + getBaseUrl: (state) => { + let baseURL = process.env.VUE_APP_BASE_URL; + if (!baseURL) baseURL = state.oms; + return baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`; + }, isAuthenticated: (state) => { let isTokenExpired = false if (state.token.expiration) { diff --git a/src/store/user.ts b/src/store/user.ts index 1ec62165..c5e6dc4f 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,14 +1,16 @@ import { defineStore } from "pinia"; -import { appContext, i18n, translate, userContext } from "../../src"; -import { hasError } from "@hotwax/oms-api"; +import { appContext, i18n, translate, userContext, useAuthStore } from "../../src"; import { DateTime } from "luxon"; import { showToast } from "src/utils"; +import { productStoreContext } from "../index"; declare let process: any; export const useUserStore = defineStore('user', { state: () => { return { + current: {} as any, + currentEComStore: {} as any, localeOptions: process.env.VUE_APP_LOCALES ? JSON.parse(process.env.VUE_APP_LOCALES) : { "en-US": "English" }, locale: 'en-US', currentTimeZoneId: '', @@ -19,6 +21,8 @@ export const useUserStore = defineStore('user', { getLocale: (state) => state.locale, getLocaleOptions: (state) => state.localeOptions, getTimeZones: (state) => state.timeZones, + getCurrentEComStore: (state) => state.currentEComStore, + getProductStores: (state) => state.current.stores, getCurrentTimeZone: (state) => state.currentTimeZoneId }, actions: { @@ -74,7 +78,54 @@ export const useUserStore = defineStore('user', { }, updateTimeZone(tzId: string) { this.currentTimeZoneId = tzId - } + }, + async getEComStores(facilityId?: any) { + const authStore = useAuthStore(); + + try { + const response = await productStoreContext.getEComStores(authStore.getToken.value, authStore.getBaseUrl, facilityId); + this.current.stores = response; + } catch (error) { + console.error(error); + this.current.stores = []; + } + }, + async getPreferredStore(userPrefTypeId: any) { + const authStore = useAuthStore(); + let preferredStore = {} as any; + + if (this.current.stores.length) { + preferredStore = this.current.stores[0]; + let preferredStoreId = ''; + + try { + preferredStoreId = await productStoreContext.getUserPreference(authStore.getToken.value, authStore.getBaseUrl, userPrefTypeId); + const store = this.current.stores.find((store: any) => store.productStoreId === preferredStoreId); + if (store) { + preferredStore = store; + } + this.currentEComStore = preferredStore; + return Promise.resolve(preferredStoreId); + } catch (error) { + throw error; + } + } else { + this.currentEComStore = {}; + } + }, + async setEComStore(payload: any) { + const currentEComStore = JSON.parse(JSON.stringify(this.getCurrentEComStore)) + if(!payload) { + this.currentEComStore = currentEComStore + } + + try { + await productStoreContext.setEComStore(payload) + } catch (error) { + console.error('error', error) + } + this.currentEComStore = payload.eComStore; + }, }, persist: true }) From a3328e01960506a5e2f3f53bf47378e74baeab0c Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 28 Aug 2024 12:05:46 +0530 Subject: [PATCH 02/11] Improved: Added cases to return and update data in the state, and added a label tag in the ion-select (#193) --- src/components/DxpProductStoreSelector.vue | 3 +-- src/store/user.ts | 30 +++++++++------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue index b400877d..ad34b786 100644 --- a/src/components/DxpProductStoreSelector.vue +++ b/src/components/DxpProductStoreSelector.vue @@ -14,8 +14,7 @@ - {{ $t("Select store") }} - + {{ store.storeName }} diff --git a/src/store/user.ts b/src/store/user.ts index c5e6dc4f..9f3b5c85 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -87,38 +87,32 @@ export const useUserStore = defineStore('user', { this.current.stores = response; } catch (error) { console.error(error); - this.current.stores = []; } + return this.current.stores }, async getPreferredStore(userPrefTypeId: any) { - const authStore = useAuthStore(); let preferredStore = {} as any; - - if (this.current.stores.length) { - preferredStore = this.current.stores[0]; + const authStore = useAuthStore(); + preferredStore = this.current.stores[0]; + + try { let preferredStoreId = ''; - - try { - preferredStoreId = await productStoreContext.getUserPreference(authStore.getToken.value, authStore.getBaseUrl, userPrefTypeId); + preferredStoreId = await productStoreContext.getUserPreference(authStore.getToken.value, authStore.getBaseUrl, userPrefTypeId); + + if(preferredStoreId) { const store = this.current.stores.find((store: any) => store.productStoreId === preferredStoreId); - if (store) { - preferredStore = store; - } - this.currentEComStore = preferredStore; - return Promise.resolve(preferredStoreId); - } catch (error) { - throw error; + store && (preferredStore = store) } - } else { - this.currentEComStore = {}; + } catch (error) { + console.error(error); } + this.currentEComStore = preferredStore; }, async setEComStore(payload: any) { const currentEComStore = JSON.parse(JSON.stringify(this.getCurrentEComStore)) if(!payload) { this.currentEComStore = currentEComStore } - try { await productStoreContext.setEComStore(payload) } catch (error) { From c7f1bf6acaae868cfcd19448f79c20667344d3e1 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 2 Sep 2024 16:42:21 +0530 Subject: [PATCH 03/11] Improved: emitting event on productStore change to perform some action(#193) --- src/components/DxpMenuFooterNavigation.vue | 4 +++- src/components/DxpProductIdentifier.vue | 6 +++--- src/components/DxpProductStoreSelector.vue | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/DxpMenuFooterNavigation.vue b/src/components/DxpMenuFooterNavigation.vue index 6050f548..83d22843 100644 --- a/src/components/DxpMenuFooterNavigation.vue +++ b/src/components/DxpMenuFooterNavigation.vue @@ -40,13 +40,15 @@ import { IonFooter, IonItem, IonLabel, IonNote, IonSelect, IonSelectOption, IonToolbar } from '@ionic/vue'; import { appContext, useAuthStore } from "../index"; import { computed } from 'vue'; +import { useUserStore } from 'src/store/user' const authStore = useAuthStore(); +const userStore = useUserStore() const appState = appContext.config.globalProperties.$store; const instanceUrl = computed(() => authStore.getOms); const userAppState = computed(() => ({ userProfile: appState.getters['user/getUserProfile'], - currentEComStore: appState.getters['user/getCurrentEComStore'], + currentEComStore: userStore.getCurrentEComStore, shopifyConfigs: appState.getters['user/getShopifyConfigs'], currentShopifyConfig: appState.getters['user/getCurrentShopifyConfig'] })); diff --git a/src/components/DxpProductIdentifier.vue b/src/components/DxpProductIdentifier.vue index d568bdd1..b9598957 100644 --- a/src/components/DxpProductIdentifier.vue +++ b/src/components/DxpProductIdentifier.vue @@ -27,14 +27,14 @@ \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e0a9cec3..e92ef283 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,7 +100,7 @@ export let dxpComponents = { productIdentificationContext.setProductIdentificationPref = options.setProductIdentificationPref productStoreContext.getEComStores = options.getEComStores - productStoreContext.setEComStore = options.setEComStore + productStoreContext.setUserPreference = options.setUserPreference productStoreContext.getUserPreference = options.getUserPreference notificationContext.addNotification = options.addNotification diff --git a/src/store/auth.ts b/src/store/auth.ts index df1e537a..094ce3a4 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -17,9 +17,8 @@ export const useAuthStore = defineStore('userAuth', { getToken: (state) => state.token, getOms: (state) => state.oms, getBaseUrl: (state) => { - let baseURL = process.env.VUE_APP_BASE_URL; - if (!baseURL) baseURL = state.oms; - return baseURL.startsWith('http') ? baseURL : `https://${baseURL}.hotwax.io/api/`; + let baseURL = state.oms + return baseURL.startsWith('http') ? baseURL.includes('/api') ? baseURL : `${baseURL}/api/` : `https://${baseURL}.hotwax.io/api/`; }, isAuthenticated: (state) => { let isTokenExpired = false diff --git a/src/store/user.ts b/src/store/user.ts index 9f3b5c85..431e911d 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -114,11 +114,14 @@ export const useUserStore = defineStore('user', { this.currentEComStore = currentEComStore } try { - await productStoreContext.setEComStore(payload) + await productStoreContext.setUserPreference({ + userPrefTypeId: 'SELECTED_BRAND', + userPrefValue: payload.productStoreId + }) } catch (error) { console.error('error', error) } - this.currentEComStore = payload.eComStore; + this.currentEComStore = payload; }, }, persist: true From d57b1d9c0764ddc66b98663df7173d149d7d5400 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 18 Oct 2024 18:49:27 +0530 Subject: [PATCH 05/11] Improved: changed functions name & optimize userStore code(#193) --- src/components/DxpProductIdentifier.vue | 6 ++--- src/components/DxpProductStoreSelector.vue | 16 +++++++----- src/store/user.ts | 30 ++++++++++------------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/components/DxpProductIdentifier.vue b/src/components/DxpProductIdentifier.vue index b9598957..cf1040cc 100644 --- a/src/components/DxpProductIdentifier.vue +++ b/src/components/DxpProductIdentifier.vue @@ -34,16 +34,16 @@ import { computed, onMounted } from 'vue'; const productIdentificationStore = useProductIdentificationStore(); const userStore = useUserStore() -const eComStore = computed(() => userStore.getCurrentEComStore) +const currentEComStore = computed(() => userStore.getCurrentEComStore) const productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref); const productIdentificationOptions = productIdentificationStore.getProductIdentificationOptions; onMounted(() => { - productIdentificationStore.getIdentificationPref(eComStore.value.productStoreId); + productIdentificationStore.getIdentificationPref(currentEComStore.value.productStoreId); }) function setProductIdentificationPref(value: string | any, id: string) { - productIdentificationStore.setProductIdentificationPref(id, value, eComStore.value.productStoreId) + productIdentificationStore.setProductIdentificationPref(id, value, currentEComStore.value.productStoreId) } diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue index b49002c1..a3eef6be 100644 --- a/src/components/DxpProductStoreSelector.vue +++ b/src/components/DxpProductStoreSelector.vue @@ -14,8 +14,8 @@ - - {{ store.storeName }} + + {{ store.storeName }} @@ -27,14 +27,16 @@ import { useUserStore } from 'src'; import { computed } from 'vue'; const userStore = useUserStore(); +const emit = defineEmits(["updateEcomStore"]) -const productStores = computed(() => userStore.getProductStores); +const eComStores = computed(() => userStore.getProductStores); const currentEComStore = computed(() => userStore.getCurrentEComStore); -const setEComStore = (event: any) => { - if (currentEComStore.value?.productStoreId !== event.detail.value) { - const selectedProductStore = productStores.value.find((store: any) => store.productStoreId == event.detail.value) - userStore.setEComStore(selectedProductStore) +async function updateEComStore(event: any) { + if (event.target.value && currentEComStore.value?.productStoreId !== event.detail.value) { + const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == event.detail.value) + await userStore.setEComStorePreference(selectedProductStore) + emit('updateEcomStore', selectedProductStore) } } \ No newline at end of file diff --git a/src/store/user.ts b/src/store/user.ts index 431e911d..8f644eb5 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -9,7 +9,7 @@ declare let process: any; export const useUserStore = defineStore('user', { state: () => { return { - current: {} as any, + eComStores: [], currentEComStore: {} as any, localeOptions: process.env.VUE_APP_LOCALES ? JSON.parse(process.env.VUE_APP_LOCALES) : { "en-US": "English" }, locale: 'en-US', @@ -22,7 +22,7 @@ export const useUserStore = defineStore('user', { getLocaleOptions: (state) => state.localeOptions, getTimeZones: (state) => state.timeZones, getCurrentEComStore: (state) => state.currentEComStore, - getProductStores: (state) => state.current.stores, + getProductStores: (state) => state.eComStores, getCurrentTimeZone: (state) => state.currentTimeZoneId }, actions: { @@ -83,24 +83,25 @@ export const useUserStore = defineStore('user', { const authStore = useAuthStore(); try { - const response = await productStoreContext.getEComStores(authStore.getToken.value, authStore.getBaseUrl, facilityId); - this.current.stores = response; + const response = await productStoreContext.getEComStores(authStore.getToken.value, authStore.getBaseUrl, 100, facilityId); + this.eComStores = response; } catch (error) { console.error(error); } - return this.current.stores + return this.eComStores }, - async getPreferredStore(userPrefTypeId: any) { - let preferredStore = {} as any; + async getEComStorePreference(userPrefTypeId: any) { const authStore = useAuthStore(); - preferredStore = this.current.stores[0]; + if(!this.eComStores) { + return; + } + let preferredStore = this.eComStores[0]; try { - let preferredStoreId = ''; - preferredStoreId = await productStoreContext.getUserPreference(authStore.getToken.value, authStore.getBaseUrl, userPrefTypeId); + let preferredStoreId = await productStoreContext.getUserPreference(authStore.getToken.value, authStore.getBaseUrl, userPrefTypeId); if(preferredStoreId) { - const store = this.current.stores.find((store: any) => store.productStoreId === preferredStoreId); + const store = this.eComStores.find((store: any) => store.productStoreId === preferredStoreId); store && (preferredStore = store) } } catch (error) { @@ -108,11 +109,8 @@ export const useUserStore = defineStore('user', { } this.currentEComStore = preferredStore; }, - async setEComStore(payload: any) { - const currentEComStore = JSON.parse(JSON.stringify(this.getCurrentEComStore)) - if(!payload) { - this.currentEComStore = currentEComStore - } + async setEComStorePreference(payload: any) { + try { await productStoreContext.setUserPreference({ userPrefTypeId: 'SELECTED_BRAND', From a920ed6e8afecdf1b4f9e45d99a900c04dfd4567 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 21 Oct 2024 11:17:12 +0530 Subject: [PATCH 06/11] Improved: Updated @ionChange handler to use ($event.detail.value) instead of $event(#193) --- src/components/DxpProductStoreSelector.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue index a3eef6be..31ae394a 100644 --- a/src/components/DxpProductStoreSelector.vue +++ b/src/components/DxpProductStoreSelector.vue @@ -14,7 +14,7 @@ - + {{ store.storeName }} @@ -32,9 +32,9 @@ const emit = defineEmits(["updateEcomStore"]) const eComStores = computed(() => userStore.getProductStores); const currentEComStore = computed(() => userStore.getCurrentEComStore); -async function updateEComStore(event: any) { - if (event.target.value && currentEComStore.value?.productStoreId !== event.detail.value) { - const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == event.detail.value) +async function updateEComStore(eComStoreId: any) { + if (eComStoreId && currentEComStore.value?.productStoreId !== eComStoreId) { + const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == eComStoreId) await userStore.setEComStorePreference(selectedProductStore) emit('updateEcomStore', selectedProductStore) } From 1239e91366cac4c91400a55e4dcc6f3974e59131 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 22 Oct 2024 18:59:38 +0530 Subject: [PATCH 07/11] Improved: added checks & replaced the oms-api `getEComStores` with `getEComStoresByFacility`(#193) --- src/components/DxpProductStoreSelector.vue | 8 +++----- src/index.ts | 2 +- src/store/user.ts | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue index 31ae394a..07f91429 100644 --- a/src/components/DxpProductStoreSelector.vue +++ b/src/components/DxpProductStoreSelector.vue @@ -33,10 +33,8 @@ const eComStores = computed(() => userStore.getProductStores); const currentEComStore = computed(() => userStore.getCurrentEComStore); async function updateEComStore(eComStoreId: any) { - if (eComStoreId && currentEComStore.value?.productStoreId !== eComStoreId) { - const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == eComStoreId) - await userStore.setEComStorePreference(selectedProductStore) - emit('updateEcomStore', selectedProductStore) - } + const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == eComStoreId) + await userStore.setEComStorePreference(selectedProductStore) + emit('updateEcomStore', selectedProductStore) } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e92ef283..083a791b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -99,7 +99,7 @@ export let dxpComponents = { productIdentificationContext.getProductIdentificationPref = options.getProductIdentificationPref productIdentificationContext.setProductIdentificationPref = options.setProductIdentificationPref - productStoreContext.getEComStores = options.getEComStores + productStoreContext.getEComStoresByFacility = options.getEComStoresByFacility productStoreContext.setUserPreference = options.setUserPreference productStoreContext.getUserPreference = options.getUserPreference diff --git a/src/store/user.ts b/src/store/user.ts index 8f644eb5..c2e3e10f 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -79,11 +79,11 @@ export const useUserStore = defineStore('user', { updateTimeZone(tzId: string) { this.currentTimeZoneId = tzId }, - async getEComStores(facilityId?: any) { + async getEComStoresByFacility(facilityId?: any) { const authStore = useAuthStore(); try { - const response = await productStoreContext.getEComStores(authStore.getToken.value, authStore.getBaseUrl, 100, facilityId); + const response = await productStoreContext.getEComStoresByFacility(authStore.getToken.value, authStore.getBaseUrl, 100, facilityId); this.eComStores = response; } catch (error) { console.error(error); @@ -93,7 +93,7 @@ export const useUserStore = defineStore('user', { async getEComStorePreference(userPrefTypeId: any) { const authStore = useAuthStore(); - if(!this.eComStores) { + if(!this.eComStores.length) { return; } let preferredStore = this.eComStores[0]; From afe0d0483ff4727de16bd96cb5ffbf483ab9bc22 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 23 Oct 2024 18:30:21 +0530 Subject: [PATCH 08/11] Improved: update the proper case for eCom(#193) --- src/components/DxpProductStoreSelector.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DxpProductStoreSelector.vue b/src/components/DxpProductStoreSelector.vue index 07f91429..fa227245 100644 --- a/src/components/DxpProductStoreSelector.vue +++ b/src/components/DxpProductStoreSelector.vue @@ -27,7 +27,7 @@ import { useUserStore } from 'src'; import { computed } from 'vue'; const userStore = useUserStore(); -const emit = defineEmits(["updateEcomStore"]) +const emit = defineEmits(["updateEComStore"]) const eComStores = computed(() => userStore.getProductStores); const currentEComStore = computed(() => userStore.getCurrentEComStore); @@ -35,6 +35,6 @@ const currentEComStore = computed(() => userStore.getCurrentEComStore); async function updateEComStore(eComStoreId: any) { const selectedProductStore = eComStores.value.find((store: any) => store.productStoreId == eComStoreId) await userStore.setEComStorePreference(selectedProductStore) - emit('updateEcomStore', selectedProductStore) + emit('updateEComStore', selectedProductStore) } \ No newline at end of file From b9f7e49f54ddb8d123cf5266aa3f547fa9da0860 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 23 Oct 2024 18:45:23 +0530 Subject: [PATCH 09/11] Improved: added comments for api related to facility and productStores(#193) --- src/store/user.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/store/user.ts b/src/store/user.ts index 048745d6..c934c477 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -84,6 +84,7 @@ export const useUserStore = defineStore('user', { updateTimeZone(tzId: string) { this.currentTimeZoneId = tzId }, + // Facility api calls - retrieve user facilities & get/set preferred facility async getUserFacilities(partyId: any, facilityGroupId: any, isAdminUser: boolean) { const authStore = useAuthStore(); @@ -126,6 +127,7 @@ export const useUserStore = defineStore('user', { } this.currentFacility = payload; }, + // ECom store api calls - fetch stores by facility & get/set user store preferences async getEComStoresByFacility(facilityId?: any) { const authStore = useAuthStore(); From 1939fbdfbe0c95583a4b0555aaf813be4b6fe7bc Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 23 Oct 2024 18:50:42 +0530 Subject: [PATCH 10/11] Improved: imported missing appContext in DxpProductIdentifier (#193) --- src/components/DxpProductIdentifier.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DxpProductIdentifier.vue b/src/components/DxpProductIdentifier.vue index 42940ca6..320dbd77 100644 --- a/src/components/DxpProductIdentifier.vue +++ b/src/components/DxpProductIdentifier.vue @@ -30,6 +30,7 @@ import { IonCard, IonCardContent, IonCardHeader, IonCardTitle, IonItem, IonSelec import { useProductIdentificationStore } from 'src/store/productIdentification'; import { useUserStore } from 'src/store/user' import { computed, onMounted } from 'vue'; +import { appContext } from "../index"; const productIdentificationStore = useProductIdentificationStore(); const userStore = useUserStore() From 64ee14f1951c8e9b4be81cbcadb0ae44518a0ddf Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 23 Oct 2024 19:02:24 +0530 Subject: [PATCH 11/11] Removed: Updated the code and removed the unnecessary changes in the auth.ts file(#193) --- src/store/auth.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/store/auth.ts b/src/store/auth.ts index 094ce3a4..c9f2cf8b 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -1,5 +1,3 @@ -declare const process: any; - import { defineStore } from "pinia"; import { DateTime } from 'luxon'