@mercurjs/vendor 2.1.6 → 2.2.0-canary.11

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 (259) hide show
  1. package/dist/[id]-A55T2ORL.js +3066 -0
  2. package/dist/[id]-B4YZTANM.js +1571 -0
  3. package/dist/{[id]-UTKO3VG4.js → [id]-EKLRGVBA.js} +10 -10
  4. package/dist/{[id]-TO6KT3ZE.js → [id]-FE5GYYVZ.js} +28 -25
  5. package/dist/{[id]-4VCL3MMM.js → [id]-GBT6VB4S.js} +29 -23
  6. package/dist/{[id]-3G5G7ZFV.js → [id]-GC3ZYPK4.js} +25 -22
  7. package/dist/{[id]-6PXEWRG7.js → [id]-J6BZG5PU.js} +14 -14
  8. package/dist/{[id]-B3LHVQM5.js → [id]-QOEO3JOV.js} +29 -23
  9. package/dist/{[id]-H3C3ZSC6.js → [id]-QQU5HVFU.js} +29 -23
  10. package/dist/{[id]-PDGHF5J2.js → [id]-SHAJTJNZ.js} +43 -36
  11. package/dist/{[id]-X4DDKOMQ.js → [id]-T5ECVBPF.js} +30 -24
  12. package/dist/{[id]-T2ROPEGY.js → [id]-U5KZEQDR.js} +7 -7
  13. package/dist/{[id]-7RUAH3TI.js → [id]-YPCO3DJV.js} +5 -5
  14. package/dist/{[id]-Y7GAMNC5.js → [id]-ZCMSBEVM.js} +4 -4
  15. package/dist/{[location_id]-D55RQOXT.js → [location_id]-NUBXDDJC.js} +9 -9
  16. package/dist/{[province_id]-OFH2ZOFQ.js → [province_id]-6GUA4PV5.js} +23 -20
  17. package/dist/{add-C6OX5C54.js → add-NTRYWOJF.js} +42 -35
  18. package/dist/add-RU3WL4YB.js +428 -0
  19. package/dist/{add-customer-groups-PJRJUWS2.js → add-customer-groups-U5RZWW4B.js} +19 -16
  20. package/dist/{add-products-INOLNPO6.js → add-products-Q4MMDQKT.js} +26 -20
  21. package/dist/{add-promotions-AHDOP52Q.js → add-promotions-3AYXQXTP.js} +8 -8
  22. package/dist/{add-to-campaign-HL6NGRR4.js → add-to-campaign-QKYQCSR2.js} +4 -4
  23. package/dist/{address-KRENKSLP.js → address-77Y3AOQ3.js} +19 -16
  24. package/dist/{adjust-inventory-H4EUP7J3.js → adjust-inventory-AFJLWF5R.js} +2 -2
  25. package/dist/{allocate-items-SUCUZU4D.js → allocate-items-TCM5A55Y.js} +141 -126
  26. package/dist/{areas-UUMZDXLX.js → areas-XUC5V5UO.js} +8 -8
  27. package/dist/{attributes-CALEHJJG.js → attributes-SZP2MM5L.js} +3 -3
  28. package/dist/{breadcrumb-KQSFIXQ4.js → breadcrumb-2XA2WOK7.js} +1 -1
  29. package/dist/{breadcrumb-IG7VZGW2.js → breadcrumb-5NP23D6X.js} +15 -12
  30. package/dist/{breadcrumb-TW5JEOYS.js → breadcrumb-EVZIOB2G.js} +14 -11
  31. package/dist/{breadcrumb-OIGGCB3L.js → breadcrumb-FPWBT76A.js} +8 -2
  32. package/dist/{breadcrumb-BS7Y5OKF.js → breadcrumb-IK6XCQOQ.js} +2 -2
  33. package/dist/{breadcrumb-M5Z5WA6I.js → breadcrumb-KTARIL65.js} +2 -2
  34. package/dist/{breadcrumb-VNNZ3TTW.js → breadcrumb-PBR27GGX.js} +3 -3
  35. package/dist/breadcrumb-THJ2HPRB.js +26 -0
  36. package/dist/{breadcrumb-6W2VP3OZ.js → breadcrumb-TNJSGX4T.js} +15 -12
  37. package/dist/{campaigns-HS6MIO7X.js → campaigns-JAQTSA4Z.js} +6 -6
  38. package/dist/{categories-PKWR3FM3.js → categories-T4QJYX4R.js} +8 -8
  39. package/dist/{chunk-4URLUCTD.js → chunk-25E4KME5.js} +3 -3
  40. package/dist/chunk-27KRIXMQ.js +71 -0
  41. package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
  42. package/dist/{chunk-ZYOXKUKZ.js → chunk-2QTNCGKX.js} +1 -1
  43. package/dist/{chunk-5UD4P6YL.js → chunk-2USXZSTK.js} +4 -4
  44. package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
  45. package/dist/{chunk-VQ5EKDA3.js → chunk-3PMM6AMP.js} +3 -3
  46. package/dist/{chunk-J6BRLL3F.js → chunk-463CNCJC.js} +3 -3
  47. package/dist/{chunk-Y2QI7KWS.js → chunk-4LVP635F.js} +408 -664
  48. package/dist/{chunk-UL4O5M4S.js → chunk-4S6XGIC6.js} +1 -18
  49. package/dist/{chunk-RUE5BPC2.js → chunk-5QI3NDJG.js} +1 -1
  50. package/dist/{chunk-PPLC4IKI.js → chunk-5T6UWTRU.js} +10 -5
  51. package/dist/{chunk-WITQNQXN.js → chunk-6FUIK3PX.js} +4 -4
  52. package/dist/{chunk-HGQTL7NX.js → chunk-6K6EQOJF.js} +3 -3
  53. package/dist/{chunk-KAZ5BYTQ.js → chunk-6OUPJNYO.js} +5 -3
  54. package/dist/{chunk-PEKANQ3T.js → chunk-6UZERVBI.js} +2 -2
  55. package/dist/{chunk-RTAWYMQP.js → chunk-7CMRFP5Q.js} +2 -2
  56. package/dist/{chunk-I2IKYOZX.js → chunk-7IPCLQ5V.js} +19 -19
  57. package/dist/chunk-ADGVQVHP.js +101 -0
  58. package/dist/{chunk-IZ5RG5XI.js → chunk-AJLGY3LQ.js} +1 -21
  59. package/dist/chunk-BER45EYD.js +82 -0
  60. package/dist/{chunk-PCMNEUMV.js → chunk-BXRNZS5K.js} +1 -1
  61. package/dist/chunk-CFRWIQIZ.js +43 -0
  62. package/dist/{chunk-RL7SFZOF.js → chunk-DDJQRV6E.js} +1 -1
  63. package/dist/{chunk-D2MA5TAP.js → chunk-DO4F5FIO.js} +2 -2
  64. package/dist/{chunk-X4FLOQ45.js → chunk-DQKK43PR.js} +3 -3
  65. package/dist/{chunk-6WY5X4PE.js → chunk-E6W57UP3.js} +35 -125
  66. package/dist/chunk-FP6U6BPH.js +61 -0
  67. package/dist/chunk-FWPGOIFA.js +22 -0
  68. package/dist/{chunk-BLVJAKBA.js → chunk-FWS4YJ4B.js} +1 -1
  69. package/dist/chunk-GAE6TKOR.js +811 -0
  70. package/dist/{chunk-3CK6OINO.js → chunk-GDWBOQI5.js} +3 -5
  71. package/dist/{chunk-PDQSPKG5.js → chunk-GN6KB75Z.js} +1 -1
  72. package/dist/chunk-HDEOZN2Q.js +60 -0
  73. package/dist/chunk-IBEUR3J7.js +173 -0
  74. package/dist/chunk-J6XCRFBW.js +30 -0
  75. package/dist/{chunk-ZEVYT6IX.js → chunk-JAUZ73XE.js} +151 -266
  76. package/dist/{chunk-CNLP35S7.js → chunk-K6LOZ4S3.js} +54 -18
  77. package/dist/{chunk-JQP7MOFH.js → chunk-KIFSQOM2.js} +2 -2
  78. package/dist/{chunk-DARJTN4I.js → chunk-L4KBTV57.js} +9 -2
  79. package/dist/chunk-L57USMYC.js +39 -0
  80. package/dist/chunk-LARLBYU6.js +127 -0
  81. package/dist/chunk-LDZCCWJB.js +518 -0
  82. package/dist/chunk-LEWA4BPH.js +18 -0
  83. package/dist/chunk-LFX6WU4A.js +36 -0
  84. package/dist/{chunk-ITI54CII.js → chunk-LKUW5SV4.js} +6 -6
  85. package/dist/{chunk-LPOAVK6Y.js → chunk-LQD232FW.js} +47 -12
  86. package/dist/{chunk-4MFMCZEJ.js → chunk-MJCL3WID.js} +2 -2
  87. package/dist/{chunk-32RYSB2V.js → chunk-NBKWY6XN.js} +2 -2
  88. package/dist/{chunk-GYV6SKY7.js → chunk-O7VOGTLX.js} +4 -6
  89. package/dist/{chunk-KQGVSLUI.js → chunk-OYKUQXJX.js} +1926 -957
  90. package/dist/{chunk-CYTNBXWF.js → chunk-OZ44ATGE.js} +8 -8
  91. package/dist/{chunk-7Q5SDEK7.js → chunk-PAVZ6FPK.js} +7 -7
  92. package/dist/{chunk-2RHAI7WK.js → chunk-QLBIBLOY.js} +2 -2
  93. package/dist/chunk-RXV7INUV.js +426 -0
  94. package/dist/chunk-S23FD6FA.js +210 -0
  95. package/dist/{chunk-NYDJTWRL.js → chunk-SGR4DMCW.js} +4 -4
  96. package/dist/{chunk-OXXL4WQU.js → chunk-SPOHNK4X.js} +6 -6
  97. package/dist/{chunk-AIF2KTEE.js → chunk-SSUUT5LK.js} +12 -2
  98. package/dist/{chunk-QX45GVAL.js → chunk-SZBERGA4.js} +8 -8
  99. package/dist/{chunk-6SBMVLJ2.js → chunk-T5MJWWDX.js} +2 -2
  100. package/dist/chunk-T6LHVNWO.js +27 -0
  101. package/dist/chunk-TBYCZRZ7.js +248 -0
  102. package/dist/chunk-TF6V3TFG.js +438 -0
  103. package/dist/chunk-TW324MAT.js +185 -0
  104. package/dist/{chunk-4ZGFODSC.js → chunk-TYESCFYW.js} +1 -1
  105. package/dist/chunk-U5G3AVED.js +64 -0
  106. package/dist/chunk-U6PBLMXD.js +14 -0
  107. package/dist/{chunk-GZMXTNDN.js → chunk-UCYSCKZV.js} +1432 -1380
  108. package/dist/{chunk-P3ZTO6T2.js → chunk-UFFVRF4V.js} +2 -2
  109. package/dist/chunk-UM7ZR3VU.js +14 -0
  110. package/dist/chunk-UORPTGV2.js +114 -0
  111. package/dist/{chunk-5M3SL4UZ.js → chunk-VCOQ7WQ2.js} +30 -106
  112. package/dist/chunk-VCUUITW6.js +35 -0
  113. package/dist/{chunk-PTW7JNAP.js → chunk-VDHW6H5F.js} +5 -5
  114. package/dist/chunk-VZUA5SRD.js +62 -0
  115. package/dist/{chunk-DKQ4XMSN.js → chunk-X4GWB6AT.js} +6 -6
  116. package/dist/{chunk-6YA3C4NB.js → chunk-XCIMOIX6.js} +3 -12
  117. package/dist/chunk-XP23ZVQT.js +2183 -0
  118. package/dist/{chunk-WBI7FEGI.js → chunk-Y2MQ5EMD.js} +29 -24
  119. package/dist/chunk-YBF45CX5.js +23 -0
  120. package/dist/{chunk-N7OVXN72.js → chunk-YGJCJBPM.js} +1 -1
  121. package/dist/{chunk-WNVEMFIK.js → chunk-YHIJCI4U.js} +3 -3
  122. package/dist/{chunk-WFE6CT6M.js → chunk-YQZBAP3S.js} +22 -76
  123. package/dist/chunk-ZHFFTT3I.js +17 -0
  124. package/dist/{collections-DJZI2RM2.js → collections-URH2TCWJ.js} +28 -24
  125. package/dist/{configuration-GN3TO77H.js → configuration-7IYZ6GNP.js} +3 -3
  126. package/dist/{configuration-RHPIO2QT.js → configuration-C4IGBNXH.js} +1 -1
  127. package/dist/{create-7S7CZWEN.js → create-5PSOIHIT.js} +4 -4
  128. package/dist/create-7R6CZU53.js +215 -0
  129. package/dist/{create-3EK5CNNX.js → create-A7B3MLJX.js} +41 -34
  130. package/dist/create-F5R76QML.js +1178 -0
  131. package/dist/create-FKRYB7ZS.js +1784 -0
  132. package/dist/create-GGACODDN.js +1914 -0
  133. package/dist/{create-YO55Z3YD.js → create-HVZYJ3YC.js} +35 -38
  134. package/dist/{create-IDVCZHIX.js → create-JF2OUZQA.js} +16 -13
  135. package/dist/{create-3ZVXEPX5.js → create-JGYG5SBM.js} +29 -23
  136. package/dist/{create-G4T2PAJH.js → create-MS6KKFSV.js} +21 -18
  137. package/dist/{create-OCFPLNNY.js → create-MZYXMGKP.js} +6 -6
  138. package/dist/{create-HKJVSFB7.js → create-O35JRZEF.js} +25 -22
  139. package/dist/{create-OGLPDVOI.js → create-ODOFJF5N.js} +40 -37
  140. package/dist/{create-GHM7OTCR.js → create-R7K3ECN6.js} +1 -1
  141. package/dist/{create-D6EW3EWC.js → create-SFU3W3ZH.js} +1 -1
  142. package/dist/create-TKXH5KQY.js +239 -0
  143. package/dist/{create-33TRLASX.js → create-UPYB65PD.js} +1 -1
  144. package/dist/{create-KGYL7FBM.js → create-XVHOCZHJ.js} +1 -1
  145. package/dist/{create-4AE3VTWN.js → create-YBF4YGWG.js} +2 -2
  146. package/dist/{customers-6ZLE65UX.js → customers-SOLJ2KQQ.js} +5 -5
  147. package/dist/{edit-QBISX7D3.js → edit-2R5QCPTB.js} +16 -13
  148. package/dist/{edit-IR6V2IDN.js → edit-3E4ZO7HT.js} +21 -18
  149. package/dist/{edit-ZSOI56BQ.js → edit-4G5D7TES.js} +52 -40
  150. package/dist/{edit-B5B3XKDM.js → edit-522DG3BY.js} +1 -1
  151. package/dist/{edit-B75KK5ZX.js → edit-5CROKEJE.js} +41 -34
  152. package/dist/{edit-ATXE6CM5.js → edit-C4OCKQVU.js} +1 -1
  153. package/dist/{edit-7HTH2UJF.js → edit-FXNXTVIW.js} +3 -3
  154. package/dist/{edit-RNT555GP.js → edit-G2E5SNGU.js} +15 -12
  155. package/dist/{edit-4HZHLYI3.js → edit-GQNIINRR.js} +1 -1
  156. package/dist/{edit-2KRJIPRK.js → edit-HTLLYECP.js} +21 -18
  157. package/dist/{edit-LRRJTHV2.js → edit-KAKVPHZZ.js} +1 -1
  158. package/dist/{edit-GIJXLMC3.js → edit-O4JLGKQR.js} +2 -2
  159. package/dist/{edit-FNDDSSMT.js → edit-OKU6FMHJ.js} +60 -9
  160. package/dist/{edit-5CJZRHAA.js → edit-ORXS3A2Y.js} +1 -1
  161. package/dist/{edit-FC64DWB2.js → edit-Q3UQIOLS.js} +1 -1
  162. package/dist/edit-VVLITC2E.js +910 -0
  163. package/dist/edit-XSICGAVO.js +176 -0
  164. package/dist/{edit-7GVP6SRA.js → edit-ZAHCMF5U.js} +1 -1
  165. package/dist/{edit-MYSWY6W4.js → edit-ZMERG3L7.js} +1 -1
  166. package/dist/{edit-budget-J27CSEZH.js → edit-budget-L3CCEWNF.js} +1 -1
  167. package/dist/{edit-inventory-item-US77M2FF.js → edit-inventory-item-ZKXXL3QK.js} +2 -2
  168. package/dist/{edit-inventory-item-attributes-UGAE2NAZ.js → edit-inventory-item-attributes-GSKUMORD.js} +3 -3
  169. package/dist/{fulfillment-DCS67LTK.js → fulfillment-76IVZ266.js} +32 -22
  170. package/dist/{fulfillment-providers-GM5PO6N3.js → fulfillment-providers-G2L6LEVO.js} +24 -20
  171. package/dist/index.css +104 -65
  172. package/dist/index.d.ts +3 -10
  173. package/dist/index.js +549 -456
  174. package/dist/{inventory-OPZ2FSEE.js → inventory-WSFLTA6Z.js} +7 -7
  175. package/dist/{invite-KEJLNXEZ.js → invite-2673PU4I.js} +17 -13
  176. package/dist/{invite-CQCKEQW2.js → invite-HRXZ5YBP.js} +28 -24
  177. package/dist/loader-VDYPD3RI.js +31 -0
  178. package/dist/{locations-ZVPTQCQY.js → locations-INS6FTMJ.js} +4 -4
  179. package/dist/{login-OUHRNNXA.js → login-TWUBU6I6.js} +14 -11
  180. package/dist/{manage-locations-YUKEFCBJ.js → manage-locations-XHH5DVIR.js} +2 -2
  181. package/dist/{media-4KYFHB5V.js → media-Z4N5MKFG.js} +42 -9
  182. package/dist/{metadata-AWUKZ25V.js → metadata-5BPOBBU2.js} +3 -3
  183. package/dist/{metadata-OCE6A3JE.js → metadata-D6M66NQK.js} +17 -14
  184. package/dist/{metadata-PYY4IB7K.js → metadata-NIDIBXJT.js} +17 -14
  185. package/dist/{metadata-XP3ZYW2M.js → metadata-Q74OJWUD.js} +18 -15
  186. package/dist/{metadata-NYYL26MQ.js → metadata-REQIFWWH.js} +18 -15
  187. package/dist/{metadata-G7KZXVNE.js → metadata-YVHJPDLD.js} +17 -14
  188. package/dist/offer-create-page-E4FLSDJQ.js +743 -0
  189. package/dist/offer-detail-page-6SIBQTLP.js +492 -0
  190. package/dist/offer-edit-page-3MO566RP.js +151 -0
  191. package/dist/offer-inventory-batch-page-BD6PMDLW.js +290 -0
  192. package/dist/offer-pricing-edit-page-4TINK42V.js +199 -0
  193. package/dist/offers-GVN5LCK6.js +32 -0
  194. package/dist/{onboarding-WXZHW62K.js → onboarding-MK2RIFD4.js} +24 -21
  195. package/dist/{orders-LWJ472VM.js → orders-TVQDR4OJ.js} +30 -26
  196. package/dist/organization-XO3T2K2X.js +340 -0
  197. package/dist/{organize-RFOMQCBG.js → organize-5XRZWD5C.js} +4 -4
  198. package/dist/{organize-OVKJ3HZO.js → organize-Z7JTTDH4.js} +4 -4
  199. package/dist/pages/index.d.ts +439 -758
  200. package/dist/pages/index.js +85 -78
  201. package/dist/{payment-details-UVXYCTUK.js → payment-details-CFTX3QDL.js} +19 -16
  202. package/dist/{payouts-TR7K5I37.js → payouts-7Q7D4FET.js} +8 -8
  203. package/dist/{price-lists-S2WNELFZ.js → price-lists-6TFLA53G.js} +9 -9
  204. package/dist/{pricing-UF27DAXA.js → pricing-ECXV6K7G.js} +41 -37
  205. package/dist/{product-tags-2CKH2M6D.js → product-tags-5O7ZG6SA.js} +40 -33
  206. package/dist/{product-types-FX43JEO2.js → product-types-PKUEL7X5.js} +6 -6
  207. package/dist/product-variant-detail-PUWOMVHQ.js +210 -0
  208. package/dist/{product-variant-edit-P3DSIFE3.js → product-variant-edit-WZNO4CQX.js} +134 -66
  209. package/dist/{products-H5EMRJYS.js → products-BM3IIH5P.js} +27 -21
  210. package/dist/{products-2LHGS7X3.js → products-CPTRYL2Z.js} +44 -45
  211. package/dist/{professional-details-HYKTH44B.js → professional-details-ED4HNYXY.js} +18 -15
  212. package/dist/{profile-PB27WIRW.js → profile-6TGCNNUU.js} +21 -18
  213. package/dist/{promotions-5EYPGHJP.js → promotions-4336KI7E.js} +9 -9
  214. package/dist/receive-224KLULH.js +578 -0
  215. package/dist/refund-IGMSXQNX.js +268 -0
  216. package/dist/{register-X45K325N.js → register-OZ5CRANZ.js} +18 -15
  217. package/dist/{reset-password-GTWLBOFK.js → reset-password-5UHZU4D3.js} +1 -1
  218. package/dist/{return-reasons-LOKYRGMI.js → return-reasons-QJRA2ZX6.js} +21 -17
  219. package/dist/{sales-channels-Y4LRP7JC.js → sales-channels-CZDU7VTE.js} +7 -6
  220. package/dist/{sales-channels-7R2IY3KG.js → sales-channels-U55MUDQP.js} +7 -6
  221. package/dist/{settings-2XDLFYMS.js → settings-2GCQQTO6.js} +47 -40
  222. package/dist/shipment-HWQHMX2L.js +242 -0
  223. package/dist/{shipping-profile-R3NABPQF.js → shipping-profile-ZP7M6VSS.js} +2 -2
  224. package/dist/{shipping-profiles-QVKNFLCW.js → shipping-profiles-C5WBXWZ2.js} +21 -18
  225. package/dist/{stock-5RXNUPUT.js → stock-MQA7PRO6.js} +21 -18
  226. package/dist/{store-MPYOWMZT.js → store-5ZHZR4JI.js} +84 -149
  227. package/dist/{store-closure-DNMCHUXD.js → store-closure-H5WHV3LA.js} +24 -16
  228. package/dist/{store-select-UTPJ7DM7.js → store-select-PZS556FB.js} +19 -16
  229. package/dist/{tax-regions-UD6P5FVC.js → tax-regions-HDLBFZVG.js} +6 -6
  230. package/dist/{team-IMS66MVP.js → team-CLKJCZNH.js} +29 -26
  231. package/dist/types-CtCEtTE6.d.ts +16 -0
  232. package/package.json +5 -5
  233. package/dist/[id]-BYP37PU4.js +0 -1314
  234. package/dist/[id]-INOFZHL7.js +0 -1219
  235. package/dist/add-KRAGFFBJ.js +0 -158
  236. package/dist/bulk-edit-3SMBLIOA.js +0 -244
  237. package/dist/chunk-47SXTGLN.js +0 -397
  238. package/dist/chunk-4KX6CBJ4.js +0 -178
  239. package/dist/chunk-DLNNTQRY.js +0 -217
  240. package/dist/chunk-FX4V5JCF.js +0 -37
  241. package/dist/chunk-GC33DBKG.js +0 -143
  242. package/dist/chunk-LQYMBSRQ.js +0 -66
  243. package/dist/chunk-NK4NR6MN.js +0 -173
  244. package/dist/chunk-PFU6FSXY.js +0 -430
  245. package/dist/chunk-QJEOPT2P.js +0 -330
  246. package/dist/chunk-QSGR43JM.js +0 -30
  247. package/dist/chunk-STR3NGWE.js +0 -3736
  248. package/dist/create-3DOO3RNH.js +0 -716
  249. package/dist/create-I7HV3RM6.js +0 -150
  250. package/dist/edit-K2AD335I.js +0 -237
  251. package/dist/edit-VO5XLIEL.js +0 -362
  252. package/dist/edit-stocks-and-prices-MHHQFWFA.js +0 -408
  253. package/dist/organization-LPYQRTQC.js +0 -303
  254. package/dist/prices-3OXV5RGY.js +0 -270
  255. package/dist/product-variant-detail-WV4KXVXR.js +0 -590
  256. package/dist/shipment-4GW2JFWB.js +0 -174
  257. package/dist/stock-GPC3BCL6.js +0 -500
  258. package/dist/{chunk-SDSEW72R.js → chunk-E2HQPY32.js} +3 -3
  259. /package/dist/{chunk-CAS74NLJ.js → chunk-YV6MK4PZ.js} +0 -0
