@dropins/storefront-auth 0.0.1-alpha5 → 0.0.1-alpha7
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/confirmEmail/confirmEmail.d.ts +4 -0
- package/api/confirmEmail/graphql/confirmEmail.graphql.d.ts +2 -0
- package/api/confirmEmail/index.d.ts +2 -0
- package/api/createCustomer/createCustomer.d.ts +4 -0
- package/api/createCustomer/graphql/createCustomer.graphql.d.ts +2 -0
- package/api/createCustomer/graphql/createCustomerV2.graphql.d.ts +2 -0
- package/api/createCustomer/index.d.ts +2 -0
- package/api/createCustomerAddress/createCustomerAddress.d.ts +4 -0
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +2 -0
- package/api/createCustomerAddress/index.d.ts +2 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
- package/api/fetch-graphql/index.d.ts +2 -0
- package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
- package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +2 -0
- package/api/getAttributesForm/index.d.ts +2 -0
- package/api/getCustomerData/getCustomerData.d.ts +4 -0
- package/api/getCustomerData/graphql/getCustomerData.graphql.d.ts +2 -0
- package/api/getCustomerData/index.d.ts +2 -0
- package/api/getCustomerToken/getCustomerToken.d.ts +15 -0
- package/api/getCustomerToken/graphql/getCustomerToken.graphql.d.ts +2 -0
- package/api/getCustomerToken/index.d.ts +2 -0
- package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +2 -0
- package/api/getStoreConfig/index.d.ts +2 -0
- package/api/index.d.ts +14 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +14 -0
- package/api/requestPasswordResetEmail/graphql/requestPasswordResetEmail.graphql.d.ts +2 -0
- package/api/requestPasswordResetEmail/index.d.ts +2 -0
- package/api/requestPasswordResetEmail/requestPasswordResetEmail.d.ts +4 -0
- package/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.d.ts +2 -0
- package/api/resendConfirmationEmail/index.d.ts +2 -0
- package/api/resendConfirmationEmail/resendConfirmationEmail.d.ts +4 -0
- package/api/resetPassword/graphql/resetPassword.graphql.d.ts +2 -0
- package/api/resetPassword/index.d.ts +2 -0
- package/api/resetPassword/resetPassword.d.ts +4 -0
- package/api/revokeCustomerToken/graphql/revokeCustomerToken.graphql.d.ts +2 -0
- package/api/revokeCustomerToken/index.d.ts +2 -0
- package/api/revokeCustomerToken/revokeCustomerToken.d.ts +4 -0
- package/api.d.ts +1 -0
- package/api.js +3 -4
- package/chunks/EmailConfirmationForm.js +1 -2
- package/chunks/ResetPasswordForm.js +1 -2
- package/chunks/SignInForm.js +1 -2
- package/chunks/SignUpForm.js +1 -2
- package/chunks/SkeletonLoader.js +1 -2
- package/chunks/confirmEmail.js +1 -2
- package/chunks/createCustomerAddress.js +5 -6
- package/chunks/getStoreConfig.js +4 -5
- package/chunks/index.js +1 -2
- package/chunks/index2.js +1 -2
- package/chunks/index3.js +1 -2
- package/chunks/initialize.js +0 -1
- package/chunks/requestPasswordResetEmail.js +2 -3
- package/chunks/resendConfirmationEmail.js +1 -2
- package/chunks/resetPassword.js +2 -3
- package/chunks/setReCaptchaToken.js +1 -0
- package/chunks/simplifyTransformAttributesForm.js +0 -1
- package/chunks/transform-attributes-form.js +0 -1
- package/chunks/useInLineAlert.js +1 -2
- package/chunks/usePasswordValidationMessage.js +1 -2
- package/components/EmailConfirmationForm/EmailConfirmationForm.d.ts +5 -0
- package/components/EmailConfirmationForm/index.d.ts +3 -0
- package/components/ResetPasswordForm/ResetPasswordForm.d.ts +6 -0
- package/components/ResetPasswordForm/index.d.ts +3 -0
- package/components/SignInForm/SignInForm.d.ts +5 -0
- package/components/SignInForm/index.d.ts +3 -0
- package/components/SignUpForm/SignUpForm.d.ts +5 -0
- package/components/SignUpForm/index.d.ts +3 -0
- package/components/SkeletonLoader/SkeletonLoader.d.ts +5 -0
- package/components/SkeletonLoader/Skeletons/ResetPasswordSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/SignInSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/SignUpSkeleton.d.ts +2 -0
- package/components/SkeletonLoader/Skeletons/index.d.ts +4 -0
- package/components/SkeletonLoader/index.d.ts +3 -0
- package/components/SuccessNotificationForm/SuccessNotificationForm.d.ts +6 -0
- package/components/SuccessNotificationForm/index.d.ts +3 -0
- package/components/UI/Button/Button.d.ts +16 -0
- package/components/UI/Button/index.d.ts +3 -0
- package/components/UI/Form/Form.d.ts +5 -0
- package/components/UI/Form/index.d.ts +3 -0
- package/components/UI/FormInputs/FormInputs.d.ts +13 -0
- package/components/UI/FormInputs/index.d.ts +3 -0
- package/components/UI/Title/Title.d.ts +11 -0
- package/components/UI/Title/index.d.ts +3 -0
- package/components/UI/index.d.ts +5 -0
- package/components/UpdatePasswordForm/UpdatePasswordForm.d.ts +5 -0
- package/components/UpdatePasswordForm/index.d.ts +3 -0
- package/components/index.d.ts +11 -0
- package/configs/cookieConfigs.d.ts +7 -0
- package/configs/defaultCreateUserConfigs.d.ts +16 -0
- package/configs/patternConfigs.d.ts +3 -0
- package/containers/AuthCombine/AuthCombine.d.ts +5 -0
- package/containers/AuthCombine/index.d.ts +3 -0
- package/containers/AuthCombine.d.ts +3 -0
- package/containers/AuthCombine.js +1 -2
- package/containers/ResetPassword/ResetPassword.d.ts +5 -0
- package/containers/ResetPassword/index.d.ts +3 -0
- package/containers/ResetPassword.d.ts +3 -0
- package/containers/ResetPassword.js +1 -2
- package/containers/SignIn/SignIn.d.ts +5 -0
- package/containers/SignIn/index.d.ts +3 -0
- package/containers/SignIn.d.ts +3 -0
- package/containers/SignIn.js +1 -2
- package/containers/SignUp/SignUp.d.ts +5 -0
- package/containers/SignUp/index.d.ts +3 -0
- package/containers/SignUp.d.ts +3 -0
- package/containers/SignUp.js +1 -2
- package/containers/SuccessNotification/SuccessNotification.d.ts +5 -0
- package/containers/SuccessNotification/index.d.ts +3 -0
- package/containers/SuccessNotification.d.ts +3 -0
- package/containers/SuccessNotification.js +1 -2
- package/containers/UpdatePassword/UpdatePassword.d.ts +5 -0
- package/containers/UpdatePassword/index.d.ts +3 -0
- package/containers/UpdatePassword.d.ts +3 -0
- package/containers/UpdatePassword.js +1 -2
- package/containers/index.d.ts +7 -0
- package/data/models/attributes-form.d.ts +25 -0
- package/data/models/customer-data.d.ts +6 -0
- package/data/models/index.d.ts +7 -0
- package/data/models/password-reset-email.d.ts +5 -0
- package/data/models/reset-password.d.ts +5 -0
- package/data/models/revoke-customer-token.d.ts +5 -0
- package/data/models/store-config.d.ts +8 -0
- package/data/transforms/index.d.ts +7 -0
- package/data/transforms/transform-attributes-form.d.ts +5 -0
- package/data/transforms/transform-auth.d.ts +37 -0
- package/data/transforms/transform-customer-data.d.ts +5 -0
- package/data/transforms/transform-password-reset-email.d.ts +5 -0
- package/data/transforms/transform-reset-password.d.ts +5 -0
- package/data/transforms/transform-revoke-customer-token.d.ts +5 -0
- package/data/transforms/transform-store-config.d.ts +5 -0
- package/hooks/api/useGetAttributesForm.d.ts +14 -0
- package/hooks/api/useGetStoreConfigs.d.ts +8 -0
- package/hooks/components/useEmailConfirmationForm.d.ts +7 -0
- package/hooks/components/usePasswordValidationMessage.d.ts +16 -0
- package/hooks/components/useResetPasswordForm.d.ts +8 -0
- package/hooks/components/useSignInForm.d.ts +21 -0
- package/hooks/components/useSignUpForm.d.ts +20 -0
- package/hooks/components/useUpdatePasswordForm.d.ts +14 -0
- package/hooks/ui/useForm.d.ts +11 -0
- package/hooks/useEmailConfirmation.d.ts +11 -0
- package/hooks/useInLineAlert.d.ts +7 -0
- package/i18n/en_US.json.d.ts +66 -0
- package/lib/acdl.d.ts +9 -0
- package/lib/checkIsFunction.d.ts +2 -0
- package/lib/clearUrlAndReplace.d.ts +2 -0
- package/lib/convertToInputDateFormat.d.ts +2 -0
- package/lib/cookieUtils.d.ts +3 -0
- package/lib/fetch-error.d.ts +5 -0
- package/lib/generateRandomDigits.d.ts +2 -0
- package/lib/getFormValues.d.ts +2 -0
- package/lib/getUrlParam.d.ts +2 -0
- package/lib/mergeFormObjects.d.ts +3 -0
- package/lib/network-error.d.ts +6 -0
- package/lib/setReCaptchaToken.d.ts +2 -0
- package/lib/simplifyTransformAttributesForm.d.ts +2 -0
- package/lib/validationUniqueSymbolsPassword.d.ts +2 -0
- package/package.json +1 -1
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +4 -7
- package/types/api/confirmEmail.types.d.ts +17 -0
- package/types/api/createCustomer.types.d.ts +24 -0
- package/types/api/createCustomerAddress.types.d.ts +47 -0
- package/types/api/getAttributesForm.types.d.ts +29 -0
- package/types/api/getCustomerData.types.d.ts +13 -0
- package/types/api/getCustomerToken.types.d.ts +11 -0
- package/types/api/passwordResetEmail.types.d.ts +9 -0
- package/types/api/resendConfirmationEmail.types.d.ts +9 -0
- package/types/api/resetPassword.types.d.ts +9 -0
- package/types/api/revokeCustomerToken.types.d.ts +9 -0
- package/types/api/storeConfig.types.d.ts +16 -0
- package/types/authCombine.types.d.ts +12 -0
- package/types/emailConfirmationForm.types.d.ts +14 -0
- package/types/form.types.d.ts +11 -0
- package/types/index.d.ts +22 -0
- package/types/notification.types.d.ts +15 -0
- package/types/resetPassword.types.d.ts +15 -0
- package/types/signIn.types.d.ts +34 -0
- package/types/signUp.types.d.ts +42 -0
- package/types/skeletonLoader.types.d.ts +6 -0
- package/types/successNotification.types.d.ts +13 -0
- package/types/updatePassword.types.d.ts +24 -0
- package/api.js.map +0 -1
- package/chunks/EmailConfirmationForm.js.map +0 -1
- package/chunks/PasswordField.js +0 -2
- package/chunks/PasswordField.js.map +0 -1
- package/chunks/ResetPasswordForm.js.map +0 -1
- package/chunks/SignInForm.js.map +0 -1
- package/chunks/SignUpForm.js.map +0 -1
- package/chunks/SkeletonLoader.js.map +0 -1
- package/chunks/confirmEmail.js.map +0 -1
- package/chunks/createCustomerAddress.js.map +0 -1
- package/chunks/getStoreConfig.js.map +0 -1
- package/chunks/index.js.map +0 -1
- package/chunks/index2.js.map +0 -1
- package/chunks/index3.js.map +0 -1
- package/chunks/initialize.js.map +0 -1
- package/chunks/network-error.js +0 -2
- package/chunks/network-error.js.map +0 -1
- package/chunks/requestPasswordResetEmail.js.map +0 -1
- package/chunks/resendConfirmationEmail.js.map +0 -1
- package/chunks/resetPassword.js.map +0 -1
- package/chunks/simplifyTransformAttributesForm.js.map +0 -1
- package/chunks/transform-attributes-form.js.map +0 -1
- package/chunks/useInLineAlert.js.map +0 -1
- package/chunks/usePasswordValidationMessage.js.map +0 -1
- package/containers/AuthCombine.js.map +0 -1
- package/containers/ResetPassword.js.map +0 -1
- package/containers/SignIn.js.map +0 -1
- package/containers/SignUp.js.map +0 -1
- package/containers/SuccessNotification.js.map +0 -1
- package/containers/UpdatePassword.js.map +0 -1
- package/render.js.map +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
1
|
import{t as a}from"./transform-attributes-form.js";const r=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-signInForm__form__email",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[]}],_=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-resetPasswordForm__form__item",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[]}],i=[{code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[]},{code:"firstname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"First name",options:[]},{code:"lastname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!1,is_unique:!1,label:"Last name",options:[]}],o={date_of_birth:"",dob:"",email:"",firstname:"",gender:"",is_subscribed:"",lastname:"",middlename:"",password:"",prefix:"",suffix:"",taxvat:""},u=e=>{if(!(e!=null&&e.length))return[];const t={data:{attributesForm:{items:e}}},{fields:s}=a(t);return s};export{_ as D,r as a,i as b,o as c,u as s};
|
|
2
|
-
//# sourceMappingURL=simplifyTransformAttributesForm.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
const b=t=>{var n,d;const r=(n=t==null?void 0:t.data)==null?void 0:n.attributesForm;if((d=r==null?void 0:r.errors)!=null&&d.length)return{errors:r.errors};const i=(r==null?void 0:r.items)||[];return{fields:i==null?void 0:i.map(({default_value:a,frontend_input:l,frontend_class:s,is_required:f,code:e,...m})=>{let o=["email","firstname","lastname"].findIndex(u=>u===e)+1||5;return{...m,defaultValue:a||"",fieldType:l||"",className:s||"",required:f||!1,orderNumber:o,name:e,id:e,code:e}}).sort((a,l)=>a.orderNumber-l.orderNumber)}};export{b as t};
|
|
2
|
-
//# sourceMappingURL=transform-attributes-form.js.map
|
package/chunks/useInLineAlert.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{useState as k,useCallback as M,useRef as A,useEffect as F}from"@dropins/tools/preact-hooks.js";import{classes as g}from"@dropins/tools/lib.js";import{Checkbox as q,Button as D,Field as L,Input as N}from"@dropins/tools/components.js";import{jsxs as x,jsx as c,Fragment as I}from"@dropins/tools/preact-jsx-runtime.js";import{useText as O}from"@dropins/tools/i18n.js";import*as h from"@dropins/tools/preact-compat.js";import{memo as C,useState as B}from"@dropins/tools/preact-compat.js";const j=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),P=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},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"})),R=e=>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",...e},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)"})))),W=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},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"})),J=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},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"})),ie=e=>{if(!e)return null;const s=new FormData(e);if(s&&typeof s.entries=="function"){const r=s.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},de=e=>typeof e=="function",X=C(({initialValue:e=!1,label:s,errors:r,name:n="",onChange:o,onBlur:a,...l})=>{const t=r?r[n]:"",u=t?"error":"",[m,_]=k(e),v=M(w=>{o==null||o(w),_(f=>!f)},[o]);return x("div",{className:g(["auth-checkbox-field"]),children:[c(q,{name:n,label:s,value:m,checked:m,error:!!t,onChange:v,onBlur:a,"data-testid":n||"uniqueCheckboxId",...l}),u?c("div",{className:"auth-checkbox-field__error",children:t.replace("Enter a checkbox, this field","Checkbox")}):null]})}),ue=({type:e,buttonText:s,variant:r,className:n="",enableLoader:o=!1,onClick:a,style:l,icon:t,...u})=>{const m=M(v=>{a==null||a(v)},[a]);return x(D,{icon:t,style:l,type:e,variant:r,className:g(["auth-button",n,o?"enableLoader":""]),onClick:m,...u,children:[c("span",{className:"auth-button__text",children:s}),o?c("div",{className:"auth-button__loader-wrapper",children:c("span",{className:"auth-button__loader"})}):null]})},K=e=>{if(!e)return"";const s=e.split("-");if(s.length<3)return"";const[r,n,o]=s;return`${r}-${n.padStart(2,"0")}-${o.padStart(2,"0")}`},U=(e,s)=>{e.forEach(r=>{const n=r.querySelector("input"),o=r.querySelector("textarea"),a=r.querySelector("select");s?r.classList.add("elsie-field__label--disabled"):r.classList.remove("elsie-field__label--disabled"),n&&(n.disabled=s),o&&(o.disabled=s),a&&(a.disabled=s)})},z=({submitCallback:e,isLoading:s,fieldsConfig:r})=>{const n=O({requiredFieldError:"Auth.FormText.requiredFieldError"}),o=A(null),[a,l]=k({}),[t,u]=k({});F(()=>{if(o.current){const f=o.current,i=f.querySelector('button[type="submit"]'),d=f.querySelectorAll(".elsie-field");if(!i||!d)return;const p=s!==void 0?s:!1;U(d,p),p?i.classList.add("loading"):i.classList.remove("loading"),i.disabled=p}},[s]);const m=M(f=>{f.forEach(i=>{if(i.required){switch(i.fieldType){case"DATE":{const d=K(i.defaultValue);l(p=>({...p,[i.name]:d||""}));break}case"BOOLEAN":{const d=i.options.find(E=>E.is_default),p=(d==null?void 0:d.value)==="1";l(E=>({...E,[i.name]:d?p:""}));break}case"SELECT":{const d=i.options.find(p=>p.is_default);l(p=>({...p,[i.name]:(d==null?void 0:d.value)||""}));break}default:l(d=>({...d,[i.name]:(i==null?void 0:i.value)||(i==null?void 0:i.defaultValue)||""}));break}u(d=>({...d,[i.name]:""}))}})},[]);F(()=>{Array.isArray(r)&&(r!=null&&r.length)&&m(r)},[r,m]);const _=M(({target:{name:f,value:i,type:d,checked:p}})=>{const E=d==="checkbox",b=E?p:i,V=t[f]?{...t,[f]:""}:t;l({...a,[f]:b}),u(V)},[t,a]),v=M(f=>{const{name:i,value:d,type:p}=f.target,E=p==="checkbox",b=Object.keys(a).includes(i),V=r.find(T=>T.name===i);!(E?f.target.checked:d.trim())&&b&&V&&V.required&&u({...t,[i]:n.requiredFieldError})},[t,r,a,n.requiredFieldError]),w=M(f=>{var E;f.preventDefault();let i=!0;const d={};Object.keys(a).forEach(b=>{const V=typeof a[b]=="boolean",H=typeof a[b]=="string"&&!a[b].trim();(V&&!a[b]||H)&&(i=!1,d[b]=n.requiredFieldError)}),u(d),e==null||e(f,i);const p=Object.keys(d)[0];(E=document.getElementsByName(p)[0])==null||E.focus()},[a,e,n.requiredFieldError]);return{formData:a,errors:t,formRef:o,handleChange:_,handleBlur:v,handleSubmit:w}},G=e=>h.createElement("svg",{width:30,height:30,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M24.75 10V9.25H23.25V10H24.75ZM23.25 14V14.75H24.75V14H23.25ZM16.75 10V9.25H15.25V10H16.75ZM15.25 14V14.75H16.75V14H15.25ZM10 17.25C9.58579 17.25 9.25 17.5858 9.25 18C9.25 18.4142 9.58579 18.75 10 18.75V17.25ZM30 18.75C30.4142 18.75 30.75 18.4142 30.75 18C30.75 17.5858 30.4142 17.25 30 17.25V18.75ZM12 12.75H28V11.25H12V12.75ZM28 12.75C28.6904 12.75 29.25 13.3096 29.25 14H30.75C30.75 12.4812 29.5188 11.25 28 11.25V12.75ZM29.25 14V28H30.75V14H29.25ZM29.25 28C29.25 28.6904 28.6904 29.25 28 29.25V30.75C29.5188 30.75 30.75 29.5188 30.75 28H29.25ZM28 29.25H12V30.75H28V29.25ZM12 29.25C11.3096 29.25 10.75 28.6904 10.75 28H9.25C9.25 29.5188 10.4812 30.75 12 30.75V29.25ZM10.75 28V14H9.25V28H10.75ZM10.75 14C10.75 13.3096 11.3096 12.75 12 12.75V11.25C10.4812 11.25 9.25 12.4812 9.25 14H10.75ZM23.25 10V14H24.75V10H23.25ZM15.25 10V14H16.75V10H15.25ZM10 18.75H30V17.25H10V18.75Z",fill:"#2B2B2B"})),Q=C(({children:e,name:s="",onChange:r,onBlur:n,errors:o,values:a,label:l})=>{const[t,u]=B("text"),m=o?o[s]:"",_=a?a[s]:"",v=()=>{u("date")},w=f=>{u("text"),n==null||n(f)};return x("div",{className:g(["auth-date-field",t]),children:[c(L,{error:m,children:c(N,{type:t,name:s,value:_,placeholder:l,floatingLabel:l,onFocus:v,onBlur:w,onChange:r})}),e,c(G,{})]})}),Z=()=>{let e="";for(let s=0;s<5;s++)e+=Math.floor(Math.random()*10);return e},S=Z(),Y=({selectTitle:e,optionConfig:s=[],name:r="",onChange:n,onBlur:o,errors:a,values:l})=>{const t=a?a[r]:"",u=l?l[r]:"",m=t?"auth-select-field--error":"";return x("div",{className:g(["auth-select-field","elsie-field",m,u?"auth-select-field--selected":""]),"data-testid":"auth-select-field",children:[x("select",{className:"auth-select-field__select",id:`select_${r}_${S}`,name:r,value:u,onBlur:o,onChange:n,"aria-label":`select_${r}`,children:[c("option",{selected:!!s.filter(v=>v.is_default).length,disabled:!0,children:e}),s.map((v,w)=>c("option",{value:v.value,defaultChecked:v.is_default,children:v.label},w))]}),c("label",{htmlFor:`select_${r}_${S}`,className:"auth-select-field__label",children:e}),c(j,{}),m&&c("div",{className:"auth-select-field__error-text",children:t})]})},$=Z(),ee=({name:e="",errors:s,values:r,label:n,className:o,onChange:a,onBlur:l})=>{const t=s?s[e]:"",u=r?r[e]:"",m=t?"error":"";return x("div",{className:g(["auth-textarea-field",o,m?"auth-textarea-field--error":""]),"data-testid":"auth-textarea-field",children:[c("textarea",{className:"auth-textarea-field__textarea",id:`textarea_${e}_${$}`,placeholder:n,name:e,value:u,onBlur:l,onChange:a}),c("label",{htmlFor:`textarea_${e}_${$}`,className:"auth-textarea-field__label",children:n}),m?c("div",{className:"auth-textarea-field__error-text",children:t}):null]})},y=C(({name:e="",onChange:s,onBlur:r,errors:n,values:o,label:a,className:l})=>{const t=n?n[e]:"",u=o?o[e]:"";return c("div",{className:g(["auth-text-field",l]),"data-testid":"auth-text_field",children:c(L,{error:t,children:c(N,{type:"text",name:e,value:u,onBlur:r,onChange:s,placeholder:a,floatingLabel:a})})})}),te=C(({values:e,fields:s=[],errors:r,className:n="",onChange:o,onBlur:a})=>{if(!s.length)return null;const l=`${n}__item`;return c(I,{children:s.map(t=>{switch(t.fieldType){case"TEXT":if(t.id==="email"){const u=r?r[t.id]:"",m=e?e[t.id]:"";return c("div",{className:g([`${l}`,`${l}--${t.id}`]),"data-testid":`${l}--${t.id}`,children:c(L,{error:u,className:t.className,children:c(N,{type:"email",name:t.id,icon:c(P,{}),value:m,placeholder:t.label,floatingLabel:t.label,onBlur:a,onChange:o})})})}else if(t.id==="firstname"||t.id==="lastname")return c("div",{className:g([`${l}`,`${l}--${t.id}`]),children:c(y,{name:t.id,className:t.className,label:t.label,onBlur:a,errors:r,onChange:o,values:e})});return c("div",{className:g([`${l}`,`${l}--${t.id}`]),children:c(y,{name:t.id,className:t.className,label:t.label,onBlur:a,errors:r,onChange:o,values:e})});case"SELECT":return c("div",{className:l,children:c(Y,{selectTitle:t.label,optionConfig:t.options,name:t.id,onBlur:a,errors:r,onChange:o,values:e})});case"BOOLEAN":return c("div",{className:l,children:c(X,{label:t.label,name:t.id,onBlur:a,errors:r,onChange:o})});case"DATE":return c("div",{className:l,children:c(Q,{label:t.label,name:t.id,onBlur:a,errors:r,onChange:o,values:e})});case"TEXTAREA":return c("div",{className:g([`${l}`,`${l}--${t.id}`]),children:c(ee,{className:t.className,label:t.label,name:t.id,onBlur:a,errors:r,onChange:o,values:e})});default:return null}})})}),he=({name:e,isLoading:s,children:r,className:n="defaultForm",fieldsConfig:o=[],submitCallback:a})=>{const{formData:l,errors:t,formRef:u,handleChange:m,handleBlur:_,handleSubmit:v}=z({submitCallback:a,isLoading:s,fieldsConfig:o});return x("form",{onSubmit:v,className:n,name:e,ref:u,children:[c(te,{fields:o,onChange:m,onBlur:_,errors:t,values:l,className:n}),r]})},me=({children:e,text:s,bottomLine:r=!0,className:n})=>x("div",{className:g(["auth-title",n]),"data-testid":"auth-title_id",children:[x("div",{className:"auth-title__text",children:[c("h1",{className:"auth-title__heading",children:s}),e]}),r?c("div",{className:"auth-title__hr"}):null]}),re={success:c(W,{}),warning:c(R,{}),error:c(J,{})},fe=()=>{const[e,s]=k({}),r=M(n=>{if(!n||!n.type)return;const o=re[n.type];s({...n,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlertProps:r}};export{ue as B,X as C,he as F,j as S,me as T,de as c,ie as g,fe as u};
|
|
2
|
-
//# sourceMappingURL=useInLineAlert.js.map
|
|
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,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=usePasswordValidationMessage.js.map
|
|
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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { ResetPasswordFormProps } from '../../types';
|
|
4
|
+
|
|
5
|
+
export declare const ResetPasswordForm: FunctionComponent<ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=ResetPasswordForm.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { SuccessNotificationFormProps } from '../../types';
|
|
4
|
+
|
|
5
|
+
export declare const SuccessNotificationForm: FunctionComponent<SuccessNotificationFormProps & HTMLAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=SuccessNotificationForm.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
type: 'submit' | 'button';
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
7
|
+
className?: string;
|
|
8
|
+
buttonText: string;
|
|
9
|
+
enableLoader?: boolean;
|
|
10
|
+
onClick?: (event: MouseEvent) => void;
|
|
11
|
+
style?: Record<string, string | number>;
|
|
12
|
+
icon?: VNode<HTMLAttributes<SVGSVGElement>>;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Button: FunctionComponent<ButtonProps>;
|
|
16
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
|
|
3
|
+
export interface FormInputsProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
errors?: Record<string, string>;
|
|
6
|
+
values?: Record<string, unknown>;
|
|
7
|
+
fields?: any;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
onChange?: (event: Event) => void;
|
|
10
|
+
onBlur?: (event: Event) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const FormInputs: FunctionComponent<FormInputsProps>;
|
|
13
|
+
//# sourceMappingURL=FormInputs.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface TitleProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
bottomLine: boolean;
|
|
8
|
+
children?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare const Title: FunctionComponent<TitleProps & HTMLAttributes<HTMLDivElement>>;
|
|
11
|
+
//# sourceMappingURL=Title.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './UpdatePasswordForm';
|
|
2
|
+
export * from './SuccessNotificationForm';
|
|
3
|
+
export * from './SignUpForm';
|
|
4
|
+
export * from './SignInForm';
|
|
5
|
+
export * from './ResetPasswordForm';
|
|
6
|
+
export * from './SkeletonLoader';
|
|
7
|
+
export * from './UI/Button';
|
|
8
|
+
export * from './UI/Form';
|
|
9
|
+
export * from './UI/FormInputs';
|
|
10
|
+
export * from './UI/Title';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SignUpFieldsProps {
|
|
2
|
+
code: string;
|
|
3
|
+
default_value: string;
|
|
4
|
+
entity_type: string;
|
|
5
|
+
frontend_class: string;
|
|
6
|
+
frontend_input: string;
|
|
7
|
+
is_required: boolean;
|
|
8
|
+
is_unique: boolean;
|
|
9
|
+
label: string;
|
|
10
|
+
options: any[];
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT__SIGN_IN_EMAIL_FIELD: SignUpFieldsProps[];
|
|
13
|
+
export declare const DEFAULT__RESET_PASSWORD_EMAIL_FIELD: Record<string, string | boolean | unknown>[];
|
|
14
|
+
export declare const DEFAULT_SIGN_UP_FIELDS: SignUpFieldsProps[];
|
|
15
|
+
export declare const DEFAULT_INPUTS_PROPS: Record<string, string | ''>;
|
|
16
|
+
//# sourceMappingURL=defaultCreateUserConfigs.d.ts.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{lazy as u,Suspense as v}from"@dropins/tools/preact-compat.js";import{useState as E,useMemo as S}from"@dropins/tools/preact-hooks.js";import{S as y}from"../chunks/SkeletonLoader.js";import
|
|
2
|
-
//# sourceMappingURL=AuthCombine.js.map
|
|
1
|
+
import{jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import{lazy as u,Suspense as v}from"@dropins/tools/preact-compat.js";import{useState as E,useMemo as S}from"@dropins/tools/preact-hooks.js";import{S as y}from"../chunks/SkeletonLoader.js";import"@dropins/tools/components.js";const L=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),P=function(c){return"/"+c},p={},d=function(t,s,a){let l=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),r=(e==null?void 0:e.nonce)||(e==null?void 0:e.getAttribute("nonce"));l=Promise.all(s.map(o=>{if(o=P(o),o in p)return;p[o]=!0;const m=o.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${f}`))return;const n=document.createElement("link");if(n.rel=m?"stylesheet":L,m||(n.as="script",n.crossOrigin=""),n.href=o,r&&n.setAttribute("nonce",r),document.head.appendChild(n),m)return new Promise((_,h)=>{n.addEventListener("load",_),n.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})}))}return l.then(()=>t()).catch(e=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=e,window.dispatchEvent(r),!r.defaultPrevented)throw e})},k=u(()=>d(()=>import("../chunks/index.js"),[])),b=u(()=>d(()=>import("../chunks/index2.js"),[])),w=u(()=>d(()=>import("../chunks/index3.js"),[])),F=({defaultView:c="signInForm",signInFormConfig:t,signUpFormConfig:s,resetPasswordFormConfig:a})=>{const[l,e]=E(c),r=S(()=>({signInForm:i(b,{setActiveComponent:e,...t}),signUpForm:i(w,{setActiveComponent:e,...s}),resetPasswordForm:i(k,{setActiveComponent:e,...a})}),[a,t,s,e]);return i(v,{fallback:i(y,{activeSkeleton:l}),children:i("div",{className:"auth-combine",children:r[l]})})};export{F as AuthCombine,F as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=ResetPassword.js.map
|
|
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};
|
package/containers/SignIn.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=SignIn.js.map
|
|
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};
|
package/containers/SignUp.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=SignUp.js.map
|
|
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,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=SuccessNotification.js.map
|
|
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,2 +1 @@
|
|
|
1
|
-
import{classes as
|
|
2
|
-
//# sourceMappingURL=UpdatePassword.js.map
|
|
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};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface AttributesFormItemsProps {
|
|
2
|
+
code: string;
|
|
3
|
+
name: string;
|
|
4
|
+
id: string;
|
|
5
|
+
defaultValue: string;
|
|
6
|
+
entity_type: string;
|
|
7
|
+
className: null | string;
|
|
8
|
+
fieldType: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
is_unique: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
orderNumber: number;
|
|
13
|
+
options: {
|
|
14
|
+
is_default: boolean;
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
export interface AttributesFormModel {
|
|
20
|
+
fields?: AttributesFormItemsProps[];
|
|
21
|
+
errors?: {
|
|
22
|
+
message: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=attributes-form.d.ts.map
|