@dropins/storefront-order 0.1.0-alpha10 → 0.1.0-alpha12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +4 -0
  2. package/api/getCustomerOrdersReturn/graphql/getCustomerOrdersReturn.graphql.d.ts +2 -0
  3. package/api/getCustomerOrdersReturn/index.d.ts +2 -0
  4. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +5 -1
  5. package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +1 -1
  6. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
  7. package/api/index.d.ts +1 -0
  8. package/api.js +70 -56
  9. package/chunks/OrderLoaders.js +1 -1
  10. package/chunks/convertCase.js +1 -0
  11. package/chunks/customerAddressFragment.graphql.js +55 -0
  12. package/chunks/fetch-graphql.js +1 -1
  13. package/chunks/getAttributesForm.js +3 -3
  14. package/chunks/getCustomer.js +34 -27
  15. package/chunks/getCustomerOrdersReturn.js +52 -0
  16. package/chunks/getStoreConfig.js +9 -2
  17. package/chunks/setTaxStatus.js +1 -0
  18. package/chunks/transform-order-details.js +77 -72
  19. package/components/EmptyList/EmptyList.d.ts +5 -0
  20. package/components/EmptyList/index.d.ts +3 -0
  21. package/components/OrderCancelReasonsForm/OrderCancelReasonsForm.d.ts +5 -0
  22. package/components/OrderCancelReasonsForm/index.d.ts +3 -0
  23. package/components/OrderCostSummaryContent/Blocks.d.ts +38 -0
  24. package/components/OrderCostSummaryContent/OrderCostSummaryContent.d.ts +5 -0
  25. package/components/OrderCostSummaryContent/index.d.ts +3 -0
  26. package/components/OrderLoaders/OrderLoaders.d.ts +2 -0
  27. package/components/OrderProductListContent/CartSummaryItem.d.ts +5 -0
  28. package/components/OrderProductListContent/OrderProductListContent.d.ts +5 -0
  29. package/components/OrderProductListContent/index.d.ts +4 -0
  30. package/components/ReturnsListContent/ReturnsListContent.d.ts +5 -0
  31. package/components/ReturnsListContent/index.d.ts +3 -0
  32. package/components/index.d.ts +5 -1
  33. package/configs/mock.config.d.ts +786 -0
  34. package/containers/CustomerDetails.js +1 -1
  35. package/containers/OrderCancel/OrderCancel.d.ts +5 -0
  36. package/containers/OrderCancel.d.ts +3 -0
  37. package/containers/OrderCancel.js +87 -0
  38. package/containers/OrderCostSummary/OrderCostSummary.d.ts +5 -0
  39. package/containers/OrderCostSummary/index.d.ts +3 -0
  40. package/containers/OrderCostSummary.d.ts +3 -0
  41. package/containers/OrderCostSummary.js +1 -0
  42. package/containers/OrderProductList/OrderProductList.d.ts +5 -0
  43. package/containers/OrderProductList/index.d.ts +3 -0
  44. package/containers/OrderProductList.d.ts +3 -0
  45. package/containers/OrderProductList.js +1 -0
  46. package/containers/OrderSearch.js +1 -1
  47. package/containers/OrderStatus.js +1 -80
  48. package/containers/ReturnsList/ReturnsList.d.ts +5 -0
  49. package/containers/ReturnsList/index.d.ts +3 -0
  50. package/containers/ReturnsList.d.ts +3 -0
  51. package/containers/ReturnsList.js +1 -0
  52. package/containers/ShippingStatus.js +1 -1
  53. package/containers/index.d.ts +4 -0
  54. package/data/models/customer-orders-return.d.ts +36 -0
  55. package/data/models/index.d.ts +2 -0
  56. package/data/models/order-details.d.ts +44 -8
  57. package/data/models/store-config.d.ts +7 -0
  58. package/data/transforms/index.d.ts +2 -0
  59. package/data/transforms/transform-customer-orders-return.d.ts +5 -0
  60. package/data/transforms/transform-order-details.d.ts +11 -1
  61. package/hooks/containers/useOrderCostSummary.d.ts +9 -0
  62. package/hooks/containers/useOrderProductList.d.ts +9 -0
  63. package/hooks/containers/useReturnsList.d.ts +14 -0
  64. package/hooks/index.d.ts +4 -0
  65. package/hooks/useIsMobile.d.ts +2 -0
  66. package/i18n/en_US.json.d.ts +67 -4
  67. package/lib/setTaxStatus.d.ts +4 -0
  68. package/package.json +1 -1
  69. package/render.js +2 -2
  70. package/types/api/getCustomerOrdersReturn.types.d.ts +46 -0
  71. package/types/api/getOrderDetails.types.d.ts +24 -5
  72. package/types/emptyList.types.d.ts +7 -0
  73. package/types/index.d.ts +5 -0
  74. package/types/orderCancel.types.d.ts +8 -4
  75. package/types/orderCostSummary.types.d.ts +28 -0
  76. package/types/orderProductList.types.d.ts +30 -0
  77. package/types/returnsList.types.d.ts +42 -0
  78. package/components/OrderCancel/OrderCancel.d.ts +0 -5
  79. /package/chunks/{CustomerDetailsContent.js → OrderCancelReasonsForm.js} +0 -0
  80. /package/{components → containers}/OrderCancel/index.d.ts +0 -0
