@mercurjs/vendor 2.2.0-canary.8 → 2.2.0-canary.9

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 (183) hide show
  1. package/dist/[id]-A55T2ORL.js +3066 -0
  2. package/dist/{[id]-VUX4FUOO.js → [id]-B4YZTANM.js} +36 -22
  3. package/dist/{[id]-BPAZLOLW.js → [id]-BC7IKQTQ.js} +5 -5
  4. package/dist/{[id]-MOOCGOWO.js → [id]-FE5GYYVZ.js} +20 -19
  5. package/dist/{[id]-QWL6SUOB.js → [id]-FWCX5PTI.js} +3 -3
  6. package/dist/{[id]-5ADOHZ45.js → [id]-GBT6VB4S.js} +16 -14
  7. package/dist/{[id]-IWCWVNVI.js → [id]-GC3ZYPK4.js} +12 -11
  8. package/dist/{[id]-T7USGHIY.js → [id]-J6BZG5PU.js} +3 -3
  9. package/dist/{[id]-BTGQJ3UD.js → [id]-QOEO3JOV.js} +15 -13
  10. package/dist/{[id]-ZAQYATGN.js → [id]-QQU5HVFU.js} +16 -14
  11. package/dist/{[id]-L6FD7BRE.js → [id]-SHAJTJNZ.js} +27 -24
  12. package/dist/{[id]-GMJAPZPU.js → [id]-T5ECVBPF.js} +17 -15
  13. package/dist/{[id]-K2CT7BXQ.js → [id]-YPCO3DJV.js} +1 -1
  14. package/dist/{[province_id]-5KZGMQER.js → [province_id]-6GUA4PV5.js} +12 -11
  15. package/dist/{add-KMHJ6OC6.js → add-NTRYWOJF.js} +27 -24
  16. package/dist/{add-Y6GMGLYX.js → add-RU3WL4YB.js} +39 -7
  17. package/dist/{add-customer-groups-NXSWICFI.js → add-customer-groups-U5RZWW4B.js} +15 -14
  18. package/dist/{add-products-LXYF57BK.js → add-products-Q4MMDQKT.js} +16 -14
  19. package/dist/{add-promotions-VTYAEDCN.js → add-promotions-KD2CWQPF.js} +5 -5
  20. package/dist/{add-to-campaign-DLP7PSQB.js → add-to-campaign-QKYQCSR2.js} +3 -3
  21. package/dist/{address-JFXH3M7D.js → address-77Y3AOQ3.js} +11 -10
  22. package/dist/{adjust-inventory-V2V7NWWH.js → adjust-inventory-AFJLWF5R.js} +1 -1
  23. package/dist/{allocate-items-OK5PVJGR.js → allocate-items-TCM5A55Y.js} +137 -122
  24. package/dist/{attributes-TRAUBTCO.js → attributes-SZP2MM5L.js} +1 -1
  25. package/dist/{breadcrumb-7R6E6G2X.js → breadcrumb-2XA2WOK7.js} +1 -1
  26. package/dist/{breadcrumb-6FV7PWEN.js → breadcrumb-5NP23D6X.js} +12 -11
  27. package/dist/{breadcrumb-Q3XSG7B2.js → breadcrumb-EVZIOB2G.js} +11 -10
  28. package/dist/{breadcrumb-S4V7MJUM.js → breadcrumb-FPWBT76A.js} +1 -1
  29. package/dist/{breadcrumb-FES7EKUR.js → breadcrumb-IK6XCQOQ.js} +2 -2
  30. package/dist/{breadcrumb-EG3ANCVO.js → breadcrumb-KTARIL65.js} +2 -2
  31. package/dist/{breadcrumb-HV67K43U.js → breadcrumb-PBR27GGX.js} +3 -3
  32. package/dist/{breadcrumb-EX4C3AZY.js → breadcrumb-TNJSGX4T.js} +11 -10
  33. package/dist/campaigns-JAQTSA4Z.js +2 -2
  34. package/dist/{categories-6TVMTN62.js → categories-T4QJYX4R.js} +5 -5
  35. package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
  36. package/dist/{chunk-GNDFMMC6.js → chunk-2QTNCGKX.js} +1 -1
  37. package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
  38. package/dist/{chunk-U5XDKYZG.js → chunk-3PMM6AMP.js} +1 -1
  39. package/dist/{chunk-JYPPXAJG.js → chunk-463CNCJC.js} +1 -1
  40. package/dist/{chunk-AVOZ7TX2.js → chunk-53SII3U2.js} +1 -1
  41. package/dist/{chunk-THMXGEZU.js → chunk-5QI3NDJG.js} +1 -1
  42. package/dist/{chunk-3X3LUKDM.js → chunk-6FUIK3PX.js} +2 -2
  43. package/dist/{chunk-Q75AC3DZ.js → chunk-6K6EQOJF.js} +1 -1
  44. package/dist/{chunk-SS46VQJA.js → chunk-6SJTAE66.js} +1 -1
  45. package/dist/{chunk-IXAQNTE7.js → chunk-6UZERVBI.js} +1 -1
  46. package/dist/{chunk-QZJIDKQR.js → chunk-7IPCLQ5V.js} +2 -2
  47. package/dist/{chunk-7LVNAFEI.js → chunk-BENED3NB.js} +24 -13
  48. package/dist/{chunk-JMRWREVE.js → chunk-BER45EYD.js} +22 -35
  49. package/dist/{chunk-2BCAQ4BB.js → chunk-BXRNZS5K.js} +1 -1
  50. package/dist/{chunk-JXQJQYGD.js → chunk-DDJQRV6E.js} +1 -1
  51. package/dist/{chunk-PBD36EZJ.js → chunk-DO4F5FIO.js} +1 -1
  52. package/dist/{chunk-4KNL46BT.js → chunk-DQKK43PR.js} +1 -1
  53. package/dist/{chunk-L7QKFC5N.js → chunk-E6W57UP3.js} +32 -122
  54. package/dist/{chunk-PP754CO7.js → chunk-EIZP3XL5.js} +1 -1
  55. package/dist/chunk-FP6U6BPH.js +61 -0
  56. package/dist/chunk-FWPGOIFA.js +22 -0
  57. package/dist/{chunk-UDJ2I5A2.js → chunk-GAE6TKOR.js} +1 -1
  58. package/dist/{chunk-WLT7K7K7.js → chunk-HDEOZN2Q.js} +21 -24
  59. package/dist/{chunk-FDR22JMM.js → chunk-HFRHHT36.js} +8 -63
  60. package/dist/chunk-IBEUR3J7.js +173 -0
  61. package/dist/chunk-J6XCRFBW.js +30 -0
  62. package/dist/{chunk-B234IELY.js → chunk-JAUZ73XE.js} +23 -0
  63. package/dist/{chunk-XEU5ZLSB.js → chunk-K6LOZ4S3.js} +3 -3
  64. package/dist/{chunk-DARJTN4I.js → chunk-L4KBTV57.js} +9 -2
  65. package/dist/chunk-L57USMYC.js +39 -0
  66. package/dist/chunk-LARLBYU6.js +127 -0
  67. package/dist/chunk-LFX6WU4A.js +36 -0
  68. package/dist/{chunk-X4INVIWL.js → chunk-LKUW5SV4.js} +1 -1
  69. package/dist/{chunk-BLRZB63H.js → chunk-MZTDRBCR.js} +1 -1
  70. package/dist/{chunk-TODJFRLH.js → chunk-NBKWY6XN.js} +1 -1
  71. package/dist/{chunk-QXLRABYH.js → chunk-O7VOGTLX.js} +1 -1
  72. package/dist/{chunk-PXI47JL5.js → chunk-OZ44ATGE.js} +7 -7
  73. package/dist/{chunk-E2L5EX5A.js → chunk-PAVZ6FPK.js} +5 -5
  74. package/dist/{chunk-FCJ7MLQK.js → chunk-PZEPOPMV.js} +100 -9
  75. package/dist/{chunk-QT7YFHCA.js → chunk-S23FD6FA.js} +12 -0
  76. package/dist/{chunk-QGGMG3OU.js → chunk-SPOHNK4X.js} +1 -1
  77. package/dist/{chunk-EIUYXS7E.js → chunk-SZBERGA4.js} +1 -1
  78. package/dist/{chunk-YIZK67RW.js → chunk-TBYCZRZ7.js} +31 -28
  79. package/dist/chunk-TF6V3TFG.js +438 -0
  80. package/dist/chunk-TW324MAT.js +185 -0
  81. package/dist/{chunk-WHSE47DM.js → chunk-TYESCFYW.js} +1 -1
  82. package/dist/chunk-UM7ZR3VU.js +14 -0
  83. package/dist/{chunk-VPKMBJ5B.js → chunk-VCOQ7WQ2.js} +3 -3
  84. package/dist/chunk-VCUUITW6.js +35 -0
  85. package/dist/chunk-VZUA5SRD.js +62 -0
  86. package/dist/{chunk-6RH3VDF7.js → chunk-X4GWB6AT.js} +2 -2
  87. package/dist/{chunk-6YA3C4NB.js → chunk-XCIMOIX6.js} +3 -12
  88. package/dist/{chunk-LJO34DKJ.js → chunk-Y2MQ5EMD.js} +29 -24
  89. package/dist/chunk-YBF45CX5.js +23 -0
  90. package/dist/{chunk-PGW3VYK4.js → chunk-YHIJCI4U.js} +1 -1
  91. package/dist/{chunk-AVOIZO63.js → chunk-YQZBAP3S.js} +4 -2
  92. package/dist/{chunk-WCSQDWMS.js → chunk-YUKD5RCX.js} +1 -1
  93. package/dist/chunk-ZHFFTT3I.js +17 -0
  94. package/dist/{collections-DS63FT2E.js → collections-URH2TCWJ.js} +19 -18
  95. package/dist/{configuration-JI22M76Z.js → configuration-7IYZ6GNP.js} +2 -2
  96. package/dist/{create-GB3ZA4LH.js → create-5PSOIHIT.js} +3 -3
  97. package/dist/{create-UFHLPXET.js → create-7R6CZU53.js} +1 -1
  98. package/dist/{create-POK6SJSZ.js → create-A7B3MLJX.js} +27 -24
  99. package/dist/create-F5R76QML.js +1178 -0
  100. package/dist/create-FKRYB7ZS.js +1784 -0
  101. package/dist/create-GGACODDN.js +1914 -0
  102. package/dist/{create-5QLYFVEK.js → create-JF2OUZQA.js} +11 -10
  103. package/dist/{create-F7IDSSTP.js → create-JGYG5SBM.js} +17 -15
  104. package/dist/{create-OXR7WG5F.js → create-MS6KKFSV.js} +19 -18
  105. package/dist/{create-CK4X357V.js → create-O35JRZEF.js} +11 -10
  106. package/dist/{create-EATFT5AB.js → create-ODOFJF5N.js} +15 -14
  107. package/dist/{create-2XZLOG5Z.js → create-TKXH5KQY.js} +12 -8
  108. package/dist/{create-HR4I33SE.js → create-Z5VPBELS.js} +21 -18
  109. package/dist/customers-SOLJ2KQQ.js +2 -2
  110. package/dist/{edit-RJ3EZ5CD.js → edit-2R5QCPTB.js} +12 -11
  111. package/dist/{edit-QPPMI7MU.js → edit-3E4ZO7HT.js} +13 -12
  112. package/dist/{edit-ZQP4MNJU.js → edit-5CROKEJE.js} +29 -26
  113. package/dist/{edit-UUP3BQV3.js → edit-FXNXTVIW.js} +2 -2
  114. package/dist/{edit-4OEBCCXJ.js → edit-G2E5SNGU.js} +11 -10
  115. package/dist/{edit-PFAJZUWI.js → edit-HTLLYECP.js} +13 -12
  116. package/dist/{edit-2LGAEKH6.js → edit-OKU6FMHJ.js} +11 -10
  117. package/dist/edit-VVLITC2E.js +910 -0
  118. package/dist/edit-XSICGAVO.js +176 -0
  119. package/dist/{edit-TZ4EXLKJ.js → edit-Y2U3KAVB.js} +41 -29
  120. package/dist/{edit-inventory-item-A7KAPATR.js → edit-inventory-item-ZKXXL3QK.js} +1 -1
  121. package/dist/{edit-inventory-item-attributes-RNBOJR66.js → edit-inventory-item-attributes-GSKUMORD.js} +1 -1
  122. package/dist/{fulfillment-OIIPL7B7.js → fulfillment-76IVZ266.js} +25 -17
  123. package/dist/{fulfillment-providers-6WDXCGAI.js → fulfillment-providers-G2L6LEVO.js} +16 -15
  124. package/dist/index.css +71 -6
  125. package/dist/index.js +166 -137
  126. package/dist/{inventory-IOVM7GDU.js → inventory-WSFLTA6Z.js} +4 -4
  127. package/dist/{invite-HRKSQI4B.js → invite-2673PU4I.js} +11 -10
  128. package/dist/{invite-UBH7PYSH.js → invite-HRXZ5YBP.js} +15 -14
  129. package/dist/{login-HON44E3S.js → login-TWUBU6I6.js} +11 -10
  130. package/dist/{manage-locations-TIYOCOZU.js → manage-locations-XHH5DVIR.js} +1 -1
  131. package/dist/{media-EXWUWWNB.js → media-J22P2DK4.js} +14 -13
  132. package/dist/{metadata-T6MLCEZ2.js → metadata-D6M66NQK.js} +11 -10
  133. package/dist/{metadata-YOQEXEGO.js → metadata-NIDIBXJT.js} +11 -10
  134. package/dist/{metadata-JIMHXPKE.js → metadata-Q74OJWUD.js} +11 -10
  135. package/dist/{metadata-ITS3VPE3.js → metadata-REQIFWWH.js} +11 -10
  136. package/dist/{metadata-JCNPERR3.js → metadata-YVHJPDLD.js} +11 -10
  137. package/dist/{offer-create-page-6YTTQAXZ.js → offer-create-page-E4FLSDJQ.js} +6 -6
  138. package/dist/{offer-detail-page-OMZN2NTA.js → offer-detail-page-6SIBQTLP.js} +2 -2
  139. package/dist/{offer-inventory-batch-page-4QNXDUWN.js → offer-inventory-batch-page-BD6PMDLW.js} +4 -4
  140. package/dist/{offer-pricing-edit-page-WZNP3TWV.js → offer-pricing-edit-page-4TINK42V.js} +1 -1
  141. package/dist/offers-GVN5LCK6.js +2 -2
  142. package/dist/{onboarding-GCRT6P6M.js → onboarding-MK2RIFD4.js} +11 -10
  143. package/dist/{orders-CHSS4ASB.js → orders-TVQDR4OJ.js} +22 -21
  144. package/dist/{organization-5AFVFFZQ.js → organization-XO3T2K2X.js} +12 -11
  145. package/dist/{organize-AZYAANZM.js → organize-5XRZWD5C.js} +3 -3
  146. package/dist/{organize-QXDKGP2X.js → organize-Z7JTTDH4.js} +3 -3
  147. package/dist/pages/index.js +51 -48
  148. package/dist/{payment-details-ENUWDVGI.js → payment-details-CFTX3QDL.js} +11 -10
  149. package/dist/{payouts-2QBQSNDR.js → payouts-7Q7D4FET.js} +6 -6
  150. package/dist/{price-lists-2WBNENE7.js → price-lists-6TFLA53G.js} +6 -6
  151. package/dist/{pricing-4Y73YJHP.js → pricing-ECXV6K7G.js} +16 -15
  152. package/dist/{product-tags-DE32PERU.js → product-tags-5O7ZG6SA.js} +27 -24
  153. package/dist/product-types-PKUEL7X5.js +2 -2
  154. package/dist/{product-variant-detail-MWUBPCOP.js → product-variant-detail-PUWOMVHQ.js} +11 -10
  155. package/dist/{product-variant-edit-ESLPI5ES.js → product-variant-edit-WZNO4CQX.js} +1 -1
  156. package/dist/{products-WLGCX6Z7.js → products-BM3IIH5P.js} +16 -14
  157. package/dist/{products-XOHAQHUJ.js → products-XE5YPQ66.js} +25 -23
  158. package/dist/{professional-details-OCVQO2MV.js → professional-details-ED4HNYXY.js} +11 -10
  159. package/dist/{profile-2HW5NX6K.js → profile-6TGCNNUU.js} +14 -13
  160. package/dist/{promotions-FPV6QOEQ.js → promotions-AZM7JQAJ.js} +6 -6
  161. package/dist/receive-2GFZTVNC.js +536 -0
  162. package/dist/refund-IGMSXQNX.js +268 -0
  163. package/dist/{register-PZOHGO7N.js → register-ADZCPWEV.js} +12 -11
  164. package/dist/{reset-password-Q7BNWHHO.js → reset-password-RGWK33Q7.js} +1 -1
  165. package/dist/{return-reasons-J2WFZOQH.js → return-reasons-QJRA2ZX6.js} +11 -9
  166. package/dist/{sales-channels-HPG2ND4W.js → sales-channels-CZDU7VTE.js} +6 -6
  167. package/dist/{sales-channels-I3PR34U5.js → sales-channels-U55MUDQP.js} +6 -6
  168. package/dist/{settings-RZNYWACF.js → settings-2GCQQTO6.js} +27 -24
  169. package/dist/shipment-HWQHMX2L.js +242 -0
  170. package/dist/{shipping-profile-M3GGADFI.js → shipping-profile-ZP7M6VSS.js} +1 -1
  171. package/dist/{shipping-profiles-L27STQ7K.js → shipping-profiles-C5WBXWZ2.js} +13 -12
  172. package/dist/{stock-3HVQ6FYP.js → stock-MQA7PRO6.js} +11 -10
  173. package/dist/{store-LDVMG7CV.js → store-5ZHZR4JI.js} +15 -14
  174. package/dist/{store-closure-EZ2YPOPL.js → store-closure-H5WHV3LA.js} +11 -10
  175. package/dist/{store-select-AM4AE7AL.js → store-select-PZS556FB.js} +11 -10
  176. package/dist/{team-6NTDISM4.js → team-CLKJCZNH.js} +15 -14
  177. package/package.json +1 -1
  178. package/dist/[id]-UVQXCYXD.js +0 -1219
  179. package/dist/chunk-432S4FGR.js +0 -0
  180. package/dist/chunk-G7BL4L3L.js +0 -66
  181. package/dist/shipment-KWUXQZWK.js +0 -176
  182. package/dist/{areas-FB63OQAI.js → areas-XUC5V5UO.js} +2 -2
  183. package/dist/{create-6I43IPLO.js → create-MZYXMGKP.js} +2 -2
