@mercurjs/admin 2.2.0-canary.8 → 2.2.0-rc.0

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 (416) hide show
  1. package/dist/{add-campaign-promotions-RURZSD6G.js → add-campaign-promotions-QK73ARX4.js} +14 -14
  2. package/dist/{adjust-inventory-4PM2YZK3.js → adjust-inventory-X45NEQFK.js} +33 -33
  3. package/dist/{api-key-management-create-MRLR4WFZ.js → api-key-management-create-LOD37GOQ.js} +5 -5
  4. package/dist/{api-key-management-detail-BG7U2KCT.js → api-key-management-detail-HKNZPPR2.js} +36 -37
  5. package/dist/{api-key-management-edit-EZHFP3RR.js → api-key-management-edit-JP2GUMMJ.js} +5 -5
  6. package/dist/{api-key-management-list-OPANEDHB.js → api-key-management-list-5RXBJ24C.js} +9 -9
  7. package/dist/{api-key-management-sales-channels-PBL3V4IS.js → api-key-management-sales-channels-4GLVMHU6.js} +9 -10
  8. package/dist/{attribute-create-L6YA6HTF.js → attribute-create-VGL7LGIH.js} +56 -66
  9. package/dist/{attribute-create-possible-value-EXVHC272.js → attribute-create-possible-value-QFXKXZM4.js} +2 -2
  10. package/dist/{attribute-detail-Q3P7SCZ2.js → attribute-detail-EKDAYT4B.js} +56 -44
  11. package/dist/{attribute-edit-LUY66TG3.js → attribute-edit-OBNLNOJS.js} +7 -7
  12. package/dist/{attribute-edit-possible-value-IOS3625C.js → attribute-edit-possible-value-QDFVWLA3.js} +5 -5
  13. package/dist/{attribute-edit-ranking-7AAAYEC7.js → attribute-edit-ranking-YGR3KCSC.js} +3 -3
  14. package/dist/attribute-list-6A72PBIY.js +61 -0
  15. package/dist/breadcrumb-GHBR74WM.js +27 -0
  16. package/dist/breadcrumb-IEEJTH47.js +26 -0
  17. package/dist/{campaign-budget-edit-WKSYXTBX.js → campaign-budget-edit-NONE5NMV.js} +3 -3
  18. package/dist/{campaign-configuration-ZTK46EB5.js → campaign-configuration-JYSVIQFE.js} +3 -3
  19. package/dist/{campaign-create-7BELREFT.js → campaign-create-6U2PONHA.js} +7 -7
  20. package/dist/{campaign-detail-JFNFC6FY.js → campaign-detail-RNB3FEJZ.js} +41 -41
  21. package/dist/{campaign-edit-ZGLDY4X4.js → campaign-edit-MAS3DCFB.js} +3 -3
  22. package/dist/{campaign-list-NQGNOFVZ.js → campaign-list-CDV4GWWD.js} +7 -7
  23. package/dist/{categories-metadata-5THJAHOA.js → categories-metadata-4LXL2PWA.js} +34 -34
  24. package/dist/{category-create-QPQQGIEN.js → category-create-AIS2MG7E.js} +10 -7
  25. package/dist/{category-detail-7Y76K4I5.js → category-detail-557376TZ.js} +46 -44
  26. package/dist/{category-edit-DJP7TK4X.js → category-edit-LYR2IOTA.js} +7 -6
  27. package/dist/category-icon-edit-W2TPCSDC.js +117 -0
  28. package/dist/{category-list-T5SE63HU.js → category-list-XKRI24VN.js} +12 -9
  29. package/dist/category-media-PC4V7YU4.js +655 -0
  30. package/dist/{category-organize-DQQGAAJY.js → category-organize-H4JYCHDA.js} +3 -3
  31. package/dist/{category-products-T525MDHE.js → category-products-44PCDDNN.js} +48 -47
  32. package/dist/{chunk-A7JOHU6Q.js → chunk-25U23TXK.js} +2 -2
  33. package/dist/{chunk-Q23KHB6V.js → chunk-2FPQHWJZ.js} +3 -3
  34. package/dist/{chunk-WQFFCK3R.js → chunk-2V74T2WI.js} +1 -1
  35. package/dist/{chunk-3UKIBKFD.js → chunk-2Z2M5K5A.js} +4 -4
  36. package/dist/{chunk-26UTIAAZ.js → chunk-32URSQ4F.js} +1 -1
  37. package/dist/{chunk-DWCBB4QM.js → chunk-32ZNZDFT.js} +4 -4
  38. package/dist/{chunk-FJLKDTNA.js → chunk-3BTRS4AA.js} +81 -64
  39. package/dist/{chunk-VKOE5J66.js → chunk-3XOE4NV5.js} +11 -2
  40. package/dist/{chunk-HJKZBCDB.js → chunk-4346EIRG.js} +5 -5
  41. package/dist/{chunk-J4MAIN7L.js → chunk-4BCUGMOR.js} +2 -2
  42. package/dist/{chunk-CVFVEDMV.js → chunk-4BPQNCF5.js} +2 -2
  43. package/dist/chunk-4C7L7TJT.js +87 -0
  44. package/dist/{chunk-JSMUFZZN.js → chunk-56UFDHNO.js} +1 -1
  45. package/dist/{chunk-2666PZI5.js → chunk-5ACJR6WB.js} +5 -5
  46. package/dist/{chunk-JQV7CXEC.js → chunk-5BSSIDW6.js} +17 -2
  47. package/dist/{chunk-CPXK5RSJ.js → chunk-5Y2AIJ2T.js} +1 -1
  48. package/dist/{chunk-BGQ7H2KL.js → chunk-65YE4SVL.js} +5 -4
  49. package/dist/chunk-6BAPAIQM.js +8 -0
  50. package/dist/{chunk-IAWZQKUH.js → chunk-6BWJWA2F.js} +2 -2
  51. package/dist/{chunk-FB7DDNCA.js → chunk-6DJQITWV.js} +4 -4
  52. package/dist/{chunk-MU63NHPX.js → chunk-6KWWJE5P.js} +25 -16
  53. package/dist/{chunk-NQEXDLYH.js → chunk-6ZVV2XHU.js} +28 -9
  54. package/dist/{chunk-NC46O6TE.js → chunk-7O7LYBHL.js} +8 -8
  55. package/dist/chunk-7OKYEA6I.js +283 -0
  56. package/dist/{chunk-GKGLVDDV.js → chunk-A2F5MDPU.js} +1 -1
  57. package/dist/{chunk-LYREZINJ.js → chunk-ABS7HMLY.js} +2 -2
  58. package/dist/{chunk-X45JKZYW.js → chunk-AMZ2QSSI.js} +6 -6
  59. package/dist/{chunk-XJ3WC4G7.js → chunk-BF7X4JQT.js} +2 -2
  60. package/dist/{chunk-3VTAK3S6.js → chunk-BFUHW56P.js} +4 -4
  61. package/dist/{chunk-LEG67A2R.js → chunk-BILFRATX.js} +1 -10
  62. package/dist/{chunk-MKBCBAS2.js → chunk-BLR3NTU6.js} +76 -23
  63. package/dist/{chunk-2ZRWLCYP.js → chunk-BNFTJW4L.js} +2 -2
  64. package/dist/{chunk-QJUWQDTX.js → chunk-BTJR5RSV.js} +11 -11
  65. package/dist/chunk-BVIIRGSW.js +204 -0
  66. package/dist/chunk-BW7BDHZV.js +34 -0
  67. package/dist/{chunk-LYZT5REU.js → chunk-C4XKPQ6T.js} +14 -1
  68. package/dist/{chunk-N6SI4IIT.js → chunk-CARSKIPW.js} +1 -1
  69. package/dist/chunk-CGIVQ7D2.js +115 -0
  70. package/dist/{chunk-HR7TFO2X.js → chunk-CHMIK6PK.js} +7 -7
  71. package/dist/{chunk-DRJAKRTI.js → chunk-CNODWD3F.js} +5 -5
  72. package/dist/chunk-CU4UVEHX.js +121 -0
  73. package/dist/{chunk-TXNRS2JR.js → chunk-CW3HYGS5.js} +1 -1
  74. package/dist/{chunk-WPVDACTL.js → chunk-DI2M3J5Q.js} +1 -1
  75. package/dist/{chunk-YYMACYP6.js → chunk-DL7ENIQB.js} +1 -1
  76. package/dist/{chunk-362ZBMNT.js → chunk-DPG4AWSG.js} +3 -3
  77. package/dist/{chunk-UCYSCKZV.js → chunk-DSTHXHJ5.js} +2114 -1699
  78. package/dist/{chunk-UQORUXQR.js → chunk-EGHDC6K6.js} +6 -6
  79. package/dist/{chunk-FXWKGNRV.js → chunk-EJY35WBK.js} +2 -2
  80. package/dist/{chunk-3JSAS7QP.js → chunk-EOSJHPHN.js} +22 -6
  81. package/dist/{chunk-46M463BR.js → chunk-EWFOFSF7.js} +1 -1
  82. package/dist/{chunk-GOWTUDQ3.js → chunk-EX4AGESR.js} +81 -77
  83. package/dist/{chunk-WCSHDVMB.js → chunk-F2SZ4LPF.js} +355 -40
  84. package/dist/{chunk-533GMKEG.js → chunk-F5NW4XBU.js} +23 -3
  85. package/dist/{chunk-5AZCIOS4.js → chunk-F6NPDZHW.js} +2 -2
  86. package/dist/chunk-FICKHCWL.js +279 -0
  87. package/dist/{chunk-LXJH3DOV.js → chunk-FLFE6HXW.js} +1 -1
  88. package/dist/{chunk-CMHI2RPL.js → chunk-FMJBQE56.js} +21 -0
  89. package/dist/{chunk-4LXBQTFN.js → chunk-FREUYHMS.js} +1 -1
  90. package/dist/{chunk-OHOWEMHO.js → chunk-G5KNNOXX.js} +32 -26
  91. package/dist/{chunk-ZN7LWXVC.js → chunk-GCEOEV6P.js} +1 -1
  92. package/dist/chunk-GCU4LHGY.js +1238 -0
  93. package/dist/{chunk-5MVC35DX.js → chunk-GISFIAGQ.js} +6 -6
  94. package/dist/{chunk-ZB4SO44T.js → chunk-GLZLBHFC.js} +2 -2
  95. package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
  96. package/dist/{chunk-BFT3CN5L.js → chunk-GWSRWILC.js} +3 -3
  97. package/dist/{chunk-VDKOJ5WD.js → chunk-GYRTURN7.js} +1 -1
  98. package/dist/{chunk-LYZDVZWA.js → chunk-H7NIKMPE.js} +2 -2
  99. package/dist/{chunk-P42E3L6Z.js → chunk-HB3KRNZM.js} +1 -1
  100. package/dist/{chunk-I5THQVYP.js → chunk-HGTPUAHD.js} +1 -1
  101. package/dist/{chunk-IWI34SYT.js → chunk-HI7NZVSJ.js} +6 -6
  102. package/dist/{chunk-YFRC6GEN.js → chunk-HLL6GLZO.js} +3 -3
  103. package/dist/chunk-HQM7D57C.js +474 -0
  104. package/dist/{chunk-MVNO35S5.js → chunk-HRDVGFS7.js} +2 -2
  105. package/dist/chunk-HT34QVZR.js +184 -0
  106. package/dist/{chunk-WJJXUXSO.js → chunk-IC2PLPRP.js} +1 -1
  107. package/dist/{chunk-PK6LEBI7.js → chunk-IVBNI2QE.js} +228 -97
  108. package/dist/chunk-IWBQZK6E.js +166 -0
  109. package/dist/chunk-IZDTQFCP.js +65 -0
  110. package/dist/{chunk-JB6QDJN3.js → chunk-J3L2FUIA.js} +6 -5
  111. package/dist/{chunk-AEMDNTW5.js → chunk-J54BZXZX.js} +2 -2
  112. package/dist/{chunk-4TWWSI7H.js → chunk-JEDX4KBB.js} +3 -3
  113. package/dist/{chunk-Y2M536WR.js → chunk-JHBNG7OD.js} +17 -0
  114. package/dist/{chunk-LYD3C73Z.js → chunk-JI7HMGMO.js} +1 -1
  115. package/dist/{chunk-NUC27ELX.js → chunk-JLCA6PWC.js} +5 -5
  116. package/dist/chunk-JSVYNNPF.js +101 -0
  117. package/dist/{chunk-UGC6Z6CQ.js → chunk-JU2O2H7I.js} +16 -15
  118. package/dist/{chunk-KT7X72J4.js → chunk-JXSXBSV6.js} +9 -1
  119. package/dist/{chunk-EB5QHYKL.js → chunk-JZJT26E3.js} +2 -2
  120. package/dist/{chunk-33BERJSG.js → chunk-K6RZE3F7.js} +1 -1
  121. package/dist/{chunk-FNKBJCNF.js → chunk-K7H77TA5.js} +4 -4
  122. package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
  123. package/dist/{chunk-45LX4LPV.js → chunk-KFYTUQXT.js} +7 -7
  124. package/dist/{chunk-PK645GWX.js → chunk-KGA2XI6W.js} +4 -4
  125. package/dist/chunk-KT4DGVRQ.js +381 -0
  126. package/dist/{chunk-Q2ULPJJ6.js → chunk-KXWN75T2.js} +2 -2
  127. package/dist/{chunk-LAPEZATU.js → chunk-L7DIEO5B.js} +1 -1
  128. package/dist/{chunk-CKD5563X.js → chunk-LQSSUC7W.js} +2 -2
  129. package/dist/{chunk-E5WBU7ZR.js → chunk-LSMTJU6Y.js} +3 -3
  130. package/dist/{chunk-LSLPZITW.js → chunk-LVRCEGL7.js} +176 -48
  131. package/dist/{chunk-ZBWL72TB.js → chunk-LXZXXOJ3.js} +1 -11
  132. package/dist/{chunk-B2STTXQV.js → chunk-ML7UVBKL.js} +1 -1
  133. package/dist/{chunk-DAXXLQKB.js → chunk-MO7TNIVQ.js} +1 -1
  134. package/dist/{chunk-I7L2Q6AL.js → chunk-MOG7LT73.js} +13 -13
  135. package/dist/{chunk-FEC24V7X.js → chunk-MW47LDBT.js} +2 -2
  136. package/dist/{chunk-SONUZNDT.js → chunk-MZOINNCV.js} +3 -3
  137. package/dist/{chunk-UXGLM3B4.js → chunk-NEGOGYEO.js} +4 -4
  138. package/dist/{chunk-FGWD66ZZ.js → chunk-NISAIYSW.js} +7 -7
  139. package/dist/{chunk-GP4J42UD.js → chunk-NOKCLBAL.js} +1 -1
  140. package/dist/{chunk-YNHS5G26.js → chunk-NQ2RDSI3.js} +2 -2
  141. package/dist/{chunk-U4IQFWPI.js → chunk-NWSKT55Z.js} +3 -3
  142. package/dist/{chunk-W4GX5X5E.js → chunk-NZVS6B77.js} +601 -744
  143. package/dist/{chunk-DV7QV3X2.js → chunk-OAN4CZKX.js} +9 -16
  144. package/dist/{chunk-HZQGZQTV.js → chunk-OPSGADQI.js} +10 -8
  145. package/dist/{chunk-C4JUURO5.js → chunk-OT5X3VOQ.js} +1 -1
  146. package/dist/{chunk-OMBP3YSV.js → chunk-OYZIFLLC.js} +19 -72
  147. package/dist/{chunk-634XVU3D.js → chunk-PAYQJPGK.js} +8 -1
  148. package/dist/{chunk-GQLVERZW.js → chunk-PFBJWWUA.js} +9 -9
  149. package/dist/{chunk-EZGIPTIF.js → chunk-PMVWIBTI.js} +8 -8
  150. package/dist/{chunk-VYMODH6P.js → chunk-PYF5EER5.js} +1 -1
  151. package/dist/{chunk-7BD24KNM.js → chunk-PYZ7VL5X.js} +3 -3
  152. package/dist/{chunk-X7H7TIOT.js → chunk-Q4R2O7XF.js} +9 -9
  153. package/dist/{chunk-5TRY5IMZ.js → chunk-Q6GUA5VE.js} +2 -2
  154. package/dist/{chunk-FPV32HVT.js → chunk-Q6QXFLUY.js} +6 -6
  155. package/dist/{chunk-B66CMFMH.js → chunk-QCIDV3AP.js} +3 -3
  156. package/dist/{chunk-PR7Y27BW.js → chunk-QDUZCJ7F.js} +1 -1
  157. package/dist/{chunk-OPX5O57R.js → chunk-QE4R2KT3.js} +1 -1
  158. package/dist/chunk-QJCUPZZQ.js +356 -0
  159. package/dist/chunk-QR3GYYX6.js +0 -0
  160. package/dist/{chunk-3B6MTW5G.js → chunk-QUHSHIAC.js} +3 -0
  161. package/dist/{chunk-OH4AABUT.js → chunk-R325CPYC.js} +1 -1
  162. package/dist/{chunk-JPNPTILP.js → chunk-R4O667NT.js} +1 -1
  163. package/dist/{chunk-PRBE5CM3.js → chunk-RGS5ZOY7.js} +32 -1
  164. package/dist/{chunk-WVJJGXM5.js → chunk-RIO2IHPE.js} +1 -1
  165. package/dist/{chunk-2FGRDEAD.js → chunk-RQQ53CQJ.js} +1 -1
  166. package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
  167. package/dist/{chunk-R5F52U3C.js → chunk-TDJSZ73V.js} +3 -3
  168. package/dist/{chunk-3VDLE5GA.js → chunk-TH26CWVG.js} +5 -5
  169. package/dist/{chunk-FFNSWUDC.js → chunk-THPXRTE5.js} +12 -5
  170. package/dist/{chunk-BKNAX6QQ.js → chunk-TZM63FZ4.js} +3 -3
  171. package/dist/{chunk-KJSCFEXT.js → chunk-UZ452ISX.js} +254 -54
  172. package/dist/{chunk-EFZBEG7O.js → chunk-VBKFXL2Q.js} +3 -3
  173. package/dist/{chunk-4XFFF2L5.js → chunk-VGXJXU7X.js} +8 -8
  174. package/dist/{chunk-ESPLVOFC.js → chunk-VHCDSNXF.js} +2 -2
  175. package/dist/{chunk-EJBFKCC5.js → chunk-VJ4LQXMA.js} +127 -61
  176. package/dist/chunk-VM56ZITS.js +356 -0
  177. package/dist/{chunk-KXIA66EJ.js → chunk-VPYI4X6C.js} +9 -5
  178. package/dist/{chunk-4KX6CBJ4.js → chunk-VSLHL2AZ.js} +2 -0
  179. package/dist/{chunk-EPHVGD5Z.js → chunk-VXW3BCN2.js} +1 -1
  180. package/dist/{chunk-X3PXBMI3.js → chunk-VY72NX26.js} +8 -8
  181. package/dist/{chunk-ACDG3RAL.js → chunk-VYQ6ASFF.js} +70 -125
  182. package/dist/{chunk-2YN2OI3W.js → chunk-W3P3RP5R.js} +17 -5
  183. package/dist/{chunk-NPQKCEAH.js → chunk-W7CJSBDM.js} +37 -9
  184. package/dist/{chunk-N3BYBEDV.js → chunk-WF3ZDT5Z.js} +11 -95
  185. package/dist/{chunk-URZCZO6F.js → chunk-WKDHY2DJ.js} +3 -3
  186. package/dist/{chunk-WYA62MUL.js → chunk-X5PMVI7H.js} +3 -3
  187. package/dist/{chunk-KMZOBR5Q.js → chunk-XW2BES72.js} +13 -13
  188. package/dist/{chunk-IMR3MZDP.js → chunk-YHEH25IE.js} +1 -1
  189. package/dist/{chunk-L3E6LES5.js → chunk-YMOP6JKN.js} +7 -7
  190. package/dist/{chunk-4RT7P5ZQ.js → chunk-YNN2YNSE.js} +2 -2
  191. package/dist/{chunk-HEX3M4TL.js → chunk-YRINVEI3.js} +2 -2
  192. package/dist/{chunk-2AFIUBWT.js → chunk-YRUCTB6M.js} +5 -5
  193. package/dist/{chunk-S4SVK5DE.js → chunk-YVLANFBK.js} +29 -1
  194. package/dist/{chunk-3L7M4E7W.js → chunk-YXKHBSQJ.js} +14 -188
  195. package/dist/{chunk-KAZ5BYTQ.js → chunk-ZAOEFQ6K.js} +5 -4
  196. package/dist/{chunk-ZRFWXNT3.js → chunk-ZKHF75MZ.js} +205 -205
  197. package/dist/{chunk-K6L5PHHQ.js → chunk-ZU74CNL4.js} +7 -7
  198. package/dist/{chunk-COP7NFSJ.js → chunk-ZVPTNPLI.js} +3 -3
  199. package/dist/{collection-add-products-6HKW4CCS.js → collection-add-products-JFUIZEZI.js} +45 -45
  200. package/dist/{collection-create-GPBN7KO6.js → collection-create-5IGFVQKE.js} +87 -16
  201. package/dist/{collection-detail-BCIH2FB7.js → collection-detail-2WOLOVWF.js} +45 -43
  202. package/dist/{collection-edit-NVRFKO46.js → collection-edit-UMZN5JZ6.js} +4 -4
  203. package/dist/collection-icon-edit-WCSKUDXE.js +117 -0
  204. package/dist/collection-list-B3Y2ALLZ.js +85 -0
  205. package/dist/collection-media-YIV5BV3Y.js +655 -0
  206. package/dist/{collection-metadata-5VPC4CJI.js → collection-metadata-SBK6SL4C.js} +34 -34
  207. package/dist/commission-rule-commission-edit-V5JVRNZN.js +195 -0
  208. package/dist/commission-rule-create-EZ2C6AWK.js +464 -0
  209. package/dist/commission-rule-detail-ZQ3OHFA2.js +45 -0
  210. package/dist/commission-rule-edit-NQ5EYCGO.js +352 -0
  211. package/dist/commissions-list-M5WLJD2P.js +36 -0
  212. package/dist/{constants-Bahlh59D.d.ts → constants-CBhKGpBZ.d.ts} +12 -5
  213. package/dist/{customer-create-QHA4KM6N.js → customer-create-ZQ4RTXBA.js} +3 -3
  214. package/dist/{customer-create-address-TYWVWNUE.js → customer-create-address-P2QYUZJ5.js} +3 -3
  215. package/dist/{customer-detail-SDKM7KM5.js → customer-detail-ZGDPIWA4.js} +42 -45
  216. package/dist/{customer-edit-JZ4PQTIN.js → customer-edit-D55FJLIN.js} +3 -3
  217. package/dist/customer-edit-address-R5RXDUNZ.js +302 -0
  218. package/dist/{customer-group-add-customers-VJUBEN7M.js → customer-group-add-customers-O6A5ZFPM.js} +13 -13
  219. package/dist/{customer-group-create-NA2UKCF6.js → customer-group-create-44R3DDOT.js} +3 -3
  220. package/dist/{customer-group-detail-AMZNW2XW.js → customer-group-detail-FXUICFYC.js} +39 -39
  221. package/dist/{customer-group-edit-3O6HAYYN.js → customer-group-edit-NZ5SUPFQ.js} +3 -3
  222. package/dist/customer-group-list-R2DP2D42.js +57 -0
  223. package/dist/{customer-group-metadata-PU2ZQP2Z.js → customer-group-metadata-JX7ZBXLJ.js} +34 -34
  224. package/dist/{customer-list-MB6WZFMA.js → customer-list-Z4DUQHCH.js} +9 -9
  225. package/dist/{customer-metadata-ZCREBYFN.js → customer-metadata-JT5GGCRV.js} +34 -34
  226. package/dist/{customers-add-customer-group-SQIJ7CDL.js → customers-add-customer-group-KX3XNNMU.js} +46 -45
  227. package/dist/{edit-inventory-item-JUWUPXRF.js → edit-inventory-item-73BY4I5T.js} +33 -33
  228. package/dist/{edit-inventory-item-attributes-3GQMHSL2.js → edit-inventory-item-attributes-ZMB343AB.js} +33 -33
  229. package/dist/{edit-reservation-ACDUXG33.js → edit-reservation-BC5IOLK6.js} +5 -5
  230. package/dist/{edit-rules-72KZYLNI.js → edit-rules-4PPNBI7B.js} +34 -34
  231. package/dist/global-commission-edit-TRSS5JBH.js +203 -0
  232. package/dist/index.css +5187 -3
  233. package/dist/index.d.ts +10 -3
  234. package/dist/index.js +356 -308
  235. package/dist/inventory-create-XQKH3HZQ.js +58 -0
  236. package/dist/{inventory-detail-42GIKTMR.js → inventory-detail-RZJNTJDF.js} +38 -38
  237. package/dist/{inventory-list-AE44PEW7.js → inventory-list-SPSBDJXO.js} +8 -8
  238. package/dist/{inventory-metadata-VLXNSQS7.js → inventory-metadata-W2E4KYG3.js} +34 -34
  239. package/dist/{inventory-stock-V37WSJ7V.js → inventory-stock-D2BNT2UL.js} +38 -38
  240. package/dist/{invite-VQ2HR2OM.js → invite-25CGHT4W.js} +3 -3
  241. package/dist/loader-HRFMJ5TM.js +36 -0
  242. package/dist/loader-TIPLOZF7.js +32 -0
  243. package/dist/{location-create-ZMNB7YKR.js → location-create-GKORXOYD.js} +3 -3
  244. package/dist/{location-detail-PBCO6YON.js → location-detail-CNETNX3M.js} +36 -36
  245. package/dist/{location-edit-DMBF3CYZ.js → location-edit-T2CWF6N2.js} +3 -3
  246. package/dist/{location-fulfillment-providers-UGTP3SCR.js → location-fulfillment-providers-XXZ7AIUF.js} +46 -46
  247. package/dist/location-list-RHUT7IRA.js +54 -0
  248. package/dist/{location-sales-channels-TEUZYDTT.js → location-sales-channels-ZQBQ3VDH.js} +9 -10
  249. package/dist/{location-service-zone-create-ZS3UWJAA.js → location-service-zone-create-O6GYRZEE.js} +11 -11
  250. package/dist/{location-service-zone-edit-MTGU2O4C.js → location-service-zone-edit-7ZTB45TD.js} +5 -5
  251. package/dist/{location-service-zone-manage-areas-S7QZTIFT.js → location-service-zone-manage-areas-DBP3P27I.js} +11 -11
  252. package/dist/location-service-zone-shipping-option-create-3PQ2EYD7.js +60 -0
  253. package/dist/{location-service-zone-shipping-option-edit-3PGSNKYT.js → location-service-zone-shipping-option-edit-SLQM4GSH.js} +7 -7
  254. package/dist/{location-service-zone-shipping-option-pricing-POBJOF3Z.js → location-service-zone-shipping-option-pricing-UZ577SNK.js} +9 -9
  255. package/dist/{login-4IJPWFIN.js → login-OKBXMSKY.js} +32 -32
  256. package/dist/{manage-locations-E2XQPKKE.js → manage-locations-SUJNIWWF.js} +3 -3
  257. package/dist/{marketplace-add-currencies-6ANNBGZM.js → marketplace-add-currencies-IPE5RJF6.js} +13 -13
  258. package/dist/marketplace-detail-IHGJXVZS.js +75 -0
  259. package/dist/{marketplace-edit-6Q3G2OY5.js → marketplace-edit-WG6LMQ2P.js} +5 -5
  260. package/dist/{marketplace-metadata-BCPLQY5Y.js → marketplace-metadata-STYABOTX.js} +34 -34
  261. package/dist/offer-detail-page-2G5BUOIB.js +585 -0
  262. package/dist/offer-variant-detail-page-V6TKNYZL.js +143 -0
  263. package/dist/offers-2QQFKGAX.js +183 -0
  264. package/dist/{order-create-claim-MPSXY24H.js → order-create-claim-Y7ESDXLI.js} +284 -259
  265. package/dist/{order-create-edit-6JLXERBY.js → order-create-edit-6L5S7KQM.js} +215 -120
  266. package/dist/{order-create-exchange-Z7F6FRMI.js → order-create-exchange-WHO3K2MW.js} +302 -274
  267. package/dist/{order-create-refund-OWCLXLH3.js → order-create-refund-4ZO73NWS.js} +37 -37
  268. package/dist/{order-create-return-EVSD6GKE.js → order-create-return-R5WJBQ5W.js} +58 -31
  269. package/dist/{order-detail-7GQLUWBA.js → order-detail-QUGH2GXH.js} +45 -46
  270. package/dist/{order-edit-billing-address-BW5NU3KC.js → order-edit-billing-address-BEOKFNLZ.js} +35 -35
  271. package/dist/{order-edit-email-GQQY2SU7.js → order-edit-email-GLAQZCIT.js} +34 -34
  272. package/dist/{order-edit-shipping-address-DMUVVAZ6.js → order-edit-shipping-address-PF54SFAG.js} +34 -34
  273. package/dist/{order-list-KTKSHQST.js → order-list-GMUOLGZY.js} +19 -18
  274. package/dist/{order-metadata-YJ6LWUYD.js → order-metadata-VQOA3DOL.js} +34 -34
  275. package/dist/{order-request-transfer-6EOWBAJP.js → order-request-transfer-BLQQ66IF.js} +34 -34
  276. package/dist/pages/index.d.ts +599 -489
  277. package/dist/pages/index.js +198 -190
  278. package/dist/{payout-detail-TWO6HN4E.js → payout-detail-6U2ANWOH.js} +3 -3
  279. package/dist/{payout-list-7WJZFNW5.js → payout-list-3GQJQSVU.js} +8 -8
  280. package/dist/{price-list-configuration-O3MR5IUA.js → price-list-configuration-BLHIGDSV.js} +14 -13
  281. package/dist/price-list-create-HKN72A6Q.js +77 -0
  282. package/dist/{price-list-detail-Q7IODVDV.js → price-list-detail-6JAMNNJW.js} +44 -44
  283. package/dist/{price-list-edit-OJAYEUYO.js → price-list-edit-RZQMPHXU.js} +5 -5
  284. package/dist/{price-list-list-ARICU2NA.js → price-list-list-HLWCOORV.js} +11 -11
  285. package/dist/price-list-prices-add-ST6WNQNH.js +72 -0
  286. package/dist/{price-list-prices-edit-TGYZNOK4.js → price-list-prices-edit-ZQE3Z3NK.js} +35 -35
  287. package/dist/{product-add-existing-attributes-NTDMPDPZ.js → product-add-existing-attributes-J6MML6MT.js} +93 -53
  288. package/dist/{product-attributes-ZURXNZ3J.js → product-attributes-4EPKS6MP.js} +4 -4
  289. package/dist/{product-bulk-edit-LHCPVFUX.js → product-bulk-edit-TRI2KKHW.js} +4 -4
  290. package/dist/product-create-B4DTC2OM.js +71 -0
  291. package/dist/{product-create-attribute-UBWABT2Q.js → product-create-attribute-BP6NN4GO.js} +92 -54
  292. package/dist/{product-create-variant-AVV4LL7R.js → product-create-variant-VDQQNHAK.js} +8 -8
  293. package/dist/{product-detail-H25AVTG7.js → product-detail-MFJ3AIU6.js} +41 -37
  294. package/dist/{product-edit-EDW3D2KW.js → product-edit-26AWYWUU.js} +4 -4
  295. package/dist/product-edit-attribute-AXPTES26.js +336 -0
  296. package/dist/product-list-DMQSLXM4.js +87 -0
  297. package/dist/{product-media-IE4P5WAE.js → product-media-XRBLOV7D.js} +14 -17
  298. package/dist/{product-metadata-3DGBHQTM.js → product-metadata-LOF6TSJQ.js} +35 -35
  299. package/dist/{product-organization-64KMYNZH.js → product-organization-ISVMEWQG.js} +86 -10
  300. package/dist/{product-sales-channels-NTT6KMSD.js → product-sales-channels-C6UUHWGB.js} +8 -9
  301. package/dist/{product-shipping-profile-WM7LORFB.js → product-shipping-profile-VTYQ22E4.js} +4 -4
  302. package/dist/{product-tag-create-6TDIKP6X.js → product-tag-create-AHG3Y4GE.js} +33 -33
  303. package/dist/{product-tag-detail-2OB43Q5H.js → product-tag-detail-4FL4CU5S.js} +58 -56
  304. package/dist/{product-tag-edit-SJY7L6IL.js → product-tag-edit-ACHNVZZP.js} +33 -33
  305. package/dist/{product-tag-list-H4HRDCAI.js → product-tag-list-YPTIDXPX.js} +58 -56
  306. package/dist/{product-tag-metadata-UCMA6YAN.js → product-tag-metadata-BXC7GMBB.js} +34 -34
  307. package/dist/{product-type-create-RHG4KEAV.js → product-type-create-PPTAW3DW.js} +3 -3
  308. package/dist/{product-type-detail-WTEDFJAW.js → product-type-detail-RAYCHYAF.js} +44 -44
  309. package/dist/{product-type-edit-CABB7R7Y.js → product-type-edit-55AH3P7G.js} +3 -3
  310. package/dist/{product-type-list-TM26QMHR.js → product-type-list-JN4SKTFE.js} +8 -8
  311. package/dist/{product-type-metadata-3WCSSNDX.js → product-type-metadata-24JU4JNK.js} +34 -34
  312. package/dist/{product-variant-detail-3YX6AL23.js → product-variant-detail-7CFNAI3A.js} +33 -33
  313. package/dist/{product-variant-edit-MDXJUTQR.js → product-variant-edit-C4HXFQFW.js} +35 -35
  314. package/dist/{product-variant-metadata-34BBPRKZ.js → product-variant-metadata-5PUBLPDN.js} +34 -34
  315. package/dist/{profile-detail-ZRL5SERS.js → profile-detail-PABUO545.js} +3 -3
  316. package/dist/{profile-edit-HQTWYWZ7.js → profile-edit-O6Z3XJ4U.js} +3 -3
  317. package/dist/{promotion-add-campaign-S3JJSFHT.js → promotion-add-campaign-WK36UMSF.js} +7 -7
  318. package/dist/promotion-create-7VBA6JFM.js +57 -0
  319. package/dist/{promotion-detail-OKCXRU4Z.js → promotion-detail-KXXWEFHW.js} +36 -36
  320. package/dist/{promotion-edit-details-TKRC5HES.js → promotion-edit-details-YM5JPGEC.js} +5 -10
  321. package/dist/{promotion-list-7YRTZF3S.js → promotion-list-56ZDROMH.js} +10 -10
  322. package/dist/{refund-reason-create-AKZX4RAN.js → refund-reason-create-UA3XS6DP.js} +33 -33
  323. package/dist/{refund-reason-edit-LXMQTLR6.js → refund-reason-edit-3TAGKV3U.js} +33 -33
  324. package/dist/{refund-reason-list-6JXGHJRA.js → refund-reason-list-PBLA5HYO.js} +49 -47
  325. package/dist/{region-add-countries-COXN4LP3.js → region-add-countries-UO5A42HM.js} +12 -12
  326. package/dist/{region-create-P66Q65XY.js → region-create-7NA6RKWS.js} +13 -13
  327. package/dist/{region-detail-P2HHBYFV.js → region-detail-636IAPYK.js} +9 -9
  328. package/dist/{region-edit-XFE54SAO.js → region-edit-Z4VYO3TQ.js} +5 -5
  329. package/dist/{region-list-2XXKCDDX.js → region-list-GIU6NFI4.js} +9 -9
  330. package/dist/{region-metadata-GS4IS7UT.js → region-metadata-NRV3L42D.js} +34 -34
  331. package/dist/{reservation-create-2TDZAX5A.js → reservation-create-ANLVF7EC.js} +5 -5
  332. package/dist/{reservation-detail-CVV36FXP.js → reservation-detail-MAWHNY2H.js} +33 -33
  333. package/dist/{reservation-list-K4RPXJTO.js → reservation-list-UWZRPRPH.js} +9 -9
  334. package/dist/{reservation-metadata-364D3VZ7.js → reservation-metadata-ZFKKAOWG.js} +34 -34
  335. package/dist/{reset-password-MH3JTCCE.js → reset-password-UDA5ZMTZ.js} +3 -3
  336. package/dist/{return-reason-create-KED7446I.js → return-reason-create-DYJCGEOK.js} +3 -3
  337. package/dist/{return-reason-edit-57EU3XSE.js → return-reason-edit-A7ATUTCD.js} +3 -3
  338. package/dist/{return-reason-list-J7QUYMYH.js → return-reason-list-NPAAMB5H.js} +23 -21
  339. package/dist/{sales-channel-add-products-Q352GB72.js → sales-channel-add-products-2BBIMN6N.js} +46 -46
  340. package/dist/{sales-channel-create-MPZCRQBT.js → sales-channel-create-OC2BB67N.js} +4 -4
  341. package/dist/{sales-channel-detail-7WO26EOP.js → sales-channel-detail-D5R7HPC7.js} +43 -43
  342. package/dist/{sales-channel-edit-GILK4QK3.js → sales-channel-edit-V62TBRC4.js} +4 -4
  343. package/dist/sales-channel-list-LVW7XE7K.js +52 -0
  344. package/dist/{sales-channel-metadata-Z75VZHOY.js → sales-channel-metadata-5W4OZZYI.js} +34 -34
  345. package/dist/{shipping-option-type-create-NCI2LJAA.js → shipping-option-type-create-GHOCZT64.js} +33 -33
  346. package/dist/{shipping-option-type-detail-YNRLWD33.js → shipping-option-type-detail-W32EHTBS.js} +34 -34
  347. package/dist/{shipping-option-type-edit-XJFALSAR.js → shipping-option-type-edit-KRIP6HTC.js} +33 -33
  348. package/dist/shipping-option-type-list-4FML2ZX5.js +60 -0
  349. package/dist/{shipping-profile-create-UJNCCKKK.js → shipping-profile-create-HKYX4FKJ.js} +3 -3
  350. package/dist/{shipping-profile-detail-YAKZHWZI.js → shipping-profile-detail-UFGQ3CCH.js} +3 -3
  351. package/dist/{shipping-profile-metadata-YJMMBUYN.js → shipping-profile-metadata-52ZW757T.js} +34 -34
  352. package/dist/{shipping-profiles-list-JF2SQIQ7.js → shipping-profiles-list-PZQVMKR4.js} +7 -7
  353. package/dist/{store-address-edit-PKIBRFH4.js → store-address-edit-IJ2UW6WC.js} +4 -4
  354. package/dist/{store-bulk-edit-BNF3HH5K.js → store-bulk-edit-OIYKZ6AZ.js} +5 -5
  355. package/dist/{store-closure-edit-OK7MTUHY.js → store-closure-edit-H3EKROXP.js} +3 -3
  356. package/dist/{store-create-A23PSUWX.js → store-create-Y3BGG5P5.js} +36 -36
  357. package/dist/{store-details-R3J3YYR6.js → store-details-56IHJJQV.js} +51 -51
  358. package/dist/{store-edit-ZGBEXU4H.js → store-edit-HWOGEOCH.js} +14 -10
  359. package/dist/store-list-5DRW6QZF.js +82 -0
  360. package/dist/{store-member-invite-J5XSPWMW.js → store-member-invite-7ORIMT73.js} +6 -6
  361. package/dist/{store-payment-details-edit-HOGHZMZC.js → store-payment-details-edit-ERRJDLBO.js} +3 -3
  362. package/dist/{store-professional-details-edit-DPJ4ZFDR.js → store-professional-details-edit-VD2J4VYV.js} +3 -3
  363. package/dist/{tax-region-create-LQU7MWPP.js → tax-region-create-GGDCD2VU.js} +34 -34
  364. package/dist/tax-region-detail-L7STT6C7.js +69 -0
  365. package/dist/{tax-region-edit-TAWTPUQC.js → tax-region-edit-6JOV3POI.js} +33 -33
  366. package/dist/{tax-region-list-FIBHEFVD.js → tax-region-list-NIAT626R.js} +8 -8
  367. package/dist/{tax-region-metadata-W4R2SPDH.js → tax-region-metadata-4P667IOY.js} +34 -34
  368. package/dist/{tax-region-province-create-OVLIZPNP.js → tax-region-province-create-7YT2LNJG.js} +3 -3
  369. package/dist/{tax-region-province-detail-W6BDEQA5.js → tax-region-province-detail-2GRPOSWS.js} +40 -40
  370. package/dist/{tax-region-tax-override-create-M3FKWCY3.js → tax-region-tax-override-create-R5GKEOK6.js} +61 -61
  371. package/dist/{tax-region-tax-override-edit-4TRW73DK.js → tax-region-tax-override-edit-MLJKNLAR.js} +61 -61
  372. package/dist/{tax-region-tax-rate-create-KDN6G52Y.js → tax-region-tax-rate-create-3ZLVL3X3.js} +4 -4
  373. package/dist/{tax-region-tax-rate-edit-D4BFDDJ7.js → tax-region-tax-rate-edit-XVMPIJOF.js} +4 -4
  374. package/dist/{user-detail-2OTVNTCL.js → user-detail-452E7GII.js} +4 -4
  375. package/dist/{user-edit-MXS2DV37.js → user-edit-T3MZKULQ.js} +3 -3
  376. package/dist/{user-invite-HLZJ7FST.js → user-invite-FCWARLW5.js} +11 -11
  377. package/dist/{user-list-TR7RSGUO.js → user-list-OU6WS25V.js} +7 -7
  378. package/dist/{user-metadata-XTDSENAD.js → user-metadata-CHHV7S3A.js} +34 -34
  379. package/package.json +15 -12
  380. package/dist/[id]-272FUOXG.js +0 -503
  381. package/dist/attribute-list-RUMLW7EI.js +0 -61
  382. package/dist/chunk-54RTJBYO.js +0 -153
  383. package/dist/chunk-7O6WJTBI.js +0 -139
  384. package/dist/chunk-AKTAFKIU.js +0 -228
  385. package/dist/chunk-CKNQJPAG.js +0 -135
  386. package/dist/chunk-GVEF6UDT.js +0 -8
  387. package/dist/chunk-MSESXKMA.js +0 -390
  388. package/dist/chunk-RXM4B6HR.js +0 -8
  389. package/dist/chunk-SWL7ZCP3.js +0 -11
  390. package/dist/chunk-UM7ZR3VU.js +0 -14
  391. package/dist/chunk-VXMTBOKI.js +0 -1743
  392. package/dist/collection-list-O24SYINI.js +0 -82
  393. package/dist/commission-rate-create-7NSSEEH5.js +0 -782
  394. package/dist/commission-rate-detail-2FGQ3V2J.js +0 -85
  395. package/dist/commission-rate-edit-NXSXX4TA.js +0 -767
  396. package/dist/commission-rate-list-Y5XLEO67.js +0 -26
  397. package/dist/customer-group-list-ES6FKPEC.js +0 -57
  398. package/dist/inventory-create-QUE6RTM5.js +0 -58
  399. package/dist/loader-O4EABIXE.js +0 -26
  400. package/dist/location-list-YD4MZG2C.js +0 -54
  401. package/dist/location-service-zone-shipping-option-create-BU6RQKYU.js +0 -60
  402. package/dist/marketplace-detail-LFCGTWIJ.js +0 -75
  403. package/dist/offers-5L46FLHU.js +0 -440
  404. package/dist/order-allocate-items-TMVWJUV3.js +0 -563
  405. package/dist/order-create-fulfillment-DC4LWQYX.js +0 -643
  406. package/dist/order-create-shipment-JSYNAOBR.js +0 -214
  407. package/dist/order-receive-return-QY6KQBDB.js +0 -562
  408. package/dist/price-list-create-F5ASYWH2.js +0 -77
  409. package/dist/price-list-prices-add-C5OEGJSE.js +0 -72
  410. package/dist/product-create-WTEZJRJC.js +0 -71
  411. package/dist/product-list-X7ZL4KY5.js +0 -87
  412. package/dist/promotion-create-FSXBFC6B.js +0 -57
  413. package/dist/sales-channel-list-LSKZXQQC.js +0 -53
  414. package/dist/shipping-option-type-list-HZBMHE23.js +0 -60
  415. package/dist/store-list-TPMIQ6OO.js +0 -82
  416. package/dist/tax-region-detail-2KADHBYF.js +0 -69
