@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,1798 @@
1
+ import {
2
+ ItemPlaceholder
3
+ } from "./chunk-ZHFFTT3I.js";
4
+ import {
5
+ ReturnShippingPlaceholder
6
+ } from "./chunk-YBF45CX5.js";
7
+ import {
8
+ useReturnReasons
9
+ } from "./chunk-ZLYGEART.js";
10
+ import {
11
+ useAddClaimInboundItems,
12
+ useAddClaimInboundShipping,
13
+ useCancelClaimRequest,
14
+ useClaim,
15
+ useClaimConfirmRequest,
16
+ useCreateClaim,
17
+ useDeleteClaimInboundShipping,
18
+ useRemoveClaimInboundItem,
19
+ useUpdateClaimInboundItem,
20
+ useUpdateClaimInboundShipping
21
+ } from "./chunk-S7NGDLZ3.js";
22
+ import {
23
+ getReturnableQuantity
24
+ } from "./chunk-UM7ZR3VU.js";
25
+ import {
26
+ DEFAULT_FIELDS
27
+ } from "./chunk-IMJ62GAP.js";
28
+ import {
29
+ useReturn,
30
+ useUpdateReturn
31
+ } from "./chunk-3TST3EWQ.js";
32
+ import {
33
+ MoneyAmountCell
34
+ } from "./chunk-L57USMYC.js";
35
+ import {
36
+ getStylizedAmount
37
+ } from "./chunk-3BXCPHN6.js";
38
+ import {
39
+ ProductCell,
40
+ ProductHeader
41
+ } from "./chunk-FWPGOIFA.js";
42
+ import {
43
+ PlaceholderCell
44
+ } from "./chunk-PHOCVOZ5.js";
45
+ import "./chunk-IQPN4PZJ.js";
46
+ import {
47
+ Combobox
48
+ } from "./chunk-VBRTC2VU.js";
49
+ import "./chunk-TKGWSUEI.js";
50
+ import {
51
+ KeyboundForm
52
+ } from "./chunk-SITRHMZZ.js";
53
+ import {
54
+ RouteFocusModal,
55
+ StackedFocusModal,
56
+ useRouteModal,
57
+ useStackedModal
58
+ } from "./chunk-GDWBOQI5.js";
59
+ import {
60
+ Form
61
+ } from "./chunk-3QSRE5LS.js";
62
+ import "./chunk-FQERBIVS.js";
63
+ import {
64
+ _DataTable,
65
+ useDataTable
66
+ } from "./chunk-W3UHAQCV.js";
67
+ import "./chunk-YN3FGNJM.js";
68
+ import "./chunk-KCHYLLVG.js";
69
+ import "./chunk-634XVU3D.js";
70
+ import {
71
+ useQueryParams
72
+ } from "./chunk-THHRRYRS.js";
73
+ import "./chunk-LRD242C7.js";
74
+ import {
75
+ Thumbnail
76
+ } from "./chunk-WIYFXWRI.js";
77
+ import "./chunk-INNFZYX2.js";
78
+ import {
79
+ ActionMenu
80
+ } from "./chunk-BDGZ4EQO.js";
81
+ import "./chunk-LAVHRER2.js";
82
+ import "./chunk-QHQWEERJ.js";
83
+ import "./chunk-Y7QKP6QU.js";
84
+ import {
85
+ useShippingOptions
86
+ } from "./chunk-JR7AABT5.js";
87
+ import {
88
+ useStockLocations
89
+ } from "./chunk-ZQCCVCHB.js";
90
+ import {
91
+ useOffers
92
+ } from "./chunk-EPRYM3FA.js";
93
+ import {
94
+ useOrder,
95
+ useOrderPreview
96
+ } from "./chunk-6FDPVW7Y.js";
97
+ import "./chunk-G6YNCIVF.js";
98
+ import "./chunk-A5DJIOHN.js";
99
+ import "./chunk-RHKRREUU.js";
100
+ import "./chunk-ZA2KFUFR.js";
101
+ import "./chunk-LXZXXOJ3.js";
102
+ import "./chunk-NBMM2TZK.js";
103
+
104
+ // src/pages/orders/[id]/claims/create/index.tsx
105
+ import { toast as toast2 } from "@medusajs/ui";
106
+ import { useEffect as useEffect2, useState as useState4 } from "react";
107
+ import { useTranslation as useTranslation11 } from "react-i18next";
108
+ import { useNavigate, useParams } from "react-router-dom";
109
+
110
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-create-form.tsx
111
+ import { zodResolver } from "@hookform/resolvers/zod";
112
+ import { Alert, Button as Button2, Heading as Heading2, Switch, Text as Text4, toast, usePrompt } from "@medusajs/ui";
113
+ import { useEffect, useMemo as useMemo5, useState as useState3 } from "react";
114
+ import { useFieldArray as useFieldArray2, useForm } from "react-hook-form";
115
+ import { useTranslation as useTranslation10 } from "react-i18next";
116
+
117
+ // src/pages/orders/[id]/claims/create/_components/add-claim-items-table/add-claim-items-table.tsx
118
+ import { useMemo as useMemo2, useState } from "react";
119
+ import { useTranslation as useTranslation3 } from "react-i18next";
120
+
121
+ // src/pages/orders/[id]/claims/create/_components/add-claim-items-table/use-claim-item-table-columns.tsx
122
+ import { Checkbox } from "@medusajs/ui";
123
+ import { createColumnHelper } from "@tanstack/react-table";
124
+ import { useMemo } from "react";
125
+ import { useTranslation } from "react-i18next";
126
+ import { jsx } from "react/jsx-runtime";
127
+ var columnHelper = createColumnHelper();
128
+ var useClaimItemTableColumns = (currencyCode) => {
129
+ const { t } = useTranslation();
130
+ return useMemo(
131
+ () => [
132
+ columnHelper.display({
133
+ id: "select",
134
+ header: ({ table }) => {
135
+ return /* @__PURE__ */ jsx(
136
+ Checkbox,
137
+ {
138
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
139
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
140
+ }
141
+ );
142
+ },
143
+ cell: ({ row }) => {
144
+ const isSelectable = row.getCanSelect();
145
+ return /* @__PURE__ */ jsx(
146
+ Checkbox,
147
+ {
148
+ disabled: !isSelectable,
149
+ checked: row.getIsSelected(),
150
+ onCheckedChange: (value) => row.toggleSelected(!!value),
151
+ onClick: (e) => {
152
+ e.stopPropagation();
153
+ }
154
+ }
155
+ );
156
+ }
157
+ }),
158
+ columnHelper.display({
159
+ id: "product",
160
+ header: () => /* @__PURE__ */ jsx(ProductHeader, {}),
161
+ cell: ({ row }) => /* @__PURE__ */ jsx(
162
+ ProductCell,
163
+ {
164
+ product: {
165
+ thumbnail: row.original.thumbnail,
166
+ title: row.original.product_title
167
+ }
168
+ }
169
+ )
170
+ }),
171
+ columnHelper.accessor("variant.sku", {
172
+ header: t("fields.sku"),
173
+ cell: ({ getValue }) => {
174
+ return getValue() || "-";
175
+ }
176
+ }),
177
+ columnHelper.accessor("variant.title", {
178
+ header: t("fields.variant")
179
+ }),
180
+ columnHelper.accessor("quantity", {
181
+ header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.quantity") }) }),
182
+ cell: ({ row }) => {
183
+ return getReturnableQuantity(row.original);
184
+ }
185
+ }),
186
+ columnHelper.accessor("refundable_total", {
187
+ header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-end overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.price") }) }),
188
+ cell: ({ getValue }) => {
189
+ const amount = getValue() || 0;
190
+ const stylized = getStylizedAmount(amount, currencyCode);
191
+ return /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-end overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: stylized }) });
192
+ }
193
+ })
194
+ ],
195
+ [t, currencyCode]
196
+ );
197
+ };
198
+
199
+ // src/pages/orders/[id]/claims/create/_components/add-claim-items-table/use-claim-item-table-filters.tsx
200
+ import { useTranslation as useTranslation2 } from "react-i18next";
201
+ var useClaimItemTableFilters = () => {
202
+ const { t } = useTranslation2();
203
+ const filters = [
204
+ {
205
+ key: "returnable_quantity",
206
+ label: t("orders.returns.returnableQuantityLabel"),
207
+ type: "number"
208
+ },
209
+ {
210
+ key: "refundable_amount",
211
+ label: t("orders.returns.refundableAmountLabel"),
212
+ type: "number"
213
+ },
214
+ {
215
+ key: "created_at",
216
+ label: t("fields.createdAt"),
217
+ type: "date"
218
+ },
219
+ {
220
+ key: "updated_at",
221
+ label: t("fields.updatedAt"),
222
+ type: "date"
223
+ }
224
+ ];
225
+ return filters;
226
+ };
227
+
228
+ // src/pages/orders/[id]/claims/create/_components/add-claim-items-table/use-claim-item-table-query.tsx
229
+ var useClaimItemTableQuery = ({
230
+ pageSize = 50,
231
+ prefix
232
+ }) => {
233
+ const raw = useQueryParams(
234
+ [
235
+ "q",
236
+ "offset",
237
+ "order",
238
+ "created_at",
239
+ "updated_at",
240
+ "returnable_quantity",
241
+ "refundable_amount"
242
+ ],
243
+ prefix
244
+ );
245
+ const {
246
+ offset,
247
+ created_at,
248
+ updated_at,
249
+ refundable_amount,
250
+ returnable_quantity,
251
+ ...rest
252
+ } = raw;
253
+ const searchParams = {
254
+ ...rest,
255
+ limit: pageSize,
256
+ offset: offset ? Number(offset) : 0,
257
+ created_at: created_at ? JSON.parse(created_at) : void 0,
258
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
259
+ refundable_amount: refundable_amount ? JSON.parse(refundable_amount) : void 0,
260
+ returnable_quantity: returnable_quantity ? JSON.parse(returnable_quantity) : void 0
261
+ };
262
+ return { searchParams, raw };
263
+ };
264
+
265
+ // src/pages/orders/[id]/claims/create/_components/add-claim-items-table/add-claim-items-table.tsx
266
+ import { jsx as jsx2 } from "react/jsx-runtime";
267
+ var PAGE_SIZE = 50;
268
+ var PREFIX = "rit";
269
+ var AddClaimItemsTable = ({
270
+ onSelectionChange,
271
+ selectedItems,
272
+ items,
273
+ currencyCode
274
+ }) => {
275
+ const { t } = useTranslation3();
276
+ const [rowSelection, setRowSelection] = useState(
277
+ selectedItems.reduce((acc, id) => {
278
+ acc[id] = true;
279
+ return acc;
280
+ }, {})
281
+ );
282
+ const updater = (fn) => {
283
+ const newState = typeof fn === "function" ? fn(rowSelection) : fn;
284
+ setRowSelection(newState);
285
+ onSelectionChange(Object.keys(newState));
286
+ };
287
+ const { searchParams, raw } = useClaimItemTableQuery({
288
+ pageSize: PAGE_SIZE,
289
+ prefix: PREFIX
290
+ });
291
+ const queriedItems = useMemo2(() => {
292
+ const {
293
+ order,
294
+ offset,
295
+ limit,
296
+ q,
297
+ created_at,
298
+ updated_at,
299
+ refundable_amount,
300
+ returnable_quantity
301
+ } = searchParams;
302
+ let results = items;
303
+ if (q) {
304
+ const needle = q.toLowerCase();
305
+ results = results.filter((i) => {
306
+ return i.product_title?.toLowerCase().includes(needle) || i.variant_title?.toLowerCase().includes(needle) || i.variant_sku?.toLowerCase().includes(needle);
307
+ });
308
+ }
309
+ if (order) {
310
+ const direction = order[0] === "-" ? "desc" : "asc";
311
+ const field = order.replace("-", "");
312
+ results = sortItems(results, field, direction);
313
+ }
314
+ if (created_at) {
315
+ results = filterByDate(results, created_at, "created_at");
316
+ }
317
+ if (updated_at) {
318
+ results = filterByDate(results, updated_at, "updated_at");
319
+ }
320
+ if (returnable_quantity) {
321
+ results = filterByNumber(
322
+ results,
323
+ returnable_quantity,
324
+ "returnable_quantity",
325
+ currencyCode
326
+ );
327
+ }
328
+ if (refundable_amount) {
329
+ results = filterByNumber(
330
+ results,
331
+ refundable_amount,
332
+ "refundable_amount",
333
+ currencyCode
334
+ );
335
+ }
336
+ return results.slice(offset, offset + limit);
337
+ }, [items, currencyCode, searchParams]);
338
+ const columns = useClaimItemTableColumns(currencyCode);
339
+ const filters = useClaimItemTableFilters();
340
+ const { table } = useDataTable({
341
+ data: queriedItems,
342
+ columns,
343
+ count: queriedItems.length,
344
+ enablePagination: true,
345
+ getRowId: (row) => row.id,
346
+ pageSize: PAGE_SIZE,
347
+ enableRowSelection: (row) => {
348
+ return getReturnableQuantity(row.original) > 0;
349
+ },
350
+ rowSelection: {
351
+ state: rowSelection,
352
+ updater
353
+ }
354
+ });
355
+ return /* @__PURE__ */ jsx2(
356
+ "div",
357
+ {
358
+ className: "flex size-full flex-col overflow-hidden",
359
+ "data-testid": "add-claim-items-picker",
360
+ children: /* @__PURE__ */ jsx2(
361
+ _DataTable,
362
+ {
363
+ table,
364
+ columns,
365
+ pageSize: PAGE_SIZE,
366
+ count: queriedItems.length,
367
+ filters,
368
+ pagination: true,
369
+ layout: "fill",
370
+ search: true,
371
+ orderBy: [
372
+ { key: "product_title", label: t("fields.product") },
373
+ { key: "variant_title", label: t("fields.variant") },
374
+ { key: "sku", label: t("fields.sku") },
375
+ {
376
+ key: "returnable_quantity",
377
+ label: t("orders.fields.returnableQuantity")
378
+ },
379
+ {
380
+ key: "refundable_amount",
381
+ label: t("orders.fields.refundableAmount")
382
+ }
383
+ ],
384
+ prefix: PREFIX,
385
+ queryObject: raw
386
+ }
387
+ )
388
+ }
389
+ );
390
+ };
391
+ var sortItems = (items, field, direction) => {
392
+ return [...items].sort((a, b) => {
393
+ let aValue;
394
+ let bValue;
395
+ if (field === "product_title") {
396
+ aValue = a.product_title;
397
+ bValue = b.product_title;
398
+ } else if (field === "variant_title") {
399
+ aValue = a.variant_title;
400
+ bValue = b.variant_title;
401
+ } else if (field === "sku") {
402
+ aValue = a.variant_sku;
403
+ bValue = b.variant_sku;
404
+ } else if (field === "returnable_quantity") {
405
+ aValue = getReturnableQuantity(a);
406
+ bValue = getReturnableQuantity(b);
407
+ } else if (field === "refundable_amount") {
408
+ aValue = a.refundable_total ?? 0;
409
+ bValue = b.refundable_total ?? 0;
410
+ }
411
+ if (aValue === void 0 || aValue === null) return 1;
412
+ if (bValue === void 0 || bValue === null) return -1;
413
+ if (aValue < bValue) {
414
+ return direction === "asc" ? -1 : 1;
415
+ }
416
+ if (aValue > bValue) {
417
+ return direction === "asc" ? 1 : -1;
418
+ }
419
+ return 0;
420
+ });
421
+ };
422
+ var filterByDate = (items, date, field) => {
423
+ const { gt, gte, lt, lte } = date;
424
+ return items.filter((i) => {
425
+ const itemDate = new Date(i[field]);
426
+ let isValid = true;
427
+ if (gt) {
428
+ isValid = isValid && itemDate > new Date(gt);
429
+ }
430
+ if (gte) {
431
+ isValid = isValid && itemDate >= new Date(gte);
432
+ }
433
+ if (lt) {
434
+ isValid = isValid && itemDate < new Date(lt);
435
+ }
436
+ if (lte) {
437
+ isValid = isValid && itemDate <= new Date(lte);
438
+ }
439
+ return isValid;
440
+ });
441
+ };
442
+ var defaultOperators = {
443
+ eq: void 0,
444
+ gt: void 0,
445
+ gte: void 0,
446
+ lt: void 0,
447
+ lte: void 0
448
+ };
449
+ var filterByNumber = (items, value, field, currency_code) => {
450
+ const { eq, gt, lt, gte, lte } = typeof value === "object" ? { ...defaultOperators, ...value } : { ...defaultOperators, eq: value };
451
+ return items.filter((i) => {
452
+ const returnableQuantity = getReturnableQuantity(i);
453
+ const refundableAmount = getStylizedAmount(
454
+ i.refundable_total ?? 0,
455
+ currency_code
456
+ );
457
+ const itemValue = field === "returnable_quantity" ? returnableQuantity : refundableAmount;
458
+ if (eq !== void 0) {
459
+ return itemValue === eq;
460
+ }
461
+ let isValid = true;
462
+ if (gt !== void 0) {
463
+ isValid = isValid && Number(itemValue) > gt;
464
+ }
465
+ if (gte !== void 0) {
466
+ isValid = isValid && Number(itemValue) >= gte;
467
+ }
468
+ if (lt !== void 0) {
469
+ isValid = isValid && Number(itemValue) < lt;
470
+ }
471
+ if (lte !== void 0) {
472
+ isValid = isValid && Number(itemValue) <= lte;
473
+ }
474
+ return isValid;
475
+ });
476
+ };
477
+
478
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-inbound-item.tsx
479
+ import { ChatBubble, DocumentText, XCircle, XMark } from "@medusajs/icons";
480
+ import { IconButton, Input, Text } from "@medusajs/ui";
481
+ import { useTranslation as useTranslation4 } from "react-i18next";
482
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
483
+ function ClaimInboundItem({
484
+ item,
485
+ previewItem,
486
+ currencyCode,
487
+ form,
488
+ onRemove,
489
+ onUpdate,
490
+ index
491
+ }) {
492
+ const { t } = useTranslation4();
493
+ const { return_reasons = [] } = useReturnReasons({ fields: "+label" });
494
+ const formItem = form.watch(`inbound_items.${index}`);
495
+ const showReturnReason = typeof formItem.reason_id === "string";
496
+ const showNote = typeof formItem.note === "string";
497
+ return /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl ", children: [
498
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-x-2 gap-y-2 border-b p-3 text-sm md:flex-row", children: [
499
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-x-3", children: [
500
+ /* @__PURE__ */ jsx3(Thumbnail, { src: item.thumbnail }),
501
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
502
+ /* @__PURE__ */ jsxs("div", { children: [
503
+ /* @__PURE__ */ jsxs(Text, { className: "txt-small", as: "span", weight: "plus", children: [
504
+ item.title,
505
+ " "
506
+ ] }),
507
+ item.variant_sku && /* @__PURE__ */ jsxs("span", { children: [
508
+ "(",
509
+ item.variant_sku,
510
+ ")"
511
+ ] })
512
+ ] }),
513
+ /* @__PURE__ */ jsx3(Text, { as: "div", className: "text-ui-fg-subtle txt-small", children: item.product_title })
514
+ ] })
515
+ ] }),
516
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 justify-between", children: [
517
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-grow items-center gap-2", children: [
518
+ /* @__PURE__ */ jsx3(
519
+ Form.Field,
520
+ {
521
+ control: form.control,
522
+ name: `inbound_items.${index}.quantity`,
523
+ render: ({ field }) => {
524
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
525
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
526
+ Input,
527
+ {
528
+ ...field,
529
+ className: "bg-ui-bg-base txt-small w-[67px] rounded-lg",
530
+ min: 1,
531
+ max: item.quantity,
532
+ type: "number",
533
+ onBlur: (e) => {
534
+ const val = e.target.value;
535
+ const payload = val === "" ? null : Number(val);
536
+ field.onChange(payload);
537
+ if (payload) {
538
+ onUpdate({ quantity: payload });
539
+ }
540
+ }
541
+ }
542
+ ) }),
543
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
544
+ ] });
545
+ }
546
+ }
547
+ ),
548
+ /* @__PURE__ */ jsx3(Text, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") })
549
+ ] }),
550
+ /* @__PURE__ */ jsx3("div", { className: "text-ui-fg-subtle txt-small mr-2 flex flex-shrink-0", children: /* @__PURE__ */ jsx3(
551
+ MoneyAmountCell,
552
+ {
553
+ currencyCode,
554
+ amount: previewItem.return_requested_total
555
+ }
556
+ ) }),
557
+ /* @__PURE__ */ jsx3(
558
+ ActionMenu,
559
+ {
560
+ groups: [
561
+ {
562
+ actions: [
563
+ !showReturnReason && {
564
+ label: t("actions.addReason"),
565
+ onClick: () => form.setValue(`inbound_items.${index}.reason_id`, ""),
566
+ icon: /* @__PURE__ */ jsx3(ChatBubble, {})
567
+ },
568
+ !showNote && {
569
+ label: t("actions.addNote"),
570
+ onClick: () => form.setValue(`inbound_items.${index}.note`, ""),
571
+ icon: /* @__PURE__ */ jsx3(DocumentText, {})
572
+ },
573
+ {
574
+ label: t("actions.remove"),
575
+ onClick: onRemove,
576
+ icon: /* @__PURE__ */ jsx3(XCircle, {})
577
+ }
578
+ ].filter(Boolean)
579
+ }
580
+ ]
581
+ }
582
+ )
583
+ ] })
584
+ ] }),
585
+ /* @__PURE__ */ jsxs(Fragment, { children: [
586
+ showReturnReason && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
587
+ /* @__PURE__ */ jsxs("div", { children: [
588
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.reason") }),
589
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.reasonHint") })
590
+ ] }),
591
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
592
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
593
+ Form.Field,
594
+ {
595
+ control: form.control,
596
+ name: `inbound_items.${index}.reason_id`,
597
+ render: ({ field: { ref: _ref, value, onChange, ...field } }) => {
598
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
599
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
600
+ Combobox,
601
+ {
602
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
603
+ value,
604
+ onChange: (v) => {
605
+ onUpdate({ reason_id: v });
606
+ onChange(v);
607
+ },
608
+ ...field,
609
+ options: return_reasons.map((reason) => ({
610
+ label: reason.label ?? "",
611
+ value: reason.id
612
+ }))
613
+ }
614
+ ) }),
615
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
616
+ ] });
617
+ }
618
+ }
619
+ ) }),
620
+ /* @__PURE__ */ jsx3(
621
+ IconButton,
622
+ {
623
+ type: "button",
624
+ className: "flex-shrink",
625
+ variant: "transparent",
626
+ onClick: () => {
627
+ form.setValue(`inbound_items.${index}.reason_id`, null);
628
+ onUpdate({ reason_id: null });
629
+ },
630
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
631
+ }
632
+ )
633
+ ] })
634
+ ] }),
635
+ showNote && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
636
+ /* @__PURE__ */ jsxs("div", { children: [
637
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.note") }),
638
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.noteHint") })
639
+ ] }),
640
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
641
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
642
+ Form.Field,
643
+ {
644
+ control: form.control,
645
+ name: `inbound_items.${index}.note`,
646
+ render: ({ field: { ref: _ref, ...field } }) => {
647
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
648
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
649
+ Input,
650
+ {
651
+ ...field,
652
+ value: field.value ?? "",
653
+ onBlur: () => {
654
+ field.onChange(field.value);
655
+ onUpdate({ internal_note: field.value });
656
+ },
657
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover"
658
+ }
659
+ ) }),
660
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
661
+ ] });
662
+ }
663
+ }
664
+ ) }),
665
+ /* @__PURE__ */ jsx3(
666
+ IconButton,
667
+ {
668
+ type: "button",
669
+ className: "flex-shrink",
670
+ variant: "transparent",
671
+ onClick: () => {
672
+ form.setValue(`inbound_items.${index}.note`, null);
673
+ onUpdate({ internal_note: null });
674
+ },
675
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
676
+ }
677
+ )
678
+ ] })
679
+ ] })
680
+ ] })
681
+ ] });
682
+ }
683
+
684
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-outbound-section.tsx
685
+ import { Button, Heading } from "@medusajs/ui";
686
+ import { useFieldArray } from "react-hook-form";
687
+ import { useTranslation as useTranslation9 } from "react-i18next";
688
+
689
+ // src/pages/orders/[id]/claims/create/_components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx
690
+ import { useMemo as useMemo4, useState as useState2 } from "react";
691
+ import { useTranslation as useTranslation7 } from "react-i18next";
692
+
693
+ // src/pages/orders/[id]/claims/create/_components/add-claim-outbound-items-table/use-claim-outbound-item-table-columns.tsx
694
+ import { Checkbox as Checkbox2, Text as Text2 } from "@medusajs/ui";
695
+ import { createColumnHelper as createColumnHelper2 } from "@tanstack/react-table";
696
+ import { useMemo as useMemo3 } from "react";
697
+ import { useTranslation as useTranslation5 } from "react-i18next";
698
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
699
+ var columnHelper2 = createColumnHelper2();
700
+ var useClaimOutboundItemTableColumns = () => {
701
+ const { t } = useTranslation5();
702
+ return useMemo3(
703
+ () => [
704
+ columnHelper2.display({
705
+ id: "select",
706
+ header: ({ table }) => /* @__PURE__ */ jsx4(
707
+ Checkbox2,
708
+ {
709
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
710
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
711
+ }
712
+ ),
713
+ cell: ({ row }) => {
714
+ const isSelectable = row.getCanSelect();
715
+ return /* @__PURE__ */ jsx4(
716
+ Checkbox2,
717
+ {
718
+ disabled: !isSelectable,
719
+ checked: row.getIsSelected(),
720
+ onCheckedChange: (value) => row.toggleSelected(!!value),
721
+ onClick: (e) => {
722
+ e.stopPropagation();
723
+ }
724
+ }
725
+ );
726
+ }
727
+ }),
728
+ columnHelper2.display({
729
+ id: "product",
730
+ header: t("fields.product"),
731
+ cell: ({ row }) => {
732
+ const variant = row.original.product_variant;
733
+ const productTitle = variant?.product?.title;
734
+ if (!productTitle) {
735
+ return /* @__PURE__ */ jsx4(PlaceholderCell, {});
736
+ }
737
+ return /* @__PURE__ */ jsxs2("div", { className: "flex h-full w-full max-w-[300px] items-center gap-x-3 overflow-hidden", children: [
738
+ /* @__PURE__ */ jsx4(Thumbnail, { src: variant?.product?.thumbnail }),
739
+ /* @__PURE__ */ jsx4(
740
+ Text2,
741
+ {
742
+ size: "small",
743
+ leading: "compact",
744
+ className: "truncate",
745
+ title: productTitle,
746
+ children: productTitle
747
+ }
748
+ )
749
+ ] });
750
+ }
751
+ }),
752
+ columnHelper2.accessor("sku", {
753
+ header: t("fields.sku"),
754
+ cell: ({ getValue }) => {
755
+ const sku = getValue();
756
+ if (!sku) return /* @__PURE__ */ jsx4(PlaceholderCell, {});
757
+ return /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", className: "truncate", children: sku });
758
+ }
759
+ }),
760
+ columnHelper2.display({
761
+ id: "variant_title",
762
+ header: t("fields.title"),
763
+ cell: ({ row }) => {
764
+ const title = row.original.product_variant?.title;
765
+ if (!title) return /* @__PURE__ */ jsx4(PlaceholderCell, {});
766
+ return /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", className: "truncate", children: title });
767
+ }
768
+ })
769
+ ],
770
+ [t]
771
+ );
772
+ };
773
+
774
+ // src/pages/orders/[id]/claims/create/_components/add-claim-outbound-items-table/use-claim-outbound-item-table-filters.tsx
775
+ import { useTranslation as useTranslation6 } from "react-i18next";
776
+ var useClaimOutboundItemTableFilters = () => {
777
+ const { t } = useTranslation6();
778
+ const filters = [
779
+ {
780
+ key: "created_at",
781
+ label: t("fields.createdAt"),
782
+ type: "date"
783
+ },
784
+ {
785
+ key: "updated_at",
786
+ label: t("fields.updatedAt"),
787
+ type: "date"
788
+ }
789
+ ];
790
+ return filters;
791
+ };
792
+
793
+ // src/pages/orders/[id]/claims/create/_components/add-claim-outbound-items-table/use-claim-outbound-item-table-query.tsx
794
+ var useClaimOutboundItemTableQuery = ({
795
+ pageSize = 50,
796
+ prefix
797
+ }) => {
798
+ const raw = useQueryParams(
799
+ ["q", "offset", "order", "created_at", "updated_at"],
800
+ prefix
801
+ );
802
+ const { offset, created_at, updated_at, ...rest } = raw;
803
+ const searchParams = {
804
+ ...rest,
805
+ limit: pageSize,
806
+ offset: offset ? Number(offset) : 0,
807
+ created_at: created_at ? JSON.parse(created_at) : void 0,
808
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0
809
+ };
810
+ return { searchParams, raw };
811
+ };
812
+
813
+ // src/pages/orders/[id]/claims/create/_components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx
814
+ import { jsx as jsx5 } from "react/jsx-runtime";
815
+ var PAGE_SIZE2 = 50;
816
+ var PREFIX2 = "rit";
817
+ var OFFER_PICKER_FIELDS = [
818
+ "id",
819
+ "sku",
820
+ "variant_id",
821
+ "seller_id",
822
+ "prices.amount",
823
+ "prices.currency_code",
824
+ "product_variant.id",
825
+ "product_variant.title",
826
+ "product_variant.product.id",
827
+ "product_variant.product.title",
828
+ "product_variant.product.thumbnail",
829
+ "product_variant.manage_inventory",
830
+ "product_variant.inventory_quantity",
831
+ "product_variant.inventory_items.required_quantity",
832
+ "product_variant.inventory_items.inventory.location_levels.available_quantity"
833
+ ].join(",");
834
+ var offerHasInventory = (offer) => {
835
+ const variant = offer.product_variant;
836
+ if (!variant) return false;
837
+ if (variant.manage_inventory === false) return true;
838
+ const links = variant.inventory_items ?? [];
839
+ if (!links.length) {
840
+ return (variant.inventory_quantity ?? 0) > 0;
841
+ }
842
+ return links.every((link) => {
843
+ const available = (link.inventory?.location_levels ?? []).reduce(
844
+ (acc, lvl) => acc + (lvl.available_quantity ?? 0),
845
+ 0
846
+ );
847
+ const required = link.required_quantity ?? 1;
848
+ return required > 0 && available >= required;
849
+ });
850
+ };
851
+ var AddClaimOutboundItemsTable = ({
852
+ currencyCode,
853
+ onSelectionChange
854
+ }) => {
855
+ const { t } = useTranslation7();
856
+ const [rowSelection, setRowSelection] = useState2({});
857
+ const [offerLookup, setOfferLookup] = useState2({});
858
+ const updater = (fn) => {
859
+ const newState = typeof fn === "function" ? fn(rowSelection) : fn;
860
+ setRowSelection(newState);
861
+ onSelectionChange(Object.keys(newState), offerLookup);
862
+ };
863
+ const { searchParams, raw } = useClaimOutboundItemTableQuery({
864
+ pageSize: PAGE_SIZE2,
865
+ prefix: PREFIX2
866
+ });
867
+ const offersResponse = useOffers({
868
+ ...searchParams,
869
+ fields: OFFER_PICKER_FIELDS
870
+ });
871
+ const rawOffersSource = offersResponse.offers;
872
+ const rawOffers = useMemo4(
873
+ () => rawOffersSource ?? [],
874
+ [rawOffersSource]
875
+ );
876
+ const offers = useMemo4(() => {
877
+ return rawOffers.filter((offer) => {
878
+ if (currencyCode) {
879
+ const hasPrice = (offer.prices ?? []).some(
880
+ (p) => p.currency_code === currencyCode
881
+ );
882
+ if (!hasPrice) return false;
883
+ }
884
+ return offerHasInventory(offer);
885
+ });
886
+ }, [rawOffers, currencyCode]);
887
+ useMemo4(() => {
888
+ if (!offers.length) return;
889
+ setOfferLookup((prev) => {
890
+ let changed = false;
891
+ const next = { ...prev };
892
+ for (const offer of offers) {
893
+ if (!next[offer.id]) {
894
+ next[offer.id] = offer;
895
+ changed = true;
896
+ }
897
+ }
898
+ return changed ? next : prev;
899
+ });
900
+ }, [offers]);
901
+ const count = offers.length;
902
+ const columns = useClaimOutboundItemTableColumns();
903
+ const filters = useClaimOutboundItemTableFilters();
904
+ const { table } = useDataTable({
905
+ data: offers,
906
+ columns,
907
+ count,
908
+ enablePagination: true,
909
+ // Row id = offer id so onSelectionChange yields offer_ids that the form
910
+ // layer sends to `useAddClaimOutboundItems` (which accepts `offer_id` and
911
+ // resolves to variant_id + unit_price server-side).
912
+ getRowId: (row) => row.id,
913
+ pageSize: PAGE_SIZE2,
914
+ enableRowSelection: () => true,
915
+ rowSelection: {
916
+ state: rowSelection,
917
+ updater
918
+ }
919
+ });
920
+ return /* @__PURE__ */ jsx5(
921
+ "div",
922
+ {
923
+ className: "flex size-full flex-col overflow-hidden",
924
+ "data-testid": "add-claim-outbound-picker",
925
+ children: /* @__PURE__ */ jsx5(
926
+ _DataTable,
927
+ {
928
+ table,
929
+ columns,
930
+ pageSize: PAGE_SIZE2,
931
+ count,
932
+ filters,
933
+ pagination: true,
934
+ layout: "fill",
935
+ search: true,
936
+ orderBy: [
937
+ { key: "sku", label: t("fields.sku") },
938
+ { key: "created_at", label: t("fields.createdAt") },
939
+ { key: "updated_at", label: t("fields.updatedAt") }
940
+ ],
941
+ prefix: PREFIX2,
942
+ queryObject: raw
943
+ }
944
+ )
945
+ }
946
+ );
947
+ };
948
+
949
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-outbound-item.tsx
950
+ import { XCircle as XCircle2 } from "@medusajs/icons";
951
+ import { Input as Input2, Text as Text3 } from "@medusajs/ui";
952
+ import { useTranslation as useTranslation8 } from "react-i18next";
953
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
954
+ function ClaimOutboundItem({
955
+ form,
956
+ onRemove,
957
+ index
958
+ }) {
959
+ const { t } = useTranslation8();
960
+ const row = form.watch(`outbound_items.${index}`);
961
+ const productTitle = row?.product_title ?? row?.variant_title ?? row?.offer_id;
962
+ return /* @__PURE__ */ jsx6(
963
+ "div",
964
+ {
965
+ className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl",
966
+ "data-testid": `claim-outbound-item-${row?.offer_id ?? index}`,
967
+ children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-x-2 gap-y-2 border-b p-3 text-sm md:flex-row", children: [
968
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-1 items-center gap-x-3", children: [
969
+ /* @__PURE__ */ jsx6(Thumbnail, { src: row?.thumbnail ?? void 0 }),
970
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
971
+ /* @__PURE__ */ jsxs3("div", { children: [
972
+ /* @__PURE__ */ jsxs3(Text3, { className: "txt-small", as: "span", weight: "plus", children: [
973
+ productTitle,
974
+ " "
975
+ ] }),
976
+ row?.sku && /* @__PURE__ */ jsxs3("span", { children: [
977
+ "(",
978
+ row.sku,
979
+ ")"
980
+ ] })
981
+ ] }),
982
+ row?.variant_title && /* @__PURE__ */ jsx6(Text3, { as: "div", className: "text-ui-fg-subtle txt-small", children: row.variant_title })
983
+ ] })
984
+ ] }),
985
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-1 justify-between", children: [
986
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-grow items-center gap-2", children: [
987
+ /* @__PURE__ */ jsx6(
988
+ Form.Field,
989
+ {
990
+ control: form.control,
991
+ name: `outbound_items.${index}.quantity`,
992
+ render: ({ field }) => {
993
+ return /* @__PURE__ */ jsxs3(Form.Item, { children: [
994
+ /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
995
+ Input2,
996
+ {
997
+ ...field,
998
+ className: "bg-ui-bg-base txt-small w-[67px] rounded-lg",
999
+ min: 1,
1000
+ type: "number",
1001
+ onBlur: (e) => {
1002
+ const val = e.target.value;
1003
+ const payload = val === "" ? null : Number(val);
1004
+ field.onChange(payload);
1005
+ }
1006
+ }
1007
+ ) }),
1008
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1009
+ ] });
1010
+ }
1011
+ }
1012
+ ),
1013
+ /* @__PURE__ */ jsx6(Text3, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") })
1014
+ ] }),
1015
+ /* @__PURE__ */ jsx6(
1016
+ ActionMenu,
1017
+ {
1018
+ groups: [
1019
+ {
1020
+ actions: [
1021
+ {
1022
+ label: t("actions.remove"),
1023
+ onClick: onRemove,
1024
+ icon: /* @__PURE__ */ jsx6(XCircle2, {})
1025
+ }
1026
+ ]
1027
+ }
1028
+ ]
1029
+ }
1030
+ )
1031
+ ] })
1032
+ ] })
1033
+ }
1034
+ );
1035
+ }
1036
+
1037
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-outbound-section.tsx
1038
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1039
+ var STACKED_MODAL_ID = "claim-add-outbound-items";
1040
+ var ClaimOutboundSection = ({
1041
+ form,
1042
+ currencyCode,
1043
+ disabled
1044
+ }) => {
1045
+ const { t } = useTranslation9();
1046
+ const { setIsOpen } = useStackedModal();
1047
+ const {
1048
+ fields: outboundItems,
1049
+ append,
1050
+ remove
1051
+ } = useFieldArray({
1052
+ name: "outbound_items",
1053
+ control: form.control
1054
+ });
1055
+ const showOutboundItemsPlaceholder = !outboundItems.length;
1056
+ const onItemsSelected = (selectedOfferIds, offerLookup) => {
1057
+ const existing = new Set(outboundItems.map((row) => row.offer_id));
1058
+ selectedOfferIds.filter((id) => !existing.has(id)).forEach((id) => {
1059
+ const offer = offerLookup[id];
1060
+ const variant = offer?.product_variant;
1061
+ append(
1062
+ {
1063
+ offer_id: id,
1064
+ variant_id: offer?.variant_id ?? variant?.id ?? null,
1065
+ product_title: variant?.product?.title ?? null,
1066
+ variant_title: variant?.title ?? null,
1067
+ thumbnail: variant?.product?.thumbnail ?? null,
1068
+ sku: offer?.sku ?? null,
1069
+ quantity: 1
1070
+ },
1071
+ { shouldFocus: false }
1072
+ );
1073
+ });
1074
+ setIsOpen(STACKED_MODAL_ID, false);
1075
+ };
1076
+ return /* @__PURE__ */ jsxs4("div", { children: [
1077
+ /* @__PURE__ */ jsxs4("div", { className: "mt-8 flex items-center justify-between", children: [
1078
+ /* @__PURE__ */ jsx7(Heading, { level: "h2", children: t("orders.claims.outboundItems") }),
1079
+ /* @__PURE__ */ jsxs4(StackedFocusModal, { id: STACKED_MODAL_ID, children: [
1080
+ /* @__PURE__ */ jsx7(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx7(
1081
+ "a",
1082
+ {
1083
+ href: "#",
1084
+ onClick: (e) => e.preventDefault(),
1085
+ className: "focus-visible:shadow-borders-focus transition-fg txt-compact-small-plus cursor-pointer text-blue-500 outline-none hover:text-blue-400",
1086
+ "data-testid": "claim-add-outbound-trigger",
1087
+ children: t("orders.claims.addOutboundItems")
1088
+ }
1089
+ ) }),
1090
+ /* @__PURE__ */ jsxs4(StackedFocusModal.Content, { children: [
1091
+ /* @__PURE__ */ jsx7(StackedFocusModal.Header, {}),
1092
+ /* @__PURE__ */ jsx7(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx7("span", { className: "sr-only", children: t("orders.claims.addOutboundItems") }) }),
1093
+ /* @__PURE__ */ jsx7(StackedFocusModal.Description, { className: "sr-only", children: t("orders.claims.addOutboundItemsDescription") }),
1094
+ /* @__PURE__ */ jsx7(StackedFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsx7(
1095
+ PickerBody,
1096
+ {
1097
+ currencyCode,
1098
+ onSubmit: onItemsSelected
1099
+ }
1100
+ ) })
1101
+ ] })
1102
+ ] })
1103
+ ] }),
1104
+ showOutboundItemsPlaceholder && /* @__PURE__ */ jsx7(ItemPlaceholder, {}),
1105
+ outboundItems.map((item, index) => /* @__PURE__ */ jsx7(
1106
+ ClaimOutboundItem,
1107
+ {
1108
+ form,
1109
+ index,
1110
+ onRemove: () => remove(index)
1111
+ },
1112
+ item.id
1113
+ )),
1114
+ /* @__PURE__ */ jsx7("span", { className: "sr-only", children: disabled ? "" : "" })
1115
+ ] });
1116
+ };
1117
+ var PickerBody = ({
1118
+ currencyCode,
1119
+ onSubmit
1120
+ }) => {
1121
+ const { t } = useTranslation9();
1122
+ let selectedOfferIds = [];
1123
+ let selectedOfferLookup = {};
1124
+ return /* @__PURE__ */ jsxs4("div", { className: "flex h-full flex-col", children: [
1125
+ /* @__PURE__ */ jsx7("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx7(
1126
+ AddClaimOutboundItemsTable,
1127
+ {
1128
+ currencyCode,
1129
+ onSelectionChange: (ids, lookup) => {
1130
+ selectedOfferIds = ids;
1131
+ selectedOfferLookup = lookup;
1132
+ }
1133
+ }
1134
+ ) }),
1135
+ /* @__PURE__ */ jsx7(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-end gap-x-2", children: [
1136
+ /* @__PURE__ */ jsx7(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx7(
1137
+ Button,
1138
+ {
1139
+ type: "button",
1140
+ variant: "secondary",
1141
+ size: "small",
1142
+ "data-testid": "claim-add-outbound-cancel",
1143
+ children: t("actions.cancel")
1144
+ }
1145
+ ) }),
1146
+ /* @__PURE__ */ jsx7(
1147
+ Button,
1148
+ {
1149
+ type: "button",
1150
+ variant: "primary",
1151
+ size: "small",
1152
+ "data-testid": "claim-add-outbound-save",
1153
+ onClick: () => onSubmit(selectedOfferIds, selectedOfferLookup),
1154
+ children: t("actions.save")
1155
+ },
1156
+ "submit-button"
1157
+ )
1158
+ ] }) })
1159
+ ] });
1160
+ };
1161
+
1162
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/schema.ts
1163
+ import { z } from "zod";
1164
+ var ClaimCreateSchema = z.object({
1165
+ inbound_items: z.array(
1166
+ z.object({
1167
+ item_id: z.string(),
1168
+ variant_id: z.string().nullish(),
1169
+ quantity: z.number(),
1170
+ reason_id: z.string().nullish(),
1171
+ note: z.string().nullish()
1172
+ })
1173
+ ),
1174
+ outbound_items: z.array(
1175
+ z.object({
1176
+ offer_id: z.string(),
1177
+ variant_id: z.string().nullish(),
1178
+ product_title: z.string().nullish(),
1179
+ variant_title: z.string().nullish(),
1180
+ thumbnail: z.string().nullish(),
1181
+ sku: z.string().nullish(),
1182
+ quantity: z.number()
1183
+ })
1184
+ ),
1185
+ location_id: z.string().nullish(),
1186
+ inbound_option_id: z.string().nullish(),
1187
+ outbound_option_id: z.string().nullish(),
1188
+ send_notification: z.boolean().optional()
1189
+ });
1190
+
1191
+ // src/pages/orders/[id]/claims/create/_components/claim-create-form/claim-create-form.tsx
1192
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1193
+ var itemsToAdd = [];
1194
+ var itemsToRemove = [];
1195
+ var IS_CANCELING = false;
1196
+ var ClaimCreateForm = ({
1197
+ order,
1198
+ preview,
1199
+ claim,
1200
+ orderReturn
1201
+ }) => {
1202
+ const { t } = useTranslation10();
1203
+ const { handleSuccess } = useRouteModal();
1204
+ const { setIsOpen } = useStackedModal();
1205
+ const [_inventoryMap, setInventoryMap] = useState3({});
1206
+ const { mutateAsync: confirmClaimRequest, isPending: isConfirming } = useClaimConfirmRequest(claim.id, order.id);
1207
+ const { mutateAsync: cancelClaimRequest, isPending: isCanceling } = useCancelClaimRequest(claim.id, order.id);
1208
+ const { mutateAsync: updateReturn, isPending: isUpdating } = useUpdateReturn(
1209
+ preview?.order_change?.return_id ?? "",
1210
+ order.id
1211
+ );
1212
+ const {
1213
+ mutateAsync: addInboundShipping,
1214
+ isPending: isAddingInboundShipping
1215
+ } = useAddClaimInboundShipping(claim.id, order.id);
1216
+ const {
1217
+ mutateAsync: _updateInboundShipping,
1218
+ isPending: isUpdatingInboundShipping
1219
+ } = useUpdateClaimInboundShipping(claim.id, order.id);
1220
+ const {
1221
+ mutateAsync: deleteInboundShipping,
1222
+ isPending: isDeletingInboundShipping
1223
+ } = useDeleteClaimInboundShipping(claim.id, order.id);
1224
+ const { mutateAsync: addInboundItem, isPending: isAddingInboundItem } = useAddClaimInboundItems(claim.id, order.id);
1225
+ const { mutateAsync: updateInboundItem, isPending: isUpdatingInboundItem } = useUpdateClaimInboundItem(claim.id, order.id);
1226
+ const { mutateAsync: removeInboundItem, isPending: isRemovingInboundItem } = useRemoveClaimInboundItem(claim.id, order.id);
1227
+ const isRequestLoading = isConfirming || isCanceling || isAddingInboundShipping || isUpdatingInboundShipping || isDeletingInboundShipping || isAddingInboundItem || isRemovingInboundItem || isUpdatingInboundItem || isUpdating;
1228
+ const previewItems = useMemo5(
1229
+ () => preview?.items?.filter(
1230
+ (i) => !!i.actions?.find((a) => a.claim_id === claim.id)
1231
+ ) ?? [],
1232
+ [preview.items, claim.id]
1233
+ );
1234
+ const inboundPreviewItems = useMemo5(
1235
+ () => previewItems.filter(
1236
+ (item) => !!item.actions?.find((a) => a.action === "RETURN_ITEM")
1237
+ ),
1238
+ [previewItems]
1239
+ );
1240
+ const itemsMap = useMemo5(
1241
+ () => new Map(order?.items?.map((i) => [i.id, i])),
1242
+ [order.items]
1243
+ );
1244
+ const form = useForm({
1245
+ defaultValues: () => {
1246
+ const inboundShippingMethod = preview.shipping_methods?.find((s) => {
1247
+ return !!s.actions?.find(
1248
+ (a) => a.action === "SHIPPING_ADD" && !!a.return_id
1249
+ );
1250
+ });
1251
+ return Promise.resolve({
1252
+ inbound_items: inboundPreviewItems.map((i) => {
1253
+ const inboundAction = i.actions?.find(
1254
+ (a) => a.action === "RETURN_ITEM"
1255
+ );
1256
+ return {
1257
+ item_id: i.id,
1258
+ variant_id: i.variant_id,
1259
+ quantity: i.detail?.return_requested_quantity ?? 1,
1260
+ note: inboundAction?.internal_note,
1261
+ reason_id: inboundAction?.details?.reason_id
1262
+ };
1263
+ }),
1264
+ outbound_items: [],
1265
+ inbound_option_id: inboundShippingMethod ? inboundShippingMethod.shipping_option_id : null,
1266
+ outbound_option_id: null,
1267
+ location_id: orderReturn?.location_id ?? null,
1268
+ send_notification: false
1269
+ });
1270
+ },
1271
+ resolver: zodResolver(ClaimCreateSchema)
1272
+ });
1273
+ const locationId = form.watch("location_id");
1274
+ const { stock_locations: stockLocations = [] } = useStockLocations({
1275
+ limit: 999
1276
+ });
1277
+ const { shipping_options: shippingOptions = [] } = useShippingOptions(
1278
+ locationId ? {
1279
+ limit: 999,
1280
+ fields: "*prices,+service_zone.fulfillment_set.location.id",
1281
+ stock_location_id: locationId
1282
+ } : void 0,
1283
+ { enabled: !!locationId }
1284
+ );
1285
+ const inboundShippingOptions = (shippingOptions ?? []).filter(
1286
+ (so) => !!so.rules?.find(
1287
+ (r) => r.attribute === "is_return" && r.value === "true"
1288
+ )
1289
+ );
1290
+ const {
1291
+ fields: inboundItems,
1292
+ append,
1293
+ remove,
1294
+ update
1295
+ } = useFieldArray2({
1296
+ name: "inbound_items",
1297
+ control: form.control
1298
+ });
1299
+ const previewItemsMap = useMemo5(
1300
+ () => new Map(previewItems.map((i) => [i.id, i])),
1301
+ [previewItems]
1302
+ );
1303
+ useEffect(() => {
1304
+ const existingItemsMap = {};
1305
+ inboundPreviewItems.forEach((i) => {
1306
+ const ind = inboundItems.findIndex((field) => field.item_id === i.id);
1307
+ const requested = i.detail?.return_requested_quantity ?? 0;
1308
+ existingItemsMap[i.id] = true;
1309
+ if (ind > -1) {
1310
+ if (inboundItems[ind].quantity !== requested) {
1311
+ const returnItemAction = i.actions?.find(
1312
+ (a) => a.action === "RETURN_ITEM"
1313
+ );
1314
+ update(ind, {
1315
+ ...inboundItems[ind],
1316
+ quantity: requested,
1317
+ note: returnItemAction?.internal_note,
1318
+ reason_id: returnItemAction?.details?.reason_id
1319
+ });
1320
+ }
1321
+ } else {
1322
+ append(
1323
+ { item_id: i.id, quantity: requested },
1324
+ { shouldFocus: false }
1325
+ );
1326
+ }
1327
+ });
1328
+ inboundItems.forEach((i, ind) => {
1329
+ if (!(i.item_id in existingItemsMap)) {
1330
+ remove(ind);
1331
+ }
1332
+ });
1333
+ }, [previewItems]);
1334
+ useEffect(() => {
1335
+ const inboundShipping = preview.shipping_methods?.find(
1336
+ (s) => !!s.actions?.find((a) => a.action === "SHIPPING_ADD" && !!a.return_id)
1337
+ );
1338
+ if (inboundShipping) {
1339
+ form.setValue("inbound_option_id", inboundShipping.shipping_option_id);
1340
+ } else {
1341
+ form.setValue("inbound_option_id", null);
1342
+ }
1343
+ }, [preview.shipping_methods]);
1344
+ useEffect(() => {
1345
+ form.setValue("location_id", orderReturn?.location_id ?? null);
1346
+ }, [orderReturn]);
1347
+ const showInboundItemsPlaceholder = !inboundPreviewItems.length;
1348
+ const prompt = usePrompt();
1349
+ const handleSubmit = form.handleSubmit(async (data) => {
1350
+ const res = await prompt({
1351
+ title: t("general.areYouSure"),
1352
+ description: t("orders.claims.confirmText"),
1353
+ confirmText: t("actions.continue"),
1354
+ cancelText: t("actions.cancel"),
1355
+ variant: "confirmation"
1356
+ });
1357
+ if (!res) {
1358
+ return;
1359
+ }
1360
+ await confirmClaimRequest(
1361
+ { no_notification: !data.send_notification },
1362
+ {
1363
+ onSuccess: () => {
1364
+ toast.success(t("orders.claims.toast.confirmedSuccessfully"));
1365
+ handleSuccess();
1366
+ },
1367
+ onError: (error) => {
1368
+ toast.error(error.message);
1369
+ }
1370
+ }
1371
+ );
1372
+ });
1373
+ const onItemsSelected = async () => {
1374
+ if (itemsToAdd.length) {
1375
+ await addInboundItem(
1376
+ {
1377
+ items: itemsToAdd.map((id) => ({
1378
+ id,
1379
+ quantity: 1
1380
+ }))
1381
+ },
1382
+ {
1383
+ onError: (error) => {
1384
+ toast.error(error.message);
1385
+ }
1386
+ }
1387
+ );
1388
+ }
1389
+ for (const itemToRemove of itemsToRemove) {
1390
+ const actionId = previewItems.find((i) => i.id === itemToRemove)?.actions?.find((a) => a.action === "RETURN_ITEM")?.id;
1391
+ if (actionId) {
1392
+ await removeInboundItem(actionId, {
1393
+ onError: (error) => {
1394
+ toast.error(error.message);
1395
+ }
1396
+ });
1397
+ }
1398
+ }
1399
+ setIsOpen("inbound-items", false);
1400
+ };
1401
+ const onLocationChange = async (selectedLocationId) => {
1402
+ if (!preview?.order_change?.return_id) return;
1403
+ await updateReturn({ location_id: selectedLocationId ?? null });
1404
+ };
1405
+ const onShippingOptionChange = async (selectedOptionId) => {
1406
+ const inboundShippingMethods = (preview.shipping_methods ?? []).filter(
1407
+ (s) => {
1408
+ const action = s.actions?.find(
1409
+ (a) => a.action === "SHIPPING_ADD" && !!a.return_id
1410
+ );
1411
+ return action && !!action?.return_id;
1412
+ }
1413
+ );
1414
+ const promises = inboundShippingMethods.filter(Boolean).map((inboundShippingMethod) => {
1415
+ const action = inboundShippingMethod.actions?.find(
1416
+ (a) => a.action === "SHIPPING_ADD" && !!a.return_id
1417
+ );
1418
+ if (action) {
1419
+ return deleteInboundShipping(action.id);
1420
+ }
1421
+ return Promise.resolve();
1422
+ });
1423
+ await Promise.all(promises);
1424
+ if (selectedOptionId) {
1425
+ await addInboundShipping(
1426
+ { shipping_option_id: selectedOptionId },
1427
+ {
1428
+ onError: (error) => {
1429
+ toast.error(error.message);
1430
+ }
1431
+ }
1432
+ );
1433
+ }
1434
+ };
1435
+ useEffect(() => {
1436
+ return () => {
1437
+ if (IS_CANCELING) {
1438
+ cancelClaimRequest(void 0, {
1439
+ onSuccess: () => {
1440
+ toast.success(t("orders.claims.toast.canceledSuccessfully"));
1441
+ },
1442
+ onError: (error) => {
1443
+ toast.error(error.message);
1444
+ }
1445
+ });
1446
+ IS_CANCELING = false;
1447
+ }
1448
+ };
1449
+ }, []);
1450
+ useEffect(() => {
1451
+ setInventoryMap({});
1452
+ }, [inboundItems.length]);
1453
+ const estimatedDifference = (preview.summary?.pending_difference ?? 0) - inboundPreviewItems.reduce(
1454
+ (acc, item) => acc + (item.total ?? 0),
1455
+ 0
1456
+ );
1457
+ const currencyCode = order.currency_code;
1458
+ return /* @__PURE__ */ jsx8(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs5(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
1459
+ /* @__PURE__ */ jsx8(RouteFocusModal.Header, {}),
1460
+ /* @__PURE__ */ jsx8(RouteFocusModal.Body, { className: "flex size-full justify-center overflow-y-auto", children: /* @__PURE__ */ jsxs5("div", { className: "mt-16 w-[720px] max-w-[100%] px-4 md:p-0", children: [
1461
+ /* @__PURE__ */ jsx8(Heading2, { level: "h1", children: t("orders.claims.create") }),
1462
+ /* @__PURE__ */ jsxs5("div", { className: "mt-8 flex items-center justify-between", children: [
1463
+ /* @__PURE__ */ jsx8(Heading2, { level: "h2", children: t("orders.returns.inbound") }),
1464
+ /* @__PURE__ */ jsxs5(StackedFocusModal, { id: "inbound-items", children: [
1465
+ /* @__PURE__ */ jsx8(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx8(
1466
+ "a",
1467
+ {
1468
+ href: "#",
1469
+ onClick: (e) => e.preventDefault(),
1470
+ className: "focus-visible:shadow-borders-focus transition-fg txt-compact-small-plus cursor-pointer text-blue-500 outline-none hover:text-blue-400",
1471
+ children: t("actions.addItems")
1472
+ }
1473
+ ) }),
1474
+ /* @__PURE__ */ jsxs5(StackedFocusModal.Content, { children: [
1475
+ /* @__PURE__ */ jsx8(StackedFocusModal.Header, {}),
1476
+ /* @__PURE__ */ jsx8(
1477
+ AddClaimItemsTable,
1478
+ {
1479
+ items: order.items,
1480
+ selectedItems: inboundItems.map((i) => i.item_id),
1481
+ currencyCode,
1482
+ onSelectionChange: (finalSelection) => {
1483
+ const alreadySelected = inboundItems.map(
1484
+ (i) => i.item_id
1485
+ );
1486
+ itemsToAdd = finalSelection.filter(
1487
+ (selection) => !alreadySelected.includes(selection)
1488
+ );
1489
+ itemsToRemove = alreadySelected.filter(
1490
+ (selection) => !finalSelection.includes(selection)
1491
+ );
1492
+ }
1493
+ }
1494
+ ),
1495
+ /* @__PURE__ */ jsx8(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsx8("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-end gap-x-2", children: [
1496
+ /* @__PURE__ */ jsx8(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx8(
1497
+ Button2,
1498
+ {
1499
+ type: "button",
1500
+ variant: "secondary",
1501
+ size: "small",
1502
+ children: t("actions.cancel")
1503
+ }
1504
+ ) }),
1505
+ /* @__PURE__ */ jsx8(
1506
+ Button2,
1507
+ {
1508
+ type: "submit",
1509
+ variant: "primary",
1510
+ size: "small",
1511
+ onClick: async () => await onItemsSelected(),
1512
+ children: t("actions.save")
1513
+ },
1514
+ "submit-button"
1515
+ )
1516
+ ] }) }) })
1517
+ ] })
1518
+ ] })
1519
+ ] }),
1520
+ showInboundItemsPlaceholder && /* @__PURE__ */ jsx8(ItemPlaceholder, {}),
1521
+ inboundItems.map(
1522
+ (item, index) => previewItemsMap.get(item.item_id) && itemsMap.get(item.item_id) && /* @__PURE__ */ jsx8(
1523
+ ClaimInboundItem,
1524
+ {
1525
+ item: itemsMap.get(item.item_id),
1526
+ previewItem: previewItemsMap.get(item.item_id),
1527
+ currencyCode,
1528
+ form,
1529
+ onRemove: () => {
1530
+ const actionId = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM")?.id;
1531
+ if (actionId) {
1532
+ removeInboundItem(actionId, {
1533
+ onError: (error) => {
1534
+ toast.error(error.message);
1535
+ }
1536
+ });
1537
+ }
1538
+ },
1539
+ onUpdate: (payload) => {
1540
+ const action = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM");
1541
+ if (action) {
1542
+ updateInboundItem(
1543
+ { ...payload, actionId: action.id },
1544
+ {
1545
+ onError: (error) => {
1546
+ if (action.details?.quantity && payload.quantity) {
1547
+ form.setValue(
1548
+ `inbound_items.${index}.quantity`,
1549
+ action.details?.quantity
1550
+ );
1551
+ }
1552
+ toast.error(error.message);
1553
+ }
1554
+ }
1555
+ );
1556
+ }
1557
+ },
1558
+ index
1559
+ },
1560
+ item.id
1561
+ )
1562
+ ),
1563
+ !showInboundItemsPlaceholder && /* @__PURE__ */ jsxs5("div", { className: "mt-8 flex flex-col gap-y-4", children: [
1564
+ /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", children: [
1565
+ /* @__PURE__ */ jsxs5("div", { children: [
1566
+ /* @__PURE__ */ jsx8(Form.Label, { children: t("orders.returns.location") }),
1567
+ /* @__PURE__ */ jsx8(Form.Hint, { className: "!mt-1", children: t("orders.returns.locationHint") })
1568
+ ] }),
1569
+ /* @__PURE__ */ jsx8(
1570
+ Form.Field,
1571
+ {
1572
+ control: form.control,
1573
+ name: "location_id",
1574
+ render: ({ field: { value, onChange, ...field } }) => {
1575
+ return /* @__PURE__ */ jsx8(Form.Item, { children: /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1576
+ Combobox,
1577
+ {
1578
+ ...field,
1579
+ value: value ?? void 0,
1580
+ onChange: (v) => {
1581
+ onChange(v);
1582
+ onLocationChange(v);
1583
+ },
1584
+ options: (stockLocations ?? []).map(
1585
+ (stockLocation) => ({
1586
+ label: stockLocation.name,
1587
+ value: stockLocation.id
1588
+ })
1589
+ )
1590
+ }
1591
+ ) }) });
1592
+ }
1593
+ }
1594
+ )
1595
+ ] }),
1596
+ /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", children: [
1597
+ /* @__PURE__ */ jsxs5("div", { children: [
1598
+ /* @__PURE__ */ jsxs5(Form.Label, { children: [
1599
+ t("orders.returns.inboundShipping"),
1600
+ /* @__PURE__ */ jsxs5(
1601
+ Text4,
1602
+ {
1603
+ size: "small",
1604
+ leading: "compact",
1605
+ className: "text-ui-fg-muted ml-1 inline",
1606
+ children: [
1607
+ "(",
1608
+ t("fields.optional"),
1609
+ ")"
1610
+ ]
1611
+ }
1612
+ )
1613
+ ] }),
1614
+ /* @__PURE__ */ jsx8(Form.Hint, { className: "!mt-1", children: t("orders.returns.inboundShippingHint") })
1615
+ ] }),
1616
+ /* @__PURE__ */ jsx8(
1617
+ Form.Field,
1618
+ {
1619
+ control: form.control,
1620
+ name: "inbound_option_id",
1621
+ render: ({ field: { value, onChange, ...field } }) => {
1622
+ return /* @__PURE__ */ jsx8(Form.Item, { children: /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1623
+ Combobox,
1624
+ {
1625
+ allowClear: true,
1626
+ value: value ?? void 0,
1627
+ onChange: (val) => {
1628
+ onChange(val);
1629
+ onShippingOptionChange(val);
1630
+ },
1631
+ ...field,
1632
+ options: inboundShippingOptions.map(
1633
+ (so) => ({
1634
+ label: so.name,
1635
+ value: so.id
1636
+ })
1637
+ ),
1638
+ disabled: !locationId,
1639
+ noResultsPlaceholder: /* @__PURE__ */ jsx8(ReturnShippingPlaceholder, {})
1640
+ }
1641
+ ) }) });
1642
+ }
1643
+ }
1644
+ )
1645
+ ] })
1646
+ ] }),
1647
+ /* @__PURE__ */ jsx8(
1648
+ ClaimOutboundSection,
1649
+ {
1650
+ form,
1651
+ currencyCode,
1652
+ disabled: isRequestLoading
1653
+ }
1654
+ ),
1655
+ /* @__PURE__ */ jsxs5("div", { className: "mt-8 border-y border-dotted py-4", children: [
1656
+ /* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-center justify-between", children: [
1657
+ /* @__PURE__ */ jsx8("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.inboundTotal") }),
1658
+ /* @__PURE__ */ jsx8("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(
1659
+ inboundPreviewItems.reduce((acc, item) => {
1660
+ const action = item.actions?.find(
1661
+ (act) => act.action === "RETURN_ITEM"
1662
+ );
1663
+ return acc + Number(action?.amount || 0);
1664
+ }, 0) * -1,
1665
+ currencyCode
1666
+ ) })
1667
+ ] }),
1668
+ /* @__PURE__ */ jsxs5("div", { className: "mt-4 flex items-center justify-between border-t border-dotted pt-4", children: [
1669
+ /* @__PURE__ */ jsx8("span", { className: "txt-small font-medium", children: t("orders.claims.refundAmount") }),
1670
+ /* @__PURE__ */ jsx8("span", { className: "txt-small font-medium", children: getStylizedAmount(estimatedDifference, currencyCode) })
1671
+ ] })
1672
+ ] }),
1673
+ /* @__PURE__ */ jsx8("div", { className: "bg-ui-bg-field mt-8 rounded-lg border py-2 pl-2 pr-4", children: /* @__PURE__ */ jsx8(
1674
+ Form.Field,
1675
+ {
1676
+ control: form.control,
1677
+ name: "send_notification",
1678
+ render: ({ field: { onChange, value, ...field } }) => {
1679
+ return /* @__PURE__ */ jsxs5(Form.Item, { children: [
1680
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center", children: [
1681
+ /* @__PURE__ */ jsx8(Form.Control, { className: "mr-4 self-start", children: /* @__PURE__ */ jsx8(
1682
+ Switch,
1683
+ {
1684
+ dir: "ltr",
1685
+ className: "mt-[2px] rtl:rotate-180",
1686
+ checked: !!value,
1687
+ onCheckedChange: onChange,
1688
+ ...field
1689
+ }
1690
+ ) }),
1691
+ /* @__PURE__ */ jsxs5("div", { className: "block", children: [
1692
+ /* @__PURE__ */ jsx8(Form.Label, { children: t("orders.returns.sendNotification") }),
1693
+ /* @__PURE__ */ jsx8(Form.Hint, { className: "!mt-1", children: t("orders.returns.sendNotificationHint") })
1694
+ ] })
1695
+ ] }),
1696
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1697
+ ] });
1698
+ }
1699
+ }
1700
+ ) }),
1701
+ /* @__PURE__ */ jsx8("div", { className: "p-8" })
1702
+ ] }) }),
1703
+ /* @__PURE__ */ jsx8(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx8("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-end gap-x-2", children: [
1704
+ /* @__PURE__ */ jsx8(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx8(
1705
+ Button2,
1706
+ {
1707
+ type: "button",
1708
+ onClick: () => IS_CANCELING = true,
1709
+ variant: "secondary",
1710
+ size: "small",
1711
+ children: t("orders.claims.cancel.title")
1712
+ }
1713
+ ) }),
1714
+ /* @__PURE__ */ jsx8(
1715
+ Button2,
1716
+ {
1717
+ type: "submit",
1718
+ variant: "primary",
1719
+ size: "small",
1720
+ isLoading: isRequestLoading,
1721
+ children: t("orders.claims.confirm")
1722
+ },
1723
+ "submit-button"
1724
+ )
1725
+ ] }) }) })
1726
+ ] }) });
1727
+ };
1728
+
1729
+ // src/pages/orders/[id]/claims/create/index.tsx
1730
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1731
+ var IS_REQUEST_RUNNING = false;
1732
+ var Component = () => {
1733
+ const { id } = useParams();
1734
+ const navigate = useNavigate();
1735
+ const { t } = useTranslation11();
1736
+ const { order } = useOrder(id, {
1737
+ fields: DEFAULT_FIELDS
1738
+ });
1739
+ const { order: preview } = useOrderPreview(id);
1740
+ const [activeClaimId, setActiveClaimId] = useState4();
1741
+ const { mutateAsync: createClaim } = useCreateClaim(order?.id ?? "");
1742
+ const { claim } = useClaim(activeClaimId, void 0, {
1743
+ enabled: !!activeClaimId
1744
+ });
1745
+ const { return: orderReturn } = useReturn(claim?.return_id, void 0, {
1746
+ enabled: !!claim?.return_id
1747
+ });
1748
+ useEffect2(() => {
1749
+ async function run() {
1750
+ if (IS_REQUEST_RUNNING || !preview) {
1751
+ return;
1752
+ }
1753
+ if (preview.order_change) {
1754
+ if (preview.order_change.change_type === "claim") {
1755
+ setActiveClaimId(preview.order_change.claim_id);
1756
+ } else {
1757
+ navigate(`/orders/${preview.id}`, { replace: true });
1758
+ toast2.error(t("orders.claims.activeChangeError"));
1759
+ }
1760
+ return;
1761
+ }
1762
+ IS_REQUEST_RUNNING = true;
1763
+ try {
1764
+ const { claim: createdClaim } = await createClaim({
1765
+ order_id: preview.id,
1766
+ type: "replace"
1767
+ });
1768
+ setActiveClaimId(createdClaim.id);
1769
+ } catch (e) {
1770
+ toast2.error(
1771
+ e instanceof Error ? e.message : t("errorBoundary.defaultTitle")
1772
+ );
1773
+ navigate(`/orders/${preview.id}`, { replace: true });
1774
+ } finally {
1775
+ IS_REQUEST_RUNNING = false;
1776
+ }
1777
+ }
1778
+ run();
1779
+ }, [preview]);
1780
+ return /* @__PURE__ */ jsxs6(RouteFocusModal, { children: [
1781
+ /* @__PURE__ */ jsx9(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx9("span", { className: "sr-only", children: t("orders.claims.title") }) }),
1782
+ /* @__PURE__ */ jsx9(RouteFocusModal.Description, { className: "sr-only", children: t("orders.claims.title") }),
1783
+ claim && preview && order && /* @__PURE__ */ jsx9(
1784
+ ClaimCreateForm,
1785
+ {
1786
+ order,
1787
+ claim,
1788
+ preview,
1789
+ orderReturn
1790
+ }
1791
+ )
1792
+ ] });
1793
+ };
1794
+ var create_default = Component;
1795
+ export {
1796
+ Component,
1797
+ create_default as default
1798
+ };