@dropins/storefront-auth 0.0.1-alpha7 → 0.0.1-alpha9

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.
package/api.js CHANGED
@@ -1,8 +1 @@
1
- import{c as x,a as R,g as S}from"./chunks/createCustomerAddress.js";import{C as s,d as m,p as i,E as n}from"./chunks/getStoreConfig.js";import{g as G,a as K,b as N}from"./chunks/getStoreConfig.js";import{r as A}from"./chunks/requestPasswordResetEmail.js";import{r as M}from"./chunks/resetPassword.js";import{f as c,h as u}from"./chunks/setReCaptchaToken.js";import{g as U,r as H,s as P,a as I,b as V}from"./chunks/setReCaptchaToken.js";import{events as f}from"@dropins/tools/event-bus.js";import{c as y}from"./chunks/confirmEmail.js";import{r as B}from"./chunks/resendConfirmationEmail.js";import{c as $,i as j}from"./chunks/initialize.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const E=e=>{var r,o,a;let t="";return(r=e==null?void 0:e.errors)!=null&&r.length&&(t=((o=e==null?void 0:e.errors[0])==null?void 0:o.message)||"Unknown error"),{message:t,success:!!((a=e==null?void 0:e.data)!=null&&a.revokeCustomerToken)}},h=`
2
- mutation REVOKE_CUSTOMER_TOKEN {
3
- revokeCustomerToken {
4
- result
5
- }
6
- }
7
- `,O=async()=>await c(h,{method:"POST"}).then(e=>{const t=E(e);if(t!=null&&t.success)[s.auth_dropin_user_token,s.auth_dropin_firstname].forEach(r=>{m(r)}),f.emit("authenticated",!1),i(n.SIGN_OUT,{logoutAttempt:!0});else{const r=`
8
- ERROR revokeCustomerToken: ${t.message}`;console.error(r)}return t}).catch(u);export{$ as config,y as confirmEmail,x as createCustomer,R as createCustomerAddress,c as fetchGraphQl,S as getAttributesForm,U as getConfig,G as getCustomerData,K as getCustomerToken,N as getStoreConfig,j as initialize,H as removeFetchGraphQlHeader,A as requestPasswordResetEmail,B as resendConfirmationEmail,M as resetPassword,O as revokeCustomerToken,P as setEndpoint,I as setFetchGraphQlHeader,V as setFetchGraphQlHeaders};
1
+ 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};
@@ -1 +1 @@
1
- import{jsxs as T,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as W}from"@dropins/tools/lib.js";import{g as X,c as w,u as Y,T as Z,F as $,B as G}from"./useInLineAlert.js";import{useState as _,useCallback as b,useEffect as q,useMemo as z}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as O}from"./getStoreConfig.js";import{r as R}from"./resendConfirmationEmail.js";import{s as tt,a as at}from"./simplifyTransformAttributesForm.js";import{c as rt}from"./confirmEmail.js";import{useText as H}from"@dropins/tools/i18n.js";import{InLineAlert as st,InputPassword as et}from"@dropins/tools/components.js";import{E as ot}from"./EmailConfirmationForm.js";const nt=({emailConfirmationStatusMessage:a,translations:r,initialEmailValue:o,routeSignUp:l,routeForgotPassword:u,routeRedirectOnSignIn:y,onErrorCallback:d,setActiveComponent:t,onSuccessCallback:c,onSignUpLinkClick:f,handleSetInLineAlertProps:s,routeRedirectOnEmailConfirmationClose:E})=>{const[A,N]=_(""),[h,I]=_(!1),[g,F]=_(""),[L,p]=_(!1),[B,k]=_({userName:"",status:!1}),[P,x]=_(!1),C=b(async n=>{await R(n),I(!0),s({})},[s]);q(()=>{a!=null&&a.text&&s({text:a.text,type:a.status?a.status:void 0})},[a,s]);const M=b(n=>r?T("span",{className:"auth-signInForm__resend-email-notification",children:[r.resendEmailInformationText," ",m("button",{onClick:()=>C(n),children:r.resendEmailButtonText})," ",r.resendEmailAdditionalText]}):"",[C,r]),U=b(async n=>{var K;s({}),x(!0);const i=X(n.target);if(i.password||(p(!0),x(!1)),i!=null&&i.email&&(i!=null&&i.password)){const{email:D,password:Q}=i,e=await O({email:D,password:Q,handleSetInLineAlertProps:s,onErrorCallback:d,translations:r});if((K=e==null?void 0:e.errorMessage)!=null&&K.length){N(D);const V=e.errorMessage.includes("This account isn't confirmed. Verify and try again.")?M(D):e.errorMessage;s({text:V,type:"error"}),F("")}e!=null&&e.userName&&(n.target.reset(),w(y)?window.location.href=y():(c==null||c({userName:e==null?void 0:e.userName,status:!0}),k({userName:e==null?void 0:e.userName,status:!0}))),p(!1)}x(!1),F("")},[M,s,r,d,y,c]),v=b(()=>{if(w(t)){t("resetPasswordForm");return}w(u)&&(window.location.href=u())},[u,t]),S=b(()=>{if(w(f)&&f(),w(t)){t("signUpForm");return}w(l)&&(window.location.href=l())},[f,l,t]),j=z(()=>{const n=tt(at);return o!=null&&o.length?n==null?void 0:n.map(i=>({...i,defaultValue:o})):n},[o]),J=b(()=>{s({}),w(E)?window.location.href=E():I(!1)},[s,E]);return{userEmail:A,defaultEnhancedEmailFields:j,passwordError:L,isSuccessful:B,isLoading:P,signInPasswordValue:g,showEmailConfirmationForm:h,setShowEmailConfirmationForm:I,setSignInPasswordValue:F,submitLogInUser:U,forgotPasswordCallback:v,onSignUpLinkClickCallback:S,handledOnPrimaryButtonClick:J}},it=()=>{let a=new URL(window.location.href),r=a.searchParams.get("email"),o=a.searchParams.get("key");r&&o&&(a.searchParams.delete("email"),a.searchParams.delete("key"),window.history.replaceState({},document.title,a.toString()))},mt=({enableEmailConfirmation:a})=>{const r=H({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[o,l]=_({text:"",status:""});return q(()=>{if(a){const{search:u}=window.location;u.includes("email=")&&u.includes("key=")&&(async()=>{var c,f,s;const d=new URLSearchParams(u),t=await rt({customerEmail:d.get("email"),customerConfirmationKey:d.get("key")});if(!t)return null;(c=t==null?void 0:t.errors)!=null&&c.length?l({text:t==null?void 0:t.errors[0].message,status:"error"}):(l({text:t.data.confirmEmail.customer.email?r.accountConfirmationEmailSuccessMessage.replace("{email}",(s=(f=t==null?void 0:t.data)==null?void 0:f.confirmEmail.customer)==null?void 0:s.email):r.accountConfirmMessage,status:"success"}),it())})()}},[a,r]),{emailConfirmationStatusMessage:o}},It=({formSize:a="default",initialEmailValue:r="",renderSignUpLink:o=!1,enableEmailConfirmation:l=!1,hideCloseBtnOnEmailConfirmation:u=!1,routeRedirectOnEmailConfirmationClose:y,routeRedirectOnSignIn:d,routeForgotPassword:t,routeSignUp:c,onSuccessCallback:f,setActiveComponent:s,onErrorCallback:E,onSignUpLinkClick:A,successNotificationForm:N})=>{const h=H({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",resendEmailAdditionalText:"Auth.Notification.resendEmailNotification.additionalText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),{emailConfirmationStatusMessage:I}=mt({enableEmailConfirmation:l}),{inLineAlertProps:g,handleSetInLineAlertProps:F}=Y(),{userEmail:L,defaultEnhancedEmailFields:p,passwordError:B,isSuccessful:k,isLoading:P,signInPasswordValue:x,showEmailConfirmationForm:C,setSignInPasswordValue:M,submitLogInUser:U,forgotPasswordCallback:v,onSignUpLinkClickCallback:S,handledOnPrimaryButtonClick:j}=nt({translations:h,emailConfirmationStatusMessage:I,initialEmailValue:r,routeSignUp:c,routeForgotPassword:t,routeRedirectOnSignIn:d,setActiveComponent:s,onErrorCallback:E,onSuccessCallback:f,onSignUpLinkClick:A,handleSetInLineAlertProps:F,routeRedirectOnEmailConfirmationClose:y});return N&&k.status?N(k.userName):C?m(ot,{formSize:a,userEmail:L,inLineAlertProps:g,hideCloseBtnOnEmailConfirmation:u,handleSetInLineAlertProps:F,onPrimaryButtonClick:j}):T("div",{className:W(["auth-signInForm",a]),"data-testid":"signInForm",children:[m(Z,{text:h.title,bottomLine:!1,className:"auth-signInForm__title"}),g.text?m(st,{"data-testid":"authInLineAlert",className:"auth-signInForm__notification",type:g.type,variant:"secondary",heading:g.text,icon:g.icon}):null,T($,{name:"signIn_form",className:"auth-signInForm__form",submitCallback:U,isLoading:P,fieldsConfig:p,children:[m(et,{className:"auth-signInForm__form__password",autoComplete:"current-password",error:B,defaultValue:x,onValue:M,hideStatusIndicator:!0}),T("div",{className:"auth-signInForm__form__buttons",children:[T("div",{className:"auth-signInForm__form__buttons--combine",children:[m(G,{type:"button",variant:"tertiary",style:{padding:0},buttonText:h.buttonTertiary,className:"auth-signInForm__button auth-signInForm__button--forgot",enableLoader:!1,onClick:v,"data-testid":"switchToSignUp"}),o?m("span",{}):null,o?m(G,{type:"button",variant:"tertiary",style:{padding:0},buttonText:h.buttonSecondary,className:"auth-signInForm__button auth-signInForm__button--signup",enableLoader:!1,onClick:S}):null]}),m(G,{type:"submit",buttonText:h.buttonPrimary,variant:"primary",className:"auth-signInForm__button auth-signInForm__button--submit",enableLoader:P})]})]}),m("div",{id:"generateCustomerToken"})]})};export{It as S};
1
+ import{jsxs as x,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as W,classes as X}from"@dropins/tools/lib.js";import{g as Y,c as w,u as Z,T as $,F as z,B as G}from"./useInLineAlert.js";import{useState as _,useCallback as b,useEffect as q,useMemo as O}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as R}from"./getCustomerToken.js";import{r as tt}from"./resendConfirmationEmail.js";import{s as at,a as rt}from"./simplifyTransformAttributesForm.js";import{c as et}from"./confirmEmail.js";import{useText as H}from"@dropins/tools/i18n.js";import{InLineAlert as st,InputPassword as ot}from"@dropins/tools/components.js";import{E as it}from"./EmailConfirmationForm.js";const nt=({emailConfirmationStatusMessage:t,translations:r,initialEmailValue:o,routeSignUp:c,routeForgotPassword:u,routeRedirectOnSignIn:y,onErrorCallback:d,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:l,handleSetInLineAlertProps:e,routeRedirectOnEmailConfirmationClose:E})=>{const[M,S]=_(""),[h,I]=_(!1),[g,F]=_(""),[A,T]=_(!1),[L,p]=_({userName:"",status:!1}),[k,N]=_(!1),P=b(async i=>{await tt(i),I(!0),e({})},[e]);q(()=>{t!=null&&t.text&&e({text:t.text,type:t.status?t.status:void 0})},[t,e]);const C=b(i=>r?x("span",{className:"auth-signInForm__resend-email-notification",children:[r.resendEmailInformationText," ",n("button",{onClick:()=>P(i),children:r.resendEmailButtonText})," ",r.resendEmailAdditionalText]}):"",[P,r]),B=b(async i=>{var K;e({}),N(!0);const m=Y(i.target);if(m.password||(T(!0),N(!1)),m!=null&&m.email&&(m!=null&&m.password)){const{email:D,password:Q}=m,s=await R({email:D,password:Q,handleSetInLineAlertProps:e,onErrorCallback:d,translations:r});if((K=s==null?void 0:s.errorMessage)!=null&&K.length){S(D);const V=s.errorMessage.includes("This account isn't confirmed. Verify and try again.")?C(D):s.errorMessage;e({text:V,type:"error"}),F("")}s!=null&&s.userName&&(i.target.reset(),w(y)?window.location.href=y():(f==null||f({userName:s==null?void 0:s.userName,status:!0}),p({userName:s==null?void 0:s.userName,status:!0}))),T(!1)}N(!1),F("")},[C,e,r,d,y,f]),U=b(()=>{if(w(a)){a("resetPasswordForm");return}w(u)&&(window.location.href=u())},[u,a]),v=b(()=>{if(w(l)&&l(),w(a)){a("signUpForm");return}w(c)&&(window.location.href=c())},[l,c,a]),j=O(()=>{const i=at(rt);return o!=null&&o.length?i==null?void 0:i.map(m=>({...m,defaultValue:o})):i},[o]),J=b(()=>{e({}),w(E)?window.location.href=E():I(!1)},[e,E]);return{userEmail:M,defaultEnhancedEmailFields:j,passwordError:A,isSuccessful:L,isLoading:k,signInPasswordValue:g,showEmailConfirmationForm:h,setShowEmailConfirmationForm:I,setSignInPasswordValue:F,submitLogInUser:B,forgotPasswordCallback:U,onSignUpLinkClickCallback:v,handledOnPrimaryButtonClick:J}},mt=()=>{let t=new URL(window.location.href),r=t.searchParams.get("email"),o=t.searchParams.get("key");r&&o&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},ct=({enableEmailConfirmation:t})=>{const r=H({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[o,c]=_({text:"",status:""});return q(()=>{if(t){const{search:u}=window.location;u.includes("email=")&&u.includes("key=")&&(async()=>{var f,l,e;const d=new URLSearchParams(u),a=await et({customerEmail:d.get("email"),customerConfirmationKey:d.get("key")});if(!a)return null;(f=a==null?void 0:a.errors)!=null&&f.length?c({text:a==null?void 0:a.errors[0].message,status:"error"}):(c({text:a.data.confirmEmail.customer.email?r.accountConfirmationEmailSuccessMessage.replace("{email}",(e=(l=a==null?void 0:a.data)==null?void 0:l.confirmEmail.customer)==null?void 0:e.email):r.accountConfirmMessage,status:"success"}),mt())})()}},[t,r]),{emailConfirmationStatusMessage:o}},Nt=({slots:t,formSize:r="default",initialEmailValue:o="",renderSignUpLink:c=!1,enableEmailConfirmation:u=!1,hideCloseBtnOnEmailConfirmation:y=!1,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:a,routeForgotPassword:f,routeSignUp:l,onSuccessCallback:e,setActiveComponent:E,onErrorCallback:M,onSignUpLinkClick:S})=>{const h=H({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",resendEmailAdditionalText:"Auth.Notification.resendEmailNotification.additionalText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),{emailConfirmationStatusMessage:I}=ct({enableEmailConfirmation:u}),{inLineAlertProps:g,handleSetInLineAlertProps:F}=Z(),{userEmail:A,defaultEnhancedEmailFields:T,passwordError:L,isSuccessful:p,isLoading:k,signInPasswordValue:N,showEmailConfirmationForm:P,setSignInPasswordValue:C,submitLogInUser:B,forgotPasswordCallback:U,onSignUpLinkClickCallback:v,handledOnPrimaryButtonClick:j}=nt({translations:h,emailConfirmationStatusMessage:I,initialEmailValue:o,routeSignUp:l,routeForgotPassword:f,routeRedirectOnSignIn:a,setActiveComponent:E,onErrorCallback:M,onSuccessCallback:e,onSignUpLinkClick:S,handleSetInLineAlertProps:F,routeRedirectOnEmailConfirmationClose:d});return p.status&&(t!=null&&t.SuccessNotification)?n(W,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:p}}):P?n(it,{formSize:r,userEmail:A,inLineAlertProps:g,hideCloseBtnOnEmailConfirmation:y,handleSetInLineAlertProps:F,onPrimaryButtonClick:j}):x("div",{className:X(["auth-signInForm",r]),"data-testid":"signInForm",children:[n($,{text:h.title,bottomLine:!1,className:"auth-signInForm__title"}),g.text?n(st,{"data-testid":"authInLineAlert",className:"auth-signInForm__notification",type:g.type,variant:"secondary",heading:g.text,icon:g.icon}):null,x(z,{name:"signIn_form",className:"auth-signInForm__form",submitCallback:B,isLoading:k,fieldsConfig:T,children:[n(ot,{className:"auth-signInForm__form__password",autoComplete:"current-password",error:L,defaultValue:N,onValue:C,hideStatusIndicator:!0}),x("div",{className:"auth-signInForm__form__buttons",children:[x("div",{className:"auth-signInForm__form__buttons--combine",children:[n(G,{type:"button",variant:"tertiary",style:{padding:0},buttonText:h.buttonTertiary,className:"auth-signInForm__button auth-signInForm__button--forgot",enableLoader:!1,onClick:U,"data-testid":"switchToSignUp"}),c?n("span",{}):null,c?n(G,{type:"button",variant:"tertiary",style:{padding:0},buttonText:h.buttonSecondary,className:"auth-signInForm__button auth-signInForm__button--signup",enableLoader:!1,onClick:v}):null]}),n(G,{type:"submit",buttonText:h.buttonPrimary,variant:"primary",className:"auth-signInForm__button auth-signInForm__button--submit",enableLoader:k})]})]}),n("div",{id:"generateCustomerToken"})]})};export{Nt as S};
@@ -1 +1 @@
1
- import{jsx as o,jsxs as I}from"@dropins/tools/preact-jsx-runtime.js";import{classes as lt}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as ct,c as ft,a as gt}from"./createCustomerAddress.js";import{useState as y,useEffect as dt,useCallback as G}from"@dropins/tools/preact-hooks.js";import{s as tt,b as ht,c as Ft}from"./simplifyTransformAttributesForm.js";import{v as Ut,u as yt,a as pt}from"./usePasswordValidationMessage.js";import{p as et,E as rt,a as bt}from"./getStoreConfig.js";import{c as H,g as _t,u as Tt,T as Nt,F as Lt,B as st}from"./useInLineAlert.js";import{InLineAlert as xt,InputPassword as Pt,Field as Q,Checkbox as X}from"@dropins/tools/components.js";import{S as Et}from"./SkeletonLoader.js";import{E as wt}from"./EmailConfirmationForm.js";import{useText as St}from"@dropins/tools/i18n.js";const it=(t,e)=>e!=null&&e.length?t.map(i=>{var s;const a=(s=e.find(({code:p})=>p===i.code))==null?void 0:s.defaultValue;return a?{...i,defaultValue:a}:i}):t,vt=({inputsDefaultValueSet:t,fieldsConfigForApiVersion1:e,apiVersion2:i})=>{const[a,s]=y([]);return dt(()=>{(async()=>{var h;if(i){const r=await ct("customer_account_create");if((h=r==null?void 0:r.fields)!=null&&h.length)if(t!=null&&t.length){const n=it(r==null?void 0:r.fields,t);s(n)}else s(r==null?void 0:r.fields)}else{const r=tt(ht),n=tt(e),u=it(r,t);s(e&&e.length?n:u)}})()},[i,e,t]),{fieldsListConfigs:a}},Mt=t=>{switch(t){case"true":case"on":return!0;case"false":case"off":return!1;default:return t}},qt=(t,e)=>{if(!e)return t;const i={};i.custom_attributes=[];for(const a in t)Object.prototype.hasOwnProperty.call(Ft,a)?i[a]=t[a]:i.custom_attributes.push({attribute_code:a,value:Mt(t[a])});return i},At=({addressesData:t,translations:e,isEmailConfirmationRequired:i,apiVersion2:a=!0,passwordConfigs:s,isAutoSignInEnabled:p,routeRedirectOnSignIn:h,routeSignIn:r,onErrorCallback:n,onSuccessCallback:u,setActiveComponent:c,handleSetInLineAlertProps:f,routeRedirectOnEmailConfirmationClose:L})=>{const[O,w]=y(""),[S,m]=y(!1),[l,_]=y({userName:"",status:!1}),[v,g]=y(""),[M,q]=y(!1),[V,F]=y(!1),[A,C]=y(!0),x=G(({target:U})=>{C(U.checked)},[]),B=G(()=>{if(H(c)){c("signInForm");return}H(r)&&(window.location.href=r())},[c,r]),W=G(U=>{g(U)},[]),j=G(()=>{f({}),g(""),H(L)?window.location.href=L():(m(!1),c==null||c("signInForm"))},[f,L,c]);return{isKeepMeLogged:A,userEmail:O,showEmailConfirmationForm:S,isSuccessful:l,isClickSubmit:M,signUpPasswordValue:v,isLoading:V,onSubmitSignUp:async(U,$)=>{var Z,z,D;if(f({}),F(!0),!$){q(!0),F(!1);return}const K=a?"createCustomerV2":"createCustomer",b=_t(U.target),{email:P,password:E,is_subscribed:at}=b,ot=(s==null?void 0:s.requiredCharacterClasses)||0,ut=(s==null?void 0:s.minLength)||1;if(!Ut(E,ot)||ut>(E==null?void 0:E.length)){q(!0),F(!1);return}const mt=qt({...b,is_subscribed:!!at||!1},a),{data:T,errors:N}=await ft(mt,a),k=((z=(Z=T==null?void 0:T.createCustomer)==null?void 0:Z.customer)==null?void 0:z.firstname)||"";if(N&&(N!=null&&N.length))f==null||f({type:"error",text:N[0].message}),n==null||n(N),et(rt.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),w(P);else{const J={email:"",...T==null?void 0:T[K]};if(et(rt.CREATE_ACCOUNT_EVENT,{email:J==null?void 0:J.email,updateProfile:!0}),i||!p){if(u==null||u({userName:k,status:!0}),i){(D=U.target)==null||D.reset(),g(""),m(!0),w(P),F(!1);return}if(!p){F(!1),_({userName:k,status:!0});return}}const d=await bt({email:P,password:E,translations:e,handleSetInLineAlertProps:f,onErrorCallback:n});if(d!=null&&d.userName){if(t!=null&&t.length)for(const R of t)try{await gt(R)}catch(nt){console.error(e.failedCreateCustomerAddress,R,nt)}H(h)?window.location.href=h():(u==null||u({userName:d==null?void 0:d.userName,status:!0}),_({userName:d==null?void 0:d.userName,status:!0}))}else u==null||u({userName:k,status:!0}),_({userName:k,status:!0})}F(!1)},signInButton:B,handleSetSignUpPasswordValue:W,onKeepMeLoggedChange:x,handleHideEmailConfirmationForm:j}},Xt=({addressesData:t,formSize:e="default",inputsDefaultValueSet:i,fieldsConfigForApiVersion1:a,apiVersion2:s=!0,isAutoSignInEnabled:p=!0,displayTermsOfUseCheckbox:h=!1,displayNewsletterCheckbox:r=!1,hideCloseBtnOnEmailConfirmation:n=!1,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,routeSignIn:f,onErrorCallback:L,onSuccessCallback:O,setActiveComponent:w,successNotificationForm:S})=>{const m=St({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"}),{passwordConfigs:l,isEmailConfirmationRequired:_}=yt(),{fieldsListConfigs:v}=vt({fieldsConfigForApiVersion1:a,apiVersion2:s,inputsDefaultValueSet:i}),{inLineAlertProps:g,handleSetInLineAlertProps:M}=Tt(),{isKeepMeLogged:q,userEmail:V,showEmailConfirmationForm:F,isSuccessful:A,isClickSubmit:C,signUpPasswordValue:x,isLoading:B,onSubmitSignUp:W,signInButton:j,handleSetSignUpPasswordValue:Y,onKeepMeLoggedChange:U,handleHideEmailConfirmationForm:$}=At({addressesData:t,translations:m,isEmailConfirmationRequired:_,apiVersion2:s,passwordConfigs:l,isAutoSignInEnabled:p,routeRedirectOnSignIn:c,routeSignIn:f,onErrorCallback:L,onSuccessCallback:O,setActiveComponent:w,handleSetInLineAlertProps:M,routeRedirectOnEmailConfirmationClose:u}),{isValidUniqueSymbols:K,defaultLengthMessage:b}=pt({password:x,isClickSubmit:C,passwordConfigs:l}),P=!_&&(t==null?void 0:t.length);return!v.length&&s?o("div",{className:`auth-signUpForm ${e} skeleton-loader`,"data-testid":"SignUpForm",children:o(Et,{activeSkeleton:"signUpForm"})}):S&&A.status?S(A.userName):F?o(wt,{formSize:e,userEmail:V,inLineAlertProps:g,hideCloseBtnOnEmailConfirmation:n,handleSetInLineAlertProps:M,onPrimaryButtonClick:$}):I("div",{className:lt(["auth-signUpForm",e]),"data-testid":"SignUpForm",children:[o(Nt,{text:m.title,bottomLine:!1,className:"auth-signUpForm__title"}),g.text?o(xt,{className:"auth-signUpForm__notification",type:g.type,variant:"secondary",heading:g.text,icon:g.icon}):null,I(Lt,{submitCallback:W,className:"auth-signUpForm__form",isLoading:B,name:"signUp_form",fieldsConfig:v,children:[o(Pt,{validateLengthConfig:b,className:"auth-signUpForm__form__item",autoComplete:"current-password",name:"password",minLength:l==null?void 0:l.minLength,error:K==="error"||(b==null?void 0:b.status)==="error"||C&&x.length<=0,defaultValue:x,uniqueSymbolsStatus:K,requiredCharacterClasses:l==null?void 0:l.requiredCharacterClasses,onValue:Y,children:P?o("div",{className:"auth-signUpForm__automatic-login",children:o(Q,{children:o(X,{name:"",placeholder:m.keepMeLoggedText,label:m.keepMeLoggedText,checked:q,onChange:U})})}):null}),r||h?I("div",{className:"auth-signUpForm__item auth-signUpForm__checkbox",children:[r?o(Q,{children:o(X,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:m.subscribedDefaultText,label:m.subscribedDefaultText})}):null,h?o(Q,{children:o(X,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:m.privacyPolicyDefaultText,label:m.privacyPolicyDefaultText})}):null]}):null,I("div",{className:"auth-signUpForm-buttons",children:[o(st,{type:"button",variant:"tertiary",style:{padding:0},buttonText:m.buttonSecondary,enableLoader:!1,onClick:j}),o(st,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:B})]})]}),o("div",{id:"createCustomerV2"})]})};export{Xt as S};
1
+ import{jsx as s,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as ct,classes as lt}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as ft,c as dt,a as gt}from"./createCustomerAddress.js";import{useState as p,useEffect as ht,useCallback as G}from"@dropins/tools/preact-hooks.js";import{s as tt,b as Ft,c as Ut}from"./simplifyTransformAttributesForm.js";import{v as yt,u as pt,a as bt}from"./usePasswordValidationMessage.js";import{a as _t}from"./getCustomerToken.js";import{p as et,E as rt}from"./getStoreConfig.js";import{c as H,g as Tt,u as Nt,T as xt,F as Lt,B as it}from"./useInLineAlert.js";import{InLineAlert as Pt,InputPassword as Et,Field as Q,Checkbox as X}from"@dropins/tools/components.js";import{S as St}from"./SkeletonLoader.js";import{E as wt}from"./EmailConfirmationForm.js";import{useText as vt}from"@dropins/tools/i18n.js";const st=(t,e)=>e!=null&&e.length?t.map(a=>{var i;const o=(i=e.find(({code:b})=>b===a.code))==null?void 0:i.defaultValue;return o?{...a,defaultValue:o}:a}):t,Mt=({inputsDefaultValueSet:t,fieldsConfigForApiVersion1:e,apiVersion2:a})=>{const[o,i]=p([]);return ht(()=>{(async()=>{var h;if(a){const r=await ft("customer_account_create");if((h=r==null?void 0:r.fields)!=null&&h.length)if(t!=null&&t.length){const n=st(r==null?void 0:r.fields,t);i(n)}else i(r==null?void 0:r.fields)}else{const r=tt(Ft),n=tt(e),u=st(r,t);i(e&&e.length?n:u)}})()},[a,e,t]),{fieldsListConfigs:o}},qt=t=>{switch(t){case"true":case"on":return!0;case"false":case"off":return!1;default:return t}},At=(t,e)=>{if(!e)return t;const a={};a.custom_attributes=[];for(const o in t)Object.prototype.hasOwnProperty.call(Ut,o)?a[o]=t[o]:a.custom_attributes.push({attribute_code:o,value:qt(t[o])});return a},Ct=({addressesData:t,translations:e,isEmailConfirmationRequired:a,apiVersion2:o=!0,passwordConfigs:i,isAutoSignInEnabled:b,routeRedirectOnSignIn:h,routeSignIn:r,onErrorCallback:n,onSuccessCallback:u,setActiveComponent:l,handleSetInLineAlertProps:f,routeRedirectOnEmailConfirmationClose:L})=>{const[O,w]=p(""),[F,m]=p(!1),[c,T]=p({userName:"",status:!1}),[v,d]=p(""),[M,q]=p(!1),[V,U]=p(!1),[A,C]=p(!0),P=G(({target:y})=>{C(y.checked)},[]),B=G(()=>{if(H(l)){l("signInForm");return}H(r)&&(window.location.href=r())},[l,r]),W=G(y=>{d(y)},[]),j=G(()=>{f({}),d(""),H(L)?window.location.href=L():(m(!1),l==null||l("signInForm"))},[f,L,l]);return{isKeepMeLogged:A,userEmail:O,showEmailConfirmationForm:F,isSuccessful:c,isClickSubmit:M,signUpPasswordValue:v,isLoading:V,onSubmitSignUp:async(y,$)=>{var Z,z,D;if(f({}),U(!0),!$){q(!0),U(!1);return}const I=o?"createCustomerV2":"createCustomer",_=Tt(y.target),{email:E,password:S,is_subscribed:at}=_,ot=(i==null?void 0:i.requiredCharacterClasses)||0,ut=(i==null?void 0:i.minLength)||1;if(!yt(S,ot)||ut>(S==null?void 0:S.length)){q(!0),U(!1);return}const mt=At({..._,is_subscribed:!!at||!1},o),{data:N,errors:x}=await dt(mt,o),K=((z=(Z=N==null?void 0:N.createCustomer)==null?void 0:Z.customer)==null?void 0:z.firstname)||"";if(x&&(x!=null&&x.length))f==null||f({type:"error",text:x[0].message}),n==null||n(x),et(rt.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),w(E);else{const J={email:"",...N==null?void 0:N[I]};if(et(rt.CREATE_ACCOUNT_EVENT,{email:J==null?void 0:J.email,updateProfile:!0}),a||!b){if(u==null||u({userName:K,status:!0}),a){(D=y.target)==null||D.reset(),d(""),m(!0),w(E),U(!1);return}if(!b){U(!1),T({userName:K,status:!0});return}}const g=await _t({email:E,password:S,translations:e,handleSetInLineAlertProps:f,onErrorCallback:n});if(g!=null&&g.userName){if(t!=null&&t.length)for(const R of t)try{await gt(R)}catch(nt){console.error(e.failedCreateCustomerAddress,R,nt)}H(h)?window.location.href=h():(u==null||u({userName:g==null?void 0:g.userName,status:!0}),T({userName:g==null?void 0:g.userName,status:!0}))}else u==null||u({userName:K,status:!0}),T({userName:K,status:!0})}U(!1)},signInButton:B,handleSetSignUpPasswordValue:W,onKeepMeLoggedChange:P,handleHideEmailConfirmationForm:j}},Zt=({addressesData:t,formSize:e="default",inputsDefaultValueSet:a,fieldsConfigForApiVersion1:o,apiVersion2:i=!0,isAutoSignInEnabled:b=!0,displayTermsOfUseCheckbox:h=!1,displayNewsletterCheckbox:r=!1,hideCloseBtnOnEmailConfirmation:n=!1,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:L,onSuccessCallback:O,setActiveComponent:w,slots:F})=>{const m=vt({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"}),{passwordConfigs:c,isEmailConfirmationRequired:T}=pt(),{fieldsListConfigs:v}=Mt({fieldsConfigForApiVersion1:o,apiVersion2:i,inputsDefaultValueSet:a}),{inLineAlertProps:d,handleSetInLineAlertProps:M}=Nt(),{isKeepMeLogged:q,userEmail:V,showEmailConfirmationForm:U,isSuccessful:A,isClickSubmit:C,signUpPasswordValue:P,isLoading:B,onSubmitSignUp:W,signInButton:j,handleSetSignUpPasswordValue:Y,onKeepMeLoggedChange:y,handleHideEmailConfirmationForm:$}=Ct({addressesData:t,translations:m,isEmailConfirmationRequired:T,apiVersion2:i,passwordConfigs:c,isAutoSignInEnabled:b,routeRedirectOnSignIn:l,routeSignIn:f,onErrorCallback:L,onSuccessCallback:O,setActiveComponent:w,handleSetInLineAlertProps:M,routeRedirectOnEmailConfirmationClose:u}),{isValidUniqueSymbols:I,defaultLengthMessage:_}=bt({password:P,isClickSubmit:C,passwordConfigs:c}),E=!T&&(t==null?void 0:t.length);return!v.length&&i?s("div",{className:`auth-signUpForm ${e} skeleton-loader`,"data-testid":"SignUpForm",children:s(St,{activeSkeleton:"signUpForm"})}):A.status&&(F!=null&&F.SuccessNotification)?s(ct,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:F==null?void 0:F.SuccessNotification,context:{isSuccessful:A}}):U?s(wt,{formSize:e,userEmail:V,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:n,handleSetInLineAlertProps:M,onPrimaryButtonClick:$}):k("div",{className:lt(["auth-signUpForm",e]),"data-testid":"SignUpForm",children:[s(xt,{text:m.title,bottomLine:!1,className:"auth-signUpForm__title"}),d.text?s(Pt,{className:"auth-signUpForm__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon}):null,k(Lt,{submitCallback:W,className:"auth-signUpForm__form",isLoading:B,name:"signUp_form",fieldsConfig:v,children:[s(Et,{validateLengthConfig:_,className:"auth-signUpForm__form__item",autoComplete:"current-password",name:"password",minLength:c==null?void 0:c.minLength,error:I==="error"||(_==null?void 0:_.status)==="error"||C&&P.length<=0,defaultValue:P,uniqueSymbolsStatus:I,requiredCharacterClasses:c==null?void 0:c.requiredCharacterClasses,onValue:Y,children:E?s("div",{className:"auth-signUpForm__automatic-login",children:s(Q,{children:s(X,{name:"",placeholder:m.keepMeLoggedText,label:m.keepMeLoggedText,checked:q,onChange:y})})}):null}),r||h?k("div",{className:"auth-signUpForm__item auth-signUpForm__checkbox",children:[r?s(Q,{children:s(X,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:m.subscribedDefaultText,label:m.subscribedDefaultText})}):null,h?s(Q,{children:s(X,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:m.privacyPolicyDefaultText,label:m.privacyPolicyDefaultText})}):null]}):null,k("div",{className:"auth-signUpForm-buttons",children:[s(it,{type:"button",variant:"tertiary",style:{padding:0},buttonText:m.buttonSecondary,enableLoader:!1,onClick:j}),s(it,{type:"submit",buttonText:m.buttonPrimary,variant:"primary",enableLoader:B})]})]}),s("div",{id:"createCustomerV2"})]})};export{Zt as S};
@@ -1,4 +1,4 @@
1
- import{f as o,h as r}from"./setReCaptchaToken.js";const t=`
1
+ import{f as o,h as r}from"./network-error.js";const t=`
2
2
  mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
3
3
  confirmEmail(input: {
4
4
  email: $email,
@@ -1,4 +1,4 @@
1
- import{c as o,f as a,h as s}from"./setReCaptchaToken.js";import{t as i}from"./transform-attributes-form.js";import{h as n}from"./getStoreConfig.js";const u=`
1
+ import{f as s,h as a}from"./network-error.js";import{s as n}from"./setReCaptchaToken.js";import{t as i}from"./transform-attributes-form.js";import{h as o}from"./getStoreConfig.js";const u=`
2
2
  mutation CREATE_CUSTOMER($input: CustomerInput!) {
3
3
  createCustomer(input: $input) {
4
4
  customer {
@@ -20,7 +20,7 @@ import{c as o,f as a,h as s}from"./setReCaptchaToken.js";import{t as i}from"./tr
20
20
  }
21
21
  }
22
22
  }
23
- `,p=async(r,t)=>(await o(),await a(t?m:u,{method:"POST",variables:{input:{...r}}}).catch(s)),c=`
23
+ `,_=async(r,t)=>(await n(),await s(t?m:u,{method:"POST",variables:{input:{...r}}}).catch(a)),c=`
24
24
  query GET_ATTRIBUTES_FORM($formCode: String!) {
25
25
  attributesForm(formCode: $formCode) {
26
26
  items {
@@ -44,10 +44,10 @@ import{c as o,f as a,h as s}from"./setReCaptchaToken.js";import{t as i}from"./tr
44
44
  }
45
45
  }
46
46
  }
47
- `,_=async r=>await a(c.replace(/\s+/g," ").trim(),{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?n(t.errors):i(t)}).catch(s),E=`
47
+ `,l=async r=>await s(c.replace(/\s+/g," ").trim(),{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?o(t.errors):i(t)}).catch(a),E=`
48
48
  mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
49
49
  createCustomerAddress(input:$input) {
50
50
  firstname
51
51
  }
52
52
  }
53
- `,l=async r=>await a(E,{method:"POST",variables:{input:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?n(t.errors):t.data.createCustomerAddress.firstname||""}).catch(s);export{l as a,p as c,_ as g};
53
+ `,f=async r=>await s(E,{method:"POST",variables:{input:r}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?o(t.errors):t.data.createCustomerAddress.firstname||""}).catch(a);export{f as a,_ as c,l as g};
@@ -0,0 +1,15 @@
1
+ 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=`
2
+ query GET_CUSTOMER_DATA {
3
+ customer {
4
+ firstname
5
+ lastname
6
+ email
7
+ }
8
+ }
9
+ `,Q=async t=>{if(t){const{authHeaderConfig:m}=U.getConfig();y(m.header,m.tokenPrefix?`${m.tokenPrefix} ${t}`:t)}return await k(H,{method:"GET",cache:"force-cache"}).then(m=>{var r;return(r=m.errors)!=null&&r.length?R(m.errors):F(m)}).catch(x)},S=`
10
+ mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
11
+ generateCustomerToken(email: $email, password: $password) {
12
+ token
13
+ }
14
+ }
15
+ `,J=async({email:t,password:m,translations:r,onErrorCallback:e,handleSetInLineAlertProps:c})=>{var E,N,d,$,M,G,w;await K();const a=await k(S,{method:"POST",variables:{email:t,password:m}}).catch(x);if(!((N=(E=a==null?void 0:a.data)==null?void 0:E.generateCustomerToken)!=null&&N.token)){const o=r.customerTokenErrorMessage,u=a!=null&&a.errors?a.errors[0].message:o;return e==null||e(u),c==null||c({type:"error",text:u}),T((d=g)==null?void 0:d.SIGN_IN,{}),{errorMessage:u,userName:""}}const f=(M=($=a==null?void 0:a.data)==null?void 0:$.generateCustomerToken)==null?void 0:M.token,i=await Q(f);if(!(i!=null&&i.firstname)||!(i!=null&&i.email)){const o=r.customerTokenErrorMessage;return e==null||e(o),c==null||c({type:"error",text:o}),T((G=g)==null?void 0:G.SIGN_IN,{}),{errorMessage:o,userName:""}}const h=i==null?void 0:i.firstname,s=i==null?void 0:i.email,_=await v();return document.cookie=`${O.auth_dropin_firstname}=${h}; path=/; ${_}; `,document.cookie=`${O.auth_dropin_user_token}=${f}; path=/; ${_}; `,D.emit("authenticated",!!f),T((w=g)==null?void 0:w.SIGN_IN,s?{email:s}:{}),{errorMessage:"",userName:h}};export{J as a,Q as g};
@@ -1,18 +1,4 @@
1
- import{a as y,f as h,h as C,c as M}from"./setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import{events as A}from"@dropins/tools/event-bus.js";import{c as D}from"./initialize.js";const U=t=>({personalEmail:{address:(t==null?void 0:t.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(t==null?void 0:t.store_code)||""}}}),R=t=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(t==null?void 0:t.store_code)||""}}}),v=t=>({personalEmail:{address:(t==null?void 0:t.email)||""},userAccount:{updateProfile:t==null?void 0:t.updateProfile},commerce:{commerceScope:{storeCode:(t==null?void 0:t.store_code)||""}}}),I={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},g=3600,q=t=>{var e,a,o,r,c,m,n,u,s,f;return{autocompleteOnStorefront:((a=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:a.autocomplete_on_storefront)||!1,minLength:((r=(o=t==null?void 0:t.data)==null?void 0:o.storeConfig)==null?void 0:r.minimum_password_length)||3,requiredCharacterClasses:+((m=(c=t==null?void 0:t.data)==null?void 0:c.storeConfig)==null?void 0:m.required_character_classes_number)||0,createAccountConfirmation:((u=(n=t==null?void 0:t.data)==null?void 0:n.storeConfig)==null?void 0:u.create_account_confirmation)||!1,customerAccessTokenLifetime:((f=(s=t==null?void 0:t.data)==null?void 0:s.storeConfig)==null?void 0:f.customer_access_token_lifetime)*g||g}},F=t=>{var e,a,o,r,c,m;return{email:((a=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:a.email)||"",firstname:((r=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:r.firstname)||"",lastname:((m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.lastname)||""}},$=t=>{const e=t.map(a=>a.message).join(" ");throw Error(e)},b=`
2
- query GET_CUSTOMER_DATA {
3
- customer {
4
- firstname
5
- lastname
6
- email
7
- }
8
- }
9
- `,J=async t=>{if(t){const{authHeaderConfig:e}=D.getConfig();y(e.header,e.tokenPrefix?`${e.tokenPrefix} ${t}`:t)}return await h(b,{method:"GET",cache:"force-cache"}).then(e=>{var a;return(a=e.errors)!=null&&a.length?$(e.errors):F(e)}).catch(C)},K=`
10
- mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
11
- generateCustomerToken(email: $email, password: $password) {
12
- token
13
- }
14
- }
15
- `,L=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},H=async()=>{try{const t=sessionStorage.getItem("storeConfig");let a=(t?JSON.parse(t):{}).customerAccessTokenLifetime;if(!a){const o=await z();sessionStorage.setItem("storeConfig",JSON.stringify(o)),a=(o==null?void 0:o.customerAccessTokenLifetime)||g}return`Max-Age=${a}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${g}`}};var i=(t=>(t.CREATE_ACCOUNT_EVENT="create-account",t.SIGN_IN="sign-in",t.SIGN_OUT="sign-out",t))(i||{});const E="authContext",N={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function S(t,e){const a=window.adobeDataLayer||[];a.push({[t]:null}),a.push({[t]:e})}function O(t){(window.adobeDataLayer||[]).push(a=>{const o=a.getState?a.getState():{};a.push({event:t,eventInfo:{...o}})})}function Q(t){const e=v(t);S(E,e),O(N.CREATE_ACCOUNT)}function j(t){const e=U(t);S(E,e),O(N.SIGN_IN)}function V(t){const e=R(t);S(E,e),O(N.SIGN_OUT)}const T=(t,e)=>{const a=sessionStorage.getItem("storeConfig"),r={...a?JSON.parse(a):{},...e};switch(t){case"create-account":Q(r);break;case"sign-in":j(r);break;case"sign-out":V(r);break;default:return null}},P=async({email:t,password:e,translations:a,onErrorCallback:o,handleSetInLineAlertProps:r})=>{var k,G,w,l;await M();const c=await h(K,{method:"POST",variables:{email:t,password:e}}).catch(C);if(!((G=(k=c==null?void 0:c.data)==null?void 0:k.generateCustomerToken)!=null&&G.token)){const _=a.customerTokenErrorMessage,d=c!=null&&c.errors?c.errors[0].message:_;return o==null||o(d),r==null||r({type:"error",text:d}),T(i==null?void 0:i.SIGN_IN,{}),{errorMessage:d,userName:""}}const m=(l=(w=c==null?void 0:c.data)==null?void 0:w.generateCustomerToken)==null?void 0:l.token,n=await J(m);if(!(n!=null&&n.firstname)||!(n!=null&&n.email)){const _=a.customerTokenErrorMessage;return o==null||o(_),r==null||r({type:"error",text:_}),T(i==null?void 0:i.SIGN_IN,{}),{errorMessage:_,userName:""}}const u=n==null?void 0:n.firstname,s=n==null?void 0:n.email,f=await H();return document.cookie=`${I.auth_dropin_firstname}=${u}; path=/; ${f}; `,document.cookie=`${I.auth_dropin_user_token}=${m}; path=/; ${f}; `,A.emit("authenticated",!!m),T(i==null?void 0:i.SIGN_IN,s?{email:s}:{}),{errorMessage:"",userName:u}},X=`
1
+ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h}from"./network-error.js";const E=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)||""}}}),T=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"},n=3600,N=e=>{var t,o,r,a,m,_,f,g,C,d;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:((d=(C=e==null?void 0:e.data)==null?void 0:C.storeConfig)==null?void 0:d.customer_access_token_lifetime)*n||n}},A=e=>{const t=e.map(o=>o.message).join(" ");throw Error(t)},p=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},U=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)||n}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${n}`}};var I=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(I||{});const c="authContext",s={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function i(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function u(e){(window.adobeDataLayer||[]).push(o=>{const r=o.getState?o.getState():{};o.push({event:e,eventInfo:{...r}})})}function O(e){const t=T(e);i(c,t),u(s.CREATE_ACCOUNT)}function k(e){const t=E(e);i(c,t),u(s.SIGN_IN)}function w(e){const t=S(e);i(c,t),u(s.SIGN_OUT)}const R=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),a={...o?JSON.parse(o):{},...t};switch(e){case"create-account":O(a);break;case"sign-in":k(a);break;case"sign-out":w(a);break;default:return null}},G=`
16
2
  query GET_STORE_CONFIG {
17
3
  storeConfig {
18
4
  autocomplete_on_storefront
@@ -26,4 +12,4 @@ import{a as y,f as h,h as C,c as M}from"./setReCaptchaToken.js";import"@dropins/
26
12
  customer_access_token_lifetime
27
13
  }
28
14
  }
