From 2a1e712d4868eedaeb0791862f6ae0de27e02870 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 3 Dec 2024 17:17:41 +0200 Subject: [PATCH] added order and account 2 --- .../chunks/CustomerInformationCard.js | 2 +- .../chunks/getOrderHistoryList.js | 6 +++--- .../chunks/removeCustomerAddress.js | 16 ++++++++-------- .../storefront-account/chunks/updateCustomer.js | 2 +- scripts/__dropins__/storefront-account/reload | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js index 55bd77978..1482570cd 100644 --- a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js +++ b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a,Fragment as Q,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{classes as X,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as Pe,Input as je,InputDate as We,Checkbox as xe,TextArea as De,Card as he,Skeleton as we,SkeletonRow as D,Button as de,Tag as pe,Icon as Se,Modal as Ge,ProgressSpinner as Ke,IllustratedMessage as Je,Header as Xe,InLineAlert as Ye}from"@dropins/tools/components.js";import{useRef as Qe,useState as _,useEffect as ee,useCallback as k,useMemo as et}from"@dropins/tools/preact-hooks.js";import{k as Re,o as Ve,u as Ce,c as He,e as tt,n as rt,j as st,h as nt,i as at,d as dt}from"./removeCustomerAddress.js";import{useText as ne}from"@dropins/tools/i18n.js";import*as G from"@dropins/tools/preact-compat.js";import{memo as Ee,forwardRef as ot,useImperativeHandle as lt,useMemo as be,useCallback as Ne}from"@dropins/tools/preact-compat.js";import{Fragment as _e}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({hideActionFormButtons:e,formName:s,showFormLoader:n,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:o,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,billingCheckBoxValue:y,shippingCheckBoxValue:g,showBillingCheckBox:O,showShippingCheckBox:L,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T})=>a("div",{className:X(["account-address-form"]),children:a(Wt,{hideActionFormButtons:e,formName:s,showFormLoader:n,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,shippingCheckBoxValue:g,billingCheckBoxValue:y,showShippingCheckBox:L,showBillingCheckBox:O,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T,forwardFormRef:o,showSaveCheckBox:r,saveCheckBoxValue:d})}),it=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),ct=e=>/^\d+$/.test(e),ut=e=>/^[a-zA-Z0-9\s]+$/.test(e),pt=e=>/^[a-zA-Z0-9]+$/.test(e),ft=e=>/^[a-zA-Z]+$/.test(e),mt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),ht=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),At=(e,s,n)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=n},Te=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],Lt=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),gt=(e,s,n)=>{const r=e.length;return r>=s&&r<=n},ye=(e,s,n,r)=>{var w,V;const{requiredFieldError:d,lengthTextError:o,numericError:i,alphaNumWithSpacesError:l,alphaNumericError:c,alphaError:u,emailError:p,dateError:y,urlError:g,dateLengthError:O}=n,L=s==null?void 0:s.customUpperCode,x={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&!e)return{[L]:d};if(!(s!=null&&s.required)&&!e||!((w=s==null?void 0:s.validateRules)!=null&&w.length))return x;const t=it(s==null?void 0:s.validateRules),h=t.MIN_TEXT_LENGTH??1,f=t.MAX_TEXT_LENGTH??255,N=t.DATE_RANGE_MIN,T=t.DATE_RANGE_MAX;if(!gt(e,+h,+f)&&!(N||T))return{[L]:o.replace("{min}",h).replace("{max}",f)};if(!At(e,+N,+T)&&(N||T))return{[L]:O.replace("{min}",Te(N)).replace("{max}",Te(T))};const z={numeric:{validate:ct,error:i},"alphanum-with-spaces":{validate:ut,error:l},alphanumeric:{validate:pt,error:c},alpha:{validate:ft,error:u},email:{validate:mt,error:p},date:{validate:ht,error:y},url:{validate:Lt,error:g}}[t.INPUT_VALIDATION];return z&&!z.validate(e)&&!((V=r[L])!=null&&V.length)?{[L]:z.error}:x},Be=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}},yt=["true","false","yes","on","off"],Ct={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},bt=e=>{const s={},n={};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);n[i]||(n[i]=[]),n[i].push({index:l,value:d})}else Object.keys(e).filter(l=>l.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((o,i)=>o.index-i.index),s[r]=d.map(o=>o.value)}return s},Mt=e=>{const s={},n=[];for(const r in e){const d=yt.includes(e[r])?Be(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(Ct,r)?s[r]=d:n.push({code:Ve(r),value:d}))}return{...s,customAttributes:n}},ae=(e,s=!1)=>{const n=Re(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=Mt(bt(n));if(!s)return r;const[d,o]=r.region?r.region.split(","):[];return{...r,region:{regionCode:d,...o&&{regionId:+o}}}},me=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),{})},Ze=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,ze=e=>typeof e=="function",vt=e=>e.reduce((s,{customUpperCode:n,required:r,defaultValue:d})=>(r&&n&&(s.initialData[n]=d||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),$e=e=>Object.keys(e).length>0,Et=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:r,formName:d,isWaitingForResponse:o})=>{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"}),l=Qe(null),[c,u]=_({}),[p,y]=_({}),[g,O]=_({}),[L,x]=_(!0),[t,h]=_(!1),[f,N]=_(!1),[T,Z]=_(!0),[z,w]=_(!1);ee(()=>{const m=()=>{if(l.current){const b=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(b-1))}};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[e==null?void 0:e.length]);const V=k((m=!1)=>{let v=!0;const b={...p};let M=null;for(const[I,A]of Object.entries(c)){const $=e==null?void 0:e.find(S=>S.customUpperCode.includes(I)),U=ye(A.toString(),$,i,b);U[I]&&(Object.assign(b,U),v=!1),M||(M=Object.keys(b).find(S=>b[S])||null)}if(m||y(b),M&&l.current&&!m){const I=l.current.elements.namedItem(M);I==null||I.focus()}return v},[p,e,c,i]),C=k((m,v,b,M)=>{const I={...me(l),[v]:m,...v.includes("countryCode")?{region:""}:{}},A={data:ae(I,!0),isDataValid:Ze(b,I)};w(A.isDataValid),V(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(A)),n==null||n(A,{},M)},[V,d,n]);ee(()=>{if(e!=null&&e.length){const{initialData:m,errorList:v}=vt(e);u(b=>({...m,...b})),y(v),O(v)}},[JSON.stringify(e)]),ee(()=>{if(f)return;const m=me(l),v=sessionStorage.getItem(`${d}_addressData`);if($e(c)&&$e(g)){let b={};const M=Ze(g,c);v?b=JSON.parse(v).data:b=ae(m,!0)??{},n==null||n({data:b,isDataValid:M},{},null),w(M),N(!0)}},[c,g]),ee(()=>{var I;if(!T)return;const m=me(l),v=!!(m!=null&&m.countryCode),b=!!((I=m==null?void 0:m.region)!=null&&I.length);m&&v&&!b&&ze(n)&&!o&&C(m==null?void 0:m.region,"region",g,null)},[T,L,e,l,n,C,g,t,o]);const H=k((m,v)=>{const{name:b,value:M,type:I,checked:A}=m==null?void 0:m.target,$=I==="checkbox"?A:M;u(B=>{const te={...B,[b]:$};return b==="countryCode"&&(te.region="",x(!0),h(!1)),te}),r==null||r({[b]:$}),N(!0);const U=e==null?void 0:e.find(B=>B.customUpperCode.includes(b));let S=v?{...v}:{...p};if(U){const B=ye($.toString(),U,i,S);B&&Object.assign(S,B),y(S)}C($,b,g,m)},[r,e,p,i,C,g,L]),q=k(m=>{const{name:v}=m==null?void 0:m.target,b=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(b!=null&&b.options.length)&&Z(!1),Z(v==="countryCode")},[]),P=k((m,v)=>{const{name:b,value:M,type:I,checked:A}=m==null?void 0:m.target,$=I==="checkbox"?A:M,U=e==null?void 0:e.find(S=>S.customUpperCode===b);if(U){const S=v?{...v}:{...p},B=ye($.toString(),U,i,S);B&&Object.assign(S,B),y(S)}},[p,e,i]),K=k(m=>{m.preventDefault();const v=V();s==null||s(m,v)},[V,s]);return{isDataValid:z,formData:c,errors:p,formRef:l,handleInputChange:H,onFocus:q,handleBlur:P,handleSubmit:K,handleValidationSubmit:V}};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 Nt=Ee(({loading:e,values:s,fields:n=[],errors:r,className:d="",onChange:o,onBlur:i,onFocus:l,slots:c})=>{const u=`${d}__field`,p=(t,h)=>{if(!(c!=null&&c[`AddressFormInput_${t.code}`]))return;const f={inputName:t.customUpperCode,handleOnChange:o,handleOnBlur:i,handleOnFocus:l,errorMessage:h,errors:r,config:t};return a(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:c[`AddressFormInput_${t.code}`],context:f},t.id)},y=(t,h,f)=>{var T;const N=((T=t.options.find(Z=>Z.isDefault))==null?void 0:T.value)??h??t.defaultValue;return a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(Pe,{id:t.code,required:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,"aria-label":t.label,options:t.options,onBlur:i,onFocus:l,handleSelect:o,defaultValue:N,value:N})},t.id)})},g=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(je,{id: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)}),O=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(We,{id: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)}),L=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(xe,{id:t.code,name:t.customUpperCode,checked:h||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)}),x=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(De,{id:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)});return n.length?a(Q,{children:n.map(t=>{const h=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,h):g(t,f,h);case se.MULTILINE:return g(t,f,h);case se.SELECT:return y(t,f,h);case se.DATE:return O(t,f,h);case se.BOOLEAN:return L(t,f,h);case se.TEXTAREA:return x(t,f,h);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const n=j(we,{"data-testid":e||"skeletonLoader",children:[a(D,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:a(he,{variant:"secondary",className:X(["account-account-loaders","account-account-loaders--card-loader"]),children:n})},_t=()=>j(we,{"data-testid":"addressFormLoader",children:[a(D,{variant:"heading",size:"medium"}),a(D,{variant:"empty",size:"medium"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0}),a(D,{size:"large",fullWidth:!0,lines:3}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0})]}),Tt=Ee(ot(({isWaitingForResponse:e,setInputChange:s,showFormLoader:n,slots:r,name:d,loading:o,children:i,className:l="defaultForm",fieldsConfig:c,onSubmit:u,onChange:p,forwardFormRef:y,regionOptions:g,showSaveCheckBox:O,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:x})=>{const t=ne({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:h,formData:f,errors:N,formRef:T,handleInputChange:Z,handleBlur:z,handleSubmit:w,handleValidationSubmit:V,onFocus:C}=Et({fieldsConfig:c,onSubmit:u,onChange:p,setInputChange:s,regionOptions:g,formName:d,isWaitingForResponse:e});return lt(y,()=>{const H=me(T);return{handleValidationSubmit:V,formData:ae(H,!0),isDataValid:h}}),n||!(c!=null&&c.length)?a(_t,{}):j("form",{className:X(["account-form",l]),onSubmit:w,name:d,ref:T,children:[a(Nt,{className:l,loading:o,fields:c,onChange:Z,onBlur:z,errors:N,values:f,onFocus:C,slots:r}),r!=null&&r.AddressFormInputs?a(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,O?a("div",{className:"account-address-form--saveAddressBook",children:a(xe,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:x,onChange:H=>{Z(H),L==null||L(H)}})}):null,i]})})),Me=({slots:e,selectable:s,selectShipping:n,selectBilling:r,variant:d="secondary",minifiedView:o,keysSortOrder:i,addressData:l,loading:c,setAddressId:u,handleRenderModal:p,handleRenderForm:y})=>{const g=o?"minifiedView":"fullSizeView",O=ne({actionRemove:`Account.${g}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${g}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${g}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${g}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${g}.Addresses.addressCard.defaultLabelText`}),L=O.cardLabelBilling.toLocaleUpperCase(),x=O.cardLabelShipping.toLocaleUpperCase(),t=O.defaultLabelText.toLocaleUpperCase(),h=be(()=>{const C={shippingLabel:x,billingLabel:L,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}:C:C},[L,t,x,r,n,s]),f=Ne(()=>{u==null||u(l==null?void 0:l.id),p==null||p()},[p,l==null?void 0:l.id,u]),N=Ne(()=>{u==null||u(l==null?void 0:l.id),y==null||y()},[y,l==null?void 0:l.id,u]),T=be(()=>{if(!i)return[];const{region:C,...H}=l,q={...H,...C};return i.filter(({name:P})=>q[P]).map(P=>({name:P.name,orderNumber:P.orderNumber,value:q[P.name],label:P.label}))},[l,i]),{shippingLabel:Z,billingLabel:z,hideShipping:w,hideBilling:V}=h;return a(he,{variant:d,className:"account-address-card","data-testid":"addressCard",children:c?a(Ue,{}):j(Q,{children:[j("div",{className:"account-address-card__action",children:[p?a(de,{type:"button",variant:"tertiary",onClick:f,"data-testid":"removeButton",children:O.actionRemove}):null,y?a(de,{type:"button",variant:"tertiary",onClick:N,className:"account-address-card__action--editbutton","data-testid":"editButton",children:O.actionEdit}):null]}),a("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?a(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:T}}):a(Q,{children:T.map((C,H)=>{const q=C.label?`${C.label}: ${C==null?void 0:C.value}`:C==null?void 0:C.value;return a("p",{"data-testid":`${C.name}_${H}`,children:q},H)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?j("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?a(pe,{label:x}):null,l!=null&&l.defaultBilling?a(pe,{label:L}):null]}):null,s?j("div",{className:"account-address-card__labels",children:[!w&&(l!=null&&l.defaultShipping)?a(pe,{label:Z}):null,!V&&(l!=null&&l.defaultBilling)?a(pe,{label:z}):null]}):null]})})},Zt=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"})))),$t=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"})))),Ft=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:"#3D3D3D"})),Ot=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:"#D6D6D6"})),Fe=({selectable:e,className:s,addNewAddress:n,minifiedView:r,routeAddressesPage:d})=>{const o=r?"minifiedView":"fullSizeView",i=ne({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=e?"span":"button",c=e?{}:{AriaRole:"button",type:"button"},u=r&&!n?i.viewAllAddressesButton:i.addNewAddressButton,p=e?i.differentAddressButton:u;return j(l,{...c,className:X(["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:p}),a(Se,{source:r&&!n?$t:Zt,size:"32"})]})},It=({minifiedView:e,keysSortOrder:s,addressData:n,open:r,submitLoading:d,onRemoveAddress:o,closeModal:i})=>{const l=e?"minifiedView":"fullSizeView",c=ne({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?j(Ge,{title:a("h3",{children:c.title}),className:"account-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:i,children:[d?a("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:a(Ke,{stroke:"4",size:"large"})}):null,a("p",{children:c.description}),a(Me,{minifiedView:e,addressData:n,keysSortOrder:s}),j("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:o,children:c.actionConfirm})]})]}):null},xt=({typeList:e,isEmpty:s,minifiedView:n,className:r})=>{const d=n?"minifiedView":"fullSizeView",o=ne({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),i=be(()=>{switch(e){case"address":return{icon:Ft,text:a("p",{children:o.addressesMessage})};case"orders":return{icon:Ot,text:a("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!i.text?null:a(Je,{className:X(["account-empty-list",n?"account-empty-list--minified":"",r]),message:i.text,icon:a(Se,{source:i.icon}),"data-testid":"emptyList"})},wt=async(e,s)=>{if(s.length===1){const i=s[0],c=Object.values(i.region).every(p=>!!p)?{}:{region:{...i.region,regionId:0}};return!!await Ce({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 Ce({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},St=["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"],r1=["email","firstname","lastname","middlename","gender","date_of_birth","prefix","suffix","fax"],ke=(e,s,n)=>{if(s&&n||!s&&!n)return e;const r=e.slice();return s?r.sort((d,o)=>Number(o.defaultShipping)-Number(d.defaultShipping)):n?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),Rt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:r,minifiedView:d,routeAddressesPage:o,onSuccess:i})=>{const[l,c]=_(""),[u,p]=_(!1),[y,g]=_(!1),[O,L]=_(!1),[x,t]=_(!1),[h,f]=_(!1),[N,T]=_(""),[Z,z]=_([]),[w,V]=_([]),C=k(async()=>{L(!0),Promise.all([He("shortRequest"),tt()]).then(A=>{const[$,U]=A;if($){const S=$.map(({name:B,orderNumber:te,label:re})=>({name:rt(B),orderNumber:te,label:St.includes(B)?null:re}));V(S)}if(U)if(d){const S=U.filter(B=>!!B.defaultShipping||!!B.defaultBilling);z(S)}else z(U)}).finally(()=>{L(!1)})},[d]);ee(()=>{C()},[C]),ee(()=>{var A;if(Z.length)if(n===0)f(!0),c("0");else{const $=Z.find(S=>+S.id===n)||ke(Z,e,s)[0],U={data:ae($),isDataValid:!ve($)};c(n.toString()||((A=$==null?void 0:$.id)==null?void 0:A.toString())),r==null||r(U)}},[Z,n,r,s,e]);const H=k(A=>{T(A),f(!1)},[]),q=k((A,$)=>{const U=(A==null?void 0:A.target).value;c(U);const S={data:ae($),isDataValid:!ve(ae($))};r==null||r(S),U!=="0"&&f(!1)},[r]),P=k(()=>{g(!0)},[]),K=k(()=>{T(""),g(!1),p(!1)},[]),m=k(()=>{p(!0)},[]),v=k(async()=>{t(!0),await wt(N,Z),st(+N).then(()=>{C(),K()}).finally(()=>{t(!1)})},[Z,N,K,C]),b=k(()=>{f(!1)},[]),M=k(()=>{ze(o)&&d&&!h?window.location.href=o():(f(!0),T(""))},[h,o,d]),I=k(async()=>{await C(),await(i==null?void 0:i())},[C,i]);return{keysSortOrder:w,submitLoading:x,isModalRendered:u,isFormRendered:y,loading:O,addNewAddress:h,addressesList:Z,addressId:N,handleRenderForm:P,handleRenderModal:m,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:H,closeNewAddressForm:b,redirectToAddressesRoute:M,handleOnSuccess:I,handleSelectAddressOption:q,selectedAddressOption:l}},s1=Ee(({hideActionFormButtons:e=!1,formName:s,slots:n,title:r="",addressFormTitle:d="",defaultSelectAddressId:o="",showFormLoader:i=!1,onAddressData:l,forwardFormRef:c,className:u,showSaveCheckBox:p=!1,saveCheckBoxValue:y=!1,selectShipping:g=!1,selectBilling:O=!1,selectable:L=!1,withHeader:x=!0,minifiedView:t=!1,withActionsInMinifiedView:h=!1,withActionsInFullSizeView:f=!0,inputsDefaultValueSet:N,showShippingCheckBox:T=!0,showBillingCheckBox:Z=!0,shippingCheckBoxValue:z=!0,billingCheckBoxValue:w=!0,routeAddressesPage:V,onSuccess:C,onError:H})=>{var J;const q=t?"minifiedView":"fullSizeView",P=ne({containerTitle:`Account.${q}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${q}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${q}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${q}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${q}.Addresses.newAddressFormTitle`}),{keysSortOrder:K,submitLoading:m,isModalRendered:v,isFormRendered:b,loading:M,addNewAddress:I,addressesList:A,addressId:$,handleRenderForm:U,handleRenderModal:S,removeAddress:B,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:oe,redirectToAddressesRoute:ie,handleSelectAddressOption:ce,selectedAddressOption:ue}=Rt({defaultSelectAddressId:o,minifiedView:t,routeAddressesPage:V,onSuccess:C,onAddressData:l,selectShipping:g,selectBilling:O}),R=s??(g&&O?"selectedAddress":g?"selectedShippingAddress":O?"selectedBillingAddress":"default"),W=L?j("div",{className:"account-addresses-wrapper--select-view",children:[(J=ke(A,g,O))==null?void 0:J.map((E,Y)=>j(_e,{children:[a("input",{"data-testid":`radio-${Y+1}`,type:"radio",name:R,id:`${R}_${E.id}`,value:E.id,checked:ue===(E==null?void 0:E.id.toString()),onChange:ge=>ce(ge,E)}),a("label",{htmlFor:`${R}_${E.id}`,className:"account-addresses-wrapper__label",children:a(Me,{slots:n,selectable:L,selectShipping:g,selectBilling:O,minifiedView:t,addressData:E,keysSortOrder:K,loading:M})})]},E.id)),a("input",{"data-testid":"radio-0",type:"radio",name:R,id:`${R}_addressActions`,value:"0",checked:ue==="0",onChange:E=>ce(E,{})}),a("label",{htmlFor:`${R}_addressActions`,className:"account-addresses-wrapper__label",children:I?a("div",{className:X(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",I]]),children:a(fe,{slots:n,hideActionFormButtons:e,formName:R,showFormLoader:i,isOpen:I,forwardFormRef:c,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:z,billingCheckBoxValue:w,addressesFormTitle:d||P.differentAddressFormTitle,inputsDefaultValueSet:N,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:oe,onSuccess:re,onError:H,onChange:l})}):A!=null&&A.length?a(Fe,{selectable:L,minifiedView:t,addNewAddress:I,routeAddressesPage:ie}):null})]}):j(Q,{children:[A.map(E=>a(_e,{children:$===E.id&&b?a(he,{variant:"secondary",style:{marginBottom:20},children:a(fe,{slots:n,isOpen:$===E.id&&b,addressFormId:$,inputsDefaultValueSet:E,addressesFormTitle:P.editAddressFormTitle,showShippingCheckBox:T,showBillingCheckBox:Z,shippingCheckBoxValue:z,billingCheckBoxValue:w,onCloseBtnClick:te,onSuccess:re,onError:H})}):a(Me,{slots:n,minifiedView:t,addressData:E,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:t&&h||!t&&f?S:void 0,handleRenderForm:t&&h||!t&&f?U:void 0},E.id)},E.id)),a("div",{className:"account-addresses__footer",children:I?a(he,{variant:"secondary",children:a(fe,{slots:n,isOpen:I,addressesFormTitle:P.newAddressFormTitle,inputsDefaultValueSet:N,showShippingCheckBox:!!(A!=null&&A.length),showBillingCheckBox:!!(A!=null&&A.length),shippingCheckBoxValue:z,billingCheckBoxValue:w,onCloseBtnClick:oe,onSuccess:re,onError:H})}):a(Fe,{minifiedView:t,addNewAddress:I,routeAddressesPage:ie})})]});return j("div",{children:[a("div",{children:x?a(Xe,{title:r||P.containerTitle,divider:!t,className:t?"account-addresses-header":""}):null}),j("div",{className:X(["account-addresses-wrapper",u]),"data-testid":"addressesIdWrapper",children:[a(It,{minifiedView:t,addressData:A==null?void 0:A.find(E=>E.id===$),keysSortOrder:K,submitLoading:m,open:v,closeModal:te,onRemoveAddress:B}),M?a(Ue,{testId:"addressSkeletonLoader",withCard:!1}):L?a(fe,{slots:n,hideActionFormButtons:e,formName:R,isOpen:!(A!=null&&A.length),forwardFormRef:c,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:z,billingCheckBoxValue:w,inputsDefaultValueSet:N,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:oe,onSuccess:re,onError:H,onChange:l}):a(xt,{isEmpty:!(A!=null&&A.length),typeList:"address",minifiedView:t}),W]})]})}),qe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},Vt={...qe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ht={...qe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},Bt=(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 o=r[n.customUpperCode];n.customUpperCode==="region"&&typeof o=="object"?d.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:d.defaultValue=o}return d}),Oe=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{}},zt=({fields:e,addressId:s,countryOptions:n,disableField:r,regionOptions:d,isRequiredRegion:o,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:o,disabled:r}:c),Ut=(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","dateOfBirth","prefix","suffix"],r={},d=[];return Object.keys(e).forEach(o=>{n.includes(o)?r[o]=e[o]:d.push({attribute_code:Ve(o),value:e[o]})}),d.length>0&&(r.custom_attributesV2=d),r},Ie=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],r=[],d={};for(const L in e){const x=e[L];n.includes(x)&&(d[L]=Be(x)),s.includes(L)&&r.push(x)}const{street:o,streetMultiline_2:i,streetMultiline_1:l,region:c,...u}=e,[p,y]=c?c.split(","):[void 0,void 0],g=y&&p?{regionId:+y,regionCode:p}:{region:p};return Ut({...u,...d,region:{...g},street:r})},kt=(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 o=s.find(i=>(i==null?void 0:i.id)===d.regionId);o?n[r]={...d,text:o.text}:n[r]=d}else Array.isArray(d)?(n[r]=d[0]||"",d.slice(1).forEach((o,i)=>{n[`${r}Multiline_${i+2}`]=o})):n[r]=d}return n},qt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Pt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:o,showShippingCheckBox:i,showBillingCheckBox:l,inputsDefaultValueSet:c,onCloseBtnClick:u,onSuccess:p,onError:y,formName:g})=>{const[O,L]=_({text:"",type:"success"}),[x,t]=_(e??!1),[h,f]=_(r||""),[N,T]=_([]),[Z,z]=_([]),[w,V]=_([]),[C,H]=_([]),[q,P]=_([]),[K,m]=_(!1),[v,b]=_(!1),[M,I]=_(()=>{var R,W;const F=sessionStorage.getItem(`${g}_addressData`);return F?{countryCode:(W=(R=JSON.parse(F))==null?void 0:R.data)==null?void 0:W.countryCode}:c}),[A,$]=_(!1),[U,S]=_(!1),[B,te]=_(()=>{var W,J;const F=sessionStorage.getItem(`${g}_addressData`);return F?(J=(W=JSON.parse(F))==null?void 0:W.data)==null?void 0:J.saveAddressBook:n}),re=k(F=>{te(F.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{He(h?"customer_address_edit":"customer_register_address").then(F=>{T(F)})},[h]),ee(()=>{$(!0),nt().then(({availableCountries:F,countriesWithRequiredRegion:R,optionalZipCountries:W})=>{z(F),H(R),P(W),$(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){$(!0),S(!0);const F=M==null?void 0:M.countryCode;at(F).then(R=>{V(R);const W=C.find(E=>E===F),J=q.find(E=>E===F);m(!!W),b(!J),$(!1),S(!1)})}},[M==null?void 0:M.countryCode,C,q]);const Le=k(()=>{L({text:"",type:"success"}),u==null||u()},[u]),oe=k(async(F,R)=>{if(!R)return null;t(!0);const W=Oe(F.target),J=Ie(W);await Ce(J).then(()=>{var E;p==null||p(),u==null||u(),(E=F==null?void 0:F.target)==null||E.reset()}).catch(E=>{L(Y=>({...Y,text:E.message,type:"error"})),y==null||y(E)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ie=k(async(F,R)=>{if(!R)return;t(!0);const{saveAddressBook:W,...J}=Oe(F.target),E=Ie(J);await dt(E).then(()=>{var Y;p==null||p(),u==null||u(),(Y=F==null?void 0:F.target)==null||Y.reset()}).catch(Y=>{L(ge=>({...ge,text:Y.message,type:"error"})),y==null||y(Y)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ce=et(()=>{if(!N.length)return[];const F={...Vt,defaultValue:o,isHidden:s&&!B?!0:!i},R={...Ht,defaultValue:d,isHidden:s&&!B?!0:!l},W=[...N,F,R],J=sessionStorage.getItem(`${g}_addressData`),E=J?kt(JSON.parse(J).data,w):{},Y=Bt(qt(E,c),W);return zt({fields:Y,addressId:h,countryOptions:Z,disableField:A,regionOptions:w,isRequiredRegion:K,isRequiredPostCode:v})},[N,o,s,B,i,d,l,g,w,c,h,Z,A,K,v]),ue=k(F=>{I(R=>({...R,...F}))},[]);return{isWaitingForResponse:U,regionOptions:w,saveCheckBoxAddress:B,inLineAlert:O,addressId:h,submitLoading:x,normalizeFieldsConfig:ce,handleSaveCheckBoxAddress:re,handleUpdateAddress:oe,handleCreateAddress:ie,handleOnCloseForm:Le,handleInputChange:ue}},jt=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:n,...r}=e;return{...r,...Re(s,"camelCase",{})}},Wt=({hideActionFormButtons:e,formName:s="",showFormLoader:n=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:o,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,showShippingCheckBox:y=!0,showBillingCheckBox:g=!0,shippingCheckBoxValue:O=!0,billingCheckBoxValue:L=!0,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T})=>{const Z=ne({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:z,inLineAlert:w,addressId:V,submitLoading:C,normalizeFieldsConfig:H,handleUpdateAddress:q,handleCreateAddress:P,handleOnCloseForm:K,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,handleInputChange:b,regionOptions:M}=Pt({showFormLoader:n,addressFormId:u,inputsDefaultValueSet:jt(p),shippingCheckBoxValue:O,billingCheckBoxValue:L,showShippingCheckBox:y,showBillingCheckBox:g,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:f,onError:N,onCloseBtnClick:h,formName:s});return x?j("div",{className:X(["account-address-form-wrapper",c]),children:[l?a("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,w.text?a(Ye,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:w.type,variant:"secondary",heading:w.text,icon:w.icon}):null,j(Tt,{regionOptions:M,forwardFormRef:o,slots:i,className:"account-address-form",name:s||"addressesForm",fieldsConfig:H,onSubmit:t||(V?q:P),setInputChange:b,loading:C,showFormLoader:n,showSaveCheckBox:r,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,onChange:T,isWaitingForResponse:z,children:[V?a("input",{type:"hidden",name:"addressId",value:V,"data-testid":"hidden_test_id"}):null,e?null:a("div",{className:X(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:i!=null&&i.AddressFormActions?a(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:i.AddressFormActions,context:{handleUpdateAddress:q,handleCreateAddress:P,addressId:V}}):a(Q,{children:r?null:j(Q,{children:[a(de,{type:"button",onClick:K,variant:"secondary",disabled:C,children:Z.secondaryButton}),a(de,{disabled:C,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,xt as E,Tt as F,$t as S,s1 as a,ze as c,r1 as d,Oe as g,Ut as n}; +import{jsx as a,Fragment as Q,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{classes as X,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as Pe,Input as je,InputDate as We,Checkbox as xe,TextArea as De,Card as he,Skeleton as we,SkeletonRow as D,Button as de,Tag as pe,Icon as Se,Modal as Ge,ProgressSpinner as Ke,IllustratedMessage as Je,Header as Xe,InLineAlert as Ye}from"@dropins/tools/components.js";import{useRef as Qe,useState as _,useEffect as ee,useCallback as k,useMemo as et}from"@dropins/tools/preact-hooks.js";import{k as Re,o as Ve,u as Ce,c as He,e as tt,m as rt,j as st,h as nt,i as at,d as dt}from"./removeCustomerAddress.js";import{useText as ne}from"@dropins/tools/i18n.js";import*as G from"@dropins/tools/preact-compat.js";import{memo as Ee,forwardRef as ot,useImperativeHandle as lt,useMemo as be,useCallback as Ne}from"@dropins/tools/preact-compat.js";import{Fragment as _e}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({hideActionFormButtons:e,formName:s,showFormLoader:n,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:o,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,billingCheckBoxValue:y,shippingCheckBoxValue:g,showBillingCheckBox:O,showShippingCheckBox:L,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T})=>a("div",{className:X(["account-address-form"]),children:a(Wt,{hideActionFormButtons:e,formName:s,showFormLoader:n,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,shippingCheckBoxValue:g,billingCheckBoxValue:y,showShippingCheckBox:L,showBillingCheckBox:O,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T,forwardFormRef:o,showSaveCheckBox:r,saveCheckBoxValue:d})}),it=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),ct=e=>/^\d+$/.test(e),ut=e=>/^[a-zA-Z0-9\s]+$/.test(e),pt=e=>/^[a-zA-Z0-9]+$/.test(e),ft=e=>/^[a-zA-Z]+$/.test(e),mt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),ht=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),At=(e,s,n)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=n},Te=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],Lt=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),gt=(e,s,n)=>{const r=e.length;return r>=s&&r<=n},ye=(e,s,n,r)=>{var w,V;const{requiredFieldError:d,lengthTextError:o,numericError:i,alphaNumWithSpacesError:l,alphaNumericError:c,alphaError:u,emailError:p,dateError:y,urlError:g,dateLengthError:O}=n,L=s==null?void 0:s.customUpperCode,x={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&!e)return{[L]:d};if(!(s!=null&&s.required)&&!e||!((w=s==null?void 0:s.validateRules)!=null&&w.length))return x;const t=it(s==null?void 0:s.validateRules),h=t.MIN_TEXT_LENGTH??1,f=t.MAX_TEXT_LENGTH??255,N=t.DATE_RANGE_MIN,T=t.DATE_RANGE_MAX;if(!gt(e,+h,+f)&&!(N||T))return{[L]:o.replace("{min}",h).replace("{max}",f)};if(!At(e,+N,+T)&&(N||T))return{[L]:O.replace("{min}",Te(N)).replace("{max}",Te(T))};const z={numeric:{validate:ct,error:i},"alphanum-with-spaces":{validate:ut,error:l},alphanumeric:{validate:pt,error:c},alpha:{validate:ft,error:u},email:{validate:mt,error:p},date:{validate:ht,error:y},url:{validate:Lt,error:g}}[t.INPUT_VALIDATION];return z&&!z.validate(e)&&!((V=r[L])!=null&&V.length)?{[L]:z.error}:x},Be=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}},yt=["true","false","yes","on","off"],Ct={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},bt=e=>{const s={},n={};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);n[i]||(n[i]=[]),n[i].push({index:l,value:d})}else Object.keys(e).filter(l=>l.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((o,i)=>o.index-i.index),s[r]=d.map(o=>o.value)}return s},Mt=e=>{const s={},n=[];for(const r in e){const d=yt.includes(e[r])?Be(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(Ct,r)?s[r]=d:n.push({code:Ve(r),value:d}))}return{...s,customAttributes:n}},ae=(e,s=!1)=>{const n=Re(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=Mt(bt(n));if(!s)return r;const[d,o]=r.region?r.region.split(","):[];return{...r,region:{regionCode:d,...o&&{regionId:+o}}}},me=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),{})},Ze=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,ze=e=>typeof e=="function",vt=e=>e.reduce((s,{customUpperCode:n,required:r,defaultValue:d})=>(r&&n&&(s.initialData[n]=d||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),$e=e=>Object.keys(e).length>0,Et=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:r,formName:d,isWaitingForResponse:o})=>{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"}),l=Qe(null),[c,u]=_({}),[p,y]=_({}),[g,O]=_({}),[L,x]=_(!0),[t,h]=_(!1),[f,N]=_(!1),[T,Z]=_(!0),[z,w]=_(!1);ee(()=>{const m=()=>{if(l.current){const b=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(b-1))}};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[e==null?void 0:e.length]);const V=k((m=!1)=>{let v=!0;const b={...p};let M=null;for(const[I,A]of Object.entries(c)){const $=e==null?void 0:e.find(S=>S.customUpperCode.includes(I)),U=ye(A.toString(),$,i,b);U[I]&&(Object.assign(b,U),v=!1),M||(M=Object.keys(b).find(S=>b[S])||null)}if(m||y(b),M&&l.current&&!m){const I=l.current.elements.namedItem(M);I==null||I.focus()}return v},[p,e,c,i]),C=k((m,v,b,M)=>{const I={...me(l),[v]:m,...v.includes("countryCode")?{region:""}:{}},A={data:ae(I,!0),isDataValid:Ze(b,I)};w(A.isDataValid),V(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(A)),n==null||n(A,{},M)},[V,d,n]);ee(()=>{if(e!=null&&e.length){const{initialData:m,errorList:v}=vt(e);u(b=>({...m,...b})),y(v),O(v)}},[JSON.stringify(e)]),ee(()=>{if(f)return;const m=me(l),v=sessionStorage.getItem(`${d}_addressData`);if($e(c)&&$e(g)){let b={};const M=Ze(g,c);v?b=JSON.parse(v).data:b=ae(m,!0)??{},n==null||n({data:b,isDataValid:M},{},null),w(M),N(!0)}},[c,g]),ee(()=>{var I;if(!T)return;const m=me(l),v=!!(m!=null&&m.countryCode),b=!!((I=m==null?void 0:m.region)!=null&&I.length);m&&v&&!b&&ze(n)&&!o&&C(m==null?void 0:m.region,"region",g,null)},[T,L,e,l,n,C,g,t,o]);const H=k((m,v)=>{const{name:b,value:M,type:I,checked:A}=m==null?void 0:m.target,$=I==="checkbox"?A:M;u(B=>{const te={...B,[b]:$};return b==="countryCode"&&(te.region="",x(!0),h(!1)),te}),r==null||r({[b]:$}),N(!0);const U=e==null?void 0:e.find(B=>B.customUpperCode.includes(b));let S=v?{...v}:{...p};if(U){const B=ye($.toString(),U,i,S);B&&Object.assign(S,B),y(S)}C($,b,g,m)},[r,e,p,i,C,g,L]),q=k(m=>{const{name:v}=m==null?void 0:m.target,b=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(b!=null&&b.options.length)&&Z(!1),Z(v==="countryCode")},[]),P=k((m,v)=>{const{name:b,value:M,type:I,checked:A}=m==null?void 0:m.target,$=I==="checkbox"?A:M,U=e==null?void 0:e.find(S=>S.customUpperCode===b);if(U){const S=v?{...v}:{...p},B=ye($.toString(),U,i,S);B&&Object.assign(S,B),y(S)}},[p,e,i]),K=k(m=>{m.preventDefault();const v=V();s==null||s(m,v)},[V,s]);return{isDataValid:z,formData:c,errors:p,formRef:l,handleInputChange:H,onFocus:q,handleBlur:P,handleSubmit:K,handleValidationSubmit:V}};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 Nt=Ee(({loading:e,values:s,fields:n=[],errors:r,className:d="",onChange:o,onBlur:i,onFocus:l,slots:c})=>{const u=`${d}__field`,p=(t,h)=>{if(!(c!=null&&c[`AddressFormInput_${t.code}`]))return;const f={inputName:t.customUpperCode,handleOnChange:o,handleOnBlur:i,handleOnFocus:l,errorMessage:h,errors:r,config:t};return a(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:c[`AddressFormInput_${t.code}`],context:f},t.id)},y=(t,h,f)=>{var T;const N=((T=t.options.find(Z=>Z.isDefault))==null?void 0:T.value)??h??t.defaultValue;return a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(Pe,{id:t.code,required:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,"aria-label":t.label,options:t.options,onBlur:i,onFocus:l,handleSelect:o,defaultValue:N,value:N})},t.id)})},g=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(je,{id: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)}),O=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:a(We,{id: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)}),L=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(xe,{id:t.code,name:t.customUpperCode,checked:h||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)}),x=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:a(De,{id:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:i,onChange:o})},t.id)});return n.length?a(Q,{children:n.map(t=>{const h=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,h):g(t,f,h);case se.MULTILINE:return g(t,f,h);case se.SELECT:return y(t,f,h);case se.DATE:return O(t,f,h);case se.BOOLEAN:return L(t,f,h);case se.TEXTAREA:return x(t,f,h);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const n=j(we,{"data-testid":e||"skeletonLoader",children:[a(D,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:a(he,{variant:"secondary",className:X(["account-account-loaders","account-account-loaders--card-loader"]),children:n})},_t=()=>j(we,{"data-testid":"addressFormLoader",children:[a(D,{variant:"heading",size:"medium"}),a(D,{variant:"empty",size:"medium"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0}),a(D,{size:"large",fullWidth:!0,lines:3}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0})]}),Tt=Ee(ot(({isWaitingForResponse:e,setInputChange:s,showFormLoader:n,slots:r,name:d,loading:o,children:i,className:l="defaultForm",fieldsConfig:c,onSubmit:u,onChange:p,forwardFormRef:y,regionOptions:g,showSaveCheckBox:O,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:x})=>{const t=ne({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:h,formData:f,errors:N,formRef:T,handleInputChange:Z,handleBlur:z,handleSubmit:w,handleValidationSubmit:V,onFocus:C}=Et({fieldsConfig:c,onSubmit:u,onChange:p,setInputChange:s,regionOptions:g,formName:d,isWaitingForResponse:e});return lt(y,()=>{const H=me(T);return{handleValidationSubmit:V,formData:ae(H,!0),isDataValid:h}}),n||!(c!=null&&c.length)?a(_t,{}):j("form",{className:X(["account-form",l]),onSubmit:w,name:d,ref:T,children:[a(Nt,{className:l,loading:o,fields:c,onChange:Z,onBlur:z,errors:N,values:f,onFocus:C,slots:r}),r!=null&&r.AddressFormInputs?a(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,O?a("div",{className:"account-address-form--saveAddressBook",children:a(xe,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:x,onChange:H=>{Z(H),L==null||L(H)}})}):null,i]})})),Me=({slots:e,selectable:s,selectShipping:n,selectBilling:r,variant:d="secondary",minifiedView:o,keysSortOrder:i,addressData:l,loading:c,setAddressId:u,handleRenderModal:p,handleRenderForm:y})=>{const g=o?"minifiedView":"fullSizeView",O=ne({actionRemove:`Account.${g}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${g}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${g}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${g}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${g}.Addresses.addressCard.defaultLabelText`}),L=O.cardLabelBilling.toLocaleUpperCase(),x=O.cardLabelShipping.toLocaleUpperCase(),t=O.defaultLabelText.toLocaleUpperCase(),h=be(()=>{const C={shippingLabel:x,billingLabel:L,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}:C:C},[L,t,x,r,n,s]),f=Ne(()=>{u==null||u(l==null?void 0:l.id),p==null||p()},[p,l==null?void 0:l.id,u]),N=Ne(()=>{u==null||u(l==null?void 0:l.id),y==null||y()},[y,l==null?void 0:l.id,u]),T=be(()=>{if(!i)return[];const{region:C,...H}=l,q={...H,...C};return i.filter(({name:P})=>q[P]).map(P=>({name:P.name,orderNumber:P.orderNumber,value:q[P.name],label:P.label}))},[l,i]),{shippingLabel:Z,billingLabel:z,hideShipping:w,hideBilling:V}=h;return a(he,{variant:d,className:"account-address-card","data-testid":"addressCard",children:c?a(Ue,{}):j(Q,{children:[j("div",{className:"account-address-card__action",children:[p?a(de,{type:"button",variant:"tertiary",onClick:f,"data-testid":"removeButton",children:O.actionRemove}):null,y?a(de,{type:"button",variant:"tertiary",onClick:N,className:"account-address-card__action--editbutton","data-testid":"editButton",children:O.actionEdit}):null]}),a("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?a(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:T}}):a(Q,{children:T.map((C,H)=>{const q=C.label?`${C.label}: ${C==null?void 0:C.value}`:C==null?void 0:C.value;return a("p",{"data-testid":`${C.name}_${H}`,children:q},H)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?j("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?a(pe,{label:x}):null,l!=null&&l.defaultBilling?a(pe,{label:L}):null]}):null,s?j("div",{className:"account-address-card__labels",children:[!w&&(l!=null&&l.defaultShipping)?a(pe,{label:Z}):null,!V&&(l!=null&&l.defaultBilling)?a(pe,{label:z}):null]}):null]})})},Zt=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"})))),$t=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"})))),Ft=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:"#3D3D3D"})),Ot=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:"#D6D6D6"})),Fe=({selectable:e,className:s,addNewAddress:n,minifiedView:r,routeAddressesPage:d})=>{const o=r?"minifiedView":"fullSizeView",i=ne({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=e?"span":"button",c=e?{}:{AriaRole:"button",type:"button"},u=r&&!n?i.viewAllAddressesButton:i.addNewAddressButton,p=e?i.differentAddressButton:u;return j(l,{...c,className:X(["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:p}),a(Se,{source:r&&!n?$t:Zt,size:"32"})]})},It=({minifiedView:e,keysSortOrder:s,addressData:n,open:r,submitLoading:d,onRemoveAddress:o,closeModal:i})=>{const l=e?"minifiedView":"fullSizeView",c=ne({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?j(Ge,{title:a("h3",{children:c.title}),className:"account-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:i,children:[d?a("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:a(Ke,{stroke:"4",size:"large"})}):null,a("p",{children:c.description}),a(Me,{minifiedView:e,addressData:n,keysSortOrder:s}),j("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:o,children:c.actionConfirm})]})]}):null},xt=({typeList:e,isEmpty:s,minifiedView:n,className:r})=>{const d=n?"minifiedView":"fullSizeView",o=ne({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),i=be(()=>{switch(e){case"address":return{icon:Ft,text:a("p",{children:o.addressesMessage})};case"orders":return{icon:Ot,text:a("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!i.text?null:a(Je,{className:X(["account-empty-list",n?"account-empty-list--minified":"",r]),message:i.text,icon:a(Se,{source:i.icon}),"data-testid":"emptyList"})},wt=async(e,s)=>{if(s.length===1){const i=s[0],c=Object.values(i.region).every(p=>!!p)?{}:{region:{...i.region,regionId:0}};return!!await Ce({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 Ce({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},St=["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"],r1=["email","firstname","lastname","middlename","gender","date_of_birth","prefix","suffix","fax"],ke=(e,s,n)=>{if(s&&n||!s&&!n)return e;const r=e.slice();return s?r.sort((d,o)=>Number(o.defaultShipping)-Number(d.defaultShipping)):n?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),Rt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:r,minifiedView:d,routeAddressesPage:o,onSuccess:i})=>{const[l,c]=_(""),[u,p]=_(!1),[y,g]=_(!1),[O,L]=_(!1),[x,t]=_(!1),[h,f]=_(!1),[N,T]=_(""),[Z,z]=_([]),[w,V]=_([]),C=k(async()=>{L(!0),Promise.all([He("shortRequest"),tt()]).then(A=>{const[$,U]=A;if($){const S=$.map(({name:B,orderNumber:te,label:re})=>({name:rt(B),orderNumber:te,label:St.includes(B)?null:re}));V(S)}if(U)if(d){const S=U.filter(B=>!!B.defaultShipping||!!B.defaultBilling);z(S)}else z(U)}).finally(()=>{L(!1)})},[d]);ee(()=>{C()},[C]),ee(()=>{var A;if(Z.length)if(n===0)f(!0),c("0");else{const $=Z.find(S=>+S.id===n)||ke(Z,e,s)[0],U={data:ae($),isDataValid:!ve($)};c(n.toString()||((A=$==null?void 0:$.id)==null?void 0:A.toString())),r==null||r(U)}},[Z,n,r,s,e]);const H=k(A=>{T(A),f(!1)},[]),q=k((A,$)=>{const U=(A==null?void 0:A.target).value;c(U);const S={data:ae($),isDataValid:!ve(ae($))};r==null||r(S),U!=="0"&&f(!1)},[r]),P=k(()=>{g(!0)},[]),K=k(()=>{T(""),g(!1),p(!1)},[]),m=k(()=>{p(!0)},[]),v=k(async()=>{t(!0),await wt(N,Z),st(+N).then(()=>{C(),K()}).finally(()=>{t(!1)})},[Z,N,K,C]),b=k(()=>{f(!1)},[]),M=k(()=>{ze(o)&&d&&!h?window.location.href=o():(f(!0),T(""))},[h,o,d]),I=k(async()=>{await C(),await(i==null?void 0:i())},[C,i]);return{keysSortOrder:w,submitLoading:x,isModalRendered:u,isFormRendered:y,loading:O,addNewAddress:h,addressesList:Z,addressId:N,handleRenderForm:P,handleRenderModal:m,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:H,closeNewAddressForm:b,redirectToAddressesRoute:M,handleOnSuccess:I,handleSelectAddressOption:q,selectedAddressOption:l}},s1=Ee(({hideActionFormButtons:e=!1,formName:s,slots:n,title:r="",addressFormTitle:d="",defaultSelectAddressId:o="",showFormLoader:i=!1,onAddressData:l,forwardFormRef:c,className:u,showSaveCheckBox:p=!1,saveCheckBoxValue:y=!1,selectShipping:g=!1,selectBilling:O=!1,selectable:L=!1,withHeader:x=!0,minifiedView:t=!1,withActionsInMinifiedView:h=!1,withActionsInFullSizeView:f=!0,inputsDefaultValueSet:N,showShippingCheckBox:T=!0,showBillingCheckBox:Z=!0,shippingCheckBoxValue:z=!0,billingCheckBoxValue:w=!0,routeAddressesPage:V,onSuccess:C,onError:H})=>{var J;const q=t?"minifiedView":"fullSizeView",P=ne({containerTitle:`Account.${q}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${q}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${q}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${q}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${q}.Addresses.newAddressFormTitle`}),{keysSortOrder:K,submitLoading:m,isModalRendered:v,isFormRendered:b,loading:M,addNewAddress:I,addressesList:A,addressId:$,handleRenderForm:U,handleRenderModal:S,removeAddress:B,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:oe,redirectToAddressesRoute:ie,handleSelectAddressOption:ce,selectedAddressOption:ue}=Rt({defaultSelectAddressId:o,minifiedView:t,routeAddressesPage:V,onSuccess:C,onAddressData:l,selectShipping:g,selectBilling:O}),R=s??(g&&O?"selectedAddress":g?"selectedShippingAddress":O?"selectedBillingAddress":"default"),W=L?j("div",{className:"account-addresses-wrapper--select-view",children:[(J=ke(A,g,O))==null?void 0:J.map((E,Y)=>j(_e,{children:[a("input",{"data-testid":`radio-${Y+1}`,type:"radio",name:R,id:`${R}_${E.id}`,value:E.id,checked:ue===(E==null?void 0:E.id.toString()),onChange:ge=>ce(ge,E)}),a("label",{htmlFor:`${R}_${E.id}`,className:"account-addresses-wrapper__label",children:a(Me,{slots:n,selectable:L,selectShipping:g,selectBilling:O,minifiedView:t,addressData:E,keysSortOrder:K,loading:M})})]},E.id)),a("input",{"data-testid":"radio-0",type:"radio",name:R,id:`${R}_addressActions`,value:"0",checked:ue==="0",onChange:E=>ce(E,{})}),a("label",{htmlFor:`${R}_addressActions`,className:"account-addresses-wrapper__label",children:I?a("div",{className:X(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",I]]),children:a(fe,{slots:n,hideActionFormButtons:e,formName:R,showFormLoader:i,isOpen:I,forwardFormRef:c,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:z,billingCheckBoxValue:w,addressesFormTitle:d||P.differentAddressFormTitle,inputsDefaultValueSet:N,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:oe,onSuccess:re,onError:H,onChange:l})}):A!=null&&A.length?a(Fe,{selectable:L,minifiedView:t,addNewAddress:I,routeAddressesPage:ie}):null})]}):j(Q,{children:[A.map(E=>a(_e,{children:$===E.id&&b?a(he,{variant:"secondary",style:{marginBottom:20},children:a(fe,{slots:n,isOpen:$===E.id&&b,addressFormId:$,inputsDefaultValueSet:E,addressesFormTitle:P.editAddressFormTitle,showShippingCheckBox:T,showBillingCheckBox:Z,shippingCheckBoxValue:z,billingCheckBoxValue:w,onCloseBtnClick:te,onSuccess:re,onError:H})}):a(Me,{slots:n,minifiedView:t,addressData:E,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:t&&h||!t&&f?S:void 0,handleRenderForm:t&&h||!t&&f?U:void 0},E.id)},E.id)),a("div",{className:"account-addresses__footer",children:I?a(he,{variant:"secondary",children:a(fe,{slots:n,isOpen:I,addressesFormTitle:P.newAddressFormTitle,inputsDefaultValueSet:N,showShippingCheckBox:!!(A!=null&&A.length),showBillingCheckBox:!!(A!=null&&A.length),shippingCheckBoxValue:z,billingCheckBoxValue:w,onCloseBtnClick:oe,onSuccess:re,onError:H})}):a(Fe,{minifiedView:t,addNewAddress:I,routeAddressesPage:ie})})]});return j("div",{children:[a("div",{children:x?a(Xe,{title:r||P.containerTitle,divider:!t,className:t?"account-addresses-header":""}):null}),j("div",{className:X(["account-addresses-wrapper",u]),"data-testid":"addressesIdWrapper",children:[a(It,{minifiedView:t,addressData:A==null?void 0:A.find(E=>E.id===$),keysSortOrder:K,submitLoading:m,open:v,closeModal:te,onRemoveAddress:B}),M?a(Ue,{testId:"addressSkeletonLoader",withCard:!1}):L?a(fe,{slots:n,hideActionFormButtons:e,formName:R,isOpen:!(A!=null&&A.length),forwardFormRef:c,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:z,billingCheckBoxValue:w,inputsDefaultValueSet:N,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:oe,onSuccess:re,onError:H,onChange:l}):a(xt,{isEmpty:!(A!=null&&A.length),typeList:"address",minifiedView:t}),W]})]})}),qe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},Vt={...qe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ht={...qe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},Bt=(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 o=r[n.customUpperCode];n.customUpperCode==="region"&&typeof o=="object"?d.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:d.defaultValue=o}return d}),Oe=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{}},zt=({fields:e,addressId:s,countryOptions:n,disableField:r,regionOptions:d,isRequiredRegion:o,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:o,disabled:r}:c),Ut=(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","dateOfBirth","prefix","suffix"],r={},d=[];return Object.keys(e).forEach(o=>{n.includes(o)?r[o]=e[o]:d.push({attribute_code:Ve(o),value:e[o]})}),d.length>0&&(r.custom_attributesV2=d),r},Ie=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],r=[],d={};for(const L in e){const x=e[L];n.includes(x)&&(d[L]=Be(x)),s.includes(L)&&r.push(x)}const{street:o,streetMultiline_2:i,streetMultiline_1:l,region:c,...u}=e,[p,y]=c?c.split(","):[void 0,void 0],g=y&&p?{regionId:+y,regionCode:p}:{region:p};return Ut({...u,...d,region:{...g},street:r})},kt=(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 o=s.find(i=>(i==null?void 0:i.id)===d.regionId);o?n[r]={...d,text:o.text}:n[r]=d}else Array.isArray(d)?(n[r]=d[0]||"",d.slice(1).forEach((o,i)=>{n[`${r}Multiline_${i+2}`]=o})):n[r]=d}return n},qt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Pt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:o,showShippingCheckBox:i,showBillingCheckBox:l,inputsDefaultValueSet:c,onCloseBtnClick:u,onSuccess:p,onError:y,formName:g})=>{const[O,L]=_({text:"",type:"success"}),[x,t]=_(e??!1),[h,f]=_(r||""),[N,T]=_([]),[Z,z]=_([]),[w,V]=_([]),[C,H]=_([]),[q,P]=_([]),[K,m]=_(!1),[v,b]=_(!1),[M,I]=_(()=>{var R,W;const F=sessionStorage.getItem(`${g}_addressData`);return F?{countryCode:(W=(R=JSON.parse(F))==null?void 0:R.data)==null?void 0:W.countryCode}:c}),[A,$]=_(!1),[U,S]=_(!1),[B,te]=_(()=>{var W,J;const F=sessionStorage.getItem(`${g}_addressData`);return F?(J=(W=JSON.parse(F))==null?void 0:W.data)==null?void 0:J.saveAddressBook:n}),re=k(F=>{te(F.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{He(h?"customer_address_edit":"customer_register_address").then(F=>{T(F)})},[h]),ee(()=>{$(!0),nt().then(({availableCountries:F,countriesWithRequiredRegion:R,optionalZipCountries:W})=>{z(F),H(R),P(W),$(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){$(!0),S(!0);const F=M==null?void 0:M.countryCode;at(F).then(R=>{V(R);const W=C.find(E=>E===F),J=q.find(E=>E===F);m(!!W),b(!J),$(!1),S(!1)})}},[M==null?void 0:M.countryCode,C,q]);const Le=k(()=>{L({text:"",type:"success"}),u==null||u()},[u]),oe=k(async(F,R)=>{if(!R)return null;t(!0);const W=Oe(F.target),J=Ie(W);await Ce(J).then(()=>{var E;p==null||p(),u==null||u(),(E=F==null?void 0:F.target)==null||E.reset()}).catch(E=>{L(Y=>({...Y,text:E.message,type:"error"})),y==null||y(E)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ie=k(async(F,R)=>{if(!R)return;t(!0);const{saveAddressBook:W,...J}=Oe(F.target),E=Ie(J);await dt(E).then(()=>{var Y;p==null||p(),u==null||u(),(Y=F==null?void 0:F.target)==null||Y.reset()}).catch(Y=>{L(ge=>({...ge,text:Y.message,type:"error"})),y==null||y(Y)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ce=et(()=>{if(!N.length)return[];const F={...Vt,defaultValue:o,isHidden:s&&!B?!0:!i},R={...Ht,defaultValue:d,isHidden:s&&!B?!0:!l},W=[...N,F,R],J=sessionStorage.getItem(`${g}_addressData`),E=J?kt(JSON.parse(J).data,w):{},Y=Bt(qt(E,c),W);return zt({fields:Y,addressId:h,countryOptions:Z,disableField:A,regionOptions:w,isRequiredRegion:K,isRequiredPostCode:v})},[N,o,s,B,i,d,l,g,w,c,h,Z,A,K,v]),ue=k(F=>{I(R=>({...R,...F}))},[]);return{isWaitingForResponse:U,regionOptions:w,saveCheckBoxAddress:B,inLineAlert:O,addressId:h,submitLoading:x,normalizeFieldsConfig:ce,handleSaveCheckBoxAddress:re,handleUpdateAddress:oe,handleCreateAddress:ie,handleOnCloseForm:Le,handleInputChange:ue}},jt=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:n,...r}=e;return{...r,...Re(s,"camelCase",{})}},Wt=({hideActionFormButtons:e,formName:s="",showFormLoader:n=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:o,slots:i,addressesFormTitle:l,className:c,addressFormId:u,inputsDefaultValueSet:p,showShippingCheckBox:y=!0,showBillingCheckBox:g=!0,shippingCheckBoxValue:O=!0,billingCheckBoxValue:L=!0,isOpen:x,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:N,onChange:T})=>{const Z=ne({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:z,inLineAlert:w,addressId:V,submitLoading:C,normalizeFieldsConfig:H,handleUpdateAddress:q,handleCreateAddress:P,handleOnCloseForm:K,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,handleInputChange:b,regionOptions:M}=Pt({showFormLoader:n,addressFormId:u,inputsDefaultValueSet:jt(p),shippingCheckBoxValue:O,billingCheckBoxValue:L,showShippingCheckBox:y,showBillingCheckBox:g,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:f,onError:N,onCloseBtnClick:h,formName:s});return x?j("div",{className:X(["account-address-form-wrapper",c]),children:[l?a("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,w.text?a(Ye,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:w.type,variant:"secondary",heading:w.text,icon:w.icon}):null,j(Tt,{regionOptions:M,forwardFormRef:o,slots:i,className:"account-address-form",name:s||"addressesForm",fieldsConfig:H,onSubmit:t||(V?q:P),setInputChange:b,loading:C,showFormLoader:n,showSaveCheckBox:r,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,onChange:T,isWaitingForResponse:z,children:[V?a("input",{type:"hidden",name:"addressId",value:V,"data-testid":"hidden_test_id"}):null,e?null:a("div",{className:X(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:i!=null&&i.AddressFormActions?a(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:i.AddressFormActions,context:{handleUpdateAddress:q,handleCreateAddress:P,addressId:V}}):a(Q,{children:r?null:j(Q,{children:[a(de,{type:"button",onClick:K,variant:"secondary",disabled:C,children:Z.secondaryButton}),a(de,{disabled:C,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,xt as E,Tt as F,$t as S,s1 as a,ze as c,r1 as d,Oe as g,Ut as n}; diff --git a/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js b/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js index 9f005a650..72b5c7516 100644 --- a/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js +++ b/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{t as u,k as i,f as _,l as f,m as p}from"./removeCustomerAddress.js";const g=(r,a="en-US",s={})=>{const t={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},e=new Date(r);return isNaN(e.getTime())?"Invalid Date":new Intl.DateTimeFormat(a,t).format(e)},y=r=>{var d,c;if(!((c=(d=r.data)==null?void 0:d.customer)!=null&&c.orders))return null;const{items:a,page_info:s,total_count:o,date_of_first_order:t}=r.data.customer.orders,{returns:e}=r.data.customer;return{items:a.map(n=>{const l={...n,returns:e==null?void 0:e.items.filter(m=>m.order.id===n.id),order_date:g(n.order_date),shipping_address:u(n.shipping_address),billing_address:u(n.billing_address)};return i(l,"camelCase",{})}),pageInfo:i(s,"camelCase",{}),totalCount:i(o,"camelCase",{}),dateOfFirstOrder:i(t,"camelCase",{})}},h=` +import{t as u,k as i,f as _,l as p}from"./removeCustomerAddress.js";const f=(e,r="en-US",s={})=>{const t={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},a=new Date(e);return isNaN(a.getTime())?"Invalid Date":new Intl.DateTimeFormat(r,t).format(a)},g=e=>{var d,c;if(!((c=(d=e.data)==null?void 0:d.customer)!=null&&c.orders))return null;const{items:r,page_info:s,total_count:n,date_of_first_order:t}=e.data.customer.orders,{returns:a}=e.data.customer;return{items:r.map(o=>{const l={...o,returns:a==null?void 0:a.items.filter(m=>m.order.id===o.id),order_date:f(o.order_date),shipping_address:u(o.shipping_address),billing_address:u(o.billing_address)};return i(l,"camelCase",{})}),pageInfo:i(s,"camelCase",{}),totalCount:i(n,"camelCase",{}),dateOfFirstOrder:i(t,"camelCase",{})}},y=` fragment AddressesList on OrderAddress { city company @@ -121,6 +121,6 @@ fragment OrderSummary on OrderTotal { } } } -${h} +${y} ${O} -`,E={sort_direction:"DESC",sort_field:"CREATED_AT"},C=async(r,a,s)=>{const o=a.includes("viewAll")?{}:{order_date:JSON.parse(a)};return await _(S,{method:"GET",cache:"no-cache",variables:{pageSize:r,currentPage:s,filter:o,sort:E}}).then(t=>{var e;return(e=t.errors)!=null&&e.length?f(t.errors):y(t)}).catch(p)};export{C as g}; +`,h={sort_direction:"DESC",sort_field:"CREATED_AT"},E=async(e,r,s)=>{const n=r.includes("viewAll")?{}:{order_date:JSON.parse(r)};return await _(S,{method:"GET",cache:"no-cache",variables:{pageSize:e,currentPage:s,filter:n,sort:h}}).then(t=>(console.log("response.errors",t.errors),g(t))).catch(p)};export{E as g}; diff --git a/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js b/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js index 4119a48f9..82ff94f04 100644 --- a/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js +++ b/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const S=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),f=(t,n,e)=>{const r=["string","boolean","number"],o=n==="camelCase"?S:p;return Array.isArray(t)?t.map(i=>r.includes(typeof i)||i===null?i:typeof i=="object"?f(i,n,e):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const u=e&&e[c]?e[c]:o(c);return i[u]=r.includes(typeof a)||a===null?a:f(a,n,e),i},{}):t},{setEndpoint:k,setFetchGraphQlHeader:H,removeFetchGraphQlHeader:J,setFetchGraphQlHeaders:K,fetchGraphQl:s,getConfig:L}=new C().getMethods(),T=` +import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const S=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),f=(t,n,e)=>{const r=["string","boolean","number"],o=n==="camelCase"?S:p;return Array.isArray(t)?t.map(i=>r.includes(typeof i)||i===null?i:typeof i=="object"?f(i,n,e):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const u=e&&e[c]?e[c]:o(c);return i[u]=r.includes(typeof a)||a===null?a:f(a,n,e),i},{}):t},{setEndpoint:k,setFetchGraphQlHeader:H,removeFetchGraphQlHeader:J,setFetchGraphQlHeaders:K,fetchGraphQl:m,getConfig:L}=new C().getMethods(),T=` query GET_ATTRIBUTES_FORM($formCode: String!) { attributesForm(formCode: $formCode) { items { @@ -46,13 +46,13 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||b.emit("error",{source:"auth",type:"network",error:t}),t},g=t=>{const n=t.map(e=>e.message).join(" ");throw Error(n)},y=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let r=2;r<=e.multiline_count;r++){const o={...e,is_required:!1,name:`${e.code}_multiline_${r}`,code:`${e.code}_multiline_${r}`,id:`${e.code}_multiline_${r}`};n.push(o)}return n},R=t=>{var i,c,a;const n=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!n.length)return[];const e=(a=n.filter(u=>{var l;return!((l=u.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:u,...l})=>{const m=u!=="country_id"?u:"country_code";return{...l,name:m,id:m,code:m}}),r=y(e);return e.concat(r).map(u=>{var E;const l=u.code==="middlename"?"middleName":u.code==="firstname"?"firstName":u.code==="lastname"?"lastName":S(u.code),m=(E=u.options)==null?void 0:E.map(h=>({isDefault:h.is_default,text:h.label,value:h.value}));return f({...u,options:m,customUpperCode:l},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((u,l)=>u.orderNumber-l.orderNumber)},v=t=>{const n={};for(const e in t){const r=t[e];!Array.isArray(r)||r.length===0||(e==="custom_attributesV2"?r.forEach(o=>{typeof o=="object"&&"value"in o&&(n[o==null?void 0:o.code]=o==null?void 0:o.value)}):r.length>1?r.forEach((o,i)=>{i===0?n[e]=o:n[`${e}_multiline_${i+1}`]=o}):n[e]=r[0])}return n},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 e,r,o;return f({...N(t),...O(t),...I(t),city:(t==null?void 0:t.city)??"",region:{region:((e=t==null?void 0:t.region)==null?void 0:e.region)??"",region_code:((r=t==null?void 0:t.region)==null?void 0:r.region_code)??"",region_id:((o=t==null?void 0:t.region)==null?void 0:o.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",{})},G=t=>{var r,o;const n=((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.addresses)||[];return n.length?n.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},M=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:n,storeConfig:e}=t.data,r=e==null?void 0:e.countries_with_required_region.split(","),o=e==null?void 0:e.optional_zip_countries.split(",");return{availableCountries:n.filter(({two_letter_abbreviation:u,full_name_locale:l})=>!!(u&&l)).map(u=>{const{two_letter_abbreviation:l,full_name_locale:m}=u;return{value:l,text:m}}).sort((u,l)=>u.text.localeCompare(l.text)),countriesWithRequiredRegion:r,optionalZipCountries:o}},U=t=>{var e,r;return(r=(e=t==null?void 0:t.data)==null?void 0:e.country)!=null&&r.available_regions?t.data.country.available_regions.filter(o=>{if(!o)return!1;const{id:i,code:c,name:a}=o;return!!(i&&c&&a)}).map(o=>{const{id:i}=o;return{id:i,text:o.name,value:`${o.code},${o.id}`}}):[]},P=async t=>{const n=`_account_attributesForm_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await s(t!=="shortRequest"?T:A,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return g(r.errors);const o=R(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},w=` +`,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||b.emit("error",{source:"auth",type:"network",error:t}),t},g=t=>{const n=t.map(e=>e.message).join(" ");throw Error(n)},y=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let r=2;r<=e.multiline_count;r++){const o={...e,is_required:!1,name:`${e.code}_multiline_${r}`,code:`${e.code}_multiline_${r}`,id:`${e.code}_multiline_${r}`};n.push(o)}return n},R=t=>{var i,c,a;const n=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!n.length)return[];const e=(a=n.filter(u=>{var l;return!((l=u.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:u,...l})=>{const s=u!=="country_id"?u:"country_code";return{...l,name:s,id:s,code:s}}),r=y(e);return e.concat(r).map(u=>{var E;const l=u.code==="middlename"?"middleName":u.code==="firstname"?"firstName":u.code==="lastname"?"lastName":S(u.code),s=(E=u.options)==null?void 0:E.map(h=>({isDefault:h.is_default,text:h.label,value:h.value}));return f({...u,options:s,customUpperCode:l},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((u,l)=>u.orderNumber-l.orderNumber)},v=t=>{const n={};for(const e in t){const r=t[e];!Array.isArray(r)||r.length===0||(e==="custom_attributesV2"?r.forEach(o=>{typeof o=="object"&&"value"in o&&(n[o==null?void 0:o.code]=o==null?void 0:o.value)}):r.length>1?r.forEach((o,i)=>{i===0?n[e]=o:n[`${e}_multiline_${i+1}`]=o}):n[e]=r[0])}return n},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 e,r,o;return f({...N(t),...O(t),...I(t),city:(t==null?void 0:t.city)??"",region:{region:((e=t==null?void 0:t.region)==null?void 0:e.region)??"",region_code:((r=t==null?void 0:t.region)==null?void 0:r.region_code)??"",region_id:((o=t==null?void 0:t.region)==null?void 0:o.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",{})},G=t=>{var r,o;const n=((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.addresses)||[];return n.length?n.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},M=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:n,storeConfig:e}=t.data,r=e==null?void 0:e.countries_with_required_region.split(","),o=e==null?void 0:e.optional_zip_countries.split(",");return{availableCountries:n.filter(({two_letter_abbreviation:u,full_name_locale:l})=>!!(u&&l)).map(u=>{const{two_letter_abbreviation:l,full_name_locale:s}=u;return{value:l,text:s}}).sort((u,l)=>u.text.localeCompare(l.text)),countriesWithRequiredRegion:r,optionalZipCountries:o}},U=t=>{var e,r;return(r=(e=t==null?void 0:t.data)==null?void 0:e.country)!=null&&r.available_regions?t.data.country.available_regions.filter(o=>{if(!o)return!1;const{id:i,code:c,name:a}=o;return!!(i&&c&&a)}).map(o=>{const{id:i}=o;return{id:i,text:o.name,value:`${o.code},${o.id}`}}):[]},P=async t=>{const n=`_account_attributesForm_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await m(t!=="shortRequest"?T:A,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return g(r.errors);const o=R(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},w=` mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) { createCustomerAddress(input:$input) { firstname } } -`,d=async t=>await s(w,{method:"POST",variables:{input:f(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(n=>{var e,r,o;return(e=n.errors)!=null&&e.length?g(n.errors):((o=(r=n==null?void 0:n.data)==null?void 0:r.createCustomerAddress)==null?void 0:o.firstname)||""}).catch(_),x=` +`,d=async t=>await m(w,{method:"POST",variables:{input:f(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(n=>{var e,r,o;return(e=n.errors)!=null&&e.length?g(n.errors):((o=(r=n==null?void 0:n.data)==null?void 0:r.createCustomerAddress)==null?void 0:o.firstname)||""}).catch(_),x=` query GET_CUSTOMER_ADDRESS { customer { addresses { @@ -86,7 +86,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,z=async()=>await s(x,{method:"GET",cache:"no-cache"}).then(t=>{var n;return(n=t.errors)!=null&&n.length?g(t.errors):G(t)}).catch(_),F=` +`,z=async()=>await m(x,{method:"GET",cache:"no-cache"}).then(t=>{var n;return(n=t.errors)!=null&&n.length?g(t.errors):G(t)}).catch(_),F=` query GET_COUNTRIES_QUERY { countries { two_letter_abbreviation @@ -97,7 +97,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr optional_zip_countries } } -`,Z=async()=>{const t="_account_countries",n=sessionStorage.getItem(t);return n?JSON.parse(n):await s(F,{method:"GET",cache:"no-cache"}).then(e=>{var o;if((o=e.errors)!=null&&o.length)return g(e.errors);const r=M(e);return sessionStorage.setItem(t,JSON.stringify(r)),r}).catch(_)},q=` +`,Z=async()=>{const t="_account_countries",n=sessionStorage.getItem(t);return n?JSON.parse(n):await m(F,{method:"GET",cache:"no-cache"}).then(e=>{var o;if((o=e.errors)!=null&&o.length)return g(e.errors);const r=M(e);return sessionStorage.setItem(t,JSON.stringify(r)),r}).catch(_)},q=` query GET_REGIONS($countryCode: String!) { country(id: $countryCode) { id @@ -108,15 +108,15 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,W=async t=>{const n=`_account_regions_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await s(q,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return g(r.errors);const o=U(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},V=` +`,W=async t=>{const n=`_account_regions_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await m(q,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return g(r.errors);const o=U(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},V=` mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) { updateCustomerAddress(id:$id, input:$input) { firstname } } -`,Y=async t=>{const{addressId:n,...e}=t;return n?await s(V,{method:"POST",variables:{id:n,input:f(e,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var o,i,c;return(o=r.errors)!=null&&o.length?g(r.errors):((c=(i=r==null?void 0:r.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(_):""},B=` +`,Y=async t=>{const{addressId:n,...e}=t;return n?await m(V,{method:"POST",variables:{id:n,input:f(e,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var o,i,c;return(o=r.errors)!=null&&o.length?g(r.errors):((c=(i=r==null?void 0:r.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(_):""},B=` mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) { deleteCustomerAddress(id:$id) } -`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(n=>n.data.deleteCustomerAddress).catch(_);export{H as a,K as b,P as c,d,z as e,s as f,L as g,Z as h,W as i,X as j,f as k,g as l,_ as m,S as n,p as o,J as r,k as s,$ as t,Y as u}; +`,X=async t=>await m(B,{method:"POST",variables:{id:t}}).then(n=>(console.log("response.errors",n.errors),n.data.deleteCustomerAddress)).catch(_);export{H as a,K as b,P as c,d,z as e,m as f,L as g,Z as h,W as i,X as j,f as k,_ as l,S as m,g as n,p as o,J as r,k as s,$ as t,Y as u}; diff --git a/scripts/__dropins__/storefront-account/chunks/updateCustomer.js b/scripts/__dropins__/storefront-account/chunks/updateCustomer.js index b1350616a..e1a97faf6 100644 --- a/scripts/__dropins__/storefront-account/chunks/updateCustomer.js +++ b/scripts/__dropins__/storefront-account/chunks/updateCustomer.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{n as G,f as d,l,m as e,k as M}from"./removeCustomerAddress.js";const $=t=>{var r,m,u,c,i,_,h,C,f,o,E,n,g,T,S,w,O,P,b,A,R;const a=(u=(m=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:m.custom_attributes)==null?void 0:u.reduce((U,N)=>(U[G(N.code)]=N.value??"",U),{});return{email:((i=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:i.email)||"",firstName:((h=(_=t==null?void 0:t.data)==null?void 0:_.customer)==null?void 0:h.firstname)||"",lastName:((f=(C=t==null?void 0:t.data)==null?void 0:C.customer)==null?void 0:f.lastname)||"",middleName:((E=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:E.middlename)||"",gender:((g=(n=t==null?void 0:t.data)==null?void 0:n.customer)==null?void 0:g.gender)||"1",dateOfBirth:((S=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:S.date_of_birth)||"",prefix:((O=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:O.prefix)||"",suffix:((b=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:b.suffix)||"",createdAt:((R=(A=t==null?void 0:t.data)==null?void 0:A.customer)==null?void 0:R.created_at)||"",...a}},I=t=>{var a,r,m,u;return{minLength:+((r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.minimum_password_length)||3,requiredCharacterClasses:+((u=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:u.required_character_classes_number)||0}},y=` +import{m as G,f as d,n as l,l as e,k as M}from"./removeCustomerAddress.js";const $=t=>{var r,m,u,c,i,_,h,C,f,o,E,n,g,T,S,w,O,P,b,A,R;const a=(u=(m=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:m.custom_attributes)==null?void 0:u.reduce((U,N)=>(U[G(N.code)]=N.value??"",U),{});return{email:((i=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:i.email)||"",firstName:((h=(_=t==null?void 0:t.data)==null?void 0:_.customer)==null?void 0:h.firstname)||"",lastName:((f=(C=t==null?void 0:t.data)==null?void 0:C.customer)==null?void 0:f.lastname)||"",middleName:((E=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:E.middlename)||"",gender:((g=(n=t==null?void 0:t.data)==null?void 0:n.customer)==null?void 0:g.gender)||"1",dateOfBirth:((S=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:S.date_of_birth)||"",prefix:((O=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:O.prefix)||"",suffix:((b=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:b.suffix)||"",createdAt:((R=(A=t==null?void 0:t.data)==null?void 0:A.customer)==null?void 0:R.created_at)||"",...a}},I=t=>{var a,r,m,u;return{minLength:+((r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.minimum_password_length)||3,requiredCharacterClasses:+((u=(m=t==null?void 0:t.data)==null?void 0:m.storeConfig)==null?void 0:u.required_character_classes_number)||0}},y=` fragment BasicCustomerInfo on Customer { date_of_birth email diff --git a/scripts/__dropins__/storefront-account/reload b/scripts/__dropins__/storefront-account/reload index 570ec35a4..d7574ba7f 100644 --- a/scripts/__dropins__/storefront-account/reload +++ b/scripts/__dropins__/storefront-account/reload @@ -1 +1 @@ -{"at":1733238773484} \ No newline at end of file +{"at":1733239021134} \ No newline at end of file