{"version":3,"sources":["webpack:///./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","webpack:///./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","webpack:///./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","webpack:///./node_modules/@babel/runtime/helpers/esm/slicedToArray.js","webpack:///./src/util/Forms.ts","webpack:///./src/views/auth/Login.vue?e62b","webpack:///./src/views/auth/LoginMachine.ts","webpack:///./src/views/auth/Login.vue","webpack:///./src/views/auth/Login.vue?12fa","webpack:///./src/views/auth/Login.vue?b554","webpack:///./src/views/auth/Login.vue?8eb4"],"names":["_arrayWithHoles","arr","Array","isArray","_iterableToArrayLimit","i","_i","Symbol","iterator","_s","_e","_arr","_n","_d","call","next","done","push","value","length","err","_nonIterableRest","TypeError","_slicedToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","mapValidationErrors","field","label","serverErrorMapper","errors","Object","entries","forEach","key","error","toLowerCase","id","$dirty","$errors","item","$validator","render","_vm","this","_h","$createElement","_c","_self","staticClass","_v","state","matches","attrs","on","$event","preventDefault","service","send","_m","directives","name","rawName","form","fields","expression","domProps","target","composing","$set","validations","windowRef","location","href","w","staticRenderFns","loginMachine","initial","states","idle","LOGIN","loading","RESOLVE","REJECT","success","type","failure","setup","props","vm","AsApi","BrsApi","window","dealerDashboardUrl","shoppingCartUrl","registerUrl","Error","useMachine","LoginMachine","emailAddress","password","required","email","$autoDirty","logIn","authState","user","authorization","maxNumberOfRingsInOrder","shopId","Shops","AllerSpanninga","allerspanningaAuthenticationLoginWithCredentials","data","BasisRingen","basisRingenAuthenticationLoginWithCredentials","dispatch","then","redirectPage","root","$route","query","red","origin","response","subscribe","s","component"],"mappings":"kHAAe,SAASA,EAAgBC,GACtC,GAAIC,MAAMC,QAAQF,GAAM,OAAOA,E,8FCDlB,SAASG,EAAsBH,EAAKI,GACjD,IAAIC,EAAY,MAAPL,EAAc,KAAyB,qBAAXM,QAA0BN,EAAIM,OAAOC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E,WAAU,SAACC,GACbA,EAAE1E,SAAW0E,EAAE1E,QAAQ,YACzBoD,UAKC,CACLzC,OACAZ,QACAmB,cACA5C,oBAAA,OACA+B,UACAc,YACAG,QCjO4Y,I,wBCQ9YqD,EAAY,eACd,EACArF,EACAiC,GACA,EACA,KACA,WACA,MAIa,aAAAoD,E,oECnBf","file":"js/chunk-1a711681.js","sourcesContent":["export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export interface GenericForm {\r\n fields: Record<string, unknown>;\r\n}\r\n\r\ninterface ServerErrors {\r\n [U: string]: string[];\r\n}\r\n\r\ninterface ServerErrorMapper {\r\n id: string;\r\n errors: ServerErrors;\r\n}\r\n\r\nexport function mapValidationErrors(\r\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n // @ts-ignore\r\n field: ValidationRuleset,\r\n label: string,\r\n serverErrorMapper?: ServerErrorMapper\r\n): string[] {\r\n const errors: string[] = [];\r\n\r\n if (serverErrorMapper) {\r\n Object.entries(serverErrorMapper?.errors).forEach(([key, error]) => {\r\n if (key.toLowerCase() === serverErrorMapper.id.toLowerCase()) {\r\n error.forEach((i) => {\r\n errors.push(i);\r\n });\r\n }\r\n });\r\n }\r\n\r\n if (!field || !field.$dirty) return errors;\r\n\r\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n // @ts-ignore\r\n field.$errors.forEach((item: ValidationRuleset) => {\r\n switch (item.$validator) {\r\n case \"email\":\r\n errors.push(\"Invalid email\");\r\n break;\r\n case \"required\":\r\n errors.push(`${label} is verplicht`);\r\n break;\r\n case \"password\":\r\n errors.push(\r\n \"Wachtwoord is niet correct. Een wachtwoord moet uit ten minste 8 tekens bestaan en één hoofdletter, kleine letter en cijfer bevatten\"\r\n );\r\n break;\r\n case \"sameAs\":\r\n errors.push(\"Wachtwoorden komen niet overeen \");\r\n break;\r\n default:\r\n break;\r\n }\r\n });\r\n\r\n return errors;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\r\nexport function getValidationErrors(form: any, field: any, label: string) {\r\n if (!form.errors) {\r\n return null;\r\n }\r\n if (field in form.errors) {\r\n return label;\r\n }\r\n return null;\r\n}\r\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('h1',{staticClass:\"title--preset-1 spacing\"},[_vm._v(\"Inloggen\")]),(_vm.state.matches('failure'))?_c('div',{staticClass:\"alert alert--error\",attrs:{\"role\":\"alert\"}},[_c('h3',{staticClass:\"title title--alert\"},[_vm._v(\"Inloggen mislukt\")]),_c('p',{staticClass:\"text-preset-small\"},[_vm._v(\" Controleer je e-mailadres en wachtwoord en probeer het opnieuw. \")])]):_vm._e(),_c('form',{staticClass:\"form spacing mb-10\",on:{\"submit\":function($event){$event.preventDefault();return _vm.service.send('LOGIN')}}},[_c('div',{staticClass:\"form__fields\"},[_c('div',{staticClass:\"input\"},[_vm._m(0),_c('div',{staticClass:\"input__field\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.form.fields.emailAddress),expression:\"form.fields.emailAddress\"}],attrs:{\"id\":\"field-01\",\"type\":\"email\",\"placeholder\":\"vul hier je e-mailadres\",\"aria-label\":\"E-mail\",\"required\":\"\"},domProps:{\"value\":(_vm.form.fields.emailAddress)},on:{\"input\":function($event){if($event.target.composing){ return; }_vm.$set(_vm.form.fields, \"emailAddress\", $event.target.value)}}}),(_vm.validations.emailAddress)?_c('div'):_vm._e()])]),_c('div',{staticClass:\"input\"},[_vm._m(1),_c('div',{staticClass:\"input__field\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.form.fields.password),expression:\"form.fields.password\"}],attrs:{\"id\":\"field-02\",\"type\":\"password\",\"placeholder\":\"vul hier je wachtwoord\",\"aria-label\":\"Wachtwoord\"},domProps:{\"value\":(_vm.form.fields.password)},on:{\"input\":function($event){if($event.target.composing){ return; }_vm.$set(_vm.form.fields, \"password\", $event.target.value)}}})])]),_c('div',{staticClass:\"flex justify-between\"},[_c('div',[_c('div',{staticClass:\"input\"},[_c('div',{staticClass:\"input__field\"},[_c('label',{staticClass:\"label\"},[_c('input',{attrs:{\"type\":\"checkbox\",\"aria-label\":\"Ingelogd blijven\"}}),_c('span',[_vm._v(\"Ingelogd blijven\")]),_c('div',{staticClass:\"input-icon\"},[_c('span',{staticClass:\"icon icon--check\"},[_c('svg',{attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 512 512\"}},[_c('path',{attrs:{\"d\":\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"}})])])])])])])]),_c('div',[_c('router-link',{staticClass:\"link link--preset-2\",attrs:{\"to\":{ name: 'requestPassword' }},domProps:{\"textContent\":_vm._s(\"Wachtwoord vergeten?\")}})],1)])]),_c('div',{staticClass:\"field__actions\"},[_c('button',{staticClass:\"button button--preset-2 button--lg\",attrs:{\"disabled\":_vm.state.matches('loading'),\"type\":\"submit\",\"aria-label\":\"Verzend login formulier\"}},[_c('span',[_vm._v(\"Inloggen\")])])])]),_c('div',{staticClass:\"alert alert--info\",attrs:{\"role\":\"alert\"}},[_c('h3',{staticClass:\"title title--alert\"},[_vm._v(\"Informatie\")]),_c('p',{staticClass:\"text-preset-small\"},[_vm._v(\" Nog geen gebruikersnaam en wachtwoord ontvangen? Vraag \"),_c('a',{staticClass:\"underline\",on:{\"click\":function($event){_vm.windowRef.location.href = (_vm.windowRef.location.origin) + \"/\" + (_vm.w.registerUrl)}}},[_vm._v(\"hier\")]),_vm._v(\" je inloggegevens aan. \")])])])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"input__label\"},[_c('label',{staticClass:\"text-preset-label text-color-darker\",attrs:{\"for\":\"field-01\"}},[_vm._v(\" E-mail: \")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"input__label\"},[_c('label',{staticClass:\"text-preset-label text-color-darker\",attrs:{\"for\":\"field-02\"}},[_vm._v(\" Wachtwoord: \")])])}]\n\nexport { render, staticRenderFns }","import { createMachine } from \"xstate\";\r\n\r\nconst loginMachine = createMachine({\r\n id: \"login\",\r\n initial: \"idle\",\r\n states: {\r\n idle: {\r\n on: {\r\n LOGIN: \"loading\",\r\n },\r\n },\r\n loading: {\r\n on: {\r\n RESOLVE: \"success\",\r\n REJECT: \"failure\",\r\n },\r\n },\r\n success: {\r\n type: \"final\",\r\n },\r\n failure: {\r\n on: {\r\n LOGIN: \"loading\",\r\n },\r\n },\r\n },\r\n});\r\n\r\nexport default loginMachine;\r\n","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\r\nimport { defineComponent, onMounted, reactive } from \"@vue/composition-api\";\r\nimport { AuthenticationAllerspanningaApi, AuthenticationBasisringenshopApi } from \"@/api\";\r\nimport { required, email } from \"@vuelidate/validators\";\r\nimport { useMachine } from \"xstate-vue2\";\r\nimport useVuelidate from \"@vuelidate/core\";\r\nimport Store from \"@/store\";\r\nimport { mapValidationErrors } from \"@/util/Forms\";\r\nimport { AuthState } from \"@/store/modules/auth/types\";\r\nimport Shops from \"@/enums/Shops\";\r\nimport LoginMachine from \"./LoginMachine\";\r\n\r\n// eslint-disable-next-line no-undef\r\ninterface ExtendedWindow extends Window {\r\n dealerDashboardUrl?: string;\r\n shoppingCartUrl?: string;\r\n registerUrl?: string;\r\n shopId?: string;\r\n}\r\n\r\nexport default defineComponent({\r\n setup(props, vm) {\r\n const AsApi = new AuthenticationAllerspanningaApi();\r\n const BrsApi = new AuthenticationBasisringenshopApi();\r\n // eslint-disable-next-line no-undef\r\n const w: ExtendedWindow = window || {};\r\n if (!w.dealerDashboardUrl || !w.shoppingCartUrl || !w.registerUrl) {\r\n throw new Error(\"Not all Urls are set\");\r\n }\r\n\r\n // eslint-disable-next-line no-undef\r\n const windowRef = window;\r\n\r\n const { state, service } = useMachine(LoginMachine as any);\r\n\r\n const form = reactive({\r\n errors: {},\r\n fields: {\r\n emailAddress: \"\",\r\n password: \"\",\r\n },\r\n });\r\n\r\n const validations = useVuelidate(\r\n {\r\n emailAddress: {\r\n required,\r\n email,\r\n $autoDirty: true,\r\n },\r\n password: {\r\n required,\r\n $autoDirty: true,\r\n },\r\n },\r\n form.fields\r\n );\r\n\r\n async function logIn() {\r\n const authState: AuthState = {\r\n user: { email: \"\" },\r\n authorization: null,\r\n maxNumberOfRingsInOrder: null,\r\n };\r\n try {\r\n if (w.shopId === Shops.AllerSpanninga) {\r\n const { data } = await AsApi.allerspanningaAuthenticationLoginWithCredentials({\r\n emailAddress: form.fields.emailAddress,\r\n password: form.fields.password,\r\n });\r\n authState.user = {\r\n email: form.fields.emailAddress,\r\n };\r\n authState.authorization = data;\r\n } else if (w.shopId === Shops.BasisRingen) {\r\n const { data } = await BrsApi.basisRingenAuthenticationLoginWithCredentials({\r\n emailAddress: form.fields.emailAddress,\r\n password: form.fields.password,\r\n });\r\n authState.user = {\r\n email: form.fields.emailAddress,\r\n };\r\n authState.authorization = data;\r\n }\r\n Store.dispatch(\"Auth/logIn\", authState).then(() => {\r\n const redirectPage = vm.root.$route?.query?.red;\r\n if (redirectPage) {\r\n if (redirectPage === w.shoppingCartUrl) {\r\n // Route to Winkelwagen\r\n // eslint-disable-next-line no-undef\r\n window.location.href = `${window.location.origin}/${w.shoppingCartUrl}`;\r\n } else if (redirectPage === w.dealerDashboardUrl) {\r\n // Route to Dashboard\r\n // eslint-disable-next-line no-undef\r\n window.location.href = `${window.location.origin}/${w.dealerDashboardUrl}`;\r\n }\r\n } else {\r\n // Route back to homepage\r\n // eslint-disable-next-line no-undef\r\n window.location.href = window.location.origin;\r\n }\r\n });\r\n } catch (err) {\r\n form.errors = err.response.data.errors;\r\n service.send(\"REJECT\");\r\n }\r\n }\r\n\r\n onMounted(() => {\r\n service.subscribe((s) => {\r\n if (s.matches && s.matches(\"loading\")) {\r\n logIn();\r\n }\r\n });\r\n });\r\n\r\n return {\r\n form,\r\n state,\r\n validations,\r\n mapValidationErrors,\r\n service,\r\n windowRef,\r\n w,\r\n };\r\n },\r\n});\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Login.vue?vue&type=template&id=becf40ba&scoped=true&\"\nimport script from \"./Login.vue?vue&type=script&lang=ts&\"\nexport * from \"./Login.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./Login.vue?vue&type=style&index=0&id=becf40ba&lang=scss&scoped=true&\"\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 \"becf40ba\",\n null\n \n)\n\nexport default component.exports","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=style&index=0&id=becf40ba&lang=scss&scoped=true&\""],"sourceRoot":""}