@mercurjs/admin 2.1.6 → 2.2.0-canary.11

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 (338) hide show
  1. package/dist/[id]-BAPEFPAO.js +505 -0
  2. package/dist/{add-campaign-promotions-6Z2STQT4.js → add-campaign-promotions-KOGSYV2W.js} +14 -16
  3. package/dist/{adjust-inventory-NVBPZYOF.js → adjust-inventory-3IQ657W2.js} +15 -15
  4. package/dist/{api-key-management-create-THDCXGWK.js → api-key-management-create-UD5V7TOU.js} +3 -3
  5. package/dist/{api-key-management-detail-IRYR6J2I.js → api-key-management-detail-NBNHERF6.js} +27 -27
  6. package/dist/{api-key-management-edit-LTVNXP6T.js → api-key-management-edit-4TLKJSAE.js} +3 -3
  7. package/dist/{api-key-management-list-4WCDP4B3.js → api-key-management-list-SZUSD6UI.js} +11 -13
  8. package/dist/{api-key-management-sales-channels-NVFG2ESH.js → api-key-management-sales-channels-TK6XEGF3.js} +15 -15
  9. package/dist/attribute-create-IKTP5XRS.js +583 -0
  10. package/dist/attribute-create-possible-value-EXVHC272.js +476 -0
  11. package/dist/{attribute-detail-R26GDX7Q.js → attribute-detail-V4QI34FV.js} +78 -69
  12. package/dist/attribute-edit-LUY66TG3.js +183 -0
  13. package/dist/attribute-edit-possible-value-IOS3625C.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-EMPHZ32M.js} +26 -29
  16. package/dist/{campaign-create-AZTR5UZP.js → campaign-create-VFFIIRE4.js} +5 -5
  17. package/dist/{campaign-detail-TCPO6DTI.js → campaign-detail-QY3AALUR.js} +29 -31
  18. package/dist/{campaign-list-DCLVAFEM.js → campaign-list-NQGNOFVZ.js} +10 -12
  19. package/dist/{categories-metadata-YVUNHMQT.js → categories-metadata-Z5JAWPAK.js} +19 -19
  20. package/dist/{category-create-DG3Z5RYE.js → category-create-GMCJABRW.js} +4 -4
  21. package/dist/{category-detail-K2UNFPRV.js → category-detail-IP5EPIUR.js} +32 -32
  22. package/dist/{category-edit-IXU6E3YT.js → category-edit-GLE4NTFG.js} +5 -5
  23. package/dist/{category-list-2MG37UXJ.js → category-list-SNVOQ64L.js} +11 -13
  24. package/dist/{category-organize-CCX2INRS.js → category-organize-UY4M4N7S.js} +2 -2
  25. package/dist/{category-products-LKT7564A.js → category-products-HWXJR7KR.js} +32 -32
  26. package/dist/{chunk-FSPZYOY6.js → chunk-2OF7GB7J.js} +4 -4
  27. package/dist/{chunk-W576GZBG.js → chunk-3AO6X4CE.js} +9 -9
  28. package/dist/{chunk-MANWKYT3.js → chunk-3HY4I76Q.js} +139 -204
  29. package/dist/{chunk-7YHAFHGI.js → chunk-3JSAS7QP.js} +92 -165
  30. package/dist/chunk-3VDLE5GA.js +87 -0
  31. package/dist/{chunk-GJPGL7RP.js → chunk-3VTAK3S6.js} +108 -28
  32. package/dist/{chunk-VIGX66F7.js → chunk-3XSC3NEG.js} +14 -1
  33. package/dist/{chunk-DBNPVU3L.js → chunk-453BC56K.js} +1 -1
  34. package/dist/{chunk-N23OD7WS.js → chunk-4GFS57XI.js} +7 -7
  35. package/dist/{chunk-EWMEXGFZ.js → chunk-4PU6GDCE.js} +19 -19
  36. package/dist/{chunk-C3WE6EFO.js → chunk-4YWKKCTT.js} +1 -2
  37. package/dist/chunk-533GMKEG.js +125 -0
  38. package/dist/{chunk-CEG375CR.js → chunk-5AZCIOS4.js} +4 -4
  39. package/dist/{chunk-X3YEY2PY.js → chunk-5FFZQPTT.js} +11 -11
  40. package/dist/{chunk-AEFDAU3Y.js → chunk-5KGMGL4N.js} +4 -24
  41. package/dist/chunk-5UPOHLBD.js +213 -0
  42. package/dist/{chunk-6676HWGI.js → chunk-623TMW36.js} +4 -4
  43. package/dist/{chunk-DL2ZIXBO.js → chunk-6FHQCLHQ.js} +1 -1
  44. package/dist/{chunk-WIQ2HBJG.js → chunk-72PLRAWM.js} +13 -13
  45. package/dist/{chunk-3IBSB2U6.js → chunk-7KZ5X5SU.js} +14 -14
  46. package/dist/chunk-7MMLCMV3.js +142 -0
  47. package/dist/{chunk-VGM5UQRA.js → chunk-A62MTLPR.js} +806 -327
  48. package/dist/{chunk-35Q6JF3S.js → chunk-A7JOHU6Q.js} +4 -4
  49. package/dist/{chunk-ARMGWHYU.js → chunk-ABWW3JHS.js} +19 -19
  50. package/dist/{chunk-UXD3VNBO.js → chunk-AJLGY3LQ.js} +1 -2
  51. package/dist/{chunk-HY3CV5V6.js → chunk-AKTAFKIU.js} +4 -4
  52. package/dist/{chunk-V7EPLR3E.js → chunk-BFT3CN5L.js} +10 -10
  53. package/dist/{chunk-HGULM6DF.js → chunk-BGQ7H2KL.js} +10 -10
  54. package/dist/{chunk-SOJ4TLWP.js → chunk-BPCU5QJE.js} +5 -5
  55. package/dist/{chunk-F67RRVMJ.js → chunk-BQ6ZDY6L.js} +13 -13
  56. package/dist/{chunk-GXRLLA5H.js → chunk-CKD5563X.js} +4 -4
  57. package/dist/{chunk-E3DLJSYD.js → chunk-COP7NFSJ.js} +1 -1
  58. package/dist/{chunk-ABUQBBEM.js → chunk-CVFVEDMV.js} +4 -4
  59. package/dist/{chunk-6A7MR5NS.js → chunk-CVZA23ES.js} +11 -11
  60. package/dist/{chunk-7MTFPHXR.js → chunk-CYGCCNIC.js} +8 -8
  61. package/dist/{chunk-6MJ5HPIP.js → chunk-D2VXOF46.js} +6 -6
  62. package/dist/{chunk-OQMBWJPH.js → chunk-DELK6EWH.js} +13 -187
  63. package/dist/{chunk-N57BOIPU.js → chunk-DJWOIRLV.js} +1 -1
  64. package/dist/{chunk-Z2QQZOG3.js → chunk-DN2K5EAH.js} +1 -1
  65. package/dist/{chunk-UEEYZGM3.js → chunk-DRJAKRTI.js} +46 -17
  66. package/dist/chunk-EBYWGIOR.js +334 -0
  67. package/dist/{chunk-MMEZWZXV.js → chunk-EGTH3PUK.js} +20 -20
  68. package/dist/{chunk-4LQX5FRH.js → chunk-EMQP2CNF.js} +5 -5
  69. package/dist/{chunk-WRRMBJBQ.js → chunk-ENFXIYIH.js} +1 -1
  70. package/dist/{chunk-KHHMQM2L.js → chunk-EYFWEKFJ.js} +5 -5
  71. package/dist/chunk-F52JLHE3.js +2051 -0
  72. package/dist/{chunk-MNYDJXTM.js → chunk-FB7DDNCA.js} +5 -5
  73. package/dist/{chunk-BEU674HI.js → chunk-FDD7TANX.js} +5 -5
  74. package/dist/{chunk-GZBVMHXS.js → chunk-FFNSWUDC.js} +10 -10
  75. package/dist/{chunk-Y3FXVIJO.js → chunk-FNKBJCNF.js} +6 -6
  76. package/dist/{chunk-GAD5DQOY.js → chunk-G5DQCCPL.js} +2 -2
  77. package/dist/{chunk-35NDMIYZ.js → chunk-GVEF6UDT.js} +1 -1
  78. package/dist/{chunk-5CK6XEFV.js → chunk-H3MAUKL7.js} +174 -118
  79. package/dist/{chunk-B6SYYKJI.js → chunk-HDOWEXDH.js} +13 -13
  80. package/dist/{chunk-Z4WRKGME.js → chunk-HEGPAGJT.js} +11 -11
  81. package/dist/{chunk-63OSYRLS.js → chunk-HR7TFO2X.js} +4 -4
  82. package/dist/{chunk-4Q7LZQVY.js → chunk-IAWZQKUH.js} +10 -10
  83. package/dist/chunk-IIFQ7KYL.js +171 -0
  84. package/dist/{chunk-DVKO4VRC.js → chunk-IQZ3T2Q4.js} +12 -12
  85. package/dist/{chunk-Y2M536WR.js → chunk-JHBNG7OD.js} +17 -0
  86. package/dist/{chunk-LNAXUDW2.js → chunk-JSH7JEKY.js} +60 -62
  87. package/dist/chunk-JSMUFZZN.js +101 -0
  88. package/dist/{chunk-X4DGVTMC.js → chunk-K4WU4PVL.js} +5 -5
  89. package/dist/{chunk-MWX5JCOM.js → chunk-KT7X72J4.js} +161 -172
  90. package/dist/{chunk-R46PKJUT.js → chunk-KXIA66EJ.js} +13 -13
  91. package/dist/{chunk-2OYCT5NO.js → chunk-LGL4QSGB.js} +6 -6
  92. package/dist/{chunk-PBQ5M44A.js → chunk-LJDGVBOQ.js} +11 -47
  93. package/dist/chunk-LO2ZWQGL.js +6 -0
  94. package/dist/{chunk-VVWB3GIK.js → chunk-LYZDVZWA.js} +3 -12
  95. package/dist/{chunk-SPIVEW2Y.js → chunk-M572YFDA.js} +8 -8
  96. package/dist/{chunk-4ZN3D4YS.js → chunk-MEXH366L.js} +9 -9
  97. package/dist/{chunk-MKA5JWE6.js → chunk-MR3MLNWV.js} +35 -35
  98. package/dist/{chunk-SJQG3RCN.js → chunk-MVDPDVMI.js} +19 -19
  99. package/dist/{chunk-J24X54DB.js → chunk-MVNO35S5.js} +7 -7
  100. package/dist/{chunk-XBHUWCBD.js → chunk-N4GJRJF5.js} +1 -1
  101. package/dist/{chunk-34I4QIBD.js → chunk-N6YOACEW.js} +1 -1
  102. package/dist/{chunk-NEN6KWAJ.js → chunk-N7OVIX55.js} +12 -12
  103. package/dist/{chunk-6YGOXPB5.js → chunk-NGDOLGBQ.js} +21 -9
  104. package/dist/{chunk-YKDEE7ZL.js → chunk-NJP3DEE5.js} +1 -1
  105. package/dist/{chunk-HKDFWQ6Q.js → chunk-NQEXDLYH.js} +460 -2
  106. package/dist/{chunk-AZAGUAN4.js → chunk-O2XHQTBX.js} +15 -15
  107. package/dist/{chunk-3IN6MMKV.js → chunk-OFOKVLV3.js} +2 -2
  108. package/dist/chunk-OMBP3YSV.js +165 -0
  109. package/dist/{chunk-B6FG7A6W.js → chunk-P5XVG4PY.js} +1 -1
  110. package/dist/{chunk-LFATSJPO.js → chunk-PASEZJC7.js} +9 -9
  111. package/dist/chunk-PT5PLV3N.js +78 -0
  112. package/dist/{chunk-4IZ2RD3L.js → chunk-PXKDYD3M.js} +8 -8
  113. package/dist/chunk-PYDRHQTY.js +24 -0
  114. package/dist/{chunk-XB3HXEZB.js → chunk-QLEGHL2Q.js} +78 -73
  115. package/dist/{chunk-3B6MTW5G.js → chunk-QUHSHIAC.js} +3 -0
  116. package/dist/{chunk-3DOCALSU.js → chunk-QUPUWR42.js} +395 -11
  117. package/dist/{chunk-NRJ7F7JW.js → chunk-R7ESTJHN.js} +14 -14
  118. package/dist/{chunk-7QWLLYOY.js → chunk-RQPDD3RI.js} +1 -1
  119. package/dist/{chunk-JCSPXBS3.js → chunk-SJGIQGEC.js} +1 -1
  120. package/dist/{chunk-3ZSYFPHB.js → chunk-SUVFPJ4J.js} +19 -19
  121. package/dist/{chunk-YEUUI6JF.js → chunk-TE4IF3MM.js} +1 -1
  122. package/dist/{chunk-OVEBN3NC.js → chunk-TZDRRTAX.js} +5 -5
  123. package/dist/{chunk-HNUA6XIW.js → chunk-UCX2T4BQ.js} +14 -14
  124. package/dist/{chunk-GZMXTNDN.js → chunk-UCYSCKZV.js} +1432 -1380
  125. package/dist/chunk-UIVWOKWT.js +63 -0
  126. package/dist/{chunk-3T5S5RDO.js → chunk-UXGLM3B4.js} +4 -4
  127. package/dist/{chunk-UYO5Y4JI.js → chunk-VT5E7OMM.js} +11 -11
  128. package/dist/{chunk-TAKEQAZZ.js → chunk-VT6QIVZW.js} +0 -93
  129. package/dist/{chunk-5ZBQICCP.js → chunk-VY7PT4SI.js} +15 -15
  130. package/dist/{chunk-O5YFLNSQ.js → chunk-W3FDZPPF.js} +101 -290
  131. package/dist/chunk-W6CW4WHC.js +1755 -0
  132. package/dist/{chunk-ORI7UXS6.js → chunk-W6V2L2FX.js} +6 -6
  133. package/dist/chunk-WPVDACTL.js +60 -0
  134. package/dist/{chunk-5OS2MBRB.js → chunk-WTK4MLMF.js} +8 -8
  135. package/dist/{chunk-GDHF6CT5.js → chunk-X45JKZYW.js} +11 -11
  136. package/dist/{chunk-PIZ7FN3L.js → chunk-X7H7TIOT.js} +16 -16
  137. package/dist/{chunk-GKJLFLGN.js → chunk-XJ3WC4G7.js} +4 -4
  138. package/dist/{chunk-SESTTUVM.js → chunk-YN3FGNJM.js} +53 -1
  139. package/dist/{chunk-S4SVK5DE.js → chunk-YVLANFBK.js} +29 -1
  140. package/dist/{chunk-U7WZYWGA.js → chunk-Z5T5EPLF.js} +1 -1
  141. package/dist/{chunk-M73MP4NC.js → chunk-ZO7A6VYP.js} +19 -19
  142. package/dist/{collection-add-products-IRYJ6U6P.js → collection-add-products-ABWXUOFD.js} +32 -32
  143. package/dist/{collection-create-3BTRORHU.js → collection-create-BRMP6SIZ.js} +2 -2
  144. package/dist/{collection-detail-263PM4DL.js → collection-detail-AMGR2B5N.js} +30 -30
  145. package/dist/{collection-edit-L5GPFBBX.js → collection-edit-YLWUEU4C.js} +2 -2
  146. package/dist/{collection-list-CEU2EZ6K.js → collection-list-6HZE43AC.js} +38 -40
  147. package/dist/{collection-metadata-KHGPTV5C.js → collection-metadata-JS5QP3GD.js} +19 -19
  148. package/dist/{commission-rate-create-U3XQ4S27.js → commission-rate-create-PSPSJZR5.js} +57 -58
  149. package/dist/{commission-rate-detail-MY3F2RHR.js → commission-rate-detail-U72E4ZIO.js} +20 -20
  150. package/dist/{commission-rate-edit-MPEWXGTE.js → commission-rate-edit-7NJPABVA.js} +57 -58
  151. package/dist/{commission-rate-list-JPBOTOTA.js → commission-rate-list-Y5XLEO67.js} +8 -10
  152. package/dist/{constants-CAwtRicB.d.ts → constants-Bahlh59D.d.ts} +8 -4
  153. package/dist/{customer-detail-2QBJPF7S.js → customer-detail-2RWBN6C4.js} +30 -32
  154. package/dist/{customer-group-add-customers-JCLAH45C.js → customer-group-add-customers-VJUBEN7M.js} +13 -15
  155. package/dist/{customer-group-detail-BDKFWKTI.js → customer-group-detail-ED66F7JM.js} +26 -28
  156. package/dist/{customer-group-list-3NEEJXQH.js → customer-group-list-6YUFKBHH.js} +26 -28
  157. package/dist/{customer-group-metadata-YJXZFSFG.js → customer-group-metadata-VQUOWR3P.js} +19 -19
  158. package/dist/{customer-list-ZIFNZXO4.js → customer-list-MB6WZFMA.js} +11 -13
  159. package/dist/{customer-metadata-SG6M7X3Q.js → customer-metadata-47AVJXRI.js} +19 -19
  160. package/dist/{customers-add-customer-group-OQIFQZBL.js → customers-add-customer-group-HI7J7YKN.js} +29 -31
  161. package/dist/{edit-inventory-item-TDG2ZTPM.js → edit-inventory-item-MBPSBJL4.js} +15 -15
  162. package/dist/{edit-inventory-item-attributes-T56PJTCT.js → edit-inventory-item-attributes-RVYWOFAC.js} +15 -15
  163. package/dist/{edit-reservation-T6SKOG2F.js → edit-reservation-7BLGYXCJ.js} +5 -5
  164. package/dist/{edit-rules-4AHZQGCX.js → edit-rules-ZWDKM5M3.js} +19 -18
  165. package/dist/index.d.ts +2 -2
  166. package/dist/index.js +792 -632
  167. package/dist/{inventory-create-P26OGAHD.js → inventory-create-Q4VBPXSG.js} +22 -22
  168. package/dist/{inventory-detail-7W7UUWNT.js → inventory-detail-6CKO3A3Y.js} +28 -30
  169. package/dist/{inventory-list-PA4B4RWY.js → inventory-list-2JGX6BRI.js} +10 -12
  170. package/dist/{inventory-metadata-LUGA3KNV.js → inventory-metadata-COGGE5ZR.js} +19 -19
  171. package/dist/{inventory-stock-UZSYXXPX.js → inventory-stock-2QIKS7LE.js} +204 -42
  172. package/dist/loader-OU7SKXOD.js +28 -0
  173. package/dist/{location-detail-RUC2ZP3K.js → location-detail-HOCNTQ7K.js} +24 -24
  174. package/dist/{location-fulfillment-providers-WDET6TJP.js → location-fulfillment-providers-YQ2XFPAJ.js} +38 -39
  175. package/dist/{location-list-R7EECG5Z.js → location-list-I2UMU25V.js} +21 -22
  176. package/dist/{location-sales-channels-IS6E3I4S.js → location-sales-channels-GKIWX6B2.js} +12 -12
  177. package/dist/{location-service-zone-create-HAQVVTKP.js → location-service-zone-create-ZS3UWJAA.js} +8 -11
  178. package/dist/{location-service-zone-manage-areas-5LCENMAM.js → location-service-zone-manage-areas-S7QZTIFT.js} +8 -11
  179. package/dist/{location-service-zone-shipping-option-create-FV5Y2PNB.js → location-service-zone-shipping-option-create-6GYLJHEC.js} +25 -24
  180. package/dist/{location-service-zone-shipping-option-edit-PLEDWIY3.js → location-service-zone-shipping-option-edit-3PGSNKYT.js} +8 -7
  181. package/dist/{location-service-zone-shipping-option-pricing-6QHLZ6IN.js → location-service-zone-shipping-option-pricing-POBJOF3Z.js} +13 -13
  182. package/dist/{login-EWHQY6G3.js → login-N7CVSQNG.js} +15 -15
  183. package/dist/{manage-locations-TU5HCIKG.js → manage-locations-TKLOHP3D.js} +1 -1
  184. package/dist/{marketplace-add-currencies-PB73MHM6.js → marketplace-add-currencies-6ANNBGZM.js} +8 -10
  185. package/dist/{marketplace-detail-3KFGJWQ7.js → marketplace-detail-K52ALYGT.js} +27 -29
  186. package/dist/{marketplace-edit-U5B6WA56.js → marketplace-edit-6Q3G2OY5.js} +5 -4
  187. package/dist/{marketplace-metadata-VYCPYFJD.js → marketplace-metadata-ZSX3IQF4.js} +22 -22
  188. package/dist/offers-UBD6NICA.js +442 -0
  189. package/dist/{order-create-claim-R2SX6YUS.js → order-create-claim-OVHMMR3J.js} +284 -293
  190. package/dist/{order-create-edit-AONQC3TO.js → order-create-edit-HEOYCYZO.js} +216 -155
  191. package/dist/{order-create-exchange-7KKMJHXE.js → order-create-exchange-L56VKQBL.js} +291 -271
  192. package/dist/{order-create-refund-KWYYLAED.js → order-create-refund-UTJKJ3AJ.js} +23 -23
  193. package/dist/{order-create-return-BQFRANNG.js → order-create-return-FLGYGUTQ.js} +66 -41
  194. package/dist/{order-detail-BITJD73H.js → order-detail-KAB4MV7X.js} +34 -37
  195. package/dist/{order-edit-billing-address-FLEI4VDB.js → order-edit-billing-address-RUURVISC.js} +18 -18
  196. package/dist/{order-edit-email-AZIA6X5Q.js → order-edit-email-OO7AMRHC.js} +17 -17
  197. package/dist/{order-edit-shipping-address-GJMUSOPK.js → order-edit-shipping-address-BRRXUE76.js} +17 -17
  198. package/dist/{order-list-O7C7ENXI.js → order-list-S3AJC6L5.js} +26 -28
  199. package/dist/{order-metadata-RXIJOP4V.js → order-metadata-OHK6TPAO.js} +20 -20
  200. package/dist/{order-request-transfer-6IZVCHGV.js → order-request-transfer-YLMXC7NL.js} +19 -18
  201. package/dist/pages/index.d.ts +562 -706
  202. package/dist/pages/index.js +202 -205
  203. package/dist/{payout-detail-JWS2Q4TY.js → payout-detail-TWO6HN4E.js} +3 -3
  204. package/dist/{payout-list-PW6BFT4O.js → payout-list-7WJZFNW5.js} +9 -11
  205. package/dist/{price-list-configuration-N5D5OFXX.js → price-list-configuration-Q5H22ZE2.js} +13 -15
  206. package/dist/{price-list-create-NQFC2JIJ.js → price-list-create-OYAVGRM5.js} +37 -37
  207. package/dist/{price-list-detail-HRVLVBPS.js → price-list-detail-Q4GFFUFG.js} +32 -32
  208. package/dist/{price-list-edit-BVVLQ5WV.js → price-list-edit-YY4SXEI3.js} +5 -5
  209. package/dist/{price-list-list-K4IJFZYH.js → price-list-list-OIOY43TF.js} +13 -15
  210. package/dist/{price-list-prices-add-WXEGEWRA.js → price-list-prices-add-KONZVSVQ.js} +33 -33
  211. package/dist/{price-list-prices-edit-KJEKS6TL.js → price-list-prices-edit-SMUKU7Q6.js} +24 -24
  212. package/dist/product-add-existing-attributes-GGRRNFDK.js +456 -0
  213. package/dist/{product-attributes-ASPKDH7H.js → product-attributes-C3KHQF2I.js} +4 -4
  214. package/dist/product-bulk-edit-J3CMBZN2.js +285 -0
  215. package/dist/{product-create-BDQ66ECX.js → product-create-UR5OFGUY.js} +38 -39
  216. package/dist/product-create-attribute-XARMC6FJ.js +224 -0
  217. package/dist/product-create-variant-6VUKYLWE.js +20 -0
  218. package/dist/{product-detail-DCHR4B4T.js → product-detail-OLFVJZ7T.js} +26 -30
  219. package/dist/{product-edit-IASCMBET.js → product-edit-F4CKOIUO.js} +13 -8
  220. package/dist/product-edit-attribute-LG2ZM6HQ.js +175 -0
  221. package/dist/{product-list-X72QPKOK.js → product-list-2BWYAATR.js} +33 -33
  222. package/dist/{product-media-VNSFLCSH.js → product-media-EUDMCJ75.js} +16 -9
  223. package/dist/{product-metadata-GJ7C2UJG.js → product-metadata-5WVNFCRL.js} +22 -22
  224. package/dist/{product-organization-PN22LYKQ.js → product-organization-BFWDCHP4.js} +18 -18
  225. package/dist/{product-sales-channels-J2ZNRKZT.js → product-sales-channels-WKQSYOEX.js} +15 -15
  226. package/dist/{product-shipping-profile-G7UPGWYK.js → product-shipping-profile-WDLKA2SN.js} +6 -5
  227. package/dist/{product-tag-create-PHJICTE4.js → product-tag-create-KQSVCWMC.js} +15 -15
  228. package/dist/{product-tag-detail-4CKJMGHR.js → product-tag-detail-CWDAY7F3.js} +54 -55
  229. package/dist/{product-tag-edit-G4UNGXPT.js → product-tag-edit-B4SIZCUK.js} +15 -15
  230. package/dist/{product-tag-list-WQLWIZZW.js → product-tag-list-2OK3OCMZ.js} +54 -55
  231. package/dist/{product-tag-metadata-I4V6CR6Z.js → product-tag-metadata-MASTMIKE.js} +19 -19
  232. package/dist/{product-type-detail-7GHH4ACU.js → product-type-detail-3X7ZTZJN.js} +30 -30
  233. package/dist/{product-type-list-LTYTTF4F.js → product-type-list-TM26QMHR.js} +12 -14
  234. package/dist/{product-type-metadata-KGVRMMTQ.js → product-type-metadata-6BKTQHQC.js} +19 -19
  235. package/dist/{product-variant-detail-PHGVJWUV.js → product-variant-detail-PQ4RKPZT.js} +23 -43
  236. package/dist/product-variant-edit-TLF475SH.js +776 -0
  237. package/dist/{product-variant-metadata-HV72UBCP.js → product-variant-metadata-3M72B3PM.js} +19 -19
  238. package/dist/{profile-detail-UQTGEFYF.js → profile-detail-ZRL5SERS.js} +4 -4
  239. package/dist/{promotion-add-campaign-M4OT6URB.js → promotion-add-campaign-S3JJSFHT.js} +8 -7
  240. package/dist/{promotion-create-GM37OXEW.js → promotion-create-OKZBUSJD.js} +25 -24
  241. package/dist/{promotion-detail-PDBRQII7.js → promotion-detail-MMNEDRXD.js} +23 -23
  242. package/dist/{promotion-list-XW4PNLJF.js → promotion-list-DHWW7FTI.js} +13 -15
  243. package/dist/{refund-reason-create-M2CYTCEM.js → refund-reason-create-N4DZ4UHS.js} +15 -15
  244. package/dist/{refund-reason-edit-M4XBV633.js → refund-reason-edit-OAHRDKXW.js} +15 -15
  245. package/dist/{refund-reason-list-OXBLAGYO.js → refund-reason-list-YLH4LD4S.js} +40 -39
  246. package/dist/{region-add-countries-T4XZ2CU3.js → region-add-countries-COXN4LP3.js} +7 -9
  247. package/dist/{region-create-MQXTWBKC.js → region-create-P66Q65XY.js} +14 -15
  248. package/dist/{region-detail-6OFP76OY.js → region-detail-P2HHBYFV.js} +11 -13
  249. package/dist/{region-edit-QNJ2HT76.js → region-edit-XFE54SAO.js} +8 -7
  250. package/dist/{region-list-EYTDREE2.js → region-list-2XXKCDDX.js} +11 -13
  251. package/dist/{region-metadata-4JWOEGTZ.js → region-metadata-BJSTTZFL.js} +22 -22
  252. package/dist/{reservation-create-26QAWABA.js → reservation-create-TXYAY3KF.js} +2 -2
  253. package/dist/{reservation-detail-G26K6HZV.js → reservation-detail-CEENG76D.js} +23 -23
  254. package/dist/{reservation-list-CHHR6CEV.js → reservation-list-SORWYHI4.js} +11 -13
  255. package/dist/{reservation-metadata-JFLJ27A3.js → reservation-metadata-G3QBZF4K.js} +22 -22
  256. package/dist/{reset-password-S6IBWG47.js → reset-password-QGQ4GAHK.js} +1 -1
  257. package/dist/{return-reason-list-65LQDOZB.js → return-reason-list-7HTIV7NK.js} +28 -29
  258. package/dist/{sales-channel-add-products-FH7B7UYR.js → sales-channel-add-products-3VZ5SLLP.js} +33 -33
  259. package/dist/{sales-channel-create-NSZEHGZE.js → sales-channel-create-XBR3QESI.js} +2 -2
  260. package/dist/{sales-channel-detail-KCS472HN.js → sales-channel-detail-PHRSKCNM.js} +30 -30
  261. package/dist/{sales-channel-edit-W6Z2ERBJ.js → sales-channel-edit-ILBZBQP4.js} +2 -2
  262. package/dist/{sales-channel-list-6HBRUZ2Z.js → sales-channel-list-3GCESYAM.js} +23 -23
  263. package/dist/{sales-channel-metadata-NDSKXOGH.js → sales-channel-metadata-HVPGS756.js} +19 -19
  264. package/dist/{shipping-option-type-create-MEL24PGH.js → shipping-option-type-create-3ZKT7WAC.js} +15 -15
  265. package/dist/{shipping-option-type-detail-IS7CNAYI.js → shipping-option-type-detail-IYXWAK7F.js} +21 -21
  266. package/dist/{shipping-option-type-edit-IVBHURXR.js → shipping-option-type-edit-QRXYNNRW.js} +15 -15
  267. package/dist/{shipping-option-type-list-BTPCLBSD.js → shipping-option-type-list-MLIDCA3L.js} +26 -28
  268. package/dist/{shipping-profile-detail-L3IHPGLL.js → shipping-profile-detail-YAKZHWZI.js} +5 -5
  269. package/dist/{shipping-profile-metadata-UZPX2PHJ.js → shipping-profile-metadata-T4HPNTLH.js} +21 -21
  270. package/dist/{shipping-profiles-list-2JKVMEZG.js → shipping-profiles-list-JF2SQIQ7.js} +9 -11
  271. package/dist/{store-bulk-edit-WBBPQAAC.js → store-bulk-edit-BNF3HH5K.js} +7 -7
  272. package/dist/{store-create-OQVFVIK4.js → store-create-KFLNOD73.js} +18 -18
  273. package/dist/{store-details-NRNZNKBY.js → store-details-E347PHAN.js} +47 -62
  274. package/dist/{store-edit-PZWUMDFA.js → store-edit-Y6NLBIOP.js} +14 -14
  275. package/dist/{store-list-GWOYTUBA.js → store-list-S2L44OLB.js} +39 -41
  276. package/dist/{store-member-invite-Z5S63WYE.js → store-member-invite-J5XSPWMW.js} +3 -3
  277. package/dist/{tax-region-create-5DDZ23QQ.js → tax-region-create-MIDQXQS4.js} +18 -17
  278. package/dist/{tax-region-detail-VNBNS7FS.js → tax-region-detail-AC7B3G57.js} +28 -29
  279. package/dist/{tax-region-edit-OARZRBVK.js → tax-region-edit-5CORTHTC.js} +17 -16
  280. package/dist/{tax-region-list-WCHVLVVC.js → tax-region-list-FIBHEFVD.js} +9 -9
  281. package/dist/{tax-region-metadata-XJRFOG7I.js → tax-region-metadata-QQZIQPAD.js} +19 -19
  282. package/dist/{tax-region-province-detail-MXYZMUX7.js → tax-region-province-detail-2MGX7LEO.js} +26 -27
  283. package/dist/{tax-region-tax-override-create-LGST6PD7.js → tax-region-tax-override-create-IONGD4TG.js} +57 -58
  284. package/dist/{tax-region-tax-override-edit-5XNWTGDS.js → tax-region-tax-override-edit-RIT6YRVK.js} +57 -58
  285. package/dist/{user-detail-LGIMHLY4.js → user-detail-MMVBN3AE.js} +6 -6
  286. package/dist/{user-invite-ZZSWFXFM.js → user-invite-HLZJ7FST.js} +14 -16
  287. package/dist/{user-list-5QJJS7EA.js → user-list-TR7RSGUO.js} +9 -11
  288. package/dist/{user-metadata-376YJMY3.js → user-metadata-OZLU3Y2X.js} +19 -19
  289. package/package.json +5 -5
  290. package/dist/attribute-create-EAOQ6KT6.js +0 -1010
  291. package/dist/attribute-create-possible-value-BIU2L7AN.js +0 -437
  292. package/dist/attribute-edit-DRHFOHMK.js +0 -282
  293. package/dist/attribute-edit-possible-value-G2ON2AE3.js +0 -264
  294. package/dist/chunk-2U5BRCQO.js +0 -170
  295. package/dist/chunk-33XUAKRP.js +0 -6
  296. package/dist/chunk-4GPAS5GW.js +0 -36
  297. package/dist/chunk-4ZTZTIIM.js +0 -69
  298. package/dist/chunk-7O5NDICV.js +0 -120
  299. package/dist/chunk-7XXM72CF.js +0 -679
  300. package/dist/chunk-IGTRIAUC.js +0 -84
  301. package/dist/chunk-KYPPQGGE.js +0 -467
  302. package/dist/chunk-LBXPX3XC.js +0 -1260
  303. package/dist/chunk-LO7XX5M7.js +0 -6
  304. package/dist/chunk-MXGDKEU5.js +0 -248
  305. package/dist/chunk-OG4WH7IW.js +0 -420
  306. package/dist/chunk-QOQSXNEF.js +0 -37
  307. package/dist/chunk-QSGR43JM.js +0 -30
  308. package/dist/chunk-RSBZREKG.js +0 -144
  309. package/dist/chunk-RXM4B6HR.js +0 -8
  310. package/dist/chunk-UM7ZR3VU.js +0 -14
  311. package/dist/chunk-WCEMRNW4.js +0 -6
  312. package/dist/chunk-Z5I2Z6L3.js +0 -160
  313. package/dist/chunk-ZMC7BKLT.js +0 -56
  314. package/dist/chunk-ZXYKF4A2.js +0 -2146
  315. package/dist/order-allocate-items-2B6T5JCK.js +0 -563
  316. package/dist/order-create-fulfillment-2FTTWTFE.js +0 -642
  317. package/dist/order-create-shipment-7XP6PDTD.js +0 -214
  318. package/dist/order-receive-return-JV3X7YHG.js +0 -562
  319. package/dist/product-create-option-B7SV42LO.js +0 -148
  320. package/dist/product-create-variant-7YAG2YRZ.js +0 -56
  321. package/dist/product-edit-option-KVTIY5NM.js +0 -156
  322. package/dist/product-export-YZ2XSXFN.js +0 -137
  323. package/dist/product-import-KOSPPCSW.js +0 -267
  324. package/dist/product-prices-HI4SOTMP.js +0 -267
  325. package/dist/product-stock-666D3AMJ.js +0 -544
  326. package/dist/product-variant-edit-L77HDGTA.js +0 -547
  327. package/dist/product-variant-manage-inventory-items-WENX2QCZ.js +0 -341
  328. package/dist/{chunk-XCANTVXS.js → chunk-CPXK5RSJ.js} +6 -6
  329. package/dist/{chunk-Y6NK6GBB.js → chunk-GP4J42UD.js} +5 -5
  330. package/dist/{chunk-L56WFGUN.js → chunk-IMR3MZDP.js} +3 -3
  331. package/dist/{chunk-OB4NOV4M.js → chunk-LYZT5REU.js} +3 -3
  332. package/dist/{chunk-ZBJ56XDB.js → chunk-Q2ULPJJ6.js} +3 -3
  333. package/dist/{chunk-KCYUY2AI.js → chunk-WQFFCK3R.js} +6 -6
  334. package/dist/{chunk-ZW34ZAIP.js → chunk-WYA62MUL.js} +8 -8
  335. package/dist/{chunk-56AUQBQX.js → chunk-YYMACYP6.js} +5 -5
  336. package/dist/{customer-edit-X4HQOUAE.js → customer-edit-JZ4PQTIN.js} +3 -3
  337. package/dist/{profile-edit-Y5UUUKVH.js → profile-edit-HQTWYWZ7.js} +6 -6
  338. package/dist/{promotion-edit-details-E2XKWY7L.js → promotion-edit-details-TKRC5HES.js} +6 -6