29
- `,z=async()=>await h(X,{method:"GET",cache:"force-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?$(t.errors):q(t)}).catch(C);export{I as C,i as E,P as a,z as b,L as d,J as g,$ as h,T as p};
15
+ `,b=async()=>await l(G,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?A(e.errors):N(e)}).catch(h);export{D as C,I as E,U as a,p as d,b as g,A as h,R as p};
package/chunks/index.js CHANGED
@@ -1 +1 @@
1
- import{R as F,R as P}from"./ResetPasswordForm.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"./requestPasswordResetEmail.js";import"./setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{F as ResetPasswordForm,P as default};
1
+ import{R as P,R as b}from"./ResetPasswordForm.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"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{P as ResetPasswordForm,b as default};
package/chunks/index2.js CHANGED
@@ -1 +1 @@
1
- import{S as c,S as h}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/event-bus.js";import"./getStoreConfig.js";import"./setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"./initialize.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./confirmEmail.js";import"./EmailConfirmationForm.js";export{c as SignInForm,h as default};
1
+ import{S as j,S as k}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.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";import"./EmailConfirmationForm.js";export{j as SignInForm,k as default};
package/chunks/index3.js CHANGED
@@ -1 +1 @@
1
- import{S as j,S as k}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"./setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"./transform-attributes-form.js";import"./getStoreConfig.js";import"./initialize.js";import"@dropins/tools/preact-hooks.js";import"./simplifyTransformAttributesForm.js";import"./usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"./useInLineAlert.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"./SkeletonLoader.js";import"./EmailConfirmationForm.js";import"./resendConfirmationEmail.js";export{j as SignUpForm,k as default};
1
+ import{S as q,S as v}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"./useInLineAlert.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"./SkeletonLoader.js";import"./EmailConfirmationForm.js";import"./resendConfirmationEmail.js";export{q as SignUpForm,v as default};
@@ -0,0 +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,5 +1,5 @@
1
- import{c as m,f as l,h as e}from"./setReCaptchaToken.js";const c=a=>{var r,E,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(E=a==null?void 0:a.errors[0])==null?void 0:E.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},R=`
1
+ 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=`
2
2
  mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
