From 4490cd1066eb440c3d4495126e8dd85f57c46b30 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 12 Oct 2023 10:35:01 +0530 Subject: [PATCH 1/5] Implemented: product Identifier, EComStore service and actions (dxp/178) --- package-lock.json | 139 ++++++++++++++++++++--- package.json | 2 +- src/App.vue | 8 +- src/adapter/index.ts | 4 +- src/components/Picklist-detail-item.vue | 13 ++- src/main.ts | 6 +- src/services/UserService.ts | 42 ++++++- src/store/modules/user/UserState.ts | 1 + src/store/modules/user/actions.ts | 21 +++- src/store/modules/user/getters.ts | 3 + src/store/modules/user/index.ts | 1 + src/store/modules/user/mutation-types.ts | 1 + src/store/modules/user/mutations.ts | 3 + src/views/Settings.vue | 2 + 14 files changed, 218 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index f554daa..0ef5b17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@capacitor/ios": "^2.5.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", - "@hotwax/dxp-components": "^1.7.5", + "@hotwax/dxp-components": "^1.8.0", "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", @@ -3117,18 +3117,20 @@ "integrity": "sha512-yokhlpG+eUEao19vaUtCOC5YwcYTb5sf5joGVH17mbb5B1hM4G+P4ZiGiFw2AMmZBKgu94DtHwSyjtdsf4bHug==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.7.5.tgz", - "integrity": "sha512-1mkomu1JzEck7fwZwb8TxzUSdooWIfNj+uuDFhxrBPnrZWwUbjKQqr2mIv8unV4HA7qoqDIyoAKFDSeEaX1HNA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.8.0.tgz", + "integrity": "sha512-391++6B7oNxKqaWVGwpDhf1vRACdObfu5K7zxy60ZGknQ1bY11da+RSVk9/90IDkCg32mLbBP2I+GQ29hlG10g==", "dependencies": { "@hotwax/oms-api": "^1.8.1", "@ionic/core": "^6.7.5", "@ionic/vue": "^6.7.5", + "@types/vue-barcode-reader": "^0.0.0", "firebase": "^10.3.1", "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", "vue": "^3.3.4", + "vue-barcode-reader": "^1.0.3", "vue-i18n": "^9.2.2" } }, @@ -4833,6 +4835,65 @@ "source-map": "^0.6.1" } }, + "node_modules/@types/vue-barcode-reader": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/@types/vue-barcode-reader/-/vue-barcode-reader-0.0.0.tgz", + "integrity": "sha512-yngQhd35qGjCxMXWIqsAtF7qmxe0qUYRVd9qW5I/CcRPWDdBpqVkHnQSh6ro5BIBl3NQ3ppky7kMKS4pr+XwCQ==", + "dependencies": { + "vue": "^2.0.0" + } + }, + "node_modules/@types/vue-barcode-reader/node_modules/@vue/compiler-sfc": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.14.tgz", + "integrity": "sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==", + "dependencies": { + "@babel/parser": "^7.18.4", + "postcss": "^8.4.14", + "source-map": "^0.6.1" + } + }, + "node_modules/@types/vue-barcode-reader/node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/@types/vue-barcode-reader/node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/@types/vue-barcode-reader/node_modules/vue": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz", + "integrity": "sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==", + "dependencies": { + "@vue/compiler-sfc": "2.7.14", + "csstype": "^3.1.0" + } + }, "node_modules/@types/webpack": { "version": "4.41.33", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.33.tgz", @@ -25334,9 +25395,15 @@ "optional": true }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -36758,18 +36825,20 @@ "integrity": "sha512-yokhlpG+eUEao19vaUtCOC5YwcYTb5sf5joGVH17mbb5B1hM4G+P4ZiGiFw2AMmZBKgu94DtHwSyjtdsf4bHug==" }, "@hotwax/dxp-components": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.7.5.tgz", - "integrity": "sha512-1mkomu1JzEck7fwZwb8TxzUSdooWIfNj+uuDFhxrBPnrZWwUbjKQqr2mIv8unV4HA7qoqDIyoAKFDSeEaX1HNA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.8.0.tgz", + "integrity": "sha512-391++6B7oNxKqaWVGwpDhf1vRACdObfu5K7zxy60ZGknQ1bY11da+RSVk9/90IDkCg32mLbBP2I+GQ29hlG10g==", "requires": { "@hotwax/oms-api": "^1.8.1", "@ionic/core": "^6.7.5", "@ionic/vue": "^6.7.5", + "@types/vue-barcode-reader": "^0.0.0", "firebase": "^10.3.1", "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", "vue": "^3.3.4", + "vue-barcode-reader": "^1.0.3", "vue-i18n": "^9.2.2" }, "dependencies": { @@ -38172,6 +38241,50 @@ "source-map": "^0.6.1" } }, + "@types/vue-barcode-reader": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/@types/vue-barcode-reader/-/vue-barcode-reader-0.0.0.tgz", + "integrity": "sha512-yngQhd35qGjCxMXWIqsAtF7qmxe0qUYRVd9qW5I/CcRPWDdBpqVkHnQSh6ro5BIBl3NQ3ppky7kMKS4pr+XwCQ==", + "requires": { + "vue": "^2.0.0" + }, + "dependencies": { + "@vue/compiler-sfc": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.14.tgz", + "integrity": "sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==", + "requires": { + "@babel/parser": "^7.18.4", + "postcss": "^8.4.14", + "source-map": "^0.6.1" + } + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "vue": { + "version": "2.7.14", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz", + "integrity": "sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==", + "requires": { + "@vue/compiler-sfc": "2.7.14", + "csstype": "^3.1.0" + } + } + } + }, "@types/webpack": { "version": "4.41.33", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.33.tgz", @@ -54318,9 +54431,9 @@ "optional": true }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==" + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" }, "nanomatch": { "version": "1.2.13", diff --git a/package.json b/package.json index 3a2e149..e869faa 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@capacitor/ios": "^2.5.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", - "@hotwax/dxp-components": "^1.7.5", + "@hotwax/dxp-components": "^1.8.0", "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", diff --git a/src/App.vue b/src/App.vue index a43ffdd..d460fb2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,7 @@ import emitter from "@/event-bus" import { mapGetters, useStore } from 'vuex'; import { initialise, resetConfig } from '@/adapter' import { useRouter } from 'vue-router'; +import { useProductIdentificationStore } from '@hotwax/dxp-components'; export default defineComponent({ name: 'App', @@ -28,7 +29,8 @@ export default defineComponent({ computed: { ...mapGetters({ userToken: 'user/getUserToken', - instanceUrl: 'user/getInstanceUrl' + instanceUrl: 'user/getInstanceUrl', + currentEComStore: 'user/getCurrentEComStore' }) }, methods: { @@ -80,6 +82,10 @@ export default defineComponent({ }); emitter.on('presentLoader', this.presentLoader); emitter.on('dismissLoader', this.dismissLoader); + + // Get product identification from api using dxp-component + await useProductIdentificationStore().getIdentificationPref(this.currentEComStore?.productStoreId) + .catch((error) => console.error(error)); }, unmounted() { emitter.off('presentLoader', this.presentLoader); diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 99fa835..5183930 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -1,11 +1,13 @@ -import { api, client, getConfig, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' +import { api, client, getConfig, getProductIdentificationPref, initialise, resetConfig, setProductIdentificationPref, updateInstanceUrl, updateToken } from '@hotwax/oms-api' export { api, client, getConfig, + getProductIdentificationPref, initialise, resetConfig, + setProductIdentificationPref, updateInstanceUrl, updateToken } \ No newline at end of file diff --git a/src/components/Picklist-detail-item.vue b/src/components/Picklist-detail-item.vue index dbb12ed..7dca82a 100644 --- a/src/components/Picklist-detail-item.vue +++ b/src/components/Picklist-detail-item.vue @@ -5,8 +5,8 @@

{{ getProduct(picklistItem.productId).parentProductName}}

-

{{ getProduct(picklistItem.productId).productName}}

-

{{ picklistItem.productId }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(picklistItem.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(picklistItem.productId)) : getProduct(picklistItem.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(picklistItem.productId)) }}

{{ $t("Color") }} : {{ $filters.getFeatures(getProduct(picklistItem.productId).featureHierarchy, '1/COLOR/') }}

{{ $t("Size") }} : {{ $filters.getFeatures(getProduct(picklistItem.productId).featureHierarchy, '1/SIZE/') }}

@@ -16,9 +16,9 @@