@dropins/storefront-account 1.0.7-beta3 → 1.0.7

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.
@@ -14,5 +14,5 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const GET_COUNTRIES_QUERY = "\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n";
17
+ export declare const GET_COUNTRIES_QUERY = "\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n";
18
18
  //# sourceMappingURL=getCountries.graphql.d.ts.map
package/api.js CHANGED
@@ -1,3 +1,14 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{c as i,g as m,i as d}from"./chunks/getStoreConfig.js";import{d as g,f as u,c as C,g as f,h,e as c,i as n,j as l,r as A,s as x,a as F,b as G,u as H}from"./chunks/removeCustomerAddress.js";import{g as b,b as v,a as E,u as j}from"./chunks/updateCustomer.js";import{g as y}from"./chunks/getOrderHistoryList.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";export{i as config,g as createCustomerAddress,u as fetchGraphQl,C as getAttributesForm,f as getConfig,h as getCountries,b as getCustomer,c as getCustomerAddress,y as getOrderHistoryList,n as getRegions,m as getStoreConfig,d as initialize,l as removeCustomerAddress,A as removeFetchGraphQlHeader,x as setEndpoint,F as setFetchGraphQlHeader,G as setFetchGraphQlHeaders,v as updateCustomer,H as updateCustomerAddress,E as updateCustomerEmail,j as updateCustomerPassword};
3
+ import{c as b,g as v,i as _}from"./chunks/getStoreConfig.js";import{f as d,h as u,a as m}from"./chunks/removeCustomerAddress.js";import{e as A,d as F,g as N,j as O,i as R,k as $,r as H,s as I,b as Q,c as w,u as T}from"./chunks/removeCustomerAddress.js";import{g as J,b as j,a as q,u as z}from"./chunks/updateCustomer.js";import{g as D}from"./chunks/getOrderHistoryList.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";const g=t=>{var r,s;const a=(s=(r=t==null?void 0:t.data)==null?void 0:r.country)==null?void 0:s.available_regions;return a?a.filter(e=>{if(!e)return!1;const{id:i,code:n,name:c}=e;return!!(i&&n&&c)}).map(e=>{const{id:i}=e;return{id:i,text:e.name,value:`${e.code},${e.id}`}}):[]},l=`
4
+ query GET_REGIONS($countryCode: String!) {
5
+ country(id: $countryCode) {
6
+ id
7
+ available_regions {
8
+ id
9
+ code
10
+ name
11
+ }
12
+ }
13
+ }
14
+ `,E=async t=>{const a=`_account_regions_${t}`,o=sessionStorage.getItem(a);return o?JSON.parse(o):await d(l,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(r=>{var e;if((e=r.errors)!=null&&e.length)return u(r.errors);const s=g(r);return sessionStorage.setItem(a,JSON.stringify(s)),s}).catch(m)};export{b as config,A as createCustomerAddress,d as fetchGraphQl,F as getAttributesForm,N as getConfig,O as getCountries,J as getCustomer,R as getCustomerAddress,D as getOrderHistoryList,E as getRegions,v as getStoreConfig,_ as initialize,$ as removeCustomerAddress,H as removeFetchGraphQlHeader,I as setEndpoint,Q as setFetchGraphQlHeader,w as setFetchGraphQlHeaders,j as updateCustomer,T as updateCustomerAddress,q as updateCustomerEmail,z as updateCustomerPassword};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as a,Fragment as ee,jsxs as G}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Q,Slot as me}from"@dropins/tools/lib.js";import{Field as le,Picker as Je,Input as Xe,InputDate as Ke,Checkbox as Re,TextArea as Ye,Card as he,Skeleton as we,SkeletonRow as K,Button as de,Tag as pe,Icon as He,Modal as Qe,ProgressSpinner as De,IllustratedMessage as et,Header as tt,InLineAlert as rt}from"@dropins/tools/components.js";import{useRef as st,useState as E,useEffect as te,useCallback as U,useMemo as nt}from"@dropins/tools/preact-hooks.js";import{n as Ve,o as ze,u as ye,c as ke,e as at,m as dt,j as ot,h as lt,i as it,d as ct}from"./removeCustomerAddress.js";import{useText as ne}from"@dropins/tools/i18n.js";import*as Y from"@dropins/tools/preact-compat.js";import{memo as _e,forwardRef as ut,useImperativeHandle as pt,useId as ft,useMemo as ve,useCallback as Ne}from"@dropins/tools/preact-compat.js";import{Fragment as Te}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({hideActionFormButtons:e,formName:s,showFormLoader:n,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:l,slots:i,addressesFormTitle:o,className:c,addressFormId:p,inputsDefaultValueSet:u,billingCheckBoxValue:g,shippingCheckBoxValue:y,showBillingCheckBox:v,showShippingCheckBox:m,isOpen:N,fieldIdPrefix:T,onSubmit:t,onCloseBtnClick:L,onSuccess:f,onError:O,onChange:_})=>a("div",{className:Q(["account-address-form"]),children:a(Yt,{hideActionFormButtons:e,formName:s,showFormLoader:n,slots:i,addressesFormTitle:o,className:c,addressFormId:p,inputsDefaultValueSet:u,shippingCheckBoxValue:y,billingCheckBoxValue:g,showShippingCheckBox:m,showBillingCheckBox:v,isOpen:N,fieldIdPrefix:T,onSubmit:t,onCloseBtnClick:L,onSuccess:f,onError:O,onChange:_,forwardFormRef:l,showSaveCheckBox:r,saveCheckBoxValue:d})}),At=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),ht=e=>/^\d+$/.test(e),mt=e=>/^[a-zA-Z0-9\s]+$/.test(e),Lt=e=>/^[a-zA-Z0-9]+$/.test(e),gt=e=>/^[a-zA-Z]+$/.test(e),bt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),Ct=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),yt=(e,s,n)=>{const r=new Date(e).getTime()/1e3;return!(isNaN(r)||r<0||s!==void 0&&r<s||n!==void 0&&r>n)},Ze=e=>!e||isNaN(Number(e))?"":new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],vt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),Mt=(e,s,n)=>{const r=e.length;return r>=s&&r<=n},Ce=(e,s,n,r)=>{var H,B;const{requiredFieldError:d,lengthTextError:l,numericError:i,alphaNumWithSpacesError:o,alphaNumericError:c,alphaError:p,emailError:u,dateError:g,urlError:y,dateLengthError:v}=n,m=s==null?void 0:s.customUpperCode,N={[m]:""};if(r[m]&&delete r[m],s!=null&&s.required&&(!e||e==="false"))return{[m]:d};if(!(s!=null&&s.required)&&!e||!((H=s==null?void 0:s.validateRules)!=null&&H.length))return N;const T=At(s==null?void 0:s.validateRules),t=T.MIN_TEXT_LENGTH??1,L=T.MAX_TEXT_LENGTH??255,f=T.DATE_RANGE_MIN,O=T.DATE_RANGE_MAX;if(!Mt(e,+t,+L)&&!(f||O))return{[m]:l.replace("{min}",t).replace("{max}",L)};if(!yt(e,+f,+O)&&(f||O))return{[m]:v.replace("{min}",Ze(f)).replace("{max}",Ze(O))};const R={numeric:{validate:ht,error:i},"alphanum-with-spaces":{validate:mt,error:o},alphanumeric:{validate:Lt,error:c},alpha:{validate:gt,error:p},email:{validate:bt,error:u},date:{validate:Ct,error:g},url:{validate:vt,error:y}}[T.INPUT_VALIDATION];return R&&!R.validate(e)&&!((B=r[m])!=null&&B.length)?{[m]:R.error}:N},qe=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},$t=["true","false","yes","on","off"],_t={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},Et=e=>{const s={},n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r],l=r.match(/^(.*)Multiline_(\d+)$/);if(l){const i=l[1],o=parseInt(l[2],10);n[i]||(n[i]=[]),n[i].push({index:o,value:d})}else Object.keys(e).filter(o=>o.startsWith(`${r}Multiline_`)).length>0?n[r]=[{index:1,value:d}]:s[r]=d}for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const d=n[r];d.sort((l,i)=>l.index-i.index),s[r]=d.map(l=>l.value)}return s},Nt=e=>{const s={},n=[];for(const r in e){const d=$t.includes(e[r])?qe(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(_t,r)?s[r]=d:n.push({code:ze(r),value:d}))}return{...s,customAttributes:n}},ae=(e,s=!1)=>{const n=Ve(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=Nt(Et(n));if(!s)return r;const[d,l]=r.region?r.region.split(","):[];return{...r,region:{regionCode:d,...l&&{regionId:+l}}}},Ae=e=>{if(!e.current)return{};const s=e.current.elements;return Array.from(s).reduce((r,d)=>(d.name&&(r[d.name]=d.type==="checkbox"?d.checked:d.value),r),{})},Se=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,Ue=e=>typeof e=="function",Tt=e=>e.reduce((s,{customUpperCode:n,required:r,defaultValue:d})=>(r&&n&&(s.initialData[n]=d||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),Fe=e=>Object.keys(e).length>0,Zt=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:r,formName:d,isWaitingForResponse:l})=>{const i=ne({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),o=st(null),[c,p]=E({}),[u,g]=E({}),[y,v]=E({}),[m,N]=E(!0),[T,t]=E(!1),[L,f]=E(!1),[O,_]=E(!0),[R,H]=E(!1);te(()=>{const A=()=>{if(o.current){const b=window.getComputedStyle(o.current).getPropertyValue("grid-template-rows").split(" ").length,C=o.current.querySelector(".account-address-form--saveAddressBook");C&&(C.style.gridRow=String(b-1))}};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[e==null?void 0:e.length]);const B=U((A=!1)=>{let M=!0;const b={...u};let C=null;for(const[Z,h]of Object.entries(c)){const S=e==null?void 0:e.find(I=>I.customUpperCode.includes(Z)),q=Ce(h.toString(),S,i,b);q[Z]&&(Object.assign(b,q),M=!1),C||(C=Object.keys(b).find(I=>b[I])||null)}if(A||g(b),C&&o.current&&!A){const Z=o.current.elements.namedItem(C);Z==null||Z.focus()}return M},[u,e,c,i]),w=U((A,M,b,C)=>{const Z={...Ae(o),[M]:A,...M.includes("countryCode")?{region:""}:{}},h={data:ae(Z,!0),isDataValid:Se(b,Z)};H(h.isDataValid),B(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(h)),n==null||n(h,{},C)},[B,d,n]);te(()=>{if(e!=null&&e.length){const{initialData:A,errorList:M}=Tt(e);p(b=>({...A,...b})),g(M),v(M)}},[JSON.stringify(e)]),te(()=>{if(L)return;const A=Ae(o),M=sessionStorage.getItem(`${d}_addressData`);if(Fe(c)&&Fe(y)){let b={};const C=Se(y,c);M?b=JSON.parse(M).data:b=ae(A,!0)??{},n==null||n({data:b,isDataValid:C},{},null),H(C),f(!0)}},[c,y]),te(()=>{var Z;if(!O)return;const A=Ae(o),M=!!(A!=null&&A.countryCode),b=!!((Z=A==null?void 0:A.region)!=null&&Z.length);A&&M&&!b&&Ue(n)&&!l&&w(A==null?void 0:A.region,"region",y,null)},[O,m,e,o,n,w,y,T,l]);const F=U((A,M)=>{const{name:b,value:C,type:Z,checked:h}=A==null?void 0:A.target,S=Z==="checkbox"?h:C;p(z=>{const D={...z,[b]:S};return b==="countryCode"&&(D.region="",N(!0),t(!1)),D}),r==null||r({[b]:S}),f(!0);const q=e==null?void 0:e.find(z=>z.customUpperCode.includes(b));let I=M?{...M}:{...u};if(q){const z=Ce(S.toString(),q,i,I);z&&Object.assign(I,z),g(I)}w(S,b,y,A)},[r,e,u,i,w,y,m]),V=U(A=>{const{name:M}=A==null?void 0:A.target,b=e==null?void 0:e.find(C=>C.customUpperCode===M);M==="region"&&(b!=null&&b.options.length)&&_(!1),_(M==="countryCode")},[]),W=U((A,M)=>{const{name:b,value:C,type:Z,checked:h}=A==null?void 0:A.target,S=Z==="checkbox"?h:C,q=e==null?void 0:e.find(I=>I.customUpperCode===b);if(q){const I=M?{...M}:{...u},z=Ce(S.toString(),q,i,I);z&&Object.assign(I,z),g(I)}},[u,e,i]),k=U(A=>{A.preventDefault();const M=B();s==null||s(A,M)},[B,s]);return{isDataValid:R,formData:c,errors:u,formRef:o,handleInputChange:F,onFocus:V,handleBlur:W,handleSubmit:k,handleValidationSubmit:B}};var se=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(se||{});const St=_e(({loading:e,values:s,fields:n=[],errors:r,className:d="",onChange:l,onBlur:i,onFocus:o,slots:c,fieldIdPrefix:p})=>{const u=`${d}__field`,g=(t,L)=>{if(!(c!=null&&c[`AddressFormInput_${t.code}`]))return;const f={inputName:t.customUpperCode,handleOnChange:l,handleOnBlur:i,handleOnFocus:o,errorMessage:L,errors:r,config:t};return a(me,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:c[`AddressFormInput_${t.code}`],context:f},t.id)},y=(t,L,f)=>{var _;const O=((_=t.options.find(R=>R.isDefault))==null?void 0:_.value)??L??t.defaultValue;return a(ee,{children:g(t,f)??a(le,{error:f,className:Q([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(Je,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:p?`${p}_${t.code}`:t.code,required:t==null?void 0:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,options:t.options,onBlur:i,onFocus:o,handleSelect:l,defaultValue:O,value:O})},t.id)})},v=(t,L,f)=>a(ee,{children:g(t,f)??a(le,{error:f,className:Q([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(Xe,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:p?`${p}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:L??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:i,onFocus:o,onChange:l})},t.id)}),m=(t,L,f)=>a(ee,{children:g(t,f)??a(le,{error:f,className:Q([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(Ke,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:p?`${p}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:L||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:l,disabled:e||t.disabled})},t.id)}),N=(t,L,f)=>a(ee,{children:g(t,f)??a(le,{error:f,className:Q([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:(t==null?void 0:t.isHidden)??e,children:a(Re,{"aria-label":t.label,"aria-required":t.required?"true":"false","aria-hidden":t.isHidden,tabindex:t!=null&&t.isHidden?-1:0,id:p?`${p}_${t.code}`:t.code,name:t.customUpperCode,checked:L||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:l})},t.id)}),T=(t,L,f)=>a(ee,{children:g(t,f)??a(le,{error:f,className:Q([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(Ye,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:p?`${p}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:L??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:l})},t.id)});return n.length?a(ee,{children:n.map(t=>{const L=r==null?void 0:r[t.customUpperCode],f=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case se.TEXT:return t.options.length?y(t,f,L):v(t,f,L);case se.MULTILINE:return v(t,f,L);case se.SELECT:return y(t,f,L);case se.DATE:return m(t,f,L);case se.BOOLEAN:return N(t,f,L);case se.TEXTAREA:return T(t,f,L);default:return null}})}):null}),je=({testId:e,withCard:s=!0})=>{const n=G(we,{"data-testid":e||"skeletonLoader",children:[a(K,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(K,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(K,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:a(he,{variant:"secondary",className:Q(["account-account-loaders","account-account-loaders--card-loader"]),children:n})},Ft=()=>G(we,{"data-testid":"addressFormLoader",children:[a(K,{variant:"heading",size:"medium"}),a(K,{variant:"empty",size:"medium"}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large",fullWidth:!0}),a(K,{size:"large",fullWidth:!0,lines:3}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large"}),a(K,{size:"large",fullWidth:!0})]}),Ot=_e(ut(({isWaitingForResponse:e,setInputChange:s,showFormLoader:n,slots:r,name:d,loading:l,children:i,className:o="defaultForm",fieldsConfig:c,onSubmit:p,onChange:u,forwardFormRef:g,regionOptions:y,showSaveCheckBox:v,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:N,fieldIdPrefix:T})=>{const t=ne({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:L,formData:f,errors:O,formRef:_,handleInputChange:R,handleBlur:H,handleSubmit:B,handleValidationSubmit:w,onFocus:F}=Zt({fieldsConfig:c,onSubmit:p,onChange:u,setInputChange:s,regionOptions:y,formName:d,isWaitingForResponse:e});return pt(g,()=>{const V=Ae(_);return{handleValidationSubmit:w,formData:ae(V,!0),isDataValid:L}}),n||!(c!=null&&c.length)?a(Ft,{}):G("form",{className:Q(["account-form",o]),onSubmit:B,name:d,ref:_,children:[a(St,{className:o,loading:l,fields:c,onChange:R,onBlur:H,errors:O,values:f,onFocus:F,slots:r,fieldIdPrefix:T}),r!=null&&r.AddressFormInputs?a(me,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:R}}}):null,v?a("div",{className:"account-address-form--saveAddressBook",children:a(Re,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:N,onChange:V=>{R(V),m==null||m(V)}})}):null,i]})})),Oe=(e,s,n={},r="editButton")=>{const d=r==="removeButton",l={shippingAndBilling:{edit:n.editAddressAriaLabelShippingAndBilling,remove:n.removeAddressAriaLabelShippingAndBilling},shipping:{edit:n.editAddressAriaLabelShipping,remove:n.removeAddressAriaLabelShipping},billing:{edit:n.editAddressAriaLabelBilling,remove:n.removeAddressAriaLabelBilling},default:{edit:n.editAddressAriaLabelDefault,remove:n.removeAddressAriaLabelDefault}};let i="default";return e&&s?i="shippingAndBilling":e?i="shipping":s&&(i="billing"),d?l[i].remove:l[i].edit},Me=({slots:e,selectable:s,selectShipping:n,selectBilling:r,variant:d="secondary",minifiedView:l,keysSortOrder:i,addressData:o,loading:c,setAddressId:p,handleRenderModal:u,handleRenderForm:g})=>{const y=ft(),v=l?"minifiedView":"fullSizeView",m=ne({actionRemove:`Account.${v}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${v}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${v}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${v}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${v}.Addresses.addressCard.defaultLabelText`,editAddressAriaLabelDefault:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.default`,editAddressAriaLabelShipping:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.shipping`,editAddressAriaLabelBilling:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.billing`,editAddressAriaLabelShippingAndBilling:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.shippingAndBilling`,removeAddressAriaLabelDefault:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.default`,removeAddressAriaLabelShipping:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.shipping`,removeAddressAriaLabelBilling:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.billing`,removeAddressAriaLabelShippingAndBilling:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.shippingAndBilling`}),N=m.cardLabelBilling.toLocaleUpperCase(),T=m.cardLabelShipping.toLocaleUpperCase(),t=m.defaultLabelText.toLocaleUpperCase(),L=ve(()=>{const F={shippingLabel:T,billingLabel:N,hideShipping:!1,hideBilling:!1};return s?n&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!n?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:F:F},[N,t,T,r,n,s]),f=Ne(()=>{p==null||p(o==null?void 0:o.id),u==null||u()},[u,o==null?void 0:o.id,p]),O=Ne(()=>{p==null||p(o==null?void 0:o.id),g==null||g()},[g,o==null?void 0:o.id,p]),_=ve(()=>{if(!i)return[];const{region:F,...V}=o,W={...V,...F};return i.filter(({name:k})=>W[k]).map(k=>({name:k.name,orderNumber:k.orderNumber,value:W[k.name],label:k.label}))},[o,i]),{shippingLabel:R,billingLabel:H,hideShipping:B,hideBilling:w}=L;return a(he,{variant:d,className:"account-address-card","data-testid":"addressCard",children:c?a(je,{}):G(ee,{children:[G("div",{className:"account-address-card__action",children:[u?a(de,{type:"button",variant:"tertiary",onClick:f,"data-testid":"removeButton","aria-label":Oe(o==null?void 0:o.defaultShipping,o==null?void 0:o.defaultBilling,m,"removeButton"),"aria-describedby":y,children:m.actionRemove}):null,g?a(de,{type:"button",variant:"tertiary",onClick:O,className:"account-address-card__action--editbutton","data-testid":"editButton","aria-label":Oe(o==null?void 0:o.defaultShipping,o==null?void 0:o.defaultBilling,m,"editButton"),"aria-describedby":y,children:m.actionEdit}):null]}),a("div",{className:"account-address-card__description",id:y,children:e!=null&&e.AddressCard?a(me,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:_}}):a(ee,{children:_.map((F,V)=>{const W=F.label?`${F.label}: ${F==null?void 0:F.value}`:F==null?void 0:F.value;return a("p",{"data-testid":`${F.name}_${V}`,children:W},V)})})}),(o!=null&&o.defaultShipping||o!=null&&o.defaultBilling)&&!s?G("div",{className:"account-address-card__labels",children:[o!=null&&o.defaultShipping?a(pe,{label:T}):null,o!=null&&o.defaultBilling?a(pe,{label:N}):null]}):null,s?G("div",{className:"account-address-card__labels",children:[!B&&(o!=null&&o.defaultShipping)?a(pe,{label:R}):null,!w&&(o!=null&&o.defaultBilling)?a(pe,{label:H}):null]}):null]})})},It=e=>Y.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},Y.createElement("g",{id:"Large"},Y.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),Y.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},Y.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),Y.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),Bt=e=>Y.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},Y.createElement("g",{id:"Large"},Y.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),Y.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},Y.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),xt=e=>Y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Y.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"currentColor"})),Rt=e=>Y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Y.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),Ie=({selectable:e,className:s,addNewAddress:n,minifiedView:r,routeAddressesPage:d})=>{const l=r?"minifiedView":"fullSizeView",i=ne({viewAllAddressesButton:`Account.${l}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${l}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${l}.Addresses.differentAddressButton`}),o=e?"span":"button",c=e?{}:{AriaRole:"button",type:"button"},p=r&&!n?i.viewAllAddressesButton:i.addNewAddressButton,u=e?i.differentAddressButton:p;return G(o,{...c,className:Q(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:d,children:[a("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:u}),a(He,{source:r&&!n?Bt:It,size:"32"})]})},wt=({minifiedView:e,keysSortOrder:s,addressData:n,open:r,submitLoading:d,onRemoveAddress:l,closeModal:i})=>{const o=e?"minifiedView":"fullSizeView",c=ne({title:`Account.${o}.Addresses.removeAddressModal.title`,description:`Account.${o}.Addresses.removeAddressModal.description`,actionCancel:`Account.${o}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${o}.Addresses.removeAddressModal.actionConfirm`});return r?a(Qe,{className:"account-address-modal--overlay",title:a("h3",{children:c.title}),size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:i,children:G("div",{className:"account-address-modal",children:[d?a("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:a(De,{stroke:"4",size:"large"})}):null,a("p",{children:c.description}),a(Me,{minifiedView:e,addressData:n,keysSortOrder:s}),G("div",{className:"account-address-modal__buttons",children:[a(de,{type:"button",onClick:i,variant:"secondary",disabled:d,children:c.actionCancel}),a(de,{disabled:d,onClick:l,children:c.actionConfirm})]})]})}):null},Ht=({typeList:e,isEmpty:s,minifiedView:n,className:r})=>{const d=n?"minifiedView":"fullSizeView",l=ne({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),i=ve(()=>{switch(e){case"address":return{icon:xt,text:a("p",{children:l.addressesMessage})};case"orders":return{icon:Rt,text:a("p",{children:l.ordersListMessage})};default:return{icon:"",text:""}}},[e,l]);return!s||!e||!i.text?null:a(et,{className:Q(["account-empty-list",n?"account-empty-list--minified":"",r]),message:i.text,icon:a(He,{source:i.icon}),"data-testid":"emptyList"})},Vt=async(e,s)=>{if(s.length===1){const i=s[0],c=Object.values(i.region).every(u=>!!u)?{}:{region:{...i.region,regionId:0}};return!!await ye({addressId:Number(i==null?void 0:i.id),defaultShipping:!1,defaultBilling:!1,...c})}const n=s.filter(i=>i.id!==e&&(i.defaultBilling||i.defaultShipping)||i.id!==e),r=s[s.length-1],d=n[0]||((r==null?void 0:r.id)!==e?r:null);return!d||!d.id?!1:!!await ye({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},zt=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing","fax","prefix","suffix","middlename"],or=["email","firstname","lastname","middlename","gender","dob","prefix","suffix","fax"],We=(e,s,n)=>{if(s&&n||!s&&!n)return e;const r=e.slice();return s?r.sort((d,l)=>Number(l.defaultShipping)-Number(d.defaultShipping)):n?r.sort((d,l)=>Number(l.defaultBilling)-Number(d.defaultBilling)):e},$e=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every($e),kt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:r,minifiedView:d,routeAddressesPage:l,onSuccess:i})=>{const[o,c]=E(""),[p,u]=E(!1),[g,y]=E(!1),[v,m]=E(!1),[N,T]=E(!1),[t,L]=E(!1),[f,O]=E(""),[_,R]=E([]),[H,B]=E([]),w=U(async()=>{m(!0),Promise.all([ke("shortRequest"),at()]).then(h=>{const[S,q]=h;if(S){const I=S.map(({name:z,orderNumber:D,label:re})=>({name:dt(z),orderNumber:D,label:zt.includes(z)?null:re}));B(I)}if(q)if(d){const I=q.filter(D=>!!D.defaultShipping||!!D.defaultBilling),z=I.length?I:q.slice(-1);R(z)}else R(q)}).finally(()=>{m(!1)})},[d]);te(()=>{w()},[w]),te(()=>{var h;if(_.length)if(n===0)L(!0),c("0");else{const S=_.find(I=>+I.id===n)||We(_,e,s)[0],q={data:ae(S),isDataValid:!$e(S)};c(n.toString()||((h=S==null?void 0:S.id)==null?void 0:h.toString())),r==null||r(q)}},[_,n,r,s,e]);const F=U(h=>{O(h),L(!1)},[]),V=U((h,S)=>{const q=(h==null?void 0:h.target).value,I=(h==null?void 0:h.target).nextSibling;c(q);const z={data:ae(S),isDataValid:!$e(ae(S))};r==null||r(z),L(q==="0"),I&&(I.focus(),window.scrollBy(0,100))},[r]),W=U(()=>{y(!0)},[]),k=U(()=>{O(""),y(!1),u(!1)},[]),A=U(()=>{u(!0)},[]),M=U(async()=>{T(!0),await Vt(f,_),ot(+f).then(()=>{w(),k()}).finally(()=>{T(!1)})},[_,f,k,w]),b=U(()=>{L(!1)},[]),C=U(()=>{Ue(l)&&d&&!t?window.location.href=l():(L(!0),O(""))},[t,l,d]),Z=U(async()=>{await w(),await(i==null?void 0:i())},[w,i]);return{keysSortOrder:H,submitLoading:N,isModalRendered:p,isFormRendered:g,loading:v,addNewAddress:t,addressesList:_,addressId:f,handleRenderForm:W,handleRenderModal:A,removeAddress:M,onCloseBtnClick:k,setEditingAddressId:F,closeNewAddressForm:b,redirectToAddressesRoute:C,handleOnSuccess:Z,handleSelectAddressOption:V,selectedAddressOption:o}},lr=_e(({minifiedViewKey:e,hideActionFormButtons:s=!1,inputName:n,slots:r,title:d="",addressFormTitle:l="",defaultSelectAddressId:i="",showFormLoader:o=!1,onAddressData:c,forwardFormRef:p,className:u,showSaveCheckBox:g=!1,saveCheckBoxValue:y=!1,selectShipping:v=!1,selectBilling:m=!1,selectable:N=!1,withHeader:T=!0,minifiedView:t=!1,withActionsInMinifiedView:L=!1,withActionsInFullSizeView:f=!0,inputsDefaultValueSet:O,showShippingCheckBox:_=!0,showBillingCheckBox:R=!0,shippingCheckBoxValue:H=!0,billingCheckBoxValue:B=!0,routeAddressesPage:w,onSuccess:F,onError:V})=>{const W=ne({containerTitle:`Account.${e}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${e}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${e}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${e}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${e}.Addresses.newAddressFormTitle`,ariaLabelAddressPicker:`Account.${e}.Addresses.ariaLabelAddressPicker`}),{keysSortOrder:k,submitLoading:A,isModalRendered:M,isFormRendered:b,loading:C,addNewAddress:Z,addressesList:h,addressId:S,handleRenderForm:q,handleRenderModal:I,removeAddress:z,onCloseBtnClick:D,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:oe,redirectToAddressesRoute:ie,handleSelectAddressOption:ce,selectedAddressOption:ue}=kt({defaultSelectAddressId:i,minifiedView:t,routeAddressesPage:w,onSuccess:F,onAddressData:c,selectShipping:v,selectBilling:m}),$=d||W.containerTitle;let P=null;if(N){const x=We(h,v,m)||[];let J;Z?J=a("div",{className:Q(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",Z]]),children:a(fe,{slots:r,hideActionFormButtons:s,formName:n,showFormLoader:o,isOpen:Z,forwardFormRef:p,showSaveCheckBox:g,saveCheckBoxValue:y,shippingCheckBoxValue:H,billingCheckBoxValue:B,addressesFormTitle:l||W.differentAddressFormTitle,inputsDefaultValueSet:O,showShippingCheckBox:_,showBillingCheckBox:R,onCloseBtnClick:oe,onSuccess:re,onError:V,onChange:c})}):x.length?J=a(Ie,{selectable:N,minifiedView:t,addNewAddress:Z,routeAddressesPage:ie}):J=null;const X=`generalLabel_${$.replace(/\s+/g,"")}`;P=G("div",{className:"account-addresses-wrapper--select-view",children:[a("span",{id:X,style:"display: none;",children:$}),x.map((j,ge)=>{const be=`${n}_${j.id}`,Ee=`${be}_label`;return G(Te,{children:[a("input",{"data-testid":`radio-${ge+1}`,type:"radio",name:n,id:be,value:j.id,checked:ue===(j==null?void 0:j.id.toString()),onChange:Ge=>ce(Ge,j),"aria-labelledby":`${X} ${Ee}`}),a("label",{id:Ee,htmlFor:be,className:"account-addresses-wrapper__label",children:a(Me,{slots:r,selectable:N,selectShipping:v,selectBilling:m,minifiedView:t,addressData:j,keysSortOrder:k,loading:C})})]},j.id)}),J&&G("div",{className:"account-addresses-wrapper__footer-section",children:[a("input",{"aria-label":`${$} ${W.ariaLabelAddressPicker}`,"data-testid":"radio-0",type:"radio",name:n,id:`${n}_addressActions`,value:"0",checked:ue==="0",onChange:j=>ce(j,{}),tabindex:J?0:-1}),a("label",{htmlFor:`${n}_addressActions`,className:"account-addresses-wrapper__label",children:J})]})]})}else P=G(ee,{children:[h.map(x=>a(Te,{children:S===x.id&&b?a(he,{variant:"secondary",style:{marginBottom:20},children:a(fe,{slots:r,isOpen:S===x.id&&b,addressFormId:S,inputsDefaultValueSet:x,addressesFormTitle:W.editAddressFormTitle,showShippingCheckBox:_,showBillingCheckBox:R,shippingCheckBoxValue:H,billingCheckBoxValue:B,onCloseBtnClick:D,onSuccess:re,onError:V})}):a(Me,{slots:r,minifiedView:t,addressData:x,keysSortOrder:k,loading:C,setAddressId:Le,handleRenderModal:t&&L||!t&&f?I:void 0,handleRenderForm:t&&L||!t&&f?q:void 0},x.id)},x.id)),a("div",{className:"account-addresses__footer",children:Z?a(he,{variant:"secondary",children:a(fe,{slots:r,isOpen:Z,addressesFormTitle:W.newAddressFormTitle,inputsDefaultValueSet:O,showShippingCheckBox:!!(h!=null&&h.length),showBillingCheckBox:!!(h!=null&&h.length),shippingCheckBoxValue:H,billingCheckBoxValue:B,onCloseBtnClick:oe,onSuccess:re,onError:V})}):a(Ie,{minifiedView:t,addNewAddress:Z,routeAddressesPage:ie})})]});return G("div",{children:[T?a(tt,{title:$,divider:!t,className:t?"account-addresses-header":""}):null,G("div",{className:Q(["account-addresses-wrapper",u]),"data-testid":"addressesIdWrapper",children:[a(wt,{minifiedView:t,addressData:h==null?void 0:h.find(x=>x.id===S),keysSortOrder:k,submitLoading:A,open:M,closeModal:D,onRemoveAddress:z}),C?a(je,{testId:"addressSkeletonLoader",withCard:!1}):N?a(fe,{slots:r,hideActionFormButtons:s,formName:n,isOpen:!(h!=null&&h.length),forwardFormRef:p,showSaveCheckBox:g,saveCheckBoxValue:y,shippingCheckBoxValue:H,billingCheckBoxValue:B,inputsDefaultValueSet:O,showShippingCheckBox:_,showBillingCheckBox:R,onCloseBtnClick:oe,onSuccess:re,onError:V,onChange:c}):a(Ht,{isEmpty:!(h!=null&&h.length),typeList:"address",minifiedView:t}),P]})]})}),Pe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},qt={...Pe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ut={...Pe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},jt=(e,s)=>s==null?void 0:s.map(n=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName,middleName:e.middlename??e.middleName},d=JSON.parse(JSON.stringify(n));if(Object.hasOwn(r,n.customUpperCode)){const l=r[n.customUpperCode];n.customUpperCode==="region"&&typeof l=="object"?d.defaultValue=l.regionCode&&l.regionId?`${l.regionCode},${l.regionId}`:l.region??l.regionCode:d.defaultValue=l}return d}),Be=e=>{if(!e)return null;const s=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(r=>{s.has(r.name)||s.set(r.name,"false"),r.checked&&s.set(r.name,"true")}),s&&typeof s.entries=="function"){const r=s.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},Wt=({fields:e,addressId:s,countryOptions:n,disableField:r,regionOptions:d,isRequiredRegion:l,isRequiredPostCode:i})=>e.filter(c=>!(s&&(c.customUpperCode==="defaultShipping"||c.customUpperCode==="defaultBilling")&&c.defaultValue)).map(c=>c.customUpperCode==="countryCode"?{...c,options:n,disabled:r}:c.customUpperCode==="postcode"?{...c,required:i}:c.customUpperCode==="region"?{...c,options:d,required:l,disabled:r}:c),Pt=(e,s="address")=>{const n=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","prefix","suffix","fax"],r={},d=[];return Object.keys(e).forEach(l=>{n.includes(l)?r[l]=e[l]:d.push({attribute_code:ze(l),value:e[l]})}),d.length>0&&(r.custom_attributesV2=d),r},xe=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],r=[],d={};for(const m in e){const N=e[m];n.includes(N)&&(d[m]=qe(N)),s.includes(m)&&r.push(N)}const{street:l,streetMultiline_2:i,streetMultiline_1:o,region:c,...p}=e,[u,g]=c?c.split(","):[void 0,void 0],y=g&&u?{regionId:+g,regionCode:u}:{region:u};return Pt({...p,...d,region:{...y},street:r})},Gt=(e,s)=>{const n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r];if(r==="region"&&d.regionId){const l=s.find(i=>(i==null?void 0:i.id)===d.regionId);l?n[r]={...d,text:l.text}:n[r]=d}else Array.isArray(d)?(n[r]=d[0]||"",d.slice(1).forEach((l,i)=>{n[`${r}Multiline_${i+2}`]=l})):n[r]=d}return n},Jt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Xt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:l,showShippingCheckBox:i,showBillingCheckBox:o,inputsDefaultValueSet:c,onCloseBtnClick:p,onSuccess:u,onError:g,formName:y})=>{const[v,m]=E({text:"",type:"success"}),[N,T]=E(e??!1),[t,L]=E(r||""),[f,O]=E([]),[_,R]=E([]),[H,B]=E([]),[w,F]=E([]),[V,W]=E([]),[k,A]=E(!1),[M,b]=E(!1),[C,Z]=E(()=>{var P,x;const $=sessionStorage.getItem(`${y}_addressData`);return $?{countryCode:(x=(P=JSON.parse($))==null?void 0:P.data)==null?void 0:x.countryCode}:c}),[h,S]=E(!1),[q,I]=E(!1),[z,D]=E(()=>{var x,J;const $=sessionStorage.getItem(`${y}_addressData`);return $?(J=(x=JSON.parse($))==null?void 0:x.data)==null?void 0:J.saveAddressBook:n}),re=U($=>{D($.target.checked)},[]);te(()=>{typeof e>"u"||T(e)},[e]),te(()=>{ke(t?"customer_address_edit":"customer_register_address").then($=>{O($)})},[t]),te(()=>{S(!0),lt().then(({availableCountries:$,countriesWithRequiredRegion:P,optionalZipCountries:x})=>{R($),F(P),W(x),S(!1)})},[]),te(()=>{if(C!=null&&C.countryCode){S(!0),I(!0);const $=C==null?void 0:C.countryCode;it($).then(P=>{B(P);const x=w.find(X=>X===$),J=V.find(X=>X===$);A(!!x),b(!J),S(!1),I(!1)})}},[C==null?void 0:C.countryCode,w,V]);const Le=U(()=>{m({text:"",type:"success"}),p==null||p()},[p]),oe=U(async($,P)=>{if(!P)return null;T(!0);const x=Be($.target),J=xe(x);await ye(J).then(()=>{var X;u==null||u(),p==null||p(),(X=$==null?void 0:$.target)==null||X.reset()}).catch(X=>{m(j=>({...j,text:X.message,type:"error"})),g==null||g(X)}).finally(()=>{L(""),T(!1)})},[p,g,u]),ie=U(async($,P)=>{if(!P)return;T(!0);const{saveAddressBook:x,...J}=Be($.target),X=xe(J);await ct(X).then(()=>{var j;u==null||u(),p==null||p(),(j=$==null?void 0:$.target)==null||j.reset()}).catch(j=>{m(ge=>({...ge,text:j.message,type:"error"})),g==null||g(j)}).finally(()=>{L(""),T(!1)})},[p,g,u]),ce=nt(()=>{if(!f.length)return[];const $={...qt,defaultValue:l,isHidden:s&&!z?!0:!i},P={...Ut,defaultValue:d,isHidden:s&&!z?!0:!o},x=[...f,$,P],J=sessionStorage.getItem(`${y}_addressData`),X=J?Gt(JSON.parse(J).data,H):{},j=jt(Jt(X,c),x);return Wt({fields:j,addressId:t,countryOptions:_,disableField:h,regionOptions:H,isRequiredRegion:k,isRequiredPostCode:M})},[f,l,s,z,i,d,o,y,H,c,t,_,h,k,M]),ue=U($=>{Z(P=>({...P,...$}))},[]);return{isWaitingForResponse:q,regionOptions:H,saveCheckBoxAddress:z,inLineAlert:v,addressId:t,submitLoading:N,normalizeFieldsConfig:ce,handleSaveCheckBoxAddress:re,handleUpdateAddress:oe,handleCreateAddress:ie,handleOnCloseForm:Le,handleInputChange:ue}},Kt=e=>{var d;if(!e||!Array.isArray(e.customAttributes))return e??{};const s={};(d=e==null?void 0:e.customAttributes)==null||d.forEach(l=>{l.code&&Object.hasOwn(l,"value")&&(s[l.code]=l.value)});const{customAttributes:n,...r}=e;return{...r,...Ve(s,"camelCase",{})}},Yt=({hideActionFormButtons:e,formName:s="",showFormLoader:n=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:l,slots:i,addressesFormTitle:o,className:c,addressFormId:p,inputsDefaultValueSet:u,showShippingCheckBox:g=!0,showBillingCheckBox:y=!0,shippingCheckBoxValue:v=!0,billingCheckBoxValue:m=!0,isOpen:N,fieldIdPrefix:T,onSubmit:t,onCloseBtnClick:L,onSuccess:f,onError:O,onChange:_})=>{const R=ne({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:H,inLineAlert:B,addressId:w,submitLoading:F,normalizeFieldsConfig:V,handleUpdateAddress:W,handleCreateAddress:k,handleOnCloseForm:A,handleSaveCheckBoxAddress:M,saveCheckBoxAddress:b,handleInputChange:C,regionOptions:Z}=Xt({showFormLoader:n,addressFormId:p,inputsDefaultValueSet:Kt(u),shippingCheckBoxValue:v,billingCheckBoxValue:m,showShippingCheckBox:g,showBillingCheckBox:y,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:f,onError:O,onCloseBtnClick:L,formName:s});return N?G("div",{className:Q(["account-address-form-wrapper",c]),children:[o?a("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:o}):null,B.text?a(rt,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:B.type,variant:"secondary",heading:B.text,icon:B.icon}):null,G(Ot,{regionOptions:Z,forwardFormRef:l,slots:i,className:"account-address-form",name:s||"addressesForm",fieldsConfig:V,onSubmit:t||(w?W:k),setInputChange:C,loading:F,showFormLoader:n,showSaveCheckBox:r,handleSaveCheckBoxAddress:M,saveCheckBoxAddress:b,onChange:_,isWaitingForResponse:H,fieldIdPrefix:T,children:[w?a("input",{type:"hidden",name:"addressId",value:w,"data-testid":"hidden_test_id"}):null,e?null:a("div",{className:Q(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:i!=null&&i.AddressFormActions?a(me,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:i.AddressFormActions,context:{handleUpdateAddress:W,handleCreateAddress:k,addressId:w}}):a(ee,{children:r?null:G(ee,{children:[a(de,{type:"button",onClick:A,variant:"secondary",disabled:F,children:R.secondaryButton}),a(de,{disabled:F,children:R.primaryButton})]})})})]})]}):null};export{fe as A,je as C,Ht as E,Ot as F,Bt as S,lr as a,Ue as c,or as d,Be as g,Pt as n};
3
+ import{jsx as n,Fragment as D,jsxs as W}from"@dropins/tools/preact-jsx-runtime.js";import{classes as J,Slot as me}from"@dropins/tools/lib.js";import{Field as oe,Picker as Xe,Input as Ke,InputDate as Ye,Checkbox as we,TextArea as Qe,Card as Ae,Skeleton as He,SkeletonRow as P,Button as de,Tag as ue,Icon as Re,Modal as De,ProgressSpinner as et,IllustratedMessage as tt,Header as rt,InLineAlert as st}from"@dropins/tools/components.js";import{useRef as at,useState as w,useEffect as te,useCallback as q,useMemo as le}from"@dropins/tools/preact-hooks.js";import{m as Ve,n as ze,u as be,d as ke,i as nt,l as dt,k as ot,j as lt,e as it}from"./removeCustomerAddress.js";import{useText as se}from"@dropins/tools/i18n.js";import*as G from"@dropins/tools/preact-compat.js";import{memo as Me,forwardRef as ct,useImperativeHandle as ut,useId as pt,useMemo as Ce,useCallback as Ne}from"@dropins/tools/preact-compat.js";import{Fragment as Te}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const pe=({hideActionFormButtons:e,formName:s,showFormLoader:a,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:o,slots:i,addressesFormTitle:l,className:f,addressFormId:c,inputsDefaultValueSet:p,billingCheckBoxValue:L,shippingCheckBoxValue:Z,showBillingCheckBox:v,showShippingCheckBox:C,isOpen:E,fieldIdPrefix:N,onSubmit:t,onCloseBtnClick:h,onSuccess:A,onError:T,onChange:b})=>n("div",{className:J(["account-address-form"]),children:n(Kt,{hideActionFormButtons:e,formName:s,showFormLoader:a,slots:i,addressesFormTitle:l,className:f,addressFormId:c,inputsDefaultValueSet:p,shippingCheckBoxValue:Z,billingCheckBoxValue:L,showShippingCheckBox:C,showBillingCheckBox:v,isOpen:E,fieldIdPrefix:N,onSubmit:t,onCloseBtnClick:h,onSuccess:A,onError:T,onChange:b,forwardFormRef:o,showSaveCheckBox:r,saveCheckBoxValue:d})}),ft=e=>e.reduce((s,a)=>({...s,[a.name]:a.value}),{}),At=e=>/^\d+$/.test(e),mt=e=>/^[a-zA-Z0-9\s]+$/.test(e),ht=e=>/^[a-zA-Z0-9]+$/.test(e),Lt=e=>/^[a-zA-Z]+$/.test(e),gt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),bt=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),Ct=(e,s,a)=>{const r=new Date(e).getTime()/1e3;return!(isNaN(r)||r<0||s!==void 0&&r<s||a!==void 0&&r>a)},Ze=e=>!e||isNaN(Number(e))?"":new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],yt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),vt=(e,s,a)=>{const r=e.length;return r>=s&&r<=a},ge=(e,s,a,r)=>{var m,x;const{requiredFieldError:d,lengthTextError:o,numericError:i,alphaNumWithSpacesError:l,alphaNumericError:f,alphaError:c,emailError:p,dateError:L,urlError:Z,dateLengthError:v}=a,C=s==null?void 0:s.customUpperCode,E={[C]:""};if(r[C]&&delete r[C],s!=null&&s.required&&(!e||e==="false"))return{[C]:d};if(!(s!=null&&s.required)&&!e||!((m=s==null?void 0:s.validateRules)!=null&&m.length))return E;const N=ft(s==null?void 0:s.validateRules),t=N.MIN_TEXT_LENGTH??1,h=N.MAX_TEXT_LENGTH??255,A=N.DATE_RANGE_MIN,T=N.DATE_RANGE_MAX;if(!vt(e,+t,+h)&&!(A||T))return{[C]:o.replace("{min}",t).replace("{max}",h)};if(!Ct(e,+A,+T)&&(A||T))return{[C]:v.replace("{min}",Ze(A)).replace("{max}",Ze(T))};const H={numeric:{validate:At,error:i},"alphanum-with-spaces":{validate:mt,error:l},alphanumeric:{validate:ht,error:f},alpha:{validate:Lt,error:c},email:{validate:gt,error:p},date:{validate:bt,error:L},url:{validate:yt,error:Z}}[N.INPUT_VALIDATION];return H&&!H.validate(e)&&!((x=r[C])!=null&&x.length)?{[C]:H.error}:E},Ue=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},Mt=["true","false","yes","on","off"],$t={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},_t=e=>{const s={},a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r],o=r.match(/^(.*)Multiline_(\d+)$/);if(o){const i=o[1],l=parseInt(o[2],10);a[i]||(a[i]=[]),a[i].push({index:l,value:d})}else Object.keys(e).filter(l=>l.startsWith(`${r}Multiline_`)).length>0?a[r]=[{index:1,value:d}]:s[r]=d}for(const r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const d=a[r];d.sort((o,i)=>o.index-i.index),s[r]=d.map(o=>o.value)}return s},Et=e=>{const s={},a=[];for(const r in e){const d=Mt.includes(e[r])?Ue(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call($t,r)?s[r]=d:a.push({code:ze(r),value:d}))}return{...s,customAttributes:a}},ne=(e,s=!1)=>{const a=Ve(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=Et(_t(a));if(!s)return r;const[d,o]=r.region?r.region.split(","):[];return{...r,region:{regionCode:d,...o&&{regionId:+o}}}},fe=e=>{if(!e.current)return{};const s=e.current.elements;return Array.from(s).reduce((r,d)=>(d.name&&(r[d.name]=d.type==="checkbox"?d.checked:d.value),r),{})},Se=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,qe=e=>typeof e=="function",Nt=e=>e.reduce((s,{customUpperCode:a,required:r,defaultValue:d})=>(r&&a&&(s.initialData[a]=d||"",s.errorList[a]=""),s),{initialData:{},errorList:{}}),Fe=e=>Object.keys(e).length>0,Tt=({fieldsConfig:e,onSubmit:s,onChange:a,setInputChange:r,formName:d})=>{const o=se({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),i=at(null),[l,f]=w({}),[c,p]=w({}),[L,Z]=w({}),[v,C]=w(!0),[E,N]=w(!1),[t,h]=w(!1),[A,T]=w(!0),[b,H]=w(!1);te(()=>{const u=()=>{if(i.current){const M=window.getComputedStyle(i.current).getPropertyValue("grid-template-rows").split(" ").length,S=i.current.querySelector(".account-address-form--saveAddressBook");S&&(S.style.gridRow=String(M-1))}};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[e==null?void 0:e.length]);const m=q((u=!1)=>{let $=!0;const M={...c};let S=null;for(const[F,U]of Object.entries(l)){const g=e==null?void 0:e.find(I=>I.customUpperCode.includes(F)),O=ge(U.toString(),g,o,M);O[F]&&(Object.assign(M,O),$=!1),S||(S=Object.keys(M).find(I=>M[I])||null)}if(u||p(M),S&&i.current&&!u){const F=i.current.elements.namedItem(S);F==null||F.focus()}return $},[c,e,l,o]),x=q((u,$,M,S)=>{const F={...fe(i),[$]:u,...$.includes("countryCode")?{region:""}:{}},U={data:ne(F,!0),isDataValid:Se(M,F)};H(U.isDataValid),m(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(U)),a==null||a(U,{},S)},[m,d,a]);te(()=>{if(e!=null&&e.length){const{initialData:u,errorList:$}=Nt(e);f(M=>({...u,...M})),p($),Z($)}},[JSON.stringify(e)]),te(()=>{if(t)return;const u=fe(i),$=sessionStorage.getItem(`${d}_addressData`);if(Fe(l)&&Fe(L)){let M={};const S=Se(L,l);$?M=JSON.parse($).data:M=ne(u,!0)??{},a==null||a({data:M,isDataValid:S},{},null),H(S),h(!0)}},[l,L]),te(()=>{var F;if(!A)return;const u=fe(i),$=!!(u!=null&&u.countryCode),M=!!((F=u==null?void 0:u.region)!=null&&F.length);u&&$&&!M&&qe(a)&&x(u==null?void 0:u.region,"region",L,null)},[A,v,e,i,a,x,L,E]);const z=q((u,$)=>{const{name:M,value:S,type:F,checked:U}=u==null?void 0:u.target,g=F==="checkbox"?U:S;f(V=>{const y={...V,[M]:g};return M==="countryCode"&&(y.region="",C(!0),N(!1)),y}),r==null||r({[M]:g}),h(!0);const O=e==null?void 0:e.find(V=>V.customUpperCode.includes(M));let I=$?{...$}:{...c};if(O){const V=ge(g.toString(),O,o,I);V&&Object.assign(I,V),p(I)}x(g,M,L,u)},[r,e,c,o,x,L,v]),_=q(u=>{const{name:$}=u==null?void 0:u.target,M=e==null?void 0:e.find(S=>S.customUpperCode===$);$==="region"&&(M!=null&&M.options.length)&&T(!1),T($==="countryCode")},[]),k=q((u,$)=>{const{name:M,value:S,type:F,checked:U}=u==null?void 0:u.target,g=F==="checkbox"?U:S,O=e==null?void 0:e.find(I=>I.customUpperCode===M);if(O){const I=$?{...$}:{...c},V=ge(g.toString(),O,o,I);V&&Object.assign(I,V),p(I)}},[c,e,o]),j=q(u=>{u.preventDefault();const $=m();s==null||s(u,$)},[m,s]);return{isDataValid:b,formData:l,errors:c,formRef:i,handleInputChange:z,onFocus:_,handleBlur:k,handleSubmit:j,handleValidationSubmit:m}};var re=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(re||{});const Zt=Me(({loading:e,values:s,fields:a=[],errors:r,className:d="",onChange:o,onBlur:i,onFocus:l,slots:f,fieldIdPrefix:c})=>{const p=`${d}__field`,L=(t,h)=>{if(!(f!=null&&f[`AddressFormInput_${t.code}`]))return;const A={inputName:t.customUpperCode,handleOnChange:o,handleOnBlur:i,handleOnFocus:l,errorMessage:h,errors:r,config:t};return n(me,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:f[`AddressFormInput_${t.code}`],context:A},t.id)},Z=(t,h,A)=>{var b;const T=((b=t.options.find(H=>H.isDefault))==null?void 0:b.value)??h??t.defaultValue;return n(D,{children:L(t,A)??n(oe,{error:A,className:J([p,`${p}--${t.id}`,[`${p}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(Xe,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:c?`${c}_${t.code}`:t.code,required:t==null?void 0:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,options:t.options,onBlur:i,onFocus:l,handleSelect:o,defaultValue:T,value:T})},t.id)})},v=(t,h,A)=>n(D,{children:L(t,A)??n(oe,{error:A,className:J([p,`${p}--${t.id}`,[`${p}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(Ke,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:c?`${c}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:i,onFocus:l,onChange:o})},t.id)}),C=(t,h,A)=>n(D,{children:L(t,A)??n(oe,{error:A,className:J([p,`${p}--${t.id}`,[`${p}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(Ye,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:c?`${c}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:h||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o,disabled:e||t.disabled})},t.id)}),E=(t,h,A)=>n(D,{children:L(t,A)??n(oe,{error:A,className:J([p,`${p}--${t.id}`,[`${p}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:(t==null?void 0:t.isHidden)??e,children:n(we,{"aria-label":t.label,"aria-required":t.required?"true":"false","aria-hidden":t.isHidden,tabindex:t!=null&&t.isHidden?-1:0,id:c?`${c}_${t.code}`:t.code,name:t.customUpperCode,checked:h||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)}),N=(t,h,A)=>n(D,{children:L(t,A)??n(oe,{error:A,className:J([p,`${p}--${t.id}`,[`${p}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(Qe,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:c?`${c}_${t.code}`:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)});return a.length?n(D,{children:a.map(t=>{const h=r==null?void 0:r[t.customUpperCode],A=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case re.TEXT:return t.options.length?Z(t,A,h):v(t,A,h);case re.MULTILINE:return v(t,A,h);case re.SELECT:return Z(t,A,h);case re.DATE:return C(t,A,h);case re.BOOLEAN:return E(t,A,h);case re.TEXTAREA:return N(t,A,h);default:return null}})}):null}),je=({testId:e,withCard:s=!0})=>{const a=W(He,{"data-testid":e||"skeletonLoader",children:[n(P,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),n(P,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),n(P,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?a:n(Ae,{variant:"secondary",className:J(["account-account-loaders","account-account-loaders--card-loader"]),children:a})},St=()=>W(He,{"data-testid":"addressFormLoader",children:[n(P,{variant:"heading",size:"medium"}),n(P,{variant:"empty",size:"medium"}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large",fullWidth:!0}),n(P,{size:"large",fullWidth:!0,lines:3}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large"}),n(P,{size:"large",fullWidth:!0})]}),Ft=Me(ct(({setInputChange:e,showFormLoader:s,slots:a,name:r,loading:d,children:o,className:i="defaultForm",fieldsConfig:l,onSubmit:f,onChange:c,forwardFormRef:p,regionOptions:L,showSaveCheckBox:Z,handleSaveCheckBoxAddress:v,saveCheckBoxAddress:C,fieldIdPrefix:E})=>{const N=se({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:t,formData:h,errors:A,formRef:T,handleInputChange:b,handleBlur:H,handleSubmit:m,handleValidationSubmit:x,onFocus:z}=Tt({fieldsConfig:l,onSubmit:f,onChange:c,setInputChange:e,regionOptions:L,formName:r});return ut(p,()=>{const _=fe(T);return{handleValidationSubmit:x,formData:ne(_,!0),isDataValid:t}}),s||!(l!=null&&l.length)?n(St,{}):W("form",{className:J(["account-form",i]),onSubmit:m,name:r,ref:T,children:[n(Zt,{className:i,loading:d,fields:l,onChange:b,onBlur:H,errors:A,values:h,onFocus:z,slots:a,fieldIdPrefix:E}),a!=null&&a.AddressFormInputs?n(me,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:a.AddressFormInputs,context:{formActions:{handleChange:b}}}):null,Z?n("div",{className:"account-address-form--saveAddressBook",children:n(we,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:N.saveAddressBook,checked:C,onChange:_=>{b(_),v==null||v(_)}})}):null,o]})})),Oe=(e,s,a={},r="editButton")=>{const d=r==="removeButton",o={shippingAndBilling:{edit:a.editAddressAriaLabelShippingAndBilling,remove:a.removeAddressAriaLabelShippingAndBilling},shipping:{edit:a.editAddressAriaLabelShipping,remove:a.removeAddressAriaLabelShipping},billing:{edit:a.editAddressAriaLabelBilling,remove:a.removeAddressAriaLabelBilling},default:{edit:a.editAddressAriaLabelDefault,remove:a.removeAddressAriaLabelDefault}};let i="default";return e&&s?i="shippingAndBilling":e?i="shipping":s&&(i="billing"),d?o[i].remove:o[i].edit},ye=({slots:e,selectable:s,selectShipping:a,selectBilling:r,variant:d="secondary",minifiedView:o,keysSortOrder:i,addressData:l,loading:f,setAddressId:c,handleRenderModal:p,handleRenderForm:L})=>{const Z=pt(),v=o?"minifiedView":"fullSizeView",C=se({actionRemove:`Account.${v}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${v}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${v}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${v}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${v}.Addresses.addressCard.defaultLabelText`,editAddressAriaLabelDefault:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.default`,editAddressAriaLabelShipping:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.shipping`,editAddressAriaLabelBilling:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.billing`,editAddressAriaLabelShippingAndBilling:`Account.${v}.Addresses.addressCard.ariaLabel.editButton.shippingAndBilling`,removeAddressAriaLabelDefault:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.default`,removeAddressAriaLabelShipping:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.shipping`,removeAddressAriaLabelBilling:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.billing`,removeAddressAriaLabelShippingAndBilling:`Account.${v}.Addresses.addressCard.ariaLabel.removeButton.shippingAndBilling`}),E=C.cardLabelBilling.toLocaleUpperCase(),N=C.cardLabelShipping.toLocaleUpperCase(),t=C.defaultLabelText.toLocaleUpperCase(),h=Ce(()=>{const _={shippingLabel:N,billingLabel:E,hideShipping:!1,hideBilling:!1};return s?a&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!a?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:_:_},[E,t,N,r,a,s]),A=Ne(()=>{c==null||c(l==null?void 0:l.id),p==null||p()},[p,l==null?void 0:l.id,c]),T=Ne(()=>{c==null||c(l==null?void 0:l.id),L==null||L()},[L,l==null?void 0:l.id,c]),b=Ce(()=>{if(!i)return[];const{region:_,...k}=l,j={...k,..._};return i.filter(({name:u})=>j[u]).map(u=>({name:u.name,orderNumber:u.orderNumber,value:j[u.name],label:u.label}))},[l,i]),{shippingLabel:H,billingLabel:m,hideShipping:x,hideBilling:z}=h;return n(Ae,{variant:d,className:"account-address-card","data-testid":"addressCard",children:f?n(je,{}):W(D,{children:[W("div",{className:"account-address-card__action",children:[p?n(de,{type:"button",variant:"tertiary",onClick:A,"data-testid":"removeButton","aria-label":Oe(l==null?void 0:l.defaultShipping,l==null?void 0:l.defaultBilling,C,"removeButton"),"aria-describedby":Z,children:C.actionRemove}):null,L?n(de,{type:"button",variant:"tertiary",onClick:T,className:"account-address-card__action--editbutton","data-testid":"editButton","aria-label":Oe(l==null?void 0:l.defaultShipping,l==null?void 0:l.defaultBilling,C,"editButton"),"aria-describedby":Z,children:C.actionEdit}):null]}),n("div",{className:"account-address-card__description",id:Z,children:e!=null&&e.AddressCard?n(me,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:b}}):n(D,{children:b.map((_,k)=>{const j=_.label?`${_.label}: ${_==null?void 0:_.value}`:_==null?void 0:_.value;return n("p",{"data-testid":`${_.name}_${k}`,children:j},k)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?W("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?n(ue,{label:N}):null,l!=null&&l.defaultBilling?n(ue,{label:E}):null]}):null,s?W("div",{className:"account-address-card__labels",children:[!x&&(l!=null&&l.defaultShipping)?n(ue,{label:H}):null,!z&&(l!=null&&l.defaultBilling)?n(ue,{label:m}):null]}):null]})})},Ot=e=>G.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),It=e=>G.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},G.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),xt=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"currentColor"})),Bt=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),Ie=({selectable:e,className:s,addNewAddress:a,minifiedView:r,routeAddressesPage:d})=>{const o=r?"minifiedView":"fullSizeView",i=se({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=e?"span":"button",f=e?{}:{AriaRole:"button",type:"button"},c=r&&!a?i.viewAllAddressesButton:i.addNewAddressButton,p=e?i.differentAddressButton:c;return W(l,{...f,className:J(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:d,children:[n("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:p}),n(Re,{source:r&&!a?It:Ot,size:"32"})]})},wt=({minifiedView:e,keysSortOrder:s,addressData:a,open:r,submitLoading:d,onRemoveAddress:o,closeModal:i})=>{const l=e?"minifiedView":"fullSizeView",f=se({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return r?n(De,{className:"account-address-modal--overlay",title:n("h3",{children:f.title}),size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:i,children:W("div",{className:"account-address-modal",children:[d?n("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:n(et,{stroke:"4",size:"large"})}):null,n("p",{children:f.description}),n(ye,{minifiedView:e,addressData:a,keysSortOrder:s}),W("div",{className:"account-address-modal__buttons",children:[n(de,{type:"button",onClick:i,variant:"secondary",disabled:d,children:f.actionCancel}),n(de,{disabled:d,onClick:o,children:f.actionConfirm})]})]})}):null},Ht=({typeList:e,isEmpty:s,minifiedView:a,className:r})=>{const d=a?"minifiedView":"fullSizeView",o=se({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),i=Ce(()=>{switch(e){case"address":return{icon:xt,text:n("p",{children:o.addressesMessage})};case"orders":return{icon:Bt,text:n("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!i.text?null:n(tt,{className:J(["account-empty-list",a?"account-empty-list--minified":"",r]),message:i.text,icon:n(Re,{source:i.icon}),"data-testid":"emptyList"})},Rt=async(e,s)=>{if(s.length===1){const i=s[0],f=Object.values(i.region).every(p=>!!p)?{}:{region:{...i.region,regionId:0}};return!!await be({addressId:Number(i==null?void 0:i.id),defaultShipping:!1,defaultBilling:!1,...f})}const a=s.filter(i=>i.id!==e&&(i.defaultBilling||i.defaultShipping)||i.id!==e),r=s[s.length-1],d=a[0]||((r==null?void 0:r.id)!==e?r:null);return!d||!d.id?!1:!!await be({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},Vt=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing","fax","prefix","suffix","middlename"],dr=["email","firstname","lastname","middlename","gender","dob","prefix","suffix","fax"],We=(e,s,a)=>{if(s&&a||!s&&!a)return e;const r=e.slice();return s?r.sort((d,o)=>Number(o.defaultShipping)-Number(d.defaultShipping)):a?r.sort((d,o)=>Number(o.defaultBilling)-Number(d.defaultBilling)):e},ve=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(ve),zt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:a,onAddressData:r,minifiedView:d,routeAddressesPage:o,onSuccess:i})=>{const[l,f]=w(""),[c,p]=w(!1),[L,Z]=w(!1),[v,C]=w(!1),[E,N]=w(!1),[t,h]=w(!1),[A,T]=w(""),[b,H]=w([]),[m,x]=w([]),z=q(async()=>{C(!0),Promise.all([ke("shortRequest"),nt()]).then(g=>{const[O,I]=g;if(O){const V=O.map(({name:y,orderNumber:R,label:B})=>({name:dt(y),orderNumber:R,label:Vt.includes(y)?null:B}));x(V)}if(I)if(d){const V=I.filter(R=>!!R.defaultShipping||!!R.defaultBilling),y=V.length?V:I.slice(-1);H(y)}else H(I)}).finally(()=>{C(!1)})},[d]);te(()=>{z()},[z]),te(()=>{var g;if(b.length)if(a===0)h(!0),f("0");else{const O=b.find(V=>+V.id===a)||We(b,e,s)[0],I={data:ne(O),isDataValid:!ve(O)};f(a.toString()||((g=O==null?void 0:O.id)==null?void 0:g.toString())),r==null||r(I)}},[b,a,r,s,e]);const _=q(g=>{T(g),h(!1)},[]),k=q((g,O)=>{const I=(g==null?void 0:g.target).value,V=(g==null?void 0:g.target).nextSibling;f(I);const y={data:ne(O),isDataValid:!ve(ne(O))};r==null||r(y),h(I==="0"),V&&(V.focus(),window.scrollBy(0,100))},[r]),j=q(()=>{Z(!0)},[]),u=q(()=>{T(""),Z(!1),p(!1)},[]),$=q(()=>{p(!0)},[]),M=q(async()=>{N(!0),await Rt(A,b),ot(+A).then(()=>{z(),u()}).finally(()=>{N(!1)})},[b,A,u,z]),S=q(()=>{h(!1)},[]),F=q(()=>{qe(o)&&d&&!t?window.location.href=o():(h(!0),T(""))},[t,o,d]),U=q(async()=>{await z(),await(i==null?void 0:i())},[z,i]);return{keysSortOrder:m,submitLoading:E,isModalRendered:c,isFormRendered:L,loading:v,addNewAddress:t,addressesList:b,addressId:A,handleRenderForm:j,handleRenderModal:$,removeAddress:M,onCloseBtnClick:u,setEditingAddressId:_,closeNewAddressForm:S,redirectToAddressesRoute:F,handleOnSuccess:U,handleSelectAddressOption:k,selectedAddressOption:l}},or=Me(({minifiedViewKey:e,hideActionFormButtons:s=!1,inputName:a,slots:r,title:d="",addressFormTitle:o="",defaultSelectAddressId:i="",showFormLoader:l=!1,onAddressData:f,forwardFormRef:c,className:p,showSaveCheckBox:L=!1,saveCheckBoxValue:Z=!1,selectShipping:v=!1,selectBilling:C=!1,selectable:E=!1,withHeader:N=!0,minifiedView:t=!1,withActionsInMinifiedView:h=!1,withActionsInFullSizeView:A=!0,inputsDefaultValueSet:T,showShippingCheckBox:b=!0,showBillingCheckBox:H=!0,shippingCheckBoxValue:m=!0,billingCheckBoxValue:x=!0,routeAddressesPage:z,onSuccess:_,onError:k})=>{const j=se({containerTitle:`Account.${e}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${e}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${e}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${e}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${e}.Addresses.newAddressFormTitle`,ariaLabelAddressPicker:`Account.${e}.Addresses.ariaLabelAddressPicker`}),{keysSortOrder:u,submitLoading:$,isModalRendered:M,isFormRendered:S,loading:F,addNewAddress:U,addressesList:g,addressId:O,handleRenderForm:I,handleRenderModal:V,removeAddress:y,onCloseBtnClick:R,handleOnSuccess:B,setEditingAddressId:Y,closeNewAddressForm:X,redirectToAddressesRoute:K,handleSelectAddressOption:ie,selectedAddressOption:$e}=zt({defaultSelectAddressId:i,minifiedView:t,routeAddressesPage:z,onSuccess:_,onAddressData:f,selectShipping:v,selectBilling:C}),ce=d||j.containerTitle;let he=null;if(E){const Q=We(g,v,C)||[];let ae;U?ae=n("div",{className:J(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",U]]),children:n(pe,{slots:r,hideActionFormButtons:s,formName:a,showFormLoader:l,isOpen:U,forwardFormRef:c,showSaveCheckBox:L,saveCheckBoxValue:Z,shippingCheckBoxValue:m,billingCheckBoxValue:x,addressesFormTitle:o||j.differentAddressFormTitle,inputsDefaultValueSet:T,showShippingCheckBox:b,showBillingCheckBox:H,onCloseBtnClick:X,onSuccess:B,onError:k,onChange:f})}):Q.length?ae=n(Ie,{selectable:E,minifiedView:t,addNewAddress:U,routeAddressesPage:K}):ae=null;const _e=`generalLabel_${ce.replace(/\s+/g,"")}`;he=W("div",{className:"account-addresses-wrapper--select-view",children:[n("span",{id:_e,style:"display: none;",children:ce}),Q.map((ee,Ge)=>{const Le=`${a}_${ee.id}`,Ee=`${Le}_label`;return W(Te,{children:[n("input",{"data-testid":`radio-${Ge+1}`,type:"radio",name:a,id:Le,value:ee.id,checked:$e===(ee==null?void 0:ee.id.toString()),onChange:Je=>ie(Je,ee),"aria-labelledby":`${_e} ${Ee}`}),n("label",{id:Ee,htmlFor:Le,className:"account-addresses-wrapper__label",children:n(ye,{slots:r,selectable:E,selectShipping:v,selectBilling:C,minifiedView:t,addressData:ee,keysSortOrder:u,loading:F})})]},ee.id)}),ae&&W("div",{className:"account-addresses-wrapper__footer-section",children:[n("input",{"aria-label":`${ce} ${j.ariaLabelAddressPicker}`,"data-testid":"radio-0",type:"radio",name:a,id:`${a}_addressActions`,value:"0",checked:$e==="0",onChange:ee=>ie(ee,{}),tabindex:ae?0:-1}),n("label",{htmlFor:`${a}_addressActions`,className:"account-addresses-wrapper__label",children:ae})]})]})}else he=W(D,{children:[g.map(Q=>n(Te,{children:O===Q.id&&S?n(Ae,{variant:"secondary",style:{marginBottom:20},children:n(pe,{slots:r,isOpen:O===Q.id&&S,addressFormId:O,inputsDefaultValueSet:Q,addressesFormTitle:j.editAddressFormTitle,showShippingCheckBox:b,showBillingCheckBox:H,shippingCheckBoxValue:m,billingCheckBoxValue:x,onCloseBtnClick:R,onSuccess:B,onError:k})}):n(ye,{slots:r,minifiedView:t,addressData:Q,keysSortOrder:u,loading:F,setAddressId:Y,handleRenderModal:t&&h||!t&&A?V:void 0,handleRenderForm:t&&h||!t&&A?I:void 0},Q.id)},Q.id)),n("div",{className:"account-addresses__footer",children:U?n(Ae,{variant:"secondary",children:n(pe,{slots:r,isOpen:U,addressesFormTitle:j.newAddressFormTitle,inputsDefaultValueSet:T,showShippingCheckBox:!!(g!=null&&g.length),showBillingCheckBox:!!(g!=null&&g.length),shippingCheckBoxValue:m,billingCheckBoxValue:x,onCloseBtnClick:X,onSuccess:B,onError:k})}):n(Ie,{minifiedView:t,addNewAddress:U,routeAddressesPage:K})})]});return W("div",{children:[N?n(rt,{title:ce,divider:!t,className:t?"account-addresses-header":""}):null,W("div",{className:J(["account-addresses-wrapper",p]),"data-testid":"addressesIdWrapper",children:[n(wt,{minifiedView:t,addressData:g==null?void 0:g.find(Q=>Q.id===O),keysSortOrder:u,submitLoading:$,open:M,closeModal:R,onRemoveAddress:y}),F?n(je,{testId:"addressSkeletonLoader",withCard:!1}):E?n(pe,{slots:r,hideActionFormButtons:s,formName:a,isOpen:!(g!=null&&g.length),forwardFormRef:c,showSaveCheckBox:L,saveCheckBoxValue:Z,shippingCheckBoxValue:m,billingCheckBoxValue:x,inputsDefaultValueSet:T,showShippingCheckBox:b,showBillingCheckBox:H,onCloseBtnClick:X,onSuccess:B,onError:k,onChange:f}):n(Ht,{isEmpty:!(g!=null&&g.length),typeList:"address",minifiedView:t}),he]})]})}),Pe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:re.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},kt={...Pe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ut={...Pe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},qt=(e,s)=>s==null?void 0:s.map(a=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName,middleName:e.middlename??e.middleName},d=JSON.parse(JSON.stringify(a));if(Object.hasOwn(r,a.customUpperCode)){const o=r[a.customUpperCode];a.customUpperCode==="region"&&typeof o=="object"?d.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:d.defaultValue=o}return d}),xe=e=>{if(!e)return null;const s=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(r=>{s.has(r.name)||s.set(r.name,"false"),r.checked&&s.set(r.name,"true")}),s&&typeof s.entries=="function"){const r=s.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},jt=({fields:e,addressId:s,countryOptions:a,disableField:r,regionOptions:d,isRequiredRegion:o,isRequiredPostCode:i})=>e.filter(f=>!(s&&(f.customUpperCode==="defaultShipping"||f.customUpperCode==="defaultBilling")&&f.defaultValue)).map(f=>f.customUpperCode==="countryCode"?{...f,options:a,disabled:r}:f.customUpperCode==="postcode"?{...f,required:i}:f.customUpperCode==="region"?{...f,options:d,required:o,disabled:r}:f),Wt=(e,s="address")=>{const a=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","prefix","suffix","fax"],r={},d=[];return Object.keys(e).forEach(o=>{a.includes(o)?r[o]=e[o]:d.push({attribute_code:ze(o),value:e[o]})}),d.length>0&&(r.custom_attributesV2=d),r},Be=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],a=["on","off","true","false"],r=[],d={};for(const C in e){const E=e[C];a.includes(E)&&(d[C]=Ue(E)),s.includes(C)&&r.push(E)}const{street:o,streetMultiline_2:i,streetMultiline_1:l,region:f,...c}=e,[p,L]=f?f.split(","):[void 0,void 0],Z=L&&p?{regionId:+L,regionCode:p}:{region:p};return Wt({...c,...d,region:{...Z},street:r})},Pt=(e,s)=>{const a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r];if(r==="region"&&d.regionId){const o=s.find(i=>(i==null?void 0:i.id)===d.regionId);o?a[r]={...d,text:o.text}:a[r]=d}else Array.isArray(d)?(a[r]=d[0]||"",d.slice(1).forEach((o,i)=>{a[`${r}Multiline_${i+2}`]=o})):a[r]=d}return a},Gt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Jt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:a,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:o,showShippingCheckBox:i,showBillingCheckBox:l,inputsDefaultValueSet:f,onCloseBtnClick:c,onSuccess:p,onError:L,formName:Z})=>{const[v,C]=w({text:"",type:"success"}),[E,N]=w(e??!1),[t,h]=w(r||""),[A,T]=w([]),[b,H]=w(null),[m,x]=w(()=>{var R,B;const y=sessionStorage.getItem(`${Z}_addressData`);return y?{countryCode:(B=(R=JSON.parse(y))==null?void 0:R.data)==null?void 0:B.countryCode}:f}),[z,_]=w(!1),[k,j]=w(()=>{var B,Y;const y=sessionStorage.getItem(`${Z}_addressData`);return y?(Y=(B=JSON.parse(y))==null?void 0:B.data)==null?void 0:Y.saveAddressBook:a}),u=q(y=>{j(y.target.checked)},[]);te(()=>{typeof e>"u"||N(e)},[e]),te(()=>{ke(t?"customer_address_edit":"customer_register_address").then(y=>{T(y)})},[t]),te(()=>{_(!0),lt().then(({availableCountries:y,countriesWithRequiredRegion:R,optionalZipCountries:B})=>{H({availableCountries:y,countriesWithRequiredRegion:R,optionalZipCountries:B}),_(!1)})},[]);const $=le(()=>(b==null?void 0:b.availableCountries)||[],[b]),M=le(()=>!(m!=null&&m.countryCode)||!b?!1:b.countriesWithRequiredRegion.includes(m.countryCode),[m==null?void 0:m.countryCode,b]),S=le(()=>!(m!=null&&m.countryCode)||!b?!0:!b.optionalZipCountries.includes(m.countryCode),[m==null?void 0:m.countryCode,b]),F=le(()=>{var R;if(!(m!=null&&m.countryCode)||!b)return[];const y=b.availableCountries.find(B=>B.value===m.countryCode);return((R=y==null?void 0:y.availableRegions)==null?void 0:R.map(B=>({text:B.name,value:`${B.code},${B.id}`})))||[]},[m==null?void 0:m.countryCode,b]),U=q(()=>{C({text:"",type:"success"}),c==null||c()},[c]),g=q(async(y,R)=>{if(!R)return null;N(!0);const B=xe(y.target),Y=Be(B);await be(Y).then(()=>{var X;p==null||p(),c==null||c(),(X=y==null?void 0:y.target)==null||X.reset()}).catch(X=>{C(K=>({...K,text:X.message,type:"error"})),L==null||L(X)}).finally(()=>{h(""),N(!1)})},[c,L,p]),O=q(async(y,R)=>{if(!R)return;N(!0);const{saveAddressBook:B,...Y}=xe(y.target),X=Be(Y);await it(X).then(()=>{var K;p==null||p(),c==null||c(),(K=y==null?void 0:y.target)==null||K.reset()}).catch(K=>{C(ie=>({...ie,text:K.message,type:"error"})),L==null||L(K)}).finally(()=>{h(""),N(!1)})},[c,L,p]),I=le(()=>{if(!A.length)return[];const y={...kt,defaultValue:o??!1,isHidden:s&&!k?!0:!i},R={...Ut,defaultValue:d??!1,isHidden:s&&!k?!0:!l},B=[...A,y,R],Y=sessionStorage.getItem(`${Z}_addressData`),X=Y?Pt(JSON.parse(Y).data,F):{},K=qt(Gt(X,f),B);return jt({fields:K,addressId:t,countryOptions:$,disableField:z,regionOptions:F,isRequiredRegion:M,isRequiredPostCode:S})},[A,o,s,k,i,d,l,Z,F,f,t,$,z,M,S]),V=q(y=>{x(R=>({...R,...y}))},[]);return{regionOptions:F,saveCheckBoxAddress:k,inLineAlert:v,addressId:t,submitLoading:E,normalizeFieldsConfig:I,handleSaveCheckBoxAddress:u,handleUpdateAddress:g,handleCreateAddress:O,handleOnCloseForm:U,handleInputChange:V}},Xt=e=>{var d;if(!e||!Array.isArray(e.customAttributes))return e??{};const s={};(d=e==null?void 0:e.customAttributes)==null||d.forEach(o=>{o.code&&Object.hasOwn(o,"value")&&(s[o.code]=o.value)});const{customAttributes:a,...r}=e;return{...r,...Ve(s,"camelCase",{})}},Kt=({hideActionFormButtons:e,formName:s="",showFormLoader:a=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:o,slots:i,addressesFormTitle:l,className:f,addressFormId:c,inputsDefaultValueSet:p,showShippingCheckBox:L=!0,showBillingCheckBox:Z=!0,shippingCheckBoxValue:v=!0,billingCheckBoxValue:C=!0,isOpen:E,fieldIdPrefix:N,onSubmit:t,onCloseBtnClick:h,onSuccess:A,onError:T,onChange:b})=>{const H=se({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{inLineAlert:m,addressId:x,submitLoading:z,normalizeFieldsConfig:_,handleUpdateAddress:k,handleCreateAddress:j,handleOnCloseForm:u,handleSaveCheckBoxAddress:$,saveCheckBoxAddress:M,handleInputChange:S,regionOptions:F}=Jt({showFormLoader:a,addressFormId:c,inputsDefaultValueSet:Xt(p),shippingCheckBoxValue:v,billingCheckBoxValue:C,showShippingCheckBox:L,showBillingCheckBox:Z,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:A,onError:T,onCloseBtnClick:h,formName:s});return E?W("div",{className:J(["account-address-form-wrapper",f]),children:[l?n("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,m.text?n(st,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:m.type,variant:"secondary",heading:m.text,icon:m.icon}):null,W(Ft,{regionOptions:F,forwardFormRef:o,slots:i,className:"account-address-form",name:s||"addressesForm",fieldsConfig:_,onSubmit:t||(x?k:j),setInputChange:S,loading:z,showFormLoader:a,showSaveCheckBox:r,handleSaveCheckBoxAddress:$,saveCheckBoxAddress:M,onChange:b,fieldIdPrefix:N,children:[x?n("input",{type:"hidden",name:"addressId",value:x,"data-testid":"hidden_test_id"}):null,e?null:n("div",{className:J(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:i!=null&&i.AddressFormActions?n(me,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:i.AddressFormActions,context:{handleUpdateAddress:k,handleCreateAddress:j,addressId:x}}):n(D,{children:r?null:W(D,{children:[n(de,{type:"button",onClick:u,variant:"secondary",disabled:z,children:H.secondaryButton}),n(de,{disabled:z,children:H.primaryButton})]})})})]})]}):null};export{pe as A,je as C,Ht as E,Ft as F,It as S,or as a,qe as c,dr as d,xe as g,Wt as n};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{t as H,f as Y,k as j}from"./removeCustomerAddress.js";import{c as J}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as K}from"@dropins/tools/lib.js";import{ADDRESS_FRAGMENT as Q,ORDER_SUMMARY_FRAGMENT as B}from"../fragments.js";const V=(a,o="en-US",s={})=>{const d={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},u=new Date(a);return isNaN(u.getTime())?"Invalid Date":new Intl.DateTimeFormat(o,d).format(u)},_={value:0,currency:"USD"},W=a=>{var o,s,c,d,u,g,f,n,l;return{subtotal:((o=a==null?void 0:a.total)==null?void 0:o.subtotal)??_,grandTotal:((s=a==null?void 0:a.total)==null?void 0:s.grand_total)??_,totalGiftcard:((c=a==null?void 0:a.total)==null?void 0:c.total_giftcard)??_,subtotalExclTax:((d=a==null?void 0:a.total)==null?void 0:d.subtotal_excl_tax)??_,subtotalInclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_incl_tax)??_,taxes:((g=a==null?void 0:a.total)==null?void 0:g.taxes)??[],totalTax:((f=a==null?void 0:a.total)==null?void 0:f.total_tax)??_,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??_,discounts:((l=a==null?void 0:a.total)==null?void 0:l.discounts)??[]}},X=a=>{var d,u,g,f,n,l,p,h,S,y,T,E,R,O,D,b,A,I,M,k,x,N,q,G,$,C,F,v,i,z;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const o=((f=(g=a==null?void 0:a.data)==null?void 0:g.customer)==null?void 0:f.returns)??[],c={items:(((p=(l=(n=a==null?void 0:a.data)==null?void 0:n.customer)==null?void 0:l.orders)==null?void 0:p.items)??[]).map(r=>{var P;return{items:r==null?void 0:r.items.map(t=>{var U,w,L;return{status:(t==null?void 0:t.status)??"",productName:(t==null?void 0:t.product_name)??"",id:t==null?void 0:t.id,quantityOrdered:(t==null?void 0:t.quantity_ordered)??0,quantityShipped:(t==null?void 0:t.quantity_shipped)??0,quantityInvoiced:(t==null?void 0:t.quantity_invoiced)??0,product:{sku:((U=t==null?void 0:t.product)==null?void 0:U.sku)??"",urlKey:(t==null?void 0:t.product.url_key)??"",smallImage:{url:((L=(w=t==null?void 0:t.product)==null?void 0:w.small_image)==null?void 0:L.url)??""}}}}),token:r==null?void 0:r.token,email:r==null?void 0:r.email,shippingMethod:r==null?void 0:r.shipping_method,paymentMethods:(r==null?void 0:r.payment_methods)??[],shipments:(r==null?void 0:r.shipments)??[],id:r==null?void 0:r.id,carrier:r==null?void 0:r.carrier,status:r==null?void 0:r.status,number:r==null?void 0:r.number,returns:(P=o==null?void 0:o.items)==null?void 0:P.filter(t=>t.order.id===r.id),orderDate:V(r.order_date),shippingAddress:H(r.shipping_address),billingAddress:H(r.billing_address),total:W(r)}}),pageInfo:{pageSize:((T=(y=(S=(h=a==null?void 0:a.data)==null?void 0:h.customer)==null?void 0:S.orders)==null?void 0:y.page_info)==null?void 0:T.page_size)??10,totalPages:((D=(O=(R=(E=a==null?void 0:a.data)==null?void 0:E.customer)==null?void 0:R.orders)==null?void 0:O.page_info)==null?void 0:D.total_pages)??1,currentPage:((M=(I=(A=(b=a==null?void 0:a.data)==null?void 0:b.customer)==null?void 0:A.orders)==null?void 0:I.page_info)==null?void 0:M.current_page)??1},totalCount:((N=(x=(k=a==null?void 0:a.data)==null?void 0:k.customer)==null?void 0:x.orders)==null?void 0:N.total_count)??0,dateOfFirstOrder:(($=(G=(q=a==null?void 0:a.data)==null?void 0:q.customer)==null?void 0:G.orders)==null?void 0:$.date_of_first_order)??""};return K(c,(z=(i=(v=(F=(C=J)==null?void 0:C.getConfig())==null?void 0:F.models)==null?void 0:v.OrderHistoryModel)==null?void 0:i.transformer)==null?void 0:z.call(i,a.data))},Z=`
3
+ import{t as H,f as Y,a as j}from"./removeCustomerAddress.js";import{c as J}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as K}from"@dropins/tools/lib.js";import{ADDRESS_FRAGMENT as Q,ORDER_SUMMARY_FRAGMENT as B}from"../fragments.js";const V=(a,o="en-US",s={})=>{const d={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},u=new Date(a);return isNaN(u.getTime())?"Invalid Date":new Intl.DateTimeFormat(o,d).format(u)},_={value:0,currency:"USD"},W=a=>{var o,s,c,d,u,g,f,n,l;return{subtotal:((o=a==null?void 0:a.total)==null?void 0:o.subtotal)??_,grandTotal:((s=a==null?void 0:a.total)==null?void 0:s.grand_total)??_,totalGiftcard:((c=a==null?void 0:a.total)==null?void 0:c.total_giftcard)??_,subtotalExclTax:((d=a==null?void 0:a.total)==null?void 0:d.subtotal_excl_tax)??_,subtotalInclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_incl_tax)??_,taxes:((g=a==null?void 0:a.total)==null?void 0:g.taxes)??[],totalTax:((f=a==null?void 0:a.total)==null?void 0:f.total_tax)??_,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??_,discounts:((l=a==null?void 0:a.total)==null?void 0:l.discounts)??[]}},X=a=>{var d,u,g,f,n,l,p,h,S,y,T,E,R,O,D,b,A,I,M,x,N,k,q,G,$,C,F,v,i,z;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const o=((f=(g=a==null?void 0:a.data)==null?void 0:g.customer)==null?void 0:f.returns)??[],c={items:(((p=(l=(n=a==null?void 0:a.data)==null?void 0:n.customer)==null?void 0:l.orders)==null?void 0:p.items)??[]).map(r=>{var P;return{items:r==null?void 0:r.items.map(t=>{var U,w,L;return{status:(t==null?void 0:t.status)??"",productName:(t==null?void 0:t.product_name)??"",id:t==null?void 0:t.id,quantityOrdered:(t==null?void 0:t.quantity_ordered)??0,quantityShipped:(t==null?void 0:t.quantity_shipped)??0,quantityInvoiced:(t==null?void 0:t.quantity_invoiced)??0,product:{sku:((U=t==null?void 0:t.product)==null?void 0:U.sku)??"",urlKey:(t==null?void 0:t.product.url_key)??"",smallImage:{url:((L=(w=t==null?void 0:t.product)==null?void 0:w.small_image)==null?void 0:L.url)??""}}}}),token:r==null?void 0:r.token,email:r==null?void 0:r.email,shippingMethod:r==null?void 0:r.shipping_method,paymentMethods:(r==null?void 0:r.payment_methods)??[],shipments:(r==null?void 0:r.shipments)??[],id:r==null?void 0:r.id,carrier:r==null?void 0:r.carrier,status:r==null?void 0:r.status,number:r==null?void 0:r.number,returns:(P=o==null?void 0:o.items)==null?void 0:P.filter(t=>t.order.id===r.id),orderDate:V(r.order_date),shippingAddress:H(r.shipping_address),billingAddress:H(r.billing_address),total:W(r)}}),pageInfo:{pageSize:((T=(y=(S=(h=a==null?void 0:a.data)==null?void 0:h.customer)==null?void 0:S.orders)==null?void 0:y.page_info)==null?void 0:T.page_size)??10,totalPages:((D=(O=(R=(E=a==null?void 0:a.data)==null?void 0:E.customer)==null?void 0:R.orders)==null?void 0:O.page_info)==null?void 0:D.total_pages)??1,currentPage:((M=(I=(A=(b=a==null?void 0:a.data)==null?void 0:b.customer)==null?void 0:A.orders)==null?void 0:I.page_info)==null?void 0:M.current_page)??1},totalCount:((k=(N=(x=a==null?void 0:a.data)==null?void 0:x.customer)==null?void 0:N.orders)==null?void 0:k.total_count)??0,dateOfFirstOrder:(($=(G=(q=a==null?void 0:a.data)==null?void 0:q.customer)==null?void 0:G.orders)==null?void 0:$.date_of_first_order)??""};return K(c,(z=(i=(v=(F=(C=J)==null?void 0:C.getConfig())==null?void 0:F.models)==null?void 0:v.OrderHistoryModel)==null?void 0:i.transformer)==null?void 0:z.call(i,a.data))},Z=`
4
4
  query GET_CUSTOMER_ORDERS_LIST(
5
5
  $currentPage: Int
6
6
  $pageSize: Int
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{Initializer as d}from"@dropins/tools/lib.js";import{f as h,l as g,k as l}from"./removeCustomerAddress.js";const _=new d({init:async t=>{const a={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};_.config.setConfig({...a,...t})},listeners:()=>[]}),G=_.config,m=t=>{var a,r,i,o,e,c,n,f;return{baseMediaUrl:(r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.base_media_url,minLength:+((o=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:o.minimum_password_length)||3,requiredCharacterClasses:+((c=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:c.required_character_classes_number)||0,storeCode:((f=(n=t==null?void 0:t.data)==null?void 0:n.storeConfig)==null?void 0:f.store_code)??""}},u=`
3
+ import{Initializer as d}from"@dropins/tools/lib.js";import{f as h,h as g,a as m}from"./removeCustomerAddress.js";const _=new d({init:async t=>{const a={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};_.config.setConfig({...a,...t})},listeners:()=>[]}),G=_.config,u=t=>{var a,r,i,o,e,c,n,f;return{baseMediaUrl:(r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.base_media_url,minLength:+((o=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:o.minimum_password_length)||3,requiredCharacterClasses:+((c=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:c.required_character_classes_number)||0,storeCode:((f=(n=t==null?void 0:t.data)==null?void 0:n.storeConfig)==null?void 0:f.store_code)??""}},l=`
4
4
  query GET_STORE_CONFIG {
5
5
  storeConfig {
6
6
  base_media_url
@@ -10,4 +10,4 @@ import{Initializer as d}from"@dropins/tools/lib.js";import{f as h,l as g,k as l}
10
10
  store_code
11
11
  }
12
12
  }
13
- `,b=async()=>await h(u,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?g(t.errors):m(t)}).catch(l);export{G as c,b as g,_ as i};
13
+ `,b=async()=>await h(l,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?g(t.errors):u(t)}).catch(m);export{G as c,b as g,_ as i};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as E}from"@dropins/tools/fetch-graphql.js";const m=t=>t.replace(/_([a-z])/g,(r,n)=>n.toUpperCase()),S=t=>t.replace(/([A-Z])/g,r=>`_${r.toLowerCase()}`),h=(t,r,n)=>{const o=["string","boolean","number"],u=r==="camelCase"?m:S;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?h(i,r,n):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const e=n&&n[c]?n[c]:u(c);return i[e]=o.includes(typeof a)||a===null?a:h(a,r,n),i},{}):t},{setEndpoint:Q,setFetchGraphQlHeader:j,removeFetchGraphQlHeader:k,setFetchGraphQlHeaders:J,fetchGraphQl:s,getConfig:K}=new E().getMethods(),p=`
3
+ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const b=t=>t.replace(/_([a-z])/g,(r,n)=>n.toUpperCase()),S=t=>t.replace(/([A-Z])/g,r=>`_${r.toLowerCase()}`),g=(t,r,n)=>{const o=["string","boolean","number"],u=r==="camelCase"?b:S;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?g(i,r,n):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const e=n&&n[c]?n[c]:u(c);return i[e]=o.includes(typeof a)||a===null?a:g(a,r,n),i},{}):t},{setEndpoint:j,setFetchGraphQlHeader:k,removeFetchGraphQlHeader:L,setFetchGraphQlHeaders:P,fetchGraphQl:s,getConfig:J}=new C().getMethods(),A=`
4
4
  query GET_ATTRIBUTES_FORM($formCode: String!) {
5
5
  attributesForm(formCode: $formCode) {
6
6
  items {
@@ -32,7 +32,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as E}fr
32
32
  }
33
33
  }
34
34
  }
35
- `,C=`
35
+ `,T=`
36
36
  query GET_ATTRIBUTES_FORM_SHORT {
37
37
  attributesForm(formCode: "customer_register_address") {
38
38
  items {
@@ -46,13 +46,13 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as E}fr
46
46
  }
47
47
  }
48
48
  }
49
- `,f=t=>{throw t instanceof DOMException&&t.name==="AbortError"||b.emit("error",{source:"auth",type:"network",error:t}),t},_=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},T=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},y=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return m(t)}},A=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},R=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const g=e!=="country_id"?e:"country_code";return{...l,name:g,id:g,code:g}}),o=T(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:A(e),customUpperCode:y(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},v=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},N=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),O=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??""}),I=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return h({...N(t),...O(t),...I(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...v(t)},"camelCase",{})},U=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},G=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:g}=e;return{value:l,text:g}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},M=t=>{var n,o;return(o=(n=t==null?void 0:t.data)==null?void 0:n.country)!=null&&o.available_regions?t.data.country.available_regions.filter(u=>{if(!u)return!1;const{id:i,code:c,name:a}=u;return!!(i&&c&&a)}).map(u=>{const{id:i}=u;return{id:i,text:u.name,value:`${u.code},${u.id}`}}):[]},L=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?p:C,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return _(o.errors);const u=R(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(f)},w=`
49
+ `,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||E.emit("error",{source:"auth",type:"network",error:t}),t},f=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},y=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},R=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return b(t)}},v=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},N=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const h=e!=="country_id"?e:"country_code";return{...l,name:h,id:h,code:h}}),o=y(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:v(e),customUpperCode:R(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},O=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},I=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),U=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??""}),M=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return g({...I(t),...U(t),...M(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...O(t)},"camelCase",{})},w=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},q=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:h,available_regions:m}=e,p=Array.isArray(m)&&m.length>0;return{value:l,text:h,availableRegions:p?m:void 0}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},K=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?A:T,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return f(o.errors);const u=N(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(_)},x=`
50
50
  mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
51
51
  createCustomerAddress(input: $input) {
52
52
  firstname
53
53
  }
54
54
  }
55
- `,P=async t=>await s(w,{method:"POST",variables:{input:h(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var n,o,u;return(n=r.errors)!=null&&n.length?_(r.errors):((u=(o=r==null?void 0:r.data)==null?void 0:o.createCustomerAddress)==null?void 0:u.firstname)||""}).catch(f),q=`
55
+ `,z=async t=>await s(x,{method:"POST",variables:{input:g(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var n,o,u;return(n=r.errors)!=null&&n.length?f(r.errors):((u=(o=r==null?void 0:r.data)==null?void 0:o.createCustomerAddress)==null?void 0:u.firstname)||""}).catch(_),F=`
56
56
  query GET_CUSTOMER_ADDRESS {
57
57
  customer {
58
58
  addresses {
@@ -86,36 +86,30 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as E}fr
86
86
  }
87
87
  }
88
88
  }
89
- `,z=async()=>await s(q,{method:"GET",cache:"no-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?_(t.errors):U(t)}).catch(f),x=`
89
+ `,Z=async()=>await s(F,{method:"GET",cache:"no-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?f(t.errors):w(t)}).catch(_),G=`
90
90
  query GET_COUNTRIES_QUERY {
91
91
  countries {
92
92
  two_letter_abbreviation
93
93
  full_name_locale
94
- }
95
- storeConfig {
96
- countries_with_required_region
97
- optional_zip_countries
98
- }
99
- }
100
- `,Z=async()=>{const t="_account_countries",r=sessionStorage.getItem(t);return r?JSON.parse(r):await s(x,{method:"GET",cache:"no-cache"}).then(n=>{var u;if((u=n.errors)!=null&&u.length)return _(n.errors);const o=G(n);return sessionStorage.setItem(t,JSON.stringify(o)),o}).catch(f)},F=`
101
- query GET_REGIONS($countryCode: String!) {
102
- country(id: $countryCode) {
103
- id
104
94
  available_regions {
105
95
  id
106
96
  code
107
97
  name
108
98
  }
109
99
  }
100
+ storeConfig {
101
+ countries_with_required_region
102
+ optional_zip_countries
103
+ }
110
104
  }
111
- `,W=async t=>{const r=`_account_regions_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(F,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return _(o.errors);const u=M(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(f)},d=`
105
+ `,W=async()=>{const t="_account_countries",r=sessionStorage.getItem(t);return r?JSON.parse(r):await s(G,{method:"GET",cache:"no-cache"}).then(n=>{var u;if((u=n.errors)!=null&&u.length)return f(n.errors);const o=q(n);return sessionStorage.setItem(t,JSON.stringify(o)),o}).catch(_)},V=`
112
106
  mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {
113
107
  updateCustomerAddress(id: $id, input: $input) {
114
108
  firstname
115
109
  }
116
110
  }
117
- `,Y=async t=>{const{addressId:r,...n}=t;return r?await s(d,{method:"POST",variables:{id:r,input:h(n,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(o=>{var u,i,c;return(u=o.errors)!=null&&u.length?_(o.errors):((c=(i=o==null?void 0:o.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(f):""},V=`
111
+ `,Y=async t=>{const{addressId:r,...n}=t;return r?await s(V,{method:"POST",variables:{id:Number(r),input:g(n,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(o=>{var u,i,c;return(u=o.errors)!=null&&u.length?f(o.errors):((c=(i=o==null?void 0:o.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(_):""},B=`
118
112
  mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {
119
113
  deleteCustomerAddress(id: $id)
120
114
  }
121
- `,X=async t=>await s(V,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?_(r.errors):r.data.deleteCustomerAddress}).catch(f);export{j as a,J as b,L as c,P as d,z as e,s as f,K as g,Z as h,W as i,X as j,f as k,_ as l,m,h as n,S as o,k as r,Q as s,$ as t,Y as u};
115
+ `,d=async t=>await s(B,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?f(r.errors):r.data.deleteCustomerAddress}).catch(_);export{_ as a,k as b,P as c,K as d,z as e,s as f,J as g,f as h,Z as i,W as j,d as k,b as l,g as m,S as n,L as r,j as s,$ as t,Y as u};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{m as y,f as C,l as o,k as h,n as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";const B=t=>{var r,u,i,d,_,f,E,S,T,w,e,g,O,P,A,M,U,R,b,N,$,G,v,D,c,I;const m=(i=(u=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:u.custom_attributes)==null?void 0:i.filter(l=>l).reduce((l,n)=>(l[y(n.code)]=n.value??"",l),{}),a={email:((_=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:_.email)||"",firstName:((E=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:E.firstname)||"",lastName:((T=(S=t==null?void 0:t.data)==null?void 0:S.customer)==null?void 0:T.lastname)||"",middleName:((e=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:e.middlename)||"",gender:((O=(g=t==null?void 0:t.data)==null?void 0:g.customer)==null?void 0:O.gender)||"1",dateOfBirth:((A=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:A.date_of_birth)||"",prefix:((U=(M=t==null?void 0:t.data)==null?void 0:M.customer)==null?void 0:U.prefix)||"",suffix:((b=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:b.suffix)||"",createdAt:(($=(N=t==null?void 0:t.data)==null?void 0:N.customer)==null?void 0:$.created_at)||"",...m};return k(a,(I=(c=(D=(v=(G=V)==null?void 0:G.getConfig())==null?void 0:v.models)==null?void 0:D.CustomerDataModelShort)==null?void 0:c.transformer)==null?void 0:I.call(c,t.data))},L=`
3
+ import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as B}from"@dropins/tools/lib.js";const L=t=>{var r,u,i,d,_,f,E,S,T,w,e,g,O,P,A,M,U,R,b,N,$,G,v,D,c,I;const m=(i=(u=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:u.custom_attributes)==null?void 0:i.filter(l=>l).reduce((l,y)=>(l[n(y.code)]=y.value??"",l),{}),a={email:((_=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:_.email)||"",firstName:((E=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:E.firstname)||"",lastName:((T=(S=t==null?void 0:t.data)==null?void 0:S.customer)==null?void 0:T.lastname)||"",middleName:((e=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:e.middlename)||"",gender:((O=(g=t==null?void 0:t.data)==null?void 0:g.customer)==null?void 0:O.gender)||"1",dateOfBirth:((A=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:A.date_of_birth)||"",prefix:((U=(M=t==null?void 0:t.data)==null?void 0:M.customer)==null?void 0:U.prefix)||"",suffix:((b=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:b.suffix)||"",createdAt:(($=(N=t==null?void 0:t.data)==null?void 0:N.customer)==null?void 0:$.created_at)||"",...m};return B(a,(I=(c=(D=(v=(G=V)==null?void 0:G.getConfig())==null?void 0:v.models)==null?void 0:D.CustomerDataModelShort)==null?void 0:c.transformer)==null?void 0:I.call(c,t.data))},k=`
4
4
  query GET_CUSTOMER {
5
5
  customer {
6
6
  ...BASIC_CUSTOMER_INFO_FRAGMENT
@@ -14,7 +14,7 @@ import{m as y,f as C,l as o,k as h,n as x}from"./removeCustomerAddress.js";impor
14
14
  }
15
15
  }
16
16
  ${F}
17
- `,X=async()=>await C(L,{method:"GET",cache:"no-cache"}).then(t=>{var m;return(m=t.errors)!=null&&m.length?o(t.errors):B(t)}).catch(h),H=`
17
+ `,X=async()=>await C(k,{method:"GET",cache:"no-cache"}).then(t=>{var m;return(m=t.errors)!=null&&m.length?o(t.errors):L(t)}).catch(h),H=`
18
18
  mutation CHANGE_CUSTOMER_PASSWORD(
19
19
  $currentPassword: String!
20
20
  $newPassword: String!
@@ -1,3 +1,3 @@
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{c 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/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};
@@ -17,5 +17,10 @@
17
17
  export type Country = {
18
18
  value: string;
19
19
  text: string;
20
+ availableRegions?: {
21
+ id: number;
22
+ code: string;
23
+ name: string;
24
+ }[];
20
25
  };
21
26
  //# sourceMappingURL=country.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { useFormProps } from '../../types';
2
2
 
3
- export declare const useForm: ({ fieldsConfig, onSubmit, onChange, setInputChange, formName, isWaitingForResponse, }: useFormProps) => {
3
+ export declare const useForm: ({ fieldsConfig, onSubmit, onChange, setInputChange, formName, }: useFormProps) => {
4
4
  isDataValid: boolean;
5
5
  formData: Record<string, string | number>;
6
6
  errors: Record<string, string>;
@@ -1,12 +1,14 @@
1
- import { CustomerAddressesModel, RegionTransform } from '../../data/models';
1
+ import { CustomerAddressesModel } from '../../data/models';
2
2
  import { useAddressFormProps } from '../../types';
3
3
  import { VNode } from 'preact';
4
4
  import { HTMLAttributes } from 'preact/compat';
5
5
 
6
6
  export declare const findNonEmptyObject: (obj1: Record<string, unknown> | undefined, obj2: CustomerAddressesModel | undefined) => CustomerAddressesModel | Record<string, unknown>;
7
7
  export declare const useAddressForm: ({ showFormLoader, showSaveCheckBox, saveCheckBoxValue, addressFormId, billingCheckBoxValue, shippingCheckBoxValue, showShippingCheckBox, showBillingCheckBox, inputsDefaultValueSet, onCloseBtnClick, onSuccess, onError, formName, }: useAddressFormProps) => {
8
- isWaitingForResponse: boolean;
9
- regionOptions: [] | RegionTransform[];
8
+ regionOptions: {
9
+ text: string;
10
+ value: string;
11
+ }[];
10
12
  saveCheckBoxAddress: boolean;
11
13
  inLineAlert: {
12
14
  text: string;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-account", "version": "1.0.7-beta3", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-account", "version": "1.0.7", "@dropins/tools": "~1.0.0", "license": "SEE LICENSE IN LICENSE.md"}
@@ -24,7 +24,9 @@ export interface CountriesFormResponse {
24
24
  two_letter_abbreviation: string;
25
25
  full_name_locale: string;
26
26
  available_regions: {
27
+ id: number;
27
28
  code: string;
29
+ name: string;
28
30
  }[] | null;
29
31
  }[];
30
32
  };
@@ -17,7 +17,6 @@ export type FormRef = {
17
17
  isDataValid: boolean;
18
18
  };
19
19
  export interface FormProps {
20
- isWaitingForResponse?: boolean;
21
20
  showSaveCheckBox?: boolean;
22
21
  saveCheckBoxAddress?: boolean;
23
22
  handleSaveCheckBoxAddress?: (event: Event) => void;