From 28c6fd8ed706f370499b5b4a39cac8fd5b657694 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 12 Sep 2024 14:49:12 +0530 Subject: [PATCH 1/2] Implemented: Added the support for using facility selector from dxp-component(dxp/228) --- package-lock.json | 454 ++++-------------- package.json | 4 +- src/adapter/index.ts | 6 +- src/components/Menu.vue | 6 +- .../NotificationPreferenceModal.vue | 10 +- src/components/TransferOrderFilters.vue | 12 +- src/main.ts | 9 +- src/services/UtilService.ts | 5 +- src/store/modules/carrier/actions.ts | 8 +- src/store/modules/order/actions.ts | 30 +- src/store/modules/stock/actions.ts | 6 +- src/store/modules/stock/getters.ts | 7 +- src/store/modules/transferorder/actions.ts | 12 +- src/store/modules/user/UserState.ts | 1 - src/store/modules/user/actions.ts | 13 +- src/store/modules/user/getters.ts | 3 - src/store/modules/user/index.ts | 1 - src/store/modules/user/mutations.ts | 4 - src/views/AssignPickerModal.vue | 12 +- src/views/Completed.vue | 12 +- src/views/DownloadPackedOrders.vue | 12 +- src/views/InProgress.vue | 16 +- src/views/OpenOrders.vue | 12 +- src/views/OrderDetail.vue | 16 +- src/views/Settings.vue | 64 +-- src/views/TransferOrderDetail.vue | 1 - src/views/TransferOrders.vue | 10 +- src/views/UploadImportOrders.vue | 8 +- 28 files changed, 256 insertions(+), 498 deletions(-) diff --git a/package-lock.json b/package-lock.json index 794d8fcd..3f90383c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", - "@hotwax/oms-api": "^1.14.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "file:../oms-api", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "^7.6.0", @@ -59,6 +59,65 @@ "typescript": "~4.7.4" } }, + "../dxp-components": { + "name": "@hotwax/dxp-components", + "version": "1.15.2", + "license": "Apache-2.0", + "dependencies": { + "@hotwax/oms-api": "^1.8.1", + "@ionic/core": "^7.6.0", + "@ionic/vue": "^7.6.0", + "firebase": "^10.3.1", + "luxon": "^3.3.0", + "pinia": "2.0.36", + "pinia-plugin-persistedstate": "^3.1.0", + "register-service-worker": "^1.7.2", + "vue": "^3.3.4", + "vue-i18n": "^9.2.2", + "vue-markdown-render": "^2.2.1" + }, + "devDependencies": { + "@babel/types": "^7.22.11", + "@types/luxon": "^3.3.0", + "@types/node": "^20.5.7", + "@vitejs/plugin-vue": "^4.3.4", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^11.0.3", + "@vue/tsconfig": "^0.1.3", + "eslint": "^8.48.0", + "eslint-plugin-vue": "^9.17.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "~4.7.4", + "vite": "^4.4.9", + "vue-tsc": "^1.8.8" + } + }, + "../oms-api": { + "name": "@hotwax/oms-api", + "version": "1.15.0", + "license": "Apache-2.0", + "dependencies": { + "@types/node-json-transform": "^1.0.0", + "axios": "^0.21.1", + "axios-cache-adapter": "^2.7.3", + "deepmerge": "^4.3.0", + "http-status-codes": "^2.2.0", + "node-json-transform": "^1.1.2", + "qs": "^6.11.0" + }, + "devDependencies": { + "@babel/cli": "^7.18.10", + "@babel/core": "^7.18.10", + "@babel/preset-env": "^7.18.10", + "@babel/preset-typescript": "^7.18.6", + "@types/qs": "^6.9.7", + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "babel-plugin-module-resolver": "^4.1.0", + "eslint": "^8.16.0", + "typescript": "^4.7.2" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -2798,177 +2857,12 @@ "integrity": "sha512-zpUjGoY7LBlKeiP0V7tonrmoey8HQ5THQmyixQ+IDtrjmEJNBjynW/Ef3gC0FUNNPuVqxWPZdT5CVgaETLGTwg==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.2.tgz", - "integrity": "sha512-0jF1xkRIVrDbJwUaaPwWUhp3cVBpdjgAJO/fOQ4XYjzKb8rYXgw0Xm/qHHUnSeAZW5laMnQrm1KtPZp8szu4dQ==", - "dependencies": { - "@hotwax/oms-api": "^1.8.1", - "@ionic/core": "^7.6.0", - "@ionic/vue": "^7.6.0", - "firebase": "^10.3.1", - "luxon": "^3.3.0", - "pinia": "2.0.36", - "pinia-plugin-persistedstate": "^3.1.0", - "register-service-worker": "^1.7.2", - "vue": "^3.3.4", - "vue-i18n": "^9.2.2", - "vue-markdown-render": "^2.2.1" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/@vue/reactivity": { - "version": "3.4.21", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.21.tgz", - "integrity": "sha512-UhenImdc0L0/4ahGCyEzc/pZNwVgcglGy9HVzJ1Bq2Mm9qXOpP8RyNTjookw/gOCUlXSEtuZ2fUg5nrHcoqJcw==", - "dependencies": { - "@vue/shared": "3.4.21" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/@vue/runtime-core": { - "version": "3.4.21", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.21.tgz", - "integrity": "sha512-pQthsuYzE1XcGZznTKn73G0s14eCJcjaLvp3/DKeYWoFacD9glJoqlNBxt3W2c5S40t6CCcpPf+jG01N3ULyrA==", - "dependencies": { - "@vue/reactivity": "3.4.21", - "@vue/shared": "3.4.21" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/@vue/runtime-dom": { - "version": "3.4.21", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.21.tgz", - "integrity": "sha512-gvf+C9cFpevsQxbkRBS1NpU8CqxKw0ebqMvLwcGQrNpx6gqRDodqKqA+A2VZZpQ9RpK2f9yfg8VbW/EpdFUOJw==", - "dependencies": { - "@vue/runtime-core": "3.4.21", - "@vue/shared": "3.4.21", - "csstype": "^3.1.3" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/@vue/server-renderer": { - "version": "3.4.21", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.21.tgz", - "integrity": "sha512-aV1gXyKSN6Rz+6kZ6kr5+Ll14YzmIbeuWe7ryJl5muJ4uwSwY/aStXTixx76TwkZFJLm1aAlA/HSWEJ4EyiMkg==", - "dependencies": { - "@vue/compiler-ssr": "3.4.21", - "@vue/shared": "3.4.21" - }, - "peerDependencies": { - "vue": "3.4.21" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" - }, - "node_modules/@hotwax/dxp-components/node_modules/luxon": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz", - "integrity": "sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==", - "engines": { - "node": ">=12" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.36.tgz", - "integrity": "sha512-4UKApwjlmJH+VuHKgA+zQMddcCb3ezYnyewQ9NVrsDqZ/j9dMv5+rh+1r48whKNdpFkZAWVxhBp5ewYaYX9JcQ==", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.2.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia-plugin-persistedstate": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz", - "integrity": "sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==", - "peerDependencies": { - "pinia": "^2.0.0" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia/node_modules/vue-demi": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", - "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/@hotwax/dxp-components/node_modules/vue": { - "version": "3.4.21", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.21.tgz", - "integrity": "sha512-5hjyV/jLEIKD/jYl4cavMcnzKwjMKohureP8ejn3hhEjwhWIhWeuzL2kJAjzl/WyVsgPY56Sy4Z40C3lVshxXA==", - "dependencies": { - "@vue/compiler-dom": "3.4.21", - "@vue/compiler-sfc": "3.4.21", - "@vue/runtime-dom": "3.4.21", - "@vue/server-renderer": "3.4.21", - "@vue/shared": "3.4.21" - }, - "peerDependencies": { - "typescript": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@hotwax/dxp-components/node_modules/vue-markdown-render": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vue-markdown-render/-/vue-markdown-render-2.2.1.tgz", - "integrity": "sha512-XkYnC0PMdbs6Vy6j/gZXSvCuOS0787Se5COwXlepRqiqPiunyCIeTPQAO2XnB4Yl04EOHXwLx5y6IuszMWSgyQ==", - "dependencies": { - "markdown-it": "^13.0.2" - }, - "peerDependencies": { - "vue": "^3.3.4" - } + "resolved": "../dxp-components", + "link": true }, "node_modules/@hotwax/oms-api": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.14.0.tgz", - "integrity": "sha512-dYkrFEi0oJHKiJ/VctKmyIY4WTVV2lmljm1EflgQ/LM7BTJ9jVEeT1zgYJ5vO906kW7SWM4pl7mZI3dDCt1YCQ==", - "dependencies": { - "@types/node-json-transform": "^1.0.0", - "axios": "^0.21.1", - "axios-cache-adapter": "^2.7.3", - "deepmerge": "^4.3.0", - "http-status-codes": "^2.2.0", - "node-json-transform": "^1.1.2", - "qs": "^6.11.0" - } + "resolved": "../oms-api", + "link": true }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", @@ -2990,47 +2884,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@intlify/core-base": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.10.2.tgz", - "integrity": "sha512-HGStVnKobsJL0DoYIyRCGXBH63DMQqEZxDUGrkNI05FuTcruYUtOAxyL3zoAZu/uDGO6mcUvm3VXBaHG2GdZCg==", - "dependencies": { - "@intlify/message-compiler": "9.10.2", - "@intlify/shared": "9.10.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/message-compiler": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.10.2.tgz", - "integrity": "sha512-ntY/kfBwQRtX5Zh6wL8cSATujPzWW2ZQd1QwKyWwAy5fMqJyyixHMeovN4fmEyCqSu+hFfYOE63nU94evsy4YA==", - "dependencies": { - "@intlify/shared": "9.10.2", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/shared": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.10.2.tgz", - "integrity": "sha512-ttHCAJkRy7R5W2S9RVnN9KYQYPIpV2+GiS79T4EE37nrPyH6/1SrOh3bmdCRC1T3ocL8qCDx7x2lBJ0xaITU7Q==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, "node_modules/@ionic/core": { "version": "7.8.0", "resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.8.0.tgz", @@ -3204,7 +3057,8 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", @@ -3752,11 +3606,6 @@ "@types/node": "*" } }, - "node_modules/@types/node-json-transform": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/node-json-transform/-/node-json-transform-1.0.2.tgz", - "integrity": "sha512-gOq49i42EmHRKPTTD4cXru3MAFoDADqzUxzAweKtZZBmLJuAK0GsJHNX4HKdvZ/JJHf+F4TYgnvb7Ge0NlQiGw==" - }, "node_modules/@types/normalize-package-data": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", @@ -4886,6 +4735,7 @@ "version": "3.4.21", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.21.tgz", "integrity": "sha512-MjXawxZf2SbZszLPYxaFCjxfibYrzr3eYbKxwpLR9EQN+oaziSu3qKVbwBERj1IFIB8OLUewxB5m/BFzi613og==", + "dev": true, "dependencies": { "@babel/parser": "^7.23.9", "@vue/shared": "3.4.21", @@ -4898,6 +4748,7 @@ "version": "3.4.21", "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.21.tgz", "integrity": "sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA==", + "dev": true, "dependencies": { "@vue/compiler-core": "3.4.21", "@vue/shared": "3.4.21" @@ -4907,6 +4758,7 @@ "version": "3.4.21", "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.21.tgz", "integrity": "sha512-me7epoTxYlY+2CUM7hy9PCDdpMPfIwrOvAXud2Upk10g4YLv9UBW7kL798TvMeDhPthkZ0CONNrK2GoeI1ODiQ==", + "dev": true, "dependencies": { "@babel/parser": "^7.23.9", "@vue/compiler-core": "3.4.21", @@ -4923,6 +4775,7 @@ "version": "3.4.21", "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.21.tgz", "integrity": "sha512-M5+9nI2lPpAsgXOGQobnIueVqc9sisBFexh5yMIMRAPYLa7+5wEJs8iqOZc1WAa9WQbx9GR2twgznU8LTIiZ4Q==", + "dev": true, "dependencies": { "@vue/compiler-dom": "3.4.21", "@vue/shared": "3.4.21" @@ -5142,7 +4995,8 @@ "node_modules/@vue/shared": { "version": "3.4.21", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.21.tgz", - "integrity": "sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==" + "integrity": "sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==", + "dev": true }, "node_modules/@vue/test-utils": { "version": "2.4.5", @@ -5795,26 +5649,6 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/axios-cache-adapter": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/axios-cache-adapter/-/axios-cache-adapter-2.7.3.tgz", - "integrity": "sha512-A+ZKJ9lhpjthOEp4Z3QR/a9xC4du1ALaAsejgRGrH9ef6kSDxdFrhRpulqsh9khsEnwXxGfgpUuDp1YXMNMEiQ==", - "dependencies": { - "cache-control-esm": "1.0.0", - "md5": "^2.2.1" - }, - "peerDependencies": { - "axios": "~0.21.1" - } - }, "node_modules/babel-loader": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.3.0.tgz", @@ -6217,11 +6051,6 @@ "node": ">= 0.8" } }, - "node_modules/cache-control-esm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cache-control-esm/-/cache-control-esm-1.0.0.tgz", - "integrity": "sha512-Fa3UV4+eIk4EOih8FTV6EEsVKO0W5XWtNs6FC3InTfVz+EjurjPfDXY5wZDo/lxjDxg5RjNcurLyxEJBcEUx9g==" - }, "node_modules/cachedir": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", @@ -6235,6 +6064,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -6353,14 +6183,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "engines": { - "node": "*" - } - }, "node_modules/check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -6982,14 +6804,6 @@ "node": ">= 8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "engines": { - "node": "*" - } - }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -7722,6 +7536,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -8155,6 +7970,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, "engines": { "node": ">=0.12" }, @@ -8239,6 +8055,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -8250,6 +8067,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -9489,6 +9307,7 @@ "version": "1.15.5", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "dev": true, "funding": [ { "type": "individual", @@ -9832,6 +9651,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -9890,6 +9710,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -10058,6 +9879,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -10114,6 +9936,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0" }, @@ -10125,6 +9948,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -10136,6 +9960,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -10168,6 +9993,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -10459,11 +10285,6 @@ "node": ">=0.10" } }, - "node_modules/http-status-codes": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", - "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==" - }, "node_modules/human-signals": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", @@ -10829,11 +10650,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -11680,14 +11496,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/linkify-it": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", - "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/listr2": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", @@ -11780,7 +11588,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash.camelcase": { "version": "4.3.0", @@ -12083,6 +11892,7 @@ "version": "0.30.8", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", + "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, @@ -12114,58 +11924,12 @@ "semver": "bin/semver.js" } }, - "node_modules/markdown-it": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", - "integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", - "dependencies": { - "argparse": "^2.0.1", - "entities": "~3.0.1", - "linkify-it": "^4.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/markdown-it/node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/mdn-data": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "dev": true }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -12565,14 +12329,6 @@ "node": ">= 6.13.0" } }, - "node_modules/node-json-transform": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/node-json-transform/-/node-json-transform-1.1.2.tgz", - "integrity": "sha512-Y3twjldHF1htCiCu6elGwQDdNp5PD54U66waWa2XNKh+g2lXSnWo3nq9SZnZOV3odFAqkM/roiNZx078RE2new==", - "dependencies": { - "lodash": "^4.17.15" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -12682,6 +12438,7 @@ "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -14145,6 +13902,7 @@ "version": "6.12.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.0.tgz", "integrity": "sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg==", + "dev": true, "dependencies": { "side-channel": "^1.0.6" }, @@ -14917,6 +14675,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -15002,6 +14761,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dev": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -16225,7 +15985,7 @@ "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "devOptional": true, + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -16234,11 +15994,6 @@ "node": ">=4.2.0" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -16624,25 +16379,6 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, - "node_modules/vue-i18n": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.10.2.tgz", - "integrity": "sha512-ECJ8RIFd+3c1d3m1pctQ6ywG5Yj8Efy1oYoAKQ9neRdkLbuKLVeW4gaY5HPkD/9ssf1pOnUrmIFjx2/gkGxmEw==", - "dependencies": { - "@intlify/core-base": "9.10.2", - "@intlify/shared": "9.10.2", - "@vue/devtools-api": "^6.5.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - }, - "peerDependencies": { - "vue": "^3.0.0" - } - }, "node_modules/vue-loader": { "version": "17.4.2", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.4.2.tgz", @@ -18055,4 +17791,4 @@ "dev": true } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index ec075e48..9a221b53 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", - "@hotwax/oms-api": "^1.14.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "file:../oms-api", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "^7.6.0", diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 3bd56705..65297a56 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -1,6 +1,6 @@ -import { api, client, getConfig, getNotificationEnumIds, getNotificationUserPrefTypeIds, getProductIdentificationPref, getUserFacilities, hasError, initialise, logout, removeClientRegistrationToken, resetConfig, setProductIdentificationPref, setUserLocale, storeClientRegistrationToken, - subscribeTopic, unsubscribeTopic, updateInstanceUrl, updateToken, setUserTimeZone, getAvailableTimeZones } from '@hotwax/oms-api' +import { api, client, getConfig, getNotificationEnumIds, getNotificationUserPrefTypeIds, getProductIdentificationPref, getUserFacilities, getUserPreference, hasError, initialise, logout, removeClientRegistrationToken, resetConfig, setProductIdentificationPref, setUserLocale, storeClientRegistrationToken, + subscribeTopic, unsubscribeTopic, updateInstanceUrl, updateToken, setUserTimeZone, setUserPreference, getAvailableTimeZones } from '@hotwax/oms-api' export { api, @@ -10,6 +10,7 @@ export { getNotificationUserPrefTypeIds, getProductIdentificationPref, getUserFacilities, + getUserPreference, hasError, initialise, logout, @@ -23,5 +24,6 @@ export { updateInstanceUrl, updateToken, setUserTimeZone, + setUserPreference, getAvailableTimeZones } \ No newline at end of file diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 78f8d032..a3814dd2 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -50,7 +50,7 @@ import { arrowBackOutline, mailUnreadOutline, mailOpenOutline, checkmarkDoneOutl import { useStore } from "@/store"; import { useRouter } from "vue-router"; import { hasPermission } from "@/authorization"; -import { translate } from '@hotwax/dxp-components'; +import { translate, useUserStore } from '@hotwax/dxp-components'; export default defineComponent({ name: "Menu", @@ -70,7 +70,6 @@ export default defineComponent({ computed: { ...mapGetters({ isUserAuthenticated: 'user/isUserAuthenticated', - currentFacility: 'user/getCurrentFacility', }) }, methods: { @@ -81,6 +80,8 @@ export default defineComponent({ setup() { const store = useStore(); const router = useRouter(); + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) const appPages = [ { @@ -179,6 +180,7 @@ export default defineComponent({ return { appPages, checkmarkDoneOutline, + currentFacility, hasPermission, arrowBackOutline, mailUnreadOutline, diff --git a/src/components/NotificationPreferenceModal.vue b/src/components/NotificationPreferenceModal.vue index d7806673..28f85dd0 100644 --- a/src/components/NotificationPreferenceModal.vue +++ b/src/components/NotificationPreferenceModal.vue @@ -44,10 +44,10 @@ import { modalController, alertController, } from "@ionic/vue"; -import { defineComponent } from "vue"; +import { defineComponent, computed } from "vue"; import { closeOutline, save } from "ionicons/icons"; import { mapGetters, useStore } from "vuex"; -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' import { showToast } from "@/utils"; import emitter from "@/event-bus" import { generateTopicName } from "@/utils/firebase"; @@ -82,7 +82,6 @@ export default defineComponent({ }, computed: { ...mapGetters({ - currentFacility: 'user/getCurrentFacility', instanceUrl: 'user/getInstanceUrl', notificationPrefs: 'user/getNotificationPrefs' }), @@ -138,7 +137,7 @@ export default defineComponent({ } }, async handleTopicSubscription() { - const facilityId = (this.currentFacility as any).facilityId + const facilityId = this.currentFacility?.facilityId const subscribeRequests = [] as any this.notificationPrefToUpdate.subscribe.map(async (enumId: string) => { const topicName = generateTopicName(facilityId, enumId) @@ -182,9 +181,12 @@ export default defineComponent({ }, setup() { const store = useStore(); + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { closeOutline, + currentFacility, translate, save, store diff --git a/src/components/TransferOrderFilters.vue b/src/components/TransferOrderFilters.vue index dda0935d..c231ae70 100644 --- a/src/components/TransferOrderFilters.vue +++ b/src/components/TransferOrderFilters.vue @@ -46,14 +46,14 @@ import { IonTitle, IonToolbar } from "@ionic/vue"; -import { defineComponent } from "vue"; +import { defineComponent, computed } from "vue"; import { albumsOutline, banOutline, barChartOutline, calendarNumberOutline, checkmarkDoneOutline, closeOutline, filterOutline, iceCreamOutline, libraryOutline, pulseOutline, settings, shirtOutline, ticketOutline } from "ionicons/icons"; import { mapGetters, useStore } from 'vuex' import { escapeSolrSpecialChars, prepareOrderQuery } from '@/utils/solrHelper'; import { UtilService } from '@/services/UtilService'; import { hasError } from '@/adapter'; import logger from '@/logger'; -import { translate } from '@hotwax/dxp-components'; +import { translate, useUserStore } from '@hotwax/dxp-components'; export default defineComponent({ name: "TransferOrderFilters", @@ -77,7 +77,6 @@ export default defineComponent({ }, computed: { ...mapGetters({ - currentFacility: 'user/getCurrentFacility', transferOrders: 'transferorder/getTransferOrders', getStatusDesc: 'util/getStatusDesc', getShipmentMethodDesc: 'util/getShipmentMethodDesc', @@ -126,7 +125,7 @@ export default defineComponent({ filters: { '-orderStatusId': { value: 'ORDER_CREATED' }, orderTypeId: { value: 'TRANSFER_ORDER' }, - facilityId: { value: escapeSolrSpecialChars(this.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(this.currentFacility?.facilityId) }, productStoreId: { value: this.currentEComStore.productStoreId } }, facet: { @@ -172,7 +171,9 @@ export default defineComponent({ }, setup() { const store = useStore(); - + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) + return { albumsOutline, banOutline, @@ -180,6 +181,7 @@ export default defineComponent({ calendarNumberOutline, checkmarkDoneOutline, closeOutline, + currentFacility, filterOutline, iceCreamOutline, libraryOutline, diff --git a/src/main.ts b/src/main.ts index 9028bd23..dc27de44 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,8 +31,8 @@ import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; import { dxpComponents } from '@hotwax/dxp-components'; import { login, logout, loader } from '@/utils/user'; -import { getConfig, getProductIdentificationPref, initialise, setProductIdentificationPref, setUserLocale, setUserTimeZone, - getAvailableTimeZones } from './adapter'; +import { getConfig, getProductIdentificationPref, getUserFacilities, getUserPreference, initialise, setProductIdentificationPref, setUserLocale, getAvailableTimeZones, setUserTimeZone, + setUserPreference } from './adapter'; import localeMessages from '@/locales'; import { addNotification, storeClientRegistrationToken } from '@/utils/firebase'; @@ -67,7 +67,10 @@ const app = createApp(App) setUserLocale, setUserTimeZone, storeClientRegistrationToken, - getAvailableTimeZones + getAvailableTimeZones, + getUserFacilities, + setUserPreference, + getUserPreference }); router.isReady().then(() => { diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 8c252431..014bae71 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -2,6 +2,7 @@ import { api, client, hasError } from '@/adapter'; import logger from '@/logger'; import store from '@/store'; import { isPdf } from '@/utils'; +import { useUserStore } from '@hotwax/dxp-components' const fetchShipmentMethods = async (query: any): Promise => { return api({ @@ -29,6 +30,8 @@ const fetchPicklistInformation = async (query: any): Promise => { const findShipmentIdsForOrders = async(picklistBinIds: Array, orderIds: Array, statusId = ["SHIPMENT_APPROVED", "SHIPMENT_INPUT"]): Promise => { let shipmentIdsForOrders = {}; + const currentFacility: any = useUserStore().getCurrentFacility + const facilityId = currentFacility?.facilityId const params = { "entityName": "Shipment", @@ -37,7 +40,7 @@ const findShipmentIdsForOrders = async(picklistBinIds: Array, orderIds: "primaryOrderId_op": "in", "picklistBinId": picklistBinIds, "picklistBinId_op": "in", - "originFacilityId": store.state.user.currentFacility.facilityId, + "originFacilityId": facilityId, "statusId": statusId, "statusId_op": "in" }, diff --git a/src/store/modules/carrier/actions.ts b/src/store/modules/carrier/actions.ts index 35405e7a..172b088d 100644 --- a/src/store/modules/carrier/actions.ts +++ b/src/store/modules/carrier/actions.ts @@ -6,7 +6,7 @@ import { hasError } from '@/adapter' import * as types from './mutation-types' import logger from '@/logger' import store from '@/store'; -import { translate } from '@hotwax/dxp-components'; +import { translate, useUserStore } from '@hotwax/dxp-components'; import { showToast, isValidCarrierCode, isValidDeliveryDays } from '@/utils'; @@ -358,14 +358,16 @@ const actions: ActionTree = { async fetchFacilityCarriers({ state, commit }, payload) { let facilityCarriers = [] as any; let viewIndex = 0, resp, docCount = 0; - + const currentFacility: any = useUserStore().getCurrentFacility + const facilityId = currentFacility?.facilityId + try { do { const params = { "entityName": "FacilityAndParty", "inputFields": { "roleTypeId": "CARRIER", - "facilityId": this.state.user.currentFacility.facilityId + "facilityId": facilityId }, "fieldList": ["facilityId", "partyId", "firstName", "lastName", "groupName", "roleTypeId", "fromDate"], "noConditionFind": "Y", diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 81aabb53..ec453070 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -7,9 +7,15 @@ import { hasError } from '@/adapter' import * as types from './mutation-types' import { escapeSolrSpecialChars, prepareOrderQuery } from '@/utils/solrHelper' import { UtilService } from '@/services/UtilService' +import { useUserStore } from '@hotwax/dxp-components' import logger from '@/logger' import { getOrderCategory, removeKitComponents } from '@/utils/order' +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} + const actions: ActionTree = { async fetchInProgressOrdersAdditionalInformation({ commit, dispatch, state }, payload = { viewIndex: 0 }) { // getting all the orders from state @@ -151,6 +157,7 @@ const actions: ActionTree = { // getting all the orders from state const cachedOrders = JSON.parse(JSON.stringify(state.completed.list)); // maintaining cachedOrders as to prepare the orders payload let completedOrders = JSON.parse(JSON.stringify(state.completed.list)); // maintaining completedOrders as update the orders information once information in fetched + const currentFacilityId = getCurrentFacilityId(); // Split orders in batch of 40 const batchSize = 20; @@ -171,7 +178,7 @@ const actions: ActionTree = { } try { - const shipmentbatches = await Promise.all(requestParams.map((params) => OrderService.fetchShipments(params.picklistBinIds, params.orderIds, this.state.user.currentFacility.facilityId))) + const shipmentbatches = await Promise.all(requestParams.map((params) => OrderService.fetchShipments(params.picklistBinIds, params.orderIds, currentFacilityId))) // TODO simplify below logic by returning shipments list const shipments = shipmentbatches.flat(); @@ -310,6 +317,7 @@ const actions: ActionTree = { let resp; let orders = []; let total = 0; + const currentFacilityId = getCurrentFacilityId(); const inProgressQuery = JSON.parse(JSON.stringify(state.inProgress.query)) @@ -324,7 +332,7 @@ const actions: ActionTree = { picklistItemStatusId: { value: 'PICKITEM_PENDING' }, '-fulfillmentStatus': { value: ['Rejected', 'Cancelled'] }, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -403,6 +411,7 @@ const actions: ActionTree = { async findOpenOrders ({ commit, state }, payload = {}) { emitter.emit('presentLoader'); let resp; + const currentFacilityId = getCurrentFacilityId(); const openOrderQuery = JSON.parse(JSON.stringify(state.open.query)) @@ -418,7 +427,7 @@ const actions: ActionTree = { '-fulfillmentStatus': { value: ['Cancelled', 'Rejected']}, orderStatusId: { value: 'ORDER_APPROVED' }, orderTypeId: { value: 'SALES_ORDER' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -477,6 +486,7 @@ const actions: ActionTree = { async findCompletedOrders ({ commit, dispatch, state }, payload = {}) { emitter.emit('presentLoader'); let resp; + const currentFacilityId = getCurrentFacilityId(); const completedOrderQuery = JSON.parse(JSON.stringify(state.completed.query)) @@ -489,7 +499,7 @@ const actions: ActionTree = { filters: { picklistItemStatusId: { value: '(PICKITEM_PICKED OR (PICKITEM_COMPLETED AND itemShippedDate: [NOW/DAY TO NOW/DAY+1DAY]))' }, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -750,6 +760,7 @@ const actions: ActionTree = { } let resp, order = {} as any; + const currentFacilityId = getCurrentFacilityId(); emitter.emit('presentLoader'); const params = { @@ -763,7 +774,7 @@ const actions: ActionTree = { '-fulfillmentStatus': { value: ['Cancelled', 'Rejected']}, orderStatusId: { value: 'ORDER_APPROVED' }, orderTypeId: { value: 'SALES_ORDER' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -820,6 +831,7 @@ const actions: ActionTree = { } emitter.emit('presentLoader'); let resp, order = {} as any; + const currentFacilityId = getCurrentFacilityId(); try { const params = { @@ -832,7 +844,7 @@ const actions: ActionTree = { shipGroupSeqId: { value: payload.shipGroupSeqId }, '-fulfillmentStatus': { value: ['Cancelled', 'Rejected']}, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -888,6 +900,7 @@ const actions: ActionTree = { } emitter.emit('presentLoader'); let resp, order = {} as any; + const currentFacilityId = getCurrentFacilityId(); try { const params = { @@ -899,7 +912,7 @@ const actions: ActionTree = { picklistItemStatusId: { value: '(PICKITEM_PICKED OR (PICKITEM_COMPLETED AND itemShippedDate: [NOW/DAY TO NOW/DAY+1DAY]))' }, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, shipGroupSeqId: { value: payload.shipGroupSeqId }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -1014,10 +1027,11 @@ const actions: ActionTree = { async fetchCompletedOrderAdditionalInformation({ dispatch }, order) { let current = JSON.parse(JSON.stringify(order)) + const currentFacilityId = getCurrentFacilityId(); try { // fetchShipments accepts Array parameters for picklistBinId and orderId - const shipmentBatches = await OrderService.fetchShipments([current.picklistBinId], [current.orderId], this.state.user.currentFacility.facilityId) + const shipmentBatches = await OrderService.fetchShipments([current.picklistBinId], [current.orderId], currentFacilityId) const shipments = shipmentBatches.flat(); const shipmentIds = [...new Set(shipments.map((shipment: any) => shipment.shipmentId))] as Array let shipmentPackages = [] as any; diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 0233e673..fd46e5cf 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -6,11 +6,13 @@ import * as types from './mutation-types' import { hasError } from '@/adapter' import logger from '@/logger' import { showToast } from '@/utils' -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' const actions: ActionTree = { async fetchStock({ commit }, { productId, facilityId = '' }) { - const id = facilityId ? facilityId : this.state.user.currentFacility.facilityId + const getCurrentFacility: any = useUserStore().getCurrentFacility + const currentFacilityId = getCurrentFacility?.facilityId + const id = facilityId ? facilityId : currentFacilityId try { const payload = { diff --git a/src/store/modules/stock/getters.ts b/src/store/modules/stock/getters.ts index 491b222d..4c76cc9b 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -1,10 +1,13 @@ import { GetterTree } from 'vuex' import StockState from './StockState' import RootState from '../../RootState' +import { useUserStore } from "@hotwax/dxp-components"; const getters: GetterTree = { - getProductStock: (state, getters, RootState) => (productId: any, facilityId?: any) => { - const id = facilityId ? facilityId : RootState.user.currentFacility.facilityId + getProductStock: (state, getters) => (productId: any, facilityId?: any) => { + const getCurrentFacility: any = useUserStore().getCurrentFacility + const currentFacilityId = getCurrentFacility?.facilityId + const id = facilityId ? facilityId : currentFacilityId return state.products[productId] ? state.products[productId][id] ? state.products[productId][id] : {} : {} } diff --git a/src/store/modules/transferorder/actions.ts b/src/store/modules/transferorder/actions.ts index 2961078a..11239e1e 100644 --- a/src/store/modules/transferorder/actions.ts +++ b/src/store/modules/transferorder/actions.ts @@ -7,16 +7,22 @@ import { hasError } from '@/adapter' import * as types from './mutation-types' import { escapeSolrSpecialChars, prepareOrderQuery } from '@/utils/solrHelper' import logger from '@/logger' -import { shopifyImgContext, translate } from '@hotwax/dxp-components' +import { shopifyImgContext, translate, useUserStore } from '@hotwax/dxp-components' import { showToast } from "@/utils"; import { UtilService } from '@/services/UtilService' +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} + const actions: ActionTree = { async findTransferOrders ({ commit, state }, payload = {}) { emitter.emit('presentLoader'); let resp; const transferOrderQuery = JSON.parse(JSON.stringify(state.transferOrder.query)) + const currentFacilityId = getCurrentFacilityId(); const params = { ...payload, @@ -28,7 +34,7 @@ const actions: ActionTree = { sort: payload.sort ? payload.sort : "orderDate asc", filters: { orderTypeId: { value: 'TRANSFER_ORDER' }, - facilityId: { value: escapeSolrSpecialChars(this.state.user.currentFacility.facilityId) }, + facilityId: { value: escapeSolrSpecialChars(currentFacilityId) }, productStoreId: { value: this.state.user.currentEComStore.productStoreId } } } @@ -153,7 +159,7 @@ const actions: ActionTree = { "shipmentTypeId": "OUT_TRANSFER", orderId: payload.orderId, "shipGroupSeqId": payload.shipGroupSeqId, - "originFacilityId": this.state.user.currentFacility.facilityId, + "originFacilityId": getCurrentFacilityId(), "destinationFacilityId": payload.orderFacilityId, "items": eligibleItems, "packages": [{ diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index 57ec11db..a664b74e 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -3,7 +3,6 @@ export default interface UserState { current: any; permissions: any; pwaState: any; - currentFacility: object; instanceUrl: string; currentEComStore: object; preference: { diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 1d7af3d0..c60a6db9 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -56,9 +56,8 @@ const actions: ActionTree = { //fetching user facilities const isAdminUser = appPermissions.some((appPermission: any) => appPermission?.action === "APP_STOREFULFILLMENT_ADMIN" ); - const baseURL = store.getters['user/getBaseUrl']; - const facilities = await getUserFacilities(token, baseURL, userProfile?.partyId, "OMS_FULFILLMENT", isAdminUser); - + const facilities = await useUserStore().getUserFacilities(userProfile?.partyId, "OMS_FULFILLMENT", isAdminUser) + await useUserStore().getPreferredFacility('SELECTED_FACILITY') if (!facilities.length) throw 'Unable to login. User is not assocaited with any facility' @@ -71,8 +70,8 @@ const actions: ActionTree = { }, []); // TODO Use a separate API for getting facilities, this should handle user like admin accessing the app - const currentFacility = userProfile.facilities[0]; - userProfile.stores = await UserService.getEComStores(token, currentFacility.facilityId); + const currentFacility: any = useUserStore().getCurrentFacility + userProfile.stores = await UserService.getEComStores(token, currentFacility?.facilityId); let preferredStore = userProfile.stores[0] @@ -93,7 +92,6 @@ const actions: ActionTree = { // TODO user single mutation commit(types.USER_CURRENT_ECOM_STORE_UPDATED, preferredStore); - commit(types.USER_CURRENT_FACILITY_UPDATED, currentFacility); commit(types.USER_INFO_UPDATED, userProfile); commit(types.USER_PERMISSIONS_UPDATED, appPermissions); commit(types.USER_TOKEN_CHANGED, { newToken: token }) @@ -589,7 +587,8 @@ const actions: ActionTree = { async fetchNotificationPreferences({ commit, state }) { let resp = {} as any - const facilityId = (state.currentFacility as any).facilityId + const currentFacility: any = useUserStore().getCurrentFacility + const facilityId = currentFacility?.facilityId let notificationPreferences = [], enumerationResp = [], userPrefIds = [] as any try { resp = await getNotificationEnumIds(process.env.VUE_APP_NOTIF_ENUM_TYPE_ID as any) diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index 83f87ce2..bbf45c36 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -18,9 +18,6 @@ const getters: GetterTree = { getUserProfile (state) { return state.current }, - getCurrentFacility (state){ - return state.currentFacility - }, getInstanceUrl (state) { const baseUrl = process.env.VUE_APP_BASE_URL; return baseUrl ? baseUrl : state.instanceUrl; diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 0011503d..1a059290 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -11,7 +11,6 @@ const userModule: Module = { token: '', permissions: [], current: {}, - currentFacility: {}, instanceUrl: '', currentEComStore: {}, preference: { diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index 2cce7671..cef65ab4 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -9,7 +9,6 @@ const mutations: MutationTree = { [types.USER_END_SESSION] (state) { state.token = '' state.current = {}, - state.currentFacility = {} state.currentEComStore = {} state.permissions = [], state.allNotificationPrefs = [] @@ -17,9 +16,6 @@ const mutations: MutationTree = { [types.USER_INFO_UPDATED] (state, payload) { state.current = { ...state.current, ...payload} }, - [types.USER_CURRENT_FACILITY_UPDATED] (state, payload) { - state.currentFacility = payload; - }, [types.USER_INSTANCE_URL_UPDATED] (state, payload) { state.instanceUrl = payload; }, diff --git a/src/views/AssignPickerModal.vue b/src/views/AssignPickerModal.vue index cc2f5cb7..043e8d39 100644 --- a/src/views/AssignPickerModal.vue +++ b/src/views/AssignPickerModal.vue @@ -69,12 +69,12 @@ import { IonTitle, IonToolbar, modalController } from "@ionic/vue"; -import { defineComponent } from "vue"; +import { defineComponent, computed } from "vue"; import { closeOutline, saveOutline } from "ionicons/icons"; import { mapGetters, useStore } from "vuex"; import { showToast } from "@/utils"; import { hasError } from "@/adapter"; -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' import { UtilService } from "@/services/UtilService"; import emitter from "@/event-bus"; import logger from "@/logger" @@ -104,7 +104,6 @@ export default defineComponent({ }, computed: { ...mapGetters({ - currentFacility: 'user/getCurrentFacility', openOrders: 'order/getOpenOrders' }) }, @@ -149,9 +148,9 @@ export default defineComponent({ } const formData = new FormData(); - formData.append("facilityId", this.currentFacility.facilityId); + formData.append("facilityId", this.currentFacility?.facilityId); orderItems.map((item, index) => { - formData.append("facilityId_o_"+index, this.currentFacility.facilityId) + formData.append("facilityId_o_"+index, this.currentFacility?.facilityId) formData.append("shipmentMethodTypeId_o_"+index, item.shipmentMethodTypeId) formData.append("itemStatusId_o_"+index, "PICKITEM_PENDING") formData.append("shipGroupSeqId_o_"+index, item.shipGroupSeqId) @@ -256,9 +255,12 @@ export default defineComponent({ }, setup() { const store = useStore(); + const userStore = useUserStore() + let currentFacility = computed(() => userStore.getCurrentFacility) return { closeOutline, + currentFacility, saveOutline, store, translate diff --git a/src/views/Completed.vue b/src/views/Completed.vue index e6c1fd71..7aa2e997 100644 --- a/src/views/Completed.vue +++ b/src/views/Completed.vue @@ -212,7 +212,7 @@ import { UtilService } from '@/services/UtilService'; import { prepareOrderQuery } from '@/utils/solrHelper'; import emitter from '@/event-bus'; import ViewSizeSelector from '@/components/ViewSizeSelector.vue' -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' import { OrderService } from '@/services/OrderService'; import logger from '@/logger'; import ShippingLabelErrorModal from '@/components/ShippingLabelErrorModal.vue'; @@ -263,7 +263,6 @@ export default defineComponent({ ...mapGetters({ completedOrders: 'order/getCompletedOrders', getProduct: 'product/getProduct', - currentFacility: 'user/getCurrentFacility', currentEComStore: 'user/getCurrentEComStore', getPartyName: 'util/getPartyName', getShipmentMethodDesc: 'util/getShipmentMethodDesc', @@ -284,7 +283,7 @@ export default defineComponent({ }, methods: { getErrorMessage() { - return this.searchedQuery === '' ? translate("doesn't have any completed orders right now.", { facilityName: this.currentFacility.facilityName }) : translate( "No results found for . Try searching In Progress or Open tab instead. If you still can't find what you're looking for, try switching stores.", { searchedQuery: this.searchedQuery, lineBreak: '
' }) + return this.searchedQuery === '' ? translate("doesn't have any completed orders right now.", { facilityName: this.currentFacility?.facilityName }) : translate( "No results found for . Try searching In Progress or Open tab instead. If you still can't find what you're looking for, try switching stores.", { searchedQuery: this.searchedQuery, lineBreak: '
' }) }, hasAnyPackedShipment(): boolean { return this.completedOrders.list.some((order: any) => { @@ -480,7 +479,7 @@ export default defineComponent({ filters: { picklistItemStatusId: { value: '(PICKITEM_PICKED OR (PICKITEM_COMPLETED AND itemShippedDate: [NOW/DAY TO NOW/DAY+1DAY]))' }, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, - facilityId: { value: this.currentFacility.facilityId }, + facilityId: { value: this.currentFacility?.facilityId }, productStoreId: { value: this.currentEComStore.productStoreId } }, facet: { @@ -521,7 +520,7 @@ export default defineComponent({ filters: { picklistItemStatusId: { value: '(PICKITEM_PICKED OR (PICKITEM_COMPLETED AND itemShippedDate: [NOW/DAY TO NOW/DAY+1DAY]))' }, '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, - facilityId: { value: this.currentFacility.facilityId }, + facilityId: { value: this.currentFacility?.facilityId }, productStoreId: { value: this.currentEComStore.productStoreId }, }, facet: { @@ -760,8 +759,10 @@ export default defineComponent({ setup() { const store = useStore(); const router = useRouter(); + const userStore = useUserStore() const productIdentificationStore = useProductIdentificationStore(); let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref) + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { Actions, @@ -770,6 +771,7 @@ export default defineComponent({ copyToClipboard, checkmarkDoneOutline, cubeOutline, + currentFacility, downloadOutline, ellipsisVerticalOutline, formatUtcDate, diff --git a/src/views/DownloadPackedOrders.vue b/src/views/DownloadPackedOrders.vue index 8ca43c98..330c3d5e 100644 --- a/src/views/DownloadPackedOrders.vue +++ b/src/views/DownloadPackedOrders.vue @@ -75,12 +75,12 @@