diff --git a/package-lock.json b/package-lock.json index 12bf7bb4..8b408b3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "receiving", - "version": "2.17.0", + "version": "2.18.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "receiving", - "version": "2.17.0", + "version": "2.18.0", "dependencies": { "@capacitor/android": "^2.4.7", "@capacitor/core": "^2.4.7", @@ -14,7 +14,7 @@ "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", "@hotwax/dxp-components": "file:../dxp-components", - "@hotwax/oms-api": "^1.6.0", + "@hotwax/oms-api": "^1.9.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", @@ -60,17 +60,20 @@ } }, "../dxp-components": { - "name": "@hotwax/dxp-components", - "version": "1.4.0", + "version": "1.7.5", "license": "Apache-2.0", "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": "^3.3.4", + "vue-barcode-reader": "^1.0.3", + "vue-i18n": "^9.2.2" }, "devDependencies": { "@babel/types": "^7.22.11", @@ -2223,9 +2226,9 @@ "link": true }, "node_modules/@hotwax/oms-api": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.8.1.tgz", - "integrity": "sha512-pVceiuaOSkRZM3i87+TCEu6uBMDG01JGTG92mCpDUXWmA6nd0BL7QiK1Qr8a9lDTib0M24RVBDCGc/cX6nlxgg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.9.0.tgz", + "integrity": "sha512-1PcS95vP8PzzlBRwHQRk99eJT0xStBSmNdpdoATRUSlLamxmHZ8RAwAwY3usph5gNy7Z+WzAxl9fJXX9VgWP9g==", "dependencies": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", @@ -34876,12 +34879,14 @@ "@ionic/vue": "^6.7.5", "@types/luxon": "^3.3.0", "@types/node": "^20.5.7", + "@types/vue-barcode-reader": "^0.0.0", "@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", + "firebase": "^10.3.1", "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", @@ -34889,13 +34894,15 @@ "typescript": "~4.7.4", "vite": "^4.4.9", "vue": "^3.3.4", + "vue-barcode-reader": "^1.0.3", + "vue-i18n": "^9.2.2", "vue-tsc": "^1.8.8" } }, "@hotwax/oms-api": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.8.1.tgz", - "integrity": "sha512-pVceiuaOSkRZM3i87+TCEu6uBMDG01JGTG92mCpDUXWmA6nd0BL7QiK1Qr8a9lDTib0M24RVBDCGc/cX6nlxgg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.9.0.tgz", + "integrity": "sha512-1PcS95vP8PzzlBRwHQRk99eJT0xStBSmNdpdoATRUSlLamxmHZ8RAwAwY3usph5gNy7Z+WzAxl9fJXX9VgWP9g==", "requires": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", diff --git a/package.json b/package.json index e31525f8..c4fe6cd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "receiving", - "version": "2.17.0", + "version": "2.18.0", "private": true, "description": "HotWax Commerce Receiving App", "scripts": { @@ -18,7 +18,7 @@ "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", "@hotwax/dxp-components": "file:../dxp-components", - "@hotwax/oms-api": "^1.6.0", + "@hotwax/oms-api": "^1.9.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", diff --git a/src/App.vue b/src/App.vue index 56cac9e0..15ff14da 100644 --- a/src/App.vue +++ b/src/App.vue @@ -60,7 +60,8 @@ export default defineComponent({ } }, async unauthorized() { - this.store.dispatch("user/logout"); + // Mark the user as unauthorised, this will help in not making the logout api call in actions + this.store.dispatch("user/logout", { isUserUnauthorised: true }); const redirectUrl = window.location.origin + '/login'; window.location.href = `${process.env.VUE_APP_LOGIN_URL}?redirectUrl=${redirectUrl}`; } diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 0d512378..0fea6aab 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -1,9 +1,11 @@ -import { api, client, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' +import { api, client, getConfig, initialise, logout, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' export { api, client, + getConfig, initialise, + logout, resetConfig, updateInstanceUrl, updateToken diff --git a/src/main.ts b/src/main.ts index 3d8ca16e..dceef479 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,6 +34,7 @@ import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; import { dxpComponents } from '@hotwax/dxp-components' import { login, logout, loader } from './user-utils'; +import { getConfig, initialise } from '@/adapter' const app = createApp(App) .use(IonicVue, { @@ -51,7 +52,9 @@ const app = createApp(App) login, logout, loader, - appLoginUrl: process.env.VUE_APP_LOGIN_URL as string + appLoginUrl: process.env.VUE_APP_LOGIN_URL as string, + getConfig: getConfig, + initialise: initialise }); // Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 5168974d..15dd9f2b 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -6,7 +6,7 @@ import * as types from './mutation-types' import { hasError, showToast } from '@/utils' import { translate } from '@/i18n' import { Settings } from 'luxon'; -import { updateInstanceUrl, updateToken, resetConfig } from '@/adapter' +import { logout, updateInstanceUrl, updateToken, resetConfig } from '@/adapter' import { getServerPermissionsFromRules, prepareAppPermissions, @@ -103,7 +103,13 @@ const actions: ActionTree = { /** * Logout user */ - async logout ({ commit }) { + async logout ({ commit }, payload) { + // Calling the logout api to flag the user as logged out, only when user is authorised + // if the user is already unauthorised then not calling the logout api as it returns 401 again that results in a loop, thus there is no need to call logout api if the user is unauthorised + if(!payload?.isUserUnauthorised) { + await logout(); + } + const authStore = useAuthStore() // TODO add any other tasks if need diff --git a/src/user-utils/index.ts b/src/user-utils/index.ts index faf98e48..44c37aba 100644 --- a/src/user-utils/index.ts +++ b/src/user-utils/index.ts @@ -4,7 +4,7 @@ import { loadingController } from '@ionic/vue' const login = async (payload: any) => store.dispatch('user/login', payload); -const logout = async () => store.dispatch('user/logout'); +const logout = async (payload: any) => store.dispatch('user/logout', payload); const loader = { value: null as any, diff --git a/src/views/Shipments.vue b/src/views/Shipments.vue index 3a445fd7..ee18d22d 100644 --- a/src/views/Shipments.vue +++ b/src/views/Shipments.vue @@ -104,12 +104,14 @@ export default defineComponent({ "inputFields": { "destinationFacilityId": this.user.facilityId, "statusId": "PURCH_SHIP_SHIPPED", - "shipmentTypeId_fld0_value": "INCOMING_SHIPMENT", - "shipmentTypeId_fld0_op": "equals", - "shipmentTypeId_fld0_grp": "1", - "parentTypeId_fld0_value": "INCOMING_SHIPMENT", - "parentTypeId_fld0_op": "equals", - "parentTypeId_fld0_grp": "2", + "grp_op": "AND", + "shipmentTypeId_value": "INCOMING_SHIPMENT", + "shipmentTypeId_op": "equals", + "shipmentTypeId_grp": "1", + "parentTypeId_value": "INCOMING_SHIPMENT", + "parentTypeId_op": "equals", + "parentTypeId_grp": "1", + "grp_op_1": "OR" }, "entityName": "ShipmentAndTypeAndItemCount", "fieldList" : [ "shipmentId","primaryShipGroupSeqId","partyIdFrom","partyIdTo","estimatedArrivalDate","destinationFacilityId","statusId", "shipmentItemCount", "externalId", "externalOrderId", "shipmentTypeId" ], @@ -121,11 +123,12 @@ export default defineComponent({ payload.inputFields["shipmentId_value"] = this.queryString payload.inputFields["shipmentId_op"] = 'contains' payload.inputFields["shipmentId_ic"] = 'Y' - payload.inputFields["shipmentId_grp"] = '1' + payload.inputFields["shipmentId_grp"] = '2' payload.inputFields["externalOrderId_value"] = this.queryString payload.inputFields["externalOrderId_op"] = 'contains' payload.inputFields["externalOrderId_ic"] = 'Y' payload.inputFields["externalOrderId_grp"] = '2' + payload.inputFields["grp_op_2"] = 'OR' } await this.store.dispatch("shipment/findShipment", payload); this.fetchingShipments = false;