@mercurjs/admin 2.0.0-canary.24

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 (358) hide show
  1. package/dist/add-campaign-promotions-JDC36EOE.js +265 -0
  2. package/dist/adjust-inventory-2YLC4O4I.js +262 -0
  3. package/dist/api-key-management-create-KERROZ6Z.js +282 -0
  4. package/dist/api-key-management-detail-PXY2ZH4V.js +481 -0
  5. package/dist/api-key-management-edit-7IPPTW37.js +106 -0
  6. package/dist/api-key-management-list-QQHOCVV4.js +350 -0
  7. package/dist/api-key-management-sales-channels-AO6SRCAW.js +201 -0
  8. package/dist/campaign-budget-edit-C5PCVES3.js +147 -0
  9. package/dist/campaign-configuration-ONC2CL7Q.js +154 -0
  10. package/dist/campaign-create-J2PN77A6.js +29 -0
  11. package/dist/campaign-detail-2XJ7PXOQ.js +666 -0
  12. package/dist/campaign-edit-MU4TVOEC.js +206 -0
  13. package/dist/campaign-list-BWYHTJL2.js +187 -0
  14. package/dist/categories-metadata-UC3N6YSC.js +83 -0
  15. package/dist/category-create-DRJZI3EM.js +427 -0
  16. package/dist/category-detail-DEGYVUXB.js +544 -0
  17. package/dist/category-edit-PTYOK7VV.js +220 -0
  18. package/dist/category-list-T4GPTLOA.js +286 -0
  19. package/dist/category-organize-MLBY54BT.js +110 -0
  20. package/dist/category-products-W7U2VZTZ.js +281 -0
  21. package/dist/chunk-25LYVP3C.js +37 -0
  22. package/dist/chunk-26OOAKQ6.js +18 -0
  23. package/dist/chunk-2I3BDP2Z.js +61 -0
  24. package/dist/chunk-2KCF3ZIB.js +32 -0
  25. package/dist/chunk-2MKZ4HD4.js +175 -0
  26. package/dist/chunk-2PZGY332.js +88 -0
  27. package/dist/chunk-2QKPRGNK.js +107 -0
  28. package/dist/chunk-2Y3WMGN6.js +39 -0
  29. package/dist/chunk-2ZFELO2L.js +13 -0
  30. package/dist/chunk-33XUAKRP.js +6 -0
  31. package/dist/chunk-362QMJZM.js +77 -0
  32. package/dist/chunk-3CKTAFTR.js +143 -0
  33. package/dist/chunk-3EF54XFY.js +64 -0
  34. package/dist/chunk-3KOTDGC2.js +18 -0
  35. package/dist/chunk-3LDJURK5.js +296 -0
  36. package/dist/chunk-3QSRE5LS.js +161 -0
  37. package/dist/chunk-3XPXUIK3.js +34 -0
  38. package/dist/chunk-4F5GP7J7.js +45 -0
  39. package/dist/chunk-4GPAS5GW.js +36 -0
  40. package/dist/chunk-54EPH67T.js +34 -0
  41. package/dist/chunk-54RTJBYO.js +153 -0
  42. package/dist/chunk-54TMLQH3.js +9 -0
  43. package/dist/chunk-5LZ2G4ZX.js +422 -0
  44. package/dist/chunk-5S6J5PG5.js +182 -0
  45. package/dist/chunk-6IJMSVC6.js +16 -0
  46. package/dist/chunk-6KI3GDYH.js +46 -0
  47. package/dist/chunk-7AV5EJJ5.js +29 -0
  48. package/dist/chunk-7RPRNVBS.js +45 -0
  49. package/dist/chunk-7SVLKK6Q.js +31 -0
  50. package/dist/chunk-AW77UWCZ.js +363 -0
  51. package/dist/chunk-AWZFIP25.js +117 -0
  52. package/dist/chunk-AYVH6Q5O.js +31 -0
  53. package/dist/chunk-BDGZ4EQO.js +86 -0
  54. package/dist/chunk-BMNW3AEU.js +373 -0
  55. package/dist/chunk-BRUOBAPY.js +234 -0
  56. package/dist/chunk-BYZIWSBB.js +185 -0
  57. package/dist/chunk-C6SUTRP2.js +13 -0
  58. package/dist/chunk-CBRSGM3X.js +342 -0
  59. package/dist/chunk-CI5Z6FGV.js +87 -0
  60. package/dist/chunk-CMHI2RPL.js +20 -0
  61. package/dist/chunk-CP5IL4P6.js +98 -0
  62. package/dist/chunk-D3KDXELJ.js +110 -0
  63. package/dist/chunk-D6IERBVW.js +43 -0
  64. package/dist/chunk-DB6ANJBO.js +35 -0
  65. package/dist/chunk-DLKKSPFE.js +50 -0
  66. package/dist/chunk-DV73MHTN.js +457 -0
  67. package/dist/chunk-DXZOR4AG.js +69 -0
  68. package/dist/chunk-DY3XQPHC.js +31 -0
  69. package/dist/chunk-EOZUAYQL.js +6 -0
  70. package/dist/chunk-ERTSYQAI.js +121 -0
  71. package/dist/chunk-EZIB4NST.js +94 -0
  72. package/dist/chunk-FGZCSG7T.js +232 -0
  73. package/dist/chunk-FI474ADU.js +0 -0
  74. package/dist/chunk-FLCYR7E5.js +467 -0
  75. package/dist/chunk-FMFVTERD.js +0 -0
  76. package/dist/chunk-FODCCP6C.js +76 -0
  77. package/dist/chunk-FQERBIVS.js +0 -0
  78. package/dist/chunk-FWPGOIFA.js +22 -0
  79. package/dist/chunk-G5OVX555.js +26 -0
  80. package/dist/chunk-GUIDZSDY.js +41 -0
  81. package/dist/chunk-H22XDSXD.js +47 -0
  82. package/dist/chunk-HC25LNX7.js +45 -0
  83. package/dist/chunk-HINXQTCW.js +97 -0
  84. package/dist/chunk-HYUGYB23.js +161 -0
  85. package/dist/chunk-I43SCBL3.js +106 -0
  86. package/dist/chunk-IGTRIAUC.js +84 -0
  87. package/dist/chunk-INNFZYX2.js +183 -0
  88. package/dist/chunk-IQPN4PZJ.js +749 -0
  89. package/dist/chunk-IZ5RG5XI.js +72 -0
  90. package/dist/chunk-JDGE23BZ.js +332 -0
  91. package/dist/chunk-JHIMVLB2.js +42 -0
  92. package/dist/chunk-JISYRXUS.js +389 -0
  93. package/dist/chunk-JJVGCTKT.js +243 -0
  94. package/dist/chunk-JQV7CXEC.js +37 -0
  95. package/dist/chunk-JRTZWK77.js +1764 -0
  96. package/dist/chunk-KAZ5BYTQ.js +132 -0
  97. package/dist/chunk-KBYZLKI4.js +1093 -0
  98. package/dist/chunk-KTKL7M34.js +90 -0
  99. package/dist/chunk-KUWNYCGL.js +4113 -0
  100. package/dist/chunk-KW56S7WF.js +67 -0
  101. package/dist/chunk-LAVHRER2.js +17 -0
  102. package/dist/chunk-LCZXAT4Q.js +58 -0
  103. package/dist/chunk-LFKTHNWI.js +83 -0
  104. package/dist/chunk-LGJWR5LX.js +164 -0
  105. package/dist/chunk-LLWK3OR6.js +169 -0
  106. package/dist/chunk-LQSLDDPT.js +67 -0
  107. package/dist/chunk-LR4ACD6E.js +86676 -0
  108. package/dist/chunk-LTBX54CI.js +11 -0
  109. package/dist/chunk-LXP7K6HL.js +817 -0
  110. package/dist/chunk-LXSBG6LK.js +18 -0
  111. package/dist/chunk-LZALOVO3.js +372 -0
  112. package/dist/chunk-M6SOYQJ6.js +39 -0
  113. package/dist/chunk-MAEP2UCK.js +110 -0
  114. package/dist/chunk-MG4GKUJW.js +31 -0
  115. package/dist/chunk-MWOKFNRO.js +446 -0
  116. package/dist/chunk-N2TQXB44.js +1280 -0
  117. package/dist/chunk-N5IUYCUZ.js +31 -0
  118. package/dist/chunk-NBMM2TZK.js +33 -0
  119. package/dist/chunk-NCMUZ6BQ.js +0 -0
  120. package/dist/chunk-NCYTM57J.js +160 -0
  121. package/dist/chunk-NIRWGTM3.js +1104 -0
  122. package/dist/chunk-NS5CHWOH.js +80 -0
  123. package/dist/chunk-NWQRHWE5.js +9461 -0
  124. package/dist/chunk-NXDFDEKP.js +0 -0
  125. package/dist/chunk-NZJGUN67.js +266 -0
  126. package/dist/chunk-NZN7PFPB.js +169 -0
  127. package/dist/chunk-O5HZRJPB.js +55 -0
  128. package/dist/chunk-O5VKW5FL.js +41 -0
  129. package/dist/chunk-O67KME6D.js +110 -0
  130. package/dist/chunk-ODBDAABQ.js +88 -0
  131. package/dist/chunk-OGYWOPHZ.js +96 -0
  132. package/dist/chunk-ORW4HNX5.js +357 -0
  133. package/dist/chunk-P3IZB24Y.js +109 -0
  134. package/dist/chunk-PHOCVOZ5.js +9 -0
  135. package/dist/chunk-PVZBDWLK.js +41 -0
  136. package/dist/chunk-PX675AEP.js +129 -0
  137. package/dist/chunk-PXYDR7WQ.js +48 -0
  138. package/dist/chunk-QDPLZDMX.js +17 -0
  139. package/dist/chunk-QG6PLWNH.js +106 -0
  140. package/dist/chunk-QSGR43JM.js +30 -0
  141. package/dist/chunk-RK5N3XIX.js +56 -0
  142. package/dist/chunk-RLMLYJDI.js +38 -0
  143. package/dist/chunk-RMXYSYK4.js +50 -0
  144. package/dist/chunk-RPIJY6TT.js +637 -0
  145. package/dist/chunk-RSBZREKG.js +144 -0
  146. package/dist/chunk-RXM4B6HR.js +8 -0
  147. package/dist/chunk-S2WEYEQR.js +14 -0
  148. package/dist/chunk-S4SVK5DE.js +39 -0
  149. package/dist/chunk-S6LPCNXQ.js +29 -0
  150. package/dist/chunk-SMQT3ZNO.js +8 -0
  151. package/dist/chunk-T435NFHC.js +490 -0
  152. package/dist/chunk-THHRRYRS.js +16 -0
  153. package/dist/chunk-TKGWSUEI.js +0 -0
  154. package/dist/chunk-TLE6YHGH.js +26 -0
  155. package/dist/chunk-TN4TIT7O.js +116 -0
  156. package/dist/chunk-TUJIAA5O.js +101 -0
  157. package/dist/chunk-U2EI2ZLM.js +32 -0
  158. package/dist/chunk-U2L77ZDR.js +17 -0
  159. package/dist/chunk-U2UCL2VG.js +369 -0
  160. package/dist/chunk-U2ZFCAPX.js +34 -0
  161. package/dist/chunk-U5MJIHLY.js +87 -0
  162. package/dist/chunk-U62GYN4A.js +227 -0
  163. package/dist/chunk-UM7ZR3VU.js +14 -0
  164. package/dist/chunk-UQITHKTH.js +342 -0
  165. package/dist/chunk-UZJ2NQSN.js +257 -0
  166. package/dist/chunk-UZWFZMOX.js +40 -0
  167. package/dist/chunk-V74Y5NIV.js +49 -0
  168. package/dist/chunk-VBMMWVB5.js +49 -0
  169. package/dist/chunk-VKOE5J66.js +31 -0
  170. package/dist/chunk-VOHEQ7B5.js +31 -0
  171. package/dist/chunk-VVTSF42Z.js +52 -0
  172. package/dist/chunk-VW56KWO2.js +9 -0
  173. package/dist/chunk-VWGKHDZ6.js +528 -0
  174. package/dist/chunk-W6Y3PPU5.js +73 -0
  175. package/dist/chunk-WCEMRNW4.js +6 -0
  176. package/dist/chunk-WDZFLCSQ.js +77 -0
  177. package/dist/chunk-WIYFXWRI.js +30 -0
  178. package/dist/chunk-WMA3WTCM.js +117 -0
  179. package/dist/chunk-WWANSDFM.js +175 -0
  180. package/dist/chunk-XBMLI2YI.js +85 -0
  181. package/dist/chunk-XBVIP2BA.js +609 -0
  182. package/dist/chunk-XCMR2HTV.js +102 -0
  183. package/dist/chunk-XFR5JLNF.js +44 -0
  184. package/dist/chunk-XL52SYWY.js +23 -0
  185. package/dist/chunk-XQNVC4Q7.js +212 -0
  186. package/dist/chunk-XSX255FK.js +12 -0
  187. package/dist/chunk-Y2M536WR.js +67 -0
  188. package/dist/chunk-Y456KVIN.js +116 -0
  189. package/dist/chunk-Y7QKP6QU.js +35 -0
  190. package/dist/chunk-YBZWO4ZV.js +57 -0
  191. package/dist/chunk-YGQUBTKR.js +81 -0
  192. package/dist/chunk-YGSM5PVN.js +170 -0
  193. package/dist/chunk-YVCBMOJG.js +50 -0
  194. package/dist/chunk-YWWUOGJA.js +62 -0
  195. package/dist/chunk-YXFG3M2D.js +792 -0
  196. package/dist/chunk-ZAUMHCIL.js +42 -0
  197. package/dist/chunk-ZDJWCSZ4.js +85 -0
  198. package/dist/chunk-ZQZHFMD7.js +19 -0
  199. package/dist/chunk-ZYNBKBY3.js +14 -0
  200. package/dist/collection-add-products-IUDEIUM5.js +284 -0
  201. package/dist/collection-create-AQ3GUG3G.js +133 -0
  202. package/dist/collection-detail-SDFALX6M.js +444 -0
  203. package/dist/collection-edit-AAHL2WFH.js +121 -0
  204. package/dist/collection-list-JGKC5EVM.js +228 -0
  205. package/dist/collection-metadata-YQWA2JTU.js +80 -0
  206. package/dist/customer-create-5VT2TB6S.js +183 -0
  207. package/dist/customer-create-address-ICEFEFD2.js +299 -0
  208. package/dist/customer-detail-CDELSJ77.js +695 -0
  209. package/dist/customer-edit-DZAD53JC.js +192 -0
  210. package/dist/customer-list-EIQP23FQ.js +152 -0
  211. package/dist/customer-metadata-ATAORBRN.js +81 -0
  212. package/dist/customers-add-customer-group-542PUCCT.js +308 -0
  213. package/dist/edit-inventory-item-P2HVULPA.js +152 -0
  214. package/dist/edit-inventory-item-attributes-V2HK3WTQ.js +323 -0
  215. package/dist/edit-reservation-LX2Z6KVD.js +246 -0
  216. package/dist/edit-rules-Q5UNWAUD.js +316 -0
  217. package/dist/home-I3OILW5Z.js +16 -0
  218. package/dist/index.css +6 -0
  219. package/dist/index.d.ts +41 -0
  220. package/dist/index.js +4824 -0
  221. package/dist/inventory-create-FT7GL4RK.js +616 -0
  222. package/dist/inventory-detail-LNZ5QC67.js +771 -0
  223. package/dist/inventory-list-UXY7PU3N.js +432 -0
  224. package/dist/inventory-metadata-OYETRH5X.js +83 -0
  225. package/dist/inventory-stock-3MBERL3K.js +288 -0
  226. package/dist/invite-HJ7BRO6H.js +372 -0
  227. package/dist/location-create-ZVVQT2KP.js +238 -0
  228. package/dist/location-detail-A5SHPUQN.js +823 -0
  229. package/dist/location-edit-QSRHHDQ2.js +253 -0
  230. package/dist/location-fulfillment-providers-4HMT5L7L.js +289 -0
  231. package/dist/location-list-TC5FEN5R.js +346 -0
  232. package/dist/location-sales-channels-STDHWQSC.js +215 -0
  233. package/dist/location-service-zone-create-63LUYCJI.js +173 -0
  234. package/dist/location-service-zone-edit-UNXI5BQV.js +134 -0
  235. package/dist/location-service-zone-manage-areas-UMD6CZDZ.js +154 -0
  236. package/dist/location-service-zone-shipping-option-create-5L73SAGE.js +807 -0
  237. package/dist/location-service-zone-shipping-option-edit-2FEWQD6Y.js +362 -0
  238. package/dist/location-service-zone-shipping-option-pricing-QSB56QZD.js +362 -0
  239. package/dist/login-V4HZQTCQ.js +254 -0
  240. package/dist/manage-locations-NVHONEZE.js +249 -0
  241. package/dist/no-match-JLVLPCRH.js +33 -0
  242. package/dist/order-allocate-items-F7CXZQGX.js +558 -0
  243. package/dist/order-create-claim-GDVWGZJA.js +2203 -0
  244. package/dist/order-create-edit-6YYKYT66.js +936 -0
  245. package/dist/order-create-exchange-NLDIMGBG.js +2190 -0
  246. package/dist/order-create-fulfillment-EIYGSKXP.js +621 -0
  247. package/dist/order-create-refund-BBXEZNWA.js +403 -0
  248. package/dist/order-create-return-6TA5J3AW.js +1292 -0
  249. package/dist/order-create-shipment-T4C6UE2K.js +208 -0
  250. package/dist/order-detail-Y4EG3P5F.js +3846 -0
  251. package/dist/order-edit-billing-address-NNIFUC5C.js +400 -0
  252. package/dist/order-edit-email-VXOX62P6.js +171 -0
  253. package/dist/order-edit-shipping-address-WDKCQRRG.js +397 -0
  254. package/dist/order-list-XDOAXZXN.js +231 -0
  255. package/dist/order-metadata-S6N3GDOA.js +82 -0
  256. package/dist/order-receive-return-5VWUPWZJ.js +549 -0
  257. package/dist/order-request-transfer-VFSY5IFF.js +571 -0
  258. package/dist/price-list-configuration-GH67LL2N.js +356 -0
  259. package/dist/price-list-create-INX5HG7G.js +973 -0
  260. package/dist/price-list-detail-5LGPE67O.js +540 -0
  261. package/dist/price-list-edit-HRWPEIZI.js +227 -0
  262. package/dist/price-list-list-IXZVTXU5.js +228 -0
  263. package/dist/price-list-prices-add-QHE3TUTV.js +614 -0
  264. package/dist/price-list-prices-edit-TMVJ7S7J.js +326 -0
  265. package/dist/product-attributes-P7WFH4I2.js +358 -0
  266. package/dist/product-create-YC6MCJ2M.js +2305 -0
  267. package/dist/product-create-option-BNF2KKJM.js +144 -0
  268. package/dist/product-create-variant-SIJX7AE3.js +837 -0
  269. package/dist/product-detail-2GJ3PGHW.js +1638 -0
  270. package/dist/product-edit-YOGTWZ4I.js +397 -0
  271. package/dist/product-edit-option-4MUSMFS7.js +152 -0
  272. package/dist/product-export-5L4HNM3W.js +127 -0
  273. package/dist/product-import-Y54VG4AC.js +261 -0
  274. package/dist/product-list-EV2TS3Y4.js +313 -0
  275. package/dist/product-media-ZSMGHCNP.js +879 -0
  276. package/dist/product-metadata-572YVJH3.js +80 -0
  277. package/dist/product-organization-LVKRBJOQ.js +312 -0
  278. package/dist/product-prices-K5YM2TL6.js +266 -0
  279. package/dist/product-sales-channels-J3OH4NWX.js +157 -0
  280. package/dist/product-shipping-profile-NOOFEUBZ.js +146 -0
  281. package/dist/product-stock-J4LTIX64.js +540 -0
  282. package/dist/product-tag-create-5JJPPELP.js +122 -0
  283. package/dist/product-tag-detail-CGLCH3BJ.js +281 -0
  284. package/dist/product-tag-edit-OR7KSC7I.js +134 -0
  285. package/dist/product-tag-list-DY7GJUJQ.js +259 -0
  286. package/dist/product-tag-metadata-BFGPRMME.js +80 -0
  287. package/dist/product-type-create-FPVSGIKL.js +101 -0
  288. package/dist/product-type-detail-JYW2DAM4.js +242 -0
  289. package/dist/product-type-edit-FBT4Z4ZJ.js +113 -0
  290. package/dist/product-type-list-FK237DSQ.js +175 -0
  291. package/dist/product-type-metadata-SFJR5OQN.js +80 -0
  292. package/dist/product-variant-detail-6KPB3HL7.js +485 -0
  293. package/dist/product-variant-edit-QFHGNDW7.js +538 -0
  294. package/dist/product-variant-manage-inventory-items-ZEX2IW53.js +340 -0
  295. package/dist/product-variant-metadata-F45CSWU6.js +86 -0
  296. package/dist/profile-detail-LLXUNQOT.js +89 -0
  297. package/dist/profile-edit-UDYMDQLT.js +176 -0
  298. package/dist/promotion-add-campaign-U6X2FNWZ.js +43 -0
  299. package/dist/promotion-create-QB7E277L.js +1258 -0
  300. package/dist/promotion-detail-7D6D6PQ7.js +486 -0
  301. package/dist/promotion-edit-details-HYQJAZDF.js +512 -0
  302. package/dist/promotion-list-HTJ5GIWG.js +206 -0
  303. package/dist/refund-reason-create-LZCL6QJI.js +192 -0
  304. package/dist/refund-reason-edit-QNGFKZMN.js +192 -0
  305. package/dist/refund-reason-list-ZEKWYQ45.js +233 -0
  306. package/dist/region-add-countries-CWJ62VPK.js +226 -0
  307. package/dist/region-create-Z3JQFIKN.js +507 -0
  308. package/dist/region-detail-46R3HACJ.js +508 -0
  309. package/dist/region-edit-W5IVVP7Z.js +380 -0
  310. package/dist/region-list-DCU6NQFA.js +205 -0
  311. package/dist/region-metadata-VG5DLCOK.js +83 -0
  312. package/dist/reservation-create-VG5FSV3F.js +309 -0
  313. package/dist/reservation-detail-36BA3V2F.js +221 -0
  314. package/dist/reservation-list-R5UBPNI4.js +298 -0
  315. package/dist/reservation-metadata-KR4HOHTH.js +83 -0
  316. package/dist/reset-password-VZPICVMM.js +458 -0
  317. package/dist/return-reason-create-KTKI6NJE.js +165 -0
  318. package/dist/return-reason-edit-5KU7WKJF.js +168 -0
  319. package/dist/return-reason-list-HBSKNIMW.js +240 -0
  320. package/dist/sales-channel-add-products-6TUDLE4D.js +274 -0
  321. package/dist/sales-channel-create-2BTWSYIK.js +154 -0
  322. package/dist/sales-channel-detail-IQIQDN3L.js +437 -0
  323. package/dist/sales-channel-edit-YBNPALFT.js +163 -0
  324. package/dist/sales-channel-list-5KNN734B.js +193 -0
  325. package/dist/sales-channel-metadata-SVW6FYSV.js +88 -0
  326. package/dist/seller-details-HBVN4GGD.js +77 -0
  327. package/dist/seller-edit-OXDARXYJ.js +387 -0
  328. package/dist/seller-list-HG2VXA6V.js +192 -0
  329. package/dist/settings-D43GVDOO.js +19 -0
  330. package/dist/shipping-option-type-create-7KYU5NNF.js +195 -0
  331. package/dist/shipping-option-type-detail-4CNTT3MO.js +169 -0
  332. package/dist/shipping-option-type-edit-AN6IPVI6.js +191 -0
  333. package/dist/shipping-option-type-list-36ZS2QZO.js +266 -0
  334. package/dist/shipping-profile-create-3OWHNAOB.js +123 -0
  335. package/dist/shipping-profile-detail-WW7IVUVV.js +157 -0
  336. package/dist/shipping-profile-metadata-AD3DSZLR.js +84 -0
  337. package/dist/shipping-profiles-list-WOGGP7IT.js +241 -0
  338. package/dist/store-add-currencies-PIGEOZ4G.js +304 -0
  339. package/dist/store-detail-MFHPXBIN.js +525 -0
  340. package/dist/store-edit-WBF6EL5N.js +246 -0
  341. package/dist/store-metadata-LSK7UVSC.js +85 -0
  342. package/dist/tax-region-create-XTX4YWRA.js +300 -0
  343. package/dist/tax-region-detail-XUYJHBHI.js +320 -0
  344. package/dist/tax-region-edit-AC64YA64.js +162 -0
  345. package/dist/tax-region-list-XRAYDYK3.js +91 -0
  346. package/dist/tax-region-metadata-YDQX3Y4X.js +83 -0
  347. package/dist/tax-region-province-create-GDL65SQF.js +315 -0
  348. package/dist/tax-region-province-detail-QMPIKT7K.js +215 -0
  349. package/dist/tax-region-tax-override-create-X2QWOHSU.js +679 -0
  350. package/dist/tax-region-tax-override-edit-VZJ6EPSU.js +788 -0
  351. package/dist/tax-region-tax-rate-create-VC2WDVJJ.js +193 -0
  352. package/dist/tax-region-tax-rate-edit-SDW36H6I.js +192 -0
  353. package/dist/user-detail-IEIX24PZ.js +163 -0
  354. package/dist/user-edit-CJ7TNY3H.js +115 -0
  355. package/dist/user-invite-OTBYWV4L.js +389 -0
  356. package/dist/user-list-BJXFPTJ7.js +341 -0
  357. package/dist/user-metadata-ZLC6T6XH.js +83 -0
  358. package/package.json +87 -0
