@dropins/storefront-auth 1.0.1 → 1.0.2
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/chunks/Button.js +3 -0
- package/chunks/Button2.js +1 -1
- package/chunks/ResetPasswordForm.js +1 -1
- package/chunks/SignInForm.js +1 -1
- package/chunks/SignUpForm.js +1 -1
- package/chunks/focusOnEmptyPasswordField.js +1 -1
- package/chunks/getCustomerToken.js +4 -4
- package/chunks/getStoreConfig.js +2 -2
- package/chunks/index.js +1 -1
- package/chunks/index2.js +1 -1
- package/chunks/index3.js +1 -1
- package/chunks/revokeCustomerToken.js +3 -3
- package/chunks/simplifyTransformAttributesForm.js +1 -1
- package/components/Form/Elements/FieldElement.d.ts +4 -0
- package/components/Form/Elements/FormSlot.d.ts +4 -0
- package/components/Form/Elements/InputCheckBoxElement.d.ts +4 -0
- package/components/Form/Elements/InputDateElement.d.ts +4 -0
- package/components/Form/Elements/InputElement.d.ts +4 -0
- package/components/Form/Elements/SelectElement.d.ts +4 -0
- package/components/Form/Elements/TextAreaElement.d.ts +4 -0
- package/components/Form/{FormInputs → Elements}/index.d.ts +6 -2
- package/components/Form/Form.d.ts +1 -1
- package/configs/defaultCreateUserConfigs.d.ts +3 -0
- package/containers/ResetPassword.js +1 -1
- package/containers/SignIn.js +1 -1
- package/containers/SignUp.js +1 -1
- package/containers/SuccessNotification.js +1 -1
- package/containers/UpdatePassword.js +1 -1
- package/data/models/customer-data.d.ts +11 -0
- package/data/transforms/transform-auth.d.ts +8 -52
- package/hooks/api/useGetAttributesForm.d.ts +22 -2
- package/hooks/useCustomTranslations.d.ts +24 -0
- package/lib/acdl.d.ts +6 -1
- package/lib/extractErrorKeyAndMessage.d.ts +7 -0
- package/package.json +1 -1
- package/types/form.types.d.ts +38 -0
- package/types/index.d.ts +1 -0
- package/types/validationErrors.types.d.ts +26 -0
- package/components/Form/FormInputs/FormInputs.d.ts +0 -5
package/chunks/Button.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as A,jsxs as q}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as g,useState as B,useCallback as S,useEffect as k}from"@dropins/tools/preact-hooks.js";import{initReCaptcha as j}from"@dropins/tools/recaptcha.js";import{useText as v}from"@dropins/tools/i18n.js";import{memo as m}from"@dropins/tools/preact-compat.js";import{Field as y,Input as z,Picker as w,InputDate as K,Checkbox as V,TextArea as Y}from"@dropins/tools/components.js";import{classes as Q,Slot as J}from"@dropins/tools/lib.js";var f=(r=>(r.REQUIRED_FIELD_ERROR="requiredFieldError",r.NUMERIC_ERROR="numericError",r.ALPHA_NUM_WITH_SPACES_ERROR="alphaNumWithSpacesError",r.ALPHA_NUMERIC_ERROR="alphaNumericError",r.ALPHA_ERROR="alphaError",r.EMAIL_ERROR="emailError",r.DATE_ERROR="dateError",r.DATE_RANGE_ERROR="dateRangeError",r.DATE_MAX_ERROR="dateMaxError",r.DATE_MIN_ERROR="dateMinError",r.URL_ERROR="urlError",r.LENGTH_TEXT_ERROR="lengthTextError",r))(f||{});const M="/",rr=r=>{const e=v(r),t=Object.entries(e).filter(([u,l])=>l===null&&Object.values(f).includes(u)).map(([u])=>u),a=t.reduce((u,l)=>(u[l]=`Auth.FormText.${l}`,u),{}),o=v(a);return{...e,...t.reduce((u,l)=>(u[l]=o[l],u),{})}},er=r=>r.reduce((e,{customUpperCode:t,required:a,defaultValue:o})=>(a&&t&&(e.initialData[t]=o||"",e.errorList[t]=""),e),{initialData:{},errorList:{}}),tr=r=>r.reduce((e,t)=>({...e,[t.name]:t.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),ur=r=>/^[a-zA-Z]+$/.test(r),lr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),sr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),cr=(r,e,t)=>{const a=new Date(r).getTime()/1e3;return!(isNaN(a)||a<0||typeof e<"u"&&a<e||typeof t<"u"&&a>t)},L=r=>{if(!r||r.trim()==="")return"";const e=parseInt(r,10);if(!isNaN(e)){const o=new Date(e*1e3);return isNaN(o.getTime())?"":o.toISOString().split("T")[0]}const t=new Date(r);if(isNaN(t.getTime()))return"";const a=parseInt(r.split("-")[1],10);return a>12||a<1?"":t.toISOString().split("T")[0]},dr=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),Er=(r,e,t)=>{const a=r.length;return a>=e&&a<=t},P=(r,e,t,a)=>{var G,H;const{requiredFieldError:o,lengthTextError:u,numericError:l,alphaNumWithSpacesError:s,alphaNumericError:p,alphaError:_,emailError:O,dateError:I,urlError:D,dateRangeError:b,dateMaxError:d,dateMinError:c}=t,n=e==null?void 0:e.customUpperCode,E={[n]:""};if(a[n]&&delete a[n],e!=null&&e.required&&(!r||r==="false"))return{[n]:`${f.REQUIRED_FIELD_ERROR}${M}${o}`};if(!(e!=null&&e.required)&&!r||!((G=e==null?void 0:e.validateRules)!=null&&G.length))return E;const T=tr(e==null?void 0:e.validateRules),i=T.MIN_TEXT_LENGTH??1,$=T.MAX_TEXT_LENGTH??255,R=T.DATE_RANGE_MIN,h=T.DATE_RANGE_MAX;if(!Er(r,+i,+$)&&!(R||h)){const N=u.replace("{min}",i).replace("{max}",$);return{[n]:`${f.LENGTH_TEXT_ERROR}${M}${N}`}}if(!cr(r,+R,+h)&&(R||h)){if(R&&R){const N=b.replace("{min}",L(R)).replace("{max}",L(h));return{[n]:`${f.DATE_RANGE_ERROR}${M}${N}`}}if(typeof R>"u"&&typeof h<"u"){const N=d.replace("{max}",L(h));return{[n]:`${f.DATE_MAX_ERROR}${M}${N}`}}if(typeof h>"u"&&typeof R<"u"){const N=c.replace("{min}",L(R));return{[n]:`${f.DATE_MIN_ERROR}${M}${N}`}}}const C={numeric:{validate:ar,error:`${f.NUMERIC_ERROR}${M}${l}`},"alphanum-with-spaces":{validate:nr,error:`${f.ALPHA_NUM_WITH_SPACES_ERROR}${M}${s}`},alphanumeric:{validate:or,error:`${f.ALPHA_NUMERIC_ERROR}${M}${p}`},alpha:{validate:ur,error:`${f.ALPHA_ERROR}${M}${_}`},email:{validate:lr,error:`${f.EMAIL_ERROR}${M}${O}`},date:{validate:sr,error:`${f.DATE_ERROR}${M}${I}`},url:{validate:dr,error:`${f.URL_ERROR}${M}${D}`}}[T.INPUT_VALIDATION];return C&&!C.validate(r)&&!((H=a[n])!=null&&H.length)?{[n]:C.error}:E},Rr=["auth-reset-password-form__buttons--signin","auth-sign-up-form-buttons--signin","auth-sign-in-form__button--forgot","auth-sign-in-form__button--signup"],hr=({fieldsConfig:r,onSubmit:e})=>{const t=rr({requiredFieldError:"Auth.FormText.requiredFieldError.default",lengthTextError:"Auth.FormText.lengthTextError.default",numericError:"Auth.FormText.numericError.default",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError.default",alphaNumericError:"Auth.FormText.alphaNumericError.default",alphaError:"Auth.FormText.alphaError.default",emailError:"Auth.FormText.emailError.default",dateError:"Auth.FormText.dateError.default",dateRangeError:"Auth.FormText.dateRangeError.default",dateMaxError:"Auth.FormText.dateMaxError.default",dateMinError:"Auth.FormText.dateMinError.default",urlError:"Auth.FormText.urlError.default"}),a=g(null),o=g(!1),[u,l]=B({}),[s,p]=B({}),_=S(()=>{let d=!0;const c={...s};let n=null;for(const[E,T]of Object.entries(u)){const i=r==null?void 0:r.find(R=>{var h;return(h=R==null?void 0:R.customUpperCode)==null?void 0:h.includes(E)}),$=P(T.toString(),i,t,c);$[E]&&(Object.assign(c,$),d=!1),n||(n=Object.keys(c).find(R=>c[R])??null)}if(p(c),n&&a.current){const E=a.current.elements.namedItem(n);E==null||E.focus()}return d},[s,r,u,t]);k(()=>{if(r!=null&&r.length){const{initialData:d,errorList:c}=er(r);l(n=>({...d,...n})),p(c)}},[JSON.stringify(r)]);const O=S(async d=>{const c=d.target,n=!Rr.some(E=>c.classList.contains(E));!o.current&&n&&(await j(0),o.current=!0)},[]),I=S(d=>{const{name:c,value:n,type:E,checked:T}=d==null?void 0:d.target,i=E==="checkbox"?T:n;l(h=>({...h,[c]:i}));const $=r==null?void 0:r.find(h=>{var F;return(F=h==null?void 0:h.customUpperCode)==null?void 0:F.includes(c)});let R={...s};if($){const h=P(i.toString(),$,t,R);h&&Object.assign(R,h),p(R)}},[r,s,t]),D=S(d=>{const{name:c,value:n,type:E,checked:T}=d==null?void 0:d.target,i=E==="checkbox"?T:n,$=r==null?void 0:r.find(R=>R.customUpperCode===c);if($){const R={...s},h=P(i.toString(),$,t,R);h&&Object.assign(R,h),p(R)}},[s,r,t]),b=S(d=>{d.preventDefault();const c=_();e==null||e(d,c)},[_,e]);return{formData:u,errors:s,formRef:a,handleChange:I,handleBlur:D,handleSubmit:b,handleFocus:O}};var x=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(x||{});const Z=r=>{const e={errorKey:"",defaultErrorMessage:""};if(!r)return e;const t=r.indexOf(M);return t===-1?e:{errorKey:r.substring(0,t).trim(),defaultErrorMessage:r.substring(t+M.length).trim()}},U=m(({item:r,errorConfig:e,className:t,itemClassName:a,loading:o,children:u})=>{const{errorKey:l,defaultErrorMessage:s}=Z(e),p=v(`Auth.FormText.${l}.${r.code}`)[r.code];let _="";return s.length&&(_=p||s),A(y,{error:_,className:Q([a,`${a}--${r.id}`,[`${a}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${t}--${r.id}`,disabled:o||r.disabled,children:u},r.id)}),X=m(({item:r,valueMessage:e,errorConfig:t,onBlur:a,onChange:o,onFocus:u,className:l,itemClassName:s,loading:p})=>A(U,{item:r,errorConfig:t,className:l,itemClassName:s,loading:p,children:A(z,{type:"text",name:r.customUpperCode,value:e??r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,autocomplete:r.autocomplete,onBlur:a,onChange:o,onFocus:u})})),W=m(({item:r,valueMessage:e,errorConfig:t,onBlur:a,onChange:o,className:u,itemClassName:l,loading:s})=>{var _;const p=(_=r.options.find(O=>O.isDefault))==null?void 0:_.value;return A(U,{item:r,errorConfig:t,className:u,itemClassName:l,loading:s,children:A(w,{name:r.customUpperCode,floatingLabel:`${r.label} ${r.required?"*":""}`,placeholder:r.label,"aria-label":r.label,options:r.options,onBlur:a,handleSelect:o,defaultValue:p??e??r.defaultValue,value:p??e??r.defaultValue})})}),pr=m(({item:r,valueMessage:e,errorConfig:t,onBlur:a,onChange:o,className:u,itemClassName:l,loading:s})=>A(U,{item:r,errorConfig:t,className:u,itemClassName:l,loading:s,children:A(K,{type:"text",name:r.customUpperCode,value:e||r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,onBlur:a,onChange:o,disabled:s||r.disabled})})),Ar=m(({item:r,valueMessage:e,errorConfig:t,onBlur:a,onChange:o,className:u,itemClassName:l,loading:s})=>A(U,{item:r,errorConfig:t,className:u,itemClassName:l,loading:s,children:A(V,{name:r.customUpperCode,checked:e||r.defaultValue,placeholder:r.label,label:`${r.label} ${r.required?"*":""}`,onBlur:a,onChange:o})})),Tr=m(({item:r,valueMessage:e,errorConfig:t,onBlur:a,onChange:o,className:u,itemClassName:l,loading:s})=>A(U,{item:r,errorConfig:t,className:u,itemClassName:l,loading:s,children:A(Y,{name:r.customUpperCode,value:e??r.defaultValue,label:`${r.label} ${r.required?"*":""}`,onBlur:a,onChange:o})})),$r=({slots:r,item:e,handleOnChange:t,handleOnBlur:a,handleOnFocus:o,errorConfig:u,errors:l})=>{const{errorKey:s,defaultErrorMessage:p}=Z(u),_=v(`Auth.FormText.${s}.${e.code}`)[e.code];let O="";p.length&&(O=_||p);const I={inputName:e.customUpperCode,handleOnChange:t,handleOnBlur:a,handleOnFocus:o,errorMessage:O,errors:l,config:e};return A(J,{"data-testid":`signUpFormInput_${e.code}`,name:`SignUpFormInput_${e.code}`,slot:r==null?void 0:r[`SignUpFormInput_${e.code}`],context:I},e.id)},Nr=m(({slots:r,name:e,loading:t,children:a,className:o="defaultForm",fieldsConfig:u=[],onSubmit:l,...s})=>{const{formData:p,errors:_,formRef:O,handleChange:I,handleBlur:D,handleSubmit:b,handleFocus:d}=hr({onSubmit:l,fieldsConfig:u}),c=`${o}__field`;return q("form",{className:o,onSubmit:b,name:e,ref:O,onFocus:d,...s,children:[u.map(n=>{const E=_==null?void 0:_[n.customUpperCode],T=p==null?void 0:p[n.customUpperCode],i=!!(r!=null&&r[`SignUpFormInput_${n.code}`]),$=A($r,{slots:r,item:n,handleOnChange:I,handleOnBlur:D,handleOnFocus:d,errorConfig:E,errors:_});switch(n.fieldType){case x.TEXT:return i?$:n.options.length?A(W,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,onFocus:d,itemClassName:c,className:o,loading:t}):A(X,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,onFocus:d,itemClassName:c,className:o,loading:t});case x.MULTILINE:return i?$:A(X,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,onFocus:d,itemClassName:c,className:o,loading:t});case x.SELECT:return i?$:A(W,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,itemClassName:c,className:o,loading:t});case x.DATE:return i?$:A(pr,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,itemClassName:c,className:o,loading:t});case x.BOOLEAN:return i?$:A(Ar,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,itemClassName:c,className:o,loading:t});case x.TEXTAREA:return i?$:A(Tr,{item:n,valueMessage:T,errorConfig:E,onBlur:D,onChange:I,itemClassName:c,className:o,loading:t});default:return null}}),a]})});export{Nr as F,rr as u};
|
package/chunks/Button2.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as E,Fragment as Z,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{useState as R,useCallback as L,useRef as H,useEffect as P}from"@dropins/tools/preact-hooks.js";import*as f from"@dropins/tools/preact-compat.js";import{memo as W,useCallback as _}from"@dropins/tools/preact-compat.js";import{initReCaptcha as G}from"@dropins/tools/recaptcha.js";import{useText as j}from"@dropins/tools/i18n.js";import{classes as M}from"@dropins/tools/lib.js";import{Field as w,Picker as q,Input as C,InputDate as X,Checkbox as z,TextArea as B,Button as g}from"@dropins/tools/components.js";/* empty css */const Ir=r=>{if(!r)return null;const t=new FormData(r);if(t&&typeof t.entries=="function"){const o=t.entries();if(o&&typeof o[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(o)))||{}}return{}},Dr=r=>typeof r=="function",J=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)"})))),Y=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"})),K=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"})),Q={success:E(Y,{}),warning:E(J,{}),error:E(K,{})},xr=()=>{const[r,t]=R({}),o=L(s=>{if(!s||!s.type){t({});return}const c=Q[s.type];t({...s,icon:c})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:o}};var v=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(v||{});const rr=W(({loading:r,values:t,fields:o=[],errors:s,className:c="",onChange:d,onBlur:p,onFocus:A})=>{const l=`${c}__field`,$=_((e,n,a)=>{var T;const h=(T=e.options.find(N=>N.isDefault))==null?void 0:T.value;return E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:E(q,{name:e.customUpperCode,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:d,defaultValue:h??n??e.defaultValue,value:h??n??e.defaultValue})},e.id)},[c,r,l,p,d]),m=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(C,{type:"text",name:e.customUpperCode,value:n??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d,onFocus:A})},e.id),[c,r,l,p,d,A]),I=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:E(X,{type:"text",name:e.customUpperCode,value:n||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d,disabled:r||e.disabled})},e.id),[c,r,l,p,d]),x=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(z,{name:e.customUpperCode,checked:n||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[c,r,l,p,d]),D=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(B,{type:"text",name:e.customUpperCode,value:n??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[c,r,l,p,d]);return o.length?E(Z,{children:o.map(e=>{const n=s==null?void 0:s[e.customUpperCode],a=t==null?void 0:t[e.customUpperCode];switch(e.fieldType){case v.TEXT:return e.options.length?$(e,a,n):m(e,a,n);case v.MULTILINE:return m(e,a,n);case v.SELECT:return $(e,a,n);case v.DATE:return I(e,a,n);case v.BOOLEAN:return x(e,a,n);case v.TEXTAREA:return D(e,a,n);default:return null}})}):null}),er=r=>r.reduce((t,{customUpperCode:o,required:s,defaultValue:c})=>(s&&o&&(t.initialData[o]=c||"",t.errorList[o]=""),t),{initialData:{},errorList:{}}),tr=r=>r.reduce((t,o)=>({...t,[o.name]:o.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),sr=r=>/^[a-zA-Z]+$/.test(r),lr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),cr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),ur=(r,t,o)=>{const s=new Date(r).getTime()/1e3;return!(isNaN(s)||s<0||typeof t<"u"&&s<t||typeof o<"u"&&s>o)},k=r=>{if(!r||r.trim()==="")return"";const t=parseInt(r,10);if(!isNaN(t)){const c=new Date(t*1e3);return isNaN(c.getTime())?"":c.toISOString().split("T")[0]}const o=new Date(r);if(isNaN(o.getTime()))return"";const s=parseInt(r.split("-")[1],10);return s>12||s<1?"":o.toISOString().split("T")[0]},dr=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),ir=(r,t,o)=>{const s=r.length;return s>=t&&s<=o},O=(r,t,o,s)=>{var F,y;const{requiredFieldError:c,lengthTextError:d,numericError:p,alphaNumWithSpacesError:A,alphaNumericError:l,alphaError:$,emailError:m,dateError:I,urlError:x,dateLengthError:D,dateMaxError:e,dateMinError:n}=o,a=t==null?void 0:t.customUpperCode,h={[a]:""};if(s[a]&&delete s[a],t!=null&&t.required&&!r)return{[a]:c};if(!(t!=null&&t.required)&&!r||!((F=t==null?void 0:t.validateRules)!=null&&F.length))return h;const T=tr(t==null?void 0:t.validateRules),N=T.MIN_TEXT_LENGTH??1,b=T.MAX_TEXT_LENGTH??255,u=T.DATE_RANGE_MIN,i=T.DATE_RANGE_MAX;if(!ir(r,+N,+b)&&!(u||i))return{[a]:d.replace("{min}",N).replace("{max}",b)};if(!ur(r,+u,+i)&&(u||i)){if(u&&u)return{[a]:D.replace("{min}",k(u)).replace("{max}",k(i))};if(typeof u>"u"||typeof i>"u")return{[a]:i?e.replace("{max}",k(i)):n.replace("{min}",k(u))}}const V={numeric:{validate:ar,error:p},"alphanum-with-spaces":{validate:nr,error:A},alphanumeric:{validate:or,error:l},alpha:{validate:sr,error:$},email:{validate:lr,error:m},date:{validate:cr,error:I},url:{validate:dr,error:x}}[T.INPUT_VALIDATION];return V&&!V.validate(r)&&!((y=s[a])!=null&&y.length)?{[a]:V.error}:h},pr=["auth-reset-password-form__buttons--signin","auth-sign-up-form-buttons--signin","auth-sign-in-form__button--forgot","auth-sign-in-form__button--signup"],hr=({fieldsConfig:r,onSubmit:t})=>{const o=j({requiredFieldError:"Auth.FormText.requiredFieldError",lengthTextError:"Auth.FormText.lengthTextError",numericError:"Auth.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Auth.FormText.alphaNumericError",alphaError:"Auth.FormText.alphaError",emailError:"Auth.FormText.emailError",dateError:"Auth.FormText.dateError",dateLengthError:"Auth.FormText.dateLengthError",dateMaxError:"Auth.FormText.dateMaxError",dateMinError:"Auth.FormText.dateMinError",urlError:"Auth.FormText.urlError"}),s=H(null),c=H(!1),[d,p]=R({}),[A,l]=R({}),$=L(()=>{let e=!0;const n={...A};let a=null;for(const[h,T]of Object.entries(d)){const N=r==null?void 0:r.find(u=>{var i;return(i=u==null?void 0:u.customUpperCode)==null?void 0:i.includes(h)}),b=O(T.toString(),N,o,n);b[h]&&(Object.assign(n,b),e=!1),a||(a=Object.keys(n).find(u=>n[u])??null)}if(l(n),a&&s.current){const h=s.current.elements.namedItem(a);h==null||h.focus()}return e},[A,r,d,o]);P(()=>{if(r!=null&&r.length){const{initialData:e,errorList:n}=er(r);p(a=>({...e,...a})),l(n)}},[JSON.stringify(r)]);const m=L(async e=>{const n=e.target,a=!pr.some(h=>n.classList.contains(h));!c.current&&a&&(await G(0),c.current=!0)},[]),I=L(e=>{const{name:n,value:a,type:h,checked:T}=e==null?void 0:e.target,N=h==="checkbox"?T:a;p(i=>({...i,[n]:N}));const b=r==null?void 0:r.find(i=>{var S;return(S=i==null?void 0:i.customUpperCode)==null?void 0:S.includes(n)});let u={...A};if(b){const i=O(N.toString(),b,o,u);i&&Object.assign(u,i),l(u)}},[r,A,o]),x=L(e=>{const{name:n,value:a,type:h,checked:T}=e==null?void 0:e.target,N=h==="checkbox"?T:a,b=r==null?void 0:r.find(u=>u.customUpperCode===n);if(b){const u={...A},i=O(N.toString(),b,o,u);i&&Object.assign(u,i),l(u)}},[A,r,o]),D=L(e=>{e.preventDefault();const n=$();t==null||t(e,n)},[$,t]);return{formData:d,errors:A,formRef:s,handleChange:I,handleBlur:x,handleSubmit:D,handleFocus:m}},vr=({name:r,loading:t,children:o,className:s="defaultForm",fieldsConfig:c=[],onSubmit:d,...p})=>{const{formData:A,errors:l,formRef:$,handleChange:m,handleBlur:I,handleSubmit:x,handleFocus:D}=hr({onSubmit:d,fieldsConfig:c});return U("form",{className:s,onSubmit:x,name:r,ref:$,onFocus:D,...p,children:[E(rr,{className:s,onFocus:D,fields:c,onChange:m,onBlur:I,errors:l,values:A,loading:t}),o]})},Lr=({type:r,buttonText:t,variant:o,className:s="",enableLoader:c=!1,onClick:d,style:p,icon:A,...l})=>{const $=L(I=>{d==null||d(I)},[d]);return U(g,{icon:A,style:p,type:r,variant:o,className:M(["auth-button",s,c?"enableLoader":""]),onClick:$,...l,children:[E("span",{className:"auth-button__text",children:t}),c?E("div",{className:"auth-button__wrapper",children:E("span",{className:"auth-button__loader"})}):null]})};export{Lr as B,vr as F,Dr as c,Ir as g,xr as u};
|
|
3
|
+
import{jsx as s,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{useState as g,useCallback as l}from"@dropins/tools/preact-hooks.js";import*as t from"@dropins/tools/preact-compat.js";import{classes as d}from"@dropins/tools/lib.js";import{Button as w}from"@dropins/tools/components.js";import"./Button.js";const M=e=>{if(!e)return null;const r=new FormData(e);if(r&&typeof r.entries=="function"){const n=r.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},S=e=>typeof e=="function",E=e=>t.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},t.createElement("g",{clipPath:"url(#clip0_841_1324)"},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),t.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"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_841_1324"},t.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),v=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.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"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),L=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.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"}),t.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"})),k={success:s(v,{}),warning:s(E,{}),error:s(L,{})},b=()=>{const[e,r]=g({}),n=l(o=>{if(!o||!o.type){r({});return}const c=k[o.type];r({...o,icon:c})},[]);return{inLineAlertProps:e,handleSetInLineAlertProps:n}},y=({type:e,buttonText:r,variant:n,className:o="",enableLoader:c=!1,onClick:a,style:i,icon:u,...h})=>{const m=l(p=>{a==null||a(p)},[a]);return f(w,{icon:u,style:i,type:e,variant:n,className:d(["auth-button",o,c?"enableLoader":""]),onClick:m,...h,children:[s("span",{className:"auth-button__text",children:r}),c?s("div",{className:"auth-button__wrapper",children:s("span",{className:"auth-button__loader"})}):null]})};export{y as B,S as c,M as g,b as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js"
|
|
3
|
+
import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{F as h}from"./Button.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as _}from"./requestPasswordResetEmail.js";import{g as F,c as w,u as P,B as p}from"./Button2.js";import{useState as x,useCallback as g}from"@dropins/tools/preact-hooks.js";import{useText as R}from"@dropins/tools/i18n.js";import{Header as N,InLineAlert as v}from"@dropins/tools/components.js";import{s as E,D as L}from"./simplifyTransformAttributesForm.js";import*as y from"@dropins/tools/preact-compat.js";const T=t=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),D=({routeSignIn:t,onErrorCallback:a,setActiveComponent:m,handleSetInLineAlertProps:s})=>{const n=R({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[r,e]=x(!1),d=g(async u=>{u.preventDefault(),e(!0);const i=F(u.target);if(i&&i.email){const f=await _(i.email);f.success?s==null||s({type:"success",text:n.successPasswordResetEmailNotification.replace("{email}",i.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,n.successPasswordResetEmailNotification]),c=g(()=>{if(w(m)){m("signInForm");return}w(t)&&(window.location.href=t())},[m,t]);return{isLoading:r,submitResetPassword:d,redirectToSignInPage:c}},$=({formSize:t="default",routeSignIn:a,setActiveComponent:m,onErrorCallback:s,...n})=>{const r=R({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=P(),{isLoading:c,submitResetPassword:u,redirectToSignInPage:i}=D({routeSignIn:a,setActiveComponent:m,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...n,className:b(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[o(N,{title:r.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(v,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(h,{"aria-labelledby":r.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:u,loading:c,fieldsConfig:E(L),children:l("div",{className:"auth-reset-password-form__buttons",children:[o(p,{className:"auth-reset-password-form__buttons--signin",type:"button",variant:"tertiary",style:{padding:"0"},icon:o(T,{style:{transform:"rotate(90deg)"}}),buttonText:r.buttonSecondary,enableLoader:!1,onClick:i}),o(p,{type:"submit",buttonText:r.buttonPrimary,variant:"primary",enableLoader:c})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{$ as R};
|
package/chunks/SignInForm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as m,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as z}from"@dropins/tools/lib.js";import{c as E,g as R,u as tt,B as K}from"./Button2.js";import{useState as y,useCallback as c,useEffect as J,useMemo as rt}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as at}from"./getCustomerToken.js";import{r as et}from"./resendConfirmationEmail.js";import{s as ot,a as it}from"./simplifyTransformAttributesForm.js";import{f as st,E as nt}from"./focusOnEmptyPasswordField.js";import{c as ut}from"./confirmEmail.js";import{useText as mt}from"@dropins/tools/i18n.js";import{Header as ct,InLineAlert as ft,InputPassword as dt}from"@dropins/tools/components.js";import{u as lt,F as ht}from"./Button.js";const gt=({emailConfirmationStatusMessage:t,translations:e,initialEmailValue:s,routeSignUp:l,routeForgotPassword:u,routeRedirectOnSignIn:F,onErrorCallback:_,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:i,routeRedirectOnEmailConfirmationClose:b})=>{const[S,L]=y(""),[v,n]=y(!1),[g,d]=y(""),[A,w]=y(!1),[U,j]=y({userName:"",status:!1}),[q,x]=y(!1),[P,N]=y([]),k=c(async r=>{i(),n(!0),w(!1),N([]),await et(r)},[i]),V=c(r=>{r.length?w(!1):w(!0),d(r)},[]);J(()=>{t!=null&&t.text&&i({text:t.text,type:t.status?t.status:void 0})},[t,i]);const D=c(()=>{g.length||w(!0)},[g]),p=c((r,o)=>g.length?!1:(w(!0),o&&st(r,g,""),!0),[g]),B=c((r,o)=>{o!=null&&o.userName&&(r.target.reset(),E(F)?window.location.href=F():(f==null||f({userName:o==null?void 0:o.userName,status:!0}),j({userName:o==null?void 0:o.userName,status:!0})))},[f,F]),C=c((r,o)=>{var I;if((I=r==null?void 0:r.errorMessage)!=null&&I.length){L(o);const H=r.errorMessage.includes("This account isn't confirmed. Verify and try again."),T=H?e.resendEmailInformationText:r.errorMessage;N(H?[{label:e.resendEmailButtonText,onClick:()=>{k(o)}}]:[]),i({text:T,type:"error"}),d("")}},[k,i,e.resendEmailButtonText,e.resendEmailInformationText]),G=c(async(r,o)=>{if(i(),p(r,o))return;x(!0);const I=R(r.target);if(Object.values(I).every(T=>T)){const{email:T,password:Y}=I,$=await at({email:T,password:Y,handleSetInLineAlertProps:i,onErrorCallback:_,translations:e});C($,T),B(r,$),w(!1)}x(!1)},[e,_,p,C,B,i]),O=c(()=>{if(E(a)){a("resetPasswordForm");return}E(u)&&(window.location.href=u())},[u,a]),Q=c(()=>{if(E(h)&&h(),E(a)){a("signUpForm");return}E(l)&&(window.location.href=l())},[h,l,a]),W=rt(()=>{const r=ot(it);return s!=null&&s.length?r==null?void 0:r.map(o=>({...o,defaultValue:s})):r},[s]),X=c(()=>{i(),E(b)?window.location.href=b():n(!1)},[i,b]);return{additionalActionsAlert:P,userEmail:S,defaultEnhancedEmailFields:W,passwordError:A,isSuccessful:U,isLoading:q,signInPasswordValue:g,showEmailConfirmationForm:v,setShowEmailConfirmationForm:n,setSignInPasswordValue:d,submitLogInUser:G,forgotPasswordCallback:O,onSignUpLinkClickCallback:Q,handledOnPrimaryButtonClick:X,handleSetPassword:V,onBlurPassword:D}},wt=()=>{let t=new URL(window.location.href),e=t.searchParams.get("email"),s=t.searchParams.get("key");e&&s&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},yt=({enableEmailConfirmation:t})=>{const e=mt({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[s,l]=y({text:"",status:""});return J(()=>{if(t){const{search:u}=window.location;u.includes("email=")&&u.includes("key=")&&(async()=>{var f,h,i;const _=new URLSearchParams(u),a=await ut({customerEmail:_.get("email"),customerConfirmationKey:_.get("key")});if(!a)return null;(f=a==null?void 0:a.errors)!=null&&f.length?l({text:a==null?void 0:a.errors[0].message,status:"error"}):(l({text:a.data.confirmEmail.customer.email?e.accountConfirmationEmailSuccessMessage.replace("{email}",(i=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:i.email):e.accountConfirmMessage,status:"success"}),wt())})()}},[t,e]),{emailConfirmationStatusMessage:s}},Mt=({slots:t,labels:e,formSize:s="default",initialEmailValue:l="",renderSignUpLink:u=!1,enableEmailConfirmation:F=!1,hideCloseBtnOnEmailConfirmation:_=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:i,onSuccessCallback:b,setActiveComponent:S,onErrorCallback:L,onSignUpLinkClick:v})=>{const n=lt({title:"Auth.SignInForm.title",buttonPrimary:"Auth.SignInForm.buttonPrimary",buttonSecondary:"Auth.SignInForm.buttonSecondary",buttonTertiary:"Auth.SignInForm.buttonTertiary",resendEmailInformationText:"Auth.Notification.resendEmailNotification.informationText",resendEmailButtonText:"Auth.Notification.resendEmailNotification.buttonText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError.default"}),{emailConfirmationStatusMessage:g}=yt({enableEmailConfirmation:F}),{inLineAlertProps:d,handleSetInLineAlertProps:A}=tt(),{userEmail:w,additionalActionsAlert:U,defaultEnhancedEmailFields:j,passwordError:q,isSuccessful:x,isLoading:P,signInPasswordValue:N,showEmailConfirmationForm:k,submitLogInUser:V,forgotPasswordCallback:D,onSignUpLinkClickCallback:p,handledOnPrimaryButtonClick:B,handleSetPassword:C,onBlurPassword:G}=gt({translations:n,emailConfirmationStatusMessage:g,initialEmailValue:l,routeSignUp:i,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:S,onErrorCallback:L,onSuccessCallback:b,onSignUpLinkClick:v,handleSetInLineAlertProps:A,routeRedirectOnEmailConfirmationClose:a});return x.status&&(t!=null&&t.SuccessNotification)?m(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:x}}):k?m(nt,{formSize:s,userEmail:w,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:_,handleSetInLineAlertProps:A,onPrimaryButtonClick:B}):M("div",{className:z(["auth-sign-in-form",`auth-sign-in-form--${s}`]),"data-testid":"signInForm",children:[m(ct,{title:(e==null?void 0:e.formTitleText)??n.title,divider:!1,className:"auth-sign-in-form__title"}),d.text?m(ft,{"data-testid":"authInLineAlert",className:"auth-sign-in-form__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:U}):null,M(ht,{name:"signIn_form",className:"auth-sign-in-form__form",onSubmit:V,loading:P,fieldsConfig:j,children:[m(dt,{hideStatusIndicator:!0,className:"auth-sign-in-form__form__password",autoComplete:"current-password",errorMessage:q?n.requiredFieldError:void 0,defaultValue:N,onValue:C,onBlur:G,placeholder:n.placeholder,floatingLabel:n.floatingLabel}),M("div",{className:"auth-sign-in-form__form__buttons",children:[M("div",{className:"auth-sign-in-form__form__buttons__combine",children:[m(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonTertiary,className:"auth-sign-in-form__button auth-sign-in-form__button--forgot",enableLoader:!1,onClick:D,"data-testid":"switchToSignUp"}),u?m("span",{}):null,u?m(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,className:"auth-sign-in-form__button auth-sign-in-form__button--signup",enableLoader:!1,onClick:p}):null]}),m(K,{type:"submit",buttonText:(e==null?void 0:e.primaryButtonText)??n.buttonPrimary,variant:"primary",className:"auth-sign-in-form__button auth-sign-in-form__button--submit",enableLoader:P})]})]}),m("div",{id:"generateCustomerToken"})]})};export{Mt as S};
|
package/chunks/SignUpForm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as n,jsxs as I}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Ee,classes as Ne}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as ye,c as Ue,a as Le}from"./createCustomerAddress.js";import{useState as p,useEffect as Me,useCallback as x,useMemo as Te}from"@dropins/tools/preact-hooks.js";import{s as de,b as xe}from"./simplifyTransformAttributesForm.js";import{v as Se,u as ve,a as qe}from"./usePasswordValidationMessage.js";import{a as Ce}from"./getCustomerToken.js";import{p as le,E as ce}from"./getStoreConfig.js";import{c as $,g as Ae,u as Be,F as Ke,B as fe}from"./Button2.js";import{c as je}from"./transform-attributes-form.js";import{f as he,E as Ie}from"./focusOnEmptyPasswordField.js";import{Header as Ge,InLineAlert as He,InputPassword as ge,Field as te,Checkbox as se}from"@dropins/tools/components.js";/* empty css */import{S as Ve}from"./SkeletonLoader.js";import{useText as We}from"@dropins/tools/i18n.js";const pe=(u,t)=>t!=null&&t.length?u.map(e=>{var d;const s=(d=t.find(({code:m})=>m===e.code))==null?void 0:d.defaultValue;return s?{...e,defaultValue:s}:e}):u,$e=({inputsDefaultValueSet:u,fieldsConfigForApiVersion1:t,apiVersion2:e})=>{const[s,d]=p([]);return Me(()=>{(async()=>{if(e){const i=await ye("customer_account_create");if(i!=null&&i.length)if(u!=null&&u.length){const w=pe(i,u);d(w)}else d(i)}else{const i=de(xe),w=de(t),N=pe(i,u);d(t&&t.length?w:N)}})()},[e,t,u]),{fieldsListConfigs:s}},Oe=(u,t)=>{const e=["dob","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],s=je(u,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!t)return{...s,...s!=null&&s.gender?{gender:Number(s==null?void 0:s.gender)}:{}};const d={},m=[];return Object.keys(s).forEach(i=>{e.includes(i)?d[i]=i.includes("gender")?Number(s[i]):s[i]:m.push({attribute_code:i,value:s[i]})}),m.length>0&&(d.custom_attributes=m),d},Je=({requireRetypePassword:u,addressesData:t,translations:e,isEmailConfirmationRequired:s,apiVersion2:d=!0,passwordConfigs:m,isAutoSignInEnabled:i,routeRedirectOnSignIn:w,routeSignIn:N,onErrorCallback:S,onSuccessCallback:h,setActiveComponent:b,handleSetInLineAlertProps:P,routeRedirectOnEmailConfirmationClose:q})=>{const[O,C]=p(!1),[o,a]=p(""),[g,l]=p(""),[G,y]=p(""),[H,A]=p(!1),[J,B]=p({userName:"",status:!1}),[c,K]=p(""),[Q,V]=p(!1),[X,U]=p(!1),[W,Y]=p(!0),Z=x(r=>{const f=r.target.value;C(!f.length),f.length&&o.length&&f!==o&&l(e.passwordMismatch)},[o,e.passwordMismatch]),k=x(r=>{const f=r.target.value;l(f.length?"":e.requiredFieldError),f.length&&c.length&&f!==c&&l(e.passwordMismatch)},[c,e.passwordMismatch,e.requiredFieldError]),z=x(r=>{a(r),l(r?c===r?"":e.passwordMismatch:e.requiredFieldError)},[e,c]),D=x(({target:r})=>{Y(r.checked)},[]),R=x(()=>{if($(b)){b("signInForm");return}$(N)&&(window.location.href=N())},[b,N]),ee=x(r=>{K(r),C(!r.length),r===o&&l("")},[o]),re=x(()=>{P(),K(""),$(q)?window.location.href=q():(A(!1),b==null||b("signInForm"))},[P,q,b]),L=()=>{V(!0),U(!1)},_=(r,f)=>{const oe=c.length&&o.length,j=c!==o,v=()=>{C(!c.length),o||l(e.requiredFieldError),oe&&j&&l(e.passwordMismatch)},M=()=>{l(o.length?e.passwordMismatch:e.requiredFieldError),he(r,c,o)};return f?u&&(g.length||j)?(L(),M(),!0):(he(r,c,""),v(),!1):(L(),v(),!0)};return{showPasswordErrorMessage:O,confirmPassword:o,confirmPasswordMessage:g,isKeepMeLogged:W,userEmail:G,showEmailConfirmationForm:H,isSuccessful:J,isClickSubmit:Q,signUpPasswordValue:c,isLoading:X,onSubmitSignUp:async(r,f)=>{var ae,ne,me;if(P(),l(""),U(!0),_(r,f))return;const{confirmPasswordField:oe,...j}=Ae(r.target),{email:v,password:M,is_subscribed:Fe}=j,we=(m==null?void 0:m.requiredCharacterClasses)||0,be=(m==null?void 0:m.minLength)||1;if(!Se(M,we)||be>(M==null?void 0:M.length)){L();return}const Pe=Oe({...j,is_subscribed:!!Fe||!1},d),F=await Ue(Pe,d);if((ae=F==null?void 0:F.errors)!=null&&ae.length){const{errors:T}=F;P==null||P({type:"error",text:(ne=T[0])==null?void 0:ne.message}),S==null||S(T),le(ce.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),y(v)}else{const T=F==null?void 0:F.firstName;if(le(ce.CREATE_ACCOUNT_EVENT,{email:F==null?void 0:F.email,updateProfile:!0}),s||!i){if(h==null||h({userName:T,status:!0}),s){(me=r.target)==null||me.reset(),K(""),A(!0),y(v),U(!1);return}if(!i){U(!1),B({userName:T,status:!0});return}}const E=await Ce({email:v,password:M,translations:e,handleSetInLineAlertProps:P,onErrorCallback:S});if(E!=null&&E.userName){if(t!=null&&t.length)for(const ue of t)try{await Le(ue)}catch(_e){console.error(e.failedCreateCustomerAddress,ue,_e)}$(w)?window.location.href=w():(h==null||h({userName:E==null?void 0:E.userName,status:!0}),B({userName:E==null?void 0:E.userName,status:!0}))}else h==null||h({userName:T,status:!0}),B({userName:T,status:!0})}U(!1)},signInButton:R,handleSetSignUpPasswordValue:ee,onKeepMeLoggedChange:D,handleHideEmailConfirmationForm:re,handleConfirmPasswordChange:z,onBlurPassword:Z,onBlurConfirmPassword:k}},ur=({requireRetypePassword:u=!1,addressesData:t,formSize:e="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:d,apiVersion2:m=!0,isAutoSignInEnabled:i=!0,displayTermsOfUseCheckbox:w=!1,displayNewsletterCheckbox:N=!1,hideCloseBtnOnEmailConfirmation:S=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:b,routeSignIn:P,onErrorCallback:q,onSuccessCallback:O,setActiveComponent:C,slots:o})=>{const a=We({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError",confirmPasswordPlaceholder:"Auth.SignUpForm.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Auth.SignUpForm.confirmPassword.floatingLabel",passwordMismatch:"Auth.SignUpForm.confirmPassword.passwordMismatch"}),{passwordConfigs:g,isEmailConfirmationRequired:l}=ve(),{fieldsListConfigs:G}=$e({fieldsConfigForApiVersion1:d,apiVersion2:m,inputsDefaultValueSet:s}),{inLineAlertProps:y,handleSetInLineAlertProps:H}=Be(),{showPasswordErrorMessage:A,confirmPassword:J,confirmPasswordMessage:B,isKeepMeLogged:c,userEmail:K,showEmailConfirmationForm:Q,isSuccessful:V,isClickSubmit:X,signUpPasswordValue:U,isLoading:W,onSubmitSignUp:Y,signInButton:Z,handleSetSignUpPasswordValue:k,onKeepMeLoggedChange:z,handleHideEmailConfirmationForm:D,handleConfirmPasswordChange:R,onBlurPassword:ee,onBlurConfirmPassword:re}=Je({requireRetypePassword:u,addressesData:t,translations:a,isEmailConfirmationRequired:l,apiVersion2:m,passwordConfigs:g,isAutoSignInEnabled:i,routeRedirectOnSignIn:b,routeSignIn:P,onErrorCallback:q,onSuccessCallback:O,setActiveComponent:C,handleSetInLineAlertProps:H,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:L,defaultLengthMessage:_}=qe({password:U,isClickSubmit:X,passwordConfigs:g}),ie=Te(()=>A?a.requiredFieldError:L==="error"||(_==null?void 0:_.status)==="error"?" ":"",[_==null?void 0:_.status,L,A,a.requiredFieldError]),r=!l&&(t==null?void 0:t.length);return!G.length&&m?n("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:n(Ve,{activeSkeleton:"signUpForm"})}):V.status&&(o!=null&&o.SuccessNotification)?n(Ee,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:o==null?void 0:o.SuccessNotification,context:{isSuccessful:V}}):Q?n(Ie,{formSize:e,userEmail:K,inLineAlertProps:y,hideCloseBtnOnEmailConfirmation:S,handleSetInLineAlertProps:H,onPrimaryButtonClick:D}):I("div",{className:Ne(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[n(Ge,{title:a.title,divider:!1,className:"auth-sign-up-form__title"}),y.text?n(He,{className:"auth-sign-up-form__notification",type:y.type,variant:"secondary",heading:y.text,icon:y.icon}):null,I(Ke,{onSubmit:Y,className:"auth-sign-up-form__form",loading:W,name:"signUp_form",fieldsConfig:G,children:[I(ge,{validateLengthConfig:_,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:g==null?void 0:g.minLength,errorMessage:ie,defaultValue:U,uniqueSymbolsStatus:L,requiredCharacterClasses:g==null?void 0:g.requiredCharacterClasses,onValue:k,placeholder:a.placeholder,floatingLabel:a.floatingLabel,onBlur:ee,children:[u?n("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:n(ge,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:a.confirmPasswordPlaceholder,floatingLabel:a.confirmPasswordFloatingLabel,errorMessage:B,defaultValue:J,onValue:R,onBlur:re})}):null,r?n("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:n(te,{children:n(se,{name:"",placeholder:a.keepMeLoggedText,label:a.keepMeLoggedText,checked:c,onChange:z})})}):null]}),N||w?I("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[N?n(te,{children:n(se,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:a.subscribedDefaultText,label:a.subscribedDefaultText})}):null,w?n(te,{children:n(se,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:a.privacyPolicyDefaultText,label:a.privacyPolicyDefaultText})}):null]}):null,I("div",{className:"auth-sign-up-form-buttons",children:[n(fe,{className:"auth-sign-up-form-buttons--signin",type:"button",variant:"tertiary",style:{padding:0},buttonText:a.buttonSecondary,enableLoader:!1,onClick:Z}),n(fe,{type:"submit",buttonText:a.buttonPrimary,variant:"primary",enableLoader:W})]})]}),n("div",{id:"createCustomerV2"})]})};export{ur as S};
|
|
3
|
+
import{jsx as u,jsxs as I}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Pe,classes as _e}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as Ne,c as ye,a as Ee}from"./createCustomerAddress.js";import{useState as p,useEffect as Le,useCallback as T,useMemo as Ue}from"@dropins/tools/preact-hooks.js";import{s as de,b as Me}from"./simplifyTransformAttributesForm.js";import{v as xe,u as Te,a as Se}from"./usePasswordValidationMessage.js";import{a as ve}from"./getCustomerToken.js";import{p as qe,E as Ce}from"./getStoreConfig.js";import{c as $,g as Ae,u as Be,B as ce}from"./Button2.js";import{c as Ke}from"./transform-attributes-form.js";import{f as le,E as je}from"./focusOnEmptyPasswordField.js";import{Header as Ie,InLineAlert as Ge,InputPassword as fe,Field as te,Checkbox as se}from"@dropins/tools/components.js";import{u as He,F as Ve}from"./Button.js";import{S as We}from"./SkeletonLoader.js";const he=(m,t)=>t!=null&&t.length?m.map(e=>{var d;const s=(d=t.find(({code:o})=>o===e.code))==null?void 0:d.defaultValue;return s?{...e,defaultValue:s}:e}):m,$e=({inputsDefaultValueSet:m,fieldsConfigForApiVersion1:t,apiVersion2:e})=>{const[s,d]=p([]);return Le(()=>{(async()=>{if(e){const i=await Ne("customer_account_create");if(i!=null&&i.length)if(m!=null&&m.length){const F=he(i,m);d(F)}else d(i)}else{const i=de(Me),F=de(t),N=he(i,m);d(t&&t.length?F:N)}})()},[e,t,m]),{fieldsListConfigs:s.map(o=>({...o,...o.code==="email"?{autocomplete:"username"}:{}}))}},Je=(m,t)=>{const e=["dob","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],s=Ke(m,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!t)return{...s,...s!=null&&s.gender?{gender:Number(s==null?void 0:s.gender)}:{}};const d={},o=[];return Object.keys(s).forEach(i=>{e.includes(i)?d[i]=i.includes("gender")?Number(s[i]):s[i]:o.push({attribute_code:i,value:s[i]})}),o.length>0&&(d.custom_attributes=o),d},Oe=({requireRetypePassword:m,addressesData:t,translations:e,isEmailConfirmationRequired:s,apiVersion2:d=!0,passwordConfigs:o,isAutoSignInEnabled:i,routeRedirectOnSignIn:F,routeSignIn:N,onErrorCallback:S,onSuccessCallback:h,setActiveComponent:w,handleSetInLineAlertProps:b,routeRedirectOnEmailConfirmationClose:q})=>{const[J,C]=p(!1),[a,n]=p(""),[g,c]=p(""),[G,y]=p(""),[H,A]=p(!1),[O,B]=p({userName:"",status:!1}),[l,K]=p(""),[Q,V]=p(!1),[X,E]=p(!1),[W,Y]=p(!0),Z=T(r=>{const f=r.target.value;C(!f.length),f.length&&a.length&&f!==a&&c(e.passwordMismatch)},[a,e.passwordMismatch]),k=T(r=>{const f=r.target.value;c(f.length?"":e.requiredFieldError),f.length&&l.length&&f!==l&&c(e.passwordMismatch)},[l,e.passwordMismatch,e.requiredFieldError]),z=T(r=>{n(r),c(r?l===r?"":e.passwordMismatch:e.requiredFieldError)},[e,l]),D=T(({target:r})=>{Y(r.checked)},[]),R=T(()=>{if($(w)){w("signInForm");return}$(N)&&(window.location.href=N())},[w,N]),ee=T(r=>{K(r),C(!r.length),r===a&&c("")},[a]),re=T(()=>{b(),K(""),$(q)?window.location.href=q():(A(!1),w==null||w("signInForm"))},[b,q,w]),U=()=>{V(!0),E(!1)},P=(r,f)=>{const ie=l.length&&a.length,j=l!==a,v=()=>{C(!l.length),a||c(e.requiredFieldError),ie&&j&&c(e.passwordMismatch)},M=()=>{c(a.length?e.passwordMismatch:e.requiredFieldError),le(r,l,a)};return f?m&&(g.length||j)?(U(),M(),!0):(le(r,l,""),v(),!1):(U(),v(),!0)};return{showPasswordErrorMessage:J,confirmPassword:a,confirmPasswordMessage:g,isKeepMeLogged:W,userEmail:G,showEmailConfirmationForm:H,isSuccessful:O,isClickSubmit:Q,signUpPasswordValue:l,isLoading:X,onSubmitSignUp:async(r,f)=>{var ae,ne,ue;if(b(),c(""),E(!0),P(r,f))return;const{confirmPasswordField:ie,...j}=Ae(r.target),{email:v,password:M,is_subscribed:ge}=j,pe=(o==null?void 0:o.requiredCharacterClasses)||0,Fe=(o==null?void 0:o.minLength)||1;if(!xe(M,pe)||Fe>(M==null?void 0:M.length)){U();return}const we=Je({...j,is_subscribed:!!ge||!1},d),L=await ye(we,d);if((ae=L==null?void 0:L.errors)!=null&&ae.length){const{errors:x}=L;b==null||b({type:"error",text:(ne=x[0])==null?void 0:ne.message}),S==null||S(x),y(v)}else{const x=L==null?void 0:L.firstName;if(qe(Ce.CREATE_ACCOUNT_EVENT,{...L}),s||!i){if(h==null||h({userName:x,status:!0}),s){(ue=r.target)==null||ue.reset(),K(""),A(!0),y(v),E(!1);return}if(!i){E(!1),B({userName:x,status:!0});return}}const _=await ve({email:v,password:M,translations:e,handleSetInLineAlertProps:b,onErrorCallback:S});if(_!=null&&_.userName){if(t!=null&&t.length)for(const me of t)try{await Ee(me)}catch(be){console.error(e.failedCreateCustomerAddress,me,be)}$(F)?window.location.href=F():(h==null||h({userName:_==null?void 0:_.userName,status:!0}),B({userName:_==null?void 0:_.userName,status:!0}))}else h==null||h({userName:x,status:!0}),B({userName:x,status:!0})}E(!1)},signInButton:R,handleSetSignUpPasswordValue:ee,onKeepMeLoggedChange:D,handleHideEmailConfirmationForm:re,handleConfirmPasswordChange:z,onBlurPassword:Z,onBlurConfirmPassword:k}},ur=({requireRetypePassword:m=!1,addressesData:t,formSize:e="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:d,apiVersion2:o=!0,isAutoSignInEnabled:i=!0,displayTermsOfUseCheckbox:F=!1,displayNewsletterCheckbox:N=!1,hideCloseBtnOnEmailConfirmation:S=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:q,onSuccessCallback:J,setActiveComponent:C,slots:a})=>{const n=He({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError.default",confirmPasswordPlaceholder:"Auth.SignUpForm.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Auth.SignUpForm.confirmPassword.floatingLabel",passwordMismatch:"Auth.SignUpForm.confirmPassword.passwordMismatch"}),{passwordConfigs:g,isEmailConfirmationRequired:c}=Te(),{fieldsListConfigs:G}=$e({fieldsConfigForApiVersion1:d,apiVersion2:o,inputsDefaultValueSet:s}),{inLineAlertProps:y,handleSetInLineAlertProps:H}=Be(),{showPasswordErrorMessage:A,confirmPassword:O,confirmPasswordMessage:B,isKeepMeLogged:l,userEmail:K,showEmailConfirmationForm:Q,isSuccessful:V,isClickSubmit:X,signUpPasswordValue:E,isLoading:W,onSubmitSignUp:Y,signInButton:Z,handleSetSignUpPasswordValue:k,onKeepMeLoggedChange:z,handleHideEmailConfirmationForm:D,handleConfirmPasswordChange:R,onBlurPassword:ee,onBlurConfirmPassword:re}=Oe({requireRetypePassword:m,addressesData:t,translations:n,isEmailConfirmationRequired:c,apiVersion2:o,passwordConfigs:g,isAutoSignInEnabled:i,routeRedirectOnSignIn:w,routeSignIn:b,onErrorCallback:q,onSuccessCallback:J,setActiveComponent:C,handleSetInLineAlertProps:H,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:U,defaultLengthMessage:P}=Se({password:E,isClickSubmit:X,passwordConfigs:g}),oe=Ue(()=>A?n.requiredFieldError:U==="error"||(P==null?void 0:P.status)==="error"?" ":"",[P==null?void 0:P.status,U,A,n.requiredFieldError]),r=!c&&(t==null?void 0:t.length);return!G.length&&o?u("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:u(We,{activeSkeleton:"signUpForm"})}):V.status&&(a!=null&&a.SuccessNotification)?u(Pe,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:V}}):Q?u(je,{formSize:e,userEmail:K,inLineAlertProps:y,hideCloseBtnOnEmailConfirmation:S,handleSetInLineAlertProps:H,onPrimaryButtonClick:D}):I("div",{className:_e(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[u(Ie,{title:n.title,divider:!1,className:"auth-sign-up-form__title"}),y.text?u(Ge,{className:"auth-sign-up-form__notification",type:y.type,variant:"secondary",heading:y.text,icon:y.icon}):null,I(Ve,{onSubmit:Y,className:"auth-sign-up-form__form",loading:W,name:"signUp_form",fieldsConfig:G,slots:a,children:[I(fe,{validateLengthConfig:P,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:g==null?void 0:g.minLength,errorMessage:oe,defaultValue:E,uniqueSymbolsStatus:U,requiredCharacterClasses:g==null?void 0:g.requiredCharacterClasses,onValue:k,placeholder:n.placeholder,floatingLabel:n.floatingLabel,onBlur:ee,children:[m?u("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:u(fe,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:n.confirmPasswordPlaceholder,floatingLabel:n.confirmPasswordFloatingLabel,errorMessage:B,defaultValue:O,onValue:R,onBlur:re})}):null,r?u("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:u(te,{children:u(se,{name:"",placeholder:n.keepMeLoggedText,label:n.keepMeLoggedText,checked:l,onChange:z})})}):null]}),N||F?I("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[N?u(te,{children:u(se,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:n.subscribedDefaultText,label:n.subscribedDefaultText})}):null,F?u(te,{children:u(se,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:n.privacyPolicyDefaultText,label:n.privacyPolicyDefaultText})}):null]}):null,I("div",{className:"auth-sign-up-form-buttons",children:[u(ce,{className:"auth-sign-up-form-buttons--signin",type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,enableLoader:!1,onClick:Z}),u(ce,{type:"submit",buttonText:n.buttonPrimary,variant:"primary",enableLoader:W})]})]}),u("div",{id:"createCustomerV2"})]})};export{ur as S};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as c,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as y,Header as p}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as C}from"./resendConfirmationEmail.js";import{useState as x,useCallback as E}from"@dropins/tools/preact-hooks.js";import{useText as u}from"@dropins/tools/i18n.js"
|
|
3
|
+
import{jsxs as c,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as y,Header as p}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as C}from"./resendConfirmationEmail.js";import{useState as x,useCallback as E}from"@dropins/tools/preact-hooks.js";import{useText as u}from"@dropins/tools/i18n.js";import"./Button.js";import{B as f}from"./Button2.js";const g=({userEmail:o,handleSetInLineAlertProps:t})=>{const a=u({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[r,e]=x(!1);return{handleEmailConfirmation:E(async()=>{var n,s;if(e(!0),o){const i=await C(o);if(i){const d=(n=i==null?void 0:i.errors)==null?void 0:n.length,h=(s=i==null?void 0:i.data)==null?void 0:s.resendConfirmationEmail;t(d?{type:"error",text:a.technicalErrorSendEmail}:{type:h?"success":"error",text:a.emailConfirmationMessage})}}e(!1)},[t,a,o]),disabledButton:r}},I=({formSize:o,userEmail:t,inLineAlertProps:a,hideCloseBtnOnEmailConfirmation:r,handleSetInLineAlertProps:e,onPrimaryButtonClick:l})=>{const n=u({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:s,disabledButton:i}=g({userEmail:t,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-email-confirmation-form",`auth-email-confirmation-form--${o}`]),children:[a.text?m(y,{className:"auth-signInForm__notification",type:a.type,variant:"secondary",heading:a.text,icon:a.icon,"data-testid":"authInLineAlert"}):null,m(p,{title:n.title,divider:!1,className:"auth-email-confirmation-form__title"}),t!=null&&t.length?m("span",{className:"auth-email-confirmation-form__subtitle",children:`${n.subtitle} ${t}`}):null,m("span",{className:"auth-email-confirmation-form__text",children:n.mainText}),c("div",{className:"auth-email-confirmation-form__buttons",children:[m(f,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,enableLoader:!1,onClick:s,disabled:i}),r?null:m(f,{type:"submit",buttonText:n.buttonPrimary,variant:"primary",enableLoader:!1,disabled:i,onClick:l})]})]})},M=(o,t,a)=>{const r=o.target.querySelector('input[name="password"]'),e=o.target.querySelector('input[name="confirmPasswordField"]');r&&!t.length?r.focus():e&&!a.length&&e.focus()};export{I as E,M as f};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{a as
|
|
3
|
+
import{a as G,f as h,h as $}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as w}from"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";import{c as R}from"./initialize.js";import{CUSTOMER_INFORMATION_FRAGMENT as C}from"../fragments.js";import{a as U,C as O,p as x,E as y}from"./getStoreConfig.js";import{s as F}from"./setReCaptchaToken.js";const v=t=>{var f,i,o,a,r,m,u,N,T,s,g,c,d;const e={email:((i=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:i.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:m.lastname)??"",isSubscribed:((N=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:N.is_subscribed)??!1};return k(e,(d=(c=(g=(s=(T=R)==null?void 0:T.getConfig())==null?void 0:s.models)==null?void 0:g.CustomerModel)==null?void 0:c.transformer)==null?void 0:d.call(c,t.data))},D=`
|
|
4
4
|
query GET_CUSTOMER_DATA {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_INFORMATION_FRAGMENT
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
${
|
|
10
|
-
`,
|
|
9
|
+
${C}
|
|
10
|
+
`,K=async t=>{if(t){const{authHeaderConfig:e}=R.getConfig();G(e.header,e.tokenPrefix?`${e.tokenPrefix} ${t}`:t)}return await h(D,{method:"GET",cache:"force-cache"}).then(e=>v(e)).catch($)},S=`
|
|
11
11
|
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
12
12
|
generateCustomerToken(email: $email, password: $password) {
|
|
13
13
|
token
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,
|
|
16
|
+
`,V=async({email:t,password:e,translations:f,onErrorCallback:i,handleSetInLineAlertProps:o})=>{var s,g,c,d,E;await F();const a=await h(S,{method:"POST",variables:{email:t,password:e}}).catch($);if(!((g=(s=a==null?void 0:a.data)==null?void 0:s.generateCustomerToken)!=null&&g.token)){const M=f.customerTokenErrorMessage,_=a!=null&&a.errors?a.errors[0].message:M;return i==null||i(_),o==null||o({type:"error",text:_}),{errorMessage:_,userName:""}}const r=(d=(c=a==null?void 0:a.data)==null?void 0:c.generateCustomerToken)==null?void 0:d.token,m=await K(r),u=m==null?void 0:m.firstName,N=m==null?void 0:m.email;if(!u||!N){const M=f.customerTokenErrorMessage;return i==null||i(M),o==null||o({type:"error",text:M}),{errorMessage:M,userName:""}}const T=await U();return document.cookie=`${O.auth_dropin_firstname}=${u}; path=/; ${T}; `,document.cookie=`${O.auth_dropin_user_token}=${r}; path=/; ${T}; `,w.emit("authenticated",!!r),x((E=y)==null?void 0:E.SIGN_IN,{...m}),{errorMessage:"",userName:u}};export{V as a,K as g};
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as
|
|
3
|
+
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as N,h as T}from"./network-error.js";const C=t=>({firstName:t.firstName,lastName:t.lastName,emailAddress:(t==null?void 0:t.email)||"",accountId:(t==null?void 0:t.email)||""}),D={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},r=3600,d=t=>{var e,o,a,n,s,u,_,f,m,g;return{autocompleteOnStorefront:((o=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:o.autocomplete_on_storefront)||!1,minLength:((n=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:n.minimum_password_length)||3,requiredCharacterClasses:+((u=(s=t==null?void 0:t.data)==null?void 0:s.storeConfig)==null?void 0:u.required_character_classes_number)||0,createAccountConfirmation:((f=(_=t==null?void 0:t.data)==null?void 0:_.storeConfig)==null?void 0:f.create_account_confirmation)||!1,customerAccessTokenLifetime:((g=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:g.customer_access_token_lifetime)*r||r}},S=t=>{const e=t.map(o=>o.message).join(" ");throw Error(e)},U=t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},v=async()=>{try{const t=sessionStorage.getItem("storeConfig");let o=(t?JSON.parse(t):{}).customerAccessTokenLifetime;if(!o){const a=await b();sessionStorage.setItem("storeConfig",JSON.stringify(a)),o=(a==null?void 0:a.customerAccessTokenLifetime)||r}return`Max-Age=${o}`}catch(t){return console.error("getCookiesLifetime() Error:",t),`Max-Age=${r}`}},h="accountContext";var I=(t=>(t.CREATE_ACCOUNT_EVENT="create-account",t.SIGN_IN="sign-in",t.SIGN_OUT="sign-out",t))(I||{});const c={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function l(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function E(t,e){const o=l();o.push({[t]:null}),o.push({[t]:e})}function i(t,e){l().push(a=>{const n=a.getState?a.getState():{};a.push({event:t,eventInfo:{...n,...e}})})}function O(t){const e=C(t);E(h,e),i(c.CREATE_ACCOUNT)}function A(t){const e=C(t);E(h,e),i(c.SIGN_IN)}function k(){i(c.SIGN_OUT)}const x=(t,e)=>{const o=sessionStorage.getItem("storeConfig"),n={...o?JSON.parse(o):{},...e};switch(t){case"create-account":O(n);break;case"sign-in":A(n);break;case"sign-out":k();break;default:return null}},w=`
|
|
4
4
|
query GET_STORE_CONFIG {
|
|
5
5
|
storeConfig {
|
|
6
6
|
autocomplete_on_storefront
|
|
@@ -14,4 +14,4 @@ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f
|
|
|
14
14
|
customer_access_token_lifetime
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`,b=async()=>await
|
|
17
|
+
`,b=async()=>await N(w,{method:"GET",cache:"force-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?S(t.errors):d(t)}).catch(T);export{D as C,I as E,v as a,U as d,b as g,S as h,x as p};
|
package/chunks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{R as b,R as c}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js"
|
|
3
|
+
import{R as b,R as c}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./Button2.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{b as ResetPasswordForm,c as default};
|
package/chunks/index2.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{S as q,S as v}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/
|
|
3
|
+
import{S as q,S as v}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"./getCustomerToken.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./initialize.js";import"../fragments.js";import"./getStoreConfig.js";import"./setReCaptchaToken.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./focusOnEmptyPasswordField.js";import"./confirmEmail.js";export{q as SignInForm,v as default};
|
package/chunks/index3.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{S as w,S as y}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"../fragments.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./initialize.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"./Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js"
|
|
3
|
+
import{S as w,S as y}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"../fragments.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./initialize.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"./Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"./Button.js";import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as
|
|
3
|
+
import{f as n,h as s}from"./network-error.js";import{C as m,d as u,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=`
|
|
4
4
|
mutation REVOKE_CUSTOMER_TOKEN {
|
|
5
5
|
revokeCustomerToken {
|
|
6
6
|
result
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,_=async()=>await
|
|
10
|
-
ERROR revokeCustomerToken: ${e.message}`;console.error(r)}return e}).catch(
|
|
9
|
+
`,_=async()=>await n(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=>{u(r)}),i.emit("authenticated",!1),c(E.SIGN_OUT,{});else{const r=`
|
|
10
|
+
ERROR revokeCustomerToken: ${e.message}`;console.error(r)}return e}).catch(s);export{_ as r};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{t}from"./transform-attributes-form.js";const
|
|
3
|
+
import{t}from"./transform-attributes-form.js";const o=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-sign-in-form__form__email",frontend_input:"TEXT",is_required:!0,multiline_count:1,sort_order:1,is_unique:!1,label:"Email",options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}],autocomplete:"username"}],s=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-reset-password-form__form__item",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}],autocomplete:"username"}],n=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",multiline_count:1,sort_order:1,options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}],autocomplete:"username"},{customUpperCode:"firstname",code:"firstname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"First name",multiline_count:1,sort_order:2,options:[]},{customUpperCode:"lastname",code:"lastname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!1,is_unique:!1,label:"Last name",multiline_count:1,sort_order:3,options:[]}],i=e=>e!=null&&e.length?t({data:{attributesForm:{items:e}}}):[];export{s as D,o as a,n as b,i as s};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormElementProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare const InputCheckBoxElement: ({ item, valueMessage, errorConfig, onBlur, onChange, className, itemClassName, loading, }: FormElementProps) => import("preact/compat").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=InputCheckBoxElement.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormElementProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare const InputDateElement: ({ item, valueMessage, errorConfig, onBlur, onChange, className, itemClassName, loading, }: FormElementProps) => import("preact/compat").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=InputDateElement.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormElementProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare const InputElement: ({ item, valueMessage, errorConfig, onBlur, onChange, onFocus, className, itemClassName, loading, }: FormElementProps) => import("preact/compat").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=InputElement.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormElementProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare const SelectElement: ({ item, valueMessage, errorConfig, onBlur, onChange, className, itemClassName, loading, }: FormElementProps) => import("preact/compat").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=SelectElement.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormElementProps } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare const TextAreaElement: ({ item, valueMessage, errorConfig, onBlur, onChange, className, itemClassName, loading, }: FormElementProps) => import("preact/compat").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=TextAreaElement.d.ts.map
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export
|
|
18
|
-
export {
|
|
17
|
+
export { InputElement } from './InputElement';
|
|
18
|
+
export { SelectElement } from './SelectElement';
|
|
19
|
+
export { InputDateElement } from './InputDateElement';
|
|
20
|
+
export { InputCheckBoxElement } from './InputCheckBoxElement';
|
|
21
|
+
export { TextAreaElement } from './TextAreaElement';
|
|
22
|
+
export { FormSlot } from './FormSlot';
|
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FormProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
export declare const Form: ({ name, loading, children, className, fieldsConfig, onSubmit, ...props }: FormProps) => import("preact").JSX.Element;
|
|
3
|
+
export declare const Form: ({ slots, name, loading, children, className, fieldsConfig, onSubmit, ...props }: FormProps) => import("preact/compat").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -31,6 +31,7 @@ export declare const DEFAULT__SIGN_IN_EMAIL_FIELD: {
|
|
|
31
31
|
name: string;
|
|
32
32
|
value: string;
|
|
33
33
|
}[];
|
|
34
|
+
autocomplete: string;
|
|
34
35
|
}[];
|
|
35
36
|
export declare const DEFAULT__RESET_PASSWORD_EMAIL_FIELD: Record<string, string | boolean | unknown>[];
|
|
36
37
|
export declare const DEFAULT_SIGN_UP_FIELDS: ({
|
|
@@ -50,6 +51,7 @@ export declare const DEFAULT_SIGN_UP_FIELDS: ({
|
|
|
50
51
|
name: string;
|
|
51
52
|
value: string;
|
|
52
53
|
}[];
|
|
54
|
+
autocomplete: string;
|
|
53
55
|
} | {
|
|
54
56
|
customUpperCode: string;
|
|
55
57
|
code: string;
|
|
@@ -64,6 +66,7 @@ export declare const DEFAULT_SIGN_UP_FIELDS: ({
|
|
|
64
66
|
sort_order: number;
|
|
65
67
|
options: never[];
|
|
66
68
|
validateRules?: undefined;
|
|
69
|
+
autocomplete?: undefined;
|
|
67
70
|
})[];
|
|
68
71
|
export declare const DEFAULT_INPUTS_PROPS: Record<string, string | ''>;
|
|
69
72
|
//# sourceMappingURL=defaultCreateUserConfigs.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js"
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{R as i}from"../chunks/ResetPasswordForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/requestPasswordResetEmail.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/Button2.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";const F=({formSize:o,routeSignIn:t,onErrorCallback:m})=>r("div",{className:"auth-reset-password",children:r(i,{formSize:o,routeSignIn:t,onErrorCallback:m})});export{F as ResetPassword,F as default};
|
package/containers/SignIn.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js"
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as u}from"../chunks/SignInForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/Button2.js";import"../chunks/getCustomerToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../fragments.js";import"../chunks/getStoreConfig.js";import"../chunks/setReCaptchaToken.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/confirmEmail.js";const L=({slots:i,labels:o,enableEmailConfirmation:t,initialEmailValue:m,formSize:p,renderSignUpLink:n,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:e,routeForgotPassword:c,routeSignUp:d,onSuccessCallback:f,onErrorCallback:g,onSignUpLinkClick:l})=>r("div",{className:"auth-sign-in",children:r(u,{slots:i,labels:o,formSize:p,renderSignUpLink:n,initialEmailValue:m,enableEmailConfirmation:t,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeSignUp:d,onErrorCallback:g,onSuccessCallback:f,onSignUpLinkClick:l,routeForgotPassword:c,routeRedirectOnSignIn:e})});export{L as SignIn,L as default};
|
package/containers/SignUp.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js"
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import"@dropins/tools/i18n.js";import{S as h}from"../chunks/SignUpForm.js";import"@dropins/tools/preact-compat.js";import"../chunks/createCustomerAddress.js";import"../fragments.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/initialize.js";import"../chunks/transform-attributes-form.js";import"../chunks/getStoreConfig.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"../chunks/getCustomerToken.js";import"../chunks/Button2.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/SkeletonLoader.js";const P=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,requireRetypePassword:s,inputsDefaultValueSet:a,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,fieldsConfigForApiVersion1:u,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,onSuccessCallback:g,onErrorCallback:l,routeSignIn:S})=>r("div",{className:"auth-sign-up",children:r(h,{requireRetypePassword:s,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:u,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,routeSignIn:S,slots:i,onErrorCallback:l,onSuccessCallback:g})});export{P as SignUp,P as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as a,jsx as e,Fragment as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u,Slot as m}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"@dropins/tools/preact-hooks.js"
|
|
3
|
+
import{jsxs as a,jsx as e,Fragment as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u,Slot as m}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"@dropins/tools/preact-hooks.js";import"../chunks/Button.js";import{useText as d}from"@dropins/tools/i18n.js";import{r as f}from"../chunks/revokeCustomerToken.js";import"@dropins/tools/preact-compat.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getStoreConfig.js";const h=({formSize:c="default",className:n="",slots:i,labels:t})=>{const o=d({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return a("div",{className:u(["auth-success-notification-form",`auth-success-notification-form--${c}`,n]),id:"welcome-message",role:"alert","aria-live":"assertive","aria-labelledby":(t==null?void 0:t.headingText)??o.headingText,"aria-describedby":(t==null?void 0:t.messageText)??o.messageText,"tab-index":"-1",children:[e("p",{id:"welcome-heading",className:"auth-success-notification-form__title","data-testid":"notification-title",children:(t==null?void 0:t.headingText)??o.headingText}),e("p",{id:"welcome-details",className:"auth-success-notification-form__content-text","data-testid":"notification-content",children:(t==null?void 0:t.messageText)??o.messageText}),i!=null&&i.SuccessNotificationActions?e(m,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:i==null?void 0:i.SuccessNotificationActions,context:{}}):a(s,{children:[e(r,{"data-testid":"primaryButton",type:"button",className:"auth-success-notification-form__button auth-success-notification-form__button--top",onClick:()=>window.location.href="/",children:o.primaryButtonText}),e(r,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await f(),window.location.href="/"},children:o.secondaryButtonText})]})]})},C=({formSize:c="default",slots:n,className:i,labels:t})=>e("div",{className:"auth-success-notification",children:e(h,{formSize:c,className:i,slots:n,labels:t})});export{C as SuccessNotification,C as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as
|
|
3
|
+
import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Y,classes as $}from"@dropins/tools/lib.js";import{Header as Z,InLineAlert as k,InputPassword as S}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{useState as h,useEffect as z,useCallback as I}from"@dropins/tools/preact-hooks.js";import{u as W,F as O}from"../chunks/Button.js";import{v as g,u as R,a as C}from"../chunks/usePasswordValidationMessage.js";import{a as tt}from"../chunks/getCustomerToken.js";import{r as et}from"../chunks/resetPassword.js";import{c as j,g as at,u as st,B as rt}from"../chunks/Button2.js";import{useText as it}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"../chunks/getStoreConfig.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../fragments.js";import"../chunks/setReCaptchaToken.js";const J=(d,p)=>d.split("&").filter(r=>r.includes(p)).map(r=>r.split("=")[1])[0],ot=({isEmailConfirmationRequired:d,signInOnSuccess:p,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:w,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:N,routeSignInPage:o})=>{const s=it({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,n]=h({userName:"",status:!1}),[x,F]=h(""),[v,A]=h(!1),[P,L]=h(""),[y,M]=h(""),[T,c]=h(!1),[_,q]=h(!1),[b,B]=h([]);z(()=>{v&&!b.length&&(x.length?q(!1):q(!0))},[v,x,b]),z(()=>{const{search:f}=window.location;!f.includes("token=")&&!f.includes("email=")&&j(w)&&(window.location.href=w());const e=decodeURIComponent(f),V=J(e,"token"),E=J(e,"email");L(E),M(V)},[w]);const K=I(async f=>{f.preventDefault(),c(!0),B([]);const e=at(f.target),V=(e==null?void 0:e.password)&&P&&y;e!=null&&e.password||(q(!0),c(!1));const E=(t==null?void 0:t.requiredCharacterClasses)??0,X=(t==null?void 0:t.minLength)??0;if(!g(e==null?void 0:e.password,E)||e.password.length<+X){A(!0),c(!1);return}if(!V){m({type:"error",text:s.errorNotification}),c(!1);return}const{message:D,success:G}=await et(P,y,e.password);if(G){if(d||!d&&!p){i==null||i(),j(N)&&(window.location.href=N()),A(!0),c(!1),q(!1),F(""),B([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=o==null?void 0:o()}}]),m({type:"success",text:s.updatePasswordMessage});return}const l=await tt({email:P,password:e.password,handleSetInLineAlertProps:m,onErrorCallback:a,translations:s});l!=null&&l.userName&&(i==null||i(l==null?void 0:l.userName),j(r)?window.location.href=r():n({userName:l==null?void 0:l.userName,status:!0}))}else m({type:"error",text:D}),a==null||a({message:D,success:G});c(!1)},[P,y,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,d,p,o,a,i,r,m,N]),Q=I(f=>{F(f)},[]);return{additionalActionsAlert:b,passwordError:_,isSuccessful:U,updatePasswordValue:x,isClickSubmit:v,isLoading:T,submitUpdatePassword:K,handleSetUpdatePasswordValue:Q,setIsClickSubmit:A}},ut=({signInOnSuccess:d=!0,formSize:p="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:w,slots:a,onErrorCallback:i,onSuccessCallback:m,routeRedirectOnPasswordUpdate:N})=>{const o=W({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError.default"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=R(),{inLineAlertProps:n,handleSetInLineAlertProps:x}=st(),{additionalActionsAlert:F,passwordError:v,isSuccessful:A,updatePasswordValue:P,isClickSubmit:L,isLoading:y,submitUpdatePassword:M,handleSetUpdatePasswordValue:T}=ot({isEmailConfirmationRequired:U,signInOnSuccess:d,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:m,handleSetInLineAlertProps:x,routeRedirectOnPasswordUpdate:N,routeSignInPage:w}),{isValidUniqueSymbols:c,defaultLengthMessage:_}=C({password:P,isClickSubmit:L,passwordConfigs:s});return A.status&&(a!=null&&a.SuccessNotification)?u(Y,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:A}}):H("div",{className:$(["auth-update-password-form",`auth-update-password-form--${p}`]),children:[u(Z,{title:o.title,divider:!1,className:"auth-update-password-form__title"}),u(k,{className:$(["auth-update-password-form__notification",["auth-update-password-form__notification--show",!!(n!=null&&n.text)]]),variant:"secondary",heading:n==null?void 0:n.text,icon:n.icon,additionalActions:F}),H(O,{name:"updatePassword_form",className:"auth-update-password-form__form",onSubmit:M,loading:y,fieldsConfig:[],children:[u("div",{style:"display: none;",children:u("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),u(S,{defaultValue:P,onValue:T,className:"auth-update-password-form__form__item",autoComplete:"new-password",name:"password",errorMessage:v||c==="error"||(_==null?void 0:_.status)==="error"?o.requiredFieldError:void 0,minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:c,validateLengthConfig:_,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:o.placeholder,floatingLabel:o.floatingLabel}),u("div",{className:"auth-update-password-form__button",children:u(rt,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:y})})]})]})},Lt=({slots:d,formSize:p,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:w,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N})=>u("div",{className:"auth-update-password",children:u(ut,{formSize:p,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:w,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N,slots:d,routeRedirectOnPasswordUpdate:r})});export{Lt as UpdatePassword,Lt as default};
|
|
@@ -24,4 +24,15 @@ export interface CustomerModel {
|
|
|
24
24
|
message: string;
|
|
25
25
|
}[];
|
|
26
26
|
}
|
|
27
|
+
export interface AccountModel {
|
|
28
|
+
firstName?: string;
|
|
29
|
+
lastName?: string;
|
|
30
|
+
emailAddress?: string;
|
|
31
|
+
phoneNumber?: string;
|
|
32
|
+
countryCode?: string;
|
|
33
|
+
accountId?: string;
|
|
34
|
+
accountType?: string;
|
|
35
|
+
company?: string;
|
|
36
|
+
customerGroup?: string;
|
|
37
|
+
}
|
|
27
38
|
//# sourceMappingURL=customer-data.d.ts.map
|
|
@@ -1,53 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
17
|
-
export declare const loginContext: (ctx: any) => {
|
|
18
|
-
personalEmail: {
|
|
19
|
-
address: any;
|
|
20
|
-
};
|
|
21
|
-
userAccount: {
|
|
22
|
-
login: boolean;
|
|
23
|
-
};
|
|
24
|
-
commerce: {
|
|
25
|
-
commerceScope: {
|
|
26
|
-
storeCode: any;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export declare const logoutContext: (ctx: any) => {
|
|
31
|
-
userAccount: {
|
|
32
|
-
logout: boolean;
|
|
33
|
-
};
|
|
34
|
-
commerce: {
|
|
35
|
-
commerceScope: {
|
|
36
|
-
storeCode: any;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export declare const createAccountContext: (ctx: any) => {
|
|
41
|
-
personalEmail: {
|
|
42
|
-
address: any;
|
|
43
|
-
};
|
|
44
|
-
userAccount: {
|
|
45
|
-
updateProfile: any;
|
|
46
|
-
};
|
|
47
|
-
commerce: {
|
|
48
|
-
commerceScope: {
|
|
49
|
-
storeCode: any;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
1
|
+
import { AccountModel, CustomerModel } from '../models';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* References:
|
|
5
|
+
* https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/signInAEP.ts
|
|
6
|
+
* https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/createAccountAEP.ts
|
|
7
|
+
*/
|
|
8
|
+
export declare const transformAccount: (data: CustomerModel) => AccountModel;
|
|
53
9
|
//# sourceMappingURL=transform-auth.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { inputsDefaultValueSetProps } from '../../types';
|
|
2
|
-
import { AttributesFormItemsProps } from '../../data/models';
|
|
3
2
|
|
|
4
3
|
interface UseGetAttributesFormProps {
|
|
5
4
|
fieldsConfigForApiVersion1: {}[];
|
|
@@ -7,7 +6,28 @@ interface UseGetAttributesFormProps {
|
|
|
7
6
|
inputsDefaultValueSet?: inputsDefaultValueSetProps[];
|
|
8
7
|
}
|
|
9
8
|
export declare const useGetAttributesForm: ({ inputsDefaultValueSet, fieldsConfigForApiVersion1, apiVersion2, }: UseGetAttributesFormProps) => {
|
|
10
|
-
fieldsListConfigs:
|
|
9
|
+
fieldsListConfigs: {
|
|
10
|
+
autocomplete?: string | undefined;
|
|
11
|
+
code?: string | undefined;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
defaultValue?: string | number | boolean | undefined;
|
|
15
|
+
entityType?: string | undefined;
|
|
16
|
+
className?: string | undefined;
|
|
17
|
+
fieldType?: import('../../data/models').FieldEnumList | undefined;
|
|
18
|
+
multilineCount: number;
|
|
19
|
+
required?: boolean | undefined;
|
|
20
|
+
unique?: boolean | undefined;
|
|
21
|
+
label?: string | undefined;
|
|
22
|
+
orderNumber: number;
|
|
23
|
+
options?: {
|
|
24
|
+
is_default: boolean;
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
hidden?: boolean | undefined;
|
|
29
|
+
customUpperCode: string;
|
|
30
|
+
}[];
|
|
11
31
|
};
|
|
12
32
|
export {};
|
|
13
33
|
//# sourceMappingURL=useGetAttributesForm.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
/**
|
|
18
|
+
* A custom hook for handling translations with support for extensible error messages.
|
|
19
|
+
*
|
|
20
|
+
* @param defaultKeys - A mapping of keys to their translation paths.
|
|
21
|
+
* @returns A complete set of translations, including dynamically updated values for null error keys.
|
|
22
|
+
*/
|
|
23
|
+
export declare const useCustomTranslations: (defaultKeys: Record<string, string>) => Record<string, string>;
|
|
24
|
+
//# sourceMappingURL=useCustomTranslations.d.ts.map
|
package/lib/acdl.d.ts
CHANGED
|
@@ -19,7 +19,12 @@ declare enum EventsList {
|
|
|
19
19
|
SIGN_IN = "sign-in",
|
|
20
20
|
SIGN_OUT = "sign-out"
|
|
21
21
|
}
|
|
22
|
-
declare function
|
|
22
|
+
export declare function getAdobeDataLayer(): any;
|
|
23
|
+
/**
|
|
24
|
+
* Pushes an event to the Adobe Client Data Layer (ACDL)
|
|
25
|
+
* Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34
|
|
26
|
+
*/
|
|
27
|
+
declare function pushEvent(event: string, additionalContext?: any): void;
|
|
23
28
|
declare const publishEvents: (eventType: string, eventParams: any) => null | undefined;
|
|
24
29
|
export { EventsList, publishEvents, pushEvent };
|
|
25
30
|
//# sourceMappingURL=acdl.d.ts.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-auth", "version": "1.0.
|
|
1
|
+
{"name": "@dropins/storefront-auth", "version": "1.0.2", "@dropins/elsie": "~0.39.0", "license": "SEE LICENSE IN LICENSE.md"}
|
package/types/form.types.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
1
2
|
import { AttributesFormItemsProps, FieldEnumList } from '../data/models';
|
|
3
|
+
import { ComponentChildren } from 'preact';
|
|
2
4
|
|
|
3
5
|
export interface FormProps {
|
|
6
|
+
slots?: {
|
|
7
|
+
[key: string]: SlotProps;
|
|
8
|
+
};
|
|
4
9
|
fieldsConfig?: any;
|
|
5
10
|
name?: string;
|
|
6
11
|
className?: string;
|
|
@@ -11,6 +16,9 @@ export interface FormProps {
|
|
|
11
16
|
export interface useFormProps extends Omit<FormProps, 'children' | 'className' | 'name' | 'loading'> {
|
|
12
17
|
}
|
|
13
18
|
export interface FormInputsProps {
|
|
19
|
+
slots?: {
|
|
20
|
+
[key: string]: SlotProps;
|
|
21
|
+
};
|
|
14
22
|
className?: string;
|
|
15
23
|
errors?: Record<string, string>;
|
|
16
24
|
values?: Record<string, string | number | boolean>;
|
|
@@ -29,4 +37,34 @@ export interface FieldsProps extends Omit<AttributesFormItemsProps, 'options'> {
|
|
|
29
37
|
text: string;
|
|
30
38
|
}[];
|
|
31
39
|
}
|
|
40
|
+
export type FormElementProps = {
|
|
41
|
+
item: any;
|
|
42
|
+
valueMessage: string;
|
|
43
|
+
errorConfig: string;
|
|
44
|
+
className: string;
|
|
45
|
+
itemClassName: string;
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
onBlur?: (e: any) => void;
|
|
48
|
+
onChange?: (e: any) => void;
|
|
49
|
+
onFocus?: (e: any) => void;
|
|
50
|
+
};
|
|
51
|
+
export type FieldElementProps = {
|
|
52
|
+
item: any;
|
|
53
|
+
errorConfig: string;
|
|
54
|
+
className: string;
|
|
55
|
+
itemClassName: string;
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
children: ComponentChildren;
|
|
58
|
+
};
|
|
59
|
+
export type FormSlotProps = {
|
|
60
|
+
slots?: {
|
|
61
|
+
[key: string]: SlotProps;
|
|
62
|
+
};
|
|
63
|
+
item: any;
|
|
64
|
+
handleOnChange?: (e: any) => void;
|
|
65
|
+
handleOnBlur?: (e: any) => void;
|
|
66
|
+
handleOnFocus?: (e: any) => void;
|
|
67
|
+
errorConfig: string;
|
|
68
|
+
errors: Record<string, string>;
|
|
69
|
+
};
|
|
32
70
|
//# sourceMappingURL=form.types.d.ts.map
|
package/types/index.d.ts
CHANGED
|
@@ -35,4 +35,5 @@ export * from './api/confirmEmail.types';
|
|
|
35
35
|
export * from './api/resendConfirmationEmail.types';
|
|
36
36
|
export * from './emailConfirmationForm.types';
|
|
37
37
|
export * from './api/createCustomerAddress.types';
|
|
38
|
+
export * from './validationErrors.types';
|
|
38
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types in this enum are used to provide custom i18n translations for specific validation errors.
|
|
3
|
+
* Each key corresponds to an error type that maps to the `Auth.FormText` i18n values in `src/i18n/en_US.json`.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ValidationErrorTypes {
|
|
6
|
+
REQUIRED_FIELD_ERROR = "requiredFieldError",
|
|
7
|
+
NUMERIC_ERROR = "numericError",
|
|
8
|
+
ALPHA_NUM_WITH_SPACES_ERROR = "alphaNumWithSpacesError",
|
|
9
|
+
ALPHA_NUMERIC_ERROR = "alphaNumericError",
|
|
10
|
+
ALPHA_ERROR = "alphaError",
|
|
11
|
+
EMAIL_ERROR = "emailError",
|
|
12
|
+
DATE_ERROR = "dateError",
|
|
13
|
+
DATE_RANGE_ERROR = "dateRangeError",
|
|
14
|
+
DATE_MAX_ERROR = "dateMaxError",
|
|
15
|
+
DATE_MIN_ERROR = "dateMinError",
|
|
16
|
+
URL_ERROR = "urlError",
|
|
17
|
+
LENGTH_TEXT_ERROR = "lengthTextError"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `ERROR_CONFIG_SEPARATOR` uses the ASCII 31 (Unit Separator) character,
|
|
21
|
+
* a rarely used control character, to avoid conflicts with custom i18n error messages.
|
|
22
|
+
*
|
|
23
|
+
* Learn more: https://theasciicode.com.ar/ascii-control-characters/unit-separator-ascii-code-31.html
|
|
24
|
+
*/
|
|
25
|
+
export declare const ERROR_CONFIG_SEPARATOR: string;
|
|
26
|
+
//# sourceMappingURL=validationErrors.types.d.ts.map
|