{"version":3,"sources":["webpack:///./src/components/Login/ActiveDirectoryLogin.vue?8e29","webpack:///./src/components/Login/ActiveDirectoryLogin.vue","webpack:///./src/components/Login/ActiveDirectoryLogin.vue?6d0f","webpack:///./src/components/Login/ActiveDirectoryLogin.vue?c28f"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","errorMessage","staticStyle","domProps","_s","_e","staticRenderFns","Component","registerHooks","ActiveDirectoryLogin","defaultErrorMessage","isRecoverySuccessful","apiRequestActive","msalService","MsalService","$store","baseApiRoute","to","from","next","SettingsHelper","getAuthenticationUrl","authUrl","commonModule","setAuthenticationUrl","console","log","initializeAuthUrl","user","authenticatedUser","authenticated","isAdLogin","redirectUrl","$router","currentRoute","query","redirect","redirectTo","push","login","state","JSON","stringify","acquireADToken","productName","resultState","loginSuccess","requestFailure","setSessionTimeoutRedirectUrl","name","$root","$emit","result","supportInfo","groupCollapsed","dir","groupEnd","VueBase","__decorate","Prop","required","component","VProgressCircular"],"mappings":"+HAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACA,EAAG,MAAM,CAAEJ,EAAoB,iBAAEI,EAAG,MAAM,CAACE,YAAY,eAAe,CAACF,EAAG,sBAAsB,CAACG,MAAM,CAAC,cAAgB,GAAG,MAAQ,UAAU,KAAO,SAAS,GAAIP,EAAIQ,cAAoC,IAApBR,EAAIQ,aAAoBJ,EAAG,OAAO,CAACK,YAAY,CAAC,MAAQ,MAAM,YAAY,WAAWC,SAAS,CAAC,UAAYV,EAAIW,GAAGX,EAAIQ,iBAAiBR,EAAIY,UACtaC,EAAkB,G,kICiBtBC,OAAUC,cAAc,CACpB,mBACA,mBACA,sBAIJ,IAAqBC,EAAoB,wDAWrC,iDACI,eARe,EAAAC,oBAA8B,4GACvC,EAAAT,aAAuB,GACvB,EAAAU,sBAAgC,EAChC,EAAAC,kBAA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BC,GAG1C5B,QAAQ6B,eAAe,kCACvB7B,QAAQ8B,IAAIH,GACZ3B,QAAQ+B,WAER9D,KAAKO,aAAeP,KAAKgB,oBAEN,MAAf2C,IACA3D,KAAKO,cAAL,oCAAkDoD,IAGtD3D,KAAKkB,kBAAmB,MAzFS,GAAS6C,QAE9CC,gBADCC,eAAK,CAAEC,UAAU,KAClB,kCAFiBnD,EAAoB,gBADxCF,eAAU,KACUE,WCzB4Y,I,6CCO7ZoD,EAAY,eACd,EACArE,EACAc,GACA,EACA,KACA,KACA,MAIa,aAAAuD,EAAiB,QAKhC,IAAkBA,EAAW,CAACC,oBAAA","file":"ActiveDirectoryLogin.d008af3be.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',[(_vm.apiRequestActive)?_c('div',{staticClass:\"text-center\"},[_c('v-progress-circular',{attrs:{\"indeterminate\":\"\",\"color\":\"#B7B6B6\",\"size\":\"40\"}})],1):(_vm.errorMessage && _vm.errorMessage != '')?_c('span',{staticStyle:{\"color\":\"red\",\"font-size\":\"smaller\"},domProps:{\"innerHTML\":_vm._s(_vm.errorMessage)}}):_vm._e()])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\nimport VueBase from '@/components/VueBase';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { RawLocation } from 'vue-router';\nimport { UserState, RequestResult, MsalService, SettingsHelper } from '@questelservices/common';\n\n// TODO: Move custom hooks to main.ts when used beyond this component\nComponent.registerHooks([\n 'beforeRouteEnter',\n 'beforeRouteLeave',\n 'beforeRouteUpdate' // for vue-router 2.2+\n]);\n\n@Component({})\nexport default class ActiveDirectoryLogin extends VueBase {\n @Prop({ required: true })\n public productName!: string;\n\n protected readonly defaultErrorMessage: string = 'An error occurred during login. Please refresh the page and try again, or contact support if it persists.';\n protected errorMessage: string = '';\n protected isRecoverySuccessful: boolean = false;\n protected apiRequestActive: boolean = false;\n protected msalService: MsalService = new MsalService(this.$store);\n protected readonly baseApiRoute: string = '/api/v1';\n\n constructor() {\n super();\n }\n\n public beforeRouteUpdate(to: any, from: any, next: any): void {\n this.errorMessage = '';\n next();\n }\n\n protected async initializeAuthUrl(): Promise {\n try {\n let authUrl: string = await SettingsHelper.getAuthenticationUrl(this.baseApiRoute);\n await this.commonModule.setAuthenticationUrl(authUrl);\n } catch (error) {\n console.log(error);\n }\n }\n\n protected async mounted() {\n this.apiRequestActive = true;\n await this.initializeAuthUrl();\n // Skip all the ActiveDirectory login when the user is already authenticated\n const user: UserState = this.commonModule.authenticatedUser;\n debugger;\n if (!!user && user.authenticated == true && user.isAdLogin == true) {\n const redirectUrl: string = this.$router.currentRoute.query.redirect as string;\n let redirectTo: string = redirectUrl ? redirectUrl : '/';\n\n this.$router.push(redirectTo);\n }\n else {\n await this.login();\n }\n }\n\n private async login(): Promise {\n this.apiRequestActive = true;\n\n try {\n const state = JSON.stringify({\n redirect: this.$router.currentRoute.query.redirect\n });\n\n const resultState = await this.msalService.acquireADToken(this.productName, state, this.baseApiRoute);\n debugger;\n await this.loginSuccess(resultState);\n }\n catch (error) {\n this.requestFailure(error, 'Azure Login');\n }\n }\n\n private async loginSuccess(state?: any): Promise {\n debugger;\n await this.commonModule.setSessionTimeoutRedirectUrl({ name: 'employee' });\n this.$root.$emit('login-success');\n\n if (this.$router.currentRoute.query.redirect || (state && state.redirect)) {\n const redirectTo = this.$router.currentRoute.query.redirect ?? state.redirect;\n this.$router.push(redirectTo as RawLocation);\n } else {\n this.$router.push('/');\n }\n }\n\n private requestFailure(result: RequestResult, supportInfo?: string): void {\n debugger;\n // Log details for troublshooting.\n console.groupCollapsed('Active Directory login failed.')\n console.dir(result);\n console.groupEnd();\n\n this.errorMessage = this.defaultErrorMessage;\n\n if (supportInfo != null) {\n this.errorMessage += `

Support Info: ${supportInfo}`;\n }\n\n this.apiRequestActive = false;\n }\n}\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveDirectoryLogin.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ActiveDirectoryLogin.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./ActiveDirectoryLogin.vue?vue&type=template&id=366f403a&\"\nimport script from \"./ActiveDirectoryLogin.vue?vue&type=script&lang=ts&\"\nexport * from \"./ActiveDirectoryLogin.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VProgressCircular } from 'vuetify/lib/components/VProgressCircular';\ninstallComponents(component, {VProgressCircular})\n"],"sourceRoot":""}