diff --git a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js index 0947534a5..44a7fa9f1 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as m,jsxs as K}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Ne,classes as ye}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as Ue,c as Le,a as Me}from"./createCustomerAddress.js";import{useState as p,useEffect as Te,useCallback as L,useMemo as xe}from"@dropins/tools/preact-hooks.js";import{s as de,b as Se}from"./simplifyTransformAttributesForm.js";import{v as Ce,u as ve,a as qe}from"./usePasswordValidationMessage.js";import{a as Ae}from"./getCustomerToken.js";import{p as le,E as fe}from"./getStoreConfig.js";import{c as W,g as Be,u as Ke,F as je,B as he}from"./UpdatePasswordForm.js";import{c as Ie}from"./transform-attributes-form.js";import{f as Ge,E as He}from"./EmailConfirmationForm.js";import{Header as Ve,InLineAlert as We,InputPassword as ge,Field as se,Checkbox as ie}from"@dropins/tools/components.js";/* empty css */import{S as $e}from"./SkeletonLoader.js";import{useText as Oe}from"@dropins/tools/i18n.js";const pe=(u,r)=>r!=null&&r.length?u.map(e=>{var c;const t=(c=r.find(({code:n})=>n===e.code))==null?void 0:c.defaultValue;return t?{...e,defaultValue:t}:e}):u,Je=({inputsDefaultValueSet:u,fieldsConfigForApiVersion1:r,apiVersion2:e})=>{const[t,c]=p([]);return Te(()=>{(async()=>{if(e){const i=await Ue("customer_account_create");if(i!=null&&i.length)if(u!=null&&u.length){const F=pe(i,u);c(F)}else c(i)}else{const i=de(Se),F=de(r),E=pe(i,u);c(r&&r.length?F:E)}})()},[e,r,u]),{fieldsListConfigs:t}},Qe=(u,r)=>{const e=["date_of_birth","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],t=Ie(u,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!r)return{...t,...t!=null&&t.gender?{gender:Number(t==null?void 0:t.gender)}:{}};const c={},n=[];return Object.keys(t).forEach(i=>{e.includes(i)?c[i]=i.includes("gender")?Number(t[i]):t[i]:n.push({attribute_code:i,value:t[i]})}),n.length>0&&(c.custom_attributes=n),c},Xe=({requireRetypePassword:u,addressesData:r,translations:e,isEmailConfirmationRequired:t,apiVersion2:c=!0,passwordConfigs:n,isAutoSignInEnabled:i,routeRedirectOnSignIn:F,routeSignIn:E,onErrorCallback:M,onSuccessCallback:h,setActiveComponent:w,handleSetInLineAlertProps:b,routeRedirectOnEmailConfirmationClose:S})=>{const[$,C]=p(!1),[o,a]=p(""),[g,d]=p(""),[j,N]=p(""),[I,v]=p(!1),[O,q]=p({userName:"",status:!1}),[l,A]=p(""),[J,G]=p(!1),[Q,y]=p(!1),[H,X]=p(!0),Y=L(s=>{const f=s.target.value;C(!f.length),f.length&&o.length&&f!==o&&d(e.passwordMismatch)},[o,e.passwordMismatch]),Z=L(s=>{const f=s.target.value;d(f.length?"":e.requiredFieldError),f.length&&l.length&&f!==l&&d(e.passwordMismatch)},[l,e.passwordMismatch,e.requiredFieldError]),k=L(s=>{a(s),d(s?l===s?"":e.passwordMismatch:e.requiredFieldError)},[e,l]),z=L(({target:s})=>{X(s.checked)},[]),D=L(()=>{if(W(w)){w("signInForm");return}W(E)&&(window.location.href=E())},[w,E]),R=L(s=>{A(s),C(!s.length),s===o&&d("")},[o]),ee=L(()=>{b(),A(""),W(S)?window.location.href=S():(v(!1),w==null||w("signInForm"))},[b,S,w]),U=()=>{G(!0),y(!1)},P=()=>{const s=l.length&&o.length,f=l!==o;U(),C(!l.length),o||d(e.requiredFieldError),s&&f&&d(e.passwordMismatch)};return{showPasswordErrorMessage:$,confirmPassword:o,confirmPasswordMessage:g,isKeepMeLogged:H,userEmail:j,showEmailConfirmationForm:I,isSuccessful:O,isClickSubmit:J,signUpPasswordValue:l,isLoading:Q,onSubmitSignUp:async(s,f)=>{var me,ne,ue;if(b(),d(""),y(!0),!f){P();return}if(u&&(g.length||l!==o)){U(),d(o.length?e.passwordMismatch:e.requiredFieldError),Ge(s,l,o);return}const Fe=c?"createCustomerV2":"createCustomer",{confirmPasswordField:Ye,...ae}=Be(s.target),{email:re,password:B,is_subscribed:we}=ae,be=(n==null?void 0:n.requiredCharacterClasses)||0,Pe=(n==null?void 0:n.minLength)||1;if(!Ce(B,be)||Pe>(B==null?void 0:B.length)){U();return}const _e=Qe({...ae,is_subscribed:!!we||!1},c),{data:T,errors:x}=await Le(_e,c),V=((ne=(me=T==null?void 0:T.createCustomer)==null?void 0:me.customer)==null?void 0:ne.firstname)||"";if(x&&(x!=null&&x.length))b==null||b({type:"error",text:x[0].message}),M==null||M(x),le(fe.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),N(re);else{const te={email:"",...T==null?void 0:T[Fe]};if(le(fe.CREATE_ACCOUNT_EVENT,{email:te==null?void 0:te.email,updateProfile:!0}),t||!i){if(h==null||h({userName:V,status:!0}),t){(ue=s.target)==null||ue.reset(),A(""),v(!0),N(re),y(!1);return}if(!i){y(!1),q({userName:V,status:!0});return}}const _=await Ae({email:re,password:B,translations:e,handleSetInLineAlertProps:b,onErrorCallback:M});if(_!=null&&_.userName){if(r!=null&&r.length)for(const ce of r)try{await Me(ce)}catch(Ee){console.error(e.failedCreateCustomerAddress,ce,Ee)}W(F)?window.location.href=F():(h==null||h({userName:_==null?void 0:_.userName,status:!0}),q({userName:_==null?void 0:_.userName,status:!0}))}else h==null||h({userName:V,status:!0}),q({userName:V,status:!0})}y(!1)},signInButton:D,handleSetSignUpPasswordValue:R,onKeepMeLoggedChange:z,handleHideEmailConfirmationForm:ee,handleConfirmPasswordChange:k,onBlurPassword:Y,onBlurConfirmPassword:Z}},lr=({requireRetypePassword:u=!1,addressesData:r,formSize:e="default",inputsDefaultValueSet:t,fieldsConfigForApiVersion1:c,apiVersion2:n=!0,isAutoSignInEnabled:i=!0,displayTermsOfUseCheckbox:F=!1,displayNewsletterCheckbox:E=!1,hideCloseBtnOnEmailConfirmation:M=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:S,onSuccessCallback:$,setActiveComponent:C,slots:o})=>{const a=Oe({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError",confirmPasswordPlaceholder:"Auth.SignUpForm.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Auth.SignUpForm.confirmPassword.floatingLabel",passwordMismatch:"Auth.SignUpForm.confirmPassword.passwordMismatch"}),{passwordConfigs:g,isEmailConfirmationRequired:d}=ve(),{fieldsListConfigs:j}=Je({fieldsConfigForApiVersion1:c,apiVersion2:n,inputsDefaultValueSet:t}),{inLineAlertProps:N,handleSetInLineAlertProps:I}=Ke(),{showPasswordErrorMessage:v,confirmPassword:O,confirmPasswordMessage:q,isKeepMeLogged:l,userEmail:A,showEmailConfirmationForm:J,isSuccessful:G,isClickSubmit:Q,signUpPasswordValue:y,isLoading:H,onSubmitSignUp:X,signInButton:Y,handleSetSignUpPasswordValue:Z,onKeepMeLoggedChange:k,handleHideEmailConfirmationForm:z,handleConfirmPasswordChange:D,onBlurPassword:R,onBlurConfirmPassword:ee}=Xe({requireRetypePassword:u,addressesData:r,translations:a,isEmailConfirmationRequired:d,apiVersion2:n,passwordConfigs:g,isAutoSignInEnabled:i,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:S,onSuccessCallback:$,setActiveComponent:C,handleSetInLineAlertProps:I,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:U,defaultLengthMessage:P}=qe({password:y,isClickSubmit:Q,passwordConfigs:g}),oe=xe(()=>v?a.requiredFieldError:U==="error"||(P==null?void 0:P.status)==="error"?" ":"",[P==null?void 0:P.status,U,v,a.requiredFieldError]),s=!d&&(r==null?void 0:r.length);return!j.length&&n?m("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:m($e,{activeSkeleton:"signUpForm"})}):G.status&&(o!=null&&o.SuccessNotification)?m(Ne,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:o==null?void 0:o.SuccessNotification,context:{isSuccessful:G}}):J?m(He,{formSize:e,userEmail:A,inLineAlertProps:N,hideCloseBtnOnEmailConfirmation:M,handleSetInLineAlertProps:I,onPrimaryButtonClick:z}):K("div",{className:ye(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[m(Ve,{title:a.title,divider:!1,className:"auth-sign-up-form__title"}),N.text?m(We,{className:"auth-sign-up-form__notification",type:N.type,variant:"secondary",heading:N.text,icon:N.icon}):null,K(je,{onSubmit:X,className:"auth-sign-up-form__form",loading:H,name:"signUp_form",fieldsConfig:j,children:[K(ge,{validateLengthConfig:P,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:g==null?void 0:g.minLength,errorMessage:oe,defaultValue:y,uniqueSymbolsStatus:U,requiredCharacterClasses:g==null?void 0:g.requiredCharacterClasses,onValue:Z,placeholder:a.placeholder,floatingLabel:a.floatingLabel,onBlur:R,children:[u?m("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:m(ge,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:a.confirmPasswordPlaceholder,floatingLabel:a.confirmPasswordFloatingLabel,errorMessage:q,defaultValue:O,onValue:D,onBlur:ee})}):null,s?m("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:m(se,{children:m(ie,{name:"",placeholder:a.keepMeLoggedText,label:a.keepMeLoggedText,checked:l,onChange:k})})}):null]}),E||F?K("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[E?m(se,{children:m(ie,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:a.subscribedDefaultText,label:a.subscribedDefaultText})}):null,F?m(se,{children:m(ie,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:a.privacyPolicyDefaultText,label:a.privacyPolicyDefaultText})}):null]}):null,K("div",{className:"auth-sign-up-form-buttons",children:[m(he,{type:"button",variant:"tertiary",style:{padding:0},buttonText:a.buttonSecondary,enableLoader:!1,onClick:Y}),m(he,{type:"submit",buttonText:a.buttonPrimary,variant:"primary",enableLoader:H})]})]}),m("div",{id:"createCustomerV2"})]})};export{lr as S}; +import{jsx as n,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Ue,classes as Le}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as Me,c as Te,a as xe}from"./createCustomerAddress.js";import{useState as p,useEffect as Se,useCallback as L,useMemo as Ce}from"@dropins/tools/preact-hooks.js";import{s as fe,b as ve}from"./simplifyTransformAttributesForm.js";import{v as qe,u as Ae,a as Be}from"./usePasswordValidationMessage.js";import{a as Ke}from"./getCustomerToken.js";import{p as he,E as ge}from"./getStoreConfig.js";import{c as $,g as je,u as Ie,F as Ge,B as pe}from"./UpdatePasswordForm.js";import{c as He}from"./transform-attributes-form.js";import{f as Fe,E as Ve}from"./EmailConfirmationForm.js";import{Header as We,InLineAlert as $e,InputPassword as we,Field as ie,Checkbox as ae}from"@dropins/tools/components.js";/* empty css */import{S as Oe}from"./SkeletonLoader.js";import{useText as Je}from"@dropins/tools/i18n.js";const be=(u,t)=>t!=null&&t.length?u.map(e=>{var c;const s=(c=t.find(({code:m})=>m===e.code))==null?void 0:c.defaultValue;return s?{...e,defaultValue:s}:e}):u,Qe=({inputsDefaultValueSet:u,fieldsConfigForApiVersion1:t,apiVersion2:e})=>{const[s,c]=p([]);return Se(()=>{(async()=>{if(e){const o=await Me("customer_account_create");if(o!=null&&o.length)if(u!=null&&u.length){const F=be(o,u);c(F)}else c(o)}else{const o=fe(ve),F=fe(t),E=be(o,u);c(t&&t.length?F:E)}})()},[e,t,u]),{fieldsListConfigs:s}},Xe=(u,t)=>{const e=["date_of_birth","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],s=He(u,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!t)return{...s,...s!=null&&s.gender?{gender:Number(s==null?void 0:s.gender)}:{}};const c={},m=[];return Object.keys(s).forEach(o=>{e.includes(o)?c[o]=o.includes("gender")?Number(s[o]):s[o]:m.push({attribute_code:o,value:s[o]})}),m.length>0&&(c.custom_attributes=m),c},Ye=({requireRetypePassword:u,addressesData:t,translations:e,isEmailConfirmationRequired:s,apiVersion2:c=!0,passwordConfigs:m,isAutoSignInEnabled:o,routeRedirectOnSignIn:F,routeSignIn:E,onErrorCallback:M,onSuccessCallback:h,setActiveComponent:w,handleSetInLineAlertProps:b,routeRedirectOnEmailConfirmationClose:S})=>{const[O,C]=p(!1),[i,a]=p(""),[g,l]=p(""),[I,N]=p(""),[G,v]=p(!1),[J,q]=p({userName:"",status:!1}),[d,A]=p(""),[Q,H]=p(!1),[X,y]=p(!1),[V,Y]=p(!0),Z=L(r=>{const f=r.target.value;C(!f.length),f.length&&i.length&&f!==i&&l(e.passwordMismatch)},[i,e.passwordMismatch]),k=L(r=>{const f=r.target.value;l(f.length?"":e.requiredFieldError),f.length&&d.length&&f!==d&&l(e.passwordMismatch)},[d,e.passwordMismatch,e.requiredFieldError]),z=L(r=>{a(r),l(r?d===r?"":e.passwordMismatch:e.requiredFieldError)},[e,d]),D=L(({target:r})=>{Y(r.checked)},[]),R=L(()=>{if($(w)){w("signInForm");return}$(E)&&(window.location.href=E())},[w,E]),ee=L(r=>{A(r),C(!r.length),r===i&&l("")},[i]),re=L(()=>{b(),A(""),$(S)?window.location.href=S():(v(!1),w==null||w("signInForm"))},[b,S,w]),U=()=>{H(!0),y(!1)},P=(r,f)=>{const te=d.length&&i.length,me=d!==i,B=()=>{C(!d.length),i||l(e.requiredFieldError),te&&me&&l(e.passwordMismatch)};return f?(Fe(r,d,""),B(),!1):(U(),B(),!0)};return{showPasswordErrorMessage:O,confirmPassword:i,confirmPasswordMessage:g,isKeepMeLogged:V,userEmail:I,showEmailConfirmationForm:G,isSuccessful:J,isClickSubmit:Q,signUpPasswordValue:d,isLoading:X,onSubmitSignUp:async(r,f)=>{var ue,ce,de;if(b(),l(""),y(!0),P(r,f))return;if(u&&(g.length||d!==i)){U(),l(i.length?e.passwordMismatch:e.requiredFieldError),Fe(r,d,i);return}const te=c?"createCustomerV2":"createCustomer",{confirmPasswordField:me,...B}=je(r.target),{email:se,password:K,is_subscribed:Pe}=B,_e=(m==null?void 0:m.requiredCharacterClasses)||0,Ee=(m==null?void 0:m.minLength)||1;if(!qe(K,_e)||Ee>(K==null?void 0:K.length)){U();return}const Ne=Xe({...B,is_subscribed:!!Pe||!1},c),{data:T,errors:x}=await Te(Ne,c),W=((ce=(ue=T==null?void 0:T.createCustomer)==null?void 0:ue.customer)==null?void 0:ce.firstname)||"";if(x&&(x!=null&&x.length))b==null||b({type:"error",text:x[0].message}),M==null||M(x),he(ge.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),N(se);else{const oe={email:"",...T==null?void 0:T[te]};if(he(ge.CREATE_ACCOUNT_EVENT,{email:oe==null?void 0:oe.email,updateProfile:!0}),s||!o){if(h==null||h({userName:W,status:!0}),s){(de=r.target)==null||de.reset(),A(""),v(!0),N(se),y(!1);return}if(!o){y(!1),q({userName:W,status:!0});return}}const _=await Ke({email:se,password:K,translations:e,handleSetInLineAlertProps:b,onErrorCallback:M});if(_!=null&&_.userName){if(t!=null&&t.length)for(const le of t)try{await xe(le)}catch(ye){console.error(e.failedCreateCustomerAddress,le,ye)}$(F)?window.location.href=F():(h==null||h({userName:_==null?void 0:_.userName,status:!0}),q({userName:_==null?void 0:_.userName,status:!0}))}else h==null||h({userName:W,status:!0}),q({userName:W,status:!0})}y(!1)},signInButton:R,handleSetSignUpPasswordValue:ee,onKeepMeLoggedChange:D,handleHideEmailConfirmationForm:re,handleConfirmPasswordChange:z,onBlurPassword:Z,onBlurConfirmPassword:k}},lr=({requireRetypePassword:u=!1,addressesData:t,formSize:e="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:c,apiVersion2:m=!0,isAutoSignInEnabled:o=!0,displayTermsOfUseCheckbox:F=!1,displayNewsletterCheckbox:E=!1,hideCloseBtnOnEmailConfirmation:M=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:S,onSuccessCallback:O,setActiveComponent:C,slots:i})=>{const a=Je({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError",confirmPasswordPlaceholder:"Auth.SignUpForm.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Auth.SignUpForm.confirmPassword.floatingLabel",passwordMismatch:"Auth.SignUpForm.confirmPassword.passwordMismatch"}),{passwordConfigs:g,isEmailConfirmationRequired:l}=Ae(),{fieldsListConfigs:I}=Qe({fieldsConfigForApiVersion1:c,apiVersion2:m,inputsDefaultValueSet:s}),{inLineAlertProps:N,handleSetInLineAlertProps:G}=Ie(),{showPasswordErrorMessage:v,confirmPassword:J,confirmPasswordMessage:q,isKeepMeLogged:d,userEmail:A,showEmailConfirmationForm:Q,isSuccessful:H,isClickSubmit:X,signUpPasswordValue:y,isLoading:V,onSubmitSignUp:Y,signInButton:Z,handleSetSignUpPasswordValue:k,onKeepMeLoggedChange:z,handleHideEmailConfirmationForm:D,handleConfirmPasswordChange:R,onBlurPassword:ee,onBlurConfirmPassword:re}=Ye({requireRetypePassword:u,addressesData:t,translations:a,isEmailConfirmationRequired:l,apiVersion2:m,passwordConfigs:g,isAutoSignInEnabled:o,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:S,onSuccessCallback:O,setActiveComponent:C,handleSetInLineAlertProps:G,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:U,defaultLengthMessage:P}=Be({password:y,isClickSubmit:X,passwordConfigs:g}),ne=Ce(()=>v?a.requiredFieldError:U==="error"||(P==null?void 0:P.status)==="error"?" ":"",[P==null?void 0:P.status,U,v,a.requiredFieldError]),r=!l&&(t==null?void 0:t.length);return!I.length&&m?n("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:n(Oe,{activeSkeleton:"signUpForm"})}):H.status&&(i!=null&&i.SuccessNotification)?n(Ue,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:i==null?void 0:i.SuccessNotification,context:{isSuccessful:H}}):Q?n(Ve,{formSize:e,userEmail:A,inLineAlertProps:N,hideCloseBtnOnEmailConfirmation:M,handleSetInLineAlertProps:G,onPrimaryButtonClick:D}):j("div",{className:Le(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[n(We,{title:a.title,divider:!1,className:"auth-sign-up-form__title"}),N.text?n($e,{className:"auth-sign-up-form__notification",type:N.type,variant:"secondary",heading:N.text,icon:N.icon}):null,j(Ge,{onSubmit:Y,className:"auth-sign-up-form__form",loading:V,name:"signUp_form",fieldsConfig:I,children:[j(we,{validateLengthConfig:P,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:g==null?void 0:g.minLength,errorMessage:ne,defaultValue:y,uniqueSymbolsStatus:U,requiredCharacterClasses:g==null?void 0:g.requiredCharacterClasses,onValue:k,placeholder:a.placeholder,floatingLabel:a.floatingLabel,onBlur:ee,children:[u?n("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:n(we,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:a.confirmPasswordPlaceholder,floatingLabel:a.confirmPasswordFloatingLabel,errorMessage:q,defaultValue:J,onValue:R,onBlur:re})}):null,r?n("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:n(ie,{children:n(ae,{name:"",placeholder:a.keepMeLoggedText,label:a.keepMeLoggedText,checked:d,onChange:z})})}):null]}),E||F?j("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[E?n(ie,{children:n(ae,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:a.subscribedDefaultText,label:a.subscribedDefaultText})}):null,F?n(ie,{children:n(ae,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:a.privacyPolicyDefaultText,label:a.privacyPolicyDefaultText})}):null]}):null,j("div",{className:"auth-sign-up-form-buttons",children:[n(pe,{type:"button",variant:"tertiary",style:{padding:0},buttonText:a.buttonSecondary,enableLoader:!1,onClick:Z}),n(pe,{type:"submit",buttonText:a.buttonPrimary,variant:"primary",enableLoader:V})]})]}),n("div",{id:"createCustomerV2"})]})};export{lr as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/acdl.js b/scripts/__dropins__/storefront-auth/chunks/acdl.js index 1561dcac0..503c9bd64 100644 --- a/scripts/__dropins__/storefront-auth/chunks/acdl.js +++ b/scripts/__dropins__/storefront-auth/chunks/acdl.js @@ -1 +1,3 @@ -import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g,a as u}from"./getStoreConfig.js";const m=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),C=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),f=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{updateProfile:e==null?void 0:e.updateProfile},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),A=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},I=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const n=await g();sessionStorage.setItem("storeConfig",JSON.stringify(n)),o=(n==null?void 0:n.customerAccessTokenLifetime)||u}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${u}`}};var d=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(d||{});const r="authContext",a={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function i(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function c(e){(window.adobeDataLayer||[]).push(o=>{const n=o.getState?o.getState():{};o.push({event:e,eventInfo:{...n}})})}function p(e){const t=f(e);i(r,t),c(a.CREATE_ACCOUNT)}function E(e){const t=m(e);i(r,t),c(a.SIGN_IN)}function l(e){const t=C(e);i(r,t),c(a.SIGN_OUT)}const _=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),s={...o?JSON.parse(o):{},...t};switch(e){case"create-account":p(s);break;case"sign-in":E(s);break;case"sign-out":l(s);break;default:return null}};export{d as E,A as d,I as g,_ as p}; +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as C,a as u}from"./getStoreConfig.js";const m=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),d=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),f=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{updateProfile:e==null?void 0:e.updateProfile},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),h=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},A=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const n=await C();sessionStorage.setItem("storeConfig",JSON.stringify(n)),o=(n==null?void 0:n.customerAccessTokenLifetime)||u}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${u}`}};var p=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(p||{});const a="authContext",g="shopperContext",i={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function s(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function c(e){(window.adobeDataLayer||[]).push(o=>{const n=o.getState?o.getState():{};o.push({event:e,eventInfo:{...n}})})}function E(e){const t=f(e);s(a,t),c(i.CREATE_ACCOUNT)}function l(e){const t=m(e);s(a,t),s(g,{shopperId:"logged-in"}),c(i.SIGN_IN)}function S(e){const t=d(e);s(a,t),s(g,{shopperId:"guest"}),c(i.SIGN_OUT)}const _=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),r={...o?JSON.parse(o):{},...t};switch(e){case"create-account":E(r);break;case"sign-in":l(r);break;case"sign-out":S(r);break;default:return null}};export{p as E,h as d,A as g,_ as p}; diff --git a/scripts/__dropins__/storefront-auth/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-auth/chunks/getAttributesForm.js index 859f8c277..60972b0dd 100644 --- a/scripts/__dropins__/storefront-auth/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/getAttributesForm.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{f as a,d as o,h as s}from"./getStoreConfig.js";import{t as i}from"./transform-attributes-form.js";const n=` +import{f as o,h as a}from"./network-error.js";import{t as s}from"./transform-attributes-form.js";import{h as i}from"./getStoreConfig.js";const n=` query GET_ATTRIBUTES_FORM($formCode: String!) { attributesForm(formCode: $formCode) { items { @@ -32,4 +32,4 @@ import{f as a,d as o,h as s}from"./getStoreConfig.js";import{t as i}from"./trans } } } -`,m=async t=>await a(n,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(r=>{var e;return(e=r.errors)!=null&&e.length?o(r.errors):i(r)}).catch(s);export{m as g}; +`,c=async e=>await o(n,{method:"GET",cache:"force-cache",variables:{formCode:e}}).then(r=>{var t;return(t=r.errors)!=null&&t.length?i(r.errors):s(r)}).catch(a);export{c as g}; diff --git a/scripts/__dropins__/storefront-auth/reload b/scripts/__dropins__/storefront-auth/reload index de179564d..e993f31f7 100644 --- a/scripts/__dropins__/storefront-auth/reload +++ b/scripts/__dropins__/storefront-auth/reload @@ -1 +1 @@ -{"at":1733233852638} \ No newline at end of file +{"at":1733236148099} \ No newline at end of file