diff --git a/package-lock.json b/package-lock.json index 4c5453a..bb1b043 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", "@hotwax/dxp-components": "^1.3.4", - "@hotwax/oms-api": "^1.6.0", + "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", @@ -2197,9 +2197,9 @@ } }, "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.10.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.10.0.tgz", + "integrity": "sha512-Li9vqTsGHqfTalL2FWDAIPSEdiZyRLDQOcHzXf5YFo8yTLEgiBM1kvfl12nXYWRpVtE9DPDMHkqxkWRlQTM/Lw==", "dependencies": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", @@ -34844,9 +34844,9 @@ } }, "@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.10.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.10.0.tgz", + "integrity": "sha512-Li9vqTsGHqfTalL2FWDAIPSEdiZyRLDQOcHzXf5YFo8yTLEgiBM1kvfl12nXYWRpVtE9DPDMHkqxkWRlQTM/Lw==", "requires": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", diff --git a/package.json b/package.json index b9af37c..c62b6bb 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", "@hotwax/dxp-components": "^1.3.4", - "@hotwax/oms-api": "^1.6.0", + "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 0d51237..99fa835 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -1,8 +1,9 @@ -import { api, client, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' +import { api, client, getConfig, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' export { api, client, + getConfig, initialise, resetConfig, updateInstanceUrl, diff --git a/src/locales/en.json b/src/locales/en.json index b3c27bd..eeb0dc8 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2,7 +2,7 @@ "App": "App", "Authenticating": "Authenticating", "Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to {timeZoneId}?", - "product barcode": "product barcode", + "Camera permission denied.": "Camera permission denied.", "Cancel": "Cancel", "Change": "Change", "Click the backdrop to dismiss.": "Click the backdrop to dismiss.", @@ -35,6 +35,7 @@ "Picklist Completed": "Picklist Completed", "Picklists": "Picklists", "Please allow camera access in your settings": "Please allow camera access in your settings", + "product barcode": "product barcode", "Product not found": "Product not found", "Product not found in remaining items": "Product not found in remaining items", "Scan": "Scan", diff --git a/src/main.ts b/src/main.ts index dc87529..8c0aca8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,6 +30,7 @@ import i18n from './i18n' import store from './store' import { dxpComponents } from '@hotwax/dxp-components' import { login, logout, loader } from './user-utils'; +import { getConfig, initialise } from '@hotwax/oms-api'; const app = createApp(App) .use(IonicVue, { @@ -43,7 +44,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, + 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/views/Picklist-Detail.vue b/src/views/Picklist-Detail.vue index 372b07f..5ee4910 100644 --- a/src/views/Picklist-Detail.vue +++ b/src/views/Picklist-Detail.vue @@ -170,16 +170,22 @@ export default defineComponent({ }) }, async scanCode() { - const modal = await modalController + try { + // checking camera permission before opening the scanner + await navigator.mediaDevices.getUserMedia({ video: true }); + const modal = await modalController .create({ component: Scanner, }); - modal.onDidDismiss() + modal.onDidDismiss() .then((result) => { //result : value of the scanned barcode/QRcode this.selectProduct(result.data.value) }); - return modal.present(); + return modal.present(); + } catch (err) { + showToast(translate("Camera permission denied.")); + } }, sortPickists() { // Sort picklist products based on the sorting parameter selected diff --git a/vue.config.js b/vue.config.js index 67e220e..79998ac 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,3 +1,4 @@ +const path = require('path') require("@hotwax/app-version-info") module.exports = { // WHY THIS CONFIG: Error while using pinia while importing dxp-components - @@ -5,6 +6,11 @@ module.exports = { // WHY ERROR: Using Vue CLI 4.x may cause this error (according to Pinia docs, did their suggested resolution) // REFERENCE: https://pinia.vuejs.org/cookbook/migration-v1-v2.html#webpack-4-support configureWebpack: { + resolve: { + alias: { + vue: path.resolve('./node_modules/vue') + } + }, module: { rules: [ { @@ -27,5 +33,6 @@ module.exports = { enableInSFC: true } }, - runtimeCompiler: true + runtimeCompiler: true, + transpileDependencies: ['@hotwax/dxp-components'] }