@@ -0,0 +1,910 @@
1
+ import {
2
+ useAddOrderEditItems,
3
+ useCancelOrderEdit,
4
+ useConfirmOrderEdit,
5
+ useCreateOrderEdit,
6
+ useRemoveOrderEditAddedItem,
7
+ useRequestOrderEdit,
8
+ useUpdateOrderEditAddedItem,
9
+ useUpdateOrderEditOriginalItem
10
+ } from "./chunk-LARLBYU6.js";
11
+ import {
12
+ MoneyAmountCell
13
+ } from "./chunk-L57USMYC.js";
14
+ import {
15
+ getStylizedAmount
16
+ } from "./chunk-3BXCPHN6.js";
17
+ import "./chunk-FQERBIVS.js";
18
+ import {
19
+ PlaceholderCell
20
+ } from "./chunk-PHOCVOZ5.js";
21
+ import {
22
+ _DataTable,
23
+ useDataTable
24
+ } from "./chunk-SSUUT5LK.js";
25
+ import "./chunk-YN3FGNJM.js";
26
+ import "./chunk-6OUPJNYO.js";
27
+ import "./chunk-3EF54XFY.js";
28
+ import "./chunk-IQPN4PZJ.js";
29
+ import "./chunk-TKGWSUEI.js";
30
+ import {
31
+ KeyboundForm
32
+ } from "./chunk-U2ZFCAPX.js";
33
+ import {
34
+ RouteFocusModal,
35
+ StackedFocusModal,
36
+ useRouteModal,
37
+ useStackedModal
38
+ } from "./chunk-GDWBOQI5.js";
39
+ import {
40
+ Form
41
+ } from "./chunk-3QSRE5LS.js";
42
+ import {
43
+ useQueryParams
44
+ } from "./chunk-THHRRYRS.js";
45
+ import "./chunk-LRD242C7.js";
46
+ import {
47
+ Thumbnail
48
+ } from "./chunk-WIYFXWRI.js";
49
+ import "./chunk-INNFZYX2.js";
50
+ import {
51
+ useOffers
52
+ } from "./chunk-UORPTGV2.js";
53
+ import {
54
+ useOrder,
55
+ useOrderPreview
56
+ } from "./chunk-Y2MQ5EMD.js";
57
+ import {
58
+ ActionMenu
59
+ } from "./chunk-BDGZ4EQO.js";
60
+ import "./chunk-LAVHRER2.js";
61
+ import "./chunk-QHQWEERJ.js";
62
+ import "./chunk-Y7QKP6QU.js";
63
+ import "./chunk-JAUZ73XE.js";
64
+ import "./chunk-A5DJIOHN.js";
65
+ import "./chunk-RHKRREUU.js";
66
+ import "./chunk-ZA2KFUFR.js";
67
+ import "./chunk-RIN4CBRB.js";
68
+ import "./chunk-NBMM2TZK.js";
69
+
70
+ // src/pages/orders/[id]/edit/index.tsx
71
+ import { toast as toast4 } from "@medusajs/ui";
72
+ import { useEffect } from "react";
73
+ import { useTranslation as useTranslation7 } from "react-i18next";
74
+ import { useNavigate, useParams } from "react-router-dom";
75
+
76
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-create-form.tsx
77
+ import { zodResolver } from "@hookform/resolvers/zod";
78
+ import { Button as Button2, Heading as Heading2, Input as Input3, Switch, toast as toast3, usePrompt } from "@medusajs/ui";
79
+ import { useForm } from "react-hook-form";
80
+ import { useTranslation as useTranslation6 } from "react-i18next";
81
+
82
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-items-section.tsx
83
+ import { Button, Heading, Input as Input2, toast as toast2 } from "@medusajs/ui";
84
+ import { useMemo as useMemo4, useState as useState2 } from "react";
85
+ import { useTranslation as useTranslation5 } from "react-i18next";
86
+
87
+ // src/pages/orders/[id]/edit/_components/add-order-edit-items-table/add-order-edit-items-table.tsx
88
+ import { useMemo as useMemo2, useState } from "react";
89
+ import { useTranslation as useTranslation3 } from "react-i18next";
90
+
91
+ // src/pages/orders/[id]/edit/_components/add-order-edit-items-table/use-order-edit-item-table-columns.tsx
92
+ import { Checkbox, Text } from "@medusajs/ui";
93
+ import { createColumnHelper } from "@tanstack/react-table";
94
+ import { useMemo } from "react";
95
+ import { useTranslation } from "react-i18next";
96
+ import { jsx, jsxs } from "react/jsx-runtime";
97
+ var columnHelper = createColumnHelper();
98
+ var useOrderEditItemsTableColumns = () => {
99
+ const { t } = useTranslation();
100
+ return useMemo(
101
+ () => [
102
+ columnHelper.display({
103
+ id: "select",
104
+ header: ({ table }) => /* @__PURE__ */ jsx(
105
+ Checkbox,
106
+ {
107
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
108
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
109
+ }
110
+ ),
111
+ cell: ({ row }) => {
112
+ const isSelectable = row.getCanSelect();
113
+ return /* @__PURE__ */ jsx(
114
+ Checkbox,
115
+ {
116
+ disabled: !isSelectable,
117
+ checked: row.getIsSelected(),
118
+ onCheckedChange: (value) => row.toggleSelected(!!value),
119
+ onClick: (e) => {
120
+ e.stopPropagation();
121
+ }
122
+ }
123
+ );
124
+ }
125
+ }),
126
+ columnHelper.display({
127
+ id: "product",
128
+ header: t("fields.product"),
129
+ cell: ({ row }) => {
130
+ const variant = row.original.product_variant;
131
+ const productTitle = variant?.product?.title;
132
+ if (!productTitle) {
133
+ return /* @__PURE__ */ jsx(PlaceholderCell, {});
134
+ }
135
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[300px] items-center gap-x-3 overflow-hidden", children: [
136
+ /* @__PURE__ */ jsx(Thumbnail, { src: variant?.product?.thumbnail }),
137
+ /* @__PURE__ */ jsx(
138
+ Text,
139
+ {
140
+ size: "small",
141
+ leading: "compact",
142
+ className: "truncate",
143
+ title: productTitle,
144
+ children: productTitle
145
+ }
146
+ )
147
+ ] });
148
+ }
149
+ }),
150
+ columnHelper.accessor("sku", {
151
+ header: t("fields.sku"),
152
+ cell: ({ getValue }) => {
153
+ const sku = getValue();
154
+ if (!sku) return /* @__PURE__ */ jsx(PlaceholderCell, {});
155
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: sku });
156
+ }
157
+ }),
158
+ columnHelper.display({
159
+ id: "variant_title",
160
+ header: t("fields.title"),
161
+ cell: ({ row }) => {
162
+ const title = row.original.product_variant?.title;
163
+ if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
164
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: title });
165
+ }
166
+ })
167
+ ],
168
+ [t]
169
+ );
170
+ };
171
+
172
+ // src/pages/orders/[id]/edit/_components/add-order-edit-items-table/use-order-edit-item-table-filters.tsx
173
+ import { useTranslation as useTranslation2 } from "react-i18next";
174
+ var useOrderEditItemTableFilters = () => {
175
+ const { t } = useTranslation2();
176
+ const filters = [
177
+ {
178
+ key: "created_at",
179
+ label: t("fields.createdAt"),
180
+ type: "date"
181
+ },
182
+ {
183
+ key: "updated_at",
184
+ label: t("fields.updatedAt"),
185
+ type: "date"
186
+ }
187
+ ];
188
+ return filters;
189
+ };
190
+
191
+ // src/pages/orders/[id]/edit/_components/add-order-edit-items-table/use-order-edit-item-table-query.tsx
192
+ var useOrderEditItemTableQuery = ({
193
+ pageSize = 50,
194
+ prefix
195
+ }) => {
196
+ const raw = useQueryParams(
197
+ ["q", "offset", "order", "created_at", "updated_at"],
198
+ prefix
199
+ );
200
+ const { offset, created_at, updated_at, ...rest } = raw;
201
+ const searchParams = {
202
+ ...rest,
203
+ limit: pageSize,
204
+ offset: offset ? Number(offset) : 0,
205
+ created_at: created_at ? JSON.parse(created_at) : void 0,
206
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0
207
+ };
208
+ return { searchParams, raw };
209
+ };
210
+
211
+ // src/pages/orders/[id]/edit/_components/add-order-edit-items-table/add-order-edit-items-table.tsx
212
+ import { jsx as jsx2 } from "react/jsx-runtime";
213
+ var PAGE_SIZE = 50;
214
+ var PREFIX = "rit";
215
+ var OFFER_PICKER_FIELDS = [
216
+ "id",
217
+ "sku",
218
+ "variant_id",
219
+ "seller_id",
220
+ "prices.amount",
221
+ "prices.currency_code",
222
+ "product_variant.id",
223
+ "product_variant.title",
224
+ "product_variant.product.id",
225
+ "product_variant.product.title",
226
+ "product_variant.product.thumbnail",
227
+ "product_variant.manage_inventory",
228
+ "product_variant.inventory_quantity",
229
+ "product_variant.inventory_items.required_quantity",
230
+ "product_variant.inventory_items.inventory.location_levels.available_quantity"
231
+ ].join(",");
232
+ var offerHasInventory = (offer) => {
233
+ const variant = offer.product_variant;
234
+ if (!variant) return false;
235
+ if (variant.manage_inventory === false) return true;
236
+ const links = variant.inventory_items ?? [];
237
+ if (!links.length) {
238
+ return (variant.inventory_quantity ?? 0) > 0;
239
+ }
240
+ return links.every((link) => {
241
+ const available = (link.inventory?.location_levels ?? []).reduce(
242
+ (acc, lvl) => acc + (lvl.available_quantity ?? 0),
243
+ 0
244
+ );
245
+ const required = link.required_quantity ?? 1;
246
+ return required > 0 && available >= required;
247
+ });
248
+ };
249
+ var AddOrderEditItemsTable = ({
250
+ currencyCode,
251
+ onSelectionChange
252
+ }) => {
253
+ const { t } = useTranslation3();
254
+ const [rowSelection, setRowSelection] = useState({});
255
+ const updater = (fn) => {
256
+ const newState = typeof fn === "function" ? fn(rowSelection) : fn;
257
+ setRowSelection(newState);
258
+ onSelectionChange(Object.keys(newState));
259
+ };
260
+ const { searchParams, raw } = useOrderEditItemTableQuery({
261
+ pageSize: PAGE_SIZE,
262
+ prefix: PREFIX
263
+ });
264
+ const offersResponse = useOffers({
265
+ ...searchParams,
266
+ fields: OFFER_PICKER_FIELDS
267
+ });
268
+ const rawOffers = offersResponse.offers ?? [];
269
+ const rawCount = offersResponse.count ?? 0;
270
+ const offers = useMemo2(() => {
271
+ return rawOffers.filter((offer) => {
272
+ if (currencyCode) {
273
+ const hasPrice = (offer.prices ?? []).some(
274
+ (p) => p.currency_code === currencyCode
275
+ );
276
+ if (!hasPrice) return false;
277
+ }
278
+ return offerHasInventory(offer);
279
+ });
280
+ }, [rawOffers, currencyCode]);
281
+ const count = offers.length;
282
+ void rawCount;
283
+ const columns = useOrderEditItemsTableColumns();
284
+ const filters = useOrderEditItemTableFilters();
285
+ const { table } = useDataTable({
286
+ data: offers,
287
+ columns,
288
+ count,
289
+ enablePagination: true,
290
+ // Row id = offer id so onSelectionChange yields offer_ids that the modal
291
+ // layer sends to the backend item-add routes (which accept `offer_id` and
292
+ // resolve to variant_id + unit_price server-side).
293
+ getRowId: (row) => row.id,
294
+ pageSize: PAGE_SIZE,
295
+ enableRowSelection: () => true,
296
+ rowSelection: {
297
+ state: rowSelection,
298
+ updater
299
+ }
300
+ });
301
+ return /* @__PURE__ */ jsx2(
302
+ "div",
303
+ {
304
+ className: "flex size-full flex-col overflow-hidden",
305
+ "data-testid": "add-offers-picker",
306
+ children: /* @__PURE__ */ jsx2(
307
+ _DataTable,
308
+ {
309
+ table,
310
+ columns,
311
+ pageSize: PAGE_SIZE,
312
+ count,
313
+ filters,
314
+ pagination: true,
315
+ layout: "fill",
316
+ search: true,
317
+ orderBy: [
318
+ { key: "sku", label: t("fields.sku") },
319
+ { key: "created_at", label: t("fields.createdAt") },
320
+ { key: "updated_at", label: t("fields.updatedAt") }
321
+ ],
322
+ prefix: PREFIX,
323
+ queryObject: raw
324
+ }
325
+ )
326
+ }
327
+ );
328
+ };
329
+
330
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-item.tsx
331
+ import {
332
+ ArrowUturnLeft,
333
+ DocumentSeries,
334
+ ReceiptPercent,
335
+ XCircle
336
+ } from "@medusajs/icons";
337
+ import { Badge, Input, Text as Text2, toast, Tooltip } from "@medusajs/ui";
338
+ import { useMemo as useMemo3 } from "react";
339
+ import { useTranslation as useTranslation4 } from "react-i18next";
340
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
341
+ function OrderEditItem({ item, currencyCode, orderId }) {
342
+ const { t } = useTranslation4();
343
+ const { mutateAsync: addItems } = useAddOrderEditItems(orderId);
344
+ const { mutateAsync: updateAddedItem } = useUpdateOrderEditAddedItem(orderId);
345
+ const { mutateAsync: updateOriginalItem } = useUpdateOrderEditOriginalItem(orderId);
346
+ const { mutateAsync: undoAction } = useRemoveOrderEditAddedItem(orderId);
347
+ const actions = item.actions ?? [];
348
+ const isAddedItem = useMemo3(
349
+ () => !!actions.find((a) => a.action === "ITEM_ADD"),
350
+ [actions]
351
+ );
352
+ const isItemUpdated = useMemo3(
353
+ () => !!actions.find((a) => a.action === "ITEM_UPDATE"),
354
+ [actions]
355
+ );
356
+ const fulfilledQty = item.detail?.fulfilled_quantity ?? 0;
357
+ const returnedQty = item.detail?.returned_quantity ?? 0;
358
+ const floor = fulfilledQty + returnedQty;
359
+ const isItemRemoved = useMemo3(() => {
360
+ const updateAction = actions.find((a) => a.action === "ITEM_UPDATE");
361
+ return !!updateAction && item.quantity === floor;
362
+ }, [actions, item.quantity, floor]);
363
+ const appliedPromoCodes = useMemo3(() => {
364
+ return (item.adjustments || []).map((adjustment) => adjustment.code).filter((c) => !!c);
365
+ }, [item.adjustments]);
366
+ const onUpdate = async (quantity) => {
367
+ if (quantity < floor) {
368
+ toast.error(t("orders.edits.removeBlockedFulfilledOrReturned"));
369
+ return;
370
+ }
371
+ if (quantity === item.quantity) {
372
+ return;
373
+ }
374
+ const addItemAction = actions.find((a) => a.action === "ITEM_ADD");
375
+ try {
376
+ if (addItemAction) {
377
+ await updateAddedItem({ $actionId: addItemAction.id, quantity });
378
+ } else {
379
+ await updateOriginalItem({ $itemId: item.id, quantity });
380
+ }
381
+ } catch (e) {
382
+ toast.error(
383
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
384
+ );
385
+ }
386
+ };
387
+ const onRemove = async () => {
388
+ const addItemAction = actions.find((a) => a.action === "ITEM_ADD");
389
+ try {
390
+ if (addItemAction) {
391
+ await undoAction(addItemAction.id);
392
+ } else {
393
+ await updateOriginalItem({
394
+ $itemId: item.id,
395
+ quantity: floor
396
+ });
397
+ }
398
+ } catch (e) {
399
+ toast.error(
400
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
401
+ );
402
+ }
403
+ };
404
+ const onRemoveUndo = async () => {
405
+ const updateItemAction = actions.find((a) => a.action === "ITEM_UPDATE");
406
+ try {
407
+ if (updateItemAction) {
408
+ await undoAction(updateItemAction.id);
409
+ }
410
+ } catch (e) {
411
+ toast.error(
412
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
413
+ );
414
+ }
415
+ };
416
+ const onDuplicate = async () => {
417
+ if (!item.variant_id) {
418
+ return;
419
+ }
420
+ try {
421
+ await addItems({
422
+ items: [
423
+ {
424
+ variant_id: item.variant_id,
425
+ quantity: item.quantity
426
+ }
427
+ ]
428
+ });
429
+ } catch (e) {
430
+ toast.error(
431
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
432
+ );
433
+ }
434
+ };
435
+ const isAtFloor = item.quantity === floor;
436
+ const qtyInput = /* @__PURE__ */ jsx3(
437
+ Input,
438
+ {
439
+ className: "bg-ui-bg-base txt-small w-[67px] rounded-lg [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
440
+ type: "number",
441
+ step: "any",
442
+ disabled: isAtFloor,
443
+ min: floor,
444
+ defaultValue: item.quantity,
445
+ "data-testid": `edit-item-${item.id}-qty`,
446
+ onBlur: (e) => {
447
+ const val = e.target.value;
448
+ const payload = val === "" ? null : Number(val);
449
+ if (payload !== null) {
450
+ onUpdate(payload);
451
+ }
452
+ }
453
+ }
454
+ );
455
+ return /* @__PURE__ */ jsx3(
456
+ "div",
457
+ {
458
+ className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl",
459
+ "data-testid": `edit-item-${item.id}`,
460
+ children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-x-2 gap-y-2 p-3 text-sm md:flex-row", children: [
461
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 items-center justify-between", children: [
462
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-row items-center gap-x-3", children: [
463
+ /* @__PURE__ */ jsx3(Thumbnail, { src: item.thumbnail }),
464
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
465
+ /* @__PURE__ */ jsxs2("div", { children: [
466
+ /* @__PURE__ */ jsxs2(Text2, { className: "txt-small", as: "span", weight: "plus", children: [
467
+ item.title,
468
+ " "
469
+ ] }),
470
+ item.variant_sku && /* @__PURE__ */ jsxs2("span", { children: [
471
+ "(",
472
+ item.variant_sku,
473
+ ")"
474
+ ] })
475
+ ] }),
476
+ /* @__PURE__ */ jsx3(Text2, { as: "div", className: "text-ui-fg-subtle txt-small", children: item.subtitle })
477
+ ] })
478
+ ] }),
479
+ isAddedItem && /* @__PURE__ */ jsx3(Badge, { size: "2xsmall", rounded: "full", color: "blue", className: "mr-1", children: t("general.new") }),
480
+ isItemRemoved ? /* @__PURE__ */ jsx3(Badge, { size: "2xsmall", rounded: "full", color: "red", className: "mr-1", children: t("general.removed") }) : isItemUpdated && /* @__PURE__ */ jsx3(
481
+ Badge,
482
+ {
483
+ size: "2xsmall",
484
+ rounded: "full",
485
+ color: "orange",
486
+ className: "mr-1",
487
+ children: t("general.modified")
488
+ }
489
+ )
490
+ ] }),
491
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 items-center justify-between", children: [
492
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-grow items-center gap-2", children: [
493
+ floor > 0 && isAtFloor ? /* @__PURE__ */ jsx3(
494
+ Tooltip,
495
+ {
496
+ content: t("orders.edits.removeBlockedFulfilledOrReturned"),
497
+ children: qtyInput
498
+ }
499
+ ) : qtyInput,
500
+ /* @__PURE__ */ jsx3(Text2, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") }),
501
+ appliedPromoCodes.length > 0 && /* @__PURE__ */ jsx3("div", { className: "flex flex-shrink pt-[2px]", children: /* @__PURE__ */ jsx3(
502
+ Tooltip,
503
+ {
504
+ content: /* @__PURE__ */ jsx3("span", { className: "text-pretty", children: appliedPromoCodes.map((code) => /* @__PURE__ */ jsx3("div", { children: code }, code)) }),
505
+ children: /* @__PURE__ */ jsx3(ReceiptPercent, { className: "text-ui-fg-subtle font-normal" })
506
+ }
507
+ ) })
508
+ ] }),
509
+ /* @__PURE__ */ jsx3("div", { className: "text-ui-fg-subtle txt-small mr-2 flex flex-shrink-0", children: /* @__PURE__ */ jsx3(
510
+ MoneyAmountCell,
511
+ {
512
+ currencyCode,
513
+ amount: item.total ?? 0
514
+ }
515
+ ) }),
516
+ /* @__PURE__ */ jsx3(
517
+ ActionMenu,
518
+ {
519
+ groups: [
520
+ {
521
+ actions: [
522
+ {
523
+ label: t("actions.duplicate"),
524
+ onClick: onDuplicate,
525
+ icon: /* @__PURE__ */ jsx3(DocumentSeries, {})
526
+ }
527
+ ]
528
+ },
529
+ {
530
+ actions: [
531
+ !isItemRemoved ? {
532
+ label: t("actions.remove"),
533
+ onClick: onRemove,
534
+ icon: /* @__PURE__ */ jsx3(XCircle, {}),
535
+ disabled: isAtFloor
536
+ } : {
537
+ label: t("actions.undo"),
538
+ onClick: onRemoveUndo,
539
+ icon: /* @__PURE__ */ jsx3(ArrowUturnLeft, {})
540
+ }
541
+ ]
542
+ }
543
+ ]
544
+ }
545
+ )
546
+ ] })
547
+ ] })
548
+ },
549
+ item.quantity
550
+ );
551
+ }
552
+
553
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-items-section.tsx
554
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
555
+ var addedOffers = [];
556
+ var OrderEditItemsSection = ({
557
+ order,
558
+ preview
559
+ }) => {
560
+ const { t } = useTranslation5();
561
+ const { setIsOpen } = useStackedModal();
562
+ const [filterTerm, setFilterTerm] = useState2("");
563
+ const { mutateAsync: addItems, isPending } = useAddOrderEditItems(order.id);
564
+ const onItemsSelected = async () => {
565
+ if (!addedOffers.length) {
566
+ setIsOpen("order-edit-add-items", false);
567
+ return;
568
+ }
569
+ try {
570
+ await addItems({
571
+ // Vendor route resolves `offer_id` → variant_id + unit_price
572
+ // server-side. Picker rows are keyed by offer id, not variant id.
573
+ items: addedOffers.map((offer_id) => ({
574
+ offer_id,
575
+ quantity: 1
576
+ }))
577
+ });
578
+ addedOffers = [];
579
+ setIsOpen("order-edit-add-items", false);
580
+ } catch (e) {
581
+ toast2.error(
582
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
583
+ );
584
+ }
585
+ };
586
+ const filteredItems = useMemo4(() => {
587
+ const term = filterTerm.toLowerCase();
588
+ if (!term) {
589
+ return preview.items;
590
+ }
591
+ return preview.items.filter(
592
+ (i) => i.title?.toLowerCase().includes(term) || i.product_title?.toLowerCase().includes(term)
593
+ );
594
+ }, [preview, filterTerm]);
595
+ return /* @__PURE__ */ jsxs3("div", { children: [
596
+ /* @__PURE__ */ jsxs3("div", { className: "mb-3 mt-8 flex items-center justify-between", children: [
597
+ /* @__PURE__ */ jsx4(Heading, { level: "h2", children: t("fields.items") }),
598
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
599
+ /* @__PURE__ */ jsx4(
600
+ Input2,
601
+ {
602
+ value: filterTerm,
603
+ onChange: (e) => setFilterTerm(e.target.value),
604
+ placeholder: t("fields.search"),
605
+ autoComplete: "off",
606
+ type: "search",
607
+ "data-testid": "edit-items-search"
608
+ }
609
+ ),
610
+ /* @__PURE__ */ jsxs3(StackedFocusModal, { id: "order-edit-add-items", children: [
611
+ /* @__PURE__ */ jsx4(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx4(
612
+ Button,
613
+ {
614
+ variant: "secondary",
615
+ size: "small",
616
+ "data-testid": "edit-add-items-trigger",
617
+ children: t("actions.addItems")
618
+ }
619
+ ) }),
620
+ /* @__PURE__ */ jsxs3(StackedFocusModal.Content, { children: [
621
+ /* @__PURE__ */ jsx4(StackedFocusModal.Header, {}),
622
+ /* @__PURE__ */ jsx4(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: t("orders.edits.addItems") }) }),
623
+ /* @__PURE__ */ jsx4(StackedFocusModal.Description, { className: "sr-only", children: t("orders.edits.addItemsDescription") }),
624
+ /* @__PURE__ */ jsx4(StackedFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsx4(
625
+ AddOrderEditItemsTable,
626
+ {
627
+ currencyCode: order.currency_code,
628
+ onSelectionChange: (finalSelection) => {
629
+ addedOffers = finalSelection;
630
+ }
631
+ }
632
+ ) }),
633
+ /* @__PURE__ */ jsx4(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-end gap-x-2", children: [
634
+ /* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
635
+ Button,
636
+ {
637
+ type: "button",
638
+ variant: "secondary",
639
+ size: "small",
640
+ "data-testid": "edit-add-items-cancel",
641
+ children: t("actions.cancel")
642
+ }
643
+ ) }),
644
+ /* @__PURE__ */ jsx4(
645
+ Button,
646
+ {
647
+ type: "submit",
648
+ variant: "primary",
649
+ size: "small",
650
+ role: "button",
651
+ disabled: isPending,
652
+ onClick: async () => await onItemsSelected(),
653
+ "data-testid": "edit-add-items-save",
654
+ children: t("actions.save")
655
+ },
656
+ "submit-button"
657
+ )
658
+ ] }) }) })
659
+ ] })
660
+ ] })
661
+ ] })
662
+ ] }),
663
+ filteredItems.map((item) => /* @__PURE__ */ jsx4(
664
+ OrderEditItem,
665
+ {
666
+ item,
667
+ orderId: order.id,
668
+ currencyCode: order.currency_code
669
+ },
670
+ item.id
671
+ )),
672
+ filterTerm && !filteredItems.length && /* @__PURE__ */ jsx4(
673
+ "div",
674
+ {
675
+ style: {
676
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
677
+ },
678
+ className: "bg-ui-bg-field mt-4 block h-[56px] w-full rounded-lg border border-dashed"
679
+ }
680
+ )
681
+ ] });
682
+ };
683
+
684
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/schema.ts
685
+ import { z } from "zod";
686
+ var OrderEditCreateSchema = z.object({
687
+ note: z.string().optional(),
688
+ send_notification: z.boolean().optional()
689
+ });
690
+
691
+ // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-create-form.tsx
692
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
693
+ var OrderEditCreateForm = ({
694
+ order,
695
+ preview
696
+ }) => {
697
+ const { t } = useTranslation6();
698
+ const { handleSuccess } = useRouteModal();
699
+ const { mutateAsync: cancelOrderEditRequest, isPending: isCanceling } = useCancelOrderEdit(order.id);
700
+ const { mutateAsync: requestOrderEdit, isPending: isRequesting } = useRequestOrderEdit(order.id);
701
+ const { mutateAsync: confirmOrderEdit, isPending: isConfirming } = useConfirmOrderEdit(order.id);
702
+ const isRequestRunning = isCanceling || isRequesting || isConfirming;
703
+ const form = useForm({
704
+ defaultValues: () => {
705
+ return Promise.resolve({
706
+ note: "",
707
+ send_notification: false
708
+ });
709
+ },
710
+ resolver: zodResolver(OrderEditCreateSchema)
711
+ });
712
+ const prompt = usePrompt();
713
+ const handleSubmit = form.handleSubmit(async () => {
714
+ try {
715
+ const res = await prompt({
716
+ title: t("general.areYouSure"),
717
+ description: t("orders.edits.confirmText"),
718
+ confirmText: t("actions.continue"),
719
+ cancelText: t("actions.cancel"),
720
+ variant: "confirmation"
721
+ });
722
+ if (!res) {
723
+ return;
724
+ }
725
+ await requestOrderEdit();
726
+ toast3.success(t("orders.edits.toast.requestSent"));
727
+ await confirmOrderEdit();
728
+ toast3.success(t("orders.edits.toast.confirmedSuccessfully"));
729
+ handleSuccess(`/orders/${order.id}`);
730
+ } catch (e) {
731
+ toast3.error(t("general.error"), {
732
+ description: e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
733
+ });
734
+ }
735
+ });
736
+ return /* @__PURE__ */ jsx5(
737
+ RouteFocusModal.Form,
738
+ {
739
+ form,
740
+ onClose: (isSubmitSuccessful) => {
741
+ if (!isSubmitSuccessful) {
742
+ cancelOrderEditRequest(void 0, {
743
+ onSuccess: () => {
744
+ toast3.success(t("orders.edits.toast.canceledSuccessfully"));
745
+ },
746
+ onError: (error) => {
747
+ toast3.error(error.message);
748
+ }
749
+ });
750
+ }
751
+ },
752
+ children: /* @__PURE__ */ jsxs4(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
753
+ /* @__PURE__ */ jsx5(RouteFocusModal.Header, {}),
754
+ /* @__PURE__ */ jsx5(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx5("span", { className: "sr-only", children: t("orders.edits.title") }) }),
755
+ /* @__PURE__ */ jsx5(RouteFocusModal.Description, { className: "sr-only", children: t("orders.edits.title") }),
756
+ /* @__PURE__ */ jsx5(RouteFocusModal.Body, { className: "flex size-full justify-center overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "mt-16 w-[720px] max-w-[100%] px-4 md:p-0", children: [
757
+ /* @__PURE__ */ jsx5(Heading2, { level: "h1", children: t("orders.edits.create") }),
758
+ /* @__PURE__ */ jsx5(OrderEditItemsSection, { preview, order }),
759
+ /* @__PURE__ */ jsxs4("div", { className: "mt-8 border-y border-dotted py-4", children: [
760
+ /* @__PURE__ */ jsxs4("div", { className: "mb-2 flex items-center justify-between", children: [
761
+ /* @__PURE__ */ jsx5("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.edits.currentTotal") }),
762
+ /* @__PURE__ */ jsx5("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(order.total, order.currency_code) })
763
+ ] }),
764
+ /* @__PURE__ */ jsxs4("div", { className: "mb-2 flex items-center justify-between", children: [
765
+ /* @__PURE__ */ jsx5("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.edits.newTotal") }),
766
+ /* @__PURE__ */ jsx5("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(preview.total, order.currency_code) })
767
+ ] }),
768
+ /* @__PURE__ */ jsxs4("div", { className: "mt-4 flex items-center justify-between border-t border-dotted pt-4", children: [
769
+ /* @__PURE__ */ jsx5("span", { className: "txt-small font-medium", children: t("orders.edits.differenceDue") }),
770
+ /* @__PURE__ */ jsx5("span", { className: "txt-small font-medium", children: getStylizedAmount(
771
+ preview.summary.pending_difference,
772
+ order.currency_code
773
+ ) })
774
+ ] })
775
+ ] }),
776
+ /* @__PURE__ */ jsx5(
777
+ Form.Field,
778
+ {
779
+ control: form.control,
780
+ name: "note",
781
+ render: ({ field }) => {
782
+ return /* @__PURE__ */ jsx5(Form.Item, { children: /* @__PURE__ */ jsxs4("div", { className: "mt-8 flex", children: [
783
+ /* @__PURE__ */ jsxs4("div", { className: "block flex-1", children: [
784
+ /* @__PURE__ */ jsx5(Form.Label, { children: t("fields.note") }),
785
+ /* @__PURE__ */ jsx5(Form.Hint, { className: "!mt-1", children: t("orders.edits.noteHint") })
786
+ ] }),
787
+ /* @__PURE__ */ jsx5("div", { className: "w-full flex-1 flex-grow", children: /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(
788
+ Input3,
789
+ {
790
+ ...field,
791
+ placeholder: t("fields.note"),
792
+ "data-testid": "edit-internal-note"
793
+ }
794
+ ) }) })
795
+ ] }) });
796
+ }
797
+ }
798
+ ),
799
+ /* @__PURE__ */ jsx5("div", { className: "bg-ui-bg-field mt-8 rounded-lg border py-2 pl-2 pr-4", children: /* @__PURE__ */ jsx5(
800
+ Form.Field,
801
+ {
802
+ control: form.control,
803
+ name: "send_notification",
804
+ render: ({ field: { onChange, value, ...field } }) => {
805
+ return /* @__PURE__ */ jsxs4(Form.Item, { children: [
806
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center", children: [
807
+ /* @__PURE__ */ jsx5(Form.Control, { className: "mr-4 self-start", children: /* @__PURE__ */ jsx5(
808
+ Switch,
809
+ {
810
+ dir: "ltr",
811
+ className: "mt-[2px] rtl:rotate-180",
812
+ checked: !!value,
813
+ onCheckedChange: onChange,
814
+ ...field
815
+ }
816
+ ) }),
817
+ /* @__PURE__ */ jsxs4("div", { className: "block", children: [
818
+ /* @__PURE__ */ jsx5(Form.Label, { children: t("orders.returns.sendNotification") }),
819
+ /* @__PURE__ */ jsx5(Form.Hint, { className: "!mt-1", children: t("orders.returns.sendNotificationHint") })
820
+ ] })
821
+ ] }),
822
+ /* @__PURE__ */ jsx5(Form.ErrorMessage, {})
823
+ ] });
824
+ }
825
+ }
826
+ ) }),
827
+ /* @__PURE__ */ jsx5("div", { className: "p-8" })
828
+ ] }) }),
829
+ /* @__PURE__ */ jsx5(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx5("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-x-2", children: [
830
+ /* @__PURE__ */ jsx5(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx5(
831
+ Button2,
832
+ {
833
+ type: "button",
834
+ variant: "secondary",
835
+ size: "small",
836
+ "data-testid": "edit-cancel",
837
+ children: t("orders.edits.cancel")
838
+ }
839
+ ) }),
840
+ /* @__PURE__ */ jsx5(
841
+ Button2,
842
+ {
843
+ type: "submit",
844
+ variant: "primary",
845
+ size: "small",
846
+ isLoading: isRequestRunning,
847
+ "data-testid": "edit-confirm",
848
+ children: t("orders.edits.confirm")
849
+ },
850
+ "submit-button"
851
+ )
852
+ ] }) }) })
853
+ ] })
854
+ }
855
+ );
856
+ };
857
+
858
+ // src/pages/orders/[id]/edit/index.tsx
859
+ import { jsx as jsx6 } from "react/jsx-runtime";
860
+ var IS_REQUEST_RUNNING = false;
861
+ var Component = () => {
862
+ const { id } = useParams();
863
+ const navigate = useNavigate();
864
+ const { t } = useTranslation7();
865
+ const orderId = id ?? "";
866
+ const { order } = useOrder(orderId, {
867
+ // Use the `<rel>.*` suffix form. Combining `*foo` with `*foo.bar`
868
+ // (or the `+foo.bar.baz` form) makes Medusa's query parser try to
869
+ // look up a literal property called `*items` / `+items` on Order
870
+ // and 500. See packages/core/src/api/vendor/orders/query-config.ts
871
+ // for the matching guidance applied to the defaults.
872
+ fields: "currency_code,total,items.*,items.variant.*"
873
+ });
874
+ const { order: preview } = useOrderPreview(orderId);
875
+ const { mutateAsync: createOrderEdit } = useCreateOrderEdit(orderId);
876
+ useEffect(() => {
877
+ async function run() {
878
+ if (IS_REQUEST_RUNNING || !preview) {
879
+ return;
880
+ }
881
+ if (preview.order_change) {
882
+ if (preview.order_change.change_type !== "edit") {
883
+ navigate(`/orders/${preview.id}`, { replace: true });
884
+ toast4.error(t("orders.edits.activeChangeError"));
885
+ }
886
+ return;
887
+ }
888
+ IS_REQUEST_RUNNING = true;
889
+ try {
890
+ await createOrderEdit({
891
+ order_id: preview.id
892
+ });
893
+ } catch (e) {
894
+ toast4.error(
895
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
896
+ );
897
+ navigate(`/orders/${preview.id}`, { replace: true });
898
+ } finally {
899
+ IS_REQUEST_RUNNING = false;
900
+ }
901
+ }
902
+ run();
903
+ }, [preview]);
904
+ return /* @__PURE__ */ jsx6(RouteFocusModal, { children: preview && order && /* @__PURE__ */ jsx6(OrderEditCreateForm, { order, preview }) });
905
+ };
906
+ var edit_default = Component;
907
+ export {
908
+ Component,
909
+ edit_default as default
910
+ };