@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
@@ -0,0 +1,1671 @@
1
+ import {
2
+ SectionRow
3
+ } from "./chunk-3XPXUIK3.js";
4
+ import {
5
+ useDataTableDateColumns,
6
+ useDataTableDateFilters
7
+ } from "./chunk-54RTJBYO.js";
8
+ import {
9
+ PRODUCT_DETAIL_QUERY
10
+ } from "./chunk-RQ4NMLSS.js";
11
+ import {
12
+ TwoColumnPage
13
+ } from "./chunk-E74OUNA3.js";
14
+ import {
15
+ Thumbnail
16
+ } from "./chunk-WIYFXWRI.js";
17
+ import {
18
+ DataTable
19
+ } from "./chunk-LYZT5REU.js";
20
+ import {
21
+ require_dist
22
+ } from "./chunk-2MDGYHWN.js";
23
+ import {
24
+ useQueryParams
25
+ } from "./chunk-THHRRYRS.js";
26
+ import {
27
+ useProductTag
28
+ } from "./chunk-AXTQMIIK.js";
29
+ import {
30
+ useProductType
31
+ } from "./chunk-46M463BR.js";
32
+ import {
33
+ useCollection
34
+ } from "./chunk-XZZTC7E5.js";
35
+ import {
36
+ useSeller
37
+ } from "./chunk-LEG67A2R.js";
38
+ import {
39
+ ActionMenu
40
+ } from "./chunk-BDGZ4EQO.js";
41
+ import {
42
+ useProductCategory
43
+ } from "./chunk-H5PYBIOZ.js";
44
+ import {
45
+ PRODUCT_VARIANT_IDS_KEY
46
+ } from "./chunk-YGAX72XV.js";
47
+ import {
48
+ TwoColumnPageSkeleton
49
+ } from "./chunk-INNFZYX2.js";
50
+ import {
51
+ useCancelProductChange,
52
+ useConfirmProduct,
53
+ useConfirmProductChange,
54
+ useDeleteProduct,
55
+ useDeleteVariantLazy,
56
+ useProduct,
57
+ useProductChange,
58
+ useProductVariants,
59
+ useRejectProduct,
60
+ useRemoveAttributeFromProduct,
61
+ useRequestProductChanges,
62
+ useUpdateProduct
63
+ } from "./chunk-2YYXP6XI.js";
64
+ import {
65
+ sdk
66
+ } from "./chunk-ZBWL72TB.js";
67
+ import {
68
+ __toESM
69
+ } from "./chunk-NBMM2TZK.js";
70
+
71
+ // src/pages/products/product-detail/product-detail.tsx
72
+ import { Children } from "react";
73
+ import { useLoaderData, useParams } from "react-router-dom";
74
+
75
+ // src/pages/products/product-detail/components/product-active-edit-section/product-active-edit-section.tsx
76
+ var import_types = __toESM(require_dist(), 1);
77
+ import { Fragment, useMemo, useState as useState2 } from "react";
78
+ import { ExclamationCircleSolid } from "@medusajs/icons";
79
+ import { Button, Container, Heading, Text, toast } from "@medusajs/ui";
80
+ import {
81
+ describeProductChangeAction,
82
+ extractReferenceIds,
83
+ formatFieldValue,
84
+ humanizeFieldName,
85
+ isImageList,
86
+ isReferenceField,
87
+ partitionProductChangeActions
88
+ } from "@mercurjs/dashboard-shared";
89
+ import { useQuery } from "@tanstack/react-query";
90
+ import { useTranslation as useTranslation2 } from "react-i18next";
91
+
92
+ // src/components/common/confirm-prompt/confirm-prompt.tsx
93
+ import { Label, Prompt, Textarea } from "@medusajs/ui";
94
+ import { useEffect, useState } from "react";
95
+ import { useTranslation } from "react-i18next";
96
+ import { jsx, jsxs } from "react/jsx-runtime";
97
+ var ConfirmPrompt = ({
98
+ open,
99
+ onOpenChange,
100
+ variant = "confirmation",
101
+ title,
102
+ description,
103
+ noteLabel,
104
+ noteOptional = false,
105
+ notePlaceholder,
106
+ defaultNote = "",
107
+ cancelLabel,
108
+ confirmLabel,
109
+ isLoading = false,
110
+ onConfirm
111
+ }) => {
112
+ const { t } = useTranslation();
113
+ const [note, setNote] = useState(defaultNote);
114
+ useEffect(() => {
115
+ if (open) {
116
+ setNote(defaultNote);
117
+ }
118
+ }, [open, defaultNote]);
119
+ const showNoteField = typeof noteLabel === "string";
120
+ const handleOpenChange = (next) => {
121
+ if (isLoading) {
122
+ return;
123
+ }
124
+ onOpenChange(next);
125
+ };
126
+ const handleConfirm = async () => {
127
+ const trimmed = note.trim();
128
+ await onConfirm(showNoteField && trimmed ? trimmed : void 0);
129
+ };
130
+ return /* @__PURE__ */ jsx(Prompt, { open, onOpenChange: handleOpenChange, variant, children: /* @__PURE__ */ jsxs(Prompt.Content, { children: [
131
+ /* @__PURE__ */ jsxs(Prompt.Header, { children: [
132
+ /* @__PURE__ */ jsx(Prompt.Title, { children: title }),
133
+ description ? /* @__PURE__ */ jsx(Prompt.Description, { children: description }) : null
134
+ ] }),
135
+ showNoteField ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2 px-6 py-4", children: [
136
+ /* @__PURE__ */ jsxs(Label, { size: "small", weight: "plus", children: [
137
+ noteLabel,
138
+ noteOptional ? /* @__PURE__ */ jsxs("span", { className: "text-ui-fg-muted ml-1 font-normal", children: [
139
+ "(",
140
+ t("fields.optional"),
141
+ ")"
142
+ ] }) : null
143
+ ] }),
144
+ /* @__PURE__ */ jsx(
145
+ Textarea,
146
+ {
147
+ placeholder: notePlaceholder,
148
+ value: note,
149
+ onChange: (e) => setNote(e.target.value),
150
+ disabled: isLoading
151
+ }
152
+ )
153
+ ] }) : null,
154
+ /* @__PURE__ */ jsxs(Prompt.Footer, { children: [
155
+ /* @__PURE__ */ jsx(Prompt.Cancel, { disabled: isLoading, children: cancelLabel ?? t("actions.cancel") }),
156
+ /* @__PURE__ */ jsx(
157
+ Prompt.Action,
158
+ {
159
+ onClick: (e) => {
160
+ e.preventDefault();
161
+ void handleConfirm();
162
+ },
163
+ disabled: isLoading,
164
+ children: confirmLabel ?? t("actions.confirm")
165
+ }
166
+ )
167
+ ] })
168
+ ] }) });
169
+ };
170
+
171
+ // src/pages/products/product-detail/components/product-active-edit-section/product-active-edit-section.tsx
172
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
173
+ var ImageStrip = ({
174
+ images,
175
+ faded
176
+ }) => /* @__PURE__ */ jsx2(
177
+ "div",
178
+ {
179
+ className: faded ? "flex items-center gap-1.5 opacity-50" : "flex items-center gap-1.5",
180
+ children: images.map((image, idx) => /* @__PURE__ */ jsx2(Thumbnail, { src: image.url, size: "base" }, `${image.url}-${idx}`))
181
+ }
182
+ );
183
+ var BrandName = ({ id }) => {
184
+ const { data } = useQuery({
185
+ queryKey: ["product_brand", id],
186
+ queryFn: () => sdk.admin.productBrands.$id.query({ $id: id }),
187
+ enabled: !!id
188
+ });
189
+ return /* @__PURE__ */ jsx2(Fragment2, { children: data?.product_brand?.name ?? id });
190
+ };
191
+ var TypeName = ({ id }) => {
192
+ const { product_type } = useProductType(id);
193
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_type?.value ?? id });
194
+ };
195
+ var CollectionName = ({ id }) => {
196
+ const { collection } = useCollection(id);
197
+ return /* @__PURE__ */ jsx2(Fragment2, { children: collection?.title ?? id });
198
+ };
199
+ var CategoryName = ({ id }) => {
200
+ const { product_category } = useProductCategory(id);
201
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_category?.name ?? id });
202
+ };
203
+ var TagName = ({ id }) => {
204
+ const { product_tag } = useProductTag(id);
205
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_tag?.value ?? id });
206
+ };
207
+ var ReferenceName = ({
208
+ field,
209
+ id
210
+ }) => {
211
+ switch (field) {
212
+ case "brand_id":
213
+ return /* @__PURE__ */ jsx2(BrandName, { id });
214
+ case "type_id":
215
+ return /* @__PURE__ */ jsx2(TypeName, { id });
216
+ case "collection_id":
217
+ return /* @__PURE__ */ jsx2(CollectionName, { id });
218
+ case "categories":
219
+ return /* @__PURE__ */ jsx2(CategoryName, { id });
220
+ case "tags":
221
+ return /* @__PURE__ */ jsx2(TagName, { id });
222
+ }
223
+ };
224
+ var ReferenceList = ({
225
+ field,
226
+ ids
227
+ }) => {
228
+ if (!ids.length) return /* @__PURE__ */ jsx2(Fragment2, { children: "-" });
229
+ return /* @__PURE__ */ jsx2(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs2(Fragment, { children: [
230
+ idx > 0 && ", ",
231
+ /* @__PURE__ */ jsx2(ReferenceName, { field, id })
232
+ ] }, `${field}-${id}`)) });
233
+ };
234
+ var FieldRow = ({ diff }) => {
235
+ const { t } = useTranslation2();
236
+ const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
237
+ const nextIsImages = isImageList(diff.next);
238
+ const previousIsImages = isImageList(diff.previous);
239
+ const renderAsImages = nextIsImages || previousIsImages;
240
+ const renderAsReference = isReferenceField(diff.field);
241
+ return /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4", children: [
242
+ /* @__PURE__ */ jsx2(
243
+ Text,
244
+ {
245
+ size: "small",
246
+ weight: "plus",
247
+ leading: "compact",
248
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
249
+ children: t(`fields.${diff.field}`, {
250
+ defaultValue: humanizeFieldName(diff.field)
251
+ })
252
+ }
253
+ ),
254
+ renderAsImages ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
255
+ hasPrevious && previousIsImages && /* @__PURE__ */ jsx2(ImageStrip, { images: diff.previous, faded: true }),
256
+ hasPrevious && /* @__PURE__ */ jsx2(
257
+ Text,
258
+ {
259
+ size: "small",
260
+ leading: "compact",
261
+ className: "text-ui-fg-subtle",
262
+ children: "\u2192"
263
+ }
264
+ ),
265
+ nextIsImages ? /* @__PURE__ */ jsx2(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx2(
266
+ Text,
267
+ {
268
+ size: "small",
269
+ leading: "compact",
270
+ className: "text-ui-fg-subtle",
271
+ children: formatFieldValue(diff.next, diff.field)
272
+ }
273
+ )
274
+ ] }) : renderAsReference ? /* @__PURE__ */ jsxs2(
275
+ Text,
276
+ {
277
+ size: "small",
278
+ leading: "compact",
279
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
280
+ children: [
281
+ hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: /* @__PURE__ */ jsx2(
282
+ ReferenceList,
283
+ {
284
+ field: diff.field,
285
+ ids: extractReferenceIds(
286
+ diff.field,
287
+ diff.previous
288
+ )
289
+ }
290
+ ) }),
291
+ hasPrevious && " \u2192 ",
292
+ /* @__PURE__ */ jsx2(
293
+ ReferenceList,
294
+ {
295
+ field: diff.field,
296
+ ids: extractReferenceIds(diff.field, diff.next)
297
+ }
298
+ )
299
+ ]
300
+ }
301
+ ) : /* @__PURE__ */ jsxs2(
302
+ Text,
303
+ {
304
+ size: "small",
305
+ leading: "compact",
306
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
307
+ children: [
308
+ hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
309
+ hasPrevious && " \u2192 ",
310
+ formatFieldValue(diff.next, diff.field)
311
+ ]
312
+ }
313
+ )
314
+ ] });
315
+ };
316
+ var ActionLine = ({ action }) => {
317
+ const { t } = useTranslation2();
318
+ const label = describeProductChangeAction(action, {
319
+ variant: t("fields.variant", { defaultValue: "Variant" })
320
+ });
321
+ return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
322
+ };
323
+ var ProductActiveEditSection = ({
324
+ product
325
+ }) => {
326
+ const { t } = useTranslation2();
327
+ const [confirmOpen, setConfirmOpen] = useState2(false);
328
+ const [rejectOpen, setRejectOpen] = useState2(false);
329
+ const { product_change, isError } = useProductChange(product.id, {
330
+ retry: false
331
+ });
332
+ const requesterId = product_change?.created_by ?? "";
333
+ const { seller: requesterSeller } = useSeller(requesterId, void 0, {
334
+ enabled: !!requesterId
335
+ });
336
+ const { mutateAsync: confirmChange, isPending: isConfirming } = useConfirmProductChange(product_change?.id ?? "", product.id);
337
+ const { mutateAsync: cancelChange, isPending: isRejecting } = useCancelProductChange(product_change?.id ?? "", product.id);
338
+ const { updated, added, removed, deleteRequested } = useMemo(
339
+ () => partitionProductChangeActions(product_change?.actions ?? []),
340
+ [product_change]
341
+ );
342
+ if (isError || !product_change) {
343
+ return null;
344
+ }
345
+ if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
346
+ return null;
347
+ }
348
+ const hasContent = updated.length > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
349
+ const handleConfirm = async (note) => {
350
+ try {
351
+ await confirmChange({ internal_note: note });
352
+ toast.success(t("products.edits.toast.confirmedSuccessfully"));
353
+ setConfirmOpen(false);
354
+ } catch (e) {
355
+ toast.error(e.message);
356
+ }
357
+ };
358
+ const handleReject = async (note) => {
359
+ try {
360
+ await cancelChange({ internal_note: note });
361
+ toast.success(t("products.edits.toast.rejectedSuccessfully"));
362
+ setRejectOpen(false);
363
+ } catch (e) {
364
+ toast.error(e.message);
365
+ }
366
+ };
367
+ return /* @__PURE__ */ jsxs2(
368
+ Container,
369
+ {
370
+ className: "divide-y p-0",
371
+ "data-testid": "product-active-edit-section",
372
+ children: [
373
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 px-6 py-4", children: [
374
+ /* @__PURE__ */ jsx2(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
375
+ /* @__PURE__ */ jsx2(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
376
+ ] }),
377
+ /* @__PURE__ */ jsx2("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.edits.panel.description", {
378
+ store: requesterSeller?.name ?? t("products.request.fallbackStore")
379
+ }) }) }),
380
+ hasContent && /* @__PURE__ */ jsxs2(Fragment2, { children: [
381
+ updated.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
382
+ /* @__PURE__ */ jsx2(
383
+ Text,
384
+ {
385
+ size: "small",
386
+ weight: "plus",
387
+ leading: "compact",
388
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
389
+ children: t("labels.updated")
390
+ }
391
+ ),
392
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-4", children: updated.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${diff.field}-${idx}`)) })
393
+ ] }),
394
+ added.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
395
+ /* @__PURE__ */ jsx2(
396
+ Text,
397
+ {
398
+ size: "small",
399
+ weight: "plus",
400
+ leading: "compact",
401
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
402
+ children: t("labels.added")
403
+ }
404
+ ),
405
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx2(ActionLine, { action }, action.id)) })
406
+ ] }),
407
+ removed.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
408
+ /* @__PURE__ */ jsx2(
409
+ Text,
410
+ {
411
+ size: "small",
412
+ weight: "plus",
413
+ leading: "compact",
414
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
415
+ children: t("labels.removed")
416
+ }
417
+ ),
418
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx2(ActionLine, { action }, action.id)) })
419
+ ] }),
420
+ deleteRequested && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
421
+ /* @__PURE__ */ jsx2(
422
+ Text,
423
+ {
424
+ size: "small",
425
+ weight: "plus",
426
+ leading: "compact",
427
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
428
+ children: t("labels.removed")
429
+ }
430
+ ),
431
+ /* @__PURE__ */ jsx2(
432
+ Text,
433
+ {
434
+ size: "small",
435
+ leading: "compact",
436
+ className: "text-ui-fg-subtle flex-1",
437
+ children: t("products.edits.panel.deleteRequested")
438
+ }
439
+ )
440
+ ] })
441
+ ] }),
442
+ /* @__PURE__ */ jsxs2(
443
+ "div",
444
+ {
445
+ className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
446
+ "data-testid": "product-active-edit-actions",
447
+ children: [
448
+ /* @__PURE__ */ jsx2(
449
+ Button,
450
+ {
451
+ size: "small",
452
+ variant: "secondary",
453
+ onClick: () => setConfirmOpen(true),
454
+ "data-testid": "product-active-edit-confirm-button",
455
+ children: t("actions.confirm")
456
+ }
457
+ ),
458
+ /* @__PURE__ */ jsx2(
459
+ Button,
460
+ {
461
+ size: "small",
462
+ variant: "secondary",
463
+ onClick: () => setRejectOpen(true),
464
+ "data-testid": "product-active-edit-reject-button",
465
+ children: t("products.edits.actions.reject")
466
+ }
467
+ )
468
+ ]
469
+ }
470
+ ),
471
+ /* @__PURE__ */ jsx2(
472
+ ConfirmPrompt,
473
+ {
474
+ open: confirmOpen,
475
+ onOpenChange: setConfirmOpen,
476
+ title: t("products.edits.confirmPrompt.title"),
477
+ description: t("products.edits.confirmPrompt.description"),
478
+ noteLabel: t("products.edits.confirmPrompt.noteLabel"),
479
+ noteOptional: true,
480
+ notePlaceholder: t("products.edits.confirmPrompt.notePlaceholder"),
481
+ isLoading: isConfirming,
482
+ onConfirm: handleConfirm
483
+ }
484
+ ),
485
+ /* @__PURE__ */ jsx2(
486
+ ConfirmPrompt,
487
+ {
488
+ open: rejectOpen,
489
+ onOpenChange: setRejectOpen,
490
+ title: t("products.edits.rejectPrompt.title"),
491
+ description: t("products.edits.rejectPrompt.description"),
492
+ noteLabel: t("products.edits.rejectPrompt.noteLabel"),
493
+ noteOptional: true,
494
+ notePlaceholder: t("products.edits.rejectPrompt.notePlaceholder"),
495
+ confirmLabel: t("products.edits.rejectPrompt.confirm"),
496
+ isLoading: isRejecting,
497
+ onConfirm: handleReject
498
+ }
499
+ )
500
+ ]
501
+ }
502
+ );
503
+ };
504
+
505
+ // src/pages/products/product-detail/components/product-active-request-section/product-active-request-section.tsx
506
+ var import_types2 = __toESM(require_dist(), 1);
507
+ import { useState as useState3 } from "react";
508
+ import { Button as Button2, Container as Container2, Heading as Heading2, Text as Text2, toast as toast2 } from "@medusajs/ui";
509
+ import { ExclamationCircleSolid as ExclamationCircleSolid2 } from "@medusajs/icons";
510
+ import { useTranslation as useTranslation3 } from "react-i18next";
511
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
512
+ var ProductActiveRequestSection = ({
513
+ product
514
+ }) => {
515
+ const { t } = useTranslation3();
516
+ const [confirmOpen, setConfirmOpen] = useState3(false);
517
+ const [requestUpdateOpen, setRequestUpdateOpen] = useState3(false);
518
+ const [rejectOpen, setRejectOpen] = useState3(false);
519
+ const { mutateAsync: confirmProduct, isPending: isConfirming } = useConfirmProduct(product.id);
520
+ const { mutateAsync: requestProductChanges, isPending: isRequestingUpdate } = useRequestProductChanges(product.id);
521
+ const { mutateAsync: rejectProduct, isPending: isRejecting } = useRejectProduct(product.id);
522
+ if (product.status !== import_types2.ProductStatus.PROPOSED) {
523
+ return null;
524
+ }
525
+ const handleConfirm = async (note) => {
526
+ try {
527
+ await confirmProduct({ internal_note: note });
528
+ toast2.success(t("products.request.toast.publishedSuccessfully"));
529
+ setConfirmOpen(false);
530
+ } catch (e) {
531
+ toast2.error(e.message);
532
+ }
533
+ };
534
+ const handleRequestUpdate = async (note) => {
535
+ try {
536
+ await requestProductChanges({ message: note });
537
+ toast2.success(t("products.request.toast.updateRequestedSuccessfully"));
538
+ setRequestUpdateOpen(false);
539
+ } catch (e) {
540
+ toast2.error(e.message);
541
+ }
542
+ };
543
+ const handleReject = async (note) => {
544
+ try {
545
+ await rejectProduct({ message: note });
546
+ toast2.success(t("products.request.toast.rejectedSuccessfully"));
547
+ setRejectOpen(false);
548
+ } catch (e) {
549
+ toast2.error(e.message);
550
+ }
551
+ };
552
+ return /* @__PURE__ */ jsxs3(
553
+ Container2,
554
+ {
555
+ className: "divide-y p-0",
556
+ "data-testid": "product-active-request-section",
557
+ children: [
558
+ /* @__PURE__ */ jsxs3(
559
+ "div",
560
+ {
561
+ className: "flex items-center gap-2 px-6 py-4",
562
+ "data-testid": "product-active-request-header",
563
+ children: [
564
+ /* @__PURE__ */ jsx3(ExclamationCircleSolid2, { className: "text-ui-fg-interactive" }),
565
+ /* @__PURE__ */ jsx3(Heading2, { level: "h2", "data-testid": "product-active-request-heading", children: t("products.request.panel.title") })
566
+ ]
567
+ }
568
+ ),
569
+ /* @__PURE__ */ jsx3("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.request.panel.description", {
570
+ store: product.sellers?.[0]?.name ?? t("products.request.fallbackStore")
571
+ }) }) }),
572
+ /* @__PURE__ */ jsxs3(
573
+ "div",
574
+ {
575
+ className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
576
+ "data-testid": "product-active-request-actions",
577
+ children: [
578
+ /* @__PURE__ */ jsx3(
579
+ Button2,
580
+ {
581
+ size: "small",
582
+ variant: "secondary",
583
+ onClick: () => setConfirmOpen(true),
584
+ "data-testid": "product-active-request-confirm-button",
585
+ children: t("actions.confirm")
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsx3(
589
+ Button2,
590
+ {
591
+ size: "small",
592
+ variant: "secondary",
593
+ onClick: () => setRequestUpdateOpen(true),
594
+ "data-testid": "product-active-request-request-update-button",
595
+ children: t("products.request.actions.requestUpdate")
596
+ }
597
+ ),
598
+ /* @__PURE__ */ jsx3(
599
+ Button2,
600
+ {
601
+ size: "small",
602
+ variant: "secondary",
603
+ onClick: () => setRejectOpen(true),
604
+ "data-testid": "product-active-request-reject-button",
605
+ children: t("products.request.actions.reject")
606
+ }
607
+ )
608
+ ]
609
+ }
610
+ ),
611
+ /* @__PURE__ */ jsx3(
612
+ ConfirmPrompt,
613
+ {
614
+ open: confirmOpen,
615
+ onOpenChange: setConfirmOpen,
616
+ title: t("products.request.confirmPrompt.title"),
617
+ description: t("products.request.confirmPrompt.description"),
618
+ noteLabel: t("products.request.confirmPrompt.noteLabel"),
619
+ noteOptional: true,
620
+ notePlaceholder: t("products.request.confirmPrompt.notePlaceholder"),
621
+ isLoading: isConfirming,
622
+ onConfirm: handleConfirm
623
+ }
624
+ ),
625
+ /* @__PURE__ */ jsx3(
626
+ ConfirmPrompt,
627
+ {
628
+ open: requestUpdateOpen,
629
+ onOpenChange: setRequestUpdateOpen,
630
+ title: t("products.request.requestUpdatePrompt.title"),
631
+ description: t("products.request.requestUpdatePrompt.description"),
632
+ noteLabel: t("products.request.requestUpdatePrompt.noteLabel"),
633
+ noteOptional: true,
634
+ notePlaceholder: t(
635
+ "products.request.requestUpdatePrompt.notePlaceholder"
636
+ ),
637
+ confirmLabel: t("products.request.requestUpdatePrompt.send"),
638
+ isLoading: isRequestingUpdate,
639
+ onConfirm: handleRequestUpdate
640
+ }
641
+ ),
642
+ /* @__PURE__ */ jsx3(
643
+ ConfirmPrompt,
644
+ {
645
+ open: rejectOpen,
646
+ onOpenChange: setRejectOpen,
647
+ title: t("products.request.rejectPrompt.title"),
648
+ description: t("products.request.rejectPrompt.description"),
649
+ noteLabel: t("products.request.rejectPrompt.noteLabel"),
650
+ noteOptional: true,
651
+ notePlaceholder: t("products.request.rejectPrompt.notePlaceholder"),
652
+ confirmLabel: t("products.request.rejectPrompt.confirm"),
653
+ isLoading: isRejecting,
654
+ onConfirm: handleReject
655
+ }
656
+ )
657
+ ]
658
+ }
659
+ );
660
+ };
661
+
662
+ // src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
663
+ import {
664
+ ListBullet,
665
+ Plus,
666
+ Trash,
667
+ Swatch,
668
+ DropCap,
669
+ InformationCircleSolid
670
+ } from "@medusajs/icons";
671
+ import {
672
+ Badge,
673
+ Container as Container3,
674
+ Heading as Heading3,
675
+ Text as Text3,
676
+ toast as toast3,
677
+ Tooltip,
678
+ usePrompt
679
+ } from "@medusajs/ui";
680
+ import { useTranslation as useTranslation4 } from "react-i18next";
681
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
682
+ var AttributeActions = ({
683
+ productId,
684
+ attribute
685
+ }) => {
686
+ const { t } = useTranslation4();
687
+ const prompt = usePrompt();
688
+ const { mutateAsync } = useRemoveAttributeFromProduct(productId, attribute.id);
689
+ const handleDelete = async () => {
690
+ const res = await prompt({
691
+ title: t("general.areYouSure"),
692
+ description: t("products.deleteAttributeWarning", {
693
+ title: attribute.name
694
+ }),
695
+ confirmText: t("actions.delete"),
696
+ cancelText: t("actions.cancel")
697
+ });
698
+ if (!res) {
699
+ return;
700
+ }
701
+ await mutateAsync(void 0, {
702
+ onError: (error) => {
703
+ toast3.error(error.message);
704
+ }
705
+ });
706
+ };
707
+ return /* @__PURE__ */ jsx4(
708
+ ActionMenu,
709
+ {
710
+ groups: [
711
+ {
712
+ actions: [
713
+ {
714
+ label: t("actions.delete"),
715
+ onClick: handleDelete,
716
+ icon: /* @__PURE__ */ jsx4(Trash, {})
717
+ }
718
+ ]
719
+ }
720
+ ]
721
+ }
722
+ );
723
+ };
724
+ var AttributeGroup = ({
725
+ icon,
726
+ title,
727
+ description,
728
+ attributes,
729
+ productId
730
+ }) => {
731
+ const { t } = useTranslation4();
732
+ if (!attributes.length) {
733
+ return null;
734
+ }
735
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
736
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-3 px-3", children: [
737
+ /* @__PURE__ */ jsx4("div", { className: "text-ui-fg-muted flex h-8 w-8 items-center justify-center rounded-lg border border-ui-border-base bg-ui-bg-component", children: icon }),
738
+ /* @__PURE__ */ jsxs4("div", { children: [
739
+ /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
740
+ /* @__PURE__ */ jsx4(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
741
+ ] })
742
+ ] }),
743
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-y-0", children: /* @__PURE__ */ jsx4("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: attributes.map((attr, index) => {
744
+ const values = attr.values?.map((v) => v.name) ?? [];
745
+ return /* @__PURE__ */ jsx4(
746
+ "div",
747
+ {
748
+ className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
749
+ children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 px-4 py-3 bg-ui-bg-component", children: [
750
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
751
+ /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
752
+ attr.description && /* @__PURE__ */ jsx4(Tooltip, { content: attr.description, children: /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx4(InformationCircleSolid, {}) }) }),
753
+ attr.is_required && /* @__PURE__ */ jsx4(Tooltip, { content: t("products.attributeRequiredByMarketplace"), children: /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx4(InformationCircleSolid, {}) }) })
754
+ ] }),
755
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx4(
756
+ Badge,
757
+ {
758
+ size: "2xsmall",
759
+ className: "flex min-w-[20px] items-center justify-center",
760
+ children: val
761
+ },
762
+ val
763
+ )) : /* @__PURE__ */ jsx4(
764
+ Text3,
765
+ {
766
+ size: "small",
767
+ leading: "compact",
768
+ className: "text-ui-fg-subtle",
769
+ children: values.join(", ") || "-"
770
+ }
771
+ ) }),
772
+ /* @__PURE__ */ jsx4(AttributeActions, { productId, attribute: attr })
773
+ ] })
774
+ },
775
+ attr.id
776
+ );
777
+ }) }) })
778
+ ] });
779
+ };
780
+ var ProductAttributeSection = ({
781
+ product
782
+ }) => {
783
+ const { t } = useTranslation4();
784
+ const allAttributes = product.attributes ?? [];
785
+ const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
786
+ const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
787
+ const isEmpty = !variantAttributes.length && !infoAttributes.length;
788
+ return /* @__PURE__ */ jsxs4(Container3, { className: "p-0", children: [
789
+ /* @__PURE__ */ jsxs4(
790
+ "div",
791
+ {
792
+ className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
793
+ children: [
794
+ /* @__PURE__ */ jsx4(Heading3, { level: "h2", children: t("products.attributes") }),
795
+ /* @__PURE__ */ jsx4(
796
+ ActionMenu,
797
+ {
798
+ groups: [
799
+ {
800
+ actions: [
801
+ {
802
+ label: t("products.create.attributes.addExisting"),
803
+ to: "attributes/add",
804
+ icon: /* @__PURE__ */ jsx4(ListBullet, {})
805
+ },
806
+ {
807
+ label: t("products.create.attributes.createNew"),
808
+ to: "attributes/create",
809
+ icon: /* @__PURE__ */ jsx4(Plus, {})
810
+ }
811
+ ]
812
+ }
813
+ ]
814
+ }
815
+ )
816
+ ]
817
+ }
818
+ ),
819
+ variantAttributes.length > 0 && /* @__PURE__ */ jsx4(
820
+ AttributeGroup,
821
+ {
822
+ icon: /* @__PURE__ */ jsx4(Swatch, {}),
823
+ title: t("products.create.tabs.variants"),
824
+ description: t("products.attributeVariantsDescription"),
825
+ attributes: variantAttributes,
826
+ productId: product.id
827
+ }
828
+ ),
829
+ variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx4("div", { className: "border-t border-dashed border-ui-border-base" }),
830
+ infoAttributes.length > 0 && /* @__PURE__ */ jsx4(
831
+ AttributeGroup,
832
+ {
833
+ icon: /* @__PURE__ */ jsx4(DropCap, {}),
834
+ title: t("products.attributeProductInformation"),
835
+ description: t("products.attributeProductInformationDescription"),
836
+ attributes: infoAttributes,
837
+ productId: product.id
838
+ }
839
+ )
840
+ ] });
841
+ };
842
+
843
+ // src/pages/products/product-detail/components/product-general-section/product-general-section.tsx
844
+ import { PencilSquare, Trash as Trash2 } from "@medusajs/icons";
845
+ import { Container as Container4, Heading as Heading4, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
846
+ import { useTranslation as useTranslation5 } from "react-i18next";
847
+ import { useNavigate } from "react-router-dom";
848
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
849
+ var productStatusColor = (status) => {
850
+ switch (status) {
851
+ case "draft":
852
+ return "grey";
853
+ case "proposed":
854
+ return "orange";
855
+ case "published":
856
+ return "green";
857
+ case "requires_action":
858
+ return "blue";
859
+ case "rejected":
860
+ return "red";
861
+ default:
862
+ return "grey";
863
+ }
864
+ };
865
+ var ProductGeneralSection = ({
866
+ product
867
+ }) => {
868
+ const { t } = useTranslation5();
869
+ const prompt = usePrompt2();
870
+ const navigate = useNavigate();
871
+ const { mutateAsync } = useDeleteProduct(product.id);
872
+ const handleDelete = async () => {
873
+ const res = await prompt({
874
+ title: t("general.areYouSure"),
875
+ description: t("products.deleteWarning", {
876
+ title: product.title
877
+ }),
878
+ confirmText: t("actions.delete"),
879
+ cancelText: t("actions.cancel")
880
+ });
881
+ if (!res) {
882
+ return;
883
+ }
884
+ await mutateAsync(void 0, {
885
+ onSuccess: () => {
886
+ navigate("..");
887
+ }
888
+ });
889
+ };
890
+ return /* @__PURE__ */ jsxs5(Container4, { className: "divide-y p-0", "data-testid": "product-general-section", children: [
891
+ /* @__PURE__ */ jsxs5(
892
+ "div",
893
+ {
894
+ className: "flex items-center justify-between px-6 py-4",
895
+ "data-testid": "product-general-header",
896
+ children: [
897
+ /* @__PURE__ */ jsx5(Heading4, { "data-testid": "product-general-title", children: product.title }),
898
+ /* @__PURE__ */ jsxs5(
899
+ "div",
900
+ {
901
+ className: "flex items-center gap-x-4",
902
+ "data-testid": "product-general-actions",
903
+ children: [
904
+ /* @__PURE__ */ jsx5(
905
+ StatusBadge,
906
+ {
907
+ color: productStatusColor(product.status),
908
+ "data-testid": "product-status-badge",
909
+ children: t(`products.productStatus.${product.status}`)
910
+ }
911
+ ),
912
+ /* @__PURE__ */ jsx5(
913
+ ActionMenu,
914
+ {
915
+ groups: [
916
+ {
917
+ actions: [
918
+ {
919
+ label: t("actions.edit"),
920
+ to: "edit",
921
+ icon: /* @__PURE__ */ jsx5(PencilSquare, {})
922
+ }
923
+ ]
924
+ },
925
+ {
926
+ actions: [
927
+ {
928
+ label: t("actions.delete"),
929
+ onClick: handleDelete,
930
+ icon: /* @__PURE__ */ jsx5(Trash2, {})
931
+ }
932
+ ]
933
+ }
934
+ ],
935
+ "data-testid": "product-general-action-menu"
936
+ }
937
+ )
938
+ ]
939
+ }
940
+ )
941
+ ]
942
+ }
943
+ ),
944
+ /* @__PURE__ */ jsx5(
945
+ SectionRow,
946
+ {
947
+ title: t("fields.description"),
948
+ value: product.description,
949
+ "data-testid": "product-description-row"
950
+ }
951
+ ),
952
+ /* @__PURE__ */ jsx5(
953
+ SectionRow,
954
+ {
955
+ title: t("fields.subtitle"),
956
+ value: product.subtitle,
957
+ "data-testid": "product-subtitle-row"
958
+ }
959
+ ),
960
+ /* @__PURE__ */ jsx5(
961
+ SectionRow,
962
+ {
963
+ title: t("fields.handle"),
964
+ value: `/${product.handle}`,
965
+ "data-testid": "product-handle-row"
966
+ }
967
+ ),
968
+ /* @__PURE__ */ jsx5(
969
+ SectionRow,
970
+ {
971
+ title: t("fields.discountable"),
972
+ value: product.discountable ? t("fields.true") : t("fields.false"),
973
+ "data-testid": "product-discountable-row"
974
+ }
975
+ )
976
+ ] });
977
+ };
978
+
979
+ // src/pages/products/product-detail/components/product-media-section/product-media-section.tsx
980
+ import { PencilSquare as PencilSquare2, ThumbnailBadge } from "@medusajs/icons";
981
+ import {
982
+ Button as Button3,
983
+ Checkbox,
984
+ CommandBar,
985
+ Container as Container5,
986
+ Heading as Heading5,
987
+ Text as Text4,
988
+ Tooltip as Tooltip2,
989
+ clx,
990
+ usePrompt as usePrompt3
991
+ } from "@medusajs/ui";
992
+ import { useState as useState4 } from "react";
993
+ import { useTranslation as useTranslation6 } from "react-i18next";
994
+ import { Link } from "react-router-dom";
995
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
996
+ var ProductMediaSection = ({
997
+ product
998
+ }) => {
999
+ const { t } = useTranslation6();
1000
+ const prompt = usePrompt3();
1001
+ const [selection, setSelection] = useState4({});
1002
+ const media = getMedia(product);
1003
+ const handleCheckedChange = (id) => {
1004
+ setSelection((prev) => {
1005
+ if (prev[id]) {
1006
+ const { [id]: _, ...rest } = prev;
1007
+ return rest;
1008
+ } else {
1009
+ return { ...prev, [id]: true };
1010
+ }
1011
+ });
1012
+ };
1013
+ const { mutateAsync } = useUpdateProduct(product.id);
1014
+ const handleDelete = async () => {
1015
+ const ids = Object.keys(selection);
1016
+ const includingThumbnail = ids.some(
1017
+ (id) => media.find((m) => m.id === id)?.isThumbnail
1018
+ );
1019
+ const res = await prompt({
1020
+ title: t("general.areYouSure"),
1021
+ description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
1022
+ count: ids.length
1023
+ }) : t("products.media.deleteWarning", {
1024
+ count: ids.length
1025
+ }),
1026
+ confirmText: t("actions.delete"),
1027
+ cancelText: t("actions.cancel")
1028
+ });
1029
+ if (!res) {
1030
+ return;
1031
+ }
1032
+ const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
1033
+ await mutateAsync(
1034
+ {
1035
+ images: mediaToKeep,
1036
+ thumbnail: includingThumbnail ? "" : void 0
1037
+ },
1038
+ {
1039
+ onSuccess: () => {
1040
+ setSelection({});
1041
+ }
1042
+ }
1043
+ );
1044
+ };
1045
+ return /* @__PURE__ */ jsxs6(Container5, { className: "divide-y p-0", "data-testid": "product-media-section", children: [
1046
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-media-header", children: [
1047
+ /* @__PURE__ */ jsx6(Heading5, { level: "h2", "data-testid": "product-media-title", children: t("products.media.label") }),
1048
+ /* @__PURE__ */ jsx6(
1049
+ ActionMenu,
1050
+ {
1051
+ groups: [
1052
+ {
1053
+ actions: [
1054
+ {
1055
+ label: t("actions.edit"),
1056
+ to: "media?view=edit",
1057
+ icon: /* @__PURE__ */ jsx6(PencilSquare2, {})
1058
+ }
1059
+ ]
1060
+ }
1061
+ ],
1062
+ "data-testid": "product-media-action-menu"
1063
+ }
1064
+ )
1065
+ ] }),
1066
+ media.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4 px-6 py-4", "data-testid": "product-media-grid", children: media.map((i, index) => {
1067
+ const isSelected = selection[i.id];
1068
+ return /* @__PURE__ */ jsxs6(
1069
+ "div",
1070
+ {
1071
+ className: "shadow-elevation-card-rest hover:shadow-elevation-card-hover transition-fg group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px]",
1072
+ "data-testid": `product-media-item-${i.id}`,
1073
+ children: [
1074
+ /* @__PURE__ */ jsx6(
1075
+ "div",
1076
+ {
1077
+ className: clx(
1078
+ "transition-fg invisible absolute right-2 top-2 opacity-0 group-hover:visible group-hover:opacity-100",
1079
+ {
1080
+ "visible opacity-100": isSelected
1081
+ }
1082
+ ),
1083
+ "data-testid": `product-media-checkbox-container-${i.id}`,
1084
+ children: /* @__PURE__ */ jsx6(
1085
+ Checkbox,
1086
+ {
1087
+ checked: selection[i.id] || false,
1088
+ onCheckedChange: () => handleCheckedChange(i.id),
1089
+ "data-testid": `product-media-checkbox-${i.id}`
1090
+ }
1091
+ )
1092
+ }
1093
+ ),
1094
+ i.isThumbnail && /* @__PURE__ */ jsx6("div", { className: "absolute left-2 top-2", "data-testid": `product-media-thumbnail-badge-${i.id}`, children: /* @__PURE__ */ jsx6(Tooltip2, { content: t("fields.thumbnail"), children: /* @__PURE__ */ jsx6(ThumbnailBadge, {}) }) }),
1095
+ /* @__PURE__ */ jsx6(Link, { to: `media`, state: { curr: index }, "data-testid": `product-media-link-${i.id}`, children: /* @__PURE__ */ jsx6(
1096
+ "img",
1097
+ {
1098
+ src: i.url,
1099
+ alt: product.title,
1100
+ className: "size-full object-cover",
1101
+ "data-testid": `product-media-image-${i.id}`
1102
+ }
1103
+ ) })
1104
+ ]
1105
+ },
1106
+ i.id
1107
+ );
1108
+ }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", "data-testid": "product-media-empty-state", children: [
1109
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center", children: [
1110
+ /* @__PURE__ */ jsx6(
1111
+ Text4,
1112
+ {
1113
+ size: "small",
1114
+ leading: "compact",
1115
+ weight: "plus",
1116
+ className: "text-ui-fg-subtle",
1117
+ "data-testid": "product-media-empty-state-header",
1118
+ children: t("products.media.emptyState.header")
1119
+ }
1120
+ ),
1121
+ /* @__PURE__ */ jsx6(Text4, { size: "small", className: "text-ui-fg-muted", "data-testid": "product-media-empty-state-description", children: t("products.media.emptyState.description") })
1122
+ ] }),
1123
+ /* @__PURE__ */ jsx6(Button3, { size: "small", variant: "secondary", asChild: true, "data-testid": "product-media-empty-state-button", children: /* @__PURE__ */ jsx6(Link, { to: "media?view=edit", "data-testid": "product-media-empty-state-link", children: t("products.media.emptyState.action") }) })
1124
+ ] }),
1125
+ /* @__PURE__ */ jsx6(CommandBar, { open: !!Object.keys(selection).length, "data-testid": "product-media-command-bar", children: /* @__PURE__ */ jsxs6(CommandBar.Bar, { "data-testid": "product-media-command-bar-bar", children: [
1126
+ /* @__PURE__ */ jsx6(CommandBar.Value, { "data-testid": "product-media-command-bar-value", children: t("general.countSelected", {
1127
+ count: Object.keys(selection).length
1128
+ }) }),
1129
+ /* @__PURE__ */ jsx6(CommandBar.Seperator, { "data-testid": "product-media-command-bar-separator" }),
1130
+ /* @__PURE__ */ jsx6(
1131
+ CommandBar.Command,
1132
+ {
1133
+ action: handleDelete,
1134
+ label: t("actions.delete"),
1135
+ shortcut: "d",
1136
+ "data-testid": "product-media-command-bar-delete"
1137
+ }
1138
+ )
1139
+ ] }) })
1140
+ ] });
1141
+ };
1142
+ var getMedia = (product) => {
1143
+ const { images = [], thumbnail } = product;
1144
+ const media = images.map((image) => ({
1145
+ id: image.id,
1146
+ url: image.url,
1147
+ isThumbnail: image.url === thumbnail
1148
+ }));
1149
+ if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
1150
+ media.unshift({
1151
+ id: "img_thumbnail",
1152
+ url: thumbnail,
1153
+ isThumbnail: true
1154
+ });
1155
+ }
1156
+ return media;
1157
+ };
1158
+
1159
+ // src/pages/products/product-detail/components/product-organization-section/product-organization-section.tsx
1160
+ import { PencilSquare as PencilSquare3 } from "@medusajs/icons";
1161
+ import { Badge as Badge2, Container as Container6, Heading as Heading6, Tooltip as Tooltip3 } from "@medusajs/ui";
1162
+ import { useTranslation as useTranslation7 } from "react-i18next";
1163
+ import { Link as Link2 } from "react-router-dom";
1164
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1165
+ var ProductOrganizationSection = ({
1166
+ product
1167
+ }) => {
1168
+ const { t } = useTranslation7();
1169
+ return /* @__PURE__ */ jsxs7(
1170
+ Container6,
1171
+ {
1172
+ className: "divide-y p-0",
1173
+ "data-testid": "product-organization-section",
1174
+ children: [
1175
+ /* @__PURE__ */ jsxs7(
1176
+ "div",
1177
+ {
1178
+ className: "flex items-center justify-between px-6 py-4",
1179
+ "data-testid": "product-organization-header",
1180
+ children: [
1181
+ /* @__PURE__ */ jsx7(Heading6, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
1182
+ /* @__PURE__ */ jsx7(
1183
+ ActionMenu,
1184
+ {
1185
+ groups: [
1186
+ {
1187
+ actions: [
1188
+ {
1189
+ label: t("actions.edit"),
1190
+ to: "organization",
1191
+ icon: /* @__PURE__ */ jsx7(PencilSquare3, {})
1192
+ }
1193
+ ]
1194
+ }
1195
+ ],
1196
+ "data-testid": "product-organization-action-menu"
1197
+ }
1198
+ )
1199
+ ]
1200
+ }
1201
+ ),
1202
+ /* @__PURE__ */ jsx7(
1203
+ SectionRow,
1204
+ {
1205
+ title: t("fields.tags"),
1206
+ value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx7(
1207
+ OrganizationTag,
1208
+ {
1209
+ label: tag.value,
1210
+ to: `/settings/product-tags/${tag.id}`
1211
+ },
1212
+ tag.id
1213
+ )) : void 0,
1214
+ "data-testid": "product-tags-row"
1215
+ }
1216
+ ),
1217
+ /* @__PURE__ */ jsx7(
1218
+ SectionRow,
1219
+ {
1220
+ title: t("fields.type"),
1221
+ value: product.type ? /* @__PURE__ */ jsx7(
1222
+ OrganizationTag,
1223
+ {
1224
+ label: product.type.value,
1225
+ to: `/settings/product-types/${product.type_id}`
1226
+ }
1227
+ ) : void 0,
1228
+ "data-testid": "product-type-row"
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ jsx7(
1232
+ SectionRow,
1233
+ {
1234
+ title: t("fields.brand"),
1235
+ value: product.brand ? /* @__PURE__ */ jsx7(
1236
+ OrganizationTag,
1237
+ {
1238
+ label: product.brand.name,
1239
+ to: `/settings/product-brands/${product.brand.id}`
1240
+ }
1241
+ ) : void 0,
1242
+ "data-testid": "product-brand-row"
1243
+ }
1244
+ ),
1245
+ /* @__PURE__ */ jsx7(
1246
+ SectionRow,
1247
+ {
1248
+ title: t("fields.collection"),
1249
+ value: product.collection ? /* @__PURE__ */ jsx7(
1250
+ OrganizationTag,
1251
+ {
1252
+ label: product.collection.title,
1253
+ to: `/collections/${product.collection.id}`
1254
+ }
1255
+ ) : void 0,
1256
+ "data-testid": "product-collection-row"
1257
+ }
1258
+ ),
1259
+ /* @__PURE__ */ jsx7(
1260
+ SectionRow,
1261
+ {
1262
+ title: t("fields.categories"),
1263
+ value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx7(
1264
+ OrganizationTag,
1265
+ {
1266
+ label: pcat.name,
1267
+ to: `/categories/${pcat.id}`
1268
+ },
1269
+ pcat.id
1270
+ )) : void 0,
1271
+ "data-testid": "product-categories-row"
1272
+ }
1273
+ )
1274
+ ]
1275
+ }
1276
+ );
1277
+ };
1278
+ var OrganizationTag = ({ label, to }) => {
1279
+ return /* @__PURE__ */ jsx7(Tooltip3, { content: label, children: /* @__PURE__ */ jsx7(Badge2, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx7(
1280
+ Link2,
1281
+ {
1282
+ to,
1283
+ "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
1284
+ children: label
1285
+ }
1286
+ ) }) });
1287
+ };
1288
+
1289
+ // src/pages/products/product-detail/components/product-variant-section/product-variant-section.tsx
1290
+ import { useCallback, useMemo as useMemo2 } from "react";
1291
+ import { Buildings, Component, PencilSquare as PencilSquare4, Trash as Trash3 } from "@medusajs/icons";
1292
+ import {
1293
+ Badge as Badge3,
1294
+ Container as Container7,
1295
+ createDataTableColumnHelper,
1296
+ createDataTableCommandHelper,
1297
+ Tooltip as Tooltip4,
1298
+ usePrompt as usePrompt4
1299
+ } from "@medusajs/ui";
1300
+ import { keepPreviousData } from "@tanstack/react-query";
1301
+ import { useTranslation as useTranslation8 } from "react-i18next";
1302
+ import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1303
+ import { jsx as jsx8 } from "react/jsx-runtime";
1304
+ var PAGE_SIZE = 10;
1305
+ var PREFIX = "pv";
1306
+ var ProductVariantSection = ({
1307
+ product
1308
+ }) => {
1309
+ const { t } = useTranslation8();
1310
+ const { q, order, offset, created_at, updated_at } = useQueryParams(
1311
+ ["q", "order", "offset", "created_at", "updated_at"],
1312
+ PREFIX
1313
+ );
1314
+ const columns = useColumns(product);
1315
+ const filters = useFilters();
1316
+ const commands = useCommands();
1317
+ const { variants, count, isPending, isError, error } = useProductVariants(
1318
+ product.id,
1319
+ {
1320
+ q,
1321
+ order: order ? order : "variant_rank",
1322
+ offset: offset ? parseInt(offset) : void 0,
1323
+ limit: PAGE_SIZE,
1324
+ created_at: created_at ? JSON.parse(created_at) : void 0,
1325
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
1326
+ fields: "title,created_at,updated_at,*attribute_values,*attribute_values.attribute"
1327
+ },
1328
+ {
1329
+ placeholderData: keepPreviousData
1330
+ }
1331
+ );
1332
+ if (isError) {
1333
+ throw error;
1334
+ }
1335
+ return /* @__PURE__ */ jsx8(Container7, { className: "divide-y p-0", "data-testid": "product-variant-section", children: /* @__PURE__ */ jsx8("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx8(
1336
+ DataTable,
1337
+ {
1338
+ data: variants,
1339
+ columns,
1340
+ filters,
1341
+ rowCount: count,
1342
+ getRowId: (row) => row.id,
1343
+ rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
1344
+ pageSize: PAGE_SIZE,
1345
+ isLoading: isPending,
1346
+ heading: t("products.variants.header"),
1347
+ emptyState: {
1348
+ empty: {
1349
+ heading: t("products.variants.empty.heading"),
1350
+ description: t("products.variants.empty.description")
1351
+ },
1352
+ filtered: {
1353
+ heading: t("products.variants.filtered.heading"),
1354
+ description: t("products.variants.filtered.description")
1355
+ }
1356
+ },
1357
+ action: {
1358
+ label: t("actions.create"),
1359
+ to: `variants/create`
1360
+ },
1361
+ actionMenu: {
1362
+ groups: [
1363
+ {
1364
+ actions: [
1365
+ {
1366
+ label: t("products.editPrices"),
1367
+ to: `prices`,
1368
+ icon: /* @__PURE__ */ jsx8(PencilSquare4, {})
1369
+ },
1370
+ {
1371
+ label: t("inventory.stock.action"),
1372
+ to: `stock`,
1373
+ icon: /* @__PURE__ */ jsx8(Buildings, {})
1374
+ }
1375
+ ]
1376
+ }
1377
+ ],
1378
+ "data-testid": "product-variant-section-action-menu"
1379
+ },
1380
+ commands,
1381
+ prefix: PREFIX
1382
+ }
1383
+ ) }) });
1384
+ };
1385
+ var columnHelper = createDataTableColumnHelper();
1386
+ var useColumns = (product) => {
1387
+ const { t } = useTranslation8();
1388
+ const navigate = useNavigate2();
1389
+ const { mutateAsync } = useDeleteVariantLazy(product.id);
1390
+ const prompt = usePrompt4();
1391
+ const [searchParams] = useSearchParams();
1392
+ const tableSearchParams = useMemo2(() => {
1393
+ const filtered = new URLSearchParams();
1394
+ for (const [key, value] of searchParams.entries()) {
1395
+ if (key.startsWith(`${PREFIX}_`)) {
1396
+ filtered.append(key, value);
1397
+ }
1398
+ }
1399
+ return filtered;
1400
+ }, [searchParams]);
1401
+ const dateColumns = useDataTableDateColumns();
1402
+ const handleDelete = useCallback(
1403
+ async (id, title) => {
1404
+ const res = await prompt({
1405
+ title: t("general.areYouSure"),
1406
+ description: t("products.deleteVariantWarning", {
1407
+ title
1408
+ }),
1409
+ confirmText: t("actions.delete"),
1410
+ cancelText: t("actions.cancel")
1411
+ });
1412
+ if (!res) {
1413
+ return;
1414
+ }
1415
+ await mutateAsync({ variantId: id });
1416
+ },
1417
+ [mutateAsync, prompt, t]
1418
+ );
1419
+ const optionColumns = useMemo2(() => {
1420
+ if (!product?.options) {
1421
+ return [];
1422
+ }
1423
+ return product.options.map((option) => {
1424
+ return columnHelper.display({
1425
+ id: option.id,
1426
+ header: option.title,
1427
+ cell: ({ row }) => {
1428
+ const variantOpt = row.original.options?.find(
1429
+ (opt) => opt.option_id === option.id
1430
+ );
1431
+ if (!variantOpt) {
1432
+ return /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1433
+ }
1434
+ return /* @__PURE__ */ jsx8(
1435
+ "div",
1436
+ {
1437
+ className: "flex items-center",
1438
+ "data-testid": `product-variant-option-${option.id}-${row.original.id}`,
1439
+ children: /* @__PURE__ */ jsx8(Tooltip4, { content: variantOpt.value, children: /* @__PURE__ */ jsx8(
1440
+ Badge3,
1441
+ {
1442
+ size: "2xsmall",
1443
+ title: variantOpt.value,
1444
+ className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1445
+ "data-testid": `product-variant-option-badge-${option.id}-${row.original.id}-${variantOpt.value}`,
1446
+ children: variantOpt.value
1447
+ }
1448
+ ) })
1449
+ }
1450
+ );
1451
+ }
1452
+ });
1453
+ });
1454
+ }, [product]);
1455
+ const attributeColumns = useMemo2(() => {
1456
+ const variantAttributes = product?.variant_attributes?.filter((attr) => attr.is_variant_axis);
1457
+ if (!variantAttributes?.length) {
1458
+ return [];
1459
+ }
1460
+ return variantAttributes.map((attribute) => {
1461
+ return columnHelper.display({
1462
+ id: `attribute-${attribute.id}`,
1463
+ header: attribute.name,
1464
+ cell: ({ row }) => {
1465
+ const variant = row.original;
1466
+ const matches = variant.attribute_values?.filter(
1467
+ (v) => v.attribute?.id === attribute.id
1468
+ ) ?? [];
1469
+ if (!matches.length) {
1470
+ return /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1471
+ }
1472
+ return /* @__PURE__ */ jsx8(
1473
+ "div",
1474
+ {
1475
+ className: "flex flex-wrap items-center gap-1",
1476
+ "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1477
+ children: matches.map((value) => /* @__PURE__ */ jsx8(Tooltip4, { content: value.name, children: /* @__PURE__ */ jsx8(
1478
+ Badge3,
1479
+ {
1480
+ size: "2xsmall",
1481
+ title: value.name,
1482
+ className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1483
+ "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${value.name}`,
1484
+ children: value.name
1485
+ }
1486
+ ) }, value.id))
1487
+ }
1488
+ );
1489
+ }
1490
+ });
1491
+ });
1492
+ }, [product]);
1493
+ const getActions = useCallback(
1494
+ (ctx) => {
1495
+ const variant = ctx.row.original;
1496
+ const mainActions = [
1497
+ {
1498
+ icon: /* @__PURE__ */ jsx8(PencilSquare4, {}),
1499
+ label: t("actions.edit"),
1500
+ onClick: (row) => {
1501
+ navigate(
1502
+ `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1503
+ {
1504
+ state: {
1505
+ restore_params: tableSearchParams.toString()
1506
+ }
1507
+ }
1508
+ );
1509
+ }
1510
+ }
1511
+ ];
1512
+ const secondaryActions = [
1513
+ {
1514
+ icon: /* @__PURE__ */ jsx8(Trash3, {}),
1515
+ label: t("actions.delete"),
1516
+ onClick: () => handleDelete(variant.id, variant.title)
1517
+ }
1518
+ ];
1519
+ const inventoryItemsCount = variant.inventory_items?.length || 0;
1520
+ switch (inventoryItemsCount) {
1521
+ case 0:
1522
+ break;
1523
+ case 1: {
1524
+ const inventoryItemLink = `/inventory/${variant.inventory_items[0].inventory.id}`;
1525
+ mainActions.push({
1526
+ label: t("products.variant.inventory.actions.inventoryItems"),
1527
+ onClick: () => {
1528
+ navigate(inventoryItemLink);
1529
+ },
1530
+ icon: /* @__PURE__ */ jsx8(Buildings, {})
1531
+ });
1532
+ break;
1533
+ }
1534
+ default: {
1535
+ const ids = variant.inventory_items?.map((i) => i.inventory?.id);
1536
+ if (!ids || ids.length === 0) {
1537
+ break;
1538
+ }
1539
+ const inventoryKitLink = `/inventory?${new URLSearchParams({
1540
+ id: ids.join(",")
1541
+ }).toString()}`;
1542
+ mainActions.push({
1543
+ label: t("products.variant.inventory.actions.inventoryKit"),
1544
+ onClick: () => {
1545
+ navigate(inventoryKitLink);
1546
+ },
1547
+ icon: /* @__PURE__ */ jsx8(Component, {})
1548
+ });
1549
+ }
1550
+ }
1551
+ return [mainActions, secondaryActions];
1552
+ },
1553
+ [handleDelete, navigate, t, tableSearchParams]
1554
+ );
1555
+ return useMemo2(() => {
1556
+ return [
1557
+ columnHelper.accessor("title", {
1558
+ header: t("fields.title"),
1559
+ enableSorting: true,
1560
+ sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1561
+ sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1562
+ }),
1563
+ ...optionColumns,
1564
+ ...attributeColumns,
1565
+ ...dateColumns,
1566
+ columnHelper.action({
1567
+ actions: getActions
1568
+ })
1569
+ ];
1570
+ }, [t, optionColumns, attributeColumns, dateColumns, getActions]);
1571
+ };
1572
+ var useFilters = () => {
1573
+ const dateFilters = useDataTableDateFilters();
1574
+ return useMemo2(() => {
1575
+ return [
1576
+ ...dateFilters
1577
+ ];
1578
+ }, [dateFilters]);
1579
+ };
1580
+ var commandHelper = createDataTableCommandHelper();
1581
+ var useCommands = () => {
1582
+ const { t } = useTranslation8();
1583
+ const navigate = useNavigate2();
1584
+ return [
1585
+ commandHelper.command({
1586
+ label: t("inventory.stock.action"),
1587
+ shortcut: "i",
1588
+ action: async (selection) => {
1589
+ navigate(
1590
+ `stock?${PRODUCT_VARIANT_IDS_KEY}=${Object.keys(selection).join(",")}`
1591
+ );
1592
+ }
1593
+ })
1594
+ ];
1595
+ };
1596
+
1597
+ // src/pages/products/product-detail/product-detail.tsx
1598
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1599
+ var Root = ({ children }) => {
1600
+ const initialData = useLoaderData();
1601
+ const { id } = useParams();
1602
+ const {
1603
+ product: rawProduct,
1604
+ isLoading,
1605
+ isError,
1606
+ error
1607
+ } = useProduct(id, PRODUCT_DETAIL_QUERY, {
1608
+ initialData
1609
+ });
1610
+ const product = rawProduct;
1611
+ if (isLoading || !product) {
1612
+ return /* @__PURE__ */ jsx9(
1613
+ TwoColumnPageSkeleton,
1614
+ {
1615
+ mainSections: 4,
1616
+ sidebarSections: 3,
1617
+ showJSON: true,
1618
+ showMetadata: true
1619
+ }
1620
+ );
1621
+ }
1622
+ if (isError) {
1623
+ throw error;
1624
+ }
1625
+ return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(
1626
+ TwoColumnPage,
1627
+ {
1628
+ data: product,
1629
+ showJSON: true,
1630
+ showMetadata: true,
1631
+ "data-testid": "product-detail-page",
1632
+ children
1633
+ }
1634
+ ) : /* @__PURE__ */ jsxs8(
1635
+ TwoColumnPage,
1636
+ {
1637
+ data: product,
1638
+ showJSON: true,
1639
+ showMetadata: true,
1640
+ "data-testid": "product-detail-page",
1641
+ children: [
1642
+ /* @__PURE__ */ jsxs8(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1643
+ /* @__PURE__ */ jsx9(ProductActiveRequestSection, { product }),
1644
+ /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1645
+ /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1646
+ /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1647
+ /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1648
+ ] }),
1649
+ /* @__PURE__ */ jsxs8(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1650
+ /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1651
+ /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1652
+ ] })
1653
+ ]
1654
+ }
1655
+ );
1656
+ };
1657
+ var ProductDetailPage = Object.assign(Root, {
1658
+ Main: TwoColumnPage.Main,
1659
+ Sidebar: TwoColumnPage.Sidebar,
1660
+ MainActiveRequestSection: ProductActiveRequestSection,
1661
+ MainActiveEditSection: ProductActiveEditSection,
1662
+ MainGeneralSection: ProductGeneralSection,
1663
+ MainMediaSection: ProductMediaSection,
1664
+ MainAttributeSection: ProductAttributeSection,
1665
+ MainVariantSection: ProductVariantSection,
1666
+ SidebarOrganizationSection: ProductOrganizationSection
1667
+ });
1668
+
1669
+ export {
1670
+ ProductDetailPage
1671
+ };