@medusajs/dashboard 3.0.0-snapshot-20251216145629 → 3.0.0-snapshot-20260102125810
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-locales-2OZXZCT5.mjs +81 -0
- package/dist/{adjust-inventory-26YXAXQL.mjs → adjust-inventory-47KGDWME.mjs} +2 -2
- package/dist/{api-key-management-create-EMP32G2D.mjs → api-key-management-create-EFPPZPZ7.mjs} +4 -4
- package/dist/{api-key-management-detail-6RCDH73M.mjs → api-key-management-detail-4IFED7SF.mjs} +15 -15
- package/dist/{api-key-management-edit-IBM3ZXHK.mjs → api-key-management-edit-QGVBNLUL.mjs} +4 -4
- package/dist/{api-key-management-list-KC5GOWAU.mjs → api-key-management-list-ROIJIIPQ.mjs} +4 -4
- package/dist/{api-key-management-sales-channels-LUB5G6RC.mjs → api-key-management-sales-channels-7P5L45AT.mjs} +6 -6
- package/dist/app.css +26 -3
- package/dist/app.js +18504 -16698
- package/dist/app.mjs +13 -13
- package/dist/{campaign-create-FJOECKGT.mjs → campaign-create-EZGZ4SBQ.mjs} +3 -3
- package/dist/{campaign-detail-5Q4BYCPX.mjs → campaign-detail-NFKLFPY4.mjs} +12 -12
- package/dist/{categories-metadata-J7M3XWI7.mjs → categories-metadata-G7BACZ26.mjs} +12 -12
- package/dist/{category-create-KHJZSC7G.mjs → category-create-7MV25HYX.mjs} +6 -6
- package/dist/{category-detail-S5IPXMHX.mjs → category-detail-XJQQ7UU4.mjs} +14 -14
- package/dist/{category-edit-CTA2EPDG.mjs → category-edit-LV7EARAB.mjs} +3 -3
- package/dist/{category-list-QBYJ4T3R.mjs → category-list-NIVLV5S3.mjs} +6 -6
- package/dist/{category-organize-SXP33XET.mjs → category-organize-SCRGWKDG.mjs} +3 -3
- package/dist/{category-products-KPW6BA5J.mjs → category-products-FXFSMCR6.mjs} +13 -13
- package/dist/{chunk-OXPE5TAY.mjs → chunk-24C2YVFU.mjs} +1 -1
- package/dist/{chunk-4JQR6QNW.mjs → chunk-333HK6Y6.mjs} +2 -2
- package/dist/{chunk-DODQ3KJT.mjs → chunk-3RRA56WC.mjs} +8 -3
- package/dist/{chunk-5LGRZSEH.mjs → chunk-3YPZ3R4U.mjs} +1 -1
- package/dist/{chunk-2DULKOPN.mjs → chunk-5ISRTMYH.mjs} +1 -1
- package/dist/{chunk-PHLCT2HA.mjs → chunk-5ZPKY5XP.mjs} +1 -1
- package/dist/{chunk-U6G4M5LP.mjs → chunk-6EXKKRZY.mjs} +1 -1
- package/dist/{chunk-GRZSG4EP.mjs → chunk-74WPAWMW.mjs} +127 -226
- package/dist/chunk-7AXHHXCX.mjs +4 -0
- package/dist/{chunk-UULAOAFM.mjs → chunk-BJ44US4R.mjs} +358 -242
- package/dist/{chunk-BMS2QLJY.mjs → chunk-BMJ5RYIO.mjs} +1 -1
- package/dist/{chunk-Y2YVTIJI.mjs → chunk-CW5PQUJ6.mjs} +1 -1
- package/dist/{chunk-IAV7IKJ6.mjs → chunk-DN5BRKVN.mjs} +1 -1
- package/dist/{chunk-RS7DWLEP.mjs → chunk-DQUXK4WW.mjs} +1 -1
- package/dist/{chunk-2XTBDCGE.mjs → chunk-DWH2OQFK.mjs} +1 -1
- package/dist/{chunk-CCQD65EY.mjs → chunk-FKNW5MLZ.mjs} +360 -288
- package/dist/{chunk-HTCYX4VD.mjs → chunk-G35UUG2P.mjs} +1 -1
- package/dist/{chunk-QKALAT7P.mjs → chunk-GGONMC2N.mjs} +1 -1
- package/dist/{chunk-FYWHE3W5.mjs → chunk-GJN5SXGZ.mjs} +1 -1
- package/dist/{chunk-CVHJAKLQ.mjs → chunk-HDO2UCKF.mjs} +1 -1
- package/dist/{chunk-3C6WQ7NH.mjs → chunk-IWNNQ6HA.mjs} +37 -3
- package/dist/{chunk-OL24RDYM.mjs → chunk-KHJL6MUQ.mjs} +8 -8
- package/dist/{chunk-6P4Q4AAP.mjs → chunk-KPI4WFJU.mjs} +3 -3
- package/dist/{chunk-AHZLMCZF.mjs → chunk-KSDXSKJ7.mjs} +1 -1
- package/dist/{chunk-BZKI5J2M.mjs → chunk-L7A2JIQY.mjs} +3 -3
- package/dist/{chunk-XY7A7GZJ.mjs → chunk-LEAMWI5H.mjs} +1 -1
- package/dist/{chunk-A4XYK3MY.mjs → chunk-LG5B2BVB.mjs} +2 -2
- package/dist/{chunk-23GTCEOV.mjs → chunk-ML7BA2NY.mjs} +1 -1
- package/dist/{chunk-OFN7DIZA.mjs → chunk-OYHFHBNL.mjs} +94 -7
- package/dist/{chunk-OSHH5GAS.mjs → chunk-Q34TRFIW.mjs} +1 -13
- package/dist/{chunk-UJ2TMPV4.mjs → chunk-QBIQEVTU.mjs} +0 -12
- package/dist/{chunk-YYOPBKME.mjs → chunk-QHRAWZGA.mjs} +3 -3
- package/dist/{chunk-A2WBKOXJ.mjs → chunk-SO2DE6MM.mjs} +2 -2
- package/dist/chunk-T6DDBLGY.mjs +13 -0
- package/dist/{chunk-EHU67PIM.mjs → chunk-TOCMU7UV.mjs} +7 -3
- package/dist/{chunk-YIOBBZUB.mjs → chunk-U7KANQ5A.mjs} +2 -2
- package/dist/{chunk-Z6BFNHEO.mjs → chunk-UCYUWNJL.mjs} +109 -62
- package/dist/{chunk-WYATCUOM.mjs → chunk-V2RGYIAG.mjs} +10 -10
- package/dist/{chunk-UWY5ZV66.mjs → chunk-VQ73B7ZZ.mjs} +1 -13
- package/dist/chunk-XD72PXRS.mjs +329 -0
- package/dist/{store-add-locales-VJ4RJ7UI.mjs → chunk-YFXI6CWD.mjs} +2 -67
- package/dist/{chunk-AWRCV3ME.mjs → chunk-YM4XGCHB.mjs} +1 -1
- package/dist/{chunk-ZMG5B4FG.mjs → chunk-ZGV5NOTE.mjs} +1 -1
- package/dist/{collection-add-products-FU2BS3D3.mjs → collection-add-products-YDMBU2JY.mjs} +13 -13
- package/dist/{collection-create-GWKWVT7B.mjs → collection-create-RXHEXU6T.mjs} +3 -3
- package/dist/{collection-detail-VJE7XHLV.mjs → collection-detail-75XPGVOX.mjs} +13 -13
- package/dist/{collection-edit-EZIO2BR5.mjs → collection-edit-CGF47VIN.mjs} +3 -3
- package/dist/{collection-list-IGA6SCNF.mjs → collection-list-75N5NYXQ.mjs} +18 -17
- package/dist/{collection-metadata-QK7MI3D2.mjs → collection-metadata-TGGC6HM2.mjs} +12 -12
- package/dist/{customer-detail-MOV2T3LF.mjs → customer-detail-KDLZ23B3.mjs} +17 -16
- package/dist/{customer-group-detail-6T7OXGQD.mjs → customer-group-detail-ZIAVMOYS.mjs} +12 -12
- package/dist/{customer-group-list-AJEAF5D2.mjs → customer-group-list-BDDC5VVZ.mjs} +15 -15
- package/dist/{customers-add-customer-group-QVTVSQYM.mjs → customers-add-customer-group-B3ASQGP6.mjs} +12 -12
- package/dist/{edit-inventory-item-H7DAZWIT.mjs → edit-inventory-item-OKAXQRJ5.mjs} +2 -2
- package/dist/{edit-inventory-item-attributes-7HTXXPGZ.mjs → edit-inventory-item-attributes-FVWDV6O5.mjs} +2 -2
- package/dist/{edit-reservation-OVTRZHJR.mjs → edit-reservation-3PU6YSNJ.mjs} +3 -3
- package/dist/{edit-rules-SMVRTCUP.mjs → edit-rules-LOJ3P4YB.mjs} +14 -14
- package/dist/en.json +73 -5
- package/dist/{inventory-create-ANYUM4P5.mjs → inventory-create-C2WWS7QR.mjs} +13 -13
- package/dist/{inventory-detail-ZPSEMYI2.mjs → inventory-detail-AKOZ4T3Z.mjs} +12 -12
- package/dist/{inventory-list-RXJPSVZE.mjs → inventory-list-DRFJIU2O.mjs} +2 -2
- package/dist/{inventory-metadata-FNEJ3RAT.mjs → inventory-metadata-N6CJZEWD.mjs} +12 -12
- package/dist/{inventory-stock-FD4ZM4BB.mjs → inventory-stock-IJ2N7LKC.mjs} +14 -14
- package/dist/{location-detail-N3GUZSY7.mjs → location-detail-PL4Y43RS.mjs} +16 -16
- package/dist/{location-fulfillment-providers-7ZUJAGNY.mjs → location-fulfillment-providers-2PLOVSXC.mjs} +17 -16
- package/dist/{location-sales-channels-P3QJTFDT.mjs → location-sales-channels-SZARSLWT.mjs} +5 -5
- package/dist/{location-service-zone-shipping-option-create-ZJ4GIBTJ.mjs → location-service-zone-shipping-option-create-CUNSAP24.mjs} +15 -15
- package/dist/{location-service-zone-shipping-option-edit-4CGPQ3VT.mjs → location-service-zone-shipping-option-edit-OJ462SVM.mjs} +1 -1
- package/dist/{location-service-zone-shipping-option-pricing-CR4BVYG3.mjs → location-service-zone-shipping-option-pricing-5HN2Z5RB.mjs} +2 -2
- package/dist/login-VBUNWZHI.mjs +301 -0
- package/dist/{manage-locations-7HH6R4UP.mjs → manage-locations-JPCSBA5D.mjs} +2 -2
- package/dist/{order-allocate-items-HZGGYJ42.mjs → order-allocate-items-6QHQASQJ.mjs} +4 -4
- package/dist/{order-create-claim-SCDJGM46.mjs → order-create-claim-ECVSH5GC.mjs} +22 -22
- package/dist/{order-create-edit-JIE3HDHP.mjs → order-create-edit-EVIOJIXE.mjs} +14 -13
- package/dist/{order-create-exchange-LQU4YN7F.mjs → order-create-exchange-ZVYYOGI3.mjs} +22 -22
- package/dist/{order-create-fulfillment-OWUVTZXW.mjs → order-create-fulfillment-FDIFEV6X.mjs} +16 -16
- package/dist/{order-create-refund-Q6HQY42R.mjs → order-create-refund-TNPGKR5P.mjs} +17 -17
- package/dist/{order-create-return-52GHGW5Z.mjs → order-create-return-NR6XQLDD.mjs} +9 -9
- package/dist/{order-create-shipment-WAGGEPRW.mjs → order-create-shipment-UP3WGRWB.mjs} +12 -12
- package/dist/{order-detail-PVPGEWGY.mjs → order-detail-F6D5DV74.mjs} +28 -28
- package/dist/{order-edit-billing-address-UM76J4KX.mjs → order-edit-billing-address-D4AJ6Z5Q.mjs} +44 -12
- package/dist/{order-edit-email-CL3KNOCM.mjs → order-edit-email-MXYA5BII.mjs} +12 -12
- package/dist/{order-edit-shipping-address-PIESTGVL.mjs → order-edit-shipping-address-GKW2ZPGR.mjs} +42 -12
- package/dist/{order-export-LE363ZLB.mjs → order-export-KQUI2TK7.mjs} +14 -14
- package/dist/{order-list-GRLQWN4L.mjs → order-list-7A5UKGXR.mjs} +11 -11
- package/dist/{order-metadata-FHBB7MTG.mjs → order-metadata-2IXELA7C.mjs} +12 -12
- package/dist/{order-receive-return-PRVKP6J2.mjs → order-receive-return-XXHOXGDC.mjs} +13 -13
- package/dist/{order-request-transfer-XSAGRUMT.mjs → order-request-transfer-2ENR64VR.mjs} +13 -13
- package/dist/{price-list-configuration-6S3MLNXQ.mjs → price-list-configuration-BZ3ZH5FY.mjs} +3 -3
- package/dist/{price-list-create-MFRUQADC.mjs → price-list-create-GFGNP6OS.mjs} +16 -16
- package/dist/{price-list-detail-Q5VG5VGW.mjs → price-list-detail-SNNOR5N7.mjs} +17 -17
- package/dist/{price-list-edit-53UW35L3.mjs → price-list-edit-YW5BXBF2.mjs} +3 -3
- package/dist/{price-list-list-DG5YEZ44.mjs → price-list-list-OF562HME.mjs} +4 -4
- package/dist/{price-list-prices-add-SDU5YZAT.mjs → price-list-prices-add-F7A2EV7L.mjs} +15 -15
- package/dist/{price-list-prices-edit-5USQR4D4.mjs → price-list-prices-edit-PQ26MOJE.mjs} +5 -5
- package/dist/{product-attributes-K4FGFORS.mjs → product-attributes-JTPGHUXZ.mjs} +13 -13
- package/dist/{product-create-7YTRHZQQ.mjs → product-create-VFLLQWVX.mjs} +485 -561
- package/dist/{product-create-variant-ERKHTEJZ.mjs → product-create-variant-PLZ5Q2R6.mjs} +14 -14
- package/dist/{product-detail-32ZXNWOP.mjs → product-detail-ISHFZV7X.mjs} +45 -66
- package/dist/{product-edit-FBAKONMR.mjs → product-edit-6EDDNIM6.mjs} +13 -13
- package/dist/{product-export-5AD7NELI.mjs → product-export-UMMROQ7T.mjs} +18 -17
- package/dist/{product-image-variants-edit-M6QF2RLE.mjs → product-image-variants-edit-VRG3AJID.mjs} +12 -12
- package/dist/{product-import-V3KQN4TV.mjs → product-import-EPS4KDID.mjs} +12 -12
- package/dist/{product-list-EUWZIFTM.mjs → product-list-37O7VB2L.mjs} +20 -20
- package/dist/{product-media-3VJ7KENL.mjs → product-media-IV5NUSLW.mjs} +3 -3
- package/dist/{product-metadata-GL2MVPDI.mjs → product-metadata-KTVRI7B3.mjs} +12 -12
- package/dist/product-option-create-JUGLFR2K.mjs +336 -0
- package/dist/product-option-detail-VVK3YBCE.mjs +331 -0
- package/dist/product-option-edit-7FQSKI2R.mjs +325 -0
- package/dist/product-option-list-YHGRI7OJ.mjs +268 -0
- package/dist/product-option-metadata-P2DHDGYR.mjs +73 -0
- package/dist/product-options-manage-4SZDF5H5.mjs +325 -0
- package/dist/{product-organization-IUSVX22S.mjs → product-organization-OEUSIWNQ.mjs} +15 -15
- package/dist/{product-prices-4C36AG4R.mjs → product-prices-GUO3KM2U.mjs} +3 -3
- package/dist/{product-sales-channels-PPXUG4KT.mjs → product-sales-channels-BOZD3AC3.mjs} +5 -5
- package/dist/{product-shipping-profile-ETQFZ7DC.mjs → product-shipping-profile-FNFRDY47.mjs} +3 -3
- package/dist/{product-stock-VEGE6SUZ.mjs → product-stock-2DNYG73L.mjs} +14 -14
- package/dist/{product-tag-create-PQMDDKWH.mjs → product-tag-create-CW7GUCZW.mjs} +12 -12
- package/dist/{product-tag-detail-I3MBZX7U.mjs → product-tag-detail-IB5VIZ3K.mjs} +26 -25
- package/dist/{product-tag-edit-K3BBQLJR.mjs → product-tag-edit-ZSXD3DOC.mjs} +12 -12
- package/dist/{product-tag-list-JUWSOMB7.mjs → product-tag-list-MJO5PURP.mjs} +24 -23
- package/dist/{product-tag-metadata-MJH5LH7E.mjs → product-tag-metadata-DAKCXWZF.mjs} +12 -12
- package/dist/{product-type-create-DRFXTL5O.mjs → product-type-create-NRLNMABQ.mjs} +2 -2
- package/dist/{product-type-detail-RKHT5NBL.mjs → product-type-detail-J2IMAZW6.mjs} +14 -14
- package/dist/{product-type-edit-SRHCZDK7.mjs → product-type-edit-BHTPMMVI.mjs} +2 -2
- package/dist/{product-type-list-QQKAHBJ3.mjs → product-type-list-MQ2PW2IE.mjs} +3 -3
- package/dist/{product-type-metadata-CDJDFFGQ.mjs → product-type-metadata-BCZMUG3K.mjs} +12 -12
- package/dist/{product-variant-detail-XAYG5CKE.mjs → product-variant-detail-4L6DHT3K.mjs} +12 -12
- package/dist/{product-variant-edit-DEZEY2H2.mjs → product-variant-edit-PZU4P65H.mjs} +13 -13
- package/dist/{product-variant-manage-inventory-items-Y2VEOHP7.mjs → product-variant-manage-inventory-items-E3GPBPEZ.mjs} +3 -3
- package/dist/{product-variant-media-2WLVNGI4.mjs → product-variant-media-BSNCO642.mjs} +2 -2
- package/dist/{product-variant-metadata-VTZDNWUT.mjs → product-variant-metadata-FHGGZGPV.mjs} +12 -12
- package/dist/{promotion-add-campaign-DO67QK6M.mjs → promotion-add-campaign-NQSIFI33.mjs} +3 -3
- package/dist/{promotion-create-HWFNUQXG.mjs → promotion-create-GBZWJVAI.mjs} +24 -21
- package/dist/{promotion-detail-QC36KXB3.mjs → promotion-detail-W2OGUESO.mjs} +12 -12
- package/dist/{refund-reason-create-YHCDEHGQ.mjs → refund-reason-create-DLVRT5OU.mjs} +12 -12
- package/dist/{refund-reason-edit-CZ5QZ2SZ.mjs → refund-reason-edit-XCSU7RMH.mjs} +12 -12
- package/dist/{refund-reason-list-OJYYEYJE.mjs → refund-reason-list-G6UNVGPG.mjs} +18 -18
- package/dist/{region-create-NA7Y2LN4.mjs → region-create-2CRTF7HJ.mjs} +1 -1
- package/dist/{region-edit-WAU347DP.mjs → region-edit-IB3PJE7V.mjs} +1 -1
- package/dist/{region-metadata-H6XXUQ4S.mjs → region-metadata-WBEUKOI6.mjs} +12 -12
- package/dist/{reservation-create-ZCIYM6JI.mjs → reservation-create-ERFJUBME.mjs} +4 -4
- package/dist/{reservation-detail-LZAQL4XA.mjs → reservation-detail-Y6UZRZXY.mjs} +12 -12
- package/dist/{reservation-list-B47DXTA7.mjs → reservation-list-LEDZB7KL.mjs} +3 -3
- package/dist/{reservation-metadata-5HZSDDOK.mjs → reservation-metadata-7KH4EXMN.mjs} +12 -12
- package/dist/{return-reason-list-SCBGTOEI.mjs → return-reason-list-UUQAL464.mjs} +6 -6
- package/dist/{sales-channel-add-products-F7YV4MO5.mjs → sales-channel-add-products-GSPG7OTK.mjs} +14 -14
- package/dist/{sales-channel-create-MI7HHZYE.mjs → sales-channel-create-MM237EBQ.mjs} +3 -3
- package/dist/{sales-channel-detail-MXIPZCGA.mjs → sales-channel-detail-65ZFV2OI.mjs} +14 -14
- package/dist/{sales-channel-edit-VSHOIR37.mjs → sales-channel-edit-AC2J4N3M.mjs} +3 -3
- package/dist/{sales-channel-list-RLGL7FM3.mjs → sales-channel-list-LXLW7X3U.mjs} +14 -14
- package/dist/{sales-channel-metadata-M364R4RJ.mjs → sales-channel-metadata-QUAL2RH6.mjs} +13 -13
- package/dist/{shipping-option-type-create-C5WUWON7.mjs → shipping-option-type-create-EU75JC2Q.mjs} +12 -12
- package/dist/{shipping-option-type-detail-PENS2K73.mjs → shipping-option-type-detail-5GYEWATD.mjs} +13 -13
- package/dist/{shipping-option-type-edit-CIU5EHRP.mjs → shipping-option-type-edit-YR4JXT5M.mjs} +12 -12
- package/dist/{shipping-option-type-list-DIOX7VG7.mjs → shipping-option-type-list-BLC4Z5QW.mjs} +13 -13
- package/dist/{shipping-profile-metadata-75G2NNMA.mjs → shipping-profile-metadata-64YRWPDA.mjs} +12 -12
- package/dist/store-add-locales-TSMLNFZP.mjs +81 -0
- package/dist/{store-detail-JSNPOB2F.mjs → store-detail-3SS53LZR.mjs} +13 -13
- package/dist/{store-edit-5ZS562ZO.mjs → store-edit-SMEWFETF.mjs} +1 -1
- package/dist/{store-metadata-CYXTVJUE.mjs → store-metadata-IJGVDDA6.mjs} +12 -12
- package/dist/{tax-region-create-DWGL4EUT.mjs → tax-region-create-XLYIS5XX.mjs} +13 -13
- package/dist/{tax-region-detail-2AE2EFI3.mjs → tax-region-detail-66FKEGFB.mjs} +29 -28
- package/dist/{tax-region-edit-EEVEEU2Q.mjs → tax-region-edit-GBR4EDW7.mjs} +13 -13
- package/dist/{tax-region-province-detail-4ERSEQFF.mjs → tax-region-province-detail-OBA7Q7MQ.mjs} +29 -28
- package/dist/{tax-region-tax-override-create-PHCGEF7V.mjs → tax-region-tax-override-create-34WYD2QZ.mjs} +28 -27
- package/dist/{tax-region-tax-override-edit-SMRPSILC.mjs → tax-region-tax-override-edit-6WJVOGWA.mjs} +27 -26
- package/dist/translation-list-J65VNNAX.mjs +527 -0
- package/dist/{translations-edit-KECSHYZY.mjs → translations-edit-6P3KC4MO.mjs} +280 -304
- package/dist/{user-detail-BJUXLZZQ.mjs → user-detail-VMOJFHIJ.mjs} +2 -2
- package/dist/{user-metadata-2WPJOEJA.mjs → user-metadata-UOPVFX2L.mjs} +12 -12
- package/dist/{workflow-execution-detail-H2AKEZJX.mjs → workflow-execution-detail-WAQ7IG4T.mjs} +12 -12
- package/package.json +9 -9
- package/src/components/data-grid/components/data-grid-cell-container.tsx +7 -10
- package/src/components/data-grid/components/data-grid-multiline-cell.tsx +103 -0
- package/src/components/data-grid/components/data-grid-readonly-cell.tsx +1 -4
- package/src/components/data-grid/components/data-grid-root.tsx +68 -51
- package/src/components/data-grid/components/data-grid-text-cell.tsx +6 -76
- package/src/components/data-grid/components/index.ts +1 -0
- package/src/components/data-grid/data-grid.tsx +2 -0
- package/src/components/data-grid/hooks/use-data-grid-cell.tsx +12 -0
- package/src/components/data-grid/hooks/use-data-grid-form-handlers.tsx +1 -0
- package/src/components/data-grid/hooks/use-data-grid-keydown-event.tsx +65 -7
- package/src/components/data-grid/types.ts +1 -0
- package/src/components/inputs/combobox/combobox.tsx +185 -95
- package/src/components/layout/main-layout/main-layout.tsx +7 -4
- package/src/components/table/table-cells/order/country-cell/country-cell.tsx +5 -1
- package/src/dashboard-app/routes/get-route.map.tsx +68 -12
- package/src/hooks/api/cloud.tsx +41 -0
- package/src/hooks/api/index.ts +3 -1
- package/src/hooks/api/product-options.tsx +151 -0
- package/src/hooks/api/products.tsx +26 -66
- package/src/hooks/api/translations.tsx +103 -191
- package/src/hooks/table/columns/use-order-table-columns.tsx +5 -3
- 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 +257 -10
- package/src/i18n/translations/en.json +73 -5
- package/src/i18n/translations/es.json +9 -1
- package/src/routes/customers/customer-detail/components/customer-order-section/customer-order-section.tsx +1 -1
- package/src/routes/login/components/cloud-auth-login.tsx +114 -0
- package/src/routes/login/login.tsx +9 -1
- package/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx +1 -0
- package/src/routes/orders/order-edit-billing-address/components/edit-order-billing-address-form/edit-order-billing-address-form.tsx +34 -0
- package/src/routes/orders/order-edit-shipping-address/components/edit-order-shipping-address-form/edit-order-shipping-address-form.tsx +32 -0
- 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 +84 -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 +82 -0
- package/src/routes/product-options/product-option-detail/index.ts +3 -0
- package/src/routes/product-options/product-option-detail/loader.ts +18 -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 +327 -194
- 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 +33 -51
- 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 +296 -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/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx +6 -0
- package/src/routes/translations/add-locales/add-locales.tsx +29 -0
- package/src/routes/translations/add-locales/index.tsx +1 -0
- package/src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx +42 -17
- package/src/routes/translations/translation-list/components/translation-list-section/translation-list-section.tsx +5 -1
- package/src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx +182 -121
- package/src/routes/translations/translations-edit/components/translations-edit-form/translations-edit-form.tsx +330 -361
- package/src/routes/translations/translations-edit/translations-edit.tsx +8 -13
- package/dist/chunk-HGRIOEAR.mjs +0 -32
- package/dist/chunk-XDJ7OMBR.mjs +0 -160
- package/dist/login-VNOLI5YG.mjs +0 -201
- package/dist/product-create-option-7AOXAA4S.mjs +0 -151
- package/dist/product-edit-option-LWJT3CYJ.mjs +0 -156
- package/dist/translation-list-UF7FLXOW.mjs +0 -441
- 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 -30
- 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 -35
- package/dist/{chunk-FBYTX6K7.mjs → chunk-ORWRXJJT.mjs} +4 -4
- package/dist/{location-list-KVBA6J47.mjs → location-list-3WP65J3E.mjs} +1 -1
- package/dist/{user-list-YTZQNYSO.mjs → user-list-3EAKK4XC.mjs} +3 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Button, toast } from "@medusajs/ui"
|
|
2
|
+
import { useMutation } from "@tanstack/react-query"
|
|
3
|
+
import { useEffect, useRef } from "react"
|
|
4
|
+
import { useTranslation } from "react-i18next"
|
|
5
|
+
import { decodeToken } from "react-jwt"
|
|
6
|
+
import { useNavigate, useSearchParams } from "react-router-dom"
|
|
7
|
+
import { useCreateCloudAuthUser } from "../../../hooks/api/cloud"
|
|
8
|
+
import { sdk } from "../../../lib/client"
|
|
9
|
+
|
|
10
|
+
const CLOUD_AUTH_PROVIDER = "cloud"
|
|
11
|
+
|
|
12
|
+
export const CloudAuthLogin = () => {
|
|
13
|
+
const { t } = useTranslation()
|
|
14
|
+
const [searchParams] = useSearchParams()
|
|
15
|
+
|
|
16
|
+
const { handleCallback, isCallbackPending } = useAuthCallback(searchParams)
|
|
17
|
+
|
|
18
|
+
// Check if we're returning from the OAuth callback
|
|
19
|
+
const hasCallbackParams =
|
|
20
|
+
searchParams.get("auth_provider") === CLOUD_AUTH_PROVIDER &&
|
|
21
|
+
searchParams.has("code") &&
|
|
22
|
+
searchParams.has("state")
|
|
23
|
+
|
|
24
|
+
const callbackInitiated = useRef(false) // ref to prevent duplicate calls in React strict mode and other unmounting+mounting scenarios
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (hasCallbackParams && !callbackInitiated.current) {
|
|
27
|
+
callbackInitiated.current = true
|
|
28
|
+
handleCallback()
|
|
29
|
+
}
|
|
30
|
+
}, [hasCallbackParams, handleCallback])
|
|
31
|
+
|
|
32
|
+
const handleCloudLogin = async () => {
|
|
33
|
+
try {
|
|
34
|
+
const result = await sdk.auth.login("user", CLOUD_AUTH_PROVIDER, {
|
|
35
|
+
// in case the admin is on a different domain, or the backend URL is set to just "/" which won't work for the callback
|
|
36
|
+
callback_url: `${window.location.origin}${window.location.pathname}?auth_provider=${CLOUD_AUTH_PROVIDER}`,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
if (typeof result === "object" && result.location) {
|
|
40
|
+
// Redirect to Medusa Cloud for authentication
|
|
41
|
+
window.location.href = result.location
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new Error("Unexpected login response")
|
|
46
|
+
} catch {
|
|
47
|
+
toast.error(t("auth.login.authenticationFailed"))
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<hr className="bg-ui-border-base my-4" />
|
|
54
|
+
<Button
|
|
55
|
+
variant="secondary"
|
|
56
|
+
onClick={handleCloudLogin}
|
|
57
|
+
className="w-full"
|
|
58
|
+
disabled={isCallbackPending}
|
|
59
|
+
isLoading={isCallbackPending}
|
|
60
|
+
>
|
|
61
|
+
{t("auth.login.cloud")}
|
|
62
|
+
</Button>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const useAuthCallback = (searchParams: URLSearchParams) => {
|
|
68
|
+
const { t } = useTranslation()
|
|
69
|
+
const navigate = useNavigate()
|
|
70
|
+
const { mutateAsync: createCloudAuthUser } = useCreateCloudAuthUser()
|
|
71
|
+
|
|
72
|
+
const { mutateAsync: handleCallback, isPending: isCallbackPending } =
|
|
73
|
+
useMutation({
|
|
74
|
+
mutationFn: async () => {
|
|
75
|
+
let token: string
|
|
76
|
+
try {
|
|
77
|
+
const query = Object.fromEntries(searchParams)
|
|
78
|
+
delete query.auth_provider // BE doesn't need this
|
|
79
|
+
|
|
80
|
+
token = await sdk.auth.callback("user", CLOUD_AUTH_PROVIDER, query)
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error("Authentication callback failed")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const decodedToken = decodeToken(token) as {
|
|
86
|
+
actor_id: string
|
|
87
|
+
user_metadata: Record<string, unknown>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// If user doesn't exist, create it
|
|
91
|
+
if (!decodedToken?.actor_id) {
|
|
92
|
+
await createCloudAuthUser()
|
|
93
|
+
|
|
94
|
+
// Refresh token to get the updated token with actor_id
|
|
95
|
+
const refreshedToken = await sdk.auth.refresh({
|
|
96
|
+
Authorization: `Bearer ${token}`, // passing it manually in case the auth type is session
|
|
97
|
+
})
|
|
98
|
+
if (!refreshedToken) {
|
|
99
|
+
throw new Error("Failed to refresh token after user creation")
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return true
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => {
|
|
106
|
+
navigate("/")
|
|
107
|
+
},
|
|
108
|
+
onError: () => {
|
|
109
|
+
toast.error(t("auth.login.authenticationFailed"))
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
return { handleCallback, isCallbackPending }
|
|
114
|
+
}
|
|
@@ -8,8 +8,10 @@ import * as z from "zod"
|
|
|
8
8
|
import { Form } from "../../components/common/form"
|
|
9
9
|
import AvatarBox from "../../components/common/logo-box/avatar-box"
|
|
10
10
|
import { useSignInWithEmailPass } from "../../hooks/api"
|
|
11
|
+
import { useCloudAuthEnabled } from "../../hooks/api/cloud"
|
|
11
12
|
import { isFetchError } from "../../lib/is-fetch-error"
|
|
12
13
|
import { useExtension } from "../../providers/extension-provider"
|
|
14
|
+
import { CloudAuthLogin } from "./components/cloud-auth-login"
|
|
13
15
|
|
|
14
16
|
const LoginSchema = z.object({
|
|
15
17
|
email: z.string().email(),
|
|
@@ -21,6 +23,7 @@ export const Login = () => {
|
|
|
21
23
|
const location = useLocation()
|
|
22
24
|
const navigate = useNavigate()
|
|
23
25
|
const { getWidgets } = useExtension()
|
|
26
|
+
const { data: cloudAuth } = useCloudAuthEnabled()
|
|
24
27
|
|
|
25
28
|
const from = location.state?.from?.pathname || "/orders"
|
|
26
29
|
|
|
@@ -70,6 +73,11 @@ export const Login = () => {
|
|
|
70
73
|
form.formState.errors.email?.message ||
|
|
71
74
|
form.formState.errors.password?.message
|
|
72
75
|
|
|
76
|
+
const loginAfterWidgets = [...getWidgets("login.after")] // cloning to avoid mutating the original array below
|
|
77
|
+
if (cloudAuth?.enabled) {
|
|
78
|
+
loginAfterWidgets.push(CloudAuthLogin)
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
return (
|
|
74
82
|
<div className="bg-ui-bg-subtle flex min-h-dvh w-dvw items-center justify-center">
|
|
75
83
|
<div className="m-4 flex w-full max-w-[280px] flex-col items-center">
|
|
@@ -150,7 +158,7 @@ export const Login = () => {
|
|
|
150
158
|
</Button>
|
|
151
159
|
</form>
|
|
152
160
|
</Form>
|
|
153
|
-
{
|
|
161
|
+
{loginAfterWidgets.map((Component, i) => {
|
|
154
162
|
return <Component key={i} />
|
|
155
163
|
})}
|
|
156
164
|
</div>
|
package/src/routes/orders/order-create-edit/components/order-edit-create-form/order-edit-item.tsx
CHANGED
|
@@ -180,6 +180,7 @@ function OrderEditItem({ item, currencyCode, orderId }: OrderEditItemProps) {
|
|
|
180
180
|
<Input
|
|
181
181
|
className="bg-ui-bg-base txt-small w-[67px] rounded-lg [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
182
182
|
type="number"
|
|
183
|
+
step="any"
|
|
183
184
|
disabled={item.detail.fulfilled_quantity === item.quantity}
|
|
184
185
|
min={item.detail.fulfilled_quantity}
|
|
185
186
|
defaultValue={item.quantity}
|
|
@@ -16,6 +16,8 @@ type EditOrderBillingAddressFormProps = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const EditOrderBillingAddressSchema = zod.object({
|
|
19
|
+
first_name: zod.string().optional(),
|
|
20
|
+
last_name: zod.string().optional(),
|
|
19
21
|
address_1: zod.string().min(1),
|
|
20
22
|
address_2: zod.string().optional(),
|
|
21
23
|
country_code: zod.string().min(2).max(2),
|
|
@@ -34,6 +36,8 @@ export function EditOrderBillingAddressForm({
|
|
|
34
36
|
|
|
35
37
|
const form = useForm<zod.infer<typeof EditOrderBillingAddressSchema>>({
|
|
36
38
|
defaultValues: {
|
|
39
|
+
first_name: order.billing_address?.first_name || "",
|
|
40
|
+
last_name: order.billing_address?.last_name || "",
|
|
37
41
|
address_1: order.billing_address?.address_1 || "",
|
|
38
42
|
address_2: order.billing_address?.address_2 || "",
|
|
39
43
|
city: order.billing_address?.city || "",
|
|
@@ -158,6 +162,36 @@ export function EditOrderBillingAddressForm({
|
|
|
158
162
|
)
|
|
159
163
|
}}
|
|
160
164
|
/>
|
|
165
|
+
<Form.Field
|
|
166
|
+
control={form.control}
|
|
167
|
+
name="first_name"
|
|
168
|
+
render={({ field }) => {
|
|
169
|
+
return (
|
|
170
|
+
<Form.Item>
|
|
171
|
+
<Form.Label>{t("fields.firstName")}</Form.Label>
|
|
172
|
+
<Form.Control>
|
|
173
|
+
<Input size="small" {...field} />
|
|
174
|
+
</Form.Control>
|
|
175
|
+
<Form.ErrorMessage />
|
|
176
|
+
</Form.Item>
|
|
177
|
+
)
|
|
178
|
+
}}
|
|
179
|
+
/>
|
|
180
|
+
<Form.Field
|
|
181
|
+
control={form.control}
|
|
182
|
+
name="last_name"
|
|
183
|
+
render={({ field }) => {
|
|
184
|
+
return (
|
|
185
|
+
<Form.Item>
|
|
186
|
+
<Form.Label>{t("fields.lastName")}</Form.Label>
|
|
187
|
+
<Form.Control>
|
|
188
|
+
<Input size="small" {...field} />
|
|
189
|
+
</Form.Control>
|
|
190
|
+
<Form.ErrorMessage />
|
|
191
|
+
</Form.Item>
|
|
192
|
+
)
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
161
195
|
<Form.Field
|
|
162
196
|
control={form.control}
|
|
163
197
|
name="company"
|
|
@@ -16,6 +16,8 @@ type EditOrderShippingAddressFormProps = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const EditOrderShippingAddressSchema = zod.object({
|
|
19
|
+
first_name: zod.string().optional(),
|
|
20
|
+
last_name: zod.string().optional(),
|
|
19
21
|
address_1: zod.string().min(1),
|
|
20
22
|
address_2: zod.string().optional(),
|
|
21
23
|
country_code: zod.string().min(2).max(2),
|
|
@@ -34,6 +36,8 @@ export function EditOrderShippingAddressForm({
|
|
|
34
36
|
|
|
35
37
|
const form = useForm<zod.infer<typeof EditOrderShippingAddressSchema>>({
|
|
36
38
|
defaultValues: {
|
|
39
|
+
first_name: order.shipping_address?.first_name || "",
|
|
40
|
+
last_name: order.shipping_address?.last_name || "",
|
|
37
41
|
address_1: order.shipping_address?.address_1 || "",
|
|
38
42
|
address_2: order.shipping_address?.address_2 || "",
|
|
39
43
|
city: order.shipping_address?.city || "",
|
|
@@ -158,6 +162,34 @@ export function EditOrderShippingAddressForm({
|
|
|
158
162
|
)
|
|
159
163
|
}}
|
|
160
164
|
/>
|
|
165
|
+
<Form.Field
|
|
166
|
+
control={form.control}
|
|
167
|
+
name="first_name"
|
|
168
|
+
render={({ field }) => {
|
|
169
|
+
return (
|
|
170
|
+
<Form.Item>
|
|
171
|
+
<Form.Label>{t("fields.firstName")}</Form.Label>
|
|
172
|
+
<Form.Control>
|
|
173
|
+
<Input size="small" {...field} />
|
|
174
|
+
</Form.Control>
|
|
175
|
+
</Form.Item>
|
|
176
|
+
)
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
<Form.Field
|
|
180
|
+
control={form.control}
|
|
181
|
+
name="last_name"
|
|
182
|
+
render={({ field }) => {
|
|
183
|
+
return (
|
|
184
|
+
<Form.Item>
|
|
185
|
+
<Form.Label>{t("fields.lastName")}</Form.Label>
|
|
186
|
+
<Form.Control>
|
|
187
|
+
<Input size="small" {...field} />
|
|
188
|
+
</Form.Control>
|
|
189
|
+
</Form.Item>
|
|
190
|
+
)
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
161
193
|
<Form.Field
|
|
162
194
|
control={form.control}
|
|
163
195
|
name="company"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useNavigate } from "react-router-dom"
|
|
2
|
+
import { toast, usePrompt } from "@medusajs/ui"
|
|
3
|
+
import { useTranslation } from "react-i18next"
|
|
4
|
+
import { useDeleteProductOption } from "../../../../hooks/api"
|
|
5
|
+
import { HttpTypes } from "@medusajs/types"
|
|
6
|
+
|
|
7
|
+
export const useDeleteProductOptionAction = ({
|
|
8
|
+
id,
|
|
9
|
+
title,
|
|
10
|
+
}: HttpTypes.AdminProductOption) => {
|
|
11
|
+
const { t } = useTranslation()
|
|
12
|
+
const prompt = usePrompt()
|
|
13
|
+
const navigate = useNavigate()
|
|
14
|
+
|
|
15
|
+
const { mutateAsync } = useDeleteProductOption(id)
|
|
16
|
+
|
|
17
|
+
return async () => {
|
|
18
|
+
const result = await prompt({
|
|
19
|
+
title: t("general.areYouSure"),
|
|
20
|
+
description: t("productOptions.delete.confirmation", { title }),
|
|
21
|
+
confirmText: t("actions.delete"),
|
|
22
|
+
cancelText: t("actions.cancel"),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
if (!result) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await mutateAsync(undefined, {
|
|
30
|
+
onSuccess: () => {
|
|
31
|
+
navigate("/product-options", {
|
|
32
|
+
replace: true,
|
|
33
|
+
})
|
|
34
|
+
toast.success(t("productOptions.delete.successToast", { title }))
|
|
35
|
+
},
|
|
36
|
+
onError: (e) => {
|
|
37
|
+
toast.error(e.message)
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Heading, Input, Text } from "@medusajs/ui"
|
|
2
|
+
import { UseFormReturn } from "react-hook-form"
|
|
3
|
+
import { useTranslation } from "react-i18next"
|
|
4
|
+
|
|
5
|
+
import { Form } from "../../../../../components/common/form"
|
|
6
|
+
import { ChipInput } from "../../../../../components/inputs/chip-input"
|
|
7
|
+
import { CreateProductOptionSchema } from "./schema"
|
|
8
|
+
|
|
9
|
+
type CreateProductOptionDetailsProps = {
|
|
10
|
+
form: UseFormReturn<CreateProductOptionSchema>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const CreateProductOptionDetails = ({
|
|
14
|
+
form,
|
|
15
|
+
}: CreateProductOptionDetailsProps) => {
|
|
16
|
+
const { t } = useTranslation()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="flex flex-col items-center p-16">
|
|
20
|
+
<div className="flex w-full max-w-[720px] flex-col gap-y-8">
|
|
21
|
+
<div>
|
|
22
|
+
<Heading>{t("productOptions.create.header")}</Heading>
|
|
23
|
+
<Text size="small" className="text-ui-fg-subtle">
|
|
24
|
+
{t("productOptions.create.hint")}
|
|
25
|
+
</Text>
|
|
26
|
+
</div>
|
|
27
|
+
<Form.Field
|
|
28
|
+
control={form.control}
|
|
29
|
+
name="title"
|
|
30
|
+
render={({ field }) => {
|
|
31
|
+
return (
|
|
32
|
+
<Form.Item>
|
|
33
|
+
<Form.Label>
|
|
34
|
+
{t("productOptions.fields.title.label")}
|
|
35
|
+
</Form.Label>
|
|
36
|
+
<Form.Control>
|
|
37
|
+
<Input
|
|
38
|
+
autoComplete="off"
|
|
39
|
+
{...field}
|
|
40
|
+
placeholder={t("productOptions.fields.title.placeholder")}
|
|
41
|
+
/>
|
|
42
|
+
</Form.Control>
|
|
43
|
+
<Form.ErrorMessage />
|
|
44
|
+
</Form.Item>
|
|
45
|
+
)
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
<Form.Field
|
|
49
|
+
control={form.control}
|
|
50
|
+
name="values"
|
|
51
|
+
render={({ field }) => {
|
|
52
|
+
return (
|
|
53
|
+
<Form.Item>
|
|
54
|
+
<Form.Label>
|
|
55
|
+
{t("productOptions.fields.values.label")}
|
|
56
|
+
</Form.Label>
|
|
57
|
+
<Form.Control>
|
|
58
|
+
<ChipInput
|
|
59
|
+
{...field}
|
|
60
|
+
placeholder={t("productOptions.fields.values.placeholder")}
|
|
61
|
+
/>
|
|
62
|
+
</Form.Control>
|
|
63
|
+
<Form.ErrorMessage />
|
|
64
|
+
</Form.Item>
|
|
65
|
+
)
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
2
|
+
import { Button, ProgressStatus, ProgressTabs, toast } from "@medusajs/ui"
|
|
3
|
+
import { useForm } from "react-hook-form"
|
|
4
|
+
import { useTranslation } from "react-i18next"
|
|
5
|
+
|
|
6
|
+
import { useState } from "react"
|
|
7
|
+
import {
|
|
8
|
+
RouteFocusModal,
|
|
9
|
+
useRouteModal,
|
|
10
|
+
} from "../../../../../components/modals"
|
|
11
|
+
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
|
12
|
+
import { useCreateProductOption } from "../../../../../hooks/api"
|
|
13
|
+
import { CreateProductOptionDetails } from "./create-product-option-details"
|
|
14
|
+
import { CreateProductOptionOrganize } from "./create-product-option-organize"
|
|
15
|
+
import {
|
|
16
|
+
CreateProductOptionDetailsSchema,
|
|
17
|
+
CreateProductOptionSchema,
|
|
18
|
+
} from "./schema"
|
|
19
|
+
import { useDocumentDirection } from "../../../../../hooks/use-document-direction"
|
|
20
|
+
|
|
21
|
+
enum Tab {
|
|
22
|
+
DETAILS = "details",
|
|
23
|
+
ORGANIZE = "organize",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const CreateProductOptionForm = () => {
|
|
27
|
+
const { t } = useTranslation()
|
|
28
|
+
const { handleSuccess } = useRouteModal()
|
|
29
|
+
const direction = useDocumentDirection()
|
|
30
|
+
const [activeTab, setActiveTab] = useState<Tab>(Tab.DETAILS)
|
|
31
|
+
const [validDetails, setValidDetails] = useState(false)
|
|
32
|
+
|
|
33
|
+
const form = useForm<CreateProductOptionSchema>({
|
|
34
|
+
defaultValues: {
|
|
35
|
+
title: "",
|
|
36
|
+
values: [],
|
|
37
|
+
value_ranks: {},
|
|
38
|
+
},
|
|
39
|
+
resolver: zodResolver(CreateProductOptionSchema),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const handleTabChange = (tab: Tab) => {
|
|
43
|
+
if (tab === Tab.ORGANIZE) {
|
|
44
|
+
const { title, values } = form.getValues()
|
|
45
|
+
|
|
46
|
+
const result = CreateProductOptionDetailsSchema.safeParse({
|
|
47
|
+
title,
|
|
48
|
+
values,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
if (!result.success) {
|
|
52
|
+
result.error.errors.forEach((error) => {
|
|
53
|
+
form.setError(
|
|
54
|
+
error.path.join(".") as keyof CreateProductOptionSchema,
|
|
55
|
+
{
|
|
56
|
+
type: "manual",
|
|
57
|
+
message: error.message,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
form.clearErrors()
|
|
66
|
+
setValidDetails(true)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setActiveTab(tab)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const { mutateAsync, isPending } = useCreateProductOption()
|
|
73
|
+
|
|
74
|
+
const handleSubmit = form.handleSubmit((data) => {
|
|
75
|
+
const { title, values, value_ranks } = data
|
|
76
|
+
|
|
77
|
+
mutateAsync(
|
|
78
|
+
{
|
|
79
|
+
title,
|
|
80
|
+
values,
|
|
81
|
+
ranks: value_ranks,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
onSuccess: ({ product_option }) => {
|
|
85
|
+
toast.success(
|
|
86
|
+
t("productOptions.create.successToast", {
|
|
87
|
+
title: product_option.title,
|
|
88
|
+
})
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
handleSuccess(`/product-options/${product_option.id}`)
|
|
92
|
+
},
|
|
93
|
+
onError: (error) => {
|
|
94
|
+
toast.error(error.message)
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const organizeStatus: ProgressStatus =
|
|
101
|
+
form.getFieldState("value_ranks")?.isDirty || activeTab === Tab.ORGANIZE
|
|
102
|
+
? "in-progress"
|
|
103
|
+
: "not-started"
|
|
104
|
+
|
|
105
|
+
const detailsStatus: ProgressStatus = validDetails
|
|
106
|
+
? "completed"
|
|
107
|
+
: "in-progress"
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<RouteFocusModal.Form form={form}>
|
|
111
|
+
<KeyboundForm
|
|
112
|
+
onSubmit={handleSubmit}
|
|
113
|
+
className="flex size-full flex-col overflow-hidden"
|
|
114
|
+
>
|
|
115
|
+
<ProgressTabs
|
|
116
|
+
dir={direction}
|
|
117
|
+
value={activeTab}
|
|
118
|
+
onValueChange={(tab) => handleTabChange(tab as Tab)}
|
|
119
|
+
className="flex size-full flex-col"
|
|
120
|
+
>
|
|
121
|
+
<RouteFocusModal.Header>
|
|
122
|
+
<div className="flex w-full items-center justify-between">
|
|
123
|
+
<div className="-my-2 w-full max-w-[400px] border-l">
|
|
124
|
+
<ProgressTabs.List className="grid w-full grid-cols-2">
|
|
125
|
+
<ProgressTabs.Trigger
|
|
126
|
+
value={Tab.DETAILS}
|
|
127
|
+
status={detailsStatus}
|
|
128
|
+
className="w-full min-w-0 overflow-hidden"
|
|
129
|
+
>
|
|
130
|
+
<span className="truncate">
|
|
131
|
+
{t("productOptions.create.tabs.details")}
|
|
132
|
+
</span>
|
|
133
|
+
</ProgressTabs.Trigger>
|
|
134
|
+
<ProgressTabs.Trigger
|
|
135
|
+
value={Tab.ORGANIZE}
|
|
136
|
+
status={organizeStatus}
|
|
137
|
+
className="w-full min-w-0 overflow-hidden"
|
|
138
|
+
>
|
|
139
|
+
<span className="truncate">
|
|
140
|
+
{t("productOptions.create.tabs.organize")}
|
|
141
|
+
</span>
|
|
142
|
+
</ProgressTabs.Trigger>
|
|
143
|
+
</ProgressTabs.List>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</RouteFocusModal.Header>
|
|
147
|
+
<RouteFocusModal.Body className="flex size-full flex-col overflow-auto">
|
|
148
|
+
<ProgressTabs.Content value={Tab.DETAILS}>
|
|
149
|
+
<CreateProductOptionDetails form={form} />
|
|
150
|
+
</ProgressTabs.Content>
|
|
151
|
+
<ProgressTabs.Content
|
|
152
|
+
value={Tab.ORGANIZE}
|
|
153
|
+
className="bg-ui-bg-subtle flex-1"
|
|
154
|
+
>
|
|
155
|
+
<CreateProductOptionOrganize form={form} />
|
|
156
|
+
</ProgressTabs.Content>
|
|
157
|
+
</RouteFocusModal.Body>
|
|
158
|
+
<RouteFocusModal.Footer>
|
|
159
|
+
<div className="flex items-center justify-end gap-x-2">
|
|
160
|
+
<RouteFocusModal.Close asChild>
|
|
161
|
+
<Button size="small" variant="secondary">
|
|
162
|
+
{t("actions.cancel")}
|
|
163
|
+
</Button>
|
|
164
|
+
</RouteFocusModal.Close>
|
|
165
|
+
{activeTab === Tab.ORGANIZE ? (
|
|
166
|
+
<Button
|
|
167
|
+
key="submit-btn"
|
|
168
|
+
size="small"
|
|
169
|
+
variant="primary"
|
|
170
|
+
type="submit"
|
|
171
|
+
isLoading={isPending}
|
|
172
|
+
>
|
|
173
|
+
{t("actions.save")}
|
|
174
|
+
</Button>
|
|
175
|
+
) : (
|
|
176
|
+
<Button
|
|
177
|
+
key="continue-btn"
|
|
178
|
+
size="small"
|
|
179
|
+
variant="primary"
|
|
180
|
+
type="button"
|
|
181
|
+
onClick={() => handleTabChange(Tab.ORGANIZE)}
|
|
182
|
+
>
|
|
183
|
+
{t("actions.continue")}
|
|
184
|
+
</Button>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
</RouteFocusModal.Footer>
|
|
188
|
+
</ProgressTabs>
|
|
189
|
+
</KeyboundForm>
|
|
190
|
+
</RouteFocusModal.Form>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Text } from "@medusajs/ui"
|
|
2
|
+
import { useMemo } from "react"
|
|
3
|
+
import { UseFormReturn, useWatch } from "react-hook-form"
|
|
4
|
+
import { SortableList } from "../../../../../components/common/sortable-list"
|
|
5
|
+
import { CreateProductOptionSchema } from "./schema"
|
|
6
|
+
|
|
7
|
+
type CreateProductOptionOrganizeProps = {
|
|
8
|
+
form: UseFormReturn<CreateProductOptionSchema>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type ValueItem = {
|
|
12
|
+
id: string
|
|
13
|
+
value: string
|
|
14
|
+
rank: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const CreateProductOptionOrganize = ({
|
|
18
|
+
form,
|
|
19
|
+
}: CreateProductOptionOrganizeProps) => {
|
|
20
|
+
const values = useWatch({
|
|
21
|
+
control: form.control,
|
|
22
|
+
name: "values",
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const valueRanks = useWatch({
|
|
26
|
+
control: form.control,
|
|
27
|
+
name: "value_ranks",
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const items = useMemo<ValueItem[]>(() => {
|
|
31
|
+
if (!values || values.length === 0) {
|
|
32
|
+
return []
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return values
|
|
36
|
+
.map((value, index) => ({
|
|
37
|
+
id: value,
|
|
38
|
+
value,
|
|
39
|
+
rank: valueRanks?.[value] ?? index,
|
|
40
|
+
}))
|
|
41
|
+
.sort((a, b) => a.rank - b.rank)
|
|
42
|
+
}, [values, valueRanks])
|
|
43
|
+
|
|
44
|
+
const handleChange = (newItems: ValueItem[]) => {
|
|
45
|
+
const newRanks: Record<string, number> = {}
|
|
46
|
+
newItems.forEach((item, index) => {
|
|
47
|
+
newRanks[item.value] = index
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
form.setValue("value_ranks", newRanks, {
|
|
51
|
+
shouldDirty: true,
|
|
52
|
+
shouldTouch: true,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!values || values.length === 0) {
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<SortableList
|
|
62
|
+
items={items}
|
|
63
|
+
onChange={handleChange}
|
|
64
|
+
renderItem={(item) => (
|
|
65
|
+
<SortableList.Item
|
|
66
|
+
id={item.id}
|
|
67
|
+
className="border-ui-border-base border-b last:border-b-0"
|
|
68
|
+
>
|
|
69
|
+
<div className="flex flex-1 items-center gap-x-3 px-4 py-3">
|
|
70
|
+
<SortableList.DragHandle />
|
|
71
|
+
<Text size="small">{item.value}</Text>
|
|
72
|
+
</div>
|
|
73
|
+
</SortableList.Item>
|
|
74
|
+
)}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateProductOptionForm } from "./create-product-option-form"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const CreateProductOptionDetailsSchema = z.object({
|
|
4
|
+
title: z.string().min(1),
|
|
5
|
+
values: z.array(z.string()).min(1, "At least one value is required"),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export type CreateProductOptionSchema = z.infer<
|
|
9
|
+
typeof CreateProductOptionSchema
|
|
10
|
+
>
|
|
11
|
+
export const CreateProductOptionSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
value_ranks: z.record(z.string(), z.number()).optional(),
|
|
14
|
+
})
|
|
15
|
+
.merge(CreateProductOptionDetailsSchema)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductOptionCreate as Component } from "./product-option-create"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RouteFocusModal } from "../../../components/modals"
|
|
2
|
+
import { CreateProductOptionForm } from "./components/create-product-option-form/create-product-option-form"
|
|
3
|
+
|
|
4
|
+
export const ProductOptionCreate = () => {
|
|
5
|
+
return (
|
|
6
|
+
<RouteFocusModal>
|
|
7
|
+
<CreateProductOptionForm />
|
|
8
|
+
</RouteFocusModal>
|
|
9
|
+
)
|
|
10
|
+
}
|