@mercurjs/vendor 2.1.2 → 2.2.0-canary.2

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 (230) hide show
  1. package/dist/{[id]-H3C3ZSC6.js → [id]-3EC6HYXL.js} +25 -21
  2. package/dist/{[id]-TO6KT3ZE.js → [id]-4OBGG7OH.js} +23 -21
  3. package/dist/{[id]-6PXEWRG7.js → [id]-7BAKUHUO.js} +13 -13
  4. package/dist/{[id]-X4DDKOMQ.js → [id]-COLO4TQJ.js} +26 -22
  5. package/dist/{[id]-7RUAH3TI.js → [id]-K2CT7BXQ.js} +4 -4
  6. package/dist/{[id]-3G5G7ZFV.js → [id]-KJIQTFGE.js} +22 -20
  7. package/dist/{[id]-4VCL3MMM.js → [id]-KRLGIVLR.js} +26 -22
  8. package/dist/{[id]-B3LHVQM5.js → [id]-KVWYLDN3.js} +25 -21
  9. package/dist/{[id]-INOFZHL7.js → [id]-LTNOHLGE.js} +16 -16
  10. package/dist/{[id]-PDGHF5J2.js → [id]-LUFRJLAU.js} +35 -31
  11. package/dist/[id]-UUUQK22M.js +1442 -0
  12. package/dist/{[id]-T2ROPEGY.js → [id]-Y2ISCLUD.js} +7 -7
  13. package/dist/{[id]-Y7GAMNC5.js → [id]-ZCMSBEVM.js} +4 -4
  14. package/dist/{[id]-UTKO3VG4.js → [id]-ZWWMJAKI.js} +9 -9
  15. package/dist/{[location_id]-D55RQOXT.js → [location_id]-NUBXDDJC.js} +9 -9
  16. package/dist/{[province_id]-OFH2ZOFQ.js → [province_id]-H2QAPKVH.js} +20 -18
  17. package/dist/{add-C6OX5C54.js → add-FIWTANZX.js} +34 -30
  18. package/dist/add-PBZQCIZQ.js +392 -0
  19. package/dist/{add-customer-groups-PJRJUWS2.js → add-customer-groups-RAHCP67U.js} +16 -14
  20. package/dist/{add-products-INOLNPO6.js → add-products-N3V2MVLD.js} +23 -19
  21. package/dist/{add-promotions-AHDOP52Q.js → add-promotions-CSCAJZHV.js} +7 -7
  22. package/dist/{add-to-campaign-HL6NGRR4.js → add-to-campaign-DLP7PSQB.js} +4 -4
  23. package/dist/{address-KRENKSLP.js → address-7F5SN7PV.js} +17 -15
  24. package/dist/{adjust-inventory-H4EUP7J3.js → adjust-inventory-SZF4W7LR.js} +2 -2
  25. package/dist/{allocate-items-SUCUZU4D.js → allocate-items-SDFS5GYN.js} +6 -6
  26. package/dist/{areas-UUMZDXLX.js → areas-7Y6BVS5A.js} +8 -8
  27. package/dist/{attributes-CALEHJJG.js → attributes-MBZ76HVZ.js} +3 -3
  28. package/dist/{breadcrumb-BS7Y5OKF.js → breadcrumb-65SAGUUL.js} +2 -2
  29. package/dist/{breadcrumb-6W2VP3OZ.js → breadcrumb-7PURSRTT.js} +13 -11
  30. package/dist/{breadcrumb-M5Z5WA6I.js → breadcrumb-EDPMEN2P.js} +2 -2
  31. package/dist/breadcrumb-FLDHJRVY.js +26 -0
  32. package/dist/{breadcrumb-VNNZ3TTW.js → breadcrumb-HND5FFWC.js} +2 -2
  33. package/dist/{breadcrumb-OIGGCB3L.js → breadcrumb-QV2IAX7N.js} +8 -2
  34. package/dist/{breadcrumb-KQSFIXQ4.js → breadcrumb-VWELWDB2.js} +1 -1
  35. package/dist/{breadcrumb-IG7VZGW2.js → breadcrumb-WRG4SITG.js} +13 -11
  36. package/dist/{breadcrumb-TW5JEOYS.js → breadcrumb-ZCG2RHIU.js} +12 -10
  37. package/dist/{campaigns-HS6MIO7X.js → campaigns-L6ULR6KR.js} +5 -5
  38. package/dist/{categories-PKWR3FM3.js → categories-FUZQKBXV.js} +6 -6
  39. package/dist/{chunk-PDQSPKG5.js → chunk-2DXNJURE.js} +1 -1
  40. package/dist/{chunk-5UD4P6YL.js → chunk-2USXZSTK.js} +4 -4
  41. package/dist/chunk-35G3SZRN.js +101 -0
  42. package/dist/{chunk-6SBMVLJ2.js → chunk-36L54SQQ.js} +1 -1
  43. package/dist/chunk-432S4FGR.js +0 -0
  44. package/dist/{chunk-KQGVSLUI.js → chunk-44RQ5PTN.js} +1803 -914
  45. package/dist/{chunk-Y2QI7KWS.js → chunk-4LVP635F.js} +408 -664
  46. package/dist/{chunk-UL4O5M4S.js → chunk-4S6XGIC6.js} +1 -18
  47. package/dist/chunk-5ATEALH7.js +68 -0
  48. package/dist/{chunk-CNLP35S7.js → chunk-5L2DCA4W.js} +16 -31
  49. package/dist/{chunk-WITQNQXN.js → chunk-6BS2AVGJ.js} +3 -3
  50. package/dist/{chunk-CYTNBXWF.js → chunk-6Y53VZ3C.js} +9 -9
  51. package/dist/{chunk-ZYOXKUKZ.js → chunk-7LBY5JLV.js} +1 -1
  52. package/dist/chunk-7SLWXX6L.js +811 -0
  53. package/dist/{chunk-LQYMBSRQ.js → chunk-AIZM66CG.js} +1 -1
  54. package/dist/{chunk-IZ5RG5XI.js → chunk-AJLGY3LQ.js} +1 -21
  55. package/dist/{chunk-WFE6CT6M.js → chunk-AVOIZO63.js} +21 -77
  56. package/dist/chunk-CFRWIQIZ.js +43 -0
  57. package/dist/{chunk-WNVEMFIK.js → chunk-CNMY5HVP.js} +2 -2
  58. package/dist/{chunk-BLVJAKBA.js → chunk-DDH7ULIQ.js} +1 -1
  59. package/dist/chunk-DIW4GRTI.js +503 -0
  60. package/dist/{chunk-JQP7MOFH.js → chunk-DVEKYLPV.js} +1 -1
  61. package/dist/{chunk-ZZO3INVE.js → chunk-DZIXC7OE.js} +1428 -1325
  62. package/dist/{chunk-QX45GVAL.js → chunk-EIUYXS7E.js} +8 -8
  63. package/dist/{chunk-N7OVXN72.js → chunk-EROX26D4.js} +1 -1
  64. package/dist/{chunk-2RHAI7WK.js → chunk-EZ3JOAUS.js} +1 -1
  65. package/dist/{chunk-HFRHHT36.js → chunk-FDR22JMM.js} +63 -8
  66. package/dist/{chunk-PEKANQ3T.js → chunk-FJUUGFXL.js} +2 -2
  67. package/dist/{chunk-3CK6OINO.js → chunk-GDWBOQI5.js} +3 -5
  68. package/dist/chunk-GGWUWT55.js +95 -0
  69. package/dist/chunk-GKZHBXZK.js +426 -0
  70. package/dist/{chunk-47SXTGLN.js → chunk-GXIAIITP.js} +63 -200
  71. package/dist/{chunk-4MFMCZEJ.js → chunk-H6LZ77GX.js} +2 -2
  72. package/dist/chunk-K4X324QP.js +18 -0
  73. package/dist/{chunk-VQ5EKDA3.js → chunk-KD7RYE6R.js} +1 -1
  74. package/dist/chunk-LEWA4BPH.js +18 -0
  75. package/dist/{chunk-7Q5SDEK7.js → chunk-LNM2D2I4.js} +4 -4
  76. package/dist/{chunk-LPOAVK6Y.js → chunk-LQD232FW.js} +47 -12
  77. package/dist/{chunk-OXXL4WQU.js → chunk-M7KSRYRI.js} +5 -5
  78. package/dist/{chunk-I2IKYOZX.js → chunk-N4MVIBFM.js} +19 -19
  79. package/dist/{chunk-PCMNEUMV.js → chunk-NHFEY3EI.js} +1 -1
  80. package/dist/{chunk-RTAWYMQP.js → chunk-NJMNYS7G.js} +1 -1
  81. package/dist/{chunk-HGQTL7NX.js → chunk-NSZQERLE.js} +2 -2
  82. package/dist/{chunk-RL7SFZOF.js → chunk-NXNJQZCP.js} +1 -1
  83. package/dist/{chunk-D2MA5TAP.js → chunk-PBD36EZJ.js} +2 -2
  84. package/dist/{chunk-4ZGFODSC.js → chunk-PZ44R4AS.js} +1 -1
  85. package/dist/{chunk-ZEVYT6IX.js → chunk-QNNJN4H6.js} +116 -286
  86. package/dist/{chunk-WBI7FEGI.js → chunk-QS6RWIBL.js} +1 -1
  87. package/dist/chunk-QT7YFHCA.js +198 -0
  88. package/dist/{chunk-GYV6SKY7.js → chunk-QXLRABYH.js} +4 -6
  89. package/dist/chunk-RTBNJQOV.js +2063 -0
  90. package/dist/chunk-RXZFEFNV.js +73 -0
  91. package/dist/{chunk-RUE5BPC2.js → chunk-RZLN2Q6G.js} +1 -1
  92. package/dist/{chunk-NYDJTWRL.js → chunk-SGR4DMCW.js} +4 -4
  93. package/dist/chunk-T6LHVNWO.js +27 -0
  94. package/dist/{chunk-DKQ4XMSN.js → chunk-TNVYTMBL.js} +6 -6
  95. package/dist/{chunk-32RYSB2V.js → chunk-TODJFRLH.js} +2 -2
  96. package/dist/{chunk-P3ZTO6T2.js → chunk-UAF2S447.js} +1 -1
  97. package/dist/{chunk-J6BRLL3F.js → chunk-UCQKXXLD.js} +2 -2
  98. package/dist/chunk-UORPTGV2.js +114 -0
  99. package/dist/{chunk-X4FLOQ45.js → chunk-WBHFU3MG.js} +2 -2
  100. package/dist/chunk-WLT7K7K7.js +63 -0
  101. package/dist/{chunk-4URLUCTD.js → chunk-WUPJADSO.js} +2 -2
  102. package/dist/{chunk-5M3SL4UZ.js → chunk-X2FVFUET.js} +9 -104
  103. package/dist/{chunk-ITI54CII.js → chunk-X4INVIWL.js} +5 -5
  104. package/dist/{chunk-PTW7JNAP.js → chunk-XFQJU6FA.js} +4 -4
  105. package/dist/{collections-DJZI2RM2.js → collections-YCAAFGSW.js} +22 -19
  106. package/dist/{configuration-RHPIO2QT.js → configuration-C4IGBNXH.js} +1 -1
  107. package/dist/{configuration-GN3TO77H.js → configuration-UOSNP45I.js} +3 -3
  108. package/dist/{create-G4T2PAJH.js → create-35MYQPVM.js} +23 -21
  109. package/dist/{create-3EK5CNNX.js → create-B5ZXTK3K.js} +33 -29
  110. package/dist/{create-HKJVSFB7.js → create-BJ4OO6LS.js} +23 -21
  111. package/dist/create-FCKGCZSM.js +210 -0
  112. package/dist/{create-7S7CZWEN.js → create-GB3ZA4LH.js} +4 -4
  113. package/dist/{create-YO55Z3YD.js → create-HI5UI2EZ.js} +32 -38
  114. package/dist/create-JDGM5KXE.js +193 -0
  115. package/dist/{create-IDVCZHIX.js → create-ORXYT74H.js} +14 -12
  116. package/dist/{create-GHM7OTCR.js → create-R7K3ECN6.js} +1 -1
  117. package/dist/{create-D6EW3EWC.js → create-SFU3W3ZH.js} +1 -1
  118. package/dist/{create-33TRLASX.js → create-UPYB65PD.js} +1 -1
  119. package/dist/{create-OCFPLNNY.js → create-UQNYMVBM.js} +6 -6
  120. package/dist/{create-OGLPDVOI.js → create-XAD5NMSJ.js} +37 -35
  121. package/dist/{create-KGYL7FBM.js → create-XVHOCZHJ.js} +1 -1
  122. package/dist/{create-4AE3VTWN.js → create-YBF4YGWG.js} +2 -2
  123. package/dist/{create-3ZVXEPX5.js → create-YDDBH4VQ.js} +25 -21
  124. package/dist/{customers-6ZLE65UX.js → customers-ETXVNM3G.js} +5 -5
  125. package/dist/{edit-QBISX7D3.js → edit-2Q7TRUTL.js} +14 -12
  126. package/dist/{edit-B5B3XKDM.js → edit-522DG3BY.js} +1 -1
  127. package/dist/{edit-ATXE6CM5.js → edit-C4OCKQVU.js} +1 -1
  128. package/dist/{edit-IR6V2IDN.js → edit-FKXIQ6ZI.js} +19 -17
  129. package/dist/{edit-4HZHLYI3.js → edit-GQNIINRR.js} +1 -1
  130. package/dist/{edit-LRRJTHV2.js → edit-KAKVPHZZ.js} +1 -1
  131. package/dist/{edit-ZSOI56BQ.js → edit-L5ZZLMAY.js} +22 -22
  132. package/dist/{edit-GIJXLMC3.js → edit-O4JLGKQR.js} +2 -2
  133. package/dist/{edit-5CJZRHAA.js → edit-ORXS3A2Y.js} +1 -1
  134. package/dist/{edit-FC64DWB2.js → edit-Q3UQIOLS.js} +1 -1
  135. package/dist/{edit-7HTH2UJF.js → edit-REDDBLTA.js} +3 -3
  136. package/dist/{edit-2KRJIPRK.js → edit-SGUY2CCK.js} +19 -17
  137. package/dist/{edit-B75KK5ZX.js → edit-UGEC27HP.js} +35 -31
  138. package/dist/{edit-FNDDSSMT.js → edit-VKT62KHG.js} +37 -8
  139. package/dist/{edit-7GVP6SRA.js → edit-ZAHCMF5U.js} +1 -1
  140. package/dist/{edit-RNT555GP.js → edit-ZCXUG42Q.js} +13 -11
  141. package/dist/{edit-MYSWY6W4.js → edit-ZMERG3L7.js} +1 -1
  142. package/dist/{edit-budget-J27CSEZH.js → edit-budget-L3CCEWNF.js} +1 -1
  143. package/dist/{edit-inventory-item-US77M2FF.js → edit-inventory-item-6B7ITDGD.js} +2 -2
  144. package/dist/{edit-inventory-item-attributes-UGAE2NAZ.js → edit-inventory-item-attributes-Y7MQZLXI.js} +3 -3
  145. package/dist/{fulfillment-DCS67LTK.js → fulfillment-75Z4H23W.js} +16 -14
  146. package/dist/{fulfillment-providers-GM5PO6N3.js → fulfillment-providers-DQAU43JZ.js} +20 -17
  147. package/dist/index.css +27 -62
  148. package/dist/index.d.ts +3 -10
  149. package/dist/index.js +522 -458
  150. package/dist/{inventory-OPZ2FSEE.js → inventory-KAUVPMPZ.js} +6 -6
  151. package/dist/{invite-KEJLNXEZ.js → invite-CI2P4GF6.js} +15 -12
  152. package/dist/{invite-764K3TJS.js → invite-Q6EYDZVQ.js} +24 -21
  153. package/dist/loader-FBB5OQRT.js +31 -0
  154. package/dist/{locations-ZVPTQCQY.js → locations-INS6FTMJ.js} +4 -4
  155. package/dist/{login-OUHRNNXA.js → login-KY342RMK.js} +12 -10
  156. package/dist/{manage-locations-YUKEFCBJ.js → manage-locations-WNHEBS3A.js} +2 -2
  157. package/dist/{media-4KYFHB5V.js → media-B6ME2WXY.js} +41 -9
  158. package/dist/{metadata-NYYL26MQ.js → metadata-2CMH4I6U.js} +16 -14
  159. package/dist/{metadata-AWUKZ25V.js → metadata-5BPOBBU2.js} +3 -3
  160. package/dist/{metadata-OCE6A3JE.js → metadata-GWI6R4ES.js} +15 -13
  161. package/dist/{metadata-G7KZXVNE.js → metadata-NUXUC2JA.js} +15 -13
  162. package/dist/{metadata-XP3ZYW2M.js → metadata-TLDUF5KV.js} +17 -15
  163. package/dist/{metadata-PYY4IB7K.js → metadata-WR4RFXO5.js} +16 -14
  164. package/dist/offer-create-page-4Z6L63BU.js +743 -0
  165. package/dist/offer-detail-page-6MAHNNIO.js +488 -0
  166. package/dist/offer-edit-page-DYQFU6JU.js +151 -0
  167. package/dist/offer-inventory-batch-page-WKCWNDNK.js +290 -0
  168. package/dist/offer-pricing-edit-page-4TYGGSOE.js +195 -0
  169. package/dist/offers-ZG6OTDZ2.js +32 -0
  170. package/dist/{onboarding-WXZHW62K.js → onboarding-43LQQQGQ.js} +22 -20
  171. package/dist/{orders-LWJ472VM.js → orders-ZV4D6L2V.js} +24 -21
  172. package/dist/organization-ZTQGRJWS.js +375 -0
  173. package/dist/{organize-RFOMQCBG.js → organize-HNJUHEEG.js} +4 -4
  174. package/dist/{organize-OVKJ3HZO.js → organize-K6QMAMEN.js} +4 -4
  175. package/dist/pages/index.d.ts +415 -758
  176. package/dist/pages/index.js +81 -77
  177. package/dist/{payment-details-UVXYCTUK.js → payment-details-64US5XWD.js} +17 -15
  178. package/dist/{payouts-TR7K5I37.js → payouts-UXJDTXDL.js} +6 -6
  179. package/dist/{price-lists-S2WNELFZ.js → price-lists-KBPUVSZI.js} +8 -8
  180. package/dist/{pricing-UF27DAXA.js → pricing-DF6C5XK4.js} +35 -32
  181. package/dist/{product-tags-2CKH2M6D.js → product-tags-6MZB4W5R.js} +32 -28
  182. package/dist/{product-types-FX43JEO2.js → product-types-UUHBV4IZ.js} +5 -5
  183. package/dist/product-variant-detail-RVWEYVPC.js +220 -0
  184. package/dist/{product-variant-edit-P3DSIFE3.js → product-variant-edit-YYNPHE4L.js} +126 -66
  185. package/dist/{products-H5EMRJYS.js → products-IWKTGZS6.js} +23 -19
  186. package/dist/{products-2LHGS7X3.js → products-MZBU5MEV.js} +40 -43
  187. package/dist/{professional-details-HYKTH44B.js → professional-details-5T2VS6MM.js} +16 -14
  188. package/dist/{profile-PB27WIRW.js → profile-6XGHAT7H.js} +20 -18
  189. package/dist/{promotions-5EYPGHJP.js → promotions-O7U4BTK6.js} +8 -8
  190. package/dist/{register-4O4F6YZK.js → register-N6WOSMLA.js} +16 -14
  191. package/dist/{reset-password-GTWLBOFK.js → reset-password-EICPAY2N.js} +1 -1
  192. package/dist/{return-reasons-LOKYRGMI.js → return-reasons-IX3LIOCU.js} +16 -14
  193. package/dist/{sales-channels-7R2IY3KG.js → sales-channels-B6FULRWI.js} +8 -7
  194. package/dist/{sales-channels-Y4LRP7JC.js → sales-channels-JW3QUYR7.js} +8 -7
  195. package/dist/{settings-2XDLFYMS.js → settings-MV53ZZ53.js} +39 -35
  196. package/dist/{shipment-4GW2JFWB.js → shipment-Q33QBMXX.js} +13 -11
  197. package/dist/{shipping-profile-R3NABPQF.js → shipping-profile-Y4SNEPZX.js} +2 -2
  198. package/dist/{shipping-profiles-QVKNFLCW.js → shipping-profiles-2NWKCEJK.js} +18 -16
  199. package/dist/{stock-5RXNUPUT.js → stock-7CSVEJJU.js} +19 -17
  200. package/dist/{store-DE2RGX7T.js → store-X23G3JCJ.js} +28 -25
  201. package/dist/{store-closure-DNMCHUXD.js → store-closure-P5PD2RSV.js} +16 -14
  202. package/dist/{store-select-GZEJHRZ7.js → store-select-TREPDS3G.js} +17 -15
  203. package/dist/{tax-regions-UD6P5FVC.js → tax-regions-YXZW7UVX.js} +5 -5
  204. package/dist/{team-JXKAVRPU.js → team-SPP5OY5W.js} +25 -23
  205. package/dist/types-CtCEtTE6.d.ts +16 -0
  206. package/package.json +6 -6
  207. package/dist/[id]-BYP37PU4.js +0 -1314
  208. package/dist/add-KRAGFFBJ.js +0 -158
  209. package/dist/bulk-edit-3SMBLIOA.js +0 -244
  210. package/dist/chunk-4KX6CBJ4.js +0 -178
  211. package/dist/chunk-DLNNTQRY.js +0 -217
  212. package/dist/chunk-FX4V5JCF.js +0 -37
  213. package/dist/chunk-GC33DBKG.js +0 -143
  214. package/dist/chunk-NK4NR6MN.js +0 -173
  215. package/dist/chunk-PFU6FSXY.js +0 -430
  216. package/dist/chunk-QJEOPT2P.js +0 -330
  217. package/dist/chunk-QSGR43JM.js +0 -30
  218. package/dist/chunk-STR3NGWE.js +0 -3736
  219. package/dist/create-3DOO3RNH.js +0 -716
  220. package/dist/create-I7HV3RM6.js +0 -150
  221. package/dist/edit-K2AD335I.js +0 -237
  222. package/dist/edit-VO5XLIEL.js +0 -362
  223. package/dist/edit-stocks-and-prices-MHHQFWFA.js +0 -408
  224. package/dist/organization-LPYQRTQC.js +0 -303
  225. package/dist/prices-3OXV5RGY.js +0 -270
  226. package/dist/product-variant-detail-WV4KXVXR.js +0 -590
  227. package/dist/stock-GPC3BCL6.js +0 -500
  228. package/dist/{chunk-SDSEW72R.js → chunk-E2HQPY32.js} +3 -3
  229. package/dist/{chunk-6WY5X4PE.js → chunk-L7QKFC5N.js} +7 -7
  230. /package/dist/{chunk-CAS74NLJ.js → chunk-YV6MK4PZ.js} +0 -0
