@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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChipGroup
|
|
3
3
|
} from "./chunk-X5VECN6S.mjs";
|
|
4
|
+
import {
|
|
5
|
+
SortableList
|
|
6
|
+
} from "./chunk-ZHH3W7CN.mjs";
|
|
4
7
|
import {
|
|
5
8
|
HandleInput
|
|
6
9
|
} from "./chunk-7OYLCEKK.mjs";
|
|
7
|
-
import {
|
|
8
|
-
ChipInput
|
|
9
|
-
} from "./chunk-XDJ7OMBR.mjs";
|
|
10
10
|
import {
|
|
11
11
|
useSalesChannelTableColumns,
|
|
12
12
|
useSalesChannelTableEmptyState,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import "./chunk-2D44OO7A.mjs";
|
|
17
17
|
import {
|
|
18
18
|
CategoryCombobox
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TNMXAPPT.mjs";
|
|
20
20
|
import {
|
|
21
21
|
useComboboxData
|
|
22
22
|
} from "./chunk-3TZOFKX2.mjs";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
UploadMediaFormItem,
|
|
30
30
|
decorateVariantsWithDefaultValues,
|
|
31
31
|
normalizeProductFormValues
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-OI4W5AEL.mjs";
|
|
33
33
|
import "./chunk-ZQRKUG6J.mjs";
|
|
34
34
|
import {
|
|
35
35
|
DataGrid,
|
|
@@ -38,10 +38,10 @@ import {
|
|
|
38
38
|
} from "./chunk-WEMXXZMY.mjs";
|
|
39
39
|
import "./chunk-DK4WIVY6.mjs";
|
|
40
40
|
import "./chunk-TYTNUPXB.mjs";
|
|
41
|
-
import "./chunk-Q33G337Z.mjs";
|
|
42
41
|
import {
|
|
43
42
|
DataTable
|
|
44
43
|
} from "./chunk-GRNWRTT3.mjs";
|
|
44
|
+
import "./chunk-Q33G337Z.mjs";
|
|
45
45
|
import "./chunk-C76H5USB.mjs";
|
|
46
46
|
import "./chunk-PFKKVLZX.mjs";
|
|
47
47
|
import {
|
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
FormExtensionZone,
|
|
63
63
|
useExtendableForm
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-ET6EGRW3.mjs";
|
|
65
65
|
import "./chunk-NQIC7ZFS.mjs";
|
|
66
66
|
import "./chunk-ONB3JEHR.mjs";
|
|
67
|
-
import "./chunk-
|
|
67
|
+
import "./chunk-YCDDT44O.mjs";
|
|
68
68
|
import "./chunk-4GQOUCX6.mjs";
|
|
69
69
|
import "./chunk-2VTICXJR.mjs";
|
|
70
70
|
import "./chunk-D3YQN7HV.mjs";
|
|
@@ -88,31 +88,33 @@ import "./chunk-67ORSRVT.mjs";
|
|
|
88
88
|
import {
|
|
89
89
|
Form
|
|
90
90
|
} from "./chunk-OBQI23QM.mjs";
|
|
91
|
-
import
|
|
91
|
+
import {
|
|
92
|
+
useProductOptions
|
|
93
|
+
} from "./chunk-WOFUOGLO.mjs";
|
|
92
94
|
import "./chunk-KOSCMAIC.mjs";
|
|
95
|
+
import "./chunk-WWQZD7WM.mjs";
|
|
93
96
|
import "./chunk-X6DSNTTX.mjs";
|
|
94
97
|
import "./chunk-I6E6CALJ.mjs";
|
|
95
|
-
import "./chunk-B4GODIOW.mjs";
|
|
96
|
-
import "./chunk-N4N4KGET.mjs";
|
|
97
98
|
import "./chunk-QTCZFYFH.mjs";
|
|
99
|
+
import "./chunk-B4GODIOW.mjs";
|
|
98
100
|
import "./chunk-ENV6YVOM.mjs";
|
|
99
101
|
import "./chunk-PIR2H25N.mjs";
|
|
100
102
|
import "./chunk-C5LYZZZ5.mjs";
|
|
101
103
|
import "./chunk-RLY2SL5E.mjs";
|
|
102
104
|
import "./chunk-2ZKVRTBW.mjs";
|
|
103
|
-
import "./chunk-
|
|
105
|
+
import "./chunk-GBKLLUUX.mjs";
|
|
106
|
+
import "./chunk-P5RVJWPK.mjs";
|
|
104
107
|
import "./chunk-F6PXCY3N.mjs";
|
|
105
|
-
import "./chunk-IXZVR3HG.mjs";
|
|
106
108
|
import "./chunk-R2G2B47Y.mjs";
|
|
107
109
|
import "./chunk-GRT22PE5.mjs";
|
|
108
110
|
import "./chunk-32IQRUVY.mjs";
|
|
109
|
-
import "./chunk-
|
|
110
|
-
import "./chunk-
|
|
111
|
-
import "./chunk-
|
|
111
|
+
import "./chunk-SBFWPL42.mjs";
|
|
112
|
+
import "./chunk-GVVAVAXG.mjs";
|
|
113
|
+
import "./chunk-7PWZ5GMG.mjs";
|
|
112
114
|
import {
|
|
113
115
|
useSalesChannel,
|
|
114
116
|
useSalesChannels
|
|
115
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-NGR5XU3K.mjs";
|
|
116
118
|
import "./chunk-KX4P5L3R.mjs";
|
|
117
119
|
import {
|
|
118
120
|
useStore
|
|
@@ -125,7 +127,7 @@ import {
|
|
|
125
127
|
} from "./chunk-QL4XKIVL.mjs";
|
|
126
128
|
import {
|
|
127
129
|
useCreateProduct
|
|
128
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-GVPJPLE2.mjs";
|
|
129
131
|
import "./chunk-FXYH54JP.mjs";
|
|
130
132
|
import "./chunk-774WSTCC.mjs";
|
|
131
133
|
import {
|
|
@@ -137,7 +139,7 @@ import "./chunk-QZ7TP4HQ.mjs";
|
|
|
137
139
|
import { useTranslation as useTranslation10 } from "react-i18next";
|
|
138
140
|
|
|
139
141
|
// src/routes/products/product-create/components/product-create-form/product-create-form.tsx
|
|
140
|
-
import { Button as
|
|
142
|
+
import { Button as Button4, ProgressTabs, toast } from "@medusajs/ui";
|
|
141
143
|
import { useEffect as useEffect2, useMemo as useMemo4, useState as useState4 } from "react";
|
|
142
144
|
import { useWatch as useWatch4 } from "react-hook-form";
|
|
143
145
|
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
@@ -512,197 +514,23 @@ function formatFileSize(bytes, decimalPlaces = 2) {
|
|
|
512
514
|
}
|
|
513
515
|
|
|
514
516
|
// src/routes/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
515
|
-
import { XMarkMini } from "@medusajs/icons";
|
|
516
517
|
import {
|
|
517
518
|
Alert,
|
|
518
|
-
Button,
|
|
519
519
|
Checkbox,
|
|
520
|
-
clx
|
|
520
|
+
clx,
|
|
521
521
|
Heading,
|
|
522
522
|
Hint,
|
|
523
|
-
IconButton as IconButton3,
|
|
524
523
|
InlineTip,
|
|
525
|
-
Input as Input2,
|
|
526
524
|
Label,
|
|
527
525
|
Text as Text2
|
|
528
526
|
} from "@medusajs/ui";
|
|
529
527
|
import {
|
|
530
|
-
Controller,
|
|
531
528
|
useFieldArray as useFieldArray2,
|
|
532
529
|
useWatch
|
|
533
530
|
} from "react-hook-form";
|
|
534
531
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
import {
|
|
538
|
-
DndContext as DndContext2,
|
|
539
|
-
DragOverlay as DragOverlay2,
|
|
540
|
-
KeyboardSensor as KeyboardSensor2,
|
|
541
|
-
PointerSensor as PointerSensor2,
|
|
542
|
-
defaultDropAnimationSideEffects as defaultDropAnimationSideEffects2,
|
|
543
|
-
useSensor as useSensor2,
|
|
544
|
-
useSensors as useSensors2
|
|
545
|
-
} from "@dnd-kit/core";
|
|
546
|
-
import {
|
|
547
|
-
SortableContext as SortableContext2,
|
|
548
|
-
arrayMove as arrayMove2,
|
|
549
|
-
sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
|
|
550
|
-
useSortable as useSortable2
|
|
551
|
-
} from "@dnd-kit/sortable";
|
|
552
|
-
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
553
|
-
import { DotsSix as DotsSix2 } from "@medusajs/icons";
|
|
554
|
-
import { IconButton as IconButton2, clx } from "@medusajs/ui";
|
|
555
|
-
import {
|
|
556
|
-
Fragment,
|
|
557
|
-
createContext,
|
|
558
|
-
useContext,
|
|
559
|
-
useMemo,
|
|
560
|
-
useState as useState2
|
|
561
|
-
} from "react";
|
|
562
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
563
|
-
var List = ({
|
|
564
|
-
items,
|
|
565
|
-
onChange,
|
|
566
|
-
renderItem
|
|
567
|
-
}) => {
|
|
568
|
-
const [active, setActive] = useState2(null);
|
|
569
|
-
const [activeItem, activeIndex] = useMemo(() => {
|
|
570
|
-
if (active === null) {
|
|
571
|
-
return [null, null];
|
|
572
|
-
}
|
|
573
|
-
const index = items.findIndex(({ id }) => id === active.id);
|
|
574
|
-
return [items[index], index];
|
|
575
|
-
}, [active, items]);
|
|
576
|
-
const sensors = useSensors2(
|
|
577
|
-
useSensor2(PointerSensor2),
|
|
578
|
-
useSensor2(KeyboardSensor2, {
|
|
579
|
-
coordinateGetter: sortableKeyboardCoordinates2
|
|
580
|
-
})
|
|
581
|
-
);
|
|
582
|
-
const handleDragStart = ({ active: active2 }) => {
|
|
583
|
-
setActive(active2);
|
|
584
|
-
};
|
|
585
|
-
const handleDragEnd = ({ active: active2, over }) => {
|
|
586
|
-
if (over && active2.id !== over.id) {
|
|
587
|
-
const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
|
|
588
|
-
const overIndex = items.findIndex(({ id }) => id === over.id);
|
|
589
|
-
onChange(arrayMove2(items, activeIndex2, overIndex));
|
|
590
|
-
}
|
|
591
|
-
setActive(null);
|
|
592
|
-
};
|
|
593
|
-
const handleDragCancel = () => {
|
|
594
|
-
setActive(null);
|
|
595
|
-
};
|
|
596
|
-
return /* @__PURE__ */ jsxs3(
|
|
597
|
-
DndContext2,
|
|
598
|
-
{
|
|
599
|
-
sensors,
|
|
600
|
-
onDragStart: handleDragStart,
|
|
601
|
-
onDragEnd: handleDragEnd,
|
|
602
|
-
onDragCancel: handleDragCancel,
|
|
603
|
-
children: [
|
|
604
|
-
/* @__PURE__ */ jsx3(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
|
|
605
|
-
/* @__PURE__ */ jsx3(SortableContext2, { items, children: /* @__PURE__ */ jsx3(
|
|
606
|
-
"ul",
|
|
607
|
-
{
|
|
608
|
-
role: "application",
|
|
609
|
-
className: "flex list-inside list-none list-image-none flex-col p-0",
|
|
610
|
-
children: items.map((item, index) => /* @__PURE__ */ jsx3(Fragment, { children: renderItem(item, index) }, item.id))
|
|
611
|
-
}
|
|
612
|
-
) })
|
|
613
|
-
]
|
|
614
|
-
}
|
|
615
|
-
);
|
|
616
|
-
};
|
|
617
|
-
var dropAnimationConfig2 = {
|
|
618
|
-
sideEffects: defaultDropAnimationSideEffects2({
|
|
619
|
-
styles: {
|
|
620
|
-
active: {
|
|
621
|
-
opacity: "0.4"
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
})
|
|
625
|
-
};
|
|
626
|
-
var Overlay = ({ children }) => {
|
|
627
|
-
return /* @__PURE__ */ jsx3(
|
|
628
|
-
DragOverlay2,
|
|
629
|
-
{
|
|
630
|
-
className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
|
|
631
|
-
dropAnimation: dropAnimationConfig2,
|
|
632
|
-
children
|
|
633
|
-
}
|
|
634
|
-
);
|
|
635
|
-
};
|
|
636
|
-
var SortableItemContext = createContext(null);
|
|
637
|
-
var useSortableItemContext = () => {
|
|
638
|
-
const context = useContext(SortableItemContext);
|
|
639
|
-
if (!context) {
|
|
640
|
-
throw new Error(
|
|
641
|
-
"useSortableItemContext must be used within a SortableItemContext"
|
|
642
|
-
);
|
|
643
|
-
}
|
|
644
|
-
return context;
|
|
645
|
-
};
|
|
646
|
-
var Item = ({
|
|
647
|
-
id,
|
|
648
|
-
className,
|
|
649
|
-
children
|
|
650
|
-
}) => {
|
|
651
|
-
const {
|
|
652
|
-
attributes,
|
|
653
|
-
isDragging,
|
|
654
|
-
listeners,
|
|
655
|
-
setNodeRef,
|
|
656
|
-
setActivatorNodeRef,
|
|
657
|
-
transform,
|
|
658
|
-
transition
|
|
659
|
-
} = useSortable2({ id });
|
|
660
|
-
const context = useMemo(
|
|
661
|
-
() => ({
|
|
662
|
-
attributes,
|
|
663
|
-
listeners,
|
|
664
|
-
ref: setActivatorNodeRef,
|
|
665
|
-
isDragging
|
|
666
|
-
}),
|
|
667
|
-
[attributes, listeners, setActivatorNodeRef, isDragging]
|
|
668
|
-
);
|
|
669
|
-
const style = {
|
|
670
|
-
opacity: isDragging ? 0.4 : void 0,
|
|
671
|
-
transform: CSS2.Translate.toString(transform),
|
|
672
|
-
transition
|
|
673
|
-
};
|
|
674
|
-
return /* @__PURE__ */ jsx3(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx3(
|
|
675
|
-
"li",
|
|
676
|
-
{
|
|
677
|
-
className: clx("transition-fg flex flex-1 list-none", className),
|
|
678
|
-
ref: setNodeRef,
|
|
679
|
-
style,
|
|
680
|
-
children
|
|
681
|
-
}
|
|
682
|
-
) });
|
|
683
|
-
};
|
|
684
|
-
var DragHandle = () => {
|
|
685
|
-
const { attributes, listeners, ref } = useSortableItemContext();
|
|
686
|
-
return /* @__PURE__ */ jsx3(
|
|
687
|
-
IconButton2,
|
|
688
|
-
{
|
|
689
|
-
variant: "transparent",
|
|
690
|
-
size: "small",
|
|
691
|
-
...attributes,
|
|
692
|
-
...listeners,
|
|
693
|
-
ref,
|
|
694
|
-
className: "cursor-grab touch-none active:cursor-grabbing",
|
|
695
|
-
children: /* @__PURE__ */ jsx3(DotsSix2, { className: "text-ui-fg-muted" })
|
|
696
|
-
}
|
|
697
|
-
);
|
|
698
|
-
};
|
|
699
|
-
var SortableList = Object.assign(List, {
|
|
700
|
-
Item,
|
|
701
|
-
DragHandle
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
// src/routes/products/product-create/components/product-create-details-form/components/product-create-details-variant-section/product-create-details-variant-section.tsx
|
|
705
|
-
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
532
|
+
import { useMemo, useState as useState2 } from "react";
|
|
533
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
706
534
|
var getPermutations = (data) => {
|
|
707
535
|
if (data.length === 0) {
|
|
708
536
|
return [];
|
|
@@ -728,10 +556,6 @@ var ProductCreateVariantsSection = ({
|
|
|
728
556
|
form
|
|
729
557
|
}) => {
|
|
730
558
|
const { t } = useTranslation3();
|
|
731
|
-
const options = useFieldArray2({
|
|
732
|
-
control: form.control,
|
|
733
|
-
name: "options"
|
|
734
|
-
});
|
|
735
559
|
const variants = useFieldArray2({
|
|
736
560
|
control: form.control,
|
|
737
561
|
name: "variants"
|
|
@@ -753,71 +577,116 @@ var ProductCreateVariantsSection = ({
|
|
|
753
577
|
});
|
|
754
578
|
const showInvalidOptionsMessage = !!form.formState.errors.options?.length;
|
|
755
579
|
const showInvalidVariantsMessage = form.formState.errors.variants?.root?.message === "invalid_length";
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
580
|
+
const { product_options = [], isLoading } = useProductOptions({
|
|
581
|
+
is_exclusive: false
|
|
582
|
+
});
|
|
583
|
+
const productOptionChoices = useMemo(() => {
|
|
584
|
+
return product_options.map((option) => ({
|
|
585
|
+
value: option.id,
|
|
586
|
+
label: option.title
|
|
587
|
+
}));
|
|
588
|
+
}, [product_options]);
|
|
589
|
+
const [selectedOptionIds, setSelectedOptionIds] = useState2([]);
|
|
590
|
+
const [selectedOptionValues, setSelectedOptionValues] = useState2({});
|
|
591
|
+
const [customValues, setCustomValues] = useState2({});
|
|
592
|
+
const handleProductOptionSelect = (optionIds) => {
|
|
593
|
+
setSelectedOptionIds(optionIds);
|
|
594
|
+
const newSelectedValues = {};
|
|
595
|
+
const selectedProductOptions = product_options.filter(
|
|
596
|
+
(option) => optionIds.includes(option.id)
|
|
762
597
|
);
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
};
|
|
769
|
-
const newVariants = oldVariants.reduce((variants2, variant) => {
|
|
770
|
-
const match = findMatchingPermutation(variant.options);
|
|
771
|
-
if (match) {
|
|
772
|
-
variants2.push({
|
|
773
|
-
...variant,
|
|
774
|
-
title: getVariantName(match),
|
|
775
|
-
options: match
|
|
776
|
-
});
|
|
598
|
+
selectedProductOptions.forEach((option) => {
|
|
599
|
+
if (selectedOptionValues[option.id]) {
|
|
600
|
+
newSelectedValues[option.id] = selectedOptionValues[option.id];
|
|
601
|
+
} else {
|
|
602
|
+
newSelectedValues[option.id] = option.values?.map((v) => v.id) || [];
|
|
777
603
|
}
|
|
778
|
-
return variants2;
|
|
779
|
-
}, []);
|
|
780
|
-
const usedPermutations = new Set(
|
|
781
|
-
newVariants.map((variant) => variant.options)
|
|
782
|
-
);
|
|
783
|
-
const unusedPermutations = permutations.filter(
|
|
784
|
-
(permutation) => !usedPermutations.has(permutation)
|
|
785
|
-
);
|
|
786
|
-
unusedPermutations.forEach((permutation) => {
|
|
787
|
-
newVariants.push({
|
|
788
|
-
title: getVariantName(permutation),
|
|
789
|
-
options: permutation,
|
|
790
|
-
should_create: hasUserSelectedVariants ? false : true,
|
|
791
|
-
variant_rank: newVariants.length,
|
|
792
|
-
// NOTE - prepare inventory array here for now so we prevent rendering issue if we append the items later
|
|
793
|
-
inventory: [{ inventory_item_id: "", required_quantity: "" }]
|
|
794
|
-
});
|
|
795
604
|
});
|
|
796
|
-
|
|
605
|
+
setSelectedOptionValues(newSelectedValues);
|
|
606
|
+
updateFormWithSelectedValues(selectedProductOptions, newSelectedValues);
|
|
797
607
|
};
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
608
|
+
const handleValueChange = (optionId, valueIds) => {
|
|
609
|
+
if (valueIds.length === 0) {
|
|
800
610
|
return;
|
|
801
611
|
}
|
|
802
|
-
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
);
|
|
812
|
-
if (variant) {
|
|
813
|
-
variants2.push({
|
|
814
|
-
...variant,
|
|
815
|
-
title: variant.title,
|
|
816
|
-
options: permutation
|
|
817
|
-
});
|
|
612
|
+
const allValues = getAllValuesForOption(optionId);
|
|
613
|
+
const existingValueIds = new Set(allValues.map((v) => v.id));
|
|
614
|
+
const validValueIds = [];
|
|
615
|
+
const newCustomValues = [];
|
|
616
|
+
valueIds.forEach((id) => {
|
|
617
|
+
if (existingValueIds.has(id)) {
|
|
618
|
+
validValueIds.push(id);
|
|
619
|
+
} else {
|
|
620
|
+
newCustomValues.push(id);
|
|
818
621
|
}
|
|
819
|
-
|
|
820
|
-
|
|
622
|
+
});
|
|
623
|
+
let updatedCustomValues = customValues;
|
|
624
|
+
const updatedValidValueIds = [...validValueIds];
|
|
625
|
+
newCustomValues.forEach((newValue) => {
|
|
626
|
+
const tempId = `custom-${Date.now()}-${Math.random()}-${newValue}`;
|
|
627
|
+
const existingCustom = updatedCustomValues[optionId] || [];
|
|
628
|
+
const option = product_options.find((opt) => opt.id === optionId);
|
|
629
|
+
const existingValuesCount = (option?.values?.length || 0) + existingCustom.length;
|
|
630
|
+
const newCustomValue = {
|
|
631
|
+
id: tempId,
|
|
632
|
+
value: newValue,
|
|
633
|
+
rank: existingValuesCount + newCustomValues.indexOf(newValue)
|
|
634
|
+
};
|
|
635
|
+
updatedCustomValues = {
|
|
636
|
+
...updatedCustomValues,
|
|
637
|
+
[optionId]: [...updatedCustomValues[optionId] || [], newCustomValue]
|
|
638
|
+
};
|
|
639
|
+
updatedValidValueIds.push(tempId);
|
|
640
|
+
});
|
|
641
|
+
if (newCustomValues.length > 0) {
|
|
642
|
+
setCustomValues(updatedCustomValues);
|
|
643
|
+
}
|
|
644
|
+
const updatedSelectedValues = {
|
|
645
|
+
...selectedOptionValues,
|
|
646
|
+
[optionId]: updatedValidValueIds
|
|
647
|
+
};
|
|
648
|
+
setSelectedOptionValues(updatedSelectedValues);
|
|
649
|
+
const selectedProductOptions = product_options.filter(
|
|
650
|
+
(option) => selectedOptionIds.includes(option.id)
|
|
651
|
+
);
|
|
652
|
+
updateFormWithSelectedValues(
|
|
653
|
+
selectedProductOptions,
|
|
654
|
+
updatedSelectedValues,
|
|
655
|
+
newCustomValues.length > 0 ? updatedCustomValues : void 0
|
|
656
|
+
);
|
|
657
|
+
};
|
|
658
|
+
const getAllValuesForOption = (optionId, customVals) => {
|
|
659
|
+
const option = product_options.find((opt) => opt.id === optionId);
|
|
660
|
+
const existingValues = option?.values || [];
|
|
661
|
+
const customForOption = (customVals || customValues)[optionId] || [];
|
|
662
|
+
return [...existingValues, ...customForOption];
|
|
663
|
+
};
|
|
664
|
+
const updateFormWithSelectedValues = (selectedProductOptions, valueSelections, customVals) => {
|
|
665
|
+
const newOptions = selectedProductOptions.map((option) => {
|
|
666
|
+
const selectedValueIds = valueSelections[option.id] || [];
|
|
667
|
+
const allValues = getAllValuesForOption(option.id, customVals);
|
|
668
|
+
const selectedValues = allValues.filter((v) => selectedValueIds.includes(v.id)).sort((a, b) => {
|
|
669
|
+
const rankA = a.rank ?? Number.MAX_VALUE;
|
|
670
|
+
const rankB = b.rank ?? Number.MAX_VALUE;
|
|
671
|
+
return rankA - rankB;
|
|
672
|
+
}).map((v) => v.value);
|
|
673
|
+
return {
|
|
674
|
+
id: option.id,
|
|
675
|
+
title: option.title,
|
|
676
|
+
values: selectedValues
|
|
677
|
+
};
|
|
678
|
+
});
|
|
679
|
+
form.setValue("options", newOptions);
|
|
680
|
+
const permutations = getPermutations(
|
|
681
|
+
newOptions.filter(({ values }) => values.length)
|
|
682
|
+
);
|
|
683
|
+
const newVariants = permutations.map((permutation, index) => ({
|
|
684
|
+
title: getVariantName(permutation),
|
|
685
|
+
options: permutation,
|
|
686
|
+
should_create: true,
|
|
687
|
+
variant_rank: index,
|
|
688
|
+
inventory: [{ inventory_item_id: "", required_quantity: "" }]
|
|
689
|
+
}));
|
|
821
690
|
form.setValue("variants", newVariants);
|
|
822
691
|
};
|
|
823
692
|
const handleRankChange = (items) => {
|
|
@@ -889,10 +758,10 @@ var ProductCreateVariantsSection = ({
|
|
|
889
758
|
])
|
|
890
759
|
);
|
|
891
760
|
};
|
|
892
|
-
return /* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
/* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ jsxs3("div", { id: "variants", className: "flex flex-col gap-y-8", children: [
|
|
762
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-6", children: [
|
|
763
|
+
/* @__PURE__ */ jsx3(Heading, { level: "h2", children: t("products.create.variants.header") }),
|
|
764
|
+
/* @__PURE__ */ jsx3(
|
|
896
765
|
SwitchBox,
|
|
897
766
|
{
|
|
898
767
|
control: form.control,
|
|
@@ -915,137 +784,65 @@ var ProductCreateVariantsSection = ({
|
|
|
915
784
|
}
|
|
916
785
|
)
|
|
917
786
|
] }),
|
|
918
|
-
watchedAreVariantsEnabled && /* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
{
|
|
934
|
-
size: "small",
|
|
935
|
-
variant: "secondary",
|
|
936
|
-
type: "button",
|
|
937
|
-
onClick: () => {
|
|
938
|
-
options.append({
|
|
939
|
-
title: "",
|
|
940
|
-
values: []
|
|
941
|
-
});
|
|
942
|
-
},
|
|
943
|
-
children: t("actions.add")
|
|
944
|
-
}
|
|
945
|
-
)
|
|
946
|
-
] }),
|
|
947
|
-
showInvalidOptionsMessage && /* @__PURE__ */ jsx4(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.options") }),
|
|
948
|
-
/* @__PURE__ */ jsx4("ul", { className: "flex flex-col gap-y-4", children: options.fields.map((option, index) => {
|
|
949
|
-
const hasError = !!form.formState.errors.options?.[index];
|
|
950
|
-
return /* @__PURE__ */ jsxs4(
|
|
951
|
-
"li",
|
|
952
|
-
{
|
|
953
|
-
className: clx2(
|
|
954
|
-
"bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
|
|
955
|
-
{
|
|
956
|
-
"border-ui-border-error shadow-borders-error": hasError
|
|
957
|
-
}
|
|
958
|
-
),
|
|
959
|
-
children: [
|
|
960
|
-
/* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
961
|
-
/* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
|
|
962
|
-
Label,
|
|
963
|
-
{
|
|
964
|
-
size: "xsmall",
|
|
965
|
-
weight: "plus",
|
|
966
|
-
className: "text-ui-fg-subtle",
|
|
967
|
-
htmlFor: `options.${index}.title`,
|
|
968
|
-
children: t("fields.title")
|
|
969
|
-
}
|
|
970
|
-
) }),
|
|
971
|
-
/* @__PURE__ */ jsx4(
|
|
972
|
-
Input2,
|
|
973
|
-
{
|
|
974
|
-
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
975
|
-
...form.register(
|
|
976
|
-
`options.${index}.title`
|
|
977
|
-
),
|
|
978
|
-
placeholder: t(
|
|
979
|
-
"products.fields.options.optionTitlePlaceholder"
|
|
980
|
-
)
|
|
981
|
-
}
|
|
982
|
-
),
|
|
983
|
-
/* @__PURE__ */ jsx4("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx4(
|
|
984
|
-
Label,
|
|
985
|
-
{
|
|
986
|
-
size: "xsmall",
|
|
987
|
-
weight: "plus",
|
|
988
|
-
className: "text-ui-fg-subtle",
|
|
989
|
-
htmlFor: `options.${index}.values`,
|
|
990
|
-
children: t("fields.values")
|
|
991
|
-
}
|
|
992
|
-
) }),
|
|
993
|
-
/* @__PURE__ */ jsx4(
|
|
994
|
-
Controller,
|
|
995
|
-
{
|
|
996
|
-
control: form.control,
|
|
997
|
-
name: `options.${index}.values`,
|
|
998
|
-
render: ({
|
|
999
|
-
field: { onChange, ...field }
|
|
1000
|
-
}) => {
|
|
1001
|
-
const handleValueChange = (value) => {
|
|
1002
|
-
handleOptionValueUpdate(index, value);
|
|
1003
|
-
onChange(value);
|
|
1004
|
-
};
|
|
1005
|
-
return /* @__PURE__ */ jsx4(
|
|
1006
|
-
ChipInput,
|
|
1007
|
-
{
|
|
1008
|
-
...field,
|
|
1009
|
-
variant: "contrast",
|
|
1010
|
-
onChange: handleValueChange,
|
|
1011
|
-
placeholder: t(
|
|
1012
|
-
"products.fields.options.variantionsPlaceholder"
|
|
1013
|
-
)
|
|
1014
|
-
}
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
)
|
|
1019
|
-
] }),
|
|
1020
|
-
/* @__PURE__ */ jsx4(
|
|
1021
|
-
IconButton3,
|
|
1022
|
-
{
|
|
1023
|
-
type: "button",
|
|
1024
|
-
size: "small",
|
|
1025
|
-
variant: "transparent",
|
|
1026
|
-
className: "text-ui-fg-muted",
|
|
1027
|
-
disabled: index === 0,
|
|
1028
|
-
onClick: () => handleRemoveOption(index),
|
|
1029
|
-
children: /* @__PURE__ */ jsx4(XMarkMini, {})
|
|
1030
|
-
}
|
|
1031
|
-
)
|
|
1032
|
-
]
|
|
1033
|
-
},
|
|
1034
|
-
option.id
|
|
1035
|
-
);
|
|
1036
|
-
}) })
|
|
1037
|
-
] }) });
|
|
787
|
+
watchedAreVariantsEnabled && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
788
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-6", children: [
|
|
789
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
|
|
790
|
+
/* @__PURE__ */ jsx3(Label, { weight: "plus", children: t("products.create.variants.productOptions.label") }),
|
|
791
|
+
/* @__PURE__ */ jsx3(Hint, { children: t("products.create.variants.productOptions.hint") })
|
|
792
|
+
] }),
|
|
793
|
+
showInvalidOptionsMessage && /* @__PURE__ */ jsx3(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.options") }),
|
|
794
|
+
/* @__PURE__ */ jsx3(
|
|
795
|
+
Combobox,
|
|
796
|
+
{
|
|
797
|
+
value: selectedOptionIds,
|
|
798
|
+
onChange: (value) => handleProductOptionSelect(value),
|
|
799
|
+
options: productOptionChoices,
|
|
800
|
+
placeholder: t("products.fields.options.optionTitlePlaceholder"),
|
|
801
|
+
disabled: isLoading
|
|
1038
802
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
803
|
+
)
|
|
804
|
+
] }),
|
|
805
|
+
selectedOptionIds.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-4", children: [
|
|
806
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
|
|
807
|
+
/* @__PURE__ */ jsx3(Label, { weight: "plus", children: t("fields.values") }),
|
|
808
|
+
/* @__PURE__ */ jsx3(Hint, { children: t("products.create.variants.selectValuesHint") })
|
|
1045
809
|
] }),
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
810
|
+
/* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-y-3", children: product_options.filter((option) => selectedOptionIds.includes(option.id)).map((option) => {
|
|
811
|
+
const allValues = getAllValuesForOption(option.id);
|
|
812
|
+
const valueOptions = allValues.sort((a, b) => {
|
|
813
|
+
const rankA = a.rank ?? Number.MAX_VALUE;
|
|
814
|
+
const rankB = b.rank ?? Number.MAX_VALUE;
|
|
815
|
+
return rankA - rankB;
|
|
816
|
+
}).map((v) => ({
|
|
817
|
+
value: v.id,
|
|
818
|
+
label: v.value
|
|
819
|
+
}));
|
|
820
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-2", children: [
|
|
821
|
+
/* @__PURE__ */ jsx3(Label, { size: "small", weight: "plus", children: option.title }),
|
|
822
|
+
/* @__PURE__ */ jsx3(
|
|
823
|
+
Combobox,
|
|
824
|
+
{
|
|
825
|
+
value: selectedOptionValues[option.id] || [],
|
|
826
|
+
onChange: (value) => handleValueChange(option.id, value),
|
|
827
|
+
onCreateOption: (_) => {
|
|
828
|
+
},
|
|
829
|
+
options: valueOptions,
|
|
830
|
+
placeholder: t(
|
|
831
|
+
"products.fields.options.variantionsPlaceholder"
|
|
832
|
+
)
|
|
833
|
+
}
|
|
834
|
+
)
|
|
835
|
+
] }, option.id);
|
|
836
|
+
}) })
|
|
837
|
+
] }),
|
|
838
|
+
/* @__PURE__ */ jsx3("div", { className: "grid grid-cols-1 gap-x-4 gap-y-8", children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-6", children: [
|
|
839
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
|
|
840
|
+
/* @__PURE__ */ jsx3(Label, { weight: "plus", children: t("products.create.variants.productVariants.label") }),
|
|
841
|
+
/* @__PURE__ */ jsx3(Hint, { children: t("products.create.variants.productVariants.hint") })
|
|
842
|
+
] }),
|
|
843
|
+
!showInvalidOptionsMessage && showInvalidVariantsMessage && /* @__PURE__ */ jsx3(Alert, { dismissible: true, variant: "error", children: t("products.create.errors.variants") }),
|
|
844
|
+
variants.fields.length > 0 ? /* @__PURE__ */ jsxs3("div", { className: "overflow-hidden rounded-xl border", children: [
|
|
845
|
+
/* @__PURE__ */ jsxs3(
|
|
1049
846
|
"div",
|
|
1050
847
|
{
|
|
1051
848
|
className: "bg-ui-bg-component text-ui-fg-subtle grid items-center gap-3 border-b px-6 py-2.5",
|
|
@@ -1053,7 +850,7 @@ var ProductCreateVariantsSection = ({
|
|
|
1053
850
|
gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
|
|
1054
851
|
},
|
|
1055
852
|
children: [
|
|
1056
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3(
|
|
1057
854
|
Checkbox,
|
|
1058
855
|
{
|
|
1059
856
|
className: "relative",
|
|
@@ -1061,25 +858,25 @@ var ProductCreateVariantsSection = ({
|
|
|
1061
858
|
onCheckedChange: onCheckboxChange
|
|
1062
859
|
}
|
|
1063
860
|
) }),
|
|
1064
|
-
/* @__PURE__ */
|
|
1065
|
-
watchedOptions.map((option, index) => /* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsx3("div", {}),
|
|
862
|
+
watchedOptions.map((option, index) => /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", weight: "plus", children: option.title }) }, index))
|
|
1066
863
|
]
|
|
1067
864
|
}
|
|
1068
865
|
),
|
|
1069
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ jsx3(
|
|
1070
867
|
SortableList,
|
|
1071
868
|
{
|
|
1072
869
|
items: variants.fields,
|
|
1073
870
|
onChange: handleRankChange,
|
|
1074
871
|
renderItem: (item, index) => {
|
|
1075
|
-
return /* @__PURE__ */
|
|
872
|
+
return /* @__PURE__ */ jsx3(
|
|
1076
873
|
SortableList.Item,
|
|
1077
874
|
{
|
|
1078
875
|
id: item.id,
|
|
1079
|
-
className:
|
|
876
|
+
className: clx("bg-ui-bg-base border-b", {
|
|
1080
877
|
"border-b-0": index === variants.fields.length - 1
|
|
1081
878
|
}),
|
|
1082
|
-
children: /* @__PURE__ */
|
|
879
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1083
880
|
"div",
|
|
1084
881
|
{
|
|
1085
882
|
className: "text-ui-fg-subtle grid w-full items-center gap-3 px-6 py-2.5",
|
|
@@ -1087,7 +884,7 @@ var ProductCreateVariantsSection = ({
|
|
|
1087
884
|
gridTemplateColumns: `20px 28px repeat(${watchedOptions.length}, 1fr)`
|
|
1088
885
|
},
|
|
1089
886
|
children: [
|
|
1090
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ jsx3(
|
|
1091
888
|
Form.Field,
|
|
1092
889
|
{
|
|
1093
890
|
control: form.control,
|
|
@@ -1095,7 +892,7 @@ var ProductCreateVariantsSection = ({
|
|
|
1095
892
|
render: ({
|
|
1096
893
|
field: { value, onChange, ...field }
|
|
1097
894
|
}) => {
|
|
1098
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ jsx3(Form.Item, { children: /* @__PURE__ */ jsx3(Form.Control, { children: /* @__PURE__ */ jsx3(
|
|
1099
896
|
Checkbox,
|
|
1100
897
|
{
|
|
1101
898
|
className: "relative",
|
|
@@ -1107,8 +904,8 @@ var ProductCreateVariantsSection = ({
|
|
|
1107
904
|
}
|
|
1108
905
|
}
|
|
1109
906
|
),
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
Object.values(item.options).map((value, index2) => /* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ jsx3(SortableList.DragHandle, {}),
|
|
908
|
+
Object.values(item.options).map((value, index2) => /* @__PURE__ */ jsx3(Text2, { size: "small", leading: "compact", children: value }, index2))
|
|
1112
909
|
]
|
|
1113
910
|
}
|
|
1114
911
|
)
|
|
@@ -1117,40 +914,40 @@ var ProductCreateVariantsSection = ({
|
|
|
1117
914
|
}
|
|
1118
915
|
}
|
|
1119
916
|
)
|
|
1120
|
-
] }) : /* @__PURE__ */
|
|
1121
|
-
variants.fields.length > 0 && /* @__PURE__ */
|
|
917
|
+
] }) : /* @__PURE__ */ jsx3(Alert, { children: t("products.create.variants.productVariants.alert") }),
|
|
918
|
+
variants.fields.length > 0 && /* @__PURE__ */ jsx3(InlineTip, { label: t("general.tip"), children: t("products.create.variants.productVariants.tip") })
|
|
1122
919
|
] }) })
|
|
1123
920
|
] })
|
|
1124
921
|
] });
|
|
1125
922
|
};
|
|
1126
923
|
|
|
1127
924
|
// src/routes/products/product-create/components/product-create-details-form/product-create-details-form.tsx
|
|
1128
|
-
import { jsx as
|
|
925
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1129
926
|
var ProductCreateDetailsForm = ({ form }) => {
|
|
1130
927
|
const { getFormFields } = useExtension();
|
|
1131
928
|
const fields = getFormFields("product", "create", "general");
|
|
1132
|
-
return /* @__PURE__ */
|
|
1133
|
-
/* @__PURE__ */
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
/* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs4("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
930
|
+
/* @__PURE__ */ jsx4(Header, {}),
|
|
931
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-y-6", children: [
|
|
932
|
+
/* @__PURE__ */ jsx4(ProductCreateGeneralSection, { form }),
|
|
933
|
+
/* @__PURE__ */ jsx4(FormExtensionZone, { fields, form }),
|
|
934
|
+
/* @__PURE__ */ jsx4(ProductCreateMediaSection, { form })
|
|
1138
935
|
] }),
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ jsx4(Divider, {}),
|
|
937
|
+
/* @__PURE__ */ jsx4(ProductCreateVariantsSection, { form })
|
|
1141
938
|
] }) });
|
|
1142
939
|
};
|
|
1143
940
|
var Header = () => {
|
|
1144
941
|
const { t } = useTranslation4();
|
|
1145
|
-
return /* @__PURE__ */
|
|
942
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx4(Heading2, { children: t("products.create.header") }) });
|
|
1146
943
|
};
|
|
1147
944
|
|
|
1148
945
|
// src/routes/products/product-create/components/product-create-inventory-kit-form/components/product-create-inventory-kit-section/product-create-inventory-kit-section.tsx
|
|
1149
|
-
import { Button
|
|
946
|
+
import { Button, Heading as Heading3, IconButton as IconButton2, Input as Input2, Label as Label2 } from "@medusajs/ui";
|
|
1150
947
|
import { useFieldArray as useFieldArray3, useWatch as useWatch2 } from "react-hook-form";
|
|
1151
|
-
import { XMarkMini
|
|
948
|
+
import { XMarkMini } from "@medusajs/icons";
|
|
1152
949
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1153
|
-
import { jsx as
|
|
950
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1154
951
|
function InventoryItemRow({
|
|
1155
952
|
form,
|
|
1156
953
|
variantIndex,
|
|
@@ -1174,13 +971,13 @@ function InventoryItemRow({
|
|
|
1174
971
|
value: item.id
|
|
1175
972
|
}))
|
|
1176
973
|
});
|
|
1177
|
-
return /* @__PURE__ */
|
|
974
|
+
return /* @__PURE__ */ jsxs5(
|
|
1178
975
|
"li",
|
|
1179
976
|
{
|
|
1180
977
|
className: "bg-ui-bg-component shadow-elevation-card-rest grid grid-cols-[1fr_28px] items-center gap-1.5 rounded-xl p-1.5",
|
|
1181
978
|
children: [
|
|
1182
|
-
/* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */
|
|
979
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid grid-cols-[min-content,1fr] items-center gap-1.5", children: [
|
|
980
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx5(
|
|
1184
981
|
Label2,
|
|
1185
982
|
{
|
|
1186
983
|
size: "xsmall",
|
|
@@ -1190,13 +987,13 @@ function InventoryItemRow({
|
|
|
1190
987
|
children: t("fields.item")
|
|
1191
988
|
}
|
|
1192
989
|
) }),
|
|
1193
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx5(
|
|
1194
991
|
Form.Field,
|
|
1195
992
|
{
|
|
1196
993
|
control: form.control,
|
|
1197
994
|
name: `variants.${variantIndex}.inventory.${inventoryIndex}.inventory_item_id`,
|
|
1198
995
|
render: ({ field }) => {
|
|
1199
|
-
return /* @__PURE__ */
|
|
996
|
+
return /* @__PURE__ */ jsx5(Form.Item, { children: /* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(
|
|
1200
997
|
Combobox,
|
|
1201
998
|
{
|
|
1202
999
|
...field,
|
|
@@ -1215,7 +1012,7 @@ function InventoryItemRow({
|
|
|
1215
1012
|
}
|
|
1216
1013
|
}
|
|
1217
1014
|
),
|
|
1218
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx5(
|
|
1219
1016
|
Label2,
|
|
1220
1017
|
{
|
|
1221
1018
|
size: "xsmall",
|
|
@@ -1225,15 +1022,15 @@ function InventoryItemRow({
|
|
|
1225
1022
|
children: t("fields.quantity")
|
|
1226
1023
|
}
|
|
1227
1024
|
) }),
|
|
1228
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ jsx5(
|
|
1229
1026
|
Form.Field,
|
|
1230
1027
|
{
|
|
1231
1028
|
control: form.control,
|
|
1232
1029
|
name: `variants.${variantIndex}.inventory.${inventoryIndex}.required_quantity`,
|
|
1233
1030
|
render: ({ field: { onChange, value, ...field } }) => {
|
|
1234
|
-
return /* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
|
|
1031
|
+
return /* @__PURE__ */ jsxs5(Form.Item, { children: [
|
|
1032
|
+
/* @__PURE__ */ jsx5(Form.Control, { children: /* @__PURE__ */ jsx5(
|
|
1033
|
+
Input2,
|
|
1237
1034
|
{
|
|
1238
1035
|
type: "number",
|
|
1239
1036
|
className: "bg-ui-bg-field-component",
|
|
@@ -1253,21 +1050,21 @@ function InventoryItemRow({
|
|
|
1253
1050
|
)
|
|
1254
1051
|
}
|
|
1255
1052
|
) }),
|
|
1256
|
-
/* @__PURE__ */
|
|
1053
|
+
/* @__PURE__ */ jsx5(Form.ErrorMessage, {})
|
|
1257
1054
|
] });
|
|
1258
1055
|
}
|
|
1259
1056
|
}
|
|
1260
1057
|
)
|
|
1261
1058
|
] }),
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
|
|
1059
|
+
/* @__PURE__ */ jsx5(
|
|
1060
|
+
IconButton2,
|
|
1264
1061
|
{
|
|
1265
1062
|
type: "button",
|
|
1266
1063
|
size: "small",
|
|
1267
1064
|
variant: "transparent",
|
|
1268
1065
|
className: "text-ui-fg-muted",
|
|
1269
1066
|
onClick: onRemove,
|
|
1270
|
-
children: /* @__PURE__ */
|
|
1067
|
+
children: /* @__PURE__ */ jsx5(XMarkMini, {})
|
|
1271
1068
|
}
|
|
1272
1069
|
)
|
|
1273
1070
|
]
|
|
@@ -1290,14 +1087,14 @@ function VariantSection({ form, variant, index }) {
|
|
|
1290
1087
|
(i, index2) => index2 != inventoryIndex && i.inventory_item_id === option.value
|
|
1291
1088
|
);
|
|
1292
1089
|
};
|
|
1293
|
-
return /* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1090
|
+
return /* @__PURE__ */ jsxs5("div", { className: "grid gap-y-4", children: [
|
|
1091
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-start justify-between gap-x-4", children: [
|
|
1092
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
|
|
1093
|
+
/* @__PURE__ */ jsx5(Form.Label, { children: variant.title }),
|
|
1094
|
+
/* @__PURE__ */ jsx5(Form.Hint, { children: t("products.create.inventory.label") })
|
|
1298
1095
|
] }),
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
|
|
1096
|
+
/* @__PURE__ */ jsx5(
|
|
1097
|
+
Button,
|
|
1301
1098
|
{
|
|
1302
1099
|
size: "small",
|
|
1303
1100
|
variant: "secondary",
|
|
@@ -1312,7 +1109,7 @@ function VariantSection({ form, variant, index }) {
|
|
|
1312
1109
|
}
|
|
1313
1110
|
)
|
|
1314
1111
|
] }),
|
|
1315
|
-
inventory.fields.map((inventoryItem, inventoryIndex) => /* @__PURE__ */
|
|
1112
|
+
inventory.fields.map((inventoryItem, inventoryIndex) => /* @__PURE__ */ jsx5(
|
|
1316
1113
|
InventoryItemRow,
|
|
1317
1114
|
{
|
|
1318
1115
|
form,
|
|
@@ -1334,9 +1131,9 @@ var ProductCreateInventoryKitSection = ({
|
|
|
1334
1131
|
control: form.control,
|
|
1335
1132
|
name: "variants"
|
|
1336
1133
|
});
|
|
1337
|
-
return /* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
variants.fields.filter((v) => v.inventory_kit).map((variant, variantIndex) => /* @__PURE__ */
|
|
1134
|
+
return /* @__PURE__ */ jsxs5("div", { id: "organize", className: "flex flex-col gap-y-8", children: [
|
|
1135
|
+
/* @__PURE__ */ jsx5(Heading3, { children: t("products.create.inventory.heading") }),
|
|
1136
|
+
variants.fields.filter((v) => v.inventory_kit).map((variant, variantIndex) => /* @__PURE__ */ jsx5(
|
|
1340
1137
|
VariantSection,
|
|
1341
1138
|
{
|
|
1342
1139
|
form,
|
|
@@ -1349,18 +1146,18 @@ var ProductCreateInventoryKitSection = ({
|
|
|
1349
1146
|
};
|
|
1350
1147
|
|
|
1351
1148
|
// src/routes/products/product-create/components/product-create-inventory-kit-form/product-create-inventory-kit-form.tsx
|
|
1352
|
-
import { jsx as
|
|
1149
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1353
1150
|
var ProductCreateInventoryKitForm = ({
|
|
1354
1151
|
form
|
|
1355
1152
|
}) => {
|
|
1356
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsx6("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsx6("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: /* @__PURE__ */ jsx6(ProductCreateInventoryKitSection, { form }) }) });
|
|
1357
1154
|
};
|
|
1358
1155
|
|
|
1359
1156
|
// src/routes/products/product-create/components/product-create-organize-form/components/product-create-organize-section/product-create-details-organize-section.tsx
|
|
1360
|
-
import { Button as
|
|
1157
|
+
import { Button as Button2, Heading as Heading4 } from "@medusajs/ui";
|
|
1361
1158
|
import { useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
1362
1159
|
import { Trans, useTranslation as useTranslation6 } from "react-i18next";
|
|
1363
|
-
import { jsx as
|
|
1160
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1364
1161
|
var ProductCreateOrganizationSection = ({
|
|
1365
1162
|
form
|
|
1366
1163
|
}) => {
|
|
@@ -1405,9 +1202,9 @@ var ProductCreateOrganizationSection = ({
|
|
|
1405
1202
|
const handleClearAllSalesChannels = () => {
|
|
1406
1203
|
replace([]);
|
|
1407
1204
|
};
|
|
1408
|
-
return /* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsxs6("div", { id: "organize", className: "flex flex-col gap-y-8", children: [
|
|
1206
|
+
/* @__PURE__ */ jsx7(Heading4, { children: t("products.organization.header") }),
|
|
1207
|
+
/* @__PURE__ */ jsx7(
|
|
1411
1208
|
SwitchBox,
|
|
1412
1209
|
{
|
|
1413
1210
|
control: form.control,
|
|
@@ -1417,16 +1214,16 @@ var ProductCreateOrganizationSection = ({
|
|
|
1417
1214
|
optional: true
|
|
1418
1215
|
}
|
|
1419
1216
|
),
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1217
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
1218
|
+
/* @__PURE__ */ jsx7(
|
|
1422
1219
|
Form.Field,
|
|
1423
1220
|
{
|
|
1424
1221
|
control: form.control,
|
|
1425
1222
|
name: "type_id",
|
|
1426
1223
|
render: ({ field }) => {
|
|
1427
|
-
return /* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.type.label") }),
|
|
1226
|
+
/* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(
|
|
1430
1227
|
Combobox,
|
|
1431
1228
|
{
|
|
1432
1229
|
...field,
|
|
@@ -1436,20 +1233,20 @@ var ProductCreateOrganizationSection = ({
|
|
|
1436
1233
|
fetchNextPage: types.fetchNextPage
|
|
1437
1234
|
}
|
|
1438
1235
|
) }),
|
|
1439
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ jsx7(Form.ErrorMessage, {})
|
|
1440
1237
|
] });
|
|
1441
1238
|
}
|
|
1442
1239
|
}
|
|
1443
1240
|
),
|
|
1444
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx7(
|
|
1445
1242
|
Form.Field,
|
|
1446
1243
|
{
|
|
1447
1244
|
control: form.control,
|
|
1448
1245
|
name: "collection_id",
|
|
1449
1246
|
render: ({ field }) => {
|
|
1450
|
-
return /* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1248
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.collection.label") }),
|
|
1249
|
+
/* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(
|
|
1453
1250
|
Combobox,
|
|
1454
1251
|
{
|
|
1455
1252
|
...field,
|
|
@@ -1459,36 +1256,36 @@ var ProductCreateOrganizationSection = ({
|
|
|
1459
1256
|
fetchNextPage: collections.fetchNextPage
|
|
1460
1257
|
}
|
|
1461
1258
|
) }),
|
|
1462
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ jsx7(Form.ErrorMessage, {})
|
|
1463
1260
|
] });
|
|
1464
1261
|
}
|
|
1465
1262
|
}
|
|
1466
1263
|
)
|
|
1467
1264
|
] }),
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
1266
|
+
/* @__PURE__ */ jsx7(
|
|
1470
1267
|
Form.Field,
|
|
1471
1268
|
{
|
|
1472
1269
|
control: form.control,
|
|
1473
1270
|
name: "categories",
|
|
1474
1271
|
render: ({ field }) => {
|
|
1475
|
-
return /* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1273
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.categories.label") }),
|
|
1274
|
+
/* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(CategoryCombobox, { ...field }) }),
|
|
1275
|
+
/* @__PURE__ */ jsx7(Form.ErrorMessage, {})
|
|
1479
1276
|
] });
|
|
1480
1277
|
}
|
|
1481
1278
|
}
|
|
1482
1279
|
),
|
|
1483
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ jsx7(
|
|
1484
1281
|
Form.Field,
|
|
1485
1282
|
{
|
|
1486
1283
|
control: form.control,
|
|
1487
1284
|
name: "tags",
|
|
1488
1285
|
render: ({ field }) => {
|
|
1489
|
-
return /* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1286
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1287
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.tags.label") }),
|
|
1288
|
+
/* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(
|
|
1492
1289
|
Combobox,
|
|
1493
1290
|
{
|
|
1494
1291
|
...field,
|
|
@@ -1498,25 +1295,25 @@ var ProductCreateOrganizationSection = ({
|
|
|
1498
1295
|
fetchNextPage: tags.fetchNextPage
|
|
1499
1296
|
}
|
|
1500
1297
|
) }),
|
|
1501
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ jsx7(Form.ErrorMessage, {})
|
|
1502
1299
|
] });
|
|
1503
1300
|
}
|
|
1504
1301
|
}
|
|
1505
1302
|
)
|
|
1506
1303
|
] }),
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
1305
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1306
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.shipping_profile.label") }),
|
|
1307
|
+
/* @__PURE__ */ jsx7(Form.Hint, { children: /* @__PURE__ */ jsx7(Trans, { i18nKey: "products.fields.shipping_profile.hint" }) })
|
|
1511
1308
|
] }),
|
|
1512
|
-
/* @__PURE__ */
|
|
1309
|
+
/* @__PURE__ */ jsx7(
|
|
1513
1310
|
Form.Field,
|
|
1514
1311
|
{
|
|
1515
1312
|
control: form.control,
|
|
1516
1313
|
name: "shipping_profile_id",
|
|
1517
1314
|
render: ({ field }) => {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1315
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1316
|
+
/* @__PURE__ */ jsx7(Form.Control, { children: /* @__PURE__ */ jsx7(
|
|
1520
1317
|
Combobox,
|
|
1521
1318
|
{
|
|
1522
1319
|
...field,
|
|
@@ -1526,33 +1323,33 @@ var ProductCreateOrganizationSection = ({
|
|
|
1526
1323
|
fetchNextPage: shippingProfiles.fetchNextPage
|
|
1527
1324
|
}
|
|
1528
1325
|
) }),
|
|
1529
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ jsx7(Form.ErrorMessage, {})
|
|
1530
1327
|
] });
|
|
1531
1328
|
}
|
|
1532
1329
|
}
|
|
1533
1330
|
)
|
|
1534
1331
|
] }),
|
|
1535
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ jsx7("div", { className: "grid grid-cols-1 gap-y-4", children: /* @__PURE__ */ jsx7(
|
|
1536
1333
|
Form.Field,
|
|
1537
1334
|
{
|
|
1538
1335
|
control: form.control,
|
|
1539
1336
|
name: "sales_channels",
|
|
1540
1337
|
render: () => {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ jsxs6(Form.Item, { children: [
|
|
1339
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start justify-between gap-x-4", children: [
|
|
1340
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1341
|
+
/* @__PURE__ */ jsx7(Form.Label, { optional: true, children: t("products.fields.sales_channels.label") }),
|
|
1342
|
+
/* @__PURE__ */ jsx7(Form.Hint, { children: /* @__PURE__ */ jsx7(Trans, { i18nKey: "products.fields.sales_channels.hint" }) })
|
|
1546
1343
|
] }),
|
|
1547
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ jsx7(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx7(Button2, { size: "small", variant: "secondary", type: "button", children: t("actions.add") }) })
|
|
1548
1345
|
] }),
|
|
1549
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ jsx7(Form.Control, { className: "mt-0", children: fields.length > 0 && /* @__PURE__ */ jsx7(
|
|
1550
1347
|
ChipGroup,
|
|
1551
1348
|
{
|
|
1552
1349
|
onClearAll: handleClearAllSalesChannels,
|
|
1553
1350
|
onRemove: remove,
|
|
1554
1351
|
className: "py-4",
|
|
1555
|
-
children: fields.map((field, index) => /* @__PURE__ */
|
|
1352
|
+
children: fields.map((field, index) => /* @__PURE__ */ jsx7(ChipGroup.Chip, { index, children: field.name }, field.key))
|
|
1556
1353
|
}
|
|
1557
1354
|
) })
|
|
1558
1355
|
] });
|
|
@@ -1564,7 +1361,7 @@ var ProductCreateOrganizationSection = ({
|
|
|
1564
1361
|
|
|
1565
1362
|
// src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
|
|
1566
1363
|
import {
|
|
1567
|
-
Button as
|
|
1364
|
+
Button as Button3,
|
|
1568
1365
|
createDataTableColumnHelper
|
|
1569
1366
|
} from "@medusajs/ui";
|
|
1570
1367
|
import { useEffect, useMemo as useMemo2, useState as useState3 } from "react";
|
|
@@ -1575,7 +1372,7 @@ import { keepPreviousData } from "@tanstack/react-query";
|
|
|
1575
1372
|
var SC_STACKED_MODAL_ID = "sc";
|
|
1576
1373
|
|
|
1577
1374
|
// src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx
|
|
1578
|
-
import { jsx as
|
|
1375
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1579
1376
|
var PAGE_SIZE = 20;
|
|
1580
1377
|
var ProductCreateSalesChannelStackedModal = ({
|
|
1581
1378
|
form
|
|
@@ -1649,9 +1446,9 @@ var ProductCreateSalesChannelStackedModal = ({
|
|
|
1649
1446
|
if (isError) {
|
|
1650
1447
|
throw error;
|
|
1651
1448
|
}
|
|
1652
|
-
return /* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ jsxs7(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
|
|
1450
|
+
/* @__PURE__ */ jsx8(StackedFocusModal.Header, {}),
|
|
1451
|
+
/* @__PURE__ */ jsx8(StackedFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx8(
|
|
1655
1452
|
DataTable,
|
|
1656
1453
|
{
|
|
1657
1454
|
data: sales_channels,
|
|
@@ -1670,9 +1467,9 @@ var ProductCreateSalesChannelStackedModal = ({
|
|
|
1670
1467
|
prefix: SC_STACKED_MODAL_ID
|
|
1671
1468
|
}
|
|
1672
1469
|
) }),
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1470
|
+
/* @__PURE__ */ jsx8(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
1471
|
+
/* @__PURE__ */ jsx8(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx8(Button3, { size: "small", variant: "secondary", type: "button", children: t("actions.cancel") }) }),
|
|
1472
|
+
/* @__PURE__ */ jsx8(Button3, { size: "small", onClick: handleAdd, type: "button", children: t("actions.save") })
|
|
1676
1473
|
] }) })
|
|
1677
1474
|
] });
|
|
1678
1475
|
};
|
|
@@ -1683,16 +1480,16 @@ var useColumns = () => {
|
|
|
1683
1480
|
};
|
|
1684
1481
|
|
|
1685
1482
|
// src/routes/products/product-create/components/product-create-organize-form/product-create-organize-form.tsx
|
|
1686
|
-
import { jsx as
|
|
1483
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1687
1484
|
var ProductCreateOrganizeForm = ({ form }) => {
|
|
1688
1485
|
const { getFormFields } = useExtension();
|
|
1689
1486
|
const fields = getFormFields("product", "create", "organize");
|
|
1690
|
-
return /* @__PURE__ */
|
|
1691
|
-
/* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1487
|
+
return /* @__PURE__ */ jsxs8(StackedFocusModal, { id: SC_STACKED_MODAL_ID, children: [
|
|
1488
|
+
/* @__PURE__ */ jsx9("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs8("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
1489
|
+
/* @__PURE__ */ jsx9(ProductCreateOrganizationSection, { form }),
|
|
1490
|
+
/* @__PURE__ */ jsx9(FormExtensionZone, { fields, form })
|
|
1694
1491
|
] }) }),
|
|
1695
|
-
/* @__PURE__ */
|
|
1492
|
+
/* @__PURE__ */ jsx9(ProductCreateSalesChannelStackedModal, { form })
|
|
1696
1493
|
] });
|
|
1697
1494
|
};
|
|
1698
1495
|
|
|
@@ -1700,7 +1497,7 @@ var ProductCreateOrganizeForm = ({ form }) => {
|
|
|
1700
1497
|
import { useMemo as useMemo3 } from "react";
|
|
1701
1498
|
import { useWatch as useWatch3 } from "react-hook-form";
|
|
1702
1499
|
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1703
|
-
import { jsx as
|
|
1500
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1704
1501
|
var ProductCreateVariantsForm = ({
|
|
1705
1502
|
form,
|
|
1706
1503
|
regions,
|
|
@@ -1737,7 +1534,7 @@ var ProductCreateVariantsForm = ({
|
|
|
1737
1534
|
});
|
|
1738
1535
|
return ret;
|
|
1739
1536
|
}, [variants]);
|
|
1740
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex size-full flex-col divide-y overflow-hidden", children: /* @__PURE__ */ jsx10(
|
|
1741
1538
|
DataGrid,
|
|
1742
1539
|
{
|
|
1743
1540
|
columns,
|
|
@@ -1759,9 +1556,9 @@ var useColumns2 = ({
|
|
|
1759
1556
|
() => [
|
|
1760
1557
|
columnHelper2.column({
|
|
1761
1558
|
id: "options",
|
|
1762
|
-
header: () => /* @__PURE__ */
|
|
1559
|
+
header: () => /* @__PURE__ */ jsx10("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx10("span", { className: "truncate", children: options.map((o) => o.title).join(" / ") }) }),
|
|
1763
1560
|
cell: (context) => {
|
|
1764
|
-
return /* @__PURE__ */
|
|
1561
|
+
return /* @__PURE__ */ jsx10(DataGrid.ReadonlyCell, { context, children: options.map((o) => context.row.original.options[o.title]).join(" / ") });
|
|
1765
1562
|
},
|
|
1766
1563
|
disableHiding: true
|
|
1767
1564
|
}),
|
|
@@ -1772,7 +1569,7 @@ var useColumns2 = ({
|
|
|
1772
1569
|
field: (context) => `variants.${context.row.original.originalIndex}.title`,
|
|
1773
1570
|
type: "text",
|
|
1774
1571
|
cell: (context) => {
|
|
1775
|
-
return /* @__PURE__ */
|
|
1572
|
+
return /* @__PURE__ */ jsx10(DataGrid.TextCell, { context });
|
|
1776
1573
|
}
|
|
1777
1574
|
}),
|
|
1778
1575
|
columnHelper2.column({
|
|
@@ -1782,7 +1579,7 @@ var useColumns2 = ({
|
|
|
1782
1579
|
field: (context) => `variants.${context.row.original.originalIndex}.sku`,
|
|
1783
1580
|
type: "text",
|
|
1784
1581
|
cell: (context) => {
|
|
1785
|
-
return /* @__PURE__ */
|
|
1582
|
+
return /* @__PURE__ */ jsx10(DataGrid.TextCell, { context });
|
|
1786
1583
|
}
|
|
1787
1584
|
}),
|
|
1788
1585
|
columnHelper2.column({
|
|
@@ -1792,7 +1589,7 @@ var useColumns2 = ({
|
|
|
1792
1589
|
field: (context) => `variants.${context.row.original.originalIndex}.manage_inventory`,
|
|
1793
1590
|
type: "boolean",
|
|
1794
1591
|
cell: (context) => {
|
|
1795
|
-
return /* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ jsx10(DataGrid.BooleanCell, { context });
|
|
1796
1593
|
}
|
|
1797
1594
|
}),
|
|
1798
1595
|
columnHelper2.column({
|
|
@@ -1802,7 +1599,7 @@ var useColumns2 = ({
|
|
|
1802
1599
|
field: (context) => `variants.${context.row.original.originalIndex}.allow_backorder`,
|
|
1803
1600
|
type: "boolean",
|
|
1804
1601
|
cell: (context) => {
|
|
1805
|
-
return /* @__PURE__ */
|
|
1602
|
+
return /* @__PURE__ */ jsx10(DataGrid.BooleanCell, { context });
|
|
1806
1603
|
}
|
|
1807
1604
|
}),
|
|
1808
1605
|
columnHelper2.column({
|
|
@@ -1812,7 +1609,7 @@ var useColumns2 = ({
|
|
|
1812
1609
|
field: (context) => `variants.${context.row.original.originalIndex}.inventory_kit`,
|
|
1813
1610
|
type: "boolean",
|
|
1814
1611
|
cell: (context) => {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1612
|
+
return /* @__PURE__ */ jsx10(
|
|
1816
1613
|
DataGrid.BooleanCell,
|
|
1817
1614
|
{
|
|
1818
1615
|
context,
|
|
@@ -1839,7 +1636,7 @@ var useColumns2 = ({
|
|
|
1839
1636
|
};
|
|
1840
1637
|
|
|
1841
1638
|
// src/routes/products/product-create/components/product-create-form/product-create-form.tsx
|
|
1842
|
-
import { jsx as
|
|
1639
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1843
1640
|
var SAVE_DRAFT_BUTTON = "save-draft-button";
|
|
1844
1641
|
var ProductCreateForm = ({
|
|
1845
1642
|
defaultChannel,
|
|
@@ -1872,13 +1669,10 @@ var ProductCreateForm = ({
|
|
|
1872
1669
|
if (!regions?.length) {
|
|
1873
1670
|
return {};
|
|
1874
1671
|
}
|
|
1875
|
-
return regions.reduce(
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
},
|
|
1880
|
-
{}
|
|
1881
|
-
);
|
|
1672
|
+
return regions.reduce((acc, reg) => {
|
|
1673
|
+
acc[reg.id] = reg.currency_code;
|
|
1674
|
+
return acc;
|
|
1675
|
+
}, {});
|
|
1882
1676
|
}, [regions]);
|
|
1883
1677
|
const watchedVariants = useWatch4({
|
|
1884
1678
|
control: form.control,
|
|
@@ -1980,7 +1774,7 @@ var ProductCreateForm = ({
|
|
|
1980
1774
|
}
|
|
1981
1775
|
setTabState({ ...currentState });
|
|
1982
1776
|
}, [tab]);
|
|
1983
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx11(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs9(
|
|
1984
1778
|
KeyboundForm,
|
|
1985
1779
|
{
|
|
1986
1780
|
onKeyDown: (e) => {
|
|
@@ -2003,7 +1797,7 @@ var ProductCreateForm = ({
|
|
|
2003
1797
|
onSubmit: handleSubmit,
|
|
2004
1798
|
className: "flex h-full flex-col",
|
|
2005
1799
|
children: [
|
|
2006
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ jsxs9(
|
|
2007
1801
|
ProgressTabs,
|
|
2008
1802
|
{
|
|
2009
1803
|
dir: direction,
|
|
@@ -2017,8 +1811,8 @@ var ProductCreateForm = ({
|
|
|
2017
1811
|
},
|
|
2018
1812
|
className: "flex h-full flex-col overflow-hidden",
|
|
2019
1813
|
children: [
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
/* @__PURE__ */
|
|
1814
|
+
/* @__PURE__ */ jsx11(RouteFocusModal.Header, { children: /* @__PURE__ */ jsx11("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsxs9(ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: [
|
|
1815
|
+
/* @__PURE__ */ jsx11(
|
|
2022
1816
|
ProgressTabs.Trigger,
|
|
2023
1817
|
{
|
|
2024
1818
|
status: tabState["details" /* DETAILS */],
|
|
@@ -2027,7 +1821,7 @@ var ProductCreateForm = ({
|
|
|
2027
1821
|
children: t("products.create.tabs.details")
|
|
2028
1822
|
}
|
|
2029
1823
|
),
|
|
2030
|
-
/* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ jsx11(
|
|
2031
1825
|
ProgressTabs.Trigger,
|
|
2032
1826
|
{
|
|
2033
1827
|
status: tabState["organize" /* ORGANIZE */],
|
|
@@ -2036,7 +1830,7 @@ var ProductCreateForm = ({
|
|
|
2036
1830
|
children: t("products.create.tabs.organize")
|
|
2037
1831
|
}
|
|
2038
1832
|
),
|
|
2039
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ jsx11(
|
|
2040
1834
|
ProgressTabs.Trigger,
|
|
2041
1835
|
{
|
|
2042
1836
|
status: tabState["variants" /* VARIANTS */],
|
|
@@ -2045,7 +1839,7 @@ var ProductCreateForm = ({
|
|
|
2045
1839
|
children: t("products.create.tabs.variants")
|
|
2046
1840
|
}
|
|
2047
1841
|
),
|
|
2048
|
-
showInventoryTab && /* @__PURE__ */
|
|
1842
|
+
showInventoryTab && /* @__PURE__ */ jsx11(
|
|
2049
1843
|
ProgressTabs.Trigger,
|
|
2050
1844
|
{
|
|
2051
1845
|
status: tabState["inventory" /* INVENTORY */],
|
|
@@ -2055,29 +1849,29 @@ var ProductCreateForm = ({
|
|
|
2055
1849
|
}
|
|
2056
1850
|
)
|
|
2057
1851
|
] }) }) }),
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
/* @__PURE__ */
|
|
1852
|
+
/* @__PURE__ */ jsxs9(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: [
|
|
1853
|
+
/* @__PURE__ */ jsx11(
|
|
2060
1854
|
ProgressTabs.Content,
|
|
2061
1855
|
{
|
|
2062
1856
|
className: "size-full overflow-y-auto",
|
|
2063
1857
|
value: "details" /* DETAILS */,
|
|
2064
|
-
children: /* @__PURE__ */
|
|
1858
|
+
children: /* @__PURE__ */ jsx11(ProductCreateDetailsForm, { form })
|
|
2065
1859
|
}
|
|
2066
1860
|
),
|
|
2067
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ jsx11(
|
|
2068
1862
|
ProgressTabs.Content,
|
|
2069
1863
|
{
|
|
2070
1864
|
className: "size-full overflow-y-auto",
|
|
2071
1865
|
value: "organize" /* ORGANIZE */,
|
|
2072
|
-
children: /* @__PURE__ */
|
|
1866
|
+
children: /* @__PURE__ */ jsx11(ProductCreateOrganizeForm, { form })
|
|
2073
1867
|
}
|
|
2074
1868
|
),
|
|
2075
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ jsx11(
|
|
2076
1870
|
ProgressTabs.Content,
|
|
2077
1871
|
{
|
|
2078
1872
|
className: "size-full overflow-y-auto",
|
|
2079
1873
|
value: "variants" /* VARIANTS */,
|
|
2080
|
-
children: /* @__PURE__ */
|
|
1874
|
+
children: /* @__PURE__ */ jsx11(
|
|
2081
1875
|
ProductCreateVariantsForm,
|
|
2082
1876
|
{
|
|
2083
1877
|
form,
|
|
@@ -2088,22 +1882,22 @@ var ProductCreateForm = ({
|
|
|
2088
1882
|
)
|
|
2089
1883
|
}
|
|
2090
1884
|
),
|
|
2091
|
-
showInventoryTab && /* @__PURE__ */
|
|
1885
|
+
showInventoryTab && /* @__PURE__ */ jsx11(
|
|
2092
1886
|
ProgressTabs.Content,
|
|
2093
1887
|
{
|
|
2094
1888
|
className: "size-full overflow-y-auto",
|
|
2095
1889
|
value: "inventory" /* INVENTORY */,
|
|
2096
|
-
children: /* @__PURE__ */
|
|
1890
|
+
children: /* @__PURE__ */ jsx11(ProductCreateInventoryKitForm, { form })
|
|
2097
1891
|
}
|
|
2098
1892
|
)
|
|
2099
1893
|
] })
|
|
2100
1894
|
]
|
|
2101
1895
|
}
|
|
2102
1896
|
),
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
|
|
1897
|
+
/* @__PURE__ */ jsx11(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
1898
|
+
/* @__PURE__ */ jsx11(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx11(Button4, { variant: "secondary", size: "small", children: t("actions.cancel") }) }),
|
|
1899
|
+
/* @__PURE__ */ jsx11(
|
|
1900
|
+
Button4,
|
|
2107
1901
|
{
|
|
2108
1902
|
"data-name": SAVE_DRAFT_BUTTON,
|
|
2109
1903
|
size: "small",
|
|
@@ -2113,7 +1907,7 @@ var ProductCreateForm = ({
|
|
|
2113
1907
|
children: t("actions.saveAsDraft")
|
|
2114
1908
|
}
|
|
2115
1909
|
),
|
|
2116
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ jsx11(
|
|
2117
1911
|
PrimaryButton,
|
|
2118
1912
|
{
|
|
2119
1913
|
tab,
|
|
@@ -2135,8 +1929,8 @@ var PrimaryButton = ({
|
|
|
2135
1929
|
}) => {
|
|
2136
1930
|
const { t } = useTranslation9();
|
|
2137
1931
|
if (tab === "variants" /* VARIANTS */ && !showInventoryTab || tab === "inventory" /* INVENTORY */ && showInventoryTab) {
|
|
2138
|
-
return /* @__PURE__ */
|
|
2139
|
-
|
|
1932
|
+
return /* @__PURE__ */ jsx11(
|
|
1933
|
+
Button4,
|
|
2140
1934
|
{
|
|
2141
1935
|
"data-name": "publish-button",
|
|
2142
1936
|
type: "submit",
|
|
@@ -2148,8 +1942,8 @@ var PrimaryButton = ({
|
|
|
2148
1942
|
"submit-button"
|
|
2149
1943
|
);
|
|
2150
1944
|
}
|
|
2151
|
-
return /* @__PURE__ */
|
|
2152
|
-
|
|
1945
|
+
return /* @__PURE__ */ jsx11(
|
|
1946
|
+
Button4,
|
|
2153
1947
|
{
|
|
2154
1948
|
type: "button",
|
|
2155
1949
|
variant: "primary",
|
|
@@ -2162,7 +1956,7 @@ var PrimaryButton = ({
|
|
|
2162
1956
|
};
|
|
2163
1957
|
|
|
2164
1958
|
// src/routes/products/product-create/product-create.tsx
|
|
2165
|
-
import { jsx as
|
|
1959
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2166
1960
|
var ProductCreate = () => {
|
|
2167
1961
|
const { t } = useTranslation10();
|
|
2168
1962
|
const {
|
|
@@ -2208,10 +2002,10 @@ var ProductCreate = () => {
|
|
|
2208
2002
|
if (isPricePreferencesError) {
|
|
2209
2003
|
throw pricePreferencesError;
|
|
2210
2004
|
}
|
|
2211
|
-
return /* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
ready && /* @__PURE__ */
|
|
2005
|
+
return /* @__PURE__ */ jsxs10(RouteFocusModal, { children: [
|
|
2006
|
+
/* @__PURE__ */ jsx12(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx12("span", { className: "sr-only", children: t("products.create.title") }) }),
|
|
2007
|
+
/* @__PURE__ */ jsx12(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx12("span", { className: "sr-only", children: t("products.create.description") }) }),
|
|
2008
|
+
ready && /* @__PURE__ */ jsx12(
|
|
2215
2009
|
ProductCreateForm,
|
|
2216
2010
|
{
|
|
2217
2011
|
defaultChannel: sales_channel,
|