@mercurjs/admin 2.0.0-canary.24
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.
- package/dist/add-campaign-promotions-JDC36EOE.js +265 -0
- package/dist/adjust-inventory-2YLC4O4I.js +262 -0
- package/dist/api-key-management-create-KERROZ6Z.js +282 -0
- package/dist/api-key-management-detail-PXY2ZH4V.js +481 -0
- package/dist/api-key-management-edit-7IPPTW37.js +106 -0
- package/dist/api-key-management-list-QQHOCVV4.js +350 -0
- package/dist/api-key-management-sales-channels-AO6SRCAW.js +201 -0
- package/dist/campaign-budget-edit-C5PCVES3.js +147 -0
- package/dist/campaign-configuration-ONC2CL7Q.js +154 -0
- package/dist/campaign-create-J2PN77A6.js +29 -0
- package/dist/campaign-detail-2XJ7PXOQ.js +666 -0
- package/dist/campaign-edit-MU4TVOEC.js +206 -0
- package/dist/campaign-list-BWYHTJL2.js +187 -0
- package/dist/categories-metadata-UC3N6YSC.js +83 -0
- package/dist/category-create-DRJZI3EM.js +427 -0
- package/dist/category-detail-DEGYVUXB.js +544 -0
- package/dist/category-edit-PTYOK7VV.js +220 -0
- package/dist/category-list-T4GPTLOA.js +286 -0
- package/dist/category-organize-MLBY54BT.js +110 -0
- package/dist/category-products-W7U2VZTZ.js +281 -0
- package/dist/chunk-25LYVP3C.js +37 -0
- package/dist/chunk-26OOAKQ6.js +18 -0
- package/dist/chunk-2I3BDP2Z.js +61 -0
- package/dist/chunk-2KCF3ZIB.js +32 -0
- package/dist/chunk-2MKZ4HD4.js +175 -0
- package/dist/chunk-2PZGY332.js +88 -0
- package/dist/chunk-2QKPRGNK.js +107 -0
- package/dist/chunk-2Y3WMGN6.js +39 -0
- package/dist/chunk-2ZFELO2L.js +13 -0
- package/dist/chunk-33XUAKRP.js +6 -0
- package/dist/chunk-362QMJZM.js +77 -0
- package/dist/chunk-3CKTAFTR.js +143 -0
- package/dist/chunk-3EF54XFY.js +64 -0
- package/dist/chunk-3KOTDGC2.js +18 -0
- package/dist/chunk-3LDJURK5.js +296 -0
- package/dist/chunk-3QSRE5LS.js +161 -0
- package/dist/chunk-3XPXUIK3.js +34 -0
- package/dist/chunk-4F5GP7J7.js +45 -0
- package/dist/chunk-4GPAS5GW.js +36 -0
- package/dist/chunk-54EPH67T.js +34 -0
- package/dist/chunk-54RTJBYO.js +153 -0
- package/dist/chunk-54TMLQH3.js +9 -0
- package/dist/chunk-5LZ2G4ZX.js +422 -0
- package/dist/chunk-5S6J5PG5.js +182 -0
- package/dist/chunk-6IJMSVC6.js +16 -0
- package/dist/chunk-6KI3GDYH.js +46 -0
- package/dist/chunk-7AV5EJJ5.js +29 -0
- package/dist/chunk-7RPRNVBS.js +45 -0
- package/dist/chunk-7SVLKK6Q.js +31 -0
- package/dist/chunk-AW77UWCZ.js +363 -0
- package/dist/chunk-AWZFIP25.js +117 -0
- package/dist/chunk-AYVH6Q5O.js +31 -0
- package/dist/chunk-BDGZ4EQO.js +86 -0
- package/dist/chunk-BMNW3AEU.js +373 -0
- package/dist/chunk-BRUOBAPY.js +234 -0
- package/dist/chunk-BYZIWSBB.js +185 -0
- package/dist/chunk-C6SUTRP2.js +13 -0
- package/dist/chunk-CBRSGM3X.js +342 -0
- package/dist/chunk-CI5Z6FGV.js +87 -0
- package/dist/chunk-CMHI2RPL.js +20 -0
- package/dist/chunk-CP5IL4P6.js +98 -0
- package/dist/chunk-D3KDXELJ.js +110 -0
- package/dist/chunk-D6IERBVW.js +43 -0
- package/dist/chunk-DB6ANJBO.js +35 -0
- package/dist/chunk-DLKKSPFE.js +50 -0
- package/dist/chunk-DV73MHTN.js +457 -0
- package/dist/chunk-DXZOR4AG.js +69 -0
- package/dist/chunk-DY3XQPHC.js +31 -0
- package/dist/chunk-EOZUAYQL.js +6 -0
- package/dist/chunk-ERTSYQAI.js +121 -0
- package/dist/chunk-EZIB4NST.js +94 -0
- package/dist/chunk-FGZCSG7T.js +232 -0
- package/dist/chunk-FI474ADU.js +0 -0
- package/dist/chunk-FLCYR7E5.js +467 -0
- package/dist/chunk-FMFVTERD.js +0 -0
- package/dist/chunk-FODCCP6C.js +76 -0
- package/dist/chunk-FQERBIVS.js +0 -0
- package/dist/chunk-FWPGOIFA.js +22 -0
- package/dist/chunk-G5OVX555.js +26 -0
- package/dist/chunk-GUIDZSDY.js +41 -0
- package/dist/chunk-H22XDSXD.js +47 -0
- package/dist/chunk-HC25LNX7.js +45 -0
- package/dist/chunk-HINXQTCW.js +97 -0
- package/dist/chunk-HYUGYB23.js +161 -0
- package/dist/chunk-I43SCBL3.js +106 -0
- package/dist/chunk-IGTRIAUC.js +84 -0
- package/dist/chunk-INNFZYX2.js +183 -0
- package/dist/chunk-IQPN4PZJ.js +749 -0
- package/dist/chunk-IZ5RG5XI.js +72 -0
- package/dist/chunk-JDGE23BZ.js +332 -0
- package/dist/chunk-JHIMVLB2.js +42 -0
- package/dist/chunk-JISYRXUS.js +389 -0
- package/dist/chunk-JJVGCTKT.js +243 -0
- package/dist/chunk-JQV7CXEC.js +37 -0
- package/dist/chunk-JRTZWK77.js +1764 -0
- package/dist/chunk-KAZ5BYTQ.js +132 -0
- package/dist/chunk-KBYZLKI4.js +1093 -0
- package/dist/chunk-KTKL7M34.js +90 -0
- package/dist/chunk-KUWNYCGL.js +4113 -0
- package/dist/chunk-KW56S7WF.js +67 -0
- package/dist/chunk-LAVHRER2.js +17 -0
- package/dist/chunk-LCZXAT4Q.js +58 -0
- package/dist/chunk-LFKTHNWI.js +83 -0
- package/dist/chunk-LGJWR5LX.js +164 -0
- package/dist/chunk-LLWK3OR6.js +169 -0
- package/dist/chunk-LQSLDDPT.js +67 -0
- package/dist/chunk-LR4ACD6E.js +86676 -0
- package/dist/chunk-LTBX54CI.js +11 -0
- package/dist/chunk-LXP7K6HL.js +817 -0
- package/dist/chunk-LXSBG6LK.js +18 -0
- package/dist/chunk-LZALOVO3.js +372 -0
- package/dist/chunk-M6SOYQJ6.js +39 -0
- package/dist/chunk-MAEP2UCK.js +110 -0
- package/dist/chunk-MG4GKUJW.js +31 -0
- package/dist/chunk-MWOKFNRO.js +446 -0
- package/dist/chunk-N2TQXB44.js +1280 -0
- package/dist/chunk-N5IUYCUZ.js +31 -0
- package/dist/chunk-NBMM2TZK.js +33 -0
- package/dist/chunk-NCMUZ6BQ.js +0 -0
- package/dist/chunk-NCYTM57J.js +160 -0
- package/dist/chunk-NIRWGTM3.js +1104 -0
- package/dist/chunk-NS5CHWOH.js +80 -0
- package/dist/chunk-NWQRHWE5.js +9461 -0
- package/dist/chunk-NXDFDEKP.js +0 -0
- package/dist/chunk-NZJGUN67.js +266 -0
- package/dist/chunk-NZN7PFPB.js +169 -0
- package/dist/chunk-O5HZRJPB.js +55 -0
- package/dist/chunk-O5VKW5FL.js +41 -0
- package/dist/chunk-O67KME6D.js +110 -0
- package/dist/chunk-ODBDAABQ.js +88 -0
- package/dist/chunk-OGYWOPHZ.js +96 -0
- package/dist/chunk-ORW4HNX5.js +357 -0
- package/dist/chunk-P3IZB24Y.js +109 -0
- package/dist/chunk-PHOCVOZ5.js +9 -0
- package/dist/chunk-PVZBDWLK.js +41 -0
- package/dist/chunk-PX675AEP.js +129 -0
- package/dist/chunk-PXYDR7WQ.js +48 -0
- package/dist/chunk-QDPLZDMX.js +17 -0
- package/dist/chunk-QG6PLWNH.js +106 -0
- package/dist/chunk-QSGR43JM.js +30 -0
- package/dist/chunk-RK5N3XIX.js +56 -0
- package/dist/chunk-RLMLYJDI.js +38 -0
- package/dist/chunk-RMXYSYK4.js +50 -0
- package/dist/chunk-RPIJY6TT.js +637 -0
- package/dist/chunk-RSBZREKG.js +144 -0
- package/dist/chunk-RXM4B6HR.js +8 -0
- package/dist/chunk-S2WEYEQR.js +14 -0
- package/dist/chunk-S4SVK5DE.js +39 -0
- package/dist/chunk-S6LPCNXQ.js +29 -0
- package/dist/chunk-SMQT3ZNO.js +8 -0
- package/dist/chunk-T435NFHC.js +490 -0
- package/dist/chunk-THHRRYRS.js +16 -0
- package/dist/chunk-TKGWSUEI.js +0 -0
- package/dist/chunk-TLE6YHGH.js +26 -0
- package/dist/chunk-TN4TIT7O.js +116 -0
- package/dist/chunk-TUJIAA5O.js +101 -0
- package/dist/chunk-U2EI2ZLM.js +32 -0
- package/dist/chunk-U2L77ZDR.js +17 -0
- package/dist/chunk-U2UCL2VG.js +369 -0
- package/dist/chunk-U2ZFCAPX.js +34 -0
- package/dist/chunk-U5MJIHLY.js +87 -0
- package/dist/chunk-U62GYN4A.js +227 -0
- package/dist/chunk-UM7ZR3VU.js +14 -0
- package/dist/chunk-UQITHKTH.js +342 -0
- package/dist/chunk-UZJ2NQSN.js +257 -0
- package/dist/chunk-UZWFZMOX.js +40 -0
- package/dist/chunk-V74Y5NIV.js +49 -0
- package/dist/chunk-VBMMWVB5.js +49 -0
- package/dist/chunk-VKOE5J66.js +31 -0
- package/dist/chunk-VOHEQ7B5.js +31 -0
- package/dist/chunk-VVTSF42Z.js +52 -0
- package/dist/chunk-VW56KWO2.js +9 -0
- package/dist/chunk-VWGKHDZ6.js +528 -0
- package/dist/chunk-W6Y3PPU5.js +73 -0
- package/dist/chunk-WCEMRNW4.js +6 -0
- package/dist/chunk-WDZFLCSQ.js +77 -0
- package/dist/chunk-WIYFXWRI.js +30 -0
- package/dist/chunk-WMA3WTCM.js +117 -0
- package/dist/chunk-WWANSDFM.js +175 -0
- package/dist/chunk-XBMLI2YI.js +85 -0
- package/dist/chunk-XBVIP2BA.js +609 -0
- package/dist/chunk-XCMR2HTV.js +102 -0
- package/dist/chunk-XFR5JLNF.js +44 -0
- package/dist/chunk-XL52SYWY.js +23 -0
- package/dist/chunk-XQNVC4Q7.js +212 -0
- package/dist/chunk-XSX255FK.js +12 -0
- package/dist/chunk-Y2M536WR.js +67 -0
- package/dist/chunk-Y456KVIN.js +116 -0
- package/dist/chunk-Y7QKP6QU.js +35 -0
- package/dist/chunk-YBZWO4ZV.js +57 -0
- package/dist/chunk-YGQUBTKR.js +81 -0
- package/dist/chunk-YGSM5PVN.js +170 -0
- package/dist/chunk-YVCBMOJG.js +50 -0
- package/dist/chunk-YWWUOGJA.js +62 -0
- package/dist/chunk-YXFG3M2D.js +792 -0
- package/dist/chunk-ZAUMHCIL.js +42 -0
- package/dist/chunk-ZDJWCSZ4.js +85 -0
- package/dist/chunk-ZQZHFMD7.js +19 -0
- package/dist/chunk-ZYNBKBY3.js +14 -0
- package/dist/collection-add-products-IUDEIUM5.js +284 -0
- package/dist/collection-create-AQ3GUG3G.js +133 -0
- package/dist/collection-detail-SDFALX6M.js +444 -0
- package/dist/collection-edit-AAHL2WFH.js +121 -0
- package/dist/collection-list-JGKC5EVM.js +228 -0
- package/dist/collection-metadata-YQWA2JTU.js +80 -0
- package/dist/customer-create-5VT2TB6S.js +183 -0
- package/dist/customer-create-address-ICEFEFD2.js +299 -0
- package/dist/customer-detail-CDELSJ77.js +695 -0
- package/dist/customer-edit-DZAD53JC.js +192 -0
- package/dist/customer-list-EIQP23FQ.js +152 -0
- package/dist/customer-metadata-ATAORBRN.js +81 -0
- package/dist/customers-add-customer-group-542PUCCT.js +308 -0
- package/dist/edit-inventory-item-P2HVULPA.js +152 -0
- package/dist/edit-inventory-item-attributes-V2HK3WTQ.js +323 -0
- package/dist/edit-reservation-LX2Z6KVD.js +246 -0
- package/dist/edit-rules-Q5UNWAUD.js +316 -0
- package/dist/home-I3OILW5Z.js +16 -0
- package/dist/index.css +6 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +4824 -0
- package/dist/inventory-create-FT7GL4RK.js +616 -0
- package/dist/inventory-detail-LNZ5QC67.js +771 -0
- package/dist/inventory-list-UXY7PU3N.js +432 -0
- package/dist/inventory-metadata-OYETRH5X.js +83 -0
- package/dist/inventory-stock-3MBERL3K.js +288 -0
- package/dist/invite-HJ7BRO6H.js +372 -0
- package/dist/location-create-ZVVQT2KP.js +238 -0
- package/dist/location-detail-A5SHPUQN.js +823 -0
- package/dist/location-edit-QSRHHDQ2.js +253 -0
- package/dist/location-fulfillment-providers-4HMT5L7L.js +289 -0
- package/dist/location-list-TC5FEN5R.js +346 -0
- package/dist/location-sales-channels-STDHWQSC.js +215 -0
- package/dist/location-service-zone-create-63LUYCJI.js +173 -0
- package/dist/location-service-zone-edit-UNXI5BQV.js +134 -0
- package/dist/location-service-zone-manage-areas-UMD6CZDZ.js +154 -0
- package/dist/location-service-zone-shipping-option-create-5L73SAGE.js +807 -0
- package/dist/location-service-zone-shipping-option-edit-2FEWQD6Y.js +362 -0
- package/dist/location-service-zone-shipping-option-pricing-QSB56QZD.js +362 -0
- package/dist/login-V4HZQTCQ.js +254 -0
- package/dist/manage-locations-NVHONEZE.js +249 -0
- package/dist/no-match-JLVLPCRH.js +33 -0
- package/dist/order-allocate-items-F7CXZQGX.js +558 -0
- package/dist/order-create-claim-GDVWGZJA.js +2203 -0
- package/dist/order-create-edit-6YYKYT66.js +936 -0
- package/dist/order-create-exchange-NLDIMGBG.js +2190 -0
- package/dist/order-create-fulfillment-EIYGSKXP.js +621 -0
- package/dist/order-create-refund-BBXEZNWA.js +403 -0
- package/dist/order-create-return-6TA5J3AW.js +1292 -0
- package/dist/order-create-shipment-T4C6UE2K.js +208 -0
- package/dist/order-detail-Y4EG3P5F.js +3846 -0
- package/dist/order-edit-billing-address-NNIFUC5C.js +400 -0
- package/dist/order-edit-email-VXOX62P6.js +171 -0
- package/dist/order-edit-shipping-address-WDKCQRRG.js +397 -0
- package/dist/order-list-XDOAXZXN.js +231 -0
- package/dist/order-metadata-S6N3GDOA.js +82 -0
- package/dist/order-receive-return-5VWUPWZJ.js +549 -0
- package/dist/order-request-transfer-VFSY5IFF.js +571 -0
- package/dist/price-list-configuration-GH67LL2N.js +356 -0
- package/dist/price-list-create-INX5HG7G.js +973 -0
- package/dist/price-list-detail-5LGPE67O.js +540 -0
- package/dist/price-list-edit-HRWPEIZI.js +227 -0
- package/dist/price-list-list-IXZVTXU5.js +228 -0
- package/dist/price-list-prices-add-QHE3TUTV.js +614 -0
- package/dist/price-list-prices-edit-TMVJ7S7J.js +326 -0
- package/dist/product-attributes-P7WFH4I2.js +358 -0
- package/dist/product-create-YC6MCJ2M.js +2305 -0
- package/dist/product-create-option-BNF2KKJM.js +144 -0
- package/dist/product-create-variant-SIJX7AE3.js +837 -0
- package/dist/product-detail-2GJ3PGHW.js +1638 -0
- package/dist/product-edit-YOGTWZ4I.js +397 -0
- package/dist/product-edit-option-4MUSMFS7.js +152 -0
- package/dist/product-export-5L4HNM3W.js +127 -0
- package/dist/product-import-Y54VG4AC.js +261 -0
- package/dist/product-list-EV2TS3Y4.js +313 -0
- package/dist/product-media-ZSMGHCNP.js +879 -0
- package/dist/product-metadata-572YVJH3.js +80 -0
- package/dist/product-organization-LVKRBJOQ.js +312 -0
- package/dist/product-prices-K5YM2TL6.js +266 -0
- package/dist/product-sales-channels-J3OH4NWX.js +157 -0
- package/dist/product-shipping-profile-NOOFEUBZ.js +146 -0
- package/dist/product-stock-J4LTIX64.js +540 -0
- package/dist/product-tag-create-5JJPPELP.js +122 -0
- package/dist/product-tag-detail-CGLCH3BJ.js +281 -0
- package/dist/product-tag-edit-OR7KSC7I.js +134 -0
- package/dist/product-tag-list-DY7GJUJQ.js +259 -0
- package/dist/product-tag-metadata-BFGPRMME.js +80 -0
- package/dist/product-type-create-FPVSGIKL.js +101 -0
- package/dist/product-type-detail-JYW2DAM4.js +242 -0
- package/dist/product-type-edit-FBT4Z4ZJ.js +113 -0
- package/dist/product-type-list-FK237DSQ.js +175 -0
- package/dist/product-type-metadata-SFJR5OQN.js +80 -0
- package/dist/product-variant-detail-6KPB3HL7.js +485 -0
- package/dist/product-variant-edit-QFHGNDW7.js +538 -0
- package/dist/product-variant-manage-inventory-items-ZEX2IW53.js +340 -0
- package/dist/product-variant-metadata-F45CSWU6.js +86 -0
- package/dist/profile-detail-LLXUNQOT.js +89 -0
- package/dist/profile-edit-UDYMDQLT.js +176 -0
- package/dist/promotion-add-campaign-U6X2FNWZ.js +43 -0
- package/dist/promotion-create-QB7E277L.js +1258 -0
- package/dist/promotion-detail-7D6D6PQ7.js +486 -0
- package/dist/promotion-edit-details-HYQJAZDF.js +512 -0
- package/dist/promotion-list-HTJ5GIWG.js +206 -0
- package/dist/refund-reason-create-LZCL6QJI.js +192 -0
- package/dist/refund-reason-edit-QNGFKZMN.js +192 -0
- package/dist/refund-reason-list-ZEKWYQ45.js +233 -0
- package/dist/region-add-countries-CWJ62VPK.js +226 -0
- package/dist/region-create-Z3JQFIKN.js +507 -0
- package/dist/region-detail-46R3HACJ.js +508 -0
- package/dist/region-edit-W5IVVP7Z.js +380 -0
- package/dist/region-list-DCU6NQFA.js +205 -0
- package/dist/region-metadata-VG5DLCOK.js +83 -0
- package/dist/reservation-create-VG5FSV3F.js +309 -0
- package/dist/reservation-detail-36BA3V2F.js +221 -0
- package/dist/reservation-list-R5UBPNI4.js +298 -0
- package/dist/reservation-metadata-KR4HOHTH.js +83 -0
- package/dist/reset-password-VZPICVMM.js +458 -0
- package/dist/return-reason-create-KTKI6NJE.js +165 -0
- package/dist/return-reason-edit-5KU7WKJF.js +168 -0
- package/dist/return-reason-list-HBSKNIMW.js +240 -0
- package/dist/sales-channel-add-products-6TUDLE4D.js +274 -0
- package/dist/sales-channel-create-2BTWSYIK.js +154 -0
- package/dist/sales-channel-detail-IQIQDN3L.js +437 -0
- package/dist/sales-channel-edit-YBNPALFT.js +163 -0
- package/dist/sales-channel-list-5KNN734B.js +193 -0
- package/dist/sales-channel-metadata-SVW6FYSV.js +88 -0
- package/dist/seller-details-HBVN4GGD.js +77 -0
- package/dist/seller-edit-OXDARXYJ.js +387 -0
- package/dist/seller-list-HG2VXA6V.js +192 -0
- package/dist/settings-D43GVDOO.js +19 -0
- package/dist/shipping-option-type-create-7KYU5NNF.js +195 -0
- package/dist/shipping-option-type-detail-4CNTT3MO.js +169 -0
- package/dist/shipping-option-type-edit-AN6IPVI6.js +191 -0
- package/dist/shipping-option-type-list-36ZS2QZO.js +266 -0
- package/dist/shipping-profile-create-3OWHNAOB.js +123 -0
- package/dist/shipping-profile-detail-WW7IVUVV.js +157 -0
- package/dist/shipping-profile-metadata-AD3DSZLR.js +84 -0
- package/dist/shipping-profiles-list-WOGGP7IT.js +241 -0
- package/dist/store-add-currencies-PIGEOZ4G.js +304 -0
- package/dist/store-detail-MFHPXBIN.js +525 -0
- package/dist/store-edit-WBF6EL5N.js +246 -0
- package/dist/store-metadata-LSK7UVSC.js +85 -0
- package/dist/tax-region-create-XTX4YWRA.js +300 -0
- package/dist/tax-region-detail-XUYJHBHI.js +320 -0
- package/dist/tax-region-edit-AC64YA64.js +162 -0
- package/dist/tax-region-list-XRAYDYK3.js +91 -0
- package/dist/tax-region-metadata-YDQX3Y4X.js +83 -0
- package/dist/tax-region-province-create-GDL65SQF.js +315 -0
- package/dist/tax-region-province-detail-QMPIKT7K.js +215 -0
- package/dist/tax-region-tax-override-create-X2QWOHSU.js +679 -0
- package/dist/tax-region-tax-override-edit-VZJ6EPSU.js +788 -0
- package/dist/tax-region-tax-rate-create-VC2WDVJJ.js +193 -0
- package/dist/tax-region-tax-rate-edit-SDW36H6I.js +192 -0
- package/dist/user-detail-IEIX24PZ.js +163 -0
- package/dist/user-edit-CJ7TNY3H.js +115 -0
- package/dist/user-invite-OTBYWV4L.js +389 -0
- package/dist/user-list-BJXFPTJ7.js +341 -0
- package/dist/user-metadata-ZLC6T6XH.js +83 -0
- package/package.json +87 -0
|
@@ -0,0 +1,1638 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SidebarLink
|
|
3
|
+
} from "./chunk-4GPAS5GW.js";
|
|
4
|
+
import "./chunk-U2EI2ZLM.js";
|
|
5
|
+
import {
|
|
6
|
+
getFormattedCountry
|
|
7
|
+
} from "./chunk-W6Y3PPU5.js";
|
|
8
|
+
import {
|
|
9
|
+
PRODUCT_VARIANT_IDS_KEY
|
|
10
|
+
} from "./chunk-33XUAKRP.js";
|
|
11
|
+
import "./chunk-FI474ADU.js";
|
|
12
|
+
import {
|
|
13
|
+
SectionRow
|
|
14
|
+
} from "./chunk-3XPXUIK3.js";
|
|
15
|
+
import "./chunk-JRTZWK77.js";
|
|
16
|
+
import {
|
|
17
|
+
TwoColumnPage
|
|
18
|
+
} from "./chunk-U2UCL2VG.js";
|
|
19
|
+
import {
|
|
20
|
+
useDataTableDateColumns,
|
|
21
|
+
useDataTableDateFilters
|
|
22
|
+
} from "./chunk-54RTJBYO.js";
|
|
23
|
+
import {
|
|
24
|
+
DataTable
|
|
25
|
+
} from "./chunk-UQITHKTH.js";
|
|
26
|
+
import {
|
|
27
|
+
TwoColumnPageSkeleton
|
|
28
|
+
} from "./chunk-INNFZYX2.js";
|
|
29
|
+
import {
|
|
30
|
+
ActionMenu
|
|
31
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
32
|
+
import "./chunk-LAVHRER2.js";
|
|
33
|
+
import "./chunk-Y7QKP6QU.js";
|
|
34
|
+
import {
|
|
35
|
+
useQueryParams
|
|
36
|
+
} from "./chunk-THHRRYRS.js";
|
|
37
|
+
import "./chunk-UZWFZMOX.js";
|
|
38
|
+
import "./chunk-XQNVC4Q7.js";
|
|
39
|
+
import "./chunk-ORW4HNX5.js";
|
|
40
|
+
import "./chunk-ODBDAABQ.js";
|
|
41
|
+
import "./chunk-YGQUBTKR.js";
|
|
42
|
+
import "./chunk-362QMJZM.js";
|
|
43
|
+
import "./chunk-FODCCP6C.js";
|
|
44
|
+
import "./chunk-AWZFIP25.js";
|
|
45
|
+
import "./chunk-2QKPRGNK.js";
|
|
46
|
+
import "./chunk-XBMLI2YI.js";
|
|
47
|
+
import "./chunk-XL52SYWY.js";
|
|
48
|
+
import "./chunk-NS5CHWOH.js";
|
|
49
|
+
import "./chunk-WDZFLCSQ.js";
|
|
50
|
+
import "./chunk-VVTSF42Z.js";
|
|
51
|
+
import "./chunk-D3KDXELJ.js";
|
|
52
|
+
import "./chunk-2MKZ4HD4.js";
|
|
53
|
+
import "./chunk-OGYWOPHZ.js";
|
|
54
|
+
import "./chunk-U62GYN4A.js";
|
|
55
|
+
import "./chunk-KTKL7M34.js";
|
|
56
|
+
import "./chunk-JJVGCTKT.js";
|
|
57
|
+
import "./chunk-I43SCBL3.js";
|
|
58
|
+
import "./chunk-LLWK3OR6.js";
|
|
59
|
+
import {
|
|
60
|
+
useSalesChannels
|
|
61
|
+
} from "./chunk-HYUGYB23.js";
|
|
62
|
+
import "./chunk-XCMR2HTV.js";
|
|
63
|
+
import "./chunk-CI5Z6FGV.js";
|
|
64
|
+
import "./chunk-LCZXAT4Q.js";
|
|
65
|
+
import "./chunk-S6LPCNXQ.js";
|
|
66
|
+
import {
|
|
67
|
+
productsQueryKeys,
|
|
68
|
+
useDeleteProduct,
|
|
69
|
+
useDeleteProductOption,
|
|
70
|
+
useDeleteVariantLazy,
|
|
71
|
+
useProduct,
|
|
72
|
+
useProductAttributes,
|
|
73
|
+
useProductVariants,
|
|
74
|
+
useUpdateProduct
|
|
75
|
+
} from "./chunk-T435NFHC.js";
|
|
76
|
+
import {
|
|
77
|
+
queryClient
|
|
78
|
+
} from "./chunk-2KCF3ZIB.js";
|
|
79
|
+
import {
|
|
80
|
+
sdk
|
|
81
|
+
} from "./chunk-ZYNBKBY3.js";
|
|
82
|
+
import "./chunk-NBMM2TZK.js";
|
|
83
|
+
|
|
84
|
+
// src/pages/products/product-detail/breadcrumb.tsx
|
|
85
|
+
import { jsx } from "react/jsx-runtime";
|
|
86
|
+
var ProductDetailBreadcrumb = (props) => {
|
|
87
|
+
const { id } = props.params || {};
|
|
88
|
+
const { product } = useProduct(
|
|
89
|
+
id,
|
|
90
|
+
{},
|
|
91
|
+
{
|
|
92
|
+
initialData: props.data,
|
|
93
|
+
enabled: Boolean(id)
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
if (!product) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return /* @__PURE__ */ jsx("span", { children: product.title });
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/pages/products/product-detail/loader.ts
|
|
103
|
+
var productDetailQuery = (id) => ({
|
|
104
|
+
queryKey: productsQueryKeys.detail(id),
|
|
105
|
+
queryFn: async () => sdk.admin.products.$id.query({ $id: id })
|
|
106
|
+
});
|
|
107
|
+
var productLoader = 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/product-detail/product-detail.tsx
|
|
118
|
+
import { useLoaderData, useParams as useParams2 } from "react-router-dom";
|
|
119
|
+
|
|
120
|
+
// src/pages/products/product-detail/components/product-additional-attribute-section/product-additional-attribute-section.tsx
|
|
121
|
+
import { useEffect, useState } from "react";
|
|
122
|
+
import { InformationCircleSolid, PencilSquare } from "@medusajs/icons";
|
|
123
|
+
import {
|
|
124
|
+
Button,
|
|
125
|
+
Container,
|
|
126
|
+
Heading,
|
|
127
|
+
Label,
|
|
128
|
+
Tooltip,
|
|
129
|
+
toast
|
|
130
|
+
} from "@medusajs/ui";
|
|
131
|
+
import { Drawer } from "@medusajs/ui";
|
|
132
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
133
|
+
import { useTranslation } from "react-i18next";
|
|
134
|
+
import { useParams } from "react-router-dom";
|
|
135
|
+
|
|
136
|
+
// src/pages/products/product-detail/components/product-additional-attribute-section/components/form-components.tsx
|
|
137
|
+
import { Input, Switch, Textarea } from "@medusajs/ui";
|
|
138
|
+
|
|
139
|
+
// src/pages/products/product-detail/components/product-additional-attribute-section/components/attribute-select.tsx
|
|
140
|
+
import { Select } from "@medusajs/ui";
|
|
141
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
142
|
+
var AttributeSelect = ({
|
|
143
|
+
values,
|
|
144
|
+
field,
|
|
145
|
+
"data-testid": dataTestId
|
|
146
|
+
}) => {
|
|
147
|
+
const handleChange = (value) => {
|
|
148
|
+
field.onChange({
|
|
149
|
+
target: {
|
|
150
|
+
name: field.name,
|
|
151
|
+
value
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ jsx2("div", { "data-testid": dataTestId ? `${dataTestId}-wrapper` : void 0, children: /* @__PURE__ */ jsxs(
|
|
156
|
+
Select,
|
|
157
|
+
{
|
|
158
|
+
onValueChange: (value) => handleChange(value),
|
|
159
|
+
value: field.value,
|
|
160
|
+
"data-testid": dataTestId,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx2(
|
|
163
|
+
Select.Trigger,
|
|
164
|
+
{
|
|
165
|
+
className: "bg-ui-bg-base",
|
|
166
|
+
"data-testid": dataTestId ? `${dataTestId}-trigger` : void 0,
|
|
167
|
+
children: /* @__PURE__ */ jsx2(
|
|
168
|
+
Select.Value,
|
|
169
|
+
{
|
|
170
|
+
placeholder: "Select value",
|
|
171
|
+
"data-testid": dataTestId ? `${dataTestId}-value` : void 0
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ jsx2(Select.Content, { "data-testid": dataTestId ? `${dataTestId}-content` : void 0, children: values?.filter((v) => v && v.attribute_id).map(({ id, attribute_id, value }) => /* @__PURE__ */ jsx2(
|
|
177
|
+
Select.Item,
|
|
178
|
+
{
|
|
179
|
+
value,
|
|
180
|
+
"data-testid": dataTestId ? `${dataTestId}-option-${id}` : void 0,
|
|
181
|
+
children: value
|
|
182
|
+
},
|
|
183
|
+
`select-option-${attribute_id}-${id}`
|
|
184
|
+
)) })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
) });
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/pages/products/product-detail/components/product-additional-attribute-section/components/form-components.tsx
|
|
191
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
192
|
+
var FormComponents = ({
|
|
193
|
+
attribute,
|
|
194
|
+
field,
|
|
195
|
+
"data-testid": dataTestId
|
|
196
|
+
}) => {
|
|
197
|
+
const { ui_component, possible_values } = attribute;
|
|
198
|
+
if (ui_component === "select")
|
|
199
|
+
return /* @__PURE__ */ jsx3(AttributeSelect, { values: possible_values, field, "data-testid": dataTestId });
|
|
200
|
+
if (ui_component === "toggle")
|
|
201
|
+
return /* @__PURE__ */ jsx3("div", { "data-testid": dataTestId ? `${dataTestId}-switch-wrapper` : void 0, children: /* @__PURE__ */ jsx3(
|
|
202
|
+
Switch,
|
|
203
|
+
{
|
|
204
|
+
name: field.name,
|
|
205
|
+
onCheckedChange: (value) => {
|
|
206
|
+
field.onChange({
|
|
207
|
+
target: {
|
|
208
|
+
name: field.name,
|
|
209
|
+
value
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
checked: field.value === "true" || field.value === true,
|
|
214
|
+
"data-testid": dataTestId
|
|
215
|
+
}
|
|
216
|
+
) });
|
|
217
|
+
if (ui_component === "text_area")
|
|
218
|
+
return /* @__PURE__ */ jsx3("div", { "data-testid": dataTestId ? `${dataTestId}-textarea-wrapper` : void 0, children: /* @__PURE__ */ jsx3(Textarea, { ...field, rows: 4, "data-testid": dataTestId }) });
|
|
219
|
+
if (ui_component === "unit")
|
|
220
|
+
return /* @__PURE__ */ jsx3("div", { "data-testid": dataTestId ? `${dataTestId}-input-wrapper` : void 0, children: /* @__PURE__ */ jsx3(Input, { type: "number", ...field, "data-testid": dataTestId }) });
|
|
221
|
+
if (ui_component === "text")
|
|
222
|
+
return /* @__PURE__ */ jsx3("div", { "data-testid": dataTestId ? `${dataTestId}-input-wrapper` : void 0, children: /* @__PURE__ */ jsx3(Input, { ...field, "data-testid": dataTestId }) });
|
|
223
|
+
return /* @__PURE__ */ jsx3("div", { "data-testid": dataTestId ? `${dataTestId}-input-wrapper` : void 0, children: /* @__PURE__ */ jsx3(Input, { ...field, "data-testid": dataTestId }) });
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/pages/products/product-detail/components/product-additional-attribute-section/product-additional-attribute-section.tsx
|
|
227
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
228
|
+
var ProductAdditionalAttributeSection = () => {
|
|
229
|
+
const { t } = useTranslation();
|
|
230
|
+
const { id } = useParams();
|
|
231
|
+
const [open, setOpen] = useState(false);
|
|
232
|
+
const { product, isLoading: isProductLoading } = useProduct(id, {
|
|
233
|
+
fields: "attribute_values.*,attribute_values.attribute.*"
|
|
234
|
+
});
|
|
235
|
+
const { data, isLoading } = useProductAttributes(id);
|
|
236
|
+
const attributes = data?.attributes || [];
|
|
237
|
+
const { mutate: updateProduct } = useUpdateProduct(id);
|
|
238
|
+
const form = useForm({
|
|
239
|
+
defaultValues: {}
|
|
240
|
+
});
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
if (product?.attribute_values) {
|
|
243
|
+
const defaultValues = product.attribute_values.reduce(
|
|
244
|
+
(acc, curr) => {
|
|
245
|
+
if (curr) {
|
|
246
|
+
acc[curr.attribute_id] = curr.value;
|
|
247
|
+
}
|
|
248
|
+
return acc;
|
|
249
|
+
},
|
|
250
|
+
{}
|
|
251
|
+
);
|
|
252
|
+
form.reset(defaultValues);
|
|
253
|
+
}
|
|
254
|
+
}, [product?.attribute_values, form]);
|
|
255
|
+
const onSubmit = (data2) => {
|
|
256
|
+
const formattedData = Object.keys(data2).map((key) => {
|
|
257
|
+
const attribute = attributes.find(
|
|
258
|
+
(a) => a.id === key && a.ui_component === "select"
|
|
259
|
+
);
|
|
260
|
+
const value = attribute?.possible_values?.find(
|
|
261
|
+
(pv) => pv.id === data2[key]
|
|
262
|
+
)?.value;
|
|
263
|
+
return value && {
|
|
264
|
+
[key]: value
|
|
265
|
+
};
|
|
266
|
+
});
|
|
267
|
+
const payload = {
|
|
268
|
+
...data2,
|
|
269
|
+
...Object.assign({}, ...formattedData.filter(Boolean))
|
|
270
|
+
};
|
|
271
|
+
const values = Object.keys(payload).reduce(
|
|
272
|
+
(acc, key) => {
|
|
273
|
+
acc.push({ attribute_id: key, value: payload[key] });
|
|
274
|
+
return acc;
|
|
275
|
+
},
|
|
276
|
+
[]
|
|
277
|
+
);
|
|
278
|
+
updateProduct(
|
|
279
|
+
{
|
|
280
|
+
additional_data: { values }
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
onSuccess: () => {
|
|
284
|
+
toast.success("Product updated successfully");
|
|
285
|
+
setOpen(false);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
if (isLoading || isProductLoading) return /* @__PURE__ */ jsx4("div", { children: "Loading..." });
|
|
291
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
292
|
+
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsxs2(
|
|
293
|
+
Container,
|
|
294
|
+
{
|
|
295
|
+
className: "divide-y p-0",
|
|
296
|
+
"data-testid": "product-additional-attributes-section",
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ jsxs2(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: "flex items-center justify-between px-6 py-4",
|
|
302
|
+
"data-testid": "product-additional-attributes-header",
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ jsx4(
|
|
305
|
+
Heading,
|
|
306
|
+
{
|
|
307
|
+
level: "h2",
|
|
308
|
+
"data-testid": "product-additional-attributes-title",
|
|
309
|
+
children: t("products.additionalAttributes")
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ jsx4(
|
|
313
|
+
ActionMenu,
|
|
314
|
+
{
|
|
315
|
+
groups: [
|
|
316
|
+
{
|
|
317
|
+
actions: [
|
|
318
|
+
{
|
|
319
|
+
label: t("actions.edit"),
|
|
320
|
+
onClick: () => setOpen(true),
|
|
321
|
+
icon: /* @__PURE__ */ jsx4(PencilSquare, {})
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"data-testid": "product-additional-attributes-action-menu"
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
product?.attribute_values?.map(
|
|
333
|
+
(attribute) => attribute && /* @__PURE__ */ jsx4(
|
|
334
|
+
SectionRow,
|
|
335
|
+
{
|
|
336
|
+
title: attribute.attribute.name,
|
|
337
|
+
value: attribute.value,
|
|
338
|
+
"data-testid": `product-additional-attribute-row-${attribute.attribute.name}`
|
|
339
|
+
},
|
|
340
|
+
attribute.id
|
|
341
|
+
)
|
|
342
|
+
)
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
) }),
|
|
346
|
+
/* @__PURE__ */ jsx4(
|
|
347
|
+
Drawer,
|
|
348
|
+
{
|
|
349
|
+
open,
|
|
350
|
+
onOpenChange: setOpen,
|
|
351
|
+
"data-testid": "product-additional-attributes-drawer",
|
|
352
|
+
children: /* @__PURE__ */ jsxs2(Drawer.Content, { "data-testid": "product-additional-attributes-drawer-content", children: [
|
|
353
|
+
/* @__PURE__ */ jsx4(Drawer.Header, { "data-testid": "product-additional-attributes-drawer-header", children: /* @__PURE__ */ jsx4(
|
|
354
|
+
Heading,
|
|
355
|
+
{
|
|
356
|
+
level: "h2",
|
|
357
|
+
"data-testid": "product-additional-attributes-drawer-title",
|
|
358
|
+
children: t("products.additionalAttributes")
|
|
359
|
+
}
|
|
360
|
+
) }),
|
|
361
|
+
/* @__PURE__ */ jsx4(
|
|
362
|
+
Drawer.Body,
|
|
363
|
+
{
|
|
364
|
+
className: "m-4 max-h-[calc(86vh)] overflow-y-auto py-2",
|
|
365
|
+
"data-testid": "product-additional-attributes-drawer-body",
|
|
366
|
+
children: /* @__PURE__ */ jsx4(FormProvider, { ...form, children: /* @__PURE__ */ jsx4(
|
|
367
|
+
"form",
|
|
368
|
+
{
|
|
369
|
+
id: "product-additional-attributes-form",
|
|
370
|
+
onSubmit: form.handleSubmit(onSubmit),
|
|
371
|
+
className: "p-0",
|
|
372
|
+
"data-testid": "product-additional-attributes-form",
|
|
373
|
+
children: attributes.map((a) => /* @__PURE__ */ jsxs2(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
className: "-mx-4 mb-4",
|
|
377
|
+
"data-testid": `product-additional-attribute-field-${a.id}`,
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ jsxs2(
|
|
380
|
+
Label,
|
|
381
|
+
{
|
|
382
|
+
className: "mb-2 flex items-center gap-x-2",
|
|
383
|
+
"data-testid": `product-additional-attribute-label-${a.id}`,
|
|
384
|
+
children: [
|
|
385
|
+
a.name,
|
|
386
|
+
a.description && /* @__PURE__ */ jsx4(
|
|
387
|
+
Tooltip,
|
|
388
|
+
{
|
|
389
|
+
content: a.description,
|
|
390
|
+
"data-testid": `product-additional-attribute-tooltip-${a.id}`,
|
|
391
|
+
children: /* @__PURE__ */ jsx4(InformationCircleSolid, {})
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
),
|
|
397
|
+
/* @__PURE__ */ jsx4(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
"data-testid": `product-additional-attribute-input-${a.id}`,
|
|
401
|
+
children: /* @__PURE__ */ jsx4(
|
|
402
|
+
FormComponents,
|
|
403
|
+
{
|
|
404
|
+
attribute: a,
|
|
405
|
+
field: {
|
|
406
|
+
name: a.id,
|
|
407
|
+
value: form.watch(a.id),
|
|
408
|
+
defaultValue: form.getValues(a.id),
|
|
409
|
+
onChange: (e) => {
|
|
410
|
+
form.setValue(a.id, e.target.value);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
"data-testid": `product-additional-attribute-input-${a.id}-component`
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
`form-field-${a.handle}-${a.id}`
|
|
421
|
+
))
|
|
422
|
+
}
|
|
423
|
+
) })
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ jsx4(Drawer.Footer, { "data-testid": "product-additional-attributes-drawer-footer", children: /* @__PURE__ */ jsxs2(
|
|
427
|
+
"div",
|
|
428
|
+
{
|
|
429
|
+
className: "flex items-center justify-end gap-x-2",
|
|
430
|
+
"data-testid": "product-additional-attributes-form-actions",
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ jsx4(
|
|
433
|
+
Drawer.Close,
|
|
434
|
+
{
|
|
435
|
+
asChild: true,
|
|
436
|
+
"data-testid": "product-additional-attributes-cancel-button-wrapper",
|
|
437
|
+
children: /* @__PURE__ */ jsx4(
|
|
438
|
+
Button,
|
|
439
|
+
{
|
|
440
|
+
variant: "secondary",
|
|
441
|
+
size: "small",
|
|
442
|
+
"data-testid": "product-additional-attributes-cancel-button",
|
|
443
|
+
children: t("actions.cancel")
|
|
444
|
+
}
|
|
445
|
+
)
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
/* @__PURE__ */ jsx4(
|
|
449
|
+
Button,
|
|
450
|
+
{
|
|
451
|
+
size: "small",
|
|
452
|
+
type: "submit",
|
|
453
|
+
form: "product-additional-attributes-form",
|
|
454
|
+
"data-testid": "product-additional-attributes-save-button",
|
|
455
|
+
children: t("actions.save")
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
) })
|
|
461
|
+
] })
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
] });
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
|
|
468
|
+
import { PencilSquare as PencilSquare2 } from "@medusajs/icons";
|
|
469
|
+
import { Container as Container2, Heading as Heading2 } from "@medusajs/ui";
|
|
470
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
471
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
472
|
+
var ProductAttributeSection = ({
|
|
473
|
+
product
|
|
474
|
+
}) => {
|
|
475
|
+
const { t } = useTranslation2();
|
|
476
|
+
return /* @__PURE__ */ jsxs3(Container2, { className: "divide-y p-0", "data-testid": "product-attribute-section", children: [
|
|
477
|
+
/* @__PURE__ */ jsxs3(
|
|
478
|
+
"div",
|
|
479
|
+
{
|
|
480
|
+
className: "flex items-center justify-between px-6 py-4",
|
|
481
|
+
"data-testid": "product-attribute-header",
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ jsx5(Heading2, { level: "h2", "data-testid": "product-attribute-title", children: t("products.attributes") }),
|
|
484
|
+
/* @__PURE__ */ jsx5(
|
|
485
|
+
ActionMenu,
|
|
486
|
+
{
|
|
487
|
+
groups: [
|
|
488
|
+
{
|
|
489
|
+
actions: [
|
|
490
|
+
{
|
|
491
|
+
label: t("actions.edit"),
|
|
492
|
+
to: "attributes",
|
|
493
|
+
icon: /* @__PURE__ */ jsx5(PencilSquare2, {})
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"data-testid": "product-attribute-action-menu"
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
/* @__PURE__ */ jsx5(
|
|
505
|
+
SectionRow,
|
|
506
|
+
{
|
|
507
|
+
title: t("fields.height"),
|
|
508
|
+
value: product.height,
|
|
509
|
+
"data-testid": "product-height-row"
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ jsx5(
|
|
513
|
+
SectionRow,
|
|
514
|
+
{
|
|
515
|
+
title: t("fields.width"),
|
|
516
|
+
value: product.width,
|
|
517
|
+
"data-testid": "product-width-row"
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ jsx5(
|
|
521
|
+
SectionRow,
|
|
522
|
+
{
|
|
523
|
+
title: t("fields.length"),
|
|
524
|
+
value: product.length,
|
|
525
|
+
"data-testid": "product-length-row"
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ jsx5(
|
|
529
|
+
SectionRow,
|
|
530
|
+
{
|
|
531
|
+
title: t("fields.weight"),
|
|
532
|
+
value: product.weight,
|
|
533
|
+
"data-testid": "product-weight-row"
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ jsx5(
|
|
537
|
+
SectionRow,
|
|
538
|
+
{
|
|
539
|
+
title: t("fields.midCode"),
|
|
540
|
+
value: product.mid_code,
|
|
541
|
+
"data-testid": "product-mid-code-row"
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
/* @__PURE__ */ jsx5(
|
|
545
|
+
SectionRow,
|
|
546
|
+
{
|
|
547
|
+
title: t("fields.hsCode"),
|
|
548
|
+
value: product.hs_code,
|
|
549
|
+
"data-testid": "product-hs-code-row"
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ jsx5(
|
|
553
|
+
SectionRow,
|
|
554
|
+
{
|
|
555
|
+
title: t("fields.countryOfOrigin"),
|
|
556
|
+
value: getFormattedCountry(product.origin_country),
|
|
557
|
+
"data-testid": "product-country-of-origin-row"
|
|
558
|
+
}
|
|
559
|
+
)
|
|
560
|
+
] });
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// src/pages/products/product-detail/components/product-general-section/product-general-section.tsx
|
|
564
|
+
import { PencilSquare as PencilSquare3, Trash } from "@medusajs/icons";
|
|
565
|
+
import { Container as Container3, Heading as Heading3, StatusBadge, usePrompt } from "@medusajs/ui";
|
|
566
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
567
|
+
import { useNavigate } from "react-router-dom";
|
|
568
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
569
|
+
var productStatusColor = (status) => {
|
|
570
|
+
switch (status) {
|
|
571
|
+
case "draft":
|
|
572
|
+
return "grey";
|
|
573
|
+
case "proposed":
|
|
574
|
+
return "orange";
|
|
575
|
+
case "published":
|
|
576
|
+
return "green";
|
|
577
|
+
case "rejected":
|
|
578
|
+
return "red";
|
|
579
|
+
default:
|
|
580
|
+
return "grey";
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var ProductGeneralSection = ({
|
|
584
|
+
product
|
|
585
|
+
}) => {
|
|
586
|
+
const { t } = useTranslation3();
|
|
587
|
+
const prompt = usePrompt();
|
|
588
|
+
const navigate = useNavigate();
|
|
589
|
+
const { mutateAsync } = useDeleteProduct(product.id);
|
|
590
|
+
const handleDelete = async () => {
|
|
591
|
+
const res = await prompt({
|
|
592
|
+
title: t("general.areYouSure"),
|
|
593
|
+
description: t("products.deleteWarning", {
|
|
594
|
+
title: product.title
|
|
595
|
+
}),
|
|
596
|
+
confirmText: t("actions.delete"),
|
|
597
|
+
cancelText: t("actions.cancel")
|
|
598
|
+
});
|
|
599
|
+
if (!res) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
await mutateAsync(void 0, {
|
|
603
|
+
onSuccess: () => {
|
|
604
|
+
navigate("..");
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
};
|
|
608
|
+
return /* @__PURE__ */ jsxs4(Container3, { className: "divide-y p-0", "data-testid": "product-general-section", children: [
|
|
609
|
+
/* @__PURE__ */ jsxs4(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
className: "flex items-center justify-between px-6 py-4",
|
|
613
|
+
"data-testid": "product-general-header",
|
|
614
|
+
children: [
|
|
615
|
+
/* @__PURE__ */ jsx6(Heading3, { "data-testid": "product-general-title", children: product.title }),
|
|
616
|
+
/* @__PURE__ */ jsxs4(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
className: "flex items-center gap-x-4",
|
|
620
|
+
"data-testid": "product-general-actions",
|
|
621
|
+
children: [
|
|
622
|
+
/* @__PURE__ */ jsx6(
|
|
623
|
+
StatusBadge,
|
|
624
|
+
{
|
|
625
|
+
color: productStatusColor(product.status),
|
|
626
|
+
"data-testid": "product-status-badge",
|
|
627
|
+
children: t(`products.productStatus.${product.status}`)
|
|
628
|
+
}
|
|
629
|
+
),
|
|
630
|
+
/* @__PURE__ */ jsx6(
|
|
631
|
+
ActionMenu,
|
|
632
|
+
{
|
|
633
|
+
groups: [
|
|
634
|
+
{
|
|
635
|
+
actions: [
|
|
636
|
+
{
|
|
637
|
+
label: t("actions.edit"),
|
|
638
|
+
to: "edit",
|
|
639
|
+
icon: /* @__PURE__ */ jsx6(PencilSquare3, {})
|
|
640
|
+
}
|
|
641
|
+
]
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
actions: [
|
|
645
|
+
{
|
|
646
|
+
label: t("actions.delete"),
|
|
647
|
+
onClick: handleDelete,
|
|
648
|
+
icon: /* @__PURE__ */ jsx6(Trash, {})
|
|
649
|
+
}
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
],
|
|
653
|
+
"data-testid": "product-general-action-menu"
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
)
|
|
659
|
+
]
|
|
660
|
+
}
|
|
661
|
+
),
|
|
662
|
+
/* @__PURE__ */ jsx6(
|
|
663
|
+
SectionRow,
|
|
664
|
+
{
|
|
665
|
+
title: t("fields.description"),
|
|
666
|
+
value: product.description,
|
|
667
|
+
"data-testid": "product-description-row"
|
|
668
|
+
}
|
|
669
|
+
),
|
|
670
|
+
/* @__PURE__ */ jsx6(
|
|
671
|
+
SectionRow,
|
|
672
|
+
{
|
|
673
|
+
title: t("fields.subtitle"),
|
|
674
|
+
value: product.subtitle,
|
|
675
|
+
"data-testid": "product-subtitle-row"
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ jsx6(
|
|
679
|
+
SectionRow,
|
|
680
|
+
{
|
|
681
|
+
title: t("fields.handle"),
|
|
682
|
+
value: `/${product.handle}`,
|
|
683
|
+
"data-testid": "product-handle-row"
|
|
684
|
+
}
|
|
685
|
+
),
|
|
686
|
+
/* @__PURE__ */ jsx6(
|
|
687
|
+
SectionRow,
|
|
688
|
+
{
|
|
689
|
+
title: t("fields.discountable"),
|
|
690
|
+
value: product.discountable ? t("fields.true") : t("fields.false"),
|
|
691
|
+
"data-testid": "product-discountable-row"
|
|
692
|
+
}
|
|
693
|
+
)
|
|
694
|
+
] });
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// src/pages/products/product-detail/components/product-media-section/product-media-section.tsx
|
|
698
|
+
import { PencilSquare as PencilSquare4, ThumbnailBadge } from "@medusajs/icons";
|
|
699
|
+
import {
|
|
700
|
+
Button as Button2,
|
|
701
|
+
Checkbox,
|
|
702
|
+
CommandBar,
|
|
703
|
+
Container as Container4,
|
|
704
|
+
Heading as Heading4,
|
|
705
|
+
Text,
|
|
706
|
+
Tooltip as Tooltip2,
|
|
707
|
+
clx,
|
|
708
|
+
usePrompt as usePrompt2
|
|
709
|
+
} from "@medusajs/ui";
|
|
710
|
+
import { useState as useState2 } from "react";
|
|
711
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
712
|
+
import { Link } from "react-router-dom";
|
|
713
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
714
|
+
var ProductMediaSection = ({ product }) => {
|
|
715
|
+
const { t } = useTranslation4();
|
|
716
|
+
const prompt = usePrompt2();
|
|
717
|
+
const [selection, setSelection] = useState2({});
|
|
718
|
+
const media = getMedia(product);
|
|
719
|
+
const handleCheckedChange = (id) => {
|
|
720
|
+
setSelection((prev) => {
|
|
721
|
+
if (prev[id]) {
|
|
722
|
+
const { [id]: _, ...rest } = prev;
|
|
723
|
+
return rest;
|
|
724
|
+
} else {
|
|
725
|
+
return { ...prev, [id]: true };
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
};
|
|
729
|
+
const { mutateAsync } = useUpdateProduct(product.id);
|
|
730
|
+
const handleDelete = async () => {
|
|
731
|
+
const ids = Object.keys(selection);
|
|
732
|
+
const includingThumbnail = ids.some(
|
|
733
|
+
(id) => media.find((m) => m.id === id)?.isThumbnail
|
|
734
|
+
);
|
|
735
|
+
const res = await prompt({
|
|
736
|
+
title: t("general.areYouSure"),
|
|
737
|
+
description: includingThumbnail ? t("products.media.deleteWarningWithThumbnail", {
|
|
738
|
+
count: ids.length
|
|
739
|
+
}) : t("products.media.deleteWarning", {
|
|
740
|
+
count: ids.length
|
|
741
|
+
}),
|
|
742
|
+
confirmText: t("actions.delete"),
|
|
743
|
+
cancelText: t("actions.cancel")
|
|
744
|
+
});
|
|
745
|
+
if (!res) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const mediaToKeep = product.images?.filter((i) => !ids.includes(i.id)).map((i) => ({ url: i.url }));
|
|
749
|
+
await mutateAsync(
|
|
750
|
+
{
|
|
751
|
+
images: mediaToKeep,
|
|
752
|
+
thumbnail: includingThumbnail ? "" : void 0
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
onSuccess: () => {
|
|
756
|
+
setSelection({});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
);
|
|
760
|
+
};
|
|
761
|
+
return /* @__PURE__ */ jsxs5(Container4, { className: "divide-y p-0", "data-testid": "product-media-section", children: [
|
|
762
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-media-header", children: [
|
|
763
|
+
/* @__PURE__ */ jsx7(Heading4, { level: "h2", "data-testid": "product-media-title", children: t("products.media.label") }),
|
|
764
|
+
/* @__PURE__ */ jsx7(
|
|
765
|
+
ActionMenu,
|
|
766
|
+
{
|
|
767
|
+
groups: [
|
|
768
|
+
{
|
|
769
|
+
actions: [
|
|
770
|
+
{
|
|
771
|
+
label: t("actions.edit"),
|
|
772
|
+
to: "media?view=edit",
|
|
773
|
+
icon: /* @__PURE__ */ jsx7(PencilSquare4, {})
|
|
774
|
+
}
|
|
775
|
+
]
|
|
776
|
+
}
|
|
777
|
+
],
|
|
778
|
+
"data-testid": "product-media-action-menu"
|
|
779
|
+
}
|
|
780
|
+
)
|
|
781
|
+
] }),
|
|
782
|
+
media.length > 0 ? /* @__PURE__ */ jsx7("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4 px-6 py-4", "data-testid": "product-media-grid", children: media.map((i, index) => {
|
|
783
|
+
const isSelected = selection[i.id];
|
|
784
|
+
return /* @__PURE__ */ jsxs5(
|
|
785
|
+
"div",
|
|
786
|
+
{
|
|
787
|
+
className: "shadow-elevation-card-rest hover:shadow-elevation-card-hover transition-fg group relative aspect-square size-full cursor-pointer overflow-hidden rounded-[8px]",
|
|
788
|
+
"data-testid": `product-media-item-${i.id}`,
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ jsx7(
|
|
791
|
+
"div",
|
|
792
|
+
{
|
|
793
|
+
className: clx(
|
|
794
|
+
"transition-fg invisible absolute right-2 top-2 opacity-0 group-hover:visible group-hover:opacity-100",
|
|
795
|
+
{
|
|
796
|
+
"visible opacity-100": isSelected
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
"data-testid": `product-media-checkbox-container-${i.id}`,
|
|
800
|
+
children: /* @__PURE__ */ jsx7(
|
|
801
|
+
Checkbox,
|
|
802
|
+
{
|
|
803
|
+
checked: selection[i.id] || false,
|
|
804
|
+
onCheckedChange: () => handleCheckedChange(i.id),
|
|
805
|
+
"data-testid": `product-media-checkbox-${i.id}`
|
|
806
|
+
}
|
|
807
|
+
)
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
i.isThumbnail && /* @__PURE__ */ jsx7("div", { className: "absolute left-2 top-2", "data-testid": `product-media-thumbnail-badge-${i.id}`, children: /* @__PURE__ */ jsx7(Tooltip2, { content: t("fields.thumbnail"), children: /* @__PURE__ */ jsx7(ThumbnailBadge, {}) }) }),
|
|
811
|
+
/* @__PURE__ */ jsx7(Link, { to: `media`, state: { curr: index }, "data-testid": `product-media-link-${i.id}`, children: /* @__PURE__ */ jsx7(
|
|
812
|
+
"img",
|
|
813
|
+
{
|
|
814
|
+
src: i.url,
|
|
815
|
+
alt: `${product.title} image`,
|
|
816
|
+
className: "size-full object-cover",
|
|
817
|
+
"data-testid": `product-media-image-${i.id}`
|
|
818
|
+
}
|
|
819
|
+
) })
|
|
820
|
+
]
|
|
821
|
+
},
|
|
822
|
+
i.id
|
|
823
|
+
);
|
|
824
|
+
}) }) : /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-y-4 pb-8 pt-6", "data-testid": "product-media-empty-state", children: [
|
|
825
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center", children: [
|
|
826
|
+
/* @__PURE__ */ jsx7(
|
|
827
|
+
Text,
|
|
828
|
+
{
|
|
829
|
+
size: "small",
|
|
830
|
+
leading: "compact",
|
|
831
|
+
weight: "plus",
|
|
832
|
+
className: "text-ui-fg-subtle",
|
|
833
|
+
"data-testid": "product-media-empty-state-header",
|
|
834
|
+
children: t("products.media.emptyState.header")
|
|
835
|
+
}
|
|
836
|
+
),
|
|
837
|
+
/* @__PURE__ */ jsx7(Text, { size: "small", className: "text-ui-fg-muted", "data-testid": "product-media-empty-state-description", children: t("products.media.emptyState.description") })
|
|
838
|
+
] }),
|
|
839
|
+
/* @__PURE__ */ jsx7(Button2, { size: "small", variant: "secondary", asChild: true, "data-testid": "product-media-empty-state-button", children: /* @__PURE__ */ jsx7(Link, { to: "media?view=edit", "data-testid": "product-media-empty-state-link", children: t("products.media.emptyState.action") }) })
|
|
840
|
+
] }),
|
|
841
|
+
/* @__PURE__ */ jsx7(CommandBar, { open: !!Object.keys(selection).length, "data-testid": "product-media-command-bar", children: /* @__PURE__ */ jsxs5(CommandBar.Bar, { "data-testid": "product-media-command-bar-bar", children: [
|
|
842
|
+
/* @__PURE__ */ jsx7(CommandBar.Value, { "data-testid": "product-media-command-bar-value", children: t("general.countSelected", {
|
|
843
|
+
count: Object.keys(selection).length
|
|
844
|
+
}) }),
|
|
845
|
+
/* @__PURE__ */ jsx7(CommandBar.Seperator, { "data-testid": "product-media-command-bar-separator" }),
|
|
846
|
+
/* @__PURE__ */ jsx7(
|
|
847
|
+
CommandBar.Command,
|
|
848
|
+
{
|
|
849
|
+
action: handleDelete,
|
|
850
|
+
label: t("actions.delete"),
|
|
851
|
+
shortcut: "d",
|
|
852
|
+
"data-testid": "product-media-command-bar-delete"
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
] }) })
|
|
856
|
+
] });
|
|
857
|
+
};
|
|
858
|
+
var getMedia = (product) => {
|
|
859
|
+
const { images = [], thumbnail } = product;
|
|
860
|
+
const media = images.map((image) => ({
|
|
861
|
+
id: image.id,
|
|
862
|
+
url: image.url,
|
|
863
|
+
isThumbnail: image.url === thumbnail
|
|
864
|
+
}));
|
|
865
|
+
if (thumbnail && !media.some((mediaItem) => mediaItem.url === thumbnail)) {
|
|
866
|
+
media.unshift({
|
|
867
|
+
id: "img_thumbnail",
|
|
868
|
+
url: thumbnail,
|
|
869
|
+
isThumbnail: true
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
return media;
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// src/pages/products/product-detail/components/product-option-section/product-option-section.tsx
|
|
876
|
+
import { PencilSquare as PencilSquare5, Plus, Trash as Trash2 } from "@medusajs/icons";
|
|
877
|
+
import { Badge, Container as Container5, Heading as Heading5, usePrompt as usePrompt3 } from "@medusajs/ui";
|
|
878
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
879
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
880
|
+
var OptionActions = ({
|
|
881
|
+
product,
|
|
882
|
+
option
|
|
883
|
+
}) => {
|
|
884
|
+
const { t } = useTranslation5();
|
|
885
|
+
const { mutateAsync } = useDeleteProductOption(product.id, option.id);
|
|
886
|
+
const prompt = usePrompt3();
|
|
887
|
+
const handleDelete = async () => {
|
|
888
|
+
const res = await prompt({
|
|
889
|
+
title: t("general.areYouSure"),
|
|
890
|
+
description: t("products.options.deleteWarning", {
|
|
891
|
+
title: option.title
|
|
892
|
+
}),
|
|
893
|
+
confirmText: t("actions.delete"),
|
|
894
|
+
cancelText: t("actions.cancel")
|
|
895
|
+
});
|
|
896
|
+
if (!res) {
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
await mutateAsync();
|
|
900
|
+
};
|
|
901
|
+
return /* @__PURE__ */ jsx8(
|
|
902
|
+
ActionMenu,
|
|
903
|
+
{
|
|
904
|
+
groups: [
|
|
905
|
+
{
|
|
906
|
+
actions: [
|
|
907
|
+
{
|
|
908
|
+
label: t("actions.edit"),
|
|
909
|
+
to: `options/${option.id}/edit`,
|
|
910
|
+
icon: /* @__PURE__ */ jsx8(PencilSquare5, {})
|
|
911
|
+
}
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
actions: [
|
|
916
|
+
{
|
|
917
|
+
label: t("actions.delete"),
|
|
918
|
+
onClick: handleDelete,
|
|
919
|
+
icon: /* @__PURE__ */ jsx8(Trash2, {})
|
|
920
|
+
}
|
|
921
|
+
]
|
|
922
|
+
}
|
|
923
|
+
],
|
|
924
|
+
"data-testid": `product-option-actions-${option.id}`
|
|
925
|
+
}
|
|
926
|
+
);
|
|
927
|
+
};
|
|
928
|
+
var ProductOptionSection = ({
|
|
929
|
+
product
|
|
930
|
+
}) => {
|
|
931
|
+
const { t } = useTranslation5();
|
|
932
|
+
return /* @__PURE__ */ jsxs6(Container5, { className: "divide-y p-0", "data-testid": "product-option-section", children: [
|
|
933
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-option-header", children: [
|
|
934
|
+
/* @__PURE__ */ jsx8(Heading5, { level: "h2", "data-testid": "product-option-title", children: t("products.options.header") }),
|
|
935
|
+
/* @__PURE__ */ jsx8(
|
|
936
|
+
ActionMenu,
|
|
937
|
+
{
|
|
938
|
+
groups: [
|
|
939
|
+
{
|
|
940
|
+
actions: [
|
|
941
|
+
{
|
|
942
|
+
label: t("actions.create"),
|
|
943
|
+
to: "options/create",
|
|
944
|
+
icon: /* @__PURE__ */ jsx8(Plus, {})
|
|
945
|
+
}
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
],
|
|
949
|
+
"data-testid": "product-option-action-menu"
|
|
950
|
+
}
|
|
951
|
+
)
|
|
952
|
+
] }),
|
|
953
|
+
product.options?.map((option) => {
|
|
954
|
+
return /* @__PURE__ */ jsx8(
|
|
955
|
+
SectionRow,
|
|
956
|
+
{
|
|
957
|
+
title: option.title,
|
|
958
|
+
value: option.values?.map((val) => {
|
|
959
|
+
return /* @__PURE__ */ jsx8(
|
|
960
|
+
Badge,
|
|
961
|
+
{
|
|
962
|
+
size: "2xsmall",
|
|
963
|
+
className: "flex min-w-[20px] items-center justify-center",
|
|
964
|
+
"data-testid": `product-option-value-badge-${option.id}-${val.value}`,
|
|
965
|
+
children: val.value
|
|
966
|
+
},
|
|
967
|
+
val.value
|
|
968
|
+
);
|
|
969
|
+
}),
|
|
970
|
+
actions: /* @__PURE__ */ jsx8(OptionActions, { product, option }),
|
|
971
|
+
"data-testid": `product-option-row-${option.id}`
|
|
972
|
+
},
|
|
973
|
+
option.id
|
|
974
|
+
);
|
|
975
|
+
})
|
|
976
|
+
] });
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// src/pages/products/product-detail/components/product-organization-section/product-organization-section.tsx
|
|
980
|
+
import { PencilSquare as PencilSquare6 } from "@medusajs/icons";
|
|
981
|
+
import { Badge as Badge2, Container as Container6, Heading as Heading6, Tooltip as Tooltip3 } from "@medusajs/ui";
|
|
982
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
983
|
+
import { Link as Link2 } from "react-router-dom";
|
|
984
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
985
|
+
var ProductOrganizationSection = ({
|
|
986
|
+
product
|
|
987
|
+
}) => {
|
|
988
|
+
const { t } = useTranslation6();
|
|
989
|
+
return /* @__PURE__ */ jsxs7(
|
|
990
|
+
Container6,
|
|
991
|
+
{
|
|
992
|
+
className: "divide-y p-0",
|
|
993
|
+
"data-testid": "product-organization-section",
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsxs7(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
className: "flex items-center justify-between px-6 py-4",
|
|
999
|
+
"data-testid": "product-organization-header",
|
|
1000
|
+
children: [
|
|
1001
|
+
/* @__PURE__ */ jsx9(Heading6, { level: "h2", "data-testid": "product-organization-title", children: t("products.organization.header") }),
|
|
1002
|
+
/* @__PURE__ */ jsx9(
|
|
1003
|
+
ActionMenu,
|
|
1004
|
+
{
|
|
1005
|
+
groups: [
|
|
1006
|
+
{
|
|
1007
|
+
actions: [
|
|
1008
|
+
{
|
|
1009
|
+
label: t("actions.edit"),
|
|
1010
|
+
to: "organization",
|
|
1011
|
+
icon: /* @__PURE__ */ jsx9(PencilSquare6, {})
|
|
1012
|
+
}
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
],
|
|
1016
|
+
"data-testid": "product-organization-action-menu"
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
]
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
/* @__PURE__ */ jsx9(
|
|
1023
|
+
SectionRow,
|
|
1024
|
+
{
|
|
1025
|
+
title: t("fields.tags"),
|
|
1026
|
+
value: product.tags?.length ? product.tags.map((tag) => /* @__PURE__ */ jsx9(
|
|
1027
|
+
OrganizationTag,
|
|
1028
|
+
{
|
|
1029
|
+
label: tag.value,
|
|
1030
|
+
to: `/settings/product-tags/${tag.id}`
|
|
1031
|
+
},
|
|
1032
|
+
tag.id
|
|
1033
|
+
)) : void 0,
|
|
1034
|
+
"data-testid": "product-tags-row"
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ jsx9(
|
|
1038
|
+
SectionRow,
|
|
1039
|
+
{
|
|
1040
|
+
title: t("fields.type"),
|
|
1041
|
+
value: product.type ? /* @__PURE__ */ jsx9(
|
|
1042
|
+
OrganizationTag,
|
|
1043
|
+
{
|
|
1044
|
+
label: product.type.value,
|
|
1045
|
+
to: `/settings/product-types/${product.type_id}`
|
|
1046
|
+
}
|
|
1047
|
+
) : void 0,
|
|
1048
|
+
"data-testid": "product-type-row"
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ jsx9(
|
|
1052
|
+
SectionRow,
|
|
1053
|
+
{
|
|
1054
|
+
title: t("fields.collection"),
|
|
1055
|
+
value: product.collection ? /* @__PURE__ */ jsx9(
|
|
1056
|
+
OrganizationTag,
|
|
1057
|
+
{
|
|
1058
|
+
label: product.collection.title,
|
|
1059
|
+
to: `/collections/${product.collection.id}`
|
|
1060
|
+
}
|
|
1061
|
+
) : void 0,
|
|
1062
|
+
"data-testid": "product-collection-row"
|
|
1063
|
+
}
|
|
1064
|
+
),
|
|
1065
|
+
/* @__PURE__ */ jsx9(
|
|
1066
|
+
SectionRow,
|
|
1067
|
+
{
|
|
1068
|
+
title: t("fields.categories"),
|
|
1069
|
+
value: product.categories?.length ? product.categories.map((pcat) => /* @__PURE__ */ jsx9(
|
|
1070
|
+
OrganizationTag,
|
|
1071
|
+
{
|
|
1072
|
+
label: pcat.name,
|
|
1073
|
+
to: `/categories/${pcat.id}`
|
|
1074
|
+
},
|
|
1075
|
+
pcat.id
|
|
1076
|
+
)) : void 0,
|
|
1077
|
+
"data-testid": "product-categories-row"
|
|
1078
|
+
}
|
|
1079
|
+
)
|
|
1080
|
+
]
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
};
|
|
1084
|
+
var OrganizationTag = ({ label, to }) => {
|
|
1085
|
+
return /* @__PURE__ */ jsx9(Tooltip3, { content: label, children: /* @__PURE__ */ jsx9(Badge2, { size: "2xsmall", className: "block w-fit truncate", asChild: true, children: /* @__PURE__ */ jsx9(
|
|
1086
|
+
Link2,
|
|
1087
|
+
{
|
|
1088
|
+
to,
|
|
1089
|
+
"data-testid": `organization-tag-${label.toLowerCase().replace(/\s+/g, "-")}`,
|
|
1090
|
+
children: label
|
|
1091
|
+
}
|
|
1092
|
+
) }) });
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
// src/pages/products/product-detail/components/product-sales-channel-section/product-sales-channel-section.tsx
|
|
1096
|
+
import { Channels, PencilSquare as PencilSquare7 } from "@medusajs/icons";
|
|
1097
|
+
import { Container as Container7, Heading as Heading7, Text as Text2, Tooltip as Tooltip4 } from "@medusajs/ui";
|
|
1098
|
+
import { Trans, useTranslation as useTranslation7 } from "react-i18next";
|
|
1099
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1100
|
+
var ProductSalesChannelSection = ({
|
|
1101
|
+
product
|
|
1102
|
+
}) => {
|
|
1103
|
+
const { count } = useSalesChannels();
|
|
1104
|
+
const { t } = useTranslation7();
|
|
1105
|
+
const availableInSalesChannels = product.sales_channels?.map((sc) => ({
|
|
1106
|
+
id: sc.id,
|
|
1107
|
+
name: sc.name
|
|
1108
|
+
})) ?? [];
|
|
1109
|
+
const firstChannels = availableInSalesChannels.slice(0, 3);
|
|
1110
|
+
const restChannels = availableInSalesChannels.slice(3);
|
|
1111
|
+
return /* @__PURE__ */ jsxs8(Container7, { className: "flex flex-col gap-y-4 px-6 py-4", "data-testid": "product-sales-channel-section", children: [
|
|
1112
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", "data-testid": "product-sales-channel-header", children: [
|
|
1113
|
+
/* @__PURE__ */ jsx10(Heading7, { level: "h2", "data-testid": "product-sales-channel-title", children: t("fields.sales_channels") }),
|
|
1114
|
+
/* @__PURE__ */ jsx10(
|
|
1115
|
+
ActionMenu,
|
|
1116
|
+
{
|
|
1117
|
+
groups: [
|
|
1118
|
+
{
|
|
1119
|
+
actions: [
|
|
1120
|
+
{
|
|
1121
|
+
label: t("actions.edit"),
|
|
1122
|
+
to: "sales-channels",
|
|
1123
|
+
icon: /* @__PURE__ */ jsx10(PencilSquare7, {})
|
|
1124
|
+
}
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"data-testid": "product-sales-channel-action-menu"
|
|
1129
|
+
}
|
|
1130
|
+
)
|
|
1131
|
+
] }),
|
|
1132
|
+
/* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-[28px_1fr] items-center gap-x-3", "data-testid": "product-sales-channels-content", children: [
|
|
1133
|
+
/* @__PURE__ */ jsx10("div", { className: "bg-ui-bg-base shadow-borders-base flex size-7 items-center justify-center rounded-md", "data-testid": "product-sales-channels-icon-container", children: /* @__PURE__ */ jsx10("div", { className: "bg-ui-bg-component flex size-6 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx10(Channels, { className: "text-ui-fg-subtle", "data-testid": "product-sales-channels-icon" }) }) }),
|
|
1134
|
+
availableInSalesChannels.length > 0 ? /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-x-1", "data-testid": "product-sales-channels-list", children: [
|
|
1135
|
+
/* @__PURE__ */ jsx10(Text2, { size: "small", leading: "compact", "data-testid": "product-sales-channels-names", children: firstChannels.map((sc) => sc.name).join(", ") }),
|
|
1136
|
+
restChannels.length > 0 && /* @__PURE__ */ jsx10(
|
|
1137
|
+
Tooltip4,
|
|
1138
|
+
{
|
|
1139
|
+
content: /* @__PURE__ */ jsx10("ul", { children: restChannels.map((sc) => /* @__PURE__ */ jsx10("li", { children: sc.name }, sc.id)) }),
|
|
1140
|
+
"data-testid": "product-sales-channels-more-tooltip",
|
|
1141
|
+
children: /* @__PURE__ */ jsx10(
|
|
1142
|
+
Text2,
|
|
1143
|
+
{
|
|
1144
|
+
size: "small",
|
|
1145
|
+
leading: "compact",
|
|
1146
|
+
className: "text-ui-fg-subtle",
|
|
1147
|
+
"data-testid": "product-sales-channels-more-count",
|
|
1148
|
+
children: `+${restChannels.length}`
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] }) : /* @__PURE__ */ jsx10(Text2, { size: "small", leading: "compact", className: "text-ui-fg-subtle", "data-testid": "product-sales-channels-empty", children: t("products.noSalesChannels") })
|
|
1154
|
+
] }),
|
|
1155
|
+
/* @__PURE__ */ jsx10("div", { "data-testid": "product-sales-channels-stats", children: /* @__PURE__ */ jsx10(Text2, { className: "text-ui-fg-subtle", size: "small", leading: "compact", "data-testid": "product-sales-channels-stats-text", children: /* @__PURE__ */ jsx10(
|
|
1156
|
+
Trans,
|
|
1157
|
+
{
|
|
1158
|
+
i18nKey: "sales_channels.availableIn",
|
|
1159
|
+
values: {
|
|
1160
|
+
x: availableInSalesChannels.length,
|
|
1161
|
+
y: count ?? 0
|
|
1162
|
+
},
|
|
1163
|
+
components: [
|
|
1164
|
+
/* @__PURE__ */ jsx10(
|
|
1165
|
+
"span",
|
|
1166
|
+
{
|
|
1167
|
+
className: "text-ui-fg-base txt-compact-medium-plus",
|
|
1168
|
+
"data-testid": "product-sales-channels-count"
|
|
1169
|
+
},
|
|
1170
|
+
"x"
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ jsx10(
|
|
1173
|
+
"span",
|
|
1174
|
+
{
|
|
1175
|
+
className: "text-ui-fg-base txt-compact-medium-plus",
|
|
1176
|
+
"data-testid": "product-sales-channels-total"
|
|
1177
|
+
},
|
|
1178
|
+
"y"
|
|
1179
|
+
)
|
|
1180
|
+
]
|
|
1181
|
+
}
|
|
1182
|
+
) }) })
|
|
1183
|
+
] });
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1186
|
+
// src/pages/products/product-detail/components/product-shipping-profile-section/product-shipping-profile-section.tsx
|
|
1187
|
+
import { PencilSquare as PencilSquare8, ShoppingBag } from "@medusajs/icons";
|
|
1188
|
+
import { Container as Container8, Heading as Heading8 } from "@medusajs/ui";
|
|
1189
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1190
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1191
|
+
var ProductShippingProfileSection = ({
|
|
1192
|
+
product
|
|
1193
|
+
}) => {
|
|
1194
|
+
const { t } = useTranslation8();
|
|
1195
|
+
const shippingProfile = product.shipping_profile;
|
|
1196
|
+
return /* @__PURE__ */ jsxs9(Container8, { className: "p-0", "data-testid": "product-shipping-profile-section", children: [
|
|
1197
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between px-6 py-4", "data-testid": "product-shipping-profile-header", children: [
|
|
1198
|
+
/* @__PURE__ */ jsx11(Heading8, { level: "h2", "data-testid": "product-shipping-profile-title", children: t("products.shippingProfile.header") }),
|
|
1199
|
+
/* @__PURE__ */ jsx11(
|
|
1200
|
+
ActionMenu,
|
|
1201
|
+
{
|
|
1202
|
+
groups: [
|
|
1203
|
+
{
|
|
1204
|
+
actions: [
|
|
1205
|
+
{
|
|
1206
|
+
label: t("actions.edit"),
|
|
1207
|
+
to: "shipping-profile",
|
|
1208
|
+
icon: /* @__PURE__ */ jsx11(PencilSquare8, {})
|
|
1209
|
+
}
|
|
1210
|
+
]
|
|
1211
|
+
}
|
|
1212
|
+
],
|
|
1213
|
+
"data-testid": "product-shipping-profile-action-menu"
|
|
1214
|
+
}
|
|
1215
|
+
)
|
|
1216
|
+
] }),
|
|
1217
|
+
shippingProfile && /* @__PURE__ */ jsx11("div", { "data-testid": "product-shipping-profile-link-container", children: /* @__PURE__ */ jsx11(
|
|
1218
|
+
SidebarLink,
|
|
1219
|
+
{
|
|
1220
|
+
to: `/settings/locations/shipping-profiles/${shippingProfile.id}`,
|
|
1221
|
+
labelKey: shippingProfile.name,
|
|
1222
|
+
descriptionKey: shippingProfile.type,
|
|
1223
|
+
icon: /* @__PURE__ */ jsx11(ShoppingBag, {}),
|
|
1224
|
+
"data-testid": "product-shipping-profile-link"
|
|
1225
|
+
}
|
|
1226
|
+
) })
|
|
1227
|
+
] });
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
// src/pages/products/product-detail/components/product-variant-section/product-variant-section.tsx
|
|
1231
|
+
import { useCallback, useMemo } from "react";
|
|
1232
|
+
import { Buildings, Component, PencilSquare as PencilSquare9, Trash as Trash3 } from "@medusajs/icons";
|
|
1233
|
+
import {
|
|
1234
|
+
Badge as Badge3,
|
|
1235
|
+
clx as clx2,
|
|
1236
|
+
Container as Container9,
|
|
1237
|
+
createDataTableColumnHelper,
|
|
1238
|
+
createDataTableCommandHelper,
|
|
1239
|
+
createDataTableFilterHelper,
|
|
1240
|
+
Tooltip as Tooltip5,
|
|
1241
|
+
usePrompt as usePrompt4
|
|
1242
|
+
} from "@medusajs/ui";
|
|
1243
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
1244
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
1245
|
+
import { useNavigate as useNavigate2, useSearchParams } from "react-router-dom";
|
|
1246
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1247
|
+
var PAGE_SIZE = 10;
|
|
1248
|
+
var PREFIX = "pv";
|
|
1249
|
+
var ProductVariantSection = ({ product }) => {
|
|
1250
|
+
const { t } = useTranslation9();
|
|
1251
|
+
const { q, order, offset, allow_backorder, manage_inventory, created_at, updated_at } = useQueryParams(
|
|
1252
|
+
["q", "order", "offset", "manage_inventory", "allow_backorder", "created_at", "updated_at"],
|
|
1253
|
+
PREFIX
|
|
1254
|
+
);
|
|
1255
|
+
const columns = useColumns(product);
|
|
1256
|
+
const filters = useFilters();
|
|
1257
|
+
const commands = useCommands();
|
|
1258
|
+
const { variants, count, isPending, isError, error } = useProductVariants(
|
|
1259
|
+
product.id,
|
|
1260
|
+
{
|
|
1261
|
+
q,
|
|
1262
|
+
order: order ? order : "variant_rank",
|
|
1263
|
+
offset: offset ? parseInt(offset) : void 0,
|
|
1264
|
+
limit: PAGE_SIZE,
|
|
1265
|
+
allow_backorder: allow_backorder ? JSON.parse(allow_backorder) : void 0,
|
|
1266
|
+
manage_inventory: manage_inventory ? JSON.parse(manage_inventory) : void 0,
|
|
1267
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
1268
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
1269
|
+
fields: "title,sku,*options,created_at,updated_at,*inventory_items.inventory.location_levels,inventory_quantity,manage_inventory"
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
placeholderData: keepPreviousData
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
if (isError) {
|
|
1276
|
+
throw error;
|
|
1277
|
+
}
|
|
1278
|
+
return /* @__PURE__ */ jsx12(
|
|
1279
|
+
Container9,
|
|
1280
|
+
{
|
|
1281
|
+
className: "divide-y p-0",
|
|
1282
|
+
"data-testid": "product-variant-section",
|
|
1283
|
+
children: /* @__PURE__ */ jsx12("div", { "data-testid": "product-variants-table-container", children: /* @__PURE__ */ jsx12(
|
|
1284
|
+
DataTable,
|
|
1285
|
+
{
|
|
1286
|
+
data: variants,
|
|
1287
|
+
columns,
|
|
1288
|
+
filters,
|
|
1289
|
+
rowCount: count,
|
|
1290
|
+
getRowId: (row) => row.id,
|
|
1291
|
+
rowHref: (row) => `/products/${product.id}/variants/${row.id}`,
|
|
1292
|
+
pageSize: PAGE_SIZE,
|
|
1293
|
+
isLoading: isPending,
|
|
1294
|
+
heading: t("products.variants.header"),
|
|
1295
|
+
emptyState: {
|
|
1296
|
+
empty: {
|
|
1297
|
+
heading: t("products.variants.empty.heading"),
|
|
1298
|
+
description: t("products.variants.empty.description")
|
|
1299
|
+
},
|
|
1300
|
+
filtered: {
|
|
1301
|
+
heading: t("products.variants.filtered.heading"),
|
|
1302
|
+
description: t("products.variants.filtered.description")
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
action: {
|
|
1306
|
+
label: t("actions.create"),
|
|
1307
|
+
to: `variants/create`
|
|
1308
|
+
},
|
|
1309
|
+
actionMenu: {
|
|
1310
|
+
groups: [
|
|
1311
|
+
{
|
|
1312
|
+
actions: [
|
|
1313
|
+
{
|
|
1314
|
+
label: t("products.editPrices"),
|
|
1315
|
+
to: `prices`,
|
|
1316
|
+
icon: /* @__PURE__ */ jsx12(PencilSquare9, {})
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
label: t("inventory.stock.action"),
|
|
1320
|
+
to: `stock`,
|
|
1321
|
+
icon: /* @__PURE__ */ jsx12(Buildings, {})
|
|
1322
|
+
}
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
],
|
|
1326
|
+
"data-testid": "product-variant-section-action-menu"
|
|
1327
|
+
},
|
|
1328
|
+
commands,
|
|
1329
|
+
prefix: PREFIX
|
|
1330
|
+
}
|
|
1331
|
+
) })
|
|
1332
|
+
}
|
|
1333
|
+
);
|
|
1334
|
+
};
|
|
1335
|
+
var columnHelper = createDataTableColumnHelper();
|
|
1336
|
+
var useColumns = (product) => {
|
|
1337
|
+
const { t } = useTranslation9();
|
|
1338
|
+
const navigate = useNavigate2();
|
|
1339
|
+
const { mutateAsync } = useDeleteVariantLazy(product.id);
|
|
1340
|
+
const prompt = usePrompt4();
|
|
1341
|
+
const [searchParams] = useSearchParams();
|
|
1342
|
+
const tableSearchParams = useMemo(() => {
|
|
1343
|
+
const filtered = new URLSearchParams();
|
|
1344
|
+
for (const [key, value] of searchParams.entries()) {
|
|
1345
|
+
if (key.startsWith(`${PREFIX}_`)) {
|
|
1346
|
+
filtered.append(key, value);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return filtered;
|
|
1350
|
+
}, [searchParams]);
|
|
1351
|
+
const dateColumns = useDataTableDateColumns();
|
|
1352
|
+
const handleDelete = useCallback(
|
|
1353
|
+
async (id, title) => {
|
|
1354
|
+
const res = await prompt({
|
|
1355
|
+
title: t("general.areYouSure"),
|
|
1356
|
+
description: t("products.deleteVariantWarning", {
|
|
1357
|
+
title
|
|
1358
|
+
}),
|
|
1359
|
+
confirmText: t("actions.delete"),
|
|
1360
|
+
cancelText: t("actions.cancel")
|
|
1361
|
+
});
|
|
1362
|
+
if (!res) {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
await mutateAsync({ variantId: id });
|
|
1366
|
+
},
|
|
1367
|
+
[mutateAsync, prompt, t]
|
|
1368
|
+
);
|
|
1369
|
+
const optionColumns = useMemo(() => {
|
|
1370
|
+
if (!product?.options) {
|
|
1371
|
+
return [];
|
|
1372
|
+
}
|
|
1373
|
+
return product.options.map((option) => {
|
|
1374
|
+
return columnHelper.display({
|
|
1375
|
+
id: option.id,
|
|
1376
|
+
header: option.title,
|
|
1377
|
+
cell: ({ row }) => {
|
|
1378
|
+
const variantOpt = row.original.options?.find((opt) => opt.option_id === option.id);
|
|
1379
|
+
if (!variantOpt) {
|
|
1380
|
+
return /* @__PURE__ */ jsx12("span", { className: "text-ui-fg-muted", children: "-" });
|
|
1381
|
+
}
|
|
1382
|
+
return /* @__PURE__ */ jsx12(
|
|
1383
|
+
"div",
|
|
1384
|
+
{
|
|
1385
|
+
className: "flex items-center",
|
|
1386
|
+
"data-testid": `product-variant-option-${option.id}-${row.original.id}`,
|
|
1387
|
+
children: /* @__PURE__ */ jsx12(Tooltip5, { content: variantOpt.value, children: /* @__PURE__ */ jsx12(
|
|
1388
|
+
Badge3,
|
|
1389
|
+
{
|
|
1390
|
+
size: "2xsmall",
|
|
1391
|
+
title: variantOpt.value,
|
|
1392
|
+
className: "inline-flex min-w-[20px] max-w-[140px] items-center justify-center overflow-hidden truncate",
|
|
1393
|
+
"data-testid": `product-variant-option-badge-${option.id}-${row.original.id}-${variantOpt.value}`,
|
|
1394
|
+
children: variantOpt.value
|
|
1395
|
+
}
|
|
1396
|
+
) })
|
|
1397
|
+
}
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1402
|
+
}, [product]);
|
|
1403
|
+
const getActions = useCallback(
|
|
1404
|
+
(ctx) => {
|
|
1405
|
+
const variant = ctx.row.original;
|
|
1406
|
+
const mainActions = [
|
|
1407
|
+
{
|
|
1408
|
+
icon: /* @__PURE__ */ jsx12(PencilSquare9, {}),
|
|
1409
|
+
label: t("actions.edit"),
|
|
1410
|
+
onClick: (row) => {
|
|
1411
|
+
navigate(
|
|
1412
|
+
`edit-variant?variant_id=${row.row.original.id}&${tableSearchParams.toString()}`,
|
|
1413
|
+
{
|
|
1414
|
+
state: {
|
|
1415
|
+
restore_params: tableSearchParams.toString()
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
];
|
|
1422
|
+
const secondaryActions = [
|
|
1423
|
+
{
|
|
1424
|
+
icon: /* @__PURE__ */ jsx12(Trash3, {}),
|
|
1425
|
+
label: t("actions.delete"),
|
|
1426
|
+
onClick: () => handleDelete(variant.id, variant.title)
|
|
1427
|
+
}
|
|
1428
|
+
];
|
|
1429
|
+
const inventoryItemsCount = variant.inventory_items?.length || 0;
|
|
1430
|
+
switch (inventoryItemsCount) {
|
|
1431
|
+
case 0:
|
|
1432
|
+
break;
|
|
1433
|
+
case 1: {
|
|
1434
|
+
const inventoryItemLink = `/inventory/${variant.inventory_items[0].inventory.id}`;
|
|
1435
|
+
mainActions.push({
|
|
1436
|
+
label: t("products.variant.inventory.actions.inventoryItems"),
|
|
1437
|
+
onClick: () => {
|
|
1438
|
+
navigate(inventoryItemLink);
|
|
1439
|
+
},
|
|
1440
|
+
icon: /* @__PURE__ */ jsx12(Buildings, {})
|
|
1441
|
+
});
|
|
1442
|
+
break;
|
|
1443
|
+
}
|
|
1444
|
+
default: {
|
|
1445
|
+
const ids = variant.inventory_items?.map((i) => i.inventory?.id);
|
|
1446
|
+
if (!ids || ids.length === 0) {
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
const inventoryKitLink = `/inventory?${new URLSearchParams({
|
|
1450
|
+
id: ids.join(",")
|
|
1451
|
+
}).toString()}`;
|
|
1452
|
+
mainActions.push({
|
|
1453
|
+
label: t("products.variant.inventory.actions.inventoryKit"),
|
|
1454
|
+
onClick: () => {
|
|
1455
|
+
navigate(inventoryKitLink);
|
|
1456
|
+
},
|
|
1457
|
+
icon: /* @__PURE__ */ jsx12(Component, {})
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
return [mainActions, secondaryActions];
|
|
1462
|
+
},
|
|
1463
|
+
[handleDelete, navigate, t, tableSearchParams]
|
|
1464
|
+
);
|
|
1465
|
+
const getInventory = useCallback(
|
|
1466
|
+
(variant) => {
|
|
1467
|
+
const castVariant = variant;
|
|
1468
|
+
if (!variant.manage_inventory) {
|
|
1469
|
+
return {
|
|
1470
|
+
text: t("products.variant.inventory.notManaged"),
|
|
1471
|
+
hasInventoryKit: false,
|
|
1472
|
+
notManaged: true
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
const quantity = variant.inventory_quantity;
|
|
1476
|
+
const inventoryItems = castVariant.inventory_items?.map((i) => i.inventory).filter(Boolean);
|
|
1477
|
+
const hasInventoryKit = inventoryItems.length > 1;
|
|
1478
|
+
const locations = {};
|
|
1479
|
+
inventoryItems.forEach((i) => {
|
|
1480
|
+
i.location_levels?.forEach((l) => {
|
|
1481
|
+
locations[l.id] = true;
|
|
1482
|
+
});
|
|
1483
|
+
});
|
|
1484
|
+
const locationCount = Object.keys(locations).length;
|
|
1485
|
+
const text = hasInventoryKit ? t("products.variant.tableItemAvailable", {
|
|
1486
|
+
availableCount: quantity
|
|
1487
|
+
}) : t("products.variant.tableItem", {
|
|
1488
|
+
availableCount: quantity,
|
|
1489
|
+
locationCount,
|
|
1490
|
+
count: locationCount
|
|
1491
|
+
});
|
|
1492
|
+
return { text, hasInventoryKit, quantity, notManaged: false };
|
|
1493
|
+
},
|
|
1494
|
+
[t]
|
|
1495
|
+
);
|
|
1496
|
+
return useMemo(() => {
|
|
1497
|
+
return [
|
|
1498
|
+
columnHelper.accessor("title", {
|
|
1499
|
+
header: t("fields.title"),
|
|
1500
|
+
enableSorting: true,
|
|
1501
|
+
sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
|
|
1502
|
+
sortDescLabel: t("filters.sorting.alphabeticallyDesc")
|
|
1503
|
+
}),
|
|
1504
|
+
columnHelper.accessor("sku", {
|
|
1505
|
+
header: t("fields.sku"),
|
|
1506
|
+
enableSorting: true,
|
|
1507
|
+
sortAscLabel: t("filters.sorting.alphabeticallyAsc"),
|
|
1508
|
+
sortDescLabel: t("filters.sorting.alphabeticallyDesc")
|
|
1509
|
+
}),
|
|
1510
|
+
...optionColumns,
|
|
1511
|
+
columnHelper.display({
|
|
1512
|
+
id: "inventory",
|
|
1513
|
+
header: t("fields.inventory"),
|
|
1514
|
+
cell: ({ row }) => {
|
|
1515
|
+
const { text, hasInventoryKit, quantity, notManaged } = getInventory(row.original);
|
|
1516
|
+
return /* @__PURE__ */ jsx12(Tooltip5, { content: text, children: /* @__PURE__ */ jsxs10(
|
|
1517
|
+
"div",
|
|
1518
|
+
{
|
|
1519
|
+
className: "flex h-full w-full items-center gap-2 overflow-hidden",
|
|
1520
|
+
"data-testid": `product-variant-inventory-${row.original.id}`,
|
|
1521
|
+
children: [
|
|
1522
|
+
hasInventoryKit && /* @__PURE__ */ jsx12(
|
|
1523
|
+
Component,
|
|
1524
|
+
{
|
|
1525
|
+
"data-testid": `product-variant-inventory-kit-icon-${row.original.id}`
|
|
1526
|
+
}
|
|
1527
|
+
),
|
|
1528
|
+
/* @__PURE__ */ jsx12(
|
|
1529
|
+
"span",
|
|
1530
|
+
{
|
|
1531
|
+
className: clx2("truncate", {
|
|
1532
|
+
"text-ui-fg-error": !quantity && !notManaged
|
|
1533
|
+
}),
|
|
1534
|
+
"data-testid": `product-variant-inventory-text-${row.original.id}`,
|
|
1535
|
+
children: text
|
|
1536
|
+
}
|
|
1537
|
+
)
|
|
1538
|
+
]
|
|
1539
|
+
}
|
|
1540
|
+
) });
|
|
1541
|
+
},
|
|
1542
|
+
maxSize: 250
|
|
1543
|
+
}),
|
|
1544
|
+
...dateColumns,
|
|
1545
|
+
columnHelper.action({
|
|
1546
|
+
actions: getActions
|
|
1547
|
+
})
|
|
1548
|
+
];
|
|
1549
|
+
}, [t, optionColumns, dateColumns, getActions, getInventory]);
|
|
1550
|
+
};
|
|
1551
|
+
var filterHelper = createDataTableFilterHelper();
|
|
1552
|
+
var useFilters = () => {
|
|
1553
|
+
const { t } = useTranslation9();
|
|
1554
|
+
const dateFilters = useDataTableDateFilters();
|
|
1555
|
+
return useMemo(() => {
|
|
1556
|
+
return [
|
|
1557
|
+
filterHelper.accessor("allow_backorder", {
|
|
1558
|
+
type: "radio",
|
|
1559
|
+
label: t("fields.allowBackorder"),
|
|
1560
|
+
options: [
|
|
1561
|
+
{ label: t("filters.radio.yes"), value: "true" },
|
|
1562
|
+
{ label: t("filters.radio.no"), value: "false" }
|
|
1563
|
+
]
|
|
1564
|
+
}),
|
|
1565
|
+
filterHelper.accessor("manage_inventory", {
|
|
1566
|
+
type: "radio",
|
|
1567
|
+
label: t("fields.manageInventory"),
|
|
1568
|
+
options: [
|
|
1569
|
+
{ label: t("filters.radio.yes"), value: "true" },
|
|
1570
|
+
{ label: t("filters.radio.no"), value: "false" }
|
|
1571
|
+
]
|
|
1572
|
+
}),
|
|
1573
|
+
...dateFilters
|
|
1574
|
+
];
|
|
1575
|
+
}, [t, dateFilters]);
|
|
1576
|
+
};
|
|
1577
|
+
var commandHelper = createDataTableCommandHelper();
|
|
1578
|
+
var useCommands = () => {
|
|
1579
|
+
const { t } = useTranslation9();
|
|
1580
|
+
const navigate = useNavigate2();
|
|
1581
|
+
return [
|
|
1582
|
+
commandHelper.command({
|
|
1583
|
+
label: t("inventory.stock.action"),
|
|
1584
|
+
shortcut: "i",
|
|
1585
|
+
action: async (selection) => {
|
|
1586
|
+
navigate(`stock?${PRODUCT_VARIANT_IDS_KEY}=${Object.keys(selection).join(",")}`);
|
|
1587
|
+
}
|
|
1588
|
+
})
|
|
1589
|
+
];
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/pages/products/product-detail/product-detail.tsx
|
|
1593
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1594
|
+
var ProductDetail = () => {
|
|
1595
|
+
const initialData = useLoaderData();
|
|
1596
|
+
const { id } = useParams2();
|
|
1597
|
+
const { product, isLoading, isError, error } = useProduct(
|
|
1598
|
+
id,
|
|
1599
|
+
{},
|
|
1600
|
+
{
|
|
1601
|
+
initialData
|
|
1602
|
+
}
|
|
1603
|
+
);
|
|
1604
|
+
if (isLoading || !product) {
|
|
1605
|
+
return /* @__PURE__ */ jsx13(
|
|
1606
|
+
TwoColumnPageSkeleton,
|
|
1607
|
+
{
|
|
1608
|
+
mainSections: 4,
|
|
1609
|
+
sidebarSections: 3,
|
|
1610
|
+
showJSON: true,
|
|
1611
|
+
showMetadata: true
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
if (isError) {
|
|
1616
|
+
throw error;
|
|
1617
|
+
}
|
|
1618
|
+
return /* @__PURE__ */ jsx13("div", { "data-testid": "product-detail-page", children: /* @__PURE__ */ jsxs11(TwoColumnPage, { showJSON: true, showMetadata: true, data: product, children: [
|
|
1619
|
+
/* @__PURE__ */ jsxs11(TwoColumnPage.Main, { "data-testid": "product-detail-main", children: [
|
|
1620
|
+
/* @__PURE__ */ jsx13(ProductGeneralSection, { product }),
|
|
1621
|
+
/* @__PURE__ */ jsx13(ProductMediaSection, { product }),
|
|
1622
|
+
/* @__PURE__ */ jsx13(ProductOptionSection, { product }),
|
|
1623
|
+
/* @__PURE__ */ jsx13(ProductVariantSection, { product })
|
|
1624
|
+
] }),
|
|
1625
|
+
/* @__PURE__ */ jsxs11(TwoColumnPage.Sidebar, { "data-testid": "product-detail-sidebar", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx13(ProductSalesChannelSection, { product }),
|
|
1627
|
+
/* @__PURE__ */ jsx13(ProductShippingProfileSection, { product }),
|
|
1628
|
+
/* @__PURE__ */ jsx13(ProductOrganizationSection, { product }),
|
|
1629
|
+
/* @__PURE__ */ jsx13(ProductAttributeSection, { product }),
|
|
1630
|
+
/* @__PURE__ */ jsx13(ProductAdditionalAttributeSection, {})
|
|
1631
|
+
] })
|
|
1632
|
+
] }) });
|
|
1633
|
+
};
|
|
1634
|
+
export {
|
|
1635
|
+
ProductDetailBreadcrumb as Breadcrumb,
|
|
1636
|
+
ProductDetail as Component,
|
|
1637
|
+
productLoader as loader
|
|
1638
|
+
};
|