@dropins/storefront-order 1.0.4 → 1.0.5-beta2

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 (34) hide show
  1. package/api/fragments.d.ts +1 -0
  2. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
  3. package/api/graphql/GiftFragment.graphql.d.ts +5 -0
  4. package/api/graphql/OrderItemsFragment.graphql.d.ts +3 -3
  5. package/api/graphql/OrderSummaryFragment.graphql.d.ts +1 -1
  6. package/api.js +20 -6
  7. package/chunks/CartSummaryItem.js +1 -1
  8. package/chunks/getStoreConfig.js +4 -2
  9. package/chunks/initialize.js +44 -17
  10. package/components/OrderCostSummaryContent/Blocks/Discounts.d.ts +9 -0
  11. package/components/OrderCostSummaryContent/Blocks/GiftCards.d.ts +8 -0
  12. package/components/OrderCostSummaryContent/Blocks/GiftWrapping.d.ts +11 -0
  13. package/components/OrderCostSummaryContent/Blocks/PrintedCard.d.ts +11 -0
  14. package/components/OrderCostSummaryContent/Blocks/Shipping.d.ts +12 -0
  15. package/components/OrderCostSummaryContent/Blocks/Subtotal.d.ts +13 -0
  16. package/components/OrderCostSummaryContent/Blocks/Tax.d.ts +11 -0
  17. package/components/OrderCostSummaryContent/Blocks/Total.d.ts +11 -0
  18. package/components/OrderCostSummaryContent/Blocks/index.d.ts +24 -0
  19. package/configs/mock.config.d.ts +154 -3
  20. package/containers/OrderCostSummary.js +1 -1
  21. package/containers/OrderProductList.js +1 -1
  22. package/data/models/order-details.d.ts +35 -1
  23. package/data/models/store-config.d.ts +2 -0
  24. package/data/transforms/transform-order-details.d.ts +7 -0
  25. package/fragments.js +108 -17
  26. package/hooks/containers/useCreateReturn.d.ts +19 -1
  27. package/i18n/en_US.json.d.ts +21 -0
  28. package/lib/categorizeProducts.d.ts +16 -0
  29. package/package.json +1 -1
  30. package/render.js +2 -2
  31. package/types/api/getOrderDetails.types.d.ts +19 -8
  32. package/types/orderCostSummary.types.d.ts +2 -0
  33. package/types/orderProductList.types.d.ts +8 -1
  34. package/components/OrderCostSummaryContent/Blocks.d.ts +0 -39
@@ -13,6 +13,58 @@
13
13
  * is strictly forbidden unless prior written permission is obtained
14
14
  * from Adobe.
15
15
  *******************************************************************/
