@mercurjs/vendor 2.2.0-canary.9 → 2.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/dist/{[id]-YPCO3DJV.js → [id]-2LOU4IGP.js} +31 -13
  2. package/dist/{[id]-GC3ZYPK4.js → [id]-6K5OJU5T.js} +35 -35
  3. package/dist/{[id]-ZCMSBEVM.js → [id]-6RTJXOT5.js} +8 -7
  4. package/dist/[id]-7T4JCGCZ.js +639 -0
  5. package/dist/{[id]-QQU5HVFU.js → [id]-BMW6PEZT.js} +42 -42
  6. package/dist/[id]-FN47ZDW5.js +515 -0
  7. package/dist/{[id]-A55T2ORL.js → [id]-KTJU7CRX.js} +432 -390
  8. package/dist/{[id]-T5ECVBPF.js → [id]-NUH6WK7Y.js} +100 -60
  9. package/dist/{[id]-J6BZG5PU.js → [id]-RRWUTLTP.js} +145 -47
  10. package/dist/{[id]-FWCX5PTI.js → [id]-TJF2WSOF.js} +148 -59
  11. package/dist/{[id]-SHAJTJNZ.js → [id]-UWBLKWZI.js} +57 -56
  12. package/dist/[id]-VWIZD2JL.js +477 -0
  13. package/dist/[id]-XRSZYRKI.js +997 -0
  14. package/dist/{[id]-BC7IKQTQ.js → [id]-YIP2TDVC.js} +130 -52
  15. package/dist/{[location_id]-NUBXDDJC.js → [location_id]-TUAKRLYQ.js} +17 -16
  16. package/dist/{[province_id]-6GUA4PV5.js → [province_id]-6VYYS4DZ.js} +34 -34
  17. package/dist/{add-RU3WL4YB.js → add-KB477RH5.js} +65 -31
  18. package/dist/{add-NTRYWOJF.js → add-NSLA2RT7.js} +64 -61
  19. package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-PB4LCA5E.js} +43 -42
  20. package/dist/{add-products-Q4MMDQKT.js → add-products-O72MJ3N2.js} +38 -40
  21. package/dist/{add-promotions-KD2CWQPF.js → add-promotions-6X7N3DTU.js} +17 -17
  22. package/dist/{add-to-campaign-QKYQCSR2.js → add-to-campaign-7WAUGNNI.js} +6 -6
  23. package/dist/{address-77Y3AOQ3.js → address-ZR4EM2QA.js} +42 -31
  24. package/dist/{adjust-inventory-AFJLWF5R.js → adjust-inventory-P4X6PFKW.js} +4 -4
  25. package/dist/allocate-items-NSQOU2QJ.js +685 -0
  26. package/dist/{areas-XUC5V5UO.js → areas-N4ORDJTD.js} +13 -13
  27. package/dist/attributes-DRC3WYY6.js +353 -0
  28. package/dist/{breadcrumb-IK6XCQOQ.js → breadcrumb-4YT6FRUQ.js} +4 -4
  29. package/dist/{breadcrumb-KTARIL65.js → breadcrumb-BKBSL3PC.js} +4 -4
  30. package/dist/breadcrumb-ETWGVI34.js +28 -0
  31. package/dist/{breadcrumb-YBBYFQYG.js → breadcrumb-F4N5CPRD.js} +2 -2
  32. package/dist/{breadcrumb-FPWBT76A.js → breadcrumb-JGDD7EHO.js} +3 -3
  33. package/dist/breadcrumb-JWDW3P6C.js +46 -0
  34. package/dist/{breadcrumb-PBR27GGX.js → breadcrumb-KKWNLFMC.js} +4 -4
  35. package/dist/{breadcrumb-3Z7KZG62.js → breadcrumb-LEFHXFLT.js} +3 -3
  36. package/dist/{breadcrumb-D3UDTWGE.js → breadcrumb-MOA2DBOE.js} +2 -2
  37. package/dist/{breadcrumb-UAUX7XCV.js → breadcrumb-PJOTRHG7.js} +5 -3
  38. package/dist/breadcrumb-PYLGF3AN.js +47 -0
  39. package/dist/{breadcrumb-2XA2WOK7.js → breadcrumb-TO45VBVD.js} +2 -2
  40. package/dist/{breadcrumb-F3BN5753.js → breadcrumb-UEUUMDIY.js} +2 -2
  41. package/dist/breadcrumb-VCRGVYJR.js +33 -0
  42. package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-WWLMQQQF.js} +10 -9
  43. package/dist/breadcrumb-Y7N7L7DM.js +13 -0
  44. package/dist/{breadcrumb-Y5UW3I4C.js → breadcrumb-YOY6Z36F.js} +2 -2
  45. package/dist/{campaigns-JAQTSA4Z.js → campaigns-GPLRB2AR.js} +8 -8
  46. package/dist/{categories-T4QJYX4R.js → categories-53X36JNS.js} +12 -10
  47. package/dist/{chunk-MZTDRBCR.js → chunk-2INANL6V.js} +61 -62
  48. package/dist/{chunk-O7VOGTLX.js → chunk-2P5H7EVR.js} +1 -1
  49. package/dist/{chunk-ADGVQVHP.js → chunk-3F4MUPGR.js} +3 -3
  50. package/dist/chunk-42R54Z2X.js +8 -0
  51. package/dist/chunk-432S4FGR.js +0 -0
  52. package/dist/{chunk-6K6EQOJF.js → chunk-4CNLTLQP.js} +7 -6
  53. package/dist/{chunk-5QI3NDJG.js → chunk-4EAC3GT7.js} +2 -2
  54. package/dist/{chunk-S23FD6FA.js → chunk-4NADEZZQ.js} +15 -4
  55. package/dist/{chunk-HDEOZN2Q.js → chunk-4OQLPIUZ.js} +27 -27
  56. package/dist/{chunk-VDHW6H5F.js → chunk-55TS752B.js} +4 -4
  57. package/dist/{chunk-LFX6WU4A.js → chunk-5ALC4Z2H.js} +0 -13
  58. package/dist/{chunk-4LVP635F.js → chunk-5FBQOAXU.js} +135 -126
  59. package/dist/{chunk-DDJQRV6E.js → chunk-5NVY7JZC.js} +5 -5
  60. package/dist/{chunk-E2HQPY32.js → chunk-5RMLLTR7.js} +5 -5
  61. package/dist/chunk-5SRG2247.js +353 -0
  62. package/dist/{chunk-L57USMYC.js → chunk-5YZ3G5EZ.js} +1 -1
  63. package/dist/{chunk-JAUZ73XE.js → chunk-744GLNZW.js} +22 -62
  64. package/dist/{chunk-463CNCJC.js → chunk-7CQ4RKVV.js} +53 -41
  65. package/dist/{chunk-U5G3AVED.js → chunk-7HLAOLG7.js} +1 -1
  66. package/dist/{chunk-M6N4ISXL.js → chunk-7MARNXFG.js} +1 -1
  67. package/dist/{chunk-SSUUT5LK.js → chunk-7TQNE3E2.js} +5 -4
  68. package/dist/chunk-7ZNZJIVN.js +30 -0
  69. package/dist/{chunk-TYESCFYW.js → chunk-AOLE7MBM.js} +1 -1
  70. package/dist/{chunk-YHIJCI4U.js → chunk-APWPWXWQ.js} +22 -11
  71. package/dist/{chunk-TBYCZRZ7.js → chunk-BQHVM46E.js} +32 -55
  72. package/dist/{chunk-UFFVRF4V.js → chunk-BXDN7ZA5.js} +26 -19
  73. package/dist/{chunk-BXRNZS5K.js → chunk-CLS6PNZY.js} +3 -3
  74. package/dist/{chunk-7CMRFP5Q.js → chunk-COGWTNSC.js} +3 -3
  75. package/dist/{chunk-EIZP3XL5.js → chunk-CQRCUQC4.js} +1 -1
  76. package/dist/{chunk-3EF54XFY.js → chunk-CVXKASWV.js} +2 -2
  77. package/dist/chunk-EEBJYXWA.js +15 -0
  78. package/dist/{chunk-TW324MAT.js → chunk-EFKHV25A.js} +2 -2
  79. package/dist/{chunk-PZEPOPMV.js → chunk-ESXMD6CR.js} +189 -84
  80. package/dist/{chunk-SPOHNK4X.js → chunk-EX5IIVVN.js} +7 -7
  81. package/dist/{chunk-YQYRAD5C.js → chunk-FCZJAYMM.js} +1 -1
  82. package/dist/{chunk-SZBERGA4.js → chunk-FXQWGW2J.js} +4 -4
  83. package/dist/{chunk-6SJTAE66.js → chunk-GGXGKMYK.js} +1 -1
  84. package/dist/chunk-GK6X67DV.js +462 -0
  85. package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
  86. package/dist/{chunk-IQWK723D.js → chunk-GZ4KTAWS.js} +1 -1
  87. package/dist/{chunk-3PMM6AMP.js → chunk-GZRCPKO5.js} +20 -9
  88. package/dist/{chunk-TF6V3TFG.js → chunk-HLAV55RT.js} +2 -2
  89. package/dist/{chunk-E6W57UP3.js → chunk-HRUO43BZ.js} +2 -2
  90. package/dist/chunk-I3I5IYHO.js +33 -0
  91. package/dist/{chunk-M6GKMFTC.js → chunk-ICKOFNHF.js} +6 -3
  92. package/dist/{chunk-53SII3U2.js → chunk-II2GAEVL.js} +27 -15
  93. package/dist/{chunk-L4KBTV57.js → chunk-IMJ62GAP.js} +1 -3
  94. package/dist/{chunk-HXGLPDZW.js → chunk-IMVZFBCM.js} +6 -17
  95. package/dist/{chunk-SGR4DMCW.js → chunk-INYLPVCG.js} +3 -3
  96. package/dist/chunk-IPNO77ZJ.js +376 -0
  97. package/dist/{chunk-5T6UWTRU.js → chunk-IV57G2CB.js} +19 -11
  98. package/dist/{chunk-GAE6TKOR.js → chunk-IWF43LO2.js} +5 -6
  99. package/dist/{chunk-BOZJOOGW.js → chunk-JIXW4WHZ.js} +5 -5
  100. package/dist/{chunk-3B34B2M2.js → chunk-JJP6AKMV.js} +1 -1
  101. package/dist/{chunk-2QTNCGKX.js → chunk-JLLFEA23.js} +1 -1
  102. package/dist/{chunk-VXMOPVRH.js → chunk-JR7AABT5.js} +2 -2
  103. package/dist/{chunk-6OUPJNYO.js → chunk-KCHYLLVG.js} +2 -2
  104. package/dist/{chunk-YGRTRAWX.js → chunk-KDE4HKH2.js} +1 -0
  105. package/dist/{chunk-LARLBYU6.js → chunk-KEXXZLVI.js} +2 -2
  106. package/dist/{chunk-VXWN37PT.js → chunk-KIURBTC4.js} +1 -1
  107. package/dist/{chunk-DO4F5FIO.js → chunk-LOBDXF34.js} +5 -5
  108. package/dist/{chunk-RIN4CBRB.js → chunk-LXZXXOJ3.js} +1 -17
  109. package/dist/chunk-LYYM7H7H.js +59 -0
  110. package/dist/{chunk-VZUA5SRD.js → chunk-MABIMRLS.js} +2 -2
  111. package/dist/{chunk-MWQQVKRU.js → chunk-MAVQ636Y.js} +1 -1
  112. package/dist/{chunk-YQZBAP3S.js → chunk-MDGTQT5D.js} +77 -23
  113. package/dist/{chunk-DQKK43PR.js → chunk-MJ4B2OFU.js} +24 -13
  114. package/dist/{chunk-IBEUR3J7.js → chunk-MK44MYO7.js} +3 -3
  115. package/dist/{chunk-S7EKBD2C.js → chunk-MNHP6YRC.js} +3 -3
  116. package/dist/{chunk-VV6IKGCN.js → chunk-NTJ3BMOE.js} +1 -1
  117. package/dist/{chunk-X4GWB6AT.js → chunk-O4N6UK6M.js} +4 -4
  118. package/dist/{chunk-K6LOZ4S3.js → chunk-OOK3BD5Z.js} +5 -5
  119. package/dist/{chunk-6UZERVBI.js → chunk-P3ETXWHD.js} +2 -2
  120. package/dist/{chunk-KIFSQOM2.js → chunk-P6XBOWET.js} +9 -8
  121. package/dist/{chunk-4S6XGIC6.js → chunk-PUAWN7SS.js} +1 -1
  122. package/dist/{chunk-U6PBLMXD.js → chunk-Q6SPIHFR.js} +8 -3
  123. package/dist/{chunk-MJCL3WID.js → chunk-QGZH3D2P.js} +5 -2
  124. package/dist/{chunk-F4OJN2F2.js → chunk-QIF4QE7T.js} +1 -1
  125. package/dist/{chunk-BENED3NB.js → chunk-QMTSINXN.js} +612 -931
  126. package/dist/{chunk-VCOQ7WQ2.js → chunk-QU444FAP.js} +47 -16
  127. package/dist/{chunk-PAVZ6FPK.js → chunk-S4ILPAEO.js} +30 -14
  128. package/dist/{chunk-U2ZFCAPX.js → chunk-SITRHMZZ.js} +11 -8
  129. package/dist/chunk-SPFLYPY6.js +6 -0
  130. package/dist/{chunk-2USXZSTK.js → chunk-SYWAMZNQ.js} +8 -7
  131. package/dist/{chunk-LQSLDDPT.js → chunk-T35QBLG7.js} +1 -1
  132. package/dist/{chunk-T5MJWWDX.js → chunk-TNZMNJRF.js} +10 -9
  133. package/dist/{chunk-QLBIBLOY.js → chunk-U5MXCMDR.js} +26 -15
  134. package/dist/{chunk-Y2MQ5EMD.js → chunk-UEPUKWD7.js} +12 -3
  135. package/dist/{chunk-7IPCLQ5V.js → chunk-UKTJEFMZ.js} +4 -4
  136. package/dist/{chunk-UORPTGV2.js → chunk-ULEW54ED.js} +11 -15
  137. package/dist/{chunk-LRARA622.js → chunk-VE6GRIIN.js} +2 -2
  138. package/dist/{chunk-YUKD5RCX.js → chunk-VR7P4DAZ.js} +1 -1
  139. package/dist/{chunk-UCYSCKZV.js → chunk-VYSB4CTB.js} +2114 -1699
  140. package/dist/{chunk-OZ44ATGE.js → chunk-W5LVOEN2.js} +15 -15
  141. package/dist/{chunk-LQD232FW.js → chunk-WJ5EU3KW.js} +1 -1
  142. package/dist/{chunk-BER45EYD.js → chunk-WQQMCV7M.js} +1 -1
  143. package/dist/chunk-WQTWBXKO.js +23 -0
  144. package/dist/{chunk-XCIMOIX6.js → chunk-XBKWFLJG.js} +1 -1
  145. package/dist/{chunk-3BXCPHN6.js → chunk-XCHKUSUU.js} +1 -0
  146. package/dist/chunk-XQUF3WIS.js +159 -0
  147. package/dist/{chunk-LWJF63JW.js → chunk-XWHHBJGS.js} +92 -16
  148. package/dist/{chunk-27WLUOI2.js → chunk-Y6S7K3YB.js} +1 -1
  149. package/dist/{chunk-6FUIK3PX.js → chunk-YEPZGGUE.js} +43 -21
  150. package/dist/{chunk-JQV7CXEC.js → chunk-YNGA3GRX.js} +17 -2
  151. package/dist/{chunk-NBKWY6XN.js → chunk-YRXXO2RT.js} +3 -3
  152. package/dist/{chunk-LKUW5SV4.js → chunk-YXWZT3PX.js} +3 -3
  153. package/dist/{chunk-X22KTLZ7.js → chunk-Z3SPAROE.js} +1 -1
  154. package/dist/{chunk-LHKHQAAY.js → chunk-ZLYGEART.js} +1 -1
  155. package/dist/{chunk-NBPMNUKZ.js → chunk-ZQCCVCHB.js} +1 -1
  156. package/dist/collections-AE7QLCFD.js +70 -0
  157. package/dist/{configuration-C4IGBNXH.js → configuration-I6BUESSG.js} +3 -3
  158. package/dist/{configuration-7IYZ6GNP.js → configuration-QVMG6LAM.js} +5 -5
  159. package/dist/{create-JGYG5SBM.js → create-2DXKC5OJ.js} +47 -44
  160. package/dist/{create-MS6KKFSV.js → create-2WFPJBDQ.js} +31 -32
  161. package/dist/{create-GGACODDN.js → create-3PIY2COT.js} +55 -38
  162. package/dist/{create-F5R76QML.js → create-7HXY7U5W.js} +72 -37
  163. package/dist/{create-A7B3MLJX.js → create-BE2YNVX3.js} +52 -52
  164. package/dist/{create-UPYB65PD.js → create-BV3QDTK2.js} +4 -4
  165. package/dist/{create-5PSOIHIT.js → create-C2WABAJU.js} +6 -6
  166. package/dist/{create-FKRYB7ZS.js → create-EIMV4KCC.js} +67 -53
  167. package/dist/{create-TKXH5KQY.js → create-F2VZZ7XS.js} +61 -37
  168. package/dist/{create-R7K3ECN6.js → create-K26SM34L.js} +3 -3
  169. package/dist/{create-MZYXMGKP.js → create-K7V36IWH.js} +13 -13
  170. package/dist/{create-JF2OUZQA.js → create-KW6KFXGI.js} +24 -25
  171. package/dist/create-MW33P4AB.js +245 -0
  172. package/dist/{create-YBF4YGWG.js → create-NF2LPVXA.js} +3 -3
  173. package/dist/{create-ODOFJF5N.js → create-RXIY777H.js} +31 -32
  174. package/dist/{create-O35JRZEF.js → create-TPNH5U7Z.js} +28 -29
  175. package/dist/{create-SFU3W3ZH.js → create-U64NEOEL.js} +3 -3
  176. package/dist/{create-XVHOCZHJ.js → create-X5SOAPD3.js} +3 -3
  177. package/dist/create-ZZBMZZQG.js +79 -0
  178. package/dist/customer-group-add-customers-DZ3JYD6S.js +251 -0
  179. package/dist/customer-group-create-6YNGAE2W.js +147 -0
  180. package/dist/customer-group-detail-VZUHEIRY.js +62 -0
  181. package/dist/customer-group-edit-UA36663R.js +159 -0
  182. package/dist/customer-groups-RGHBJV55.js +305 -0
  183. package/dist/{customers-SOLJ2KQQ.js → customers-7S2MK4VG.js} +10 -10
  184. package/dist/edit-3RDEZH6V.js +367 -0
  185. package/dist/{edit-ORXS3A2Y.js → edit-3V34KJS2.js} +3 -3
  186. package/dist/{edit-5CROKEJE.js → edit-3XGZNC24.js} +53 -53
  187. package/dist/{edit-2R5QCPTB.js → edit-45TYWHR6.js} +25 -26
  188. package/dist/{edit-Y2U3KAVB.js → edit-5IQNX7YB.js} +87 -50
  189. package/dist/{edit-3E4ZO7HT.js → edit-GBTLRL6H.js} +33 -35
  190. package/dist/{edit-G2E5SNGU.js → edit-HXCSFGP5.js} +24 -25
  191. package/dist/{edit-Q3UQIOLS.js → edit-I2RJUPWV.js} +4 -4
  192. package/dist/{edit-ZMERG3L7.js → edit-JB7KVBOL.js} +5 -5
  193. package/dist/{edit-C4OCKQVU.js → edit-JT4OKP5H.js} +25 -9
  194. package/dist/{edit-O4JLGKQR.js → edit-NHQJLCAK.js} +4 -4
  195. package/dist/edit-PIOHPBF5.js +103 -0
  196. package/dist/{edit-FXNXTVIW.js → edit-UYYI6HIT.js} +30 -13
  197. package/dist/{edit-VVLITC2E.js → edit-VFHZ6GVR.js} +44 -78
  198. package/dist/{edit-HTLLYECP.js → edit-W7T5NAFW.js} +33 -35
  199. package/dist/{edit-KAKVPHZZ.js → edit-WN2Q3TOX.js} +4 -4
  200. package/dist/{edit-OKU6FMHJ.js → edit-X4DFAW7S.js} +60 -39
  201. package/dist/{edit-ZAHCMF5U.js → edit-YLWMEXUS.js} +25 -9
  202. package/dist/{edit-522DG3BY.js → edit-ZOLSAIKF.js} +3 -3
  203. package/dist/{edit-budget-L3CCEWNF.js → edit-budget-XVJ65KUO.js} +3 -3
  204. package/dist/{edit-inventory-item-ZKXXL3QK.js → edit-inventory-item-NHSXZ7UB.js} +24 -9
  205. package/dist/{edit-inventory-item-attributes-GSKUMORD.js → edit-inventory-item-attributes-VTFPTLLT.js} +3 -3
  206. package/dist/edit-price-XCJDZ4CU.js +197 -0
  207. package/dist/edit-stock-5SQJH74B.js +230 -0
  208. package/dist/extension-targets.d.ts +248 -0
  209. package/dist/extension-targets.js +1 -0
  210. package/dist/fulfillment-5LEDKCH7.js +650 -0
  211. package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KUIDFRP4.js} +39 -40
  212. package/dist/index.css +82 -45
  213. package/dist/index.d.ts +2 -0
  214. package/dist/index.js +389 -271
  215. package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-L26YLIBO.js} +18 -18
  216. package/dist/{inventory-WSFLTA6Z.js → inventory-ZWZ2SUYW.js} +9 -9
  217. package/dist/{invite-2673PU4I.js → invite-CQEODMVX.js} +29 -41
  218. package/dist/{invite-HRXZ5YBP.js → invite-VYXX7ICP.js} +38 -39
  219. package/dist/loader-CDW7SKZP.js +34 -0
  220. package/dist/loader-OGR7BCER.js +35 -0
  221. package/dist/{locations-INS6FTMJ.js → locations-UVMY2QLW.js} +3 -3
  222. package/dist/login-Z43XSPNR.js +39 -0
  223. package/dist/{manage-locations-XHH5DVIR.js → manage-locations-WD3WRVMF.js} +3 -3
  224. package/dist/media-UAAKHWJZ.js +316 -0
  225. package/dist/{media-J22P2DK4.js → media-VRNKF2TX.js} +31 -31
  226. package/dist/{metadata-REQIFWWH.js → metadata-6FYHGP2P.js} +27 -28
  227. package/dist/{metadata-Q74OJWUD.js → metadata-GI4A7XUC.js} +27 -28
  228. package/dist/{metadata-NIDIBXJT.js → metadata-GR7QS5N6.js} +27 -28
  229. package/dist/{metadata-YVHJPDLD.js → metadata-MRDVKETB.js} +25 -26
  230. package/dist/{metadata-D6M66NQK.js → metadata-QZEX5FQH.js} +25 -26
  231. package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-LRKRHBRT.js} +246 -265
  232. package/dist/offer-detail-page-RSBA6WJB.js +637 -0
  233. package/dist/offer-variant-detail-page-KBDN27ZG.js +411 -0
  234. package/dist/offers-LBJILJQX.js +54 -0
  235. package/dist/{onboarding-MK2RIFD4.js → onboarding-4DXHB5KY.js} +71 -73
  236. package/dist/orders-JGKXRRJ6.js +63 -0
  237. package/dist/{organization-XO3T2K2X.js → organization-NQHWLNES.js} +26 -27
  238. package/dist/{organize-5XRZWD5C.js → organize-PNLFCNY4.js} +4 -4
  239. package/dist/{organize-Z7JTTDH4.js → organize-X4IMS4S5.js} +4 -4
  240. package/dist/pages/index.d.ts +249 -234
  241. package/dist/pages/index.js +91 -91
  242. package/dist/{payment-details-CFTX3QDL.js → payment-details-T7CKYYQR.js} +43 -32
  243. package/dist/{payouts-7Q7D4FET.js → payouts-MGC6Z3AT.js} +10 -10
  244. package/dist/{price-lists-6TFLA53G.js → price-lists-QJTMWEEP.js} +11 -11
  245. package/dist/{pricing-ECXV6K7G.js → pricing-CFDZXHIE.js} +29 -30
  246. package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-LEEEQ2TR.js} +21 -19
  247. package/dist/{product-tags-5O7ZG6SA.js → product-tags-Z7DOYERG.js} +47 -47
  248. package/dist/{product-types-PKUEL7X5.js → product-types-F5YH6TBY.js} +9 -9
  249. package/dist/product-variant-detail-EUWXJWAJ.js +372 -0
  250. package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-OP7DAKIN.js} +45 -27
  251. package/dist/{products-BM3IIH5P.js → products-QRYZFYMR.js} +39 -40
  252. package/dist/products-SGYVJ33I.js +93 -0
  253. package/dist/{professional-details-ED4HNYXY.js → professional-details-UVRM7GID.js} +42 -31
  254. package/dist/{profile-6TGCNNUU.js → profile-HYJJLO63.js} +75 -42
  255. package/dist/{promotions-AZM7JQAJ.js → promotions-TF4GPADY.js} +11 -11
  256. package/dist/{receive-2GFZTVNC.js → receive-NHOBI4NE.js} +63 -21
  257. package/dist/{refund-IGMSXQNX.js → refund-6MXXZP2L.js} +78 -54
  258. package/dist/{register-ADZCPWEV.js → register-SC2R7TDT.js} +26 -27
  259. package/dist/{reset-password-RGWK33Q7.js → reset-password-OIZAI2US.js} +3 -3
  260. package/dist/{return-reasons-QJRA2ZX6.js → return-reasons-L5BFL5WW.js} +28 -24
  261. package/dist/{sales-channels-U55MUDQP.js → sales-channels-57VSC3CU.js} +11 -11
  262. package/dist/{sales-channels-CZDU7VTE.js → sales-channels-VXOZQKLK.js} +15 -15
  263. package/dist/{settings-2GCQQTO6.js → settings-UZGHDHAR.js} +54 -54
  264. package/dist/{shipment-HWQHMX2L.js → shipment-KF4M3RDJ.js} +24 -25
  265. package/dist/shipping-3KKFZONF.js +125 -0
  266. package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-ZHE4U2MG.js} +5 -9
  267. package/dist/shipping-profiles-W6ESWKTU.js +46 -0
  268. package/dist/{stock-MQA7PRO6.js → stock-JCDE7SMM.js} +27 -28
  269. package/dist/{store-5ZHZR4JI.js → store-UOOVXKZY.js} +136 -63
  270. package/dist/{store-closure-H5WHV3LA.js → store-closure-7TG7Y7LW.js} +24 -25
  271. package/dist/{store-select-PZS556FB.js → store-select-SARJSWL4.js} +45 -27
  272. package/dist/{tax-regions-HDLBFZVG.js → tax-regions-4NK7L6FA.js} +13 -10
  273. package/dist/{team-CLKJCZNH.js → team-45IARFMH.js} +40 -40
  274. package/package.json +23 -18
  275. package/dist/[id]-B4YZTANM.js +0 -1571
  276. package/dist/[id]-FE5GYYVZ.js +0 -481
  277. package/dist/[id]-GBT6VB4S.js +0 -361
  278. package/dist/[id]-QOEO3JOV.js +0 -384
  279. package/dist/allocate-items-TCM5A55Y.js +0 -548
  280. package/dist/attributes-SZP2MM5L.js +0 -278
  281. package/dist/breadcrumb-5NP23D6X.js +0 -34
  282. package/dist/breadcrumb-EVZIOB2G.js +0 -47
  283. package/dist/breadcrumb-TNJSGX4T.js +0 -48
  284. package/dist/chunk-27KRIXMQ.js +0 -71
  285. package/dist/chunk-BDZOSMAX.js +0 -23
  286. package/dist/chunk-CFRWIQIZ.js +0 -43
  287. package/dist/chunk-FP6U6BPH.js +0 -61
  288. package/dist/chunk-RXV7INUV.js +0 -426
  289. package/dist/chunk-T6LHVNWO.js +0 -27
  290. package/dist/collections-URH2TCWJ.js +0 -69
  291. package/dist/create-7R6CZU53.js +0 -215
  292. package/dist/create-Z5VPBELS.js +0 -76
  293. package/dist/edit-GQNIINRR.js +0 -192
  294. package/dist/edit-XSICGAVO.js +0 -176
  295. package/dist/fulfillment-76IVZ266.js +0 -567
  296. package/dist/loader-VDYPD3RI.js +0 -31
  297. package/dist/login-TWUBU6I6.js +0 -40
  298. package/dist/metadata-5BPOBBU2.js +0 -45
  299. package/dist/offer-detail-page-6SIBQTLP.js +0 -492
  300. package/dist/offer-edit-page-3MO566RP.js +0 -151
  301. package/dist/offers-GVN5LCK6.js +0 -32
  302. package/dist/orders-TVQDR4OJ.js +0 -64
  303. package/dist/product-variant-detail-PUWOMVHQ.js +0 -210
  304. package/dist/products-XE5YPQ66.js +0 -93
  305. package/dist/shipping-profiles-C5WBXWZ2.js +0 -47
  306. /package/dist/{chunk-HFRHHT36.js → chunk-NWU7EGGF.js} +0 -0
