@mercurjs/vendor 2.2.0-canary.8 → 2.2.0-rc.0

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 (305) hide show
  1. package/dist/{[id]-GMJAPZPU.js → [id]-3LNKC5OJ.js} +41 -40
  2. package/dist/[id]-4HO4S2PX.js +3074 -0
  3. package/dist/{[id]-QWL6SUOB.js → [id]-4LIIFGET.js} +14 -14
  4. package/dist/{[id]-5ADOHZ45.js → [id]-5EECCIRP.js} +151 -58
  5. package/dist/{[id]-K2CT7BXQ.js → [id]-5P5LTATX.js} +3 -3
  6. package/dist/{[id]-T7USGHIY.js → [id]-AQUUZFRX.js} +11 -11
  7. package/dist/{[id]-BTGQJ3UD.js → [id]-CUBGVODE.js} +177 -85
  8. package/dist/{[id]-ZAQYATGN.js → [id]-DCGPICT3.js} +39 -38
  9. package/dist/{[id]-IWCWVNVI.js → [id]-DT5YJVKG.js} +32 -32
  10. package/dist/{[id]-L6FD7BRE.js → [id]-IEBZ6V3W.js} +51 -48
  11. package/dist/{[id]-ZCMSBEVM.js → [id]-N7JEZFXQ.js} +6 -6
  12. package/dist/[id]-U6FKX5UQ.js +975 -0
  13. package/dist/{[id]-BPAZLOLW.js → [id]-XB45DY2D.js} +19 -19
  14. package/dist/[id]-XP5KEMNX.js +602 -0
  15. package/dist/{[location_id]-NUBXDDJC.js → [location_id]-I4HHUHWY.js} +14 -14
  16. package/dist/{[province_id]-5KZGMQER.js → [province_id]-OYX4MOCF.js} +31 -31
  17. package/dist/{add-KMHJ6OC6.js → add-3T4GBFMM.js} +63 -57
  18. package/dist/{add-Y6GMGLYX.js → add-RPRJWCYU.js} +99 -34
  19. package/dist/{add-customer-groups-NXSWICFI.js → add-customer-groups-FB5T6PQN.js} +44 -42
  20. package/dist/{add-products-LXYF57BK.js → add-products-F243SWGD.js} +40 -40
  21. package/dist/{add-promotions-VTYAEDCN.js → add-promotions-TJDK7HLW.js} +18 -18
  22. package/dist/{add-to-campaign-DLP7PSQB.js → add-to-campaign-Q6OAJMUJ.js} +6 -6
  23. package/dist/{address-JFXH3M7D.js → address-XVBSNMFU.js} +24 -24
  24. package/dist/{adjust-inventory-V2V7NWWH.js → adjust-inventory-IZLRMQXV.js} +4 -4
  25. package/dist/allocate-items-Q3VALDYT.js +685 -0
  26. package/dist/{areas-FB63OQAI.js → areas-IYGBRCRH.js} +14 -14
  27. package/dist/attributes-LGEM2JJW.js +353 -0
  28. package/dist/breadcrumb-BC6XN2SE.js +13 -0
  29. package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-BFNJWOJ4.js} +10 -9
  30. package/dist/{breadcrumb-S4V7MJUM.js → breadcrumb-BXD3SRM7.js} +3 -3
  31. package/dist/{breadcrumb-HV67K43U.js → breadcrumb-FEYGZFJU.js} +4 -4
  32. package/dist/{breadcrumb-EG3ANCVO.js → breadcrumb-H45Z2WNG.js} +3 -3
  33. package/dist/breadcrumb-ILEAQRW7.js +33 -0
  34. package/dist/breadcrumb-K4HBKZUE.js +28 -0
  35. package/dist/{breadcrumb-YBBYFQYG.js → breadcrumb-KZPOPXGG.js} +2 -2
  36. package/dist/{breadcrumb-F3BN5753.js → breadcrumb-L262VPBO.js} +2 -2
  37. package/dist/{breadcrumb-3Z7KZG62.js → breadcrumb-LEFHXFLT.js} +3 -3
  38. package/dist/{breadcrumb-D3UDTWGE.js → breadcrumb-MOA2DBOE.js} +2 -2
  39. package/dist/breadcrumb-NZYOCEEM.js +47 -0
  40. package/dist/breadcrumb-VY5DNTTJ.js +46 -0
  41. package/dist/{breadcrumb-UAUX7XCV.js → breadcrumb-WG6TIF4C.js} +2 -2
  42. package/dist/{breadcrumb-7R6E6G2X.js → breadcrumb-XEZCMI55.js} +2 -2
  43. package/dist/{breadcrumb-FES7EKUR.js → breadcrumb-XGXKCDYS.js} +4 -4
  44. package/dist/{breadcrumb-Y5UW3I4C.js → breadcrumb-YOY6Z36F.js} +2 -2
  45. package/dist/{campaigns-JAQTSA4Z.js → campaigns-DZKRNCA4.js} +9 -9
  46. package/dist/{categories-6TVMTN62.js → categories-JZJA2IBQ.js} +13 -11
  47. package/dist/{chunk-SFQKKIHA.js → chunk-27WLUOI2.js} +1 -1
  48. package/dist/{chunk-U5XDKYZG.js → chunk-2KA4TGBQ.js} +3 -3
  49. package/dist/{chunk-6RH3VDF7.js → chunk-2NPD4S55.js} +4 -4
  50. package/dist/{chunk-M6GKMFTC.js → chunk-3ALBZK4M.js} +1 -1
  51. package/dist/{chunk-PXYDR7WQ.js → chunk-3BXCPHN6.js} +3 -2
  52. package/dist/{chunk-X4INVIWL.js → chunk-3C2T27YW.js} +3 -3
  53. package/dist/{chunk-QXLRABYH.js → chunk-3I6ZAMGN.js} +1 -1
  54. package/dist/{chunk-THMXGEZU.js → chunk-3SH24DGG.js} +2 -2
  55. package/dist/chunk-3TST3EWQ.js +438 -0
  56. package/dist/chunk-42R54Z2X.js +8 -0
  57. package/dist/{chunk-UDJ2I5A2.js → chunk-4IRQSBA7.js} +5 -6
  58. package/dist/chunk-5ALC4Z2H.js +23 -0
  59. package/dist/chunk-5BQO3YQP.js +62 -0
  60. package/dist/{chunk-QGGMG3OU.js → chunk-5BYYDBLS.js} +7 -7
  61. package/dist/{chunk-4LVP635F.js → chunk-5FBQOAXU.js} +135 -126
  62. package/dist/{chunk-2BCAQ4BB.js → chunk-5PAUN3PM.js} +3 -3
  63. package/dist/{chunk-E2HQPY32.js → chunk-5RMLLTR7.js} +5 -5
  64. package/dist/{chunk-3EF54XFY.js → chunk-634XVU3D.js} +1 -1
  65. package/dist/{chunk-LJO34DKJ.js → chunk-6FDPVW7Y.js} +35 -21
  66. package/dist/{chunk-3X3LUKDM.js → chunk-6Q3J6ZMM.js} +5 -5
  67. package/dist/chunk-7BFQKYCJ.js +127 -0
  68. package/dist/chunk-7EXKHL5L.js +30 -0
  69. package/dist/{chunk-M6N4ISXL.js → chunk-7MARNXFG.js} +1 -1
  70. package/dist/{chunk-WHSE47DM.js → chunk-AOLE7MBM.js} +1 -1
  71. package/dist/{chunk-YIZK67RW.js → chunk-BQHVM46E.js} +29 -49
  72. package/dist/chunk-CRYZK4NU.js +185 -0
  73. package/dist/{chunk-JYPPXAJG.js → chunk-CUAGC54B.js} +33 -35
  74. package/dist/{chunk-KIFSQOM2.js → chunk-D76WZZSB.js} +5 -5
  75. package/dist/{chunk-QLBIBLOY.js → chunk-DQ7LZZJX.js} +5 -5
  76. package/dist/{chunk-UCYSCKZV.js → chunk-DSTHXHJ5.js} +2114 -1699
  77. package/dist/{chunk-L7QKFC5N.js → chunk-E6W57UP3.js} +32 -122
  78. package/dist/{chunk-UFFVRF4V.js → chunk-EAAZV3B7.js} +6 -11
  79. package/dist/chunk-EDV4MTTT.js +434 -0
  80. package/dist/chunk-EEBJYXWA.js +15 -0
  81. package/dist/{chunk-UORPTGV2.js → chunk-EPRYM3FA.js} +11 -15
  82. package/dist/{chunk-YQYRAD5C.js → chunk-FCZJAYMM.js} +1 -1
  83. package/dist/{chunk-JMRWREVE.js → chunk-FDKFUIYV.js} +23 -36
  84. package/dist/chunk-FWPGOIFA.js +22 -0
  85. package/dist/{chunk-B234IELY.js → chunk-G6YNCIVF.js} +24 -41
  86. package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
  87. package/dist/chunk-GSH6ZGI6.js +353 -0
  88. package/dist/{chunk-IQWK723D.js → chunk-GZ4KTAWS.js} +1 -1
  89. package/dist/{chunk-MJCL3WID.js → chunk-H6LZ77GX.js} +1 -1
  90. package/dist/{chunk-WLT7K7K7.js → chunk-HDEOZN2Q.js} +21 -24
  91. package/dist/{chunk-FDR22JMM.js → chunk-HFRHHT36.js} +8 -63
  92. package/dist/{chunk-GNDFMMC6.js → chunk-IEVN722X.js} +1 -1
  93. package/dist/{chunk-DARJTN4I.js → chunk-IMJ62GAP.js} +10 -5
  94. package/dist/{chunk-SGR4DMCW.js → chunk-INYLPVCG.js} +3 -3
  95. package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
  96. package/dist/chunk-J6XCRFBW.js +30 -0
  97. package/dist/{chunk-BLRZB63H.js → chunk-JDNXS37G.js} +61 -62
  98. package/dist/{chunk-3B34B2M2.js → chunk-JJP6AKMV.js} +1 -1
  99. package/dist/{chunk-XEU5ZLSB.js → chunk-JK4M3ZKY.js} +5 -5
  100. package/dist/{chunk-VXMOPVRH.js → chunk-JR7AABT5.js} +2 -2
  101. package/dist/{chunk-PBD36EZJ.js → chunk-JTHDMXZV.js} +5 -5
  102. package/dist/{chunk-Q75AC3DZ.js → chunk-JY2XON7H.js} +2 -2
  103. package/dist/{chunk-6OUPJNYO.js → chunk-KCHYLLVG.js} +2 -2
  104. package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
  105. package/dist/{chunk-VPKMBJ5B.js → chunk-KG2NUK4J.js} +6 -6
  106. package/dist/{chunk-VXWN37PT.js → chunk-KIURBTC4.js} +1 -1
  107. package/dist/{chunk-7LVNAFEI.js → chunk-KTJLJTFO.js} +547 -882
  108. package/dist/{chunk-FCJ7MLQK.js → chunk-KZQFIPY2.js} +264 -76
  109. package/dist/chunk-L57USMYC.js +39 -0
  110. package/dist/{chunk-4KNL46BT.js → chunk-LWFBBTJ3.js} +5 -5
  111. package/dist/{chunk-RIN4CBRB.js → chunk-LXZXXOJ3.js} +1 -17
  112. package/dist/chunk-LYYM7H7H.js +59 -0
  113. package/dist/{chunk-MWQQVKRU.js → chunk-MAVQ636Y.js} +1 -1
  114. package/dist/{chunk-VDHW6H5F.js → chunk-MAW6ZT3D.js} +4 -4
  115. package/dist/{chunk-7CMRFP5Q.js → chunk-MJP5V3JN.js} +3 -3
  116. package/dist/{chunk-S7EKBD2C.js → chunk-MNHP6YRC.js} +3 -3
  117. package/dist/{chunk-QZJIDKQR.js → chunk-MT6WOKIW.js} +4 -4
  118. package/dist/chunk-MUGQQY6P.js +315 -0
  119. package/dist/{chunk-QT7YFHCA.js → chunk-MVEHWM7K.js} +13 -1
  120. package/dist/{chunk-VV6IKGCN.js → chunk-NTJ3BMOE.js} +1 -1
  121. package/dist/{chunk-JXQJQYGD.js → chunk-O7BGGWW6.js} +2 -2
  122. package/dist/{chunk-LWJF63JW.js → chunk-OYUJYPDF.js} +90 -15
  123. package/dist/{chunk-4S6XGIC6.js → chunk-PUAWN7SS.js} +1 -1
  124. package/dist/{chunk-U6PBLMXD.js → chunk-Q6SPIHFR.js} +8 -3
  125. package/dist/{chunk-F4OJN2F2.js → chunk-QIF4QE7T.js} +1 -1
  126. package/dist/{chunk-X22KTLZ7.js → chunk-QWJTJSIT.js} +1 -1
  127. package/dist/{chunk-2USXZSTK.js → chunk-QWW6RHZC.js} +5 -5
  128. package/dist/{chunk-TODJFRLH.js → chunk-RILHLBKW.js} +3 -3
  129. package/dist/{chunk-PP754CO7.js → chunk-RPU4UOQK.js} +1 -1
  130. package/dist/{chunk-AVOZ7TX2.js → chunk-RTMMO6IU.js} +6 -6
  131. package/dist/chunk-S7NGDLZ3.js +173 -0
  132. package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
  133. package/dist/chunk-SPFLYPY6.js +6 -0
  134. package/dist/{chunk-EIUYXS7E.js → chunk-TJKZ5QCJ.js} +4 -4
  135. package/dist/{chunk-WCSQDWMS.js → chunk-TPGIMZLI.js} +1 -1
  136. package/dist/chunk-UM7ZR3VU.js +14 -0
  137. package/dist/{chunk-PGW3VYK4.js → chunk-UNE4VD5U.js} +3 -3
  138. package/dist/chunk-UX5UYDCY.js +33 -0
  139. package/dist/{chunk-IXAQNTE7.js → chunk-V5K6HISS.js} +2 -2
  140. package/dist/chunk-VCUUITW6.js +35 -0
  141. package/dist/{chunk-T5MJWWDX.js → chunk-VD27SL7H.js} +5 -5
  142. package/dist/{chunk-LRARA622.js → chunk-VE6GRIIN.js} +2 -2
  143. package/dist/{chunk-SSUUT5LK.js → chunk-W3UHAQCV.js} +5 -4
  144. package/dist/{chunk-U5G3AVED.js → chunk-WBCWER26.js} +1 -1
  145. package/dist/{chunk-PXI47JL5.js → chunk-WCXFUBEF.js} +13 -13
  146. package/dist/{chunk-AVOIZO63.js → chunk-WFE6CT6M.js} +77 -21
  147. package/dist/{chunk-E2L5EX5A.js → chunk-WFHGJGCW.js} +7 -6
  148. package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
  149. package/dist/{chunk-6YA3C4NB.js → chunk-XBKWFLJG.js} +4 -13
  150. package/dist/chunk-XQUF3WIS.js +159 -0
  151. package/dist/{chunk-SS46VQJA.js → chunk-Y4PM3IDZ.js} +1 -1
  152. package/dist/chunk-YBF45CX5.js +23 -0
  153. package/dist/{chunk-JQV7CXEC.js → chunk-YNGA3GRX.js} +17 -2
  154. package/dist/chunk-ZHFFTT3I.js +17 -0
  155. package/dist/{chunk-BOZJOOGW.js → chunk-ZLHCZ5F2.js} +1 -1
  156. package/dist/{chunk-LHKHQAAY.js → chunk-ZLYGEART.js} +1 -1
  157. package/dist/{chunk-NBPMNUKZ.js → chunk-ZQCCVCHB.js} +1 -1
  158. package/dist/{chunk-ADGVQVHP.js → chunk-ZTOYVPGA.js} +3 -3
  159. package/dist/collections-XIHCTMSJ.js +70 -0
  160. package/dist/{configuration-C4IGBNXH.js → configuration-3GCBMM27.js} +3 -3
  161. package/dist/{configuration-JI22M76Z.js → configuration-FWZTMYXY.js} +5 -5
  162. package/dist/{create-OXR7WG5F.js → create-2RGNAVVY.js} +32 -32
  163. package/dist/{create-5QLYFVEK.js → create-32MXB6FD.js} +24 -24
  164. package/dist/create-3AMFYYI6.js +245 -0
  165. package/dist/create-AMNH3WXL.js +75 -0
  166. package/dist/{create-UPYB65PD.js → create-BV3QDTK2.js} +4 -4
  167. package/dist/{create-POK6SJSZ.js → create-FHIFVCSG.js} +52 -49
  168. package/dist/{create-EATFT5AB.js → create-GO7APBBU.js} +31 -31
  169. package/dist/create-HEZYB7RF.js +1179 -0
  170. package/dist/{create-R7K3ECN6.js → create-K26SM34L.js} +3 -3
  171. package/dist/{create-6I43IPLO.js → create-N534JQPH.js} +14 -14
  172. package/dist/create-NEK6JCKR.js +1798 -0
  173. package/dist/{create-YBF4YGWG.js → create-NF2LPVXA.js} +3 -3
  174. package/dist/{create-F7IDSSTP.js → create-PJVLJ7T6.js} +50 -45
  175. package/dist/{create-CK4X357V.js → create-RPBHXU32.js} +28 -28
  176. package/dist/{create-SFU3W3ZH.js → create-U64NEOEL.js} +3 -3
  177. package/dist/create-VL7LDTVE.js +1931 -0
  178. package/dist/{create-XVHOCZHJ.js → create-X5SOAPD3.js} +3 -3
  179. package/dist/{create-2XZLOG5Z.js → create-XLYGW5PN.js} +69 -41
  180. package/dist/{create-GB3ZA4LH.js → create-YKYLCEAK.js} +6 -6
  181. package/dist/customer-group-add-customers-2C53NFBJ.js +251 -0
  182. package/dist/customer-group-create-75QQEQZF.js +147 -0
  183. package/dist/customer-group-detail-AOQYYAOG.js +58 -0
  184. package/dist/customer-group-edit-N77RCW6I.js +138 -0
  185. package/dist/customer-groups-GNFV7VMT.js +284 -0
  186. package/dist/{customers-SOLJ2KQQ.js → customers-HNINO6YL.js} +11 -11
  187. package/dist/{edit-TZ4EXLKJ.js → edit-3DUCWSLA.js} +62 -46
  188. package/dist/{edit-ORXS3A2Y.js → edit-3V34KJS2.js} +3 -3
  189. package/dist/{edit-RJ3EZ5CD.js → edit-4PWAJ7A3.js} +25 -25
  190. package/dist/{edit-ZQP4MNJU.js → edit-7CLOJ3UZ.js} +50 -47
  191. package/dist/{edit-ZAHCMF5U.js → edit-7SBPHN6P.js} +3 -3
  192. package/dist/edit-BSD6667Q.js +367 -0
  193. package/dist/{edit-Q3UQIOLS.js → edit-I2RJUPWV.js} +4 -4
  194. package/dist/{edit-UUP3BQV3.js → edit-IJ6DCBUU.js} +5 -5
  195. package/dist/{edit-ZMERG3L7.js → edit-JB7KVBOL.js} +5 -5
  196. package/dist/{edit-O4JLGKQR.js → edit-NHQJLCAK.js} +4 -4
  197. package/dist/edit-O65JD54W.js +103 -0
  198. package/dist/{edit-4OEBCCXJ.js → edit-SIKOSSHF.js} +24 -24
  199. package/dist/edit-TD7QFM4Z.js +871 -0
  200. package/dist/{edit-C4OCKQVU.js → edit-UNN3QTEJ.js} +3 -3
  201. package/dist/{edit-PFAJZUWI.js → edit-WEUFBORT.js} +33 -34
  202. package/dist/{edit-KAKVPHZZ.js → edit-WN2Q3TOX.js} +4 -4
  203. package/dist/{edit-QPPMI7MU.js → edit-ZGAOUZYP.js} +33 -34
  204. package/dist/{edit-522DG3BY.js → edit-ZOLSAIKF.js} +3 -3
  205. package/dist/{edit-2LGAEKH6.js → edit-ZORE6RUD.js} +25 -25
  206. package/dist/{edit-budget-L3CCEWNF.js → edit-budget-D22WMVYR.js} +3 -3
  207. package/dist/{edit-inventory-item-A7KAPATR.js → edit-inventory-item-QMYWEBZ3.js} +3 -3
  208. package/dist/{edit-inventory-item-attributes-RNBOJR66.js → edit-inventory-item-attributes-HLG6JR6S.js} +3 -3
  209. package/dist/edit-price-F7ZWM3FN.js +197 -0
  210. package/dist/edit-stock-ITAZNHPU.js +230 -0
  211. package/dist/fulfillment-U2GRQ6DD.js +641 -0
  212. package/dist/{fulfillment-providers-6WDXCGAI.js → fulfillment-providers-CMU2JB5X.js} +40 -40
  213. package/dist/index.css +120 -24
  214. package/dist/index.js +355 -235
  215. package/dist/{offer-inventory-batch-page-4QNXDUWN.js → inventory-4JKLAZ2Q.js} +20 -20
  216. package/dist/{inventory-IOVM7GDU.js → inventory-FKEXULLT.js} +10 -10
  217. package/dist/{invite-HRKSQI4B.js → invite-3R2CEWLN.js} +23 -23
  218. package/dist/{invite-UBH7PYSH.js → invite-MNAX6EUC.js} +39 -39
  219. package/dist/loader-HTPUNIOS.js +34 -0
  220. package/dist/loader-MAAMUP2Z.js +33 -0
  221. package/dist/{locations-INS6FTMJ.js → locations-2VWSMWHL.js} +3 -3
  222. package/dist/login-YUWOWICV.js +39 -0
  223. package/dist/{manage-locations-TIYOCOZU.js → manage-locations-RWGDXXJQ.js} +3 -3
  224. package/dist/{media-EXWUWWNB.js → media-P6WSFHY4.js} +31 -30
  225. package/dist/media-YB4G5CMV.js +316 -0
  226. package/dist/{metadata-JIMHXPKE.js → metadata-5Q6FLVX4.js} +27 -27
  227. package/dist/{metadata-T6MLCEZ2.js → metadata-6OYHLPLA.js} +25 -25
  228. package/dist/{metadata-JCNPERR3.js → metadata-ADXGD4Y6.js} +25 -25
  229. package/dist/{metadata-ITS3VPE3.js → metadata-J447GEBP.js} +27 -27
  230. package/dist/{metadata-YOQEXEGO.js → metadata-VTQ2CGZX.js} +27 -27
  231. package/dist/{offer-create-page-6YTTQAXZ.js → offer-create-page-ACPKTNHA.js} +245 -266
  232. package/dist/offer-detail-page-S4R4N5GL.js +584 -0
  233. package/dist/offer-variant-detail-page-XUMDXZUD.js +402 -0
  234. package/dist/offers-OTZJBW43.js +54 -0
  235. package/dist/{onboarding-GCRT6P6M.js → onboarding-TUGXFOA6.js} +23 -23
  236. package/dist/orders-PJSJNGZS.js +63 -0
  237. package/dist/{organization-5AFVFFZQ.js → organization-YIOAVFHN.js} +26 -26
  238. package/dist/{organize-QXDKGP2X.js → organize-BTA7NJD2.js} +4 -4
  239. package/dist/{organize-AZYAANZM.js → organize-OWT5QSJR.js} +4 -4
  240. package/dist/pages/index.d.ts +232 -232
  241. package/dist/pages/index.js +89 -87
  242. package/dist/{payment-details-ENUWDVGI.js → payment-details-K2XFATEL.js} +24 -24
  243. package/dist/{payouts-2QBQSNDR.js → payouts-K5IDTJV3.js} +11 -11
  244. package/dist/{price-lists-2WBNENE7.js → price-lists-DNPIPDAW.js} +13 -13
  245. package/dist/{offer-pricing-edit-page-WZNP3TWV.js → pricing-5VUPPNKS.js} +21 -19
  246. package/dist/{pricing-4Y73YJHP.js → pricing-J5FIDZIY.js} +32 -32
  247. package/dist/{product-tags-DE32PERU.js → product-tags-SJYIGXEV.js} +47 -44
  248. package/dist/{product-types-PKUEL7X5.js → product-types-4PTJW5DE.js} +10 -10
  249. package/dist/product-variant-detail-FO6J3RFA.js +371 -0
  250. package/dist/{product-variant-edit-ESLPI5ES.js → product-variant-edit-55TAIBZO.js} +45 -27
  251. package/dist/{products-WLGCX6Z7.js → products-EQMANSO6.js} +41 -40
  252. package/dist/products-XM57LXJK.js +92 -0
  253. package/dist/{professional-details-OCVQO2MV.js → professional-details-WWZPTXSX.js} +24 -24
  254. package/dist/{profile-2HW5NX6K.js → profile-5IADQ727.js} +30 -30
  255. package/dist/{promotions-FPV6QOEQ.js → promotions-BYW6TZ5B.js} +12 -12
  256. package/dist/receive-MTXKKPKZ.js +578 -0
  257. package/dist/refund-3IXGYA7W.js +268 -0
  258. package/dist/{register-PZOHGO7N.js → register-U5PQZATC.js} +25 -25
  259. package/dist/{reset-password-Q7BNWHHO.js → reset-password-SKUJJLSV.js} +3 -3
  260. package/dist/{return-reasons-J2WFZOQH.js → return-reasons-QDPSIJG3.js} +22 -19
  261. package/dist/{sales-channels-I3PR34U5.js → sales-channels-GBSTCWVP.js} +12 -13
  262. package/dist/{sales-channels-HPG2ND4W.js → sales-channels-N4NE3FXP.js} +14 -15
  263. package/dist/{settings-RZNYWACF.js → settings-ZUBBFS67.js} +54 -51
  264. package/dist/shipment-TKSCPC3M.js +241 -0
  265. package/dist/shipping-DODEUYOQ.js +125 -0
  266. package/dist/{shipping-profile-M3GGADFI.js → shipping-profile-O4JMJLN7.js} +5 -9
  267. package/dist/shipping-profiles-4TJ4IH6U.js +46 -0
  268. package/dist/{stock-3HVQ6FYP.js → stock-GYK2GHJN.js} +27 -27
  269. package/dist/{store-LDVMG7CV.js → store-XWOALZ5Q.js} +36 -36
  270. package/dist/{store-closure-EZ2YPOPL.js → store-closure-46B3XZ2I.js} +24 -24
  271. package/dist/{store-select-AM4AE7AL.js → store-select-E77E3ZY7.js} +24 -24
  272. package/dist/{tax-regions-HDLBFZVG.js → tax-regions-S2LFRTMP.js} +9 -9
  273. package/dist/{team-6NTDISM4.js → team-N2C5JPSU.js} +37 -37
  274. package/package.json +12 -12
  275. package/dist/[id]-MOOCGOWO.js +0 -480
  276. package/dist/[id]-UVQXCYXD.js +0 -1219
  277. package/dist/[id]-VUX4FUOO.js +0 -1557
  278. package/dist/allocate-items-OK5PVJGR.js +0 -533
  279. package/dist/attributes-TRAUBTCO.js +0 -278
  280. package/dist/breadcrumb-6FV7PWEN.js +0 -33
  281. package/dist/breadcrumb-EX4C3AZY.js +0 -47
  282. package/dist/breadcrumb-Q3XSG7B2.js +0 -46
  283. package/dist/chunk-27KRIXMQ.js +0 -71
  284. package/dist/chunk-432S4FGR.js +0 -0
  285. package/dist/chunk-BDZOSMAX.js +0 -23
  286. package/dist/chunk-CFRWIQIZ.js +0 -43
  287. package/dist/chunk-G7BL4L3L.js +0 -66
  288. package/dist/chunk-RXV7INUV.js +0 -426
  289. package/dist/chunk-T6LHVNWO.js +0 -27
  290. package/dist/collections-DS63FT2E.js +0 -68
  291. package/dist/create-HR4I33SE.js +0 -73
  292. package/dist/create-UFHLPXET.js +0 -215
  293. package/dist/edit-GQNIINRR.js +0 -192
  294. package/dist/fulfillment-OIIPL7B7.js +0 -559
  295. package/dist/loader-VDYPD3RI.js +0 -31
  296. package/dist/login-HON44E3S.js +0 -39
  297. package/dist/metadata-5BPOBBU2.js +0 -45
  298. package/dist/offer-detail-page-OMZN2NTA.js +0 -492
  299. package/dist/offer-edit-page-3MO566RP.js +0 -151
  300. package/dist/offers-GVN5LCK6.js +0 -32
  301. package/dist/orders-CHSS4ASB.js +0 -63
  302. package/dist/product-variant-detail-MWUBPCOP.js +0 -209
  303. package/dist/products-XOHAQHUJ.js +0 -91
  304. package/dist/shipment-KWUXQZWK.js +0 -176
  305. package/dist/shipping-profiles-L27STQ7K.js +0 -46