@@ -1 +1 @@
1
- import{jsx as t,jsxs as u,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{useMemo as V,useCallback as x,useState as k,useEffect as L}from"@dropins/tools/preact-hooks.js";import{events as Z}from"@dropins/tools/event-bus.js";import{c as R}from"../chunks/fetch-graphql.js";import{g as z}from"../chunks/getAttributesForm.js";import{Card as B,Header as F,Price as $,Icon as q}from"@dropins/tools/components.js";import"../chunks/CustomerDetailsContent.js";import*as m from"@dropins/tools/preact-compat.js";import{D as K}from"../chunks/OrderLoaders.js";import{useText as G}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";const I=o=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),J=o=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),Q=({loading:o,order:e,withHeader:a=!0,title:c,paymentIconsMap:s={},normalizeAddress:r})=>{var N,M,E,T,D;const i=G({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",billingMethodsTitle:"Order.CustomerDetails.billingMethods.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping"}),p=V(()=>({checkmo:I,card:J,...s}),[s]),_=x(j=>{var w;return(w=r[j])==null?void 0:w.map((f,S)=>t("div",{className:"order-customer-details-content__container-description--row",children:f==null?void 0:f.map((l,W)=>t("p",{children:l.label?`${l.label}: ${Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value}`:Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value},W))},S))},[r]);if(!e||o)return t(K,{});const d=(e==null?void 0:e.email)??"",h=(N=e==null?void 0:e.shipping)==null?void 0:N.code,n=(M=e==null?void 0:e.shipping)==null?void 0:M.amount,v=(E=e==null?void 0:e.shipping)==null?void 0:E.currency,g=e==null?void 0:e.payments,C=g&&g.length>0,A=C?(T=g[0])==null?void 0:T.name:"",y=C?(D=g[0])==null?void 0:D.code:"",H=C&&A!=="";return u(B,{"data-testid":"order-details",variant:"secondary",className:b(["order-customer-details-content"]),children:[a?t(F,{title:c??i.headerText}):null,u("div",{className:"order-customer-details-content__container",children:[u("div",{className:"order-customer-details-content__container-email",children:[t("div",{className:"order-customer-details-content__container-title",children:i.emailTitle}),t("p",{children:d})]}),u("div",{className:"order-customer-details-content__container-shipping_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("shippingAddress")})]}),u("div",{className:"order-customer-details-content__container-billing_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("billingAddress")})]}),u("div",{className:"order-customer-details-content__container-shipping_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingMethodsTitle}),h?t(P,{children:n?u("p",{"data-testid":"shipping_methods_price",children:[t($,{amount:n,currency:v})," ",h]}):t("p",{"data-testid":"shipping_methods_placeholder",children:i.freeShipping})}):null]}),u("div",{className:"order-customer-details-content__container-billing_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingMethodsTitle}),H&&u("p",{"data-testid":"billing_methods_description",className:b([["order-customer-details-content__container-billing_methods--icon",!!p[y]]]),children:[t(q,{source:p[y]}),A]})]})]})]})},U=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],O=o=>{o.sort((s,r)=>s.orderNumber-r.orderNumber);const e=[];let a=[];const c=s=>s.value!==void 0&&s.value!==null&&s.value!=="";for(let s=0;s<o.length;s++){const r=o[s];if(c(r))if(Array.isArray(r.value)){const i=r.value.map(p=>({...r,value:p}));e.push(i)}else e.length<4?(a.push(r),a.length===2&&(e.push(a),a=[])):e.push([r])}return a.length>0&&e.length<4&&e.push(a),e},X=({orderData:o})=>{const[e,a]=k(!0),[c,s]=k(o),[r,i]=k([]);L(()=>{const d=Z.on("order/data",h=>{s(h)},{eager:!0});return()=>{d==null||d.off()}},[]),L(()=>{z("shortRequest").then(d=>{if(d){const h=d.map(({name:n,orderNumber:v,label:g})=>({name:R(n),orderNumber:v,label:U.includes(n)?null:g}));i(h)}}).finally(()=>{a(!1)})},[]);const p=x(d=>{if(!r.length||!c||!c[d])return[];const h=Object.fromEntries(Object.entries(c[d]).map(([n,v])=>[n.toLowerCase(),v]));return r.filter(({name:n})=>h[n.toLowerCase()]).map(n=>({name:n.name,orderNumber:n.orderNumber,value:h[n.name.toLowerCase()],label:n.label}))},[r,c]),_=V(()=>({billingAddress:O(p("billingAddress")),shippingAddress:O(p("shippingAddress"))}),[p]);return{order:c,normalizeAddress:_,loading:e}},me=({paymentIconsMap:o,orderData:e,title:a,className:c})=>{const{order:s,normalizeAddress:r,loading:i}=X({orderData:e});return t("div",{className:b(["order-customer-details",c]),children:t(Q,{loading:i,order:s,title:a,paymentIconsMap:o,normalizeAddress:r})})};export{me as CustomerDetails,me as default};
1
+ import{jsx as t,jsxs as m,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{useMemo as x,useCallback as H,useState as k,useEffect as O}from"@dropins/tools/preact-hooks.js";import{events as Z}from"@dropins/tools/event-bus.js";import{c as R}from"../chunks/convertCase.js";import{g as z}from"../chunks/getAttributesForm.js";import{Card as B,Header as F,Price as $,Icon as q}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import*as h from"@dropins/tools/preact-compat.js";import{D as K}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact.js";import{useText as G}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=o=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),J=o=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),Q=({loading:o,order:e,withHeader:a=!0,title:c,paymentIconsMap:s={},normalizeAddress:r})=>{var N,M,E,T,D;const i=G({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",billingMethodsTitle:"Order.CustomerDetails.billingMethods.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping"}),p=x(()=>({checkmo:I,card:J,...s}),[s]),_=H(S=>{var w;return(w=r[S])==null?void 0:w.map((f,W)=>t("div",{className:"order-customer-details-content__container-description--row",children:f==null?void 0:f.map((l,P)=>m(L,{children:[t("p",{children:l.label?`${l.label}: ${Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value}`:Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value},P)," "]}))},W))},[r]);if(!e||o)return t(K,{});const d=(e==null?void 0:e.email)??"",u=(N=e==null?void 0:e.shipping)==null?void 0:N.code,n=(M=e==null?void 0:e.shipping)==null?void 0:M.amount,v=(E=e==null?void 0:e.shipping)==null?void 0:E.currency,g=e==null?void 0:e.payments,C=g&&g.length>0,A=C?(T=g[0])==null?void 0:T.name:"",y=C?(D=g[0])==null?void 0:D.code:"",j=C&&A!=="";return m(B,{"data-testid":"order-details",variant:"secondary",className:b(["order-customer-details-content"]),children:[a?t(F,{title:c??i.headerText}):null,m("div",{className:"order-customer-details-content__container",children:[m("div",{className:"order-customer-details-content__container-email",children:[t("div",{className:"order-customer-details-content__container-title",children:i.emailTitle}),t("p",{children:d})]}),m("div",{className:"order-customer-details-content__container-shipping_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("shippingAddress")})]}),m("div",{className:"order-customer-details-content__container-billing_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("billingAddress")})]}),m("div",{className:"order-customer-details-content__container-shipping_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingMethodsTitle}),u?t(L,{children:n?m("p",{"data-testid":"shipping_methods_price",children:[t($,{amount:n,currency:v})," ",u]}):t("p",{"data-testid":"shipping_methods_placeholder",children:i.freeShipping})}):null]}),m("div",{className:"order-customer-details-content__container-billing_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingMethodsTitle}),j&&m("p",{"data-testid":"billing_methods_description",className:b([["order-customer-details-content__container-billing_methods--icon",!!p[y]]]),children:[t(q,{source:p[y]}),A]})]})]})]})},U=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],V=o=>{o.sort((s,r)=>s.orderNumber-r.orderNumber);const e=[];let a=[];const c=s=>s.value!==void 0&&s.value!==null&&s.value!=="";for(let s=0;s<o.length;s++){const r=o[s];if(c(r))if(Array.isArray(r.value)){const i=r.value.map(p=>({...r,value:p}));e.push(i)}else e.length<4?(a.push(r),a.length===2&&(e.push(a),a=[])):e.push([r])}return a.length>0&&e.length<4&&e.push(a),e},X=({orderData:o})=>{const[e,a]=k(!0),[c,s]=k(o),[r,i]=k([]);O(()=>{const d=Z.on("order/data",u=>{s(u)},{eager:!0});return()=>{d==null||d.off()}},[]),O(()=>{z("shortRequest").then(d=>{if(d){const u=d.map(({name:n,orderNumber:v,label:g})=>({name:R(n),orderNumber:v,label:U.includes(n)?null:g}));i(u)}}).finally(()=>{a(!1)})},[]);const p=H(d=>{if(!r.length||!c||!c[d])return[];const u=Object.fromEntries(Object.entries(c[d]).map(([n,v])=>[n.toLowerCase(),v]));return r.filter(({name:n})=>u[n.toLowerCase()]).map(n=>({name:n.name,orderNumber:n.orderNumber,value:u[n.name.toLowerCase()],label:n.label}))},[r,c]),_=x(()=>({billingAddress:V(p("billingAddress")),shippingAddress:V(p("shippingAddress"))}),[p]);return{order:c,normalizeAddress:_,loading:e}},ue=({paymentIconsMap:o,orderData:e,title:a,className:c})=>{const{order:s,normalizeAddress:r,loading:i}=X({orderData:e});return t("div",{className:b(["order-customer-details",c]),children:t(Q,{loading:i,order:s,title:a,paymentIconsMap:o,normalizeAddress:r})})};export{ue as CustomerDetails,ue as default};
@@ -0,0 +1,5 @@
1
+ import { OrderCancelProps } from '../../types';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+
4
+ export declare const OrderCancel: Container<OrderCancelProps>;
5
+ //# sourceMappingURL=OrderCancel.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderCancel/index'
2
+ import _default from './OrderCancel/index'
3
+ export default _default
@@ -0,0 +1,87 @@
1
+ import{jsx as n,Fragment as f,jsxs as E}from"@dropins/tools/preact-jsx-runtime.js";import{P as g,a as S,G as h,O as I,B as A,t as T}from"../chunks/transform-order-details.js";import{O as b,A as N}from"../chunks/customerAddressFragment.graphql.js";import{f as F,h as L}from"../chunks/fetch-graphql.js";import{useState as c,useEffect as v}from"@dropins/tools/preact-hooks.js";import{g as G}from"../chunks/getStoreConfig.js";import{InLineAlert as M,Picker as $,Button as x}from"@dropins/tools/components.js";import{F as y}from"../chunks/OrderCancelReasonsForm.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as m}from"@dropins/tools/event-bus.js";import{useText as w,Text as u}from"@dropins/tools/i18n.js";import"../chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";const P=({pickerProps:a,submitButtonProps:r,cancelReasons:e,cancelOrder:s,orderId:t})=>{const o=w({ErrorHeading:"Order.OrderCancellationReasonsForm.errorHeading",ErrorDescription:"Order.OrderCancellationReasonsForm.errorDescription",orderCancellationLabel:"Order.OrderCancellationReasonsForm.label"}),[i,p]=c(0),[_,O]=c(!1),[R,C]=c(!1);m.on("authenticated",d=>{d&&C(!0)},{eager:!0});const D=d=>{d.preventDefault();const l=Number(d.target.value);p(l)};return n(f,{children:E(y,{onSubmit:async d=>(d.preventDefault(),s(t,e[i].text,l=>{R||(l.status="guest order cancellation requested"),m.emit("order/data",l)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[_&&n(M,{heading:o.ErrorHeading,description:o.ErrorDescription}),n("div",{className:"order-order-cancel-reasons-form__text",children:n(u,{id:"Order.OrderCancellationReasonsForm.description"})}),n($,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:e[0],variant:"primary",options:e,value:String(i),handleSelect:D,required:!0,"data-testid":"order-cancellation-reasons-selector",...a}),n("div",{className:"order-order-cancel-reasons-form__button-container",children:n(x,{variant:"primary",...r,children:n(u,{id:"Order.OrderCancellationReasonsForm.button"})})})]})})},B=`
2
+ mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
3
+ cancelOrder(input: { order_id: $orderId, reason: $reason }) {
4
+ error
5
+ order {
6
+ email
7
+ available_actions
8
+ status
9
+ number
10
+ id
11
+ order_date
12
+ carrier
13
+ shipping_method
14
+ is_virtual
15
+ applied_coupons {
16
+ code
17
+ }
18
+ shipments {
19
+ id
20
+ number
21
+ tracking {
22
+ title
23
+ number
24
+ carrier
25
+ }
26
+ comments {
27
+ message
28
+ timestamp
29
+ }
30
+ items {
31
+ id
32
+ product_sku
33
+ product_name
34
+ order_item {
35
+ ...OrderItemDetails
36
+ ... on GiftCardOrderItem {
37
+ ...GiftCardDetails
38
+ product {
39
+ ...ProductDetails
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ payment_methods {
46
+ name
47
+ type
48
+ }
49
+ shipping_address {
50
+ ...AddressesList
51
+ }
52
+ billing_address {
53
+ ...AddressesList
54
+ }
55
+ items {
56
+ ...OrderItemDetails
57
+ ... on BundleOrderItem {
58
+ ...BundleOrderItemDetails
59
+ }
60
+ ... on GiftCardOrderItem {
61
+ ...GiftCardDetails
62
+ product {
63
+ ...ProductDetails
64
+ }
65
+ }
66
+ ... on DownloadableOrderItem {
67
+ product_name
68
+ downloadable_links {
69
+ sort_order
70
+ title
71
+ }
72
+ }
73
+ }
74
+ total {
75
+ ...OrderSummary
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ${g}
81
+ ${S}
82
+ ${h}
83
+ ${I}
84
+ ${A}
85
+ ${b}
86
+ ${N}
87
+ `,U=async(a,r,e,s)=>{if(!a)throw new Error("No order ID found");if(!r)throw new Error("No reason found");return F(B,{variables:{orderId:a,reason:r}}).then(({errors:t,data:o})=>{if(t)return L(t);if(o.cancelOrder.error!=null){s();return}const i=T(o.cancelOrder.order);e(i)})},k=()=>{const[a,r]=c(null);return v(()=>{const e=sessionStorage.getItem("orderStoreConfig"),s=e?JSON.parse(e):null;s?r(s):G().then(t=>{t&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(t)),r(t))})},[]),a},nr=({orderId:a})=>{const r=k(),e=(r==null?void 0:r.orderCancellationReasons)??[];return n(f,{children:n(P,{orderId:a,cancelOrder:U,cancelReasons:(t=>t.map((o,i)=>({text:o==null?void 0:o.description,value:i.toString()})))(e)})})};export{nr as OrderCancel,nr as default};
@@ -0,0 +1,5 @@
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
+ import { OrderCostSummaryProps } from '../../types';
3
+
4
+ export declare const OrderCostSummary: Container<OrderCostSummaryProps>;
5
+ //# sourceMappingURL=OrderCostSummary.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderCostSummary';
2
+ export { OrderCostSummary as default } from './OrderCostSummary';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderCostSummary/index'
2
+ import _default from './OrderCostSummary/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsxs as r,jsx as c,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-hooks.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 u,Icon as b,Accordion as f,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import*as h from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{a 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 A=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),I=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.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"})),P=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,i;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(u,{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})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?r(v,{children:[c(u,{currency:(i=a==null?void 0:a.subtotal)==null?void 0:i.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},W=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,i,o,s;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[r("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(u,{weight:"normal",currency:(i=t==null?void 0:t.totalShipping)==null?void 0:i.currency,amount:n}):c("span",{children:e.freeShipping})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?r(v,{children:[c(u,{weight:"normal",currency:(o=t==null?void 0:t.totalShipping)==null?void 0:o.currency,amount:(s=t==null?void 0:t.totalShipping)==null?void 0:s.value,size:"small"}),r("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 l;return!(a!=null&&a.discounts.length)&&!t?null:r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:a!=null&&a.discounts.length?(l=a==null?void 0:a.discounts)==null?void 0:l.map(({amount:i},o)=>{const s=(i==null?void 0:i.value)??0;return c(u,{weight:"normal",sale:!0,currency:i==null?void 0:i.currency,amount:-(s+t)},o)}):null})]}),!(a!=null&&a.discounts.length)&&t?r("div",{className:"order-cost-summary-content__description--subheader",children:[r("span",{children:[c(b,{source:j,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(u,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:e})=>c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:e.coupons.map((a,t)=>r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.code}),c("span",{children:"TBD"})]},t))}),U=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var o;const[l,i]=_(!1);return a?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:A,iconClose:I,children:r(E,{onStateChange:i,title:e.accordionTitle,secondaryText:c(v,{children:l?null:c(u,{weight:"normal",amount:t,currency:n.totalTax.currency})}),renderContentWhenClosed:!1,children:[n.taxes.map((s,m)=>{var d,p;return r("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(u,{weight:"normal",amount:(d=s==null?void 0:s.amount)==null?void 0:d.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},m)}),r("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(u,{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:r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(u,{currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,i,o;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(u,{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?r("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(u,{currency:(i=t==null?void 0:t.grandTotal)==null?void 0:i.currency,amount:((o=t==null?void 0:t.grandTotal)==null?void 0:o.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},R=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var y,x,S,O,w,L;if(a||!n)return c(z,{});const i=((y=n==null?void 0:n.totalGiftcard)==null?void 0:y.value)??0,o=((x=n.totalGiftcard)==null?void 0:x.currency)??"",s=((S=n.subtotal)==null?void 0:S.value)??0,m=((O=n.totalShipping)==null?void 0:O.value)??0,d=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),p=d?(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 r(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,r("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:e,order:n,subTotalValue:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:e,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:e,order:n,totalGiftcardValue:i,totalGiftcardCurrency:o}),c(F,{order:n}),c(U,{order:n,translations:e,renderTaxAccordion:d,totalAccordionTaxValue:p}),c(G,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},J=({orderData:e})=>{const[a,t]=_(!0),[n,l]=_(e),[i,o]=_(null);return T(()=>{N().then(s=>{if(s){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:d,shoppingOrdersDisplaySubtotal:p,...y}=s;o(x=>({...x,...y,shoppingCartDisplayPrice:C(m),shoppingOrdersDisplayShipping:C(d),shoppingOrdersDisplaySubtotal:C(p)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const s=V.on("order/data",m=>{l(m)},{eager:!0});return()=>{s==null||s.off()}},[]),{loading:a,storeConfig:i,order:n}},lt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:i,storeConfig:o,order:s}=J({orderData:a}),m=B({headerText:"Order.OrderCostSummary.headerText",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"});return c("div",{...l,className:H(["order-cost-summary",n]),children:c(R,{order:s,withHeader:e,loading:i,storeConfig:o,translations:m})})};export{lt as OrderCostSummary,lt as default};
@@ -0,0 +1,5 @@
1
+ import { OrderProductListProps } from '../../types';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+
4
+ export declare const OrderProductList: Container<OrderProductListProps>;
5
+ //# sourceMappingURL=OrderProductList.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderProductList';
2
+ export { OrderProductList as default } from './OrderProductList';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderProductList/index'
2
+ import _default from './OrderProductList/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as k,Fragment as E}from"@dropins/tools/preact-jsx-runtime.js";import{Card as Z,Header as j,Price as W,CartItem as z,Icon as B,Image as K}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import{classes as q}from"@dropins/tools/lib.js";import*as L from"@dropins/tools/preact-compat.js";import{useMemo as R,useCallback as A,useState as b,useEffect as P}from"@dropins/tools/preact-hooks.js";import{Fragment as J}from"@dropins/tools/preact.js";import{O as U}from"../chunks/OrderLoaders.js";import{events as X}from"@dropins/tools/event-bus.js";import{useText as Y}from"@dropins/tools/i18n.js";import{s as g}from"../chunks/setTaxStatus.js";import{g as I}from"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const T=u=>L.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...u},L.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"}),L.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),p=({loading:u,taxConfig:e,order:d=null,withHeader:c=!0,showConfigurableOptions:i})=>{const m=Y({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),h=R(()=>{if(!d)return[];const{items:s}=d;return[{type:"cancelled",list:s.filter(a=>a.quantityCanceled),title:m.cancelled},{type:"",list:s.filter(a=>!a.quantityCanceled),title:m.allOrders}]},[d,m]);return d?r(Z,{variant:"secondary",className:"order-order-product-list-content",children:h.filter(s=>s.list.length).map((s,a)=>{var v;return k(J,{children:[c?r(j,{title:`${s.title} (${s.list.length})`}):null,r("ul",{className:"order-order-product-list-content__items",children:(v=s.list)==null?void 0:v.map(O=>r("li",{"data-testid":"order-product-list-content-item",children:r(ee,{loading:u,product:O,itemType:s.type,taxConfig:e,translations:m,showConfigurableOptions:i})},O.id))})]},a)})}):r(U,{})},ee=({loading:u,product:e,itemType:d,taxConfig:c,translations:i,showConfigurableOptions:m})=>{var S,C,N,x,Q,_,H,V,$,M;const{taxExcluded:h,taxIncluded:s}=c,a=A((y,F,G)=>r(W,{amount:y,currency:F,weight:"normal",...G}),[]);let v={};const O=d==="cancelled",D=(C=(S=e==null?void 0:e.product)==null?void 0:S.stockStatus)==null?void 0:C.includes("IN_STOCK"),t=(e==null?void 0:e.giftCard)||{},l=(N=e==null?void 0:e.itemPrices)==null?void 0:N.priceIncludingTax,n=(x=e==null?void 0:e.itemPrices)==null?void 0:x.originalPrice,o=(Q=e==null?void 0:e.itemPrices)==null?void 0:Q.price,f=e.discounted&&((_=e.price)==null?void 0:_.value)!==(n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),w={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t&&(t!=null&&t.senderName)?{[i.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[i.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[i.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[i.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[i.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(H=e==null?void 0:e.downloadableLinks)==null?void 0:H.count} ${i.downloadableCount}`]:(V=e==null?void 0:e.downloadableLinks)==null?void 0:V.result}:{}};if(s&&h){const y=f?n==null?void 0:n.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);v={taxExcluded:!0,taxIncluded:void 0,price:a(n==null?void 0:n.value,n==null?void 0:n.currency),total:k(E,{children:[a(y,n==null?void 0:n.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==y?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==y?a(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:a((o==null?void 0:o.value)*e.totalQuantity,o==null?void 0:o.currency)}}else if(!s&&h)v={taxExcluded:void 0,taxIncluded:void 0,price:a(n==null?void 0:n.value,n==null?void 0:n.currency),total:k(E,{children:[a((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:f?"strikethrough":"default"}),f?a(($=e.price)==null?void 0:$.value,(M=e.price)==null?void 0:M.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:a((o==null?void 0:o.value)*(e==null?void 0:e.totalQuantity),o==null?void 0:o.currency)};else if(s&&!h){const y=f?n.value:l.value*e.totalQuantity;v={taxExcluded:void 0,taxIncluded:!0,price:a(l==null?void 0:l.value,l==null?void 0:l.currency),total:k(E,{children:[a(y,l==null?void 0:l.currency,{variant:f?"strikethrough":"default",weight:"bold"}),f?a(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return r(z,{loading:u,alert:O&&D?k("span",{children:[r(B,{source:T}),i.outOfStock]}):r(E,{}),configurations:(m==null?void 0:m(w))??w,title:r("div",{"data-testid":"product-name",className:q(["cart-summary-item__title",["cart-summary-item__title--strikethrough",O]]),children:e.product.name}),sku:r("div",{children:e.product.sku}),quantity:e.totalQuantity,image:r(K,{src:e.product.thumbnail.url,alt:e.product.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...v})},te=({orderData:u})=>{const[e,d]=b(!0),[c,i]=b(u),[m,h]=b({taxIncluded:!1,taxExcluded:!1});return P(()=>{I().then(s=>{s&&h(g(s==null?void 0:s.shoppingCartDisplayPrice))}).finally(()=>{d(!1)})},[]),P(()=>{const s=X.on("order/data",a=>{i(a)},{eager:!0});return()=>{s==null||s.off()}},[]),{loading:e,taxConfig:m,order:c}},ye=({className:u,orderData:e,withHeader:d,showConfigurableOptions:c})=>{const{loading:i,taxConfig:m,order:h}=te({orderData:e});return r("div",{className:q(["order-order-product-list",u]),children:r(p,{loading:i,taxConfig:m,order:h,withHeader:d,showConfigurableOptions:c})})};export{ye as OrderProductList,ye as default};
@@ -1 +1 @@
1
- import{jsxs as v,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _}from"@dropins/tools/lib.js";import{Card as U,InLineAlert as C,Icon as x,Button as V}from"@dropins/tools/components.js";import{F as L}from"../chunks/CustomerDetailsContent.js";import*as R from"@dropins/tools/preact-compat.js";import{useState as D,useCallback as O,useEffect as g,useMemo as k}from"@dropins/tools/preact-hooks.js";import{events as w}from"@dropins/tools/event-bus.js";import{Text as S,useText as H}from"@dropins/tools/i18n.js";import{g as A,a as P}from"../chunks/getCustomer.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";const X=e=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},R.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),B=({onSubmit:e,loading:t,inLineAlert:o,fieldsConfig:a})=>v(U,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(S,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(S,{id:"Order.OrderSearchForm.description"})}),o.text?s(C,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:o.type,variant:"secondary",heading:o.text,icon:s(x,{source:X})}):null,s(L,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:a,onSubmit:e,children:s("div",{className:"order-order-search-form__button-container",children:s(V,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:s(S,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});var T=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(T||{});const j=e=>{if(!e)return null;const t=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(a=>{t.has(a.name)||t.set(a.name,"false"),a.checked&&t.set(a.name,"true")}),t&&typeof t.entries=="function"){const a=t.entries();if(a&&typeof a[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(a)))||{}}return{}},p=(e,t)=>{if(typeof e!="function")return;const o=e();if(!t||Object.keys(t).length===0){window.location.href=o;return}const a=new URLSearchParams;Object.entries(t).forEach(([u,d])=>{a.append(u,String(d))});const c=o.includes("?")?"&":"?";window.location.href=`${o}${c}${a.toString()}`},I=e=>{try{return new URL(window.location.href).searchParams.get(e)}catch{return null}},q=({onError:e,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c})=>{const[u,d]=D({text:"",type:"success"}),[E,h]=D(!1),f=H({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),b=O(async r=>{const n=I("orderRef"),l=n&&n.length>20;if(!r&&!n||!(r!=null&&r.number)&&!(r!=null&&r.token)&&!n)return null;if(t){const m=await A();(m==null?void 0:m.email)===r.email?p(a,{orderRef:r==null?void 0:r.number}):l||p(c,{orderRef:r.token})}else l||p(c,{orderRef:r==null?void 0:r.token})},[t,a,c]);g(()=>{const r=w.on("order/data",n=>{b(n)},{eager:!0});return()=>{r==null||r.off()}},[b]),g(()=>{const r=I("orderRef"),n=r&&r.length>20?r:null;r&&(n?p(c,{orderRef:r}):t?p(a,{orderRef:r}):o==null||o({render:!0,formValues:{number:r}}))},[t,a,c,o]);const M=k(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:f.email,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:f.postcode,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:f.number,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[f]);return{onSubmit:O(async(r,n)=>{if(!n)return null;h(!0);const l=j(r.target);await P(l).then(i=>{i||d({text:f.invalidSearch,type:"warning"}),w.emit("order/data",i)}).catch(async i=>{var N;let m=!0;e==null||e({error:i.message});const y=t?await A():{email:""};(y==null?void 0:y.email)===(l==null?void 0:l.email)?(m=!1,p(a,{orderRef:l.number})):m=o==null?void 0:o({render:(N=i==null?void 0:i.message)==null?void 0:N.includes("Please login to view the order."),formValues:l}),m&&d({text:i.message,type:"warning"})}).finally(()=>{h(!1)})},[t,e,o,a,f.invalidSearch]),inLineAlert:u,loading:E,normalizeFieldsConfig:M}},oe=({className:e,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c,onError:u})=>{const{onSubmit:d,loading:E,inLineAlert:h,normalizeFieldsConfig:f}=q({onError:u,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c});return s("div",{className:_(["order-order-search",e]),children:s(B,{onSubmit:d,loading:E,inLineAlert:h,fieldsConfig:f})})};export{oe as OrderSearch,oe as default};
1
+ import{jsxs as v,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _}from"@dropins/tools/lib.js";import{Card as U,InLineAlert as C,Icon as x,Button as V}from"@dropins/tools/components.js";import{F as L}from"../chunks/OrderCancelReasonsForm.js";import*as R from"@dropins/tools/preact-compat.js";import{useState as D,useCallback as O,useEffect as g,useMemo as k}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as w}from"@dropins/tools/event-bus.js";import{Text as S,useText as H}from"@dropins/tools/i18n.js";import{g as A,a as P}from"../chunks/getCustomer.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/customerAddressFragment.graphql.js";const X=e=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},R.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),B=({onSubmit:e,loading:t,inLineAlert:o,fieldsConfig:a})=>v(U,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(S,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(S,{id:"Order.OrderSearchForm.description"})}),o.text?s(C,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:o.type,variant:"secondary",heading:o.text,icon:s(x,{source:X})}):null,s(L,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:a,onSubmit:e,children:s("div",{className:"order-order-search-form__button-container",children:s(V,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:s(S,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});var T=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(T||{});const j=e=>{if(!e)return null;const t=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(a=>{t.has(a.name)||t.set(a.name,"false"),a.checked&&t.set(a.name,"true")}),t&&typeof t.entries=="function"){const a=t.entries();if(a&&typeof a[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(a)))||{}}return{}},p=(e,t)=>{if(typeof e!="function")return;const o=e();if(!t||Object.keys(t).length===0){window.location.href=o;return}const a=new URLSearchParams;Object.entries(t).forEach(([u,d])=>{a.append(u,String(d))});const c=o.includes("?")?"&":"?";window.location.href=`${o}${c}${a.toString()}`},I=e=>{try{return new URL(window.location.href).searchParams.get(e)}catch{return null}},q=({onError:e,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c})=>{const[u,d]=D({text:"",type:"success"}),[E,h]=D(!1),m=H({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),b=O(async r=>{const n=I("orderRef"),i=n&&n.length>20;if(!r&&!n||!(r!=null&&r.number)&&!(r!=null&&r.token)&&!n)return null;if(t){const f=await A();(f==null?void 0:f.email)===r.email?p(a,{orderRef:r==null?void 0:r.number}):i||p(c,{orderRef:r.token})}else i||p(c,{orderRef:r==null?void 0:r.token})},[t,a,c]);g(()=>{const r=w.on("order/data",n=>{b(n)},{eager:!0});return()=>{r==null||r.off()}},[b]),g(()=>{const r=I("orderRef"),n=r&&r.length>20?r:null;r&&(n?p(c,{orderRef:r}):t?p(a,{orderRef:r}):o==null||o({render:!0,formValues:{number:r}}))},[t,a,c,o]);const M=k(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.postcode,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[m]);return{onSubmit:O(async(r,n)=>{if(!n)return null;h(!0);const i=j(r.target);await P(i).then(l=>{l||d({text:m.invalidSearch,type:"warning"}),w.emit("order/data",l)}).catch(async l=>{var N;let f=!0;e==null||e({error:l.message});const y=t?await A():{email:""};(y==null?void 0:y.email)===(i==null?void 0:i.email)?(f=!1,p(a,{orderRef:i.number})):f=o==null?void 0:o({render:(N=l==null?void 0:l.message)==null?void 0:N.includes("Please login to view the order."),formValues:i}),f&&d({text:l.message,type:"warning"})}).finally(()=>{h(!1)})},[t,e,o,a,m.invalidSearch]),inLineAlert:u,loading:E,normalizeFieldsConfig:M}},ce=({className:e,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c,onError:u})=>{const{onSubmit:d,loading:E,inLineAlert:h,normalizeFieldsConfig:m}=q({onError:u,isAuth:t,renderSignIn:o,routeCustomerOrder:a,routeGuestOrder:c});return s("div",{className:_(["order-order-search",e]),children:s(B,{onSubmit:d,loading:E,inLineAlert:h,fieldsConfig:m})})};export{ce as OrderSearch,ce as default};
@@ -1,80 +1 @@
1
- import{jsx as r,jsxs as p,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as h,Modal as k,InLineAlert as q,Picker as G}from"@dropins/tools/components.js";import{F as V}from"../chunks/CustomerDetailsContent.js";import{Slot as D,classes as v}from"@dropins/tools/lib.js";import{useMemo as W}from"@dropins/tools/preact-compat.js";import{O as j,a as J,A as P,t as z}from"../chunks/transform-order-details.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{useState as u,useEffect as y}from"@dropins/tools/preact-hooks.js";import{g as Y}from"../chunks/getStoreConfig.js";import{events as N}from"@dropins/tools/event-bus.js";import{useText as O,Text as S}from"@dropins/tools/i18n.js";import{C as K}from"../chunks/OrderLoaders.js";import"@dropins/tools/fetch-graphql.js";const E={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"},X=({slots:t,title:d,status:n,orderData:e})=>{const s=String(n).toLocaleLowerCase(),o=O(`Order.OrderStatusContent.${E[s]}.title`),a=O(`Order.OrderStatusContent.${E[s]}.message`),i=O(`Order.OrderStatusContent.${E[s]}.messageWithoutDate`);if(!n)return r("div",{});const m=e!=null&&e.orderStatusChangeDate?a==null?void 0:a.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):i.messageWithoutDate;return p(U,{className:"order-order-status-content",variant:"secondary",children:[r(F,{title:d??o.title}),p("div",{className:"order-order-status-content__wrapper",children:[r("div",{className:"order-order-status-content__wrapper-description",children:r("p",{children:m})}),r(ne,{orderData:e,slots:t})]})]})};var f=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(f||{});const Z=`
2
- mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
3
- cancelOrder(input: { order_id: $orderId, reason: $reason }) {
4
- error
5
- order {
6
- email
7
- available_actions
8
- status
9
- number
10
- id
11
- order_date
12
- carrier
13
- shipping_method
14
- is_virtual
15
- applied_coupons {
16
- code
17
- }
18
- shipments {
19
- id
20
- number
21
- tracking {
22
- title
23
- number
24
- carrier
25
- }
26
- comments {
27
- message
28
- timestamp
29
- }
30
- items {
31
- id
32
- product_sku
33
- product_name
34
- order_item {
35
- ...OrderItems
36
- ... on GiftCardOrderItem {
37
- gift_card {
38
- recipient_name
39
- recipient_email
40
- sender_name
41
- sender_email
42
- message
43
- }
44
- }
45
- }
46
- }
47
- }
48
- payment_methods {
49
- name
50
- type
51
- }
52
- shipping_address {
53
- ...AddressesList
54
- }
55
- billing_address {
56
- ...AddressesList
57
- }
58
- items {
59
- ...OrderItems
60
- ... on GiftCardOrderItem {
61
- __typename
62
- gift_card {
63
- recipient_name
64
- recipient_email
65
- sender_name
66
- sender_email
67
- message
68
- }
69
- }
70
- }
71
- total {
72
- ...OrderSummary
73
- }
74
- }
75
- }
76
- }
77
- ${j}
78
- ${J}
79
- ${P}
80
- `,ee=async(t,d,n,e)=>{if(!t)throw new Error("No order ID found");if(!d)throw new Error("No reason found");return B(Z,{variables:{orderId:t,reason:d}}).then(({errors:s,data:o})=>{if(s)return Q(s);if(o.cancelOrder.error!=null){e();return}const a=z(o.cancelOrder.order);n(a)})},re=()=>{const[t,d]=u(null);return y(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?d(e):Y().then(s=>{s&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(s)),d(s))})},[]),t},te=({cancelButtonProps:t,modalProps:d,pickerProps:n,submitButtonProps:e,orderId:s})=>{const o=O({buttonText:"Order.OrderCancel.buttonText",ErrorHeading:"Order.OrderCancellationReasonsModal.errorHeading",ErrorDescription:"Order.OrderCancellationReasonsModal.errorDescription",orderCancellationLabel:"Order.OrderCancellationReasonsModal.label"}),[a,i]=u(!1),[m,g]=u(0),[C,M]=u(!1),[I,T]=u(!1),w=()=>{i(!0)},L=()=>{i(!1)},x=c=>{c.preventDefault();const l=Number(c.target.value);g(l)},R=re(),_=(R==null?void 0:R.orderCancellationReasons)??[];N.on("authenticated",c=>{c&&T(!0)},{eager:!0});const b=c=>c.map((l,H)=>({text:l==null?void 0:l.description,value:H.toString()})),$=async c=>(c.preventDefault(),ee(s,_[m].description,l=>{i(!1),I||(l.status="guest order cancellation requested"),N.emit("order/data",l)},()=>{M(!0)}));return p(A,{children:[r(h,{onClick:w,type:"button",variant:"secondary",...t,children:o.buttonText}),a&&p(k,{size:"medium",onClose:L,className:"order-order-cancel__modal",title:r("h2",{className:"order-order-cancel__title",children:r(S,{id:"Order.OrderCancellationReasonsModal.title"})}),"data-testid":"order-cancellation-reasons-modal",...d,children:[C&&r(q,{heading:o.ErrorHeading,description:o.ErrorDescription}),p(V,{onSubmit:$,children:[r("div",{className:"order-order-cancel__text",children:r(S,{id:"Order.OrderCancellationReasonsModal.description"})}),r(G,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:b(_)[0],variant:"primary",options:b(_),value:String(m),handleSelect:x,required:!0,"data-testid":"order-cancellation-reasons-selector",...n}),r("div",{className:"order-order-cancel__button-container",children:r(h,{variant:"primary",...e,children:r(S,{id:"Order.OrderCancellationReasonsModal.button"})})})]})]})]})},ne=({className:t,children:d,orderData:n,slots:e,...s})=>{const o=O({cancel:"Order.OrderStatusContent.actions.cancel",return:"Order.OrderStatusContent.actions.return",reorder:"Order.OrderStatusContent.actions.reorder"}),a=W(()=>{const i=n==null?void 0:n.availableActions,m=!!(i!=null&&i.length);return r(A,{children:e!=null&&e.OrderActions?r(D,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:e==null?void 0:e.OrderActions,context:n}):r("div",{"data-testid":"availableActionsList",className:v(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!m]]),children:i==null?void 0:i.map((g,C)=>{switch(g){case f.CANCEL:return r(te,{orderId:atob(n.id)});case f.RETURN:return r(h,{variant:"secondary",children:o.return},C);case f.REORDER:return r(h,{variant:"secondary",children:o.reorder},C)}})})})},[n,e==null?void 0:e.OrderActions,o]);return r("div",{...s,className:v(["order-order-actions",t]),children:a})},oe=({orderData:t})=>{const[d,n]=u(t),[e,s]=u(t==null?void 0:t.status);return y(()=>{const o=N.on("order/data",a=>{n(a),s(a.status)},{eager:!0});return()=>{o==null||o.off()}},[]),{orderStatus:e,order:d}},ge=({slots:t,orderData:d,className:n,statusTitle:e,status:s})=>{const{orderStatus:o,order:a}=oe({orderData:d});return r("div",{className:v(["order-order-status",n]),children:a?r(X,{title:e,status:s||o,slots:t,orderData:a}):r(K,{withCard:!1})})};export{ge as OrderStatus,ge as default};
1
+ import{jsx as t,jsxs as C,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{Card as g,Header as f,Button as p}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import{Slot as E,classes as O}from"@dropins/tools/lib.js";import{useMemo as v}from"@dropins/tools/preact-compat.js";import{useText as i}from"@dropins/tools/i18n.js";import{useState as h,useEffect as N}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as w}from"@dropins/tools/event-bus.js";import{C as y}from"../chunks/OrderLoaders.js";const l={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"},A=({slots:r,title:a,status:n,orderData:e})=>{const o=String(n).toLocaleLowerCase(),s=i(`Order.OrderStatusContent.${l[o]}.title`),d=i(`Order.OrderStatusContent.${l[o]}.message`),c=i(`Order.OrderStatusContent.${l[o]}.messageWithoutDate`);if(!n)return t("div",{});const m=e!=null&&e.orderStatusChangeDate?d==null?void 0:d.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):c.messageWithoutDate;return C(g,{className:"order-order-status-content",variant:"secondary",children:[t(f,{title:a??s.title}),C("div",{className:"order-order-status-content__wrapper",children:[t("div",{className:"order-order-status-content__wrapper-description",children:t("p",{children:m})}),t(_,{orderData:e,slots:r})]})]})};var u=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(u||{});const _=({className:r,children:a,orderData:n,slots:e,...o})=>{const s=i({cancel:"Order.OrderStatusContent.actions.cancel",return:"Order.OrderStatusContent.actions.return",reorder:"Order.OrderStatusContent.actions.reorder"}),d=v(()=>{const c=n==null?void 0:n.availableActions,m=!!(c!=null&&c.length);return t(R,{children:e!=null&&e.OrderActions?t(E,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:e==null?void 0:e.OrderActions,context:n}):t("div",{"data-testid":"availableActionsList",className:O(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!m]]),children:c==null?void 0:c.map(S=>{switch(S){case u.CANCEL:return t(p,{variant:"secondary",children:s.cancel});case u.RETURN:return t(p,{variant:"secondary",children:s.return});case u.REORDER:return t(p,{variant:"secondary",children:s.reorder})}})})})},[n,e==null?void 0:e.OrderActions,s]);return t("div",{...o,className:O(["order-order-actions",r]),children:d})},T=({orderData:r})=>{const[a,n]=h(r),[e,o]=h(r==null?void 0:r.status);return N(()=>{const s=w.on("order/data",d=>{n(d),o(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:a}},B=({slots:r,orderData:a,className:n,statusTitle:e,status:o})=>{const{orderStatus:s,order:d}=T({orderData:a});return t("div",{className:O(["order-order-status",n]),children:d?t(A,{title:e,status:o||s,slots:r,orderData:d}):t(y,{withCard:!1})})};export{B as OrderStatus,B as default};
@@ -0,0 +1,5 @@
1
+ import { ReturnsListProps } from '../../types';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+
4
+ export declare const ReturnsList: Container<ReturnsListProps>;
5
+ //# sourceMappingURL=ReturnsList.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from '.';
2
+ export { ReturnsList as default } from './ReturnsList';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ReturnsList/index'
2
+ import _default from './ReturnsList/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as M,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{IllustratedMessage as J,Icon as V,Card as B,ContentGrid as Q,Image as X,Header as Y,Pagination as D}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import{classes as I,Slot as P,debounce as e1}from"@dropins/tools/lib.js";import{C as r1}from"../chunks/OrderLoaders.js";import*as g from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import{useMemo as $,useState as w,useEffect as j,useCallback as U}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as n1}from"../chunks/getCustomerOrdersReturn.js";import{useText as i1}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";const z=e=>g.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},g.createElement("g",{id:"Large"},g.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),g.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},g.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),s1=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),F=({typeList:e,isEmpty:t,minifiedView:a,message:L})=>{const d=t1(()=>{switch(e){case"orders":return{icon:s1,text:r("p",{children:L}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[e,L]);return!t||!e||!d.text?null:r(J,{className:I(["order-empty-list",d.className,a?"order-empty-list--minified":""]),message:d.text,icon:r(V,{source:d.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},a1=({slots:e,pageInfo:t,withReturnsListButton:a=!0,isMobile:L=!1,returnsInMinifiedView:d=1,translations:n={},returnOrderList:c=[],minifiedView:m=!1,withHeader:C=!0,withThumbnails:s=!0,selectedPage:N=1,handleSetSelectPage:b,routeReturnDetails:u,routeOrderDetails:Z,routeTracking:p,routeReturnsList:f,routeProductDetails:h})=>{const x=m?d:c.length,l=h!=null&&h()?"a":"span",_=$(()=>c.slice(0,x).map((i,K)=>{var O,S;return r(B,{variant:"secondary",className:"order-returns-list-content__cards-list",children:M("div",{className:"order-returns-list-content__cards-grid",children:[M("div",{className:"order-returns-list-content__descriptions",children:[r("p",{children:"TBD"}),M("p",{children:[n.orderNumber," ",r("a",{href:(Z==null?void 0:Z(i.orderNumber))??"#",target:"_blank",rel:"noreferrer",children:i.orderNumber})]}),(O=i==null?void 0:i.tracking)==null?void 0:O.map((o,E)=>{var v,y;return M("p",{children:[`${n.carrier} ${(y=(v=o==null?void 0:o.carrier)==null?void 0:v.label)==null?void 0:y.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(o))||"#"}`,target:"_blank",rel:"noreferrer",children:o.trackingNumber})]},`${o.trackingNumber}_${E}`)}),e!=null&&e.ReturnItemsDetails?r(P,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:i.items}}):i.items.length?M("p",{children:[i.items.length," ",n.itemsText]}):null]}),s?r(Q,{maxColumns:L?3:9,emptyGridContent:r(H,{}),className:I(["order-returns-list-content__images",["order-returns-list-content__images-3",L]]),children:(S=i==null?void 0:i.items)==null?void 0:S.map((o,E)=>{var A,R;const v=o.orderItem,y=(A=v.thumbnail)==null?void 0:A.label,q=(R=v.thumbnail)==null?void 0:R.url;return r(l,{href:(h==null?void 0:h(o.orderItem))??"#",children:r(X,{alt:y,src:q,width:85,height:114})},E+o.uid)})}):null,e!=null&&e.DetailsActionParams?r(P,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:e==null?void 0:e.DetailsActionParams,context:{returnOrderItem:i}}):r("a",{href:(u==null?void 0:u({token:i.token,orderNumber:i.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:z,...T})})]})},K)}),[c,x,n,e,s,L,Z,u,p,h,l]),W=$(()=>M(H,{children:[C?r(Y,{title:n.minifiedViewTitle,divider:!1}):null,_,r(F,{minifiedView:m,typeList:"orders",isEmpty:!c.length,message:n.emptyOrdersListMessage}),a?r("a",{className:"order-returns-list-content__actions",href:(f==null?void 0:f())??"#",children:r(B,{variant:"secondary",className:"order-returns-list-content__card",children:M("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:n.viewAllOrdersButton}),r(V,{source:z,...T})]})})}):null]}),[f,a,C,n,_,m,c.length]),k=$(()=>M(H,{children:[r(F,{minifiedView:m,typeList:"orders",isEmpty:!c.length,message:n.emptyOrdersListMessage}),_,(t==null?void 0:t.totalPages)>1?r(D,{totalPages:t==null?void 0:t.totalPages,currentPage:N,onChange:b}):null]}),[_,m,c,n,t,N,b]);return r("div",{className:"order-returns-list-content",children:m?W:k})},G={totalPages:1,currentPage:1,pageSize:1},L1=()=>{const[e,t]=w(!0),[a,L]=w([]),[d,n]=w(G),[c,m]=w(1);j(()=>{n1().then(s=>{L((s==null?void 0:s.ordersReturn)??[]),n((s==null?void 0:s.pageInfo)??G)}).finally(()=>{t(!1)})},[]);const C=U(s=>{m(s)},[]);return{pageInfo:d,selectedPage:c,loading:e,returnOrderList:a,handleSetSelectPage:C}},c1=()=>{const[e,t]=w(window.innerWidth<768),a=U(e1(()=>{t(window.innerWidth<768)},1e3),[]);return j(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[a]),e},b1=({slots:e,withReturnsListButton:t,className:a,minifiedView:L,withHeader:d,withThumbnails:n,returnsInMinifiedView:c,routeReturnDetails:m,routeOrderDetails:C,routeTracking:s,routeReturnsList:N,routeProductDetails:b})=>{const{pageInfo:u,selectedPage:Z,handleSetSelectPage:p,loading:f,returnOrderList:h}=L1(),x=c1(),l=L?"minifiedView":"fullSizeView",_=i1({viewAllOrdersButton:`Order.Returns.${l}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${l}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${l}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${l}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${l}.returnsList.orderNumber`,carrier:`Order.Returns.${l}.returnsList.carrier`,itemsText:`Order.Returns.${l}.returnsList.itemsText`});return r("div",{className:I(["order-returns-list",a]),children:f?r(r1,{withCard:!1}):r(a1,{slots:e,selectedPage:Z,handleSetSelectPage:p,pageInfo:u,withReturnsListButton:t,isMobile:x,returnOrderList:h,translations:_,withHeader:d,returnsInMinifiedView:c,withThumbnails:n,minifiedView:L,routeReturnDetails:m,routeOrderDetails:C,routeTracking:s,routeReturnsList:N,routeProductDetails:b})})};export{b1 as default};
@@ -1 +1 @@
1
- import{jsxs as h,jsx as e,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as E,classes as R}from"@dropins/tools/lib.js";import{Card as g,Header as u,Accordion as b,AccordionSection as x,ContentGrid as U,Image as w}from"@dropins/tools/components.js";import"../chunks/CustomerDetailsContent.js";import{useText as Y}from"@dropins/tools/i18n.js";import{C as $}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";import{useState as j,useEffect as F}from"@dropins/tools/preact-hooks.js";import{events as q}from"@dropins/tools/event-bus.js";var m=(i=>(i.PENDING="pending",i.SHIPPING="shipping",i.COMPLETE="complete",i.PROCESSING="processing",i.HOLD="on hold",i.CANCELED="Canceled",i.SUSPECTED_FRAUD="suspected fraud",i.PAYMENT_REVIEW="payment review",i))(m||{});const V=({slots:i,orderData:n,collapseThreshold:d=0})=>{var C,f,T,S,I;const t=Y({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",notYetShippedImagesTitle:"Order.ShippingStatusCard.notYetShippedImagesTitle",noInfoTitle:"Order.OrderStatusContent.noInfoTitle"}),l=(C=n==null?void 0:n.status)==null?void 0:C.toLocaleLowerCase(),G=((f=n==null?void 0:n.shipments)==null?void 0:f.length)===1&&(l==null?void 0:l.includes(m.COMPLETE)),s=(T=n==null?void 0:n.items)==null?void 0:T.filter(c=>(c==null?void 0:c.quantityShipped)===0);return!n||l!=null&&l.includes(m.CANCELED)?null:(S=n==null?void 0:n.shipments)!=null&&S.length?h(A,{children:[(I=n==null?void 0:n.shipments)==null?void 0:I.map(({tracking:c,items:r,id:a},H)=>h(g,{variant:"secondary",className:"order-shipping-status-card",children:[e(u,{title:t.shippingCardTitle}),c==null?void 0:c.map(p=>{var o;return h("div",{className:"order-shipping-status-card__header",role:"status",children:[h("div",{className:"order-shipping-status-card__header--content",children:[h("p",{children:[t.carrier," ",(o=p==null?void 0:p.carrier)==null?void 0:o.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),e("p",{children:p==null?void 0:p.title})]}),i!=null&&i.DeliveryTrackActions?e(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:i==null?void 0:i.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),G?null:e(b,{actionIconPosition:"right","data-testid":"dropinAccordion",children:e(x,{"data-position":H+1,defaultOpen:d>=(r==null?void 0:r.length),title:`Package contents (${r==null?void 0:r.length} items)`,children:e(U,{maxColumns:6,emptyGridContent:e(A,{}),className:"order-shipping-status-card__images",children:r==null?void 0:r.map(p=>{var v,O,y,_,L,N;const o=(y=(O=(v=p==null?void 0:p.orderItem)==null?void 0:v.product)==null?void 0:O.thumbnail)==null?void 0:y.label,M=(N=(L=(_=p==null?void 0:p.orderItem)==null?void 0:_.product)==null?void 0:L.thumbnail)==null?void 0:N.url;return e(w,{alt:o,src:M,width:85,height:114},p.id)})})})}),i!=null&&i.DeliveryTimeLine?e(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:i==null?void 0:i.DeliveryTimeLine,context:{}}):null]},a)),s!=null&&s.length?h(g,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[e(u,{title:t.notYetShippedTitle}),e(b,{actionIconPosition:"right",children:e(x,{title:`${t.notYetShippedImagesTitle} ${s==null?void 0:s.length}`,children:e("div",{className:"order-shipping-status-card__images",children:s==null?void 0:s.map(({id:c,thumbnail:{url:r,label:a}})=>e(w,{alt:a,src:r,width:85,height:114},c))})})})]}):null]}):h(g,{variant:"secondary",className:"order-shipping-status-card",children:[e(u,{title:t.shippingInfoTitle}),e("div",{className:"order-shipping-status-card__header",children:h("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?e("p",{children:n==null?void 0:n.carrier}):null,e("p",{children:t.noInfoTitle})]})})]})},W=({orderData:i})=>{const[n,d]=j(i);return F(()=>{const t=q.on("order/data",l=>{d(l)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:n}},ii=({slots:i,className:n,collapseThreshold:d,orderData:t})=>{const{order:l}=W({orderData:t});return e("div",{className:R(["order-shipping-status",n]),children:l?e(V,{slots:i,orderData:l,collapseThreshold:d}):e($,{withCard:!1})})};export{ii as ShippingStatus,ii as default};
1
+ import{jsxs as h,jsx as e,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as E,classes as R}from"@dropins/tools/lib.js";import{Card as g,Header as u,Accordion as b,AccordionSection as x,ContentGrid as U,Image as w}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import{useText as Y}from"@dropins/tools/i18n.js";import{C as $}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";import{useState as j,useEffect as F}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as q}from"@dropins/tools/event-bus.js";var m=(i=>(i.PENDING="pending",i.SHIPPING="shipping",i.COMPLETE="complete",i.PROCESSING="processing",i.HOLD="on hold",i.CANCELED="Canceled",i.SUSPECTED_FRAUD="suspected fraud",i.PAYMENT_REVIEW="payment review",i))(m||{});const V=({slots:i,orderData:n,collapseThreshold:d=0})=>{var C,f,T,S,I;const t=Y({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",notYetShippedImagesTitle:"Order.ShippingStatusCard.notYetShippedImagesTitle",noInfoTitle:"Order.OrderStatusContent.noInfoTitle"}),l=(C=n==null?void 0:n.status)==null?void 0:C.toLocaleLowerCase(),G=((f=n==null?void 0:n.shipments)==null?void 0:f.length)===1&&(l==null?void 0:l.includes(m.COMPLETE)),s=(T=n==null?void 0:n.items)==null?void 0:T.filter(c=>(c==null?void 0:c.quantityShipped)===0);return!n||l!=null&&l.includes(m.CANCELED)?null:(S=n==null?void 0:n.shipments)!=null&&S.length?h(A,{children:[(I=n==null?void 0:n.shipments)==null?void 0:I.map(({tracking:c,items:r,id:a},H)=>h(g,{variant:"secondary",className:"order-shipping-status-card",children:[e(u,{title:t.shippingCardTitle}),c==null?void 0:c.map(p=>{var o;return h("div",{className:"order-shipping-status-card__header",role:"status",children:[h("div",{className:"order-shipping-status-card__header--content",children:[h("p",{children:[t.carrier," ",(o=p==null?void 0:p.carrier)==null?void 0:o.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),e("p",{children:p==null?void 0:p.title})]}),i!=null&&i.DeliveryTrackActions?e(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:i==null?void 0:i.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),G?null:e(b,{actionIconPosition:"right","data-testid":"dropinAccordion",children:e(x,{"data-position":H+1,defaultOpen:d>=(r==null?void 0:r.length),title:`Package contents (${r==null?void 0:r.length} items)`,children:e(U,{maxColumns:6,emptyGridContent:e(A,{}),className:"order-shipping-status-card__images",children:r==null?void 0:r.map(p=>{var v,O,y,_,L,N;const o=(y=(O=(v=p==null?void 0:p.orderItem)==null?void 0:v.product)==null?void 0:O.thumbnail)==null?void 0:y.label,M=(N=(L=(_=p==null?void 0:p.orderItem)==null?void 0:_.product)==null?void 0:L.thumbnail)==null?void 0:N.url;return e(w,{alt:o,src:M,width:85,height:114},p.id)})})})}),i!=null&&i.DeliveryTimeLine?e(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:i==null?void 0:i.DeliveryTimeLine,context:{}}):null]},a)),s!=null&&s.length?h(g,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[e(u,{title:t.notYetShippedTitle}),e(b,{actionIconPosition:"right",children:e(x,{title:`${t.notYetShippedImagesTitle} ${s==null?void 0:s.length}`,children:e("div",{className:"order-shipping-status-card__images",children:s==null?void 0:s.map(({id:c,thumbnail:{url:r,label:a}})=>e(w,{alt:a,src:r,width:85,height:114},c))})})})]}):null]}):h(g,{variant:"secondary",className:"order-shipping-status-card",children:[e(u,{title:t.shippingInfoTitle}),e("div",{className:"order-shipping-status-card__header",children:h("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?e("p",{children:n==null?void 0:n.carrier}):null,e("p",{children:t.noInfoTitle})]})})]})},W=({orderData:i})=>{const[n,d]=j(i);return F(()=>{const t=q.on("order/data",l=>{d(l)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:n}},ni=({slots:i,className:n,collapseThreshold:d,orderData:t})=>{const{order:l}=W({orderData:t});return e("div",{className:R(["order-shipping-status",n]),children:l?e(V,{slots:i,orderData:l,collapseThreshold:d}):e($,{withCard:!1})})};export{ni as ShippingStatus,ni as default};
@@ -2,4 +2,8 @@ export * from './OrderSearch';
2
2
  export * from './OrderStatus';
3
3
  export * from './ShippingStatus';
4
4
  export * from './CustomerDetails';
5
+ export * from './ReturnsList';
6
+ export * from './OrderProductList';
7
+ export * from './OrderCostSummary';
8
+ export * from './OrderCancel';
5
9
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { OrderItemModel } from './order-details';
2
+
3
+ export interface OrdersReturnItemsProps {
4
+ orderItem: OrderItemModel;
5
+ quantity: number;
6
+ requestQuantity: number;
7
+ status: string;
8
+ uid: string;
9
+ }
10
+ export interface OrdersReturnTrackingProps {
11
+ status: {
12
+ text: string;
13
+ type: string;
14
+ };
15
+ carrier: {
16
+ uid: string;
17
+ label: string;
18
+ };
19
+ trackingNumber: string;
20
+ }
21
+ export interface OrdersReturnProps {
22
+ token: string;
23
+ orderNumber: string;
24
+ tracking: OrdersReturnTrackingProps[];
25
+ items: OrdersReturnItemsProps[];
26
+ }
27
+ export interface PageInfoProps {
28
+ pageSize: number;
29
+ totalPages: number;
30
+ currentPage: number;
31
+ }
32
+ export interface CustomerOrdersReturnModel {
33
+ ordersReturn: OrdersReturnProps[];
34
+ pageInfo: PageInfoProps;
35
+ }
36
+ //# sourceMappingURL=customer-orders-return.d.ts.map
@@ -2,4 +2,6 @@ export * from './order-details';
2
2
  export * from './attributes-form';
3
3
  export * from './store-config';
4
4
  export * from './customer';
5
+ export * from './store-config';
6
+ export * from './customer-orders-return';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -18,6 +18,7 @@ export type OrderAddressModel = {
18
18
  }[];
19
19
  } | null;
20
20
  export type OrderItemProductModel = {
21
+ stockStatus?: string;
21
22
  canonicalUrl?: string;
22
23
  id: string;
23
24
  image?: string;
@@ -31,27 +32,51 @@ export type OrderItemProductModel = {
31
32
  };
32
33
  };
33
34
  export type OrderItemModel = {
34
- type: string;
35
- discounted: boolean;
35
+ type?: string;
36
+ discounted?: boolean;
36
37
  id: string;
37
- productName: string;
38
- regularPrice: MoneyProps;
39
- price: MoneyProps;
40
- product: OrderItemProductModel;
38
+ productName?: string;
39
+ regularPrice?: MoneyProps;
40
+ price?: MoneyProps;
41
+ product?: OrderItemProductModel;
41
42
  selectedOptions?: Array<{
42
43
  label: string;
43
44
  value: any;
44
45
  }>;
45
- totalQuantity: number;
46
- thumbnail: {
46
+ totalQuantity?: number;
47
+ thumbnail?: {
47
48
  label: string;
48
49
  url: string;
49
50
  };
51
+ downloadableLinks: {
52
+ count: number;
53
+ result: string;
54
+ };
55
+ itemPrices: {
56
+ priceIncludingTax: MoneyProps;
57
+ originalPrice: MoneyProps;
58
+ originalPriceIncludingTax: MoneyProps;
59
+ price: MoneyProps;
60
+ discounts: [
61
+ {
62
+ label: string;
63
+ amount: {
64
+ value: number;
65
+ };
66
+ }
67
+ ];
68
+ };
69
+ bundleOptions: Record<string, string> | null;
70
+ totalInclTax: MoneyProps;
71
+ priceInclTax: MoneyProps;
72
+ total: MoneyProps;
73
+ configurableOptions: Record<string, string | number | boolean> | undefined;
50
74
  giftCard?: {
51
75
  senderName: string;
52
76
  senderEmail: string;
53
77
  recipientEmail: string;
54
78
  recipientName: string;
79
+ message: string;
55
80
  };
56
81
  quantityCanceled: number;
57
82
  quantityInvoiced: number;
@@ -92,6 +117,10 @@ export type OrderDataModel = {
92
117
  totalQuantity: number;
93
118
  shippingMethod?: string;
94
119
  carrier?: string;
120
+ discounts: {
121
+ amount: MoneyProps;
122
+ label: string;
123
+ }[];
95
124
  coupons: {
96
125
  code: string;
97
126
  }[];
@@ -106,12 +135,19 @@ export type OrderDataModel = {
106
135
  };
107
136
  shipments: ShipmentsModel[];
108
137
  items: OrderItemModel[];
138
+ totalGiftcard: MoneyProps;
109
139
  grandTotal: MoneyProps;
140
+ totalShipping?: MoneyProps;
110
141
  subtotal: MoneyProps;
111
142
  totalTax: MoneyProps;
112
143
  shippingAddress: OrderAddressModel;
113
144
  billingAddress: OrderAddressModel;
114
145
  availableActions: AvailableActionsProps[];
146
+ taxes: {
147
+ amount: MoneyProps;
148
+ rate: number;
149
+ title: string;
150
+ }[];
115
151
  };
116
152
  export type TransformedData<T extends QueryType> = T extends 'orderData' ? OrderDataModel : null;
117
153
  //# sourceMappingURL=order-details.d.ts.map
@@ -1,6 +1,13 @@
1
1
  export interface StoreConfigModel {
2
2
  orderCancellationEnabled: boolean;
3
3
  orderCancellationReasons: OrderCancellationReason[];
4
+ shoppingCartDisplayPrice: 1 | 2 | 3;
5
+ shoppingOrdersDisplayShipping: 1 | 2 | 3;
6
+ shoppingOrdersDisplaySubtotal: 1 | 2 | 3;
7
+ shoppingOrdersDisplayTaxGiftWrapping: string;
8
+ shoppingOrdersDisplayFullSummary: boolean;
9
+ shoppingOrdersDisplayGrandTotal: boolean;
10
+ shoppingOrdersDisplayZeroTax: boolean;
4
11
  }
5
12
  export interface OrderCancellationReason {
6
13
  description: string;
@@ -3,4 +3,6 @@ export * from './transform-guest-order';
3
3
  export * from './transform-attributes-form';
4
4
  export * from './transform-store-config';
5
5
  export * from './transform-customer';
6
+ export * from './transform-store-config';
7
+ export * from './transform-customer-orders-return';
6
8
  //# sourceMappingURL=index.d.ts.map