@@ -1,1743 +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-UCYSCKZV.js";
23
- import {
24
- useQueryParams
25
- } from "./chunk-THHRRYRS.js";
26
- import {
27
- useProductTag
28
- } from "./chunk-LYREZINJ.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 } from "@tanstack/react-query";
92
- import { useTranslation as useTranslation2 } from "react-i18next";
93
-
94
- // src/components/common/confirm-prompt/confirm-prompt.tsx
95
- import { Label, Prompt, Textarea } from "@medusajs/ui";
96
- import { useEffect, useState } from "react";
97
- import { useTranslation } from "react-i18next";
98
- import { jsx, jsxs } from "react/jsx-runtime";
99
- var ConfirmPrompt = ({
100
- open,
101
- onOpenChange,
102
- variant = "confirmation",
103
- title,
104
- description,
105
- noteLabel,
106
- noteOptional = false,
107
- notePlaceholder,
108
- defaultNote = "",
109
- cancelLabel,
110
- confirmLabel,
111
- isLoading = false,
112
- onConfirm
113
- }) => {
114
- const { t } = useTranslation();
115
- const [note, setNote] = useState(defaultNote);
116
- useEffect(() => {
117
- if (open) {
118
- setNote(defaultNote);
119
- }
120
- }, [open, defaultNote]);
121
- const showNoteField = typeof noteLabel === "string";
122
- const handleOpenChange = (next) => {
123
- if (isLoading) {
124
- return;
125
- }
126
- onOpenChange(next);
127
- };
128
- const handleConfirm = async () => {
129
- const trimmed = note.trim();
130
- await onConfirm(showNoteField && trimmed ? trimmed : void 0);
131
- };
132
- return /* @__PURE__ */ jsx(Prompt, { open, onOpenChange: handleOpenChange, variant, children: /* @__PURE__ */ jsxs(Prompt.Content, { children: [
133
- /* @__PURE__ */ jsxs(Prompt.Header, { children: [
134
- /* @__PURE__ */ jsx(Prompt.Title, { children: title }),
135
- description ? /* @__PURE__ */ jsx(Prompt.Description, { children: description }) : null
136
- ] }),
137
- showNoteField ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2 px-6 py-4", children: [
138
- /* @__PURE__ */ jsxs(Label, { size: "small", weight: "plus", children: [
139
- noteLabel,
140
- noteOptional ? /* @__PURE__ */ jsxs("span", { className: "text-ui-fg-muted ml-1 font-normal", children: [
141
- "(",
142
- t("fields.optional"),
143
- ")"
144
- ] }) : null
145
- ] }),
146
- /* @__PURE__ */ jsx(
147
- Textarea,
148
- {
149
- placeholder: notePlaceholder,
150
- value: note,
151
- onChange: (e) => setNote(e.target.value),
152
- disabled: isLoading
153
- }
154
- )
155
- ] }) : null,
156
- /* @__PURE__ */ jsxs(Prompt.Footer, { children: [
157
- /* @__PURE__ */ jsx(Prompt.Cancel, { disabled: isLoading, children: cancelLabel ?? t("actions.cancel") }),
158
- /* @__PURE__ */ jsx(
159
- Prompt.Action,
160
- {
161
- onClick: (e) => {
162
- e.preventDefault();
163
- void handleConfirm();
164
- },
165
- disabled: isLoading,
166
- children: confirmLabel ?? t("actions.confirm")
167
- }
168
- )
169
- ] })
170
- ] }) });
171
- };
172
-
173
- // src/pages/products/product-detail/components/product-active-edit-section/product-active-edit-section.tsx
174
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
175
- var VARIANT_LOOKUP_FIELDS = "id,title,sku,*images";
176
- var ImageStrip = ({
177
- images,
178
- faded
179
- }) => /* @__PURE__ */ jsx2(
180
- "div",
181
- {
182
- className: faded ? "flex items-center gap-1.5 opacity-50" : "flex items-center gap-1.5",
183
- children: images.map((image, idx) => /* @__PURE__ */ jsx2(Thumbnail, { src: image.url, size: "base" }, `${image.url}-${idx}`))
184
- }
185
- );
186
- var TypeName = ({ id }) => {
187
- const { product_type } = useProductType(id);
188
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_type?.value ?? id });
189
- };
190
- var CollectionName = ({ id }) => {
191
- const { collection } = useCollection(id);
192
- return /* @__PURE__ */ jsx2(Fragment2, { children: collection?.title ?? id });
193
- };
194
- var CategoryName = ({ id }) => {
195
- const { product_category } = useProductCategory(id);
196
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_category?.name ?? id });
197
- };
198
- var TagName = ({ id }) => {
199
- const { product_tag } = useProductTag(id);
200
- return /* @__PURE__ */ jsx2(Fragment2, { children: product_tag?.value ?? id });
201
- };
202
- var ReferenceName = ({
203
- field,
204
- id
205
- }) => {
206
- switch (field) {
207
- case "type_id":
208
- return /* @__PURE__ */ jsx2(TypeName, { id });
209
- case "collection_id":
210
- return /* @__PURE__ */ jsx2(CollectionName, { id });
211
- case "categories":
212
- return /* @__PURE__ */ jsx2(CategoryName, { id });
213
- case "tags":
214
- return /* @__PURE__ */ jsx2(TagName, { id });
215
- }
216
- };
217
- var ReferenceList = ({
218
- field,
219
- ids
220
- }) => {
221
- if (!ids.length) return /* @__PURE__ */ jsx2(Fragment2, { children: "-" });
222
- return /* @__PURE__ */ jsx2(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs2(Fragment, { children: [
223
- idx > 0 && ", ",
224
- /* @__PURE__ */ jsx2(ReferenceName, { field, id })
225
- ] }, `${field}-${id}`)) });
226
- };
227
- var FieldRow = ({ diff }) => {
228
- const { t } = useTranslation2();
229
- const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
230
- const nextIsImages = isImageList(diff.next);
231
- const previousIsImages = isImageList(diff.previous);
232
- const renderAsImages = nextIsImages || previousIsImages;
233
- const renderAsReference = isReferenceField(diff.field);
234
- return /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4", children: [
235
- /* @__PURE__ */ jsx2(
236
- Text,
237
- {
238
- size: "small",
239
- weight: "plus",
240
- leading: "compact",
241
- className: "text-ui-fg-subtle w-[160px] shrink-0",
242
- children: t(`fields.${diff.field}`, {
243
- defaultValue: humanizeFieldName(diff.field)
244
- })
245
- }
246
- ),
247
- renderAsImages ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
248
- hasPrevious && previousIsImages && /* @__PURE__ */ jsx2(ImageStrip, { images: diff.previous, faded: true }),
249
- hasPrevious && /* @__PURE__ */ jsx2(
250
- Text,
251
- {
252
- size: "small",
253
- leading: "compact",
254
- className: "text-ui-fg-subtle",
255
- children: "\u2192"
256
- }
257
- ),
258
- nextIsImages ? /* @__PURE__ */ jsx2(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx2(
259
- Text,
260
- {
261
- size: "small",
262
- leading: "compact",
263
- className: "text-ui-fg-subtle",
264
- children: formatFieldValue(diff.next, diff.field)
265
- }
266
- )
267
- ] }) : renderAsReference ? /* @__PURE__ */ jsxs2(
268
- Text,
269
- {
270
- size: "small",
271
- leading: "compact",
272
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
273
- children: [
274
- hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: /* @__PURE__ */ jsx2(
275
- ReferenceList,
276
- {
277
- field: diff.field,
278
- ids: extractReferenceIds(
279
- diff.field,
280
- diff.previous
281
- )
282
- }
283
- ) }),
284
- hasPrevious && " \u2192 ",
285
- /* @__PURE__ */ jsx2(
286
- ReferenceList,
287
- {
288
- field: diff.field,
289
- ids: extractReferenceIds(diff.field, diff.next)
290
- }
291
- )
292
- ]
293
- }
294
- ) : /* @__PURE__ */ jsxs2(
295
- Text,
296
- {
297
- size: "small",
298
- leading: "compact",
299
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
300
- children: [
301
- hasPrevious && /* @__PURE__ */ jsx2("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
302
- hasPrevious && " \u2192 ",
303
- formatFieldValue(diff.next, diff.field)
304
- ]
305
- }
306
- )
307
- ] });
308
- };
309
- var AttributeActionLine = ({
310
- attributeId,
311
- valueIds
312
- }) => {
313
- const { product_attribute } = useProductAttribute(attributeId);
314
- const name = product_attribute?.name ?? attributeId;
315
- const values = product_attribute?.values ?? [];
316
- const selectedNames = valueIds && valueIds.length ? valueIds.map((id) => {
317
- const match = values.find((v) => v.id === id);
318
- return match?.name ?? id;
319
- }) : [];
320
- return /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
321
- /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: name }),
322
- selectedNames.length > 0 && `: ${selectedNames.join(", ")}`
323
- ] });
324
- };
325
- var VariantActionLine = ({
326
- title,
327
- images
328
- }) => /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
329
- images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
330
- /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: title }) })
331
- ] });
332
- var ActionLine = ({
333
- action,
334
- variantsById
335
- }) => {
336
- const { t } = useTranslation2();
337
- const details = action.details ?? {};
338
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
339
- if (!details.attribute_id) return null;
340
- return /* @__PURE__ */ jsx2(
341
- AttributeActionLine,
342
- {
343
- attributeId: details.attribute_id,
344
- valueIds: action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD ? details.attribute_value_ids : void 0
345
- }
346
- );
347
- }
348
- const variantFallback = t("fields.variant", { defaultValue: "Variant" });
349
- if (action.action === import_types.ProductChangeActionType.VARIANT_ADD) {
350
- const title = details.variant?.title || details.variant?.sku || variantFallback;
351
- return /* @__PURE__ */ jsx2(VariantActionLine, { title });
352
- }
353
- if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
354
- const variantId = details.variant_id ?? "";
355
- const found = variantId ? variantsById.get(variantId) : void 0;
356
- const title = found?.title || found?.sku || variantId || variantFallback;
357
- const images = isImageList(found?.images) ? found?.images : void 0;
358
- return /* @__PURE__ */ jsx2(VariantActionLine, { title, images });
359
- }
360
- const label = describeProductChangeAction(action, {
361
- variant: variantFallback
362
- });
363
- return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
364
- };
365
- var VariantUpdateBlock = ({
366
- variantId,
367
- diffs,
368
- variantsById
369
- }) => {
370
- const { t } = useTranslation2();
371
- const found = variantsById.get(variantId);
372
- const title = found?.title || found?.sku || variantId || t("fields.variant", { defaultValue: "Variant" });
373
- const images = isImageList(found?.images) ? found?.images : void 0;
374
- return /* @__PURE__ */ jsxs2(
375
- "div",
376
- {
377
- className: "flex flex-col gap-y-3",
378
- "data-testid": `product-active-edit-variant-${variantId}`,
379
- children: [
380
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
381
- images && images.length > 0 && /* @__PURE__ */ jsx2(ImageStrip, { images }),
382
- /* @__PURE__ */ jsxs2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
383
- /* @__PURE__ */ jsx2("span", { className: "font-medium text-ui-fg-base", children: t("products.edits.panel.variantUpdated", {
384
- defaultValue: "Variant updated"
385
- }) }),
386
- ": ",
387
- title
388
- ] })
389
- ] }),
390
- /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-4 pl-1", children: diffs.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${variantId}-${diff.field}-${idx}`)) })
391
- ]
392
- }
393
- );
394
- };
395
- var ProductActiveEditSection = ({
396
- product
397
- }) => {
398
- const { t } = useTranslation2();
399
- const [confirmOpen, setConfirmOpen] = useState2(false);
400
- const [rejectOpen, setRejectOpen] = useState2(false);
401
- const { product_change, isError } = useProductChange(product.id, {
402
- retry: false
403
- });
404
- const requesterId = product_change?.created_by ?? "";
405
- const { seller: requesterSeller } = useSeller(requesterId, void 0, {
406
- enabled: !!requesterId
407
- });
408
- const { mutateAsync: confirmChange, isPending: isConfirming } = useConfirmProductChange(product_change?.id ?? "", product.id);
409
- const { mutateAsync: cancelChange, isPending: isRejecting } = useCancelProductChange(product_change?.id ?? "", product.id);
410
- const { updated, added, removed, deleteRequested } = useMemo(
411
- () => partitionProductChangeActions(product_change?.actions ?? []),
412
- [product_change]
413
- );
414
- const productUpdated = useMemo(
415
- () => updated.filter((d) => !d.variant_id),
416
- [updated]
417
- );
418
- const variantsUpdated = useMemo(() => {
419
- const groups = /* @__PURE__ */ new Map();
420
- for (const diff of updated) {
421
- if (!diff.variant_id) continue;
422
- const bucket = groups.get(diff.variant_id) ?? [];
423
- bucket.push(diff);
424
- groups.set(diff.variant_id, bucket);
425
- }
426
- return groups;
427
- }, [updated]);
428
- const attributeIds = useMemo(() => {
429
- const ids = /* @__PURE__ */ new Set();
430
- for (const action of [...added, ...removed]) {
431
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
432
- const details = action.details ?? {};
433
- if (details.attribute_id) ids.add(details.attribute_id);
434
- }
435
- }
436
- return Array.from(ids);
437
- }, [added, removed]);
438
- const attributeQueries = useQueries({
439
- queries: attributeIds.map((id) => ({
440
- queryKey: productAttributesQueryKeys.detail(id),
441
- queryFn: () => sdk.admin.productAttributes.$id.query({ $id: id })
442
- }))
443
- });
444
- const isLoadingAttributes = attributeQueries.some((q) => q.isPending);
445
- const variantIds = useMemo(() => {
446
- const ids = /* @__PURE__ */ new Set();
447
- for (const action of removed) {
448
- if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
449
- const details = action.details ?? {};
450
- if (details.variant_id) ids.add(details.variant_id);
451
- }
452
- }
453
- for (const diff of updated) {
454
- if (diff.variant_id) ids.add(diff.variant_id);
455
- }
456
- return Array.from(ids);
457
- }, [removed, updated]);
458
- const variantQueryInput = { fields: VARIANT_LOOKUP_FIELDS };
459
- const variantQueries = useQueries({
460
- queries: variantIds.map((variantId) => ({
461
- queryKey: variantsQueryKeys.detail(variantId, variantQueryInput),
462
- queryFn: () => sdk.admin.products.$id.variants.$variantId.query({
463
- $id: product.id,
464
- $variantId: variantId,
465
- ...variantQueryInput
466
- })
467
- }))
468
- });
469
- const isLoadingVariants = variantQueries.some((q) => q.isPending);
470
- const variantsById = useMemo(() => {
471
- const map = /* @__PURE__ */ new Map();
472
- for (const query of variantQueries) {
473
- const variant = query.data?.variant;
474
- if (variant?.id) map.set(variant.id, variant);
475
- }
476
- return map;
477
- }, [variantQueries]);
478
- if (isError || !product_change) {
479
- return null;
480
- }
481
- if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
482
- return null;
483
- }
484
- if (isLoadingAttributes || isLoadingVariants) {
485
- return null;
486
- }
487
- const hasContent = productUpdated.length > 0 || variantsUpdated.size > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
488
- const handleConfirm = async (note) => {
489
- try {
490
- await confirmChange({ internal_note: note });
491
- toast.success(t("products.edits.toast.confirmedSuccessfully"));
492
- setConfirmOpen(false);
493
- } catch (e) {
494
- toast.error(e.message);
495
- }
496
- };
497
- const handleReject = async (note) => {
498
- try {
499
- await cancelChange({ internal_note: note });
500
- toast.success(t("products.edits.toast.rejectedSuccessfully"));
501
- setRejectOpen(false);
502
- } catch (e) {
503
- toast.error(e.message);
504
- }
505
- };
506
- return /* @__PURE__ */ jsxs2(
507
- Container,
508
- {
509
- className: "divide-y p-0",
510
- "data-testid": "product-active-edit-section",
511
- children: [
512
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 px-6 py-4", children: [
513
- /* @__PURE__ */ jsx2(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
514
- /* @__PURE__ */ jsx2(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
515
- ] }),
516
- /* @__PURE__ */ jsx2("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.edits.panel.description", {
517
- store: requesterSeller?.name ?? t("products.request.fallbackStore")
518
- }) }) }),
519
- hasContent && /* @__PURE__ */ jsxs2(Fragment2, { children: [
520
- productUpdated.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
521
- /* @__PURE__ */ jsx2(
522
- Text,
523
- {
524
- size: "small",
525
- weight: "plus",
526
- leading: "compact",
527
- className: "text-ui-fg-subtle w-[160px] shrink-0",
528
- children: t("labels.updated")
529
- }
530
- ),
531
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-4", children: productUpdated.map((diff, idx) => /* @__PURE__ */ jsx2(FieldRow, { diff }, `${diff.field}-${idx}`)) })
532
- ] }),
533
- variantsUpdated.size > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
534
- /* @__PURE__ */ jsx2(
535
- Text,
536
- {
537
- size: "small",
538
- weight: "plus",
539
- leading: "compact",
540
- className: "text-ui-fg-subtle w-[160px] shrink-0",
541
- children: t("labels.updated")
542
- }
543
- ),
544
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-6", children: Array.from(variantsUpdated.entries()).map(
545
- ([variantId, diffs]) => /* @__PURE__ */ jsx2(
546
- VariantUpdateBlock,
547
- {
548
- variantId,
549
- diffs,
550
- variantsById
551
- },
552
- variantId
553
- )
554
- ) })
555
- ] }),
556
- added.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
557
- /* @__PURE__ */ jsx2(
558
- Text,
559
- {
560
- size: "small",
561
- weight: "plus",
562
- leading: "compact",
563
- className: "text-ui-fg-subtle w-[160px] shrink-0",
564
- children: t("labels.added")
565
- }
566
- ),
567
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx2(
568
- ActionLine,
569
- {
570
- action,
571
- variantsById
572
- },
573
- action.id
574
- )) })
575
- ] }),
576
- removed.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
577
- /* @__PURE__ */ jsx2(
578
- Text,
579
- {
580
- size: "small",
581
- weight: "plus",
582
- leading: "compact",
583
- className: "text-ui-fg-subtle w-[160px] shrink-0",
584
- children: t("labels.removed")
585
- }
586
- ),
587
- /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx2(
588
- ActionLine,
589
- {
590
- action,
591
- variantsById
592
- },
593
- action.id
594
- )) })
595
- ] }),
596
- deleteRequested && /* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-4 px-6 py-4", children: [
597
- /* @__PURE__ */ jsx2(
598
- Text,
599
- {
600
- size: "small",
601
- weight: "plus",
602
- leading: "compact",
603
- className: "text-ui-fg-subtle w-[160px] shrink-0",
604
- children: t("labels.removed")
605
- }
606
- ),
607
- /* @__PURE__ */ jsx2(
608
- Text,
609
- {
610
- size: "small",
611
- leading: "compact",
612
- className: "text-ui-fg-subtle flex-1",
613
- children: t("products.edits.panel.deleteRequested")
614
- }
615
- )
616
- ] })
617
- ] }),
618
- /* @__PURE__ */ jsxs2(
619
- "div",
620
- {
621
- className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
622
- "data-testid": "product-active-edit-actions",
623
- children: [
624
- /* @__PURE__ */ jsx2(
625
- Button,
626
- {
627
- size: "small",
628
- variant: "secondary",
629
- onClick: () => setConfirmOpen(true),
630
- "data-testid": "product-active-edit-confirm-button",
631
- children: t("actions.confirm")
632
- }
633
- ),
634
- /* @__PURE__ */ jsx2(
635
- Button,
636
- {
637
- size: "small",
638
- variant: "secondary",
639
- onClick: () => setRejectOpen(true),
640
- "data-testid": "product-active-edit-reject-button",
641
- children: t("products.edits.actions.reject")
642
- }
643
- )
644
- ]
645
- }
646
- ),
647
- /* @__PURE__ */ jsx2(
648
- ConfirmPrompt,
649
- {
650
- open: confirmOpen,
651
- onOpenChange: setConfirmOpen,
652
- title: t("products.edits.confirmPrompt.title"),
653
- description: t("products.edits.confirmPrompt.description"),
654
- noteLabel: t("products.edits.confirmPrompt.noteLabel"),
655
- noteOptional: true,
656
- notePlaceholder: t("products.edits.confirmPrompt.notePlaceholder"),
657
- isLoading: isConfirming,
658
- onConfirm: handleConfirm
659
- }
660
- ),
661
- /* @__PURE__ */ jsx2(
662
- ConfirmPrompt,
663
- {
664
- open: rejectOpen,
665
- onOpenChange: setRejectOpen,
666
- title: t("products.edits.rejectPrompt.title"),
667
- description: t("products.edits.rejectPrompt.description"),
668
- noteLabel: t("products.edits.rejectPrompt.noteLabel"),
669
- noteOptional: true,
670
- notePlaceholder: t("products.edits.rejectPrompt.notePlaceholder"),
671
- confirmLabel: t("products.edits.rejectPrompt.confirm"),
672
- isLoading: isRejecting,
673
- onConfirm: handleReject
674
- }
675
- )
676
- ]
677
- }
678
- );
679
- };
680
-
681
- // src/pages/products/product-detail/components/product-active-request-section/product-active-request-section.tsx
682
- var import_types2 = __toESM(require_dist(), 1);
683
- import { useState as useState3 } from "react";
684
- import { Button as Button2, Container as Container2, Heading as Heading2, Text as Text2, toast as toast2 } from "@medusajs/ui";
685
- import { ExclamationCircleSolid as ExclamationCircleSolid2 } from "@medusajs/icons";
686
- import { useTranslation as useTranslation3 } from "react-i18next";
687
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
688
- var ProductActiveRequestSection = ({
689
- product
690
- }) => {
691
- const { t } = useTranslation3();
692
- const [confirmOpen, setConfirmOpen] = useState3(false);
693
- const [requestUpdateOpen, setRequestUpdateOpen] = useState3(false);
694
- const [rejectOpen, setRejectOpen] = useState3(false);
695
- const { mutateAsync: confirmProduct, isPending: isConfirming } = useConfirmProduct(product.id);
696
- const { mutateAsync: requestProductChanges, isPending: isRequestingUpdate } = useRequestProductChanges(product.id);
697
- const { mutateAsync: rejectProduct, isPending: isRejecting } = useRejectProduct(product.id);
698
- if (product.status !== import_types2.ProductStatus.PROPOSED) {
699
- return null;
700
- }
701
- const handleConfirm = async (note) => {
702
- try {
703
- await confirmProduct({ internal_note: note });
704
- toast2.success(t("products.request.toast.publishedSuccessfully"));
705
- setConfirmOpen(false);
706
- } catch (e) {
707
- toast2.error(e.message);
708
- }
709
- };
710
- const handleRequestUpdate = async (note) => {
711
- try {
712
- await requestProductChanges({ message: note });
713
- toast2.success(t("products.request.toast.updateRequestedSuccessfully"));
714
- setRequestUpdateOpen(false);
715
- } catch (e) {
716
- toast2.error(e.message);
717
- }
718
- };
719
- const handleReject = async (note) => {
720
- try {
721
- await rejectProduct({ message: note });
722
- toast2.success(t("products.request.toast.rejectedSuccessfully"));
723
- setRejectOpen(false);
724
- } catch (e) {
725
- toast2.error(e.message);
726
- }
727
- };
728
- return /* @__PURE__ */ jsxs3(
729
- Container2,
730
- {
731
- className: "divide-y p-0",
732
- "data-testid": "product-active-request-section",
733
- children: [
734
- /* @__PURE__ */ jsxs3(
735
- "div",
736
- {
737
- className: "flex items-center gap-2 px-6 py-4",
738
- "data-testid": "product-active-request-header",
739
- children: [
740
- /* @__PURE__ */ jsx3(ExclamationCircleSolid2, { className: "text-ui-fg-interactive" }),
741
- /* @__PURE__ */ jsx3(Heading2, { level: "h2", "data-testid": "product-active-request-heading", children: t("products.request.panel.title") })
742
- ]
743
- }
744
- ),
745
- /* @__PURE__ */ jsx3("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.request.panel.description", {
746
- store: product.sellers?.[0]?.name ?? t("products.request.fallbackStore")
747
- }) }) }),
748
- /* @__PURE__ */ jsxs3(
749
- "div",
750
- {
751
- className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
752
- "data-testid": "product-active-request-actions",
753
- children: [
754
- /* @__PURE__ */ jsx3(
755
- Button2,
756
- {
757
- size: "small",
758
- variant: "secondary",
759
- onClick: () => setConfirmOpen(true),
760
- "data-testid": "product-active-request-confirm-button",
761
- children: t("actions.confirm")
762
- }
763
- ),
764
- /* @__PURE__ */ jsx3(
765
- Button2,
766
- {
767
- size: "small",
768
- variant: "secondary",
769
- onClick: () => setRequestUpdateOpen(true),
770
- "data-testid": "product-active-request-request-update-button",
771
- children: t("products.request.actions.requestUpdate")
772
- }
773
- ),
774
- /* @__PURE__ */ jsx3(
775
- Button2,
776
- {
777
- size: "small",
778
- variant: "secondary",
779
- onClick: () => setRejectOpen(true),
780
- "data-testid": "product-active-request-reject-button",
781
- children: t("products.request.actions.reject")
782
- }
783
- )
784
- ]
785
- }
786
- ),
787
- /* @__PURE__ */ jsx3(
788
- ConfirmPrompt,
789
- {
790
- open: confirmOpen,
791
- onOpenChange: setConfirmOpen,
792
- title: t("products.request.confirmPrompt.title"),
793
- description: t("products.request.confirmPrompt.description"),
794
- noteLabel: t("products.request.confirmPrompt.noteLabel"),
795
- noteOptional: true,
796
- notePlaceholder: t("products.request.confirmPrompt.notePlaceholder"),
797
- isLoading: isConfirming,
798
- onConfirm: handleConfirm
799
- }
800
- ),
801
- /* @__PURE__ */ jsx3(
802
- ConfirmPrompt,
803
- {
804
- open: requestUpdateOpen,
805
- onOpenChange: setRequestUpdateOpen,
806
- title: t("products.request.requestUpdatePrompt.title"),
807
- description: t("products.request.requestUpdatePrompt.description"),
808
- noteLabel: t("products.request.requestUpdatePrompt.noteLabel"),
809
- noteOptional: true,
810
- notePlaceholder: t(
811
- "products.request.requestUpdatePrompt.notePlaceholder"
812
- ),
813
- confirmLabel: t("products.request.requestUpdatePrompt.send"),
814
- isLoading: isRequestingUpdate,
815
- onConfirm: handleRequestUpdate
816
- }
817
- ),
818
- /* @__PURE__ */ jsx3(
819
- ConfirmPrompt,
820
- {
821
- open: rejectOpen,
822
- onOpenChange: setRejectOpen,
823
- title: t("products.request.rejectPrompt.title"),
824
- description: t("products.request.rejectPrompt.description"),
825
- noteLabel: t("products.request.rejectPrompt.noteLabel"),
826
- noteOptional: true,
827
- notePlaceholder: t("products.request.rejectPrompt.notePlaceholder"),
828
- confirmLabel: t("products.request.rejectPrompt.confirm"),
829
- isLoading: isRejecting,
830
- onConfirm: handleReject
831
- }
832
- )
833
- ]
834
- }
835
- );
836
- };
837
-
838
- // src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
839
- import {
840
- ListBullet,
841
- Plus,
842
- Trash,
843
- Swatch,
844
- DropCap,
845
- InformationCircleSolid
846
- } from "@medusajs/icons";
847
- import {
848
- Badge,
849
- Container as Container3,
850
- Heading as Heading3,
851
- Text as Text3,
852
- toast as toast3,
853
- Tooltip,
854
- usePrompt
855
- } from "@medusajs/ui";
856
- import { useTranslation as useTranslation4 } from "react-i18next";
857
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
858
- var AttributeActions = ({
859
- productId,
860
- attribute
861
- }) => {
862
- const { t } = useTranslation4();
863
- const prompt = usePrompt();
864
- const { mutateAsync } = useRemoveAttributeFromProduct(productId, attribute.id);
865
- const handleDelete = async () => {
866
- const res = await prompt({
867
- title: t("general.areYouSure"),
868
- description: t("products.deleteAttributeWarning", {
869
- title: attribute.name
870
- }),
871
- confirmText: t("actions.delete"),
872
- cancelText: t("actions.cancel")
873
- });
874
- if (!res) {
875
- return;
876
- }
877
- await mutateAsync(void 0, {
878
- onError: (error) => {
879
- toast3.error(error.message);
880
- }
881
- });
882
- };
883
- return /* @__PURE__ */ jsx4(
884
- ActionMenu,
885
- {
886
- groups: [
887
- {
888
- actions: [
889
- {
890
- label: t("actions.delete"),
891
- onClick: handleDelete,
892
- icon: /* @__PURE__ */ jsx4(Trash, {})
893
- }
894
- ]
895
- }
896
- ]
897
- }
898
- );
899
- };
900
- var AttributeGroup = ({
901
- icon,
902
- title,
903
- description,
904
- attributes,
905
- productId
906
- }) => {
907
- const { t } = useTranslation4();
908
- if (!attributes.length) {
909
- return null;
910
- }
911
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
912
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-3 px-3", children: [
913
- /* @__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 }),
914
- /* @__PURE__ */ jsxs4("div", { children: [
915
- /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
916
- /* @__PURE__ */ jsx4(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
917
- ] })
918
- ] }),
919
- /* @__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) => {
920
- const values = attr.values?.map((v) => v.name) ?? [];
921
- return /* @__PURE__ */ jsx4(
922
- "div",
923
- {
924
- className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
925
- children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 px-4 py-3 bg-ui-bg-component", children: [
926
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-2 text-ui-fg-subtle", children: [
927
- /* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
928
- attr.description && /* @__PURE__ */ jsx4(Tooltip, { content: attr.description, children: /* @__PURE__ */ jsx4("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx4(InformationCircleSolid, {}) }) }),
929
- 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, {}) }) })
930
- ] }),
931
- /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx4(
932
- Badge,
933
- {
934
- size: "2xsmall",
935
- className: "flex min-w-[20px] items-center justify-center",
936
- children: val
937
- },
938
- val
939
- )) : /* @__PURE__ */ jsx4(
940
- Text3,
941
- {
942
- size: "small",
943
- leading: "compact",
944
- className: "text-ui-fg-subtle",
945
- children: values.join(", ") || "-"
946
- }
947
- ) }),
948
- /* @__PURE__ */ jsx4(AttributeActions, { productId, attribute: attr })
949
- ] })
950
- },
951
- attr.id
952
- );
953
- }) }) })
954
- ] });
955
- };
956
- var ProductAttributeSection = ({
957
- product
958
- }) => {
959
- const { t } = useTranslation4();
960
- const allAttributes = product.attributes ?? [];
961
- const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
962
- const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
963
- const isEmpty = !variantAttributes.length && !infoAttributes.length;
964
- return /* @__PURE__ */ jsxs4(Container3, { className: "p-0", children: [
965
- /* @__PURE__ */ jsxs4(
966
- "div",
967
- {
968
- className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
969
- children: [
970
- /* @__PURE__ */ jsx4(Heading3, { level: "h2", children: t("products.attributes") }),
971
- /* @__PURE__ */ jsx4(
972
- ActionMenu,
973
- {
974
- groups: [
975
- {
976
- actions: [
977
- {
978
- label: t("products.create.attributes.addExisting"),
979
- to: "attributes/add",
980
- icon: /* @__PURE__ */ jsx4(ListBullet, {})
981
- },
982
- {
983
- label: t("products.create.attributes.createNew"),
984
- to: "attributes/create",
985
- icon: /* @__PURE__ */ jsx4(Plus, {})
986
- }
987
- ]
988
- }
989
- ]
990
- }
991
- )
992
- ]
993
- }
994
- ),
995
- variantAttributes.length > 0 && /* @__PURE__ */ jsx4(
996
- AttributeGroup,
997
- {
998
- icon: /* @__PURE__ */ jsx4(Swatch, {}),
999
- title: t("products.create.tabs.variants"),
1000
- description: t("products.attributeVariantsDescription"),
1001
- attributes: variantAttributes,
1002
- productId: product.id
1003
- }
1004
- ),
1005
- variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx4("div", { className: "border-t border-dashed border-ui-border-base" }),
1006
- infoAttributes.length > 0 && /* @__PURE__ */ jsx4(
1007
- AttributeGroup,
1008
- {
1009
- icon: /* @__PURE__ */ jsx4(DropCap, {}),
1010
- title: t("products.attributeProductInformation"),
1011
- description: t("products.attributeProductInformationDescription"),
1012
- attributes: infoAttributes,
1013
- productId: product.id
1014
- }
1015
- )
1016
- ] });
1017
- };
1018
-
1019
- // src/pages/products/product-detail/components/product-general-section/product-general-section.tsx
1020
- import { PencilSquare, Trash as Trash2 } from "@medusajs/icons";
1021
- import { Container as Container4, Heading as Heading4, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
1022
- import { useTranslation as useTranslation5 } from "react-i18next";
1023
- import { useNavigate } from "react-router-dom";
1024
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1025
- var productStatusColor = (status) => {
1026
- switch (status) {
1027
- case "draft":
1028
- return "grey";
1029
- case "proposed":
1030
- return "orange";
1031
- case "published":
1032
- return "green";
1033
- case "rejected":
1034
- return "red";
1035
- default:
1036
- return "grey";
1037
- }
1038
- };
1039
- var ProductGeneralSection = ({
1040
- product
1041
- }) => {
1042
- const { t } = useTranslation5();
1043
- const prompt = usePrompt2();
1044
- const navigate = useNavigate();
1045
- const { mutateAsync } = useDeleteProduct(product.id);
1046
- const handleDelete = async () => {
1047
- const res = await prompt({
1048
- title: t("general.areYouSure"),
1049
- description: t("products.deleteWarning", {
1050
- title: product.title
1051
- }),
1052
- confirmText: t("actions.delete"),
1053
- cancelText: t("actions.cancel")
1054
- });
1055
- if (!res) {
1056
- return;
1057
- }
1058
- await mutateAsync(void 0, {
1059
- onSuccess: () => {
1060
- navigate("..");
1061
- }
1062
- });
1063
- };
1064
- return /* @__PURE__ */ jsxs5(Container4, { className: "divide-y p-0", "data-testid": "product-general-section", children: [
1065
- /* @__PURE__ */ jsxs5(
1066
- "div",
1067
- {
1068
- className: "flex items-center justify-between px-6 py-4",
1069
- "data-testid": "product-general-header",
1070
- children: [
1071
- /* @__PURE__ */ jsx5(Heading4, { "data-testid": "product-general-title", children: product.title }),
1072
- /* @__PURE__ */ jsxs5(
1073
- "div",
1074
- {
1075
- className: "flex items-center gap-x-4",
1076
- "data-testid": "product-general-actions",
1077
- children: [
1078
- /* @__PURE__ */ jsx5(
1079
- StatusBadge,
1080
- {
1081
- color: productStatusColor(product.status),
1082
- "data-testid": "product-status-badge",
1083
- children: t(`products.productStatus.${product.status}`)
1084
- }
1085
- ),
1086
- /* @__PURE__ */ jsx5(
1087
- ActionMenu,
1088
- {
1089
- groups: [
1090
- {
1091
- actions: [
1092
- {
1093
- label: t("actions.edit"),
1094
- to: "edit",
1095
- icon: /* @__PURE__ */ jsx5(PencilSquare, {})
1096
- }
1097
- ]
1098
- },
1099
- {
1100
- actions: [
1101
- {
1102
- label: t("actions.delete"),
1103
- onClick: handleDelete,
1104
- icon: /* @__PURE__ */ jsx5(Trash2, {})
1105
- }
1106
- ]
1107
- }
1108
- ],
1109
- "data-testid": "product-general-action-menu"
1110
- }
1111
- )
1112
- ]
1113
- }
1114
- )
1115
- ]
1116
- }
1117
- ),
1118
- /* @__PURE__ */ jsx5(
1119
- SectionRow,
1120
- {
1121
- title: t("fields.description"),
1122
- value: product.description,
1123
- "data-testid": "product-description-row"
1124
- }
1125
- ),
1126
- /* @__PURE__ */ jsx5(
1127
- SectionRow,
1128
- {
1129
- title: t("fields.subtitle"),
1130
- value: product.subtitle,
1131
- "data-testid": "product-subtitle-row"
1132
- }
1133
- ),
1134
- /* @__PURE__ */ jsx5(
1135
- SectionRow,
1136
- {
1137
- title: t("fields.handle"),
1138
- value: `/${product.handle}`,
1139
- "data-testid": "product-handle-row"
1140
- }
1141
- ),
1142
- /* @__PURE__ */ jsx5(
1143
- SectionRow,
1144
- {
1145
- title: t("fields.discountable"),
1146
- value: product.discountable ? t("fields.true") : t("fields.false"),
1147
- "data-testid": "product-discountable-row"
1148
- }
1149
- )
1150
- ] });
1151
- };
1152
-
1153
- // src/pages/products/product-detail/components/product-media-section/product-media-section.tsx
1154
- import { PencilSquare as PencilSquare2, ThumbnailBadge } from "@medusajs/icons";
1155
- import {
1156
- Button as Button3,
1157
- Checkbox,
1158
- CommandBar,
1159
- Container as Container5,
1160
- Heading as Heading5,
1161
- Text as Text4,
1162
- Tooltip as Tooltip2,
1163
- clx,
1164
- usePrompt as usePrompt3
1165
- } from "@medusajs/ui";
1166
- import { useState as useState4 } from "react";
1167
- import { useTranslation as useTranslation6 } from "react-i18next";
1168
- import { Link } from "react-router-dom";
1169
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1170
- var ProductMediaSection = ({
1171
- product
1172
- }) => {
1173
- const { t } = useTranslation6();
1174
- const prompt = usePrompt3();
1175
- const [selection, setSelection] = useState4({});
1176
- const media = getMedia(product);
1177
- const handleCheckedChange = (id) => {
1178
- setSelection((prev) => {
1179
- if (prev[id]) {
1180
- const { [id]: _, ...rest } = prev;
1181
- return rest;
1182
- } else {
1183
- return { ...prev, [id]: true };
1184
- }
1185
- });
1186
- };
1187
- const { mutateAsync } = useUpdateProduct(product.id);
1188
- const handleDelete = async () => {
1189
- const ids = Object.keys(selection);
1190
- const includingThumbnail = ids.some(
1191
- (id) => media.find((m) => m.id === id)?.isThumbnail
1192
- );
1193
- const res = await prompt({
1194
- title: t("general.areYouSure"),
1195
- description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
1196
- count: ids.length
1197
- }) : t("products.media.deleteWarning", {
1198
- count: ids.length
1199
- }),
1200
- confirmText: t("actions.delete"),
1201
- cancelText: t("actions.cancel")
1202
- });
1203
- if (!res) {
1204
- return;
1205
- }
1206
- const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
1207
- await mutateAsync(
1208
- {
1209
- images: mediaToKeep,
1210
- thumbnail: includingThumbnail ? "" : void 0
1211
- },
1212
- {
1213
- onSuccess: () => {
1214
- setSelection({});
1215
- }
1216
- }
1217
- );
1218
- };
1219
- return /* @__PURE__ */ jsxs6(Container5, { className: "divide-y p-0", "data-testid": "product-media-section", children: [
1220
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-media-header", children: [
1221
- /* @__PURE__ */ jsx6(Heading5, { level: "h2", "data-testid": "product-media-title", children: t("products.media.label") }),
1222
- /* @__PURE__ */ jsx6(
1223
- ActionMenu,
1224
- {
1225
- groups: [
1226
- {
1227
- actions: [
1228
- {
1229
- label: t("actions.edit"),
1230
- to: "media?view=edit",
1231
- icon: /* @__PURE__ */ jsx6(PencilSquare2, {})
1232
- }
1233
- ]
1234
- }
1235
- ],
1236
- "data-testid": "product-media-action-menu"
1237
- }
1238
- )
1239
- ] }),
1240
- 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) => {
1241
- const isSelected = selection[i.id];
1242
- return /* @__PURE__ */ jsxs6(
1243
- "div",
1244
- {
1245
- className: "shadow-elevation-card-rest hover:shadow-elevation-card-hover transition-fg group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px]",
1246
- "data-testid": `product-media-item-${i.id}`,
1247
- children: [
1248
- /* @__PURE__ */ jsx6(
1249
- "div",
1250
- {
1251
- className: clx(
1252
- "transition-fg invisible absolute right-2 top-2 opacity-0 group-hover:visible group-hover:opacity-100",
1253
- {
1254
- "visible opacity-100": isSelected
1255
- }
1256
- ),
1257
- "data-testid": `product-media-checkbox-container-${i.id}`,
1258
- children: /* @__PURE__ */ jsx6(
1259
- Checkbox,
1260
- {
1261
- checked: selection[i.id] || false,
1262
- onCheckedChange: () => handleCheckedChange(i.id),
1263
- "data-testid": `product-media-checkbox-${i.id}`
1264
- }
1265
- )
1266
- }
1267
- ),
1268
- 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, {}) }) }),
1269
- /* @__PURE__ */ jsx6(Link, { to: `media`, state: { curr: index }, "data-testid": `product-media-link-${i.id}`, children: /* @__PURE__ */ jsx6(
1270
- "img",
1271
- {
1272
- src: i.url,
1273
- alt: product.title,
1274
- className: "size-full object-cover",
1275
- "data-testid": `product-media-image-${i.id}`
1276
- }
1277
- ) })
1278
- ]
1279
- },
1280
- i.id
1281
- );
1282
- }) }) : /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", "data-testid": "product-media-empty-state", children: [
1283
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center", children: [
1284
- /* @__PURE__ */ jsx6(
1285
- Text4,
1286
- {
1287
- size: "small",
1288
- leading: "compact",
1289
- weight: "plus",
1290
- className: "text-ui-fg-subtle",
1291
- "data-testid": "product-media-empty-state-header",
1292
- children: t("products.media.emptyState.header")
1293
- }
1294
- ),
1295
- /* @__PURE__ */ jsx6(Text4, { size: "small", className: "text-ui-fg-muted", "data-testid": "product-media-empty-state-description", children: t("products.media.emptyState.description") })
1296
- ] }),
1297
- /* @__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") }) })
1298
- ] }),
1299
- /* @__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: [
1300
- /* @__PURE__ */ jsx6(CommandBar.Value, { "data-testid": "product-media-command-bar-value", children: t("general.countSelected", {
1301
- count: Object.keys(selection).length
1302
- }) }),
1303
- /* @__PURE__ */ jsx6(CommandBar.Seperator, { "data-testid": "product-media-command-bar-separator" }),
1304
- /* @__PURE__ */ jsx6(
1305
- CommandBar.Command,
1306
- {
1307
- action: handleDelete,
1308
- label: t("actions.delete"),
1309
- shortcut: "d",
1310
- "data-testid": "product-media-command-bar-delete"
1311
- }
1312
- )
1313
- ] }) })
1314
- ] });
1315
- };
1316
- var getMedia = (product) => {
1317
- const { images = [], thumbnail } = product;
1318
- const media = images.map((image) => ({
1319
- id: image.id,
1320
- url: image.url,
1321
- isThumbnail: image.url === thumbnail
1322
- }));
1323
- if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
1324
- media.unshift({
1325
- id: "img_thumbnail",
1326
- url: thumbnail,
1327
- isThumbnail: true
1328
- });
1329
- }
1330
- return media;
1331
- };
1332
-
1333
- // src/pages/products/product-detail/components/product-organization-section/product-organization-section.tsx
1334
- import { PencilSquare as PencilSquare3 } from "@medusajs/icons";
1335
- import { Badge as Badge2, Container as Container6, Heading as Heading6, Tooltip as Tooltip3 } from "@medusajs/ui";
1336
- import { useTranslation as useTranslation7 } from "react-i18next";
1337
- import { Link as Link2 } from "react-router-dom";
1338
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1339
- var ProductOrganizationSection = ({
1340
- product
1341
- }) => {
1342
- const { t } = useTranslation7();
1343
- return /* @__PURE__ */ jsxs7(
1344
- Container6,
1345
- {
1346
- className: "divide-y p-0",
1347
- "data-testid": "product-organization-section",
1348
- children: [
1349
- /* @__PURE__ */ jsxs7(
1350
- "div",
1351
- {
1352
- className: "flex items-center justify-between px-6 py-4",
1353
- "data-testid": "product-organization-header",
1354
- children: [
1355
- /* @__PURE__ */ jsx7(Heading6, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
1356
- /* @__PURE__ */ jsx7(
1357
- ActionMenu,
1358
- {
1359
- groups: [
1360
- {
1361
- actions: [
1362
- {
1363
- label: t("actions.edit"),
1364
- to: "organization",
1365
- icon: /* @__PURE__ */ jsx7(PencilSquare3, {})
1366
- }
1367
- ]
1368
- }
1369
- ],
1370
- "data-testid": "product-organization-action-menu"
1371
- }
1372
- )
1373
- ]
1374
- }
1375
- ),
1376
- /* @__PURE__ */ jsx7(
1377
- SectionRow,
1378
- {
1379
- title: t("fields.tags"),
1380
- value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx7(
1381
- OrganizationTag,
1382
- {
1383
- label: tag.value,
1384
- to: `/settings/product-tags/${tag.id}`
1385
- },
1386
- tag.id
1387
- )) : void 0,
1388
- "data-testid": "product-tags-row"
1389
- }
1390
- ),
1391
- /* @__PURE__ */ jsx7(
1392
- SectionRow,
1393
- {
1394
- title: t("fields.type"),
1395
- value: product.type ? /* @__PURE__ */ jsx7(
1396
- OrganizationTag,
1397
- {
1398
- label: product.type.value,
1399
- to: `/settings/product-types/${product.type_id}`
1400
- }
1401
- ) : void 0,
1402
- "data-testid": "product-type-row"
1403
- }
1404
- ),
1405
- /* @__PURE__ */ jsx7(
1406
- SectionRow,
1407
- {
1408
- title: t("fields.collection"),
1409
- value: product.collection ? /* @__PURE__ */ jsx7(
1410
- OrganizationTag,
1411
- {
1412
- label: product.collection.title,
1413
- to: `/collections/${product.collection.id}`
1414
- }
1415
- ) : void 0,
1416
- "data-testid": "product-collection-row"
1417
- }
1418
- ),
1419
- /* @__PURE__ */ jsx7(
1420
- SectionRow,
1421
- {
1422
- title: t("fields.categories"),
1423
- value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx7(
1424
- OrganizationTag,
1425
- {
1426
- label: pcat.name,
1427
- to: `/categories/${pcat.id}`
1428
- },
1429
- pcat.id
1430
- )) : void 0,
1431
- "data-testid": "product-categories-row"
1432
- }
1433
- )
1434
- ]
1435
- }
1436
- );
1437
- };
1438
- var OrganizationTag = ({ label, to }) => {
1439
- return /* @__PURE__ */ jsx7(Tooltip3, { content: label, children: /* @__PURE__ */ jsx7(Badge2, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx7(
1440
- Link2,
1441
- {
1442
- to,
1443
- "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
1444
- children: label
1445
- }
1446
- ) }) });
1447
- };
1448
-
1449
- // src/pages/products/product-detail/components/product-variant-section/product-variant-section.tsx
1450
- import { useCallback, useMemo as useMemo2 } from "react";
1451
- import { PencilSquare as PencilSquare4, Trash as Trash3 } from "@medusajs/icons";
1452
- import {
1453
- Badge as Badge3,
1454
- Button as Button4,
1455
- Container as Container7,
1456
- createDataTableColumnHelper,
1457
- Heading as Heading7,
1458
- Tooltip as Tooltip4,
1459
- usePrompt as usePrompt4
1460
- } from "@medusajs/ui";
1461
- import { keepPreviousData } from "@tanstack/react-query";
1462
- import { useTranslation as useTranslation8 } from "react-i18next";
1463
- import { Link as Link3, useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
1464
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1465
- var PAGE_SIZE = 10;
1466
- var PREFIX = "pv";
1467
- var ProductVariantSection = ({
1468
- product
1469
- }) => {
1470
- const { t } = useTranslation8();
1471
- const { q, order, offset, created_at, updated_at } = useQueryParams(
1472
- ["q", "order", "offset", "created_at", "updated_at"],
1473
- PREFIX
1474
- );
1475
- const columns = useColumns(product);
1476
- const filters = useFilters();
1477
- const { variants, count, isPending, isError, error } = useProductVariants(
1478
- product.id,
1479
- {
1480
- q,
1481
- order: order ? order : "variant_rank",
1482
- offset: offset ? parseInt(offset) : void 0,
1483
- limit: PAGE_SIZE,
1484
- created_at: created_at ? JSON.parse(created_at) : void 0,
1485
- updated_at: updated_at ? JSON.parse(updated_at) : void 0,
1486
- fields: "title,sku,created_at,updated_at,*options,*options.option"
1487
- },
1488
- {
1489
- placeholderData: keepPreviousData
1490
- }
1491
- );
1492
- if (isError) {
1493
- throw error;
1494
- }
1495
- return /* @__PURE__ */ jsxs8(Container7, { className: "divide-y p-0", "data-testid": "product-variant-section", children: [
1496
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-6 py-4", children: [
1497
- /* @__PURE__ */ jsx8(Heading7, { level: "h2", children: t("products.variants.header") }),
1498
- /* @__PURE__ */ jsx8(
1499
- Button4,
1500
- {
1501
- size: "small",
1502
- variant: "secondary",
1503
- asChild: true,
1504
- "data-testid": "product-variants-create-button",
1505
- children: /* @__PURE__ */ jsx8(Link3, { to: "variants/create", children: t("actions.create") })
1506
- }
1507
- )
1508
- ] }),
1509
- /* @__PURE__ */ jsx8("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx8(
1510
- DataTable,
1511
- {
1512
- data: variants,
1513
- columns,
1514
- filters,
1515
- rowCount: count,
1516
- getRowId: (row) => row.id,
1517
- rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
1518
- pageSize: PAGE_SIZE,
1519
- isLoading: isPending,
1520
- compact: true,
1521
- emptyState: {
1522
- empty: {
1523
- heading: t("products.variants.empty.heading"),
1524
- description: t("products.variants.empty.description")
1525
- },
1526
- filtered: {
1527
- heading: t("products.variants.filtered.heading"),
1528
- description: t("products.variants.filtered.description")
1529
- }
1530
- },
1531
- prefix: PREFIX
1532
- }
1533
- ) })
1534
- ] });
1535
- };
1536
- var columnHelper = createDataTableColumnHelper();
1537
- var useColumns = (product) => {
1538
- const { t } = useTranslation8();
1539
- const navigate = useNavigate2();
1540
- const { mutateAsync } = useDeleteVariantLazy(product.id);
1541
- const prompt = usePrompt4();
1542
- const [searchParams] = useSearchParams();
1543
- const tableSearchParams = useMemo2(() => {
1544
- const filtered = new URLSearchParams();
1545
- for (const [key, value] of searchParams.entries()) {
1546
- if (key.startsWith(`${PREFIX}_`)) {
1547
- filtered.append(key, value);
1548
- }
1549
- }
1550
- return filtered;
1551
- }, [searchParams]);
1552
- const dateColumns = useDataTableDateColumns();
1553
- const handleDelete = useCallback(
1554
- async (id, title) => {
1555
- const res = await prompt({
1556
- title: t("general.areYouSure"),
1557
- description: t("products.deleteVariantWarning", {
1558
- title
1559
- }),
1560
- confirmText: t("actions.delete"),
1561
- cancelText: t("actions.cancel")
1562
- });
1563
- if (!res) {
1564
- return;
1565
- }
1566
- await mutateAsync({ variantId: id });
1567
- },
1568
- [mutateAsync, prompt, t]
1569
- );
1570
- const attributeColumns = useMemo2(() => {
1571
- const variantAttributes = product?.attributes?.filter((attr) => attr.is_variant_axis);
1572
- if (!variantAttributes?.length) {
1573
- return [];
1574
- }
1575
- return variantAttributes.map((attribute) => {
1576
- return columnHelper.display({
1577
- id: `attribute-${attribute.id}`,
1578
- header: attribute.name,
1579
- cell: ({ row }) => {
1580
- const variantOpt = row.original.options?.find(
1581
- (opt) => opt.option?.title === attribute.name
1582
- );
1583
- if (!variantOpt?.value) {
1584
- return /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1585
- }
1586
- return /* @__PURE__ */ jsx8(
1587
- "div",
1588
- {
1589
- className: "flex flex-wrap items-center gap-1",
1590
- "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1591
- children: /* @__PURE__ */ jsx8(Tooltip4, { content: variantOpt.value, children: /* @__PURE__ */ jsx8(
1592
- Badge3,
1593
- {
1594
- size: "2xsmall",
1595
- title: variantOpt.value,
1596
- className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1597
- "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${variantOpt.value}`,
1598
- children: variantOpt.value
1599
- }
1600
- ) })
1601
- }
1602
- );
1603
- }
1604
- });
1605
- });
1606
- }, [product]);
1607
- const getActions = useCallback(
1608
- (ctx) => {
1609
- const variant = ctx.row.original;
1610
- const mainActions = [
1611
- {
1612
- icon: /* @__PURE__ */ jsx8(PencilSquare4, {}),
1613
- label: t("actions.edit"),
1614
- onClick: (row) => {
1615
- navigate(
1616
- `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1617
- {
1618
- state: {
1619
- restore_params: tableSearchParams.toString()
1620
- }
1621
- }
1622
- );
1623
- }
1624
- }
1625
- ];
1626
- const secondaryActions = [
1627
- {
1628
- icon: /* @__PURE__ */ jsx8(Trash3, {}),
1629
- label: t("actions.delete"),
1630
- onClick: () => handleDelete(variant.id, variant.title)
1631
- }
1632
- ];
1633
- return [mainActions, secondaryActions];
1634
- },
1635
- [handleDelete, navigate, t, tableSearchParams]
1636
- );
1637
- return useMemo2(() => {
1638
- return [
1639
- columnHelper.accessor("title", {
1640
- header: t("fields.title"),
1641
- enableSorting: true,
1642
- sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1643
- sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1644
- }),
1645
- columnHelper.accessor("sku", {
1646
- header: t("fields.sku"),
1647
- cell: ({ getValue }) => {
1648
- const value = getValue();
1649
- return value ? value : /* @__PURE__ */ jsx8("span", { className: "text-ui-fg-muted", children: "-" });
1650
- }
1651
- }),
1652
- ...attributeColumns,
1653
- ...dateColumns,
1654
- columnHelper.action({
1655
- actions: getActions
1656
- })
1657
- ];
1658
- }, [t, attributeColumns, dateColumns, getActions]);
1659
- };
1660
- var useFilters = () => {
1661
- const dateFilters = useDataTableDateFilters();
1662
- return useMemo2(() => {
1663
- return [
1664
- ...dateFilters
1665
- ];
1666
- }, [dateFilters]);
1667
- };
1668
-
1669
- // src/pages/products/product-detail/product-detail.tsx
1670
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1671
- var Root = ({ children }) => {
1672
- const initialData = useLoaderData();
1673
- const { id } = useParams();
1674
- const {
1675
- product: rawProduct,
1676
- isLoading,
1677
- isError,
1678
- error
1679
- } = useProduct(id, PRODUCT_DETAIL_QUERY, {
1680
- initialData
1681
- });
1682
- const product = rawProduct;
1683
- if (isLoading || !product) {
1684
- return /* @__PURE__ */ jsx9(
1685
- TwoColumnPageSkeleton,
1686
- {
1687
- mainSections: 4,
1688
- sidebarSections: 3,
1689
- showJSON: true,
1690
- showMetadata: true
1691
- }
1692
- );
1693
- }
1694
- if (isError) {
1695
- throw error;
1696
- }
1697
- return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(
1698
- TwoColumnPage,
1699
- {
1700
- data: product,
1701
- showJSON: true,
1702
- showMetadata: true,
1703
- "data-testid": "product-detail-page",
1704
- children
1705
- }
1706
- ) : /* @__PURE__ */ jsxs9(
1707
- TwoColumnPage,
1708
- {
1709
- data: product,
1710
- showJSON: true,
1711
- showMetadata: true,
1712
- "data-testid": "product-detail-page",
1713
- children: [
1714
- /* @__PURE__ */ jsxs9(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1715
- /* @__PURE__ */ jsx9(ProductActiveRequestSection, { product }),
1716
- /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1717
- /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1718
- /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1719
- /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1720
- ] }),
1721
- /* @__PURE__ */ jsxs9(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1722
- /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1723
- /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1724
- ] })
1725
- ]
1726
- }
1727
- );
1728
- };
1729
- var ProductDetailPage = Object.assign(Root, {
1730
- Main: TwoColumnPage.Main,
1731
- Sidebar: TwoColumnPage.Sidebar,
1732
- MainActiveRequestSection: ProductActiveRequestSection,
1733
- MainActiveEditSection: ProductActiveEditSection,
1734
- MainGeneralSection: ProductGeneralSection,
1735
- MainMediaSection: ProductMediaSection,
1736
- MainAttributeSection: ProductAttributeSection,
1737
- MainVariantSection: ProductVariantSection,
1738
- SidebarOrganizationSection: ProductOrganizationSection
1739
- });
1740
-
1741
- export {
1742
- ProductDetailPage
1743
- };