@mercurjs/admin 2.0.0-canary.39 → 2.0.0-canary.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-campaign-promotions-ZUXBF5G3.js → add-campaign-promotions-7TPECJOT.js} +4 -4
- package/dist/{api-key-management-detail-SKJNAZ5L.js → api-key-management-detail-2EFDWJSF.js} +7 -7
- package/dist/{api-key-management-list-2D4WKI6Y.js → api-key-management-list-UZLHSM2R.js} +6 -5
- package/dist/{api-key-management-sales-channels-C7EWPHC2.js → api-key-management-sales-channels-ER5ZINL7.js} +6 -7
- package/dist/{campaign-create-B7XM2FZM.js → campaign-create-AFR3V7P4.js} +3 -3
- package/dist/{campaign-detail-7U4CQHU5.js → campaign-detail-UUNEZUY7.js} +9 -8
- package/dist/{campaign-list-SC7FLTRM.js → campaign-list-2AAGWYEG.js} +6 -5
- package/dist/category-create-LY45Z7YB.js +23 -0
- package/dist/{category-detail-HGHR3R2R.js → category-detail-AGTIMI6P.js} +7 -6
- package/dist/{category-list-QBBFGHQM.js → category-list-ROM7UTA4.js} +6 -5
- package/dist/{chunk-ENMRRG4N.js → chunk-2AWQ4FPA.js} +6 -6
- package/dist/{chunk-VBAAYYCS.js → chunk-2HPZJCAF.js} +6 -6
- package/dist/{chunk-SFG7JTBH.js → chunk-2LAANNMF.js} +111 -48
- package/dist/{chunk-KYUXTS2L.js → chunk-2UN7CNBG.js} +7 -7
- package/dist/chunk-3LTXCGNM.js +204 -0
- package/dist/{chunk-EDQBUWY7.js → chunk-3NIWL75F.js} +6 -6
- package/dist/{product-create-variant-CJPECBV4.js → chunk-4UTK7DZN.js} +63 -69
- package/dist/{chunk-5VEYNZSW.js → chunk-5322X23U.js} +9 -4
- package/dist/{chunk-U3SFHLUA.js → chunk-53IISBJZ.js} +1 -0
- package/dist/{chunk-DGCPYCHU.js → chunk-54RTJBYO.js} +63 -8
- package/dist/{chunk-E2AAYIHS.js → chunk-5EFOVNK2.js} +3 -3
- package/dist/{chunk-NQPAEBSZ.js → chunk-6E3T6CGY.js} +15 -7
- package/dist/{chunk-V2DXJ75C.js → chunk-6OA7JZ5E.js} +1 -1
- package/dist/chunk-72IQIAGX.js +245 -0
- package/dist/{chunk-3IYIS5UZ.js → chunk-7DOPC5GY.js} +4 -4
- package/dist/{chunk-Q6XCCONH.js → chunk-AI6RJGRQ.js} +9 -9
- package/dist/{price-list-create-OK7YYLAB.js → chunk-AJZQBGE4.js} +193 -428
- package/dist/{chunk-XDVS4B7W.js → chunk-BAV6Y7RC.js} +8 -7
- package/dist/{chunk-4WYBW3HK.js → chunk-BCAT7P6B.js} +3 -3
- package/dist/{chunk-LYT3RI4O.js → chunk-BHYDGWZ6.js} +18 -9
- package/dist/{chunk-DK3U2SRA.js → chunk-BIEYPCHL.js} +5 -5
- package/dist/{product-create-NVBKO426.js → chunk-BLG726FI.js} +36 -68
- package/dist/chunk-BVRI7YAR.js +100 -0
- package/dist/{chunk-2IGCU3KP.js → chunk-DOMRLXOI.js} +2 -2
- package/dist/{chunk-K6FXWZ2M.js → chunk-F55UXYYA.js} +10 -0
- package/dist/{chunk-AOVEX4EM.js → chunk-FNXSMFGL.js} +5 -5
- package/dist/{chunk-IXGP2EEN.js → chunk-FYAYHOCN.js} +2 -3
- package/dist/{chunk-QBOXELB5.js → chunk-GJHAVFXL.js} +4 -4
- package/dist/{price-list-prices-add-7PGUONDK.js → chunk-GOVOSXUU.js} +90 -290
- package/dist/{chunk-66IHH2HG.js → chunk-H6W6Q6YE.js} +3 -3
- package/dist/{seller-details-KROISMQC.js → chunk-HVLQFQGD.js} +74 -146
- package/dist/{chunk-QD6KYDYH.js → chunk-I6R4I7EF.js} +6 -6
- package/dist/{chunk-RIMR3ULR.js → chunk-ISYWL6RZ.js} +64 -33
- package/dist/{chunk-HHNJNKCB.js → chunk-KMUEJ3IE.js} +59 -20
- package/dist/{chunk-GJTIHFXG.js → chunk-KOILMFJX.js} +29 -31
- package/dist/{chunk-3SAH3NUS.js → chunk-LIXRNUG5.js} +1 -1
- package/dist/chunk-LOJD5572.js +433 -0
- package/dist/{chunk-T25UE7SS.js → chunk-MD56QRKC.js} +6 -6
- package/dist/{chunk-S4QUEQQK.js → chunk-MSFNMGFD.js} +48 -48
- package/dist/{chunk-YH4VQBAA.js → chunk-MX52GGQO.js} +81 -52
- package/dist/{chunk-O6O22BN4.js → chunk-N7BCAAJC.js} +113 -48
- package/dist/{chunk-JA2XIIIZ.js → chunk-NXKCVD5F.js} +6 -5
- package/dist/{chunk-G4QMLQF2.js → chunk-NZN7PFPB.js} +2 -4
- package/dist/{chunk-KUDLPUWR.js → chunk-OFWYMU6K.js} +8 -8
- package/dist/chunk-OOAY7PAK.js +1155 -0
- package/dist/chunk-PAQH5QQH.js +685 -0
- package/dist/{chunk-3H74EI2D.js → chunk-POCHIWE2.js} +100 -40
- package/dist/chunk-PXBCTPQO.js +248 -0
- package/dist/chunk-QSZ2FIM2.js +223 -0
- package/dist/{chunk-23663A2W.js → chunk-R5VKVG6S.js} +1 -1
- package/dist/{chunk-DP5U3GQU.js → chunk-RXUUBJSZ.js} +1 -1
- package/dist/{chunk-FYB5MS4F.js → chunk-S2GARTQU.js} +6 -6
- package/dist/{chunk-7TLEUIAL.js → chunk-SO6PXIPV.js} +21 -16
- package/dist/{category-create-UWBJGIED.js → chunk-ST74PSEZ.js} +78 -149
- package/dist/{chunk-33FUPXJL.js → chunk-T3OYE2MH.js} +4 -4
- package/dist/{chunk-JRWB7VWP.js → chunk-U4RMXPGI.js} +8 -8
- package/dist/{chunk-YGSM5PVN.js → chunk-UI2BJVP5.js} +1 -1
- package/dist/{chunk-FXU7SL6M.js → chunk-UOIUQC3P.js} +25 -15
- package/dist/{chunk-ZU2RNSCP.js → chunk-UONTDHRH.js} +4 -2
- package/dist/{chunk-J7SR4GW5.js → chunk-V3SHSLK4.js} +4 -4
- package/dist/{chunk-TE5VQBCL.js → chunk-V42ZR4XW.js} +8 -9
- package/dist/chunk-V5J73NPW.js +117 -0
- package/dist/{chunk-QP6XXG6A.js → chunk-VOFAM7HJ.js} +74 -42
- package/dist/{chunk-CR4E2DCR.js → chunk-VT3RBTYK.js} +3 -3
- package/dist/{chunk-AOVJTW7M.js → chunk-VWQYMOBM.js} +9 -9
- package/dist/{chunk-6L2LSIPR.js → chunk-VXAQZ2ZZ.js} +4 -4
- package/dist/{chunk-OSHCUDYY.js → chunk-X3KBQBGW.js} +6 -6
- package/dist/{chunk-WZADCDDE.js → chunk-X56THFPA.js} +2 -1
- package/dist/{chunk-HZKW7HRU.js → chunk-X7NWBH7T.js} +64 -35
- package/dist/{chunk-OFRQZHVQ.js → chunk-XE5ZMNUN.js} +6 -6
- package/dist/{chunk-4GVHNYZR.js → chunk-XHVYNMTA.js} +2 -2
- package/dist/{chunk-U2UCL2VG.js → chunk-XIZLPYEE.js} +3 -111
- package/dist/{chunk-KXPCEVFB.js → chunk-XOKRMMVP.js} +6 -6
- package/dist/{chunk-XVKRTPVM.js → chunk-Y5N26ZC3.js} +41 -15
- package/dist/{chunk-A6Z2Q7D5.js → chunk-Z2MDPTF2.js} +4 -2
- package/dist/{chunk-TKGZBTOS.js → chunk-ZFSZTRZ6.js} +54 -32
- package/dist/{chunk-RV6NZTNP.js → chunk-ZZEAWVFX.js} +27 -27
- package/dist/{collection-detail-YJ3FV2C6.js → collection-detail-SRR3HSIV.js} +7 -6
- package/dist/{collection-list-WDQOBHQN.js → collection-list-MKISW5S4.js} +6 -5
- package/dist/{commission-rate-detail-UQDIIMIK.js → commission-rate-detail-GLB733F3.js} +5 -4
- package/dist/{commission-rate-list-WTDZLKUR.js → commission-rate-list-5V3FQROA.js} +6 -5
- package/dist/{customer-detail-N7CS4IJU.js → customer-detail-SBQF232S.js} +4 -3
- package/dist/customer-group-add-customers-LCNDTLXR.js +1 -1
- package/dist/{customer-group-detail-UCTY4FF7.js → customer-group-detail-QQSNRM2K.js} +6 -5
- package/dist/{customer-group-list-XOQ64CVR.js → customer-group-list-IO7SVK3F.js} +15 -6
- package/dist/{customer-list-BUUO6OF7.js → customer-list-TXBAME4V.js} +4 -3
- package/dist/customers-add-customer-group-BKEV24N2.js +1 -1
- package/dist/index.d.ts +225 -16
- package/dist/index.js +581 -387
- package/dist/inventory-create-Q4JIXZTT.js +56 -0
- package/dist/{inventory-detail-BJT5WEV5.js → inventory-detail-3D37JWQT.js} +7 -6
- package/dist/{inventory-list-3LWBPWVK.js → inventory-list-WH42ADNB.js} +6 -5
- package/dist/{inventory-stock-G3GP4FZX.js → inventory-stock-DTKOGYT7.js} +6 -6
- package/dist/{location-detail-N7J6PEAP.js → location-detail-2SSHXSKL.js} +5 -4
- package/dist/location-fulfillment-providers-BHCY2MYC.js +1 -1
- package/dist/{location-list-UG6B47NP.js → location-list-LPISOSQI.js} +5 -4
- package/dist/{location-sales-channels-3IGHCJEN.js → location-sales-channels-PPH53OHD.js} +6 -7
- package/dist/location-service-zone-shipping-option-create-GSXLVEGO.js +57 -0
- package/dist/{location-service-zone-shipping-option-pricing-7VMPXDWX.js → location-service-zone-shipping-option-pricing-4CTGXBP3.js} +6 -6
- package/dist/marketplace-add-currencies-CIGOPBO6.js +1 -1
- package/dist/{marketplace-detail-7KJMXXAJ.js → marketplace-detail-3CBLIYVK.js} +6 -5
- package/dist/{order-detail-C25NQSZN.js → order-detail-AJV2PE7J.js} +7 -6
- package/dist/{order-edit-billing-address-NVRMPZEU.js → order-edit-billing-address-QQUPIC2H.js} +6 -6
- package/dist/{order-list-7NH7LROU.js → order-list-VPQOG5WE.js} +6 -5
- package/dist/pages/index.d.ts +2608 -82
- package/dist/pages/index.js +238 -156
- package/dist/{payout-detail-MDD5SRK5.js → payout-detail-PMR26YQI.js} +5 -4
- package/dist/{payout-list-XY2A5KYS.js → payout-list-DMG7MQM7.js} +6 -4
- package/dist/price-list-configuration-XK3IZLLX.js +1 -1
- package/dist/price-list-create-QS6CVEWS.js +76 -0
- package/dist/{price-list-detail-IGFSM77P.js → price-list-detail-IO5ZURVW.js} +7 -6
- package/dist/{price-list-list-TBXQ5DOS.js → price-list-list-B3FKB46L.js} +6 -5
- package/dist/price-list-prices-add-NSAQWBT6.js +71 -0
- package/dist/{price-list-prices-edit-QVGBT6AI.js → price-list-prices-edit-UOAIOS5X.js} +6 -6
- package/dist/product-create-UVKMOKRF.js +68 -0
- package/dist/product-create-variant-TCXDJ425.js +53 -0
- package/dist/{product-detail-ZC37BGPC.js → product-detail-273ME23P.js} +4 -4
- package/dist/{product-list-635ZXM2D.js → product-list-2ZHLFSBI.js} +5 -4
- package/dist/{product-media-ZMDAVPGI.js → product-media-YMFP6Q6A.js} +3 -3
- package/dist/{product-prices-WMRIC7WM.js → product-prices-X6JO3Y5A.js} +5 -5
- package/dist/{product-sales-channels-LSN5DVWZ.js → product-sales-channels-2PVBPK6W.js} +2 -3
- package/dist/{product-stock-HF42WRSC.js → product-stock-ARRFHDSU.js} +6 -6
- package/dist/{product-tag-detail-OJLYO3Q5.js → product-tag-detail-545AVFGA.js} +7 -6
- package/dist/{product-tag-list-XFHGJBRF.js → product-tag-list-2Y2Q7K3A.js} +7 -6
- package/dist/{product-type-detail-J4UA4AEM.js → product-type-detail-PBP572AM.js} +7 -6
- package/dist/{product-type-list-H5EQHCXS.js → product-type-list-XWNUKETZ.js} +6 -5
- package/dist/{product-variant-detail-5WKYURFA.js → product-variant-detail-RJUQWBYH.js} +4 -3
- package/dist/{profile-detail-EYNXOHGZ.js → profile-detail-H22ZBNOB.js} +5 -4
- package/dist/{promotion-add-campaign-B5SF72KC.js → promotion-add-campaign-5LCKEU6H.js} +3 -3
- package/dist/promotion-create-KXBEHXPK.js +54 -0
- package/dist/{promotion-detail-MVFOMS4E.js → promotion-detail-NZZ2HII7.js} +7 -6
- package/dist/{promotion-list-IN4VWEQN.js → promotion-list-KARWNOAQ.js} +9 -8
- package/dist/{refund-reason-list-DJZZC7KK.js → refund-reason-list-GTZQBZ7R.js} +3 -2
- package/dist/{region-detail-OFZHX57G.js → region-detail-3OPMLS4V.js} +5 -4
- package/dist/{region-list-L4FKHVJJ.js → region-list-542EMW5C.js} +6 -5
- package/dist/{reservation-detail-LZYEM5NW.js → reservation-detail-IPGIBQW4.js} +5 -4
- package/dist/{reservation-list-OGPDB7WG.js → reservation-list-CEFKMB2G.js} +6 -5
- package/dist/{reset-password-Q7Y4FWRE.js → reset-password-R5ULRWEM.js} +1 -1
- package/dist/{return-reason-list-6ICMSVKF.js → return-reason-list-S7LU655M.js} +5 -4
- package/dist/{sales-channel-detail-RRJG7U7R.js → sales-channel-detail-QCJ6OC3H.js} +7 -6
- package/dist/{sales-channel-list-LUZ4ZXCY.js → sales-channel-list-KYNBWXUD.js} +7 -7
- package/dist/seller-details-A7TYGP67.js +104 -0
- package/dist/{seller-list-664H4SI5.js → seller-list-5KPNNC2B.js} +7 -6
- package/dist/{shipping-option-type-detail-2RY3NHRO.js → shipping-option-type-detail-OBYOZZWS.js} +5 -4
- package/dist/{shipping-option-type-list-IOSOE33S.js → shipping-option-type-list-UGVMQ3DC.js} +6 -5
- package/dist/{shipping-profile-detail-RIIAX7VE.js → shipping-profile-detail-RYOFRMLH.js} +5 -4
- package/dist/{shipping-profiles-list-AL4EJSJY.js → shipping-profiles-list-XJGQ7AVX.js} +5 -4
- package/dist/{tax-region-create-UOTLTCOP.js → tax-region-create-AR2LNF2G.js} +6 -6
- package/dist/{tax-region-detail-CA2W5W6A.js → tax-region-detail-PIGY5JQ7.js} +7 -6
- package/dist/{tax-region-list-JTZ7KZCX.js → tax-region-list-AMGZWUAI.js} +6 -5
- package/dist/{tax-region-province-detail-ZHLX4FF4.js → tax-region-province-detail-D3R4FJT4.js} +6 -5
- package/dist/types-DUhfb5tH.d.ts +30 -0
- package/dist/{user-detail-YNPBC5MN.js → user-detail-H66ZAR7W.js} +5 -4
- package/dist/{user-list-LNTZNT3D.js → user-list-HIUXLIJV.js} +5 -4
- package/package.json +3 -3
- package/dist/chunk-62ZRA6BZ.js +0 -216
- package/dist/chunk-6PNMR6XP.js +0 -192
- package/dist/chunk-7COSFMM7.js +0 -163
- package/dist/chunk-A2KURGQO.js +0 -151
- package/dist/chunk-BHID7W3U.js +0 -78
- package/dist/chunk-UKLRBS4W.js +0 -61
- package/dist/inventory-create-QLEIHESO.js +0 -620
- package/dist/location-service-zone-shipping-option-create-GYPW6SSN.js +0 -811
- package/dist/promotion-create-D77SANLX.js +0 -1262
- package/dist/{adjust-inventory-HZCWL6SC.js → adjust-inventory-WL7D7TQR.js} +3 -3
- package/dist/{campaign-budget-edit-AIXCDGG3.js → campaign-budget-edit-722ECPRI.js} +3 -3
- package/dist/{category-products-XLCG2JR7.js → category-products-H3VFYGOU.js} +2 -2
- package/dist/{chunk-DEKJJ7NG.js → chunk-OFCUTNGV.js} +3 -3
- package/dist/{chunk-KUWNYCGL.js → chunk-U3OWJE7V.js} +0 -0
- package/dist/{collection-add-products-IQ7M63BA.js → collection-add-products-BQ2FZKR4.js} +1 -1
- package/dist/{commission-rate-create-VC72GTV4.js → commission-rate-create-GFQNADQS.js} +9 -9
- package/dist/{commission-rate-edit-AXJKJNFY.js → commission-rate-edit-A2BFZUEI.js} +9 -9
- package/dist/{location-service-zone-shipping-option-edit-E3GN4ZF5.js → location-service-zone-shipping-option-edit-KPECMUYB.js} +3 -3
- package/dist/{order-create-claim-7WW6MXTT.js → order-create-claim-IWTV2HKL.js} +6 -6
- package/dist/{order-create-edit-KAH6ZPLX.js → order-create-edit-H2MHZFIW.js} +5 -5
- package/dist/{order-create-exchange-ELLWF3IY.js → order-create-exchange-PPMRSGLD.js} +6 -6
- package/dist/{order-create-refund-5QZBOSCA.js → order-create-refund-LZOHRL7T.js} +3 -3
- package/dist/{order-create-return-L6DEDPJK.js → order-create-return-WY6R4QMN.js} +6 -6
- package/dist/{order-edit-shipping-address-BPU7OL2N.js → order-edit-shipping-address-XQCSN4YO.js} +3 -3
- package/dist/{order-receive-return-FW5QZJBM.js → order-receive-return-GKMHYD4G.js} +1 -1
- package/dist/{product-edit-LQJDUUVX.js → product-edit-QGRKGJ3H.js} +1 -1
- package/dist/{product-variant-edit-66ZUIIMP.js → product-variant-edit-IQLBIHDE.js} +1 -1
- package/dist/{product-variant-manage-inventory-items-CV2CC2PV.js → product-variant-manage-inventory-items-C77QHYRT.js} +3 -3
- package/dist/{promotion-edit-details-YKS24GBD.js → promotion-edit-details-BFXPUEE6.js} +4 -4
- package/dist/{region-create-UMJK3VGL.js → region-create-ZPY6V77Q.js} +3 -3
- package/dist/{region-edit-ODVSNJHM.js → region-edit-Q2CBVPR2.js} +3 -3
- package/dist/{sales-channel-add-products-EOWFSO35.js → sales-channel-add-products-PIY4PUIW.js} +2 -2
- package/dist/{tax-region-province-create-RFYCUDER.js → tax-region-province-create-7BMYABJ6.js} +3 -3
- package/dist/{tax-region-tax-override-create-WIWUNXW6.js → tax-region-tax-override-create-EBDKSAXG.js} +6 -6
- package/dist/{tax-region-tax-override-edit-SWROFQTP.js → tax-region-tax-override-edit-55ODL7KC.js} +6 -6
|
@@ -1,1262 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeprecatedPercentageInput
|
|
3
|
-
} from "./chunk-MAEP2UCK.js";
|
|
4
|
-
import {
|
|
5
|
-
AddCampaignPromotionFields
|
|
6
|
-
} from "./chunk-WZADCDDE.js";
|
|
7
|
-
import {
|
|
8
|
-
RulesFormField
|
|
9
|
-
} from "./chunk-VBBBIEVH.js";
|
|
10
|
-
import {
|
|
11
|
-
CreateCampaignSchema,
|
|
12
|
-
DEFAULT_CAMPAIGN_VALUES
|
|
13
|
-
} from "./chunk-23663A2W.js";
|
|
14
|
-
import "./chunk-54TMLQH3.js";
|
|
15
|
-
import "./chunk-DEKJJ7NG.js";
|
|
16
|
-
import "./chunk-AEFDAU3Y.js";
|
|
17
|
-
import "./chunk-AW77UWCZ.js";
|
|
18
|
-
import "./chunk-TKGWSUEI.js";
|
|
19
|
-
import {
|
|
20
|
-
KeyboundForm
|
|
21
|
-
} from "./chunk-U2ZFCAPX.js";
|
|
22
|
-
import {
|
|
23
|
-
currencies,
|
|
24
|
-
getCurrencySymbol
|
|
25
|
-
} from "./chunk-IQPN4PZJ.js";
|
|
26
|
-
import {
|
|
27
|
-
useDocumentDirection
|
|
28
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
29
|
-
import {
|
|
30
|
-
RouteFocusModal,
|
|
31
|
-
useRouteModal
|
|
32
|
-
} from "./chunk-MWOKFNRO.js";
|
|
33
|
-
import {
|
|
34
|
-
Form
|
|
35
|
-
} from "./chunk-3QSRE5LS.js";
|
|
36
|
-
import "./chunk-XM6GCWNF.js";
|
|
37
|
-
import "./chunk-ODBDAABQ.js";
|
|
38
|
-
import "./chunk-CDQJKJMX.js";
|
|
39
|
-
import "./chunk-JLATVDLM.js";
|
|
40
|
-
import "./chunk-E7ZBQO6E.js";
|
|
41
|
-
import "./chunk-GPRBBA7S.js";
|
|
42
|
-
import "./chunk-XGHM75N2.js";
|
|
43
|
-
import "./chunk-U2GCSKW3.js";
|
|
44
|
-
import "./chunk-A4X5VP3G.js";
|
|
45
|
-
import "./chunk-RTAIDSDS.js";
|
|
46
|
-
import "./chunk-LW3UWYZU.js";
|
|
47
|
-
import "./chunk-NNZP4PYP.js";
|
|
48
|
-
import "./chunk-JOQ3RTF5.js";
|
|
49
|
-
import "./chunk-V534K7G4.js";
|
|
50
|
-
import "./chunk-TQI3DOQ5.js";
|
|
51
|
-
import {
|
|
52
|
-
useCampaigns,
|
|
53
|
-
useCreatePromotion
|
|
54
|
-
} from "./chunk-5PB7KCTF.js";
|
|
55
|
-
import "./chunk-LU72QEQC.js";
|
|
56
|
-
import "./chunk-GF4QHVX3.js";
|
|
57
|
-
import "./chunk-A5XOYSDC.js";
|
|
58
|
-
import "./chunk-YOIARITB.js";
|
|
59
|
-
import "./chunk-W7G64ULL.js";
|
|
60
|
-
import "./chunk-6C7TCU42.js";
|
|
61
|
-
import "./chunk-4YF3GAKE.js";
|
|
62
|
-
import "./chunk-QSM56ZOP.js";
|
|
63
|
-
import "./chunk-MIHEJ6Y6.js";
|
|
64
|
-
import "./chunk-3VZV6SJQ.js";
|
|
65
|
-
import "./chunk-LORVU5II.js";
|
|
66
|
-
import "./chunk-36ORDF7W.js";
|
|
67
|
-
import "./chunk-K357FGGP.js";
|
|
68
|
-
import "./chunk-RHKRREUU.js";
|
|
69
|
-
import "./chunk-ZA2KFUFR.js";
|
|
70
|
-
import "./chunk-ZYNBKBY3.js";
|
|
71
|
-
import "./chunk-NBMM2TZK.js";
|
|
72
|
-
|
|
73
|
-
// src/pages/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx
|
|
74
|
-
import { useEffect, useMemo, useState } from "react";
|
|
75
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
76
|
-
import {
|
|
77
|
-
Alert,
|
|
78
|
-
Badge,
|
|
79
|
-
Button,
|
|
80
|
-
clx,
|
|
81
|
-
CurrencyInput,
|
|
82
|
-
Divider,
|
|
83
|
-
Heading,
|
|
84
|
-
Input,
|
|
85
|
-
ProgressTabs,
|
|
86
|
-
RadioGroup,
|
|
87
|
-
Switch,
|
|
88
|
-
Text,
|
|
89
|
-
toast
|
|
90
|
-
} from "@medusajs/ui";
|
|
91
|
-
import { useForm, useWatch } from "react-hook-form";
|
|
92
|
-
import { Trans, useTranslation } from "react-i18next";
|
|
93
|
-
|
|
94
|
-
// src/pages/promotions/promotion-create/components/create-promotion-form/form-schema.ts
|
|
95
|
-
import { z } from "zod";
|
|
96
|
-
var RuleSchema = z.array(
|
|
97
|
-
z.object({
|
|
98
|
-
id: z.string().optional(),
|
|
99
|
-
attribute: z.string().min(1, { message: "Required field" }),
|
|
100
|
-
operator: z.string().min(1, { message: "Required field" }),
|
|
101
|
-
values: z.union([
|
|
102
|
-
z.number().min(1, { message: "Required field" }),
|
|
103
|
-
z.string().min(1, { message: "Required field" }),
|
|
104
|
-
z.array(z.string()).min(1, { message: "Required field" })
|
|
105
|
-
]),
|
|
106
|
-
required: z.boolean().optional(),
|
|
107
|
-
disguised: z.boolean().optional(),
|
|
108
|
-
field_type: z.string().optional()
|
|
109
|
-
})
|
|
110
|
-
);
|
|
111
|
-
var CreatePromotionSchema = z.object({
|
|
112
|
-
template_id: z.string().optional(),
|
|
113
|
-
campaign_id: z.string().optional(),
|
|
114
|
-
campaign_choice: z.enum(["none", "existing", "new"]).optional(),
|
|
115
|
-
is_automatic: z.string().toLowerCase(),
|
|
116
|
-
code: z.string().min(1),
|
|
117
|
-
type: z.enum(["buyget", "standard"]),
|
|
118
|
-
status: z.enum(["draft", "active", "inactive"]),
|
|
119
|
-
rules: RuleSchema,
|
|
120
|
-
is_tax_inclusive: z.boolean().optional(),
|
|
121
|
-
application_method: z.object({
|
|
122
|
-
allocation: z.enum(["each", "across", "once"]),
|
|
123
|
-
value: z.number().min(0).or(z.string().min(1)),
|
|
124
|
-
currency_code: z.string().optional(),
|
|
125
|
-
max_quantity: z.number().optional().nullable(),
|
|
126
|
-
target_rules: RuleSchema,
|
|
127
|
-
buy_rules: RuleSchema,
|
|
128
|
-
type: z.enum(["fixed", "percentage"]),
|
|
129
|
-
target_type: z.enum(["order", "shipping_methods", "items"])
|
|
130
|
-
}),
|
|
131
|
-
campaign: CreateCampaignSchema.optional()
|
|
132
|
-
}).refine(
|
|
133
|
-
(data) => {
|
|
134
|
-
if (data.application_method.allocation === "across") {
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return typeof data.application_method.max_quantity === "number";
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
path: ["application_method.max_quantity"],
|
|
141
|
-
message: `required field`
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
// src/pages/promotions/promotion-create/components/create-promotion-form/templates.ts
|
|
146
|
-
var commonHiddenFields = [
|
|
147
|
-
"type",
|
|
148
|
-
"application_method.type"
|
|
149
|
-
];
|
|
150
|
-
var amountOfOrderHiddenFields = [...commonHiddenFields];
|
|
151
|
-
var amountOfProductHiddenFields = [...commonHiddenFields];
|
|
152
|
-
var percentageOfOrderHiddenFields = [
|
|
153
|
-
...commonHiddenFields,
|
|
154
|
-
"is_tax_inclusive"
|
|
155
|
-
];
|
|
156
|
-
var percentageOfProductHiddenFields = [
|
|
157
|
-
...commonHiddenFields,
|
|
158
|
-
"is_tax_inclusive"
|
|
159
|
-
];
|
|
160
|
-
var buyGetHiddenFields = [
|
|
161
|
-
...commonHiddenFields,
|
|
162
|
-
"application_method.value",
|
|
163
|
-
"is_tax_inclusive"
|
|
164
|
-
];
|
|
165
|
-
var freeShippingHiddenFields = [
|
|
166
|
-
...commonHiddenFields,
|
|
167
|
-
"application_method.value",
|
|
168
|
-
"application_method.allocation",
|
|
169
|
-
"is_tax_inclusive"
|
|
170
|
-
];
|
|
171
|
-
var templates = [
|
|
172
|
-
{
|
|
173
|
-
id: "amount_off_products",
|
|
174
|
-
type: "standard",
|
|
175
|
-
title: "Amount off products",
|
|
176
|
-
description: "Discount specific products or collection of products",
|
|
177
|
-
hiddenFields: amountOfProductHiddenFields,
|
|
178
|
-
defaults: {
|
|
179
|
-
is_automatic: "false",
|
|
180
|
-
type: "standard",
|
|
181
|
-
application_method: {
|
|
182
|
-
allocation: "each",
|
|
183
|
-
target_type: "items",
|
|
184
|
-
type: "fixed"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "amount_off_order",
|
|
190
|
-
type: "standard",
|
|
191
|
-
title: "Amount off order",
|
|
192
|
-
description: "Discounts the total order amount",
|
|
193
|
-
hiddenFields: amountOfOrderHiddenFields,
|
|
194
|
-
defaults: {
|
|
195
|
-
is_automatic: "false",
|
|
196
|
-
type: "standard",
|
|
197
|
-
application_method: {
|
|
198
|
-
allocation: "across",
|
|
199
|
-
target_type: "order",
|
|
200
|
-
type: "fixed"
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
id: "percentage_off_product",
|
|
206
|
-
type: "standard",
|
|
207
|
-
title: "Percentage off product",
|
|
208
|
-
description: "Discounts a percentage off selected products",
|
|
209
|
-
hiddenFields: percentageOfProductHiddenFields,
|
|
210
|
-
defaults: {
|
|
211
|
-
is_automatic: "false",
|
|
212
|
-
type: "standard",
|
|
213
|
-
application_method: {
|
|
214
|
-
allocation: "each",
|
|
215
|
-
target_type: "items",
|
|
216
|
-
type: "percentage"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
id: "percentage_off_order",
|
|
222
|
-
type: "standard",
|
|
223
|
-
title: "Percentage off order",
|
|
224
|
-
description: "Discounts a percentage of the total order amount",
|
|
225
|
-
hiddenFields: percentageOfOrderHiddenFields,
|
|
226
|
-
defaults: {
|
|
227
|
-
is_automatic: "false",
|
|
228
|
-
type: "standard",
|
|
229
|
-
application_method: {
|
|
230
|
-
allocation: "across",
|
|
231
|
-
target_type: "order",
|
|
232
|
-
type: "percentage"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
id: "buy_get",
|
|
238
|
-
type: "buy_get",
|
|
239
|
-
title: "Buy X Get Y",
|
|
240
|
-
description: "Buy X product(s), get Y product(s)",
|
|
241
|
-
hiddenFields: buyGetHiddenFields,
|
|
242
|
-
defaults: {
|
|
243
|
-
is_automatic: "false",
|
|
244
|
-
type: "buyget",
|
|
245
|
-
application_method: {
|
|
246
|
-
type: "percentage",
|
|
247
|
-
value: 100,
|
|
248
|
-
apply_to_quantity: 1,
|
|
249
|
-
max_quantity: 1
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
id: "shipping_discount",
|
|
255
|
-
type: "standard",
|
|
256
|
-
title: "Free shipping",
|
|
257
|
-
description: "Applies a 100% discount to shipping fees",
|
|
258
|
-
hiddenFields: freeShippingHiddenFields,
|
|
259
|
-
defaults: {
|
|
260
|
-
is_automatic: "false",
|
|
261
|
-
type: "standard",
|
|
262
|
-
application_method: {
|
|
263
|
-
allocation: "across",
|
|
264
|
-
target_type: "shipping_methods",
|
|
265
|
-
type: "percentage",
|
|
266
|
-
value: 100
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
];
|
|
271
|
-
|
|
272
|
-
// src/pages/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx
|
|
273
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
274
|
-
var defaultValues = {
|
|
275
|
-
campaign_id: void 0,
|
|
276
|
-
template_id: templates[0].id,
|
|
277
|
-
campaign_choice: "none",
|
|
278
|
-
is_automatic: "false",
|
|
279
|
-
code: "",
|
|
280
|
-
type: "standard",
|
|
281
|
-
status: "draft",
|
|
282
|
-
rules: [],
|
|
283
|
-
is_tax_inclusive: false,
|
|
284
|
-
application_method: {
|
|
285
|
-
allocation: "each",
|
|
286
|
-
type: "fixed",
|
|
287
|
-
target_type: "items",
|
|
288
|
-
max_quantity: 1,
|
|
289
|
-
target_rules: [],
|
|
290
|
-
buy_rules: []
|
|
291
|
-
},
|
|
292
|
-
campaign: void 0
|
|
293
|
-
};
|
|
294
|
-
var CreatePromotionForm = () => {
|
|
295
|
-
const [tab, setTab] = useState("type" /* TYPE */);
|
|
296
|
-
const [tabState, setTabState] = useState({
|
|
297
|
-
["type" /* TYPE */]: "in-progress",
|
|
298
|
-
["promotion" /* PROMOTION */]: "not-started",
|
|
299
|
-
["campaign" /* CAMPAIGN */]: "not-started"
|
|
300
|
-
});
|
|
301
|
-
const { t } = useTranslation();
|
|
302
|
-
const { handleSuccess } = useRouteModal();
|
|
303
|
-
const direction = useDocumentDirection();
|
|
304
|
-
const form = useForm({
|
|
305
|
-
defaultValues,
|
|
306
|
-
resolver: zodResolver(CreatePromotionSchema)
|
|
307
|
-
});
|
|
308
|
-
const { setValue, reset, getValues } = form;
|
|
309
|
-
const [allocationMode, setAllocationMode] = useState("each");
|
|
310
|
-
const { mutateAsync: createPromotion } = useCreatePromotion();
|
|
311
|
-
const handleSubmit = form.handleSubmit(
|
|
312
|
-
async (data) => {
|
|
313
|
-
if (data.campaign_choice === "existing" && !data.campaign_id) {
|
|
314
|
-
form.setError("campaign_id", { message: t("promotions.errors.requiredField") });
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
const {
|
|
318
|
-
campaign_choice: _campaignChoice,
|
|
319
|
-
is_automatic,
|
|
320
|
-
is_tax_inclusive,
|
|
321
|
-
template_id: _templateId,
|
|
322
|
-
application_method,
|
|
323
|
-
rules,
|
|
324
|
-
...promotionData
|
|
325
|
-
} = data;
|
|
326
|
-
const {
|
|
327
|
-
target_rules: targetRulesData = [],
|
|
328
|
-
buy_rules: buyRulesData = [],
|
|
329
|
-
...applicationMethodData
|
|
330
|
-
} = application_method;
|
|
331
|
-
const allocationTyped = applicationMethodData.allocation;
|
|
332
|
-
const disguisedRules = [
|
|
333
|
-
...targetRulesData.filter((r) => !!r.disguised),
|
|
334
|
-
...buyRulesData.filter((r) => !!r.disguised),
|
|
335
|
-
...rules.filter((r) => !!r.disguised)
|
|
336
|
-
];
|
|
337
|
-
const applicationMethodRuleData = {};
|
|
338
|
-
for (const rule of disguisedRules) {
|
|
339
|
-
applicationMethodRuleData[rule.attribute] = rule.field_type === "number" ? parseInt(rule.values) : rule.values;
|
|
340
|
-
}
|
|
341
|
-
const buildRulesData = (rules2) => {
|
|
342
|
-
return rules2.filter((r) => !r.disguised).map((rule) => ({
|
|
343
|
-
operator: rule.operator,
|
|
344
|
-
attribute: rule.attribute,
|
|
345
|
-
values: rule.values
|
|
346
|
-
}));
|
|
347
|
-
};
|
|
348
|
-
if (data.campaign) {
|
|
349
|
-
data.campaign.budget.attribute = data.campaign.budget.attribute || null;
|
|
350
|
-
data.campaign.budget.type = data.campaign.budget.attribute ? "use_by_attribute" : data.campaign.budget.type;
|
|
351
|
-
}
|
|
352
|
-
createPromotion(
|
|
353
|
-
{
|
|
354
|
-
...promotionData,
|
|
355
|
-
rules: buildRulesData(rules),
|
|
356
|
-
application_method: {
|
|
357
|
-
...applicationMethodData,
|
|
358
|
-
allocation: allocationTyped,
|
|
359
|
-
...applicationMethodRuleData,
|
|
360
|
-
value: parseFloat(applicationMethodData.value),
|
|
361
|
-
target_rules: buildRulesData(targetRulesData),
|
|
362
|
-
buy_rules: buildRulesData(buyRulesData),
|
|
363
|
-
max_quantity: allocationTyped === "across" ? void 0 : applicationMethodData.max_quantity
|
|
364
|
-
},
|
|
365
|
-
is_tax_inclusive,
|
|
366
|
-
is_automatic: is_automatic === "true"
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
onSuccess: ({ promotion }) => {
|
|
370
|
-
toast.success(
|
|
371
|
-
t("promotions.toasts.promotionCreateSuccess", {
|
|
372
|
-
code: promotion.code
|
|
373
|
-
})
|
|
374
|
-
);
|
|
375
|
-
handleSuccess(`/promotions/${promotion.id}`);
|
|
376
|
-
},
|
|
377
|
-
onError: (e) => {
|
|
378
|
-
toast.error(e.message);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
);
|
|
382
|
-
},
|
|
383
|
-
async (error) => {
|
|
384
|
-
const { campaign: _campaign, ...rest } = error || {};
|
|
385
|
-
const errorInPromotionTab = !!Object.keys(rest || {}).length;
|
|
386
|
-
if (errorInPromotionTab) {
|
|
387
|
-
toast.error(t("promotions.errors.promotionTabError"));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
const handleTabChange = async (tab2) => {
|
|
392
|
-
switch (tab2) {
|
|
393
|
-
case "type" /* TYPE */:
|
|
394
|
-
setTabState((prev) => ({
|
|
395
|
-
...prev,
|
|
396
|
-
["type" /* TYPE */]: "in-progress"
|
|
397
|
-
}));
|
|
398
|
-
setTab(tab2);
|
|
399
|
-
break;
|
|
400
|
-
case "promotion" /* PROMOTION */:
|
|
401
|
-
setTabState((prev) => ({
|
|
402
|
-
...prev,
|
|
403
|
-
["type" /* TYPE */]: "completed",
|
|
404
|
-
["promotion" /* PROMOTION */]: "in-progress"
|
|
405
|
-
}));
|
|
406
|
-
setTab(tab2);
|
|
407
|
-
break;
|
|
408
|
-
case "campaign" /* CAMPAIGN */: {
|
|
409
|
-
const valid = await form.trigger();
|
|
410
|
-
if (!valid) {
|
|
411
|
-
setTabState({
|
|
412
|
-
["type" /* TYPE */]: "completed",
|
|
413
|
-
["promotion" /* PROMOTION */]: "in-progress",
|
|
414
|
-
["campaign" /* CAMPAIGN */]: "not-started"
|
|
415
|
-
});
|
|
416
|
-
setTab("promotion" /* PROMOTION */);
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
setTabState((prev) => ({
|
|
420
|
-
...prev,
|
|
421
|
-
["promotion" /* PROMOTION */]: "completed",
|
|
422
|
-
["campaign" /* CAMPAIGN */]: "in-progress"
|
|
423
|
-
}));
|
|
424
|
-
setTab(tab2);
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
const handleContinue = async () => {
|
|
430
|
-
switch (tab) {
|
|
431
|
-
case "type" /* TYPE */:
|
|
432
|
-
handleTabChange("promotion" /* PROMOTION */);
|
|
433
|
-
break;
|
|
434
|
-
case "promotion" /* PROMOTION */: {
|
|
435
|
-
const valid = await form.trigger();
|
|
436
|
-
if (valid) {
|
|
437
|
-
handleTabChange("campaign" /* CAMPAIGN */);
|
|
438
|
-
}
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
case "campaign" /* CAMPAIGN */:
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
const watchTemplateId = useWatch({
|
|
446
|
-
control: form.control,
|
|
447
|
-
name: "template_id"
|
|
448
|
-
});
|
|
449
|
-
const currentTemplate = useMemo(() => {
|
|
450
|
-
const currentTemplate2 = templates.find((template) => template.id === watchTemplateId);
|
|
451
|
-
if (!currentTemplate2) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
reset({ ...defaultValues, template_id: watchTemplateId });
|
|
455
|
-
for (const [key, value] of Object.entries(currentTemplate2.defaults)) {
|
|
456
|
-
if (typeof value === "object") {
|
|
457
|
-
for (const [subKey, subValue] of Object.entries(value)) {
|
|
458
|
-
setValue(`application_method.${subKey}`, subValue);
|
|
459
|
-
}
|
|
460
|
-
} else {
|
|
461
|
-
setValue(key, value);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return currentTemplate2;
|
|
465
|
-
}, [watchTemplateId, setValue, reset]);
|
|
466
|
-
const watchValueType = useWatch({
|
|
467
|
-
control: form.control,
|
|
468
|
-
name: "application_method.type"
|
|
469
|
-
});
|
|
470
|
-
const isFixedValueType = watchValueType === "fixed";
|
|
471
|
-
const watchAllocation = useWatch({
|
|
472
|
-
control: form.control,
|
|
473
|
-
name: "application_method.allocation"
|
|
474
|
-
});
|
|
475
|
-
useEffect(() => {
|
|
476
|
-
if (watchAllocation) {
|
|
477
|
-
setAllocationMode(watchAllocation);
|
|
478
|
-
}
|
|
479
|
-
}, [watchAllocation]);
|
|
480
|
-
const watchType = useWatch({
|
|
481
|
-
control: form.control,
|
|
482
|
-
name: "type"
|
|
483
|
-
});
|
|
484
|
-
const isTypeStandard = watchType === "standard";
|
|
485
|
-
const isTypeBuyGet = watchType === "buyget";
|
|
486
|
-
const targetType = useWatch({
|
|
487
|
-
control: form.control,
|
|
488
|
-
name: "application_method.target_type"
|
|
489
|
-
});
|
|
490
|
-
const isTargetTypeOrder = targetType === "order";
|
|
491
|
-
const formData = form.getValues();
|
|
492
|
-
let campaignQuery = {};
|
|
493
|
-
if (formData.application_method.currency_code) {
|
|
494
|
-
campaignQuery = {
|
|
495
|
-
budget: { currency_code: formData.application_method.currency_code }
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
const { campaigns } = useCampaigns(campaignQuery);
|
|
499
|
-
const watchCampaignChoice = useWatch({
|
|
500
|
-
control: form.control,
|
|
501
|
-
name: "campaign_choice"
|
|
502
|
-
});
|
|
503
|
-
useEffect(() => {
|
|
504
|
-
const formData2 = getValues();
|
|
505
|
-
if (watchCampaignChoice !== "existing") {
|
|
506
|
-
setValue("campaign_id", void 0);
|
|
507
|
-
form.clearErrors("campaign_id");
|
|
508
|
-
}
|
|
509
|
-
if (watchCampaignChoice !== "new") {
|
|
510
|
-
setValue("campaign", void 0);
|
|
511
|
-
}
|
|
512
|
-
if (watchCampaignChoice === "new") {
|
|
513
|
-
if (!formData2.campaign || !formData2.campaign?.budget?.type) {
|
|
514
|
-
setValue("campaign", {
|
|
515
|
-
...DEFAULT_CAMPAIGN_VALUES,
|
|
516
|
-
budget: {
|
|
517
|
-
...DEFAULT_CAMPAIGN_VALUES.budget,
|
|
518
|
-
currency_code: formData2.application_method.currency_code
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}, [watchCampaignChoice, getValues, setValue]);
|
|
524
|
-
const watchRules = useWatch({
|
|
525
|
-
control: form.control,
|
|
526
|
-
name: "rules"
|
|
527
|
-
});
|
|
528
|
-
const watchCurrencyRule = watchRules.find((rule) => rule.attribute === "currency_code");
|
|
529
|
-
if (watchCurrencyRule) {
|
|
530
|
-
const formData2 = form.getValues();
|
|
531
|
-
const currencyCode = formData2.application_method.currency_code;
|
|
532
|
-
const ruleValue = watchCurrencyRule.values;
|
|
533
|
-
if (!Array.isArray(ruleValue) && currencyCode !== ruleValue) {
|
|
534
|
-
form.setValue("application_method.currency_code", ruleValue);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
return /* @__PURE__ */ jsx(
|
|
538
|
-
RouteFocusModal.Form,
|
|
539
|
-
{
|
|
540
|
-
form,
|
|
541
|
-
"data-testid": "promotion-create-form",
|
|
542
|
-
children: /* @__PURE__ */ jsxs(
|
|
543
|
-
KeyboundForm,
|
|
544
|
-
{
|
|
545
|
-
className: "flex h-full flex-col",
|
|
546
|
-
onSubmit: handleSubmit,
|
|
547
|
-
children: [
|
|
548
|
-
/* @__PURE__ */ jsxs(
|
|
549
|
-
ProgressTabs,
|
|
550
|
-
{
|
|
551
|
-
dir: direction,
|
|
552
|
-
value: tab,
|
|
553
|
-
onValueChange: (tab2) => handleTabChange(tab2),
|
|
554
|
-
className: "flex h-full flex-col overflow-hidden",
|
|
555
|
-
"data-testid": "promotion-create-form-tabs",
|
|
556
|
-
children: [
|
|
557
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Header, { "data-testid": "promotion-create-form-header", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-x-4", children: /* @__PURE__ */ jsx("div", { className: "-my-2 w-full max-w-[600px] border-l", children: /* @__PURE__ */ jsxs(
|
|
558
|
-
ProgressTabs.List,
|
|
559
|
-
{
|
|
560
|
-
className: "grid w-full grid-cols-3",
|
|
561
|
-
"data-testid": "promotion-create-form-tabs-list",
|
|
562
|
-
children: [
|
|
563
|
-
/* @__PURE__ */ jsx(
|
|
564
|
-
ProgressTabs.Trigger,
|
|
565
|
-
{
|
|
566
|
-
className: "w-full",
|
|
567
|
-
value: "type" /* TYPE */,
|
|
568
|
-
status: tabState["type" /* TYPE */],
|
|
569
|
-
"data-testid": "promotion-create-form-tab-type",
|
|
570
|
-
children: t("promotions.tabs.template")
|
|
571
|
-
}
|
|
572
|
-
),
|
|
573
|
-
/* @__PURE__ */ jsx(
|
|
574
|
-
ProgressTabs.Trigger,
|
|
575
|
-
{
|
|
576
|
-
className: "w-full",
|
|
577
|
-
value: "promotion" /* PROMOTION */,
|
|
578
|
-
status: tabState["promotion" /* PROMOTION */],
|
|
579
|
-
"data-testid": "promotion-create-form-tab-promotion",
|
|
580
|
-
children: t("promotions.tabs.details")
|
|
581
|
-
}
|
|
582
|
-
),
|
|
583
|
-
/* @__PURE__ */ jsx(
|
|
584
|
-
ProgressTabs.Trigger,
|
|
585
|
-
{
|
|
586
|
-
className: "w-full",
|
|
587
|
-
value: "campaign" /* CAMPAIGN */,
|
|
588
|
-
status: tabState["campaign" /* CAMPAIGN */],
|
|
589
|
-
"data-testid": "promotion-create-form-tab-campaign",
|
|
590
|
-
children: t("promotions.tabs.campaign")
|
|
591
|
-
}
|
|
592
|
-
)
|
|
593
|
-
]
|
|
594
|
-
}
|
|
595
|
-
) }) }) }),
|
|
596
|
-
/* @__PURE__ */ jsxs(
|
|
597
|
-
RouteFocusModal.Body,
|
|
598
|
-
{
|
|
599
|
-
className: "size-full overflow-hidden",
|
|
600
|
-
"data-testid": "promotion-create-form-body",
|
|
601
|
-
children: [
|
|
602
|
-
/* @__PURE__ */ jsx(
|
|
603
|
-
ProgressTabs.Content,
|
|
604
|
-
{
|
|
605
|
-
value: "type" /* TYPE */,
|
|
606
|
-
className: "size-full overflow-y-auto",
|
|
607
|
-
"data-testid": "promotion-create-form-content-type",
|
|
608
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "w-full max-w-[720px] py-16", children: /* @__PURE__ */ jsx(
|
|
609
|
-
Form.Field,
|
|
610
|
-
{
|
|
611
|
-
control: form.control,
|
|
612
|
-
name: "template_id",
|
|
613
|
-
render: ({ field }) => {
|
|
614
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-template-item", children: [
|
|
615
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-template-label", children: t("promotions.fields.type") }),
|
|
616
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-template-control", children: /* @__PURE__ */ jsx(
|
|
617
|
-
RadioGroup,
|
|
618
|
-
{
|
|
619
|
-
dir: direction,
|
|
620
|
-
className: "flex-col gap-y-3",
|
|
621
|
-
...field,
|
|
622
|
-
onValueChange: field.onChange,
|
|
623
|
-
"data-testid": "promotion-create-form-template-radio-group",
|
|
624
|
-
children: templates.map((template) => {
|
|
625
|
-
return /* @__PURE__ */ jsx(
|
|
626
|
-
RadioGroup.ChoiceBox,
|
|
627
|
-
{
|
|
628
|
-
value: template.id,
|
|
629
|
-
label: template.title,
|
|
630
|
-
description: template.description,
|
|
631
|
-
"data-testid": `promotion-create-form-template-option-${template.id}`
|
|
632
|
-
},
|
|
633
|
-
template.id
|
|
634
|
-
);
|
|
635
|
-
})
|
|
636
|
-
},
|
|
637
|
-
"template_id"
|
|
638
|
-
) }),
|
|
639
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-template-error" })
|
|
640
|
-
] });
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
) }) })
|
|
644
|
-
}
|
|
645
|
-
),
|
|
646
|
-
/* @__PURE__ */ jsx(
|
|
647
|
-
ProgressTabs.Content,
|
|
648
|
-
{
|
|
649
|
-
value: "promotion" /* PROMOTION */,
|
|
650
|
-
className: "size-full overflow-y-auto",
|
|
651
|
-
"data-testid": "promotion-create-form-content-promotion",
|
|
652
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 py-16", children: [
|
|
653
|
-
/* @__PURE__ */ jsxs(
|
|
654
|
-
Heading,
|
|
655
|
-
{
|
|
656
|
-
level: "h1",
|
|
657
|
-
className: "text-fg-base",
|
|
658
|
-
"data-testid": "promotion-create-form-promotion-heading",
|
|
659
|
-
children: [
|
|
660
|
-
t(`promotions.sections.details`),
|
|
661
|
-
currentTemplate?.title && /* @__PURE__ */ jsx(
|
|
662
|
-
Badge,
|
|
663
|
-
{
|
|
664
|
-
className: "ml-2 align-middle",
|
|
665
|
-
color: "grey",
|
|
666
|
-
size: "2xsmall",
|
|
667
|
-
rounded: "full",
|
|
668
|
-
"data-testid": "promotion-create-form-promotion-template-badge",
|
|
669
|
-
children: currentTemplate?.title
|
|
670
|
-
}
|
|
671
|
-
)
|
|
672
|
-
]
|
|
673
|
-
}
|
|
674
|
-
),
|
|
675
|
-
form.formState.errors.root && /* @__PURE__ */ jsx(
|
|
676
|
-
Alert,
|
|
677
|
-
{
|
|
678
|
-
variant: "error",
|
|
679
|
-
dismissible: false,
|
|
680
|
-
className: "text-balance",
|
|
681
|
-
"data-testid": "promotion-create-form-promotion-error-alert",
|
|
682
|
-
children: form.formState.errors.root.message
|
|
683
|
-
}
|
|
684
|
-
),
|
|
685
|
-
/* @__PURE__ */ jsx(
|
|
686
|
-
Form.Field,
|
|
687
|
-
{
|
|
688
|
-
control: form.control,
|
|
689
|
-
name: "is_automatic",
|
|
690
|
-
render: ({ field }) => {
|
|
691
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-method-item", children: [
|
|
692
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-method-label", children: t("promotions.form.method.label") }),
|
|
693
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-method-control", children: /* @__PURE__ */ jsxs(
|
|
694
|
-
RadioGroup,
|
|
695
|
-
{
|
|
696
|
-
dir: direction,
|
|
697
|
-
className: "flex gap-y-3",
|
|
698
|
-
...field,
|
|
699
|
-
value: field.value,
|
|
700
|
-
onValueChange: field.onChange,
|
|
701
|
-
"data-testid": "promotion-create-form-method-radio-group",
|
|
702
|
-
children: [
|
|
703
|
-
/* @__PURE__ */ jsx(
|
|
704
|
-
RadioGroup.ChoiceBox,
|
|
705
|
-
{
|
|
706
|
-
value: "false",
|
|
707
|
-
label: t("promotions.form.method.code.title"),
|
|
708
|
-
description: t("promotions.form.method.code.description"),
|
|
709
|
-
className: clx("basis-1/2"),
|
|
710
|
-
"data-testid": "promotion-create-form-method-option-code"
|
|
711
|
-
}
|
|
712
|
-
),
|
|
713
|
-
/* @__PURE__ */ jsx(
|
|
714
|
-
RadioGroup.ChoiceBox,
|
|
715
|
-
{
|
|
716
|
-
value: "true",
|
|
717
|
-
label: t("promotions.form.method.automatic.title"),
|
|
718
|
-
description: t("promotions.form.method.automatic.description"),
|
|
719
|
-
className: clx("basis-1/2"),
|
|
720
|
-
"data-testid": "promotion-create-form-method-option-automatic"
|
|
721
|
-
}
|
|
722
|
-
)
|
|
723
|
-
]
|
|
724
|
-
}
|
|
725
|
-
) }),
|
|
726
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-method-error" })
|
|
727
|
-
] });
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
/* @__PURE__ */ jsx(
|
|
732
|
-
Form.Field,
|
|
733
|
-
{
|
|
734
|
-
control: form.control,
|
|
735
|
-
name: "status",
|
|
736
|
-
render: ({ field }) => {
|
|
737
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-status-item", children: [
|
|
738
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-status-label", children: t("promotions.form.status.label") }),
|
|
739
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-status-control", children: /* @__PURE__ */ jsxs(
|
|
740
|
-
RadioGroup,
|
|
741
|
-
{
|
|
742
|
-
dir: direction,
|
|
743
|
-
className: "flex gap-y-3",
|
|
744
|
-
...field,
|
|
745
|
-
value: field.value,
|
|
746
|
-
onValueChange: field.onChange,
|
|
747
|
-
"data-testid": "promotion-create-form-status-radio-group",
|
|
748
|
-
children: [
|
|
749
|
-
/* @__PURE__ */ jsx(
|
|
750
|
-
RadioGroup.ChoiceBox,
|
|
751
|
-
{
|
|
752
|
-
value: "draft",
|
|
753
|
-
label: t("promotions.form.status.draft.title"),
|
|
754
|
-
description: t("promotions.form.status.draft.description"),
|
|
755
|
-
className: clx("basis-1/2"),
|
|
756
|
-
"data-testid": "promotion-create-form-status-option-draft"
|
|
757
|
-
}
|
|
758
|
-
),
|
|
759
|
-
/* @__PURE__ */ jsx(
|
|
760
|
-
RadioGroup.ChoiceBox,
|
|
761
|
-
{
|
|
762
|
-
value: "active",
|
|
763
|
-
label: t("promotions.form.status.active.title"),
|
|
764
|
-
description: t("promotions.form.status.active.description"),
|
|
765
|
-
className: clx("basis-1/2"),
|
|
766
|
-
"data-testid": "promotion-create-form-status-option-active"
|
|
767
|
-
}
|
|
768
|
-
)
|
|
769
|
-
]
|
|
770
|
-
}
|
|
771
|
-
) }),
|
|
772
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-status-error" })
|
|
773
|
-
] });
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
),
|
|
777
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-y-4", children: /* @__PURE__ */ jsx(
|
|
778
|
-
Form.Field,
|
|
779
|
-
{
|
|
780
|
-
control: form.control,
|
|
781
|
-
name: "code",
|
|
782
|
-
render: ({ field }) => {
|
|
783
|
-
return /* @__PURE__ */ jsxs(
|
|
784
|
-
Form.Item,
|
|
785
|
-
{
|
|
786
|
-
className: "basis-1/2",
|
|
787
|
-
"data-testid": "promotion-create-form-code-item",
|
|
788
|
-
children: [
|
|
789
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-code-label", children: t("promotions.form.code.title") }),
|
|
790
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-code-control", children: /* @__PURE__ */ jsx(
|
|
791
|
-
Input,
|
|
792
|
-
{
|
|
793
|
-
...field,
|
|
794
|
-
placeholder: "SUMMER15",
|
|
795
|
-
"data-testid": "promotion-create-form-code-input"
|
|
796
|
-
}
|
|
797
|
-
) }),
|
|
798
|
-
/* @__PURE__ */ jsx(
|
|
799
|
-
Text,
|
|
800
|
-
{
|
|
801
|
-
size: "small",
|
|
802
|
-
leading: "compact",
|
|
803
|
-
className: "text-ui-fg-subtle",
|
|
804
|
-
"data-testid": "promotion-create-form-code-description",
|
|
805
|
-
children: /* @__PURE__ */ jsx(
|
|
806
|
-
Trans,
|
|
807
|
-
{
|
|
808
|
-
t,
|
|
809
|
-
i18nKey: "promotions.form.code.description",
|
|
810
|
-
components: [/* @__PURE__ */ jsx("br", {}, "break")]
|
|
811
|
-
}
|
|
812
|
-
)
|
|
813
|
-
}
|
|
814
|
-
),
|
|
815
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-code-error" })
|
|
816
|
-
]
|
|
817
|
-
}
|
|
818
|
-
);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
) }),
|
|
822
|
-
!currentTemplate?.hiddenFields?.includes("is_tax_inclusive") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
823
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
824
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-x-2 gap-y-4", children: /* @__PURE__ */ jsx(
|
|
825
|
-
Form.Field,
|
|
826
|
-
{
|
|
827
|
-
control: form.control,
|
|
828
|
-
name: "is_tax_inclusive",
|
|
829
|
-
render: ({ field: { onChange, value, ...field } }) => {
|
|
830
|
-
return /* @__PURE__ */ jsxs(
|
|
831
|
-
Form.Item,
|
|
832
|
-
{
|
|
833
|
-
className: "basis-full",
|
|
834
|
-
"data-testid": "promotion-create-form-tax-inclusive-item",
|
|
835
|
-
children: [
|
|
836
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
837
|
-
/* @__PURE__ */ jsxs("div", { className: "block", children: [
|
|
838
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-tax-inclusive-label", children: t("promotions.form.taxInclusive.title") }),
|
|
839
|
-
/* @__PURE__ */ jsx(
|
|
840
|
-
Form.Hint,
|
|
841
|
-
{
|
|
842
|
-
className: "!mt-1",
|
|
843
|
-
"data-testid": "promotion-create-form-tax-inclusive-hint",
|
|
844
|
-
children: t("promotions.form.taxInclusive.description")
|
|
845
|
-
}
|
|
846
|
-
)
|
|
847
|
-
] }),
|
|
848
|
-
/* @__PURE__ */ jsx(
|
|
849
|
-
Form.Control,
|
|
850
|
-
{
|
|
851
|
-
className: "mr-2 self-center",
|
|
852
|
-
"data-testid": "promotion-create-form-tax-inclusive-control",
|
|
853
|
-
children: /* @__PURE__ */ jsx(
|
|
854
|
-
Switch,
|
|
855
|
-
{
|
|
856
|
-
dir: "ltr",
|
|
857
|
-
className: "mt-[2px] rtl:rotate-180",
|
|
858
|
-
checked: !!value,
|
|
859
|
-
onCheckedChange: onChange,
|
|
860
|
-
...field,
|
|
861
|
-
"data-testid": "promotion-create-form-tax-inclusive-switch"
|
|
862
|
-
}
|
|
863
|
-
)
|
|
864
|
-
}
|
|
865
|
-
)
|
|
866
|
-
] }),
|
|
867
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-tax-inclusive-error" })
|
|
868
|
-
]
|
|
869
|
-
}
|
|
870
|
-
);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
) })
|
|
874
|
-
] }),
|
|
875
|
-
!currentTemplate?.hiddenFields?.includes("type") && /* @__PURE__ */ jsx(
|
|
876
|
-
Form.Field,
|
|
877
|
-
{
|
|
878
|
-
control: form.control,
|
|
879
|
-
name: "type",
|
|
880
|
-
render: ({ field }) => {
|
|
881
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-type-item", children: [
|
|
882
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-type-label", children: t("promotions.fields.type") }),
|
|
883
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-type-control", children: /* @__PURE__ */ jsxs(
|
|
884
|
-
RadioGroup,
|
|
885
|
-
{
|
|
886
|
-
dir: direction,
|
|
887
|
-
className: "flex gap-y-3",
|
|
888
|
-
...field,
|
|
889
|
-
onValueChange: field.onChange,
|
|
890
|
-
"data-testid": "promotion-create-form-type-radio-group",
|
|
891
|
-
children: [
|
|
892
|
-
/* @__PURE__ */ jsx(
|
|
893
|
-
RadioGroup.ChoiceBox,
|
|
894
|
-
{
|
|
895
|
-
value: "standard",
|
|
896
|
-
label: t("promotions.form.type.standard.title"),
|
|
897
|
-
description: t("promotions.form.type.standard.description"),
|
|
898
|
-
className: clx("basis-1/2"),
|
|
899
|
-
"data-testid": "promotion-create-form-type-option-standard"
|
|
900
|
-
}
|
|
901
|
-
),
|
|
902
|
-
/* @__PURE__ */ jsx(
|
|
903
|
-
RadioGroup.ChoiceBox,
|
|
904
|
-
{
|
|
905
|
-
value: "buyget",
|
|
906
|
-
label: t("promotions.form.type.buyget.title"),
|
|
907
|
-
description: t("promotions.form.type.buyget.description"),
|
|
908
|
-
className: clx("basis-1/2"),
|
|
909
|
-
"data-testid": "promotion-create-form-type-option-buyget"
|
|
910
|
-
}
|
|
911
|
-
)
|
|
912
|
-
]
|
|
913
|
-
}
|
|
914
|
-
) }),
|
|
915
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-type-error" })
|
|
916
|
-
] });
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
),
|
|
920
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
921
|
-
/* @__PURE__ */ jsx(
|
|
922
|
-
RulesFormField,
|
|
923
|
-
{
|
|
924
|
-
form,
|
|
925
|
-
ruleType: "rules"
|
|
926
|
-
}
|
|
927
|
-
),
|
|
928
|
-
!currentTemplate?.hiddenFields?.includes("application_method.type") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
929
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
930
|
-
/* @__PURE__ */ jsx(
|
|
931
|
-
Form.Field,
|
|
932
|
-
{
|
|
933
|
-
control: form.control,
|
|
934
|
-
name: "application_method.type",
|
|
935
|
-
render: ({ field }) => {
|
|
936
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-value-type-item", children: [
|
|
937
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-value-type-label", children: t("promotions.fields.value_type") }),
|
|
938
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-value-type-control", children: /* @__PURE__ */ jsxs(
|
|
939
|
-
RadioGroup,
|
|
940
|
-
{
|
|
941
|
-
dir: direction,
|
|
942
|
-
className: "flex gap-y-3",
|
|
943
|
-
...field,
|
|
944
|
-
onValueChange: field.onChange,
|
|
945
|
-
"data-testid": "promotion-create-form-value-type-radio-group",
|
|
946
|
-
children: [
|
|
947
|
-
/* @__PURE__ */ jsx(
|
|
948
|
-
RadioGroup.ChoiceBox,
|
|
949
|
-
{
|
|
950
|
-
value: "fixed",
|
|
951
|
-
label: t("promotions.form.value_type.fixed.title"),
|
|
952
|
-
description: t("promotions.form.value_type.fixed.description"),
|
|
953
|
-
className: clx("basis-1/2"),
|
|
954
|
-
"data-testid": "promotion-create-form-value-type-option-fixed"
|
|
955
|
-
}
|
|
956
|
-
),
|
|
957
|
-
/* @__PURE__ */ jsx(
|
|
958
|
-
RadioGroup.ChoiceBox,
|
|
959
|
-
{
|
|
960
|
-
value: "percentage",
|
|
961
|
-
label: t("promotions.form.value_type.percentage.title"),
|
|
962
|
-
description: t(
|
|
963
|
-
"promotions.form.value_type.percentage.description"
|
|
964
|
-
),
|
|
965
|
-
className: clx("basis-1/2"),
|
|
966
|
-
"data-testid": "promotion-create-form-value-type-option-percentage"
|
|
967
|
-
}
|
|
968
|
-
)
|
|
969
|
-
]
|
|
970
|
-
}
|
|
971
|
-
) }),
|
|
972
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-value-type-error" })
|
|
973
|
-
] });
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
)
|
|
977
|
-
] }),
|
|
978
|
-
!currentTemplate?.hiddenFields?.includes("application_method.value") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
979
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
980
|
-
/* @__PURE__ */ jsx(
|
|
981
|
-
Form.Field,
|
|
982
|
-
{
|
|
983
|
-
control: form.control,
|
|
984
|
-
name: "application_method.value",
|
|
985
|
-
render: ({ field: { onChange, value, ...field } }) => {
|
|
986
|
-
const currencyCode = form.getValues().application_method.currency_code;
|
|
987
|
-
const currencyInfo = currencies[currencyCode?.toUpperCase() || "USD"];
|
|
988
|
-
return /* @__PURE__ */ jsxs(
|
|
989
|
-
Form.Item,
|
|
990
|
-
{
|
|
991
|
-
className: "basis-1/2",
|
|
992
|
-
"data-testid": "promotion-create-form-value-item",
|
|
993
|
-
children: [
|
|
994
|
-
/* @__PURE__ */ jsx(
|
|
995
|
-
Form.Label,
|
|
996
|
-
{
|
|
997
|
-
tooltip: currencyCode || !isFixedValueType ? void 0 : t("promotions.fields.amount.tooltip"),
|
|
998
|
-
"data-testid": "promotion-create-form-value-label",
|
|
999
|
-
children: t("promotions.form.value.title")
|
|
1000
|
-
}
|
|
1001
|
-
),
|
|
1002
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-value-control", children: isFixedValueType ? /* @__PURE__ */ jsx(
|
|
1003
|
-
CurrencyInput,
|
|
1004
|
-
{
|
|
1005
|
-
...field,
|
|
1006
|
-
min: 0,
|
|
1007
|
-
code: currencyCode || "USD",
|
|
1008
|
-
onValueChange: (_value, _name, values) => onChange(values?.value),
|
|
1009
|
-
decimalScale: currencyInfo?.decimal_digits ?? 2,
|
|
1010
|
-
decimalsLimit: currencyInfo?.decimal_digits ?? 2,
|
|
1011
|
-
symbol: currencyCode ? getCurrencySymbol(currencyCode) : "$",
|
|
1012
|
-
value,
|
|
1013
|
-
disabled: !currencyCode,
|
|
1014
|
-
"data-testid": "promotion-create-form-value-currency-input"
|
|
1015
|
-
}
|
|
1016
|
-
) : /* @__PURE__ */ jsx(
|
|
1017
|
-
DeprecatedPercentageInput,
|
|
1018
|
-
{
|
|
1019
|
-
className: "text-right",
|
|
1020
|
-
min: 0,
|
|
1021
|
-
max: 100,
|
|
1022
|
-
...field,
|
|
1023
|
-
value,
|
|
1024
|
-
onChange: (e) => {
|
|
1025
|
-
onChange(
|
|
1026
|
-
e.target.value === "" ? null : parseFloat(e.target.value)
|
|
1027
|
-
);
|
|
1028
|
-
},
|
|
1029
|
-
"data-testid": "promotion-create-form-value-percentage-input"
|
|
1030
|
-
},
|
|
1031
|
-
"amount"
|
|
1032
|
-
) }),
|
|
1033
|
-
/* @__PURE__ */ jsx(
|
|
1034
|
-
Text,
|
|
1035
|
-
{
|
|
1036
|
-
size: "small",
|
|
1037
|
-
leading: "compact",
|
|
1038
|
-
className: "text-ui-fg-subtle",
|
|
1039
|
-
"data-testid": "promotion-create-form-value-description",
|
|
1040
|
-
children: /* @__PURE__ */ jsx(
|
|
1041
|
-
Trans,
|
|
1042
|
-
{
|
|
1043
|
-
t,
|
|
1044
|
-
i18nKey: isFixedValueType ? "promotions.form.value_type.fixed.description" : "promotions.form.value_type.percentage.description",
|
|
1045
|
-
components: [/* @__PURE__ */ jsx("br", {}, "break")]
|
|
1046
|
-
}
|
|
1047
|
-
)
|
|
1048
|
-
}
|
|
1049
|
-
),
|
|
1050
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-value-error" })
|
|
1051
|
-
]
|
|
1052
|
-
}
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
)
|
|
1057
|
-
] }),
|
|
1058
|
-
(isTypeStandard || isTypeBuyGet) && allocationMode !== "across" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1059
|
-
isTypeBuyGet && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Divider, {}) }),
|
|
1060
|
-
/* @__PURE__ */ jsx(
|
|
1061
|
-
Form.Field,
|
|
1062
|
-
{
|
|
1063
|
-
control: form.control,
|
|
1064
|
-
name: "application_method.max_quantity",
|
|
1065
|
-
render: () => {
|
|
1066
|
-
return /* @__PURE__ */ jsxs(
|
|
1067
|
-
Form.Item,
|
|
1068
|
-
{
|
|
1069
|
-
className: "basis-1/2",
|
|
1070
|
-
"data-testid": "promotion-create-form-max-quantity-item",
|
|
1071
|
-
children: [
|
|
1072
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-max-quantity-label", children: t("promotions.form.max_quantity.title") }),
|
|
1073
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-max-quantity-control", children: /* @__PURE__ */ jsx(
|
|
1074
|
-
Input,
|
|
1075
|
-
{
|
|
1076
|
-
...form.register("application_method.max_quantity", {
|
|
1077
|
-
valueAsNumber: true
|
|
1078
|
-
}),
|
|
1079
|
-
type: "number",
|
|
1080
|
-
min: 1,
|
|
1081
|
-
placeholder: "3",
|
|
1082
|
-
"data-testid": "promotion-create-form-max-quantity-input"
|
|
1083
|
-
}
|
|
1084
|
-
) }),
|
|
1085
|
-
/* @__PURE__ */ jsx(
|
|
1086
|
-
Text,
|
|
1087
|
-
{
|
|
1088
|
-
size: "small",
|
|
1089
|
-
leading: "compact",
|
|
1090
|
-
className: "text-ui-fg-subtle",
|
|
1091
|
-
"data-testid": "promotion-create-form-max-quantity-description",
|
|
1092
|
-
children: /* @__PURE__ */ jsx(
|
|
1093
|
-
Trans,
|
|
1094
|
-
{
|
|
1095
|
-
t,
|
|
1096
|
-
i18nKey: "promotions.form.max_quantity.description",
|
|
1097
|
-
components: [/* @__PURE__ */ jsx("br", {}, "break")]
|
|
1098
|
-
}
|
|
1099
|
-
)
|
|
1100
|
-
}
|
|
1101
|
-
),
|
|
1102
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-max-quantity-error" })
|
|
1103
|
-
]
|
|
1104
|
-
}
|
|
1105
|
-
);
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
)
|
|
1109
|
-
] }),
|
|
1110
|
-
!currentTemplate?.hiddenFields?.includes("application_method.allocation") && /* @__PURE__ */ jsx(
|
|
1111
|
-
Form.Field,
|
|
1112
|
-
{
|
|
1113
|
-
control: form.control,
|
|
1114
|
-
name: "application_method.allocation",
|
|
1115
|
-
render: ({ field }) => {
|
|
1116
|
-
const handleAllocationChange = (value) => {
|
|
1117
|
-
setAllocationMode(value);
|
|
1118
|
-
setValue(
|
|
1119
|
-
"application_method.allocation",
|
|
1120
|
-
value
|
|
1121
|
-
);
|
|
1122
|
-
field.onChange(value);
|
|
1123
|
-
if (value === "once") {
|
|
1124
|
-
setValue("application_method.max_quantity", 1);
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
return /* @__PURE__ */ jsxs(Form.Item, { "data-testid": "promotion-create-form-allocation-item", children: [
|
|
1128
|
-
/* @__PURE__ */ jsx(Form.Label, { "data-testid": "promotion-create-form-allocation-label", children: t("promotions.fields.allocation") }),
|
|
1129
|
-
/* @__PURE__ */ jsx(Form.Control, { "data-testid": "promotion-create-form-allocation-control", children: /* @__PURE__ */ jsxs(
|
|
1130
|
-
RadioGroup,
|
|
1131
|
-
{
|
|
1132
|
-
dir: direction,
|
|
1133
|
-
className: "flex gap-y-3",
|
|
1134
|
-
value: allocationMode,
|
|
1135
|
-
onValueChange: (val) => handleAllocationChange(val),
|
|
1136
|
-
"data-testid": "promotion-create-form-allocation-radio-group",
|
|
1137
|
-
children: [
|
|
1138
|
-
/* @__PURE__ */ jsx(
|
|
1139
|
-
RadioGroup.ChoiceBox,
|
|
1140
|
-
{
|
|
1141
|
-
value: "each",
|
|
1142
|
-
label: t("promotions.form.allocation.each.title"),
|
|
1143
|
-
description: t("promotions.form.allocation.each.description"),
|
|
1144
|
-
className: clx("basis-1/2"),
|
|
1145
|
-
"data-testid": "promotion-create-form-allocation-option-each"
|
|
1146
|
-
}
|
|
1147
|
-
),
|
|
1148
|
-
/* @__PURE__ */ jsx(
|
|
1149
|
-
RadioGroup.ChoiceBox,
|
|
1150
|
-
{
|
|
1151
|
-
value: "once",
|
|
1152
|
-
label: t("promotions.form.allocation.once.title", {
|
|
1153
|
-
defaultValue: "Once"
|
|
1154
|
-
}),
|
|
1155
|
-
description: t("promotions.form.allocation.once.description", {
|
|
1156
|
-
defaultValue: "Limit discount to max quantity"
|
|
1157
|
-
}),
|
|
1158
|
-
className: clx("basis-1/2"),
|
|
1159
|
-
"data-testid": "promotion-create-form-allocation-option-once"
|
|
1160
|
-
}
|
|
1161
|
-
)
|
|
1162
|
-
]
|
|
1163
|
-
}
|
|
1164
|
-
) }),
|
|
1165
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { "data-testid": "promotion-create-form-allocation-error" })
|
|
1166
|
-
] });
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
),
|
|
1170
|
-
!isTypeStandard && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1171
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
1172
|
-
/* @__PURE__ */ jsx(
|
|
1173
|
-
RulesFormField,
|
|
1174
|
-
{
|
|
1175
|
-
form,
|
|
1176
|
-
ruleType: "buy-rules",
|
|
1177
|
-
scope: "application_method.buy_rules"
|
|
1178
|
-
}
|
|
1179
|
-
)
|
|
1180
|
-
] }),
|
|
1181
|
-
!isTargetTypeOrder && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1182
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
1183
|
-
/* @__PURE__ */ jsx(
|
|
1184
|
-
RulesFormField,
|
|
1185
|
-
{
|
|
1186
|
-
form,
|
|
1187
|
-
ruleType: "target-rules",
|
|
1188
|
-
scope: "application_method.target_rules"
|
|
1189
|
-
}
|
|
1190
|
-
)
|
|
1191
|
-
] })
|
|
1192
|
-
] }) })
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1195
|
-
/* @__PURE__ */ jsx(
|
|
1196
|
-
ProgressTabs.Content,
|
|
1197
|
-
{
|
|
1198
|
-
value: "campaign" /* CAMPAIGN */,
|
|
1199
|
-
className: "size-full overflow-auto",
|
|
1200
|
-
"data-testid": "promotion-create-form-content-campaign",
|
|
1201
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8 py-16", children: /* @__PURE__ */ jsx(
|
|
1202
|
-
AddCampaignPromotionFields,
|
|
1203
|
-
{
|
|
1204
|
-
form,
|
|
1205
|
-
campaigns: campaigns || []
|
|
1206
|
-
}
|
|
1207
|
-
) }) })
|
|
1208
|
-
}
|
|
1209
|
-
)
|
|
1210
|
-
]
|
|
1211
|
-
}
|
|
1212
|
-
)
|
|
1213
|
-
]
|
|
1214
|
-
}
|
|
1215
|
-
),
|
|
1216
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { "data-testid": "promotion-create-form-footer", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
1217
|
-
/* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1218
|
-
Button,
|
|
1219
|
-
{
|
|
1220
|
-
variant: "secondary",
|
|
1221
|
-
size: "small",
|
|
1222
|
-
"data-testid": "promotion-create-form-cancel-button",
|
|
1223
|
-
children: t("actions.cancel")
|
|
1224
|
-
}
|
|
1225
|
-
) }),
|
|
1226
|
-
tab === "campaign" /* CAMPAIGN */ ? /* @__PURE__ */ jsx(
|
|
1227
|
-
Button,
|
|
1228
|
-
{
|
|
1229
|
-
type: "submit",
|
|
1230
|
-
size: "small",
|
|
1231
|
-
isLoading: false,
|
|
1232
|
-
"data-testid": "promotion-create-form-save-button",
|
|
1233
|
-
children: t("actions.save")
|
|
1234
|
-
},
|
|
1235
|
-
"save-btn"
|
|
1236
|
-
) : /* @__PURE__ */ jsx(
|
|
1237
|
-
Button,
|
|
1238
|
-
{
|
|
1239
|
-
type: "button",
|
|
1240
|
-
onClick: handleContinue,
|
|
1241
|
-
size: "small",
|
|
1242
|
-
"data-testid": "promotion-create-form-continue-button",
|
|
1243
|
-
children: t("actions.continue")
|
|
1244
|
-
},
|
|
1245
|
-
"continue-btn"
|
|
1246
|
-
)
|
|
1247
|
-
] }) })
|
|
1248
|
-
]
|
|
1249
|
-
}
|
|
1250
|
-
)
|
|
1251
|
-
}
|
|
1252
|
-
);
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
|
-
// src/pages/promotions/promotion-create/promotion-create.tsx
|
|
1256
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
1257
|
-
var PromotionCreate = () => {
|
|
1258
|
-
return /* @__PURE__ */ jsx2(RouteFocusModal, { children: /* @__PURE__ */ jsx2(CreatePromotionForm, {}) });
|
|
1259
|
-
};
|
|
1260
|
-
export {
|
|
1261
|
-
PromotionCreate as Component
|
|
1262
|
-
};
|