@@ -1,1571 +0,0 @@
1
- import {
2
- SectionRow
3
- } from "./chunk-4TLP3TAA.js";
4
- import {
5
- useDataTableDateColumns
6
- } from "./chunk-FP6U6BPH.js";
7
- import {
8
- SidebarLink
9
- } from "./chunk-4GPAS5GW.js";
10
- import "./chunk-U2EI2ZLM.js";
11
- import {
12
- TwoColumnPage
13
- } from "./chunk-YV6MK4PZ.js";
14
- import {
15
- useDataTableDateFilters
16
- } from "./chunk-HFRHHT36.js";
17
- import {
18
- DataTable
19
- } from "./chunk-5T6UWTRU.js";
20
- import {
21
- useQueryParams
22
- } from "./chunk-THHRRYRS.js";
23
- import "./chunk-LRD242C7.js";
24
- import {
25
- require_dist
26
- } from "./chunk-UCYSCKZV.js";
27
- import {
28
- Thumbnail
29
- } from "./chunk-WIYFXWRI.js";
30
- import {
31
- TwoColumnPageSkeleton
32
- } from "./chunk-INNFZYX2.js";
33
- import {
34
- useProductTag
35
- } from "./chunk-TBYCZRZ7.js";
36
- import "./chunk-F4OJN2F2.js";
37
- import "./chunk-LRARA622.js";
38
- import "./chunk-M6N4ISXL.js";
39
- import "./chunk-S7EKBD2C.js";
40
- import {
41
- useProductType
42
- } from "./chunk-VV6IKGCN.js";
43
- import "./chunk-BXRNZS5K.js";
44
- import "./chunk-BOZJOOGW.js";
45
- import "./chunk-T6LHVNWO.js";
46
- import "./chunk-4S6XGIC6.js";
47
- import "./chunk-S23FD6FA.js";
48
- import "./chunk-IQWK723D.js";
49
- import {
50
- useCollection
51
- } from "./chunk-DDJQRV6E.js";
52
- import "./chunk-LWJF63JW.js";
53
- import "./chunk-VXWN37PT.js";
54
- import {
55
- useProductCategory
56
- } from "./chunk-5QI3NDJG.js";
57
- import "./chunk-VZUA5SRD.js";
58
- import "./chunk-VXMOPVRH.js";
59
- import "./chunk-NBPMNUKZ.js";
60
- import "./chunk-UORPTGV2.js";
61
- import "./chunk-Y2MQ5EMD.js";
62
- import {
63
- useSalesChannels
64
- } from "./chunk-3B34B2M2.js";
65
- import {
66
- ActionMenu
67
- } from "./chunk-BDGZ4EQO.js";
68
- import "./chunk-LAVHRER2.js";
69
- import "./chunk-QHQWEERJ.js";
70
- import "./chunk-Y7QKP6QU.js";
71
- import {
72
- PRODUCT_DETAIL_QUERY
73
- } from "./chunk-U6PBLMXD.js";
74
- import {
75
- productAttributesQueryKeys,
76
- productsQueryKeys,
77
- useCancelProductEdit,
78
- useDeleteProduct,
79
- useDeleteVariantLazy,
80
- useProduct,
81
- useProductAttribute,
82
- useProductChange,
83
- useProductVariants,
84
- useRemoveProductAttribute,
85
- useUpdateProduct
86
- } from "./chunk-JAUZ73XE.js";
87
- import "./chunk-A5DJIOHN.js";
88
- import {
89
- queryClient
90
- } from "./chunk-RHKRREUU.js";
91
- import "./chunk-ZA2KFUFR.js";
92
- import {
93
- sdk
94
- } from "./chunk-RIN4CBRB.js";
95
- import {
96
- __toESM
97
- } from "./chunk-NBMM2TZK.js";
98
-
99
- // src/pages/products/[id]/loader.tsx
100
- var productDetailQuery = (id) => ({
101
- queryKey: productsQueryKeys.detail(id, PRODUCT_DETAIL_QUERY),
102
- queryFn: async () => sdk.vendor.products.$id.query({
103
- $id: id,
104
- ...PRODUCT_DETAIL_QUERY
105
- })
106
- });
107
- var loader = async ({ params }) => {
108
- const id = params.id;
109
- const query = productDetailQuery(id);
110
- const response = await queryClient.ensureQueryData({
111
- ...query,
112
- staleTime: 9e4
113
- });
114
- return response;
115
- };
116
-
117
- // src/pages/products/[id]/product-detail-page.tsx
118
- import { Children } from "react";
119
- import { useLoaderData, useParams } from "react-router-dom";
120
-
121
- // src/pages/products/[id]/_components/product-active-edit-section/product-active-edit-section.tsx
122
- var import_types = __toESM(require_dist(), 1);
123
- import { ExclamationCircleSolid } from "@medusajs/icons";
124
- import { Button, Container, Heading, Text, toast, usePrompt } from "@medusajs/ui";
125
- import {
126
- describeProductChangeAction,
127
- extractReferenceIds,
128
- formatFieldValue,
129
- humanizeFieldName,
130
- isImageList,
131
- isReferenceField,
132
- partitionProductChangeActions
133
- } from "@mercurjs/dashboard-shared";
134
- import { useQueries } from "@tanstack/react-query";
135
- import { Fragment, useMemo } from "react";
136
- import { useTranslation } from "react-i18next";
137
- import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
138
- var ImageStrip = ({
139
- images,
140
- faded
141
- }) => /* @__PURE__ */ jsx("div", { className: faded ? "flex items-center gap-1.5 opacity-50" : "flex items-center gap-1.5", children: images.map((image, idx) => /* @__PURE__ */ jsx(Thumbnail, { src: image.url, size: "base" }, `${image.url}-${idx}`)) });
142
- var TypeName = ({ id }) => {
143
- const { product_type } = useProductType(id);
144
- return /* @__PURE__ */ jsx(Fragment2, { children: product_type?.value ?? id });
145
- };
146
- var CollectionName = ({ id }) => {
147
- const { collection } = useCollection(id);
148
- return /* @__PURE__ */ jsx(Fragment2, { children: collection?.title ?? id });
149
- };
150
- var CategoryName = ({ id }) => {
151
- const { product_category } = useProductCategory(id);
152
- return /* @__PURE__ */ jsx(Fragment2, { children: product_category?.name ?? id });
153
- };
154
- var TagName = ({ id }) => {
155
- const { product_tag } = useProductTag(id);
156
- return /* @__PURE__ */ jsx(Fragment2, { children: product_tag?.value ?? id });
157
- };
158
- var ReferenceName = ({
159
- field,
160
- id
161
- }) => {
162
- switch (field) {
163
- case "type_id":
164
- return /* @__PURE__ */ jsx(TypeName, { id });
165
- case "collection_id":
166
- return /* @__PURE__ */ jsx(CollectionName, { id });
167
- case "categories":
168
- return /* @__PURE__ */ jsx(CategoryName, { id });
169
- case "tags":
170
- return /* @__PURE__ */ jsx(TagName, { id });
171
- }
172
- };
173
- var ReferenceList = ({
174
- field,
175
- ids
176
- }) => {
177
- if (!ids.length) return /* @__PURE__ */ jsx(Fragment2, { children: "-" });
178
- return /* @__PURE__ */ jsx(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs(Fragment, { children: [
179
- idx > 0 && ", ",
180
- /* @__PURE__ */ jsx(ReferenceName, { field, id })
181
- ] }, `${field}-${id}`)) });
182
- };
183
- var FieldRow = ({ diff }) => {
184
- const { t } = useTranslation();
185
- const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
186
- const nextIsImages = isImageList(diff.next);
187
- const previousIsImages = isImageList(diff.previous);
188
- const renderAsImages = nextIsImages || previousIsImages;
189
- const renderAsReference = isReferenceField(diff.field);
190
- return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
191
- /* @__PURE__ */ jsx(
192
- Text,
193
- {
194
- size: "small",
195
- weight: "plus",
196
- leading: "compact",
197
- className: "text-ui-fg-subtle w-[160px] shrink-0",
198
- children: t(`fields.${diff.field}`, {
199
- defaultValue: humanizeFieldName(diff.field)
200
- })
201
- }
202
- ),
203
- renderAsImages ? /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
204
- hasPrevious && previousIsImages && /* @__PURE__ */ jsx(ImageStrip, { images: diff.previous, faded: true }),
205
- hasPrevious && /* @__PURE__ */ jsx(
206
- Text,
207
- {
208
- size: "small",
209
- leading: "compact",
210
- className: "text-ui-fg-subtle",
211
- children: "\u2192"
212
- }
213
- ),
214
- nextIsImages ? /* @__PURE__ */ jsx(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx(
215
- Text,
216
- {
217
- size: "small",
218
- leading: "compact",
219
- className: "text-ui-fg-subtle",
220
- children: formatFieldValue(diff.next, diff.field)
221
- }
222
- )
223
- ] }) : renderAsReference ? /* @__PURE__ */ jsxs(
224
- Text,
225
- {
226
- size: "small",
227
- leading: "compact",
228
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
229
- children: [
230
- hasPrevious && /* @__PURE__ */ jsx("span", { className: "line-through", children: /* @__PURE__ */ jsx(
231
- ReferenceList,
232
- {
233
- field: diff.field,
234
- ids: extractReferenceIds(
235
- diff.field,
236
- diff.previous
237
- )
238
- }
239
- ) }),
240
- hasPrevious && " \u2192 ",
241
- /* @__PURE__ */ jsx(
242
- ReferenceList,
243
- {
244
- field: diff.field,
245
- ids: extractReferenceIds(diff.field, diff.next)
246
- }
247
- )
248
- ]
249
- }
250
- ) : /* @__PURE__ */ jsxs(
251
- Text,
252
- {
253
- size: "small",
254
- leading: "compact",
255
- className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
256
- children: [
257
- hasPrevious && /* @__PURE__ */ jsx("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
258
- hasPrevious && " \u2192 ",
259
- formatFieldValue(diff.next, diff.field)
260
- ]
261
- }
262
- )
263
- ] });
264
- };
265
- var AttributeActionLine = ({
266
- attributeId,
267
- valueIds
268
- }) => {
269
- const { product_attribute } = useProductAttribute(attributeId);
270
- const name = product_attribute?.name ?? attributeId;
271
- const values = product_attribute?.values ?? [];
272
- const selectedNames = valueIds && valueIds.length ? valueIds.map((id) => {
273
- const match = values.find((v) => v.id === id);
274
- return match?.name ?? id;
275
- }) : [];
276
- return /* @__PURE__ */ jsxs(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
277
- /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: name }),
278
- selectedNames.length > 0 && `: ${selectedNames.join(", ")}`
279
- ] });
280
- };
281
- var VariantActionLine = ({
282
- title,
283
- images
284
- }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
285
- images && images.length > 0 && /* @__PURE__ */ jsx(ImageStrip, { images }),
286
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: title }) })
287
- ] });
288
- var ActionLine = ({
289
- action,
290
- variantsById
291
- }) => {
292
- const { t } = useTranslation();
293
- const details = action.details ?? {};
294
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
295
- if (!details.attribute_id) return null;
296
- return /* @__PURE__ */ jsx(
297
- AttributeActionLine,
298
- {
299
- attributeId: details.attribute_id,
300
- valueIds: action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD ? details.attribute_value_ids : void 0
301
- }
302
- );
303
- }
304
- const variantFallback = t("fields.variant", { defaultValue: "Variant" });
305
- if (action.action === import_types.ProductChangeActionType.VARIANT_ADD) {
306
- const title = details.variant?.title || details.variant?.sku || variantFallback;
307
- return /* @__PURE__ */ jsx(VariantActionLine, { title });
308
- }
309
- if (action.action === import_types.ProductChangeActionType.VARIANT_REMOVE) {
310
- const variantId = details.variant_id ?? "";
311
- const found = variantId ? variantsById.get(variantId) : void 0;
312
- const title = found?.title || found?.sku || variantId || variantFallback;
313
- const images = isImageList(found?.images) ? found?.images : void 0;
314
- return /* @__PURE__ */ jsx(VariantActionLine, { title, images });
315
- }
316
- const label = describeProductChangeAction(action, {
317
- variant: variantFallback
318
- });
319
- return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
320
- };
321
- var VariantUpdateBlock = ({
322
- variantId,
323
- diffs,
324
- variantsById
325
- }) => {
326
- const { t } = useTranslation();
327
- const found = variantsById.get(variantId);
328
- const title = found?.title || found?.sku || variantId || t("fields.variant", { defaultValue: "Variant" });
329
- const images = isImageList(found?.images) ? found?.images : void 0;
330
- return /* @__PURE__ */ jsxs(
331
- "div",
332
- {
333
- className: "flex flex-col gap-y-3",
334
- "data-testid": `product-active-edit-variant-${variantId}`,
335
- children: [
336
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
337
- images && images.length > 0 && /* @__PURE__ */ jsx(ImageStrip, { images }),
338
- /* @__PURE__ */ jsxs(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: [
339
- /* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: t("products.edits.panel.variantUpdated", {
340
- defaultValue: "Variant updated"
341
- }) }),
342
- ": ",
343
- title
344
- ] })
345
- ] }),
346
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-4 pl-1", children: diffs.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${variantId}-${diff.field}-${idx}`)) })
347
- ]
348
- }
349
- );
350
- };
351
- var ProductActiveEditSection = ({
352
- product
353
- }) => {
354
- const { t } = useTranslation();
355
- const prompt = usePrompt();
356
- const productId = product.id;
357
- const variantsById = useMemo(() => {
358
- const map = /* @__PURE__ */ new Map();
359
- for (const variant of product.variants ?? []) {
360
- if (variant?.id) map.set(variant.id, variant);
361
- }
362
- return map;
363
- }, [product.variants]);
364
- const { product_change, isError } = useProductChange(productId, {
365
- retry: false
366
- });
367
- const { mutateAsync: cancelEdit, isPending: isCanceling } = useCancelProductEdit(productId);
368
- const { updated, added, removed, deleteRequested } = useMemo(
369
- () => partitionProductChangeActions(product_change?.actions ?? []),
370
- [product_change]
371
- );
372
- const productUpdated = useMemo(
373
- () => updated.filter((d) => !d.variant_id),
374
- [updated]
375
- );
376
- const variantsUpdated = useMemo(() => {
377
- const groups = /* @__PURE__ */ new Map();
378
- for (const diff of updated) {
379
- if (!diff.variant_id) continue;
380
- const bucket = groups.get(diff.variant_id) ?? [];
381
- bucket.push(diff);
382
- groups.set(diff.variant_id, bucket);
383
- }
384
- return groups;
385
- }, [updated]);
386
- const attributeIds = useMemo(() => {
387
- const ids = /* @__PURE__ */ new Set();
388
- for (const action of [...added, ...removed]) {
389
- if (action.action === import_types.ProductChangeActionType.ATTRIBUTE_ADD || action.action === import_types.ProductChangeActionType.ATTRIBUTE_REMOVE) {
390
- const details = action.details ?? {};
391
- if (details.attribute_id) ids.add(details.attribute_id);
392
- }
393
- }
394
- return Array.from(ids);
395
- }, [added, removed]);
396
- const attributeQueries = useQueries({
397
- queries: attributeIds.map((id) => ({
398
- queryKey: productAttributesQueryKeys.detail(id),
399
- queryFn: () => sdk.vendor.productAttributes.$id.query({ $id: id })
400
- }))
401
- });
402
- const isLoadingAttributes = attributeQueries.some((q) => q.isPending);
403
- const onCancel = async () => {
404
- const confirmed = await prompt({
405
- title: t("products.edits.panel.cancelTitle"),
406
- description: t("products.edits.panel.cancelDescription"),
407
- confirmText: t("actions.confirm"),
408
- cancelText: t("actions.cancel")
409
- });
410
- if (!confirmed) return;
411
- try {
412
- await cancelEdit();
413
- toast.success(t("products.edits.toast.canceledSuccessfully"));
414
- } catch (e) {
415
- toast.error(e.message);
416
- }
417
- };
418
- if (isError || !product_change) {
419
- return null;
420
- }
421
- if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
422
- return null;
423
- }
424
- if (isLoadingAttributes) {
425
- return null;
426
- }
427
- const hasContent = productUpdated.length > 0 || variantsUpdated.size > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
428
- return /* @__PURE__ */ jsxs(
429
- Container,
430
- {
431
- className: "divide-y p-0",
432
- "data-testid": "product-active-edit-section",
433
- children: [
434
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-6 py-4", children: [
435
- /* @__PURE__ */ jsx(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
436
- /* @__PURE__ */ jsx(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
437
- ] }),
438
- hasContent && /* @__PURE__ */ jsxs(Fragment2, { children: [
439
- productUpdated.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
440
- /* @__PURE__ */ jsx(
441
- Text,
442
- {
443
- size: "small",
444
- weight: "plus",
445
- leading: "compact",
446
- className: "text-ui-fg-subtle w-[160px] shrink-0",
447
- children: t("labels.updated")
448
- }
449
- ),
450
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-4", children: productUpdated.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${diff.field}-${idx}`)) })
451
- ] }),
452
- variantsUpdated.size > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
453
- /* @__PURE__ */ jsx(
454
- Text,
455
- {
456
- size: "small",
457
- weight: "plus",
458
- leading: "compact",
459
- className: "text-ui-fg-subtle w-[160px] shrink-0",
460
- children: t("labels.updated")
461
- }
462
- ),
463
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-6", children: Array.from(variantsUpdated.entries()).map(
464
- ([variantId, diffs]) => /* @__PURE__ */ jsx(
465
- VariantUpdateBlock,
466
- {
467
- variantId,
468
- diffs,
469
- variantsById
470
- },
471
- variantId
472
- )
473
- ) })
474
- ] }),
475
- added.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
476
- /* @__PURE__ */ jsx(
477
- Text,
478
- {
479
- size: "small",
480
- weight: "plus",
481
- leading: "compact",
482
- className: "text-ui-fg-subtle w-[160px] shrink-0",
483
- children: t("labels.added")
484
- }
485
- ),
486
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx(
487
- ActionLine,
488
- {
489
- action,
490
- variantsById
491
- },
492
- action.id
493
- )) })
494
- ] }),
495
- removed.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
496
- /* @__PURE__ */ jsx(
497
- Text,
498
- {
499
- size: "small",
500
- weight: "plus",
501
- leading: "compact",
502
- className: "text-ui-fg-subtle w-[160px] shrink-0",
503
- children: t("labels.removed")
504
- }
505
- ),
506
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx(
507
- ActionLine,
508
- {
509
- action,
510
- variantsById
511
- },
512
- action.id
513
- )) })
514
- ] }),
515
- deleteRequested && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
516
- /* @__PURE__ */ jsx(
517
- Text,
518
- {
519
- size: "small",
520
- weight: "plus",
521
- leading: "compact",
522
- className: "text-ui-fg-subtle w-[160px] shrink-0",
523
- children: t("labels.removed")
524
- }
525
- ),
526
- /* @__PURE__ */ jsx(
527
- Text,
528
- {
529
- size: "small",
530
- leading: "compact",
531
- className: "text-ui-fg-subtle flex-1",
532
- children: t("products.edits.panel.deleteRequested")
533
- }
534
- )
535
- ] })
536
- ] }),
537
- /* @__PURE__ */ jsx(
538
- "div",
539
- {
540
- className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
541
- "data-testid": "product-active-edit-actions",
542
- children: /* @__PURE__ */ jsx(
543
- Button,
544
- {
545
- size: "small",
546
- variant: "secondary",
547
- onClick: onCancel,
548
- disabled: isCanceling,
549
- isLoading: isCanceling,
550
- "data-testid": "product-active-edit-cancel-button",
551
- children: t("actions.cancel")
552
- }
553
- )
554
- }
555
- )
556
- ]
557
- }
558
- );
559
- };
560
-
561
- // src/pages/products/[id]/_components/product-general-section/product-general-section.tsx
562
- import { PencilSquare, Trash } from "@medusajs/icons";
563
- import { Container as Container2, Heading as Heading2, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
564
- import { useTranslation as useTranslation2 } from "react-i18next";
565
- import { useNavigate } from "react-router-dom";
566
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
567
- var productStatusColor = (status) => {
568
- switch (status) {
569
- case "draft":
570
- return "grey";
571
- case "proposed":
572
- return "orange";
573
- case "published":
574
- return "green";
575
- case "rejected":
576
- return "red";
577
- default:
578
- return "grey";
579
- }
580
- };
581
- var ProductGeneralSection = ({
582
- product
583
- }) => {
584
- const { t } = useTranslation2();
585
- const prompt = usePrompt2();
586
- const navigate = useNavigate();
587
- const { mutateAsync } = useDeleteProduct(product.id);
588
- const handleDelete = async () => {
589
- const res = await prompt({
590
- title: t("general.areYouSure"),
591
- description: t("products.deleteWarning", {
592
- title: product.title
593
- }),
594
- confirmText: t("actions.delete"),
595
- cancelText: t("actions.cancel")
596
- });
597
- if (!res) {
598
- return;
599
- }
600
- await mutateAsync(void 0, {
601
- onSuccess: () => {
602
- navigate("..");
603
- }
604
- });
605
- };
606
- return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", children: [
607
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
608
- /* @__PURE__ */ jsx2(Heading2, { children: product.title }),
609
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-4", children: [
610
- /* @__PURE__ */ jsx2(StatusBadge, { color: productStatusColor(product.status), children: t(`products.productStatus.${product.status}`) }),
611
- /* @__PURE__ */ jsx2(
612
- ActionMenu,
613
- {
614
- groups: [
615
- {
616
- actions: [
617
- {
618
- label: t("actions.edit"),
619
- to: "edit",
620
- icon: /* @__PURE__ */ jsx2(PencilSquare, {})
621
- }
622
- ]
623
- },
624
- {
625
- actions: [
626
- {
627
- label: t("actions.delete"),
628
- onClick: handleDelete,
629
- icon: /* @__PURE__ */ jsx2(Trash, {})
630
- }
631
- ]
632
- }
633
- ]
634
- }
635
- )
636
- ] })
637
- ] }),
638
- /* @__PURE__ */ jsx2(
639
- SectionRow,
640
- {
641
- title: t("fields.description"),
642
- value: product.description || "-"
643
- }
644
- ),
645
- /* @__PURE__ */ jsx2(
646
- SectionRow,
647
- {
648
- title: t("fields.subtitle"),
649
- value: product.subtitle || "-"
650
- }
651
- ),
652
- /* @__PURE__ */ jsx2(SectionRow, { title: t("fields.handle"), value: `/${product.handle}` }),
653
- /* @__PURE__ */ jsx2(
654
- SectionRow,
655
- {
656
- title: t("fields.discountable"),
657
- value: product.discountable ? t("general.true") : t("general.false")
658
- }
659
- )
660
- ] });
661
- };
662
-
663
- // src/pages/products/[id]/_components/product-media-section/product-media-section.tsx
664
- import { useState } from "react";
665
- import { PencilSquare as PencilSquare2, ThumbnailBadge } from "@medusajs/icons";
666
- import {
667
- Button as Button2,
668
- Checkbox,
669
- clx,
670
- CommandBar,
671
- Container as Container3,
672
- Heading as Heading3,
673
- Text as Text2,
674
- Tooltip,
675
- usePrompt as usePrompt3
676
- } from "@medusajs/ui";
677
- import { useTranslation as useTranslation3 } from "react-i18next";
678
- import { Link } from "react-router-dom";
679
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
680
- var ProductMediaSection = ({
681
- product
682
- }) => {
683
- const { t } = useTranslation3();
684
- const prompt = usePrompt3();
685
- const [selection, setSelection] = useState({});
686
- const media = getMedia(product);
687
- const handleCheckedChange = (id) => {
688
- setSelection((prev) => {
689
- if (prev[id]) {
690
- const { [id]: _, ...rest } = prev;
691
- return rest;
692
- } else {
693
- return { ...prev, [id]: true };
694
- }
695
- });
696
- };
697
- const { mutateAsync } = useUpdateProduct(product.id);
698
- const handleDelete = async () => {
699
- const ids = Object.keys(selection);
700
- const includingThumbnail = ids.some((id) => media.find((m) => m.id === id)?.isThumbnail);
701
- const res = await prompt({
702
- title: t("general.areYouSure"),
703
- description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
704
- count: ids.length
705
- }) : t("products.media.deleteWarning", {
706
- count: ids.length
707
- }),
708
- confirmText: t("actions.delete"),
709
- cancelText: t("actions.cancel")
710
- });
711
- if (!res) {
712
- return;
713
- }
714
- const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
715
- await mutateAsync(
716
- {
717
- images: mediaToKeep,
718
- thumbnail: includingThumbnail ? "" : void 0
719
- },
720
- {
721
- onSuccess: () => {
722
- setSelection({});
723
- }
724
- }
725
- );
726
- };
727
- return /* @__PURE__ */ jsxs3(Container3, { className: "divide-y p-0", children: [
728
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-6 py-4", children: [
729
- /* @__PURE__ */ jsx3(Heading3, { level: "h2", children: t("products.media.label") }),
730
- /* @__PURE__ */ jsx3(
731
- ActionMenu,
732
- {
733
- groups: [
734
- {
735
- actions: [
736
- {
737
- label: t("actions.edit"),
738
- to: "media?view=edit",
739
- icon: /* @__PURE__ */ jsx3(PencilSquare2, {})
740
- }
741
- ]
742
- }
743
- ]
744
- }
745
- )
746
- ] }),
747
- media.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4 px-6 py-4", children: media.map((i, index) => {
748
- const isSelected = selection[i.id];
749
- return /* @__PURE__ */ jsxs3(
750
- "div",
751
- {
752
- className: "group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px] shadow-elevation-card-rest transition-fg hover:shadow-elevation-card-hover",
753
- children: [
754
- /* @__PURE__ */ jsx3(
755
- "div",
756
- {
757
- className: clx(
758
- "invisible absolute right-2 top-2 opacity-0 transition-fg group-hover:visible group-hover:opacity-100",
759
- {
760
- "visible opacity-100": isSelected
761
- }
762
- ),
763
- children: /* @__PURE__ */ jsx3(
764
- Checkbox,
765
- {
766
- checked: selection[i.id] || false,
767
- onCheckedChange: () => handleCheckedChange(i.id)
768
- }
769
- )
770
- }
771
- ),
772
- i.isThumbnail && /* @__PURE__ */ jsx3("div", { className: "absolute left-2 top-2", children: /* @__PURE__ */ jsx3(Tooltip, { content: t("fields.thumbnail"), children: /* @__PURE__ */ jsx3(ThumbnailBadge, {}) }) }),
773
- /* @__PURE__ */ jsx3(
774
- Link,
775
- {
776
- to: `media`,
777
- state: { curr: index },
778
- children: /* @__PURE__ */ jsx3(
779
- "img",
780
- {
781
- src: i.url,
782
- alt: product.title,
783
- className: "size-full object-cover"
784
- }
785
- )
786
- }
787
- )
788
- ]
789
- },
790
- i.id
791
- );
792
- }) }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", children: [
793
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center", children: [
794
- /* @__PURE__ */ jsx3(
795
- Text2,
796
- {
797
- size: "small",
798
- leading: "compact",
799
- weight: "plus",
800
- className: "text-ui-fg-subtle",
801
- children: t("products.media.emptyState.header")
802
- }
803
- ),
804
- /* @__PURE__ */ jsx3(
805
- Text2,
806
- {
807
- size: "small",
808
- className: "text-ui-fg-muted",
809
- children: t("products.media.emptyState.description")
810
- }
811
- )
812
- ] }),
813
- /* @__PURE__ */ jsx3(
814
- Button2,
815
- {
816
- size: "small",
817
- variant: "secondary",
818
- asChild: true,
819
- children: /* @__PURE__ */ jsx3(Link, { to: "media?view=edit", children: t("products.media.emptyState.action") })
820
- }
821
- )
822
- ] }),
823
- /* @__PURE__ */ jsx3(CommandBar, { open: !!Object.keys(selection).length, children: /* @__PURE__ */ jsxs3(CommandBar.Bar, { children: [
824
- /* @__PURE__ */ jsx3(CommandBar.Value, { children: t("general.countSelected", {
825
- count: Object.keys(selection).length
826
- }) }),
827
- /* @__PURE__ */ jsx3(CommandBar.Seperator, {}),
828
- /* @__PURE__ */ jsx3(
829
- CommandBar.Command,
830
- {
831
- action: handleDelete,
832
- label: t("actions.delete"),
833
- shortcut: "d"
834
- }
835
- )
836
- ] }) })
837
- ] });
838
- };
839
- var getMedia = (product) => {
840
- const { images = [], thumbnail } = product;
841
- const media = (images || []).map((image) => ({
842
- id: image.id,
843
- url: image.url,
844
- isThumbnail: image.url === thumbnail
845
- }));
846
- if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
847
- media.unshift({
848
- id: "img_thumbnail",
849
- url: thumbnail,
850
- isThumbnail: true
851
- });
852
- }
853
- return media;
854
- };
855
-
856
- // src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx
857
- import { PencilSquare as PencilSquare3 } from "@medusajs/icons";
858
- import { Badge, Container as Container4, Heading as Heading4, Tooltip as Tooltip2 } from "@medusajs/ui";
859
- import { useTranslation as useTranslation4 } from "react-i18next";
860
- import { Link as Link2 } from "react-router-dom";
861
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
862
- var ProductOrganizationSection = ({
863
- product
864
- }) => {
865
- const { t } = useTranslation4();
866
- return /* @__PURE__ */ jsxs4(
867
- Container4,
868
- {
869
- className: "divide-y p-0",
870
- "data-testid": "product-organization-section",
871
- children: [
872
- /* @__PURE__ */ jsxs4(
873
- "div",
874
- {
875
- className: "flex items-center justify-between px-6 py-4",
876
- "data-testid": "product-organization-header",
877
- children: [
878
- /* @__PURE__ */ jsx4(Heading4, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
879
- /* @__PURE__ */ jsx4(
880
- ActionMenu,
881
- {
882
- groups: [
883
- {
884
- actions: [
885
- {
886
- label: t("actions.edit"),
887
- to: "organization",
888
- icon: /* @__PURE__ */ jsx4(PencilSquare3, {})
889
- }
890
- ]
891
- }
892
- ],
893
- "data-testid": "product-organization-action-menu"
894
- }
895
- )
896
- ]
897
- }
898
- ),
899
- /* @__PURE__ */ jsx4(
900
- SectionRow,
901
- {
902
- title: t("fields.category"),
903
- value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx4(
904
- OrganizationTag,
905
- {
906
- label: pcat.name,
907
- to: `/categories/${pcat.id}`
908
- },
909
- pcat.id
910
- )) : void 0,
911
- "data-testid": "product-categories-row"
912
- }
913
- ),
914
- /* @__PURE__ */ jsx4(
915
- SectionRow,
916
- {
917
- title: t("fields.collection"),
918
- value: product.collection ? /* @__PURE__ */ jsx4(
919
- OrganizationTag,
920
- {
921
- label: product.collection.title,
922
- to: `/collections/${product.collection.id}`
923
- }
924
- ) : void 0,
925
- "data-testid": "product-collection-row"
926
- }
927
- ),
928
- /* @__PURE__ */ jsx4(
929
- SectionRow,
930
- {
931
- title: t("fields.tags"),
932
- value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx4(
933
- OrganizationTag,
934
- {
935
- label: tag.value,
936
- to: `/settings/product-tags/${tag.id}`
937
- },
938
- tag.id
939
- )) : void 0,
940
- "data-testid": "product-tags-row"
941
- }
942
- ),
943
- /* @__PURE__ */ jsx4(
944
- SectionRow,
945
- {
946
- title: t("fields.type"),
947
- value: product.type ? /* @__PURE__ */ jsx4(
948
- OrganizationTag,
949
- {
950
- label: product.type.value,
951
- to: `/settings/product-types/${product.type_id}`
952
- }
953
- ) : void 0,
954
- "data-testid": "product-type-row"
955
- }
956
- )
957
- ]
958
- }
959
- );
960
- };
961
- var OrganizationTag = ({ label, to }) => {
962
- return /* @__PURE__ */ jsx4(Tooltip2, { content: label, children: /* @__PURE__ */ jsx4(Badge, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx4(
963
- Link2,
964
- {
965
- to,
966
- "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
967
- children: label
968
- }
969
- ) }) });
970
- };
971
-
972
- // src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx
973
- import { useCallback, useMemo as useMemo2 } from "react";
974
- import { PencilSquare as PencilSquare4, Trash as Trash2 } from "@medusajs/icons";
975
- import {
976
- Badge as Badge2,
977
- Button as Button3,
978
- Container as Container5,
979
- createDataTableColumnHelper,
980
- Heading as Heading5,
981
- toast as toast2,
982
- Tooltip as Tooltip3,
983
- usePrompt as usePrompt4
984
- } from "@medusajs/ui";
985
- import { keepPreviousData } from "@tanstack/react-query";
986
- import { useTranslation as useTranslation5 } from "react-i18next";
987
- import { Link as Link3, useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
988
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
989
- var PAGE_SIZE = 10;
990
- var PREFIX = "pv";
991
- var ProductVariantSection = ({
992
- product
993
- }) => {
994
- const { t } = useTranslation5();
995
- const { q, order, offset, created_at, updated_at } = useQueryParams(
996
- ["q", "order", "offset", "created_at", "updated_at"],
997
- PREFIX
998
- );
999
- const columns = useColumns(product);
1000
- const filters = useFilters();
1001
- const { variants, count, isPending, isError, error } = useProductVariants(
1002
- product.id,
1003
- {
1004
- q,
1005
- order: order ? order : "variant_rank",
1006
- offset: offset ? parseInt(offset) : void 0,
1007
- limit: PAGE_SIZE,
1008
- created_at: created_at ? JSON.parse(created_at) : void 0,
1009
- updated_at: updated_at ? JSON.parse(updated_at) : void 0,
1010
- fields: "title,sku,created_at,updated_at,*options,*options.option"
1011
- },
1012
- {
1013
- placeholderData: keepPreviousData
1014
- }
1015
- );
1016
- if (isError) {
1017
- throw error;
1018
- }
1019
- return /* @__PURE__ */ jsxs5(Container5, { className: "divide-y p-0", "data-testid": "product-variant-section", children: [
1020
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-6 py-4", children: [
1021
- /* @__PURE__ */ jsx5(Heading5, { level: "h2", children: t("products.variants.header") }),
1022
- /* @__PURE__ */ jsx5(
1023
- Button3,
1024
- {
1025
- size: "small",
1026
- variant: "secondary",
1027
- asChild: true,
1028
- "data-testid": "product-variants-create-button",
1029
- children: /* @__PURE__ */ jsx5(Link3, { to: "variants/create", children: t("actions.create") })
1030
- }
1031
- )
1032
- ] }),
1033
- /* @__PURE__ */ jsx5("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx5(
1034
- DataTable,
1035
- {
1036
- data: variants,
1037
- columns,
1038
- filters,
1039
- rowCount: count,
1040
- getRowId: (row) => row.id,
1041
- rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
1042
- pageSize: PAGE_SIZE,
1043
- isLoading: isPending,
1044
- compact: true,
1045
- emptyState: {
1046
- empty: {
1047
- heading: t("products.variants.empty.heading"),
1048
- description: t("products.variants.empty.description")
1049
- },
1050
- filtered: {
1051
- heading: t("products.variants.filtered.heading"),
1052
- description: t("products.variants.filtered.description")
1053
- }
1054
- },
1055
- prefix: PREFIX
1056
- }
1057
- ) })
1058
- ] });
1059
- };
1060
- var columnHelper = createDataTableColumnHelper();
1061
- var useColumns = (product) => {
1062
- const { t } = useTranslation5();
1063
- const navigate = useNavigate2();
1064
- const { mutateAsync } = useDeleteVariantLazy(product.id);
1065
- const prompt = usePrompt4();
1066
- const [searchParams] = useSearchParams();
1067
- const tableSearchParams = useMemo2(() => {
1068
- const filtered = new URLSearchParams();
1069
- for (const [key, value] of searchParams.entries()) {
1070
- if (key.startsWith(`${PREFIX}_`)) {
1071
- filtered.append(key, value);
1072
- }
1073
- }
1074
- return filtered;
1075
- }, [searchParams]);
1076
- const dateColumns = useDataTableDateColumns();
1077
- const handleDelete = useCallback(
1078
- async (id, title) => {
1079
- const res = await prompt({
1080
- title: t("general.areYouSure"),
1081
- description: t("products.deleteVariantWarning", {
1082
- title
1083
- }),
1084
- confirmText: t("actions.delete"),
1085
- cancelText: t("actions.cancel")
1086
- });
1087
- if (!res) {
1088
- return;
1089
- }
1090
- await mutateAsync(
1091
- { variantId: id },
1092
- {
1093
- onError: (error) => {
1094
- toast2.error(error.message);
1095
- }
1096
- }
1097
- );
1098
- },
1099
- [mutateAsync, prompt, t]
1100
- );
1101
- const attributeColumns = useMemo2(() => {
1102
- const variantAttributes = product?.attributes?.filter((attr) => attr.is_variant_axis);
1103
- if (!variantAttributes?.length) {
1104
- return [];
1105
- }
1106
- return variantAttributes.map((attribute) => {
1107
- return columnHelper.display({
1108
- id: `attribute-${attribute.id}`,
1109
- header: attribute.name,
1110
- cell: ({ row }) => {
1111
- const variantOpt = row.original.options?.find(
1112
- (opt) => opt.option?.title === attribute.name
1113
- );
1114
- if (!variantOpt?.value) {
1115
- return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
1116
- }
1117
- return /* @__PURE__ */ jsx5(
1118
- "div",
1119
- {
1120
- className: "flex flex-wrap items-center gap-1",
1121
- "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1122
- children: /* @__PURE__ */ jsx5(Tooltip3, { content: variantOpt.value, children: /* @__PURE__ */ jsx5(
1123
- Badge2,
1124
- {
1125
- size: "2xsmall",
1126
- title: variantOpt.value,
1127
- className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1128
- "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${variantOpt.value}`,
1129
- children: variantOpt.value
1130
- }
1131
- ) })
1132
- }
1133
- );
1134
- }
1135
- });
1136
- });
1137
- }, [product]);
1138
- const getActions = useCallback(
1139
- (_ctx) => {
1140
- const variant = _ctx.row.original;
1141
- const mainActions = [
1142
- {
1143
- icon: /* @__PURE__ */ jsx5(PencilSquare4, {}),
1144
- label: t("actions.edit"),
1145
- onClick: (row) => {
1146
- navigate(
1147
- `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1148
- {
1149
- state: {
1150
- restore_params: tableSearchParams.toString()
1151
- }
1152
- }
1153
- );
1154
- }
1155
- }
1156
- ];
1157
- const secondaryActions = [
1158
- {
1159
- icon: /* @__PURE__ */ jsx5(Trash2, {}),
1160
- label: t("actions.delete"),
1161
- onClick: () => handleDelete(variant.id, variant.title)
1162
- }
1163
- ];
1164
- return [mainActions, secondaryActions];
1165
- },
1166
- [handleDelete, navigate, t, tableSearchParams]
1167
- );
1168
- return useMemo2(() => {
1169
- return [
1170
- columnHelper.accessor("title", {
1171
- header: t("fields.title"),
1172
- enableSorting: true,
1173
- sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1174
- sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1175
- }),
1176
- columnHelper.accessor("sku", {
1177
- header: t("fields.sku"),
1178
- cell: ({ getValue }) => {
1179
- const value = getValue();
1180
- return value ? value : /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
1181
- }
1182
- }),
1183
- ...attributeColumns,
1184
- ...dateColumns,
1185
- columnHelper.action({
1186
- actions: getActions
1187
- })
1188
- ];
1189
- }, [t, attributeColumns, dateColumns, getActions]);
1190
- };
1191
- var useFilters = () => {
1192
- const dateFilters = useDataTableDateFilters();
1193
- return useMemo2(() => {
1194
- return [...dateFilters];
1195
- }, [dateFilters]);
1196
- };
1197
-
1198
- // src/pages/products/[id]/_components/product-attribute-section/product-attribute-section.tsx
1199
- import {
1200
- ListBullet,
1201
- Plus,
1202
- Trash as Trash3,
1203
- Swatch,
1204
- DropCap,
1205
- InformationCircleSolid,
1206
- PencilSquare as PencilSquare5
1207
- } from "@medusajs/icons";
1208
- import {
1209
- Badge as Badge3,
1210
- Container as Container6,
1211
- Heading as Heading6,
1212
- Text as Text3,
1213
- toast as toast3,
1214
- Tooltip as Tooltip4,
1215
- usePrompt as usePrompt5
1216
- } from "@medusajs/ui";
1217
- import { useTranslation as useTranslation6 } from "react-i18next";
1218
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1219
- var AttributeActions = ({
1220
- productId,
1221
- attribute
1222
- }) => {
1223
- const { t } = useTranslation6();
1224
- const prompt = usePrompt5();
1225
- const { mutateAsync } = useRemoveProductAttribute(productId, attribute.id);
1226
- const handleDelete = async () => {
1227
- const res = await prompt({
1228
- title: t("general.areYouSure"),
1229
- description: t("products.deleteAttributeWarning", {
1230
- title: attribute.name
1231
- }),
1232
- confirmText: t("actions.delete"),
1233
- cancelText: t("actions.cancel")
1234
- });
1235
- if (!res) {
1236
- return;
1237
- }
1238
- await mutateAsync(void 0, {
1239
- onError: (error) => {
1240
- toast3.error(error.message);
1241
- }
1242
- });
1243
- };
1244
- return /* @__PURE__ */ jsx6(
1245
- ActionMenu,
1246
- {
1247
- groups: [
1248
- {
1249
- actions: [
1250
- {
1251
- label: t("actions.edit"),
1252
- to: `attributes/${attribute.id}/edit`,
1253
- icon: /* @__PURE__ */ jsx6(PencilSquare5, {})
1254
- }
1255
- ]
1256
- },
1257
- {
1258
- actions: [
1259
- {
1260
- label: t("actions.delete"),
1261
- onClick: handleDelete,
1262
- icon: /* @__PURE__ */ jsx6(Trash3, {}),
1263
- disabled: attribute.is_required,
1264
- disabledTooltip: attribute.is_required ? t("products.attributeRequiredDeleteDisabledTooltip") : void 0
1265
- }
1266
- ]
1267
- }
1268
- ]
1269
- }
1270
- );
1271
- };
1272
- var AttributeGroup = ({
1273
- icon,
1274
- title,
1275
- description,
1276
- attributes,
1277
- productId
1278
- }) => {
1279
- const { t } = useTranslation6();
1280
- if (!attributes.length) {
1281
- return null;
1282
- }
1283
- return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
1284
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-x-3 px-3", children: [
1285
- /* @__PURE__ */ jsx6("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 }),
1286
- /* @__PURE__ */ jsxs6("div", { children: [
1287
- /* @__PURE__ */ jsx6(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
1288
- /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
1289
- ] })
1290
- ] }),
1291
- /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-y-0", children: /* @__PURE__ */ jsx6("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: attributes.map((attr, index) => {
1292
- const values = attr.values?.map((v) => v.name) ?? [];
1293
- return /* @__PURE__ */ jsx6(
1294
- "div",
1295
- {
1296
- className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
1297
- children: /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 bg-ui-bg-component px-4 py-3", children: [
1298
- /* @__PURE__ */ jsxs6("div", { className: "text-ui-fg-subtle flex items-center gap-x-2", children: [
1299
- /* @__PURE__ */ jsx6(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
1300
- attr.description && /* @__PURE__ */ jsx6(Tooltip4, { content: attr.description, children: /* @__PURE__ */ jsx6("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx6(InformationCircleSolid, {}) }) }),
1301
- attr.is_required && /* @__PURE__ */ jsx6(
1302
- Tooltip4,
1303
- {
1304
- content: t("products.attributeRequiredByMarketplace"),
1305
- children: /* @__PURE__ */ jsx6("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx6(InformationCircleSolid, {}) })
1306
- }
1307
- )
1308
- ] }),
1309
- /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx6(
1310
- Badge3,
1311
- {
1312
- size: "2xsmall",
1313
- className: "flex min-w-[20px] items-center justify-center",
1314
- children: val
1315
- },
1316
- val
1317
- )) : /* @__PURE__ */ jsx6(
1318
- Text3,
1319
- {
1320
- size: "small",
1321
- leading: "compact",
1322
- className: "text-ui-fg-subtle",
1323
- children: values.join(", ") || "-"
1324
- }
1325
- ) }),
1326
- /* @__PURE__ */ jsx6(AttributeActions, { productId, attribute: attr })
1327
- ] })
1328
- },
1329
- attr.id
1330
- );
1331
- }) }) })
1332
- ] });
1333
- };
1334
- var ProductAttributeSection = ({
1335
- product
1336
- }) => {
1337
- const { t } = useTranslation6();
1338
- const allAttributes = product.attributes ?? [];
1339
- const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
1340
- const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
1341
- const isEmpty = !variantAttributes.length && !infoAttributes.length;
1342
- return /* @__PURE__ */ jsxs6(Container6, { className: "p-0", children: [
1343
- /* @__PURE__ */ jsxs6(
1344
- "div",
1345
- {
1346
- className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
1347
- children: [
1348
- /* @__PURE__ */ jsx6(Heading6, { level: "h2", children: t("products.attributes") }),
1349
- /* @__PURE__ */ jsx6(
1350
- ActionMenu,
1351
- {
1352
- groups: [
1353
- {
1354
- actions: [
1355
- {
1356
- label: t("products.create.attributes.addExisting"),
1357
- to: "attributes/add",
1358
- icon: /* @__PURE__ */ jsx6(ListBullet, {})
1359
- },
1360
- {
1361
- label: t("products.create.attributes.createNew"),
1362
- to: "attributes/create",
1363
- icon: /* @__PURE__ */ jsx6(Plus, {})
1364
- }
1365
- ]
1366
- }
1367
- ]
1368
- }
1369
- )
1370
- ]
1371
- }
1372
- ),
1373
- variantAttributes.length > 0 && /* @__PURE__ */ jsx6(
1374
- AttributeGroup,
1375
- {
1376
- icon: /* @__PURE__ */ jsx6(Swatch, {}),
1377
- title: t("products.create.tabs.variants"),
1378
- description: t("products.attributeVariantsDescription"),
1379
- attributes: variantAttributes,
1380
- productId: product.id
1381
- }
1382
- ),
1383
- variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx6("div", { className: "border-t border-dashed border-ui-border-base" }),
1384
- infoAttributes.length > 0 && /* @__PURE__ */ jsx6(
1385
- AttributeGroup,
1386
- {
1387
- icon: /* @__PURE__ */ jsx6(DropCap, {}),
1388
- title: t("products.attributeProductInformation"),
1389
- description: t("products.attributeProductInformationDescription"),
1390
- attributes: infoAttributes,
1391
- productId: product.id
1392
- }
1393
- )
1394
- ] });
1395
- };
1396
-
1397
- // src/pages/products/[id]/_components/product-shipping-profile-section/product-shipping-profile-section.tsx
1398
- import { PencilSquare as PencilSquare6, ShoppingBag } from "@medusajs/icons";
1399
- import { Container as Container7, Heading as Heading7 } from "@medusajs/ui";
1400
- import { useTranslation as useTranslation7 } from "react-i18next";
1401
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1402
- var ProductShippingProfileSection = ({
1403
- product
1404
- }) => {
1405
- const { t } = useTranslation7();
1406
- const shippingProfile = product.shipping_profile;
1407
- return /* @__PURE__ */ jsxs7(Container7, { className: "p-0", children: [
1408
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between px-6 py-4", children: [
1409
- /* @__PURE__ */ jsx7(Heading7, { level: "h2", children: t("products.shippingProfile.header") }),
1410
- /* @__PURE__ */ jsx7(
1411
- ActionMenu,
1412
- {
1413
- groups: [
1414
- {
1415
- actions: [
1416
- {
1417
- label: t("actions.edit"),
1418
- to: "shipping-profile",
1419
- icon: /* @__PURE__ */ jsx7(PencilSquare6, {})
1420
- }
1421
- ]
1422
- }
1423
- ]
1424
- }
1425
- )
1426
- ] }),
1427
- shippingProfile && /* @__PURE__ */ jsx7(
1428
- SidebarLink,
1429
- {
1430
- to: `/settings/locations/shipping-profiles/${shippingProfile.id}`,
1431
- labelKey: shippingProfile.name,
1432
- descriptionKey: shippingProfile.type,
1433
- icon: /* @__PURE__ */ jsx7(ShoppingBag, {})
1434
- }
1435
- )
1436
- ] });
1437
- };
1438
-
1439
- // src/pages/products/[id]/_components/product-sales-channel-section/product-sales-channel-section.tsx
1440
- import { Channels, PencilSquare as PencilSquare7 } from "@medusajs/icons";
1441
- import { Container as Container8, Heading as Heading8, Text as Text4, Tooltip as Tooltip5 } from "@medusajs/ui";
1442
- import { Trans, useTranslation as useTranslation8 } from "react-i18next";
1443
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1444
- var ProductSalesChannelSection = ({
1445
- product
1446
- }) => {
1447
- const { count } = useSalesChannels();
1448
- const { t } = useTranslation8();
1449
- const availableInSalesChannels = product.sales_channels?.map((sc) => ({
1450
- id: sc.id,
1451
- name: sc.name
1452
- })) ?? [];
1453
- const firstChannels = availableInSalesChannels.slice(0, 3);
1454
- const restChannels = availableInSalesChannels.slice(3);
1455
- return /* @__PURE__ */ jsxs8(Container8, { className: "flex flex-col gap-y-4 px-6 py-4", children: [
1456
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
1457
- /* @__PURE__ */ jsx8(Heading8, { level: "h2", children: t("fields.sales_channels") }),
1458
- /* @__PURE__ */ jsx8(
1459
- ActionMenu,
1460
- {
1461
- groups: [
1462
- {
1463
- actions: [
1464
- {
1465
- label: t("actions.edit"),
1466
- to: "sales-channels",
1467
- icon: /* @__PURE__ */ jsx8(PencilSquare7, {})
1468
- }
1469
- ]
1470
- }
1471
- ]
1472
- }
1473
- )
1474
- ] }),
1475
- /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-[28px_1fr] items-center gap-x-3", children: [
1476
- /* @__PURE__ */ jsx8("div", { className: "bg-ui-bg-base shadow-borders-base flex size-7 items-center justify-center rounded-md", children: /* @__PURE__ */ jsx8("div", { className: "bg-ui-bg-component flex size-6 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx8(Channels, { className: "text-ui-fg-subtle" }) }) }),
1477
- availableInSalesChannels.length > 0 ? /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-x-1", children: [
1478
- /* @__PURE__ */ jsx8(Text4, { size: "small", leading: "compact", children: firstChannels.map((sc) => sc.name).join(", ") }),
1479
- restChannels.length > 0 && /* @__PURE__ */ jsx8(
1480
- Tooltip5,
1481
- {
1482
- content: /* @__PURE__ */ jsx8("ul", { children: restChannels.map((sc) => /* @__PURE__ */ jsx8("li", { children: sc.name }, sc.id)) }),
1483
- children: /* @__PURE__ */ jsx8(
1484
- Text4,
1485
- {
1486
- size: "small",
1487
- leading: "compact",
1488
- className: "text-ui-fg-subtle",
1489
- children: `+${restChannels.length}`
1490
- }
1491
- )
1492
- }
1493
- )
1494
- ] }) : /* @__PURE__ */ jsx8(Text4, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.noSalesChannels") })
1495
- ] }),
1496
- /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(Text4, { className: "text-ui-fg-subtle", size: "small", leading: "compact", children: /* @__PURE__ */ jsx8(
1497
- Trans,
1498
- {
1499
- i18nKey: "sales_channels.availableIn",
1500
- values: {
1501
- x: availableInSalesChannels.length,
1502
- y: count ?? 0
1503
- },
1504
- components: [
1505
- /* @__PURE__ */ jsx8(
1506
- "span",
1507
- {
1508
- className: "text-ui-fg-base txt-compact-medium-plus"
1509
- },
1510
- "x"
1511
- ),
1512
- /* @__PURE__ */ jsx8(
1513
- "span",
1514
- {
1515
- className: "text-ui-fg-base txt-compact-medium-plus"
1516
- },
1517
- "y"
1518
- )
1519
- ]
1520
- }
1521
- ) }) })
1522
- ] });
1523
- };
1524
-
1525
- // src/pages/products/[id]/product-detail-page.tsx
1526
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1527
- var Root = ({ children }) => {
1528
- const initialData = useLoaderData();
1529
- const { id } = useParams();
1530
- const { product, isLoading, isError, error } = useProduct(
1531
- id,
1532
- PRODUCT_DETAIL_QUERY,
1533
- {
1534
- initialData
1535
- }
1536
- );
1537
- if (isLoading || !product) {
1538
- return /* @__PURE__ */ jsx9(TwoColumnPageSkeleton, { mainSections: 4, sidebarSections: 3 });
1539
- }
1540
- if (isError) {
1541
- throw error;
1542
- }
1543
- return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children }) : /* @__PURE__ */ jsxs9(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children: [
1544
- /* @__PURE__ */ jsxs9(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1545
- /* @__PURE__ */ jsx9(ProductActiveEditSection, { product }),
1546
- /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1547
- /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1548
- /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1549
- ] }),
1550
- /* @__PURE__ */ jsxs9(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1551
- /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1552
- /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1553
- ] })
1554
- ] });
1555
- };
1556
- var ProductDetailPage = Object.assign(Root, {
1557
- Main: TwoColumnPage.Main,
1558
- Sidebar: TwoColumnPage.Sidebar,
1559
- MainActiveEditSection: ProductActiveEditSection,
1560
- MainGeneralSection: ProductGeneralSection,
1561
- MainMediaSection: ProductMediaSection,
1562
- MainVariantSection: ProductVariantSection,
1563
- MainAttributeSection: ProductAttributeSection,
1564
- SidebarShippingProfileSection: ProductShippingProfileSection,
1565
- SidebarOrganizationSection: ProductOrganizationSection,
1566
- SidebarSalesChannelSection: ProductSalesChannelSection
1567
- });
1568
- export {
1569
- ProductDetailPage,
1570
- loader
1571
- };