@mercurjs/vendor 2.2.0 → 2.2.1-canary.1
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/{[id]-OV5VX7KD.js → [id]-4H5PHF5Y.js} +12 -12
- package/dist/{[id]-LJABCC3D.js → [id]-DO6VH55G.js} +14 -14
- package/dist/{[id]-RFC2YGFT.js → [id]-JZSYMEEU.js} +3 -3
- package/dist/{[id]-AXGVRF7M.js → [id]-L3SFKXZ7.js} +9 -9
- package/dist/{[id]-NGB5OLRW.js → [id]-ME4FNZNO.js} +77 -240
- package/dist/{[id]-VKEADKFV.js → [id]-OHHNUQEA.js} +13 -13
- package/dist/{[id]-FOWK6QIJ.js → [id]-UPNT4QPB.js} +14 -14
- package/dist/{[id]-H3YKIFO3.js → [id]-URI4QFRU.js} +81 -32
- package/dist/{[id]-WUXFJPPB.js → [id]-V4RDXDN5.js} +7 -7
- package/dist/{[id]-IFWREJVP.js → [id]-X75OHEV7.js} +13 -13
- package/dist/{[id]-DKF4YEXN.js → [id]-XMJLPBNR.js} +10 -10
- package/dist/{[id]-3GF4DR5K.js → [id]-ZD5HBP2R.js} +11 -11
- package/dist/{[location_id]-ZG5GZKHC.js → [location_id]-CJDVYICJ.js} +1 -1
- package/dist/{[province_id]-KEDQTW6S.js → [province_id]-4WMI4GFG.js} +9 -9
- package/dist/{add-HARVSLKD.js → add-Q4A7JELU.js} +14 -14
- package/dist/{add-IEIH4CBT.js → add-YEUSE5QA.js} +9 -9
- package/dist/{add-customer-groups-EJIRM264.js → add-customer-groups-U2VVS2U4.js} +9 -9
- package/dist/{add-products-MW2JYTSJ.js → add-products-GVD6RS4H.js} +13 -13
- package/dist/{add-promotions-7KCUDY3S.js → add-promotions-C4EVHYS6.js} +7 -7
- package/dist/{add-to-campaign-B7RFNWPF.js → add-to-campaign-WBSCTSKW.js} +2 -2
- package/dist/{address-CP2MSWLA.js → address-ZMZ4ST5T.js} +7 -7
- package/dist/{adjust-inventory-CQPDV5X7.js → adjust-inventory-QUGKDXOC.js} +1 -1
- package/dist/{allocate-items-646J75L2.js → allocate-items-7NSBGXSF.js} +2 -2
- package/dist/{areas-VO7NUUUL.js → areas-V6PALYZ5.js} +3 -3
- package/dist/{attributes-HU6I723C.js → attributes-6KZMMR7U.js} +1 -1
- package/dist/{breadcrumb-3M7RKX5V.js → breadcrumb-C7M5PG2Q.js} +7 -7
- package/dist/{breadcrumb-X5TTCKIB.js → breadcrumb-CX5327S5.js} +1 -1
- package/dist/{breadcrumb-C7X6FV2H.js → breadcrumb-JWFTKHLE.js} +2 -2
- package/dist/{breadcrumb-4Z7NR2BO.js → breadcrumb-KLNC72RI.js} +2 -2
- package/dist/{breadcrumb-HK53R6S2.js → breadcrumb-KNBZ3JNR.js} +1 -1
- package/dist/{breadcrumb-UVODV3YP.js → breadcrumb-M657ZCG6.js} +2 -2
- package/dist/{breadcrumb-KV6K64PW.js → breadcrumb-M6NW3DRQ.js} +1 -1
- package/dist/{breadcrumb-TPITDYD7.js → breadcrumb-MXYWEBK6.js} +7 -7
- package/dist/{breadcrumb-FF7H3XPP.js → breadcrumb-NBO7UIBV.js} +2 -2
- package/dist/{breadcrumb-EAYZVNKS.js → breadcrumb-QPV566YX.js} +7 -7
- package/dist/{campaigns-JKFMRYZE.js → campaigns-JVLK7PZZ.js} +3 -3
- package/dist/{categories-2PGWWGP6.js → categories-V5UXBO7N.js} +5 -5
- package/dist/{chunk-P7UBW2EI.js → chunk-2S2WK2OG.js} +1 -1
- package/dist/{chunk-AAKR2CB4.js → chunk-3GSR455R.js} +1 -1
- package/dist/{chunk-DSNCEHLY.js → chunk-3WQSQ46M.js} +54 -12
- package/dist/{chunk-53JNB4BP.js → chunk-4E26HOEQ.js} +3 -3
- package/dist/{chunk-B25W27XK.js → chunk-4PLH6C5Y.js} +2 -2
- package/dist/{chunk-52KJSIHS.js → chunk-4UQMRTSC.js} +1393 -1359
- package/dist/{chunk-D6XR2USM.js → chunk-5YRE7YS6.js} +6 -6
- package/dist/{chunk-DHARUTMI.js → chunk-63F4K3JV.js} +1 -1
- package/dist/{chunk-RPMYKDNA.js → chunk-6VKJM537.js} +1 -1
- package/dist/{chunk-2GVPLCQR.js → chunk-72HQFLZI.js} +1 -1
- package/dist/{chunk-ORI73OPX.js → chunk-7BIBEQTK.js} +1 -1
- package/dist/{chunk-YVI3LZ3X.js → chunk-7LSQNTWJ.js} +5 -5
- package/dist/{chunk-ZZ4JC4WE.js → chunk-A2KHOOJJ.js} +305 -271
- package/dist/{chunk-F4ORNDFU.js → chunk-B6PFCERY.js} +1 -1
- package/dist/{chunk-P76QYIFF.js → chunk-BTQN4KKH.js} +1 -1
- package/dist/{chunk-JDMNEMRJ.js → chunk-BX3JE7IE.js} +1 -1
- package/dist/{chunk-54SCBOWD.js → chunk-BZ62QUXM.js} +5 -5
- package/dist/{chunk-3IZSQI6K.js → chunk-CQ2LZLMZ.js} +1 -1
- package/dist/{chunk-656G74I2.js → chunk-DETQ6IBQ.js} +1 -1
- package/dist/{chunk-YAUGB4LD.js → chunk-EMUCGKHP.js} +19 -23
- package/dist/{chunk-D6RN3ONJ.js → chunk-EPSRO7C5.js} +2 -2
- package/dist/{chunk-6PSJJHI4.js → chunk-GIKVFOQL.js} +1 -1
- package/dist/{chunk-DSY5PNK6.js → chunk-HCUIYIIY.js} +1 -1
- package/dist/{chunk-SCPQYA26.js → chunk-HJKH5CIN.js} +1 -1
- package/dist/{chunk-KUH5ZX7G.js → chunk-IMIPUUZG.js} +1 -1
- package/dist/chunk-J75EFK5A.js +59 -0
- package/dist/{chunk-IP6TSKUQ.js → chunk-JB32ZD4Y.js} +2 -2
- package/dist/chunk-MDABSESI.js +38 -0
- package/dist/{chunk-UWU6VSO4.js → chunk-MJDXUH62.js} +2 -2
- package/dist/{chunk-RSOV55K7.js → chunk-NIBVITRN.js} +1 -1
- package/dist/{chunk-XKEYHWBS.js → chunk-OCYVN77Z.js} +1 -1
- package/dist/{chunk-DIAWPVYS.js → chunk-OGUTFP6B.js} +1 -1
- package/dist/{chunk-OCS24TF4.js → chunk-OTBX6TP5.js} +1 -1
- package/dist/{chunk-OZ2UHCWA.js → chunk-OZJVEN6Y.js} +1 -1
- package/dist/{chunk-N7YRIXJA.js → chunk-OZUKJHBG.js} +2 -2
- package/dist/{chunk-5DKUSZQ7.js → chunk-PF7R7LMW.js} +1 -1
- package/dist/{chunk-WJ4KVDFV.js → chunk-PFZJDFJE.js} +1 -1
- package/dist/{chunk-7TQNE3E2.js → chunk-RR276N7K.js} +1 -1
- package/dist/{chunk-YXEC5XAV.js → chunk-RVFPWOR2.js} +1 -1
- package/dist/{chunk-MDGTQT5D.js → chunk-RW2EF2S2.js} +15 -44
- package/dist/{chunk-S5KWI3MM.js → chunk-RZNF5OGM.js} +12 -12
- package/dist/{chunk-G64YUZSL.js → chunk-S2VYK3YC.js} +1 -1
- package/dist/{chunk-E73SSHJR.js → chunk-SA7ZGKMI.js} +1 -1
- package/dist/{chunk-SFQOECF7.js → chunk-SI55QRZ4.js} +7 -6
- package/dist/{chunk-XQO243HC.js → chunk-TGAJLPO4.js} +1 -1
- package/dist/{chunk-WN2NWWVO.js → chunk-TII3PB6X.js} +1 -1
- package/dist/{chunk-VUWAOX7H.js → chunk-U5V6HNVW.js} +1 -1
- package/dist/{chunk-XEQU2OQP.js → chunk-UJ57OE7G.js} +4 -4
- package/dist/{chunk-4GPAS5GW.js → chunk-UST2RGWB.js} +3 -2
- package/dist/{chunk-DRKRLQZZ.js → chunk-VHFKJLDH.js} +1 -1
- package/dist/{chunk-KGHHGMDU.js → chunk-VVTBCP3J.js} +2 -2
- package/dist/{chunk-XUJUJD2E.js → chunk-VVX7PL6K.js} +77 -14
- package/dist/{chunk-P27MQBMZ.js → chunk-WJF24CGA.js} +1 -1
- package/dist/{chunk-OQTL7PXK.js → chunk-XVBONKRV.js} +1 -1
- package/dist/{chunk-ZZ7T7GN5.js → chunk-YG5K4DQ2.js} +25 -16
- package/dist/{chunk-4ZWIWI2H.js → chunk-Z6KOYIKK.js} +2 -2
- package/dist/{chunk-VQTQILLY.js → chunk-ZEXF3ABX.js} +1 -1
- package/dist/{chunk-CVXKASWV.js → chunk-ZHXIOG62.js} +1 -1
- package/dist/{chunk-LFX6R456.js → chunk-ZXDMPIXN.js} +3 -3
- package/dist/{collections-BLDMQOVB.js → collections-K7H2MWBH.js} +13 -13
- package/dist/{configuration-YVYVOLSP.js → configuration-QEDVL2WF.js} +2 -2
- package/dist/{create-FYKFT7TQ.js → create-2I3GAX4C.js} +7 -7
- package/dist/{create-3WBHG32J.js → create-2VDED7TL.js} +6 -6
- package/dist/{create-QZVZF3MJ.js → create-7FT7N2NH.js} +2 -2
- package/dist/{create-PO3JC6QK.js → create-GEOTGYQK.js} +7 -7
- package/dist/{create-NNBIDU4Q.js → create-GEYXN6SW.js} +7 -7
- package/dist/{create-Z6ZHEAKU.js → create-H77ZUZG5.js} +7 -7
- package/dist/{create-Y2FZ4565.js → create-HQVENM5H.js} +159 -132
- package/dist/{create-TDQISX3H.js → create-LJO4YEDW.js} +5 -5
- package/dist/{create-ZLYEPOAQ.js → create-MFGMTZ5A.js} +8 -8
- package/dist/{create-PO2JF7F5.js → create-PF2465JI.js} +15 -15
- package/dist/{create-XORPYXNT.js → create-S7VYYTUD.js} +9 -9
- package/dist/{create-7VKH255E.js → create-T6WOFJDM.js} +3 -3
- package/dist/{create-DU2V6X5H.js → create-V4YOFXW7.js} +13 -13
- package/dist/{create-G6VJD52A.js → create-VWONAYEZ.js} +15 -15
- package/dist/{customer-group-add-customers-UTBBZ6T4.js → customer-group-add-customers-GUJQAPU4.js} +2 -2
- package/dist/{customer-group-detail-WSBXE23J.js → customer-group-detail-ZQOMC6C5.js} +3 -3
- package/dist/{customer-groups-TWCYFU3U.js → customer-groups-JKF46LEB.js} +3 -3
- package/dist/{customers-6HDZKARD.js → customers-OZJ5UBIZ.js} +3 -3
- package/dist/{edit-K2IP2H25.js → edit-4B364HGZ.js} +2 -2
- package/dist/{edit-Y4XONJJU.js → edit-6VJWRZHQ.js} +7 -7
- package/dist/{edit-IVBVZ5NL.js → edit-735HBYH2.js} +2 -2
- package/dist/{edit-YDMBLXGU.js → edit-M4AP65HO.js} +8 -8
- package/dist/{edit-CKO32TA3.js → edit-MPOTIGUY.js} +8 -8
- package/dist/{edit-3AM5DZE7.js → edit-PUGFEETJ.js} +10 -10
- package/dist/edit-QBUYHSE7.js +122 -0
- package/dist/{edit-CNXA4GKJ.js → edit-QHXQ4XOC.js} +6 -6
- package/dist/{edit-YPIJHIGC.js → edit-RJUZDCAC.js} +15 -15
- package/dist/{edit-3HMTDPZK.js → edit-SQU5UOGE.js} +8 -8
- package/dist/{edit-OOY2XGLZ.js → edit-TFFIBHDE.js} +53 -42
- package/dist/edit-TTW5DB77.js +525 -0
- package/dist/{edit-inventory-item-5VBH365V.js → edit-inventory-item-BCVECCLT.js} +1 -1
- package/dist/{edit-inventory-item-attributes-RMKG2IRO.js → edit-inventory-item-attributes-GWEMP67O.js} +1 -1
- package/dist/{edit-price-PDS4XN2J.js → edit-price-GLAEAO7R.js} +2 -2
- package/dist/{edit-stock-UI6HXHJJ.js → edit-stock-E3PM2YOP.js} +2 -2
- package/dist/extension-targets.d.ts +2 -2
- package/dist/{fulfillment-6GC3NRFT.js → fulfillment-HDU7GATG.js} +7 -7
- package/dist/{fulfillment-providers-IND53UPG.js → fulfillment-providers-KT6GFVHM.js} +12 -12
- package/dist/index.css +9 -0
- package/dist/index.js +158 -158
- package/dist/{inventory-BDST2XIX.js → inventory-4DHRHO5G.js} +4 -4
- package/dist/{inventory-LSG2IEWD.js → inventory-CKA34HWM.js} +2 -2
- package/dist/{invite-DD2G6UUM.js → invite-4CRK5AKM.js} +10 -10
- package/dist/{invite-CNJQ27AY.js → invite-755AJC3M.js} +7 -7
- package/dist/{loader-MJTR2S7V.js → loader-B4T2VBGV.js} +2 -2
- package/dist/{loader-BLRQLIJT.js → loader-UUSAVCK6.js} +1 -1
- package/dist/{locations-HHP2DZ4N.js → locations-BN2BTULF.js} +2 -2
- package/dist/{login-VMLJYOCF.js → login-UGKYRKMD.js} +9 -9
- package/dist/{manage-locations-V2AJVZXA.js → manage-locations-PRQI5TI4.js} +1 -1
- package/dist/{media-ZXUMWWXV.js → media-QXTBUKRL.js} +11 -11
- package/dist/{media-T26YU24S.js → media-TGFAHFBV.js} +9 -9
- package/dist/{metadata-WB37SSTG.js → metadata-4ZZ4ZIWJ.js} +7 -7
- package/dist/{metadata-XS3VAC3N.js → metadata-5TVRCKWX.js} +7 -7
- package/dist/{metadata-BGYWXGMG.js → metadata-7JWZ4VFM.js} +7 -7
- package/dist/{metadata-3CER2AEK.js → metadata-BQQFHVKF.js} +7 -7
- package/dist/{metadata-MSAODJ2T.js → metadata-G73TILNE.js} +7 -7
- package/dist/{offer-create-page-VHNJL3UO.js → offer-create-page-WPGYWE3P.js} +12 -12
- package/dist/{offer-detail-page-ZLGP4ELR.js → offer-detail-page-MCCTZS4U.js} +16 -23
- package/dist/{offer-variant-detail-page-2A7TRGYS.js → offer-variant-detail-page-ITNWEDPL.js} +16 -19
- package/dist/{offers-ZBAZOZ7Q.js → offers-VURV22HI.js} +13 -13
- package/dist/{onboarding-XCCZ2TMN.js → onboarding-7MURQYXX.js} +7 -7
- package/dist/{orders-VFSDZYOV.js → orders-WX5YB4QC.js} +13 -13
- package/dist/{organization-YB45TRUN.js → organization-T6ZTYMMW.js} +9 -9
- package/dist/{organize-T62CDRZC.js → organize-F2KDXDHQ.js} +3 -3
- package/dist/{organize-HQLROEUF.js → organize-GZ5URDMH.js} +3 -3
- package/dist/pages/index.d.ts +1 -2
- package/dist/pages/index.js +40 -39
- package/dist/{payment-details-O4EWCOYQ.js → payment-details-UQ65D5AY.js} +7 -7
- package/dist/{payouts-7O5W2X5J.js → payouts-64CG65KK.js} +3 -3
- package/dist/{price-lists-5C4MCWWR.js → price-lists-ZRXB2V7W.js} +6 -6
- package/dist/{pricing-CF3FJP6A.js → pricing-3NLEJYRP.js} +2 -2
- package/dist/{pricing-OQ4RKZO5.js → pricing-CPPIL627.js} +7 -7
- package/dist/{product-tags-2TLA7BVO.js → product-tags-AE5K6YFE.js} +15 -15
- package/dist/{product-types-LZAMCLGS.js → product-types-OMPZFQH4.js} +3 -3
- package/dist/{product-variant-detail-UNG6LWDP.js → product-variant-detail-4DDE6RJ5.js} +8 -8
- package/dist/{product-variant-edit-K5U3JZFW.js → product-variant-edit-SAZUI4E3.js} +9 -9
- package/dist/{products-WJJBC3NI.js → products-4AAGMX3C.js} +13 -13
- package/dist/{products-QIGSKI65.js → products-7SPJXANH.js} +19 -19
- package/dist/{professional-details-ZCRAWCXZ.js → professional-details-UN5B4YDJ.js} +7 -7
- package/dist/{profile-T2QLFLI7.js → profile-6MIDTK52.js} +7 -7
- package/dist/{promotions-JT5PFYPT.js → promotions-FUPYU3EL.js} +8 -8
- package/dist/{receive-QCVCAR3R.js → receive-ZG6FFN7H.js} +3 -3
- package/dist/{refund-GAOWE636.js → refund-KJX74N6T.js} +3 -3
- package/dist/{register-S4EBPL7B.js → register-GAG7SNL6.js} +9 -9
- package/dist/{reset-password-VTYSKEFH.js → reset-password-YI7COKLV.js} +1 -1
- package/dist/{return-reasons-RH6IEU2M.js → return-reasons-I7YVFYB7.js} +5 -5
- package/dist/{sales-channels-ZHYGTRWU.js → sales-channels-LWEVGTY6.js} +3 -2
- package/dist/{sales-channels-C5M2ZA5L.js → sales-channels-RJLPZDOZ.js} +3 -2
- package/dist/{settings-5IUDEPUN.js → settings-YWUHDHET.js} +19 -19
- package/dist/{shipment-UP2OGESO.js → shipment-6CTA2GHU.js} +7 -7
- package/dist/{shipping-ACK5UOA5.js → shipping-TKKMYQHJ.js} +2 -2
- package/dist/{shipping-profile-3US7LC5E.js → shipping-profile-CFISOMTE.js} +1 -1
- package/dist/{shipping-profiles-34432J3C.js → shipping-profiles-42EXTQKX.js} +10 -10
- package/dist/{stock-QOUDJSFO.js → stock-465GEUY3.js} +7 -7
- package/dist/{store-BCNSSIO6.js → store-BRVTHHXV.js} +9 -9
- package/dist/{store-closure-QGR3F45Y.js → store-closure-DYW54VHB.js} +7 -7
- package/dist/{store-select-55ZOJGGV.js → store-select-6A5YR7WH.js} +8 -8
- package/dist/{tax-regions-RTPVM4IC.js → tax-regions-SQVEIHUK.js} +2 -2
- package/dist/{team-DAUWBJAI.js → team-5SBIRJKL.js} +10 -10
- package/package.json +15 -15
- package/dist/chunk-S2WEYEQR.js +0 -14
- package/dist/edit-DCMMX4GW.js +0 -366
- package/dist/edit-P6YZBA32.js +0 -324
package/dist/edit-DCMMX4GW.js
DELETED
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AttributeValueInput
|
|
3
|
-
} from "./chunk-6PSJJHI4.js";
|
|
4
|
-
import {
|
|
5
|
-
ChipInput
|
|
6
|
-
} from "./chunk-KDE4HKH2.js";
|
|
7
|
-
import "./chunk-VBRTC2VU.js";
|
|
8
|
-
import "./chunk-TKGWSUEI.js";
|
|
9
|
-
import {
|
|
10
|
-
KeyboundForm
|
|
11
|
-
} from "./chunk-SITRHMZZ.js";
|
|
12
|
-
import {
|
|
13
|
-
RouteDrawer,
|
|
14
|
-
useRouteModal
|
|
15
|
-
} from "./chunk-GDWBOQI5.js";
|
|
16
|
-
import {
|
|
17
|
-
Form
|
|
18
|
-
} from "./chunk-3QSRE5LS.js";
|
|
19
|
-
import {
|
|
20
|
-
require_dist
|
|
21
|
-
} from "./chunk-52KJSIHS.js";
|
|
22
|
-
import {
|
|
23
|
-
useFeatureFlags
|
|
24
|
-
} from "./chunk-RLRWDHME.js";
|
|
25
|
-
import "./chunk-K5324KIX.js";
|
|
26
|
-
import "./chunk-FV76G2D7.js";
|
|
27
|
-
import "./chunk-GHDLST2P.js";
|
|
28
|
-
import "./chunk-YVYYOBAE.js";
|
|
29
|
-
import "./chunk-L2NJPDUD.js";
|
|
30
|
-
import "./chunk-P7UBW2EI.js";
|
|
31
|
-
import "./chunk-MR6REQKT.js";
|
|
32
|
-
import "./chunk-EPSDO2MJ.js";
|
|
33
|
-
import "./chunk-BHEU34FL.js";
|
|
34
|
-
import "./chunk-W34KDYZA.js";
|
|
35
|
-
import "./chunk-II3CLUXA.js";
|
|
36
|
-
import "./chunk-XKEYHWBS.js";
|
|
37
|
-
import "./chunk-J2XUEO2E.js";
|
|
38
|
-
import "./chunk-656G74I2.js";
|
|
39
|
-
import "./chunk-VWPNMEOE.js";
|
|
40
|
-
import "./chunk-O72AIZUN.js";
|
|
41
|
-
import "./chunk-VUWAOX7H.js";
|
|
42
|
-
import "./chunk-5DKUSZQ7.js";
|
|
43
|
-
import "./chunk-DIAWPVYS.js";
|
|
44
|
-
import "./chunk-4U2BLH45.js";
|
|
45
|
-
import {
|
|
46
|
-
PRODUCT_DETAIL_QUERY
|
|
47
|
-
} from "./chunk-Q6SPIHFR.js";
|
|
48
|
-
import {
|
|
49
|
-
useBatchProductAttributes,
|
|
50
|
-
useProduct
|
|
51
|
-
} from "./chunk-YAUGB4LD.js";
|
|
52
|
-
import "./chunk-A5DJIOHN.js";
|
|
53
|
-
import "./chunk-RHKRREUU.js";
|
|
54
|
-
import "./chunk-ZA2KFUFR.js";
|
|
55
|
-
import "./chunk-DTGEFKK4.js";
|
|
56
|
-
import {
|
|
57
|
-
__toESM
|
|
58
|
-
} from "./chunk-NBMM2TZK.js";
|
|
59
|
-
|
|
60
|
-
// src/pages/products/[id]/attributes/[attribute_id]/edit/index.tsx
|
|
61
|
-
import { Heading } from "@medusajs/ui";
|
|
62
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
63
|
-
import { useParams } from "react-router-dom";
|
|
64
|
-
import { useLinkQuery } from "@mercurjs/dashboard-shared";
|
|
65
|
-
|
|
66
|
-
// src/pages/products/[id]/attributes/[attribute_id]/edit/components/edit-attribute-form/edit-attribute-form.tsx
|
|
67
|
-
var import_types = __toESM(require_dist(), 1);
|
|
68
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
69
|
-
import { Button, InlineTip, Input, Label, toast } from "@medusajs/ui";
|
|
70
|
-
import { useForm } from "react-hook-form";
|
|
71
|
-
import { useTranslation } from "react-i18next";
|
|
72
|
-
import * as zod from "zod";
|
|
73
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
74
|
-
var isVariantAxis = (attribute) => attribute.type === import_types.AttributeType.MULTI_SELECT || !!attribute.is_variant_axis;
|
|
75
|
-
var EditAttributeForm = ({
|
|
76
|
-
productId,
|
|
77
|
-
attribute
|
|
78
|
-
}) => {
|
|
79
|
-
if (attribute.is_scoped) {
|
|
80
|
-
return /* @__PURE__ */ jsx(EditScopedAttributeForm, { productId, attribute });
|
|
81
|
-
}
|
|
82
|
-
return /* @__PURE__ */ jsx(EditCatalogAttributeForm, { productId, attribute });
|
|
83
|
-
};
|
|
84
|
-
var AttributeWarning = () => {
|
|
85
|
-
const { t } = useTranslation();
|
|
86
|
-
return /* @__PURE__ */ jsx(
|
|
87
|
-
InlineTip,
|
|
88
|
-
{
|
|
89
|
-
variant: "warning",
|
|
90
|
-
label: t("products.create.attributes.warning"),
|
|
91
|
-
children: t("products.create.attributes.editWarning")
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
var VariantAxisTip = () => {
|
|
96
|
-
const { t } = useTranslation();
|
|
97
|
-
return /* @__PURE__ */ jsx(InlineTip, { label: t("products.create.attributes.tip"), children: t("products.create.attributes.editVariantAxisTip") });
|
|
98
|
-
};
|
|
99
|
-
var EditScopedAttributeForm = ({
|
|
100
|
-
productId,
|
|
101
|
-
attribute
|
|
102
|
-
}) => {
|
|
103
|
-
const { t } = useTranslation();
|
|
104
|
-
const { handleSuccess } = useRouteModal();
|
|
105
|
-
const isAxis = isVariantAxis(attribute);
|
|
106
|
-
const currentValues = attribute.values ?? attribute.all_values ?? [];
|
|
107
|
-
const schema = zod.object({
|
|
108
|
-
title: zod.string().trim().min(1, { message: t("products.create.attributes.errors.titleRequired") }),
|
|
109
|
-
values: zod.union([zod.string(), zod.array(zod.string())]).refine(
|
|
110
|
-
(v) => Array.isArray(v) ? v.length > 0 : v.trim().length > 0,
|
|
111
|
-
{ message: t("products.create.attributes.errors.valuesRequired") }
|
|
112
|
-
)
|
|
113
|
-
});
|
|
114
|
-
const form = useForm({
|
|
115
|
-
defaultValues: {
|
|
116
|
-
title: attribute.name,
|
|
117
|
-
values: isAxis ? currentValues.map((v) => v.name) : currentValues[0]?.name ?? ""
|
|
118
|
-
},
|
|
119
|
-
resolver: zodResolver(schema)
|
|
120
|
-
});
|
|
121
|
-
const { mutateAsync, isPending } = useBatchProductAttributes(productId);
|
|
122
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
123
|
-
const title = data.title.trim() !== attribute.name ? data.title.trim() : void 0;
|
|
124
|
-
let payload;
|
|
125
|
-
if (isAxis) {
|
|
126
|
-
const newNames = (Array.isArray(data.values) ? data.values : []).map((v) => v.trim()).filter(Boolean);
|
|
127
|
-
const byName = new Map(currentValues.map((v) => [v.name, v.id]));
|
|
128
|
-
const add = newNames.filter((name) => !byName.has(name)).map((value) => ({ value }));
|
|
129
|
-
const remove = currentValues.filter((v) => !newNames.includes(v.name)).map((v) => v.id);
|
|
130
|
-
payload = {
|
|
131
|
-
update: [{ id: attribute.id, title, add, remove }]
|
|
132
|
-
};
|
|
133
|
-
} else {
|
|
134
|
-
const value = Array.isArray(data.values) ? data.values[0] ?? "" : data.values;
|
|
135
|
-
payload = {
|
|
136
|
-
update: [{ id: attribute.id, title, value }]
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
await mutateAsync(payload, {
|
|
140
|
-
onSuccess: () => handleSuccess(),
|
|
141
|
-
onError: (error) => toast.error(error.message)
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
|
|
145
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
146
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-component shadow-elevation-card-rest rounded-xl p-1.5", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[min-content,1fr] items-start gap-1.5", children: [
|
|
147
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx(
|
|
148
|
-
Label,
|
|
149
|
-
{
|
|
150
|
-
size: "xsmall",
|
|
151
|
-
weight: "plus",
|
|
152
|
-
className: "text-ui-fg-subtle",
|
|
153
|
-
children: t("fields.title")
|
|
154
|
-
}
|
|
155
|
-
) }),
|
|
156
|
-
/* @__PURE__ */ jsx(
|
|
157
|
-
Form.Field,
|
|
158
|
-
{
|
|
159
|
-
control: form.control,
|
|
160
|
-
name: "title",
|
|
161
|
-
render: ({ field, fieldState }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
162
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
163
|
-
Input,
|
|
164
|
-
{
|
|
165
|
-
...field,
|
|
166
|
-
"aria-invalid": fieldState.invalid ? "true" : void 0,
|
|
167
|
-
className: fieldState.invalid ? "bg-ui-bg-field-component shadow-borders-error focus:shadow-borders-error" : "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover",
|
|
168
|
-
"data-testid": "edit-attribute-title-input"
|
|
169
|
-
}
|
|
170
|
-
) }),
|
|
171
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
172
|
-
] })
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center px-2 py-1.5", children: /* @__PURE__ */ jsx(
|
|
176
|
-
Label,
|
|
177
|
-
{
|
|
178
|
-
size: "xsmall",
|
|
179
|
-
weight: "plus",
|
|
180
|
-
className: "text-ui-fg-subtle",
|
|
181
|
-
children: t("fields.values")
|
|
182
|
-
}
|
|
183
|
-
) }),
|
|
184
|
-
/* @__PURE__ */ jsx(
|
|
185
|
-
Form.Field,
|
|
186
|
-
{
|
|
187
|
-
control: form.control,
|
|
188
|
-
name: "values",
|
|
189
|
-
render: ({ field: { onChange, value }, fieldState }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
190
|
-
/* @__PURE__ */ jsx(Form.Control, { children: isAxis ? /* @__PURE__ */ jsx(
|
|
191
|
-
ChipInput,
|
|
192
|
-
{
|
|
193
|
-
variant: "contrast",
|
|
194
|
-
value: Array.isArray(value) ? value : [],
|
|
195
|
-
onChange,
|
|
196
|
-
"aria-invalid": fieldState.invalid ? "true" : void 0,
|
|
197
|
-
className: fieldState.invalid ? "shadow-borders-error focus-within:!shadow-borders-error" : void 0,
|
|
198
|
-
placeholder: t(
|
|
199
|
-
"products.create.attributes.valuePlaceholder"
|
|
200
|
-
)
|
|
201
|
-
}
|
|
202
|
-
) : /* @__PURE__ */ jsx(
|
|
203
|
-
AttributeValueInput,
|
|
204
|
-
{
|
|
205
|
-
type: attribute.type,
|
|
206
|
-
value,
|
|
207
|
-
onChange,
|
|
208
|
-
placeholder: t(
|
|
209
|
-
"products.create.attributes.valuePlaceholder"
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
) }),
|
|
213
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
214
|
-
] })
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
] }) }),
|
|
218
|
-
isAxis && /* @__PURE__ */ jsx(VariantAxisTip, {}),
|
|
219
|
-
/* @__PURE__ */ jsx(AttributeWarning, {})
|
|
220
|
-
] }) }),
|
|
221
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
222
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
|
|
223
|
-
/* @__PURE__ */ jsx(
|
|
224
|
-
Button,
|
|
225
|
-
{
|
|
226
|
-
size: "small",
|
|
227
|
-
type: "submit",
|
|
228
|
-
isLoading: isPending,
|
|
229
|
-
"data-testid": "edit-attribute-submit-button",
|
|
230
|
-
children: t("actions.save")
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
] }) })
|
|
234
|
-
] }) });
|
|
235
|
-
};
|
|
236
|
-
var EditCatalogAttributeForm = ({
|
|
237
|
-
productId,
|
|
238
|
-
attribute
|
|
239
|
-
}) => {
|
|
240
|
-
const { t } = useTranslation();
|
|
241
|
-
const { handleSuccess } = useRouteModal();
|
|
242
|
-
const { feature_flags } = useFeatureFlags();
|
|
243
|
-
const isProductRequestEnabled = !!feature_flags?.[import_types.MercurFeatureFlags.PRODUCT_REQUEST];
|
|
244
|
-
const isAxis = isVariantAxis(attribute);
|
|
245
|
-
const hasPresetValues = attribute.type === import_types.AttributeType.SINGLE_SELECT || attribute.type === import_types.AttributeType.MULTI_SELECT;
|
|
246
|
-
const labelTooltip = attribute.description || (attribute.is_required ? t("products.create.attributes.requiredTooltip") : void 0);
|
|
247
|
-
const initialValues = (() => {
|
|
248
|
-
const selected = attribute.values ?? [];
|
|
249
|
-
if (attribute.type === import_types.AttributeType.MULTI_SELECT) {
|
|
250
|
-
return selected.map((v) => v.name);
|
|
251
|
-
}
|
|
252
|
-
return selected[0]?.name ?? "";
|
|
253
|
-
})();
|
|
254
|
-
const schema = zod.object({
|
|
255
|
-
values: zod.union([zod.string(), zod.array(zod.string())]).refine(
|
|
256
|
-
(v) => Array.isArray(v) ? v.length > 0 : v.trim().length > 0,
|
|
257
|
-
{ message: t("products.create.attributes.errors.valuesRequired") }
|
|
258
|
-
)
|
|
259
|
-
});
|
|
260
|
-
const form = useForm({
|
|
261
|
-
defaultValues: { values: initialValues },
|
|
262
|
-
resolver: zodResolver(schema)
|
|
263
|
-
});
|
|
264
|
-
const { mutateAsync, isPending } = useBatchProductAttributes(productId);
|
|
265
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
266
|
-
const vals = Array.isArray(data.values) ? data.values : [data.values].filter((s) => s.trim().length > 0);
|
|
267
|
-
let payload;
|
|
268
|
-
if (hasPresetValues) {
|
|
269
|
-
const selectedIds = (attribute.all_values ?? []).filter((v) => vals.includes(v.name)).map((v) => v.id);
|
|
270
|
-
if (attribute.is_variant_axis) {
|
|
271
|
-
const currentIds = (attribute.values ?? []).map((v) => v.id);
|
|
272
|
-
const add = selectedIds.filter((id) => !currentIds.includes(id));
|
|
273
|
-
const remove = currentIds.filter((id) => !selectedIds.includes(id));
|
|
274
|
-
payload = { update: [{ id: attribute.id, add, remove }] };
|
|
275
|
-
} else {
|
|
276
|
-
payload = {
|
|
277
|
-
remove: [attribute.id],
|
|
278
|
-
add: [{ id: attribute.id, value_ids: selectedIds }]
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
payload = {
|
|
283
|
-
update: [
|
|
284
|
-
{
|
|
285
|
-
id: attribute.id,
|
|
286
|
-
value: attribute.type === import_types.AttributeType.TOGGLE ? vals[0] === "true" : vals[0]
|
|
287
|
-
}
|
|
288
|
-
]
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
await mutateAsync(payload, {
|
|
292
|
-
onSuccess: () => {
|
|
293
|
-
handleSuccess();
|
|
294
|
-
toast.success(
|
|
295
|
-
isProductRequestEnabled ? t("products.edit.requestSuccessToast") : t("products.edit.attributes.updateSuccessToast")
|
|
296
|
-
);
|
|
297
|
-
},
|
|
298
|
-
onError: (error) => toast.error(error.message)
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { onSubmit: handleSubmit, className: "flex h-full flex-col", children: [
|
|
302
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
303
|
-
/* @__PURE__ */ jsx(
|
|
304
|
-
Form.Field,
|
|
305
|
-
{
|
|
306
|
-
control: form.control,
|
|
307
|
-
name: "values",
|
|
308
|
-
render: ({ field: { onChange, value } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
309
|
-
/* @__PURE__ */ jsx(Form.Label, { tooltip: labelTooltip, children: attribute.name }),
|
|
310
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
311
|
-
AttributeValueInput,
|
|
312
|
-
{
|
|
313
|
-
type: attribute.type,
|
|
314
|
-
value,
|
|
315
|
-
onChange,
|
|
316
|
-
availableValues: attribute.all_values ?? []
|
|
317
|
-
}
|
|
318
|
-
) }),
|
|
319
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {}),
|
|
320
|
-
isAxis && /* @__PURE__ */ jsx(VariantAxisTip, {})
|
|
321
|
-
] })
|
|
322
|
-
}
|
|
323
|
-
),
|
|
324
|
-
/* @__PURE__ */ jsx(AttributeWarning, {})
|
|
325
|
-
] }) }),
|
|
326
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
327
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
|
|
328
|
-
/* @__PURE__ */ jsx(
|
|
329
|
-
Button,
|
|
330
|
-
{
|
|
331
|
-
size: "small",
|
|
332
|
-
type: "submit",
|
|
333
|
-
isLoading: isPending,
|
|
334
|
-
"data-testid": "edit-attribute-submit-button",
|
|
335
|
-
children: t("actions.save")
|
|
336
|
-
}
|
|
337
|
-
)
|
|
338
|
-
] }) })
|
|
339
|
-
] }) });
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// src/pages/products/[id]/attributes/[attribute_id]/edit/index.tsx
|
|
343
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
344
|
-
var Component = () => {
|
|
345
|
-
const { id, attribute_id } = useParams();
|
|
346
|
-
const { t } = useTranslation2();
|
|
347
|
-
const query = useLinkQuery("product", PRODUCT_DETAIL_QUERY.fields);
|
|
348
|
-
const { product, isLoading, isError, error } = useProduct(id, query);
|
|
349
|
-
if (isError) {
|
|
350
|
-
throw error;
|
|
351
|
-
}
|
|
352
|
-
const attribute = product?.attributes?.find(
|
|
353
|
-
(a) => a.id === attribute_id
|
|
354
|
-
);
|
|
355
|
-
const ready = !isLoading && !!product && !!attribute;
|
|
356
|
-
return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
|
|
357
|
-
/* @__PURE__ */ jsxs2(RouteDrawer.Header, { children: [
|
|
358
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx2(Heading, { children: t("products.editAttribute") }) }),
|
|
359
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Description, { className: "sr-only", children: t("products.editAttributeHint") })
|
|
360
|
-
] }),
|
|
361
|
-
ready && /* @__PURE__ */ jsx2(EditAttributeForm, { productId: id, attribute })
|
|
362
|
-
] });
|
|
363
|
-
};
|
|
364
|
-
export {
|
|
365
|
-
Component
|
|
366
|
-
};
|
package/dist/edit-P6YZBA32.js
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeprecatedPercentageInput
|
|
3
|
-
} from "./chunk-MAEP2UCK.js";
|
|
4
|
-
import "./chunk-TKGWSUEI.js";
|
|
5
|
-
import {
|
|
6
|
-
KeyboundForm
|
|
7
|
-
} from "./chunk-SITRHMZZ.js";
|
|
8
|
-
import {
|
|
9
|
-
RouteDrawer,
|
|
10
|
-
useRouteModal
|
|
11
|
-
} from "./chunk-GDWBOQI5.js";
|
|
12
|
-
import {
|
|
13
|
-
Form
|
|
14
|
-
} from "./chunk-3QSRE5LS.js";
|
|
15
|
-
import {
|
|
16
|
-
usePromotion,
|
|
17
|
-
useUpdatePromotion
|
|
18
|
-
} from "./chunk-MR6REQKT.js";
|
|
19
|
-
import "./chunk-RHKRREUU.js";
|
|
20
|
-
import "./chunk-ZA2KFUFR.js";
|
|
21
|
-
import "./chunk-DTGEFKK4.js";
|
|
22
|
-
import "./chunk-NBMM2TZK.js";
|
|
23
|
-
|
|
24
|
-
// src/pages/promotions/[id]/edit/index.tsx
|
|
25
|
-
import { Heading } from "@medusajs/ui";
|
|
26
|
-
import { useLinkQuery } from "@mercurjs/dashboard-shared";
|
|
27
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
28
|
-
import { useParams } from "react-router-dom";
|
|
29
|
-
|
|
30
|
-
// src/pages/promotions/[id]/edit/edit-promotion-form/edit-promotion-details-form.tsx
|
|
31
|
-
import { Button, Input, RadioGroup, Text } from "@medusajs/ui";
|
|
32
|
-
import { Trans, useTranslation } from "react-i18next";
|
|
33
|
-
import * as zod from "zod";
|
|
34
|
-
import {
|
|
35
|
-
FormExtensionZone,
|
|
36
|
-
useExtendableForm
|
|
37
|
-
} from "@mercurjs/dashboard-shared";
|
|
38
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
|
-
var EditPromotionSchema = zod.object({
|
|
40
|
-
is_automatic: zod.string().toLowerCase(),
|
|
41
|
-
code: zod.string().min(1),
|
|
42
|
-
status: zod.enum(["active", "inactive", "draft"]),
|
|
43
|
-
value_type: zod.enum(["fixed", "percentage"]),
|
|
44
|
-
value: zod.number(),
|
|
45
|
-
max_quantity: zod.number().min(1).optional().nullable()
|
|
46
|
-
});
|
|
47
|
-
var EditPromotionDetailsForm = ({ promotion }) => {
|
|
48
|
-
const { t } = useTranslation();
|
|
49
|
-
const { handleSuccess } = useRouteModal();
|
|
50
|
-
const form = useExtendableForm({
|
|
51
|
-
schema: EditPromotionSchema,
|
|
52
|
-
model: "promotion",
|
|
53
|
-
zone: "edit",
|
|
54
|
-
data: promotion,
|
|
55
|
-
defaultValues: {
|
|
56
|
-
is_automatic: promotion.is_automatic.toString(),
|
|
57
|
-
code: promotion.code,
|
|
58
|
-
status: promotion.status,
|
|
59
|
-
value: promotion.application_method.value,
|
|
60
|
-
value_type: promotion.application_method.type,
|
|
61
|
-
max_quantity: promotion.application_method?.max_quantity ?? 1
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const { mutateAsync, isPending } = useUpdatePromotion(promotion.id);
|
|
65
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
66
|
-
await mutateAsync(
|
|
67
|
-
{
|
|
68
|
-
is_automatic: data.is_automatic === "true",
|
|
69
|
-
code: data.code,
|
|
70
|
-
status: data.status,
|
|
71
|
-
application_method: {
|
|
72
|
-
value: data.value,
|
|
73
|
-
max_quantity: data.max_quantity
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
onSuccess: () => {
|
|
78
|
-
handleSuccess();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
84
|
-
KeyboundForm,
|
|
85
|
-
{
|
|
86
|
-
onSubmit: handleSubmit,
|
|
87
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-8", children: [
|
|
90
|
-
/* @__PURE__ */ jsx(
|
|
91
|
-
Form.Field,
|
|
92
|
-
{
|
|
93
|
-
control: form.control,
|
|
94
|
-
name: "status",
|
|
95
|
-
render: ({ field }) => {
|
|
96
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
97
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.status.label") }),
|
|
98
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
99
|
-
RadioGroup,
|
|
100
|
-
{
|
|
101
|
-
className: "flex-col gap-y-3",
|
|
102
|
-
...field,
|
|
103
|
-
value: field.value,
|
|
104
|
-
onValueChange: field.onChange,
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ jsx(
|
|
107
|
-
RadioGroup.ChoiceBox,
|
|
108
|
-
{
|
|
109
|
-
value: "draft",
|
|
110
|
-
label: t("promotions.form.status.draft.title"),
|
|
111
|
-
description: t("promotions.form.status.draft.description")
|
|
112
|
-
}
|
|
113
|
-
),
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
RadioGroup.ChoiceBox,
|
|
116
|
-
{
|
|
117
|
-
value: "active",
|
|
118
|
-
label: t("promotions.form.status.active.title"),
|
|
119
|
-
description: t("promotions.form.status.active.description")
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
/* @__PURE__ */ jsx(
|
|
123
|
-
RadioGroup.ChoiceBox,
|
|
124
|
-
{
|
|
125
|
-
value: "inactive",
|
|
126
|
-
label: t("promotions.form.status.inactive.title"),
|
|
127
|
-
description: t("promotions.form.status.inactive.description")
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
) }),
|
|
133
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
134
|
-
] });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
/* @__PURE__ */ jsx(
|
|
139
|
-
Form.Field,
|
|
140
|
-
{
|
|
141
|
-
control: form.control,
|
|
142
|
-
name: "is_automatic",
|
|
143
|
-
render: ({ field }) => {
|
|
144
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
145
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.method.label") }),
|
|
146
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
147
|
-
RadioGroup,
|
|
148
|
-
{
|
|
149
|
-
className: "flex-col gap-y-3",
|
|
150
|
-
...field,
|
|
151
|
-
value: field.value,
|
|
152
|
-
onValueChange: field.onChange,
|
|
153
|
-
children: [
|
|
154
|
-
/* @__PURE__ */ jsx(
|
|
155
|
-
RadioGroup.ChoiceBox,
|
|
156
|
-
{
|
|
157
|
-
value: "false",
|
|
158
|
-
label: t("promotions.form.method.code.title"),
|
|
159
|
-
description: t("promotions.form.method.code.description")
|
|
160
|
-
}
|
|
161
|
-
),
|
|
162
|
-
/* @__PURE__ */ jsx(
|
|
163
|
-
RadioGroup.ChoiceBox,
|
|
164
|
-
{
|
|
165
|
-
value: "true",
|
|
166
|
-
label: t("promotions.form.method.automatic.title"),
|
|
167
|
-
description: t("promotions.form.method.automatic.description")
|
|
168
|
-
}
|
|
169
|
-
)
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
) }),
|
|
173
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
174
|
-
] });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
179
|
-
/* @__PURE__ */ jsx(
|
|
180
|
-
Form.Field,
|
|
181
|
-
{
|
|
182
|
-
control: form.control,
|
|
183
|
-
name: "code",
|
|
184
|
-
render: ({ field }) => {
|
|
185
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
186
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.code.title") }),
|
|
187
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) })
|
|
188
|
-
] });
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ jsx(
|
|
193
|
-
Text,
|
|
194
|
-
{
|
|
195
|
-
size: "small",
|
|
196
|
-
leading: "compact",
|
|
197
|
-
className: "text-ui-fg-subtle",
|
|
198
|
-
children: /* @__PURE__ */ jsx(
|
|
199
|
-
Trans,
|
|
200
|
-
{
|
|
201
|
-
t,
|
|
202
|
-
i18nKey: "promotions.form.code.description",
|
|
203
|
-
components: [/* @__PURE__ */ jsx("br", {}, "break")]
|
|
204
|
-
}
|
|
205
|
-
)
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
] }),
|
|
209
|
-
/* @__PURE__ */ jsx(
|
|
210
|
-
Form.Field,
|
|
211
|
-
{
|
|
212
|
-
control: form.control,
|
|
213
|
-
name: "value",
|
|
214
|
-
render: ({ field: { onChange, ...field } }) => {
|
|
215
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
216
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("fields.percentage") }),
|
|
217
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
218
|
-
DeprecatedPercentageInput,
|
|
219
|
-
{
|
|
220
|
-
min: 0,
|
|
221
|
-
max: 100,
|
|
222
|
-
...field,
|
|
223
|
-
value: field.value || "",
|
|
224
|
-
onChange: (e) => {
|
|
225
|
-
onChange(e.target.value === "" ? null : parseInt(e.target.value));
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
"amount"
|
|
229
|
-
) }),
|
|
230
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
231
|
-
] });
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
promotion.application_method?.allocation === "each" && /* @__PURE__ */ jsx(
|
|
236
|
-
Form.Field,
|
|
237
|
-
{
|
|
238
|
-
control: form.control,
|
|
239
|
-
name: "max_quantity",
|
|
240
|
-
render: () => {
|
|
241
|
-
return /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
242
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("promotions.form.max_quantity.title") }),
|
|
243
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
244
|
-
Input,
|
|
245
|
-
{
|
|
246
|
-
...form.register("max_quantity", {
|
|
247
|
-
valueAsNumber: true
|
|
248
|
-
}),
|
|
249
|
-
type: "number",
|
|
250
|
-
min: 1,
|
|
251
|
-
placeholder: "999"
|
|
252
|
-
}
|
|
253
|
-
) }),
|
|
254
|
-
/* @__PURE__ */ jsx(
|
|
255
|
-
Text,
|
|
256
|
-
{
|
|
257
|
-
size: "small",
|
|
258
|
-
leading: "compact",
|
|
259
|
-
className: "text-ui-fg-subtle",
|
|
260
|
-
children: /* @__PURE__ */ jsx(
|
|
261
|
-
Trans,
|
|
262
|
-
{
|
|
263
|
-
t,
|
|
264
|
-
i18nKey: "promotions.form.max_quantity.description",
|
|
265
|
-
components: [/* @__PURE__ */ jsx("br", {}, "break")]
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
271
|
-
] });
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
),
|
|
275
|
-
/* @__PURE__ */ jsx(
|
|
276
|
-
FormExtensionZone,
|
|
277
|
-
{
|
|
278
|
-
model: "promotion",
|
|
279
|
-
zone: "edit",
|
|
280
|
-
control: form.control,
|
|
281
|
-
data: promotion
|
|
282
|
-
}
|
|
283
|
-
)
|
|
284
|
-
] }) }),
|
|
285
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
286
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
287
|
-
Button,
|
|
288
|
-
{
|
|
289
|
-
size: "small",
|
|
290
|
-
variant: "secondary",
|
|
291
|
-
children: t("actions.cancel")
|
|
292
|
-
}
|
|
293
|
-
) }),
|
|
294
|
-
/* @__PURE__ */ jsx(
|
|
295
|
-
Button,
|
|
296
|
-
{
|
|
297
|
-
size: "small",
|
|
298
|
-
type: "submit",
|
|
299
|
-
isLoading: isPending,
|
|
300
|
-
children: t("actions.save")
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] }) })
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
) });
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// src/pages/promotions/[id]/edit/index.tsx
|
|
310
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
311
|
-
var Component = () => {
|
|
312
|
-
const { id } = useParams();
|
|
313
|
-
const { t } = useTranslation2();
|
|
314
|
-
const linkQuery = useLinkQuery("promotion");
|
|
315
|
-
const { promotion, isLoading, isError, error } = usePromotion(id, linkQuery);
|
|
316
|
-
if (isError) throw error;
|
|
317
|
-
return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
|
|
318
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading, { children: t("promotions.edit.title") }) }),
|
|
319
|
-
!isLoading && promotion && /* @__PURE__ */ jsx2(EditPromotionDetailsForm, { promotion })
|
|
320
|
-
] });
|
|
321
|
-
};
|
|
322
|
-
export {
|
|
323
|
-
Component
|
|
324
|
-
};
|