From cd140a4297a050d8f1943459ced471ca46f1990a Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Mon, 11 Mar 2024 18:01:35 +0530 Subject: [PATCH] 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,