3
3
  requestPasswordResetEmail(email: $email)
4
4
  }
5
- `,h=async a=>(await m(),await l(R,{method:"POST",variables:{email:a}}).then(t=>c(t)).catch(e));export{h as r};
5
+ `,o=async a=>(await e(),await E(c,{method:"POST",variables:{email:a}}).then(t=>R(t)).catch(l));export{o as r};
@@ -1,4 +1,4 @@
1
- import{f as r,h as e}from"./setReCaptchaToken.js";const i=`
1
+ import{f as r,h as e}from"./network-error.js";const i=`
2
2
  mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
3
3
  resendConfirmationEmail(email: $email)
4
4
  }`,n=async a=>await r(i,{method:"POST",variables:{email:a}}).catch(e);export{n as r};
@@ -1,5 +1,5 @@
1
- import{c as w,f as o,h as d}from"./setReCaptchaToken.js";const P=`
1
+ import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=`
2
2
  mutation RESET_PASSWORD($email: String!, $resetPasswordToken: String!, $newPassword: String!){
3
3
  resetPassword(email: $email,resetPasswordToken: $resetPasswordToken,newPassword: $newPassword)
4
4
  }
5
- `,i=a=>{var r,s,e;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(s=a==null?void 0:a.errors[0])==null?void 0:s.message),{message:t,success:!!((e=a==null?void 0:a.data)!=null&&e.resetPassword)}},m=async(a,t,r)=>(await w(),await o(P,{method:"POST",variables:{email:a,resetPasswordToken:t,newPassword:r}}).then(s=>i(s)).catch(d));export{m as r};
5
+ `,P=a=>{var r,s,e;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(s=a==null?void 0:a.errors[0])==null?void 0:s.message),{message:t,success:!!((e=a==null?void 0:a.data)!=null&&e.resetPassword)}},S=async(a,t,r)=>(await d(),await o(i,{method:"POST",variables:{email:a,resetPasswordToken:t,newPassword:r}}).then(s=>P(s)).catch(w));export{S as r};
@@ -0,0 +1,8 @@
1
+ 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=`
2
+ mutation REVOKE_CUSTOMER_TOKEN {
3
+ revokeCustomerToken {
4
+ result
5
+ }
6
+ }
7
+ `,_=async()=>await u(h,{method:"POST"}).then(t=>{const e=k(t);if(e!=null&&e.success)[m.auth_dropin_user_token,m.auth_dropin_firstname].forEach(r=>{s(r)}),i.emit("authenticated",!1),c(E.SIGN_OUT,{logoutAttempt:!0});else{const r=`
8
+ ERROR revokeCustomerToken: ${e.message}`;console.error(r)}return e}).catch(n);export{_ as r};
@@ -1 +1 @@
1
- import{events as t}from"@dropins/tools/event-bus.js";import{verifyReCaptcha as r}from"@dropins/tools/recaptcha.js";import{FetchGraphQL as o}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:p,setFetchGraphQlHeader:a,removeFetchGraphQlHeader:i,setFetchGraphQlHeaders:f,fetchGraphQl:m,getConfig:d}=new o().getMethods(),l=e=>{throw e instanceof DOMException&&e.name==="AbortError"||t.emit("error",{source:"auth",type:"network",error:e}),e},E=async()=>{const e=await r();e?a("X-ReCaptcha",e):console.error("ReCaptcha Token not received")};export{a,f as b,E as c,m as f,d as g,l as h,i as r,p as s};
1
+ import{verifyReCaptcha as a}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{a as t}from"./network-error.js";const s=async()=>{const e=await a();e?t("X-ReCaptcha",e):console.error("ReCaptcha Token not received")};export{s};
@@ -1 +1 @@
1
- import{jsxs as C,jsx as o,Fragment as F}from"@dropins/tools/preact-jsx-runtime.js";import{useCallback as _,useRef as V,useState as L,useEffect as M}from"@dropins/tools/preact-hooks.js";import{classes as k}from"@dropins/tools/lib.js";import{Button as S,Field as m,Picker as y,Input as T,InputDate as N,Checkbox as A,TextArea as H}from"@dropins/tools/components.js";import{initReCaptcha as I}from"@dropins/tools/recaptcha.js";import{useText as q}from"@dropins/tools/i18n.js";import*as f from"@dropins/tools/preact-compat.js";import{memo as D,useCallback as x}from"@dropins/tools/preact-compat.js";const Y=r=>{if(!r)return null;const s=new FormData(r);if(s&&typeof s.entries=="function"){const i=s.entries();if(i&&typeof i[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(i)))||{}}return{}},ee=r=>typeof r=="function",re=({type:r,buttonText:s,variant:i,className:c="",enableLoader:a=!1,onClick:d,style:p,icon:l,...E})=>{const g=_(v=>{d==null||d(v)},[d]);return C(S,{icon:l,style:p,type:r,variant:i,className:k(["auth-button",c,a?"enableLoader":""]),onClick:g,...E,children:[o("span",{className:"auth-button__text",children:s}),a?o("div",{className:"auth-button__loader-wrapper",children:o("span",{className:"auth-button__loader"})}):null]})},O=({fieldsConfig:r,submitCallback:s})=>{const{requiredFieldError:i}=q({requiredFieldError:"Auth.FormText.requiredFieldError"}),c=V(null),[a,d]=L(r.reduce((h,{code:e,required:t,defaultValue:n})=>(t&&(h[e]=n),h),{})),[p,l]=L({}),E=_((h,e)=>{const t=r.find(u=>u.code===h);return t!=null&&t.required&&!e?i:""},[r,i]),g=_(h=>{const{name:e,value:t,type:n,checked:u}=h==null?void 0:h.target,$=n==="checkbox"?u:t;d(w=>({...w,[e]:$}))},[]);M(()=>{I()},[]);const b=_(h=>{const{name:e,value:t,type:n,checked:u}=h==null?void 0:h.target,$=n==="checkbox"?u:t;l(w=>({...w,[e]:E(e,$)}))},[E]),v=_(h=>{h.preventDefault();let e=!0,t={},n=null;for(const[u,$]of Object.entries(a)){const w=E(u,$);w&&(t[u]=w,e=!1,n||(n=u))}if(l(t),n&&c.current){const u=c.current.elements.namedItem(n);u==null||u.focus()}s==null||s(h,e)},[a,E,s]);return{formData:a,errors:p,formRef:c,handleChange:g,handleBlur:b,handleSubmit:v}},Z=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:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),R=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)"})))),P=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"})),B=D(({isLoading:r,values:s,fields:i=[],errors:c,className:a="",onChange:d,onBlur:p})=>{const l=`${a}__item`,E=x((e,t,n)=>{const u=e.options.map($=>({text:$.label,value:$.value}));return o(m,{error:n,className:k([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:o(y,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:u,onBlur:p,handleSelect:d,value:t||e.defaultValue})},e.id)},[a,r,l,p,d]),g=x((e,t,n)=>{const u=e.id==="email",$=u?o(Z,{}):void 0,w=u?"username":"";return o(m,{error:n,className:k([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:o(T,{autoComplete:w,icon:$,type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id)},[a,r,l,p,d]),b=x((e,t,n)=>o(m,{error:n,className:k([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:o(N,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[a,r,l,p,d]),v=x((e,t,n)=>o(m,{error:n,className:k([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:o(A,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[a,r,l,p,d]),h=x((e,t,n)=>o(m,{error:n,className:k([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:o(H,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[a,r,l,p,d]);return i.length?o(F,{children:i.map(e=>{const t=(c==null?void 0:c[e.id])??"",n=(s==null?void 0:s[e.id])??"";switch(e.fieldType){case"TEXT":return e.options.length?E(e,n,t):g(e,n,t);case"MULTILINE":return g(e,n,t);case"SELECT":return E(e,n,t);case"DATE":return b(e,n,t);case"BOOLEAN":return v(e,n,t);case"TEXTAREA":return h(e,n,t);default:return null}})}):null}),te=({name:r,isLoading:s,children:i,className:c="defaultForm",fieldsConfig:a=[],submitCallback:d})=>{const{formData:p,errors:l,formRef:E,handleChange:g,handleBlur:b,handleSubmit:v}=O({submitCallback:d,fieldsConfig:a});return C("form",{onSubmit:v,className:c,name:r,ref:E,children:[o(B,{fields:a,onChange:g,onBlur:b,errors:l,values:p,className:c,isLoading:s}),i]})},ne=({children:r,text:s,bottomLine:i=!0,className:c})=>C("div",{className:k(["auth-title",c]),"data-testid":"auth-title_id",children:[C("div",{className:"auth-title__text",children:[o("h1",{className:"auth-title__heading",children:s}),r]}),i?o("div",{className:"auth-title__hr"}):null]}),W={success:o(P,{}),warning:o(R,{}),error:o(j,{})},le=()=>{const[r,s]=L({}),i=_(c=>{if(!c||!c.type)return;const a=W[c.type];s({...c,icon:a})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:i}};export{re as B,te as F,ne as T,ee as c,Y as g,le as u};
1
+ import{jsxs as L,jsx as c,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{useCallback as m,useRef as M,useState as C,useEffect as F}from"@dropins/tools/preact-hooks.js";import{classes as k}from"@dropins/tools/lib.js";import{Button as S,Field as _,Picker as y,Input as T,InputDate as N,Checkbox as A,TextArea as D}from"@dropins/tools/components.js";import{initReCaptcha as H}from"@dropins/tools/recaptcha.js";import{useText as I}from"@dropins/tools/i18n.js";import*as h from"@dropins/tools/preact-compat.js";import{memo as q,useCallback as x}from"@dropins/tools/preact-compat.js";const ee=r=>{if(!r)return null;const o=new FormData(r);if(o&&typeof o.entries=="function"){const u=o.entries();if(u&&typeof u[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(u)))||{}}return{}},re=r=>typeof r=="function",te=({type:r,buttonText:o,variant:u,className:s="",enableLoader:l=!1,onClick:d,style:p,icon:n,...E})=>{const w=m(v=>{d==null||d(v)},[d]);return L(S,{icon:n,style:p,type:r,variant:u,className:k(["auth-button",s,l?"enableLoader":""]),onClick:w,...E,children:[c("span",{className:"auth-button__text",children:o}),l?c("div",{className:"auth-button__loader-wrapper",children:c("span",{className:"auth-button__loader"})}):null]})},O=r=>r.reduce((o,{code:u,required:s,defaultValue:l})=>(s&&(o[u]=l),o),{}),Z=({fieldsConfig:r,submitCallback:o})=>{const{requiredFieldError:u}=I({requiredFieldError:"Auth.FormText.requiredFieldError"}),s=M(null),[l,d]=C({}),[p,n]=C({});F(()=>{if(!r.length)return;const f=O(r);d(f)},[r==null?void 0:r.length]);const E=m((f,e)=>{const t=r.find(i=>i.code===f);return t!=null&&t.required&&!e?u:""},[r,u]),w=m(f=>{const{name:e,value:t,type:a,checked:i}=f==null?void 0:f.target,$=a==="checkbox"?i:t;d(g=>({...g,[e]:$}))},[]);F(()=>{H()},[]);const b=m(f=>{const{name:e,value:t,type:a,checked:i}=f==null?void 0:f.target,$=a==="checkbox"?i:t;n(g=>({...g,[e]:E(e,$)}))},[E]),v=m(f=>{f.preventDefault();let e=!0,t={},a=null;for(const[i,$]of Object.entries(l)){const g=E(i,$);g&&(t[i]=g,e=!1,a||(a=i))}if(n(t),a&&s.current){const i=s.current.elements.namedItem(a);i==null||i.focus()}o==null||o(f,e)},[l,E,o]);return{formData:l,errors:p,formRef:s,handleChange:w,handleBlur:b,handleSubmit:v}},R=r=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),P=r=>h.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},h.createElement("g",{clipPath:"url(#clip0_841_1324)"},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),h.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"})),h.createElement("defs",null,h.createElement("clipPath",{id:"clip0_841_1324"},h.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),j=r=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},h.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"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),B=r=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},h.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"}),h.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"})),W=q(({isLoading:r,values:o,fields:u=[],errors:s,className:l="",onChange:d,onBlur:p})=>{const n=`${l}__item`,E=x((e,t,a)=>{const i=e.options.map($=>({text:$.label,value:$.value}));return c(_,{error:a,className:k([n,`${n}--${e.id}`,[`${n}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${l}--${e.id}`,disabled:r,children:c(y,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:i,onBlur:p,handleSelect:d,value:t||e.defaultValue})},e.id)},[l,r,n,p,d]),w=x((e,t,a)=>{const i=e.id==="email",$=i?c(R,{}):void 0,g=i?"username":"";return c(_,{error:a,className:k([n,`${n}--${e.id}`,[`${n}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${l}--${e.id}`,disabled:r,children:c(T,{autoComplete:g,icon:$,type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id)},[l,r,n,p,d]),b=x((e,t,a)=>c(_,{error:a,className:k([n,`${n}--${e.id}`,[`${n}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${l}--${e.id}`,disabled:r,children:c(N,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[l,r,n,p,d]),v=x((e,t,a)=>c(_,{error:a,className:k([n,`${n}--${e.id}`,[`${n}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${l}--${e.id}`,disabled:r,children:c(A,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[l,r,n,p,d]),f=x((e,t,a)=>c(_,{error:a,className:k([n,`${n}--${e.id}`,[`${n}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${l}--${e.id}`,disabled:r,children:c(D,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[l,r,n,p,d]);return u.length?c(V,{children:u.map(e=>{const t=(s==null?void 0:s[e.id])??"",a=(o==null?void 0:o[e.id])??"";switch(e.fieldType){case"TEXT":return e.options.length?E(e,a,t):w(e,a,t);case"MULTILINE":return w(e,a,t);case"SELECT":return E(e,a,t);case"DATE":return b(e,a,t);case"BOOLEAN":return v(e,a,t);case"TEXTAREA":return f(e,a,t);default:return null}})}):null}),ne=({name:r,isLoading:o,children:u,className:s="defaultForm",fieldsConfig:l=[],submitCallback:d})=>{const{formData:p,errors:n,formRef:E,handleChange:w,handleBlur:b,handleSubmit:v}=Z({submitCallback:d,fieldsConfig:l});return L("form",{onSubmit:v,className:s,name:r,ref:E,children:[c(W,{fields:l,onChange:w,onBlur:b,errors:n,values:p,className:s,isLoading:o}),u]})},ae=({children:r,text:o,bottomLine:u=!0,className:s})=>L("div",{className:k(["auth-title",s]),"data-testid":"auth-title_id",children:[L("div",{className:"auth-title__text",children:[c("h1",{className:"auth-title__heading",children:o}),r]}),u?c("div",{className:"auth-title__hr"}):null]}),J={success:c(j,{}),warning:c(P,{}),error:c(B,{})},le=()=>{const[r,o]=C({}),u=m(s=>{if(!s||!s.type)return;const l=J[s.type];o({...s,icon:l})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:u}};export{te as B,ne as F,ae as T,re as c,ee as g,le as u};
@@ -1 +1 @@
1
- import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{b 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<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
1
+ 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<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
@@ -1 +1 @@
1
- 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"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"../chunks/requestPasswordResetEmail.js";import"../chunks/setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";const j=({formSize:o,routeSignIn:t,onErrorCallback:m})=>r("div",{className:"auth-reset-password",children:r(i,{formSize:o,routeSignIn:t,onErrorCallback:m})});export{j as ResetPassword,j as default};
1
+ 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"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"../chunks/requestPasswordResetEmail.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";const v=({formSize:o,routeSignIn:t,onErrorCallback:m})=>r("div",{className:"auth-reset-password",children:r(i,{formSize:o,routeSignIn:t,onErrorCallback:m})});export{v as ResetPassword,v as default};
@@ -1 +1 @@
1
- import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S as l}from"../chunks/SignInForm.js";import"@dropins/tools/lib.js";import"../chunks/useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/event-bus.js";import"../chunks/getStoreConfig.js";import"../chunks/setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/confirmEmail.js";import"../chunks/EmailConfirmationForm.js";const E=({enableEmailConfirmation:i,initialEmailValue:o,formSize:t,renderSignUpLink:m,hideCloseBtnOnEmailConfirmation:p,routeRedirectOnEmailConfirmationClose:n,routeRedirectOnSignIn:s,routeForgotPassword:a,routeSignUp:e,onSuccessCallback:c,onErrorCallback:d,onSignUpLinkClick:f,successNotificationForm:g})=>r("div",{className:"auth-sign-in",children:r(l,{formSize:t,renderSignUpLink:m,initialEmailValue:o,enableEmailConfirmation:i,hideCloseBtnOnEmailConfirmation:p,routeRedirectOnEmailConfirmationClose:n,routeSignUp:e,onErrorCallback:d,onSuccessCallback:c,onSignUpLinkClick:f,routeForgotPassword:a,routeRedirectOnSignIn:s,successNotificationForm:g})});export{E as SignIn,E as default};
1
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S as l}from"../chunks/SignInForm.js";import"@dropins/tools/lib.js";import"../chunks/useInLineAlert.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.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";import"../chunks/EmailConfirmationForm.js";const H=({slots:i,enableEmailConfirmation:o,initialEmailValue:t,formSize:m,renderSignUpLink:p,hideCloseBtnOnEmailConfirmation:n,routeRedirectOnEmailConfirmationClose:s,routeRedirectOnSignIn:a,routeForgotPassword:e,routeSignUp:c,onSuccessCallback:d,onErrorCallback:f,onSignUpLinkClick:g})=>r("div",{className:"auth-sign-in",children:r(l,{slots:i,formSize:m,renderSignUpLink:p,initialEmailValue:t,enableEmailConfirmation:o,hideCloseBtnOnEmailConfirmation:n,routeRedirectOnEmailConfirmationClose:s,routeSignUp:c,onErrorCallback:f,onSuccessCallback:d,onSignUpLinkClick:g,routeForgotPassword:e,routeRedirectOnSignIn:a})});export{H as SignIn,H as default};
@@ -1 +1 @@
1
- import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S}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/setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/getStoreConfig.js";import"../chunks/initialize.js";import"@dropins/tools/preact-hooks.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"../chunks/useInLineAlert.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"../chunks/SkeletonLoader.js";import"../chunks/EmailConfirmationForm.js";import"../chunks/resendConfirmationEmail.js";const J=({formSize:i,apiVersion2:o,addressesData:t,isAutoSignInEnabled:m,inputsDefaultValueSet:p,displayNewsletterCheckbox:s,displayTermsOfUseCheckbox:a,fieldsConfigForApiVersion1:n,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,successNotificationForm:d,onSuccessCallback:f,onErrorCallback:g,routeSignIn:l})=>r("div",{className:"auth-sign-up",children:r(S,{formSize:i,apiVersion2:o,addressesData:t,isAutoSignInEnabled:m,inputsDefaultValueSet:p,fieldsConfigForApiVersion1:n,displayNewsletterCheckbox:s,displayTermsOfUseCheckbox:a,hideCloseBtnOnEmailConfirmation:e,routeRedirectOnEmailConfirmationClose:u,routeRedirectOnSignIn:c,routeSignIn:l,successNotificationForm:d,onErrorCallback:g,onSuccessCallback:f})});export{J as SignUp,J as default};
1
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{S}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/useInLineAlert.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"../chunks/SkeletonLoader.js";import"../chunks/EmailConfirmationForm.js";import"../chunks/resendConfirmationEmail.js";const L=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:s,displayNewsletterCheckbox:a,displayTermsOfUseCheckbox:n,fieldsConfigForApiVersion1:e,hideCloseBtnOnEmailConfirmation:u,routeRedirectOnEmailConfirmationClose:c,routeRedirectOnSignIn:d,onSuccessCallback:f,onErrorCallback:g,routeSignIn:l})=>r("div",{className:"auth-sign-up",children:r(S,{formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:s,fieldsConfigForApiVersion1:e,displayNewsletterCheckbox:a,displayTermsOfUseCheckbox:n,hideCloseBtnOnEmailConfirmation:u,routeRedirectOnEmailConfirmationClose:c,routeRedirectOnSignIn:d,routeSignIn:l,slots:i,onErrorCallback:g,onSuccessCallback:f})});export{L as SignUp,L as default};
@@ -1 +1 @@
1
- import{jsxs as l,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{classes as f}from"@dropins/tools/lib.js";import{Button as u}from"@dropins/tools/components.js";const m=({formSize:o="default",className:s="",headingText:a="",messageText:e="",primaryButtonText:i="",secondaryButtonText:c="",onPrimaryButtonClick:n,onSecondaryButtonClick:r})=>!i&&!c?null:l("div",{className:f(["auth-successNotificationForm",o,s]),children:[t("p",{className:"auth-successNotificationForm__title","data-testid":"notification-title",children:a}),t("p",{className:"auth-successNotificationForm__content-text","data-testid":"notification-content",children:e}),t(u,{type:"button",className:"auth-successNotificationForm__button auth-successNotificationForm__button--top",onClick:n,children:i}),t(u,{type:"button",variant:"tertiary",onClick:r,children:c})]}),p=({formSize:o="default",className:s,headingText:a,messageText:e,primaryButtonText:i,secondaryButtonText:c,onPrimaryButtonClick:n,onSecondaryButtonClick:r})=>t("div",{className:"auth-success-notification",children:t(m,{formSize:o,className:s,headingText:a,messageText:e,primaryButtonText:i,secondaryButtonText:c,onPrimaryButtonClick:n,onSecondaryButtonClick:r})});export{p as SuccessNotification,p as default};
1
+ import{jsxs as s,jsx as i,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m,Slot as d}from"@dropins/tools/lib.js";import{Button as r}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 h}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getStoreConfig.js";const p=({formSize:e="default",className:c="",slots:t,headingText:a,messageText:n})=>{const o=h({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return s("div",{className:m(["auth-successNotificationForm",e,c]),children:[i("p",{className:"auth-successNotificationForm__title","data-testid":"notification-title",children:a||o.headingText}),i("p",{className:"auth-successNotificationForm__content-text","data-testid":"notification-content",children:n||o.messageText}),t!=null&&t.SuccessNotificationActions?i(d,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:t==null?void 0:t.SuccessNotificationActions,context:{}}):s(u,{children:[i(r,{"data-testid":"primaryButton",type:"button",className:"auth-successNotificationForm__button auth-successNotificationForm__button--top",onClick:()=>window.location.href="/",children:o.primaryButtonText}),i(r,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await f(),window.location.href="/"},children:o.secondaryButtonText})]})]})},F=({formSize:e="default",slots:c,className:t,headingText:a,messageText:n})=>i("div",{className:"auth-success-notification",children:i(p,{formSize:e,className:t,slots:c,headingText:a,messageText:n})});export{F as SuccessNotification,F as default};
@@ -1 +1 @@
1
- import{jsxs as k,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as g}from"@dropins/tools/lib.js";import{v as z,u as H,a as J}from"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as K}from"../chunks/getStoreConfig.js";import{r as Q}from"../chunks/resetPassword.js";import{c as V,g as X,u as Y,T as Z,F as $,B as W}from"../chunks/useInLineAlert.js";import{useState as h,useEffect as E,useCallback as S}from"@dropins/tools/preact-hooks.js";import{useText as B}from"@dropins/tools/i18n.js";import{InLineAlert as O,InputPassword as C}from"@dropins/tools/components.js";import"../chunks/setReCaptchaToken.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"@dropins/tools/preact-compat.js";const j=(r,n)=>r.split("&").filter(a=>a.includes(n)).map(a=>a.split("=")[1])[0],R=({isEmailConfirmationRequired:r,signInOnSuccess:n,passwordConfigs:e,routeRedirectOnSignIn:a,routeWrongUrlRedirect:d,onErrorCallback:o,onSuccessCallback:l,handleSetInLineAlertProps:i,routeRedirectOnPasswordUpdate:f})=>{const t=B({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,P]=h({userName:"",status:!1}),[L,N]=h(""),[_,x]=h(!1),[p,b]=h(""),[y,v]=h(""),[w,F]=h(!1);E(()=>{const{search:c}=window.location;!c.includes("token=")&&!c.includes("email=")&&V(d)&&(window.location.href=d());const s=decodeURIComponent(c),T=j(s,"token"),q=j(s,"email");b(q),v(T)},[d]);const D=S(async c=>{c.preventDefault(),F(!0);const s=X(c.target),T=(s==null?void 0:s.password)&&p&&y,q=(e==null?void 0:e.requiredCharacterClasses)||0,G=(e==null?void 0:e.minLength)||0;if(!z(s==null?void 0:s.password,q)||s.password.length<+G){x(!0),F(!1);return}if(!T){i({type:"error",text:t.errorNotification}),F(!1);return}const{message:A,success:M}=await Q(p,y,s.password);if(M){if(r||!r&&!n){V(f)&&(window.location.href=f()),x(!0),F(!1),i({type:"success",text:t.updatePasswordMessage}),N("");return}const u=await K({email:p,password:s.password,handleSetInLineAlertProps:i,onErrorCallback:o,translations:t});u!=null&&u.userName&&(V(a)?window.location.href=a():(P({userName:u==null?void 0:u.userName,status:!0}),l==null||l(u==null?void 0:u.userName)))}else i({type:"error",text:A}),o==null||o({message:A,success:M});F(!1)},[p,y,e,r,t,n,i,a,f,o,l]),I=S(c=>{N(c)},[]);return{isSuccessful:U,updatePasswordValue:L,isClickSubmit:_,isLoading:w,submitUpdatePassword:D,handleSetUpdatePasswordValue:I}},tt=({signInOnSuccess:r=!0,formSize:n="default",routeRedirectOnSignIn:e,routeWrongUrlRedirect:a,successNotificationForm:d,onErrorCallback:o,onSuccessCallback:l,routeRedirectOnPasswordUpdate:i})=>{const f=B({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary"}),{passwordConfigs:t,isEmailConfirmationRequired:U}=H(),{inLineAlertProps:P,handleSetInLineAlertProps:L}=Y(),{isSuccessful:N,updatePasswordValue:_,isClickSubmit:x,isLoading:p,submitUpdatePassword:b,handleSetUpdatePasswordValue:y}=R({isEmailConfirmationRequired:U,signInOnSuccess:r,passwordConfigs:t,routeRedirectOnSignIn:e,routeWrongUrlRedirect:a,onErrorCallback:o,onSuccessCallback:l,handleSetInLineAlertProps:L,routeRedirectOnPasswordUpdate:i}),{isValidUniqueSymbols:v,defaultLengthMessage:w}=J({password:_,isClickSubmit:x,passwordConfigs:t});return d&&N.status?d(N.userName):k("div",{className:g(["auth-updatePasswordForm",n]),children:[m(Z,{text:f.title,bottomLine:!1,className:"auth-updatePasswordForm__title"}),P.text?m(O,{className:"auth-updatePasswordForm__notification",variant:"secondary",heading:P.text,icon:P.icon}):null,k($,{name:"updatePassword_form",className:"auth-updatePasswordForm__form",submitCallback:b,isLoading:p,fieldsConfig:[],children:[m("div",{style:"display: none;",children:m("input",{type:"text",id:"username",name:"username",autocomplete:"username"})}),m(C,{defaultValue:_,onValue:y,className:"auth-updatePasswordForm__form__item",autoComplete:"new-password",name:"password",required:!0,error:v==="error"||(w==null?void 0:w.status)==="error",minLength:t==null?void 0:t.minLength,uniqueSymbolsStatus:v,validateLengthConfig:w,requiredCharacterClasses:t==null?void 0:t.requiredCharacterClasses}),m("div",{className:"auth-updatePasswordForm__button",children:m(W,{type:"submit",buttonText:f.buttonPrimary,variant:"primary",enableLoader:p})})]})]})},ht=({formSize:r,signInOnSuccess:n,routeRedirectOnPasswordUpdate:e,routeRedirectOnSignIn:a,routeWrongUrlRedirect:d,successNotificationForm:o,onErrorCallback:l,onSuccessCallback:i})=>m("div",{className:"auth-update-password",children:m(tt,{formSize:r,signInOnSuccess:n,routeRedirectOnSignIn:a,routeWrongUrlRedirect:d,onErrorCallback:l,onSuccessCallback:i,successNotificationForm:o,routeRedirectOnPasswordUpdate:e})});export{ht as UpdatePassword,ht as default};
1
+ import{jsx as i,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as g,classes as z}from"@dropins/tools/lib.js";import{v as H,u as J,a as K}from"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as Q}from"../chunks/getCustomerToken.js";import{r as X}from"../chunks/resetPassword.js";import{c as S,g as Y,u as Z,T as $,F as W,B as E}from"../chunks/useInLineAlert.js";import{useState as h,useEffect as O,useCallback as k}from"@dropins/tools/preact-hooks.js";import{useText as j}from"@dropins/tools/i18n.js";import{InLineAlert as C,InputPassword as R}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 I=(o,d)=>o.split("&").filter(r=>r.includes(d)).map(r=>r.split("=")[1])[0],tt=({isEmailConfirmationRequired:o,signInOnSuccess:d,passwordConfigs:e,routeRedirectOnSignIn:r,routeWrongUrlRedirect:a,onErrorCallback:u,onSuccessCallback:c,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:f})=>{const t=j({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,P]=h({userName:"",status:!1}),[L,N]=h(""),[x,_]=h(!1),[p,T]=h(""),[y,v]=h(""),[w,F]=h(!1);O(()=>{const{search:l}=window.location;!l.includes("token=")&&!l.includes("email=")&&S(a)&&(window.location.href=a());const s=decodeURIComponent(l),b=I(s,"token"),q=I(s,"email");T(q),v(b)},[a]);const B=k(async l=>{l.preventDefault(),F(!0);const s=Y(l.target),b=(s==null?void 0:s.password)&&p&&y,q=(e==null?void 0:e.requiredCharacterClasses)||0,G=(e==null?void 0:e.minLength)||0;if(!H(s==null?void 0:s.password,q)||s.password.length<+G){_(!0),F(!1);return}if(!b){m({type:"error",text:t.errorNotification}),F(!1);return}const{message:V,success:A}=await X(p,y,s.password);if(A){if(o||!o&&!d){S(f)&&(window.location.href=f()),_(!0),F(!1),m({type:"success",text:t.updatePasswordMessage}),N("");return}const n=await Q({email:p,password:s.password,handleSetInLineAlertProps:m,onErrorCallback:u,translations:t});n!=null&&n.userName&&(S(r)?window.location.href=r():(P({userName:n==null?void 0:n.userName,status:!0}),c==null||c(n==null?void 0:n.userName)))}else m({type:"error",text:V}),u==null||u({message:V,success:A});F(!1)},[p,y,e,o,t,d,m,r,f,u,c]),D=k(l=>{N(l)},[]);return{isSuccessful:U,updatePasswordValue:L,isClickSubmit:x,isLoading:w,submitUpdatePassword:B,handleSetUpdatePasswordValue:D}},et=({signInOnSuccess:o=!0,formSize:d="default",routeRedirectOnSignIn:e,routeWrongUrlRedirect:r,slots:a,onErrorCallback:u,onSuccessCallback:c,routeRedirectOnPasswordUpdate:m})=>{const f=j({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary"}),{passwordConfigs:t,isEmailConfirmationRequired:U}=J(),{inLineAlertProps:P,handleSetInLineAlertProps:L}=Z(),{isSuccessful:N,updatePasswordValue:x,isClickSubmit:_,isLoading:p,submitUpdatePassword:T,handleSetUpdatePasswordValue:y}=tt({isEmailConfirmationRequired:U,signInOnSuccess:o,passwordConfigs:t,routeRedirectOnSignIn:e,routeWrongUrlRedirect:r,onErrorCallback:u,onSuccessCallback:c,handleSetInLineAlertProps:L,routeRedirectOnPasswordUpdate:m}),{isValidUniqueSymbols:v,defaultLengthMessage:w}=K({password:x,isClickSubmit:_,passwordConfigs:t});return N.status&&(a!=null&&a.SuccessNotification)?i(g,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:N}}):M("div",{className:z(["auth-updatePasswordForm",d]),children:[i($,{text:f.title,bottomLine:!1,className:"auth-updatePasswordForm__title"}),P.text?i(C,{className:"auth-updatePasswordForm__notification",variant:"secondary",heading:P.text,icon:P.icon}):null,M(W,{name:"updatePassword_form",className:"auth-updatePasswordForm__form",submitCallback:T,isLoading:p,fieldsConfig:[],children:[i("div",{style:"display: none;",children:i("input",{type:"text",id:"username",name:"username",autocomplete:"username"})}),i(R,{defaultValue:x,onValue:y,className:"auth-updatePasswordForm__form__item",autoComplete:"new-password",name:"password",required:!0,error:v==="error"||(w==null?void 0:w.status)==="error",minLength:t==null?void 0:t.minLength,uniqueSymbolsStatus:v,validateLengthConfig:w,requiredCharacterClasses:t==null?void 0:t.requiredCharacterClasses}),i("div",{className:"auth-updatePasswordForm__button",children:i(E,{type:"submit",buttonText:f.buttonPrimary,variant:"primary",enableLoader:p})})]})]})},yt=({slots:o,formSize:d,signInOnSuccess:e,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:a,routeWrongUrlRedirect:u,onErrorCallback:c,onSuccessCallback:m})=>i("div",{className:"auth-update-password",children:i(et,{formSize:d,signInOnSuccess:e,routeRedirectOnSignIn:a,routeWrongUrlRedirect:u,onErrorCallback:c,onSuccessCallback:m,slots:o,routeRedirectOnPasswordUpdate:r})});export{yt as UpdatePassword,yt as default};
@@ -56,6 +56,12 @@ declare const _default: {
56
56
  "technicalErrorSendEmail": "A technical error occurred while trying to send the email. Please try again later."
57
57
  }
58
58
  },
59
+ "SuccessNotification": {
60
+ "headingText":"Welcome!",
61
+ "messageText":"We are glad to see you!",
62
+ "primaryButtonText":"Continue shopping",
63
+ "secondaryButtonText":"Logout"
64
+ },
59
65
  "Api": {
60
66
  "customerTokenErrorMessage": "Unable to log in. Please try again later or contact support if the issue persists."
61
67
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-auth", "version": "0.0.1-alpha7", "@dropins/elsie": "0.26.0-alpha227"}
1
+ {"name": "@dropins/storefront-auth", "version": "0.0.1-alpha9", "@dropins/elsie": "0.26.0-alpha229"}
package/render.js CHANGED
@@ -5,4 +5,4 @@
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__item .auth-signUpForm__form__item--firstname,.auth-signUpForm.small .auth-signUpForm__form__item .auth-signUpForm__form__item--lastname{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__item{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__item--firstname,.auth-signUpForm__form__item--lastname{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__item--firstname,.auth-signUpForm__form__item--lastname{flex-shrink:1;flex-grow:.5;flex-basis:48%}}
7
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"});
8
- import{jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,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 y}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as h}from"./chunks/initialize.js";const p={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. Now you can log in with the new password.",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:"Click here",additionalText:"to 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."}},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."}},b={Auth:p},w={default:b},P=({children:s})=>{var o,r;const[e,n]=m("en_US"),c=(r=(o=h)==null?void 0:o.getConfig())==null?void 0:r.langDefinitions;f(()=>{const t=y.on("locale",a=>{a!==e&&n(a)},{eager:!0});return()=>{t==null||t.off()}},[e]);const l=d(w,c??{});return i(g,{lang:e,langDefinitions:l,children:s})},F=new u(i(P,{}));export{F as render};
8
+ import{jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,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 y}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as p}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. Now you can log in with the new password.",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:"Click here",additionalText:"to 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."}},b={Auth:h},w={default:b},S=({children:s})=>{var o,r;const[e,n]=m("en_US"),c=(r=(o=p)==null?void 0:o.getConfig())==null?void 0:r.langDefinitions;f(()=>{const t=y.on("locale",a=>{a!==e&&n(a)},{eager:!0});return()=>{t==null||t.off()}},[e]);const l=d(w,c??{});return i(g,{lang:e,langDefinitions:l,children:s})},F=new u(i(S,{}));export{F as render};
@@ -1,8 +1,17 @@
1
- import { VNode } from 'preact';
1
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { activeComponentType } from './authCombine.types';
3
3
  import { inLineAlertInterface } from './notification.types';
4
4
 
5
+ type DefaultSlotContext = {
6
+ isSuccessful: {
7
+ userName: string;
8
+ status: boolean;
9
+ };
10
+ };
5
11
  export interface SignInProps {
12
+ slots?: {
13
+ SuccessNotification?: SlotProps<DefaultSlotContext>;
14
+ };
6
15
  formSize?: 'default' | 'small';
7
16
  renderSignUpLink?: boolean;
8
17
  initialEmailValue?: string;
@@ -12,7 +21,6 @@ export interface SignInProps {
12
21
  routeForgotPassword?: () => string;
13
22
  routeSignUp?: () => string;
14
23
  routeRedirectOnSignIn?: () => string;
15
- successNotificationForm?: (userName: string) => VNode<any>;
16
24
  onSuccessCallback?: (value?: {
17
25
  userName: string;
18
26
  status: boolean;
@@ -23,7 +31,7 @@ export interface SignInProps {
23
31
  export interface SignInFormProps extends SignInProps {
24
32
  setActiveComponent?: (componentName: activeComponentType) => void;
25
33
  }
26
- export interface useSignInFormProps extends Omit<SignInFormProps, 'formSize' | 'successNotificationForm'> {
34
+ export interface useSignInFormProps extends Omit<SignInFormProps, 'formSize' | 'slots'> {
27
35
  handleSetInLineAlertProps: (value?: inLineAlertInterface) => void;
28
36
  emailConfirmationStatusMessage?: {
29
37
  text: string;
@@ -31,4 +39,5 @@ export interface useSignInFormProps extends Omit<SignInFormProps, 'formSize' | '
31
39
  };
32
40
  translations: any;
33
41
  }
42
+ export {};
34
43
  //# sourceMappingURL=signIn.types.d.ts.map
@@ -1,12 +1,18 @@
1
- import { VNode } from 'preact';
2
1
  import { activeComponentType } from './authCombine.types';
3
2
  import { inLineAlertInterface } from './notification.types';
4
3
  import { AddressFormProps } from './api/createCustomerAddress.types';
4
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
5
5
 
6
6
  export interface inputsDefaultValueSetProps {
7
7
  code: string;
8
8
  defaultValue: string;
9
9
  }
10
+ type DefaultSlotContext = {
11
+ isSuccessful: {
12
+ userName: string;
13
+ status: boolean;
14
+ };
15
+ };
10
16
  export interface SignUpProps {
11
17
  addressesData?: AddressFormProps[];
12
18
  inputsDefaultValueSet?: inputsDefaultValueSetProps[];
@@ -18,7 +24,9 @@ export interface SignUpProps {
18
24
  formSize?: 'default' | 'small';
19
25
  hideCloseBtnOnEmailConfirmation?: boolean;
20
26
  routeRedirectOnEmailConfirmationClose?: () => string;
21
- successNotificationForm?: (userName: string) => VNode<any>;
27
+ slots?: {
28
+ SuccessNotification?: SlotProps<DefaultSlotContext>;
29
+ };
22
30
  routeSignIn?: () => string;
23
31
  routeRedirectOnSignIn?: () => string;
24
32
  onErrorCallback?: (value?: unknown) => void;
@@ -30,7 +38,7 @@ export interface SignUpProps {
30
38
  export interface SignUpFormProps extends SignUpProps {
31
39
  setActiveComponent?: (componentName: activeComponentType) => void;
32
40
  }
33
- export interface UseSingUpFormProps extends Omit<SignUpFormProps, 'formSize' | 'displayTermsOfUseCheckbox' | 'displayNewsletterCheckbox' | 'inputsDefaultValueSet' | 'successNotificationForm'> {
41
+ export interface UseSingUpFormProps extends Omit<SignUpFormProps, 'formSize' | 'displayTermsOfUseCheckbox' | 'displayNewsletterCheckbox' | 'inputsDefaultValueSet' | 'slots'> {
34
42
  passwordConfigs?: {
35
43
  minLength: number;
36
44
  requiredCharacterClasses: number;
@@ -39,4 +47,5 @@ export interface UseSingUpFormProps extends Omit<SignUpFormProps, 'formSize' | '
39
47
  isEmailConfirmationRequired?: boolean;
40
48
  translations: Record<string, string>;
41
49
  }
50
+ export {};
42
51
  //# sourceMappingURL=signUp.types.d.ts.map
@@ -1,12 +1,13 @@
1
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
+
1
3
  export interface SuccessNotificationProps {
4
+ slots?: {
5
+ SuccessNotificationActions?: SlotProps;
6
+ };
2
7
  formSize?: 'default' | 'small';
3
- headingText?: string;
4
8
  className?: string;
9
+ headingText?: string;
5
10
  messageText?: string;
6
- primaryButtonText?: string;
7
- secondaryButtonText?: string;
8
- onPrimaryButtonClick?: () => void;
9
- onSecondaryButtonClick?: () => void;
10
11
  }
11
12
  export interface SuccessNotificationFormProps extends SuccessNotificationProps {
12
13
  }
@@ -1,6 +1,12 @@
1
- import { VNode } from 'preact';
1
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { inLineAlertInterface } from './notification.types';
3
3
 
4
+ type DefaultSlotContext = {
5
+ isSuccessful: {
6
+ userName: string;
7
+ status: boolean;
8
+ };
9
+ };
4
10
  export interface UpdatePasswordProps {
5
11
  signInOnSuccess?: boolean;
6
12
  formSize?: 'default' | 'small';
@@ -9,11 +15,13 @@ export interface UpdatePasswordProps {
9
15
  routeWrongUrlRedirect?: () => string;
10
16
  onErrorCallback?: (value: unknown) => void;
11
17
  onSuccessCallback?: (value: string) => void;
12
- successNotificationForm?: (userName: string) => VNode<any>;
18
+ slots?: {
19
+ SuccessNotification?: SlotProps<DefaultSlotContext>;
20
+ };
13
21
  }
14
22
  export interface UpdatePasswordFormProps extends UpdatePasswordProps {
15
23
  }
16
- export interface UseUpdatePasswordFormProps extends Omit<UpdatePasswordFormProps, 'formSize' | 'successNotificationForm'> {
24
+ export interface UseUpdatePasswordFormProps extends Omit<UpdatePasswordFormProps, 'formSize' | 'slots'> {
17
25
  isEmailConfirmationRequired?: boolean;
18
26
  passwordConfigs?: {
19
27
  minLength: number;
@@ -21,4 +29,5 @@ export interface UseUpdatePasswordFormProps extends Omit<UpdatePasswordFormProps
21
29
  } | null;
22
30
  handleSetInLineAlertProps: (value?: inLineAlertInterface) => void;
23
31
  }
32
+ export {};
24
33
  //# sourceMappingURL=updatePassword.types.d.ts.map