@mercurjs/admin 2.2.0-canary.5 → 2.2.0-canary.50

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 (438) hide show
  1. package/dist/{add-campaign-promotions-FAG3FAOF.js → add-campaign-promotions-QQUFYFRH.js} +14 -14
  2. package/dist/{adjust-inventory-EAAPNIBZ.js → adjust-inventory-P2M7KZ77.js} +33 -34
  3. package/dist/{api-key-management-create-MRLR4WFZ.js → api-key-management-create-KDKSGJ4C.js} +5 -5
  4. package/dist/{api-key-management-detail-PIN6NFQF.js → api-key-management-detail-O6KKT7V2.js} +36 -38
  5. package/dist/{api-key-management-edit-EZHFP3RR.js → api-key-management-edit-NOGBLKBT.js} +5 -5
  6. package/dist/{api-key-management-list-OPANEDHB.js → api-key-management-list-QVYDHEZQ.js} +9 -9
  7. package/dist/{api-key-management-sales-channels-PBL3V4IS.js → api-key-management-sales-channels-W5NFP6EW.js} +9 -10
  8. package/dist/{attribute-create-F55LOXRA.js → attribute-create-KR4DSDH2.js} +96 -83
  9. package/dist/{attribute-create-possible-value-EXVHC272.js → attribute-create-possible-value-QFXKXZM4.js} +2 -2
  10. package/dist/{attribute-detail-NRDJUPTJ.js → attribute-detail-LWKL6UMS.js} +61 -49
  11. package/dist/{attribute-edit-SB6GN67M.js → attribute-edit-WXO5FGR6.js} +7 -7
  12. package/dist/{attribute-edit-possible-value-5CLQOLVR.js → attribute-edit-possible-value-RO7BY3NC.js} +5 -5
  13. package/dist/{attribute-edit-ranking-7AAAYEC7.js → attribute-edit-ranking-YGR3KCSC.js} +3 -3
  14. package/dist/attribute-list-QUSXFHRZ.js +61 -0
  15. package/dist/breadcrumb-GHBR74WM.js +27 -0
  16. package/dist/breadcrumb-OBHTESQD.js +26 -0
  17. package/dist/{campaign-budget-edit-WKSYXTBX.js → campaign-budget-edit-QXAXRI6B.js} +3 -3
  18. package/dist/{campaign-configuration-ZTK46EB5.js → campaign-configuration-A3E6G2VQ.js} +3 -3
  19. package/dist/{campaign-create-7BELREFT.js → campaign-create-TZH66JVU.js} +7 -7
  20. package/dist/{campaign-detail-QMLFWZ6K.js → campaign-detail-PF3LUUZU.js} +49 -46
  21. package/dist/{campaign-edit-ZGLDY4X4.js → campaign-edit-6CIGS4ZU.js} +25 -9
  22. package/dist/{campaign-list-NQGNOFVZ.js → campaign-list-YXZ5GE7I.js} +7 -7
  23. package/dist/{categories-metadata-5GXBBHEH.js → categories-metadata-AIT33J5U.js} +34 -35
  24. package/dist/{category-create-QPQQGIEN.js → category-create-NTSIOKLK.js} +10 -7
  25. package/dist/category-detail-NQIXS2WH.js +113 -0
  26. package/dist/{category-edit-DJP7TK4X.js → category-edit-4PGWERPJ.js} +31 -13
  27. package/dist/category-icon-edit-C2VAH5JA.js +117 -0
  28. package/dist/{category-list-T5SE63HU.js → category-list-5XGK4PEB.js} +12 -9
  29. package/dist/category-media-E5UUDN3I.js +655 -0
  30. package/dist/category-organize-T45BC4HL.js +129 -0
  31. package/dist/{category-products-255EJFTV.js → category-products-SX6CH3ZZ.js} +48 -48
  32. package/dist/{chunk-G3GSRFTB.js → chunk-26PTCTT3.js} +9 -8
  33. package/dist/{chunk-XAIID3PU.js → chunk-2CHED2KM.js} +25 -16
  34. package/dist/{chunk-FFNSWUDC.js → chunk-2GHNKPYY.js} +39 -11
  35. package/dist/{chunk-3JSAS7QP.js → chunk-2SMBVF6F.js} +24 -7
  36. package/dist/{chunk-WQFFCK3R.js → chunk-2V74T2WI.js} +1 -1
  37. package/dist/{chunk-26UTIAAZ.js → chunk-32URSQ4F.js} +1 -1
  38. package/dist/chunk-3LGGCLSO.js +185 -0
  39. package/dist/chunk-3RRHQY24.js +1284 -0
  40. package/dist/{chunk-6RHAGO5O.js → chunk-3WOU2BB5.js} +5 -4
  41. package/dist/{chunk-VKOE5J66.js → chunk-3XOE4NV5.js} +11 -2
  42. package/dist/{chunk-GP4J42UD.js → chunk-4TNOZ4VH.js} +3 -2
  43. package/dist/{chunk-UNOG2S56.js → chunk-4XGFT4RZ.js} +167 -102
  44. package/dist/{chunk-JQV7CXEC.js → chunk-5BSSIDW6.js} +17 -2
  45. package/dist/{chunk-FB7DDNCA.js → chunk-5CHUXS7G.js} +4 -4
  46. package/dist/{chunk-PR7Y27BW.js → chunk-5EOYDQAS.js} +1 -1
  47. package/dist/{chunk-LYZDVZWA.js → chunk-5NSOIZFB.js} +5 -3
  48. package/dist/{chunk-SS7LB52P.js → chunk-5WTNXDRM.js} +10 -9
  49. package/dist/chunk-6BAPAIQM.js +8 -0
  50. package/dist/{chunk-D2NBZVQC.js → chunk-6PGIRZA6.js} +15 -13
  51. package/dist/{chunk-NQEXDLYH.js → chunk-6ZVV2XHU.js} +28 -9
  52. package/dist/{chunk-TXNRS2JR.js → chunk-7CQD5AQ6.js} +2 -6
  53. package/dist/chunk-7IGLZARZ.js +101 -0
  54. package/dist/{chunk-SONUZNDT.js → chunk-7MYE6VFQ.js} +75 -53
  55. package/dist/chunk-7OKYEA6I.js +283 -0
  56. package/dist/{chunk-GKGLVDDV.js → chunk-A2F5MDPU.js} +1 -1
  57. package/dist/{chunk-NUC27ELX.js → chunk-AASCLZ5N.js} +5 -5
  58. package/dist/{chunk-46A3QXAL.js → chunk-ABS7HMLY.js} +2 -2
  59. package/dist/{chunk-PRBE5CM3.js → chunk-AFYILTAC.js} +35 -3
  60. package/dist/{chunk-KMZOBR5Q.js → chunk-AO3P27WX.js} +19 -16
  61. package/dist/chunk-APAT344J.js +144 -0
  62. package/dist/{chunk-NMFVQDVF.js → chunk-APMBU7ZV.js} +5 -5
  63. package/dist/{chunk-EFZBEG7O.js → chunk-B3IK3FNO.js} +24 -8
  64. package/dist/{chunk-3VTAK3S6.js → chunk-BFUHW56P.js} +4 -4
  65. package/dist/chunk-BW7BDHZV.js +34 -0
  66. package/dist/{chunk-LYZT5REU.js → chunk-C4XKPQ6T.js} +14 -1
  67. package/dist/{chunk-N6SI4IIT.js → chunk-CARSKIPW.js} +1 -1
  68. package/dist/chunk-CGIVQ7D2.js +115 -0
  69. package/dist/{chunk-HR7TFO2X.js → chunk-CQKCZECQ.js} +7 -7
  70. package/dist/chunk-CU4UVEHX.js +121 -0
  71. package/dist/{chunk-M5AJSIRN.js → chunk-DJD3MWED.js} +1 -1
  72. package/dist/{chunk-HZQGZQTV.js → chunk-DP6YFZHP.js} +10 -8
  73. package/dist/{chunk-I5THQVYP.js → chunk-DUVYF37J.js} +1 -1
  74. package/dist/{chunk-FXWKGNRV.js → chunk-EJY35WBK.js} +2 -2
  75. package/dist/{chunk-KJSCFEXT.js → chunk-EQGJGBA5.js} +291 -76
  76. package/dist/{chunk-XJ3WC4G7.js → chunk-ESC6LVVC.js} +4 -3
  77. package/dist/{chunk-46M463BR.js → chunk-EWFOFSF7.js} +1 -1
  78. package/dist/{chunk-533GMKEG.js → chunk-F5NW4XBU.js} +23 -3
  79. package/dist/{chunk-5AZCIOS4.js → chunk-F6NPDZHW.js} +2 -2
  80. package/dist/{chunk-R5F52U3C.js → chunk-FIWEITDG.js} +36 -8
  81. package/dist/{chunk-UFGVU7RF.js → chunk-FLFE6HXW.js} +1 -1
  82. package/dist/{chunk-4LXBQTFN.js → chunk-FREUYHMS.js} +1 -1
  83. package/dist/{chunk-2ZRWLCYP.js → chunk-FVG5DTS6.js} +3 -3
  84. package/dist/{chunk-E5WBU7ZR.js → chunk-G2LHEJLS.js} +4 -4
  85. package/dist/{chunk-OHOWEMHO.js → chunk-G5KNNOXX.js} +32 -26
  86. package/dist/{chunk-CKUIM5ZD.js → chunk-GLWJ5J3F.js} +52 -23
  87. package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
  88. package/dist/{chunk-CKD5563X.js → chunk-GT5A4XN2.js} +4 -3
  89. package/dist/{chunk-MKBCBAS2.js → chunk-GVPKRQWI.js} +79 -28
  90. package/dist/{chunk-BFT3CN5L.js → chunk-GWW6MPYK.js} +5 -4
  91. package/dist/{chunk-VDKOJ5WD.js → chunk-GYRTURN7.js} +1 -1
  92. package/dist/{chunk-YFRC6GEN.js → chunk-HLL6GLZO.js} +3 -3
  93. package/dist/{chunk-BKNAX6QQ.js → chunk-I3RIVWBQ.js} +5 -4
  94. package/dist/{chunk-6NDM5WGE.js → chunk-I5HY5Q3K.js} +19 -72
  95. package/dist/{chunk-WJJXUXSO.js → chunk-IC2PLPRP.js} +1 -1
  96. package/dist/{chunk-L3E6LES5.js → chunk-IGTR66D2.js} +7 -7
  97. package/dist/{chunk-WRVGLMRW.js → chunk-IJ2CSCLP.js} +7 -4
  98. package/dist/{chunk-EZGIPTIF.js → chunk-IOAB3VND.js} +54 -19
  99. package/dist/chunk-IWBQZK6E.js +166 -0
  100. package/dist/chunk-IZDTQFCP.js +65 -0
  101. package/dist/{chunk-AEMDNTW5.js → chunk-J54BZXZX.js} +2 -2
  102. package/dist/{chunk-A7JOHU6Q.js → chunk-J772X4Q3.js} +4 -3
  103. package/dist/{chunk-Y2M536WR.js → chunk-JHBNG7OD.js} +17 -0
  104. package/dist/{chunk-LYD3C73Z.js → chunk-JI7HMGMO.js} +1 -1
  105. package/dist/{chunk-5J2HQOKK.js → chunk-JPFPQWNT.js} +5 -4
  106. package/dist/{chunk-KT7X72J4.js → chunk-JXSXBSV6.js} +9 -1
  107. package/dist/chunk-K2JORJRZ.js +281 -0
  108. package/dist/{chunk-33BERJSG.js → chunk-K6RZE3F7.js} +1 -1
  109. package/dist/{chunk-MFI5TG54.js → chunk-KA3BALYJ.js} +56 -16
  110. package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
  111. package/dist/{chunk-VERWLDVW.js → chunk-KL4DBMVO.js} +6 -5
  112. package/dist/{chunk-EBQUMS7H.js → chunk-KQVRWXAL.js} +50 -20
  113. package/dist/chunk-KUBTN5TC.js +206 -0
  114. package/dist/{chunk-Q2ULPJJ6.js → chunk-KXWN75T2.js} +2 -2
  115. package/dist/{chunk-MVNO35S5.js → chunk-L6D7AGRF.js} +18 -8
  116. package/dist/{chunk-LAPEZATU.js → chunk-L7DIEO5B.js} +1 -1
  117. package/dist/{chunk-YYMACYP6.js → chunk-LEQINL55.js} +3 -2
  118. package/dist/{chunk-CMHI2RPL.js → chunk-LPIPSLR7.js} +21 -0
  119. package/dist/chunk-LXNWSQOE.js +87 -0
  120. package/dist/{chunk-ZBWL72TB.js → chunk-LXZXXOJ3.js} +1 -11
  121. package/dist/{chunk-GQLVERZW.js → chunk-M5BZBKA3.js} +9 -9
  122. package/dist/{chunk-4XFFF2L5.js → chunk-MBHP7XGQ.js} +12 -11
  123. package/dist/{chunk-KXIA66EJ.js → chunk-MJTFEVGB.js} +36 -13
  124. package/dist/{chunk-ZRFWXNT3.js → chunk-MMKUMSZS.js} +205 -205
  125. package/dist/{chunk-DAXXLQKB.js → chunk-MO7TNIVQ.js} +1 -1
  126. package/dist/{chunk-ZN7LWXVC.js → chunk-MTHPNKQ4.js} +5 -5
  127. package/dist/{chunk-2YN2OI3W.js → chunk-MVRIYUOU.js} +34 -8
  128. package/dist/{chunk-K43FFKGD.js → chunk-N2CMOV3N.js} +1 -1
  129. package/dist/chunk-NASXWD7N.js +659 -0
  130. package/dist/{chunk-UXGLM3B4.js → chunk-NEGOGYEO.js} +4 -4
  131. package/dist/{chunk-3OUWXGMT.js → chunk-NI4FAFNL.js} +129 -61
  132. package/dist/{chunk-SXGSYSW7.js → chunk-NLJ5F7FS.js} +15 -7
  133. package/dist/{chunk-DWCBB4QM.js → chunk-NPUD4G37.js} +7 -6
  134. package/dist/{chunk-YNHS5G26.js → chunk-NQ2RDSI3.js} +2 -2
  135. package/dist/{chunk-6XTHMAA2.js → chunk-O6KUSG6F.js} +31 -13
  136. package/dist/{chunk-KTBL35I2.js → chunk-OAGTPKC5.js} +1 -1
  137. package/dist/chunk-ODDJZVYL.js +476 -0
  138. package/dist/{chunk-Q23KHB6V.js → chunk-OG5AVHPY.js} +111 -29
  139. package/dist/{chunk-AKC67AN5.js → chunk-OPE24DZA.js} +83 -63
  140. package/dist/{chunk-C4JUURO5.js → chunk-OT5X3VOQ.js} +1 -1
  141. package/dist/chunk-OTGABFC4.js +382 -0
  142. package/dist/{chunk-LD7NVG2X.js → chunk-P2DFLKCN.js} +5 -5
  143. package/dist/{chunk-634XVU3D.js → chunk-PAYQJPGK.js} +8 -1
  144. package/dist/{chunk-CPXK5RSJ.js → chunk-PEUWV5YK.js} +3 -2
  145. package/dist/{chunk-DRJAKRTI.js → chunk-PEVS3GLB.js} +7 -6
  146. package/dist/{chunk-34OFJ74B.js → chunk-PFD4SHVF.js} +53 -36
  147. package/dist/{chunk-FNKBJCNF.js → chunk-PHWYJ26A.js} +4 -4
  148. package/dist/{chunk-VYMODH6P.js → chunk-PYF5EER5.js} +1 -1
  149. package/dist/{chunk-7BD24KNM.js → chunk-PYZ7VL5X.js} +3 -3
  150. package/dist/{chunk-QFE4AEQJ.js → chunk-Q2CJGCIA.js} +401 -107
  151. package/dist/{chunk-X7H7TIOT.js → chunk-Q4R2O7XF.js} +9 -9
  152. package/dist/{chunk-5TRY5IMZ.js → chunk-Q6GUA5VE.js} +2 -2
  153. package/dist/{chunk-B66CMFMH.js → chunk-QCIDV3AP.js} +3 -3
  154. package/dist/{chunk-TNNQPNXY.js → chunk-QE4R2KT3.js} +1 -1
  155. package/dist/{chunk-FPV32HVT.js → chunk-QEX45BI3.js} +8 -6
  156. package/dist/chunk-QJCUPZZQ.js +356 -0
  157. package/dist/chunk-QR3GYYX6.js +0 -0
  158. package/dist/{chunk-3B6MTW5G.js → chunk-QUHSHIAC.js} +3 -0
  159. package/dist/{chunk-EB5QHYKL.js → chunk-QVIX6O76.js} +2 -2
  160. package/dist/{chunk-OH4AABUT.js → chunk-R325CPYC.js} +1 -1
  161. package/dist/{chunk-JPNPTILP.js → chunk-R4O667NT.js} +1 -1
  162. package/dist/{chunk-UKDC2AQR.js → chunk-RMB7MPIT.js} +1 -1
  163. package/dist/{chunk-2FGRDEAD.js → chunk-RQQ53CQJ.js} +1 -1
  164. package/dist/{chunk-LEG67A2R.js → chunk-SAU35JEB.js} +2 -11
  165. package/dist/{chunk-BGQ7H2KL.js → chunk-SHFF3Y5U.js} +26 -12
  166. package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
  167. package/dist/{chunk-IAWZQKUH.js → chunk-THMINQBZ.js} +4 -3
  168. package/dist/{chunk-LO7NJYHZ.js → chunk-TJJ7S3GL.js} +5 -4
  169. package/dist/{chunk-LXMGYWPO.js → chunk-TVTI7RG5.js} +10 -9
  170. package/dist/{chunk-J4MAIN7L.js → chunk-UK5BVJI7.js} +2 -2
  171. package/dist/{chunk-P42E3L6Z.js → chunk-VH4W6LKI.js} +4 -3
  172. package/dist/{chunk-ESPLVOFC.js → chunk-VHCDSNXF.js} +2 -2
  173. package/dist/{chunk-GPJ6KVY2.js → chunk-VHOCBKSA.js} +7 -6
  174. package/dist/chunk-VM56ZITS.js +356 -0
  175. package/dist/{chunk-4KX6CBJ4.js → chunk-VSLHL2AZ.js} +2 -0
  176. package/dist/{chunk-N3334MXP.js → chunk-VU6KTPOZ.js} +647 -754
  177. package/dist/{chunk-K6L5PHHQ.js → chunk-VVJPSCBO.js} +10 -9
  178. package/dist/{chunk-EPHVGD5Z.js → chunk-VXW3BCN2.js} +1 -1
  179. package/dist/{chunk-F5H5JZQZ.js → chunk-VYSB4CTB.js} +2112 -1706
  180. package/dist/{chunk-N3BYBEDV.js → chunk-WF3ZDT5Z.js} +11 -95
  181. package/dist/{chunk-X3PXBMI3.js → chunk-WNBV2NBG.js} +11 -10
  182. package/dist/{chunk-F7O6IXPA.js → chunk-WV4SPFOD.js} +72 -30
  183. package/dist/{chunk-ZB4SO44T.js → chunk-WX4ABVXL.js} +3 -3
  184. package/dist/{chunk-WYA62MUL.js → chunk-X5PMVI7H.js} +3 -3
  185. package/dist/{chunk-2MVNFKL6.js → chunk-XJQ4MWBR.js} +16 -15
  186. package/dist/{chunk-DV7QV3X2.js → chunk-XWP4ZGKN.js} +11 -16
  187. package/dist/{chunk-IWI34SYT.js → chunk-Y6C2YIKD.js} +8 -7
  188. package/dist/{chunk-CVFVEDMV.js → chunk-YBVXGODN.js} +4 -3
  189. package/dist/{chunk-X45JKZYW.js → chunk-YL7CBNVF.js} +11 -8
  190. package/dist/chunk-YPM6XXSO.js +525 -0
  191. package/dist/{chunk-S4SVK5DE.js → chunk-YVLANFBK.js} +29 -1
  192. package/dist/{chunk-3L7M4E7W.js → chunk-YXKHBSQJ.js} +14 -188
  193. package/dist/{chunk-IMR3MZDP.js → chunk-Z6CIQQUZ.js} +3 -2
  194. package/dist/{chunk-ACDG3RAL.js → chunk-Z7XMG6DA.js} +89 -128
  195. package/dist/{chunk-4RT7P5ZQ.js → chunk-ZAANJVLM.js} +2 -2
  196. package/dist/{chunk-KAZ5BYTQ.js → chunk-ZAOEFQ6K.js} +5 -4
  197. package/dist/{chunk-SA3MMYXT.js → chunk-ZCQMFJ4X.js} +22 -10
  198. package/dist/{chunk-FEC24V7X.js → chunk-ZOTBKQLG.js} +2 -2
  199. package/dist/{chunk-COP7NFSJ.js → chunk-ZVPTNPLI.js} +3 -3
  200. package/dist/{collection-add-products-4ZTBHENL.js → collection-add-products-TRY52HYQ.js} +45 -46
  201. package/dist/{collection-create-GPBN7KO6.js → collection-create-7ZQONUJL.js} +89 -17
  202. package/dist/collection-detail-MQ7ZH6OT.js +104 -0
  203. package/dist/{collection-edit-NVRFKO46.js → collection-edit-ZFAECPWC.js} +35 -12
  204. package/dist/collection-icon-edit-642AZRHR.js +117 -0
  205. package/dist/collection-list-YMCTIJ52.js +85 -0
  206. package/dist/collection-media-LMJFEFVY.js +655 -0
  207. package/dist/{collection-metadata-E4C54MTU.js → collection-metadata-AZRN32RU.js} +34 -35
  208. package/dist/commission-rule-commission-edit-V5JVRNZN.js +195 -0
  209. package/dist/commission-rule-create-EZ2C6AWK.js +464 -0
  210. package/dist/commission-rule-detail-FOLHANWL.js +45 -0
  211. package/dist/commission-rule-edit-NQ5EYCGO.js +352 -0
  212. package/dist/commissions-list-56S53CQ4.js +36 -0
  213. package/dist/{constants-Bahlh59D.d.ts → constants-CBhKGpBZ.d.ts} +12 -5
  214. package/dist/{customer-create-QHA4KM6N.js → customer-create-SC6LAEVJ.js} +3 -3
  215. package/dist/{customer-create-address-TYWVWNUE.js → customer-create-address-VZMOF5AE.js} +11 -6
  216. package/dist/{customer-detail-ONZGPCHW.js → customer-detail-VIWHZUOZ.js} +51 -52
  217. package/dist/{customer-edit-JZ4PQTIN.js → customer-edit-RAWO66UL.js} +27 -9
  218. package/dist/customer-edit-address-ZEVUPAYN.js +311 -0
  219. package/dist/{customer-group-add-customers-VJUBEN7M.js → customer-group-add-customers-VKUSW6AS.js} +13 -13
  220. package/dist/{customer-group-create-NA2UKCF6.js → customer-group-create-3KAC3R3N.js} +3 -3
  221. package/dist/{customer-group-detail-XTCDJX7O.js → customer-group-detail-JVULZZTT.js} +51 -49
  222. package/dist/{customer-group-edit-3O6HAYYN.js → customer-group-edit-E7JX2L4J.js} +43 -22
  223. package/dist/customer-group-list-SKODEZKB.js +57 -0
  224. package/dist/{customer-group-metadata-N7HGHXNC.js → customer-group-metadata-3QRU7FIE.js} +34 -35
  225. package/dist/{customer-list-MB6WZFMA.js → customer-list-LYDL4IEG.js} +9 -9
  226. package/dist/{customer-metadata-63OWV4KB.js → customer-metadata-7DMBCQXW.js} +34 -35
  227. package/dist/{customers-add-customer-group-NUXPXNUC.js → customers-add-customer-group-FXRUE5SD.js} +46 -46
  228. package/dist/{edit-inventory-item-YOJTYA7H.js → edit-inventory-item-QPWV4MSP.js} +55 -41
  229. package/dist/{edit-inventory-item-attributes-JGY633F2.js → edit-inventory-item-attributes-J7WHYKMK.js} +33 -34
  230. package/dist/{edit-reservation-ACDUXG33.js → edit-reservation-PTUSCC6C.js} +29 -11
  231. package/dist/{edit-rules-4VAD5Q3L.js → edit-rules-2WZOLTL7.js} +34 -35
  232. package/dist/extension-targets.d.ts +269 -0
  233. package/dist/extension-targets.js +1 -0
  234. package/dist/global-commission-edit-TRSS5JBH.js +203 -0
  235. package/dist/index.css +5187 -3
  236. package/dist/index.d.ts +16 -5
  237. package/dist/index.js +405 -383
  238. package/dist/inventory-create-RDVKGH2S.js +58 -0
  239. package/dist/{inventory-detail-B3HU2OVR.js → inventory-detail-J7NMO7EZ.js} +50 -47
  240. package/dist/{inventory-list-AE44PEW7.js → inventory-list-XBDJ7BHE.js} +8 -8
  241. package/dist/{inventory-metadata-WCFTI7AH.js → inventory-metadata-CQHLKX4T.js} +34 -35
  242. package/dist/{inventory-stock-M65W4GRN.js → inventory-stock-3TR47RNA.js} +38 -39
  243. package/dist/{invite-VQ2HR2OM.js → invite-25CGHT4W.js} +3 -3
  244. package/dist/loader-TIPLOZF7.js +32 -0
  245. package/dist/loader-ZYV22XGC.js +40 -0
  246. package/dist/{location-create-ZMNB7YKR.js → location-create-GKORXOYD.js} +3 -3
  247. package/dist/{location-detail-2NCZD5MO.js → location-detail-DTBVSZBJ.js} +36 -37
  248. package/dist/{location-edit-DMBF3CYZ.js → location-edit-T2CWF6N2.js} +3 -3
  249. package/dist/{location-fulfillment-providers-3XKOFATD.js → location-fulfillment-providers-P5U5K4NO.js} +46 -47
  250. package/dist/location-list-LH27WJBT.js +54 -0
  251. package/dist/{location-sales-channels-TEUZYDTT.js → location-sales-channels-PRQUBZIV.js} +9 -10
  252. package/dist/{location-service-zone-create-ZS3UWJAA.js → location-service-zone-create-O6GYRZEE.js} +11 -11
  253. package/dist/{location-service-zone-edit-MTGU2O4C.js → location-service-zone-edit-7ZTB45TD.js} +5 -5
  254. package/dist/{location-service-zone-manage-areas-S7QZTIFT.js → location-service-zone-manage-areas-DBP3P27I.js} +11 -11
  255. package/dist/location-service-zone-shipping-option-create-Z3S7EUYH.js +60 -0
  256. package/dist/{location-service-zone-shipping-option-edit-3PGSNKYT.js → location-service-zone-shipping-option-edit-SLQM4GSH.js} +7 -7
  257. package/dist/{location-service-zone-shipping-option-pricing-POBJOF3Z.js → location-service-zone-shipping-option-pricing-UZ577SNK.js} +9 -9
  258. package/dist/{login-DJWU5X5L.js → login-JNIVGP2G.js} +32 -33
  259. package/dist/{manage-locations-E2XQPKKE.js → manage-locations-NGNUXP3N.js} +3 -3
  260. package/dist/{marketplace-add-currencies-6ANNBGZM.js → marketplace-add-currencies-IPE5RJF6.js} +13 -13
  261. package/dist/marketplace-detail-VNCNRAE4.js +75 -0
  262. package/dist/{marketplace-edit-6Q3G2OY5.js → marketplace-edit-WG6LMQ2P.js} +5 -5
  263. package/dist/{marketplace-metadata-7DNBHUDD.js → marketplace-metadata-74YUQ6UC.js} +34 -35
  264. package/dist/offer-detail-page-KQMSZLQN.js +631 -0
  265. package/dist/offer-variant-detail-page-GESVAA2S.js +144 -0
  266. package/dist/offers-NW24IATZ.js +198 -0
  267. package/dist/{order-create-claim-MPSXY24H.js → order-create-claim-Y7ESDXLI.js} +284 -259
  268. package/dist/{order-create-edit-6JLXERBY.js → order-create-edit-CAKL6MJQ.js} +215 -120
  269. package/dist/{order-create-exchange-O6COEAGJ.js → order-create-exchange-QGSECB7D.js} +302 -275
  270. package/dist/{order-create-refund-TCNCSOMX.js → order-create-refund-HXFCDZV5.js} +37 -38
  271. package/dist/{order-create-return-EVSD6GKE.js → order-create-return-R5WJBQ5W.js} +58 -31
  272. package/dist/{order-detail-BOW62X75.js → order-detail-DGZXN7IQ.js} +53 -51
  273. package/dist/{order-edit-billing-address-5ZBOWDWQ.js → order-edit-billing-address-ZAQ3FPRT.js} +35 -36
  274. package/dist/{order-edit-email-DQJW2SAM.js → order-edit-email-VSAS3M2E.js} +34 -35
  275. package/dist/{order-edit-shipping-address-RIML4XFQ.js → order-edit-shipping-address-FZMDRJU5.js} +34 -35
  276. package/dist/{order-list-U5DZYLJK.js → order-list-6LIYSO2R.js} +19 -18
  277. package/dist/{order-metadata-WGZUETFN.js → order-metadata-FKM3ZDNM.js} +34 -35
  278. package/dist/{order-request-transfer-QFUMEZPD.js → order-request-transfer-BCE6ED5E.js} +34 -35
  279. package/dist/pages/index.d.ts +574 -491
  280. package/dist/pages/index.js +204 -206
  281. package/dist/{payout-detail-TWO6HN4E.js → payout-detail-LY7SRCKO.js} +3 -3
  282. package/dist/{payout-list-7WJZFNW5.js → payout-list-VUJKOAOJ.js} +8 -8
  283. package/dist/{price-list-configuration-O3MR5IUA.js → price-list-configuration-DYFBYDQE.js} +14 -13
  284. package/dist/price-list-create-U2DMHUQE.js +77 -0
  285. package/dist/price-list-detail-CAK3AFSU.js +108 -0
  286. package/dist/{price-list-edit-OJAYEUYO.js → price-list-edit-4JPSL2NL.js} +28 -12
  287. package/dist/{price-list-list-ARICU2NA.js → price-list-list-PJIIPQOF.js} +11 -11
  288. package/dist/price-list-prices-add-6TO5RTTD.js +72 -0
  289. package/dist/{price-list-prices-edit-4HBSUC5W.js → price-list-prices-edit-AXJJTMKL.js} +35 -36
  290. package/dist/{product-add-existing-attributes-IHCIKDIH.js → product-add-existing-attributes-XIJB2NXI.js} +93 -54
  291. package/dist/{product-attributes-ZURXNZ3J.js → product-attributes-PCZDEFHM.js} +4 -4
  292. package/dist/{product-bulk-edit-LHCPVFUX.js → product-bulk-edit-FGB4T2KQ.js} +4 -4
  293. package/dist/product-create-KCMW6PCB.js +71 -0
  294. package/dist/{product-create-attribute-UBWABT2Q.js → product-create-attribute-6AJPI6IJ.js} +92 -54
  295. package/dist/{product-create-variant-MVYZPDO7.js → product-create-variant-2OCZA6GW.js} +8 -8
  296. package/dist/product-detail-A6DZWYEL.js +110 -0
  297. package/dist/{product-edit-EDW3D2KW.js → product-edit-KMK7CMLI.js} +9 -5
  298. package/dist/product-edit-attribute-FCEYWZWL.js +336 -0
  299. package/dist/product-list-CIHKL6N7.js +90 -0
  300. package/dist/{product-media-J3VTWOU4.js → product-media-P57SRDNX.js} +14 -17
  301. package/dist/{product-metadata-T2D4GEIP.js → product-metadata-6EFF4IPX.js} +35 -36
  302. package/dist/{product-organization-D6UMZAUE.js → product-organization-QNCCL277.js} +84 -51
  303. package/dist/{product-sales-channels-NTT6KMSD.js → product-sales-channels-GD7NYUP3.js} +8 -9
  304. package/dist/{product-shipping-profile-WM7LORFB.js → product-shipping-profile-UFIRKPTG.js} +4 -4
  305. package/dist/{product-tag-create-47G425O2.js → product-tag-create-PSY5Q437.js} +33 -34
  306. package/dist/{product-tag-detail-VNGOBWYE.js → product-tag-detail-D54OKWUZ.js} +58 -57
  307. package/dist/{product-tag-edit-DN7IVL75.js → product-tag-edit-NVGUS3CY.js} +33 -34
  308. package/dist/{product-tag-list-ZGRJZT2U.js → product-tag-list-QNWZAU5G.js} +58 -57
  309. package/dist/{product-tag-metadata-YLDBRJMI.js → product-tag-metadata-T4ZYOIXY.js} +34 -35
  310. package/dist/{product-type-create-RHG4KEAV.js → product-type-create-PPTAW3DW.js} +3 -3
  311. package/dist/{product-type-detail-MPONGCVO.js → product-type-detail-TXZ6HTOV.js} +44 -45
  312. package/dist/{product-type-edit-CABB7R7Y.js → product-type-edit-55AH3P7G.js} +3 -3
  313. package/dist/{product-type-list-TM26QMHR.js → product-type-list-OZILJZLG.js} +8 -8
  314. package/dist/{product-type-metadata-TDAER7JD.js → product-type-metadata-OJJYUALT.js} +34 -35
  315. package/dist/{product-variant-detail-5BF6JTHV.js → product-variant-detail-FZL5OZFE.js} +33 -34
  316. package/dist/{product-variant-edit-2RHFG2CZ.js → product-variant-edit-LSSJW4DS.js} +35 -36
  317. package/dist/{product-variant-metadata-G2LLH7YK.js → product-variant-metadata-D5AUINFJ.js} +34 -35
  318. package/dist/{profile-detail-ZRL5SERS.js → profile-detail-PFJX3LPX.js} +3 -3
  319. package/dist/{profile-edit-HQTWYWZ7.js → profile-edit-O6Z3XJ4U.js} +3 -3
  320. package/dist/{promotion-add-campaign-S3JJSFHT.js → promotion-add-campaign-PYEBYRHK.js} +7 -7
  321. package/dist/promotion-create-OFLXF3RZ.js +57 -0
  322. package/dist/promotion-detail-H6S4JYYD.js +96 -0
  323. package/dist/{promotion-edit-details-TKRC5HES.js → promotion-edit-details-GXA4FDTK.js} +29 -17
  324. package/dist/{promotion-list-AFBLWKTJ.js → promotion-list-A3V4W5DY.js} +10 -10
  325. package/dist/{refund-reason-create-6RPQHIJI.js → refund-reason-create-HTTX2UGC.js} +33 -34
  326. package/dist/{refund-reason-edit-W2TVZB3N.js → refund-reason-edit-I7XXP4EP.js} +33 -34
  327. package/dist/{refund-reason-list-TS6JWYS4.js → refund-reason-list-YYCNRERE.js} +49 -48
  328. package/dist/{region-add-countries-COXN4LP3.js → region-add-countries-UO5A42HM.js} +12 -12
  329. package/dist/{region-create-P66Q65XY.js → region-create-7NA6RKWS.js} +13 -13
  330. package/dist/{region-detail-P2HHBYFV.js → region-detail-VA4FGEKA.js} +9 -9
  331. package/dist/{region-edit-XFE54SAO.js → region-edit-Z4VYO3TQ.js} +5 -5
  332. package/dist/{region-list-2XXKCDDX.js → region-list-WU4LTP5Y.js} +9 -9
  333. package/dist/{region-metadata-TNSJDCBM.js → region-metadata-RRUP56B2.js} +34 -35
  334. package/dist/{reservation-create-2TDZAX5A.js → reservation-create-3RVQVMRF.js} +5 -5
  335. package/dist/{reservation-detail-KFOVTTFH.js → reservation-detail-QOVPIIMC.js} +42 -39
  336. package/dist/{reservation-list-K4RPXJTO.js → reservation-list-SGGW2MSN.js} +9 -9
  337. package/dist/{reservation-metadata-HBFAVVPW.js → reservation-metadata-OAEUUCRG.js} +34 -35
  338. package/dist/{reset-password-3NYZNQPK.js → reset-password-7KNQD6OM.js} +3 -3
  339. package/dist/{return-reason-create-KED7446I.js → return-reason-create-DYJCGEOK.js} +3 -3
  340. package/dist/{return-reason-edit-57EU3XSE.js → return-reason-edit-A7ATUTCD.js} +3 -3
  341. package/dist/{return-reason-list-WBLPUYD4.js → return-reason-list-HMSZJDKI.js} +23 -21
  342. package/dist/{sales-channel-add-products-IHGDKRKH.js → sales-channel-add-products-6TXYF3HM.js} +46 -47
  343. package/dist/{sales-channel-create-MPZCRQBT.js → sales-channel-create-77PRY5T6.js} +4 -4
  344. package/dist/{sales-channel-detail-QCFO7VUA.js → sales-channel-detail-SYE4FUXD.js} +43 -44
  345. package/dist/{sales-channel-edit-GILK4QK3.js → sales-channel-edit-PBN2XYEI.js} +4 -4
  346. package/dist/sales-channel-list-4CNHLSBR.js +52 -0
  347. package/dist/{sales-channel-metadata-OEQVWJRQ.js → sales-channel-metadata-RXT26TCT.js} +34 -35
  348. package/dist/{shipping-option-type-create-SMXDCF6I.js → shipping-option-type-create-2EVIHSGN.js} +33 -34
  349. package/dist/{shipping-option-type-detail-MO3YRUVR.js → shipping-option-type-detail-BKFYUX2T.js} +34 -35
  350. package/dist/{shipping-option-type-edit-KO64TZS6.js → shipping-option-type-edit-LTH6PE7B.js} +33 -34
  351. package/dist/shipping-option-type-list-7NSGG7ZI.js +60 -0
  352. package/dist/{shipping-profile-create-UJNCCKKK.js → shipping-profile-create-HKYX4FKJ.js} +3 -3
  353. package/dist/{shipping-profile-detail-YAKZHWZI.js → shipping-profile-detail-FOPCKNOZ.js} +3 -3
  354. package/dist/{shipping-profile-metadata-FLTMLAZN.js → shipping-profile-metadata-WRFZ55C3.js} +34 -35
  355. package/dist/{shipping-profiles-list-JF2SQIQ7.js → shipping-profiles-list-AKSZ4O35.js} +7 -7
  356. package/dist/{store-address-edit-PKIBRFH4.js → store-address-edit-M6A37RFY.js} +4 -4
  357. package/dist/{store-bulk-edit-LW6ABDJK.js → store-bulk-edit-SYHKAJ6D.js} +5 -5
  358. package/dist/{store-closure-edit-OK7MTUHY.js → store-closure-edit-VE7D5F7I.js} +3 -3
  359. package/dist/{store-create-STR6YNFJ.js → store-create-6OQW7F4U.js} +37 -38
  360. package/dist/store-details-45RPSTMU.js +104 -0
  361. package/dist/{store-edit-KRBR5MGV.js → store-edit-HABD7SAL.js} +59 -21
  362. package/dist/store-list-XZU26QTH.js +82 -0
  363. package/dist/{store-member-invite-AKH3KHMF.js → store-member-invite-T5GCT6HV.js} +6 -6
  364. package/dist/{store-payment-details-edit-HOGHZMZC.js → store-payment-details-edit-JUM745OG.js} +3 -3
  365. package/dist/{store-professional-details-edit-DPJ4ZFDR.js → store-professional-details-edit-NKBYKBCA.js} +3 -3
  366. package/dist/{tax-region-create-NEKIT7TT.js → tax-region-create-SKBBBZXJ.js} +34 -35
  367. package/dist/tax-region-detail-UGD2KK2H.js +69 -0
  368. package/dist/{tax-region-edit-4PJV5F5X.js → tax-region-edit-N64TGNAG.js} +33 -34
  369. package/dist/{tax-region-list-FIBHEFVD.js → tax-region-list-GRZIXRD4.js} +8 -8
  370. package/dist/{tax-region-metadata-EYRFMJLL.js → tax-region-metadata-MKXFQ5B7.js} +34 -35
  371. package/dist/{tax-region-province-create-OVLIZPNP.js → tax-region-province-create-7YT2LNJG.js} +3 -3
  372. package/dist/{tax-region-province-detail-MTHKW7LW.js → tax-region-province-detail-LITAO6EZ.js} +40 -41
  373. package/dist/{tax-region-tax-override-create-OGW3MPBD.js → tax-region-tax-override-create-NCAWHUOU.js} +61 -62
  374. package/dist/{tax-region-tax-override-edit-LTZCYN4Y.js → tax-region-tax-override-edit-OOP7RQZR.js} +61 -62
  375. package/dist/{tax-region-tax-rate-create-KDN6G52Y.js → tax-region-tax-rate-create-3ZLVL3X3.js} +4 -4
  376. package/dist/{tax-region-tax-rate-edit-D4BFDDJ7.js → tax-region-tax-rate-edit-XVMPIJOF.js} +4 -4
  377. package/dist/{user-detail-2OTVNTCL.js → user-detail-4FDNMJ6W.js} +4 -4
  378. package/dist/{user-edit-MXS2DV37.js → user-edit-T3MZKULQ.js} +3 -3
  379. package/dist/{user-invite-HLZJ7FST.js → user-invite-FCWARLW5.js} +11 -11
  380. package/dist/{user-list-TR7RSGUO.js → user-list-62A6ZMIX.js} +7 -7
  381. package/dist/{user-metadata-GIR3A7WO.js → user-metadata-5UFWFXLX.js} +34 -35
  382. package/package.json +25 -17
  383. package/dist/[id]-272FUOXG.js +0 -503
  384. package/dist/attribute-list-URWKNTSJ.js +0 -62
  385. package/dist/category-detail-RIKOZMPK.js +0 -108
  386. package/dist/category-organize-DQQGAAJY.js +0 -112
  387. package/dist/chunk-2XVH2IJL.js +0 -473
  388. package/dist/chunk-54RTJBYO.js +0 -153
  389. package/dist/chunk-6WBQDJIH.js +0 -1733
  390. package/dist/chunk-7O6WJTBI.js +0 -139
  391. package/dist/chunk-AKTAFKIU.js +0 -228
  392. package/dist/chunk-CKNQJPAG.js +0 -135
  393. package/dist/chunk-DDANJIE7.js +0 -207
  394. package/dist/chunk-GVEF6UDT.js +0 -8
  395. package/dist/chunk-J65IXAGI.js +0 -292
  396. package/dist/chunk-LFKTHNWI.js +0 -83
  397. package/dist/chunk-MSESXKMA.js +0 -390
  398. package/dist/chunk-RXM4B6HR.js +0 -8
  399. package/dist/chunk-SWL7ZCP3.js +0 -11
  400. package/dist/chunk-TE245WV3.js +0 -371
  401. package/dist/chunk-UM7ZR3VU.js +0 -14
  402. package/dist/chunk-V5XHY5LP.js +0 -39
  403. package/dist/chunk-ZZ3XFIEM.js +0 -84
  404. package/dist/collection-detail-W7OC2ALM.js +0 -99
  405. package/dist/collection-list-B7LALPSA.js +0 -83
  406. package/dist/commission-rate-create-7MEIKAXK.js +0 -783
  407. package/dist/commission-rate-detail-XBMB3Y7S.js +0 -86
  408. package/dist/commission-rate-edit-XXUAGK5Q.js +0 -768
  409. package/dist/commission-rate-list-Y5XLEO67.js +0 -26
  410. package/dist/customer-group-list-63ER7WQH.js +0 -58
  411. package/dist/inventory-create-3NJZLSFO.js +0 -59
  412. package/dist/loader-O4EABIXE.js +0 -26
  413. package/dist/location-list-VS6V2FXE.js +0 -55
  414. package/dist/location-service-zone-shipping-option-create-LAM3OHBC.js +0 -61
  415. package/dist/marketplace-detail-IQLU7R3J.js +0 -76
  416. package/dist/offers-UJCSO3RD.js +0 -440
  417. package/dist/order-allocate-items-TMVWJUV3.js +0 -563
  418. package/dist/order-create-fulfillment-Y4HQ5YRS.js +0 -644
  419. package/dist/order-create-shipment-EWOJJXEM.js +0 -215
  420. package/dist/order-receive-return-MDUU4L4X.js +0 -563
  421. package/dist/price-list-create-J4AJG42T.js +0 -78
  422. package/dist/price-list-detail-D2ETNZ5N.js +0 -105
  423. package/dist/price-list-prices-add-FQLQ5DPX.js +0 -73
  424. package/dist/product-brand-create-B3ZJGHUQ.js +0 -171
  425. package/dist/product-brand-detail-O7UKYV4H.js +0 -100
  426. package/dist/product-brand-edit-3TQDHZNN.js +0 -179
  427. package/dist/product-brand-list-ZBPBSRQN.js +0 -30
  428. package/dist/product-brand-metadata-N2CJ5K3Z.js +0 -87
  429. package/dist/product-create-BQXFDMEP.js +0 -72
  430. package/dist/product-detail-I57XSYLB.js +0 -102
  431. package/dist/product-list-PR532XII.js +0 -88
  432. package/dist/promotion-create-G3M4UJX2.js +0 -58
  433. package/dist/promotion-detail-4EHU6FKF.js +0 -91
  434. package/dist/sales-channel-list-YNHR5EHL.js +0 -54
  435. package/dist/shipping-option-type-list-6C26GWDM.js +0 -61
  436. package/dist/store-details-3U4OEFWC.js +0 -122
  437. package/dist/store-list-PJ3U254I.js +0 -83
  438. package/dist/tax-region-detail-LVN5XSN5.js +0 -70
