@mercurjs/admin 2.2.0-canary.27 → 2.2.0-canary.28
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/{commission-rule-commission-edit-L2F2PNRI.js → commission-rule-commission-edit-7AV3COXL.js} +18 -20
- package/dist/{commission-rule-create-SCZ3PBTF.js → commission-rule-create-PV7FDDQ2.js} +42 -40
- package/dist/{global-commission-edit-4HDRIZSC.js → global-commission-edit-XTGJWPF4.js} +18 -20
- package/dist/index.js +3 -3
- package/package.json +1 -1
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
fixedValuesFromRate
|
|
8
8
|
} from "./chunk-CGIVQ7D2.js";
|
|
9
9
|
import "./chunk-MAEP2UCK.js";
|
|
10
|
+
import {
|
|
11
|
+
Combobox
|
|
12
|
+
} from "./chunk-AW77UWCZ.js";
|
|
10
13
|
import {
|
|
11
14
|
SwitchBox
|
|
12
15
|
} from "./chunk-2EME4AWX.js";
|
|
@@ -28,9 +31,6 @@ import {
|
|
|
28
31
|
} from "./chunk-ZIFHQXP3.js";
|
|
29
32
|
import "./chunk-FXWKGNRV.js";
|
|
30
33
|
import "./chunk-VDKOJ5WD.js";
|
|
31
|
-
import {
|
|
32
|
-
useDocumentDirection
|
|
33
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
34
34
|
import "./chunk-RHKRREUU.js";
|
|
35
35
|
import "./chunk-ZA2KFUFR.js";
|
|
36
36
|
import "./chunk-ZBWL72TB.js";
|
|
@@ -38,7 +38,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
38
38
|
|
|
39
39
|
// src/pages/commissions/commission-rule-commission-edit/commission-rule-commission-edit.tsx
|
|
40
40
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
41
|
-
import { Button, Heading,
|
|
41
|
+
import { Button, Heading, toast } from "@medusajs/ui";
|
|
42
42
|
import { useForm } from "react-hook-form";
|
|
43
43
|
import { useTranslation } from "react-i18next";
|
|
44
44
|
import { useParams } from "react-router-dom";
|
|
@@ -54,8 +54,11 @@ var EditCommissionSchema = zod.object({
|
|
|
54
54
|
var EditCommissionForm = ({ rule }) => {
|
|
55
55
|
const { t } = useTranslation();
|
|
56
56
|
const { handleSuccess } = useRouteModal();
|
|
57
|
-
const direction = useDocumentDirection();
|
|
58
57
|
const { currencies } = useStoreCurrencies();
|
|
58
|
+
const typeOptions = [
|
|
59
|
+
{ value: "percentage", label: t("commissions.fields.type.percentage") },
|
|
60
|
+
{ value: "fixed", label: t("commissions.fields.type.fixed") }
|
|
61
|
+
];
|
|
59
62
|
const form = useForm({
|
|
60
63
|
defaultValues: {
|
|
61
64
|
type: rule.type,
|
|
@@ -98,22 +101,17 @@ var EditCommissionForm = ({ rule }) => {
|
|
|
98
101
|
{
|
|
99
102
|
control: form.control,
|
|
100
103
|
name: "type",
|
|
101
|
-
render: ({ field
|
|
104
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
102
105
|
/* @__PURE__ */ jsx(Form.Label, { children: t("commissions.fields.type.label") }),
|
|
103
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/* @__PURE__ */ jsxs(Select.Content, { children: [
|
|
113
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: t("commissions.fields.type.percentage") }),
|
|
114
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: t("commissions.fields.type.fixed") })
|
|
115
|
-
] })
|
|
116
|
-
] }) }),
|
|
106
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
107
|
+
Combobox,
|
|
108
|
+
{
|
|
109
|
+
...field,
|
|
110
|
+
options: typeOptions,
|
|
111
|
+
forceHideInput: true,
|
|
112
|
+
"data-testid": "commission-edit-type-select"
|
|
113
|
+
}
|
|
114
|
+
) }),
|
|
117
115
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
118
116
|
] })
|
|
119
117
|
}
|
|
@@ -39,9 +39,6 @@ import {
|
|
|
39
39
|
} from "./chunk-ZIFHQXP3.js";
|
|
40
40
|
import "./chunk-FXWKGNRV.js";
|
|
41
41
|
import "./chunk-VDKOJ5WD.js";
|
|
42
|
-
import {
|
|
43
|
-
useDocumentDirection
|
|
44
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
45
42
|
import "./chunk-RHKRREUU.js";
|
|
46
43
|
import "./chunk-ZA2KFUFR.js";
|
|
47
44
|
import {
|
|
@@ -60,15 +57,18 @@ import { useForm } from "react-hook-form";
|
|
|
60
57
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
61
58
|
|
|
62
59
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-commission.tsx
|
|
63
|
-
import { Heading
|
|
60
|
+
import { Heading } from "@medusajs/ui";
|
|
64
61
|
import { useTranslation } from "react-i18next";
|
|
65
62
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
66
63
|
var CreateCommissionRuleCommission = () => {
|
|
67
64
|
const { t } = useTranslation();
|
|
68
65
|
const form = useTabbedForm();
|
|
69
|
-
const direction = useDocumentDirection();
|
|
70
66
|
const { currencies } = useStoreCurrencies();
|
|
71
67
|
const commissionType = form.watch("commissionType");
|
|
68
|
+
const typeOptions = [
|
|
69
|
+
{ value: "percentage", label: t("commissions.fields.type.percentage") },
|
|
70
|
+
{ value: "fixed", label: t("commissions.fields.type.fixed") }
|
|
71
|
+
];
|
|
72
72
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
73
73
|
/* @__PURE__ */ jsx(Heading, { children: t("commissions.create.commission") }),
|
|
74
74
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
@@ -77,22 +77,17 @@ var CreateCommissionRuleCommission = () => {
|
|
|
77
77
|
{
|
|
78
78
|
control: form.control,
|
|
79
79
|
name: "commissionType",
|
|
80
|
-
render: ({ field
|
|
80
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
81
81
|
/* @__PURE__ */ jsx(Form.Label, { children: t("commissions.fields.type.label") }),
|
|
82
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */ jsxs(Select.Content, { children: [
|
|
92
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: t("commissions.fields.type.percentage") }),
|
|
93
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: t("commissions.fields.type.fixed") })
|
|
94
|
-
] })
|
|
95
|
-
] }) }),
|
|
82
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
83
|
+
Combobox,
|
|
84
|
+
{
|
|
85
|
+
...field,
|
|
86
|
+
options: typeOptions,
|
|
87
|
+
forceHideInput: true,
|
|
88
|
+
"data-testid": "commission-rule-commission-type-select"
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
96
91
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
97
92
|
] })
|
|
98
93
|
}
|
|
@@ -135,15 +130,30 @@ CreateCommissionRuleCommission._tabMeta = defineTabMeta({
|
|
|
135
130
|
});
|
|
136
131
|
|
|
137
132
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-details.tsx
|
|
138
|
-
import { Heading as Heading2, Input
|
|
133
|
+
import { Heading as Heading2, Input } from "@medusajs/ui";
|
|
139
134
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
140
135
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
141
136
|
var CreateCommissionRuleDetails = () => {
|
|
142
137
|
const { t } = useTranslation2();
|
|
143
138
|
const form = useTabbedForm();
|
|
144
|
-
const direction = useDocumentDirection();
|
|
145
139
|
const scopeType = form.watch("scopeType");
|
|
146
140
|
const dimensions = SCOPE_TYPE_DIMENSIONS[scopeType];
|
|
141
|
+
const scopeTypeOptions = [
|
|
142
|
+
{ value: "store", label: t("commissions.fields.scopeType.store") },
|
|
143
|
+
{
|
|
144
|
+
value: "product_type",
|
|
145
|
+
label: t("commissions.fields.scopeType.productType")
|
|
146
|
+
},
|
|
147
|
+
{ value: "category", label: t("commissions.fields.scopeType.category") },
|
|
148
|
+
{
|
|
149
|
+
value: "store_product_type",
|
|
150
|
+
label: t("commissions.fields.scopeType.storeProductType")
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: "store_category",
|
|
154
|
+
label: t("commissions.fields.scopeType.storeCategory")
|
|
155
|
+
}
|
|
156
|
+
];
|
|
147
157
|
const stores = useComboboxData({
|
|
148
158
|
queryKey: ["commission_stores"],
|
|
149
159
|
queryFn: (params) => sdk.admin.sellers.query({ ...params }),
|
|
@@ -188,25 +198,17 @@ var CreateCommissionRuleDetails = () => {
|
|
|
188
198
|
{
|
|
189
199
|
control: form.control,
|
|
190
200
|
name: "scopeType",
|
|
191
|
-
render: ({ field
|
|
201
|
+
render: ({ field }) => /* @__PURE__ */ jsxs2(Form.Item, { children: [
|
|
192
202
|
/* @__PURE__ */ jsx2(Form.Label, { children: t("commissions.fields.scopeType.label") }),
|
|
193
|
-
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
/* @__PURE__ */ jsxs2(Select2.Content, { children: [
|
|
203
|
-
/* @__PURE__ */ jsx2(Select2.Item, { value: "store", children: t("commissions.fields.scopeType.store") }),
|
|
204
|
-
/* @__PURE__ */ jsx2(Select2.Item, { value: "product_type", children: t("commissions.fields.scopeType.productType") }),
|
|
205
|
-
/* @__PURE__ */ jsx2(Select2.Item, { value: "category", children: t("commissions.fields.scopeType.category") }),
|
|
206
|
-
/* @__PURE__ */ jsx2(Select2.Item, { value: "store_product_type", children: t("commissions.fields.scopeType.storeProductType") }),
|
|
207
|
-
/* @__PURE__ */ jsx2(Select2.Item, { value: "store_category", children: t("commissions.fields.scopeType.storeCategory") })
|
|
208
|
-
] })
|
|
209
|
-
] }) }),
|
|
203
|
+
/* @__PURE__ */ jsx2(Form.Control, { children: /* @__PURE__ */ jsx2(
|
|
204
|
+
Combobox,
|
|
205
|
+
{
|
|
206
|
+
...field,
|
|
207
|
+
options: scopeTypeOptions,
|
|
208
|
+
forceHideInput: true,
|
|
209
|
+
"data-testid": "commission-rule-scope-type-select"
|
|
210
|
+
}
|
|
211
|
+
) }),
|
|
210
212
|
/* @__PURE__ */ jsx2(Form.ErrorMessage, {})
|
|
211
213
|
] })
|
|
212
214
|
}
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
fixedValuesFromRate
|
|
8
8
|
} from "./chunk-CGIVQ7D2.js";
|
|
9
9
|
import "./chunk-MAEP2UCK.js";
|
|
10
|
+
import {
|
|
11
|
+
Combobox
|
|
12
|
+
} from "./chunk-AW77UWCZ.js";
|
|
10
13
|
import {
|
|
11
14
|
SwitchBox
|
|
12
15
|
} from "./chunk-2EME4AWX.js";
|
|
@@ -28,9 +31,6 @@ import {
|
|
|
28
31
|
} from "./chunk-ZIFHQXP3.js";
|
|
29
32
|
import "./chunk-FXWKGNRV.js";
|
|
30
33
|
import "./chunk-VDKOJ5WD.js";
|
|
31
|
-
import {
|
|
32
|
-
useDocumentDirection
|
|
33
|
-
} from "./chunk-Y7QKP6QU.js";
|
|
34
34
|
import "./chunk-RHKRREUU.js";
|
|
35
35
|
import "./chunk-ZA2KFUFR.js";
|
|
36
36
|
import "./chunk-ZBWL72TB.js";
|
|
@@ -38,7 +38,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
38
38
|
|
|
39
39
|
// src/pages/commissions/global-commission-edit/global-commission-edit.tsx
|
|
40
40
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
41
|
-
import { Button, Heading, Input,
|
|
41
|
+
import { Button, Heading, Input, toast } from "@medusajs/ui";
|
|
42
42
|
import { useForm } from "react-hook-form";
|
|
43
43
|
import { useTranslation } from "react-i18next";
|
|
44
44
|
import * as zod from "zod";
|
|
@@ -62,8 +62,11 @@ var EditGlobalCommissionSchema = zod.object({
|
|
|
62
62
|
var EditGlobalCommissionForm = ({ rate }) => {
|
|
63
63
|
const { t } = useTranslation();
|
|
64
64
|
const { handleSuccess } = useRouteModal();
|
|
65
|
-
const direction = useDocumentDirection();
|
|
66
65
|
const { currencies } = useStoreCurrencies();
|
|
66
|
+
const typeOptions = [
|
|
67
|
+
{ value: "percentage", label: t("commissions.fields.type.percentage") },
|
|
68
|
+
{ value: "fixed", label: t("commissions.fields.type.fixed") }
|
|
69
|
+
];
|
|
67
70
|
const form = useForm({
|
|
68
71
|
defaultValues: {
|
|
69
72
|
code: rate.code,
|
|
@@ -125,22 +128,17 @@ var EditGlobalCommissionForm = ({ rate }) => {
|
|
|
125
128
|
{
|
|
126
129
|
control: form.control,
|
|
127
130
|
name: "type",
|
|
128
|
-
render: ({ field
|
|
131
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
|
|
129
132
|
/* @__PURE__ */ jsx(Form.Label, { children: t("commissions.fields.type.label") }),
|
|
130
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/* @__PURE__ */ jsxs(Select.Content, { children: [
|
|
140
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "percentage", children: t("commissions.fields.type.percentage") }),
|
|
141
|
-
/* @__PURE__ */ jsx(Select.Item, { value: "fixed", children: t("commissions.fields.type.fixed") })
|
|
142
|
-
] })
|
|
143
|
-
] }) }),
|
|
133
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
134
|
+
Combobox,
|
|
135
|
+
{
|
|
136
|
+
...field,
|
|
137
|
+
options: typeOptions,
|
|
138
|
+
forceHideInput: true,
|
|
139
|
+
"data-testid": "global-commission-type-select"
|
|
140
|
+
}
|
|
141
|
+
) }),
|
|
144
142
|
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
145
143
|
] })
|
|
146
144
|
}
|
package/dist/index.js
CHANGED
|
@@ -4475,11 +4475,11 @@ function getRouteMap({
|
|
|
4475
4475
|
children: [
|
|
4476
4476
|
{
|
|
4477
4477
|
path: "create",
|
|
4478
|
-
lazy: () => import("./commission-rule-create-
|
|
4478
|
+
lazy: () => import("./commission-rule-create-PV7FDDQ2.js")
|
|
4479
4479
|
},
|
|
4480
4480
|
{
|
|
4481
4481
|
path: "edit-global",
|
|
4482
|
-
lazy: () => import("./global-commission-edit-
|
|
4482
|
+
lazy: () => import("./global-commission-edit-XTGJWPF4.js")
|
|
4483
4483
|
}
|
|
4484
4484
|
]
|
|
4485
4485
|
},
|
|
@@ -4505,7 +4505,7 @@ function getRouteMap({
|
|
|
4505
4505
|
},
|
|
4506
4506
|
{
|
|
4507
4507
|
path: "edit-commission",
|
|
4508
|
-
lazy: () => import("./commission-rule-commission-edit-
|
|
4508
|
+
lazy: () => import("./commission-rule-commission-edit-7AV3COXL.js")
|
|
4509
4509
|
}
|
|
4510
4510
|
]
|
|
4511
4511
|
}
|