diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index cd6ad0920..d69b114c9 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as i,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as X,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as D,Icon as V,Card as O,ContentGrid as r1,Image as e1,Header as P,Pagination as t1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as a1}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const J=c=>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",...c},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"})))),c1=c=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},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"})),T=({typeList:c,isEmpty:p,minifiedView:N,message:t})=>{const a=n1(()=>{switch(c){case"orders":return{icon:c1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[c,t]);return!p||!c||!a.text?null:r(D,{className:X(["order-empty-list",a.className,N?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},W={size:"32",stroke:"2"},_1=({minifiedViewKey:c,withReturnNumber:p=!1,withOrderNumber:N=!1,slots:t,pageInfo:a,withReturnsListButton:A=!0,isMobile:E=!1,returnsInMinifiedView:Y=1,translations:L={},orderReturns:s=[],minifiedView:h=!1,withHeader:g=!0,withThumbnails:B=!0,selectedPage:S=1,handleSetSelectPage:k,routeReturnDetails:d,routeOrderDetails:f,routeTracking:v,routeReturnsList:b,routeProductDetails:m,loading:x})=>{const z=h?Y:s.length,j=m!=null&&m()?"a":"span",y=w(()=>s.slice(0,z).map((e,R)=>{var F,G;const $=((e==null?void 0:e.items)??[]).reduce((n,C)=>(C.requestQuantity??0)+n,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:i("div",{className:"order-returns-list-content__cards-grid",children:[i("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${c}.returnsList.returnStatus.${a1(e.returnStatus)}`})}),p?i("p",{children:[L.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,N?i("p",{children:[L.orderNumber," ",r("a",{href:(f==null?void 0:f({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,C)=>{var Z,u;const M={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((Z=n==null?void 0:n.carrier)==null?void 0:Z.label)??""},H=v==null?void 0:v(M),o=`${M.number}_${C}`;return i("p",{children:[`${L.carrier} `,`${(u=M.carrier)==null?void 0:u.toLocaleUpperCase()} | `,H?r("a",{href:H,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?i("p",{children:[$," ",r(U,{id:`Order.Returns.${c}.returnsList.itemText`,plural:$,fields:{count:$}})]}):null]}),B?r(r1,{maxColumns:E?3:9,emptyGridContent:r(_,{}),className:X(["order-returns-list-content__images",["order-returns-list-content__images-3",E]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,C)=>{var Z,u;const M=(Z=n.thumbnail)==null?void 0:Z.label,H=(u=n.thumbnail)==null?void 0:u.url,o=`key_${C}_${n.uid}`;return r(j,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(e1,{alt:M,src:H,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(V,{source:J,...W})})]})},R)}),[s,z,c,p,L,d,N,f,t,B,E,m,v,j]),I=w(()=>i(_,{children:[g?r(P,{title:L.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,x?r(Q,{withCard:!1}):i(_,{children:[y,r(T,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:L.emptyOrdersListMessage}),A?r("a",{className:"order-returns-list-content__actions",href:(b==null?void 0:b())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:i("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:L.viewAllOrdersButton}),r(V,{source:J,...W})]})})}):null]})]}),[b,A,g,L,y,h,s.length,x]),K=w(()=>i(_,{children:[g?r(P,{title:L.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,x?r(Q,{withCard:!1}):i(_,{children:[r(T,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:L.emptyOrdersListMessage}),y,(a==null?void 0:a.totalPages)>1?r(t1,{totalPages:a==null?void 0:a.totalPages,currentPage:S,onChange:k}):null]})]}),[y,h,s,L,a==null?void 0:a.totalPages,S,k,x,g]);return r("div",{className:"order-returns-list-content",children:h?I:K})};export{_1 as R}; +import{jsx as r,jsxs as L,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as V}from"@dropins/tools/preact-hooks.js";import{classes as Y,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as r1,Icon as A,Card as P,ContentGrid as e1,Image as t1,Header as Q,Pagination as n1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as a1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as L1}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as U}from"./OrderLoaders.js";import{Text as J}from"@dropins/tools/i18n.js";const T=c=>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",...c},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"})))),c1=c=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},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"})),W=({typeList:c,isEmpty:C,minifiedView:g,message:M})=>{const t=a1(()=>{switch(c){case"orders":return{icon:c1,text:r("p",{children:M}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[c,M]);return!C||!c||!t.text?null:r(r1,{className:Y(["order-empty-list",t.className,g?"order-empty-list--minified":""]),message:t.text,icon:r(A,{source:t.icon}),"data-testid":"emptyList"})},X={size:"32",stroke:"2"},p1=({placeholderImage:c,minifiedViewKey:C,withReturnNumber:g=!1,withOrderNumber:M=!1,slots:t,pageInfo:i,withReturnsListButton:B=!0,isMobile:$=!1,returnsInMinifiedView:K=1,translations:a={},orderReturns:s=[],minifiedView:h=!1,withHeader:f=!0,withThumbnails:S=!0,selectedPage:k=1,handleSetSelectPage:z,routeReturnDetails:d,routeOrderDetails:v,routeTracking:b,routeReturnsList:x,routeProductDetails:m,loading:y})=>{const j=h?K:s.length,F=m!=null&&m()?"a":"span",H=V(()=>s.slice(0,j).map((e,D)=>{var G,q;const w=((e==null?void 0:e.items)??[]).reduce((n,Z)=>(Z.requestQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:L("div",{className:"order-returns-list-content__cards-grid",children:[L("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(J,{id:`Order.Returns.${C}.returnsList.returnStatus.${L1(e.returnStatus)}`})}),g?L("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?L("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,Z)=>{var _,p;const u={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(u),o=`${u.number}_${Z}`;return L("p",{children:[`${a.carrier} `,`${(p=u.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(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):null,!(t!=null&&t.ReturnItemsDetails)&&e.items.length?L("p",{children:[w," ",r(J,{id:`Order.Returns.${C}.returnsList.itemText`,plural:w,fields:{count:w}})]}):null]}),S?r(e1,{maxColumns:$?3:9,emptyGridContent:r(N,{}),className:Y(["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,Z)=>{var _,p;const u=(_=n.thumbnail)==null?void 0:_.label,E=((p=n.thumbnail)==null?void 0:p.url)??c,o=`key_${Z}_${n.uid}`;return r(F,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(t1,{alt:u,src:E,width:85,height:114})},o)})}):null,t!=null&&t.DetailsActionParams?r(O,{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(A,{source:T,...X})})]})},D)}),[s,j,C,g,a,M,t,S,$,c,F,b,m,d,v]),I=V(()=>L(N,{children:[f?r(Q,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,y?r(U,{withCard:!1}):L(N,{children:[H,r(W,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),B?r("a",{className:"order-returns-list-content__actions",href:(x==null?void 0:x())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:L("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(A,{source:T,...X})]})})}):null]})]}),[x,B,f,a,H,h,s.length,y]),R=V(()=>L(N,{children:[f?r(Q,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,y?r(U,{withCard:!1}):L(N,{children:[r(W,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),H,(i==null?void 0:i.totalPages)>1?r(n1,{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?I:R})};export{p1 as R}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index fc0734fce..6a7384c54 100644 --- a/scripts/__dropins__/storefront-order/containers/ReturnsList.js +++ b/scripts/__dropins__/storefront-order/containers/ReturnsList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 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 s,useEffect as h,useCallback as I}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as y}from"../chunks/getCustomerOrdersReturn.js";import{u as A}from"../chunks/useIsMobile.js";import{R as M}from"../chunks/ReturnsListContent.js";import{useText as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const g={totalPages:1,currentPage:1,pageSize:1},V=({returnPageSize:t})=>{const[n,o]=s(!0),[i,u]=s([]),[a,m]=s(g),[d,l]=s(1);h(()=>{y(t).then(r=>{u((r==null?void 0:r.ordersReturn)??[]),m((r==null?void 0:r.pageInfo)??g)}).finally(()=>{o(!1)})},[t]);const c=I(r=>{l(r)},[]);return{pageInfo:a,selectedPage:d,loading:n,orderReturns:i,handleSetSelectPage:c}},Y=({slots:t,withReturnsListButton:n,className:o,minifiedView:i,withHeader:u,withThumbnails:a,returnPageSize:m,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:p,routeProductDetails:L})=>{const{pageInfo:R,selectedPage:O,handleSetSelectPage:b,loading:w,orderReturns:N}=V({returnPageSize:m}),P=A(),e=i?"minifiedView":"fullSizeView",S=T({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",o]),children:f(M,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:O,handleSetSelectPage:b,pageInfo:R,withReturnsListButton:n,isMobile:P,orderReturns:N,translations:S,withHeader:u,returnsInMinifiedView:d,withThumbnails:a,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:p,routeProductDetails:L,loading:w})})};export{Y as default}; +import{jsx as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as S}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as s,useEffect as $,useCallback as y}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as M}from"../chunks/getCustomerOrdersReturn.js";import{g as A}from"../chunks/getStoreConfig.js";import{u as C}from"../chunks/useIsMobile.js";import{R as T}from"../chunks/ReturnsListContent.js";import{useText as V}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const R={totalPages:1,currentPage:1,pageSize:1},k=({returnPageSize:i})=>{const[n,a]=s(!0),[o,u]=s([]),[m,l]=s(""),[d,c]=s(R),[g,f]=s(1);$(()=>{M(i).then(async e=>{const t=await A();l((t==null?void 0:t.baseMediaUrl)??""),u((e==null?void 0:e.ordersReturn)??[]),c((e==null?void 0:e.pageInfo)??R)}).finally(()=>{a(!1)})},[i]);const p=y(e=>{f(e)},[]);return{placeholderImage:m,pageInfo:d,selectedPage:g,loading:n,orderReturns:o,handleSetSelectPage:p}},re=({slots:i,withReturnsListButton:n,className:a,minifiedView:o,withHeader:u,withThumbnails:m,returnPageSize:l,returnsInMinifiedView:d,routeReturnDetails:c,routeOrderDetails:g,routeTracking:f,routeReturnsList:p,routeProductDetails:e})=>{const{pageInfo:t,selectedPage:O,handleSetSelectPage:b,loading:h,orderReturns:w,placeholderImage:I}=k({returnPageSize:l}),P=C(),r=o?"minifiedView":"fullSizeView",N=V({viewAllOrdersButton:`Order.Returns.${r}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return L("div",{className:S(["order-returns-list",a]),children:L(T,{placeholderImage:I,minifiedViewKey:r,withOrderNumber:!0,withReturnNumber:!0,slots:i,selectedPage:O,handleSetSelectPage:b,pageInfo:t,withReturnsListButton:n,isMobile:P,orderReturns:w,translations:N,withHeader:u,returnsInMinifiedView:d,withThumbnails:m,minifiedView:o,routeReturnDetails:c,routeOrderDetails:g,routeTracking:f,routeReturnsList:p,routeProductDetails:e,loading:h})})};export{re as default}; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts index 1b11a83db..00c60e2d1 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts @@ -2,6 +2,7 @@ import { OrdersReturnPropsModel } from '../../data/models'; import { UseReturnsListProps } from '../../types'; export declare const useReturnsList: ({ returnPageSize }: UseReturnsListProps) => { + placeholderImage: string; pageInfo: { totalPages: number; currentPage: number; @@ -9,7 +10,7 @@ export declare const useReturnsList: ({ returnPageSize }: UseReturnsListProps) = }; selectedPage: number; loading: boolean; - orderReturns: [] | OrdersReturnPropsModel[]; + orderReturns: OrdersReturnPropsModel[] | []; handleSetSelectPage: (value: number) => void; }; //# sourceMappingURL=useReturnsList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 67b531b5f..50b1663d5 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1733230876414} \ No newline at end of file +{"at":1733233322491} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts index 17cf40f21..3c7d12e50 100644 --- a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts @@ -40,6 +40,7 @@ export interface ReturnsListProps { withThumbnails?: boolean; } export interface ReturnsListContentProps extends Omit { + placeholderImage: string; minifiedViewKey: 'minifiedView' | 'fullSizeView'; orderReturns?: OrdersReturnPropsModel[] | []; translations: Record;