@mercurjs/admin 2.2.0-canary.18 → 2.2.0-canary.19
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-4QP4LF7G.js → add-campaign-promotions-KK4JMLSK.js} +3 -3
- package/dist/{adjust-inventory-AHIKDW7M.js → adjust-inventory-F3OTF6O6.js} +5 -5
- package/dist/{api-key-management-detail-ZRLG6YRB.js → api-key-management-detail-JMWPGN6M.js} +6 -6
- package/dist/{attribute-create-NIYUQEHQ.js → attribute-create-TJRNP5SK.js} +7 -7
- package/dist/{attribute-detail-GA4FDSAG.js → attribute-detail-7I2SQCDK.js} +6 -6
- package/dist/{attribute-edit-KJL36HQ4.js → attribute-edit-UBG6SMUF.js} +2 -2
- package/dist/{attribute-edit-possible-value-LGOD3ZKQ.js → attribute-edit-possible-value-3BYEPC4X.js} +2 -2
- package/dist/{attribute-list-A3RFO32Z.js → attribute-list-EFU4DPB5.js} +5 -5
- package/dist/{campaign-detail-A7ZM4Q7M.js → campaign-detail-H32E6EDD.js} +9 -9
- package/dist/{categories-metadata-FCV4YK74.js → categories-metadata-V37DXTVZ.js} +5 -5
- package/dist/{category-detail-CIEHVR4M.js → category-detail-5MRHPG6T.js} +10 -10
- package/dist/{category-products-AB3YAGSW.js → category-products-3KYY662O.js} +9 -9
- package/dist/{chunk-WUGV75DM.js → chunk-3F6U44M6.js} +1 -1
- package/dist/{chunk-IBX52HBP.js → chunk-3N7QXAMO.js} +1 -1
- package/dist/{chunk-K2C42QAV.js → chunk-4DYSSDAA.js} +4 -4
- package/dist/{chunk-2PUBUYFG.js → chunk-5GXPXVVD.js} +2 -2
- package/dist/{chunk-CIKXWLWE.js → chunk-6AYGDFNE.js} +2 -2
- package/dist/{chunk-G5DQCCPL.js → chunk-6LG3VL3Q.js} +2 -2
- package/dist/{chunk-A2GVK4VZ.js → chunk-AXVZ56UD.js} +2 -2
- package/dist/{chunk-2LKMOTLX.js → chunk-B7HIZN4V.js} +2 -2
- package/dist/{chunk-EOLSQKPV.js → chunk-BJQ4UBK7.js} +529 -480
- package/dist/{chunk-OMBP3YSV.js → chunk-CFBEBAQS.js} +1 -1
- package/dist/{chunk-FJRNNDZS.js → chunk-EASE3NLF.js} +1 -1
- package/dist/chunk-EG45GIE3.js +368 -0
- package/dist/{chunk-TWCYZF6X.js → chunk-EM5TF7YZ.js} +1 -1
- package/dist/{chunk-MEXH366L.js → chunk-FCLS6CKW.js} +2 -2
- package/dist/{chunk-ENFXIYIH.js → chunk-FYKG35MR.js} +1 -1
- package/dist/{chunk-VZ7GNMGX.js → chunk-GA4ZFAOV.js} +1 -1
- package/dist/{chunk-RZ5SFALB.js → chunk-GFUCELIZ.js} +2 -2
- package/dist/{chunk-OFOKVLV3.js → chunk-GHGOOZEL.js} +2 -2
- package/dist/{chunk-CVZA23ES.js → chunk-GNWWL47L.js} +3 -3
- package/dist/{chunk-MR3MLNWV.js → chunk-HYQPZADS.js} +1 -1
- package/dist/{chunk-DELK6EWH.js → chunk-IHTQOPB6.js} +1 -1
- package/dist/chunk-JEJQKTZO.js +191 -0
- package/dist/{chunk-5BF5JDWT.js → chunk-JWE2IW4R.js} +5 -5
- package/dist/chunk-KZB7LCF2.js +82 -0
- package/dist/{chunk-N6YOACEW.js → chunk-L5Z4JGRD.js} +1 -1
- package/dist/{chunk-3VDLE5GA.js → chunk-LVCIAKJI.js} +1 -1
- package/dist/{chunk-PE6JFXWU.js → chunk-MFIT2RX5.js} +1 -1
- package/dist/{chunk-ZB4TESPP.js → chunk-O62SUNK2.js} +16 -7
- package/dist/{chunk-Q5WTOVZZ.js → chunk-O63MLTQV.js} +71 -0
- package/dist/{chunk-WPVDACTL.js → chunk-OA24YN34.js} +1 -1
- package/dist/{chunk-3DMUKRIX.js → chunk-OXONMLRP.js} +2 -2
- package/dist/{chunk-LJDGVBOQ.js → chunk-PJR6W35H.js} +1 -1
- package/dist/chunk-PN5C4AND.js +115 -0
- package/dist/chunk-QR3GYYX6.js +0 -0
- package/dist/{chunk-VT6QIVZW.js → chunk-RMAQKNBA.js} +10 -1
- package/dist/{chunk-IEPH6A2W.js → chunk-RV7DWZZB.js} +2 -2
- package/dist/chunk-RXRDZ47F.js +103 -0
- package/dist/{chunk-623TMW36.js → chunk-T53YX34K.js} +1 -1
- package/dist/{chunk-EYFWEKFJ.js → chunk-TLOJG7LK.js} +2 -2
- package/dist/{chunk-7Y6A7XK6.js → chunk-UCHVBAUB.js} +2 -2
- package/dist/{chunk-47W2JHOE.js → chunk-UT2O7IS7.js} +2 -2
- package/dist/{chunk-B4K7H6DH.js → chunk-UUTACMA5.js} +1 -1
- package/dist/{chunk-JSMUFZZN.js → chunk-WHIYSLYW.js} +1 -1
- package/dist/{chunk-SEQJOCTT.js → chunk-X4N7EMFO.js} +2 -2
- package/dist/{chunk-RUSMGNQ6.js → chunk-X7E65HM2.js} +1 -1
- package/dist/{chunk-RWRL4AXD.js → chunk-XKD67CD4.js} +2 -2
- package/dist/{chunk-UCYSCKZV.js → chunk-Y7FNFQCU.js} +1 -6
- package/dist/{chunk-HEGPAGJT.js → chunk-YI7I7JFX.js} +2 -2
- package/dist/{chunk-EB6ZFOTO.js → chunk-YLK2WZU3.js} +2 -2
- package/dist/{chunk-OCRKS4Z7.js → chunk-ZDJWTF64.js} +2 -2
- package/dist/{chunk-T4GL73RP.js → chunk-ZG6DNI7O.js} +1 -1
- package/dist/{chunk-OHOWEMHO.js → chunk-ZIFHQXP3.js} +31 -25
- package/dist/{collection-add-products-KTUW23TD.js → collection-add-products-4EZ6W4N6.js} +9 -9
- package/dist/{collection-detail-TR7TDQZG.js → collection-detail-X22ZIM5S.js} +10 -10
- package/dist/{collection-list-FOWSOTS7.js → collection-list-6CUEOLUU.js} +9 -9
- package/dist/{collection-metadata-DS32TGOK.js → collection-metadata-AWJYPZKR.js} +5 -5
- package/dist/commission-rule-commission-edit-TA3H3EEN.js +196 -0
- package/dist/commission-rule-create-O7Z25SC7.js +412 -0
- package/dist/commission-rule-detail-I7LVSNAM.js +45 -0
- package/dist/commission-rule-edit-YSHDTYZY.js +342 -0
- package/dist/{commission-rate-list-Y5XLEO67.js → commissions-list-OUGVPED6.js} +13 -4
- package/dist/{customer-detail-5XGZ2K3H.js → customer-detail-6MBW3FHO.js} +6 -6
- package/dist/{customer-group-detail-JX3BEYFG.js → customer-group-detail-G53RB6EA.js} +5 -5
- package/dist/{customer-group-list-F5TFLDVH.js → customer-group-list-XDNCZ4K6.js} +5 -5
- package/dist/{customer-group-metadata-CHOTUAS2.js → customer-group-metadata-FWLKUHIZ.js} +5 -5
- package/dist/{customer-metadata-LG6HA56I.js → customer-metadata-KU4YWD3R.js} +5 -5
- package/dist/{customers-add-customer-group-3YKZEZKJ.js → customers-add-customer-group-5Y5XPN7C.js} +5 -5
- package/dist/{edit-inventory-item-5EYVQ6CM.js → edit-inventory-item-MBLHBGBH.js} +5 -5
- package/dist/{edit-inventory-item-attributes-7QM4YHAQ.js → edit-inventory-item-attributes-GTTGNBO4.js} +5 -5
- package/dist/{edit-rules-2S5H7MC2.js → edit-rules-UFGKSAJV.js} +5 -5
- package/dist/global-commission-edit-LCD6JJUX.js +194 -0
- package/dist/index.js +158 -150
- package/dist/{inventory-create-RBMMOSC3.js → inventory-create-4O4L6NXK.js} +5 -5
- package/dist/{inventory-detail-LSAJ3ZB5.js → inventory-detail-ZWHSLLLI.js} +5 -5
- package/dist/{inventory-metadata-OZAKLWNY.js → inventory-metadata-GZYYWU3S.js} +5 -5
- package/dist/{inventory-stock-WUAIUFQS.js → inventory-stock-S5B6ZZQW.js} +5 -5
- package/dist/{location-detail-PBCP7BBV.js → location-detail-QS7HM2KG.js} +5 -5
- package/dist/{location-fulfillment-providers-D4EFIF3Z.js → location-fulfillment-providers-6RUGYQ3W.js} +7 -7
- package/dist/{location-list-DM4WU57J.js → location-list-7RTDLHGR.js} +5 -5
- package/dist/{location-service-zone-shipping-option-create-T4LT4E6M.js → location-service-zone-shipping-option-create-UKULBDGM.js} +5 -5
- package/dist/{login-LTASZXSR.js → login-SFGV4QGP.js} +5 -5
- package/dist/{marketplace-detail-GSPPUVR7.js → marketplace-detail-7VPTFUPB.js} +5 -5
- package/dist/{marketplace-metadata-PB7JEK2K.js → marketplace-metadata-E25VT5TH.js} +5 -5
- package/dist/{offers-D2QQQD2F.js → offers-WYAJB75N.js} +9 -9
- package/dist/{order-create-claim-HND7RODU.js → order-create-claim-3AQK3FH2.js} +3 -3
- package/dist/{order-create-edit-LIQGALQ2.js → order-create-edit-UFD26FE2.js} +2 -2
- package/dist/{order-create-exchange-QE2TJ36U.js → order-create-exchange-QCYD3DC4.js} +7 -7
- package/dist/{order-create-refund-37JJA6MM.js → order-create-refund-TR4XMHRY.js} +5 -5
- package/dist/{order-create-return-AVVT3OUO.js → order-create-return-Y7QS52UL.js} +2 -2
- package/dist/{order-detail-A2WC2OZU.js → order-detail-FZT74HMD.js} +10 -10
- package/dist/{order-edit-billing-address-IPWVSYR2.js → order-edit-billing-address-OJZICMBN.js} +6 -6
- package/dist/{order-edit-email-ZQZNTV4P.js → order-edit-email-TH26N5HK.js} +5 -5
- package/dist/{order-edit-shipping-address-YPYWT3YN.js → order-edit-shipping-address-GBOUGZPD.js} +5 -5
- package/dist/{order-list-QR3ZVI4U.js → order-list-C5YOR6B5.js} +2 -2
- package/dist/{order-metadata-E25YHGCC.js → order-metadata-RT3BVTYZ.js} +5 -5
- package/dist/{order-request-transfer-XDNXRB66.js → order-request-transfer-3HTFPYFD.js} +5 -5
- package/dist/pages/index.d.ts +5 -23
- package/dist/pages/index.js +79 -77
- package/dist/{price-list-create-GBUUE3NP.js → price-list-create-XQWV352E.js} +10 -10
- package/dist/{price-list-detail-77FAEXXO.js → price-list-detail-347UU3LU.js} +10 -10
- package/dist/{price-list-prices-add-2XS5TX5X.js → price-list-prices-add-R656I6QF.js} +10 -10
- package/dist/{price-list-prices-edit-C2C3I64A.js → price-list-prices-edit-BOKBTLEI.js} +5 -5
- package/dist/{product-add-existing-attributes-NFXKW6SW.js → product-add-existing-attributes-MNGWZFGD.js} +7 -7
- package/dist/{product-create-AG4AYDM3.js → product-create-LMYR36NA.js} +9 -9
- package/dist/{product-create-variant-7DVYYUDX.js → product-create-variant-XETT2WJC.js} +3 -3
- package/dist/{product-detail-CNVETME5.js → product-detail-WSL4PXKK.js} +7 -7
- package/dist/{product-edit-attribute-GXFMVPCQ.js → product-edit-attribute-XEYHQJ6D.js} +2 -2
- package/dist/{product-list-KM37QJ6F.js → product-list-7YPGRGHX.js} +10 -10
- package/dist/{product-media-H5DAWUYR.js → product-media-H6SYBNLI.js} +2 -2
- package/dist/{product-metadata-4ZLL42UF.js → product-metadata-MGLJJ7QG.js} +5 -5
- package/dist/{product-tag-create-KKRQQT3A.js → product-tag-create-JCYAG42N.js} +5 -5
- package/dist/{product-tag-detail-R6UFJDCW.js → product-tag-detail-AUNKJJLP.js} +12 -12
- package/dist/{product-tag-edit-TISDF4FQ.js → product-tag-edit-2FREKKVN.js} +5 -5
- package/dist/{product-tag-list-NFPQVVMO.js → product-tag-list-IKL46JZT.js} +12 -12
- package/dist/{product-tag-metadata-GJFYX5HU.js → product-tag-metadata-UV3TBPXS.js} +5 -5
- package/dist/{product-type-detail-XJPSQDL2.js → product-type-detail-DKHKFADI.js} +13 -13
- package/dist/{product-type-metadata-GKVLFBF6.js → product-type-metadata-22OACFMD.js} +8 -8
- package/dist/{product-variant-detail-VCMC4BZP.js → product-variant-detail-MNMJBYIP.js} +5 -5
- package/dist/{product-variant-edit-QLDFN6LI.js → product-variant-edit-THZLEOGL.js} +7 -7
- package/dist/{product-variant-metadata-VZZMPRRG.js → product-variant-metadata-7N7PL7WY.js} +5 -5
- package/dist/{promotion-create-POBB7B23.js → promotion-create-RB3AA5GE.js} +5 -5
- package/dist/{promotion-detail-NSOGXQAY.js → promotion-detail-PEDTLXZ4.js} +8 -8
- package/dist/{promotion-list-7C3SQCSO.js → promotion-list-MCYWN5TF.js} +4 -4
- package/dist/{refund-reason-create-HPLJOL6S.js → refund-reason-create-YWA5XP4J.js} +5 -5
- package/dist/{refund-reason-edit-JI4U4RWO.js → refund-reason-edit-MBG5WL43.js} +5 -5
- package/dist/{refund-reason-list-SWU4B2ED.js → refund-reason-list-GPDRI2QM.js} +10 -10
- package/dist/{region-metadata-LDWMTB7G.js → region-metadata-WDZ7DRGU.js} +5 -5
- package/dist/{reservation-detail-BLPISKPA.js → reservation-detail-WTYOR6IB.js} +5 -5
- package/dist/{reservation-metadata-AZ265HZI.js → reservation-metadata-PJVHEJRU.js} +5 -5
- package/dist/{reset-password-6CAYNSJ6.js → reset-password-2NVKH6QA.js} +1 -1
- package/dist/{return-reason-list-7HTIV7NK.js → return-reason-list-E6L7VJY7.js} +5 -5
- package/dist/{sales-channel-add-products-S47CQCJF.js → sales-channel-add-products-BKT3CFLY.js} +9 -9
- package/dist/{sales-channel-detail-6JPHP4FZ.js → sales-channel-detail-MUBMJGQV.js} +10 -10
- package/dist/{sales-channel-list-D673ONK2.js → sales-channel-list-O5SFOGMA.js} +5 -5
- package/dist/{sales-channel-metadata-OY47MCFI.js → sales-channel-metadata-67RGBA7X.js} +5 -5
- package/dist/{shipping-option-type-create-H2YRDETZ.js → shipping-option-type-create-OBF6GG5W.js} +5 -5
- package/dist/{shipping-option-type-detail-NVSXILP4.js → shipping-option-type-detail-TJC2GBUA.js} +7 -7
- package/dist/{shipping-option-type-edit-KBPDYAUJ.js → shipping-option-type-edit-INKLJRSH.js} +5 -5
- package/dist/{shipping-option-type-list-OUKJZJ6R.js → shipping-option-type-list-WKA64NYE.js} +7 -7
- package/dist/{shipping-profile-metadata-CQCDC45M.js → shipping-profile-metadata-RI6Y2N6V.js} +5 -5
- package/dist/{store-bulk-edit-DXWHZMGL.js → store-bulk-edit-WML2DUA4.js} +1 -1
- package/dist/{store-create-MVHUY3I3.js → store-create-AGF2LZWR.js} +5 -5
- package/dist/{store-details-V3NMV665.js → store-details-3HWOCRYI.js} +11 -11
- package/dist/{store-edit-6CC2GBFY.js → store-edit-5WWOOSHT.js} +3 -3
- package/dist/{store-list-WV6XHGLU.js → store-list-YEEKX2AV.js} +9 -9
- package/dist/{store-member-invite-7YIXFC56.js → store-member-invite-TULPI3N5.js} +1 -1
- package/dist/{tax-region-create-RGE5ZIBR.js → tax-region-create-X2LAHX27.js} +6 -6
- package/dist/{tax-region-detail-OKEK6WNJ.js → tax-region-detail-3X3TNFJA.js} +5 -5
- package/dist/{tax-region-edit-QQ3LB74P.js → tax-region-edit-7ECYGXEA.js} +5 -5
- package/dist/{tax-region-metadata-GPTD6KZB.js → tax-region-metadata-FQLEYY2R.js} +5 -5
- package/dist/{tax-region-province-detail-WHO3RLUX.js → tax-region-province-detail-DIV5AAFQ.js} +5 -5
- package/dist/{tax-region-tax-override-create-223MPYUG.js → tax-region-tax-override-create-BV4O3QCU.js} +14 -16
- package/dist/{tax-region-tax-override-edit-WFOXP6A7.js → tax-region-tax-override-edit-QUA77YTI.js} +16 -18
- package/dist/{user-metadata-A3JS6O4K.js → user-metadata-64LX64QI.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-AKTAFKIU.js +0 -228
- package/dist/chunk-HLJ24XVH.js +0 -390
- package/dist/chunk-SWL7ZCP3.js +0 -11
- package/dist/commission-rate-create-G42ZUJPH.js +0 -782
- package/dist/commission-rate-detail-VGYTGWLH.js +0 -85
- package/dist/commission-rate-edit-3CYWYOMS.js +0 -767
|
@@ -1,767 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TargetForm,
|
|
3
|
-
TargetItem,
|
|
4
|
-
TaxRateRuleReferenceSchema
|
|
5
|
-
} from "./chunk-ZB4TESPP.js";
|
|
6
|
-
import "./chunk-5A4JNOK3.js";
|
|
7
|
-
import "./chunk-O5VKW5FL.js";
|
|
8
|
-
import "./chunk-LTBX54CI.js";
|
|
9
|
-
import "./chunk-LQAAVRET.js";
|
|
10
|
-
import "./chunk-AFQS6E4N.js";
|
|
11
|
-
import "./chunk-QG6PLWNH.js";
|
|
12
|
-
import "./chunk-DBYUB2YI.js";
|
|
13
|
-
import "./chunk-54EPH67T.js";
|
|
14
|
-
import "./chunk-4F5GP7J7.js";
|
|
15
|
-
import "./chunk-JQV7CXEC.js";
|
|
16
|
-
import "./chunk-KOURHC2N.js";
|
|
17
|
-
import "./chunk-2ZFELO2L.js";
|
|
18
|
-
import "./chunk-26OOAKQ6.js";
|
|
19
|
-
import "./chunk-ZQZHFMD7.js";
|
|
20
|
-
import "./chunk-I5THQVYP.js";
|
|
21
|
-
import "./chunk-J3AMUGGZ.js";
|
|
22
|
-
import "./chunk-CMHI2RPL.js";
|
|
23
|
-
import "./chunk-S2WEYEQR.js";
|
|
24
|
-
import {
|
|
25
|
-
PercentageInput
|
|
26
|
-
} from "./chunk-MAEP2UCK.js";
|
|
27
|
-
import "./chunk-HINXQTCW.js";
|
|
28
|
-
import "./chunk-HC25LNX7.js";
|
|
29
|
-
import "./chunk-MR3MLNWV.js";
|
|
30
|
-
import "./chunk-MG4GKUJW.js";
|
|
31
|
-
import "./chunk-AYVH6Q5O.js";
|
|
32
|
-
import "./chunk-VOHEQ7B5.js";
|
|
33
|
-
import "./chunk-N5IUYCUZ.js";
|
|
34
|
-
import "./chunk-7SVLKK6Q.js";
|
|
35
|
-
import "./chunk-GR6JUIRU.js";
|
|
36
|
-
import "./chunk-PVZBDWLK.js";
|
|
37
|
-
import "./chunk-QUHSHIAC.js";
|
|
38
|
-
import "./chunk-VKOE5J66.js";
|
|
39
|
-
import "./chunk-DY3XQPHC.js";
|
|
40
|
-
import "./chunk-NOWUEJ74.js";
|
|
41
|
-
import "./chunk-VW56KWO2.js";
|
|
42
|
-
import "./chunk-TZSOL34K.js";
|
|
43
|
-
import "./chunk-25LYVP3C.js";
|
|
44
|
-
import "./chunk-2Y3WMGN6.js";
|
|
45
|
-
import "./chunk-PXYDR7WQ.js";
|
|
46
|
-
import "./chunk-JHIMVLB2.js";
|
|
47
|
-
import "./chunk-JRTZWK77.js";
|
|
48
|
-
import "./chunk-OMBP3YSV.js";
|
|
49
|
-
import "./chunk-WPVDACTL.js";
|
|
50
|
-
import "./chunk-RZ5SFALB.js";
|
|
51
|
-
import "./chunk-LYZDVZWA.js";
|
|
52
|
-
import "./chunk-FWPGOIFA.js";
|
|
53
|
-
import "./chunk-DB6ANJBO.js";
|
|
54
|
-
import "./chunk-PHOCVOZ5.js";
|
|
55
|
-
import "./chunk-FQERBIVS.js";
|
|
56
|
-
import "./chunk-NQEXDLYH.js";
|
|
57
|
-
import "./chunk-YN3FGNJM.js";
|
|
58
|
-
import "./chunk-KAZ5BYTQ.js";
|
|
59
|
-
import "./chunk-634XVU3D.js";
|
|
60
|
-
import "./chunk-RT6L7JXU.js";
|
|
61
|
-
import "./chunk-4YWKKCTT.js";
|
|
62
|
-
import {
|
|
63
|
-
currencies,
|
|
64
|
-
getCurrencySymbol
|
|
65
|
-
} from "./chunk-IQPN4PZJ.js";
|
|
66
|
-
import "./chunk-TKGWSUEI.js";
|
|
67
|
-
import {
|
|
68
|
-
KeyboundForm
|
|
69
|
-
} from "./chunk-SITRHMZZ.js";
|
|
70
|
-
import {
|
|
71
|
-
RouteDrawer,
|
|
72
|
-
StackedDrawer,
|
|
73
|
-
useRouteModal,
|
|
74
|
-
useStackedModal
|
|
75
|
-
} from "./chunk-FWJLS7XD.js";
|
|
76
|
-
import {
|
|
77
|
-
Form
|
|
78
|
-
} from "./chunk-3QSRE5LS.js";
|
|
79
|
-
import "./chunk-WIYFXWRI.js";
|
|
80
|
-
import "./chunk-UZWFZMOX.js";
|
|
81
|
-
import "./chunk-XQNVC4Q7.js";
|
|
82
|
-
import "./chunk-THHRRYRS.js";
|
|
83
|
-
import "./chunk-UCYSCKZV.js";
|
|
84
|
-
import "./chunk-LJDGVBOQ.js";
|
|
85
|
-
import "./chunk-OH4AABUT.js";
|
|
86
|
-
import "./chunk-FJHAAROU.js";
|
|
87
|
-
import "./chunk-AEMDNTW5.js";
|
|
88
|
-
import "./chunk-LYD3C73Z.js";
|
|
89
|
-
import "./chunk-533GMKEG.js";
|
|
90
|
-
import "./chunk-46M463BR.js";
|
|
91
|
-
import "./chunk-YFRC6GEN.js";
|
|
92
|
-
import "./chunk-N6SI4IIT.js";
|
|
93
|
-
import "./chunk-JPNPTILP.js";
|
|
94
|
-
import "./chunk-DAXXLQKB.js";
|
|
95
|
-
import {
|
|
96
|
-
useBatchCommissionRules,
|
|
97
|
-
useCommissionRate,
|
|
98
|
-
useUpdateCommissionRate
|
|
99
|
-
} from "./chunk-OHOWEMHO.js";
|
|
100
|
-
import "./chunk-GKGLVDDV.js";
|
|
101
|
-
import "./chunk-ESPLVOFC.js";
|
|
102
|
-
import "./chunk-WJJXUXSO.js";
|
|
103
|
-
import "./chunk-LAPEZATU.js";
|
|
104
|
-
import "./chunk-Z2UBJXTU.js";
|
|
105
|
-
import "./chunk-QKJGSZI2.js";
|
|
106
|
-
import {
|
|
107
|
-
useStore
|
|
108
|
-
} from "./chunk-FXWKGNRV.js";
|
|
109
|
-
import "./chunk-VDKOJ5WD.js";
|
|
110
|
-
import "./chunk-ZN7LWXVC.js";
|
|
111
|
-
import "./chunk-XGUUM3S6.js";
|
|
112
|
-
import "./chunk-VYMODH6P.js";
|
|
113
|
-
import "./chunk-LEG67A2R.js";
|
|
114
|
-
import "./chunk-PRBE5CM3.js";
|
|
115
|
-
import "./chunk-5TRY5IMZ.js";
|
|
116
|
-
import "./chunk-EPHVGD5Z.js";
|
|
117
|
-
import "./chunk-VT6QIVZW.js";
|
|
118
|
-
import "./chunk-OKWGPKVK.js";
|
|
119
|
-
import "./chunk-KYFWVLWO.js";
|
|
120
|
-
import "./chunk-LAVHRER2.js";
|
|
121
|
-
import {
|
|
122
|
-
useDocumentDirection
|
|
123
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
124
|
-
import "./chunk-INNFZYX2.js";
|
|
125
|
-
import "./chunk-M2E3PKA4.js";
|
|
126
|
-
import "./chunk-RHKRREUU.js";
|
|
127
|
-
import "./chunk-ZA2KFUFR.js";
|
|
128
|
-
import "./chunk-ZBWL72TB.js";
|
|
129
|
-
import "./chunk-NBMM2TZK.js";
|
|
130
|
-
|
|
131
|
-
// src/pages/commission-rates/commission-rate-edit/commission-rate-edit.tsx
|
|
132
|
-
import { Heading as Heading2 } from "@medusajs/ui";
|
|
133
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
134
|
-
import { useParams } from "react-router-dom";
|
|
135
|
-
|
|
136
|
-
// src/pages/commission-rates/commission-rate-edit/components/edit-commission-rate-form/edit-commission-rate-form.tsx
|
|
137
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
138
|
-
import { MagnifyingGlass } from "@medusajs/icons";
|
|
139
|
-
import {
|
|
140
|
-
Button,
|
|
141
|
-
clx,
|
|
142
|
-
CurrencyInput,
|
|
143
|
-
Divider,
|
|
144
|
-
Heading,
|
|
145
|
-
Hint,
|
|
146
|
-
Input,
|
|
147
|
-
Label,
|
|
148
|
-
Select,
|
|
149
|
-
Switch,
|
|
150
|
-
Text,
|
|
151
|
-
toast
|
|
152
|
-
} from "@medusajs/ui";
|
|
153
|
-
import { useFieldArray, useForm, useWatch } from "react-hook-form";
|
|
154
|
-
import { useTranslation } from "react-i18next";
|
|
155
|
-
import * as zod from "zod";
|
|
156
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
157
|
-
var STACKED_MODAL_ID = "cr";
|
|
158
|
-
var getStackedModalId = (type) => `${STACKED_MODAL_ID}-${type}`;
|
|
159
|
-
var EditCommissionRateSchema = zod.object({
|
|
160
|
-
name: zod.string().min(1),
|
|
161
|
-
code: zod.string().min(1),
|
|
162
|
-
type: zod.enum(["fixed", "percentage"]),
|
|
163
|
-
target: zod.enum(["item", "shipping"]),
|
|
164
|
-
value: zod.coerce.number().min(0),
|
|
165
|
-
currency_code: zod.string().optional(),
|
|
166
|
-
min_amount: zod.coerce.number().optional(),
|
|
167
|
-
include_tax: zod.boolean(),
|
|
168
|
-
priority: zod.coerce.number().int().min(0),
|
|
169
|
-
enabled_rules: zod.object({
|
|
170
|
-
product: zod.boolean(),
|
|
171
|
-
product_type: zod.boolean(),
|
|
172
|
-
shipping_option: zod.boolean()
|
|
173
|
-
}),
|
|
174
|
-
product: zod.array(TaxRateRuleReferenceSchema).optional(),
|
|
175
|
-
product_type: zod.array(TaxRateRuleReferenceSchema).optional(),
|
|
176
|
-
shipping_option: zod.array(TaxRateRuleReferenceSchema).optional()
|
|
177
|
-
});
|
|
178
|
-
var getRulesByType = (rules, type) => {
|
|
179
|
-
return (rules || []).filter((r) => r.reference === type).map((r) => ({ value: r.reference_id, label: "" }));
|
|
180
|
-
};
|
|
181
|
-
var EditCommissionRateForm = ({
|
|
182
|
-
commissionRate
|
|
183
|
-
}) => {
|
|
184
|
-
const { t } = useTranslation();
|
|
185
|
-
const { handleSuccess } = useRouteModal();
|
|
186
|
-
const { setIsOpen } = useStackedModal();
|
|
187
|
-
const direction = useDocumentDirection();
|
|
188
|
-
const initialProducts = getRulesByType(
|
|
189
|
-
commissionRate.rules,
|
|
190
|
-
"product" /* PRODUCT */
|
|
191
|
-
);
|
|
192
|
-
const initialProductTypes = getRulesByType(
|
|
193
|
-
commissionRate.rules,
|
|
194
|
-
"product_type" /* PRODUCT_TYPE */
|
|
195
|
-
);
|
|
196
|
-
const initialShippingOptions = getRulesByType(
|
|
197
|
-
commissionRate.rules,
|
|
198
|
-
"shipping_option" /* SHIPPING_OPTION */
|
|
199
|
-
);
|
|
200
|
-
const form = useForm({
|
|
201
|
-
defaultValues: {
|
|
202
|
-
name: commissionRate.name,
|
|
203
|
-
code: commissionRate.code,
|
|
204
|
-
type: commissionRate.type,
|
|
205
|
-
target: commissionRate.target,
|
|
206
|
-
value: commissionRate.value,
|
|
207
|
-
currency_code: commissionRate.currency_code ?? "",
|
|
208
|
-
min_amount: commissionRate.min_amount ?? void 0,
|
|
209
|
-
include_tax: commissionRate.include_tax,
|
|
210
|
-
priority: commissionRate.priority,
|
|
211
|
-
enabled_rules: {
|
|
212
|
-
product: initialProducts.length > 0,
|
|
213
|
-
product_type: initialProductTypes.length > 0,
|
|
214
|
-
shipping_option: initialShippingOptions.length > 0
|
|
215
|
-
},
|
|
216
|
-
product: initialProducts,
|
|
217
|
-
product_type: initialProductTypes,
|
|
218
|
-
shipping_option: initialShippingOptions
|
|
219
|
-
},
|
|
220
|
-
resolver: zodResolver(EditCommissionRateSchema)
|
|
221
|
-
});
|
|
222
|
-
const { store } = useStore();
|
|
223
|
-
const storeCurrencies = (store?.supported_currencies ?? []).map(
|
|
224
|
-
(c) => currencies[c.currency_code.toUpperCase()]
|
|
225
|
-
);
|
|
226
|
-
const { mutateAsync: updateCommissionRate, isPending: isUpdating } = useUpdateCommissionRate(commissionRate.id);
|
|
227
|
-
const { mutateAsync: batchRules, isPending: isBatching } = useBatchCommissionRules(commissionRate.id);
|
|
228
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
229
|
-
const newRules = [
|
|
230
|
-
...(values.product || []).map((ref) => ({
|
|
231
|
-
reference: "product" /* PRODUCT */,
|
|
232
|
-
reference_id: ref.value
|
|
233
|
-
})),
|
|
234
|
-
...(values.product_type || []).map((ref) => ({
|
|
235
|
-
reference: "product_type" /* PRODUCT_TYPE */,
|
|
236
|
-
reference_id: ref.value
|
|
237
|
-
})),
|
|
238
|
-
...(values.shipping_option || []).map((ref) => ({
|
|
239
|
-
reference: "shipping_option" /* SHIPPING_OPTION */,
|
|
240
|
-
reference_id: ref.value
|
|
241
|
-
}))
|
|
242
|
-
];
|
|
243
|
-
const existingRules = commissionRate.rules || [];
|
|
244
|
-
const toCreate = newRules.filter(
|
|
245
|
-
(nr) => !existingRules.some(
|
|
246
|
-
(er) => er.reference === nr.reference && er.reference_id === nr.reference_id
|
|
247
|
-
)
|
|
248
|
-
);
|
|
249
|
-
const toDelete = existingRules.filter(
|
|
250
|
-
(er) => !newRules.some(
|
|
251
|
-
(nr) => nr.reference === er.reference && nr.reference_id === er.reference_id
|
|
252
|
-
)
|
|
253
|
-
).map((er) => er.id);
|
|
254
|
-
try {
|
|
255
|
-
await updateCommissionRate({
|
|
256
|
-
name: values.name,
|
|
257
|
-
code: values.code,
|
|
258
|
-
type: values.type,
|
|
259
|
-
target: values.target,
|
|
260
|
-
value: values.value,
|
|
261
|
-
currency_code: values.currency_code || null,
|
|
262
|
-
min_amount: values.min_amount ?? null,
|
|
263
|
-
include_tax: values.include_tax,
|
|
264
|
-
priority: values.priority
|
|
265
|
-
});
|
|
266
|
-
if (toCreate.length > 0 || toDelete.length > 0) {
|
|
267
|
-
await batchRules({
|
|
268
|
-
...toCreate.length > 0 ? { create: toCreate } : {},
|
|
269
|
-
...toDelete.length > 0 ? { delete: toDelete } : {}
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
toast.success(t("commissionRates.edit.successToast"));
|
|
273
|
-
handleSuccess();
|
|
274
|
-
} catch (e) {
|
|
275
|
-
toast.error(e.message);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
const watchType = form.watch("type");
|
|
279
|
-
const watchCurrency = form.watch("currency_code");
|
|
280
|
-
const products = useFieldArray({
|
|
281
|
-
control: form.control,
|
|
282
|
-
name: "product" /* PRODUCT */
|
|
283
|
-
});
|
|
284
|
-
const productTypes = useFieldArray({
|
|
285
|
-
control: form.control,
|
|
286
|
-
name: "product_type" /* PRODUCT_TYPE */
|
|
287
|
-
});
|
|
288
|
-
const shippingOptions = useFieldArray({
|
|
289
|
-
control: form.control,
|
|
290
|
-
name: "shipping_option" /* SHIPPING_OPTION */
|
|
291
|
-
});
|
|
292
|
-
const getControls = (type) => {
|
|
293
|
-
switch (type) {
|
|
294
|
-
case "product" /* PRODUCT */:
|
|
295
|
-
return products;
|
|
296
|
-
case "product_type" /* PRODUCT_TYPE */:
|
|
297
|
-
return productTypes;
|
|
298
|
-
case "shipping_option" /* SHIPPING_OPTION */:
|
|
299
|
-
return shippingOptions;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const referenceTypeOptions = [
|
|
303
|
-
{
|
|
304
|
-
value: "product" /* PRODUCT */,
|
|
305
|
-
label: t("taxRegions.fields.targets.options.product")
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
value: "product_type" /* PRODUCT_TYPE */,
|
|
309
|
-
label: t("taxRegions.fields.targets.options.productType")
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
value: "shipping_option" /* SHIPPING_OPTION */,
|
|
313
|
-
label: t("taxRegions.fields.targets.options.shippingOption")
|
|
314
|
-
}
|
|
315
|
-
];
|
|
316
|
-
const searchPlaceholders = {
|
|
317
|
-
["product" /* PRODUCT */]: t(
|
|
318
|
-
"taxRegions.fields.targets.placeholders.product"
|
|
319
|
-
),
|
|
320
|
-
["product_type" /* PRODUCT_TYPE */]: t(
|
|
321
|
-
"taxRegions.fields.targets.placeholders.productType"
|
|
322
|
-
),
|
|
323
|
-
["shipping_option" /* SHIPPING_OPTION */]: t(
|
|
324
|
-
"taxRegions.fields.targets.placeholders.shippingOption"
|
|
325
|
-
)
|
|
326
|
-
};
|
|
327
|
-
const getFieldHandler = (type) => {
|
|
328
|
-
const { fields, remove, prepend } = getControls(type);
|
|
329
|
-
const modalId = getStackedModalId(type);
|
|
330
|
-
return (references) => {
|
|
331
|
-
if (!references.length) {
|
|
332
|
-
form.setValue(type, [], { shouldDirty: true });
|
|
333
|
-
setIsOpen(modalId, false);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
const newIds = references.map((reference) => reference.value);
|
|
337
|
-
const fieldsToAdd = references.filter(
|
|
338
|
-
(reference) => !fields.some((field) => field.value === reference.value)
|
|
339
|
-
);
|
|
340
|
-
for (const field of fields) {
|
|
341
|
-
if (!newIds.includes(field.value)) {
|
|
342
|
-
remove(fields.indexOf(field));
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
prepend(fieldsToAdd);
|
|
346
|
-
setIsOpen(modalId, false);
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
const displayOrder = new Set(
|
|
350
|
-
[
|
|
351
|
-
initialProducts.length > 0 ? "product" /* PRODUCT */ : null,
|
|
352
|
-
initialProductTypes.length > 0 ? "product_type" /* PRODUCT_TYPE */ : null,
|
|
353
|
-
initialShippingOptions.length > 0 ? "shipping_option" /* SHIPPING_OPTION */ : null
|
|
354
|
-
].filter(Boolean)
|
|
355
|
-
);
|
|
356
|
-
const disableRule = (type) => {
|
|
357
|
-
form.setValue(type, [], { shouldDirty: true });
|
|
358
|
-
form.setValue(`enabled_rules.${type}`, false, { shouldDirty: true });
|
|
359
|
-
displayOrder.delete(type);
|
|
360
|
-
};
|
|
361
|
-
const enableRule = (type) => {
|
|
362
|
-
form.setValue(`enabled_rules.${type}`, true, { shouldDirty: true });
|
|
363
|
-
form.setValue(type, [], { shouldDirty: true });
|
|
364
|
-
displayOrder.add(type);
|
|
365
|
-
};
|
|
366
|
-
const watchedEnabledRules = useWatch({
|
|
367
|
-
control: form.control,
|
|
368
|
-
name: "enabled_rules"
|
|
369
|
-
});
|
|
370
|
-
const addRule = () => {
|
|
371
|
-
const firstDisabledRule = Object.keys(watchedEnabledRules).find(
|
|
372
|
-
(key) => !watchedEnabledRules[key]
|
|
373
|
-
);
|
|
374
|
-
if (firstDisabledRule) {
|
|
375
|
-
enableRule(firstDisabledRule);
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
const visibleRuleTypes = referenceTypeOptions.filter((option) => watchedEnabledRules[option.value]).sort((a, b) => {
|
|
379
|
-
const orderArray = Array.from(displayOrder);
|
|
380
|
-
return orderArray.indexOf(a.value) - orderArray.indexOf(b.value);
|
|
381
|
-
});
|
|
382
|
-
const getAvailableRuleTypes = (type) => {
|
|
383
|
-
return referenceTypeOptions.filter((option) => {
|
|
384
|
-
return !visibleRuleTypes.some(
|
|
385
|
-
(visibleOption) => visibleOption.value === option.value
|
|
386
|
-
) || option.value === type;
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
const showAddButton = Object.values(watchedEnabledRules).some(
|
|
390
|
-
(value) => !value
|
|
391
|
-
);
|
|
392
|
-
const isPending = isUpdating || isBatching;
|
|
393
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
394
|
-
KeyboundForm,
|
|
395
|
-
{
|
|
396
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
397
|
-
onSubmit: handleSubmit,
|
|
398
|
-
children: [
|
|
399
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-6 overflow-auto", children: [
|
|
400
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
401
|
-
/* @__PURE__ */ jsx(
|
|
402
|
-
Form.Field,
|
|
403
|
-
{
|
|
404
|
-
control: form.control,
|
|
405
|
-
name: "name",
|
|
406
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
407
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.name") }),
|
|
408
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
409
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
410
|
-
] })
|
|
411
|
-
}
|
|
412
|
-
),
|
|
413
|
-
/* @__PURE__ */ jsx(
|
|
414
|
-
Form.Field,
|
|
415
|
-
{
|
|
416
|
-
control: form.control,
|
|
417
|
-
name: "code",
|
|
418
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
419
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.code") }),
|
|
420
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
421
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
422
|
-
] })
|
|
423
|
-
}
|
|
424
|
-
),
|
|
425
|
-
/* @__PURE__ */ jsx(
|
|
426
|
-
Form.Field,
|
|
427
|
-
{
|
|
428
|
-
control: form.control,
|
|
429
|
-
name: "type",
|
|
430
|
-
render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
431
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.type.label") }),
|
|
432
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
|
|
433
|
-
/* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
434
|
-
/* @__PURE__ */ jsxs(Select.Content, { children: [
|
|
435
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: t("commissionRates.fields.type.percentage") }),
|
|
436
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: t("commissionRates.fields.type.fixed") })
|
|
437
|
-
] })
|
|
438
|
-
] }) }),
|
|
439
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
440
|
-
] })
|
|
441
|
-
}
|
|
442
|
-
),
|
|
443
|
-
/* @__PURE__ */ jsx(
|
|
444
|
-
Form.Field,
|
|
445
|
-
{
|
|
446
|
-
control: form.control,
|
|
447
|
-
name: "target",
|
|
448
|
-
render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
449
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.target.label") }),
|
|
450
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
|
|
451
|
-
/* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
452
|
-
/* @__PURE__ */ jsxs(Select.Content, { children: [
|
|
453
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "item", children: t("commissionRates.fields.target.item") }),
|
|
454
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "shipping", children: t("commissionRates.fields.target.shipping") })
|
|
455
|
-
] })
|
|
456
|
-
] }) }),
|
|
457
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
458
|
-
] })
|
|
459
|
-
}
|
|
460
|
-
),
|
|
461
|
-
/* @__PURE__ */ jsx(
|
|
462
|
-
Form.Field,
|
|
463
|
-
{
|
|
464
|
-
control: form.control,
|
|
465
|
-
name: "currency_code",
|
|
466
|
-
render: ({ field: { onChange, ref, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
467
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.currencyCode") }),
|
|
468
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(Select, { ...field, onValueChange: onChange, children: [
|
|
469
|
-
/* @__PURE__ */ jsx(Select.Trigger, { ref, children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("commissionRates.fields.currencyPlaceholder") }) }),
|
|
470
|
-
/* @__PURE__ */ jsx(Select.Content, { children: storeCurrencies.map((currency) => /* @__PURE__ */ jsx(
|
|
471
|
-
Select.Item,
|
|
472
|
-
{
|
|
473
|
-
value: currency.code.toLowerCase(),
|
|
474
|
-
children: currency.name
|
|
475
|
-
},
|
|
476
|
-
currency.code
|
|
477
|
-
)) })
|
|
478
|
-
] }) }),
|
|
479
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
480
|
-
] })
|
|
481
|
-
}
|
|
482
|
-
),
|
|
483
|
-
/* @__PURE__ */ jsx(
|
|
484
|
-
Form.Field,
|
|
485
|
-
{
|
|
486
|
-
control: form.control,
|
|
487
|
-
name: "value",
|
|
488
|
-
render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
489
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.rate") }),
|
|
490
|
-
/* @__PURE__ */ jsx(Form.Control, { children: watchType === "percentage" ? /* @__PURE__ */ jsx(
|
|
491
|
-
PercentageInput,
|
|
492
|
-
{
|
|
493
|
-
...field,
|
|
494
|
-
value,
|
|
495
|
-
decimalsLimit: 4,
|
|
496
|
-
onValueChange: (_value, _name, values) => onChange(values?.float ?? 0)
|
|
497
|
-
}
|
|
498
|
-
) : /* @__PURE__ */ jsx(
|
|
499
|
-
CurrencyInput,
|
|
500
|
-
{
|
|
501
|
-
min: 0,
|
|
502
|
-
onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
|
|
503
|
-
code: watchCurrency ?? "",
|
|
504
|
-
symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
|
|
505
|
-
...field,
|
|
506
|
-
value
|
|
507
|
-
}
|
|
508
|
-
) }),
|
|
509
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
510
|
-
] })
|
|
511
|
-
}
|
|
512
|
-
),
|
|
513
|
-
/* @__PURE__ */ jsx(
|
|
514
|
-
Form.Field,
|
|
515
|
-
{
|
|
516
|
-
control: form.control,
|
|
517
|
-
name: "min_amount",
|
|
518
|
-
render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
519
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.minAmount") }),
|
|
520
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
521
|
-
CurrencyInput,
|
|
522
|
-
{
|
|
523
|
-
min: 0,
|
|
524
|
-
onValueChange: (value2) => onChange(value2 ? parseInt(value2) : ""),
|
|
525
|
-
code: watchCurrency ?? "",
|
|
526
|
-
symbol: watchCurrency ? getCurrencySymbol(watchCurrency) : "",
|
|
527
|
-
...field,
|
|
528
|
-
value
|
|
529
|
-
}
|
|
530
|
-
) }),
|
|
531
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
532
|
-
] })
|
|
533
|
-
}
|
|
534
|
-
),
|
|
535
|
-
/* @__PURE__ */ jsx(
|
|
536
|
-
Form.Field,
|
|
537
|
-
{
|
|
538
|
-
control: form.control,
|
|
539
|
-
name: "priority",
|
|
540
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
541
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.priority") }),
|
|
542
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { type: "number", ...field }) }),
|
|
543
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
544
|
-
] })
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
/* @__PURE__ */ jsx(
|
|
548
|
-
Form.Field,
|
|
549
|
-
{
|
|
550
|
-
control: form.control,
|
|
551
|
-
name: "include_tax",
|
|
552
|
-
render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
553
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
554
|
-
/* @__PURE__ */ jsx(Form.Label, { children: t("commissionRates.fields.includeTax") }),
|
|
555
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
556
|
-
Switch,
|
|
557
|
-
{
|
|
558
|
-
...field,
|
|
559
|
-
checked: value,
|
|
560
|
-
onCheckedChange: onChange
|
|
561
|
-
}
|
|
562
|
-
) })
|
|
563
|
-
] }),
|
|
564
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
565
|
-
] })
|
|
566
|
-
}
|
|
567
|
-
)
|
|
568
|
-
] }),
|
|
569
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
570
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-4", children: [
|
|
571
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
572
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
|
|
573
|
-
/* @__PURE__ */ jsx(Label, { id: "commission_rules_label", htmlFor: "commission_rules", children: t("taxRegions.fields.targets.label") }),
|
|
574
|
-
/* @__PURE__ */ jsxs(
|
|
575
|
-
Text,
|
|
576
|
-
{
|
|
577
|
-
size: "small",
|
|
578
|
-
leading: "compact",
|
|
579
|
-
className: "text-ui-fg-muted",
|
|
580
|
-
children: [
|
|
581
|
-
"(",
|
|
582
|
-
t("fields.optional"),
|
|
583
|
-
")"
|
|
584
|
-
]
|
|
585
|
-
}
|
|
586
|
-
)
|
|
587
|
-
] }),
|
|
588
|
-
/* @__PURE__ */ jsx(Hint, { id: "commission_rules_description", className: "text-pretty", children: t("taxRegions.fields.targets.hint") })
|
|
589
|
-
] }),
|
|
590
|
-
showAddButton && /* @__PURE__ */ jsx(
|
|
591
|
-
Button,
|
|
592
|
-
{
|
|
593
|
-
onClick: addRule,
|
|
594
|
-
type: "button",
|
|
595
|
-
size: "small",
|
|
596
|
-
variant: "transparent",
|
|
597
|
-
className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover flex-shrink-0",
|
|
598
|
-
children: t("taxRegions.fields.targets.action")
|
|
599
|
-
}
|
|
600
|
-
)
|
|
601
|
-
] }),
|
|
602
|
-
/* @__PURE__ */ jsx(
|
|
603
|
-
"div",
|
|
604
|
-
{
|
|
605
|
-
id: "commission_rules",
|
|
606
|
-
"aria-labelledby": "commission_rules_label",
|
|
607
|
-
"aria-describedby": "commission_rules_description",
|
|
608
|
-
role: "application",
|
|
609
|
-
className: "flex flex-col gap-y-3",
|
|
610
|
-
children: visibleRuleTypes.map((ruleType, index) => {
|
|
611
|
-
const type = ruleType.value;
|
|
612
|
-
const label = ruleType.label;
|
|
613
|
-
const isLast = index === visibleRuleTypes.length - 1;
|
|
614
|
-
const searchPlaceholder = searchPlaceholders[type];
|
|
615
|
-
const options = getAvailableRuleTypes(type);
|
|
616
|
-
const modalId = getStackedModalId(type);
|
|
617
|
-
const { fields, remove } = getControls(type);
|
|
618
|
-
const handler = getFieldHandler(type);
|
|
619
|
-
const handleChangeType = (value) => {
|
|
620
|
-
disableRule(type);
|
|
621
|
-
enableRule(value);
|
|
622
|
-
};
|
|
623
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
624
|
-
Form.Field,
|
|
625
|
-
{
|
|
626
|
-
control: form.control,
|
|
627
|
-
name: ruleType.value,
|
|
628
|
-
render: ({
|
|
629
|
-
field: { value: _value, onChange: _onChange, ...field }
|
|
630
|
-
}) => {
|
|
631
|
-
return /* @__PURE__ */ jsxs(Form.Item, { className: "space-y-0", children: [
|
|
632
|
-
/* @__PURE__ */ jsx(Form.Label, { className: "sr-only", children: label }),
|
|
633
|
-
/* @__PURE__ */ jsxs(
|
|
634
|
-
"div",
|
|
635
|
-
{
|
|
636
|
-
className: clx(
|
|
637
|
-
"bg-ui-bg-component shadow-elevation-card-rest transition-fg grid gap-1.5 rounded-xl py-1.5",
|
|
638
|
-
"aria-[invalid='true']:shadow-borders-error"
|
|
639
|
-
),
|
|
640
|
-
role: "application",
|
|
641
|
-
...field,
|
|
642
|
-
children: [
|
|
643
|
-
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid gap-1.5 px-1.5 md:grid-cols-2", children: [
|
|
644
|
-
isLast ? /* @__PURE__ */ jsxs(
|
|
645
|
-
Select,
|
|
646
|
-
{
|
|
647
|
-
dir: direction,
|
|
648
|
-
value: type,
|
|
649
|
-
onValueChange: handleChangeType,
|
|
650
|
-
children: [
|
|
651
|
-
/* @__PURE__ */ jsx(Select.Trigger, { className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
|
|
652
|
-
/* @__PURE__ */ jsx(Select.Content, { children: options.map((option) => {
|
|
653
|
-
return /* @__PURE__ */ jsx(
|
|
654
|
-
Select.Item,
|
|
655
|
-
{
|
|
656
|
-
value: option.value,
|
|
657
|
-
children: option.label
|
|
658
|
-
},
|
|
659
|
-
option.value
|
|
660
|
-
);
|
|
661
|
-
}) })
|
|
662
|
-
]
|
|
663
|
-
}
|
|
664
|
-
) : /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: label }),
|
|
665
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field shadow-borders-base txt-compact-small rounded-md px-2 py-1.5", children: t("taxRegions.fields.targets.operators.in") })
|
|
666
|
-
] }),
|
|
667
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 px-1.5", children: [
|
|
668
|
-
/* @__PURE__ */ jsxs(StackedDrawer, { id: modalId, children: [
|
|
669
|
-
/* @__PURE__ */ jsx(StackedDrawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
670
|
-
"button",
|
|
671
|
-
{
|
|
672
|
-
type: "button",
|
|
673
|
-
className: "bg-ui-bg-field-component hover:bg-ui-bg-field-component-hover shadow-borders-base txt-compact-small text-ui-fg-muted transition-fg focus-visible:shadow-borders-interactive-with-active flex flex-1 items-center gap-x-2 rounded-md px-2 py-1.5 outline-none",
|
|
674
|
-
children: [
|
|
675
|
-
/* @__PURE__ */ jsx(MagnifyingGlass, {}),
|
|
676
|
-
searchPlaceholder
|
|
677
|
-
]
|
|
678
|
-
}
|
|
679
|
-
) }),
|
|
680
|
-
/* @__PURE__ */ jsx(StackedDrawer.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: t("actions.browse") }) }),
|
|
681
|
-
/* @__PURE__ */ jsxs(StackedDrawer.Content, { children: [
|
|
682
|
-
/* @__PURE__ */ jsxs(StackedDrawer.Header, { children: [
|
|
683
|
-
/* @__PURE__ */ jsx(StackedDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: t(
|
|
684
|
-
"taxRegions.fields.targets.modal.header"
|
|
685
|
-
) }) }),
|
|
686
|
-
/* @__PURE__ */ jsx(StackedDrawer.Description, { className: "sr-only", children: t("taxRegions.fields.targets.hint") })
|
|
687
|
-
] }),
|
|
688
|
-
/* @__PURE__ */ jsx(
|
|
689
|
-
TargetForm,
|
|
690
|
-
{
|
|
691
|
-
type: "drawer",
|
|
692
|
-
referenceType: type,
|
|
693
|
-
state: fields,
|
|
694
|
-
setState: handler
|
|
695
|
-
}
|
|
696
|
-
)
|
|
697
|
-
] })
|
|
698
|
-
] }),
|
|
699
|
-
/* @__PURE__ */ jsx(
|
|
700
|
-
Button,
|
|
701
|
-
{
|
|
702
|
-
variant: "secondary",
|
|
703
|
-
onClick: () => disableRule(type),
|
|
704
|
-
type: "button",
|
|
705
|
-
children: t("actions.delete")
|
|
706
|
-
}
|
|
707
|
-
)
|
|
708
|
-
] }),
|
|
709
|
-
fields.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
710
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
711
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-1.5", children: fields.map((field2, index2) => {
|
|
712
|
-
return /* @__PURE__ */ jsx(
|
|
713
|
-
TargetItem,
|
|
714
|
-
{
|
|
715
|
-
index: index2,
|
|
716
|
-
label: field2.label,
|
|
717
|
-
value: field2.value,
|
|
718
|
-
onRemove: remove
|
|
719
|
-
},
|
|
720
|
-
field2.id
|
|
721
|
-
);
|
|
722
|
-
}) })
|
|
723
|
-
] }) : null
|
|
724
|
-
]
|
|
725
|
-
}
|
|
726
|
-
),
|
|
727
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, { className: "mt-2" })
|
|
728
|
-
] });
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
) }, type);
|
|
732
|
-
})
|
|
733
|
-
}
|
|
734
|
-
)
|
|
735
|
-
] })
|
|
736
|
-
] }),
|
|
737
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Footer, { children: [
|
|
738
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: t("actions.cancel") }) }),
|
|
739
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: t("actions.save") })
|
|
740
|
-
] })
|
|
741
|
-
]
|
|
742
|
-
}
|
|
743
|
-
) });
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
// src/pages/commission-rates/commission-rate-edit/commission-rate-edit.tsx
|
|
747
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
748
|
-
var CommissionRateEdit = () => {
|
|
749
|
-
const { t } = useTranslation2();
|
|
750
|
-
const { id } = useParams();
|
|
751
|
-
const {
|
|
752
|
-
commission_rate,
|
|
753
|
-
isPending: isLoading,
|
|
754
|
-
isError,
|
|
755
|
-
error
|
|
756
|
-
} = useCommissionRate(id, { fields: "*rules" });
|
|
757
|
-
if (isError) {
|
|
758
|
-
throw error;
|
|
759
|
-
}
|
|
760
|
-
return /* @__PURE__ */ jsxs2(RouteDrawer, { children: [
|
|
761
|
-
/* @__PURE__ */ jsx2(RouteDrawer.Header, { children: /* @__PURE__ */ jsx2(Heading2, { children: t("commissionRates.edit.header") }) }),
|
|
762
|
-
!isLoading && commission_rate && /* @__PURE__ */ jsx2(EditCommissionRateForm, { commissionRate: commission_rate })
|
|
763
|
-
] });
|
|
764
|
-
};
|
|
765
|
-
export {
|
|
766
|
-
CommissionRateEdit as Component
|
|
767
|
-
};
|