@medusajs/dashboard 3.0.0-snapshot-20251202221811 → 3.0.0-snapshot-20251208164410
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-WZOCLB5V.mjs → adjust-inventory-ZB3AVET7.mjs} +1 -1
- package/dist/{api-key-management-create-W7NL2IYN.mjs → api-key-management-create-U6VGZK7R.mjs} +3 -3
- package/dist/{api-key-management-detail-LDBEO446.mjs → api-key-management-detail-OEAWWV5O.mjs} +13 -13
- package/dist/{api-key-management-edit-TLVLXAVK.mjs → api-key-management-edit-TJM737A7.mjs} +3 -3
- package/dist/{api-key-management-list-FTLC3ELT.mjs → api-key-management-list-ZRYMMTF5.mjs} +3 -3
- package/dist/{api-key-management-sales-channels-NYY3NZOE.mjs → api-key-management-sales-channels-D2RAHI7W.mjs} +4 -4
- package/dist/app.css +3 -3
- package/dist/app.js +17416 -15980
- package/dist/app.mjs +11 -11
- package/dist/{campaign-create-LHL7FKQK.mjs → campaign-create-IXOWJQ4L.mjs} +3 -3
- package/dist/{campaign-detail-T3V6M3XE.mjs → campaign-detail-TFQCDDIN.mjs} +10 -10
- package/dist/{categories-metadata-V6FDXGSN.mjs → categories-metadata-7JFVYYUN.mjs} +10 -10
- package/dist/{category-create-ELMCLH4J.mjs → category-create-BTMZYQ5R.mjs} +5 -5
- package/dist/{category-detail-DNWTF4FV.mjs → category-detail-UUEMLEVJ.mjs} +14 -14
- package/dist/{category-edit-TYKLEYGE.mjs → category-edit-Q3KEELHO.mjs} +2 -2
- package/dist/{category-list-IJ3DLPYQ.mjs → category-list-Z6HS6N75.mjs} +5 -5
- package/dist/{category-organize-PDLC54E2.mjs → category-organize-45NPSRNG.mjs} +2 -2
- package/dist/{category-products-ATK63QHB.mjs → category-products-KW6X3JDW.mjs} +13 -13
- package/dist/{chunk-WPXYFJEP.mjs → chunk-2WLOIS3L.mjs} +1 -1
- package/dist/{chunk-UHIPGDJZ.mjs → chunk-35G7IXTE.mjs} +15 -15
- package/dist/{chunk-DODQ3KJT.mjs → chunk-3RRA56WC.mjs} +8 -3
- package/dist/{chunk-DKIUGYWW.mjs → chunk-3ZJ55SFA.mjs} +2 -2
- package/dist/{chunk-OXPE5TAY.mjs → chunk-42TMWI76.mjs} +1 -1
- package/dist/{chunk-OFN7DIZA.mjs → chunk-5AM254NB.mjs} +83 -3
- package/dist/{chunk-56TDUOXV.mjs → chunk-5N33TBBX.mjs} +1 -1
- package/dist/{chunk-5LGRZSEH.mjs → chunk-67RC6SEX.mjs} +1 -1
- package/dist/{chunk-O4RZ3Y65.mjs → chunk-7H6DB666.mjs} +1 -1
- package/dist/{chunk-5EGFR4EO.mjs → chunk-AGBHQZZT.mjs} +318 -236
- package/dist/{chunk-E3AFVPLW.mjs → chunk-BWU3ZE4W.mjs} +1 -1
- package/dist/{chunk-IKTS7EHT.mjs → chunk-D55WNQYO.mjs} +1 -1
- package/dist/{chunk-XDLBQGST.mjs → chunk-EFRTOOI5.mjs} +1 -1
- package/dist/{chunk-ETOJCN3Q.mjs → chunk-FJHAGJ5G.mjs} +1 -1
- package/dist/{chunk-K5QWNI6V.mjs → chunk-FNQ227BC.mjs} +1 -1
- package/dist/{chunk-A6PWH2CK.mjs → chunk-GHBURGZC.mjs} +1 -1
- package/dist/{chunk-4MG5LND4.mjs → chunk-HEYM67GY.mjs} +1 -1
- package/dist/{chunk-QHRVYT5N.mjs → chunk-HRSO6H4F.mjs} +3 -3
- package/dist/{chunk-REUYEF7L.mjs → chunk-MB7M5THW.mjs} +1 -1
- package/dist/{chunk-KLNRCI3K.mjs → chunk-MOGV3UZD.mjs} +1 -1
- package/dist/{chunk-3C6WQ7NH.mjs → chunk-NFEW5CVI.mjs} +37 -3
- package/dist/{chunk-VGXF4DOW.mjs → chunk-NKGKWMUU.mjs} +5 -5
- package/dist/{chunk-RLDK4LY5.mjs → chunk-NTYLG6Y3.mjs} +1 -1
- package/dist/{chunk-AF7A24XI.mjs → chunk-O5DGX2NZ.mjs} +1 -1
- package/dist/{chunk-T2ANPJ36.mjs → chunk-OMRGW7JS.mjs} +3 -3
- package/dist/{chunk-7V2JZU2B.mjs → chunk-P23S5LDK.mjs} +2 -2
- package/dist/{chunk-OAW7KLET.mjs → chunk-PPRHEG37.mjs} +2 -2
- package/dist/{chunk-AENRV3N7.mjs → chunk-QW4SQVMT.mjs} +109 -50
- package/dist/{chunk-MWBKAP7W.mjs → chunk-RNYL6AXZ.mjs} +2 -2
- package/dist/{chunk-KWP436SM.mjs → chunk-S3MMZPMX.mjs} +2 -2
- package/dist/{chunk-ND5YSIPU.mjs → chunk-SAZHCRHS.mjs} +1 -1
- package/dist/{chunk-M3CKVBZC.mjs → chunk-YGEJFHC3.mjs} +1 -1
- package/dist/chunk-ZHH3W7CN.mjs +171 -0
- package/dist/{collection-add-products-7WSD7YU4.mjs → collection-add-products-YSTEEHMF.mjs} +14 -14
- package/dist/{collection-create-I2A2X4VK.mjs → collection-create-RIGJHEX5.mjs} +2 -2
- package/dist/{collection-detail-NVE55BPK.mjs → collection-detail-P5JWWFHH.mjs} +14 -14
- package/dist/{collection-edit-RGH7NCUE.mjs → collection-edit-WX5G3FHR.mjs} +2 -2
- package/dist/{collection-list-SXHRKTIU.mjs → collection-list-PU6SWYVL.mjs} +24 -23
- package/dist/{collection-metadata-ZREV7BND.mjs → collection-metadata-R55DUZSX.mjs} +11 -11
- package/dist/{customer-detail-O4L55RY6.mjs → customer-detail-HVGU3DRM.mjs} +14 -14
- package/dist/{customer-group-detail-LSZA4ARM.mjs → customer-group-detail-QKFWIFYH.mjs} +13 -13
- package/dist/{customer-group-list-6JTEUJAC.mjs → customer-group-list-WLG2ZMBD.mjs} +13 -13
- package/dist/{customers-add-customer-group-MHJ34FDF.mjs → customers-add-customer-group-KL5UXXOR.mjs} +13 -13
- package/dist/{edit-inventory-item-LMDNUI6M.mjs → edit-inventory-item-O6JLGZE4.mjs} +1 -1
- package/dist/{edit-inventory-item-attributes-DPJIHBP3.mjs → edit-inventory-item-attributes-AUVR3GYY.mjs} +1 -1
- package/dist/{edit-reservation-IOOZBJ2T.mjs → edit-reservation-GQ6R6GVA.mjs} +2 -2
- package/dist/{edit-rules-CEE2IKS6.mjs → edit-rules-PJWEWMM7.mjs} +12 -12
- package/dist/en.json +49 -3
- package/dist/{inventory-create-H62EOWR6.mjs → inventory-create-P3WYAGQZ.mjs} +10 -10
- package/dist/{inventory-detail-ALOIH3H7.mjs → inventory-detail-C2NU7GTA.mjs} +10 -10
- package/dist/{inventory-list-RQBI7UJX.mjs → inventory-list-ADJQDNX5.mjs} +1 -1
- package/dist/{inventory-metadata-ICOCEY75.mjs → inventory-metadata-V2N3HOPG.mjs} +10 -10
- package/dist/{inventory-stock-LDEZTKU4.mjs → inventory-stock-5DCIGKBI.mjs} +10 -10
- package/dist/{location-detail-UNXAQQSZ.mjs → location-detail-2CJWVT5M.mjs} +15 -15
- package/dist/{location-fulfillment-providers-XVFFAB6I.mjs → location-fulfillment-providers-PYPUR74W.mjs} +15 -14
- package/dist/{location-sales-channels-UVYT52SH.mjs → location-sales-channels-JPH5BTUY.mjs} +3 -3
- package/dist/{location-service-zone-shipping-option-create-THNTZX5P.mjs → location-service-zone-shipping-option-create-HLZLP422.mjs} +11 -11
- package/dist/{location-service-zone-shipping-option-edit-TQNTCYII.mjs → location-service-zone-shipping-option-edit-OYTEZGGC.mjs} +4 -4
- package/dist/{login-EMANCYJH.mjs → login-AKO3BIQT.mjs} +10 -10
- package/dist/{manage-locations-2VDQ3ILT.mjs → manage-locations-ATCDVTSR.mjs} +1 -1
- package/dist/{order-allocate-items-FCJTB2IB.mjs → order-allocate-items-2H25GRTK.mjs} +3 -3
- package/dist/{order-create-claim-P5ADYS5P.mjs → order-create-claim-CWGDAFFU.mjs} +17 -17
- package/dist/{order-create-edit-CVPRRPOA.mjs → order-create-edit-KJODOQXN.mjs} +11 -11
- package/dist/{order-create-exchange-IHV6VKO5.mjs → order-create-exchange-TM4FQLKM.mjs} +23 -23
- package/dist/{order-create-fulfillment-SY6UM3NJ.mjs → order-create-fulfillment-2WJZPAWX.mjs} +14 -14
- package/dist/{order-create-refund-AGKPMCF6.mjs → order-create-refund-A6WKCHX7.mjs} +15 -15
- package/dist/{order-create-return-5UH7FN3H.mjs → order-create-return-NDKTI4E5.mjs} +5 -5
- package/dist/{order-create-shipment-J34CYL32.mjs → order-create-shipment-3AVEAGAY.mjs} +10 -10
- package/dist/{order-detail-EVDCA6UP.mjs → order-detail-7HXZEBWJ.mjs} +31 -31
- package/dist/{order-edit-billing-address-JH3XNOCQ.mjs → order-edit-billing-address-DPK7HTLM.mjs} +10 -10
- package/dist/{order-edit-email-KV2IHQRT.mjs → order-edit-email-UJ2OUKHJ.mjs} +10 -10
- package/dist/{order-edit-shipping-address-WMNNU53B.mjs → order-edit-shipping-address-5ZCGHHZE.mjs} +10 -10
- package/dist/{order-list-26YQAIRH.mjs → order-list-5C4TVJRH.mjs} +4 -4
- package/dist/{order-metadata-F4LZ73LR.mjs → order-metadata-UKTGLYWR.mjs} +10 -10
- package/dist/{order-receive-return-LSMD7POH.mjs → order-receive-return-N7VLM2GX.mjs} +11 -11
- package/dist/{order-request-transfer-A3EBBZ5N.mjs → order-request-transfer-5ENT7IOT.mjs} +11 -11
- package/dist/{price-list-configuration-2G3WFC3J.mjs → price-list-configuration-SS2VMD4N.mjs} +4 -4
- package/dist/{price-list-create-RLT7G7KF.mjs → price-list-create-FF4F6M2A.mjs} +17 -17
- package/dist/{price-list-detail-TKRELOK2.mjs → price-list-detail-HQF4ZR2U.mjs} +17 -17
- package/dist/{price-list-edit-6URYI6AK.mjs → price-list-edit-VRI5T4W3.mjs} +2 -2
- package/dist/{price-list-list-FLINOQCK.mjs → price-list-list-S2HWTXKV.mjs} +3 -3
- package/dist/{price-list-prices-add-UPUY72HG.mjs → price-list-prices-add-JYZAHKAQ.mjs} +13 -13
- package/dist/{price-list-prices-edit-ZHAQDPWX.mjs → price-list-prices-edit-TRCLLGU4.mjs} +2 -2
- package/dist/{product-attributes-ZR63AQWA.mjs → product-attributes-NEXVST24.mjs} +12 -12
- package/dist/{product-create-EQ6SN5QT.mjs → product-create-WU4YFCMM.mjs} +377 -554
- package/dist/{product-create-variant-7C5PKKX7.mjs → product-create-variant-RDEE4IX7.mjs} +11 -11
- package/dist/{product-detail-ATPFDPI2.mjs → product-detail-J4JYWH2M.mjs} +38 -54
- package/dist/{product-edit-XPUNYMD7.mjs → product-edit-ZF2WYHPB.mjs} +12 -12
- package/dist/{product-export-GFLEIKIM.mjs → product-export-QDX6343F.mjs} +23 -22
- package/dist/{product-image-variants-edit-TC3M4PGX.mjs → product-image-variants-edit-5L5J32SO.mjs} +10 -10
- package/dist/{product-import-2Z5I7RXI.mjs → product-import-6TEVSKGQ.mjs} +10 -10
- package/dist/{product-list-33ANLONH.mjs → product-list-BHGGJX6B.mjs} +17 -17
- package/dist/{product-media-WCLPCVR3.mjs → product-media-EKXMOSO4.mjs} +2 -2
- package/dist/{product-metadata-GQU7EVZ3.mjs → product-metadata-BCJJNWAC.mjs} +10 -10
- package/dist/product-option-create-3Z73MSHD.mjs +336 -0
- package/dist/product-option-detail-4VRUA7KT.mjs +322 -0
- package/dist/product-option-edit-YIKFL6OY.mjs +324 -0
- package/dist/product-option-list-CR7NCCMH.mjs +267 -0
- package/dist/product-option-metadata-7CSZUQ7M.mjs +71 -0
- package/dist/product-options-manage-QOMXMPGW.mjs +304 -0
- package/dist/{product-organization-T2TQ5EH6.mjs → product-organization-IG54OB75.mjs} +14 -14
- package/dist/{product-prices-MKMKBH6P.mjs → product-prices-UMEIS5AZ.mjs} +1 -1
- package/dist/{product-sales-channels-5YIO22UW.mjs → product-sales-channels-2SALTLTF.mjs} +3 -3
- package/dist/{product-shipping-profile-PL76UMVZ.mjs → product-shipping-profile-VPHZLKDT.mjs} +13 -13
- package/dist/{product-stock-6QHBTDUQ.mjs → product-stock-3ILUPCVN.mjs} +10 -10
- package/dist/{product-tag-create-B6EOKDJT.mjs → product-tag-create-OOUTLHHD.mjs} +10 -10
- package/dist/{product-tag-detail-TQP7ZWSR.mjs → product-tag-detail-YVKJEAKT.mjs} +28 -27
- package/dist/{product-tag-edit-RPLWDG5A.mjs → product-tag-edit-RV5WITSN.mjs} +10 -10
- package/dist/{product-tag-list-PZTGHM7M.mjs → product-tag-list-ZSPFYZIL.mjs} +26 -25
- package/dist/{product-tag-metadata-FKKOT5CD.mjs → product-tag-metadata-S5YL3FUL.mjs} +10 -10
- package/dist/{product-type-detail-DDIBFR7O.mjs → product-type-detail-EFVZRETM.mjs} +13 -13
- package/dist/{product-type-metadata-EXCYTTQG.mjs → product-type-metadata-TNAASDKX.mjs} +10 -10
- package/dist/{product-variant-detail-GCESZH4H.mjs → product-variant-detail-CLP5FJP6.mjs} +10 -10
- package/dist/{product-variant-edit-JHOQJN6U.mjs → product-variant-edit-REMB77V7.mjs} +11 -11
- package/dist/{product-variant-manage-inventory-items-B7TUBSD5.mjs → product-variant-manage-inventory-items-IGDCLZQE.mjs} +2 -2
- package/dist/{product-variant-media-6WWLRINP.mjs → product-variant-media-EKI4BTEV.mjs} +1 -1
- package/dist/{product-variant-metadata-NEZIGTEP.mjs → product-variant-metadata-5JIY5KLN.mjs} +10 -10
- package/dist/{promotion-add-campaign-MKDYE7MW.mjs → promotion-add-campaign-DOALJUKJ.mjs} +3 -3
- package/dist/{promotion-create-CUAQY2NH.mjs → promotion-create-2PTB6NQI.mjs} +18 -18
- package/dist/{promotion-detail-2S7FWTXF.mjs → promotion-detail-RGXCA2XS.mjs} +10 -10
- package/dist/{refund-reason-create-4YAO4325.mjs → refund-reason-create-AGEFXEIZ.mjs} +10 -10
- package/dist/{refund-reason-edit-5J2VIRIL.mjs → refund-reason-edit-DL56EKBY.mjs} +10 -10
- package/dist/{refund-reason-list-453DXONV.mjs → refund-reason-list-RL2ZG7IJ.mjs} +13 -13
- package/dist/{region-create-QLPSK6TX.mjs → region-create-UVJICJRX.mjs} +1 -1
- package/dist/{region-edit-JCJHA6TY.mjs → region-edit-3NVXQECN.mjs} +1 -1
- package/dist/{region-metadata-C7DIBM35.mjs → region-metadata-2HO3SAPM.mjs} +10 -10
- package/dist/{reservation-create-BW4CDTWR.mjs → reservation-create-Z7TWUE2L.mjs} +3 -3
- package/dist/{reservation-detail-GFNWLSI2.mjs → reservation-detail-2AOBK5EY.mjs} +10 -10
- package/dist/{reservation-list-RGL67CIU.mjs → reservation-list-MN22JYAW.mjs} +2 -2
- package/dist/{reservation-metadata-OI2G4BDW.mjs → reservation-metadata-BFPJTXK6.mjs} +10 -10
- package/dist/{sales-channel-add-products-63NGB37Z.mjs → sales-channel-add-products-4LNP2TUM.mjs} +13 -13
- package/dist/{sales-channel-create-TOBEDYFD.mjs → sales-channel-create-UFFXX5HK.mjs} +2 -2
- package/dist/{sales-channel-detail-LJPQAJDT.mjs → sales-channel-detail-UMYMS2JA.mjs} +13 -13
- package/dist/{sales-channel-edit-XUTE5GB5.mjs → sales-channel-edit-SP2HF4E3.mjs} +2 -2
- package/dist/{sales-channel-list-TBAN7UT6.mjs → sales-channel-list-CV4V6R7H.mjs} +11 -11
- package/dist/{sales-channel-metadata-SE4TGSDB.mjs → sales-channel-metadata-REOQHHUT.mjs} +10 -10
- package/dist/{shipping-option-type-create-MB4ENYKV.mjs → shipping-option-type-create-XAWQO66M.mjs} +10 -10
- package/dist/{shipping-option-type-detail-IX4JGSTK.mjs → shipping-option-type-detail-G4WLGIAA.mjs} +11 -11
- package/dist/{shipping-option-type-edit-B5KU5LER.mjs → shipping-option-type-edit-OI6TBKGG.mjs} +10 -10
- package/dist/{shipping-option-type-list-TVR5OE2C.mjs → shipping-option-type-list-6GNCKAFB.mjs} +11 -11
- package/dist/{shipping-profile-metadata-Z35SYLBS.mjs → shipping-profile-metadata-MANQ7ZEI.mjs} +10 -10
- package/dist/{store-detail-VUJSSOKZ.mjs → store-detail-N2CP3MTB.mjs} +10 -10
- package/dist/{store-edit-3XS6IC2Z.mjs → store-edit-Q25HCMCQ.mjs} +1 -1
- package/dist/{store-metadata-TYFTDOEK.mjs → store-metadata-U22TVWK2.mjs} +10 -10
- package/dist/{tax-region-create-ZTCTKE4C.mjs → tax-region-create-JZB7NFIG.mjs} +11 -11
- package/dist/{tax-region-detail-MHM4MAOS.mjs → tax-region-detail-CBZ3ZJN2.mjs} +29 -28
- package/dist/{tax-region-edit-SFJGFTAV.mjs → tax-region-edit-E56XVHW2.mjs} +11 -11
- package/dist/{tax-region-province-detail-VMOV4JPV.mjs → tax-region-province-detail-2DC2U4EN.mjs} +29 -28
- package/dist/{tax-region-tax-override-create-GRXLTURD.mjs → tax-region-tax-override-create-JWGWGYB4.mjs} +28 -27
- package/dist/{tax-region-tax-override-edit-D2YBOBEI.mjs → tax-region-tax-override-edit-7DCU55AS.mjs} +27 -26
- package/dist/{user-detail-N6PT3KRP.mjs → user-detail-K5UMPO2L.mjs} +1 -1
- package/dist/{user-metadata-D5HNZWZY.mjs → user-metadata-EX5WDGCR.mjs} +10 -10
- package/dist/{workflow-execution-detail-GSUDCTN3.mjs → workflow-execution-detail-GBPFVG3O.mjs} +10 -10
- package/package.json +9 -9
- package/src/components/inputs/combobox/combobox.tsx +173 -92
- package/src/components/layout/main-layout/main-layout.tsx +7 -4
- package/src/dashboard-app/routes/get-route.map.tsx +64 -12
- package/src/hooks/api/index.ts +1 -0
- package/src/hooks/api/product-options.tsx +151 -0
- package/src/hooks/api/products.tsx +26 -66
- package/src/hooks/table/columns/use-product-option-table-columns.tsx +44 -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 +171 -4
- package/src/i18n/translations/en.json +49 -3
- 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 +140 -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-general-section/product-create-general-section.tsx +16 -4
- package/src/routes/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx +220 -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 +2 -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 +31 -49
- 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 +284 -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-GAEPSU6J.mjs +0 -145
- package/dist/product-edit-option-VIU3ZICO.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-ACJ3PPQJ.mjs → chunk-2QH2TBJ2.mjs} +3 -3
- package/dist/{customer-group-add-customers-QU4Q56SS.mjs → customer-group-add-customers-2Y2GVCDV.mjs} +3 -3
- package/dist/{customer-list-ZXCGIXJC.mjs → customer-list-TG4D4QOT.mjs} +3 -3
- package/dist/{location-list-OYBI7EGV.mjs → location-list-ZJMZZ6T3.mjs} +1 -1
- package/dist/{product-type-list-QX7QC6RI.mjs → product-type-list-7WQ5D2KV.mjs} +3 -3
- package/dist/{region-list-XQRIBDMF.mjs → region-list-JAQXIBYD.mjs} +3 -3
- package/dist/{return-reason-list-VYLLXDG4.mjs → return-reason-list-ATE2XU4H.mjs} +3 -3
- package/dist/{user-list-6KATHOTJ.mjs → user-list-KPI3BTOA.mjs} +3 -3
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
TrianglesMini,
|
|
16
16
|
XMarkMini,
|
|
17
17
|
} from "@medusajs/icons"
|
|
18
|
-
import { clx, Text } from "@medusajs/ui"
|
|
18
|
+
import { Badge, clx, Text } from "@medusajs/ui"
|
|
19
19
|
import { matchSorter } from "match-sorter"
|
|
20
20
|
import {
|
|
21
21
|
ComponentPropsWithoutRef,
|
|
@@ -59,6 +59,7 @@ interface ComboboxProps<T extends Value = Value>
|
|
|
59
59
|
noResultsPlaceholder?: ReactNode
|
|
60
60
|
allowClear?: boolean
|
|
61
61
|
forceHideInput?: boolean // always hide input -> used for singe value select that don't have query/filter
|
|
62
|
+
displayMode?: "count" | "chips" // how to display multiple selected values
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
const ComboboxImpl = <T extends Value = string>(
|
|
@@ -76,6 +77,7 @@ const ComboboxImpl = <T extends Value = string>(
|
|
|
76
77
|
noResultsPlaceholder,
|
|
77
78
|
allowClear,
|
|
78
79
|
forceHideInput,
|
|
80
|
+
displayMode = "count",
|
|
79
81
|
...inputProps
|
|
80
82
|
}: ComboboxProps<T>,
|
|
81
83
|
ref: ForwardedRef<HTMLInputElement>
|
|
@@ -143,6 +145,15 @@ const ComboboxImpl = <T extends Value = string>(
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
const handleRemoveValue = (valueToRemove: string) => {
|
|
149
|
+
if (!isArrayValue || !Array.isArray(selectedValues)) {
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const newValues = selectedValues.filter((v) => v !== valueToRemove) as T
|
|
154
|
+
handleValueChange(newValues)
|
|
155
|
+
}
|
|
156
|
+
|
|
146
157
|
/**
|
|
147
158
|
* Filter and sort the options based on the search value,
|
|
148
159
|
* and whether the value is already selected.
|
|
@@ -235,109 +246,179 @@ const ComboboxImpl = <T extends Value = string>(
|
|
|
235
246
|
startTransition(() => handleSearchChange(query))
|
|
236
247
|
}}
|
|
237
248
|
>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
249
|
+
{displayMode === "chips" && isArrayValue ? (
|
|
250
|
+
<div
|
|
251
|
+
className={clx(
|
|
252
|
+
"relative flex cursor-pointer flex-wrap items-center gap-1.5",
|
|
253
|
+
"min-h-8 w-full rounded-md",
|
|
254
|
+
"bg-ui-bg-field transition-fg shadow-borders-base",
|
|
255
|
+
"has-[input:focus]:shadow-borders-interactive-with-active",
|
|
256
|
+
"has-[:invalid]:shadow-borders-error has-[[aria-invalid=true]]:shadow-borders-error",
|
|
257
|
+
"has-[:disabled]:bg-ui-bg-disabled has-[:disabled]:text-ui-fg-disabled has-[:disabled]:cursor-not-allowed",
|
|
258
|
+
"p-1",
|
|
259
|
+
className
|
|
260
|
+
)}
|
|
261
|
+
>
|
|
262
|
+
{Array.isArray(selectedValues) &&
|
|
263
|
+
selectedValues.map((value) => {
|
|
264
|
+
const option = options.find((o) => o.value === value)
|
|
265
|
+
if (!option) return null
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<Badge
|
|
269
|
+
key={value}
|
|
270
|
+
size="2xsmall"
|
|
271
|
+
className="gap-x-0.5 pl-1.5 pr-1 transition-fg"
|
|
272
|
+
>
|
|
273
|
+
{option.label}
|
|
274
|
+
<button
|
|
275
|
+
tabIndex={-1}
|
|
276
|
+
type="button"
|
|
277
|
+
onClick={(e) => {
|
|
278
|
+
e.preventDefault()
|
|
279
|
+
handleRemoveValue(value)
|
|
280
|
+
}}
|
|
281
|
+
className="text-ui-fg-subtle transition-fg outline-none"
|
|
282
|
+
>
|
|
283
|
+
<XMarkMini />
|
|
284
|
+
</button>
|
|
285
|
+
</Badge>
|
|
286
|
+
)
|
|
287
|
+
})}
|
|
288
|
+
<div className="relative flex flex-1 items-center min-w-[120px]">
|
|
289
|
+
<PrimitiveCombobox
|
|
290
|
+
autoSelect
|
|
291
|
+
ref={comboboxRef}
|
|
292
|
+
onFocus={() => setOpen(true)}
|
|
270
293
|
className={clx(
|
|
271
|
-
"
|
|
272
|
-
{
|
|
273
|
-
"start-[calc(var(--tag-width)+8px)]": showTag,
|
|
274
|
-
"start-2": !showTag,
|
|
275
|
-
}
|
|
294
|
+
"txt-compact-small text-ui-fg-base !placeholder:text-ui-fg-muted transition-fg size-full cursor-pointer bg-transparent pe-8 ps-1 outline-none focus:cursor-text"
|
|
276
295
|
)}
|
|
296
|
+
placeholder={
|
|
297
|
+
Array.isArray(selectedValues) && selectedValues.length > 0
|
|
298
|
+
? undefined
|
|
299
|
+
: placeholder
|
|
300
|
+
}
|
|
301
|
+
{...inputProps}
|
|
302
|
+
/>
|
|
303
|
+
</div>
|
|
304
|
+
<PrimitiveComboboxDisclosure
|
|
305
|
+
render={(props) => {
|
|
306
|
+
return (
|
|
307
|
+
<button
|
|
308
|
+
{...props}
|
|
309
|
+
type="button"
|
|
310
|
+
className="text-ui-fg-muted transition-fg hover:bg-ui-bg-field-hover absolute end-0 top-0 flex h-8 w-8 items-center justify-center rounded-r outline-none"
|
|
311
|
+
>
|
|
312
|
+
<TrianglesMini />
|
|
313
|
+
</button>
|
|
314
|
+
)
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
</div>
|
|
318
|
+
) : (
|
|
319
|
+
<div
|
|
320
|
+
className={clx(
|
|
321
|
+
"relative flex cursor-pointer items-center gap-x-2 overflow-hidden",
|
|
322
|
+
"h-8 w-full rounded-md",
|
|
323
|
+
"bg-ui-bg-field transition-fg shadow-borders-base",
|
|
324
|
+
"has-[input:focus]:shadow-borders-interactive-with-active",
|
|
325
|
+
"has-[:invalid]:shadow-borders-error has-[[aria-invalid=true]]:shadow-borders-error",
|
|
326
|
+
"has-[:disabled]:bg-ui-bg-disabled has-[:disabled]:text-ui-fg-disabled has-[:disabled]:cursor-not-allowed",
|
|
327
|
+
className
|
|
328
|
+
)}
|
|
329
|
+
style={
|
|
330
|
+
{
|
|
331
|
+
"--tag-width": `${tagWidth}px`,
|
|
332
|
+
} as CSSProperties
|
|
333
|
+
}
|
|
334
|
+
>
|
|
335
|
+
{showTag && (
|
|
336
|
+
<button
|
|
337
|
+
type="button"
|
|
338
|
+
onClick={(e) => {
|
|
339
|
+
e.preventDefault()
|
|
340
|
+
handleValueChange(isArrayValue ? ([] as unknown as T) : undefined)
|
|
341
|
+
}}
|
|
342
|
+
className="bg-ui-bg-base hover:bg-ui-bg-base-hover txt-compact-small-plus text-ui-fg-subtle focus-within:border-ui-fg-interactive transition-fg absolute start-0.5 top-0.5 z-[1] flex h-[28px] items-center rounded-[4px] border py-[3px] pe-1 ps-1.5 outline-none"
|
|
277
343
|
>
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
</div>
|
|
344
|
+
<span className="tabular-nums">{selectedValues.length}</span>
|
|
345
|
+
<XMarkMini className="text-ui-fg-muted" />
|
|
346
|
+
</button>
|
|
282
347
|
)}
|
|
283
|
-
|
|
284
|
-
|
|
348
|
+
<div className="relative flex size-full items-center">
|
|
349
|
+
{showSelected && (
|
|
350
|
+
<div
|
|
351
|
+
className={clx(
|
|
352
|
+
"pointer-events-none absolute inset-y-0 flex size-full items-center",
|
|
353
|
+
{
|
|
354
|
+
"start-[calc(var(--tag-width)+8px)]": showTag,
|
|
355
|
+
"start-2": !showTag,
|
|
356
|
+
}
|
|
357
|
+
)}
|
|
358
|
+
>
|
|
359
|
+
<Text size="small" leading="compact">
|
|
360
|
+
{t("general.selected")}
|
|
361
|
+
</Text>
|
|
362
|
+
</div>
|
|
363
|
+
)}
|
|
364
|
+
{hideInput && (
|
|
365
|
+
<div
|
|
366
|
+
className={clx(
|
|
367
|
+
"pointer-events-none absolute inset-y-0 flex size-full items-center overflow-hidden",
|
|
368
|
+
{
|
|
369
|
+
"start-[calc(var(--tag-width)+8px)]": showTag,
|
|
370
|
+
"start-2": !showTag,
|
|
371
|
+
}
|
|
372
|
+
)}
|
|
373
|
+
>
|
|
374
|
+
<Text size="small" leading="compact" className="truncate">
|
|
375
|
+
{selectedLabel}
|
|
376
|
+
</Text>
|
|
377
|
+
</div>
|
|
378
|
+
)}
|
|
379
|
+
<PrimitiveCombobox
|
|
380
|
+
autoSelect
|
|
381
|
+
ref={comboboxRef}
|
|
382
|
+
onFocus={() => setOpen(true)}
|
|
285
383
|
className={clx(
|
|
286
|
-
"
|
|
384
|
+
"txt-compact-small text-ui-fg-base !placeholder:text-ui-fg-muted transition-fg size-full cursor-pointer bg-transparent pe-8 ps-2 outline-none focus:cursor-text",
|
|
287
385
|
{
|
|
288
|
-
"
|
|
289
|
-
"
|
|
386
|
+
"opacity-0": hideInput,
|
|
387
|
+
"ps-2": !showTag,
|
|
388
|
+
"ps-[calc(var(--tag-width)+8px)]": showTag,
|
|
290
389
|
}
|
|
291
390
|
)}
|
|
391
|
+
placeholder={hidePlaceholder ? undefined : placeholder}
|
|
392
|
+
{...inputProps}
|
|
393
|
+
/>
|
|
394
|
+
</div>
|
|
395
|
+
{allowClear && controlledValue && (
|
|
396
|
+
<button
|
|
397
|
+
type="button"
|
|
398
|
+
onClick={(e) => {
|
|
399
|
+
e.preventDefault()
|
|
400
|
+
handleValueChange(undefined)
|
|
401
|
+
}}
|
|
402
|
+
className="bg-ui-bg-base hover:bg-ui-bg-base-hover txt-compact-small-plus text-ui-fg-subtle focus-within:border-ui-fg-interactive transition-fg absolute end-[28px] top-0.5 z-[1] flex h-[28px] items-center rounded-[4px] border px-1.5 py-[2px] outline-none"
|
|
292
403
|
>
|
|
293
|
-
<
|
|
294
|
-
|
|
295
|
-
</Text>
|
|
296
|
-
</div>
|
|
404
|
+
<XMarkMini className="text-ui-fg-muted" />
|
|
405
|
+
</button>
|
|
297
406
|
)}
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
)}
|
|
311
|
-
placeholder={hidePlaceholder ? undefined : placeholder}
|
|
312
|
-
{...inputProps}
|
|
407
|
+
<PrimitiveComboboxDisclosure
|
|
408
|
+
render={(props) => {
|
|
409
|
+
return (
|
|
410
|
+
<button
|
|
411
|
+
{...props}
|
|
412
|
+
type="button"
|
|
413
|
+
className="text-ui-fg-muted transition-fg hover:bg-ui-bg-field-hover absolute end-0 flex size-8 items-center justify-center rounded-r outline-none"
|
|
414
|
+
>
|
|
415
|
+
<TrianglesMini />
|
|
416
|
+
</button>
|
|
417
|
+
)
|
|
418
|
+
}}
|
|
313
419
|
/>
|
|
314
420
|
</div>
|
|
315
|
-
|
|
316
|
-
<button
|
|
317
|
-
type="button"
|
|
318
|
-
onClick={(e) => {
|
|
319
|
-
e.preventDefault()
|
|
320
|
-
handleValueChange(undefined)
|
|
321
|
-
}}
|
|
322
|
-
className="bg-ui-bg-base hover:bg-ui-bg-base-hover txt-compact-small-plus text-ui-fg-subtle focus-within:border-ui-fg-interactive transition-fg absolute end-[28px] top-0.5 z-[1] flex h-[28px] items-center rounded-[4px] border px-1.5 py-[2px] outline-none"
|
|
323
|
-
>
|
|
324
|
-
<XMarkMini className="text-ui-fg-muted" />
|
|
325
|
-
</button>
|
|
326
|
-
)}
|
|
327
|
-
<PrimitiveComboboxDisclosure
|
|
328
|
-
render={(props) => {
|
|
329
|
-
return (
|
|
330
|
-
<button
|
|
331
|
-
{...props}
|
|
332
|
-
type="button"
|
|
333
|
-
className="text-ui-fg-muted transition-fg hover:bg-ui-bg-field-hover absolute end-0 flex size-8 items-center justify-center rounded-r outline-none"
|
|
334
|
-
>
|
|
335
|
-
<TrianglesMini />
|
|
336
|
-
</button>
|
|
337
|
-
)
|
|
338
|
-
}}
|
|
339
|
-
/>
|
|
340
|
-
</div>
|
|
421
|
+
)}
|
|
341
422
|
<PrimitiveComboboxPopover
|
|
342
423
|
gutter={4}
|
|
343
424
|
sameWidth
|
|
@@ -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"),
|
|
@@ -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 />,
|
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
|
+
}
|