@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
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { HttpTypes } from "@medusajs/types"
|
|
2
|
+
import { Button, toast } from "@medusajs/ui"
|
|
3
|
+
import { useMemo, useState } from "react"
|
|
4
|
+
import { useTranslation } from "react-i18next"
|
|
5
|
+
import * as zod from "zod"
|
|
6
|
+
|
|
7
|
+
import { Form } from "../../../../../components/common/form"
|
|
8
|
+
import { Combobox } from "../../../../../components/inputs/combobox"
|
|
9
|
+
import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
|
10
|
+
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
|
11
|
+
import { useExtendableForm } from "../../../../../dashboard-app"
|
|
12
|
+
import {
|
|
13
|
+
useLinkProductOptions,
|
|
14
|
+
useProductOptions,
|
|
15
|
+
} from "../../../../../hooks/api"
|
|
16
|
+
import { useExtension } from "../../../../../providers/extension-provider"
|
|
17
|
+
|
|
18
|
+
type ProductOptionsManageFormProps = {
|
|
19
|
+
product: HttpTypes.AdminProduct
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ProductOptionsManageSchema = zod.object({
|
|
23
|
+
option_ids: zod.array(zod.string()),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export const ProductOptionsManageForm = ({
|
|
27
|
+
product,
|
|
28
|
+
}: ProductOptionsManageFormProps) => {
|
|
29
|
+
const { t } = useTranslation()
|
|
30
|
+
const { handleSuccess } = useRouteModal()
|
|
31
|
+
const { getFormConfigs } = useExtension()
|
|
32
|
+
const configs = getFormConfigs("product", "edit")
|
|
33
|
+
|
|
34
|
+
const { product_options = [], isLoading } = useProductOptions({
|
|
35
|
+
is_exclusive: false,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const productOptionChoices = useMemo(() => {
|
|
39
|
+
return product_options.map((option) => ({
|
|
40
|
+
value: option.id,
|
|
41
|
+
label: option.title,
|
|
42
|
+
}))
|
|
43
|
+
}, [product_options])
|
|
44
|
+
|
|
45
|
+
const [selectedOptionIds, setSelectedOptionIds] = useState<string[]>(
|
|
46
|
+
product.options?.map((opt) => opt.id) || []
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const form = useExtendableForm({
|
|
50
|
+
defaultValues: {
|
|
51
|
+
option_ids: product.options?.map((opt) => opt.id) || [],
|
|
52
|
+
},
|
|
53
|
+
schema: ProductOptionsManageSchema,
|
|
54
|
+
configs: configs,
|
|
55
|
+
data: product,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const { mutateAsync, isPending } = useLinkProductOptions(product.id)
|
|
59
|
+
|
|
60
|
+
const handleProductOptionSelect = (optionIds: string[]) => {
|
|
61
|
+
setSelectedOptionIds(optionIds)
|
|
62
|
+
form.setValue("option_ids", optionIds)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
66
|
+
const currentOptionIds = product.options?.map((opt) => opt.id) || []
|
|
67
|
+
const newOptionIds = data.option_ids
|
|
68
|
+
|
|
69
|
+
// Determine which options to add and remove
|
|
70
|
+
const optionsToAdd = newOptionIds.filter(
|
|
71
|
+
(id) => !currentOptionIds.includes(id)
|
|
72
|
+
)
|
|
73
|
+
const optionsToRemove = currentOptionIds.filter(
|
|
74
|
+
(id) => !newOptionIds.includes(id)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
await mutateAsync(
|
|
78
|
+
{
|
|
79
|
+
add: optionsToAdd,
|
|
80
|
+
remove: optionsToRemove,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
onSuccess: ({ product }) => {
|
|
84
|
+
toast.success(
|
|
85
|
+
t("products.organization.edit.toasts.success", {
|
|
86
|
+
title: product.title,
|
|
87
|
+
})
|
|
88
|
+
)
|
|
89
|
+
handleSuccess()
|
|
90
|
+
},
|
|
91
|
+
onError: (error) => {
|
|
92
|
+
toast.error(error.message)
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<RouteDrawer.Form form={form}>
|
|
100
|
+
<KeyboundForm onSubmit={handleSubmit} className="flex h-full flex-col">
|
|
101
|
+
<RouteDrawer.Body>
|
|
102
|
+
<div className="flex h-full flex-col gap-y-4">
|
|
103
|
+
<Form.Field
|
|
104
|
+
control={form.control}
|
|
105
|
+
name="option_ids"
|
|
106
|
+
render={({ field }) => {
|
|
107
|
+
return (
|
|
108
|
+
<Form.Item>
|
|
109
|
+
<Form.Label>
|
|
110
|
+
{t("products.options.manage.label")}
|
|
111
|
+
</Form.Label>
|
|
112
|
+
<Form.Hint>{t("products.options.manage.hint")}</Form.Hint>
|
|
113
|
+
<Form.Control>
|
|
114
|
+
<Combobox
|
|
115
|
+
{...field}
|
|
116
|
+
value={selectedOptionIds}
|
|
117
|
+
onChange={(value) =>
|
|
118
|
+
handleProductOptionSelect(value as string[])
|
|
119
|
+
}
|
|
120
|
+
options={productOptionChoices}
|
|
121
|
+
placeholder={t("products.options.manage.placeholder")}
|
|
122
|
+
disabled={isLoading}
|
|
123
|
+
/>
|
|
124
|
+
</Form.Control>
|
|
125
|
+
<Form.ErrorMessage />
|
|
126
|
+
</Form.Item>
|
|
127
|
+
)
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</RouteDrawer.Body>
|
|
132
|
+
<RouteDrawer.Footer>
|
|
133
|
+
<div className="flex items-center justify-end gap-x-2">
|
|
134
|
+
<RouteDrawer.Close asChild>
|
|
135
|
+
<Button size="small" variant="secondary">
|
|
136
|
+
{t("actions.cancel")}
|
|
137
|
+
</Button>
|
|
138
|
+
</RouteDrawer.Close>
|
|
139
|
+
<Button size="small" type="submit" isLoading={isPending}>
|
|
140
|
+
{t("actions.save")}
|
|
141
|
+
</Button>
|
|
142
|
+
</div>
|
|
143
|
+
</RouteDrawer.Footer>
|
|
144
|
+
</KeyboundForm>
|
|
145
|
+
</RouteDrawer.Form>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductOptionsManage as Component } from "./product-options-manage"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Heading } from "@medusajs/ui"
|
|
2
|
+
import { useTranslation } from "react-i18next"
|
|
3
|
+
import { useParams } from "react-router-dom"
|
|
4
|
+
|
|
5
|
+
import { RouteDrawer } from "../../../components/modals"
|
|
6
|
+
import { useProduct } from "../../../hooks/api"
|
|
7
|
+
import { PRODUCT_DETAIL_FIELDS } from "../product-detail/constants"
|
|
8
|
+
import { ProductOptionsManageForm } from "./components/product-options-manage-form"
|
|
9
|
+
|
|
10
|
+
export const ProductOptionsManage = () => {
|
|
11
|
+
const { id } = useParams()
|
|
12
|
+
const { t } = useTranslation()
|
|
13
|
+
|
|
14
|
+
const { product, isLoading, isError, error } = useProduct(id!, {
|
|
15
|
+
fields: PRODUCT_DETAIL_FIELDS,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
if (isError) {
|
|
19
|
+
throw error
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<RouteDrawer>
|
|
24
|
+
<RouteDrawer.Header>
|
|
25
|
+
<RouteDrawer.Title asChild>
|
|
26
|
+
<Heading>{t("products.options.manage.header")}</Heading>
|
|
27
|
+
</RouteDrawer.Title>
|
|
28
|
+
<RouteDrawer.Description className="sr-only">
|
|
29
|
+
{t("products.options.manage.description")}
|
|
30
|
+
</RouteDrawer.Description>
|
|
31
|
+
</RouteDrawer.Header>
|
|
32
|
+
{!isLoading && product && <ProductOptionsManageForm product={product} />}
|
|
33
|
+
</RouteDrawer>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChipInput
|
|
3
|
-
} from "./chunk-XDJ7OMBR.mjs";
|
|
4
|
-
import "./chunk-IUCDCPJU.mjs";
|
|
5
|
-
import {
|
|
6
|
-
KeyboundForm
|
|
7
|
-
} from "./chunk-6HTZNHPT.mjs";
|
|
8
|
-
import {
|
|
9
|
-
RouteDrawer,
|
|
10
|
-
useRouteModal
|
|
11
|
-
} from "./chunk-AERWK3TJ.mjs";
|
|
12
|
-
import {
|
|
13
|
-
Form
|
|
14
|
-
} from "./chunk-OBQI23QM.mjs";
|
|
15
|
-
import {
|
|
16
|
-
useCreateProductOption,
|
|
17
|
-
useProduct
|
|
18
|
-
} from "./chunk-4BGVSXZZ.mjs";
|
|
19
|
-
import "./chunk-FXYH54JP.mjs";
|
|
20
|
-
import "./chunk-774WSTCC.mjs";
|
|
21
|
-
import "./chunk-DEQUVHHE.mjs";
|
|
22
|
-
import "./chunk-QZ7TP4HQ.mjs";
|
|
23
|
-
|
|
24
|
-
// src/routes/products/product-create-option/product-create-option.tsx
|
|
25
|
-
import { Heading } from "@medusajs/ui";
|
|
26
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
27
|
-
import { useParams } from "react-router-dom";
|
|
28
|
-
|
|
29
|
-
// src/routes/products/product-create-option/components/create-product-option-form/create-product-option-form.tsx
|
|
30
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
31
|
-
import { Button, Input, toast } from "@medusajs/ui";
|
|
32
|
-
import { useForm } from "react-hook-form";
|
|
33
|
-
import { useTranslation } from "react-i18next";
|
|
34
|
-
import { z } from "zod";
|
|
35
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
-
var CreateProductOptionSchema = z.object({
|
|
37
|
-
title: z.string().min(1),
|
|
38
|
-
values: z.array(z.string()).optional()
|
|
39
|
-
});
|
|
40
|
-
var CreateProductOptionForm = ({
|
|
41
|
-
product
|
|
42
|
-
}) => {
|
|
43
|
-
const { t } = useTranslation();
|
|
44
|
-
const { handleSuccess } = useRouteModal();
|
|
45
|
-
const form = useForm({
|
|
46
|
-
defaultValues: {
|
|
47
|
-
title: "",
|
|
48
|
-
values: []
|
|
49
|
-
},
|
|
50
|
-
resolver: zodResolver(CreateProductOptionSchema)
|
|
51
|
-
});
|
|
52
|
-
const { mutateAsync, isPending } = useCreateProductOption(product.id);
|
|
53
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
54
|
-
mutateAsync(values, {
|
|
55
|
-
onSuccess: () => {
|
|
56
|
-
toast.success(
|
|
57
|
-
t("products.options.create.successToast", {
|
|
58
|
-
title: values.title
|
|
59
|
-
})
|
|
60
|
-
);
|
|
61
|
-
handleSuccess();
|
|
62
|
-
},
|
|
63
|
-
onError: async (err) => {
|
|
64
|
-
toast.error(err.message);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
69
|
-
KeyboundForm,
|
|
70
|
-
{
|
|
71
|
-
onSubmit: handleSubmit,
|
|
72
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
73
|
-
children: [
|
|
74
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: [
|
|
75
|
-
/* @__PURE__ */ jsx(
|
|
76
|
-
Form.Field,
|
|
77
|
-
{
|
|
78
|
-
control: form.control,
|
|
79
|
-
name: "title",
|
|
80
|
-
render: ({ field }) => {
|
|
81
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
82
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("products.fields.options.optionTitle") }),
|
|
83
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
84
|
-
Input,
|
|
85
|
-
{
|
|
86
|
-
...field,
|
|
87
|
-
placeholder: t(
|
|
88
|
-
"products.fields.options.optionTitlePlaceholder"
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
) }),
|
|
92
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
93
|
-
] });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ jsx(
|
|
98
|
-
Form.Field,
|
|
99
|
-
{
|
|
100
|
-
control: form.control,
|
|
101
|
-
name: "values",
|
|
102
|
-
render: ({ field }) => {
|
|
103
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
104
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("products.fields.options.variations") }),
|
|
105
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
106
|
-
ChipInput,
|
|
107
|
-
{
|
|
108
|
-
...field,
|
|
109
|
-
placeholder: t(
|
|
110
|
-
"products.fields.options.variantionsPlaceholder"
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
) }),
|
|
114
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
115
|
-
] });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
] }),
|
|
120
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
121
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
|
|
122
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", size: "small", isLoading: isPending, children: t("actions.save") })
|
|
123
|
-
] }) })
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
) });
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// src/routes/products/product-create-option/product-create-option.tsx
|
|
130
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
131
|
-
var ProductCreateOption = () => {
|
|
132
|
-
const { id } = useParams();
|
|
133
|
-
const { t } = useTranslation2();
|
|
134
|
-
const { product, isLoading, isError, error } = useProduct(id);
|
|
135
|
-
if (isError) {
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
138
|
-
return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
|
|
139
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading, { children: t("products.options.create.header") }) }),
|
|
140
|
-
!isLoading && product && /* @__PURE__ */ jsx2(CreateProductOptionForm, { product })
|
|
141
|
-
] });
|
|
142
|
-
};
|
|
143
|
-
export {
|
|
144
|
-
ProductCreateOption as Component
|
|
145
|
-
};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChipInput
|
|
3
|
-
} from "./chunk-XDJ7OMBR.mjs";
|
|
4
|
-
import "./chunk-IUCDCPJU.mjs";
|
|
5
|
-
import {
|
|
6
|
-
KeyboundForm
|
|
7
|
-
} from "./chunk-6HTZNHPT.mjs";
|
|
8
|
-
import {
|
|
9
|
-
RouteDrawer,
|
|
10
|
-
useRouteModal
|
|
11
|
-
} from "./chunk-AERWK3TJ.mjs";
|
|
12
|
-
import {
|
|
13
|
-
Form
|
|
14
|
-
} from "./chunk-OBQI23QM.mjs";
|
|
15
|
-
import {
|
|
16
|
-
useProduct,
|
|
17
|
-
useUpdateProductOption
|
|
18
|
-
} from "./chunk-4BGVSXZZ.mjs";
|
|
19
|
-
import "./chunk-FXYH54JP.mjs";
|
|
20
|
-
import "./chunk-774WSTCC.mjs";
|
|
21
|
-
import "./chunk-DEQUVHHE.mjs";
|
|
22
|
-
import "./chunk-QZ7TP4HQ.mjs";
|
|
23
|
-
|
|
24
|
-
// src/routes/products/product-edit-option/product-edit-option.tsx
|
|
25
|
-
import { Heading } from "@medusajs/ui";
|
|
26
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
27
|
-
import { json, useParams } from "react-router-dom";
|
|
28
|
-
|
|
29
|
-
// src/routes/products/product-edit-option/components/edit-product-option-form/edit-product-option-form.tsx
|
|
30
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
31
|
-
import { Button, Input } from "@medusajs/ui";
|
|
32
|
-
import { useForm } from "react-hook-form";
|
|
33
|
-
import { useTranslation } from "react-i18next";
|
|
34
|
-
import { z } from "zod";
|
|
35
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
-
var CreateProductOptionSchema = z.object({
|
|
37
|
-
title: z.string().min(1),
|
|
38
|
-
values: z.array(z.string()).optional()
|
|
39
|
-
});
|
|
40
|
-
var CreateProductOptionForm = ({
|
|
41
|
-
option
|
|
42
|
-
}) => {
|
|
43
|
-
const { t } = useTranslation();
|
|
44
|
-
const { handleSuccess } = useRouteModal();
|
|
45
|
-
const form = useForm({
|
|
46
|
-
defaultValues: {
|
|
47
|
-
title: option.title,
|
|
48
|
-
values: option.values.map((v) => v.value)
|
|
49
|
-
},
|
|
50
|
-
resolver: zodResolver(CreateProductOptionSchema)
|
|
51
|
-
});
|
|
52
|
-
const { mutateAsync, isPending } = useUpdateProductOption(
|
|
53
|
-
option.product_id,
|
|
54
|
-
option.id
|
|
55
|
-
);
|
|
56
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
57
|
-
mutateAsync(
|
|
58
|
-
{
|
|
59
|
-
id: option.id,
|
|
60
|
-
...values
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
onSuccess: () => {
|
|
64
|
-
handleSuccess();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
70
|
-
KeyboundForm,
|
|
71
|
-
{
|
|
72
|
-
onSubmit: handleSubmit,
|
|
73
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: [
|
|
76
|
-
/* @__PURE__ */ jsx(
|
|
77
|
-
Form.Field,
|
|
78
|
-
{
|
|
79
|
-
control: form.control,
|
|
80
|
-
name: "title",
|
|
81
|
-
render: ({ field }) => {
|
|
82
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
83
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("products.fields.options.optionTitle") }),
|
|
84
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
85
|
-
Input,
|
|
86
|
-
{
|
|
87
|
-
...field,
|
|
88
|
-
placeholder: t(
|
|
89
|
-
"products.fields.options.optionTitlePlaceholder"
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
) }),
|
|
93
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
94
|
-
] });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ jsx(
|
|
99
|
-
Form.Field,
|
|
100
|
-
{
|
|
101
|
-
control: form.control,
|
|
102
|
-
name: "values",
|
|
103
|
-
render: ({ field: { ...field } }) => {
|
|
104
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
105
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("products.fields.options.variations") }),
|
|
106
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
107
|
-
ChipInput,
|
|
108
|
-
{
|
|
109
|
-
...field,
|
|
110
|
-
placeholder: t(
|
|
111
|
-
"products.fields.options.variantionsPlaceholder"
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
) }),
|
|
115
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
116
|
-
] });
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
)
|
|
120
|
-
] }),
|
|
121
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
122
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
|
|
123
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", size: "small", isLoading: isPending, children: t("actions.save") })
|
|
124
|
-
] }) })
|
|
125
|
-
]
|
|
126
|
-
}
|
|
127
|
-
) });
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// src/routes/products/product-edit-option/product-edit-option.tsx
|
|
131
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
132
|
-
var ProductEditOption = () => {
|
|
133
|
-
const { id, option_id } = useParams();
|
|
134
|
-
const { t } = useTranslation2();
|
|
135
|
-
const { product, isPending, isFetching, isError, error } = useProduct(id);
|
|
136
|
-
const option = product?.options.find((o) => o.id === option_id);
|
|
137
|
-
if (!isPending && !isFetching && !option) {
|
|
138
|
-
throw json({ message: `An option with ID ${option_id} was not found` }, 404);
|
|
139
|
-
}
|
|
140
|
-
if (isError) {
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
|
|
144
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading, { children: t("products.options.edit.header") }) }),
|
|
145
|
-
option && /* @__PURE__ */ jsx2(CreateProductOptionForm, { option })
|
|
146
|
-
] });
|
|
147
|
-
};
|
|
148
|
-
export {
|
|
149
|
-
ProductEditOption as Component
|
|
150
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { zodResolver } from "@hookform/resolvers/zod"
|
|
2
|
-
import { Button, Input, toast } from "@medusajs/ui"
|
|
3
|
-
import { useForm } from "react-hook-form"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
import { z } from "zod"
|
|
6
|
-
|
|
7
|
-
import { HttpTypes } from "@medusajs/types"
|
|
8
|
-
import { Form } from "../../../../../components/common/form"
|
|
9
|
-
import { ChipInput } from "../../../../../components/inputs/chip-input"
|
|
10
|
-
import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
|
11
|
-
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
|
12
|
-
import { useCreateProductOption } from "../../../../../hooks/api/products"
|
|
13
|
-
|
|
14
|
-
type EditProductOptionsFormProps = {
|
|
15
|
-
product: HttpTypes.AdminProduct
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const CreateProductOptionSchema = z.object({
|
|
19
|
-
title: z.string().min(1),
|
|
20
|
-
values: z.array(z.string()).optional(),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export const CreateProductOptionForm = ({
|
|
24
|
-
product,
|
|
25
|
-
}: EditProductOptionsFormProps) => {
|
|
26
|
-
const { t } = useTranslation()
|
|
27
|
-
const { handleSuccess } = useRouteModal()
|
|
28
|
-
|
|
29
|
-
const form = useForm<z.infer<typeof CreateProductOptionSchema>>({
|
|
30
|
-
defaultValues: {
|
|
31
|
-
title: "",
|
|
32
|
-
values: [],
|
|
33
|
-
},
|
|
34
|
-
resolver: zodResolver(CreateProductOptionSchema),
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const { mutateAsync, isPending } = useCreateProductOption(product.id)
|
|
38
|
-
|
|
39
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
40
|
-
mutateAsync(values, {
|
|
41
|
-
onSuccess: () => {
|
|
42
|
-
toast.success(
|
|
43
|
-
t("products.options.create.successToast", {
|
|
44
|
-
title: values.title,
|
|
45
|
-
})
|
|
46
|
-
)
|
|
47
|
-
handleSuccess()
|
|
48
|
-
},
|
|
49
|
-
onError: async (err) => {
|
|
50
|
-
toast.error(err.message)
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<RouteDrawer.Form form={form}>
|
|
57
|
-
<KeyboundForm
|
|
58
|
-
onSubmit={handleSubmit}
|
|
59
|
-
className="flex flex-1 flex-col overflow-hidden"
|
|
60
|
-
>
|
|
61
|
-
<RouteDrawer.Body className="flex flex-1 flex-col gap-y-4 overflow-auto">
|
|
62
|
-
<Form.Field
|
|
63
|
-
control={form.control}
|
|
64
|
-
name="title"
|
|
65
|
-
render={({ field }) => {
|
|
66
|
-
return (
|
|
67
|
-
<Form.Item>
|
|
68
|
-
<Form.Label>
|
|
69
|
-
{t("products.fields.options.optionTitle")}
|
|
70
|
-
</Form.Label>
|
|
71
|
-
<Form.Control>
|
|
72
|
-
<Input
|
|
73
|
-
{...field}
|
|
74
|
-
placeholder={t(
|
|
75
|
-
"products.fields.options.optionTitlePlaceholder"
|
|
76
|
-
)}
|
|
77
|
-
/>
|
|
78
|
-
</Form.Control>
|
|
79
|
-
<Form.ErrorMessage />
|
|
80
|
-
</Form.Item>
|
|
81
|
-
)
|
|
82
|
-
}}
|
|
83
|
-
/>
|
|
84
|
-
<Form.Field
|
|
85
|
-
control={form.control}
|
|
86
|
-
name="values"
|
|
87
|
-
render={({ field }) => {
|
|
88
|
-
return (
|
|
89
|
-
<Form.Item>
|
|
90
|
-
<Form.Label>
|
|
91
|
-
{t("products.fields.options.variations")}
|
|
92
|
-
</Form.Label>
|
|
93
|
-
<Form.Control>
|
|
94
|
-
<ChipInput
|
|
95
|
-
{...field}
|
|
96
|
-
placeholder={t(
|
|
97
|
-
"products.fields.options.variantionsPlaceholder"
|
|
98
|
-
)}
|
|
99
|
-
/>
|
|
100
|
-
</Form.Control>
|
|
101
|
-
<Form.ErrorMessage />
|
|
102
|
-
</Form.Item>
|
|
103
|
-
)
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
</RouteDrawer.Body>
|
|
107
|
-
<RouteDrawer.Footer>
|
|
108
|
-
<div className="flex items-center justify-end gap-x-2">
|
|
109
|
-
<RouteDrawer.Close asChild>
|
|
110
|
-
<Button variant="secondary" size="small">
|
|
111
|
-
{t("actions.cancel")}
|
|
112
|
-
</Button>
|
|
113
|
-
</RouteDrawer.Close>
|
|
114
|
-
<Button type="submit" size="small" isLoading={isPending}>
|
|
115
|
-
{t("actions.save")}
|
|
116
|
-
</Button>
|
|
117
|
-
</div>
|
|
118
|
-
</RouteDrawer.Footer>
|
|
119
|
-
</KeyboundForm>
|
|
120
|
-
</RouteDrawer.Form>
|
|
121
|
-
)
|
|
122
|
-
}
|
package/src/routes/products/product-create-option/components/create-product-option-form/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./create-product-option-form"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ProductCreateOption as Component } from "./product-create-option"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Heading } from "@medusajs/ui"
|
|
2
|
-
import { useTranslation } from "react-i18next"
|
|
3
|
-
import { useParams } from "react-router-dom"
|
|
4
|
-
import { RouteDrawer } from "../../../components/modals"
|
|
5
|
-
import { useProduct } from "../../../hooks/api/products"
|
|
6
|
-
import { CreateProductOptionForm } from "./components/create-product-option-form"
|
|
7
|
-
|
|
8
|
-
export const ProductCreateOption = () => {
|
|
9
|
-
const { id } = useParams()
|
|
10
|
-
const { t } = useTranslation()
|
|
11
|
-
|
|
12
|
-
const { product, isLoading, isError, error } = useProduct(id!)
|
|
13
|
-
|
|
14
|
-
if (isError) {
|
|
15
|
-
throw error
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<RouteDrawer>
|
|
20
|
-
<RouteDrawer.Header>
|
|
21
|
-
<Heading>{t("products.options.create.header")}</Heading>
|
|
22
|
-
</RouteDrawer.Header>
|
|
23
|
-
{!isLoading && product && <CreateProductOptionForm product={product} />}
|
|
24
|
-
</RouteDrawer>
|
|
25
|
-
)
|
|
26
|
-
}
|