@medusajs/dashboard 3.0.0-snapshot-20251104011621 → 3.0.0-snapshot-20251106181920
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/{adjust-inventory-7EWRE2HD.mjs → adjust-inventory-MEJEPP4Y.mjs} +1 -1
- package/dist/{api-key-management-create-SPLD3JMO.mjs → api-key-management-create-4OZWVOSF.mjs} +3 -3
- package/dist/{api-key-management-detail-MFQTHUN6.mjs → api-key-management-detail-K3A3T6ET.mjs} +13 -13
- package/dist/{api-key-management-edit-2VPL7PHB.mjs → api-key-management-edit-FYLVVQOA.mjs} +3 -3
- package/dist/{api-key-management-list-22GXXJUC.mjs → api-key-management-list-6YG52LWY.mjs} +3 -3
- package/dist/{api-key-management-sales-channels-MV6FMA4C.mjs → api-key-management-sales-channels-S5IFH7LP.mjs} +4 -4
- package/dist/app.css +3 -3
- package/dist/app.js +16852 -15621
- package/dist/app.mjs +12 -12
- package/dist/{campaign-create-GD2D45NX.mjs → campaign-create-NEKUWDGF.mjs} +2 -2
- package/dist/{campaign-detail-IKHUALTL.mjs → campaign-detail-2H2W4W5B.mjs} +10 -10
- package/dist/{categories-metadata-2HM7G27P.mjs → categories-metadata-ZEYU33GV.mjs} +10 -10
- package/dist/{category-create-BC2VUVKO.mjs → category-create-N7PP3GWU.mjs} +5 -5
- package/dist/{category-detail-D4PYJJGJ.mjs → category-detail-DKY37LPO.mjs} +14 -14
- package/dist/{category-edit-U5Y5KJ2Y.mjs → category-edit-IFDQP7EZ.mjs} +2 -2
- package/dist/{category-list-MLLB5U6K.mjs → category-list-2M4BCRAL.mjs} +5 -5
- package/dist/{category-organize-4NXFDN2I.mjs → category-organize-76I7PO24.mjs} +2 -2
- package/dist/{category-products-K5INZSSV.mjs → category-products-VVRGW25X.mjs} +13 -13
- package/dist/{chunk-XXROCJ7D.mjs → chunk-227DWSFF.mjs} +15 -15
- package/dist/{chunk-IKXQEHLS.mjs → chunk-3G33PZVQ.mjs} +1 -1
- package/dist/{chunk-ULQ3V4CC.mjs → chunk-3MPO56OL.mjs} +2 -2
- package/dist/{chunk-MQALAB34.mjs → chunk-7PWZ5GMG.mjs} +1 -1
- package/dist/{chunk-PYIPIUAY.mjs → chunk-ET6EGRW3.mjs} +332 -241
- package/dist/{chunk-6IXLTZ2H.mjs → chunk-FA5QNPXE.mjs} +2 -2
- package/dist/{chunk-IXZVR3HG.mjs → chunk-GBKLLUUX.mjs} +1 -1
- package/dist/{chunk-ALKTJGWS.mjs → chunk-GI6XX5VU.mjs} +2 -2
- package/dist/{chunk-4BGVSXZZ.mjs → chunk-GVPJPLE2.mjs} +15 -48
- package/dist/{chunk-6XWHQ6ON.mjs → chunk-GVVAVAXG.mjs} +1 -1
- package/dist/{chunk-3DO2JGVG.mjs → chunk-HGFZAXHD.mjs} +1 -1
- package/dist/{chunk-3C6WQ7NH.mjs → chunk-IBSMG7AF.mjs} +37 -3
- package/dist/{chunk-EQKJ5FSL.mjs → chunk-JAXWGF4M.mjs} +1 -1
- package/dist/{chunk-LEKWKUIS.mjs → chunk-JC75WAC7.mjs} +3 -3
- package/dist/{chunk-ZUUKLYH4.mjs → chunk-JDA2MYND.mjs} +1 -1
- package/dist/{chunk-LOAL44PP.mjs → chunk-JDEH6Z4M.mjs} +1 -1
- package/dist/{chunk-2O43G3RH.mjs → chunk-LYTIMAIZ.mjs} +1 -1
- package/dist/{chunk-OGAZYXOV.mjs → chunk-NGR5XU3K.mjs} +1 -1
- package/dist/{chunk-3JJBLFYN.mjs → chunk-OI4W5AEL.mjs} +6 -2
- package/dist/{chunk-XYHXWLTJ.mjs → chunk-P5RVJWPK.mjs} +1 -1
- package/dist/{chunk-WTK7SR6S.mjs → chunk-SBFWPL42.mjs} +2 -2
- package/dist/{chunk-NDXL7ZT5.mjs → chunk-TNMXAPPT.mjs} +1 -1
- package/dist/{chunk-TUCPFNIY.mjs → chunk-UTVAHVAY.mjs} +5 -5
- package/dist/{chunk-KXRW6JRE.mjs → chunk-WOFUOGLO.mjs} +123 -33
- package/dist/{chunk-N4N4KGET.mjs → chunk-WWQZD7WM.mjs} +1 -1
- package/dist/{chunk-R2QF6AQX.mjs → chunk-Y6ZQFV7H.mjs} +1 -1
- package/dist/{chunk-VLOA5XAC.mjs → chunk-YCDDT44O.mjs} +8 -4
- package/dist/{chunk-YL4UEHO3.mjs → chunk-YSQG2JDM.mjs} +1 -1
- package/dist/chunk-ZHH3W7CN.mjs +171 -0
- package/dist/{collection-add-products-TWIDVZMU.mjs → collection-add-products-QCSFXELK.mjs} +14 -14
- package/dist/{collection-create-CUZFWEOB.mjs → collection-create-45RYGDW7.mjs} +2 -2
- package/dist/{collection-detail-B33WPVIW.mjs → collection-detail-OLC6DMBZ.mjs} +14 -14
- package/dist/{collection-edit-22I7EEJG.mjs → collection-edit-YBPBHLLZ.mjs} +2 -2
- package/dist/{collection-list-DAW7WOX5.mjs → collection-list-6UJNE2QB.mjs} +24 -23
- package/dist/{collection-metadata-ZUFYY4OU.mjs → collection-metadata-QG55V5ZM.mjs} +11 -11
- package/dist/{customer-detail-ATJGSJTH.mjs → customer-detail-XOCZDUJL.mjs} +14 -14
- package/dist/{customer-group-detail-OVZIWNPP.mjs → customer-group-detail-EWSDTVTQ.mjs} +13 -13
- package/dist/{customer-group-list-SADXXHAE.mjs → customer-group-list-NFXAELFY.mjs} +13 -13
- package/dist/{customers-add-customer-group-XNPZ47LK.mjs → customers-add-customer-group-EYZMFVBS.mjs} +13 -13
- package/dist/{edit-inventory-item-5RPZHCM7.mjs → edit-inventory-item-TFJL5H5X.mjs} +1 -1
- package/dist/{edit-inventory-item-attributes-R73ZTBYG.mjs → edit-inventory-item-attributes-O3K7OB56.mjs} +1 -1
- package/dist/{edit-reservation-WMLAFMYU.mjs → edit-reservation-Z5TFZERY.mjs} +2 -2
- package/dist/{edit-rules-KV43O773.mjs → edit-rules-IE77WUXD.mjs} +10 -10
- package/dist/en.json +51 -4
- package/dist/{inventory-create-NW5WSPBV.mjs → inventory-create-HQ5XLKOJ.mjs} +10 -10
- package/dist/{inventory-detail-I2CNJC6Y.mjs → inventory-detail-DAINM7WP.mjs} +10 -10
- package/dist/{inventory-list-I7IXI4KC.mjs → inventory-list-5ROSUTXF.mjs} +1 -1
- package/dist/{inventory-metadata-7XR4ON7G.mjs → inventory-metadata-HUL56OD2.mjs} +10 -10
- package/dist/{inventory-stock-VTIDGTOY.mjs → inventory-stock-5VIUWKTQ.mjs} +10 -10
- package/dist/{location-detail-WZM4EXFM.mjs → location-detail-QMLCFID5.mjs} +15 -15
- package/dist/{location-fulfillment-providers-F7MMM5KC.mjs → location-fulfillment-providers-NAFFMP3P.mjs} +15 -14
- package/dist/{location-sales-channels-J3V26P3Q.mjs → location-sales-channels-D37LXTKQ.mjs} +3 -3
- package/dist/{location-service-zone-shipping-option-create-F3EQW67U.mjs → location-service-zone-shipping-option-create-VM4TEJHY.mjs} +10 -10
- package/dist/{login-VZALGB6R.mjs → login-MTGOV7KC.mjs} +10 -10
- package/dist/{manage-locations-ZRCDYW5V.mjs → manage-locations-OHDFBORX.mjs} +2 -2
- package/dist/{order-allocate-items-MZ7Y4FU4.mjs → order-allocate-items-NU65ZXHE.mjs} +3 -3
- package/dist/{order-create-claim-VFFKHCI6.mjs → order-create-claim-LTE2E75R.mjs} +16 -16
- package/dist/{order-create-edit-7TFUOMST.mjs → order-create-edit-TPU3CKUU.mjs} +11 -11
- package/dist/{order-create-exchange-CXQ5ZM3Q.mjs → order-create-exchange-FVSBZI7P.mjs} +22 -22
- package/dist/{order-create-fulfillment-VTICR6OE.mjs → order-create-fulfillment-NFGPDCBV.mjs} +13 -13
- package/dist/{order-create-refund-RWDVIXPV.mjs → order-create-refund-DC7C3R4Y.mjs} +15 -15
- package/dist/{order-create-return-AYWH3WMR.mjs → order-create-return-RLXYVZLO.mjs} +4 -4
- package/dist/{order-create-shipment-2KNYEHSU.mjs → order-create-shipment-RDYWCG3A.mjs} +10 -10
- package/dist/{order-detail-IFXJNVTV.mjs → order-detail-VVOZ6E2R.mjs} +31 -31
- package/dist/{order-edit-billing-address-T6BIIRAX.mjs → order-edit-billing-address-LV7453CS.mjs} +10 -10
- package/dist/{order-edit-email-SLUOGWRO.mjs → order-edit-email-4U5C6UKX.mjs} +10 -10
- package/dist/{order-edit-shipping-address-YUES5K5Q.mjs → order-edit-shipping-address-6IQC2CVP.mjs} +10 -10
- package/dist/{order-list-4N3OV2PU.mjs → order-list-INSYF52F.mjs} +5 -5
- package/dist/{order-metadata-HS33MC6S.mjs → order-metadata-EEV4IWOM.mjs} +10 -10
- package/dist/{order-receive-return-E6BGSZVL.mjs → order-receive-return-IWHR3EBF.mjs} +11 -11
- package/dist/{order-request-transfer-7IIDQ37I.mjs → order-request-transfer-65R4A7HS.mjs} +10 -10
- package/dist/{price-list-configuration-4XY4JW4I.mjs → price-list-configuration-L5XYCVP2.mjs} +4 -4
- package/dist/{price-list-create-VFQVCUWV.mjs → price-list-create-5GIMBRG2.mjs} +17 -17
- package/dist/{price-list-detail-32UKOWNW.mjs → price-list-detail-7AL2EBRL.mjs} +17 -17
- package/dist/{price-list-edit-GXDLVOU4.mjs → price-list-edit-DHG5STG4.mjs} +2 -2
- package/dist/{price-list-list-TKXSU27S.mjs → price-list-list-QQKZEFSU.mjs} +3 -3
- package/dist/{price-list-prices-add-AY75YZ7D.mjs → price-list-prices-add-2OO4QEZB.mjs} +13 -13
- package/dist/{price-list-prices-edit-J7HCNDTO.mjs → price-list-prices-edit-2FB25KWU.mjs} +2 -2
- package/dist/{product-attributes-3GCAY7KW.mjs → product-attributes-CCQ6WAOD.mjs} +13 -13
- package/dist/{product-create-4TD7FQC7.mjs → product-create-AIRCVZAE.mjs} +343 -549
- package/dist/{product-create-variant-ZWY57BX7.mjs → product-create-variant-7BD5KQHQ.mjs} +10 -10
- package/dist/{product-detail-J7T7MNUY.mjs → product-detail-IYMXYAPH.mjs} +27 -54
- package/dist/{product-edit-MJ7VAIVY.mjs → product-edit-PDGQHCQ2.mjs} +13 -13
- package/dist/{product-export-X64NQWTS.mjs → product-export-5EINLQDF.mjs} +23 -22
- package/dist/{product-image-variants-edit-J6A5G4AC.mjs → product-image-variants-edit-DDSEBG5H.mjs} +10 -10
- package/dist/{product-import-HDNC36SM.mjs → product-import-IQJWHNYN.mjs} +16 -16
- package/dist/{product-list-E7HS4SBG.mjs → product-list-PUQEGU75.mjs} +17 -17
- package/dist/{product-media-Z3NNTB7H.mjs → product-media-Q5XFYZRS.mjs} +2 -2
- package/dist/{product-metadata-LMDEXR3V.mjs → product-metadata-WCKNOZXX.mjs} +10 -10
- package/dist/product-option-create-MWFWB2SU.mjs +336 -0
- package/dist/product-option-detail-UKKEZPG7.mjs +323 -0
- package/dist/product-option-edit-NHAF7B4P.mjs +324 -0
- package/dist/product-option-list-C6ZR2WIX.mjs +266 -0
- package/dist/product-option-metadata-OWSGHNDC.mjs +71 -0
- package/dist/product-options-manage-N73G5IXY.mjs +206 -0
- package/dist/{product-organization-263TICCI.mjs → product-organization-HHME5F2C.mjs} +14 -14
- package/dist/{product-prices-MCZYVPQW.mjs → product-prices-GVEPABHQ.mjs} +1 -1
- package/dist/{product-sales-channels-RHZQXWAY.mjs → product-sales-channels-ZC5ONPG7.mjs} +3 -3
- package/dist/{product-shipping-profile-GVTR3MHD.mjs → product-shipping-profile-KXSBDGRD.mjs} +13 -13
- package/dist/{product-stock-O2BH5R45.mjs → product-stock-LXRLD7FA.mjs} +10 -10
- package/dist/{product-tag-create-GOJTE5XA.mjs → product-tag-create-RAJEWM5O.mjs} +10 -10
- package/dist/{product-tag-detail-CK5F4DU3.mjs → product-tag-detail-EOW2GMOL.mjs} +28 -27
- package/dist/{product-tag-edit-IT4GHLSO.mjs → product-tag-edit-ZOO56XMF.mjs} +10 -10
- package/dist/{product-tag-list-VNROS2W3.mjs → product-tag-list-B2UX2OHB.mjs} +26 -25
- package/dist/{product-tag-metadata-QV2BOGP2.mjs → product-tag-metadata-OZB7SVDN.mjs} +10 -10
- package/dist/{product-type-detail-7K5RLART.mjs → product-type-detail-4YZUC6ZS.mjs} +13 -13
- package/dist/{product-type-metadata-5TDBJGNQ.mjs → product-type-metadata-6QT47ZSR.mjs} +10 -10
- package/dist/{product-variant-detail-3SO2MX22.mjs → product-variant-detail-HOOYZSS2.mjs} +10 -10
- package/dist/{product-variant-edit-DW27AYBX.mjs → product-variant-edit-J2MTJA75.mjs} +10 -10
- package/dist/{product-variant-manage-inventory-items-T5OB3YX3.mjs → product-variant-manage-inventory-items-P4QUORRH.mjs} +1 -1
- package/dist/{product-variant-media-PHRCKUDK.mjs → product-variant-media-U5RG7AOW.mjs} +1 -1
- package/dist/{product-variant-metadata-4KJE6B2R.mjs → product-variant-metadata-ZRSZO2D4.mjs} +10 -10
- package/dist/{promotion-create-F27AOTVZ.mjs → promotion-create-2E4EF4SP.mjs} +15 -15
- package/dist/{promotion-detail-ZDINJASC.mjs → promotion-detail-P2BHIQDG.mjs} +10 -10
- package/dist/{refund-reason-create-5ATQ2IPU.mjs → refund-reason-create-I3BIJFJH.mjs} +10 -10
- package/dist/{refund-reason-edit-F7AMOTG3.mjs → refund-reason-edit-2BEZASQH.mjs} +10 -10
- package/dist/{refund-reason-list-SFTHVSPC.mjs → refund-reason-list-NIJHHOXJ.mjs} +13 -13
- package/dist/{region-metadata-CRAHVHOC.mjs → region-metadata-RLZSQNGW.mjs} +10 -10
- package/dist/{reservation-create-YZMZ6HSS.mjs → reservation-create-4R2XEEZU.mjs} +2 -2
- package/dist/{reservation-detail-6MCBQZAE.mjs → reservation-detail-7OYGNK4L.mjs} +10 -10
- package/dist/{reservation-list-IEUC3KXK.mjs → reservation-list-VY44QEH6.mjs} +2 -2
- package/dist/{reservation-metadata-IQNJPNAX.mjs → reservation-metadata-VJIAGIMF.mjs} +10 -10
- package/dist/{sales-channel-add-products-7RKUDBXN.mjs → sales-channel-add-products-KAUMNKMD.mjs} +13 -13
- package/dist/{sales-channel-create-7ISLGNGC.mjs → sales-channel-create-I6ME6QBM.mjs} +2 -2
- package/dist/{sales-channel-detail-TKVVIAS5.mjs → sales-channel-detail-5SXDKP6P.mjs} +13 -13
- package/dist/{sales-channel-edit-2PEHGAWF.mjs → sales-channel-edit-O7GM2B6O.mjs} +2 -2
- package/dist/{sales-channel-list-SI7JVBOI.mjs → sales-channel-list-JKZ6TIY7.mjs} +11 -11
- package/dist/{sales-channel-metadata-ZOCPAIGM.mjs → sales-channel-metadata-33P5SKDI.mjs} +10 -10
- package/dist/{shipping-option-type-create-YR2QV2OG.mjs → shipping-option-type-create-KVYNWD2Q.mjs} +10 -10
- package/dist/{shipping-option-type-detail-TYHGCV2X.mjs → shipping-option-type-detail-YX3HMXNI.mjs} +11 -11
- package/dist/{shipping-option-type-edit-6KL3MHVT.mjs → shipping-option-type-edit-ODXQMHYJ.mjs} +10 -10
- package/dist/{shipping-option-type-list-YPCCUVFZ.mjs → shipping-option-type-list-XCQNWDDA.mjs} +11 -11
- package/dist/{shipping-profile-metadata-A33XKBQN.mjs → shipping-profile-metadata-K34DAKGY.mjs} +10 -10
- package/dist/{store-detail-3ZV7FCPV.mjs → store-detail-3Z3BK2BH.mjs} +10 -10
- package/dist/{store-metadata-LMRFCZ3J.mjs → store-metadata-FESGAO7E.mjs} +10 -10
- package/dist/{tax-region-create-5Y6EA7XE.mjs → tax-region-create-EVFVC6HN.mjs} +10 -10
- package/dist/{tax-region-detail-TTYUBJ3V.mjs → tax-region-detail-ULHK52CD.mjs} +29 -28
- package/dist/{tax-region-edit-IKEWHRUK.mjs → tax-region-edit-CXEPD2F2.mjs} +10 -10
- package/dist/{tax-region-province-detail-YCY56CRL.mjs → tax-region-province-detail-VUY4PDGN.mjs} +29 -28
- package/dist/{tax-region-tax-override-create-R3PNDP43.mjs → tax-region-tax-override-create-WWZZVAG5.mjs} +28 -27
- package/dist/{tax-region-tax-override-edit-QLD7MIQY.mjs → tax-region-tax-override-edit-HVZRD44G.mjs} +27 -26
- package/dist/{user-detail-DFZPKHG2.mjs → user-detail-YTVBPRH5.mjs} +1 -1
- package/dist/{user-metadata-BQKW4WAU.mjs → user-metadata-33W3JSHN.mjs} +10 -10
- package/dist/{workflow-execution-detail-D5QUZFTV.mjs → workflow-execution-detail-SHEXD5OL.mjs} +10 -10
- package/package.json +9 -9
- package/src/components/common/infinite-list/infinite-list.tsx +9 -4
- package/src/components/layout/main-layout/main-layout.tsx +7 -4
- package/src/dashboard-app/dashboard-app.tsx +10 -2
- package/src/dashboard-app/routes/get-route.map.tsx +64 -12
- package/src/dashboard-app/routes/utils.ts +14 -6
- package/src/hooks/api/index.ts +1 -0
- package/src/hooks/api/product-options.tsx +151 -0
- package/src/hooks/api/products.tsx +23 -63
- package/src/hooks/table/columns/use-product-option-table-columns.tsx +43 -0
- package/src/hooks/table/filters/index.ts +1 -0
- package/src/hooks/table/filters/use-product-option-table-filters.tsx +33 -0
- package/src/hooks/table/query/use-product-option-table-query.tsx +34 -0
- package/src/i18n/translations/$schema.json +176 -5
- package/src/i18n/translations/en.json +51 -4
- package/src/routes/product-options/common/hooks/use-delete-product-option-action.tsx +41 -0
- package/src/routes/product-options/product-option-create/components/create-product-option-form/create-product-option-details.tsx +71 -0
- package/src/routes/product-options/product-option-create/components/create-product-option-form/create-product-option-form.tsx +192 -0
- package/src/routes/product-options/product-option-create/components/create-product-option-form/create-product-option-organize.tsx +77 -0
- package/src/routes/product-options/product-option-create/components/create-product-option-form/index.ts +1 -0
- package/src/routes/product-options/product-option-create/components/create-product-option-form/schema.ts +15 -0
- package/src/routes/product-options/product-option-create/index.ts +1 -0
- package/src/routes/product-options/product-option-create/product-option-create.tsx +10 -0
- package/src/routes/product-options/product-option-detail/breadcrumb.tsx +14 -0
- package/src/routes/product-options/product-option-detail/components/product-option-general-section/index.ts +1 -0
- package/src/routes/product-options/product-option-detail/components/product-option-general-section/product-option-general-section.tsx +81 -0
- package/src/routes/product-options/product-option-detail/components/product-option-product-section/index.ts +1 -0
- package/src/routes/product-options/product-option-detail/components/product-option-product-section/product-option-product-section.tsx +74 -0
- package/src/routes/product-options/product-option-detail/index.ts +3 -0
- package/src/routes/product-options/product-option-detail/loader.ts +17 -0
- package/src/routes/product-options/product-option-detail/product-option-detail.tsx +50 -0
- package/src/routes/product-options/product-option-edit/components/edit-product-option-form/edit-product-option-details.tsx +94 -0
- package/src/routes/product-options/product-option-edit/components/edit-product-option-form/edit-product-option-form.tsx +116 -0
- package/src/routes/product-options/product-option-edit/components/edit-product-option-form/edit-product-option-organize.tsx +77 -0
- package/src/routes/product-options/product-option-edit/components/edit-product-option-form/index.ts +1 -0
- package/src/routes/product-options/product-option-edit/components/edit-product-option-form/schema.ts +13 -0
- package/src/routes/product-options/product-option-edit/index.ts +1 -0
- package/src/routes/product-options/product-option-edit/product-option-edit.tsx +34 -0
- package/src/routes/product-options/product-option-list/components/product-option-list-table/index.ts +1 -0
- package/src/routes/product-options/product-option-list/components/product-option-list-table/product-option-list-table.tsx +131 -0
- package/src/routes/product-options/product-option-list/index.ts +1 -0
- package/src/routes/product-options/product-option-list/product-option-list.tsx +19 -0
- package/src/routes/product-options/product-option-metadata/index.ts +1 -0
- package/src/routes/product-options/product-option-metadata/product-option-metadata.tsx +27 -0
- package/src/routes/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx +214 -198
- package/src/routes/products/product-create/components/product-create-form/product-create-form.tsx +4 -7
- package/src/routes/products/product-create/constants.ts +1 -0
- package/src/routes/products/product-create/utils.ts +6 -1
- package/src/routes/products/product-detail/components/product-option-section/product-option-section.tsx +7 -38
- package/src/routes/products/product-import/helpers/import-template.ts +6 -6
- package/src/routes/products/product-options-manage/components/product-options-manage-form/index.ts +1 -0
- package/src/routes/products/product-options-manage/components/product-options-manage-form/product-options-manage-form.tsx +147 -0
- package/src/routes/products/product-options-manage/index.ts +1 -0
- package/src/routes/products/product-options-manage/product-options-manage.tsx +35 -0
- package/dist/product-create-option-D2636LJL.mjs +0 -145
- package/dist/product-edit-option-DYAFZIT2.mjs +0 -150
- package/src/routes/products/product-create-option/components/create-product-option-form/create-product-option-form.tsx +0 -122
- package/src/routes/products/product-create-option/components/create-product-option-form/index.ts +0 -1
- package/src/routes/products/product-create-option/index.ts +0 -1
- package/src/routes/products/product-create-option/product-create-option.tsx +0 -26
- package/src/routes/products/product-edit-option/components/edit-product-option-form/edit-product-option-form.tsx +0 -123
- package/src/routes/products/product-edit-option/components/edit-product-option-form/index.ts +0 -1
- package/src/routes/products/product-edit-option/index.ts +0 -1
- package/src/routes/products/product-edit-option/product-edit-option.tsx +0 -32
- package/dist/{chunk-ELPHCFRW.mjs → chunk-MK4E5XQX.mjs} +3 -3
- package/dist/{chunk-VWXNC2B5.mjs → chunk-SMDWWXCD.mjs} +3 -3
- package/dist/{customer-group-add-customers-57THRZ6D.mjs → customer-group-add-customers-TQAH4IPM.mjs} +3 -3
- package/dist/{customer-list-TE7VNBX6.mjs → customer-list-TXAB4URJ.mjs} +3 -3
- package/dist/{location-list-W6EHBBE5.mjs → location-list-MVIK73QC.mjs} +1 -1
- package/dist/{location-service-zone-shipping-option-edit-27MYKN7R.mjs → location-service-zone-shipping-option-edit-WN4MTZSB.mjs} +3 -3
- package/dist/{product-type-list-2ZQ2NE3R.mjs → product-type-list-J2WDYTZK.mjs} +3 -3
- package/dist/{region-list-W55C3CTH.mjs → region-list-KE5HCKOR.mjs} +3 -3
- package/dist/{return-reason-list-CBOVMQZF.mjs → return-reason-list-6UKR2BLW.mjs} +3 -3
- package/dist/{user-list-6EVTLPJE.mjs → user-list-73SJSKYT.mjs} +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/dashboard",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251106181920",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"generate:static": "node ./scripts/generate-currencies.js && prettier --write ./src/lib/currencies.ts",
|
|
6
6
|
"dev": "vite",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
47
|
"@hookform/error-message": "^2.0.1",
|
|
48
48
|
"@hookform/resolvers": "3.4.2",
|
|
49
|
-
"@medusajs/admin-shared": "3.0.0-snapshot-
|
|
50
|
-
"@medusajs/icons": "3.0.0-snapshot-
|
|
51
|
-
"@medusajs/js-sdk": "3.0.0-snapshot-
|
|
52
|
-
"@medusajs/ui": "4.0.
|
|
49
|
+
"@medusajs/admin-shared": "3.0.0-snapshot-20251106181920",
|
|
50
|
+
"@medusajs/icons": "3.0.0-snapshot-20251106181920",
|
|
51
|
+
"@medusajs/js-sdk": "3.0.0-snapshot-20251106181920",
|
|
52
|
+
"@medusajs/ui": "4.0.28-snapshot-20251106181920",
|
|
53
53
|
"@radix-ui/react-dialog": "1.1.4",
|
|
54
54
|
"@radix-ui/react-dismissable-layer": "1.1.4",
|
|
55
55
|
"@tanstack/react-query": "5.64.2",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"zod": "3.25.76"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@medusajs/admin-shared": "3.0.0-snapshot-
|
|
85
|
-
"@medusajs/admin-vite-plugin": "3.0.0-snapshot-
|
|
86
|
-
"@medusajs/types": "3.0.0-snapshot-
|
|
87
|
-
"@medusajs/ui-preset": "3.0.0-snapshot-
|
|
84
|
+
"@medusajs/admin-shared": "3.0.0-snapshot-20251106181920",
|
|
85
|
+
"@medusajs/admin-vite-plugin": "3.0.0-snapshot-20251106181920",
|
|
86
|
+
"@medusajs/types": "3.0.0-snapshot-20251106181920",
|
|
87
|
+
"@medusajs/ui-preset": "3.0.0-snapshot-20251106181920"
|
|
88
88
|
},
|
|
89
89
|
"packageManager": "yarn@3.2.1"
|
|
90
90
|
}
|
|
@@ -65,6 +65,13 @@ export const InfiniteList = <
|
|
|
65
65
|
const parentRef = useRef<HTMLDivElement>(null)
|
|
66
66
|
const startObserver = useRef<IntersectionObserver>()
|
|
67
67
|
const endObserver = useRef<IntersectionObserver>()
|
|
68
|
+
const fetchNextPageRef = useRef(fetchNextPage)
|
|
69
|
+
const fetchPreviousPageRef = useRef(fetchPreviousPage)
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
fetchNextPageRef.current = fetchNextPage
|
|
73
|
+
fetchPreviousPageRef.current = fetchPreviousPage
|
|
74
|
+
}, [fetchNextPage, fetchPreviousPage])
|
|
68
75
|
|
|
69
76
|
useEffect(() => {
|
|
70
77
|
if (isPending) {
|
|
@@ -78,7 +85,7 @@ export const InfiniteList = <
|
|
|
78
85
|
(entries) => {
|
|
79
86
|
if (entries[0].isIntersecting && hasPreviousPage) {
|
|
80
87
|
startObserver.current?.disconnect()
|
|
81
|
-
|
|
88
|
+
fetchPreviousPageRef.current()
|
|
82
89
|
}
|
|
83
90
|
},
|
|
84
91
|
{
|
|
@@ -90,7 +97,7 @@ export const InfiniteList = <
|
|
|
90
97
|
(entries) => {
|
|
91
98
|
if (entries[0].isIntersecting && hasNextPage) {
|
|
92
99
|
endObserver.current?.disconnect()
|
|
93
|
-
|
|
100
|
+
fetchNextPageRef.current()
|
|
94
101
|
}
|
|
95
102
|
},
|
|
96
103
|
{
|
|
@@ -113,8 +120,6 @@ export const InfiniteList = <
|
|
|
113
120
|
endObserver.current?.disconnect()
|
|
114
121
|
}
|
|
115
122
|
}, [
|
|
116
|
-
fetchNextPage,
|
|
117
|
-
fetchPreviousPage,
|
|
118
123
|
hasNextPage,
|
|
119
124
|
hasPreviousPage,
|
|
120
125
|
isFetching,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BuildingStorefront,
|
|
3
2
|
Buildings,
|
|
3
|
+
BuildingStorefront,
|
|
4
4
|
ChevronDownMini,
|
|
5
5
|
CogSixTooth,
|
|
6
6
|
CurrencyDollar,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
Tag,
|
|
15
15
|
Users,
|
|
16
16
|
} from "@medusajs/icons"
|
|
17
|
-
import { Avatar, Divider, DropdownMenu, Text
|
|
17
|
+
import { Avatar, clx, Divider, DropdownMenu, Text } from "@medusajs/ui"
|
|
18
18
|
import { Collapsible as RadixCollapsible } from "radix-ui"
|
|
19
19
|
import { useTranslation } from "react-i18next"
|
|
20
20
|
|
|
@@ -107,8 +107,7 @@ const Header = () => {
|
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
109
|
<div className="w-full p-3">
|
|
110
|
-
|
|
111
|
-
dir={direction}>
|
|
110
|
+
<DropdownMenu dir={direction}>
|
|
112
111
|
<DropdownMenu.Trigger
|
|
113
112
|
disabled={!isLoaded}
|
|
114
113
|
className={clx(
|
|
@@ -206,6 +205,10 @@ const useCoreRoutes = (): Omit<INavItem, "pathname">[] => {
|
|
|
206
205
|
label: t("categories.domain"),
|
|
207
206
|
to: "/categories",
|
|
208
207
|
},
|
|
208
|
+
{
|
|
209
|
+
label: t("productOptions.domain"),
|
|
210
|
+
to: "/product-options",
|
|
211
|
+
},
|
|
209
212
|
// TODO: Enable when domin is introduced
|
|
210
213
|
// {
|
|
211
214
|
// label: t("giftCards.domain"),
|
|
@@ -42,6 +42,13 @@ type DashboardAppProps = {
|
|
|
42
42
|
plugins: DashboardPlugin[]
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Matches segments that are optional and at the end of the path.
|
|
47
|
+
* Example: /path/to/:id?
|
|
48
|
+
* Such paths can be added to the menu items without the optional segment.
|
|
49
|
+
*/
|
|
50
|
+
const OPTIONAL_LAST_SEGMENT_MATCH = /\/([^\/])+\?$/
|
|
51
|
+
|
|
45
52
|
export class DashboardApp {
|
|
46
53
|
private widgets: WidgetMap
|
|
47
54
|
private menus: MenuMap
|
|
@@ -129,10 +136,11 @@ export class DashboardApp {
|
|
|
129
136
|
allMenuItems.sort((a, b) => a.path.length - b.path.length)
|
|
130
137
|
|
|
131
138
|
allMenuItems.forEach((item) => {
|
|
132
|
-
|
|
139
|
+
item.path = item.path.replace(OPTIONAL_LAST_SEGMENT_MATCH, "")
|
|
140
|
+
if (item.path.includes("/:") || item.path.endsWith("/*")) {
|
|
133
141
|
if (process.env.NODE_ENV === "development") {
|
|
134
142
|
console.warn(
|
|
135
|
-
`[@medusajs/dashboard] Menu item for path "${item.path}" can't be added to the sidebar as it contains a parameter.`
|
|
143
|
+
`[@medusajs/dashboard] Menu item for path "${item.path}" can't be added to the sidebar as it contains a mandatory parameter.`
|
|
136
144
|
)
|
|
137
145
|
}
|
|
138
146
|
return
|
|
@@ -136,18 +136,6 @@ export function getRouteMap({
|
|
|
136
136
|
lazy: () =>
|
|
137
137
|
import("../../routes/products/product-prices"),
|
|
138
138
|
},
|
|
139
|
-
{
|
|
140
|
-
path: "options/create",
|
|
141
|
-
lazy: () =>
|
|
142
|
-
import(
|
|
143
|
-
"../../routes/products/product-create-option"
|
|
144
|
-
),
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
path: "options/:option_id/edit",
|
|
148
|
-
lazy: () =>
|
|
149
|
-
import("../../routes/products/product-edit-option"),
|
|
150
|
-
},
|
|
151
139
|
{
|
|
152
140
|
path: "variants/create",
|
|
153
141
|
lazy: () =>
|
|
@@ -165,6 +153,13 @@ export function getRouteMap({
|
|
|
165
153
|
lazy: () =>
|
|
166
154
|
import("../../routes/products/product-metadata"),
|
|
167
155
|
},
|
|
156
|
+
{
|
|
157
|
+
path: "options/manage",
|
|
158
|
+
lazy: () =>
|
|
159
|
+
import(
|
|
160
|
+
"../../routes/products/product-options-manage"
|
|
161
|
+
),
|
|
162
|
+
},
|
|
168
163
|
],
|
|
169
164
|
},
|
|
170
165
|
{
|
|
@@ -225,6 +220,63 @@ export function getRouteMap({
|
|
|
225
220
|
},
|
|
226
221
|
],
|
|
227
222
|
},
|
|
223
|
+
{
|
|
224
|
+
path: "/product-options",
|
|
225
|
+
errorElement: <ErrorBoundary />,
|
|
226
|
+
handle: {
|
|
227
|
+
breadcrumb: () => t("productOptions.domain"),
|
|
228
|
+
},
|
|
229
|
+
children: [
|
|
230
|
+
{
|
|
231
|
+
path: "",
|
|
232
|
+
lazy: () =>
|
|
233
|
+
import("../../routes/product-options/product-option-list"),
|
|
234
|
+
children: [
|
|
235
|
+
{
|
|
236
|
+
path: "create",
|
|
237
|
+
lazy: () =>
|
|
238
|
+
import(
|
|
239
|
+
"../../routes/product-options/product-option-create"
|
|
240
|
+
),
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
path: ":id",
|
|
246
|
+
lazy: async () => {
|
|
247
|
+
const { Component, Breadcrumb, loader } = await import(
|
|
248
|
+
"../../routes/product-options/product-option-detail"
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
Component,
|
|
253
|
+
loader,
|
|
254
|
+
handle: {
|
|
255
|
+
breadcrumb: (match: UIMatch<any>) => (
|
|
256
|
+
<Breadcrumb {...match} />
|
|
257
|
+
),
|
|
258
|
+
},
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
{
|
|
263
|
+
path: "edit",
|
|
264
|
+
lazy: () =>
|
|
265
|
+
import(
|
|
266
|
+
"../../routes/product-options/product-option-edit"
|
|
267
|
+
),
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
path: "metadata/edit",
|
|
271
|
+
lazy: () =>
|
|
272
|
+
import(
|
|
273
|
+
"../../routes/product-options/product-option-metadata"
|
|
274
|
+
),
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
},
|
|
228
280
|
{
|
|
229
281
|
path: "/categories",
|
|
230
282
|
errorElement: <ErrorBoundary />,
|
|
@@ -37,9 +37,10 @@ const createBranchRoute = (segment: string): RouteObject => ({
|
|
|
37
37
|
const createLeafRoute = (
|
|
38
38
|
Component: ComponentType,
|
|
39
39
|
loader?: LoaderFunction,
|
|
40
|
-
handle?: object
|
|
40
|
+
handle?: object,
|
|
41
|
+
path: string = ""
|
|
41
42
|
): RouteObject => ({
|
|
42
|
-
path
|
|
43
|
+
path,
|
|
43
44
|
ErrorBoundary: ErrorBoundary,
|
|
44
45
|
async lazy() {
|
|
45
46
|
const result: {
|
|
@@ -149,7 +150,6 @@ const addRoute = (
|
|
|
149
150
|
|
|
150
151
|
if (isComponentSegment || remainingSegments.length === 0) {
|
|
151
152
|
route.children ||= []
|
|
152
|
-
const leaf = createLeafRoute(Component, loader)
|
|
153
153
|
|
|
154
154
|
if (handle) {
|
|
155
155
|
route.handle = handle
|
|
@@ -159,9 +159,17 @@ const addRoute = (
|
|
|
159
159
|
route.loader = loader
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
route
|
|
164
|
-
|
|
162
|
+
// Since splat segments must occur at the end of a route, react-router enforces the segment to be a leaf.
|
|
163
|
+
// Therefore we can't create a child leaf route with `path: ""` and must instead modify the route itself
|
|
164
|
+
if (currentSegment === "*?" || currentSegment === "*") {
|
|
165
|
+
const leaf = createLeafRoute(Component, loader, handle, currentSegment)
|
|
166
|
+
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath)
|
|
167
|
+
Object.assign(route, leaf)
|
|
168
|
+
} else {
|
|
169
|
+
const leaf = createLeafRoute(Component, loader)
|
|
170
|
+
leaf.children = processParallelRoutes(parallelRoutes, currentFullPath)
|
|
171
|
+
route.children.push(leaf)
|
|
172
|
+
}
|
|
165
173
|
if (remainingSegments.length > 0) {
|
|
166
174
|
addRoute(
|
|
167
175
|
remainingSegments,
|
package/src/hooks/api/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./payment-collections"
|
|
|
17
17
|
export * from "./payments"
|
|
18
18
|
export * from "./plugins"
|
|
19
19
|
export * from "./price-lists"
|
|
20
|
+
export * from "./product-options"
|
|
20
21
|
export * from "./product-types"
|
|
21
22
|
export * from "./product-variants"
|
|
22
23
|
export * from "./products"
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { FetchError } from "@medusajs/js-sdk"
|
|
2
|
+
import {
|
|
3
|
+
QueryKey,
|
|
4
|
+
useMutation,
|
|
5
|
+
UseMutationOptions,
|
|
6
|
+
useQuery,
|
|
7
|
+
UseQueryOptions,
|
|
8
|
+
} from "@tanstack/react-query"
|
|
9
|
+
import { sdk } from "../../lib/client"
|
|
10
|
+
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
11
|
+
import { HttpTypes } from "@medusajs/types"
|
|
12
|
+
import { queryClient } from "../../lib/query-client.ts"
|
|
13
|
+
|
|
14
|
+
const PRODUCT_OPTIONS_QUERY_KEY = "product_options" as const
|
|
15
|
+
export const productOptionsQueryKeys = queryKeysFactory(
|
|
16
|
+
PRODUCT_OPTIONS_QUERY_KEY
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export const useProductOption = (
|
|
20
|
+
id: string,
|
|
21
|
+
query?: HttpTypes.AdminProductOptionParams,
|
|
22
|
+
options?: Omit<
|
|
23
|
+
UseQueryOptions<
|
|
24
|
+
HttpTypes.AdminProductOptionResponse,
|
|
25
|
+
FetchError,
|
|
26
|
+
HttpTypes.AdminProductOptionResponse,
|
|
27
|
+
QueryKey
|
|
28
|
+
>,
|
|
29
|
+
"queryFn" | "queryKey"
|
|
30
|
+
>
|
|
31
|
+
) => {
|
|
32
|
+
const { data, ...rest } = useQuery({
|
|
33
|
+
queryKey: productOptionsQueryKeys.detail(id, query),
|
|
34
|
+
queryFn: () => sdk.admin.productOption.retrieve(id, query),
|
|
35
|
+
...options,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return { ...data, ...rest }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const useProductOptions = (
|
|
42
|
+
query?: HttpTypes.AdminProductOptionListParams,
|
|
43
|
+
options?: Omit<
|
|
44
|
+
UseQueryOptions<
|
|
45
|
+
HttpTypes.AdminProductOptionListResponse,
|
|
46
|
+
FetchError,
|
|
47
|
+
HttpTypes.AdminProductOptionListResponse,
|
|
48
|
+
QueryKey
|
|
49
|
+
>,
|
|
50
|
+
"queryFn" | "queryKey"
|
|
51
|
+
>
|
|
52
|
+
) => {
|
|
53
|
+
const { data, ...rest } = useQuery({
|
|
54
|
+
queryFn: () => sdk.admin.productOption.list(query),
|
|
55
|
+
queryKey: productOptionsQueryKeys.list(query),
|
|
56
|
+
...options,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
return { ...data, ...rest }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const useCreateProductOption = (
|
|
63
|
+
options?: UseMutationOptions<
|
|
64
|
+
HttpTypes.AdminProductOptionResponse,
|
|
65
|
+
FetchError,
|
|
66
|
+
HttpTypes.AdminCreateProductOption
|
|
67
|
+
>
|
|
68
|
+
) => {
|
|
69
|
+
return useMutation({
|
|
70
|
+
mutationFn: (payload) => sdk.admin.productOption.create(payload),
|
|
71
|
+
onSuccess: (data, variables, context) => {
|
|
72
|
+
queryClient.invalidateQueries({
|
|
73
|
+
queryKey: productOptionsQueryKeys.lists(),
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
options?.onSuccess?.(data, variables, context)
|
|
77
|
+
},
|
|
78
|
+
...options,
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const useUpdateProductOption = (
|
|
83
|
+
id: string,
|
|
84
|
+
options?: UseMutationOptions<
|
|
85
|
+
HttpTypes.AdminProductOptionResponse,
|
|
86
|
+
FetchError,
|
|
87
|
+
HttpTypes.AdminUpdateProductOption
|
|
88
|
+
>
|
|
89
|
+
) => {
|
|
90
|
+
return useMutation({
|
|
91
|
+
mutationFn: (payload) => sdk.admin.productOption.update(id, payload),
|
|
92
|
+
onSuccess: (data, variables, context) => {
|
|
93
|
+
queryClient.invalidateQueries({
|
|
94
|
+
queryKey: productOptionsQueryKeys.lists(),
|
|
95
|
+
})
|
|
96
|
+
queryClient.invalidateQueries({
|
|
97
|
+
queryKey: productOptionsQueryKeys.detail(id),
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
options?.onSuccess?.(data, variables, context)
|
|
101
|
+
},
|
|
102
|
+
...options,
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const useDeleteProductOption = (
|
|
107
|
+
id: string,
|
|
108
|
+
options?: UseMutationOptions<
|
|
109
|
+
HttpTypes.AdminProductOptionDeleteResponse,
|
|
110
|
+
FetchError,
|
|
111
|
+
void
|
|
112
|
+
>
|
|
113
|
+
) => {
|
|
114
|
+
return useMutation({
|
|
115
|
+
mutationFn: () => sdk.admin.productOption.delete(id),
|
|
116
|
+
onSuccess: (data, variables, context) => {
|
|
117
|
+
queryClient.invalidateQueries({
|
|
118
|
+
queryKey: productOptionsQueryKeys.lists(),
|
|
119
|
+
})
|
|
120
|
+
queryClient.invalidateQueries({
|
|
121
|
+
queryKey: productOptionsQueryKeys.detail(id),
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
options?.onSuccess?.(data, variables, context)
|
|
125
|
+
},
|
|
126
|
+
...options,
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const useDeleteProductOptionLazy = (
|
|
131
|
+
options?: UseMutationOptions<
|
|
132
|
+
HttpTypes.AdminProductOptionDeleteResponse,
|
|
133
|
+
FetchError,
|
|
134
|
+
string
|
|
135
|
+
>
|
|
136
|
+
) => {
|
|
137
|
+
return useMutation({
|
|
138
|
+
mutationFn: (id: string) => sdk.admin.productOption.delete(id),
|
|
139
|
+
onSuccess: (data, variables, context) => {
|
|
140
|
+
queryClient.invalidateQueries({
|
|
141
|
+
queryKey: productOptionsQueryKeys.lists(),
|
|
142
|
+
})
|
|
143
|
+
queryClient.invalidateQueries({
|
|
144
|
+
queryKey: productOptionsQueryKeys.details(),
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
options?.onSuccess?.(data, variables, context)
|
|
148
|
+
},
|
|
149
|
+
...options,
|
|
150
|
+
})
|
|
151
|
+
}
|
|
@@ -21,69 +21,6 @@ export const variantsQueryKeys = queryKeysFactory(VARIANTS_QUERY_KEY)
|
|
|
21
21
|
const OPTIONS_QUERY_KEY = "product_options" as const
|
|
22
22
|
export const optionsQueryKeys = queryKeysFactory(OPTIONS_QUERY_KEY)
|
|
23
23
|
|
|
24
|
-
export const useCreateProductOption = (
|
|
25
|
-
productId: string,
|
|
26
|
-
options?: UseMutationOptions<any, FetchError, any>
|
|
27
|
-
) => {
|
|
28
|
-
return useMutation({
|
|
29
|
-
mutationFn: (payload: HttpTypes.AdminCreateProductOption) =>
|
|
30
|
-
sdk.admin.product.createOption(productId, payload),
|
|
31
|
-
onSuccess: (data: any, variables: any, context: any) => {
|
|
32
|
-
queryClient.invalidateQueries({ queryKey: optionsQueryKeys.lists() })
|
|
33
|
-
queryClient.invalidateQueries({
|
|
34
|
-
queryKey: productsQueryKeys.detail(productId),
|
|
35
|
-
})
|
|
36
|
-
options?.onSuccess?.(data, variables, context)
|
|
37
|
-
},
|
|
38
|
-
...options,
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const useUpdateProductOption = (
|
|
43
|
-
productId: string,
|
|
44
|
-
optionId: string,
|
|
45
|
-
options?: UseMutationOptions<any, FetchError, any>
|
|
46
|
-
) => {
|
|
47
|
-
return useMutation({
|
|
48
|
-
mutationFn: (payload: HttpTypes.AdminUpdateProductOption) =>
|
|
49
|
-
sdk.admin.product.updateOption(productId, optionId, payload),
|
|
50
|
-
onSuccess: (data: any, variables: any, context: any) => {
|
|
51
|
-
queryClient.invalidateQueries({ queryKey: optionsQueryKeys.lists() })
|
|
52
|
-
queryClient.invalidateQueries({
|
|
53
|
-
queryKey: optionsQueryKeys.detail(optionId),
|
|
54
|
-
})
|
|
55
|
-
queryClient.invalidateQueries({
|
|
56
|
-
queryKey: productsQueryKeys.detail(productId),
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
options?.onSuccess?.(data, variables, context)
|
|
60
|
-
},
|
|
61
|
-
...options,
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const useDeleteProductOption = (
|
|
66
|
-
productId: string,
|
|
67
|
-
optionId: string,
|
|
68
|
-
options?: UseMutationOptions<any, FetchError, void>
|
|
69
|
-
) => {
|
|
70
|
-
return useMutation({
|
|
71
|
-
mutationFn: () => sdk.admin.product.deleteOption(productId, optionId),
|
|
72
|
-
onSuccess: (data: any, variables: any, context: any) => {
|
|
73
|
-
queryClient.invalidateQueries({ queryKey: optionsQueryKeys.lists() })
|
|
74
|
-
queryClient.invalidateQueries({
|
|
75
|
-
queryKey: optionsQueryKeys.detail(optionId),
|
|
76
|
-
})
|
|
77
|
-
queryClient.invalidateQueries({
|
|
78
|
-
queryKey: productsQueryKeys.detail(productId),
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
options?.onSuccess?.(data, variables, context)
|
|
82
|
-
},
|
|
83
|
-
...options,
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
|
|
87
24
|
export const useProductVariant = (
|
|
88
25
|
productId: string,
|
|
89
26
|
variantId: string,
|
|
@@ -375,6 +312,29 @@ export const useDeleteProduct = (
|
|
|
375
312
|
})
|
|
376
313
|
}
|
|
377
314
|
|
|
315
|
+
export const useLinkProductOptions = (
|
|
316
|
+
productId: string,
|
|
317
|
+
options?: UseMutationOptions<
|
|
318
|
+
HttpTypes.AdminProductResponse,
|
|
319
|
+
FetchError,
|
|
320
|
+
HttpTypes.AdminLinkProductOptions
|
|
321
|
+
>
|
|
322
|
+
) => {
|
|
323
|
+
return useMutation({
|
|
324
|
+
mutationFn: (payload) => sdk.admin.product.linkOptions(productId, payload),
|
|
325
|
+
onSuccess: (data, variables, context) => {
|
|
326
|
+
queryClient.invalidateQueries({ queryKey: productsQueryKeys.lists() })
|
|
327
|
+
queryClient.invalidateQueries({
|
|
328
|
+
queryKey: productsQueryKeys.detail(productId),
|
|
329
|
+
})
|
|
330
|
+
queryClient.invalidateQueries({ queryKey: optionsQueryKeys.lists() })
|
|
331
|
+
|
|
332
|
+
options?.onSuccess?.(data, variables, context)
|
|
333
|
+
},
|
|
334
|
+
...options,
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
|
|
378
338
|
export const useExportProducts = (
|
|
379
339
|
query?: HttpTypes.AdminProductListParams,
|
|
380
340
|
options?: UseMutationOptions<
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createColumnHelper } from "@tanstack/react-table"
|
|
2
|
+
import { useMemo } from "react"
|
|
3
|
+
import { useTranslation } from "react-i18next"
|
|
4
|
+
import { TextCell } from "../../../components/table/table-cells/common/text-cell"
|
|
5
|
+
import { HttpTypes } from "@medusajs/types"
|
|
6
|
+
|
|
7
|
+
const columnHelper = createColumnHelper<HttpTypes.AdminProductOption>()
|
|
8
|
+
|
|
9
|
+
export const useProductOptionTableColumns = () => {
|
|
10
|
+
const { t } = useTranslation()
|
|
11
|
+
|
|
12
|
+
return useMemo(
|
|
13
|
+
() => [
|
|
14
|
+
columnHelper.accessor("title", {
|
|
15
|
+
header: t("fields.title"),
|
|
16
|
+
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
|
17
|
+
}),
|
|
18
|
+
columnHelper.accessor("values", {
|
|
19
|
+
header: t("fields.values"),
|
|
20
|
+
cell: ({ getValue }) => {
|
|
21
|
+
const values = getValue()
|
|
22
|
+
const count = values?.length || 0
|
|
23
|
+
const displayText =
|
|
24
|
+
count > 0 ? `${count} ${count === 1 ? "value" : "values"}` : "-"
|
|
25
|
+
|
|
26
|
+
return <TextCell text={displayText} />
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
columnHelper.accessor("is_exclusive", {
|
|
30
|
+
header: t("fields.exclusive"),
|
|
31
|
+
cell: ({ getValue }) => {
|
|
32
|
+
const isExclusive = getValue()
|
|
33
|
+
return (
|
|
34
|
+
<TextCell
|
|
35
|
+
text={isExclusive ? t("fields.true") : t("fields.false")}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
[t]
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from "./use-customer-table-filters"
|
|
|
4
4
|
export * from "./use-date-table-filters"
|
|
5
5
|
export * from "./use-order-table-filters"
|
|
6
6
|
export * from "./use-product-table-filters"
|
|
7
|
+
export * from "./use-product-option-table-filters"
|
|
7
8
|
export * from "./use-product-tag-table-filters"
|
|
8
9
|
export * from "./use-product-type-table-filters"
|
|
9
10
|
export * from "./use-promotion-table-filters"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next"
|
|
2
|
+
import { createDataTableFilterHelper } from "@medusajs/ui"
|
|
3
|
+
import { HttpTypes } from "@medusajs/types"
|
|
4
|
+
import { useDataTableDateFilters } from "../../../components/data-table/helpers/general/use-data-table-date-filters.tsx"
|
|
5
|
+
import { useMemo } from "react"
|
|
6
|
+
|
|
7
|
+
const filterHelper = createDataTableFilterHelper<HttpTypes.AdminProductOption>()
|
|
8
|
+
|
|
9
|
+
export const useProductOptionTableFilters = () => {
|
|
10
|
+
const { t } = useTranslation()
|
|
11
|
+
const dateFilters = useDataTableDateFilters()
|
|
12
|
+
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => [
|
|
15
|
+
filterHelper.accessor("is_exclusive", {
|
|
16
|
+
label: t("fields.exclusive"),
|
|
17
|
+
type: "radio",
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
label: t("fields.true"),
|
|
21
|
+
value: "false",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: t("fields.false"),
|
|
25
|
+
value: "true",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
...dateFilters,
|
|
30
|
+
],
|
|
31
|
+
[dateFilters, t]
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HttpTypes } from "@medusajs/types"
|
|
2
|
+
import { useQueryParams } from "../../use-query-params"
|
|
3
|
+
|
|
4
|
+
type UseProductOptionTableQueryProps = {
|
|
5
|
+
prefix?: string
|
|
6
|
+
pageSize?: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const useProductOptionTableQuery = ({
|
|
10
|
+
prefix,
|
|
11
|
+
pageSize = 20,
|
|
12
|
+
}: UseProductOptionTableQueryProps) => {
|
|
13
|
+
const queryObject = useQueryParams(
|
|
14
|
+
["offset", "q", "order", "created_at", "updated_at", "is_exclusive"],
|
|
15
|
+
prefix
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const { offset, created_at, updated_at, q, order, is_exclusive } = queryObject
|
|
19
|
+
|
|
20
|
+
const searchParams: HttpTypes.AdminProductOptionListParams = {
|
|
21
|
+
limit: pageSize,
|
|
22
|
+
offset: offset ? Number(offset) : 0,
|
|
23
|
+
order,
|
|
24
|
+
created_at: created_at ? JSON.parse(created_at) : undefined,
|
|
25
|
+
updated_at: updated_at ? JSON.parse(updated_at) : undefined,
|
|
26
|
+
is_exclusive: is_exclusive === "true" ? true : is_exclusive === "false" ? false : undefined,
|
|
27
|
+
q,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
searchParams,
|
|
32
|
+
raw: queryObject,
|
|
33
|
+
}
|
|
34
|
+
}
|