From cd140a4297a050d8f1943459ced471ca46f1990a Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Mon, 11 Mar 2024 18:01:35 +0530 Subject: [PATCH 1/4] Implemented: app version component from dxp-components(#214) --- src/locales/en.json | 2 ++ src/locales/index.ts | 5 +++++ src/main.ts | 2 ++ src/store/modules/user/UserState.ts | 1 + src/store/modules/user/actions.ts | 3 +++ src/store/modules/user/getters.ts | 3 +++ src/store/modules/user/index.ts | 6 +++++- src/store/modules/user/mutation-types.ts | 3 ++- src/store/modules/user/mutations.ts | 6 +++++- src/views/Settings.vue | 10 +++------- tsconfig.json | 1 + 11 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 src/locales/index.ts diff --git a/src/locales/en.json b/src/locales/en.json index 61d01859..39bd6a03 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -3,6 +3,7 @@ "Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to {timeZoneId}?", "Authenticating": "Authenticating", "Back to Launchpad": "Back to Launchpad", + "Built: ": "Built: {builtDateTime}", "Camera permission denied.": "Camera permission denied.", "Cancel": "Cancel", "Change": "Change", @@ -80,6 +81,7 @@ "Variance": "Variance", "Variance reason": "Variance reason", "Variance updated successfully": "Variance updated successfully", + "Version: ": "Version: {appVersion}", "View": "View", "You do not have permission to access the app.": "You do not have permission to access the app.", "You do not have permission to access this page": "You do not have permission to access this page" diff --git a/src/locales/index.ts b/src/locales/index.ts new file mode 100644 index 00000000..83e39f0d --- /dev/null +++ b/src/locales/index.ts @@ -0,0 +1,5 @@ +import en from "./en.json" + +export default { + "en-US": en +}; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 832b6199..b96376cc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,6 +34,7 @@ import permissionActions from '@/authorization/Actions'; import { dxpComponents } from '@hotwax/dxp-components' import { login, logout, loader } from './user-utils'; import { getConfig, getProductIdentificationPref, initialise, setProductIdentificationPref } from '@/adapter'; +import localeMessages from './locales'; const app = createApp(App) .use(IonicVue, { @@ -55,6 +56,7 @@ const app = createApp(App) getConfig, getProductIdentificationPref, initialise, + localeMessages, setProductIdentificationPref }); diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index 4c0f3e99..05dd8f8f 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -3,6 +3,7 @@ export default interface UserState { current: any; currentFacility: object | null; permissions: any; + pwaState: any; instanceUrl: string; config: any; currentEComStore: any; diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 64b43c00..77894a0d 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -196,5 +196,8 @@ const actions: ActionTree = { updateViewQOHConfig({ commit }, config) { commit(types.USER_VIEW_QOH_CNFG_UPDATED, config) }, + + updatePwaState({ commit }, payload) { + commit(types.USER_PWA_STATE_UPDATED, payload); } export default actions; \ No newline at end of file diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index d51e65ac..fabce843 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -35,6 +35,9 @@ const getters: GetterTree = { }, getViewQOHConfig (state) { return state.config; + }, + getPwaState(state) { + return state.pwaState; } } export default getters; \ No newline at end of file diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 869a2065..2a5c26cb 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -17,7 +17,11 @@ const userModule: Module = { currentQOHViewConfig: {}, viewQOH: false }, - currentEComStore: {} + currentEComStore: {}, + pwaState: { + updateExists: false, + registration: null, + } }, getters, actions, diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index 8cbb2ccc..5f1b9075 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -6,4 +6,5 @@ export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATE 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_VIEW_QOH_CNFG_UPDATED = SN_USER + '/VIEW_QOH_CNFG_UPDATED' \ No newline at end of file +export const USER_VIEW_QOH_CNFG_UPDATED = SN_USER + '/VIEW_QOH_CNFG_UPDATED' +export const USER_PWA_STATE_UPDATED = SN_USER + '/PWA_STATE_UPDATED' \ No newline at end of file diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index 323e54ee..d579ac00 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -32,6 +32,10 @@ const mutations: MutationTree = { [types.USER_VIEW_QOH_CNFG_UPDATED] (state, payload) { state.config.viewQOH = payload.viewQOH; state.config.currentQOHViewConfig = payload.currentQOHViewConfig; - } + }, + [types.USER_PWA_STATE_UPDATED](state, payload) { + state.pwaState.registration = payload.registration; + state.pwaState.updateExists = payload.updateExists; + }, } export default mutations; \ No newline at end of file diff --git a/src/views/Settings.vue b/src/views/Settings.vue index a9e2777f..ab67cccb 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -53,13 +53,9 @@
-
-

- {{ $t('App') }} -

{{ "Version: " + appVersion }}

-

-

{{ "Built: " + getDateTime(appInfo.builtTime) }}

-
+ + +
diff --git a/tsconfig.json b/tsconfig.json index bc100c11..60af2769 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "jsx": "preserve", "importHelpers": true, "moduleResolution": "node", + "resolveJsonModule": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, From 7ce3f3126cf66e8ce78ddfdb3d3d4447f53749d4 Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Mon, 11 Mar 2024 18:12:23 +0530 Subject: [PATCH 2/4] Fixed: syntax error --- src/store/modules/user/actions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 77894a0d..69b8c516 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -199,5 +199,6 @@ const actions: ActionTree = { updatePwaState({ commit }, payload) { commit(types.USER_PWA_STATE_UPDATED, payload); + } } export default actions; \ No newline at end of file From 0444400c7842347e9f5d6243687af26d40b695e1 Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Mon, 11 Mar 2024 19:44:45 +0530 Subject: [PATCH 3/4] Improved: code by removing unused code --- src/views/Settings.vue | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/views/Settings.vue b/src/views/Settings.vue index ab67cccb..4334c8ef 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -132,15 +132,10 @@ export default defineComponent({ data() { return { baseURL: process.env.VUE_APP_BASE_URL, - appInfo: (process.env.VUE_APP_VERSION_INFO ? JSON.parse(process.env.VUE_APP_VERSION_INFO) : {}) as any, - appVersion: "", currentFacilityId: "", currentQOHViewConfig: {} as any }; }, - mounted() { - this.appVersion = this.appInfo.branch ? (this.appInfo.branch + "-" + this.appInfo.revision) : this.appInfo.tag; - }, ionViewWillEnter() { this.currentFacilityId = this.currentFacility.facilityId; this.getViewQOHConfig(); @@ -266,9 +261,6 @@ export default defineComponent({ }, goToLaunchpad() { window.location.href = `${process.env.VUE_APP_LOGIN_URL}` - }, - getDateTime(time: any) { - return DateTime.fromMillis(time).toLocaleString(DateTime.DATETIME_MED); } }, setup(){ From e7fc801533dd5305faaf1b627df1d7139207d242 Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Tue, 12 Mar 2024 12:59:51 +0530 Subject: [PATCH 4/4] Improved: code by removing unused imports --- src/views/Settings.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 4334c8ef..b5ffb474 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -99,7 +99,6 @@ import { codeWorkingOutline, ellipsisVertical, personCircleOutline, storefrontOu import { mapGetters, useStore } from 'vuex'; import { useRouter } from 'vue-router'; import Image from '@/components/Image.vue' -import { DateTime } from 'luxon'; import TimeZoneModal from '@/views/TimezoneModal.vue'; import { Actions, hasPermission } from '@/authorization' import { UserService } from '@/services/UserService'