@@ -1,1733 +0,0 @@
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
- require_dist
22
- } from "./chunk-F5H5JZQZ.js";
23
- import {
24
- useQueryParams
25
- } from "./chunk-THHRRYRS.js";
26
- import {
27
- useProductTag
28
- } from "./chunk-46A3QXAL.js";
29
- import {
30
- productAttributesQueryKeys,
31
- useProductAttribute
32
- } from "./chunk-533GMKEG.js";
33
- import {
34
- useProductType
35
- } from "./chunk-46M463BR.js";
36
- import {
37
- useCollection
38
- } from "./chunk-2ZRWLCYP.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-EB5QHYKL.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-ZRFWXNT3.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, useQuery } 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 BrandName = ({ id }) => {
187
- const { data } = useQuery({
188
- queryKey: ["product_brand", id],
189
- queryFn: () => sdk.admin.productBrands.$id.query({ $id: id }),
190
- enabled: !!id
191
- });
192
- return /* @__PURE__ */ jsx2(Fragment2, { children: data?.product_brand?.name ?? id });
193
- };
194
- var TypeName = ({ id }) => {
195
- const { product_type } = useProductType(id);
196
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_type?.value ?? id });
197
- };
198
- var CollectionName = ({ id }) => {
199
- const { collection } = useCollection(id);
200
- return /* @__PURE__ */ jsx2(Fragment2, { children: collection?.title ?? id });
201
- };
202
- var CategoryName = ({ id }) => {
203
- const { product_category } = useProductCategory(id);
204
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_category?.name ?? id });
205
- };
206
- var TagName = ({ id }) => {
207
- const { product_tag } = useProductTag(id);
208
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_tag?.value ?? id });
209
- };
210
- var ReferenceName = ({
211
- field,
212
- id
213
- }) => {
214
- switch (field) {
215
- case "brand_id":
216
- return /* @__PURE__ */ jsx2(BrandName, { id });
217
- case "type_id":
218
- return /* @__PURE__ */ jsx2(TypeName, { id });
219
- case "collection_id":
220
- return /* @__PURE__ */ jsx2(CollectionName, { id });
221
- case "categories":
222
- return /* @__PURE__ */ jsx2(CategoryName, { id });
223
- case "tags":
224
- return /* @__PURE__ */ jsx2(TagName, { id });
225
- }
226
- };
227
- var ReferenceList = ({
228
- field,
229
- ids
230
- }) => {
231
- if (!ids.length) return /* @__PURE__ */ jsx2(Fragment2, { children: "-" });
232
- return /* @__PURE__ */ jsx2(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs2(Fragment, { children: [
233
- idx > 0 && ", ",
234
- /* @__PURE__ */ jsx2(ReferenceName, { field, id })
235
- ] }, `${field}-${id}`)) });
236
- };
237
- var FieldRow = ({ diff }) => {
238
- const { t } = useTranslation2();
239
- const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
240
- const nextIsImages = isImageList(diff.next);
241
- const previousIsImages = isImageList(diff.previous);
242
- const renderAsImages = nextIsImages || previousIsImages;
243
- const renderAsReference = isReferenceField(diff.field);
244
- return /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4", children: [
245
- /* @__PURE__ */ jsx2(
246
- Text,
247
- {
248
- size: "small",
249
- weight: "plus",
250
- leading: "compact",
251
- className: "text-ui-fg-subtle w-[160px] shrink-0",
252
- children: t(`fields.${diff.field}`, {
253
- defaultValue: humanizeFieldName(diff.field)
254
- })
255
- }
256
- ),
257
- renderAsImages ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
258
- hasPrevious && previousIsImages && /* @__PURE__ */ jsx2(ImageStrip, { images: diff.previous, faded: true }),
259
- hasPrevious && /* @__PURE__ */ jsx2(
260
- Text,
261
- {
262
- size: "small",
263
- leading: "compact",
264
- className: "text-ui-fg-subtle",
265
- children: "\u2192"
266
- }
267
- ),
268
- nextIsImages ? /* @__PURE__ */ jsx2(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx2(
269
- Text,
270
- {
271
- size: "small",
272
- leading: "compact",
273
- className: "text-ui-fg-subtle",
274
- children: formatFieldValue(diff.next, diff.field)
275
- }
276
- )
277
- ] }) : renderAsReference ? /* @__PURE__ */ jsxs2(
278
- Text,
279
- {
280
- size: "small",
281
- leading: "compact",
282
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
283
- children: [
284
- hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: /* @__PURE__ */ jsx2(
285
- ReferenceList,
286
- {
287
- field: diff.field,
288
- ids: extractReferenceIds(
289
- diff.field,
290
- diff.previous
291
- )
292
- }
293
- ) }),
294
- hasPrevious && " \u2192 ",
295
- /* @__PURE__ */ jsx2(
296
- ReferenceList,
297
- {
298
- field: diff.field,
299
- ids: extractReferenceIds(diff.field, diff.next)
300
- }
301
- )
302
- ]
303
- }
304
- ) : /* @__PURE__ */ jsxs2(
305
- Text,
306
- {
307
- size: "small",
308
- leading: "compact",
309
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
310
- children: [
311
- hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
312
- hasPrevious && " \u2192 ",
313
- formatFieldValue(diff.next, diff.field)
314
- ]
315
- }
316
- )
317
- ] });
318
- };
319
- var AttributeActionLine = ({
320
- attributeId,
321
- valueIds
322
- }) => {
323
- const { product_attribute } = useProductAttribute(attributeId);
324
- const name = product_attribute?.name ?? attributeId;
325
- const values = product_attribute?.values ?? [];
326
- const selectedNames = valueIds && valueIds.length ? valueIds.map((id) => {
327
- const match = values.find((v) => v.id === id);
328
- return match?.name ?? id;
329
- }) : [];
330
- return /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
331
- /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: name }),
332
- selectedNames.length > 0 && `: ${selectedNames.join(", ")}`
333
- ] });
334
- };
335
- var VariantActionLine = ({
336
- title,
337
- images
338
- }) => /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
339
- images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
340
- /* @__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 }) })
341
- ] });
342
- var ActionLine = ({
343
- action,
344
- variantsById
345
- }) => {
346
- const { t } = useTranslation2();
347
- const details = action.details ?? {};
348
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
349
- if (!details.attribute_id) return null;
350
- return /* @__PURE__ */ jsx2(
351
- AttributeActionLine,
352
- {
353
- attributeId: details.attribute_id,
354
- valueIds: action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD ? details.attribute_value_ids : void 0
355
- }
356
- );
357
- }
358
- const variantFallback = t("fields.variant", { defaultValue: "Variant" });
359
- if (action.action === import_types.ProductChangeActionType.VARIANT_ADD) {
360
- const title = details.variant?.title || details.variant?.sku || variantFallback;
361
- return /* @__PURE__ */ jsx2(VariantActionLine, { title });
362
- }
363
- if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
364
- const variantId = details.variant_id ?? "";
365
- const found = variantId ? variantsById.get(variantId) : void 0;
366
- const title = found?.title || found?.sku || variantId || variantFallback;
367
- const images = isImageList(found?.images) ? found?.images : void 0;
368
- return /* @__PURE__ */ jsx2(VariantActionLine, { title, images });
369
- }
370
- const label = describeProductChangeAction(action, {
371
- variant: variantFallback
372
- });
373
- return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
374
- };
375
- var VariantUpdateBlock = ({
376
- variantId,
377
- diffs,
378
- variantsById
379
- }) => {
380
- const { t } = useTranslation2();
381
- const found = variantsById.get(variantId);
382
- const title = found?.title || found?.sku || variantId || t("fields.variant", { defaultValue: "Variant" });
383
- const images = isImageList(found?.images) ? found?.images : void 0;
384
- return /* @__PURE__ */ jsxs2(
385
- "div",
386
- {
387
- className: "flex flex-col gap-y-3",
388
- "data-testid": `product-active-edit-variant-${variantId}`,
389
- children: [
390
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
391
- images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
392
- /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
393
- /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: t("products.edits.panel.variantUpdated", {
394
- defaultValue: "Variant updated"
395
- }) }),
396
- ": ",
397
- title
398
- ] })
399
- ] }),
400
- /* @__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}`)) })
401
- ]
402
- }
403
- );
404
- };
405
- var ProductActiveEditSection = ({
406
- product
407
- }) => {
408
- const { t } = useTranslation2();
409
- const [confirmOpen, setConfirmOpen] = useState2(false);
410
- const [rejectOpen, setRejectOpen] = useState2(false);
411
- const { product_change, isError } = useProductChange(product.id, {
412
- retry: false
413
- });
414
- const requesterId = product_change?.created_by ?? "";
415
- const { seller: requesterSeller } = useSeller(requesterId, void 0, {
416
- enabled: !!requesterId
417
- });
418
- const { mutateAsync: confirmChange, isPending: isConfirming } = useConfirmProductChange(product_change?.id ?? "", product.id);
419
- const { mutateAsync: cancelChange, isPending: isRejecting } = useCancelProductChange(product_change?.id ?? "", product.id);
420
- const { updated, added, removed, deleteRequested } = useMemo(
421
- () => partitionProductChangeActions(product_change?.actions ?? []),
422
- [product_change]
423
- );
424
- const productUpdated = useMemo(
425
- () => updated.filter((d) => !d.variant_id),
426
- [updated]
427
- );
428
- const variantsUpdated = useMemo(() => {
429
- const groups = /* @__PURE__ */ new Map();
430
- for (const diff of updated) {
431
- if (!diff.variant_id) continue;
432
- const bucket = groups.get(diff.variant_id) ?? [];
433
- bucket.push(diff);
434
- groups.set(diff.variant_id, bucket);
435
- }
436
- return groups;
437
- }, [updated]);
438
- const attributeIds = useMemo(() => {
439
- const ids = /* @__PURE__ */ new Set();
440
- for (const action of [...added, ...removed]) {
441
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
442
- const details = action.details ?? {};
443
- if (details.attribute_id) ids.add(details.attribute_id);
444
- }
445
- }
446
- return Array.from(ids);
447
- }, [added, removed]);
448
- const attributeQueries = useQueries({
449
- queries: attributeIds.map((id) => ({
450
- queryKey: productAttributesQueryKeys.detail(id),
451
- queryFn: () => sdk.admin.productAttributes.$id.query({ $id: id })
452
- }))
453
- });
454
- const isLoadingAttributes = attributeQueries.some((q) => q.isPending);
455
- const variantIds = useMemo(() => {
456
- const ids = /* @__PURE__ */ new Set();
457
- for (const action of removed) {
458
- if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
459
- const details = action.details ?? {};
460
- if (details.variant_id) ids.add(details.variant_id);
461
- }
462
- }
463
- for (const diff of updated) {
464
- if (diff.variant_id) ids.add(diff.variant_id);
465
- }
466
- return Array.from(ids);
467
- }, [removed, updated]);
468
- const variantQueryInput = { fields: VARIANT_LOOKUP_FIELDS };
469
- const variantQueries = useQueries({
470
- queries: variantIds.map((variantId) => ({
471
- queryKey: variantsQueryKeys.detail(variantId, variantQueryInput),
472
- queryFn: () => sdk.admin.products.$id.variants.$variantId.query({
473
- $id: product.id,
474
- $variantId: variantId,
475
- ...variantQueryInput
476
- })
477
- }))
478
- });
479
- const isLoadingVariants = variantQueries.some((q) => q.isPending);
480
- const variantsById = useMemo(() => {
481
- const map = /* @__PURE__ */ new Map();
482
- for (const query of variantQueries) {
483
- const variant = query.data?.variant;
484
- if (variant?.id) map.set(variant.id, variant);
485
- }
486
- return map;
487
- }, [variantQueries]);
488
- if (isError || !product_change) {
489
- return null;
490
- }
491
- if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
492
- return null;
493
- }
494
- if (isLoadingAttributes || isLoadingVariants) {
495
- return null;
496
- }
497
- const hasContent = productUpdated.length > 0 || variantsUpdated.size > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
498
- const handleConfirm = async (note) => {
499
- try {
500
- await confirmChange({ internal_note: note });
501
- toast.success(t("products.edits.toast.confirmedSuccessfully"));
502
- setConfirmOpen(false);
503
- } catch (e) {
504
- toast.error(e.message);
505
- }
506
- };
507
- const handleReject = async (note) => {
508
- try {
509
- await cancelChange({ internal_note: note });
510
- toast.success(t("products.edits.toast.rejectedSuccessfully"));
511
- setRejectOpen(false);
512
- } catch (e) {
513
- toast.error(e.message);
514
- }
515
- };
516
- return /* @__PURE__ */ jsxs2(
517
- Container,
518
- {
519
- className: "divide-y p-0",
520
- "data-testid": "product-active-edit-section",
521
- children: [
522
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 px-6 py-4", children: [
523
- /* @__PURE__ */ jsx2(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
524
- /* @__PURE__ */ jsx2(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
525
- ] }),
526
- /* @__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", {
527
- store: requesterSeller?.name ?? t("products.request.fallbackStore")
528
- }) }) }),
529
- hasContent && /* @__PURE__ */ jsxs2(Fragment2, { children: [
530
- productUpdated.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
531
- /* @__PURE__ */ jsx2(
532
- Text,
533
- {
534
- size: "small",
535
- weight: "plus",
536
- leading: "compact",
537
- className: "text-ui-fg-subtle w-[160px] shrink-0",
538
- children: t("labels.updated")
539
- }
540
- ),
541
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-4", children: productUpdated.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${diff.field}-${idx}`)) })
542
- ] }),
543
- variantsUpdated.size > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
544
- /* @__PURE__ */ jsx2(
545
- Text,
546
- {
547
- size: "small",
548
- weight: "plus",
549
- leading: "compact",
550
- className: "text-ui-fg-subtle w-[160px] shrink-0",
551
- children: t("labels.updated")
552
- }
553
- ),
554
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-6", children: Array.from(variantsUpdated.entries()).map(
555
- ([variantId, diffs]) => /* @__PURE__ */ jsx2(
556
- VariantUpdateBlock,
557
- {
558
- variantId,
559
- diffs,
560
- variantsById
561
- },
562
- variantId
563
- )
564
- ) })
565
- ] }),
566
- added.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
567
- /* @__PURE__ */ jsx2(
568
- Text,
569
- {
570
- size: "small",
571
- weight: "plus",
572
- leading: "compact",
573
- className: "text-ui-fg-subtle w-[160px] shrink-0",
574
- children: t("labels.added")
575
- }
576
- ),
577
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx2(
578
- ActionLine,
579
- {
580
- action,
581
- variantsById
582
- },
583
- action.id
584
- )) })
585
- ] }),
586
- removed.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
587
- /* @__PURE__ */ jsx2(
588
- Text,
589
- {
590
- size: "small",
591
- weight: "plus",
592
- leading: "compact",
593
- className: "text-ui-fg-subtle w-[160px] shrink-0",
594
- children: t("labels.removed")
595
- }
596
- ),
597
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx2(
598
- ActionLine,
599
- {
600
- action,
601
- variantsById
602
- },
603
- action.id
604
- )) })
605
- ] }),
606
- deleteRequested && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
607
- /* @__PURE__ */ jsx2(
608
- Text,
609
- {
610
- size: "small",
611
- weight: "plus",
612
- leading: "compact",
613
- className: "text-ui-fg-subtle w-[160px] shrink-0",
614
- children: t("labels.removed")
615
- }
616
- ),
617
- /* @__PURE__ */ jsx2(
618
- Text,
619
- {
620
- size: "small",
621
- leading: "compact",
622
- className: "text-ui-fg-subtle flex-1",
623
- children: t("products.edits.panel.deleteRequested")
624
- }
625
- )
626
- ] })
627
- ] }),
628
- /* @__PURE__ */ jsxs2(
629
- "div",
630
- {
631
- className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
632
- "data-testid": "product-active-edit-actions",
633
- children: [
634
- /* @__PURE__ */ jsx2(
635
- Button,
636
- {
637
- size: "small",
638
- variant: "secondary",
639
- onClick: () => setConfirmOpen(true),
640
- "data-testid": "product-active-edit-confirm-button",
641
- children: t("actions.confirm")
642
- }
643
- ),
644
- /* @__PURE__ */ jsx2(
645
- Button,
646
- {
647
- size: "small",
648
- variant: "secondary",
649
- onClick: () => setRejectOpen(true),
650
- "data-testid": "product-active-edit-reject-button",
651
- children: t("products.edits.actions.reject")
652
- }
653
- )
654
- ]
655
- }
656
- ),
657
- /* @__PURE__ */ jsx2(
658
- ConfirmPrompt,
659
- {
660
- open: confirmOpen,
661
- onOpenChange: setConfirmOpen,
662
- title: t("products.edits.confirmPrompt.title"),
663
- description: t("products.edits.confirmPrompt.description"),
664
- noteLabel: t("products.edits.confirmPrompt.noteLabel"),
665
- noteOptional: true,
666
- notePlaceholder: t("products.edits.confirmPrompt.notePlaceholder"),
667
- isLoading: isConfirming,
668
- onConfirm: handleConfirm
669
- }
670
- ),
671
- /* @__PURE__ */ jsx2(
672
- ConfirmPrompt,
673
- {
674
- open: rejectOpen,
675
- onOpenChange: setRejectOpen,
676
- title: t("products.edits.rejectPrompt.title"),
677
- description: t("products.edits.rejectPrompt.description"),
678
- noteLabel: t("products.edits.rejectPrompt.noteLabel"),
679
- noteOptional: true,
680
- notePlaceholder: t("products.edits.rejectPrompt.notePlaceholder"),
681
- confirmLabel: t("products.edits.rejectPrompt.confirm"),
682
- isLoading: isRejecting,
683
- onConfirm: handleReject
684
- }
685
- )
686
- ]
687
- }
688
- );
689
- };
690
-
691
- // src/pages/products/product-detail/components/product-active-request-section/product-active-request-section.tsx
692
- var import_types2 = __toESM(require_dist(), 1);
693
- import { useState as useState3 } from "react";
694
- import { Button as Button2, Container as Container2, Heading as Heading2, Text as Text2, toast as toast2 } from "@medusajs/ui";
695
- import { ExclamationCircleSolid as ExclamationCircleSolid2 } from "@medusajs/icons";
696
- import { useTranslation as useTranslation3 } from "react-i18next";
697
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
698
- var ProductActiveRequestSection = ({
699
- product
700
- }) => {
701
- const { t } = useTranslation3();
702
- const [confirmOpen, setConfirmOpen] = useState3(false);
703
- const [requestUpdateOpen, setRequestUpdateOpen] = useState3(false);
704
- const [rejectOpen, setRejectOpen] = useState3(false);
705
- const { mutateAsync: confirmProduct, isPending: isConfirming } = useConfirmProduct(product.id);
706
- const { mutateAsync: requestProductChanges, isPending: isRequestingUpdate } = useRequestProductChanges(product.id);
707
- const { mutateAsync: rejectProduct, isPending: isRejecting } = useRejectProduct(product.id);
708
- if (product.status !== import_types2.ProductStatus.PROPOSED) {
709
- return null;
710
- }
711
- const handleConfirm = async (note) => {
712
- try {
713
- await confirmProduct({ internal_note: note });
714
- toast2.success(t("products.request.toast.publishedSuccessfully"));
715
- setConfirmOpen(false);
716
- } catch (e) {
717
- toast2.error(e.message);
718
- }
719
- };
720
- const handleRequestUpdate = async (note) => {
721
- try {
722
- await requestProductChanges({ message: note });
723
- toast2.success(t("products.request.toast.updateRequestedSuccessfully"));
724
- setRequestUpdateOpen(false);
725
- } catch (e) {
726
- toast2.error(e.message);
727
- }
728
- };
729
- const handleReject = async (note) => {
730
- try {
731
- await rejectProduct({ message: note });
732
- toast2.success(t("products.request.toast.rejectedSuccessfully"));
733
- setRejectOpen(false);
734
- } catch (e) {
735
- toast2.error(e.message);
736
- }
737
- };
738
- return /* @__PURE__ */ jsxs3(
739
- Container2,
740
- {
741
- className: "divide-y p-0",
742
- "data-testid": "product-active-request-section",
743
- children: [
744
- /* @__PURE__ */ jsxs3(
745
- "div",
746
- {
747
- className: "flex items-center gap-2 px-6 py-4",
748
- "data-testid": "product-active-request-header",
749
- children: [
750
- /* @__PURE__ */ jsx3(ExclamationCircleSolid2, { className: "text-ui-fg-interactive" }),
751
- /* @__PURE__ */ jsx3(Heading2, { level: "h2", "data-testid": "product-active-request-heading", children: t("products.request.panel.title") })
752
- ]
753
- }
754
- ),
755
- /* @__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", {
756
- store: product.sellers?.[0]?.name ?? t("products.request.fallbackStore")
757
- }) }) }),
758
- /* @__PURE__ */ jsxs3(
759
- "div",
760
- {
761
- className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
762
- "data-testid": "product-active-request-actions",
763
- children: [
764
- /* @__PURE__ */ jsx3(
765
- Button2,
766
- {
767
- size: "small",
768
- variant: "secondary",
769
- onClick: () => setConfirmOpen(true),
770
- "data-testid": "product-active-request-confirm-button",
771
- children: t("actions.confirm")
772
- }
773
- ),
774
- /* @__PURE__ */ jsx3(
775
- Button2,
776
- {
777
- size: "small",
778
- variant: "secondary",
779
- onClick: () => setRequestUpdateOpen(true),
780
- "data-testid": "product-active-request-request-update-button",
781
- children: t("products.request.actions.requestUpdate")
782
- }
783
- ),
784
- /* @__PURE__ */ jsx3(
785
- Button2,
786
- {
787
- size: "small",
788
- variant: "secondary",
789
- onClick: () => setRejectOpen(true),
790
- "data-testid": "product-active-request-reject-button",
791
- children: t("products.request.actions.reject")
792
- }
793
- )
794
- ]
795
- }
796
- ),
797
- /* @__PURE__ */ jsx3(
798
- ConfirmPrompt,
799
- {
800
- open: confirmOpen,
801
- onOpenChange: setConfirmOpen,
802
- title: t("products.request.confirmPrompt.title"),
803
- description: t("products.request.confirmPrompt.description"),
804
- noteLabel: t("products.request.confirmPrompt.noteLabel"),
805
- noteOptional: true,
806
- notePlaceholder: t("products.request.confirmPrompt.notePlaceholder"),
807
- isLoading: isConfirming,
808
- onConfirm: handleConfirm
809
- }
810
- ),
811
- /* @__PURE__ */ jsx3(
812
- ConfirmPrompt,
813
- {
814
- open: requestUpdateOpen,
815
- onOpenChange: setRequestUpdateOpen,
816
- title: t("products.request.requestUpdatePrompt.title"),
817
- description: t("products.request.requestUpdatePrompt.description"),
818
- noteLabel: t("products.request.requestUpdatePrompt.noteLabel"),
819
- noteOptional: true,
820
- notePlaceholder: t(
821
- "products.request.requestUpdatePrompt.notePlaceholder"
822
- ),
823
- confirmLabel: t("products.request.requestUpdatePrompt.send"),
824
- isLoading: isRequestingUpdate,
825
- onConfirm: handleRequestUpdate
826
- }
827
- ),
828
- /* @__PURE__ */ jsx3(
829
- ConfirmPrompt,
830
- {
831
- open: rejectOpen,
832
- onOpenChange: setRejectOpen,
833
- title: t("products.request.rejectPrompt.title"),
834
- description: t("products.request.rejectPrompt.description"),
835
- noteLabel: t("products.request.rejectPrompt.noteLabel"),
836
- noteOptional: true,
837
- notePlaceholder: t("products.request.rejectPrompt.notePlaceholder"),
838
- confirmLabel: t("products.request.rejectPrompt.confirm"),
839
- isLoading: isRejecting,
840
- onConfirm: handleReject
841
- }
842
- )
843
- ]
844
- }
845
- );
846
- };
847
-
848
- // src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
849
- import {
850
- ListBullet,
851
- Plus,
852
- Trash,
853
- Swatch,
854
- DropCap,
855
- InformationCircleSolid
856
- } from "@medusajs/icons";
857
- import {
858
- Badge,
859
- Container as Container3,
860
- Heading as Heading3,
861
- Text as Text3,
862
- toast as toast3,
863
- Tooltip,
864
- usePrompt
865
- } from "@medusajs/ui";
866
- import { useTranslation as useTranslation4 } from "react-i18next";
867
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
868
- var AttributeActions = ({
869
- productId,
870
- attribute
871
- }) => {
872
- const { t } = useTranslation4();
873
- const prompt = usePrompt();
874
- const { mutateAsync } = useRemoveAttributeFromProduct(productId, attribute.id);
875
- const handleDelete = async () => {
876
- const res = await prompt({
877
- title: t("general.areYouSure"),
878
- description: t("products.deleteAttributeWarning", {
879
- title: attribute.name
880
- }),
881
- confirmText: t("actions.delete"),
882
- cancelText: t("actions.cancel")
883
- });
884
- if (!res) {
885
- return;
886
- }
887
- await mutateAsync(void 0, {
888
- onError: (error) => {
889
- toast3.error(error.message);
890
- }
891
- });
892
- };
893
- return /* @__PURE__ */ jsx4(
894
- ActionMenu,
895
- {
896
- groups: [
897
- {
898
- actions: [
899
- {
900
- label: t("actions.delete"),
901
- onClick: handleDelete,
902
- icon: /* @__PURE__ */ jsx4(Trash, {})
903
- }
904
- ]
905
- }
906
- ]
907
- }
908
- );
909
- };
910
- var AttributeGroup = ({
911
- icon,
912
- title,
913
- description,
914
- attributes,
915
- productId
916
- }) => {
917
- const { t } = useTranslation4();
918
- if (!attributes.length) {
919
- return null;
920
- }
921
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
922
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-3 px-3", children: [
923
- /* @__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 }),
924
- /* @__PURE__ */ jsxs4("div", { children: [
925
- /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
926
- /* @__PURE__ */ jsx4(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
927
- ] })
928
- ] }),
929
- /* @__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) => {
930
- const values = attr.values?.map((v) => v.name) ?? [];
931
- return /* @__PURE__ */ jsx4(
932
- "div",
933
- {
934
- className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
935
- children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 px-4 py-3 bg-ui-bg-component", children: [
936
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
937
- /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
938
- attr.description && /* @__PURE__ */ jsx4(Tooltip, { content: attr.description, children: /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx4(InformationCircleSolid, {}) }) }),
939
- 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, {}) }) })
940
- ] }),
941
- /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx4(
942
- Badge,
943
- {
944
- size: "2xsmall",
945
- className: "flex min-w-[20px] items-center justify-center",
946
- children: val
947
- },
948
- val
949
- )) : /* @__PURE__ */ jsx4(
950
- Text3,
951
- {
952
- size: "small",
953
- leading: "compact",
954
- className: "text-ui-fg-subtle",
955
- children: values.join(", ") || "-"
956
- }
957
- ) }),
958
- /* @__PURE__ */ jsx4(AttributeActions, { productId, attribute: attr })
959
- ] })
960
- },
961
- attr.id
962
- );
963
- }) }) })
964
- ] });
965
- };
966
- var ProductAttributeSection = ({
967
- product
968
- }) => {
969
- const { t } = useTranslation4();
970
- const allAttributes = product.attributes ?? [];
971
- const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
972
- const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
973
- const isEmpty = !variantAttributes.length && !infoAttributes.length;
974
- return /* @__PURE__ */ jsxs4(Container3, { className: "p-0", children: [
975
- /* @__PURE__ */ jsxs4(
976
- "div",
977
- {
978
- className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
979
- children: [
980
- /* @__PURE__ */ jsx4(Heading3, { level: "h2", children: t("products.attributes") }),
981
- /* @__PURE__ */ jsx4(
982
- ActionMenu,
983
- {
984
- groups: [
985
- {
986
- actions: [
987
- {
988
- label: t("products.create.attributes.addExisting"),
989
- to: "attributes/add",
990
- icon: /* @__PURE__ */ jsx4(ListBullet, {})
991
- },
992
- {
993
- label: t("products.create.attributes.createNew"),
994
- to: "attributes/create",
995
- icon: /* @__PURE__ */ jsx4(Plus, {})
996
- }
997
- ]
998
- }
999
- ]
1000
- }
1001
- )
1002
- ]
1003
- }
1004
- ),
1005
- variantAttributes.length > 0 && /* @__PURE__ */ jsx4(
1006
- AttributeGroup,
1007
- {
1008
- icon: /* @__PURE__ */ jsx4(Swatch, {}),
1009
- title: t("products.create.tabs.variants"),
1010
- description: t("products.attributeVariantsDescription"),
1011
- attributes: variantAttributes,
1012
- productId: product.id
1013
- }
1014
- ),
1015
- variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx4("div", { className: "border-t border-dashed border-ui-border-base" }),
1016
- infoAttributes.length > 0 && /* @__PURE__ */ jsx4(
1017
- AttributeGroup,
1018
- {
1019
- icon: /* @__PURE__ */ jsx4(DropCap, {}),
1020
- title: t("products.attributeProductInformation"),
1021
- description: t("products.attributeProductInformationDescription"),
1022
- attributes: infoAttributes,
1023
- productId: product.id
1024
- }
1025
- )
1026
- ] });
1027
- };
1028
-
1029
- // src/pages/products/product-detail/components/product-general-section/product-general-section.tsx
1030
- import { PencilSquare, Trash as Trash2 } from "@medusajs/icons";
1031
- import { Container as Container4, Heading as Heading4, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
1032
- import { useTranslation as useTranslation5 } from "react-i18next";
1033
- import { useNavigate } from "react-router-dom";
1034
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1035
- var productStatusColor = (status) => {
1036
- switch (status) {
1037
- case "draft":
1038
- return "grey";
1039
- case "proposed":
1040
- return "orange";
1041
- case "published":
1042
- return "green";
1043
- case "rejected":
1044
- return "red";
1045
- default:
1046
- return "grey";
1047
- }
1048
- };
1049
- var ProductGeneralSection = ({
1050
- product
1051
- }) => {
1052
- const { t } = useTranslation5();
1053
- const prompt = usePrompt2();
1054
- const navigate = useNavigate();
1055
- const { mutateAsync } = useDeleteProduct(product.id);
1056
- const handleDelete = async () => {
1057
- const res = await prompt({
1058
- title: t("general.areYouSure"),
1059
- description: t("products.deleteWarning", {
1060
- title: product.title
1061
- }),
1062
- confirmText: t("actions.delete"),
1063
- cancelText: t("actions.cancel")
1064
- });
1065
- if (!res) {
1066
- return;
1067
- }
1068
- await mutateAsync(void 0, {
1069
- onSuccess: () => {
1070
- navigate("..");
1071
- }
1072
- });
1073
- };
1074
- return /* @__PURE__ */ jsxs5(Container4, { className: "divide-y p-0", "data-testid": "product-general-section", children: [
1075
- /* @__PURE__ */ jsxs5(
1076
- "div",
1077
- {
1078
- className: "flex items-center justify-between px-6 py-4",
1079
- "data-testid": "product-general-header",
1080
- children: [
1081
- /* @__PURE__ */ jsx5(Heading4, { "data-testid": "product-general-title", children: product.title }),
1082
- /* @__PURE__ */ jsxs5(
1083
- "div",
1084
- {
1085
- className: "flex items-center gap-x-4",
1086
- "data-testid": "product-general-actions",
1087
- children: [
1088
- /* @__PURE__ */ jsx5(
1089
- StatusBadge,
1090
- {
1091
- color: productStatusColor(product.status),
1092
- "data-testid": "product-status-badge",
1093
- children: t(`products.productStatus.${product.status}`)
1094
- }
1095
- ),
1096
- /* @__PURE__ */ jsx5(
1097
- ActionMenu,
1098
- {
1099
- groups: [
1100
- {
1101
- actions: [
1102
- {
1103
- label: t("actions.edit"),
1104
- to: "edit",
1105
- icon: /* @__PURE__ */ jsx5(PencilSquare, {})
1106
- }
1107
- ]
1108
- },
1109
- {
1110
- actions: [
1111
- {
1112
- label: t("actions.delete"),
1113
- onClick: handleDelete,
1114
- icon: /* @__PURE__ */ jsx5(Trash2, {})
1115
- }
1116
- ]
1117
- }
1118
- ],
1119
- "data-testid": "product-general-action-menu"
1120
- }
1121
- )
1122
- ]
1123
- }
1124
- )
1125
- ]
1126
- }
1127
- ),
1128
- /* @__PURE__ */ jsx5(
1129
- SectionRow,
1130
- {
1131
- title: t("fields.description"),
1132
- value: product.description,
1133
- "data-testid": "product-description-row"
1134
- }
1135
- ),
1136
- /* @__PURE__ */ jsx5(
1137
- SectionRow,
1138
- {
1139
- title: t("fields.subtitle"),
1140
- value: product.subtitle,
1141
- "data-testid": "product-subtitle-row"
1142
- }
1143
- ),
1144
- /* @__PURE__ */ jsx5(
1145
- SectionRow,
1146
- {
1147
- title: t("fields.handle"),
1148
- value: `/${product.handle}`,
1149
- "data-testid": "product-handle-row"
1150
- }
1151
- ),
1152
- /* @__PURE__ */ jsx5(
1153
- SectionRow,
1154
- {
1155
- title: t("fields.discountable"),
1156
- value: product.discountable ? t("fields.true") : t("fields.false"),
1157
- "data-testid": "product-discountable-row"
1158
- }
1159
- )
1160
- ] });
1161
- };
1162
-
1163
- // src/pages/products/product-detail/components/product-media-section/product-media-section.tsx
1164
- import { PencilSquare as PencilSquare2, ThumbnailBadge } from "@medusajs/icons";
1165
- import {
1166
- Button as Button3,
1167
- Checkbox,
1168
- CommandBar,
1169
- Container as Container5,
1170
- Heading as Heading5,
1171
- Text as Text4,
1172
- Tooltip as Tooltip2,
1173
- clx,
1174
- usePrompt as usePrompt3
1175
- } from "@medusajs/ui";
1176
- import { useState as useState4 } from "react";
1177
- import { useTranslation as useTranslation6 } from "react-i18next";
1178
- import { Link } from "react-router-dom";
1179
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1180
- var ProductMediaSection = ({
1181
- product
1182
- }) => {
1183
- const { t } = useTranslation6();
1184
- const prompt = usePrompt3();
1185
- const [selection, setSelection] = useState4({});
1186
- const media = getMedia(product);
1187
- const handleCheckedChange = (id) => {
1188
- setSelection((prev) => {
1189
- if (prev[id]) {
1190
- const { [id]: _, ...rest } = prev;
1191
- return rest;
1192
- } else {
1193
- return { ...prev, [id]: true };
1194
- }
1195
- });
1196
- };
1197
- const { mutateAsync } = useUpdateProduct(product.id);
1198
- const handleDelete = async () => {
1199
- const ids = Object.keys(selection);
1200
- const includingThumbnail = ids.some(
1201
- (id) => media.find((m) => m.id === id)?.isThumbnail
1202
- );
1203
- const res = await prompt({
1204
- title: t("general.areYouSure"),
1205
- description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
1206
- count: ids.length
1207
- }) : t("products.media.deleteWarning", {
1208
- count: ids.length
1209
- }),
1210
- confirmText: t("actions.delete"),
1211
- cancelText: t("actions.cancel")
1212
- });
1213
- if (!res) {
1214
- return;
1215
- }
1216
- const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
1217
- await mutateAsync(
1218
- {
1219
- images: mediaToKeep,
1220
- thumbnail: includingThumbnail ? "" : void 0
1221
- },
1222
- {
1223
- onSuccess: () => {
1224
- setSelection({});
1225
- }
1226
- }
1227
- );
1228
- };
1229
- return /* @__PURE__ */ jsxs6(Container5, { className: "divide-y p-0", "data-testid": "product-media-section", children: [
1230
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-media-header", children: [
1231
- /* @__PURE__ */ jsx6(Heading5, { level: "h2", "data-testid": "product-media-title", children: t("products.media.label") }),
1232
- /* @__PURE__ */ jsx6(
1233
- ActionMenu,
1234
- {
1235
- groups: [
1236
- {
1237
- actions: [
1238
- {
1239
- label: t("actions.edit"),
1240
- to: "media?view=edit",
1241
- icon: /* @__PURE__ */ jsx6(PencilSquare2, {})
1242
- }
1243
- ]
1244
- }
1245
- ],
1246
- "data-testid": "product-media-action-menu"
1247
- }
1248
- )
1249
- ] }),
1250
- 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) => {
1251
- const isSelected = selection[i.id];
1252
- return /* @__PURE__ */ jsxs6(
1253
- "div",
1254
- {
1255
- className: "shadow-elevation-card-rest hover:shadow-elevation-card-hover transition-fg group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px]",
1256
- "data-testid": `product-media-item-${i.id}`,
1257
- children: [
1258
- /* @__PURE__ */ jsx6(
1259
- "div",
1260
- {
1261
- className: clx(
1262
- "transition-fg invisible absolute right-2 top-2 opacity-0 group-hover:visible group-hover:opacity-100",
1263
- {
1264
- "visible opacity-100": isSelected
1265
- }
1266
- ),
1267
- "data-testid": `product-media-checkbox-container-${i.id}`,
1268
- children: /* @__PURE__ */ jsx6(
1269
- Checkbox,
1270
- {
1271
- checked: selection[i.id] || false,
1272
- onCheckedChange: () => handleCheckedChange(i.id),
1273
- "data-testid": `product-media-checkbox-${i.id}`
1274
- }
1275
- )
1276
- }
1277
- ),
1278
- 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, {}) }) }),
1279
- /* @__PURE__ */ jsx6(Link, { to: `media`, state: { curr: index }, "data-testid": `product-media-link-${i.id}`, children: /* @__PURE__ */ jsx6(
1280
- "img",
1281
- {
1282
- src: i.url,
1283
- alt: product.title,
1284
- className: "size-full object-cover",
1285
- "data-testid": `product-media-image-${i.id}`
1286
- }
1287
- ) })
1288
- ]
1289
- },
1290
- i.id
1291
- );
1292
- }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", "data-testid": "product-media-empty-state", children: [
1293
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center", children: [
1294
- /* @__PURE__ */ jsx6(
1295
- Text4,
1296
- {
1297
- size: "small",
1298
- leading: "compact",
1299
- weight: "plus",
1300
- className: "text-ui-fg-subtle",
1301
- "data-testid": "product-media-empty-state-header",
1302
- children: t("products.media.emptyState.header")
1303
- }
1304
- ),
1305
- /* @__PURE__ */ jsx6(Text4, { size: "small", className: "text-ui-fg-muted", "data-testid": "product-media-empty-state-description", children: t("products.media.emptyState.description") })
1306
- ] }),
1307
- /* @__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") }) })
1308
- ] }),
1309
- /* @__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: [
1310
- /* @__PURE__ */ jsx6(CommandBar.Value, { "data-testid": "product-media-command-bar-value", children: t("general.countSelected", {
1311
- count: Object.keys(selection).length
1312
- }) }),
1313
- /* @__PURE__ */ jsx6(CommandBar.Seperator, { "data-testid": "product-media-command-bar-separator" }),
1314
- /* @__PURE__ */ jsx6(
1315
- CommandBar.Command,
1316
- {
1317
- action: handleDelete,
1318
- label: t("actions.delete"),
1319
- shortcut: "d",
1320
- "data-testid": "product-media-command-bar-delete"
1321
- }
1322
- )
1323
- ] }) })
1324
- ] });
1325
- };
1326
- var getMedia = (product) => {
1327
- const { images = [], thumbnail } = product;
1328
- const media = images.map((image) => ({
1329
- id: image.id,
1330
- url: image.url,
1331
- isThumbnail: image.url === thumbnail
1332
- }));
1333
- if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
1334
- media.unshift({
1335
- id: "img_thumbnail",
1336
- url: thumbnail,
1337
- isThumbnail: true
1338
- });
1339
- }
1340
- return media;
1341
- };
1342
-
1343
- // src/pages/products/product-detail/components/product-organization-section/product-organization-section.tsx
1344
- import { PencilSquare as PencilSquare3 } from "@medusajs/icons";
1345
- import { Badge as Badge2, Container as Container6, Heading as Heading6, Tooltip as Tooltip3 } from "@medusajs/ui";
1346
- import { useTranslation as useTranslation7 } from "react-i18next";
1347
- import { Link as Link2 } from "react-router-dom";
1348
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1349
- var ProductOrganizationSection = ({
1350
- product
1351
- }) => {
1352
- const { t } = useTranslation7();
1353
- return /* @__PURE__ */ jsxs7(
1354
- Container6,
1355
- {
1356
- className: "divide-y p-0",
1357
- "data-testid": "product-organization-section",
1358
- children: [
1359
- /* @__PURE__ */ jsxs7(
1360
- "div",
1361
- {
1362
- className: "flex items-center justify-between px-6 py-4",
1363
- "data-testid": "product-organization-header",
1364
- children: [
1365
- /* @__PURE__ */ jsx7(Heading6, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
1366
- /* @__PURE__ */ jsx7(
1367
- ActionMenu,
1368
- {
1369
- groups: [
1370
- {
1371
- actions: [
1372
- {
1373
- label: t("actions.edit"),
1374
- to: "organization",
1375
- icon: /* @__PURE__ */ jsx7(PencilSquare3, {})
1376
- }
1377
- ]
1378
- }
1379
- ],
1380
- "data-testid": "product-organization-action-menu"
1381
- }
1382
- )
1383
- ]
1384
- }
1385
- ),
1386
- /* @__PURE__ */ jsx7(
1387
- SectionRow,
1388
- {
1389
- title: t("fields.tags"),
1390
- value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx7(
1391
- OrganizationTag,
1392
- {
1393
- label: tag.value,
1394
- to: `/settings/product-tags/${tag.id}`
1395
- },
1396
- tag.id
1397
- )) : void 0,
1398
- "data-testid": "product-tags-row"
1399
- }
1400
- ),
1401
- /* @__PURE__ */ jsx7(
1402
- SectionRow,
1403
- {
1404
- title: t("fields.type"),
1405
- value: product.type ? /* @__PURE__ */ jsx7(
1406
- OrganizationTag,
1407
- {
1408
- label: product.type.value,
1409
- to: `/settings/product-types/${product.type_id}`
1410
- }
1411
- ) : void 0,
1412
- "data-testid": "product-type-row"
1413
- }
1414
- ),
1415
- /* @__PURE__ */ jsx7(
1416
- SectionRow,
1417
- {
1418
- title: t("fields.collection"),
1419
- value: product.collection ? /* @__PURE__ */ jsx7(
1420
- OrganizationTag,
1421
- {
1422
- label: product.collection.title,
1423
- to: `/collections/${product.collection.id}`
1424
- }
1425
- ) : void 0,
1426
- "data-testid": "product-collection-row"
1427
- }
1428
- ),
1429
- /* @__PURE__ */ jsx7(
1430
- SectionRow,
1431
- {
1432
- title: t("fields.categories"),
1433
- value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx7(
1434
- OrganizationTag,
1435
- {
1436
- label: pcat.name,
1437
- to: `/categories/${pcat.id}`
1438
- },
1439
- pcat.id
1440
- )) : void 0,
1441
- "data-testid": "product-categories-row"
1442
- }
1443
- )
1444
- ]
1445
- }
1446
- );
1447
- };
1448
- var OrganizationTag = ({ label, to }) => {
1449
- return /* @__PURE__ */ jsx7(Tooltip3, { content: label, children: /* @__PURE__ */ jsx7(Badge2, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx7(
1450
- Link2,
1451
- {
1452
- to,
1453
- "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
1454
- children: label
1455
- }
1456
- ) }) });
1457
- };
1458
-
1459
- // src/pages/products/product-detail/components/product-variant-section/product-variant-section.tsx
1460
- import { useCallback, useMemo as useMemo2 } from "react";
1461
- import { PencilSquare as PencilSquare4, Trash as Trash3 } from "@medusajs/icons";
1462
- import {
1463
- Badge as Badge3,
1464
- Container as Container7,
1465
- createDataTableColumnHelper,
1466
- Tooltip as Tooltip4,
1467
- usePrompt as usePrompt4
1468
- } from "@medusajs/ui";
1469
- import { keepPreviousData } from "@tanstack/react-query";
1470
- import { useTranslation as useTranslation8 } from "react-i18next";
1471
- import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1472
- import { jsx as jsx8 } from "react/jsx-runtime";
1473
- var PAGE_SIZE = 10;
1474
- var PREFIX = "pv";
1475
- var ProductVariantSection = ({
1476
- product
1477
- }) => {
1478
- const { t } = useTranslation8();
1479
- const { q, order, offset, created_at, updated_at } = useQueryParams(
1480
- ["q", "order", "offset", "created_at", "updated_at"],
1481
- PREFIX
1482
- );
1483
- const columns = useColumns(product);
1484
- const filters = useFilters();
1485
- const { variants, count, isPending, isError, error } = useProductVariants(
1486
- product.id,
1487
- {
1488
- q,
1489
- order: order ? order : "variant_rank",
1490
- offset: offset ? parseInt(offset) : void 0,
1491
- limit: PAGE_SIZE,
1492
- created_at: created_at ? JSON.parse(created_at) : void 0,
1493
- updated_at: updated_at ? JSON.parse(updated_at) : void 0,
1494
- fields: "title,created_at,updated_at,*options,*options.option"
1495
- },
1496
- {
1497
- placeholderData: keepPreviousData
1498
- }
1499
- );
1500
- if (isError) {
1501
- throw error;
1502
- }
1503
- 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(
1504
- DataTable,
1505
- {
1506
- data: variants,
1507
- columns,
1508
- filters,
1509
- rowCount: count,
1510
- getRowId: (row) => row.id,
1511
- rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
1512
- pageSize: PAGE_SIZE,
1513
- isLoading: isPending,
1514
- heading: t("products.variants.header"),
1515
- emptyState: {
1516
- empty: {
1517
- heading: t("products.variants.empty.heading"),
1518
- description: t("products.variants.empty.description")
1519
- },
1520
- filtered: {
1521
- heading: t("products.variants.filtered.heading"),
1522
- description: t("products.variants.filtered.description")
1523
- }
1524
- },
1525
- action: {
1526
- label: t("actions.create"),
1527
- to: `variants/create`
1528
- },
1529
- prefix: PREFIX
1530
- }
1531
- ) }) });
1532
- };
1533
- var columnHelper = createDataTableColumnHelper();
1534
- var useColumns = (product) => {
1535
- const { t } = useTranslation8();
1536
- const navigate = useNavigate2();
1537
- const { mutateAsync } = useDeleteVariantLazy(product.id);
1538
- const prompt = usePrompt4();
1539
- const [searchParams] = useSearchParams();
1540
- const tableSearchParams = useMemo2(() => {
1541
- const filtered = new URLSearchParams();
1542
- for (const [key, value] of searchParams.entries()) {
1543
- if (key.startsWith(`${PREFIX}_`)) {
1544
- filtered.append(key, value);
1545
- }
1546
- }
1547
- return filtered;
1548
- }, [searchParams]);
1549
- const dateColumns = useDataTableDateColumns();
1550
- const handleDelete = useCallback(
1551
- async (id, title) => {
1552
- const res = await prompt({
1553
- title: t("general.areYouSure"),
1554
- description: t("products.deleteVariantWarning", {
1555
- title
1556
- }),
1557
- confirmText: t("actions.delete"),
1558
- cancelText: t("actions.cancel")
1559
- });
1560
- if (!res) {
1561
- return;
1562
- }
1563
- await mutateAsync({ variantId: id });
1564
- },
1565
- [mutateAsync, prompt, t]
1566
- );
1567
- const attributeColumns = useMemo2(() => {
1568
- const variantAttributes = product?.attributes?.filter((attr) => attr.is_variant_axis);
1569
- if (!variantAttributes?.length) {
1570
- return [];
1571
- }
1572
- return variantAttributes.map((attribute) => {
1573
- return columnHelper.display({
1574
- id: `attribute-${attribute.id}`,
1575
- header: attribute.name,
1576
- cell: ({ row }) => {
1577
- const variantOpt = row.original.options?.find(
1578
- (opt) => opt.option?.title === attribute.name
1579
- );
1580
- if (!variantOpt?.value) {
1581
- return /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1582
- }
1583
- return /* @__PURE__ */ jsx8(
1584
- "div",
1585
- {
1586
- className: "flex flex-wrap items-center gap-1",
1587
- "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1588
- children: /* @__PURE__ */ jsx8(Tooltip4, { content: variantOpt.value, children: /* @__PURE__ */ jsx8(
1589
- Badge3,
1590
- {
1591
- size: "2xsmall",
1592
- title: variantOpt.value,
1593
- className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1594
- "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${variantOpt.value}`,
1595
- children: variantOpt.value
1596
- }
1597
- ) })
1598
- }
1599
- );
1600
- }
1601
- });
1602
- });
1603
- }, [product]);
1604
- const getActions = useCallback(
1605
- (ctx) => {
1606
- const variant = ctx.row.original;
1607
- const mainActions = [
1608
- {
1609
- icon: /* @__PURE__ */ jsx8(PencilSquare4, {}),
1610
- label: t("actions.edit"),
1611
- onClick: (row) => {
1612
- navigate(
1613
- `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1614
- {
1615
- state: {
1616
- restore_params: tableSearchParams.toString()
1617
- }
1618
- }
1619
- );
1620
- }
1621
- }
1622
- ];
1623
- const secondaryActions = [
1624
- {
1625
- icon: /* @__PURE__ */ jsx8(Trash3, {}),
1626
- label: t("actions.delete"),
1627
- onClick: () => handleDelete(variant.id, variant.title)
1628
- }
1629
- ];
1630
- return [mainActions, secondaryActions];
1631
- },
1632
- [handleDelete, navigate, t, tableSearchParams]
1633
- );
1634
- return useMemo2(() => {
1635
- return [
1636
- columnHelper.accessor("title", {
1637
- header: t("fields.title"),
1638
- enableSorting: true,
1639
- sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1640
- sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1641
- }),
1642
- ...attributeColumns,
1643
- ...dateColumns,
1644
- columnHelper.action({
1645
- actions: getActions
1646
- })
1647
- ];
1648
- }, [t, attributeColumns, dateColumns, getActions]);
1649
- };
1650
- var useFilters = () => {
1651
- const dateFilters = useDataTableDateFilters();
1652
- return useMemo2(() => {
1653
- return [
1654
- ...dateFilters
1655
- ];
1656
- }, [dateFilters]);
1657
- };
1658
-
1659
- // src/pages/products/product-detail/product-detail.tsx
1660
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1661
- var Root = ({ children }) => {
1662
- const initialData = useLoaderData();
1663
- const { id } = useParams();
1664
- const {
1665
- product: rawProduct,
1666
- isLoading,
1667
- isError,
1668
- error
1669
- } = useProduct(id, PRODUCT_DETAIL_QUERY, {
1670
- initialData
1671
- });
1672
- const product = rawProduct;
1673
- if (isLoading || !product) {
1674
- return /* @__PURE__ */ jsx9(
1675
- TwoColumnPageSkeleton,
1676
- {
1677
- mainSections: 4,
1678
- sidebarSections: 3,
1679
- showJSON: true,
1680
- showMetadata: true
1681
- }
1682
- );
1683
- }
1684
- if (isError) {
1685
- throw error;
1686
- }
1687
- return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(
1688
- TwoColumnPage,
1689
- {
1690
- data: product,
1691
- showJSON: true,
1692
- showMetadata: true,
1693
- "data-testid": "product-detail-page",
1694
- children
1695
- }
1696
- ) : /* @__PURE__ */ jsxs8(
1697
- TwoColumnPage,
1698
- {
1699
- data: product,
1700
- showJSON: true,
1701
- showMetadata: true,
1702
- "data-testid": "product-detail-page",
1703
- children: [
1704
- /* @__PURE__ */ jsxs8(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1705
- /* @__PURE__ */ jsx9(ProductActiveRequestSection, { product }),
1706
- /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1707
- /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1708
- /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1709
- /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1710
- ] }),
1711
- /* @__PURE__ */ jsxs8(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1712
- /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1713
- /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1714
- ] })
1715
- ]
1716
- }
1717
- );
1718
- };
1719
- var ProductDetailPage = Object.assign(Root, {
1720
- Main: TwoColumnPage.Main,
1721
- Sidebar: TwoColumnPage.Sidebar,
1722
- MainActiveRequestSection: ProductActiveRequestSection,
1723
- MainActiveEditSection: ProductActiveEditSection,
1724
- MainGeneralSection: ProductGeneralSection,
1725
- MainMediaSection: ProductMediaSection,
1726
- MainAttributeSection: ProductAttributeSection,
1727
- MainVariantSection: ProductVariantSection,
1728
- SidebarOrganizationSection: ProductOrganizationSection
1729
- });
1730
-
1731
- export {
1732
- ProductDetailPage
1733
- };