@dropins/storefront-auth 0.0.1-alpha9 → 1.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/confirmEmail/graphql/confirmEmail.graphql.d.ts +1 -1
- package/api/createCustomer/createCustomer.d.ts +3 -2
- package/api/createCustomer/graphql/createCustomer.graphql.d.ts +1 -1
- package/api/createCustomer/graphql/createCustomerV2.graphql.d.ts +1 -1
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +1 -1
- package/api/fragments.d.ts +2 -0
- package/api/getAttributesForm/getAttributesForm.d.ts +1 -1
- package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +1 -1
- package/api/getCustomerData/getCustomerData.d.ts +2 -2
- package/api/getCustomerData/graphql/getCustomerData.graphql.d.ts +1 -1
- package/api/getCustomerToken/getCustomerToken.d.ts +2 -2
- package/api/graphql/CustomerFragment.graphql.d.ts +2 -0
- package/api/initialize/initialize.d.ts +5 -1
- package/api/resendConfirmationEmail/graphql/resendConfirmationEmail.graphql.d.ts +1 -1
- package/api/resetPassword/graphql/resetPassword.graphql.d.ts +1 -1
- package/api.js +3 -1
- package/chunks/Button2.js +3 -0
- package/chunks/ResetPasswordForm.js +3 -1
- package/chunks/SignInForm.js +3 -1
- package/chunks/SignUpForm.js +3 -1
- package/chunks/SkeletonLoader.js +2 -0
- package/chunks/confirmEmail.js +5 -4
- package/chunks/createCustomerAddress.js +21 -15
- package/chunks/focusOnEmptyPasswordField.js +3 -0
- package/chunks/getCustomerToken.js +7 -6
- package/chunks/getStoreConfig.js +4 -2
- package/chunks/index.js +3 -1
- package/chunks/index2.js +3 -1
- package/chunks/index3.js +3 -1
- package/chunks/initialize.js +2 -0
- package/chunks/network-error.js +3 -1
- package/chunks/requestPasswordResetEmail.js +2 -0
- package/chunks/resendConfirmationEmail.js +6 -3
- package/chunks/resetPassword.js +12 -2
- package/chunks/revokeCustomerToken.js +2 -0
- package/chunks/setReCaptchaToken.js +3 -1
- package/chunks/simplifyTransformAttributesForm.js +3 -1
- package/chunks/transform-attributes-form.js +3 -1
- package/chunks/usePasswordValidationMessage.js +2 -0
- package/components/Form/Form.d.ts +4 -0
- package/components/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/index.d.ts +3 -4
- package/configs/defaultCreateUserConfigs.d.ts +42 -5
- package/containers/AuthCombine.js +3 -1
- package/containers/ResetPassword.js +3 -1
- package/containers/SignIn.js +3 -1
- package/containers/SignUp.js +3 -1
- package/containers/SuccessNotification.js +3 -1
- package/containers/UpdatePassword.js +3 -1
- package/data/models/attributes-form.d.ts +36 -16
- package/data/models/customer-data.d.ts +8 -3
- package/data/transforms/index.d.ts +1 -0
- package/data/transforms/transform-attributes-form.d.ts +3 -2
- package/data/transforms/transform-create-customer.d.ts +7 -0
- package/data/transforms/transform-customer-data.d.ts +2 -2
- package/fragments.d.ts +1 -0
- package/fragments.js +11 -0
- package/hooks/api/useGetAttributesForm.d.ts +1 -2
- package/hooks/{ui → components}/useForm.d.ts +3 -2
- package/hooks/components/useSignInForm.d.ts +5 -2
- package/hooks/components/useSignUpForm.d.ts +7 -1
- package/hooks/components/useUpdatePasswordForm.d.ts +5 -2
- package/hooks/useInLineAlert.d.ts +3 -3
- package/i18n/en_US.json.d.ts +32 -12
- package/lib/acdl.d.ts +2 -2
- package/lib/convertCase.d.ts +4 -0
- package/lib/focusOnEmptyPasswordField.d.ts +2 -0
- package/lib/initializeFormDataAndErrors.d.ts +10 -0
- package/lib/mergeFormObjects.d.ts +1 -2
- package/lib/simplifyTransformAttributesForm.d.ts +1 -1
- package/lib/validationFields.d.ts +33 -0
- package/package.json +1 -1
- package/render.js +4 -8
- package/types/api/createCustomer.types.d.ts +16 -11
- package/types/api/createCustomerAddress.types.d.ts +2 -2
- package/types/api/getAttributesForm.types.d.ts +5 -3
- package/types/api/getCustomerData.types.d.ts +1 -0
- package/types/emailConfirmationForm.types.d.ts +4 -4
- package/types/form.types.d.ts +24 -3
- package/types/notification.types.d.ts +5 -1
- package/types/resetPassword.types.d.ts +2 -2
- package/types/signIn.types.d.ts +4 -3
- package/types/signUp.types.d.ts +3 -2
- package/types/successNotification.types.d.ts +4 -2
- package/types/updatePassword.types.d.ts +4 -3
- package/chunks/EmailConfirmationForm.js +0 -1
- package/chunks/useInLineAlert.js +0 -1
- package/components/UI/Form/Form.d.ts +0 -5
- package/components/UI/FormInputs/FormInputs.d.ts +0 -13
- package/components/UI/Title/Title.d.ts +0 -11
- package/components/UI/Title/index.d.ts +0 -3
- package/components/UI/index.d.ts +0 -5
- /package/components/{UI/Button → Button}/Button.d.ts +0 -0
- /package/components/{UI/Button → Button}/index.d.ts +0 -0
- /package/components/{UI → Form}/FormInputs/index.d.ts +0 -0
- /package/components/{UI/Form → Form}/index.d.ts +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CONFIRM_EMAIL = "\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(input: {
|
|
1
|
+
export declare const CONFIRM_EMAIL = "\n mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {\n confirmEmail(\n input: { email: $email, confirmation_key: $confirmation_key }\n ) {\n customer {\n email\n }\n }\n }\n";
|
|
2
2
|
//# sourceMappingURL=confirmEmail.graphql.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Customer } from '../../types';
|
|
2
|
+
import { CustomerModel } from '../../data/models';
|
|
2
3
|
|
|
3
|
-
export declare const createCustomer: (forms: Customer, apiVersion2: boolean) => Promise<
|
|
4
|
+
export declare const createCustomer: (forms: Customer, apiVersion2: boolean) => Promise<CustomerModel>;
|
|
4
5
|
//# sourceMappingURL=createCustomer.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CREATE_CUSTOMER
|
|
1
|
+
export declare const CREATE_CUSTOMER: string;
|
|
2
2
|
//# sourceMappingURL=createCustomer.graphql.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CREATE_CUSTOMER_V2
|
|
1
|
+
export declare const CREATE_CUSTOMER_V2: string;
|
|
2
2
|
//# sourceMappingURL=createCustomerV2.graphql.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CREATE_CUSTOMER_ADDRESS = "\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input
|
|
1
|
+
export declare const CREATE_CUSTOMER_ADDRESS = "\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n";
|
|
2
2
|
//# sourceMappingURL=createCustomerAddress.graphql.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AttributesFormModel } from '../../data/models';
|
|
2
2
|
|
|
3
|
-
export declare const getAttributesForm: (formCode: string) => Promise<AttributesFormModel>;
|
|
3
|
+
export declare const getAttributesForm: (formCode: string) => Promise<AttributesFormModel[]>;
|
|
4
4
|
//# sourceMappingURL=getAttributesForm.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
|
|
2
2
|
//# sourceMappingURL=getAttributesForm.graphql.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomerModel } from '../../data/models';
|
|
2
2
|
|
|
3
|
-
export declare const getCustomerData: (user_token: string) => Promise<
|
|
3
|
+
export declare const getCustomerData: (user_token: string) => Promise<CustomerModel>;
|
|
4
4
|
//# sourceMappingURL=getCustomerData.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GET_CUSTOMER_DATA
|
|
1
|
+
export declare const GET_CUSTOMER_DATA: string;
|
|
2
2
|
//# sourceMappingURL=getCustomerData.graphql.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InLineAlertInterface } from '../../types';
|
|
2
2
|
|
|
3
3
|
interface getCustomerTokenProps {
|
|
4
4
|
email: string;
|
|
5
5
|
password: string;
|
|
6
|
-
handleSetInLineAlertProps: (value?:
|
|
6
|
+
handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;
|
|
7
7
|
translations: Record<string, string>;
|
|
8
8
|
onErrorCallback?: (value?: unknown) => void;
|
|
9
9
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
1
|
+
import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
import { CustomerModel } from '../../data/models';
|
|
3
4
|
|
|
4
5
|
type ConfigProps = {
|
|
5
6
|
langDefinitions?: Lang;
|
|
@@ -7,6 +8,9 @@ type ConfigProps = {
|
|
|
7
8
|
header: string;
|
|
8
9
|
tokenPrefix: string;
|
|
9
10
|
};
|
|
11
|
+
models?: {
|
|
12
|
+
CustomerModel?: Model<CustomerModel>;
|
|
13
|
+
};
|
|
10
14
|
};
|
|
11
15
|
export declare const initialize: Initializer<ConfigProps>;
|
|
12
16
|
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RESEND_CONFIRMATION_EMAIL = "\
|
|
1
|
+
export declare const RESEND_CONFIRMATION_EMAIL = "\n mutation RESEND_CONFIRMATION_EMAIL($email: String!) {\n resendConfirmationEmail(email: $email)\n }\n";
|
|
2
2
|
//# sourceMappingURL=resendConfirmationEmail.graphql.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RESET_PASSWORD = "\n mutation RESET_PASSWORD($email: String
|
|
1
|
+
export declare const RESET_PASSWORD = "\n mutation RESET_PASSWORD(\n $email: String!\n $resetPasswordToken: String!\n $newPassword: String!\n ) {\n resetPassword(\n email: $email\n resetPasswordToken: $resetPasswordToken\n newPassword: $newPassword\n )\n }\n";
|
|
2
2
|
//# sourceMappingURL=resetPassword.graphql.d.ts.map
|
package/api.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{c as f,a as g,g as n}from"./chunks/createCustomerAddress.js";import{g as x,a as d}from"./chunks/getCustomerToken.js";import{g as l}from"./chunks/getStoreConfig.js";import{r as u}from"./chunks/requestPasswordResetEmail.js";import{r as F}from"./chunks/resetPassword.js";import{r as Q}from"./chunks/revokeCustomerToken.js";import{c as H}from"./chunks/confirmEmail.js";import{r as v}from"./chunks/resendConfirmationEmail.js";import{c as A,i as P}from"./chunks/initialize.js";import{f as q,g as z,r as D,s as R,a as S,b as j}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/fetch-graphql.js";export{A as config,H as confirmEmail,f as createCustomer,g as createCustomerAddress,q as fetchGraphQl,n as getAttributesForm,z as getConfig,x as getCustomerData,d as getCustomerToken,l as getStoreConfig,P as initialize,D as removeFetchGraphQlHeader,u as requestPasswordResetEmail,v as resendConfirmationEmail,F as resetPassword,Q as revokeCustomerToken,R as setEndpoint,S as setFetchGraphQlHeader,j as setFetchGraphQlHeaders};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as h,Fragment as Z,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{useState as R,useCallback as L,useRef as H,useEffect as P}from"@dropins/tools/preact-hooks.js";import*as $ from"@dropins/tools/preact-compat.js";import{memo as W,useCallback as _}from"@dropins/tools/preact-compat.js";import{initReCaptcha as G}from"@dropins/tools/recaptcha.js";import{useText as j}from"@dropins/tools/i18n.js";import{classes as M}from"@dropins/tools/lib.js";import{Field as w,Picker as q,Input as X,InputDate as C,Checkbox as z,TextArea as B,Button as J}from"@dropins/tools/components.js";/* empty css */const Dr=r=>{if(!r)return null;const t=new FormData(r);if(t&&typeof t.entries=="function"){const n=t.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},xr=r=>typeof r=="function",Y=r=>$.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("g",{clipPath:"url(#clip0_841_1324)"},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),$.createElement("defs",null,$.createElement("clipPath",{id:"clip0_841_1324"},$.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),K=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Q=r=>$.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),$.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),g={success:h(K,{}),warning:h(Y,{}),error:h(Q,{})},br=()=>{const[r,t]=R({}),n=L(l=>{if(!l||!l.type){t({});return}const c=g[l.type];t({...l,icon:c})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:n}};var v=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(v||{});const rr=W(({loading:r,values:t,fields:n=[],errors:l,className:c="",onChange:u,onBlur:p,onFocus:A})=>{const s=`${c}__field`,f=_((e,o,a)=>{var T;const E=(T=e.options.find(N=>N.isDefault))==null?void 0:T.value;return h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(q,{name:e.customUpperCode,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:u,defaultValue:E??o??e.defaultValue,value:E??o??e.defaultValue})},e.id)},[c,r,s,p,u]),D=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(X,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,onFocus:A})},e.id),[c,r,s,p,u,A]),x=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:h(C,{type:"text",name:e.customUpperCode,value:o||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u,disabled:r||e.disabled})},e.id),[c,r,s,p,u]),m=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(z,{name:e.customUpperCode,checked:o||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]),b=_((e,o,a)=>h(w,{error:a,className:M([s,`${s}--${e.id}`,[`${s}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:h(B,{type:"text",name:e.customUpperCode,value:o??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:u})},e.id),[c,r,s,p,u]);return n.length?h(Z,{children:n.map(e=>{const o=l==null?void 0:l[e.customUpperCode],a=t==null?void 0:t[e.customUpperCode];switch(e.fieldType){case v.TEXT:return e.options.length?f(e,a,o):D(e,a,o);case v.MULTILINE:return D(e,a,o);case v.SELECT:return f(e,a,o);case v.DATE:return x(e,a,o);case v.BOOLEAN:return m(e,a,o);case v.TEXTAREA:return b(e,a,o);default:return null}})}):null}),er=r=>r.reduce((t,{customUpperCode:n,required:l,defaultValue:c})=>(l&&n&&(t.initialData[n]=c||"",t.errorList[n]=""),t),{initialData:{},errorList:{}}),tr=r=>r.reduce((t,n)=>({...t,[n.name]:n.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),lr=r=>/^[a-zA-Z]+$/.test(r),sr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),cr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),dr=(r,t,n)=>{const l=new Date(r).getTime()/1e3;return!(isNaN(l)||l<0||typeof t<"u"&&l<t||typeof n<"u"&&l>n)},k=r=>{if(!r||r.trim()==="")return"";const t=parseInt(r,10);if(!isNaN(t)){const c=new Date(t*1e3);return isNaN(c.getTime())?"":c.toISOString().split("T")[0]}const n=new Date(r);if(isNaN(n.getTime()))return"";const l=parseInt(r.split("-")[1],10);return l>12||l<1?"":n.toISOString().split("T")[0]},ur=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),ir=(r,t,n)=>{const l=r.length;return l>=t&&l<=n},O=(r,t,n,l)=>{var y,F;const{requiredFieldError:c,lengthTextError:u,numericError:p,alphaNumWithSpacesError:A,alphaNumericError:s,alphaError:f,emailError:D,dateError:x,urlError:m,dateLengthError:b,dateMaxError:e,dateMinError:o}=n,a=t==null?void 0:t.customUpperCode,E={[a]:""};if(l[a]&&delete l[a],t!=null&&t.required&&!r)return{[a]:c};if(!(t!=null&&t.required)&&!r||!((y=t==null?void 0:t.validateRules)!=null&&y.length))return E;const T=tr(t==null?void 0:t.validateRules),N=T.MIN_TEXT_LENGTH??1,I=T.MAX_TEXT_LENGTH??255,d=T.DATE_RANGE_MIN,i=T.DATE_RANGE_MAX;if(!ir(r,+N,+I)&&!(d||i))return{[a]:u.replace("{min}",N).replace("{max}",I)};if(!dr(r,+d,+i)&&(d||i)){if(d&&d)return{[a]:b.replace("{min}",k(d)).replace("{max}",k(i))};if(typeof d>"u"||typeof i>"u")return{[a]:i?e.replace("{max}",k(i)):o.replace("{min}",k(d))}}const V={numeric:{validate:ar,error:p},"alphanum-with-spaces":{validate:nr,error:A},alphanumeric:{validate:or,error:s},alpha:{validate:lr,error:f},email:{validate:sr,error:D},date:{validate:cr,error:x},url:{validate:ur,error:m}}[T.INPUT_VALIDATION];return V&&!V.validate(r)&&!((F=l[a])!=null&&F.length)?{[a]:V.error}:E},pr=({fieldsConfig:r,onSubmit:t})=>{const n=j({requiredFieldError:"Auth.FormText.requiredFieldError",lengthTextError:"Auth.FormText.lengthTextError",numericError:"Auth.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Auth.FormText.alphaNumericError",alphaError:"Auth.FormText.alphaError",emailError:"Auth.FormText.emailError",dateError:"Auth.FormText.dateError",dateLengthError:"Auth.FormText.dateLengthError",dateMaxError:"Auth.FormText.dateMaxError",dateMinError:"Auth.FormText.dateMinError",urlError:"Auth.FormText.urlError"}),l=H(null),c=H(!1),[u,p]=R({}),[A,s]=R({}),f=L(()=>{let e=!0;const o={...A};let a=null;for(const[E,T]of Object.entries(u)){const N=r==null?void 0:r.find(d=>{var i;return(i=d==null?void 0:d.customUpperCode)==null?void 0:i.includes(E)}),I=O(T.toString(),N,n,o);I[E]&&(Object.assign(o,I),e=!1),a||(a=Object.keys(o).find(d=>o[d])??null)}if(s(o),a&&l.current){const E=l.current.elements.namedItem(a);E==null||E.focus()}return e},[A,r,u,n]);P(()=>{if(r!=null&&r.length){const{initialData:e,errorList:o}=er(r);p(a=>({...e,...a})),s(o)}},[JSON.stringify(r)]);const D=L(async()=>{c.current||(await G(0),c.current=!0)},[]),x=L(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a;p(i=>({...i,[o]:N}));const I=r==null?void 0:r.find(i=>{var S;return(S=i==null?void 0:i.customUpperCode)==null?void 0:S.includes(o)});let d={...A};if(I){const i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[r,A,n]),m=L(e=>{const{name:o,value:a,type:E,checked:T}=e==null?void 0:e.target,N=E==="checkbox"?T:a,I=r==null?void 0:r.find(d=>d.customUpperCode===o);if(I){const d={...A},i=O(N.toString(),I,n,d);i&&Object.assign(d,i),s(d)}},[A,r,n]),b=L(e=>{e.preventDefault();const o=f();t==null||t(e,o)},[f,t]);return{formData:u,errors:A,formRef:l,handleChange:x,handleBlur:m,handleSubmit:b,handleFocus:D}},mr=({name:r,loading:t,children:n,className:l="defaultForm",fieldsConfig:c=[],onSubmit:u,...p})=>{const{formData:A,errors:s,formRef:f,handleChange:D,handleBlur:x,handleSubmit:m,handleFocus:b}=pr({onSubmit:u,fieldsConfig:c});return U("form",{className:l,onSubmit:m,name:r,ref:f,onFocus:b,...p,children:[h(rr,{className:l,onFocus:b,fields:c,onChange:D,onBlur:x,errors:s,values:A,loading:t}),n]})},vr=({type:r,buttonText:t,variant:n,className:l="",enableLoader:c=!1,onClick:u,style:p,icon:A,...s})=>{const f=L(x=>{u==null||u(x)},[u]);return U(J,{icon:A,style:p,type:r,variant:n,className:M(["auth-button",l,c?"enableLoader":""]),onClick:f,...s,children:[h("span",{className:"auth-button__text",children:t}),c?h("div",{className:"auth-button__wrapper",children:h("span",{className:"auth-button__loader"})}):null]})};export{vr as B,mr as F,xr as c,Dr as g,br as u};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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";/* empty css */import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as h}from"./requestPasswordResetEmail.js";import{g as F,c as w,u as P,F as _,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 v,InLineAlert as N}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 c=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 h(i.email);f.success?s==null||s({type:"success",text:c.successPasswordResetEmailNotification.replace("{email}",i.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,c.successPasswordResetEmailNotification]),n=g(()=>{if(w(m)){m("signInForm");return}w(t)&&(window.location.href=t())},[m,t]);return{isLoading:r,submitResetPassword:d,redirectToSignInPage:n}},$=({formSize:t="default",routeSignIn:a,setActiveComponent:m,onErrorCallback:s,...c})=>{const r=R({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=P(),{isLoading:n,submitResetPassword:u,redirectToSignInPage:i}=D({routeSignIn:a,setActiveComponent:m,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...c,className:b(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[o(v,{title:r.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(N,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(_,{"aria-labelledby":r.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:u,loading:n,fieldsConfig:E(L),children:l("div",{className:"auth-reset-password-form__buttons",children:[o(p,{type:"button",variant:"tertiary",style:{padding:"0"},icon:o(T,{style:{transform:"rotate(90deg)"}}),buttonText:r.buttonSecondary,enableLoader:!1,onClick:i}),o(p,{type:"submit",buttonText:r.buttonPrimary,variant:"primary",enableLoader:n})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{$ as R};
|
package/chunks/SignInForm.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as c,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as z,classes as R}from"@dropins/tools/lib.js";import{c as E,g as tt,u as rt,F as at,B as K}from"./Button2.js";import{useState as y,useCallback as m,useEffect as J,useMemo as et}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as ot}from"./getCustomerToken.js";import{r as it}from"./resendConfirmationEmail.js";import{s as st,a as nt}from"./simplifyTransformAttributesForm.js";import{f as ut,E as ct}from"./focusOnEmptyPasswordField.js";import{c as mt}from"./confirmEmail.js";import{useText as O}from"@dropins/tools/i18n.js";import{Header as ft,InLineAlert as dt,InputPassword as lt}from"@dropins/tools/components.js";/* empty css */const ht=({emailConfirmationStatusMessage:t,translations:e,initialEmailValue:s,routeSignUp:l,routeForgotPassword:u,routeRedirectOnSignIn:F,onErrorCallback:_,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:i,routeRedirectOnEmailConfirmationClose:x})=>{const[S,L]=y(""),[v,n]=y(!1),[g,d]=y(""),[A,w]=y(!1),[U,j]=y({userName:"",status:!1}),[q,T]=y(!1),[P,N]=y([]),k=m(async r=>{i(),n(!0),w(!1),N([]),await it(r)},[i]),V=m(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=m(()=>{g.length||w(!0)},[g]),p=m((r,o)=>g.length?!1:(w(!0),o&&ut(r,g,""),!0),[g]),B=m((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=m((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."),b=H?e.resendEmailInformationText:r.errorMessage;N(H?[{label:e.resendEmailButtonText,onClick:()=>{k(o)}}]:[]),i({text:b,type:"error"}),d("")}},[k,i,e.resendEmailButtonText,e.resendEmailInformationText]),G=m(async(r,o)=>{if(i(),p(r,o))return;T(!0);const I=tt(r.target);if(Object.values(I).every(b=>b)){const{email:b,password:Z}=I,$=await ot({email:b,password:Z,handleSetInLineAlertProps:i,onErrorCallback:_,translations:e});C($,b),B(r,$),w(!1)}T(!1)},[e,_,p,C,B,i]),Q=m(()=>{if(E(a)){a("resetPasswordForm");return}E(u)&&(window.location.href=u())},[u,a]),W=m(()=>{if(E(h)&&h(),E(a)){a("signUpForm");return}E(l)&&(window.location.href=l())},[h,l,a]),X=et(()=>{const r=st(nt);return s!=null&&s.length?r==null?void 0:r.map(o=>({...o,defaultValue:s})):r},[s]),Y=m(()=>{i(),E(x)?window.location.href=x():n(!1)},[i,x]);return{additionalActionsAlert:P,userEmail:S,defaultEnhancedEmailFields:X,passwordError:A,isSuccessful:U,isLoading:q,signInPasswordValue:g,showEmailConfirmationForm:v,setShowEmailConfirmationForm:n,setSignInPasswordValue:d,submitLogInUser:G,forgotPasswordCallback:Q,onSignUpLinkClickCallback:W,handledOnPrimaryButtonClick:Y,handleSetPassword:V,onBlurPassword:D}},gt=()=>{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()))},wt=({enableEmailConfirmation:t})=>{const e=O({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 mt({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"}),gt())})()}},[t,e]),{emailConfirmationStatusMessage:s}},Ct=({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:x,setActiveComponent:S,onErrorCallback:L,onSignUpLinkClick:v})=>{const n=O({title:"Auth.SignInForm.title",buttonPrimary:"Auth.SignInForm.buttonPrimary",buttonSecondary:"Auth.SignInForm.buttonSecondary",buttonTertiary:"Auth.SignInForm.buttonTertiary",resendEmailInformationText:"Auth.Notification.resendEmailNotification.informationText",resendEmailButtonText:"Auth.Notification.resendEmailNotification.buttonText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError"}),{emailConfirmationStatusMessage:g}=wt({enableEmailConfirmation:F}),{inLineAlertProps:d,handleSetInLineAlertProps:A}=rt(),{userEmail:w,additionalActionsAlert:U,defaultEnhancedEmailFields:j,passwordError:q,isSuccessful:T,isLoading:P,signInPasswordValue:N,showEmailConfirmationForm:k,submitLogInUser:V,forgotPasswordCallback:D,onSignUpLinkClickCallback:p,handledOnPrimaryButtonClick:B,handleSetPassword:C,onBlurPassword:G}=ht({translations:n,emailConfirmationStatusMessage:g,initialEmailValue:l,routeSignUp:i,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:S,onErrorCallback:L,onSuccessCallback:x,onSignUpLinkClick:v,handleSetInLineAlertProps:A,routeRedirectOnEmailConfirmationClose:a});return T.status&&(t!=null&&t.SuccessNotification)?c(z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:T}}):k?c(ct,{formSize:s,userEmail:w,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:_,handleSetInLineAlertProps:A,onPrimaryButtonClick:B}):M("div",{className:R(["auth-sign-in-form",`auth-sign-in-form--${s}`]),"data-testid":"signInForm",children:[c(ft,{title:(e==null?void 0:e.formTitleText)??n.title,divider:!1,className:"auth-sign-in-form__title"}),d.text?c(dt,{"data-testid":"authInLineAlert",className:"auth-sign-in-form__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:U}):null,M(at,{name:"signIn_form",className:"auth-sign-in-form__form",onSubmit:V,loading:P,fieldsConfig:j,children:[c(lt,{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:[c(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?c("span",{}):null,u?c(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]}),c(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})]})]}),c("div",{id:"generateCustomerToken"})]})};export{Ct as S};
|
package/chunks/SignUpForm.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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=["date_of_birth","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,{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};
|
package/chunks/SkeletonLoader.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{jsxs as l,jsx as e,Fragment as r}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as s}from"@dropins/tools/preact-hooks.js";import{Skeleton as a,SkeletonRow as i}from"@dropins/tools/components.js";const d=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),h=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),u=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),o=({activeSkeleton:n})=>{const t=s(()=>({signInForm:e(h,{}),signUpForm:e(d,{}),resetPasswordForm:e(u,{})}),[]);return e(r,{children:t[n]})};export{o as S};
|
package/chunks/confirmEmail.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{f as o,h as r}from"./network-error.js";const t=`
|
|
2
4
|
mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) {
|
|
3
|
-
confirmEmail(
|
|
4
|
-
email: $email,
|
|
5
|
-
|
|
6
|
-
}) {
|
|
5
|
+
confirmEmail(
|
|
6
|
+
input: { email: $email, confirmation_key: $confirmation_key }
|
|
7
|
+
) {
|
|
7
8
|
customer {
|
|
8
9
|
email
|
|
9
10
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{CUSTOMER_INFORMATION_FRAGMENT as N}from"../fragments.js";import{f as m,h as u}from"./network-error.js";import{s as I}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as U}from"@dropins/tools/lib.js";import{c as g}from"./initialize.js";import{t as $}from"./transform-attributes-form.js";import{h as F}from"./getStoreConfig.js";const v=`
|
|
2
4
|
mutation CREATE_CUSTOMER($input: CustomerInput!) {
|
|
3
5
|
createCustomer(input: $input) {
|
|
4
6
|
customer {
|
|
5
|
-
|
|
6
|
-
lastname
|
|
7
|
-
email
|
|
8
|
-
is_subscribed
|
|
7
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
${N}
|
|
12
|
+
`,y=`
|
|
13
13
|
mutation CREATE_CUSTOMER_V2($input: CustomerCreateInput!) {
|
|
14
14
|
createCustomerV2(input: $input) {
|
|
15
15
|
customer {
|
|
16
|
-
|
|
17
|
-
lastname
|
|
18
|
-
email
|
|
19
|
-
is_subscribed
|
|
16
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
${N}
|
|
21
|
+
`,G=(r,e)=>{var i,a,c,n,C,l,f,E,T,_,R,A,h,S,b,M,O,d,s,p;let o;if(e){const{data:t}=r;o={firstName:((a=(i=t==null?void 0:t.createCustomerV2)==null?void 0:i.customer)==null?void 0:a.firstname)??"",lastName:((n=(c=t==null?void 0:t.createCustomerV2)==null?void 0:c.customer)==null?void 0:n.lastname)??"",email:((l=(C=t==null?void 0:t.createCustomerV2)==null?void 0:C.customer)==null?void 0:l.email)??"",isSubscribed:((E=(f=t==null?void 0:t.createCustomerV2)==null?void 0:f.customer)==null?void 0:E.is_subscribed)??!1,customAttributes:((T=t==null?void 0:t.createCustomerV2)==null?void 0:T.custom_attributes)??[],errors:(r==null?void 0:r.errors)??[]}}else{const{data:t}=r;o={firstName:((R=(_=t==null?void 0:t.createCustomer)==null?void 0:_.customer)==null?void 0:R.firstname)??"",lastName:((h=(A=t==null?void 0:t.createCustomer)==null?void 0:A.customer)==null?void 0:h.lastname)??"",email:((b=(S=t==null?void 0:t.createCustomer)==null?void 0:S.customer)==null?void 0:b.email)??"",isSubscribed:((O=(M=t==null?void 0:t.createCustomer)==null?void 0:M.customer)==null?void 0:O.is_subscribed)??!1,errors:(r==null?void 0:r.errors)??[]}}return U(o,(p=(s=(d=g.getConfig().models)==null?void 0:d.CustomerModel)==null?void 0:s.transformer)==null?void 0:p.call(s,r))},H=async(r,e)=>{await I();const o=await m(e?y:v,{method:"POST",variables:{input:{...r}}}).catch(u);return G(o,e)},V=`
|
|
24
22
|
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
25
23
|
attributesForm(formCode: $formCode) {
|
|
26
24
|
items {
|
|
@@ -37,6 +35,14 @@ import{f as s,h as a}from"./network-error.js";import{s as n}from"./setReCaptchaT
|
|
|
37
35
|
label
|
|
38
36
|
value
|
|
39
37
|
}
|
|
38
|
+
... on CustomerAttributeMetadata {
|
|
39
|
+
multiline_count
|
|
40
|
+
sort_order
|
|
41
|
+
validate_rules {
|
|
42
|
+
name
|
|
43
|
+
value
|
|
44
|
+
}
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
errors {
|
|
42
48
|
type
|
|
@@ -44,10 +50,10 @@ import{f as s,h as a}from"./network-error.js";import{s as n}from"./setReCaptchaT
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
|
-
`,
|
|
53
|
+
`,J=async r=>await m(V,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(e=>{var o;return(o=e.errors)!=null&&o.length?F(e.errors):$(e)}).catch(u),w=`
|
|
48
54
|
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
49
|
-
createCustomerAddress(input
|
|
55
|
+
createCustomerAddress(input: $input) {
|
|
50
56
|
firstname
|
|
51
|
-
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
|
-
`,
|
|
59
|
+
`,K=async r=>await m(w,{method:"POST",variables:{input:r}}).then(e=>{var o;return(o=e.errors)!=null&&o.length?F(e.errors):e.data.createCustomerAddress.firstname||""}).catch(u);export{K as a,H as c,J as g};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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";/* empty css */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,15 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{a as U,f as w,h as k}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as x}from"@dropins/tools/event-bus.js";import{merge as y}from"@dropins/tools/lib.js";import{c as C}from"./initialize.js";import{CUSTOMER_INFORMATION_FRAGMENT as F}from"../fragments.js";import{p as E,E as O,a as S,C as R}from"./getStoreConfig.js";import{s as v}from"./setReCaptchaToken.js";const D=t=>{var f,e,i,a,r,o,u,T,s,g,N,c,_;const m={email:((e=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:e.email)??"",firstName:((a=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:a.firstname)??"",lastName:((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.lastname)??"",isSubscribed:((T=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:T.is_subscribed)??!1};return y(m,(_=(c=(N=(g=(s=C)==null?void 0:s.getConfig())==null?void 0:g.models)==null?void 0:N.CustomerModel)==null?void 0:c.transformer)==null?void 0:_.call(c,t.data))},K=`
|
|
2
4
|
query GET_CUSTOMER_DATA {
|
|
3
5
|
customer {
|
|
4
|
-
|
|
5
|
-
lastname
|
|
6
|
-
email
|
|
6
|
+
...CUSTOMER_INFORMATION_FRAGMENT
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
${F}
|
|
10
|
+
`,H=async t=>{if(t){const{authHeaderConfig:m}=C.getConfig();U(m.header,m.tokenPrefix?`${m.tokenPrefix} ${t}`:t)}return await w(K,{method:"GET",cache:"force-cache"}).then(m=>D(m)).catch(k)},I=`
|
|
10
11
|
mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
|
|
11
12
|
generateCustomerToken(email: $email, password: $password) {
|
|
12
13
|
token
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
`,
|
|
16
|
+
`,W=async({email:t,password:m,translations:f,onErrorCallback:e,handleSetInLineAlertProps:i})=>{var g,N,c,_,h,$,G;await v();const a=await w(I,{method:"POST",variables:{email:t,password:m}}).catch(k);if(!((N=(g=a==null?void 0:a.data)==null?void 0:g.generateCustomerToken)!=null&&N.token)){const d=f.customerTokenErrorMessage,M=a!=null&&a.errors?a.errors[0].message:d;return e==null||e(M),i==null||i({type:"error",text:M}),E((c=O)==null?void 0:c.SIGN_IN,{}),{errorMessage:M,userName:""}}const r=(h=(_=a==null?void 0:a.data)==null?void 0:_.generateCustomerToken)==null?void 0:h.token,o=await H(r),u=o==null?void 0:o.firstName,T=o==null?void 0:o.email;if(!u||!T){const d=f.customerTokenErrorMessage;return e==null||e(d),i==null||i({type:"error",text:d}),E(($=O)==null?void 0:$.SIGN_IN,{}),{errorMessage:d,userName:""}}const s=await S();return document.cookie=`${R.auth_dropin_firstname}=${u}; path=/; ${s}; `,document.cookie=`${R.auth_dropin_user_token}=${r}; path=/; ${s}; `,x.emit("authenticated",!!r),E((G=O)==null?void 0:G.SIGN_IN,{email:T}),{errorMessage:"",userName:u}};export{W as a,H as g};
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h as E}from"./network-error.js";const T=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),S=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),N=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{updateProfile:e==null?void 0:e.updateProfile},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),D={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},c=3600,I=e=>{var t,o,r,a,m,_,f,g,d,C;return{autocompleteOnStorefront:((o=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:o.autocomplete_on_storefront)||!1,minLength:((a=(r=e==null?void 0:e.data)==null?void 0:r.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((_=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:_.required_character_classes_number)||0,createAccountConfirmation:((g=(f=e==null?void 0:e.data)==null?void 0:f.storeConfig)==null?void 0:g.create_account_confirmation)||!1,customerAccessTokenLifetime:((C=(d=e==null?void 0:e.data)==null?void 0:d.storeConfig)==null?void 0:C.customer_access_token_lifetime)*c||c}},O=e=>{const t=e.map(o=>o.message).join(" ");throw Error(t)},U=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},R=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const r=await b();sessionStorage.setItem("storeConfig",JSON.stringify(r)),o=(r==null?void 0:r.customerAccessTokenLifetime)||c}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${c}`}};var A=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(A||{});const s="authContext",h="shopperContext",i={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function n(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function u(e){(window.adobeDataLayer||[]).push(o=>{const r=o.getState?o.getState():{};o.push({event:e,eventInfo:{...r}})})}function k(e){const t=N(e);n(s,t),u(i.CREATE_ACCOUNT)}function p(e){const t=T(e);n(s,t),n(h,{shopperId:"logged-in"}),u(i.SIGN_IN)}function w(e){const t=S(e);n(s,t),n(h,{shopperId:"guest"}),u(i.SIGN_OUT)}const M=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),a={...o?JSON.parse(o):{},...t};switch(e){case"create-account":k(a);break;case"sign-in":p(a);break;case"sign-out":w(a);break;default:return null}},G=`
|
|
2
4
|
query GET_STORE_CONFIG {
|
|
3
5
|
storeConfig {
|
|
4
6
|
autocomplete_on_storefront
|
|
@@ -12,4 +14,4 @@ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f
|
|
|
12
14
|
customer_access_token_lifetime
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
|
-
`,b=async()=>await l(G,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?
|
|
17
|
+
`,b=async()=>await l(G,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?O(e.errors):I(e)}).catch(E);export{D as C,A as E,R as a,U as d,b as g,O as h,M as p};
|
package/chunks/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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";/* empty css */import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{b as ResetPasswordForm,c as default};
|
package/chunks/index2.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";/* empty css */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 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
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";/* empty css */import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default};
|
package/chunks/initialize.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{Initializer as o}from"@dropins/tools/lib.js";const i=new o({init:async n=>{const e={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};i.config.setConfig({...e,...n})},listeners:()=>[]}),a=i.config;export{a as c,i};
|
package/chunks/network-error.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{f as E,h as l}from"./network-error.js";import{s as e}from"./setReCaptchaToken.js";const R=a=>{var r,m,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(m=a==null?void 0:a.errors[0])==null?void 0:m.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},c=`
|
|
2
4
|
mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) {
|
|
3
5
|
requestPasswordResetEmail(email: $email)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{f as r,h as e}from"./network-error.js";const i=`
|
|
2
|
-
mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
|
|
3
|
-
|
|
4
|
-
}
|
|
4
|
+
mutation RESEND_CONFIRMATION_EMAIL($email: String!) {
|
|
5
|
+
resendConfirmationEmail(email: $email)
|
|
6
|
+
}
|
|
7
|
+
`,n=async a=>await r(i,{method:"POST",variables:{email:a}}).catch(e);export{n as r};
|
package/chunks/resetPassword.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=`
|
|
2
|
-
mutation RESET_PASSWORD(
|
|
3
|
-
|
|
4
|
+
mutation RESET_PASSWORD(
|
|
5
|
+
$email: String!
|
|
6
|
+
$resetPasswordToken: String!
|
|
7
|
+
$newPassword: String!
|
|
8
|
+
) {
|
|
9
|
+
resetPassword(
|
|
10
|
+
email: $email
|
|
11
|
+
resetPasswordToken: $resetPasswordToken
|
|
12
|
+
newPassword: $newPassword
|
|
13
|
+
)
|
|
4
14
|
}
|
|
5
15
|
`,P=a=>{var r,s,e;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(s=a==null?void 0:a.errors[0])==null?void 0:s.message),{message:t,success:!!((e=a==null?void 0:a.data)!=null&&e.resetPassword)}},S=async(a,t,r)=>(await d(),await o(i,{method:"POST",variables:{email:a,resetPasswordToken:t,newPassword:r}}).then(s=>P(s)).catch(w));export{S as r};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{f as u,h as n}from"./network-error.js";import{C as m,d as s,p as c,E}from"./getStoreConfig.js";import{events as i}from"@dropins/tools/event-bus.js";const k=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},h=`
|
|
2
4
|
mutation REVOKE_CUSTOMER_TOKEN {
|
|
3
5
|
revokeCustomerToken {
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{verifyReCaptcha as t}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{a as e}from"./network-error.js";const s=async()=>{const a=await t();a&&e("X-ReCaptcha",a)};export{s};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{t}from"./transform-attributes-form.js";const s=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-sign-in-form__form__email",frontend_input:"TEXT",is_required:!0,multiline_count:1,sort_order:1,is_unique:!1,label:"Email",options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}]}],o=[{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"}]}],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"}]},{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{o as D,s as a,n as b,i as s};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
const _=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),m=(t,n,e)=>{const s=["string","boolean","number"],a=n==="camelCase"?_:p;return Array.isArray(t)?t.map(o=>s.includes(typeof o)||o===null?o:typeof o=="object"?m(o,n,e):o):t!==null&&typeof t=="object"?Object.entries(t).reduce((o,[i,c])=>{const r=e&&e[i]?e[i]:a(i);return o[r]=s.includes(typeof c)||c===null?c:m(c,n,e),o},{}):t},b=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let s=2;s<=e.multiline_count;s++){const a={...e,is_required:!1,name:`${e.code}_multiline_${s}`,code:`${e.code}_multiline_${s}`,id:`${e.code}_multiline_${s}`};n.push(a)}return n},C=t=>{var o,i,c;const n=((i=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:i.items)||[];if(!n.length)return[];const e=(c=n.filter(r=>{var u;return!((u=r.frontend_input)!=null&&u.includes("HIDDEN"))}))==null?void 0:c.map(({code:r,...u})=>{const l=r!=="country_id"?r:"country_code";return{...u,name:l,id:l,code:l}}),s=b(e);return e.concat(s).map(r=>{var d;const u=r.code==="firstname"?"firstName":r.code==="lastname"?"lastName":_(r.code),l=(d=r.options)==null?void 0:d.map(f=>({isDefault:f.is_default,text:f.label,value:f.value}));return m({...r,options:l,customUpperCode:u},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,u)=>r.orderNumber-u.orderNumber)};export{m as c,C as t};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./getStoreConfig.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length<e.minLength?n?{...s,icon:"error",status:"error"}:{...s,icon:"pending",status:"pending"}:s},[e,i.messageLengthPassword,t==null?void 0:t.length,n]);return{isValidUniqueSymbols:a,defaultLengthMessage:o}};export{M as a,A as u,L as v};
|