@mercurjs/admin 2.1.2 → 2.2.0-canary.1

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 (336) hide show
  1. package/dist/[id]-YI7UXOO2.js +499 -0
  2. package/dist/{add-campaign-promotions-6Z2STQT4.js → add-campaign-promotions-OLNTDP26.js} +14 -16
  3. package/dist/{adjust-inventory-NVBPZYOF.js → adjust-inventory-CVWSBMHU.js} +13 -12
  4. package/dist/{api-key-management-create-THDCXGWK.js → api-key-management-create-7RWOCVAO.js} +3 -3
  5. package/dist/{api-key-management-detail-IRYR6J2I.js → api-key-management-detail-ZIIDMHFI.js} +24 -23
  6. package/dist/{api-key-management-edit-LTVNXP6T.js → api-key-management-edit-ACH6TJAX.js} +3 -3
  7. package/dist/{api-key-management-list-4WCDP4B3.js → api-key-management-list-JHBBXGHH.js} +11 -13
  8. package/dist/{api-key-management-sales-channels-NVFG2ESH.js → api-key-management-sales-channels-XEBTUB5V.js} +15 -15
  9. package/dist/attribute-create-BYO7BDF5.js +562 -0
  10. package/dist/attribute-create-possible-value-EXVHC272.js +476 -0
  11. package/dist/{attribute-detail-R26GDX7Q.js → attribute-detail-36XP35P6.js} +74 -64
  12. package/dist/attribute-edit-WMJWHT7Z.js +183 -0
  13. package/dist/attribute-edit-possible-value-KTUZ7YLW.js +164 -0
  14. package/dist/{attribute-edit-ranking-CEBR5LJ7.js → attribute-edit-ranking-7AAAYEC7.js} +66 -61
  15. package/dist/{attribute-list-XR7OSL2H.js → attribute-list-OHU2QMUG.js} +24 -26
  16. package/dist/{campaign-create-AZTR5UZP.js → campaign-create-VFFIIRE4.js} +4 -4
  17. package/dist/{campaign-detail-TCPO6DTI.js → campaign-detail-AZKBPDLC.js} +27 -28
  18. package/dist/{campaign-list-DCLVAFEM.js → campaign-list-NQGNOFVZ.js} +10 -12
  19. package/dist/{categories-metadata-YVUNHMQT.js → categories-metadata-YZUP43OH.js} +17 -16
  20. package/dist/{category-create-DG3Z5RYE.js → category-create-2MRYTSYM.js} +4 -4
  21. package/dist/{category-detail-K2UNFPRV.js → category-detail-KTFD3VVR.js} +29 -28
  22. package/dist/{category-edit-IXU6E3YT.js → category-edit-QLOS2LBA.js} +5 -5
  23. package/dist/{category-list-2MG37UXJ.js → category-list-U7ZQBSZN.js} +11 -13
  24. package/dist/{category-organize-CCX2INRS.js → category-organize-TIKTYJFZ.js} +2 -2
  25. package/dist/{category-products-LKT7564A.js → category-products-7P5DSQN4.js} +30 -29
  26. package/dist/{chunk-6YGOXPB5.js → chunk-2LQ5SCPB.js} +5 -5
  27. package/dist/{chunk-ZZO3INVE.js → chunk-2MDGYHWN.js} +128 -25
  28. package/dist/{chunk-X3YEY2PY.js → chunk-2S6VXFBZ.js} +8 -8
  29. package/dist/{chunk-5CK6XEFV.js → chunk-2YYXP6XI.js} +183 -111
  30. package/dist/{chunk-GAD5DQOY.js → chunk-3EDQIZV6.js} +2 -2
  31. package/dist/{chunk-4IZ2RD3L.js → chunk-3IVTUFBM.js} +8 -8
  32. package/dist/{chunk-7YHAFHGI.js → chunk-3JSAS7QP.js} +92 -165
  33. package/dist/{chunk-DVKO4VRC.js → chunk-3P4VTL4S.js} +12 -12
  34. package/dist/{chunk-GJPGL7RP.js → chunk-3VTAK3S6.js} +108 -28
  35. package/dist/{chunk-C3WE6EFO.js → chunk-4YWKKCTT.js} +1 -2
  36. package/dist/chunk-533GMKEG.js +125 -0
  37. package/dist/chunk-57BHSFNA.js +101 -0
  38. package/dist/{chunk-AEFDAU3Y.js → chunk-5KGMGL4N.js} +4 -24
  39. package/dist/{chunk-VGM5UQRA.js → chunk-637OFDFC.js} +809 -306
  40. package/dist/{chunk-NRJ7F7JW.js → chunk-6AZKWCVL.js} +14 -14
  41. package/dist/{chunk-JCSPXBS3.js → chunk-6FIU2V6Y.js} +1 -1
  42. package/dist/chunk-77T2UI6L.js +1671 -0
  43. package/dist/{chunk-B6SYYKJI.js → chunk-A4UQKKGC.js} +13 -13
  44. package/dist/{chunk-B6FG7A6W.js → chunk-A772RAKB.js} +1 -1
  45. package/dist/{chunk-35Q6JF3S.js → chunk-A7JOHU6Q.js} +4 -4
  46. package/dist/{chunk-N57BOIPU.js → chunk-AB2LHP3M.js} +1 -1
  47. package/dist/chunk-ABFL4ACD.js +207 -0
  48. package/dist/{chunk-HY3CV5V6.js → chunk-AKTAFKIU.js} +4 -4
  49. package/dist/{chunk-N23OD7WS.js → chunk-ALATTLBM.js} +7 -7
  50. package/dist/{chunk-PBQ5M44A.js → chunk-AXTQMIIK.js} +13 -30
  51. package/dist/{chunk-TAKEQAZZ.js → chunk-B3EEDC47.js} +2 -2
  52. package/dist/{chunk-EWMEXGFZ.js → chunk-BCVUMATY.js} +18 -18
  53. package/dist/{chunk-34I4QIBD.js → chunk-BE6JLTMI.js} +1 -1
  54. package/dist/{chunk-V7EPLR3E.js → chunk-BFT3CN5L.js} +10 -10
  55. package/dist/{chunk-O5YFLNSQ.js → chunk-BGGUVHDG.js} +27 -27
  56. package/dist/{chunk-HGULM6DF.js → chunk-BGQ7H2KL.js} +10 -10
  57. package/dist/{chunk-3DOCALSU.js → chunk-BHOZKBYY.js} +395 -11
  58. package/dist/{chunk-KHHMQM2L.js → chunk-BLYJZMNE.js} +5 -5
  59. package/dist/chunk-CBG4E3M3.js +165 -0
  60. package/dist/{chunk-5ZBQICCP.js → chunk-CBGXKU7Z.js} +18 -18
  61. package/dist/{chunk-LFATSJPO.js → chunk-CKACZXMP.js} +9 -9
  62. package/dist/{chunk-GXRLLA5H.js → chunk-CKD5563X.js} +4 -4
  63. package/dist/{chunk-E3DLJSYD.js → chunk-COP7NFSJ.js} +1 -1
  64. package/dist/{chunk-ABUQBBEM.js → chunk-CVFVEDMV.js} +4 -4
  65. package/dist/chunk-CYGIJOA5.js +79 -0
  66. package/dist/{chunk-CXO3C3L2.js → chunk-D5T7QOVY.js} +11 -11
  67. package/dist/{chunk-ARMGWHYU.js → chunk-DOSKHIRH.js} +16 -16
  68. package/dist/{chunk-UEEYZGM3.js → chunk-DRJAKRTI.js} +46 -17
  69. package/dist/{chunk-NEN6KWAJ.js → chunk-ED7XNGZD.js} +12 -12
  70. package/dist/{chunk-W576GZBG.js → chunk-EJTB2SLE.js} +9 -9
  71. package/dist/{chunk-32OKBVER.js → chunk-ELM74U2R.js} +5 -5
  72. package/dist/chunk-EREXPX6I.js +348 -0
  73. package/dist/{chunk-MNYDJXTM.js → chunk-FB7DDNCA.js} +5 -5
  74. package/dist/{chunk-GZBVMHXS.js → chunk-FFNSWUDC.js} +10 -10
  75. package/dist/{chunk-YKDEE7ZL.js → chunk-FTAR3BDS.js} +1 -1
  76. package/dist/{chunk-2OYCT5NO.js → chunk-G4PROEJI.js} +5 -5
  77. package/dist/{chunk-OQMBWJPH.js → chunk-GKW445WA.js} +1 -1
  78. package/dist/{chunk-LNAXUDW2.js → chunk-GLPS6QFG.js} +64 -62
  79. package/dist/{chunk-3IN6MMKV.js → chunk-GNLPUGYK.js} +2 -2
  80. package/dist/{chunk-3IBSB2U6.js → chunk-H23AKDB2.js} +14 -14
  81. package/dist/{chunk-Z2QQZOG3.js → chunk-H5PYBIOZ.js} +1 -1
  82. package/dist/{chunk-63OSYRLS.js → chunk-HR7TFO2X.js} +4 -4
  83. package/dist/{chunk-XB3HXEZB.js → chunk-HWBUIBJD.js} +77 -72
  84. package/dist/{chunk-4Q7LZQVY.js → chunk-IAWZQKUH.js} +10 -10
  85. package/dist/{chunk-2U5BRCQO.js → chunk-IEPNHH7Z.js} +1 -1
  86. package/dist/chunk-IIFQ7KYL.js +171 -0
  87. package/dist/{chunk-HNUA6XIW.js → chunk-IRTI3AS3.js} +14 -14
  88. package/dist/chunk-J65IXAGI.js +292 -0
  89. package/dist/{chunk-VIGX66F7.js → chunk-JQBSPUH2.js} +1 -1
  90. package/dist/{chunk-4ZN3D4YS.js → chunk-K4TGNN4P.js} +9 -9
  91. package/dist/{chunk-R46PKJUT.js → chunk-KXIA66EJ.js} +13 -13
  92. package/dist/{chunk-CIH5DSU7.js → chunk-LCGLQNOI.js} +11 -11
  93. package/dist/{chunk-RE3AYHPM.js → chunk-LLOKYZMI.js} +4 -4
  94. package/dist/chunk-LT3REHJG.js +2355 -0
  95. package/dist/{chunk-VVWB3GIK.js → chunk-LYZDVZWA.js} +3 -12
  96. package/dist/{chunk-AZAGUAN4.js → chunk-MN3AEVR7.js} +15 -15
  97. package/dist/{chunk-J24X54DB.js → chunk-MVNO35S5.js} +7 -7
  98. package/dist/{chunk-PIZ7FN3L.js → chunk-N2LH7A4X.js} +9 -9
  99. package/dist/{chunk-SPIVEW2Y.js → chunk-NQBSSM5V.js} +8 -8
  100. package/dist/{chunk-HKDFWQ6Q.js → chunk-NQEXDLYH.js} +460 -2
  101. package/dist/{chunk-HO7Z6MC3.js → chunk-NZ2LHIKD.js} +33 -33
  102. package/dist/{chunk-DBNPVU3L.js → chunk-OSEIN4Y2.js} +1 -1
  103. package/dist/{chunk-XBHUWCBD.js → chunk-P25PIADJ.js} +1 -1
  104. package/dist/{chunk-GPKTJXGG.js → chunk-PCLSODMO.js} +32 -32
  105. package/dist/{chunk-WRRMBJBQ.js → chunk-PXTJJQKJ.js} +1 -1
  106. package/dist/chunk-PYDRHQTY.js +24 -0
  107. package/dist/{chunk-ORI7UXS6.js → chunk-Q6I2IKJB.js} +6 -6
  108. package/dist/{chunk-X4DGVTMC.js → chunk-QIU6DJY6.js} +5 -5
  109. package/dist/{chunk-F67RRVMJ.js → chunk-RKH3A4O3.js} +13 -13
  110. package/dist/chunk-RQ4NMLSS.js +8 -0
  111. package/dist/{chunk-7QWLLYOY.js → chunk-RQPDD3RI.js} +1 -1
  112. package/dist/{chunk-DL2ZIXBO.js → chunk-S5BJ5CMF.js} +1 -1
  113. package/dist/chunk-SG76L7C7.js +61 -0
  114. package/dist/{chunk-3ZSYFPHB.js → chunk-SRDK3XX7.js} +20 -20
  115. package/dist/{chunk-SJQG3RCN.js → chunk-TGFZ4UBK.js} +19 -19
  116. package/dist/{chunk-WIQ2HBJG.js → chunk-TITPJHIL.js} +13 -13
  117. package/dist/{chunk-SOJ4TLWP.js → chunk-TP7L6M7V.js} +5 -5
  118. package/dist/{chunk-OG4WH7IW.js → chunk-U7XILJH6.js} +35 -32
  119. package/dist/{chunk-7MTFPHXR.js → chunk-UPNMDPFX.js} +6 -6
  120. package/dist/{chunk-7XXM72CF.js → chunk-UR6HGBFE.js} +62 -89
  121. package/dist/{chunk-5OS2MBRB.js → chunk-UXQAHUGZ.js} +8 -8
  122. package/dist/chunk-V5XHY5LP.js +39 -0
  123. package/dist/{chunk-NHAOR25V.js → chunk-W7NN2EFL.js} +20 -20
  124. package/dist/{chunk-YEUUI6JF.js → chunk-WDH5C2NS.js} +1 -1
  125. package/dist/{chunk-BEU674HI.js → chunk-WKCYMDTV.js} +5 -5
  126. package/dist/{chunk-M73MP4NC.js → chunk-WNYDGJ3E.js} +19 -19
  127. package/dist/{chunk-6MJ5HPIP.js → chunk-WS63IRBI.js} +3 -3
  128. package/dist/chunk-WV4SQ57G.js +141 -0
  129. package/dist/{chunk-Y3FXVIJO.js → chunk-WVKVPGJW.js} +4 -4
  130. package/dist/{chunk-GDHF6CT5.js → chunk-X45JKZYW.js} +11 -11
  131. package/dist/{chunk-GKJLFLGN.js → chunk-XJ3WC4G7.js} +4 -4
  132. package/dist/{chunk-4LQX5FRH.js → chunk-XODRTI2W.js} +7 -7
  133. package/dist/{chunk-U7WZYWGA.js → chunk-XZZTC7E5.js} +1 -1
  134. package/dist/{chunk-7A5WEMNW.js → chunk-Y3NVKGGI.js} +11 -11
  135. package/dist/{chunk-33XUAKRP.js → chunk-YGAX72XV.js} +3 -1
  136. package/dist/{chunk-FSPZYOY6.js → chunk-YLKG7W4P.js} +4 -4
  137. package/dist/{chunk-SESTTUVM.js → chunk-YN3FGNJM.js} +53 -1
  138. package/dist/{chunk-3T5S5RDO.js → chunk-ZHOI4QMK.js} +4 -4
  139. package/dist/{chunk-CEG375CR.js → chunk-ZSFJVRRS.js} +4 -4
  140. package/dist/chunk-ZZ3XFIEM.js +84 -0
  141. package/dist/{collection-add-products-IRYJ6U6P.js → collection-add-products-XL2TAKQD.js} +30 -29
  142. package/dist/{collection-create-3BTRORHU.js → collection-create-HUNYHKUJ.js} +2 -2
  143. package/dist/{collection-detail-263PM4DL.js → collection-detail-2DSZVOI7.js} +28 -27
  144. package/dist/{collection-edit-L5GPFBBX.js → collection-edit-OQGYTQDO.js} +2 -2
  145. package/dist/{collection-list-IVPTNBSI.js → collection-list-NGCW7OTG.js} +35 -36
  146. package/dist/{collection-metadata-KHGPTV5C.js → collection-metadata-47N7TUOH.js} +17 -16
  147. package/dist/{commission-rate-create-3N6BHEGT.js → commission-rate-create-BQY3UGKV.js} +53 -53
  148. package/dist/{commission-rate-detail-MY3F2RHR.js → commission-rate-detail-LAZZLZVX.js} +18 -17
  149. package/dist/{commission-rate-edit-WZDPXLLZ.js → commission-rate-edit-DAFXNYYN.js} +53 -53
  150. package/dist/{commission-rate-list-JPBOTOTA.js → commission-rate-list-Y5XLEO67.js} +8 -10
  151. package/dist/{constants-CAwtRicB.d.ts → constants-26tEckuq.d.ts} +3 -3
  152. package/dist/{customer-detail-2QBJPF7S.js → customer-detail-D5SSLNFT.js} +27 -28
  153. package/dist/{customer-group-add-customers-JCLAH45C.js → customer-group-add-customers-VJUBEN7M.js} +13 -15
  154. package/dist/{customer-group-detail-BDKFWKTI.js → customer-group-detail-KRT7E2JA.js} +24 -25
  155. package/dist/{customer-group-list-3NEEJXQH.js → customer-group-list-KKDIESQ6.js} +24 -25
  156. package/dist/{customer-group-metadata-YJXZFSFG.js → customer-group-metadata-J6JY7DZ3.js} +17 -16
  157. package/dist/{customer-list-ZIFNZXO4.js → customer-list-MB6WZFMA.js} +11 -13
  158. package/dist/{customer-metadata-SG6M7X3Q.js → customer-metadata-AH2LBK4T.js} +17 -16
  159. package/dist/{customers-add-customer-group-OQIFQZBL.js → customers-add-customer-group-AHGAPEIS.js} +27 -28
  160. package/dist/{edit-inventory-item-TDG2ZTPM.js → edit-inventory-item-ADNLKLCN.js} +13 -12
  161. package/dist/{edit-inventory-item-attributes-T56PJTCT.js → edit-inventory-item-attributes-XVR2WLDU.js} +13 -12
  162. package/dist/{edit-reservation-T6SKOG2F.js → edit-reservation-HQQL42QX.js} +7 -7
  163. package/dist/{edit-rules-4AHZQGCX.js → edit-rules-YMKM5JPI.js} +17 -15
  164. package/dist/index.d.ts +2 -2
  165. package/dist/index.js +824 -598
  166. package/dist/{inventory-create-P26OGAHD.js → inventory-create-IVESXFSV.js} +19 -18
  167. package/dist/{inventory-detail-7W7UUWNT.js → inventory-detail-TINIAFVB.js} +26 -27
  168. package/dist/{inventory-list-PA4B4RWY.js → inventory-list-YLIAKQXI.js} +10 -12
  169. package/dist/{inventory-metadata-LUGA3KNV.js → inventory-metadata-6INRH2JC.js} +17 -16
  170. package/dist/{inventory-stock-UZSYXXPX.js → inventory-stock-6YGTATID.js} +21 -20
  171. package/dist/loader-6KDBTRVR.js +26 -0
  172. package/dist/{location-detail-RUC2ZP3K.js → location-detail-EK2S7WOK.js} +22 -21
  173. package/dist/{location-fulfillment-providers-WDET6TJP.js → location-fulfillment-providers-KUUNC2KP.js} +36 -36
  174. package/dist/{location-list-R7EECG5Z.js → location-list-IV323QW2.js} +19 -19
  175. package/dist/{location-sales-channels-IS6E3I4S.js → location-sales-channels-EYUXMTW7.js} +12 -12
  176. package/dist/{location-service-zone-create-HAQVVTKP.js → location-service-zone-create-ZS3UWJAA.js} +8 -11
  177. package/dist/{location-service-zone-manage-areas-5LCENMAM.js → location-service-zone-manage-areas-S7QZTIFT.js} +8 -11
  178. package/dist/{location-service-zone-shipping-option-create-FV5Y2PNB.js → location-service-zone-shipping-option-create-36JZFRGY.js} +23 -21
  179. package/dist/{location-service-zone-shipping-option-edit-PLEDWIY3.js → location-service-zone-shipping-option-edit-3PGSNKYT.js} +8 -7
  180. package/dist/{location-service-zone-shipping-option-pricing-6QHLZ6IN.js → location-service-zone-shipping-option-pricing-JLGCOZGS.js} +8 -8
  181. package/dist/{login-EWHQY6G3.js → login-6L3RMREO.js} +13 -12
  182. package/dist/{manage-locations-TU5HCIKG.js → manage-locations-CFTM6DNH.js} +1 -1
  183. package/dist/{marketplace-add-currencies-PB73MHM6.js → marketplace-add-currencies-6ANNBGZM.js} +8 -10
  184. package/dist/{marketplace-detail-3KFGJWQ7.js → marketplace-detail-BAU2MEJT.js} +22 -23
  185. package/dist/{marketplace-edit-U5B6WA56.js → marketplace-edit-6Q3G2OY5.js} +5 -4
  186. package/dist/{marketplace-metadata-VYCPYFJD.js → marketplace-metadata-KRCGKOCA.js} +17 -16
  187. package/dist/offers-IFKM6EQT.js +440 -0
  188. package/dist/{order-allocate-items-2B6T5JCK.js → order-allocate-items-DJ2V4B7A.js} +11 -11
  189. package/dist/{order-create-claim-R2SX6YUS.js → order-create-claim-RMDDCUZ6.js} +27 -61
  190. package/dist/{order-create-edit-G35PDCQ2.js → order-create-edit-PQ54JFZZ.js} +24 -58
  191. package/dist/{order-create-exchange-7KKMJHXE.js → order-create-exchange-T6DBVS75.js} +41 -48
  192. package/dist/{order-create-fulfillment-2FTTWTFE.js → order-create-fulfillment-SMSUJSBN.js} +22 -20
  193. package/dist/{order-create-refund-KWYYLAED.js → order-create-refund-OW3MIXBY.js} +17 -16
  194. package/dist/{order-create-return-BQFRANNG.js → order-create-return-YCX6C3VP.js} +25 -27
  195. package/dist/{order-create-shipment-7XP6PDTD.js → order-create-shipment-5ZAWH5CZ.js} +14 -13
  196. package/dist/{order-detail-BITJD73H.js → order-detail-2OAEGBQG.js} +29 -30
  197. package/dist/{order-edit-billing-address-FLEI4VDB.js → order-edit-billing-address-VGZBQHF5.js} +15 -14
  198. package/dist/{order-edit-email-AZIA6X5Q.js → order-edit-email-OOCXVRET.js} +14 -13
  199. package/dist/{order-edit-shipping-address-GJMUSOPK.js → order-edit-shipping-address-B4F3E5RE.js} +14 -13
  200. package/dist/{order-list-D2SJOMZ2.js → order-list-DQTMCEFD.js} +25 -27
  201. package/dist/{order-metadata-RXIJOP4V.js → order-metadata-AN6MPHHT.js} +18 -17
  202. package/dist/{order-receive-return-JV3X7YHG.js → order-receive-return-DZ4IUOHY.js} +20 -19
  203. package/dist/{order-request-transfer-6IZVCHGV.js → order-request-transfer-A2NJSQ4H.js} +16 -14
  204. package/dist/pages/index.d.ts +702 -566
  205. package/dist/pages/index.js +192 -184
  206. package/dist/{payout-detail-JWS2Q4TY.js → payout-detail-TWO6HN4E.js} +3 -3
  207. package/dist/{payout-list-PW6BFT4O.js → payout-list-7WJZFNW5.js} +9 -11
  208. package/dist/{price-list-configuration-N5D5OFXX.js → price-list-configuration-XAHXLCXR.js} +13 -15
  209. package/dist/{price-list-create-NQFC2JIJ.js → price-list-create-37SCDSPN.js} +35 -34
  210. package/dist/{price-list-detail-HRVLVBPS.js → price-list-detail-4Q2HBLAM.js} +30 -29
  211. package/dist/{price-list-edit-BVVLQ5WV.js → price-list-edit-ZVLD4M5T.js} +5 -5
  212. package/dist/{price-list-list-K4IJFZYH.js → price-list-list-ER4TOZTY.js} +13 -15
  213. package/dist/{price-list-prices-add-WXEGEWRA.js → price-list-prices-add-UASPZXKT.js} +31 -30
  214. package/dist/{price-list-prices-edit-KJEKS6TL.js → price-list-prices-edit-WHCIGSB2.js} +22 -21
  215. package/dist/product-add-existing-attributes-7HEJUR6J.js +420 -0
  216. package/dist/{product-attributes-ASPKDH7H.js → product-attributes-MHRXZK5S.js} +4 -4
  217. package/dist/product-brand-create-B3ZJGHUQ.js +171 -0
  218. package/dist/product-brand-detail-6MPQ3UFN.js +100 -0
  219. package/dist/product-brand-edit-3TQDHZNN.js +179 -0
  220. package/dist/product-brand-list-ZBPBSRQN.js +30 -0
  221. package/dist/product-brand-metadata-EAMW6PQJ.js +87 -0
  222. package/dist/product-bulk-edit-J6ZP7GGM.js +287 -0
  223. package/dist/{product-create-BDQ66ECX.js → product-create-KHJWRSUB.js} +34 -34
  224. package/dist/product-create-attribute-ZT3VZDNZ.js +196 -0
  225. package/dist/{product-create-option-B7SV42LO.js → product-create-option-NIAP75EE.js} +6 -24
  226. package/dist/{product-create-variant-7YAG2YRZ.js → product-create-variant-LCE47YFO.js} +25 -21
  227. package/dist/{product-detail-DCHR4B4T.js → product-detail-GLISGO65.js} +25 -27
  228. package/dist/{product-edit-IASCMBET.js → product-edit-EKAZRIJ6.js} +15 -8
  229. package/dist/product-edit-option-OZUZGMIM.js +166 -0
  230. package/dist/{product-list-X72QPKOK.js → product-list-2CTGPDDT.js} +31 -30
  231. package/dist/{product-media-VNSFLCSH.js → product-media-KREKRDOC.js} +15 -8
  232. package/dist/{product-metadata-GJ7C2UJG.js → product-metadata-O3BAEUYB.js} +20 -19
  233. package/dist/{product-organization-PN22LYKQ.js → product-organization-SBQY44IF.js} +61 -18
  234. package/dist/{product-prices-HI4SOTMP.js → product-prices-R5JOHVGS.js} +8 -8
  235. package/dist/{product-sales-channels-J2ZNRKZT.js → product-sales-channels-TFOGXCMI.js} +15 -15
  236. package/dist/{product-shipping-profile-G7UPGWYK.js → product-shipping-profile-E4HJ4EYW.js} +6 -5
  237. package/dist/{product-stock-666D3AMJ.js → product-stock-EIP2XJUR.js} +28 -27
  238. package/dist/{product-tag-create-PHJICTE4.js → product-tag-create-7JBM6I3V.js} +13 -12
  239. package/dist/{product-tag-detail-B7JEBNMJ.js → product-tag-detail-MTFAPSG2.js} +51 -51
  240. package/dist/{product-tag-edit-G4UNGXPT.js → product-tag-edit-O2ADFDD6.js} +13 -12
  241. package/dist/{product-tag-list-MAUUWH25.js → product-tag-list-EOULJIYQ.js} +51 -51
  242. package/dist/{product-tag-metadata-I4V6CR6Z.js → product-tag-metadata-SBOUTUXY.js} +17 -16
  243. package/dist/{product-type-detail-7GHH4ACU.js → product-type-detail-H4CZN27J.js} +28 -27
  244. package/dist/{product-type-list-LTYTTF4F.js → product-type-list-TM26QMHR.js} +12 -14
  245. package/dist/{product-type-metadata-KGVRMMTQ.js → product-type-metadata-KN5OXR6J.js} +17 -16
  246. package/dist/{product-variant-detail-PHGVJWUV.js → product-variant-detail-H2YRFDAU.js} +27 -37
  247. package/dist/product-variant-edit-6W7LKCEE.js +867 -0
  248. package/dist/{product-variant-manage-inventory-items-WENX2QCZ.js → product-variant-manage-inventory-items-Q5MJG3EJ.js} +6 -10
  249. package/dist/{product-variant-metadata-HV72UBCP.js → product-variant-metadata-QESZ7VS2.js} +17 -16
  250. package/dist/{profile-detail-UQTGEFYF.js → profile-detail-ZRL5SERS.js} +4 -4
  251. package/dist/{promotion-add-campaign-M4OT6URB.js → promotion-add-campaign-O3RTMS3W.js} +6 -5
  252. package/dist/{promotion-create-GM37OXEW.js → promotion-create-TGC6BVWF.js} +23 -21
  253. package/dist/{promotion-detail-PDBRQII7.js → promotion-detail-VYIXZMMD.js} +21 -20
  254. package/dist/{promotion-list-XW4PNLJF.js → promotion-list-C3SKV5BJ.js} +13 -15
  255. package/dist/{refund-reason-create-M2CYTCEM.js → refund-reason-create-2KEQFOID.js} +13 -12
  256. package/dist/{refund-reason-edit-M4XBV633.js → refund-reason-edit-E7CB7SM3.js} +13 -12
  257. package/dist/{refund-reason-list-2S2MDKBQ.js → refund-reason-list-TAHJK4OX.js} +37 -35
  258. package/dist/{region-add-countries-T4XZ2CU3.js → region-add-countries-COXN4LP3.js} +7 -9
  259. package/dist/{region-create-MQXTWBKC.js → region-create-P66Q65XY.js} +14 -15
  260. package/dist/{region-detail-6OFP76OY.js → region-detail-P2HHBYFV.js} +11 -13
  261. package/dist/{region-edit-QNJ2HT76.js → region-edit-XFE54SAO.js} +8 -7
  262. package/dist/{region-list-EYTDREE2.js → region-list-2XXKCDDX.js} +11 -13
  263. package/dist/{region-metadata-4JWOEGTZ.js → region-metadata-723RQGHS.js} +17 -16
  264. package/dist/{reservation-create-26QAWABA.js → reservation-create-Y3HG4AZA.js} +4 -4
  265. package/dist/{reservation-detail-G26K6HZV.js → reservation-detail-HQMADZ56.js} +19 -18
  266. package/dist/{reservation-list-CHHR6CEV.js → reservation-list-YKC3JJ6K.js} +11 -13
  267. package/dist/{reservation-metadata-JFLJ27A3.js → reservation-metadata-UG4YTEMY.js} +18 -17
  268. package/dist/{reset-password-S6IBWG47.js → reset-password-2VNU52CE.js} +1 -1
  269. package/dist/{return-reason-list-MCGW2JV3.js → return-reason-list-IHFO2LJK.js} +27 -28
  270. package/dist/{sales-channel-add-products-FH7B7UYR.js → sales-channel-add-products-YZTQ2SDS.js} +31 -30
  271. package/dist/{sales-channel-create-NSZEHGZE.js → sales-channel-create-BSNCLZWR.js} +2 -2
  272. package/dist/{sales-channel-detail-KCS472HN.js → sales-channel-detail-67G7K3IE.js} +28 -27
  273. package/dist/{sales-channel-edit-W6Z2ERBJ.js → sales-channel-edit-FUDXMZYV.js} +2 -2
  274. package/dist/{sales-channel-list-6HBRUZ2Z.js → sales-channel-list-GYLGH4U7.js} +21 -20
  275. package/dist/{sales-channel-metadata-NDSKXOGH.js → sales-channel-metadata-H6RSHKVP.js} +17 -16
  276. package/dist/{shipping-option-type-create-MEL24PGH.js → shipping-option-type-create-QAOW7753.js} +13 -12
  277. package/dist/{shipping-option-type-detail-IS7CNAYI.js → shipping-option-type-detail-QGWVDTDU.js} +19 -18
  278. package/dist/{shipping-option-type-edit-IVBHURXR.js → shipping-option-type-edit-WXYBDRNY.js} +13 -12
  279. package/dist/{shipping-option-type-list-BTPCLBSD.js → shipping-option-type-list-YSWP6DSC.js} +24 -25
  280. package/dist/{shipping-profile-detail-L3IHPGLL.js → shipping-profile-detail-YAKZHWZI.js} +5 -5
  281. package/dist/{shipping-profile-metadata-UZPX2PHJ.js → shipping-profile-metadata-UE53IA3J.js} +19 -18
  282. package/dist/{shipping-profiles-list-2JKVMEZG.js → shipping-profiles-list-JF2SQIQ7.js} +9 -11
  283. package/dist/{store-bulk-edit-A4ZWZ7HJ.js → store-bulk-edit-UYNQ2CPG.js} +7 -7
  284. package/dist/{store-create-OQVFVIK4.js → store-create-WNFRHXWR.js} +13 -12
  285. package/dist/{store-details-BOGWBWE7.js → store-details-R2GQU7HE.js} +44 -44
  286. package/dist/{store-edit-77WKNZUH.js → store-edit-UW3QOFFX.js} +11 -11
  287. package/dist/{store-list-2G34KVD5.js → store-list-5CV7VJLO.js} +36 -37
  288. package/dist/{store-member-invite-4GDKCSTT.js → store-member-invite-M4NVBUXM.js} +3 -3
  289. package/dist/{tax-region-create-5DDZ23QQ.js → tax-region-create-3KVECMFN.js} +16 -14
  290. package/dist/{tax-region-detail-VNBNS7FS.js → tax-region-detail-AOT4X4DZ.js} +26 -26
  291. package/dist/{tax-region-edit-OARZRBVK.js → tax-region-edit-5T7VHKIA.js} +15 -13
  292. package/dist/{tax-region-list-WCHVLVVC.js → tax-region-list-FIBHEFVD.js} +9 -9
  293. package/dist/{tax-region-metadata-XJRFOG7I.js → tax-region-metadata-RSZCJGJT.js} +17 -16
  294. package/dist/{tax-region-province-detail-MXYZMUX7.js → tax-region-province-detail-XEMIX5SQ.js} +24 -24
  295. package/dist/{tax-region-tax-override-create-VIOPM26G.js → tax-region-tax-override-create-KVVY4AF2.js} +54 -54
  296. package/dist/{tax-region-tax-override-edit-5FW6YCCW.js → tax-region-tax-override-edit-TVX7SMJD.js} +54 -54
  297. package/dist/{user-detail-LGIMHLY4.js → user-detail-W7DGVXDZ.js} +6 -6
  298. package/dist/{user-invite-ZZSWFXFM.js → user-invite-HLZJ7FST.js} +14 -16
  299. package/dist/{user-list-5QJJS7EA.js → user-list-TR7RSGUO.js} +9 -11
  300. package/dist/{user-metadata-376YJMY3.js → user-metadata-3AFZX3DM.js} +17 -16
  301. package/package.json +3 -3
  302. package/dist/attribute-create-EAOQ6KT6.js +0 -1010
  303. package/dist/attribute-create-possible-value-BIU2L7AN.js +0 -437
  304. package/dist/attribute-edit-DRHFOHMK.js +0 -282
  305. package/dist/attribute-edit-possible-value-G2ON2AE3.js +0 -264
  306. package/dist/chunk-35NDMIYZ.js +0 -8
  307. package/dist/chunk-4GPAS5GW.js +0 -36
  308. package/dist/chunk-4ZTZTIIM.js +0 -69
  309. package/dist/chunk-7O5NDICV.js +0 -120
  310. package/dist/chunk-IGTRIAUC.js +0 -84
  311. package/dist/chunk-KYPPQGGE.js +0 -467
  312. package/dist/chunk-LBXPX3XC.js +0 -1260
  313. package/dist/chunk-LO7XX5M7.js +0 -6
  314. package/dist/chunk-MXGDKEU5.js +0 -248
  315. package/dist/chunk-QOQSXNEF.js +0 -37
  316. package/dist/chunk-RSBZREKG.js +0 -144
  317. package/dist/chunk-WCEMRNW4.js +0 -6
  318. package/dist/chunk-Z5I2Z6L3.js +0 -160
  319. package/dist/chunk-ZMC7BKLT.js +0 -56
  320. package/dist/chunk-ZXYKF4A2.js +0 -2146
  321. package/dist/product-edit-option-KVTIY5NM.js +0 -156
  322. package/dist/product-export-E7RBOIO6.js +0 -137
  323. package/dist/product-import-KOSPPCSW.js +0 -267
  324. package/dist/product-variant-edit-L77HDGTA.js +0 -547
  325. package/dist/{chunk-XCANTVXS.js → chunk-CPXK5RSJ.js} +6 -6
  326. package/dist/{chunk-Y6NK6GBB.js → chunk-GP4J42UD.js} +5 -5
  327. package/dist/{chunk-L56WFGUN.js → chunk-IMR3MZDP.js} +3 -3
  328. package/dist/{chunk-OB4NOV4M.js → chunk-LYZT5REU.js} +3 -3
  329. package/dist/{chunk-ZBJ56XDB.js → chunk-Q2ULPJJ6.js} +3 -3
  330. package/dist/{chunk-MWX5JCOM.js → chunk-V6OGMYAI.js} +3 -3
  331. package/dist/{chunk-KCYUY2AI.js → chunk-WQFFCK3R.js} +6 -6
  332. package/dist/{chunk-ZW34ZAIP.js → chunk-WYA62MUL.js} +8 -8
  333. package/dist/{chunk-56AUQBQX.js → chunk-YYMACYP6.js} +5 -5
  334. package/dist/{customer-edit-X4HQOUAE.js → customer-edit-JZ4PQTIN.js} +3 -3
  335. package/dist/{profile-edit-Y5UUUKVH.js → profile-edit-HQTWYWZ7.js} +6 -6
  336. package/dist/{promotion-edit-details-E2XKWY7L.js → promotion-edit-details-TKRC5HES.js} +6 -6
