@dropins/storefront-account
Advanced tools
Comparing version 1.0.1 to 1.0.2-beta1
@@ -17,3 +17,3 @@ /******************************************************************** | ||
*******************************************************************/ | ||
export declare const GET_STORE_CONFIG = "\n query GET_STORE_CONFIG {\n storeConfig {\n base_media_url\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n }\n }\n"; | ||
export declare const GET_STORE_CONFIG = "\n query GET_STORE_CONFIG {\n storeConfig {\n base_media_url\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n }\n }\n"; | ||
//# sourceMappingURL=getStoreConfig.graphql.d.ts.map |
/*! Copyright 2025 Adobe | ||
All Rights Reserved. */ | ||
import{jsx as n,Fragment as Q,jsxs as W}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Y,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as De,Input as Ge,InputDate as Je,Checkbox as Re,TextArea as Xe,Card as he,Skeleton as we,SkeletonRow as J,Button as de,Tag as pe,Icon as He,Modal as Ke,ProgressSpinner as Ye,IllustratedMessage as Qe,Header as et,InLineAlert as tt}from"@dropins/tools/components.js";import{useRef as rt,useState as _,useEffect as ee,useCallback as z,useMemo as st}from"@dropins/tools/preact-hooks.js";import{n as Ve,o as Be,u as Ce,c as ze,e as at,m as nt,j as dt,h as ot,i as lt,d as ct}from"./removeCustomerAddress.js";import{useText as ae}from"@dropins/tools/i18n.js";import*as X from"@dropins/tools/preact-compat.js";import{memo as _e,forwardRef as it,useImperativeHandle as ut,useMemo as Me,useCallback as Te}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:a,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:o,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,billingCheckBoxValue:g,shippingCheckBoxValue:C,showBillingCheckBox:O,showShippingCheckBox:L,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$})=>n("div",{className:Y(["account-address-form"]),children:n(Jt,{hideActionFormButtons:e,formName:s,showFormLoader:a,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,shippingCheckBoxValue:C,billingCheckBoxValue:g,showShippingCheckBox:L,showBillingCheckBox:O,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$,forwardFormRef:o,showSaveCheckBox:r,saveCheckBoxValue:d})}),pt=e=>e.reduce((s,a)=>({...s,[a.name]:a.value}),{}),ft=e=>/^\d+$/.test(e),mt=e=>/^[a-zA-Z0-9\s]+$/.test(e),ht=e=>/^[a-zA-Z0-9]+$/.test(e),At=e=>/^[a-zA-Z]+$/.test(e),Lt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),gt=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),bt=(e,s,a)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=a},Ze=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],yt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),Ct=(e,s,a)=>{const r=e.length;return r>=s&&r<=a},ye=(e,s,a,r)=>{var S,R;const{requiredFieldError:d,lengthTextError:o,numericError:c,alphaNumWithSpacesError:l,alphaNumericError:i,alphaError:u,emailError:f,dateError:g,urlError:C,dateLengthError:O}=a,L=s==null?void 0:s.customUpperCode,N={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&!e)return{[L]:d};if(!(s!=null&&s.required)&&!e||!((S=s==null?void 0:s.validateRules)!=null&&S.length))return N;const t=pt(s==null?void 0:s.validateRules),p=t.MIN_TEXT_LENGTH??1,m=t.MAX_TEXT_LENGTH??255,T=t.DATE_RANGE_MIN,$=t.DATE_RANGE_MAX;if(!Ct(e,+p,+m)&&!(T||$))return{[L]:o.replace("{min}",p).replace("{max}",m)};if(!bt(e,+T,+$)&&(T||$))return{[L]:O.replace("{min}",Ze(T)).replace("{max}",Ze($))};const k={numeric:{validate:ft,error:c},"alphanum-with-spaces":{validate:mt,error:l},alphanumeric:{validate:ht,error:i},alpha:{validate:At,error:u},email:{validate:Lt,error:f},date:{validate:gt,error:g},url:{validate:yt,error:C}}[t.INPUT_VALIDATION];return k&&!k.validate(e)&&!((R=r[L])!=null&&R.length)?{[L]:k.error}:N},ke=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},Mt=["true","false","yes","on","off"],vt={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},Et=e=>{const s={},a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r],o=r.match(/^(.*)Multiline_(\d+)$/);if(o){const c=o[1],l=parseInt(o[2],10);a[c]||(a[c]=[]),a[c].push({index:l,value:d})}else Object.keys(e).filter(l=>l.startsWith(`${r}Multiline_`)).length>0?a[r]=[{index:1,value:d}]:s[r]=d}for(const r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const d=a[r];d.sort((o,c)=>o.index-c.index),s[r]=d.map(o=>o.value)}return s},_t=e=>{const s={},a=[];for(const r in e){const d=Mt.includes(e[r])?ke(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(vt,r)?s[r]=d:a.push({code:Be(r),value:d}))}return{...s,customAttributes:a}},ne=(e,s=!1)=>{const a=Ve(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=_t(Et(a));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),{})},Ie=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,qe=e=>typeof e=="function",Nt=e=>e.reduce((s,{customUpperCode:a,required:r,defaultValue:d})=>(r&&a&&(s.initialData[a]=d||"",s.errorList[a]=""),s),{initialData:{},errorList:{}}),xe=e=>Object.keys(e).length>0,Tt=({fieldsConfig:e,onSubmit:s,onChange:a,setInputChange:r,formName:d,isWaitingForResponse:o})=>{const c=ae({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=rt(null),[i,u]=_({}),[f,g]=_({}),[C,O]=_({}),[L,N]=_(!0),[t,p]=_(!1),[m,T]=_(!1),[$,Z]=_(!0),[k,S]=_(!1);ee(()=>{const h=()=>{if(l.current){const y=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(y-1))}};return h(),window.addEventListener("resize",h),()=>{window.removeEventListener("resize",h)}},[e==null?void 0:e.length]);const R=z((h=!1)=>{let v=!0;const y={...f};let M=null;for(const[x,A]of Object.entries(i)){const I=e==null?void 0:e.find(F=>F.customUpperCode.includes(x)),B=ye(A.toString(),I,c,y);B[x]&&(Object.assign(y,B),v=!1),M||(M=Object.keys(y).find(F=>y[F])||null)}if(h||g(y),M&&l.current&&!h){const x=l.current.elements.namedItem(M);x==null||x.focus()}return v},[f,e,i,c]),b=z((h,v,y,M)=>{const x={...me(l),[v]:h,...v.includes("countryCode")?{region:""}:{}},A={data:ne(x,!0),isDataValid:Ie(y,x)};S(A.isDataValid),R(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(A)),a==null||a(A,{},M)},[R,d,a]);ee(()=>{if(e!=null&&e.length){const{initialData:h,errorList:v}=Nt(e);u(y=>({...h,...y})),g(v),O(v)}},[JSON.stringify(e)]),ee(()=>{if(m)return;const h=me(l),v=sessionStorage.getItem(`${d}_addressData`);if(xe(i)&&xe(C)){let y={};const M=Ie(C,i);v?y=JSON.parse(v).data:y=ne(h,!0)??{},a==null||a({data:y,isDataValid:M},{},null),S(M),T(!0)}},[i,C]),ee(()=>{var x;if(!$)return;const h=me(l),v=!!(h!=null&&h.countryCode),y=!!((x=h==null?void 0:h.region)!=null&&x.length);h&&v&&!y&&qe(a)&&!o&&b(h==null?void 0:h.region,"region",C,null)},[$,L,e,l,a,b,C,t,o]);const U=z((h,v)=>{const{name:y,value:M,type:x,checked:A}=h==null?void 0:h.target,I=x==="checkbox"?A:M;u(H=>{const te={...H,[y]:I};return y==="countryCode"&&(te.region="",N(!0),p(!1)),te}),r==null||r({[y]:I}),T(!0);const B=e==null?void 0:e.find(H=>H.customUpperCode.includes(y));let F=v?{...v}:{...f};if(B){const H=ye(I.toString(),B,c,F);H&&Object.assign(F,H),g(F)}b(I,y,C,h)},[r,e,f,c,b,C,L]),P=z(h=>{const{name:v}=h==null?void 0:h.target,y=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(y!=null&&y.options.length)&&Z(!1),Z(v==="countryCode")},[]),V=z((h,v)=>{const{name:y,value:M,type:x,checked:A}=h==null?void 0:h.target,I=x==="checkbox"?A:M,B=e==null?void 0:e.find(F=>F.customUpperCode===y);if(B){const F=v?{...v}:{...f},H=ye(I.toString(),B,c,F);H&&Object.assign(F,H),g(F)}},[f,e,c]),K=z(h=>{h.preventDefault();const v=R();s==null||s(h,v)},[R,s]);return{isDataValid:k,formData:i,errors:f,formRef:l,handleInputChange:U,onFocus:P,handleBlur:V,handleSubmit:K,handleValidationSubmit:R}};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 $t=_e(({loading:e,values:s,fields:a=[],errors:r,className:d="",onChange:o,onBlur:c,onFocus:l,slots:i})=>{const u=`${d}__field`,f=(t,p)=>{if(!(i!=null&&i[`AddressFormInput_${t.code}`]))return;const m={inputName:t.customUpperCode,handleOnChange:o,handleOnBlur:c,handleOnFocus:l,errorMessage:p,errors:r,config:t};return n(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:i[`AddressFormInput_${t.code}`],context:m},t.id)},g=(t,p,m)=>{var $;const T=(($=t.options.find(Z=>Z.isDefault))==null?void 0:$.value)??p??t.defaultValue;return n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(De,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,required:t==null?void 0:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,options:t.options,onBlur:c,onFocus:l,handleSelect:o,defaultValue:T,value:T})},t.id)})},C=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(Ge,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onFocus:l,onChange:o})},t.id)}),O=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(Je,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o,disabled:e||t.disabled})},t.id)}),L=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:(t==null?void 0:t.isHidden)??e,children:n(Re,{"aria-label":t.label,"aria-required":t.required?"true":"false","aria-hidden":t.isHidden,tabindex:t!=null&&t.isHidden?-1:0,id:t.code,name:t.customUpperCode,checked:p||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o})},t.id)}),N=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(Xe,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o})},t.id)});return a.length?n(Q,{children:a.map(t=>{const p=r==null?void 0:r[t.customUpperCode],m=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case se.TEXT:return t.options.length?g(t,m,p):C(t,m,p);case se.MULTILINE:return C(t,m,p);case se.SELECT:return g(t,m,p);case se.DATE:return O(t,m,p);case se.BOOLEAN:return L(t,m,p);case se.TEXTAREA:return N(t,m,p);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const a=W(we,{"data-testid":e||"skeletonLoader",children:[n(J,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),n(J,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),n(J,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?a:n(he,{variant:"secondary",className:Y(["account-account-loaders","account-account-loaders--card-loader"]),children:a})},Zt=()=>W(we,{"data-testid":"addressFormLoader",children:[n(J,{variant:"heading",size:"medium"}),n(J,{variant:"empty",size:"medium"}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large",fullWidth:!0}),n(J,{size:"large",fullWidth:!0,lines:3}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large"}),n(J,{size:"large",fullWidth:!0})]}),It=_e(it(({isWaitingForResponse:e,setInputChange:s,showFormLoader:a,slots:r,name:d,loading:o,children:c,className:l="defaultForm",fieldsConfig:i,onSubmit:u,onChange:f,forwardFormRef:g,regionOptions:C,showSaveCheckBox:O,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:N})=>{const t=ae({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:p,formData:m,errors:T,formRef:$,handleInputChange:Z,handleBlur:k,handleSubmit:S,handleValidationSubmit:R,onFocus:b}=Tt({fieldsConfig:i,onSubmit:u,onChange:f,setInputChange:s,regionOptions:C,formName:d,isWaitingForResponse:e});return ut(g,()=>{const U=me($);return{handleValidationSubmit:R,formData:ne(U,!0),isDataValid:p}}),a||!(i!=null&&i.length)?n(Zt,{}):W("form",{className:Y(["account-form",l]),onSubmit:S,name:d,ref:$,children:[n($t,{className:l,loading:o,fields:i,onChange:Z,onBlur:k,errors:T,values:m,onFocus:b,slots:r}),r!=null&&r.AddressFormInputs?n(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,O?n("div",{className:"account-address-form--saveAddressBook",children:n(Re,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:N,onChange:U=>{Z(U),L==null||L(U)}})}):null,c]})})),ve=({slots:e,selectable:s,selectShipping:a,selectBilling:r,variant:d="secondary",minifiedView:o,keysSortOrder:c,addressData:l,loading:i,setAddressId:u,handleRenderModal:f,handleRenderForm:g})=>{const C=o?"minifiedView":"fullSizeView",O=ae({actionRemove:`Account.${C}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${C}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${C}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${C}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${C}.Addresses.addressCard.defaultLabelText`}),L=O.cardLabelBilling.toLocaleUpperCase(),N=O.cardLabelShipping.toLocaleUpperCase(),t=O.defaultLabelText.toLocaleUpperCase(),p=Me(()=>{const b={shippingLabel:N,billingLabel:L,hideShipping:!1,hideBilling:!1};return s?a&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!a?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:b:b},[L,t,N,r,a,s]),m=Te(()=>{u==null||u(l==null?void 0:l.id),f==null||f()},[f,l==null?void 0:l.id,u]),T=Te(()=>{u==null||u(l==null?void 0:l.id),g==null||g()},[g,l==null?void 0:l.id,u]),$=Me(()=>{if(!c)return[];const{region:b,...U}=l,P={...U,...b};return c.filter(({name:V})=>P[V]).map(V=>({name:V.name,orderNumber:V.orderNumber,value:P[V.name],label:V.label}))},[l,c]),{shippingLabel:Z,billingLabel:k,hideShipping:S,hideBilling:R}=p;return n(he,{variant:d,className:"account-address-card","data-testid":"addressCard",children:i?n(Ue,{}):W(Q,{children:[W("div",{className:"account-address-card__action",children:[f?n(de,{type:"button",variant:"tertiary",onClick:m,"data-testid":"removeButton",children:O.actionRemove}):null,g?n(de,{type:"button",variant:"tertiary",onClick:T,className:"account-address-card__action--editbutton","data-testid":"editButton",children:O.actionEdit}):null]}),n("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?n(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:$}}):n(Q,{children:$.map((b,U)=>{const P=b.label?`${b.label}: ${b==null?void 0:b.value}`:b==null?void 0:b.value;return n("p",{"data-testid":`${b.name}_${U}`,children:P},U)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?W("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?n(pe,{label:N}):null,l!=null&&l.defaultBilling?n(pe,{label:L}):null]}):null,s?W("div",{className:"account-address-card__labels",children:[!S&&(l!=null&&l.defaultShipping)?n(pe,{label:Z}):null,!R&&(l!=null&&l.defaultBilling)?n(pe,{label:k}):null]}):null]})})},xt=e=>X.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},X.createElement("g",{id:"Large"},X.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),X.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},X.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"}),X.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"})))),Ft=e=>X.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},X.createElement("g",{id:"Large"},X.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),X.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},X.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"})))),Ot=e=>X.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.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"})),St=e=>X.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.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:a,minifiedView:r,routeAddressesPage:d})=>{const o=r?"minifiedView":"fullSizeView",c=ae({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=e?"span":"button",i=e?{}:{AriaRole:"button",type:"button"},u=r&&!a?c.viewAllAddressesButton:c.addNewAddressButton,f=e?c.differentAddressButton:u;return W(l,{...i,className:Y(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:d,children:[n("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:f}),n(He,{source:r&&!a?Ft:xt,size:"32"})]})},Rt=({minifiedView:e,keysSortOrder:s,addressData:a,open:r,submitLoading:d,onRemoveAddress:o,closeModal:c})=>{const l=e?"minifiedView":"fullSizeView",i=ae({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return r?n("div",{className:"account-address-modal",children:W(Ke,{className:"account-address-modal--overlay",title:n("h3",{children:i.title}),size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:c,children:[d?n("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:n(Ye,{stroke:"4",size:"large"})}):null,n("p",{children:i.description}),n(ve,{minifiedView:e,addressData:a,keysSortOrder:s}),W("div",{className:"account-address-modal__buttons",children:[n(de,{type:"button",onClick:c,variant:"secondary",disabled:d,children:i.actionCancel}),n(de,{disabled:d,onClick:o,children:i.actionConfirm})]})]})}):null},wt=({typeList:e,isEmpty:s,minifiedView:a,className:r})=>{const d=a?"minifiedView":"fullSizeView",o=ae({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),c=Me(()=>{switch(e){case"address":return{icon:Ot,text:n("p",{children:o.addressesMessage})};case"orders":return{icon:St,text:n("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!c.text?null:n(Qe,{className:Y(["account-empty-list",a?"account-empty-list--minified":"",r]),message:c.text,icon:n(He,{source:c.icon}),"data-testid":"emptyList"})},Ht=async(e,s)=>{if(s.length===1){const c=s[0],i=Object.values(c.region).every(f=>!!f)?{}:{region:{...c.region,regionId:0}};return!!await Ce({addressId:Number(c==null?void 0:c.id),defaultShipping:!1,defaultBilling:!1,...i})}const a=s.filter(c=>c.id!==e&&(c.defaultBilling||c.defaultShipping)||c.id!==e),r=s[s.length-1],d=a[0]||((r==null?void 0:r.id)!==e?r:null);return!d||!d.id?!1:!!await Ce({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},Vt=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing","fax","prefix","suffix","middlename"],n1=["email","firstname","lastname","middlename","gender","dob","prefix","suffix","fax"],Pe=(e,s,a)=>{if(s&&a||!s&&!a)return e;const r=e.slice();return s?r.sort((d,o)=>Number(o.defaultShipping)-Number(d.defaultShipping)):a?r.sort((d,o)=>Number(o.defaultBilling)-Number(d.defaultBilling)):e},Ee=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(Ee),Bt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:a,onAddressData:r,minifiedView:d,routeAddressesPage:o,onSuccess:c})=>{const[l,i]=_(""),[u,f]=_(!1),[g,C]=_(!1),[O,L]=_(!1),[N,t]=_(!1),[p,m]=_(!1),[T,$]=_(""),[Z,k]=_([]),[S,R]=_([]),b=z(async()=>{L(!0),Promise.all([ze("shortRequest"),at()]).then(A=>{const[I,B]=A;if(I){const F=I.map(({name:H,orderNumber:te,label:re})=>({name:nt(H),orderNumber:te,label:Vt.includes(H)?null:re}));R(F)}if(B)if(d){const F=B.filter(H=>!!H.defaultShipping||!!H.defaultBilling);k(F)}else k(B)}).finally(()=>{L(!1)})},[d]);ee(()=>{b()},[b]),ee(()=>{var A;if(Z.length)if(a===0)m(!0),i("0");else{const I=Z.find(F=>+F.id===a)||Pe(Z,e,s)[0],B={data:ne(I),isDataValid:!Ee(I)};i(a.toString()||((A=I==null?void 0:I.id)==null?void 0:A.toString())),r==null||r(B)}},[Z,a,r,s,e]);const U=z(A=>{$(A),m(!1)},[]),P=z((A,I)=>{const B=(A==null?void 0:A.target).value,F=(A==null?void 0:A.target).nextSibling;i(B);const H={data:ne(I),isDataValid:!Ee(ne(I))};r==null||r(H),m(B==="0"),F&&(F.focus(),window.scrollBy(0,100))},[r]),V=z(()=>{C(!0)},[]),K=z(()=>{$(""),C(!1),f(!1)},[]),h=z(()=>{f(!0)},[]),v=z(async()=>{t(!0),await Ht(T,Z),dt(+T).then(()=>{b(),K()}).finally(()=>{t(!1)})},[Z,T,K,b]),y=z(()=>{m(!1)},[]),M=z(()=>{qe(o)&&d&&!p?window.location.href=o():(m(!0),$(""))},[p,o,d]),x=z(async()=>{await b(),await(c==null?void 0:c())},[b,c]);return{keysSortOrder:S,submitLoading:N,isModalRendered:u,isFormRendered:g,loading:O,addNewAddress:p,addressesList:Z,addressId:T,handleRenderForm:V,handleRenderModal:h,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:U,closeNewAddressForm:y,redirectToAddressesRoute:M,handleOnSuccess:x,handleSelectAddressOption:P,selectedAddressOption:l}},d1=_e(({minifiedViewKey:e,hideActionFormButtons:s=!1,inputName:a,slots:r,title:d="",addressFormTitle:o="",defaultSelectAddressId:c="",showFormLoader:l=!1,onAddressData:i,forwardFormRef:u,className:f,showSaveCheckBox:g=!1,saveCheckBoxValue:C=!1,selectShipping:O=!1,selectBilling:L=!1,selectable:N=!1,withHeader:t=!0,minifiedView:p=!1,withActionsInMinifiedView:m=!1,withActionsInFullSizeView:T=!0,inputsDefaultValueSet:$,showShippingCheckBox:Z=!0,showBillingCheckBox:k=!0,shippingCheckBoxValue:S=!0,billingCheckBoxValue:R=!0,routeAddressesPage:b,onSuccess:U,onError:P})=>{const V=ae({containerTitle:`Account.${e}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${e}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${e}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${e}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${e}.Addresses.newAddressFormTitle`,ariaLabelAddressPicker:`Account.${e}.Addresses.ariaLabelAddressPicker`}),{keysSortOrder:K,submitLoading:h,isModalRendered:v,isFormRendered:y,loading:M,addNewAddress:x,addressesList:A,addressId:I,handleRenderForm:B,handleRenderModal:F,removeAddress:H,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:oe,redirectToAddressesRoute:ce,handleSelectAddressOption:ie,selectedAddressOption:ue}=Bt({defaultSelectAddressId:c,minifiedView:p,routeAddressesPage:b,onSuccess:U,onAddressData:i,selectShipping:O,selectBilling:L}),E=d||V.containerTitle;let j=null;if(N){const w=Pe(A,O,L)||[];let D;x?D=n("div",{className:Y(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",x]]),children:n(fe,{slots:r,hideActionFormButtons:s,formName:a,showFormLoader:l,isOpen:x,forwardFormRef:u,showSaveCheckBox:g,saveCheckBoxValue:C,shippingCheckBoxValue:S,billingCheckBoxValue:R,addressesFormTitle:o||V.differentAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:Z,showBillingCheckBox:k,onCloseBtnClick:oe,onSuccess:re,onError:P,onChange:i})}):w.length?D=n(Fe,{selectable:N,minifiedView:p,addNewAddress:x,routeAddressesPage:ce}):D=null;const G=`generalLabel_${E.replace(/\s+/g,"")}`;j=W("div",{className:"account-addresses-wrapper--select-view",children:[n("span",{id:G,style:"display: none;",children:E}),w.map((q,ge)=>{const be=`${a}_${q.id}`,Ne=`${be}_label`;return W($e,{children:[n("input",{"data-testid":`radio-${ge+1}`,type:"radio",name:a,id:be,value:q.id,checked:ue===(q==null?void 0:q.id.toString()),onChange:We=>ie(We,q),"aria-labelledby":`${G} ${Ne}`}),n("label",{id:Ne,htmlFor:be,className:"account-addresses-wrapper__label",children:n(ve,{slots:r,selectable:N,selectShipping:O,selectBilling:L,minifiedView:p,addressData:q,keysSortOrder:K,loading:M})})]},q.id)}),n("input",{"aria-label":`${E} ${V.ariaLabelAddressPicker}`,"data-testid":"radio-0",type:"radio",name:a,id:`${a}_addressActions`,value:"0",checked:ue==="0",onChange:q=>ie(q,{}),tabindex:D?0:-1}),n("label",{htmlFor:`${a}_addressActions`,className:"account-addresses-wrapper__label",children:D})]})}else j=W(Q,{children:[A.map(w=>n($e,{children:I===w.id&&y?n(he,{variant:"secondary",style:{marginBottom:20},children:n(fe,{slots:r,isOpen:I===w.id&&y,addressFormId:I,inputsDefaultValueSet:w,addressesFormTitle:V.editAddressFormTitle,showShippingCheckBox:Z,showBillingCheckBox:k,shippingCheckBoxValue:S,billingCheckBoxValue:R,onCloseBtnClick:te,onSuccess:re,onError:P})}):n(ve,{slots:r,minifiedView:p,addressData:w,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:p&&m||!p&&T?F:void 0,handleRenderForm:p&&m||!p&&T?B:void 0},w.id)},w.id)),n("div",{className:"account-addresses__footer",children:x?n(he,{variant:"secondary",children:n(fe,{slots:r,isOpen:x,addressesFormTitle:V.newAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:!!(A!=null&&A.length),showBillingCheckBox:!!(A!=null&&A.length),shippingCheckBoxValue:S,billingCheckBoxValue:R,onCloseBtnClick:oe,onSuccess:re,onError:P})}):n(Fe,{minifiedView:p,addNewAddress:x,routeAddressesPage:ce})})]});return W("div",{children:[t?n(et,{title:E,divider:!p,className:p?"account-addresses-header":""}):null,W("div",{className:Y(["account-addresses-wrapper",f]),"data-testid":"addressesIdWrapper",children:[n(Rt,{minifiedView:p,addressData:A==null?void 0:A.find(w=>w.id===I),keysSortOrder:K,submitLoading:h,open:v,closeModal:te,onRemoveAddress:H}),M?n(Ue,{testId:"addressSkeletonLoader",withCard:!1}):N?n(fe,{slots:r,hideActionFormButtons:s,formName:a,isOpen:!(A!=null&&A.length),forwardFormRef:u,showSaveCheckBox:g,saveCheckBoxValue:C,shippingCheckBoxValue:S,billingCheckBoxValue:R,inputsDefaultValueSet:$,showShippingCheckBox:Z,showBillingCheckBox:k,onCloseBtnClick:oe,onSuccess:re,onError:P,onChange:i}):n(wt,{isEmpty:!(A!=null&&A.length),typeList:"address",minifiedView:p}),j]})]})}),je={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},zt={...je,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},kt={...je,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},qt=(e,s)=>s==null?void 0:s.map(a=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName,middleName:e.middlename??e.middleName},d=JSON.parse(JSON.stringify(a));if(Object.hasOwn(r,a.customUpperCode)){const o=r[a.customUpperCode];a.customUpperCode==="region"&&typeof o=="object"?d.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:d.defaultValue=o}return d}),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{}},Ut=({fields:e,addressId:s,countryOptions:a,disableField:r,regionOptions:d,isRequiredRegion:o,isRequiredPostCode:c})=>e.filter(i=>!(s&&(i.customUpperCode==="defaultShipping"||i.customUpperCode==="defaultBilling")&&i.defaultValue)).map(i=>i.customUpperCode==="countryCode"?{...i,options:a,disabled:r}:i.customUpperCode==="postcode"?{...i,required:c}:i.customUpperCode==="region"?{...i,options:d,required:o,disabled:r}:i),Pt=(e,s="address")=>{const a=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","prefix","suffix","fax"],r={},d=[];return Object.keys(e).forEach(o=>{a.includes(o)?r[o]=e[o]:d.push({attribute_code:Be(o),value:e[o]})}),d.length>0&&(r.custom_attributesV2=d),r},Se=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],a=["on","off","true","false"],r=[],d={};for(const L in e){const N=e[L];a.includes(N)&&(d[L]=ke(N)),s.includes(L)&&r.push(N)}const{street:o,streetMultiline_2:c,streetMultiline_1:l,region:i,...u}=e,[f,g]=i?i.split(","):[void 0,void 0],C=g&&f?{regionId:+g,regionCode:f}:{region:f};return Pt({...u,...d,region:{...C},street:r})},jt=(e,s)=>{const a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r];if(r==="region"&&d.regionId){const o=s.find(c=>(c==null?void 0:c.id)===d.regionId);o?a[r]={...d,text:o.text}:a[r]=d}else Array.isArray(d)?(a[r]=d[0]||"",d.slice(1).forEach((o,c)=>{a[`${r}Multiline_${c+2}`]=o})):a[r]=d}return a},Wt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Dt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:a,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:o,showShippingCheckBox:c,showBillingCheckBox:l,inputsDefaultValueSet:i,onCloseBtnClick:u,onSuccess:f,onError:g,formName:C})=>{const[O,L]=_({text:"",type:"success"}),[N,t]=_(e??!1),[p,m]=_(r||""),[T,$]=_([]),[Z,k]=_([]),[S,R]=_([]),[b,U]=_([]),[P,V]=_([]),[K,h]=_(!1),[v,y]=_(!1),[M,x]=_(()=>{var j,w;const E=sessionStorage.getItem(`${C}_addressData`);return E?{countryCode:(w=(j=JSON.parse(E))==null?void 0:j.data)==null?void 0:w.countryCode}:i}),[A,I]=_(!1),[B,F]=_(!1),[H,te]=_(()=>{var w,D;const E=sessionStorage.getItem(`${C}_addressData`);return E?(D=(w=JSON.parse(E))==null?void 0:w.data)==null?void 0:D.saveAddressBook:a}),re=z(E=>{te(E.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{ze(p?"customer_address_edit":"customer_register_address").then(E=>{$(E)})},[p]),ee(()=>{I(!0),ot().then(({availableCountries:E,countriesWithRequiredRegion:j,optionalZipCountries:w})=>{k(E),U(j),V(w),I(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){I(!0),F(!0);const E=M==null?void 0:M.countryCode;lt(E).then(j=>{R(j);const w=b.find(G=>G===E),D=P.find(G=>G===E);h(!!w),y(!D),I(!1),F(!1)})}},[M==null?void 0:M.countryCode,b,P]);const Le=z(()=>{L({text:"",type:"success"}),u==null||u()},[u]),oe=z(async(E,j)=>{if(!j)return null;t(!0);const w=Oe(E.target),D=Se(w);await Ce(D).then(()=>{var G;f==null||f(),u==null||u(),(G=E==null?void 0:E.target)==null||G.reset()}).catch(G=>{L(q=>({...q,text:G.message,type:"error"})),g==null||g(G)}).finally(()=>{m(""),t(!1)})},[u,g,f]),ce=z(async(E,j)=>{if(!j)return;t(!0);const{saveAddressBook:w,...D}=Oe(E.target),G=Se(D);await ct(G).then(()=>{var q;f==null||f(),u==null||u(),(q=E==null?void 0:E.target)==null||q.reset()}).catch(q=>{L(ge=>({...ge,text:q.message,type:"error"})),g==null||g(q)}).finally(()=>{m(""),t(!1)})},[u,g,f]),ie=st(()=>{if(!T.length)return[];const E={...zt,defaultValue:o,isHidden:s&&!H?!0:!c},j={...kt,defaultValue:d,isHidden:s&&!H?!0:!l},w=[...T,E,j],D=sessionStorage.getItem(`${C}_addressData`),G=D?jt(JSON.parse(D).data,S):{},q=qt(Wt(G,i),w);return Ut({fields:q,addressId:p,countryOptions:Z,disableField:A,regionOptions:S,isRequiredRegion:K,isRequiredPostCode:v})},[T,o,s,H,c,d,l,C,S,i,p,Z,A,K,v]),ue=z(E=>{x(j=>({...j,...E}))},[]);return{isWaitingForResponse:B,regionOptions:S,saveCheckBoxAddress:H,inLineAlert:O,addressId:p,submitLoading:N,normalizeFieldsConfig:ie,handleSaveCheckBoxAddress:re,handleUpdateAddress:oe,handleCreateAddress:ce,handleOnCloseForm:Le,handleInputChange:ue}},Gt=e=>{var d;if(!e||!Array.isArray(e.customAttributes))return e??{};const s={};(d=e==null?void 0:e.customAttributes)==null||d.forEach(o=>{o.code&&Object.hasOwn(o,"value")&&(s[o.code]=o.value)});const{customAttributes:a,...r}=e;return{...r,...Ve(s,"camelCase",{})}},Jt=({hideActionFormButtons:e,formName:s="",showFormLoader:a=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:o,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,showShippingCheckBox:g=!0,showBillingCheckBox:C=!0,shippingCheckBoxValue:O=!0,billingCheckBoxValue:L=!0,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$})=>{const Z=ae({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:k,inLineAlert:S,addressId:R,submitLoading:b,normalizeFieldsConfig:U,handleUpdateAddress:P,handleCreateAddress:V,handleOnCloseForm:K,handleSaveCheckBoxAddress:h,saveCheckBoxAddress:v,handleInputChange:y,regionOptions:M}=Dt({showFormLoader:a,addressFormId:u,inputsDefaultValueSet:Gt(f),shippingCheckBoxValue:O,billingCheckBoxValue:L,showShippingCheckBox:g,showBillingCheckBox:C,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:m,onError:T,onCloseBtnClick:p,formName:s});return N?W("div",{className:Y(["account-address-form-wrapper",i]),children:[l?n("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,S.text?n(tt,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:S.type,variant:"secondary",heading:S.text,icon:S.icon}):null,W(It,{regionOptions:M,forwardFormRef:o,slots:c,className:"account-address-form",name:s||"addressesForm",fieldsConfig:U,onSubmit:t||(R?P:V),setInputChange:y,loading:b,showFormLoader:a,showSaveCheckBox:r,handleSaveCheckBoxAddress:h,saveCheckBoxAddress:v,onChange:$,isWaitingForResponse:k,children:[R?n("input",{type:"hidden",name:"addressId",value:R,"data-testid":"hidden_test_id"}):null,e?null:n("div",{className:Y(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:c!=null&&c.AddressFormActions?n(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:c.AddressFormActions,context:{handleUpdateAddress:P,handleCreateAddress:V,addressId:R}}):n(Q,{children:r?null:W(Q,{children:[n(de,{type:"button",onClick:K,variant:"secondary",disabled:b,children:Z.secondaryButton}),n(de,{disabled:b,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,wt as E,It as F,Ft as S,d1 as a,qe as c,n1 as d,Oe as g,Pt as n}; | ||
import{jsx as n,Fragment as Q,jsxs as W}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Y,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as Ge,Input as Je,InputDate as Xe,Checkbox as Re,TextArea as De,Card as he,Skeleton as we,SkeletonRow as X,Button as de,Tag as pe,Icon as He,Modal as Ke,ProgressSpinner as Ye,IllustratedMessage as Qe,Header as et,InLineAlert as tt}from"@dropins/tools/components.js";import{useRef as rt,useState as _,useEffect as ee,useCallback as z,useMemo as st}from"@dropins/tools/preact-hooks.js";import{n as Ve,o as Be,u as Ce,c as ze,e as at,m as nt,j as dt,h as ot,i as lt,d as ct}from"./removeCustomerAddress.js";import{useText as ae}from"@dropins/tools/i18n.js";import*as D from"@dropins/tools/preact-compat.js";import{memo as _e,forwardRef as it,useImperativeHandle as ut,useMemo as Me,useCallback as Te}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:a,showSaveCheckBox:r,saveCheckBoxValue:d,forwardFormRef:o,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,billingCheckBoxValue:g,shippingCheckBoxValue:C,showBillingCheckBox:O,showShippingCheckBox:L,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$})=>n("div",{className:Y(["account-address-form"]),children:n(Xt,{hideActionFormButtons:e,formName:s,showFormLoader:a,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,shippingCheckBoxValue:C,billingCheckBoxValue:g,showShippingCheckBox:L,showBillingCheckBox:O,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$,forwardFormRef:o,showSaveCheckBox:r,saveCheckBoxValue:d})}),pt=e=>e.reduce((s,a)=>({...s,[a.name]:a.value}),{}),ft=e=>/^\d+$/.test(e),mt=e=>/^[a-zA-Z0-9\s]+$/.test(e),ht=e=>/^[a-zA-Z0-9]+$/.test(e),At=e=>/^[a-zA-Z]+$/.test(e),Lt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),gt=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),bt=(e,s,a)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=a},Ze=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],yt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),Ct=(e,s,a)=>{const r=e.length;return r>=s&&r<=a},ye=(e,s,a,r)=>{var S,R;const{requiredFieldError:d,lengthTextError:o,numericError:c,alphaNumWithSpacesError:l,alphaNumericError:i,alphaError:u,emailError:f,dateError:g,urlError:C,dateLengthError:O}=a,L=s==null?void 0:s.customUpperCode,N={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&(!e||e==="false"))return{[L]:d};if(!(s!=null&&s.required)&&!e||!((S=s==null?void 0:s.validateRules)!=null&&S.length))return N;const t=pt(s==null?void 0:s.validateRules),p=t.MIN_TEXT_LENGTH??1,m=t.MAX_TEXT_LENGTH??255,T=t.DATE_RANGE_MIN,$=t.DATE_RANGE_MAX;if(!Ct(e,+p,+m)&&!(T||$))return{[L]:o.replace("{min}",p).replace("{max}",m)};if(!bt(e,+T,+$)&&(T||$))return{[L]:O.replace("{min}",Ze(T)).replace("{max}",Ze($))};const k={numeric:{validate:ft,error:c},"alphanum-with-spaces":{validate:mt,error:l},alphanumeric:{validate:ht,error:i},alpha:{validate:At,error:u},email:{validate:Lt,error:f},date:{validate:gt,error:g},url:{validate:yt,error:C}}[t.INPUT_VALIDATION];return k&&!k.validate(e)&&!((R=r[L])!=null&&R.length)?{[L]:k.error}:N},ke=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},Mt=["true","false","yes","on","off"],vt={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:"",prefix:"",middleName:"",fax:"",suffix:""},Et=e=>{const s={},a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r],o=r.match(/^(.*)Multiline_(\d+)$/);if(o){const c=o[1],l=parseInt(o[2],10);a[c]||(a[c]=[]),a[c].push({index:l,value:d})}else Object.keys(e).filter(l=>l.startsWith(`${r}Multiline_`)).length>0?a[r]=[{index:1,value:d}]:s[r]=d}for(const r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const d=a[r];d.sort((o,c)=>o.index-c.index),s[r]=d.map(o=>o.value)}return s},_t=e=>{const s={},a=[];for(const r in e){const d=Mt.includes(e[r])?ke(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(vt,r)?s[r]=d:a.push({code:Be(r),value:d}))}return{...s,customAttributes:a}},ne=(e,s=!1)=>{const a=Ve(e,"camelCase",{firstname:"firstName",lastname:"lastName",middlename:"middleName"}),r=_t(Et(a));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),{})},Ie=(e,s)=>Object.keys(e).length?Object.keys(e).every(r=>r in s&&s[r]!==""):!1,qe=e=>typeof e=="function",Nt=e=>e.reduce((s,{customUpperCode:a,required:r,defaultValue:d})=>(r&&a&&(s.initialData[a]=d||"",s.errorList[a]=""),s),{initialData:{},errorList:{}}),xe=e=>Object.keys(e).length>0,Tt=({fieldsConfig:e,onSubmit:s,onChange:a,setInputChange:r,formName:d,isWaitingForResponse:o})=>{const c=ae({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=rt(null),[i,u]=_({}),[f,g]=_({}),[C,O]=_({}),[L,N]=_(!0),[t,p]=_(!1),[m,T]=_(!1),[$,Z]=_(!0),[k,S]=_(!1);ee(()=>{const h=()=>{if(l.current){const y=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(y-1))}};return h(),window.addEventListener("resize",h),()=>{window.removeEventListener("resize",h)}},[e==null?void 0:e.length]);const R=z((h=!1)=>{let v=!0;const y={...f};let M=null;for(const[x,A]of Object.entries(i)){const I=e==null?void 0:e.find(F=>F.customUpperCode.includes(x)),B=ye(A.toString(),I,c,y);B[x]&&(Object.assign(y,B),v=!1),M||(M=Object.keys(y).find(F=>y[F])||null)}if(h||g(y),M&&l.current&&!h){const x=l.current.elements.namedItem(M);x==null||x.focus()}return v},[f,e,i,c]),b=z((h,v,y,M)=>{const x={...me(l),[v]:h,...v.includes("countryCode")?{region:""}:{}},A={data:ne(x,!0),isDataValid:Ie(y,x)};S(A.isDataValid),R(!0),["selectedShippingAddress","selectedBillingAddress"].includes(d)&&sessionStorage.setItem(`${d}_addressData`,JSON.stringify(A)),a==null||a(A,{},M)},[R,d,a]);ee(()=>{if(e!=null&&e.length){const{initialData:h,errorList:v}=Nt(e);u(y=>({...h,...y})),g(v),O(v)}},[JSON.stringify(e)]),ee(()=>{if(m)return;const h=me(l),v=sessionStorage.getItem(`${d}_addressData`);if(xe(i)&&xe(C)){let y={};const M=Ie(C,i);v?y=JSON.parse(v).data:y=ne(h,!0)??{},a==null||a({data:y,isDataValid:M},{},null),S(M),T(!0)}},[i,C]),ee(()=>{var x;if(!$)return;const h=me(l),v=!!(h!=null&&h.countryCode),y=!!((x=h==null?void 0:h.region)!=null&&x.length);h&&v&&!y&&qe(a)&&!o&&b(h==null?void 0:h.region,"region",C,null)},[$,L,e,l,a,b,C,t,o]);const U=z((h,v)=>{const{name:y,value:M,type:x,checked:A}=h==null?void 0:h.target,I=x==="checkbox"?A:M;u(H=>{const te={...H,[y]:I};return y==="countryCode"&&(te.region="",N(!0),p(!1)),te}),r==null||r({[y]:I}),T(!0);const B=e==null?void 0:e.find(H=>H.customUpperCode.includes(y));let F=v?{...v}:{...f};if(B){const H=ye(I.toString(),B,c,F);H&&Object.assign(F,H),g(F)}b(I,y,C,h)},[r,e,f,c,b,C,L]),P=z(h=>{const{name:v}=h==null?void 0:h.target,y=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(y!=null&&y.options.length)&&Z(!1),Z(v==="countryCode")},[]),V=z((h,v)=>{const{name:y,value:M,type:x,checked:A}=h==null?void 0:h.target,I=x==="checkbox"?A:M,B=e==null?void 0:e.find(F=>F.customUpperCode===y);if(B){const F=v?{...v}:{...f},H=ye(I.toString(),B,c,F);H&&Object.assign(F,H),g(F)}},[f,e,c]),K=z(h=>{h.preventDefault();const v=R();s==null||s(h,v)},[R,s]);return{isDataValid:k,formData:i,errors:f,formRef:l,handleInputChange:U,onFocus:P,handleBlur:V,handleSubmit:K,handleValidationSubmit:R}};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 $t=_e(({loading:e,values:s,fields:a=[],errors:r,className:d="",onChange:o,onBlur:c,onFocus:l,slots:i})=>{const u=`${d}__field`,f=(t,p)=>{if(!(i!=null&&i[`AddressFormInput_${t.code}`]))return;const m={inputName:t.customUpperCode,handleOnChange:o,handleOnBlur:c,handleOnFocus:l,errorMessage:p,errors:r,config:t};return n(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:i[`AddressFormInput_${t.code}`],context:m},t.id)},g=(t,p,m)=>{var $;const T=(($=t.options.find(Z=>Z.isDefault))==null?void 0:$.value)??p??t.defaultValue;return n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(Ge,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,required:t==null?void 0:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,options:t.options,onBlur:c,onFocus:l,handleSelect:o,defaultValue:T,value:T})},t.id)})},C=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(Je,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onFocus:l,onChange:o})},t.id)}),O=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e||t.disabled,children:n(Xe,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o,disabled:e||t.disabled})},t.id)}),L=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:(t==null?void 0:t.isHidden)??e,children:n(Re,{"aria-label":t.label,"aria-required":t.required?"true":"false","aria-hidden":t.isHidden,tabindex:t!=null&&t.isHidden?-1:0,id:t.code,name:t.customUpperCode,checked:p||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o})},t.id)}),N=(t,p,m)=>n(Q,{children:f(t,m)??n(le,{error:m,className:Y([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${d}--${t.id}`,disabled:e,children:n(De,{"aria-label":t.label,"aria-required":t.required?"true":"false",id:t.code,type:"text",name:t.customUpperCode,value:p??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:o})},t.id)});return a.length?n(Q,{children:a.map(t=>{const p=r==null?void 0:r[t.customUpperCode],m=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case se.TEXT:return t.options.length?g(t,m,p):C(t,m,p);case se.MULTILINE:return C(t,m,p);case se.SELECT:return g(t,m,p);case se.DATE:return O(t,m,p);case se.BOOLEAN:return L(t,m,p);case se.TEXTAREA:return N(t,m,p);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const a=W(we,{"data-testid":e||"skeletonLoader",children:[n(X,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),n(X,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),n(X,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?a:n(he,{variant:"secondary",className:Y(["account-account-loaders","account-account-loaders--card-loader"]),children:a})},Zt=()=>W(we,{"data-testid":"addressFormLoader",children:[n(X,{variant:"heading",size:"medium"}),n(X,{variant:"empty",size:"medium"}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large",fullWidth:!0}),n(X,{size:"large",fullWidth:!0,lines:3}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large"}),n(X,{size:"large",fullWidth:!0})]}),It=_e(it(({isWaitingForResponse:e,setInputChange:s,showFormLoader:a,slots:r,name:d,loading:o,children:c,className:l="defaultForm",fieldsConfig:i,onSubmit:u,onChange:f,forwardFormRef:g,regionOptions:C,showSaveCheckBox:O,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:N})=>{const t=ae({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:p,formData:m,errors:T,formRef:$,handleInputChange:Z,handleBlur:k,handleSubmit:S,handleValidationSubmit:R,onFocus:b}=Tt({fieldsConfig:i,onSubmit:u,onChange:f,setInputChange:s,regionOptions:C,formName:d,isWaitingForResponse:e});return ut(g,()=>{const U=me($);return{handleValidationSubmit:R,formData:ne(U,!0),isDataValid:p}}),a||!(i!=null&&i.length)?n(Zt,{}):W("form",{className:Y(["account-form",l]),onSubmit:S,name:d,ref:$,children:[n($t,{className:l,loading:o,fields:i,onChange:Z,onBlur:k,errors:T,values:m,onFocus:b,slots:r}),r!=null&&r.AddressFormInputs?n(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,O?n("div",{className:"account-address-form--saveAddressBook",children:n(Re,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:N,onChange:U=>{Z(U),L==null||L(U)}})}):null,c]})})),ve=({slots:e,selectable:s,selectShipping:a,selectBilling:r,variant:d="secondary",minifiedView:o,keysSortOrder:c,addressData:l,loading:i,setAddressId:u,handleRenderModal:f,handleRenderForm:g})=>{const C=o?"minifiedView":"fullSizeView",O=ae({actionRemove:`Account.${C}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${C}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${C}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${C}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${C}.Addresses.addressCard.defaultLabelText`}),L=O.cardLabelBilling.toLocaleUpperCase(),N=O.cardLabelShipping.toLocaleUpperCase(),t=O.defaultLabelText.toLocaleUpperCase(),p=Me(()=>{const b={shippingLabel:N,billingLabel:L,hideShipping:!1,hideBilling:!1};return s?a&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!a?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:b:b},[L,t,N,r,a,s]),m=Te(()=>{u==null||u(l==null?void 0:l.id),f==null||f()},[f,l==null?void 0:l.id,u]),T=Te(()=>{u==null||u(l==null?void 0:l.id),g==null||g()},[g,l==null?void 0:l.id,u]),$=Me(()=>{if(!c)return[];const{region:b,...U}=l,P={...U,...b};return c.filter(({name:V})=>P[V]).map(V=>({name:V.name,orderNumber:V.orderNumber,value:P[V.name],label:V.label}))},[l,c]),{shippingLabel:Z,billingLabel:k,hideShipping:S,hideBilling:R}=p;return n(he,{variant:d,className:"account-address-card","data-testid":"addressCard",children:i?n(Ue,{}):W(Q,{children:[W("div",{className:"account-address-card__action",children:[f?n(de,{type:"button",variant:"tertiary",onClick:m,"data-testid":"removeButton",children:O.actionRemove}):null,g?n(de,{type:"button",variant:"tertiary",onClick:T,className:"account-address-card__action--editbutton","data-testid":"editButton",children:O.actionEdit}):null]}),n("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?n(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:$}}):n(Q,{children:$.map((b,U)=>{const P=b.label?`${b.label}: ${b==null?void 0:b.value}`:b==null?void 0:b.value;return n("p",{"data-testid":`${b.name}_${U}`,children:P},U)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?W("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?n(pe,{label:N}):null,l!=null&&l.defaultBilling?n(pe,{label:L}):null]}):null,s?W("div",{className:"account-address-card__labels",children:[!S&&(l!=null&&l.defaultShipping)?n(pe,{label:Z}):null,!R&&(l!=null&&l.defaultBilling)?n(pe,{label:k}):null]}):null]})})},xt=e=>D.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},D.createElement("g",{id:"Large"},D.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),D.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},D.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"}),D.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"})))),Ft=e=>D.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},D.createElement("g",{id:"Large"},D.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),D.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},D.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"})))),Ot=e=>D.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},D.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"currentColor"})),St=e=>D.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},D.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),Fe=({selectable:e,className:s,addNewAddress:a,minifiedView:r,routeAddressesPage:d})=>{const o=r?"minifiedView":"fullSizeView",c=ae({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=e?"span":"button",i=e?{}:{AriaRole:"button",type:"button"},u=r&&!a?c.viewAllAddressesButton:c.addNewAddressButton,f=e?c.differentAddressButton:u;return W(l,{...i,className:Y(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:d,children:[n("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:f}),n(He,{source:r&&!a?Ft:xt,size:"32"})]})},Rt=({minifiedView:e,keysSortOrder:s,addressData:a,open:r,submitLoading:d,onRemoveAddress:o,closeModal:c})=>{const l=e?"minifiedView":"fullSizeView",i=ae({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return r?n("div",{className:"account-address-modal",children:W(Ke,{className:"account-address-modal--overlay",title:n("h3",{children:i.title}),size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:c,children:[d?n("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:n(Ye,{stroke:"4",size:"large"})}):null,n("p",{children:i.description}),n(ve,{minifiedView:e,addressData:a,keysSortOrder:s}),W("div",{className:"account-address-modal__buttons",children:[n(de,{type:"button",onClick:c,variant:"secondary",disabled:d,children:i.actionCancel}),n(de,{disabled:d,onClick:o,children:i.actionConfirm})]})]})}):null},wt=({typeList:e,isEmpty:s,minifiedView:a,className:r})=>{const d=a?"minifiedView":"fullSizeView",o=ae({addressesMessage:`Account.${d}.EmptyList.Addresses.message`,ordersListMessage:`Account.${d}.EmptyList.OrdersList.message`}),c=Me(()=>{switch(e){case"address":return{icon:Ot,text:n("p",{children:o.addressesMessage})};case"orders":return{icon:St,text:n("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!c.text?null:n(Qe,{className:Y(["account-empty-list",a?"account-empty-list--minified":"",r]),message:c.text,icon:n(He,{source:c.icon}),"data-testid":"emptyList"})},Ht=async(e,s)=>{if(s.length===1){const c=s[0],i=Object.values(c.region).every(f=>!!f)?{}:{region:{...c.region,regionId:0}};return!!await Ce({addressId:Number(c==null?void 0:c.id),defaultShipping:!1,defaultBilling:!1,...i})}const a=s.filter(c=>c.id!==e&&(c.defaultBilling||c.defaultShipping)||c.id!==e),r=s[s.length-1],d=a[0]||((r==null?void 0:r.id)!==e?r:null);return!d||!d.id?!1:!!await Ce({addressId:+d.id,defaultShipping:!0,defaultBilling:!0})},Vt=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing","fax","prefix","suffix","middlename"],n1=["email","firstname","lastname","middlename","gender","dob","prefix","suffix","fax"],Pe=(e,s,a)=>{if(s&&a||!s&&!a)return e;const r=e.slice();return s?r.sort((d,o)=>Number(o.defaultShipping)-Number(d.defaultShipping)):a?r.sort((d,o)=>Number(o.defaultBilling)-Number(d.defaultBilling)):e},Ee=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(Ee),Bt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:a,onAddressData:r,minifiedView:d,routeAddressesPage:o,onSuccess:c})=>{const[l,i]=_(""),[u,f]=_(!1),[g,C]=_(!1),[O,L]=_(!1),[N,t]=_(!1),[p,m]=_(!1),[T,$]=_(""),[Z,k]=_([]),[S,R]=_([]),b=z(async()=>{L(!0),Promise.all([ze("shortRequest"),at()]).then(A=>{const[I,B]=A;if(I){const F=I.map(({name:H,orderNumber:te,label:re})=>({name:nt(H),orderNumber:te,label:Vt.includes(H)?null:re}));R(F)}if(B)if(d){const F=B.filter(H=>!!H.defaultShipping||!!H.defaultBilling);k(F)}else k(B)}).finally(()=>{L(!1)})},[d]);ee(()=>{b()},[b]),ee(()=>{var A;if(Z.length)if(a===0)m(!0),i("0");else{const I=Z.find(F=>+F.id===a)||Pe(Z,e,s)[0],B={data:ne(I),isDataValid:!Ee(I)};i(a.toString()||((A=I==null?void 0:I.id)==null?void 0:A.toString())),r==null||r(B)}},[Z,a,r,s,e]);const U=z(A=>{$(A),m(!1)},[]),P=z((A,I)=>{const B=(A==null?void 0:A.target).value,F=(A==null?void 0:A.target).nextSibling;i(B);const H={data:ne(I),isDataValid:!Ee(ne(I))};r==null||r(H),m(B==="0"),F&&(F.focus(),window.scrollBy(0,100))},[r]),V=z(()=>{C(!0)},[]),K=z(()=>{$(""),C(!1),f(!1)},[]),h=z(()=>{f(!0)},[]),v=z(async()=>{t(!0),await Ht(T,Z),dt(+T).then(()=>{b(),K()}).finally(()=>{t(!1)})},[Z,T,K,b]),y=z(()=>{m(!1)},[]),M=z(()=>{qe(o)&&d&&!p?window.location.href=o():(m(!0),$(""))},[p,o,d]),x=z(async()=>{await b(),await(c==null?void 0:c())},[b,c]);return{keysSortOrder:S,submitLoading:N,isModalRendered:u,isFormRendered:g,loading:O,addNewAddress:p,addressesList:Z,addressId:T,handleRenderForm:V,handleRenderModal:h,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:U,closeNewAddressForm:y,redirectToAddressesRoute:M,handleOnSuccess:x,handleSelectAddressOption:P,selectedAddressOption:l}},d1=_e(({minifiedViewKey:e,hideActionFormButtons:s=!1,inputName:a,slots:r,title:d="",addressFormTitle:o="",defaultSelectAddressId:c="",showFormLoader:l=!1,onAddressData:i,forwardFormRef:u,className:f,showSaveCheckBox:g=!1,saveCheckBoxValue:C=!1,selectShipping:O=!1,selectBilling:L=!1,selectable:N=!1,withHeader:t=!0,minifiedView:p=!1,withActionsInMinifiedView:m=!1,withActionsInFullSizeView:T=!0,inputsDefaultValueSet:$,showShippingCheckBox:Z=!0,showBillingCheckBox:k=!0,shippingCheckBoxValue:S=!0,billingCheckBoxValue:R=!0,routeAddressesPage:b,onSuccess:U,onError:P})=>{const V=ae({containerTitle:`Account.${e}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${e}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${e}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${e}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${e}.Addresses.newAddressFormTitle`,ariaLabelAddressPicker:`Account.${e}.Addresses.ariaLabelAddressPicker`}),{keysSortOrder:K,submitLoading:h,isModalRendered:v,isFormRendered:y,loading:M,addNewAddress:x,addressesList:A,addressId:I,handleRenderForm:B,handleRenderModal:F,removeAddress:H,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:oe,redirectToAddressesRoute:ce,handleSelectAddressOption:ie,selectedAddressOption:ue}=Bt({defaultSelectAddressId:c,minifiedView:p,routeAddressesPage:b,onSuccess:U,onAddressData:i,selectShipping:O,selectBilling:L}),E=d||V.containerTitle;let j=null;if(N){const w=Pe(A,O,L)||[];let G;x?G=n("div",{className:Y(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",x]]),children:n(fe,{slots:r,hideActionFormButtons:s,formName:a,showFormLoader:l,isOpen:x,forwardFormRef:u,showSaveCheckBox:g,saveCheckBoxValue:C,shippingCheckBoxValue:S,billingCheckBoxValue:R,addressesFormTitle:o||V.differentAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:Z,showBillingCheckBox:k,onCloseBtnClick:oe,onSuccess:re,onError:P,onChange:i})}):w.length?G=n(Fe,{selectable:N,minifiedView:p,addNewAddress:x,routeAddressesPage:ce}):G=null;const J=`generalLabel_${E.replace(/\s+/g,"")}`;j=W("div",{className:"account-addresses-wrapper--select-view",children:[n("span",{id:J,style:"display: none;",children:E}),w.map((q,ge)=>{const be=`${a}_${q.id}`,Ne=`${be}_label`;return W($e,{children:[n("input",{"data-testid":`radio-${ge+1}`,type:"radio",name:a,id:be,value:q.id,checked:ue===(q==null?void 0:q.id.toString()),onChange:We=>ie(We,q),"aria-labelledby":`${J} ${Ne}`}),n("label",{id:Ne,htmlFor:be,className:"account-addresses-wrapper__label",children:n(ve,{slots:r,selectable:N,selectShipping:O,selectBilling:L,minifiedView:p,addressData:q,keysSortOrder:K,loading:M})})]},q.id)}),n("input",{"aria-label":`${E} ${V.ariaLabelAddressPicker}`,"data-testid":"radio-0",type:"radio",name:a,id:`${a}_addressActions`,value:"0",checked:ue==="0",onChange:q=>ie(q,{}),tabindex:G?0:-1}),n("label",{htmlFor:`${a}_addressActions`,className:"account-addresses-wrapper__label",children:G})]})}else j=W(Q,{children:[A.map(w=>n($e,{children:I===w.id&&y?n(he,{variant:"secondary",style:{marginBottom:20},children:n(fe,{slots:r,isOpen:I===w.id&&y,addressFormId:I,inputsDefaultValueSet:w,addressesFormTitle:V.editAddressFormTitle,showShippingCheckBox:Z,showBillingCheckBox:k,shippingCheckBoxValue:S,billingCheckBoxValue:R,onCloseBtnClick:te,onSuccess:re,onError:P})}):n(ve,{slots:r,minifiedView:p,addressData:w,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:p&&m||!p&&T?F:void 0,handleRenderForm:p&&m||!p&&T?B:void 0},w.id)},w.id)),n("div",{className:"account-addresses__footer",children:x?n(he,{variant:"secondary",children:n(fe,{slots:r,isOpen:x,addressesFormTitle:V.newAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:!!(A!=null&&A.length),showBillingCheckBox:!!(A!=null&&A.length),shippingCheckBoxValue:S,billingCheckBoxValue:R,onCloseBtnClick:oe,onSuccess:re,onError:P})}):n(Fe,{minifiedView:p,addNewAddress:x,routeAddressesPage:ce})})]});return W("div",{children:[t?n(et,{title:E,divider:!p,className:p?"account-addresses-header":""}):null,W("div",{className:Y(["account-addresses-wrapper",f]),"data-testid":"addressesIdWrapper",children:[n(Rt,{minifiedView:p,addressData:A==null?void 0:A.find(w=>w.id===I),keysSortOrder:K,submitLoading:h,open:v,closeModal:te,onRemoveAddress:H}),M?n(Ue,{testId:"addressSkeletonLoader",withCard:!1}):N?n(fe,{slots:r,hideActionFormButtons:s,formName:a,isOpen:!(A!=null&&A.length),forwardFormRef:u,showSaveCheckBox:g,saveCheckBoxValue:C,shippingCheckBoxValue:S,billingCheckBoxValue:R,inputsDefaultValueSet:$,showShippingCheckBox:Z,showBillingCheckBox:k,onCloseBtnClick:oe,onSuccess:re,onError:P,onChange:i}):n(wt,{isEmpty:!(A!=null&&A.length),typeList:"address",minifiedView:p}),j]})]})}),je={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},zt={...je,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},kt={...je,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},qt=(e,s)=>s==null?void 0:s.map(a=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName,middleName:e.middlename??e.middleName},d=JSON.parse(JSON.stringify(a));if(Object.hasOwn(r,a.customUpperCode)){const o=r[a.customUpperCode];a.customUpperCode==="region"&&typeof o=="object"?d.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:d.defaultValue=o}return d}),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{}},Ut=({fields:e,addressId:s,countryOptions:a,disableField:r,regionOptions:d,isRequiredRegion:o,isRequiredPostCode:c})=>e.filter(i=>!(s&&(i.customUpperCode==="defaultShipping"||i.customUpperCode==="defaultBilling")&&i.defaultValue)).map(i=>i.customUpperCode==="countryCode"?{...i,options:a,disabled:r}:i.customUpperCode==="postcode"?{...i,required:c}:i.customUpperCode==="region"?{...i,options:d,required:o,disabled:r}:i),Pt=(e,s="address")=>{const a=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","prefix","suffix","fax"],r={},d=[];return Object.keys(e).forEach(o=>{a.includes(o)?r[o]=e[o]:d.push({attribute_code:Be(o),value:e[o]})}),d.length>0&&(r.custom_attributesV2=d),r},Se=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],a=["on","off","true","false"],r=[],d={};for(const L in e){const N=e[L];a.includes(N)&&(d[L]=ke(N)),s.includes(L)&&r.push(N)}const{street:o,streetMultiline_2:c,streetMultiline_1:l,region:i,...u}=e,[f,g]=i?i.split(","):[void 0,void 0],C=g&&f?{regionId:+g,regionCode:f}:{region:f};return Pt({...u,...d,region:{...C},street:r})},jt=(e,s)=>{const a={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const d=e[r];if(r==="region"&&d.regionId){const o=s.find(c=>(c==null?void 0:c.id)===d.regionId);o?a[r]={...d,text:o.text}:a[r]=d}else Array.isArray(d)?(a[r]=d[0]||"",d.slice(1).forEach((o,c)=>{a[`${r}Multiline_${c+2}`]=o})):a[r]=d}return a},Wt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Gt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:a,addressFormId:r,billingCheckBoxValue:d,shippingCheckBoxValue:o,showShippingCheckBox:c,showBillingCheckBox:l,inputsDefaultValueSet:i,onCloseBtnClick:u,onSuccess:f,onError:g,formName:C})=>{const[O,L]=_({text:"",type:"success"}),[N,t]=_(e??!1),[p,m]=_(r||""),[T,$]=_([]),[Z,k]=_([]),[S,R]=_([]),[b,U]=_([]),[P,V]=_([]),[K,h]=_(!1),[v,y]=_(!1),[M,x]=_(()=>{var j,w;const E=sessionStorage.getItem(`${C}_addressData`);return E?{countryCode:(w=(j=JSON.parse(E))==null?void 0:j.data)==null?void 0:w.countryCode}:i}),[A,I]=_(!1),[B,F]=_(!1),[H,te]=_(()=>{var w,G;const E=sessionStorage.getItem(`${C}_addressData`);return E?(G=(w=JSON.parse(E))==null?void 0:w.data)==null?void 0:G.saveAddressBook:a}),re=z(E=>{te(E.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{ze(p?"customer_address_edit":"customer_register_address").then(E=>{$(E)})},[p]),ee(()=>{I(!0),ot().then(({availableCountries:E,countriesWithRequiredRegion:j,optionalZipCountries:w})=>{k(E),U(j),V(w),I(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){I(!0),F(!0);const E=M==null?void 0:M.countryCode;lt(E).then(j=>{R(j);const w=b.find(J=>J===E),G=P.find(J=>J===E);h(!!w),y(!G),I(!1),F(!1)})}},[M==null?void 0:M.countryCode,b,P]);const Le=z(()=>{L({text:"",type:"success"}),u==null||u()},[u]),oe=z(async(E,j)=>{if(!j)return null;t(!0);const w=Oe(E.target),G=Se(w);await Ce(G).then(()=>{var J;f==null||f(),u==null||u(),(J=E==null?void 0:E.target)==null||J.reset()}).catch(J=>{L(q=>({...q,text:J.message,type:"error"})),g==null||g(J)}).finally(()=>{m(""),t(!1)})},[u,g,f]),ce=z(async(E,j)=>{if(!j)return;t(!0);const{saveAddressBook:w,...G}=Oe(E.target),J=Se(G);await ct(J).then(()=>{var q;f==null||f(),u==null||u(),(q=E==null?void 0:E.target)==null||q.reset()}).catch(q=>{L(ge=>({...ge,text:q.message,type:"error"})),g==null||g(q)}).finally(()=>{m(""),t(!1)})},[u,g,f]),ie=st(()=>{if(!T.length)return[];const E={...zt,defaultValue:o,isHidden:s&&!H?!0:!c},j={...kt,defaultValue:d,isHidden:s&&!H?!0:!l},w=[...T,E,j],G=sessionStorage.getItem(`${C}_addressData`),J=G?jt(JSON.parse(G).data,S):{},q=qt(Wt(J,i),w);return Ut({fields:q,addressId:p,countryOptions:Z,disableField:A,regionOptions:S,isRequiredRegion:K,isRequiredPostCode:v})},[T,o,s,H,c,d,l,C,S,i,p,Z,A,K,v]),ue=z(E=>{x(j=>({...j,...E}))},[]);return{isWaitingForResponse:B,regionOptions:S,saveCheckBoxAddress:H,inLineAlert:O,addressId:p,submitLoading:N,normalizeFieldsConfig:ie,handleSaveCheckBoxAddress:re,handleUpdateAddress:oe,handleCreateAddress:ce,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:a,...r}=e;return{...r,...Ve(s,"camelCase",{})}},Xt=({hideActionFormButtons:e,formName:s="",showFormLoader:a=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:d=!1,forwardFormRef:o,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:f,showShippingCheckBox:g=!0,showBillingCheckBox:C=!0,shippingCheckBoxValue:O=!0,billingCheckBoxValue:L=!0,isOpen:N,onSubmit:t,onCloseBtnClick:p,onSuccess:m,onError:T,onChange:$})=>{const Z=ae({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:k,inLineAlert:S,addressId:R,submitLoading:b,normalizeFieldsConfig:U,handleUpdateAddress:P,handleCreateAddress:V,handleOnCloseForm:K,handleSaveCheckBoxAddress:h,saveCheckBoxAddress:v,handleInputChange:y,regionOptions:M}=Gt({showFormLoader:a,addressFormId:u,inputsDefaultValueSet:Jt(f),shippingCheckBoxValue:O,billingCheckBoxValue:L,showShippingCheckBox:g,showBillingCheckBox:C,saveCheckBoxValue:d,showSaveCheckBox:r,onSuccess:m,onError:T,onCloseBtnClick:p,formName:s});return N?W("div",{className:Y(["account-address-form-wrapper",i]),children:[l?n("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,S.text?n(tt,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:S.type,variant:"secondary",heading:S.text,icon:S.icon}):null,W(It,{regionOptions:M,forwardFormRef:o,slots:c,className:"account-address-form",name:s||"addressesForm",fieldsConfig:U,onSubmit:t||(R?P:V),setInputChange:y,loading:b,showFormLoader:a,showSaveCheckBox:r,handleSaveCheckBoxAddress:h,saveCheckBoxAddress:v,onChange:$,isWaitingForResponse:k,children:[R?n("input",{type:"hidden",name:"addressId",value:R,"data-testid":"hidden_test_id"}):null,e?null:n("div",{className:Y(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:c!=null&&c.AddressFormActions?n(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:c.AddressFormActions,context:{handleUpdateAddress:P,handleCreateAddress:V,addressId:R}}):n(Q,{children:r?null:W(Q,{children:[n(de,{type:"button",onClick:K,variant:"secondary",disabled:b,children:Z.secondaryButton}),n(de,{disabled:b,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,wt as E,It as F,Ft as S,d1 as a,qe as c,n1 as d,Oe as g,Pt as n}; |
/*! Copyright 2025 Adobe | ||
All Rights Reserved. */ | ||
import{Initializer as f}from"@dropins/tools/lib.js";import{f as h,l as _,k as g}from"./removeCustomerAddress.js";const c=new f({init:async t=>{const r={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};c.config.setConfig({...r,...t})},listeners:()=>[]}),C=c.config,l=t=>{var r,a,i,e,o,n;return{baseMediaUrl:(a=(r=t==null?void 0:t.data)==null?void 0:r.storeConfig)==null?void 0:a.base_media_url,minLength:+((e=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:e.minimum_password_length)||3,requiredCharacterClasses:+((n=(o=t==null?void 0:t.data)==null?void 0:o.storeConfig)==null?void 0:n.required_character_classes_number)||0}},m=` | ||
import{Initializer as d}from"@dropins/tools/lib.js";import{f as h,l as g,k as l}from"./removeCustomerAddress.js";const _=new d({init:async t=>{const a={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};_.config.setConfig({...a,...t})},listeners:()=>[]}),G=_.config,m=t=>{var a,r,i,o,e,c,n,f;return{baseMediaUrl:(r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.base_media_url,minLength:+((o=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:o.minimum_password_length)||3,requiredCharacterClasses:+((c=(e=t==null?void 0:t.data)==null?void 0:e.storeConfig)==null?void 0:c.required_character_classes_number)||0,storeCode:((f=(n=t==null?void 0:t.data)==null?void 0:n.storeConfig)==null?void 0:f.store_code)??""}},u=` | ||
query GET_STORE_CONFIG { | ||
@@ -10,4 +10,5 @@ storeConfig { | ||
required_character_classes_number | ||
store_code | ||
} | ||
} | ||
`,s=async()=>await h(m,{method:"GET",cache:"force-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?_(t.errors):l(t)}).catch(g);export{C as c,s as g,c as i}; | ||
`,b=async()=>await h(u,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?g(t.errors):m(t)}).catch(l);export{G as c,b as g,_ as i}; |
/*! Copyright 2025 Adobe | ||
All Rights Reserved. */ | ||
import{jsxs as L,jsx as d,Fragment as ue}from"@dropins/tools/preact-jsx-runtime.js";import{classes as re,Slot as me}from"@dropins/tools/lib.js";import{F as fe,d as he,g as ge,n as D,C as we}from"../chunks/CustomerInformationCard.js";import*as V from"@dropins/tools/preact-compat.js";import{Card as Q,Header as X,InLineAlert as te,InputPassword as R,Button as O}from"@dropins/tools/components.js";import{useState as m,useEffect as B,useCallback as C,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as Ce}from"../chunks/getStoreConfig.js";import{u as Pe,g as pe,b as ee,a as be}from"../chunks/updateCustomer.js";import{useText as x}from"@dropins/tools/i18n.js";import{c as Ee}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const Ve=e=>V.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ye=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Ie=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ve=()=>{const[e,t]=m(null);return B(()=>{const n=sessionStorage.getItem("accountStoreConfig"),r=n?JSON.parse(n):null;if(r){const{minLength:o,requiredCharacterClasses:s}=r;t({minLength:o,requiredCharacterClasses:s})}else Ce().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:P}=o;sessionStorage.setItem("accountStoreConfig",JSON.stringify(o)),t({minLength:s,requiredCharacterClasses:P})}})},[]),{passwordConfigs:e}},Fe=({currentPassword:e,newPassword:t,confirmPassword:n,translations:r})=>{let o={...K};const s=!e.length&&!t.length&&!n.length,P=e.length&&t!==n;return s?(o={...o,currentPassword:r.requiredFieldError,newPassword:r.requiredFieldError,confirmPassword:r.requiredFieldError},{isValid:!1,errors:o}):e.length?t.length?n.length?P?(o={...o,currentPassword:"",newPassword:"",confirmPassword:r.passwordMismatch},{isValid:!1,errors:o}):{isValid:!0,errors:o}:(o={...o,confirmPassword:r.requiredFieldError},{isValid:!1,errors:o}):(o={...o,newPassword:r.requiredFieldError},{isValid:!1,errors:o}):(o={...o,currentPassword:r.requiredFieldError},{isValid:!1,errors:o})},ne=(e,t)=>{if(t<=1)return!0;const n=/[0-9]/.test(e)?1:0,r=/[a-z]/.test(e)?1:0,o=/[A-Z]/.test(e)?1:0,s=/[^a-zA-Z0-9\s]/.test(e)?1:0;return n+r+o+s>=t},K={currentPassword:"",newPassword:"",confirmPassword:""},Le=({passwordConfigs:e,handleSetInLineAlert:t,handleHideChangePassword:n})=>{const r=x({requiredFieldError:"Account.FormText.requiredFieldError",passwordMismatch:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch",incorrectCurrentPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword",passwordUpdateMessage:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage"}),[o,s]=m(!1),[P,l]=m(!1),[c,p]=m(""),[h,u]=m(""),[_,y]=m(""),[I,b]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{n(()=>{t({}),b(K)})},[n,t]),M=C(f=>{p(f),b(E=>({...E,currentPassword:f?"":r.requiredFieldError}))},[r]),w=C(f=>{u(f),b(E=>({...E,newPassword:f?"":r.requiredFieldError}))},[r]),H=C(f=>{y(f),b(E=>({...E,confirmPassword:f?"":r.requiredFieldError}))},[r]),A=C(f=>{const{name:E,value:Z}=f==null?void 0:f.target;b(v=>({...v,[E]:Z?"":r.requiredFieldError}))},[r]),T=C(()=>{const{isValid:f,errors:E}=Fe({currentPassword:c,newPassword:h,confirmPassword:_,translations:r});return b(E),f},[c,h,_,r]),U=C(f=>{f.preventDefault(),l(!0);const E=(e==null?void 0:e.requiredCharacterClasses)??0,Z=(e==null?void 0:e.minLength)??1;if(!T()){s(!0),l(!1);return}if(!ne(h,E)||Z>(h==null?void 0:h.length)){s(!0),l(!1);return}Pe({currentPassword:c,newPassword:h}).then(v=>{if(!(v!=null&&v.length)){l(!1);return}p(""),u(""),y(""),b(K),s(!1),t({type:"success",text:r.passwordUpdateMessage})}).catch(v=>{v.message==="Invalid login or password."&&t({type:"error",text:r.incorrectCurrentPassword}),v.message==="The account is locked."&&t({type:"error",text:v.message})}),l(!1)},[e,T,h,c,t,r]);return{hideChangePassword:i,handleOnBlurPassword:A,handleConfirmPasswordChange:H,handleNewPasswordChange:w,handleCurrentPasswordChange:M,mutationChangePassword:U,currentPassword:c,newPassword:h,confirmPassword:_,passwordErrors:I,submitLoading:P,isClickSubmit:o}},_e=({passwordConfigs:e,isClickSubmit:t,password:n})=>{const r=x({messageLengthPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword"}),[o,s]=m("pending");B(()=>{if(!e)return;const l=ne(n,e.requiredCharacterClasses);t&&n.length>0?s(l?"success":"error"):t&&n.length===0?s("pending"):s(l?"success":"pending")},[t,e,n]);const P=G(()=>{var c;if(!e)return;const l={status:"pending",icon:"pending",message:(c=r.messageLengthPassword)==null?void 0:c.replace("{minLength}",`${e.minLength}`)};return n.length&&n.length>=e.minLength?{...l,icon:"success",status:"success"}:n.length&&n.length<e.minLength?t?{...l,icon:"error",status:"error"}:{...l,icon:"pending",status:"pending"}:l},[e,r.messageLengthPassword,n==null?void 0:n.length,t]);return{isValidUniqueSymbols:o,defaultLengthMessage:P}},Ae=(e,t,n,r,o)=>e==="error"||(t==null?void 0:t.status)==="error"||n&&r.trim().length===0?o.newPassword:void 0,Me=({handleHideChangePassword:e,handleSetInLineAlert:t,inLineAlertProps:n})=>{const{passwordConfigs:r}=ve(),{hideChangePassword:o,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:l,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:u,confirmPassword:_,passwordErrors:y,submitLoading:I,isClickSubmit:b}=Le({passwordConfigs:r,handleSetInLineAlert:t,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:M}=_e({password:u,isClickSubmit:b,passwordConfigs:r}),w=x({containerTitle:"Account.minifiedView.CustomerInformation.changePassword.containerTitle",currentPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder",currentPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel",newPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder",newPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel",confirmPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel",buttonSecondary:"Account.minifiedView.CustomerInformation.changePassword.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.changePassword.buttonPrimary"});return L(Q,{className:"account-change-password",variant:"secondary",children:[d(X,{title:w.containerTitle,divider:!1,className:"account-change-password__title"}),n.text?d(te,{className:"account-change-password__notification",type:n.type,variant:"secondary",heading:n.text,icon:n.icon,"data-testid":"changePasswordInLineAlert"}):null,L("div",{className:"account-change-password__fields",children:[d(R,{className:"account-change-password__fields-item",autoComplete:"currentPassword",name:"currentPassword",placeholder:w.currentPasswordPlaceholder,floatingLabel:w.currentPasswordFloatingLabel,errorMessage:y.currentPassword,defaultValue:h,onValue:c,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"newPassword",name:"newPassword",placeholder:w.newPasswordPlaceholder,floatingLabel:w.newPasswordFloatingLabel,minLength:r==null?void 0:r.minLength,validateLengthConfig:M,uniqueSymbolsStatus:i,requiredCharacterClasses:r==null?void 0:r.requiredCharacterClasses,errorMessage:Ae(i,M,b,u,y),defaultValue:u,onValue:l,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"confirmPassword",name:"confirmPassword",placeholder:w.confirmPasswordPlaceholder,floatingLabel:w.confirmPasswordFloatingLabel,errorMessage:y.confirmPassword,defaultValue:_,onValue:P,onBlur:s})]}),L("div",{className:"account-change-password__actions",children:[d(O,{type:"button",disabled:I,onClick:o,variant:"secondary",children:w.buttonSecondary}),d(O,{variant:"primary",type:"button",disabled:I,onClick:p,children:w.buttonPrimary})]})]})},Se=({inLineAlertProps:e,errorPasswordEmpty:t,passwordValue:n,showPasswordOnEmailChange:r,submitLoading:o,formFieldsList:s,handleHideEditForm:P,handleUpdateCustomerInformation:l,handleInputChange:c,handleSetPassword:p,handleOnBlurPassword:h})=>{const u=x({buttonSecondary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary",placeholder:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder",floatingLabel:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel",containerTitle:"Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle",requiredFieldError:"Account.FormText.requiredFieldError"});return L(Q,{variant:"secondary",className:"account-edit-customer-information",children:[d(X,{title:u.containerTitle,divider:!1,className:"account-edit-customer-information__title"}),e.text?d(te,{className:"account-edit-customer-information__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon,"data-testid":"editCustomerInLineAlert"}):null,L(fe,{loading:o,fieldsConfig:s||[],name:"editCustomerInformation",className:"account-edit-customer-information-form",onSubmit:l,setInputChange:c,children:[r?d("div",{className:"account-edit-customer-information__password",children:d(R,{autoComplete:"password",name:"password",placeholder:u.placeholder,floatingLabel:u.floatingLabel,errorMessage:t?u.requiredFieldError:void 0,defaultValue:n,onValue:p,onBlur:h})}):null,L("div",{className:"account-edit-customer-information__actions",children:[d(O,{disabled:o,type:"button",variant:"secondary",onClick:()=>P(),children:u.buttonSecondary}),d(O,{disabled:o,type:"submit",variant:"primary",children:u.buttonPrimary})]})]})]})},Ne=({createdAt:e,slots:t,orderedCustomerData:n,showEditForm:r,showChangePassword:o,handleShowChangePassword:s,handleShowEditForm:P})=>{const l=x({buttonSecondary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary",accountCreation:"Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation"});return d(Q,{variant:"secondary",className:re(["account-customer-information-card",["account-customer-information-card-short",o||r]]),children:L("div",{className:"account-customer-information-card__wrapper",children:[d("div",{className:"account-customer-information-card__content",children:t!=null&&t.CustomerData?d(me,{name:"CustomerData",slot:t==null?void 0:t.CustomerData,context:{customerData:n}}):L(ue,{children:[n==null?void 0:n.map((c,p)=>{const h=c!=null&&c.label?`${c.label}: ${c==null?void 0:c.value}`:c==null?void 0:c.value;return d("p",{"data-testid":`${c.name}_${p}`,children:h},`${c.name}_${p}`)}),L("p",{children:[l.accountCreation,": ",e]})]})}),L("div",{className:"account-customer-information-card__actions",children:[d(O,{type:"button",variant:"tertiary",onClick:s,children:l.buttonSecondary}),d(O,{type:"button",variant:"tertiary",onClick:P,children:l.buttonPrimary})]})]})})},qe=e=>{if(!(e!=null&&e.dateOfBirth))return e;const{dateOfBirth:t,...n}=e;return{...n,dob:t}},ke=({handleSetInLineAlert:e})=>{const t=x({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[n,r]=m(!0),[o,s]=m(!1),[P,l]=m(!1),[c,p]=m(!1),[h,u]=m(!1),[_,y]=m(!1),[I,b]=m([]),[i,M]=m(null),[w,H]=m([]),[A,T]=m({}),[U,f]=m(""),[E,Z]=m(""),v=C(a=>{const{value:g}=a==null?void 0:a.target;g.length&&u(!1),g.length||u(!0)},[]),S=C(a=>{f(a)},[]),oe=C(a=>{T(a)},[]),ae=C(()=>{l(!0),p(!1),e(),S("")},[e,S]),se=C(a=>{a==null||a(),l(!1)},[]),ie=C(()=>{p(!0),l(!1),e(),S("")},[e,S]),ce=C(a=>{a==null||a(),p(!1)},[]),N=C((a,g)=>{a==="success"?e({type:"success",text:g??t.accountSuccess}):a==="error"?e({type:"error",text:g??t.accountError}):e(),s(!1)},[e,t]),W=C(()=>{pe().then(a=>{var F;const g=(F=a==null?void 0:a.createdAt)==null?void 0:F.split(" ")[0],z=qe({...a,gender:a.gender===1?t.genderMale:t.genderFemale});M(z),Z(g)})},[t.genderFemale,t.genderMale]);B(()=>{W()},[]),B(()=>{Ee("customer_account_edit").then(a=>{H(a);const g=a.map(({name:z,customUpperCode:F,orderNumber:q,label:j})=>({name:F,orderNumber:q,label:he.includes(z)?null:j}));b(g)})},[]),B(()=>{A.email&&A.email!==(i==null?void 0:i.email)?y(!0):A.email&&A.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,A]);const $=G(()=>!I||!i?[]:I.filter(({name:g})=>g!==void 0&&i[g]).map(g=>({name:g.name,orderNumber:g.orderNumber,value:i[g.name],label:g.label})),[i,I]);B(()=>{$!=null&&$.length&&r(!1)},[$]);const de=G(()=>w==null?void 0:w.map(a=>({...a,defaultValue:a!=null&&a.customUpperCode&&i?i[a.customUpperCode]??"":""})).map(a=>a.customUpperCode==="gender"?{...a,defaultValue:a.defaultValue==="Male"?1:2}:a),[w,i]),le=C(async(a,g)=>{const z=ge(a.target),{email:F,password:q,...j}=z,Y=F!==(i==null?void 0:i.email)&&q.length===0;if(!g){Y&&u(!0);return}if(u(!1),s(!0),F===(i==null?void 0:i.email)){S(""),ee(D(j,"account")).then(k=>{k&&(W(),N("success"))}).catch(k=>{N("error",k.message)});return}if(Y){u(!0),s(!1);return}F!=null&&F.length&&(q!=null&&q.length)&&be({email:F,password:q}).then(k=>{k&&ee(D(j,"account")).then(J=>{J&&(W(),N("success"))}).catch(J=>{N("error",J.message)})}).catch(k=>{N("error",k.message)})},[i==null?void 0:i.email,S,W,N]);return{createdAt:E,errorPasswordEmpty:h,passwordValue:U,showPasswordOnEmailChange:_,orderedCustomerData:$,loading:n,normalizeFieldsConfig:de,submitLoading:o,showEditForm:c,showChangePassword:P,handleShowChangePassword:ae,handleHideChangePassword:se,handleShowEditForm:ie,handleHideEditForm:ce,handleUpdateCustomerInformation:le,handleInputChange:oe,handleSetPassword:S,handleOnBlurPassword:v,renderAlertMessage:N}},xe={success:d(ye,{}),warning:d(Ve,{}),error:d(Ie,{})},Te=()=>{const[e,t]=m({}),n=C(r=>{if(!(r!=null&&r.type)){t({});return}const o=xe[r.type];t({...r,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlert:n}},Qe=({className:e,withHeader:t=!0,slots:n})=>{const r=x({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:s}=Te(),{createdAt:P,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:u,normalizeFieldsConfig:_,submitLoading:y,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleHideChangePassword:M,handleShowEditForm:w,handleHideEditForm:H,handleUpdateCustomerInformation:A,handleInputChange:T,handleSetPassword:U,handleOnBlurPassword:f}=ke({handleSetInLineAlert:s});return u?d("div",{"data-testid":"customerInformationLoader",children:d(we,{withCard:!0})}):L("div",{className:re(["account-customer-information",e]),children:[t?d(X,{title:r.containerTitle,divider:!1,className:"customer-information__title"}):null,d(Ne,{createdAt:P,slots:n,orderedCustomerData:h,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleShowEditForm:w}),b?d(Me,{inLineAlertProps:o,handleSetInLineAlert:s,handleHideChangePassword:M}):null,I?d(Se,{inLineAlertProps:o,submitLoading:y,formFieldsList:_,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:U,handleOnBlurPassword:f,handleUpdateCustomerInformation:A,handleHideEditForm:H,handleInputChange:T}):null]})};export{Qe as CustomerInformation,Qe as default}; | ||
import{jsxs as L,jsx as d,Fragment as he}from"@dropins/tools/preact-jsx-runtime.js";import{classes as ne,Slot as ge}from"@dropins/tools/lib.js";import{F as we,d as Ce,g as Pe,n as ee,C as pe}from"../chunks/CustomerInformationCard.js";import*as V from"@dropins/tools/preact-compat.js";import{Card as X,Header as Q,InLineAlert as oe,InputPassword as R,Button as B}from"@dropins/tools/components.js";import{useState as m,useEffect as U,useCallback as C,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as Ee}from"../chunks/getStoreConfig.js";import{u as be,g as Ve,b as re,a as ye}from"../chunks/updateCustomer.js";import{useText as x}from"@dropins/tools/i18n.js";import{c as Ie}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const _e=e=>V.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ve=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Le=e=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Fe=e=>({firstName:e.firstName,lastName:e.lastName,emailAddress:(e==null?void 0:e.email)||"",accountId:(e==null?void 0:e.email)||""}),Ne=()=>{const[e,r]=m(null);return U(()=>{const n=sessionStorage.getItem("accountStoreConfig"),t=n?JSON.parse(n):null;if(t){const{minLength:o,requiredCharacterClasses:s}=t;r({minLength:o,requiredCharacterClasses:s})}else Ee().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:P}=o;sessionStorage.setItem("accountStoreConfig",JSON.stringify(o)),r({minLength:s,requiredCharacterClasses:P})}})},[]),{passwordConfigs:e}},Ae=({currentPassword:e,newPassword:r,confirmPassword:n,translations:t})=>{let o={...K};const s=!e.length&&!r.length&&!n.length,P=e.length&&r!==n;return s?(o={...o,currentPassword:t.requiredFieldError,newPassword:t.requiredFieldError,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):e.length?r.length?n.length?P?(o={...o,currentPassword:"",newPassword:"",confirmPassword:t.passwordMismatch},{isValid:!1,errors:o}):{isValid:!0,errors:o}:(o={...o,confirmPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,newPassword:t.requiredFieldError},{isValid:!1,errors:o}):(o={...o,currentPassword:t.requiredFieldError},{isValid:!1,errors:o})},ae=(e,r)=>{if(r<=1)return!0;const n=/[0-9]/.test(e)?1:0,t=/[a-z]/.test(e)?1:0,o=/[A-Z]/.test(e)?1:0,s=/[^a-zA-Z0-9\s]/.test(e)?1:0;return n+t+o+s>=r},K={currentPassword:"",newPassword:"",confirmPassword:""},Se=({passwordConfigs:e,handleSetInLineAlert:r,handleHideChangePassword:n})=>{const t=x({requiredFieldError:"Account.FormText.requiredFieldError",passwordMismatch:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordMismatch",incorrectCurrentPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.incorrectCurrentPassword",passwordUpdateMessage:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.passwordUpdateMessage"}),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(""),[h,l]=m(""),[F,y]=m(""),[I,E]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{n(()=>{r({}),E(K)})},[n,r]),A=C(f=>{p(f),E(b=>({...b,currentPassword:f?"":t.requiredFieldError}))},[t]),w=C(f=>{l(f),E(b=>({...b,newPassword:f?"":t.requiredFieldError}))},[t]),H=C(f=>{y(f),E(b=>({...b,confirmPassword:f?"":t.requiredFieldError}))},[t]),N=C(f=>{const{name:b,value:$}=f==null?void 0:f.target;E(_=>({..._,[b]:$?"":t.requiredFieldError}))},[t]),O=C(()=>{const{isValid:f,errors:b}=Ae({currentPassword:c,newPassword:h,confirmPassword:F,translations:t});return E(b),f},[c,h,F,t]),Z=C(f=>{f.preventDefault(),u(!0);const b=(e==null?void 0:e.requiredCharacterClasses)??0,$=(e==null?void 0:e.minLength)??1;if(!O()){s(!0),u(!1);return}if(!ae(h,b)||$>(h==null?void 0:h.length)){s(!0),u(!1);return}be({currentPassword:c,newPassword:h}).then(_=>{if(!(_!=null&&_.length)){u(!1);return}p(""),l(""),y(""),E(K),s(!1),r({type:"success",text:t.passwordUpdateMessage})}).catch(_=>{_.message==="Invalid login or password."&&r({type:"error",text:t.incorrectCurrentPassword}),_.message==="The account is locked."&&r({type:"error",text:_.message})}),u(!1)},[e,O,h,c,r,t]);return{hideChangePassword:i,handleOnBlurPassword:N,handleConfirmPasswordChange:H,handleNewPasswordChange:w,handleCurrentPasswordChange:A,mutationChangePassword:Z,currentPassword:c,newPassword:h,confirmPassword:F,passwordErrors:I,submitLoading:P,isClickSubmit:o}},Te=({passwordConfigs:e,isClickSubmit:r,password:n})=>{const t=x({messageLengthPassword:"Account.minifiedView.CustomerInformation.changePassword.passwordValidationMessage.messageLengthPassword"}),[o,s]=m("pending");U(()=>{if(!e)return;const u=ae(n,e.requiredCharacterClasses);r&&n.length>0?s(u?"success":"error"):r&&n.length===0?s("pending"):s(u?"success":"pending")},[r,e,n]);const P=G(()=>{var c;if(!e)return;const u={status:"pending",icon:"pending",message:(c=t.messageLengthPassword)==null?void 0:c.replace("{minLength}",`${e.minLength}`)};return n.length&&n.length>=e.minLength?{...u,icon:"success",status:"success"}:n.length&&n.length<e.minLength?r?{...u,icon:"error",status:"error"}:{...u,icon:"pending",status:"pending"}:u},[e,t.messageLengthPassword,n==null?void 0:n.length,r]);return{isValidUniqueSymbols:o,defaultLengthMessage:P}},Me=(e,r,n,t,o)=>e==="error"||(r==null?void 0:r.status)==="error"||n&&t.trim().length===0?o.newPassword:void 0,qe=({handleHideChangePassword:e,handleSetInLineAlert:r,inLineAlertProps:n})=>{const{passwordConfigs:t}=Ne(),{hideChangePassword:o,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:u,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:l,confirmPassword:F,passwordErrors:y,submitLoading:I,isClickSubmit:E}=Se({passwordConfigs:t,handleSetInLineAlert:r,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:A}=Te({password:l,isClickSubmit:E,passwordConfigs:t}),w=x({containerTitle:"Account.minifiedView.CustomerInformation.changePassword.containerTitle",currentPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.placeholder",currentPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.currentPassword.floatingLabel",newPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.newPassword.placeholder",newPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.newPassword.floatingLabel",confirmPasswordPlaceholder:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Account.minifiedView.CustomerInformation.changePassword.confirmPassword.floatingLabel",buttonSecondary:"Account.minifiedView.CustomerInformation.changePassword.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.changePassword.buttonPrimary"});return L(X,{className:"account-change-password",variant:"secondary",children:[d(Q,{title:w.containerTitle,divider:!1,className:"account-change-password__title"}),n.text?d(oe,{className:"account-change-password__notification",type:n.type,variant:"secondary",heading:n.text,icon:n.icon,"data-testid":"changePasswordInLineAlert"}):null,L("div",{className:"account-change-password__fields",children:[d(R,{className:"account-change-password__fields-item",autoComplete:"currentPassword",name:"currentPassword",placeholder:w.currentPasswordPlaceholder,floatingLabel:w.currentPasswordFloatingLabel,errorMessage:y.currentPassword,defaultValue:h,onValue:c,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"newPassword",name:"newPassword",placeholder:w.newPasswordPlaceholder,floatingLabel:w.newPasswordFloatingLabel,minLength:t==null?void 0:t.minLength,validateLengthConfig:A,uniqueSymbolsStatus:i,requiredCharacterClasses:t==null?void 0:t.requiredCharacterClasses,errorMessage:Me(i,A,E,l,y),defaultValue:l,onValue:u,onBlur:s}),d(R,{className:"account-change-password__fields-item",autoComplete:"confirmPassword",name:"confirmPassword",placeholder:w.confirmPasswordPlaceholder,floatingLabel:w.confirmPasswordFloatingLabel,errorMessage:y.confirmPassword,defaultValue:F,onValue:P,onBlur:s})]}),L("div",{className:"account-change-password__actions",children:[d(B,{type:"button",disabled:I,onClick:o,variant:"secondary",children:w.buttonSecondary}),d(B,{variant:"primary",type:"button",disabled:I,onClick:p,children:w.buttonPrimary})]})]})},ke=({inLineAlertProps:e,errorPasswordEmpty:r,passwordValue:n,showPasswordOnEmailChange:t,submitLoading:o,formFieldsList:s,handleHideEditForm:P,handleUpdateCustomerInformation:u,handleInputChange:c,handleSetPassword:p,handleOnBlurPassword:h})=>{const l=x({buttonSecondary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.editCustomerInformation.buttonPrimary",placeholder:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.placeholder",floatingLabel:"Account.minifiedView.CustomerInformation.editCustomerInformation.passwordField.floatingLabel",containerTitle:"Account.minifiedView.CustomerInformation.editCustomerInformation.containerTitle",requiredFieldError:"Account.FormText.requiredFieldError"});return L(X,{variant:"secondary",className:"account-edit-customer-information",children:[d(Q,{title:l.containerTitle,divider:!1,className:"account-edit-customer-information__title"}),e.text?d(oe,{className:"account-edit-customer-information__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon,"data-testid":"editCustomerInLineAlert"}):null,L(we,{loading:o,fieldsConfig:s||[],name:"editCustomerInformation",className:"account-edit-customer-information-form",onSubmit:u,setInputChange:c,children:[t?d("div",{className:"account-edit-customer-information__password",children:d(R,{autoComplete:"password",name:"password",placeholder:l.placeholder,floatingLabel:l.floatingLabel,errorMessage:r?l.requiredFieldError:void 0,defaultValue:n,onValue:p,onBlur:h})}):null,L("div",{className:"account-edit-customer-information__actions",children:[d(B,{disabled:o,type:"button",variant:"secondary",onClick:()=>P(),children:l.buttonSecondary}),d(B,{disabled:o,type:"submit",variant:"primary",children:l.buttonPrimary})]})]})]})},xe=({createdAt:e,slots:r,orderedCustomerData:n,showEditForm:t,showChangePassword:o,handleShowChangePassword:s,handleShowEditForm:P})=>{const u=x({buttonSecondary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonSecondary",buttonPrimary:"Account.minifiedView.CustomerInformation.customerInformationCard.buttonPrimary",accountCreation:"Account.minifiedView.CustomerInformation.customerInformationCard.accountCreation"});return d(X,{variant:"secondary",className:ne(["account-customer-information-card",["account-customer-information-card-short",o||t]]),children:L("div",{className:"account-customer-information-card__wrapper",children:[L("div",{className:"account-customer-information-card__actions",children:[d(B,{type:"button",variant:"tertiary",onClick:s,children:u.buttonSecondary}),d(B,{type:"button",variant:"tertiary",onClick:P,children:u.buttonPrimary})]}),d("div",{className:"account-customer-information-card__content",children:r!=null&&r.CustomerData?d(ge,{name:"CustomerData",slot:r==null?void 0:r.CustomerData,context:{customerData:n}}):L(he,{children:[n==null?void 0:n.map((c,p)=>{const h=c!=null&&c.label?`${c.label}: ${c==null?void 0:c.value}`:c==null?void 0:c.value;return d("p",{"data-testid":`${c.name}_${p}`,children:h},`${c.name}_${p}`)}),L("p",{children:[u.accountCreation,": ",e]})]})})]})})},Oe=e=>{if(!(e!=null&&e.dateOfBirth))return e;const{dateOfBirth:r,...n}=e;return{...n,dob:r}},Ue="accountContext";var k=(e=>(e.EDIT_ACCOUNT_EVENT="edit-account",e))(k||{});const Be={EDIT_ACCOUNT_EVENT:"edit-account"};function se(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function He(e,r){const n=se();n.push({[e]:null}),n.push({[e]:r})}function Ze(e,r){se().push(t=>{const o=t.getState?t.getState():{};t.push({event:e,eventInfo:{...o,...r}})})}function $e(e){const r=Fe(e);He(Ue,r),Ze(Be.EDIT_ACCOUNT_EVENT)}const te=(e,r)=>{const n=sessionStorage.getItem("accountStoreConfig"),o={...n?JSON.parse(n):{},...r};switch(e){case"edit-account":$e(o);break;default:return null}},ze=({handleSetInLineAlert:e})=>{const r=x({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[n,t]=m(!0),[o,s]=m(!1),[P,u]=m(!1),[c,p]=m(!1),[h,l]=m(!1),[F,y]=m(!1),[I,E]=m([]),[i,A]=m(null),[w,H]=m([]),[N,O]=m({}),[Z,f]=m(""),[b,$]=m(""),_=C(a=>{const{value:g}=a==null?void 0:a.target;g.length&&l(!1),g.length||l(!0)},[]),S=C(a=>{f(a)},[]),ie=C(a=>{O(a)},[]),ce=C(()=>{u(!0),p(!1),e(),S("")},[e,S]),de=C(a=>{a==null||a(),u(!1)},[]),ue=C(()=>{p(!0),u(!1),e(),S("")},[e,S]),le=C(a=>{a==null||a(),p(!1)},[]),T=C((a,g)=>{a==="success"?e({type:"success",text:g??r.accountSuccess}):a==="error"?e({type:"error",text:g??r.accountError}):e(),s(!1)},[e,r]),j=C(()=>{Ve().then(a=>{var v;const g=(v=a==null?void 0:a.createdAt)==null?void 0:v.split(" ")[0],W=Oe({...a,gender:a.gender===1?r.genderMale:r.genderFemale});A(W),$(g)})},[r.genderFemale,r.genderMale]);U(()=>{j()},[]),U(()=>{Ie("customer_account_edit").then(a=>{H(a);const g=a.map(({name:W,customUpperCode:v,orderNumber:M,label:D})=>({name:v,orderNumber:M,label:Ce.includes(W)?null:D}));E(g)})},[]),U(()=>{N.email&&N.email!==(i==null?void 0:i.email)?y(!0):N.email&&N.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,N]);const z=G(()=>!I||!i?[]:I.filter(({name:g})=>g!==void 0&&i[g]).map(g=>({name:g.name,orderNumber:g.orderNumber,value:i[g.name],label:g.label})),[i,I]);U(()=>{z!=null&&z.length&&t(!1)},[z]);const me=G(()=>w==null?void 0:w.map(a=>({...a,defaultValue:a!=null&&a.customUpperCode&&i?i[a.customUpperCode]??"":""})).map(a=>a.customUpperCode==="gender"?{...a,defaultValue:a.defaultValue==="Male"?1:2}:a),[w,i]),fe=C(async(a,g)=>{const W=Pe(a.target),{email:v,password:M,...D}=W,Y=v!==(i==null?void 0:i.email)&&M.length===0;if(!g){Y&&l(!0);return}if(l(!1),s(!0),v===(i==null?void 0:i.email)){S(""),re(ee(D,"account")).then(q=>{q&&(j(),T("success"),te(k==null?void 0:k.EDIT_ACCOUNT_EVENT,{...i}))}).catch(q=>{T("error",q.message)});return}if(Y){l(!0),s(!1);return}v!=null&&v.length&&(M!=null&&M.length)&&ye({email:v,password:M}).then(q=>{q&&re(ee(D,"account")).then(J=>{J&&(j(),T("success"),te(k==null?void 0:k.EDIT_ACCOUNT_EVENT,{...i}))}).catch(J=>{T("error",J.message)})}).catch(q=>{T("error",q.message)})},[i,S,j,T]);return{createdAt:b,errorPasswordEmpty:h,passwordValue:Z,showPasswordOnEmailChange:F,orderedCustomerData:z,loading:n,normalizeFieldsConfig:me,submitLoading:o,showEditForm:c,showChangePassword:P,handleShowChangePassword:ce,handleHideChangePassword:de,handleShowEditForm:ue,handleHideEditForm:le,handleUpdateCustomerInformation:fe,handleInputChange:ie,handleSetPassword:S,handleOnBlurPassword:_,renderAlertMessage:T}},We={success:d(ve,{}),warning:d(_e,{}),error:d(Le,{})},je=()=>{const[e,r]=m({}),n=C(t=>{if(!(t!=null&&t.type)){r({});return}const o=We[t.type];r({...t,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlert:n}},ar=({className:e,withHeader:r=!0,slots:n})=>{const t=x({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:s}=je(),{createdAt:P,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:l,normalizeFieldsConfig:F,submitLoading:y,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleHideChangePassword:A,handleShowEditForm:w,handleHideEditForm:H,handleUpdateCustomerInformation:N,handleInputChange:O,handleSetPassword:Z,handleOnBlurPassword:f}=ze({handleSetInLineAlert:s});return l?d("div",{"data-testid":"customerInformationLoader",children:d(pe,{withCard:!0})}):L("div",{className:ne(["account-customer-information",e]),children:[r?d(Q,{title:t.containerTitle,divider:!1,className:"customer-information__title"}):null,d(xe,{createdAt:P,slots:n,orderedCustomerData:h,showEditForm:I,showChangePassword:E,handleShowChangePassword:i,handleShowEditForm:w}),E?d(qe,{inLineAlertProps:o,handleSetInLineAlert:s,handleHideChangePassword:A}):null,I?d(ke,{inLineAlertProps:o,submitLoading:y,formFieldsList:F,errorPasswordEmpty:u,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:Z,handleOnBlurPassword:f,handleUpdateCustomerInformation:N,handleHideEditForm:H,handleInputChange:O}):null]})};export{ar as CustomerInformation,ar as default}; |
@@ -29,2 +29,13 @@ /******************************************************************** | ||
} | ||
export interface AccountModel { | ||
firstName?: string; | ||
lastName?: string; | ||
emailAddress?: string; | ||
phoneNumber?: string; | ||
countryCode?: string; | ||
accountId?: string; | ||
accountType?: string; | ||
company?: string; | ||
customerGroup?: string; | ||
} | ||
//# sourceMappingURL=customer.d.ts.map |
@@ -21,3 +21,4 @@ /******************************************************************** | ||
requiredCharacterClasses: number; | ||
storeCode: string; | ||
} | ||
//# sourceMappingURL=store-config.d.ts.map |
@@ -24,2 +24,3 @@ /******************************************************************** | ||
export * from './transform-store-config'; | ||
export * from './transform-account'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
{"name": "@dropins/storefront-account", "version": "1.0.1", "@dropins/elsie": "~0.38.0", "license": "SEE LICENSE IN LICENSE.md"} | ||
{"name": "@dropins/storefront-account", "version": "1.0.2-beta1", "@dropins/elsie": "~0.39.0", "license": "SEE LICENSE IN LICENSE.md"} |
/*! Copyright 2025 Adobe | ||
All Rights Reserved. */ | ||
(function(e,r){try{if(typeof document<"u"){const a=document.createElement("style"),o=r.styleId;for(const t in r.attributes)a.setAttribute(t,r.attributes[t]);a.setAttribute("data-dropin",o),a.appendChild(document.createTextNode(e));const c=document.querySelector('style[data-dropin="sdk"]');if(c)c.after(a);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})(`.account-orders-list-header{margin-bottom:var(--spacing-medium)}.account-orders-list ul{list-style:none;margin:0;padding:0}.account-orders-list__date-select{margin-bottom:var(--spacing-xbig)}.account-orders-list__date-select span{display:inline-block;font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);margin-bottom:var(--spacing-xsmall)}.account-orders-list__date-select .dropin-picker{max-width:224px} | ||
.account-form{display:grid;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.account-form{display:grid;grid-template-columns:repeat(2,1fr)}.account-form>.dropin-field:nth-child(1),.account-form>.dropin-field:nth-child(2){grid-column:span 1}.account-form>.dropin-field:nth-child(3),.account-form>.dropin-field:nth-child(4),.account-form>.dropin-field:nth-child(5){grid-column:span 2}.account-form>.dropin-field:nth-child(6),.account-form>.dropin-field:nth-child(7){grid-column:span 1}.account-form>.dropin-field:nth-child(8),.account-form>.dropin-field:nth-child(9){grid-column:span 1}.account-form>.dropin-field:nth-child(n+10){grid-column:span 2}}.account-form [class$=-hidden]{position:absolute;opacity:0;height:0;width:0;overflow:hidden;clip:rect(0,0,0,0)}.account-account-loaders--card-loader{margin-bottom:var(--spacing-small)}.account-account-loaders--picker-loader div:first-child{max-width:200px}.account-account-loaders--picker-loader div:nth-child(3){max-width:400px}.account-address-card{margin-bottom:var(--spacing-small)}.account-address-card .dropin-card__content{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-small) 0px;grid-template-areas:"description action" "labels action"}.account-address-card .account-address-card__action{display:flex;justify-content:flex-end;align-items:baseline;cursor:pointer;grid-area:action}.account-address-card .account-address-card__action--editbutton{margin-left:var(--spacing-small)}.account-address-card .account-address-card__action button{padding:0}.account-address-card .account-address-card__action button:hover{text-decoration:underline}.account-address-card .account-address-card__description{grid-area:description;margin:0;padding:0}.account-address-card .account-address-card__labels{display:flex;gap:0 var(--spacing-xsmall);grid-area:labels}.account-address-card .account-address-card__description p{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);line-height:var(--spacing-xbig);color:var(--color-neutral-800);padding:0;margin:0 var(--spacing-xsmall) 0 0}.account-address-card .account-address-card__description p:nth-child(1),.account-address-card .account-address-card__description p:nth-child(2){margin:0 var(--spacing-xsmall) var(--spacing-xsmall) 0;color:var(--color-neutral-800);font:var(--type-button-2-font);font-weight:500;cursor:default}.account-address-card .account-address-card__description p:nth-child(1),.account-address-card .account-address-card__description p:nth-child(3),.account-address-card .account-address-card__description p:nth-child(4),.account-address-card .account-address-card__description p:nth-child(6){float:left}.account-actions-address{cursor:pointer;padding:var(--spacing-xsmall) var(--spacing-medium);border-radius:var(--shape-border-radius-2);border:var(--shape-border-width-2) solid var(--color-neutral-400);background-color:var(--color-neutral-50);width:100%;height:88px;display:flex;align-items:center;justify-content:space-between}.account-actions-address--selectable{max-width:100%;width:auto}.account-actions-address__title{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);-moz-appearance:none;appearance:none;-webkit-appearance:none;color:var(--color-neutral-800)}.account-actions-address svg{stroke:var(--shape-icon-stroke-4);color:var(--color-neutral-800)}@supports (height: 100dvh){.account-address-modal .dropin-modal{height:100dvh}}.account-address-modal--overlay{position:relative;padding:var(--spacing-small) var(--spacing-small) var(--spacing-small) var(--spacing-small);width:100%;margin:auto;max-width:340px}@media (min-width: 768px){.account-address-modal--overlay{position:relative;padding:var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig);width:100%;margin:auto;max-width:721px}.account-address-card .dropin-card__content{padding:var(--spacing-small)}}.dropin-modal__body--medium>.dropin-modal__header-title,.dropin-modal__body--full>.dropin-modal__header-title,.account-address-modal .dropin-modal__content{margin:0;align-items:center}.account-address-modal .dropin-modal__header-title-content h3{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0;padding:0}.account-address-modal .account-address-modal__spinner{position:absolute;top:0;left:0;background-color:var(--color-neutral-200);opacity:.8;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1}.account-address-modal p{margin:var(--spacing-small) 0}@media (min-width: 768px){.account-address-modal p{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}}.account-address-modal .account-address-modal__buttons{display:flex;align-items:center;justify-content:right;gap:0 var(--spacing-small)}.account-empty-list{margin-bottom:var(--spacing-small)}.account-empty-list.account-empty-list--minified,.account-empty-list .dropin-card{border:none}.account-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.account-empty-list.account-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.account-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.account-empty-list.account-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.account-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.account-empty-list.account-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.account-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.account-empty-list.account-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.account-orders-list-action{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}a.account-orders-list-action:focus-visible{display:inline-block}.account-orders-list-action--minifiedView{width:100%;text-align:left;font:var(--type-body-1-default-font)}.account-orders-list-action.account-orders-list-action--minifiedView:hover{text-decoration:none}.account-orders-list-action--minifiedView .account-orders-list-action__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.account-orders-list-action__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.account-orders-list-action__card-wrapper svg,.account-orders-list-action svg{color:var(--color-neutral-800)}.account-orders-list-action--minifiedView .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.account-orders-list-action--minifiedView p{font:var(--type-body-1-strong-font)}.account-orders-list-card{height:100%;margin-bottom:var(--spacing-small)}.account-orders-list-card .dropin-card__content{padding:var(--spacing-medium);display:grid;grid-template-areas:"content actions" "imageList actions";gap:0;max-height:100%}.account-orders-list-card .account-orders-list-card__content{grid-area:content;margin-bottom:var(--spacing-small)}.account-orders-list-card__content--quantity{font-weight:500;color:var(--color-neutral-800)}.account-orders-list-card__content--track_number,.account-orders-list-card__content--return_number{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing)}.account-orders-list-card .account-orders-list-card__content>div:first-child{font-weight:500}.account-orders-list-card .account-orders-list-card__content p,.account-orders-list-card .account-orders-list-card__content div{padding:0;text-align:left;font:var(--type-body-1-default-font);margin:0 0 var(--spacing-small) 0;color:var(--color-neutral-800)}.account-orders-list-card p.account-orders-list-card__content--product-name{margin:0}.account-orders-list-card .account-orders-list-card__content p:last-child{margin:0}.account-orders-list-card .account-orders-list-card__content div{font:var(--type-button-2-font);margin-bottom:var(--spacing-small)}.account-orders-list-card .account-orders-list-card__actions{grid-area:actions}.account-orders-list-card .account-orders-list-card__images{overflow:auto}.account-orders-list-card .account-orders-list-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.account-orders-list-card .account-orders-list-card__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.account-orders-list-card .account-orders-list-card__images img{object-fit:contain;width:65px;height:65px}.account-orders-list-card .account-orders-list-card__actions{position:relative;align-self:center;margin-left:auto}@media (min-width: 768px){.account-orders-list-card.account-orders-list-card--full .dropin-card__content{max-height:100%}}.account-addresses-header{margin-bottom:var(--spacing-medium)}.account-addresses-wrapper{box-sizing:border-box;position:relative}.account-addresses-wrapper--select-view{position:relative;margin:0;padding:0;border:none}.account-addresses-wrapper--select-view input[type=radio]{position:absolute;clip:rect(0,0,0,0);width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden}.account-addresses-wrapper--select-view .account-addresses-wrapper__label{cursor:pointer;display:block;border-radius:0}.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-address-card{border-radius:0}.account-addresses-wrapper--select-view .account-addresses-wrapper__label:nth-child(2){border-radius:var(--shape-border-radius-1) var(--shape-border-radius-1) 0 0}.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:nth-child(2)>.account-address-card{border-radius:var(--shape-border-radius-1) var(--shape-border-radius-1) 0 0}.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:last-child,.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:last-child>.account-actions-address.account-actions-address--address{border-radius:0 0 var(--shape-border-radius-1) var(--shape-border-radius-1)}.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-address-card,.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-actions-address.account-actions-address--address{background-color:var(--color-neutral-200)}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label>.account-address-card{border:var(--shape-border-width-1) solid var(--color-neutral-900);position:relative}.account-addresses-wrapper--select-view input[type=radio]:focus+.account-addresses-wrapper__label>.account-address-card{border:var(--shape-border-width-1) solid var(--color-neutral-900);outline:var(--spacing-xxsmall) solid var(--color-button-focus);position:relative}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label>.account-addresses-form__footer__wrapper{border:var(--shape-border-width-1) solid var(--color-neutral-900);position:relative}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label .account-address-card,.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label .account-actions-address.account-actions-address--address{background-color:var(--color-neutral-50)}.account-addresses-wrapper--select-view .account-address-card{margin:0}.account-addresses-wrapper--select-view .account-addresses-form__footer__wrapper{padding:var(--spacing-medium)}.account-address-form-wrapper{box-sizing:border-box;background-color:var(--color-neutral-50)}.account-address-form-wrapper__notification{margin-bottom:var(--spacing-medium)}.account-address-form-wrapper__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.account-address-form-wrapper__buttons{display:flex;align-items:center;justify-content:end;gap:0 var(--spacing-medium);margin-top:var(--spacing-medium)}.account-address-form-wrapper__buttons--empty{gap:0;margin:0;padding:0;display:inline-block}.account-address-form-wrapper__buttons button{min-width:142px}.account-change-password .dropin-card__content{gap:0}.account-change-password__title,.account-change-password .account-change-password__notification,.account-change-password .account-change-password__fields .account-change-password__fields-item{margin-bottom:var(--spacing-medium)}.account-change-password .account-change-password__fields .account-change-password__fields-item:last-child{margin-bottom:0}.account-change-password .account-change-password__actions{display:flex;justify-content:right;align-items:center;gap:0 var(--grid-3-gutters);margin-top:var(--spacing-xlarge)}.account-change-password .account-change-password__actions button{min-width:144px}.account-edit-customer-information__title{margin-bottom:var(--spacing-medium)}.account-edit-customer-information .dropin-card__content{gap:0}.account-edit-customer-information .account-edit-customer-information__notification{margin-bottom:var(--spacing-medium)}.account-edit-customer-information .account-edit-customer-information-form__field:nth-child(n+3),.account-edit-customer-information .account-edit-customer-information__password{grid-column:span 2}.account-edit-customer-information .account-edit-customer-information__actions{display:flex;justify-content:end;align-items:center;gap:0 var(--grid-2-gutters);grid-column:span 2}.account-edit-customer-information .account-edit-customer-information__actions button{min-width:144px}.customer-information__title{margin-bottom:var(--spacing-medium)}.account-customer-information-card-short{margin-bottom:var(--spacing-small)}.account-customer-information-card .dropin-card__content{gap:0}.account-customer-information-card__wrapper{display:grid;grid-template-columns:1fr auto;align-items:start}.account-customer-information-card .account-customer-information-card__actions{display:flex;justify-content:space-between;align-items:center;gap:0 var(--grid-2-gutters)}.account-customer-information-card .account-customer-information-card__actions button{cursor:pointer;margin:0;padding:0}.account-customer-information-card__content p{font:var(--type-body-1-default-font);margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-xbig);padding:0}.account-customer-information-card__content p:nth-child(1),.account-customer-information-card__content p:nth-child(2){font:var(--type-body-1-strong-font);font-weight:500;margin:0 var(--spacing-xsmall) var(--spacing-xsmall) 0}.account-customer-information-card__content p:nth-child(1){float:left}`,{styleId:"account"}); | ||
.account-form{display:grid;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.account-form{display:grid;grid-template-columns:repeat(2,1fr)}.account-form>.dropin-field:nth-child(1),.account-form>.dropin-field:nth-child(2){grid-column:span 1}.account-form>.dropin-field:nth-child(3),.account-form>.dropin-field:nth-child(4),.account-form>.dropin-field:nth-child(5){grid-column:span 2}.account-form>.dropin-field:nth-child(6),.account-form>.dropin-field:nth-child(7){grid-column:span 1}.account-form>.dropin-field:nth-child(8),.account-form>.dropin-field:nth-child(9){grid-column:span 1}.account-form>.dropin-field:nth-child(n+10){grid-column:span 2}}.account-form [class$=-hidden]{position:absolute;opacity:0;height:0;width:0;overflow:hidden;clip:rect(0,0,0,0)}.account-account-loaders--card-loader{margin-bottom:var(--spacing-small)}.account-account-loaders--picker-loader div:first-child{max-width:200px}.account-account-loaders--picker-loader div:nth-child(3){max-width:400px}.account-address-card{margin-bottom:var(--spacing-small)}.account-address-card .dropin-card__content{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-small) 0px;grid-template-areas:"description action" "labels action"}.account-address-card .account-address-card__action{display:flex;justify-content:flex-end;align-items:baseline;cursor:pointer;grid-area:action}.account-address-card .account-address-card__action--editbutton{margin-left:var(--spacing-small)}.account-address-card .account-address-card__action button{padding:0}.account-address-card .account-address-card__action button:hover{text-decoration:underline}.account-address-card .account-address-card__description{grid-area:description;margin:0;padding:0}.account-address-card .account-address-card__labels{display:flex;gap:0 var(--spacing-xsmall);grid-area:labels}.account-address-card .account-address-card__description p{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);line-height:var(--spacing-xbig);color:var(--color-neutral-800);padding:0;margin:0 var(--spacing-xsmall) 0 0}.account-address-card .account-address-card__description p:nth-child(1),.account-address-card .account-address-card__description p:nth-child(2){margin:0 var(--spacing-xsmall) var(--spacing-xsmall) 0;color:var(--color-neutral-800);font:var(--type-button-2-font);font-weight:500;cursor:default}.account-address-card .account-address-card__description p:nth-child(1),.account-address-card .account-address-card__description p:nth-child(3),.account-address-card .account-address-card__description p:nth-child(4),.account-address-card .account-address-card__description p:nth-child(6){float:left}.account-actions-address{cursor:pointer;padding:var(--spacing-xsmall) var(--spacing-medium);border-radius:var(--shape-border-radius-2);border:var(--shape-border-width-2) solid var(--color-neutral-400);background-color:var(--color-neutral-50);width:100%;height:88px;display:flex;align-items:center;justify-content:space-between}.account-actions-address--selectable{max-width:100%;width:auto}.account-actions-address__title{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);-moz-appearance:none;appearance:none;-webkit-appearance:none;color:var(--color-neutral-800)}.account-actions-address svg{stroke:var(--shape-icon-stroke-4);color:var(--color-neutral-800)}@supports (height: 100dvh){.account-address-modal .dropin-modal{height:100dvh}}.account-address-modal--overlay{position:relative;padding:var(--spacing-small) var(--spacing-small) var(--spacing-small) var(--spacing-small);width:100%;margin:auto;max-width:340px}@media (min-width: 768px){.account-address-modal--overlay{position:relative;padding:var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig);width:100%;margin:auto;max-width:721px}.account-address-card .dropin-card__content{padding:var(--spacing-small)}}.dropin-modal__body--medium>.dropin-modal__header-title,.dropin-modal__body--full>.dropin-modal__header-title,.account-address-modal .dropin-modal__content{margin:0;align-items:center}.account-address-modal .dropin-modal__header-title-content h3{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0;padding:0}.account-address-modal .account-address-modal__spinner{position:absolute;top:0;left:0;background-color:var(--color-neutral-200);opacity:.8;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1}.account-address-modal p{margin:var(--spacing-small) 0}@media (min-width: 768px){.account-address-modal p{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}}.account-address-modal .account-address-modal__buttons{display:flex;align-items:center;justify-content:right;gap:0 var(--spacing-small)}.account-empty-list{margin-bottom:var(--spacing-small)}.account-empty-list.account-empty-list--minified,.account-empty-list .dropin-card{border:none}.account-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.account-empty-list.account-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.account-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.account-empty-list.account-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.account-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.account-empty-list.account-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.account-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.account-empty-list.account-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.account-orders-list-action{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}a.account-orders-list-action:focus-visible{display:inline-block}.account-orders-list-action--minifiedView{width:100%;text-align:left;font:var(--type-body-1-default-font)}.account-orders-list-action.account-orders-list-action--minifiedView:hover{text-decoration:none}.account-orders-list-action--minifiedView .account-orders-list-action__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.account-orders-list-action__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.account-orders-list-action__card-wrapper svg,.account-orders-list-action svg{color:var(--color-neutral-800)}.account-orders-list-action--minifiedView .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.account-orders-list-action--minifiedView p{font:var(--type-body-1-strong-font)}.account-orders-list-card{height:100%;margin-bottom:var(--spacing-small)}.account-orders-list-card .dropin-card__content{padding:var(--spacing-medium);display:grid;grid-template-areas:"content actions" "imageList actions";gap:0;max-height:100%}.account-orders-list-card .account-orders-list-card__content{grid-area:content;margin-bottom:var(--spacing-small)}.account-orders-list-card__content--quantity{font-weight:500;color:var(--color-neutral-800)}.account-orders-list-card__content--track_number,.account-orders-list-card__content--return_number{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing)}.account-orders-list-card .account-orders-list-card__content>div:first-child{font-weight:500}.account-orders-list-card .account-orders-list-card__content p,.account-orders-list-card .account-orders-list-card__content div{padding:0;text-align:left;font:var(--type-body-1-default-font);margin:0 0 var(--spacing-small) 0;color:var(--color-neutral-800)}.account-orders-list-card p.account-orders-list-card__content--product-name{margin:0}.account-orders-list-card .account-orders-list-card__content p:last-child{margin:0}.account-orders-list-card .account-orders-list-card__content div{font:var(--type-button-2-font);margin-bottom:var(--spacing-small)}.account-orders-list-card .account-orders-list-card__actions{grid-area:actions}.account-orders-list-card .account-orders-list-card__images{overflow:auto}.account-orders-list-card .account-orders-list-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.account-orders-list-card .account-orders-list-card__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.account-orders-list-card .account-orders-list-card__images img{object-fit:contain;width:65px;height:65px}.account-orders-list-card .account-orders-list-card__actions{position:relative;align-self:center;margin-left:auto}@media (min-width: 768px){.account-orders-list-card.account-orders-list-card--full .dropin-card__content{max-height:100%}}.account-addresses-header{margin-bottom:var(--spacing-medium)}.account-addresses-wrapper{box-sizing:border-box;position:relative}.account-addresses-wrapper--select-view{position:relative;margin:0;padding:0;border:none}.account-addresses-wrapper--select-view input[type=radio]{position:absolute;clip:rect(0,0,0,0);width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden}.account-addresses-wrapper--select-view .account-addresses-wrapper__label{cursor:pointer;display:block;border-radius:0}.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-address-card{border-radius:0}.account-addresses-wrapper--select-view .account-addresses-wrapper__label:nth-child(2){border-radius:var(--shape-border-radius-1) var(--shape-border-radius-1) 0 0}.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:nth-child(2)>.account-address-card{border-radius:var(--shape-border-radius-1) var(--shape-border-radius-1) 0 0}.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:last-child,.account-addresses-wrapper--select-view>.account-addresses-wrapper__label:last-child>.account-actions-address.account-actions-address--address{border-radius:0 0 var(--shape-border-radius-1) var(--shape-border-radius-1)}.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-address-card,.account-addresses-wrapper--select-view .account-addresses-wrapper__label .account-actions-address.account-actions-address--address{background-color:var(--color-neutral-200)}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label>.account-address-card{border:var(--shape-border-width-1) solid var(--color-neutral-900);position:relative}.account-addresses-wrapper--select-view input[type=radio]:focus+.account-addresses-wrapper__label>.account-address-card{border:var(--shape-border-width-1) solid var(--color-neutral-900);outline:var(--spacing-xxsmall) solid var(--color-button-focus);position:relative}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label>.account-addresses-form__footer__wrapper{border:var(--shape-border-width-1) solid var(--color-neutral-900);position:relative}.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label .account-address-card,.account-addresses-wrapper--select-view input[type=radio]:checked+.account-addresses-wrapper__label .account-actions-address.account-actions-address--address{background-color:var(--color-neutral-50)}.account-addresses-wrapper--select-view .account-address-card{margin:0}.account-addresses-wrapper--select-view .account-addresses-form__footer__wrapper{padding:var(--spacing-medium)}.account-address-form-wrapper{box-sizing:border-box;background-color:var(--color-neutral-50)}.account-address-form-wrapper__notification{margin-bottom:var(--spacing-medium)}.account-address-form-wrapper__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.account-address-form-wrapper__buttons{display:flex;align-items:center;justify-content:end;gap:0 var(--spacing-medium);margin-top:var(--spacing-medium)}.account-address-form-wrapper__buttons--empty{gap:0;margin:0;padding:0;display:inline-block}.account-address-form-wrapper__buttons button{min-width:142px}.account-change-password .dropin-card__content{gap:0}.account-change-password__title,.account-change-password .account-change-password__notification,.account-change-password .account-change-password__fields .account-change-password__fields-item{margin-bottom:var(--spacing-medium)}.account-change-password .account-change-password__fields .account-change-password__fields-item:last-child{margin-bottom:0}.account-change-password .account-change-password__actions{display:flex;justify-content:right;align-items:center;gap:0 var(--grid-3-gutters)}.account-change-password .account-change-password__actions button{min-width:144px}.account-edit-customer-information__title{margin-bottom:var(--spacing-medium)}.account-edit-customer-information .dropin-card__content{gap:0}.account-edit-customer-information .account-edit-customer-information__notification{margin-bottom:var(--spacing-medium)}.account-edit-customer-information .account-edit-customer-information-form__field:nth-child(n+3),.account-edit-customer-information .account-edit-customer-information__password{grid-column:span 2}.account-edit-customer-information .account-edit-customer-information__actions{display:flex;justify-content:end;align-items:center;gap:0 var(--grid-2-gutters);grid-column:span 2}.account-edit-customer-information .account-edit-customer-information__actions button{min-width:144px}.customer-information__title{margin-bottom:var(--spacing-medium)}.account-customer-information-card-short{margin-bottom:var(--spacing-small)}.account-customer-information-card .dropin-card__content{gap:0}.account-customer-information-card__wrapper{display:grid;grid-template-columns:1fr;align-items:start;gap:var(--grid-1-gutters) 0}.account-customer-information-card .account-customer-information-card__actions{margin-left:auto;display:flex;justify-content:space-between;align-items:center;gap:0 var(--grid-2-gutters)}@media (max-width: 300px){.account-customer-information-card .account-customer-information-card__actions{align-items:self-end;flex-direction:column-reverse}}.account-customer-information-card .account-customer-information-card__actions button{cursor:pointer;margin:0;padding:0}.account-customer-information-card__content p{font:var(--type-body-1-default-font);margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-xbig);padding:0}.account-customer-information-card__content p:nth-child(1),.account-customer-information-card__content p:nth-child(2){font:var(--type-body-1-strong-font);font-weight:500;margin:0 var(--spacing-xsmall) var(--spacing-xsmall) 0}.account-customer-information-card__content p:nth-child(1){float:left}`,{styleId:"account"}); | ||
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as o}from"@dropins/tools/lib.js";import{useState as n,useEffect as i}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const m={minifiedView:{CustomerInformation:{containerTitle:"Account settings",genderMale:"Male",genderFemale:"Female",changePassword:{passwordValidationMessage:{chartTwoSymbols:"Use characters and numbers or symbols",chartThreeSymbols:"Use characters, numbers and symbols",chartFourSymbols:"Use uppercase characters, lowercase characters, numbers and symbols",messageLengthPassword:"At least {minLength} characters long",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical",incorrectCurrentPassword:"The current password you entered is incorrect. Please check and try again.",passwordUpdateMessage:"Your password has been updated"},containerTitle:"Change password",currentPassword:{placeholder:"Password",floatingLabel:"Password"},newPassword:{placeholder:"New Password",floatingLabel:"New Password"},confirmPassword:{placeholder:"Confirm new password",floatingLabel:"Confirm new password"},buttonSecondary:"Cancel",buttonPrimary:"Save"},customerInformationCard:{buttonSecondary:"Change password",buttonPrimary:"Edit",accountCreation:"Account creation date"},editCustomerInformation:{containerTitle:"Edit details",buttonSecondary:"Cancel",buttonPrimary:"Save",accountSuccess:"Your account information has been updated.",accountError:"Your account information has not been updated.",passwordField:{placeholder:"Password",floatingLabel:"Password"}}},Addresses:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",differentAddressFormTitle:"Deliver to new address",viewAllAddressesButton:"View address list",differentAddressButton:"Use a different address",ariaLabelAddressPicker:"form",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing",defaultLabelText:"DEFAULT"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}},OrdersList:{containerTitle:"Recent orders",viewAllOrdersButton:"View all orders",ariaLabelLink:"Redirect to full order information",dateOrderPlaced:"Date order placed",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items",carrier:"Carrier:",returns:"Return(s):",orderDate:"Placed on"},OrdersListSelectDate:{pastSixMonths:"Past 6 months",currentYear:"Current year",viewAll:"View all"}},EmptyList:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}}},fullSizeView:{Addresses:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",differentAddressFormTitle:"Deliver to new address",newAddressFormTitle:"Add address",addNewAddressButton:"Create new",differentAddressButton:"Use a different address",ariaLabelAddressPicker:"form",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing",defaultLabelText:"DEFAULT"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}},OrdersList:{containerTitle:"Your orders",ariaLabelLink:"Redirect to full order information",dateOrderPlaced:"Date order placed",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items",carrier:"Carrier:",returns:"Return(s):",orderDate:"Placed on"},OrdersListSelectDate:{pastSixMonths:"Past 6 months",currentYear:"Current year",viewAll:"View all"}},EmptyList:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}}},AddressForm:{formText:{secondaryButton:"Cancel",primaryButton:"Save",defaultShippingLabel:"Set as default shipping address",defaultBillingLabel:"Set as default billing address",saveAddressBook:"Save in address book"}},FormText:{requiredFieldError:"This is a required field.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",urlError:"Please enter a valid URL, e.g., http://www.adobe.com.",lengthTextError:"Text length must be between {min} and {max} characters."}},u={Account:m},w={default:u},p=({children:a})=>{const[s,t]=n("en_US");return i(()=>{const e=c.on("locale",d=>{t(d)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:s,langDefinitions:w,children:a})},L=new o(r(p,{}));export{L as render}; |
@@ -21,2 +21,3 @@ /******************************************************************** | ||
required_character_classes_number: string; | ||
store_code: string; | ||
} | ||
@@ -23,0 +24,0 @@ export interface GetStoreConfigResponse { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
297546
191
4499
2