@@ -0,0 +1,1292 @@
1
+ import {
2
+ ReturnShippingPlaceholder
3
+ } from "./chunk-S4SVK5DE.js";
4
+ import {
5
+ useReturnReasons
6
+ } from "./chunk-ZDJWCSZ4.js";
7
+ import {
8
+ getReturnableQuantity
9
+ } from "./chunk-UM7ZR3VU.js";
10
+ import {
11
+ DEFAULT_FIELDS
12
+ } from "./chunk-Y2M536WR.js";
13
+ import {
14
+ useAddReturnItem,
15
+ useAddReturnShipping,
16
+ useCancelReturnRequest,
17
+ useConfirmReturnRequest,
18
+ useDeleteReturnShipping,
19
+ useInitiateReturn,
20
+ useRemoveReturnItem,
21
+ useReturn,
22
+ useUpdateReturn,
23
+ useUpdateReturnItem,
24
+ useUpdateReturnShipping
25
+ } from "./chunk-DV73MHTN.js";
26
+ import {
27
+ MoneyAmountCell
28
+ } from "./chunk-2Y3WMGN6.js";
29
+ import {
30
+ getStylizedAmount
31
+ } from "./chunk-PXYDR7WQ.js";
32
+ import {
33
+ ProductCell,
34
+ ProductHeader
35
+ } from "./chunk-FWPGOIFA.js";
36
+ import "./chunk-FQERBIVS.js";
37
+ import "./chunk-PHOCVOZ5.js";
38
+ import {
39
+ _DataTable,
40
+ useDataTable
41
+ } from "./chunk-FLCYR7E5.js";
42
+ import "./chunk-YBZWO4ZV.js";
43
+ import "./chunk-KAZ5BYTQ.js";
44
+ import "./chunk-3EF54XFY.js";
45
+ import {
46
+ Thumbnail
47
+ } from "./chunk-WIYFXWRI.js";
48
+ import {
49
+ Combobox
50
+ } from "./chunk-AW77UWCZ.js";
51
+ import {
52
+ currencies
53
+ } from "./chunk-IQPN4PZJ.js";
54
+ import "./chunk-TKGWSUEI.js";
55
+ import {
56
+ KeyboundForm
57
+ } from "./chunk-U2ZFCAPX.js";
58
+ import "./chunk-KBYZLKI4.js";
59
+ import "./chunk-YWWUOGJA.js";
60
+ import {
61
+ RouteFocusModal,
62
+ StackedFocusModal,
63
+ useRouteModal,
64
+ useStackedModal
65
+ } from "./chunk-MWOKFNRO.js";
66
+ import {
67
+ Form
68
+ } from "./chunk-3QSRE5LS.js";
69
+ import "./chunk-INNFZYX2.js";
70
+ import {
71
+ ActionMenu
72
+ } from "./chunk-BDGZ4EQO.js";
73
+ import "./chunk-LAVHRER2.js";
74
+ import "./chunk-Y7QKP6QU.js";
75
+ import {
76
+ useQueryParams
77
+ } from "./chunk-THHRRYRS.js";
78
+ import "./chunk-UZWFZMOX.js";
79
+ import "./chunk-XQNVC4Q7.js";
80
+ import {
81
+ useShippingOptions
82
+ } from "./chunk-KTKL7M34.js";
83
+ import {
84
+ useOrder,
85
+ useOrderPreview
86
+ } from "./chunk-JJVGCTKT.js";
87
+ import "./chunk-I43SCBL3.js";
88
+ import {
89
+ useStockLocations
90
+ } from "./chunk-LLWK3OR6.js";
91
+ import "./chunk-T435NFHC.js";
92
+ import "./chunk-2KCF3ZIB.js";
93
+ import {
94
+ sdk
95
+ } from "./chunk-ZYNBKBY3.js";
96
+ import "./chunk-NBMM2TZK.js";
97
+
98
+ // src/pages/orders/order-create-return/return-create.tsx
99
+ import { useNavigate, useParams } from "react-router-dom";
100
+ import { useEffect as useEffect2, useState as useState3 } from "react";
101
+ import { useTranslation as useTranslation6 } from "react-i18next";
102
+ import { toast as toast2 } from "@medusajs/ui";
103
+
104
+ // src/pages/orders/order-create-return/components/return-create-form/return-create-form.tsx
105
+ import { zodResolver } from "@hookform/resolvers/zod";
106
+ import { PencilSquare } from "@medusajs/icons";
107
+ import {
108
+ Alert,
109
+ Button,
110
+ CurrencyInput,
111
+ Heading,
112
+ IconButton as IconButton2,
113
+ Switch,
114
+ Text as Text2,
115
+ toast,
116
+ usePrompt
117
+ } from "@medusajs/ui";
118
+ import { useEffect, useMemo as useMemo3, useState as useState2 } from "react";
119
+ import { useFieldArray, useForm } from "react-hook-form";
120
+ import { useTranslation as useTranslation5 } from "react-i18next";
121
+
122
+ // src/pages/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx
123
+ import { useMemo as useMemo2, useState } from "react";
124
+ import { useTranslation as useTranslation3 } from "react-i18next";
125
+
126
+ // src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-columns.tsx
127
+ import { useMemo } from "react";
128
+ import { Checkbox } from "@medusajs/ui";
129
+ import { createColumnHelper } from "@tanstack/react-table";
130
+ import { useTranslation } from "react-i18next";
131
+ import { jsx } from "react/jsx-runtime";
132
+ var columnHelper = createColumnHelper();
133
+ var useReturnItemTableColumns = (currencyCode) => {
134
+ const { t } = useTranslation();
135
+ return useMemo(
136
+ () => [
137
+ columnHelper.display({
138
+ id: "select",
139
+ header: ({ table }) => {
140
+ return /* @__PURE__ */ jsx(
141
+ Checkbox,
142
+ {
143
+ checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
144
+ onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
145
+ }
146
+ );
147
+ },
148
+ cell: ({ row }) => {
149
+ const isSelectable = row.getCanSelect();
150
+ return /* @__PURE__ */ jsx(
151
+ Checkbox,
152
+ {
153
+ disabled: !isSelectable,
154
+ checked: row.getIsSelected(),
155
+ onCheckedChange: (value) => row.toggleSelected(!!value),
156
+ onClick: (e) => {
157
+ e.stopPropagation();
158
+ }
159
+ }
160
+ );
161
+ }
162
+ }),
163
+ columnHelper.display({
164
+ id: "product",
165
+ header: () => /* @__PURE__ */ jsx(ProductHeader, {}),
166
+ cell: ({ row }) => /* @__PURE__ */ jsx(
167
+ ProductCell,
168
+ {
169
+ product: {
170
+ thumbnail: row.original.thumbnail,
171
+ title: row.original.product_title
172
+ }
173
+ }
174
+ )
175
+ }),
176
+ columnHelper.accessor("variant.sku", {
177
+ header: t("fields.sku"),
178
+ cell: ({ getValue }) => {
179
+ return getValue() || "-";
180
+ }
181
+ }),
182
+ columnHelper.accessor("variant.title", {
183
+ header: t("fields.variant")
184
+ }),
185
+ columnHelper.accessor("quantity", {
186
+ header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: t("fields.quantity") }) }),
187
+ cell: ({ row }) => {
188
+ return getReturnableQuantity(row.original);
189
+ }
190
+ }),
191
+ columnHelper.accessor("refundable_total", {
192
+ 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") }) }),
193
+ cell: ({ getValue }) => {
194
+ const amount = getValue() || 0;
195
+ const stylized = getStylizedAmount(amount, currencyCode);
196
+ return /* @__PURE__ */ jsx("div", { className: "flex size-full items-center justify-end overflow-hidden text-right", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: stylized }) });
197
+ }
198
+ })
199
+ ],
200
+ [t, currencyCode]
201
+ );
202
+ };
203
+
204
+ // src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-filters.tsx
205
+ import { useTranslation as useTranslation2 } from "react-i18next";
206
+ var useReturnItemTableFilters = () => {
207
+ const { t } = useTranslation2();
208
+ const filters = [
209
+ {
210
+ key: "returnable_quantity",
211
+ label: t("orders.returns.returnableQuantityLabel"),
212
+ type: "number"
213
+ },
214
+ {
215
+ key: "refundable_amount",
216
+ label: t("orders.returns.refundableAmountLabel"),
217
+ type: "number"
218
+ },
219
+ {
220
+ key: "created_at",
221
+ label: t("fields.createdAt"),
222
+ type: "date"
223
+ },
224
+ {
225
+ key: "updated_at",
226
+ label: t("fields.updatedAt"),
227
+ type: "date"
228
+ }
229
+ ];
230
+ return filters;
231
+ };
232
+
233
+ // src/pages/orders/order-create-return/components/add-return-items-table/use-return-item-table-query.tsx
234
+ var useReturnItemTableQuery = ({
235
+ pageSize = 50,
236
+ prefix
237
+ }) => {
238
+ const raw = useQueryParams(
239
+ [
240
+ "q",
241
+ "offset",
242
+ "order",
243
+ "created_at",
244
+ "updated_at",
245
+ "returnable_quantity",
246
+ "refundable_amount"
247
+ ],
248
+ prefix
249
+ );
250
+ const {
251
+ offset,
252
+ created_at,
253
+ updated_at,
254
+ refundable_amount,
255
+ returnable_quantity,
256
+ ...rest
257
+ } = raw;
258
+ const searchParams = {
259
+ ...rest,
260
+ limit: pageSize,
261
+ offset: offset ? Number(offset) : 0,
262
+ created_at: created_at ? JSON.parse(created_at) : void 0,
263
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
264
+ refundable_amount: refundable_amount ? JSON.parse(refundable_amount) : void 0,
265
+ returnable_quantity: returnable_quantity ? JSON.parse(returnable_quantity) : void 0
266
+ };
267
+ return { searchParams, raw };
268
+ };
269
+
270
+ // src/pages/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx
271
+ import { jsx as jsx2 } from "react/jsx-runtime";
272
+ var PAGE_SIZE = 50;
273
+ var PREFIX = "rit";
274
+ var AddReturnItemsTable = ({
275
+ onSelectionChange,
276
+ selectedItems: selectedItems2,
277
+ items,
278
+ currencyCode
279
+ }) => {
280
+ const { t } = useTranslation3();
281
+ const [rowSelection, setRowSelection] = useState(
282
+ selectedItems2.reduce((acc, id) => {
283
+ acc[id] = true;
284
+ return acc;
285
+ }, {})
286
+ );
287
+ const updater = (fn) => {
288
+ const newState = typeof fn === "function" ? fn(rowSelection) : fn;
289
+ setRowSelection(newState);
290
+ onSelectionChange(Object.keys(newState));
291
+ };
292
+ const { searchParams, raw } = useReturnItemTableQuery({
293
+ pageSize: PAGE_SIZE,
294
+ prefix: PREFIX
295
+ });
296
+ const queriedItems = useMemo2(() => {
297
+ const {
298
+ order,
299
+ offset,
300
+ limit,
301
+ q,
302
+ created_at,
303
+ updated_at,
304
+ refundable_amount,
305
+ returnable_quantity
306
+ } = searchParams;
307
+ let results = items;
308
+ if (q) {
309
+ results = results.filter((i) => {
310
+ return i.product_title?.toLowerCase().includes(q.toLowerCase()) || i.variant_title?.toLowerCase().includes(q.toLowerCase()) || i.variant_sku?.toLowerCase().includes(q.toLowerCase());
311
+ });
312
+ }
313
+ if (order) {
314
+ const direction = order[0] === "-" ? "desc" : "asc";
315
+ const field = order.replace("-", "");
316
+ results = sortItems(results, field, direction);
317
+ }
318
+ if (created_at) {
319
+ results = filterByDate(results, created_at, "created_at");
320
+ }
321
+ if (updated_at) {
322
+ results = filterByDate(results, updated_at, "updated_at");
323
+ }
324
+ if (returnable_quantity) {
325
+ results = filterByNumber(
326
+ results,
327
+ returnable_quantity,
328
+ "returnable_quantity",
329
+ currencyCode
330
+ );
331
+ }
332
+ if (refundable_amount) {
333
+ results = filterByNumber(
334
+ results,
335
+ refundable_amount,
336
+ "refundable_amount",
337
+ currencyCode
338
+ );
339
+ }
340
+ return results.slice(offset, offset + limit);
341
+ }, [items, currencyCode, searchParams]);
342
+ const columns = useReturnItemTableColumns(currencyCode);
343
+ const filters = useReturnItemTableFilters();
344
+ const { table } = useDataTable({
345
+ data: queriedItems,
346
+ columns,
347
+ count: queriedItems.length,
348
+ enablePagination: true,
349
+ getRowId: (row) => row.id,
350
+ pageSize: PAGE_SIZE,
351
+ enableRowSelection: (row) => {
352
+ return getReturnableQuantity(row.original) > 0;
353
+ },
354
+ rowSelection: {
355
+ state: rowSelection,
356
+ updater
357
+ }
358
+ });
359
+ return /* @__PURE__ */ jsx2("div", { className: "flex size-full flex-col overflow-hidden", children: /* @__PURE__ */ jsx2(
360
+ _DataTable,
361
+ {
362
+ table,
363
+ columns,
364
+ pageSize: PAGE_SIZE,
365
+ count: queriedItems.length,
366
+ filters,
367
+ pagination: true,
368
+ layout: "fill",
369
+ search: true,
370
+ orderBy: [
371
+ { key: "product_title", label: t("fields.product") },
372
+ { key: "variant_title", label: t("fields.variant") },
373
+ { key: "sku", label: t("fields.sku") },
374
+ {
375
+ key: "returnable_quantity",
376
+ label: t("orders.fields.returnableQuantity")
377
+ },
378
+ {
379
+ key: "refundable_amount",
380
+ label: t("orders.fields.refundableAmount")
381
+ }
382
+ ],
383
+ prefix: PREFIX,
384
+ queryObject: raw
385
+ }
386
+ ) });
387
+ };
388
+ var sortItems = (items, field, direction) => {
389
+ return items.sort((a, b) => {
390
+ let aValue;
391
+ let bValue;
392
+ if (field === "product_title") {
393
+ aValue = a.product_title;
394
+ bValue = b.product_title;
395
+ } else if (field === "variant_title") {
396
+ aValue = a.variant_title;
397
+ bValue = b.variant_title;
398
+ } else if (field === "sku") {
399
+ aValue = a.variant_sku;
400
+ bValue = b.variant_sku;
401
+ } else if (field === "returnable_quantity") {
402
+ aValue = a.quantity - (a.returned_quantity || 0);
403
+ bValue = b.quantity - (b.returned_quantity || 0);
404
+ } else if (field === "refundable_amount") {
405
+ aValue = a.refundable || 0;
406
+ bValue = b.refundable || 0;
407
+ }
408
+ if (aValue < bValue) {
409
+ return direction === "asc" ? -1 : 1;
410
+ }
411
+ if (aValue > bValue) {
412
+ return direction === "asc" ? 1 : -1;
413
+ }
414
+ return 0;
415
+ });
416
+ };
417
+ var filterByDate = (items, date, field) => {
418
+ const { gt, gte, lt, lte } = date;
419
+ return items.filter((i) => {
420
+ const itemDate = new Date(i[field]);
421
+ let isValid = true;
422
+ if (gt) {
423
+ isValid = isValid && itemDate > new Date(gt);
424
+ }
425
+ if (gte) {
426
+ isValid = isValid && itemDate >= new Date(gte);
427
+ }
428
+ if (lt) {
429
+ isValid = isValid && itemDate < new Date(lt);
430
+ }
431
+ if (lte) {
432
+ isValid = isValid && itemDate <= new Date(lte);
433
+ }
434
+ return isValid;
435
+ });
436
+ };
437
+ var defaultOperators = {
438
+ eq: void 0,
439
+ gt: void 0,
440
+ gte: void 0,
441
+ lt: void 0,
442
+ lte: void 0
443
+ };
444
+ var filterByNumber = (items, value, field, currency_code) => {
445
+ const { eq, gt, lt, gte, lte } = typeof value === "object" ? { ...defaultOperators, ...value } : { ...defaultOperators, eq: value };
446
+ return items.filter((i) => {
447
+ const returnableQuantity = i.quantity - (i.returned_quantity || 0);
448
+ const refundableAmount = getStylizedAmount(i.refundable || 0, currency_code);
449
+ const itemValue = field === "returnable_quantity" ? returnableQuantity : refundableAmount;
450
+ if (eq) {
451
+ return itemValue === eq;
452
+ }
453
+ let isValid = true;
454
+ if (gt) {
455
+ isValid = isValid && itemValue > gt;
456
+ }
457
+ if (gte) {
458
+ isValid = isValid && itemValue >= gte;
459
+ }
460
+ if (lt) {
461
+ isValid = isValid && itemValue < lt;
462
+ }
463
+ if (lte) {
464
+ isValid = isValid && itemValue <= lte;
465
+ }
466
+ return isValid;
467
+ });
468
+ };
469
+
470
+ // src/pages/orders/order-create-return/components/return-create-form/return-item.tsx
471
+ import { useTranslation as useTranslation4 } from "react-i18next";
472
+ import { IconButton, Input, Text } from "@medusajs/ui";
473
+ import { ChatBubble, DocumentText, XCircle, XMark } from "@medusajs/icons";
474
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
475
+ function ReturnItem({
476
+ item,
477
+ previewItem,
478
+ currencyCode,
479
+ form,
480
+ onRemove,
481
+ onUpdate,
482
+ index
483
+ }) {
484
+ const { t } = useTranslation4();
485
+ const { return_reasons = [] } = useReturnReasons({ fields: "+label" });
486
+ const formItem = form.watch(`items.${index}`);
487
+ const showReturnReason = typeof formItem.reason_id === "string";
488
+ const showNote = typeof formItem.note === "string";
489
+ return /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest my-2 rounded-xl ", children: [
490
+ /* @__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: [
491
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-x-3", children: [
492
+ /* @__PURE__ */ jsx3(Thumbnail, { src: item.thumbnail }),
493
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
494
+ /* @__PURE__ */ jsxs("div", { children: [
495
+ /* @__PURE__ */ jsxs(Text, { className: "txt-small", as: "span", weight: "plus", children: [
496
+ item.title,
497
+ " "
498
+ ] }),
499
+ item.variant_sku && /* @__PURE__ */ jsxs("span", { children: [
500
+ "(",
501
+ item.variant_sku,
502
+ ")"
503
+ ] })
504
+ ] }),
505
+ /* @__PURE__ */ jsx3(Text, { as: "div", className: "text-ui-fg-subtle txt-small", children: item.product_title })
506
+ ] })
507
+ ] }),
508
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 justify-between", children: [
509
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-grow items-center gap-2", children: [
510
+ /* @__PURE__ */ jsx3(
511
+ Form.Field,
512
+ {
513
+ control: form.control,
514
+ name: `items.${index}.quantity`,
515
+ render: ({ field }) => {
516
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
517
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
518
+ Input,
519
+ {
520
+ className: "bg-ui-bg-base txt-small w-[67px] rounded-lg",
521
+ min: 1,
522
+ max: item.quantity,
523
+ type: "number",
524
+ ...field,
525
+ onChange: (e) => {
526
+ const val = e.target.value;
527
+ const payload = val === "" ? null : Number(val);
528
+ field.onChange(payload);
529
+ if (payload) {
530
+ onUpdate({ quantity: payload });
531
+ }
532
+ }
533
+ }
534
+ ) }),
535
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
536
+ ] });
537
+ }
538
+ }
539
+ ),
540
+ /* @__PURE__ */ jsx3(Text, { className: "txt-small text-ui-fg-subtle", children: t("fields.qty") })
541
+ ] }),
542
+ /* @__PURE__ */ jsx3("div", { className: "text-ui-fg-subtle txt-small mr-2 flex flex-shrink-0", children: /* @__PURE__ */ jsx3(
543
+ MoneyAmountCell,
544
+ {
545
+ currencyCode,
546
+ amount: previewItem.return_requested_total
547
+ }
548
+ ) }),
549
+ /* @__PURE__ */ jsx3(
550
+ ActionMenu,
551
+ {
552
+ groups: [
553
+ {
554
+ actions: [
555
+ !showReturnReason && {
556
+ label: t("actions.addReason"),
557
+ onClick: () => form.setValue(`items.${index}.reason_id`, ""),
558
+ icon: /* @__PURE__ */ jsx3(ChatBubble, {})
559
+ },
560
+ !showNote && {
561
+ label: t("actions.addNote"),
562
+ onClick: () => form.setValue(`items.${index}.note`, ""),
563
+ icon: /* @__PURE__ */ jsx3(DocumentText, {})
564
+ },
565
+ {
566
+ label: t("actions.remove"),
567
+ onClick: onRemove,
568
+ icon: /* @__PURE__ */ jsx3(XCircle, {})
569
+ }
570
+ ].filter(Boolean)
571
+ }
572
+ ]
573
+ }
574
+ )
575
+ ] })
576
+ ] }),
577
+ /* @__PURE__ */ jsxs(Fragment, { children: [
578
+ showReturnReason && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
579
+ /* @__PURE__ */ jsxs("div", { children: [
580
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.reason") }),
581
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.reasonHint") })
582
+ ] }),
583
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
584
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
585
+ Form.Field,
586
+ {
587
+ control: form.control,
588
+ name: `items.${index}.reason_id`,
589
+ render: ({ field: { ref, value, onChange, ...field } }) => {
590
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
591
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
592
+ Combobox,
593
+ {
594
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
595
+ value,
596
+ onChange: (v) => {
597
+ onUpdate({ reason_id: v });
598
+ onChange(v);
599
+ },
600
+ ...field,
601
+ options: return_reasons.map((reason) => ({
602
+ label: reason.label,
603
+ value: reason.id
604
+ }))
605
+ }
606
+ ) }),
607
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
608
+ ] });
609
+ }
610
+ }
611
+ ) }),
612
+ /* @__PURE__ */ jsx3(
613
+ IconButton,
614
+ {
615
+ type: "button",
616
+ className: "flex-shrink",
617
+ variant: "transparent",
618
+ onClick: () => {
619
+ onUpdate({ reason_id: null });
620
+ form.setValue(`items.${index}.reason_id`, null);
621
+ },
622
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
623
+ }
624
+ )
625
+ ] })
626
+ ] }),
627
+ showNote && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 p-3 md:grid-cols-2", children: [
628
+ /* @__PURE__ */ jsxs("div", { children: [
629
+ /* @__PURE__ */ jsx3(Form.Label, { children: t("orders.returns.note") }),
630
+ /* @__PURE__ */ jsx3(Form.Hint, { className: "!mt-1", children: t("orders.returns.noteHint") })
631
+ ] }),
632
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
633
+ /* @__PURE__ */ jsx3("div", { className: "flex-grow", children: /* @__PURE__ */ jsx3(
634
+ Form.Field,
635
+ {
636
+ control: form.control,
637
+ name: `items.${index}.note`,
638
+ render: ({ field: { ref, onChange, ...field } }) => {
639
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
640
+ /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
641
+ Input,
642
+ {
643
+ onChange,
644
+ ...field,
645
+ onBlur: () => onUpdate({ internal_note: field.value }),
646
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover"
647
+ }
648
+ ) }),
649
+ /* @__PURE__ */ jsx3(Form.ErrorMessage, {})
650
+ ] });
651
+ }
652
+ }
653
+ ) }),
654
+ /* @__PURE__ */ jsx3(
655
+ IconButton,
656
+ {
657
+ type: "button",
658
+ className: "flex-shrink",
659
+ variant: "transparent",
660
+ onClick: () => {
661
+ form.setValue(`items.${index}.note`, {
662
+ shouldDirty: true,
663
+ shouldTouch: true
664
+ });
665
+ onUpdate({ internal_note: null });
666
+ },
667
+ children: /* @__PURE__ */ jsx3(XMark, { className: "text-ui-fg-muted" })
668
+ }
669
+ )
670
+ ] })
671
+ ] })
672
+ ] })
673
+ ] });
674
+ }
675
+
676
+ // src/pages/orders/order-create-return/components/return-create-form/schema.ts
677
+ import { z } from "zod";
678
+ var ReturnCreateSchema = z.object({
679
+ items: z.array(
680
+ z.object({
681
+ item_id: z.string(),
682
+ quantity: z.number(),
683
+ reason_id: z.string().optional().nullable(),
684
+ note: z.string().optional().nullable()
685
+ })
686
+ ),
687
+ location_id: z.string().optional(),
688
+ option_id: z.string(),
689
+ send_notification: z.boolean().optional(),
690
+ // TODO: implement this
691
+ receive_now: z.boolean().optional()
692
+ });
693
+
694
+ // src/pages/orders/order-create-return/components/return-create-form/return-create-form.tsx
695
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
696
+ var selectedItems = [];
697
+ var ReturnCreateForm = ({
698
+ order,
699
+ preview,
700
+ activeReturn
701
+ }) => {
702
+ const { t } = useTranslation5();
703
+ const { handleSuccess } = useRouteModal();
704
+ const itemsMap = useMemo3(
705
+ () => new Map((order.items || []).map((i) => [i.id, i])),
706
+ [order.items]
707
+ );
708
+ const previewItems = useMemo3(
709
+ () => preview.items.filter(
710
+ (i) => !!i.actions?.find((a) => a.return_id === activeReturn.id)
711
+ ),
712
+ [preview.items]
713
+ );
714
+ const previewItemsMap = useMemo3(
715
+ () => new Map(previewItems.map((i) => [i.id, i])),
716
+ [previewItems]
717
+ );
718
+ const { setIsOpen } = useStackedModal();
719
+ const [isShippingPriceEdit, setIsShippingPriceEdit] = useState2(false);
720
+ const [customShippingAmount, setCustomShippingAmount] = useState2({
721
+ value: "0",
722
+ float: 0
723
+ });
724
+ const [inventoryMap, setInventoryMap] = useState2({});
725
+ const { stock_locations = [] } = useStockLocations({ limit: 999 });
726
+ const { shipping_options = [] } = useShippingOptions({
727
+ limit: 999,
728
+ fields: "*prices,+service_zone.fulfillment_set.location.id"
729
+ /**
730
+ * TODO: this should accept filter for location_id
731
+ */
732
+ });
733
+ const { mutateAsync: confirmReturnRequest, isPending: isConfirming } = useConfirmReturnRequest(activeReturn.id, order.id);
734
+ const { mutateAsync: cancelReturnRequest, isPending: isCanceling } = useCancelReturnRequest(activeReturn.id, order.id);
735
+ const { mutateAsync: updateReturnRequest, isPending: isUpdating } = useUpdateReturn(activeReturn.id, order.id);
736
+ const { mutateAsync: addReturnShipping, isPending: isAddingReturnShipping } = useAddReturnShipping(activeReturn.id, order.id);
737
+ const {
738
+ mutateAsync: updateReturnShipping,
739
+ isPending: isUpdatingReturnShipping
740
+ } = useUpdateReturnShipping(activeReturn.id, order.id);
741
+ const {
742
+ mutateAsync: deleteReturnShipping,
743
+ isPending: isDeletingReturnShipping
744
+ } = useDeleteReturnShipping(activeReturn.id, order.id);
745
+ const { mutateAsync: addReturnItem, isPending: isAddingReturnItem } = useAddReturnItem(activeReturn.id, order.id);
746
+ const { mutateAsync: removeReturnItem, isPending: isRemovingReturnItem } = useRemoveReturnItem(activeReturn.id, order.id);
747
+ const { mutateAsync: updateReturnItem, isPending: isUpdatingReturnItem } = useUpdateReturnItem(activeReturn.id, order.id);
748
+ const isRequestLoading = isConfirming || isCanceling || isAddingReturnShipping || isUpdatingReturnShipping || isDeletingReturnShipping || isAddingReturnItem || isRemovingReturnItem || isUpdatingReturnItem || isUpdating;
749
+ const form = useForm({
750
+ /**
751
+ * TODO: reason selection once Return reason settings are added
752
+ */
753
+ defaultValues: () => {
754
+ const method = preview.shipping_methods.find(
755
+ (s) => !!s.actions?.find((a) => a.action === "SHIPPING_ADD")
756
+ );
757
+ return Promise.resolve({
758
+ items: previewItems.map((i) => ({
759
+ item_id: i.id,
760
+ quantity: i.detail.return_requested_quantity,
761
+ note: i.actions?.find((a) => a.action === "RETURN_ITEM")?.internal_note,
762
+ reason_id: i.actions?.find((a) => a.action === "RETURN_ITEM")?.details?.reason_id
763
+ })),
764
+ option_id: method ? method.shipping_option_id : "",
765
+ location_id: activeReturn?.location_id,
766
+ send_notification: false
767
+ });
768
+ },
769
+ resolver: zodResolver(ReturnCreateSchema)
770
+ });
771
+ const {
772
+ fields: items,
773
+ append,
774
+ remove,
775
+ update
776
+ } = useFieldArray({
777
+ name: "items",
778
+ control: form.control
779
+ });
780
+ useEffect(() => {
781
+ const existingItemsMap = {};
782
+ previewItems.forEach((i) => {
783
+ const ind = items.findIndex((field) => field.item_id === i.id);
784
+ if (!i.detail.return_requested_quantity) {
785
+ return;
786
+ }
787
+ existingItemsMap[i.id] = true;
788
+ if (ind > -1) {
789
+ if (items[ind].quantity !== i.detail.return_requested_quantity) {
790
+ const returnItemAction = i.actions?.find(
791
+ (a) => a.action === "RETURN_ITEM"
792
+ );
793
+ update(ind, {
794
+ ...items[ind],
795
+ quantity: i.detail.return_requested_quantity,
796
+ note: returnItemAction?.internal_note,
797
+ reason_id: returnItemAction?.details?.reason_id
798
+ });
799
+ }
800
+ } else {
801
+ append({ item_id: i.id, quantity: i.detail.return_requested_quantity });
802
+ }
803
+ });
804
+ items.forEach((i, ind) => {
805
+ if (!(i.item_id in existingItemsMap)) {
806
+ remove(ind);
807
+ }
808
+ });
809
+ }, [previewItems]);
810
+ useEffect(() => {
811
+ const method = preview.shipping_methods?.find(
812
+ (s) => !!s.actions?.find((a) => a.action === "SHIPPING_ADD")
813
+ );
814
+ if (method) {
815
+ form.setValue("option_id", method.shipping_option_id);
816
+ } else {
817
+ form.setValue("option_id", "");
818
+ }
819
+ }, [preview.shipping_methods]);
820
+ const showPlaceholder = !items.length;
821
+ const locationId = form.watch("location_id");
822
+ const shippingOptionId = form.watch("option_id");
823
+ const prompt = usePrompt();
824
+ const handleSubmit = form.handleSubmit(async (data) => {
825
+ try {
826
+ const res = await prompt({
827
+ title: t("general.areYouSure"),
828
+ description: t("orders.returns.confirmText"),
829
+ confirmText: t("actions.continue"),
830
+ cancelText: t("actions.cancel"),
831
+ variant: "confirmation"
832
+ });
833
+ if (!res) {
834
+ return;
835
+ }
836
+ await confirmReturnRequest({ no_notification: !data.send_notification });
837
+ handleSuccess();
838
+ } catch (e) {
839
+ toast.error(t("general.error"), {
840
+ description: e.message,
841
+ dismissLabel: t("actions.close")
842
+ });
843
+ }
844
+ });
845
+ const onItemsSelected = () => {
846
+ addReturnItem({
847
+ items: selectedItems.map((id) => ({
848
+ id,
849
+ quantity: 1
850
+ }))
851
+ });
852
+ setIsOpen("items", false);
853
+ };
854
+ const onLocationChange = async (selectedLocationId) => {
855
+ await updateReturnRequest({ location_id: selectedLocationId });
856
+ };
857
+ const onShippingOptionChange = async (selectedOptionId) => {
858
+ const promises = preview.shipping_methods.map((s) => s.actions?.find((a) => a.action === "SHIPPING_ADD")?.id).filter(Boolean).map(deleteReturnShipping);
859
+ await Promise.all(promises);
860
+ if (selectedOptionId) {
861
+ await addReturnShipping({ shipping_option_id: selectedOptionId });
862
+ }
863
+ };
864
+ useEffect(() => {
865
+ if (isShippingPriceEdit) {
866
+ document.getElementById("js-shipping-input").focus();
867
+ }
868
+ }, [isShippingPriceEdit]);
869
+ useEffect(() => {
870
+ form.setValue("location_id", activeReturn?.location_id || "");
871
+ }, [activeReturn]);
872
+ const showLevelsWarning = useMemo3(() => {
873
+ if (!locationId) {
874
+ return false;
875
+ }
876
+ const allItemsHaveLocation = items.map((_i) => {
877
+ const item = itemsMap.get(_i.item_id);
878
+ if (!item?.variant_id) {
879
+ return true;
880
+ }
881
+ if (!item.variant?.manage_inventory) {
882
+ return true;
883
+ }
884
+ return inventoryMap[item.variant_id]?.find(
885
+ (l) => l.location_id === locationId
886
+ );
887
+ }).every(Boolean);
888
+ return !allItemsHaveLocation;
889
+ }, [items, inventoryMap, locationId]);
890
+ useEffect(() => {
891
+ const getInventoryMap = async () => {
892
+ const ret = {};
893
+ if (!items.length) {
894
+ return ret;
895
+ }
896
+ (await Promise.all(
897
+ items.map(async (_i) => {
898
+ const item = itemsMap.get(_i.item_id);
899
+ if (!item.variant_id) {
900
+ return void 0;
901
+ }
902
+ return await sdk.admin.product.retrieveVariant(
903
+ item.product_id,
904
+ item.variant_id,
905
+ { fields: "*inventory,*inventory.location_levels" }
906
+ );
907
+ })
908
+ )).filter((it) => it?.variant).forEach((item) => {
909
+ const { variant } = item;
910
+ const levels = variant.inventory[0]?.location_levels;
911
+ if (!levels) {
912
+ return;
913
+ }
914
+ ret[variant.id] = levels;
915
+ });
916
+ return ret;
917
+ };
918
+ getInventoryMap().then((map) => {
919
+ setInventoryMap(map);
920
+ });
921
+ }, [items]);
922
+ const returnTotal = preview.return_requested_total;
923
+ const shippingTotal = useMemo3(() => {
924
+ const method = preview.shipping_methods.find(
925
+ (sm) => !!sm.actions?.find((a) => a.action === "SHIPPING_ADD")
926
+ );
927
+ return method?.total || 0;
928
+ }, [preview.shipping_methods]);
929
+ return /* @__PURE__ */ jsx4(
930
+ RouteFocusModal.Form,
931
+ {
932
+ form,
933
+ onClose: (isSubmitSuccessful) => {
934
+ if (!isSubmitSuccessful) {
935
+ cancelReturnRequest();
936
+ }
937
+ },
938
+ "data-testid": "order-create-return-form",
939
+ children: /* @__PURE__ */ jsxs2(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
940
+ /* @__PURE__ */ jsx4(RouteFocusModal.Header, { "data-testid": "order-create-return-header" }),
941
+ /* @__PURE__ */ jsx4(RouteFocusModal.Body, { className: "flex size-full justify-center overflow-y-auto", "data-testid": "order-create-return-body", children: /* @__PURE__ */ jsxs2("div", { className: "mt-16 w-[720px] max-w-[100%] px-4 md:p-0", children: [
942
+ /* @__PURE__ */ jsx4(Heading, { level: "h1", "data-testid": "order-create-return-heading", children: t("orders.returns.create") }),
943
+ /* @__PURE__ */ jsxs2("div", { className: "mt-8 flex items-center justify-between", "data-testid": "order-create-return-inbound-header", children: [
944
+ /* @__PURE__ */ jsx4(Heading, { level: "h2", "data-testid": "order-create-return-inbound-heading", children: t("orders.returns.inbound") }),
945
+ /* @__PURE__ */ jsxs2(StackedFocusModal, { id: "items", "data-testid": "order-create-return-add-items-modal", children: [
946
+ /* @__PURE__ */ jsx4(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx4("a", { className: "focus-visible:shadow-borders-focus transition-fg txt-compact-small-plus cursor-pointer text-blue-500 outline-none hover:text-blue-400", "data-testid": "order-create-return-add-items-button", children: t("actions.addItems") }) }),
947
+ /* @__PURE__ */ jsxs2(StackedFocusModal.Content, { children: [
948
+ /* @__PURE__ */ jsx4(StackedFocusModal.Header, {}),
949
+ /* @__PURE__ */ jsx4(
950
+ AddReturnItemsTable,
951
+ {
952
+ items: order.items,
953
+ selectedItems: items.map((i) => i.item_id),
954
+ currencyCode: order.currency_code,
955
+ onSelectionChange: (s) => selectedItems = s
956
+ }
957
+ ),
958
+ /* @__PURE__ */ jsx4(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-x-2", children: [
959
+ /* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(
960
+ Button,
961
+ {
962
+ type: "button",
963
+ variant: "secondary",
964
+ size: "small",
965
+ children: t("actions.cancel")
966
+ }
967
+ ) }),
968
+ /* @__PURE__ */ jsx4(
969
+ Button,
970
+ {
971
+ type: "submit",
972
+ variant: "primary",
973
+ size: "small",
974
+ role: "button",
975
+ onClick: () => onItemsSelected(),
976
+ children: t("actions.save")
977
+ },
978
+ "submit-button"
979
+ )
980
+ ] }) }) })
981
+ ] })
982
+ ] })
983
+ ] }),
984
+ showPlaceholder && /* @__PURE__ */ jsx4(
985
+ "div",
986
+ {
987
+ style: {
988
+ background: "repeating-linear-gradient(-45deg, rgb(212, 212, 216, 0.15), rgb(212, 212, 216,.15) 10px, transparent 10px, transparent 20px)"
989
+ },
990
+ className: "bg-ui-bg-field mt-4 block h-[56px] w-full rounded-lg border border-dashed"
991
+ }
992
+ ),
993
+ items.filter((item) => !!previewItemsMap.get(item.item_id)).map((item, index) => /* @__PURE__ */ jsx4(
994
+ ReturnItem,
995
+ {
996
+ item: itemsMap.get(item.item_id),
997
+ previewItem: previewItemsMap.get(item.item_id),
998
+ currencyCode: order.currency_code,
999
+ form,
1000
+ onRemove: () => {
1001
+ const actionId = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM")?.id;
1002
+ if (actionId) {
1003
+ removeReturnItem(actionId);
1004
+ }
1005
+ },
1006
+ onUpdate: (payload) => {
1007
+ const action = previewItems.find((i) => i.id === item.item_id)?.actions?.find((a) => a.action === "RETURN_ITEM");
1008
+ if (action) {
1009
+ updateReturnItem(
1010
+ { ...payload, actionId: action.id },
1011
+ {
1012
+ onError: (error) => {
1013
+ if (action.details?.quantity && payload.quantity) {
1014
+ form.setValue(
1015
+ `items.${index}.quantity`,
1016
+ action.details?.quantity
1017
+ );
1018
+ }
1019
+ toast.error(error.message);
1020
+ }
1021
+ }
1022
+ );
1023
+ }
1024
+ },
1025
+ index
1026
+ },
1027
+ item.id
1028
+ )),
1029
+ !showPlaceholder && /* @__PURE__ */ jsxs2("div", { className: "mt-8 flex flex-col gap-y-4", children: [
1030
+ /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", "data-testid": "order-create-return-location-section", children: [
1031
+ /* @__PURE__ */ jsxs2("div", { children: [
1032
+ /* @__PURE__ */ jsx4(Form.Label, { "data-testid": "order-create-return-location-label", children: t("orders.returns.location") }),
1033
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-location-hint", children: t("orders.returns.locationHint") })
1034
+ ] }),
1035
+ /* @__PURE__ */ jsx4(
1036
+ Form.Field,
1037
+ {
1038
+ control: form.control,
1039
+ name: "location_id",
1040
+ render: ({ field: { value, onChange, ...field } }) => {
1041
+ return /* @__PURE__ */ jsx4(Form.Item, { "data-testid": "order-create-return-location-item", children: /* @__PURE__ */ jsx4(Form.Control, { "data-testid": "order-create-return-location-control", children: /* @__PURE__ */ jsx4(
1042
+ Combobox,
1043
+ {
1044
+ value,
1045
+ onChange: (v) => {
1046
+ onChange(v);
1047
+ onLocationChange(v);
1048
+ },
1049
+ ...field,
1050
+ options: (stock_locations ?? []).map(
1051
+ (stockLocation) => ({
1052
+ label: stockLocation.name,
1053
+ value: stockLocation.id
1054
+ })
1055
+ ),
1056
+ "data-testid": "order-create-return-location-combobox"
1057
+ }
1058
+ ) }) });
1059
+ }
1060
+ }
1061
+ )
1062
+ ] }),
1063
+ /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-1 gap-2 md:grid-cols-2", "data-testid": "order-create-return-shipping-section", children: [
1064
+ /* @__PURE__ */ jsxs2("div", { children: [
1065
+ /* @__PURE__ */ jsxs2(Form.Label, { "data-testid": "order-create-return-shipping-label", children: [
1066
+ t("orders.returns.inboundShipping"),
1067
+ /* @__PURE__ */ jsxs2(
1068
+ Text2,
1069
+ {
1070
+ size: "small",
1071
+ leading: "compact",
1072
+ className: "text-ui-fg-muted ml-1 inline",
1073
+ children: [
1074
+ "(",
1075
+ t("fields.optional"),
1076
+ ")"
1077
+ ]
1078
+ }
1079
+ )
1080
+ ] }),
1081
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-shipping-hint", children: t("orders.returns.inboundShippingHint") })
1082
+ ] }),
1083
+ /* @__PURE__ */ jsx4(
1084
+ Form.Field,
1085
+ {
1086
+ control: form.control,
1087
+ name: "option_id",
1088
+ render: ({ field: { value, onChange, ...field } }) => {
1089
+ return /* @__PURE__ */ jsx4(Form.Item, { "data-testid": "order-create-return-shipping-item", children: /* @__PURE__ */ jsx4(Form.Control, { "data-testid": "order-create-return-shipping-control", children: /* @__PURE__ */ jsx4(
1090
+ Combobox,
1091
+ {
1092
+ allowClear: true,
1093
+ value,
1094
+ onChange: (v) => {
1095
+ onChange(v);
1096
+ onShippingOptionChange(v);
1097
+ },
1098
+ ...field,
1099
+ options: (shipping_options ?? []).filter(
1100
+ (so) => (locationId ? so.service_zone.fulfillment_set.location.id === locationId : true) && !!so.rules.find(
1101
+ (r) => r.attribute === "is_return" && r.value === "true"
1102
+ )
1103
+ ).map((so) => ({
1104
+ label: so.name,
1105
+ value: so.id
1106
+ })),
1107
+ disabled: !locationId,
1108
+ noResultsPlaceholder: /* @__PURE__ */ jsx4(ReturnShippingPlaceholder, {}),
1109
+ "data-testid": "order-create-return-shipping-combobox"
1110
+ }
1111
+ ) }) });
1112
+ }
1113
+ }
1114
+ )
1115
+ ] })
1116
+ ] }),
1117
+ showLevelsWarning && /* @__PURE__ */ jsxs2(Alert, { variant: "warning", dismissible: true, className: "mt-4 p-5", children: [
1118
+ /* @__PURE__ */ jsx4("div", { className: "text-ui-fg-subtle txt-small pb-2 font-medium leading-[20px]", children: t("orders.returns.noInventoryLevel") }),
1119
+ /* @__PURE__ */ jsx4(Text2, { className: "text-ui-fg-subtle txt-small leading-normal", children: t("orders.returns.noInventoryLevelDesc") })
1120
+ ] }),
1121
+ /* @__PURE__ */ jsxs2("div", { className: "mt-8 border-y border-dotted py-4", "data-testid": "order-create-return-totals", children: [
1122
+ /* @__PURE__ */ jsxs2("div", { className: "mb-2 flex items-center justify-between", "data-testid": "order-create-return-total-row", children: [
1123
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.returnTotal") }),
1124
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: getStylizedAmount(
1125
+ returnTotal ? -1 * returnTotal : returnTotal,
1126
+ order.currency_code
1127
+ ) })
1128
+ ] }),
1129
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", "data-testid": "order-create-return-shipping-total-row", children: [
1130
+ /* @__PURE__ */ jsx4("span", { className: "txt-small text-ui-fg-subtle", children: t("orders.returns.inboundShipping") }),
1131
+ /* @__PURE__ */ jsxs2("span", { className: "txt-small text-ui-fg-subtle flex items-center", children: [
1132
+ !isShippingPriceEdit && /* @__PURE__ */ jsx4(
1133
+ IconButton2,
1134
+ {
1135
+ onClick: () => setIsShippingPriceEdit(true),
1136
+ variant: "transparent",
1137
+ className: "text-ui-fg-muted",
1138
+ disabled: showPlaceholder || !shippingOptionId,
1139
+ "data-testid": "order-create-return-shipping-edit-button",
1140
+ children: /* @__PURE__ */ jsx4(PencilSquare, {})
1141
+ }
1142
+ ),
1143
+ isShippingPriceEdit ? /* @__PURE__ */ jsx4(
1144
+ CurrencyInput,
1145
+ {
1146
+ id: "js-shipping-input",
1147
+ onBlur: () => {
1148
+ let actionId;
1149
+ preview.shipping_methods.forEach((s) => {
1150
+ if (s.actions) {
1151
+ for (const a of s.actions) {
1152
+ if (a.action === "SHIPPING_ADD") {
1153
+ actionId = a.id;
1154
+ }
1155
+ }
1156
+ }
1157
+ });
1158
+ if (actionId) {
1159
+ updateReturnShipping({
1160
+ actionId,
1161
+ custom_amount: customShippingAmount.float
1162
+ });
1163
+ }
1164
+ setIsShippingPriceEdit(false);
1165
+ },
1166
+ symbol: currencies[order.currency_code.toUpperCase()].symbol_native,
1167
+ code: order.currency_code,
1168
+ onValueChange: (_value, _name, values) => setCustomShippingAmount({
1169
+ value: values?.value ?? "",
1170
+ float: values?.float ?? null
1171
+ }),
1172
+ value: customShippingAmount.value,
1173
+ disabled: showPlaceholder,
1174
+ "data-testid": "order-create-return-shipping-amount-input"
1175
+ }
1176
+ ) : getStylizedAmount(shippingTotal, order.currency_code)
1177
+ ] })
1178
+ ] }),
1179
+ /* @__PURE__ */ jsxs2("div", { className: "mt-4 flex items-center justify-between border-t border-dotted pt-4", "data-testid": "order-create-return-difference-row", children: [
1180
+ /* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: t("orders.returns.estDifference") }),
1181
+ /* @__PURE__ */ jsx4("span", { className: "txt-small font-medium", children: getStylizedAmount(
1182
+ preview.summary.pending_difference,
1183
+ order.currency_code
1184
+ ) })
1185
+ ] })
1186
+ ] }),
1187
+ /* @__PURE__ */ jsx4("div", { className: "bg-ui-bg-field mt-8 rounded-lg border py-2 pl-2 pr-4", "data-testid": "order-create-return-notification", children: /* @__PURE__ */ jsx4(
1188
+ Form.Field,
1189
+ {
1190
+ control: form.control,
1191
+ name: "send_notification",
1192
+ render: ({ field: { onChange, value, ...field } }) => {
1193
+ return /* @__PURE__ */ jsxs2(Form.Item, { "data-testid": "order-create-return-notification-item", children: [
1194
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center", children: [
1195
+ /* @__PURE__ */ jsx4(Form.Control, { className: "mr-4 self-start", "data-testid": "order-create-return-notification-control", children: /* @__PURE__ */ jsx4(
1196
+ Switch,
1197
+ {
1198
+ dir: "ltr",
1199
+ className: "mt-[2px] rtl:rotate-180",
1200
+ checked: !!value,
1201
+ onCheckedChange: onChange,
1202
+ ...field,
1203
+ "data-testid": "order-create-return-notification-switch"
1204
+ }
1205
+ ) }),
1206
+ /* @__PURE__ */ jsxs2("div", { className: "block", children: [
1207
+ /* @__PURE__ */ jsx4(Form.Label, { "data-testid": "order-create-return-notification-label", children: t("orders.returns.sendNotification") }),
1208
+ /* @__PURE__ */ jsx4(Form.Hint, { className: "!mt-1", "data-testid": "order-create-return-notification-hint", children: t("orders.returns.sendNotificationHint") })
1209
+ ] })
1210
+ ] }),
1211
+ /* @__PURE__ */ jsx4(Form.ErrorMessage, { "data-testid": "order-create-return-notification-error" })
1212
+ ] });
1213
+ }
1214
+ }
1215
+ ) }),
1216
+ /* @__PURE__ */ jsx4("div", { className: "p-8" })
1217
+ ] }) }),
1218
+ /* @__PURE__ */ jsx4(RouteFocusModal.Footer, { "data-testid": "order-create-return-footer", children: /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-end gap-x-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-end gap-x-2", children: [
1219
+ /* @__PURE__ */ jsx4(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx4(Button, { type: "button", variant: "secondary", size: "small", "data-testid": "order-create-return-cancel-button", children: t("orders.returns.cancel.title") }) }),
1220
+ /* @__PURE__ */ jsx4(
1221
+ Button,
1222
+ {
1223
+ type: "submit",
1224
+ variant: "primary",
1225
+ size: "small",
1226
+ isLoading: isRequestLoading,
1227
+ "data-testid": "order-create-return-confirm-button",
1228
+ children: t("orders.returns.confirm")
1229
+ },
1230
+ "submit-button"
1231
+ )
1232
+ ] }) }) })
1233
+ ] })
1234
+ }
1235
+ );
1236
+ };
1237
+
1238
+ // src/pages/orders/order-create-return/return-create.tsx
1239
+ import { jsx as jsx5 } from "react/jsx-runtime";
1240
+ var IS_REQUEST_RUNNING = false;
1241
+ var ReturnCreate = () => {
1242
+ const { id } = useParams();
1243
+ const navigate = useNavigate();
1244
+ const { t } = useTranslation6();
1245
+ const { order } = useOrder(id, {
1246
+ fields: DEFAULT_FIELDS
1247
+ });
1248
+ const { order: preview } = useOrderPreview(id, void 0, {});
1249
+ const [activeReturnId, setActiveReturnId] = useState3();
1250
+ const { mutateAsync: initiateReturn } = useInitiateReturn(order.id);
1251
+ const { return: activeReturn } = useReturn(activeReturnId, void 0, {
1252
+ enabled: !!activeReturnId
1253
+ });
1254
+ useEffect2(() => {
1255
+ async function run() {
1256
+ if (IS_REQUEST_RUNNING || !preview) {
1257
+ return;
1258
+ }
1259
+ if (preview.order_change) {
1260
+ if (preview.order_change.change_type === "return_request") {
1261
+ setActiveReturnId(preview.order_change.return_id);
1262
+ } else {
1263
+ navigate(`/orders/${order.id}`, { replace: true });
1264
+ toast2.error(t("orders.returns.activeChangeError"));
1265
+ }
1266
+ return;
1267
+ }
1268
+ IS_REQUEST_RUNNING = true;
1269
+ try {
1270
+ const orderReturn = await initiateReturn({ order_id: order.id });
1271
+ setActiveReturnId(orderReturn.id);
1272
+ } catch (e) {
1273
+ navigate(`/orders/${order.id}`, { replace: true });
1274
+ toast2.error(e.message);
1275
+ } finally {
1276
+ IS_REQUEST_RUNNING = false;
1277
+ }
1278
+ }
1279
+ run();
1280
+ }, [preview]);
1281
+ return /* @__PURE__ */ jsx5(RouteFocusModal, { "data-testid": "order-create-return-modal", children: activeReturn && preview && order && /* @__PURE__ */ jsx5(
1282
+ ReturnCreateForm,
1283
+ {
1284
+ order,
1285
+ activeReturn,
1286
+ preview
1287
+ }
1288
+ ) });
1289
+ };
1290
+ export {
1291
+ ReturnCreate as Component
1292
+ };