Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: appVersionInfo component from dxp-components on settings page. (#618) #640

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"Blank": "Blank",
"Brokering": "Brokering",
"Brokering queue": "Brokering queue",
"Built: ": "Built: {builtDateTime}",
"Browser TimeZone": "Browser TimeZone",
"Browser time zone": "Browser time zone",
"Bulk editor": "Bulk editor",
Expand Down Expand Up @@ -304,6 +305,7 @@
"Upload Pending Process": "Upload Pending Process",
"Use POs to manage catalog": "Use POs to manage catalog",
"Username": "Username",
"Version: ": "Version: {appVersion}",
"View catalog": "View catalog",
"Webhook subscribed successfully": "Webhook subscribed successfully",
"Webhook unsubscribed successfully": "Webhook unsubscribed successfully",
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export default interface UserState {
shopifyConfigs: any;
currentShopifyConfig: any;
productStoreCategories: any;
pwaState: any;
}
3 changes: 3 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ const actions: ActionTree<UserState, RootState> = {
updateInstanceUrl(payload)
},

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

async getShopifyConfig({ commit }, productStoreId) {
if (!productStoreId) {
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const getters: GetterTree <UserState, RootState> = {
getProductStoreCategories(state) {
return state.productStoreCategories;
},
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 @@ -18,7 +18,11 @@ const userModule: Module<UserState, RootState> = {
productStoreId: "",
storeName: "None"
},
productStoreCategories: {}
productStoreCategories: {},
pwaState: {
updateExists: false,
registration: null,
},
},
getters,
actions,
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/user/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const USER_SHOPIFY_CONFIGS_UPDATED = SN_USER + '/SHOPIFY_CONFIGS_UPDATED'
export const USER_CURRENT_SHOPIFY_CONFIG_UPDATED = SN_USER + '/SHOPIFY_CONFIG_UPDATED'
export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED'
export const USER_PERMISSIONS_UPDATED = SN_USER + '/PERMISSIONS_UPDATED'
export const USER_PWA_STATE_UPDATED = SN_USER + '/PWA_STATE_UPDATED'
export const USER_PRDCT_STR_CATGRS_UPDATED = SN_USER + '/PRDCT_STR_CATGRS_UPDATED'
4 changes: 4 additions & 0 deletions src/store/modules/user/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const mutations: MutationTree <UserState> = {
[types.USER_PRDCT_STR_CATGRS_UPDATED] (state, payload) {
state.productStoreCategories = payload
},
[types.USER_PWA_STATE_UPDATED] (state, payload) {
state.pwaState.registration = payload.registration;
state.pwaState.updateExists = payload.updateExists;
},
[types.USER_CURRENT_ECOM_STORE_UPDATED] (state, payload) {
state.currentEComStore = payload;
},
Expand Down
20 changes: 2 additions & 18 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,7 @@
</ion-card>
</section>
<hr />

<div class="section-header">
<h1>
{{ translate('App') }}
<p class="overline" >{{ "Version: " + appVersion }}</p>
</h1>
<p class="overline">{{ "Built: " + getDateTime(appInfo.builtTime) }}</p>
</div>
<DxpAppVersionInfo />

<section>
<DxpTimeZoneSwitcher @timeZoneUpdated="timeZoneUpdated" />
Expand All @@ -99,7 +92,6 @@ import { codeWorkingOutline, ellipsisVertical, personCircleOutline, openOutline,
import { mapGetters, useStore } from 'vuex';
import { useRouter } from 'vue-router';
import Image from '@/components/Image.vue'
import { DateTime } from 'luxon';
import { translate } from '@hotwax/dxp-components';

export default defineComponent({
Expand All @@ -126,9 +118,7 @@ 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: ""
baseURL: process.env.VUE_APP_BASE_URL
};
},
computed: {
Expand All @@ -139,9 +129,6 @@ export default defineComponent({
currentShopifyConfig: 'user/getCurrentShopifyConfig',
})
},
mounted() {
this.appVersion = this.appInfo.branch ? (this.appInfo.branch + "-" + this.appInfo.revision) : this.appInfo.tag;
},
methods: {
setEComStore(event: any) {
// If the value is same, no need to update
Expand All @@ -168,9 +155,6 @@ export default defineComponent({
}
})
},
getDateTime(time: any) {
return DateTime.fromMillis(time).toLocaleString(DateTime.DATETIME_MED);
},
goToLaunchpad() {
window.location.href = `${process.env.VUE_APP_LOGIN_URL}`
}
Expand Down
Loading