diff --git a/package-lock.json b/package-lock.json index 5ab86fdb40..08b18ecaec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,11 +12,11 @@ "dependencies": { "@adobe/magento-storefront-event-collector": "^1.8.0", "@adobe/magento-storefront-events-sdk": "^1.8.0", - "@dropins/storefront-account": "~1.0.1-beta1", - "@dropins/storefront-auth": "~1.0.1-beta1", + "@dropins/storefront-account": "~1.0.1", + "@dropins/storefront-auth": "~1.0.1", "@dropins/storefront-cart": "~1.0.1", "@dropins/storefront-checkout": "~1.0.0", - "@dropins/storefront-order": "~1.0.1-beta1", + "@dropins/storefront-order": "~1.0.1", "@dropins/storefront-pdp": "~1.0.0", "@dropins/tools": "^0.38.0" }, @@ -1797,14 +1797,14 @@ } }, "node_modules/@dropins/storefront-account": { - "version": "1.0.1-beta1", - "resolved": "https://registry.npmjs.org/@dropins/storefront-account/-/storefront-account-1.0.1-beta1.tgz", - "integrity": "sha512-NCG5gpvBeIpyVDNfMZ0V5WFrokP7VpO9oQNN9B4PL7Hab/w7DaiEr+gvOxscd5BdQblomvumAPTcO0xegBajIg==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@dropins/storefront-account/-/storefront-account-1.0.1.tgz", + "integrity": "sha512-4c6Xog9zq4f6a+Q+hm3XjK9FhdaT8sUgB34CRKuY7EAQWBEarVP/OVhNom8c6+jh8jFtZqcUzO9h5iY7ip1wag==" }, "node_modules/@dropins/storefront-auth": { - "version": "1.0.1-beta1", - "resolved": "https://registry.npmjs.org/@dropins/storefront-auth/-/storefront-auth-1.0.1-beta1.tgz", - "integrity": "sha512-gzXxdXayg3pq6SiwlRyRlZyYB0Bry1X0o451083IpZSmsC6pqgAEKBte2ZKvOJM9dTDm8L7cpNAOs2cR2xMHPQ==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@dropins/storefront-auth/-/storefront-auth-1.0.1.tgz", + "integrity": "sha512-L2RB0V1lNrtF0EL50RBDpaLNtbTqg1BhM8gPYaK5QFMlIIOIj+2WGJ3Edq9d3y2JReXATx0/eApzxXQWJaWDJA==" }, "node_modules/@dropins/storefront-cart": { "version": "1.0.1", @@ -1817,9 +1817,9 @@ "integrity": "sha512-tNCmgVEWEW2OzyNll69jTUTsT3wNG8yJ4HRZ/MrBJF+5/B/o3O+dfYTs4RUpIohXC8sGPkAjXCn5k6BQyo7QUA==" }, "node_modules/@dropins/storefront-order": { - "version": "1.0.1-beta1", - "resolved": "https://registry.npmjs.org/@dropins/storefront-order/-/storefront-order-1.0.1-beta1.tgz", - "integrity": "sha512-h6HYZrNk5QOoTDFaf7Ktlt6O+NEG2qHsmFGIyf6Vf8LnKRTrydYzsDjTU43qLdEI46aOW3/V9IVV+c7XLNAd7g==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@dropins/storefront-order/-/storefront-order-1.0.1.tgz", + "integrity": "sha512-0D3PW6NTVq53k4Z4R1lCbpGhQHifFQcyjfiA/wuHOEOzOX2rgf+o6RuKtUVhMHOp71/tQAZno2RenMQKXR8OSQ==" }, "node_modules/@dropins/storefront-pdp": { "version": "1.0.0", diff --git a/package.json b/package.json index 381ab2ab7a..b803b73a37 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,11 @@ "dependencies": { "@adobe/magento-storefront-event-collector": "^1.8.0", "@adobe/magento-storefront-events-sdk": "^1.8.0", - "@dropins/storefront-account": "~1.0.1-beta1", - "@dropins/storefront-auth": "~1.0.1-beta1", + "@dropins/storefront-account": "~1.0.1", + "@dropins/storefront-auth": "~1.0.1", "@dropins/storefront-cart": "~1.0.1", "@dropins/storefront-checkout": "~1.0.0", - "@dropins/storefront-order": "~1.0.1-beta1", + "@dropins/storefront-order": "~1.0.1", "@dropins/storefront-pdp": "~1.0.0", "@dropins/tools": "^0.38.0" } diff --git a/scripts/__dropins__/storefront-account/api.js b/scripts/__dropins__/storefront-account/api.js index d7caabd4ee..28dfbacf2a 100644 --- a/scripts/__dropins__/storefront-account/api.js +++ b/scripts/__dropins__/storefront-account/api.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{c as i,g as m,i as d}from"./chunks/getStoreConfig.js";import{d as g,f as u,c as C,g as f,h,e as c,i as n,j as l,r as A,s as x,a as F,b as G,u as H}from"./chunks/removeCustomerAddress.js";import{g as b,b as v,a as E,u as j}from"./chunks/updateCustomer.js";import{g as y}from"./chunks/getOrderHistoryList.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";export{i as config,g as createCustomerAddress,u as fetchGraphQl,C as getAttributesForm,f as getConfig,h as getCountries,b as getCustomer,c as getCustomerAddress,y as getOrderHistoryList,n as getRegions,m as getStoreConfig,d as initialize,l as removeCustomerAddress,A as removeFetchGraphQlHeader,x as setEndpoint,F as setFetchGraphQlHeader,G as setFetchGraphQlHeaders,v as updateCustomer,H as updateCustomerAddress,E as updateCustomerEmail,j as updateCustomerPassword}; diff --git a/scripts/__dropins__/storefront-account/api/graphql/OrderSummaryFragment.graphql.d.ts b/scripts/__dropins__/storefront-account/api/graphql/OrderSummaryFragment.graphql.d.ts index 595f46f594..daee43c400 100644 --- a/scripts/__dropins__/storefront-account/api/graphql/OrderSummaryFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-account/api/graphql/OrderSummaryFragment.graphql.d.ts @@ -14,5 +14,5 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n __typename\n grand_total {\n value\n currency\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; +export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal_excl_tax {\n currency\n value\n }\n subtotal_incl_tax {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; //# sourceMappingURL=OrderSummaryFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js index fcb0bdb0b2..5bde786299 100644 --- a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js +++ b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! 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{k as Ve,o as Be,u as Ce,c as ze,e as at,n 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.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 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}; diff --git a/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js b/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js index bb5909ad2a..03cf3ffe70 100644 --- a/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js +++ b/scripts/__dropins__/storefront-account/chunks/getOrderHistoryList.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{t as h,k as d,f as A,l as C}from"./removeCustomerAddress.js";import{c as I}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as M}from"@dropins/tools/lib.js";import{ADDRESS_FRAGMENT as N,ORDER_SUMMARY_FRAGMENT as $}from"../fragments.js";const b=(t,e="en-US",a={})=>{const r={...{day:"2-digit",month:"2-digit",year:"numeric"},...a},n=new Date(t);return isNaN(n.getTime())?"Invalid Date":new Intl.DateTimeFormat(e,r).format(n)},G=t=>{var c,_,l,u,f,g,p,R,S,E,s,O;if(!((_=(c=t.data)==null?void 0:c.customer)!=null&&_.orders))return null;const{page_info:e,total_count:a,date_of_first_order:i}=t.data.customer.orders,r=((u=(l=t==null?void 0:t.data)==null?void 0:l.customer)==null?void 0:u.returns)??[],m={items:(((p=(g=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:g.orders)==null?void 0:p.items)??[]).map(o=>{var T;const D={...o,returns:(T=r==null?void 0:r.items)==null?void 0:T.filter(y=>y.order.id===o.id),order_date:b(o.order_date),shipping_address:h(o.shipping_address),billing_address:h(o.billing_address)};return d(D,"camelCase",{})}),pageInfo:d(e,"camelCase",{}),totalCount:d(a,"camelCase",{}),dateOfFirstOrder:d(i,"camelCase",{})};return M(m,(O=(s=(E=(S=(R=I)==null?void 0:R.getConfig())==null?void 0:S.models)==null?void 0:E.OrderHistoryModel)==null?void 0:s.transformer)==null?void 0:O.call(s,t.data))},F=` +import{t as H,f as Y,k as j}from"./removeCustomerAddress.js";import{c as J}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as K}from"@dropins/tools/lib.js";import{ADDRESS_FRAGMENT as Q,ORDER_SUMMARY_FRAGMENT as B}from"../fragments.js";const V=(a,o="en-US",s={})=>{const d={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},u=new Date(a);return isNaN(u.getTime())?"Invalid Date":new Intl.DateTimeFormat(o,d).format(u)},_={value:0,currency:"USD"},W=a=>{var o,s,c,d,u,g,f,n,l;return{subtotal:((o=a==null?void 0:a.total)==null?void 0:o.subtotal)??_,grandTotal:((s=a==null?void 0:a.total)==null?void 0:s.grand_total)??_,totalGiftcard:((c=a==null?void 0:a.total)==null?void 0:c.total_giftcard)??_,subtotalExclTax:((d=a==null?void 0:a.total)==null?void 0:d.subtotal_excl_tax)??_,subtotalInclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_incl_tax)??_,taxes:((g=a==null?void 0:a.total)==null?void 0:g.taxes)??[],totalTax:((f=a==null?void 0:a.total)==null?void 0:f.total_tax)??_,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??_,discounts:((l=a==null?void 0:a.total)==null?void 0:l.discounts)??[]}},X=a=>{var d,u,g,f,n,l,p,h,S,y,T,E,R,O,D,b,A,I,M,k,x,N,q,G,$,C,F,v,i,z;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const o=((f=(g=a==null?void 0:a.data)==null?void 0:g.customer)==null?void 0:f.returns)??[],c={items:(((p=(l=(n=a==null?void 0:a.data)==null?void 0:n.customer)==null?void 0:l.orders)==null?void 0:p.items)??[]).map(r=>{var P;return{items:r==null?void 0:r.items.map(t=>{var U,w,L;return{status:(t==null?void 0:t.status)??"",productName:(t==null?void 0:t.product_name)??"",id:t==null?void 0:t.id,quantityOrdered:(t==null?void 0:t.quantity_ordered)??0,quantityShipped:(t==null?void 0:t.quantity_shipped)??0,quantityInvoiced:(t==null?void 0:t.quantity_invoiced)??0,product:{sku:((U=t==null?void 0:t.product)==null?void 0:U.sku)??"",urlKey:(t==null?void 0:t.product.url_key)??"",smallImage:{url:((L=(w=t==null?void 0:t.product)==null?void 0:w.small_image)==null?void 0:L.url)??""}}}}),token:r==null?void 0:r.token,email:r==null?void 0:r.email,shippingMethod:r==null?void 0:r.shipping_method,paymentMethods:(r==null?void 0:r.payment_methods)??[],shipments:(r==null?void 0:r.shipments)??[],id:r==null?void 0:r.id,carrier:r==null?void 0:r.carrier,status:r==null?void 0:r.status,number:r==null?void 0:r.number,returns:(P=o==null?void 0:o.items)==null?void 0:P.filter(t=>t.order.id===r.id),orderDate:V(r.order_date),shippingAddress:H(r.shipping_address),billingAddress:H(r.billing_address),total:W(r)}}),pageInfo:{pageSize:((T=(y=(S=(h=a==null?void 0:a.data)==null?void 0:h.customer)==null?void 0:S.orders)==null?void 0:y.page_info)==null?void 0:T.page_size)??10,totalPages:((D=(O=(R=(E=a==null?void 0:a.data)==null?void 0:E.customer)==null?void 0:R.orders)==null?void 0:O.page_info)==null?void 0:D.total_pages)??1,currentPage:((M=(I=(A=(b=a==null?void 0:a.data)==null?void 0:b.customer)==null?void 0:A.orders)==null?void 0:I.page_info)==null?void 0:M.current_page)??1},totalCount:((N=(x=(k=a==null?void 0:a.data)==null?void 0:k.customer)==null?void 0:x.orders)==null?void 0:N.total_count)??0,dateOfFirstOrder:(($=(G=(q=a==null?void 0:a.data)==null?void 0:q.customer)==null?void 0:G.orders)==null?void 0:$.date_of_first_order)??""};return K(c,(z=(i=(v=(F=(C=J)==null?void 0:C.getConfig())==null?void 0:F.models)==null?void 0:v.OrderHistoryModel)==null?void 0:i.transformer)==null?void 0:z.call(i,a.data))},Z=` query GET_CUSTOMER_ORDERS_LIST( $currentPage: Int $pageSize: Int @@ -80,6 +80,6 @@ import{t as h,k as d,f as A,l as C}from"./removeCustomerAddress.js";import{c as } } } - ${N} - ${$} -`,k={sort_direction:"DESC",sort_field:"CREATED_AT"},z=async(t,e,a)=>{const i=e.includes("viewAll")?{}:{order_date:JSON.parse(e)};return await A(F,{method:"GET",cache:"no-cache",variables:{pageSize:t,currentPage:a,filter:i,sort:k}}).then(r=>G(r)).catch(C)};export{z as g}; + ${Q} + ${B} +`,m={sort_direction:"DESC",sort_field:"CREATED_AT"},ua=async(a,o,s)=>{const c=o.includes("viewAll")?{}:{order_date:JSON.parse(o)};return await Y(Z,{method:"GET",cache:"no-cache",variables:{pageSize:a,currentPage:s,filter:c,sort:m}}).then(d=>X(d)).catch(j)};export{ua as g}; diff --git a/scripts/__dropins__/storefront-account/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-account/chunks/getStoreConfig.js index de40cc9465..8d7a3bb8ad 100644 --- a/scripts/__dropins__/storefront-account/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-account/chunks/getStoreConfig.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{Initializer as f}from"@dropins/tools/lib.js";import{f as h,m as _,l as m}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,g=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}},l=` +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=` query GET_STORE_CONFIG { storeConfig { base_media_url @@ -9,4 +9,4 @@ import{Initializer as f}from"@dropins/tools/lib.js";import{f as h,m as _,l as m} required_character_classes_number } } -`,s=async()=>await h(l,{method:"GET",cache:"force-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?_(t.errors):g(t)}).catch(m);export{C as c,s as g,c as i}; +`,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}; diff --git a/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js b/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js index acb1d2cdb3..de9db772ec 100644 --- a/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js +++ b/scripts/__dropins__/storefront-account/chunks/removeCustomerAddress.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const S=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),g=(t,n,e)=>{const r=["string","boolean","number"],o=n==="camelCase"?S:p;return Array.isArray(t)?t.map(i=>r.includes(typeof i)||i===null?i:typeof i=="object"?g(i,n,e):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const u=e&&e[c]?e[c]:o(c);return i[u]=r.includes(typeof a)||a===null?a:g(a,n,e),i},{}):t},{setEndpoint:k,setFetchGraphQlHeader:H,removeFetchGraphQlHeader:J,setFetchGraphQlHeaders:K,fetchGraphQl:s,getConfig:L}=new C().getMethods(),T=` +import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as E}from"@dropins/tools/fetch-graphql.js";const m=t=>t.replace(/_([a-z])/g,(r,n)=>n.toUpperCase()),S=t=>t.replace(/([A-Z])/g,r=>`_${r.toLowerCase()}`),h=(t,r,n)=>{const o=["string","boolean","number"],u=r==="camelCase"?m:S;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?h(i,r,n):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const e=n&&n[c]?n[c]:u(c);return i[e]=o.includes(typeof a)||a===null?a:h(a,r,n),i},{}):t},{setEndpoint:Q,setFetchGraphQlHeader:j,removeFetchGraphQlHeader:k,setFetchGraphQlHeaders:J,fetchGraphQl:s,getConfig:K}=new E().getMethods(),p=` query GET_ATTRIBUTES_FORM($formCode: String!) { attributesForm(formCode: $formCode) { items { @@ -32,7 +32,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,A=` +`,C=` query GET_ATTRIBUTES_FORM_SHORT { attributesForm(formCode: "customer_register_address") { items { @@ -46,13 +46,13 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||b.emit("error",{source:"auth",type:"network",error:t}),t},f=t=>{const n=t.map(e=>e.message).join(" ");throw Error(n)},y=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let r=2;r<=e.multiline_count;r++){const o={...e,is_required:!1,name:`${e.code}_multiline_${r}`,code:`${e.code}_multiline_${r}`,id:`${e.code}_multiline_${r}`};n.push(o)}return n},R=t=>{var i,c,a;const n=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!n.length)return[];const e=(a=n.filter(u=>{var l;return!((l=u.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:u,...l})=>{const m=u!=="country_id"?u:"country_code";return{...l,name:m,id:m,code:m}}),r=y(e);return e.concat(r).map(u=>{var E;const l=u.code==="middlename"?"middleName":u.code==="firstname"?"firstName":u.code==="lastname"?"lastName":S(u.code),m=(E=u.options)==null?void 0:E.map(h=>({isDefault:h.is_default,text:h.label,value:h.value}));return g({...u,options:m,customUpperCode:l},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((u,l)=>u.orderNumber-l.orderNumber)},v=t=>{const n={};for(const e in t){const r=t[e];!Array.isArray(r)||r.length===0||(e==="custom_attributesV2"?r.forEach(o=>{typeof o=="object"&&"value"in o&&(n[o==null?void 0:o.code]=o==null?void 0:o.value)}):r.length>1?r.forEach((o,i)=>{i===0?n[e]=o:n[`${e}_multiline_${i+1}`]=o}):n[e]=r[0])}return n},N=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),O=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??""}),I=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var e,r,o;return g({...N(t),...O(t),...I(t),city:(t==null?void 0:t.city)??"",region:{region:((e=t==null?void 0:t.region)==null?void 0:e.region)??"",region_code:((r=t==null?void 0:t.region)==null?void 0:r.region_code)??"",region_id:((o=t==null?void 0:t.region)==null?void 0:o.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...v(t)},"camelCase",{})},G=t=>{var r,o;const n=((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.addresses)||[];return n.length?n.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},M=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:n,storeConfig:e}=t.data,r=e==null?void 0:e.countries_with_required_region.split(","),o=e==null?void 0:e.optional_zip_countries.split(",");return{availableCountries:n.filter(({two_letter_abbreviation:u,full_name_locale:l})=>!!(u&&l)).map(u=>{const{two_letter_abbreviation:l,full_name_locale:m}=u;return{value:l,text:m}}).sort((u,l)=>u.text.localeCompare(l.text)),countriesWithRequiredRegion:r,optionalZipCountries:o}},U=t=>{var e,r;return(r=(e=t==null?void 0:t.data)==null?void 0:e.country)!=null&&r.available_regions?t.data.country.available_regions.filter(o=>{if(!o)return!1;const{id:i,code:c,name:a}=o;return!!(i&&c&&a)}).map(o=>{const{id:i}=o;return{id:i,text:o.name,value:`${o.code},${o.id}`}}):[]},P=async t=>{const n=`_account_attributesForm_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await s(t!=="shortRequest"?T:A,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return f(r.errors);const o=R(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},w=` +`,f=t=>{throw t instanceof DOMException&&t.name==="AbortError"||b.emit("error",{source:"auth",type:"network",error:t}),t},_=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},T=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},y=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return m(t)}},A=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},R=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const g=e!=="country_id"?e:"country_code";return{...l,name:g,id:g,code:g}}),o=T(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:A(e),customUpperCode:y(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},v=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},N=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),O=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??""}),I=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return h({...N(t),...O(t),...I(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...v(t)},"camelCase",{})},U=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},G=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:g}=e;return{value:l,text:g}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},M=t=>{var n,o;return(o=(n=t==null?void 0:t.data)==null?void 0:n.country)!=null&&o.available_regions?t.data.country.available_regions.filter(u=>{if(!u)return!1;const{id:i,code:c,name:a}=u;return!!(i&&c&&a)}).map(u=>{const{id:i}=u;return{id:i,text:u.name,value:`${u.code},${u.id}`}}):[]},L=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?p:C,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return _(o.errors);const u=R(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(f)},w=` mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) { createCustomerAddress(input: $input) { firstname } } -`,d=async t=>await s(w,{method:"POST",variables:{input:g(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(n=>{var e,r,o;return(e=n.errors)!=null&&e.length?f(n.errors):((o=(r=n==null?void 0:n.data)==null?void 0:r.createCustomerAddress)==null?void 0:o.firstname)||""}).catch(_),x=` +`,P=async t=>await s(w,{method:"POST",variables:{input:h(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var n,o,u;return(n=r.errors)!=null&&n.length?_(r.errors):((u=(o=r==null?void 0:r.data)==null?void 0:o.createCustomerAddress)==null?void 0:u.firstname)||""}).catch(f),q=` query GET_CUSTOMER_ADDRESS { customer { addresses { @@ -86,7 +86,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,z=async()=>await s(x,{method:"GET",cache:"no-cache"}).then(t=>{var n;return(n=t.errors)!=null&&n.length?f(t.errors):G(t)}).catch(_),F=` +`,z=async()=>await s(q,{method:"GET",cache:"no-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?_(t.errors):U(t)}).catch(f),x=` query GET_COUNTRIES_QUERY { countries { two_letter_abbreviation @@ -97,7 +97,7 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr optional_zip_countries } } -`,Z=async()=>{const t="_account_countries",n=sessionStorage.getItem(t);return n?JSON.parse(n):await s(F,{method:"GET",cache:"no-cache"}).then(e=>{var o;if((o=e.errors)!=null&&o.length)return f(e.errors);const r=M(e);return sessionStorage.setItem(t,JSON.stringify(r)),r}).catch(_)},q=` +`,Z=async()=>{const t="_account_countries",r=sessionStorage.getItem(t);return r?JSON.parse(r):await s(x,{method:"GET",cache:"no-cache"}).then(n=>{var u;if((u=n.errors)!=null&&u.length)return _(n.errors);const o=G(n);return sessionStorage.setItem(t,JSON.stringify(o)),o}).catch(f)},F=` query GET_REGIONS($countryCode: String!) { country(id: $countryCode) { id @@ -108,14 +108,14 @@ import{events as b}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr } } } -`,W=async t=>{const n=`_account_regions_${t}`,e=sessionStorage.getItem(n);return e?JSON.parse(e):await s(q,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(r=>{var i;if((i=r.errors)!=null&&i.length)return f(r.errors);const o=U(r);return sessionStorage.setItem(n,JSON.stringify(o)),o}).catch(_)},V=` +`,W=async t=>{const r=`_account_regions_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(F,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return _(o.errors);const u=M(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(f)},d=` mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) { updateCustomerAddress(id: $id, input: $input) { firstname } } -`,Y=async t=>{const{addressId:n,...e}=t;return n?await s(V,{method:"POST",variables:{id:n,input:g(e,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var o,i,c;return(o=r.errors)!=null&&o.length?f(r.errors):((c=(i=r==null?void 0:r.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(_):""},B=` +`,Y=async t=>{const{addressId:r,...n}=t;return r?await s(d,{method:"POST",variables:{id:r,input:h(n,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(o=>{var u,i,c;return(u=o.errors)!=null&&u.length?_(o.errors):((c=(i=o==null?void 0:o.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(f):""},V=` mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) { deleteCustomerAddress(id: $id) } -`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(n=>{var e;return(e=n.errors)!=null&&e.length?f(n.errors):n.data.deleteCustomerAddress}).catch(_);export{H as a,K as b,P as c,d,z as e,s as f,L as g,Z as h,W as i,X as j,g as k,_ as l,f as m,S as n,p as o,J as r,k as s,$ as t,Y as u}; +`,X=async t=>await s(V,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?_(r.errors):r.data.deleteCustomerAddress}).catch(f);export{j as a,J as b,L as c,P as d,z as e,s as f,K as g,Z as h,W as i,X as j,f as k,_ as l,m,h as n,S as o,k as r,Q as s,$ as t,Y as u}; diff --git a/scripts/__dropins__/storefront-account/chunks/updateCustomer.js b/scripts/__dropins__/storefront-account/chunks/updateCustomer.js index 7d1b697a50..40311cc701 100644 --- a/scripts/__dropins__/storefront-account/chunks/updateCustomer.js +++ b/scripts/__dropins__/storefront-account/chunks/updateCustomer.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{n as y,f as C,m as o,l as h,k as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";const B=t=>{var r,u,i,d,_,f,E,S,T,w,e,g,O,P,A,M,U,R,b,N,$,G,v,D,c,I;const m=(i=(u=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:u.custom_attributes)==null?void 0:i.filter(l=>l).reduce((l,n)=>(l[y(n.code)]=n.value??"",l),{}),a={email:((_=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:_.email)||"",firstName:((E=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:E.firstname)||"",lastName:((T=(S=t==null?void 0:t.data)==null?void 0:S.customer)==null?void 0:T.lastname)||"",middleName:((e=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:e.middlename)||"",gender:((O=(g=t==null?void 0:t.data)==null?void 0:g.customer)==null?void 0:O.gender)||"1",dateOfBirth:((A=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:A.date_of_birth)||"",prefix:((U=(M=t==null?void 0:t.data)==null?void 0:M.customer)==null?void 0:U.prefix)||"",suffix:((b=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:b.suffix)||"",createdAt:(($=(N=t==null?void 0:t.data)==null?void 0:N.customer)==null?void 0:$.created_at)||"",...m};return k(a,(I=(c=(D=(v=(G=V)==null?void 0:G.getConfig())==null?void 0:v.models)==null?void 0:D.CustomerDataModelShort)==null?void 0:c.transformer)==null?void 0:I.call(c,t.data))},L=` +import{m as y,f as C,l as o,k as h,n as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";const B=t=>{var r,u,i,d,_,f,E,S,T,w,e,g,O,P,A,M,U,R,b,N,$,G,v,D,c,I;const m=(i=(u=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:u.custom_attributes)==null?void 0:i.filter(l=>l).reduce((l,n)=>(l[y(n.code)]=n.value??"",l),{}),a={email:((_=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:_.email)||"",firstName:((E=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:E.firstname)||"",lastName:((T=(S=t==null?void 0:t.data)==null?void 0:S.customer)==null?void 0:T.lastname)||"",middleName:((e=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:e.middlename)||"",gender:((O=(g=t==null?void 0:t.data)==null?void 0:g.customer)==null?void 0:O.gender)||"1",dateOfBirth:((A=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:A.date_of_birth)||"",prefix:((U=(M=t==null?void 0:t.data)==null?void 0:M.customer)==null?void 0:U.prefix)||"",suffix:((b=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:b.suffix)||"",createdAt:(($=(N=t==null?void 0:t.data)==null?void 0:N.customer)==null?void 0:$.created_at)||"",...m};return k(a,(I=(c=(D=(v=(G=V)==null?void 0:G.getConfig())==null?void 0:v.models)==null?void 0:D.CustomerDataModelShort)==null?void 0:c.transformer)==null?void 0:I.call(c,t.data))},L=` query GET_CUSTOMER { customer { ...BASIC_CUSTOMER_INFO_FRAGMENT diff --git a/scripts/__dropins__/storefront-account/components/ChangePassword/ChangePassword.d.ts b/scripts/__dropins__/storefront-account/components/ChangePassword/ChangePassword.d.ts index 9ef25dd3a0..8c5f1771c1 100644 --- a/scripts/__dropins__/storefront-account/components/ChangePassword/ChangePassword.d.ts +++ b/scripts/__dropins__/storefront-account/components/ChangePassword/ChangePassword.d.ts @@ -1,5 +1,8 @@ import { FunctionComponent } from 'preact'; -import { ChangePasswordProps } from '../../types'; +import { ChangePasswordProps, ValidateLengthConfigProps } from '../../types'; +export declare const getErrorMessage: (isValidUniqueSymbols: string, defaultLengthMessage: ValidateLengthConfigProps | undefined, isSubmit: boolean, newPassword: string, passwordErrors: { + newPassword: string; +}) => string | undefined; export declare const ChangePassword: FunctionComponent; //# sourceMappingURL=ChangePassword.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-account/configs/mockOrdersList.config.d.ts b/scripts/__dropins__/storefront-account/configs/mockOrdersList.config.d.ts index 1674a14f6f..ba46cd05ee 100644 --- a/scripts/__dropins__/storefront-account/configs/mockOrdersList.config.d.ts +++ b/scripts/__dropins__/storefront-account/configs/mockOrdersList.config.d.ts @@ -39,7 +39,6 @@ export declare const mockOrdersListResponse: { region_code: string; region_id: string; }; - shipments: never[]; telephone: string; id: string; vat_id: string; @@ -140,7 +139,6 @@ export declare const mockOrdersListResponse: { default_shipping: boolean; default_billing: boolean; custom_attributesV2: never[]; - shipments?: undefined; }; billing_address: { firstname: string; diff --git a/scripts/__dropins__/storefront-account/containers/AddressForm.js b/scripts/__dropins__/storefront-account/containers/AddressForm.js index 9284ac8a3d..142654d804 100644 --- a/scripts/__dropins__/storefront-account/containers/AddressForm.js +++ b/scripts/__dropins__/storefront-account/containers/AddressForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{A as l,A as u}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";export{l as AddressForm,u as default}; diff --git a/scripts/__dropins__/storefront-account/containers/Addresses.js b/scripts/__dropins__/storefront-account/containers/Addresses.js index 5dbad04a51..4cd11b8950 100644 --- a/scripts/__dropins__/storefront-account/containers/Addresses.js +++ b/scripts/__dropins__/storefront-account/containers/Addresses.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k}from"@dropins/tools/lib.js";import{a as q}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const C=(e,r)=>e&&r?"selectedAddress":e?"selectedShippingAddress":r?"selectedBillingAddress":"default",S=({hideActionFormButtons:e,formName:r,slots:m,title:a,addressFormTitle:p,defaultSelectAddressId:f,showFormLoader:n,forwardFormRef:u,showSaveCheckBox:c,saveCheckBoxValue:l,selectShipping:s,selectBilling:t,selectable:A,className:d,withHeader:w,minifiedView:i,withActionsInMinifiedView:x,withActionsInFullSizeView:N,inputsDefaultValueSet:V,showShippingCheckBox:j,showBillingCheckBox:v,shippingCheckBoxValue:y,billingCheckBoxValue:z,onAddressData:D,routeAddressesPage:F,onSuccess:K,onError:W})=>{const b=i?"minifiedView":"fullSizeView",h=r??C(s,t);return o("div",{className:k(["account-addresses",d]),"data-testid":"addressesid",children:o(q,{inputName:h,minifiedViewKey:b,hideActionFormButtons:e,slots:m,title:a,addressFormTitle:p,defaultSelectAddressId:f,showFormLoader:n,onAddressData:D,forwardFormRef:u,selectShipping:s,selectBilling:t,showSaveCheckBox:c,saveCheckBoxValue:l,selectable:A,className:d,withHeader:w,minifiedView:i,withActionsInMinifiedView:x,withActionsInFullSizeView:N,inputsDefaultValueSet:V,billingCheckBoxValue:z,shippingCheckBoxValue:y,showBillingCheckBox:v,showShippingCheckBox:j,routeAddressesPage:F,onSuccess:K,onError:W})})};export{S as Addresses,S as default}; diff --git a/scripts/__dropins__/storefront-account/containers/CustomerInformation.js b/scripts/__dropins__/storefront-account/containers/CustomerInformation.js index 91f117b3c9..f9b6152d6a 100644 --- a/scripts/__dropins__/storefront-account/containers/CustomerInformation.js +++ b/scripts/__dropins__/storefront-account/containers/CustomerInformation.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsxs as F,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 E 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 Ve}from"../chunks/removeCustomerAddress.js";import"@dropins/tools/preact.js";import"../fragments.js";import"@dropins/tools/fetch-graphql.js";const Ee=e=>E.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},E.createElement("g",{clipPath:"url(#clip0_841_1324)"},E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),E.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"})),E.createElement("defs",null,E.createElement("clipPath",{id:"clip0_841_1324"},E.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ye=e=>E.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},E.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"}),E.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),Ie=e=>E.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},E.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"}),E.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"})),Le=()=>{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}},ve=({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:""},Fe=({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(""),[A,y]=m(""),[I,b]=m({currentPassword:"",newPassword:"",confirmPassword:""}),i=C(()=>{n(()=>{t({}),b(K)})},[n,t]),_=C(f=>{p(f),b(V=>({...V,currentPassword:f?"":r.requiredFieldError}))},[r]),w=C(f=>{u(f),b(V=>({...V,newPassword:f?"":r.requiredFieldError}))},[r]),H=C(f=>{y(f),b(V=>({...V,confirmPassword:f?"":r.requiredFieldError}))},[r]),M=C(f=>{const{name:V,value:Z}=f==null?void 0:f.target;b(L=>({...L,[V]:Z?"":r.requiredFieldError}))},[r]),T=C(()=>{const{isValid:f,errors:V}=ve({currentPassword:c,newPassword:h,confirmPassword:A,translations:r});return b(V),f},[c,h,A,r]),U=C(f=>{f.preventDefault(),l(!0);const V=(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,V)||Z>(h==null?void 0:h.length)){s(!0),l(!1);return}Pe({currentPassword:c,newPassword:h}).then(L=>{if(!(L!=null&&L.length)){l(!1);return}p(""),u(""),y(""),b(K),s(!1),t({type:"success",text:r.passwordUpdateMessage})}).catch(L=>{L.message==="Invalid login or password."&&t({type:"error",text:r.incorrectCurrentPassword}),L.message==="The account is locked."&&t({type:"error",text:L.message})}),l(!1)},[e,T,h,c,t,r]);return{hideChangePassword:i,handleOnBlurPassword:M,handleConfirmPasswordChange:H,handleNewPasswordChange:w,handleCurrentPasswordChange:_,mutationChangePassword:U,currentPassword:c,newPassword:h,confirmPassword:A,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{const{passwordConfigs:r}=Le(),{hideChangePassword:o,handleOnBlurPassword:s,handleConfirmPasswordChange:P,handleNewPasswordChange:l,handleCurrentPasswordChange:c,mutationChangePassword:p,currentPassword:h,newPassword:u,confirmPassword:A,passwordErrors:y,submitLoading:I,isClickSubmit:b}=Fe({passwordConfigs:r,handleSetInLineAlert:t,handleHideChangePassword:e}),{isValidUniqueSymbols:i,defaultLengthMessage:_}=_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 F(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,F("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:_,uniqueSymbolsStatus:i,requiredCharacterClasses:r==null?void 0:r.requiredCharacterClasses,errorMessage:i==="error"||(_==null?void 0:_.status)==="error"||b&&u.length<=0?y.newPassword:void 0,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:A,onValue:P,onBlur:s})]}),F("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})]})]})},Me=({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 F(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,F(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,F("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})]})]})]})},Se=({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:F("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}}):F(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}`)}),F("p",{children:[l.accountCreation,": ",e]})]})}),F("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})]})]})})},Ne=e=>{if(!(e!=null&&e.dateOfBirth))return e;const{dateOfBirth:t,...n}=e;return{...n,dob:t}},qe=({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),[A,y]=m(!1),[I,b]=m([]),[i,_]=m(null),[w,H]=m([]),[M,T]=m({}),[U,f]=m(""),[V,Z]=m(""),L=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 v;const g=(v=a==null?void 0:a.createdAt)==null?void 0:v.split(" ")[0],z=Ne({...a,gender:a.gender===1?t.genderMale:t.genderFemale});_(z),Z(g)})},[t.genderFemale,t.genderMale]);B(()=>{W()},[]),B(()=>{Ve("customer_account_edit").then(a=>{H(a);const g=a.map(({name:z,customUpperCode:v,orderNumber:q,label:j})=>({name:v,orderNumber:q,label:he.includes(z)?null:j}));b(g)})},[]),B(()=>{M.email&&M.email!==(i==null?void 0:i.email)?y(!0):M.email&&M.email===(i==null?void 0:i.email)&&y(!1)},[i==null?void 0:i.email,M]);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:v,password:q,...j}=z,Y=v!==(i==null?void 0:i.email)&&q.length===0;if(!g){Y&&u(!0);return}if(u(!1),s(!0),v===(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}v!=null&&v.length&&(q!=null&&q.length)&&be({email:v,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:V,errorPasswordEmpty:h,passwordValue:U,showPasswordOnEmailChange:A,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:L,renderAlertMessage:N}},ke={success:d(ye,{}),warning:d(Ee,{}),error:d(Ie,{})},xe=()=>{const[e,t]=m({}),n=C(r=>{if(!(r!=null&&r.type)){t({});return}const o=ke[r.type];t({...r,icon:o})},[]);return{inLineAlertProps:e,handleSetInLineAlert:n}},Ke=({className:e,withHeader:t=!0,slots:n})=>{const r=x({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:s}=xe(),{createdAt:P,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,orderedCustomerData:h,loading:u,normalizeFieldsConfig:A,submitLoading:y,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleHideChangePassword:_,handleShowEditForm:w,handleHideEditForm:H,handleUpdateCustomerInformation:M,handleInputChange:T,handleSetPassword:U,handleOnBlurPassword:f}=qe({handleSetInLineAlert:s});return u?d("div",{"data-testid":"customerInformationLoader",children:d(we,{withCard:!0})}):F("div",{className:re(["account-customer-information",e]),children:[t?d(X,{title:r.containerTitle,divider:!1,className:"customer-information__title"}):null,d(Se,{createdAt:P,slots:n,orderedCustomerData:h,showEditForm:I,showChangePassword:b,handleShowChangePassword:i,handleShowEditForm:w}),b?d(Ae,{inLineAlertProps:o,handleSetInLineAlert:s,handleHideChangePassword:_}):null,I?d(Me,{inLineAlertProps:o,submitLoading:y,formFieldsList:A,errorPasswordEmpty:l,passwordValue:c,showPasswordOnEmailChange:p,handleSetPassword:U,handleOnBlurPassword:f,handleUpdateCustomerInformation:M,handleHideEditForm:H,handleInputChange:T}):null]})};export{Ke as CustomerInformation,Ke as default}; +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.lengthe==="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}; diff --git a/scripts/__dropins__/storefront-account/containers/OrdersList.js b/scripts/__dropins__/storefront-account/containers/OrdersList.js index d24e9f23d8..700c2c1843 100644 --- a/scripts/__dropins__/storefront-account/containers/OrdersList.js +++ b/scripts/__dropins__/storefront-account/containers/OrdersList.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as s,jsxs as l,Fragment as $}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k,Slot as m}from"@dropins/tools/lib.js";import{S as K,c as Q,E as X,C as Z}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import{Card as R,Icon as V,Price as rr,ContentGrid as tr,Image as W,Header as sr,Picker as er,Pagination as ar}from"@dropins/tools/components.js";import{useText as D}from"@dropins/tools/i18n.js";import{useState as y,useEffect as Y,useMemo as cr,useCallback as j}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as nr}from"../chunks/getOrderHistoryList.js";import{g as or}from"../chunks/getStoreConfig.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";import"../fragments.js";const G={size:"32",stroke:"2"},U=({minifiedView:a,orderNumber:c,orderToken:r,routeOrdersList:e,routeOrderDetails:u})=>{const n=a?"minifiedView":"fullSizeView",i=D({viewAllOrdersButton:`Account.${n}.OrdersList.viewAllOrdersButton`,ariaLabelLink:`Account.${n}.OrdersList.ariaLabelLink`});return e?s("a",{className:k(["account-orders-list-action",["account-orders-list-action--minifiedView",a]]),"data-testid":"ordersListActionButtonMinifiedView",href:e(),children:s(R,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:l("div",{className:"account-orders-list-action__card-wrapper",children:[s("p",{children:i.viewAllOrdersButton}),s(V,{source:K,...G})]})})}):s("a",{"aria-label":`${i.ariaLabelLink} ${c??r}`,href:Q(u)?u(c,r):"#",className:"account-orders-list-action","data-testid":"ordersListActionButton",children:s(V,{source:K,...G})})},dr=()=>{const[a,c]=y(window.innerWidth<768);return Y(()=>{const r=()=>{c(window.innerWidth<768)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),a},ir=({placeholderImage:a,minifiedView:c,item:r,withThumbnails:e,children:u,slots:n,routeTracking:i,routeOrderProduct:p,routeReturnDetails:f,...b})=>{var g,I,_,x,N,M,P,O,T,w,z,v;const o=c?"minifiedView":"fullSizeView",h=D({orderNumber:`Account.${o}.OrdersList.OrdersListCard.orderNumber`,itemsAmount:`Account.${o}.OrdersList.OrdersListCard.itemsAmount`,carrier:`Account.${o}.OrdersList.OrdersListCard.carrier`,returnsText:`Account.${o}.OrdersList.OrdersListCard.returns`,deliveryDateText:`Account.${o}.OrdersList.OrdersListCard.orderDate`}),d=dr(),S=Q(p);return l(R,{variant:"secondary",...b,className:k(["account-orders-list-card",["account-orders-list-card--full",((g=r==null?void 0:r.items)==null?void 0:g.length)>6]]),children:[s("div",{className:"account-orders-list-card__content",children:n!=null&&n.OrdersListCard?s(m,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:n==null?void 0:n.OrdersListCard,context:{orderHistoryListItem:r}}):l($,{children:[s("div",{children:r==null?void 0:r.status}),l("p",{children:[h.deliveryDateText," ",r==null?void 0:r.orderDate]}),l("p",{children:[h.orderNumber," ",r.number]}),(I=r==null?void 0:r.shipments)==null?void 0:I.map(t=>{var L;return(L=t==null?void 0:t.tracking)==null?void 0:L.map(A=>{const C=i==null?void 0:i(A);return l("p",{"data-testid":A.number,children:[s("span",{children:`${h.carrier} ${A.carrier.toLocaleUpperCase()} `}),C?s("a",{href:C,target:"_blank",className:"account-orders-list-card__content--track_number",rel:"noreferrer",children:A.number}):s("span",{className:"account-orders-list-card__content--track_number",children:A.number})]},t.id)})}),r!=null&&r.returns&&((_=r.returns)!=null&&_.length)?l("p",{"data-testid":r.number,children:[l("span",{children:[h.returnsText," "]}),(x=r==null?void 0:r.returns)==null?void 0:x.map(t=>s("span",{"data-testid":t.number,children:l("a",{href:(f==null?void 0:f({orderNumber:r.number,orderToken:r.token,returnNumber:t.number}))??"#",className:"account-orders-list-card__content--return_number",children:[t.number," "]})},t.uid))]},r.id):null,s("p",{children:s(rr,{amount:((M=(N=r==null?void 0:r.total)==null?void 0:N.grandTotal)==null?void 0:M.value)??0,currency:(O=(P=r==null?void 0:r.total)==null?void 0:P.grandTotal)==null?void 0:O.currency,weight:"normal"})}),l("p",{"data-testid":"itemsAmount",children:[(T=r==null?void 0:r.items)!=null&&T.length?(w=r==null?void 0:r.items)==null?void 0:w.reduce((t,L)=>{const A=(L==null?void 0:L.quantityOrdered)||0;return t+A},0):0," ",h.itemsAmount]}),(z=r==null?void 0:r.items)==null?void 0:z.map((t,L)=>{if(L>=0&&L<10)return l("p",{className:"account-orders-list-card__content--product-name",children:[l("span",{className:"account-orders-list-card__content--quantity",children:[(t==null?void 0:t.quantityOrdered)>1?t==null?void 0:t.quantityOrdered:null," "]}),t==null?void 0:t.productName.replaceAll("-"," ")]},`${L}_${t.id}`);if(L===11)return s("p",{children:"..."},"ellipsis")})]})}),e&&((v=r==null?void 0:r.items)!=null&&v.length)?s(tr,{maxColumns:d?3:9,emptyGridContent:s($,{}),className:k(["account-orders-list-card__images",["account-orders-list-card__images-3",d]]),"data-testid":"ordersListCardImages",children:r.items.map((t,L)=>{var H,q,B,F,J;const A=(B=(q=(H=t==null?void 0:t.product)==null?void 0:H.smallImage)==null?void 0:q.url)!=null&&B.length?(J=(F=t==null?void 0:t.product)==null?void 0:F.smallImage)==null?void 0:J.url:a,C=(t==null?void 0:t.productName)??"";return S?s("a",{href:(p==null?void 0:p(t))??"",target:"_blank",rel:"noreferrer",children:s(W,{src:A,width:65,height:65,alt:C})},t.id+L):s(W,{src:A,width:65,height:65,alt:C},t.id+L)})}):null,s("div",{className:"account-orders-list-card__actions",children:u})]})},lr=({ordersInMinifiedView:a,minifiedView:c,pageSize:r,selectedDate:e,selectedPage:u,handleSetFirstOrderDate:n})=>{const[i,p]=y([]),[f,b]=y({totalPages:1,currentPage:1,pageSize:1}),[o,h]=y(!1),[d,S]=y("");return Y(()=>{or().then(g=>{S(g.baseMediaUrl)})},[]),Y(()=>{h(!0),nr(c?a:r,e,u).then(g=>{!g||!g.items||(b(g.pageInfo),p(g.items),n==null||n(g.dateOfFirstOrder))}).finally(()=>{h(!1)})},[n,c,a,r,e,u]),{loading:o,orderHistoryListItems:i,pageInfo:f,placeholderImage:d}},E=(a,c=1)=>{const r=new Date,e=new Date(r);switch(a){case"sixMonthsAgo":{e.setMonth(e.getMonth()-c);break}case"oneYearAgo":{e.setFullYear(e.getFullYear()-c);break}default:return""}return{from:e==null?void 0:e.toISOString().split("T")[0],to:`${r==null?void 0:r.toISOString().split("T")[0]} 23:59:59`}},ur=a=>{const c=[],r=new Date().getFullYear();for(let e=a;e<=r-1;e++)c.push({value:`{"from":"${e}-01-01","to":"${e+1}-01-01 23:59:59"}`,text:e.toString()});return c},hr=()=>{const a=D({pastSixMonths:"Account.fullSizeView.OrdersList.OrdersListSelectDate.pastSixMonths",currentYear:"Account.fullSizeView.OrdersList.OrdersListSelectDate.currentYear",viewAll:"Account.fullSizeView.OrdersList.OrdersListSelectDate.viewAll"}),[c,r]=y(),[e,u]=y(JSON.stringify(E("sixMonthsAgo",6))),[n,i]=y(1);Y(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[n]);const p=cr(()=>{const o=[{value:JSON.stringify(E("sixMonthsAgo",6)),text:a.pastSixMonths},{value:JSON.stringify(E("oneYearAgo",1)),text:a.currentYear},{value:"viewAll",text:a.viewAll}];if(c){const d=new Date(c).getFullYear();o==null||o.splice(2,0,...ur(d))}return o},[a,c]),f=j(o=>{r(o)},[]),b=j(o=>{const d=o.target.value;u(d),i(1)},[]);return{selectableDateList:p,selectedDate:e,selectedPage:n,handleSelectDate:b,setSelectedPage:i,handleSetFirstOrderDate:f}},gr=({className:a,withHeader:c=!0,minifiedView:r=!1,withThumbnails:e=!0,withFilter:u=!0,ordersInMinifiedView:n=1,pageSize:i=10,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>{const S=r?"minifiedView":"fullSizeView",g=D({containerTitle:`Account.${S}.OrdersList.containerTitle`,dateOrderPlaced:`Account.${S}.OrdersList.dateOrderPlaced`}),{selectableDateList:I,selectedDate:_,handleSelectDate:x,selectedPage:N,setSelectedPage:M,handleSetFirstOrderDate:P}=hr(),{pageInfo:O,loading:T,orderHistoryListItems:w,placeholderImage:z}=lr({minifiedView:r,pageSize:i,ordersInMinifiedView:n,selectedDate:_,selectedPage:N,handleSetFirstOrderDate:P});return l("div",{children:[c?s(sr,{"aria-label":g.containerTitle,role:"region",title:g.containerTitle,divider:!r,className:r?"account-orders-list-header":""}):null,l("div",{className:k(["account-orders-list",a]),children:[!r&&u?l("div",{className:"account-orders-list__date-select",children:[s("span",{children:g.dateOrderPlaced}),s(er,{value:_,name:"orderDatePicker",options:I,handleSelect:x})]}):null,T?s($,{children:Array.from(Array(O==null?void 0:O.pageSize).keys()).map(v=>s(Z,{testId:"orderSkeletonLoader",withCard:!1},v))}):s($,{children:w.length?s($,{children:w.map((v,t)=>s(ir,{placeholderImage:z,routeTracking:o,routeOrderProduct:h,routeReturnDetails:b,minifiedView:r,item:v,withThumbnails:e,slots:d,children:d!=null&&d.OrdersListAction?s(m,{"data-testid":`ordersListActionSlot_${t}`,name:"OrdersListAction",slot:d==null?void 0:d.OrdersListAction,context:{orderHistoryListItem:v}}):s(U,{minifiedView:r,orderNumber:v.number,orderToken:v.token,routeOrderDetails:f})},t))}):s(X,{isEmpty:!w.length,typeList:"orders",minifiedView:r})}),!r&&(O==null?void 0:O.totalPages)>1?s(ar,{totalPages:O==null?void 0:O.totalPages,currentPage:N,onChange:M}):null,r?s(U,{minifiedView:r,routeOrdersList:p}):null]})]})},kr=({className:a,withHeader:c,minifiedView:r,withThumbnails:e,withFilter:u,ordersInMinifiedView:n,pageSize:i,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>s("div",{className:k(["account-orders-list",a]),"data-testid":"ordersListId",children:s(gr,{className:a,withHeader:c,minifiedView:r,withThumbnails:e,withFilter:u,ordersInMinifiedView:n,pageSize:i,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})});export{kr as OrdersList,kr as default}; +import{jsx as s,jsxs as l,Fragment as $}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k,Slot as U}from"@dropins/tools/lib.js";import{S as K,c as Q,E as X,C as Z}from"../chunks/CustomerInformationCard.js";import"@dropins/tools/preact-compat.js";import{Card as R,Icon as V,Price as rr,ContentGrid as tr,Image as W,Header as sr,Picker as er,Pagination as ar}from"@dropins/tools/components.js";import{useText as D}from"@dropins/tools/i18n.js";import{useState as y,useEffect as Y,useMemo as cr,useCallback as j}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as nr}from"../chunks/getOrderHistoryList.js";import{g as or}from"../chunks/getStoreConfig.js";import"../chunks/removeCustomerAddress.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";import"../fragments.js";const m={size:"32",stroke:"2"},G=({minifiedView:a,orderNumber:c,orderToken:r,routeOrdersList:e,routeOrderDetails:u})=>{const n=a?"minifiedView":"fullSizeView",i=D({viewAllOrdersButton:`Account.${n}.OrdersList.viewAllOrdersButton`,ariaLabelLink:`Account.${n}.OrdersList.ariaLabelLink`});return e?s("a",{className:k(["account-orders-list-action",["account-orders-list-action--minifiedView",a]]),"data-testid":"ordersListActionButtonMinifiedView",href:e(),children:s(R,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:l("div",{className:"account-orders-list-action__card-wrapper",children:[s("p",{children:i.viewAllOrdersButton}),s(V,{source:K,...m})]})})}):s("a",{"aria-label":`${i.ariaLabelLink} ${c??r}`,href:Q(u)?u(c,r):"#",className:"account-orders-list-action","data-testid":"ordersListActionButton",children:s(V,{source:K,...m})})},dr=()=>{const[a,c]=y(window.innerWidth<768);return Y(()=>{const r=()=>{c(window.innerWidth<768)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},[]),a},ir=({placeholderImage:a,minifiedView:c,item:r,withThumbnails:e,children:u,slots:n,routeTracking:i,routeOrderProduct:p,routeReturnDetails:f,...b})=>{var g,I,_,x,N,M,P,O,z,w,T,v;const o=c?"minifiedView":"fullSizeView",h=D({orderNumber:`Account.${o}.OrdersList.OrdersListCard.orderNumber`,itemsAmount:`Account.${o}.OrdersList.OrdersListCard.itemsAmount`,carrier:`Account.${o}.OrdersList.OrdersListCard.carrier`,returnsText:`Account.${o}.OrdersList.OrdersListCard.returns`,deliveryDateText:`Account.${o}.OrdersList.OrdersListCard.orderDate`}),d=dr(),S=Q(p);return l(R,{variant:"secondary",...b,className:k(["account-orders-list-card",["account-orders-list-card--full",((g=r==null?void 0:r.items)==null?void 0:g.length)>6]]),children:[s("div",{className:"account-orders-list-card__content",children:n!=null&&n.OrdersListCard?s(U,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:n==null?void 0:n.OrdersListCard,context:{orderHistoryListItem:r}}):l($,{children:[s("div",{children:r==null?void 0:r.status}),l("p",{children:[h.deliveryDateText," ",r==null?void 0:r.orderDate]}),l("p",{children:[h.orderNumber," ",r.number]}),(I=r==null?void 0:r.shipments)==null?void 0:I.map(t=>{var L;return(L=t==null?void 0:t.tracking)==null?void 0:L.map(A=>{const C=i==null?void 0:i(A);return l("p",{"data-testid":A.number,children:[s("span",{children:`${h.carrier} ${A.carrier.toLocaleUpperCase()} `}),C?s("a",{href:C,target:"_blank",className:"account-orders-list-card__content--track_number",rel:"noreferrer",children:A.number}):s("span",{className:"account-orders-list-card__content--track_number",children:A.number})]},t.id)})}),r!=null&&r.returns&&((_=r.returns)!=null&&_.length)?l("p",{"data-testid":r.number,children:[l("span",{children:[h.returnsText," "]}),(x=r==null?void 0:r.returns)==null?void 0:x.map(t=>s("span",{"data-testid":t.number,children:l("a",{href:(f==null?void 0:f({orderNumber:r.number,orderToken:r.token,returnNumber:t.number}))??"#",className:"account-orders-list-card__content--return_number",children:[t.number," "]})},t.uid))]},r.id):null,s("p",{children:s(rr,{amount:((M=(N=r==null?void 0:r.total)==null?void 0:N.grandTotal)==null?void 0:M.value)??0,currency:(O=(P=r==null?void 0:r.total)==null?void 0:P.grandTotal)==null?void 0:O.currency,weight:"normal",size:"medium"})}),l("p",{"data-testid":"itemsAmount",children:[(z=r==null?void 0:r.items)!=null&&z.length?(w=r==null?void 0:r.items)==null?void 0:w.reduce((t,L)=>{const A=(L==null?void 0:L.quantityOrdered)||0;return t+A},0):0," ",h.itemsAmount]}),(T=r==null?void 0:r.items)==null?void 0:T.map((t,L)=>{if(L>=0&&L<10)return l("p",{className:"account-orders-list-card__content--product-name",children:[l("span",{className:"account-orders-list-card__content--quantity",children:[(t==null?void 0:t.quantityOrdered)>1?t==null?void 0:t.quantityOrdered:null," "]}),t==null?void 0:t.productName.replaceAll("-"," ")]},`${L}_${t.id}`);if(L===11)return s("p",{children:"..."},"ellipsis")})]})}),e&&((v=r==null?void 0:r.items)!=null&&v.length)?s(tr,{maxColumns:d?3:9,emptyGridContent:s($,{}),className:k(["account-orders-list-card__images",["account-orders-list-card__images-3",d]]),"data-testid":"ordersListCardImages",children:r.items.map((t,L)=>{var H,q,B,F,J;const A=(B=(q=(H=t==null?void 0:t.product)==null?void 0:H.smallImage)==null?void 0:q.url)!=null&&B.length?(J=(F=t==null?void 0:t.product)==null?void 0:F.smallImage)==null?void 0:J.url:a,C=(t==null?void 0:t.productName)??"";return S?s("a",{href:(p==null?void 0:p(t))??"",target:"_blank",rel:"noreferrer",children:s(W,{src:A,width:65,height:65,alt:C})},t.id+L):s(W,{src:A,width:65,height:65,alt:C},t.id+L)})}):null,s("div",{className:"account-orders-list-card__actions",children:u})]})},lr=({ordersInMinifiedView:a,minifiedView:c,pageSize:r,selectedDate:e,selectedPage:u,handleSetFirstOrderDate:n})=>{const[i,p]=y([]),[f,b]=y({totalPages:1,currentPage:1,pageSize:1}),[o,h]=y(!1),[d,S]=y("");return Y(()=>{or().then(g=>{S(g.baseMediaUrl)})},[]),Y(()=>{h(!0),nr(c?a:r,e,u).then(g=>{!g||!g.items||(b(g.pageInfo),p(g.items),n==null||n(g.dateOfFirstOrder))}).finally(()=>{h(!1)})},[n,c,a,r,e,u]),{loading:o,orderHistoryListItems:i,pageInfo:f,placeholderImage:d}},E=(a,c=1)=>{const r=new Date,e=new Date(r);switch(a){case"sixMonthsAgo":{e.setMonth(e.getMonth()-c);break}case"oneYearAgo":{e.setFullYear(e.getFullYear()-c);break}default:return""}return{from:e==null?void 0:e.toISOString().split("T")[0],to:`${r==null?void 0:r.toISOString().split("T")[0]} 23:59:59`}},ur=a=>{const c=[],r=new Date().getFullYear();for(let e=a;e<=r-1;e++)c.push({value:`{"from":"${e}-01-01","to":"${e+1}-01-01 23:59:59"}`,text:e.toString()});return c},hr=()=>{const a=D({pastSixMonths:"Account.fullSizeView.OrdersList.OrdersListSelectDate.pastSixMonths",currentYear:"Account.fullSizeView.OrdersList.OrdersListSelectDate.currentYear",viewAll:"Account.fullSizeView.OrdersList.OrdersListSelectDate.viewAll"}),[c,r]=y(),[e,u]=y(JSON.stringify(E("sixMonthsAgo",6))),[n,i]=y(1);Y(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[n]);const p=cr(()=>{const o=[{value:JSON.stringify(E("sixMonthsAgo",6)),text:a.pastSixMonths},{value:JSON.stringify(E("oneYearAgo",1)),text:a.currentYear},{value:"viewAll",text:a.viewAll}];if(c){const d=new Date(c).getFullYear();o==null||o.splice(2,0,...ur(d))}return o},[a,c]),f=j(o=>{r(o)},[]),b=j(o=>{const d=o.target.value;u(d),i(1)},[]);return{selectableDateList:p,selectedDate:e,selectedPage:n,handleSelectDate:b,setSelectedPage:i,handleSetFirstOrderDate:f}},gr=({className:a,withHeader:c=!0,minifiedView:r=!1,withThumbnails:e=!0,withFilter:u=!0,ordersInMinifiedView:n=1,pageSize:i=10,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>{const S=r?"minifiedView":"fullSizeView",g=D({containerTitle:`Account.${S}.OrdersList.containerTitle`,dateOrderPlaced:`Account.${S}.OrdersList.dateOrderPlaced`}),{selectableDateList:I,selectedDate:_,handleSelectDate:x,selectedPage:N,setSelectedPage:M,handleSetFirstOrderDate:P}=hr(),{pageInfo:O,loading:z,orderHistoryListItems:w,placeholderImage:T}=lr({minifiedView:r,pageSize:i,ordersInMinifiedView:n,selectedDate:_,selectedPage:N,handleSetFirstOrderDate:P});return l("div",{children:[c?s(sr,{"aria-label":g.containerTitle,role:"region",title:g.containerTitle,divider:!r,className:r?"account-orders-list-header":""}):null,l("div",{className:k(["account-orders-list",a]),children:[!r&&u?l("div",{className:"account-orders-list__date-select",children:[s("span",{children:g.dateOrderPlaced}),s(er,{value:_,name:"orderDatePicker",options:I,handleSelect:x})]}):null,z?s($,{children:Array.from(Array(O==null?void 0:O.pageSize).keys()).map(v=>s(Z,{testId:"orderSkeletonLoader",withCard:!1},v))}):s($,{children:w.length?s($,{children:w.map((v,t)=>s(ir,{placeholderImage:T,routeTracking:o,routeOrderProduct:h,routeReturnDetails:b,minifiedView:r,item:v,withThumbnails:e,slots:d,children:d!=null&&d.OrdersListAction?s(U,{"data-testid":`ordersListActionSlot_${t}`,name:"OrdersListAction",slot:d==null?void 0:d.OrdersListAction,context:{orderHistoryListItem:v}}):s(G,{minifiedView:r,orderNumber:v.number,orderToken:v.token,routeOrderDetails:f})},t))}):s(X,{isEmpty:!w.length,typeList:"orders",minifiedView:r})}),!r&&(O==null?void 0:O.totalPages)>1?s(ar,{totalPages:O==null?void 0:O.totalPages,currentPage:N,onChange:M}):null,r?s(G,{minifiedView:r,routeOrdersList:p}):null]})]})},kr=({className:a,withHeader:c,minifiedView:r,withThumbnails:e,withFilter:u,ordersInMinifiedView:n,pageSize:i,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})=>s("div",{className:k(["account-orders-list",a]),"data-testid":"ordersListId",children:s(gr,{className:a,withHeader:c,minifiedView:r,withThumbnails:e,withFilter:u,ordersInMinifiedView:n,pageSize:i,routeOrdersList:p,routeOrderDetails:f,routeReturnDetails:b,routeTracking:o,routeOrderProduct:h,slots:d})});export{kr as OrdersList,kr as default}; diff --git a/scripts/__dropins__/storefront-account/data/models/attributes-form.d.ts b/scripts/__dropins__/storefront-account/data/models/attributes-form.d.ts index 5afc18118e..6368452da2 100644 --- a/scripts/__dropins__/storefront-account/data/models/attributes-form.d.ts +++ b/scripts/__dropins__/storefront-account/data/models/attributes-form.d.ts @@ -36,26 +36,26 @@ export declare enum FieldEnumList { EMPTY = "" } export interface AttributesFormItemsProps { - code?: string; - name?: string; - id?: string; - required?: boolean; - label?: string; - options?: { - is_default: boolean; - label: string; + code: string; + name: string; + id: string; + required: boolean; + label: string; + options: { + isDefault: boolean; + text: string; value: string; }[]; - entityType?: string; - className?: string; - defaultValue?: string | boolean | number; - fieldType?: FieldEnumList; - multilineCount?: number; - isUnique?: boolean; + entityType: string; + className: string; + defaultValue: string | boolean | number; + fieldType: FieldEnumList; + multilineCount: number; + isUnique: boolean; orderNumber: number; - isHidden?: boolean; + isHidden: boolean; customUpperCode: string; - validateRules: Record[]; + validateRules: Record[]; } export interface AttributesFormModel extends AttributesFormItemsProps { } diff --git a/scripts/__dropins__/storefront-account/fragments.js b/scripts/__dropins__/storefront-account/fragments.js index d5bb645651..5e55065b87 100644 --- a/scripts/__dropins__/storefront-account/fragments.js +++ b/scripts/__dropins__/storefront-account/fragments.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const e=` fragment BASIC_CUSTOMER_INFO_FRAGMENT on Customer { @@ -32,12 +32,19 @@ const e=` } `,a=` fragment ORDER_SUMMARY_FRAGMENT on OrderTotal { - __typename grand_total { value currency } - subtotal { + total_giftcard { + currency + value + } + subtotal_excl_tax { + currency + value + } + subtotal_incl_tax { currency value } diff --git a/scripts/__dropins__/storefront-account/hooks/containers/useCustomerInformation.d.ts b/scripts/__dropins__/storefront-account/hooks/containers/useCustomerInformation.d.ts index d774cc129e..1110fe8c88 100644 --- a/scripts/__dropins__/storefront-account/hooks/containers/useCustomerInformation.d.ts +++ b/scripts/__dropins__/storefront-account/hooks/containers/useCustomerInformation.d.ts @@ -14,25 +14,25 @@ export declare const useCustomerInformation: ({ handleSetInLineAlert, }: UseCust loading: boolean; normalizeFieldsConfig: { defaultValue: any; - code?: string | undefined; - name?: string | undefined; - id?: string | undefined; - required?: boolean | undefined; - label?: string | undefined; - options?: { - is_default: boolean; - label: string; + code: string; + name: string; + id: string; + required: boolean; + label: string; + options: { + isDefault: boolean; + text: string; value: string; - }[] | undefined; - entityType?: string | undefined; - className?: string | undefined; - fieldType?: import('../../data/models').FieldEnumList | undefined; - multilineCount?: number | undefined; - isUnique?: boolean | undefined; + }[]; + entityType: string; + className: string; + fieldType: import('../../data/models').FieldEnumList; + multilineCount: number; + isUnique: boolean; orderNumber: number; - isHidden?: boolean | undefined; + isHidden: boolean; customUpperCode: string; - validateRules: Record[]; + validateRules: Record[]; }[]; submitLoading: boolean; showEditForm: boolean; diff --git a/scripts/__dropins__/storefront-account/render.js b/scripts/__dropins__/storefront-account/render.js index 0075994d79..044ab12cf4 100644 --- a/scripts/__dropins__/storefront-account/render.js +++ b/scripts/__dropins__/storefront-account/render.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! 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"}); diff --git a/scripts/__dropins__/storefront-account/types/addresses.types.d.ts b/scripts/__dropins__/storefront-account/types/addresses.types.d.ts index 01798efb1d..dad05dd71f 100644 --- a/scripts/__dropins__/storefront-account/types/addresses.types.d.ts +++ b/scripts/__dropins__/storefront-account/types/addresses.types.d.ts @@ -1,4 +1,3 @@ -import { HTMLAttributes } from 'preact/compat'; import { CustomerAddressesModel } from '../data/models'; import { FieldsProps } from './form.types'; import { SlotProps } from '@dropins/tools/types/elsie/src/src/lib'; @@ -73,7 +72,8 @@ export interface AddressCardProps { handleRenderModal?: () => void | undefined; handleRenderForm?: () => void | undefined; } -export interface AddressActionsProps extends HTMLAttributes { +export interface AddressActionsProps { + className?: string; selectable?: boolean; minifiedView?: boolean; addNewAddress?: boolean; diff --git a/scripts/__dropins__/storefront-account/types/api/getAttributesForm.types.d.ts b/scripts/__dropins__/storefront-account/types/api/getAttributesForm.types.d.ts index b95291c5b5..0683ece75d 100644 --- a/scripts/__dropins__/storefront-account/types/api/getAttributesForm.types.d.ts +++ b/scripts/__dropins__/storefront-account/types/api/getAttributesForm.types.d.ts @@ -30,6 +30,10 @@ export interface ResponseAttributesFormItemsProps { label: string; value: string; }[]; + validate_rules: { + name: string; + value: string | number | boolean; + }[]; } export interface GetAttributesFormResponse { data: { diff --git a/scripts/__dropins__/storefront-account/types/api/getOrderHistoryList.types.d.ts b/scripts/__dropins__/storefront-account/types/api/getOrderHistoryList.types.d.ts index c8c9a468a3..540a0650fc 100644 --- a/scripts/__dropins__/storefront-account/types/api/getOrderHistoryList.types.d.ts +++ b/scripts/__dropins__/storefront-account/types/api/getOrderHistoryList.types.d.ts @@ -4,6 +4,8 @@ export interface PaymentMethodProps { name: string; } export interface ProductProps { + sku: string; + url_key: string; small_image: { url: string; }; @@ -39,6 +41,9 @@ export interface TotalProps { total_tax: AmountProps; total_shipping: AmountProps; discounts: DiscountProps[]; + total_giftcard: AmountProps; + subtotal_excl_tax: AmountProps; + subtotal_incl_tax: AmountProps; } export interface OrderProps { token: string; @@ -55,6 +60,8 @@ export interface OrderProps { total: TotalProps; status: string; id: string; + payment_method?: PaymentMethodProps[]; + shipments?: []; } export interface PageInfoProps { page_size: number; diff --git a/scripts/__dropins__/storefront-account/types/form.types.d.ts b/scripts/__dropins__/storefront-account/types/form.types.d.ts index ef57abf445..f79fc2bd93 100644 --- a/scripts/__dropins__/storefront-account/types/form.types.d.ts +++ b/scripts/__dropins__/storefront-account/types/form.types.d.ts @@ -1,7 +1,7 @@ import { SlotProps } from '@dropins/tools/types/elsie/src/src/lib'; import { AttributesFormModel, Country, FieldEnumList, RegionTransform } from '../data/models'; -export interface FieldsProps extends Omit { +export interface FieldsProps extends Omit { className?: string; fieldType: FieldEnumList; id: string; @@ -33,7 +33,7 @@ export interface FormProps { loading?: boolean; showFormLoader?: boolean; onSubmit?: (event: SubmitEvent, isValid: boolean) => Promise; - onChange?: (values: Record, inputValue: Record, event: Event) => void; + onChange?: (values: Record, inputValue: Record, event: Event) => void; setInputChange?: (values: Record) => void; } export interface useFormProps extends Omit { diff --git a/scripts/__dropins__/storefront-auth/api.js b/scripts/__dropins__/storefront-auth/api.js index 960a560c6b..7c52919bac 100644 --- a/scripts/__dropins__/storefront-auth/api.js +++ b/scripts/__dropins__/storefront-auth/api.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{c as f,a as g,g as n}from"./chunks/createCustomerAddress.js";import{g as x,a as d}from"./chunks/getCustomerToken.js";import{g as l}from"./chunks/getStoreConfig.js";import{r as u}from"./chunks/requestPasswordResetEmail.js";import{r as F}from"./chunks/resetPassword.js";import{r as Q}from"./chunks/revokeCustomerToken.js";import{c as H}from"./chunks/confirmEmail.js";import{r as v}from"./chunks/resendConfirmationEmail.js";import{c as A,i as P}from"./chunks/initialize.js";import{f as q,g as z,r as D,s as R,a as S,b as j}from"./chunks/network-error.js";import"./fragments.js";import"./chunks/setReCaptchaToken.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/fetch-graphql.js";export{A as config,H as confirmEmail,f as createCustomer,g as createCustomerAddress,q as fetchGraphQl,n as getAttributesForm,z as getConfig,x as getCustomerData,d as getCustomerToken,l as getStoreConfig,P as initialize,D as removeFetchGraphQlHeader,u as requestPasswordResetEmail,v as resendConfirmationEmail,F as resetPassword,Q as revokeCustomerToken,R as setEndpoint,S as setFetchGraphQlHeader,j as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-auth/chunks/Button2.js b/scripts/__dropins__/storefront-auth/chunks/Button2.js index 3588745db9..d27c3fa659 100644 --- a/scripts/__dropins__/storefront-auth/chunks/Button2.js +++ b/scripts/__dropins__/storefront-auth/chunks/Button2.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as E,Fragment as Z,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{useState as R,useCallback as L,useRef as H,useEffect as P}from"@dropins/tools/preact-hooks.js";import*as f from"@dropins/tools/preact-compat.js";import{memo as W,useCallback as _}from"@dropins/tools/preact-compat.js";import{initReCaptcha as G}from"@dropins/tools/recaptcha.js";import{useText as j}from"@dropins/tools/i18n.js";import{classes as M}from"@dropins/tools/lib.js";import{Field as w,Picker as q,Input as C,InputDate as X,Checkbox as z,TextArea as B,Button as g}from"@dropins/tools/components.js";/* empty css */const Ir=r=>{if(!r)return null;const t=new FormData(r);if(t&&typeof t.entries=="function"){const o=t.entries();if(o&&typeof o[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(o)))||{}}return{}},Dr=r=>typeof r=="function",J=r=>f.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},f.createElement("g",{clipPath:"url(#clip0_841_1324)"},f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),f.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"})),f.createElement("defs",null,f.createElement("clipPath",{id:"clip0_841_1324"},f.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),Y=r=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},f.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"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),K=r=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},f.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"}),f.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"})),Q={success:E(Y,{}),warning:E(J,{}),error:E(K,{})},xr=()=>{const[r,t]=R({}),o=L(s=>{if(!s||!s.type){t({});return}const c=Q[s.type];t({...s,icon:c})},[]);return{inLineAlertProps:r,handleSetInLineAlertProps:o}};var v=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(v||{});const rr=W(({loading:r,values:t,fields:o=[],errors:s,className:c="",onChange:d,onBlur:p,onFocus:A})=>{const l=`${c}__field`,$=_((e,n,a)=>{var T;const h=(T=e.options.find(N=>N.isDefault))==null?void 0:T.value;return E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:E(q,{name:e.customUpperCode,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:d,defaultValue:h??n??e.defaultValue,value:h??n??e.defaultValue})},e.id)},[c,r,l,p,d]),m=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(C,{type:"text",name:e.customUpperCode,value:n??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d,onFocus:A})},e.id),[c,r,l,p,d,A]),I=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r||e.disabled,children:E(X,{type:"text",name:e.customUpperCode,value:n||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d,disabled:r||e.disabled})},e.id),[c,r,l,p,d]),x=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(z,{name:e.customUpperCode,checked:n||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[c,r,l,p,d]),D=_((e,n,a)=>E(w,{error:a,className:M([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${c}--${e.id}`,disabled:r,children:E(B,{type:"text",name:e.customUpperCode,value:n??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:d})},e.id),[c,r,l,p,d]);return o.length?E(Z,{children:o.map(e=>{const n=s==null?void 0:s[e.customUpperCode],a=t==null?void 0:t[e.customUpperCode];switch(e.fieldType){case v.TEXT:return e.options.length?$(e,a,n):m(e,a,n);case v.MULTILINE:return m(e,a,n);case v.SELECT:return $(e,a,n);case v.DATE:return I(e,a,n);case v.BOOLEAN:return x(e,a,n);case v.TEXTAREA:return D(e,a,n);default:return null}})}):null}),er=r=>r.reduce((t,{customUpperCode:o,required:s,defaultValue:c})=>(s&&o&&(t.initialData[o]=c||"",t.errorList[o]=""),t),{initialData:{},errorList:{}}),tr=r=>r.reduce((t,o)=>({...t,[o.name]:o.value}),{}),ar=r=>/^\d+$/.test(r),nr=r=>/^[a-zA-Z0-9\s]+$/.test(r),or=r=>/^[a-zA-Z0-9]+$/.test(r),sr=r=>/^[a-zA-Z]+$/.test(r),lr=r=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(r),cr=r=>/^\d{4}-\d{2}-\d{2}$/.test(r)&&!isNaN(Date.parse(r)),ur=(r,t,o)=>{const s=new Date(r).getTime()/1e3;return!(isNaN(s)||s<0||typeof t<"u"&&so)},k=r=>{if(!r||r.trim()==="")return"";const t=parseInt(r,10);if(!isNaN(t)){const c=new Date(t*1e3);return isNaN(c.getTime())?"":c.toISOString().split("T")[0]}const o=new Date(r);if(isNaN(o.getTime()))return"";const s=parseInt(r.split("-")[1],10);return s>12||s<1?"":o.toISOString().split("T")[0]},dr=r=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(r),ir=(r,t,o)=>{const s=r.length;return s>=t&&s<=o},O=(r,t,o,s)=>{var F,y;const{requiredFieldError:c,lengthTextError:d,numericError:p,alphaNumWithSpacesError:A,alphaNumericError:l,alphaError:$,emailError:m,dateError:I,urlError:x,dateLengthError:D,dateMaxError:e,dateMinError:n}=o,a=t==null?void 0:t.customUpperCode,h={[a]:""};if(s[a]&&delete s[a],t!=null&&t.required&&!r)return{[a]:c};if(!(t!=null&&t.required)&&!r||!((F=t==null?void 0:t.validateRules)!=null&&F.length))return h;const T=tr(t==null?void 0:t.validateRules),N=T.MIN_TEXT_LENGTH??1,b=T.MAX_TEXT_LENGTH??255,u=T.DATE_RANGE_MIN,i=T.DATE_RANGE_MAX;if(!ir(r,+N,+b)&&!(u||i))return{[a]:d.replace("{min}",N).replace("{max}",b)};if(!ur(r,+u,+i)&&(u||i)){if(u&&u)return{[a]:D.replace("{min}",k(u)).replace("{max}",k(i))};if(typeof u>"u"||typeof i>"u")return{[a]:i?e.replace("{max}",k(i)):n.replace("{min}",k(u))}}const V={numeric:{validate:ar,error:p},"alphanum-with-spaces":{validate:nr,error:A},alphanumeric:{validate:or,error:l},alpha:{validate:sr,error:$},email:{validate:lr,error:m},date:{validate:cr,error:I},url:{validate:dr,error:x}}[T.INPUT_VALIDATION];return V&&!V.validate(r)&&!((y=s[a])!=null&&y.length)?{[a]:V.error}:h},pr=["auth-reset-password-form__buttons--signin","auth-sign-up-form-buttons--signin","auth-sign-in-form__button--forgot","auth-sign-in-form__button--signup"],hr=({fieldsConfig:r,onSubmit:t})=>{const o=j({requiredFieldError:"Auth.FormText.requiredFieldError",lengthTextError:"Auth.FormText.lengthTextError",numericError:"Auth.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Auth.FormText.alphaNumericError",alphaError:"Auth.FormText.alphaError",emailError:"Auth.FormText.emailError",dateError:"Auth.FormText.dateError",dateLengthError:"Auth.FormText.dateLengthError",dateMaxError:"Auth.FormText.dateMaxError",dateMinError:"Auth.FormText.dateMinError",urlError:"Auth.FormText.urlError"}),s=H(null),c=H(!1),[d,p]=R({}),[A,l]=R({}),$=L(()=>{let e=!0;const n={...A};let a=null;for(const[h,T]of Object.entries(d)){const N=r==null?void 0:r.find(u=>{var i;return(i=u==null?void 0:u.customUpperCode)==null?void 0:i.includes(h)}),b=O(T.toString(),N,o,n);b[h]&&(Object.assign(n,b),e=!1),a||(a=Object.keys(n).find(u=>n[u])??null)}if(l(n),a&&s.current){const h=s.current.elements.namedItem(a);h==null||h.focus()}return e},[A,r,d,o]);P(()=>{if(r!=null&&r.length){const{initialData:e,errorList:n}=er(r);p(a=>({...e,...a})),l(n)}},[JSON.stringify(r)]);const m=L(async e=>{const n=e.target,a=!pr.some(h=>n.classList.contains(h));!c.current&&a&&(await G(0),c.current=!0)},[]),I=L(e=>{const{name:n,value:a,type:h,checked:T}=e==null?void 0:e.target,N=h==="checkbox"?T:a;p(i=>({...i,[n]:N}));const b=r==null?void 0:r.find(i=>{var S;return(S=i==null?void 0:i.customUpperCode)==null?void 0:S.includes(n)});let u={...A};if(b){const i=O(N.toString(),b,o,u);i&&Object.assign(u,i),l(u)}},[r,A,o]),x=L(e=>{const{name:n,value:a,type:h,checked:T}=e==null?void 0:e.target,N=h==="checkbox"?T:a,b=r==null?void 0:r.find(u=>u.customUpperCode===n);if(b){const u={...A},i=O(N.toString(),b,o,u);i&&Object.assign(u,i),l(u)}},[A,r,o]),D=L(e=>{e.preventDefault();const n=$();t==null||t(e,n)},[$,t]);return{formData:d,errors:A,formRef:s,handleChange:I,handleBlur:x,handleSubmit:D,handleFocus:m}},vr=({name:r,loading:t,children:o,className:s="defaultForm",fieldsConfig:c=[],onSubmit:d,...p})=>{const{formData:A,errors:l,formRef:$,handleChange:m,handleBlur:I,handleSubmit:x,handleFocus:D}=hr({onSubmit:d,fieldsConfig:c});return U("form",{className:s,onSubmit:x,name:r,ref:$,onFocus:D,...p,children:[E(rr,{className:s,onFocus:D,fields:c,onChange:m,onBlur:I,errors:l,values:A,loading:t}),o]})},Lr=({type:r,buttonText:t,variant:o,className:s="",enableLoader:c=!1,onClick:d,style:p,icon:A,...l})=>{const $=L(I=>{d==null||d(I)},[d]);return U(g,{icon:A,style:p,type:r,variant:o,className:M(["auth-button",s,c?"enableLoader":""]),onClick:$,...l,children:[E("span",{className:"auth-button__text",children:t}),c?E("div",{className:"auth-button__wrapper",children:E("span",{className:"auth-button__loader"})}):null]})};export{Lr as B,vr as F,Dr as c,Ir as g,xr as u}; diff --git a/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js b/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js index 7a41f8862b..542b498ca4 100644 --- a/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/ResetPasswordForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as h}from"./requestPasswordResetEmail.js";import{g as _,c as w,u as F,F as P,B as p}from"./Button2.js";import{useState as x,useCallback as g}from"@dropins/tools/preact-hooks.js";import{useText as R}from"@dropins/tools/i18n.js";import{Header as N,InLineAlert as v}from"@dropins/tools/components.js";import{s as E,D as L}from"./simplifyTransformAttributesForm.js";import*as y from"@dropins/tools/preact-compat.js";const T=t=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),D=({routeSignIn:t,onErrorCallback:a,setActiveComponent:m,handleSetInLineAlertProps:s})=>{const n=R({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[r,e]=x(!1),d=g(async u=>{u.preventDefault(),e(!0);const i=_(u.target);if(i&&i.email){const f=await h(i.email);f.success?s==null||s({type:"success",text:n.successPasswordResetEmailNotification.replace("{email}",i.email)}):(a==null||a(f),s==null||s({type:"error",text:f.message}))}e(!1)},[s,a,n.successPasswordResetEmailNotification]),c=g(()=>{if(w(m)){m("signInForm");return}w(t)&&(window.location.href=t())},[m,t]);return{isLoading:r,submitResetPassword:d,redirectToSignInPage:c}},$=({formSize:t="default",routeSignIn:a,setActiveComponent:m,onErrorCallback:s,...n})=>{const r=R({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:d}=F(),{isLoading:c,submitResetPassword:u,redirectToSignInPage:i}=D({routeSignIn:a,setActiveComponent:m,onErrorCallback:s,handleSetInLineAlertProps:d});return l("div",{...n,className:b(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[o(N,{title:r.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(v,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(P,{"aria-labelledby":r.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:u,loading:c,fieldsConfig:E(L),children:l("div",{className:"auth-reset-password-form__buttons",children:[o(p,{className:"auth-reset-password-form__buttons--signin",type:"button",variant:"tertiary",style:{padding:"0"},icon:o(T,{style:{transform:"rotate(90deg)"}}),buttonText:r.buttonSecondary,enableLoader:!1,onClick:i}),o(p,{type:"submit",buttonText:r.buttonPrimary,variant:"primary",enableLoader:c})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{$ as R}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SignInForm.js b/scripts/__dropins__/storefront-auth/chunks/SignInForm.js index bdcc184eae..7154fbb7d5 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SignInForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/SignInForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as c,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as z,classes as R}from"@dropins/tools/lib.js";import{c as E,g as tt,u as rt,F as at,B as K}from"./Button2.js";import{useState as y,useCallback as m,useEffect as J,useMemo as et}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{a as ot}from"./getCustomerToken.js";import{r as it}from"./resendConfirmationEmail.js";import{s as st,a as nt}from"./simplifyTransformAttributesForm.js";import{f as ut,E as ct}from"./focusOnEmptyPasswordField.js";import{c as mt}from"./confirmEmail.js";import{useText as O}from"@dropins/tools/i18n.js";import{Header as ft,InLineAlert as dt,InputPassword as lt}from"@dropins/tools/components.js";/* empty css */const ht=({emailConfirmationStatusMessage:t,translations:e,initialEmailValue:s,routeSignUp:l,routeForgotPassword:u,routeRedirectOnSignIn:F,onErrorCallback:_,setActiveComponent:a,onSuccessCallback:f,onSignUpLinkClick:h,handleSetInLineAlertProps:i,routeRedirectOnEmailConfirmationClose:x})=>{const[S,L]=y(""),[v,n]=y(!1),[g,d]=y(""),[A,w]=y(!1),[U,j]=y({userName:"",status:!1}),[q,T]=y(!1),[P,N]=y([]),k=m(async r=>{i(),n(!0),w(!1),N([]),await it(r)},[i]),V=m(r=>{r.length?w(!1):w(!0),d(r)},[]);J(()=>{t!=null&&t.text&&i({text:t.text,type:t.status?t.status:void 0})},[t,i]);const D=m(()=>{g.length||w(!0)},[g]),p=m((r,o)=>g.length?!1:(w(!0),o&&ut(r,g,""),!0),[g]),B=m((r,o)=>{o!=null&&o.userName&&(r.target.reset(),E(F)?window.location.href=F():(f==null||f({userName:o==null?void 0:o.userName,status:!0}),j({userName:o==null?void 0:o.userName,status:!0})))},[f,F]),C=m((r,o)=>{var I;if((I=r==null?void 0:r.errorMessage)!=null&&I.length){L(o);const H=r.errorMessage.includes("This account isn't confirmed. Verify and try again."),b=H?e.resendEmailInformationText:r.errorMessage;N(H?[{label:e.resendEmailButtonText,onClick:()=>{k(o)}}]:[]),i({text:b,type:"error"}),d("")}},[k,i,e.resendEmailButtonText,e.resendEmailInformationText]),G=m(async(r,o)=>{if(i(),p(r,o))return;T(!0);const I=tt(r.target);if(Object.values(I).every(b=>b)){const{email:b,password:Z}=I,$=await ot({email:b,password:Z,handleSetInLineAlertProps:i,onErrorCallback:_,translations:e});C($,b),B(r,$),w(!1)}T(!1)},[e,_,p,C,B,i]),Q=m(()=>{if(E(a)){a("resetPasswordForm");return}E(u)&&(window.location.href=u())},[u,a]),W=m(()=>{if(E(h)&&h(),E(a)){a("signUpForm");return}E(l)&&(window.location.href=l())},[h,l,a]),X=et(()=>{const r=st(nt);return s!=null&&s.length?r==null?void 0:r.map(o=>({...o,defaultValue:s})):r},[s]),Y=m(()=>{i(),E(x)?window.location.href=x():n(!1)},[i,x]);return{additionalActionsAlert:P,userEmail:S,defaultEnhancedEmailFields:X,passwordError:A,isSuccessful:U,isLoading:q,signInPasswordValue:g,showEmailConfirmationForm:v,setShowEmailConfirmationForm:n,setSignInPasswordValue:d,submitLogInUser:G,forgotPasswordCallback:Q,onSignUpLinkClickCallback:W,handledOnPrimaryButtonClick:Y,handleSetPassword:V,onBlurPassword:D}},gt=()=>{let t=new URL(window.location.href),e=t.searchParams.get("email"),s=t.searchParams.get("key");e&&s&&(t.searchParams.delete("email"),t.searchParams.delete("key"),window.history.replaceState({},document.title,t.toString()))},wt=({enableEmailConfirmation:t})=>{const e=O({accountConfirmMessage:"Auth.EmailConfirmationForm.accountConfirmMessage",accountConfirmationEmailSuccessMessage:"Auth.EmailConfirmationForm.accountConfirmationEmailSuccessMessage"}),[s,l]=y({text:"",status:""});return J(()=>{if(t){const{search:u}=window.location;u.includes("email=")&&u.includes("key=")&&(async()=>{var f,h,i;const _=new URLSearchParams(u),a=await mt({customerEmail:_.get("email"),customerConfirmationKey:_.get("key")});if(!a)return null;(f=a==null?void 0:a.errors)!=null&&f.length?l({text:a==null?void 0:a.errors[0].message,status:"error"}):(l({text:a.data.confirmEmail.customer.email?e.accountConfirmationEmailSuccessMessage.replace("{email}",(i=(h=a==null?void 0:a.data)==null?void 0:h.confirmEmail.customer)==null?void 0:i.email):e.accountConfirmMessage,status:"success"}),gt())})()}},[t,e]),{emailConfirmationStatusMessage:s}},Ct=({slots:t,labels:e,formSize:s="default",initialEmailValue:l="",renderSignUpLink:u=!1,enableEmailConfirmation:F=!1,hideCloseBtnOnEmailConfirmation:_=!1,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:f,routeForgotPassword:h,routeSignUp:i,onSuccessCallback:x,setActiveComponent:S,onErrorCallback:L,onSignUpLinkClick:v})=>{const n=O({title:"Auth.SignInForm.title",buttonPrimary:"Auth.SignInForm.buttonPrimary",buttonSecondary:"Auth.SignInForm.buttonSecondary",buttonTertiary:"Auth.SignInForm.buttonTertiary",resendEmailInformationText:"Auth.Notification.resendEmailNotification.informationText",resendEmailButtonText:"Auth.Notification.resendEmailNotification.buttonText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError"}),{emailConfirmationStatusMessage:g}=wt({enableEmailConfirmation:F}),{inLineAlertProps:d,handleSetInLineAlertProps:A}=rt(),{userEmail:w,additionalActionsAlert:U,defaultEnhancedEmailFields:j,passwordError:q,isSuccessful:T,isLoading:P,signInPasswordValue:N,showEmailConfirmationForm:k,submitLogInUser:V,forgotPasswordCallback:D,onSignUpLinkClickCallback:p,handledOnPrimaryButtonClick:B,handleSetPassword:C,onBlurPassword:G}=ht({translations:n,emailConfirmationStatusMessage:g,initialEmailValue:l,routeSignUp:i,routeForgotPassword:h,routeRedirectOnSignIn:f,setActiveComponent:S,onErrorCallback:L,onSuccessCallback:x,onSignUpLinkClick:v,handleSetInLineAlertProps:A,routeRedirectOnEmailConfirmationClose:a});return T.status&&(t!=null&&t.SuccessNotification)?c(z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:t==null?void 0:t.SuccessNotification,context:{isSuccessful:T}}):k?c(ct,{formSize:s,userEmail:w,inLineAlertProps:d,hideCloseBtnOnEmailConfirmation:_,handleSetInLineAlertProps:A,onPrimaryButtonClick:B}):M("div",{className:R(["auth-sign-in-form",`auth-sign-in-form--${s}`]),"data-testid":"signInForm",children:[c(ft,{title:(e==null?void 0:e.formTitleText)??n.title,divider:!1,className:"auth-sign-in-form__title"}),d.text?c(dt,{"data-testid":"authInLineAlert",className:"auth-sign-in-form__notification",type:d.type,variant:"secondary",heading:d.text,icon:d.icon,additionalActions:U}):null,M(at,{name:"signIn_form",className:"auth-sign-in-form__form",onSubmit:V,loading:P,fieldsConfig:j,children:[c(lt,{hideStatusIndicator:!0,className:"auth-sign-in-form__form__password",autoComplete:"current-password",errorMessage:q?n.requiredFieldError:void 0,defaultValue:N,onValue:C,onBlur:G,placeholder:n.placeholder,floatingLabel:n.floatingLabel}),M("div",{className:"auth-sign-in-form__form__buttons",children:[M("div",{className:"auth-sign-in-form__form__buttons__combine",children:[c(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonTertiary,className:"auth-sign-in-form__button auth-sign-in-form__button--forgot",enableLoader:!1,onClick:D,"data-testid":"switchToSignUp"}),u?c("span",{}):null,u?c(K,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,className:"auth-sign-in-form__button auth-sign-in-form__button--signup",enableLoader:!1,onClick:p}):null]}),c(K,{type:"submit",buttonText:(e==null?void 0:e.primaryButtonText)??n.buttonPrimary,variant:"primary",className:"auth-sign-in-form__button auth-sign-in-form__button--submit",enableLoader:P})]})]}),c("div",{id:"generateCustomerToken"})]})};export{Ct as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js index 126389c5c1..27be8b1bed 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/SignUpForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as n,jsxs as I}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Ee,classes as Ne}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as ye,c as Ue,a as Le}from"./createCustomerAddress.js";import{useState as p,useEffect as Me,useCallback as x,useMemo as Te}from"@dropins/tools/preact-hooks.js";import{s as de,b as xe}from"./simplifyTransformAttributesForm.js";import{v as Se,u as ve,a as qe}from"./usePasswordValidationMessage.js";import{a as Ce}from"./getCustomerToken.js";import{p as le,E as ce}from"./getStoreConfig.js";import{c as $,g as Ae,u as Be,F as Ke,B as fe}from"./Button2.js";import{c as je}from"./transform-attributes-form.js";import{f as he,E as Ie}from"./focusOnEmptyPasswordField.js";import{Header as Ge,InLineAlert as He,InputPassword as ge,Field as te,Checkbox as se}from"@dropins/tools/components.js";/* empty css */import{S as Ve}from"./SkeletonLoader.js";import{useText as We}from"@dropins/tools/i18n.js";const pe=(u,t)=>t!=null&&t.length?u.map(e=>{var d;const s=(d=t.find(({code:m})=>m===e.code))==null?void 0:d.defaultValue;return s?{...e,defaultValue:s}:e}):u,$e=({inputsDefaultValueSet:u,fieldsConfigForApiVersion1:t,apiVersion2:e})=>{const[s,d]=p([]);return Me(()=>{(async()=>{if(e){const i=await ye("customer_account_create");if(i!=null&&i.length)if(u!=null&&u.length){const w=pe(i,u);d(w)}else d(i)}else{const i=de(xe),w=de(t),N=pe(i,u);d(t&&t.length?w:N)}})()},[e,t,u]),{fieldsListConfigs:s}},Oe=(u,t)=>{const e=["dob","email","firstname","gender","is_subscribed","lastname","middlename","password","prefix","suffix","taxvat"],s=je(u,"snakeCase",{firstName:"firstname",lastName:"lastname"});if(!t)return{...s,...s!=null&&s.gender?{gender:Number(s==null?void 0:s.gender)}:{}};const d={},m=[];return Object.keys(s).forEach(i=>{e.includes(i)?d[i]=i.includes("gender")?Number(s[i]):s[i]:m.push({attribute_code:i,value:s[i]})}),m.length>0&&(d.custom_attributes=m),d},Je=({requireRetypePassword:u,addressesData:t,translations:e,isEmailConfirmationRequired:s,apiVersion2:d=!0,passwordConfigs:m,isAutoSignInEnabled:i,routeRedirectOnSignIn:w,routeSignIn:N,onErrorCallback:S,onSuccessCallback:h,setActiveComponent:b,handleSetInLineAlertProps:P,routeRedirectOnEmailConfirmationClose:q})=>{const[O,C]=p(!1),[o,a]=p(""),[g,l]=p(""),[G,y]=p(""),[H,A]=p(!1),[J,B]=p({userName:"",status:!1}),[c,K]=p(""),[Q,V]=p(!1),[X,U]=p(!1),[W,Y]=p(!0),Z=x(r=>{const f=r.target.value;C(!f.length),f.length&&o.length&&f!==o&&l(e.passwordMismatch)},[o,e.passwordMismatch]),k=x(r=>{const f=r.target.value;l(f.length?"":e.requiredFieldError),f.length&&c.length&&f!==c&&l(e.passwordMismatch)},[c,e.passwordMismatch,e.requiredFieldError]),z=x(r=>{a(r),l(r?c===r?"":e.passwordMismatch:e.requiredFieldError)},[e,c]),D=x(({target:r})=>{Y(r.checked)},[]),R=x(()=>{if($(b)){b("signInForm");return}$(N)&&(window.location.href=N())},[b,N]),ee=x(r=>{K(r),C(!r.length),r===o&&l("")},[o]),re=x(()=>{P(),K(""),$(q)?window.location.href=q():(A(!1),b==null||b("signInForm"))},[P,q,b]),L=()=>{V(!0),U(!1)},_=(r,f)=>{const oe=c.length&&o.length,j=c!==o,v=()=>{C(!c.length),o||l(e.requiredFieldError),oe&&j&&l(e.passwordMismatch)},M=()=>{l(o.length?e.passwordMismatch:e.requiredFieldError),he(r,c,o)};return f?u&&(g.length||j)?(L(),M(),!0):(he(r,c,""),v(),!1):(L(),v(),!0)};return{showPasswordErrorMessage:O,confirmPassword:o,confirmPasswordMessage:g,isKeepMeLogged:W,userEmail:G,showEmailConfirmationForm:H,isSuccessful:J,isClickSubmit:Q,signUpPasswordValue:c,isLoading:X,onSubmitSignUp:async(r,f)=>{var ae,ne,me;if(P(),l(""),U(!0),_(r,f))return;const{confirmPasswordField:oe,...j}=Ae(r.target),{email:v,password:M,is_subscribed:Fe}=j,we=(m==null?void 0:m.requiredCharacterClasses)||0,be=(m==null?void 0:m.minLength)||1;if(!Se(M,we)||be>(M==null?void 0:M.length)){L();return}const Pe=Oe({...j,is_subscribed:!!Fe||!1},d),F=await Ue(Pe,d);if((ae=F==null?void 0:F.errors)!=null&&ae.length){const{errors:T}=F;P==null||P({type:"error",text:(ne=T[0])==null?void 0:ne.message}),S==null||S(T),le(ce.CREATE_ACCOUNT_EVENT,{updateProfile:!1}),y(v)}else{const T=F==null?void 0:F.firstName;if(le(ce.CREATE_ACCOUNT_EVENT,{email:F==null?void 0:F.email,updateProfile:!0}),s||!i){if(h==null||h({userName:T,status:!0}),s){(me=r.target)==null||me.reset(),K(""),A(!0),y(v),U(!1);return}if(!i){U(!1),B({userName:T,status:!0});return}}const E=await Ce({email:v,password:M,translations:e,handleSetInLineAlertProps:P,onErrorCallback:S});if(E!=null&&E.userName){if(t!=null&&t.length)for(const ue of t)try{await Le(ue)}catch(_e){console.error(e.failedCreateCustomerAddress,ue,_e)}$(w)?window.location.href=w():(h==null||h({userName:E==null?void 0:E.userName,status:!0}),B({userName:E==null?void 0:E.userName,status:!0}))}else h==null||h({userName:T,status:!0}),B({userName:T,status:!0})}U(!1)},signInButton:R,handleSetSignUpPasswordValue:ee,onKeepMeLoggedChange:D,handleHideEmailConfirmationForm:re,handleConfirmPasswordChange:z,onBlurPassword:Z,onBlurConfirmPassword:k}},ur=({requireRetypePassword:u=!1,addressesData:t,formSize:e="default",inputsDefaultValueSet:s,fieldsConfigForApiVersion1:d,apiVersion2:m=!0,isAutoSignInEnabled:i=!0,displayTermsOfUseCheckbox:w=!1,displayNewsletterCheckbox:N=!1,hideCloseBtnOnEmailConfirmation:S=!1,routeRedirectOnEmailConfirmationClose:h,routeRedirectOnSignIn:b,routeSignIn:P,onErrorCallback:q,onSuccessCallback:O,setActiveComponent:C,slots:o})=>{const a=We({title:"Auth.SignUpForm.title",buttonPrimary:"Auth.SignUpForm.buttonPrimary",buttonSecondary:"Auth.SignUpForm.buttonSecondary",privacyPolicyDefaultText:"Auth.SignUpForm.privacyPolicyDefaultText",subscribedDefaultText:"Auth.SignUpForm.subscribedDefaultText",keepMeLoggedText:"Auth.SignUpForm.keepMeLoggedText",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage",failedCreateCustomerAddress:"Auth.SignUpForm.failedCreateCustomerAddress",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError",confirmPasswordPlaceholder:"Auth.SignUpForm.confirmPassword.placeholder",confirmPasswordFloatingLabel:"Auth.SignUpForm.confirmPassword.floatingLabel",passwordMismatch:"Auth.SignUpForm.confirmPassword.passwordMismatch"}),{passwordConfigs:g,isEmailConfirmationRequired:l}=ve(),{fieldsListConfigs:G}=$e({fieldsConfigForApiVersion1:d,apiVersion2:m,inputsDefaultValueSet:s}),{inLineAlertProps:y,handleSetInLineAlertProps:H}=Be(),{showPasswordErrorMessage:A,confirmPassword:J,confirmPasswordMessage:B,isKeepMeLogged:c,userEmail:K,showEmailConfirmationForm:Q,isSuccessful:V,isClickSubmit:X,signUpPasswordValue:U,isLoading:W,onSubmitSignUp:Y,signInButton:Z,handleSetSignUpPasswordValue:k,onKeepMeLoggedChange:z,handleHideEmailConfirmationForm:D,handleConfirmPasswordChange:R,onBlurPassword:ee,onBlurConfirmPassword:re}=Je({requireRetypePassword:u,addressesData:t,translations:a,isEmailConfirmationRequired:l,apiVersion2:m,passwordConfigs:g,isAutoSignInEnabled:i,routeRedirectOnSignIn:b,routeSignIn:P,onErrorCallback:q,onSuccessCallback:O,setActiveComponent:C,handleSetInLineAlertProps:H,routeRedirectOnEmailConfirmationClose:h}),{isValidUniqueSymbols:L,defaultLengthMessage:_}=qe({password:U,isClickSubmit:X,passwordConfigs:g}),ie=Te(()=>A?a.requiredFieldError:L==="error"||(_==null?void 0:_.status)==="error"?" ":"",[_==null?void 0:_.status,L,A,a.requiredFieldError]),r=!l&&(t==null?void 0:t.length);return!G.length&&m?n("div",{className:`auth-sign-up-form auth-sign-up-form--${e} skeleton-loader`,"data-testid":"SignUpForm",children:n(Ve,{activeSkeleton:"signUpForm"})}):V.status&&(o!=null&&o.SuccessNotification)?n(Ee,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:o==null?void 0:o.SuccessNotification,context:{isSuccessful:V}}):Q?n(Ie,{formSize:e,userEmail:K,inLineAlertProps:y,hideCloseBtnOnEmailConfirmation:S,handleSetInLineAlertProps:H,onPrimaryButtonClick:D}):I("div",{className:Ne(["auth-sign-up-form",`auth-sign-up-form--${e}`]),"data-testid":"SignUpForm",children:[n(Ge,{title:a.title,divider:!1,className:"auth-sign-up-form__title"}),y.text?n(He,{className:"auth-sign-up-form__notification",type:y.type,variant:"secondary",heading:y.text,icon:y.icon}):null,I(Ke,{onSubmit:Y,className:"auth-sign-up-form__form",loading:W,name:"signUp_form",fieldsConfig:G,children:[I(ge,{validateLengthConfig:_,className:"auth-sign-up-form__form__field",autoComplete:"current-password",name:"password",minLength:g==null?void 0:g.minLength,errorMessage:ie,defaultValue:U,uniqueSymbolsStatus:L,requiredCharacterClasses:g==null?void 0:g.requiredCharacterClasses,onValue:k,placeholder:a.placeholder,floatingLabel:a.floatingLabel,onBlur:ee,children:[u?n("div",{className:"auth-sign-up-form__form__confirm-wrapper",children:n(ge,{className:"auth-sign-up-form__form__field auth-sign-up-form__form__field--confirm-password",autoComplete:"confirmPassword",name:"confirmPasswordField",placeholder:a.confirmPasswordPlaceholder,floatingLabel:a.confirmPasswordFloatingLabel,errorMessage:B,defaultValue:J,onValue:R,onBlur:re})}):null,r?n("div",{className:"auth-sign-up-form__automatic-login","data-testid":"automaticLogin",children:n(te,{children:n(se,{name:"",placeholder:a.keepMeLoggedText,label:a.keepMeLoggedText,checked:c,onChange:z})})}):null]}),N||w?I("div",{className:"auth-sign-up-form__item auth-sign-up-form__checkbox",children:[N?n(te,{children:n(se,{"data-testid":"isSubscribed",name:"is_subscribed",placeholder:a.subscribedDefaultText,label:a.subscribedDefaultText})}):null,w?n(te,{children:n(se,{"data-testid":"privacyPolicy",name:"privacyPolicy",placeholder:a.privacyPolicyDefaultText,label:a.privacyPolicyDefaultText})}):null]}):null,I("div",{className:"auth-sign-up-form-buttons",children:[n(fe,{className:"auth-sign-up-form-buttons--signin",type:"button",variant:"tertiary",style:{padding:0},buttonText:a.buttonSecondary,enableLoader:!1,onClick:Z}),n(fe,{type:"submit",buttonText:a.buttonPrimary,variant:"primary",enableLoader:W})]})]}),n("div",{id:"createCustomerV2"})]})};export{ur as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js b/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js index 6bdfef8665..bc569b6709 100644 --- a/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js +++ b/scripts/__dropins__/storefront-auth/chunks/SkeletonLoader.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as l,jsx as e,Fragment as r}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as s}from"@dropins/tools/preact-hooks.js";import{Skeleton as a,SkeletonRow as i}from"@dropins/tools/components.js";const d=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),h=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),u=()=>l(a,{children:[e(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})," ",e(i,{variant:"heading",size:"medium",fullWidth:!1,lines:1})]}),o=({activeSkeleton:n})=>{const t=s(()=>({signInForm:e(h,{}),signUpForm:e(d,{}),resetPasswordForm:e(u,{})}),[]);return e(r,{children:t[n]})};export{o as S}; diff --git a/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js b/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js index c422fff4b9..0995e841bd 100644 --- a/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/confirmEmail.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{f as o,h as r}from"./network-error.js";const t=` mutation CONFIRM_EMAIL($email: String!, $confirmation_key: String!) { diff --git a/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js b/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js index 44a8ded8e8..61b4b451b8 100644 --- a/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js +++ b/scripts/__dropins__/storefront-auth/chunks/createCustomerAddress.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{CUSTOMER_INFORMATION_FRAGMENT as N}from"../fragments.js";import{f as m,h as u}from"./network-error.js";import{s as I}from"./setReCaptchaToken.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{merge as U}from"@dropins/tools/lib.js";import{c as g}from"./initialize.js";import{t as $}from"./transform-attributes-form.js";import{h as F}from"./getStoreConfig.js";const v=` mutation CREATE_CUSTOMER($input: CustomerInput!) { diff --git a/scripts/__dropins__/storefront-auth/chunks/focusOnEmptyPasswordField.js b/scripts/__dropins__/storefront-auth/chunks/focusOnEmptyPasswordField.js index ac90985b60..9a15145840 100644 --- a/scripts/__dropins__/storefront-auth/chunks/focusOnEmptyPasswordField.js +++ b/scripts/__dropins__/storefront-auth/chunks/focusOnEmptyPasswordField.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as c,jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{InLineAlert as y,Header as p}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as C}from"./resendConfirmationEmail.js";import{useState as x,useCallback as E}from"@dropins/tools/preact-hooks.js";import{useText as u}from"@dropins/tools/i18n.js";/* empty css */import{B as f}from"./Button2.js";const g=({userEmail:o,handleSetInLineAlertProps:t})=>{const a=u({emailConfirmationMessage:"Auth.Notification.emailConfirmationMessage",technicalErrorSendEmail:"Auth.Notification.technicalErrors.technicalErrorSendEmail"}),[r,e]=x(!1);return{handleEmailConfirmation:E(async()=>{var n,s;if(e(!0),o){const i=await C(o);if(i){const d=(n=i==null?void 0:i.errors)==null?void 0:n.length,h=(s=i==null?void 0:i.data)==null?void 0:s.resendConfirmationEmail;t(d?{type:"error",text:a.technicalErrorSendEmail}:{type:h?"success":"error",text:a.emailConfirmationMessage})}}e(!1)},[t,a,o]),disabledButton:r}},I=({formSize:o,userEmail:t,inLineAlertProps:a,hideCloseBtnOnEmailConfirmation:r,handleSetInLineAlertProps:e,onPrimaryButtonClick:l})=>{const n=u({title:"Auth.EmailConfirmationForm.title",subtitle:"Auth.EmailConfirmationForm.subtitle",mainText:"Auth.EmailConfirmationForm.mainText",buttonPrimary:"Auth.EmailConfirmationForm.buttonPrimary",buttonSecondary:"Auth.EmailConfirmationForm.buttonSecondary"}),{handleEmailConfirmation:s,disabledButton:i}=g({userEmail:t,handleSetInLineAlertProps:e});return c("div",{className:b(["auth-email-confirmation-form",`auth-email-confirmation-form--${o}`]),children:[a.text?m(y,{className:"auth-signInForm__notification",type:a.type,variant:"secondary",heading:a.text,icon:a.icon,"data-testid":"authInLineAlert"}):null,m(p,{title:n.title,divider:!1,className:"auth-email-confirmation-form__title"}),t!=null&&t.length?m("span",{className:"auth-email-confirmation-form__subtitle",children:`${n.subtitle} ${t}`}):null,m("span",{className:"auth-email-confirmation-form__text",children:n.mainText}),c("div",{className:"auth-email-confirmation-form__buttons",children:[m(f,{type:"button",variant:"tertiary",style:{padding:0},buttonText:n.buttonSecondary,enableLoader:!1,onClick:s,disabled:i}),r?null:m(f,{type:"submit",buttonText:n.buttonPrimary,variant:"primary",enableLoader:!1,disabled:i,onClick:l})]})]})},M=(o,t,a)=>{const r=o.target.querySelector('input[name="password"]'),e=o.target.querySelector('input[name="confirmPasswordField"]');r&&!t.length?r.focus():e&&!a.length&&e.focus()};export{I as E,M as f}; diff --git a/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js b/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js index 1a249bbf30..a2e0bdf91f 100644 --- a/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/getCustomerToken.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{a as U,f as w,h as k}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as x}from"@dropins/tools/event-bus.js";import{merge as y}from"@dropins/tools/lib.js";import{c as C}from"./initialize.js";import{CUSTOMER_INFORMATION_FRAGMENT as F}from"../fragments.js";import{p as E,E as O,a as S,C as R}from"./getStoreConfig.js";import{s as v}from"./setReCaptchaToken.js";const D=t=>{var f,e,i,a,r,o,u,T,s,g,N,c,_;const m={email:((e=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:e.email)??"",firstName:((a=(i=t==null?void 0:t.data)==null?void 0:i.customer)==null?void 0:a.firstname)??"",lastName:((o=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:o.lastname)??"",isSubscribed:((T=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:T.is_subscribed)??!1};return y(m,(_=(c=(N=(g=(s=C)==null?void 0:s.getConfig())==null?void 0:g.models)==null?void 0:N.CustomerModel)==null?void 0:c.transformer)==null?void 0:_.call(c,t.data))},K=` query GET_CUSTOMER_DATA { diff --git a/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js index 4023c8da2a..c2bf8c6e2d 100644 --- a/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-auth/chunks/getStoreConfig.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as l,h as E}from"./network-error.js";const T=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{login:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),S=e=>({userAccount:{logout:!0},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),N=e=>({personalEmail:{address:(e==null?void 0:e.email)||""},userAccount:{updateProfile:e==null?void 0:e.updateProfile},commerce:{commerceScope:{storeCode:(e==null?void 0:e.store_code)||""}}}),D={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},c=3600,I=e=>{var t,o,r,a,m,_,f,g,d,C;return{autocompleteOnStorefront:((o=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:o.autocomplete_on_storefront)||!1,minLength:((a=(r=e==null?void 0:e.data)==null?void 0:r.storeConfig)==null?void 0:a.minimum_password_length)||3,requiredCharacterClasses:+((_=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:_.required_character_classes_number)||0,createAccountConfirmation:((g=(f=e==null?void 0:e.data)==null?void 0:f.storeConfig)==null?void 0:g.create_account_confirmation)||!1,customerAccessTokenLifetime:((C=(d=e==null?void 0:e.data)==null?void 0:d.storeConfig)==null?void 0:C.customer_access_token_lifetime)*c||c}},O=e=>{const t=e.map(o=>o.message).join(" ");throw Error(t)},U=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},R=async()=>{try{const e=sessionStorage.getItem("storeConfig");let o=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!o){const r=await b();sessionStorage.setItem("storeConfig",JSON.stringify(r)),o=(r==null?void 0:r.customerAccessTokenLifetime)||c}return`Max-Age=${o}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${c}`}};var A=(e=>(e.CREATE_ACCOUNT_EVENT="create-account",e.SIGN_IN="sign-in",e.SIGN_OUT="sign-out",e))(A||{});const s="authContext",h="shopperContext",i={CREATE_ACCOUNT:"create-account",SIGN_IN:"sign-in",SIGN_OUT:"sign-out"};function n(e,t){const o=window.adobeDataLayer||[];o.push({[e]:null}),o.push({[e]:t})}function u(e){(window.adobeDataLayer||[]).push(o=>{const r=o.getState?o.getState():{};o.push({event:e,eventInfo:{...r}})})}function k(e){const t=N(e);n(s,t),u(i.CREATE_ACCOUNT)}function p(e){const t=T(e);n(s,t),n(h,{shopperId:"logged-in"}),u(i.SIGN_IN)}function w(e){const t=S(e);n(s,t),n(h,{shopperId:"guest"}),u(i.SIGN_OUT)}const M=(e,t)=>{const o=sessionStorage.getItem("storeConfig"),a={...o?JSON.parse(o):{},...t};switch(e){case"create-account":k(a);break;case"sign-in":p(a);break;case"sign-out":w(a);break;default:return null}},G=` query GET_STORE_CONFIG { diff --git a/scripts/__dropins__/storefront-auth/chunks/index.js b/scripts/__dropins__/storefront-auth/chunks/index.js index a3a388aecd..89a1bee2ce 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index.js +++ b/scripts/__dropins__/storefront-auth/chunks/index.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{R as b,R as c}from"./ResetPasswordForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./requestPasswordResetEmail.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";export{b as ResetPasswordForm,c as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/index2.js b/scripts/__dropins__/storefront-auth/chunks/index2.js index f2a9e92fd8..b91f832138 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index2.js +++ b/scripts/__dropins__/storefront-auth/chunks/index2.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{S as q,S as v}from"./SignInForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"./Button2.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/event-bus.js";import"./getCustomerToken.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./initialize.js";import"../fragments.js";import"./getStoreConfig.js";import"./setReCaptchaToken.js";import"./resendConfirmationEmail.js";import"./simplifyTransformAttributesForm.js";import"./transform-attributes-form.js";import"./focusOnEmptyPasswordField.js";import"./confirmEmail.js";export{q as SignInForm,v as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/index3.js b/scripts/__dropins__/storefront-auth/chunks/index3.js index 765ff19c9d..065fb4ee63 100644 --- a/scripts/__dropins__/storefront-auth/chunks/index3.js +++ b/scripts/__dropins__/storefront-auth/chunks/index3.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{S as w,S as y}from"./SignUpForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"./createCustomerAddress.js";import"../fragments.js";import"./network-error.js";import"@dropins/tools/fetch-graphql.js";import"./setReCaptchaToken.js";import"./initialize.js";import"./transform-attributes-form.js";import"./getStoreConfig.js";import"@dropins/tools/preact-hooks.js";import"./simplifyTransformAttributesForm.js";import"./usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"./getCustomerToken.js";import"./Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";/* empty css */import"./focusOnEmptyPasswordField.js";import"./resendConfirmationEmail.js";import"./SkeletonLoader.js";export{w as SignUpForm,y as default}; diff --git a/scripts/__dropins__/storefront-auth/chunks/initialize.js b/scripts/__dropins__/storefront-auth/chunks/initialize.js index 48b5b4b6df..8b7fc75944 100644 --- a/scripts/__dropins__/storefront-auth/chunks/initialize.js +++ b/scripts/__dropins__/storefront-auth/chunks/initialize.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{Initializer as o}from"@dropins/tools/lib.js";const i=new o({init:async n=>{const e={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};i.config.setConfig({...e,...n})},listeners:()=>[]}),a=i.config;export{a as c,i}; diff --git a/scripts/__dropins__/storefront-auth/chunks/network-error.js b/scripts/__dropins__/storefront-auth/chunks/network-error.js index b42c878118..dd167fcd68 100644 --- a/scripts/__dropins__/storefront-auth/chunks/network-error.js +++ b/scripts/__dropins__/storefront-auth/chunks/network-error.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{FetchGraphQL as e}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:c,setFetchGraphQlHeaders:p,fetchGraphQl:i,getConfig:f}=new e().getMethods(),m=t=>{throw t instanceof DOMException&&t.name==="AbortError"||r.emit("auth/error",{source:"auth",type:"network",error:t}),t};export{n as a,p as b,i as f,f as g,m as h,c as r,h as s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js b/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js index bc522e0e36..88e7714e03 100644 --- a/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/requestPasswordResetEmail.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{f as E,h as l}from"./network-error.js";import{s as e}from"./setReCaptchaToken.js";const R=a=>{var r,m,i;let t="";return(r=a==null?void 0:a.errors)!=null&&r.length&&(t=(m=a==null?void 0:a.errors[0])==null?void 0:m.message),{message:t,success:!!((i=a==null?void 0:a.data)!=null&&i.requestPasswordResetEmail)}},c=` mutation REQUEST_PASSWORD_RESET_EMAIL($email: String!) { diff --git a/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js b/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js index bee8145f76..b6f09c8302 100644 --- a/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js +++ b/scripts/__dropins__/storefront-auth/chunks/resendConfirmationEmail.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{f as r,h as e}from"./network-error.js";const i=` mutation RESEND_CONFIRMATION_EMAIL($email: String!) { diff --git a/scripts/__dropins__/storefront-auth/chunks/resetPassword.js b/scripts/__dropins__/storefront-auth/chunks/resetPassword.js index 1584ee7812..4bd8e7a2dc 100644 --- a/scripts/__dropins__/storefront-auth/chunks/resetPassword.js +++ b/scripts/__dropins__/storefront-auth/chunks/resetPassword.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{f as o,h as w}from"./network-error.js";import{s as d}from"./setReCaptchaToken.js";const i=` mutation RESET_PASSWORD( diff --git a/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js b/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js index 4b64ef7150..d649960ef9 100644 --- a/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/revokeCustomerToken.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{f as u,h as n}from"./network-error.js";import{C as m,d as s,p as c,E}from"./getStoreConfig.js";import{events as i}from"@dropins/tools/event-bus.js";const k=t=>{var r,o,a;let e="";return(r=t==null?void 0:t.errors)!=null&&r.length&&(e=((o=t==null?void 0:t.errors[0])==null?void 0:o.message)||"Unknown error"),{message:e,success:!!((a=t==null?void 0:t.data)!=null&&a.revokeCustomerToken)}},h=` mutation REVOKE_CUSTOMER_TOKEN { diff --git a/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js b/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js index 7c2f91394c..3f7c50eb86 100644 --- a/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js +++ b/scripts/__dropins__/storefront-auth/chunks/setReCaptchaToken.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{verifyReCaptcha as t}from"@dropins/tools/recaptcha.js";import"@dropins/tools/event-bus.js";import{a as e}from"./network-error.js";const s=async()=>{const a=await t();a&&e("X-ReCaptcha",a)};export{s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js b/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js index aaefa753f9..db88379c82 100644 --- a/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js +++ b/scripts/__dropins__/storefront-auth/chunks/simplifyTransformAttributesForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{t}from"./transform-attributes-form.js";const s=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-sign-in-form__form__email",frontend_input:"TEXT",is_required:!0,multiline_count:1,sort_order:1,is_unique:!1,label:"Email",options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}]}],o=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"auth-reset-password-form__form__item",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}]}],n=[{customUpperCode:"email",code:"email",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"Email",multiline_count:1,sort_order:1,options:[],validateRules:[{name:"INPUT_VALIDATION",value:"email"}]},{customUpperCode:"firstname",code:"firstname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!0,is_unique:!1,label:"First name",multiline_count:1,sort_order:2,options:[]},{customUpperCode:"lastname",code:"lastname",default_value:"",entity_type:"CUSTOMER",frontend_class:"",frontend_input:"TEXT",is_required:!1,is_unique:!1,label:"Last name",multiline_count:1,sort_order:3,options:[]}],i=e=>e!=null&&e.length?t({data:{attributesForm:{items:e}}}):[];export{o as D,s as a,n as b,i as s}; diff --git a/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js index 1e6a358e67..717eb1b9ad 100644 --- a/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-auth/chunks/transform-attributes-form.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const _=t=>t.replace(/_([a-z])/g,(n,e)=>e.toUpperCase()),p=t=>t.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),m=(t,n,e)=>{const s=["string","boolean","number"],a=n==="camelCase"?_:p;return Array.isArray(t)?t.map(o=>s.includes(typeof o)||o===null?o:typeof o=="object"?m(o,n,e):o):t!==null&&typeof t=="object"?Object.entries(t).reduce((o,[i,c])=>{const r=e&&e[i]?e[i]:a(i);return o[r]=s.includes(typeof c)||c===null?c:m(c,n,e),o},{}):t},b=t=>{let n=[];for(const e of t)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let s=2;s<=e.multiline_count;s++){const a={...e,is_required:!1,name:`${e.code}_multiline_${s}`,code:`${e.code}_multiline_${s}`,id:`${e.code}_multiline_${s}`};n.push(a)}return n},C=t=>{var o,i,c;const n=((i=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:i.items)||[];if(!n.length)return[];const e=(c=n.filter(r=>{var u;return!((u=r.frontend_input)!=null&&u.includes("HIDDEN"))}))==null?void 0:c.map(({code:r,...u})=>{const l=r!=="country_id"?r:"country_code";return{...u,name:l,id:l,code:l}}),s=b(e);return e.concat(s).map(r=>{var d;const u=r.code==="firstname"?"firstName":r.code==="lastname"?"lastName":_(r.code),l=(d=r.options)==null?void 0:d.map(f=>({isDefault:f.is_default,text:f.label,value:f.value}));return m({...r,options:l,customUpperCode:u},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,u)=>r.orderNumber-u.orderNumber)};export{m as c,C as t}; diff --git a/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js b/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js index ef6ef183ab..9b2f74879f 100644 --- a/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js +++ b/scripts/__dropins__/storefront-auth/chunks/usePasswordValidationMessage.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{g as m}from"./getStoreConfig.js";import{useState as c,useEffect as u,useMemo as h}from"@dropins/tools/preact-hooks.js";import{useText as f}from"@dropins/tools/i18n.js";const A=()=>{const[e,n]=c(!1),[t,i]=c(null);return u(()=>{const a=sessionStorage.getItem("storeConfig"),r=a?JSON.parse(a):null;if(r){const{minLength:o,requiredCharacterClasses:s,createAccountConfirmation:g}=r;i({minLength:o,requiredCharacterClasses:s}),n(g)}else m().then(o=>{if(o){const{minLength:s,requiredCharacterClasses:g,createAccountConfirmation:l}=o;sessionStorage.setItem("storeConfig",JSON.stringify(o)),i({minLength:s,requiredCharacterClasses:g}),n(l)}})},[]),{passwordConfigs:t,isEmailConfirmationRequired:e}},L=(e,n)=>{if(n<=1)return!0;const t=/[0-9]/.test(e)?1:0,i=/[a-z]/.test(e)?1:0,a=/[A-Z]/.test(e)?1:0,r=/[^a-zA-Z0-9\s]/.test(e)?1:0;return t+i+a+r>=n},M=({passwordConfigs:e,isClickSubmit:n,password:t})=>{const i=f({messageLengthPassword:"Auth.PasswordValidationMessage.messageLengthPassword"}),[a,r]=c("pending");u(()=>{if(!e)return;const s=L(t,e.requiredCharacterClasses);n&&t.length>0?r(s?"success":"error"):n&&t.length===0?r("pending"):r(s?"success":"pending")},[n,e,t]);const o=h(()=>{var g;if(!e)return;const s={status:"pending",icon:"pending",message:(g=i.messageLengthPassword)==null?void 0:g.replace("{minLength}",`${e.minLength}`)};return t.length&&t.length>=e.minLength?{...s,icon:"success",status:"success"}:t.length&&t.length0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),t=(e==null?void 0:e.nonce)||(e==null?void 0:e.getAttribute("nonce"));a=Promise.allSettled(c.map(o=>{if(o=k(o),o in f)return;f[o]=!0;const m=o.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${h}`))return;const n=document.createElement("link");if(n.rel=m?"stylesheet":L,m||(n.as="script"),n.crossOrigin="",n.href=o,t&&n.setAttribute("nonce",t),document.head.appendChild(n),m)return new Promise((_,v)=>{n.addEventListener("load",_),n.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${o}`)))})}))}function s(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return a.then(e=>{for(const t of e||[])t.status==="rejected"&&s(t.reason);return r().catch(s)})},b=d(()=>p(()=>import("../chunks/index.js"),[])),w=d(()=>p(()=>import("../chunks/index2.js"),[])),A=d(()=>p(()=>import("../chunks/index3.js"),[])),O=({defaultView:l="signInForm",signInFormConfig:r,signUpFormConfig:c,resetPasswordFormConfig:u})=>{const[a,s]=S(l),e=P(()=>({signInForm:i(w,{setActiveComponent:s,...r}),signUpForm:i(A,{setActiveComponent:s,...c}),resetPasswordForm:i(b,{setActiveComponent:s,...u})}),[u,r,c,s]);return i("div",{children:i(E,{fallback:i(y,{activeSkeleton:a}),children:i("div",{className:"auth-combine",children:e[a]})})})};export{O as AuthCombine,O as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/ResetPassword.js b/scripts/__dropins__/storefront-auth/containers/ResetPassword.js index db511ae674..c6b1dc8bda 100644 --- a/scripts/__dropins__/storefront-auth/containers/ResetPassword.js +++ b/scripts/__dropins__/storefront-auth/containers/ResetPassword.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{R as i}from"../chunks/ResetPasswordForm.js";import"../chunks/requestPasswordResetEmail.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/i18n.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";const F=({formSize:o,routeSignIn:t,onErrorCallback:m})=>r("div",{className:"auth-reset-password",children:r(i,{formSize:o,routeSignIn:t,onErrorCallback:m})});export{F as ResetPassword,F as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SignIn.js b/scripts/__dropins__/storefront-auth/containers/SignIn.js index 439560d0ec..d31752bdfb 100644 --- a/scripts/__dropins__/storefront-auth/containers/SignIn.js +++ b/scripts/__dropins__/storefront-auth/containers/SignIn.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{S as u}from"../chunks/SignInForm.js";import"../chunks/Button2.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/i18n.js";import"../chunks/getCustomerToken.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../fragments.js";import"../chunks/getStoreConfig.js";import"../chunks/setReCaptchaToken.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/transform-attributes-form.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/confirmEmail.js";const L=({slots:i,labels:o,enableEmailConfirmation:t,initialEmailValue:m,formSize:p,renderSignUpLink:n,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeRedirectOnSignIn:e,routeForgotPassword:c,routeSignUp:d,onSuccessCallback:f,onErrorCallback:g,onSignUpLinkClick:l})=>r("div",{className:"auth-sign-in",children:r(u,{slots:i,labels:o,formSize:p,renderSignUpLink:n,initialEmailValue:m,enableEmailConfirmation:t,hideCloseBtnOnEmailConfirmation:s,routeRedirectOnEmailConfirmationClose:a,routeSignUp:d,onErrorCallback:g,onSuccessCallback:f,onSignUpLinkClick:l,routeForgotPassword:c,routeRedirectOnSignIn:e})});export{L as SignIn,L as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SignUp.js b/scripts/__dropins__/storefront-auth/containers/SignUp.js index 37ee48fd3f..ff9b24925e 100644 --- a/scripts/__dropins__/storefront-auth/containers/SignUp.js +++ b/scripts/__dropins__/storefront-auth/containers/SignUp.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{S as h}from"../chunks/SignUpForm.js";import"../chunks/createCustomerAddress.js";import"../fragments.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/setReCaptchaToken.js";import"../chunks/initialize.js";import"../chunks/transform-attributes-form.js";import"../chunks/getStoreConfig.js";import"../chunks/simplifyTransformAttributesForm.js";import"../chunks/usePasswordValidationMessage.js";import"@dropins/tools/i18n.js";import"../chunks/getCustomerToken.js";import"../chunks/Button2.js";import"@dropins/tools/preact-compat.js";import"../chunks/focusOnEmptyPasswordField.js";import"../chunks/resendConfirmationEmail.js";import"../chunks/SkeletonLoader.js";const P=({slots:i,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,requireRetypePassword:s,inputsDefaultValueSet:a,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,fieldsConfigForApiVersion1:u,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,onSuccessCallback:g,onErrorCallback:l,routeSignIn:S})=>r("div",{className:"auth-sign-up",children:r(h,{requireRetypePassword:s,formSize:o,apiVersion2:t,addressesData:m,isAutoSignInEnabled:p,inputsDefaultValueSet:a,fieldsConfigForApiVersion1:u,displayNewsletterCheckbox:n,displayTermsOfUseCheckbox:e,hideCloseBtnOnEmailConfirmation:c,routeRedirectOnEmailConfirmationClose:d,routeRedirectOnSignIn:f,routeSignIn:S,slots:i,onErrorCallback:l,onSuccessCallback:g})});export{P as SignUp,P as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js b/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js index 7d09fd07ac..52da2b18b0 100644 --- a/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js +++ b/scripts/__dropins__/storefront-auth/containers/SuccessNotification.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as a,jsx as e,Fragment as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u,Slot as m}from"@dropins/tools/lib.js";import{Button as r}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{r as d}from"../chunks/revokeCustomerToken.js";import{useText as f}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getStoreConfig.js";const h=({formSize:c="default",className:n="",slots:i,labels:t})=>{const o=f({headingText:"Auth.SuccessNotification.headingText",messageText:"Auth.SuccessNotification.messageText",primaryButtonText:"Auth.SuccessNotification.primaryButtonText",secondaryButtonText:"Auth.SuccessNotification.secondaryButtonText"});return a("div",{className:u(["auth-success-notification-form",`auth-success-notification-form--${c}`,n]),id:"welcome-message",role:"alert","aria-live":"assertive","aria-labelledby":(t==null?void 0:t.headingText)??o.headingText,"aria-describedby":(t==null?void 0:t.messageText)??o.messageText,"tab-index":"-1",children:[e("p",{id:"welcome-heading",className:"auth-success-notification-form__title","data-testid":"notification-title",children:(t==null?void 0:t.headingText)??o.headingText}),e("p",{id:"welcome-details",className:"auth-success-notification-form__content-text","data-testid":"notification-content",children:(t==null?void 0:t.messageText)??o.messageText}),i!=null&&i.SuccessNotificationActions?e(m,{"data-testid":"successNotificationActions",name:"SuccessNotificationActions",slot:i==null?void 0:i.SuccessNotificationActions,context:{}}):a(s,{children:[e(r,{"data-testid":"primaryButton",type:"button",className:"auth-success-notification-form__button auth-success-notification-form__button--top",onClick:()=>window.location.href="/",children:o.primaryButtonText}),e(r,{"data-testid":"secondaryButton",type:"button",variant:"tertiary",onClick:async()=>{await d(),window.location.href="/"},children:o.secondaryButtonText})]})]})},k=({formSize:c="default",slots:n,className:i,labels:t})=>e("div",{className:"auth-success-notification",children:e(h,{formSize:c,className:i,slots:n,labels:t})});export{k as SuccessNotification,k as default}; diff --git a/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js b/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js index 812f95a9bf..2f67643be9 100644 --- a/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js +++ b/scripts/__dropins__/storefront-auth/containers/UpdatePassword.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as u,jsxs as H}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as Z,classes as $}from"@dropins/tools/lib.js";import{Header as k,InLineAlert as S,InputPassword as W}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{useState as h,useEffect as z,useCallback as I}from"@dropins/tools/preact-hooks.js";/* empty css */import{v as O,u as g,a as R}from"../chunks/usePasswordValidationMessage.js";import{a as C}from"../chunks/getCustomerToken.js";import{r as tt}from"../chunks/resetPassword.js";import{c as j,g as et,u as at,F as st,B as rt}from"../chunks/Button2.js";import{useText as K}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../fragments.js";import"../chunks/setReCaptchaToken.js";import"@dropins/tools/preact-compat.js";const J=(d,p)=>d.split("&").filter(r=>r.includes(p)).map(r=>r.split("=")[1])[0],it=({isEmailConfirmationRequired:d,signInOnSuccess:p,passwordConfigs:t,routeRedirectOnSignIn:r,routeWrongUrlRedirect:w,onErrorCallback:a,onSuccessCallback:i,handleSetInLineAlertProps:m,routeRedirectOnPasswordUpdate:N,routeSignInPage:o})=>{const s=K({errorNotification:"Auth.Notification.errorNotification",updatePasswordMessage:"Auth.Notification.updatePasswordMessage",updatePasswordActionMessage:"Auth.Notification.updatePasswordActionMessage",customerTokenErrorMessage:"Auth.Api.customerTokenErrorMessage"}),[U,n]=h({userName:"",status:!1}),[x,F]=h(""),[v,A]=h(!1),[P,L]=h(""),[y,M]=h(""),[T,c]=h(!1),[_,q]=h(!1),[b,B]=h([]);z(()=>{v&&!b.length&&(x.length?q(!1):q(!0))},[v,x,b]),z(()=>{const{search:f}=window.location;!f.includes("token=")&&!f.includes("email=")&&j(w)&&(window.location.href=w());const e=decodeURIComponent(f),V=J(e,"token"),E=J(e,"email");L(E),M(V)},[w]);const Q=I(async f=>{f.preventDefault(),c(!0),B([]);const e=et(f.target),V=(e==null?void 0:e.password)&&P&&y;e!=null&&e.password||(q(!0),c(!1));const E=(t==null?void 0:t.requiredCharacterClasses)??0,Y=(t==null?void 0:t.minLength)??0;if(!O(e==null?void 0:e.password,E)||e.password.length<+Y){A(!0),c(!1);return}if(!V){m({type:"error",text:s.errorNotification}),c(!1);return}const{message:D,success:G}=await tt(P,y,e.password);if(G){if(d||!d&&!p){i==null||i(),j(N)&&(window.location.href=N()),A(!0),c(!1),q(!1),F(""),B([{label:s.updatePasswordActionMessage,onClick:()=>{window.location.href=o==null?void 0:o()}}]),m({type:"success",text:s.updatePasswordMessage});return}const l=await C({email:P,password:e.password,handleSetInLineAlertProps:m,onErrorCallback:a,translations:s});l!=null&&l.userName&&(i==null||i(l==null?void 0:l.userName),j(r)?window.location.href=r():n({userName:l==null?void 0:l.userName,status:!0}))}else m({type:"error",text:D}),a==null||a({message:D,success:G});c(!1)},[P,y,t==null?void 0:t.requiredCharacterClasses,t==null?void 0:t.minLength,s,d,p,o,a,i,r,m,N]),X=I(f=>{F(f)},[]);return{additionalActionsAlert:b,passwordError:_,isSuccessful:U,updatePasswordValue:x,isClickSubmit:v,isLoading:T,submitUpdatePassword:Q,handleSetUpdatePasswordValue:X,setIsClickSubmit:A}},ot=({signInOnSuccess:d=!0,formSize:p="default",routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,routeSignInPage:w,slots:a,onErrorCallback:i,onSuccessCallback:m,routeRedirectOnPasswordUpdate:N})=>{const o=K({title:"Auth.UpdatePasswordForm.title",buttonPrimary:"Auth.UpdatePasswordForm.buttonPrimary",placeholder:"Auth.InputPassword.placeholder",floatingLabel:"Auth.InputPassword.floatingLabel",requiredFieldError:"Auth.FormText.requiredFieldError"}),{passwordConfigs:s,isEmailConfirmationRequired:U}=g(),{inLineAlertProps:n,handleSetInLineAlertProps:x}=at(),{additionalActionsAlert:F,passwordError:v,isSuccessful:A,updatePasswordValue:P,isClickSubmit:L,isLoading:y,submitUpdatePassword:M,handleSetUpdatePasswordValue:T}=it({isEmailConfirmationRequired:U,signInOnSuccess:d,passwordConfigs:s,routeRedirectOnSignIn:t,routeWrongUrlRedirect:r,onErrorCallback:i,onSuccessCallback:m,handleSetInLineAlertProps:x,routeRedirectOnPasswordUpdate:N,routeSignInPage:w}),{isValidUniqueSymbols:c,defaultLengthMessage:_}=R({password:P,isClickSubmit:L,passwordConfigs:s});return A.status&&(a!=null&&a.SuccessNotification)?u(Z,{"data-testid":"successNotificationTestId",name:"SuccessNotification",slot:a==null?void 0:a.SuccessNotification,context:{isSuccessful:A}}):H("div",{className:$(["auth-update-password-form",`auth-update-password-form--${p}`]),children:[u(k,{title:o.title,divider:!1,className:"auth-update-password-form__title"}),u(S,{className:$(["auth-update-password-form__notification",["auth-update-password-form__notification--show",!!(n!=null&&n.text)]]),variant:"secondary",heading:n==null?void 0:n.text,icon:n.icon,additionalActions:F}),H(st,{name:"updatePassword_form",className:"auth-update-password-form__form",onSubmit:M,loading:y,fieldsConfig:[],children:[u("div",{style:"display: none;",children:u("input",{type:"text",id:"username",name:"username",autoComplete:"username"})}),u(W,{defaultValue:P,onValue:T,className:"auth-update-password-form__form__item",autoComplete:"new-password",name:"password",errorMessage:v||c==="error"||(_==null?void 0:_.status)==="error"?o.requiredFieldError:void 0,minLength:s==null?void 0:s.minLength,uniqueSymbolsStatus:c,validateLengthConfig:_,requiredCharacterClasses:s==null?void 0:s.requiredCharacterClasses,placeholder:o.placeholder,floatingLabel:o.floatingLabel}),u("div",{className:"auth-update-password-form__button",children:u(rt,{type:"submit",buttonText:o.buttonPrimary,variant:"primary",enableLoader:y})})]})]})},Ut=({slots:d,formSize:p,signInOnSuccess:t,routeRedirectOnPasswordUpdate:r,routeRedirectOnSignIn:w,routeSignInPage:a,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N})=>u("div",{className:"auth-update-password",children:u(ot,{formSize:p,signInOnSuccess:t,routeSignInPage:a,routeRedirectOnSignIn:w,routeWrongUrlRedirect:i,onErrorCallback:m,onSuccessCallback:N,slots:d,routeRedirectOnPasswordUpdate:r})});export{Ut as UpdatePassword,Ut as default}; diff --git a/scripts/__dropins__/storefront-auth/fragments.js b/scripts/__dropins__/storefront-auth/fragments.js index 4bcbe599f7..d9aec75221 100644 --- a/scripts/__dropins__/storefront-auth/fragments.js +++ b/scripts/__dropins__/storefront-auth/fragments.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const e=` fragment CUSTOMER_INFORMATION_FRAGMENT on Customer { diff --git a/scripts/__dropins__/storefront-auth/render.js b/scripts/__dropins__/storefront-auth/render.js index 4b973ea874..a0eec6c6c4 100644 --- a/scripts/__dropins__/storefront-auth/render.js +++ b/scripts/__dropins__/storefront-auth/render.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ (function(o,t){try{if(typeof document<"u"){const a=document.createElement("style"),n=t.styleId;for(const i in t.attributes)a.setAttribute(i,t.attributes[i]);a.setAttribute("data-dropin",n),a.appendChild(document.createTextNode(o));const r=document.querySelector('style[data-dropin="sdk"]');if(r)r.after(a);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(a):document.head.append(a)}}}catch(a){console.error("dropin-styles (injectCodeFunction)",a)}})('.auth-email-confirmation-form{border-radius:8px;background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small);text-align:start}@media (min-width: 768px){.auth-email-confirmation-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-email-confirmation-form__title{font:var(--type-headline-2-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--color-neutral-800, #3d3d3d)}.auth-email-confirmation-form__subtitle{display:block;font:var(--type-details-caption-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-neutral-700, #666666)}.auth-email-confirmation-form__notification{margin-bottom:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-email-confirmation-form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-email-confirmation-form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-email-confirmation-form__text{display:block;font-family:var(--type-body-1-default-font);letter-spacing:var(--type-display-1-letter-spacing);color:var(--neutrals-neutral-800);padding:var(--spacing-big) 0}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form.auth-email-confirmation-form--small .auth-email-confirmation-form__buttons>span{display:none}.auth-email-confirmation-form__buttons>span{border:1px solid var(--color-brand-500);margin:var(--spacing-small) var(--spacing-xsmall);font:var(--type-button-2-font)}@media (max-width: 768px){.auth-email-confirmation-form__buttons{justify-content:center;flex-wrap:wrap}.auth-email-confirmation-form__buttons{flex-basis:100%;margin-top:var(--spacing-medium)}.auth-email-confirmation-form__buttons>span{display:none}}.auth-update-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-update-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-update-password-form.auth-update-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}.auth-update-password-form.auth-update-password-form--small .auth-update-password-form__title{margin-bottom:var(--spacing-small)}.auth-update-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-update-password-form__form .auth-update-password-form__form__item{margin-bottom:var(--spacing-xxbig)}}.auth-update-password-form__notification{display:none}.auth-update-password-form__notification--show{display:grid;margin-bottom:var(--spacing-medium)}.auth-success-notification-form{display:flex;justify-content:center;align-items:center;flex-direction:column;border-radius:var(--shape-border-radius-2);background:var(--color-neutral-50, #fff);padding:var(--spacing-xbig) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-success-notification-form{padding:var(--spacing-big) var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xbig)}}.auth-success-notification-form.auth-success-notification-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-success-notification-form__title{color:var(--color-neutral-800, #2b2b2b);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-details-caption-1-letter-spacing);margin-bottom:var(--spacing-medium)}.auth-success-notification-form__content-text{color:var(--color-neutral-800, #2b2b2b);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);text-align:center;margin-bottom:var(--spacing-xxbig)}.auth-success-notification-form__button--top{margin-bottom:var(--spacing-xsmall)}.auth-sign-up-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-up-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-up-form.auth-sign-up-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__title{margin-bottom:var(--spacing-small)}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form__field .auth-sign-up-form__form__field:nth-child(3){flex-basis:100%}.auth-sign-up-form.auth-sign-up-form--small .auth-sign-up-form__form{grid-template-columns:1fr}.auth-sign-up-form__form__confirm-wrapper>.auth-sign-up-form__form__field--confirm-password{margin:var(--spacing-medium) 0}.auth-sign-up-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-up-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-up-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-up-form__form{display:flex;flex-wrap:wrap;flex-direction:row;gap:0 13px}.auth-sign-up-form__form__field{margin-bottom:var(--spacing-medium);flex-basis:100%;flex-grow:1;flex-shrink:0}.auth-sign-up-form__checkbox{margin-bottom:12px}.auth-sign-up-form__automatic-login{margin-top:12px}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:1;flex-basis:100%}.auth-sign-up-form-buttons{flex-basis:100%;display:grid;grid-template-columns:1fr;gap:var(--spacing-medium) 0;justify-content:center;grid-area:buttons}@media (min-width: 768px){.auth-sign-up-form-buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}.auth-sign-up-form__form__field:nth-child(2),.auth-sign-up-form__form__field:nth-child(3){flex-shrink:1;flex-grow:.5;flex-basis:48%}}.auth-sign-in-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-sign-in-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-sign-in-form__notification{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__email,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__password,.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__title{margin-bottom:var(--spacing-medium)}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons{grid-template-columns:1fr;gap:20px 0}.auth-sign-in-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-sign-in-form__title{margin-bottom:var(--spacing-xxbig)}}.auth-sign-in-form__form{display:grid;grid-template-columns:1fr}.auth-sign-in-form__form__email{margin-bottom:var(--spacing-medium)}.auth-sign-in-form__form__password{margin-bottom:var(--spacing-big)}.auth-sign-in-form__form__buttons{display:grid;grid-template-columns:auto auto;justify-content:space-between}@media (max-width: 768px){.auth-sign-in-form__form__buttons{gap:20px 0;grid-template-columns:1fr}}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form.auth-sign-in-form--small .auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{display:flex}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{border:var(--shape-border-width-1) solid var(--color-brand-500);margin:13px 10px;font:var(--type-button-2-font)}.auth-sign-in-form__resend-email-notification button{font:var(--type-button-3-font);color:var(--textColor);display:inline;background-color:transparent;border:none;cursor:pointer;padding:0;margin:0}.auth-sign-in-form__resend-email-notification button:hover{color:var(--color-brand-700);text-decoration:solid underline var(--color-brand-700);text-underline-offset:6px;color:var(--color-informational-500)}@media (max-width: 768px){.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine{justify-content:center;flex-wrap:wrap}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine .auth-sign-in-form__button--signup{flex-basis:100%;margin-top:20px}.auth-sign-in-form__form__buttons .auth-sign-in-form__form__buttons__combine>span{display:none}}.auth-reset-password-form{border-radius:var(--shape-border-radius-2);background-color:var(--color-neutral-50, #fff);padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}@media (min-width: 768px){.auth-reset-password-form{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}}.auth-reset-password-form.auth-reset-password-form--small{padding:var(--spacing-small) var(--spacing-small) var(--spacing-medium) var(--spacing-small)}.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__form__item,.auth-reset-password-form.auth-reset-password-form--small .auth-reset-password-form__title{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__form{display:grid;grid-template-columns:1fr}.auth-reset-password-form__form__item{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__buttons{display:grid;grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form.auth-reset-password-form--small{grid-template-columns:1fr;gap:20px 0}.auth-reset-password-form__notification{margin-bottom:var(--spacing-medium)}.auth-reset-password-form__title{margin-bottom:var(--spacing-big)}@media (min-width: 768px){.auth-reset-password-form__title{margin-bottom:var(--spacing-xxbig)}}@media (min-width: 600px){.auth-reset-password-form__buttons{grid-template-columns:auto auto;justify-content:space-between}}.auth-button{position:relative}.auth-button__wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:0;display:none}.auth-custom-button__loader{width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;position:relative;animation:pulse 1s linear infinite}.auth-button__loader:after{content:"";position:absolute;width:20px;height:20px;border:5px solid #fff;border-radius:50%;display:inline-block;box-sizing:border-box;left:50%;top:50%;transform:translate(-50%,-50%);animation:scaleUp 1s linear infinite}@keyframes scaleUp{0%{transform:translate(-50%,-50%) scale(0)}60%,to{transform:translate(-50%,-50%) scale(1)}}@keyframes pulse{0%,60%,to{transform:scale(1)}80%{transform:scale(1.2)}}.auth-button.enableLoader .auth-button__text{opacity:0}.auth-button.enableLoader .auth-button__wrapper{opacity:1;display:inline-flex}',{styleId:"Auth"}); import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{deepmerge as d,Render as m}from"@dropins/tools/lib.js";import{useState as u,useEffect as f}from"@dropins/tools/preact-hooks.js";import{UIProvider as h}from"@dropins/tools/components.js";import{events as p}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{c as g}from"./chunks/initialize.js";const w={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"},ResetPasswordForm:{title:"Reset your password",buttonPrimary:"Reset password",buttonSecondary:"Back to sign in",formAriaLabel:"Reset your password form"},SignInForm:{title:"Sign in",buttonPrimary:"Sign in",buttonSecondary:"Sign up",buttonTertiary:"Forgot password?"},SignUpForm:{title:"Sign up",buttonPrimary:"Create account",buttonSecondary:"Already a member? Sign in",privacyPolicyDefaultText:"I’ve read and accept the Terms of Use and Privacy Policy.",subscribedDefaultText:"Subscribe to our newsletter and be the first to know about new arrivals, sales and exclusive offers.",keepMeLoggedText:"Keep me logged in after account creation",failedCreateCustomerAddress:"Failed to create customer addresses:",confirmPassword:{placeholder:"Confirm password",floatingLabel:"Confirm password *",passwordMismatch:"Passwords do not match. Please make sure both password fields are identical."}},UpdatePasswordForm:{title:"Update password",buttonPrimary:"Update password"},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}.",dateMaxError:"Date must be less than or equal to {max}.",dateMinError:"Date must be greater than or equal to {min}.",urlError:"Please enter a valid URL, e.g., https://www.website.com.",lengthTextError:"Text length must be between {min} and {max} characters."},EmailConfirmationForm:{title:"Verify your email address",subtitle:"We`ve sent an email to",mainText:"Check your inbox and click on the link we just send you to confirm your email address and activate your account.",buttonSecondary:"Resend email",buttonPrimary:"Close",accountConfirmMessage:"Account confirmed",accountConfirmationEmailSuccessMessage:"Congratulations! Your account at {email} email has been successfully confirmed."},Notification:{errorNotification:"Your password update failed due to validation errors. Please check your information and try again.",updatePasswordMessage:"The password has been updated.",updatePasswordActionMessage:"Sign in",successPasswordResetEmailNotification:"If there is an account associated with {email} you will receive an email with a link to reset your password.",resendEmailNotification:{informationText:"This account is not confirmed.",buttonText:"Resend confirmation email"},emailConfirmationMessage:"Please check your email for confirmation link.",technicalErrors:{technicalErrorSendEmail:"A technical error occurred while trying to send the email. Please try again later."}},SuccessNotification:{headingText:"Welcome!",messageText:"We are glad to see you!",primaryButtonText:"Continue shopping",secondaryButtonText:"Logout"},Api:{customerTokenErrorMessage:"Unable to log in. Please try again later or contact support if the issue persists."},InputPassword:{placeholder:"Password",floatingLabel:"Password *"}},b={Auth:w},y={default:b},P=({children:n})=>{var r,t;const[e,i]=u("en_US"),c=(t=(r=g)==null?void 0:r.getConfig())==null?void 0:t.langDefinitions;f(()=>{const a=p.on("locale",o=>{o!==e&&i(o)},{eager:!0});return()=>{a==null||a.off()}},[e]);const l=d(y,c??{});return s(h,{lang:e,langDefinitions:l,children:n})},k=new m(s(P,{}));export{k as render}; diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 2b73984f58..d166efed64 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{c as j,r as z}from"./chunks/requestGuestOrderCancel.js";import{f as R,h as g}from"./chunks/fetch-graphql.js";import{g as K,r as W,s as Z,a as ee,b as re}from"./chunks/fetch-graphql.js";import{g as oe}from"./chunks/getAttributesForm.js";import{g as ne,a as se,r as ue}from"./chunks/requestGuestReturn.js";import{g as ie,a as le}from"./chunks/getGuestOrder.js";import{g as de}from"./chunks/getCustomerOrdersReturn.js";import{a as A}from"./chunks/initialize.js";import{d as Te,g as me,c as _e,i as Re}from"./chunks/initialize.js";import{g as Ae}from"./chunks/getStoreConfig.js";import{h as D}from"./chunks/network-error.js";import{events as d}from"@dropins/tools/event-bus.js";import{PRODUCT_DETAILS_FRAGMENT as O,PRICE_DETAILS_FRAGMENT as h,GIFT_CARD_DETAILS_FRAGMENT as f,ORDER_ITEM_DETAILS_FRAGMENT as x,BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT as C,ORDER_SUMMARY_FRAGMENT as b,ADDRESS_FRAGMENT as M}from"./fragments.js";import{a as Oe,c as he,r as fe}from"./chunks/confirmCancelOrder.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";const m=(r,t)=>r+t.amount.value,G=(r,t)=>({id:r,totalQuantity:t.totalQuantity,possibleOnepageCheckout:!0,items:t.items.map(e=>{var o,a,n,s,u,c,i,l;return{canApplyMsrp:!0,formattedPrice:"",id:e.id,quantity:e.totalQuantity,product:{canonicalUrl:(o=e.product)==null?void 0:o.canonicalUrl,mainImageUrl:((a=e.product)==null?void 0:a.image)??"",name:((n=e.product)==null?void 0:n.name)??"",productId:0,productType:(s=e.product)==null?void 0:s.productType,sku:((u=e.product)==null?void 0:u.sku)??"",topLevelSku:(c=e.product)==null?void 0:c.sku},prices:{price:{value:e.price.value,currency:e.price.currency,regularPrice:((i=e.regularPrice)==null?void 0:i.value)??e.price.value}},configurableOptions:((l=e.selectedOptions)==null?void 0:l.map(p=>({optionLabel:p.label,valueLabel:p.value})))||[]}}),prices:{subtotalExcludingTax:{value:t.subtotalExclTax.value,currency:t.subtotalExclTax.currency},subtotalIncludingTax:{value:t.subtotalInclTax.value,currency:t.subtotalInclTax.currency}},discountAmount:t.discounts.reduce(m,0)}),I=r=>{var o,a,n;const t=r.coupons[0],e=(o=r.payments)==null?void 0:o[0];return{appliedCouponCode:(t==null?void 0:t.code)??"",email:r.email,grandTotal:r.grandTotal.value,orderId:r.number,orderType:"checkout",otherTax:0,salesTax:r.totalTax.value,shipping:{shippingMethod:((a=r.shipping)==null?void 0:a.code)??"",shippingAmount:((n=r.shipping)==null?void 0:n.amount)??0},subtotalExcludingTax:r.subtotalExclTax.value,subtotalIncludingTax:r.subtotalInclTax.value,payments:e?[{paymentMethodCode:(e==null?void 0:e.code)||"",paymentMethodName:(e==null?void 0:e.name)||"",total:r.grandTotal.value,orderId:r.number}]:[],discountAmount:r.discounts.reduce(m,0),taxAmount:r.totalTax.value}},N=r=>{var e,o;const t=(o=(e=r==null?void 0:r.data)==null?void 0:e.placeOrder)==null?void 0:o.orderV2;return t?A(t):null},E={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},v={PLACE_ORDER:"place-order"};function _(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function T(r,t){const e=_();e.push({[r]:null}),e.push({[r]:t})}function L(r){_().push(e=>{const o=e.getState?e.getState():{};e.push({event:r,eventInfo:{...o}})})}function y(r,t){const e=I(t),o=G(r,t);T(E.ORDER_CONTEXT,{...e}),T(E.SHOPPING_CART_CONTEXT,{...o}),L(v.PLACE_ORDER)}class S extends Error{constructor(t){super(t),this.name="PlaceOrderError"}}const F=r=>{const t=r.map(e=>e.message).join(" ");throw new S(t)},P=` mutation PLACE_ORDER_MUTATION($cartId: String!) { diff --git a/scripts/__dropins__/storefront-order/api/confirmCancelOrder/confirmCancelOrder.d.ts b/scripts/__dropins__/storefront-order/api/confirmCancelOrder/confirmCancelOrder.d.ts index d9e243dd3c..0228b612dd 100644 --- a/scripts/__dropins__/storefront-order/api/confirmCancelOrder/confirmCancelOrder.d.ts +++ b/scripts/__dropins__/storefront-order/api/confirmCancelOrder/confirmCancelOrder.d.ts @@ -1,16 +1,4 @@ -/******************************************************************** - * - * Copyright 2024 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - *******************************************************************/ -export declare const confirmCancelOrder: (orderId: string, confirmationKey: string) => Promise; +import { OrderDataModel } from '../../data/models'; + +export declare const confirmCancelOrder: (orderId: string, confirmationKey: string) => Promise; //# sourceMappingURL=confirmCancelOrder.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts index 91a6069529..7a02106015 100644 --- a/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts +++ b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts @@ -1,17 +1,4 @@ -/******************************************************************** - * ADOBE CONFIDENTIAL - * - * Copyright 2024 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - *******************************************************************/ -export declare const confirmGuestReturn: (orderId: string, confirmationKey: string) => Promise; +import { OrderDataModel } from '../../data/models'; + +export declare const confirmGuestReturn: (orderId: string, confirmationKey: string) => Promise; //# sourceMappingURL=confirmGuestReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/helpers/initializeOrderDetails.d.ts b/scripts/__dropins__/storefront-order/api/helpers/initializeOrderDetails.d.ts index 46bd510494..332b8b3fab 100644 --- a/scripts/__dropins__/storefront-order/api/helpers/initializeOrderDetails.d.ts +++ b/scripts/__dropins__/storefront-order/api/helpers/initializeOrderDetails.d.ts @@ -1,4 +1,4 @@ -import { OrderDataModel } from '../../data/models'; +import { ConfigProps } from '../initialize'; -export declare const initializeOrderDetails: (config: Record | undefined) => Promise; +export declare const initializeOrderDetails: (config: ConfigProps) => Promise; //# sourceMappingURL=initializeOrderDetails.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts b/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts index c5ac724da0..79486207c5 100644 --- a/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts +++ b/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts @@ -2,15 +2,17 @@ import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib'; import { Lang } from '@dropins/tools/types/elsie/src/i18n'; import { CustomerOrdersReturnModel, OrderDataModel, RequestReturnModel } from '../../data/models'; -type ConfigProps = { +export type ConfigProps = { langDefinitions?: Lang; models?: { OrderDataModel?: Model; CustomerOrdersReturnModel?: Model; RequestReturnModel?: Model; }; + orderRef?: string; + returnRef?: string; + orderData?: OrderDataModel | null; }; export declare const initialize: Initializer; export declare const config: import('@dropins/tools/types/elsie/src/lib').Config; -export {}; //# sourceMappingURL=initialize.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js index 97f5fb2f5a..d3dd6df9ab 100644 --- a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js +++ b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as v,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{Price as P,Image as T,CartItem as g,Icon as u,Incrementer as o}from"@dropins/tools/components.js";import{useCallback as G}from"@dropins/tools/preact-hooks.js";import{classes as J}from"@dropins/tools/lib.js";import{O as r}from"./OrderLoaders.js";import*as M from"@dropins/tools/preact-compat.js";const c=k=>M.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...k},M.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"}),M.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"})),se=({placeholderImage:k="",loading:X,product:e,itemType:Y,taxConfig:D,translations:h,disabledIncrementer:i,onQuantity:E,showConfigurableOptions:V,routeProductDetails:w})=>{var q,x,O,W,$,z,B,F,K,R,U;const{taxExcluded:f,taxIncluded:L}=D,t=G((m,H,b)=>v(P,{amount:m,currency:H,weight:"normal",...b}),[]),Z=G(m=>{var b,A;const H=(b=m==null?void 0:m.product)!=null&&b.thumbnail.url.length?(A=m==null?void 0:m.product)==null?void 0:A.thumbnail.url:k;return v(T,{src:H,alt:m==null?void 0:m.productName,loading:"lazy",width:"90",height:"120"})},[k]);if(!e)return v(r,{});let N={};const Q=Y==="cancelled",C=(x=(q=e==null?void 0:e.product)==null?void 0:q.stockStatus)==null?void 0:x.includes("IN_STOCK"),l=e==null?void 0:e.giftCard,a=(O=e==null?void 0:e.itemPrices)==null?void 0:O.priceIncludingTax,s=(W=e==null?void 0:e.itemPrices)==null?void 0:W.originalPrice,n=($=e==null?void 0:e.itemPrices)==null?void 0:$.price,I=e.totalQuantity>1?{quantity:e.totalQuantity}:{},y=e.discounted&&((z=e.price)==null?void 0:z.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),j={...(e==null?void 0:e.configurableOptions)||{},...(e==null?void 0:e.bundleOptions)||{},...l!=null&&l.senderName?{[h.sender]:l==null?void 0:l.senderName}:{},...l!=null&&l.senderEmail?{[h.sender]:l==null?void 0:l.senderEmail}:{},...l!=null&&l.senderName?{[h.sender]:l==null?void 0:l.senderName}:{},...l!=null&&l.recipientEmail?{[h.recipient]:l==null?void 0:l.recipientEmail}:{},...l!=null&&l.message?{[h.message]:l==null?void 0:l.message}:{},...e!=null&&e.downloadableLinks?{[`${(B=e==null?void 0:e.downloadableLinks)==null?void 0:B.count} ${h.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(L&&f){const m=y?s==null?void 0:s.value:(a==null?void 0:a.value)*(e==null?void 0:e.totalQuantity);N={taxExcluded:!0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:S(_,{children:[t(m,s==null?void 0:s.currency,{variant:e.discounted&&(a==null?void 0:a.value)!==m?"strikethrough":"default"}),e.discounted&&(a==null?void 0:a.value)!==m?t(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!L&&f)N={taxExcluded:void 0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:S(_,{children:[t((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),a==null?void 0:a.currency,{variant:y?"strikethrough":"default"}),y?t((K=e.price)==null?void 0:K.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(L&&!f){const m=y?s.value:a.value*e.totalQuantity;N={taxExcluded:void 0,taxIncluded:!0,price:t(a==null?void 0:a.value,a==null?void 0:a.currency),total:S(_,{children:[t(m,a==null?void 0:a.currency,{variant:y?"strikethrough":"default",weight:"bold"}),y?t(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]})}}return v(g,{loading:X,alert:Q&&C?S("span",{children:[v(u,{source:c}),h.outOfStock]}):v(_,{}),configurations:(V==null?void 0:V(j))??j,title:w?v("a",{"data-testid":"product-name",className:J(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),href:w(e),children:e==null?void 0:e.productName}):v("div",{"data-testid":"product-name",className:J(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),children:e==null?void 0:e.productName}),sku:v("div",{children:(U=e==null?void 0:e.product)==null?void 0:U.sku}),...I,image:w?v("a",{href:w(e),children:Z(e)}):Z(e),...N,footer:E&&!i?v(o,{value:1,min:1,max:e==null?void 0:e.totalQuantity,onValue:m=>E==null?void 0:E(Number(m)),name:"quantity","data-testid":"returnIncrementer",readonly:!0}):void 0})};export{se as C,c as S}; +import{jsx as l,jsxs as y,Fragment as E}from"@dropins/tools/preact-jsx-runtime.js";import{Price as z,Image as A,CartItem as B,Icon as F,Incrementer as K}from"@dropins/tools/components.js";import{useCallback as V}from"@dropins/tools/preact-hooks.js";import{classes as H}from"@dropins/tools/lib.js";import{O as Q}from"./OrderLoaders.js";import*as O from"@dropins/tools/preact-compat.js";const R=o=>O.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},O.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"}),O.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"})),C=({placeholderImage:o="",loading:M,product:e,itemType:Z,taxConfig:j,translations:g,disabledIncrementer:q,onQuantity:b,showConfigurableOptions:k,routeProductDetails:v})=>{var S,_,D,f,L;const{taxExcluded:w,taxIncluded:I}=j,a=V((i,t,s)=>l(z,{amount:i,currency:t,weight:"normal",...s}),[]),T=V(i=>{var s,x;const t=(s=i==null?void 0:i.product)!=null&&s.thumbnail.url.length?(x=i==null?void 0:i.product)==null?void 0:x.thumbnail.url:o;return l(A,{src:t,alt:i==null?void 0:i.productName,loading:"lazy",width:"90",height:"120"})},[o]);if(!e)return l(Q,{});let P={};const N=Z==="cancelled",W=(_=(S=e==null?void 0:e.product)==null?void 0:S.stockStatus)==null?void 0:_.includes("IN_STOCK"),n=e==null?void 0:e.giftCard,$=e.totalQuantity>1?{quantity:e.totalQuantity}:{},u=e.discounted,{includeAndExcludeTax:c,includeTax:h,excludeTax:r}=e.taxCalculations,m=e==null?void 0:e.totalQuantity,d={...(e==null?void 0:e.configurableOptions)||{},...(e==null?void 0:e.bundleOptions)||{},...n!=null&&n.senderName?{[g.sender]:n==null?void 0:n.senderName}:{},...n!=null&&n.senderEmail?{[g.sender]:n==null?void 0:n.senderEmail}:{},...n!=null&&n.senderName?{[g.sender]:n==null?void 0:n.senderName}:{},...n!=null&&n.recipientEmail?{[g.recipient]:n==null?void 0:n.recipientEmail}:{},...n!=null&&n.message?{[g.message]:n==null?void 0:n.message}:{},...e!=null&&e.downloadableLinks?{[`${(D=e==null?void 0:e.downloadableLinks)==null?void 0:D.count} ${g.downloadableCount}`]:(f=e==null?void 0:e.downloadableLinks)==null?void 0:f.result}:{}};if(I&&w){const i=a(c.originalPrice.value,c.originalPrice.currency),t=a(c.baseOriginalPrice.value*m,c.baseOriginalPrice.currency,{variant:e.discounted?"strikethrough":"default",weight:"bold"}),s=a(c.baseDiscountedPrice.value*m,c.baseDiscountedPrice.currency,{sale:!0,weight:"bold"}),x=a(c.baseExcludingTax.value*m,c.baseExcludingTax.currency,{weight:"bold"});P={taxExcluded:!0,taxIncluded:void 0,price:i,total:y(E,{children:[t,e.discounted?s:null]}),totalExcludingTax:x}}else if(!I&&w){const i=a(r.originalPrice.value,r.originalPrice.currency),t=a(r.baseOriginalPrice.value*m,r.baseOriginalPrice.currency,{variant:u?"strikethrough":"default",weight:"bold"}),s=a(r.baseDiscountedPrice.value*m,r.baseDiscountedPrice.currency,{sale:!0,weight:"bold"}),x=a(r.baseExcludingTax.value*m,r.baseExcludingTax.currency,{weight:"bold"});P={taxExcluded:void 0,taxIncluded:void 0,price:i,total:y(E,{children:[t,u?s:null]}),totalExcludingTax:x}}else if(I&&!w){const i=a(h.singleItemPrice.value,h.singleItemPrice.currency),t=a(h.baseOriginalPrice.value*m,h.baseOriginalPrice.currency,{variant:u?"strikethrough":"default",weight:"bold"}),s=a(h.baseDiscountedPrice.value*m,h.baseDiscountedPrice.currency,{sale:!0,weight:"bold"});P={taxExcluded:void 0,taxIncluded:!0,price:i,total:y(E,{children:[t,u?s:null]})}}return l(B,{loading:M,alert:N&&W?y("span",{children:[l(F,{source:R}),g.outOfStock]}):l(E,{}),configurations:(k==null?void 0:k(d))??d,title:v?l("a",{"data-testid":"product-name",className:H(["cart-summary-item__title",["cart-summary-item__title--strikethrough",N]]),href:v(e),children:e==null?void 0:e.productName}):l("div",{"data-testid":"product-name",className:H(["cart-summary-item__title",["cart-summary-item__title--strikethrough",N]]),children:e==null?void 0:e.productName}),sku:l("div",{children:(L=e==null?void 0:e.product)==null?void 0:L.sku}),...$,image:v?l("a",{href:v(e),children:T(e)}):T(e),...P,footer:b&&!q?l(K,{value:1,min:1,max:e==null?void 0:e.totalQuantity,onValue:i=>b==null?void 0:b(Number(i)),name:"quantity","data-testid":"returnIncrementer",readonly:!0}):void 0})};export{C,R as S}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js index 10df655718..c7383661f4 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./ShippingStatusCard.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as d}from"@dropins/tools/event-bus.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js index cf9eb06f10..6ee0839e52 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as e,jsxs as a}from"@dropins/tools/preact-jsx-runtime.js";import"./ShippingStatusCard.js";import{Card as d,Skeleton as i,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import{classes as m}from"@dropins/tools/lib.js";const z=({testId:s,withCard:n=!0})=>{const l=a(i,{"data-testid":s??"skeletonLoader",children:[e(r,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return n?l:e(d,{variant:"secondary",className:m(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},v=s=>e(d,{variant:"secondary",...s,children:a(i,{"data-testid":"order-details-skeleton",children:[e(r,{variant:"heading",size:"medium",fullWidth:!0}),e(r,{size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"})]})}),g=()=>a(i,{"data-testid":"order-product-list-skeleton",style:{gridTemplateColumns:"1fr"},children:[e(r,{variant:"heading",fullWidth:!0,size:"medium"}),e(t,{}),e(t,{}),e(t,{}),e(t,{}),e(t,{})]}),p=()=>a(i,{"data-testid":"order-cost-summary-content-skeleton",className:"order-cost-summary-content",children:[e(r,{variant:"heading",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"heading",size:"small",fullWidth:!0,lines:3})]}),f=()=>a(i,{"data-testid":"order-header-skeleton",className:"order-header",children:[e(r,{variant:"empty",size:"xlarge",fullWidth:!0}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"small",fullWidth:!0}),e(r,{variant:"heading",size:"xsmall",fullWidth:!0})]});export{z as C,v as D,p as O,g as a,f as b}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index dd9c2eeb08..e57f8e580b 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as c,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as V}from"@dropins/tools/preact-hooks.js";import{classes as R,Slot as Q}from"@dropins/tools/lib.js";import{IllustratedMessage as n1,Icon as S,Card as U,ContentGrid as a1,Image as c1,Header as J,Pagination as L1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as i1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as T}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as W}from"./OrderLoaders.js";import{c as s1}from"./capitalizeFirst.js";import{Text as X}from"@dropins/tools/i18n.js";const Y=L=>l.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",...L},l.createElement("g",{id:"Large"},l.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),l.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},l.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"})))),d1=L=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...L},l.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"})),K=({typeList:L,isEmpty:C,minifiedView:g,message:M})=>{const t=i1(()=>{switch(L){case"orders":return{icon:d1,text:r("p",{children:M}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,M]);return!C||!L||!t.text?null:r(n1,{className:R(["order-empty-list",t.className,g?"order-empty-list--minified":""]),message:t.text,icon:r(S,{source:t.icon}),"data-testid":"emptyList"})},I={size:"32",stroke:"2"},v1=({placeholderImage:L,minifiedViewKey:C,withReturnNumber:g=!1,withOrderNumber:M=!1,slots:t,pageInfo:i,withReturnsListButton:A=!0,isMobile:$=!1,returnsInMinifiedView:D=1,translations:a={},orderReturns:s=[],minifiedView:h=!1,withHeader:f=!0,withThumbnails:B=!0,selectedPage:k=1,handleSetSelectPage:z,routeReturnDetails:d,routeOrderDetails:v,routeTracking:b,routeReturnsList:x,routeProductDetails:m,loading:y})=>{const F=h?D:s.length,j=m!=null&&m()?"a":"span",H=V(()=>s.slice(0,F).map((e,t1)=>{var G,q;const w=((e==null?void 0:e.items)??[]).reduce((n,u)=>(u.requestQuantity??0)+n,0);return r(U,{variant:"secondary",className:"order-returns-list-content__cards-list",children:c("div",{className:"order-returns-list-content__cards-grid",children:[c("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:T(e.returnStatus)?r(X,{id:`Order.Returns.${C}.returnsList.returnStatus.${T(e.returnStatus)}`}):r("span",{children:s1(e.returnStatus)})}),g?c("p",{children:[a.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?c("p",{children:[a.orderNumber," ",r("a",{href:(v==null?void 0:v({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(G=e==null?void 0:e.tracking)==null?void 0:G.map((n,u)=>{var _,p;const Z={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((_=n==null?void 0:n.carrier)==null?void 0:_.label)??""},E=b==null?void 0:b(Z),o=`${Z.number}_${u}`;return c("p",{children:[`${a.carrier} `,`${(p=Z.carrier)==null?void 0:p.toLocaleUpperCase()} | `,E?r("a",{href:E,target:"_blank",rel:"noreferrer","data-testid":`${o}_link`,children:n.trackingNumber}):r("span",{"data-testid":`${o}_span`,children:n.trackingNumber})]},o)}),t!=null&&t.ReturnItemsDetails?r(Q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):null,!(t!=null&&t.ReturnItemsDetails)&&e.items.length?c("p",{children:[w," ",r(X,{id:`Order.Returns.${C}.returnsList.itemText`,plural:w,fields:{count:w}})]}):null]}),B?r(a1,{maxColumns:$?3:9,emptyGridContent:r(N,{}),className:R(["order-returns-list-content__images",["order-returns-list-content__images-3",$]]),children:(q=e==null?void 0:e.items)==null?void 0:q.map((n,u)=>{var _,p,O,P;const Z=(_=n.thumbnail)==null?void 0:_.label,E=(O=(p=n.thumbnail)==null?void 0:p.url)!=null&&O.length?(P=n.thumbnail)==null?void 0:P.url:L,o=`key_${u}_${n.uid}`;return r(j,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(c1,{alt:Z,src:E,width:85,height:114})},o)})}):null,t!=null&&t.DetailsActionParams?r(Q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(S,{source:Y,...I})})]})},t1)}),[s,F,C,g,a,M,t,B,$,L,j,b,m,d,v]),r1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,y?r(W,{withCard:!1}):c(N,{children:[H,r(K,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),A?r("a",{className:"order-returns-list-content__actions",href:(x==null?void 0:x())??"#",children:r(U,{variant:"secondary",className:"order-returns-list-content__card",children:c("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(S,{source:Y,...I})]})})}):null]})]}),[x,A,f,a,H,h,s.length,y]),e1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,y?r(W,{withCard:!1}):c(N,{children:[r(K,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),H,(i==null?void 0:i.totalPages)>1?r(L1,{totalPages:i==null?void 0:i.totalPages,currentPage:k,onChange:z}):null]})]}),[H,h,s,a,i==null?void 0:i.totalPages,k,z,y,f]);return r("div",{className:"order-returns-list-content",children:h?r1:e1})};export{v1 as R}; +import{jsx as r,jsxs as c,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as V}from"@dropins/tools/preact-hooks.js";import{classes as R,Slot as Q}from"@dropins/tools/lib.js";import{IllustratedMessage as n1,Icon as S,Card as U,ContentGrid as a1,Image as c1,Header as J,Pagination as L1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as i1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as T}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as W}from"./OrderLoaders.js";import{c as s1}from"./capitalizeFirst.js";import{Text as X}from"@dropins/tools/i18n.js";const Y=L=>l.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",...L},l.createElement("g",{id:"Large"},l.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),l.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},l.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"})))),d1=L=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...L},l.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"})),K=({typeList:L,isEmpty:C,minifiedView:g,message:M})=>{const t=i1(()=>{switch(L){case"orders":return{icon:d1,text:r("p",{children:M}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,M]);return!C||!L||!t.text?null:r(n1,{className:R(["order-empty-list",t.className,g?"order-empty-list--minified":""]),message:t.text,icon:r(S,{source:t.icon}),"data-testid":"emptyList"})},I={size:"32",stroke:"2"},v1=({placeholderImage:L,minifiedViewKey:C,withReturnNumber:g=!1,withOrderNumber:M=!1,slots:t,pageInfo:i,withReturnsListButton:A=!0,isMobile:$=!1,returnsInMinifiedView:D=1,translations:a={},orderReturns:s=[],minifiedView:h=!1,withHeader:f=!0,withThumbnails:B=!0,selectedPage:k=1,handleSetSelectPage:z,routeReturnDetails:d,routeOrderDetails:v,routeTracking:b,routeReturnsList:x,routeProductDetails:m,loading:y})=>{const F=h?D:s.length,j=m!=null&&m()?"a":"span",H=V(()=>s.slice(0,F).map((e,t1)=>{var G,q;const w=((e==null?void 0:e.items)??[]).reduce((n,u)=>(u.requestQuantity??0)+n,0);return r(U,{variant:"secondary",className:"order-returns-list-content__cards-list",children:c("div",{className:"order-returns-list-content__cards-grid",children:[c("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:T(e.returnStatus)?r(X,{id:`Order.Returns.${C}.returnsList.returnStatus.${T(e.returnStatus)}`}):r("span",{children:s1(e.returnStatus)})}),g?c("p",{children:[a.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?c("p",{children:[a.orderNumber," ",r("a",{href:(v==null?void 0:v({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(G=e==null?void 0:e.tracking)==null?void 0:G.map((n,u)=>{var _,p;const Z={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((_=n==null?void 0:n.carrier)==null?void 0:_.label)??""},E=b==null?void 0:b(Z),o=`${Z.number}_${u}`;return c("p",{children:[`${a.carrier} `,`${(p=Z.carrier)==null?void 0:p.toLocaleUpperCase()} | `,E?r("a",{href:E,target:"_blank",rel:"noreferrer","data-testid":`${o}_link`,children:n.trackingNumber}):r("span",{"data-testid":`${o}_span`,children:n.trackingNumber})]},o)}),t!=null&&t.ReturnItemsDetails?r(Q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):null,!(t!=null&&t.ReturnItemsDetails)&&e.items.length?c("p",{children:[w," ",r(X,{id:`Order.Returns.${C}.returnsList.itemText`,plural:w,fields:{count:w}})]}):null]}),B?r(a1,{maxColumns:$?3:9,emptyGridContent:r(N,{}),className:R(["order-returns-list-content__images",["order-returns-list-content__images-3",$]]),children:(q=e==null?void 0:e.items)==null?void 0:q.map((n,u)=>{var _,p,O,P;const Z=(_=n.thumbnail)==null?void 0:_.label,E=(O=(p=n.thumbnail)==null?void 0:p.url)!=null&&O.length?(P=n.thumbnail)==null?void 0:P.url:L,o=`key_${u}_${n.uid}`;return r(j,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(c1,{alt:Z,src:E??"",width:85,height:114})},o)})}):null,t!=null&&t.DetailsActionParams?r(Q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(S,{source:Y,...I})})]})},t1)}),[s,F,C,g,a,M,t,B,$,L,j,b,m,d,v]),r1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,y?r(W,{withCard:!1}):c(N,{children:[H,r(K,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),A?r("a",{className:"order-returns-list-content__actions",href:(x==null?void 0:x())??"#",children:r(U,{variant:"secondary",className:"order-returns-list-content__card",children:c("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(S,{source:Y,...I})]})})}):null]})]}),[x,A,f,a,H,h,s.length,y]),e1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,y?r(W,{withCard:!1}):c(N,{children:[r(K,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),H,(i==null?void 0:i.totalPages)>1?r(L1,{totalPages:i==null?void 0:i.totalPages,currentPage:k,onChange:z}):null]})]}),[H,h,s,a,i==null?void 0:i.totalPages,k,z,y,f]);return r("div",{className:"order-returns-list-content",children:h?r1:e1})};export{v1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js b/scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js index 3d86843b29..7e20294005 100644 --- a/scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js +++ b/scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as h,Fragment as v,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as _,useState as D,useEffect as w,useCallback as T}from"@dropins/tools/preact-hooks.js";import{useText as y}from"@dropins/tools/i18n.js";import*as C from"@dropins/tools/preact-compat.js";import{memo as V,useCallback as L}from"@dropins/tools/preact-compat.js";import{classes as k}from"@dropins/tools/lib.js";import{Field as q,Picker as A,Input as I,InputDate as R,Checkbox as O,TextArea as N}from"@dropins/tools/components.js";const j=l=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...l},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),H=l=>l.reduce((u,{code:i,required:$,defaultValue:s})=>($&&(u[i]=s),u),{}),S=({fieldsConfig:l,onSubmit:u})=>{const{requiredFieldError:i}=y({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),$=_(null),[s,n]=D({}),[o,t]=D({});w(()=>{if(n({}),!l||!l.length)return;const c=H(l);n(c)},[l==null?void 0:l.length]),w(()=>()=>{var c;n({}),(c=$.current)==null||c.reset()},[]);const p=T((c,e)=>{const r=l.find(d=>d.code===c);return r!=null&&r.required&&!e?i:""},[l,i]),b=T(c=>{const{name:e,value:r,type:a,checked:d}=c==null?void 0:c.target,f=a==="checkbox"?d:r;n(E=>({...E,[e]:f}))},[]),x=T(c=>{const{name:e,value:r,type:a,checked:d}=c==null?void 0:c.target,f=a==="checkbox"?d:r;t(E=>({...E,[e]:p(e,f)}))},[p]),F=T(c=>{c.preventDefault();let e=!0,r={},a=null;for(const[d,f]of Object.entries(s)){const E=p(d,f);E&&(r[d]=E,e=!1,a||(a=d))}if(t(r),a&&$.current){const d=$.current.elements.namedItem(a);d==null||d.focus()}u==null||u(c,e)},[s,p,u]);return{formData:s,errors:o,formRef:$,handleChange:b,handleBlur:x,handleSubmit:F}},U=V(({loading:l,values:u,fields:i=[],errors:$,className:s="",onChange:n,onBlur:o})=>{const t=`${s}__item`,p=L((e,r,a)=>{const d=e.options.map(f=>({text:f.label,value:f.value}));return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(A,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:d,onBlur:o,handleSelect:n,value:r||e.defaultValue})},e.id)},[s,l,t,o,n]),b=L((e,r,a)=>{const d=e.id==="email",f=d?h(j,{}):void 0,E=d?"username":"";return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e==null?void 0:e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(I,{"aria-label":e.label,"aria-required":e.required,autoComplete:E,icon:f,type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id)},[s,l,t,o,n]),x=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(R,{type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]),F=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(O,{name:e.id,checked:r||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]),c=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(N,{type:"text",name:e.id,value:r===void 0?e.defaultValue:r,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]);return i.length?h(v,{children:i.map(e=>{var d;const r=($==null?void 0:$[e.id])??"",a=(u==null?void 0:u[e.id])??"";switch(e.fieldType){case"TEXT":return(d=e==null?void 0:e.options)!=null&&d.length?p(e,a,r):b(e,a,r);case"MULTILINE":return b(e,a,r);case"SELECT":return p(e,a,r);case"DATE":return x(e,a,r);case"BOOLEAN":return F(e,a,r);case"TEXTAREA":return c(e,a,r);default:return null}})}):null}),K=V(({name:l,loading:u,children:i,className:$="defaultForm",fieldsConfig:s,onSubmit:n})=>{const{formData:o,errors:t,formRef:p,handleChange:b,handleBlur:x,handleSubmit:F}=S({fieldsConfig:s,onSubmit:n});return M("form",{className:k(["order-form",$]),onSubmit:F,name:l,ref:p,children:[h(U,{className:$,loading:u,fields:s,onChange:b,onBlur:x,errors:t,values:o}),i]})});export{K as F,U as a,S as u}; diff --git a/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js b/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js index a8297f4927..8b4054f020 100644 --- a/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js +++ b/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const a=e=>e&&e.charAt(0).toLocaleUpperCase()+e.slice(1).toLocaleLowerCase();export{a as c}; diff --git a/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js index dce1a5dfeb..8384a7e04f 100644 --- a/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js +++ b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{h as f}from"./network-error.js";import{f as u,h as _}from"./fetch-graphql.js";import{REQUEST_RETURN_ORDER_FRAGMENT as I,GUEST_ORDER_FRAGMENT as O}from"../fragments.js";import{a}from"./initialize.js";import{events as T}from"@dropins/tools/event-bus.js";const N=` mutation REORDER_ITEMS_MUTATION($orderNumber: String!) { diff --git a/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js b/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js index 75489de79e..034be55074 100644 --- a/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const h=e=>{const r=e.map(a=>a.message).join(" ");throw Error(r)},{setEndpoint:o,setFetchGraphQlHeader:c,removeFetchGraphQlHeader:n,setFetchGraphQlHeaders:p,fetchGraphQl:d,getConfig:g}=new s().getMethods();export{c as a,p as b,d as f,g,h,n as r,o as s}; diff --git a/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js b/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js index a6dca51049..10ee06c599 100644 --- a/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js +++ b/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const m=(e,a="en-US",o={})=>{const n={...{day:"2-digit",month:"2-digit",year:"numeric"},...o},t=new Date(e);return isNaN(t.getTime())?"Invalid Date":new Intl.DateTimeFormat(a,n).format(t)};export{m as f}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index 0600701db6..731a0a31b8 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql.js";import{t as m}from"./transform-attributes-form.js";const n=` query GET_ATTRIBUTES_FORM($formCode: String!) { diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js index 6117fe0a7b..2925ae22a0 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{h as R}from"./network-error.js";import{RETURNS_FRAGMENT as E,PRODUCT_DETAILS_FRAGMENT as T,PRICE_DETAILS_FRAGMENT as _,GIFT_CARD_DETAILS_FRAGMENT as o,ORDER_ITEM_DETAILS_FRAGMENT as c}from"../fragments.js";import{t as n}from"./initialize.js";import{f as u}from"./fetch-graphql.js";const m=` query GET_CUSTOMER_ORDERS_RETURN($currentPage: Int, $pageSize: Int) { diff --git a/scripts/__dropins__/storefront-order/chunks/getFormValues.js b/scripts/__dropins__/storefront-order/chunks/getFormValues.js index 7c6404646c..b8009fb976 100644 --- a/scripts/__dropins__/storefront-order/chunks/getFormValues.js +++ b/scripts/__dropins__/storefront-order/chunks/getFormValues.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ var r=(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))(r||{});const D=E=>{if(!E)return null;const T=new FormData(E);if(E.querySelectorAll('input[type="checkbox"]').forEach(I=>{T.has(I.name)||T.set(I.name,"false"),I.checked&&T.set(I.name,"true")}),T&&typeof T.entries=="function"){const I=T.entries();if(I&&typeof I[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(I)))||{}}return{}};export{r as F,D as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js index 242cdc1892..bbe0a84b49 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{h as i}from"./network-error.js";import{f as h,h as o}from"./fetch-graphql.js";import{GUEST_ORDER_FRAGMENT as E}from"../fragments.js";import{b as n}from"./initialize.js";const G=t=>{var r,a,m,c,e,u;return{email:((a=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:a.email)||"",firstname:((c=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:c.firstname)||"",lastname:((u=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:u.lastname)||""}},f=` query GET_CUSTOMER { diff --git a/scripts/__dropins__/storefront-order/chunks/getQueryParam.js b/scripts/__dropins__/storefront-order/chunks/getQueryParam.js index 29459cba0e..e7e567dfa4 100644 --- a/scripts/__dropins__/storefront-order/chunks/getQueryParam.js +++ b/scripts/__dropins__/storefront-order/chunks/getQueryParam.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const t=r=>{try{return new URL(window.location.href).searchParams.get(r)??""}catch{return""}};export{t as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js index a164a243a7..4337058dc4 100644 --- a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{f as s,h as i}from"./fetch-graphql.js";function o(e){return e?{baseMediaUrl:e.base_media_url,orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=` +import{f as s,h as i}from"./fetch-graphql.js";function o(e){return e?{baseMediaUrl:e.base_media_url,orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingOrderDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=` query STORE_CONFIG_QUERY { storeConfig { order_cancellation_enabled diff --git a/scripts/__dropins__/storefront-order/chunks/initialize.js b/scripts/__dropins__/storefront-order/chunks/initialize.js index c0cf6c4ba5..c1be8eca93 100644 --- a/scripts/__dropins__/storefront-order/chunks/initialize.js +++ b/scripts/__dropins__/storefront-order/chunks/initialize.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{merge as Q,Initializer as na}from"@dropins/tools/lib.js";import{events as v}from"@dropins/tools/event-bus.js";import{a as ta,h as x}from"./network-error.js";import{PRODUCT_DETAILS_FRAGMENT as K,PRICE_DETAILS_FRAGMENT as j,GIFT_CARD_DETAILS_FRAGMENT as H,ORDER_ITEM_DETAILS_FRAGMENT as J,BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT as V,ORDER_SUMMARY_FRAGMENT as W,ADDRESS_FRAGMENT as X,RETURNS_FRAGMENT as Z}from"../fragments.js";import{f as m,h as _a}from"./fetch-graphql.js";const ua=a=>a||0,ia=a=>{var n,t,_;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((t=a==null?void 0:a.thumbnail)==null?void 0:t.label)||"",url:((_=a==null?void 0:a.thumbnail)==null?void 0:_.url)||""}}},sa=a=>{if(!a||!("selected_options"in a))return;const n={};for(const t of a.selected_options)n[t.label]=t.value;return n},la=a=>{const n=a==null?void 0:a.map(_=>({uid:_.uid,label:_.label,values:_.values.map(i=>i.product_name).join(", ")})),t={};return n==null||n.forEach(_=>{t[_.label]=_.values}),Object.keys(t).length>0?t:null},ea=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,ca=a=>({quantityCanceled:(a==null?void 0:a.quantity_canceled)??0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)??0,quantityOrdered:(a==null?void 0:a.quantity_ordered)??0,quantityRefunded:(a==null?void 0:a.quantity_refunded)??0,quantityReturned:(a==null?void 0:a.quantity_returned)??0,quantityShipped:(a==null?void 0:a.quantity_shipped)??0,quantityReturnRequested:(a==null?void 0:a.quantity_return_requested)??0}),I=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var T,c,R,O,N,b,h,g,r,D,u,A,y,p,G,f,F,S,C,q,d,k,B,$,U,w,o,P,z,Y;const{quantityCanceled:t,quantityInvoiced:_,quantityOrdered:i,quantityRefunded:s,quantityReturned:l,quantityShipped:e,quantityReturnRequested:E}=ca(n);return{type:n==null?void 0:n.__typename,eligibleForReturn:n==null?void 0:n.eligible_for_return,productSku:n==null?void 0:n.product_sku,productName:n.product_name,productUrlKey:n.product_url_key,quantityCanceled:t,quantityInvoiced:_,quantityOrdered:i,quantityRefunded:s,quantityReturned:l,quantityShipped:e,quantityReturnRequested:E,id:n==null?void 0:n.id,discounted:((O=(R=(c=(T=n==null?void 0:n.product)==null?void 0:T.price_range)==null?void 0:c.maximum_price)==null?void 0:R.regular_price)==null?void 0:O.value)*(n==null?void 0:n.quantity_ordered)!==((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)*(n==null?void 0:n.quantity_ordered),total:{value:((b=n==null?void 0:n.product_sale_price)==null?void 0:b.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((h=n==null?void 0:n.product_sale_price)==null?void 0:h.currency)||""},totalInclTax:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(r=n==null?void 0:n.product_sale_price)==null?void 0:r.currency},price:{value:((D=n==null?void 0:n.product_sale_price)==null?void 0:D.value)||0,currency:(u=n==null?void 0:n.product_sale_price)==null?void 0:u.currency},priceInclTax:{value:((A=n==null?void 0:n.product_sale_price)==null?void 0:A.value)||0,currency:(y=n==null?void 0:n.product_sale_price)==null?void 0:y.currency},totalQuantity:ua(n==null?void 0:n.quantity_ordered),regularPrice:{value:(F=(f=(G=(p=n==null?void 0:n.product)==null?void 0:p.price_range)==null?void 0:G.maximum_price)==null?void 0:f.regular_price)==null?void 0:F.value,currency:(d=(q=(C=(S=n==null?void 0:n.product)==null?void 0:S.price_range)==null?void 0:C.maximum_price)==null?void 0:q.regular_price)==null?void 0:d.currency},product:ia(n==null?void 0:n.product),thumbnail:{label:((B=(k=n==null?void 0:n.product)==null?void 0:k.thumbnail)==null?void 0:B.label)||"",url:((U=($=n==null?void 0:n.product)==null?void 0:$.thumbnail)==null?void 0:U.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((w=n.gift_card)==null?void 0:w.sender_name)||"",senderEmail:((o=n.gift_card)==null?void 0:o.sender_email)||"",recipientEmail:((P=n.gift_card)==null?void 0:P.recipient_email)||"",recipientName:((z=n.gift_card)==null?void 0:z.recipient_name)||"",message:((Y=n.gift_card)==null?void 0:Y.message)||""}:void 0,configurableOptions:sa(n),bundleOptions:n.__typename==="BundleOrderItem"?la(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?ea(n==null?void 0:n.downloadable_links):null}}),L=(a,n)=>{var O,N,b,h,g,r,D,u,A;const t=I(a.items),_=((O=Ea(a==null?void 0:a.returns))==null?void 0:O.ordersReturn)??[],i=n?_.filter(y=>y.returnNumber===n):_,{total:s,...l}=ta({...a,items:t,returns:i},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),e=(N=a==null?void 0:a.payment_methods)==null?void 0:N[0],E=(e==null?void 0:e.type)||"",T=(e==null?void 0:e.name)||"",c=(b=l==null?void 0:l.items)==null?void 0:b.reduce((y,p)=>y+(p==null?void 0:p.totalQuantity),0),R={...s,...l,totalQuantity:c,shipping:{amount:((h=s==null?void 0:s.totalShipping)==null?void 0:h.value)??0,currency:((g=s==null?void 0:s.totalShipping)==null?void 0:g.currency)||"",code:l.shippingMethod??""},payments:[{code:E,name:T}]};return Q(R,(A=(u=(D=(r=M==null?void 0:M.getConfig())==null?void 0:r.models)==null?void 0:D.OrderDataModel)==null?void 0:u.transformer)==null?void 0:A.call(u,a))},Ra=(a,n,t)=>{var _,i,s,l,e,E,T;if((l=(s=(i=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:i.orders)==null?void 0:s.items)!=null&&l.length&&a==="orderData"){const c=(T=(E=(e=n==null?void 0:n.data)==null?void 0:e.customer)==null?void 0:E.orders)==null?void 0:T.items[0];return L(c,t)}return null},Ea=a=>{var s,l,e,E,T;if(!((s=a==null?void 0:a.items)!=null&&s.length))return null;const n=a==null?void 0:a.items,t=a==null?void 0:a.page_info,i={ordersReturn:[...n].sort((c,R)=>+R.number-+c.number).map(c=>{var r,D;const{order:R,status:O,number:N,created_at:b}=c,h=((D=(r=c==null?void 0:c.shipping)==null?void 0:r.tracking)==null?void 0:D.map(u=>{const{status:A,carrier:y,tracking_number:p}=u;return{status:A,carrier:y,trackingNumber:p}}))??[],g=c.items.map(u=>{var S;const A=u==null?void 0:u.quantity,y=u==null?void 0:u.status,p=u==null?void 0:u.request_quantity,G=u==null?void 0:u.uid,f=u==null?void 0:u.order_item,F=((S=I([f]))==null?void 0:S.reduce((C,q)=>q,{}))??{};return{uid:G,quantity:A,status:y,requestQuantity:p,...F}});return{createdReturnAt:b,returnStatus:O,token:R==null?void 0:R.token,orderNumber:R==null?void 0:R.number,returnNumber:N,items:g,tracking:h}}),...t?{pageInfo:{pageSize:t.page_size,totalPages:t.total_pages,currentPage:t.current_page}}:{}};return Q(i,(T=(E=(e=(l=M==null?void 0:M.getConfig())==null?void 0:l.models)==null?void 0:e.CustomerOrdersReturnModel)==null?void 0:E.transformer)==null?void 0:T.call(E,{...n,...t}))},Sa=(a,n)=>{var _,i;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrder))return null;const t=(i=a==null?void 0:a.data)==null?void 0:i.guestOrder;return L(t,n)},Ta=(a,n)=>{var _,i;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrderByToken))return null;const t=(i=a==null?void 0:a.data)==null?void 0:i.guestOrderByToken;return L(t,n)},ya=` +import{merge as z,Initializer as m}from"@dropins/tools/lib.js";import{events as L}from"@dropins/tools/event-bus.js";import{h as Y}from"./network-error.js";import{PRODUCT_DETAILS_FRAGMENT as Q,PRICE_DETAILS_FRAGMENT as K,GIFT_CARD_DETAILS_FRAGMENT as j,ORDER_ITEM_DETAILS_FRAGMENT as P,BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT as D,ORDER_SUMMARY_FRAGMENT as V,ADDRESS_FRAGMENT as X,RETURNS_FRAGMENT as H}from"../fragments.js";import{f as J,h as o}from"./fetch-graphql.js";const r=n=>n||0,I=n=>{var i,u,_,l,c,s,E,y,T;return{__typename:(n==null?void 0:n.__typename)||"",uid:(n==null?void 0:n.uid)||"",onlyXLeftInStock:(n==null?void 0:n.only_x_left_in_stock)??0,stockStatus:(n==null?void 0:n.stock_status)??"",priceRange:{maximumPrice:{regularPrice:{currency:((_=(u=(i=n==null?void 0:n.price_range)==null?void 0:i.maximum_price)==null?void 0:u.regular_price)==null?void 0:_.currency)??"",value:((s=(c=(l=n==null?void 0:n.price_range)==null?void 0:l.maximum_price)==null?void 0:c.regular_price)==null?void 0:s.value)??0}}},canonicalUrl:(n==null?void 0:n.canonical_url)??"",urlKey:(n==null?void 0:n.url_key)||"",id:(n==null?void 0:n.uid)??"",name:(n==null?void 0:n.name)||"",sku:(n==null?void 0:n.sku)||"",image:((E=n==null?void 0:n.image)==null?void 0:E.url)||"",productType:(n==null?void 0:n.__typename)||"",thumbnail:{label:((y=n==null?void 0:n.thumbnail)==null?void 0:y.label)||"",url:((T=n==null?void 0:n.thumbnail)==null?void 0:T.url)||""}}},d=n=>{if(!n||!("selected_options"in n))return;const i={};for(const u of n.selected_options)i[u.label]=u.value;return i},nn=n=>{const i=n==null?void 0:n.map(_=>({uid:_.uid,label:_.label,values:_.values.map(l=>l.product_name).join(", ")})),u={};return i==null||i.forEach(_=>{u[_.label]=_.values}),Object.keys(u).length>0?u:null},un=n=>(n==null?void 0:n.length)>0?{count:n.length,result:n.map(i=>i.title).join(", ")}:null,_n=n=>({quantityCanceled:(n==null?void 0:n.quantity_canceled)??0,quantityInvoiced:(n==null?void 0:n.quantity_invoiced)??0,quantityOrdered:(n==null?void 0:n.quantity_ordered)??0,quantityRefunded:(n==null?void 0:n.quantity_refunded)??0,quantityReturned:(n==null?void 0:n.quantity_returned)??0,quantityShipped:(n==null?void 0:n.quantity_shipped)??0,quantityReturnRequested:(n==null?void 0:n.quantity_return_requested)??0}),ln=n=>({firstName:(n==null?void 0:n.firstname)??"",lastName:(n==null?void 0:n.lastname)??"",middleName:(n==null?void 0:n.middlename)??""}),$=n=>{const{firstName:i,lastName:u,middleName:_}=ln(n);return{firstName:i,lastName:u,middleName:_,city:(n==null?void 0:n.city)??"",company:(n==null?void 0:n.company)??"",country:(n==null?void 0:n.country)??"",countryCode:(n==null?void 0:n.country_code)??"",fax:(n==null?void 0:n.fax)??"",postCode:(n==null?void 0:n.postcode)??"",prefix:(n==null?void 0:n.prefix)??"",region:(n==null?void 0:n.region)??"",regionId:(n==null?void 0:n.region_id)??"",street:(n==null?void 0:n.street)??[],suffix:(n==null?void 0:n.suffix)??"",telephone:(n==null?void 0:n.telephone)??"",vatId:(n==null?void 0:n.vat_id)??"",customAttributes:(n==null?void 0:n.custom_attributes)??[]}},cn=n=>{const i={value:0,currency:"USD"};return{grandTotal:(n==null?void 0:n.grand_total)??i,totalGiftcard:(n==null?void 0:n.total_giftcard)??i,subtotalExclTax:(n==null?void 0:n.subtotal_excl_tax)??i,subtotalInclTax:(n==null?void 0:n.subtotal_incl_tax)??i,taxes:(n==null?void 0:n.taxes)??[],totalTax:(n==null?void 0:n.total_tax)??i,totalShipping:(n==null?void 0:n.total_shipping)??i,discounts:(n==null?void 0:n.discounts)??[]}},w=n=>{const i={value:0,currency:"USD"},u=(n==null?void 0:n.prices)??{};return{price:(u==null?void 0:u.price)??i,priceIncludingTax:(u==null?void 0:u.price_including_tax)??i,originalPrice:(u==null?void 0:u.original_price)??i,originalPriceIncludingTax:(u==null?void 0:u.original_price_including_tax)??i,discounts:(u==null?void 0:u.discounts)??[]}},an=(n,i,u)=>{const _=n==null?void 0:n.price,l=n==null?void 0:n.priceIncludingTax,c=n==null?void 0:n.originalPrice,s=u?c==null?void 0:c.value:l==null?void 0:l.value,E={originalPrice:c,baseOriginalPrice:{value:s,currency:c==null?void 0:c.currency},baseDiscountedPrice:{value:l==null?void 0:l.value,currency:l==null?void 0:l.currency},baseExcludingTax:{value:_==null?void 0:_.value,currency:_==null?void 0:_.currency}},y={originalPrice:c,baseOriginalPrice:{value:c==null?void 0:c.value,currency:l==null?void 0:l.currency},baseDiscountedPrice:{value:i==null?void 0:i.value,currency:_==null?void 0:_.currency},baseExcludingTax:{value:_==null?void 0:_.value,currency:_==null?void 0:_.currency}},T={singleItemPrice:{value:u?c.value:l.value,currency:l.currency},baseOriginalPrice:{value:s,currency:l.currency},baseDiscountedPrice:{value:l.value,currency:l.currency}};return{includeAndExcludeTax:E,excludeTax:y,includeTax:T}},tn=n=>{var i,u,_,l,c;return{senderName:((i=n.gift_card)==null?void 0:i.sender_name)||"",senderEmail:((u=n.gift_card)==null?void 0:u.sender_email)||"",recipientEmail:((_=n.gift_card)==null?void 0:_.recipient_email)||"",recipientName:((l=n.gift_card)==null?void 0:l.recipient_name)||"",message:((c=n.gift_card)==null?void 0:c.message)||""}},sn=n=>{var i,u,_,l;return{label:((u=(i=n==null?void 0:n.product)==null?void 0:i.thumbnail)==null?void 0:u.label)||"",url:((l=(_=n==null?void 0:n.product)==null?void 0:_.thumbnail)==null?void 0:l.url)||""}},W=n=>{var G,e,F,q,x,f,N,t,A,h,O,S,v,M,p,k,g,b;const{quantityCanceled:i,quantityInvoiced:u,quantityOrdered:_,quantityRefunded:l,quantityReturned:c,quantityShipped:s,quantityReturnRequested:E}=_n(n),y=w(n),T=((G=n==null?void 0:n.prices)==null?void 0:G.original_price.value)*(n==null?void 0:n.quantity_ordered)>((e=n==null?void 0:n.prices)==null?void 0:e.price.value)*(n==null?void 0:n.quantity_ordered),a=r(n==null?void 0:n.quantity_ordered),R={value:((F=n==null?void 0:n.product_sale_price)==null?void 0:F.value)||0,currency:(q=n==null?void 0:n.product_sale_price)==null?void 0:q.currency};return{selectedOptions:(n==null?void 0:n.selected_options)??[],productSalePrice:n==null?void 0:n.product_sale_price,status:(n==null?void 0:n.status)??"",type:n==null?void 0:n.__typename,eligibleForReturn:(n==null?void 0:n.eligible_for_return)??!1,productSku:(n==null?void 0:n.product_sku)??"",productName:(n==null?void 0:n.product_name)??"",productUrlKey:(n==null?void 0:n.product_url_key)??"",quantityCanceled:i,quantityInvoiced:u,quantityOrdered:_,quantityRefunded:l,quantityReturned:c,quantityShipped:s,quantityReturnRequested:E,id:n==null?void 0:n.id,discounted:T,total:{value:((x=n==null?void 0:n.product_sale_price)==null?void 0:x.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((f=n==null?void 0:n.product_sale_price)==null?void 0:f.currency)||""},totalInclTax:{value:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(t=n==null?void 0:n.product_sale_price)==null?void 0:t.currency},price:R,prices:w(n),itemPrices:y,taxCalculations:an(y,R,T),priceInclTax:{value:((A=n==null?void 0:n.product_sale_price)==null?void 0:A.value)??0,currency:(h=n==null?void 0:n.product_sale_price)==null?void 0:h.currency},totalQuantity:a,regularPrice:{value:(M=(v=(S=(O=n==null?void 0:n.product)==null?void 0:O.price_range)==null?void 0:S.maximum_price)==null?void 0:v.regular_price)==null?void 0:M.value,currency:(b=(g=(k=(p=n==null?void 0:n.product)==null?void 0:p.price_range)==null?void 0:k.maximum_price)==null?void 0:g.regular_price)==null?void 0:b.currency},product:I(n==null?void 0:n.product),thumbnail:sn(n),giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?tn(n):void 0,configurableOptions:d(n),bundleOptions:n.__typename==="BundleOrderItem"?nn(n.bundle_options):null,downloadableLinks:n.__typename==="DownloadableOrderItem"?un(n==null?void 0:n.downloadable_links):null}},U=n=>n==null?void 0:n.filter(i=>i.__typename).map(i=>W(i)),Rn=n=>({token:(n==null?void 0:n.token)??"",email:(n==null?void 0:n.email)??"",status:(n==null?void 0:n.status)??"",number:(n==null?void 0:n.number)??"",id:(n==null?void 0:n.id)??"",carrier:n.carrier??"",coupons:(n==null?void 0:n.applied_coupons)??[],orderDate:(n==null?void 0:n.order_date)??"",isVirtual:(n==null?void 0:n.is_virtual)??!1,availableActions:(n==null?void 0:n.available_actions)??[],orderStatusChangeDate:(n==null?void 0:n.order_status_change_date)??"",shippingMethod:(n==null?void 0:n.shipping_method)??""}),B=(n,i)=>{var t,A,h,O,S,v,M,p,k;const u=Rn(n),_=$(n==null?void 0:n.billing_address),l=$(n==null?void 0:n.shipping_address),c=(t=n.shipments)==null?void 0:t.map(g=>({...g,items:g.items.map(b=>({id:b.id,productName:b.product_name,productSku:b.product_sku,quantityShipped:b.quantity_shipped,orderItem:W(b.order_item)}))})),s=U(n.items),E=((A=En(n==null?void 0:n.returns))==null?void 0:A.ordersReturn)??[],y=i?E.filter(g=>g.returnNumber===i):E,T=U(n.items_eligible_for_return),a=cn(n==null?void 0:n.total),R=(h=n==null?void 0:n.payment_methods)==null?void 0:h[0],G=n==null?void 0:n.shipping_method,e=s==null?void 0:s.reduce((g,b)=>g+(b==null?void 0:b.totalQuantity),0),F={amount:((O=a==null?void 0:a.totalShipping)==null?void 0:O.value)??0,currency:((S=a==null?void 0:a.totalShipping)==null?void 0:S.currency)||"",code:(u==null?void 0:u.shippingMethod)??""},q=[{code:(R==null?void 0:R.type)??"",name:(R==null?void 0:R.name)??""}],x=a==null?void 0:a.subtotalExclTax,f=a==null?void 0:a.subtotalInclTax,N={...u,...a,subtotalExclTax:x,subtotalInclTax:f,billingAddress:_,shippingAddress:l,shipments:c,items:s,returns:y,itemsEligibleForReturn:T,totalQuantity:e,shippingMethod:G,shipping:F,payments:q};return z(N,(k=(p=(M=(v=C==null?void 0:C.getConfig())==null?void 0:v.models)==null?void 0:M.OrderDataModel)==null?void 0:p.transformer)==null?void 0:k.call(p,n))},yn=(n,i,u)=>{var _,l,c,s,E,y,T;if((s=(c=(l=(_=i==null?void 0:i.data)==null?void 0:_.customer)==null?void 0:l.orders)==null?void 0:c.items)!=null&&s.length&&n==="orderData"){const a=(T=(y=(E=i==null?void 0:i.data)==null?void 0:E.customer)==null?void 0:y.orders)==null?void 0:T.items[0];return B(a,u)}return null},En=n=>{var c,s,E,y,T;if(!((c=n==null?void 0:n.items)!=null&&c.length))return null;const i=n==null?void 0:n.items,u=n==null?void 0:n.page_info,l={ordersReturn:[...i].sort((a,R)=>+R.number-+a.number).map(a=>{var f,N;const{order:R,status:G,number:e,created_at:F}=a,q=((N=(f=a==null?void 0:a.shipping)==null?void 0:f.tracking)==null?void 0:N.map(t=>{const{status:A,carrier:h,tracking_number:O}=t;return{status:A,carrier:h,trackingNumber:O}}))??[],x=a.items.map(t=>{var p;const A=t==null?void 0:t.quantity,h=t==null?void 0:t.status,O=t==null?void 0:t.request_quantity,S=t==null?void 0:t.uid,v=t==null?void 0:t.order_item,M=((p=U([v]))==null?void 0:p.reduce((k,g)=>g,{}))??{};return{uid:S,quantity:A,status:h,requestQuantity:O,...M}});return{createdReturnAt:F,returnStatus:G,token:R==null?void 0:R.token,orderNumber:R==null?void 0:R.number,returnNumber:e,items:x,tracking:q}}),...u?{pageInfo:{pageSize:u.page_size,totalPages:u.total_pages,currentPage:u.current_page}}:{}};return z(l,(T=(y=(E=(s=C==null?void 0:C.getConfig())==null?void 0:s.models)==null?void 0:E.CustomerOrdersReturnModel)==null?void 0:y.transformer)==null?void 0:T.call(y,{...i,...u}))},Gn=(n,i)=>{var _,l;if(!((_=n==null?void 0:n.data)!=null&&_.guestOrder))return null;const u=(l=n==null?void 0:n.data)==null?void 0:l.guestOrder;return B(u,i)},Tn=(n,i)=>{var _,l;if(!((_=n==null?void 0:n.data)!=null&&_.guestOrderByToken))return null;const u=(l=n==null?void 0:n.data)==null?void 0:l.guestOrderByToken;return B(u,i)},bn=` query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { customer { orders(filter: { number: { eq: $orderNumber } }) { @@ -104,15 +104,15 @@ import{merge as Q,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } + ${Q} ${K} ${j} - ${H} - ${J} + ${P} + ${D} ${V} - ${W} ${X} - ${Z} -`,pa=async({orderId:a,returnRef:n,queryType:t,returnsPageSize:_=50})=>await m(ya,{method:"GET",cache:"force-cache",variables:{orderNumber:a,pageSize:_}}).then(i=>Ra(t??"orderData",i,n)).catch(x),Aa=` + ${H} +`,gn=async({orderId:n,returnRef:i,queryType:u,returnsPageSize:_=50})=>await J(bn,{method:"GET",cache:"force-cache",variables:{orderNumber:n,pageSize:_}}).then(l=>yn(u??"orderData",l,i)).catch(Y),pn=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -201,12 +201,12 @@ import{merge as Q,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } + ${Q} ${K} ${j} - ${H} - ${J} + ${P} + ${D} ${V} - ${W} ${X} - ${Z} -`,ra=async(a,n)=>await m(Aa,{method:"GET",cache:"no-cache",variables:{token:a}}).then(t=>{var _;return(_=t.errors)!=null&&_.length&&t.errors[0].message==="Please login to view the order."?_a(t.errors):Ta(t,n)}).catch(x),Da="orderData",Oa=async a=>{var l;const n=typeof(a==null?void 0:a.orderRef)=="string"?a==null?void 0:a.orderRef:"",t=typeof(a==null?void 0:a.returnRef)=="string"?a==null?void 0:a.returnRef:"",_=n&&typeof(a==null?void 0:a.orderRef)=="string"&&((l=a==null?void 0:a.orderRef)==null?void 0:l.length)>20,i=(a==null?void 0:a.orderData)??null;if(i){v.emit("order/data",{...i,returnNumber:t});return}if(!n)return;const s=_?await ra(n,t):await pa({orderId:n,returnRef:t,queryType:Da});s?v.emit("order/data",{...s,returnNumber:t}):v.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},aa=new na({init:async a=>{const n={};aa.config.setConfig({...n,...a}),Oa(a).catch(console.error)},listeners:()=>[]}),M=aa.config;export{L as a,Sa as b,ra as c,M as d,pa as g,aa as i,Ea as t}; + ${H} +`,An=async(n,i)=>await J(pn,{method:"GET",cache:"no-cache",variables:{token:n}}).then(u=>{var _;return(_=u.errors)!=null&&_.length&&u.errors[0].message==="Please login to view the order."?o(u.errors):Tn(u,i)}).catch(Y),hn="orderData",On=async n=>{var s;const i=typeof(n==null?void 0:n.orderRef)=="string"?n==null?void 0:n.orderRef:"",u=typeof(n==null?void 0:n.returnRef)=="string"?n==null?void 0:n.returnRef:"",_=i&&typeof(n==null?void 0:n.orderRef)=="string"&&((s=n==null?void 0:n.orderRef)==null?void 0:s.length)>20,l=(n==null?void 0:n.orderData)??null;if(l){L.emit("order/data",{...l,returnNumber:u});return}if(!i)return;const c=_?await An(i,u):await gn({orderId:i,returnRef:u,queryType:hn});c?L.emit("order/data",{...c,returnNumber:u}):L.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},Z=new m({init:async n=>{const i={};Z.config.setConfig({...i,...n}),On(n??{}).catch(console.error)},listeners:()=>[]}),C=Z.config;export{B as a,Gn as b,An as c,C as d,gn as g,Z as i,En as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/network-error.js b/scripts/__dropins__/storefront-order/chunks/network-error.js index ba4dbbfadd..4f339a093e 100644 --- a/scripts/__dropins__/storefront-order/chunks/network-error.js +++ b/scripts/__dropins__/storefront-order/chunks/network-error.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{events as f}from"@dropins/tools/event-bus.js";const l=r=>r.replace(/_([a-z])/g,(s,e)=>e.toUpperCase()),i=r=>r.replace(/([A-Z])/g,s=>`_${s.toLowerCase()}`),u=(r,s,e)=>{const c=["string","boolean","number"],a=s==="camelCase"?l:i;return Array.isArray(r)?r.map(o=>c.includes(typeof o)||o===null?o:typeof o=="object"?u(o,s,e):o):r!==null&&typeof r=="object"?Object.entries(r).reduce((o,[t,n])=>{const p=e&&e[t]?e[t]:a(t);return o[p]=c.includes(typeof n)||n===null?n:u(n,s,e),o},{}):r},C=r=>{const s=r instanceof DOMException&&r.name==="AbortError",e=r.name==="PlaceOrderError";throw!s&&!e&&f.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{u as a,l as c,C as h}; +import{events as t}from"@dropins/tools/event-bus.js";const s=r=>{const e=r instanceof DOMException&&r.name==="AbortError",o=r.name==="PlaceOrderError";throw!e&&!o&&t.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{s as h}; diff --git a/scripts/__dropins__/storefront-order/chunks/redirectTo.js b/scripts/__dropins__/storefront-order/chunks/redirectTo.js index 70554833ed..c8260a2e9d 100644 --- a/scripts/__dropins__/storefront-order/chunks/redirectTo.js +++ b/scripts/__dropins__/storefront-order/chunks/redirectTo.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const a=(e,n,r)=>{if(typeof e!="function")return;const t=e(r);if(!n||Object.keys(n).length===0){window.location.href=t;return}const o=new URLSearchParams;Object.entries(n).forEach(([i,s])=>{o.append(i,String(s))});const c=t.includes("?")?"&":"?";window.location.href=`${t}${c}${o.toString()}`};export{a as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js index 93660ac157..b439488820 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{PRODUCT_DETAILS_FRAGMENT as d,PRICE_DETAILS_FRAGMENT as s,GIFT_CARD_DETAILS_FRAGMENT as i,ORDER_ITEM_DETAILS_FRAGMENT as A,BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT as D,ORDER_SUMMARY_FRAGMENT as c,ADDRESS_FRAGMENT as u,GUEST_ORDER_FRAGMENT as G}from"../fragments.js";import{f as a,h as R}from"./fetch-graphql.js";import{a as T}from"./initialize.js";const N=` mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) { diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js index 4ace23884e..d12b56f0a3 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js @@ -1,6 +1,6 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{h as i,a as _}from"./network-error.js";import{f as o,h as s}from"./fetch-graphql.js";import{t as d}from"./transform-attributes-form.js";import{REQUEST_RETURN_ORDER_FRAGMENT as m}from"../fragments.js";import{merge as l}from"@dropins/tools/lib.js";import{d as f}from"./initialize.js";const h=r=>{var a,n,E,c,R,T;if(!((n=(a=r==null?void 0:r.data)==null?void 0:a.requestReturn)!=null&&n.return))return{};const{created_at:e,...t}=r.data.requestReturn.return,u={...t,createdAt:e};return l(u,(T=(R=(c=(E=f.getConfig())==null?void 0:E.models)==null?void 0:c.RequestReturnModel)==null?void 0:R.transformer)==null?void 0:T.call(R,r.data.requestReturn.return))},U=` +import{h as i}from"./network-error.js";import{f as o,h as s}from"./fetch-graphql.js";import{t as d,a as _}from"./transform-attributes-form.js";import{REQUEST_RETURN_ORDER_FRAGMENT as m}from"../fragments.js";import{merge as l}from"@dropins/tools/lib.js";import{d as f}from"./initialize.js";const h=r=>{var a,n,E,c,R,T;if(!((n=(a=r==null?void 0:r.data)==null?void 0:a.requestReturn)!=null&&n.return))return{};const{created_at:e,...t}=r.data.requestReturn.return,u={...t,createdAt:e};return l(u,(T=(R=(c=(E=f.getConfig())==null?void 0:E.models)==null?void 0:c.RequestReturnModel)==null?void 0:R.transformer)==null?void 0:T.call(R,r.data.requestReturn.return))},U=` query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) { attributesList(entityType: $entityType) { items { diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index 07dcb6203f..22c6285527 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{g as p,F as c}from"./getFormValues.js";const d={PENDING:"pending",AUTHORIZED:"authorized",PARTIALLY_AUTHORIZED:"partiallyAuthorized",RECEIVED:"received",PARTIALLY_RECEIVED:"partiallyReceived",APPROVED:"approved",PARTIALLY_APPROVED:"partiallyApproved",REJECTED:"rejected",PARTIALLY_REJECTED:"partiallyRejected",DENIED:"denied",PROCESSED_AND_CLOSED:"processedAndClosed",CLOSED:"closed"},u=(t,n)=>({id:`${t.id}_${t.fieldType}_${n+1}`,name:`${t.name}_${t.fieldType}_${n+1}`,code:`${t.code}_${t.fieldType}_${n+1}`,customUpperCode:`${t.customUpperCode}_${t.fieldType}_${n+1}`}),l=t=>{const n={};return!t||typeof t!="object"||Object.keys(t).length===0||Object.keys(t).forEach(e=>{if(/_(\d+)$/.exec(e)){const s=e==null?void 0:e.replace(/_\d+$/,"");n[s]=t[e]}else n[e]=t[e]}),n},f=(t,n)=>t.map(e=>({...e,...u(e,n)})),A=(t,n)=>t==null?void 0:t.flatMap(e=>Array.from({length:n},(i,s)=>({...e,...u(e,s)}))),E=t=>{const n=[],e=[];return Object.entries(t).forEach(([i,s])=>{const r=i.lastIndexOf("_"),o=i.slice(0,r),a=i.slice(r+1);a===c.MULTISELECT||a===c.SELECT?n.push({attributeCode:o,value:s}):e.push({attributeCode:o,value:s})}),{selectedCustomAttributes:n,enteredCustomAttributes:e}},C=t=>typeof t!="string"?"":d[t]??"",R=t=>{var e;const n=[];if(t!=null&&t.current.length)for(const{current:i}of t.current){if(!i)continue;const s=i.name.replace(/_\d+$/,""),r=((e=i==null?void 0:i.dataset)==null?void 0:e.quantity)??1,o=p(i),a=l(o);n.push({orderItemUid:s,quantityToReturn:+r,...E(a)})}return n},_=t=>{var n;return(n=t==null?void 0:t.items)!=null&&n.length?[...(t==null?void 0:t.items)??[]].sort((e,i)=>{const s=e.quantityShipped-e.quantityReturnRequested===0,r=i.quantityShipped-i.quantityReturnRequested===0;return e.eligibleForReturn&&!i.eligibleForReturn?-1:!e.eligibleForReturn&&i.eligibleForReturn||s&&!r?1:!s&&r?-1:0}):[]};export{C as f,f as m,R as p,A as r,_ as s}; diff --git a/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js b/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js index afa80511a9..72e0fe153b 100644 --- a/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js +++ b/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const s=t=>{let e=!1,a=!1;switch(t){case 1:a=!0;break;case 2:e=!0;break;case 3:e=!0,a=!0;break;default:e=!1,a=!1}return{taxIncluded:e,taxExcluded:a}};export{s}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index 19aed95cc1..0d750b2e22 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{c as i,a as d}from"./network-error.js";const l=n=>{let s=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const c={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};s.push(c)}return s},f=(n=[])=>{var c;if(!(n!=null&&n.length))return[];const s=(c=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:c.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=l(s);return[...s,...e].map(t=>{const r=i(t.code);return d({...t,customUpperCode:r},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((t,r)=>t.orderNumber-r.orderNumber)};export{f as t}; +const l=r=>r.replace(/_([a-z])/g,(t,n)=>n.toUpperCase()),a=r=>r.replace(/([A-Z])/g,t=>`_${t.toLowerCase()}`),i=(r,t,n)=>{const s=["string","boolean","number"],c=t==="camelCase"?l:a;return Array.isArray(r)?r.map(e=>s.includes(typeof e)||e===null?e:typeof e=="object"?i(e,t,n):e):r!==null&&typeof r=="object"?Object.entries(r).reduce((e,[o,u])=>{const f=n&&n[o]?n[o]:c(o);return e[f]=s.includes(typeof u)||u===null?u:i(u,t,n),e},{}):r},d=r=>{let t=[];for(const n of r)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let s=2;s<=n.multiline_count;s++){const c={...n,name:`${n.code}_${s}`,code:`${n.code}_${s}`,id:`${n.code}_${s}`};t.push(c)}return t},p=(r=[])=>{var c;if(!(r!=null&&r.length))return[];const t=(c=r.filter(e=>{var o;return!((o=e.frontend_input)!=null&&o.includes("HIDDEN"))}))==null?void 0:c.map(({code:e,...o})=>{const u=e!=="country_id"?e:"country_code";return{...o,name:u,id:u,code:u}}),n=d(t);return[...t,...n].map(e=>{const o=l(e.code);return i({...e,customUpperCode:o},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((e,o)=>e.orderNumber-o.orderNumber)};export{i as a,l as c,p as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js index 4398ad0c43..e08ada004a 100644 --- a/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js +++ b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{useState as i,useEffect as s}from"@dropins/tools/preact-hooks.js";import{g as f}from"./getStoreConfig.js";const c=()=>{const[n,e]=i(null);return s(()=>{const o=sessionStorage.getItem("orderStoreConfig"),r=o?JSON.parse(o):null;r?e(r):f().then(t=>{t&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(t)),e(t))})},[]),n};export{c as u}; +import{useState as f,useEffect as g}from"@dropins/tools/preact-hooks.js";import{g as S}from"./getStoreConfig.js";const C=()=>{const[s,r]=f(null);return g(()=>{var n;const e="orderStoreConfigPromise",i=sessionStorage.getItem("orderStoreConfig");if(i){const t=JSON.parse(i);r(t)}else{const t=window;t[e]||(t[e]=S().then(o=>(o&&sessionStorage.setItem("orderStoreConfig",JSON.stringify(o)),o))),(n=t[e])==null||n.then(o=>{o&&r(o)})}},[]),s};export{C as u}; diff --git a/scripts/__dropins__/storefront-order/chunks/useIsMobile.js b/scripts/__dropins__/storefront-order/chunks/useIsMobile.js index 9f24ca2937..7f9df141b4 100644 --- a/scripts/__dropins__/storefront-order/chunks/useIsMobile.js +++ b/scripts/__dropins__/storefront-order/chunks/useIsMobile.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{debounce as t}from"@dropins/tools/lib.js";import{useState as o,useCallback as s,useEffect as r}from"@dropins/tools/preact-hooks.js";const w=()=>{const[i,n]=o(window.innerWidth<768),e=s(t(()=>{n(window.innerWidth<768)},1e3),[]);return r(()=>(window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),i};export{w as u}; diff --git a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts index 1e9c4f96cd..0b5533f63e 100644 --- a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts +++ b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts @@ -13,6 +13,110 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ +export declare const taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; +}; +export declare const taxCalculationsEmpty: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; +}; export declare const mockOrder: { data: { guestOrder: { @@ -178,6 +282,7 @@ export declare const transformMockOrderInput: { customer: { orders: { items: { + uid: string; available_actions: string[]; status: string; number: string; @@ -427,7 +532,107 @@ export declare const transformMockOrderOutput: { carrier: string; shippingMethod: null; coupons: never[]; - shipments: { + shipments: ({ + id: string; + tracking: { + title: string; + number: string; + }[]; + comments: never[]; + items: { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + id: string; + productSku: string; + productName: string; + orderItem: { + __typename: string; + status: string; + productName: string; + id: string; + quantityOrdered: number; + quantityShipped: number; + quantityCanceled: number; + quantityInvoiced: number; + quantityRefunded: number; + quantityReturned: number; + productSalePrice: { + value: number; + currency: string; + }; + selectedOptions: never[]; + product: { + __typename: string; + canonicalUrl: null; + uid: string; + name: string; + sku: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + }; + }; + }[]; + } | { id: string; tracking: { title: string; @@ -478,7 +683,7 @@ export declare const transformMockOrderOutput: { }; }; }[]; - }[]; + })[]; shippingAddress: { city: string; company: null; @@ -1822,13 +2027,65 @@ export declare const createReturnOrderMock: { carrier: string; shippingMethod: string; isVirtual: boolean; - returns: { + returns: ({ createdReturnAt: string; returnStatus: string; token: string; orderNumber: string; returnNumber: string; items: ({ + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; uid: string; quantity: number; status: string; @@ -1897,8 +2154,8 @@ export declare const createReturnOrderMock: { url: string; }; configurableOptions: { - Size?: undefined; - Color?: undefined; + Size: string; + Color: string; }; bundleOptions: null; itemPrices: { @@ -2012,215 +2269,430 @@ export declare const createReturnOrderMock: { }; }; downloadableLinks: null; + taxCalculations?: undefined; })[]; tracking: never[]; - }[]; - itemsEligibleForReturn: ({ - type: string; - eligibleForReturn: boolean; - productSku: string; - productName: string; - productUrlKey: string; - quantityCanceled: number; - quantityInvoiced: number; - quantityOrdered: number; - quantityRefunded: number; - quantityReturned: number; - quantityShipped: number; - id: string; - discounted: boolean; - total: { - value: number; - currency: string; - }; - totalInclTax: { - value: number; - currency: string; - }; - price: { - value: number; - currency: string; - }; - priceInclTax: { - value: number; - currency: string; - }; - totalQuantity: number; - regularPrice: { - value: number; - currency: string; - }; - product: { - __typename: string; - canonicalUrl: string; - urlKey: string; - uid: string; - name: string; - sku: string; - onlyXLeftInStock: null; - stockStatus: string; - thumbnail: { - label: string; - url: string; - }; - priceRange: { - maximumPrice: { - regularPrice: { + } | { + createdReturnAt: string; + returnStatus: string; + token: string; + orderNumber: string; + returnNumber: string; + items: ({ + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { value: number; + currency: string; }; }; }; + uid: string; + quantity: number; + status: string; + requestQuantity: number; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; id: string; - image: string; - productType: string; - }; - thumbnail: { - label: string; - url: string; - }; - configurableOptions: { - Color?: undefined; - Size?: undefined; - }; - bundleOptions: null; - itemPrices: { - priceIncludingTax: { + discounted: boolean; + total: { value: number; currency: string; }; - originalPrice: { + totalInclTax: { value: number; currency: string; }; - originalPriceIncludingTax: { + price: { value: number; currency: string; }; - price: { + priceInclTax: { value: number; currency: string; }; - }; - downloadableLinks: null; - } | { - type: string; - eligibleForReturn: boolean; - productSku: string; - productName: string; - productUrlKey: string; - quantityCanceled: number; - quantityInvoiced: number; - quantityOrdered: number; - quantityRefunded: number; - quantityReturned: number; - quantityShipped: number; - id: string; - discounted: boolean; - total: { - value: number; - currency: string; - }; - totalInclTax: { - value: number; - currency: string; - }; - price: { - value: number; - currency: string; - }; - priceInclTax: { - value: number; - currency: string; - }; - totalQuantity: number; - regularPrice: { - value: number; - currency: string; - }; - product: { - __typename: string; - canonicalUrl: string; - urlKey: string; - uid: string; - name: string; - sku: string; - onlyXLeftInStock: null; - stockStatus: string; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; thumbnail: { label: string; url: string; }; - priceRange: { - maximumPrice: { - regularPrice: { - currency: string; - value: number; - }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; }; }; + downloadableLinks: null; + } | { + uid: string; + quantity: number; + status: string; + requestQuantity: number; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; id: string; - image: string; - productType: string; - }; - thumbnail: { - label: string; - url: string; - }; - configurableOptions: { - Color: string; - Size: string; - }; - bundleOptions: null; - itemPrices: { - priceIncludingTax: { + discounted: boolean; + total: { value: number; currency: string; }; - originalPrice: { + totalInclTax: { value: number; currency: string; }; - originalPriceIncludingTax: { + price: { value: number; currency: string; }; - price: { + priceInclTax: { value: number; currency: string; }; - }; - downloadableLinks: null; - } | { - type: string; - eligibleForReturn: boolean; - productSku: string; - productName: string; - productUrlKey: string; - quantityCanceled: number; - quantityInvoiced: number; - quantityOrdered: number; - quantityRefunded: number; - quantityReturned: number; - quantityShipped: number; - id: string; - discounted: boolean; - total: { - value: number; - currency: string; - }; - totalInclTax: { - value: number; - currency: string; - }; - price: { - value: number; - currency: string; - }; - priceInclTax: { - value: number; - currency: string; - }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color: string; + Size: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + taxCalculations?: undefined; + } | { + uid: string; + quantity: number; + status: string; + requestQuantity: number; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + taxCalculations?: undefined; + })[]; + tracking: never[]; + })[]; + itemsEligibleForReturn: ({ + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; totalQuantity: number; regularPrice: { value: number; @@ -2259,12 +2731,7 @@ export declare const createReturnOrderMock: { Color?: undefined; Size?: undefined; }; - bundleOptions: { - 'Sprite Stasis Ball': string; - 'Sprite Foam Yoga Brick': string; - 'Sprite Yoga Strap': string; - 'Sprite Foam Roller': string; - }; + bundleOptions: null; itemPrices: { priceIncludingTax: { value: number; @@ -2284,208 +2751,59 @@ export declare const createReturnOrderMock: { }; }; downloadableLinks: null; - })[]; - coupons: never[]; - shipments: { - id: string; - number: string; - tracking: never[]; - comments: never[]; - items: { - id: string; - productSku: string; - productName: string; - orderItem: { - __typename: string; - status: string; - productSku: string; - eligibleForReturn: boolean; - productName: string; - productUrlKey: string; - id: string; - quantityOrdered: number; - quantityShipped: number; - quantityCanceled: number; - quantityInvoiced: number; - quantityRefunded: number; - productSalePrice: { + } | { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { value: number; currency: string; }; - selectedOptions: { - label: string; - value: string; - }[]; - product: { - __typename: string; - canonicalUrl: null; - urlKey: string; - uid: string; - name: string; - sku: string; - onlyXLeftInStock: null; - stockStatus: string; - thumbnail: { - label: string; - url: string; - }; - priceRange: { - maximumPrice: { - regularPrice: { - currency: string; - value: number; - }; - }; - }; + baseOriginalPrice: { + value: number; + currency: string; }; - prices: { - priceIncludingTax: { - value: number; - currency: string; - }; - originalPrice: { - value: number; - currency: string; - }; - originalPriceIncludingTax: { - value: number; - currency: string; - }; - price: { - value: number; - currency: string; - }; + baseDiscountedPrice: { + value: number; + currency: string; }; - }; - }[]; - }[]; - payments: { - code: string; - name: string; - }[]; - shippingAddress: { - city: string; - company: null; - countryCode: string; - fax: null; - firstName: string; - lastName: string; - middleName: null; - postCode: string; - prefix: null; - region: string; - regionId: string; - street: string[]; - suffix: null; - telephone: string; - vatId: string; - }; - billingAddress: { - city: string; - company: null; - countryCode: string; - fax: null; - firstName: string; - lastName: string; - middleName: null; - postCode: string; - prefix: null; - region: string; - regionId: string; - street: string[]; - suffix: null; - telephone: string; - vatId: string; - }; - items: ({ - type: string; - eligibleForReturn: boolean; - productSku: string; - productName: string; - productUrlKey: string; - quantityCanceled: number; - quantityInvoiced: number; - quantityOrdered: number; - quantityRefunded: number; - quantityReturned: number; - quantityShipped: number; - id: string; - discounted: boolean; - total: { - value: number; - currency: string; - }; - totalInclTax: { - value: number; - currency: string; - }; - price: { - value: number; - currency: string; - }; - priceInclTax: { - value: number; - currency: string; - }; - totalQuantity: number; - regularPrice: { - value: number; - currency: string; - }; - product: { - __typename: string; - canonicalUrl: string; - urlKey: string; - uid: string; - name: string; - sku: string; - onlyXLeftInStock: null; - stockStatus: string; - thumbnail: { - label: string; - url: string; - }; - priceRange: { - maximumPrice: { - regularPrice: { - currency: string; - value: number; - }; + baseExcludingTax: { + value: number; + currency: string; }; }; - id: string; - image: string; - productType: string; - }; - thumbnail: { - label: string; - url: string; - }; - configurableOptions: { - Color?: undefined; - Size?: undefined; - }; - bundleOptions: null; - itemPrices: { - priceIncludingTax: { - value: number; - currency: string; - }; - originalPrice: { - value: number; - currency: string; - }; - originalPriceIncludingTax: { - value: number; - currency: string; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; }; - price: { - value: number; - currency: string; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; }; }; - downloadableLinks: null; - } | { type: string; eligibleForReturn: boolean; productSku: string; @@ -2574,6 +2892,58 @@ export declare const createReturnOrderMock: { }; downloadableLinks: null; } | { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; type: string; eligibleForReturn: boolean; productSku: string; @@ -2667,27 +3037,191 @@ export declare const createReturnOrderMock: { }; downloadableLinks: null; })[]; - itemsEligibleForReturn2: ({ - type: string; - eligibleForReturn: boolean; - productSku: string; - productName: string; - productUrlKey: string; - quantityCanceled: number; - quantityInvoiced: number; - quantityOrdered: number; - quantityRefunded: number; - quantityReturned: number; - quantityShipped: number; + coupons: never[]; + shipments: { id: string; - discounted: boolean; - total: { - value: number; - currency: string; - }; - totalInclTax: { - value: number; - currency: string; + number: string; + tracking: never[]; + comments: never[]; + items: { + id: string; + productSku: string; + productName: string; + orderItem: { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + __typename: string; + status: string; + productSku: string; + eligibleForReturn: boolean; + productName: string; + productUrlKey: string; + id: string; + quantityOrdered: number; + quantityShipped: number; + quantityCanceled: number; + quantityInvoiced: number; + quantityRefunded: number; + productSalePrice: { + value: number; + currency: string; + }; + selectedOptions: { + label: string; + value: string; + }[]; + product: { + __typename: string; + canonicalUrl: null; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + }; + prices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + }; + }[]; + }[]; + payments: { + code: string; + name: string; + }[]; + shippingAddress: { + city: string; + company: null; + countryCode: string; + fax: null; + firstName: string; + lastName: string; + middleName: null; + postCode: string; + prefix: null; + region: string; + regionId: string; + street: string[]; + suffix: null; + telephone: string; + vatId: string; + }; + billingAddress: { + city: string; + company: null; + countryCode: string; + fax: null; + firstName: string; + lastName: string; + middleName: null; + postCode: string; + prefix: null; + region: string; + regionId: string; + street: string[]; + suffix: null; + telephone: string; + vatId: string; + }; + items: ({ + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; }; price: { value: number; @@ -2937,40 +3471,310 @@ export declare const createReturnOrderMock: { }; downloadableLinks: null; })[]; - totalQuantity: number; - shipping: { - amount: number; - currency: string; - code: string; - }; - returnNumber: string; -}; -export declare const shippingStatusCardDataMock: { - email: string; - availableActions: string[]; - status: string; - number: string; - id: string; - returns: never[]; - itemsEligibleForReturn: never[]; - coupons: never[]; - shipments: { + itemsEligibleForReturn2: ({ + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; id: string; - tracking: { - number: number; - carrier: string; - title: string; - }[]; - comments: never[]; - items: { + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; id: string; - productSku: string; - productName: string; - orderItem: { - __typename: string; - status: string; - productSku: string; - eligibleForReturn: boolean; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color: string; + Size: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: { + 'Sprite Stasis Ball': string; + 'Sprite Foam Yoga Brick': string; + 'Sprite Yoga Strap': string; + 'Sprite Foam Roller': string; + }; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + })[]; + totalQuantity: number; + shipping: { + amount: number; + currency: string; + code: string; + }; + returnNumber: string; +}; +export declare const shippingStatusCardDataMock: { + email: string; + availableActions: string[]; + status: string; + number: string; + id: string; + returns: never[]; + itemsEligibleForReturn: never[]; + coupons: never[]; + shipments: { + id: string; + tracking: { + number: number; + carrier: string; + title: string; + }[]; + comments: never[]; + items: { + id: string; + productSku: string; + productName: string; + orderItem: { + __typename: string; + status: string; + productSku: string; + eligibleForReturn: boolean; productName: string; productUrlKey: string; id: string; @@ -3734,11 +4538,641 @@ export declare const storeConfigMock: { orderCancellationReasons: { description: string; }[]; - shoppingCartDisplayPrice: number; + shoppingOrderDisplayPrice: number; shoppingOrdersDisplaySubtotal: number; shoppingOrdersDisplayShipping: number; shoppingOrdersDisplayGrandTotal: boolean; shoppingOrdersDisplayFullSummary: boolean; shoppingOrdersDisplayZeroTax: boolean; }; +export declare const placeOrderMockData: { + availableActions: string[]; + billingAddress: { + city: string; + company: string; + countryCode: string; + fax: string; + firstName: string; + lastName: string; + middleName: string; + postCode: string; + prefix: string; + region: string; + regionId: string; + street: string[]; + suffix: string; + telephone: string; + vatId: string; + country: string; + customAttributes: never[]; + }; + carrier: string; + coupons: never[]; + discounts: { + amount: { + currency: string; + value: number; + }; + label: string; + }[]; + email: string; + grandTotal: { + currency: string; + value: number; + }; + id: string; + isVirtual: boolean; + items: { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + bundleOptions: null; + configurableOptions: undefined; + discounted: boolean; + downloadableLinks: null; + eligibleForReturn: boolean; + giftCard: { + message: string; + recipientEmail: string; + recipientName: string; + senderEmail: string; + senderName: string; + }; + id: undefined; + price: { + currency: undefined; + value: number; + }; + priceInclTax: { + currency: undefined; + value: number; + }; + prices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + itemPrices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + product: { + __typename: string; + uid: string; + canonicalUrl: string; + id: string; + image: string; + name: string; + onlyXLeftInStock: number; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + productType: string; + sku: string; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + urlKey: string; + }; + productName: string; + productSalePrice: undefined; + productSku: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturnRequested: number; + quantityReturned: number; + quantityShipped: number; + regularPrice: { + currency: undefined; + value: undefined; + }; + selectedOptions: never[]; + status: string; + thumbnail: { + label: string; + url: string; + }; + total: { + currency: string; + value: number; + }; + totalInclTax: { + currency: undefined; + value: number; + }; + totalQuantity: number; + type: string; + }[]; + itemsEligibleForReturn: undefined; + number: string; + orderDate: string; + orderStatusChangeDate: string; + payments: { + code: string; + name: string; + }[]; + returns: never[]; + shipments: ({ + comments: never[]; + id: string; + items: { + id: string; + orderItem: { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + bundleOptions: null; + configurableOptions: {}; + discounted: boolean; + downloadableLinks: null; + eligibleForReturn: boolean; + giftCard: undefined; + id: string; + price: { + currency: string; + value: number; + }; + priceInclTax: { + currency: string; + value: number; + }; + prices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + itemPrices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + product: { + __typename: string; + canonicalUrl: string; + id: string; + image: string; + name: string; + onlyXLeftInStock: number; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + productType: string; + sku: string; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + uid: string; + urlKey: string; + }; + productName: string; + productSalePrice: { + currency: string; + value: number; + }; + productSku: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturnRequested: number; + quantityReturned: number; + quantityShipped: number; + regularPrice: { + currency: string; + value: number; + }; + selectedOptions: never[]; + status: string; + thumbnail: { + label: string; + url: string; + }; + total: { + currency: string; + value: number; + }; + totalInclTax: { + currency: string; + value: number; + }; + totalQuantity: number; + type: string; + }; + productName: string; + productSku: string; + quantityShipped: undefined; + }[]; + tracking: { + number: string; + title: string; + }[]; + } | { + comments: never[]; + id: string; + items: { + id: string; + orderItem: { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + excludeTax: { + originalPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + baseExcludingTax: { + value: number; + currency: string; + }; + }; + includeTax: { + singleItemPrice: { + value: number; + currency: string; + }; + baseOriginalPrice: { + value: number; + currency: string; + }; + baseDiscountedPrice: { + value: number; + currency: string; + }; + }; + }; + bundleOptions: null; + configurableOptions: { + Color: string; + Size: string; + }; + discounted: boolean; + downloadableLinks: null; + eligibleForReturn: boolean; + giftCard: undefined; + id: string; + price: { + currency: string; + value: number; + }; + priceInclTax: { + currency: string; + value: number; + }; + prices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + itemPrices: { + discounts: never[]; + originalPrice: { + currency: string; + value: number; + }; + originalPriceIncludingTax: { + currency: string; + value: number; + }; + price: { + currency: string; + value: number; + }; + priceIncludingTax: { + currency: string; + value: number; + }; + }; + product: { + __typename: string; + canonicalUrl: string; + id: string; + image: string; + name: string; + onlyXLeftInStock: number; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + productType: string; + sku: string; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + uid: string; + urlKey: string; + }; + productName: string; + productSalePrice: { + currency: string; + value: number; + }; + productSku: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturnRequested: number; + quantityReturned: number; + quantityShipped: number; + regularPrice: { + currency: string; + value: number; + }; + selectedOptions: { + label: string; + value: string; + }[]; + status: string; + thumbnail: { + label: string; + url: string; + }; + total: { + currency: string; + value: number; + }; + totalInclTax: { + currency: string; + value: number; + }; + totalQuantity: number; + type: string; + }; + productName: string; + productSku: string; + quantityShipped: undefined; + }[]; + tracking: { + number: string; + title: string; + }[]; + })[]; + shipping: { + amount: number; + code: string; + currency: string; + }; + shippingAddress: { + city: string; + company: string; + countryCode: string; + fax: string; + firstName: string; + lastName: string; + middleName: string; + postCode: string; + prefix: string; + region: string; + regionId: string; + street: string[]; + suffix: string; + telephone: string; + vatId: string; + country: string; + customAttributes: never[]; + }; + shippingMethod: null; + status: string; + subtotalExclTax: { + currency: string; + value: number; + }; + subtotalInclTax: { + currency: string; + value: number; + }; + taxes: never[]; + token: string; + totalGiftcard: { + currency: string; + value: number; + }; + totalQuantity: number; + totalShipping: { + currency: string; + value: number; + }; + totalTax: { + currency: string; + value: number; + }; +}; //# sourceMappingURL=mock.config.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index df04cdc644..20c0c7f40b 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B,Slot as H}from"@dropins/tools/lib.js";import{Icon as $,Header as W,InLineAlert as j,Button as M,Checkbox as G,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as w,useRef as D,useEffect as P,useCallback as F}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{u as J}from"../chunks/useGetStoreConfig.js";import{createRef as K,Fragment as X}from"@dropins/tools/preact.js";import{s as Y,p as I,r as ee,m as te}from"../chunks/returnOrdersHelper.js";import{events as ne}from"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getQueryParam.js";import{g as re,r as se,a as ae}from"../chunks/requestGuestReturn.js";import{s as ie}from"../chunks/setTaxStatus.js";import{S as ce,C as ue}from"../chunks/CartSummaryItem.js";import{a as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getFormValues.js";import"../chunks/network-error.js";import"../chunks/transform-attributes-form.js";import"../fragments.js";import"../chunks/initialize.js";const de=a=>_.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},_.createElement("g",{clipPath:"url(#clip0_841_1324)"},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_841_1324"},_.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=a=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:i,orderData:l})=>{const[k,L]=w(!1),[o,R]=w({id:"",email:"",...l}),[v,x]=w("products"),[h,d]=w(!0),[g,f]=w([]),[C,t]=w([]),[m,e]=w([]),c=D([]);c.current.length!==g.length&&(c.current=g.map((n,p)=>c.current[p]||K())),P(()=>{const n=ne.on("order/data",p=>{var u;R(p);const O=Y(p);e(O),L(((u=A("orderRef"))==null?void 0:u.length)>20),d(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),P(()=>{re("RMA_ITEM").then(n=>{n!=null&&n.length&&(t(n),d(!1))})},[]);const y=F(n=>{f(p=>p.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?p.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...p,n])},[]),S=F(n=>{x(n),i(),n==="products"&&f([])},[i]),E=F((n,p)=>{const O=g.map(u=>u.productSku===p?{...u,currentReturnOrderQuantity:n}:u);f(O)},[g]),Q=F(async(n,p)=>{if(!p)return;d(!0);const O={orderUid:o.id,contactEmail:o.email},u=I(c);k?ae({token:A("orderRef"),contactEmail:O.contactEmail,items:u,commentText:"."}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}):se({...O,items:u}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}),d(!1)},[S,s,a,i,o,k]);return{order:o,steps:v,loading:h,formsRef:c,attributesList:C,selectedProductList:g,itemsEligibleForReturn:m,handleSelectedProductList:y,handleSetQuantity:E,handleChangeStep:S,onSubmit:Q}},he={success:pe,warning:de,error:ce},ge=()=>{const[a,s]=w({type:"success",heading:""}),i=F(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const k=r($,{source:he[l.type]});s({...l,icon:k})},[]);return{inLineAlertProps:a,handleSetInLineAlert:i}},je=({className:a,orderData:s,slots:i,onSuccess:l,onError:k,routeReturnSuccess:L,showConfigurableOptions:o})=>{const R=le({headerText:"Order.CreateReturn.headerText",successTitle:"Order.CreateReturn.success.title",successMessage:"Order.CreateReturn.success.message",sender:"Order.CreateReturn.giftCard.sender",recipient:"Order.CreateReturn.giftCard.recipient",message:"Order.CreateReturn.giftCard.message",outOfStock:"Order.CreateReturn.stockStatus.outOfStock",nextStep:"Order.CreateReturn.buttons.nextStep",backStep:"Order.CreateReturn.buttons.backStep",submit:"Order.CreateReturn.buttons.submit",backStore:"Order.CreateReturn.buttons.backStore",downloadableCount:"Order.CreateReturn.downloadableCount",returnedItems:"Order.CreateReturn.returnedItems",configurationsListQuantity:"Order.CreateReturn.configurationsList.quantity"}),{inLineAlertProps:v,handleSetInLineAlert:x}=ge(),h=J(),{order:d,itemsEligibleForReturn:g,formsRef:f,attributesList:C,steps:t,loading:m,selectedProductList:e,handleSelectedProductList:c,handleSetQuantity:y,handleChangeStep:S,onSubmit:E}=me({orderData:s,onSuccess:l,onError:k,handleSetInLineAlert:x});if(m)return r("div",{children:r(oe,{})});if(!m&&!C.length)return r("div",{});const Q=(h==null?void 0:h.baseMediaUrl)??"",n={products:r(be,{itemsEligibleForReturn:g,placeholderImage:Q,taxConfig:ie((h==null?void 0:h.shoppingCartDisplayPrice)??0),slots:i,translations:R,loading:m,selectedProductList:e,handleSelectedProductList:c,showConfigurableOptions:o,handleSetQuantity:y,handleChangeStep:S}),attributes:r(ke,{placeholderImage:Q,slots:i,formsRef:f,loading:m,fieldsConfig:C,selectedProductList:e,handleChangeStep:S,translations:R,onSubmit:E}),success:r(fe,{translations:R,routeReturnSuccess:L,orderData:d}),error:null};return N("div",{className:B(["order-create-return",a]),children:[r(W,{title:R.headerText}),v.heading?r(j,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...v}):null,n[t]]})},fe=({routeReturnSuccess:a,translations:s,orderData:i})=>N("div",{className:"order-return-order-message",children:[r("p",{className:"order-return-order-message__title",children:s.successTitle}),r("p",{className:"order-return-order-message__subtitle",children:s.successMessage}),r(M,{href:(a==null?void 0:a(i))??"#",children:s.backStore})]}),be=({placeholderImage:a,itemsEligibleForReturn:s,slots:i,loading:l,taxConfig:k,translations:L,selectedProductList:o,handleSelectedProductList:R,showConfigurableOptions:v,handleSetQuantity:x,handleChangeStep:h})=>N("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((d,g)=>{const{quantityReturnRequested:f,quantityShipped:C,eligibleForReturn:t}=d,m=o.some(y=>(y==null?void 0:y.productSku)===d.productSku&&d.eligibleForReturn),e=C===f&&t||!t,c=C-f===0?f:C-f;return N("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(G,{"data-testid":`key_${g}`,name:`key_${g}`,checked:m,disabled:e,onChange:()=>{R({...d,currentReturnOrderQuantity:1})}}),r(ue,{placeholderImage:a,loading:l,product:{...d,totalQuantity:c||1},itemType:"",taxConfig:k,translations:L,showConfigurableOptions:v,disabledIncrementer:!m,onQuantity:c>1?y=>{x(y,d.productSku)}:void 0}),r(H,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:i==null?void 0:i.ReturnOrderItem})]},d.id)}),r("li",{className:"order-return-order-product-list__item",children:r(M,{type:"button",onClick:()=>h("attributes"),disabled:!o.length,children:L.nextStep})})]}),ke=({placeholderImage:a,slots:s,formsRef:i,selectedProductList:l,loading:k,fieldsConfig:L,translations:o,handleChangeStep:R,onSubmit:v})=>{const{formData:x,errors:h,formRef:d,handleChange:g,handleBlur:f,handleSubmit:C}=U({fieldsConfig:ee(L,l==null?void 0:l.length),onSubmit:v});return N("form",{className:"order-return-reason-form",ref:d,onSubmit:C,name:"returnReasonForm",children:[l.map((t,m)=>{var p,O,u,b,T,q;const e=t==null?void 0:t.giftCard,c=t==null?void 0:t.product,y=te(L,m),S=`${t==null?void 0:t.id}_${m}`,E=(t==null?void 0:t.currentReturnOrderQuantity)??1,Q={...t!=null&&t.currentReturnOrderQuantity?{[o.configurationsListQuantity]:E}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[o.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[o.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[o.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[o.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[o.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(p=t==null?void 0:t.downloadableLinks)==null?void 0:p.count} ${o.downloadableCount}`]:(O=t==null?void 0:t.downloadableLinks)==null?void 0:O.result}:{}},n=(b=(u=c==null?void 0:c.thumbnail)==null?void 0:u.url)!=null&&b.length?c.thumbnail.url:a;return N(X,{children:[r(V,{loading:k,title:r("div",{"data-testid":"product-name",children:(T=t==null?void 0:t.product)==null?void 0:T.name}),sku:r("div",{children:c==null?void 0:c.sku}),image:r(Z,{src:n,alt:((q=c==null?void 0:c.thumbnail)==null?void 0:q.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:Q}),r("form",{name:S,ref:i==null?void 0:i.current[m],"data-quantity":E,children:r(z,{className:"className",loading:k,fields:y,onChange:g,onBlur:f,errors:h,values:x})})]},t.id)}),r(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:R},children:N("div",{className:"order-return-reason-form__actions",children:[r(M,{variant:"secondary",type:"button",onClick:()=>{R("products")},children:o.backStep}),r(M,{children:o.submit})]})})]})};export{je as CreateReturn,je as default}; +import{jsx as n,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B,Slot as H}from"@dropins/tools/lib.js";import{Icon as $,Header as W,InLineAlert as j,Button as M,Checkbox as G,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as w,useRef as D,useEffect as P,useCallback as F}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{u as J}from"../chunks/useGetStoreConfig.js";import{createRef as K,Fragment as X}from"@dropins/tools/preact.js";import{s as Y,p as I,r as ee,m as te}from"../chunks/returnOrdersHelper.js";import{events as re}from"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getQueryParam.js";import{g as ne,r as se,a as ae}from"../chunks/requestGuestReturn.js";import{s as ie}from"../chunks/setTaxStatus.js";import{S as ce,C as ue}from"../chunks/CartSummaryItem.js";import{a as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getFormValues.js";import"../chunks/network-error.js";import"../chunks/transform-attributes-form.js";import"../fragments.js";import"../chunks/initialize.js";const de=a=>_.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},_.createElement("g",{clipPath:"url(#clip0_841_1324)"},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_841_1324"},_.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=a=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:i,orderData:l})=>{const[k,L]=w(!1),[o,R]=w({id:"",email:"",...l}),[v,x]=w("products"),[h,d]=w(!0),[g,f]=w([]),[C,t]=w([]),[m,e]=w([]),c=D([]);c.current.length!==g.length&&(c.current=g.map((r,p)=>c.current[p]||K())),P(()=>{const r=re.on("order/data",p=>{var u;R(p);const O=Y(p);e(O),L(((u=A("orderRef"))==null?void 0:u.length)>20),d(!1)},{eager:!0});return()=>{r==null||r.off()}},[]),P(()=>{ne("RMA_ITEM").then(r=>{r!=null&&r.length&&(t(r),d(!1))})},[]);const y=F(r=>{f(p=>p.findIndex(u=>(u==null?void 0:u.productSku)===(r==null?void 0:r.productSku))>-1?p.filter(u=>(u==null?void 0:u.productSku)!==(r==null?void 0:r.productSku)):[...p,r])},[]),S=F(r=>{x(r),i(),r==="products"&&f([])},[i]),E=F((r,p)=>{const O=g.map(u=>u.productSku===p?{...u,currentReturnOrderQuantity:r}:u);f(O)},[g]),Q=F(async(r,p)=>{if(!p)return;d(!0);const O={orderUid:o.id,contactEmail:o.email},u=I(c);k?ae({token:A("orderRef"),contactEmail:O.contactEmail,items:u,commentText:"."}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}):se({...O,items:u}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}),d(!1)},[S,s,a,i,o,k]);return{order:o,steps:v,loading:h,formsRef:c,attributesList:C,selectedProductList:g,itemsEligibleForReturn:m,handleSelectedProductList:y,handleSetQuantity:E,handleChangeStep:S,onSubmit:Q}},he={success:pe,warning:de,error:ce},ge=()=>{const[a,s]=w({type:"success",heading:""}),i=F(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const k=n($,{source:he[l.type]});s({...l,icon:k})},[]);return{inLineAlertProps:a,handleSetInLineAlert:i}},je=({className:a,orderData:s,slots:i,onSuccess:l,onError:k,routeReturnSuccess:L,showConfigurableOptions:o})=>{const R=le({headerText:"Order.CreateReturn.headerText",successTitle:"Order.CreateReturn.success.title",successMessage:"Order.CreateReturn.success.message",sender:"Order.CreateReturn.giftCard.sender",recipient:"Order.CreateReturn.giftCard.recipient",message:"Order.CreateReturn.giftCard.message",outOfStock:"Order.CreateReturn.stockStatus.outOfStock",nextStep:"Order.CreateReturn.buttons.nextStep",backStep:"Order.CreateReturn.buttons.backStep",submit:"Order.CreateReturn.buttons.submit",backStore:"Order.CreateReturn.buttons.backStore",downloadableCount:"Order.CreateReturn.downloadableCount",returnedItems:"Order.CreateReturn.returnedItems",configurationsListQuantity:"Order.CreateReturn.configurationsList.quantity"}),{inLineAlertProps:v,handleSetInLineAlert:x}=ge(),h=J(),{order:d,itemsEligibleForReturn:g,formsRef:f,attributesList:C,steps:t,loading:m,selectedProductList:e,handleSelectedProductList:c,handleSetQuantity:y,handleChangeStep:S,onSubmit:E}=me({orderData:s,onSuccess:l,onError:k,handleSetInLineAlert:x});if(m)return n("div",{children:n(oe,{})});if(!m&&!C.length)return n("div",{});const Q=(h==null?void 0:h.baseMediaUrl)??"",r={products:n(be,{itemsEligibleForReturn:g,placeholderImage:Q,taxConfig:ie((h==null?void 0:h.shoppingOrderDisplayPrice)??0),slots:i,translations:R,loading:m,selectedProductList:e,handleSelectedProductList:c,showConfigurableOptions:o,handleSetQuantity:y,handleChangeStep:S}),attributes:n(ke,{placeholderImage:Q,slots:i,formsRef:f,loading:m,fieldsConfig:C,selectedProductList:e,handleChangeStep:S,translations:R,onSubmit:E}),success:n(fe,{translations:R,routeReturnSuccess:L,orderData:d}),error:null};return N("div",{className:B(["order-create-return",a]),children:[n(W,{title:R.headerText}),v.heading?n(j,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...v}):null,r[t]]})},fe=({routeReturnSuccess:a,translations:s,orderData:i})=>N("div",{className:"order-return-order-message",children:[n("p",{className:"order-return-order-message__title",children:s.successTitle}),n("p",{className:"order-return-order-message__subtitle",children:s.successMessage}),n(M,{href:(a==null?void 0:a(i))??"#",children:s.backStore})]}),be=({placeholderImage:a,itemsEligibleForReturn:s,slots:i,loading:l,taxConfig:k,translations:L,selectedProductList:o,handleSelectedProductList:R,showConfigurableOptions:v,handleSetQuantity:x,handleChangeStep:h})=>N("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((d,g)=>{const{quantityReturnRequested:f,quantityShipped:C,eligibleForReturn:t}=d,m=o.some(y=>(y==null?void 0:y.productSku)===d.productSku&&d.eligibleForReturn),e=C===f&&t||!t,c=C-f===0?f:C-f;return N("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[n(G,{"data-testid":`key_${g}`,name:`key_${g}`,checked:m,disabled:e,onChange:()=>{R({...d,currentReturnOrderQuantity:1})}}),n(ue,{placeholderImage:a,loading:l,product:{...d,totalQuantity:c||1},itemType:"",taxConfig:k,translations:L,showConfigurableOptions:v,disabledIncrementer:!m,onQuantity:c>1?y=>{x(y,d.productSku)}:void 0}),n(H,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:i==null?void 0:i.ReturnOrderItem})]},d.id)}),n("li",{className:"order-return-order-product-list__item",children:n(M,{type:"button",onClick:()=>h("attributes"),disabled:!o.length,children:L.nextStep})})]}),ke=({placeholderImage:a,slots:s,formsRef:i,selectedProductList:l,loading:k,fieldsConfig:L,translations:o,handleChangeStep:R,onSubmit:v})=>{const{formData:x,errors:h,formRef:d,handleChange:g,handleBlur:f,handleSubmit:C}=U({fieldsConfig:ee(L,l==null?void 0:l.length),onSubmit:v});return N("form",{className:"order-return-reason-form",ref:d,onSubmit:C,name:"returnReasonForm",children:[l.map((t,m)=>{var p,O,u,b,T,q;const e=t==null?void 0:t.giftCard,c=t==null?void 0:t.product,y=te(L,m),S=`${t==null?void 0:t.id}_${m}`,E=(t==null?void 0:t.currentReturnOrderQuantity)??1,Q={...t!=null&&t.currentReturnOrderQuantity?{[o.configurationsListQuantity]:E}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[o.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[o.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[o.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[o.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[o.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(p=t==null?void 0:t.downloadableLinks)==null?void 0:p.count} ${o.downloadableCount}`]:(O=t==null?void 0:t.downloadableLinks)==null?void 0:O.result}:{}},r=(b=(u=c==null?void 0:c.thumbnail)==null?void 0:u.url)!=null&&b.length?c.thumbnail.url:a;return N(X,{children:[n(V,{loading:k,title:n("div",{"data-testid":"product-name",children:(T=t==null?void 0:t.product)==null?void 0:T.name}),sku:n("div",{children:c==null?void 0:c.sku}),image:n(Z,{src:r,alt:((q=c==null?void 0:c.thumbnail)==null?void 0:q.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:Q}),n("form",{name:S,ref:i==null?void 0:i.current[m],"data-quantity":E,children:n(z,{className:"className",loading:k,fields:y,onChange:g,onBlur:f,errors:h,values:x})})]},t.id)}),n(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:R},children:N("div",{className:"order-return-reason-form__actions",children:[n(M,{variant:"secondary",type:"button",onClick:()=>{R("products")},children:o.backStep}),n(M,{children:o.submit})]})})]})};export{je as CreateReturn,je as default}; diff --git a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js index 75f96d413f..7f0d1d274f 100644 --- a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js +++ b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as c,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useMemo as S,useState as k,useEffect as E,useCallback as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as z}from"@dropins/tools/event-bus.js";import{c as F}from"../chunks/network-error.js";import{g as q}from"../chunks/getAttributesForm.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.js";import"../chunks/ShippingStatusCard.js";import*as u from"@dropins/tools/preact-compat.js";import{D as Y}from"../chunks/OrderLoaders.js";import{Text as ee,useText as te}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/getFormValues.js";const re=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ne=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),O=(i,e)=>{var d;const m=o=>{const s=Array.isArray(o.value)?o.value.join(" "):o==null?void 0:o.value;return o.label?`${o.label}: ${s}`:s};return(d=i[e])==null?void 0:d.map((o,s)=>r("p",{children:m(o)},`${o.value}${s}`))},oe=i=>{var s,t;const e=i&&i.length>0,m=e?(s=i[0])==null?void 0:s.name:"",d=e?(t=i[0])==null?void 0:t.code:"";return{selectedPaymentMethod:m,selectedPaymentMethodCode:d,hasToDisplayPaymentMethod:e&&m!==""}},ie=({loading:i,order:e,withHeader:m=!0,title:d,paymentIconsMap:o={},normalizeAddress:s,translations:t,slots:l})=>{var D,M,A,N;const g=!!(e!=null&&e.returnNumber),n=(D=e==null?void 0:e.returns)==null?void 0:D[0],h=S(()=>({checkmo:re,card:ne,...o}),[o]);if(!e||i)return r(Y,{});const a=(e==null?void 0:e.email)??"",p=(M=e==null?void 0:e.shipping)==null?void 0:M.code,f=(A=e==null?void 0:e.shipping)==null?void 0:A.amount,w=(N=e==null?void 0:e.shipping)==null?void 0:N.currency,x=e==null?void 0:e.payments,{selectedPaymentMethod:P,selectedPaymentMethodCode:y,hasToDisplayPaymentMethod:H}=oe(x),v=h[y],C=O(s,"shippingAddress")??[],b=O(s,"billingAddress")??[],I=c("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.emailTitle}),r("p",{children:a})]}),V=g?c("div",{className:"order-customer-details-content__container-return-information","data-testid":"returnDetailsBlock",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:r(T,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:l==null?void 0:l.OrderReturnInformation,context:n,children:c(L,{children:[c("p",{children:[t.createdReturnAt,r("span",{children:X(n==null?void 0:n.createdReturnAt)})]}),c("p",{children:[t.returnStatusLabel,r(ee,{id:`Order.CustomerDetails.returnStatus.${U(n==null?void 0:n.returnStatus)}`})]}),c("p",{children:[t.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})})]}):null,W=C.length?c("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:t.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:C})]}):null,j=b.length?c("div",{className:_(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!C.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,R=H?c("div",{className:_(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!p]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.paymentMethodsTitle}),c("p",{"data-testid":"payment_methods_description",className:_([["order-customer-details-content__container-payment_methods--icon",!!v]]),children:[r(T,{"data-testid":"PaymentMethodIcon",name:"PaymentMethodIcon",slot:l==null?void 0:l.PaymentMethodIcon,context:{selectedPaymentMethodCode:y},children:v?r(K,{source:v}):null}),P]})]}):null,Z=p?c("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.shippingMethodsTitle}),f?c("p",{"data-testid":"shipping_methods_price",children:[r(G,{amount:f,currency:w})," ",p]}):r("p",{"data-testid":"shipping_methods_placeholder",children:t==null?void 0:t.freeShipping})]}):null,$=g?V:c(L,{children:[j,Z,R]});return c(J,{"data-testid":"order-details",variant:"secondary",className:_(["order-customer-details-content"]),children:[m?r(Q,{title:d??(t==null?void 0:t.headerText)}):null,c("div",{className:_(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",C.length||b.length]]),children:[I,W,$]})]})},se=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ce=({orderData:i})=>{const[e,m]=k(!0),[d,o]=k(i),[s,t]=k([]);E(()=>{const n=z.on("order/data",h=>{o(h)},{eager:!0});return()=>{n==null||n.off()}},[]),E(()=>{q("shortRequest").then(n=>{if(n){const h=n.map(({name:a,orderNumber:p,label:f})=>({name:F(a),orderNumber:p,label:se.includes(a)?null:f}));t(h)}}).finally(()=>{m(!1)})},[]);const l=B(n=>{if(!s.length||!d||!d[n])return[];const h=Object.fromEntries(Object.entries(d[n]).map(([a,p])=>[a.toLowerCase(),p]));return s.filter(({name:a})=>h[a.toLowerCase()]).map(a=>({name:a.name,orderNumber:a.orderNumber,value:h[a.name.toLowerCase()],label:a.label}))},[s,d]),g=S(()=>({billingAddress:l("billingAddress"),shippingAddress:l("shippingAddress")}),[l]);return{order:d,normalizeAddress:g,loading:e}},Ae=({paymentIconsMap:i,orderData:e,title:m,className:d,slots:o})=>{const s=te({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",paymentMethodsTitle:"Order.CustomerDetails.paymentMethods.title",returnInformationTitle:"Order.CustomerDetails.returnInformation.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping",createdReturnAt:"Order.CustomerDetails.orderReturnLabels.createdReturnAt",orderNumberLabel:"Order.CustomerDetails.orderReturnLabels.orderNumberLabel",returnStatusLabel:"Order.CustomerDetails.orderReturnLabels.returnStatusLabel"}),{order:t,normalizeAddress:l,loading:g}=ce({orderData:e});return r("div",{className:_(["order-customer-details",d]),children:r(ie,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ae as CustomerDetails,Ae as default}; +import{jsx as r,jsxs as d,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useMemo as S,useState as k,useEffect as E,useCallback as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as z}from"@dropins/tools/event-bus.js";import{c as F}from"../chunks/transform-attributes-form.js";import{g as q}from"../chunks/getAttributesForm.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.js";import"../chunks/ShippingStatusCard.js";import*as u from"@dropins/tools/preact-compat.js";import{D as Y}from"../chunks/OrderLoaders.js";import{Text as ee,useText as te}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getFormValues.js";const re=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ne=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),O=(i,e)=>{var c;const m=o=>{const s=Array.isArray(o.value)?o.value.join(" "):o==null?void 0:o.value;return o.label?`${o.label}: ${s}`:s};return(c=i[e])==null?void 0:c.map((o,s)=>r("p",{children:m(o)},`${o.value}${s}`))},oe=i=>{var s,t;const e=i&&i.length>0,m=e?(s=i[0])==null?void 0:s.name:"",c=e?(t=i[0])==null?void 0:t.code:"";return{selectedPaymentMethod:m,selectedPaymentMethodCode:c,hasToDisplayPaymentMethod:e&&m!==""}},ie=({loading:i,order:e,withHeader:m=!0,title:c,paymentIconsMap:o={},normalizeAddress:s,translations:t,slots:l})=>{var D,M,A,N;const g=!!(e!=null&&e.returnNumber),n=(D=e==null?void 0:e.returns)==null?void 0:D[0],h=S(()=>({checkmo:re,card:ne,...o}),[o]);if(!e||i)return r(Y,{});const a=(e==null?void 0:e.email)??"",p=(M=e==null?void 0:e.shipping)==null?void 0:M.code,f=(A=e==null?void 0:e.shipping)==null?void 0:A.amount,w=(N=e==null?void 0:e.shipping)==null?void 0:N.currency,x=e==null?void 0:e.payments,{selectedPaymentMethod:P,selectedPaymentMethodCode:y,hasToDisplayPaymentMethod:H}=oe(x),v=h[y],C=O(s,"shippingAddress")??[],b=O(s,"billingAddress")??[],I=d("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.emailTitle}),r("p",{children:a})]}),V=g?d("div",{className:"order-customer-details-content__container-return-information","data-testid":"returnDetailsBlock",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:r(T,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:l==null?void 0:l.OrderReturnInformation,context:n,children:d(L,{children:[d("p",{children:[t.createdReturnAt,r("span",{children:X(n==null?void 0:n.createdReturnAt)})]}),d("p",{children:[t.returnStatusLabel,r(ee,{id:`Order.CustomerDetails.returnStatus.${U(n==null?void 0:n.returnStatus)}`})]}),d("p",{children:[t.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})})]}):null,W=C.length?d("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:t.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:C})]}):null,j=b.length?d("div",{className:_(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!C.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,R=H?d("div",{className:_(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!p]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.paymentMethodsTitle}),d("p",{"data-testid":"payment_methods_description",className:_([["order-customer-details-content__container-payment_methods--icon",!!v]]),children:[r(T,{"data-testid":"PaymentMethodIcon",name:"PaymentMethodIcon",slot:l==null?void 0:l.PaymentMethodIcon,context:{selectedPaymentMethodCode:y},children:v?r(K,{source:v}):null}),P]})]}):null,Z=p?d("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.shippingMethodsTitle}),f?d("p",{"data-testid":"shipping_methods_price",children:[r(G,{amount:f,currency:w})," ",p]}):r("p",{"data-testid":"shipping_methods_placeholder",children:t==null?void 0:t.freeShipping})]}):null,$=g?V:d(L,{children:[j,Z,R]});return d(J,{"data-testid":"order-details",variant:"secondary",className:_(["order-customer-details-content"]),children:[m?r(Q,{title:c??(t==null?void 0:t.headerText)}):null,d("div",{className:_(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",C.length||b.length]]),children:[I,W,$]})]})},se=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ce=({orderData:i})=>{const[e,m]=k(!0),[c,o]=k(i),[s,t]=k([]);E(()=>{const n=z.on("order/data",h=>{o(h)},{eager:!0});return()=>{n==null||n.off()}},[]),E(()=>{q("shortRequest").then(n=>{if(n){const h=n.map(({name:a,orderNumber:p,label:f})=>({name:F(a),orderNumber:p,label:se.includes(a)?null:f}));t(h)}}).finally(()=>{m(!1)})},[]);const l=B(n=>{if(!s.length||!c||!c[n])return[];const h=c[n]?Object.fromEntries(Object.entries(c[n]).map(([a,p])=>[a.toLowerCase(),p])):{};return s.filter(({name:a})=>h[a.toLowerCase()]).map(a=>({name:a.name,orderNumber:a.orderNumber,value:h[a.name.toLowerCase()],label:a.label}))},[s,c]),g=S(()=>({billingAddress:l("billingAddress"),shippingAddress:l("shippingAddress")}),[l]);return{order:c,normalizeAddress:g,loading:e}},Ae=({paymentIconsMap:i,orderData:e,title:m,className:c,slots:o})=>{const s=te({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",paymentMethodsTitle:"Order.CustomerDetails.paymentMethods.title",returnInformationTitle:"Order.CustomerDetails.returnInformation.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping",createdReturnAt:"Order.CustomerDetails.orderReturnLabels.createdReturnAt",orderNumberLabel:"Order.CustomerDetails.orderReturnLabels.orderNumberLabel",returnStatusLabel:"Order.CustomerDetails.orderReturnLabels.returnStatusLabel"}),{order:t,normalizeAddress:l,loading:g}=ce({orderData:e});return r("div",{className:_(["order-customer-details",c]),children:r(ie,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ae as CustomerDetails,Ae as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index 0933505eac..01a1c79ea2 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../fragments.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/initialize.js";import"../chunks/network-error.js";export{C as OrderCancelForm,F as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index 18e66d9b0a..44ed3b57d6 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as c,jsxs as i,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Z}from"@dropins/tools/lib.js";import{useState as g,useEffect as V}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{Price as d,Icon as E,Accordion as f,AccordionSection as D,Card as I,Header as k}from"@dropins/tools/components.js";import{u as z}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{O as A}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const $=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),P=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),W=({orderData:s,config:e})=>{const[t,n]=g(!0),[u,r]=g(s),[l,m]=g(null);return V(()=>{if(e){const{shoppingCartDisplayPrice:o,shoppingOrdersDisplayShipping:a,shoppingOrdersDisplaySubtotal:h,...y}=e;m(p=>({...p,...y,shoppingCartDisplayPrice:S(o),shoppingOrdersDisplayShipping:S(a),shoppingOrdersDisplaySubtotal:S(h)})),n(!1)}},[e]),V(()=>{const o=b.on("order/data",a=>{r(a)},{eager:!0});return()=>{o==null||o.off()}},[]),{loading:t,storeConfig:l,order:u}},mt=({withHeader:s,orderData:e,children:t,className:n,...u})=>{const r=z(),{loading:l,storeConfig:m,order:o}=W({orderData:e,config:r}),a=B({subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText"});return c("div",{...u,className:Z(["order-cost-summary",n]),children:c(K,{order:o,withHeader:s,loading:l,storeConfig:m,translations:a})})},q=({translations:s,order:e,subtotalInclTax:t,subtotalExclTax:n,shoppingOrdersDisplaySubtotal:u})=>{var h,y,p,x;const r=u.taxIncluded,l=u.taxExcluded,m=r&&!l?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(h=e==null?void 0:e.subtotalInclTax)==null?void 0:h.currency,amount:t})]}),c("div",{className:"order-cost-summary-content__description--subheader",children:c("span",{children:s.incl})})]}):null,o=l&&!r?i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(y=e==null?void 0:e.subtotalExclTax)==null?void 0:y.currency,amount:n})]}):null,a=l&&r?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(p=e==null?void 0:e.subtotalInclTax)==null?void 0:p.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[c(d,{currency:(x=e==null?void 0:e.subtotalExclTax)==null?void 0:x.currency,amount:n,size:"small",weight:"bold"})," ",c("span",{children:s.excl})]})]}):null;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[m,o,a]})},F=({translations:s,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var u,r,l,m;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.shipping}),(u=t==null?void 0:t.totalShipping)!=null&&u.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:s.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(v,{children:[c(d,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:(m=t==null?void 0:t.totalShipping)==null?void 0:m.value,size:"small"}),i("span",{children:[" ",s.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:s.incl}):null]})]})},U=({translations:s,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,l,m,o;const u=(r=e==null?void 0:e.discounts)==null?void 0:r.every(a=>a.amount.value===0);return!((l=e==null?void 0:e.discounts)!=null&&l.length)&&(u||!t||t<1)||(m=e==null?void 0:e.discounts)!=null&&m.length&&u?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.discount}),c("span",{children:(o=e==null?void 0:e.discounts)==null?void 0:o.map(({amount:a},h)=>{const p=((a==null?void 0:a.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:a==null?void 0:a.currency,amount:-p},`${a==null?void 0:a.value}${h}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(E,{source:P,size:"16"}),c("span",{children:s.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},G=({order:s})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=s==null?void 0:s.coupons)==null?void 0:e.map((t,n)=>c("div",{className:"order-cost-summary-content__description--header",children:c("span",{children:t.code})},`${t==null?void 0:t.code}${n}`))})},R=({translations:s,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var l,m,o;const[u,r]=g(!1);return e?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:$,iconClose:j,children:i(D,{onStateChange:r,title:s.accordionTitle,secondaryText:c(v,{children:u?null:c(d,{weight:"normal",amount:t,currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((a,h)=>{var y,p,x;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:a==null?void 0:a.title}),c("p",{children:c(d,{weight:"normal",amount:(y=a==null?void 0:a.amount)==null?void 0:y.value,currency:(p=a==null?void 0:a.amount)==null?void 0:p.currency})})]},`${(x=a==null?void 0:a.amount)==null?void 0:x.value}${h}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:s.accordionTotalTax}),c("p",{children:c(d,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.tax}),c(d,{currency:(l=n==null?void 0:n.totalTax)==null?void 0:l.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},J=({translations:s,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,u,r,l;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(u=t==null?void 0:t.grandTotal)==null?void 0:u.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:s.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((l=t==null?void 0:t.grandTotal)==null?void 0:l.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},K=({translations:s,loading:e,storeConfig:t,order:n,withHeader:u=!0})=>{var p,x,w,O,T,L,M;if(e||!n)return c(A,{});const r=((p=n==null?void 0:n.totalGiftcard)==null?void 0:p.value)??0,l=((x=n.totalGiftcard)==null?void 0:x.currency)??"",m=((w=n.subtotalInclTax)==null?void 0:w.value)??0,o=((O=n.subtotalExclTax)==null?void 0:O.value)??0,a=((T=n.totalShipping)==null?void 0:T.value)??0,h=!!((L=n==null?void 0:n.taxes)!=null&&L.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=h?(M=n==null?void 0:n.taxes)==null?void 0:M.reduce((N,C)=>{var H;return+((H=C==null?void 0:C.amount)==null?void 0:H.value)+N},0):0;return i(I,{variant:"secondary",className:Z(["order-cost-summary-content"]),children:[u?c(k,{title:s.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(q,{translations:s,order:n,subtotalInclTax:m,subtotalExclTax:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(F,{translations:s,order:n,totalShipping:a,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(U,{translations:s,order:n,totalGiftcardValue:r,totalGiftcardCurrency:l}),c(G,{order:n}),c(R,{order:n,translations:s,renderTaxAccordion:h,totalAccordionTaxValue:y}),c(J,{translations:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{mt as OrderCostSummary,mt as default}; +import{jsx as c,jsxs as i,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Z}from"@dropins/tools/lib.js";import{useState as g,useEffect as V}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{Price as d,Icon as E,Accordion as f,AccordionSection as D,Card as I,Header as k}from"@dropins/tools/components.js";import{u as z}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{O as A}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const $=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),P=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),W=({orderData:s,config:e})=>{const[t,n]=g(!0),[u,r]=g(s),[l,m]=g(null);return V(()=>{if(e){const{shoppingOrderDisplayPrice:o,shoppingOrdersDisplayShipping:a,shoppingOrdersDisplaySubtotal:h,...y}=e;m(p=>({...p,...y,shoppingOrderDisplayPrice:S(o),shoppingOrdersDisplayShipping:S(a),shoppingOrdersDisplaySubtotal:S(h)})),n(!1)}},[e]),V(()=>{const o=b.on("order/data",a=>{r(a)},{eager:!0});return()=>{o==null||o.off()}},[]),{loading:t,storeConfig:l,order:u}},mt=({withHeader:s,orderData:e,children:t,className:n,...u})=>{const r=z(),{loading:l,storeConfig:m,order:o}=W({orderData:e,config:r}),a=B({subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText"});return c("div",{...u,className:Z(["order-cost-summary",n]),children:c(K,{order:o,withHeader:s,loading:l,storeConfig:m,translations:a})})},q=({translations:s,order:e,subtotalInclTax:t,subtotalExclTax:n,shoppingOrdersDisplaySubtotal:u})=>{var h,y,p,x;const r=u.taxIncluded,l=u.taxExcluded,m=r&&!l?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(h=e==null?void 0:e.subtotalInclTax)==null?void 0:h.currency,amount:t})]}),c("div",{className:"order-cost-summary-content__description--subheader",children:c("span",{children:s.incl})})]}):null,o=l&&!r?i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(y=e==null?void 0:e.subtotalExclTax)==null?void 0:y.currency,amount:n})]}):null,a=l&&r?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(p=e==null?void 0:e.subtotalInclTax)==null?void 0:p.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[c(d,{currency:(x=e==null?void 0:e.subtotalExclTax)==null?void 0:x.currency,amount:n,size:"small",weight:"bold"})," ",c("span",{children:s.excl})]})]}):null;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[m,o,a]})},F=({translations:s,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var u,r,l,m;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.shipping}),(u=t==null?void 0:t.totalShipping)!=null&&u.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:s.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(v,{children:[c(d,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:(m=t==null?void 0:t.totalShipping)==null?void 0:m.value,size:"small"}),i("span",{children:[" ",s.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:s.incl}):null]})]})},U=({translations:s,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,l,m,o;const u=(r=e==null?void 0:e.discounts)==null?void 0:r.every(a=>a.amount.value===0);return!((l=e==null?void 0:e.discounts)!=null&&l.length)&&(u||!t||t<1)||(m=e==null?void 0:e.discounts)!=null&&m.length&&u?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.discount}),c("span",{children:(o=e==null?void 0:e.discounts)==null?void 0:o.map(({amount:a},h)=>{const p=((a==null?void 0:a.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:a==null?void 0:a.currency,amount:-p},`${a==null?void 0:a.value}${h}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(E,{source:P,size:"16"}),c("span",{children:s.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},G=({order:s})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=s==null?void 0:s.coupons)==null?void 0:e.map((t,n)=>c("div",{className:"order-cost-summary-content__description--header",children:c("span",{children:t.code})},`${t==null?void 0:t.code}${n}`))})},R=({translations:s,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var l,m,o;const[u,r]=g(!1);return e?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:$,iconClose:j,children:i(D,{onStateChange:r,title:s.accordionTitle,secondaryText:c(v,{children:u?null:c(d,{weight:"normal",amount:t,currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((a,h)=>{var y,p,x;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:a==null?void 0:a.title}),c("p",{children:c(d,{weight:"normal",amount:(y=a==null?void 0:a.amount)==null?void 0:y.value,currency:(p=a==null?void 0:a.amount)==null?void 0:p.currency})})]},`${(x=a==null?void 0:a.amount)==null?void 0:x.value}${h}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:s.accordionTotalTax}),c("p",{children:c(d,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.tax}),c(d,{currency:(l=n==null?void 0:n.totalTax)==null?void 0:l.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},J=({translations:s,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,u,r,l;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(u=t==null?void 0:t.grandTotal)==null?void 0:u.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:s.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((l=t==null?void 0:t.grandTotal)==null?void 0:l.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},K=({translations:s,loading:e,storeConfig:t,order:n,withHeader:u=!0})=>{var p,x,O,w,T,L,M;if(e||!n)return c(A,{});const r=((p=n==null?void 0:n.totalGiftcard)==null?void 0:p.value)??0,l=((x=n.totalGiftcard)==null?void 0:x.currency)??"",m=((O=n.subtotalInclTax)==null?void 0:O.value)??0,o=((w=n.subtotalExclTax)==null?void 0:w.value)??0,a=((T=n.totalShipping)==null?void 0:T.value)??0,h=!!((L=n==null?void 0:n.taxes)!=null&&L.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=h?(M=n==null?void 0:n.taxes)==null?void 0:M.reduce((N,C)=>{var H;return+((H=C==null?void 0:C.amount)==null?void 0:H.value)+N},0):0;return i(I,{variant:"secondary",className:Z(["order-cost-summary-content"]),children:[u?c(k,{title:s.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(q,{translations:s,order:n,subtotalInclTax:m,subtotalExclTax:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(F,{translations:s,order:n,totalShipping:a,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(U,{translations:s,order:n,totalGiftcardValue:r,totalGiftcardCurrency:l}),c(G,{order:n}),c(R,{order:n,translations:s,renderTaxAccordion:h,totalAccordionTaxValue:y}),c(J,{translations:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{mt as OrderCostSummary,mt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderHeader.js b/scripts/__dropins__/storefront-order/containers/OrderHeader.js index d73431e6fa..09e053c519 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderHeader.js +++ b/scripts/__dropins__/storefront-order/containers/OrderHeader.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as l,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import{Icon as O,Header as d,Button as H}from"@dropins/tools/components.js";import{useState as f,useEffect as p}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import*as c from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as _}from"@dropins/tools/event-bus.js";import{b}from"../chunks/OrderLoaders.js";import{useText as w,Text as L}from"@dropins/tools/i18n.js";const V=e=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},c.createElement("g",{clipPath:"url(#clip0_4797_15077)"},c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),c.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),c.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),c.createElement("defs",null,c.createElement("clipPath",{id:"clip0_4797_15077"},c.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"}))));function s(e){var r;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(i=>({attribute_code:i.code,value:i.value})))||[]}}const M=({orderData:e,handleEmailAvailability:r,handleSignUpClick:i})=>{const[t,v]=f(e),[u,N]=f(),[C,h]=f(r?void 0:!0),a=t==null?void 0:t.email,E=i&&t!==void 0&&u===!1&&C===!0?()=>{const o=t.shippingAddress,n=t.billingAddress,A=[{code:"email",defaultValue:t.email},{code:"firstname",defaultValue:(n==null?void 0:n.firstName)??""},{code:"lastname",defaultValue:(n==null?void 0:n.lastName)??""}];let m=[];if(o){const g={...s(o),default_shipping:!0};m=[{...s(n),default_billing:!0},g]}else m=[{...s(n),default_billing:!0,default_shipping:!0}];i({inputsDefaultValueSet:A,addressesData:m})}:void 0;return p(()=>{const o=_.on("authenticated",n=>{N(n)},{eager:!0});return()=>{o==null||o.off()}},[]),p(()=>{const o=_.on("order/data",n=>{v(n)},{eager:!0});return()=>{o==null||o.off()}},[]),p(()=>{r&&u!==void 0&&(u||!a||r(a).then(o=>h(o)).catch(()=>h(!0)))},[u,r,a]),{order:t,onSignUpClickHandler:E}},R=e=>{var t;const{order:r,onSignUpClickHandler:i}=M(e);return l("div",{children:r?l(j,{customerName:(t=r.billingAddress)==null?void 0:t.firstName,onSignUpClick:i,orderNumber:r.number}):l(b,{})})},j=({customerName:e,orderNumber:r,onSignUpClick:i})=>{const t=w({title:l(L,{id:"Order.OrderHeader.title",fields:{name:e}}),defaultTitle:"Order.OrderHeader.defaultTitle",order:l(L,{id:"Order.OrderHeader.order",fields:{order:r}}),createAccountMessage:"Order.OrderHeader.CreateAccount.message",createAccountButton:"Order.OrderHeader.CreateAccount.button"});return k("div",{"data-testid":"order-header",className:"order-header order-header__card",children:[l(O,{source:V,size:"64",className:"order-header__icon"}),l(d,{className:"order-header__title",title:t.title,size:"large",divider:!1,children:e?t.title:t.defaultTitle}),l("p",{className:"order-header__order",children:t.order}),i&&k("div",{className:"order-header-create-account",children:[l("p",{className:"order-header-create-account__message",children:t.createAccountMessage}),l(H,{"data-testid":"create-account-button",className:"order-header-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:i,children:t.createAccountButton})]})]})};export{R as OrderHeader,R as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 2c8ad403ba..15e12060fb 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as a,jsxs as g}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as q,Header as R}from"@dropins/tools/components.js";import{useState as P,useEffect as S,useMemo as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import{Fragment as x}from"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as Q}from"../chunks/setTaxStatus.js";import{a as k}from"../chunks/OrderLoaders.js";import{C as G}from"../chunks/CartSummaryItem.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const v=({orderData:n})=>{const[u,i]=P(!0),[e,r]=P(n);return S(()=>{const t=N.on("order/data",o=>{r(o),i(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:u,order:e}},Y=({className:n,orderData:u,withHeader:i,showConfigurableOptions:e,routeProductDetails:r})=>{const t=b(),{loading:o,order:d}=v({orderData:u});return a("div",{className:h(["order-order-product-list",n]),children:a(I,{loading:o,placeholderImage:(t==null?void 0:t.baseMediaUrl)??"",taxConfig:Q((t==null?void 0:t.shoppingCartDisplayPrice)??0),order:d,withHeader:i,showConfigurableOptions:e,routeProductDetails:r})})},w=n=>{const u=(n==null?void 0:n.items)??[],i=u.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),e=new Map(i.map(t=>[t.id,t])),r=u.map(t=>{const o=e.get(t==null?void 0:t.id);if(o){const d=t.totalQuantity-o.quantityReturnRequested;return d===0?null:{...t,totalQuantity:d}}return t}).filter(t=>t!==null);return{returnedList:i,canceledItems:r==null?void 0:r.filter(t=>t.quantityCanceled),nonCanceledItems:r==null?void 0:r.filter(t=>!t.quantityCanceled)}},I=({placeholderImage:n,loading:u,taxConfig:i,order:e=null,withHeader:r=!0,showConfigurableOptions:t,routeProductDetails:o})=>{const d=!!(e!=null&&e.returnNumber),c=M({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=T(()=>{var p,f;if(!e)return[];if(!d){const{returnedList:s,canceledItems:m,nonCanceledItems:O}=w(e);return[{type:"returned",list:s,title:c.returned},{type:"cancelled",list:m,title:c.cancelled},{type:"allItems",list:O,title:c.allOrders}].filter(C=>{var y;return((y=C==null?void 0:C.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((f=(p=e.returns.find(s=>s.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:p.items)==null?void 0:f.map(s=>({...s,totalQuantity:s.requestQuantity})))??[],title:c.returned}]},[e,d,c]);return e?L.every(l=>l.list.length===0)?null:a(q,{variant:"secondary",className:"order-order-product-list-content",children:L.map((l,p)=>{var s;const f=l.list.reduce((m,{totalQuantity:O})=>O+m,0);return g(x,{children:[r?a(R,{title:`${l.title} (${f})`}):null,a("ul",{className:"order-order-product-list-content__items",children:(s=l.list)==null?void 0:s.map(m=>a("li",{"data-testid":"order-product-list-content-item",children:a(G,{placeholderImage:n,loading:u,product:m,itemType:l.type,taxConfig:i,translations:c,showConfigurableOptions:t,routeProductDetails:o})},m.id))})]},p)})}):a(k,{})};export{Y as OrderProductList,Y as default}; +import{jsx as d,jsxs as g}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as q,Header as R}from"@dropins/tools/components.js";import{useState as P,useEffect as S,useMemo as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import{Fragment as x}from"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as Q}from"../chunks/setTaxStatus.js";import{a as k}from"../chunks/OrderLoaders.js";import{C as G}from"../chunks/CartSummaryItem.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const v=({orderData:s})=>{const[i,o]=P(!0),[e,r]=P(s);return S(()=>{const t=N.on("order/data",l=>{r(l),o(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:i,order:e}},Y=({className:s,orderData:i,withHeader:o,showConfigurableOptions:e,routeProductDetails:r})=>{const t=b(),{loading:l,order:a}=v({orderData:i});return d("div",{className:h(["order-order-product-list",s]),children:d(I,{loading:l,placeholderImage:(t==null?void 0:t.baseMediaUrl)??"",taxConfig:Q((t==null?void 0:t.shoppingOrderDisplayPrice)??0),order:a,withHeader:o,showConfigurableOptions:e,routeProductDetails:r})})},w=s=>{const i=(s==null?void 0:s.items)??[],o=i.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),e=new Map(o.map(t=>[t.id,t])),r=i.map(t=>{const l=e.get(t==null?void 0:t.id);if(l){const a=t.totalQuantity-l.quantityReturnRequested;return a===0?null:{...t,totalQuantity:a}}return t}).filter(t=>t!==null);return{returnedList:o,canceledItems:r==null?void 0:r.filter(t=>t.quantityCanceled),nonCanceledItems:r==null?void 0:r.filter(t=>!t.quantityCanceled)}},I=({placeholderImage:s,loading:i,taxConfig:o,order:e=null,withHeader:r=!0,showConfigurableOptions:t,routeProductDetails:l})=>{const a=!!(e!=null&&e.returnNumber),m=M({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=T(()=>{var p,f;if(!e)return[];if(!a){const{returnedList:u,canceledItems:n,nonCanceledItems:O}=w(e);return[{type:"returned",list:u,title:m.returned},{type:"cancelled",list:n,title:m.cancelled},{type:"allItems",list:O,title:m.allOrders}].filter(C=>{var y;return((y=C==null?void 0:C.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((f=(p=e.returns.find(u=>u.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:p.items)==null?void 0:f.map(u=>({...u,totalQuantity:u.requestQuantity})))??[],title:m.returned}]},[e,a,m]);return e?L.every(c=>c.list.length===0)?null:d(q,{variant:"secondary",className:"order-order-product-list-content",children:L.map((c,p)=>{var u;const f=c.list.filter(n=>n!==null).reduce((n,{totalQuantity:O})=>O+n,0);return g(x,{children:[r?d(R,{title:`${c.title} (${f})`}):null,d("ul",{className:"order-order-product-list-content__items",children:(u=c.list)==null?void 0:u.filter(n=>n!==null).map(n=>d("li",{"data-testid":"order-product-list-content-item",children:d(G,{placeholderImage:s,loading:i,product:n,itemType:c.type,taxConfig:o,translations:m,showConfigurableOptions:t,routeProductDetails:l})},n.id))})]},p)})}):d(k,{})};export{Y as OrderProductList,Y as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderReturns.js b/scripts/__dropins__/storefront-order/containers/OrderReturns.js index c4d2b9a826..1a10e50549 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderReturns.js +++ b/scripts/__dropins__/storefront-order/containers/OrderReturns.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as p,useEffect as O}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as g}from"@dropins/tools/event-bus.js";import{u as w}from"../chunks/useIsMobile.js";import{R as N}from"../chunks/ReturnsListContent.js";import{useText as $}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";import"../chunks/capitalizeFirst.js";const h=({orderData:s})=>{const[i,n]=p(s),[o,u]=p([]);return O(()=>{const t=g.on("order/data",e=>{n(e),u(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:o}},B=({slots:s,className:i,orderData:n,withHeader:o,withThumbnails:u,routeReturnDetails:t,routeProductDetails:e,routeTracking:l})=>{const m=b(),{orderReturns:a}=h({orderData:n}),f=w(),r="fullSizeView",c=(m==null?void 0:m.baseMediaUrl)??"",R=$({minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return d("div",{className:L(["order-order-returns",i]),children:a.length?d(N,{placeholderImage:c,pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:f,withOrderNumber:!1,withReturnNumber:!0,orderReturns:a,translations:R,withHeader:o,withThumbnails:u,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:l,loading:!1}):null})};export{B as OrderReturns,B as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderSearch.js b/scripts/__dropins__/storefront-order/containers/OrderSearch.js index e391860b18..6eaf75b62f 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderSearch.js +++ b/scripts/__dropins__/storefront-order/containers/OrderSearch.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as t,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as M}from"@dropins/tools/lib.js";import{Card as V,InLineAlert as k,Icon as C,Button as q}from"@dropins/tools/components.js";import{useState as v,useCallback as F,useEffect as _,useMemo as D}from"@dropins/tools/preact-hooks.js";import{F as H}from"../chunks/ShippingStatusCard.js";import*as w from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{F as g,g as B}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E}from"../chunks/getQueryParam.js";import{g as x,a as z}from"../chunks/getGuestOrder.js";import{useText as U,Text as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/initialize.js";const X=s=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},w.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),Z=({onError:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[b,u]=v({text:"",type:"success"}),[y,p]=v(!1),n=U({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",lastname:"Order.OrderSearchForm.lastname",number:"Order.OrderSearchForm.orderNumber"}),R=F(async e=>{const l=E("orderRef"),o=l&&l.length>20;if(!e&&!l||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!l)return null;if(r){const d=await x();(d==null?void 0:d.email)===e.email?f(i,{orderRef:e==null?void 0:e.number}):o||f(c,{orderRef:e.token})}else o||f(c,{orderRef:e==null?void 0:e.token})},[r,i,c]);_(()=>{const e=N.on("order/data",l=>{R(l)},{eager:!0});return()=>{e==null||e.off()}},[R]),_(()=>{const e=E("orderRef"),l=e&&e.length>20?e:null;e&&(l?f(c,{orderRef:e}):r?f(i,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[r,i,c,a]);const O=D(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.email,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.lastname,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.number,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[n]);return{onSubmit:F(async(e,l)=>{if(!l)return null;p(!0);const o=B(e.target);await z(o).then(m=>{m||u({text:n.invalidSearch,type:"warning"}),N.emit("order/data",m)}).catch(async m=>{var S;let d=!0;s==null||s({error:m.message});const h=r?await x():{email:""};(h==null?void 0:h.email)===(o==null?void 0:o.email)?f(i,{orderRef:o.number}):d=a==null?void 0:a({render:h===null||((S=m==null?void 0:m.message)==null?void 0:S.includes("Please login to view the order.")),formValues:o}),d&&u({text:m.message,type:"warning"})}).finally(()=>{p(!1)})},[r,s,a,i,n.invalidSearch]),inLineAlert:b,loading:y,normalizeFieldsConfig:O}},ne=({className:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c,onError:b})=>{const{onSubmit:u,loading:y,inLineAlert:p,normalizeFieldsConfig:n}=Z({onError:b,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return t("div",{className:M(["order-order-search",s]),children:t(j,{onSubmit:u,loading:y,inLineAlert:p,fieldsConfig:n})})},j=({onSubmit:s,loading:r,inLineAlert:a,fieldsConfig:i})=>L(V,{variant:"secondary",className:"order-order-search-form",children:[t("h2",{className:"order-order-search-form__title",children:t(T,{id:"Order.OrderSearchForm.title"})}),t("p",{children:t(T,{id:"Order.OrderSearchForm.description"})}),a.text?t(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:t(C,{source:X})}):null,t(H,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:r,fieldsConfig:i,onSubmit:s,children:t("div",{className:"order-order-search-form__button-container",children:t(q,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:r,children:t(T,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});export{ne as OrderSearch,ne as default}; +import{jsx as t,jsxs as q}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import{Card as M,InLineAlert as V,Icon as k,Button as C}from"@dropins/tools/components.js";import{useState as v,useCallback as F,useEffect as _,useMemo as D}from"@dropins/tools/preact-hooks.js";import{F as U}from"../chunks/ShippingStatusCard.js";import*as w from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{F as g,g as H}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E}from"../chunks/getQueryParam.js";import{g as x,a as B}from"../chunks/getGuestOrder.js";import{useText as z,Text as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/initialize.js";const X=s=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},w.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),Z=({onError:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[b,u]=v({text:"",type:"success"}),[y,p]=v(!1),n=z({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",lastname:"Order.OrderSearchForm.lastname",number:"Order.OrderSearchForm.orderNumber"}),R=F(async e=>{const l=E("orderRef"),o=l&&l.length>20;if(!e&&!l||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!l)return null;if(r){const d=await x();(d==null?void 0:d.email)===e.email?f(i,{orderRef:e==null?void 0:e.number}):o||f(c,{orderRef:e.token})}else o||f(c,{orderRef:e==null?void 0:e.token})},[r,i,c]);_(()=>{const e=N.on("order/data",l=>{R(l)},{eager:!0});return()=>{e==null||e.off()}},[R]),_(()=>{const e=E("orderRef"),l=e&&e.length>20?e:null;e&&(l?f(c,{orderRef:e}):r?f(i,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[r,i,c,a]);const O=D(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.email,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email",isUnique:!1},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.lastname,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname",isUnique:!1},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.number,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number",isUnique:!1}],[n]);return{onSubmit:F(async(e,l)=>{if(!l)return null;p(!0);const o=H(e.target);await B(o).then(m=>{m||u({text:n.invalidSearch,type:"warning"}),N.emit("order/data",m)}).catch(async m=>{var S;let d=!0;s==null||s({error:m.message});const h=r?await x():{email:""};(h==null?void 0:h.email)===(o==null?void 0:o.email)?f(i,{orderRef:o.number}):d=a==null?void 0:a({render:h===null||((S=m==null?void 0:m.message)==null?void 0:S.includes("Please login to view the order.")),formValues:o}),d&&u({text:m.message,type:"warning"})}).finally(()=>{p(!1)})},[r,s,a,i,n.invalidSearch]),inLineAlert:b,loading:y,normalizeFieldsConfig:O}},ne=({className:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c,onError:b})=>{const{onSubmit:u,loading:y,inLineAlert:p,normalizeFieldsConfig:n}=Z({onError:b,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return t("div",{className:L(["order-order-search",s]),children:t(j,{onSubmit:u,loading:y,inLineAlert:p,fieldsConfig:n})})},j=({onSubmit:s,loading:r,inLineAlert:a,fieldsConfig:i})=>q(M,{variant:"secondary",className:"order-order-search-form",children:[t("h2",{className:"order-order-search-form__title",children:t(T,{id:"Order.OrderSearchForm.title"})}),t("p",{children:t(T,{id:"Order.OrderSearchForm.description"})}),a.text?t(V,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:t(k,{source:X})}):null,t(U,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:r,fieldsConfig:i,onSubmit:s,children:t("div",{className:"order-order-search-form__button-container",children:t(C,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:r,children:t(T,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});export{ne as OrderSearch,ne as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 1e1d15df87..4eac665aaf 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ -import{jsx as s,Fragment as S,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as _}from"@dropins/tools/lib.js";import{Button as P,InLineAlert as B,Modal as V,Card as K,Header as Q}from"@dropins/tools/components.js";import{useState as C,useEffect as k,useCallback as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as J}from"@dropins/tools/preact-compat.js";import{u as G}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{a as X,c as Y,r as Z}from"../chunks/confirmCancelOrder.js";import{useText as O,Text as M}from"@dropins/tools/i18n.js";import{C as D}from"../chunks/OrderLoaders.js";import{f as ee}from"../chunks/returnOrdersHelper.js";import{f as w}from"../chunks/formatDateToLocale.js";import{c as b}from"../chunks/capitalizeFirst.js";import{r as U}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../fragments.js";import"../chunks/initialize.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";var y=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(y||{});const re=({className:t,orderData:e,slots:n,routeCreateReturn:r,routeOnSuccess:u,onError:i})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=J(()=>{const c=e==null?void 0:e.availableActions,o=!!(c!=null&&c.length),a=!!(e!=null&&e.returnNumber),m=()=>{U(r,{},e)};return s(S,{children:n!=null&&n.OrderActions?s($,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:e}):s("div",{"data-testid":"availableActionsList",className:_(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:c==null?void 0:c.map(p=>{switch(p){case y.CANCEL:return s(S,{children:a?null:s(ce,{orderRef:(e==null?void 0:e.token)??(e==null?void 0:e.id)})});case y.RETURN:return s(P,{variant:"secondary",onClick:m,children:a?d.createAnotherReturn:d.createReturn});case y.REORDER:return s(S,{children:a?null:s(ie,{orderData:e,onError:i,routeOnSuccess:u,children:d.reorder})})}})})})},[i,e,u,r,n,d]);return s("div",{className:_(["order-order-actions",t]),children:l})},ne=({orderData:t})=>{const[e,n]=C(t),[r,u]=C(t==null?void 0:t.status);return k(()=>{const i=I.on("order/data",d=>{n(d),u(d.status)},{eager:!0});return()=>{i==null||i.off()}},[]),{orderStatus:r,order:e}},H=t=>{const e=new URL(window.location.href);t.forEach(n=>{e.searchParams.has(n)&&e.searchParams.delete(n)}),window.history.replaceState({},document.title,e.toString())},se=({enableOrderCancellation:t})=>{const e=O({cancelOrderHeading:"Order.OrderStatusContent.actions.cancel",confirmGuestReturnHeading:"Order.OrderStatusContent.actions.confirmGuestReturn",orderCancelled:"Order.OrderStatusContent.orderCanceled.message",guestRequestReturnMessage:"Order.OrderStatusContent.actions.confirmGuestReturnMessage"}),[n,r]=C(!1),[u,i]=C(!1),[d,l]=C({heading:"",text:"",status:void 0}),c=T(()=>{r(!0),H(["order_id","confirmation_key","action"])},[]),o=T((a,m,p)=>{l({heading:a,text:m,status:p}),H(["action"])},[]);return k(()=>{const a=new URLSearchParams(window.location.search),m=a.get("order_id")??"",p=a.get("confirmation_key")??"",g=a.get("action")??"";u||!m||!p||!g||(t&&g==="cancel"&&(i(!0),X(m,p).then(()=>{l({heading:e.cancelOrderHeading,text:e.orderCancelled,status:"success"})}).catch(h=>{l({heading:e.cancelOrderHeading,text:h.message,status:"warning"})})),g==="return"&&(i(!0),Y(m,p).then(()=>{l({heading:e.confirmGuestReturnHeading,text:e.guestRequestReturnMessage,status:"success"})}).catch(h=>{l({heading:e.confirmGuestReturnHeading,text:h.message,status:"warning"})})))},[t,e,o,u]),{orderActionStatus:d,isDismissed:n,onDismiss:c}},be=({slots:t,orderData:e,className:n,statusTitle:r,status:u,routeCreateReturn:i,onError:d,routeOnSuccess:l})=>{const{orderStatus:c,order:o}=ne({orderData:e}),a=G(),{orderActionStatus:m,isDismissed:p,onDismiss:g}=se({enableOrderCancellation:a==null?void 0:a.orderCancellationEnabled});return A("div",{className:_(["order-order-status",n]),children:[!p&&(m==null?void 0:m.status)!==void 0?s(B,{style:{marginBottom:"1rem"},heading:m.heading,onDismiss:g,description:m.text,type:m.status}):null,o?s(oe,{title:r,status:u||c,slots:t,orderData:o,routeCreateReturn:i,onError:d,routeOnSuccess:l}):s(D,{withCard:!1})]})},ce=({orderRef:t})=>{const[e,n]=C(!1),r=()=>{n(!0)},u=()=>{n(!1)},i=G(),d=(i==null?void 0:i.orderCancellationReasons)??[],l=c=>c.map((o,a)=>({text:o==null?void 0:o.description,value:a.toString()}));return I.on("order/data",c=>{const o=String(c.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&u()}),A(S,{children:[s(P,{variant:"secondary",onClick:r,"data-testid":"cancel-button",children:s(M,{id:"Order.OrderStatusContent.actions.cancel"})}),e&&s(V,{centered:!0,size:"medium",onClose:u,className:"order-order-cancel__modal",title:s("h2",{className:"order-order-cancel__title",children:s(M,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:s(te,{orderRef:t,cancelReasons:l(d)})})]})},N={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},oe=({slots:t,title:e,status:n,orderData:r,routeCreateReturn:u,onError:i,routeOnSuccess:d})=>{var x,E,L;const l=!!(r!=null&&r.returnNumber),c=String(n).toLocaleLowerCase(),o=(x=r==null?void 0:r.returns)==null?void 0:x[0],a=(o==null?void 0:o.returnStatus)??"",m=(o==null?void 0:o.createdReturnAt)??"",p=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),g=O(`Order.OrderStatusContent.${N[c]}.title`),h=O(`Order.OrderStatusContent.${N[c]}.message`),R=O(`Order.OrderStatusContent.${N[c]}.messageWithoutDate`),f=O({title:`Order.OrderStatusContent.returnStatus.${ee(a)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return s("div",{});const q=g!=null&&g.title?g:{title:b(c)},v=h!=null&&h.message?h:p,F=R!=null&&R.messageWithoutDate?R:p,W=r!=null&&r.orderStatusChangeDate?v==null?void 0:v.message.replace("{DATE}",w(r==null?void 0:r.orderStatusChangeDate)):F.messageWithoutDate,j=((L=(E=f==null?void 0:f.returnMessage)==null?void 0:E.replace("{ORDER_CREATE_DATE}",w(r==null?void 0:r.orderDate)))==null?void 0:L.replace("{RETURN_CREATE_DATE}",w(m)))??"",z=l?e??(f.title||b(a)):e??q.title;return A(K,{className:"order-order-status-content",variant:"secondary",children:[s(Q,{title:z}),A("div",{className:"order-order-status-content__wrapper",children:[s("div",{className:_(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(t!=null&&t.OrderActions)]]),children:s("p",{children:l?j:W})}),s(re,{orderData:r,slots:t,routeCreateReturn:u,routeOnSuccess:d,onError:i})]})]})},ie=({onError:t,routeOnSuccess:e,orderData:n,children:r})=>{const[u,i]=C(!1),d=T(()=>{i(!0);const l=n==null?void 0:n.number;Z(l).then(({success:c,userInputErrors:o})=>{c&&U(e,{}),o.length&&(t==null||t(o))}).catch(c=>{t==null||t(c.message)}).finally(()=>{i(!1)})},[n,e,t]);return s(P,{type:"button",disabled:u,variant:"secondary",className:"order-reorder",onClick:d,children:r})};export{be as OrderStatus,be as default}; +import{jsx as s,Fragment as S,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as _}from"@dropins/tools/lib.js";import{Button as P,InLineAlert as B,Modal as V,Card as K,Header as Q}from"@dropins/tools/components.js";import{useState as C,useEffect as k,useCallback as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as J}from"@dropins/tools/preact-compat.js";import{u as G}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{a as X,c as Y,r as Z}from"../chunks/confirmCancelOrder.js";import{useText as O,Text as M}from"@dropins/tools/i18n.js";import{C as D}from"../chunks/OrderLoaders.js";import{f as ee}from"../chunks/returnOrdersHelper.js";import{f as w}from"../chunks/formatDateToLocale.js";import{c as b}from"../chunks/capitalizeFirst.js";import{r as U}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../fragments.js";import"../chunks/initialize.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";var y=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(y||{});const re=({className:t,orderData:e,slots:n,routeCreateReturn:r,routeOnSuccess:u,onError:i})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=J(()=>{const c=e==null?void 0:e.availableActions,o=!!(c!=null&&c.length),a=!!(e!=null&&e.returnNumber),m=()=>{U(r,{},e)};return s(S,{children:n!=null&&n.OrderActions?s($,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:e}):s("div",{"data-testid":"availableActionsList",className:_(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:c==null?void 0:c.map(p=>{switch(p){case y.CANCEL:return s(S,{children:a?null:s(ce,{orderRef:(e==null?void 0:e.token)||(e==null?void 0:e.id)})});case y.RETURN:return s(P,{variant:"secondary",onClick:m,children:a?d.createAnotherReturn:d.createReturn});case y.REORDER:return s(S,{children:a?null:s(ie,{orderData:e,onError:i,routeOnSuccess:u,children:d.reorder})})}})})})},[i,e,u,r,n,d]);return s("div",{className:_(["order-order-actions",t]),children:l})},ne=({orderData:t})=>{const[e,n]=C(t),[r,u]=C(t==null?void 0:t.status);return k(()=>{const i=I.on("order/data",d=>{n(d),u(d.status)},{eager:!0});return()=>{i==null||i.off()}},[]),{orderStatus:r,order:e}},H=t=>{const e=new URL(window.location.href);t.forEach(n=>{e.searchParams.has(n)&&e.searchParams.delete(n)}),window.history.replaceState({},document.title,e.toString())},se=({enableOrderCancellation:t})=>{const e=O({cancelOrderHeading:"Order.OrderStatusContent.actions.cancel",confirmGuestReturnHeading:"Order.OrderStatusContent.actions.confirmGuestReturn",orderCancelled:"Order.OrderStatusContent.orderCanceled.message",guestRequestReturnMessage:"Order.OrderStatusContent.actions.confirmGuestReturnMessage"}),[n,r]=C(!1),[u,i]=C(!1),[d,l]=C({heading:"",text:"",status:void 0}),c=T(()=>{r(!0),H(["order_id","confirmation_key","action"])},[]),o=T((a,m,p)=>{l({heading:a,text:m,status:p}),H(["action"])},[]);return k(()=>{const a=new URLSearchParams(window.location.search),m=a.get("order_id")??"",p=a.get("confirmation_key")??"",g=a.get("action")??"";u||!m||!p||!g||(t&&g==="cancel"&&(i(!0),X(m,p).then(()=>{l({heading:e.cancelOrderHeading,text:e.orderCancelled,status:"success"})}).catch(h=>{l({heading:e.cancelOrderHeading,text:h.message,status:"warning"})})),g==="return"&&(i(!0),Y(m,p).then(()=>{l({heading:e.confirmGuestReturnHeading,text:e.guestRequestReturnMessage,status:"success"})}).catch(h=>{l({heading:e.confirmGuestReturnHeading,text:h.message,status:"warning"})})))},[t,e,o,u]),{orderActionStatus:d,isDismissed:n,onDismiss:c}},be=({slots:t,orderData:e,className:n,statusTitle:r,status:u,routeCreateReturn:i,onError:d,routeOnSuccess:l})=>{const{orderStatus:c,order:o}=ne({orderData:e}),a=G(),{orderActionStatus:m,isDismissed:p,onDismiss:g}=se({enableOrderCancellation:a==null?void 0:a.orderCancellationEnabled});return A("div",{className:_(["order-order-status",n]),children:[!p&&(m==null?void 0:m.status)!==void 0?s(B,{style:{marginBottom:"1rem"},heading:m.heading,onDismiss:g,description:m.text,type:m.status}):null,o?s(oe,{title:r,status:u||c,slots:t,orderData:o,routeCreateReturn:i,onError:d,routeOnSuccess:l}):s(D,{withCard:!1})]})},ce=({orderRef:t})=>{const[e,n]=C(!1),r=()=>{n(!0)},u=()=>{n(!1)},i=G(),d=(i==null?void 0:i.orderCancellationReasons)??[],l=c=>c.map((o,a)=>({text:o==null?void 0:o.description,value:a.toString()}));return I.on("order/data",c=>{const o=String(c.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&u()}),A(S,{children:[s(P,{variant:"secondary",onClick:r,"data-testid":"cancel-button",children:s(M,{id:"Order.OrderStatusContent.actions.cancel"})}),e&&s(V,{centered:!0,size:"medium",onClose:u,className:"order-order-cancel__modal",title:s("h2",{className:"order-order-cancel__title",children:s(M,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:s(te,{orderRef:t,cancelReasons:l(d)})})]})},N={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},oe=({slots:t,title:e,status:n,orderData:r,routeCreateReturn:u,onError:i,routeOnSuccess:d})=>{var x,E,L;const l=!!(r!=null&&r.returnNumber),c=String(n).toLocaleLowerCase(),o=(x=r==null?void 0:r.returns)==null?void 0:x[0],a=(o==null?void 0:o.returnStatus)??"",m=(o==null?void 0:o.createdReturnAt)??"",p=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),g=O(`Order.OrderStatusContent.${N[c]}.title`),h=O(`Order.OrderStatusContent.${N[c]}.message`),R=O(`Order.OrderStatusContent.${N[c]}.messageWithoutDate`),f=O({title:`Order.OrderStatusContent.returnStatus.${ee(a)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return s("div",{});const q=g!=null&&g.title?g:{title:b(c)},v=h!=null&&h.message?h:p,F=R!=null&&R.messageWithoutDate?R:p,W=r!=null&&r.orderStatusChangeDate?v==null?void 0:v.message.replace("{DATE}",w(r==null?void 0:r.orderStatusChangeDate)):F.messageWithoutDate,j=((L=(E=f==null?void 0:f.returnMessage)==null?void 0:E.replace("{ORDER_CREATE_DATE}",w(r==null?void 0:r.orderDate)))==null?void 0:L.replace("{RETURN_CREATE_DATE}",w(m)))??"",z=l?e??(f.title||b(a)):e??q.title;return A(K,{className:"order-order-status-content",variant:"secondary",children:[s(Q,{title:z}),A("div",{className:"order-order-status-content__wrapper",children:[s("div",{className:_(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(t!=null&&t.OrderActions)]]),children:s("p",{children:l?j:W})}),s(re,{orderData:r,slots:t,routeCreateReturn:u,routeOnSuccess:d,onError:i})]})]})},ie=({onError:t,routeOnSuccess:e,orderData:n,children:r})=>{const[u,i]=C(!1),d=T(()=>{i(!0);const l=n==null?void 0:n.number;Z(l).then(({success:c,userInputErrors:o})=>{c&&U(e,{}),o.length&&(t==null||t(o))}).catch(c=>{t==null||t(c.message)}).finally(()=>{i(!1)})},[n,e,t]);return s(P,{type:"button",disabled:u,variant:"secondary",className:"order-reorder",onClick:d,children:r})};export{be as OrderStatus,be as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index f185864eb6..c865f4b1e6 100644 --- a/scripts/__dropins__/storefront-order/containers/ReturnsList.js +++ b/scripts/__dropins__/storefront-order/containers/ReturnsList.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as o,useEffect as g,useCallback as M}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as T}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as v}from"../chunks/getCustomerOrdersReturn.js";import{u as y}from"../chunks/useIsMobile.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as V}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../fragments.js";import"../chunks/initialize.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";import"../chunks/capitalizeFirst.js";const L={totalPages:1,currentPage:1,pageSize:1},k=({returnPageSize:i})=>{const[n,u]=o(!0),[s,a]=o([]),[m,l]=o(L),[t,d]=o(1);g(()=>{v(i,t).then(r=>{a((r==null?void 0:r.ordersReturn)??[]),l((r==null?void 0:r.pageInfo)??L)}).finally(()=>{u(!1)})},[i,t]),g(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[t]);const c=M(r=>{d(r)},[]);return{pageInfo:m,selectedPage:t,loading:n,orderReturns:s,handleSetSelectPage:c}},ir=({slots:i,withReturnsListButton:n,className:u,minifiedView:s,withHeader:a,withThumbnails:m,returnPageSize:l,returnsInMinifiedView:t,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O})=>{const p=T(),{pageInfo:b,selectedPage:w,handleSetSelectPage:h,loading:N,orderReturns:P}=k({returnPageSize:l}),S=y(),e=s?"minifiedView":"fullSizeView",I=V({viewAllOrdersButton:`Order.Returns.${e}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${e}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${e}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${e}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${e}.returnsList.orderNumber`,returnNumber:`Order.Returns.${e}.returnsList.returnNumber`,carrier:`Order.Returns.${e}.returnsList.carrier`});return f("div",{className:$(["order-returns-list",u]),children:f(A,{placeholderImage:(p==null?void 0:p.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:i,selectedPage:w,handleSetSelectPage:h,pageInfo:b,withReturnsListButton:n,isMobile:S,orderReturns:P,translations:I,withHeader:a,returnsInMinifiedView:t,withThumbnails:m,minifiedView:s,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O,loading:N})})};export{ir as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index e1daad6036..4c4e53e9db 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1,3 +1,3 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ import{jsx as i,jsxs as S,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as E,Slot as q}from"@dropins/tools/lib.js";import{Card as A,Header as x,Accordion as G,AccordionSection as V,ContentGrid as B,Image as M}from"@dropins/tools/components.js";import{useState as R,useEffect as tn}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as sn}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as rn}from"@dropins/tools/event-bus.js";import{C as ln}from"../chunks/OrderLoaders.js";import{u as hn}from"../chunks/useIsMobile.js";import{Text as U,useText as un}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";var H=(s=>(s.PENDING="pending",s.SHIPPING="shipping",s.COMPLETE="complete",s.PROCESSING="processing",s.HOLD="on hold",s.CANCELED="Canceled",s.SUSPECTED_FRAUD="suspected fraud",s.PAYMENT_REVIEW="payment review",s))(H||{});const dn=({orderData:s})=>{const[l,h]=R(!0),[n,c]=R(s),[r,m]=R(!1);return tn(()=>{const u=rn.on("order/data",o=>{c(o),m(o==null?void 0:o.isVirtual),h(!1)},{eager:!0});return s!=null&&s.id&&h(!1),()=>{u==null||u.off()}},[s]),{loading:l,order:n,isVirtualProduct:r}},en=({value:s,variant:l="primary",size:h="medium",icon:n,className:c,children:r,disabled:m=!1,active:u=!1,activeChildren:o,activeIcon:b,href:e,...C})=>{let d="dropin-button";(n&&!r||n&&u&&!o||!n&&u&&b)&&(d="dropin-iconButton"),u&&o&&(d="dropin-button"),c=$([d,`${d}--${h}`,`${d}--${l}`,[`${d}--${l}--disabled`,m],r&&n&&`${d}--with-icon`,!r&&o&&n&&`${d}--with-icon`,u&&b&&`${d}--with-icon`,c]);const I=$(["dropin-button-icon",`dropin-button-icon--${l}`,[`dropin-button-icon--${l}--disabled`,m],n==null?void 0:n.props.className]),g=e?{node:i("a",{}),role:"link",href:e,...C,disabled:m,active:u,onKeyDown:y=>{m&&y.preventDefault()},tabIndex:m?-1:0}:{node:i("button",{}),role:"button",...C,value:s,disabled:m,active:u};return S(E,{...g,className:c,children:[n&&!u&&i(E,{node:n,className:I}),b&&u&&i(E,{node:b,className:I}),r&&!u&&(typeof r=="string"?i("span",{children:r}):r),u&&o&&(typeof o=="string"?i("span",{children:o}):o)]})},cn=({placeholderImage:s,slots:l,collapseThreshold:h,translations:n,returnData:c,routeTracking:r,routeProductDetails:m})=>{var b;const u=hn(),o=m?"a":"span";return S(A,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(x,{title:n.returnOrderCardTitle}),S("div",{children:[(b=c==null?void 0:c.tracking)==null?void 0:b.map((e,C)=>{var y,N;const d={title:"",number:(e==null?void 0:e.trackingNumber)??"",carrier:((y=e==null?void 0:e.carrier)==null?void 0:y.label)??""},I=r==null?void 0:r(d),g=I?()=>{window.open(I,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(N=d.carrier)==null?void 0:N.toLocaleUpperCase()} | `,d.number]}),g?i(en,{onClick:g,children:n.trackButton}):null]},`${d.number}_${C}`)}),l!=null&&l.ReturnItemsDetails?i(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:l==null?void 0:l.ReturnItemsDetails,context:{items:c.items}}):null,i(G,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{defaultOpen:h>=c.items.length,title:i(U,{id:"Order.ShippingStatusCard.itemText",plural:c.items.reduce((e,C)=>e+C.requestQuantity,0),fields:{count:c.items.reduce((e,C)=>e+C.requestQuantity,0)}}),children:i(B,{maxColumns:u?3:9,emptyGridContent:i(w,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",u]]),children:c.items.map((e,C)=>{var g,y,N,_;const d=(g=e.thumbnail)==null?void 0:g.label,I=(N=(y=e.thumbnail)==null?void 0:y.url)!=null&&N.length?(_=e.thumbnail)==null?void 0:_.url:s;return i(o,{href:(m==null?void 0:m(e))??"#","data-testid":`${C}${e.uid}`,children:i(M,{alt:d,src:I,width:85,height:114})},`${C}${e.uid}`)})})})})]})]})},mn=({placeholderImage:s,translations:l,slots:h,orderData:n,collapseThreshold:c=10,routeProductDetails:r,routeTracking:m})=>{var N,_,j,F,Q,K,W;const u=!!(n!=null&&n.returnNumber),o=n==null?void 0:n.returnNumber,b=r?"a":"span",e=(N=n==null?void 0:n.status)==null?void 0:N.toLocaleLowerCase(),d=((_=n==null?void 0:n.shipments)==null?void 0:_.length)===1&&(e==null?void 0:e.includes(H.COMPLETE)),I=(j=n==null?void 0:n.shipments)==null?void 0:j.every(p=>p.tracking.length===0),g=(F=n==null?void 0:n.items)==null?void 0:F.filter(p=>(p==null?void 0:p.quantityShipped)===0||(p==null?void 0:p.quantityShipped)<(p==null?void 0:p.quantityOrdered)),y=(Q=n==null?void 0:n.items)==null?void 0:Q.reduce((p,f)=>{const T=f.quantityOrdered-f.quantityShipped;return p+(T>0?T:0)},0);if(u&&(n!=null&&n.returns.length)){const p=n.returns.find(f=>f.returnNumber===o);return!p||p.tracking.length===0?null:i(cn,{placeholderImage:s,slots:h,collapseThreshold:c,translations:l,returnData:p,routeTracking:m,routeProductDetails:r})}return!n||e!=null&&e.includes(H.CANCELED)?null:(K=n==null?void 0:n.shipments)!=null&&K.length?I&&!(g!=null&&g.length)&&d?null:S(w,{children:[(W=n==null?void 0:n.shipments)==null?void 0:W.map(({tracking:p,items:f,id:T},pn)=>{const Y=f.reduce((t,O)=>t+((O==null?void 0:O.quantityShipped)??O.orderItem.quantityShipped??0),0);return S(A,{variant:"secondary",className:"order-shipping-status-card",children:[i(x,{title:l.shippingCardTitle}),p==null?void 0:p.map(t=>{var a;const O=m==null?void 0:m(t),L=O?()=>{window.open(O,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",role:"status",children:[S("div",{className:"order-shipping-status-card__header--content",children:[S("p",{children:[l.carrier," ",(a=t==null?void 0:t.carrier)==null?void 0:a.toLocaleUpperCase()," | ",t==null?void 0:t.number]}),i("p",{children:t==null?void 0:t.title})]}),h!=null&&h.DeliveryTrackActions?i(q,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:t}}):L?i(en,{onClick:L,children:l.trackButton}):null]},t.number)}),d?null:i(G,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{"data-position":pn+1,defaultOpen:c>=(f==null?void 0:f.length),title:i(U,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:Y,fields:{count:Y}}),children:i(B,{maxColumns:6,emptyGridContent:i(w,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(t=>{var a,z,J,X,Z,v,P,k,D,nn;const O=(J=(z=(a=t==null?void 0:t.orderItem)==null?void 0:a.product)==null?void 0:z.thumbnail)==null?void 0:J.label,L=(P=(v=(Z=(X=t==null?void 0:t.orderItem)==null?void 0:X.product)==null?void 0:Z.thumbnail)==null?void 0:v.url)!=null&&P.length?(nn=(D=(k=t==null?void 0:t.orderItem)==null?void 0:k.product)==null?void 0:D.thumbnail)==null?void 0:nn.url:s;return i(b,{href:(r==null?void 0:r(t))??"#",children:i(M,{alt:O,src:L,width:85,height:114})},t.id)})})})}),h!=null&&h.DeliveryTimeLine?i(q,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},T)}),g!=null&&g.length?S(A,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(x,{title:l.notYetShippedTitle}),i(G,{actionIconPosition:"right",children:i(V,{defaultOpen:c>=(g==null?void 0:g.length),title:i(U,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:y,fields:{count:y}}),children:i(B,{maxColumns:6,emptyGridContent:i(w,{}),className:"order-shipping-status-card__images",children:g==null?void 0:g.map(p=>{var f,T;return i(b,{href:(r==null?void 0:r(p))??"#",children:i(M,{alt:(f=p.thumbnail)==null?void 0:f.label,src:((T=p.thumbnail)==null?void 0:T.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):S(A,{variant:"secondary",className:"order-shipping-status-card",children:[i(x,{title:l.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:l.noInfoTitle})]})})]})},wn=({slots:s,className:l,collapseThreshold:h,orderData:n,routeOrderDetails:c,routeTracking:r,routeProductDetails:m})=>{const{loading:u,order:o,isVirtualProduct:b}=dn({orderData:n}),e=sn(),C=un({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});if(!u&&b)return null;const d=(e==null?void 0:e.baseMediaUrl)??"";return i("div",{className:$(["order-shipping-status",l]),children:!u&&o?i(mn,{placeholderImage:d,translations:C,routeOrderDetails:c,routeTracking:r,slots:s,orderData:o,collapseThreshold:h,routeProductDetails:m}):i(ln,{withCard:!1})})};export{wn as ShippingStatus,wn as default}; diff --git a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts index d3805af02c..3495783f8f 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -19,6 +19,12 @@ export type OrderAddressModel = { }[]; } | null; export type OrderItemProductModel = { + onlyXLeftInStock?: number; + priceRange?: { + maximumPrice?: { + regularPrice?: MoneyProps; + }; + }; uid: string; __typename: string; stockStatus?: string; @@ -36,6 +42,27 @@ export type OrderItemProductModel = { }; }; export type OrderItemModel = { + taxCalculations: { + includeAndExcludeTax: { + originalPrice: MoneyProps; + baseOriginalPrice: MoneyProps; + baseDiscountedPrice: MoneyProps; + baseExcludingTax: MoneyProps; + }; + excludeTax: { + originalPrice: MoneyProps; + baseOriginalPrice: MoneyProps; + baseDiscountedPrice: MoneyProps; + baseExcludingTax: MoneyProps; + }; + includeTax: { + singleItemPrice: MoneyProps; + baseOriginalPrice: MoneyProps; + baseDiscountedPrice: MoneyProps; + }; + }; + productSalePrice: MoneyProps; + status?: string; currentReturnOrderQuantity?: number; eligibleForReturn: boolean; productSku?: string; @@ -59,6 +86,20 @@ export type OrderItemModel = { count: number; result: string; } | null; + prices: { + priceIncludingTax: MoneyProps; + originalPrice: MoneyProps; + originalPriceIncludingTax: MoneyProps; + price: MoneyProps; + discounts: [ + { + label: string; + amount: { + value: number; + }; + } + ]; + }; itemPrices: { priceIncludingTax: MoneyProps; originalPrice: MoneyProps; @@ -91,7 +132,7 @@ export type OrderItemModel = { quantityRefunded: number; quantityReturned: number; quantityShipped: number; - requestQuantity: number; + requestQuantity?: number; totalQuantity: number; returnableQuantity?: number; quantityReturnRequested: number; @@ -120,7 +161,7 @@ export type ShipmentsModel = { }; export type OrderDataModel = { placeholderImage?: string; - returnNumber: string; + returnNumber?: string; id: string; orderStatusChangeDate?: string; number: string; diff --git a/scripts/__dropins__/storefront-order/data/models/store-config.d.ts b/scripts/__dropins__/storefront-order/data/models/store-config.d.ts index 9365f2ea14..91917cd120 100644 --- a/scripts/__dropins__/storefront-order/data/models/store-config.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/store-config.d.ts @@ -13,13 +13,14 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ +type OrderDisplayPriceProps = 1 | 2 | 3; export interface StoreConfigModel { baseMediaUrl: string; orderCancellationEnabled: boolean; orderCancellationReasons: OrderCancellationReason[]; - shoppingCartDisplayPrice: 1 | 2 | 3; - shoppingOrdersDisplayShipping: 1 | 2 | 3; - shoppingOrdersDisplaySubtotal: 1 | 2 | 3; + shoppingOrderDisplayPrice: OrderDisplayPriceProps; + shoppingOrdersDisplayShipping: OrderDisplayPriceProps; + shoppingOrdersDisplaySubtotal: OrderDisplayPriceProps; shoppingOrdersDisplayFullSummary: boolean; shoppingOrdersDisplayGrandTotal: boolean; shoppingOrdersDisplayZeroTax: boolean; @@ -27,4 +28,5 @@ export interface StoreConfigModel { export interface OrderCancellationReason { description: string; } +export {}; //# sourceMappingURL=store-config.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-order-details.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-order-details.d.ts index 5421b44993..643f5ddade 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-order-details.d.ts @@ -1,5 +1,5 @@ import { QueryType, ResponseData, OrderProps, OrderItemProps } from '../../types'; -import { OrderItemModel, TransformedData } from '../models'; +import { OrderDataModel, OrderItemModel, TransformedData } from '../models'; export declare const transformConfigurableOptions: (item: OrderItemProps) => Record | undefined; export declare const transformBundleOptions: (data: any) => { @@ -12,6 +12,6 @@ export declare const transformLinks: (links: { result: string; } | null; export declare const transformOrderItems: (items: OrderItemProps[]) => OrderItemModel[]; -export declare const transformOrderData: (orderData: OrderProps, returnRef?: string) => any; +export declare const transformOrderData: (orderData: OrderProps, returnRef?: string) => OrderDataModel; export declare const transformOrderDetails: (queryType: QueryType, response: ResponseData, returnRef?: string) => TransformedData; //# sourceMappingURL=transform-order-details.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/fragments.js b/scripts/__dropins__/storefront-order/fragments.js index 5908a7657e..a4a01367ae 100644 --- a/scripts/__dropins__/storefront-order/fragments.js +++ b/scripts/__dropins__/storefront-order/fragments.js @@ -1,4 +1,4 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ const R=` fragment REQUEST_RETURN_ORDER_FRAGMENT on Return { diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderSearch.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderSearch.d.ts index e1e6f8b152..e3f7be4ca3 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderSearch.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderSearch.d.ts @@ -17,6 +17,7 @@ export declare const useOrderSearch: ({ onError, isAuth, renderSignIn, routeCust name: string; id: string; code: string; + isUnique: boolean; }[]; }; //# sourceMappingURL=useOrderSearch.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/lib/categorizeProducts.d.ts b/scripts/__dropins__/storefront-order/lib/categorizeProducts.d.ts index b6953c0bed..7a11a1baff 100644 --- a/scripts/__dropins__/storefront-order/lib/categorizeProducts.d.ts +++ b/scripts/__dropins__/storefront-order/lib/categorizeProducts.d.ts @@ -1,8 +1,29 @@ -import { OrderDataModel } from '../data/models'; +import { OrderDataModel, OrderItemModel } from '../data/models'; export declare const categorizeProducts: (order: OrderDataModel) => { returnedList: { totalQuantity: number; + taxCalculations: { + includeAndExcludeTax: { + originalPrice: import('../types/index').MoneyProps; + baseOriginalPrice: import('../types/index').MoneyProps; + baseDiscountedPrice: import('../types/index').MoneyProps; + baseExcludingTax: import('../types/index').MoneyProps; + }; + excludeTax: { + originalPrice: import('../types/index').MoneyProps; + baseOriginalPrice: import('../types/index').MoneyProps; + baseDiscountedPrice: import('../types/index').MoneyProps; + baseExcludingTax: import('../types/index').MoneyProps; + }; + includeTax: { + singleItemPrice: import('../types/index').MoneyProps; + baseOriginalPrice: import('../types/index').MoneyProps; + baseDiscountedPrice: import('../types/index').MoneyProps; + }; + }; + productSalePrice: import('../types/index').MoneyProps; + status?: string | undefined; currentReturnOrderQuantity?: number | undefined; eligibleForReturn: boolean; productSku?: string | undefined; @@ -26,6 +47,18 @@ export declare const categorizeProducts: (order: OrderDataModel) => { count: number; result: string; } | null; + prices: { + priceIncludingTax: import('../types/index').MoneyProps; + originalPrice: import('../types/index').MoneyProps; + originalPriceIncludingTax: import('../types/index').MoneyProps; + price: import('../types/index').MoneyProps; + discounts: [{ + label: string; + amount: { + value: number; + }; + }]; + }; itemPrices: { priceIncludingTax: import('../types/index').MoneyProps; originalPrice: import('../types/index').MoneyProps; @@ -56,11 +89,11 @@ export declare const categorizeProducts: (order: OrderDataModel) => { quantityRefunded: number; quantityReturned: number; quantityShipped: number; - requestQuantity: number; + requestQuantity?: number | undefined; returnableQuantity?: number | undefined; quantityReturnRequested: number; }[]; - canceledItems: (import('../data/models').OrderItemModel | null)[]; - nonCanceledItems: (import('../data/models').OrderItemModel | null)[]; + canceledItems: OrderItemModel[]; + nonCanceledItems: OrderItemModel[]; }; //# sourceMappingURL=categorizeProducts.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index 1365495e93..041423b4f1 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,5 +1,5 @@ -/*! Copyright 2024 Adobe +/*! Copyright 2025 Adobe All Rights Reserved. */ (function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} -.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-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)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-order-cancel-reasons-form__text{text-align:left;color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font);font-weight:700}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-header{text-align:center;padding:var(--spacing-xxbig)}.order-header__icon{margin-bottom:var(--spacing-small)}.order-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);justify-content:center;margin:0}.order-header__title:first-letter{text-transform:uppercase}.order-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-header .success-icon{color:var(--color-positive-500)}.order-header-create-account{display:grid;gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-header-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-header-create-account__button{display:flex;margin:0 auto;text-align:center}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "lastname" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--lastname{grid-area:lastname}.order-order-search-form__wrapper__item--number{grid-area:number}.order-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.order-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.order-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email lastname" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-return-order-message p{margin:0;padding:0}.order-return-order-message a{max-width:162px;padding:var(--spacing-xsmall)}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content a.order-returns-list-content__actions{display:inline-block;width:100%}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}`,{styleId:"order"}); +.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-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)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-order-cancel-reasons-form__text{text-align:left;color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font);font-weight:700}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-header{text-align:center;padding:var(--spacing-xxbig)}.order-header__icon{margin-bottom:var(--spacing-small)}.order-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);justify-content:center;margin:0}.order-header__title:first-letter{text-transform:uppercase}.order-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-header .success-icon{color:var(--color-positive-500)}.order-header-create-account{display:grid;gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-header-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-header-create-account__button{display:flex;margin:0 auto;text-align:center}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "lastname" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--lastname{grid-area:lastname}.order-order-search-form__wrapper__item--number{grid-area:number}.order-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.order-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.order-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email lastname" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-return-order-message p{margin:0;padding:0}.order-return-order-message a{max-width:162px;padding:var(--spacing-xsmall)}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content a.order-returns-list-content__actions{display:inline-block;width:100%}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images,.order-returns-list-content .dropin-content-grid{overflow:auto}.order-returns-list-content hr.dropin-divider.dropin-divider--secondary:last-child{display:none}.order-returns-list-content .dropin-accordion-section__content-container{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card .dropin-content-grid{overflow:auto}.order-shipping-status-card hr.dropin-divider.dropin-divider--secondary:last-child{display:none}.order-shipping-status-card .dropin-accordion-section__content-container{margin-bottom:var(--spacing-small)}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}`,{styleId:"order"}); import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as i}from"@dropins/tools/lib.js";import{useState as n,useEffect as d}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 u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",configurationsList:{quantity:"Quantity"},stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Return submitted",message:"Your return request has been successfully submitted."},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to order"}},OrderCostSummary:{headerText:"Order summary",headerReturnText:"Return summary",subtotal:{title:"Subtotal"},shipping:{title:"Shipping",freeShipping:"Free shipping"},tax:{accordionTitle:"Taxes",accordionTotalTax:"Tax Total",totalExcludingTaxes:"Total excluding taxes",title:"Tax",incl:"Including taxes",excl:"Excluding taxes"},discount:{title:"Discount",subtitle:"discounted"},total:{title:"Total"}},Returns:{minifiedView:{returnsList:{viewAllOrdersButton:"View all returns",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Recent returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}},fullSizeView:{returnsList:{viewAllOrdersButton:"View all orders",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}}},OrderProductListContent:{cancelledTitle:"Cancelled",allOrdersTitle:"Your order",returnedTitle:"Returned",refundedTitle:"Your refunded",downloadableCount:"Files",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},GiftCard:{sender:"Sender",recipient:"Recipient",message:"Note"}},OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",lastname:"Last Name",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",confirmGuestReturn:"Return request confirmed",confirmGuestReturnMessage:"Your return request has been successfully confirmed.",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPlaceholder:{title:"",message:"Your order has been in its current status since {DATE}.",messageWithoutDate:"Your order has been in its current status for some time."},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"Cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."},orderPendingPayment:{title:"Pending Payment",message:"The order was successfully placed on {DATE}, but it is awaiting payment. Please complete the payment so we can start processing your order.",messageWithoutDate:"Your order is awaiting payment. Please complete the payment so we can start processing your order."},orderRejected:{title:"Rejected",message:"Your order was rejected on {DATE}. Please contact us for more information.",messageWithoutDate:"Your order was rejected. Please contact us for more information."},orderAuthorized:{title:"Authorized",message:"Your order was successfully authorized on {DATE}. We will begin processing your order shortly.",messageWithoutDate:"Your order was successfully authorized. We will begin processing your order shortly."},orderPaypalCanceledReversal:{title:"PayPal Canceled Reversal",message:"The PayPal transaction reversal was canceled on {DATE}. Please check your order details for more information.",messageWithoutDate:"The PayPal transaction reversal was canceled. Please check your order details for more information."},orderPendingPaypal:{title:"Pending PayPal",message:"Your order is awaiting PayPal payment confirmation since {DATE}. Please check your PayPal account for the payment status.",messageWithoutDate:"Your order is awaiting PayPal payment confirmation. Please check your PayPal account for the payment status."},orderPaypalReversed:{title:"PayPal Reversed",message:"The PayPal payment was reversed on {DATE}. Please contact us for further details.",messageWithoutDate:"The PayPal payment was reversed. Please contact us for further details."},orderClosed:{title:"Closed",message:"The order placed on {DATE} has been closed. For any further assistance, please contact support.",messageWithoutDate:"Your order has been closed. For any further assistance, please contact support."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."},OrderHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},p={Order:u},m={default:p},h=({children:t})=>{const[o,a]=n("en_US");return d(()=>{const e=c.on("locale",s=>{a(s)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new i(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts index a4d5c227a8..e921da8cae 100644 --- a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts @@ -36,6 +36,8 @@ interface ThumbnailImageProps { label?: string; } export interface ProductProps { + only_x_left_in_stock?: number; + stock_status?: string; thumbnail?: ThumbnailImageProps; image: ThumbnailImageProps; canonical_url: string; @@ -191,7 +193,9 @@ export interface ShipmentsProps { id: string; product_sku: string; product_name: string; - }; + quantity_shipped: number; + order_item: OrderItemProps; + }[]; } export declare enum AvailableActionsProps { CANCEL = "CANCEL", @@ -228,6 +232,8 @@ export interface ReturnsItemsProps { }[]; } export interface OrderProps { + is_virtual?: boolean; + order_status_change_date?: string; available_actions: AvailableActionsProps[]; shipping_method: string; status: string; diff --git a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts index 17aafb587b..7ffa0735c0 100644 --- a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts @@ -21,7 +21,7 @@ export interface CreateReturnProps { }>; }; className: string; - onSuccess?: (response: onSuccessTypes) => void; + onSuccess?: (response: onSuccessTypes | {}) => void; onError?: (message: string) => void; routeReturnSuccess?: () => string; showConfigurableOptions?: (options: options | {}) => options; @@ -63,7 +63,7 @@ export interface ReturnOrderMessageProps { } export interface UseCreateReturn { orderData?: OrderDataModel; - onSuccess?: (response: onSuccessTypes) => void; + onSuccess?: (response: onSuccessTypes | {}) => void; onError?: (message: string) => void; handleSetInLineAlert: (value?: InLineAlertProps) => void; } diff --git a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts index 1578f9a786..24adb6b759 100644 --- a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts @@ -5,8 +5,8 @@ type TaxTypes = { taxIncluded: boolean; taxExcluded: boolean; }; -export interface StoreConfigProps extends Omit { - shoppingCartDisplayPrice: TaxTypes; +export interface StoreConfigProps extends Omit { + shoppingOrderDisplayPrice: TaxTypes; shoppingOrdersDisplayShipping: TaxTypes; shoppingOrdersDisplaySubtotal: TaxTypes; }