@@ -0,0 +1,3066 @@
1
+ import {
2
+ useCancelOrderEdit,
3
+ useConfirmOrderEdit
4
+ } from "./chunk-LARLBYU6.js";
5
+ import {
6
+ useCancelExchangeBegin,
7
+ useExchanges
8
+ } from "./chunk-TW324MAT.js";
9
+ import {
10
+ CLAIM_POLICY_DAYS,
11
+ EXCHANGE_POLICY_DAYS,
12
+ RETURN_POLICY_DAYS,
13
+ isOutsidePolicyWindow
14
+ } from "./chunk-VCUUITW6.js";
15
+ import {
16
+ useCancelClaimBegin,
17
+ useClaims
18
+ } from "./chunk-IBEUR3J7.js";
19
+ import {
20
+ useCancelReturn,
21
+ useCancelReturnRequest,
22
+ useReturns
23
+ } from "./chunk-TF6V3TFG.js";
24
+ import {
25
+ getReturnableQuantity
26
+ } from "./chunk-UM7ZR3VU.js";
27
+ import {
28
+ DEFAULT_FIELDS
29
+ } from "./chunk-L4KBTV57.js";
30
+ import "./chunk-BCU3FKP2.js";
31
+ import {
32
+ formatProvider
33
+ } from "./chunk-VW56KWO2.js";
34
+ import {
35
+ getFormattedAddress,
36
+ isSameAddress
37
+ } from "./chunk-W6Y3PPU5.js";
38
+ import {
39
+ getCanceledOrderStatus,
40
+ getOrderFulfillmentStatus,
41
+ getOrderPaymentStatus
42
+ } from "./chunk-LQSLDDPT.js";
43
+ import {
44
+ getLocaleAmount,
45
+ getStylizedAmount,
46
+ isAmountLessThenRoundingError
47
+ } from "./chunk-3BXCPHN6.js";
48
+ import "./chunk-JRTZWK77.js";
49
+ import "./chunk-IQPN4PZJ.js";
50
+ import {
51
+ TwoColumnPage
52
+ } from "./chunk-YV6MK4PZ.js";
53
+ import {
54
+ useDate
55
+ } from "./chunk-LRD242C7.js";
56
+ import {
57
+ Thumbnail
58
+ } from "./chunk-WIYFXWRI.js";
59
+ import {
60
+ Skeleton,
61
+ TwoColumnPageSkeleton
62
+ } from "./chunk-INNFZYX2.js";
63
+ import {
64
+ useMarkPaymentCollectionAsPaid
65
+ } from "./chunk-TBYCZRZ7.js";
66
+ import "./chunk-F4OJN2F2.js";
67
+ import "./chunk-LRARA622.js";
68
+ import "./chunk-M6N4ISXL.js";
69
+ import "./chunk-S7EKBD2C.js";
70
+ import "./chunk-VV6IKGCN.js";
71
+ import "./chunk-BXRNZS5K.js";
72
+ import "./chunk-BOZJOOGW.js";
73
+ import "./chunk-T6LHVNWO.js";
74
+ import "./chunk-4S6XGIC6.js";
75
+ import {
76
+ useMember
77
+ } from "./chunk-S23FD6FA.js";
78
+ import "./chunk-IQWK723D.js";
79
+ import "./chunk-DDJQRV6E.js";
80
+ import {
81
+ useCustomer
82
+ } from "./chunk-LWJF63JW.js";
83
+ import "./chunk-VXWN37PT.js";
84
+ import "./chunk-5QI3NDJG.js";
85
+ import "./chunk-VZUA5SRD.js";
86
+ import "./chunk-VXMOPVRH.js";
87
+ import {
88
+ useStockLocation
89
+ } from "./chunk-NBPMNUKZ.js";
90
+ import "./chunk-UORPTGV2.js";
91
+ import {
92
+ ordersQueryKeys,
93
+ useCancelOrder,
94
+ useCancelOrderFulfillment,
95
+ useMarkOrderFulfillmentAsDelivered,
96
+ useOrder,
97
+ useOrderChanges,
98
+ useOrderPreview,
99
+ useReservationItems
100
+ } from "./chunk-Y2MQ5EMD.js";
101
+ import "./chunk-3B34B2M2.js";
102
+ import {
103
+ ActionMenu
104
+ } from "./chunk-BDGZ4EQO.js";
105
+ import "./chunk-LAVHRER2.js";
106
+ import "./chunk-QHQWEERJ.js";
107
+ import "./chunk-Y7QKP6QU.js";
108
+ import "./chunk-JAUZ73XE.js";
109
+ import "./chunk-A5DJIOHN.js";
110
+ import {
111
+ queryClient
112
+ } from "./chunk-RHKRREUU.js";
113
+ import "./chunk-ZA2KFUFR.js";
114
+ import {
115
+ fetchQuery
116
+ } from "./chunk-RIN4CBRB.js";
117
+ import "./chunk-NBMM2TZK.js";
118
+
119
+ // src/pages/orders/[id]/loader.tsx
120
+ var orderDetailQuery = (id) => ({
121
+ queryKey: ordersQueryKeys.detail(id),
122
+ queryFn: async () => fetchQuery(`/vendor/orders/${id}`, {
123
+ method: "GET",
124
+ query: { fields: DEFAULT_FIELDS }
125
+ })
126
+ });
127
+ var loader = async ({ params }) => {
128
+ const id = params.id;
129
+ const query = orderDetailQuery(id);
130
+ return queryClient.ensureQueryData(query);
131
+ };
132
+
133
+ // src/pages/orders/[id]/order-detail-page.tsx
134
+ import { Children } from "react";
135
+ import { useLoaderData, useParams } from "react-router-dom";
136
+
137
+ // src/pages/orders/[id]/_components/active-order-claim-section/active-order-claim-section.tsx
138
+ import { ExclamationCircle } from "@medusajs/icons";
139
+ import { Button, Container, Heading, Text, toast } from "@medusajs/ui";
140
+ import { useNavigate } from "react-router-dom";
141
+ import { useTranslation } from "react-i18next";
142
+ import { jsx, jsxs } from "react/jsx-runtime";
143
+ var readClaimId = (change) => {
144
+ if (change && typeof change === "object" && "claim_id" in change && typeof change.claim_id === "string") {
145
+ return change.claim_id;
146
+ }
147
+ return void 0;
148
+ };
149
+ var ActiveOrderClaimSection = ({
150
+ orderPreview
151
+ }) => {
152
+ const { t } = useTranslation();
153
+ const navigate = useNavigate();
154
+ const claimId = readClaimId(orderPreview?.order_change);
155
+ const { mutateAsync: cancelClaim } = useCancelClaimBegin(
156
+ claimId ?? "",
157
+ orderPreview.id
158
+ );
159
+ if (!claimId) {
160
+ return null;
161
+ }
162
+ const onContinueClaim = async () => {
163
+ navigate(`/orders/${orderPreview.id}/claims/create`);
164
+ };
165
+ const onCancelClaim = async () => {
166
+ await cancelClaim(void 0, {
167
+ onSuccess: () => {
168
+ toast.success(t("orders.claims.toast.canceledSuccessfully"));
169
+ },
170
+ onError: (error) => {
171
+ toast.error(error.message);
172
+ }
173
+ });
174
+ };
175
+ return /* @__PURE__ */ jsx(
176
+ "div",
177
+ {
178
+ style: {
179
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
180
+ },
181
+ className: "-m-4 mb-1 border-b border-l p-4",
182
+ "data-testid": "active-order-claim-section",
183
+ children: /* @__PURE__ */ jsx(Container, { className: "flex items-center justify-between p-0", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row justify-between", children: [
184
+ /* @__PURE__ */ jsxs("div", { children: [
185
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2 px-6 pt-4", children: [
186
+ /* @__PURE__ */ jsx(ExclamationCircle, { className: "text-ui-fg-subtle" }),
187
+ /* @__PURE__ */ jsx(Heading, { level: "h2", children: t("orders.claims.panel.title") })
188
+ ] }),
189
+ /* @__PURE__ */ jsx("div", { className: "gap-2 px-6 pb-4", children: /* @__PURE__ */ jsx(Text, { children: t("orders.claims.panel.description") }) })
190
+ ] }),
191
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
192
+ /* @__PURE__ */ jsx(
193
+ Button,
194
+ {
195
+ size: "small",
196
+ variant: "secondary",
197
+ onClick: onCancelClaim,
198
+ "data-testid": "active-order-claim-cancel",
199
+ children: t("orders.claims.cancel.title")
200
+ }
201
+ ),
202
+ /* @__PURE__ */ jsx(
203
+ Button,
204
+ {
205
+ size: "small",
206
+ variant: "secondary",
207
+ onClick: onContinueClaim,
208
+ "data-testid": "active-order-claim-continue",
209
+ children: t("actions.continue")
210
+ }
211
+ )
212
+ ] })
213
+ ] }) })
214
+ }
215
+ );
216
+ };
217
+
218
+ // src/pages/orders/[id]/_components/active-order-exchange-section/active-order-exchange-section.tsx
219
+ import { ArrowPath } from "@medusajs/icons";
220
+ import { Button as Button2, Container as Container2, Heading as Heading2, Text as Text2, toast as toast2 } from "@medusajs/ui";
221
+ import { useNavigate as useNavigate2 } from "react-router-dom";
222
+ import { useTranslation as useTranslation2 } from "react-i18next";
223
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
224
+ var readExchangeId = (change) => {
225
+ if (change && typeof change === "object" && "exchange_id" in change && typeof change.exchange_id === "string") {
226
+ return change.exchange_id;
227
+ }
228
+ return void 0;
229
+ };
230
+ var ActiveOrderExchangeSection = ({
231
+ orderPreview
232
+ }) => {
233
+ const { t } = useTranslation2();
234
+ const navigate = useNavigate2();
235
+ const exchangeId = readExchangeId(orderPreview?.order_change);
236
+ const { mutateAsync: cancelExchange } = useCancelExchangeBegin(
237
+ exchangeId ?? "",
238
+ orderPreview.id
239
+ );
240
+ if (!exchangeId) {
241
+ return null;
242
+ }
243
+ const onContinueExchange = async () => {
244
+ navigate(`/orders/${orderPreview.id}/exchanges/create`);
245
+ };
246
+ const onCancelExchange = async () => {
247
+ await cancelExchange(void 0, {
248
+ onSuccess: () => {
249
+ toast2.success(t("orders.exchanges.toast.canceledSuccessfully"));
250
+ },
251
+ onError: (error) => {
252
+ toast2.error(error.message);
253
+ }
254
+ });
255
+ };
256
+ return /* @__PURE__ */ jsx2(
257
+ "div",
258
+ {
259
+ style: {
260
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
261
+ },
262
+ className: "-m-4 mb-1 border-b border-l p-4",
263
+ "data-testid": "active-order-exchange-section",
264
+ children: /* @__PURE__ */ jsx2(Container2, { className: "flex items-center justify-between p-0", children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-row justify-between", children: [
265
+ /* @__PURE__ */ jsxs2("div", { children: [
266
+ /* @__PURE__ */ jsxs2("div", { className: "mb-2 flex items-center gap-2 px-6 pt-4", children: [
267
+ /* @__PURE__ */ jsx2(ArrowPath, { className: "text-ui-fg-subtle" }),
268
+ /* @__PURE__ */ jsx2(Heading2, { level: "h2", children: t("orders.exchanges.panel.title") })
269
+ ] }),
270
+ /* @__PURE__ */ jsx2("div", { className: "gap-2 px-6 pb-4", children: /* @__PURE__ */ jsx2(Text2, { children: t("orders.exchanges.panel.description") }) })
271
+ ] }),
272
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
273
+ /* @__PURE__ */ jsx2(
274
+ Button2,
275
+ {
276
+ size: "small",
277
+ variant: "secondary",
278
+ onClick: onCancelExchange,
279
+ "data-testid": "active-order-exchange-cancel",
280
+ children: t("orders.exchanges.cancel.title")
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsx2(
284
+ Button2,
285
+ {
286
+ size: "small",
287
+ variant: "secondary",
288
+ onClick: onContinueExchange,
289
+ "data-testid": "active-order-exchange-continue",
290
+ children: t("actions.continue")
291
+ }
292
+ )
293
+ ] })
294
+ ] }) })
295
+ }
296
+ );
297
+ };
298
+
299
+ // src/pages/orders/[id]/_components/active-order-return-section/active-order-return-section.tsx
300
+ import { ArrowUturnLeft } from "@medusajs/icons";
301
+ import { Button as Button3, Container as Container3, Heading as Heading3, Text as Text3, toast as toast3 } from "@medusajs/ui";
302
+ import { useNavigate as useNavigate3 } from "react-router-dom";
303
+ import { useTranslation as useTranslation3 } from "react-i18next";
304
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
305
+ var readReturnId = (change) => {
306
+ if (change && typeof change === "object" && "return_id" in change && typeof change.return_id === "string") {
307
+ return change.return_id;
308
+ }
309
+ return void 0;
310
+ };
311
+ var ActiveOrderReturnSection = ({
312
+ orderPreview
313
+ }) => {
314
+ const { t } = useTranslation3();
315
+ const navigate = useNavigate3();
316
+ const orderChange = orderPreview?.order_change;
317
+ const returnId = readReturnId(orderChange);
318
+ const isReturnRequest = orderChange?.change_type === "return_request" && !!returnId;
319
+ const { mutateAsync: cancelReturn } = useCancelReturnRequest(
320
+ returnId ?? "",
321
+ orderPreview.id
322
+ );
323
+ if (!returnId || !isReturnRequest) {
324
+ return null;
325
+ }
326
+ const onContinueReturn = async () => {
327
+ navigate(`/orders/${orderPreview.id}/returns/create`);
328
+ };
329
+ const onCancelReturn = async () => {
330
+ await cancelReturn(void 0, {
331
+ onSuccess: () => {
332
+ toast3.success(t("orders.returns.toast.canceledSuccessfully"));
333
+ },
334
+ onError: (error) => {
335
+ toast3.error(error.message);
336
+ }
337
+ });
338
+ };
339
+ return /* @__PURE__ */ jsx3(
340
+ "div",
341
+ {
342
+ style: {
343
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
344
+ },
345
+ className: "-m-4 mb-1 border-b border-l p-4",
346
+ "data-testid": "active-order-return-section",
347
+ children: /* @__PURE__ */ jsx3(Container3, { className: "flex items-center justify-between p-0", children: /* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-row justify-between", children: [
348
+ /* @__PURE__ */ jsxs3("div", { children: [
349
+ /* @__PURE__ */ jsxs3("div", { className: "mb-2 flex items-center gap-2 px-6 pt-4", children: [
350
+ /* @__PURE__ */ jsx3(ArrowUturnLeft, { className: "text-ui-fg-subtle" }),
351
+ /* @__PURE__ */ jsx3(Heading3, { level: "h2", children: t("orders.returns.panel.title") })
352
+ ] }),
353
+ /* @__PURE__ */ jsx3("div", { className: "gap-2 px-6 pb-4", children: /* @__PURE__ */ jsx3(Text3, { children: t("orders.returns.panel.description") }) })
354
+ ] }),
355
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
356
+ /* @__PURE__ */ jsx3(
357
+ Button3,
358
+ {
359
+ size: "small",
360
+ variant: "secondary",
361
+ onClick: onCancelReturn,
362
+ "data-testid": "active-order-return-cancel",
363
+ children: t("orders.returns.cancel.title")
364
+ }
365
+ ),
366
+ /* @__PURE__ */ jsx3(
367
+ Button3,
368
+ {
369
+ size: "small",
370
+ variant: "secondary",
371
+ onClick: onContinueReturn,
372
+ "data-testid": "active-order-return-continue",
373
+ children: t("actions.continue")
374
+ }
375
+ )
376
+ ] })
377
+ ] }) })
378
+ }
379
+ );
380
+ };
381
+
382
+ // src/pages/orders/[id]/_components/order-active-edit-section/order-active-edit-section.tsx
383
+ import { ExclamationCircleSolid } from "@medusajs/icons";
384
+ import { Button as Button4, Container as Container4, Copy, Heading as Heading4, toast as toast4 } from "@medusajs/ui";
385
+ import { useMemo } from "react";
386
+ import { useTranslation as useTranslation4 } from "react-i18next";
387
+ import { useNavigate as useNavigate4 } from "react-router-dom";
388
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
389
+ function EditItem({
390
+ item,
391
+ quantity
392
+ }) {
393
+ return /* @__PURE__ */ jsx4("div", { className: "text-ui-fg-subtle items-center gap-x-2", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2", children: [
394
+ /* @__PURE__ */ jsxs4("div", { className: "w-fit min-w-[27px]", children: [
395
+ /* @__PURE__ */ jsx4("span", { className: "txt-small tabular-nums", children: quantity }),
396
+ "x"
397
+ ] }),
398
+ /* @__PURE__ */ jsx4(Thumbnail, { src: item.thumbnail ?? void 0 }),
399
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle font-medium", children: item.title }),
400
+ item.variant_sku && " \xB7 ",
401
+ item.variant_sku && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-1", children: [
402
+ /* @__PURE__ */ jsx4("span", { className: "txt-small", children: item.variant_sku }),
403
+ /* @__PURE__ */ jsx4(Copy, { content: item.variant_sku, className: "text-ui-fg-muted" })
404
+ ] })
405
+ ] }) });
406
+ }
407
+ var OrderActiveEditSection = ({
408
+ order
409
+ }) => {
410
+ const { t } = useTranslation4();
411
+ const navigate = useNavigate4();
412
+ const { order: orderPreview } = useOrderPreview(order.id);
413
+ const { mutateAsync: cancelOrderEdit } = useCancelOrderEdit(order.id);
414
+ const { mutateAsync: confirmOrderEdit } = useConfirmOrderEdit(order.id);
415
+ const isPending = orderPreview?.order_change?.status === "pending";
416
+ const [addedItems, removedItems] = useMemo(() => {
417
+ const added = [];
418
+ const removed = [];
419
+ const originals = order.items ?? [];
420
+ const previewItems = orderPreview?.items ?? [];
421
+ const orderLookupMap = new Map(originals.map((i) => [i.id, i]));
422
+ previewItems.forEach((currentItem) => {
423
+ const originalItem = orderLookupMap.get(currentItem.id);
424
+ if (!originalItem) {
425
+ added.push({ item: currentItem, quantity: currentItem.quantity });
426
+ return;
427
+ }
428
+ if (originalItem.quantity > currentItem.quantity) {
429
+ removed.push({
430
+ item: currentItem,
431
+ quantity: originalItem.quantity - currentItem.quantity
432
+ });
433
+ }
434
+ if (originalItem.quantity < currentItem.quantity) {
435
+ added.push({
436
+ item: currentItem,
437
+ quantity: currentItem.quantity - originalItem.quantity
438
+ });
439
+ }
440
+ });
441
+ return [added, removed];
442
+ }, [orderPreview, order.items]);
443
+ const onConfirmOrderEdit = async () => {
444
+ try {
445
+ await confirmOrderEdit();
446
+ toast4.success(t("orders.edits.toast.confirmedSuccessfully"));
447
+ } catch (e) {
448
+ toast4.error(
449
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
450
+ );
451
+ }
452
+ };
453
+ const onCancelOrderEdit = async () => {
454
+ try {
455
+ await cancelOrderEdit();
456
+ toast4.success(t("orders.edits.toast.canceledSuccessfully"));
457
+ } catch (e) {
458
+ toast4.error(
459
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
460
+ );
461
+ }
462
+ };
463
+ const change = orderPreview?.order_change;
464
+ if (!orderPreview || change?.change_type !== "edit") {
465
+ return null;
466
+ }
467
+ return /* @__PURE__ */ jsx4(
468
+ "div",
469
+ {
470
+ style: {
471
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
472
+ },
473
+ className: "-m-4 mb-1 border-b border-l p-4",
474
+ "data-testid": "order-active-edit-section",
475
+ children: /* @__PURE__ */ jsx4(Container4, { className: "flex items-center justify-between p-0", children: /* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col divide-y divide-dashed", children: [
476
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 px-6 py-4", children: [
477
+ /* @__PURE__ */ jsx4(ExclamationCircleSolid, { className: "text-blue-500" }),
478
+ /* @__PURE__ */ jsx4(Heading4, { level: "h2", children: t(
479
+ isPending ? "orders.edits.panel.titlePending" : "orders.edits.panel.title"
480
+ ) })
481
+ ] }),
482
+ !!addedItems.length && /* @__PURE__ */ jsxs4("div", { className: "txt-small text-ui-fg-subtle flex flex-row px-6 py-4", children: [
483
+ /* @__PURE__ */ jsx4("span", { className: "flex-1 font-medium", children: t("labels.added") }),
484
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-1 flex-col gap-y-2", children: addedItems.map(({ item, quantity }) => /* @__PURE__ */ jsx4(EditItem, { item, quantity }, item.id)) })
485
+ ] }),
486
+ !!removedItems.length && /* @__PURE__ */ jsxs4("div", { className: "txt-small text-ui-fg-subtle flex flex-row px-6 py-4", children: [
487
+ /* @__PURE__ */ jsx4("span", { className: "flex-1 font-medium", children: t("labels.removed") }),
488
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-1 flex-col gap-y-2", children: removedItems.map(({ item, quantity }) => /* @__PURE__ */ jsx4(EditItem, { item, quantity }, item.id)) })
489
+ ] }),
490
+ /* @__PURE__ */ jsxs4("div", { className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
491
+ isPending ? /* @__PURE__ */ jsx4(
492
+ Button4,
493
+ {
494
+ size: "small",
495
+ variant: "secondary",
496
+ onClick: () => navigate(`/orders/${order.id}/edit`),
497
+ "data-testid": "order-active-edit-continue",
498
+ children: t("actions.continueEdit")
499
+ }
500
+ ) : /* @__PURE__ */ jsx4(
501
+ Button4,
502
+ {
503
+ size: "small",
504
+ variant: "secondary",
505
+ onClick: onConfirmOrderEdit,
506
+ "data-testid": "order-active-edit-force-confirm",
507
+ children: t("actions.forceConfirm")
508
+ }
509
+ ),
510
+ /* @__PURE__ */ jsx4(
511
+ Button4,
512
+ {
513
+ size: "small",
514
+ variant: "secondary",
515
+ onClick: onCancelOrderEdit,
516
+ "data-testid": "order-active-edit-cancel",
517
+ children: t("actions.cancel")
518
+ }
519
+ )
520
+ ] })
521
+ ] }) })
522
+ }
523
+ );
524
+ };
525
+
526
+ // src/pages/orders/[id]/_components/order-activity-section/order-activity-section.tsx
527
+ import { Container as Container5, Heading as Heading5 } from "@medusajs/ui";
528
+ import { useTranslation as useTranslation15 } from "react-i18next";
529
+
530
+ // src/pages/orders/[id]/_components/order-activity-section/hooks/use-activity-items.tsx
531
+ import { useMemo as useMemo3 } from "react";
532
+ import { useTranslation as useTranslation14 } from "react-i18next";
533
+ import { Text as Text15 } from "@medusajs/ui";
534
+
535
+ // src/components/common/user-link/user-link.tsx
536
+ import { Avatar, Text as Text4 } from "@medusajs/ui";
537
+ import { Link } from "react-router-dom";
538
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
539
+ var UserLink = ({
540
+ id,
541
+ first_name,
542
+ last_name,
543
+ email,
544
+ type = "user"
545
+ }) => {
546
+ const name = [first_name, last_name].filter(Boolean).join(" ");
547
+ const fallback = name ? name.slice(0, 1) : email.slice(0, 1);
548
+ const link = type === "user" ? `/settings/users/${id}` : `/customers/${id}`;
549
+ return /* @__PURE__ */ jsxs5(
550
+ Link,
551
+ {
552
+ to: link,
553
+ className: "flex items-center gap-x-2 w-fit transition-fg hover:text-ui-fg-subtle outline-none focus-visible:shadow-borders-focus rounded-md",
554
+ children: [
555
+ /* @__PURE__ */ jsx5(Avatar, { size: "2xsmall", fallback: fallback.toUpperCase() }),
556
+ /* @__PURE__ */ jsx5(Text4, { size: "small", leading: "compact", weight: "regular", children: name || email })
557
+ ]
558
+ }
559
+ );
560
+ };
561
+ var By = ({ id }) => {
562
+ const { user } = useMember(id);
563
+ if (!user) {
564
+ return null;
565
+ }
566
+ return /* @__PURE__ */ jsx5(UserLink, { ...user });
567
+ };
568
+
569
+ // src/pages/orders/[id]/_components/order-activity-section/change-details-tooltip.tsx
570
+ import { Popover, Text as Text5 } from "@medusajs/ui";
571
+ import { useState } from "react";
572
+ import { useTranslation as useTranslation5 } from "react-i18next";
573
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
574
+ function ChangeDetailsTooltip(props) {
575
+ const { t } = useTranslation5();
576
+ const [open, setOpen] = useState(false);
577
+ const previous = props.previous;
578
+ const next = props.next;
579
+ const title = props.title;
580
+ const handleMouseEnter = () => {
581
+ setOpen(true);
582
+ };
583
+ const handleMouseLeave = () => {
584
+ setOpen(false);
585
+ };
586
+ if (!previous && !next) {
587
+ return null;
588
+ }
589
+ return /* @__PURE__ */ jsxs6(Popover, { open, children: [
590
+ /* @__PURE__ */ jsx6(
591
+ Popover.Trigger,
592
+ {
593
+ onMouseEnter: handleMouseEnter,
594
+ onMouseLeave: handleMouseLeave,
595
+ autoFocus: false,
596
+ className: "focus-visible:outline-none",
597
+ children: /* @__PURE__ */ jsx6(Text5, { size: "small", leading: "compact", weight: "plus", children: title })
598
+ }
599
+ ),
600
+ /* @__PURE__ */ jsx6(
601
+ Popover.Content,
602
+ {
603
+ align: "center",
604
+ side: "top",
605
+ className: "bg-ui-bg-component max-w-[200px] p-0 focus-visible:outline-none",
606
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
607
+ !!previous && /* @__PURE__ */ jsxs6("div", { className: "p-3", children: [
608
+ /* @__PURE__ */ jsx6("div", { className: "txt-compact-small-plus mb-1", children: t("labels.from") }),
609
+ /* @__PURE__ */ jsx6("p", { className: "txt-compact-small text-ui-fg-subtle", children: previous })
610
+ ] }),
611
+ !!next && /* @__PURE__ */ jsxs6("div", { className: "border-t-2 border-dotted p-3", children: [
612
+ /* @__PURE__ */ jsx6("div", { className: "txt-compact-small-plus mb-1", children: t("labels.to") }),
613
+ /* @__PURE__ */ jsx6("p", { className: "txt-compact-small text-ui-fg-subtle", children: next })
614
+ ] })
615
+ ] })
616
+ }
617
+ )
618
+ ] });
619
+ }
620
+ var change_details_tooltip_default = ChangeDetailsTooltip;
621
+
622
+ // src/pages/orders/[id]/_components/order-activity-section/components/fulfillment-created-body.tsx
623
+ import { Text as Text6 } from "@medusajs/ui";
624
+ import { useTranslation as useTranslation6 } from "react-i18next";
625
+ import { jsx as jsx7 } from "react/jsx-runtime";
626
+ var FulfillmentCreatedBody = ({
627
+ fulfillment
628
+ }) => {
629
+ const { t } = useTranslation6();
630
+ const numberOfItems = (fulfillment.items || []).reduce((acc, item) => {
631
+ return acc + (item.quantity || 0);
632
+ }, 0);
633
+ return /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Text6, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.fulfillment.items", {
634
+ count: numberOfItems
635
+ }) }) });
636
+ };
637
+
638
+ // src/pages/orders/[id]/_components/order-activity-section/components/return-body.tsx
639
+ import { Button as Button5, Text as Text7, usePrompt } from "@medusajs/ui";
640
+ import { useTranslation as useTranslation7 } from "react-i18next";
641
+ import { Fragment, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
642
+ var ReturnBody = ({
643
+ orderReturn,
644
+ isCreated,
645
+ isReceived
646
+ }) => {
647
+ const prompt = usePrompt();
648
+ const { t } = useTranslation7();
649
+ const { mutateAsync: cancelReturnRequest } = useCancelReturn(
650
+ orderReturn.id,
651
+ orderReturn.order_id
652
+ );
653
+ const onCancel = async () => {
654
+ const res = await prompt({
655
+ title: t("orders.returns.cancel.title"),
656
+ description: t("orders.returns.cancel.description"),
657
+ confirmText: t("actions.confirm"),
658
+ cancelText: t("actions.cancel")
659
+ });
660
+ if (!res) {
661
+ return;
662
+ }
663
+ await cancelReturnRequest();
664
+ };
665
+ const numberOfItems = (orderReturn.items ?? []).reduce((acc, item) => {
666
+ return acc + (isReceived ? item.received_quantity : item.quantity);
667
+ }, 0);
668
+ return /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-1", children: [
669
+ /* @__PURE__ */ jsx8(Text7, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.return.items", {
670
+ count: numberOfItems
671
+ }) }),
672
+ isCreated && /* @__PURE__ */ jsxs7(Fragment, { children: [
673
+ /* @__PURE__ */ jsx8("div", { className: "mt-[2px] flex items-center leading-none", children: "\u22C5" }),
674
+ /* @__PURE__ */ jsx8(
675
+ Button5,
676
+ {
677
+ onClick: onCancel,
678
+ className: "text-ui-fg-subtle h-auto px-0 leading-none hover:bg-transparent",
679
+ variant: "transparent",
680
+ size: "small",
681
+ children: t("actions.cancel")
682
+ }
683
+ )
684
+ ] })
685
+ ] });
686
+ };
687
+
688
+ // src/pages/orders/[id]/_components/order-activity-section/components/claim-body.tsx
689
+ import { Text as Text8 } from "@medusajs/ui";
690
+ import { useTranslation as useTranslation8 } from "react-i18next";
691
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
692
+ var ClaimBody = ({
693
+ claim,
694
+ claimReturn
695
+ }) => {
696
+ const { t } = useTranslation8();
697
+ const outboundItems = (claim.additional_items || []).reduce(
698
+ (acc, item) => acc + item.quantity,
699
+ 0
700
+ );
701
+ const inboundItems = (claimReturn?.items || []).reduce(
702
+ (acc, item) => acc + item.quantity,
703
+ 0
704
+ );
705
+ return /* @__PURE__ */ jsxs8("div", { children: [
706
+ outboundItems > 0 && /* @__PURE__ */ jsx9(Text8, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.claim.itemsInbound", {
707
+ count: outboundItems
708
+ }) }),
709
+ inboundItems > 0 && /* @__PURE__ */ jsx9(Text8, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.claim.itemsOutbound", {
710
+ count: inboundItems
711
+ }) })
712
+ ] });
713
+ };
714
+
715
+ // src/pages/orders/[id]/_components/order-activity-section/components/exchange-body.tsx
716
+ import { Text as Text9 } from "@medusajs/ui";
717
+ import { useTranslation as useTranslation9 } from "react-i18next";
718
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
719
+ var ExchangeBody = ({
720
+ exchange,
721
+ exchangeReturn
722
+ }) => {
723
+ const { t } = useTranslation9();
724
+ const outboundItems = (exchange.additional_items || []).reduce(
725
+ (acc, item) => acc + item.quantity,
726
+ 0
727
+ );
728
+ const inboundItems = (exchangeReturn?.items || []).reduce(
729
+ (acc, item) => acc + item.quantity,
730
+ 0
731
+ );
732
+ return /* @__PURE__ */ jsxs9("div", { children: [
733
+ outboundItems > 0 && /* @__PURE__ */ jsx10(Text9, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.exchange.itemsInbound", {
734
+ count: outboundItems
735
+ }) }),
736
+ inboundItems > 0 && /* @__PURE__ */ jsx10(Text9, { size: "small", className: "text-ui-fg-subtle", children: t("orders.activity.events.exchange.itemsOutbound", {
737
+ count: inboundItems
738
+ }) })
739
+ ] });
740
+ };
741
+
742
+ // src/pages/orders/[id]/_components/order-activity-section/components/order-edit-body.tsx
743
+ import { Text as Text10 } from "@medusajs/ui";
744
+ import { useTranslation as useTranslation10 } from "react-i18next";
745
+ import { useMemo as useMemo2 } from "react";
746
+
747
+ // src/pages/orders/[id]/_components/order-activity-section/utils/count-items-change.ts
748
+ function countItemsChange(actions) {
749
+ let added = 0;
750
+ let removed = 0;
751
+ actions.forEach((action) => {
752
+ if (action.action === "ITEM_ADD") {
753
+ added += action.details.quantity;
754
+ }
755
+ if (action.action === "ITEM_UPDATE") {
756
+ const quantityDiff = action.details.quantity_diff;
757
+ if (quantityDiff > 0) {
758
+ added += quantityDiff;
759
+ } else {
760
+ removed += Math.abs(quantityDiff);
761
+ }
762
+ }
763
+ });
764
+ return [added, removed];
765
+ }
766
+
767
+ // src/pages/orders/[id]/_components/order-activity-section/components/order-edit-body.tsx
768
+ import { jsxs as jsxs10 } from "react/jsx-runtime";
769
+ var OrderEditBody = ({ edit }) => {
770
+ const { t } = useTranslation10();
771
+ const [itemsAdded, itemsRemoved] = useMemo2(
772
+ () => countItemsChange(edit.actions),
773
+ [edit]
774
+ );
775
+ return /* @__PURE__ */ jsxs10("div", { children: [
776
+ itemsAdded > 0 && /* @__PURE__ */ jsxs10(Text10, { size: "small", className: "text-ui-fg-subtle", children: [
777
+ t("labels.added"),
778
+ ": ",
779
+ itemsAdded
780
+ ] }),
781
+ itemsRemoved > 0 && /* @__PURE__ */ jsxs10(Text10, { size: "small", className: "text-ui-fg-subtle", children: [
782
+ t("labels.removed"),
783
+ ": ",
784
+ itemsRemoved
785
+ ] })
786
+ ] });
787
+ };
788
+
789
+ // src/pages/orders/[id]/_components/order-activity-section/components/transfer-order-request-body.tsx
790
+ import { Text as Text11 } from "@medusajs/ui";
791
+ import { useTranslation as useTranslation11 } from "react-i18next";
792
+ import { jsxs as jsxs11 } from "react/jsx-runtime";
793
+ var TransferOrderRequestBody = ({
794
+ transfer
795
+ }) => {
796
+ const { t } = useTranslation11();
797
+ const action = transfer.actions[0];
798
+ const { customer } = useCustomer(action.reference_id);
799
+ return /* @__PURE__ */ jsxs11("div", { children: [
800
+ /* @__PURE__ */ jsxs11(Text11, { size: "small", className: "text-ui-fg-subtle", children: [
801
+ t("orders.activity.from"),
802
+ ": ",
803
+ String(action.details?.original_email || "")
804
+ ] }),
805
+ /* @__PURE__ */ jsxs11(Text11, { size: "small", className: "text-ui-fg-subtle", children: [
806
+ t("orders.activity.to"),
807
+ ":",
808
+ " ",
809
+ customer?.first_name ? `${customer?.first_name} ${customer?.last_name}` : customer?.email
810
+ ] })
811
+ ] });
812
+ };
813
+
814
+ // src/pages/orders/[id]/_components/order-activity-section/components/order-activity-item.tsx
815
+ import { Text as Text13, Tooltip, clx } from "@medusajs/ui";
816
+
817
+ // src/pages/orders/[id]/_components/order-activity-section/activity-items.tsx
818
+ import { Popover as Popover2, Text as Text12 } from "@medusajs/ui";
819
+ import { useState as useState2 } from "react";
820
+ import { useTranslation as useTranslation12 } from "react-i18next";
821
+ import { jsx as jsx11, jsxs as jsxs12 } from "react/jsx-runtime";
822
+ function ActivityItems(props) {
823
+ const { t } = useTranslation12();
824
+ const [open, setOpen] = useState2(false);
825
+ const itemsToSend = props.itemsToSend;
826
+ const itemsToReturn = props.itemsToReturn;
827
+ const itemsMap = props.itemsMap;
828
+ const title = props.title;
829
+ const handleMouseEnter = () => {
830
+ setOpen(true);
831
+ };
832
+ const handleMouseLeave = () => {
833
+ setOpen(false);
834
+ };
835
+ if (!itemsToSend?.length && !itemsToReturn?.length) {
836
+ return;
837
+ }
838
+ return /* @__PURE__ */ jsxs12(Popover2, { open, children: [
839
+ /* @__PURE__ */ jsx11(
840
+ Popover2.Trigger,
841
+ {
842
+ onMouseEnter: handleMouseEnter,
843
+ onMouseLeave: handleMouseLeave,
844
+ autoFocus: false,
845
+ className: "focus-visible:outline-none",
846
+ children: /* @__PURE__ */ jsx11(Text12, { size: "small", leading: "compact", weight: "plus", children: title })
847
+ }
848
+ ),
849
+ /* @__PURE__ */ jsx11(
850
+ Popover2.Content,
851
+ {
852
+ align: "center",
853
+ side: "top",
854
+ className: "bg-ui-bg-component max-w-[200px] p-0 focus-visible:outline-none",
855
+ children: /* @__PURE__ */ jsxs12("div", { className: "flex flex-col", children: [
856
+ !!itemsToSend?.length && /* @__PURE__ */ jsxs12("div", { className: "p-3", children: [
857
+ /* @__PURE__ */ jsx11("div", { className: "txt-compact-small-plus mb-1", children: t("orders.activity.events.common.toSend") }),
858
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col", children: [
859
+ itemsToSend?.map((item) => {
860
+ const originalItem = itemsMap?.get(item.item_id);
861
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-x-3", children: [
862
+ /* @__PURE__ */ jsxs12(Text12, { size: "small", className: "text-ui-fg-subtle", children: [
863
+ item.quantity,
864
+ "x"
865
+ ] }),
866
+ /* @__PURE__ */ jsx11(Thumbnail, { src: originalItem?.thumbnail }),
867
+ /* @__PURE__ */ jsx11(Text12, { className: "txt-compact-small text-ui-fg-subtle truncate", children: `${originalItem?.variant_title} \xB7 ${originalItem?.product_title}` })
868
+ ] }, item.id);
869
+ }),
870
+ /* @__PURE__ */ jsx11("div", { className: "flex flex-1 flex-row items-center gap-2" })
871
+ ] })
872
+ ] }),
873
+ !!itemsToReturn?.length && /* @__PURE__ */ jsxs12("div", { className: "border-t-2 border-dotted p-3", children: [
874
+ /* @__PURE__ */ jsx11("div", { className: "txt-compact-small-plus mb-1", children: t("orders.activity.events.common.toReturn") }),
875
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col", children: [
876
+ itemsToReturn?.map((item) => {
877
+ const originalItem = itemsMap?.get(item.item_id);
878
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-x-3", children: [
879
+ /* @__PURE__ */ jsxs12(Text12, { size: "small", className: "text-ui-fg-subtle", children: [
880
+ item.quantity,
881
+ "x"
882
+ ] }),
883
+ /* @__PURE__ */ jsx11(Thumbnail, { src: originalItem?.thumbnail }),
884
+ /* @__PURE__ */ jsx11(Text12, { className: "txt-compact-small text-ui-fg-subtle truncate", children: `${originalItem?.variant_title} \xB7 ${originalItem?.product_title}` })
885
+ ] }, item.id);
886
+ }),
887
+ /* @__PURE__ */ jsx11("div", { className: "flex flex-1 flex-row items-center gap-2" })
888
+ ] })
889
+ ] })
890
+ ] })
891
+ }
892
+ )
893
+ ] });
894
+ }
895
+ var activity_items_default = ActivityItems;
896
+
897
+ // src/pages/orders/[id]/_components/order-activity-section/components/order-activity-item.tsx
898
+ import { jsx as jsx12, jsxs as jsxs13 } from "react/jsx-runtime";
899
+ var OrderActivityItem = ({
900
+ title,
901
+ timestamp,
902
+ isFirst = false,
903
+ children,
904
+ itemsToSend,
905
+ itemsToReturn,
906
+ itemsMap
907
+ }) => {
908
+ const { getFullDate, getRelativeDate } = useDate();
909
+ return /* @__PURE__ */ jsxs13("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
910
+ /* @__PURE__ */ jsxs13("div", { className: "flex size-full flex-col items-center gap-y-0.5", children: [
911
+ /* @__PURE__ */ jsx12("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx12("div", { className: "bg-ui-bg-base shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx12("div", { className: "bg-ui-tag-neutral-icon size-1.5 rounded-full" }) }) }),
912
+ !isFirst && /* @__PURE__ */ jsx12("div", { className: "bg-ui-border-base w-px flex-1" })
913
+ ] }),
914
+ /* @__PURE__ */ jsxs13(
915
+ "div",
916
+ {
917
+ className: clx({
918
+ "pb-4": !isFirst
919
+ }),
920
+ children: [
921
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
922
+ itemsToSend?.length || itemsToReturn?.length ? /* @__PURE__ */ jsx12(
923
+ activity_items_default,
924
+ {
925
+ title,
926
+ itemsToSend,
927
+ itemsToReturn,
928
+ itemsMap
929
+ }
930
+ ) : /* @__PURE__ */ jsx12(Text13, { size: "small", leading: "compact", weight: "plus", children: title }),
931
+ timestamp && /* @__PURE__ */ jsx12(
932
+ Tooltip,
933
+ {
934
+ content: getFullDate({
935
+ date: timestamp,
936
+ includeTime: true
937
+ }),
938
+ children: /* @__PURE__ */ jsx12(
939
+ Text13,
940
+ {
941
+ size: "small",
942
+ leading: "compact",
943
+ className: "text-ui-fg-subtle text-right",
944
+ children: getRelativeDate(timestamp)
945
+ }
946
+ )
947
+ }
948
+ )
949
+ ] }),
950
+ /* @__PURE__ */ jsx12("div", { children })
951
+ ]
952
+ }
953
+ )
954
+ ] });
955
+ };
956
+
957
+ // src/pages/orders/[id]/_components/order-activity-section/components/order-activity-collapsible.tsx
958
+ import { Text as Text14 } from "@medusajs/ui";
959
+ import { Collapsible as RadixCollapsible } from "radix-ui";
960
+ import { useState as useState3 } from "react";
961
+ import { useTranslation as useTranslation13 } from "react-i18next";
962
+ import { jsx as jsx13, jsxs as jsxs14 } from "react/jsx-runtime";
963
+ var OrderActivityCollapsible = ({
964
+ activities
965
+ }) => {
966
+ const [open, setOpen] = useState3(false);
967
+ const { t } = useTranslation13();
968
+ if (!activities.length) {
969
+ return null;
970
+ }
971
+ return /* @__PURE__ */ jsxs14(RadixCollapsible.Root, { open, onOpenChange: setOpen, children: [
972
+ !open && /* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
973
+ /* @__PURE__ */ jsx13("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsx13("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-right bg-repeat-y" }) }),
974
+ /* @__PURE__ */ jsx13("div", { className: "pb-4", children: /* @__PURE__ */ jsx13(RadixCollapsible.Trigger, { className: "text-left", children: /* @__PURE__ */ jsx13(
975
+ Text14,
976
+ {
977
+ size: "small",
978
+ leading: "compact",
979
+ weight: "plus",
980
+ className: "text-ui-fg-muted",
981
+ children: t("orders.activity.showMoreActivities", {
982
+ count: activities.length
983
+ })
984
+ }
985
+ ) }) })
986
+ ] }),
987
+ /* @__PURE__ */ jsx13(RadixCollapsible.Content, { children: /* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-y-0.5", children: activities.map((item, index) => {
988
+ return /* @__PURE__ */ jsx13(
989
+ OrderActivityItem,
990
+ {
991
+ title: item.title,
992
+ timestamp: item.timestamp,
993
+ itemsToSend: item.itemsToSend,
994
+ itemsToReturn: item.itemsToReturn,
995
+ itemsMap: item.itemsMap,
996
+ children: item.children
997
+ },
998
+ index
999
+ );
1000
+ }) }) })
1001
+ ] });
1002
+ };
1003
+
1004
+ // src/pages/orders/[id]/_components/order-activity-section/hooks/use-activity-items.tsx
1005
+ import { jsx as jsx14, jsxs as jsxs15 } from "react/jsx-runtime";
1006
+ var useActivityItems = (order) => {
1007
+ const { t } = useTranslation14();
1008
+ const { order_changes: orderChanges = [] } = useOrderChanges(order.id);
1009
+ const itemsMap = useMemo3(() => {
1010
+ return new Map(
1011
+ order?.items?.map((i) => [i.id, i])
1012
+ );
1013
+ }, [order.items]);
1014
+ const { returns: returnsList = [] } = useReturns({
1015
+ order_id: order.id,
1016
+ fields: "+received_at,*items"
1017
+ });
1018
+ const { claims: claimsList = [] } = useClaims({
1019
+ order_id: order.id,
1020
+ fields: "*additional_items"
1021
+ });
1022
+ const { exchanges: exchangesList = [] } = useExchanges({
1023
+ order_id: order.id,
1024
+ fields: "*additional_items"
1025
+ });
1026
+ const returns = returnsList;
1027
+ const claims = claimsList;
1028
+ const exchanges = exchangesList;
1029
+ const isLoading = false;
1030
+ const payments = useMemo3(
1031
+ () => (order.payment_collections ?? []).flatMap(
1032
+ (pc) => pc.payments ?? []
1033
+ ),
1034
+ [order.payment_collections]
1035
+ );
1036
+ return useMemo3(() => {
1037
+ if (isLoading) {
1038
+ return [];
1039
+ }
1040
+ const items = [];
1041
+ for (const payment of payments) {
1042
+ const amount = payment.amount ?? payment.authorized_amount ?? 0;
1043
+ if (!payment.captured_at && !payment.canceled_at && payment.created_at) {
1044
+ items.push({
1045
+ title: t("orders.activity.events.payment.awaiting"),
1046
+ timestamp: payment.created_at,
1047
+ children: /* @__PURE__ */ jsx14(Text15, { size: "small", className: "text-ui-fg-subtle", children: getStylizedAmount(amount, payment.currency_code) })
1048
+ });
1049
+ }
1050
+ if (payment.captured_at) {
1051
+ items.push({
1052
+ title: t("orders.activity.events.payment.captured"),
1053
+ timestamp: payment.captured_at,
1054
+ children: /* @__PURE__ */ jsx14(Text15, { size: "small", className: "text-ui-fg-subtle", children: getStylizedAmount(amount, payment.currency_code) })
1055
+ });
1056
+ }
1057
+ if (payment.canceled_at) {
1058
+ items.push({
1059
+ title: t("orders.activity.events.payment.canceled"),
1060
+ timestamp: payment.canceled_at,
1061
+ children: /* @__PURE__ */ jsx14(Text15, { size: "small", className: "text-ui-fg-subtle", children: getStylizedAmount(amount, payment.currency_code) })
1062
+ });
1063
+ }
1064
+ for (const refund of payment.refunds ?? []) {
1065
+ items.push({
1066
+ title: t("orders.activity.events.payment.refunded"),
1067
+ timestamp: refund.created_at,
1068
+ children: /* @__PURE__ */ jsx14(Text15, { size: "small", className: "text-ui-fg-subtle", children: getStylizedAmount(
1069
+ refund.amount,
1070
+ payment.currency_code
1071
+ ) })
1072
+ });
1073
+ }
1074
+ }
1075
+ for (const fulfillment of order.fulfillments || []) {
1076
+ items.push({
1077
+ title: t("orders.activity.events.fulfillment.created"),
1078
+ timestamp: fulfillment.created_at,
1079
+ children: /* @__PURE__ */ jsx14(FulfillmentCreatedBody, { fulfillment })
1080
+ });
1081
+ if (fulfillment.delivered_at) {
1082
+ items.push({
1083
+ title: t("orders.activity.events.fulfillment.delivered"),
1084
+ timestamp: fulfillment.delivered_at,
1085
+ children: /* @__PURE__ */ jsx14(FulfillmentCreatedBody, { fulfillment })
1086
+ });
1087
+ }
1088
+ if (fulfillment.shipped_at) {
1089
+ items.push({
1090
+ title: t("orders.activity.events.fulfillment.shipped"),
1091
+ timestamp: fulfillment.shipped_at,
1092
+ children: /* @__PURE__ */ jsx14(FulfillmentCreatedBody, { fulfillment, isShipment: true })
1093
+ });
1094
+ }
1095
+ if (fulfillment.canceled_at) {
1096
+ items.push({
1097
+ title: t("orders.activity.events.fulfillment.canceled"),
1098
+ timestamp: fulfillment.canceled_at
1099
+ });
1100
+ }
1101
+ }
1102
+ const returnMap = /* @__PURE__ */ new Map();
1103
+ for (const ret of returns) {
1104
+ returnMap.set(ret.id, ret);
1105
+ if (ret.claim_id || ret.exchange_id) {
1106
+ continue;
1107
+ }
1108
+ items.push({
1109
+ title: t("orders.activity.events.return.created", {
1110
+ returnId: ret.id.slice(-7)
1111
+ }),
1112
+ timestamp: ret.created_at,
1113
+ itemsToReturn: ret?.items,
1114
+ itemsMap,
1115
+ children: /* @__PURE__ */ jsx14(ReturnBody, { orderReturn: ret, isCreated: !ret.canceled_at })
1116
+ });
1117
+ if (ret.canceled_at) {
1118
+ items.push({
1119
+ title: t("orders.activity.events.return.canceled", {
1120
+ returnId: ret.id.slice(-7)
1121
+ }),
1122
+ timestamp: ret.canceled_at
1123
+ });
1124
+ }
1125
+ if (ret.status === "received" || ret.status === "partially_received") {
1126
+ items.push({
1127
+ title: t("orders.activity.events.return.received", {
1128
+ returnId: ret.id.slice(-7)
1129
+ }),
1130
+ timestamp: ret.received_at,
1131
+ itemsToReturn: ret?.items,
1132
+ itemsMap,
1133
+ children: /* @__PURE__ */ jsx14(ReturnBody, { orderReturn: ret, isCreated: false, isReceived: true })
1134
+ });
1135
+ }
1136
+ }
1137
+ for (const claim of claims) {
1138
+ const claimReturn = returnMap.get(claim.return_id);
1139
+ items.push({
1140
+ title: t(
1141
+ claim.canceled_at ? "orders.activity.events.claim.canceled" : "orders.activity.events.claim.created",
1142
+ {
1143
+ claimId: claim.id.slice(-7)
1144
+ }
1145
+ ),
1146
+ timestamp: claim.canceled_at || claim.created_at,
1147
+ itemsToSend: claim.additional_items,
1148
+ itemsToReturn: claimReturn?.items,
1149
+ itemsMap,
1150
+ children: /* @__PURE__ */ jsx14(ClaimBody, { claim, claimReturn })
1151
+ });
1152
+ }
1153
+ for (const exchange of exchanges) {
1154
+ const exchangeReturn = returnMap.get(exchange.return_id);
1155
+ items.push({
1156
+ title: t(
1157
+ exchange.canceled_at ? "orders.activity.events.exchange.canceled" : "orders.activity.events.exchange.created",
1158
+ {
1159
+ exchangeId: exchange.id.slice(-7)
1160
+ }
1161
+ ),
1162
+ timestamp: exchange.canceled_at || exchange.created_at,
1163
+ itemsToSend: exchange.additional_items,
1164
+ itemsToReturn: exchangeReturn?.items,
1165
+ itemsMap,
1166
+ children: /* @__PURE__ */ jsx14(ExchangeBody, { exchange, exchangeReturn })
1167
+ });
1168
+ }
1169
+ for (const edit of orderChanges.filter((oc) => oc.change_type === "edit")) {
1170
+ const isConfirmed = edit.status === "confirmed";
1171
+ const isPending = edit.status === "pending";
1172
+ if (isPending) {
1173
+ continue;
1174
+ }
1175
+ const translationKey = `orders.activity.events.edit.${edit.status}`;
1176
+ items.push({
1177
+ title: t(translationKey, {
1178
+ editId: edit.id.slice(-7)
1179
+ }),
1180
+ timestamp: edit.status === "requested" ? edit.requested_at : edit.status === "confirmed" ? edit.confirmed_at : edit.status === "declined" ? edit.declined_at : edit.status === "canceled" ? edit.canceled_at : edit.created_at,
1181
+ children: isConfirmed ? /* @__PURE__ */ jsx14(OrderEditBody, { edit }) : null
1182
+ });
1183
+ }
1184
+ for (const transfer of orderChanges.filter(
1185
+ (oc) => oc.change_type === "transfer"
1186
+ )) {
1187
+ if (transfer.requested_at) {
1188
+ items.push({
1189
+ title: t(`orders.activity.events.transfer.requested`, {
1190
+ transferId: transfer.id.slice(-7)
1191
+ }),
1192
+ timestamp: transfer.requested_at,
1193
+ children: /* @__PURE__ */ jsx14(TransferOrderRequestBody, { transfer })
1194
+ });
1195
+ }
1196
+ if (transfer.confirmed_at) {
1197
+ items.push({
1198
+ title: t(`orders.activity.events.transfer.confirmed`, {
1199
+ transferId: transfer.id.slice(-7)
1200
+ }),
1201
+ timestamp: transfer.confirmed_at
1202
+ });
1203
+ }
1204
+ if (transfer.declined_at) {
1205
+ items.push({
1206
+ title: t(`orders.activity.events.transfer.declined`, {
1207
+ transferId: transfer.id.slice(-7)
1208
+ }),
1209
+ timestamp: transfer.declined_at
1210
+ });
1211
+ }
1212
+ }
1213
+ for (const update of orderChanges.filter(
1214
+ (oc) => oc.change_type === "edit"
1215
+ )) {
1216
+ const updateType = update.actions[0]?.details?.type;
1217
+ if (updateType === "shipping_address") {
1218
+ const oldAddress = update?.actions[0]?.details?.old;
1219
+ const newAddress = update?.actions[0]?.details?.new;
1220
+ items.push({
1221
+ title: /* @__PURE__ */ jsx14(
1222
+ change_details_tooltip_default,
1223
+ {
1224
+ title: t(`orders.activity.events.update_order.shipping_address`),
1225
+ previous: getFormattedAddress({
1226
+ address: oldAddress
1227
+ }).join(", "),
1228
+ next: getFormattedAddress({
1229
+ address: newAddress
1230
+ }).join(", ")
1231
+ }
1232
+ ),
1233
+ timestamp: update.created_at,
1234
+ children: update.created_by ? /* @__PURE__ */ jsxs15("div", { className: "text-ui-fg-subtle mt-2 flex gap-x-2 text-sm", children: [
1235
+ t("fields.by"),
1236
+ " ",
1237
+ /* @__PURE__ */ jsx14(By, { id: update.created_by })
1238
+ ] }) : null
1239
+ });
1240
+ }
1241
+ if (updateType === "billing_address") {
1242
+ const oldAddress = update?.actions[0]?.details?.old;
1243
+ const newAddress = update?.actions[0]?.details?.new;
1244
+ items.push({
1245
+ title: /* @__PURE__ */ jsx14(
1246
+ change_details_tooltip_default,
1247
+ {
1248
+ title: t(`orders.activity.events.update_order.billing_address`),
1249
+ previous: getFormattedAddress({
1250
+ address: oldAddress
1251
+ }).join(", "),
1252
+ next: getFormattedAddress({
1253
+ address: newAddress
1254
+ }).join(", ")
1255
+ }
1256
+ ),
1257
+ timestamp: update.created_at,
1258
+ children: update.created_by ? /* @__PURE__ */ jsxs15("div", { className: "text-ui-fg-subtle mt-2 flex gap-x-2 text-sm", children: [
1259
+ t("fields.by"),
1260
+ " ",
1261
+ /* @__PURE__ */ jsx14(By, { id: update.created_by })
1262
+ ] }) : null
1263
+ });
1264
+ }
1265
+ if (updateType === "email") {
1266
+ const oldEmail = update.actions[0]?.details?.old;
1267
+ const newEmail = update.actions[0]?.details?.new;
1268
+ items.push({
1269
+ title: /* @__PURE__ */ jsx14(
1270
+ change_details_tooltip_default,
1271
+ {
1272
+ title: t(`orders.activity.events.update_order.email`),
1273
+ previous: oldEmail,
1274
+ next: newEmail
1275
+ }
1276
+ ),
1277
+ timestamp: update.created_at,
1278
+ children: update.created_by ? /* @__PURE__ */ jsxs15("div", { className: "text-ui-fg-subtle mt-2 flex gap-x-2 text-sm", children: [
1279
+ t("fields.by"),
1280
+ " ",
1281
+ /* @__PURE__ */ jsx14(By, { id: update.created_by })
1282
+ ] }) : null
1283
+ });
1284
+ }
1285
+ }
1286
+ if (order.canceled_at) {
1287
+ items.push({
1288
+ title: t("orders.activity.events.canceled.title"),
1289
+ timestamp: order.canceled_at
1290
+ });
1291
+ }
1292
+ const sortedActivities = items.sort((a, b) => {
1293
+ return new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime();
1294
+ });
1295
+ const createdAt = {
1296
+ title: t("orders.activity.events.placed.title"),
1297
+ timestamp: order.created_at,
1298
+ children: /* @__PURE__ */ jsx14(Text15, { size: "small", className: "text-ui-fg-subtle", children: getStylizedAmount(order.total, order.currency_code) })
1299
+ };
1300
+ return [...sortedActivities, createdAt];
1301
+ }, [
1302
+ order,
1303
+ exchanges,
1304
+ orderChanges,
1305
+ payments,
1306
+ isLoading,
1307
+ itemsMap
1308
+ ]);
1309
+ };
1310
+
1311
+ // src/pages/orders/[id]/_components/order-activity-section/order-timeline.tsx
1312
+ import { jsx as jsx15, jsxs as jsxs16 } from "react/jsx-runtime";
1313
+ var OrderTimeline = ({ order }) => {
1314
+ const items = useActivityItems(order);
1315
+ if (items.length <= 3) {
1316
+ return /* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-y-0.5", children: items.map((item, index) => {
1317
+ return /* @__PURE__ */ jsx15(
1318
+ OrderActivityItem,
1319
+ {
1320
+ title: item.title,
1321
+ timestamp: item.timestamp,
1322
+ isFirst: index === items.length - 1,
1323
+ itemsToSend: item.itemsToSend,
1324
+ itemsToReturn: item.itemsToReturn,
1325
+ itemsMap: item.itemsMap,
1326
+ children: item.children
1327
+ },
1328
+ index
1329
+ );
1330
+ }) });
1331
+ }
1332
+ const lastItems = items.slice(0, 2);
1333
+ const collapsibleItems = items.slice(2, items.length - 1);
1334
+ const firstItem = items[items.length - 1];
1335
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-y-0.5", children: [
1336
+ lastItems.map((item, index) => {
1337
+ return /* @__PURE__ */ jsx15(
1338
+ OrderActivityItem,
1339
+ {
1340
+ title: item.title,
1341
+ timestamp: item.timestamp,
1342
+ itemsToSend: item.itemsToSend,
1343
+ itemsToReturn: item.itemsToReturn,
1344
+ itemsMap: item.itemsMap,
1345
+ children: item.children
1346
+ },
1347
+ index
1348
+ );
1349
+ }),
1350
+ /* @__PURE__ */ jsx15(OrderActivityCollapsible, { activities: collapsibleItems }),
1351
+ /* @__PURE__ */ jsx15(
1352
+ OrderActivityItem,
1353
+ {
1354
+ title: firstItem.title,
1355
+ timestamp: firstItem.timestamp,
1356
+ isFirst: true,
1357
+ itemsToSend: firstItem.itemsToSend,
1358
+ itemsToReturn: firstItem.itemsToReturn,
1359
+ itemsMap: firstItem.itemsMap,
1360
+ children: firstItem.children
1361
+ }
1362
+ )
1363
+ ] });
1364
+ };
1365
+
1366
+ // src/pages/orders/[id]/_components/order-activity-section/order-activity-section.tsx
1367
+ import { jsx as jsx16, jsxs as jsxs17 } from "react/jsx-runtime";
1368
+ var OrderActivitySection = ({ order }) => {
1369
+ const { t } = useTranslation15();
1370
+ return /* @__PURE__ */ jsxs17(Container5, { className: "flex flex-col gap-y-8 px-6 py-4", children: [
1371
+ /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-y-4", children: /* @__PURE__ */ jsx16("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx16(Heading5, { level: "h2", children: t("orders.activity.header") }) }) }),
1372
+ /* @__PURE__ */ jsx16(OrderTimeline, { order })
1373
+ ] });
1374
+ };
1375
+
1376
+ // src/pages/orders/[id]/_components/order-customer-section/order-customer-section.tsx
1377
+ import { Container as Container6, Heading as Heading6 } from "@medusajs/ui";
1378
+ import { useTranslation as useTranslation17 } from "react-i18next";
1379
+
1380
+ // src/components/common/customer-info/customer-info.tsx
1381
+ import { Avatar as Avatar2, Copy as Copy2, Text as Text16 } from "@medusajs/ui";
1382
+ import { useTranslation as useTranslation16 } from "react-i18next";
1383
+ import { Link as Link2 } from "react-router-dom";
1384
+ import { jsx as jsx17, jsxs as jsxs18 } from "react/jsx-runtime";
1385
+ var ID = ({ data }) => {
1386
+ const { t } = useTranslation16();
1387
+ const id = data.customer_id;
1388
+ const name = getOrderCustomer(data);
1389
+ const email = data.email;
1390
+ const fallback = (name || email || "").charAt(0).toUpperCase();
1391
+ return /* @__PURE__ */ jsxs18("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
1392
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", weight: "plus", children: t("fields.id") }),
1393
+ /* @__PURE__ */ jsx17(
1394
+ Link2,
1395
+ {
1396
+ to: `/customers/${id}`,
1397
+ className: "focus:shadow-borders-focus rounded-[4px] outline-none transition-shadow",
1398
+ children: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-x-2 overflow-hidden", children: [
1399
+ /* @__PURE__ */ jsx17(Avatar2, { size: "2xsmall", fallback }),
1400
+ /* @__PURE__ */ jsx17(
1401
+ Text16,
1402
+ {
1403
+ size: "small",
1404
+ leading: "compact",
1405
+ className: "text-ui-fg-subtle hover:text-ui-fg-base transition-fg truncate",
1406
+ children: name || email
1407
+ }
1408
+ )
1409
+ ] })
1410
+ }
1411
+ )
1412
+ ] });
1413
+ };
1414
+ var Company = ({ data }) => {
1415
+ const { t } = useTranslation16();
1416
+ const company = data.shipping_address?.company || data.billing_address?.company;
1417
+ if (!company) {
1418
+ return null;
1419
+ }
1420
+ return /* @__PURE__ */ jsxs18("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
1421
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", weight: "plus", children: t("fields.company") }),
1422
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", className: "truncate", children: company })
1423
+ ] });
1424
+ };
1425
+ var Contact = ({ data }) => {
1426
+ const { t } = useTranslation16();
1427
+ const phone = data.shipping_address?.phone || data.billing_address?.phone;
1428
+ const email = data.email || "";
1429
+ return /* @__PURE__ */ jsxs18("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4", children: [
1430
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", weight: "plus", children: t("orders.customer.contactLabel") }),
1431
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-y-2", children: [
1432
+ /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-[1fr_20px] items-start gap-x-2", children: [
1433
+ /* @__PURE__ */ jsx17(
1434
+ Text16,
1435
+ {
1436
+ size: "small",
1437
+ leading: "compact",
1438
+ className: "text-pretty break-all",
1439
+ children: email
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(Copy2, { content: email, className: "text-ui-fg-muted" }) })
1443
+ ] }),
1444
+ phone && /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-[1fr_20px] items-start gap-x-2", children: [
1445
+ /* @__PURE__ */ jsx17(
1446
+ Text16,
1447
+ {
1448
+ size: "small",
1449
+ leading: "compact",
1450
+ className: "text-pretty break-all",
1451
+ children: phone
1452
+ }
1453
+ ),
1454
+ /* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(Copy2, { content: phone, className: "text-ui-fg-muted" }) })
1455
+ ] })
1456
+ ] })
1457
+ ] });
1458
+ };
1459
+ var AddressPrint = ({
1460
+ address,
1461
+ type
1462
+ }) => {
1463
+ const { t } = useTranslation16();
1464
+ return /* @__PURE__ */ jsxs18("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4", children: [
1465
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", weight: "plus", children: type === "shipping" ? t("addresses.shippingAddress.label") : t("addresses.billingAddress.label") }),
1466
+ address ? /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-[1fr_20px] items-start gap-x-2", children: [
1467
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", children: getFormattedAddress({ address }).map((line, i) => {
1468
+ return /* @__PURE__ */ jsxs18("span", { className: "break-words", children: [
1469
+ line,
1470
+ /* @__PURE__ */ jsx17("br", {})
1471
+ ] }, i);
1472
+ }) }),
1473
+ /* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(
1474
+ Copy2,
1475
+ {
1476
+ content: getFormattedAddress({ address }).join("\n"),
1477
+ className: "text-ui-fg-muted"
1478
+ }
1479
+ ) })
1480
+ ] }) : /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", children: "-" })
1481
+ ] });
1482
+ };
1483
+ var Addresses = ({ data }) => {
1484
+ const { t } = useTranslation16();
1485
+ return /* @__PURE__ */ jsxs18("div", { className: "divide-y", children: [
1486
+ /* @__PURE__ */ jsx17(AddressPrint, { address: data.shipping_address, type: "shipping" }),
1487
+ !isSameAddress(data.shipping_address, data.billing_address) ? /* @__PURE__ */ jsx17(AddressPrint, { address: data.billing_address, type: "billing" }) : /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 items-center px-6 py-4", children: [
1488
+ /* @__PURE__ */ jsx17(
1489
+ Text16,
1490
+ {
1491
+ size: "small",
1492
+ leading: "compact",
1493
+ weight: "plus",
1494
+ className: "text-ui-fg-subtle",
1495
+ children: t("addresses.billingAddress.label")
1496
+ }
1497
+ ),
1498
+ /* @__PURE__ */ jsx17(Text16, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: t("addresses.billingAddress.sameAsShipping") })
1499
+ ] })
1500
+ ] });
1501
+ };
1502
+ var CustomerInfo = Object.assign(
1503
+ {},
1504
+ {
1505
+ ID,
1506
+ Company,
1507
+ Contact,
1508
+ Addresses
1509
+ }
1510
+ );
1511
+ var getOrderCustomer = (obj) => {
1512
+ const { first_name: sFirstName, last_name: sLastName } = obj.shipping_address || {};
1513
+ const { first_name: bFirstName, last_name: bLastName } = obj.billing_address || {};
1514
+ const { first_name: cFirstName, last_name: cLastName } = obj.customer || {};
1515
+ const customerName = [cFirstName, cLastName].filter(Boolean).join(" ");
1516
+ const shippingName = [sFirstName, sLastName].filter(Boolean).join(" ");
1517
+ const billingName = [bFirstName, bLastName].filter(Boolean).join(" ");
1518
+ const name = customerName || shippingName || billingName;
1519
+ return name;
1520
+ };
1521
+
1522
+ // src/pages/orders/[id]/_components/order-customer-section/order-customer-section.tsx
1523
+ import { jsx as jsx18, jsxs as jsxs19 } from "react/jsx-runtime";
1524
+ var OrderCustomerSection = ({ order }) => {
1525
+ return /* @__PURE__ */ jsxs19(Container6, { className: "divide-y p-0", children: [
1526
+ /* @__PURE__ */ jsx18(Header, {}),
1527
+ /* @__PURE__ */ jsx18(CustomerInfo.ID, { data: order }),
1528
+ /* @__PURE__ */ jsx18(CustomerInfo.Contact, { data: order }),
1529
+ /* @__PURE__ */ jsx18(CustomerInfo.Company, { data: order }),
1530
+ /* @__PURE__ */ jsx18(CustomerInfo.Addresses, { data: order })
1531
+ ] });
1532
+ };
1533
+ var Header = () => {
1534
+ const { t } = useTranslation17();
1535
+ return /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx18(Heading6, { level: "h2", children: t("fields.customer") }) });
1536
+ };
1537
+
1538
+ // src/pages/orders/[id]/_components/order-fulfillment-section/order-fulfillment-section.tsx
1539
+ import { XCircle } from "@medusajs/icons";
1540
+ import {
1541
+ Button as Button6,
1542
+ Container as Container7,
1543
+ Copy as Copy3,
1544
+ Heading as Heading7,
1545
+ StatusBadge,
1546
+ Text as Text17,
1547
+ Tooltip as Tooltip2,
1548
+ toast as toast5,
1549
+ usePrompt as usePrompt2
1550
+ } from "@medusajs/ui";
1551
+ import { format } from "date-fns";
1552
+ import { useTranslation as useTranslation18 } from "react-i18next";
1553
+ import { Link as Link3, useNavigate as useNavigate5 } from "react-router-dom";
1554
+ import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs20 } from "react/jsx-runtime";
1555
+ var OrderFulfillmentSection = ({
1556
+ order
1557
+ }) => {
1558
+ const fulfillments = order.fulfillments || [];
1559
+ return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-y-3", children: [
1560
+ /* @__PURE__ */ jsx19(UnfulfilledItemBreakdown, { order }),
1561
+ fulfillments.map((f, index) => /* @__PURE__ */ jsx19(Fulfillment, { index, fulfillment: f, order }, f.id))
1562
+ ] });
1563
+ };
1564
+ var UnfulfilledItem = ({
1565
+ item,
1566
+ currencyCode
1567
+ }) => {
1568
+ return /* @__PURE__ */ jsxs20(
1569
+ "div",
1570
+ {
1571
+ className: "text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4",
1572
+ children: [
1573
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-x-4", children: [
1574
+ /* @__PURE__ */ jsx19(Thumbnail, { src: item.thumbnail }),
1575
+ /* @__PURE__ */ jsxs20("div", { children: [
1576
+ /* @__PURE__ */ jsx19(
1577
+ Text17,
1578
+ {
1579
+ size: "small",
1580
+ leading: "compact",
1581
+ weight: "plus",
1582
+ className: "text-ui-fg-base",
1583
+ children: item.title
1584
+ }
1585
+ ),
1586
+ item.variant_sku && /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-x-1", children: [
1587
+ /* @__PURE__ */ jsx19(Text17, { size: "small", children: item.variant_sku }),
1588
+ /* @__PURE__ */ jsx19(Copy3, { content: item.variant_sku, className: "text-ui-fg-muted" })
1589
+ ] }),
1590
+ /* @__PURE__ */ jsx19(Text17, { size: "small", children: item.variant?.options?.map((o) => o.value).join(" \xB7 ") })
1591
+ ] })
1592
+ ] }),
1593
+ /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-3 items-center gap-x-4", children: [
1594
+ /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx19(Text17, { size: "small", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
1595
+ /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxs20(Text17, { children: [
1596
+ /* @__PURE__ */ jsx19("span", { className: "tabular-nums", children: item.quantity - item.detail.fulfilled_quantity }),
1597
+ "x"
1598
+ ] }) }),
1599
+ /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx19(Text17, { size: "small", children: getLocaleAmount(item.subtotal || 0, currencyCode) }) })
1600
+ ] })
1601
+ ]
1602
+ },
1603
+ item.id
1604
+ );
1605
+ };
1606
+ var UnfulfilledItemBreakdown = ({ order }) => {
1607
+ const unfulfilledItemsWithShipping = order.items.filter(
1608
+ (i) => i.requires_shipping && i.detail && i.quantity && i.detail.fulfilled_quantity < i.quantity
1609
+ );
1610
+ const unfulfilledItemsWithoutShipping = order.items.filter(
1611
+ (i) => !i.requires_shipping && i.detail && i.quantity && i.detail.fulfilled_quantity < i.quantity
1612
+ );
1613
+ return /* @__PURE__ */ jsxs20(Fragment2, { children: [
1614
+ !!unfulfilledItemsWithShipping.length && /* @__PURE__ */ jsx19(
1615
+ UnfulfilledItemDisplay,
1616
+ {
1617
+ order,
1618
+ unfulfilledItems: unfulfilledItemsWithShipping,
1619
+ requiresShipping: true
1620
+ }
1621
+ ),
1622
+ !!unfulfilledItemsWithoutShipping.length && /* @__PURE__ */ jsx19(
1623
+ UnfulfilledItemDisplay,
1624
+ {
1625
+ order,
1626
+ unfulfilledItems: unfulfilledItemsWithoutShipping,
1627
+ requiresShipping: false
1628
+ }
1629
+ )
1630
+ ] });
1631
+ };
1632
+ var UnfulfilledItemDisplay = ({
1633
+ order,
1634
+ unfulfilledItems,
1635
+ requiresShipping = false
1636
+ }) => {
1637
+ const { t } = useTranslation18();
1638
+ if (order.status === "canceled") {
1639
+ return;
1640
+ }
1641
+ return /* @__PURE__ */ jsxs20(Container7, { className: "divide-y p-0", children: [
1642
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between px-6 py-4", children: [
1643
+ /* @__PURE__ */ jsx19(Heading7, { level: "h2", children: t("orders.fulfillment.unfulfilledItems") }),
1644
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-x-4", children: [
1645
+ requiresShipping && /* @__PURE__ */ jsx19(StatusBadge, { color: "red", className: "text-nowrap", children: t("orders.fulfillment.requiresShipping") }),
1646
+ /* @__PURE__ */ jsx19(StatusBadge, { color: "red", className: "text-nowrap", children: t("orders.fulfillment.awaitingFulfillmentBadge") })
1647
+ ] })
1648
+ ] }),
1649
+ /* @__PURE__ */ jsx19("div", { children: unfulfilledItems.map((item) => /* @__PURE__ */ jsx19(
1650
+ UnfulfilledItem,
1651
+ {
1652
+ item,
1653
+ currencyCode: order.currency_code
1654
+ },
1655
+ item.id
1656
+ )) }),
1657
+ /* @__PURE__ */ jsx19("div", { className: "px-6 py-4 flex justify-end", children: /* @__PURE__ */ jsx19(
1658
+ Link3,
1659
+ {
1660
+ to: `/orders/${order.id}/fulfillment?requires_shipping=${requiresShipping}`,
1661
+ children: /* @__PURE__ */ jsx19(Button6, { size: "small", children: t("orders.fulfillment.fulfillItems") })
1662
+ }
1663
+ ) })
1664
+ ] });
1665
+ };
1666
+ var Fulfillment = ({
1667
+ fulfillment,
1668
+ order,
1669
+ index
1670
+ }) => {
1671
+ const { t } = useTranslation18();
1672
+ const prompt = usePrompt2();
1673
+ const navigate = useNavigate5();
1674
+ const showLocation = !!fulfillment.location_id;
1675
+ const isPickUpFulfillment = fulfillment.shipping_option?.service_zone.fulfillment_set.type === "pickup" /* Pickup */;
1676
+ const { stock_location, isError, error } = useStockLocation(
1677
+ fulfillment.location_id,
1678
+ void 0,
1679
+ {
1680
+ enabled: showLocation
1681
+ }
1682
+ );
1683
+ let statusText = fulfillment.requires_shipping ? isPickUpFulfillment ? t("orders.fulfillment.status.awaitingPickup") : t("orders.fulfillment.status.awaitingShipping") : t("orders.fulfillment.status.awaitingDelivery");
1684
+ let statusColor = "blue";
1685
+ let statusTimestamp = fulfillment.created_at;
1686
+ if (fulfillment.canceled_at) {
1687
+ statusText = t("orders.fulfillment.status.canceled");
1688
+ statusColor = "red";
1689
+ statusTimestamp = fulfillment.canceled_at;
1690
+ } else if (fulfillment.delivered_at) {
1691
+ statusText = t("orders.fulfillment.status.delivered");
1692
+ statusColor = "green";
1693
+ statusTimestamp = fulfillment.delivered_at;
1694
+ } else if (fulfillment.shipped_at) {
1695
+ statusText = t("orders.fulfillment.status.shipped");
1696
+ statusColor = "green";
1697
+ statusTimestamp = fulfillment.shipped_at;
1698
+ }
1699
+ const { mutateAsync } = useCancelOrderFulfillment(order.id, fulfillment.id);
1700
+ const { mutateAsync: markAsDelivered } = useMarkOrderFulfillmentAsDelivered(
1701
+ order.id,
1702
+ fulfillment.id
1703
+ );
1704
+ const showShippingButton = !fulfillment.canceled_at && !fulfillment.shipped_at && !fulfillment.delivered_at && fulfillment.requires_shipping && !isPickUpFulfillment;
1705
+ const showDeliveryButton = !fulfillment.canceled_at && !fulfillment.delivered_at;
1706
+ const handleMarkAsDelivered = async () => {
1707
+ const res = await prompt({
1708
+ title: t("general.areYouSure"),
1709
+ description: t("orders.fulfillment.markAsDeliveredWarning"),
1710
+ confirmText: t("actions.continue"),
1711
+ cancelText: t("actions.cancel"),
1712
+ variant: "confirmation"
1713
+ });
1714
+ if (res) {
1715
+ await markAsDelivered(void 0, {
1716
+ onSuccess: () => {
1717
+ toast5.success(
1718
+ t(
1719
+ isPickUpFulfillment ? "orders.fulfillment.toast.fulfillmentPickedUp" : "orders.fulfillment.toast.fulfillmentDelivered"
1720
+ )
1721
+ );
1722
+ },
1723
+ onError: (e) => {
1724
+ toast5.error(e.message);
1725
+ }
1726
+ });
1727
+ }
1728
+ };
1729
+ const handleCancel = async () => {
1730
+ if (fulfillment.shipped_at) {
1731
+ toast5.warning(t("orders.fulfillment.toast.fulfillmentShipped"));
1732
+ return;
1733
+ }
1734
+ const res = await prompt({
1735
+ title: t("general.areYouSure"),
1736
+ description: t("orders.fulfillment.cancelWarning"),
1737
+ confirmText: t("actions.continue"),
1738
+ cancelText: t("actions.cancel")
1739
+ });
1740
+ if (res) {
1741
+ await mutateAsync(void 0, {
1742
+ onSuccess: () => {
1743
+ toast5.success(t("orders.fulfillment.toast.canceled"));
1744
+ },
1745
+ onError: (e) => {
1746
+ toast5.error(e.message);
1747
+ }
1748
+ });
1749
+ }
1750
+ };
1751
+ if (isError) {
1752
+ throw error;
1753
+ }
1754
+ return /* @__PURE__ */ jsxs20(Container7, { className: "divide-y p-0", children: [
1755
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between px-6 py-4", children: [
1756
+ /* @__PURE__ */ jsx19(Heading7, { level: "h2", children: t("orders.fulfillment.number", {
1757
+ number: index + 1
1758
+ }) }),
1759
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-x-4", children: [
1760
+ /* @__PURE__ */ jsx19(
1761
+ Tooltip2,
1762
+ {
1763
+ content: format(
1764
+ new Date(statusTimestamp),
1765
+ "dd MMM, yyyy, HH:mm:ss"
1766
+ ),
1767
+ children: /* @__PURE__ */ jsx19(StatusBadge, { color: statusColor, className: "text-nowrap", children: statusText })
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ jsx19(
1771
+ ActionMenu,
1772
+ {
1773
+ groups: [
1774
+ {
1775
+ actions: [
1776
+ {
1777
+ label: t("actions.cancel"),
1778
+ icon: /* @__PURE__ */ jsx19(XCircle, {}),
1779
+ onClick: handleCancel,
1780
+ disabled: !!fulfillment.canceled_at
1781
+ }
1782
+ ]
1783
+ }
1784
+ ]
1785
+ }
1786
+ )
1787
+ ] })
1788
+ ] }),
1789
+ /* @__PURE__ */ jsxs20("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4", children: [
1790
+ /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", weight: "plus", children: t("orders.fulfillment.itemsLabel") }),
1791
+ /* @__PURE__ */ jsx19("ul", { children: (fulfillment.items || []).map((f_item) => /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsxs20(Text17, { size: "small", leading: "compact", children: [
1792
+ f_item.quantity,
1793
+ "x ",
1794
+ f_item.title
1795
+ ] }) }, f_item.line_item_id)) })
1796
+ ] }),
1797
+ showLocation && /* @__PURE__ */ jsxs20("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
1798
+ /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", weight: "plus", children: t("orders.fulfillment.shippingFromLabel") }),
1799
+ stock_location ? /* @__PURE__ */ jsx19(
1800
+ Link3,
1801
+ {
1802
+ to: `/settings/locations/${stock_location.id}`,
1803
+ className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover transition-fg",
1804
+ children: /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", children: stock_location.name })
1805
+ }
1806
+ ) : /* @__PURE__ */ jsx19(Skeleton, { className: "w-16" })
1807
+ ] }),
1808
+ /* @__PURE__ */ jsxs20("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4", children: [
1809
+ /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", weight: "plus", children: t("fields.provider") }),
1810
+ /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", children: formatProvider(fulfillment.provider_id) })
1811
+ ] }),
1812
+ /* @__PURE__ */ jsxs20("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4", children: [
1813
+ /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", weight: "plus", children: t("orders.fulfillment.trackingLabel") }),
1814
+ /* @__PURE__ */ jsx19("div", { children: fulfillment.labels && fulfillment.labels.length > 0 ? /* @__PURE__ */ jsx19("ul", { children: fulfillment.labels.map((tlink) => {
1815
+ const hasUrl = !!tlink.tracking_url?.length && tlink.tracking_url !== "#";
1816
+ if (hasUrl) {
1817
+ return /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsx19(
1818
+ "a",
1819
+ {
1820
+ href: tlink.tracking_url || "",
1821
+ target: "_blank",
1822
+ rel: "noopener noreferrer",
1823
+ className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover transition-fg",
1824
+ children: /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", children: tlink.tracking_number })
1825
+ }
1826
+ ) }, tlink.tracking_number);
1827
+ }
1828
+ return /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", children: tlink.tracking_number }) }, tlink.tracking_number);
1829
+ }) }) : /* @__PURE__ */ jsx19(Text17, { size: "small", leading: "compact", children: "-" }) })
1830
+ ] }),
1831
+ (showShippingButton || showDeliveryButton) && /* @__PURE__ */ jsxs20("div", { className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
1832
+ showDeliveryButton && /* @__PURE__ */ jsx19(
1833
+ Button6,
1834
+ {
1835
+ size: "small",
1836
+ onClick: handleMarkAsDelivered,
1837
+ variant: "secondary",
1838
+ children: t(
1839
+ isPickUpFulfillment ? "orders.fulfillment.markAsPickedUp" : "orders.fulfillment.markAsDelivered"
1840
+ )
1841
+ }
1842
+ ),
1843
+ showShippingButton && /* @__PURE__ */ jsx19(
1844
+ Button6,
1845
+ {
1846
+ size: "small",
1847
+ onClick: () => navigate(`./${fulfillment.id}/create-shipment`),
1848
+ variant: "secondary",
1849
+ children: t("orders.fulfillment.markAsShipped")
1850
+ }
1851
+ )
1852
+ ] })
1853
+ ] });
1854
+ };
1855
+
1856
+ // src/pages/orders/[id]/_components/order-general-section/order-general-section.tsx
1857
+ import { XCircle as XCircle2 } from "@medusajs/icons";
1858
+ import {
1859
+ Container as Container8,
1860
+ Copy as Copy4,
1861
+ Heading as Heading8,
1862
+ StatusBadge as StatusBadge2,
1863
+ Text as Text18,
1864
+ toast as toast6,
1865
+ usePrompt as usePrompt3
1866
+ } from "@medusajs/ui";
1867
+ import { useTranslation as useTranslation19 } from "react-i18next";
1868
+ import { jsx as jsx20, jsxs as jsxs21 } from "react/jsx-runtime";
1869
+ var OrderGeneralSection = ({ order }) => {
1870
+ const { t } = useTranslation19();
1871
+ const prompt = usePrompt3();
1872
+ const { getFullDate } = useDate();
1873
+ const { mutateAsync: cancelOrder } = useCancelOrder(order.id);
1874
+ const hasAnyFulfilledItem = order.items?.some(
1875
+ // @ts-ignore — detail.fulfilled_quantity is exposed via Mercur query-config
1876
+ (i) => (i.detail?.fulfilled_quantity ?? 0) > 0
1877
+ );
1878
+ const cancelDisabled = !!order.canceled_at || !!hasAnyFulfilledItem;
1879
+ const cancelDisabledTooltip = order.canceled_at ? void 0 : hasAnyFulfilledItem ? t("orders.actions.cancelDisabledFulfilled") : void 0;
1880
+ const handleCancel = async () => {
1881
+ const res = await prompt({
1882
+ title: t("general.areYouSure"),
1883
+ description: t("orders.cancelWarning", {
1884
+ id: `#${order.display_id}`
1885
+ }),
1886
+ confirmText: t("actions.continue"),
1887
+ cancelText: t("actions.cancel")
1888
+ });
1889
+ if (!res) {
1890
+ return;
1891
+ }
1892
+ await cancelOrder(void 0, {
1893
+ onSuccess: () => {
1894
+ toast6.success(t("orders.orderCanceled"));
1895
+ },
1896
+ onError: (e) => {
1897
+ toast6.error(e.message);
1898
+ }
1899
+ });
1900
+ };
1901
+ return /* @__PURE__ */ jsxs21(Container8, { className: "flex items-center justify-between px-6 py-4", children: [
1902
+ /* @__PURE__ */ jsxs21("div", { children: [
1903
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-x-1", children: [
1904
+ /* @__PURE__ */ jsxs21(Heading8, { children: [
1905
+ "#",
1906
+ order.display_id
1907
+ ] }),
1908
+ /* @__PURE__ */ jsx20(Copy4, { content: `#${order.display_id}`, className: "text-ui-fg-muted" })
1909
+ ] }),
1910
+ /* @__PURE__ */ jsx20(Text18, { size: "small", className: "text-ui-fg-subtle", children: t("orders.onDateFromSalesChannel", {
1911
+ date: getFullDate({ date: order.created_at, includeTime: true }),
1912
+ salesChannel: order.sales_channel?.name
1913
+ }) })
1914
+ ] }),
1915
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-x-4", children: [
1916
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-x-1.5", children: [
1917
+ /* @__PURE__ */ jsx20(OrderBadge, { order }),
1918
+ /* @__PURE__ */ jsx20(PaymentBadge, { order }),
1919
+ /* @__PURE__ */ jsx20(FulfillmentBadge, { order })
1920
+ ] }),
1921
+ /* @__PURE__ */ jsx20(
1922
+ ActionMenu,
1923
+ {
1924
+ groups: [
1925
+ {
1926
+ actions: [
1927
+ {
1928
+ label: t("actions.cancel"),
1929
+ onClick: handleCancel,
1930
+ disabled: cancelDisabled,
1931
+ disabledTooltip: cancelDisabledTooltip,
1932
+ icon: /* @__PURE__ */ jsx20(XCircle2, {})
1933
+ }
1934
+ ]
1935
+ }
1936
+ ]
1937
+ }
1938
+ )
1939
+ ] })
1940
+ ] });
1941
+ };
1942
+ var FulfillmentBadge = ({ order }) => {
1943
+ const { t } = useTranslation19();
1944
+ if (!order.fulfillment_status) {
1945
+ return null;
1946
+ }
1947
+ const { label, color } = getOrderFulfillmentStatus(
1948
+ t,
1949
+ order.fulfillment_status
1950
+ );
1951
+ return /* @__PURE__ */ jsx20(StatusBadge2, { color, className: "text-nowrap", children: label });
1952
+ };
1953
+ var PaymentBadge = ({ order }) => {
1954
+ const { t } = useTranslation19();
1955
+ if (!order.payment_status) {
1956
+ return null;
1957
+ }
1958
+ const { label, color } = getOrderPaymentStatus(t, order.payment_status);
1959
+ return /* @__PURE__ */ jsx20(StatusBadge2, { color, className: "text-nowrap", children: label });
1960
+ };
1961
+ var OrderBadge = ({ order }) => {
1962
+ const { t } = useTranslation19();
1963
+ const orderStatus = getCanceledOrderStatus(t, order.status);
1964
+ if (!orderStatus) {
1965
+ return null;
1966
+ }
1967
+ return /* @__PURE__ */ jsx20(StatusBadge2, { color: orderStatus.color, className: "text-nowrap", children: orderStatus.label });
1968
+ };
1969
+
1970
+ // src/pages/orders/[id]/_components/order-payment-section/order-payment-section.tsx
1971
+ import { ArrowUturnLeft as ArrowUturnLeft2, DocumentText } from "@medusajs/icons";
1972
+ import {
1973
+ Badge,
1974
+ Container as Container9,
1975
+ Heading as Heading9,
1976
+ StatusBadge as StatusBadge3,
1977
+ Text as Text19,
1978
+ Tooltip as Tooltip3
1979
+ } from "@medusajs/ui";
1980
+ import { useTranslation as useTranslation20 } from "react-i18next";
1981
+
1982
+ // src/lib/payment.ts
1983
+ var getTotalCaptured = (paymentCollections) => paymentCollections.reduce((acc, paymentCollection) => {
1984
+ acc = acc + (paymentCollection.captured_amount - paymentCollection.refunded_amount);
1985
+ return acc;
1986
+ }, 0);
1987
+ var getTotalPending = (paymentCollections) => paymentCollections.filter((pc) => pc.status !== "canceled").reduce((acc, paymentCollection) => {
1988
+ acc += paymentCollection.amount - paymentCollection.captured_amount;
1989
+ return acc;
1990
+ }, 0);
1991
+
1992
+ // src/pages/orders/[id]/_components/order-payment-section/order-payment-section.tsx
1993
+ import { jsx as jsx21, jsxs as jsxs22 } from "react/jsx-runtime";
1994
+ var getPaymentsFromOrder = (order) => {
1995
+ return order.payment_collections?.map((collection) => collection.payments).flat(1).filter(Boolean);
1996
+ };
1997
+ var OrderPaymentSection = ({ order }) => {
1998
+ const payments = getPaymentsFromOrder(order) ?? [];
1999
+ return /* @__PURE__ */ jsxs22(Container9, { className: "divide-y p-0", children: [
2000
+ /* @__PURE__ */ jsx21(Header2, { order }),
2001
+ payments.length > 0 && /* @__PURE__ */ jsx21("ul", { className: "divide-y", children: payments.map((payment) => /* @__PURE__ */ jsx21(PaymentRow, { order, payment }, payment.id)) }),
2002
+ /* @__PURE__ */ jsx21(Total, { order })
2003
+ ] });
2004
+ };
2005
+ var Header2 = ({ order }) => {
2006
+ const { t } = useTranslation20();
2007
+ return /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-6 py-4", children: [
2008
+ /* @__PURE__ */ jsx21(Heading9, { level: "h2", children: t("orders.payment.title") }),
2009
+ order.payment_status && /* @__PURE__ */ jsx21(
2010
+ StatusBadge3,
2011
+ {
2012
+ color: getOrderPaymentStatus(t, order.payment_status).color,
2013
+ className: "text-nowrap",
2014
+ children: getOrderPaymentStatus(t, order.payment_status).label
2015
+ }
2016
+ )
2017
+ ] });
2018
+ };
2019
+ var Total = ({ order }) => {
2020
+ const { t } = useTranslation20();
2021
+ if (!order.payment_collections?.length) {
2022
+ return null;
2023
+ }
2024
+ const paymentCollections = order.payment_collections;
2025
+ const totalCaptured = getTotalCaptured(paymentCollections);
2026
+ const totalPending = getTotalPending(paymentCollections);
2027
+ const totalRefunded = paymentCollections.reduce(
2028
+ (acc, pc) => acc + (pc.refunded_amount || 0),
2029
+ 0
2030
+ );
2031
+ return /* @__PURE__ */ jsxs22("div", { children: [
2032
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-6 py-4", children: [
2033
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: t("orders.payment.totalPaidByCustomer") }),
2034
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: getStylizedAmount(totalCaptured, order.currency_code) })
2035
+ ] }),
2036
+ totalRefunded > 0 && /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-6 py-4", children: [
2037
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: t("orders.payment.totalRefunded") }),
2038
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: getStylizedAmount(totalRefunded, order.currency_code) })
2039
+ ] }),
2040
+ order.status !== "canceled" && totalPending > 0 && /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-6 py-4", children: [
2041
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: t("orders.payment.totalPending") }),
2042
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: getStylizedAmount(totalPending, order.currency_code) })
2043
+ ] })
2044
+ ] });
2045
+ };
2046
+ var getPaymentStatus = (payment) => {
2047
+ const refundedAmount = (payment.refunds ?? []).reduce(
2048
+ (acc, r) => acc + (r.amount ?? 0),
2049
+ 0
2050
+ );
2051
+ if (payment.canceled_at) {
2052
+ return { label: "Canceled", color: "red" };
2053
+ }
2054
+ if (refundedAmount > 0 && refundedAmount >= payment.amount) {
2055
+ return { label: "Refunded", color: "grey" };
2056
+ }
2057
+ if (refundedAmount > 0) {
2058
+ return { label: "Partly refunded", color: "orange" };
2059
+ }
2060
+ if (payment.captured_at) {
2061
+ return { label: "Captured", color: "green" };
2062
+ }
2063
+ return { label: "Pending", color: "orange" };
2064
+ };
2065
+ var PaymentRow = ({
2066
+ order,
2067
+ payment
2068
+ }) => {
2069
+ const { t } = useTranslation20();
2070
+ const { getFullDate } = useDate();
2071
+ const status = getPaymentStatus(payment);
2072
+ const refunds = payment.refunds ?? [];
2073
+ const refundedAmount = refunds.reduce(
2074
+ (acc, r) => acc + (r.amount ?? 0),
2075
+ 0
2076
+ );
2077
+ const isFullyRefunded = refundedAmount > 0 && refundedAmount >= payment.amount;
2078
+ const canRefund = !!payment.captured_at && !payment.canceled_at && !isFullyRefunded;
2079
+ return /* @__PURE__ */ jsxs22("li", { "data-testid": `payment-row-${payment.id}`, children: [
2080
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-6 py-4", children: [
2081
+ /* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 flex-col", children: [
2082
+ /* @__PURE__ */ jsx21(Tooltip3, { content: payment.id, children: /* @__PURE__ */ jsx21(
2083
+ Text19,
2084
+ {
2085
+ size: "small",
2086
+ weight: "plus",
2087
+ leading: "compact",
2088
+ className: isFullyRefunded ? "text-ui-fg-muted truncate line-through" : "text-ui-fg-base truncate",
2089
+ children: `#${payment.id.slice(-7)}`
2090
+ }
2091
+ ) }),
2092
+ /* @__PURE__ */ jsx21(
2093
+ Text19,
2094
+ {
2095
+ size: "xsmall",
2096
+ leading: "compact",
2097
+ className: isFullyRefunded ? "text-ui-fg-muted line-through" : "text-ui-fg-subtle",
2098
+ children: payment.created_at ? getFullDate({ date: payment.created_at, includeTime: true }) : null
2099
+ }
2100
+ )
2101
+ ] }),
2102
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-x-3", children: [
2103
+ /* @__PURE__ */ jsx21(StatusBadge3, { color: status.color, className: "text-nowrap", children: status.label }),
2104
+ /* @__PURE__ */ jsx21(
2105
+ Text19,
2106
+ {
2107
+ size: "small",
2108
+ weight: "plus",
2109
+ leading: "compact",
2110
+ className: isFullyRefunded ? "line-through" : void 0,
2111
+ children: getStylizedAmount(payment.amount, order.currency_code)
2112
+ }
2113
+ ),
2114
+ /* @__PURE__ */ jsx21(
2115
+ ActionMenu,
2116
+ {
2117
+ groups: [
2118
+ {
2119
+ actions: [
2120
+ {
2121
+ label: t("orders.payment.createRefund"),
2122
+ icon: /* @__PURE__ */ jsx21(ArrowUturnLeft2, {}),
2123
+ to: `/orders/${order.id}/refund?payment_id=${payment.id}`,
2124
+ disabled: !canRefund
2125
+ }
2126
+ ]
2127
+ }
2128
+ ]
2129
+ }
2130
+ )
2131
+ ] })
2132
+ ] }),
2133
+ refunds.map((refund) => /* @__PURE__ */ jsx21(
2134
+ RefundRow,
2135
+ {
2136
+ refund,
2137
+ currencyCode: order.currency_code
2138
+ },
2139
+ refund.id
2140
+ ))
2141
+ ] });
2142
+ };
2143
+ var RefundRow = ({
2144
+ refund,
2145
+ currencyCode
2146
+ }) => {
2147
+ const { t } = useTranslation20();
2148
+ const { getFullDate } = useDate();
2149
+ const reasonLabel = refund.refund_reason?.label ?? null;
2150
+ return /* @__PURE__ */ jsxs22(
2151
+ "div",
2152
+ {
2153
+ className: "flex items-center justify-between px-6 py-3 pl-12 bg-ui-bg-subtle",
2154
+ "data-testid": `refund-row-${refund.id}`,
2155
+ children: [
2156
+ /* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 flex-col", children: [
2157
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-x-2", children: [
2158
+ /* @__PURE__ */ jsx21(Text19, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("orders.payment.refund") }),
2159
+ reasonLabel && /* @__PURE__ */ jsx21(Badge, { size: "2xsmall", rounded: "full", children: reasonLabel }),
2160
+ refund.note && /* @__PURE__ */ jsx21(Tooltip3, { content: refund.note, children: /* @__PURE__ */ jsx21(DocumentText, { className: "text-ui-fg-subtle h-3 w-3" }) })
2161
+ ] }),
2162
+ refund.created_at && /* @__PURE__ */ jsx21(Text19, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: getFullDate({ date: refund.created_at, includeTime: true }) })
2163
+ ] }),
2164
+ /* @__PURE__ */ jsx21(Text19, { size: "small", weight: "plus", leading: "compact", children: `- ${getLocaleAmount(refund.amount ?? 0, currencyCode)}` })
2165
+ ]
2166
+ }
2167
+ );
2168
+ };
2169
+
2170
+ // src/pages/orders/[id]/_components/order-summary-section/order-summary-section.tsx
2171
+ import { useMemo as useMemo4, useState as useState5 } from "react";
2172
+ import { useTranslation as useTranslation23 } from "react-i18next";
2173
+ import { Link as Link4 } from "react-router-dom";
2174
+ import {
2175
+ ArrowDownRightMini,
2176
+ ArrowLongRight,
2177
+ ArrowPath as ArrowPath2,
2178
+ ArrowUturnLeft as ArrowUturnLeft3,
2179
+ DocumentText as DocumentText2,
2180
+ ExclamationCircle as ExclamationCircle2,
2181
+ PencilSquare,
2182
+ TriangleDownMini
2183
+ } from "@medusajs/icons";
2184
+ import {
2185
+ Badge as Badge4,
2186
+ Button as Button7,
2187
+ clx as clx2,
2188
+ Container as Container10,
2189
+ Copy as Copy5,
2190
+ Heading as Heading10,
2191
+ StatusBadge as StatusBadge4,
2192
+ Text as Text21,
2193
+ Tooltip as Tooltip5,
2194
+ toast as toast7
2195
+ } from "@medusajs/ui";
2196
+
2197
+ // src/lib/orders.ts
2198
+ function getReservationsLimitCount(order) {
2199
+ if (!order?.items?.length) {
2200
+ return 0;
2201
+ }
2202
+ return order.items.reduce(
2203
+ (acc, item) => acc + (item.variant?.inventory_items?.length || 1),
2204
+ 0
2205
+ );
2206
+ }
2207
+
2208
+ // src/pages/orders/[id]/_components/order-summary-section/return-info-popover.tsx
2209
+ import { useState as useState4 } from "react";
2210
+ import { useTranslation as useTranslation21 } from "react-i18next";
2211
+ import { InformationCircleSolid } from "@medusajs/icons";
2212
+ import { Badge as Badge2, Popover as Popover3, Text as Text20 } from "@medusajs/ui";
2213
+ import { jsx as jsx22, jsxs as jsxs23 } from "react/jsx-runtime";
2214
+ function ReturnInfoPopover({ orderReturn }) {
2215
+ const { t } = useTranslation21();
2216
+ const { getFullDate } = useDate();
2217
+ const [open, setOpen] = useState4(false);
2218
+ if (typeof orderReturn !== "object") {
2219
+ return null;
2220
+ }
2221
+ let returnType = "Return";
2222
+ let returnTypeId = orderReturn.id;
2223
+ if (orderReturn.claim_id) {
2224
+ returnType = "Claim";
2225
+ returnTypeId = orderReturn.claim_id;
2226
+ }
2227
+ if (orderReturn.exchange_id) {
2228
+ returnType = "Exchange";
2229
+ returnTypeId = orderReturn.exchange_id;
2230
+ }
2231
+ return /* @__PURE__ */ jsxs23(Popover3, { open, children: [
2232
+ /* @__PURE__ */ jsx22(
2233
+ Popover3.Trigger,
2234
+ {
2235
+ onMouseEnter: () => setOpen(true),
2236
+ onMouseLeave: () => setOpen(false),
2237
+ autoFocus: false,
2238
+ className: "align-sub focus-visible:outline-none",
2239
+ "data-testid": "order-summary-return-info-trigger",
2240
+ children: /* @__PURE__ */ jsx22(InformationCircleSolid, {})
2241
+ }
2242
+ ),
2243
+ /* @__PURE__ */ jsx22(
2244
+ Popover3.Content,
2245
+ {
2246
+ align: "center",
2247
+ side: "top",
2248
+ className: "bg-ui-bg-component p-2 focus-visible:outline-none",
2249
+ children: /* @__PURE__ */ jsxs23("div", { children: [
2250
+ /* @__PURE__ */ jsxs23(Badge2, { size: "2xsmall", className: "mb-2", rounded: "full", children: [
2251
+ returnType,
2252
+ ": #",
2253
+ returnTypeId.slice(-7)
2254
+ ] }),
2255
+ /* @__PURE__ */ jsxs23(Text20, { size: "xsmall", children: [
2256
+ /* @__PURE__ */ jsx22("span", { className: "text-ui-fg-subtle", children: t("orders.returns.returnRequested") }),
2257
+ " \xB7 ",
2258
+ getFullDate({
2259
+ date: orderReturn.requested_at,
2260
+ includeTime: true
2261
+ })
2262
+ ] }),
2263
+ /* @__PURE__ */ jsxs23(Text20, { size: "xsmall", children: [
2264
+ /* @__PURE__ */ jsx22("span", { className: "text-ui-fg-subtle", children: t("orders.returns.itemReceived") }),
2265
+ " \xB7 ",
2266
+ orderReturn.received_at ? getFullDate({
2267
+ date: orderReturn.received_at,
2268
+ includeTime: true
2269
+ }) : "-"
2270
+ ] })
2271
+ ] })
2272
+ }
2273
+ )
2274
+ ] });
2275
+ }
2276
+ var return_info_popover_default = ReturnInfoPopover;
2277
+
2278
+ // src/pages/orders/[id]/_components/order-summary-section/shipping-info-popover.tsx
2279
+ import { InformationCircleSolid as InformationCircleSolid2 } from "@medusajs/icons";
2280
+ import { Badge as Badge3, Tooltip as Tooltip4 } from "@medusajs/ui";
2281
+ import { useTranslation as useTranslation22 } from "react-i18next";
2282
+ import { jsx as jsx23, jsxs as jsxs24 } from "react/jsx-runtime";
2283
+ function ShippingInfoPopover({ shippingMethod }) {
2284
+ const { t } = useTranslation22();
2285
+ const shippingDetail = shippingMethod?.detail;
2286
+ if (!shippingDetail) {
2287
+ return;
2288
+ }
2289
+ let rmaType = t("orders.return");
2290
+ let rmaId = shippingDetail.return_id;
2291
+ if (shippingDetail.claim_id) {
2292
+ rmaType = t("orders.claim");
2293
+ rmaId = shippingDetail.claim_id;
2294
+ }
2295
+ if (shippingDetail.exchange_id) {
2296
+ rmaType = t("orders.exchange");
2297
+ rmaId = shippingDetail.exchange_id;
2298
+ }
2299
+ if (!rmaId) {
2300
+ return;
2301
+ }
2302
+ return /* @__PURE__ */ jsx23(
2303
+ Tooltip4,
2304
+ {
2305
+ content: /* @__PURE__ */ jsxs24(Badge3, { size: "2xsmall", rounded: "full", children: [
2306
+ rmaType,
2307
+ ": #",
2308
+ rmaId.slice(-7)
2309
+ ] }),
2310
+ children: /* @__PURE__ */ jsx23(InformationCircleSolid2, { className: "inline-block text-ui-fg-muted ml-1" })
2311
+ }
2312
+ );
2313
+ }
2314
+ var shipping_info_popover_default = ShippingInfoPopover;
2315
+
2316
+ // src/pages/orders/[id]/_components/order-summary-section/order-summary-section.tsx
2317
+ import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs25 } from "react/jsx-runtime";
2318
+ var OrderSummarySection = ({
2319
+ order
2320
+ }) => {
2321
+ const { t } = useTranslation23();
2322
+ const { reservations } = useReservationItems(
2323
+ {
2324
+ line_item_id: order?.items?.map((i) => i.id),
2325
+ limit: getReservationsLimitCount(order)
2326
+ },
2327
+ { enabled: Array.isArray(order?.items) }
2328
+ );
2329
+ const { order: orderPreview } = useOrderPreview(order.id);
2330
+ const reservationList = useMemo4(
2331
+ () => reservations ?? [],
2332
+ [reservations]
2333
+ );
2334
+ const { returns: receivableReturnsList = [] } = useReturns({
2335
+ status: "requested",
2336
+ order_id: order.id,
2337
+ fields: "+received_at"
2338
+ });
2339
+ const receivableReturns = useMemo4(
2340
+ () => receivableReturnsList.filter((r) => !r.canceled_at),
2341
+ [receivableReturnsList]
2342
+ );
2343
+ const showReturns = !!receivableReturns.length;
2344
+ const showAllocateButton = useMemo4(() => {
2345
+ if (!reservations) {
2346
+ return false;
2347
+ }
2348
+ const reservationsMap = new Map(
2349
+ reservationList.map((r) => [r.line_item_id, r.id])
2350
+ );
2351
+ return order.items?.some((item) => {
2352
+ const offerLinks = item.offer?.inventory_item_link;
2353
+ if (!offerLinks?.length) {
2354
+ return false;
2355
+ }
2356
+ const fulfilled = item.detail?.fulfilled_quantity ?? 0;
2357
+ if (item.quantity - fulfilled <= 0) {
2358
+ return false;
2359
+ }
2360
+ return !reservationsMap.has(item.id);
2361
+ }) ?? false;
2362
+ }, [order.items, reservations, reservationList]);
2363
+ const unpaidPaymentCollection = order.payment_collections?.find(
2364
+ (pc) => pc.status !== "captured" && pc.status !== "canceled"
2365
+ );
2366
+ const pendingDifference = order.summary?.pending_difference || 0;
2367
+ const isAmountSignificant = !isAmountLessThenRoundingError(
2368
+ pendingDifference,
2369
+ order.currency_code
2370
+ );
2371
+ const showRefund = unpaidPaymentCollection && pendingDifference < 0 && isAmountSignificant;
2372
+ return /* @__PURE__ */ jsxs25(Container10, { className: "divide-y p-0", children: [
2373
+ /* @__PURE__ */ jsx24(Header3, { order, orderPreview }),
2374
+ /* @__PURE__ */ jsx24(ItemBreakdown, { order, reservations: reservationList }),
2375
+ /* @__PURE__ */ jsx24(CostBreakdown, { order }),
2376
+ /* @__PURE__ */ jsx24(Total2, { order }),
2377
+ (showReturns || showRefund || showAllocateButton) && /* @__PURE__ */ jsxs25("div", { className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
2378
+ showReturns && (receivableReturns.length === 1 ? /* @__PURE__ */ jsx24(Button7, { asChild: true, variant: "secondary", size: "small", children: /* @__PURE__ */ jsx24(
2379
+ Link4,
2380
+ {
2381
+ to: `/orders/${order.id}/returns/${receivableReturns[0].id}/receive`,
2382
+ children: t("orders.returns.receive.action")
2383
+ }
2384
+ ) }) : /* @__PURE__ */ jsx24(
2385
+ ActionMenu,
2386
+ {
2387
+ groups: [
2388
+ {
2389
+ actions: receivableReturns.map((r) => {
2390
+ let id = r.id;
2391
+ let returnType = "Return";
2392
+ if (r.exchange_id) {
2393
+ id = r.exchange_id;
2394
+ returnType = "Exchange";
2395
+ }
2396
+ if (r.claim_id) {
2397
+ id = r.claim_id;
2398
+ returnType = "Claim";
2399
+ }
2400
+ return {
2401
+ label: t("orders.returns.receive.receiveItems", {
2402
+ id: `#${id?.slice(-7)}`,
2403
+ returnType
2404
+ }),
2405
+ icon: /* @__PURE__ */ jsx24(ArrowLongRight, {}),
2406
+ to: `/orders/${order.id}/returns/${r.id}/receive`
2407
+ };
2408
+ })
2409
+ }
2410
+ ],
2411
+ children: /* @__PURE__ */ jsx24(Button7, { variant: "secondary", size: "small", children: t("orders.returns.receive.action") })
2412
+ }
2413
+ )),
2414
+ showAllocateButton && /* @__PURE__ */ jsx24(
2415
+ Button7,
2416
+ {
2417
+ asChild: true,
2418
+ variant: "secondary",
2419
+ size: "small",
2420
+ "data-testid": "order-summary-allocate-items-cta",
2421
+ children: /* @__PURE__ */ jsx24(Link4, { to: "allocate-items", children: t("orders.allocateItems.action") })
2422
+ }
2423
+ ),
2424
+ showRefund && /* @__PURE__ */ jsx24(Button7, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx24(Link4, { to: `/orders/${order.id}/refund`, children: t("orders.payment.refundAmount", {
2425
+ amount: getStylizedAmount(
2426
+ pendingDifference * -1,
2427
+ order?.currency_code
2428
+ )
2429
+ }) }) })
2430
+ ] }),
2431
+ /* @__PURE__ */ jsx24(OutstandingActions, { order })
2432
+ ] });
2433
+ };
2434
+ var Header3 = ({
2435
+ order,
2436
+ orderPreview
2437
+ }) => {
2438
+ const { t } = useTranslation23();
2439
+ const isCanceled = !!order.canceled_at;
2440
+ const returnOutOfPolicy = isOutsidePolicyWindow(order, RETURN_POLICY_DAYS);
2441
+ const exchangeOutOfPolicy = isOutsidePolicyWindow(
2442
+ order,
2443
+ EXCHANGE_POLICY_DAYS
2444
+ );
2445
+ const claimOutOfPolicy = isOutsidePolicyWindow(order, CLAIM_POLICY_DAYS);
2446
+ const shouldDisableReturn = (order.items || []).every(
2447
+ (i) => !(getReturnableQuantity(i) > 0)
2448
+ );
2449
+ const orderChange = orderPreview?.order_change;
2450
+ const isOrderEditActive = orderChange?.change_type === "edit";
2451
+ const isOrderEditPending = orderChange?.change_type === "edit" && orderChange?.status === "pending";
2452
+ const editDisabled = isCanceled || !!orderChange && orderChange.change_type !== "edit" || orderChange?.change_type === "edit" && orderChange?.status === "requested";
2453
+ const returnDisabledByChange = isOrderEditActive || !!orderChange?.exchange_id || !!orderChange?.claim_id;
2454
+ const exchangeDisabledByChange = isOrderEditActive || !!orderChange?.return_id && !orderChange?.exchange_id || !!orderChange?.claim_id;
2455
+ const claimDisabledByChange = isOrderEditActive || !!orderChange?.return_id && !orderChange?.claim_id || !!orderChange?.exchange_id;
2456
+ return /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between px-6 py-4", children: [
2457
+ /* @__PURE__ */ jsx24(Heading10, { level: "h2", children: t("fields.summary") }),
2458
+ /* @__PURE__ */ jsx24(
2459
+ ActionMenu,
2460
+ {
2461
+ groups: [
2462
+ {
2463
+ actions: [
2464
+ {
2465
+ label: t(
2466
+ isOrderEditPending ? "orders.summary.editOrderContinue" : "orders.edits.create"
2467
+ ),
2468
+ to: "edit",
2469
+ disabled: editDisabled,
2470
+ icon: /* @__PURE__ */ jsx24(PencilSquare, {})
2471
+ }
2472
+ ]
2473
+ },
2474
+ {
2475
+ actions: [
2476
+ {
2477
+ label: t("orders.returns.create"),
2478
+ to: "returns/create",
2479
+ disabled: isCanceled || returnOutOfPolicy || shouldDisableReturn || returnDisabledByChange,
2480
+ disabledTooltip: returnOutOfPolicy ? t("orders.returns.outOfPolicy", {
2481
+ days: RETURN_POLICY_DAYS
2482
+ }) : void 0,
2483
+ icon: /* @__PURE__ */ jsx24(ArrowUturnLeft3, {})
2484
+ },
2485
+ {
2486
+ label: orderChange?.id && orderChange?.exchange_id ? t("orders.exchanges.manage") : t("orders.exchanges.create"),
2487
+ to: "exchanges/create",
2488
+ disabled: isCanceled || exchangeOutOfPolicy || shouldDisableReturn || exchangeDisabledByChange,
2489
+ disabledTooltip: exchangeOutOfPolicy ? t("orders.exchanges.outOfPolicy", {
2490
+ days: EXCHANGE_POLICY_DAYS
2491
+ }) : void 0,
2492
+ icon: /* @__PURE__ */ jsx24(ArrowPath2, {})
2493
+ },
2494
+ {
2495
+ label: orderChange?.id && orderChange?.claim_id ? t("orders.claims.manage") : t("orders.claims.create"),
2496
+ to: "claims/create",
2497
+ disabled: isCanceled || claimOutOfPolicy || shouldDisableReturn || claimDisabledByChange,
2498
+ disabledTooltip: claimOutOfPolicy ? t("orders.claims.outOfPolicy", {
2499
+ days: CLAIM_POLICY_DAYS
2500
+ }) : void 0,
2501
+ icon: /* @__PURE__ */ jsx24(ExclamationCircle2, {})
2502
+ }
2503
+ ]
2504
+ }
2505
+ ]
2506
+ }
2507
+ )
2508
+ ] });
2509
+ };
2510
+ var Item = ({
2511
+ item,
2512
+ currencyCode,
2513
+ returns,
2514
+ reservation
2515
+ }) => {
2516
+ const { t } = useTranslation23();
2517
+ const original_price = item.variant?.prices?.find((price2) => price2.currency_code === currencyCode)?.amount || 0;
2518
+ const price = item.unit_price;
2519
+ const offerInventoryLinks = item.offer?.inventory_item_link ?? [];
2520
+ const isInventoryManaged = !!offerInventoryLinks.length;
2521
+ const hasUnfulfilledItems = item.quantity - (item.detail?.fulfilled_quantity ?? 0) > 0;
2522
+ const offerSku = item.offer?.sku ?? null;
2523
+ const captionSku = offerSku ?? item.variant_sku ?? null;
2524
+ return /* @__PURE__ */ jsxs25(Fragment3, { children: [
2525
+ /* @__PURE__ */ jsxs25(
2526
+ "div",
2527
+ {
2528
+ className: "text-ui-fg-subtle grid grid-cols-2 items-center gap-x-4 px-6 py-4",
2529
+ children: [
2530
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-start gap-x-4", children: [
2531
+ /* @__PURE__ */ jsx24(Thumbnail, { src: item.thumbnail }),
2532
+ /* @__PURE__ */ jsxs25("div", { children: [
2533
+ /* @__PURE__ */ jsx24(
2534
+ Text21,
2535
+ {
2536
+ size: "small",
2537
+ leading: "compact",
2538
+ weight: "plus",
2539
+ className: "text-ui-fg-base",
2540
+ children: item.title || item.product_title
2541
+ }
2542
+ ),
2543
+ captionSku && /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-x-1", children: [
2544
+ /* @__PURE__ */ jsx24(Text21, { size: "small", children: captionSku }),
2545
+ /* @__PURE__ */ jsx24(Copy5, { content: captionSku, className: "text-ui-fg-muted" })
2546
+ ] }),
2547
+ /* @__PURE__ */ jsx24(Text21, { size: "small", children: item.variant?.options?.map((o) => o.value).join(" \xB7 ") })
2548
+ ] })
2549
+ ] }),
2550
+ /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-3 items-center gap-x-4", children: [
2551
+ /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs25(Text21, { size: "small", children: [
2552
+ original_price !== price && /* @__PURE__ */ jsx24("span", { className: "line-through text-ui-fg-muted text-xs mr-1", children: getLocaleAmount(original_price, currencyCode) }),
2553
+ getLocaleAmount(price, currencyCode)
2554
+ ] }) }),
2555
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-x-2", children: [
2556
+ /* @__PURE__ */ jsx24("div", { className: "w-fit min-w-[27px]", children: /* @__PURE__ */ jsxs25(Text21, { size: "small", children: [
2557
+ /* @__PURE__ */ jsx24("span", { className: "tabular-nums", children: item.quantity }),
2558
+ "x"
2559
+ ] }) }),
2560
+ /* @__PURE__ */ jsx24("div", { className: "overflow-visible", children: isInventoryManaged && hasUnfulfilledItems && /* @__PURE__ */ jsx24(
2561
+ StatusBadge4,
2562
+ {
2563
+ color: reservation ? "green" : "orange",
2564
+ className: "text-nowrap",
2565
+ children: reservation ? t("orders.reservations.allocatedLabel") : t("orders.reservations.notAllocatedLabel")
2566
+ }
2567
+ ) })
2568
+ ] }),
2569
+ /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsx24(Text21, { size: "small", className: "pt-[1px]", children: getLocaleAmount(item.original_total || 0, currencyCode) }) })
2570
+ ] })
2571
+ ]
2572
+ },
2573
+ item.id
2574
+ ),
2575
+ returns.map((r) => /* @__PURE__ */ jsx24(ReturnBreakdown, { orderReturn: r, itemId: item.id }, r.id))
2576
+ ] });
2577
+ };
2578
+ var ItemBreakdown = ({
2579
+ order,
2580
+ reservations
2581
+ }) => {
2582
+ const { returns: returnsList = [] } = useReturns({
2583
+ order_id: order.id,
2584
+ fields: "*items,*items.reason"
2585
+ });
2586
+ const returns = useMemo4(
2587
+ () => returnsList.filter((r) => !r.canceled_at),
2588
+ [returnsList]
2589
+ );
2590
+ const reservationsMap = useMemo4(
2591
+ () => new Map(reservations.map((r) => [r.line_item_id, r])),
2592
+ [reservations]
2593
+ );
2594
+ return /* @__PURE__ */ jsx24("div", { children: order.items?.map((item) => {
2595
+ return /* @__PURE__ */ jsx24(
2596
+ Item,
2597
+ {
2598
+ item,
2599
+ currencyCode: order.currency_code,
2600
+ returns,
2601
+ reservation: reservationsMap.get(item.id)
2602
+ },
2603
+ item.id
2604
+ );
2605
+ }) });
2606
+ };
2607
+ var ReturnBreakdownWithDamages = ({
2608
+ orderReturn,
2609
+ itemId
2610
+ }) => {
2611
+ const { t } = useTranslation23();
2612
+ const item = orderReturn.items?.find((ri) => ri.item_id === itemId);
2613
+ const damagedQuantity = item?.damaged_quantity || 0;
2614
+ if (!item || damagedQuantity <= 0) {
2615
+ return null;
2616
+ }
2617
+ return /* @__PURE__ */ jsxs25(
2618
+ "div",
2619
+ {
2620
+ className: "txt-compact-small-plus text-ui-fg-subtle bg-ui-bg-subtle flex flex-row justify-between gap-y-2 border-t-2 border-dotted px-6 py-4",
2621
+ children: [
2622
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
2623
+ /* @__PURE__ */ jsx24(ArrowDownRightMini, { className: "text-ui-fg-muted" }),
2624
+ /* @__PURE__ */ jsx24(Text21, { size: "small", children: t("orders.returns.damagedItemsReturned", {
2625
+ quantity: damagedQuantity
2626
+ }) }),
2627
+ item.note && /* @__PURE__ */ jsx24(Tooltip5, { content: item.note, children: /* @__PURE__ */ jsx24(DocumentText2, { className: "text-ui-tag-neutral-icon ml-1 inline" }) }),
2628
+ item.reason && /* @__PURE__ */ jsx24(
2629
+ Badge4,
2630
+ {
2631
+ size: "2xsmall",
2632
+ className: "cursor-default select-none capitalize",
2633
+ rounded: "full",
2634
+ children: item.reason.label
2635
+ }
2636
+ )
2637
+ ] }),
2638
+ /* @__PURE__ */ jsxs25(Text21, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: [
2639
+ t("orders.returns.damagedItemReceived"),
2640
+ /* @__PURE__ */ jsx24("span", { className: "ml-2", children: /* @__PURE__ */ jsx24(return_info_popover_default, { orderReturn }) })
2641
+ ] })
2642
+ ]
2643
+ },
2644
+ `${orderReturn.id}-damaged`
2645
+ );
2646
+ };
2647
+ var ReturnBreakdown = ({
2648
+ orderReturn,
2649
+ itemId
2650
+ }) => {
2651
+ const { t } = useTranslation23();
2652
+ const { getRelativeDate } = useDate();
2653
+ if (!["requested", "received", "partially_received"].includes(
2654
+ orderReturn.status || ""
2655
+ )) {
2656
+ return null;
2657
+ }
2658
+ const isRequested = orderReturn.status === "requested";
2659
+ const item = orderReturn.items?.find((ri) => ri.item_id === itemId);
2660
+ if (!item) {
2661
+ return null;
2662
+ }
2663
+ const damagedQuantity = item.damaged_quantity || 0;
2664
+ return /* @__PURE__ */ jsxs25(Fragment3, { children: [
2665
+ damagedQuantity > 0 && /* @__PURE__ */ jsx24(
2666
+ ReturnBreakdownWithDamages,
2667
+ {
2668
+ orderReturn,
2669
+ itemId
2670
+ }
2671
+ ),
2672
+ /* @__PURE__ */ jsxs25(
2673
+ "div",
2674
+ {
2675
+ className: "txt-compact-small-plus text-ui-fg-subtle bg-ui-bg-subtle flex flex-row justify-between gap-y-2 border-t-2 border-dotted px-6 py-4",
2676
+ children: [
2677
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
2678
+ /* @__PURE__ */ jsx24(ArrowDownRightMini, { className: "text-ui-fg-muted" }),
2679
+ /* @__PURE__ */ jsx24(Text21, { size: "small", children: t(
2680
+ `orders.returns.${isRequested ? "returnRequestedInfo" : "returnReceivedInfo"}`,
2681
+ {
2682
+ requestedItemsCount: isRequested ? item.quantity : item.received_quantity
2683
+ }
2684
+ ) }),
2685
+ item.note && /* @__PURE__ */ jsx24(Tooltip5, { content: item.note, children: /* @__PURE__ */ jsx24(DocumentText2, { className: "text-ui-tag-neutral-icon ml-1 inline" }) }),
2686
+ item.reason && /* @__PURE__ */ jsx24(
2687
+ Badge4,
2688
+ {
2689
+ size: "2xsmall",
2690
+ className: "cursor-default select-none capitalize",
2691
+ rounded: "full",
2692
+ children: item.reason.label
2693
+ }
2694
+ )
2695
+ ] }),
2696
+ isRequested ? /* @__PURE__ */ jsxs25(Text21, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: [
2697
+ getRelativeDate(orderReturn.created_at),
2698
+ /* @__PURE__ */ jsx24("span", { className: "ml-2", children: /* @__PURE__ */ jsx24(return_info_popover_default, { orderReturn }) })
2699
+ ] }) : /* @__PURE__ */ jsxs25(Text21, { size: "small", leading: "compact", className: "text-ui-fg-muted", children: [
2700
+ t("orders.returns.itemReceived"),
2701
+ /* @__PURE__ */ jsx24("span", { className: "ml-2", children: /* @__PURE__ */ jsx24(return_info_popover_default, { orderReturn }) })
2702
+ ] })
2703
+ ]
2704
+ },
2705
+ item.id
2706
+ )
2707
+ ] });
2708
+ };
2709
+ var Cost = ({
2710
+ label,
2711
+ value,
2712
+ secondaryValue,
2713
+ tooltip
2714
+ }) => /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-3 items-center", children: [
2715
+ /* @__PURE__ */ jsxs25(Text21, { size: "small", leading: "compact", children: [
2716
+ label,
2717
+ " ",
2718
+ tooltip
2719
+ ] }),
2720
+ /* @__PURE__ */ jsx24("div", { className: "text-right", children: /* @__PURE__ */ jsx24(Text21, { size: "small", leading: "compact", children: secondaryValue }) }),
2721
+ /* @__PURE__ */ jsx24("div", { className: "text-right", children: /* @__PURE__ */ jsx24(Text21, { size: "small", leading: "compact", children: value }) })
2722
+ ] });
2723
+ var CostBreakdown = ({
2724
+ order
2725
+ }) => {
2726
+ const { t } = useTranslation23();
2727
+ const [isTaxOpen, setIsTaxOpen] = useState5(false);
2728
+ const [isShippingOpen, setIsShippingOpen] = useState5(false);
2729
+ const commissionTotal = useMemo4(() => {
2730
+ return order.items.reduce((acc, item) => {
2731
+ const lines = item.commission_lines;
2732
+ if (!lines) return acc;
2733
+ return acc + lines.reduce((sum, line) => sum + (line.amount ?? 0), 0);
2734
+ }, 0);
2735
+ }, [order.items]);
2736
+ const discountCodes = useMemo4(() => {
2737
+ const codes = /* @__PURE__ */ new Set();
2738
+ order.items.forEach(
2739
+ (item) => item.adjustments?.forEach((adj) => {
2740
+ codes.add(adj.code);
2741
+ })
2742
+ );
2743
+ return Array.from(codes).sort();
2744
+ }, [order]);
2745
+ const taxCodes = useMemo4(() => {
2746
+ const taxCodeMap = {};
2747
+ order.items.forEach((item) => {
2748
+ item.tax_lines?.forEach((line) => {
2749
+ taxCodeMap[line.code] = (taxCodeMap[line.code] || 0) + line.total;
2750
+ });
2751
+ });
2752
+ order.shipping_methods.forEach((sm) => {
2753
+ sm.tax_lines?.forEach((line) => {
2754
+ taxCodeMap[line.code] = (taxCodeMap[line.code] || 0) + line.total;
2755
+ });
2756
+ });
2757
+ return taxCodeMap;
2758
+ }, [order]);
2759
+ const automaticTaxesOn = !!order.region?.automatic_taxes;
2760
+ const hasTaxLines = !!Object.keys(taxCodes).length;
2761
+ const discountTotal = automaticTaxesOn ? order.discount_total : order.discount_subtotal;
2762
+ return /* @__PURE__ */ jsxs25("div", { className: "text-ui-fg-subtle flex flex-col gap-y-2 px-6 py-4", children: [
2763
+ /* @__PURE__ */ jsx24(
2764
+ Cost,
2765
+ {
2766
+ label: t(
2767
+ automaticTaxesOn ? "orders.summary.itemTotal" : "orders.summary.itemSubtotal"
2768
+ ),
2769
+ value: getLocaleAmount(order.item_total, order.currency_code)
2770
+ }
2771
+ ),
2772
+ /* @__PURE__ */ jsx24(
2773
+ Cost,
2774
+ {
2775
+ label: (
2776
+ // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
2777
+ /* @__PURE__ */ jsxs25(
2778
+ "span",
2779
+ {
2780
+ onClick: () => setIsShippingOpen((o) => !o),
2781
+ className: "flex cursor-pointer items-center gap-1",
2782
+ children: [
2783
+ /* @__PURE__ */ jsx24("span", { children: t(
2784
+ automaticTaxesOn ? "orders.summary.shippingTotal" : "orders.summary.shippingSubtotal"
2785
+ ) }),
2786
+ /* @__PURE__ */ jsx24(
2787
+ TriangleDownMini,
2788
+ {
2789
+ style: {
2790
+ transform: `rotate(${isShippingOpen ? 0 : -90}deg)`
2791
+ }
2792
+ }
2793
+ )
2794
+ ]
2795
+ }
2796
+ )
2797
+ ),
2798
+ value: getLocaleAmount(
2799
+ automaticTaxesOn ? order.shipping_total : order.shipping_subtotal,
2800
+ order.currency_code
2801
+ )
2802
+ }
2803
+ ),
2804
+ isShippingOpen && /* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-1 pl-5", children: (order.shipping_methods || []).sort(
2805
+ (m1, m2) => m1.created_at.localeCompare(m2.created_at)
2806
+ ).map((sm, i) => {
2807
+ return /* @__PURE__ */ jsxs25(
2808
+ "div",
2809
+ {
2810
+ className: "flex items-center justify-between gap-x-2",
2811
+ children: [
2812
+ /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsxs25("span", { className: "txt-small text-ui-fg-subtle font-medium", children: [
2813
+ sm.name,
2814
+ sm.detail?.return_id && ` (${t("fields.returnShipping")})`,
2815
+ " ",
2816
+ /* @__PURE__ */ jsx24(shipping_info_popover_default, { shippingMethod: sm }, i)
2817
+ ] }) }),
2818
+ /* @__PURE__ */ jsx24("div", { className: "relative flex-1", children: /* @__PURE__ */ jsx24("div", { className: "bottom-[calc(50% - 2px)] absolute h-[1px] w-full border-b border-dashed" }) }),
2819
+ /* @__PURE__ */ jsx24("span", { className: "txt-small text-ui-fg-muted", children: getLocaleAmount(
2820
+ automaticTaxesOn ? sm.total : sm.subtotal,
2821
+ order.currency_code
2822
+ ) })
2823
+ ]
2824
+ },
2825
+ sm.id
2826
+ );
2827
+ }) }),
2828
+ /* @__PURE__ */ jsx24(
2829
+ Cost,
2830
+ {
2831
+ label: t(
2832
+ automaticTaxesOn ? "orders.summary.discountTotal" : "orders.summary.discountSubtotal"
2833
+ ),
2834
+ secondaryValue: discountCodes.join(", "),
2835
+ value: discountTotal > 0 ? `- ${getLocaleAmount(discountTotal, order.currency_code)}` : "-"
2836
+ }
2837
+ ),
2838
+ /* @__PURE__ */ jsxs25(Fragment3, { children: [
2839
+ /* @__PURE__ */ jsxs25("div", { className: "flex justify-between", children: [
2840
+ /* @__PURE__ */ jsxs25(
2841
+ "div",
2842
+ {
2843
+ onClick: () => hasTaxLines && setIsTaxOpen((o) => !o),
2844
+ className: clx2("flex items-center gap-1", {
2845
+ "cursor-pointer": hasTaxLines
2846
+ }),
2847
+ children: [
2848
+ /* @__PURE__ */ jsx24("span", { className: "txt-small select-none", children: t(
2849
+ automaticTaxesOn ? "orders.summary.taxTotalIncl" : "orders.summary.taxTotal"
2850
+ ) }),
2851
+ hasTaxLines && /* @__PURE__ */ jsx24(
2852
+ TriangleDownMini,
2853
+ {
2854
+ style: {
2855
+ transform: `rotate(${isTaxOpen ? 0 : -90}deg)`
2856
+ }
2857
+ }
2858
+ )
2859
+ ]
2860
+ }
2861
+ ),
2862
+ /* @__PURE__ */ jsx24("div", { className: "text-right", children: /* @__PURE__ */ jsx24(Text21, { size: "small", leading: "compact", children: getLocaleAmount(order.tax_total, order.currency_code) }) })
2863
+ ] }),
2864
+ isTaxOpen && /* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-1 pl-5", children: Object.entries(taxCodes).map(([code, total]) => {
2865
+ return /* @__PURE__ */ jsxs25(
2866
+ "div",
2867
+ {
2868
+ className: "flex items-center justify-between gap-x-2",
2869
+ children: [
2870
+ /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24("span", { className: "txt-small text-ui-fg-subtle font-medium", children: code }) }),
2871
+ /* @__PURE__ */ jsx24("div", { className: "relative flex-1", children: /* @__PURE__ */ jsx24("div", { className: "bottom-[calc(50% - 2px)] absolute h-[1px] w-full border-b border-dashed" }) }),
2872
+ /* @__PURE__ */ jsx24("span", { className: "txt-small text-ui-fg-muted", children: getLocaleAmount(total, order.currency_code) })
2873
+ ]
2874
+ },
2875
+ code
2876
+ );
2877
+ }) })
2878
+ ] }),
2879
+ commissionTotal > 0 && /* @__PURE__ */ jsx24(
2880
+ Cost,
2881
+ {
2882
+ label: t("fields.commission"),
2883
+ value: getLocaleAmount(commissionTotal, order.currency_code)
2884
+ }
2885
+ )
2886
+ ] });
2887
+ };
2888
+ var Total2 = ({ order }) => {
2889
+ const { t } = useTranslation23();
2890
+ const totalCaptured = getTotalCaptured(order.payment_collections || []);
2891
+ const outstanding = Math.max(0, order.total - totalCaptured);
2892
+ return /* @__PURE__ */ jsxs25("div", { className: " flex flex-col gap-y-2 px-6 py-4", children: [
2893
+ /* @__PURE__ */ jsxs25("div", { className: "text-ui-fg-base flex items-center justify-between", children: [
2894
+ /* @__PURE__ */ jsx24(
2895
+ Text21,
2896
+ {
2897
+ weight: "plus",
2898
+ className: "text-ui-fg-subtle",
2899
+ size: "small",
2900
+ leading: "compact",
2901
+ children: t("fields.total")
2902
+ }
2903
+ ),
2904
+ /* @__PURE__ */ jsx24(
2905
+ Text21,
2906
+ {
2907
+ weight: "plus",
2908
+ className: "text-ui-fg-subtle",
2909
+ size: "small",
2910
+ leading: "compact",
2911
+ children: getStylizedAmount(order.total, order.currency_code)
2912
+ }
2913
+ )
2914
+ ] }),
2915
+ /* @__PURE__ */ jsxs25("div", { className: "text-ui-fg-base flex items-center justify-between", children: [
2916
+ /* @__PURE__ */ jsx24(
2917
+ Text21,
2918
+ {
2919
+ weight: "plus",
2920
+ className: "text-ui-fg-subtle",
2921
+ size: "small",
2922
+ leading: "compact",
2923
+ children: t("fields.paidTotal")
2924
+ }
2925
+ ),
2926
+ /* @__PURE__ */ jsx24(
2927
+ Text21,
2928
+ {
2929
+ weight: "plus",
2930
+ className: "text-ui-fg-subtle",
2931
+ size: "small",
2932
+ leading: "compact",
2933
+ children: getStylizedAmount(totalCaptured, order.currency_code)
2934
+ }
2935
+ )
2936
+ ] }),
2937
+ /* @__PURE__ */ jsxs25("div", { className: "text-ui-fg-base flex items-center justify-between", children: [
2938
+ /* @__PURE__ */ jsx24(Text21, { weight: "plus", size: "small", leading: "compact", children: t("orders.payment.outstandingAmount") }),
2939
+ /* @__PURE__ */ jsx24(Text21, { weight: "plus", size: "small", leading: "compact", children: getStylizedAmount(outstanding, order.currency_code) })
2940
+ ] })
2941
+ ] });
2942
+ };
2943
+ var OutstandingActions = ({ order }) => {
2944
+ const { t } = useTranslation23();
2945
+ const unpaidCollection = order.payment_collections?.find(
2946
+ (pc) => pc.status !== "captured" && pc.status !== "canceled"
2947
+ );
2948
+ const pendingDifference = order.summary?.pending_difference || 0;
2949
+ const isOutstanding = pendingDifference > 5e-3 && order.status !== "canceled" && !!unpaidCollection;
2950
+ const markAsPaid = useMarkPaymentCollectionAsPaid(
2951
+ order.id,
2952
+ unpaidCollection?.id ?? ""
2953
+ );
2954
+ if (!isOutstanding || !unpaidCollection) {
2955
+ return null;
2956
+ }
2957
+ const paymentLink = unpaidCollection.payment_sessions?.[0]?.data?.url ?? null;
2958
+ const handleCopyLink = async () => {
2959
+ if (!paymentLink) {
2960
+ toast7.error(t("orders.payment.copyLinkMissing"));
2961
+ return;
2962
+ }
2963
+ try {
2964
+ await navigator.clipboard.writeText(paymentLink);
2965
+ toast7.success(t("orders.payment.copyLinkSuccess"));
2966
+ } catch {
2967
+ toast7.error(t("orders.payment.copyLinkError"));
2968
+ }
2969
+ };
2970
+ const handleMarkAsPaid = () => {
2971
+ markAsPaid.mutate(
2972
+ { order_id: order.id },
2973
+ {
2974
+ onSuccess: () => toast7.success(t("orders.payment.markAsPaidSuccess")),
2975
+ onError: (e) => toast7.error(e.message)
2976
+ }
2977
+ );
2978
+ };
2979
+ return /* @__PURE__ */ jsxs25("div", { className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-4 py-4", children: [
2980
+ paymentLink && /* @__PURE__ */ jsx24(Button7, { size: "small", variant: "secondary", onClick: handleCopyLink, children: t("orders.payment.copyPaymentLink", {
2981
+ amount: getStylizedAmount(pendingDifference, order.currency_code)
2982
+ }) }),
2983
+ /* @__PURE__ */ jsx24(
2984
+ Button7,
2985
+ {
2986
+ size: "small",
2987
+ variant: "secondary",
2988
+ onClick: handleMarkAsPaid,
2989
+ isLoading: markAsPaid.isPending,
2990
+ children: t("orders.payment.markAsPaid")
2991
+ }
2992
+ )
2993
+ ] });
2994
+ };
2995
+
2996
+ // src/pages/orders/[id]/order-detail-page.tsx
2997
+ import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs26 } from "react/jsx-runtime";
2998
+ var Root = ({ children }) => {
2999
+ const initialData = useLoaderData();
3000
+ const { id } = useParams();
3001
+ const { order, isLoading, isError, error } = useOrder(
3002
+ id,
3003
+ {
3004
+ fields: DEFAULT_FIELDS
3005
+ },
3006
+ {
3007
+ initialData
3008
+ }
3009
+ );
3010
+ const { order: orderPreview, isLoading: isPreviewLoading } = useOrderPreview(
3011
+ id
3012
+ );
3013
+ if (order) {
3014
+ order.items = order.items.sort((itemA, itemB) => {
3015
+ if (itemA.created_at > itemB.created_at) {
3016
+ return 1;
3017
+ }
3018
+ if (itemA.created_at < itemB.created_at) {
3019
+ return -1;
3020
+ }
3021
+ return 0;
3022
+ });
3023
+ }
3024
+ if (isLoading || !order || isPreviewLoading) {
3025
+ return /* @__PURE__ */ jsx25(TwoColumnPageSkeleton, { mainSections: 4, sidebarSections: 2, showJSON: true });
3026
+ }
3027
+ if (isError) {
3028
+ throw error;
3029
+ }
3030
+ return /* @__PURE__ */ jsx25(Fragment4, { children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs26(TwoColumnPage, { data: order, hasOutlet: true, showMetadata: true, showJSON: true, children: [
3031
+ /* @__PURE__ */ jsxs26(TwoColumnPage.Main, { children: [
3032
+ /* @__PURE__ */ jsx25(OrderActiveEditSection, { order }),
3033
+ orderPreview && /* @__PURE__ */ jsxs26(Fragment4, { children: [
3034
+ /* @__PURE__ */ jsx25(ActiveOrderClaimSection, { orderPreview }),
3035
+ /* @__PURE__ */ jsx25(ActiveOrderExchangeSection, { orderPreview }),
3036
+ /* @__PURE__ */ jsx25(ActiveOrderReturnSection, { orderPreview })
3037
+ ] }),
3038
+ /* @__PURE__ */ jsx25(OrderGeneralSection, { order }),
3039
+ /* @__PURE__ */ jsx25(OrderSummarySection, { order }),
3040
+ /* @__PURE__ */ jsx25(OrderPaymentSection, { order }),
3041
+ /* @__PURE__ */ jsx25(OrderFulfillmentSection, { order })
3042
+ ] }),
3043
+ /* @__PURE__ */ jsxs26(TwoColumnPage.Sidebar, { children: [
3044
+ /* @__PURE__ */ jsx25(OrderCustomerSection, { order }),
3045
+ /* @__PURE__ */ jsx25(OrderActivitySection, { order })
3046
+ ] })
3047
+ ] }) });
3048
+ };
3049
+ var OrderDetailPage = Object.assign(Root, {
3050
+ Main: TwoColumnPage.Main,
3051
+ Sidebar: TwoColumnPage.Sidebar,
3052
+ MainActiveEditSection: OrderActiveEditSection,
3053
+ MainActiveClaimSection: ActiveOrderClaimSection,
3054
+ MainActiveExchangeSection: ActiveOrderExchangeSection,
3055
+ MainActiveReturnSection: ActiveOrderReturnSection,
3056
+ MainGeneralSection: OrderGeneralSection,
3057
+ MainSummarySection: OrderSummarySection,
3058
+ MainPaymentSection: OrderPaymentSection,
3059
+ MainFulfillmentSection: OrderFulfillmentSection,
3060
+ SidebarCustomerSection: OrderCustomerSection,
3061
+ SidebarActivitySection: OrderActivitySection
3062
+ });
3063
+ export {
3064
+ OrderDetailPage,
3065
+ loader
3066
+ };