@@ -0,0 +1,1442 @@
1
+ import {
2
+ SectionRow
3
+ } from "./chunk-4TLP3TAA.js";
4
+ import {
5
+ useDataTableDateColumns,
6
+ useDataTableDateFilters
7
+ } from "./chunk-FDR22JMM.js";
8
+ import {
9
+ SidebarLink
10
+ } from "./chunk-4GPAS5GW.js";
11
+ import "./chunk-U2EI2ZLM.js";
12
+ import {
13
+ TwoColumnPage
14
+ } from "./chunk-YV6MK4PZ.js";
15
+ import "./chunk-LRD242C7.js";
16
+ import "./chunk-QHQWEERJ.js";
17
+ import "./chunk-432S4FGR.js";
18
+ import {
19
+ DataTable
20
+ } from "./chunk-PPLC4IKI.js";
21
+ import {
22
+ useQueryParams
23
+ } from "./chunk-THHRRYRS.js";
24
+ import {
25
+ require_dist
26
+ } from "./chunk-DZIXC7OE.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-GXIAIITP.js";
36
+ import "./chunk-F4OJN2F2.js";
37
+ import "./chunk-LRARA622.js";
38
+ import "./chunk-M6N4ISXL.js";
39
+ import "./chunk-S7EKBD2C.js";
40
+ import "./chunk-VXMOPVRH.js";
41
+ import {
42
+ useProductType
43
+ } from "./chunk-VV6IKGCN.js";
44
+ import "./chunk-NHFEY3EI.js";
45
+ import "./chunk-BOZJOOGW.js";
46
+ import "./chunk-LWJF63JW.js";
47
+ import "./chunk-T6LHVNWO.js";
48
+ import "./chunk-4S6XGIC6.js";
49
+ import "./chunk-QT7YFHCA.js";
50
+ import "./chunk-IQWK723D.js";
51
+ import "./chunk-UORPTGV2.js";
52
+ import {
53
+ useCollection
54
+ } from "./chunk-NXNJQZCP.js";
55
+ import "./chunk-VXWN37PT.js";
56
+ import {
57
+ useProductCategory
58
+ } from "./chunk-RZLN2Q6G.js";
59
+ import "./chunk-NBPMNUKZ.js";
60
+ import "./chunk-QS6RWIBL.js";
61
+ import {
62
+ useSalesChannels
63
+ } from "./chunk-3B34B2M2.js";
64
+ import {
65
+ ActionMenu
66
+ } from "./chunk-BDGZ4EQO.js";
67
+ import "./chunk-LAVHRER2.js";
68
+ import "./chunk-Y7QKP6QU.js";
69
+ import {
70
+ PRODUCT_DETAIL_QUERY
71
+ } from "./chunk-K4X324QP.js";
72
+ import {
73
+ productsQueryKeys,
74
+ useCancelProductEdit,
75
+ useDeleteProduct,
76
+ useDeleteVariantLazy,
77
+ useProduct,
78
+ useProductChange,
79
+ useProductVariants,
80
+ useRemoveProductAttribute,
81
+ useUpdateProduct
82
+ } from "./chunk-QNNJN4H6.js";
83
+ import "./chunk-A5DJIOHN.js";
84
+ import {
85
+ queryClient
86
+ } from "./chunk-RHKRREUU.js";
87
+ import "./chunk-ZA2KFUFR.js";
88
+ import {
89
+ sdk
90
+ } from "./chunk-RIN4CBRB.js";
91
+ import {
92
+ __toESM
93
+ } from "./chunk-NBMM2TZK.js";
94
+
95
+ // src/pages/products/[id]/loader.tsx
96
+ var productDetailQuery = (id) => ({
97
+ queryKey: productsQueryKeys.detail(id, PRODUCT_DETAIL_QUERY),
98
+ queryFn: async () => sdk.vendor.products.$id.query({
99
+ $id: id,
100
+ ...PRODUCT_DETAIL_QUERY
101
+ })
102
+ });
103
+ var loader = async ({ params }) => {
104
+ const id = params.id;
105
+ const query = productDetailQuery(id);
106
+ const response = await queryClient.ensureQueryData({
107
+ ...query,
108
+ staleTime: 9e4
109
+ });
110
+ return response;
111
+ };
112
+
113
+ // src/pages/products/[id]/product-detail-page.tsx
114
+ import { Children } from "react";
115
+ import { useLoaderData, useParams } from "react-router-dom";
116
+
117
+ // src/pages/products/[id]/_components/product-active-edit-section/product-active-edit-section.tsx
118
+ var import_types = __toESM(require_dist(), 1);
119
+ import { ExclamationCircleSolid } from "@medusajs/icons";
120
+ import { Button, Container, Heading, Text, toast, usePrompt } from "@medusajs/ui";
121
+ import {
122
+ describeProductChangeAction,
123
+ extractReferenceIds,
124
+ formatFieldValue,
125
+ humanizeFieldName,
126
+ isImageList,
127
+ isReferenceField,
128
+ partitionProductChangeActions
129
+ } from "@mercurjs/dashboard-shared";
130
+ import { useQuery } from "@tanstack/react-query";
131
+ import { Fragment, useMemo } from "react";
132
+ import { useTranslation } from "react-i18next";
133
+ import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
134
+ var ImageStrip = ({
135
+ images,
136
+ faded
137
+ }) => /* @__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}`)) });
138
+ var BrandName = ({ id }) => {
139
+ const { data } = useQuery({
140
+ queryKey: ["product_brand", id],
141
+ queryFn: () => sdk.vendor.productBrands.$id.query({ $id: id }),
142
+ enabled: !!id
143
+ });
144
+ return /* @__PURE__ */ jsx(Fragment2, { children: data?.product_brand?.name ?? id });
145
+ };
146
+ var TypeName = ({ id }) => {
147
+ const { product_type } = useProductType(id);
148
+ return /* @__PURE__ */ jsx(Fragment2, { children: product_type?.value ?? id });
149
+ };
150
+ var CollectionName = ({ id }) => {
151
+ const { collection } = useCollection(id);
152
+ return /* @__PURE__ */ jsx(Fragment2, { children: collection?.title ?? id });
153
+ };
154
+ var CategoryName = ({ id }) => {
155
+ const { product_category } = useProductCategory(id);
156
+ return /* @__PURE__ */ jsx(Fragment2, { children: product_category?.name ?? id });
157
+ };
158
+ var TagName = ({ id }) => {
159
+ const { product_tag } = useProductTag(id);
160
+ return /* @__PURE__ */ jsx(Fragment2, { children: product_tag?.value ?? id });
161
+ };
162
+ var ReferenceName = ({
163
+ field,
164
+ id
165
+ }) => {
166
+ switch (field) {
167
+ case "brand_id":
168
+ return /* @__PURE__ */ jsx(BrandName, { id });
169
+ case "type_id":
170
+ return /* @__PURE__ */ jsx(TypeName, { id });
171
+ case "collection_id":
172
+ return /* @__PURE__ */ jsx(CollectionName, { id });
173
+ case "categories":
174
+ return /* @__PURE__ */ jsx(CategoryName, { id });
175
+ case "tags":
176
+ return /* @__PURE__ */ jsx(TagName, { id });
177
+ }
178
+ };
179
+ var ReferenceList = ({
180
+ field,
181
+ ids
182
+ }) => {
183
+ if (!ids.length) return /* @__PURE__ */ jsx(Fragment2, { children: "-" });
184
+ return /* @__PURE__ */ jsx(Fragment2, { children: ids.map((id, idx) => /* @__PURE__ */ jsxs(Fragment, { children: [
185
+ idx > 0 && ", ",
186
+ /* @__PURE__ */ jsx(ReferenceName, { field, id })
187
+ ] }, `${field}-${id}`)) });
188
+ };
189
+ var FieldRow = ({ diff }) => {
190
+ const { t } = useTranslation();
191
+ const hasPrevious = diff.previous !== void 0 && diff.previous !== null && diff.previous !== "" && !(Array.isArray(diff.previous) && diff.previous.length === 0);
192
+ const nextIsImages = isImageList(diff.next);
193
+ const previousIsImages = isImageList(diff.previous);
194
+ const renderAsImages = nextIsImages || previousIsImages;
195
+ const renderAsReference = isReferenceField(diff.field);
196
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
197
+ /* @__PURE__ */ jsx(
198
+ Text,
199
+ {
200
+ size: "small",
201
+ weight: "plus",
202
+ leading: "compact",
203
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
204
+ children: t(`fields.${diff.field}`, {
205
+ defaultValue: humanizeFieldName(diff.field)
206
+ })
207
+ }
208
+ ),
209
+ renderAsImages ? /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
210
+ hasPrevious && previousIsImages && /* @__PURE__ */ jsx(ImageStrip, { images: diff.previous, faded: true }),
211
+ hasPrevious && /* @__PURE__ */ jsx(
212
+ Text,
213
+ {
214
+ size: "small",
215
+ leading: "compact",
216
+ className: "text-ui-fg-subtle",
217
+ children: "\u2192"
218
+ }
219
+ ),
220
+ nextIsImages ? /* @__PURE__ */ jsx(ImageStrip, { images: diff.next }) : /* @__PURE__ */ jsx(
221
+ Text,
222
+ {
223
+ size: "small",
224
+ leading: "compact",
225
+ className: "text-ui-fg-subtle",
226
+ children: formatFieldValue(diff.next, diff.field)
227
+ }
228
+ )
229
+ ] }) : renderAsReference ? /* @__PURE__ */ jsxs(
230
+ Text,
231
+ {
232
+ size: "small",
233
+ leading: "compact",
234
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
235
+ children: [
236
+ hasPrevious && /* @__PURE__ */ jsx("span", { className: "line-through", children: /* @__PURE__ */ jsx(
237
+ ReferenceList,
238
+ {
239
+ field: diff.field,
240
+ ids: extractReferenceIds(
241
+ diff.field,
242
+ diff.previous
243
+ )
244
+ }
245
+ ) }),
246
+ hasPrevious && " \u2192 ",
247
+ /* @__PURE__ */ jsx(
248
+ ReferenceList,
249
+ {
250
+ field: diff.field,
251
+ ids: extractReferenceIds(diff.field, diff.next)
252
+ }
253
+ )
254
+ ]
255
+ }
256
+ ) : /* @__PURE__ */ jsxs(
257
+ Text,
258
+ {
259
+ size: "small",
260
+ leading: "compact",
261
+ className: "text-ui-fg-subtle flex-1 whitespace-pre-line text-pretty",
262
+ children: [
263
+ hasPrevious && /* @__PURE__ */ jsx("span", { className: "line-through", children: formatFieldValue(diff.previous, diff.field) }),
264
+ hasPrevious && " \u2192 ",
265
+ formatFieldValue(diff.next, diff.field)
266
+ ]
267
+ }
268
+ )
269
+ ] });
270
+ };
271
+ var ActionLine = ({ action }) => {
272
+ const { t } = useTranslation();
273
+ const label = describeProductChangeAction(action, {
274
+ variant: t("fields.variant", { defaultValue: "Variant" })
275
+ });
276
+ return /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: label });
277
+ };
278
+ var ProductActiveEditSection = ({
279
+ productId
280
+ }) => {
281
+ const { t } = useTranslation();
282
+ const prompt = usePrompt();
283
+ const { product_change, isError } = useProductChange(productId, {
284
+ retry: false
285
+ });
286
+ const { mutateAsync: cancelEdit, isPending: isCanceling } = useCancelProductEdit(productId);
287
+ const { updated, added, removed, deleteRequested } = useMemo(
288
+ () => partitionProductChangeActions(product_change?.actions ?? []),
289
+ [product_change]
290
+ );
291
+ const onCancel = async () => {
292
+ const confirmed = await prompt({
293
+ title: t("products.edits.panel.cancelTitle"),
294
+ description: t("products.edits.panel.cancelDescription"),
295
+ confirmText: t("actions.confirm"),
296
+ cancelText: t("actions.cancel")
297
+ });
298
+ if (!confirmed) return;
299
+ try {
300
+ await cancelEdit();
301
+ toast.success(t("products.edits.toast.canceledSuccessfully"));
302
+ } catch (e) {
303
+ toast.error(e.message);
304
+ }
305
+ };
306
+ if (isError || !product_change) {
307
+ return null;
308
+ }
309
+ if (product_change.status !== import_types.ProductChangeStatus.PENDING) {
310
+ return null;
311
+ }
312
+ const hasContent = updated.length > 0 || added.length > 0 || removed.length > 0 || deleteRequested;
313
+ return /* @__PURE__ */ jsxs(
314
+ Container,
315
+ {
316
+ className: "divide-y p-0",
317
+ "data-testid": "product-active-edit-section",
318
+ children: [
319
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-6 py-4", children: [
320
+ /* @__PURE__ */ jsx(ExclamationCircleSolid, { className: "text-ui-fg-interactive" }),
321
+ /* @__PURE__ */ jsx(Heading, { level: "h2", "data-testid": "product-active-edit-heading", children: t("products.edits.panel.title") })
322
+ ] }),
323
+ /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.edits.panel.description") }) }),
324
+ hasContent && /* @__PURE__ */ jsxs(Fragment2, { children: [
325
+ updated.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
326
+ /* @__PURE__ */ jsx(
327
+ Text,
328
+ {
329
+ size: "small",
330
+ weight: "plus",
331
+ leading: "compact",
332
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
333
+ children: t("labels.updated")
334
+ }
335
+ ),
336
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-4", children: updated.map((diff, idx) => /* @__PURE__ */ jsx(FieldRow, { diff }, `${diff.field}-${idx}`)) })
337
+ ] }),
338
+ added.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
339
+ /* @__PURE__ */ jsx(
340
+ Text,
341
+ {
342
+ size: "small",
343
+ weight: "plus",
344
+ leading: "compact",
345
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
346
+ children: t("labels.added")
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: added.map((action) => /* @__PURE__ */ jsx(ActionLine, { action }, action.id)) })
350
+ ] }),
351
+ removed.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
352
+ /* @__PURE__ */ jsx(
353
+ Text,
354
+ {
355
+ size: "small",
356
+ weight: "plus",
357
+ leading: "compact",
358
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
359
+ children: t("labels.removed")
360
+ }
361
+ ),
362
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col gap-y-2", children: removed.map((action) => /* @__PURE__ */ jsx(ActionLine, { action }, action.id)) })
363
+ ] }),
364
+ deleteRequested && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 px-6 py-4", children: [
365
+ /* @__PURE__ */ jsx(
366
+ Text,
367
+ {
368
+ size: "small",
369
+ weight: "plus",
370
+ leading: "compact",
371
+ className: "text-ui-fg-subtle w-[160px] shrink-0",
372
+ children: t("labels.removed")
373
+ }
374
+ ),
375
+ /* @__PURE__ */ jsx(
376
+ Text,
377
+ {
378
+ size: "small",
379
+ leading: "compact",
380
+ className: "text-ui-fg-subtle flex-1",
381
+ children: t("products.edits.panel.deleteRequested")
382
+ }
383
+ )
384
+ ] })
385
+ ] }),
386
+ /* @__PURE__ */ jsx(
387
+ "div",
388
+ {
389
+ className: "bg-ui-bg-subtle flex items-center justify-end gap-x-2 rounded-b-xl px-6 py-4",
390
+ "data-testid": "product-active-edit-actions",
391
+ children: /* @__PURE__ */ jsx(
392
+ Button,
393
+ {
394
+ size: "small",
395
+ variant: "secondary",
396
+ onClick: onCancel,
397
+ disabled: isCanceling,
398
+ isLoading: isCanceling,
399
+ "data-testid": "product-active-edit-cancel-button",
400
+ children: t("actions.cancel")
401
+ }
402
+ )
403
+ }
404
+ )
405
+ ]
406
+ }
407
+ );
408
+ };
409
+
410
+ // src/pages/products/[id]/_components/product-general-section/product-general-section.tsx
411
+ import { PencilSquare, Trash } from "@medusajs/icons";
412
+ import { Container as Container2, Heading as Heading2, StatusBadge, usePrompt as usePrompt2 } from "@medusajs/ui";
413
+ import { useTranslation as useTranslation2 } from "react-i18next";
414
+ import { useNavigate } from "react-router-dom";
415
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
416
+ var productStatusColor = (status) => {
417
+ switch (status) {
418
+ case "draft":
419
+ return "grey";
420
+ case "proposed":
421
+ return "orange";
422
+ case "published":
423
+ return "green";
424
+ case "rejected":
425
+ return "red";
426
+ case "requires_action":
427
+ return "blue";
428
+ default:
429
+ return "grey";
430
+ }
431
+ };
432
+ var ProductGeneralSection = ({
433
+ product
434
+ }) => {
435
+ const { t } = useTranslation2();
436
+ const prompt = usePrompt2();
437
+ const navigate = useNavigate();
438
+ const { mutateAsync } = useDeleteProduct(product.id);
439
+ const handleDelete = async () => {
440
+ const res = await prompt({
441
+ title: t("general.areYouSure"),
442
+ description: t("products.deleteWarning", {
443
+ title: product.title
444
+ }),
445
+ confirmText: t("actions.delete"),
446
+ cancelText: t("actions.cancel")
447
+ });
448
+ if (!res) {
449
+ return;
450
+ }
451
+ await mutateAsync(void 0, {
452
+ onSuccess: () => {
453
+ navigate("..");
454
+ }
455
+ });
456
+ };
457
+ return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", children: [
458
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
459
+ /* @__PURE__ */ jsx2(Heading2, { children: product.title }),
460
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-4", children: [
461
+ /* @__PURE__ */ jsx2(StatusBadge, { color: productStatusColor(product.status), children: t(`products.productStatus.${product.status}`) }),
462
+ /* @__PURE__ */ jsx2(
463
+ ActionMenu,
464
+ {
465
+ groups: [
466
+ {
467
+ actions: [
468
+ {
469
+ label: t("actions.edit"),
470
+ to: "edit",
471
+ icon: /* @__PURE__ */ jsx2(PencilSquare, {})
472
+ }
473
+ ]
474
+ },
475
+ {
476
+ actions: [
477
+ {
478
+ label: t("actions.delete"),
479
+ onClick: handleDelete,
480
+ icon: /* @__PURE__ */ jsx2(Trash, {})
481
+ }
482
+ ]
483
+ }
484
+ ]
485
+ }
486
+ )
487
+ ] })
488
+ ] }),
489
+ /* @__PURE__ */ jsx2(
490
+ SectionRow,
491
+ {
492
+ title: t("fields.description"),
493
+ value: product.description || "-"
494
+ }
495
+ ),
496
+ /* @__PURE__ */ jsx2(
497
+ SectionRow,
498
+ {
499
+ title: t("fields.subtitle"),
500
+ value: product.subtitle || "-"
501
+ }
502
+ ),
503
+ /* @__PURE__ */ jsx2(SectionRow, { title: t("fields.handle"), value: `/${product.handle}` }),
504
+ /* @__PURE__ */ jsx2(
505
+ SectionRow,
506
+ {
507
+ title: t("fields.discountable"),
508
+ value: product.discountable ? t("general.true") : t("general.false")
509
+ }
510
+ )
511
+ ] });
512
+ };
513
+
514
+ // src/pages/products/[id]/_components/product-media-section/product-media-section.tsx
515
+ import { useState } from "react";
516
+ import { PencilSquare as PencilSquare2, ThumbnailBadge } from "@medusajs/icons";
517
+ import {
518
+ Button as Button2,
519
+ Checkbox,
520
+ clx,
521
+ CommandBar,
522
+ Container as Container3,
523
+ Heading as Heading3,
524
+ Text as Text2,
525
+ Tooltip,
526
+ usePrompt as usePrompt3
527
+ } from "@medusajs/ui";
528
+ import { useTranslation as useTranslation3 } from "react-i18next";
529
+ import { Link } from "react-router-dom";
530
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
531
+ var ProductMediaSection = ({
532
+ product
533
+ }) => {
534
+ const { t } = useTranslation3();
535
+ const prompt = usePrompt3();
536
+ const [selection, setSelection] = useState({});
537
+ const media = getMedia(product);
538
+ const handleCheckedChange = (id) => {
539
+ setSelection((prev) => {
540
+ if (prev[id]) {
541
+ const { [id]: _, ...rest } = prev;
542
+ return rest;
543
+ } else {
544
+ return { ...prev, [id]: true };
545
+ }
546
+ });
547
+ };
548
+ const { mutateAsync } = useUpdateProduct(product.id);
549
+ const handleDelete = async () => {
550
+ const ids = Object.keys(selection);
551
+ const includingThumbnail = ids.some((id) => media.find((m) => m.id === id)?.isThumbnail);
552
+ const res = await prompt({
553
+ title: t("general.areYouSure"),
554
+ description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
555
+ count: ids.length
556
+ }) : t("products.media.deleteWarning", {
557
+ count: ids.length
558
+ }),
559
+ confirmText: t("actions.delete"),
560
+ cancelText: t("actions.cancel")
561
+ });
562
+ if (!res) {
563
+ return;
564
+ }
565
+ const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
566
+ await mutateAsync(
567
+ {
568
+ images: mediaToKeep,
569
+ thumbnail: includingThumbnail ? "" : void 0
570
+ },
571
+ {
572
+ onSuccess: () => {
573
+ setSelection({});
574
+ }
575
+ }
576
+ );
577
+ };
578
+ return /* @__PURE__ */ jsxs3(Container3, { className: "divide-y p-0", children: [
579
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-6 py-4", children: [
580
+ /* @__PURE__ */ jsx3(Heading3, { level: "h2", children: t("products.media.label") }),
581
+ /* @__PURE__ */ jsx3(
582
+ ActionMenu,
583
+ {
584
+ groups: [
585
+ {
586
+ actions: [
587
+ {
588
+ label: t("actions.edit"),
589
+ to: "media?view=edit",
590
+ icon: /* @__PURE__ */ jsx3(PencilSquare2, {})
591
+ }
592
+ ]
593
+ }
594
+ ]
595
+ }
596
+ )
597
+ ] }),
598
+ 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) => {
599
+ const isSelected = selection[i.id];
600
+ return /* @__PURE__ */ jsxs3(
601
+ "div",
602
+ {
603
+ className: "group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px] shadow-elevation-card-rest transition-fg hover:shadow-elevation-card-hover",
604
+ children: [
605
+ /* @__PURE__ */ jsx3(
606
+ "div",
607
+ {
608
+ className: clx(
609
+ "invisible absolute right-2 top-2 opacity-0 transition-fg group-hover:visible group-hover:opacity-100",
610
+ {
611
+ "visible opacity-100": isSelected
612
+ }
613
+ ),
614
+ children: /* @__PURE__ */ jsx3(
615
+ Checkbox,
616
+ {
617
+ checked: selection[i.id] || false,
618
+ onCheckedChange: () => handleCheckedChange(i.id)
619
+ }
620
+ )
621
+ }
622
+ ),
623
+ i.isThumbnail && /* @__PURE__ */ jsx3("div", { className: "absolute left-2 top-2", children: /* @__PURE__ */ jsx3(Tooltip, { content: t("fields.thumbnail"), children: /* @__PURE__ */ jsx3(ThumbnailBadge, {}) }) }),
624
+ /* @__PURE__ */ jsx3(
625
+ Link,
626
+ {
627
+ to: `media`,
628
+ state: { curr: index },
629
+ children: /* @__PURE__ */ jsx3(
630
+ "img",
631
+ {
632
+ src: i.url,
633
+ alt: product.title,
634
+ className: "size-full object-cover"
635
+ }
636
+ )
637
+ }
638
+ )
639
+ ]
640
+ },
641
+ i.id
642
+ );
643
+ }) }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", children: [
644
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center", children: [
645
+ /* @__PURE__ */ jsx3(
646
+ Text2,
647
+ {
648
+ size: "small",
649
+ leading: "compact",
650
+ weight: "plus",
651
+ className: "text-ui-fg-subtle",
652
+ children: t("products.media.emptyState.header")
653
+ }
654
+ ),
655
+ /* @__PURE__ */ jsx3(
656
+ Text2,
657
+ {
658
+ size: "small",
659
+ className: "text-ui-fg-muted",
660
+ children: t("products.media.emptyState.description")
661
+ }
662
+ )
663
+ ] }),
664
+ /* @__PURE__ */ jsx3(
665
+ Button2,
666
+ {
667
+ size: "small",
668
+ variant: "secondary",
669
+ asChild: true,
670
+ children: /* @__PURE__ */ jsx3(Link, { to: "media?view=edit", children: t("products.media.emptyState.action") })
671
+ }
672
+ )
673
+ ] }),
674
+ /* @__PURE__ */ jsx3(CommandBar, { open: !!Object.keys(selection).length, children: /* @__PURE__ */ jsxs3(CommandBar.Bar, { children: [
675
+ /* @__PURE__ */ jsx3(CommandBar.Value, { children: t("general.countSelected", {
676
+ count: Object.keys(selection).length
677
+ }) }),
678
+ /* @__PURE__ */ jsx3(CommandBar.Seperator, {}),
679
+ /* @__PURE__ */ jsx3(
680
+ CommandBar.Command,
681
+ {
682
+ action: handleDelete,
683
+ label: t("actions.delete"),
684
+ shortcut: "d"
685
+ }
686
+ )
687
+ ] }) })
688
+ ] });
689
+ };
690
+ var getMedia = (product) => {
691
+ const { images = [], thumbnail } = product;
692
+ const media = (images || []).map((image) => ({
693
+ id: image.id,
694
+ url: image.url,
695
+ isThumbnail: image.url === thumbnail
696
+ }));
697
+ if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
698
+ media.unshift({
699
+ id: "img_thumbnail",
700
+ url: thumbnail,
701
+ isThumbnail: true
702
+ });
703
+ }
704
+ return media;
705
+ };
706
+
707
+ // src/pages/products/[id]/_components/product-organization-section/product-organization-section.tsx
708
+ import { PencilSquare as PencilSquare3 } from "@medusajs/icons";
709
+ import { Badge, Container as Container4, Heading as Heading4, Tooltip as Tooltip2 } from "@medusajs/ui";
710
+ import { useTranslation as useTranslation4 } from "react-i18next";
711
+ import { Link as Link2 } from "react-router-dom";
712
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
713
+ var ProductOrganizationSection = ({
714
+ product
715
+ }) => {
716
+ const { t } = useTranslation4();
717
+ return /* @__PURE__ */ jsxs4(
718
+ Container4,
719
+ {
720
+ className: "divide-y p-0",
721
+ "data-testid": "product-organization-section",
722
+ children: [
723
+ /* @__PURE__ */ jsxs4(
724
+ "div",
725
+ {
726
+ className: "flex items-center justify-between px-6 py-4",
727
+ "data-testid": "product-organization-header",
728
+ children: [
729
+ /* @__PURE__ */ jsx4(Heading4, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
730
+ /* @__PURE__ */ jsx4(
731
+ ActionMenu,
732
+ {
733
+ groups: [
734
+ {
735
+ actions: [
736
+ {
737
+ label: t("actions.edit"),
738
+ to: "organization",
739
+ icon: /* @__PURE__ */ jsx4(PencilSquare3, {})
740
+ }
741
+ ]
742
+ }
743
+ ],
744
+ "data-testid": "product-organization-action-menu"
745
+ }
746
+ )
747
+ ]
748
+ }
749
+ ),
750
+ /* @__PURE__ */ jsx4(
751
+ SectionRow,
752
+ {
753
+ title: t("fields.tags"),
754
+ value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx4(
755
+ OrganizationTag,
756
+ {
757
+ label: tag.value,
758
+ to: `/settings/product-tags/${tag.id}`
759
+ },
760
+ tag.id
761
+ )) : void 0,
762
+ "data-testid": "product-tags-row"
763
+ }
764
+ ),
765
+ /* @__PURE__ */ jsx4(
766
+ SectionRow,
767
+ {
768
+ title: t("fields.type"),
769
+ value: product.type ? /* @__PURE__ */ jsx4(
770
+ OrganizationTag,
771
+ {
772
+ label: product.type.value,
773
+ to: `/settings/product-types/${product.type_id}`
774
+ }
775
+ ) : void 0,
776
+ "data-testid": "product-type-row"
777
+ }
778
+ ),
779
+ /* @__PURE__ */ jsx4(
780
+ SectionRow,
781
+ {
782
+ title: t("fields.brand"),
783
+ value: product.brand ? /* @__PURE__ */ jsx4(
784
+ OrganizationTag,
785
+ {
786
+ label: product.brand.name,
787
+ to: `/settings/product-brands/${product.brand.id}`
788
+ }
789
+ ) : void 0,
790
+ "data-testid": "product-brand-row"
791
+ }
792
+ ),
793
+ /* @__PURE__ */ jsx4(
794
+ SectionRow,
795
+ {
796
+ title: t("fields.collection"),
797
+ value: product.collection ? /* @__PURE__ */ jsx4(
798
+ OrganizationTag,
799
+ {
800
+ label: product.collection.title,
801
+ to: `/collections/${product.collection.id}`
802
+ }
803
+ ) : void 0,
804
+ "data-testid": "product-collection-row"
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsx4(
808
+ SectionRow,
809
+ {
810
+ title: t("fields.categories"),
811
+ value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx4(
812
+ OrganizationTag,
813
+ {
814
+ label: pcat.name,
815
+ to: `/categories/${pcat.id}`
816
+ },
817
+ pcat.id
818
+ )) : void 0,
819
+ "data-testid": "product-categories-row"
820
+ }
821
+ )
822
+ ]
823
+ }
824
+ );
825
+ };
826
+ var OrganizationTag = ({ label, to }) => {
827
+ return /* @__PURE__ */ jsx4(Tooltip2, { content: label, children: /* @__PURE__ */ jsx4(Badge, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx4(
828
+ Link2,
829
+ {
830
+ to,
831
+ "data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
832
+ children: label
833
+ }
834
+ ) }) });
835
+ };
836
+
837
+ // src/pages/products/[id]/_components/product-variant-section/product-variant-section.tsx
838
+ import { useCallback, useMemo as useMemo2 } from "react";
839
+ import { PencilSquare as PencilSquare4, Trash as Trash2 } from "@medusajs/icons";
840
+ import {
841
+ Badge as Badge2,
842
+ Container as Container5,
843
+ createDataTableColumnHelper,
844
+ toast as toast2,
845
+ Tooltip as Tooltip3,
846
+ usePrompt as usePrompt4
847
+ } from "@medusajs/ui";
848
+ import { keepPreviousData } from "@tanstack/react-query";
849
+ import { useTranslation as useTranslation5 } from "react-i18next";
850
+ import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
851
+ import { jsx as jsx5 } from "react/jsx-runtime";
852
+ var PAGE_SIZE = 10;
853
+ var PREFIX = "pv";
854
+ var ProductVariantSection = ({
855
+ product
856
+ }) => {
857
+ const { t } = useTranslation5();
858
+ const { q, order, offset, created_at, updated_at } = useQueryParams(
859
+ ["q", "order", "offset", "created_at", "updated_at"],
860
+ PREFIX
861
+ );
862
+ const columns = useColumns(product);
863
+ const filters = useFilters();
864
+ const { variants, count, isPending, isError, error } = useProductVariants(
865
+ product.id,
866
+ {
867
+ q,
868
+ order: order ? order : "variant_rank",
869
+ offset: offset ? parseInt(offset) : void 0,
870
+ limit: PAGE_SIZE,
871
+ created_at: created_at ? JSON.parse(created_at) : void 0,
872
+ updated_at: updated_at ? JSON.parse(updated_at) : void 0,
873
+ fields: "title,created_at,updated_at,*attribute_values,*attribute_values.attribute"
874
+ },
875
+ {
876
+ placeholderData: keepPreviousData
877
+ }
878
+ );
879
+ if (isError) {
880
+ throw error;
881
+ }
882
+ return /* @__PURE__ */ jsx5(Container5, { className: "divide-y p-0", "data-testid": "product-variant-section", children: /* @__PURE__ */ jsx5("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx5(
883
+ DataTable,
884
+ {
885
+ data: variants,
886
+ columns,
887
+ filters,
888
+ rowCount: count,
889
+ getRowId: (row) => row.id,
890
+ rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
891
+ pageSize: PAGE_SIZE,
892
+ isLoading: isPending,
893
+ heading: t("products.variants.header"),
894
+ emptyState: {
895
+ empty: {
896
+ heading: t("products.variants.empty.heading"),
897
+ description: t("products.variants.empty.description")
898
+ },
899
+ filtered: {
900
+ heading: t("products.variants.filtered.heading"),
901
+ description: t("products.variants.filtered.description")
902
+ }
903
+ },
904
+ action: {
905
+ label: t("actions.create"),
906
+ to: `variants/create`
907
+ },
908
+ prefix: PREFIX
909
+ }
910
+ ) }) });
911
+ };
912
+ var columnHelper = createDataTableColumnHelper();
913
+ var useColumns = (product) => {
914
+ const { t } = useTranslation5();
915
+ const navigate = useNavigate2();
916
+ const { mutateAsync } = useDeleteVariantLazy(product.id);
917
+ const prompt = usePrompt4();
918
+ const [searchParams] = useSearchParams();
919
+ const tableSearchParams = useMemo2(() => {
920
+ const filtered = new URLSearchParams();
921
+ for (const [key, value] of searchParams.entries()) {
922
+ if (key.startsWith(`${PREFIX}_`)) {
923
+ filtered.append(key, value);
924
+ }
925
+ }
926
+ return filtered;
927
+ }, [searchParams]);
928
+ const dateColumns = useDataTableDateColumns();
929
+ const handleDelete = useCallback(
930
+ async (id, title) => {
931
+ const res = await prompt({
932
+ title: t("general.areYouSure"),
933
+ description: t("products.deleteVariantWarning", {
934
+ title
935
+ }),
936
+ confirmText: t("actions.delete"),
937
+ cancelText: t("actions.cancel")
938
+ });
939
+ if (!res) {
940
+ return;
941
+ }
942
+ await mutateAsync(
943
+ { variantId: id },
944
+ {
945
+ onError: (error) => {
946
+ toast2.error(error.message);
947
+ }
948
+ }
949
+ );
950
+ },
951
+ [mutateAsync, prompt, t]
952
+ );
953
+ const optionColumns = useMemo2(() => {
954
+ if (!product?.options) {
955
+ return [];
956
+ }
957
+ return product.options.map((option) => {
958
+ return columnHelper.display({
959
+ id: option.id,
960
+ header: option.title,
961
+ cell: ({ row }) => {
962
+ const variantOpt = row.original.options?.find(
963
+ (opt) => opt.option_id === option.id
964
+ );
965
+ if (!variantOpt) {
966
+ return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
967
+ }
968
+ return /* @__PURE__ */ jsx5(
969
+ "div",
970
+ {
971
+ className: "flex items-center",
972
+ "data-testid": `product-variant-option-${option.id}-${row.original.id}`,
973
+ children: /* @__PURE__ */ jsx5(Tooltip3, { content: variantOpt.value, children: /* @__PURE__ */ jsx5(
974
+ Badge2,
975
+ {
976
+ size: "2xsmall",
977
+ title: variantOpt.value,
978
+ className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
979
+ "data-testid": `product-variant-option-badge-${option.id}-${row.original.id}-${variantOpt.value}`,
980
+ children: variantOpt.value
981
+ }
982
+ ) })
983
+ }
984
+ );
985
+ }
986
+ });
987
+ });
988
+ }, [product]);
989
+ const attributeColumns = useMemo2(() => {
990
+ const variantAttributes = product?.variant_attributes?.filter((attr) => attr.is_variant_axis);
991
+ if (!variantAttributes?.length) {
992
+ return [];
993
+ }
994
+ return variantAttributes.map((attribute) => {
995
+ return columnHelper.display({
996
+ id: `attribute-${attribute.id}`,
997
+ header: attribute.name,
998
+ cell: ({ row }) => {
999
+ const variant = row.original;
1000
+ const matches = variant.attribute_values?.filter(
1001
+ (v) => v.attribute?.id === attribute.id
1002
+ ) ?? [];
1003
+ if (!matches.length) {
1004
+ return /* @__PURE__ */ jsx5("span", { className: "text-ui-fg-muted", children: "-" });
1005
+ }
1006
+ return /* @__PURE__ */ jsx5(
1007
+ "div",
1008
+ {
1009
+ className: "flex flex-wrap items-center gap-1",
1010
+ "data-testid": `product-variant-attribute-${attribute.id}-${row.original.id}`,
1011
+ children: matches.map((value) => /* @__PURE__ */ jsx5(Tooltip3, { content: value.name, children: /* @__PURE__ */ jsx5(
1012
+ Badge2,
1013
+ {
1014
+ size: "2xsmall",
1015
+ title: value.name,
1016
+ className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
1017
+ "data-testid": `product-variant-attribute-badge-${attribute.id}-${row.original.id}-${value.name}`,
1018
+ children: value.name
1019
+ }
1020
+ ) }, value.id))
1021
+ }
1022
+ );
1023
+ }
1024
+ });
1025
+ });
1026
+ }, [product]);
1027
+ const getActions = useCallback(
1028
+ (_ctx) => {
1029
+ const variant = _ctx.row.original;
1030
+ const mainActions = [
1031
+ {
1032
+ icon: /* @__PURE__ */ jsx5(PencilSquare4, {}),
1033
+ label: t("actions.edit"),
1034
+ onClick: (row) => {
1035
+ navigate(
1036
+ `edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
1037
+ {
1038
+ state: {
1039
+ restore_params: tableSearchParams.toString()
1040
+ }
1041
+ }
1042
+ );
1043
+ }
1044
+ }
1045
+ ];
1046
+ const secondaryActions = [
1047
+ {
1048
+ icon: /* @__PURE__ */ jsx5(Trash2, {}),
1049
+ label: t("actions.delete"),
1050
+ onClick: () => handleDelete(variant.id, variant.title)
1051
+ }
1052
+ ];
1053
+ return [mainActions, secondaryActions];
1054
+ },
1055
+ [handleDelete, navigate, t, tableSearchParams]
1056
+ );
1057
+ return useMemo2(() => {
1058
+ return [
1059
+ columnHelper.accessor("title", {
1060
+ header: t("fields.title"),
1061
+ enableSorting: true,
1062
+ sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
1063
+ sortDescLabel: t("filters.sorting.alphabeticallyDesc")
1064
+ }),
1065
+ ...optionColumns,
1066
+ ...attributeColumns,
1067
+ ...dateColumns,
1068
+ columnHelper.action({
1069
+ actions: getActions
1070
+ })
1071
+ ];
1072
+ }, [t, optionColumns, attributeColumns, dateColumns, getActions]);
1073
+ };
1074
+ var useFilters = () => {
1075
+ const dateFilters = useDataTableDateFilters();
1076
+ return useMemo2(() => {
1077
+ return [...dateFilters];
1078
+ }, [dateFilters]);
1079
+ };
1080
+
1081
+ // src/pages/products/[id]/_components/product-attribute-section/product-attribute-section.tsx
1082
+ import {
1083
+ ListBullet,
1084
+ Plus,
1085
+ Trash as Trash3,
1086
+ Swatch,
1087
+ DropCap,
1088
+ InformationCircleSolid
1089
+ } from "@medusajs/icons";
1090
+ import {
1091
+ Badge as Badge3,
1092
+ Container as Container6,
1093
+ Heading as Heading5,
1094
+ Text as Text3,
1095
+ toast as toast3,
1096
+ Tooltip as Tooltip4,
1097
+ usePrompt as usePrompt5
1098
+ } from "@medusajs/ui";
1099
+ import { useTranslation as useTranslation6 } from "react-i18next";
1100
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1101
+ var AttributeActions = ({
1102
+ productId,
1103
+ attribute
1104
+ }) => {
1105
+ const { t } = useTranslation6();
1106
+ const prompt = usePrompt5();
1107
+ const { mutateAsync } = useRemoveProductAttribute(productId, attribute.id);
1108
+ const handleDelete = async () => {
1109
+ const res = await prompt({
1110
+ title: t("general.areYouSure"),
1111
+ description: t("products.deleteAttributeWarning", {
1112
+ title: attribute.name
1113
+ }),
1114
+ confirmText: t("actions.delete"),
1115
+ cancelText: t("actions.cancel")
1116
+ });
1117
+ if (!res) {
1118
+ return;
1119
+ }
1120
+ await mutateAsync(void 0, {
1121
+ onError: (error) => {
1122
+ toast3.error(error.message);
1123
+ }
1124
+ });
1125
+ };
1126
+ return /* @__PURE__ */ jsx6(
1127
+ ActionMenu,
1128
+ {
1129
+ groups: [
1130
+ {
1131
+ actions: [
1132
+ {
1133
+ label: t("actions.delete"),
1134
+ onClick: handleDelete,
1135
+ icon: /* @__PURE__ */ jsx6(Trash3, {})
1136
+ }
1137
+ ]
1138
+ }
1139
+ ]
1140
+ }
1141
+ );
1142
+ };
1143
+ var AttributeGroup = ({
1144
+ icon,
1145
+ title,
1146
+ description,
1147
+ attributes,
1148
+ productId
1149
+ }) => {
1150
+ const { t } = useTranslation6();
1151
+ if (!attributes.length) {
1152
+ return null;
1153
+ }
1154
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-y-4 px-3 py-4", children: [
1155
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-x-3 px-3", children: [
1156
+ /* @__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 }),
1157
+ /* @__PURE__ */ jsxs5("div", { children: [
1158
+ /* @__PURE__ */ jsx6(Text3, { size: "small", weight: "plus", leading: "compact", children: title }),
1159
+ /* @__PURE__ */ jsx6(Text3, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: description })
1160
+ ] })
1161
+ ] }),
1162
+ /* @__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) => {
1163
+ const values = attr.values?.map((v) => v.name) ?? [];
1164
+ return /* @__PURE__ */ jsx6(
1165
+ "div",
1166
+ {
1167
+ className: index < attributes.length - 1 ? "border-b border-ui-border-base" : "",
1168
+ children: /* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-[1fr_1fr_28px] items-center gap-4 bg-ui-bg-component px-4 py-3", children: [
1169
+ /* @__PURE__ */ jsxs5("div", { className: "text-ui-fg-subtle flex items-center gap-x-2", children: [
1170
+ /* @__PURE__ */ jsx6(Text3, { size: "small", weight: "plus", leading: "compact", children: attr.name }),
1171
+ attr.description && /* @__PURE__ */ jsx6(Tooltip4, { content: attr.description, children: /* @__PURE__ */ jsx6("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx6(InformationCircleSolid, {}) }) }),
1172
+ attr.is_required && /* @__PURE__ */ jsx6(
1173
+ Tooltip4,
1174
+ {
1175
+ content: t("products.attributeRequiredByMarketplace"),
1176
+ children: /* @__PURE__ */ jsx6("span", { className: "text-ui-fg-muted flex items-center", children: /* @__PURE__ */ jsx6(InformationCircleSolid, {}) })
1177
+ }
1178
+ )
1179
+ ] }),
1180
+ /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-1", children: ["single_select", "multi_select"].includes(attr.type) ? values.map((val) => /* @__PURE__ */ jsx6(
1181
+ Badge3,
1182
+ {
1183
+ size: "2xsmall",
1184
+ className: "flex min-w-[20px] items-center justify-center",
1185
+ children: val
1186
+ },
1187
+ val
1188
+ )) : /* @__PURE__ */ jsx6(
1189
+ Text3,
1190
+ {
1191
+ size: "small",
1192
+ leading: "compact",
1193
+ className: "text-ui-fg-subtle",
1194
+ children: values.join(", ") || "-"
1195
+ }
1196
+ ) }),
1197
+ /* @__PURE__ */ jsx6(AttributeActions, { productId, attribute: attr })
1198
+ ] })
1199
+ },
1200
+ attr.id
1201
+ );
1202
+ }) }) })
1203
+ ] });
1204
+ };
1205
+ var ProductAttributeSection = ({
1206
+ product
1207
+ }) => {
1208
+ const { t } = useTranslation6();
1209
+ const allAttributes = product.attributes ?? [];
1210
+ const variantAttributes = allAttributes.filter((a) => a.is_variant_axis);
1211
+ const infoAttributes = allAttributes.filter((a) => !a.is_variant_axis);
1212
+ const isEmpty = !variantAttributes.length && !infoAttributes.length;
1213
+ return /* @__PURE__ */ jsxs5(Container6, { className: "p-0", children: [
1214
+ /* @__PURE__ */ jsxs5(
1215
+ "div",
1216
+ {
1217
+ className: `flex items-center justify-between px-6 py-4${isEmpty ? "" : " border-b border-ui-border-base"}`,
1218
+ children: [
1219
+ /* @__PURE__ */ jsx6(Heading5, { level: "h2", children: t("products.attributes") }),
1220
+ /* @__PURE__ */ jsx6(
1221
+ ActionMenu,
1222
+ {
1223
+ groups: [
1224
+ {
1225
+ actions: [
1226
+ {
1227
+ label: t("products.create.attributes.addExisting"),
1228
+ to: "attributes/add",
1229
+ icon: /* @__PURE__ */ jsx6(ListBullet, {})
1230
+ },
1231
+ {
1232
+ label: t("products.create.attributes.createNew"),
1233
+ to: "attributes/create",
1234
+ icon: /* @__PURE__ */ jsx6(Plus, {})
1235
+ }
1236
+ ]
1237
+ }
1238
+ ]
1239
+ }
1240
+ )
1241
+ ]
1242
+ }
1243
+ ),
1244
+ variantAttributes.length > 0 && /* @__PURE__ */ jsx6(
1245
+ AttributeGroup,
1246
+ {
1247
+ icon: /* @__PURE__ */ jsx6(Swatch, {}),
1248
+ title: t("products.create.tabs.variants"),
1249
+ description: t("products.attributeVariantsDescription"),
1250
+ attributes: variantAttributes,
1251
+ productId: product.id
1252
+ }
1253
+ ),
1254
+ variantAttributes.length > 0 && infoAttributes.length > 0 && /* @__PURE__ */ jsx6("div", { className: "border-t border-dashed border-ui-border-base" }),
1255
+ infoAttributes.length > 0 && /* @__PURE__ */ jsx6(
1256
+ AttributeGroup,
1257
+ {
1258
+ icon: /* @__PURE__ */ jsx6(DropCap, {}),
1259
+ title: t("products.attributeProductInformation"),
1260
+ description: t("products.attributeProductInformationDescription"),
1261
+ attributes: infoAttributes,
1262
+ productId: product.id
1263
+ }
1264
+ )
1265
+ ] });
1266
+ };
1267
+
1268
+ // src/pages/products/[id]/_components/product-shipping-profile-section/product-shipping-profile-section.tsx
1269
+ import { PencilSquare as PencilSquare5, ShoppingBag } from "@medusajs/icons";
1270
+ import { Container as Container7, Heading as Heading6 } from "@medusajs/ui";
1271
+ import { useTranslation as useTranslation7 } from "react-i18next";
1272
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1273
+ var ProductShippingProfileSection = ({
1274
+ product
1275
+ }) => {
1276
+ const { t } = useTranslation7();
1277
+ const shippingProfile = product.shipping_profile;
1278
+ return /* @__PURE__ */ jsxs6(Container7, { className: "p-0", children: [
1279
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", children: [
1280
+ /* @__PURE__ */ jsx7(Heading6, { level: "h2", children: t("products.shippingProfile.header") }),
1281
+ /* @__PURE__ */ jsx7(
1282
+ ActionMenu,
1283
+ {
1284
+ groups: [
1285
+ {
1286
+ actions: [
1287
+ {
1288
+ label: t("actions.edit"),
1289
+ to: "shipping-profile",
1290
+ icon: /* @__PURE__ */ jsx7(PencilSquare5, {})
1291
+ }
1292
+ ]
1293
+ }
1294
+ ]
1295
+ }
1296
+ )
1297
+ ] }),
1298
+ shippingProfile && /* @__PURE__ */ jsx7(
1299
+ SidebarLink,
1300
+ {
1301
+ to: `/settings/locations/shipping-profiles/${shippingProfile.id}`,
1302
+ labelKey: shippingProfile.name,
1303
+ descriptionKey: shippingProfile.type,
1304
+ icon: /* @__PURE__ */ jsx7(ShoppingBag, {})
1305
+ }
1306
+ )
1307
+ ] });
1308
+ };
1309
+
1310
+ // src/pages/products/[id]/_components/product-sales-channel-section/product-sales-channel-section.tsx
1311
+ import { Channels, PencilSquare as PencilSquare6 } from "@medusajs/icons";
1312
+ import { Container as Container8, Heading as Heading7, Text as Text4, Tooltip as Tooltip5 } from "@medusajs/ui";
1313
+ import { Trans, useTranslation as useTranslation8 } from "react-i18next";
1314
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1315
+ var ProductSalesChannelSection = ({
1316
+ product
1317
+ }) => {
1318
+ const { count } = useSalesChannels();
1319
+ const { t } = useTranslation8();
1320
+ const availableInSalesChannels = product.sales_channels?.map((sc) => ({
1321
+ id: sc.id,
1322
+ name: sc.name
1323
+ })) ?? [];
1324
+ const firstChannels = availableInSalesChannels.slice(0, 3);
1325
+ const restChannels = availableInSalesChannels.slice(3);
1326
+ return /* @__PURE__ */ jsxs7(Container8, { className: "flex flex-col gap-y-4 px-6 py-4", children: [
1327
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
1328
+ /* @__PURE__ */ jsx8(Heading7, { level: "h2", children: t("fields.sales_channels") }),
1329
+ /* @__PURE__ */ jsx8(
1330
+ ActionMenu,
1331
+ {
1332
+ groups: [
1333
+ {
1334
+ actions: [
1335
+ {
1336
+ label: t("actions.edit"),
1337
+ to: "sales-channels",
1338
+ icon: /* @__PURE__ */ jsx8(PencilSquare6, {})
1339
+ }
1340
+ ]
1341
+ }
1342
+ ]
1343
+ }
1344
+ )
1345
+ ] }),
1346
+ /* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-[28px_1fr] items-center gap-x-3", children: [
1347
+ /* @__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" }) }) }),
1348
+ availableInSalesChannels.length > 0 ? /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-x-1", children: [
1349
+ /* @__PURE__ */ jsx8(Text4, { size: "small", leading: "compact", children: firstChannels.map((sc) => sc.name).join(", ") }),
1350
+ restChannels.length > 0 && /* @__PURE__ */ jsx8(
1351
+ Tooltip5,
1352
+ {
1353
+ content: /* @__PURE__ */ jsx8("ul", { children: restChannels.map((sc) => /* @__PURE__ */ jsx8("li", { children: sc.name }, sc.id)) }),
1354
+ children: /* @__PURE__ */ jsx8(
1355
+ Text4,
1356
+ {
1357
+ size: "small",
1358
+ leading: "compact",
1359
+ className: "text-ui-fg-subtle",
1360
+ children: `+${restChannels.length}`
1361
+ }
1362
+ )
1363
+ }
1364
+ )
1365
+ ] }) : /* @__PURE__ */ jsx8(Text4, { size: "small", leading: "compact", className: "text-ui-fg-subtle", children: t("products.noSalesChannels") })
1366
+ ] }),
1367
+ /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(Text4, { className: "text-ui-fg-subtle", size: "small", leading: "compact", children: /* @__PURE__ */ jsx8(
1368
+ Trans,
1369
+ {
1370
+ i18nKey: "sales_channels.availableIn",
1371
+ values: {
1372
+ x: availableInSalesChannels.length,
1373
+ y: count ?? 0
1374
+ },
1375
+ components: [
1376
+ /* @__PURE__ */ jsx8(
1377
+ "span",
1378
+ {
1379
+ className: "text-ui-fg-base txt-compact-medium-plus"
1380
+ },
1381
+ "x"
1382
+ ),
1383
+ /* @__PURE__ */ jsx8(
1384
+ "span",
1385
+ {
1386
+ className: "text-ui-fg-base txt-compact-medium-plus"
1387
+ },
1388
+ "y"
1389
+ )
1390
+ ]
1391
+ }
1392
+ ) }) })
1393
+ ] });
1394
+ };
1395
+
1396
+ // src/pages/products/[id]/product-detail-page.tsx
1397
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1398
+ var Root = ({ children }) => {
1399
+ const initialData = useLoaderData();
1400
+ const { id } = useParams();
1401
+ const { product, isLoading, isError, error } = useProduct(
1402
+ id,
1403
+ PRODUCT_DETAIL_QUERY,
1404
+ {
1405
+ initialData
1406
+ }
1407
+ );
1408
+ if (isLoading || !product) {
1409
+ return /* @__PURE__ */ jsx9(TwoColumnPageSkeleton, { mainSections: 4, sidebarSections: 3 });
1410
+ }
1411
+ if (isError) {
1412
+ throw error;
1413
+ }
1414
+ return Children.count(children) > 0 ? /* @__PURE__ */ jsx9(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children }) : /* @__PURE__ */ jsxs8(TwoColumnPage, { data: product, "data-testid": "product-detail-page", children: [
1415
+ /* @__PURE__ */ jsxs8(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
1416
+ /* @__PURE__ */ jsx9(ProductActiveEditSection, { productId: product.id }),
1417
+ /* @__PURE__ */ jsx9(ProductGeneralSection, { product }),
1418
+ /* @__PURE__ */ jsx9(ProductMediaSection, { product }),
1419
+ /* @__PURE__ */ jsx9(ProductVariantSection, { product })
1420
+ ] }),
1421
+ /* @__PURE__ */ jsxs8(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
1422
+ /* @__PURE__ */ jsx9(ProductOrganizationSection, { product }),
1423
+ /* @__PURE__ */ jsx9(ProductAttributeSection, { product })
1424
+ ] })
1425
+ ] });
1426
+ };
1427
+ var ProductDetailPage = Object.assign(Root, {
1428
+ Main: TwoColumnPage.Main,
1429
+ Sidebar: TwoColumnPage.Sidebar,
1430
+ MainActiveEditSection: ProductActiveEditSection,
1431
+ MainGeneralSection: ProductGeneralSection,
1432
+ MainMediaSection: ProductMediaSection,
1433
+ MainVariantSection: ProductVariantSection,
1434
+ MainAttributeSection: ProductAttributeSection,
1435
+ SidebarShippingProfileSection: ProductShippingProfileSection,
1436
+ SidebarOrganizationSection: ProductOrganizationSection,
1437
+ SidebarSalesChannelSection: ProductSalesChannelSection
1438
+ });
1439
+ export {
1440
+ ProductDetailPage,
1441
+ loader
1442
+ };