@@ -0,0 +1,1179 @@
1
+ import {
2
+ getOfferRestockPreview
3
+ } from "./chunk-J6XCRFBW.js";
4
+ import {
5
+ ReturnShippingPlaceholder
6
+ } from "./chunk-YBF45CX5.js";
7
+ import {
8
+ useReturnReasons
9
+ } from "./chunk-ZLYGEART.js";
10
+ import {
11
+ RETURN_POLICY_DAYS
12
+ } from "./chunk-VCUUITW6.js";
13
+ import {
14
+ useAddReturnItem,
15
+ useAddReturnShipping,
16
+ useCancelReturnRequest,
17
+ useConfirmReturnRequest,
18
+ useDeleteReturnShipping,
19
+ useInitiateReturn,
20
+ useRemoveReturnItem,
21
+ useUpdateReturn,
22
+ useUpdateReturnItem,
23
+ useUpdateReturnShipping
24
+ } from "./chunk-3TST3EWQ.js";
25
+ import {
26
+ MoneyAmountCell
27
+ } from "./chunk-L57USMYC.js";
28
+ import {
29
+ getStylizedAmount
30
+ } from "./chunk-3BXCPHN6.js";
31
+ import {
32
+ PlaceholderCell
33
+ } from "./chunk-PHOCVOZ5.js";
34
+ import {
35
+ currencies
36
+ } from "./chunk-IQPN4PZJ.js";
37
+ import {
38
+ Combobox
39
+ } from "./chunk-VBRTC2VU.js";
40
+ import "./chunk-TKGWSUEI.js";
41
+ import {
42
+ KeyboundForm
43
+ } from "./chunk-SITRHMZZ.js";
44
+ import {
45
+ RouteFocusModal,
46
+ StackedFocusModal,
47
+ useRouteModal,
48
+ useStackedModal
49
+ } from "./chunk-GDWBOQI5.js";
50
+ import {
51
+ Form
52
+ } from "./chunk-3QSRE5LS.js";
53
+ import "./chunk-FQERBIVS.js";
54
+ import {
55
+ _DataTable,
56
+ useDataTable
57
+ } from "./chunk-W3UHAQCV.js";
58
+ import "./chunk-YN3FGNJM.js";
59
+ import "./chunk-KCHYLLVG.js";
60
+ import "./chunk-634XVU3D.js";
61
+ import "./chunk-LRD242C7.js";
62
+ import {
63
+ Thumbnail
64
+ } from "./chunk-WIYFXWRI.js";
65
+ import "./chunk-INNFZYX2.js";
66
+ import {
67
+ ActionMenu
68
+ } from "./chunk-BDGZ4EQO.js";
69
+ import "./chunk-LAVHRER2.js";
70
+ import "./chunk-QHQWEERJ.js";
71
+ import "./chunk-Y7QKP6QU.js";
72
+ import {
73
+ useShippingOptions
74
+ } from "./chunk-JR7AABT5.js";
75
+ import {
76
+ useStockLocations
77
+ } from "./chunk-ZQCCVCHB.js";
78
+ import {
79
+ useOrder,
80
+ useOrderPreview
81
+ } from "./chunk-6FDPVW7Y.js";
82
+ import "./chunk-G6YNCIVF.js";
83
+ import "./chunk-A5DJIOHN.js";
84
+ import "./chunk-RHKRREUU.js";
85
+ import "./chunk-ZA2KFUFR.js";
86
+ import "./chunk-LXZXXOJ3.js";
87
+ import "./chunk-NBMM2TZK.js";
88
+
89
+ // src/pages/orders/[id]/returns/create/index.tsx
90
+ import { useEffect as useEffect2, useRef, useState as useState3 } from "react";
91
+ import { useNavigate, useParams } from "react-router-dom";
92
+ import { toast as toast2 } from "@medusajs/ui";
93
+ import { useTranslation as useTranslation5 } from "react-i18next";
94
+
95
+ // src/pages/orders/[id]/returns/create/_components/return-create-form/return-create-form.tsx
96
+ import { zodResolver } from "@hookform/resolvers/zod";
97
+ import { PencilSquare } from "@medusajs/icons";
98
+ import {
99
+ Button,
100
+ CurrencyInput,
101
+ Heading,
102
+ IconButton as IconButton2,
103
+ Switch,
104
+ Text as Text3,
105
+ toast,
106
+ usePrompt
107
+ } from "@medusajs/ui";
108
+ import { useEffect, useMemo as useMemo3, useState as useState2 } from "react";
109
+ import { useFieldArray, useForm } from "react-hook-form";
110
+ import { useTranslation as useTranslation4 } from "react-i18next";
111
+
112
+ // src/pages/orders/[id]/returns/create/_components/add-return-items-table/add-return-items-table.tsx
113
+ import { useMemo as useMemo2, useState } from "react";
114
+ import { useTranslation as useTranslation2 } from "react-i18next";
115
+
116
+ // src/pages/orders/[id]/returns/create/_components/add-return-items-table/use-return-item-table-columns.tsx
117
+ import { Checkbox, Text } from "@medusajs/ui";
118
+ import { createColumnHelper } from "@tanstack/react-table";
119
+ import { useMemo } from "react";
120
+ import { useTranslation } from "react-i18next";
121
+ import { jsx, jsxs } from "react/jsx-runtime";
122
+ var columnHelper = createColumnHelper();
123
+ var useReturnItemTableColumns = () => {
124
+ const { t } = useTranslation();
125
+ return useMemo(
126
+ () => [
127
+ columnHelper.display({
128
+ id: "select",
129
+ header: ({ table }) => /* @__PURE__ */ jsx(
130
+ Checkbox,
131
+ {
132
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
133
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
134
+ }
135
+ ),
136
+ cell: ({ row }) => {
137
+ const isSelectable = row.getCanSelect();
138
+ return /* @__PURE__ */ jsx(
139
+ Checkbox,
140
+ {
141
+ disabled: !isSelectable,
142
+ checked: row.getIsSelected(),
143
+ onCheckedChange: (value) => row.toggleSelected(!!value),
144
+ onClick: (e) => {
145
+ e.stopPropagation();
146
+ }
147
+ }
148
+ );
149
+ }
150
+ }),
151
+ columnHelper.display({
152
+ id: "product",
153
+ header: t("fields.product"),
154
+ cell: ({ row }) => {
155
+ const title = row.original.product_title ?? row.original.title;
156
+ if (!title) {
157
+ return /* @__PURE__ */ jsx(PlaceholderCell, {});
158
+ }
159
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[300px] items-center gap-x-3 overflow-hidden", children: [
160
+ /* @__PURE__ */ jsx(Thumbnail, { src: row.original.thumbnail }),
161
+ /* @__PURE__ */ jsx(
162
+ Text,
163
+ {
164
+ size: "small",
165
+ leading: "compact",
166
+ className: "truncate",
167
+ title,
168
+ children: title
169
+ }
170
+ )
171
+ ] });
172
+ }
173
+ }),
174
+ columnHelper.accessor("variant_sku", {
175
+ header: t("fields.sku"),
176
+ cell: ({ getValue }) => {
177
+ const sku = getValue();
178
+ if (!sku) return /* @__PURE__ */ jsx(PlaceholderCell, {});
179
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: sku });
180
+ }
181
+ }),
182
+ columnHelper.display({
183
+ id: "variant_title",
184
+ header: t("fields.title"),
185
+ cell: ({ row }) => {
186
+ const title = row.original.variant_title;
187
+ if (!title) return /* @__PURE__ */ jsx(PlaceholderCell, {});
188
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "truncate", children: title });
189
+ }
190
+ }),
191
+ columnHelper.accessor("remainingQuantity", {
192
+ header: t("orders.returns.remainingQuantity", {
193
+ defaultValue: "Remaining"
194
+ }),
195
+ cell: ({ getValue }) => /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "tabular-nums", children: getValue() })
196
+ })
197
+ ],
198
+ [t]
199
+ );
200
+ };
201
+
202
+ // src/pages/orders/[id]/returns/create/_components/add-return-items-table/add-return-items-table.tsx
203
+ import { jsx as jsx2 } from "react/jsx-runtime";
204
+ var PAGE_SIZE = 50;
205
+ var getRemainingQuantity = (item) => {
206
+ const detail = item.detail ?? {};
207
+ const fulfilled = detail.fulfilled_quantity ?? 0;
208
+ const requested = detail.return_requested_quantity ?? 0;
209
+ const returned = detail.returned_quantity ?? 0;
210
+ return fulfilled - requested - returned;
211
+ };
212
+ var AddReturnItemsTable = ({
213
+ order,
214
+ onSelectionChange,
215
+ selectedItems = []
216
+ }) => {
217
+ const { t } = useTranslation2();
218
+ const [rowSelection, setRowSelection] = useState(
219
+ selectedItems.reduce((acc, id) => {
220
+ acc[id] = true;
221
+ return acc;
222
+ }, {})
223
+ );
224
+ const updater = (fn) => {
225
+ const newState = typeof fn === "function" ? fn(rowSelection) : fn;
226
+ setRowSelection(newState);
227
+ onSelectionChange(Object.keys(newState));
228
+ };
229
+ const rows = useMemo2(() => {
230
+ return (order.items ?? []).map((item) => {
231
+ const remainingQuantity = getRemainingQuantity(item);
232
+ if (remainingQuantity <= 0) {
233
+ return null;
234
+ }
235
+ return {
236
+ id: item.id,
237
+ title: item.title,
238
+ product_title: item.product_title,
239
+ variant_sku: item.variant_sku,
240
+ variant_title: item.variant_title,
241
+ thumbnail: item.thumbnail,
242
+ remainingQuantity
243
+ };
244
+ }).filter((r) => r !== null);
245
+ }, [order.items]);
246
+ const count = rows.length;
247
+ const columns = useReturnItemTableColumns();
248
+ const { table } = useDataTable({
249
+ data: rows,
250
+ columns,
251
+ count,
252
+ enablePagination: true,
253
+ // Row id = order line item id; `onSelectionChange` yields the ids the
254
+ // vendor add-return-items route accepts.
255
+ getRowId: (row) => row.id,
256
+ pageSize: PAGE_SIZE,
257
+ enableRowSelection: () => true,
258
+ rowSelection: {
259
+ state: rowSelection,
260
+ updater
261
+ }
262
+ });
263
+ return /* @__PURE__ */ jsx2(
264
+ "div",
265
+ {
266
+ className: "flex size-full flex-col overflow-hidden",
267
+ "data-testid": "add-return-items-picker",
268
+ children: /* @__PURE__ */ jsx2(
269
+ _DataTable,
270
+ {
271
+ table,
272
+ columns,
273
+ pageSize: PAGE_SIZE,
274
+ count,
275
+ pagination: true,
276
+ layout: "fill",
277
+ search: false,
278
+ orderBy: [
279
+ { key: "product_title", label: t("fields.product") },
280
+ { key: "variant_title", label: t("fields.title") }
281
+ ]
282
+ }
283
+ )
284
+ }
285
+ );
286
+ };
287
+
288
+ // src/pages/orders/[id]/returns/create/_components/return-create-form/return-item.tsx
289
+ import { ChatBubble, DocumentText, XCircle, XMark } from "@medusajs/icons";
290
+ import { IconButton, Input, Text as Text2 } from "@medusajs/ui";
291
+ import { useTranslation as useTranslation3 } from "react-i18next";
292
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
293
+ function ReturnItem({
294
+ item,
295
+ previewItem,
296
+ currencyCode,
297
+ form,
298
+ onRemove,
299
+ onUpdate,
300
+ index,
301
+ locationId,
302
+ locationName
303
+ }) {
304
+ const { t } = useTranslation3();
305
+ const { return_reasons: returnReasons = [] } = useReturnReasons({
306
+ fields: "+label"
307
+ });
308
+ const formItem = form.watch(`items.${index}`);
309
+ const showReturnReason = typeof formItem?.reason_id === "string";
310
+ const showNote = typeof formItem?.note === "string";
311
+ const restockRows = locationId ? getOfferRestockPreview(
312
+ item,
313
+ formItem?.quantity ?? 0
314
+ ) : [];
315
+ const offerSku = item.offer?.sku ?? item.variant_sku ?? null;
316
+ return /* @__PURE__ */ jsxs2(
317
+ "div",
318
+ {
319
+ className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl",
320
+ "data-testid": `return-item-${item.id}`,
321
+ children: [
322
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-x-2 gap-y-2 border-b p-3 text-sm md:flex-row", children: [
323
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 items-center gap-x-3", children: [
324
+ /* @__PURE__ */ jsx3(Thumbnail, { src: item.thumbnail }),
325
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
326
+ /* @__PURE__ */ jsxs2("div", { children: [
327
+ /* @__PURE__ */ jsxs2(Text2, { className: "txt-small", as: "span", weight: "plus", children: [
328
+ item.title,
329
+ " "
330
+ ] }),
331
+ item.variant_sku && /* @__PURE__ */ jsxs2("span", { children: [
332
+ "(",
333
+ item.variant_sku,
334
+ ")"
335
+ ] })
336
+ ] }),
337
+ /* @__PURE__ */ jsx3(Text2, { as: "div", className: "text-ui-fg-subtle txt-small", children: item.product_title })
338
+ ] })
339
+ ] }),
340
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 justify-between", children: [
341
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-grow items-center gap-2", children: [
342
+ /* @__PURE__ */ jsx3(
343
+ Form.Field,
344
+ {
345
+ control: form.control,
346
+ name: `items.${index}.quantity`,
347
+ render: ({ field }) => {
348
+ return /* @__PURE__ */ jsxs2(Form.Item, { children: [
349
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
350
+ Input,
351
+ {
352
+ className: "bg-ui-bg-base txt-small w-[67px] rounded-lg",
353
+ min: 1,
354
+ max: item.quantity,
355
+ type: "number",
356
+ "data-testid": `return-item-${item.id}-qty`,
357
+ ...field,
358
+ onChange: (e) => {
359
+ const val = e.target.value;
360
+ const payload = val === "" ? null : Number(val);
361
+ field.onChange(payload);
362
+ if (payload) {
363
+ onUpdate({ quantity: payload });
364
+ }
365
+ }
366
+ }
367
+ ) }),
368
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
369
+ ] });
370
+ }
371
+ }
372
+ ),
373
+ /* @__PURE__ */ jsx3(Text2, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") })
374
+ ] }),
375
+ /* @__PURE__ */ jsx3("div", { className: "text-ui-fg-subtle txt-small mr-2 flex flex-shrink-0", children: /* @__PURE__ */ jsx3(
376
+ MoneyAmountCell,
377
+ {
378
+ currencyCode,
379
+ amount: previewItem.return_requested_total
380
+ }
381
+ ) }),
382
+ /* @__PURE__ */ jsx3(
383
+ ActionMenu,
384
+ {
385
+ groups: [
386
+ {
387
+ actions: [
388
+ !showReturnReason && {
389
+ label: t("actions.addReason"),
390
+ onClick: () => form.setValue(`items.${index}.reason_id`, ""),
391
+ icon: /* @__PURE__ */ jsx3(ChatBubble, {})
392
+ },
393
+ !showNote && {
394
+ label: t("actions.addNote"),
395
+ onClick: () => form.setValue(`items.${index}.note`, ""),
396
+ icon: /* @__PURE__ */ jsx3(DocumentText, {})
397
+ },
398
+ {
399
+ label: t("actions.remove"),
400
+ onClick: onRemove,
401
+ icon: /* @__PURE__ */ jsx3(XCircle, {})
402
+ }
403
+ ].filter(Boolean)
404
+ }
405
+ ]
406
+ }
407
+ )
408
+ ] })
409
+ ] }),
410
+ restockRows.length > 0 && /* @__PURE__ */ jsx3("div", { className: "bg-ui-bg-subtle flex flex-col gap-y-1 rounded-md px-3 py-2", children: restockRows.map((row) => /* @__PURE__ */ jsx3(
411
+ Text2,
412
+ {
413
+ size: "xsmall",
414
+ className: "text-ui-fg-subtle",
415
+ "data-testid": `return-item-${item.id}-restock-${row.inventoryItemId}`,
416
+ children: t("orders.returns.restockPreview", {
417
+ quantity: formItem?.quantity ?? 0,
418
+ offerSku: offerSku ?? "\u2014",
419
+ delta: row.delta,
420
+ inventoryItem: row.inventoryItemLabel,
421
+ location: locationName ?? "\u2014"
422
+ })
423
+ },
424
+ row.inventoryItemId
425
+ )) }),
426
+ /* @__PURE__ */ jsxs2(Fragment, { children: [
427
+ showReturnReason && /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
428
+ /* @__PURE__ */ jsxs2("div", { children: [
429
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.reason") }),
430
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.reasonHint") })
431
+ ] }),
432
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1", children: [
433
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
434
+ Form.Field,
435
+ {
436
+ control: form.control,
437
+ name: `items.${index}.reason_id`,
438
+ render: ({ field: { ref, value, onChange, ...field } }) => {
439
+ void ref;
440
+ return /* @__PURE__ */ jsxs2(Form.Item, { children: [
441
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
442
+ Combobox,
443
+ {
444
+ value: value ?? void 0,
445
+ onChange: (v) => {
446
+ onUpdate({ reason_id: v });
447
+ onChange(v);
448
+ },
449
+ ...field,
450
+ options: returnReasons.map(
451
+ (reason) => ({
452
+ label: reason.label ?? reason.value ?? reason.id,
453
+ value: reason.id
454
+ })
455
+ ),
456
+ "data-testid": `return-item-${item.id}-reason`
457
+ }
458
+ ) }),
459
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
460
+ ] });
461
+ }
462
+ }
463
+ ) }),
464
+ /* @__PURE__ */ jsx3(
465
+ IconButton,
466
+ {
467
+ type: "button",
468
+ className: "flex-shrink",
469
+ variant: "transparent",
470
+ onClick: () => {
471
+ onUpdate({ reason_id: null });
472
+ form.setValue(`items.${index}.reason_id`, null);
473
+ },
474
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
475
+ }
476
+ )
477
+ ] })
478
+ ] }),
479
+ showNote && /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
480
+ /* @__PURE__ */ jsxs2("div", { children: [
481
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.note") }),
482
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.noteHint") })
483
+ ] }),
484
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1", children: [
485
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
486
+ Form.Field,
487
+ {
488
+ control: form.control,
489
+ name: `items.${index}.note`,
490
+ render: ({ field: { ref, value, onChange, ...field } }) => {
491
+ void ref;
492
+ return /* @__PURE__ */ jsxs2(Form.Item, { children: [
493
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
494
+ Input,
495
+ {
496
+ value: value ?? "",
497
+ onChange,
498
+ ...field,
499
+ onBlur: () => onUpdate({ internal_note: value ?? null }),
500
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
501
+ "data-testid": `return-item-${item.id}-note`
502
+ }
503
+ ) }),
504
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
505
+ ] });
506
+ }
507
+ }
508
+ ) }),
509
+ /* @__PURE__ */ jsx3(
510
+ IconButton,
511
+ {
512
+ type: "button",
513
+ className: "flex-shrink",
514
+ variant: "transparent",
515
+ onClick: () => {
516
+ form.setValue(`items.${index}.note`, null);
517
+ onUpdate({ internal_note: null });
518
+ },
519
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
520
+ }
521
+ )
522
+ ] })
523
+ ] })
524
+ ] })
525
+ ]
526
+ }
527
+ );
528
+ }
529
+
530
+ // src/pages/orders/[id]/returns/create/_components/return-create-form/schema.ts
531
+ import { z } from "zod";
532
+ var ReturnCreateSchema = z.object({
533
+ items: z.array(
534
+ z.object({
535
+ item_id: z.string(),
536
+ quantity: z.number(),
537
+ reason_id: z.string().optional().nullable(),
538
+ note: z.string().optional().nullable()
539
+ })
540
+ ),
541
+ location_id: z.string().optional(),
542
+ option_id: z.string(),
543
+ send_notification: z.boolean().optional(),
544
+ // TODO: receive flow happens on a separate route — left here for parity
545
+ // with the admin schema and possible future inline-receive support.
546
+ receive_now: z.boolean().optional()
547
+ });
548
+
549
+ // src/pages/orders/[id]/returns/create/_components/return-create-form/return-create-form.tsx
550
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
551
+ var selectedLineItemIds = [];
552
+ var ReturnCreateForm = ({
553
+ order,
554
+ preview,
555
+ activeReturn
556
+ }) => {
557
+ const { t } = useTranslation4();
558
+ const { handleSuccess } = useRouteModal();
559
+ const itemsMap = useMemo3(
560
+ () => new Map((order.items || []).map((i) => [i.id, i])),
561
+ [order.items]
562
+ );
563
+ const previewItems = useMemo3(
564
+ () => preview.items.filter(
565
+ (i) => !!i.actions?.find(
566
+ (a) => a.return_id === activeReturn.id
567
+ )
568
+ ),
569
+ // eslint-disable-next-line react-hooks/exhaustive-deps
570
+ [preview.items, activeReturn.id]
571
+ );
572
+ const previewItemsMap = useMemo3(
573
+ () => new Map(previewItems.map((i) => [i.id, i])),
574
+ [previewItems]
575
+ );
576
+ const { setIsOpen } = useStackedModal();
577
+ const [isShippingPriceEdit, setIsShippingPriceEdit] = useState2(false);
578
+ const [customShippingAmount, setCustomShippingAmount] = useState2({
579
+ value: "0",
580
+ float: 0
581
+ });
582
+ const { stock_locations: stockLocations = [] } = useStockLocations({
583
+ limit: 999
584
+ });
585
+ const { shipping_options: shippingOptions = [] } = useShippingOptions({
586
+ limit: 999,
587
+ fields: "*prices,+service_zone.fulfillment_set.location.id"
588
+ });
589
+ const { mutateAsync: confirmReturnRequest, isPending: isConfirming } = useConfirmReturnRequest(activeReturn.id, order.id);
590
+ const { mutateAsync: cancelReturnRequest, isPending: isCanceling } = useCancelReturnRequest(activeReturn.id, order.id);
591
+ const { mutateAsync: updateReturnRequest, isPending: isUpdating } = useUpdateReturn(activeReturn.id, order.id);
592
+ const { mutateAsync: addReturnShipping, isPending: isAddingReturnShipping } = useAddReturnShipping(activeReturn.id, order.id);
593
+ const {
594
+ mutateAsync: updateReturnShipping,
595
+ isPending: isUpdatingReturnShipping
596
+ } = useUpdateReturnShipping(activeReturn.id, order.id);
597
+ const {
598
+ mutateAsync: deleteReturnShipping,
599
+ isPending: isDeletingReturnShipping
600
+ } = useDeleteReturnShipping(activeReturn.id, order.id);
601
+ const { mutateAsync: addReturnItem, isPending: isAddingReturnItem } = useAddReturnItem(activeReturn.id, order.id);
602
+ const { mutateAsync: removeReturnItem, isPending: isRemovingReturnItem } = useRemoveReturnItem(activeReturn.id, order.id);
603
+ const { mutateAsync: updateReturnItem, isPending: isUpdatingReturnItem } = useUpdateReturnItem(activeReturn.id, order.id);
604
+ const isRequestLoading = isConfirming || isCanceling || isAddingReturnShipping || isUpdatingReturnShipping || isDeletingReturnShipping || isAddingReturnItem || isRemovingReturnItem || isUpdatingReturnItem || isUpdating;
605
+ const form = useForm({
606
+ defaultValues: () => {
607
+ const method = preview.shipping_methods.find(
608
+ (s) => !!s.actions?.find(
609
+ (a) => a.action === "SHIPPING_ADD"
610
+ )
611
+ );
612
+ return Promise.resolve({
613
+ items: previewItems.map((i) => {
614
+ const actions = i.actions ?? [];
615
+ const returnAction = actions.find((a) => a.action === "RETURN_ITEM");
616
+ return {
617
+ item_id: i.id,
618
+ quantity: i.detail.return_requested_quantity,
619
+ note: returnAction?.internal_note ?? void 0,
620
+ reason_id: returnAction?.details?.reason_id
621
+ };
622
+ }),
623
+ option_id: method ? method.shipping_option_id ?? "" : "",
624
+ location_id: activeReturn?.location_id ?? void 0,
625
+ send_notification: false
626
+ });
627
+ },
628
+ resolver: zodResolver(ReturnCreateSchema)
629
+ });
630
+ const {
631
+ fields: items,
632
+ append,
633
+ remove,
634
+ update
635
+ } = useFieldArray({
636
+ name: "items",
637
+ control: form.control
638
+ });
639
+ useEffect(() => {
640
+ const existingItemsMap = {};
641
+ previewItems.forEach((i) => {
642
+ const ind = items.findIndex((field) => field.item_id === i.id);
643
+ if (!i.detail.return_requested_quantity) {
644
+ return;
645
+ }
646
+ existingItemsMap[i.id] = true;
647
+ if (ind > -1) {
648
+ if (items[ind].quantity !== i.detail.return_requested_quantity) {
649
+ const actions = i.actions ?? [];
650
+ const returnItemAction = actions.find(
651
+ (a) => a.action === "RETURN_ITEM"
652
+ );
653
+ update(ind, {
654
+ ...items[ind],
655
+ quantity: i.detail.return_requested_quantity,
656
+ note: returnItemAction?.internal_note ?? void 0,
657
+ reason_id: returnItemAction?.details?.reason_id
658
+ });
659
+ }
660
+ } else {
661
+ append({
662
+ item_id: i.id,
663
+ quantity: i.detail.return_requested_quantity
664
+ });
665
+ }
666
+ });
667
+ items.forEach((i, ind) => {
668
+ if (!(i.item_id in existingItemsMap)) {
669
+ remove(ind);
670
+ }
671
+ });
672
+ }, [previewItems]);
673
+ useEffect(() => {
674
+ const method = preview.shipping_methods?.find(
675
+ (s) => !!s.actions?.find(
676
+ (a) => a.action === "SHIPPING_ADD"
677
+ )
678
+ );
679
+ if (method) {
680
+ form.setValue("option_id", method.shipping_option_id ?? "");
681
+ } else {
682
+ form.setValue("option_id", "");
683
+ }
684
+ }, [preview.shipping_methods]);
685
+ useEffect(() => {
686
+ form.setValue("location_id", activeReturn?.location_id || "");
687
+ }, [activeReturn]);
688
+ useEffect(() => {
689
+ if (isShippingPriceEdit) {
690
+ document.getElementById("js-shipping-input")?.focus();
691
+ }
692
+ }, [isShippingPriceEdit]);
693
+ const showPlaceholder = !items.length;
694
+ const locationId = form.watch("location_id");
695
+ const shippingOptionId = form.watch("option_id");
696
+ const prompt = usePrompt();
697
+ const locationName = useMemo3(() => {
698
+ if (!locationId) return null;
699
+ return stockLocations.find((l) => l.id === locationId)?.name ?? null;
700
+ }, [locationId, stockLocations]);
701
+ const returnTotal = preview.return_requested_total;
702
+ const shippingTotal = useMemo3(() => {
703
+ const method = preview.shipping_methods.find(
704
+ (sm) => !!sm.actions?.find(
705
+ (a) => a.action === "SHIPPING_ADD"
706
+ )
707
+ );
708
+ return method?.total || 0;
709
+ }, [preview.shipping_methods]);
710
+ const estimatedDifference = (preview.summary?.pending_difference || 0) - previewItems.reduce(
711
+ (acc, item) => acc + (item.total ?? 0),
712
+ 0
713
+ );
714
+ const handleSubmit = form.handleSubmit(async (data) => {
715
+ try {
716
+ const res = await prompt({
717
+ title: t("general.areYouSure"),
718
+ description: t("orders.returns.confirmText"),
719
+ confirmText: t("actions.continue"),
720
+ cancelText: t("actions.cancel"),
721
+ variant: "confirmation"
722
+ });
723
+ if (!res) {
724
+ return;
725
+ }
726
+ await confirmReturnRequest({ no_notification: !data.send_notification });
727
+ toast.success(t("orders.returns.toast.confirmedSuccessfully"));
728
+ handleSuccess(`/orders/${order.id}`);
729
+ } catch (e) {
730
+ toast.error(t("general.error"), {
731
+ description: e instanceof Error ? e.message : void 0
732
+ });
733
+ }
734
+ });
735
+ const onItemsSelected = async () => {
736
+ const existingIds = new Set(items.map((i) => i.item_id));
737
+ const newIds = selectedLineItemIds.filter((id) => !existingIds.has(id));
738
+ if (newIds.length === 0) {
739
+ setIsOpen("items", false);
740
+ return;
741
+ }
742
+ try {
743
+ await addReturnItem({
744
+ items: newIds.map((id) => ({
745
+ id,
746
+ quantity: 1
747
+ }))
748
+ });
749
+ } catch (e) {
750
+ toast.error(
751
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
752
+ );
753
+ } finally {
754
+ selectedLineItemIds = [];
755
+ setIsOpen("items", false);
756
+ }
757
+ };
758
+ const onLocationChange = async (selectedLocationId) => {
759
+ await updateReturnRequest({ location_id: selectedLocationId });
760
+ };
761
+ const onShippingOptionChange = async (selectedOptionId) => {
762
+ const promises = preview.shipping_methods.map(
763
+ (s) => s.actions?.find(
764
+ (a) => a.action === "SHIPPING_ADD"
765
+ )?.id
766
+ ).filter((id) => !!id).map((id) => deleteReturnShipping(id));
767
+ await Promise.all(promises);
768
+ if (selectedOptionId) {
769
+ await addReturnShipping({ shipping_option_id: selectedOptionId });
770
+ }
771
+ };
772
+ return /* @__PURE__ */ jsx4(
773
+ RouteFocusModal.Form,
774
+ {
775
+ form,
776
+ onClose: (isSubmitSuccessful) => {
777
+ if (!isSubmitSuccessful) {
778
+ cancelReturnRequest();
779
+ }
780
+ },
781
+ children: /* @__PURE__ */ jsxs3(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
782
+ /* @__PURE__ */ jsx4(RouteFocusModal.Header, {}),
783
+ /* @__PURE__ */ jsx4(RouteFocusModal.Body, { className: "flex size-full justify-center overflow-y-auto", children: /* @__PURE__ */ jsxs3("div", { className: "mt-16 w-[720px] max-w-[100%] px-4 md:p-0", children: [
784
+ /* @__PURE__ */ jsx4(Heading, { level: "h1", children: t("orders.returns.create") }),
785
+ /* @__PURE__ */ jsx4(Text3, { size: "small", className: "text-ui-fg-subtle mt-2", children: t("orders.returns.policyHint", { days: RETURN_POLICY_DAYS }) }),
786
+ /* @__PURE__ */ jsxs3("div", { className: "mt-8 flex items-center justify-between", children: [
787
+ /* @__PURE__ */ jsx4(Heading, { level: "h2", children: t("orders.returns.inbound") }),
788
+ /* @__PURE__ */ jsxs3(StackedFocusModal, { id: "items", children: [
789
+ /* @__PURE__ */ jsx4(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx4(
790
+ "a",
791
+ {
792
+ href: "#",
793
+ onClick: (e) => e.preventDefault(),
794
+ className: "focus-visible:shadow-borders-focus transition-fg txt-compact-small-plus cursor-pointer text-blue-500 outline-none hover:text-blue-400",
795
+ "data-testid": "return-create-add-items-trigger",
796
+ children: t("actions.addItems")
797
+ }
798
+ ) }),
799
+ /* @__PURE__ */ jsxs3(StackedFocusModal.Content, { children: [
800
+ /* @__PURE__ */ jsx4(StackedFocusModal.Header, {}),
801
+ /* @__PURE__ */ jsx4(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: t("actions.addItems") }) }),
802
+ /* @__PURE__ */ jsx4(StackedFocusModal.Description, { className: "sr-only", children: t("orders.returns.create") }),
803
+ /* @__PURE__ */ jsx4(StackedFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsx4(
804
+ AddReturnItemsTable,
805
+ {
806
+ order,
807
+ selectedItems: items.map((i) => i.item_id),
808
+ onSelectionChange: (s) => selectedLineItemIds = s
809
+ }
810
+ ) }),
811
+ /* @__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: [
812
+ /* @__PURE__ */ jsx4(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
813
+ Button,
814
+ {
815
+ type: "button",
816
+ variant: "secondary",
817
+ size: "small",
818
+ "data-testid": "return-create-add-items-cancel",
819
+ children: t("actions.cancel")
820
+ }
821
+ ) }),
822
+ /* @__PURE__ */ jsx4(
823
+ Button,
824
+ {
825
+ type: "button",
826
+ variant: "primary",
827
+ size: "small",
828
+ onClick: onItemsSelected,
829
+ "data-testid": "return-create-add-items-save",
830
+ children: t("actions.save")
831
+ },
832
+ "submit-button"
833
+ )
834
+ ] }) }) })
835
+ ] })
836
+ ] })
837
+ ] }),
838
+ showPlaceholder && /* @__PURE__ */ jsx4(
839
+ "div",
840
+ {
841
+ style: {
842
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
843
+ },
844
+ className: "bg-ui-bg-field mt-4 block h-[56px] w-full rounded-lg border border-dashed"
845
+ }
846
+ ),
847
+ items.filter((item) => !!previewItemsMap.get(item.item_id)).map((item, index) => {
848
+ const previewItem = previewItemsMap.get(item.item_id);
849
+ if (!previewItem) {
850
+ return null;
851
+ }
852
+ const orderItem = itemsMap.get(item.item_id);
853
+ if (!orderItem) {
854
+ return null;
855
+ }
856
+ return /* @__PURE__ */ jsx4(
857
+ ReturnItem,
858
+ {
859
+ item: orderItem,
860
+ previewItem,
861
+ currencyCode: order.currency_code,
862
+ form,
863
+ locationId,
864
+ locationName,
865
+ onRemove: () => {
866
+ const actions = previewItems.find((i) => i.id === item.item_id)?.actions ?? [];
867
+ const actionId = actions.find(
868
+ (a) => a.action === "RETURN_ITEM"
869
+ )?.id;
870
+ if (actionId) {
871
+ removeReturnItem(actionId);
872
+ }
873
+ },
874
+ onUpdate: (payload) => {
875
+ const actions = previewItems.find((i) => i.id === item.item_id)?.actions ?? [];
876
+ const action = actions.find(
877
+ (a) => a.action === "RETURN_ITEM"
878
+ );
879
+ if (action) {
880
+ updateReturnItem(
881
+ { actionId: action.id, ...payload },
882
+ {
883
+ onError: (error) => {
884
+ if (action.details?.quantity && payload.quantity) {
885
+ form.setValue(
886
+ `items.${index}.quantity`,
887
+ action.details.quantity
888
+ );
889
+ }
890
+ toast.error(error.message);
891
+ }
892
+ }
893
+ );
894
+ }
895
+ },
896
+ index
897
+ },
898
+ item.id
899
+ );
900
+ }),
901
+ !showPlaceholder && /* @__PURE__ */ jsxs3("div", { className: "mt-8 flex flex-col gap-y-4", children: [
902
+ /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", children: [
903
+ /* @__PURE__ */ jsxs3("div", { children: [
904
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("orders.returns.location") }),
905
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", children: t("orders.returns.locationHint") })
906
+ ] }),
907
+ /* @__PURE__ */ jsx4(
908
+ Form.Field,
909
+ {
910
+ control: form.control,
911
+ name: "location_id",
912
+ render: ({ field: { value, onChange, ...field } }) => {
913
+ return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(
914
+ Combobox,
915
+ {
916
+ value: value ?? void 0,
917
+ onChange: (v) => {
918
+ onChange(v);
919
+ onLocationChange(v ?? "");
920
+ },
921
+ ...field,
922
+ options: (stockLocations ?? []).map(
923
+ (loc) => ({
924
+ label: loc.name,
925
+ value: loc.id
926
+ })
927
+ ),
928
+ "data-testid": "return-create-location"
929
+ }
930
+ ) }) });
931
+ }
932
+ }
933
+ )
934
+ ] }),
935
+ /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", children: [
936
+ /* @__PURE__ */ jsxs3("div", { children: [
937
+ /* @__PURE__ */ jsxs3(Form.Label, { children: [
938
+ t("orders.returns.inboundShipping"),
939
+ /* @__PURE__ */ jsxs3(
940
+ Text3,
941
+ {
942
+ size: "small",
943
+ leading: "compact",
944
+ className: "text-ui-fg-muted ml-1 inline",
945
+ children: [
946
+ "(",
947
+ t("fields.optional"),
948
+ ")"
949
+ ]
950
+ }
951
+ )
952
+ ] }),
953
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", children: t("orders.returns.inboundShippingHint") })
954
+ ] }),
955
+ /* @__PURE__ */ jsx4(
956
+ Form.Field,
957
+ {
958
+ control: form.control,
959
+ name: "option_id",
960
+ render: ({ field: { value, onChange, ...field } }) => {
961
+ return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(
962
+ Combobox,
963
+ {
964
+ allowClear: true,
965
+ value,
966
+ onChange: (v) => {
967
+ onChange(v ?? "");
968
+ onShippingOptionChange(v);
969
+ },
970
+ ...field,
971
+ options: (shippingOptions ?? []).filter(
972
+ (so) => (locationId ? so.service_zone?.fulfillment_set?.location?.id === locationId : true) && !!so.rules?.find(
973
+ (r) => r.attribute === "is_return" && r.value === "true"
974
+ )
975
+ ).map((so) => ({
976
+ label: so.name,
977
+ value: so.id
978
+ })),
979
+ disabled: !locationId,
980
+ noResultsPlaceholder: /* @__PURE__ */ jsx4(ReturnShippingPlaceholder, {}),
981
+ "data-testid": "return-create-shipping-option"
982
+ }
983
+ ) }) });
984
+ }
985
+ }
986
+ )
987
+ ] })
988
+ ] }),
989
+ /* @__PURE__ */ jsxs3("div", { className: "mt-8 border-y border-dotted py-4", children: [
990
+ /* @__PURE__ */ jsxs3("div", { className: "mb-2 flex items-center justify-between", children: [
991
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.returnTotal") }),
992
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(
993
+ returnTotal ? -1 * returnTotal : returnTotal ?? 0,
994
+ order.currency_code
995
+ ) })
996
+ ] }),
997
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
998
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.inboundShipping") }),
999
+ /* @__PURE__ */ jsxs3("span", { className: "txt-small text-ui-fg-subtle flex items-center", children: [
1000
+ !isShippingPriceEdit && /* @__PURE__ */ jsx4(
1001
+ IconButton2,
1002
+ {
1003
+ onClick: () => setIsShippingPriceEdit(true),
1004
+ variant: "transparent",
1005
+ className: "text-ui-fg-muted",
1006
+ disabled: showPlaceholder || !shippingOptionId,
1007
+ children: /* @__PURE__ */ jsx4(PencilSquare, {})
1008
+ }
1009
+ ),
1010
+ isShippingPriceEdit ? /* @__PURE__ */ jsx4(
1011
+ CurrencyInput,
1012
+ {
1013
+ id: "js-shipping-input",
1014
+ onBlur: () => {
1015
+ let actionId;
1016
+ preview.shipping_methods.forEach((s) => {
1017
+ const actions = s.actions;
1018
+ if (actions) {
1019
+ for (const a of actions) {
1020
+ if (a.action === "SHIPPING_ADD") {
1021
+ actionId = a.id;
1022
+ }
1023
+ }
1024
+ }
1025
+ });
1026
+ if (actionId) {
1027
+ updateReturnShipping({
1028
+ actionId,
1029
+ custom_amount: customShippingAmount.float ?? void 0
1030
+ });
1031
+ }
1032
+ setIsShippingPriceEdit(false);
1033
+ },
1034
+ symbol: currencies[order.currency_code.toUpperCase()]?.symbol_native ?? "",
1035
+ code: order.currency_code,
1036
+ onValueChange: (_value, _name, values) => setCustomShippingAmount({
1037
+ value: values?.value ?? "",
1038
+ float: values?.float ?? null
1039
+ }),
1040
+ value: customShippingAmount.value,
1041
+ disabled: showPlaceholder
1042
+ }
1043
+ ) : getStylizedAmount(shippingTotal, order.currency_code)
1044
+ ] })
1045
+ ] }),
1046
+ /* @__PURE__ */ jsxs3("div", { className: "mt-4 flex items-center justify-between border-t border-dotted pt-4", children: [
1047
+ /* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: t("orders.returns.estDifference") }),
1048
+ /* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: getStylizedAmount(estimatedDifference, order.currency_code) })
1049
+ ] })
1050
+ ] }),
1051
+ /* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-field mt-8 rounded-lg border py-2 pl-2 pr-4", children: /* @__PURE__ */ jsx4(
1052
+ Form.Field,
1053
+ {
1054
+ control: form.control,
1055
+ name: "send_notification",
1056
+ render: ({ field: { onChange, value, ...field } }) => {
1057
+ return /* @__PURE__ */ jsxs3(Form.Item, { children: [
1058
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center", children: [
1059
+ /* @__PURE__ */ jsx4(Form.Control, { className: "mr-4 self-start", children: /* @__PURE__ */ jsx4(
1060
+ Switch,
1061
+ {
1062
+ dir: "ltr",
1063
+ className: "mt-[2px] rtl:rotate-180",
1064
+ checked: !!value,
1065
+ onCheckedChange: onChange,
1066
+ ...field,
1067
+ "data-testid": "return-create-notify"
1068
+ }
1069
+ ) }),
1070
+ /* @__PURE__ */ jsxs3("div", { className: "block", children: [
1071
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("orders.returns.sendNotification") }),
1072
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", children: t("orders.returns.sendNotificationHint") })
1073
+ ] })
1074
+ ] }),
1075
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, {})
1076
+ ] });
1077
+ }
1078
+ }
1079
+ ) }),
1080
+ /* @__PURE__ */ jsx4("div", { className: "p-8" })
1081
+ ] }) }),
1082
+ /* @__PURE__ */ jsx4(RouteFocusModal.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: [
1083
+ /* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
1084
+ Button,
1085
+ {
1086
+ type: "button",
1087
+ variant: "secondary",
1088
+ size: "small",
1089
+ "data-testid": "return-create-cancel",
1090
+ children: t("orders.returns.cancel.title")
1091
+ }
1092
+ ) }),
1093
+ /* @__PURE__ */ jsx4(
1094
+ Button,
1095
+ {
1096
+ type: "submit",
1097
+ variant: "primary",
1098
+ size: "small",
1099
+ isLoading: isRequestLoading,
1100
+ "data-testid": "return-create-confirm",
1101
+ children: t("orders.returns.confirm")
1102
+ },
1103
+ "submit-button"
1104
+ )
1105
+ ] }) }) })
1106
+ ] })
1107
+ }
1108
+ );
1109
+ };
1110
+
1111
+ // src/pages/orders/[id]/returns/create/index.tsx
1112
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1113
+ var Component = () => {
1114
+ const { t } = useTranslation5();
1115
+ return /* @__PURE__ */ jsxs4(RouteFocusModal, { children: [
1116
+ /* @__PURE__ */ jsx5(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx5("span", { className: "sr-only", children: t("orders.returns.create") }) }),
1117
+ /* @__PURE__ */ jsx5(RouteFocusModal.Description, { className: "sr-only", children: t("orders.returns.confirmText") }),
1118
+ /* @__PURE__ */ jsx5(ReturnCreateContent, {})
1119
+ ] });
1120
+ };
1121
+ var create_default = Component;
1122
+ var ReturnCreateContent = () => {
1123
+ const { id } = useParams();
1124
+ const { t } = useTranslation5();
1125
+ const navigate = useNavigate();
1126
+ const orderId = id ?? "";
1127
+ const { order } = useOrder(orderId, {
1128
+ // Use `<rel>.*` and bare scalar names. Combining `*foo` with
1129
+ // `*foo.bar` (or `+foo.bar.baz`) makes the Medusa query parser look
1130
+ // up a literal `*items` / `+items` on Order and 500s. See
1131
+ // packages/core/src/api/vendor/orders/query-config.ts.
1132
+ fields: "currency_code,total,items.*,items.variant.*,items.offer.*,items.offer.inventory_item_link.*,items.offer.inventory_item_link.required_quantity,items.offer.inventory_item_link.inventory_item.*,items.offer.inventory_item_link.inventory_item.location_levels.*"
1133
+ });
1134
+ const { order: preview } = useOrderPreview(orderId);
1135
+ const [activeReturn, setActiveReturn] = useState3(
1136
+ void 0
1137
+ );
1138
+ const isInitiatingRef = useRef(false);
1139
+ const { mutateAsync: initiateReturn } = useInitiateReturn(orderId);
1140
+ useEffect2(() => {
1141
+ async function run() {
1142
+ if (isInitiatingRef.current || activeReturn || !order || !preview) {
1143
+ return;
1144
+ }
1145
+ isInitiatingRef.current = true;
1146
+ try {
1147
+ const res = await initiateReturn({ order_id: orderId });
1148
+ const r = res?.return;
1149
+ if (r) {
1150
+ setActiveReturn(r);
1151
+ }
1152
+ } catch (e) {
1153
+ toast2.error(
1154
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
1155
+ );
1156
+ navigate(`/orders/${orderId}`, { replace: true });
1157
+ } finally {
1158
+ isInitiatingRef.current = false;
1159
+ }
1160
+ }
1161
+ run();
1162
+ }, [order, preview, activeReturn, initiateReturn, orderId, navigate, t]);
1163
+ const ready = !!(order && preview && activeReturn);
1164
+ if (!ready) {
1165
+ return null;
1166
+ }
1167
+ return /* @__PURE__ */ jsx5(
1168
+ ReturnCreateForm,
1169
+ {
1170
+ order,
1171
+ preview,
1172
+ activeReturn
1173
+ }
1174
+ );
1175
+ };
1176
+ export {
1177
+ Component,
1178
+ create_default as default
1179
+ };