From ff7546065b8c3725ab5d59addd1dfb37f8fffc1a Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 7 Nov 2023 14:16:08 +0530 Subject: [PATCH 1/2] Implemented: support to show timeZone of browser and user, renamed component to have prefix Dxp and handled case of undefined for setUserLocale method --- ...{MenuFooterNavigation.vue => DxpMenuFooterNavigation.vue} | 5 ++++- src/components/index.ts | 2 +- src/index.ts | 5 +++-- src/store/user.ts | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) rename src/components/{MenuFooterNavigation.vue => DxpMenuFooterNavigation.vue} (89%) diff --git a/src/components/MenuFooterNavigation.vue b/src/components/DxpMenuFooterNavigation.vue similarity index 89% rename from src/components/MenuFooterNavigation.vue rename to src/components/DxpMenuFooterNavigation.vue index 4a5f6d78..6050f548 100644 --- a/src/components/MenuFooterNavigation.vue +++ b/src/components/DxpMenuFooterNavigation.vue @@ -5,7 +5,7 @@

{{ instanceUrl }}

- {{ userAppState.userProfile?.userTimeZone }} + {{ userAppState.userProfile?.userTimeZone }} @@ -50,4 +50,7 @@ const userAppState = computed(() => ({ shopifyConfigs: appState.getters['user/getShopifyConfigs'], currentShopifyConfig: appState.getters['user/getCurrentShopifyConfig'] })); + +// Accessing browser timeZone to check for timeZone diff of the app and browser +const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone diff --git a/src/components/index.ts b/src/components/index.ts index 2607183f..ad943b47 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -18,7 +18,7 @@ export { default as DxpImage } from './DxpImage.vue'; export { default as DxpUserProfile } from './DxpUserProfile.vue' export { default as AppVersionInfo } from './AppVersionInfo.vue'; export { default as LanguageSwitcher } from './LanguageSwitcher.vue'; -export { default as MenuFooterNavigation } from './MenuFooterNavigation.vue'; +export { default as DxpMenuFooterNavigation } from './DxpMenuFooterNavigation.vue'; export { default as OmsInstanceNavigator } from './OmsInstanceNavigator.vue' export { default as ProductIdentifier } from "./ProductIdentifier.vue"; export { default as Scanner } from './Scanner.vue'; diff --git a/src/index.ts b/src/index.ts index c06353d7..2cb851c4 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 { AppVersionInfo, DxpImage, DxpUserProfile, LanguageSwitcher, MenuFooterNavigation, OmsInstanceNavigator, ProductIdentifier, Scanner, ShopifyImg } from "./components"; +import { AppVersionInfo, DxpImage, DxpUserProfile, LanguageSwitcher, DxpMenuFooterNavigation, OmsInstanceNavigator, ProductIdentifier, Scanner, ShopifyImg } from "./components"; import Login from "./components/Login"; import { goToOms, getProductIdentificationValue } from "./utils"; import { initialiseFirebaseApp } from "./utils/firebase" @@ -48,7 +48,7 @@ export let dxpComponents = { app.component('DxpUserProfile', DxpUserProfile) app.component('LanguageSwitcher', LanguageSwitcher) app.component('Login', Login) - app.component('MenuFooterNavigation', MenuFooterNavigation) + app.component('DxpMenuFooterNavigation', DxpMenuFooterNavigation) app.component('OmsInstanceNavigator', OmsInstanceNavigator) app.component('ProductIdentifier', ProductIdentifier) app.component('Scanner', Scanner) @@ -86,6 +86,7 @@ export { appContext, DxpImage, DxpUserProfile, + DxpMenuFooterNavigation, getProductIdentificationValue, goToOms, i18n, diff --git a/src/store/user.ts b/src/store/user.ts index 1dea5a0b..f83e169e 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -26,7 +26,8 @@ export const useUserStore = defineStore('user', { matchingLocale = matchingLocale || Object.keys(this.localeOptions).find((option: string) => option.slice(0, 2) === locale.slice(0, 2)) newLocale = matchingLocale || this.locale // update locale in state and globally - await userContext.setUserLocale({ newLocale }) + console.log('setting up locale for user', userContext.setUserLocale) + if(userContext.setUserLocale) await userContext.setUserLocale({ newLocale }) } } catch (error) { console.error(error) From eba643bacfe110dd29bc862da7d75c2ea6688189 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 7 Nov 2023 14:18:10 +0530 Subject: [PATCH 2/2] Removed: unwanted console statement --- src/store/user.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/store/user.ts b/src/store/user.ts index f83e169e..e8b02f15 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -26,7 +26,6 @@ export const useUserStore = defineStore('user', { matchingLocale = matchingLocale || Object.keys(this.localeOptions).find((option: string) => option.slice(0, 2) === locale.slice(0, 2)) newLocale = matchingLocale || this.locale // update locale in state and globally - console.log('setting up locale for user', userContext.setUserLocale) if(userContext.setUserLocale) await userContext.setUserLocale({ newLocale }) } } catch (error) {