From 0933fec2ec00b7bd4f5ac35ad3abc0550e45e1d4 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 3 Dec 2024 20:10:43 +0200 Subject: [PATCH] updated order --- .../chunks/useGetStoreConfig.js | 3 ++ .../storefront-order/configs/mock.config.d.ts | 13 +++++ .../containers/CreateReturn.js | 2 +- .../containers/OrderCostSummary.js | 2 +- .../containers/OrderProductList.js | 2 +- .../containers/OrderStatus.js | 4 +- .../containers/ReturnsList.js | 2 +- .../context/ConfigStoreContext.d.ts | 9 ++++ .../hooks/containers/useCreateReturn.d.ts | 5 +- .../hooks/containers/useOrderCostSummary.d.ts | 2 +- .../hooks/containers/useOrderProductList.d.ts | 52 ++----------------- .../hooks/containers/useReturnsList.d.ts | 1 - .../storefront-order/hooks/index.d.ts | 1 + scripts/__dropins__/storefront-order/reload | 2 +- .../types/orderCostSummary.types.d.ts | 1 + .../types/orderProductList.types.d.ts | 1 + .../types/returnsList.types.d.ts | 2 +- 17 files changed, 42 insertions(+), 62 deletions(-) create mode 100644 scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js create mode 100644 scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts diff --git a/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js new file mode 100644 index 0000000000..4398ad0c43 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 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}; diff --git a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts index 6c20a39e46..ba35296ddc 100644 --- a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts +++ b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts @@ -3712,4 +3712,17 @@ export declare const customerReturnDetailsFullMock: { })[]; }; }; +export declare const storeConfigMock: { + baseMediaUrl: string; + orderCancellationEnabled: boolean; + orderCancellationReasons: { + description: string; + }[]; + shoppingCartDisplayPrice: number; + shoppingOrdersDisplaySubtotal: number; + shoppingOrdersDisplayShipping: number; + shoppingOrdersDisplayGrandTotal: boolean; + shoppingOrdersDisplayFullSummary: boolean; + shoppingOrdersDisplayZeroTax: boolean; +}; //# 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 19d53c1853..7081ff9cd0 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as B}from"@dropins/tools/lib.js";import{Icon as H,Header as $,InLineAlert as W,Button as T,Checkbox as j,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as _,useRef as D,useEffect as P,useCallback as M}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as S from"@dropins/tools/preact-compat.js";import{s as G}from"../chunks/setTaxStatus.js";import{createRef as J,Fragment as K}from"@dropins/tools/preact.js";import{s as X,p as Y,r as I,m as ee}from"../chunks/returnOrdersHelper.js";import{events as te}from"@dropins/tools/event-bus.js";import{g as ne,r as re}from"../chunks/requestReturn.js";import{g as ae}from"../chunks/getStoreConfig.js";import{S as se,C as ce}from"../chunks/CartSummaryItem.js";import{a as ie}from"../chunks/OrderLoaders.js";import{useText as ue}from"@dropins/tools/i18n.js";import"../chunks/getFormValues.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const oe=s=>S.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},S.createElement("g",{clipPath:"url(#clip0_841_1324)"},S.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),S.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"})),S.createElement("defs",null,S.createElement("clipPath",{id:"clip0_841_1324"},S.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),le=s=>S.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},S.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"}),S.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=({onSuccess:s,onError:a,handleSetInLineAlert:c,orderData:l})=>{const[m,O]=_({id:"",email:"",...l}),[d,f]=_("products"),[v,k]=_(!0),[i,h]=_([]),[x,C]=_([]),[R,t]=_({taxIncluded:!1,taxExcluded:!1}),[g,e]=_([]),[u,b]=_(""),y=D([]);y.current.length!==i.length&&(y.current=i.map((n,o)=>y.current[o]||J())),P(()=>{const n=te.on("order/data",o=>{O(o);const L=X(o);e(L),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),P(()=>{ae().then(n=>{if(!n)return;const o=G(n==null?void 0:n.shoppingCartDisplayPrice);t(o),b(n.baseMediaUrl)})},[]),P(()=>{ne("RMA_ITEM").then(n=>{n!=null&&n.length&&(C(n),k(!1))})},[]);const F=M(n=>{h(o=>o.findIndex(p=>(p==null?void 0:p.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(p=>(p==null?void 0:p.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),w=M(n=>{f(n),c(),n==="products"&&h([])},[c]),A=M((n,o)=>{const L=i.map(p=>p.productSku===o?{...p,currentReturnOrderQuantity:n}:p);h(L)},[i]),Q=M(async(n,o)=>{if(!o)return;k(!0);const L={orderUid:m.id,contactEmail:m.email},p=Y(y);re({...L,items:p}).then(E=>{s==null||s(E),w("success"),c()}).catch(E=>{a==null||a(E.message),c({type:"error",heading:E.message})}),k(!1)},[w,a,s,c,m]);return{order:{...m,placeholderImage:u},steps:d,loading:v,formsRef:y,taxConfig:R,attributesList:x,selectedProductList:i,itemsEligibleForReturn:g,handleSelectedProductList:F,handleSetQuantity:A,handleChangeStep:w,onSubmit:Q}},pe={success:le,warning:oe,error:se},he=()=>{const[s,a]=_({type:"success",heading:""}),c=M(l=>{if(!(l!=null&&l.type)){a({type:"success",heading:""});return}const m=r(H,{source:pe[l.type]});a({...l,icon:m})},[]);return{inLineAlertProps:s,handleSetInLineAlert:c}},qe=({className:s,orderData:a,slots:c,onSuccess:l,onError:m,routeReturnSuccess:O,showConfigurableOptions:d})=>{const f=ue({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:k}=he(),{order:i,itemsEligibleForReturn:h,formsRef:x,taxConfig:C,attributesList:R,steps:t,loading:g,selectedProductList:e,handleSelectedProductList:u,handleSetQuantity:b,handleChangeStep:y,onSubmit:F}=de({orderData:a,onSuccess:l,onError:m,handleSetInLineAlert:k});if(g)return r("div",{children:r(ie,{})});if(!g&&!R.length)return r("div",{});const w={products:r(ge,{itemsEligibleForReturn:h,placeholderImage:i==null?void 0:i.placeholderImage,slots:c,translations:f,loading:g,taxConfig:C,selectedProductList:e,handleSelectedProductList:u,showConfigurableOptions:d,handleSetQuantity:b,handleChangeStep:y}),attributes:r(fe,{placeholderImage:i==null?void 0:i.placeholderImage,slots:c,formsRef:x,loading:g,fieldsConfig:R,selectedProductList:e,handleChangeStep:y,translations:f,onSubmit:F}),success:r(me,{translations:f,routeReturnSuccess:O,orderData:i}),error:null};return N("div",{className:q(["order-create-return",s]),children:[r($,{title:f.headerText}),v.heading?r(W,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...v}):null,w[t]]})},me=({routeReturnSuccess:s,translations:a,orderData:c})=>N("div",{className:"order-return-order-message",children:[r("p",{className:"order-return-order-message__title",children:a.successTitle}),r("p",{className:"order-return-order-message__subtitle",children:a.successMessage}),r(T,{href:(s==null?void 0:s(c))??"#",children:a.backStore})]}),ge=({placeholderImage:s,itemsEligibleForReturn:a,slots:c,loading:l,taxConfig:m,translations:O,selectedProductList:d,handleSelectedProductList:f,showConfigurableOptions:v,handleSetQuantity:k,handleChangeStep:i})=>N("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((h,x)=>{const{quantityReturnRequested:C,quantityShipped:R,eligibleForReturn:t}=h,g=d.some(b=>(b==null?void 0:b.productSku)===h.productSku&&h.eligibleForReturn),e=R===C&&t,u=R-C===0?C:R-C;return N("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(j,{"data-testid":`key_${x}`,name:`key_${x}`,checked:g,disabled:e,onChange:()=>{f({...h,currentReturnOrderQuantity:1})}}),r(ce,{placeholderImage:s,loading:l,product:{...h,totalQuantity:u},itemType:"",taxConfig:m,translations:O,showConfigurableOptions:v,disabledIncrementer:!g,onQuantity:u>1?b=>{k(b,h.productSku)}:void 0}),r(B,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:c==null?void 0:c.ReturnOrderItem})]},h.id)}),r("li",{className:"order-return-order-product-list__item",children:r(T,{type:"button",onClick:()=>i("attributes"),disabled:!d.length,children:O.nextStep})})]}),fe=({placeholderImage:s,slots:a,formsRef:c,selectedProductList:l,loading:m,fieldsConfig:O,translations:d,handleChangeStep:f,onSubmit:v})=>{const{formData:k,errors:i,formRef:h,handleChange:x,handleBlur:C,handleSubmit:R}=U({fieldsConfig:I(O,l==null?void 0:l.length),onSubmit:v});return N("form",{className:"order-return-reason-form",ref:h,onSubmit:R,name:"returnReasonForm",children:[l.map((t,g)=>{var Q,n,o,L,p,E;const e=t==null?void 0:t.giftCard,u=t==null?void 0:t.product,b=ee(O,g),y=`${t==null?void 0:t.id}_${g}`,F=(t==null?void 0:t.currentReturnOrderQuantity)??1,w={...t!=null&&t.currentReturnOrderQuantity?{[d.configurationsListQuantity]:F}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[d.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[d.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[d.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[d.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[d.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(Q=t==null?void 0:t.downloadableLinks)==null?void 0:Q.count} ${d.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}},A=(L=(o=u==null?void 0:u.thumbnail)==null?void 0:o.url)!=null&&L.length?u.thumbnail.url:s;return N(K,{children:[r(V,{loading:m,title:r("div",{"data-testid":"product-name",children:(p=t==null?void 0:t.product)==null?void 0:p.name}),sku:r("div",{children:u==null?void 0:u.sku}),image:r(Z,{src:A,alt:((E=u==null?void 0:u.thumbnail)==null?void 0:E.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:w}),r("form",{name:y,ref:c==null?void 0:c.current[g],"data-quantity":F,children:r(z,{className:"className",loading:m,fields:b,onChange:x,onBlur:C,errors:i,values:k})})]},t.id)}),r(B,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:f},children:N("div",{className:"order-return-reason-form__actions",children:[r(T,{variant:"secondary",type:"button",onClick:()=>{f("products")},children:d.backStep}),r(T,{children:d.submit})]})})]})};export{qe as CreateReturn,qe as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B,Slot as P}from"@dropins/tools/lib.js";import{Icon as H,Header as $,InLineAlert as W,Button as F,Checkbox as j,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as w,useRef as D,useEffect as q,useCallback as E}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as C from"@dropins/tools/preact-compat.js";import{u as G}from"../chunks/useGetStoreConfig.js";import{createRef as J,Fragment as K}from"@dropins/tools/preact.js";import{s as X,p as Y,r as I,m as ee}from"../chunks/returnOrdersHelper.js";import{events as te}from"@dropins/tools/event-bus.js";import{g as ne,r as re}from"../chunks/requestReturn.js";import{s as se}from"../chunks/setTaxStatus.js";import{S as ae,C as ce}from"../chunks/CartSummaryItem.js";import{a as ie}from"../chunks/OrderLoaders.js";import{useText as ue}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"../chunks/convertCase.js";const oe=a=>C.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},C.createElement("g",{clipPath:"url(#clip0_841_1324)"},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),C.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"})),C.createElement("defs",null,C.createElement("clipPath",{id:"clip0_841_1324"},C.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),le=a=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},C.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"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:l})=>{const[g,O]=w({id:"",email:"",...l}),[d,f]=w("products"),[L,k]=w(!0),[p,m]=w([]),[_,R]=w([]),[y,t]=w([]),u=D([]);u.current.length!==p.length&&(u.current=p.map((n,o)=>u.current[o]||J())),q(()=>{const n=te.on("order/data",o=>{O(o);const S=X(o);t(S),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),q(()=>{ne("RMA_ITEM").then(n=>{n!=null&&n.length&&(R(n),k(!1))})},[]);const e=E(n=>{m(o=>o.findIndex(h=>(h==null?void 0:h.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(h=>(h==null?void 0:h.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),i=E(n=>{f(n),c(),n==="products"&&m([])},[c]),b=E((n,o)=>{const S=p.map(h=>h.productSku===o?{...h,currentReturnOrderQuantity:n}:h);m(S)},[p]),N=E(async(n,o)=>{if(!o)return;k(!0);const S={orderUid:g.id,contactEmail:g.email},h=Y(u);re({...S,items:h}).then(v=>{a==null||a(v),i("success"),c()}).catch(v=>{s==null||s(v.message),c({type:"error",heading:v.message})}),k(!1)},[i,s,a,c,g]);return{order:g,steps:d,loading:L,formsRef:u,attributesList:_,selectedProductList:p,itemsEligibleForReturn:y,handleSelectedProductList:e,handleSetQuantity:b,handleChangeStep:i,onSubmit:N}},pe={success:le,warning:oe,error:ae},he=()=>{const[a,s]=w({type:"success",heading:""}),c=E(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const g=r(H,{source:pe[l.type]});s({...l,icon:g})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},Pe=({className:a,orderData:s,slots:c,onSuccess:l,onError:g,routeReturnSuccess:O,showConfigurableOptions:d})=>{const f=ue({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:L,handleSetInLineAlert:k}=he(),p=G(),{order:m,itemsEligibleForReturn:_,formsRef:R,attributesList:y,steps:t,loading:u,selectedProductList:e,handleSelectedProductList:i,handleSetQuantity:b,handleChangeStep:N,onSubmit:n}=de({orderData:s,onSuccess:l,onError:g,handleSetInLineAlert:k});if(u)return r("div",{children:r(ie,{})});if(!u&&!y.length)return r("div",{});const o=(p==null?void 0:p.baseMediaUrl)??"",S={products:r(ge,{itemsEligibleForReturn:_,placeholderImage:o,taxConfig:se((p==null?void 0:p.shoppingCartDisplayPrice)??0),slots:c,translations:f,loading:u,selectedProductList:e,handleSelectedProductList:i,showConfigurableOptions:d,handleSetQuantity:b,handleChangeStep:N}),attributes:r(fe,{placeholderImage:o,slots:c,formsRef:R,loading:u,fieldsConfig:y,selectedProductList:e,handleChangeStep:N,translations:f,onSubmit:n}),success:r(me,{translations:f,routeReturnSuccess:O,orderData:m}),error:null};return x("div",{className:B(["order-create-return",a]),children:[r($,{title:f.headerText}),L.heading?r(W,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...L}):null,S[t]]})},me=({routeReturnSuccess:a,translations:s,orderData:c})=>x("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(F,{href:(a==null?void 0:a(c))??"#",children:s.backStore})]}),ge=({placeholderImage:a,itemsEligibleForReturn:s,slots:c,loading:l,taxConfig:g,translations:O,selectedProductList:d,handleSelectedProductList:f,showConfigurableOptions:L,handleSetQuantity:k,handleChangeStep:p})=>x("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((m,_)=>{const{quantityReturnRequested:R,quantityShipped:y,eligibleForReturn:t}=m,u=d.some(b=>(b==null?void 0:b.productSku)===m.productSku&&m.eligibleForReturn),e=y===R&&t,i=y-R===0?R:y-R;return x("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(j,{"data-testid":`key_${_}`,name:`key_${_}`,checked:u,disabled:e,onChange:()=>{f({...m,currentReturnOrderQuantity:1})}}),r(ce,{placeholderImage:a,loading:l,product:{...m,totalQuantity:i},itemType:"",taxConfig:g,translations:O,showConfigurableOptions:L,disabledIncrementer:!u,onQuantity:i>1?b=>{k(b,m.productSku)}:void 0}),r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:c==null?void 0:c.ReturnOrderItem})]},m.id)}),r("li",{className:"order-return-order-product-list__item",children:r(F,{type:"button",onClick:()=>p("attributes"),disabled:!d.length,children:O.nextStep})})]}),fe=({placeholderImage:a,slots:s,formsRef:c,selectedProductList:l,loading:g,fieldsConfig:O,translations:d,handleChangeStep:f,onSubmit:L})=>{const{formData:k,errors:p,formRef:m,handleChange:_,handleBlur:R,handleSubmit:y}=U({fieldsConfig:I(O,l==null?void 0:l.length),onSubmit:L});return x("form",{className:"order-return-reason-form",ref:m,onSubmit:y,name:"returnReasonForm",children:[l.map((t,u)=>{var h,v,M,Q,A,T;const e=t==null?void 0:t.giftCard,i=t==null?void 0:t.product,b=ee(O,u),N=`${t==null?void 0:t.id}_${u}`,n=(t==null?void 0:t.currentReturnOrderQuantity)??1,o={...t!=null&&t.currentReturnOrderQuantity?{[d.configurationsListQuantity]:n}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[d.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[d.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[d.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[d.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[d.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(h=t==null?void 0:t.downloadableLinks)==null?void 0:h.count} ${d.downloadableCount}`]:(v=t==null?void 0:t.downloadableLinks)==null?void 0:v.result}:{}},S=(Q=(M=i==null?void 0:i.thumbnail)==null?void 0:M.url)!=null&&Q.length?i.thumbnail.url:a;return x(K,{children:[r(V,{loading:g,title:r("div",{"data-testid":"product-name",children:(A=t==null?void 0:t.product)==null?void 0:A.name}),sku:r("div",{children:i==null?void 0:i.sku}),image:r(Z,{src:S,alt:((T=i==null?void 0:i.thumbnail)==null?void 0:T.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:o}),r("form",{name:N,ref:c==null?void 0:c.current[u],"data-quantity":n,children:r(z,{className:"className",loading:g,fields:b,onChange:_,onBlur:R,errors:p,values:k})})]},t.id)}),r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:f},children:x("div",{className:"order-return-reason-form__actions",children:[r(F,{variant:"secondary",type:"button",onClick:()=>{f("products")},children:d.backStep}),r(F,{children:d.submit})]})})]})};export{Pe as CreateReturn,Pe as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index c0d3500481..b949cc7d36 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as c,jsxs as i,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as g,useEffect as T}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import{Price as d,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import*as x from"@dropins/tools/preact-compat.js";import{O as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=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:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=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:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$=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",{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"})),j=({orderData:e})=>{const[a,t]=g(!0),[n,l]=g(e),[r,m]=g(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:o,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=u;m(p=>({...p,...h,shoppingCartDisplayPrice:C(o),shoppingOrdersDisplayShipping:C(s),shoppingOrdersDisplaySubtotal:C(y)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",o=>{l(o)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:a,storeConfig:r,order:n}},rt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:r,storeConfig:m,order:u}=j({orderData:a}),o=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",{...l,className:H(["order-cost-summary",n]),children:c(G,{order:u,withHeader:e,loading:r,storeConfig:m,translations:o})})},P=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?i(S,{children:[c(d,{currency:(r=a==null?void 0:a.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},W=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,r,m,u;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:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:e.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?i(S,{children:[c(d,{weight:"normal",currency:(m=t==null?void 0:t.totalShipping)==null?void 0:m.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),i("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},q=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,m,u,o;const l=(r=a==null?void 0:a.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((m=a==null?void 0:a.discounts)!=null&&m.length)&&(l||!t||t<1)||(u=a==null?void 0:a.discounts)!=null&&u.length&&l?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:e.discount}),c("span",{children:(o=a==null?void 0:a.discounts)==null?void 0:o.map(({amount:s},y)=>{const p=((s==null?void 0:s.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-p},`${s==null?void 0:s.value}${y}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(f,{source:$,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:e})=>{var a;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(a=e==null?void 0:e.coupons)==null?void 0:a.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},`${t==null?void 0:t.code}${n}`))})},U=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var m,u,o;const[l,r]=g(!1);return a?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(E,{onStateChange:r,title:e.accordionTitle,secondaryText:c(S,{children:l?null:c(d,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((s,y)=>{var h,p,_;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(d,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},`${(_=s==null?void 0:s.amount)==null?void 0:_.value}${y}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.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:e.tax}),c(d,{currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},R=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,r,m;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:e.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((m=t==null?void 0:t.grandTotal)==null?void 0:m.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},G=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var h,p,_,O,w,L;if(a||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,m=((p=n.totalGiftcard)==null?void 0:p.currency)??"",u=((_=n.subtotal)==null?void 0:_.value)??0,o=((O=n.totalShipping)==null?void 0:O.value)??0,s=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=s?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,v)=>{var M;return+((M=v==null?void 0:v.amount)==null?void 0:M.value)+Z},0):0;return i(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:e,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:e,order:n,totalShipping:o,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:e,order:n,totalGiftcardValue:r,totalGiftcardCurrency:m}),c(F,{order:n}),c(U,{order:n,translations:e,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(R,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{rt as OrderCostSummary,rt as default}; +import{jsx as c,jsxs as i,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as v,useEffect as T}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{Price as d,Icon as N,Accordion as b,AccordionSection as f,Card as E,Header as D}from"@dropins/tools/components.js";import{u as k}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as x from"@dropins/tools/preact-compat.js";import{O as z}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 I=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},x.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},x.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},x.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"})),j=({orderData:a,config:e})=>{const[t,n]=v(!0),[l,r]=v(a),[u,o]=v(null);return T(()=>{if(e){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=e;o(p=>({...p,...h,shoppingCartDisplayPrice:C(m),shoppingOrdersDisplayShipping:C(s),shoppingOrdersDisplaySubtotal:C(y)})),n(!1)}},[e]),T(()=>{const m=V.on("order/data",s=>{r(s)},{eager:!0});return()=>{m==null||m.off()}},[]),{loading:t,storeConfig:u,order:l}},ut=({withHeader:a,orderData:e,children:t,className:n,...l})=>{const r=k(),{loading:u,storeConfig:o,order:m}=j({orderData:e,config:r}),s=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",{...l,className:H(["order-cost-summary",n]),children:c(R,{order:m,withHeader:a,loading:u,storeConfig:o,translations:s})})},P=({translations:a,order:e,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=e==null?void 0:e.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:a.incl}):null,n.taxExcluded&&n.taxIncluded?i(S,{children:[c(d,{currency:(r=e==null?void 0:e.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:a.excl})]}):null]})]})},W=({translations:a,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var l,r,u,o;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:a.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:a.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(S,{children:[c(d,{weight:"normal",currency:(u=t==null?void 0:t.totalShipping)==null?void 0:u.currency,amount:(o=t==null?void 0:t.totalShipping)==null?void 0:o.value,size:"small"}),i("span",{children:[" ",a.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:a.incl}):null]})]})},q=({translations:a,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,u,o,m;const l=(r=e==null?void 0:e.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((u=e==null?void 0:e.discounts)!=null&&u.length)&&(l||!t||t<1)||(o=e==null?void 0:e.discounts)!=null&&o.length&&l?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:a.discount}),c("span",{children:(m=e==null?void 0:e.discounts)==null?void 0:m.map(({amount:s},y)=>{const p=((s==null?void 0:s.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-p},`${s==null?void 0:s.value}${y}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(N,{source:$,size:"16"}),c("span",{children:a.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:a})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=a==null?void 0:a.coupons)==null?void 0:e.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},`${t==null?void 0:t.code}${n}`))})},U=({translations:a,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var u,o,m;const[l,r]=v(!1);return e?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(f,{onStateChange:r,title:a.accordionTitle,secondaryText:c(S,{children:l?null:c(d,{weight:"normal",amount:t,currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency})}),renderContentWhenClosed:!1,children:[(m=n==null?void 0:n.taxes)==null?void 0:m.map((s,y)=>{var h,p,_;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(d,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},`${(_=s==null?void 0:s.amount)==null?void 0:_.value}${y}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:a.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:a.tax}),c(d,{currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:a,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,l,r,u;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:a.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:a.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((u=t==null?void 0:t.grandTotal)==null?void 0:u.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},R=({translations:a,loading:e,storeConfig:t,order:n,withHeader:l=!0})=>{var h,p,_,O,w,L;if(e||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,u=((p=n.totalGiftcard)==null?void 0:p.currency)??"",o=((_=n.subtotal)==null?void 0:_.value)??0,m=((O=n.totalShipping)==null?void 0:O.value)??0,s=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=s?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,g)=>{var M;return+((M=g==null?void 0:g.amount)==null?void 0:M.value)+Z},0):0;return i(E,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(D,{title:a.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:a,order:n,subTotalValue:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:a,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:a,order:n,totalGiftcardValue:r,totalGiftcardCurrency:u}),c(F,{order:n}),c(U,{order:n,translations:a,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(G,{translations:a,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{ut as OrderCostSummary,ut as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index d41b7a9dca..2c8ad403ba 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as d,jsxs as P}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as x,Header as q}from"@dropins/tools/components.js";import{useState as C,useEffect as L,useMemo as R}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{Fragment as T}from"@dropins/tools/preact.js";import{events as S}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as I}from"../chunks/getStoreConfig.js";import{a as N}from"../chunks/OrderLoaders.js";import{C as Q}from"../chunks/CartSummaryItem.js";import{useText as k}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const M=({orderData:i})=>{const[l,e]=C(!0),[c,s]=C(i),[t,a]=C({taxIncluded:!1,taxExcluded:!1}),[n,f]=C("");return L(()=>{I().then(r=>{if(r){const o=b(r==null?void 0:r.shoppingCartDisplayPrice);a(o),f(r.baseMediaUrl)}}).finally(()=>{e(!1)})},[]),L(()=>{const r=S.on("order/data",o=>{s(o)},{eager:!0});return()=>{r==null||r.off()}},[]),{loading:l,taxConfig:t,order:{...c,placeholderImage:n}}},W=({className:i,orderData:l,withHeader:e,showConfigurableOptions:c,routeProductDetails:s})=>{const{loading:t,taxConfig:a,order:n}=M({orderData:l});return d("div",{className:h(["order-order-product-list",i]),children:d(w,{loading:t,taxConfig:a,order:n,withHeader:e,showConfigurableOptions:c,routeProductDetails:s})})},v=i=>{const l=(i==null?void 0:i.items)??[],e=l.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),c=new Map(e.map(t=>[t.id,t])),s=l.map(t=>{const a=c.get(t==null?void 0:t.id);if(a){const n=t.totalQuantity-a.quantityReturnRequested;return n===0?null:{...t,totalQuantity:n}}return t}).filter(t=>t!==null);return{returnedList:e,canceledItems:s==null?void 0:s.filter(t=>t.quantityCanceled),nonCanceledItems:s==null?void 0:s.filter(t=>!t.quantityCanceled)}},w=({loading:i,taxConfig:l,order:e=null,withHeader:c=!0,showConfigurableOptions:s,routeProductDetails:t})=>{const a=!!(e!=null&&e.returnNumber),n=k({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"}),f=R(()=>{var o,p;if(!e)return[];if(!a){const{returnedList:u,canceledItems:m,nonCanceledItems:g}=v(e);return[{type:"returned",list:u,title:n.returned},{type:"cancelled",list:m,title:n.cancelled},{type:"allItems",list:g,title:n.allOrders}].filter(O=>{var y;return((y=O==null?void 0:O.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((p=(o=e.returns.find(u=>u.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:o.items)==null?void 0:p.map(u=>({...u,totalQuantity:u.requestQuantity})))??[],title:n.returned}]},[e,a,n]);return e?f.every(r=>r.list.length===0)?null:d(x,{variant:"secondary",className:"order-order-product-list-content",children:f.map((r,o)=>{var u;const p=r.list.reduce((m,{totalQuantity:g})=>g+m,0);return P(T,{children:[c?d(q,{title:`${r.title} (${p})`}):null,d("ul",{className:"order-order-product-list-content__items",children:(u=r.list)==null?void 0:u.map(m=>d("li",{"data-testid":"order-product-list-content-item",children:d(Q,{placeholderImage:e==null?void 0:e.placeholderImage,loading:i,product:m,itemType:r.type,taxConfig:l,translations:n,showConfigurableOptions:s,routeProductDetails:t})},m.id))})]},o)})}):d(N,{})};export{W as OrderProductList,W as default}; +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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 3ed829bda9..f889b85251 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as c,Fragment as S,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as F,classes as y}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as P,Modal as G,Card as V,Header as K}from"@dropins/tools/components.js";import{useState as O,useEffect as v,useCallback as q}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as H,useState as W}from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{G as j}from"../chunks/getGuestOrder.graphql.js";import{f as J,h as z}from"../chunks/fetch-graphql.js";import{b as B}from"../chunks/transform-customer-orders-returns.js";import{useText as C,Text as x}from"@dropins/tools/i18n.js";import{C as Q}from"../chunks/OrderLoaders.js";import{f as X}from"../chunks/returnOrdersHelper.js";import{f as $}from"../chunks/formatDateToLocale.js";import{r as k}from"../chunks/redirectTo.js";import{g as Y}from"../chunks/getStoreConfig.js";import{O as Z}from"../chunks/OrderCancelForm.js";import{r as D}from"../chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const a=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=H(()=>{const d=t==null?void 0:t.availableActions,o=!!(d!=null&&d.length),m=!!(t!=null&&t.returnNumber),p=()=>{k(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(F,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:d==null?void 0:d.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:c(oe,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?a.createAnotherReturn:a.createReturn});case _.REORDER:return c(S,{children:m?null:c(ie,{orderData:t,onError:s,routeOnSuccess:i,children:a.reorder})})}})})})},[s,t,i,e,n,a]);return c("div",{className:y(["order-order-actions",r]),children:l})},U=()=>{const[r,t]=O(null);return v(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},te=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return v(()=>{const s=I.on("order/data",a=>{n(a),i(a.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=` +import{jsx as o,Fragment as S,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as F,classes as y}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as P,Modal as G,Card as V,Header as K}from"@dropins/tools/components.js";import{useState as g,useEffect as $,useCallback as q}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as H,useState as W}from"@dropins/tools/preact-compat.js";import{u as k}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as v}from"@dropins/tools/event-bus.js";import{G as j}from"../chunks/getGuestOrder.graphql.js";import{f as z,h as B}from"../chunks/fetch-graphql.js";import{b as Q}from"../chunks/transform-customer-orders-returns.js";import{useText as O,Text as b}from"@dropins/tools/i18n.js";import{C as J}from"../chunks/OrderLoaders.js";import{f as X}from"../chunks/returnOrdersHelper.js";import{f as x}from"../chunks/formatDateToLocale.js";import{r as U}from"../chunks/redirectTo.js";import{O as Y}from"../chunks/OrderCancelForm.js";import{r as Z}from"../chunks/reorderItems.js";import"../chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const D=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:a,onError:s})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=H(()=>{const i=t==null?void 0:t.availableActions,c=!!(i!=null&&i.length),m=!!(t!=null&&t.returnNumber),f=()=>{U(e,{},t)};return o(S,{children:n!=null&&n.OrderActions?o(F,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):o("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!c]]),children:i==null?void 0:i.map(p=>{switch(p){case _.CANCEL:return o(S,{children:m?null:o(se,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case _.RETURN:return o(E,{variant:"secondary",onClick:f,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return o(S,{children:m?null:o(oe,{orderData:t,onError:s,routeOnSuccess:a,children:d.reorder})})}})})})},[s,t,a,e,n,d]);return o("div",{className:y(["order-order-actions",r]),children:l})},ee=({orderData:r})=>{const[t,n]=g(r),[e,a]=g(r==null?void 0:r.status);return $(()=>{const s=v.on("order/data",d=>{n(d),a(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! @@ -19,4 +19,4 @@ import{jsx as c,Fragment as S,jsxs as N}from"@dropins/tools/preact-jsx-runtime.j } } ${j} -`,ne=async(r,t)=>J(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var a,l,d,o;const i=[...(a=e==null?void 0:e.confirmCancelOrder)!=null&&a.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.order&&(s=B((o=e==null?void 0:e.confirmCancelOrder)==null?void 0:o.order),I.emit("order/data",s)),i.length>0?z(i):s}),se=({enableOrderCancellation:r})=>{const t=C({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=O({text:"",status:void 0});return v(()=>{if(!r)return;const i=new URLSearchParams(window.location.search),s=i.get("order_id"),a=i.get("confirmation_key");s&&a&&ne(s,a).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},be=({slots:r,orderData:t,className:n,statusTitle:e,status:i,routeCreateReturn:s,onError:a,routeOnSuccess:l})=>{const{orderStatus:d,order:o}=te({orderData:t}),[m,p]=W(!1),g=()=>{p(!0);const f=new URL(window.location.href),A=f.searchParams.get("order_id"),T=f.searchParams.get("confirmation_key");A&&T&&(f.searchParams.delete("order_id"),f.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,f.toString()))},h=C({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=U(),{confirmOrderCancellation:u}=se({enableOrderCancellation:R==null?void 0:R.orderCancellationEnabled});return N("div",{className:y(["order-order-status",n]),children:[!m&&(u==null?void 0:u.status)!==void 0&&c(P,{heading:h.cancelOrder,onDismiss:g,description:u.text,type:u.status}),o?c(ce,{title:e,status:i||d,slots:r,orderData:o,routeCreateReturn:s,onError:a,routeOnSuccess:l}):c(Q,{withCard:!1})]})},oe=({orderRef:r})=>{const[t,n]=O(!1),e=()=>{n(!0)},i=()=>{n(!1)},s=U(),a=(s==null?void 0:s.orderCancellationReasons)??[],l=d=>d.map((o,m)=>({text:o==null?void 0:o.description,value:m.toString()}));return I.on("order/data",d=>{const o=String(d.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&i()}),N(S,{children:[c(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:c(x,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&c(G,{centered:!0,size:"medium",onClose:i,className:"order-order-cancel__modal",title:c("h2",{className:"order-order-cancel__title",children:c(x,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:c(Z,{orderRef:r,cancelReasons:l(a)})})]})},w={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"},ce=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:a})=>{var M,L,b;const l=!!(e!=null&&e.returnNumber),d=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[d]}.title`),h=C(`Order.OrderStatusContent.${w[d]}.message`),R=C(`Order.OrderStatusContent.${w[d]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${X(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((b=(L=u==null?void 0:u.returnMessage)==null?void 0:L.replace("{ORDER_CREATE_DATE}",$(e==null?void 0:e.orderDate)))==null?void 0:b.replace("{RETURN_CREATE_DATE}",$(p)))??"",T=l?t??u.title:t??g.title;return N(V,{className:"order-order-status-content",variant:"secondary",children:[c(K,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:a,onError:s})]})]})},ie=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[i,s]=O(!1),a=q(()=>{s(!0);const l=n==null?void 0:n.number;D(l).then(({success:d,userInputErrors:o})=>{d&&k(t,{}),o.length&&(r==null||r(o))}).catch(d=>{r==null||r(d.message)}).finally(()=>{s(!1)})},[n,t,r]);return c(E,{type:"button",disabled:i,variant:"secondary",className:"order-reorder",onClick:a,children:e})};export{be as OrderStatus,be as default}; +`,te=async(r,t)=>z(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,i,c;const a=[...(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(i=e==null?void 0:e.confirmCancelOrder)!=null&&i.order&&(s=Q((c=e==null?void 0:e.confirmCancelOrder)==null?void 0:c.order),v.emit("order/data",s)),a.length>0?B(a):s}),ne=({enableOrderCancellation:r})=>{const t=O({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=g({text:"",status:void 0});return $(()=>{if(!r)return;const a=new URLSearchParams(window.location.search),s=a.get("order_id"),d=a.get("confirmation_key");s&&d&&te(s,d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},be=({slots:r,orderData:t,className:n,statusTitle:e,status:a,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:i,order:c}=ee({orderData:t}),[m,f]=W(!1),p=()=>{f(!0);const C=new URL(window.location.href),A=C.searchParams.get("order_id"),T=C.searchParams.get("confirmation_key");A&&T&&(C.searchParams.delete("order_id"),C.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,C.toString()))},h=O({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=k(),{confirmOrderCancellation:u}=ne({enableOrderCancellation:R==null?void 0:R.orderCancellationEnabled});return N("div",{className:y(["order-order-status",n]),children:[!m&&(u==null?void 0:u.status)!==void 0&&o(P,{heading:h.cancelOrder,onDismiss:p,description:u.text,type:u.status}),c?o(ce,{title:e,status:a||i,slots:r,orderData:c,routeCreateReturn:s,onError:d,routeOnSuccess:l}):o(J,{withCard:!1})]})},se=({orderRef:r})=>{const[t,n]=g(!1),e=()=>{n(!0)},a=()=>{n(!1)},s=k(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=i=>i.map((c,m)=>({text:c==null?void 0:c.description,value:m.toString()}));return v.on("order/data",i=>{const c=String(i.status).toLocaleLowerCase();(c==="guest order cancellation requested"||c==="canceled")&&a()}),N(S,{children:[o(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:o(b,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&o(G,{centered:!0,size:"medium",onClose:a,className:"order-order-cancel__modal",title:o("h2",{className:"order-order-cancel__title",children:o(b,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:o(Y,{orderRef:r,cancelReasons:l(d)})})]})},w={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"},ce=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:a,onError:s,routeOnSuccess:d})=>{var M,I,L;const l=!!(e!=null&&e.returnNumber),i=String(n).toLocaleLowerCase(),c=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(c==null?void 0:c.returnStatus)??"",f=(c==null?void 0:c.createdReturnAt)??"",p=O(`Order.OrderStatusContent.${w[i]}.title`),h=O(`Order.OrderStatusContent.${w[i]}.message`),R=O(`Order.OrderStatusContent.${w[i]}.messageWithoutDate`),u=O({title:`Order.OrderStatusContent.returnStatus.${X(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return o("div",{});const C=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((L=(I=u==null?void 0:u.returnMessage)==null?void 0:I.replace("{ORDER_CREATE_DATE}",x(e==null?void 0:e.orderDate)))==null?void 0:L.replace("{RETURN_CREATE_DATE}",x(f)))??"",T=l?t??u.title:t??p.title;return N(V,{className:"order-order-status-content",variant:"secondary",children:[o(K,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[o("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:o("p",{children:l?A:C})}),o(D,{orderData:e,slots:r,routeCreateReturn:a,routeOnSuccess:d,onError:s})]})]})},oe=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[a,s]=g(!1),d=q(()=>{s(!0);const l=n==null?void 0:n.number;Z(l).then(({success:i,userInputErrors:c})=>{i&&U(t,{}),c.length&&(r==null||r(c))}).catch(i=>{r==null||r(i.message)}).finally(()=>{s(!1)})},[n,t,r]);return o(E,{type:"button",disabled:a,variant:"secondary",className:"order-reorder",onClick:d,children:e})};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 6a7384c549..0f17307321 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 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}; +import{jsx as p}from"@dropins/tools/preact-jsx-runtime.js";import{classes as I}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{u as M}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getCustomerOrdersReturn.js";import{u as T}from"../chunks/useIsMobile.js";import{R as V}from"../chunks/ReturnsListContent.js";import{useText as k}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"../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[o,n]=s(!0),[i,u]=s([]),[a,m]=s(g),[d,l]=s(1);$(()=>{A(t).then(async r=>{u((r==null?void 0:r.ordersReturn)??[]),m((r==null?void 0:r.pageInfo)??g)}).finally(()=>{n(!1)})},[t]);const c=y(r=>{l(r)},[]);return{pageInfo:a,selectedPage:d,loading:o,orderReturns:i,handleSetSelectPage:c}},tr=({slots:t,withReturnsListButton:o,className:n,minifiedView:i,withHeader:u,withThumbnails:a,returnPageSize:m,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R})=>{const f=M(),{pageInfo:O,selectedPage:b,handleSetSelectPage:w,loading:N,orderReturns:P}=v({returnPageSize:m}),S=T(),e=i?"minifiedView":"fullSizeView",h=k({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 p("div",{className:I(["order-returns-list",n]),children:p(V,{placeholderImage:(f==null?void 0:f.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:b,handleSetSelectPage:w,pageInfo:O,withReturnsListButton:o,isMobile:S,orderReturns:P,translations:h,withHeader:u,returnsInMinifiedView:d,withThumbnails:a,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R,loading:N})})};export{tr as default}; diff --git a/scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts b/scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts new file mode 100644 index 0000000000..f11f3943aa --- /dev/null +++ b/scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts @@ -0,0 +1,9 @@ +export declare const ConfigStoreProvider: ({ children }: any) => import("preact").JSX.Element; +export declare const useConfig: () => { + placeholderImage: string; + taxConfig: { + taxIncluded: boolean; + taxExcluded: boolean; + }; +}; +//# sourceMappingURL=ConfigStoreContext.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts index b648c854b6..dedc3def4d 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts @@ -1,10 +1,10 @@ import { AttributesFormModel, OrderItemModel } from '../../data/models'; -import { StepsTypes, TaxTypes, UseCreateReturn } from '../../types'; +import { StepsTypes, UseCreateReturn } from '../../types'; import { RefObject } from 'preact'; export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAlert, orderData, }: UseCreateReturn) => { order: { - placeholderImage: string; + placeholderImage?: string | undefined; returnNumber?: string | undefined; id: string; orderStatusChangeDate?: string | undefined; @@ -53,7 +53,6 @@ export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAler steps: StepsTypes; loading: boolean; formsRef: import('preact/hooks').MutableRef[]>; - taxConfig: TaxTypes; attributesList: [] | AttributesFormModel[]; selectedProductList: [] | OrderItemModel[]; itemsEligibleForReturn: OrderItemModel[]; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts index 10e8080d22..12c733ecf5 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts @@ -1,7 +1,7 @@ import { OrderDataModel } from '../../data/models'; import { StoreConfigProps, UseOrderCostSummaryProps } from '../../types'; -export declare const useOrderCostSummary: ({ orderData, }: UseOrderCostSummaryProps) => { +export declare const useOrderCostSummary: ({ orderData, config }: UseOrderCostSummaryProps) => { loading: boolean; storeConfig: StoreConfigProps | null; order: OrderDataModel | undefined; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts index bb367dd81b..3b7b764fd5 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts @@ -1,54 +1,8 @@ -import { TaxTypes, UseOrderProductListProps } from '../../types'; +import { OrderDataModel } from '../../data/models'; +import { UseOrderProductListProps } from '../../types'; export declare const useOrderProductList: ({ orderData, }: UseOrderProductListProps) => { loading: boolean; - taxConfig: TaxTypes; - order: { - placeholderImage: string; - returnNumber?: string | undefined; - id?: string | undefined; - orderStatusChangeDate?: string | undefined; - number?: string | undefined; - email?: string | undefined; - token?: string | undefined; - status?: string | undefined; - isVirtual?: boolean | undefined; - totalQuantity?: number | undefined; - shippingMethod?: string | undefined; - carrier?: string | undefined; - orderDate?: string | undefined; - returns?: import('../../data/models').OrdersReturnPropsModel[] | undefined; - discounts?: { - amount: import('../../types').MoneyProps; - label: string; - }[] | undefined; - coupons?: { - code: string; - }[] | undefined; - payments?: { - code: string; - name: string; - }[] | undefined; - shipping?: { - code: string; - amount: number; - currency: string; - } | undefined; - shipments?: import('../../data/models').ShipmentsModel[] | undefined; - items?: import('../../data/models').OrderItemModel[] | undefined; - totalGiftcard?: import('../../types').MoneyProps | undefined; - grandTotal?: import('../../types').MoneyProps | undefined; - totalShipping?: import('../../types').MoneyProps | undefined; - subtotal?: import('../../types').MoneyProps | undefined; - totalTax?: import('../../types').MoneyProps | undefined; - shippingAddress?: import('../../data/models').OrderAddressModel | undefined; - billingAddress?: import('../../data/models').OrderAddressModel | undefined; - availableActions?: import('../../types').AvailableActionsProps[] | undefined; - taxes?: { - amount: import('../../types').MoneyProps; - rate: number; - title: string; - }[] | undefined; - }; + order: OrderDataModel | undefined; }; //# sourceMappingURL=useOrderProductList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts index 672a7dabc3..1b11a83db8 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts @@ -2,7 +2,6 @@ import { OrdersReturnPropsModel } from '../../data/models'; import { UseReturnsListProps } from '../../types'; export declare const useReturnsList: ({ returnPageSize }: UseReturnsListProps) => { - placeholderImage: string; pageInfo: { totalPages: number; currentPage: number; diff --git a/scripts/__dropins__/storefront-order/hooks/index.d.ts b/scripts/__dropins__/storefront-order/hooks/index.d.ts index 411457d8bc..eeec23d318 100644 --- a/scripts/__dropins__/storefront-order/hooks/index.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/index.d.ts @@ -9,4 +9,5 @@ export * from './containers/useReturnsList'; export * from './containers/useShippingStatus'; export * from './useInLineAlert'; export * from './useIsMobile'; +export * from './api/useGetStoreConfig'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 60bb811370..2d7f3b19f4 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1733238046033} \ No newline at end of file +{"at":1733249360240} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts index ceee817ad9..1578f9a786 100644 --- a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts @@ -23,6 +23,7 @@ export interface OrderCostSummaryContentProps { } export interface UseOrderCostSummaryProps { orderData?: OrderDataModel; + config: StoreConfigModel | null; } export {}; //# sourceMappingURL=orderCostSummary.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts index c8d4d0ea96..027355ea02 100644 --- a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts @@ -13,6 +13,7 @@ export interface OrderProductListProps { routeProductDetails?: (product: any) => string; } export interface OrderProductListContentProps extends Omit { + placeholderImage: string; order?: OrderDataModel; taxConfig: TaxTypes; loading: boolean; diff --git a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts index 3c7d12e500..e06e0c2017 100644 --- a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts @@ -40,7 +40,7 @@ export interface ReturnsListProps { withThumbnails?: boolean; } export interface ReturnsListContentProps extends Omit { - placeholderImage: string; + placeholderImage?: string; minifiedViewKey: 'minifiedView' | 'fullSizeView'; orderReturns?: OrdersReturnPropsModel[] | []; translations: Record;