16
+ export declare const totalGiftOptions: {
17
+ giftWrappingForItems: {
18
+ value: number;
19
+ currency: string;
20
+ };
21
+ giftWrappingForItemsInclTax: {
22
+ value: number;
23
+ currency: string;
24
+ };
25
+ giftWrappingForOrder: {
26
+ value: number;
27
+ currency: string;
28
+ };
29
+ giftWrappingForOrderInclTax: {
30
+ value: number;
31
+ currency: string;
32
+ };
33
+ printedCard: {
34
+ value: number;
35
+ currency: string;
36
+ };
37
+ printedCardInclTax: {
38
+ value: number;
39
+ currency: string;
40
+ };
41
+ };
42
+ export declare const gift_options: {
43
+ gift_wrapping_for_items: {
44
+ currency: string;
45
+ value: number;
46
+ };
47
+ gift_wrapping_for_items_incl_tax: {
48
+ currency: string;
49
+ value: number;
50
+ };
51
+ gift_wrapping_for_order: {
52
+ currency: string;
53
+ value: number;
54
+ };
55
+ gift_wrapping_for_order_incl_tax: {
56
+ currency: string;
57
+ value: number;
58
+ };
59
+ printed_card: {
60
+ currency: string;
61
+ value: number;
62
+ };
63
+ printed_card_incl_tax: {
64
+ currency: string;
65
+ value: number;
66
+ };
67
+ };
16
68
  export declare const taxCalculations: {
17
69
  includeAndExcludeTax: {
18
70
  originalPrice: {
@@ -468,6 +520,32 @@ export declare const transformMockOrderInput: {
468
520
  gift_card?: undefined;
469
521
  })[];
470
522
  total: {
523
+ gift_options: {
524
+ gift_wrapping_for_items: {
525
+ currency: string;
526
+ value: number;
527
+ };
528
+ gift_wrapping_for_items_incl_tax: {
529
+ currency: string;
530
+ value: number;
531
+ };
532
+ gift_wrapping_for_order: {
533
+ currency: string;
534
+ value: number;
535
+ };
536
+ gift_wrapping_for_order_incl_tax: {
537
+ currency: string;
538
+ value: number;
539
+ };
540
+ printed_card: {
541
+ currency: string;
542
+ value: number;
543
+ };
544
+ printed_card_incl_tax: {
545
+ currency: string;
546
+ value: number;
547
+ };
548
+ };
471
549
  grand_total: {
472
550
  value: number;
473
551
  currency: string;
@@ -1192,6 +1270,13 @@ export declare const orderCostSummaryMockup: {
1192
1270
  totalQuantity: number;
1193
1271
  shippingMethod: string;
1194
1272
  carrier: string;
1273
+ appliedGiftCards: {
1274
+ appliedBalance: {
1275
+ currency: string;
1276
+ value: number;
1277
+ };
1278
+ code: string;
1279
+ }[];
1195
1280
  discounts: {
1196
1281
  amount: {
1197
1282
  value: number;
@@ -1313,7 +1398,33 @@ export declare const orderCostSummaryMockup: {
1313
1398
  quantityReturned: number;
1314
1399
  quantityShipped: number;
1315
1400
  }[];
1316
- totalGiftcard: {
1401
+ totalGiftOptions: {
1402
+ giftWrappingForItems: {
1403
+ value: number;
1404
+ currency: string;
1405
+ };
1406
+ giftWrappingForItemsInclTax: {
1407
+ value: number;
1408
+ currency: string;
1409
+ };
1410
+ giftWrappingForOrder: {
1411
+ value: number;
1412
+ currency: string;
1413
+ };
1414
+ giftWrappingForOrderInclTax: {
1415
+ value: number;
1416
+ currency: string;
1417
+ };
1418
+ printedCard: {
1419
+ value: number;
1420
+ currency: string;
1421
+ };
1422
+ printedCardInclTax: {
1423
+ value: number;
1424
+ currency: string;
1425
+ };
1426
+ };
1427
+ totalGiftCard: {
1317
1428
  value: number;
1318
1429
  currency: string;
1319
1430
  };
@@ -1986,7 +2097,7 @@ export declare const createReturnOrderMock: {
1986
2097
  value: number;
1987
2098
  currency: string;
1988
2099
  };
1989
- totalGiftcard: {
2100
+ totalGiftCard: {
1990
2101
  currency: string;
1991
2102
  value: number;
1992
2103
  };
@@ -3887,7 +3998,7 @@ export declare const customerReturnDetailsFullMock: {
3887
3998
  value: number;
3888
3999
  currency: string;
3889
4000
  };
3890
- totalGiftcard: {
4001
+ totalGiftCard: {
3891
4002
  currency: string;
3892
4003
  value: number;
3893
4004
  };
@@ -4576,6 +4687,13 @@ export declare const placeOrderMockData: {
4576
4687
  label: string;
4577
4688
  }[];
4578
4689
  email: string;
4690
+ giftWrappingOrder: {
4691
+ price: {
4692
+ currency: string;
4693
+ value: number;
4694
+ };
4695
+ uid: string;
4696
+ };
4579
4697
  grandTotal: {
4580
4698
  currency: string;
4581
4699
  value: number;
@@ -4647,6 +4765,13 @@ export declare const placeOrderMockData: {
4647
4765
  senderEmail: string;
4648
4766
  senderName: string;
4649
4767
  };
4768
+ productGiftWrapping: {
4769
+ price: {
4770
+ currency: string;
4771
+ value: number;
4772
+ };
4773
+ uid: string;
4774
+ };
4650
4775
  id: undefined;
4651
4776
  price: {
4652
4777
  currency: undefined;
@@ -5174,5 +5299,31 @@ export declare const placeOrderMockData: {
5174
5299
  currency: string;
5175
5300
  value: number;
5176
5301
  };
5302
+ totalGiftOptions: {
5303
+ giftWrappingForItems: {
5304
+ value: number;
5305
+ currency: string;
5306
+ };
5307
+ giftWrappingForItemsInclTax: {
5308
+ value: number;
5309
+ currency: string;
5310
+ };
5311
+ giftWrappingForOrder: {
5312
+ value: number;
5313
+ currency: string;
5314
+ };
5315
+ giftWrappingForOrderInclTax: {
5316
+ value: number;
5317
+ currency: string;
5318
+ };
5319
+ printedCard: {
5320
+ value: number;
5321
+ currency: string;
5322
+ };
5323
+ printedCardInclTax: {
5324
+ value: number;
5325
+ currency: string;
5326
+ };
5327
+ };
5177
5328
  };
5178
5329
  //# sourceMappingURL=mock.config.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as c,jsxs as i,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Z}from"@dropins/tools/lib.js";import{useState as g,useEffect as V}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{Price as d,Icon as E,Accordion as f,AccordionSection as I,Card as k,Header as D}from"@dropins/tools/components.js";import{u as z}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{O as A}from"../chunks/OrderLoaders.js";import{useText as $}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const j=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),B=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),P=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"currentColor"})),W=({orderData:s,config:e})=>{const[t,n]=g(!0),[u,r]=g(s),[l,m]=g(null);return V(()=>{if(e){const{shoppingOrderDisplayPrice:o,shoppingOrdersDisplayShipping:a,shoppingOrdersDisplaySubtotal:h,...y}=e;m(p=>({...p,...y,shoppingOrderDisplayPrice:S(o),shoppingOrdersDisplayShipping:S(a),shoppingOrdersDisplaySubtotal:S(h)})),n(!1)}},[e]),V(()=>{const o=b.on("order/data",a=>{r(a)},{eager:!0});return()=>{o==null||o.off()}},[]),{loading:t,storeConfig:l,order:u}},mt=({withHeader:s,orderData:e,children:t,className:n,...u})=>{const r=z(),{loading:l,storeConfig:m,order:o}=W({orderData:e,config:r}),a=$({subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText"});return c("div",{...u,className:Z(["order-cost-summary",n]),children:c(K,{order:o,withHeader:s,loading:l,storeConfig:m,translations:a})})},q=({translations:s,order:e,subtotalInclTax:t,subtotalExclTax:n,shoppingOrdersDisplaySubtotal:u})=>{var h,y,p,x;const r=u.taxIncluded,l=u.taxExcluded,m=r&&!l?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(h=e==null?void 0:e.subtotalInclTax)==null?void 0:h.currency,amount:t})]}),c("div",{className:"order-cost-summary-content__description--subheader",children:c("span",{children:s.incl})})]}):null,o=l&&!r?i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(y=e==null?void 0:e.subtotalExclTax)==null?void 0:y.currency,amount:n})]}):null,a=l&&r?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(p=e==null?void 0:e.subtotalInclTax)==null?void 0:p.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[c(d,{currency:(x=e==null?void 0:e.subtotalExclTax)==null?void 0:x.currency,amount:n,size:"small",weight:"bold"})," ",c("span",{children:s.excl})]})]}):null;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[m,o,a]})},F=({translations:s,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var u,r,l,m;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.shipping}),(u=t==null?void 0:t.totalShipping)!=null&&u.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:s.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(v,{children:[c(d,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:(m=t==null?void 0:t.totalShipping)==null?void 0:m.value,size:"small"}),i("span",{children:[" ",s.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:s.incl}):null]})]})},U=({translations:s,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,l,m,o;const u=(r=e==null?void 0:e.discounts)==null?void 0:r.every(a=>a.amount.value===0);return!((l=e==null?void 0:e.discounts)!=null&&l.length)&&(u||!t||t<1)||(m=e==null?void 0:e.discounts)!=null&&m.length&&u?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.discount}),c("span",{children:(o=e==null?void 0:e.discounts)==null?void 0:o.map(({amount:a},h)=>{const p=((a==null?void 0:a.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:a==null?void 0:a.currency,amount:-p},`${a==null?void 0:a.value}${h}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(E,{source:P,size:"16"}),c("span",{children:s.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},G=({order:s})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=s==null?void 0:s.coupons)==null?void 0:e.map((t,n)=>c("div",{className:"order-cost-summary-content__description--header",children:c("span",{children:t.code})},`${t==null?void 0:t.code}${n}`))})},R=({translations:s,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var l,m,o;const[u,r]=g(!1);return e?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:j,iconClose:B,children:i(I,{onStateChange:r,title:s.accordionTitle,secondaryText:c(v,{children:u?null:c(d,{weight:"normal",amount:t,currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((a,h)=>{var y,p,x;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:a==null?void 0:a.title}),c("p",{children:c(d,{weight:"normal",amount:(y=a==null?void 0:a.amount)==null?void 0:y.value,currency:(p=a==null?void 0:a.amount)==null?void 0:p.currency})})]},`${(x=a==null?void 0:a.amount)==null?void 0:x.value}${h}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:s.accordionTotalTax}),c("p",{children:c(d,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.tax}),c(d,{currency:(l=n==null?void 0:n.totalTax)==null?void 0:l.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},J=({translations:s,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,u,r,l;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(u=t==null?void 0:t.grandTotal)==null?void 0:u.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:s.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((l=t==null?void 0:t.grandTotal)==null?void 0:l.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},K=({translations:s,loading:e,storeConfig:t,order:n,withHeader:u=!0})=>{var p,x,O,w,T,L,M;if(e||!n)return c(A,{});const r=((p=n==null?void 0:n.totalGiftcard)==null?void 0:p.value)??0,l=((x=n.totalGiftcard)==null?void 0:x.currency)??"",m=((O=n.subtotalInclTax)==null?void 0:O.value)??0,o=((w=n.subtotalExclTax)==null?void 0:w.value)??0,a=((T=n.totalShipping)==null?void 0:T.value)??0,h=!!((L=n==null?void 0:n.taxes)!=null&&L.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=h?(M=n==null?void 0:n.taxes)==null?void 0:M.reduce((N,C)=>{var H;return+((H=C==null?void 0:C.amount)==null?void 0:H.value)+N},0):0;return i(k,{variant:"secondary",className:Z(["order-cost-summary-content"]),children:[u?c(D,{title:s.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(q,{translations:s,order:n,subtotalInclTax:m,subtotalExclTax:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(F,{translations:s,order:n,totalShipping:a,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(U,{translations:s,order:n,totalGiftcardValue:r,totalGiftcardCurrency:l}),c(G,{order:n}),c(R,{order:n,translations:s,renderTaxAccordion:h,totalAccordionTaxValue:y}),c(J,{translations:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{mt as OrderCostSummary,mt as default};
3
+ import{jsx as e,jsxs as r,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{useState as v,useEffect as E}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as Z}from"@dropins/tools/event-bus.js";import{s as T}from"../chunks/setTaxStatus.js";import{Price as m,Icon as H,Accordion as I,AccordionSection as G,Card as W,Header as k}from"@dropins/tools/components.js";import{u as z}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as g from"@dropins/tools/preact-compat.js";import{O as D}from"../chunks/OrderLoaders.js";import{useText as F,Text as A}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const j=c=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},g.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),B=c=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},g.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),q=c=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},g.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:"currentColor"})),$=c=>g.createElement("svg",{width:24,height:16,viewBox:"0 0 24 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},g.createElement("path",{d:"M22.5364 9.8598V2.1658C22.5364 1.63583 22.099 1.20996 21.576 1.20996H2.42337C1.89083 1.20996 1.46289 1.64529 1.46289 2.1658V9.8598M22.5364 9.8598H1.46289M22.5364 9.8598V13.844C22.5364 14.3645 22.1085 14.7999 21.576 14.7999H2.42337C1.90034 14.7999 1.46289 14.374 1.46289 13.844V9.8598M3.9164 12.5191L7.5396 9.8598M7.5396 9.8598L11.1628 12.5191M7.5396 9.8598C7.5396 9.8598 6.96902 7.26674 6.40795 6.70838C5.84687 6.15002 4.93394 6.15002 4.37287 6.70838C3.81179 7.26674 3.81179 8.17526 4.37287 8.73362C4.93394 9.29198 7.5396 9.8598 7.5396 9.8598ZM7.5396 9.8598C7.5396 9.8598 10.1643 9.27305 10.7254 8.71469C11.2864 8.15633 11.2864 7.24782 10.7254 6.68946C10.1643 6.1311 9.25135 6.1311 8.69028 6.68946C8.12921 7.24782 7.5396 9.8598 7.5396 9.8598ZM7.5396 14.7904V1.20996",stroke:"currentColor",strokeLinecap:"round"})),R=({orderData:c,config:a})=>{const[t,n]=v(!0),[i,s]=v(c),[l,o]=v(null);return E(()=>{if(a){const{shoppingOrderDisplayPrice:u,shoppingOrdersDisplayShipping:d,shoppingOrdersDisplaySubtotal:p,...x}=a;o(h=>({...h,...x,shoppingOrderDisplayPrice:T(u),shoppingOrdersDisplayShipping:T(d),shoppingOrdersDisplaySubtotal:T(p),salesPrintedCard:T(a.salesPrintedCard),salesGiftWrapping:T(a.salesGiftWrapping)})),n(!1)}},[a]),E(()=>{const u=Z.on("order/data",d=>{s(d)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:t,storeConfig:l,order:i}},xt=({withHeader:c,orderData:a,children:t,className:n,...i})=>{const s=z(),{loading:l,storeConfig:o,order:u}=R({orderData:a,config:s}),d=F({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",totalFree:"Order.OrderCostSummary.totalFree",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText",printedCardTitle:"Order.OrderCostSummary.giftOptionsTax.printedCard.title",printedCardTitleInclTax:"Order.OrderCostSummary.giftOptionsTax.printedCard.inclTax",printedCardTitleExclTax:"Order.OrderCostSummary.giftOptionsTax.printedCard.exclTax",itemGiftWrappingTitle:"Order.OrderCostSummary.giftOptionsTax.itemGiftWrapping.title",itemGiftWrappingInclTax:"Order.OrderCostSummary.giftOptionsTax.itemGiftWrapping.inclTax",itemGiftWrappingExclTax:"Order.OrderCostSummary.giftOptionsTax.itemGiftWrapping.exclTax",orderGiftWrappingTitle:"Order.OrderCostSummary.giftOptionsTax.orderGiftWrapping.title",orderGiftWrappingInclTax:"Order.OrderCostSummary.giftOptionsTax.orderGiftWrapping.inclTax",orderGiftWrappingExclTax:"Order.OrderCostSummary.giftOptionsTax.orderGiftWrapping.exclTax"});return e("div",{...i,className:b(["order-cost-summary",n]),children:e(tt,{order:u,withHeader:c,loading:l,storeConfig:o,translations:d})})},M=({salesGiftWrapping:c,giftWrappingPrice:a,giftWrappingPriceInclTax:t,giftWrappingTitle:n,giftWrappingExclTaxText:i,giftWrappingInclTaxText:s})=>{const l=c==null?void 0:c.taxIncluded,o=c==null?void 0:c.taxExcluded,u=l&&!o,d=o&&!l,p=o&&l;if(a.value===0||t.value===0)return null;const x=u?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:s}),e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:t.currency,amount:t.value})]}),e("div",{className:"order-cost-summary-content__description--subheader",children:e("span",{children:s})})]}):null,h=d?r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:n}),e("span",{children:e(m,{weight:"normal",currency:a.currency,amount:a.value})})]}):null,y=p?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:n}),e("span",{children:e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:t.currency,amount:t.value})})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[e(m,{currency:a.currency,amount:a.value,size:"small",weight:"bold"})," ",e("span",{children:i})]})]}):null;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--gift-wrapping",children:[x,h,y]})},U=({translations:c,order:a,salesPrintedCard:t})=>{const n=a==null?void 0:a.totalGiftOptions,{printedCard:i,printedCardInclTax:s}=n,l=t==null?void 0:t.taxIncluded,o=t==null?void 0:t.taxExcluded;if(i.value===0||s.value===0)return null;const u=l&&!o?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.printedCardTitle}),e("span",{children:e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:s.currency,amount:s.value})})]}),e("div",{className:"order-cost-summary-content__description--subheader",children:e("span",{children:e("span",{children:c.printedCardTitleInclTax})})})]}):null,d=o&&!l?r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.printedCardTitle}),e("span",{children:e(m,{weight:"normal",currency:i.currency,amount:i.value})})]}):null,p=o&&l?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.printedCardTitle}),e("span",{children:e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:s.currency,amount:s.value})})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[e(m,{currency:i.currency,amount:i.value,size:"small",weight:"bold"})," ",e("span",{children:c.printedCardTitleExclTax})]})]}):null;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--printed-card",children:[u,d,p]})},J=({translations:c,order:a,subtotalInclTax:t,subtotalExclTax:n,shoppingOrdersDisplaySubtotal:i})=>{var p,x,h,y;const s=i.taxIncluded,l=i.taxExcluded,o=s&&!l?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.subtotal}),e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(p=a==null?void 0:a.subtotalInclTax)==null?void 0:p.currency,amount:t})]}),e("div",{className:"order-cost-summary-content__description--subheader",children:e("span",{children:c.incl})})]}):null,u=l&&!s?r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.subtotal}),e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(x=a==null?void 0:a.subtotalExclTax)==null?void 0:x.currency,amount:n})]}):null,d=l&&s?r(_,{children:[r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.subtotal}),e(m,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(h=a==null?void 0:a.subtotalInclTax)==null?void 0:h.currency,amount:t})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[e(m,{currency:(y=a==null?void 0:a.subtotalExclTax)==null?void 0:y.currency,amount:n,size:"small",weight:"bold"})," ",e("span",{children:c.excl})]})]}):null;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[o,u,d]})},K=({translations:c,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var i,s,l,o;return t!=null&&t.isVirtual?null: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:[e("span",{children:c.shipping}),(i=t==null?void 0:t.totalShipping)!=null&&i.value?e(m,{weight:"normal",currency:(s=t==null?void 0:t.totalShipping)==null?void 0:s.currency,amount:n}):e("span",{children:c.freeShipping})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?r(_,{children:[e(m,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:(o=t==null?void 0:t.totalShipping)==null?void 0:o.value,size:"small"}),r("span",{children:[" ",c.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?e("span",{children:c.incl}):null]})]})},Q=({translations:c,order:a})=>{var s,l;const t=a==null?void 0:a.coupons,n=a==null?void 0:a.discounts,i=(n==null?void 0:n.reduce((o,u)=>o+(u.amount.value??0),0))||0;return!((s=a==null?void 0:a.discounts)!=null&&s.length)&&i===0?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:[e("span",{children:c.discount}),e("span",{children:e(m,{weight:"normal",sale:!0,currency:(l=n[0])==null?void 0:l.amount.currency,amount:-i})})]}),t.map(o=>e("div",{className:"order-cost-summary-content__description--subheader",children:r("span",{children:[e(H,{source:q,size:"16",className:"order-cost-summary-content__description--coupon-icon"}),e("span",{children:o.code})]})},o.code))]})},X=({translations:c,shoppingOrdersDisplaySubtotal:a,order:t})=>{var i,s,l,o,u;const n=((i=t==null?void 0:t.grandTotal)==null?void 0:i.value)===0;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:[e("span",{children:c.total}),n?e("span",{className:"order-cost-summary-content__description--total-free",children:c.totalFree}):e(m,{currency:(s=t==null?void 0:t.grandTotal)==null?void 0:s.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:[e("span",{children:c.totalExcludingTaxes}),e(m,{currency:(o=t==null?void 0:t.grandTotal)==null?void 0:o.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]})},Y=({translations:c,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var l,o,u;const[i,s]=v(!1);return a?e(I,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:j,iconClose:B,children:r(G,{onStateChange:s,title:c.accordionTitle,secondaryText:e(_,{children:i?null:e(m,{weight:"normal",amount:t,currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency})}),renderContentWhenClosed:!1,children:[(u=n==null?void 0:n.taxes)==null?void 0:u.map((d,p)=>{var x,h,y;return r("div",{className:"order-cost-summary-content__accordion-row",children:[e("p",{children:d==null?void 0:d.title}),e("p",{children:e(m,{weight:"normal",amount:(x=d==null?void 0:d.amount)==null?void 0:x.value,currency:(h=d==null?void 0:d.amount)==null?void 0:h.currency})})]},`${(y=d==null?void 0:d.amount)==null?void 0:y.value}${p}`)}),r("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[e("p",{children:c.accordionTotalTax}),e("p",{children:e(m,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):e("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:r("div",{className:"order-cost-summary-content__description--header",children:[e("span",{children:c.tax}),e(m,{currency:(l=n==null?void 0:n.totalTax)==null?void 0:l.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},P=({totalGiftCardValue:c,totalGiftCardCurrency:a,order:t})=>{const n=t==null?void 0:t.appliedGiftCards;return c?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:[e("span",{children:e(A,{id:"Order.OrderCostSummary.appliedGiftCards.label",plural:n==null?void 0:n.length,fields:{count:n==null?void 0:n.length}})}),e("span",{children:e(m,{weight:"normal",sale:!0,currency:a,amount:-c})})]}),n.map(i=>e("div",{className:"order-cost-summary-content__description--subheader",children:r("span",{children:[e(H,{source:$,size:"16",className:"order-cost-summary-content__description--giftcard-icon"}),e("span",{children:i.code})]})},i.code))]}):null},tt=({translations:c,loading:a,storeConfig:t,order:n,withHeader:i=!0})=>{var h,y,C,w,S,f,N;if(a||!n)return e(D,{});const s=((h=n==null?void 0:n.totalGiftCard)==null?void 0:h.value)??0,l=((y=n.totalGiftCard)==null?void 0:y.currency)??"",o=((C=n.subtotalInclTax)==null?void 0:C.value)??0,u=((w=n.subtotalExclTax)==null?void 0:w.value)??0,d=((S=n.totalShipping)==null?void 0:S.value)??0,p=!!((f=n==null?void 0:n.taxes)!=null&&f.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),x=p?(N=n==null?void 0:n.taxes)==null?void 0:N.reduce((L,O)=>{var V;return+((V=O==null?void 0:O.amount)==null?void 0:V.value)+L},0):0;return r(W,{variant:"secondary",className:b(["order-cost-summary-content"]),children:[i?e(k,{title:c.headerText}):null,r("div",{className:"order-cost-summary-content__wrapper",children:[e(J,{translations:c,order:n,subtotalInclTax:o,subtotalExclTax:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),e(K,{translations:c,order:n,totalShipping:d,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),e(U,{order:n,translations:c,salesPrintedCard:t==null?void 0:t.salesPrintedCard}),e(M,{salesGiftWrapping:t==null?void 0:t.salesGiftWrapping,giftWrappingPrice:n.totalGiftOptions.giftWrappingForItems,giftWrappingPriceInclTax:n.totalGiftOptions.giftWrappingForItemsInclTax,giftWrappingTitle:c.itemGiftWrappingTitle,giftWrappingExclTaxText:c.itemGiftWrappingExclTax,giftWrappingInclTaxText:c.itemGiftWrappingInclTax}),e(M,{salesGiftWrapping:t==null?void 0:t.salesGiftWrapping,giftWrappingPrice:n.totalGiftOptions.giftWrappingForOrder,giftWrappingPriceInclTax:n.totalGiftOptions.giftWrappingForOrderInclTax,giftWrappingTitle:c.orderGiftWrappingTitle,giftWrappingExclTaxText:c.orderGiftWrappingExclTax,giftWrappingInclTaxText:c.orderGiftWrappingInclTax}),e(Q,{translations:c,order:n}),e(P,{order:n,totalGiftCardValue:s,totalGiftCardCurrency:l}),e(Y,{order:n,translations:c,renderTaxAccordion:p,totalAccordionTaxValue:x}),e(X,{translations:c,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{xt as OrderCostSummary,xt as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as d,jsxs as g}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as q,Header as R}from"@dropins/tools/components.js";import{useState as P,useEffect as S,useMemo as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import{Fragment as x}from"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as Q}from"../chunks/setTaxStatus.js";import{a as k}from"../chunks/OrderLoaders.js";import{C as G}from"../chunks/CartSummaryItem.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const v=({orderData:s})=>{const[i,o]=P(!0),[e,r]=P(s);return S(()=>{const t=N.on("order/data",l=>{r(l),o(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:i,order:e}},Y=({className:s,orderData:i,withHeader:o,showConfigurableOptions:e,routeProductDetails:r})=>{const t=b(),{loading:l,order:a}=v({orderData:i});return d("div",{className:h(["order-order-product-list",s]),children:d(I,{loading:l,placeholderImage:(t==null?void 0:t.baseMediaUrl)??"",taxConfig:Q((t==null?void 0:t.shoppingOrderDisplayPrice)??0),order:a,withHeader:o,showConfigurableOptions:e,routeProductDetails:r})})},w=s=>{const i=(s==null?void 0:s.items)??[],o=i.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),e=new Map(o.map(t=>[t.id,t])),r=i.map(t=>{const l=e.get(t==null?void 0:t.id);if(l){const a=t.totalQuantity-l.quantityReturnRequested;return a===0?null:{...t,totalQuantity:a}}return t}).filter(t=>t!==null);return{returnedList:o,canceledItems:r==null?void 0:r.filter(t=>t.quantityCanceled),nonCanceledItems:r==null?void 0:r.filter(t=>!t.quantityCanceled)}},I=({placeholderImage:s,loading:i,taxConfig:o,order:e=null,withHeader:r=!0,showConfigurableOptions:t,routeProductDetails:l})=>{const a=!!(e!=null&&e.returnNumber),m=M({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=T(()=>{var p,f;if(!e)return[];if(!a){const{returnedList:u,canceledItems:n,nonCanceledItems:O}=w(e);return[{type:"returned",list:u,title:m.returned},{type:"cancelled",list:n,title:m.cancelled},{type:"allItems",list:O,title:m.allOrders}].filter(C=>{var y;return((y=C==null?void 0:C.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((f=(p=e.returns.find(u=>u.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:p.items)==null?void 0:f.map(u=>({...u,totalQuantity:u.requestQuantity})))??[],title:m.returned}]},[e,a,m]);return e?L.every(c=>c.list.length===0)?null:d(q,{variant:"secondary",className:"order-order-product-list-content",children:L.map((c,p)=>{var u;const f=c.list.filter(n=>n!==null).reduce((n,{totalQuantity:O})=>O+n,0);return g(x,{children:[r?d(R,{title:`${c.title} (${f})`}):null,d("ul",{className:"order-order-product-list-content__items",children:(u=c.list)==null?void 0:u.filter(n=>n!==null).map(n=>d("li",{"data-testid":"order-product-list-content-item",children:d(G,{placeholderImage:s,loading:i,product:n,itemType:c.type,taxConfig:o,translations:m,showConfigurableOptions:t,routeProductDetails:l})},n.id))})]},p)})}):d(k,{})};export{Y as OrderProductList,Y as default};
3
+ import{jsx as l,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q}from"@dropins/tools/lib.js";import{Card as R,Header as S}from"@dropins/tools/components.js";import{useState as g,useEffect as T,useMemo as b}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as x}from"../chunks/useGetStoreConfig.js";import{Fragment as N}from"@dropins/tools/preact.js";import{events as Q}from"@dropins/tools/event-bus.js";import{s as k}from"../chunks/setTaxStatus.js";import{a as G}from"../chunks/OrderLoaders.js";import{C as M}from"../chunks/CartSummaryItem.js";import{useText as v}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const w=({orderData:s})=>{const[i,o]=g(!0),[d,e]=g(s);return T(()=>{const t=Q.on("order/data",r=>{e(r),o(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:i,order:d}},Z=({slots:s,className:i,orderData:o,withHeader:d,showConfigurableOptions:e,routeProductDetails:t})=>{const r=x(),{loading:c,order:p}=w({orderData:o});return l("div",{className:q(["order-order-product-list",i]),children:l(j,{slots:s,loading:c,placeholderImage:(r==null?void 0:r.baseMediaUrl)??"",taxConfig:k((r==null?void 0:r.shoppingOrderDisplayPrice)??0),order:p,withHeader:d,showConfigurableOptions:e,routeProductDetails:t})})},I=s=>{const i=(s==null?void 0:s.items)??[],o=i.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),d=new Map(o.map(t=>[t.id,t])),e=i.map(t=>{const r=d.get(t==null?void 0:t.id);if(r){const c=t.totalQuantity-r.quantityReturnRequested;return c===0?null:{...t,totalQuantity:c}}return t}).filter(t=>t!==null);return{returnedList:o,canceledItems:e==null?void 0:e.filter(t=>t.quantityCanceled),nonCanceledItems:e==null?void 0:e.filter(t=>!t.quantityCanceled)}},j=({slots:s,placeholderImage:i,loading:o,taxConfig:d,order:e=null,withHeader:t=!0,showConfigurableOptions:r,routeProductDetails:c})=>{const p=!!(e!=null&&e.returnNumber),m=v({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"}),y=b(()=>{var f,O;if(!e)return[];if(!p){const{returnedList:u,canceledItems:n,nonCanceledItems:C}=I(e);return[{type:"returned",list:u,title:m.returned},{type:"cancelled",list:n,title:m.cancelled},{type:"allItems",list:C,title:m.allOrders}].filter(L=>{var P;return((P=L==null?void 0:L.list)==null?void 0:P.length)>0})}return[{type:"returned",list:((O=(f=e.returns.find(u=>u.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:f.items)==null?void 0:O.map(u=>({...u,totalQuantity:u.requestQuantity})))??[],title:m.returned}]},[e,p,m]);return e?y.every(a=>a.list.length===0)?null:l(R,{variant:"secondary",className:"order-order-product-list-content",children:y.map((a,f)=>{var u;const O=a.list.filter(n=>n!==null).reduce((n,{totalQuantity:C})=>C+n,0);return h(N,{children:[t?l(S,{title:`${a.title} (${O})`}):null,l("ul",{className:"order-order-product-list-content__items",children:(u=a.list)==null?void 0:u.filter(n=>n!==null).map(n=>l("li",{"data-testid":"order-product-list-content-item",children:l(M,{slots:s,placeholderImage:i,loading:o,product:n,itemType:a.type,taxConfig:d,translations:m,showConfigurableOptions:r,routeProductDetails:c})},n.id))})]},f)})}):l(G,{})};export{Z as OrderProductList,Z as default};
@@ -42,6 +42,22 @@ export type OrderItemProductModel = {
42
42
  };
43
43
  };
44
44
  export type OrderItemModel = {
45
+ giftMessage: {
46
+ senderName: string;
47
+ recipientName: string;
48
+ message: string;
49
+ };
50
+ giftWrappingPrice: MoneyProps;
51
+ productGiftWrapping: {
52
+ uid: string;
53
+ design: string;
54
+ selected: boolean;
55
+ image: {
56
+ url: string;
57
+ label: string;
58
+ };
59
+ price: MoneyProps;
60
+ }[];
45
61
  taxCalculations: {
46
62
  includeAndExcludeTax: {
47
63
  originalPrice: MoneyProps;
@@ -160,6 +176,12 @@ export type ShipmentsModel = {
160
176
  items: ShipmentItemsModel[];
161
177
  };
162
178
  export type OrderDataModel = {
179
+ giftReceiptIncluded: boolean;
180
+ printedCardIncluded: boolean;
181
+ giftWrappingOrder: {
182
+ price: MoneyProps;
183
+ uid: string;
184
+ };
163
185
  placeholderImage?: string;
164
186
  returnNumber?: string;
165
187
  id: string;
@@ -192,13 +214,21 @@ export type OrderDataModel = {
192
214
  };
193
215
  shipments: ShipmentsModel[];
194
216
  items: OrderItemModel[];
195
- totalGiftcard: MoneyProps;
217
+ totalGiftCard: MoneyProps;
196
218
  grandTotal: MoneyProps;
197
219
  totalShipping?: MoneyProps;
198
220
  subtotalExclTax: MoneyProps;
199
221
  subtotalInclTax: MoneyProps;
200
222
  totalTax: MoneyProps;
201
223
  shippingAddress: OrderAddressModel;
224
+ totalGiftOptions: {
225
+ giftWrappingForItems: MoneyProps;
226
+ giftWrappingForItemsInclTax: MoneyProps;
227
+ giftWrappingForOrder: MoneyProps;
228
+ giftWrappingForOrderInclTax: MoneyProps;
229
+ printedCard: MoneyProps;
230
+ printedCardInclTax: MoneyProps;
231
+ };
202
232
  billingAddress: OrderAddressModel;
203
233
  availableActions: AvailableActionsProps[];
204
234
  taxes: {
@@ -206,6 +236,10 @@ export type OrderDataModel = {
206
236
  rate: number;
207
237
  title: string;
208
238
  }[];
239
+ appliedGiftCards: {
240
+ code: string;
241
+ appliedBalance: MoneyProps;
242
+ }[];
209
243
  };
210
244
  export type TransformedData<T extends QueryType> = T extends 'orderData' ? OrderDataModel : null;
211
245
  //# sourceMappingURL=order-details.d.ts.map
@@ -24,6 +24,8 @@ export interface StoreConfigModel {
24
24
  shoppingOrdersDisplayFullSummary: boolean;
25
25
  shoppingOrdersDisplayGrandTotal: boolean;
26
26
  shoppingOrdersDisplayZeroTax: boolean;
27
+ salesPrintedCard: number;
28
+ salesGiftWrapping: number;
27
29
  }
28
30
  export interface OrderCancellationReason {
29
31
  description: string;
@@ -12,6 +12,13 @@ export declare const transformLinks: (links: {
12
12
  result: string;
13
13
  } | null;
14
14
  export declare const transformOrderItems: (items: OrderItemProps[]) => OrderItemModel[];
15
+ export declare const transformAppliedGiftCards: (appliedGiftCards?: any[]) => {
16
+ code: any;
17
+ appliedBalance: {
18
+ value: any;
19
+ currency: any;
20
+ };
21
+ }[];
15
22
  export declare const transformOrderData: (orderData: OrderProps, returnRef?: string) => OrderDataModel;
16
23
  export declare const transformOrderDetails: <T extends "orderData">(queryType: QueryType, response: ResponseData<T>, returnRef?: string) => TransformedData<T>;
17
24
  //# sourceMappingURL=transform-order-details.d.ts.map
package/fragments.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- const T=`
3
+ const o=`
4
4
  fragment REQUEST_RETURN_ORDER_FRAGMENT on Return {
5
5
  __typename
6
6
  uid
@@ -35,6 +35,10 @@ const T=`
35
35
  name
36
36
  sku
37
37
  only_x_left_in_stock
38
+ gift_wrapping_price {
39
+ currency
40
+ value
41
+ }
38
42
  stock_status
39
43
  thumbnail {
40
44
  label
@@ -49,7 +53,7 @@ const T=`
49
53
  }
50
54
  }
51
55
  }
52
- `,t=`
56
+ `,r=`
53
57
  fragment PRICE_DETAILS_FRAGMENT on OrderItemInterface {
54
58
  prices {
55
59
  price_including_tax {
@@ -70,11 +74,11 @@ const T=`
70
74
  }
71
75
  }
72
76
  }
73
- `,r=`
77
+ `,t=`
74
78
  fragment GIFT_CARD_DETAILS_FRAGMENT on GiftCardOrderItem {
75
79
  ...PRICE_DETAILS_FRAGMENT
76
80
  gift_message {
77
- message
81
+ ...GIFT_MESSAGE_FRAGMENT
78
82
  }
79
83
  gift_card {
80
84
  recipient_name
@@ -86,6 +90,9 @@ const T=`
86
90
  }
87
91
  `,n=`
88
92
  fragment ORDER_ITEM_DETAILS_FRAGMENT on OrderItemInterface {
93
+ gift_wrapping {
94
+ ...GIFT_WRAPPING_FRAGMENT
95
+ }
89
96
  __typename
90
97
  status
91
98
  product_sku
@@ -99,6 +106,9 @@ const T=`
99
106
  quantity_invoiced
100
107
  quantity_refunded
101
108
  quantity_return_requested
109
+ gift_message {
110
+ ...GIFT_MESSAGE_FRAGMENT
111
+ }
102
112
  product_sale_price {
103
113
  value
104
114
  currency
@@ -132,7 +142,7 @@ const T=`
132
142
  title
133
143
  }
134
144
  }
135
- `,R=`
145
+ `,i=`
136
146
  fragment ORDER_ITEM_FRAGMENT on OrderItemInterface {
137
147
  ...ORDER_ITEM_DETAILS_FRAGMENT
138
148
  ... on BundleOrderItem {
@@ -148,8 +158,34 @@ const T=`
148
158
  }
149
159
 
150
160
  ${E}
151
- `,i=`
161
+ `,R=`
152
162
  fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {
163
+ gift_options {
164
+ gift_wrapping_for_items {
165
+ currency
166
+ value
167
+ }
168
+ gift_wrapping_for_items_incl_tax {
169
+ currency
170
+ value
171
+ }
172
+ gift_wrapping_for_order {
173
+ currency
174
+ value
175
+ }
176
+ gift_wrapping_for_order_incl_tax {
177
+ currency
178
+ value
179
+ }
180
+ printed_card {
181
+ currency
182
+ value
183
+ }
184
+ printed_card_incl_tax {
185
+ currency
186
+ value
187
+ }
188
+ }
153
189
  grand_total {
154
190
  value
155
191
  currency
@@ -190,7 +226,7 @@ const T=`
190
226
  label
191
227
  }
192
228
  }
193
- `,u=`
229
+ `,c=`
194
230
  fragment RETURNS_FRAGMENT on Returns {
195
231
  __typename
196
232
  items {
@@ -231,8 +267,65 @@ const T=`
231
267
  }
232
268
  }
233
269
  }
234
- `,c=`
270
+ `,T=`
271
+ fragment APPLIED_GIFT_CARDS_FRAGMENT on ApplyGiftCardToOrder {
272
+ __typename
273
+ code
274
+ applied_balance {
275
+ value
276
+ currency
277
+ }
278
+ }
279
+ `,u=`
280
+ fragment GIFT_MESSAGE_FRAGMENT on GiftMessage {
281
+ __typename
282
+ from
283
+ to
284
+ message
285
+ }
286
+ `,A=`
287
+ fragment GIFT_WRAPPING_FRAGMENT on GiftWrapping {
288
+ __typename
289
+ uid
290
+ design
291
+ image {
292
+ url
293
+ }
294
+ price {
295
+ value
296
+ currency
297
+ }
298
+ }
299
+ `,d=`
300
+ fragment AVAILABLE_GIFT_WRAPPING_FRAGMENT on GiftWrapping {
301
+ __typename
302
+ uid
303
+ design
304
+ image {
305
+ url
306
+ label
307
+ }
308
+ price {
309
+ currency
310
+ value
311
+ }
312
+ }
313
+ `,s=`
235
314
  fragment GUEST_ORDER_FRAGMENT on CustomerOrder {
315
+ printed_card_included
316
+ gift_receipt_included
317
+ gift_wrapping {
318
+ ...GIFT_WRAPPING_FRAGMENT
319
+ }
320
+ gift_message {
321
+ ...GIFT_MESSAGE_FRAGMENT
322
+ }
323
+ applied_gift_cards {
324
+ ...APPLIED_GIFT_CARDS_FRAGMENT
325
+ }
326
+ items_eligible_for_return {
327
+ ...ORDER_ITEM_DETAILS_FRAGMENT
328
+ }
236
329
  email
237
330
  id
238
331
  number
@@ -242,13 +335,8 @@ const T=`
242
335
  token
243
336
  carrier
244
337
  shipping_method
245
- printed_card_included
246
- gift_receipt_included
247
338
  available_actions
248
339
  is_virtual
249
- items_eligible_for_return {
250
- ...ORDER_ITEM_DETAILS_FRAGMENT
251
- }
252
340
  returns {
253
341
  ...RETURNS_FRAGMENT
254
342
  }
@@ -304,12 +392,15 @@ const T=`
304
392
  }
305
393
  }
306
394
  ${_}
307
- ${t}
308
395
  ${r}
396
+ ${t}
309
397
  ${n}
310
398
  ${a}
311
- ${i}
399
+ ${R}
312
400
  ${e}
401
+ ${c}
402
+ ${i}
403
+ ${A}
313
404
  ${u}
314
- ${R}
315
- `;export{e as ADDRESS_FRAGMENT,a as BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT,E as DOWNLOADABLE_ORDER_ITEMS_FRAGMENT,r as GIFT_CARD_DETAILS_FRAGMENT,c as GUEST_ORDER_FRAGMENT,n as ORDER_ITEM_DETAILS_FRAGMENT,R as ORDER_ITEM_FRAGMENT,i as ORDER_SUMMARY_FRAGMENT,t as PRICE_DETAILS_FRAGMENT,_ as PRODUCT_DETAILS_FRAGMENT,T as REQUEST_RETURN_ORDER_FRAGMENT,u as RETURNS_FRAGMENT};
405
+ ${T}
406
+ `;export{e as ADDRESS_FRAGMENT,T as APPLIED_GIFT_CARDS_FRAGMENT,d as AVAILABLE_GIFT_WRAPPING_FRAGMENT,a as BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT,E as DOWNLOADABLE_ORDER_ITEMS_FRAGMENT,t as GIFT_CARD_DETAILS_FRAGMENT,u as GIFT_MESSAGE_FRAGMENT,A as GIFT_WRAPPING_FRAGMENT,s as GUEST_ORDER_FRAGMENT,n as ORDER_ITEM_DETAILS_FRAGMENT,i as ORDER_ITEM_FRAGMENT,R as ORDER_SUMMARY_FRAGMENT,r as PRICE_DETAILS_FRAGMENT,_ as PRODUCT_DETAILS_FRAGMENT,o as REQUEST_RETURN_ORDER_FRAGMENT,c as RETURNS_FRAGMENT};
@@ -4,6 +4,12 @@ import { RefObject } from 'preact';
4
4
 
5
5
  export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAlert, orderData, }: UseCreateReturn) => {
6
6
  order: {
7
+ giftReceiptIncluded?: boolean | undefined;
8
+ printedCardIncluded?: boolean | undefined;
9
+ giftWrappingOrder?: {
10
+ price: import('../../types').MoneyProps;
11
+ uid: string;
12
+ } | undefined;
7
13
  placeholderImage?: string | undefined;
8
14
  returnNumber?: string | undefined;
9
15
  id: string;
@@ -36,13 +42,21 @@ export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAler
36
42
  } | undefined;
37
43
  shipments?: import('../../data/models').ShipmentsModel[] | undefined;
38
44
  items?: OrderItemModel[] | undefined;
39
- totalGiftcard?: import('../../types').MoneyProps | undefined;
45
+ totalGiftCard?: import('../../types').MoneyProps | undefined;
40
46
  grandTotal?: import('../../types').MoneyProps | undefined;
41
47
  totalShipping?: import('../../types').MoneyProps | undefined;
42
48
  subtotalExclTax?: import('../../types').MoneyProps | undefined;
43
49
  subtotalInclTax?: import('../../types').MoneyProps | undefined;
44
50
  totalTax?: import('../../types').MoneyProps | undefined;
45
51
  shippingAddress?: import('../../data/models').OrderAddressModel | undefined;
52
+ totalGiftOptions?: {
53
+ giftWrappingForItems: import('../../types').MoneyProps;
54
+ giftWrappingForItemsInclTax: import('../../types').MoneyProps;
55
+ giftWrappingForOrder: import('../../types').MoneyProps;
56
+ giftWrappingForOrderInclTax: import('../../types').MoneyProps;
57
+ printedCard: import('../../types').MoneyProps;
58
+ printedCardInclTax: import('../../types').MoneyProps;
59
+ } | undefined;
46
60
  billingAddress?: import('../../data/models').OrderAddressModel | undefined;
47
61
  availableActions?: import('../../types').AvailableActionsProps[] | undefined;
48
62
  taxes?: {
@@ -50,6 +64,10 @@ export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAler
50
64
  rate: number;
51
65
  title: string;
52
66
  }[] | undefined;
67
+ appliedGiftCards?: {
68
+ code: string;
69
+ appliedBalance: import('../../types').MoneyProps;
70
+ }[] | undefined;
53
71
  };
54
72
  steps: StepsTypes;
55
73
  loading: boolean;