From 7f3ecbc4c8ea7ef7053b0a1ee6a1dd21bc5791e5 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 3 Dec 2024 23:52:45 +0200 Subject: [PATCH] added forgot pswd aria-label --- scripts/__dropins__/storefront-auth/api.js | 2 ++ .../storefront-auth/chunks/EmailConfirmationForm.js | 2 ++ .../__dropins__/storefront-auth/chunks/ResetPasswordForm.js | 4 +++- scripts/__dropins__/storefront-auth/chunks/SignInForm.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/SignUpForm.js | 4 +++- scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js | 2 ++ .../__dropins__/storefront-auth/chunks/UpdatePasswordForm.js | 4 +++- scripts/__dropins__/storefront-auth/chunks/confirmEmail.js | 2 ++ .../storefront-auth/chunks/createCustomerAddress.js | 2 ++ .../__dropins__/storefront-auth/chunks/getCustomerToken.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/index.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/index2.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/index3.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/initialize.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/network-error.js | 2 ++ .../storefront-auth/chunks/requestPasswordResetEmail.js | 2 ++ .../storefront-auth/chunks/resendConfirmationEmail.js | 2 ++ scripts/__dropins__/storefront-auth/chunks/resetPassword.js | 2 ++ .../__dropins__/storefront-auth/chunks/revokeCustomerToken.js | 2 ++ .../__dropins__/storefront-auth/chunks/setReCaptchaToken.js | 2 ++ .../storefront-auth/chunks/simplifyTransformAttributesForm.js | 2 ++ .../storefront-auth/chunks/transform-attributes-form.js | 2 ++ .../storefront-auth/chunks/usePasswordValidationMessage.js | 2 ++ scripts/__dropins__/storefront-auth/components/Form/Form.d.ts | 2 +- scripts/__dropins__/storefront-auth/containers/AuthCombine.js | 2 ++ .../__dropins__/storefront-auth/containers/ResetPassword.js | 2 ++ scripts/__dropins__/storefront-auth/containers/SignIn.js | 2 ++ scripts/__dropins__/storefront-auth/containers/SignUp.js | 2 ++ .../storefront-auth/containers/SuccessNotification.js | 2 ++ .../__dropins__/storefront-auth/containers/UpdatePassword.js | 2 ++ .../storefront-auth/hooks/components/useSignUpForm.d.ts | 3 +++ scripts/__dropins__/storefront-auth/i18n/en_US.json.d.ts | 3 ++- scripts/__dropins__/storefront-auth/reload | 1 + scripts/__dropins__/storefront-auth/render.js | 4 +++- 35 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 scripts/__dropins__/storefront-auth/reload diff --git a/scripts/__dropins__/storefront-auth/api.js b/scripts/__dropins__/storefront-auth/api.js index 8a2c1509f8..aa283caa53 100644 --- a/scripts/__dropins__/storefront-auth/api.js +++ b/scripts/__dropins__/storefront-auth/api.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{c as p,a as f,g}from"./chunks/createCustomerAddress.js";import{g as c,a as x}from"./chunks/getCustomerToken.js";import{g as h}from"./chunks/getStoreConfig.js";import{r as C}from"./chunks/requestPasswordResetEmail.js";import{r as E}from"./chunks/resetPassword.js";import{r as G}from"./chunks/revokeCustomerToken.js";import{c as k}from"./chunks/confirmEmail.js";import{r as b}from"./chunks/resendConfirmationEmail.js";import{c as w,i as A}from"./chunks/initialize.js";import{f as T,g as q,r as z,s as D,a as R,b as S}from"./chunks/network-error.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";export{w as config,k as confirmEmail,p as createCustomer,f as createCustomerAddress,T as fetchGraphQl,g as getAttributesForm,q as getConfig,c as getCustomerData,x as getCustomerToken,h as getStoreConfig,A as initialize,z as removeFetchGraphQlHeader,C as requestPasswordResetEmail,b as resendConfirmationEmail,E as resetPassword,G as revokeCustomerToken,D as setEndpoint,R as setFetchGraphQlHeader,S as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-auth/chunks/EmailConfirmationForm.js b/scripts/__dropins__/storefront-auth/chunks/EmailConfirmationForm.js index c882357f8d..bb9d5a5acc 100644 --- a/scripts/__dropins__/storefront-auth/chunks/EmailConfirmationForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/EmailConfirmationForm.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsxs as c,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{useState as C,useCallback as y}from"@dropins/tools/preact-hooks.js";import{InLineAlert as x,Header as p}from"@dropins/tools/components.js";import{B as f}from"./UpdatePasswordForm.js";/* empty css */import{r as E}from"./resendConfirmationEmail.js";import{useText as d}from"@dropins/tools/i18n.js";const _=({userEmail:r,handleSetInLineAlertProps:i})=>{const a=d({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[l,e]=C(!1);return{handleEmailConfirmation:y(async()=>{var o,m;if(e(!0),r){const t=await E(r);if(t){const u=(o=t==null?void 0:t.errors)==null?void 0:o.length,h=(m=t==null?void 0:t.data)==null?void 0:m.resendConfirmationEmail;i(u?{type:"error",text:a.technicalErrorSendEmail}:{type:h?"success":"error",text:a.emailConfirmationMessage})}}e(!1)},[i,a,r]),disabledButton:l}},$=({formSize:r,userEmail:i,inLineAlertProps:a,hideCloseBtnOnEmailConfirmation:l,handleSetInLineAlertProps:e,onPrimaryButtonClick:s})=>{const o=d({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:m,disabledButton:t}=_({userEmail:i,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-email-confirmation-form",`auth-email-confirmation-form--${r}`]),children:[a.text?n(x,{className:"auth-signInForm__notification",type:a.type,variant:"secondary",heading:a.text,icon:a.icon,"data-testid":"authInLineAlert"}):null,n(p,{title:o.title,divider:!1,className:"auth-email-confirmation-form__title"}),i!=null&&i.length?n("span",{className:"auth-email-confirmation-form__subtitle",children:`${o.subtitle} ${i}`}):null,n("span",{className:"auth-email-confirmation-form__text",children:o.mainText}),c("div",{className:"auth-email-confirmation-form__buttons",children:[n(f,{type:"button",variant:"tertiary",style:{padding:0},buttonText:o.buttonSecondary,enableLoader:!1,onClick:m,disabled:t}),l?null:n(f,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:!1,disabled:t,onClick:s})]})]})};export{$ as E}; diff --git a/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js b/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js index bb574e0fec..4fabfb684f 100644 --- a/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js @@ -1 +1,3 @@ -import{jsxs as w,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{g as F,c as l,u as P,F as _,B as p}from"./UpdatePasswordForm.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as b}from"./requestPasswordResetEmail.js";import{useState as x,useCallback as g}from"@dropins/tools/preact-hooks.js";import{useText as R}from"@dropins/tools/i18n.js";import{Header as v,InLineAlert as N}from"@dropins/tools/components.js";/* empty css */import{s as E,D as T}from"./simplifyTransformAttributesForm.js";import*as y from"@dropins/tools/preact-compat.js";const D=t=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),L=({routeSignIn:t,onErrorCallback:a,setActiveComponent:i,handleSetInLineAlertProps:s})=>{const c=R({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[m,e]=x(!1),d=g(async u=>{u.preventDefault(),e(!0);const r=F(u.target);if(r&&r.email){const f=await b(r.email);f.success?s==null||s({type:"success",text:c.successPasswordResetEmailNotification.replace("{email}",r.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,c.successPasswordResetEmailNotification]),n=g(()=>{if(l(i)){i("signInForm");return}l(t)&&(window.location.href=t())},[i,t]);return{isLoading:m,submitResetPassword:d,redirectToSignInPage:n}},z=({formSize:t="default",routeSignIn:a,setActiveComponent:i,onErrorCallback:s,...c})=>{const m=R({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=P(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:r}=L({routeSignIn:a,setActiveComponent:i,onErrorCallback:s,handleSetInLineAlertProps:d});return w("div",{...c,className:h(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[o(v,{title:m.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(N,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(_,{name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:u,loading:n,fieldsConfig:E(T),children:w("div",{className:"auth-reset-password-form__buttons",children:[o(p,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(D,{style:{transform:"rotate(90deg)"}}),buttonText:m.buttonSecondary,enableLoader:!1,onClick:r}),o(p,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{z as R}; +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{g as h,c as w,u as F,F as P,B as p}from"./UpdatePasswordForm.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as _}from"./requestPasswordResetEmail.js";import{useState as x,useCallback as g}from"@dropins/tools/preact-hooks.js";import{useText as R}from"@dropins/tools/i18n.js";import{Header as v,InLineAlert as N}from"@dropins/tools/components.js";/* empty css */import{s as E,D as L}from"./simplifyTransformAttributesForm.js";import*as y from"@dropins/tools/preact-compat.js";const T=t=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),D=({routeSignIn:t,onErrorCallback:a,setActiveComponent:m,handleSetInLineAlertProps:s})=>{const c=R({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[r,e]=x(!1),d=g(async u=>{u.preventDefault(),e(!0);const i=h(u.target);if(i&&i.email){const f=await _(i.email);f.success?s==null||s({type:"success",text:c.successPasswordResetEmailNotification.replace("{email}",i.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,c.successPasswordResetEmailNotification]),n=g(()=>{if(w(m)){m("signInForm");return}w(t)&&(window.location.href=t())},[m,t]);return{isLoading:r,submitResetPassword:d,redirectToSignInPage:n}},$=({formSize:t="default",routeSignIn:a,setActiveComponent:m,onErrorCallback:s,...c})=>{const r=R({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=F(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:i}=D({routeSignIn:a,setActiveComponent:m,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...c,className:b(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[o(v,{title:r.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(N,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(P,{"aria-labelledby":r.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:u,loading:n,fieldsConfig:E(L),children:l("div",{className:"auth-reset-password-form__buttons",children:[o(p,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(T,{style:{transform:"rotate(90deg)"}}),buttonText:r.buttonSecondary,enableLoader:!1,onClick:i}),o(p,{type:"submit",buttonText:r.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{$ as R}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SignInForm.js b/scripts/__dropins__/storefront-auth/chunks/SignInForm.js index 176029a77c..b75a00e04c 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SignInForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/SignInForm.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as u,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as z}from"@dropins/tools/lib.js";import{g as V,c as _,u as O,F as R,B as H}from"./UpdatePasswordForm.js";import{useState as g,useCallback as F,useEffect as J,useMemo as tt}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as at}from"./getCustomerToken.js";import{r as rt}from"./resendConfirmationEmail.js";import{s as et,a as ot}from"./simplifyTransformAttributesForm.js";import{c as it}from"./confirmEmail.js";import{useText as Q}from"@dropins/tools/i18n.js";import{Header as st,InLineAlert as nt,InputPassword as mt}from"@dropins/tools/components.js";/* empty css */import{E as ct}from"./EmailConfirmationForm.js";const ut=({emailConfirmationStatusMessage:t,translations:r,initialEmailValue:i,routeSignUp:l,routeForgotPassword:m,routeRedirectOnSignIn:E,onErrorCallback:w,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:e,routeRedirectOnEmailConfirmationClose:N})=>{const[k,P]=g(""),[L,s]=g(!1),[M,d]=g(""),[T,y]=g(!1),[S,C]=g({userName:"",status:!1}),[B,b]=g(!1),[p,x]=g([]),I=F(async n=>{e(),s(!0),y(!1),x([]),await rt(n)},[e]),v=F(n=>{n.length?y(!1):y(!0),d(n)},[]);J(()=>{t!=null&&t.text&&e({text:t.text,type:t.status?t.status:void 0})},[t,e]);const U=F(async n=>{var K;e(),b(!0);const c=V(n.target);if(c.password||(y(!0),b(!1)),c!=null&&c.email&&(c!=null&&c.password)){const{email:G,password:X}=c,o=await at({email:G,password:X,handleSetInLineAlertProps:e,onErrorCallback:w,translations:r});if((K=o==null?void 0:o.errorMessage)!=null&&K.length){P(G);const $=o.errorMessage.includes("This account isn't confirmed. Verify and try again."),Y=$?r.resendEmailInformationText:o.errorMessage;x($?[{label:r.resendEmailButtonText,onClick:()=>{I(G)}}]:[]),e({text:Y,type:"error"}),d("")}o!=null&&o.userName&&(n.target.reset(),_(E)?window.location.href=E():(f==null||f({userName:o==null?void 0:o.userName,status:!0}),C({userName:o==null?void 0:o.userName,status:!0}))),y(!1)}b(!1)},[e,w,r,I,E,f]),q=F(()=>{if(_(a)){a("resetPasswordForm");return}_(m)&&(window.location.href=m())},[m,a]),j=F(()=>{if(_(h)&&h(),_(a)){a("signUpForm");return}_(l)&&(window.location.href=l())},[h,l,a]),D=tt(()=>{const n=et(ot);return i!=null&&i.length?n==null?void 0:n.map(c=>({...c,defaultValue:i})):n},[i]),W=F(()=>{e(),_(N)?window.location.href=N():s(!1)},[e,N]);return{additionalActionsAlert:p,userEmail:k,defaultEnhancedEmailFields:D,passwordError:T,isSuccessful:S,isLoading:B,signInPasswordValue:M,showEmailConfirmationForm:L,setShowEmailConfirmationForm:s,setSignInPasswordValue:d,submitLogInUser:U,forgotPasswordCallback:q,onSignUpLinkClickCallback:j,handledOnPrimaryButtonClick:W,handleSetPassword:v}},ft=()=>{let t=new URL(window.location.href),r=t.searchParams.get("email"),i=t.searchParams.get("key");r&&i&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},dt=({enableEmailConfirmation:t})=>{const r=Q({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[i,l]=g({text:"",status:""});return J(()=>{if(t){const{search:m}=window.location;m.includes("email=")&&m.includes("key=")&&(async()=>{var f,h,e;const w=new URLSearchParams(m),a=await it({customerEmail:w.get("email"),customerConfirmationKey:w.get("key")});if(!a)return null;(f=a==null?void 0:a.errors)!=null&&f.length?l({text:a==null?void 0:a.errors[0].message,status:"error"}):(l({text:a.data.confirmEmail.customer.email?r.accountConfirmationEmailSuccessMessage.replace("{email}",(e=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:e.email):r.accountConfirmMessage,status:"success"}),ft())})()}},[t,r]),{emailConfirmationStatusMessage:i}},At=({slots:t,labels:r,formSize:i="default",initialEmailValue:l="",renderSignUpLink:m=!1,enableEmailConfirmation:E=!1,hideCloseBtnOnEmailConfirmation:w=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:e,onSuccessCallback:N,setActiveComponent:k,onErrorCallback:P,onSignUpLinkClick:L})=>{const s=Q({title:"Auth.SignInForm.title",buttonPrimary:"Auth.SignInForm.buttonPrimary",buttonSecondary:"Auth.SignInForm.buttonSecondary",buttonTertiary:"Auth.SignInForm.buttonTertiary",resendEmailInformationText:"Auth.Notification.resendEmailNotification.informationText",resendEmailButtonText:"Auth.Notification.resendEmailNotification.buttonText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError"}),{emailConfirmationStatusMessage:M}=dt({enableEmailConfirmation:E}),{inLineAlertProps:d,handleSetInLineAlertProps:T}=O(),{userEmail:y,additionalActionsAlert:S,defaultEnhancedEmailFields:C,passwordError:B,isSuccessful:b,isLoading:p,signInPasswordValue:x,showEmailConfirmationForm:I,submitLogInUser:v,forgotPasswordCallback:U,onSignUpLinkClickCallback:q,handledOnPrimaryButtonClick:j,handleSetPassword:D}=ut({translations:s,emailConfirmationStatusMessage:M,initialEmailValue:l,routeSignUp:e,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:k,onErrorCallback:P,onSuccessCallback:N,onSignUpLinkClick:L,handleSetInLineAlertProps:T,routeRedirectOnEmailConfirmationClose:a});return b.status&&(t!=null&&t.SuccessNotification)?u(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:b}}):I?u(ct,{formSize:i,userEmail:y,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:w,handleSetInLineAlertProps:T,onPrimaryButtonClick:j}):A("div",{className:z(["auth-sign-in-form",`auth-sign-in-form--${i}`]),"data-testid":"signInForm",children:[u(st,{title:(r==null?void 0:r.formTitleText)??s.title,divider:!1,className:"auth-sign-in-form__title"}),d.text?u(nt,{"data-testid":"authInLineAlert",className:"auth-sign-in-form__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:S}):null,A(R,{name:"signIn_form",className:"auth-sign-in-form__form",onSubmit:v,loading:p,fieldsConfig:C,children:[u(mt,{hideStatusIndicator:!0,className:"auth-sign-in-form__form__password",autoComplete:"current-password",errorMessage:B?s.requiredFieldError:void 0,defaultValue:x,onValue:D,placeholder:s.placeholder,floatingLabel:s.floatingLabel}),A("div",{className:"auth-sign-in-form__form__buttons",children:[A("div",{className:"auth-sign-in-form__form__buttons__combine",children:[u(H,{type:"button",variant:"tertiary",style:{padding:0},buttonText:s.buttonTertiary,className:"auth-sign-in-form__button auth-sign-in-form__button--forgot",enableLoader:!1,onClick:U,"data-testid":"switchToSignUp"}),m?u("span",{}):null,m?u(H,{type:"button",variant:"tertiary",style:{padding:0},buttonText:s.buttonSecondary,className:"auth-sign-in-form__button auth-sign-in-form__button--signup",enableLoader:!1,onClick:q}):null]}),u(H,{type:"submit",buttonText:(r==null?void 0:r.primaryButtonText)??s.buttonPrimary,variant:"primary",className:"auth-sign-in-form__button auth-sign-in-form__button--submit",enableLoader:p})]})]}),u("div",{id:"generateCustomerToken"})]})};export{At as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js index 6a8460f92f..63b181fe77 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js @@ -1 +1,3 @@ -import{jsx as o,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Fe,classes as _e}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as Pe,c as we,a as Ne}from"./createCustomerAddress.js";import{useState as d,useEffect as Le,useCallback as q}from"@dropins/tools/preact-hooks.js";import{s as ae,b as ye}from"./simplifyTransformAttributesForm.js";import{v as Ue,u as Te,a as xe}from"./usePasswordValidationMessage.js";import{a as Ee}from"./getCustomerToken.js";import{p as me,E as ne}from"./getStoreConfig.js";import{c as I,g as Me,u as Se,F as Ce,B as ue}from"./UpdatePasswordForm.js";import{c as ve}from"./transform-attributes-form.js";import{Header as Ae,InLineAlert as qe,InputPassword as ce,Field as R,Checkbox as ee}from"@dropins/tools/components.js";/* empty css */import{S as Ke}from"./SkeletonLoader.js";import{E as Be}from"./EmailConfirmationForm.js";import{useText as je}from"@dropins/tools/i18n.js";const le=(m,e)=>e!=null&&e.length?m.map(r=>{var n;const t=(n=e.find(({code:a})=>a===r.code))==null?void 0:n.defaultValue;return t?{...r,defaultValue:t}:r}):m,Ge=({inputsDefaultValueSet:m,fieldsConfigForApiVersion1:e,apiVersion2:r})=>{const[t,n]=d([]);return Le(()=>{(async()=>{if(r){const s=await Pe("customer_account_create");if(s!=null&&s.length)if(m!=null&&m.length){const f=le(s,m);n(f)}else n(s)}else{const s=ae(ye),f=ae(e),F=le(s,m);n(e&&e.length?f:F)}})()},[r,e,m]),{fieldsListConfigs:t}},He=(m,e)=>{const r=["date_of_birth","dob","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],t=ve(m,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!e)return{...t,...t!=null&&t.gender?{gender:Number(t==null?void 0:t.gender)}:{}};const n={},a=[];return Object.keys(t).forEach(s=>{r.includes(s)?n[s]=s.includes("gender")?Number(t[s]):t[s]:a.push({attribute_code:s,value:t[s]})}),a.length>0&&(n.custom_attributes=a),n},Ie=({requireRetypePassword:m,addressesData:e,translations:r,isEmailConfirmationRequired:t,apiVersion2:n=!0,passwordConfigs:a,isAutoSignInEnabled:s,routeRedirectOnSignIn:f,routeSignIn:F,onErrorCallback:w,onSuccessCallback:c,setActiveComponent:g,handleSetInLineAlertProps:h,routeRedirectOnEmailConfirmationClose:T})=>{const[N,V]=d(""),[p,i]=d(""),[l,x]=d(""),[K,_]=d(!1),[B,E]=d({userName:"",status:!1}),[L,M]=d(""),[W,$]=d(!1),[j,P]=d(!1),[S,G]=d(!0),J=q(u=>{V(u),i(u?L===u?"":r.passwordMismatch:r.requiredFieldError)},[r,L]),O=q(({target:u})=>{G(u.checked)},[]),Q=q(()=>{if(I(g)){g("signInForm");return}I(F)&&(window.location.href=F())},[g,F]),X=q(u=>{M(u)},[]),Y=q(()=>{h(),M(""),I(T)?window.location.href=T():(_(!1),g==null||g("signInForm"))},[h,T,g]),C=()=>{$(!0),P(!1)};return{confirmPassword:N,confirmPasswordMessage:p,isKeepMeLogged:S,userEmail:l,showEmailConfirmationForm:K,isSuccessful:B,isClickSubmit:W,signUpPasswordValue:L,isLoading:j,onSubmitSignUp:async(u,k)=>{var te,ie,se;if(h(),i(""),P(!0),!k){C(),!N&&i(r.requiredFieldError);return}if(m&&(p.length||L!==N)){C(),i(N.length?r.passwordMismatch:r.requiredFieldError);return}const de=n?"createCustomerV2":"createCustomer",{confirmPasswordField:Ve,...re}=Me(u.target),{email:z,password:v,is_subscribed:fe}=re,ge=(a==null?void 0:a.requiredCharacterClasses)||0,he=(a==null?void 0:a.minLength)||1;if(!Ue(v,ge)||he>(v==null?void 0:v.length)){C();return}const pe=He({...re,is_subscribed:!!fe||!1},n),{data:y,errors:U}=await we(pe,n),H=((ie=(te=y==null?void 0:y.createCustomer)==null?void 0:te.customer)==null?void 0:ie.firstname)||"";if(U&&(U!=null&&U.length))h==null||h({type:"error",text:U[0].message}),w==null||w(U),me(ne.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),x(z);else{const D={email:"",...y==null?void 0:y[de]};if(me(ne.CREATE_ACCOUNT_EVENT,{email:D==null?void 0:D.email,updateProfile:!0}),t||!s){if(c==null||c({userName:H,status:!0}),t){(se=u.target)==null||se.reset(),M(""),_(!0),x(z),P(!1);return}if(!s){P(!1),E({userName:H,status:!0});return}}const b=await Ee({email:z,password:v,translations:r,handleSetInLineAlertProps:h,onErrorCallback:w});if(b!=null&&b.userName){if(e!=null&&e.length)for(const oe of e)try{await Ne(oe)}catch(be){console.error(r.failedCreateCustomerAddress,oe,be)}I(f)?window.location.href=f():(c==null||c({userName:b==null?void 0:b.userName,status:!0}),E({userName:b==null?void 0:b.userName,status:!0}))}else c==null||c({userName:H,status:!0}),E({userName:H,status:!0})}P(!1)},signInButton:Q,handleSetSignUpPasswordValue:X,onKeepMeLoggedChange:O,handleHideEmailConfirmationForm:Y,handleConfirmPasswordChange:J}},or=({requireRetypePassword:m=!1,addressesData:e,formSize:r="default",inputsDefaultValueSet:t,fieldsConfigForApiVersion1:n,apiVersion2:a=!0,isAutoSignInEnabled:s=!0,displayTermsOfUseCheckbox:f=!1,displayNewsletterCheckbox:F=!1,hideCloseBtnOnEmailConfirmation:w=!1,routeRedirectOnEmailConfirmationClose:c,routeRedirectOnSignIn:g,routeSignIn:h,onErrorCallback:T,onSuccessCallback:N,setActiveComponent:V,slots:p})=>{const i=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:l,isEmailConfirmationRequired:x}=Te(),{fieldsListConfigs:K}=Ge({fieldsConfigForApiVersion1:n,apiVersion2:a,inputsDefaultValueSet:t}),{inLineAlertProps:_,handleSetInLineAlertProps:B}=Se(),{confirmPassword:E,confirmPasswordMessage:L,isKeepMeLogged:M,userEmail:W,showEmailConfirmationForm:$,isSuccessful:j,isClickSubmit:P,signUpPasswordValue:S,isLoading:G,onSubmitSignUp:J,signInButton:O,handleSetSignUpPasswordValue:Q,onKeepMeLoggedChange:X,handleHideEmailConfirmationForm:Y,handleConfirmPasswordChange:C}=Ie({requireRetypePassword:m,addressesData:e,translations:i,isEmailConfirmationRequired:x,apiVersion2:a,passwordConfigs:l,isAutoSignInEnabled:s,routeRedirectOnSignIn:g,routeSignIn:h,onErrorCallback:T,onSuccessCallback:N,setActiveComponent:V,handleSetInLineAlertProps:B,routeRedirectOnEmailConfirmationClose:c}),{isValidUniqueSymbols:Z,defaultLengthMessage:u}=xe({password:S,isClickSubmit:P,passwordConfigs:l}),k=!x&&(e==null?void 0:e.length);return!K.length&&a?o("div",{className:`auth-sign-up-form auth-sign-up-form--${r} skeleton-loader`,"data-testid":"SignUpForm",children:o(Ke,{activeSkeleton:"signUpForm"})}):j.status&&(p!=null&&p.SuccessNotification)?o(Fe,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:p==null?void 0:p.SuccessNotification,context:{isSuccessful:j}}):$?o(Be,{formSize:r,userEmail:W,inLineAlertProps:_,hideCloseBtnOnEmailConfirmation:w,handleSetInLineAlertProps:B,onPrimaryButtonClick:Y}):A("div",{className:_e(["auth-sign-up-form",`auth-sign-up-form--${r}`]),"data-testid":"SignUpForm",children:[o(Ae,{title:i.title,divider:!1,className:"auth-sign-up-form__title"}),_.text?o(qe,{className:"auth-sign-up-form__notification",type:_.type,variant:"secondary",heading:_.text,icon:_.icon}):null,A(Ce,{onSubmit:J,className:"auth-sign-up-form__form",loading:G,name:"signUp_form",fieldsConfig:K,children:[A(ce,{validateLengthConfig:u,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:l==null?void 0:l.minLength,errorMessage:Z==="error"||(u==null?void 0:u.status)==="error"||P&&S.length<=0?i.requiredFieldError:void 0,defaultValue:S,uniqueSymbolsStatus:Z,requiredCharacterClasses:l==null?void 0:l.requiredCharacterClasses,onValue:Q,placeholder:i.placeholder,floatingLabel:i.floatingLabel,children:[m?o("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:o(ce,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:i.confirmPasswordPlaceholder,floatingLabel:i.confirmPasswordFloatingLabel,errorMessage:L,defaultValue:E,onValue:C})}):null,k?o("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:o(R,{children:o(ee,{name:"",placeholder:i.keepMeLoggedText,label:i.keepMeLoggedText,checked:M,onChange:X})})}):null]}),F||f?A("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[F?o(R,{children:o(ee,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:i.subscribedDefaultText,label:i.subscribedDefaultText})}):null,f?o(R,{children:o(ee,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:i.privacyPolicyDefaultText,label:i.privacyPolicyDefaultText})}):null]}):null,A("div",{className:"auth-sign-up-form-buttons",children:[o(ue,{type:"button",variant:"tertiary",style:{padding:0},buttonText:i.buttonSecondary,enableLoader:!1,onClick:O}),o(ue,{type:"submit",buttonText:i.buttonPrimary,variant:"primary",enableLoader:G})]})]}),o("div",{id:"createCustomerV2"})]})};export{or as S}; +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{jsx as n,jsxs as K}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Ee,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 ve,u as Ce,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{Header as Ge,InLineAlert as He,InputPassword as ge,Field as se,Checkbox as ie}from"@dropins/tools/components.js";/* empty css */import{S as Ve}from"./SkeletonLoader.js";import{E as We}from"./EmailConfirmationForm.js";import{useText as $e}from"@dropins/tools/i18n.js";const pe=(u,r)=>r!=null&&r.length?u.map(e=>{var c;const t=(c=r.find(({code:m})=>m===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 s=await Ue("customer_account_create");if(s!=null&&s.length)if(u!=null&&u.length){const F=pe(s,u);c(F)}else c(s)}else{const s=de(Se),F=de(r),N=pe(s,u);c(r&&r.length?F:N)}})()},[e,r,u]),{fieldsListConfigs:t}},Oe=(u,r)=>{const e=["date_of_birth","dob","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={},m=[];return Object.keys(t).forEach(s=>{e.includes(s)?c[s]=s.includes("gender")?Number(t[s]):t[s]:m.push({attribute_code:s,value:t[s]})}),m.length>0&&(c.custom_attributes=m),c},Qe=({requireRetypePassword:u,addressesData:r,translations:e,isEmailConfirmationRequired:t,apiVersion2:c=!0,passwordConfigs:m,isAutoSignInEnabled:s,routeRedirectOnSignIn:F,routeSignIn:N,onErrorCallback:M,onSuccessCallback:h,setActiveComponent:b,handleSetInLineAlertProps:w,routeRedirectOnEmailConfirmationClose:S})=>{const[$,v]=p(!1),[o,a]=p(""),[g,d]=p(""),[j,E]=p(""),[I,C]=p(!1),[J,q]=p({userName:"",status:!1}),[l,A]=p(""),[O,G]=p(!1),[Q,y]=p(!1),[H,X]=p(!0),Y=L(i=>{const f=i.target.value;v(!f.length),f.length&&o.length&&f!==o&&d(e.passwordMismatch)},[o,e.passwordMismatch]),Z=L(i=>{const f=i.target.value;d(f.length?"":e.requiredFieldError),f.length&&l.length&&f!==l&&d(e.passwordMismatch)},[l,e.passwordMismatch,e.requiredFieldError]),k=L(i=>{a(i),d(i?l===i?"":e.passwordMismatch:e.requiredFieldError)},[e,l]),z=L(({target:i})=>{X(i.checked)},[]),D=L(()=>{if(W(b)){b("signInForm");return}W(N)&&(window.location.href=N())},[b,N]),R=L(i=>{A(i),v(!i.length),i===o&&d("")},[o]),ee=L(()=>{w(),A(""),W(S)?window.location.href=S():(C(!1),b==null||b("signInForm"))},[w,S,b]),U=()=>{G(!0),y(!1)},P=()=>{const i=l.length&&o.length,f=l!==o;U(),v(!l.length),o||d(e.requiredFieldError),i&&f&&d(e.passwordMismatch)};return{showPasswordErrorMessage:$,confirmPassword:o,confirmPasswordMessage:g,isKeepMeLogged:H,userEmail:j,showEmailConfirmationForm:I,isSuccessful:J,isClickSubmit:O,signUpPasswordValue:l,isLoading:Q,onSubmitSignUp:async(i,f)=>{var ne,me,ue;if(w(),d(""),y(!0),!f){P();return}if(u&&(g.length||l!==o)){U(),d(o.length?e.passwordMismatch:e.requiredFieldError);return}const Fe=c?"createCustomerV2":"createCustomer",{confirmPasswordField:Xe,...ae}=Be(i.target),{email:re,password:B,is_subscribed:be}=ae,we=(m==null?void 0:m.requiredCharacterClasses)||0,Pe=(m==null?void 0:m.minLength)||1;if(!ve(B,we)||Pe>(B==null?void 0:B.length)){U();return}const _e=Oe({...ae,is_subscribed:!!be||!1},c),{data:T,errors:x}=await Le(_e,c),V=((me=(ne=T==null?void 0:T.createCustomer)==null?void 0:ne.customer)==null?void 0:me.firstname)||"";if(x&&(x!=null&&x.length))w==null||w({type:"error",text:x[0].message}),M==null||M(x),le(fe.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),E(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||!s){if(h==null||h({userName:V,status:!0}),t){(ue=i.target)==null||ue.reset(),A(""),C(!0),E(re),y(!1);return}if(!s){y(!1),q({userName:V,status:!0});return}}const _=await Ae({email:re,password:B,translations:e,handleSetInLineAlertProps:w,onErrorCallback:M});if(_!=null&&_.userName){if(r!=null&&r.length)for(const ce of r)try{await Me(ce)}catch(Ne){console.error(e.failedCreateCustomerAddress,ce,Ne)}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}},dr=({requireRetypePassword:u=!1,addressesData:r,formSize:e="default",inputsDefaultValueSet:t,fieldsConfigForApiVersion1:c,apiVersion2:m=!0,isAutoSignInEnabled:s=!0,displayTermsOfUseCheckbox:F=!1,displayNewsletterCheckbox:N=!1,hideCloseBtnOnEmailConfirmation:M=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:b,routeSignIn:w,onErrorCallback:S,onSuccessCallback:$,setActiveComponent:v,slots:o})=>{const a=$e({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}=Ce(),{fieldsListConfigs:j}=Je({fieldsConfigForApiVersion1:c,apiVersion2:m,inputsDefaultValueSet:t}),{inLineAlertProps:E,handleSetInLineAlertProps:I}=Ke(),{showPasswordErrorMessage:C,confirmPassword:J,confirmPasswordMessage:q,isKeepMeLogged:l,userEmail:A,showEmailConfirmationForm:O,isSuccessful:G,isClickSubmit:Q,signUpPasswordValue:y,isLoading:H,onSubmitSignUp:X,signInButton:Y,handleSetSignUpPasswordValue:Z,onKeepMeLoggedChange:k,handleHideEmailConfirmationForm:z,handleConfirmPasswordChange:D,onBlurPassword:R,onBlurConfirmPassword:ee}=Qe({requireRetypePassword:u,addressesData:r,translations:a,isEmailConfirmationRequired:d,apiVersion2:m,passwordConfigs:g,isAutoSignInEnabled:s,routeRedirectOnSignIn:b,routeSignIn:w,onErrorCallback:S,onSuccessCallback:$,setActiveComponent:v,handleSetInLineAlertProps:I,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:U,defaultLengthMessage:P}=qe({password:y,isClickSubmit:Q,passwordConfigs:g}),oe=xe(()=>C?a.requiredFieldError:U==="error"||(P==null?void 0:P.status)==="error"?" ":"",[P==null?void 0:P.status,U,C,a.requiredFieldError]),i=!d&&(r==null?void 0:r.length);return!j.length&&m?n("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:n(Ve,{activeSkeleton:"signUpForm"})}):G.status&&(o!=null&&o.SuccessNotification)?n(Ee,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:o==null?void 0:o.SuccessNotification,context:{isSuccessful:G}}):O?n(We,{formSize:e,userEmail:A,inLineAlertProps:E,hideCloseBtnOnEmailConfirmation:M,handleSetInLineAlertProps:I,onPrimaryButtonClick:z}):K("div",{className:ye(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[n(Ge,{title:a.title,divider:!1,className:"auth-sign-up-form__title"}),E.text?n(He,{className:"auth-sign-up-form__notification",type:E.type,variant:"secondary",heading:E.text,icon:E.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?n("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:n(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:J,onValue:D,onBlur:ee})}):null,i?n("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:n(se,{children:n(ie,{name:"",placeholder:a.keepMeLoggedText,label:a.keepMeLoggedText,checked:l,onChange:k})})}):null]}),N||F?K("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[N?n(se,{children:n(ie,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:a.subscribedDefaultText,label:a.subscribedDefaultText})}):null,F?n(se,{children:n(ie,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:a.privacyPolicyDefaultText,label:a.privacyPolicyDefaultText})}):null]}):null,K("div",{className:"auth-sign-up-form-buttons",children:[n(he,{type:"button",variant:"tertiary",style:{padding:0},buttonText:a.buttonSecondary,enableLoader:!1,onClick:Y}),n(he,{type:"submit",buttonText:a.buttonPrimary,variant:"primary",enableLoader:H})]})]}),n("div",{id:"createCustomerV2"})]})};export{dr as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js b/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js index efe1f36240..6bdfef8665 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js +++ b/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsxs as l,jsx as e,Fragment as r}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as s}from"@dropins/tools/preact-hooks.js";import{Skeleton as a,SkeletonRow as i}from"@dropins/tools/components.js";const d=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),h=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),u=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),o=({activeSkeleton:n})=>{const t=s(()=>({signInForm:e(h,{}),signUpForm:e(d,{}),resetPasswordForm:e(u,{})}),[]);return e(r,{children:t[n]})};export{o as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/UpdatePasswordForm.js b/scripts/__dropins__/storefront-auth/chunks/UpdatePasswordForm.js index e26482daa9..f425a19619 100644 --- a/scripts/__dropins__/storefront-auth/chunks/UpdatePasswordForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/UpdatePasswordForm.js @@ -1 +1,3 @@ -import{jsx as h,Fragment as Z,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{useState as R,useCallback as v,useRef as H,useEffect as P}from"@dropins/tools/preact-hooks.js";import*as $ from"@dropins/tools/preact-compat.js";import{memo as W,useCallback as _}from"@dropins/tools/preact-compat.js";import{initReCaptcha as G}from"@dropins/tools/recaptcha.js";import{useText as j}from"@dropins/tools/i18n.js";import{classes as L}from"@dropins/tools/lib.js";import{Field as w,Picker as q,Input as X,InputDate as C,Checkbox as z,TextArea as B,Button as J}from"@dropins/tools/components.js";const Ir=r=>{if(!r)return null;const t=new FormData(r);if(t&&typeof t.entries=="function"){const n=t.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},Dr=r=>typeof r=="function",Y=r=>$.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("g",{clipPath:"url(#clip0_841_1324)"},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),$.createElement("defs",null,$.createElement("clipPath",{id:"clip0_841_1324"},$.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),K=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Q=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),g={success:h(K,{}),warning:h(Y,{}),error:h(Q,{})},xr=()=>{const[r,t]=R({}),n=v(l=>{if(!l||!l.type){t({});return}const c=g[l.type];t({...l,icon:c})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:n}};var m=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(m||{});const rr=W(({loading:r,values:t,fields:n=[],errors:l,className:c="",onChange:u,onBlur:p,onFocus:A})=>{const s=`${c}__field`,f=_((e,o,a)=>{var T;const E=(T=e.options.find(N=>N.isDefault))==null?void 0:T.value;return h(w,{error:a,className:L([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(q,{name:e.customUpperCode,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:u,defaultValue:E??o??e.defaultValue,value:E??o??e.defaultValue})},e.id)},[c,r,s,p,u]),D=_((e,o,a)=>h(w,{error:a,className:L([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(X,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,onFocus:A})},e.id),[c,r,s,p,u,A]),x=_((e,o,a)=>h(w,{error:a,className:L([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(C,{type:"text",name:e.customUpperCode,value:o||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,disabled:r||e.disabled})},e.id),[c,r,s,p,u]),b=_((e,o,a)=>h(w,{error:a,className:L([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(z,{name:e.customUpperCode,checked:o||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]),M=_((e,o,a)=>h(w,{error:a,className:L([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(B,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]);return n.length?h(Z,{children:n.map(e=>{const o=l==null?void 0:l[e.customUpperCode],a=t==null?void 0:t[e.customUpperCode];switch(e.fieldType){case m.TEXT:return e.options.length?f(e,a,o):D(e,a,o);case m.MULTILINE:return D(e,a,o);case m.SELECT:return f(e,a,o);case m.DATE:return x(e,a,o);case m.BOOLEAN:return b(e,a,o);case m.TEXTAREA:return M(e,a,o);default:return null}})}):null}),er=r=>r.reduce((t,{customUpperCode:n,required:l,defaultValue:c})=>(l&&n&&(t.initialData[n]=c||"",t.errorList[n]=""),t),{initialData:{},errorList:{}}),tr=r=>r.reduce((t,n)=>({...t,[n.name]:n.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),lr=r=>/^[a-zA-Z]+$/.test(r),sr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),cr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),dr=(r,t,n)=>{const l=new Date(r).getTime()/1e3;return!(isNaN(l)||l<0||typeof t<"u"&&ln)},k=r=>{if(!r||r.trim()==="")return"";const t=parseInt(r,10);if(!isNaN(t)){const c=new Date(t*1e3);return isNaN(c.getTime())?"":c.toISOString().split("T")[0]}const n=new Date(r);if(isNaN(n.getTime()))return"";const l=parseInt(r.split("-")[1],10);return l>12||l<1?"":n.toISOString().split("T")[0]},ur=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),ir=(r,t,n)=>{const l=r.length;return l>=t&&l<=n},O=(r,t,n,l)=>{var y,F;const{requiredFieldError:c,lengthTextError:u,numericError:p,alphaNumWithSpacesError:A,alphaNumericError:s,alphaError:f,emailError:D,dateError:x,urlError:b,dateLengthError:M,dateMaxError:e,dateMinError:o}=n,a=t==null?void 0:t.customUpperCode,E={[a]:""};if(l[a]&&delete l[a],t!=null&&t.required&&!r)return{[a]:c};if(!(t!=null&&t.required)&&!r||!((y=t==null?void 0:t.validateRules)!=null&&y.length))return E;const T=tr(t==null?void 0:t.validateRules),N=T.MIN_TEXT_LENGTH??1,I=T.MAX_TEXT_LENGTH??255,d=T.DATE_RANGE_MIN,i=T.DATE_RANGE_MAX;if(!ir(r,+N,+I)&&!(d||i))return{[a]:u.replace("{min}",N).replace("{max}",I)};if(!dr(r,+d,+i)&&(d||i)){if(d&&d)return{[a]:M.replace("{min}",k(d)).replace("{max}",k(i))};if(typeof d>"u"||typeof i>"u")return{[a]:i?e.replace("{max}",k(i)):o.replace("{min}",k(d))}}const V={numeric:{validate:ar,error:p},"alphanum-with-spaces":{validate:nr,error:A},alphanumeric:{validate:or,error:s},alpha:{validate:lr,error:f},email:{validate:sr,error:D},date:{validate:cr,error:x},url:{validate:ur,error:b}}[T.INPUT_VALIDATION];return V&&!V.validate(r)&&!((F=l[a])!=null&&F.length)?{[a]:V.error}:E},pr=({fieldsConfig:r,onSubmit:t})=>{const n=j({requiredFieldError:"Auth.FormText.requiredFieldError",lengthTextError:"Auth.FormText.lengthTextError",numericError:"Auth.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Auth.FormText.alphaNumericError",alphaError:"Auth.FormText.alphaError",emailError:"Auth.FormText.emailError",dateError:"Auth.FormText.dateError",dateLengthError:"Auth.FormText.dateLengthError",dateMaxError:"Auth.FormText.dateMaxError",dateMinError:"Auth.FormText.dateMinError",urlError:"Auth.FormText.urlError"}),l=H(null),c=H(!1),[u,p]=R({}),[A,s]=R({}),f=v(()=>{let e=!0;const o={...A};let a=null;for(const[E,T]of Object.entries(u)){const N=r==null?void 0:r.find(d=>{var i;return(i=d==null?void 0:d.customUpperCode)==null?void 0:i.includes(E)}),I=O(T.toString(),N,n,o);I[E]&&(Object.assign(o,I),e=!1),a||(a=Object.keys(o).find(d=>o[d])||null)}if(s(o),a&&l.current){const E=l.current.elements.namedItem(a);E==null||E.focus()}return e},[A,r,u,n]);P(()=>{if(r!=null&&r.length){const{initialData:e,errorList:o}=er(r);p(a=>({...e,...a})),s(o)}},[JSON.stringify(r)]);const D=v(async()=>{c.current||(await G(0),c.current=!0)},[]),x=v(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a;p(i=>({...i,[o]:N}));const I=r==null?void 0:r.find(i=>{var S;return(S=i==null?void 0:i.customUpperCode)==null?void 0:S.includes(o)});let d={...A};if(I){const i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[r,A,n]),b=v(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a,I=r==null?void 0:r.find(d=>d.customUpperCode===o);if(I){const d={...A},i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[A,r,n]),M=v(e=>{e.preventDefault();const o=f();t==null||t(e,o)},[f,t]);return{formData:u,errors:A,formRef:l,handleChange:x,handleBlur:b,handleSubmit:M,handleFocus:D}},br=({name:r,loading:t,children:n,className:l="defaultForm",fieldsConfig:c=[],onSubmit:u})=>{const{formData:p,errors:A,formRef:s,handleChange:f,handleBlur:D,handleSubmit:x,handleFocus:b}=pr({onSubmit:u,fieldsConfig:c});return U("form",{className:l,onSubmit:x,name:r,ref:s,onFocus:b,children:[h(rr,{className:l,onFocus:b,fields:c,onChange:f,onBlur:D,errors:A,values:p,loading:t}),n]})},mr=({type:r,buttonText:t,variant:n,className:l="",enableLoader:c=!1,onClick:u,style:p,icon:A,...s})=>{const f=v(x=>{u==null||u(x)},[u]);return U(J,{icon:A,style:p,type:r,variant:n,className:L(["auth-button",l,c?"enableLoader":""]),onClick:f,...s,children:[h("span",{className:"auth-button__text",children:t}),c?h("div",{className:"auth-button__wrapper",children:h("span",{className:"auth-button__loader"})}):null]})};export{mr as B,br as F,Dr as c,Ir as g,xr as u}; +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{jsx as h,Fragment as Z,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{useState as R,useCallback as L,useRef as H,useEffect as P}from"@dropins/tools/preact-hooks.js";import*as $ from"@dropins/tools/preact-compat.js";import{memo as W,useCallback as _}from"@dropins/tools/preact-compat.js";import{initReCaptcha as G}from"@dropins/tools/recaptcha.js";import{useText as j}from"@dropins/tools/i18n.js";import{classes as M}from"@dropins/tools/lib.js";import{Field as w,Picker as q,Input as X,InputDate as C,Checkbox as z,TextArea as B,Button as J}from"@dropins/tools/components.js";const Ir=r=>{if(!r)return null;const t=new FormData(r);if(t&&typeof t.entries=="function"){const n=t.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},Dr=r=>typeof r=="function",Y=r=>$.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("g",{clipPath:"url(#clip0_841_1324)"},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),$.createElement("defs",null,$.createElement("clipPath",{id:"clip0_841_1324"},$.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),K=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Q=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),g={success:h(K,{}),warning:h(Y,{}),error:h(Q,{})},xr=()=>{const[r,t]=R({}),n=L(l=>{if(!l||!l.type){t({});return}const c=g[l.type];t({...l,icon:c})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:n}};var v=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(v||{});const rr=W(({loading:r,values:t,fields:n=[],errors:l,className:c="",onChange:u,onBlur:p,onFocus:A})=>{const s=`${c}__field`,f=_((e,o,a)=>{var T;const E=(T=e.options.find(N=>N.isDefault))==null?void 0:T.value;return h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(q,{name:e.customUpperCode,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:u,defaultValue:E??o??e.defaultValue,value:E??o??e.defaultValue})},e.id)},[c,r,s,p,u]),D=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(X,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,onFocus:A})},e.id),[c,r,s,p,u,A]),x=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(C,{type:"text",name:e.customUpperCode,value:o||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,disabled:r||e.disabled})},e.id),[c,r,s,p,u]),m=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(z,{name:e.customUpperCode,checked:o||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]),b=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(B,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]);return n.length?h(Z,{children:n.map(e=>{const o=l==null?void 0:l[e.customUpperCode],a=t==null?void 0:t[e.customUpperCode];switch(e.fieldType){case v.TEXT:return e.options.length?f(e,a,o):D(e,a,o);case v.MULTILINE:return D(e,a,o);case v.SELECT:return f(e,a,o);case v.DATE:return x(e,a,o);case v.BOOLEAN:return m(e,a,o);case v.TEXTAREA:return b(e,a,o);default:return null}})}):null}),er=r=>r.reduce((t,{customUpperCode:n,required:l,defaultValue:c})=>(l&&n&&(t.initialData[n]=c||"",t.errorList[n]=""),t),{initialData:{},errorList:{}}),tr=r=>r.reduce((t,n)=>({...t,[n.name]:n.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),lr=r=>/^[a-zA-Z]+$/.test(r),sr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),cr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),dr=(r,t,n)=>{const l=new Date(r).getTime()/1e3;return!(isNaN(l)||l<0||typeof t<"u"&&ln)},k=r=>{if(!r||r.trim()==="")return"";const t=parseInt(r,10);if(!isNaN(t)){const c=new Date(t*1e3);return isNaN(c.getTime())?"":c.toISOString().split("T")[0]}const n=new Date(r);if(isNaN(n.getTime()))return"";const l=parseInt(r.split("-")[1],10);return l>12||l<1?"":n.toISOString().split("T")[0]},ur=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),ir=(r,t,n)=>{const l=r.length;return l>=t&&l<=n},O=(r,t,n,l)=>{var y,F;const{requiredFieldError:c,lengthTextError:u,numericError:p,alphaNumWithSpacesError:A,alphaNumericError:s,alphaError:f,emailError:D,dateError:x,urlError:m,dateLengthError:b,dateMaxError:e,dateMinError:o}=n,a=t==null?void 0:t.customUpperCode,E={[a]:""};if(l[a]&&delete l[a],t!=null&&t.required&&!r)return{[a]:c};if(!(t!=null&&t.required)&&!r||!((y=t==null?void 0:t.validateRules)!=null&&y.length))return E;const T=tr(t==null?void 0:t.validateRules),N=T.MIN_TEXT_LENGTH??1,I=T.MAX_TEXT_LENGTH??255,d=T.DATE_RANGE_MIN,i=T.DATE_RANGE_MAX;if(!ir(r,+N,+I)&&!(d||i))return{[a]:u.replace("{min}",N).replace("{max}",I)};if(!dr(r,+d,+i)&&(d||i)){if(d&&d)return{[a]:b.replace("{min}",k(d)).replace("{max}",k(i))};if(typeof d>"u"||typeof i>"u")return{[a]:i?e.replace("{max}",k(i)):o.replace("{min}",k(d))}}const V={numeric:{validate:ar,error:p},"alphanum-with-spaces":{validate:nr,error:A},alphanumeric:{validate:or,error:s},alpha:{validate:lr,error:f},email:{validate:sr,error:D},date:{validate:cr,error:x},url:{validate:ur,error:m}}[T.INPUT_VALIDATION];return V&&!V.validate(r)&&!((F=l[a])!=null&&F.length)?{[a]:V.error}:E},pr=({fieldsConfig:r,onSubmit:t})=>{const n=j({requiredFieldError:"Auth.FormText.requiredFieldError",lengthTextError:"Auth.FormText.lengthTextError",numericError:"Auth.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Auth.FormText.alphaNumericError",alphaError:"Auth.FormText.alphaError",emailError:"Auth.FormText.emailError",dateError:"Auth.FormText.dateError",dateLengthError:"Auth.FormText.dateLengthError",dateMaxError:"Auth.FormText.dateMaxError",dateMinError:"Auth.FormText.dateMinError",urlError:"Auth.FormText.urlError"}),l=H(null),c=H(!1),[u,p]=R({}),[A,s]=R({}),f=L(()=>{let e=!0;const o={...A};let a=null;for(const[E,T]of Object.entries(u)){const N=r==null?void 0:r.find(d=>{var i;return(i=d==null?void 0:d.customUpperCode)==null?void 0:i.includes(E)}),I=O(T.toString(),N,n,o);I[E]&&(Object.assign(o,I),e=!1),a||(a=Object.keys(o).find(d=>o[d])||null)}if(s(o),a&&l.current){const E=l.current.elements.namedItem(a);E==null||E.focus()}return e},[A,r,u,n]);P(()=>{if(r!=null&&r.length){const{initialData:e,errorList:o}=er(r);p(a=>({...e,...a})),s(o)}},[JSON.stringify(r)]);const D=L(async()=>{c.current||(await G(0),c.current=!0)},[]),x=L(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a;p(i=>({...i,[o]:N}));const I=r==null?void 0:r.find(i=>{var S;return(S=i==null?void 0:i.customUpperCode)==null?void 0:S.includes(o)});let d={...A};if(I){const i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[r,A,n]),m=L(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a,I=r==null?void 0:r.find(d=>d.customUpperCode===o);if(I){const d={...A},i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[A,r,n]),b=L(e=>{e.preventDefault();const o=f();t==null||t(e,o)},[f,t]);return{formData:u,errors:A,formRef:l,handleChange:x,handleBlur:m,handleSubmit:b,handleFocus:D}},br=({name:r,loading:t,children:n,className:l="defaultForm",fieldsConfig:c=[],onSubmit:u,...p})=>{const{formData:A,errors:s,formRef:f,handleChange:D,handleBlur:x,handleSubmit:m,handleFocus:b}=pr({onSubmit:u,fieldsConfig:c});return U("form",{className:l,onSubmit:m,name:r,ref:f,onFocus:b,...p,children:[h(rr,{className:l,onFocus:b,fields:c,onChange:D,onBlur:x,errors:s,values:A,loading:t}),n]})},mr=({type:r,buttonText:t,variant:n,className:l="",enableLoader:c=!1,onClick:u,style:p,icon:A,...s})=>{const f=L(x=>{u==null||u(x)},[u]);return U(J,{icon:A,style:p,type:r,variant:n,className:M(["auth-button",l,c?"enableLoader":""]),onClick:f,...s,children:[h("span",{className:"auth-button__text",children:t}),c?h("div",{className:"auth-button__wrapper",children:h("span",{className:"auth-button__loader"})}):null]})};export{mr as B,br as F,Dr as c,Ir as g,xr as u}; diff --git a/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js b/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js index e4872b447c..c802dc49c0 100644 --- a/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as o,h as r}from"./network-error.js";const t=` mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) { confirmEmail(input: { diff --git a/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js b/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js index de04a0fab1..568650dc7a 100644 --- a/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js +++ b/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as a,h as s}from"./network-error.js";import{s as n}from"./setReCaptchaToken.js";import{t as u}from"./transform-attributes-form.js";import{h as o}from"./getStoreConfig.js";const i=` mutation CREATE_CUSTOMER($input: CustomerInput!) { createCustomer(input: $input) { diff --git a/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js b/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js index cada7215c0..2d798fe106 100644 --- a/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{a as y,f as k,h as x}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{h as R,p as T,E as g,a as v,C as O}from"./getStoreConfig.js";import{events as D}from"@dropins/tools/event-bus.js";import{c as U}from"./initialize.js";import{s as K}from"./setReCaptchaToken.js";const F=t=>{var m,r,e,c,a,f;return{email:((r=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:r.email)||"",firstname:((c=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:c.firstname)||"",lastname:((f=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:f.lastname)||""}},H=` query GET_CUSTOMER_DATA { customer { diff --git a/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js index bf7f59943c..4023c8da2a 100644 --- a/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h as E}from"./network-error.js";const T=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),S=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),N=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)||""}}}),D={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},c=3600,I=e=>{var t,o,r,a,m,_,f,g,d,C;return{autocompleteOnStorefront:((o=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:o.autocomplete_on_storefront)||!1,minLength:((a=(r=e==null?void 0:e.data)==null?void 0:r.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((_=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:_.required_character_classes_number)||0,createAccountConfirmation:((g=(f=e==null?void 0:e.data)==null?void 0:f.storeConfig)==null?void 0:g.create_account_confirmation)||!1,customerAccessTokenLifetime:((C=(d=e==null?void 0:e.data)==null?void 0:d.storeConfig)==null?void 0:C.customer_access_token_lifetime)*c||c}},O=e=>{const t=e.map(o=>o.message).join(" ");throw Error(t)},U=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},R=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const r=await b();sessionStorage.setItem("storeConfig",JSON.stringify(r)),o=(r==null?void 0:r.customerAccessTokenLifetime)||c}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${c}`}};var A=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(A||{});const s="authContext",h="shopperContext",i={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function n(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function u(e){(window.adobeDataLayer||[]).push(o=>{const r=o.getState?o.getState():{};o.push({event:e,eventInfo:{...r}})})}function k(e){const t=N(e);n(s,t),u(i.CREATE_ACCOUNT)}function p(e){const t=T(e);n(s,t),n(h,{shopperId:"logged-in"}),u(i.SIGN_IN)}function w(e){const t=S(e);n(s,t),n(h,{shopperId:"guest"}),u(i.SIGN_OUT)}const M=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),a={...o?JSON.parse(o):{},...t};switch(e){case"create-account":k(a);break;case"sign-in":p(a);break;case"sign-out":w(a);break;default:return null}},G=` query GET_STORE_CONFIG { storeConfig { diff --git a/scripts/__dropins__/storefront-auth/chunks/index.js b/scripts/__dropins__/storefront-auth/chunks/index.js index 24ff0945c9..ca991f000c 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index.js +++ b/scripts/__dropins__/storefront-auth/chunks/index.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{R as b,R as c}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./UpdatePasswordForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";/* empty css */import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{b as ResetPasswordForm,c as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/index2.js b/scripts/__dropins__/storefront-auth/chunks/index2.js index 00bfd0a9af..8dfe1d9480 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index2.js +++ b/scripts/__dropins__/storefront-auth/chunks/index2.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{S as k,S as q}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./UpdatePasswordForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"./getCustomerToken.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./getStoreConfig.js";import"./initialize.js";import"./setReCaptchaToken.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./confirmEmail.js";/* empty css */import"./EmailConfirmationForm.js";export{k as SignInForm,q as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/index3.js b/scripts/__dropins__/storefront-auth/chunks/index3.js index a952dfc42d..53708108ef 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index3.js +++ b/scripts/__dropins__/storefront-auth/chunks/index3.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{S as v,S as w}from"./SignUpForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./createCustomerAddress.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./transform-attributes-form.js";import"./getStoreConfig.js";import"@dropins/tools/preact-hooks.js";import"./simplifyTransformAttributesForm.js";import"./usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"./getCustomerToken.js";import"./initialize.js";import"./UpdatePasswordForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";/* empty css */import"./SkeletonLoader.js";import"./EmailConfirmationForm.js";import"./resendConfirmationEmail.js";export{v as SignUpForm,w as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/initialize.js b/scripts/__dropins__/storefront-auth/chunks/initialize.js index 4694336287..48b5b4b6df 100644 --- a/scripts/__dropins__/storefront-auth/chunks/initialize.js +++ b/scripts/__dropins__/storefront-auth/chunks/initialize.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{Initializer as o}from"@dropins/tools/lib.js";const i=new o({init:async n=>{const e={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};i.config.setConfig({...e,...n})},listeners:()=>[]}),a=i.config;export{a as c,i}; diff --git a/scripts/__dropins__/storefront-auth/chunks/network-error.js b/scripts/__dropins__/storefront-auth/chunks/network-error.js index f2d0406a8c..b42c878118 100644 --- a/scripts/__dropins__/storefront-auth/chunks/network-error.js +++ b/scripts/__dropins__/storefront-auth/chunks/network-error.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js b/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js index 0a42afb41c..bc522e0e36 100644 --- a/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as E,h as l}from"./network-error.js";import{s as e}from"./setReCaptchaToken.js";const R=a=>{var r,m,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(m=a==null?void 0:a.errors[0])==null?void 0:m.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},c=` mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) { requestPasswordResetEmail(email: $email) diff --git a/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js b/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js index 745cd5dcf0..42fa7f44d0 100644 --- a/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as r,h as e}from"./network-error.js";const i=` mutation RESEND_CONFIRMATION_EMAIL($email: String!) { resendConfirmationEmail(email: $email) diff --git a/scripts/__dropins__/storefront-auth/chunks/resetPassword.js b/scripts/__dropins__/storefront-auth/chunks/resetPassword.js index 119699aa02..3676feeeab 100644 --- a/scripts/__dropins__/storefront-auth/chunks/resetPassword.js +++ b/scripts/__dropins__/storefront-auth/chunks/resetPassword.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=` mutation RESET_PASSWORD($email: String!, $resetPasswordToken: String!, $newPassword: String!){ resetPassword(email: $email,resetPasswordToken: $resetPasswordToken,newPassword: $newPassword) diff --git a/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js b/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js index e8033febf4..4b64ef7150 100644 --- a/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js @@ -1,3 +1,5 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{f as u,h as n}from"./network-error.js";import{C as m,d as s,p as c,E}from"./getStoreConfig.js";import{events as i}from"@dropins/tools/event-bus.js";const k=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},h=` mutation REVOKE_CUSTOMER_TOKEN { revokeCustomerToken { diff --git a/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js b/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js index ffad115ea0..7c2f91394c 100644 --- a/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{verifyReCaptcha as t}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{a as e}from"./network-error.js";const s=async()=>{const a=await t();a&&e("X-ReCaptcha",a)};export{s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js b/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js index 0854d46240..b0ff94f9ef 100644 --- a/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{t}from"./transform-attributes-form.js";const s=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-sign-in-form__form__email",frontend_input:"TEXT",is_required:!0,multiline_count:1,sort_order:1,is_unique:!1,label:"Email",options:[]}],n=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-reset-password-form__form__item",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[]}],_=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",multiline_count:1,sort_order:1,options:[]},{customUpperCode:"firstname",code:"firstname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"First name",multiline_count:1,sort_order:2,options:[]},{customUpperCode:"lastname",code:"lastname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!1,is_unique:!1,label:"Last name",multiline_count:1,sort_order:3,options:[]}],a=e=>e!=null&&e.length?t({data:{attributesForm:{items:e}}}):[];export{n as D,s as a,_ as b,a as s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js index fe968f794f..1e6a358e67 100644 --- a/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ const _=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),m=(t,n,e)=>{const s=["string","boolean","number"],a=n==="camelCase"?_:p;return Array.isArray(t)?t.map(o=>s.includes(typeof o)||o===null?o:typeof o=="object"?m(o,n,e):o):t!==null&&typeof t=="object"?Object.entries(t).reduce((o,[i,c])=>{const r=e&&e[i]?e[i]:a(i);return o[r]=s.includes(typeof c)||c===null?c:m(c,n,e),o},{}):t},b=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let s=2;s<=e.multiline_count;s++){const a={...e,is_required:!1,name:`${e.code}_multiline_${s}`,code:`${e.code}_multiline_${s}`,id:`${e.code}_multiline_${s}`};n.push(a)}return n},C=t=>{var o,i,c;const n=((i=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:i.items)||[];if(!n.length)return[];const e=(c=n.filter(r=>{var u;return!((u=r.frontend_input)!=null&&u.includes("HIDDEN"))}))==null?void 0:c.map(({code:r,...u})=>{const l=r!=="country_id"?r:"country_code";return{...u,name:l,id:l,code:l}}),s=b(e);return e.concat(s).map(r=>{var d;const u=r.code==="firstname"?"firstName":r.code==="lastname"?"lastName":_(r.code),l=(d=r.options)==null?void 0:d.map(f=>({isDefault:f.is_default,text:f.label,value:f.value}));return m({...r,options:l,customUpperCode:u},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,u)=>r.orderNumber-u.orderNumber)};export{m as c,C as t}; diff --git a/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js b/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js index 7068e90f82..ef6ef183ab 100644 --- a/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js +++ b/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./getStoreConfig.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length import("preact").JSX.Element; +export declare const Form: ({ name, loading, children, className, fieldsConfig, onSubmit, ...props }: FormProps) => import("preact").JSX.Element; //# sourceMappingURL=Form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-auth/containers/AuthCombine.js b/scripts/__dropins__/storefront-auth/containers/AuthCombine.js index 7a2fa79c69..26e94e21fb 100644 --- a/scripts/__dropins__/storefront-auth/containers/AuthCombine.js +++ b/scripts/__dropins__/storefront-auth/containers/AuthCombine.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{lazy as u,Suspense as v}from"@dropins/tools/preact-compat.js";import{useState as E,useMemo as S}from"@dropins/tools/preact-hooks.js";import{S as y}from"../chunks/SkeletonLoader.js";import"@dropins/tools/components.js";const L=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),P=function(c){return"/"+c},p={},d=function(t,i,a){let l=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),r=(e==null?void 0:e.nonce)||(e==null?void 0:e.getAttribute("nonce"));l=Promise.all(i.map(o=>{if(o=P(o),o in p)return;p[o]=!0;const m=o.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${f}`))return;const n=document.createElement("link");if(n.rel=m?"stylesheet":L,m||(n.as="script",n.crossOrigin=""),n.href=o,r&&n.setAttribute("nonce",r),document.head.appendChild(n),m)return new Promise((h,_)=>{n.addEventListener("load",h),n.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${o}`)))})}))}return l.then(()=>t()).catch(e=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=e,window.dispatchEvent(r),!r.defaultPrevented)throw e})},k=u(()=>d(()=>import("../chunks/index.js"),[])),b=u(()=>d(()=>import("../chunks/index2.js"),[])),w=u(()=>d(()=>import("../chunks/index3.js"),[])),F=({defaultView:c="signInForm",signInFormConfig:t,signUpFormConfig:i,resetPasswordFormConfig:a})=>{const[l,e]=E(c),r=S(()=>({signInForm:s(b,{setActiveComponent:e,...t}),signUpForm:s(w,{setActiveComponent:e,...i}),resetPasswordForm:s(k,{setActiveComponent:e,...a})}),[a,t,i,e]);return s("div",{children:s(v,{fallback:s(y,{activeSkeleton:l}),children:s("div",{className:"auth-combine",children:r[l]})})})};export{F as AuthCombine,F as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/ResetPassword.js b/scripts/__dropins__/storefront-auth/containers/ResetPassword.js index 702f474f33..dc132fd911 100644 --- a/scripts/__dropins__/storefront-auth/containers/ResetPassword.js +++ b/scripts/__dropins__/storefront-auth/containers/ResetPassword.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{R as i}from"../chunks/ResetPasswordForm.js";import"@dropins/tools/lib.js";import"../chunks/UpdatePasswordForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/requestPasswordResetEmail.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";/* empty css */import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";const F=({formSize:o,routeSignIn:t,onErrorCallback:m})=>r("div",{className:"auth-reset-password",children:r(i,{formSize:o,routeSignIn:t,onErrorCallback:m})});export{F as ResetPassword,F as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SignIn.js b/scripts/__dropins__/storefront-auth/containers/SignIn.js index 154ff81df8..171a41dccb 100644 --- a/scripts/__dropins__/storefront-auth/containers/SignIn.js +++ b/scripts/__dropins__/storefront-auth/containers/SignIn.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S as u}from"../chunks/SignInForm.js";import"@dropins/tools/lib.js";import"../chunks/UpdatePasswordForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/getCustomerToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getStoreConfig.js";import"../chunks/initialize.js";import"../chunks/setReCaptchaToken.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/confirmEmail.js";/* empty css */import"../chunks/EmailConfirmationForm.js";const K=({slots:i,labels:o,enableEmailConfirmation:t,initialEmailValue:m,formSize:p,renderSignUpLink:n,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:e,routeForgotPassword:c,routeSignUp:d,onSuccessCallback:f,onErrorCallback:g,onSignUpLinkClick:l})=>r("div",{className:"auth-sign-in",children:r(u,{slots:i,labels:o,formSize:p,renderSignUpLink:n,initialEmailValue:m,enableEmailConfirmation:t,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeSignUp:d,onErrorCallback:g,onSuccessCallback:f,onSignUpLinkClick:l,routeForgotPassword:c,routeRedirectOnSignIn:e})});export{K as SignIn,K as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SignUp.js b/scripts/__dropins__/storefront-auth/containers/SignUp.js index 2e8cc6b5ff..5813b434b7 100644 --- a/scripts/__dropins__/storefront-auth/containers/SignUp.js +++ b/scripts/__dropins__/storefront-auth/containers/SignUp.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S as h}from"../chunks/SignUpForm.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"../chunks/createCustomerAddress.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/transform-attributes-form.js";import"../chunks/getStoreConfig.js";import"@dropins/tools/preact-hooks.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"../chunks/getCustomerToken.js";import"../chunks/initialize.js";import"../chunks/UpdatePasswordForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/SkeletonLoader.js";import"../chunks/EmailConfirmationForm.js";import"../chunks/resendConfirmationEmail.js";const O=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,requireRetypePassword:s,inputsDefaultValueSet:a,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,fieldsConfigForApiVersion1:u,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,onSuccessCallback:g,onErrorCallback:l,routeSignIn:S})=>r("div",{className:"auth-sign-up",children:r(h,{requireRetypePassword:s,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:u,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,routeSignIn:S,slots:i,onErrorCallback:l,onSuccessCallback:g})});export{O as SignUp,O as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js b/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js index 8fd6c7cff4..dc6647bc86 100644 --- a/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js +++ b/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsxs as a,jsx as o,Fragment as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u,Slot as m}from"@dropins/tools/lib.js";/* empty css */import{Button as s}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as f}from"../chunks/revokeCustomerToken.js";import{useText as d}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getStoreConfig.js";const h=({formSize:n="default",className:e="",slots:t,labels:i})=>{const c=d({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return a("div",{className:u(["auth-success-notification-form",`auth-success-notification-form--${n}`,e]),children:[o("p",{className:"auth-success-notification-form__title","data-testid":"notification-title",children:(i==null?void 0:i.headingText)||c.headingText}),o("p",{className:"auth-success-notification-form__content-text","data-testid":"notification-content",children:(i==null?void 0:i.messageText)||c.messageText}),t!=null&&t.SuccessNotificationActions?o(m,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:t==null?void 0:t.SuccessNotificationActions,context:{}}):a(r,{children:[o(s,{"data-testid":"primaryButton",type:"button",className:"auth-success-notification-form__button auth-success-notification-form__button--top",onClick:()=>window.location.href="/",children:c.primaryButtonText}),o(s,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await f(),window.location.href="/"},children:c.secondaryButtonText})]})]})},k=({formSize:n="default",slots:e,className:t,labels:i})=>o("div",{className:"auth-success-notification",children:o(h,{formSize:n,className:t,slots:e,labels:i})});export{k as SuccessNotification,k as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js b/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js index 4d9cd26da6..d9907efff3 100644 --- a/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js +++ b/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js @@ -1 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as $}from"@dropins/tools/lib.js";import{v as k,u as S,a as W}from"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as O}from"../chunks/getCustomerToken.js";import{r as g}from"../chunks/resetPassword.js";import{c as j,g as R,u as C,F as tt,B as et}from"../chunks/UpdatePasswordForm.js";import{useState as h,useEffect as z,useCallback as I}from"@dropins/tools/preact-hooks.js";import{useText as K}from"@dropins/tools/i18n.js";import{Header as at,InLineAlert as st,InputPassword as rt}from"@dropins/tools/components.js";/* empty css */import"../chunks/getStoreConfig.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../chunks/setReCaptchaToken.js";import"@dropins/tools/preact-compat.js";const J=(d,p)=>d.split("&").filter(r=>r.includes(p)).map(r=>r.split("=")[1])[0],it=({isEmailConfirmationRequired:d,signInOnSuccess:p,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:w,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:N,routeSignInPage:o})=>{const s=K({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,n]=h({userName:"",status:!1}),[x,F]=h(""),[v,A]=h(!1),[P,L]=h(""),[y,M]=h(""),[T,c]=h(!1),[_,q]=h(!1),[b,B]=h([]);z(()=>{v&&!b.length&&(x.length?q(!1):q(!0))},[v,x,b]),z(()=>{const{search:f}=window.location;!f.includes("token=")&&!f.includes("email=")&&j(w)&&(window.location.href=w());const e=decodeURIComponent(f),V=J(e,"token"),E=J(e,"email");L(E),M(V)},[w]);const Q=I(async f=>{f.preventDefault(),c(!0),B([]);const e=R(f.target),V=(e==null?void 0:e.password)&&P&&y;e!=null&&e.password||(q(!0),c(!1));const E=(t==null?void 0:t.requiredCharacterClasses)??0,Y=(t==null?void 0:t.minLength)??0;if(!k(e==null?void 0:e.password,E)||e.password.length<+Y){A(!0),c(!1);return}if(!V){m({type:"error",text:s.errorNotification}),c(!1);return}const{message:D,success:G}=await g(P,y,e.password);if(G){if(d||!d&&!p){i==null||i(),j(N)&&(window.location.href=N()),A(!0),c(!1),q(!1),F(""),B([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=o==null?void 0:o()}}]),m({type:"success",text:s.updatePasswordMessage});return}const l=await O({email:P,password:e.password,handleSetInLineAlertProps:m,onErrorCallback:a,translations:s});l!=null&&l.userName&&(i==null||i(l==null?void 0:l.userName),j(r)?window.location.href=r():n({userName:l==null?void 0:l.userName,status:!0}))}else m({type:"error",text:D}),a==null||a({message:D,success:G});c(!1)},[P,y,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,d,p,o,a,i,r,m,N]),X=I(f=>{F(f)},[]);return{additionalActionsAlert:b,passwordError:_,isSuccessful:U,updatePasswordValue:x,isClickSubmit:v,isLoading:T,submitUpdatePassword:Q,handleSetUpdatePasswordValue:X,setIsClickSubmit:A}},ot=({signInOnSuccess:d=!0,formSize:p="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:w,slots:a,onErrorCallback:i,onSuccessCallback:m,routeRedirectOnPasswordUpdate:N})=>{const o=K({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=S(),{inLineAlertProps:n,handleSetInLineAlertProps:x}=C(),{additionalActionsAlert:F,passwordError:v,isSuccessful:A,updatePasswordValue:P,isClickSubmit:L,isLoading:y,submitUpdatePassword:M,handleSetUpdatePasswordValue:T}=it({isEmailConfirmationRequired:U,signInOnSuccess:d,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:m,handleSetInLineAlertProps:x,routeRedirectOnPasswordUpdate:N,routeSignInPage:w}),{isValidUniqueSymbols:c,defaultLengthMessage:_}=W({password:P,isClickSubmit:L,passwordConfigs:s});return A.status&&(a!=null&&a.SuccessNotification)?u(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:A}}):H("div",{className:$(["auth-update-password-form",`auth-update-password-form--${p}`]),children:[u(at,{title:o.title,divider:!1,className:"auth-update-password-form__title"}),u(st,{className:$(["auth-update-password-form__notification",["auth-update-password-form__notification--show",!!(n!=null&&n.text)]]),variant:"secondary",heading:n==null?void 0:n.text,icon:n.icon,additionalActions:F}),H(tt,{name:"updatePassword_form",className:"auth-update-password-form__form",onSubmit:M,loading:y,fieldsConfig:[],children:[u("div",{style:"display: none;",children:u("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),u(rt,{defaultValue:P,onValue:T,className:"auth-update-password-form__form__item",autoComplete:"new-password",name:"password",errorMessage:v||c==="error"||(_==null?void 0:_.status)==="error"?o.requiredFieldError:void 0,minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:c,validateLengthConfig:_,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:o.placeholder,floatingLabel:o.floatingLabel}),u("div",{className:"auth-update-password-form__button",children:u(et,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:y})})]})]})},qt=({slots:d,formSize:p,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:w,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N})=>u("div",{className:"auth-update-password",children:u(ot,{formSize:p,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:w,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N,slots:d,routeRedirectOnPasswordUpdate:r})});export{qt as UpdatePassword,qt as default}; diff --git a/scripts/__dropins__/storefront-auth/hooks/components/useSignUpForm.d.ts b/scripts/__dropins__/storefront-auth/hooks/components/useSignUpForm.d.ts index 28a34ae2cd..afc0e6d5ef 100644 --- a/scripts/__dropins__/storefront-auth/hooks/components/useSignUpForm.d.ts +++ b/scripts/__dropins__/storefront-auth/hooks/components/useSignUpForm.d.ts @@ -1,6 +1,7 @@ import { UseSingUpFormProps } from '../../types'; export declare const useSignUpForm: ({ requireRetypePassword, addressesData, translations, isEmailConfirmationRequired, apiVersion2, passwordConfigs, isAutoSignInEnabled, routeRedirectOnSignIn, routeSignIn, onErrorCallback, onSuccessCallback, setActiveComponent, handleSetInLineAlertProps, routeRedirectOnEmailConfirmationClose, }: UseSingUpFormProps) => { + showPasswordErrorMessage: boolean; confirmPassword: string; confirmPasswordMessage: string; isKeepMeLogged: boolean; @@ -19,5 +20,7 @@ export declare const useSignUpForm: ({ requireRetypePassword, addressesData, tra onKeepMeLoggedChange: ({ target }: any) => void; handleHideEmailConfirmationForm: () => void; handleConfirmPasswordChange: (value: string) => void; + onBlurPassword: (event: Event) => void; + onBlurConfirmPassword: (event: Event) => void; }; //# sourceMappingURL=useSignUpForm.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-auth/i18n/en_US.json.d.ts b/scripts/__dropins__/storefront-auth/i18n/en_US.json.d.ts index bc5282b2e9..466616129a 100644 --- a/scripts/__dropins__/storefront-auth/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-auth/i18n/en_US.json.d.ts @@ -9,7 +9,8 @@ declare const _default: { "ResetPasswordForm": { "title": "Reset your password", "buttonPrimary": "Reset password", - "buttonSecondary": "Back to sign in" + "buttonSecondary": "Back to sign in", + "formAriaLabel": "Reset your password form" }, "SignInForm": { "title": "Sign in", diff --git a/scripts/__dropins__/storefront-auth/reload b/scripts/__dropins__/storefront-auth/reload new file mode 100644 index 0000000000..3bb08c0cb0 --- /dev/null +++ b/scripts/__dropins__/storefront-auth/reload @@ -0,0 +1 @@ +{"at":1733262199129} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-auth/render.js b/scripts/__dropins__/storefront-auth/render.js index 36f3496487..6b72da4731 100644 --- a/scripts/__dropins__/storefront-auth/render.js +++ b/scripts/__dropins__/storefront-auth/render.js @@ -1,4 +1,6 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ (function(o,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const i in t.attributes)a.setAttribute(i,t.attributes[i]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(o));const r=document.querySelector('style[data-dropin="sdk"]');if(r)r.after(a);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(`.auth-success-notification-form{display:flex;justify-content:center;align-items:center;flex-direction:column;border-radius:var(--shape-border-radius-2);background:var(--color-neutral-50, #fff);padding:var(--spacing-xbig) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-success-notification-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-success-notification-form.auth-success-notification-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-success-notification-form__title{color:var(--color-neutral-800, #2b2b2b);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-details-caption-1-letter-spacing);margin-bottom:var(--spacing-medium)}.auth-success-notification-form__content-text{color:var(--color-neutral-800, #2b2b2b);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);text-align:center;margin-bottom:var(--spacing-xxbig)}.auth-success-notification-form__button--top{margin-bottom:var(--spacing-xsmall)} .auth-email-confirmation-form{border-radius:8px;background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small);text-align:start}@media (min-width: 768px){.auth-email-confirmation-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-email-confirmation-form__title{font:var(--type-headline-2-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--color-neutral-800, #3d3d3d)}.auth-email-confirmation-form__subtitle{display:block;font:var(--type-details-caption-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-neutral-700, #666666)}.auth-email-confirmation-form__notification{margin-bottom:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-email-confirmation-form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-email-confirmation-form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-email-confirmation-form__text{display:block;font-family:var(--type-body-1-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--neutrals-neutral-800);padding:var(--spacing-big) 0}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons>span{display:none}.auth-email-confirmation-form__buttons>span{border:1px solid var(--color-brand-500);margin:var(--spacing-small) var(--spacing-xsmall);font:var(--type-button-2-font)}@media (max-width: 768px){.auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form__buttons>span{display:none}} .auth-sign-up-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-up-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-up-form.auth-sign-up-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__title{margin-bottom:var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(3){flex-basis:100%}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form{grid-template-columns:1fr}.auth-sign-up-form__form__confirm-wrapper>.auth-sign-up-form__form__field--confirm-password{margin:var(--spacing-medium) 0}.auth-sign-up-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-up-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-up-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-up-form__form{display:flex;flex-wrap:wrap;flex-direction:row;gap:0 13px}.auth-sign-up-form__form__field{margin-bottom:var(--spacing-medium);flex-basis:100%;flex-grow:1;flex-shrink:0}.auth-sign-up-form__checkbox{margin-bottom:12px}.auth-sign-up-form__automatic-login{margin-top:12px}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:1;flex-basis:100%}.auth-sign-up-form-buttons{flex-basis:100%;display:grid;grid-template-columns:1fr;gap:var(--spacing-medium) 0;justify-content:center;grid-area:buttons}@media (min-width: 768px){.auth-sign-up-form-buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:.5;flex-basis:48%}}.auth-sign-in-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-in-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-in-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__email,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__password,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__title{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-sign-in-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-in-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-in-form__form{display:grid;grid-template-columns:1fr}.auth-sign-in-form__form__email{margin-bottom:var(--spacing-medium)}.auth-sign-in-form__form__password{margin-bottom:var(--spacing-big)}.auth-sign-in-form__form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-sign-in-form__form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{display:flex}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{border:var(--shape-border-width-1) solid var(--color-brand-500);margin:13px 10px;font:var(--type-button-2-font)}.auth-sign-in-form__resend-email-notification button{font:var(--type-button-3-font);color:var(--textColor);display:inline;background-color:transparent;border:none;cursor:pointer;padding:0;margin:0}.auth-sign-in-form__resend-email-notification button:hover{color:var(--color-brand-700);text-decoration:solid underline var(--color-brand-700);text-underline-offset:6px;color:var(--color-informational-500)}@media (max-width: 768px){.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}}.auth-reset-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-reset-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-reset-password-form.auth-reset-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__form__item,.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__title{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__form{display:grid;grid-template-columns:1fr}.auth-reset-password-form__form__item{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__buttons{display:grid;grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form.auth-reset-password-form--small{grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form__notification{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-reset-password-form__title{margin-bottom:var(--spacing-xxbig)}}@media (min-width: 600px){.auth-reset-password-form__buttons{grid-template-columns:auto auto;justify-content:space-between}}.auth-button{position:relative}.auth-button__wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:0;display:none}.auth-custom-button__loader{width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;position:relative;animation:pulse 1s linear infinite}.auth-button__loader:after{content:"";position:absolute;width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%,-50%);animation:scaleUp 1s linear infinite}@keyframes scaleUp{0%{transform:translate(-50%,-50%) scale(0)}60%,to{transform:translate(-50%,-50%) scale(1)}}@keyframes pulse{0%,60%,to{transform:scale(1)}80%{transform:scale(1.2)}}.auth-button.enableLoader .auth-button__text{opacity:0}.auth-button.enableLoader .auth-button__wrapper{opacity:1;display:inline-flex}.auth-update-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-update-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-update-password-form.auth-update-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__title{margin-bottom:var(--spacing-small)}.auth-update-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__notification{display:none}.auth-update-password-form__notification--show{display:grid;margin-bottom:var(--spacing-medium)}`,{styleId:"Auth"}); -import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,Render as m}from"@dropins/tools/lib.js";import{useState as u,useEffect as f}from"@dropins/tools/preact-hooks.js";import{UIProvider as h}from"@dropins/tools/components.js";import{events as p}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as g}from"./chunks/initialize.js";const w={PasswordValidationMessage:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},ResetPasswordForm:{title:"Reset your password",buttonPrimary:"Reset password",buttonSecondary:"Back to sign in"},SignInForm:{title:"Sign in",buttonPrimary:"Sign in",buttonSecondary:"Sign up",buttonTertiary:"Forgot password?"},SignUpForm:{title:"Sign up",buttonPrimary:"Create account",buttonSecondary:"Already a member? Sign in",privacyPolicyDefaultText:"I’ve read and accept the Terms of Use and Privacy Policy.",subscribedDefaultText:"Subscribe to our newsletter and be the first to know about new arrivals, sales and exclusive offers.",keepMeLoggedText:"Keep me logged in after account creation",failedCreateCustomerAddress:"Failed to create customer addresses:",confirmPassword:{placeholder:"Confirm password",floatingLabel:"Confirm password *",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical."}},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},FormText:{requiredFieldError:"This is a required field.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",dateMaxError:"Date must be less than or equal to {max}.",dateMinError:"Date must be greater than or equal to {min}.",urlError:"Please enter a valid URL, e.g., https://www.website.com.",lengthTextError:"Text length must be between {min} and {max} characters."},EmailConfirmationForm:{title:"Verify your email address",subtitle:"We`ve sent an email to",mainText:"Check your inbox and click on the link we just send you to confirm your email address and activate your account.",buttonSecondary:"Resend email",buttonPrimary:"Close",accountConfirmMessage:"Account confirmed",accountConfirmationEmailSuccessMessage:"Congratulations! Your account at {email} email has been successfully confirmed."},Notification:{errorNotification:"Your password update failed due to validation errors. Please check your information and try again.",updatePasswordMessage:"The password has been updated.",updatePasswordActionMessage:"Sign in",successPasswordResetEmailNotification:"If there is an account associated with {email} you will receive an email with a link to reset your password.",resendEmailNotification:{informationText:"This account is not confirmed.",buttonText:"Resend confirmation email"},emailConfirmationMessage:"Please check your email for confirmation link.",technicalErrors:{technicalErrorSendEmail:"A technical error occurred while trying to send the email. Please try again later."}},SuccessNotification:{headingText:"Welcome!",messageText:"We are glad to see you!",primaryButtonText:"Continue shopping",secondaryButtonText:"Logout"},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."},InputPassword:{placeholder:"Password",floatingLabel:"Password *"}},b={Auth:w},y={default:b},P=({children:n})=>{var r,t;const[e,i]=u("en_US"),c=(t=(r=g)==null?void 0:r.getConfig())==null?void 0:t.langDefinitions;f(()=>{const a=p.on("locale",o=>{o!==e&&i(o)},{eager:!0});return()=>{a==null||a.off()}},[e]);const l=d(y,c??{});return s(h,{lang:e,langDefinitions:l,children:n})},k=new m(s(P,{}));export{k as render}; +import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,Render as m}from"@dropins/tools/lib.js";import{useState as u,useEffect as f}from"@dropins/tools/preact-hooks.js";import{UIProvider as h}from"@dropins/tools/components.js";import{events as p}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as g}from"./chunks/initialize.js";const w={PasswordValidationMessage:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long"},ResetPasswordForm:{title:"Reset your password",buttonPrimary:"Reset password",buttonSecondary:"Back to sign in",formAriaLabel:"Reset your password form"},SignInForm:{title:"Sign in",buttonPrimary:"Sign in",buttonSecondary:"Sign up",buttonTertiary:"Forgot password?"},SignUpForm:{title:"Sign up",buttonPrimary:"Create account",buttonSecondary:"Already a member? Sign in",privacyPolicyDefaultText:"I’ve read and accept the Terms of Use and Privacy Policy.",subscribedDefaultText:"Subscribe to our newsletter and be the first to know about new arrivals, sales and exclusive offers.",keepMeLoggedText:"Keep me logged in after account creation",failedCreateCustomerAddress:"Failed to create customer addresses:",confirmPassword:{placeholder:"Confirm password",floatingLabel:"Confirm password *",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical."}},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},FormText:{requiredFieldError:"This is a required field.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",dateMaxError:"Date must be less than or equal to {max}.",dateMinError:"Date must be greater than or equal to {min}.",urlError:"Please enter a valid URL, e.g., https://www.website.com.",lengthTextError:"Text length must be between {min} and {max} characters."},EmailConfirmationForm:{title:"Verify your email address",subtitle:"We`ve sent an email to",mainText:"Check your inbox and click on the link we just send you to confirm your email address and activate your account.",buttonSecondary:"Resend email",buttonPrimary:"Close",accountConfirmMessage:"Account confirmed",accountConfirmationEmailSuccessMessage:"Congratulations! Your account at {email} email has been successfully confirmed."},Notification:{errorNotification:"Your password update failed due to validation errors. Please check your information and try again.",updatePasswordMessage:"The password has been updated.",updatePasswordActionMessage:"Sign in",successPasswordResetEmailNotification:"If there is an account associated with {email} you will receive an email with a link to reset your password.",resendEmailNotification:{informationText:"This account is not confirmed.",buttonText:"Resend confirmation email"},emailConfirmationMessage:"Please check your email for confirmation link.",technicalErrors:{technicalErrorSendEmail:"A technical error occurred while trying to send the email. Please try again later."}},SuccessNotification:{headingText:"Welcome!",messageText:"We are glad to see you!",primaryButtonText:"Continue shopping",secondaryButtonText:"Logout"},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."},InputPassword:{placeholder:"Password",floatingLabel:"Password *"}},b={Auth:w},y={default:b},P=({children:n})=>{var r,t;const[e,i]=u("en_US"),c=(t=(r=g)==null?void 0:r.getConfig())==null?void 0:t.langDefinitions;f(()=>{const a=p.on("locale",o=>{o!==e&&i(o)},{eager:!0});return()=>{a==null||a.off()}},[e]);const l=d(y,c??{});return s(h,{lang:e,langDefinitions:l,children:n})},k=new m(s(P,{}));export{k as render};