@@ -0,0 +1,1755 @@
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-GVEF6UDT.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
+ useQueryParams
22
+ } from "./chunk-THHRRYRS.js";
23
+ import {
24
+ require_dist
25
+ } from "./chunk-UCYSCKZV.js";
26
+ import {
27
+ useProductTag
28
+ } from "./chunk-LJDGVBOQ.js";
29
+ import {
30
+ useProductType
31
+ } from "./chunk-46M463BR.js";
32
+ import {
33
+ productAttributesQueryKeys,
34
+ useProductAttribute
35
+ } from "./chunk-533GMKEG.js";
36
+ import {
37
+ useCollection
38
+ } from "./chunk-Z5T5EPLF.js";
39
+ import {
40
+ useSeller
41
+ } from "./chunk-LEG67A2R.js";
42
+ import {
43
+ ActionMenu
44
+ } from "./chunk-BDGZ4EQO.js";
45
+ import {
46
+ useProductCategory
47
+ } from "./chunk-DN2K5EAH.js";
48
+ import {
49
+ TwoColumnPageSkeleton
50
+ } from "./chunk-INNFZYX2.js";
51
+ import {
52
+ useCancelProductChange,
53
+ useConfirmProduct,
54
+ useConfirmProductChange,
55
+ useDeleteProduct,
56
+ useDeleteVariantLazy,
57
+ useProduct,
58
+ useProductChange,
59
+ useProductVariants,
60
+ useRejectProduct,
61
+ useRemoveAttributeFromProduct,
62
+ useRequestProductChanges,
63
+ useUpdateProduct,
64
+ variantsQueryKeys
65
+ } from "./chunk-H3MAUKL7.js";
66
+ import {
67
+ sdk
68
+ } from "./chunk-ZBWL72TB.js";
69
+ import {
70
+ __toESM
71
+ } from "./chunk-NBMM2TZK.js";
72
+
73
+ // src/pages/products/product-detail/product-detail.tsx
74
+ import { Children } from "react";
75
+ import { useLoaderData, useParams } from "react-router-dom";
76
+
77
+ // src/pages/products/product-detail/components/product-active-edit-section/product-active-edit-section.tsx
78
+ var import_types = __toESM(require_dist(), 1);
79
+ import { Fragment, useMemo, useState as useState2 } from "react";
80
+ import { ExclamationCircleSolid } from "@medusajs/icons";
81
+ import { Button, Container, Heading, Text, toast } from "@medusajs/ui";
82
+ import {
83
+ describeProductChangeAction,
84
+ extractReferenceIds,
85
+ formatFieldValue,
86
+ humanizeFieldName,
87
+ isImageList,
88
+ isReferenceField,
89
+ partitionProductChangeActions
90
+ } from "@mercurjs/dashboard-shared";
91
+ import { useQueries } from "@tanstack/react-query";
92
+ import { useTranslation as useTranslation2 } from "react-i18next";
93
+
94
+ // src/components/common/confirm-prompt/confirm-prompt.tsx
95
+ import { Label, Prompt, Textarea } from "@medusajs/ui";
96
+ import { useEffect, useState } from "react";
97
+ import { useTranslation } from "react-i18next";
98
+ import { jsx, jsxs } from "react/jsx-runtime";
99
+ var ConfirmPrompt = ({
100
+ open,
101
+ onOpenChange,
102
+ variant = "confirmation",
103
+ title,
104
+ description,
105
+ noteLabel,
106
+ noteOptional = false,
107
+ notePlaceholder,
108
+ defaultNote = "",
109
+ cancelLabel,
110
+ confirmLabel,
111
+ isLoading = false,
112
+ onConfirm
113
+ }) => {
114
+ const { t } = useTranslation();
115
+ const [note, setNote] = useState(defaultNote);
116
+ useEffect(() => {
117
+ if (open) {
118
+ setNote(defaultNote);
119
+ }
120
+ }, [open, defaultNote]);
121
+ const showNoteField = typeof noteLabel === "string";
122
+ const handleOpenChange = (next) => {
123
+ if (isLoading) {
124
+ return;
125
+ }
126
+ onOpenChange(next);
127
+ };
128
+ const handleConfirm = async () => {
129
+ const trimmed = note.trim();
130
+ await onConfirm(showNoteField && trimmed ? trimmed : void 0);
131
+ };
132
+ return /* @__PURE__ */ jsx(Prompt, { open, onOpenChange: handleOpenChange, variant, children: /* @__PURE__ */ jsxs(Prompt.Content, { children: [
133
+ /* @__PURE__ */ jsxs(Prompt.Header, { children: [
134
+ /* @__PURE__ */ jsx(Prompt.Title, { children: title }),
135
+ description ? /* @__PURE__ */ jsx(Prompt.Description, { children: description }) : null
136
+ ] }),
137
+ showNoteField ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2 px-6 py-4", children: [
138
+ /* @__PURE__ */ jsxs(Label, { size: "small", weight: "plus", children: [
139
+ noteLabel,
140
+ noteOptional ? /* @__PURE__ */ jsxs("span", { className: "text-ui-fg-muted ml-1 font-normal", children: [
141
+ "(",
142
+ t("fields.optional"),
143
+ ")"
144
+ ] }) : null
145
+ ] }),
146
+ /* @__PURE__ */ jsx(
147
+ Textarea,
148
+ {
149
+ placeholder: notePlaceholder,
150
+ value: note,
151
+ onChange: (e) => setNote(e.target.value),
152
+ disabled: isLoading
153
+ }
154
+ )
155
+ ] }) : null,
156
+ /* @__PURE__ */ jsxs(Prompt.Footer, { children: [
157
+ /* @__PURE__ */ jsx(Prompt.Cancel, { disabled: isLoading, children: cancelLabel ?? t("actions.cancel") }),
158
+ /* @__PURE__ */ jsx(
159
+ Prompt.Action,
160
+ {
161
+ onClick: (e) => {
162
+ e.preventDefault();
163
+ void handleConfirm();
164
+ },
165
+ disabled: isLoading,
166
+ children: confirmLabel ?? t("actions.confirm")
167
+ }
168
+ )
169
+ ] })
170
+ ] }) });
171
+ };
172
+
173
+ // src/pages/products/product-detail/components/product-active-edit-section/product-active-edit-section.tsx
174
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
175
+ var VARIANT_LOOKUP_FIELDS = "id,title,sku,*images";
176
+ var ImageStrip = ({
177
+ images,
178
+ faded
179
+ }) => /* @__PURE__ */ jsx2(
180
+ "div",
181
+ {
182
+ className: faded ? "flex items-center gap-1.5 opacity-50" : "flex items-center gap-1.5",
183
+ children: images.map((image, idx) => /* @__PURE__ */ jsx2(Thumbnail, { src: image.url, size: "base" }, `${image.url}-${idx}`))
184
+ }
185
+ );
186
+ var TypeName = ({ id }) => {
187
+ const { product_type } = useProductType(id);
188
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_type?.value ?? id });
189
+ };
190
+ var CollectionName = ({ id }) => {
191
+ const { collection } = useCollection(id);
192
+ return /* @__PURE__ */ jsx2(Fragment2, { children: collection?.title ?? id });
193
+ };
194
+ var CategoryName = ({ id }) => {
195
+ const { product_category } = useProductCategory(id);
196
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_category?.name ?? id });
197
+ };
198
+ var TagName = ({ id }) => {
199
+ const { product_tag } = useProductTag(id);
200
+ return /* @__PURE__ */ jsx2(Fragment2, { children: product_tag?.value ?? id });
201
+ };
202
+ var ReferenceName = ({
203
+ field,
204
+ id
205
+ }) => {
206
+ switch (field) {
207
+ case "type_id":
208
+ return /* @__PURE__ */ jsx2(TypeName, { id });
209
+ case "collection_id":
210
+ return /* @__PURE__ */ jsx2(CollectionName, { id });
211
+ case "categories":
212
+ return /* @__PURE__ */ jsx2(CategoryName, { id });
213
+ case "tags":
214
+ return /* @__PURE__ */ jsx2(TagName, { id });
215
+ }
216
+ };
217
+ var ReferenceList = ({
218
+ field,
219
+ ids
220
+ }) => {
221
+ if (!ids.length) return /* @__PURE__ */ jsx2(Fragment2, { children: "-" });
222
+ return /* @__PURE__ */ jsx2(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs2(Fragment, { children: [
223
+ idx > 0 && ", ",
224
+ /* @__PURE__ */ jsx2(ReferenceName, { field, id })
225
+ ] }, `${field}-${id}`)) });
226
+ };
227
+ var FieldRow = ({ diff }) => {
228
+ const { t } = useTranslation2();
229
+ const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
230
+ const nextIsImages = isImageList(diff.next);
231
+ const previousIsImages = isImageList(diff.previous);
232
+ const renderAsImages = nextIsImages || previousIsImages;
233
+ const renderAsReference = isReferenceField(diff.field);
234
+ return /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4", children: [
235
+ /* @__PURE__ */ jsx2(
236
+ Text,
237
+ {
238
+ size: "small",
239
+ weight: "plus",
240
+ leading: "compact",
241
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
242
+ children: t(`fields.${diff.field}`, {
243
+ defaultValue: humanizeFieldName(diff.field)
244
+ })
245
+ }
246
+ ),
247
+ renderAsImages ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
248
+ hasPrevious && previousIsImages && /* @__PURE__ */ jsx2(ImageStrip, { images: diff.previous, faded: true }),
249
+ hasPrevious && /* @__PURE__ */ jsx2(
250
+ Text,
251
+ {
252
+ size: "small",
253
+ leading: "compact",
254
+ className: "text-ui-fg-subtle",
255
+ children: "\u2192"
256
+ }
257
+ ),
258
+ nextIsImages ? /* @__PURE__ */ jsx2(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx2(
259
+ Text,
260
+ {
261
+ size: "small",
262
+ leading: "compact",
263
+ className: "text-ui-fg-subtle",
264
+ children: formatFieldValue(diff.next, diff.field)
265
+ }
266
+ )
267
+ ] }) : renderAsReference ? /* @__PURE__ */ jsxs2(
268
+ Text,
269
+ {
270
+ size: "small",
271
+ leading: "compact",
272
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
273
+ children: [
274
+ hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: /* @__PURE__ */ jsx2(
275
+ ReferenceList,
276
+ {
277
+ field: diff.field,
278
+ ids: extractReferenceIds(
279
+ diff.field,
280
+ diff.previous
281
+ )
282
+ }
283
+ ) }),
284
+ hasPrevious && " \u2192 ",
285
+ /* @__PURE__ */ jsx2(
286
+ ReferenceList,
287
+ {
288
+ field: diff.field,
289
+ ids: extractReferenceIds(diff.field, diff.next)
290
+ }
291
+ )
292
+ ]
293
+ }
294
+ ) : /* @__PURE__ */ jsxs2(
295
+ Text,
296
+ {
297
+ size: "small",
298
+ leading: "compact",
299
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
300
+ children: [
301
+ hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
302
+ hasPrevious && " \u2192 ",
303
+ formatFieldValue(diff.next, diff.field)
304
+ ]
305
+ }
306
+ )
307
+ ] });
308
+ };
309
+ var AttributeActionLine = ({
310
+ attributeId,
311
+ valueIds
312
+ }) => {
313
+ const { product_attribute } = useProductAttribute(attributeId);
314
+ const name = product_attribute?.name ?? attributeId;
315
+ const values = product_attribute?.values ?? [];
316
+ const selectedNames = valueIds && valueIds.length ? valueIds.map((id) => {
317
+ const match = values.find((v) => v.id === id);
318
+ return match?.name ?? id;
319
+ }) : [];
320
+ return /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
321
+ /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: name }),
322
+ selectedNames.length > 0 && `: ${selectedNames.join(", ")}`
323
+ ] });
324
+ };
325
+ var VariantActionLine = ({
326
+ title,
327
+ images
328
+ }) => /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
329
+ images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
330
+ /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: title }) })
331
+ ] });
332
+ var ActionLine = ({
333
+ action,
334
+ variantsById
335
+ }) => {
336
+ const { t } = useTranslation2();
337
+ const details = action.details ?? {};
338
+ if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
339
+ if (!details.attribute_id) return null;
340
+ return /* @__PURE__ */ jsx2(
341
+ AttributeActionLine,
342
+ {
343
+ attributeId: details.attribute_id,
344
+ valueIds: action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD ? details.attribute_value_ids : void 0
345
+ }
346
+ );
347
+ }
348
+ const variantFallback = t("fields.variant", { defaultValue: "Variant" });
349
+ if (action.action === import_types.ProductChangeActionType.VARIANT_ADD) {
350
+ const title = details.variant?.title || details.variant?.sku || variantFallback;
351
+ return /* @__PURE__ */ jsx2(VariantActionLine, { title });
352
+ }
353
+ if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
354
+ const variantId = details.variant_id ?? "";
355
+ const found = variantId ? variantsById.get(variantId) : void 0;
356
+ const title = found?.title || found?.sku || variantId || variantFallback;
357
+ const images = isImageList(found?.images) ? found?.images : void 0;
358
+ return /* @__PURE__ */ jsx2(VariantActionLine, { title, images });
359
+ }
360
+ const label = describeProductChangeAction(action, {
361
+ variant: variantFallback
362
+ });
363
+ return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
364
+ };
365
+ var VariantUpdateBlock = ({
366
+ variantId,
367
+ diffs,
368
+ variantsById
369
+ }) => {
370
+ const { t } = useTranslation2();
371
+ const found = variantsById.get(variantId);
372
+ const title = found?.title || found?.sku || variantId || t("fields.variant", { defaultValue: "Variant" });
373
+ const images = isImageList(found?.images) ? found?.images : void 0;
374
+ return /* @__PURE__ */ jsxs2(
375
+ "div",
376
+ {
377
+ className: "flex flex-col gap-y-3",
378
+ "data-testid": `product-active-edit-variant-${variantId}`,
379
+ children: [
380
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
381
+ images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
382
+ /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
383
+ /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: t("products.edits.panel.variantUpdated", {
384
+ defaultValue: "Variant updated"
385
+ }) }),
386
+ ": ",
387
+ title
388
+ ] })
389
+ ] }),
390
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-4 pl-1", children: diffs.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${variantId}-${diff.field}-${idx}`)) })
391
+ ]
392
+ }
393
+ );
394
+ };
395
+ var ProductActiveEditSection = ({
396
+ product
397
+ }) => {
398
+ const { t } = useTranslation2();
399
+ const [confirmOpen, setConfirmOpen] = useState2(false);
400
+ const [rejectOpen, setRejectOpen] = useState2(false);
401
+ const { product_change, isError } = useProductChange(product.id, {
402
+ retry: false
403
+ });
404
+ const requesterId = product_change?.created_by ?? "";
405
+ const { seller: requesterSeller } = useSeller(requesterId, void 0, {
406
+ enabled: !!requesterId
407
+ });
408
+ const { mutateAsync: confirmChange, isPending: isConfirming } = useConfirmProductChange(product_change?.id ?? "", product.id);
409
+ const { mutateAsync: cancelChange, isPending: isRejecting } = useCancelProductChange(product_change?.id ?? "", product.id);
410
+ const { updated, added, removed, deleteRequested } = useMemo(
411
+ () => partitionProductChangeActions(product_change?.actions ?? []),
412
+ [product_change]
413
+ );
414
+ const productUpdated = useMemo(
415
+ () => updated.filter((d) => !d.variant_id),
416
+ [updated]
417
+ );
418
+ const variantsUpdated = useMemo(() => {
419
+ const groups = /* @__PURE__ */ new Map();
420
+ for (const diff of updated) {
421
+ if (!diff.variant_id) continue;
422
+ const bucket = groups.get(diff.variant_id) ?? [];
423
+ bucket.push(diff);
424
+ groups.set(diff.variant_id, bucket);
425
+ }
426
+ return groups;
427
+ }, [updated]);
428
+ const attributeIds = useMemo(() => {
429
+ const ids = /* @__PURE__ */ new Set();
430
+ for (const action of [...added, ...removed]) {
431
+ if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
432
+ const details = action.details ?? {};
433
+ if (details.attribute_id) ids.add(details.attribute_id);
434
+ }
435
+ }
436
+ return Array.from(ids);
437
+ }, [added, removed]);
438
+ const attributeQueries = useQueries({
439
+ queries: attributeIds.map((id) => ({
440
+ queryKey: productAttributesQueryKeys.detail(id),
441
+ queryFn: () => sdk.admin.productAttributes.$id.query({ $id: id })
442
+ }))
443
+ });
444
+ const isLoadingAttributes = attributeQueries.some((q) => q.isPending);
445
+ const variantIds = useMemo(() => {
446
+ const ids = /* @__PURE__ */ new Set();
447
+ for (const action of removed) {
448
+ if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
449
+ const details = action.details ?? {};
450
+ if (details.variant_id) ids.add(details.variant_id);
451
+ }
452
+ }
453
+ for (const diff of updated) {
454
+ if (diff.variant_id) ids.add(diff.variant_id);
455
+ }
456
+ return Array.from(ids);
457
+ }, [removed, updated]);
458
+ const variantQueryInput = { fields: VARIANT_LOOKUP_FIELDS };
459
+ const variantQueries = useQueries({
460
+ queries: variantIds.map((variantId) => ({
461
+ queryKey: variantsQueryKeys.detail(variantId, variantQueryInput),
462
+ queryFn: () => sdk.admin.products.$id.variants.$variantId.query({
463
+ $id: product.id,
464
+ $variantId: variantId,
465
+ ...variantQueryInput
466
+ })
467
+ }))
468
+ });
469
+ const isLoadingVariants = variantQueries.some((q) => q.isPending);
470
+ const variantsById = useMemo(() => {
471
+ const map = /* @__PURE__ */ new Map();
472
+ for (const query of variantQueries) {
473
+ const variant = query.data?.variant;
474
+ if (variant?.id) map.set(variant.id, variant);
475
+ }
476
+ return map;
477
+ }, [variantQueries]);
478
+ if (isError || !product_change) {
479
+ return null;
480
+ }
481
+ if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
482
+ return null;
483
+ }
484
+ if (isLoadingAttributes || isLoadingVariants) {
485
+ return null;
486
+ }
487
+ const hasContent = productUpdated.length > 0 || variantsUpdated.size > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
488
+ const handleConfirm = async (note) => {
489
+ try {
490
+ await confirmChange({ internal_note: note });
491
+ toast.success(t("products.edits.toast.confirmedSuccessfully"));
492
+ setConfirmOpen(false);
493
+ } catch (e) {
494
+ toast.error(e.message);
495
+ }
496
+ };
497
+ const handleReject = async (note) => {
498
+ try {
499
+ await cancelChange({ internal_note: note });
500
+ toast.success(t("products.edits.toast.rejectedSuccessfully"));
501
+ setRejectOpen(false);
502
+ } catch (e) {
503
+ toast.error(e.message);
504
+ }
505
+ };
506
+ return /* @__PURE__ */ jsxs2(
507
+ Container,
508
+ {
509
+ className: "divide-y p-0",
510
+ "data-testid": "product-active-edit-section",
511
+ children: [
512
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 px-6 py-4", children: [
513
+ /* @__PURE__ */ jsx2(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
514
+ /* @__PURE__ */ jsx2(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
515
+ ] }),
516
+ /* @__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", {
517
+ store: requesterSeller?.name ?? t("products.request.fallbackStore")
518
+ }) }) }),
519
+ hasContent && /* @__PURE__ */ jsxs2(Fragment2, { children: [
520
+ productUpdated.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
521
+ /* @__PURE__ */ jsx2(
522
+ Text,
523
+ {
524
+ size: "small",
525
+ weight: "plus",
526
+ leading: "compact",
527
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
528
+ children: t("labels.updated")
529
+ }
530
+ ),
531
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-4", children: productUpdated.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${diff.field}-${idx}`)) })
532
+ ] }),
533
+ variantsUpdated.size > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
534
+ /* @__PURE__ */ jsx2(
535
+ Text,
536
+ {
537
+ size: "small",
538
+ weight: "plus",
539
+ leading: "compact",
540
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
541
+ children: t("labels.updated")
542
+ }
543
+ ),
544
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-6", children: Array.from(variantsUpdated.entries()).map(
545
+ ([variantId, diffs]) => /* @__PURE__ */ jsx2(
546
+ VariantUpdateBlock,
547
+ {
548
+ variantId,
549
+ diffs,
550
+ variantsById
551
+ },
552
+ variantId
553
+ )
554
+ ) })
555
+ ] }),
556
+ added.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
557
+ /* @__PURE__ */ jsx2(
558
+ Text,
559
+ {
560
+ size: "small",
561
+ weight: "plus",
562
+ leading: "compact",
563
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
564
+ children: t("labels.added")
565
+ }
566
+ ),
567
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx2(
568
+ ActionLine,
569
+ {
570
+ action,
571
+ variantsById
572
+ },
573
+ action.id
574
+ )) })
575
+ ] }),
576
+ removed.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
577
+ /* @__PURE__ */ jsx2(
578
+ Text,
579
+ {
580
+ size: "small",
581
+ weight: "plus",
582
+ leading: "compact",
583
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
584
+ children: t("labels.removed")
585
+ }
586
+ ),
587
+ /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx2(
588
+ ActionLine,
589
+ {
590
+ action,
591
+ variantsById
592
+ },
593
+ action.id
594
+ )) })
595
+ ] }),
596
+ deleteRequested && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
597
+ /* @__PURE__ */ jsx2(
598
+ Text,
599
+ {
600
+ size: "small",
601
+ weight: "plus",
602
+ leading: "compact",
603
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
604
+ children: t("labels.removed")
605
+ }
606
+ ),
607
+ /* @__PURE__ */ jsx2(
608
+ Text,
609
+ {
610
+ size: "small",
611
+ leading: "compact",
612
+ className: "text-ui-fg-subtle flex-1",
613
+ children: t("products.edits.panel.deleteRequested")
614
+ }
615
+ )
616
+ ] })
617
+ ] }),
618
+ /* @__PURE__ */ jsxs2(
619
+ "div",
620
+ {
621
+ className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
622
+ "data-testid": "product-active-edit-actions",
623
+ children: [
624
+ /* @__PURE__ */ jsx2(
625
+ Button,
626
+ {
627
+ size: "small",
628
+ variant: "secondary",
629
+ onClick: () => setConfirmOpen(true),
630
+ "data-testid": "product-active-edit-confirm-button",
631
+ children: t("actions.confirm")
632
+ }
633
+ ),
634
+ /* @__PURE__ */ jsx2(
635
+ Button,
636
+ {
637
+ size: "small",
638
+ variant: "secondary",
639
+ onClick: () => setRejectOpen(true),
640
+ "data-testid": "product-active-edit-reject-button",
641
+ children: t("products.edits.actions.reject")
642
+ }
643
+ )
644
+ ]
645
+ }
646
+ ),
647
+ /* @__PURE__ */ jsx2(
648
+ ConfirmPrompt,
649
+ {
650
+ open: confirmOpen,
651
+ onOpenChange: setConfirmOpen,
652
+ title: t("products.edits.confirmPrompt.title"),
653
+ description: t("products.edits.confirmPrompt.description"),
654
+ noteLabel: t("products.edits.confirmPrompt.noteLabel"),
655
+ noteOptional: true,
656
+ notePlaceholder: t("products.edits.confirmPrompt.notePlaceholder"),
657
+ isLoading: isConfirming,
658
+ onConfirm: handleConfirm
659
+ }
660
+ ),
661
+ /* @__PURE__ */ jsx2(
662
+ ConfirmPrompt,
663
+ {
664
+ open: rejectOpen,
665
+ onOpenChange: setRejectOpen,
666
+ title: t("products.edits.rejectPrompt.title"),
667
+ description: t("products.edits.rejectPrompt.description"),
668
+ noteLabel: t("products.edits.rejectPrompt.noteLabel"),
669
+ noteOptional: true,
670
+ notePlaceholder: t("products.edits.rejectPrompt.notePlaceholder"),
671
+ confirmLabel: t("products.edits.rejectPrompt.confirm"),
672
+ isLoading: isRejecting,
673
+ onConfirm: handleReject
674
+ }
675
+ )
676
+ ]
677
+ }
678
+ );
679
+ };
680
+
681
+ // src/pages/products/product-detail/components/product-active-request-section/product-active-request-section.tsx
682
+ var import_types2 = __toESM(require_dist(), 1);
683
+ import { useState as useState3 } from "react";
684
+ import { Button as Button2, Container as Container2, Heading as Heading2, Text as Text2, toast as toast2 } from "@medusajs/ui";
685
+ import { ExclamationCircleSolid as ExclamationCircleSolid2 } from "@medusajs/icons";
686
+ import { useTranslation as useTranslation3 } from "react-i18next";
687
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
688
+ var ProductActiveRequestSection = ({
689
+ product
690
+ }) => {
691
+ const { t } = useTranslation3();
692
+ const [confirmOpen, setConfirmOpen] = useState3(false);
693
+ const [requestUpdateOpen, setRequestUpdateOpen] = useState3(false);
694
+ const [rejectOpen, setRejectOpen] = useState3(false);
695
+ const { mutateAsync: confirmProduct, isPending: isConfirming } = useConfirmProduct(product.id);
696
+ const { mutateAsync: requestProductChanges, isPending: isRequestingUpdate } = useRequestProductChanges(product.id);
697
+ const { mutateAsync: rejectProduct, isPending: isRejecting } = useRejectProduct(product.id);
698
+ if (product.status !== import_types2.ProductStatus.PROPOSED) {
699
+ return null;
700
+ }
701
+ const handleConfirm = async (note) => {
702
+ try {
703
+ await confirmProduct({ internal_note: note });
704
+ toast2.success(t("products.request.toast.publishedSuccessfully"));
705
+ setConfirmOpen(false);
706
+ } catch (e) {
707
+ toast2.error(e.message);
708
+ }
709
+ };
710
+ const handleRequestUpdate = async (note) => {
711
+ try {
712
+ await requestProductChanges({ message: note });
713
+ toast2.success(t("products.request.toast.updateRequestedSuccessfully"));
714
+ setRequestUpdateOpen(false);
715
+ } catch (e) {
716
+ toast2.error(e.message);
717
+ }
718
+ };
719
+ const handleReject = async (note) => {
720
+ try {
721
+ await rejectProduct({ message: note });
722
+ toast2.success(t("products.request.toast.rejectedSuccessfully"));
723
+ setRejectOpen(false);
724
+ } catch (e) {
725
+ toast2.error(e.message);
726
+ }
727
+ };
728
+ return /* @__PURE__ */ jsxs3(
729
+ Container2,
730
+ {
731
+ className: "divide-y p-0",
732
+ "data-testid": "product-active-request-section",
733
+ children: [
734
+ /* @__PURE__ */ jsxs3(
735
+ "div",
736
+ {
737
+ className: "flex items-center gap-2 px-6 py-4",
738
+ "data-testid": "product-active-request-header",
739
+ children: [
740
+ /* @__PURE__ */ jsx3(ExclamationCircleSolid2, { className: "text-ui-fg-interactive" }),
741
+ /* @__PURE__ */ jsx3(Heading2, { level: "h2", "data-testid": "product-active-request-heading", children: t("products.request.panel.title") })
742
+ ]
743
+ }
744
+ ),
745
+ /* @__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", {
746
+ store: product.sellers?.[0]?.name ?? t("products.request.fallbackStore")
747
+ }) }) }),
748
+ /* @__PURE__ */ jsxs3(
749
+ "div",
750
+ {
751
+ className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
752
+ "data-testid": "product-active-request-actions",
753
+ children: [
754
+ /* @__PURE__ */ jsx3(
755
+ Button2,
756
+ {
757
+ size: "small",
758
+ variant: "secondary",
759
+ onClick: () => setConfirmOpen(true),
760
+ "data-testid": "product-active-request-confirm-button",
761
+ children: t("actions.confirm")
762
+ }
763
+ ),
764
+ /* @__PURE__ */ jsx3(
765
+ Button2,
766
+ {
767
+ size: "small",
768
+ variant: "secondary",
769
+ onClick: () => setRequestUpdateOpen(true),
770
+ "data-testid": "product-active-request-request-update-button",
771
+ children: t("products.request.actions.requestUpdate")
772
+ }
773
+ ),
774
+ /* @__PURE__ */ jsx3(
775
+ Button2,
776
+ {
777
+ size: "small",
778
+ variant: "secondary",
779
+ onClick: () => setRejectOpen(true),
780
+ "data-testid": "product-active-request-reject-button",
781
+ children: t("products.request.actions.reject")
782
+ }
783
+ )
784
+ ]
785
+ }
786
+ ),
787
+ /* @__PURE__ */ jsx3(
788
+ ConfirmPrompt,
789
+ {
790
+ open: confirmOpen,
791
+ onOpenChange: setConfirmOpen,
792
+ title: t("products.request.confirmPrompt.title"),
793
+ description: t("products.request.confirmPrompt.description"),
794
+ noteLabel: t("products.request.confirmPrompt.noteLabel"),
795
+ noteOptional: true,
796
+ notePlaceholder: t("products.request.confirmPrompt.notePlaceholder"),
797
+ isLoading: isConfirming,
798
+ onConfirm: handleConfirm
799
+ }
800
+ ),
801
+ /* @__PURE__ */ jsx3(
802
+ ConfirmPrompt,
803
+ {
804
+ open: requestUpdateOpen,
805
+ onOpenChange: setRequestUpdateOpen,
806
+ title: t("products.request.requestUpdatePrompt.title"),
807
+ description: t("products.request.requestUpdatePrompt.description"),
808
+ noteLabel: t("products.request.requestUpdatePrompt.noteLabel"),
809
+ noteOptional: true,
810
+ notePlaceholder: t(
811
+ "products.request.requestUpdatePrompt.notePlaceholder"
812
+ ),
813
+ confirmLabel: t("products.request.requestUpdatePrompt.send"),
814
+ isLoading: isRequestingUpdate,
815
+ onConfirm: handleRequestUpdate
816
+ }
817
+ ),
818
+ /* @__PURE__ */ jsx3(
819
+ ConfirmPrompt,
820
+ {
821
+ open: rejectOpen,
822
+ onOpenChange: setRejectOpen,
823
+ title: t("products.request.rejectPrompt.title"),
824
+ description: t("products.request.rejectPrompt.description"),
825
+ noteLabel: t("products.request.rejectPrompt.noteLabel"),
826
+ noteOptional: true,
827
+ notePlaceholder: t("products.request.rejectPrompt.notePlaceholder"),
828
+ confirmLabel: t("products.request.rejectPrompt.confirm"),
829
+ isLoading: isRejecting,
830
+ onConfirm: handleReject
831
+ }
832
+ )
833
+ ]
834
+ }
835
+ );
836
+ };
837
+
838
+ // src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
839
+ import {
840
+ ListBullet,
841
+ Plus,
842
+ Trash,
843
+ Swatch,
844
+ DropCap,
845
+ InformationCircleSolid,
846
+ PencilSquare
847
+ } from "@medusajs/icons";
848
+ import {
849
+ Badge,
850
+ Container as Container3,
851
+ Heading as Heading3,
852
+ Text as Text3,
853
+ toast as toast3,
854
+ Tooltip,
855
+ usePrompt
856
+ } from "@medusajs/ui";
857
+ import { useTranslation as useTranslation4 } from "react-i18next";
858
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
859
+ var AttributeActions = ({
860
+ productId,
861
+ attribute
862
+ }) => {
863
+ const { t } = useTranslation4();
864
+ const prompt = usePrompt();
865
+ const { mutateAsync } = useRemoveAttributeFromProduct(productId, attribute.id);
866
+ const handleDelete = async () => {
867
+ const res = await prompt({
868
+ title: t("general.areYouSure"),
869
+ description: t("products.deleteAttributeWarning", {
870
+ title: attribute.name
871
+ }),
872
+ confirmText: t("actions.delete"),
873
+ cancelText: t("actions.cancel")
874
+ });
875
+ if (!res) {
876
+ return;
877
+ }
878
+ await mutateAsync(void 0, {
879
+ onError: (error) => {
880
+ toast3.error(error.message);
881
+ }
882
+ });
883
+ };
884
+ return /* @__PURE__ */ jsx4(
885
+ ActionMenu,
886
+ {
887
+ groups: [
888
+ {
889
+ actions: [
890
+ {
891
+ label: t("actions.edit"),
892
+ to: `attributes/${attribute.id}/edit`,
893
+ icon: /* @__PURE__ */ jsx4(PencilSquare, {})
894
+ }
895
+ ]
896
+ },
897
+ {
898
+ actions: [
899
+ {
900
+ label: t("actions.delete"),
901
+ onClick: handleDelete,
902
+ icon: /* @__PURE__ */ jsx4(Trash, {}),
903
+ disabled: attribute.is_required,
904
+ disabledTooltip: attribute.is_required ? t("products.attributeRequiredDeleteDisabledTooltip") : void 0
905
+ }
906
+ ]
907
+ }
908
+ ]
909
+ }
910
+ );
911
+ };
912
+ var AttributeGroup = ({
913
+ icon,
914
+ title,
915
+ description,
916
+ attributes,
917
+ productId
918
+ }) => {
919
+ const { t } = useTranslation4();
920
+ if (!attributes.length) {
921
+ return null;
922
+ }
923
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
924
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-3 px-3", children: [
925
+ /* @__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 }),
926
+ /* @__PURE__ */ jsxs4("div", { children: [
927
+ /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
928
+ /* @__PURE__ */ jsx4(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
929
+ ] })
930
+ ] }),
931
+ /* @__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) => {
932
+ const values = attr.values?.map((v) => v.name) ?? [];
933
+ return /* @__PURE__ */ jsx4(
934
+ "div",
935
+ {
936
+ className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
937
+ children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 px-4 py-3 bg-ui-bg-component", children: [
938
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
939
+ /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
940
+ attr.description && /* @__PURE__ */ jsx4(Tooltip, { content: attr.description, children: /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx4(InformationCircleSolid, {}) }) }),
941
+ 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, {}) }) })
942
+ ] }),
943
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx4(
944
+ Badge,
945
+ {
946
+ size: "2xsmall",
947
+ className: "flex min-w-[20px] items-center justify-center",
948
+ children: val
949
+ },
950
+ val
951
+ )) : /* @__PURE__ */ jsx4(
952
+ Text3,
953
+ {
954
+ size: "small",
955
+ leading: "compact",
956
+ className: "text-ui-fg-subtle",
957
+ children: values.join(", ") || "-"
958
+ }
959
+ ) }),
960
+ /* @__PURE__ */ jsx4(AttributeActions, { productId, attribute: attr })
961
+ ] })
962
+ },
963
+ attr.id
964
+ );
965
+ }) }) })
966
+ ] });
967
+ };
968
+ var ProductAttributeSection = ({
969
+ product
970
+ }) => {
971
+ const { t } = useTranslation4();
972
+ const allAttributes = product.attributes ?? [];
973
+ const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
974
+ const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
975
+ const isEmpty = !variantAttributes.length && !infoAttributes.length;
976
+ return /* @__PURE__ */ jsxs4(Container3, { className: "p-0", children: [
977
+ /* @__PURE__ */ jsxs4(
978
+ "div",
979
+ {
980
+ className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
981
+ children: [
982
+ /* @__PURE__ */ jsx4(Heading3, { level: "h2", children: t("products.attributes") }),
983
+ /* @__PURE__ */ jsx4(
984
+ ActionMenu,
985
+ {
986
+ groups: [
987
+ {
988
+ actions: [
989
+ {
990
+ label: t("products.create.attributes.addExisting"),
991
+ to: "attributes/add",
992
+ icon: /* @__PURE__ */ jsx4(ListBullet, {})
993
+ },
994
+ {
995
+ label: t("products.create.attributes.createNew"),
996
+ to: "attributes/create",
997
+ icon: /* @__PURE__ */ jsx4(Plus, {})
998
+ }
999
+ ]
1000
+ }
1001
+ ]
1002
+ }
1003
+ )
1004
+ ]
1005
+ }
1006
+ ),
1007
+ variantAttributes.length > 0 && /* @__PURE__ */ jsx4(
1008
+ AttributeGroup,
1009
+ {
1010
+ icon: /* @__PURE__ */ jsx4(Swatch, {}),
1011
+ title: t("products.create.tabs.variants"),
1012
+ description: t("products.attributeVariantsDescription"),
1013
+ attributes: variantAttributes,
1014
+ productId: product.id
1015
+ }
1016
+ ),
1017
+ variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx4("div", { className: "border-t border-dashed border-ui-border-base" }),
1018
+ infoAttributes.length > 0 && /* @__PURE__ */ jsx4(
1019
+ AttributeGroup,
1020
+ {
1021
+ icon: /* @__PURE__ */ jsx4(DropCap, {}),
1022
+ title: t("products.attributeProductInformation"),
1023
+ description: t("products.attributeProductInformationDescription"),
1024
+ attributes: infoAttributes,
1025
+ productId: product.id
1026
+ }
1027
+ )
1028
+ ] });
1029
+ };
1030
+
1031
+ // src/pages/products/product-detail/components/product-general-section/product-general-section.tsx
1032
+ import { PencilSquare as PencilSquare2, Trash as Trash2 } from "@medusajs/icons";
1033
+ import { Container as Container4, Heading as Heading4, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
1034
+ import { useTranslation as useTranslation5 } from "react-i18next";
1035
+ import { useNavigate } from "react-router-dom";
1036
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1037
+ var productStatusColor = (status) => {
1038
+ switch (status) {
1039
+ case "draft":
1040
+ return "grey";
1041
+ case "proposed":
1042
+ return "orange";
1043
+ case "published":
1044
+ return "green";
1045
+ case "rejected":
1046
+ return "red";
1047
+ default:
1048
+ return "grey";
1049
+ }
1050
+ };
1051
+ var ProductGeneralSection = ({
1052
+ product
1053
+ }) => {
1054
+ const { t } = useTranslation5();
1055
+ const prompt = usePrompt2();
1056
+ const navigate = useNavigate();
1057
+ const { mutateAsync } = useDeleteProduct(product.id);
1058
+ const handleDelete = async () => {
1059
+ const res = await prompt({
1060
+ title: t("general.areYouSure"),
1061
+ description: t("products.deleteWarning", {
1062
+ title: product.title
1063
+ }),
1064
+ confirmText: t("actions.delete"),
1065
+ cancelText: t("actions.cancel")
1066
+ });
1067
+ if (!res) {
1068
+ return;
1069
+ }
1070
+ await mutateAsync(void 0, {
1071
+ onSuccess: () => {
1072
+ navigate("..");
1073
+ }
1074
+ });
1075
+ };
1076
+ return /* @__PURE__ */ jsxs5(Container4, { className: "divide-y p-0", "data-testid": "product-general-section", children: [
1077
+ /* @__PURE__ */ jsxs5(
1078
+ "div",
1079
+ {
1080
+ className: "flex items-center justify-between px-6 py-4",
1081
+ "data-testid": "product-general-header",
1082
+ children: [
1083
+ /* @__PURE__ */ jsx5(Heading4, { "data-testid": "product-general-title", children: product.title }),
1084
+ /* @__PURE__ */ jsxs5(
1085
+ "div",
1086
+ {
1087
+ className: "flex items-center gap-x-4",
1088
+ "data-testid": "product-general-actions",
1089
+ children: [
1090
+ /* @__PURE__ */ jsx5(
1091
+ StatusBadge,
1092
+ {
1093
+ color: productStatusColor(product.status),
1094
+ "data-testid": "product-status-badge",
1095
+ children: t(`products.productStatus.${product.status}`)
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ jsx5(
1099
+ ActionMenu,
1100
+ {
1101
+ groups: [
1102
+ {
1103
+ actions: [
1104
+ {
1105
+ label: t("actions.edit"),
1106
+ to: "edit",
1107
+ icon: /* @__PURE__ */ jsx5(PencilSquare2, {})
1108
+ }
1109
+ ]
1110
+ },
1111
+ {
1112
+ actions: [
1113
+ {
1114
+ label: t("actions.delete"),
1115
+ onClick: handleDelete,
1116
+ icon: /* @__PURE__ */ jsx5(Trash2, {})
1117
+ }
1118
+ ]
1119
+ }
1120
+ ],
1121
+ "data-testid": "product-general-action-menu"
1122
+ }
1123
+ )
1124
+ ]
1125
+ }
1126
+ )
1127
+ ]
1128
+ }
1129
+ ),
1130
+ /* @__PURE__ */ jsx5(
1131
+ SectionRow,
1132
+ {
1133
+ title: t("fields.description"),
1134
+ value: product.description,
1135
+ "data-testid": "product-description-row"
1136
+ }
1137
+ ),
1138
+ /* @__PURE__ */ jsx5(
1139
+ SectionRow,
1140
+ {
1141
+ title: t("fields.subtitle"),
1142
+ value: product.subtitle,
1143
+ "data-testid": "product-subtitle-row"
1144
+ }
1145
+ ),
1146
+ /* @__PURE__ */ jsx5(
1147
+ SectionRow,
1148
+ {
1149
+ title: t("fields.handle"),
1150
+ value: `/${product.handle}`,
1151
+ "data-testid": "product-handle-row"
1152
+ }
1153
+ ),
1154
+ /* @__PURE__ */ jsx5(
1155
+ SectionRow,
1156
+ {
1157
+ title: t("fields.discountable"),
1158
+ value: product.discountable ? t("fields.true") : t("fields.false"),
1159
+ "data-testid": "product-discountable-row"
1160
+ }
1161
+ )
1162
+ ] });
1163
+ };
1164
+
1165
+ // src/pages/products/product-detail/components/product-media-section/product-media-section.tsx
1166
+ import { PencilSquare as PencilSquare3, ThumbnailBadge } from "@medusajs/icons";
1167
+ import {
1168
+ Button as Button3,
1169
+ Checkbox,
1170
+ CommandBar,
1171
+ Container as Container5,
1172
+ Heading as Heading5,
1173
+ Text as Text4,
1174
+ Tooltip as Tooltip2,
1175
+ clx,
1176
+ usePrompt as usePrompt3
1177
+ } from "@medusajs/ui";
1178
+ import { useState as useState4 } from "react";
1179
+ import { useTranslation as useTranslation6 } from "react-i18next";
1180
+ import { Link } from "react-router-dom";
1181
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1182
+ var ProductMediaSection = ({
1183
+ product
1184
+ }) => {
1185
+ const { t } = useTranslation6();
1186
+ const prompt = usePrompt3();
1187
+ const [selection, setSelection] = useState4({});
1188
+ const media = getMedia(product);
1189
+ const handleCheckedChange = (id) => {
1190
+ setSelection((prev) => {
1191
+ if (prev[id]) {
1192
+ const { [id]: _, ...rest } = prev;
1193
+ return rest;
1194
+ } else {
1195
+ return { ...prev, [id]: true };
1196
+ }
1197
+ });
1198
+ };
1199
+ const { mutateAsync } = useUpdateProduct(product.id);
1200
+ const handleDelete = async () => {
1201
+ const ids = Object.keys(selection);
1202
+ const includingThumbnail = ids.some(
1203
+ (id) => media.find((m) => m.id === id)?.isThumbnail
1204
+ );
1205
+ const res = await prompt({
1206
+ title: t("general.areYouSure"),
1207
+ description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
1208
+ count: ids.length
1209
+ }) : t("products.media.deleteWarning", {
1210
+ count: ids.length
1211
+ }),
1212
+ confirmText: t("actions.delete"),
1213
+ cancelText: t("actions.cancel")
1214
+ });
1215
+ if (!res) {
1216
+ return;
1217
+ }
1218
+ const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
1219
+ await mutateAsync(
1220
+ {
1221
+ images: mediaToKeep,
1222
+ thumbnail: includingThumbnail ? "" : void 0
1223
+ },
1224
+ {
1225
+ onSuccess: () => {
1226
+ setSelection({});
1227
+ }
1228
+ }
1229
+ );
1230
+ };
1231
+ return /* @__PURE__ */ jsxs6(Container5, { className: "divide-y p-0", "data-testid": "product-media-section", children: [
1232
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-media-header", children: [
1233
+ /* @__PURE__ */ jsx6(Heading5, { level: "h2", "data-testid": "product-media-title", children: t("products.media.label") }),
1234
+ /* @__PURE__ */ jsx6(
1235
+ ActionMenu,
1236
+ {
1237
+ groups: [
1238
+ {
1239
+ actions: [
1240
+ {
1241
+ label: t("actions.edit"),
1242
+ to: "media?view=edit",
1243
+ icon: /* @__PURE__ */ jsx6(PencilSquare3, {})
1244
+ }
1245
+ ]
1246
+ }
1247
+ ],
1248
+ "data-testid": "product-media-action-menu"
1249
+ }
1250
+ )
1251
+ ] }),
1252
+ 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) => {
1253
+ const isSelected = selection[i.id];
1254
+ return /* @__PURE__ */ jsxs6(
1255
+ "div",
1256
+ {
1257
+ className: "shadow-elevation-card-rest hover:shadow-elevation-card-hover transition-fg group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px]",
1258
+ "data-testid": `product-media-item-${i.id}`,
1259
+ children: [
1260
+ /* @__PURE__ */ jsx6(
1261
+ "div",
1262
+ {
1263
+ className: clx(
1264
+ "transition-fg invisible absolute right-2 top-2 opacity-0 group-hover:visible group-hover:opacity-100",
1265
+ {
1266
+ "visible opacity-100": isSelected
1267
+ }
1268
+ ),
1269
+ "data-testid": `product-media-checkbox-container-${i.id}`,
1270
+ children: /* @__PURE__ */ jsx6(
1271
+ Checkbox,
1272
+ {
1273
+ checked: selection[i.id] || false,
1274
+ onCheckedChange: () => handleCheckedChange(i.id),
1275
+ "data-testid": `product-media-checkbox-${i.id}`
1276
+ }
1277
+ )
1278
+ }
1279
+ ),
1280
+ 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, {}) }) }),
1281
+ /* @__PURE__ */ jsx6(Link, { to: `media`, state: { curr: index }, "data-testid": `product-media-link-${i.id}`, children: /* @__PURE__ */ jsx6(
1282
+ "img",
1283
+ {
1284
+ src: i.url,
1285
+ alt: product.title,
1286
+ className: "size-full object-cover",
1287
+ "data-testid": `product-media-image-${i.id}`
1288
+ }
1289
+ ) })
1290
+ ]
1291
+ },
1292
+ i.id
1293
+ );
1294
+ }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", "data-testid": "product-media-empty-state", children: [
1295
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center", children: [
1296
+ /* @__PURE__ */ jsx6(
1297
+ Text4,
1298
+ {
1299
+ size: "small",
1300
+ leading: "compact",
1301
+ weight: "plus",
1302
+ className: "text-ui-fg-subtle",
1303
+ "data-testid": "product-media-empty-state-header",
1304
+ children: t("products.media.emptyState.header")
1305
+ }
1306
+ ),
1307
+ /* @__PURE__ */ jsx6(Text4, { size: "small", className: "text-ui-fg-muted", "data-testid": "product-media-empty-state-description", children: t("products.media.emptyState.description") })
1308
+ ] }),
1309
+ /* @__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") }) })
1310
+ ] }),
1311
+ /* @__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: [
1312
+ /* @__PURE__ */ jsx6(CommandBar.Value, { "data-testid": "product-media-command-bar-value", children: t("general.countSelected", {
1313
+ count: Object.keys(selection).length
1314
+ }) }),
1315
+ /* @__PURE__ */ jsx6(CommandBar.Seperator, { "data-testid": "product-media-command-bar-separator" }),
1316
+ /* @__PURE__ */ jsx6(
1317
+ CommandBar.Command,
1318
+ {
1319
+ action: handleDelete,
1320
+ label: t("actions.delete"),
1321
+ shortcut: "d",
1322
+ "data-testid": "product-media-command-bar-delete"
1323
+ }
1324
+ )
1325
+ ] }) })
1326
+ ] });
1327
+ };
1328
+ var getMedia = (product) => {
1329
+ const { images = [], thumbnail } = product;
1330
+ const media = images.map((image) => ({
1331
+ id: image.id,
1332
+ url: image.url,
1333
+ isThumbnail: image.url === thumbnail
1334
+ }));
1335
+ if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
1336
+ media.unshift({
1337
+ id: "img_thumbnail",
1338
+ url: thumbnail,
1339
+ isThumbnail: true
1340
+ });
1341
+ }
1342
+ return media;
1343
+ };
1344
+
1345
+ // src/pages/products/product-detail/components/product-organization-section/product-organization-section.tsx
1346
+ import { PencilSquare as PencilSquare4 } from "@medusajs/icons";
1347
+ import { Badge as Badge2, Container as Container6, Heading as Heading6, Tooltip as Tooltip3 } from "@medusajs/ui";
1348
+ import { useTranslation as useTranslation7 } from "react-i18next";
1349
+ import { Link as Link2 } from "react-router-dom";
1350
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1351
+ var ProductOrganizationSection = ({
1352
+ product
1353
+ }) => {
1354
+ const { t } = useTranslation7();
1355
+ return /* @__PURE__ */ jsxs7(
1356
+ Container6,
1357
+ {
1358
+ className: "divide-y p-0",
1359
+ "data-testid": "product-organization-section",
1360
+ children: [
1361
+ /* @__PURE__ */ jsxs7(
1362
+ "div",
1363
+ {
1364
+ className: "flex items-center justify-between px-6 py-4",
1365
+ "data-testid": "product-organization-header",
1366
+ children: [
1367
+ /* @__PURE__ */ jsx7(Heading6, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
1368
+ /* @__PURE__ */ jsx7(
1369
+ ActionMenu,
1370
+ {
1371
+ groups: [
1372
+ {
1373
+ actions: [
1374
+ {
1375
+ label: t("actions.edit"),
1376
+ to: "organization",
1377
+ icon: /* @__PURE__ */ jsx7(PencilSquare4, {})
1378
+ }
1379
+ ]
1380
+ }
1381
+ ],
1382
+ "data-testid": "product-organization-action-menu"
1383
+ }
1384
+ )
1385
+ ]
1386
+ }
1387
+ ),
1388
+ /* @__PURE__ */ jsx7(
1389
+ SectionRow,
1390
+ {
1391
+ title: t("fields.tags"),
1392
+ value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx7(
1393
+ OrganizationTag,
1394
+ {
1395
+ label: tag.value,
1396
+ to: `/settings/product-tags/${tag.id}`
1397
+ },
1398
+ tag.id
1399
+ )) : void 0,
1400
+ "data-testid": "product-tags-row"
1401
+ }
1402
+ ),
1403
+ /* @__PURE__ */ jsx7(
1404
+ SectionRow,
1405
+ {
1406
+ title: t("fields.type"),
1407
+ value: product.type ? /* @__PURE__ */ jsx7(
1408
+ OrganizationTag,
1409
+ {
1410
+ label: product.type.value,
1411
+ to: `/settings/product-types/${product.type_id}`
1412
+ }
1413
+ ) : void 0,
1414
+ "data-testid": "product-type-row"
1415
+ }
1416
+ ),
1417
+ /* @__PURE__ */ jsx7(
1418
+ SectionRow,
1419
+ {
1420
+ title: t("fields.collection"),
1421
+ value: product.collection ? /* @__PURE__ */ jsx7(
1422
+ OrganizationTag,
1423
+ {
1424
+ label: product.collection.title,
1425
+ to: `/collections/${product.collection.id}`
1426
+ }
1427
+ ) : void 0,
1428
+ "data-testid": "product-collection-row"
1429
+ }
1430
+ ),
1431
+ /* @__PURE__ */ jsx7(
1432
+ SectionRow,
1433
+ {
1434
+ title: t("fields.categories"),
1435
+ value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx7(
1436
+ OrganizationTag,
1437
+ {
1438
+ label: pcat.name,
1439
+ to: `/categories/${pcat.id}`
1440
+ },
1441
+ pcat.id
1442
+ )) : void 0,
1443
+ "data-testid": "product-categories-row"
1444
+ }
1445
+ )
1446
+ ]
1447
+ }
1448
+ );
1449
+ };
1450
+ var OrganizationTag = ({ label, to }) => {
1451
+ return /* @__PURE__ */ jsx7(Tooltip3, { content: label, children: /* @__PURE__ */ jsx7(Badge2, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx7(
1452
+ Link2,
1453
+ {
1454
+ to,
1455
+ "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
1456
+ children: label
1457
+ }
1458
+ ) }) });
1459
+ };
1460
+
1461
+ // src/pages/products/product-detail/components/product-variant-section/product-variant-section.tsx
1462
+ import { useCallback, useMemo as useMemo2 } from "react";
1463
+ import { PencilSquare as PencilSquare5, Trash as Trash3 } from "@medusajs/icons";
1464
+ import {
1465
+ Badge as Badge3,
1466
+ Button as Button4,
1467
+ Container as Container7,
1468
+ createDataTableColumnHelper,
1469
+ Heading as Heading7,
1470
+ Tooltip as Tooltip4,
1471
+ usePrompt as usePrompt4
1472
+ } from "@medusajs/ui";
1473
+ import { keepPreviousData } from "@tanstack/react-query";
1474
+ import { useTranslation as useTranslation8 } from "react-i18next";
1475
+ import { Link as Link3, useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1476
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1477
+ var PAGE_SIZE = 10;
1478
+ var PREFIX = "pv";
1479
+ var ProductVariantSection = ({
1480
+ product
1481
+ }) => {
1482
+ const { t } = useTranslation8();
1483
+ const { q, order, offset, created_at, updated_at } = useQueryParams(
1484
+ ["q", "order", "offset", "created_at", "updated_at"],
1485
+ PREFIX
1486
+ );
1487
+ const columns = useColumns(product);
1488
+ const filters = useFilters();
1489
+ const { variants, count, isPending, isError, error } = useProductVariants(
1490
+ product.id,
1491
+ {
1492
+ q,
1493
+ order: order ? order : "variant_rank",
1494
+ offset: offset ? parseInt(offset) : void 0,
1495
+ limit: PAGE_SIZE,
1496
+ created_at: created_at ? JSON.parse(created_at) : void 0,
1497
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
1498
+ fields: "title,sku,created_at,updated_at,*options,*options.option"
1499
+ },
1500
+ {
1501
+ placeholderData: keepPreviousData
1502
+ }
1503
+ );
1504
+ if (isError) {
1505
+ throw error;
1506
+ }
1507
+ return /* @__PURE__ */ jsxs8(Container7, { className: "divide-y p-0", "data-testid": "product-variant-section", children: [
1508
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-6 py-4", children: [
1509
+ /* @__PURE__ */ jsx8(Heading7, { level: "h2", children: t("products.variants.header") }),
1510
+ /* @__PURE__ */ jsx8(
1511
+ Button4,
1512
+ {
1513
+ size: "small",
1514
+ variant: "secondary",
1515
+ asChild: true,
1516
+ "data-testid": "product-variants-create-button",
1517
+ children: /* @__PURE__ */ jsx8(Link3, { to: "variants/create", children: t("actions.create") })
1518
+ }
1519
+ )
1520
+ ] }),
1521
+ /* @__PURE__ */ jsx8("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx8(
1522
+ DataTable,
1523
+ {
1524
+ data: variants,
1525
+ columns,
1526
+ filters,
1527
+ rowCount: count,
1528
+ getRowId: (row) => row.id,
1529
+ rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
1530
+ pageSize: PAGE_SIZE,
1531
+ isLoading: isPending,
1532
+ compact: true,
1533
+ emptyState: {
1534
+ empty: {
1535
+ heading: t("products.variants.empty.heading"),
1536
+ description: t("products.variants.empty.description")
1537
+ },
1538
+ filtered: {
1539
+ heading: t("products.variants.filtered.heading"),
1540
+ description: t("products.variants.filtered.description")
1541
+ }
1542
+ },
1543
+ prefix: PREFIX
1544
+ }
1545
+ ) })
1546
+ ] });
1547
+ };
1548
+ var columnHelper = createDataTableColumnHelper();
1549
+ var useColumns = (product) => {
1550
+ const { t } = useTranslation8();
1551
+ const navigate = useNavigate2();
1552
+ const { mutateAsync } = useDeleteVariantLazy(product.id);
1553
+ const prompt = usePrompt4();
1554
+ const [searchParams] = useSearchParams();
1555
+ const tableSearchParams = useMemo2(() => {
1556
+ const filtered = new URLSearchParams();
1557
+ for (const [key, value] of searchParams.entries()) {
1558
+ if (key.startsWith(`${PREFIX}_`)) {
1559
+ filtered.append(key, value);
1560
+ }
1561
+ }
1562
+ return filtered;
1563
+ }, [searchParams]);
1564
+ const dateColumns = useDataTableDateColumns();
1565
+ const handleDelete = useCallback(
1566
+ async (id, title) => {
1567
+ const res = await prompt({
1568
+ title: t("general.areYouSure"),
1569
+ description: t("products.deleteVariantWarning", {
1570
+ title
1571
+ }),
1572
+ confirmText: t("actions.delete"),
1573
+ cancelText: t("actions.cancel")
1574
+ });
1575
+ if (!res) {
1576
+ return;
1577
+ }
1578
+ await mutateAsync({ variantId: id });
1579
+ },
1580
+ [mutateAsync, prompt, t]
1581
+ );
1582
+ const attributeColumns = useMemo2(() => {
1583
+ const variantAttributes = product?.attributes?.filter((attr) => attr.is_variant_axis);
1584
+ if (!variantAttributes?.length) {
1585
+ return [];
1586
+ }
1587
+ return variantAttributes.map((attribute) => {
1588
+ return columnHelper.display({
1589
+ id: `attribute-${attribute.id}`,
1590
+ header: attribute.name,
1591
+ cell: ({ row }) => {
1592
+ const variantOpt = row.original.options?.find(
1593
+ (opt) => opt.option?.title === attribute.name
1594
+ );
1595
+ if (!variantOpt?.value) {
1596
+ return /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1597
+ }
1598
+ return /* @__PURE__ */ jsx8(
1599
+ "div",
1600
+ {
1601
+ className: "flex flex-wrap items-center gap-1",
1602
+ "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1603
+ children: /* @__PURE__ */ jsx8(Tooltip4, { content: variantOpt.value, children: /* @__PURE__ */ jsx8(
1604
+ Badge3,
1605
+ {
1606
+ size: "2xsmall",
1607
+ title: variantOpt.value,
1608
+ className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1609
+ "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${variantOpt.value}`,
1610
+ children: variantOpt.value
1611
+ }
1612
+ ) })
1613
+ }
1614
+ );
1615
+ }
1616
+ });
1617
+ });
1618
+ }, [product]);
1619
+ const getActions = useCallback(
1620
+ (ctx) => {
1621
+ const variant = ctx.row.original;
1622
+ const mainActions = [
1623
+ {
1624
+ icon: /* @__PURE__ */ jsx8(PencilSquare5, {}),
1625
+ label: t("actions.edit"),
1626
+ onClick: (row) => {
1627
+ navigate(
1628
+ `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1629
+ {
1630
+ state: {
1631
+ restore_params: tableSearchParams.toString()
1632
+ }
1633
+ }
1634
+ );
1635
+ }
1636
+ }
1637
+ ];
1638
+ const secondaryActions = [
1639
+ {
1640
+ icon: /* @__PURE__ */ jsx8(Trash3, {}),
1641
+ label: t("actions.delete"),
1642
+ onClick: () => handleDelete(variant.id, variant.title)
1643
+ }
1644
+ ];
1645
+ return [mainActions, secondaryActions];
1646
+ },
1647
+ [handleDelete, navigate, t, tableSearchParams]
1648
+ );
1649
+ return useMemo2(() => {
1650
+ return [
1651
+ columnHelper.accessor("title", {
1652
+ header: t("fields.title"),
1653
+ enableSorting: true,
1654
+ sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1655
+ sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1656
+ }),
1657
+ columnHelper.accessor("sku", {
1658
+ header: t("fields.sku"),
1659
+ cell: ({ getValue }) => {
1660
+ const value = getValue();
1661
+ return value ? value : /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1662
+ }
1663
+ }),
1664
+ ...attributeColumns,
1665
+ ...dateColumns,
1666
+ columnHelper.action({
1667
+ actions: getActions
1668
+ })
1669
+ ];
1670
+ }, [t, attributeColumns, dateColumns, getActions]);
1671
+ };
1672
+ var useFilters = () => {
1673
+ const dateFilters = useDataTableDateFilters();
1674
+ return useMemo2(() => {
1675
+ return [
1676
+ ...dateFilters
1677
+ ];
1678
+ }, [dateFilters]);
1679
+ };
1680
+
1681
+ // src/pages/products/product-detail/product-detail.tsx
1682
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1683
+ var Root = ({ children }) => {
1684
+ const initialData = useLoaderData();
1685
+ const { id } = useParams();
1686
+ const {
1687
+ product: rawProduct,
1688
+ isLoading,
1689
+ isError,
1690
+ error
1691
+ } = useProduct(id, PRODUCT_DETAIL_QUERY, {
1692
+ initialData
1693
+ });
1694
+ const product = rawProduct;
1695
+ if (isLoading || !product) {
1696
+ return /* @__PURE__ */ jsx9(
1697
+ TwoColumnPageSkeleton,
1698
+ {
1699
+ mainSections: 4,
1700
+ sidebarSections: 3,
1701
+ showJSON: true,
1702
+ showMetadata: true
1703
+ }
1704
+ );
1705
+ }
1706
+ if (isError) {
1707
+ throw error;
1708
+ }
1709
+ return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(
1710
+ TwoColumnPage,
1711
+ {
1712
+ data: product,
1713
+ showJSON: true,
1714
+ showMetadata: true,
1715
+ "data-testid": "product-detail-page",
1716
+ children
1717
+ }
1718
+ ) : /* @__PURE__ */ jsxs9(
1719
+ TwoColumnPage,
1720
+ {
1721
+ data: product,
1722
+ showJSON: true,
1723
+ showMetadata: true,
1724
+ "data-testid": "product-detail-page",
1725
+ children: [
1726
+ /* @__PURE__ */ jsxs9(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1727
+ /* @__PURE__ */ jsx9(ProductActiveRequestSection, { product }),
1728
+ /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1729
+ /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1730
+ /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1731
+ /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1732
+ ] }),
1733
+ /* @__PURE__ */ jsxs9(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1734
+ /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1735
+ /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1736
+ ] })
1737
+ ]
1738
+ }
1739
+ );
1740
+ };
1741
+ var ProductDetailPage = Object.assign(Root, {
1742
+ Main: TwoColumnPage.Main,
1743
+ Sidebar: TwoColumnPage.Sidebar,
1744
+ MainActiveRequestSection: ProductActiveRequestSection,
1745
+ MainActiveEditSection: ProductActiveEditSection,
1746
+ MainGeneralSection: ProductGeneralSection,
1747
+ MainMediaSection: ProductMediaSection,
1748
+ MainAttributeSection: ProductAttributeSection,
1749
+ MainVariantSection: ProductVariantSection,
1750
+ SidebarOrganizationSection: ProductOrganizationSection
1751
+ });
1752
+
1753
+ export {
1754
+ ProductDetailPage
1755
+ };