Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Dec 13, 2023
2 parents c20afb5 + da985fb commit b2f4d4f
Show file tree
Hide file tree
Showing 16 changed files with 11,546 additions and 55,008 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ module.exports = {
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
]
}
]
}
66,349 changes: 11,474 additions & 54,875 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@casl/ability": "^6.0.0",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.1.0",
"@hotwax/dxp-components": "^1.7.5",
"@hotwax/dxp-components": "^1.11.0",
"@hotwax/oms-api": "^1.10.0",
"@ionic/core": "6.7.5",
"@ionic/vue": "6.7.5",
Expand All @@ -38,27 +38,22 @@
"devDependencies": {
"@capacitor/cli": "^2.4.7",
"@intlify/vue-i18n-loader": "^2.1.0",
"@types/jest": "^27.5.0",
"@types/luxon": "^3.2.0",
"@typescript-eslint/eslint-plugin": "~5.26.0",
"@typescript-eslint/parser": "~5.26.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-e2e-cypress": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-pwa": "^4.5.15",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/cli-plugin-pwa": "^5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-typescript": "^9.1.0",
"@vue/test-utils": "^2.0.0-0",
"@vue/vue3-jest": "^28.0.0",
"cypress": "^8.3.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^28.1.0",
"ts-jest": "^28.0.8",
"typescript": "~4.7.4",
"vue-cli-plugin-i18n": "^1.0.1"
}
Expand Down
15 changes: 12 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ export default defineComponent({
})
},
methods: {
async presentLoader() {
async presentLoader(options = { message: '', backdropDismiss: true }) {
// When having a custom message remove already existing loader
if(options.message && this.loader) this.dismissLoader();
if (!this.loader) {
this.loader = await loadingController
.create({
message: this.$t("Click the backdrop to dismiss."),
message: options.message ? this.$t(options.message) : this.$t("Click the backdrop to dismiss."),
translucent: true,
backdropDismiss: true
backdropDismiss: options.backdropDismiss
});
}
this.loader.present();
Expand Down Expand Up @@ -117,3 +120,9 @@ export default defineComponent({
}
});
</script>

<style>
ion-split-pane {
--side-width: 304px;
}
</style>
4 changes: 2 additions & 2 deletions src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default {
'APP_PURCHASEORDER_DETAIL_VIEW': '',
'APP_RETURNS_VIEW': '',
'APP_RETURN_DETAIL_VIEW': '',
'APP_SHIPMENT_UPDATE': 'COMMON_ADMIN',
'APP_SHIPMENT_ADMIN': 'FULFILL_SHIPMENT_ADMIN',
'APP_SHIPMENT_UPDATE': 'RECEIVING_ADMIN',
'APP_SHIPMENT_ADMIN': 'RECEIVING_ADMIN',
} as any
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"Loading": "Loading",
"Login": "Login",
"Logging in": "Logging in",
"Logging out": "Logging out",
"Logout": "Logout",
"Make sure you have entered all the inventory you received. You cannot edit this information after proceeding.": "Make sure you have entered all the inventory you received. { space } You cannot edit this information after proceeding.",
"No more shipments found": "No more shipments found",
Expand Down
6 changes: 3 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { showToast } from '@/utils'
import { translate } from '@/i18n'

import 'vue-router'
import { Login, useAuthStore } from '@hotwax/dxp-components';
import { DxpLogin, useAuthStore } from '@hotwax/dxp-components';
import { loader } from '@/user-utils';

// Defining types for the meta values
Expand Down Expand Up @@ -70,8 +70,8 @@ const routes: Array<RouteRecordRaw> = [
},
{
path: '/login',
name: 'Login',
component: Login,
name: 'DxpLogin',
component: DxpLogin,
beforeEnter: loginGuard
},
{
Expand Down
30 changes: 29 additions & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
setPermissions
} from '@/authorization'
import { useAuthStore } from '@hotwax/dxp-components'
import emitter from '@/event-bus'

const actions: ActionTree<UserState, RootState> = {

Expand Down Expand Up @@ -104,10 +105,29 @@ const actions: ActionTree<UserState, RootState> = {
* Logout user
*/
async logout ({ commit }, payload) {
// store the url on which we need to redirect the user after logout api completes in case of SSO enabled
let redirectionUrl = ''

emitter.emit('presentLoader', { message: 'Logging out', backdropDismiss: false })

// 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();
let resp;

// wrapping the parsing logic in try catch as in some case the logout api makes redirection, and then we are unable to parse the resp and thus the logout process halts
try {
resp = await logout();

// Added logic to remove the `//` from the resp as in case of get request we are having the extra characters and in case of post we are having 403
resp = JSON.parse(resp.startsWith('//') ? resp.replace('//', '') : resp)
} catch(err) {
console.error('Error parsing data', err)
}

if(resp?.logoutAuthType == 'SAML2SSO') {
redirectionUrl = resp.logoutUrl
}
}

const authStore = useAuthStore()
Expand All @@ -121,6 +141,14 @@ const actions: ActionTree<UserState, RootState> = {

// reset plugin state on logout
authStore.$reset()

// If we get any url in logout api resp then we will redirect the user to the url
if(redirectionUrl) {
window.location.href = redirectionUrl
}

emitter.emit('dismissLoader')
return redirectionUrl;
},

/**
Expand Down
23 changes: 16 additions & 7 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,31 @@ export default defineComponent({
{
text: this.$t('Ok'),
handler: () => {
this.store.dispatch('product/clearUploadProducts');
this.store.dispatch('user/logout').then(() => {
this.router.push('/login');
this.store.dispatch('user/logout', { isUserUnauthorised: false }).then((redirectionUrl) => {
this.store.dispatch('product/clearUploadProducts');
// if not having redirection url then redirect the user to launchpad
if (!redirectionUrl) {
const redirectUrl = window.location.origin + '/login'
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?isLoggedOut=true&redirectUrl=${redirectUrl}`
}
})
}
}]
});
await alert.present();
},
logout () {
this.store.dispatch('user/logout').then(() => {
logout() {
this.store.dispatch('user/logout', { isUserUnauthorised: false }).then((redirectionUrl) => {
this.store.dispatch('shipment/clearShipments');
this.store.dispatch('return/clearReturns');
this.store.dispatch("party/resetReceiversDetails");
const redirectUrl = window.location.origin + '/login'
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?isLoggedOut=true&redirectUrl=${redirectUrl}`
// if not having redirection url then redirect the user to launchpad
if (!redirectionUrl) {
const redirectUrl = window.location.origin + '/login'
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?isLoggedOut=true&redirectUrl=${redirectUrl}`
}
})
},
goToLaunchpad() {
Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/.eslintrc.js

This file was deleted.

25 changes: 0 additions & 25 deletions tests/e2e/plugins/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions tests/e2e/specs/test.js

This file was deleted.

25 changes: 0 additions & 25 deletions tests/e2e/support/commands.js

This file was deleted.

20 changes: 0 additions & 20 deletions tests/e2e/support/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions tests/unit/example.spec.ts

This file was deleted.

3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"jest"
"webpack-env"
],
"paths": {
"@/*": [
Expand Down

0 comments on commit b2f4d4f

Please sign in to comment.