@@ -1,2146 +0,0 @@
1
- import {
2
- ChipGroup
3
- } from "./chunk-IGTRIAUC.js";
4
- import {
5
- HandleInput
6
- } from "./chunk-HJ56YXBU.js";
7
- import {
8
- DataGrid,
9
- createDataGridHelper,
10
- createDataGridPriceColumns
11
- } from "./chunk-MWX5JCOM.js";
12
- import {
13
- useSalesChannelTableColumns,
14
- useSalesChannelTableEmptyState,
15
- useSalesChannelTableFilters,
16
- useSalesChannelTableQuery
17
- } from "./chunk-CKNQJPAG.js";
18
- import {
19
- DataTable
20
- } from "./chunk-OB4NOV4M.js";
21
- import {
22
- CategoryCombobox
23
- } from "./chunk-3DOCALSU.js";
24
- import {
25
- useComboboxData
26
- } from "./chunk-AEFDAU3Y.js";
27
- import {
28
- Combobox
29
- } from "./chunk-AW77UWCZ.js";
30
- import {
31
- UploadMediaFormItem
32
- } from "./chunk-26UTIAAZ.js";
33
- import {
34
- PRODUCT_CREATE_FORM_DEFAULTS,
35
- ProductCreateSchema,
36
- decorateVariantsWithDefaultValues,
37
- normalizeProductFormValues
38
- } from "./chunk-MXGDKEU5.js";
39
- import {
40
- ChipInput
41
- } from "./chunk-YGRTRAWX.js";
42
- import {
43
- TabbedForm,
44
- defineTabMeta,
45
- useTabbedForm
46
- } from "./chunk-4LXBQTFN.js";
47
- import {
48
- SwitchBox
49
- } from "./chunk-2EME4AWX.js";
50
- import {
51
- ActionMenu
52
- } from "./chunk-BDGZ4EQO.js";
53
- import {
54
- RouteFocusModal,
55
- StackedFocusModal,
56
- useRouteModal,
57
- useStackedModal
58
- } from "./chunk-FWJLS7XD.js";
59
- import {
60
- Form
61
- } from "./chunk-3QSRE5LS.js";
62
- import {
63
- useRegions
64
- } from "./chunk-ESPLVOFC.js";
65
- import {
66
- useStore
67
- } from "./chunk-FXWKGNRV.js";
68
- import {
69
- usePricePreferences
70
- } from "./chunk-VDKOJ5WD.js";
71
- import {
72
- useSalesChannel,
73
- useSalesChannels
74
- } from "./chunk-DL2ZIXBO.js";
75
- import {
76
- useCreateProduct
77
- } from "./chunk-5CK6XEFV.js";
78
- import {
79
- sdk
80
- } from "./chunk-ZBWL72TB.js";
81
-
82
- // src/pages/products/product-create/product-create.tsx
83
- import { Children as Children2 } from "react";
84
- import { useTranslation as useTranslation10 } from "react-i18next";
85
-
86
- // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
87
- import { Button as Button5, toast } from "@medusajs/ui";
88
- import { useCallback, useMemo as useMemo4, Children } from "react";
89
- import { useForm, useWatch as useWatch4 } from "react-hook-form";
90
- import { useTranslation as useTranslation9 } from "react-i18next";
91
-
92
- // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
93
- import { Divider, Heading as Heading2 } from "@medusajs/ui";
94
- import { useTranslation as useTranslation4 } from "react-i18next";
95
-
96
- // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-general-section/product-create-general-section.tsx
97
- import { Input, Textarea } from "@medusajs/ui";
98
- import { useTranslation } from "react-i18next";
99
- import { jsx, jsxs } from "react/jsx-runtime";
100
- var ProductCreateGeneralSection = () => {
101
- const form = useTabbedForm();
102
- const { t } = useTranslation();
103
- return /* @__PURE__ */ jsxs("div", { id: "general", className: "flex flex-col gap-y-6", "data-testid": "product-create-general-section", children: [
104
- /* @__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: [
105
- /* @__PURE__ */ jsx(
106
- Form.Field,
107
- {
108
- control: form.control,
109
- name: "title",
110
- render: ({ field }) => {
111
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-title-item", children: [
112
- /* @__PURE__ */ jsx(Form.Label, { "data-testid": "product-create-general-section-title-label", children: t("products.fields.title.label") }),
113
- /* @__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" }) })
114
- ] });
115
- }
116
- }
117
- ),
118
- /* @__PURE__ */ jsx(
119
- Form.Field,
120
- {
121
- control: form.control,
122
- name: "subtitle",
123
- render: ({ field }) => {
124
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-subtitle-item", children: [
125
- /* @__PURE__ */ jsx(Form.Label, { optional: true, "data-testid": "product-create-general-section-subtitle-label", children: t("products.fields.subtitle.label") }),
126
- /* @__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" }) })
127
- ] });
128
- }
129
- }
130
- ),
131
- /* @__PURE__ */ jsx(
132
- Form.Field,
133
- {
134
- control: form.control,
135
- name: "handle",
136
- render: ({ field }) => {
137
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-handle-item", children: [
138
- /* @__PURE__ */ jsx(
139
- Form.Label,
140
- {
141
- tooltip: t("products.fields.handle.tooltip"),
142
- optional: true,
143
- "data-testid": "product-create-general-section-handle-label",
144
- children: t("fields.handle")
145
- }
146
- ),
147
- /* @__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" }) })
148
- ] });
149
- }
150
- }
151
- )
152
- ] }) }),
153
- /* @__PURE__ */ jsx(
154
- Form.Field,
155
- {
156
- control: form.control,
157
- name: "description",
158
- render: ({ field }) => {
159
- return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "product-create-general-section-description-item", children: [
160
- /* @__PURE__ */ jsx(Form.Label, { optional: true, "data-testid": "product-create-general-section-description-label", children: t("products.fields.description.label") }),
161
- /* @__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" }) })
162
- ] });
163
- }
164
- }
165
- )
166
- ] });
167
- };
168
-
169
- // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-media-section/product-create-details-media-section.tsx
170
- import {
171
- defaultDropAnimationSideEffects,
172
- DndContext,
173
- DragOverlay,
174
- KeyboardSensor,
175
- PointerSensor,
176
- useSensor,
177
- useSensors
178
- } from "@dnd-kit/core";
179
- import {
180
- arrayMove,
181
- SortableContext,
182
- sortableKeyboardCoordinates,
183
- useSortable
184
- } from "@dnd-kit/sortable";
185
- import { CSS } from "@dnd-kit/utilities";
186
- import {
187
- DotsSix,
188
- StackPerspective,
189
- ThumbnailBadge,
190
- Trash,
191
- XMark
192
- } from "@medusajs/icons";
193
- import { IconButton, Text } from "@medusajs/ui";
194
- import { useState } from "react";
195
- import { useFieldArray } from "react-hook-form";
196
- import { useTranslation as useTranslation2 } from "react-i18next";
197
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
198
- var dropAnimationConfig = {
199
- sideEffects: defaultDropAnimationSideEffects({
200
- styles: {
201
- active: {
202
- opacity: "0.4"
203
- }
204
- }
205
- })
206
- };
207
- var ProductCreateMediaSection = () => {
208
- const form = useTabbedForm();
209
- const { fields, append, remove } = useFieldArray({
210
- name: "media",
211
- control: form.control,
212
- keyName: "field_id"
213
- });
214
- const [activeId, setActiveId] = useState(null);
215
- const sensors = useSensors(
216
- useSensor(PointerSensor),
217
- useSensor(KeyboardSensor, {
218
- coordinateGetter: sortableKeyboardCoordinates
219
- })
220
- );
221
- const handleDragStart = (event) => {
222
- setActiveId(event.active.id);
223
- };
224
- const handleDragEnd = (event) => {
225
- setActiveId(null);
226
- const { active, over } = event;
227
- if (active.id !== over?.id) {
228
- const oldIndex = fields.findIndex((item) => item.field_id === active.id);
229
- const newIndex = fields.findIndex((item) => item.field_id === over?.id);
230
- form.setValue("media", arrayMove(fields, oldIndex, newIndex), {
231
- shouldDirty: true,
232
- shouldTouch: true
233
- });
234
- }
235
- };
236
- const handleDragCancel = () => {
237
- setActiveId(null);
238
- };
239
- const getOnDelete = (index) => {
240
- return () => {
241
- remove(index);
242
- };
243
- };
244
- const getMakeThumbnail = (index) => {
245
- return () => {
246
- const newFields = fields.map((field, i) => {
247
- return {
248
- ...field,
249
- isThumbnail: i === index
250
- };
251
- });
252
- form.setValue("media", newFields, {
253
- shouldDirty: true,
254
- shouldTouch: true
255
- });
256
- };
257
- };
258
- const getItemHandlers = (index) => {
259
- return {
260
- onDelete: getOnDelete(index),
261
- onMakeThumbnail: getMakeThumbnail(index)
262
- };
263
- };
264
- return /* @__PURE__ */ jsxs2("div", { id: "media", className: "flex flex-col gap-y-2", "data-testid": "product-create-media-section", children: [
265
- /* @__PURE__ */ jsx2(UploadMediaFormItem, { form, append, showHint: false, "data-testid": "product-create-media-section-upload" }),
266
- /* @__PURE__ */ jsxs2(
267
- DndContext,
268
- {
269
- sensors,
270
- onDragEnd: handleDragEnd,
271
- onDragStart: handleDragStart,
272
- onDragCancel: handleDragCancel,
273
- children: [
274
- /* @__PURE__ */ jsx2(DragOverlay, { dropAnimation: dropAnimationConfig, children: activeId ? /* @__PURE__ */ jsx2(
275
- MediaGridItemOverlay,
276
- {
277
- field: fields.find((m) => m.field_id === activeId)
278
- }
279
- ) : null }),
280
- /* @__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) => {
281
- const { onDelete, onMakeThumbnail } = getItemHandlers(index);
282
- return /* @__PURE__ */ jsx2(
283
- MediaItem,
284
- {
285
- field,
286
- onDelete,
287
- onMakeThumbnail
288
- },
289
- field.field_id
290
- );
291
- }) }) })
292
- ]
293
- }
294
- )
295
- ] });
296
- };
297
- var MediaItem = ({ field, onDelete, onMakeThumbnail }) => {
298
- const { t } = useTranslation2();
299
- const {
300
- attributes,
301
- listeners,
302
- setNodeRef,
303
- setActivatorNodeRef,
304
- transform,
305
- transition,
306
- isDragging
307
- } = useSortable({ id: field.field_id });
308
- const style = {
309
- opacity: isDragging ? 0.4 : void 0,
310
- transform: CSS.Translate.toString(transform),
311
- transition
312
- };
313
- if (!field.file) {
314
- return null;
315
- }
316
- return /* @__PURE__ */ jsxs2(
317
- "li",
318
- {
319
- className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
320
- ref: setNodeRef,
321
- style,
322
- "data-testid": `product-create-media-section-item-${field.field_id}`,
323
- children: [
324
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-2", children: [
325
- /* @__PURE__ */ jsx2(
326
- IconButton,
327
- {
328
- variant: "transparent",
329
- type: "button",
330
- size: "small",
331
- ...attributes,
332
- ...listeners,
333
- ref: setActivatorNodeRef,
334
- className: "cursor-grab touch-none active:cursor-grabbing",
335
- children: /* @__PURE__ */ jsx2(DotsSix, { className: "text-ui-fg-muted" })
336
- }
337
- ),
338
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-3", children: [
339
- /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx2(ThumbnailPreview, { url: field.url }) }),
340
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
341
- /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: field.file.name }),
342
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
343
- field.isThumbnail && /* @__PURE__ */ jsx2(ThumbnailBadge, {}),
344
- /* @__PURE__ */ jsx2(
345
- Text,
346
- {
347
- size: "xsmall",
348
- leading: "compact",
349
- className: "text-ui-fg-subtle",
350
- children: formatFileSize(field.file.size)
351
- }
352
- )
353
- ] })
354
- ] })
355
- ] })
356
- ] }),
357
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
358
- /* @__PURE__ */ jsx2(
359
- ActionMenu,
360
- {
361
- groups: [
362
- {
363
- actions: [
364
- {
365
- label: t("products.media.makeThumbnail"),
366
- icon: /* @__PURE__ */ jsx2(StackPerspective, {}),
367
- onClick: onMakeThumbnail
368
- }
369
- ]
370
- },
371
- {
372
- actions: [
373
- {
374
- icon: /* @__PURE__ */ jsx2(Trash, {}),
375
- label: t("actions.delete"),
376
- onClick: onDelete
377
- }
378
- ]
379
- }
380
- ],
381
- "data-testid": `product-create-media-section-item-menu-${field.field_id}`
382
- }
383
- ),
384
- /* @__PURE__ */ jsx2(
385
- IconButton,
386
- {
387
- type: "button",
388
- size: "small",
389
- variant: "transparent",
390
- onClick: onDelete,
391
- "data-testid": `product-create-media-section-item-delete-${field.field_id}`,
392
- children: /* @__PURE__ */ jsx2(XMark, {})
393
- }
394
- )
395
- ] })
396
- ]
397
- }
398
- );
399
- };
400
- var MediaGridItemOverlay = ({ field }) => {
401
- 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: [
402
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-2", children: [
403
- /* @__PURE__ */ jsx2(
404
- IconButton,
405
- {
406
- variant: "transparent",
407
- size: "small",
408
- className: "cursor-grab touch-none active:cursor-grabbing",
409
- children: /* @__PURE__ */ jsx2(DotsSix, { className: "text-ui-fg-muted" })
410
- }
411
- ),
412
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-3", children: [
413
- /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx2(ThumbnailPreview, { url: field.url }) }),
414
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
415
- /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", children: field.file?.name }),
416
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
417
- field.isThumbnail && /* @__PURE__ */ jsx2(ThumbnailBadge, {}),
418
- /* @__PURE__ */ jsx2(
419
- Text,
420
- {
421
- size: "xsmall",
422
- leading: "compact",
423
- className: "text-ui-fg-subtle",
424
- children: formatFileSize(field.file?.size ?? 0)
425
- }
426
- )
427
- ] })
428
- ] })
429
- ] })
430
- ] }),
431
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1", children: [
432
- /* @__PURE__ */ jsx2(ActionMenu, { groups: [] }),
433
- /* @__PURE__ */ jsx2(
434
- IconButton,
435
- {
436
- type: "button",
437
- size: "small",
438
- variant: "transparent",
439
- onClick: () => {
440
- },
441
- children: /* @__PURE__ */ jsx2(XMark, {})
442
- }
443
- )
444
- ] })
445
- ] });
446
- };
447
- var ThumbnailPreview = ({ url }) => {
448
- if (!url) {
449
- return null;
450
- }
451
- return /* @__PURE__ */ jsx2("img", { src: url, alt: "", className: "size-full object-cover object-center" });
452
- };
453
- function formatFileSize(bytes, decimalPlaces = 2) {
454
- if (bytes === 0) {
455
- return "0 Bytes";
456
- }
457
- const k = 1024;
458
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
459
- const i = Math.floor(Math.log(bytes) / Math.log(k));
460
- return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
461
- }
462
-
463
- // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
464
- import { XMarkMini } from "@medusajs/icons";
465
- import {
466
- Alert,
467
- Button,
468
- Checkbox,
469
- clx as clx2,
470
- Heading,
471
- Hint,
472
- IconButton as IconButton3,
473
- InlineTip,
474
- Input as Input2,
475
- Label,
476
- Text as Text2
477
- } from "@medusajs/ui";
478
- import {
479
- Controller,
480
- useFieldArray as useFieldArray2,
481
- useWatch
482
- } from "react-hook-form";
483
- import { useTranslation as useTranslation3 } from "react-i18next";
484
-
485
- // src/components/common/sortable-list/sortable-list.tsx
486
- import {
487
- DndContext as DndContext2,
488
- DragOverlay as DragOverlay2,
489
- KeyboardSensor as KeyboardSensor2,
490
- PointerSensor as PointerSensor2,
491
- defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
492
- useSensor as useSensor2,
493
- useSensors as useSensors2
494
- } from "@dnd-kit/core";
495
- import {
496
- SortableContext as SortableContext2,
497
- arrayMove as arrayMove2,
498
- sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
499
- useSortable as useSortable2
500
- } from "@dnd-kit/sortable";
501
- import { CSS as CSS2 } from "@dnd-kit/utilities";
502
- import { DotsSix as DotsSix2 } from "@medusajs/icons";
503
- import { IconButton as IconButton2, clx } from "@medusajs/ui";
504
- import {
505
- Fragment,
506
- createContext,
507
- useContext,
508
- useMemo,
509
- useState as useState2
510
- } from "react";
511
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
512
- var List = ({
513
- items,
514
- onChange,
515
- renderItem
516
- }) => {
517
- const [active, setActive] = useState2(null);
518
- const [activeItem, activeIndex] = useMemo(() => {
519
- if (active === null) {
520
- return [null, null];
521
- }
522
- const index = items.findIndex(({ id }) => id === active.id);
523
- return [items[index], index];
524
- }, [active, items]);
525
- const sensors = useSensors2(
526
- useSensor2(PointerSensor2),
527
- useSensor2(KeyboardSensor2, {
528
- coordinateGetter: sortableKeyboardCoordinates2
529
- })
530
- );
531
- const handleDragStart = ({ active: active2 }) => {
532
- setActive(active2);
533
- };
534
- const handleDragEnd = ({ active: active2, over }) => {
535
- if (over && active2.id !== over.id) {
536
- const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
537
- const overIndex = items.findIndex(({ id }) => id === over.id);
538
- onChange(arrayMove2(items, activeIndex2, overIndex));
539
- }
540
- setActive(null);
541
- };
542
- const handleDragCancel = () => {
543
- setActive(null);
544
- };
545
- return /* @__PURE__ */ jsxs3(
546
- DndContext2,
547
- {
548
- sensors,
549
- onDragStart: handleDragStart,
550
- onDragEnd: handleDragEnd,
551
- onDragCancel: handleDragCancel,
552
- children: [
553
- /* @__PURE__ */ jsx3(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
554
- /* @__PURE__ */ jsx3(SortableContext2, { items, children: /* @__PURE__ */ jsx3(
555
- "ul",
556
- {
557
- role: "application",
558
- className: "flex list-inside list-none list-image-none flex-col p-0",
559
- children: items.map((item, index) => /* @__PURE__ */ jsx3(Fragment, { children: renderItem(item, index) }, item.id))
560
- }
561
- ) })
562
- ]
563
- }
564
- );
565
- };
566
- var dropAnimationConfig2 = {
567
- sideEffects: defaultDropAnimationSideEffects2({
568
- styles: {
569
- active: {
570
- opacity: "0.4"
571
- }
572
- }
573
- })
574
- };
575
- var Overlay = ({ children }) => {
576
- return /* @__PURE__ */ jsx3(
577
- DragOverlay2,
578
- {
579
- className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
580
- dropAnimation: dropAnimationConfig2,
581
- children
582
- }
583
- );
584
- };
585
- var SortableItemContext = createContext(null);
586
- var useSortableItemContext = () => {
587
- const context = useContext(SortableItemContext);
588
- if (!context) {
589
- throw new Error(
590
- "useSortableItemContext must be used within a SortableItemContext"
591
- );
592
- }
593
- return context;
594
- };
595
- var Item = ({
596
- id,
597
- className,
598
- children
599
- }) => {
600
- const {
601
- attributes,
602
- isDragging,
603
- listeners,
604
- setNodeRef,
605
- setActivatorNodeRef,
606
- transform,
607
- transition
608
- } = useSortable2({ id });
609
- const context = useMemo(
610
- () => ({
611
- attributes,
612
- listeners,
613
- ref: setActivatorNodeRef,
614
- isDragging
615
- }),
616
- [attributes, listeners, setActivatorNodeRef, isDragging]
617
- );
618
- const style = {
619
- opacity: isDragging ? 0.4 : void 0,
620
- transform: CSS2.Translate.toString(transform),
621
- transition
622
- };
623
- return /* @__PURE__ */ jsx3(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx3(
624
- "li",
625
- {
626
- className: clx("transition-fg flex flex-1 list-none", className),
627
- ref: setNodeRef,
628
- style,
629
- children
630
- }
631
- ) });
632
- };
633
- var DragHandle = () => {
634
- const { attributes, listeners, ref } = useSortableItemContext();
635
- return /* @__PURE__ */ jsx3(
636
- IconButton2,
637
- {
638
- variant: "transparent",
639
- size: "small",
640
- ...attributes,
641
- ...listeners,
642
- ref,
643
- className: "cursor-grab touch-none active:cursor-grabbing",
644
- children: /* @__PURE__ */ jsx3(DotsSix2, { className: "text-ui-fg-muted" })
645
- }
646
- );
647
- };
648
- var SortableList = Object.assign(List, {
649
- Item,
650
- DragHandle
651
- });
652
-
653
- // src/pages/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
654
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
655
- var getPermutations = (data) => {
656
- if (data.length === 0) {
657
- return [];
658
- }
659
- if (data.length === 1) {
660
- return data[0].values.map((value) => ({ [data[0].title]: value }));
661
- }
662
- const toProcess = data[0];
663
- const rest = data.slice(1);
664
- return toProcess.values.flatMap((value) => {
665
- return getPermutations(rest).map((permutation) => {
666
- return {
667
- [toProcess.title]: value,
668
- ...permutation
669
- };
670
- });
671
- });
672
- };
673
- var getVariantName = (options) => {
674
- return Object.values(options).join(" / ");
675
- };
676
- var ProductCreateVariantsSection = () => {
677
- const form = useTabbedForm();
678
- const { t } = useTranslation3();
679
- const options = useFieldArray2({
680
- control: form.control,
681
- name: "options"
682
- });
683
- const variants = useFieldArray2({
684
- control: form.control,
685
- name: "variants"
686
- });
687
- const watchedAreVariantsEnabled = useWatch({
688
- control: form.control,
689
- name: "enable_variants",
690
- defaultValue: false
691
- });
692
- const watchedOptions = useWatch({
693
- control: form.control,
694
- name: "options",
695
- defaultValue: []
696
- });
697
- const watchedVariants = useWatch({
698
- control: form.control,
699
- name: "variants",
700
- defaultValue: []
701
- });
702
- const showInvalidOptionsMessage = !!form.formState.errors.options?.length;
703
- const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
704
- const handleOptionValueUpdate = (index, value) => {
705
- const { isTouched: hasUserSelectedVariants } = form.getFieldState("variants");
706
- const newOptions = [...watchedOptions];
707
- newOptions[index].values = value;
708
- const permutations = getPermutations(
709
- newOptions.filter(({ values }) => values.length)
710
- );
711
- const oldVariants = [...watchedVariants];
712
- const findMatchingPermutation = (options2) => {
713
- return permutations.find(
714
- (permutation) => Object.keys(options2).every((key) => options2[key] === permutation[key])
715
- );
716
- };
717
- const newVariants = oldVariants.reduce((variants2, variant) => {
718
- const match = findMatchingPermutation(variant.options);
719
- if (match) {
720
- variants2.push({
721
- ...variant,
722
- title: getVariantName(match),
723
- options: match
724
- });
725
- }
726
- return variants2;
727
- }, []);
728
- const usedPermutations = new Set(
729
- newVariants.map((variant) => variant.options)
730
- );
731
- const unusedPermutations = permutations.filter(
732
- (permutation) => !usedPermutations.has(permutation)
733
- );
734
- unusedPermutations.forEach((permutation) => {
735
- newVariants.push({
736
- title: getVariantName(permutation),
737
- options: permutation,
738
- should_create: !hasUserSelectedVariants,
739
- variant_rank: newVariants.length,
740
- // NOTE - prepare inventory array here for now so we prevent rendering issue if we append the items later
741
- inventory: [{ inventory_item_id: "", required_quantity: "" }]
742
- });
743
- });
744
- form.setValue("variants", newVariants);
745
- };
746
- const handleRemoveOption = (index) => {
747
- if (index === 0) {
748
- return;
749
- }
750
- options.remove(index);
751
- const newOptions = [...watchedOptions];
752
- newOptions.splice(index, 1);
753
- const validOptionTitles = new Set(newOptions.map((option) => option.title));
754
- const permutations = getPermutations(newOptions);
755
- const oldVariants = [...watchedVariants];
756
- const newVariants = permutations.reduce((variants2, permutation) => {
757
- const variant = oldVariants.find(
758
- ({ options: options2 }) => Object.keys(options2).filter((option) => validOptionTitles.has(option)).every((key) => options2[key] === permutation[key])
759
- );
760
- if (variant) {
761
- variants2.push({
762
- ...variant,
763
- title: variant.title,
764
- options: permutation
765
- });
766
- }
767
- return variants2;
768
- }, []);
769
- form.setValue("variants", newVariants);
770
- };
771
- const handleRankChange = (items) => {
772
- const update = items.map((item, index) => {
773
- const variant = watchedVariants.find((v) => v.title === item.title);
774
- return {
775
- id: item.id,
776
- ...variant || item,
777
- variant_rank: index
778
- };
779
- });
780
- variants.replace(update);
781
- };
782
- const getCheckboxState = (variants2) => {
783
- if (variants2.every((variant) => variant.should_create)) {
784
- return true;
785
- }
786
- if (variants2.some((variant) => variant.should_create)) {
787
- return "indeterminate";
788
- }
789
- return false;
790
- };
791
- const onCheckboxChange = (value) => {
792
- switch (value) {
793
- case true: {
794
- const update = watchedVariants.map((variant) => {
795
- return {
796
- ...variant,
797
- should_create: true
798
- };
799
- });
800
- form.setValue("variants", update);
801
- break;
802
- }
803
- case false: {
804
- const update = watchedVariants.map((variant) => {
805
- return {
806
- ...variant,
807
- should_create: false
808
- };
809
- });
810
- form.setValue("variants", decorateVariantsWithDefaultValues(update));
811
- break;
812
- }
813
- case "indeterminate":
814
- break;
815
- }
816
- };
817
- const createDefaultOptionAndVariant = () => {
818
- form.setValue("options", [
819
- {
820
- title: "Default option",
821
- values: ["Default option value"]
822
- }
823
- ]);
824
- form.setValue(
825
- "variants",
826
- decorateVariantsWithDefaultValues([
827
- {
828
- title: "Default variant",
829
- should_create: true,
830
- variant_rank: 0,
831
- options: {
832
- "Default option": "Default option value"
833
- },
834
- inventory: [{ inventory_item_id: "", required_quantity: "" }],
835
- is_default: true
836
- }
837
- ])
838
- );
839
- };
840
- return /* @__PURE__ */ jsxs4("div", { id: "variants", className: "flex flex-col gap-y-8", "data-testid": "product-create-variants-section", children: [
841
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", "data-testid": "product-create-variants-section-header", children: [
842
- /* @__PURE__ */ jsx4(Heading, { level: "h2", "data-testid": "product-create-variants-section-heading", children: t("products.create.variants.header") }),
843
- /* @__PURE__ */ jsx4(
844
- SwitchBox,
845
- {
846
- control: form.control,
847
- name: "enable_variants",
848
- label: t("products.create.variants.subHeadingTitle"),
849
- description: t("products.create.variants.subHeadingDescription"),
850
- "data-testid": "product-create-variants-section-enable-switch",
851
- onCheckedChange: (checked) => {
852
- if (checked) {
853
- form.setValue("options", [
854
- {
855
- title: "",
856
- values: []
857
- }
858
- ]);
859
- form.setValue("variants", []);
860
- } else {
861
- createDefaultOptionAndVariant();
862
- }
863
- }
864
- }
865
- )
866
- ] }),
867
- watchedAreVariantsEnabled && /* @__PURE__ */ jsxs4(Fragment2, { children: [
868
- /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx4(
869
- Form.Field,
870
- {
871
- control: form.control,
872
- name: "options",
873
- render: () => {
874
- return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", children: [
875
- /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-x-4", children: [
876
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
877
- /* @__PURE__ */ jsx4(Form.Label, { children: t("products.create.variants.productOptions.label") }),
878
- /* @__PURE__ */ jsx4(Form.Hint, { children: t("products.create.variants.productOptions.hint") })
879
- ] }),
880
- /* @__PURE__ */ jsx4(
881
- Button,
882
- {
883
- size: "small",
884
- variant: "secondary",
885
- type: "button",
886
- onClick: () => {
887
- options.append({
888
- title: "",
889
- values: []
890
- });
891
- },
892
- "data-testid": "product-create-variants-section-add-option-button",
893
- children: t("actions.add")
894
- }
895
- )
896
- ] }),
897
- showInvalidOptionsMessage && /* @__PURE__ */ jsx4(Alert, { dismissible: true, variant: "error", "data-testid": "product-create-variants-section-options-error", children: t("products.create.errors.options") }),
898
- /* @__PURE__ */ jsx4("ul", { className: "flex flex-col gap-y-4", "data-testid": "product-create-variants-section-options-list", children: options.fields.map((option, index) => {
899
- const hasError = !!form.formState.errors.options?.[index];
900
- return /* @__PURE__ */ jsxs4(
901
- "li",
902
- {
903
- className: clx2(
904
- "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
905
- {
906
- "border-ui-border-error shadow-borders-error": hasError
907
- }
908
- ),
909
- "data-testid": `product-create-variants-section-option-${index}`,
910
- children: [
911
- /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
912
- /* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
913
- Label,
914
- {
915
- size: "xsmall",
916
- weight: "plus",
917
- className: "text-ui-fg-subtle",
918
- htmlFor: `options.${index}.title`,
919
- children: t("fields.title")
920
- }
921
- ) }),
922
- /* @__PURE__ */ jsx4(
923
- Input2,
924
- {
925
- className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
926
- ...form.register(
927
- `options.${index}.title`
928
- ),
929
- placeholder: t(
930
- "products.fields.options.optionTitlePlaceholder"
931
- ),
932
- "data-testid": `product-create-variants-section-option-title-input-${index}`
933
- }
934
- ),
935
- /* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
936
- Label,
937
- {
938
- size: "xsmall",
939
- weight: "plus",
940
- className: "text-ui-fg-subtle",
941
- htmlFor: `options.${index}.values`,
942
- children: t("fields.values")
943
- }
944
- ) }),
945
- /* @__PURE__ */ jsx4(
946
- Controller,
947
- {
948
- control: form.control,
949
- name: `options.${index}.values`,
950
- render: ({
951
- field: { onChange, ...field }
952
- }) => {
953
- const handleValueChange = (value) => {
954
- handleOptionValueUpdate(index, value);
955
- onChange(value);
956
- };
957
- return /* @__PURE__ */ jsx4(
958
- ChipInput,
959
- {
960
- ...field,
961
- variant: "contrast",
962
- onChange: handleValueChange,
963
- placeholder: t(
964
- "products.fields.options.variantionsPlaceholder"
965
- ),
966
- "data-testid": `product-create-variants-section-option-values-input-${index}`
967
- }
968
- );
969
- }
970
- }
971
- )
972
- ] }),
973
- /* @__PURE__ */ jsx4(
974
- IconButton3,
975
- {
976
- type: "button",
977
- size: "small",
978
- variant: "transparent",
979
- className: "text-ui-fg-muted",
980
- disabled: index === 0,
981
- onClick: () => handleRemoveOption(index),
982
- "data-testid": `product-create-variants-section-option-remove-${index}`,
983
- children: /* @__PURE__ */ jsx4(XMarkMini, {})
984
- }
985
- )
986
- ]
987
- },
988
- option.id
989
- );
990
- }) })
991
- ] }) });
992
- }
993
- }
994
- ) }),
995
- /* @__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: [
996
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
997
- /* @__PURE__ */ jsx4(Label, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
998
- /* @__PURE__ */ jsx4(Hint, { children: t("products.create.variants.productVariants.hint") })
999
- ] }),
1000
- !showInvalidOptionsMessage && showInvalidVariantsMessage && /* @__PURE__ */ jsx4(Alert, { dismissible: true, variant: "error", "data-testid": "product-create-variants-section-variants-error", children: t("products.create.errors.variants") }),
1001
- variants.fields.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "overflow-hidden rounded-xl border", "data-testid": "product-create-variants-section-variants-list", children: [
1002
- /* @__PURE__ */ jsxs4(
1003
- "div",
1004
- {
1005
- className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
1006
- style: {
1007
- gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
1008
- },
1009
- "data-testid": "product-create-variants-section-variants-header",
1010
- children: [
1011
- /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
1012
- Checkbox,
1013
- {
1014
- className: "relative",
1015
- checked: getCheckboxState(watchedVariants),
1016
- onCheckedChange: onCheckboxChange,
1017
- "data-testid": "product-create-variants-section-variants-select-all"
1018
- }
1019
- ) }),
1020
- /* @__PURE__ */ jsx4("div", {}),
1021
- watchedOptions.map((option, index) => /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", weight: "plus", children: option.title }) }, index))
1022
- ]
1023
- }
1024
- ),
1025
- /* @__PURE__ */ jsx4(
1026
- SortableList,
1027
- {
1028
- items: variants.fields,
1029
- onChange: handleRankChange,
1030
- renderItem: (item, index) => {
1031
- return /* @__PURE__ */ jsx4(
1032
- SortableList.Item,
1033
- {
1034
- id: item.id,
1035
- className: clx2("bg-ui-bg-base border-b", {
1036
- "border-b-0": index === variants.fields.length - 1
1037
- }),
1038
- children: /* @__PURE__ */ jsxs4(
1039
- "div",
1040
- {
1041
- className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
1042
- style: {
1043
- gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
1044
- },
1045
- children: [
1046
- /* @__PURE__ */ jsx4(
1047
- Form.Field,
1048
- {
1049
- control: form.control,
1050
- name: `variants.${index}.should_create`,
1051
- render: ({
1052
- field: { value, onChange, ...field }
1053
- }) => {
1054
- return /* @__PURE__ */ jsx4(Form.Item, { children: /* @__PURE__ */ jsx4(Form.Control, { children: /* @__PURE__ */ jsx4(
1055
- Checkbox,
1056
- {
1057
- className: "relative",
1058
- ...field,
1059
- checked: value,
1060
- onCheckedChange: onChange,
1061
- "data-testid": `product-create-variants-section-variant-checkbox-${index}`
1062
- }
1063
- ) }) });
1064
- }
1065
- }
1066
- ),
1067
- /* @__PURE__ */ jsx4(SortableList.DragHandle, {}),
1068
- Object.values(item.options).map((value, index2) => /* @__PURE__ */ jsx4(Text2, { size: "small", leading: "compact", children: value }, index2))
1069
- ]
1070
- }
1071
- )
1072
- }
1073
- );
1074
- }
1075
- }
1076
- )
1077
- ] }) : /* @__PURE__ */ jsx4(Alert, { "data-testid": "product-create-variants-section-variants-empty-alert", children: t("products.create.variants.productVariants.alert") }),
1078
- variants.fields.length > 0 && /* @__PURE__ */ jsx4(InlineTip, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
1079
- ] }) })
1080
- ] })
1081
- ] });
1082
- };
1083
-
1084
- // src/pages/products/product-create/components/product-create-details-form/product-create-details-form.tsx
1085
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1086
- var Root = () => {
1087
- return /* @__PURE__ */ jsx5(
1088
- "div",
1089
- {
1090
- className: "flex flex-col items-center p-16",
1091
- "data-testid": "product-create-details-form",
1092
- children: /* @__PURE__ */ jsxs5(
1093
- "div",
1094
- {
1095
- className: "flex w-full max-w-[720px] flex-col gap-y-8",
1096
- "data-testid": "product-create-details-form-content",
1097
- children: [
1098
- /* @__PURE__ */ jsx5(Header, {}),
1099
- /* @__PURE__ */ jsxs5(
1100
- "div",
1101
- {
1102
- className: "flex flex-col gap-y-6",
1103
- "data-testid": "product-create-details-form-sections",
1104
- children: [
1105
- /* @__PURE__ */ jsx5(ProductCreateGeneralSection, {}),
1106
- /* @__PURE__ */ jsx5(ProductCreateMediaSection, {})
1107
- ]
1108
- }
1109
- ),
1110
- /* @__PURE__ */ jsx5(Divider, { "data-testid": "product-create-details-form-divider" }),
1111
- /* @__PURE__ */ jsx5(ProductCreateVariantsSection, {})
1112
- ]
1113
- }
1114
- )
1115
- }
1116
- );
1117
- };
1118
- Root._tabMeta = defineTabMeta({
1119
- id: "details",
1120
- labelKey: "products.create.tabs.details",
1121
- validationFields: ["title", "handle", "description", "media", "options", "variants"]
1122
- });
1123
- var ProductCreateDetailsForm = Root;
1124
- var Header = () => {
1125
- const { t } = useTranslation4();
1126
- return /* @__PURE__ */ jsx5(
1127
- "div",
1128
- {
1129
- className: "flex flex-col",
1130
- "data-testid": "product-create-details-form-header",
1131
- children: /* @__PURE__ */ jsx5(Heading2, { "data-testid": "product-create-details-form-heading", children: t("products.create.header") })
1132
- }
1133
- );
1134
- };
1135
-
1136
- // src/pages/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx
1137
- import { Button as Button2, Heading as Heading3, IconButton as IconButton4, Input as Input3, Label as Label2 } from "@medusajs/ui";
1138
- import { useFieldArray as useFieldArray3, useWatch as useWatch2 } from "react-hook-form";
1139
- import { XMarkMini as XMarkMini2 } from "@medusajs/icons";
1140
- import { useTranslation as useTranslation5 } from "react-i18next";
1141
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1142
- function InventoryItemRow({
1143
- variantIndex,
1144
- inventoryIndex,
1145
- inventoryItem,
1146
- isItemOptionDisabled,
1147
- onRemove
1148
- }) {
1149
- const form = useTabbedForm();
1150
- const { t } = useTranslation5();
1151
- const selectedInventoryItemId = useWatch2({
1152
- control: form.control,
1153
- name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`
1154
- });
1155
- const items = useComboboxData({
1156
- queryKey: ["inventory_items"],
1157
- defaultValueKey: "id",
1158
- selectedValue: selectedInventoryItemId,
1159
- queryFn: (params) => sdk.admin.inventoryItems.query(params),
1160
- getOptions: (data) => data.inventory_items.map((item) => ({
1161
- label: `${item.title} ${item.sku ? `(${item.sku})` : ""}`,
1162
- value: item.id
1163
- }))
1164
- });
1165
- return /* @__PURE__ */ jsxs6(
1166
- "li",
1167
- {
1168
- className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
1169
- children: [
1170
- /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
1171
- /* @__PURE__ */ jsx6("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx6(
1172
- Label2,
1173
- {
1174
- size: "xsmall",
1175
- weight: "plus",
1176
- className: "text-ui-fg-subtle",
1177
- htmlFor: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
1178
- children: t("fields.item")
1179
- }
1180
- ) }),
1181
- /* @__PURE__ */ jsx6(
1182
- Form.Field,
1183
- {
1184
- control: form.control,
1185
- name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
1186
- render: ({ field }) => {
1187
- return /* @__PURE__ */ jsx6(Form.Item, { children: /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
1188
- Combobox,
1189
- {
1190
- ...field,
1191
- options: items.options.map((o) => ({
1192
- ...o,
1193
- disabled: isItemOptionDisabled(o, inventoryIndex)
1194
- })),
1195
- searchValue: items.searchValue,
1196
- onBlur: () => items.onSearchValueChange(""),
1197
- onSearchValueChange: items.onSearchValueChange,
1198
- fetchNextPage: items.fetchNextPage,
1199
- className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
1200
- placeholder: t("products.create.inventory.itemPlaceholder")
1201
- }
1202
- ) }) });
1203
- }
1204
- }
1205
- ),
1206
- /* @__PURE__ */ jsx6("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx6(
1207
- Label2,
1208
- {
1209
- size: "xsmall",
1210
- weight: "plus",
1211
- className: "text-ui-fg-subtle",
1212
- htmlFor: `variants.${variantIndex}.inventory.${inventoryIndex}.required_quantity`,
1213
- children: t("fields.quantity")
1214
- }
1215
- ) }),
1216
- /* @__PURE__ */ jsx6(
1217
- Form.Field,
1218
- {
1219
- control: form.control,
1220
- name: `variants.${variantIndex}.inventory.${inventoryIndex}.required_quantity`,
1221
- render: ({ field: { onChange, value, ...field } }) => {
1222
- return /* @__PURE__ */ jsxs6(Form.Item, { children: [
1223
- /* @__PURE__ */ jsx6(Form.Control, { children: /* @__PURE__ */ jsx6(
1224
- Input3,
1225
- {
1226
- type: "number",
1227
- className: "bg-ui-bg-field-component",
1228
- min: 0,
1229
- value,
1230
- onChange: (e) => {
1231
- const value2 = e.target.value;
1232
- if (value2 === "") {
1233
- onChange(null);
1234
- } else {
1235
- onChange(Number(value2));
1236
- }
1237
- },
1238
- ...field,
1239
- placeholder: t(
1240
- "products.create.inventory.quantityPlaceholder"
1241
- )
1242
- }
1243
- ) }),
1244
- /* @__PURE__ */ jsx6(Form.ErrorMessage, {})
1245
- ] });
1246
- }
1247
- }
1248
- )
1249
- ] }),
1250
- /* @__PURE__ */ jsx6(
1251
- IconButton4,
1252
- {
1253
- type: "button",
1254
- size: "small",
1255
- variant: "transparent",
1256
- className: "text-ui-fg-muted",
1257
- onClick: onRemove,
1258
- children: /* @__PURE__ */ jsx6(XMarkMini2, {})
1259
- }
1260
- )
1261
- ]
1262
- },
1263
- inventoryItem.id
1264
- );
1265
- }
1266
- function VariantSection({ variant, index }) {
1267
- const form = useTabbedForm();
1268
- const { t } = useTranslation5();
1269
- const inventory = useFieldArray3({
1270
- control: form.control,
1271
- name: `variants.${index}.inventory`
1272
- });
1273
- const inventoryFormData = useWatch2({
1274
- control: form.control,
1275
- name: `variants.${index}.inventory`
1276
- });
1277
- const isItemOptionDisabled = (option, inventoryIndex) => {
1278
- return !!inventoryFormData?.some(
1279
- (i, index2) => index2 != inventoryIndex && i.inventory_item_id === option.value
1280
- );
1281
- };
1282
- return /* @__PURE__ */ jsxs6("div", { className: "grid gap-y-4", children: [
1283
- /* @__PURE__ */ jsxs6("div", { className: "flex items-start justify-between gap-x-4", children: [
1284
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
1285
- /* @__PURE__ */ jsx6(Form.Label, { children: variant.title }),
1286
- /* @__PURE__ */ jsx6(Form.Hint, { children: t("products.create.inventory.label") })
1287
- ] }),
1288
- /* @__PURE__ */ jsx6(
1289
- Button2,
1290
- {
1291
- size: "small",
1292
- variant: "secondary",
1293
- type: "button",
1294
- onClick: () => {
1295
- inventory.append({
1296
- inventory_item_id: "",
1297
- required_quantity: ""
1298
- });
1299
- },
1300
- children: t("actions.add")
1301
- }
1302
- )
1303
- ] }),
1304
- inventory.fields.map((inventoryItem, inventoryIndex) => /* @__PURE__ */ jsx6(
1305
- InventoryItemRow,
1306
- {
1307
- variantIndex: index,
1308
- inventoryIndex,
1309
- inventoryItem,
1310
- isItemOptionDisabled,
1311
- onRemove: () => inventory.remove(inventoryIndex)
1312
- },
1313
- inventoryItem.id
1314
- ))
1315
- ] });
1316
- }
1317
- var ProductCreateInventoryKitSection = () => {
1318
- const form = useTabbedForm();
1319
- const { t } = useTranslation5();
1320
- const variants = useFieldArray3({
1321
- control: form.control,
1322
- name: "variants"
1323
- });
1324
- return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", children: [
1325
- /* @__PURE__ */ jsx6(Heading3, { children: t("products.create.inventory.heading") }),
1326
- variants.fields.filter((v) => v.inventory_kit).map((variant, variantIndex) => /* @__PURE__ */ jsx6(
1327
- VariantSection,
1328
- {
1329
- variant,
1330
- index: variantIndex
1331
- },
1332
- variant.id
1333
- ))
1334
- ] });
1335
- };
1336
-
1337
- // src/pages/products/product-create/components/product-create-inventory-kit-form/product-create-inventory-kit-form.tsx
1338
- import { jsx as jsx7 } from "react/jsx-runtime";
1339
- var Root2 = () => {
1340
- 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, {}) }) });
1341
- };
1342
- Root2._tabMeta = defineTabMeta({
1343
- id: "inventory",
1344
- labelKey: "products.create.tabs.inventory",
1345
- validationFields: ["variants"]
1346
- });
1347
- var ProductCreateInventoryKitForm = Root2;
1348
-
1349
- // src/pages/products/product-create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
1350
- import { Button as Button3, Heading as Heading4 } from "@medusajs/ui";
1351
- import { useFieldArray as useFieldArray4 } from "react-hook-form";
1352
- import { Trans, useTranslation as useTranslation6 } from "react-i18next";
1353
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1354
- var ProductCreateOrganizationSection = () => {
1355
- const form = useTabbedForm();
1356
- const { t } = useTranslation6();
1357
- const sellers = useComboboxData({
1358
- queryKey: ["sellers"],
1359
- queryFn: (params) => sdk.admin.sellers.query({ fetchOptions: { method: "GET" }, ...params }),
1360
- getOptions: (data) => data.sellers.map((seller) => ({
1361
- label: seller.name,
1362
- value: seller.id
1363
- }))
1364
- });
1365
- const collections = useComboboxData({
1366
- queryKey: ["product_collections"],
1367
- queryFn: (params) => sdk.admin.collections.query(params),
1368
- getOptions: (data) => data.collections.map((collection) => ({
1369
- label: collection.title,
1370
- value: collection.id
1371
- }))
1372
- });
1373
- const types = useComboboxData({
1374
- queryKey: ["product_types"],
1375
- queryFn: (params) => sdk.admin.productTypes.query(params),
1376
- getOptions: (data) => data.product_types.map((type) => ({
1377
- label: type.value,
1378
- value: type.id
1379
- }))
1380
- });
1381
- const tags = useComboboxData({
1382
- queryKey: ["product_tags"],
1383
- queryFn: (params) => sdk.admin.productTags.query(params),
1384
- getOptions: (data) => data.product_tags.map((tag) => ({
1385
- label: tag.value,
1386
- value: tag.id
1387
- }))
1388
- });
1389
- const shippingProfiles = useComboboxData({
1390
- queryKey: ["shipping_profiles"],
1391
- queryFn: (params) => sdk.admin.shippingProfiles.query(params),
1392
- getOptions: (data) => data.shipping_profiles.map((shippingProfile) => ({
1393
- label: shippingProfile.name,
1394
- value: shippingProfile.id
1395
- }))
1396
- });
1397
- const { fields, remove, replace } = useFieldArray4({
1398
- control: form.control,
1399
- name: "sales_channels",
1400
- keyName: "key"
1401
- });
1402
- const handleClearAllSalesChannels = () => {
1403
- replace([]);
1404
- };
1405
- return /* @__PURE__ */ jsxs7("div", { id: "organize", className: "flex flex-col gap-y-8", "data-testid": "product-create-organize-section", children: [
1406
- /* @__PURE__ */ jsx8(Heading4, { "data-testid": "product-create-organize-section-heading", children: t("products.organization.header") }),
1407
- /* @__PURE__ */ jsx8(
1408
- SwitchBox,
1409
- {
1410
- control: form.control,
1411
- name: "discountable",
1412
- label: t("products.fields.discountable.label"),
1413
- description: t("products.fields.discountable.hint"),
1414
- optional: true,
1415
- "data-testid": "product-create-organize-section-discountable-switch"
1416
- }
1417
- ),
1418
- /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: /* @__PURE__ */ jsx8(
1419
- Form.Field,
1420
- {
1421
- control: form.control,
1422
- name: "seller_id",
1423
- render: ({ field }) => {
1424
- return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1425
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: "Seller" }),
1426
- /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1427
- Combobox,
1428
- {
1429
- ...field,
1430
- options: sellers.options,
1431
- searchValue: sellers.searchValue,
1432
- onSearchValueChange: sellers.onSearchValueChange,
1433
- fetchNextPage: sellers.fetchNextPage
1434
- }
1435
- ) }),
1436
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1437
- ] });
1438
- }
1439
- }
1440
- ) }),
1441
- /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-type-collection", children: [
1442
- /* @__PURE__ */ jsx8(
1443
- Form.Field,
1444
- {
1445
- control: form.control,
1446
- name: "type_id",
1447
- render: ({ field }) => {
1448
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-type-item", children: [
1449
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-type-label", children: t("products.fields.type.label") }),
1450
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-type-control", children: /* @__PURE__ */ jsx8(
1451
- Combobox,
1452
- {
1453
- ...field,
1454
- options: types.options,
1455
- searchValue: types.searchValue,
1456
- onSearchValueChange: types.onSearchValueChange,
1457
- fetchNextPage: types.fetchNextPage,
1458
- "data-testid": "product-create-organize-section-type-input"
1459
- }
1460
- ) }),
1461
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1462
- ] });
1463
- }
1464
- }
1465
- ),
1466
- /* @__PURE__ */ jsx8(
1467
- Form.Field,
1468
- {
1469
- control: form.control,
1470
- name: "collection_id",
1471
- render: ({ field }) => {
1472
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-collection-item", children: [
1473
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-collection-label", children: t("products.fields.collection.label") }),
1474
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-collection-control", children: /* @__PURE__ */ jsx8(
1475
- Combobox,
1476
- {
1477
- ...field,
1478
- options: collections.options,
1479
- searchValue: collections.searchValue,
1480
- onSearchValueChange: collections.onSearchValueChange,
1481
- fetchNextPage: collections.fetchNextPage,
1482
- "data-testid": "product-create-organize-section-collection-input"
1483
- }
1484
- ) }),
1485
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1486
- ] });
1487
- }
1488
- }
1489
- )
1490
- ] }),
1491
- /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", "data-testid": "product-create-organize-section-categories-tags", children: [
1492
- /* @__PURE__ */ jsx8(
1493
- Form.Field,
1494
- {
1495
- control: form.control,
1496
- name: "categories",
1497
- render: ({ field }) => {
1498
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-categories-item", children: [
1499
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-categories-label", children: t("products.fields.categories.label") }),
1500
- /* @__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" }) }),
1501
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1502
- ] });
1503
- }
1504
- }
1505
- ),
1506
- /* @__PURE__ */ jsx8(
1507
- Form.Field,
1508
- {
1509
- control: form.control,
1510
- name: "tags",
1511
- render: ({ field }) => {
1512
- return /* @__PURE__ */ jsxs7(Form.Item, { "data-testid": "product-create-organize-section-tags-item", children: [
1513
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, "data-testid": "product-create-organize-section-tags-label", children: t("products.fields.tags.label") }),
1514
- /* @__PURE__ */ jsx8(Form.Control, { "data-testid": "product-create-organize-section-tags-control", children: /* @__PURE__ */ jsx8(
1515
- Combobox,
1516
- {
1517
- ...field,
1518
- options: tags.options,
1519
- searchValue: tags.searchValue,
1520
- onSearchValueChange: tags.onSearchValueChange,
1521
- fetchNextPage: tags.fetchNextPage,
1522
- "data-testid": "product-create-organize-section-tags-input"
1523
- }
1524
- ) }),
1525
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1526
- ] });
1527
- }
1528
- }
1529
- )
1530
- ] }),
1531
- /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
1532
- /* @__PURE__ */ jsxs7("div", { children: [
1533
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: t("products.fields.shipping_profile.label") }),
1534
- /* @__PURE__ */ jsx8(Form.Hint, { children: /* @__PURE__ */ jsx8(Trans, { i18nKey: "products.fields.shipping_profile.hint" }) })
1535
- ] }),
1536
- /* @__PURE__ */ jsx8(
1537
- Form.Field,
1538
- {
1539
- control: form.control,
1540
- name: "shipping_profile_id",
1541
- render: ({ field }) => {
1542
- return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1543
- /* @__PURE__ */ jsx8(Form.Control, { children: /* @__PURE__ */ jsx8(
1544
- Combobox,
1545
- {
1546
- ...field,
1547
- options: shippingProfiles.options,
1548
- searchValue: shippingProfiles.searchValue,
1549
- onSearchValueChange: shippingProfiles.onSearchValueChange,
1550
- fetchNextPage: shippingProfiles.fetchNextPage
1551
- }
1552
- ) }),
1553
- /* @__PURE__ */ jsx8(Form.ErrorMessage, {})
1554
- ] });
1555
- }
1556
- }
1557
- )
1558
- ] }),
1559
- /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-1 gap-y-4", children: /* @__PURE__ */ jsx8(
1560
- Form.Field,
1561
- {
1562
- control: form.control,
1563
- name: "sales_channels",
1564
- render: () => {
1565
- return /* @__PURE__ */ jsxs7(Form.Item, { children: [
1566
- /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-x-4", children: [
1567
- /* @__PURE__ */ jsxs7("div", { children: [
1568
- /* @__PURE__ */ jsx8(Form.Label, { optional: true, children: t("products.fields.sales_channels.label") }),
1569
- /* @__PURE__ */ jsx8(Form.Hint, { children: /* @__PURE__ */ jsx8(Trans, { i18nKey: "products.fields.sales_channels.hint" }) })
1570
- ] }),
1571
- /* @__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") }) })
1572
- ] }),
1573
- /* @__PURE__ */ jsx8(Form.Control, { className: "mt-0", children: fields.length > 0 && /* @__PURE__ */ jsx8(
1574
- ChipGroup,
1575
- {
1576
- onClearAll: handleClearAllSalesChannels,
1577
- onRemove: remove,
1578
- className: "py-4",
1579
- children: fields.map((field, index) => /* @__PURE__ */ jsx8(ChipGroup.Chip, { index, children: field.name }, field.key))
1580
- }
1581
- ) })
1582
- ] });
1583
- }
1584
- }
1585
- ) })
1586
- ] });
1587
- };
1588
-
1589
- // src/pages/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
1590
- import {
1591
- Button as Button4,
1592
- createDataTableColumnHelper
1593
- } from "@medusajs/ui";
1594
- import { useEffect, useMemo as useMemo2, useState as useState3 } from "react";
1595
- import { useTranslation as useTranslation7 } from "react-i18next";
1596
- import { keepPreviousData } from "@tanstack/react-query";
1597
-
1598
- // src/pages/products/product-create/components/product-create-organize-form/constants.ts
1599
- var SC_STACKED_MODAL_ID = "sc";
1600
-
1601
- // src/pages/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
1602
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1603
- var PAGE_SIZE = 20;
1604
- var ProductCreateSalesChannelStackedModal = () => {
1605
- const form = useTabbedForm();
1606
- const { t } = useTranslation7();
1607
- const { getValues, setValue } = form;
1608
- const { setIsOpen, getIsOpen } = useStackedModal();
1609
- const [rowSelection, setRowSelection] = useState3(
1610
- {}
1611
- );
1612
- const [state, setState] = useState3([]);
1613
- const searchParams = useSalesChannelTableQuery({
1614
- pageSize: PAGE_SIZE,
1615
- prefix: SC_STACKED_MODAL_ID
1616
- });
1617
- const { sales_channels, count, isLoading, isError, error } = useSalesChannels(
1618
- searchParams,
1619
- {
1620
- placeholderData: keepPreviousData
1621
- }
1622
- );
1623
- const open = getIsOpen(SC_STACKED_MODAL_ID);
1624
- useEffect(() => {
1625
- if (!open) {
1626
- return;
1627
- }
1628
- const salesChannels = getValues("sales_channels");
1629
- if (salesChannels) {
1630
- setState(
1631
- salesChannels.map((channel) => ({
1632
- id: channel.id,
1633
- name: channel.name
1634
- }))
1635
- );
1636
- setRowSelection(
1637
- salesChannels.reduce(
1638
- (acc, channel) => ({
1639
- ...acc,
1640
- [channel.id]: true
1641
- }),
1642
- {}
1643
- )
1644
- );
1645
- }
1646
- }, [open, getValues]);
1647
- const onRowSelectionChange = (state2) => {
1648
- const ids = Object.keys(state2);
1649
- const addedIdsSet = new Set(
1650
- ids.filter((id) => state2[id] && !rowSelection[id])
1651
- );
1652
- let addedSalesChannels = [];
1653
- if (addedIdsSet.size > 0) {
1654
- addedSalesChannels = sales_channels?.filter((channel) => addedIdsSet.has(channel.id)) ?? [];
1655
- }
1656
- setState((prev) => {
1657
- const filteredPrev = prev.filter((channel) => state2[channel.id]);
1658
- return Array.from(/* @__PURE__ */ new Set([...filteredPrev, ...addedSalesChannels]));
1659
- });
1660
- setRowSelection(state2);
1661
- };
1662
- const handleAdd = () => {
1663
- setValue("sales_channels", state, {
1664
- shouldDirty: true,
1665
- shouldTouch: true
1666
- });
1667
- setIsOpen(SC_STACKED_MODAL_ID, false);
1668
- };
1669
- const filters = useSalesChannelTableFilters();
1670
- const columns = useColumns();
1671
- const emptyState = useSalesChannelTableEmptyState();
1672
- if (isError) {
1673
- throw error;
1674
- }
1675
- return /* @__PURE__ */ jsxs8(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
1676
- /* @__PURE__ */ jsx9(StackedFocusModal.Header, {}),
1677
- /* @__PURE__ */ jsx9(StackedFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx9(
1678
- DataTable,
1679
- {
1680
- data: sales_channels,
1681
- columns,
1682
- filters,
1683
- emptyState,
1684
- rowCount: count,
1685
- pageSize: PAGE_SIZE,
1686
- getRowId: (row) => row.id,
1687
- rowSelection: {
1688
- state: rowSelection,
1689
- onRowSelectionChange
1690
- },
1691
- isLoading,
1692
- layout: "fill",
1693
- prefix: SC_STACKED_MODAL_ID
1694
- }
1695
- ) }),
1696
- /* @__PURE__ */ jsx9(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-end gap-x-2", children: [
1697
- /* @__PURE__ */ jsx9(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx9(Button4, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
1698
- /* @__PURE__ */ jsx9(Button4, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
1699
- ] }) })
1700
- ] });
1701
- };
1702
- var columnHelper = createDataTableColumnHelper();
1703
- var useColumns = () => {
1704
- const base = useSalesChannelTableColumns();
1705
- return useMemo2(() => [columnHelper.select(), ...base], [base]);
1706
- };
1707
-
1708
- // src/pages/products/product-create/components/product-create-organize-form/product-create-organize-form.tsx
1709
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1710
- var Root3 = () => {
1711
- return /* @__PURE__ */ jsxs9(StackedFocusModal, { id: SC_STACKED_MODAL_ID, children: [
1712
- /* @__PURE__ */ jsx10(
1713
- "div",
1714
- {
1715
- className: "flex flex-col items-center p-16",
1716
- "data-testid": "product-create-organize-form",
1717
- children: /* @__PURE__ */ jsx10(
1718
- "div",
1719
- {
1720
- className: "flex w-full max-w-[720px] flex-col gap-y-8",
1721
- "data-testid": "product-create-organize-form-content",
1722
- children: /* @__PURE__ */ jsx10(ProductCreateOrganizationSection, {})
1723
- }
1724
- )
1725
- }
1726
- ),
1727
- /* @__PURE__ */ jsx10(ProductCreateSalesChannelStackedModal, {})
1728
- ] });
1729
- };
1730
- Root3._tabMeta = defineTabMeta({
1731
- id: "organize",
1732
- labelKey: "products.create.tabs.organize",
1733
- validationFields: [
1734
- "type_id",
1735
- "collection_id",
1736
- "categories",
1737
- "tags",
1738
- "sales_channels",
1739
- "shipping_profile_id",
1740
- "origin_country",
1741
- "material",
1742
- "width",
1743
- "length",
1744
- "height",
1745
- "weight",
1746
- "mid_code",
1747
- "hs_code"
1748
- ]
1749
- });
1750
- var ProductCreateOrganizeForm = Root3;
1751
-
1752
- // src/pages/products/product-create/components/product-create-variants-form/product-create-variants-form.tsx
1753
- import { useMemo as useMemo3 } from "react";
1754
- import { useWatch as useWatch3 } from "react-hook-form";
1755
- import { useTranslation as useTranslation8 } from "react-i18next";
1756
- import { jsx as jsx11 } from "react/jsx-runtime";
1757
- var Root4 = () => {
1758
- const form = useTabbedForm();
1759
- const { setCloseOnEscape } = useRouteModal();
1760
- const { store } = useStore({
1761
- fields: "+default_sales_channel"
1762
- });
1763
- const { regions } = useRegions({ limit: 9999 });
1764
- const { price_preferences: pricePreferences } = usePricePreferences({
1765
- limit: 9999
1766
- });
1767
- const currencyCodes = useMemo3(
1768
- () => store?.supported_currencies?.map((c) => c.currency_code) || [],
1769
- [store]
1770
- );
1771
- const variants = useWatch3({
1772
- control: form.control,
1773
- name: "variants",
1774
- defaultValue: []
1775
- });
1776
- const options = useWatch3({
1777
- control: form.control,
1778
- name: "options",
1779
- defaultValue: []
1780
- });
1781
- const columns = useColumns2({
1782
- options,
1783
- currencies: currencyCodes,
1784
- regions: regions ?? [],
1785
- pricePreferences: pricePreferences ?? []
1786
- });
1787
- const variantData = useMemo3(() => {
1788
- const ret = [];
1789
- variants.forEach((v, i) => {
1790
- if (v.should_create) {
1791
- ret.push({ ...v, originalIndex: i });
1792
- }
1793
- });
1794
- return ret;
1795
- }, [variants]);
1796
- 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(
1797
- DataGrid,
1798
- {
1799
- columns,
1800
- data: variantData,
1801
- state: form,
1802
- onEditingChange: (editing) => setCloseOnEscape(!editing)
1803
- }
1804
- ) }) });
1805
- };
1806
- Root4._tabMeta = defineTabMeta({
1807
- id: "variants",
1808
- labelKey: "products.create.tabs.variants",
1809
- validationFields: ["variants"]
1810
- });
1811
- var ProductCreateVariantsForm = Root4;
1812
- var columnHelper2 = createDataGridHelper();
1813
- var useColumns2 = ({
1814
- options,
1815
- currencies = [],
1816
- regions = [],
1817
- pricePreferences = []
1818
- }) => {
1819
- const { t } = useTranslation8();
1820
- return useMemo3(
1821
- () => [
1822
- columnHelper2.column({
1823
- id: "options",
1824
- 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(" / ") }) }),
1825
- cell: (context) => {
1826
- return /* @__PURE__ */ jsx11(DataGrid.ReadonlyCell, { context, children: options.map((o) => context.row.original.options[o.title]).join(" / ") });
1827
- },
1828
- disableHiding: true
1829
- }),
1830
- columnHelper2.column({
1831
- id: "title",
1832
- name: t("fields.title"),
1833
- header: t("fields.title"),
1834
- field: (context) => `variants.${context.row.original.originalIndex}.title`,
1835
- type: "text",
1836
- cell: (context) => {
1837
- return /* @__PURE__ */ jsx11(DataGrid.TextCell, { context });
1838
- }
1839
- }),
1840
- columnHelper2.column({
1841
- id: "sku",
1842
- name: t("fields.sku"),
1843
- header: t("fields.sku"),
1844
- field: (context) => `variants.${context.row.original.originalIndex}.sku`,
1845
- type: "text",
1846
- cell: (context) => {
1847
- return /* @__PURE__ */ jsx11(DataGrid.TextCell, { context });
1848
- }
1849
- }),
1850
- columnHelper2.column({
1851
- id: "manage_inventory",
1852
- name: t("fields.managedInventory"),
1853
- header: t("fields.managedInventory"),
1854
- field: (context) => `variants.${context.row.original.originalIndex}.manage_inventory`,
1855
- type: "boolean",
1856
- cell: (context) => {
1857
- return /* @__PURE__ */ jsx11(DataGrid.BooleanCell, { context });
1858
- }
1859
- }),
1860
- columnHelper2.column({
1861
- id: "allow_backorder",
1862
- name: t("fields.allowBackorder"),
1863
- header: t("fields.allowBackorder"),
1864
- field: (context) => `variants.${context.row.original.originalIndex}.allow_backorder`,
1865
- type: "boolean",
1866
- cell: (context) => {
1867
- return /* @__PURE__ */ jsx11(DataGrid.BooleanCell, { context });
1868
- }
1869
- }),
1870
- columnHelper2.column({
1871
- id: "inventory_kit",
1872
- name: t("fields.inventoryKit"),
1873
- header: t("fields.inventoryKit"),
1874
- field: (context) => `variants.${context.row.original.originalIndex}.inventory_kit`,
1875
- type: "boolean",
1876
- cell: (context) => {
1877
- return /* @__PURE__ */ jsx11(
1878
- DataGrid.BooleanCell,
1879
- {
1880
- context,
1881
- disabled: !context.row.original.manage_inventory
1882
- }
1883
- );
1884
- }
1885
- }),
1886
- ...createDataGridPriceColumns({
1887
- currencies,
1888
- regions,
1889
- pricePreferences,
1890
- getFieldName: (context, value) => {
1891
- if (context.column.id?.startsWith("currency_prices")) {
1892
- return `variants.${context.row.original.originalIndex}.prices.${value}`;
1893
- }
1894
- return `variants.${context.row.original.originalIndex}.prices.${value}`;
1895
- },
1896
- t
1897
- })
1898
- ],
1899
- [currencies, regions, options, pricePreferences, t]
1900
- );
1901
- };
1902
-
1903
- // src/pages/products/product-create/components/product-create-form/product-create-form.tsx
1904
- import { zodResolver } from "@hookform/resolvers/zod";
1905
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1906
- var SAVE_DRAFT_BUTTON = "save-draft-button";
1907
- var ProductCreateForm = ({
1908
- defaultChannel,
1909
- children,
1910
- schema,
1911
- defaultValues: extraDefaults
1912
- }) => {
1913
- const { t } = useTranslation9();
1914
- const { handleSuccess } = useRouteModal();
1915
- const form = useForm({
1916
- defaultValues: {
1917
- ...PRODUCT_CREATE_FORM_DEFAULTS,
1918
- ...extraDefaults,
1919
- sales_channels: defaultChannel ? [{ id: defaultChannel.id, name: defaultChannel.name }] : []
1920
- },
1921
- resolver: zodResolver(schema ?? ProductCreateSchema)
1922
- });
1923
- const { mutateAsync, isPending } = useCreateProduct();
1924
- const {
1925
- regions,
1926
- isPending: isRegionsPending,
1927
- isError: isRegionsError,
1928
- error: regionsError
1929
- } = useRegions({ limit: 9999 });
1930
- if (isRegionsError) {
1931
- throw regionsError;
1932
- }
1933
- const regionsCurrencyMap = useMemo4(() => {
1934
- if (!regions?.length) {
1935
- return {};
1936
- }
1937
- return regions.reduce(
1938
- (acc, reg) => {
1939
- acc[reg.id] = reg.currency_code;
1940
- return acc;
1941
- },
1942
- {}
1943
- );
1944
- }, [regions]);
1945
- const watchedVariants = useWatch4({
1946
- control: form.control,
1947
- name: "variants"
1948
- });
1949
- const handleSubmit = form.handleSubmit(async (values, e) => {
1950
- if (isRegionsPending) {
1951
- return;
1952
- }
1953
- let isDraftSubmission = false;
1954
- if (e?.nativeEvent instanceof SubmitEvent) {
1955
- const submitter = e?.nativeEvent?.submitter;
1956
- isDraftSubmission = submitter.dataset.name === SAVE_DRAFT_BUTTON;
1957
- }
1958
- const media = values.media || [];
1959
- const payload = { ...values, media: void 0 };
1960
- let uploadedMedia = [];
1961
- try {
1962
- if (media.length) {
1963
- const thumbnailReq = media.find((m) => m.isThumbnail);
1964
- const otherMediaReq = media.filter((m) => !m.isThumbnail);
1965
- const fileReqs = [];
1966
- if (thumbnailReq) {
1967
- fileReqs.push(
1968
- sdk.admin.uploads.mutate({ files: [thumbnailReq.file] }).then((r) => r.files.map((f) => ({ ...f, isThumbnail: true })))
1969
- );
1970
- }
1971
- if (otherMediaReq?.length) {
1972
- fileReqs.push(
1973
- sdk.admin.uploads.mutate({
1974
- files: otherMediaReq.map((m) => m.file)
1975
- }).then((r) => r.files.map((f) => ({ ...f, isThumbnail: false })))
1976
- );
1977
- }
1978
- uploadedMedia = (await Promise.all(fileReqs)).flat();
1979
- }
1980
- } catch (error) {
1981
- if (error instanceof Error) {
1982
- toast.error(error.message);
1983
- }
1984
- }
1985
- await mutateAsync(
1986
- normalizeProductFormValues({
1987
- ...payload,
1988
- media: uploadedMedia,
1989
- status: isDraftSubmission ? "draft" : "published",
1990
- regionsCurrencyMap
1991
- }),
1992
- {
1993
- onSuccess: (data) => {
1994
- toast.success(
1995
- t("products.create.successToast", {
1996
- title: data.product.title
1997
- })
1998
- );
1999
- handleSuccess(`../${data.product.id}`);
2000
- },
2001
- onError: (error) => {
2002
- toast.error(error.message);
2003
- }
2004
- }
2005
- );
2006
- });
2007
- const transformTabs = useCallback(
2008
- (tabs) => {
2009
- const showInventoryTab = watchedVariants?.some(
2010
- (v) => v.manage_inventory && v.inventory_kit
2011
- ) ?? false;
2012
- return tabs.map((tab) => {
2013
- if (tab.id === "inventory") {
2014
- return {
2015
- ...tab,
2016
- isVisible: () => showInventoryTab
2017
- };
2018
- }
2019
- return tab;
2020
- });
2021
- },
2022
- [watchedVariants]
2023
- );
2024
- const defaultTabs = useMemo4(
2025
- () => [
2026
- /* @__PURE__ */ jsx12(ProductCreateDetailsForm, {}, "details"),
2027
- /* @__PURE__ */ jsx12(ProductCreateOrganizeForm, {}, "organize"),
2028
- /* @__PURE__ */ jsx12(ProductCreateVariantsForm, {}, "variants"),
2029
- /* @__PURE__ */ jsx12(ProductCreateInventoryKitForm, {}, "inventory")
2030
- ],
2031
- []
2032
- );
2033
- const hasCustomChildren = Children.count(children) > 0;
2034
- return /* @__PURE__ */ jsx12(
2035
- TabbedForm,
2036
- {
2037
- form,
2038
- onSubmit: handleSubmit,
2039
- isLoading: isPending || isRegionsPending,
2040
- transformTabs,
2041
- footer: ({ isLastTab, onNext, isLoading }) => /* @__PURE__ */ jsxs10(
2042
- "div",
2043
- {
2044
- className: "flex items-center justify-end gap-x-2",
2045
- "data-testid": "product-create-form-footer-actions",
2046
- children: [
2047
- /* @__PURE__ */ jsx12(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx12(
2048
- Button5,
2049
- {
2050
- variant: "secondary",
2051
- size: "small",
2052
- "data-testid": "product-create-form-cancel-button",
2053
- children: t("actions.cancel")
2054
- }
2055
- ) }),
2056
- /* @__PURE__ */ jsx12(
2057
- Button5,
2058
- {
2059
- "data-name": SAVE_DRAFT_BUTTON,
2060
- size: "small",
2061
- type: "submit",
2062
- isLoading,
2063
- className: "whitespace-nowrap",
2064
- "data-testid": "product-create-form-save-draft-button",
2065
- children: t("actions.saveAsDraft")
2066
- }
2067
- ),
2068
- isLastTab ? /* @__PURE__ */ jsx12(
2069
- Button5,
2070
- {
2071
- "data-name": "publish-button",
2072
- type: "submit",
2073
- variant: "primary",
2074
- size: "small",
2075
- isLoading,
2076
- "data-testid": "product-create-form-publish-button",
2077
- children: t("actions.publish")
2078
- },
2079
- "submit-button"
2080
- ) : /* @__PURE__ */ jsx12(
2081
- Button5,
2082
- {
2083
- type: "button",
2084
- variant: "primary",
2085
- size: "small",
2086
- onClick: () => onNext(),
2087
- "data-testid": "product-create-form-continue-button",
2088
- children: t("actions.continue")
2089
- },
2090
- "next-button"
2091
- )
2092
- ]
2093
- }
2094
- ),
2095
- children: hasCustomChildren ? children : defaultTabs
2096
- }
2097
- );
2098
- };
2099
-
2100
- // src/pages/products/product-create/product-create.tsx
2101
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2102
- var Root5 = ({ children }) => {
2103
- const { t } = useTranslation10();
2104
- const {
2105
- store,
2106
- isPending: isStorePending,
2107
- isError: isStoreError,
2108
- error: storeError
2109
- } = useStore({
2110
- fields: "+default_sales_channel"
2111
- });
2112
- const {
2113
- sales_channel,
2114
- isPending: isSalesChannelPending,
2115
- isError: isSalesChannelError,
2116
- error: salesChannelError
2117
- } = useSalesChannel(store?.default_sales_channel_id, {
2118
- enabled: !!store?.default_sales_channel_id
2119
- });
2120
- const ready = !!store && !isStorePending && !!sales_channel && !isSalesChannelPending;
2121
- if (isStoreError) {
2122
- throw storeError;
2123
- }
2124
- if (isSalesChannelError) {
2125
- throw salesChannelError;
2126
- }
2127
- return /* @__PURE__ */ jsxs11(RouteFocusModal, { children: [
2128
- /* @__PURE__ */ jsx13(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: t("products.create.title") }) }),
2129
- /* @__PURE__ */ jsx13(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: t("products.create.description") }) }),
2130
- ready && (Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx13(ProductCreateForm, { defaultChannel: sales_channel }))
2131
- ] });
2132
- };
2133
- var ProductCreate = Root5;
2134
- var ProductCreatePage = Object.assign(Root5, {
2135
- Form: ProductCreateForm,
2136
- DetailsTab: ProductCreateDetailsForm,
2137
- OrganizeTab: ProductCreateOrganizeForm,
2138
- VariantsTab: ProductCreateVariantsForm,
2139
- InventoryTab: ProductCreateInventoryKitForm,
2140
- Tab: TabbedForm.Tab
2141
- });
2142
-
2143
- export {
2144
- ProductCreate,
2145
- ProductCreatePage
2146
- };