@mercurjs/admin 2.0.0-canary.100

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 (447) hide show
  1. package/dist/add-campaign-promotions-CQDZBX3V.js +266 -0
  2. package/dist/adjust-inventory-3GPDYI3V.js +266 -0
  3. package/dist/api-key-management-create-GUNLFGNT.js +283 -0
  4. package/dist/api-key-management-detail-4IL3BQJW.js +87 -0
  5. package/dist/api-key-management-edit-SIXXFLNP.js +107 -0
  6. package/dist/api-key-management-list-XLRD4ASE.js +34 -0
  7. package/dist/api-key-management-sales-channels-GCUMV6YA.js +202 -0
  8. package/dist/campaign-budget-edit-GAP5KUI3.js +148 -0
  9. package/dist/campaign-configuration-LTHPZGYC.js +155 -0
  10. package/dist/campaign-create-TRNE6L26.js +30 -0
  11. package/dist/campaign-detail-GYMMDRUV.js +106 -0
  12. package/dist/campaign-edit-CRQCVEFT.js +207 -0
  13. package/dist/campaign-list-WEKSY62X.js +32 -0
  14. package/dist/categories-metadata-GESU3DEU.js +87 -0
  15. package/dist/category-create-PSAN6SA2.js +23 -0
  16. package/dist/category-detail-67ZTYE5M.js +106 -0
  17. package/dist/category-edit-QYKE3GAC.js +221 -0
  18. package/dist/category-list-ZRDWHPEI.js +33 -0
  19. package/dist/category-organize-D26G234L.js +112 -0
  20. package/dist/category-products-XMIZ2KRR.js +285 -0
  21. package/dist/chunk-25DQRKFS.js +102 -0
  22. package/dist/chunk-25LYVP3C.js +37 -0
  23. package/dist/chunk-26OOAKQ6.js +18 -0
  24. package/dist/chunk-2TDFXWGC.js +742 -0
  25. package/dist/chunk-2Y3WMGN6.js +39 -0
  26. package/dist/chunk-2ZFELO2L.js +13 -0
  27. package/dist/chunk-33XUAKRP.js +6 -0
  28. package/dist/chunk-35NDMIYZ.js +8 -0
  29. package/dist/chunk-3B6MTW5G.js +64 -0
  30. package/dist/chunk-3CKTAFTR.js +143 -0
  31. package/dist/chunk-3EF54XFY.js +64 -0
  32. package/dist/chunk-3GCRM6UM.js +1155 -0
  33. package/dist/chunk-3KOTDGC2.js +18 -0
  34. package/dist/chunk-3QSRE5LS.js +161 -0
  35. package/dist/chunk-3XPXUIK3.js +34 -0
  36. package/dist/chunk-4F5GP7J7.js +45 -0
  37. package/dist/chunk-4GPAS5GW.js +36 -0
  38. package/dist/chunk-4JYZU65L.js +2144 -0
  39. package/dist/chunk-4ZIQGDNH.js +184 -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-5A4JNOK3.js +109 -0
  44. package/dist/chunk-5HZT54X7.js +374 -0
  45. package/dist/chunk-5LI2P5VT.js +433 -0
  46. package/dist/chunk-5N24A4CX.js +296 -0
  47. package/dist/chunk-64B6RWZI.js +159 -0
  48. package/dist/chunk-64XMEZ5A.js +50 -0
  49. package/dist/chunk-6ERRELWD.js +3892 -0
  50. package/dist/chunk-6HJINLUB.js +94 -0
  51. package/dist/chunk-6IJMSVC6.js +16 -0
  52. package/dist/chunk-6S72GJRI.js +142 -0
  53. package/dist/chunk-77R2QD4O.js +337 -0
  54. package/dist/chunk-7AV5EJJ5.js +29 -0
  55. package/dist/chunk-7H2I3TA2.js +420 -0
  56. package/dist/chunk-7ITJ4725.js +185 -0
  57. package/dist/chunk-7JZMCLD3.js +165 -0
  58. package/dist/chunk-7KMDLRLG.js +248 -0
  59. package/dist/chunk-7NNA33IY.js +600 -0
  60. package/dist/chunk-7OSCNHHQ.js +69 -0
  61. package/dist/chunk-7RPRNVBS.js +45 -0
  62. package/dist/chunk-7SQW55FI.js +470 -0
  63. package/dist/chunk-7SVLKK6Q.js +31 -0
  64. package/dist/chunk-A2F5MDPU.js +79 -0
  65. package/dist/chunk-AEFDAU3Y.js +110 -0
  66. package/dist/chunk-AFQS6E4N.js +61 -0
  67. package/dist/chunk-AJQ6EVLE.js +501 -0
  68. package/dist/chunk-AW77UWCZ.js +363 -0
  69. package/dist/chunk-AYVH6Q5O.js +31 -0
  70. package/dist/chunk-AZVAL5E5.js +303 -0
  71. package/dist/chunk-BBZ6YISG.js +371 -0
  72. package/dist/chunk-BDGZ4EQO.js +86 -0
  73. package/dist/chunk-BLHFWBK3.js +199 -0
  74. package/dist/chunk-BPTVQM72.js +9496 -0
  75. package/dist/chunk-BYKTBURG.js +250 -0
  76. package/dist/chunk-C6OVKRMH.js +294 -0
  77. package/dist/chunk-C6SUTRP2.js +13 -0
  78. package/dist/chunk-CARSKIPW.js +87 -0
  79. package/dist/chunk-CJQRZEZU.js +614 -0
  80. package/dist/chunk-CMHI2RPL.js +20 -0
  81. package/dist/chunk-CP5IL4P6.js +98 -0
  82. package/dist/chunk-DB6ANJBO.js +35 -0
  83. package/dist/chunk-DBYUB2YI.js +174 -0
  84. package/dist/chunk-DPH3FG5H.js +528 -0
  85. package/dist/chunk-DY3XQPHC.js +31 -0
  86. package/dist/chunk-EEOEIXDA.js +112 -0
  87. package/dist/chunk-EF47ASFU.js +39 -0
  88. package/dist/chunk-EJY35WBK.js +60 -0
  89. package/dist/chunk-EOZUAYQL.js +6 -0
  90. package/dist/chunk-EWFOFSF7.js +78 -0
  91. package/dist/chunk-FD7OJEGQ.js +345 -0
  92. package/dist/chunk-FI474ADU.js +0 -0
  93. package/dist/chunk-FIVW6L2I.js +269 -0
  94. package/dist/chunk-FIYO3KTR.js +710 -0
  95. package/dist/chunk-FMFVTERD.js +0 -0
  96. package/dist/chunk-FQERBIVS.js +0 -0
  97. package/dist/chunk-FWPGOIFA.js +22 -0
  98. package/dist/chunk-G2N27VIE.js +164 -0
  99. package/dist/chunk-G4MIA23Y.js +100 -0
  100. package/dist/chunk-G5OVX555.js +26 -0
  101. package/dist/chunk-GCEOEV6P.js +241 -0
  102. package/dist/chunk-GR6JUIRU.js +32 -0
  103. package/dist/chunk-GVXAFQDF.js +170 -0
  104. package/dist/chunk-GYRTURN7.js +29 -0
  105. package/dist/chunk-HC25LNX7.js +45 -0
  106. package/dist/chunk-HDUVTTOW.js +396 -0
  107. package/dist/chunk-HGHJRKUC.js +223 -0
  108. package/dist/chunk-HINXQTCW.js +97 -0
  109. package/dist/chunk-HLL6GLZO.js +109 -0
  110. package/dist/chunk-HPQG3PEA.js +67 -0
  111. package/dist/chunk-I5LLMPI2.js +108 -0
  112. package/dist/chunk-I6GNV6QA.js +175 -0
  113. package/dist/chunk-IGTRIAUC.js +84 -0
  114. package/dist/chunk-INNFZYX2.js +183 -0
  115. package/dist/chunk-IQPN4PZJ.js +749 -0
  116. package/dist/chunk-IUB4C2WJ.js +420 -0
  117. package/dist/chunk-J54BZXZX.js +83 -0
  118. package/dist/chunk-J5SOBS7K.js +298 -0
  119. package/dist/chunk-JAJMMPOF.js +1260 -0
  120. package/dist/chunk-JHIMVLB2.js +42 -0
  121. package/dist/chunk-JI7HMGMO.js +79 -0
  122. package/dist/chunk-JJ4XUGHZ.js +312 -0
  123. package/dist/chunk-JOX3ZSRT.js +50 -0
  124. package/dist/chunk-JQV7CXEC.js +37 -0
  125. package/dist/chunk-JRTZWK77.js +1764 -0
  126. package/dist/chunk-K6RZE3F7.js +39 -0
  127. package/dist/chunk-KAZ5BYTQ.js +132 -0
  128. package/dist/chunk-KBYZLKI4.js +1093 -0
  129. package/dist/chunk-KHXRL3BH.js +85 -0
  130. package/dist/chunk-KWW4RDRS.js +199 -0
  131. package/dist/chunk-L74EVHCU.js +176 -0
  132. package/dist/chunk-L7DIEO5B.js +33 -0
  133. package/dist/chunk-LAVHRER2.js +17 -0
  134. package/dist/chunk-LFKTHNWI.js +83 -0
  135. package/dist/chunk-LGVVX4I6.js +422 -0
  136. package/dist/chunk-LQAAVRET.js +88 -0
  137. package/dist/chunk-LTBX54CI.js +11 -0
  138. package/dist/chunk-LXSBG6LK.js +18 -0
  139. package/dist/chunk-LXZXXOJ3.js +64 -0
  140. package/dist/chunk-LZO7MWH7.js +102 -0
  141. package/dist/chunk-MAEP2UCK.js +110 -0
  142. package/dist/chunk-MG4GKUJW.js +31 -0
  143. package/dist/chunk-MMDRMNPE.js +424 -0
  144. package/dist/chunk-MO7TNIVQ.js +23 -0
  145. package/dist/chunk-MZCJZRR6.js +381 -0
  146. package/dist/chunk-N2TQXB44.js +1280 -0
  147. package/dist/chunk-N3WRPCPT.js +94 -0
  148. package/dist/chunk-N5IUYCUZ.js +31 -0
  149. package/dist/chunk-N5XVXV47.js +530 -0
  150. package/dist/chunk-NBMM2TZK.js +33 -0
  151. package/dist/chunk-NCMUZ6BQ.js +0 -0
  152. package/dist/chunk-NCYTM57J.js +160 -0
  153. package/dist/chunk-NHGR2OFE.js +292 -0
  154. package/dist/chunk-NOWUEJ74.js +44 -0
  155. package/dist/chunk-NQ2RDSI3.js +43 -0
  156. package/dist/chunk-NXDFDEKP.js +0 -0
  157. package/dist/chunk-NYWESQ6J.js +86705 -0
  158. package/dist/chunk-NZN7PFPB.js +169 -0
  159. package/dist/chunk-O4LSCHTC.js +245 -0
  160. package/dist/chunk-O5VKW5FL.js +41 -0
  161. package/dist/chunk-O5ZOACVV.js +593 -0
  162. package/dist/chunk-OEDISQ2O.js +98 -0
  163. package/dist/chunk-OJI3SRZ3.js +373 -0
  164. package/dist/chunk-OSI3M4M2.js +473 -0
  165. package/dist/chunk-OT5X3VOQ.js +42 -0
  166. package/dist/chunk-OZMCKYJL.js +204 -0
  167. package/dist/chunk-P52JGPUG.js +135 -0
  168. package/dist/chunk-PHOCVOZ5.js +9 -0
  169. package/dist/chunk-PJTR2MBS.js +459 -0
  170. package/dist/chunk-PUQSQBZW.js +49 -0
  171. package/dist/chunk-PVZBDWLK.js +41 -0
  172. package/dist/chunk-PWMB7ITO.js +344 -0
  173. package/dist/chunk-PXYDR7WQ.js +48 -0
  174. package/dist/chunk-PYF5EER5.js +32 -0
  175. package/dist/chunk-Q6GUA5VE.js +92 -0
  176. package/dist/chunk-QDIPFZLV.js +113 -0
  177. package/dist/chunk-QDPLZDMX.js +17 -0
  178. package/dist/chunk-QG6PLWNH.js +106 -0
  179. package/dist/chunk-QLTN2DIY.js +119 -0
  180. package/dist/chunk-QSGR43JM.js +30 -0
  181. package/dist/chunk-QUNCQMFH.js +219 -0
  182. package/dist/chunk-QUTZUW55.js +163 -0
  183. package/dist/chunk-QVLL4MKH.js +245 -0
  184. package/dist/chunk-R325CPYC.js +88 -0
  185. package/dist/chunk-R4O667NT.js +80 -0
  186. package/dist/chunk-R55Q5LAH.js +47 -0
  187. package/dist/chunk-RF7BE47J.js +685 -0
  188. package/dist/chunk-RHKRREUU.js +15 -0
  189. package/dist/chunk-RHYS2TFP.js +266 -0
  190. package/dist/chunk-RK5N3XIX.js +56 -0
  191. package/dist/chunk-RQQ53CQJ.js +87 -0
  192. package/dist/chunk-RSBZREKG.js +144 -0
  193. package/dist/chunk-RXM4B6HR.js +8 -0
  194. package/dist/chunk-S2WEYEQR.js +14 -0
  195. package/dist/chunk-S3L6CIN2.js +459 -0
  196. package/dist/chunk-S4SVK5DE.js +39 -0
  197. package/dist/chunk-SBH4E5NY.js +129 -0
  198. package/dist/chunk-SDNGZDNK.js +170 -0
  199. package/dist/chunk-SJQ4QAFK.js +471 -0
  200. package/dist/chunk-SMQT3ZNO.js +8 -0
  201. package/dist/chunk-STSW4GDV.js +325 -0
  202. package/dist/chunk-SWL7ZCP3.js +11 -0
  203. package/dist/chunk-THHRRYRS.js +16 -0
  204. package/dist/chunk-THYWJQI4.js +635 -0
  205. package/dist/chunk-TK3XKN2P.js +357 -0
  206. package/dist/chunk-TKEAOWBZ.js +178 -0
  207. package/dist/chunk-TKFMOTJK.js +297 -0
  208. package/dist/chunk-TKGWSUEI.js +0 -0
  209. package/dist/chunk-TKSKCH3S.js +199 -0
  210. package/dist/chunk-TLE6YHGH.js +26 -0
  211. package/dist/chunk-TN4TIT7O.js +116 -0
  212. package/dist/chunk-TOUMBTYI.js +41 -0
  213. package/dist/chunk-TP7M43SI.js +189 -0
  214. package/dist/chunk-TUJIAA5O.js +101 -0
  215. package/dist/chunk-TZSOL34K.js +106 -0
  216. package/dist/chunk-U2EI2ZLM.js +32 -0
  217. package/dist/chunk-U2L77ZDR.js +17 -0
  218. package/dist/chunk-U2ZFCAPX.js +34 -0
  219. package/dist/chunk-U3OWJE7V.js +4113 -0
  220. package/dist/chunk-U5MJIHLY.js +87 -0
  221. package/dist/chunk-U5QDMLTR.js +294 -0
  222. package/dist/chunk-UI2BJVP5.js +170 -0
  223. package/dist/chunk-ULJ3OMWU.js +467 -0
  224. package/dist/chunk-UM7ZR3VU.js +14 -0
  225. package/dist/chunk-UQITHKTH.js +342 -0
  226. package/dist/chunk-UXD3VNBO.js +53 -0
  227. package/dist/chunk-UZWFZMOX.js +40 -0
  228. package/dist/chunk-V5J73NPW.js +117 -0
  229. package/dist/chunk-V6LO4BXB.js +460 -0
  230. package/dist/chunk-V74Y5NIV.js +49 -0
  231. package/dist/chunk-V7Y7WBGF.js +112 -0
  232. package/dist/chunk-VEW7PQ3X.js +209 -0
  233. package/dist/chunk-VHCDSNXF.js +89 -0
  234. package/dist/chunk-VKOE5J66.js +31 -0
  235. package/dist/chunk-VOHEQ7B5.js +31 -0
  236. package/dist/chunk-VRGXUUPH.js +772 -0
  237. package/dist/chunk-VVWB3GIK.js +70 -0
  238. package/dist/chunk-VW56KWO2.js +9 -0
  239. package/dist/chunk-VXW3BCN2.js +171 -0
  240. package/dist/chunk-VZEMURY7.js +35 -0
  241. package/dist/chunk-W6Y3PPU5.js +73 -0
  242. package/dist/chunk-WBNGBRBK.js +482 -0
  243. package/dist/chunk-WCEMRNW4.js +6 -0
  244. package/dist/chunk-WEVK4TBV.js +257 -0
  245. package/dist/chunk-WIYFXWRI.js +30 -0
  246. package/dist/chunk-WMA3WTCM.js +117 -0
  247. package/dist/chunk-WW7VLWKJ.js +360 -0
  248. package/dist/chunk-X6HEEFUW.js +1104 -0
  249. package/dist/chunk-XBFWFGZH.js +249 -0
  250. package/dist/chunk-XFKRBJLK.js +104 -0
  251. package/dist/chunk-XFR5JLNF.js +44 -0
  252. package/dist/chunk-XIZLPYEE.js +261 -0
  253. package/dist/chunk-XQNVC4Q7.js +212 -0
  254. package/dist/chunk-XR2UEF6U.js +433 -0
  255. package/dist/chunk-XSEF6KRY.js +335 -0
  256. package/dist/chunk-XSX255FK.js +12 -0
  257. package/dist/chunk-Y2M536WR.js +67 -0
  258. package/dist/chunk-Y456KVIN.js +116 -0
  259. package/dist/chunk-Y7QKP6QU.js +35 -0
  260. package/dist/chunk-YAMNPEPW.js +345 -0
  261. package/dist/chunk-YBZWO4ZV.js +57 -0
  262. package/dist/chunk-YDAJI7WF.js +389 -0
  263. package/dist/chunk-YMKZS2HK.js +82 -0
  264. package/dist/chunk-YQYGAFCS.js +119 -0
  265. package/dist/chunk-YVCBMOJG.js +50 -0
  266. package/dist/chunk-YWWUOGJA.js +62 -0
  267. package/dist/chunk-YXFG3M2D.js +792 -0
  268. package/dist/chunk-ZA2KFUFR.js +19 -0
  269. package/dist/chunk-ZGEMSYN7.js +61 -0
  270. package/dist/chunk-ZJO4DDOP.js +454 -0
  271. package/dist/chunk-ZNA2XOGX.js +675 -0
  272. package/dist/chunk-ZQZHFMD7.js +19 -0
  273. package/dist/collection-add-products-4TTEF6QV.js +288 -0
  274. package/dist/collection-create-SD4GKHFC.js +134 -0
  275. package/dist/collection-detail-64YVMLBU.js +97 -0
  276. package/dist/collection-edit-Z474HXCJ.js +122 -0
  277. package/dist/collection-list-OTSGOEBC.js +79 -0
  278. package/dist/collection-metadata-FFHA6CQ3.js +84 -0
  279. package/dist/commission-rate-create-7BBUGS2I.js +779 -0
  280. package/dist/commission-rate-detail-FORKXXJY.js +83 -0
  281. package/dist/commission-rate-edit-SAX2DAND.js +762 -0
  282. package/dist/commission-rate-list-EESTCCRP.js +28 -0
  283. package/dist/constants-CAwtRicB.d.ts +42 -0
  284. package/dist/customer-create-WA4GYGVD.js +184 -0
  285. package/dist/customer-create-address-YBI4KWWH.js +300 -0
  286. package/dist/customer-detail-SDE4TDZD.js +107 -0
  287. package/dist/customer-edit-TFR6PVJJ.js +193 -0
  288. package/dist/customer-group-add-customers-77BVWLTN.js +247 -0
  289. package/dist/customer-group-create-32UIUO46.js +114 -0
  290. package/dist/customer-group-detail-QRY6BHGI.js +106 -0
  291. package/dist/customer-group-edit-HFL7LZZZ.js +109 -0
  292. package/dist/customer-group-list-Q3T72VH2.js +57 -0
  293. package/dist/customer-group-metadata-FXI3J6DB.js +85 -0
  294. package/dist/customer-list-CXTUBLCK.js +33 -0
  295. package/dist/customer-metadata-BV4CHHWI.js +85 -0
  296. package/dist/customers-add-customer-group-SUE2KKJR.js +312 -0
  297. package/dist/edit-inventory-item-DDRUGVSK.js +156 -0
  298. package/dist/edit-inventory-item-attributes-MDL7FSLR.js +327 -0
  299. package/dist/edit-reservation-JWABBNJ6.js +247 -0
  300. package/dist/edit-rules-ECNFIPUC.js +320 -0
  301. package/dist/home-I3OILW5Z.js +16 -0
  302. package/dist/index.css +6 -0
  303. package/dist/index.d.ts +255 -0
  304. package/dist/index.js +4989 -0
  305. package/dist/inventory-create-S6CB4JYN.js +56 -0
  306. package/dist/inventory-detail-OIKNOS5A.js +107 -0
  307. package/dist/inventory-list-XSHWCPO4.js +30 -0
  308. package/dist/inventory-metadata-MHGDNLXT.js +87 -0
  309. package/dist/inventory-stock-JG5CZWZA.js +292 -0
  310. package/dist/invite-25CGHT4W.js +373 -0
  311. package/dist/location-create-G3MNWQWB.js +239 -0
  312. package/dist/location-detail-5CGAZMBR.js +100 -0
  313. package/dist/location-edit-UI6AWCZS.js +254 -0
  314. package/dist/location-fulfillment-providers-BA2VMZHX.js +293 -0
  315. package/dist/location-list-656DEW7L.js +53 -0
  316. package/dist/location-sales-channels-WXBK4EJO.js +216 -0
  317. package/dist/location-service-zone-create-647O67PU.js +174 -0
  318. package/dist/location-service-zone-edit-BUY6HNZM.js +135 -0
  319. package/dist/location-service-zone-manage-areas-X2ZGRHHA.js +155 -0
  320. package/dist/location-service-zone-shipping-option-create-IASFWJ2Z.js +57 -0
  321. package/dist/location-service-zone-shipping-option-edit-IJDU5PTW.js +363 -0
  322. package/dist/location-service-zone-shipping-option-pricing-3T7HLKJC.js +363 -0
  323. package/dist/login-WU5VB5LW.js +264 -0
  324. package/dist/manage-locations-IJIPCYAY.js +250 -0
  325. package/dist/marketplace-add-currencies-RXLEQ6MZ.js +305 -0
  326. package/dist/marketplace-detail-23KSAJVI.js +75 -0
  327. package/dist/marketplace-edit-XPIEDQYD.js +247 -0
  328. package/dist/marketplace-metadata-5GEWGH2M.js +89 -0
  329. package/dist/no-match-JLVLPCRH.js +33 -0
  330. package/dist/order-allocate-items-GYGER65Z.js +559 -0
  331. package/dist/order-create-claim-RNUFU2MP.js +2207 -0
  332. package/dist/order-create-edit-DLH76B2Q.js +936 -0
  333. package/dist/order-create-exchange-FA27FZU7.js +2194 -0
  334. package/dist/order-create-fulfillment-4F5JAUOX.js +625 -0
  335. package/dist/order-create-refund-3LCTQXFD.js +407 -0
  336. package/dist/order-create-return-EO2C5RAA.js +1293 -0
  337. package/dist/order-create-shipment-PIQ43ZSG.js +212 -0
  338. package/dist/order-detail-2U26JNU2.js +123 -0
  339. package/dist/order-edit-billing-address-PRXCLUNR.js +404 -0
  340. package/dist/order-edit-email-GVKVQESG.js +175 -0
  341. package/dist/order-edit-shipping-address-UDNHXO2V.js +401 -0
  342. package/dist/order-list-U2HL7VBX.js +49 -0
  343. package/dist/order-metadata-HPXIR6KI.js +86 -0
  344. package/dist/order-receive-return-FMM74XYM.js +553 -0
  345. package/dist/order-request-transfer-SI5PSOKA.js +575 -0
  346. package/dist/pages/index.d.ts +3165 -0
  347. package/dist/pages/index.js +447 -0
  348. package/dist/payout-detail-L4VYAP53.js +52 -0
  349. package/dist/payout-list-4S6MAU4R.js +30 -0
  350. package/dist/price-list-configuration-F2BZC6QX.js +357 -0
  351. package/dist/price-list-create-ZJTDGJSS.js +76 -0
  352. package/dist/price-list-detail-IUJXNM6Y.js +103 -0
  353. package/dist/price-list-edit-CERYYMC5.js +228 -0
  354. package/dist/price-list-list-RBD2MEZ5.js +36 -0
  355. package/dist/price-list-prices-add-AJJ76VMY.js +71 -0
  356. package/dist/price-list-prices-edit-2NYN6WVJ.js +332 -0
  357. package/dist/product-attributes-EUDG25XA.js +362 -0
  358. package/dist/product-create-XA7UOISW.js +68 -0
  359. package/dist/product-create-option-BG2ZKSFN.js +148 -0
  360. package/dist/product-create-variant-4Z6HSHRE.js +54 -0
  361. package/dist/product-detail-F67SLUIA.js +103 -0
  362. package/dist/product-edit-HFWSBQQI.js +401 -0
  363. package/dist/product-edit-option-Y46SNVHN.js +156 -0
  364. package/dist/product-export-ABNA6ZTY.js +132 -0
  365. package/dist/product-import-SQSXBPK5.js +265 -0
  366. package/dist/product-list-NWHRQHVJ.js +86 -0
  367. package/dist/product-media-YIQCVDCC.js +883 -0
  368. package/dist/product-metadata-2Z5DIXJH.js +87 -0
  369. package/dist/product-organization-L666C2EQ.js +316 -0
  370. package/dist/product-prices-DPGO4KHT.js +267 -0
  371. package/dist/product-sales-channels-6IS6T3EC.js +161 -0
  372. package/dist/product-shipping-profile-LMLRMJ36.js +150 -0
  373. package/dist/product-stock-AQKD6EQO.js +542 -0
  374. package/dist/product-tag-create-5CF7JLN5.js +126 -0
  375. package/dist/product-tag-detail-2RJNUUT7.js +136 -0
  376. package/dist/product-tag-edit-KGT54WP5.js +138 -0
  377. package/dist/product-tag-list-PJG7ICZE.js +130 -0
  378. package/dist/product-tag-metadata-WU7DVJUM.js +84 -0
  379. package/dist/product-type-create-WHYGTCYX.js +102 -0
  380. package/dist/product-type-detail-MZ3MAV2B.js +98 -0
  381. package/dist/product-type-edit-A4IE6BSF.js +114 -0
  382. package/dist/product-type-list-ND2IIR6O.js +35 -0
  383. package/dist/product-type-metadata-KX4ETP3Y.js +84 -0
  384. package/dist/product-variant-detail-USZXPSVX.js +112 -0
  385. package/dist/product-variant-edit-5L2GWAHB.js +545 -0
  386. package/dist/product-variant-manage-inventory-items-54V2HTA6.js +341 -0
  387. package/dist/product-variant-metadata-SBYZTEIH.js +90 -0
  388. package/dist/profile-detail-OAQD5VJC.js +18 -0
  389. package/dist/profile-edit-DSZCGRY7.js +177 -0
  390. package/dist/promotion-add-campaign-JC4B53LS.js +44 -0
  391. package/dist/promotion-create-A6FMNECA.js +54 -0
  392. package/dist/promotion-detail-XOQTYXTV.js +88 -0
  393. package/dist/promotion-edit-details-KFZ2VVVQ.js +513 -0
  394. package/dist/promotion-list-EH7CW4JZ.js +58 -0
  395. package/dist/refund-reason-create-EMGCAW5S.js +196 -0
  396. package/dist/refund-reason-edit-3D25LGKM.js +196 -0
  397. package/dist/refund-reason-list-V7HDVFS2.js +102 -0
  398. package/dist/region-add-countries-ZAQBBXIL.js +227 -0
  399. package/dist/region-create-IMSMEASB.js +508 -0
  400. package/dist/region-detail-RASFBR5O.js +74 -0
  401. package/dist/region-edit-HGSLB3RU.js +381 -0
  402. package/dist/region-list-WEILXVMS.js +35 -0
  403. package/dist/region-metadata-4COKDRZH.js +87 -0
  404. package/dist/reservation-create-CIYW3ZKU.js +310 -0
  405. package/dist/reservation-detail-2ARWTBE6.js +83 -0
  406. package/dist/reservation-list-W6IOXQZK.js +31 -0
  407. package/dist/reservation-metadata-3ZJ2C5BM.js +87 -0
  408. package/dist/reset-password-YQ6HMFFZ.js +458 -0
  409. package/dist/return-reason-create-HHZ3EMCC.js +166 -0
  410. package/dist/return-reason-edit-5P43JRYC.js +169 -0
  411. package/dist/return-reason-list-32MCIQMK.js +81 -0
  412. package/dist/sales-channel-add-products-U2UTBUKE.js +278 -0
  413. package/dist/sales-channel-create-TMRTMLIX.js +155 -0
  414. package/dist/sales-channel-detail-FRBKGP4X.js +98 -0
  415. package/dist/sales-channel-edit-4LE2N6EV.js +164 -0
  416. package/dist/sales-channel-list-36UHU63C.js +50 -0
  417. package/dist/sales-channel-metadata-OKKVLC7G.js +92 -0
  418. package/dist/seller-address-edit-VH4X5OIO.js +223 -0
  419. package/dist/seller-details-52PG56BK.js +104 -0
  420. package/dist/seller-edit-TU72D5QS.js +331 -0
  421. package/dist/seller-list-CYNCPXYT.js +80 -0
  422. package/dist/settings-AVE3VCCM.js +19 -0
  423. package/dist/shipping-option-type-create-ZHRADP5E.js +199 -0
  424. package/dist/shipping-option-type-detail-ZDEEU3P5.js +82 -0
  425. package/dist/shipping-option-type-edit-2FCNVHNE.js +195 -0
  426. package/dist/shipping-option-type-list-OCCZ4DNS.js +60 -0
  427. package/dist/shipping-profile-create-WLHDFQ4Q.js +124 -0
  428. package/dist/shipping-profile-detail-AUWRGYYL.js +57 -0
  429. package/dist/shipping-profile-metadata-W7CND3IQ.js +88 -0
  430. package/dist/shipping-profiles-list-RZT6HIZV.js +27 -0
  431. package/dist/tax-region-create-U5JWJUX4.js +304 -0
  432. package/dist/tax-region-detail-UNGDO64V.js +68 -0
  433. package/dist/tax-region-edit-5DOYTPEF.js +166 -0
  434. package/dist/tax-region-list-MRQ63BL3.js +27 -0
  435. package/dist/tax-region-metadata-WN3XSWGA.js +87 -0
  436. package/dist/tax-region-province-create-3GZUYVBY.js +316 -0
  437. package/dist/tax-region-province-detail-QTBP47GV.js +99 -0
  438. package/dist/tax-region-tax-override-create-PRZ3DEZE.js +688 -0
  439. package/dist/tax-region-tax-override-edit-YAA6TB6A.js +797 -0
  440. package/dist/tax-region-tax-rate-create-KHNADBCN.js +194 -0
  441. package/dist/tax-region-tax-rate-edit-JR5262VW.js +193 -0
  442. package/dist/user-detail-I66RREWP.js +55 -0
  443. package/dist/user-edit-LBJOZ4LG.js +116 -0
  444. package/dist/user-invite-EUNVBT5W.js +398 -0
  445. package/dist/user-list-BDJJI33F.js +28 -0
  446. package/dist/user-metadata-4RXAMVDT.js +87 -0
  447. package/package.json +87 -0
