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AtC,aAAAA,GACI,IAAIuC,wBAA0B,GAS9B,OARIrL,KAAK2G,MAAMI,cAAgB/G,KAAKqG,OAAO0B,WACvCsD,wBAAwBC,KAAK,OAC7BD,wBAAwBC,KAAK,WAE7BD,wBAAwBC,KAAK,YAC7BD,wBAAwBC,KAAK,aAG1BtL,KAAK2G,MAAM4E,oBAAoBF,wBAC1C,EACAzC,SAAAA,GACI4C,aAAAA,EAAYC,+BAA+BzL,KAAK2G,OAC5C,SAAU+E,SAAUP,OAChB,MAAwB,iBAAVA,KAClB,IACA,SAAUzJ,IAAKgK,SAAUP,OACrBzJ,IAAIgK,UAAYC,aAAAA,EAAYC,YAAYT,MAC5C,GACR,EACAhC,sBAAAA,GACI,IAAI0C,KAAO7L,KAAK2G,MAAMmF,cAUtB,OARI9L,KAAK2G,MAAMI,cAAgB/G,KAAKqG,OAAO0B,YACvC8D,KAAKlE,MAAQkE,KAAKjE,SAClBiE,KAAKpE,IAAMoE,KAAKnE,gBACTmE,KAAKjE,iBAGTiE,KAAKhE,UAELgE,IACX,EACAE,yBAA0B,WACtB,IAAInK,KAAO5B,KACPA,KAAKoI,cACL4D,YAAW,WACPpK,KAAKwG,cAAe,CACxB,GAAG,IAEX,EACA6D,wBAAyB,WACjBjM,KAAKqG,OAAO6F,qBACZlM,KAAKmI,YAAa,EAClBgE,SAASC,KAAOpM,KAAKqG,OAAO6F,mBAEpC,GAGJG,WAAY,CACRC,qBAAoB,uBACpBC,UACAC,SAIM1B,GAClB,CA/MA9H,UAAUyJ,8BAA8BnM,UAAAA,EAAU2F,WAAWC,mBAAmB,WAC5EH,kBAAkB2G,WAAWvG,wBACjC,G","sources":["webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/mixins/popup-mixin.js","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/Recaptcha.vue","webpack://RdoWeb/ResourcePackages/Main/assets/src/scripts/components/Recaptcha.vue","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/Recaptcha.vue?8236","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/Recaptcha.vue?6559","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/PopUp.vue","webpack://RdoWeb/ResourcePackages/Main/assets/src/scripts/components/PopUp.vue","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/PopUp.vue?386b","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/components/PopUp.vue?46b9","webpack://RdoWeb/./ResourcePackages/Main/assets/src/scripts/widgets/customer-register.js"],"sourcesContent":["import { Constants } from \"../functions/constants\";\r\n\r\nconst popupMixin = {\r\n methods: {\r\n liftPopupSection: function (val) {\r\n var popup = this.$refs[\"popup\"];\r\n if (popup) {\r\n var section = popup.closest('body>section');\r\n }\r\n if (section)\r\n section.classList.toggle(Constants.CLASS_NAMES.BODY_MENUS_OPENED_CLASS, val)\r\n }\r\n }\r\n};\r\n\r\nexport default popupMixin;","var render = function render() {\n var _vm = this,\n _c = _vm._self._c\n return _c(\"div\", { ref: \"recaptchaContainer\" })\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","\r\n \r\n\r\n\r\n","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Recaptcha.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Recaptcha.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./Recaptcha.vue?vue&type=template&id=265b1fd1\"\nimport script from \"./Recaptcha.vue?vue&type=script&lang=js\"\nexport * from \"./Recaptcha.vue?vue&type=script&lang=js\"\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","var render = function render() {\n var _vm = this,\n _c = _vm._self._c\n return _c(\n \"div\",\n {\n ref: \"popup\",\n staticClass: \"added_to_cart_popup\",\n class: [{ shown: _vm.show }],\n attrs: { id: \"added_to_cart\" },\n },\n [\n _c(\n \"div\",\n { staticClass: \"atc_body\" },\n [\n _vm.withCloseButtons\n ? _c(\n \"button\",\n {\n staticClass: \"atc_close js_close\",\n on: {\n click: function ($event) {\n $event.stopPropagation()\n return _vm.closePopup.apply(null, arguments)\n },\n },\n },\n [\n _c(\"span\", { staticClass: \"sr--only\" }, [\n _vm._v(_vm._s(_vm.options.labels.close)),\n ]),\n _vm._v(\" \"),\n _c(\n \"svg\",\n {\n staticClass: \"svg-icon\",\n attrs: { viewBox: \"0 0 20 20\" },\n },\n [\n _c(\"path\", {\n attrs: {\n stroke: \"#333\",\n \"stroke-width\": \"2\",\n d: \"M 5 5 L 15 15 M 5 15 L 15 5\",\n },\n }),\n ]\n ),\n ]\n )\n : _vm._e(),\n _vm._v(\" \"),\n _vm._t(\"default\"),\n _vm._v(\" \"),\n _vm.withDotsLoader\n ? _c(\n \"div\",\n {\n staticClass:\n \"awaiting_overlay displayed partial dots_loader mt_40\",\n },\n [_c(\"p\", { attrs: { loader: \"loading\" } })]\n )\n : _vm._e(),\n _vm._v(\" \"),\n _vm.withCloseButtons\n ? _c(\n \"button\",\n {\n staticClass: \"atc_button white keep\",\n on: {\n click: function ($event) {\n $event.stopPropagation()\n return _vm.closePopup.apply(null, arguments)\n },\n },\n },\n [\n _vm._v(\n \"\\n \" +\n _vm._s(_vm.options.labels.ok) +\n \"\\n \"\n ),\n ]\n )\n : _vm._e(),\n ],\n 2\n ),\n ]\n )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","\r\n \r\n\r\n\r\n","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PopUp.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PopUp.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./PopUp.vue?vue&type=template&id=135289c3\"\nimport script from \"./PopUp.vue?vue&type=script&lang=js\"\nexport * from \"./PopUp.vue?vue&type=script&lang=js\"\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","import { WidgetInitializer } from \"../functions/widget-initializer\";\r\nimport { Constants } from \"../functions/constants\";\r\nimport { ConfigUtils } from \"../functions/config-utils\";\r\nimport { ObjectUtils } from \"../functions/object-utils\";\r\nimport { StringUtils } from \"../functions/string-utils\";\r\nimport { FormValidator } from \"../services/form-validator\";\r\nimport { ValidationModel } from \"../services/validation-model\";\r\nimport Recaptcha from \"../components/Recaptcha\";\r\nimport SelectBranchDropdown from \"../components/SelectBranchDropdown\";\r\nimport PopUp from \"../components/PopUp\";\r\nimport '../directives/mask-phone';\r\n\r\nvar widgetInitializer = new WidgetInitializer(Constants.COMPONENTS.CUSTOMER_REGISTER);\r\nGlobalApp.registerInitializationHandler(Constants.COMPONENTS.CUSTOMER_REGISTER, function () {\r\n widgetInitializer.initialize(initCustomerRegisterApp);\r\n});\r\n\r\nfunction initCustomerRegisterApp(element) {\r\n var config = ConfigUtils.getConfigFor(element);\r\n\r\n var formValidator = new FormValidator(config.validatorOptions);\r\n\r\n const customerValidationSchema = {\r\n accountType: { isRequired: true },\r\n countryCode: { isRequired: true },\r\n firstName: { isRequired: true, valueType: \"firstName\" },\r\n lastName: { isRequired: true, valueType: \"lastName\" },\r\n email: { isRequired: true, valueType: \"email\" },\r\n phone: { isRequired: true, valueType: \"phone\" },\r\n password: { isRequired: true, valueType: \"password\" },\r\n addressLine1: { isRequired: true, valueType: \"address\" },\r\n addressLine2: { isRequired: false, valueType: \"address\" }, \r\n city: { isRequired: true, valueType: \"city\" },\r\n zip: { isRequired: true, valueType: \"zip\" },\r\n postCode: { isRequired: true },\r\n state: { isRequired: true }, \r\n province: { isRequired: true }, \r\n recaptcha: { isRequired: true }\r\n };\r\n\r\n let model = new ValidationModel(formValidator, customerValidationSchema);\r\n model.populateFrom({\r\n accountType: null,\r\n countryCode: config.usIcoCode,\r\n recaptcha: ''\r\n });\r\n\r\n var vueApp = new Vue({\r\n el: '#' + element.id,\r\n\r\n data: {\r\n model: model,\r\n rememberMe: true, \r\n isAwaiting: false,\r\n showPassword: false,\r\n showNotHandledErrorMessage: false,\r\n triedToCreate: false \r\n },\r\n\r\n computed: {\r\n constants: () => Constants,\r\n config: () => config, \r\n validationModel: function () {\r\n return this.model.getValidationModel();\r\n }\r\n },\r\n\r\n methods: {\r\n createAccount: function () {\r\n var that = this;\r\n\r\n this.trimModel();\r\n var isModelValid = this.validateModel(); \r\n this.triedToCreate = true;\r\n \r\n if (isModelValid === false)\r\n return;\r\n \r\n this.isAwaiting = true;\r\n\r\n GlobalApp.RdoApiClient.fetchJson(\"customers/register\", {\r\n method: 'POST',\r\n jBody: this.getRegisterRequestBody()\r\n })\r\n .then(function (registerDetails) {\r\n var errorMessage = GlobalApp.ErrorHandler.handle(registerDetails);\r\n if (errorMessage) {\r\n var emailAlreadyInUseMassage = `Email ${that.model.email} already in use`;\r\n var firstNameErrorMessage = \"First Name must be max 15 characters\";\r\n var lastNameErrorMessage = \"Last Name must be max 18 characters\";\r\n if (errorMessage.toLowerCase() === emailAlreadyInUseMassage.toLowerCase()) {\r\n that.validationModel.email = {\r\n isValid: false,\r\n message: emailAlreadyInUseMassage\r\n };\r\n } else if (errorMessage === firstNameErrorMessage) {\r\n that.validationModel.firstName = {\r\n isValid: false,\r\n message: firstNameErrorMessage\r\n };\r\n } else if (errorMessage === lastNameErrorMessage) {\r\n that.validationModel.lastName = {\r\n isValid: false,\r\n message: lastNameErrorMessage\r\n };\r\n } else {\r\n that.showNotHandledErrorMessage = true;\r\n }\r\n\r\n return;\r\n }\r\n\r\n that.login(that.model.email, that.model.password, that.rememberMe);\r\n })\r\n .catch(function (err) {\r\n that.showNotHandledErrorMessage = true;\r\n console.warn(Constants.ERROR_MESSAGES.SOMETHING_WENT_WRONG, err);\r\n })\r\n .finally(function () {\r\n that.isAwaiting = false;\r\n });\r\n },\r\n login(email, pass, rememberMe) {\r\n var that = this;\r\n\r\n GlobalApp.CartService.getCartId()\r\n .then(function (cartId) {\r\n return GlobalApp.RdoApiClient.fetchJson(\"customers/login\", {\r\n method: 'POST',\r\n jBody: {\r\n \"email\": email,\r\n \"password\": pass,\r\n \"cartId\": cartId\r\n }\r\n });\r\n })\r\n .then(function (loginDetails) {\r\n if (!loginDetails.token)\r\n return;\r\n\r\n that.postLoginRequestToTheLoginFormPage(email, loginDetails.token, rememberMe);\r\n });\r\n },\r\n postLoginRequestToTheLoginFormPage(email, pass, rememberMe) {\r\n var rootEl = this.$root.$el;\r\n var formEl = rootEl.nextElementSibling;\r\n if (formEl.nodeName !== \"FORM\")\r\n return;\r\n\r\n var inputs = formEl.elements;\r\n\r\n var usernameField = inputs[\"UserName\"];\r\n usernameField.value = email;\r\n\r\n var passwordField = inputs[\"Password\"];\r\n passwordField.value = pass;\r\n\r\n var rememberMeField = inputs[\"RememberMe\"];\r\n rememberMeField.value = rememberMe;\r\n\r\n formEl.submit();\r\n },\r\n validateModel() {\r\n let excludedPropertiesArray = [];\r\n if (this.model.countryCode !== this.config.usIcoCode) {\r\n excludedPropertiesArray.push(\"zip\");\r\n excludedPropertiesArray.push(\"state\");\r\n } else {\r\n excludedPropertiesArray.push(\"postCode\");\r\n excludedPropertiesArray.push(\"province\");\r\n }\r\n\r\n return this.model.isValidForAllExcept(excludedPropertiesArray);\r\n },\r\n trimModel() {\r\n ObjectUtils.traversePropertiesAndTransform(this.model,\r\n function (propName, value) {\r\n return typeof value === 'string';\r\n },\r\n function (obj, propName, value) {\r\n obj[propName] = StringUtils.trimOrEmpty(value);\r\n });\r\n },\r\n getRegisterRequestBody() {\r\n var body = this.model.getSubModel(); \r\n\r\n if (this.model.countryCode !== this.config.usIcoCode) {\r\n body.state = body.province;\r\n body.zip = body.postCode;\r\n delete body.province;\r\n }\r\n\r\n delete body.recaptcha;\r\n\r\n return body;\r\n },\r\n switchPasswordVisibility: function switchPasswordVisibility() {\r\n var that = this;\r\n if (this.showPassword) {\r\n setTimeout(function () {\r\n that.showPassword = false;\r\n }, 1000);\r\n }\r\n },\r\n businessAccountSelected: function () {\r\n if (this.config.businessAccountUrl) {\r\n this.isAwaiting = true;\r\n location.href = this.config.businessAccountUrl\r\n }\r\n }\r\n }, \r\n\r\n components: {\r\n SelectBranchDropdown,\r\n Recaptcha,\r\n PopUp\r\n }\r\n });\r\n\r\n return vueApp.$el;\r\n}"],"names":["methods","liftPopupSection","val","popup","this","$refs","section","closest","classList","toggle","Constants","CLASS_NAMES","BODY_MENUS_OPENED_CLASS","render","_c","_self","ref","_withStripped","name","props","sitekey","type","String","default","size","theme","tabindex","data","widgetId","grecaptchaLoadedHandler","obj","eventArgs","that","src","EXTERNAL_SCRIPTS","GRECAPTCHA_SRC","grecaptcha","window","console","error","ready","init","recaptchaOptions","callback","grecaptchaConfirmed","grecaptchaExpired","recaptchaContainer","response","$emit","grecaptchaReset","reset","created","GlobalApp","EventHub","subscribeToEvent","EVENTS","EXTERNAL_SCRIPT_LOADED","generalSettings","gRecaptchaDataSitekey","ExternalScriptsLoader","load","destroyed","unsubscribeToEvent","_vm","staticClass","class","shown","show","attrs","id","withCloseButtons","on","click","$event","stopPropagation","closePopup","apply","arguments","_v","_s","options","labels","close","viewBox","stroke","d","_e","_t","withDotsLoader","loader","ok","mixins","popupMixin","Boolean","Object","closeAllPopupsHandler","watch","handler","CLOSE_ALL_POPUPS","widgetInitializer","WidgetInitializer","COMPONENTS","CUSTOMER_REGISTER","initCustomerRegisterApp","element","config","ConfigUtils","getConfigFor","formValidator","FormValidator","validatorOptions","model","ValidationModel","accountType","isRequired","countryCode","firstName","valueType","lastName","email","phone","password","addressLine1","addressLine2","city","zip","postCode","state","province","recaptcha","populateFrom","usIcoCode","Vue","el","rememberMe","isAwaiting","showPassword","showNotHandledErrorMessage","triedToCreate","computed","constants","validationModel","getValidationModel","createAccount","trimModel","isModelValid","validateModel","RdoApiClient","fetchJson","method","jBody","getRegisterRequestBody","then","registerDetails","errorMessage","ErrorHandler","handle","emailAlreadyInUseMassage","concat","toLowerCase","isValid","message","login","catch","err","warn","ERROR_MESSAGES","SOMETHING_WENT_WRONG","finally","pass","CartService","getCartId","cartId","loginDetails","token","postLoginRequestToTheLoginFormPage","formEl","$root","$el","nextElementSibling","nodeName","inputs","elements","value","submit","excludedPropertiesArray","push","isValidForAllExcept","ObjectUtils","traversePropertiesAndTransform","propName","StringUtils","trimOrEmpty","body","getSubModel","switchPasswordVisibility","setTimeout","businessAccountSelected","businessAccountUrl","location","href","components","SelectBranchDropdown","Recaptcha","PopUp","registerInitializationHandler","initialize"],"sourceRoot":""}