@dropins/storefront-auth 0.0.1-alpha20 → 0.0.1-alpha21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{jsxs as c,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as C}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as y}from"./resendConfirmationEmail.js";import{useState as x,useCallback as E}from"@dropins/tools/preact-hooks.js";import{useText as u}from"@dropins/tools/i18n.js";import{T as F,B as f}from"./useInLineAlert.js";const p=({userEmail:e,handleSetInLineAlertProps:a})=>{const i=u({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[l,r]=x(!1);return{handleEmailConfirmation:E(async()=>{var o,m;if(r(!0),e){const t=await y(e);if(t){const d=(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;a(d?{type:"error",text:i.technicalErrorSendEmail}:{type:h?"success":"error",text:i.emailConfirmationMessage})}}r(!1)},[a,i,e]),disabledButton:l}},M=({formSize:e,userEmail:a,inLineAlertProps:i,hideCloseBtnOnEmailConfirmation:l,handleSetInLineAlertProps:r,onPrimaryButtonClick:s})=>{const o=u({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:m,disabledButton:t}=p({userEmail:a,handleSetInLineAlertProps:r});return c("div",{className:b(["auth-emailConfirmationForm",e]),children:[i.text?n(C,{className:"auth-signInForm__notification",type:i.type,variant:"secondary",heading:i.text,icon:i.icon,"data-testid":"authInLineAlert"}):null,n(F,{text:o.title,bottomLine:!1,className:"auth-emailConfirmationForm__title"}),a!=null&&a.length?n("span",{className:"auth-emailConfirmationForm__subtitle",children:`${o.subtitle} ${a}`}):null,n("span",{className:"auth-emailConfirmationForm__text",children:o.mainText}),c("div",{className:"auth-emailConfirmationForm-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{M as E};
1
+ import{jsxs as c,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as C,Header as y}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as x}from"./resendConfirmationEmail.js";import{useState as E,useCallback as F}from"@dropins/tools/preact-hooks.js";import{useText as d}from"@dropins/tools/i18n.js";import{B as f}from"./useInLineAlert.js";const p=({userEmail:r,handleSetInLineAlertProps:a})=>{const i=d({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[l,e]=E(!1);return{handleEmailConfirmation:F(async()=>{var o,m;if(e(!0),r){const t=await x(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;a(u?{type:"error",text:i.technicalErrorSendEmail}:{type:h?"success":"error",text:i.emailConfirmationMessage})}}e(!1)},[a,i,r]),disabledButton:l}},M=({formSize:r,userEmail:a,inLineAlertProps:i,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}=p({userEmail:a,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-emailConfirmationForm",r]),children:[i.text?n(C,{className:"auth-signInForm__notification",type:i.type,variant:"secondary",heading:i.text,icon:i.icon,"data-testid":"authInLineAlert"}):null,n(y,{title:o.title,divider:!1,className:"auth-emailConfirmationForm__title"}),a!=null&&a.length?n("span",{className:"auth-emailConfirmationForm__subtitle",children:`${o.subtitle} ${a}`}):null,n("span",{className:"auth-emailConfirmationForm__text",children:o.mainText}),c("div",{className:"auth-emailConfirmationForm-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{M as E};
@@ -1 +1 @@
1
- import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as p}from"./requestPasswordResetEmail.js";import{g as b,c as w,u as _,T as h,F as x,B as g}from"./useInLineAlert.js";import{useState as N,useCallback as y}from"@dropins/tools/preact-hooks.js";import{useText as P}from"@dropins/tools/i18n.js";import{InLineAlert as T}from"@dropins/tools/components.js";import{s as v,D as E}from"./simplifyTransformAttributesForm.js";import*as F from"@dropins/tools/preact-compat.js";const L=t=>F.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},F.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:i,handleSetInLineAlertProps:s})=>{const c=P({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[m,e]=N(!1),d=y(async u=>{u.preventDefault(),e(!0);const r=b(u.target);if(r&&r.email){const f=await p(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=y(()=>{if(w(i)){i("signInForm");return}w(t)&&(window.location.href=t())},[i,t]);return{isLoading:m,submitResetPassword:d,redirectToSignInPage:n}},A=({formSize:t="default",routeSignIn:a,setActiveComponent:i,onErrorCallback:s,...c})=>{const m=P({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=_(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:r}=D({routeSignIn:a,setActiveComponent:i,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...c,className:R(["auth-resetPasswordForm",t]),"data-testid":"resetPasswordForm",children:[o(h,{text:m.title,bottomLine:!1,className:"auth-resetPasswordForm__title"}),e.text?o(T,{className:"auth-resetPasswordForm__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(x,{name:"resetPassword_form",className:"auth-resetPasswordForm__form",submitCallback:u,isLoading:n,fieldsConfig:v(E),children:l("div",{className:"auth-resetPasswordForm__buttons",children:[o(g,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(L,{style:{transform:"rotate(90deg)"}}),buttonText:m.buttonSecondary,enableLoader:!1,onClick:r}),o(g,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{A as R};
1
+ import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as p}from"./requestPasswordResetEmail.js";import{g as b,c as w,u as _,F as h,B as g}from"./useInLineAlert.js";import{useState as x,useCallback as y}from"@dropins/tools/preact-hooks.js";import{useText as P}from"@dropins/tools/i18n.js";import{Header as v,InLineAlert as N}from"@dropins/tools/components.js";import{s as E,D as T}from"./simplifyTransformAttributesForm.js";import*as F from"@dropins/tools/preact-compat.js";const D=t=>F.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},F.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=P({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[m,e]=x(!1),d=y(async u=>{u.preventDefault(),e(!0);const r=b(u.target);if(r&&r.email){const f=await p(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=y(()=>{if(w(i)){i("signInForm");return}w(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=P({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=_(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:r}=L({routeSignIn:a,setActiveComponent:i,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...c,className:R(["auth-resetPasswordForm",t]),"data-testid":"resetPasswordForm",children:[o(v,{title:m.title,divider:!1,className:"auth-resetPasswordForm__title"}),e.text?o(N,{className:"auth-resetPasswordForm__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(h,{name:"resetPassword_form",className:"auth-resetPasswordForm__form",submitCallback:u,isLoading:n,fieldsConfig:E(T),children:l("div",{className:"auth-resetPasswordForm__buttons",children:[o(g,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(D,{style:{transform:"rotate(90deg)"}}),buttonText:m.buttonSecondary,enableLoader:!1,onClick:r}),o(g,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{z as R};
@@ -1 +1 @@
1
- import{jsx as u,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as z}from"@dropins/tools/lib.js";import{g as V,c as F,u as O,T as R,F as tt,B as q}from"./useInLineAlert.js";import{useState as g,useCallback as E,useEffect as Q,useMemo as at}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as rt}from"./getCustomerToken.js";import{r as ot}from"./resendConfirmationEmail.js";import{s as st,a as et}from"./simplifyTransformAttributesForm.js";import{c as it}from"./confirmEmail.js";import{useText as W}from"@dropins/tools/i18n.js";import{InLineAlert as nt,InputPassword as mt}from"@dropins/tools/components.js";import{E as ct}from"./EmailConfirmationForm.js";const ut=({emailConfirmationStatusMessage:t,translations:r,initialEmailValue:e,routeSignUp:d,routeForgotPassword:m,routeRedirectOnSignIn:_,onErrorCallback:w,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:o,routeRedirectOnEmailConfirmationClose:b})=>{const[A,P]=g(""),[L,n]=g(!1),[C,l]=g(""),[T,y]=g(!1),[M,S]=g({userName:"",status:!1}),[B,I]=g(!1),[x,N]=g([]),p=E(async i=>{o(),n(!0),y(!1),N([]),await ot(i)},[o]),U=E(i=>{i.length?y(!1):y(!0),l(i)},[]);Q(()=>{t!=null&&t.text&&o({text:t.text,type:t.status?t.status:void 0})},[t,o]);const v=E(async i=>{var H;o(),I(!0);const c=V(i.target);if(c.password||(y(!0),I(!1)),c!=null&&c.email&&(c!=null&&c.password)){const{email:K,password:Y}=c,s=await rt({email:K,password:Y,handleSetInLineAlertProps:o,onErrorCallback:w,translations:r});if((H=s==null?void 0:s.errorMessage)!=null&&H.length){P(K);const J=s.errorMessage.includes("This account isn't confirmed. Verify and try again."),Z=J?r.resendEmailInformationText:s.errorMessage;N(J?[{label:r.resendEmailButtonText,onClick:()=>{p(K)}}]:[]),o({text:Z,type:"error"}),l("")}s!=null&&s.userName&&(i.target.reset(),F(_)?window.location.href=_():(f==null||f({userName:s==null?void 0:s.userName,status:!0}),S({userName:s==null?void 0:s.userName,status:!0}))),y(!1)}I(!1)},[o,w,r,p,_,f]),j=E(()=>{if(F(a)){a("resetPasswordForm");return}F(m)&&(window.location.href=m())},[m,a]),D=E(()=>{if(F(h)&&h(),F(a)){a("signUpForm");return}F(d)&&(window.location.href=d())},[h,d,a]),G=at(()=>{const i=st(et);return e!=null&&e.length?i==null?void 0:i.map(c=>({...c,defaultValue:e})):i},[e]),X=E(()=>{o(),F(b)?window.location.href=b():n(!1)},[o,b]);return{additionalActionsAlert:x,userEmail:A,defaultEnhancedEmailFields:G,passwordError:T,isSuccessful:M,isLoading:B,signInPasswordValue:C,showEmailConfirmationForm:L,setShowEmailConfirmationForm:n,setSignInPasswordValue:l,submitLogInUser:v,forgotPasswordCallback:j,onSignUpLinkClickCallback:D,handledOnPrimaryButtonClick:X,handleSetPassword:U}},ft=()=>{let t=new URL(window.location.href),r=t.searchParams.get("email"),e=t.searchParams.get("key");r&&e&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},lt=({enableEmailConfirmation:t})=>{const r=W({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[e,d]=g({text:"",status:""});return Q(()=>{if(t){const{search:m}=window.location;m.includes("email=")&&m.includes("key=")&&(async()=>{var f,h,o;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?d({text:a==null?void 0:a.errors[0].message,status:"error"}):(d({text:a.data.confirmEmail.customer.email?r.accountConfirmationEmailSuccessMessage.replace("{email}",(o=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:o.email):r.accountConfirmMessage,status:"success"}),ft())})()}},[t,r]),{emailConfirmationStatusMessage:e}},pt=({slots:t,labels:r,formSize:e="default",initialEmailValue:d="",renderSignUpLink:m=!1,enableEmailConfirmation:_=!1,hideCloseBtnOnEmailConfirmation:w=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:o,onSuccessCallback:b,setActiveComponent:A,onErrorCallback:P,onSignUpLinkClick:L})=>{const n=W({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"}),{emailConfirmationStatusMessage:C}=lt({enableEmailConfirmation:_}),{inLineAlertProps:l,handleSetInLineAlertProps:T}=O(),{userEmail:y,additionalActionsAlert:M,defaultEnhancedEmailFields:S,passwordError:B,isSuccessful:I,isLoading:x,signInPasswordValue:N,showEmailConfirmationForm:p,submitLogInUser:U,forgotPasswordCallback:v,onSignUpLinkClickCallback:j,handledOnPrimaryButtonClick:D,handleSetPassword:G}=ut({translations:n,emailConfirmationStatusMessage:C,initialEmailValue:d,routeSignUp:o,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:A,onErrorCallback:P,onSuccessCallback:b,onSignUpLinkClick:L,handleSetInLineAlertProps:T,routeRedirectOnEmailConfirmationClose:a});return I.status&&(t!=null&&t.SuccessNotification)?u($,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:I}}):p?u(ct,{formSize:e,userEmail:y,inLineAlertProps:l,hideCloseBtnOnEmailConfirmation:w,handleSetInLineAlertProps:T,onPrimaryButtonClick:D}):k("div",{className:z(["auth-signInForm",e]),"data-testid":"signInForm",children:[u(R,{text:(r==null?void 0:r.formTitleText)??n.title,bottomLine:!1,className:"auth-signInForm__title"}),l.text?u(nt,{"data-testid":"authInLineAlert",className:"auth-signInForm__notification",type:l.type,variant:"secondary",heading:l.text,icon:l.icon,additionalActions:M}):null,k(tt,{name:"signIn_form",className:"auth-signInForm__form",submitCallback:U,isLoading:x,fieldsConfig:S,children:[u(mt,{hideStatusIndicator:!0,className:"auth-signInForm__form__password",autoComplete:"current-password",error:B,defaultValue:N,onValue:G,placeholder:n.placeholder,floatingLabel:n.floatingLabel}),k("div",{className:"auth-signInForm__form__buttons",children:[k("div",{className:"auth-signInForm__form__buttons--combine",children:[u(q,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonTertiary,className:"auth-signInForm__button auth-signInForm__button--forgot",enableLoader:!1,onClick:v,"data-testid":"switchToSignUp"}),m?u("span",{}):null,m?u(q,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,className:"auth-signInForm__button auth-signInForm__button--signup",enableLoader:!1,onClick:j}):null]}),u(q,{type:"submit",buttonText:(r==null?void 0:r.primaryButtonText)??n.buttonPrimary,variant:"primary",className:"auth-signInForm__button auth-signInForm__button--submit",enableLoader:x})]})]}),u("div",{id:"generateCustomerToken"})]})};export{pt as S};
1
+ import{jsx as u,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as z}from"@dropins/tools/lib.js";import{g as V,c as F,u as O,F as R,B as K}from"./useInLineAlert.js";import{useState as g,useCallback as E,useEffect as Q,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 st,a as ot}from"./simplifyTransformAttributesForm.js";import{c as et}from"./confirmEmail.js";import{useText as W}from"@dropins/tools/i18n.js";import{Header as it,InLineAlert as nt,InputPassword as ct}from"@dropins/tools/components.js";import{E as mt}from"./EmailConfirmationForm.js";const ut=({emailConfirmationStatusMessage:t,translations:r,initialEmailValue:e,routeSignUp:l,routeForgotPassword:c,routeRedirectOnSignIn:_,onErrorCallback:w,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:s,routeRedirectOnEmailConfirmationClose:b})=>{const[A,P]=g(""),[L,n]=g(!1),[C,d]=g(""),[x,y]=g(!1),[M,S]=g({userName:"",status:!1}),[B,I]=g(!1),[T,N]=g([]),p=E(async i=>{s(),n(!0),y(!1),N([]),await rt(i)},[s]),U=E(i=>{i.length?y(!1):y(!0),d(i)},[]);Q(()=>{t!=null&&t.text&&s({text:t.text,type:t.status?t.status:void 0})},[t,s]);const v=E(async i=>{var q;s(),I(!0);const m=V(i.target);if(m.password||(y(!0),I(!1)),m!=null&&m.email&&(m!=null&&m.password)){const{email:H,password:Y}=m,o=await at({email:H,password:Y,handleSetInLineAlertProps:s,onErrorCallback:w,translations:r});if((q=o==null?void 0:o.errorMessage)!=null&&q.length){P(H);const J=o.errorMessage.includes("This account isn't confirmed. Verify and try again."),Z=J?r.resendEmailInformationText:o.errorMessage;N(J?[{label:r.resendEmailButtonText,onClick:()=>{p(H)}}]:[]),s({text:Z,type:"error"}),d("")}o!=null&&o.userName&&(i.target.reset(),F(_)?window.location.href=_():(f==null||f({userName:o==null?void 0:o.userName,status:!0}),S({userName:o==null?void 0:o.userName,status:!0}))),y(!1)}I(!1)},[s,w,r,p,_,f]),j=E(()=>{if(F(a)){a("resetPasswordForm");return}F(c)&&(window.location.href=c())},[c,a]),D=E(()=>{if(F(h)&&h(),F(a)){a("signUpForm");return}F(l)&&(window.location.href=l())},[h,l,a]),G=tt(()=>{const i=st(ot);return e!=null&&e.length?i==null?void 0:i.map(m=>({...m,defaultValue:e})):i},[e]),X=E(()=>{s(),F(b)?window.location.href=b():n(!1)},[s,b]);return{additionalActionsAlert:T,userEmail:A,defaultEnhancedEmailFields:G,passwordError:x,isSuccessful:M,isLoading:B,signInPasswordValue:C,showEmailConfirmationForm:L,setShowEmailConfirmationForm:n,setSignInPasswordValue:d,submitLogInUser:v,forgotPasswordCallback:j,onSignUpLinkClickCallback:D,handledOnPrimaryButtonClick:X,handleSetPassword:U}},ft=()=>{let t=new URL(window.location.href),r=t.searchParams.get("email"),e=t.searchParams.get("key");r&&e&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},dt=({enableEmailConfirmation:t})=>{const r=W({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[e,l]=g({text:"",status:""});return Q(()=>{if(t){const{search:c}=window.location;c.includes("email=")&&c.includes("key=")&&(async()=>{var f,h,s;const w=new URLSearchParams(c),a=await et({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}",(s=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:s.email):r.accountConfirmMessage,status:"success"}),ft())})()}},[t,r]),{emailConfirmationStatusMessage:e}},pt=({slots:t,labels:r,formSize:e="default",initialEmailValue:l="",renderSignUpLink:c=!1,enableEmailConfirmation:_=!1,hideCloseBtnOnEmailConfirmation:w=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:s,onSuccessCallback:b,setActiveComponent:A,onErrorCallback:P,onSignUpLinkClick:L})=>{const n=W({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"}),{emailConfirmationStatusMessage:C}=dt({enableEmailConfirmation:_}),{inLineAlertProps:d,handleSetInLineAlertProps:x}=O(),{userEmail:y,additionalActionsAlert:M,defaultEnhancedEmailFields:S,passwordError:B,isSuccessful:I,isLoading:T,signInPasswordValue:N,showEmailConfirmationForm:p,submitLogInUser:U,forgotPasswordCallback:v,onSignUpLinkClickCallback:j,handledOnPrimaryButtonClick:D,handleSetPassword:G}=ut({translations:n,emailConfirmationStatusMessage:C,initialEmailValue:l,routeSignUp:s,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:A,onErrorCallback:P,onSuccessCallback:b,onSignUpLinkClick:L,handleSetInLineAlertProps:x,routeRedirectOnEmailConfirmationClose:a});return I.status&&(t!=null&&t.SuccessNotification)?u($,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:I}}):p?u(mt,{formSize:e,userEmail:y,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:w,handleSetInLineAlertProps:x,onPrimaryButtonClick:D}):k("div",{className:z(["auth-signInForm",e]),"data-testid":"signInForm",children:[u(it,{title:(r==null?void 0:r.formTitleText)??n.title,divider:!1,className:"auth-signInForm__title"}),d.text?u(nt,{"data-testid":"authInLineAlert",className:"auth-signInForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:M}):null,k(R,{name:"signIn_form",className:"auth-signInForm__form",submitCallback:U,isLoading:T,fieldsConfig:S,children:[u(ct,{hideStatusIndicator:!0,className:"auth-signInForm__form__password",autoComplete:"current-password",error:B,defaultValue:N,onValue:G,placeholder:n.placeholder,floatingLabel:n.floatingLabel}),k("div",{className:"auth-signInForm__form__buttons",children:[k("div",{className:"auth-signInForm__form__buttons--combine",children:[u(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonTertiary,className:"auth-signInForm__button auth-signInForm__button--forgot",enableLoader:!1,onClick:v,"data-testid":"switchToSignUp"}),c?u("span",{}):null,c?u(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,className:"auth-signInForm__button auth-signInForm__button--signup",enableLoader:!1,onClick:j}):null]}),u(K,{type:"submit",buttonText:(r==null?void 0:r.primaryButtonText)??n.buttonPrimary,variant:"primary",className:"auth-signInForm__button auth-signInForm__button--submit",enableLoader:T})]})]}),u("div",{id:"generateCustomerToken"})]})};export{pt as S};
@@ -1 +1 @@
1
- import{jsx as i,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as ce,classes as le}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as fe,c as de,a as ge}from"./createCustomerAddress.js";import{useState as b,useEffect as he,useCallback as G}from"@dropins/tools/preact-hooks.js";import{s as ee,b as pe,c as Fe}from"./simplifyTransformAttributesForm.js";import{v as Ue,u as be,a as ye}from"./usePasswordValidationMessage.js";import{a as _e}from"./getCustomerToken.js";import{p as te,E as re}from"./getStoreConfig.js";import{c as H,g as Te,u as Ne,T as Le,F as xe,B as ie}from"./useInLineAlert.js";import{InLineAlert as Pe,InputPassword as Ee,Field as Q,Checkbox as X}from"@dropins/tools/components.js";import{S as Se}from"./SkeletonLoader.js";import{E as we}from"./EmailConfirmationForm.js";import{useText as ve}from"@dropins/tools/i18n.js";const se=(e,t)=>t!=null&&t.length?e.map(s=>{var r;const a=(r=t.find(({code:y})=>y===s.code))==null?void 0:r.defaultValue;return a?{...s,defaultValue:a}:s}):e,Me=({inputsDefaultValueSet:e,fieldsConfigForApiVersion1:t,apiVersion2:s})=>{const[a,r]=b([]);return he(()=>{(async()=>{if(s){const u=await fe("customer_account_create");if(u!=null&&u.length)if(e!=null&&e.length){const m=se(u,e);r(m)}else r(u)}else{const u=ee(pe),m=ee(t),h=se(u,e);r(t&&t.length?m:h)}})()},[s,t,e]),{fieldsListConfigs:a}},Ae=e=>{switch(e){case"true":case"on":return!0;case"false":case"off":return!1;default:return e}},qe=(e,t)=>{if(!t)return e;const s={};s.custom_attributes=[];for(const a in e)Object.prototype.hasOwnProperty.call(Fe,a)?s[a]=e[a]:s.custom_attributes.push({attribute_code:a,value:Ae(e[a])});return s},Ce=({addressesData:e,translations:t,isEmailConfirmationRequired:s,apiVersion2:a=!0,passwordConfigs:r,isAutoSignInEnabled:y,routeRedirectOnSignIn:u,routeSignIn:m,onErrorCallback:h,onSuccessCallback:n,setActiveComponent:l,handleSetInLineAlertProps:f,routeRedirectOnEmailConfirmationClose:x})=>{const[O,w]=b(""),[p,o]=b(!1),[c,T]=b({userName:"",status:!1}),[v,d]=b(""),[M,A]=b(!1),[V,F]=b(!1),[q,C]=b(!0),P=G(({target:U})=>{C(U.checked)},[]),I=G(()=>{if(H(l)){l("signInForm");return}H(m)&&(window.location.href=m())},[l,m]),W=G(U=>{d(U)},[]),j=G(()=>{f(),d(""),H(x)?window.location.href=x():(o(!1),l==null||l("signInForm"))},[f,x,l]);return{isKeepMeLogged:q,userEmail:O,showEmailConfirmationForm:p,isSuccessful:c,isClickSubmit:M,signUpPasswordValue:v,isLoading:V,onSubmitSignUp:async(U,$)=>{var Z,z,D;if(f(),F(!0),!$){A(!0),F(!1);return}const B=a?"createCustomerV2":"createCustomer",_=Te(U.target),{email:E,password:S,is_subscribed:ae}=_,oe=(r==null?void 0:r.requiredCharacterClasses)||0,ue=(r==null?void 0:r.minLength)||1;if(!Ue(S,oe)||ue>(S==null?void 0:S.length)){A(!0),F(!1);return}const ne=qe({..._,is_subscribed:!!ae||!1},a),{data:N,errors:L}=await de(ne,a),K=((z=(Z=N==null?void 0:N.createCustomer)==null?void 0:Z.customer)==null?void 0:z.firstname)||"";if(L&&(L!=null&&L.length))f==null||f({type:"error",text:L[0].message}),h==null||h(L),te(re.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),w(E);else{const J={email:"",...N==null?void 0:N[B]};if(te(re.CREATE_ACCOUNT_EVENT,{email:J==null?void 0:J.email,updateProfile:!0}),s||!y){if(n==null||n({userName:K,status:!0}),s){(D=U.target)==null||D.reset(),d(""),o(!0),w(E),F(!1);return}if(!y){F(!1),T({userName:K,status:!0});return}}const g=await _e({email:E,password:S,translations:t,handleSetInLineAlertProps:f,onErrorCallback:h});if(g!=null&&g.userName){if(e!=null&&e.length)for(const R of e)try{await ge(R)}catch(me){console.error(t.failedCreateCustomerAddress,R,me)}H(u)?window.location.href=u():(n==null||n({userName:g==null?void 0:g.userName,status:!0}),T({userName:g==null?void 0:g.userName,status:!0}))}else n==null||n({userName:K,status:!0}),T({userName:K,status:!0})}F(!1)},signInButton:I,handleSetSignUpPasswordValue:W,onKeepMeLoggedChange:P,handleHideEmailConfirmationForm:j}},Ze=({addressesData:e,formSize:t="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:a,apiVersion2:r=!0,isAutoSignInEnabled:y=!0,displayTermsOfUseCheckbox:u=!1,displayNewsletterCheckbox:m=!1,hideCloseBtnOnEmailConfirmation:h=!1,routeRedirectOnEmailConfirmationClose:n,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,slots:p})=>{const o=ve({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"}),{passwordConfigs:c,isEmailConfirmationRequired:T}=be(),{fieldsListConfigs:v}=Me({fieldsConfigForApiVersion1:a,apiVersion2:r,inputsDefaultValueSet:s}),{inLineAlertProps:d,handleSetInLineAlertProps:M}=Ne(),{isKeepMeLogged:A,userEmail:V,showEmailConfirmationForm:F,isSuccessful:q,isClickSubmit:C,signUpPasswordValue:P,isLoading:I,onSubmitSignUp:W,signInButton:j,handleSetSignUpPasswordValue:Y,onKeepMeLoggedChange:U,handleHideEmailConfirmationForm:$}=Ce({addressesData:e,translations:o,isEmailConfirmationRequired:T,apiVersion2:r,passwordConfigs:c,isAutoSignInEnabled:y,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,handleSetInLineAlertProps:M,routeRedirectOnEmailConfirmationClose:n}),{isValidUniqueSymbols:B,defaultLengthMessage:_}=ye({password:P,isClickSubmit:C,passwordConfigs:c}),E=!T&&(e==null?void 0:e.length);return!v.length&&r?i("div",{className:`auth-signUpForm ${t} skeleton-loader`,"data-testid":"SignUpForm",children:i(Se,{activeSkeleton:"signUpForm"})}):q.status&&(p!=null&&p.SuccessNotification)?i(ce,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:p==null?void 0:p.SuccessNotification,context:{isSuccessful:q}}):F?i(we,{formSize:t,userEmail:V,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:h,handleSetInLineAlertProps:M,onPrimaryButtonClick:$}):k("div",{className:le(["auth-signUpForm",t]),"data-testid":"SignUpForm",children:[i(Le,{text:o.title,bottomLine:!1,className:"auth-signUpForm__title"}),d.text?i(Pe,{className:"auth-signUpForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon}):null,k(xe,{submitCallback:W,className:"auth-signUpForm__form",isLoading:I,name:"signUp_form",fieldsConfig:v,children:[i(Ee,{validateLengthConfig:_,className:"auth-signUpForm__form__field",autoComplete:"current-password",name:"password",minLength:c==null?void 0:c.minLength,error:B==="error"||(_==null?void 0:_.status)==="error"||C&&P.length<=0,defaultValue:P,uniqueSymbolsStatus:B,requiredCharacterClasses:c==null?void 0:c.requiredCharacterClasses,onValue:Y,placeholder:o.placeholder,floatingLabel:o.floatingLabel,children:E?i("div",{className:"auth-signUpForm__automatic-login",children:i(Q,{children:i(X,{name:"",placeholder:o.keepMeLoggedText,label:o.keepMeLoggedText,checked:A,onChange:U})})}):null}),m||u?k("div",{className:"auth-signUpForm__item auth-signUpForm__checkbox",children:[m?i(Q,{children:i(X,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:o.subscribedDefaultText,label:o.subscribedDefaultText})}):null,u?i(Q,{children:i(X,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:o.privacyPolicyDefaultText,label:o.privacyPolicyDefaultText})}):null]}):null,k("div",{className:"auth-signUpForm-buttons",children:[i(ie,{type:"button",variant:"tertiary",style:{padding:0},buttonText:o.buttonSecondary,enableLoader:!1,onClick:j}),i(ie,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:I})]})]}),i("div",{id:"createCustomerV2"})]})};export{Ze as S};
1
+ import{jsx as i,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as ce,classes as le}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as fe,c as de,a as ge}from"./createCustomerAddress.js";import{useState as y,useEffect as he,useCallback as G}from"@dropins/tools/preact-hooks.js";import{s as ee,b as pe,c as Fe}from"./simplifyTransformAttributesForm.js";import{v as Ue,u as ye,a as be}from"./usePasswordValidationMessage.js";import{a as _e}from"./getCustomerToken.js";import{p as te,E as re}from"./getStoreConfig.js";import{c as H,g as Ne,u as Te,F as Le,B as ie}from"./useInLineAlert.js";import{Header as xe,InLineAlert as Pe,InputPassword as Ee,Field as Q,Checkbox as X}from"@dropins/tools/components.js";import{S as Se}from"./SkeletonLoader.js";import{E as we}from"./EmailConfirmationForm.js";import{useText as ve}from"@dropins/tools/i18n.js";const se=(e,t)=>t!=null&&t.length?e.map(s=>{var r;const a=(r=t.find(({code:b})=>b===s.code))==null?void 0:r.defaultValue;return a?{...s,defaultValue:a}:s}):e,Me=({inputsDefaultValueSet:e,fieldsConfigForApiVersion1:t,apiVersion2:s})=>{const[a,r]=y([]);return he(()=>{(async()=>{if(s){const u=await fe("customer_account_create");if(u!=null&&u.length)if(e!=null&&e.length){const m=se(u,e);r(m)}else r(u)}else{const u=ee(pe),m=ee(t),h=se(u,e);r(t&&t.length?m:h)}})()},[s,t,e]),{fieldsListConfigs:a}},Ae=e=>{switch(e){case"true":case"on":return!0;case"false":case"off":return!1;default:return e}},qe=(e,t)=>{if(!t)return e;const s={};s.custom_attributes=[];for(const a in e)Object.prototype.hasOwnProperty.call(Fe,a)?s[a]=e[a]:s.custom_attributes.push({attribute_code:a,value:Ae(e[a])});return s},Ce=({addressesData:e,translations:t,isEmailConfirmationRequired:s,apiVersion2:a=!0,passwordConfigs:r,isAutoSignInEnabled:b,routeRedirectOnSignIn:u,routeSignIn:m,onErrorCallback:h,onSuccessCallback:n,setActiveComponent:l,handleSetInLineAlertProps:f,routeRedirectOnEmailConfirmationClose:x})=>{const[O,w]=y(""),[p,o]=y(!1),[c,N]=y({userName:"",status:!1}),[v,d]=y(""),[M,A]=y(!1),[V,F]=y(!1),[q,C]=y(!0),P=G(({target:U})=>{C(U.checked)},[]),I=G(()=>{if(H(l)){l("signInForm");return}H(m)&&(window.location.href=m())},[l,m]),W=G(U=>{d(U)},[]),j=G(()=>{f(),d(""),H(x)?window.location.href=x():(o(!1),l==null||l("signInForm"))},[f,x,l]);return{isKeepMeLogged:q,userEmail:O,showEmailConfirmationForm:p,isSuccessful:c,isClickSubmit:M,signUpPasswordValue:v,isLoading:V,onSubmitSignUp:async(U,$)=>{var Z,z,D;if(f(),F(!0),!$){A(!0),F(!1);return}const B=a?"createCustomerV2":"createCustomer",_=Ne(U.target),{email:E,password:S,is_subscribed:ae}=_,oe=(r==null?void 0:r.requiredCharacterClasses)||0,ue=(r==null?void 0:r.minLength)||1;if(!Ue(S,oe)||ue>(S==null?void 0:S.length)){A(!0),F(!1);return}const ne=qe({..._,is_subscribed:!!ae||!1},a),{data:T,errors:L}=await de(ne,a),K=((z=(Z=T==null?void 0:T.createCustomer)==null?void 0:Z.customer)==null?void 0:z.firstname)||"";if(L&&(L!=null&&L.length))f==null||f({type:"error",text:L[0].message}),h==null||h(L),te(re.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),w(E);else{const J={email:"",...T==null?void 0:T[B]};if(te(re.CREATE_ACCOUNT_EVENT,{email:J==null?void 0:J.email,updateProfile:!0}),s||!b){if(n==null||n({userName:K,status:!0}),s){(D=U.target)==null||D.reset(),d(""),o(!0),w(E),F(!1);return}if(!b){F(!1),N({userName:K,status:!0});return}}const g=await _e({email:E,password:S,translations:t,handleSetInLineAlertProps:f,onErrorCallback:h});if(g!=null&&g.userName){if(e!=null&&e.length)for(const R of e)try{await ge(R)}catch(me){console.error(t.failedCreateCustomerAddress,R,me)}H(u)?window.location.href=u():(n==null||n({userName:g==null?void 0:g.userName,status:!0}),N({userName:g==null?void 0:g.userName,status:!0}))}else n==null||n({userName:K,status:!0}),N({userName:K,status:!0})}F(!1)},signInButton:I,handleSetSignUpPasswordValue:W,onKeepMeLoggedChange:P,handleHideEmailConfirmationForm:j}},Ze=({addressesData:e,formSize:t="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:a,apiVersion2:r=!0,isAutoSignInEnabled:b=!0,displayTermsOfUseCheckbox:u=!1,displayNewsletterCheckbox:m=!1,hideCloseBtnOnEmailConfirmation:h=!1,routeRedirectOnEmailConfirmationClose:n,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,slots:p})=>{const o=ve({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"}),{passwordConfigs:c,isEmailConfirmationRequired:N}=ye(),{fieldsListConfigs:v}=Me({fieldsConfigForApiVersion1:a,apiVersion2:r,inputsDefaultValueSet:s}),{inLineAlertProps:d,handleSetInLineAlertProps:M}=Te(),{isKeepMeLogged:A,userEmail:V,showEmailConfirmationForm:F,isSuccessful:q,isClickSubmit:C,signUpPasswordValue:P,isLoading:I,onSubmitSignUp:W,signInButton:j,handleSetSignUpPasswordValue:Y,onKeepMeLoggedChange:U,handleHideEmailConfirmationForm:$}=Ce({addressesData:e,translations:o,isEmailConfirmationRequired:N,apiVersion2:r,passwordConfigs:c,isAutoSignInEnabled:b,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:x,onSuccessCallback:O,setActiveComponent:w,handleSetInLineAlertProps:M,routeRedirectOnEmailConfirmationClose:n}),{isValidUniqueSymbols:B,defaultLengthMessage:_}=be({password:P,isClickSubmit:C,passwordConfigs:c}),E=!N&&(e==null?void 0:e.length);return!v.length&&r?i("div",{className:`auth-signUpForm ${t} skeleton-loader`,"data-testid":"SignUpForm",children:i(Se,{activeSkeleton:"signUpForm"})}):q.status&&(p!=null&&p.SuccessNotification)?i(ce,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:p==null?void 0:p.SuccessNotification,context:{isSuccessful:q}}):F?i(we,{formSize:t,userEmail:V,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:h,handleSetInLineAlertProps:M,onPrimaryButtonClick:$}):k("div",{className:le(["auth-signUpForm",t]),"data-testid":"SignUpForm",children:[i(xe,{title:o.title,divider:!1,className:"auth-signUpForm__title"}),d.text?i(Pe,{className:"auth-signUpForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon}):null,k(Le,{submitCallback:W,className:"auth-signUpForm__form",isLoading:I,name:"signUp_form",fieldsConfig:v,children:[i(Ee,{validateLengthConfig:_,className:"auth-signUpForm__form__field",autoComplete:"current-password",name:"password",minLength:c==null?void 0:c.minLength,error:B==="error"||(_==null?void 0:_.status)==="error"||C&&P.length<=0,defaultValue:P,uniqueSymbolsStatus:B,requiredCharacterClasses:c==null?void 0:c.requiredCharacterClasses,onValue:Y,placeholder:o.placeholder,floatingLabel:o.floatingLabel,children:E?i("div",{className:"auth-signUpForm__automatic-login",children:i(Q,{children:i(X,{name:"",placeholder:o.keepMeLoggedText,label:o.keepMeLoggedText,checked:A,onChange:U})})}):null}),m||u?k("div",{className:"auth-signUpForm__item auth-signUpForm__checkbox",children:[m?i(Q,{children:i(X,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:o.subscribedDefaultText,label:o.subscribedDefaultText})}):null,u?i(Q,{children:i(X,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:o.privacyPolicyDefaultText,label:o.privacyPolicyDefaultText})}):null]}):null,k("div",{className:"auth-signUpForm-buttons",children:[i(ie,{type:"button",variant:"tertiary",style:{padding:0},buttonText:o.buttonSecondary,enableLoader:!1,onClick:j}),i(ie,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:I})]})]}),i("div",{id:"createCustomerV2"})]})};export{Ze as S};
@@ -1 +1 @@
1
- import{FetchGraphQL as t}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 t().getMethods(),m=e=>{throw e instanceof DOMException&&e.name==="AbortError"||r.emit("error",{source:"auth",type:"network",error:e}),e};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s};
1
+ 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};
@@ -1 +1 @@
1
- import{jsxs as v,jsx as d,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{useCallback as D,useRef as g,useState as k,useEffect as V}from"@dropins/tools/preact-hooks.js";import{classes as L}from"@dropins/tools/lib.js";import{Button as R,Field as N,Picker as O,Input as y,InputDate as H,Checkbox as P,TextArea as q}from"@dropins/tools/components.js";import{initReCaptcha as U}from"@dropins/tools/recaptcha.js";import{useText as W}from"@dropins/tools/i18n.js";import*as f from"@dropins/tools/preact-compat.js";import{memo as G,useCallback as _}from"@dropins/tools/preact-compat.js";const te=r=>{if(!r)return null;const c=new FormData(r);if(c&&typeof c.entries=="function"){const u=c.entries();if(u&&typeof u[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(u)))||{}}return{}},ne=r=>typeof r=="function",ae=({type:r,buttonText:c,variant:u,className:l="",enableLoader:o=!1,onClick:s,style:h,icon:a,...p})=>{const I=D(A=>{s==null||s(A)},[s]);return v(R,{icon:a,style:h,type:r,variant:u,className:L(["auth-button",l,o?"enableLoader":""]),onClick:I,...p,children:[d("span",{className:"auth-button__text",children:c}),o?d("div",{className:"auth-button__loader-wrapper",children:d("span",{className:"auth-button__loader"})}):null]})},C=r=>r.reduce((c,{code:u,required:l,defaultValue:o})=>(l&&(c[u]=o),c),{}),F=({fieldsConfig:r,submitCallback:c})=>{const{requiredFieldError:u}=W({requiredFieldError:"Auth.FormText.requiredFieldError"}),l=g(null),o=g(!1),[s,h]=k({}),[a,p]=k({}),I=D(async()=>{o.current||(await U(0),o.current=!0)},[]);V(()=>{if(!r.length)return;const t=C(r);h(t)},[r==null?void 0:r.length]);const $=D((t,n)=>{const E=r.find(i=>i.code===t);return E!=null&&E.required&&!n?u:""},[r,u]),A=D(t=>{const{name:n,value:E,type:T,checked:i}=t==null?void 0:t.target,M=T==="checkbox"?i:E;h(b=>({...b,[n]:M}))},[]),x=D(t=>{const{name:n,value:E,type:T,checked:i}=t==null?void 0:t.target,M=T==="checkbox"?i:E;p(b=>({...b,[n]:$(n,M)}))},[$]),e=D(t=>{t.preventDefault();let n=!0,E={},T=null;for(const[i,M]of Object.entries(s)){const b=$(i,M);b&&(E[i]=b,n=!1,T||(T=i))}if(p(E),T&&l.current){const i=l.current.elements.namedItem(T);i==null||i.focus()}c==null||c(t,n)},[s,$,c]);return{formData:s,errors:a,formRef:l,handleChange:A,handleBlur:x,handleSubmit:e,handleFocus:I}};var w=(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))(w||{});const Z=G(({loading:r,values:c,fields:u=[],errors:l,className:o="",onChange:s,onBlur:h})=>{const a=`${o}__field`,p=_((e,t,n)=>d(N,{error:n,className:L([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(O,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options.map(E=>({...E,text:E.label})),onBlur:h,handleSelect:s,value:t||e.defaultValue})},e.id),[o,r,a,h,s]),I=_((e,t,n)=>d(N,{error:n,className:L([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(y,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:s})},e.id),[o,r,a,h,s]),$=_((e,t,n)=>d(N,{error:n,className:L([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(H,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:s})},e.id),[o,r,a,h,s]),A=_((e,t,n)=>d(N,{error:n,className:L([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(P,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:s})},e.id),[o,r,a,h,s]),x=_((e,t,n)=>d(N,{error:n,className:L([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(q,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:s})},e.id),[o,r,a,h,s]);return u.length?d(S,{children:u.map(e=>{const t=(l==null?void 0:l[e.id])??void 0,n=(c==null?void 0:c[e.id])??void 0;switch(e.fieldType){case w.TEXT:return e.options.length?p(e,n,t):I(e,n,t);case w.MULTILINE:return I(e,n,t);case w.SELECT:return p(e,n,t);case w.DATE:return $(e,n,t);case w.BOOLEAN:return A(e,n,t);case"TEXTAREA":return x(e,n,t);default:return null}})}):null}),ce=({name:r,isLoading:c,children:u,className:l="defaultForm",fieldsConfig:o=[],submitCallback:s})=>{const{formData:h,errors:a,formRef:p,handleChange:I,handleBlur:$,handleSubmit:A,handleFocus:x}=F({submitCallback:s,fieldsConfig:o});return v("form",{onSubmit:A,className:l,name:r,ref:p,onFocus:x,children:[d(Z,{fields:o,onChange:I,onBlur:$,errors:a,values:h,className:l,isLoading:c}),u]})},oe=({children:r,text:c,bottomLine:u=!0,className:l})=>v("div",{className:L(["auth-title",l]),"data-testid":"auth-title_id",children:[v("div",{className:"auth-title__text",children:[d("h1",{className:"auth-title__heading",children:c}),r]}),u?d("div",{className:"auth-title__hr"}):null]}),B=r=>f.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},f.createElement("g",{clipPath:"url(#clip0_841_1324)"},f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),f.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"})),f.createElement("defs",null,f.createElement("clipPath",{id:"clip0_841_1324"},f.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),X=r=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},f.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"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),j=r=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},f.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"}),f.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"})),Y={success:d(X,{}),warning:d(B,{}),error:d(j,{})},le=()=>{const[r,c]=k({}),u=D(l=>{if(!l||!l.type){c({});return}const o=Y[l.type];c({...l,icon:o})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:u}};export{ae as B,ce as F,oe as T,ne as c,te as g,le as u};
1
+ import{jsxs as S,jsx as d,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{useCallback as D,useRef as v,useState as N,useEffect as R}from"@dropins/tools/preact-hooks.js";import{classes as b}from"@dropins/tools/lib.js";import{Button as _,Field as k,Picker as O,Input as y,InputDate as H,Checkbox as P,TextArea as q}from"@dropins/tools/components.js";import{initReCaptcha as U}from"@dropins/tools/recaptcha.js";import{useText as W}from"@dropins/tools/i18n.js";import*as p from"@dropins/tools/preact-compat.js";import{memo as G,useCallback as g}from"@dropins/tools/preact-compat.js";const te=r=>{if(!r)return null;const c=new FormData(r);if(c&&typeof c.entries=="function"){const u=c.entries();if(u&&typeof u[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(u)))||{}}return{}},ne=r=>typeof r=="function",ae=({type:r,buttonText:c,variant:u,className:s="",enableLoader:o=!1,onClick:l,style:h,icon:a,...i})=>{const T=D(A=>{l==null||l(A)},[l]);return S(_,{icon:a,style:h,type:r,variant:u,className:b(["auth-button",s,o?"enableLoader":""]),onClick:T,...i,children:[d("span",{className:"auth-button__text",children:c}),o?d("div",{className:"auth-button__loader-wrapper",children:d("span",{className:"auth-button__loader"})}):null]})},C=r=>r.reduce((c,{code:u,required:s,defaultValue:o})=>(s&&(c[u]=o),c),{}),F=({fieldsConfig:r,submitCallback:c})=>{const{requiredFieldError:u}=W({requiredFieldError:"Auth.FormText.requiredFieldError"}),s=v(null),o=v(!1),[l,h]=N({}),[a,i]=N({}),T=D(async()=>{o.current||(await U(0),o.current=!0)},[]);R(()=>{if(!r.length)return;const t=C(r);h(t)},[r==null?void 0:r.length]);const $=D((t,n)=>{const E=r.find(f=>f.code===t);return E!=null&&E.required&&!n?u:""},[r,u]),A=D(t=>{const{name:n,value:E,type:I,checked:f}=t==null?void 0:t.target,x=I==="checkbox"?f:E;h(L=>({...L,[n]:x}))},[]),M=D(t=>{const{name:n,value:E,type:I,checked:f}=t==null?void 0:t.target,x=I==="checkbox"?f:E;i(L=>({...L,[n]:$(n,x)}))},[$]),e=D(t=>{t.preventDefault();let n=!0,E={},I=null;for(const[f,x]of Object.entries(l)){const L=$(f,x);L&&(E[f]=L,n=!1,I||(I=f))}if(i(E),I&&s.current){const f=s.current.elements.namedItem(I);f==null||f.focus()}c==null||c(t,n)},[l,$,c]);return{formData:l,errors:a,formRef:s,handleChange:A,handleBlur:M,handleSubmit:e,handleFocus:T}};var w=(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))(w||{});const Z=G(({loading:r,values:c,fields:u=[],errors:s,className:o="",onChange:l,onBlur:h})=>{const a=`${o}__field`,i=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(O,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options.map(E=>({...E,text:E.label})),onBlur:h,handleSelect:l,value:t||e.defaultValue})},e.id),[o,r,a,h,l]),T=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(y,{autocomplete:e.code==="email"?"username":"",type:"text",name:e.id,value:t===void 0?e.defaultValue:t,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),$=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(H,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),A=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(P,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]),M=g((e,t,n)=>d(k,{error:n,className:b([a,`${a}--${e.id}`,[`${a}--${e.id}-hidden`,e.hidden],e.className]),"data-testid":`${o}--${e.id}`,disabled:r,children:d(q,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:l})},e.id),[o,r,a,h,l]);return u.length?d(V,{children:u.map(e=>{const t=(s==null?void 0:s[e.id])??void 0,n=(c==null?void 0:c[e.id])??void 0;switch(e.fieldType){case w.TEXT:return e.options.length?i(e,n,t):T(e,n,t);case w.MULTILINE:return T(e,n,t);case w.SELECT:return i(e,n,t);case w.DATE:return $(e,n,t);case w.BOOLEAN:return A(e,n,t);case"TEXTAREA":return M(e,n,t);default:return null}})}):null}),oe=({name:r,isLoading:c,children:u,className:s="defaultForm",fieldsConfig:o=[],submitCallback:l})=>{const{formData:h,errors:a,formRef:i,handleChange:T,handleBlur:$,handleSubmit:A,handleFocus:M}=F({submitCallback:l,fieldsConfig:o});return S("form",{onSubmit:A,className:s,name:r,ref:i,onFocus:M,children:[d(Z,{fields:o,onChange:T,onBlur:$,errors:a,values:h,className:s,loading:c}),u]})},B=r=>p.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},p.createElement("g",{clipPath:"url(#clip0_841_1324)"},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_841_1324"},p.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),X=r=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},p.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"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),j=r=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},p.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"}),p.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"})),Y={success:d(X,{}),warning:d(B,{}),error:d(j,{})},ce=()=>{const[r,c]=N({}),u=D(s=>{if(!s||!s.type){c({});return}const o=Y[s.type];c({...s,icon:o})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:u}};export{ae as B,oe as F,ne as c,te as g,ce as u};
@@ -1,5 +1,4 @@
1
- import { FunctionComponent } from 'preact';
2
1
  import { FormProps } from '../../../types';
3
2
 
4
- export declare const Form: FunctionComponent<FormProps>;
3
+ export declare const Form: ({ name, isLoading, children, className, fieldsConfig, submitCallback, }: FormProps) => import("preact").JSX.Element;
5
4
  //# sourceMappingURL=Form.d.ts.map
@@ -1,5 +1,4 @@
1
1
  export { Button } from './Button';
2
2
  export { Form } from './Form';
3
3
  export { FormInputs } from './FormInputs';
4
- export { Title } from './Title';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -7,5 +7,4 @@ export * from './SkeletonLoader';
7
7
  export * from './UI/Button';
8
8
  export * from './UI/Form';
9
9
  export * from './UI/FormInputs';
10
- export * from './UI/Title';
11
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{jsx as o,jsxs as E}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as $}from"@dropins/tools/lib.js";import{v as k,u as W,a as S}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 B,g as R,u as C,T as tt,F as et,B as at}from"../chunks/useInLineAlert.js";import{useState as h,useEffect as H,useCallback as I}from"@dropins/tools/preact-hooks.js";import{useText as K}from"@dropins/tools/i18n.js";import{InLineAlert as st,InputPassword as rt}from"@dropins/tools/components.js";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=(u,l)=>u.split("&").filter(r=>r.includes(l)).map(r=>r.split("=")[1])[0],it=({isEmailConfirmationRequired:u,signInOnSuccess:l,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:f,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:d,routeRedirectOnPasswordUpdate:w,routeSignInPage:m})=>{const s=K({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,y]=h({userName:"",status:!1}),[F,_]=h(""),[L,x]=h(!1),[P,T]=h(""),[N,b]=h(""),[M,n]=h(!1),[A,v]=h(!1),[q,D]=h([]);H(()=>{L&&!q.length&&(F.length?v(!1):v(!0))},[L,F,q]),H(()=>{const{search:p}=window.location;!p.includes("token=")&&!p.includes("email=")&&B(f)&&(window.location.href=f());const e=decodeURIComponent(p),V=J(e,"token"),j=J(e,"email");T(j),b(V)},[f]);const Q=I(async p=>{p.preventDefault(),n(!0),D([]);const e=R(p.target),V=(e==null?void 0:e.password)&&P&&N;e!=null&&e.password||(v(!0),n(!1));const j=(t==null?void 0:t.requiredCharacterClasses)??0,Y=(t==null?void 0:t.minLength)??0;if(!k(e==null?void 0:e.password,j)||e.password.length<+Y){x(!0),n(!1);return}if(!V){d({type:"error",text:s.errorNotification}),n(!1);return}const{message:G,success:z}=await g(P,N,e.password);if(z){if(u||!u&&!l){i==null||i(),B(w)&&(window.location.href=w()),x(!0),n(!1),v(!1),_(""),D([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=m==null?void 0:m()}}]),d({type:"success",text:s.updatePasswordMessage});return}const c=await O({email:P,password:e.password,handleSetInLineAlertProps:d,onErrorCallback:a,translations:s});c!=null&&c.userName&&(i==null||i(c==null?void 0:c.userName),B(r)?window.location.href=r():y({userName:c==null?void 0:c.userName,status:!0}))}else d({type:"error",text:G}),a==null||a({message:G,success:z});n(!1)},[P,N,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,u,l,m,a,i,r,d,w]),X=I(p=>{_(p)},[]);return{additionalActionsAlert:q,passwordError:A,isSuccessful:U,updatePasswordValue:F,isClickSubmit:L,isLoading:M,submitUpdatePassword:Q,handleSetUpdatePasswordValue:X}},ot=({signInOnSuccess:u=!0,formSize:l="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:f,slots:a,onErrorCallback:i,onSuccessCallback:d,routeRedirectOnPasswordUpdate:w})=>{const m=K({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=W(),{inLineAlertProps:y,handleSetInLineAlertProps:F}=C(),{additionalActionsAlert:_,passwordError:L,isSuccessful:x,updatePasswordValue:P,isClickSubmit:T,isLoading:N,submitUpdatePassword:b,handleSetUpdatePasswordValue:M}=it({isEmailConfirmationRequired:U,signInOnSuccess:u,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:d,handleSetInLineAlertProps:F,routeRedirectOnPasswordUpdate:w,routeSignInPage:f}),{isValidUniqueSymbols:n,defaultLengthMessage:A}=S({password:P,isClickSubmit:T,passwordConfigs:s});return x.status&&(a!=null&&a.SuccessNotification)?o(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:x}}):E("div",{className:$(["auth-updatePasswordForm",l]),children:[o(tt,{text:m.title,bottomLine:!1,className:"auth-updatePasswordForm__title"}),y.text?o(st,{className:"auth-updatePasswordForm__notification",variant:"secondary",heading:y.text,icon:y.icon,additionalActions:_}):null,E(et,{name:"updatePassword_form",className:"auth-updatePasswordForm__form",submitCallback:b,isLoading:N,fieldsConfig:[],children:[o("div",{style:"display: none;",children:o("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),o(rt,{defaultValue:P,onValue:M,className:"auth-updatePasswordForm__form__item",autoComplete:"new-password",name:"password",error:L||n==="error"||(A==null?void 0:A.status)==="error",minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:n,validateLengthConfig:A,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:m.placeholder,floatingLabel:m.floatingLabel}),o("div",{className:"auth-updatePasswordForm__button",children:o(at,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:N})})]})]})},_t=({slots:u,formSize:l,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:f,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:d,onSuccessCallback:w})=>o("div",{className:"auth-update-password",children:o(ot,{formSize:l,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:f,routeWrongUrlRedirect:i,onErrorCallback:d,onSuccessCallback:w,slots:u,routeRedirectOnPasswordUpdate:r})});export{_t as UpdatePassword,_t as default};
1
+ import{jsx as o,jsxs as z}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as $}from"@dropins/tools/lib.js";import{v as k,u as W,a as S}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 B,g as R,u as C,F as tt,B as et}from"../chunks/useInLineAlert.js";import{useState as h,useEffect as E,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";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=(u,l)=>u.split("&").filter(r=>r.includes(l)).map(r=>r.split("=")[1])[0],it=({isEmailConfirmationRequired:u,signInOnSuccess:l,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:f,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:d,routeRedirectOnPasswordUpdate:w,routeSignInPage:m})=>{const s=K({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,y]=h({userName:"",status:!1}),[F,x]=h(""),[L,_]=h(!1),[P,M]=h(""),[N,b]=h(""),[q,n]=h(!1),[A,v]=h(!1),[T,D]=h([]);E(()=>{L&&!T.length&&(F.length?v(!1):v(!0))},[L,F,T]),E(()=>{const{search:p}=window.location;!p.includes("token=")&&!p.includes("email=")&&B(f)&&(window.location.href=f());const e=decodeURIComponent(p),V=J(e,"token"),j=J(e,"email");M(j),b(V)},[f]);const Q=I(async p=>{p.preventDefault(),n(!0),D([]);const e=R(p.target),V=(e==null?void 0:e.password)&&P&&N;e!=null&&e.password||(v(!0),n(!1));const j=(t==null?void 0:t.requiredCharacterClasses)??0,Y=(t==null?void 0:t.minLength)??0;if(!k(e==null?void 0:e.password,j)||e.password.length<+Y){_(!0),n(!1);return}if(!V){d({type:"error",text:s.errorNotification}),n(!1);return}const{message:G,success:H}=await g(P,N,e.password);if(H){if(u||!u&&!l){i==null||i(),B(w)&&(window.location.href=w()),_(!0),n(!1),v(!1),x(""),D([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=m==null?void 0:m()}}]),d({type:"success",text:s.updatePasswordMessage});return}const c=await O({email:P,password:e.password,handleSetInLineAlertProps:d,onErrorCallback:a,translations:s});c!=null&&c.userName&&(i==null||i(c==null?void 0:c.userName),B(r)?window.location.href=r():y({userName:c==null?void 0:c.userName,status:!0}))}else d({type:"error",text:G}),a==null||a({message:G,success:H});n(!1)},[P,N,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,u,l,m,a,i,r,d,w]),X=I(p=>{x(p)},[]);return{additionalActionsAlert:T,passwordError:A,isSuccessful:U,updatePasswordValue:F,isClickSubmit:L,isLoading:q,submitUpdatePassword:Q,handleSetUpdatePasswordValue:X}},ot=({signInOnSuccess:u=!0,formSize:l="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:f,slots:a,onErrorCallback:i,onSuccessCallback:d,routeRedirectOnPasswordUpdate:w})=>{const m=K({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=W(),{inLineAlertProps:y,handleSetInLineAlertProps:F}=C(),{additionalActionsAlert:x,passwordError:L,isSuccessful:_,updatePasswordValue:P,isClickSubmit:M,isLoading:N,submitUpdatePassword:b,handleSetUpdatePasswordValue:q}=it({isEmailConfirmationRequired:U,signInOnSuccess:u,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:d,handleSetInLineAlertProps:F,routeRedirectOnPasswordUpdate:w,routeSignInPage:f}),{isValidUniqueSymbols:n,defaultLengthMessage:A}=S({password:P,isClickSubmit:M,passwordConfigs:s});return _.status&&(a!=null&&a.SuccessNotification)?o(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:_}}):z("div",{className:$(["auth-updatePasswordForm",l]),children:[o(at,{title:m.title,divider:!1,className:"auth-updatePasswordForm__title"}),y.text?o(st,{className:"auth-updatePasswordForm__notification",variant:"secondary",heading:y.text,icon:y.icon,additionalActions:x}):null,z(tt,{name:"updatePassword_form",className:"auth-updatePasswordForm__form",submitCallback:b,isLoading:N,fieldsConfig:[],children:[o("div",{style:"display: none;",children:o("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),o(rt,{defaultValue:P,onValue:q,className:"auth-updatePasswordForm__form__item",autoComplete:"new-password",name:"password",error:L||n==="error"||(A==null?void 0:A.status)==="error",minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:n,validateLengthConfig:A,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:m.placeholder,floatingLabel:m.floatingLabel}),o("div",{className:"auth-updatePasswordForm__button",children:o(et,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:N})})]})]})},xt=({slots:u,formSize:l,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:f,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:d,onSuccessCallback:w})=>o("div",{className:"auth-update-password",children:o(ot,{formSize:l,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:f,routeWrongUrlRedirect:i,onErrorCallback:d,onSuccessCallback:w,slots:u,routeRedirectOnPasswordUpdate:r})});export{xt as UpdatePassword,xt as default};
@@ -1,7 +1,7 @@
1
1
  import { useFormProps } from '../../types';
2
2
 
3
3
  export declare const useForm: ({ fieldsConfig, submitCallback }: useFormProps) => {
4
- formData: Record<string, unknown>;
4
+ formData: Record<string, string | number | boolean>;
5
5
  errors: Record<string, string>;
6
6
  formRef: import('preact').RefObject<HTMLFormElement>;
7
7
  handleChange: (event: Event) => void;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-auth", "version": "0.0.1-alpha20", "@dropins/elsie": "0.28.2"}
1
+ {"name": "@dropins/storefront-auth", "version": "0.0.1-alpha21", "@dropins/elsie": "0.32.0"}
package/render.js CHANGED
@@ -4,5 +4,5 @@
4
4
  .auth-updatePasswordForm{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-updatePasswordForm{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-updatePasswordForm.small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-updatePasswordForm.small .auth-updatePasswordForm__form__item{margin-bottom:var(--spacing-big)}.auth-updatePasswordForm.small .auth-updatePasswordForm__title{margin-bottom:var(--spacing-small)}.auth-updatePasswordForm__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-updatePasswordForm__title{margin-bottom:var(--spacing-xxbig)}}.auth-updatePasswordForm__form .auth-updatePasswordForm__form__item{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-updatePasswordForm__form .auth-updatePasswordForm__form__item{margin-bottom:var(--spacing-xxbig)}}.auth-updatePasswordForm__notification{margin-bottom:var(--spacing-medium)}
5
5
  .auth-signInForm{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-signInForm{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-signInForm__notification{margin-bottom:var(--spacing-medium)}.auth-signInForm.small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-signInForm.small .auth-signInForm__form__email,.auth-signInForm.small .auth-signInForm__form__password,.auth-signInForm.small .auth-signInForm__title{margin-bottom:var(--spacing-medium)}.auth-signInForm.small .auth-signInForm__form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-signInForm__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-signInForm__title{margin-bottom:var(--spacing-xxbig)}}.auth-signInForm__form{display:grid;grid-template-columns:1fr}.auth-signInForm__form__email{margin-bottom:var(--spacing-medium)}.auth-signInForm__form__password{margin-bottom:var(--spacing-big)}.auth-signInForm__form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-signInForm__form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-signInForm.small .auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine{justify-content:center;flex-wrap:wrap}.auth-signInForm.small .auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine .auth-signInForm__button--signup{flex-basis:100%;margin-top:20px}.auth-signInForm.small .auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine>span{display:none}.auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine{display:flex}.auth-signInForm__form__buttons .auth-signInForm__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-signInForm__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-signInForm__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-signInForm__form__buttons .auth-signInForm__form__buttons--combine{justify-content:center;flex-wrap:wrap}.auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine .auth-signInForm__button--signup{flex-basis:100%;margin-top:20px}.auth-signInForm__form__buttons .auth-signInForm__form__buttons--combine>span{display:none}}
6
6
  .auth-signUpForm{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-signUpForm{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-signUpForm.small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-signUpForm.small .auth-signUpForm__title{margin-bottom:var(--spacing-small)}.auth-signUpForm.small .auth-signUpForm__form__field .auth-signUpForm__form__field:nth-child(2),.auth-signUpForm.small .auth-signUpForm__form__field .auth-signUpForm__form__field:nth-child(3){flex-basis:100%}.auth-signUpForm.small .auth-signUpForm__form{grid-template-columns:1fr}.auth-signUpForm__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-signUpForm__title{margin-bottom:var(--spacing-xxbig)}}.auth-signUpForm__notification{margin-bottom:var(--spacing-medium)}.auth-signUpForm__form{display:flex;flex-wrap:wrap;flex-direction:row;gap:0 13px}.auth-signUpForm__form__field{margin-bottom:var(--spacing-medium);flex-basis:100%;flex-grow:1;flex-shrink:0}.auth-signUpForm__checkbox{margin-bottom:12px}.auth-signUpForm__automatic-login{margin-top:12px}.auth-signUpForm__form__field:nth-child(2),.auth-signUpForm__form__field:nth-child(3){flex-shrink:1;flex-grow:1;flex-basis:100%}.auth-signUpForm-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-signUpForm-buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}.auth-signUpForm__form__field:nth-child(2),.auth-signUpForm__form__field:nth-child(3){flex-shrink:1;flex-grow:.5;flex-basis:48%}}
7
- .auth-button{position:relative}.auth-button__loader-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__loader-wrapper{opacity:1;display:inline-flex}.auth-title__heading{color:var(--color-neutral-800, #2b2b2b);font:var(--type-headline-2-default-font);letter-spacing:var(--type-details-caption-1-letter-spacing)}.auth-title__text{display:flex;justify-content:space-between;align-items:center}.auth-title__hr{margin-top:var(--spacing-xsmall);border:none;border-bottom:var(--shape-border-width-2) solid var(--color-neutral-400, #d6d6d6)}`,{styleId:"Auth"});
7
+ .auth-button{position:relative}.auth-button__loader-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__loader-wrapper{opacity:1;display:inline-flex}`,{styleId:"Auth"});
8
8
  import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as l,Render as u}from"@dropins/tools/lib.js";import{useState as m,useEffect as f}from"@dropins/tools/preact-hooks.js";import{UIProvider as g}from"@dropins/tools/components.js";import{events as p}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as y}from"./chunks/initialize.js";const h={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:"},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},FormText:{requiredFieldError:"This is a required field."},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:h},w={default:b},P=({children:i})=>{var o,r;const[e,n]=m("en_US"),c=(r=(o=y)==null?void 0:o.getConfig())==null?void 0:r.langDefinitions;f(()=>{const t=p.on("locale",a=>{a!==e&&n(a)},{eager:!0});return()=>{t==null||t.off()}},[e]);const d=l(w,c??{});return s(g,{lang:e,langDefinitions:d,children:i})},F=new u(s(P,{}));export{F as render};
@@ -28,8 +28,8 @@ export interface AddressFormProps {
28
28
  company: string;
29
29
  country_code: string;
30
30
  country_id: string;
31
- custom_attributes: CustomAttributes[];
32
- custom_attributesV2: CustomAttributesV2[];
31
+ custom_attributes?: CustomAttributes[];
32
+ custom_attributesV2?: CustomAttributesV2[];
33
33
  default_billing?: boolean;
34
34
  default_shipping?: boolean;
35
35
  fax: string;
@@ -5,10 +5,10 @@ export interface FormProps {
5
5
  name?: string;
6
6
  className?: string;
7
7
  children?: any;
8
- isLoading?: boolean;
8
+ isLoading: boolean;
9
9
  submitCallback?: (event: SubmitEvent, isValid: boolean) => Promise<void | null | undefined>;
10
10
  }
11
- export interface useFormProps extends Omit<FormProps, 'children' | 'className' | 'name'> {
11
+ export interface useFormProps extends Omit<FormProps, 'children' | 'className' | 'name' | 'isLoading'> {
12
12
  }
13
13
  export interface FormInputsProps {
14
14
  className?: string;
@@ -38,7 +38,7 @@ export interface useSignInFormProps extends Omit<SignInFormProps, 'formSize' | '
38
38
  text: string;
39
39
  status: '' | 'success' | 'error';
40
40
  };
41
- translations: any;
41
+ translations: Record<string, string>;
42
42
  }
43
43
  export {};
44
44
  //# sourceMappingURL=signIn.types.d.ts.map
@@ -1,11 +0,0 @@
1
- import { FunctionComponent } from 'preact';
2
- import { HTMLAttributes } from 'preact/compat';
3
-
4
- export interface TitleProps {
5
- className?: string;
6
- text: string;
7
- bottomLine: boolean;
8
- children?: any;
9
- }
10
- export declare const Title: FunctionComponent<TitleProps & HTMLAttributes<HTMLDivElement>>;
11
- //# sourceMappingURL=Title.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from './Title';
2
- export { Title as default } from './Title';
3
- //# sourceMappingURL=index.d.ts.map