@@ -0,0 +1,2144 @@
1
+ import {
2
+ ChipGroup
3
+ } from "./chunk-IGTRIAUC.js";
4
+ import {
5
+ HandleInput
6
+ } from "./chunk-TLE6YHGH.js";
7
+ import {
8
+ DataGrid,
9
+ createDataGridHelper,
10
+ createDataGridPriceColumns
11
+ } from "./chunk-U3OWJE7V.js";
12
+ import {
13
+ useSalesChannelTableColumns,
14
+ useSalesChannelTableEmptyState,
15
+ useSalesChannelTableFilters,
16
+ useSalesChannelTableQuery
17
+ } from "./chunk-NZN7PFPB.js";
18
+ import {
19
+ DataTable
20
+ } from "./chunk-UQITHKTH.js";
21
+ import {
22
+ CategoryCombobox
23
+ } from "./chunk-LGVVX4I6.js";
24
+ import {
25
+ useComboboxData
26
+ } from "./chunk-AEFDAU3Y.js";
27
+ import {
28
+ Combobox
29
+ } from "./chunk-AW77UWCZ.js";
30
+ import {
31
+ PRODUCT_CREATE_FORM_DEFAULTS,
32
+ ProductCreateSchema,
33
+ UploadMediaFormItem,
34
+ decorateVariantsWithDefaultValues,
35
+ normalizeProductFormValues
36
+ } from "./chunk-77R2QD4O.js";
37
+ import {
38
+ ChipInput
39
+ } from "./chunk-NCYTM57J.js";
40
+ import {
41
+ TabbedForm,
42
+ defineTabMeta,
43
+ useTabbedForm
44
+ } from "./chunk-XSEF6KRY.js";
45
+ import {
46
+ SwitchBox
47
+ } from "./chunk-YVCBMOJG.js";
48
+ import {
49
+ ActionMenu
50
+ } from "./chunk-BDGZ4EQO.js";
51
+ import {
52
+ RouteFocusModal,
53
+ StackedFocusModal,
54
+ useRouteModal,
55
+ useStackedModal
56
+ } from "./chunk-V6LO4BXB.js";
57
+ import {
58
+ Form
59
+ } from "./chunk-3QSRE5LS.js";
60
+ import {
61
+ useRegions
62
+ } from "./chunk-VHCDSNXF.js";
63
+ import {
64
+ useStore
65
+ } from "./chunk-EJY35WBK.js";
66
+ import {
67
+ usePricePreferences
68
+ } from "./chunk-GYRTURN7.js";
69
+ import {
70
+ useSalesChannel,
71
+ useSalesChannels
72
+ } from "./chunk-QUTZUW55.js";
73
+ import {
74
+ useCreateProduct
75
+ } from "./chunk-WBNGBRBK.js";
76
+ import {
77
+ sdk
78
+ } from "./chunk-LXZXXOJ3.js";
79
+
80
+ // src/pages/products/product-create/product-create.tsx
81
+ import { Children as Children2 } from "react";
82
+ import { useTranslation as useTranslation10 } from "react-i18next";
83
+
84
+ // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
85
+ import { Button as Button5, toast } from "@medusajs/ui";
86
+ import { useCallback, useMemo as useMemo4, Children } from "react";
87
+ import { useForm, useWatch as useWatch4 } from "react-hook-form";
88
+ import { useTranslation as useTranslation9 } from "react-i18next";
89
+
90
+ // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
91
+ import { Divider, Heading as Heading2 } from "@medusajs/ui";
92
+ import { useTranslation as useTranslation4 } from "react-i18next";
93
+
94
+ // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
95
+ import { Input, Textarea } from "@medusajs/ui";
96
+ import { useTranslation } from "react-i18next";
97
+ import { jsx, jsxs } from "react/jsx-runtime";
98
+ var ProductCreateGeneralSection = () => {
99
+ const form = useTabbedForm();
100
+ const { t } = useTranslation();
101
+ return /* @__PURE__ */ jsxs("div", { id: "general", className: "flex flex-col gap-y-6", "data-testid": "product-create-general-section", children: [
102
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-2", "data-testid": "product-create-general-section-fields", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-3", "data-testid": "product-create-general-section-title-fields", children: [
103
+ /* @__PURE__ */ jsx(
104
+ Form.Field,
105
+ {
106
+ control: form.control,
107
+ name: "title",
108
+ render: ({ field }) => {
109
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-title-item", children: [
110
+ /* @__PURE__ */ jsx(Form.Label, { "data-testid": "product-create-general-section-title-label", children: t("products.fields.title.label") }),
111
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "product-create-general-section-title-control", children: /* @__PURE__ */ jsx(Input, { ...field, placeholder: t("products.fields.title.placeholder"), "data-testid": "product-create-general-section-title-input" }) })
112
+ ] });
113
+ }
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsx(
117
+ Form.Field,
118
+ {
119
+ control: form.control,
120
+ name: "subtitle",
121
+ render: ({ field }) => {
122
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-subtitle-item", children: [
123
+ /* @__PURE__ */ jsx(Form.Label, { optional: true, "data-testid": "product-create-general-section-subtitle-label", children: t("products.fields.subtitle.label") }),
124
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "product-create-general-section-subtitle-control", children: /* @__PURE__ */ jsx(Input, { ...field, placeholder: t("products.fields.subtitle.placeholder"), "data-testid": "product-create-general-section-subtitle-input" }) })
125
+ ] });
126
+ }
127
+ }
128
+ ),
129
+ /* @__PURE__ */ jsx(
130
+ Form.Field,
131
+ {
132
+ control: form.control,
133
+ name: "handle",
134
+ render: ({ field }) => {
135
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-handle-item", children: [
136
+ /* @__PURE__ */ jsx(
137
+ Form.Label,
138
+ {
139
+ tooltip: t("products.fields.handle.tooltip"),
140
+ optional: true,
141
+ "data-testid": "product-create-general-section-handle-label",
142
+ children: t("fields.handle")
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "product-create-general-section-handle-control", children: /* @__PURE__ */ jsx(HandleInput, { ...field, placeholder: t("products.fields.handle.placeholder"), "data-testid": "product-create-general-section-handle-input" }) })
146
+ ] });
147
+ }
148
+ }
149
+ )
150
+ ] }) }),
151
+ /* @__PURE__ */ jsx(
152
+ Form.Field,
153
+ {
154
+ control: form.control,
155
+ name: "description",
156
+ render: ({ field }) => {
157
+ return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-description-item", children: [
158
+ /* @__PURE__ */ jsx(Form.Label, { optional: true, "data-testid": "product-create-general-section-description-label", children: t("products.fields.description.label") }),
159
+ /* @__PURE__ */ jsx(Form.Control, { "data-testid": "product-create-general-section-description-control", children: /* @__PURE__ */ jsx(Textarea, { ...field, placeholder: t("products.fields.description.placeholder"), "data-testid": "product-create-general-section-description-input" }) })
160
+ ] });
161
+ }
162
+ }
163
+ )
164
+ ] });
165
+ };
166
+
167
+ // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-media-section/product-create-details-media-section.tsx
168
+ import {
169
+ defaultDropAnimationSideEffects,
170
+ DndContext,
171
+ DragOverlay,
172
+ KeyboardSensor,
173
+ PointerSensor,
174
+ useSensor,
175
+ useSensors
176
+ } from "@dnd-kit/core";
177
+ import {
178
+ arrayMove,
179
+ SortableContext,
180
+ sortableKeyboardCoordinates,
181
+ useSortable
182
+ } from "@dnd-kit/sortable";
183
+ import { CSS } from "@dnd-kit/utilities";
184
+ import {
185
+ DotsSix,
186
+ StackPerspective,
187
+ ThumbnailBadge,
188
+ Trash,
189
+ XMark
190
+ } from "@medusajs/icons";
191
+ import { IconButton, Text } from "@medusajs/ui";
192
+ import { useState } from "react";
193
+ import { useFieldArray } from "react-hook-form";
194
+ import { useTranslation as useTranslation2 } from "react-i18next";
195
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
196
+ var dropAnimationConfig = {
197
+ sideEffects: defaultDropAnimationSideEffects({
198
+ styles: {
199
+ active: {
200
+ opacity: "0.4"
201
+ }
202
+ }
203
+ })
204
+ };
205
+ var ProductCreateMediaSection = () => {
206
+ const form = useTabbedForm();
207
+ const { fields, append, remove } = useFieldArray({
208
+ name: "media",
209
+ control: form.control,
210
+ keyName: "field_id"
211
+ });
212
+ const [activeId, setActiveId] = useState(null);
213
+ const sensors = useSensors(
214
+ useSensor(PointerSensor),
215
+ useSensor(KeyboardSensor, {
216
+ coordinateGetter: sortableKeyboardCoordinates
217
+ })
218
+ );
219
+ const handleDragStart = (event) => {
220
+ setActiveId(event.active.id);
221
+ };
222
+ const handleDragEnd = (event) => {
223
+ setActiveId(null);
224
+ const { active, over } = event;
225
+ if (active.id !== over?.id) {
226
+ const oldIndex = fields.findIndex((item) => item.field_id === active.id);
227
+ const newIndex = fields.findIndex((item) => item.field_id === over?.id);
228
+ form.setValue("media", arrayMove(fields, oldIndex, newIndex), {
229
+ shouldDirty: true,
230
+ shouldTouch: true
231
+ });
232
+ }
233
+ };
234
+ const handleDragCancel = () => {
235
+ setActiveId(null);
236
+ };
237
+ const getOnDelete = (index) => {
238
+ return () => {
239
+ remove(index);
240
+ };
241
+ };
242
+ const getMakeThumbnail = (index) => {
243
+ return () => {
244
+ const newFields = fields.map((field, i) => {
245
+ return {
246
+ ...field,
247
+ isThumbnail: i === index
248
+ };
249
+ });
250
+ form.setValue("media", newFields, {
251
+ shouldDirty: true,
252
+ shouldTouch: true
253
+ });
254
+ };
255
+ };
256
+ const getItemHandlers = (index) => {
257
+ return {
258
+ onDelete: getOnDelete(index),
259
+ onMakeThumbnail: getMakeThumbnail(index)
260
+ };
261
+ };
262
+ return /* @__PURE__ */ jsxs2("div", { id: "media", className: "flex flex-col gap-y-2", "data-testid": "product-create-media-section", children: [
263
+ /* @__PURE__ */ jsx2(UploadMediaFormItem, { form, append, showHint: false, "data-testid": "product-create-media-section-upload" }),
264
+ /* @__PURE__ */ jsxs2(
265
+ DndContext,
266
+ {
267
+ sensors,
268
+ onDragEnd: handleDragEnd,
269
+ onDragStart: handleDragStart,
270
+ onDragCancel: handleDragCancel,
271
+ children: [
272
+ /* @__PURE__ */ jsx2(DragOverlay, { dropAnimation: dropAnimationConfig, children: activeId ? /* @__PURE__ */ jsx2(
273
+ MediaGridItemOverlay,
274
+ {
275
+ field: fields.find((m) => m.field_id === activeId)
276
+ }
277
+ ) : null }),
278
+ /* @__PURE__ */ jsx2("ul", { className: "flex flex-col gap-y-2", "data-testid": "product-create-media-section-list", children: /* @__PURE__ */ jsx2(SortableContext, { items: fields.map((field) => field.field_id), children: fields.map((field, index) => {
279
+ const { onDelete, onMakeThumbnail } = getItemHandlers(index);
280
+ return /* @__PURE__ */ jsx2(
281
+ MediaItem,
282
+ {
283
+ field,
284
+ onDelete,
285
+ onMakeThumbnail
286
+ },
287
+ field.field_id
288
+ );
289
+ }) }) })
290
+ ]
291
+ }
292
+ )
293
+ ] });
294
+ };
295
+ var MediaItem = ({ field, onDelete, onMakeThumbnail }) => {
296
+ const { t } = useTranslation2();
297
+ const {
298
+ attributes,
299
+ listeners,
300
+ setNodeRef,
301
+ setActivatorNodeRef,
302
+ transform,
303
+ transition,
304
+ isDragging
305
+ } = useSortable({ id: field.field_id });
306
+ const style = {
307
+ opacity: isDragging ? 0.4 : void 0,
308
+ transform: CSS.Translate.toString(transform),
309
+ transition
310
+ };
311
+ if (!field.file) {
312
+ return null;
313
+ }
314
+ return /* @__PURE__ */ jsxs2(
315
+ "li",
316
+ {
317
+ className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
318
+ ref: setNodeRef,
319
+ style,
320
+ "data-testid": `product-create-media-section-item-${field.field_id}`,
321
+ children: [
322
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-2", children: [
323
+ /* @__PURE__ */ jsx2(
324
+ IconButton,
325
+ {
326
+ variant: "transparent",
327
+ type: "button",
328
+ size: "small",
329
+ ...attributes,
330
+ ...listeners,
331
+ ref: setActivatorNodeRef,
332
+ className: "cursor-grab touch-none active:cursor-grabbing",
333
+ children: /* @__PURE__ */ jsx2(DotsSix, { className: "text-ui-fg-muted" })
334
+ }
335
+ ),
336
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-3", children: [
337
+ /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx2(ThumbnailPreview, { url: field.url }) }),
338
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
339
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: field.file.name }),
340
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
341
+ field.isThumbnail && /* @__PURE__ */ jsx2(ThumbnailBadge, {}),
342
+ /* @__PURE__ */ jsx2(
343
+ Text,
344
+ {
345
+ size: "xsmall",
346
+ leading: "compact",
347
+ className: "text-ui-fg-subtle",
348
+ children: formatFileSize(field.file.size)
349
+ }
350
+ )
351
+ ] })
352
+ ] })
353
+ ] })
354
+ ] }),
355
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
356
+ /* @__PURE__ */ jsx2(
357
+ ActionMenu,
358
+ {
359
+ groups: [
360
+ {
361
+ actions: [
362
+ {
363
+ label: t("products.media.makeThumbnail"),
364
+ icon: /* @__PURE__ */ jsx2(StackPerspective, {}),
365
+ onClick: onMakeThumbnail
366
+ }
367
+ ]
368
+ },
369
+ {
370
+ actions: [
371
+ {
372
+ icon: /* @__PURE__ */ jsx2(Trash, {}),
373
+ label: t("actions.delete"),
374
+ onClick: onDelete
375
+ }
376
+ ]
377
+ }
378
+ ],
379
+ "data-testid": `product-create-media-section-item-menu-${field.field_id}`
380
+ }
381
+ ),
382
+ /* @__PURE__ */ jsx2(
383
+ IconButton,
384
+ {
385
+ type: "button",
386
+ size: "small",
387
+ variant: "transparent",
388
+ onClick: onDelete,
389
+ "data-testid": `product-create-media-section-item-delete-${field.field_id}`,
390
+ children: /* @__PURE__ */ jsx2(XMark, {})
391
+ }
392
+ )
393
+ ] })
394
+ ]
395
+ }
396
+ );
397
+ };
398
+ var MediaGridItemOverlay = ({ field }) => {
399
+ return /* @__PURE__ */ jsxs2("li", { className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2", children: [
400
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-2", children: [
401
+ /* @__PURE__ */ jsx2(
402
+ IconButton,
403
+ {
404
+ variant: "transparent",
405
+ size: "small",
406
+ className: "cursor-grab touch-none active:cursor-grabbing",
407
+ children: /* @__PURE__ */ jsx2(DotsSix, { className: "text-ui-fg-muted" })
408
+ }
409
+ ),
410
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-3", children: [
411
+ /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx2(ThumbnailPreview, { url: field.url }) }),
412
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
413
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: field.file?.name }),
414
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
415
+ field.isThumbnail && /* @__PURE__ */ jsx2(ThumbnailBadge, {}),
416
+ /* @__PURE__ */ jsx2(
417
+ Text,
418
+ {
419
+ size: "xsmall",
420
+ leading: "compact",
421
+ className: "text-ui-fg-subtle",
422
+ children: formatFileSize(field.file?.size ?? 0)
423
+ }
424
+ )
425
+ ] })
426
+ ] })
427
+ ] })
428
+ ] }),
429
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
430
+ /* @__PURE__ */ jsx2(ActionMenu, { groups: [] }),
431
+ /* @__PURE__ */ jsx2(
432
+ IconButton,
433
+ {
434
+ type: "button",
435
+ size: "small",
436
+ variant: "transparent",
437
+ onClick: () => {
438
+ },
439
+ children: /* @__PURE__ */ jsx2(XMark, {})
440
+ }
441
+ )
442
+ ] })
443
+ ] });
444
+ };
445
+ var ThumbnailPreview = ({ url }) => {
446
+ if (!url) {
447
+ return null;
448
+ }
449
+ return /* @__PURE__ */ jsx2("img", { src: url, alt: "", className: "size-full object-cover object-center" });
450
+ };
451
+ function formatFileSize(bytes, decimalPlaces = 2) {
452
+ if (bytes === 0) {
453
+ return "0 Bytes";
454
+ }
455
+ const k = 1024;
456
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
457
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
458
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
459
+ }
460
+
461
+ // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
462
+ import { XMarkMini } from "@medusajs/icons";
463
+ import {
464
+ Alert,
465
+ Button,
466
+ Checkbox,
467
+ clx as clx2,
468
+ Heading,
469
+ Hint,
470
+ IconButton as IconButton3,
471
+ InlineTip,
472
+ Input as Input2,
473
+ Label,
474
+ Text as Text2
475
+ } from "@medusajs/ui";
476
+ import {
477
+ Controller,
478
+ useFieldArray as useFieldArray2,
479
+ useWatch
480
+ } from "react-hook-form";
481
+ import { useTranslation as useTranslation3 } from "react-i18next";
482
+
483
+ // src/components/common/sortable-list/sortable-list.tsx
484
+ import {
485
+ DndContext as DndContext2,
486
+ DragOverlay as DragOverlay2,
487
+ KeyboardSensor as KeyboardSensor2,
488
+ PointerSensor as PointerSensor2,
489
+ defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
490
+ useSensor as useSensor2,
491
+ useSensors as useSensors2
492
+ } from "@dnd-kit/core";
493
+ import {
494
+ SortableContext as SortableContext2,
495
+ arrayMove as arrayMove2,
496
+ sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
497
+ useSortable as useSortable2
498
+ } from "@dnd-kit/sortable";
499
+ import { CSS as CSS2 } from "@dnd-kit/utilities";
500
+ import { DotsSix as DotsSix2 } from "@medusajs/icons";
501
+ import { IconButton as IconButton2, clx } from "@medusajs/ui";
502
+ import {
503
+ Fragment,
504
+ createContext,
505
+ useContext,
506
+ useMemo,
507
+ useState as useState2
508
+ } from "react";
509
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
510
+ var List = ({
511
+ items,
512
+ onChange,
513
+ renderItem
514
+ }) => {
515
+ const [active, setActive] = useState2(null);
516
+ const [activeItem, activeIndex] = useMemo(() => {
517
+ if (active === null) {
518
+ return [null, null];
519
+ }
520
+ const index = items.findIndex(({ id }) => id === active.id);
521
+ return [items[index], index];
522
+ }, [active, items]);
523
+ const sensors = useSensors2(
524
+ useSensor2(PointerSensor2),
525
+ useSensor2(KeyboardSensor2, {
526
+ coordinateGetter: sortableKeyboardCoordinates2
527
+ })
528
+ );
529
+ const handleDragStart = ({ active: active2 }) => {
530
+ setActive(active2);
531
+ };
532
+ const handleDragEnd = ({ active: active2, over }) => {
533
+ if (over && active2.id !== over.id) {
534
+ const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
535
+ const overIndex = items.findIndex(({ id }) => id === over.id);
536
+ onChange(arrayMove2(items, activeIndex2, overIndex));
537
+ }
538
+ setActive(null);
539
+ };
540
+ const handleDragCancel = () => {
541
+ setActive(null);
542
+ };
543
+ return /* @__PURE__ */ jsxs3(
544
+ DndContext2,
545
+ {
546
+ sensors,
547
+ onDragStart: handleDragStart,
548
+ onDragEnd: handleDragEnd,
549
+ onDragCancel: handleDragCancel,
550
+ children: [
551
+ /* @__PURE__ */ jsx3(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
552
+ /* @__PURE__ */ jsx3(SortableContext2, { items, children: /* @__PURE__ */ jsx3(
553
+ "ul",
554
+ {
555
+ role: "application",
556
+ className: "flex list-inside list-none list-image-none flex-col p-0",
557
+ children: items.map((item, index) => /* @__PURE__ */ jsx3(Fragment, { children: renderItem(item, index) }, item.id))
558
+ }
559
+ ) })
560
+ ]
561
+ }
562
+ );
563
+ };
564
+ var dropAnimationConfig2 = {
565
+ sideEffects: defaultDropAnimationSideEffects2({
566
+ styles: {
567
+ active: {
568
+ opacity: "0.4"
569
+ }
570
+ }
571
+ })
572
+ };
573
+ var Overlay = ({ children }) => {
574
+ return /* @__PURE__ */ jsx3(
575
+ DragOverlay2,
576
+ {
577
+ className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
578
+ dropAnimation: dropAnimationConfig2,
579
+ children
580
+ }
581
+ );
582
+ };
583
+ var SortableItemContext = createContext(null);
584
+ var useSortableItemContext = () => {
585
+ const context = useContext(SortableItemContext);
586
+ if (!context) {
587
+ throw new Error(
588
+ "useSortableItemContext must be used within a SortableItemContext"
589
+ );
590
+ }
591
+ return context;
592
+ };
593
+ var Item = ({
594
+ id,
595
+ className,
596
+ children
597
+ }) => {
598
+ const {
599
+ attributes,
600
+ isDragging,
601
+ listeners,
602
+ setNodeRef,
603
+ setActivatorNodeRef,
604
+ transform,
605
+ transition
606
+ } = useSortable2({ id });
607
+ const context = useMemo(
608
+ () => ({
609
+ attributes,
610
+ listeners,
611
+ ref: setActivatorNodeRef,
612
+ isDragging
613
+ }),
614
+ [attributes, listeners, setActivatorNodeRef, isDragging]
615
+ );
616
+ const style = {
617
+ opacity: isDragging ? 0.4 : void 0,
618
+ transform: CSS2.Translate.toString(transform),
619
+ transition
620
+ };
621
+ return /* @__PURE__ */ jsx3(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx3(
622
+ "li",
623
+ {
624
+ className: clx("transition-fg flex flex-1 list-none", className),
625
+ ref: setNodeRef,
626
+ style,
627
+ children
628
+ }
629
+ ) });
630
+ };
631
+ var DragHandle = () => {
632
+ const { attributes, listeners, ref } = useSortableItemContext();
633
+ return /* @__PURE__ */ jsx3(
634
+ IconButton2,
635
+ {
636
+ variant: "transparent",
637
+ size: "small",
638
+ ...attributes,
639
+ ...listeners,
640
+ ref,
641
+ className: "cursor-grab touch-none active:cursor-grabbing",
642
+ children: /* @__PURE__ */ jsx3(DotsSix2, { className: "text-ui-fg-muted" })
643
+ }
644
+ );
645
+ };
646
+ var SortableList = Object.assign(List, {
647
+ Item,
648
+ DragHandle
649
+ });
650
+
651
+ // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
652
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
653
+ var getPermutations = (data) => {
654
+ if (data.length === 0) {
655
+ return [];
656
+ }
657
+ if (data.length === 1) {
658
+ return data[0].values.map((value) => ({ [data[0].title]: value }));
659
+ }
660
+ const toProcess = data[0];
661
+ const rest = data.slice(1);
662
+ return toProcess.values.flatMap((value) => {
663
+ return getPermutations(rest).map((permutation) => {
664
+ return {
665
+ [toProcess.title]: value,
666
+ ...permutation
667
+ };
668
+ });
669
+ });
670
+ };
671
+ var getVariantName = (options) => {
672
+ return Object.values(options).join(" / ");
673
+ };
674
+ var ProductCreateVariantsSection = () => {
675
+ const form = useTabbedForm();
676
+ const { t } = useTranslation3();
677
+ const options = useFieldArray2({
678
+ control: form.control,
679
+ name: "options"
680
+ });
681
+ const variants = useFieldArray2({
682
+ control: form.control,
683
+ name: "variants"
684
+ });
685
+ const watchedAreVariantsEnabled = useWatch({
686
+ control: form.control,
687
+ name: "enable_variants",
688
+ defaultValue: false
689
+ });
690
+ const watchedOptions = useWatch({
691
+ control: form.control,
692
+ name: "options",
693
+ defaultValue: []
694
+ });
695
+ const watchedVariants = useWatch({
696
+ control: form.control,
697
+ name: "variants",
698
+ defaultValue: []
699
+ });
700
+ const showInvalidOptionsMessage = !!form.formState.errors.options?.length;
701
+ const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
702
+ const handleOptionValueUpdate = (index, value) => {
703
+ const { isTouched: hasUserSelectedVariants } = form.getFieldState("variants");
704
+ const newOptions = [...watchedOptions];
705
+ newOptions[index].values = value;
706
+ const permutations = getPermutations(
707
+ newOptions.filter(({ values }) => values.length)
708
+ );
709
+ const oldVariants = [...watchedVariants];
710
+ const findMatchingPermutation = (options2) => {
711
+ return permutations.find(
712
+ (permutation) => Object.keys(options2).every((key) => options2[key] === permutation[key])
713
+ );
714
+ };
715
+ const newVariants = oldVariants.reduce((variants2, variant) => {
716
+ const match = findMatchingPermutation(variant.options);
717
+ if (match) {
718
+ variants2.push({
719
+ ...variant,
720
+ title: getVariantName(match),
721
+ options: match
722
+ });
723
+ }
724
+ return variants2;
725
+ }, []);
726
+ const usedPermutations = new Set(
727
+ newVariants.map((variant) => variant.options)
728
+ );
729
+ const unusedPermutations = permutations.filter(
730
+ (permutation) => !usedPermutations.has(permutation)
731
+ );
732
+ unusedPermutations.forEach((permutation) => {
733
+ newVariants.push({
734
+ title: getVariantName(permutation),
735
+ options: permutation,
736
+ should_create: hasUserSelectedVariants ? false : true,
737
+ variant_rank: newVariants.length,
738
+ // NOTE - prepare inventory array here for now so we prevent rendering issue if we append the items later
739
+ inventory: [{ inventory_item_id: "", required_quantity: "" }]
740
+ });
741
+ });
742
+ form.setValue("variants", newVariants);
743
+ };
744
+ const handleRemoveOption = (index) => {
745
+ if (index === 0) {
746
+ return;
747
+ }
748
+ options.remove(index);
749
+ const newOptions = [...watchedOptions];
750
+ newOptions.splice(index, 1);
751
+ const validOptionTitles = new Set(newOptions.map((option) => option.title));
752
+ const permutations = getPermutations(newOptions);
753
+ const oldVariants = [...watchedVariants];
754
+ const newVariants = permutations.reduce((variants2, permutation) => {
755
+ const variant = oldVariants.find(
756
+ ({ options: options2 }) => Object.keys(options2).filter((option) => validOptionTitles.has(option)).every((key) => options2[key] === permutation[key])
757
+ );
758
+ if (variant) {
759
+ variants2.push({
760
+ ...variant,
761
+ title: variant.title,
762
+ options: permutation
763
+ });
764
+ }
765
+ return variants2;
766
+ }, []);
767
+ form.setValue("variants", newVariants);
768
+ };
769
+ const handleRankChange = (items) => {
770
+ const update = items.map((item, index) => {
771
+ const variant = watchedVariants.find((v) => v.title === item.title);
772
+ return {
773
+ id: item.id,
774
+ ...variant || item,
775
+ variant_rank: index
776
+ };
777
+ });
778
+ variants.replace(update);
779
+ };
780
+ const getCheckboxState = (variants2) => {
781
+ if (variants2.every((variant) => variant.should_create)) {
782
+ return true;
783
+ }
784
+ if (variants2.some((variant) => variant.should_create)) {
785
+ return "indeterminate";
786
+ }
787
+ return false;
788
+ };
789
+ const onCheckboxChange = (value) => {
790
+ switch (value) {
791
+ case true: {
792
+ const update = watchedVariants.map((variant) => {
793
+ return {
794
+ ...variant,
795
+ should_create: true
796
+ };
797
+ });
798
+ form.setValue("variants", update);
799
+ break;
800
+ }
801
+ case false: {
802
+ const update = watchedVariants.map((variant) => {
803
+ return {
804
+ ...variant,
805
+ should_create: false
806
+ };
807
+ });
808
+ form.setValue("variants", decorateVariantsWithDefaultValues(update));
809
+ break;
810
+ }
811
+ case "indeterminate":
812
+ break;
813
+ }
814
+ };
815
+ const createDefaultOptionAndVariant = () => {
816
+ form.setValue("options", [
817
+ {
818
+ title: "Default option",
819
+ values: ["Default option value"]
820
+ }
821
+ ]);
822
+ form.setValue(
823
+ "variants",
824
+ decorateVariantsWithDefaultValues([
825
+ {
826
+ title: "Default variant",
827
+ should_create: true,
828
+ variant_rank: 0,
829
+ options: {
830
+ "Default option": "Default option value"
831
+ },
832
+ inventory: [{ inventory_item_id: "", required_quantity: "" }],
833
+ is_default: true
834
+ }
835
+ ])
836
+ );
837
+ };
838
+ return /* @__PURE__ */ jsxs4("div", { id: "variants", className: "flex flex-col gap-y-8", "data-testid": "product-create-variants-section", children: [
839
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", "data-testid": "product-create-variants-section-header", children: [
840
+ /* @__PURE__ */ jsx4(Heading, { level: "h2", "data-testid": "product-create-variants-section-heading", children: t("products.create.variants.header") }),
841
+ /* @__PURE__ */ jsx4(
842
+ SwitchBox,
843
+ {
844
+ control: form.control,
845
+ name: "enable_variants",
846
+ label: t("products.create.variants.subHeadingTitle"),
847
+ description: t("products.create.variants.subHeadingDescription"),
848
+ "data-testid": "product-create-variants-section-enable-switch",
849
+ onCheckedChange: (checked) => {
850
+ if (checked) {
851
+ form.setValue("options", [
852
+ {
853
+ title: "",
854
+ values: []
855
+ }
856
+ ]);
857
+ form.setValue("variants", []);
858
+ } else {
859
+ createDefaultOptionAndVariant();
860
+ }
861
+ }
862
+ }
863
+ )
864
+ ] }),
865
+ watchedAreVariantsEnabled && /* @__PURE__ */ jsxs4(Fragment2, { children: [
866
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx4(
867
+ Form.Field,
868
+ {
869
+ control: form.control,
870
+ name: "options",
871
+ render: () => {
872
+ return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", children: [
873
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-x-4", children: [
874
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
875
+ /* @__PURE__ */ jsx4(Form.Label, { children: t("products.create.variants.productOptions.label") }),
876
+ /* @__PURE__ */ jsx4(Form.Hint, { children: t("products.create.variants.productOptions.hint") })
877
+ ] }),
878
+ /* @__PURE__ */ jsx4(
879
+ Button,
880
+ {
881
+ size: "small",
882
+ variant: "secondary",
883
+ type: "button",
884
+ onClick: () => {
885
+ options.append({
886
+ title: "",
887
+ values: []
888
+ });
889
+ },
890
+ "data-testid": "product-create-variants-section-add-option-button",
891
+ children: t("actions.add")
892
+ }
893
+ )
894
+ ] }),
895
+ showInvalidOptionsMessage && /* @__PURE__ */ jsx4(Alert, { dismissible: true, variant: "error", "data-testid": "product-create-variants-section-options-error", children: t("products.create.errors.options") }),
896
+ /* @__PURE__ */ jsx4("ul", { className: "flex flex-col gap-y-4", "data-testid": "product-create-variants-section-options-list", children: options.fields.map((option, index) => {
897
+ const hasError = !!form.formState.errors.options?.[index];
898
+ return /* @__PURE__ */ jsxs4(
899
+ "li",
900
+ {
901
+ className: clx2(
902
+ "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
903
+ {
904
+ "border-ui-border-error shadow-borders-error": hasError
905
+ }
906
+ ),
907
+ "data-testid": `product-create-variants-section-option-${index}`,
908
+ children: [
909
+ /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
910
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
911
+ Label,
912
+ {
913
+ size: "xsmall",
914
+ weight: "plus",
915
+ className: "text-ui-fg-subtle",
916
+ htmlFor: `options.${index}.title`,
917
+ children: t("fields.title")
918
+ }
919
+ ) }),
920
+ /* @__PURE__ */ jsx4(
921
+ Input2,
922
+ {
923
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
924
+ ...form.register(
925
+ `options.${index}.title`
926
+ ),
927
+ placeholder: t(
928
+ "products.fields.options.optionTitlePlaceholder"
929
+ ),
930
+ "data-testid": `product-create-variants-section-option-title-input-${index}`
931
+ }
932
+ ),
933
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
934
+ Label,
935
+ {
936
+ size: "xsmall",
937
+ weight: "plus",
938
+ className: "text-ui-fg-subtle",
939
+ htmlFor: `options.${index}.values`,
940
+ children: t("fields.values")
941
+ }
942
+ ) }),
943
+ /* @__PURE__ */ jsx4(
944
+ Controller,
945
+ {
946
+ control: form.control,
947
+ name: `options.${index}.values`,
948
+ render: ({
949
+ field: { onChange, ...field }
950
+ }) => {
951
+ const handleValueChange = (value) => {
952
+ handleOptionValueUpdate(index, value);
953
+ onChange(value);
954
+ };
955
+ return /* @__PURE__ */ jsx4(
956
+ ChipInput,
957
+ {
958
+ ...field,
959
+ variant: "contrast",
960
+ onChange: handleValueChange,
961
+ placeholder: t(
962
+ "products.fields.options.variantionsPlaceholder"
963
+ ),
964
+ "data-testid": `product-create-variants-section-option-values-input-${index}`
965
+ }
966
+ );
967
+ }
968
+ }
969
+ )
970
+ ] }),
971
+ /* @__PURE__ */ jsx4(
972
+ IconButton3,
973
+ {
974
+ type: "button",
975
+ size: "small",
976
+ variant: "transparent",
977
+ className: "text-ui-fg-muted",
978
+ disabled: index === 0,
979
+ onClick: () => handleRemoveOption(index),
980
+ "data-testid": `product-create-variants-section-option-remove-${index}`,
981
+ children: /* @__PURE__ */ jsx4(XMarkMini, {})
982
+ }
983
+ )
984
+ ]
985
+ },
986
+ option.id
987
+ );
988
+ }) })
989
+ ] }) });
990
+ }
991
+ }
992
+ ) }),
993
+ /* @__PURE__ */ jsx4("div", { className: "grid grid-cols-1 gap-x-4 gap-y-8", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", children: [
994
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
995
+ /* @__PURE__ */ jsx4(Label, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
996
+ /* @__PURE__ */ jsx4(Hint, { children: t("products.create.variants.productVariants.hint") })
997
+ ] }),
998
+ !showInvalidOptionsMessage && showInvalidVariantsMessage && /* @__PURE__ */ jsx4(Alert, { dismissible: true, variant: "error", "data-testid": "product-create-variants-section-variants-error", children: t("products.create.errors.variants") }),
999
+ variants.fields.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "overflow-hidden rounded-xl border", "data-testid": "product-create-variants-section-variants-list", children: [
1000
+ /* @__PURE__ */ jsxs4(
1001
+ "div",
1002
+ {
1003
+ className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
1004
+ style: {
1005
+ gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
1006
+ },
1007
+ "data-testid": "product-create-variants-section-variants-header",
1008
+ children: [
1009
+ /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
1010
+ Checkbox,
1011
+ {
1012
+ className: "relative",
1013
+ checked: getCheckboxState(watchedVariants),
1014
+ onCheckedChange: onCheckboxChange,
1015
+ "data-testid": "product-create-variants-section-variants-select-all"
1016
+ }
1017
+ ) }),
1018
+ /* @__PURE__ */ jsx4("div", {}),
1019
+ watchedOptions.map((option, index) => /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", weight: "plus", children: option.title }) }, index))
1020
+ ]
1021
+ }
1022
+ ),
1023
+ /* @__PURE__ */ jsx4(
1024
+ SortableList,
1025
+ {
1026
+ items: variants.fields,
1027
+ onChange: handleRankChange,
1028
+ renderItem: (item, index) => {
1029
+ return /* @__PURE__ */ jsx4(
1030
+ SortableList.Item,
1031
+ {
1032
+ id: item.id,
1033
+ className: clx2("bg-ui-bg-base border-b", {
1034
+ "border-b-0": index === variants.fields.length - 1
1035
+ }),
1036
+ children: /* @__PURE__ */ jsxs4(
1037
+ "div",
1038
+ {
1039
+ className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
1040
+ style: {
1041
+ gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
1042
+ },
1043
+ children: [
1044
+ /* @__PURE__ */ jsx4(
1045
+ Form.Field,
1046
+ {
1047
+ control: form.control,
1048
+ name: `variants.${index}.should_create`,
1049
+ render: ({
1050
+ field: { value, onChange, ...field }
1051
+ }) => {
1052
+ return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(
1053
+ Checkbox,
1054
+ {
1055
+ className: "relative",
1056
+ ...field,
1057
+ checked: value,
1058
+ onCheckedChange: onChange,
1059
+ "data-testid": `product-create-variants-section-variant-checkbox-${index}`
1060
+ }
1061
+ ) }) });
1062
+ }
1063
+ }
1064
+ ),
1065
+ /* @__PURE__ */ jsx4(SortableList.DragHandle, {}),
1066
+ Object.values(item.options).map((value, index2) => /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", children: value }, index2))
1067
+ ]
1068
+ }
1069
+ )
1070
+ }
1071
+ );
1072
+ }
1073
+ }
1074
+ )
1075
+ ] }) : /* @__PURE__ */ jsx4(Alert, { "data-testid": "product-create-variants-section-variants-empty-alert", children: t("products.create.variants.productVariants.alert") }),
1076
+ variants.fields.length > 0 && /* @__PURE__ */ jsx4(InlineTip, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
1077
+ ] }) })
1078
+ ] })
1079
+ ] });
1080
+ };
1081
+
1082
+ // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
1083
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1084
+ var Root = () => {
1085
+ return /* @__PURE__ */ jsx5(
1086
+ "div",
1087
+ {
1088
+ className: "flex flex-col items-center p-16",
1089
+ "data-testid": "product-create-details-form",
1090
+ children: /* @__PURE__ */ jsxs5(
1091
+ "div",
1092
+ {
1093
+ className: "flex w-full max-w-[720px] flex-col gap-y-8",
1094
+ "data-testid": "product-create-details-form-content",
1095
+ children: [
1096
+ /* @__PURE__ */ jsx5(Header, {}),
1097
+ /* @__PURE__ */ jsxs5(
1098
+ "div",
1099
+ {
1100
+ className: "flex flex-col gap-y-6",
1101
+ "data-testid": "product-create-details-form-sections",
1102
+ children: [
1103
+ /* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
1104
+ /* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
1105
+ ]
1106
+ }
1107
+ ),
1108
+ /* @__PURE__ */ jsx5(Divider, { "data-testid": "product-create-details-form-divider" }),
1109
+ /* @__PURE__ */ jsx5(ProductCreateVariantsSection, {})
1110
+ ]
1111
+ }
1112
+ )
1113
+ }
1114
+ );
1115
+ };
1116
+ Root._tabMeta = defineTabMeta({
1117
+ id: "details",
1118
+ labelKey: "products.create.tabs.details",
1119
+ validationFields: ["title", "handle", "description", "media", "options", "variants"]
1120
+ });
1121
+ var ProductCreateDetailsForm = Root;
1122
+ var Header = () => {
1123
+ const { t } = useTranslation4();
1124
+ return /* @__PURE__ */ jsx5(
1125
+ "div",
1126
+ {
1127
+ className: "flex flex-col",
1128
+ "data-testid": "product-create-details-form-header",
1129
+ children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
1130
+ }
1131
+ );
1132
+ };
1133
+
1134
+ // src/pages/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx
1135
+ import { Button as Button2, Heading as Heading3, IconButton as IconButton4, Input as Input3, Label as Label2 } from "@medusajs/ui";
1136
+ import { useFieldArray as useFieldArray3, useWatch as useWatch2 } from "react-hook-form";
1137
+ import { XMarkMini as XMarkMini2 } from "@medusajs/icons";
1138
+ import { useTranslation as useTranslation5 } from "react-i18next";
1139
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1140
+ function InventoryItemRow({
1141
+ variantIndex,
1142
+ inventoryIndex,
1143
+ inventoryItem,
1144
+ isItemOptionDisabled,
1145
+ onRemove
1146
+ }) {
1147
+ const form = useTabbedForm();
1148
+ const { t } = useTranslation5();
1149
+ const selectedInventoryItemId = useWatch2({
1150
+ control: form.control,
1151
+ name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`
1152
+ });
1153
+ const items = useComboboxData({
1154
+ queryKey: ["inventory_items"],
1155
+ defaultValueKey: "id",
1156
+ selectedValue: selectedInventoryItemId,
1157
+ queryFn: (params) => sdk.admin.inventoryItems.query(params),
1158
+ getOptions: (data) => data.inventory_items.map((item) => ({
1159
+ label: `${item.title} ${item.sku ? `(${item.sku})` : ""}`,
1160
+ value: item.id
1161
+ }))
1162
+ });
1163
+ return /* @__PURE__ */ jsxs6(
1164
+ "li",
1165
+ {
1166
+ className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
1167
+ children: [
1168
+ /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
1169
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx6(
1170
+ Label2,
1171
+ {
1172
+ size: "xsmall",
1173
+ weight: "plus",
1174
+ className: "text-ui-fg-subtle",
1175
+ htmlFor: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
1176
+ children: t("fields.item")
1177
+ }
1178
+ ) }),
1179
+ /* @__PURE__ */ jsx6(
1180
+ Form.Field,
1181
+ {
1182
+ control: form.control,
1183
+ name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
1184
+ render: ({ field }) => {
1185
+ return /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
1186
+ Combobox,
1187
+ {
1188
+ ...field,
1189
+ options: items.options.map((o) => ({
1190
+ ...o,
1191
+ disabled: isItemOptionDisabled(o, inventoryIndex)
1192
+ })),
1193
+ searchValue: items.searchValue,
1194
+ onBlur: () => items.onSearchValueChange(""),
1195
+ onSearchValueChange: items.onSearchValueChange,
1196
+ fetchNextPage: items.fetchNextPage,
1197
+ className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
1198
+ placeholder: t("products.create.inventory.itemPlaceholder")
1199
+ }
1200
+ ) }) });
1201
+ }
1202
+ }
1203
+ ),
1204
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx6(
1205
+ Label2,
1206
+ {
1207
+ size: "xsmall",
1208
+ weight: "plus",
1209
+ className: "text-ui-fg-subtle",
1210
+ htmlFor: `variants.${variantIndex}.inventory.${inventoryIndex}.required_quantity`,
1211
+ children: t("fields.quantity")
1212
+ }
1213
+ ) }),
1214
+ /* @__PURE__ */ jsx6(
1215
+ Form.Field,
1216
+ {
1217
+ control: form.control,
1218
+ name: `variants.${variantIndex}.inventory.${inventoryIndex}.required_quantity`,
1219
+ render: ({ field: { onChange, value, ...field } }) => {
1220
+ return /* @__PURE__ */ jsxs6(Form.Item, { children: [
1221
+ /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
1222
+ Input3,
1223
+ {
1224
+ type: "number",
1225
+ className: "bg-ui-bg-field-component",
1226
+ min: 0,
1227
+ value,
1228
+ onChange: (e) => {
1229
+ const value2 = e.target.value;
1230
+ if (value2 === "") {
1231
+ onChange(null);
1232
+ } else {
1233
+ onChange(Number(value2));
1234
+ }
1235
+ },
1236
+ ...field,
1237
+ placeholder: t(
1238
+ "products.create.inventory.quantityPlaceholder"
1239
+ )
1240
+ }
1241
+ ) }),
1242
+ /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1243
+ ] });
1244
+ }
1245
+ }
1246
+ )
1247
+ ] }),
1248
+ /* @__PURE__ */ jsx6(
1249
+ IconButton4,
1250
+ {
1251
+ type: "button",
1252
+ size: "small",
1253
+ variant: "transparent",
1254
+ className: "text-ui-fg-muted",
1255
+ onClick: onRemove,
1256
+ children: /* @__PURE__ */ jsx6(XMarkMini2, {})
1257
+ }
1258
+ )
1259
+ ]
1260
+ },
1261
+ inventoryItem.id
1262
+ );
1263
+ }
1264
+ function VariantSection({ variant, index }) {
1265
+ const form = useTabbedForm();
1266
+ const { t } = useTranslation5();
1267
+ const inventory = useFieldArray3({
1268
+ control: form.control,
1269
+ name: `variants.${index}.inventory`
1270
+ });
1271
+ const inventoryFormData = useWatch2({
1272
+ control: form.control,
1273
+ name: `variants.${index}.inventory`
1274
+ });
1275
+ const isItemOptionDisabled = (option, inventoryIndex) => {
1276
+ return !!inventoryFormData?.some(
1277
+ (i, index2) => index2 != inventoryIndex && i.inventory_item_id === option.value
1278
+ );
1279
+ };
1280
+ return /* @__PURE__ */ jsxs6("div", { className: "grid gap-y-4", children: [
1281
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-start justify-between gap-x-4", children: [
1282
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
1283
+ /* @__PURE__ */ jsx6(Form.Label, { children: variant.title }),
1284
+ /* @__PURE__ */ jsx6(Form.Hint, { children: t("products.create.inventory.label") })
1285
+ ] }),
1286
+ /* @__PURE__ */ jsx6(
1287
+ Button2,
1288
+ {
1289
+ size: "small",
1290
+ variant: "secondary",
1291
+ type: "button",
1292
+ onClick: () => {
1293
+ inventory.append({
1294
+ inventory_item_id: "",
1295
+ required_quantity: ""
1296
+ });
1297
+ },
1298
+ children: t("actions.add")
1299
+ }
1300
+ )
1301
+ ] }),
1302
+ inventory.fields.map((inventoryItem, inventoryIndex) => /* @__PURE__ */ jsx6(
1303
+ InventoryItemRow,
1304
+ {
1305
+ variantIndex: index,
1306
+ inventoryIndex,
1307
+ inventoryItem,
1308
+ isItemOptionDisabled,
1309
+ onRemove: () => inventory.remove(inventoryIndex)
1310
+ },
1311
+ inventoryItem.id
1312
+ ))
1313
+ ] });
1314
+ }
1315
+ var ProductCreateInventoryKitSection = () => {
1316
+ const form = useTabbedForm();
1317
+ const { t } = useTranslation5();
1318
+ const variants = useFieldArray3({
1319
+ control: form.control,
1320
+ name: "variants"
1321
+ });
1322
+ return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", children: [
1323
+ /* @__PURE__ */ jsx6(Heading3, { children: t("products.create.inventory.heading") }),
1324
+ variants.fields.filter((v) => v.inventory_kit).map((variant, variantIndex) => /* @__PURE__ */ jsx6(
1325
+ VariantSection,
1326
+ {
1327
+ variant,
1328
+ index: variantIndex
1329
+ },
1330
+ variant.id
1331
+ ))
1332
+ ] });
1333
+ };
1334
+
1335
+ // src/pages/products/product-create/components/product-create-inventory-kit-form/product-create-inventory-kit-form.tsx
1336
+ import { jsx as jsx7 } from "react/jsx-runtime";
1337
+ var Root2 = () => {
1338
+ return /* @__PURE__ */ jsx7("div", { className: "flex flex-col items-center p-16", "data-testid": "product-create-inventory-kit-form", children: /* @__PURE__ */ jsx7("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", "data-testid": "product-create-inventory-kit-form-content", children: /* @__PURE__ */ jsx7(ProductCreateInventoryKitSection, {}) }) });
1339
+ };
1340
+ Root2._tabMeta = defineTabMeta({
1341
+ id: "inventory",
1342
+ labelKey: "products.create.tabs.inventory",
1343
+ validationFields: ["variants"]
1344
+ });
1345
+ var ProductCreateInventoryKitForm = Root2;
1346
+
1347
+ // src/pages/products/product-create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
1348
+ import { Button as Button3, Heading as Heading4 } from "@medusajs/ui";
1349
+ import { useFieldArray as useFieldArray4 } from "react-hook-form";
1350
+ import { Trans, useTranslation as useTranslation6 } from "react-i18next";
1351
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1352
+ var ProductCreateOrganizationSection = () => {
1353
+ const form = useTabbedForm();
1354
+ const { t } = useTranslation6();
1355
+ const sellers = useComboboxData({
1356
+ queryKey: ["sellers"],
1357
+ queryFn: (params) => sdk.admin.sellers.query({ fetchOptions: { method: "GET" }, ...params }),
1358
+ getOptions: (data) => data.sellers.map((seller) => ({
1359
+ label: seller.name,
1360
+ value: seller.id
1361
+ }))
1362
+ });
1363
+ const collections = useComboboxData({
1364
+ queryKey: ["product_collections"],
1365
+ queryFn: (params) => sdk.admin.collections.query(params),
1366
+ getOptions: (data) => data.collections.map((collection) => ({
1367
+ label: collection.title,
1368
+ value: collection.id
1369
+ }))
1370
+ });
1371
+ const types = useComboboxData({
1372
+ queryKey: ["product_types"],
1373
+ queryFn: (params) => sdk.admin.productTypes.query(params),
1374
+ getOptions: (data) => data.product_types.map((type) => ({
1375
+ label: type.value,
1376
+ value: type.id
1377
+ }))
1378
+ });
1379
+ const tags = useComboboxData({
1380
+ queryKey: ["product_tags"],
1381
+ queryFn: (params) => sdk.admin.productTags.query(params),
1382
+ getOptions: (data) => data.product_tags.map((tag) => ({
1383
+ label: tag.value,
1384
+ value: tag.id
1385
+ }))
1386
+ });
1387
+ const shippingProfiles = useComboboxData({
1388
+ queryKey: ["shipping_profiles"],
1389
+ queryFn: (params) => sdk.admin.shippingProfiles.query(params),
1390
+ getOptions: (data) => data.shipping_profiles.map((shippingProfile) => ({
1391
+ label: shippingProfile.name,
1392
+ value: shippingProfile.id
1393
+ }))
1394
+ });
1395
+ const { fields, remove, replace } = useFieldArray4({
1396
+ control: form.control,
1397
+ name: "sales_channels",
1398
+ keyName: "key"
1399
+ });
1400
+ const handleClearAllSalesChannels = () => {
1401
+ replace([]);
1402
+ };
1403
+ return /* @__PURE__ */ jsxs7("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
1404
+ /* @__PURE__ */ jsx8(Heading4, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
1405
+ /* @__PURE__ */ jsx8(
1406
+ SwitchBox,
1407
+ {
1408
+ control: form.control,
1409
+ name: "discountable",
1410
+ label: t("products.fields.discountable.label"),
1411
+ description: t("products.fields.discountable.hint"),
1412
+ optional: true,
1413
+ "data-testid": "product-create-organize-section-discountable-switch"
1414
+ }
1415
+ ),
1416
+ /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: /* @__PURE__ */ jsx8(
1417
+ Form.Field,
1418
+ {
1419
+ control: form.control,
1420
+ name: "seller_id",
1421
+ render: ({ field }) => {
1422
+ return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1423
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: "Seller" }),
1424
+ /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1425
+ Combobox,
1426
+ {
1427
+ ...field,
1428
+ options: sellers.options,
1429
+ searchValue: sellers.searchValue,
1430
+ onSearchValueChange: sellers.onSearchValueChange,
1431
+ fetchNextPage: sellers.fetchNextPage
1432
+ }
1433
+ ) }),
1434
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1435
+ ] });
1436
+ }
1437
+ }
1438
+ ) }),
1439
+ /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-collection", children: [
1440
+ /* @__PURE__ */ jsx8(
1441
+ Form.Field,
1442
+ {
1443
+ control: form.control,
1444
+ name: "type_id",
1445
+ render: ({ field }) => {
1446
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1447
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1448
+ /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx8(
1449
+ Combobox,
1450
+ {
1451
+ ...field,
1452
+ options: types.options,
1453
+ searchValue: types.searchValue,
1454
+ onSearchValueChange: types.onSearchValueChange,
1455
+ fetchNextPage: types.fetchNextPage,
1456
+ "data-testid": "product-create-organize-section-type-input"
1457
+ }
1458
+ ) }),
1459
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1460
+ ] });
1461
+ }
1462
+ }
1463
+ ),
1464
+ /* @__PURE__ */ jsx8(
1465
+ Form.Field,
1466
+ {
1467
+ control: form.control,
1468
+ name: "collection_id",
1469
+ render: ({ field }) => {
1470
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1471
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1472
+ /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx8(
1473
+ Combobox,
1474
+ {
1475
+ ...field,
1476
+ options: collections.options,
1477
+ searchValue: collections.searchValue,
1478
+ onSearchValueChange: collections.onSearchValueChange,
1479
+ fetchNextPage: collections.fetchNextPage,
1480
+ "data-testid": "product-create-organize-section-collection-input"
1481
+ }
1482
+ ) }),
1483
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1484
+ ] });
1485
+ }
1486
+ }
1487
+ )
1488
+ ] }),
1489
+ /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-categories-tags", children: [
1490
+ /* @__PURE__ */ jsx8(
1491
+ Form.Field,
1492
+ {
1493
+ control: form.control,
1494
+ name: "categories",
1495
+ render: ({ field }) => {
1496
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-categories-item", children: [
1497
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-categories-label", children: t("products.fields.categories.label") }),
1498
+ /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-categories-control", children: /* @__PURE__ */ jsx8(CategoryCombobox, { ...field, "data-testid": "product-create-organize-section-categories-input" }) }),
1499
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1500
+ ] });
1501
+ }
1502
+ }
1503
+ ),
1504
+ /* @__PURE__ */ jsx8(
1505
+ Form.Field,
1506
+ {
1507
+ control: form.control,
1508
+ name: "tags",
1509
+ render: ({ field }) => {
1510
+ return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1511
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1512
+ /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx8(
1513
+ Combobox,
1514
+ {
1515
+ ...field,
1516
+ options: tags.options,
1517
+ searchValue: tags.searchValue,
1518
+ onSearchValueChange: tags.onSearchValueChange,
1519
+ fetchNextPage: tags.fetchNextPage,
1520
+ "data-testid": "product-create-organize-section-tags-input"
1521
+ }
1522
+ ) }),
1523
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1524
+ ] });
1525
+ }
1526
+ }
1527
+ )
1528
+ ] }),
1529
+ /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
1530
+ /* @__PURE__ */ jsxs7("div", { children: [
1531
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: t("products.fields.shipping_profile.label") }),
1532
+ /* @__PURE__ */ jsx8(Form.Hint, { children: /* @__PURE__ */ jsx8(Trans, { i18nKey: "products.fields.shipping_profile.hint" }) })
1533
+ ] }),
1534
+ /* @__PURE__ */ jsx8(
1535
+ Form.Field,
1536
+ {
1537
+ control: form.control,
1538
+ name: "shipping_profile_id",
1539
+ render: ({ field }) => {
1540
+ return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1541
+ /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1542
+ Combobox,
1543
+ {
1544
+ ...field,
1545
+ options: shippingProfiles.options,
1546
+ searchValue: shippingProfiles.searchValue,
1547
+ onSearchValueChange: shippingProfiles.onSearchValueChange,
1548
+ fetchNextPage: shippingProfiles.fetchNextPage
1549
+ }
1550
+ ) }),
1551
+ /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1552
+ ] });
1553
+ }
1554
+ }
1555
+ )
1556
+ ] }),
1557
+ /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-1 gap-y-4", children: /* @__PURE__ */ jsx8(
1558
+ Form.Field,
1559
+ {
1560
+ control: form.control,
1561
+ name: "sales_channels",
1562
+ render: () => {
1563
+ return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1564
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-x-4", children: [
1565
+ /* @__PURE__ */ jsxs7("div", { children: [
1566
+ /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: t("products.fields.sales_channels.label") }),
1567
+ /* @__PURE__ */ jsx8(Form.Hint, { children: /* @__PURE__ */ jsx8(Trans, { i18nKey: "products.fields.sales_channels.hint" }) })
1568
+ ] }),
1569
+ /* @__PURE__ */ jsx8(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx8(Button3, { size: "small", variant: "secondary", type: "button", "data-testid": "product-create-organize-section-sales-channels-add-button", children: t("actions.add") }) })
1570
+ ] }),
1571
+ /* @__PURE__ */ jsx8(Form.Control, { className: "mt-0", children: fields.length > 0 && /* @__PURE__ */ jsx8(
1572
+ ChipGroup,
1573
+ {
1574
+ onClearAll: handleClearAllSalesChannels,
1575
+ onRemove: remove,
1576
+ className: "py-4",
1577
+ children: fields.map((field, index) => /* @__PURE__ */ jsx8(ChipGroup.Chip, { index, children: field.name }, field.key))
1578
+ }
1579
+ ) })
1580
+ ] });
1581
+ }
1582
+ }
1583
+ ) })
1584
+ ] });
1585
+ };
1586
+
1587
+ // src/pages/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
1588
+ import {
1589
+ Button as Button4,
1590
+ createDataTableColumnHelper
1591
+ } from "@medusajs/ui";
1592
+ import { useEffect, useMemo as useMemo2, useState as useState3 } from "react";
1593
+ import { useTranslation as useTranslation7 } from "react-i18next";
1594
+ import { keepPreviousData } from "@tanstack/react-query";
1595
+
1596
+ // src/pages/products/product-create/components/product-create-organize-form/constants.ts
1597
+ var SC_STACKED_MODAL_ID = "sc";
1598
+
1599
+ // src/pages/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
1600
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1601
+ var PAGE_SIZE = 20;
1602
+ var ProductCreateSalesChannelStackedModal = () => {
1603
+ const form = useTabbedForm();
1604
+ const { t } = useTranslation7();
1605
+ const { getValues, setValue } = form;
1606
+ const { setIsOpen, getIsOpen } = useStackedModal();
1607
+ const [rowSelection, setRowSelection] = useState3(
1608
+ {}
1609
+ );
1610
+ const [state, setState] = useState3([]);
1611
+ const searchParams = useSalesChannelTableQuery({
1612
+ pageSize: PAGE_SIZE,
1613
+ prefix: SC_STACKED_MODAL_ID
1614
+ });
1615
+ const { sales_channels, count, isLoading, isError, error } = useSalesChannels(
1616
+ searchParams,
1617
+ {
1618
+ placeholderData: keepPreviousData
1619
+ }
1620
+ );
1621
+ const open = getIsOpen(SC_STACKED_MODAL_ID);
1622
+ useEffect(() => {
1623
+ if (!open) {
1624
+ return;
1625
+ }
1626
+ const salesChannels = getValues("sales_channels");
1627
+ if (salesChannels) {
1628
+ setState(
1629
+ salesChannels.map((channel) => ({
1630
+ id: channel.id,
1631
+ name: channel.name
1632
+ }))
1633
+ );
1634
+ setRowSelection(
1635
+ salesChannels.reduce(
1636
+ (acc, channel) => ({
1637
+ ...acc,
1638
+ [channel.id]: true
1639
+ }),
1640
+ {}
1641
+ )
1642
+ );
1643
+ }
1644
+ }, [open, getValues]);
1645
+ const onRowSelectionChange = (state2) => {
1646
+ const ids = Object.keys(state2);
1647
+ const addedIdsSet = new Set(
1648
+ ids.filter((id) => state2[id] && !rowSelection[id])
1649
+ );
1650
+ let addedSalesChannels = [];
1651
+ if (addedIdsSet.size > 0) {
1652
+ addedSalesChannels = sales_channels?.filter((channel) => addedIdsSet.has(channel.id)) ?? [];
1653
+ }
1654
+ setState((prev) => {
1655
+ const filteredPrev = prev.filter((channel) => state2[channel.id]);
1656
+ return Array.from(/* @__PURE__ */ new Set([...filteredPrev, ...addedSalesChannels]));
1657
+ });
1658
+ setRowSelection(state2);
1659
+ };
1660
+ const handleAdd = () => {
1661
+ setValue("sales_channels", state, {
1662
+ shouldDirty: true,
1663
+ shouldTouch: true
1664
+ });
1665
+ setIsOpen(SC_STACKED_MODAL_ID, false);
1666
+ };
1667
+ const filters = useSalesChannelTableFilters();
1668
+ const columns = useColumns();
1669
+ const emptyState = useSalesChannelTableEmptyState();
1670
+ if (isError) {
1671
+ throw error;
1672
+ }
1673
+ return /* @__PURE__ */ jsxs8(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
1674
+ /* @__PURE__ */ jsx9(StackedFocusModal.Header, {}),
1675
+ /* @__PURE__ */ jsx9(StackedFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx9(
1676
+ DataTable,
1677
+ {
1678
+ data: sales_channels,
1679
+ columns,
1680
+ filters,
1681
+ emptyState,
1682
+ rowCount: count,
1683
+ pageSize: PAGE_SIZE,
1684
+ getRowId: (row) => row.id,
1685
+ rowSelection: {
1686
+ state: rowSelection,
1687
+ onRowSelectionChange
1688
+ },
1689
+ isLoading,
1690
+ layout: "fill",
1691
+ prefix: SC_STACKED_MODAL_ID
1692
+ }
1693
+ ) }),
1694
+ /* @__PURE__ */ jsx9(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-end gap-x-2", children: [
1695
+ /* @__PURE__ */ jsx9(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(Button4, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
1696
+ /* @__PURE__ */ jsx9(Button4, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
1697
+ ] }) })
1698
+ ] });
1699
+ };
1700
+ var columnHelper = createDataTableColumnHelper();
1701
+ var useColumns = () => {
1702
+ const base = useSalesChannelTableColumns();
1703
+ return useMemo2(() => [columnHelper.select(), ...base], [base]);
1704
+ };
1705
+
1706
+ // src/pages/products/product-create/components/product-create-organize-form/product-create-organize-form.tsx
1707
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1708
+ var Root3 = () => {
1709
+ return /* @__PURE__ */ jsxs9(StackedFocusModal, { id: SC_STACKED_MODAL_ID, children: [
1710
+ /* @__PURE__ */ jsx10(
1711
+ "div",
1712
+ {
1713
+ className: "flex flex-col items-center p-16",
1714
+ "data-testid": "product-create-organize-form",
1715
+ children: /* @__PURE__ */ jsx10(
1716
+ "div",
1717
+ {
1718
+ className: "flex w-full max-w-[720px] flex-col gap-y-8",
1719
+ "data-testid": "product-create-organize-form-content",
1720
+ children: /* @__PURE__ */ jsx10(ProductCreateOrganizationSection, {})
1721
+ }
1722
+ )
1723
+ }
1724
+ ),
1725
+ /* @__PURE__ */ jsx10(ProductCreateSalesChannelStackedModal, {})
1726
+ ] });
1727
+ };
1728
+ Root3._tabMeta = defineTabMeta({
1729
+ id: "organize",
1730
+ labelKey: "products.create.tabs.organize",
1731
+ validationFields: [
1732
+ "type_id",
1733
+ "collection_id",
1734
+ "categories",
1735
+ "tags",
1736
+ "sales_channels",
1737
+ "shipping_profile_id",
1738
+ "origin_country",
1739
+ "material",
1740
+ "width",
1741
+ "length",
1742
+ "height",
1743
+ "weight",
1744
+ "mid_code",
1745
+ "hs_code"
1746
+ ]
1747
+ });
1748
+ var ProductCreateOrganizeForm = Root3;
1749
+
1750
+ // src/pages/products/product-create/components/product-create-variants-form/product-create-variants-form.tsx
1751
+ import { useMemo as useMemo3 } from "react";
1752
+ import { useWatch as useWatch3 } from "react-hook-form";
1753
+ import { useTranslation as useTranslation8 } from "react-i18next";
1754
+ import { jsx as jsx11 } from "react/jsx-runtime";
1755
+ var Root4 = () => {
1756
+ const form = useTabbedForm();
1757
+ const { setCloseOnEscape } = useRouteModal();
1758
+ const { store } = useStore({
1759
+ fields: "+default_sales_channel"
1760
+ });
1761
+ const { regions } = useRegions({ limit: 9999 });
1762
+ const { price_preferences: pricePreferences } = usePricePreferences({
1763
+ limit: 9999
1764
+ });
1765
+ const currencyCodes = useMemo3(
1766
+ () => store?.supported_currencies?.map((c) => c.currency_code) || [],
1767
+ [store]
1768
+ );
1769
+ const variants = useWatch3({
1770
+ control: form.control,
1771
+ name: "variants",
1772
+ defaultValue: []
1773
+ });
1774
+ const options = useWatch3({
1775
+ control: form.control,
1776
+ name: "options",
1777
+ defaultValue: []
1778
+ });
1779
+ const columns = useColumns2({
1780
+ options,
1781
+ currencies: currencyCodes,
1782
+ regions: regions ?? [],
1783
+ pricePreferences: pricePreferences ?? []
1784
+ });
1785
+ const variantData = useMemo3(() => {
1786
+ const ret = [];
1787
+ variants.forEach((v, i) => {
1788
+ if (v.should_create) {
1789
+ ret.push({ ...v, originalIndex: i });
1790
+ }
1791
+ });
1792
+ return ret;
1793
+ }, [variants]);
1794
+ return /* @__PURE__ */ jsx11("div", { className: "flex size-full flex-col divide-y overflow-hidden", "data-testid": "product-create-variants-form", children: /* @__PURE__ */ jsx11("div", { "data-testid": "product-create-variants-form-datagrid", children: /* @__PURE__ */ jsx11(
1795
+ DataGrid,
1796
+ {
1797
+ columns,
1798
+ data: variantData,
1799
+ state: form,
1800
+ onEditingChange: (editing) => setCloseOnEscape(!editing)
1801
+ }
1802
+ ) }) });
1803
+ };
1804
+ Root4._tabMeta = defineTabMeta({
1805
+ id: "variants",
1806
+ labelKey: "products.create.tabs.variants",
1807
+ validationFields: ["variants"]
1808
+ });
1809
+ var ProductCreateVariantsForm = Root4;
1810
+ var columnHelper2 = createDataGridHelper();
1811
+ var useColumns2 = ({
1812
+ options,
1813
+ currencies = [],
1814
+ regions = [],
1815
+ pricePreferences = []
1816
+ }) => {
1817
+ const { t } = useTranslation8();
1818
+ return useMemo3(
1819
+ () => [
1820
+ columnHelper2.column({
1821
+ id: "options",
1822
+ header: () => /* @__PURE__ */ jsx11("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx11("span", { className: "truncate", children: options.map((o) => o.title).join(" / ") }) }),
1823
+ cell: (context) => {
1824
+ return /* @__PURE__ */ jsx11(DataGrid.ReadonlyCell, { context, children: options.map((o) => context.row.original.options[o.title]).join(" / ") });
1825
+ },
1826
+ disableHiding: true
1827
+ }),
1828
+ columnHelper2.column({
1829
+ id: "title",
1830
+ name: t("fields.title"),
1831
+ header: t("fields.title"),
1832
+ field: (context) => `variants.${context.row.original.originalIndex}.title`,
1833
+ type: "text",
1834
+ cell: (context) => {
1835
+ return /* @__PURE__ */ jsx11(DataGrid.TextCell, { context });
1836
+ }
1837
+ }),
1838
+ columnHelper2.column({
1839
+ id: "sku",
1840
+ name: t("fields.sku"),
1841
+ header: t("fields.sku"),
1842
+ field: (context) => `variants.${context.row.original.originalIndex}.sku`,
1843
+ type: "text",
1844
+ cell: (context) => {
1845
+ return /* @__PURE__ */ jsx11(DataGrid.TextCell, { context });
1846
+ }
1847
+ }),
1848
+ columnHelper2.column({
1849
+ id: "manage_inventory",
1850
+ name: t("fields.managedInventory"),
1851
+ header: t("fields.managedInventory"),
1852
+ field: (context) => `variants.${context.row.original.originalIndex}.manage_inventory`,
1853
+ type: "boolean",
1854
+ cell: (context) => {
1855
+ return /* @__PURE__ */ jsx11(DataGrid.BooleanCell, { context });
1856
+ }
1857
+ }),
1858
+ columnHelper2.column({
1859
+ id: "allow_backorder",
1860
+ name: t("fields.allowBackorder"),
1861
+ header: t("fields.allowBackorder"),
1862
+ field: (context) => `variants.${context.row.original.originalIndex}.allow_backorder`,
1863
+ type: "boolean",
1864
+ cell: (context) => {
1865
+ return /* @__PURE__ */ jsx11(DataGrid.BooleanCell, { context });
1866
+ }
1867
+ }),
1868
+ columnHelper2.column({
1869
+ id: "inventory_kit",
1870
+ name: t("fields.inventoryKit"),
1871
+ header: t("fields.inventoryKit"),
1872
+ field: (context) => `variants.${context.row.original.originalIndex}.inventory_kit`,
1873
+ type: "boolean",
1874
+ cell: (context) => {
1875
+ return /* @__PURE__ */ jsx11(
1876
+ DataGrid.BooleanCell,
1877
+ {
1878
+ context,
1879
+ disabled: !context.row.original.manage_inventory
1880
+ }
1881
+ );
1882
+ }
1883
+ }),
1884
+ ...createDataGridPriceColumns({
1885
+ currencies,
1886
+ regions,
1887
+ pricePreferences,
1888
+ getFieldName: (context, value) => {
1889
+ if (context.column.id?.startsWith("currency_prices")) {
1890
+ return `variants.${context.row.original.originalIndex}.prices.${value}`;
1891
+ }
1892
+ return `variants.${context.row.original.originalIndex}.prices.${value}`;
1893
+ },
1894
+ t
1895
+ })
1896
+ ],
1897
+ [currencies, regions, options, pricePreferences, t]
1898
+ );
1899
+ };
1900
+
1901
+ // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
1902
+ import { zodResolver } from "@hookform/resolvers/zod";
1903
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1904
+ var SAVE_DRAFT_BUTTON = "save-draft-button";
1905
+ var ProductCreateForm = ({
1906
+ defaultChannel,
1907
+ children,
1908
+ schema,
1909
+ defaultValues: extraDefaults
1910
+ }) => {
1911
+ const { t } = useTranslation9();
1912
+ const { handleSuccess } = useRouteModal();
1913
+ const form = useForm({
1914
+ defaultValues: {
1915
+ ...PRODUCT_CREATE_FORM_DEFAULTS,
1916
+ ...extraDefaults,
1917
+ sales_channels: defaultChannel ? [{ id: defaultChannel.id, name: defaultChannel.name }] : []
1918
+ },
1919
+ resolver: zodResolver(schema ?? ProductCreateSchema)
1920
+ });
1921
+ const { mutateAsync, isPending } = useCreateProduct();
1922
+ const {
1923
+ regions,
1924
+ isPending: isRegionsPending,
1925
+ isError: isRegionsError,
1926
+ error: regionsError
1927
+ } = useRegions({ limit: 9999 });
1928
+ if (isRegionsError) {
1929
+ throw regionsError;
1930
+ }
1931
+ const regionsCurrencyMap = useMemo4(() => {
1932
+ if (!regions?.length) {
1933
+ return {};
1934
+ }
1935
+ return regions.reduce(
1936
+ (acc, reg) => {
1937
+ acc[reg.id] = reg.currency_code;
1938
+ return acc;
1939
+ },
1940
+ {}
1941
+ );
1942
+ }, [regions]);
1943
+ const watchedVariants = useWatch4({
1944
+ control: form.control,
1945
+ name: "variants"
1946
+ });
1947
+ const handleSubmit = form.handleSubmit(async (values, e) => {
1948
+ if (isRegionsPending) {
1949
+ return;
1950
+ }
1951
+ let isDraftSubmission = false;
1952
+ if (e?.nativeEvent instanceof SubmitEvent) {
1953
+ const submitter = e?.nativeEvent?.submitter;
1954
+ isDraftSubmission = submitter.dataset.name === SAVE_DRAFT_BUTTON;
1955
+ }
1956
+ const media = values.media || [];
1957
+ const payload = { ...values, media: void 0 };
1958
+ let uploadedMedia = [];
1959
+ try {
1960
+ if (media.length) {
1961
+ const thumbnailReq = media.find((m) => m.isThumbnail);
1962
+ const otherMediaReq = media.filter((m) => !m.isThumbnail);
1963
+ const fileReqs = [];
1964
+ if (thumbnailReq) {
1965
+ fileReqs.push(
1966
+ sdk.admin.uploads.mutate({ files: [thumbnailReq.file] }).then((r) => r.files.map((f) => ({ ...f, isThumbnail: true })))
1967
+ );
1968
+ }
1969
+ if (otherMediaReq?.length) {
1970
+ fileReqs.push(
1971
+ sdk.admin.uploads.mutate({
1972
+ files: otherMediaReq.map((m) => m.file)
1973
+ }).then((r) => r.files.map((f) => ({ ...f, isThumbnail: false })))
1974
+ );
1975
+ }
1976
+ uploadedMedia = (await Promise.all(fileReqs)).flat();
1977
+ }
1978
+ } catch (error) {
1979
+ if (error instanceof Error) {
1980
+ toast.error(error.message);
1981
+ }
1982
+ }
1983
+ await mutateAsync(
1984
+ normalizeProductFormValues({
1985
+ ...payload,
1986
+ media: uploadedMedia,
1987
+ status: isDraftSubmission ? "draft" : "published",
1988
+ regionsCurrencyMap
1989
+ }),
1990
+ {
1991
+ onSuccess: (data) => {
1992
+ toast.success(
1993
+ t("products.create.successToast", {
1994
+ title: data.product.title
1995
+ })
1996
+ );
1997
+ handleSuccess(`../${data.product.id}`);
1998
+ },
1999
+ onError: (error) => {
2000
+ toast.error(error.message);
2001
+ }
2002
+ }
2003
+ );
2004
+ });
2005
+ const transformTabs = useCallback(
2006
+ (tabs) => {
2007
+ const showInventoryTab = watchedVariants?.some(
2008
+ (v) => v.manage_inventory && v.inventory_kit
2009
+ ) ?? false;
2010
+ return tabs.map((tab) => {
2011
+ if (tab.id === "inventory") {
2012
+ return {
2013
+ ...tab,
2014
+ isVisible: () => showInventoryTab
2015
+ };
2016
+ }
2017
+ return tab;
2018
+ });
2019
+ },
2020
+ [watchedVariants]
2021
+ );
2022
+ const defaultTabs = useMemo4(
2023
+ () => [
2024
+ /* @__PURE__ */ jsx12(ProductCreateDetailsForm, {}, "details"),
2025
+ /* @__PURE__ */ jsx12(ProductCreateOrganizeForm, {}, "organize"),
2026
+ /* @__PURE__ */ jsx12(ProductCreateVariantsForm, {}, "variants"),
2027
+ /* @__PURE__ */ jsx12(ProductCreateInventoryKitForm, {}, "inventory")
2028
+ ],
2029
+ []
2030
+ );
2031
+ const hasCustomChildren = Children.count(children) > 0;
2032
+ return /* @__PURE__ */ jsx12(
2033
+ TabbedForm,
2034
+ {
2035
+ form,
2036
+ onSubmit: handleSubmit,
2037
+ isLoading: isPending || isRegionsPending,
2038
+ transformTabs,
2039
+ footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs10(
2040
+ "div",
2041
+ {
2042
+ className: "flex items-center justify-end gap-x-2",
2043
+ "data-testid": "product-create-form-footer-actions",
2044
+ children: [
2045
+ /* @__PURE__ */ jsx12(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx12(
2046
+ Button5,
2047
+ {
2048
+ variant: "secondary",
2049
+ size: "small",
2050
+ "data-testid": "product-create-form-cancel-button",
2051
+ children: t("actions.cancel")
2052
+ }
2053
+ ) }),
2054
+ /* @__PURE__ */ jsx12(
2055
+ Button5,
2056
+ {
2057
+ "data-name": SAVE_DRAFT_BUTTON,
2058
+ size: "small",
2059
+ type: "submit",
2060
+ isLoading,
2061
+ className: "whitespace-nowrap",
2062
+ "data-testid": "product-create-form-save-draft-button",
2063
+ children: t("actions.saveAsDraft")
2064
+ }
2065
+ ),
2066
+ isLastTab ? /* @__PURE__ */ jsx12(
2067
+ Button5,
2068
+ {
2069
+ "data-name": "publish-button",
2070
+ type: "submit",
2071
+ variant: "primary",
2072
+ size: "small",
2073
+ isLoading,
2074
+ "data-testid": "product-create-form-publish-button",
2075
+ children: t("actions.publish")
2076
+ },
2077
+ "submit-button"
2078
+ ) : /* @__PURE__ */ jsx12(
2079
+ Button5,
2080
+ {
2081
+ type: "button",
2082
+ variant: "primary",
2083
+ size: "small",
2084
+ onClick: () => onNext(),
2085
+ "data-testid": "product-create-form-continue-button",
2086
+ children: t("actions.continue")
2087
+ },
2088
+ "next-button"
2089
+ )
2090
+ ]
2091
+ }
2092
+ ),
2093
+ children: hasCustomChildren ? children : defaultTabs
2094
+ }
2095
+ );
2096
+ };
2097
+
2098
+ // src/pages/products/product-create/product-create.tsx
2099
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2100
+ var Root5 = ({ children }) => {
2101
+ const { t } = useTranslation10();
2102
+ const {
2103
+ store,
2104
+ isPending: isStorePending,
2105
+ isError: isStoreError,
2106
+ error: storeError
2107
+ } = useStore({
2108
+ fields: "+default_sales_channel"
2109
+ });
2110
+ const {
2111
+ sales_channel,
2112
+ isPending: isSalesChannelPending,
2113
+ isError: isSalesChannelError,
2114
+ error: salesChannelError
2115
+ } = useSalesChannel(store?.default_sales_channel_id, {
2116
+ enabled: !!store?.default_sales_channel_id
2117
+ });
2118
+ const ready = !!store && !isStorePending && !!sales_channel && !isSalesChannelPending;
2119
+ if (isStoreError) {
2120
+ throw storeError;
2121
+ }
2122
+ if (isSalesChannelError) {
2123
+ throw salesChannelError;
2124
+ }
2125
+ return /* @__PURE__ */ jsxs11(RouteFocusModal, { children: [
2126
+ /* @__PURE__ */ jsx13(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: t("products.create.title") }) }),
2127
+ /* @__PURE__ */ jsx13(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: t("products.create.description") }) }),
2128
+ ready && (Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx13(ProductCreateForm, { defaultChannel: sales_channel }))
2129
+ ] });
2130
+ };
2131
+ var ProductCreate = Root5;
2132
+ var ProductCreatePage = Object.assign(Root5, {
2133
+ Form: ProductCreateForm,
2134
+ DetailsTab: ProductCreateDetailsForm,
2135
+ OrganizeTab: ProductCreateOrganizeForm,
2136
+ VariantsTab: ProductCreateVariantsForm,
2137
+ InventoryTab: ProductCreateInventoryKitForm,
2138
+ Tab: TabbedForm.Tab
2139
+ });
2140
+
2141
+ export {
2142
+ ProductCreate,
2143
+ ProductCreatePage
2144
+ };