PageSourceSearch

https://www.puratos.com/etc.clientlibs/settings/wcm/designs/purato…/js/myPuratos-signUp.faba900c.chunk.js

js puratos.com collected 2026-10-02 03:58:22 UTC 30,011 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkpuratos_react=self.webpackChunkpuratos_react||[]).push([[7984],{4327(e,t,r){r.r(t),r.d(t,{default:()=>Pe});var n=r(96540),s=r(68912),o=r(19115),a=r(74848);const i=e=>{let{signUpModel:t}=e;const{registrationTitle:r,registrationText:n,flow:s}=t;return(0,a.jsxs)("header",{className:"sign-up__header",children:[(0,a.jsx)("h2",{className:"sign-up__title",children:r}),(0,a.jsx)("h6",{className:"sign-up__subtitle",dangerouslySetInnerHTML:{__html:n}})]})};var l=r(5556),c=r.n(l),u=r(95799),d=r(43516);function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){f(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function f(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const h=e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"sign-up__progress-bar--loading",children:(0,a.jsx)(d.Ay,m(m({height:"100px",width:"90%",speed:u.P.SPEED,backgroundColor:u.P.BACKGROUND,foregroundColor:u.P.FOREGROUND,style:{borderRadius:"10px"}},e),{},{children:(0,a.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%"})}))}),(0,a.jsxs)("div",{className:"sign-up__form--loading",children:[(0,a.jsx)(d.Ay,m(m({height:"100px",width:"90%",speed:u.P.SPEED,backgroundColor:u.P.BACKGROUND,foregroundColor:u.P.FOREGROUND,style:{borderRadius:"10px"}},e),{},{children:(0,a.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%"})})),(0,a.jsx)(d.Ay,m(m({height:"100px",width:"90%",speed:u.P.SPEED,backgroundColor:u.P.BACKGROUND,foregroundColor:u.P.FOREGROUND,style:{borderRadius:"10px"}},e),{},{children:(0,a.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%"})})),(0,a.jsx)(d.Ay,m(m({height:"100px",width:"90%",speed:u.P.SPEED,backgroundColor:u.P.BACKGROUND,foregroundColor:u.P.FOREGROUND,style:{borderRadius:"10px"}},e),{},{children:(0,a.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%"})}))]})]}),g=e=>{let{steps:t,activeStep:r}=e;const s=(0,n.useRef)(null),o=t.map((e,s)=>{const o=s===r,i=s<r;return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("div",{className:"step".concat(i?" step--complete":o?" step--active":""),"data-step":e,children:s+1}),s!==t.length-1&&(0,a.jsx)("div",{className:"dashed-line"})]},s)});return(0,a.jsx)("div",{ref:s,className:"sign-up__progress-bar",children:(0,a.jsx)("div",{className:"steps",children:o})})};g.propTypes={steps:c().arrayOf(c().string).isRequired,activeStep:c().number.isRequired};var b=r(41953);const v=e=>{let{signUpModel:t}=e;const{benefitsTitle:r,benefitsDescription:s,benefitsList:o}
1=t,[i,l]=(0,n.useState)(!1);return r&&s&&o?(0,a.jsxs)("div",{className:"sign-up__benefits",children:[(0,a.jsx)("div",{className:(0,b.ig)("sign-up__benefits-title","opened",i),onClick:()=>l(!i),onKeyDown:e=>"Enter"===e.key&&l(!i),role:"button",tabIndex:0,children:r}),(0,a.jsx)("div",{className:(0,b.ig)("sign-up__benefits-description","opened",i),dangerouslySetInnerHTML:{__html:s}}),(0,a.jsx)("ul",{className:(0,b.ig)("sign-up__benefits-list","opened",i),children:o.length&&o.map((e,t)=>{let{benefitsItem:r}=e;return(0,a.jsx)("li",{className:"sign-up__benefits-list-item",children:r},t)})})]}):null};var y=r(74810),j=r(16718);const w=e=>{let{onClick:t,hidden:r=!1,disabled:n=!1,children:s,type:o}=e;return(0,a.jsx)("button",{type:"button",className:"button--".concat(o," ").concat(r?"button--hidden":""),disabled:n,onClick:t,children:s})};w.propTypes={onClick:c().func.isRequired,disabled:c().bool,children:c().node.isRequired,type:c().string.isRequired};var x=r(45047),S=r(54585);const P=e=>{let{schema:t,uiSchema:r}=e;const n=r["ui:apiError"],s=r["ui:errorName"];if(!(!!s||!!n)||!t.errors)return null;const o=s&&t.errors[s],[i,l]=o?o.split("|"):n?n.split("|"):["",""],[c,u,d]=i.split("*");return(0,a.jsxs)("p",{className:"extra-text extra-text--error",children:[c&&c,u&&l?(0,a.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:u}):u||null,d&&d]})};function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach(function(t){N(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function N(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _=e=>{let{value:t,label:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flag flag--".concat(null===t||void 0===t?void 0:t.toLowerCase())}),r]})},D=e=>{let{schema:t,uiSchema:r,onChange:s,formData:o,isPhone:i}=e;const l=t.Enum.map(e=>{let{value:t,title:r}=e;return{value:t,label:r}}),c=i?l.find(e=>{let{value:t}=e;return t.toLowerCase()===(0,S.Ul)().substring(3).toLowerCase()}):l[0],u=l.filter(e=>{let{value:t}=e;return""!==t}),d=o?l.find(e=>e.value.toLowerCase()===o.toLowerCase()):c,p=(0,n.useRef)();return(0,n.useEffect)(()=>{i&&s(d.value)},[]),(0,a.jsxs)("div",{className:"custom-select custom-field",children:[t.title&&(0,a.jsx)("label",{className:"control-field",children:t.title}),(0,a.jsx)(x.Ay,{ref:p,defaultValue:c,value:d,isSearchable:!0,options:u,onChange:e=>{var t;s(e.value),null===(t=p.current)||void 0===t||t.blur()},onMenuClose:()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.blur()},formatOptionLabel:i?_:void 0,classNamePrefix:"custom-select",className:i||(null===d||void 0===d?void 0:d.value)!==(null===c||void 0===c?void 0:c.value)?"":"default"}),(0,a.jsx)(P,{schema:t,uiSchema:r})]})},E=e=>(0,a.jsx)(D,C(C({},e),{},{isPhone:!0}));var T=r(84593);const k=e=>e.split("").map(e=>String.fromCharCode(e.charCodeAt(0)+13)).join(""),M=e=>e.split("").map(e=>String.fromCharCode(e.charCodeAt(0)-13)).join("");function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach(function(t){L(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEac
1h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function L(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const A=e=>{const{required:t,disabled:r,readonly:s,schema:o,uiSchema:i,onChange:l,idSchema:c,setSignUpPassword:u,setSignUpRePassword:d,password:p,rePassword:m,isRepassword:f=!1}=e,[h,g]=(0,n.useState)(!1);return(0,a.jsxs)("div",{className:"custom-password custom-field",children:[o.title&&(0,a.jsx)("label",{htmlFor:c.$id,className:"control-label",children:o.title}),(0,a.jsxs)("div",{className:"custom-password__input",children:[(0,a.jsx)("input",{name:c.$id,className:"form-control",required:t,disabled:r,readOnly:s,maxLength:o.maxLength,id:c.$id,type:h?"text":"password",value:f?m:p,placeholder:i["ui:placeholder"],onChange:e=>{l(e.target.value),f?d(e.target.value):u(e.target.value)}}),(0,a.jsx)("button",{type:"button",className:"custom-password__eye ".concat(h?"active":""),tabIndex:-1,onClick:()=>g(!h)})]}),i["ui:description"]&&(0,a.jsx)("p",{className:"extra-text",children:i["ui:description"]}),(0,a.jsx)(P,{schema:o,uiSchema:i})]})},I=e=>({password:M(e.formData.password),rePassword:M(e.formData.rePassword)}),F=e=>({setSignUpPassword:t=>{const r=k(t);e((0,T.wi)(r))},setSignUpRePassword:t=>{const r=k(t);e((0,T.Zp)(r))}}),V=(0,o.connect)(I,F)(A),q=(0,o.connect)(I,F)(e=>(0,a.jsx)(A,U(U({},e),{},{isRepassword:!0})));var G=r(82135);const B={ValidIcon:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,a.jsx)("path",{d:"M9.99951 1.90723C5.53695 1.90723 1.90625 5.53809 1.90625 10.0005C1.90625 14.4629 5.53695 18.0938 9.99951 18.0938C14.4621 18.0938 18.0928 14.4635 18.0928 10.0005C18.0928 5.53745 14.4614 1.90723 9.99951 1.90723ZM9.99951 17.1154C6.07618 17.1154 2.88347 13.9233 2.88347 10.0005C2.88347 6.07764 6.07618 2.88508 9.99951 2.88508C13.9228 2.88508 17.1151 6.07716 17.1151 10.0005C17.1151 13.9238 13.9228 17.1154 9.99951 17.1154Z",fill:"#007D32"}),(0,a.jsx)("path",{d:"M13.1206 7.58634L8.75753 11.9488L6.87561 10.0668C6.75466 9.93362 6.54862 9.92367 6.4154 10.0446C6.28218 10.1656 6.27223 10.3716 6.39317 10.5048C6.40022 10.5126 6.40764 10.52 6.4154 10.527L8.52742 12.6403C8.65443 12.7674 8.86041 12.7675 8.98749 12.6405C8.98745 12.6405 8.98754 12.6404 8.98749 12.6405L13.5808 8.04781C13.7082 7.92073 13.7085 7.7144 13.5814 7.58697C13.4543 7.45954 13.248 7.45925 13.1206 7.58634Z",fill:"#007D32"})]}),InvalidIcon:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,a.jsx)("path",{d:"M9.99951 1.90674C5.53743 1.90674 1.90625 5.5376 1.90625 10C1.90625 14.4624 5.53774 18.0933 9.99951 18.0933C14.4613 18.0933 18.0928 14.4629 18.0928 10C18.0928 5.53712 14.4619 1.90674 9.99951 1.90674ZM9.99951 17.1154C6.07603 17.1154 2.88379 13.9232 2.88379 10.0002C2.88379 6.07715 6.07634 2.88444 9.99951 2.88444C13.9227 2.88444 17.1146 6.07667 17.1146 10.0002C17.1146 13.9236 13.9227 17.1154 9.99951 17.1154Z",fill:"#CC0935"}),(0,a.jsx)("path",{d:"M10.4472 10.0004L12.9821 7.46545C13.1153 7.34451 13.1253 7.13846 13.0043 7.00524C12.8834 6.87202 12.6774 6.86207 12.5441 6.98302C12.5364 6.99006 12.529 6.99748 12.5219 7.00524L9.98666 9.5397L7.45141 7.00445C7.31819 6.88351 7.11215 6.89346 6.9912 7.02668C6.87843 7.15089 6.87843 7.34044 6.9912 7.46466L9.52598 10.0004L6.99073 12.5356C6.85896 12.658 6.85138 12.8641 6.97378 12.9958C7.09618 13.1276 7.30222 13.1352 7.43398 13.0128C7.43984 13.0074 7.44549 13.0017 7.45093 12.9958L9.98666 10.4611L12.5221 12.9965C12.6445 13.1282 12.8505 13.1358 12.9823 13.0134C13.114 12.891 13.1216 12.685 12.9992 12.5532C12.9938 12.5474 12.9881 12.5417 12.9823 12.5363L10.4472 10.0004Z",fill:"#CC0935"})]})},$=(0,o.connect)(e=>({password:M(e.formData.password),rePassword:M(e.formData.rePassword),isPasswordValid:e.isPasswordValid}),e=>({setIsPasswordValid:t=>e((0,T.CM)(t))}))(e=>{let{password:t,requirements:r,isPasswordValid:n,setIsPasswordValid:s}=e;if(!r)return null;const{title:o,rules:i,minLength:l,messages:c}=r;return(0,a.jsxs)("div",{className:"password-tips",children:[(0,a.jsx)("span",{className:"password-tips__title",children:o}),(0,a.jsx)(G.A,{rules:i,minLength:l,messages:c,value:t,onChange:e=>{e!==n&&s(e)},invalidTextColor:"#000",validTextColor:"#000",iconComponents:B})]})}),J=e=>{let{schema:t,uiSchema:r,formData:n,onChange:s}=e;const{href:o,hrefText:i,title:l}=t;return(0,a.jsxs)("div",{className:"checkbox custom-field",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:n,onChange:()=>s(!n)}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:l}),o&&i&&(0,a.jsx)("a",{target:"_blank",rel:"noreferrer",href:o,children:i})]})]}),(0,a.jsx)(P,{schema:t,uiSchema:r})]})},K=e=>{const{schema:t,uiSchema:r,formData:n,value:s,onChange:o,options:i,id:l}=e,{title:c,enum:u=[],options:d=[]}=t,p=(null===r||void 0===r?void 0:r["ui:enumNames"])||[],m=(null===i||void 0===i?void 0:i.enumOptions)||[],f=m.length>0?m:d.length>0?d:u.map((e,t)=>({value:e,label:p[t]||e})),h=null!==n&&void 0!==n?n:s,g=l||c;return(0,a.jsxs)("div",{className:"custom-radio custom-field",children:[f.length?(0,a.jsx)("div",{className:"radio-label-wrapper",children:f.map((e,t)=>(0,a.jsxs)("label",{className:"radio-inline","aria-label":e.label,children:[(0,a.jsx)("input",{type:"radio",name:g,value:e.value,checked:h===e.value,onChange:()=>o(e.value)}),(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:e.label})})]},t))}):null,(0,a.jsx)(P,{schema:t,uiSchema:r})]})};var Z=r(10169),H=r(51701),z=r(54950);function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?X(Object(r),!0).forEach(function(t){Y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Y(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e,t,r){const n=t.split(".").filter(e=>""!==e);let s=e;for(let o=0;o<n.length;o++)if(""!==n[o]&&void 0!==s[n[o]])o===n.length-1?s[n[o]]=W(W({},s[n[o]]),r):s=s[n[o]];else if(void 0===s[n[o]])s[n[o]]=W({},r);else if(""!==n[o])return}const ee=e=>{setTimeout(()=>{const t=document.querySelector(e);if(t){const e=t.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:e,behavior:"smooth"})}},500)};function te(e,t){const r=t.split(".");let n=e;for(let s=0;s<r.length;s++)if(""!==r[s]&&void 0!==n[r[s]])n=n[r[s]];else if(""!==r[s])return;return n}const re=async e=>{const{fieldEncryptionEndpointPath:t}=Z.M_.getState().myPuratos_account.signUpModel;try{const r=await fetch("".concat(t,"?fieldValue=").concat(encodeURIComponent(e)));if(r.ok){const e=await r.json(),{encryptedFieldValue:t}=e;return t}return console.error("Password encryption API failed",r.statusText),e}catch(r){return console.error(r),e}},ne=async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const{fieldValidationEndpointPath:s,formLocale:o}=Z.M_.getState().myPuratos_account.signUpModel,{i18n:a}=Z.M_.getState().myPuratos_i18n,i=r.toLowerCase().includes("password"),l=i?await re(e):e;if(i&&l===e)return console.error("Password encryption API failed"),{status:500,data:{Errors:[(0,z.T)(a,"General error")||"General error"]},key:r};if(!s)return null;try{const e=await fetch("".concat(s,"?locale=").concat(o,"&validationType=").concat(t,"&fieldValue=").concat(((e,t)=>e?JSON.stringify({[e.split(".").pop()]:t}):JSON.stringify(t))(r,l)));if(200===e.status&&n)return{status:200,data:{},key:r};const a=await e.json();return{status:e.status,data:a,key:r}}catch(c){return console.error(c),{status:500,data:{Errors:[(0,z.T)(a,"General error")||"General error"]},key:r}}},se=async(e,t,r,n,s)=>{const o={},a=[];return e.forEach(e=>{let{status:r,data:n,key:i}=e;r||a.push(!1),200===r?(o[i]=te(s,i),a.push(!0)):(Q(t,i,{classNames:"has-error","ui:apiError":n.Errors[0]}),a.push(!1))}),n(W(W({},r),o)),a.every(e=>e)};function oe(e){return Object.entries(e).reduce((e,t)=>{let[r,n]=t;if(n&&"object"===typeof n&&!Array.isArray(n)){const t=oe(n);e[r]=t}else""!==n&&(e[r]=n);return e},{})}const ae=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";for(const[n,s]of Object.entries(e)){const e=r?"".concat(r,".").concat(n):n;if(n===t)return e;if(null!==s&&"object"===typeof s){const r=ae(s,t,e);if(r)return r}}return null},ie=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(const[n,s]of Object.entries(e))if(null!==s&&"object"===typeof s)await ie(s,e,n);else if("password"===n){const n=await re(s);t&&r?(t[r].password=n,delete t[r].rePassword):(e.password=n,delete e.rePassword)}},le=async e=>{let{formRef:t,setFormData:r,activeStep:n,setActiveStep:s,setUiSchema:o,validatedData:a,setValidatedData:i,form:l,currentStep:c,setIsKnownEmail:u,setIsValidating:d}=e;d(!0);let p=!0;const m=l.length,{UiSchema:f,Schema:h,isPasswordStep:g,fieldsForApiValidation:b}={UiSchema:W({},c.UISchema),Schema:c.Schema,isPasswordStep:!!c.PasswordChecklist,fieldsForApiValidation:c.fieldsForApiValidation||[]},v=n+1===m,y=Z.M_.getState().myPuratos_account.signUpModel.flow,{i18n:j}=Z.M_.getState().myPuratos_i18n,w=t.state.formData,x=M(Z.M_.getState().formData.password)||"",S=M(Z.M_.getState().formData.rePassword)||"",P=g?W(W({},w),{},{password:x,rePassword:S}):w,{errors:O}=t.validate(oe(P));let C=!1,N="failed",_=!g;const D=JSON.parse(JSON.stringify(f));if(r(w),C=await(async e=>{let{validatedData:t,setValidatedData:r,formData:n,errors:s,updatedUiSchema:o,fieldsForApiValidation:a}=e;if(0===a.length)return!0;const i=a.filter(e=>{let{key:t}=e;return!s.some(e=>{let{property:r}=e;return null===r||void 0===r?void 0:r.includes(t)})&&void 0!==te(n,t)&&""!==te(n,t)}).filter(e=>{let{key:r}=e;return t[r]!==te(n,r)}).map(e=>{let{key:t,validationType:r}=e;return ne(te(n,t),r,t)});try{const e=await Promise.all(i);return await se(e,o,t,r,n)}catch(l){return console.error(l),!1}})({validatedData:a,setValidatedData:i,Schema:h,formData:w,errors:O,updatedUiSchema:D,fieldsForApiValidation:b}),O.length>
10&&O.forEach(e=>{let{property:t,name:r}=e;Q(D,t,{classNames:"has-error","ui:errorName":r})}),"existing-customer"===y&&0===n&&C&&0===O.length){const e=await(async(e,t)=>{const r=t.map(t=>{let{key:r,validationType:n,isSimple:s}=t;return s?null:{value:{[r]:te(e,r)},type:n}}).filter(e=>!!e);if(0===r.length)return!1;const n=r.reduce((e,t)=>{const r=t.type;return e[r]||(e[r]=[]),e[r].push(t),e},{}),s=[];Object.keys(n).forEach(e=>{let t={};n[e].forEach(e=>{let{value:r}=e;return t=W(W({},t),r)}),s.push({value:t,validationType:e})});const o=s.map(e=>{let{value:t,validationType:r}=e;return ne(t,r,"",!1)});try{return(await Promise.all(o))[0].data.hasContact}catch(a){return console.error(a),!1}})(w,b);u(e)}g&&(_=((e,t)=>{const r=Z.M_.getState().formData.isPasswordValid,n=ae(e,"password"),s=ae(e,"rePassword"),o=M(Z.M_.getState().formData.password)||"",a=M(Z.M_.getState().formData.rePassword)||"",i=a===o,l=t.some(e=>{let{property:t}=e;return t.includes("password")});return!i&&a.length>0&&(Q(e,s,{classNames:"has-error","ui:errorName":"NoMatch"}),ee(".has-error")),r||l||(Q(e,n,{classNames:"has-error","ui:errorName":"password"}),ee(".has-error")),i&&r})(D,O));const E=((e,t)=>{const r=ae(t,"ConfirmEmail")||ae(t,"confirmEmail");if(!r)return!0;const n=te(t,r);if("hidden"===(null===n||void 0===n?void 0:n["ui:widget"]))return!0;const s=(e.Email||e.email||"").trim(),o=(e.ConfirmEmail||"").trim(),a=s.toLowerCase()===o.toLowerCase();if(!a){const{i18n:e}=Z.M_.getState().myPuratos_i18n;Q(t,r,{classNames:"has-error","ui:errorName":"NoMatch","ui:apiError":(0,z.T)(e,"E-mail addresses do not match")}),ee(".has-error")}return a})(w,D);d(!1);const T=async()=>{if(!v)return s(n+1),ee(".steps"),void(p=!1);d(!0);const e=await(async e=>{const{formSubmitEndpointPath:t,formLocale:r,formId:n,successRedirect:s,errorRedirect:o}=Z.M_.getState().myPuratos_account.signUpModel,a=JSON.parse(JSON.stringify(e)),i=window.location.href.split("?")[0];if(await ie(a),te(e,ae(e,"password"))===te(a,ae(a,"password")))return!1;try{return(await fetch("".concat(t,"?locale=").concat(r,"&formId=").concat(n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({formData:JSON.stringify(a),URLOptIn:i})})).ok?(window.location.href=s,!0):(window.location.href=o,console.error("Form submission failed"),!1)}catch(l){return window.location.href=o,console.error(l),!1}})(w);e||(Q(D,"password",{classNames:"has-error","ui:apiError":(0,z.T)(j,"General error")||"General error"}),d(!1),N="failed",console.error("Password encryption API failed"))};0===O.length&&C&&_&&E?(N="success",await T()):ee(".has-error"),p&&o(D),H.v.submitSignUpStep({email_address:w.Email||"",result:N,customer_type:y||"",step:v?"final":"".concat(n+1)})},ce=e=>{if(!e)return null;return e.split(",").map(e=>e.trim())[0]},ue=(e,t,r,n)=>{if(0===e.length)throw new Error("Invalid properties array for address object.");const s=((e,t,r)=>{const n=W(W(W(W(W(W({},(null===t||void 0===t?void 0:t.box)&&{box:t.box}),(null===t||void 0===t?void 0:t.city)&&{city:t.city}),(null===t||void 0===t?void 0:t.streetNumber)&&{number:t.streetNumber}),ce(null===t||void 0===t?void 0:t.postalCode)&&{postalCode:ce(t.postalCode)}),(null===t||void 0===t?void 0:t.streetName)&&{street:t.streetName}),(null===t||void 0===t?void 0:t.State)&&{State:t.State}),s=de(r,e);return e.reverse().reduce((e,r,o)=>0===o?W(W({},s),{},{[r.replace(/Manual/g,"").trim()]:t.label||"",[r]:n}):{[r]:e},{})})(e,t,n);r(()=>oe(W(W({},n),s)))},de=(e,t)=>{let r=W({},e);if(t.length<2)return{};for(let n=0;n<t.length;n++){const e=t[n].trim();if(e.toLowerCase().includes("manual"))return r;r=r[e]}};const pe=e=>{let t=Object.assign({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));const{idSchema:r,required:s,disabled:o,readonly:i,autofocus:l,onChange:c,onBlur:u,schema:d,uiSchema:p,formData:m}=t,f=(0,n.useRef)(null);(0,n.useEffect)(()=>{var e;l&&(null===(e=f.current)||void 0===e||e.focus())},[l]);return(0,a.jsxs)("div",{className:"custom-field",children:[d.title&&(0,a.jsx)("label",{className:"control-label",htmlFor:r.$id,children:d.title}),(0,a.jsx)("input",{ref:f,id:r.$id,name:r.$id,className:"form-control",label:d.title,required:s,disabled:o,readOnly:i,value:m,onChange:e=>{c(e.target.value)},onBlur:e=>{u(r.$id,e.target.value)},type:"text",maxLength:d.maxLength,placeholder:p["ui:placeholder"]}),(0,a.jsx)("p",{className:"extra-text",children:p["ui:description"]}),(0,a.jsx)(P,{schema:d,uiSchema:p})]})};var me=r(91785);const fe=(0,S.gI)(),he="https://atlas.microsoft.com/search/address/json?api-version=1.0&subscription-key=".concat("sTxM0XHmq5XxWj1ZFl5L-L0TmezILCMRKJNPsr0hdTo"),ge=fe?"".concat(he,"&countrySet=").concat(fe):he,be=e=>{let t=Object.assign({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));const{idSchema:r,required:s,disabled:o,readonly:i,autofocus:l,onChange:c,onBlur:u,schema:d,uiSchema:p,formData:m,onChildChange:f}
1=t,[h,g]=(0,n.useState)(!1),[b,v]=(0,n.useState)([]),y=(0,n.useRef)(null),j=(0,n.useRef)(null),{i18n:w}=Z.M_.getState().myPuratos_i18n,x=(S=e=>{g(!0),fetch("".concat(ge,"&query=").concat(e,"&typeahead=true&limit=4")).then(e=>e.json()).then(e=>{const t=e.results.map(e=>{const t=e.address||{};return{label:t.freeformAddress||"",city:t.municipality||"",postalCode:t.extendedPostalCode||t.postalCode||"",streetName:t.streetName||"",streetNumber:t.streetNumber||"",box:"",State:t.countrySubdivisionCode||t.countrySecondarySubdivision||"",lat:e.position.lat||0,lon:e.position.lon||0}});t.push({label:(null===d||void 0===d?void 0:d.manualSelection)||"Enter address manually",lat:0,lon:0}),v(t),g(!1)}).catch(e=>{f&&null!==d&&void 0!==d&&d.objToFill&&f(d.objToFill,{label:(null===d||void 0===d?void 0:d.manualSelection)||"Enter address manually",lat:0,lon:0}),console.error("Error fetching data:",e),g(!1)})},O=800,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(...t)},O)});var S,O;return(0,n.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]),(0,n.useEffect)(()=>{var e,t;l&&(null===(e=j.current)||void 0===e||null===(t=e.focus)||void 0===t||t.call(e))},[l]),m&&m.trim()?null:(0,a.jsxs)(a.Fragment,{children:[d.title&&(0,a.jsx)("label",{className:"control-label",htmlFor:r.$id,children:d.title}),(0,a.jsx)(me.EX,{ref:j,filterBy:()=>!0,id:"azure-maps-autocomplete",inputProps:{id:r.$id},isLoading:h,labelKey:"label",className:"custom-field",minLength:2,name:r.$id,onSearch:e=>{e.length>=2&&x(e)},options:b,required:s,disabled:o,promptText:(0,z.T)(w,"Type to search")||"Type to search",searchText:(0,z.T)(w,"Searching")||"Searching...",readOnly:i,value:m,placeholder:p["ui:placeholder"],onChange:e=>{e.length>0&&f&&null!==d&&void 0!==d&&d.objToFill&&f(d.objToFill,e[0])},renderMenuItemChildren:e=>(0,a.jsx)("span",{children:e.label})}),(0,a.jsx)(P,{schema:d,uiSchema:p})]})};function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach(function(t){je(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function je(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const we=e=>{const{activeStep:t,setActiveStep:r,form:s}=e,[o,i]=(0,n.useState)(!0),l=s[t].UISchema?s[t]:o?s[t].Schema.properties.knownEmail:s[t].Schema.properties.unknownEmail,c=(0,n.useRef)(null),[u,d]=(0,n.useState)({}
1),[p,m]=(0,n.useState)(l.UISchema),[f,h]=(0,n.useState)(l.Schema),[g,b]=(0,n.useState)({}),[v,x]=(0,n.useState)(!1),{i18n:S}=Z.M_.getState().myPuratos_i18n;(0,n.useEffect)(()=>{h(l.Schema),m(l.UISchema)},[t,s]);const P=()=>{le({formRef:c.current,setFormData:d,activeStep:t,setActiveStep:r,form:s,setUiSchema:m,validatedData:g,setValidatedData:b,setIsKnownEmail:i,currentStep:l,setIsValidating:x})},O=e=>(0,a.jsxs)(j.Ay,ye(ye({ref:c},e),{},{disabled:v,fields:e.fields,children:[!!l.PasswordChecklist&&(0,a.jsx)($,{requirements:l.PasswordChecklist}),(0,a.jsxs)("div",{className:"sign-up__form-buttons",children:[(0,a.jsx)(w,{type:"previous",hidden:0===t,disabled:v,onClick:()=>{r(t-1),ee(".steps")},children:(0,z.T)(S,"Previous")||"Previous"}),(0,a.jsx)(w,{type:"next",hidden:t===s.length-1,disabled:v,onClick:P,children:(0,z.T)(S,"Next")||"Next"}),(0,a.jsx)(w,{type:"submit",hidden:t<s.length-1,disabled:v,onClick:P,children:(0,z.T)(S,"Submit")||"Submit"})]})]}));return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(O,{className:"sign-up__form",schema:f,uiSchema:p,formData:u,validator:y.Ay,widgets:{radio:K,Radio:K},fields:{businessDropdown:D,phoneDropdown:E,checkbox:J,radio:K,password:V,rePassword:q,customInput:pe,azureAutocomplete:e=>(0,a.jsx)(be,ye(ye({},e),{},{onChildChange:(e,t)=>
1((e,t)=>{const r=e.split(",");ue(r,t,d,c.current.state.formData)})(e,t)})),newAddressBtn:e=>(0,a.jsx)(w,ye(ye({},e),{},{type:"underline-primary",onClick:()=>{var t;(e=>{if(e){const t=e.split(",");ue(t,{},d,c.current.state.formData)}})(null===(t=e.schema)||void 0===t?void 0:t.objToFill)},children:e.schema.title}))}})})};we.propTypes={activeStep:c().number.isRequired,setActiveStep:c().func.isRequired,form:c().array.isRequired};const xe=e=>{let{signUpModel:t}=e;const[r,s]=(0,n.useState)(0),[o,i]=(0,n.useState)({}),[l,c]=(0,n.useState)(!0),[u,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const{formId:e,formLocale:r,formDefinitionEndpointPath:n}=t;(async()=>{try{if(e&&r&&n){const t=await fetch("".concat(n,"?formId=").concat(e,"&locale=").concat(r));if(!t.ok)throw new Error("HTTP error! status: ".concat(t.status));const s=await t.json();i(s),c(!1)}}catch(t){console.error("Failed to fetch form schema:",t),d(!0),c(!1)}})()},[t]);const p=l?(0,a.jsx)(h,{}):u?(0,a.jsx)("div",{className:"sign-up__form sign-up__form--error",children:"There has been a problem"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{steps:o.form.map(e=>e.name),activeStep:r}),(0,a.jsx)(we,{activeStep:r,setActiveStep:s,form:o.form})]});return(0,a.jsxs)("main",{className:"sign-up__content",children:[p,(0,a.jsx)(v,{signUpModel:t})]})};xe.propTypes={signUpModel:c().object.isRequired};const Se={fetchSignUpModel:s.sD},Pe=(0,o.connect)(e=>({mapping:e.myPuratos_dashboard.mapping,signUpModel:e.myPuratos_account.signUpModel}),Se)(e=>{let{fetchSignUpModel:t,signUpModel:r,mapping:s,newCustomer:o=!0}=e;return(0,n.useEffect)(()=>{t({mapping:s,newCustomer:o})},[s]),(0,a.jsx)("div",{className:"sign-up",children:(0,a.jsxs)("div",{className:"sign-up__wrapper",children:[(0,a.jsx)(i,{signUpModel:r}),(0,a.jsx)(xe,{signUpModel:r})]})})})}}]);
2//# sourceMappingURL=myPuratos-signUp.faba900c.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.