@dropins/storefront-account 1.0.9 → 1.2.0

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.
Files changed (32) hide show
  1. package/api/getCustomerAddress/graphql/getCustomerAddress.graphql.d.ts +1 -1
  2. package/chunks/AddressValidation.js +4 -0
  3. package/chunks/AddressValidation.js.map +1 -0
  4. package/chunks/getOrderHistoryList.js +4 -4
  5. package/chunks/getOrderHistoryList.js.map +1 -1
  6. package/chunks/removeCustomerAddress.js +3 -2
  7. package/chunks/removeCustomerAddress.js.map +1 -1
  8. package/components/AddressValidation/AddressValidation.d.ts +14 -0
  9. package/components/AddressValidation/index.d.ts +19 -0
  10. package/components/index.d.ts +1 -0
  11. package/containers/AddressForm.js +1 -1
  12. package/containers/AddressValidation/AddressValidation.d.ts +14 -0
  13. package/containers/AddressValidation/index.d.ts +19 -0
  14. package/containers/AddressValidation.d.ts +3 -0
  15. package/containers/AddressValidation.js +4 -0
  16. package/containers/AddressValidation.js.map +1 -0
  17. package/containers/Addresses.js +1 -1
  18. package/containers/Addresses.js.map +1 -1
  19. package/containers/CustomerInformation.js +1 -1
  20. package/containers/CustomerInformation.js.map +1 -1
  21. package/containers/OrdersList.js +1 -1
  22. package/containers/OrdersList.js.map +1 -1
  23. package/data/models/customer-address.d.ts +1 -0
  24. package/i18n/en_US.json.d.ts +6 -0
  25. package/package.json +1 -1
  26. package/render.js +2 -2
  27. package/render.js.map +1 -1
  28. package/types/addressForm.types.d.ts +1 -1
  29. package/types/addresses.types.d.ts +1 -1
  30. package/types/api/getCustomerAddress.type.d.ts +1 -0
  31. package/chunks/CustomerInformationCard.js +0 -4
  32. package/chunks/CustomerInformationCard.js.map +0 -1
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as L,jsx as d,Fragment as he}from"@dropins/tools/preact-jsx-runtime.js";import{classes as ne,Slot as ge}from"@dropins/tools/lib.js";import{F as we,d as Ce,g as Pe,n as ee,C as pe}from"../chunks/CustomerInformationCard.js";import*as V from"@dropins/tools/preact-compat.js";import{Card as X,Header as Q,InLineAlert as oe,InputPassword as R,Button as H}from"@dropins/tools/components.js";import{useState as m,useEffect as B,useCallback as C,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as Ee}from"../chunks/getStoreConfig.js";import{u as be,g as Ve,b as re,a as ye}from"../chunks/updateCustomer.js";import{useText as O}from"@dropins/tools/i18n.js";import{d as Ie}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const _e=e=>V.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},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.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"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ve=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.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"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Le=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.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"}),V.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"})),Fe=e=>({firstName:e.firstName,lastName:e.lastName,emailAddress:(e==null?void 0:e.email)||"",accountId:(e==null?void 0:e.email)||""}),Ne=()=>{const[e,r]=m(null);return B(()=>{const n=sessionStorage.getItem("accountStoreConfig"),t=n?JSON.parse(n):null;if(t){const{minLength:o,requiredCharacterClasses:s}=t;r({minLength:o,requiredCharacterClasses:s})}else Ee().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:P}=o;sessionStorage.setItem("accountStoreConfig",JSON.stringify(o)),r({minLength:s,requiredCharacterClasses:P})}})},[]),{passwordConfigs:e}},Ae=({currentPassword:e,newPassword:r,confirmPassword:n,translations:t})=>{let o={...K};const s=!e.length&&!r.length&&!n.length,P=e.length&&r!==n;return s?(o={...o,currentPassword:t.requiredFieldError,newPassword:t.requiredFieldError,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):e.length?r.length?n.length?P?(o={...o,currentPassword:"",newPassword:"",confirmPassword:t.passwordMismatch},{isValid:!1,errors:o}):{isValid:!0,errors:o}:(o={...o,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,newPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,currentPassword:t.requiredFieldError},{isValid:!1,errors:o})},ae=(e,r)=>{if(r<=1)return!0;const n=/[0-9]/.test(e)?1:0,t=/[a-z]/.test(e)?1:0,o=/[A-Z]/.test(e)?1:0,s=/[^a-zA-Z0-9\s]/.test(e)?1:0;return n+t+o+s>=r},K={currentPassword:"",newPassword:"",confirmPassword:""},Se=({passwordConfigs:e,handleSetInLineAlert:r,handleHideChangePassword:n})=>{const t=O({requiredFieldError:"Account.FormText.requiredFieldError",passwordMismatch:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch",incorrectCurrentPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword",passwordUpdateMessage:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage"}),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(""),[h,l]=m(""),[F,y]=m(""),[I,E]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{n(()=>{r({}),E(K)})},[n,r]),A=C(f=>{p(f),E(b=>({...b,currentPassword:f?"":t.requiredFieldError}))},[t]),w=C(f=>{l(f),E(b=>({...b,newPassword:f?"":t.requiredFieldError}))},[t]),Z=C(f=>{y(f),E(b=>({...b,confirmPassword:f?"":t.requiredFieldError}))},[t]),N=C(f=>{const{name:b,value:z}=f==null?void 0:f.target;E(_=>({..._,[b]:z?"":t.requiredFieldError}))},[t]),U=C(()=>{const{isValid:f,errors:b}=Ae({currentPassword:c,newPassword:h,confirmPassword:F,translations:t});return E(b),f},[c,h,F,t]),$=C(f=>{f.preventDefault(),u(!0);const b=(e==null?void 0:e.requiredCharacterClasses)??0,z=(e==null?void 0:e.minLength)??1;if(!U()){s(!0),u(!1);return}if(!ae(h,b)||z>(h==null?void 0:h.length)){s(!0),u(!1);return}be({currentPassword:c,newPassword:h}).then(_=>{if(!(_!=null&&_.length)){u(!1);return}p(""),l(""),y(""),E(K),s(!1),r({type:"success",text:t.passwordUpdateMessage})}).catch(_=>{_.message==="Invalid login or password."&&r({type:"error",text:t.incorrectCurrentPassword}),_.message==="The account is locked."&&r({type:"error",text:_.message})}),u(!1)},[e,U,h,c,r,t]);return{hideChangePassword:i,handleOnBlurPassword:N,handleConfirmPasswordChange:Z,handleNewPasswordChange:w,handleCurrentPasswordChange:A,mutationChangePassword:$,currentPassword:c,newPassword:h,confirmPassword:F,passwordErrors:I,submitLoading:P,isClickSubmit:o}},Te=({passwordConfigs:e,isClickSubmit:r,password:n})=>{const t=O({messageLengthPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword"}),[o,s]=m("pending");B(()=>{if(!e)return;const u=ae(n,e.requiredCharacterClasses);r&&n.length>0?s(u?"success":"error"):r&&n.length===0?s("pending"):s(u?"success":"pending")},[r,e,n]);const P=G(()=>{var c;if(!e)return;const u={status:"pending",icon:"pending",message:(c=t.messageLengthPassword)==null?void 0:c.replace("{minLength}",`${e.minLength}`)};return n.length&&n.length>=e.minLength?{...u,icon:"success",status:"success"}:n.length&&n.length<e.minLength?r?{...u,icon:"error",status:"error"}:{...u,icon:"pending",status:"pending"}:u},[e,t.messageLengthPassword,n==null?void 0:n.length,r]);return{isValidUniqueSymbols:o,defaultLengthMessage:P}},Me=(e,r,n,t,o)=>e==="error"||(r==null?void 0:r.status)==="error"||n&&t.trim().length===0?o.newPassword:void 0,qe=({handleHideChangePassword:e,handleSetInLineAlert:r,inLineAlertProps:n})=>{const{passwordConfigs:t}=Ne(),{hideChangePassword:o,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:u,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:l,confirmPassword:F,passwordErrors:y,submitLoading:I,isClickSubmit:E}=Se({passwordConfigs:t,handleSetInLineAlert:r,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:A}=Te({password:l,isClickSubmit:E,passwordConfigs:t}),w=O({containerTitle:"Account.minifiedView.CustomerInformation.changePassword.containerTitle",currentPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder",currentPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel",newPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder",newPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel",confirmPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel",buttonSecondary:"Account.minifiedView.CustomerInformation.changePassword.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.changePassword.buttonPrimary"});return L(X,{className:"account-change-password",variant:"secondary",children:[d(Q,{title:w.containerTitle,divider:!1,className:"account-change-password__title"}),n.text?d(oe,{className:"account-change-password__notification",type:n.type,variant:"secondary",heading:n.text,icon:n.icon,"data-testid":"changePasswordInLineAlert"}):null,L("div",{className:"account-change-password__fields",children:[d(R,{className:"account-change-password__fields-item",autoComplete:"currentPassword",name:"currentPassword",placeholder:w.currentPasswordPlaceholder,floatingLabel:w.currentPasswordFloatingLabel,errorMessage:y.currentPassword,defaultValue:h,onValue:c,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"newPassword",name:"newPassword",placeholder:w.newPasswordPlaceholder,floatingLabel:w.newPasswordFloatingLabel,minLength:t==null?void 0:t.minLength,validateLengthConfig:A,uniqueSymbolsStatus:i,requiredCharacterClasses:t==null?void 0:t.requiredCharacterClasses,errorMessage:Me(i,A,E,l,y),defaultValue:l,onValue:u,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"confirmPassword",name:"confirmPassword",placeholder:w.confirmPasswordPlaceholder,floatingLabel:w.confirmPasswordFloatingLabel,errorMessage:y.confirmPassword,defaultValue:F,onValue:P,onBlur:s})]}),L("div",{className:"account-change-password__actions",children:[d(H,{type:"button",disabled:I,onClick:o,variant:"secondary",children:w.buttonSecondary}),d(H,{variant:"primary",type:"button",disabled:I,onClick:p,children:w.buttonPrimary})]})]})},ke=({inLineAlertProps:e,errorPasswordEmpty:r,passwordValue:n,showPasswordOnEmailChange:t,submitLoading:o,formFieldsList:s,handleHideEditForm:P,handleUpdateCustomerInformation:u,handleInputChange:c,handleSetPassword:p,handleOnBlurPassword:h})=>{const l=O({buttonSecondary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary",placeholder:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder",floatingLabel:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel",containerTitle:"Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle",requiredFieldError:"Account.FormText.requiredFieldError"});return L(X,{variant:"secondary",className:"account-edit-customer-information",children:[d(Q,{title:l.containerTitle,divider:!1,className:"account-edit-customer-information__title"}),e.text?d(oe,{className:"account-edit-customer-information__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon,"data-testid":"editCustomerInLineAlert"}):null,L(we,{loading:o,fieldsConfig:s||[],name:"editCustomerInformation",className:"account-edit-customer-information-form",onSubmit:u,setInputChange:c,children:[t?d("div",{className:"account-edit-customer-information__password",children:d(R,{autoComplete:"password",name:"password",placeholder:l.placeholder,floatingLabel:l.floatingLabel,errorMessage:r?l.requiredFieldError:void 0,defaultValue:n,onValue:p,onBlur:h})}):null,L("div",{className:"account-edit-customer-information__actions",children:[d(H,{disabled:o,type:"button",variant:"secondary",onClick:()=>P(),children:l.buttonSecondary}),d(H,{disabled:o,type:"submit",variant:"primary",children:l.buttonPrimary})]})]})]})},xe=({createdAt:e,slots:r,orderedCustomerData:n,showEditForm:t,showChangePassword:o,handleShowChangePassword:s,handleShowEditForm:P})=>{const u=O({buttonSecondary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary",accountCreation:"Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation"});return d(X,{variant:"secondary",className:ne(["account-customer-information-card",["account-customer-information-card-short",o||t]]),children:L("div",{className:"account-customer-information-card__wrapper",children:[L("div",{className:"account-customer-information-card__actions",children:[d(H,{type:"button",variant:"tertiary",onClick:s,children:u.buttonSecondary}),d(H,{type:"button",variant:"tertiary",onClick:P,children:u.buttonPrimary})]}),d("div",{className:"account-customer-information-card__content",children:r!=null&&r.CustomerData?d(ge,{name:"CustomerData",slot:r==null?void 0:r.CustomerData,context:{customerData:n}}):L(he,{children:[n==null?void 0:n.map((c,p)=>{const h=c!=null&&c.label?`${c.label}: ${c==null?void 0:c.value}`:c==null?void 0:c.value;return d("p",{"data-testid":`${c.name}_${p}`,children:h},`${c.name}_${p}`)}),L("p",{children:[u.accountCreation,": ",e]})]})})]})})},Oe=e=>{if(!(e!=null&&e.dateOfBirth))return e;const{dateOfBirth:r,...n}=e;return{...n,dob:r}},Ue="accountContext";var x=(e=>(e.EDIT_ACCOUNT_EVENT="edit-account",e))(x||{});const Be={EDIT_ACCOUNT_EVENT:"edit-account"};function se(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function He(e,r){const n=se();n.push({[e]:null}),n.push({[e]:r})}function Ze(e,r){se().push(t=>{const o=t.getState?t.getState():{};t.push({event:e,eventInfo:{...o,...r}})})}function $e(e){const r=Fe(e);He(Ue,r),Ze(Be.EDIT_ACCOUNT_EVENT)}const te=(e,r)=>{const n=sessionStorage.getItem("accountStoreConfig"),o={...n?JSON.parse(n):{},...r};switch(e){case"edit-account":$e(o);break;default:return null}},ze=({handleSetInLineAlert:e})=>{const r=O({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[n,t]=m(!0),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(!1),[h,l]=m(!1),[F,y]=m(!1),[I,E]=m([]),[i,A]=m(null),[w,Z]=m([]),[N,U]=m({}),[$,f]=m(""),[b,z]=m(""),_=C(a=>{const{value:g}=a==null?void 0:a.target;g.length&&l(!1),g.length||l(!0)},[]),S=C(a=>{f(a)},[]),ie=C(a=>{U(a)},[]),ce=C(()=>{u(!0),p(!1),e(),S("")},[e,S]),de=C(a=>{a==null||a(),u(!1)},[]),ue=C(()=>{p(!0),u(!1),e(),S("")},[e,S]),le=C(a=>{a==null||a(),p(!1)},[]),T=C((a,g)=>{a==="success"?e({type:"success",text:g??r.accountSuccess}):a==="error"?e({type:"error",text:g??r.accountError}):e(),s(!1)},[e,r]),j=C(()=>{Ve().then(a=>{var v;const g=(v=a==null?void 0:a.createdAt)==null?void 0:v.split(" ")[0],M=Oe({...a,gender:a.gender===1?r.genderMale:r.genderFemale});A(M),z(g)})},[r.genderFemale,r.genderMale]);B(()=>{j()},[]),B(()=>{Ie("customer_account_edit").then(a=>{Z(a);const g=a.map(({name:M,customUpperCode:v,orderNumber:q,label:D})=>({name:v,orderNumber:q,label:Ce.includes(M)?null:D}));E(g)})},[]),B(()=>{N.email&&N.email!==(i==null?void 0:i.email)?y(!0):N.email&&N.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,N]);const W=G(()=>!I||!i?[]:I.filter(({name:g})=>g!==void 0&&i[g]).map(g=>({name:g.name,orderNumber:g.orderNumber,value:i[g.name],label:g.label})),[i,I]);B(()=>{W!=null&&W.length&&t(!1)},[W]);const me=G(()=>w==null?void 0:w.map(a=>({...a,defaultValue:a!=null&&a.customUpperCode&&i?i[a.customUpperCode]??"":""})).map(a=>a.customUpperCode==="gender"?{...a,defaultValue:a.defaultValue==="Male"?1:2}:a),[w,i]),fe=C(async(a,g)=>{const M=Pe(a.target),{email:v,password:q,...D}=M,Y=v!==(i==null?void 0:i.email)&&q.length===0;if(!g){Y&&l(!0);return}if(l(!1),s(!0),v===(i==null?void 0:i.email)){S(""),re(ee(D,"account")).then(k=>{k&&(j(),T("success"),te(x==null?void 0:x.EDIT_ACCOUNT_EVENT,{...M}))}).catch(k=>{T("error",k.message)});return}if(Y){l(!0),s(!1);return}v!=null&&v.length&&(q!=null&&q.length)&&ye({email:v,password:q}).then(k=>{k&&re(ee(D,"account")).then(J=>{J&&(j(),T("success"),te(x==null?void 0:x.EDIT_ACCOUNT_EVENT,{...M}))}).catch(J=>{T("error",J.message)})}).catch(k=>{T("error",k.message)})},[i,S,j,T]);return{createdAt:b,errorPasswordEmpty:h,passwordValue:$,showPasswordOnEmailChange:F,orderedCustomerData:W,loading:n,normalizeFieldsConfig:me,submitLoading:o,showEditForm:c,showChangePassword:P,handleShowChangePassword:ce,handleHideChangePassword:de,handleShowEditForm:ue,handleHideEditForm:le,handleUpdateCustomerInformation:fe,handleInputChange:ie,handleSetPassword:S,handleOnBlurPassword:_,renderAlertMessage:T}},We={success:d(ve,{}),warning:d(_e,{}),error:d(Le,{})},je=()=>{const[e,r]=m({}),n=C(t=>{if(!(t!=null&&t.type)){r({});return}const o=We[t.type];r({...t,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlert:n}},ar=({className:e,withHeader:r=!0,slots:n})=>{const t=O({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:s}=je(),{createdAt:P,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:l,normalizeFieldsConfig:F,submitLoading:y,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleHideChangePassword:A,handleShowEditForm:w,handleHideEditForm:Z,handleUpdateCustomerInformation:N,handleInputChange:U,handleSetPassword:$,handleOnBlurPassword:f}=ze({handleSetInLineAlert:s});return l?d("div",{"data-testid":"customerInformationLoader",children:d(pe,{withCard:!0})}):L("div",{className:ne(["account-customer-information",e]),children:[r?d(Q,{title:t.containerTitle,divider:!1,className:"customer-information__title"}):null,d(xe,{createdAt:P,slots:n,orderedCustomerData:h,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleShowEditForm:w}),E?d(qe,{inLineAlertProps:o,handleSetInLineAlert:s,handleHideChangePassword:A}):null,I?d(ke,{inLineAlertProps:o,submitLoading:y,formFieldsList:F,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:$,handleOnBlurPassword:f,handleUpdateCustomerInformation:N,handleHideEditForm:Z,handleInputChange:U}):null]})};export{ar as CustomerInformation,ar as default};
3
+ import{jsxs as L,jsx as d,Fragment as he}from"@dropins/tools/preact-jsx-runtime.js";import{classes as ne,Slot as ge}from"@dropins/tools/lib.js";import{F as we,d as Ce,g as Pe,n as ee,C as pe}from"../chunks/AddressValidation.js";import*as V from"@dropins/tools/preact-compat.js";import{Card as X,Header as Q,InLineAlert as oe,InputPassword as R,Button as H}from"@dropins/tools/components.js";import{useState as m,useEffect as B,useCallback as C,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as Ee}from"../chunks/getStoreConfig.js";import{u as be,g as Ve,b as re,a as ye}from"../chunks/updateCustomer.js";import{useText as O}from"@dropins/tools/i18n.js";import{d as Ie}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const _e=e=>V.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},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.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"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ve=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.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"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Le=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.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"}),V.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"})),Fe=e=>({firstName:e.firstName,lastName:e.lastName,emailAddress:(e==null?void 0:e.email)||"",accountId:(e==null?void 0:e.email)||""}),Ne=()=>{const[e,r]=m(null);return B(()=>{const n=sessionStorage.getItem("accountStoreConfig"),t=n?JSON.parse(n):null;if(t){const{minLength:o,requiredCharacterClasses:s}=t;r({minLength:o,requiredCharacterClasses:s})}else Ee().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:P}=o;sessionStorage.setItem("accountStoreConfig",JSON.stringify(o)),r({minLength:s,requiredCharacterClasses:P})}})},[]),{passwordConfigs:e}},Ae=({currentPassword:e,newPassword:r,confirmPassword:n,translations:t})=>{let o={...K};const s=!e.length&&!r.length&&!n.length,P=e.length&&r!==n;return s?(o={...o,currentPassword:t.requiredFieldError,newPassword:t.requiredFieldError,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):e.length?r.length?n.length?P?(o={...o,currentPassword:"",newPassword:"",confirmPassword:t.passwordMismatch},{isValid:!1,errors:o}):{isValid:!0,errors:o}:(o={...o,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,newPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,currentPassword:t.requiredFieldError},{isValid:!1,errors:o})},ae=(e,r)=>{if(r<=1)return!0;const n=/[0-9]/.test(e)?1:0,t=/[a-z]/.test(e)?1:0,o=/[A-Z]/.test(e)?1:0,s=/[^a-zA-Z0-9\s]/.test(e)?1:0;return n+t+o+s>=r},K={currentPassword:"",newPassword:"",confirmPassword:""},Se=({passwordConfigs:e,handleSetInLineAlert:r,handleHideChangePassword:n})=>{const t=O({requiredFieldError:"Account.FormText.requiredFieldError",passwordMismatch:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch",incorrectCurrentPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword",passwordUpdateMessage:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage"}),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(""),[h,l]=m(""),[F,y]=m(""),[I,E]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{n(()=>{r({}),E(K)})},[n,r]),A=C(f=>{p(f),E(b=>({...b,currentPassword:f?"":t.requiredFieldError}))},[t]),w=C(f=>{l(f),E(b=>({...b,newPassword:f?"":t.requiredFieldError}))},[t]),Z=C(f=>{y(f),E(b=>({...b,confirmPassword:f?"":t.requiredFieldError}))},[t]),N=C(f=>{const{name:b,value:z}=f==null?void 0:f.target;E(_=>({..._,[b]:z?"":t.requiredFieldError}))},[t]),U=C(()=>{const{isValid:f,errors:b}=Ae({currentPassword:c,newPassword:h,confirmPassword:F,translations:t});return E(b),f},[c,h,F,t]),$=C(f=>{f.preventDefault(),u(!0);const b=(e==null?void 0:e.requiredCharacterClasses)??0,z=(e==null?void 0:e.minLength)??1;if(!U()){s(!0),u(!1);return}if(!ae(h,b)||z>(h==null?void 0:h.length)){s(!0),u(!1);return}be({currentPassword:c,newPassword:h}).then(_=>{if(!(_!=null&&_.length)){u(!1);return}p(""),l(""),y(""),E(K),s(!1),r({type:"success",text:t.passwordUpdateMessage})}).catch(_=>{_.message==="Invalid login or password."&&r({type:"error",text:t.incorrectCurrentPassword}),_.message==="The account is locked."&&r({type:"error",text:_.message})}),u(!1)},[e,U,h,c,r,t]);return{hideChangePassword:i,handleOnBlurPassword:N,handleConfirmPasswordChange:Z,handleNewPasswordChange:w,handleCurrentPasswordChange:A,mutationChangePassword:$,currentPassword:c,newPassword:h,confirmPassword:F,passwordErrors:I,submitLoading:P,isClickSubmit:o}},Te=({passwordConfigs:e,isClickSubmit:r,password:n})=>{const t=O({messageLengthPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword"}),[o,s]=m("pending");B(()=>{if(!e)return;const u=ae(n,e.requiredCharacterClasses);r&&n.length>0?s(u?"success":"error"):r&&n.length===0?s("pending"):s(u?"success":"pending")},[r,e,n]);const P=G(()=>{var c;if(!e)return;const u={status:"pending",icon:"pending",message:(c=t.messageLengthPassword)==null?void 0:c.replace("{minLength}",`${e.minLength}`)};return n.length&&n.length>=e.minLength?{...u,icon:"success",status:"success"}:n.length&&n.length<e.minLength?r?{...u,icon:"error",status:"error"}:{...u,icon:"pending",status:"pending"}:u},[e,t.messageLengthPassword,n==null?void 0:n.length,r]);return{isValidUniqueSymbols:o,defaultLengthMessage:P}},Me=(e,r,n,t,o)=>e==="error"||(r==null?void 0:r.status)==="error"||n&&t.trim().length===0?o.newPassword:void 0,qe=({handleHideChangePassword:e,handleSetInLineAlert:r,inLineAlertProps:n})=>{const{passwordConfigs:t}=Ne(),{hideChangePassword:o,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:u,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:l,confirmPassword:F,passwordErrors:y,submitLoading:I,isClickSubmit:E}=Se({passwordConfigs:t,handleSetInLineAlert:r,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:A}=Te({password:l,isClickSubmit:E,passwordConfigs:t}),w=O({containerTitle:"Account.minifiedView.CustomerInformation.changePassword.containerTitle",currentPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder",currentPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel",newPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder",newPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel",confirmPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel",buttonSecondary:"Account.minifiedView.CustomerInformation.changePassword.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.changePassword.buttonPrimary"});return L(X,{className:"account-change-password",variant:"secondary",children:[d(Q,{title:w.containerTitle,divider:!1,className:"account-change-password__title"}),n.text?d(oe,{className:"account-change-password__notification",type:n.type,variant:"secondary",heading:n.text,icon:n.icon,"data-testid":"changePasswordInLineAlert"}):null,L("div",{className:"account-change-password__fields",children:[d(R,{className:"account-change-password__fields-item",autoComplete:"currentPassword",name:"currentPassword",placeholder:w.currentPasswordPlaceholder,floatingLabel:w.currentPasswordFloatingLabel,errorMessage:y.currentPassword,defaultValue:h,onValue:c,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"newPassword",name:"newPassword",placeholder:w.newPasswordPlaceholder,floatingLabel:w.newPasswordFloatingLabel,minLength:t==null?void 0:t.minLength,validateLengthConfig:A,uniqueSymbolsStatus:i,requiredCharacterClasses:t==null?void 0:t.requiredCharacterClasses,errorMessage:Me(i,A,E,l,y),defaultValue:l,onValue:u,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"confirmPassword",name:"confirmPassword",placeholder:w.confirmPasswordPlaceholder,floatingLabel:w.confirmPasswordFloatingLabel,errorMessage:y.confirmPassword,defaultValue:F,onValue:P,onBlur:s})]}),L("div",{className:"account-change-password__actions",children:[d(H,{type:"button",disabled:I,onClick:o,variant:"secondary",children:w.buttonSecondary}),d(H,{variant:"primary",type:"button",disabled:I,onClick:p,children:w.buttonPrimary})]})]})},ke=({inLineAlertProps:e,errorPasswordEmpty:r,passwordValue:n,showPasswordOnEmailChange:t,submitLoading:o,formFieldsList:s,handleHideEditForm:P,handleUpdateCustomerInformation:u,handleInputChange:c,handleSetPassword:p,handleOnBlurPassword:h})=>{const l=O({buttonSecondary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary",placeholder:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder",floatingLabel:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel",containerTitle:"Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle",requiredFieldError:"Account.FormText.requiredFieldError"});return L(X,{variant:"secondary",className:"account-edit-customer-information",children:[d(Q,{title:l.containerTitle,divider:!1,className:"account-edit-customer-information__title"}),e.text?d(oe,{className:"account-edit-customer-information__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon,"data-testid":"editCustomerInLineAlert"}):null,L(we,{loading:o,fieldsConfig:s||[],name:"editCustomerInformation",className:"account-edit-customer-information-form",onSubmit:u,setInputChange:c,children:[t?d("div",{className:"account-edit-customer-information__password",children:d(R,{autoComplete:"password",name:"password",placeholder:l.placeholder,floatingLabel:l.floatingLabel,errorMessage:r?l.requiredFieldError:void 0,defaultValue:n,onValue:p,onBlur:h})}):null,L("div",{className:"account-edit-customer-information__actions",children:[d(H,{disabled:o,type:"button",variant:"secondary",onClick:()=>P(),children:l.buttonSecondary}),d(H,{disabled:o,type:"submit",variant:"primary",children:l.buttonPrimary})]})]})]})},xe=({createdAt:e,slots:r,orderedCustomerData:n,showEditForm:t,showChangePassword:o,handleShowChangePassword:s,handleShowEditForm:P})=>{const u=O({buttonSecondary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary",accountCreation:"Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation"});return d(X,{variant:"secondary",className:ne(["account-customer-information-card",["account-customer-information-card-short",o||t]]),children:L("div",{className:"account-customer-information-card__wrapper",children:[L("div",{className:"account-customer-information-card__actions",children:[d(H,{type:"button",variant:"tertiary",onClick:s,children:u.buttonSecondary}),d(H,{type:"button",variant:"tertiary",onClick:P,children:u.buttonPrimary})]}),d("div",{className:"account-customer-information-card__content",children:r!=null&&r.CustomerData?d(ge,{name:"CustomerData",slot:r==null?void 0:r.CustomerData,context:{customerData:n}}):L(he,{children:[n==null?void 0:n.map((c,p)=>{const h=c!=null&&c.label?`${c.label}: ${c==null?void 0:c.value}`:c==null?void 0:c.value;return d("p",{"data-testid":`${c.name}_${p}`,children:h},`${c.name}_${p}`)}),L("p",{children:[u.accountCreation,": ",e]})]})})]})})},Oe=e=>{if(!(e!=null&&e.dateOfBirth))return e;const{dateOfBirth:r,...n}=e;return{...n,dob:r}},Ue="accountContext";var x=(e=>(e.EDIT_ACCOUNT_EVENT="edit-account",e))(x||{});const Be={EDIT_ACCOUNT_EVENT:"edit-account"};function se(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function He(e,r){const n=se();n.push({[e]:null}),n.push({[e]:r})}function Ze(e,r){se().push(t=>{const o=t.getState?t.getState():{};t.push({event:e,eventInfo:{...o,...r}})})}function $e(e){const r=Fe(e);He(Ue,r),Ze(Be.EDIT_ACCOUNT_EVENT)}const te=(e,r)=>{const n=sessionStorage.getItem("accountStoreConfig"),o={...n?JSON.parse(n):{},...r};switch(e){case"edit-account":$e(o);break;default:return null}},ze=({handleSetInLineAlert:e})=>{const r=O({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[n,t]=m(!0),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(!1),[h,l]=m(!1),[F,y]=m(!1),[I,E]=m([]),[i,A]=m(null),[w,Z]=m([]),[N,U]=m({}),[$,f]=m(""),[b,z]=m(""),_=C(a=>{const{value:g}=a==null?void 0:a.target;g.length&&l(!1),g.length||l(!0)},[]),S=C(a=>{f(a)},[]),ie=C(a=>{U(a)},[]),ce=C(()=>{u(!0),p(!1),e(),S("")},[e,S]),de=C(a=>{a==null||a(),u(!1)},[]),ue=C(()=>{p(!0),u(!1),e(),S("")},[e,S]),le=C(a=>{a==null||a(),p(!1)},[]),T=C((a,g)=>{a==="success"?e({type:"success",text:g??r.accountSuccess}):a==="error"?e({type:"error",text:g??r.accountError}):e(),s(!1)},[e,r]),j=C(()=>{Ve().then(a=>{var v;const g=(v=a==null?void 0:a.createdAt)==null?void 0:v.split(" ")[0],M=Oe({...a,gender:a.gender===1?r.genderMale:r.genderFemale});A(M),z(g)})},[r.genderFemale,r.genderMale]);B(()=>{j()},[]),B(()=>{Ie("customer_account_edit").then(a=>{Z(a);const g=a.map(({name:M,customUpperCode:v,orderNumber:q,label:D})=>({name:v,orderNumber:q,label:Ce.includes(M)?null:D}));E(g)})},[]),B(()=>{N.email&&N.email!==(i==null?void 0:i.email)?y(!0):N.email&&N.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,N]);const W=G(()=>!I||!i?[]:I.filter(({name:g})=>g!==void 0&&i[g]).map(g=>({name:g.name,orderNumber:g.orderNumber,value:i[g.name],label:g.label})),[i,I]);B(()=>{W!=null&&W.length&&t(!1)},[W]);const me=G(()=>w==null?void 0:w.map(a=>({...a,defaultValue:a!=null&&a.customUpperCode&&i?i[a.customUpperCode]??"":""})).map(a=>a.customUpperCode==="gender"?{...a,defaultValue:a.defaultValue==="Male"?1:2}:a),[w,i]),fe=C(async(a,g)=>{const M=Pe(a.target),{email:v,password:q,...D}=M,Y=v!==(i==null?void 0:i.email)&&q.length===0;if(!g){Y&&l(!0);return}if(l(!1),s(!0),v===(i==null?void 0:i.email)){S(""),re(ee(D,"account")).then(k=>{k&&(j(),T("success"),te(x==null?void 0:x.EDIT_ACCOUNT_EVENT,{...M}))}).catch(k=>{T("error",k.message)});return}if(Y){l(!0),s(!1);return}v!=null&&v.length&&(q!=null&&q.length)&&ye({email:v,password:q}).then(k=>{k&&re(ee(D,"account")).then(J=>{J&&(j(),T("success"),te(x==null?void 0:x.EDIT_ACCOUNT_EVENT,{...M}))}).catch(J=>{T("error",J.message)})}).catch(k=>{T("error",k.message)})},[i,S,j,T]);return{createdAt:b,errorPasswordEmpty:h,passwordValue:$,showPasswordOnEmailChange:F,orderedCustomerData:W,loading:n,normalizeFieldsConfig:me,submitLoading:o,showEditForm:c,showChangePassword:P,handleShowChangePassword:ce,handleHideChangePassword:de,handleShowEditForm:ue,handleHideEditForm:le,handleUpdateCustomerInformation:fe,handleInputChange:ie,handleSetPassword:S,handleOnBlurPassword:_,renderAlertMessage:T}},We={success:d(ve,{}),warning:d(_e,{}),error:d(Le,{})},je=()=>{const[e,r]=m({}),n=C(t=>{if(!(t!=null&&t.type)){r({});return}const o=We[t.type];r({...t,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlert:n}},ar=({className:e,withHeader:r=!0,slots:n})=>{const t=O({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:s}=je(),{createdAt:P,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:l,normalizeFieldsConfig:F,submitLoading:y,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleHideChangePassword:A,handleShowEditForm:w,handleHideEditForm:Z,handleUpdateCustomerInformation:N,handleInputChange:U,handleSetPassword:$,handleOnBlurPassword:f}=ze({handleSetInLineAlert:s});return l?d("div",{"data-testid":"customerInformationLoader",children:d(pe,{withCard:!0})}):L("div",{className:ne(["account-customer-information",e]),children:[r?d(Q,{title:t.containerTitle,divider:!1,className:"customer-information__title"}):null,d(xe,{createdAt:P,slots:n,orderedCustomerData:h,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleShowEditForm:w}),E?d(qe,{inLineAlertProps:o,handleSetInLineAlert:s,handleHideChangePassword:A}):null,I?d(ke,{inLineAlertProps:o,submitLoading:y,formFieldsList:F,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:$,handleOnBlurPassword:f,handleUpdateCustomerInformation:N,handleHideEditForm:Z,handleInputChange:U}):null]})};export{ar as CustomerInformation,ar as default};
4
4
  //# sourceMappingURL=CustomerInformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomerInformation.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-account/src/data/transforms/transform-account.ts","/@dropins/storefront-account/src/hooks/containers/useGetStoreConfigs.tsx","/@dropins/storefront-account/src/lib/validationChangePassword.ts","/@dropins/storefront-account/src/lib/validationUniqueSymbolsPassword.ts","/@dropins/storefront-account/src/hooks/components/useChangePassword.tsx","/@dropins/storefront-account/src/hooks/components/usePasswordValidationMessage.tsx","/@dropins/storefront-account/src/components/ChangePassword/ChangePassword.tsx","/@dropins/storefront-account/src/components/EditCustomerInformation/EditCustomerInformation.tsx","/@dropins/storefront-account/src/components/CustomerInformationCard/CustomerInformationCard.tsx","/@dropins/storefront-account/src/lib/transformDobCustomer.ts","/@dropins/storefront-account/src/lib/acdl.ts","/@dropins/storefront-account/src/hooks/containers/useCustomerInformation.tsx","/@dropins/storefront-account/src/hooks/useInLineAlert.tsx","/@dropins/storefront-account/src/containers/CustomerInformation/CustomerInformation.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.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\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.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\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.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\" }), /* @__PURE__ */ React.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\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AccountModel,\n CustomerDataModelShort,\n} from '@/account/data/models/customer';\n\n/**\n * Reference:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n */\nexport const transformAccount = (\n data: CustomerDataModelShort\n): AccountModel => {\n return {\n firstName: data.firstName,\n lastName: data.lastName,\n emailAddress: data?.email || '',\n accountId: data?.email || '',\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfig } from '@/account/api';\nimport { StoreConfigModel } from '@/account/data/models';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport const useGetStoreConfigs = () => {\n const [passwordConfigs, setPasswordConfigs] = useState<{\n minLength: number;\n requiredCharacterClasses: number;\n } | null>(null);\n\n useEffect(() => {\n const storeConfigString = sessionStorage.getItem('accountStoreConfig');\n\n const cachedStoreConfig: StoreConfigModel = storeConfigString\n ? JSON.parse(storeConfigString)\n : null;\n\n if (cachedStoreConfig) {\n const { minLength, requiredCharacterClasses } = cachedStoreConfig;\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n } else {\n getStoreConfig().then((response) => {\n if (response) {\n const { minLength, requiredCharacterClasses } = response;\n\n sessionStorage.setItem(\n 'accountStoreConfig',\n JSON.stringify(response)\n );\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n }\n });\n }\n }, []);\n\n return { passwordConfigs };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DEFAULT_ERRORS_STATE } from '../hooks/components/useChangePassword';\n\ninterface PasswordValidationParams {\n currentPassword: string;\n newPassword: string;\n confirmPassword: string;\n translations: Record<string, string>;\n}\n\ninterface PasswordErrors {\n currentPassword: string;\n newPassword: string;\n confirmPassword: string;\n}\n\nexport const validationChangePassword = ({\n currentPassword,\n newPassword,\n confirmPassword,\n translations,\n}: PasswordValidationParams): { isValid: boolean; errors: PasswordErrors } => {\n let errors: PasswordErrors = { ...DEFAULT_ERRORS_STATE };\n\n const arePasswordsEmpty =\n !currentPassword.length && !newPassword.length && !confirmPassword.length;\n const isNewPasswordMismatch =\n currentPassword.length && newPassword !== confirmPassword;\n\n if (arePasswordsEmpty) {\n errors = {\n ...errors,\n currentPassword: translations.requiredFieldError,\n newPassword: translations.requiredFieldError,\n confirmPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!currentPassword.length) {\n errors = {\n ...errors,\n currentPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!newPassword.length) {\n errors = {\n ...errors,\n newPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!confirmPassword.length) {\n errors = {\n ...errors,\n confirmPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (isNewPasswordMismatch) {\n errors = {\n ...errors,\n currentPassword: '',\n newPassword: '',\n confirmPassword: translations.passwordMismatch,\n };\n return { isValid: false, errors };\n }\n\n return { isValid: true, errors };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const validationUniqueSymbolsPassword = (\n password: string,\n uniqueSymbolsCount: number\n) => {\n if (uniqueSymbolsCount <= 1) return true;\n\n const numbers = /[0-9]/.test(password) ? 1 : 0;\n const lowerCaseLetter = /[a-z]/.test(password) ? 1 : 0;\n const upperCaseLetter = /[A-Z]/.test(password) ? 1 : 0;\n const specialSymbols = /[^a-zA-Z0-9\\s]/.test(password) ? 1 : 0;\n\n return (\n numbers + lowerCaseLetter + upperCaseLetter + specialSymbols >=\n uniqueSymbolsCount\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { updateCustomerPassword } from '@/account/api';\nimport { validationChangePassword } from '@/account/lib/validationChangePassword';\nimport { validationUniqueSymbolsPassword } from '@/account/lib/validationUniqueSymbolsPassword';\nimport { UseChangePasswordProps } from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\n\nexport const DEFAULT_ERRORS_STATE = {\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n};\n\nexport const useChangePassword = ({\n passwordConfigs,\n handleSetInLineAlert,\n handleHideChangePassword,\n}: UseChangePasswordProps) => {\n const translations = useText({\n requiredFieldError: 'Account.FormText.requiredFieldError',\n passwordMismatch:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch',\n incorrectCurrentPassword:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword',\n passwordUpdateMessage:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage',\n });\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [currentPassword, setCurrentPassword] = useState('');\n const [newPassword, setNewPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n const [passwordErrors, setPasswordErrors] = useState({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n });\n\n const hideChangePassword = useCallback(() => {\n handleHideChangePassword(() => {\n handleSetInLineAlert({});\n setPasswordErrors(DEFAULT_ERRORS_STATE);\n });\n }, [handleHideChangePassword, handleSetInLineAlert]);\n\n const handleCurrentPasswordChange = useCallback(\n (value: string) => {\n setCurrentPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n currentPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleNewPasswordChange = useCallback(\n (value: string) => {\n setNewPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n newPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleConfirmPasswordChange = useCallback(\n (value: string) => {\n setConfirmPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n confirmPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleOnBlurPassword = useCallback(\n (event: Event) => {\n const { name, value } = event?.target as HTMLInputElement;\n\n setPasswordErrors((prev) => ({\n ...prev,\n [name]: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const validatePasswords = useCallback(() => {\n const { isValid, errors } = validationChangePassword({\n currentPassword,\n newPassword,\n confirmPassword,\n translations,\n });\n\n setPasswordErrors(errors);\n return isValid;\n }, [currentPassword, newPassword, confirmPassword, translations]);\n\n const mutationChangePassword = useCallback(\n (event: Event) => {\n event.preventDefault();\n\n setSubmitLoading(true);\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses ?? 0;\n const requiredPasswordLength = passwordConfigs?.minLength ?? 1;\n\n if (!validatePasswords()) {\n setIsClickSubmit(true);\n setSubmitLoading(false);\n return;\n }\n\n if (\n !validationUniqueSymbolsPassword(\n newPassword,\n requiredCharacterClasses\n ) ||\n requiredPasswordLength > newPassword?.length\n ) {\n setIsClickSubmit(true);\n setSubmitLoading(false);\n\n return;\n }\n\n updateCustomerPassword({ currentPassword, newPassword })\n .then((result) => {\n if (!result?.length) {\n setSubmitLoading(false);\n return;\n }\n\n setCurrentPassword('');\n setNewPassword('');\n setConfirmPassword('');\n setPasswordErrors(DEFAULT_ERRORS_STATE);\n setIsClickSubmit(false);\n handleSetInLineAlert({\n type: 'success',\n text: translations.passwordUpdateMessage,\n });\n })\n .catch((error) => {\n if (error.message === 'Invalid login or password.') {\n handleSetInLineAlert({\n type: 'error',\n text: translations.incorrectCurrentPassword,\n });\n }\n\n if (error.message === 'The account is locked.') {\n handleSetInLineAlert({\n type: 'error',\n text: error.message,\n });\n }\n });\n\n setSubmitLoading(false);\n },\n [\n passwordConfigs,\n validatePasswords,\n newPassword,\n currentPassword,\n handleSetInLineAlert,\n translations,\n ]\n );\n\n return {\n hideChangePassword,\n handleOnBlurPassword,\n handleConfirmPasswordChange,\n handleNewPasswordChange,\n handleCurrentPasswordChange,\n mutationChangePassword,\n currentPassword,\n newPassword,\n confirmPassword,\n passwordErrors,\n submitLoading,\n isClickSubmit,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { validationUniqueSymbolsPassword } from '@/account/lib/validationUniqueSymbolsPassword';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { ValidateLengthConfigProps, statusTypes } from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface UsePasswordValidationMessageProps {\n passwordConfigs: {\n minLength: number;\n requiredCharacterClasses: number;\n } | null;\n isClickSubmit: boolean;\n password: string;\n}\n\nexport const usePasswordValidationMessage = ({\n passwordConfigs,\n isClickSubmit,\n password,\n}: UsePasswordValidationMessageProps) => {\n const translations = useText({\n messageLengthPassword:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword',\n });\n\n const [isValidUniqueSymbols, setIsValidUniqueSymbols] =\n useState<statusTypes>('pending');\n\n useEffect(() => {\n if (!passwordConfigs) return;\n\n const result = validationUniqueSymbolsPassword(\n password,\n passwordConfigs.requiredCharacterClasses\n );\n\n if (isClickSubmit && password.length > 0) {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('error');\n } else if (isClickSubmit && password.length === 0) {\n setIsValidUniqueSymbols('pending');\n } else {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('pending');\n }\n }, [isClickSubmit, passwordConfigs, password]);\n\n const defaultLengthMessage: ValidateLengthConfigProps | undefined =\n useMemo(() => {\n if (!passwordConfigs) return;\n\n const defaultMessage: ValidateLengthConfigProps = {\n status: 'pending',\n icon: 'pending',\n message: translations.messageLengthPassword?.replace(\n '{minLength}',\n `${passwordConfigs.minLength}`\n ),\n };\n\n if (password.length && password.length >= passwordConfigs.minLength) {\n return { ...defaultMessage, icon: 'success', status: 'success' };\n }\n\n if (password.length && password.length < passwordConfigs.minLength) {\n return isClickSubmit\n ? { ...defaultMessage, icon: 'error', status: 'error' }\n : { ...defaultMessage, icon: 'pending', status: 'pending' };\n }\n\n return defaultMessage;\n }, [\n passwordConfigs,\n translations.messageLengthPassword,\n password?.length,\n isClickSubmit,\n ]);\n\n return { isValidUniqueSymbols, defaultLengthMessage };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport {\n ChangePasswordProps,\n ValidateLengthConfigProps,\n} from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n InputPassword,\n} from '@adobe-commerce/elsie/components';\nimport '@/account/components/ChangePassword/ChangePassword.css';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { useChangePassword } from '@/account/hooks/components/useChangePassword';\nimport { usePasswordValidationMessage } from '@/account/hooks/components/usePasswordValidationMessage';\n\nexport const getErrorMessage = (\n isValidUniqueSymbols: string,\n defaultLengthMessage: ValidateLengthConfigProps | undefined,\n isSubmit: boolean,\n newPassword: string,\n passwordErrors: { newPassword: string }\n) => {\n const hasError =\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error' ||\n (isSubmit && newPassword.trim().length === 0);\n\n return hasError ? passwordErrors.newPassword : undefined;\n};\n\nexport const ChangePassword: FunctionComponent<ChangePasswordProps> = ({\n handleHideChangePassword,\n handleSetInLineAlert,\n inLineAlertProps,\n}) => {\n const { passwordConfigs } = useGetStoreConfigs();\n\n const {\n hideChangePassword,\n handleOnBlurPassword,\n handleConfirmPasswordChange,\n handleNewPasswordChange,\n handleCurrentPasswordChange,\n mutationChangePassword,\n currentPassword,\n newPassword,\n confirmPassword,\n passwordErrors,\n submitLoading,\n isClickSubmit,\n } = useChangePassword({\n passwordConfigs,\n handleSetInLineAlert,\n handleHideChangePassword,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: newPassword,\n isClickSubmit,\n passwordConfigs,\n });\n\n const translations = useText({\n containerTitle:\n 'Account.minifiedView.CustomerInformation.changePassword.containerTitle',\n currentPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder',\n currentPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel',\n newPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder',\n newPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel',\n confirmPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder',\n confirmPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel',\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.changePassword.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.changePassword.buttonPrimary',\n });\n\n return (\n <Card className=\"account-change-password\" variant=\"secondary\">\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'account-change-password__title'}\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"account-change-password__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"changePasswordInLineAlert\"\n />\n ) : null}\n <div className=\"account-change-password__fields\">\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"currentPassword\"\n name=\"currentPassword\"\n placeholder={translations.currentPasswordPlaceholder}\n floatingLabel={translations.currentPasswordFloatingLabel}\n errorMessage={passwordErrors.currentPassword}\n defaultValue={currentPassword}\n onValue={handleCurrentPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"newPassword\"\n name=\"newPassword\"\n placeholder={translations.newPasswordPlaceholder}\n floatingLabel={translations.newPasswordFloatingLabel}\n minLength={passwordConfigs?.minLength}\n validateLengthConfig={defaultLengthMessage}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n errorMessage={getErrorMessage(\n isValidUniqueSymbols,\n defaultLengthMessage,\n isClickSubmit,\n newPassword,\n passwordErrors\n )}\n defaultValue={newPassword}\n onValue={handleNewPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"confirmPassword\"\n name=\"confirmPassword\"\n placeholder={translations.confirmPasswordPlaceholder}\n floatingLabel={translations.confirmPasswordFloatingLabel}\n errorMessage={passwordErrors.confirmPassword}\n defaultValue={confirmPassword}\n onValue={handleConfirmPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n </div>\n\n <div className=\"account-change-password__actions\">\n <Button\n // @ts-ignore\n type=\"button\"\n disabled={submitLoading}\n onClick={hideChangePassword}\n variant=\"secondary\"\n >\n {translations.buttonSecondary}\n </Button>\n <Button\n variant=\"primary\"\n // @ts-ignore\n type=\"button\"\n disabled={submitLoading}\n onClick={mutationChangePassword}\n >\n {translations.buttonPrimary}\n </Button>\n </div>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { EditCustomerInformationProps, FieldsProps } from '@/account/types';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n InputPassword,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Form } from '@/account/components';\nimport '@/account/components/EditCustomerInformation/EditCustomerInformation.css';\n\nexport const EditCustomerInformation: FunctionComponent<\n EditCustomerInformationProps\n> = ({\n inLineAlertProps,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n submitLoading,\n formFieldsList,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n}) => {\n const translations = useText({\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary',\n placeholder:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder',\n floatingLabel:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel',\n containerTitle:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle',\n requiredFieldError: 'Account.FormText.requiredFieldError',\n });\n\n return (\n <Card variant=\"secondary\" className={'account-edit-customer-information'}>\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'account-edit-customer-information__title'}\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"account-edit-customer-information__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"editCustomerInLineAlert\"\n />\n ) : null}\n <Form\n loading={submitLoading}\n fieldsConfig={(formFieldsList as FieldsProps[]) || []}\n name=\"editCustomerInformation\"\n className=\"account-edit-customer-information-form\"\n onSubmit={handleUpdateCustomerInformation}\n setInputChange={handleInputChange}\n >\n {showPasswordOnEmailChange ? (\n <div className=\"account-edit-customer-information__password\">\n <InputPassword\n autoComplete=\"password\"\n name=\"password\"\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n errorMessage={\n errorPasswordEmpty ? translations.requiredFieldError : undefined\n }\n defaultValue={passwordValue}\n onValue={handleSetPassword}\n onBlur={handleOnBlurPassword}\n />\n </div>\n ) : null}\n <div className=\"account-edit-customer-information__actions\">\n <Button\n disabled={submitLoading}\n // @ts-ignore\n type=\"button\"\n variant=\"secondary\"\n onClick={() => handleHideEditForm()}\n >\n {translations.buttonSecondary}\n </Button>\n <Button disabled={submitLoading} type=\"submit\" variant=\"primary\">\n {translations.buttonPrimary}\n </Button>\n </div>\n </Form>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { CustomerInformationCardProps } from '@/account/types';\nimport { Card, Button } from '@adobe-commerce/elsie/components';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/account/components/CustomerInformationCard/CustomerInformationCard.css';\n\nexport const CustomerInformationCard: FunctionComponent<\n CustomerInformationCardProps\n> = ({\n createdAt,\n slots,\n orderedCustomerData,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleShowEditForm,\n}) => {\n const translations = useText({\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary',\n accountCreation:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation',\n });\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'account-customer-information-card',\n [\n 'account-customer-information-card-short',\n showChangePassword || showEditForm,\n ],\n ])}\n >\n <div className=\"account-customer-information-card__wrapper\">\n <div className=\"account-customer-information-card__actions\">\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowChangePassword}\n >\n {translations.buttonSecondary}\n </Button>\n\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowEditForm}\n >\n {translations.buttonPrimary}\n </Button>\n </div>\n <div className=\"account-customer-information-card__content\">\n {slots?.CustomerData ? (\n <Slot\n name=\"CustomerData\"\n slot={slots?.CustomerData}\n context={{ customerData: orderedCustomerData }}\n />\n ) : (\n <>\n {orderedCustomerData?.map((el, index) => {\n const value = !el?.label\n ? el?.value\n : `${el.label}: ${el?.value}`;\n\n return (\n <p\n key={`${el.name}_${index}`}\n data-testid={`${el.name}_${index}`}\n >\n {value}\n </p>\n );\n })}\n <p>\n {translations.accountCreation}: {createdAt}\n </p>\n </>\n )}\n </div>\n </div>\n </Card>\n );\n};\n","import { CustomerDataModelShort } from '@/account/data/models/customer';\n\nexport const transformDobCustomer = (\n customerData: CustomerDataModelShort\n): CustomerDataModelShort | (CustomerDataModelShort & { dob: string }) => {\n if (!customerData?.dateOfBirth) return customerData;\n\n const { dateOfBirth, ...rest } = customerData;\n\n return { ...rest, dob: dateOfBirth } as CustomerDataModelShort & {\n dob: string;\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\n\nenum EventsList {\n EDIT_ACCOUNT_EVENT = 'edit-account',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n EDIT_ACCOUNT_EVENT: EventsList.EDIT_ACCOUNT_EVENT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction editAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.EDIT_ACCOUNT_EVENT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('accountStoreConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n const eventData = { ...storeConfig, ...eventParams };\n\n switch (eventType) {\n case EventsList.EDIT_ACCOUNT_EVENT:\n editAccountEvent(eventData);\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport {\n getAttributesForm,\n getCustomer,\n updateCustomerEmail,\n updateCustomer,\n} from '@/account/api';\nimport {\n KeysSortOrderProps,\n UseCustomerInformationProps,\n} from '@/account/types';\nimport { defaultAccountAttributePreset } from '@/account/configs/defaultAttributePreset.config';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { getFormValues } from '@/account/lib/getFormValues';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { normalizeAttributes } from '@/account/lib/normalizeAttributes';\nimport { transformDobCustomer } from '@/account/lib/transformDobCustomer';\nimport { EventsList, publishEvents } from '@/account/lib/acdl';\n\nexport const useCustomerInformation = ({\n handleSetInLineAlert,\n}: UseCustomerInformationProps) => {\n const translations = useText({\n accountSuccess:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess',\n accountError:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountError',\n genderMale: 'Account.minifiedView.CustomerInformation.genderMale',\n genderFemale: 'Account.minifiedView.CustomerInformation.genderFemale',\n });\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showChangePassword, setShowChangePassword] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [errorPasswordEmpty, setErrorPasswordEmpty] = useState(false);\n const [showPasswordOnEmailChange, setShowPasswordOnEmailChange] =\n useState(false);\n const [keysSortOrder, setKeysSortOrder] = useState<KeysSortOrderProps[] | []>(\n []\n );\n const [customerData, setCustomerData] =\n useState<CustomerDataModelShort | null>(null);\n const [formFieldsList, setFormFieldsList] = useState<\n AttributesFormModel[] | []\n >([]);\n const [inputChange, setInputChange] = useState<\n Record<string, string | number | boolean>\n >({});\n const [passwordValue, setPasswordValue] = useState('');\n const [createdAt, setCreatedAt] = useState('');\n\n const handleOnBlurPassword = useCallback((event: Event) => {\n const { value } = event?.target as HTMLInputElement;\n\n if (value.length) setErrorPasswordEmpty(false);\n if (!value.length) setErrorPasswordEmpty(true);\n }, []);\n\n const handleSetPassword = useCallback((value: string) => {\n setPasswordValue(value);\n }, []);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const handleShowChangePassword = useCallback(() => {\n setShowChangePassword(true);\n setShowEditForm(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideChangePassword = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowChangePassword(false);\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n setShowChangePassword(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n }, []);\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? translations.accountSuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? translations.accountError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, translations]\n );\n\n const fetchCustomer = useCallback(() => {\n getCustomer().then((customer: CustomerDataModelShort) => {\n const createAccountDate = customer?.createdAt?.split(' ')[0];\n const modifyCustomerData = transformDobCustomer({\n ...customer,\n gender:\n customer.gender === 1\n ? translations.genderMale\n : translations.genderFemale,\n });\n\n setCustomerData(modifyCustomerData);\n setCreatedAt(createAccountDate);\n });\n }, [translations.genderFemale, translations.genderMale]);\n\n useEffect(() => {\n fetchCustomer();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n getAttributesForm('customer_account_edit').then(\n (attributesFormResponse) => {\n setFormFieldsList(attributesFormResponse);\n\n const result: KeysSortOrderProps[] = attributesFormResponse.map(\n ({ name, customUpperCode, orderNumber, label }) => ({\n name: customUpperCode,\n orderNumber,\n label: !defaultAccountAttributePreset.includes(name as string)\n ? label\n : null,\n })\n );\n\n setKeysSortOrder(result);\n }\n );\n }, []);\n\n useEffect(() => {\n if (inputChange['email'] && inputChange['email'] !== customerData?.email) {\n setShowPasswordOnEmailChange(true);\n } else if (\n inputChange['email'] &&\n inputChange['email'] === customerData?.email\n ) {\n setShowPasswordOnEmailChange(false);\n }\n }, [customerData?.email, inputChange]);\n\n const orderedCustomerData = useMemo(() => {\n if (!keysSortOrder || !customerData) return [];\n\n const result = keysSortOrder\n .filter(\n ({ name }) =>\n name !== undefined && (customerData as Record<string, any>)[name]\n )\n .map((item) => {\n return {\n name: item.name,\n orderNumber: item.orderNumber,\n value: (customerData as Record<string, any>)[item.name],\n label: item.label,\n };\n });\n\n return result;\n }, [customerData, keysSortOrder]);\n\n useEffect(() => {\n orderedCustomerData?.length && setLoading(false);\n }, [orderedCustomerData]);\n\n const normalizeFieldsConfig = useMemo(() => {\n return formFieldsList\n ?.map((el) => ({\n ...el,\n defaultValue:\n el?.customUpperCode && customerData\n ? (customerData as Record<string, any>)[el.customUpperCode] ?? ''\n : '',\n }))\n .map((item) => {\n if (item.customUpperCode === 'gender') {\n return {\n ...item,\n defaultValue: item.defaultValue === 'Male' ? 1 : 2,\n };\n }\n\n return item;\n });\n }, [formFieldsList, customerData]);\n\n const handleUpdateCustomerInformation = useCallback(\n async (event: Event, valid: boolean) => {\n const formValues = getFormValues(event.target as HTMLFormElement);\n\n const { email, password, ...props } = formValues;\n\n const passwordEmpty =\n email !== customerData?.email! && password.length === 0;\n\n if (!valid) {\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n }\n return;\n }\n\n setErrorPasswordEmpty(false);\n setSubmitLoading(true);\n\n if (email === customerData?.email!) {\n handleSetPassword('');\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((response) => {\n if (!response) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n\n return;\n }\n\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n setSubmitLoading(false);\n return;\n }\n\n if (email?.length && password?.length) {\n updateCustomerEmail({ email, password })\n .then((customerEmail) => {\n if (!customerEmail) return;\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((responseCustomer) => {\n if (!responseCustomer) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n }\n },\n [customerData, handleSetPassword, fetchCustomer, renderAlertMessage]\n );\n\n return {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n renderAlertMessage,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertProps } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] = useState<InLineAlertProps>(\n {}\n );\n\n const handleSetInLineAlert = useCallback(\n (notification: InLineAlertProps | undefined) => {\n if (!notification?.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlert };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n CardLoader,\n ChangePassword,\n CustomerInformationCard,\n EditCustomerInformation,\n} from '@/account/components';\nimport { useCustomerInformation } from '@/account/hooks/containers/useCustomerInformation';\nimport { useInLineAlert } from '@/account/hooks/useInLineAlert';\nimport { CustomerInformationProps } from '@/account/types';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const CustomerInformation: Container<CustomerInformationProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Account.minifiedView.CustomerInformation.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n } = useCustomerInformation({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"customerInformationLoader\">\n <CardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-customer-information', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'customer-information__title'}\n />\n ) : null}\n <CustomerInformationCard\n createdAt={createdAt}\n slots={slots}\n orderedCustomerData={orderedCustomerData}\n showEditForm={showEditForm}\n showChangePassword={showChangePassword}\n handleShowChangePassword={handleShowChangePassword}\n handleShowEditForm={handleShowEditForm}\n />\n {showChangePassword ? (\n <ChangePassword\n inLineAlertProps={inLineAlertProps}\n handleSetInLineAlert={handleSetInLineAlert}\n handleHideChangePassword={handleHideChangePassword}\n />\n ) : null}\n {showEditForm ? (\n <EditCustomerInformation\n inLineAlertProps={inLineAlertProps}\n submitLoading={submitLoading}\n formFieldsList={normalizeFieldsConfig}\n errorPasswordEmpty={errorPasswordEmpty}\n passwordValue={passwordValue}\n showPasswordOnEmailChange={showPasswordOnEmailChange}\n handleSetPassword={handleSetPassword}\n handleOnBlurPassword={handleOnBlurPassword}\n handleUpdateCustomerInformation={handleUpdateCustomerInformation}\n handleHideEditForm={handleHideEditForm}\n handleInputChange={handleInputChange}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","transformAccount","data","useGetStoreConfigs","passwordConfigs","setPasswordConfigs","useState","useEffect","storeConfigString","cachedStoreConfig","minLength","requiredCharacterClasses","getStoreConfig","response","validationChangePassword","currentPassword","newPassword","confirmPassword","translations","errors","DEFAULT_ERRORS_STATE","arePasswordsEmpty","isNewPasswordMismatch","validationUniqueSymbolsPassword","password","uniqueSymbolsCount","numbers","lowerCaseLetter","upperCaseLetter","specialSymbols","useChangePassword","handleSetInLineAlert","handleHideChangePassword","useText","isClickSubmit","setIsClickSubmit","submitLoading","setSubmitLoading","setCurrentPassword","setNewPassword","setConfirmPassword","passwordErrors","setPasswordErrors","hideChangePassword","useCallback","handleCurrentPasswordChange","value","prev","handleNewPasswordChange","handleConfirmPasswordChange","handleOnBlurPassword","event","name","validatePasswords","isValid","mutationChangePassword","requiredPasswordLength","updateCustomerPassword","result","error","usePasswordValidationMessage","isValidUniqueSymbols","setIsValidUniqueSymbols","defaultLengthMessage","useMemo","defaultMessage","_a","getErrorMessage","isSubmit","ChangePassword","inLineAlertProps","jsxs","Card","jsx","Header","InLineAlert","InputPassword","Button","EditCustomerInformation","errorPasswordEmpty","passwordValue","showPasswordOnEmailChange","formFieldsList","handleHideEditForm","handleUpdateCustomerInformation","handleInputChange","handleSetPassword","Form","CustomerInformationCard","createdAt","slots","orderedCustomerData","showEditForm","showChangePassword","handleShowChangePassword","handleShowEditForm","classes","Slot","Fragment","el","index","transformDobCustomer","customerData","dateOfBirth","rest","ACCOUNT_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","adobeDataLayer","pushEvent","additionalContext","acdl","state","editAccountEvent","eventData","accountData","publishEvents","eventType","eventParams","storeConfigRaw","useCustomerInformation","loading","setLoading","setShowChangePassword","setShowEditForm","setErrorPasswordEmpty","setShowPasswordOnEmailChange","keysSortOrder","setKeysSortOrder","setCustomerData","setFormFieldsList","inputChange","setInputChange","setPasswordValue","setCreatedAt","clearStates","renderAlertMessage","type","message","fetchCustomer","getCustomer","customer","createAccountDate","modifyCustomerData","getAttributesForm","attributesFormResponse","customUpperCode","orderNumber","label","defaultAccountAttributePreset","item","normalizeFieldsConfig","valid","formValues","getFormValues","email","passwordEmpty","updateCustomer","normalizeAttributes","updateCustomerEmail","customerEmail","responseCustomer","iconsList","Success","Warning","Error","useInLineAlert","setInLineAlertProps","notification","icon","CustomerInformation","className","withHeader","CardLoader"],"mappings":"41BACA,MAAMA,GAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GA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,EACA,mBAAA+D,EACA,mBAAAZ,EACA,gCAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,qBAAApC,CAAA,EACEwE,GAAuB,CAAE,qBAAA3F,EAAsB,EAE/C,OAAA4F,EAEAlD,EAAC,OAAI,cAAY,4BACf,WAACsG,GAAW,CAAA,SAAQ,GAAC,CACvB,CAAA,EAIFxG,EAAC,OAAI,UAAWyB,GAAQ,CAAC,+BAAgC6E,CAAS,CAAC,EAChE,SAAA,CACCC,EAAArG,EAACC,EAAA,CACC,MAAOxD,EAAa,eACpB,QAAS,GACT,UAAW,6BAAA,CAAA,EAEX,KACJuD,EAACe,GAAA,CACC,UAAAC,EACA,MAAAC,EACA,oBAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,yBAAAC,EACA,mBAAAC,CAAA,CACF,EACCF,EACCpB,EAACJ,GAAA,CACC,iBAAAC,EACA,qBAAAvC,EACA,yBAAAC,CAAA,CAAA,EAEA,KACH4D,EACCnB,EAACK,GAAA,CACC,iBAAAR,EACA,cAAAlC,EACA,eAAgBqH,EAChB,mBAAA1E,EACA,cAAAC,EACA,0BAAAC,EACA,kBAAAK,EACA,qBAAApC,EACA,gCAAAkC,EACA,mBAAAD,EACA,kBAAAE,CAAA,CAAA,EAEA,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"CustomerInformation.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-account/src/data/transforms/transform-account.ts","/@dropins/storefront-account/src/hooks/containers/useGetStoreConfigs.tsx","/@dropins/storefront-account/src/lib/validationChangePassword.ts","/@dropins/storefront-account/src/lib/validationUniqueSymbolsPassword.ts","/@dropins/storefront-account/src/hooks/components/useChangePassword.tsx","/@dropins/storefront-account/src/hooks/components/usePasswordValidationMessage.tsx","/@dropins/storefront-account/src/components/ChangePassword/ChangePassword.tsx","/@dropins/storefront-account/src/components/EditCustomerInformation/EditCustomerInformation.tsx","/@dropins/storefront-account/src/components/CustomerInformationCard/CustomerInformationCard.tsx","/@dropins/storefront-account/src/lib/transformDobCustomer.ts","/@dropins/storefront-account/src/lib/acdl.ts","/@dropins/storefront-account/src/hooks/containers/useCustomerInformation.tsx","/@dropins/storefront-account/src/hooks/useInLineAlert.tsx","/@dropins/storefront-account/src/containers/CustomerInformation/CustomerInformation.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.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\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.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\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.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\" }), /* @__PURE__ */ React.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\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AccountModel,\n CustomerDataModelShort,\n} from '@/account/data/models/customer';\n\n/**\n * Reference:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n */\nexport const transformAccount = (\n data: CustomerDataModelShort\n): AccountModel => {\n return {\n firstName: data.firstName,\n lastName: data.lastName,\n emailAddress: data?.email || '',\n accountId: data?.email || '',\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfig } from '@/account/api';\nimport { StoreConfigModel } from '@/account/data/models';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport const useGetStoreConfigs = () => {\n const [passwordConfigs, setPasswordConfigs] = useState<{\n minLength: number;\n requiredCharacterClasses: number;\n } | null>(null);\n\n useEffect(() => {\n const storeConfigString = sessionStorage.getItem('accountStoreConfig');\n\n const cachedStoreConfig: StoreConfigModel = storeConfigString\n ? JSON.parse(storeConfigString)\n : null;\n\n if (cachedStoreConfig) {\n const { minLength, requiredCharacterClasses } = cachedStoreConfig;\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n } else {\n getStoreConfig().then((response) => {\n if (response) {\n const { minLength, requiredCharacterClasses } = response;\n\n sessionStorage.setItem(\n 'accountStoreConfig',\n JSON.stringify(response)\n );\n\n setPasswordConfigs({\n minLength,\n requiredCharacterClasses,\n });\n }\n });\n }\n }, []);\n\n return { passwordConfigs };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { DEFAULT_ERRORS_STATE } from '../hooks/components/useChangePassword';\n\ninterface PasswordValidationParams {\n currentPassword: string;\n newPassword: string;\n confirmPassword: string;\n translations: Record<string, string>;\n}\n\ninterface PasswordErrors {\n currentPassword: string;\n newPassword: string;\n confirmPassword: string;\n}\n\nexport const validationChangePassword = ({\n currentPassword,\n newPassword,\n confirmPassword,\n translations,\n}: PasswordValidationParams): { isValid: boolean; errors: PasswordErrors } => {\n let errors: PasswordErrors = { ...DEFAULT_ERRORS_STATE };\n\n const arePasswordsEmpty =\n !currentPassword.length && !newPassword.length && !confirmPassword.length;\n const isNewPasswordMismatch =\n currentPassword.length && newPassword !== confirmPassword;\n\n if (arePasswordsEmpty) {\n errors = {\n ...errors,\n currentPassword: translations.requiredFieldError,\n newPassword: translations.requiredFieldError,\n confirmPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!currentPassword.length) {\n errors = {\n ...errors,\n currentPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!newPassword.length) {\n errors = {\n ...errors,\n newPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (!confirmPassword.length) {\n errors = {\n ...errors,\n confirmPassword: translations.requiredFieldError,\n };\n return { isValid: false, errors };\n }\n\n if (isNewPasswordMismatch) {\n errors = {\n ...errors,\n currentPassword: '',\n newPassword: '',\n confirmPassword: translations.passwordMismatch,\n };\n return { isValid: false, errors };\n }\n\n return { isValid: true, errors };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const validationUniqueSymbolsPassword = (\n password: string,\n uniqueSymbolsCount: number\n) => {\n if (uniqueSymbolsCount <= 1) return true;\n\n const numbers = /[0-9]/.test(password) ? 1 : 0;\n const lowerCaseLetter = /[a-z]/.test(password) ? 1 : 0;\n const upperCaseLetter = /[A-Z]/.test(password) ? 1 : 0;\n const specialSymbols = /[^a-zA-Z0-9\\s]/.test(password) ? 1 : 0;\n\n return (\n numbers + lowerCaseLetter + upperCaseLetter + specialSymbols >=\n uniqueSymbolsCount\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { updateCustomerPassword } from '@/account/api';\nimport { validationChangePassword } from '@/account/lib/validationChangePassword';\nimport { validationUniqueSymbolsPassword } from '@/account/lib/validationUniqueSymbolsPassword';\nimport { UseChangePasswordProps } from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\n\nexport const DEFAULT_ERRORS_STATE = {\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n};\n\nexport const useChangePassword = ({\n passwordConfigs,\n handleSetInLineAlert,\n handleHideChangePassword,\n}: UseChangePasswordProps) => {\n const translations = useText({\n requiredFieldError: 'Account.FormText.requiredFieldError',\n passwordMismatch:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch',\n incorrectCurrentPassword:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword',\n passwordUpdateMessage:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage',\n });\n const [isClickSubmit, setIsClickSubmit] = useState(false);\n const [submitLoading, setSubmitLoading] = useState(false);\n const [currentPassword, setCurrentPassword] = useState('');\n const [newPassword, setNewPassword] = useState('');\n const [confirmPassword, setConfirmPassword] = useState('');\n const [passwordErrors, setPasswordErrors] = useState({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n });\n\n const hideChangePassword = useCallback(() => {\n handleHideChangePassword(() => {\n handleSetInLineAlert({});\n setPasswordErrors(DEFAULT_ERRORS_STATE);\n });\n }, [handleHideChangePassword, handleSetInLineAlert]);\n\n const handleCurrentPasswordChange = useCallback(\n (value: string) => {\n setCurrentPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n currentPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleNewPasswordChange = useCallback(\n (value: string) => {\n setNewPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n newPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleConfirmPasswordChange = useCallback(\n (value: string) => {\n setConfirmPassword(value);\n setPasswordErrors((prev) => ({\n ...prev,\n confirmPassword: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const handleOnBlurPassword = useCallback(\n (event: Event) => {\n const { name, value } = event?.target as HTMLInputElement;\n\n setPasswordErrors((prev) => ({\n ...prev,\n [name]: value ? '' : translations.requiredFieldError,\n }));\n },\n [translations]\n );\n\n const validatePasswords = useCallback(() => {\n const { isValid, errors } = validationChangePassword({\n currentPassword,\n newPassword,\n confirmPassword,\n translations,\n });\n\n setPasswordErrors(errors);\n return isValid;\n }, [currentPassword, newPassword, confirmPassword, translations]);\n\n const mutationChangePassword = useCallback(\n (event: Event) => {\n event.preventDefault();\n\n setSubmitLoading(true);\n\n const requiredCharacterClasses =\n passwordConfigs?.requiredCharacterClasses ?? 0;\n const requiredPasswordLength = passwordConfigs?.minLength ?? 1;\n\n if (!validatePasswords()) {\n setIsClickSubmit(true);\n setSubmitLoading(false);\n return;\n }\n\n if (\n !validationUniqueSymbolsPassword(\n newPassword,\n requiredCharacterClasses\n ) ||\n requiredPasswordLength > newPassword?.length\n ) {\n setIsClickSubmit(true);\n setSubmitLoading(false);\n\n return;\n }\n\n updateCustomerPassword({ currentPassword, newPassword })\n .then((result) => {\n if (!result?.length) {\n setSubmitLoading(false);\n return;\n }\n\n setCurrentPassword('');\n setNewPassword('');\n setConfirmPassword('');\n setPasswordErrors(DEFAULT_ERRORS_STATE);\n setIsClickSubmit(false);\n handleSetInLineAlert({\n type: 'success',\n text: translations.passwordUpdateMessage,\n });\n })\n .catch((error) => {\n if (error.message === 'Invalid login or password.') {\n handleSetInLineAlert({\n type: 'error',\n text: translations.incorrectCurrentPassword,\n });\n }\n\n if (error.message === 'The account is locked.') {\n handleSetInLineAlert({\n type: 'error',\n text: error.message,\n });\n }\n });\n\n setSubmitLoading(false);\n },\n [\n passwordConfigs,\n validatePasswords,\n newPassword,\n currentPassword,\n handleSetInLineAlert,\n translations,\n ]\n );\n\n return {\n hideChangePassword,\n handleOnBlurPassword,\n handleConfirmPasswordChange,\n handleNewPasswordChange,\n handleCurrentPasswordChange,\n mutationChangePassword,\n currentPassword,\n newPassword,\n confirmPassword,\n passwordErrors,\n submitLoading,\n isClickSubmit,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { validationUniqueSymbolsPassword } from '@/account/lib/validationUniqueSymbolsPassword';\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { ValidateLengthConfigProps, statusTypes } from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface UsePasswordValidationMessageProps {\n passwordConfigs: {\n minLength: number;\n requiredCharacterClasses: number;\n } | null;\n isClickSubmit: boolean;\n password: string;\n}\n\nexport const usePasswordValidationMessage = ({\n passwordConfigs,\n isClickSubmit,\n password,\n}: UsePasswordValidationMessageProps) => {\n const translations = useText({\n messageLengthPassword:\n 'Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword',\n });\n\n const [isValidUniqueSymbols, setIsValidUniqueSymbols] =\n useState<statusTypes>('pending');\n\n useEffect(() => {\n if (!passwordConfigs) return;\n\n const result = validationUniqueSymbolsPassword(\n password,\n passwordConfigs.requiredCharacterClasses\n );\n\n if (isClickSubmit && password.length > 0) {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('error');\n } else if (isClickSubmit && password.length === 0) {\n setIsValidUniqueSymbols('pending');\n } else {\n result\n ? setIsValidUniqueSymbols('success')\n : setIsValidUniqueSymbols('pending');\n }\n }, [isClickSubmit, passwordConfigs, password]);\n\n const defaultLengthMessage: ValidateLengthConfigProps | undefined =\n useMemo(() => {\n if (!passwordConfigs) return;\n\n const defaultMessage: ValidateLengthConfigProps = {\n status: 'pending',\n icon: 'pending',\n message: translations.messageLengthPassword?.replace(\n '{minLength}',\n `${passwordConfigs.minLength}`\n ),\n };\n\n if (password.length && password.length >= passwordConfigs.minLength) {\n return { ...defaultMessage, icon: 'success', status: 'success' };\n }\n\n if (password.length && password.length < passwordConfigs.minLength) {\n return isClickSubmit\n ? { ...defaultMessage, icon: 'error', status: 'error' }\n : { ...defaultMessage, icon: 'pending', status: 'pending' };\n }\n\n return defaultMessage;\n }, [\n passwordConfigs,\n translations.messageLengthPassword,\n password?.length,\n isClickSubmit,\n ]);\n\n return { isValidUniqueSymbols, defaultLengthMessage };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport {\n ChangePasswordProps,\n ValidateLengthConfigProps,\n} from '@/account/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n InputPassword,\n} from '@adobe-commerce/elsie/components';\nimport '@/account/components/ChangePassword/ChangePassword.css';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { useChangePassword } from '@/account/hooks/components/useChangePassword';\nimport { usePasswordValidationMessage } from '@/account/hooks/components/usePasswordValidationMessage';\n\nexport const getErrorMessage = (\n isValidUniqueSymbols: string,\n defaultLengthMessage: ValidateLengthConfigProps | undefined,\n isSubmit: boolean,\n newPassword: string,\n passwordErrors: { newPassword: string }\n) => {\n const hasError =\n isValidUniqueSymbols === 'error' ||\n defaultLengthMessage?.status === 'error' ||\n (isSubmit && newPassword.trim().length === 0);\n\n return hasError ? passwordErrors.newPassword : undefined;\n};\n\nexport const ChangePassword: FunctionComponent<ChangePasswordProps> = ({\n handleHideChangePassword,\n handleSetInLineAlert,\n inLineAlertProps,\n}) => {\n const { passwordConfigs } = useGetStoreConfigs();\n\n const {\n hideChangePassword,\n handleOnBlurPassword,\n handleConfirmPasswordChange,\n handleNewPasswordChange,\n handleCurrentPasswordChange,\n mutationChangePassword,\n currentPassword,\n newPassword,\n confirmPassword,\n passwordErrors,\n submitLoading,\n isClickSubmit,\n } = useChangePassword({\n passwordConfigs,\n handleSetInLineAlert,\n handleHideChangePassword,\n });\n\n const { isValidUniqueSymbols, defaultLengthMessage } =\n usePasswordValidationMessage({\n password: newPassword,\n isClickSubmit,\n passwordConfigs,\n });\n\n const translations = useText({\n containerTitle:\n 'Account.minifiedView.CustomerInformation.changePassword.containerTitle',\n currentPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder',\n currentPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel',\n newPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder',\n newPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel',\n confirmPasswordPlaceholder:\n 'Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder',\n confirmPasswordFloatingLabel:\n 'Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel',\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.changePassword.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.changePassword.buttonPrimary',\n });\n\n return (\n <Card className=\"account-change-password\" variant=\"secondary\">\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'account-change-password__title'}\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"account-change-password__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"changePasswordInLineAlert\"\n />\n ) : null}\n <div className=\"account-change-password__fields\">\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"currentPassword\"\n name=\"currentPassword\"\n placeholder={translations.currentPasswordPlaceholder}\n floatingLabel={translations.currentPasswordFloatingLabel}\n errorMessage={passwordErrors.currentPassword}\n defaultValue={currentPassword}\n onValue={handleCurrentPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"newPassword\"\n name=\"newPassword\"\n placeholder={translations.newPasswordPlaceholder}\n floatingLabel={translations.newPasswordFloatingLabel}\n minLength={passwordConfigs?.minLength}\n validateLengthConfig={defaultLengthMessage}\n uniqueSymbolsStatus={isValidUniqueSymbols}\n requiredCharacterClasses={passwordConfigs?.requiredCharacterClasses}\n errorMessage={getErrorMessage(\n isValidUniqueSymbols,\n defaultLengthMessage,\n isClickSubmit,\n newPassword,\n passwordErrors\n )}\n defaultValue={newPassword}\n onValue={handleNewPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n <InputPassword\n className=\"account-change-password__fields-item\"\n autoComplete=\"confirmPassword\"\n name=\"confirmPassword\"\n placeholder={translations.confirmPasswordPlaceholder}\n floatingLabel={translations.confirmPasswordFloatingLabel}\n errorMessage={passwordErrors.confirmPassword}\n defaultValue={confirmPassword}\n onValue={handleConfirmPasswordChange}\n onBlur={handleOnBlurPassword}\n />\n </div>\n\n <div className=\"account-change-password__actions\">\n <Button\n // @ts-ignore\n type=\"button\"\n disabled={submitLoading}\n onClick={hideChangePassword}\n variant=\"secondary\"\n >\n {translations.buttonSecondary}\n </Button>\n <Button\n variant=\"primary\"\n // @ts-ignore\n type=\"button\"\n disabled={submitLoading}\n onClick={mutationChangePassword}\n >\n {translations.buttonPrimary}\n </Button>\n </div>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { EditCustomerInformationProps, FieldsProps } from '@/account/types';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n InputPassword,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Form } from '@/account/components';\nimport '@/account/components/EditCustomerInformation/EditCustomerInformation.css';\n\nexport const EditCustomerInformation: FunctionComponent<\n EditCustomerInformationProps\n> = ({\n inLineAlertProps,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n submitLoading,\n formFieldsList,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n}) => {\n const translations = useText({\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary',\n placeholder:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder',\n floatingLabel:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel',\n containerTitle:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle',\n requiredFieldError: 'Account.FormText.requiredFieldError',\n });\n\n return (\n <Card variant=\"secondary\" className={'account-edit-customer-information'}>\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'account-edit-customer-information__title'}\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"account-edit-customer-information__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"editCustomerInLineAlert\"\n />\n ) : null}\n <Form\n loading={submitLoading}\n fieldsConfig={(formFieldsList as FieldsProps[]) || []}\n name=\"editCustomerInformation\"\n className=\"account-edit-customer-information-form\"\n onSubmit={handleUpdateCustomerInformation}\n setInputChange={handleInputChange}\n >\n {showPasswordOnEmailChange ? (\n <div className=\"account-edit-customer-information__password\">\n <InputPassword\n autoComplete=\"password\"\n name=\"password\"\n placeholder={translations.placeholder}\n floatingLabel={translations.floatingLabel}\n errorMessage={\n errorPasswordEmpty ? translations.requiredFieldError : undefined\n }\n defaultValue={passwordValue}\n onValue={handleSetPassword}\n onBlur={handleOnBlurPassword}\n />\n </div>\n ) : null}\n <div className=\"account-edit-customer-information__actions\">\n <Button\n disabled={submitLoading}\n // @ts-ignore\n type=\"button\"\n variant=\"secondary\"\n onClick={() => handleHideEditForm()}\n >\n {translations.buttonSecondary}\n </Button>\n <Button disabled={submitLoading} type=\"submit\" variant=\"primary\">\n {translations.buttonPrimary}\n </Button>\n </div>\n </Form>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { CustomerInformationCardProps } from '@/account/types';\nimport { Card, Button } from '@adobe-commerce/elsie/components';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/account/components/CustomerInformationCard/CustomerInformationCard.css';\n\nexport const CustomerInformationCard: FunctionComponent<\n CustomerInformationCardProps\n> = ({\n createdAt,\n slots,\n orderedCustomerData,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleShowEditForm,\n}) => {\n const translations = useText({\n buttonSecondary:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary',\n buttonPrimary:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary',\n accountCreation:\n 'Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation',\n });\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'account-customer-information-card',\n [\n 'account-customer-information-card-short',\n showChangePassword || showEditForm,\n ],\n ])}\n >\n <div className=\"account-customer-information-card__wrapper\">\n <div className=\"account-customer-information-card__actions\">\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowChangePassword}\n >\n {translations.buttonSecondary}\n </Button>\n\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowEditForm}\n >\n {translations.buttonPrimary}\n </Button>\n </div>\n <div className=\"account-customer-information-card__content\">\n {slots?.CustomerData ? (\n <Slot\n name=\"CustomerData\"\n slot={slots?.CustomerData}\n context={{ customerData: orderedCustomerData }}\n />\n ) : (\n <>\n {orderedCustomerData?.map((el, index) => {\n const value = !el?.label\n ? el?.value\n : `${el.label}: ${el?.value}`;\n\n return (\n <p\n key={`${el.name}_${index}`}\n data-testid={`${el.name}_${index}`}\n >\n {value}\n </p>\n );\n })}\n <p>\n {translations.accountCreation}: {createdAt}\n </p>\n </>\n )}\n </div>\n </div>\n </Card>\n );\n};\n","import { CustomerDataModelShort } from '@/account/data/models/customer';\n\nexport const transformDobCustomer = (\n customerData: CustomerDataModelShort\n): CustomerDataModelShort | (CustomerDataModelShort & { dob: string }) => {\n if (!customerData?.dateOfBirth) return customerData;\n\n const { dateOfBirth, ...rest } = customerData;\n\n return { ...rest, dob: dateOfBirth } as CustomerDataModelShort & {\n dob: string;\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\n\nenum EventsList {\n EDIT_ACCOUNT_EVENT = 'edit-account',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n EDIT_ACCOUNT_EVENT: EventsList.EDIT_ACCOUNT_EVENT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction editAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.EDIT_ACCOUNT_EVENT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('accountStoreConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n const eventData = { ...storeConfig, ...eventParams };\n\n switch (eventType) {\n case EventsList.EDIT_ACCOUNT_EVENT:\n editAccountEvent(eventData);\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport {\n getAttributesForm,\n getCustomer,\n updateCustomerEmail,\n updateCustomer,\n} from '@/account/api';\nimport {\n KeysSortOrderProps,\n UseCustomerInformationProps,\n} from '@/account/types';\nimport { defaultAccountAttributePreset } from '@/account/configs/defaultAttributePreset.config';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { getFormValues } from '@/account/lib/getFormValues';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { normalizeAttributes } from '@/account/lib/normalizeAttributes';\nimport { transformDobCustomer } from '@/account/lib/transformDobCustomer';\nimport { EventsList, publishEvents } from '@/account/lib/acdl';\n\nexport const useCustomerInformation = ({\n handleSetInLineAlert,\n}: UseCustomerInformationProps) => {\n const translations = useText({\n accountSuccess:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess',\n accountError:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountError',\n genderMale: 'Account.minifiedView.CustomerInformation.genderMale',\n genderFemale: 'Account.minifiedView.CustomerInformation.genderFemale',\n });\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showChangePassword, setShowChangePassword] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [errorPasswordEmpty, setErrorPasswordEmpty] = useState(false);\n const [showPasswordOnEmailChange, setShowPasswordOnEmailChange] =\n useState(false);\n const [keysSortOrder, setKeysSortOrder] = useState<KeysSortOrderProps[] | []>(\n []\n );\n const [customerData, setCustomerData] =\n useState<CustomerDataModelShort | null>(null);\n const [formFieldsList, setFormFieldsList] = useState<\n AttributesFormModel[] | []\n >([]);\n const [inputChange, setInputChange] = useState<\n Record<string, string | number | boolean>\n >({});\n const [passwordValue, setPasswordValue] = useState('');\n const [createdAt, setCreatedAt] = useState('');\n\n const handleOnBlurPassword = useCallback((event: Event) => {\n const { value } = event?.target as HTMLInputElement;\n\n if (value.length) setErrorPasswordEmpty(false);\n if (!value.length) setErrorPasswordEmpty(true);\n }, []);\n\n const handleSetPassword = useCallback((value: string) => {\n setPasswordValue(value);\n }, []);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const handleShowChangePassword = useCallback(() => {\n setShowChangePassword(true);\n setShowEditForm(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideChangePassword = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowChangePassword(false);\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n setShowChangePassword(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n }, []);\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? translations.accountSuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? translations.accountError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, translations]\n );\n\n const fetchCustomer = useCallback(() => {\n getCustomer().then((customer: CustomerDataModelShort) => {\n const createAccountDate = customer?.createdAt?.split(' ')[0];\n const modifyCustomerData = transformDobCustomer({\n ...customer,\n gender:\n customer.gender === 1\n ? translations.genderMale\n : translations.genderFemale,\n });\n\n setCustomerData(modifyCustomerData);\n setCreatedAt(createAccountDate);\n });\n }, [translations.genderFemale, translations.genderMale]);\n\n useEffect(() => {\n fetchCustomer();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n getAttributesForm('customer_account_edit').then(\n (attributesFormResponse) => {\n setFormFieldsList(attributesFormResponse);\n\n const result: KeysSortOrderProps[] = attributesFormResponse.map(\n ({ name, customUpperCode, orderNumber, label }) => ({\n name: customUpperCode,\n orderNumber,\n label: !defaultAccountAttributePreset.includes(name as string)\n ? label\n : null,\n })\n );\n\n setKeysSortOrder(result);\n }\n );\n }, []);\n\n useEffect(() => {\n if (inputChange['email'] && inputChange['email'] !== customerData?.email) {\n setShowPasswordOnEmailChange(true);\n } else if (\n inputChange['email'] &&\n inputChange['email'] === customerData?.email\n ) {\n setShowPasswordOnEmailChange(false);\n }\n }, [customerData?.email, inputChange]);\n\n const orderedCustomerData = useMemo(() => {\n if (!keysSortOrder || !customerData) return [];\n\n const result = keysSortOrder\n .filter(\n ({ name }) =>\n name !== undefined && (customerData as Record<string, any>)[name]\n )\n .map((item) => {\n return {\n name: item.name,\n orderNumber: item.orderNumber,\n value: (customerData as Record<string, any>)[item.name],\n label: item.label,\n };\n });\n\n return result;\n }, [customerData, keysSortOrder]);\n\n useEffect(() => {\n orderedCustomerData?.length && setLoading(false);\n }, [orderedCustomerData]);\n\n const normalizeFieldsConfig = useMemo(() => {\n return formFieldsList\n ?.map((el) => ({\n ...el,\n defaultValue:\n el?.customUpperCode && customerData\n ? (customerData as Record<string, any>)[el.customUpperCode] ?? ''\n : '',\n }))\n .map((item) => {\n if (item.customUpperCode === 'gender') {\n return {\n ...item,\n defaultValue: item.defaultValue === 'Male' ? 1 : 2,\n };\n }\n\n return item;\n });\n }, [formFieldsList, customerData]);\n\n const handleUpdateCustomerInformation = useCallback(\n async (event: Event, valid: boolean) => {\n const formValues = getFormValues(event.target as HTMLFormElement);\n\n const { email, password, ...props } = formValues;\n\n const passwordEmpty =\n email !== customerData?.email! && password.length === 0;\n\n if (!valid) {\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n }\n return;\n }\n\n setErrorPasswordEmpty(false);\n setSubmitLoading(true);\n\n if (email === customerData?.email!) {\n handleSetPassword('');\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((response) => {\n if (!response) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n\n return;\n }\n\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n setSubmitLoading(false);\n return;\n }\n\n if (email?.length && password?.length) {\n updateCustomerEmail({ email, password })\n .then((customerEmail) => {\n if (!customerEmail) return;\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((responseCustomer) => {\n if (!responseCustomer) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n }\n },\n [customerData, handleSetPassword, fetchCustomer, renderAlertMessage]\n );\n\n return {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n renderAlertMessage,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertProps } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] = useState<InLineAlertProps>(\n {}\n );\n\n const handleSetInLineAlert = useCallback(\n (notification: InLineAlertProps | undefined) => {\n if (!notification?.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlert };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n CardLoader,\n ChangePassword,\n CustomerInformationCard,\n EditCustomerInformation,\n} from '@/account/components';\nimport { useCustomerInformation } from '@/account/hooks/containers/useCustomerInformation';\nimport { useInLineAlert } from '@/account/hooks/useInLineAlert';\nimport { CustomerInformationProps } from '@/account/types';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const CustomerInformation: Container<CustomerInformationProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Account.minifiedView.CustomerInformation.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n } = useCustomerInformation({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"customerInformationLoader\">\n <CardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-customer-information', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'customer-information__title'}\n />\n ) : null}\n <CustomerInformationCard\n createdAt={createdAt}\n slots={slots}\n orderedCustomerData={orderedCustomerData}\n showEditForm={showEditForm}\n showChangePassword={showChangePassword}\n handleShowChangePassword={handleShowChangePassword}\n handleShowEditForm={handleShowEditForm}\n />\n {showChangePassword ? (\n <ChangePassword\n inLineAlertProps={inLineAlertProps}\n handleSetInLineAlert={handleSetInLineAlert}\n handleHideChangePassword={handleHideChangePassword}\n />\n ) : null}\n {showEditForm ? (\n <EditCustomerInformation\n inLineAlertProps={inLineAlertProps}\n submitLoading={submitLoading}\n formFieldsList={normalizeFieldsConfig}\n errorPasswordEmpty={errorPasswordEmpty}\n passwordValue={passwordValue}\n showPasswordOnEmailChange={showPasswordOnEmailChange}\n handleSetPassword={handleSetPassword}\n handleOnBlurPassword={handleOnBlurPassword}\n handleUpdateCustomerInformation={handleUpdateCustomerInformation}\n handleHideEditForm={handleHideEditForm}\n handleInputChange={handleInputChange}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","transformAccount","data","useGetStoreConfigs","passwordConfigs","setPasswordConfigs","useState","useEffect","storeConfigString","cachedStoreConfig","minLength","requiredCharacterClasses","getStoreConfig","response","validationChangePassword","currentPassword","newPassword","confirmPassword","translations","errors","DEFAULT_ERRORS_STATE","arePasswordsEmpty","isNewPasswordMismatch","validationUniqueSymbolsPassword","password","uniqueSymbolsCount","numbers","lowerCaseLetter","upperCaseLetter","specialSymbols","useChangePassword","handleSetInLineAlert","handleHideChangePassword","useText","isClickSubmit","setIsClickSubmit","submitLoading","setSubmitLoading","setCurrentPassword","setNewPassword","setConfirmPassword","passwordErrors","setPasswordErrors","hideChangePassword","useCallback","handleCurrentPasswordChange","value","prev","handleNewPasswordChange","handleConfirmPasswordChange","handleOnBlurPassword","event","name","validatePasswords","isValid","mutationChangePassword","requiredPasswordLength","updateCustomerPassword","result","error","usePasswordValidationMessage","isValidUniqueSymbols","setIsValidUniqueSymbols","defaultLengthMessage","useMemo","defaultMessage","_a","getErrorMessage","isSubmit","ChangePassword","inLineAlertProps","jsxs","Card","jsx","Header","InLineAlert","InputPassword","Button","EditCustomerInformation","errorPasswordEmpty","passwordValue","showPasswordOnEmailChange","formFieldsList","handleHideEditForm","handleUpdateCustomerInformation","handleInputChange","handleSetPassword","Form","CustomerInformationCard","createdAt","slots","orderedCustomerData","showEditForm","showChangePassword","handleShowChangePassword","handleShowEditForm","classes","Slot","Fragment","el","index","transformDobCustomer","customerData","dateOfBirth","rest","ACCOUNT_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","adobeDataLayer","pushEvent","additionalContext","acdl","state","editAccountEvent","eventData","accountData","publishEvents","eventType","eventParams","storeConfigRaw","useCustomerInformation","loading","setLoading","setShowChangePassword","setShowEditForm","setErrorPasswordEmpty","setShowPasswordOnEmailChange","keysSortOrder","setKeysSortOrder","setCustomerData","setFormFieldsList","inputChange","setInputChange","setPasswordValue","setCreatedAt","clearStates","renderAlertMessage","type","message","fetchCustomer","getCustomer","customer","createAccountDate","modifyCustomerData","getAttributesForm","attributesFormResponse","customUpperCode","orderNumber","label","defaultAccountAttributePreset","item","normalizeFieldsConfig","valid","formValues","getFormValues","email","passwordEmpty","updateCustomer","normalizeAttributes","updateCustomerEmail","customerEmail","responseCustomer","iconsList","Success","Warning","Error","useInLineAlert","setInLineAlertProps","notification","icon","CustomerInformation","className","withHeader","CardLoader"],"mappings":"s1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V,EACA,cAAAC,EACA,0BAAAC,EACA,oBAAAU,EACA,QAAAgC,EACA,sBAAA8B,EACA,cAAArH,EACA,aAAAwD,EACA,mBAAAC,EACA,yBAAAC,EACA,yBAAA9D,EACA,mBAAA+D,EACA,mBAAAZ,EACA,gCAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,qBAAApC,CAAA,EACEwE,GAAuB,CAAE,qBAAA3F,EAAsB,EAE/C,OAAA4F,EAEAlD,EAAC,OAAI,cAAY,4BACf,WAACsG,GAAW,CAAA,SAAQ,GAAC,CACvB,CAAA,EAIFxG,EAAC,OAAI,UAAWyB,GAAQ,CAAC,+BAAgC6E,CAAS,CAAC,EAChE,SAAA,CACCC,EAAArG,EAACC,EAAA,CACC,MAAOxD,EAAa,eACpB,QAAS,GACT,UAAW,6BAAA,CAAA,EAEX,KACJuD,EAACe,GAAA,CACC,UAAAC,EACA,MAAAC,EACA,oBAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,yBAAAC,EACA,mBAAAC,CAAA,CACF,EACCF,EACCpB,EAACJ,GAAA,CACC,iBAAAC,EACA,qBAAAvC,EACA,yBAAAC,CAAA,CAAA,EAEA,KACH4D,EACCnB,EAACK,GAAA,CACC,iBAAAR,EACA,cAAAlC,EACA,eAAgBqH,EAChB,mBAAA1E,EACA,cAAAC,EACA,0BAAAC,EACA,kBAAAK,EACA,qBAAApC,EACA,gCAAAkC,EACA,mBAAAD,EACA,kBAAAE,CAAA,CAAA,EAEA,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2]}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t,jsxs as l,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k,Slot as m}from"@dropins/tools/lib.js";import{S as B,c as j,E as Q,C as R}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import{Card as G,Icon as F,Image as J,Price as X,ContentGrid as Z,Header as rr,Picker as tr,Pagination as er}from"@dropins/tools/components.js";import{useText as H}from"@dropins/tools/i18n.js";import{useState as y,useEffect as E,useMemo as U,useCallback as K}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as ar}from"../chunks/getOrderHistoryList.js";import{g as sr}from"../chunks/getStoreConfig.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";import"../fragments.js";const V={size:"32",stroke:"2"},W=({minifiedView:n,orderNumber:c,orderToken:r,routeOrdersList:a,routeOrderDetails:u})=>{const s=n?"minifiedView":"fullSizeView",i=H({viewAllOrdersButton:`Account.${s}.OrdersList.viewAllOrdersButton`,ariaLabelLink:`Account.${s}.OrdersList.ariaLabelLink`});return a?t("a",{className:k(["account-orders-list-action",["account-orders-list-action--minifiedView",n]]),"data-testid":"ordersListActionButtonMinifiedView",href:a(),children:t(G,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:l("div",{className:"account-orders-list-action__card-wrapper",children:[t("p",{children:i.viewAllOrdersButton}),t(F,{source:B,...V})]})})}):t("a",{"aria-label":`${i.ariaLabelLink} ${c??r}`,href:j(u)?u(c,r):"#",className:"account-orders-list-action","data-testid":"ordersListActionButton",children:t(F,{source:B,...V})})},nr=()=>{const[n,c]=y(window.innerWidth<768);return E(()=>{const r=()=>{c(window.innerWidth<768)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),n},cr=({placeholderImage:n,minifiedView:c,item:r,withThumbnails:a,children:u,slots:s,routeTracking:i,routeOrderProduct:g,routeReturnDetails:f,...b})=>{var M,w,P,N,z,T,O,Y,_,D,v,C;const o=c?"minifiedView":"fullSizeView",h=H({orderNumber:`Account.${o}.OrdersList.OrdersListCard.orderNumber`,itemsAmount:`Account.${o}.OrdersList.OrdersListCard.itemsAmount`,carrier:`Account.${o}.OrdersList.OrdersListCard.carrier`,returnsText:`Account.${o}.OrdersList.OrdersListCard.returns`,deliveryDateText:`Account.${o}.OrdersList.OrdersListCard.orderDate`}),d=nr(),S=j(g),L=U(()=>((r==null?void 0:r.items)??[]).map((e,p)=>{var $,q;const A={title:(e==null?void 0:e.productName)??"",src:((q=($=e==null?void 0:e.product)==null?void 0:$.smallImage)==null?void 0:q.url)||n,alt:(e==null?void 0:e.productName)??"",width:65,height:65,loading:"eager"};return t(m,{name:"OrderItemImage",slot:s==null?void 0:s.OrderItemImage,context:{data:e,defaultImageProps:A},children:S?t("a",{href:(g==null?void 0:g(e))??"",target:"_blank",rel:"noreferrer",children:t(J,{...A})}):t(J,{...A})},`${p}_${e.id}`)}),[S,r.items,n,g,s==null?void 0:s.OrderItemImage]);return l(G,{variant:"secondary",...b,className:k(["account-orders-list-card",["account-orders-list-card--full",((M=r==null?void 0:r.items)==null?void 0:M.length)>6]]),children:[t("div",{className:"account-orders-list-card__content",children:s!=null&&s.OrdersListCard?t(m,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:s==null?void 0:s.OrdersListCard,context:{orderHistoryListItem:r}}):l(x,{children:[t("div",{children:r==null?void 0:r.status}),l("p",{children:[h.deliveryDateText," ",r==null?void 0:r.orderDate]}),l("p",{children:[h.orderNumber," ",r.number]}),(w=r==null?void 0:r.shipments)==null?void 0:w.map(e=>{var p;return(p=e==null?void 0:e.tracking)==null?void 0:p.map(A=>{const $=i==null?void 0:i(A);return l("p",{"data-testid":A.number,children:[t("span",{children:`${h.carrier} ${A.carrier.toLocaleUpperCase()} `}),$?t("a",{href:$,target:"_blank",className:"account-orders-list-card__content--track_number",rel:"noreferrer",children:A.number}):t("span",{className:"account-orders-list-card__content--track_number",children:A.number})]},e.id)})}),r!=null&&r.returns&&((P=r.returns)!=null&&P.length)?l("p",{"data-testid":r.number,children:[l("span",{children:[h.returnsText," "]}),(N=r==null?void 0:r.returns)==null?void 0:N.map(e=>t("span",{"data-testid":e.number,children:l("a",{href:(f==null?void 0:f({orderNumber:r.number,orderToken:r.token,returnNumber:e.number}))??"#",className:"account-orders-list-card__content--return_number",children:[e.number," "]})},e.uid))]},r.id):null,t("p",{children:t(X,{amount:((T=(z=r==null?void 0:r.total)==null?void 0:z.grandTotal)==null?void 0:T.value)??0,currency:(Y=(O=r==null?void 0:r.total)==null?void 0:O.grandTotal)==null?void 0:Y.currency,weight:"normal",size:"medium"})}),l("p",{"data-testid":"itemsAmount",children:[(_=r==null?void 0:r.items)!=null&&_.length?(D=r==null?void 0:r.items)==null?void 0:D.reduce((e,p)=>{const A=(p==null?void 0:p.quantityOrdered)||0;return e+A},0):0," ",h.itemsAmount]}),(v=r==null?void 0:r.items)==null?void 0:v.map((e,p)=>{if(p>=0&&p<10)return l("p",{className:"account-orders-list-card__content--product-name",children:[l("span",{className:"account-orders-list-card__content--quantity",children:[(e==null?void 0:e.quantityOrdered)>1?e==null?void 0:e.quantityOrdered:null," "]}),e==null?void 0:e.productName.replaceAll("-"," ")]},`${p}_${e.id}`);if(p===11)return t("p",{children:"..."},"ellipsis")})]})}),a&&((C=r==null?void 0:r.items)!=null&&C.length)?t(Z,{maxColumns:d?3:9,emptyGridContent:t(x,{}),className:k(["account-orders-list-card__images",["account-orders-list-card__images-3",d]]),"data-testid":"ordersListCardImages",children:L}):null,t("div",{className:"account-orders-list-card__actions",children:u})]})},or=({ordersInMinifiedView:n,minifiedView:c,pageSize:r,selectedDate:a,selectedPage:u,handleSetFirstOrderDate:s})=>{const[i,g]=y([]),[f,b]=y({totalPages:1,currentPage:1,pageSize:1}),[o,h]=y(!1),[d,S]=y("");return E(()=>{sr().then(L=>{S(L.baseMediaUrl)})},[]),E(()=>{h(!0),ar(c?n:r,a,u).then(L=>{!L||!L.items||(b(L.pageInfo),g(L.items),s==null||s(L.dateOfFirstOrder))}).finally(()=>{h(!1)})},[s,c,n,r,a,u]),{loading:o,orderHistoryListItems:i,pageInfo:f,placeholderImage:d}},I=(n,c=1)=>{const r=new Date,a=new Date(r);switch(n){case"sixMonthsAgo":{a.setMonth(a.getMonth()-c);break}case"oneYearAgo":{a.setFullYear(a.getFullYear()-c);break}default:return""}return{from:a==null?void 0:a.toISOString().split("T")[0],to:`${r==null?void 0:r.toISOString().split("T")[0]} 23:59:59`}},dr=n=>{const c=[],r=new Date().getFullYear();for(let a=n;a<=r-1;a++)c.push({value:`{"from":"${a}-01-01","to":"${a+1}-01-01 23:59:59"}`,text:a.toString()});return c},ir=()=>{const n=H({pastSixMonths:"Account.fullSizeView.OrdersList.OrdersListSelectDate.pastSixMonths",currentYear:"Account.fullSizeView.OrdersList.OrdersListSelectDate.currentYear",viewAll:"Account.fullSizeView.OrdersList.OrdersListSelectDate.viewAll"}),[c,r]=y(),[a,u]=y(JSON.stringify(I("sixMonthsAgo",6))),[s,i]=y(1);E(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[s]);const g=U(()=>{const o=[{value:JSON.stringify(I("sixMonthsAgo",6)),text:n.pastSixMonths},{value:JSON.stringify(I("oneYearAgo",1)),text:n.currentYear},{value:"viewAll",text:n.viewAll}];if(c){const d=new Date(c).getFullYear();o==null||o.splice(2,0,...dr(d))}return o},[n,c]),f=K(o=>{r(o)},[]),b=K(o=>{const d=o.target.value;u(d),i(1)},[]);return{selectableDateList:g,selectedDate:a,selectedPage:s,handleSelectDate:b,setSelectedPage:i,handleSetFirstOrderDate:f}},lr=({className:n,withHeader:c=!0,minifiedView:r=!1,withThumbnails:a=!0,withFilter:u=!0,ordersInMinifiedView:s=1,pageSize:i=10,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>{const S=r?"minifiedView":"fullSizeView",L=H({containerTitle:`Account.${S}.OrdersList.containerTitle`,dateOrderPlaced:`Account.${S}.OrdersList.dateOrderPlaced`}),{selectableDateList:M,selectedDate:w,handleSelectDate:P,selectedPage:N,setSelectedPage:z,handleSetFirstOrderDate:T}=ir(),{pageInfo:O,loading:Y,orderHistoryListItems:_,placeholderImage:D}=or({minifiedView:r,pageSize:i,ordersInMinifiedView:s,selectedDate:w,selectedPage:N,handleSetFirstOrderDate:T});return l("div",{children:[c?t(rr,{"aria-label":L.containerTitle,role:"region",title:L.containerTitle,divider:!r,className:r?"account-orders-list-header":""}):null,l("div",{className:k(["account-orders-list",n]),children:[!r&&u?l("div",{className:"account-orders-list__date-select",children:[t("span",{children:L.dateOrderPlaced}),t(tr,{value:w,name:"orderDatePicker",options:M,handleSelect:P})]}):null,Y?t(x,{children:Array.from(Array(O==null?void 0:O.pageSize).keys()).map(v=>t(R,{testId:"orderSkeletonLoader",withCard:!1},v))}):t(x,{children:_.length?t(x,{children:_.map((v,C)=>t(cr,{placeholderImage:D,routeTracking:o,routeOrderProduct:h,routeReturnDetails:b,minifiedView:r,item:v,withThumbnails:a,slots:d,children:d!=null&&d.OrdersListAction?t(m,{"data-testid":`ordersListActionSlot_${C}`,name:"OrdersListAction",slot:d==null?void 0:d.OrdersListAction,context:{orderHistoryListItem:v}}):t(W,{minifiedView:r,orderNumber:v.number,orderToken:v.token,routeOrderDetails:f})},C))}):t(Q,{isEmpty:!_.length,typeList:"orders",minifiedView:r})}),!r&&(O==null?void 0:O.totalPages)>1?t(er,{totalPages:O==null?void 0:O.totalPages,currentPage:N,onChange:z}):null,r?t(W,{minifiedView:r,routeOrdersList:g}):null]})]})},Nr=({className:n,withHeader:c,minifiedView:r,withThumbnails:a,withFilter:u,ordersInMinifiedView:s,pageSize:i,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>t("div",{className:k(["account-orders-list",n]),"data-testid":"ordersListId",children:t(lr,{className:n,withHeader:c,minifiedView:r,withThumbnails:a,withFilter:u,ordersInMinifiedView:s,pageSize:i,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})});export{Nr as OrdersList,Nr as default};
3
+ import{jsx as t,jsxs as l,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k,Slot as m}from"@dropins/tools/lib.js";import{S as B,c as j,E as Q,C as R}from"../chunks/AddressValidation.js";import"@dropins/tools/preact-compat.js";import{Card as G,Icon as F,Image as J,Price as X,ContentGrid as Z,Header as rr,Picker as tr,Pagination as er}from"@dropins/tools/components.js";import{useText as H}from"@dropins/tools/i18n.js";import{useState as y,useEffect as E,useMemo as U,useCallback as K}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as ar}from"../chunks/getOrderHistoryList.js";import{g as sr}from"../chunks/getStoreConfig.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";import"../fragments.js";const V={size:"32",stroke:"2"},W=({minifiedView:n,orderNumber:c,orderToken:r,routeOrdersList:a,routeOrderDetails:u})=>{const s=n?"minifiedView":"fullSizeView",i=H({viewAllOrdersButton:`Account.${s}.OrdersList.viewAllOrdersButton`,ariaLabelLink:`Account.${s}.OrdersList.ariaLabelLink`});return a?t("a",{className:k(["account-orders-list-action",["account-orders-list-action--minifiedView",n]]),"data-testid":"ordersListActionButtonMinifiedView",href:a(),children:t(G,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:l("div",{className:"account-orders-list-action__card-wrapper",children:[t("p",{children:i.viewAllOrdersButton}),t(F,{source:B,...V})]})})}):t("a",{"aria-label":`${i.ariaLabelLink} ${c??r}`,href:j(u)?u(c,r):"#",className:"account-orders-list-action","data-testid":"ordersListActionButton",children:t(F,{source:B,...V})})},nr=()=>{const[n,c]=y(window.innerWidth<768);return E(()=>{const r=()=>{c(window.innerWidth<768)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),n},cr=({placeholderImage:n,minifiedView:c,item:r,withThumbnails:a,children:u,slots:s,routeTracking:i,routeOrderProduct:g,routeReturnDetails:f,...b})=>{var M,w,P,N,z,T,O,Y,_,D,v,C;const o=c?"minifiedView":"fullSizeView",h=H({orderNumber:`Account.${o}.OrdersList.OrdersListCard.orderNumber`,itemsAmount:`Account.${o}.OrdersList.OrdersListCard.itemsAmount`,carrier:`Account.${o}.OrdersList.OrdersListCard.carrier`,returnsText:`Account.${o}.OrdersList.OrdersListCard.returns`,deliveryDateText:`Account.${o}.OrdersList.OrdersListCard.orderDate`}),d=nr(),S=j(g),L=U(()=>((r==null?void 0:r.items)??[]).map((e,p)=>{var $,q;const A={title:(e==null?void 0:e.productName)??"",src:((q=($=e==null?void 0:e.product)==null?void 0:$.smallImage)==null?void 0:q.url)||n,alt:(e==null?void 0:e.productName)??"",width:65,height:65,loading:"eager"};return t(m,{name:"OrderItemImage",slot:s==null?void 0:s.OrderItemImage,context:{data:e,defaultImageProps:A},children:S?t("a",{href:(g==null?void 0:g(e))??"",target:"_blank",rel:"noreferrer",children:t(J,{...A})}):t(J,{...A})},`${p}_${e.id}`)}),[S,r.items,n,g,s==null?void 0:s.OrderItemImage]);return l(G,{variant:"secondary",...b,className:k(["account-orders-list-card",["account-orders-list-card--full",((M=r==null?void 0:r.items)==null?void 0:M.length)>6]]),children:[t("div",{className:"account-orders-list-card__content",children:s!=null&&s.OrdersListCard?t(m,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:s==null?void 0:s.OrdersListCard,context:{orderHistoryListItem:r}}):l(x,{children:[t("div",{children:r==null?void 0:r.status}),l("p",{children:[h.deliveryDateText," ",r==null?void 0:r.orderDate]}),l("p",{children:[h.orderNumber," ",r.number]}),(w=r==null?void 0:r.shipments)==null?void 0:w.map(e=>{var p;return(p=e==null?void 0:e.tracking)==null?void 0:p.map(A=>{const $=i==null?void 0:i(A);return l("p",{"data-testid":A.number,children:[t("span",{children:`${h.carrier} ${A.carrier.toLocaleUpperCase()} `}),$?t("a",{href:$,target:"_blank",className:"account-orders-list-card__content--track_number",rel:"noreferrer",children:A.number}):t("span",{className:"account-orders-list-card__content--track_number",children:A.number})]},e.id)})}),r!=null&&r.returns&&((P=r.returns)!=null&&P.length)?l("p",{"data-testid":r.number,children:[l("span",{children:[h.returnsText," "]}),(N=r==null?void 0:r.returns)==null?void 0:N.map(e=>t("span",{"data-testid":e.number,children:l("a",{href:(f==null?void 0:f({orderNumber:r.number,orderToken:r.token,returnNumber:e.number}))??"#",className:"account-orders-list-card__content--return_number",children:[e.number," "]})},e.uid))]},r.id):null,t("p",{children:t(X,{amount:((T=(z=r==null?void 0:r.total)==null?void 0:z.grandTotal)==null?void 0:T.value)??0,currency:(Y=(O=r==null?void 0:r.total)==null?void 0:O.grandTotal)==null?void 0:Y.currency,weight:"normal",size:"medium"})}),l("p",{"data-testid":"itemsAmount",children:[(_=r==null?void 0:r.items)!=null&&_.length?(D=r==null?void 0:r.items)==null?void 0:D.reduce((e,p)=>{const A=(p==null?void 0:p.quantityOrdered)||0;return e+A},0):0," ",h.itemsAmount]}),(v=r==null?void 0:r.items)==null?void 0:v.map((e,p)=>{if(p>=0&&p<10)return l("p",{className:"account-orders-list-card__content--product-name",children:[l("span",{className:"account-orders-list-card__content--quantity",children:[(e==null?void 0:e.quantityOrdered)>1?e==null?void 0:e.quantityOrdered:null," "]}),e==null?void 0:e.productName.replaceAll("-"," ")]},`${p}_${e.id}`);if(p===11)return t("p",{children:"..."},"ellipsis")})]})}),a&&((C=r==null?void 0:r.items)!=null&&C.length)?t(Z,{maxColumns:d?3:9,emptyGridContent:t(x,{}),className:k(["account-orders-list-card__images",["account-orders-list-card__images-3",d]]),"data-testid":"ordersListCardImages",children:L}):null,t("div",{className:"account-orders-list-card__actions",children:u})]})},or=({ordersInMinifiedView:n,minifiedView:c,pageSize:r,selectedDate:a,selectedPage:u,handleSetFirstOrderDate:s})=>{const[i,g]=y([]),[f,b]=y({totalPages:1,currentPage:1,pageSize:1}),[o,h]=y(!1),[d,S]=y("");return E(()=>{sr().then(L=>{S(L.baseMediaUrl)})},[]),E(()=>{h(!0),ar(c?n:r,a,u).then(L=>{!L||!L.items||(b(L.pageInfo),g(L.items),s==null||s(L.dateOfFirstOrder))}).finally(()=>{h(!1)})},[s,c,n,r,a,u]),{loading:o,orderHistoryListItems:i,pageInfo:f,placeholderImage:d}},I=(n,c=1)=>{const r=new Date,a=new Date(r);switch(n){case"sixMonthsAgo":{a.setMonth(a.getMonth()-c);break}case"oneYearAgo":{a.setFullYear(a.getFullYear()-c);break}default:return""}return{from:a==null?void 0:a.toISOString().split("T")[0],to:`${r==null?void 0:r.toISOString().split("T")[0]} 23:59:59`}},dr=n=>{const c=[],r=new Date().getFullYear();for(let a=n;a<=r-1;a++)c.push({value:`{"from":"${a}-01-01","to":"${a+1}-01-01 23:59:59"}`,text:a.toString()});return c},ir=()=>{const n=H({pastSixMonths:"Account.fullSizeView.OrdersList.OrdersListSelectDate.pastSixMonths",currentYear:"Account.fullSizeView.OrdersList.OrdersListSelectDate.currentYear",viewAll:"Account.fullSizeView.OrdersList.OrdersListSelectDate.viewAll"}),[c,r]=y(),[a,u]=y(JSON.stringify(I("sixMonthsAgo",6))),[s,i]=y(1);E(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[s]);const g=U(()=>{const o=[{value:JSON.stringify(I("sixMonthsAgo",6)),text:n.pastSixMonths},{value:JSON.stringify(I("oneYearAgo",1)),text:n.currentYear},{value:"viewAll",text:n.viewAll}];if(c){const d=new Date(c).getFullYear();o==null||o.splice(2,0,...dr(d))}return o},[n,c]),f=K(o=>{r(o)},[]),b=K(o=>{const d=o.target.value;u(d),i(1)},[]);return{selectableDateList:g,selectedDate:a,selectedPage:s,handleSelectDate:b,setSelectedPage:i,handleSetFirstOrderDate:f}},lr=({className:n,withHeader:c=!0,minifiedView:r=!1,withThumbnails:a=!0,withFilter:u=!0,ordersInMinifiedView:s=1,pageSize:i=10,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>{const S=r?"minifiedView":"fullSizeView",L=H({containerTitle:`Account.${S}.OrdersList.containerTitle`,dateOrderPlaced:`Account.${S}.OrdersList.dateOrderPlaced`}),{selectableDateList:M,selectedDate:w,handleSelectDate:P,selectedPage:N,setSelectedPage:z,handleSetFirstOrderDate:T}=ir(),{pageInfo:O,loading:Y,orderHistoryListItems:_,placeholderImage:D}=or({minifiedView:r,pageSize:i,ordersInMinifiedView:s,selectedDate:w,selectedPage:N,handleSetFirstOrderDate:T});return l("div",{children:[c?t(rr,{"aria-label":L.containerTitle,role:"region",title:L.containerTitle,divider:!r,className:r?"account-orders-list-header":""}):null,l("div",{className:k(["account-orders-list",n]),children:[!r&&u?l("div",{className:"account-orders-list__date-select",children:[t("span",{children:L.dateOrderPlaced}),t(tr,{value:w,name:"orderDatePicker",options:M,handleSelect:P})]}):null,Y?t(x,{children:Array.from(Array(O==null?void 0:O.pageSize).keys()).map(v=>t(R,{testId:"orderSkeletonLoader",withCard:!1},v))}):t(x,{children:_.length?t(x,{children:_.map((v,C)=>t(cr,{placeholderImage:D,routeTracking:o,routeOrderProduct:h,routeReturnDetails:b,minifiedView:r,item:v,withThumbnails:a,slots:d,children:d!=null&&d.OrdersListAction?t(m,{"data-testid":`ordersListActionSlot_${C}`,name:"OrdersListAction",slot:d==null?void 0:d.OrdersListAction,context:{orderHistoryListItem:v}}):t(W,{minifiedView:r,orderNumber:v.number,orderToken:v.token,routeOrderDetails:f})},C))}):t(Q,{isEmpty:!_.length,typeList:"orders",minifiedView:r})}),!r&&(O==null?void 0:O.totalPages)>1?t(er,{totalPages:O==null?void 0:O.totalPages,currentPage:N,onChange:z}):null,r?t(W,{minifiedView:r,routeOrdersList:g}):null]})]})},Nr=({className:n,withHeader:c,minifiedView:r,withThumbnails:a,withFilter:u,ordersInMinifiedView:s,pageSize:i,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>t("div",{className:k(["account-orders-list",n]),"data-testid":"ordersListId",children:t(lr,{className:n,withHeader:c,minifiedView:r,withThumbnails:a,withFilter:u,ordersInMinifiedView:s,pageSize:i,routeOrdersList:g,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})});export{Nr as OrdersList,Nr as default};
4
4
  //# sourceMappingURL=OrdersList.js.map