@mercurjs/admin 2.2.0-canary.20 → 2.2.0-canary.22
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-BNLH6QN5.js → add-campaign-promotions-2IOKLEMG.js} +3 -3
- package/dist/{adjust-inventory-2LHBQAWK.js → adjust-inventory-KNHM7QEV.js} +6 -6
- package/dist/{api-key-management-detail-R5QQPNOD.js → api-key-management-detail-ELMPBXEB.js} +7 -7
- package/dist/{attribute-create-JW7OXOK2.js → attribute-create-Q3IEGYRG.js} +6 -6
- package/dist/{attribute-detail-3Z6MTMJT.js → attribute-detail-SDYWELHS.js} +6 -6
- package/dist/{attribute-list-WRTXTFED.js → attribute-list-HW3R6764.js} +6 -6
- package/dist/{campaign-detail-ROTJ4SWD.js → campaign-detail-5WNSQVKG.js} +10 -10
- package/dist/{categories-metadata-EPKUI3R4.js → categories-metadata-INVMU224.js} +6 -6
- package/dist/{category-detail-ICACLNJ3.js → category-detail-ABK4MEZP.js} +6 -6
- package/dist/{category-products-V4H3B6ML.js → category-products-HTNBFHSW.js} +6 -6
- package/dist/{chunk-A7RM5JXC.js → chunk-2H3KXP53.js} +1 -1
- package/dist/{chunk-KZB7LCF2.js → chunk-3EQOAHVG.js} +1 -1
- package/dist/{chunk-VKOE5J66.js → chunk-3XOE4NV5.js} +11 -2
- package/dist/{chunk-7XBB24GO.js → chunk-3ZCBTIIC.js} +1 -1
- package/dist/{chunk-SNCZQATG.js → chunk-4GRFDNQQ.js} +2 -2
- package/dist/{chunk-4Q5JHL4V.js → chunk-4O7GPTNJ.js} +1 -1
- package/dist/{chunk-AGXO2H4E.js → chunk-5PWXUMCA.js} +1 -1
- package/dist/{chunk-2HMWS5UW.js → chunk-67RX3M6X.js} +154 -23
- package/dist/{chunk-2MYHGOPY.js → chunk-7IVRL4AF.js} +1 -1
- package/dist/{chunk-7VPJ4C6F.js → chunk-7PAVVX2P.js} +1 -1
- package/dist/{chunk-HR7TFO2X.js → chunk-A3IFGUDD.js} +3 -3
- package/dist/{chunk-CMHI2RPL.js → chunk-AKSUGT5I.js} +21 -0
- package/dist/{chunk-7JZVZ5EX.js → chunk-ARN66CDK.js} +1 -1
- package/dist/{chunk-JEJQKTZO.js → chunk-ASNNJIW7.js} +2 -2
- package/dist/{chunk-RXRDZ47F.js → chunk-BHJFT3ST.js} +3 -3
- package/dist/chunk-BN6OOLJA.js +358 -0
- package/dist/{chunk-WETV577Q.js → chunk-CPWOVYZE.js} +1 -1
- package/dist/{chunk-JQV7CXEC.js → chunk-EDDKIVMF.js} +17 -2
- package/dist/{chunk-2NA54XKC.js → chunk-FP6YPFKF.js} +80 -7
- package/dist/{chunk-SJKLYS3R.js → chunk-IO5S4RFO.js} +3 -3
- package/dist/{chunk-HI6L7DXI.js → chunk-K7EOVKKV.js} +1 -1
- package/dist/{chunk-FFNSWUDC.js → chunk-LNPJFQWA.js} +11 -4
- package/dist/{chunk-KXIA66EJ.js → chunk-PAEKCYFU.js} +7 -3
- package/dist/{chunk-EG45GIE3.js → chunk-PAGH4K4C.js} +47 -14
- package/dist/{chunk-MHVZVF6O.js → chunk-PT3DTHQK.js} +1 -1
- package/dist/{chunk-PRBE5CM3.js → chunk-QYDWMBEX.js} +31 -0
- package/dist/{chunk-Z3SUMFDT.js → chunk-R2UDZINP.js} +214 -38
- package/dist/{chunk-Z2UBJXTU.js → chunk-RDTFLHYO.js} +1 -1
- package/dist/{chunk-IER5BQNC.js → chunk-RXZZEPW3.js} +1 -1
- package/dist/{chunk-BGQ7H2KL.js → chunk-SMQM5N45.js} +2 -2
- package/dist/{chunk-PN5C4AND.js → chunk-STPSVH3T.js} +1 -1
- package/dist/{chunk-I5THQVYP.js → chunk-XIFE4VUR.js} +1 -1
- package/dist/{chunk-4VXYPZMT.js → chunk-Z7AXFQPD.js} +2 -2
- package/dist/{chunk-PWFZCT6H.js → chunk-ZIIZGCTQ.js} +1 -1
- package/dist/{collection-add-products-PBCIG33C.js → collection-add-products-CKF2VFVK.js} +6 -6
- package/dist/{collection-create-7G3MHBVQ.js → collection-create-UNGPKT7H.js} +83 -12
- package/dist/{collection-detail-3OLBOV24.js → collection-detail-36QTD3ZU.js} +9 -7
- package/dist/collection-icon-edit-V4SNBMD5.js +117 -0
- package/dist/{collection-list-S4ICG5T6.js → collection-list-UN7C36DU.js} +15 -12
- package/dist/collection-media-ESJUYVF7.js +654 -0
- package/dist/{collection-metadata-VUOECEP4.js → collection-metadata-6SD67JUV.js} +6 -6
- package/dist/{commission-rule-commission-edit-TA3H3EEN.js → commission-rule-commission-edit-EAOSJNA2.js} +3 -3
- package/dist/{commission-rule-create-O7Z25SC7.js → commission-rule-create-X3AYVCQG.js} +183 -67
- package/dist/{commission-rule-detail-I7LVSNAM.js → commission-rule-detail-EITJYZG5.js} +3 -3
- package/dist/{commission-rule-edit-YSHDTYZY.js → commission-rule-edit-FZLHYL4A.js} +2 -2
- package/dist/{commissions-list-OUGVPED6.js → commissions-list-TT2ITT75.js} +4 -3
- package/dist/{customer-create-RW63XPQ6.js → customer-create-HZXLOIZH.js} +1 -1
- package/dist/{customer-create-address-SZCOIGDP.js → customer-create-address-AEZNVQOG.js} +1 -1
- package/dist/{customer-detail-MT2R7DFI.js → customer-detail-3OQ7RSDN.js} +9 -13
- package/dist/{customer-edit-ZBIZ4FKT.js → customer-edit-MMRTWOAF.js} +1 -1
- package/dist/customer-edit-address-AEYX2LMP.js +302 -0
- package/dist/{customer-group-add-customers-SG7EU4D7.js → customer-group-add-customers-4OAYSXWK.js} +2 -2
- package/dist/{customer-group-create-LFGY5HR6.js → customer-group-create-25JT74S3.js} +1 -1
- package/dist/{customer-group-detail-MCAEXZYM.js → customer-group-detail-CH4UIK3X.js} +8 -8
- package/dist/{customer-group-edit-CXWQSMDZ.js → customer-group-edit-AAI47MUL.js} +1 -1
- package/dist/{customer-group-list-V4PW33M5.js → customer-group-list-777C2B57.js} +9 -9
- package/dist/{customer-group-metadata-J622TR4I.js → customer-group-metadata-ELFKJMYK.js} +6 -6
- package/dist/{customer-list-MB6WZFMA.js → customer-list-U7VFBV7E.js} +3 -3
- package/dist/{customer-metadata-SFS5VRK5.js → customer-metadata-4H6ADARR.js} +6 -6
- package/dist/{customers-add-customer-group-G6FIKKUP.js → customers-add-customer-group-AZ3ILZMA.js} +8 -8
- package/dist/{edit-inventory-item-OFPVTJ4I.js → edit-inventory-item-NL5WNNI3.js} +6 -6
- package/dist/{edit-inventory-item-attributes-Z37AFIYM.js → edit-inventory-item-attributes-2JEH72WW.js} +6 -6
- package/dist/{edit-rules-JG62MLUS.js → edit-rules-XYTK7DQ2.js} +6 -6
- package/dist/{global-commission-edit-LCD6JJUX.js → global-commission-edit-3CEVUAAP.js} +46 -29
- package/dist/index.js +163 -151
- package/dist/{inventory-create-3IM54ZO3.js → inventory-create-7RQSCNCQ.js} +6 -6
- package/dist/{inventory-detail-POKYZVLA.js → inventory-detail-W7BGKWKL.js} +6 -6
- package/dist/{inventory-metadata-XXYKRUNP.js → inventory-metadata-ZGLTDSQB.js} +6 -6
- package/dist/{inventory-stock-CXPPGARO.js → inventory-stock-US7LGBC4.js} +6 -6
- package/dist/{location-detail-PHT367V5.js → location-detail-GAINHCV5.js} +6 -6
- package/dist/{location-fulfillment-providers-EZOVLJWL.js → location-fulfillment-providers-6DFBFALS.js} +8 -8
- package/dist/{location-list-HVSRDHOW.js → location-list-QXIHD6NJ.js} +6 -6
- package/dist/{location-service-zone-shipping-option-create-VZBL7MK6.js → location-service-zone-shipping-option-create-AUNZVIGU.js} +6 -6
- package/dist/{login-LJMTSRAG.js → login-NFPUZDAL.js} +6 -6
- package/dist/{marketplace-detail-WINAJJDB.js → marketplace-detail-M7DWNMIH.js} +6 -6
- package/dist/{marketplace-metadata-CCUK2B4Q.js → marketplace-metadata-FYJ7TJLZ.js} +6 -6
- package/dist/{offers-5LSNWJ6B.js → offers-PYM6LQSX.js} +6 -6
- package/dist/{order-create-exchange-6IQJFYUK.js → order-create-exchange-4PWNGE6U.js} +6 -6
- package/dist/{order-create-refund-DUVGD54U.js → order-create-refund-A4AXOFZC.js} +6 -6
- package/dist/{order-detail-Y6SFV44C.js → order-detail-HPYAUA2N.js} +7 -7
- package/dist/{order-edit-billing-address-IW6UIARN.js → order-edit-billing-address-5XHAAGT7.js} +7 -7
- package/dist/{order-edit-email-D5XIYASI.js → order-edit-email-44O3ARQ4.js} +6 -6
- package/dist/{order-edit-shipping-address-4VJDVGKJ.js → order-edit-shipping-address-UI2AHBXW.js} +6 -6
- package/dist/{order-list-KWHMMX2M.js → order-list-IVXCYRGB.js} +4 -4
- package/dist/{order-metadata-QSTGFW66.js → order-metadata-3U5KT3MW.js} +6 -6
- package/dist/{order-request-transfer-GYBTSHU4.js → order-request-transfer-OM3BPIWZ.js} +6 -6
- package/dist/pages/index.d.ts +33 -9
- package/dist/pages/index.js +95 -94
- package/dist/{price-list-configuration-SNL2LNV2.js → price-list-configuration-6LD6DTEQ.js} +6 -5
- package/dist/{price-list-create-LPJWSOBP.js → price-list-create-SR24HYH3.js} +11 -11
- package/dist/{price-list-detail-7AUDNRSM.js → price-list-detail-QIMJQ6DD.js} +9 -9
- package/dist/{price-list-edit-BOEBNVGM.js → price-list-edit-MEM47NGY.js} +2 -2
- package/dist/{price-list-list-AX7ZW6LL.js → price-list-list-GIVZGIYW.js} +4 -4
- package/dist/{price-list-prices-add-5IOYBCXV.js → price-list-prices-add-VE5RTT5O.js} +7 -7
- package/dist/{price-list-prices-edit-DT2DLFTO.js → price-list-prices-edit-R52K4MBL.js} +7 -7
- package/dist/{product-add-existing-attributes-LNZK2LHX.js → product-add-existing-attributes-AC4643LI.js} +6 -6
- package/dist/{product-create-QYEZHBTC.js → product-create-LY3HDOLG.js} +9 -9
- package/dist/{product-detail-Q6YF7IYX.js → product-detail-77DV4TAW.js} +6 -6
- package/dist/{product-list-IDRT4WUK.js → product-list-4JGMM4AF.js} +6 -6
- package/dist/{product-media-6H34CVXJ.js → product-media-PWPVCTC2.js} +2 -2
- package/dist/{product-metadata-VJMZL753.js → product-metadata-H53ZIWBS.js} +6 -6
- package/dist/{product-tag-create-4FYE46PE.js → product-tag-create-4OT4PMCG.js} +6 -6
- package/dist/{product-tag-detail-WF34TUQR.js → product-tag-detail-NVTDW7BR.js} +15 -13
- package/dist/{product-tag-edit-HRWMMCUC.js → product-tag-edit-RXF6ZZ6E.js} +6 -6
- package/dist/{product-tag-list-PK43EMMH.js → product-tag-list-T6BDTH24.js} +15 -13
- package/dist/{product-tag-metadata-ONSEQTEW.js → product-tag-metadata-HN5QRCYY.js} +6 -6
- package/dist/{product-type-detail-J466AJUQ.js → product-type-detail-KOGHJIMG.js} +6 -6
- package/dist/{product-type-metadata-CXYKP2OF.js → product-type-metadata-QUCMB3ZJ.js} +6 -6
- package/dist/{product-variant-detail-FXQZLB7Q.js → product-variant-detail-6XBLXEXQ.js} +6 -6
- package/dist/{product-variant-edit-CYEISGII.js → product-variant-edit-3KAFS4OC.js} +6 -6
- package/dist/{product-variant-metadata-YQ2GKWW7.js → product-variant-metadata-N5H2VPGQ.js} +6 -6
- package/dist/{promotion-create-KNK57JWD.js → promotion-create-Y2XVWGAT.js} +6 -6
- package/dist/{promotion-detail-EUQ5LK2V.js → promotion-detail-ORDL76NG.js} +9 -9
- package/dist/{promotion-list-M5SAE7A3.js → promotion-list-NMD23NXJ.js} +4 -4
- package/dist/{refund-reason-create-ANAVZO2N.js → refund-reason-create-CIXYHBRC.js} +6 -6
- package/dist/{refund-reason-edit-HKEVJ6A5.js → refund-reason-edit-AXMEDPRT.js} +6 -6
- package/dist/{refund-reason-list-FBH43XVP.js → refund-reason-list-F56TJAGR.js} +13 -11
- package/dist/{region-metadata-XHT3A6D7.js → region-metadata-QGH7IBQU.js} +6 -6
- package/dist/{reservation-detail-T3VHDWP6.js → reservation-detail-7TL2OFEM.js} +6 -6
- package/dist/{reservation-metadata-4LVLM4UW.js → reservation-metadata-UXACXYO6.js} +6 -6
- package/dist/{reset-password-RF5J4RIU.js → reset-password-GA3NEKEX.js} +1 -1
- package/dist/{return-reason-list-4JWWSFOS.js → return-reason-list-EJ5DLDR2.js} +7 -5
- package/dist/{sales-channel-add-products-FNJQKCQQ.js → sales-channel-add-products-7ERGMGJ7.js} +6 -6
- package/dist/{sales-channel-detail-HXJAR6M4.js → sales-channel-detail-LWVBJCJQ.js} +6 -6
- package/dist/{sales-channel-list-YYIH254X.js → sales-channel-list-I72W2XTH.js} +6 -6
- package/dist/{sales-channel-metadata-YF5AV2XX.js → sales-channel-metadata-RD6QDHRW.js} +6 -6
- package/dist/{shipping-option-type-create-TOONS7EC.js → shipping-option-type-create-LXYYXNSQ.js} +6 -6
- package/dist/{shipping-option-type-detail-VXZ4UQQI.js → shipping-option-type-detail-2IQSQ5BQ.js} +6 -6
- package/dist/{shipping-option-type-edit-6WO2XRLE.js → shipping-option-type-edit-4XKXWCN3.js} +6 -6
- package/dist/{shipping-option-type-list-S7TW7Q3R.js → shipping-option-type-list-QA2TA7XQ.js} +6 -6
- package/dist/{shipping-profile-metadata-SVD3WK7H.js → shipping-profile-metadata-PVNYV7DY.js} +6 -6
- package/dist/{store-create-7A5OSRIV.js → store-create-F6W5CSH2.js} +6 -6
- package/dist/{store-details-LSGSI4QU.js → store-details-CSHIHCVO.js} +10 -10
- package/dist/{store-edit-TP5CQHV7.js → store-edit-QJXV27DI.js} +2 -2
- package/dist/{store-list-KQGPNQQ4.js → store-list-FGLLHZPD.js} +10 -10
- package/dist/{tax-region-create-JR7OHOJ5.js → tax-region-create-MS6G5YVE.js} +7 -7
- package/dist/{tax-region-detail-2E56T5C2.js → tax-region-detail-EU5U3SFN.js} +6 -6
- package/dist/{tax-region-edit-7SBQFGPY.js → tax-region-edit-XHO3ELVD.js} +6 -6
- package/dist/{tax-region-metadata-4NUEQV3N.js → tax-region-metadata-NYTCYO6D.js} +6 -6
- package/dist/{tax-region-province-detail-5Q5E5OP7.js → tax-region-province-detail-U4RULBEK.js} +6 -6
- package/dist/{tax-region-tax-override-create-S5S5JZEJ.js → tax-region-tax-override-create-5MIAKHY6.js} +15 -13
- package/dist/{tax-region-tax-override-edit-JBG3MRNC.js → tax-region-tax-override-edit-EHLIO56A.js} +15 -13
- package/dist/{user-metadata-2D552EAR.js → user-metadata-VCWUSKHV.js} +6 -6
- package/package.json +1 -1
- package/dist/{chunk-WTPWO7KS.js → chunk-KAAUSK5T.js} +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionValueFields,
|
|
3
3
|
useStoreCurrencies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3EQOAHVG.js";
|
|
5
5
|
import {
|
|
6
6
|
buildValuesPayload,
|
|
7
7
|
fixedValuesFromRate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-STPSVH3T.js";
|
|
9
9
|
import "./chunk-MAEP2UCK.js";
|
|
10
10
|
import {
|
|
11
11
|
SwitchBox
|
|
@@ -81,7 +81,7 @@ var EditCommissionForm = ({ rule }) => {
|
|
|
81
81
|
onSuccess: () => {
|
|
82
82
|
toast.success(
|
|
83
83
|
t("commissions.commissionEdit.successToast", {
|
|
84
|
-
defaultValue: "Commission updated"
|
|
84
|
+
defaultValue: "Commission was successfully updated."
|
|
85
85
|
})
|
|
86
86
|
);
|
|
87
87
|
handleSuccess();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionValueFields,
|
|
3
3
|
useStoreCurrencies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3EQOAHVG.js";
|
|
5
5
|
import "./chunk-QR3GYYX6.js";
|
|
6
6
|
import {
|
|
7
7
|
SCOPE_TYPE_DIMENSIONS,
|
|
8
8
|
buildRulesFromScope,
|
|
9
9
|
buildValuesPayload
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-STPSVH3T.js";
|
|
11
11
|
import "./chunk-MAEP2UCK.js";
|
|
12
12
|
import {
|
|
13
13
|
useComboboxData
|
|
@@ -60,7 +60,7 @@ import { useForm } from "react-hook-form";
|
|
|
60
60
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
61
61
|
|
|
62
62
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-commission.tsx
|
|
63
|
-
import { Heading,
|
|
63
|
+
import { Heading, RadioGroup } from "@medusajs/ui";
|
|
64
64
|
import { useTranslation } from "react-i18next";
|
|
65
65
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
66
66
|
var CreateCommissionRuleCommission = () => {
|
|
@@ -77,15 +77,47 @@ var CreateCommissionRuleCommission = () => {
|
|
|
77
77
|
{
|
|
78
78
|
control: form.control,
|
|
79
79
|
name: "commissionType",
|
|
80
|
-
render: ({ field: { onChange,
|
|
80
|
+
render: ({ field: { onChange, ...rest } }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
81
81
|
/* @__PURE__ */ jsx(Form.Label, { children: t("commissions.fields.type.label", "Type") }),
|
|
82
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsxs(
|
|
83
|
+
RadioGroup,
|
|
84
|
+
{
|
|
85
|
+
dir: direction,
|
|
86
|
+
onValueChange: onChange,
|
|
87
|
+
...rest,
|
|
88
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
89
|
+
"data-testid": "commission-rule-commission-type-radio-group",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
RadioGroup.ChoiceBox,
|
|
93
|
+
{
|
|
94
|
+
value: "percentage",
|
|
95
|
+
label: t(
|
|
96
|
+
"commissions.fields.type.percentage",
|
|
97
|
+
"Percentage"
|
|
98
|
+
),
|
|
99
|
+
description: t(
|
|
100
|
+
"commissions.fields.type.percentageHint",
|
|
101
|
+
"Charge a percentage of the order total."
|
|
102
|
+
),
|
|
103
|
+
"data-testid": "commission-rule-commission-type-option-percentage"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
RadioGroup.ChoiceBox,
|
|
108
|
+
{
|
|
109
|
+
value: "fixed",
|
|
110
|
+
label: t("commissions.fields.type.fixed", "Fixed"),
|
|
111
|
+
description: t(
|
|
112
|
+
"commissions.fields.type.fixedHint",
|
|
113
|
+
"Charge a fixed amount per order."
|
|
114
|
+
),
|
|
115
|
+
"data-testid": "commission-rule-commission-type-option-fixed"
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
) }),
|
|
89
121
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
90
122
|
] })
|
|
91
123
|
}
|
|
@@ -133,11 +165,11 @@ var CreateCommissionRuleCommission = () => {
|
|
|
133
165
|
CreateCommissionRuleCommission._tabMeta = defineTabMeta({
|
|
134
166
|
id: "commission",
|
|
135
167
|
labelKey: "commissions.create.commission",
|
|
136
|
-
validationFields: ["commissionType"]
|
|
168
|
+
validationFields: ["commissionType", "value"]
|
|
137
169
|
});
|
|
138
170
|
|
|
139
171
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-details.tsx
|
|
140
|
-
import { Heading as Heading2, Input,
|
|
172
|
+
import { Heading as Heading2, Input, RadioGroup as RadioGroup2 } from "@medusajs/ui";
|
|
141
173
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
142
174
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
143
175
|
var CreateCommissionRuleDetails = () => {
|
|
@@ -173,58 +205,109 @@ var CreateCommissionRuleDetails = () => {
|
|
|
173
205
|
return /* @__PURE__ */ jsx2("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
174
206
|
/* @__PURE__ */ jsx2(Heading2, { children: t("commissions.create.details", "Details") }),
|
|
175
207
|
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-y-4", children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ jsx2(
|
|
190
|
-
Form.Field,
|
|
191
|
-
{
|
|
192
|
-
control: form.control,
|
|
193
|
-
name: "code",
|
|
194
|
-
render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
|
|
195
|
-
/* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.code", "Code") }),
|
|
196
|
-
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(Input, { autoComplete: "off", ...field }) }),
|
|
197
|
-
/* @__PURE__ */ jsx2(Form.ErrorMessage, {})
|
|
198
|
-
] })
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
] }),
|
|
208
|
+
/* @__PURE__ */ jsx2(
|
|
209
|
+
Form.Field,
|
|
210
|
+
{
|
|
211
|
+
control: form.control,
|
|
212
|
+
name: "title",
|
|
213
|
+
render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
|
|
214
|
+
/* @__PURE__ */ jsx2(Form.Label, { children: t("fields.title") }),
|
|
215
|
+
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(Input, { autoComplete: "off", ...field }) }),
|
|
216
|
+
/* @__PURE__ */ jsx2(Form.ErrorMessage, {})
|
|
217
|
+
] })
|
|
218
|
+
}
|
|
219
|
+
),
|
|
202
220
|
/* @__PURE__ */ jsx2(
|
|
203
221
|
Form.Field,
|
|
204
222
|
{
|
|
205
223
|
control: form.control,
|
|
206
224
|
name: "scopeType",
|
|
207
|
-
render: ({ field: { onChange,
|
|
225
|
+
render: ({ field: { onChange, ...rest } }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
|
|
208
226
|
/* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.scopeType.label", "Type") }),
|
|
209
|
-
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsxs2(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsxs2(
|
|
228
|
+
RadioGroup2,
|
|
229
|
+
{
|
|
230
|
+
dir: direction,
|
|
231
|
+
onValueChange: onChange,
|
|
232
|
+
...rest,
|
|
233
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
234
|
+
"data-testid": "commission-rule-scope-type-radio-group",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ jsx2(
|
|
237
|
+
RadioGroup2.ChoiceBox,
|
|
238
|
+
{
|
|
239
|
+
value: "store",
|
|
240
|
+
label: t("commissions.fields.scopeType.store", "Store"),
|
|
241
|
+
description: t(
|
|
242
|
+
"commissions.fields.scopeType.storeHint",
|
|
243
|
+
"Apply to specific stores."
|
|
244
|
+
),
|
|
245
|
+
"data-testid": "commission-rule-scope-type-option-store"
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ jsx2(
|
|
249
|
+
RadioGroup2.ChoiceBox,
|
|
250
|
+
{
|
|
251
|
+
value: "product_type",
|
|
252
|
+
label: t(
|
|
253
|
+
"commissions.fields.scopeType.productType",
|
|
254
|
+
"Product Type"
|
|
255
|
+
),
|
|
256
|
+
description: t(
|
|
257
|
+
"commissions.fields.scopeType.productTypeHint",
|
|
258
|
+
"Apply to specific product types."
|
|
259
|
+
),
|
|
260
|
+
"data-testid": "commission-rule-scope-type-option-product-type"
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ jsx2(
|
|
264
|
+
RadioGroup2.ChoiceBox,
|
|
265
|
+
{
|
|
266
|
+
value: "category",
|
|
267
|
+
label: t(
|
|
268
|
+
"commissions.fields.scopeType.category",
|
|
269
|
+
"Category"
|
|
270
|
+
),
|
|
271
|
+
description: t(
|
|
272
|
+
"commissions.fields.scopeType.categoryHint",
|
|
273
|
+
"Apply to specific categories."
|
|
274
|
+
),
|
|
275
|
+
"data-testid": "commission-rule-scope-type-option-category"
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ jsx2(
|
|
279
|
+
RadioGroup2.ChoiceBox,
|
|
280
|
+
{
|
|
281
|
+
value: "store_product_type",
|
|
282
|
+
label: t(
|
|
283
|
+
"commissions.fields.scopeType.storeProductType",
|
|
284
|
+
"Store + Product Type"
|
|
285
|
+
),
|
|
286
|
+
description: t(
|
|
287
|
+
"commissions.fields.scopeType.storeProductTypeHint",
|
|
288
|
+
"Apply to product types within specific stores."
|
|
289
|
+
),
|
|
290
|
+
"data-testid": "commission-rule-scope-type-option-store-product-type"
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ jsx2(
|
|
294
|
+
RadioGroup2.ChoiceBox,
|
|
295
|
+
{
|
|
296
|
+
value: "store_category",
|
|
297
|
+
label: t(
|
|
298
|
+
"commissions.fields.scopeType.storeCategory",
|
|
299
|
+
"Store + Category"
|
|
300
|
+
),
|
|
301
|
+
description: t(
|
|
302
|
+
"commissions.fields.scopeType.storeCategoryHint",
|
|
303
|
+
"Apply to categories within specific stores."
|
|
304
|
+
),
|
|
305
|
+
"data-testid": "commission-rule-scope-type-option-store-category"
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
) }),
|
|
228
311
|
/* @__PURE__ */ jsx2(Form.ErrorMessage, {})
|
|
229
312
|
] })
|
|
230
313
|
}
|
|
@@ -299,15 +382,20 @@ CreateCommissionRuleDetails._tabMeta = defineTabMeta(
|
|
|
299
382
|
{
|
|
300
383
|
id: "details",
|
|
301
384
|
labelKey: "commissions.create.details",
|
|
302
|
-
validationFields: [
|
|
385
|
+
validationFields: [
|
|
386
|
+
"title",
|
|
387
|
+
"scopeType",
|
|
388
|
+
"stores",
|
|
389
|
+
"productTypes",
|
|
390
|
+
"categories"
|
|
391
|
+
]
|
|
303
392
|
}
|
|
304
393
|
);
|
|
305
394
|
|
|
306
395
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/schema.ts
|
|
307
396
|
import * as zod from "zod";
|
|
308
397
|
var CreateCommissionRuleSchema = zod.object({
|
|
309
|
-
title: zod.string().min(1),
|
|
310
|
-
code: zod.string().min(1),
|
|
398
|
+
title: zod.string().min(1, "Please enter a title"),
|
|
311
399
|
scopeType: zod.enum([
|
|
312
400
|
"store",
|
|
313
401
|
"product_type",
|
|
@@ -319,10 +407,40 @@ var CreateCommissionRuleSchema = zod.object({
|
|
|
319
407
|
productTypes: zod.array(zod.string()),
|
|
320
408
|
categories: zod.array(zod.string()),
|
|
321
409
|
commissionType: zod.enum(["percentage", "fixed"]),
|
|
322
|
-
value: zod.coerce.number().
|
|
410
|
+
value: zod.coerce.number().optional(),
|
|
323
411
|
fixed_values: zod.record(zod.string(), zod.coerce.number()).optional(),
|
|
324
412
|
include_tax: zod.boolean(),
|
|
325
413
|
include_shipping: zod.boolean()
|
|
414
|
+
}).superRefine((data, ctx) => {
|
|
415
|
+
const dimensions = SCOPE_TYPE_DIMENSIONS[data.scopeType];
|
|
416
|
+
if (dimensions.includes("seller") && data.stores.length === 0) {
|
|
417
|
+
ctx.addIssue({
|
|
418
|
+
code: zod.ZodIssueCode.custom,
|
|
419
|
+
path: ["stores"],
|
|
420
|
+
message: "Please select at least one store"
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
if (dimensions.includes("product_type") && data.productTypes.length === 0) {
|
|
424
|
+
ctx.addIssue({
|
|
425
|
+
code: zod.ZodIssueCode.custom,
|
|
426
|
+
path: ["productTypes"],
|
|
427
|
+
message: "Please select at least one product type"
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (dimensions.includes("product_category") && data.categories.length === 0) {
|
|
431
|
+
ctx.addIssue({
|
|
432
|
+
code: zod.ZodIssueCode.custom,
|
|
433
|
+
path: ["categories"],
|
|
434
|
+
message: "Please select at least one category"
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
if (data.commissionType === "percentage" && (data.value === void 0 || Number.isNaN(data.value))) {
|
|
438
|
+
ctx.addIssue({
|
|
439
|
+
code: zod.ZodIssueCode.custom,
|
|
440
|
+
path: ["value"],
|
|
441
|
+
message: "Please enter a value."
|
|
442
|
+
});
|
|
443
|
+
}
|
|
326
444
|
});
|
|
327
445
|
|
|
328
446
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-form.tsx
|
|
@@ -334,13 +452,12 @@ var CreateCommissionRuleForm = () => {
|
|
|
334
452
|
const form = useForm({
|
|
335
453
|
defaultValues: {
|
|
336
454
|
title: "",
|
|
337
|
-
code: "",
|
|
338
455
|
scopeType: "store",
|
|
339
456
|
stores: [],
|
|
340
457
|
productTypes: [],
|
|
341
458
|
categories: [],
|
|
342
459
|
commissionType: "percentage",
|
|
343
|
-
value: 0,
|
|
460
|
+
value: void 0,
|
|
344
461
|
fixed_values: {},
|
|
345
462
|
include_tax: false,
|
|
346
463
|
include_shipping: false
|
|
@@ -358,7 +475,6 @@ var CreateCommissionRuleForm = () => {
|
|
|
358
475
|
await mutateAsync(
|
|
359
476
|
{
|
|
360
477
|
name: values.title,
|
|
361
|
-
code: values.code,
|
|
362
478
|
type: values.commissionType,
|
|
363
479
|
value: isFixed ? 0 : values.value,
|
|
364
480
|
...isFixed ? { values: buildValuesPayload(currencies, values.fixed_values) } : {},
|
|
@@ -371,7 +487,7 @@ var CreateCommissionRuleForm = () => {
|
|
|
371
487
|
onSuccess: ({ commission_rate }) => {
|
|
372
488
|
toast.success(
|
|
373
489
|
t("commissions.create.successToast", {
|
|
374
|
-
defaultValue: "Commission rule created"
|
|
490
|
+
defaultValue: "Commission rule was successfully created."
|
|
375
491
|
})
|
|
376
492
|
);
|
|
377
493
|
handleSuccess(`/settings/commissions/${commission_rate.id}`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionRuleDetail
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ASNNJIW7.js";
|
|
4
|
+
import "./chunk-BHJFT3ST.js";
|
|
5
|
+
import "./chunk-STPSVH3T.js";
|
|
6
6
|
import "./chunk-FI474ADU.js";
|
|
7
7
|
import "./chunk-3XPXUIK3.js";
|
|
8
8
|
import "./chunk-E74OUNA3.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
deriveScopeType,
|
|
5
5
|
diffScopeRules,
|
|
6
6
|
referenceIds
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-STPSVH3T.js";
|
|
8
8
|
import {
|
|
9
9
|
useComboboxData
|
|
10
10
|
} from "./chunk-5KGMGL4N.js";
|
|
@@ -126,7 +126,7 @@ var EditCommissionRuleForm = ({ rule }) => {
|
|
|
126
126
|
}
|
|
127
127
|
toast.success(
|
|
128
128
|
t("commissions.edit.successToast", {
|
|
129
|
-
defaultValue: "Commission rule updated"
|
|
129
|
+
defaultValue: "Commission rule was successfully updated."
|
|
130
130
|
})
|
|
131
131
|
);
|
|
132
132
|
handleSuccess();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionsPage
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-PAGH4K4C.js";
|
|
4
|
+
import "./chunk-BHJFT3ST.js";
|
|
5
|
+
import "./chunk-STPSVH3T.js";
|
|
6
6
|
import "./chunk-JHIMVLB2.js";
|
|
7
|
+
import "./chunk-DB6ANJBO.js";
|
|
7
8
|
import "./chunk-PHOCVOZ5.js";
|
|
8
9
|
import "./chunk-FQERBIVS.js";
|
|
9
10
|
import "./chunk-NQEXDLYH.js";
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomerDetailPage
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-DBYUB2YI.js";
|
|
5
|
-
import "./chunk-J3AMUGGZ.js";
|
|
3
|
+
} from "./chunk-R2UDZINP.js";
|
|
6
4
|
import "./chunk-54EPH67T.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-NOWUEJ74.js";
|
|
9
|
-
import "./chunk-2Y3WMGN6.js";
|
|
5
|
+
import "./chunk-AKSUGT5I.js";
|
|
10
6
|
import "./chunk-QUHSHIAC.js";
|
|
11
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-3XOE4NV5.js";
|
|
12
8
|
import "./chunk-TZSOL34K.js";
|
|
13
9
|
import "./chunk-25LYVP3C.js";
|
|
14
10
|
import "./chunk-PXYDR7WQ.js";
|
|
@@ -28,22 +24,22 @@ import "./chunk-XQNVC4Q7.js";
|
|
|
28
24
|
import "./chunk-THHRRYRS.js";
|
|
29
25
|
import "./chunk-PJR6W35H.js";
|
|
30
26
|
import "./chunk-OH4AABUT.js";
|
|
27
|
+
import "./chunk-FJHAAROU.js";
|
|
31
28
|
import "./chunk-AEMDNTW5.js";
|
|
32
29
|
import "./chunk-LYD3C73Z.js";
|
|
33
|
-
import "./chunk-FJHAAROU.js";
|
|
34
30
|
import "./chunk-533GMKEG.js";
|
|
35
31
|
import "./chunk-YFRC6GEN.js";
|
|
36
32
|
import "./chunk-N6SI4IIT.js";
|
|
37
|
-
import "./chunk-46M463BR.js";
|
|
38
|
-
import "./chunk-ZIFHQXP3.js";
|
|
39
33
|
import "./chunk-JPNPTILP.js";
|
|
40
34
|
import "./chunk-DAXXLQKB.js";
|
|
41
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-46M463BR.js";
|
|
36
|
+
import "./chunk-ZIFHQXP3.js";
|
|
42
37
|
import "./chunk-ESPLVOFC.js";
|
|
38
|
+
import "./chunk-GKGLVDDV.js";
|
|
43
39
|
import "./chunk-WJJXUXSO.js";
|
|
44
40
|
import "./chunk-LAPEZATU.js";
|
|
41
|
+
import "./chunk-RDTFLHYO.js";
|
|
45
42
|
import "./chunk-QKJGSZI2.js";
|
|
46
|
-
import "./chunk-Z2UBJXTU.js";
|
|
47
43
|
import "./chunk-FXWKGNRV.js";
|
|
48
44
|
import "./chunk-VDKOJ5WD.js";
|
|
49
45
|
import "./chunk-ZN7LWXVC.js";
|
|
@@ -55,7 +51,7 @@ import "./chunk-VYMODH6P.js";
|
|
|
55
51
|
import "./chunk-LEG67A2R.js";
|
|
56
52
|
import {
|
|
57
53
|
useCustomer
|
|
58
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QYDWMBEX.js";
|
|
59
55
|
import "./chunk-BDGZ4EQO.js";
|
|
60
56
|
import "./chunk-OKWGPKVK.js";
|
|
61
57
|
import "./chunk-KYFWVLWO.js";
|