@medusajs/dashboard 2.10.4-snapshot-20250930123356 → 2.10.4-snapshot-20251001130744
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-YATCZFPA.mjs → add-campaign-promotions-TFNUPW6A.mjs} +3 -3
- package/dist/app.js +69 -70
- package/dist/app.mjs +2 -2
- package/dist/{campaign-create-SGLXQU2F.mjs → campaign-create-CQ3XBHSY.mjs} +2 -3
- package/dist/{campaign-detail-6WW6QFB2.mjs → campaign-detail-6TPA4ERV.mjs} +4 -4
- package/dist/{chunk-HGAQ6CRN.mjs → chunk-6IQV6XRM.mjs} +1 -1
- package/dist/{chunk-ASFB7W5A.mjs → chunk-AHHACBNF.mjs} +1 -1
- package/dist/{chunk-ENN7KGKR.mjs → chunk-AXXGAOQL.mjs} +4 -9
- package/dist/{chunk-GOJZH5OP.mjs → chunk-CY33DS7K.mjs} +1 -52
- package/dist/{chunk-TR3FWQXE.mjs → chunk-EES6O4ND.mjs} +1 -1
- package/dist/{chunk-55PVXDDC.mjs → chunk-FLPX3C4H.mjs} +1 -1
- package/dist/{chunk-CLIAKOWC.mjs → chunk-H4ASVW4A.mjs} +2 -6
- package/dist/{chunk-W4JWOYEI.mjs → chunk-RBDAWRFF.mjs} +1 -1
- package/dist/{chunk-7PAOPX4A.mjs → chunk-RVHD6PIL.mjs} +21 -21
- package/dist/{order-create-refund-MGNKZZU7.mjs → order-create-refund-2JJJVK5A.mjs} +73 -3
- package/dist/{product-attributes-XSMFVMPL.mjs → product-attributes-TLXB4J7A.mjs} +3 -3
- package/dist/{product-create-IGZFHXVZ.mjs → product-create-7HOLP36D.mjs} +3 -3
- package/dist/{product-detail-CW42KVKT.mjs → product-detail-76PYSS7T.mjs} +3 -3
- package/dist/{product-edit-EXLC7FN7.mjs → product-edit-2QP6R36U.mjs} +3 -3
- package/dist/{product-media-NJZ6JSA7.mjs → product-media-OEV3BHUK.mjs} +2 -2
- package/dist/{product-organization-V2LE3CYO.mjs → product-organization-6FNRPZOP.mjs} +3 -3
- package/dist/{product-shipping-profile-K4FB5YNC.mjs → product-shipping-profile-LVR2XRIN.mjs} +3 -3
- package/dist/{promotion-add-campaign-SOGZKDNX.mjs → promotion-add-campaign-YOUUM6RB.mjs} +2 -2
- package/dist/{promotion-create-DRWLH3CY.mjs → promotion-create-SWL2YAZR.mjs} +3 -7
- package/dist/{promotion-detail-VHNQCTRH.mjs → promotion-detail-T5Y3LGZN.mjs} +2 -2
- package/dist/{promotion-list-6KMDX6OB.mjs → promotion-list-4YQXF4JL.mjs} +3 -3
- package/dist/{reset-password-AOR576NC.mjs → reset-password-IRRCZOIH.mjs} +1 -1
- package/dist/{tax-region-create-EFDLXWCS.mjs → tax-region-create-GCKJ6LII.mjs} +1 -1
- package/package.json +9 -9
- package/src/i18n/translations/$schema.json +1 -22
- package/src/i18n/translations/en.json +2 -6
- package/src/routes/campaigns/campaign-create/components/create-campaign-form/create-campaign-form.tsx +2 -7
- package/src/routes/campaigns/campaign-detail/components/campaign-budget/campaign-budget.tsx +1 -5
- package/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx +1 -50
- package/src/routes/campaigns/common/constants.ts +0 -1
- package/src/routes/orders/order-create-refund/components/create-refund-form/create-refund-form.tsx +92 -13
- package/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx +0 -7
- package/dist/{order-detail-G3IQFZ4U.mjs → order-detail-XZKV6VOY.mjs} +3 -3
- package/dist/{tax-region-detail-S5R5D4KY.mjs → tax-region-detail-HNTTGBII.mjs} +1 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
import {
|
2
2
|
usePromotionTableColumns,
|
3
3
|
usePromotionTableQuery
|
4
|
-
} from "./chunk-
|
5
|
-
import "./chunk-
|
4
|
+
} from "./chunk-AHHACBNF.mjs";
|
5
|
+
import "./chunk-6IQV6XRM.mjs";
|
6
6
|
import "./chunk-MSDRGCRR.mjs";
|
7
7
|
import "./chunk-ADOCJB6L.mjs";
|
8
8
|
import "./chunk-LQTHYS2Z.mjs";
|
@@ -30,7 +30,7 @@ import {
|
|
30
30
|
useRouteModal
|
31
31
|
} from "./chunk-4TC5YS65.mjs";
|
32
32
|
import "./chunk-4GQOUCX6.mjs";
|
33
|
-
import "./chunk-
|
33
|
+
import "./chunk-H4ASVW4A.mjs";
|
34
34
|
import "./chunk-LPEUYMRK.mjs";
|
35
35
|
import "./chunk-OC7BQLYI.mjs";
|
36
36
|
import "./chunk-S4DMV3ZT.mjs";
|
package/dist/app.js
CHANGED
@@ -11004,7 +11004,7 @@ var init_en = __esm({
|
|
11004
11004
|
delete: {
|
11005
11005
|
title: "Are you sure?",
|
11006
11006
|
description: "You are about to delete the campaign '{{name}}'. This action cannot be undone.",
|
11007
|
-
successToast: "Campaign '{{name}}' was successfully
|
11007
|
+
successToast: "Campaign '{{name}}' was successfully created."
|
11008
11008
|
},
|
11009
11009
|
edit: {
|
11010
11010
|
header: "Edit Campaign",
|
@@ -11048,11 +11048,7 @@ var init_en = __esm({
|
|
11048
11048
|
type: "Type",
|
11049
11049
|
currency: "Currency",
|
11050
11050
|
limit: "Limit",
|
11051
|
-
used: "Used"
|
11052
|
-
budgetAttribute: "Limit usage per",
|
11053
|
-
budgetAttributeTooltip: "Define how many times the promotion can be used by a specific customer or email.",
|
11054
|
-
limitBudgetAttributeCustomer: "Budget limit per customer",
|
11055
|
-
limitBudgetAttributeEmail: "Budget limit per email"
|
11051
|
+
used: "Used"
|
11056
11052
|
},
|
11057
11053
|
type: {
|
11058
11054
|
spend: {
|
@@ -136679,6 +136675,7 @@ var init_create_refund_form = __esm({
|
|
136679
136675
|
init_money_amount_helpers();
|
136680
136676
|
init_orders2();
|
136681
136677
|
init_use_document_direction();
|
136678
|
+
init_format_provider();
|
136682
136679
|
import_jsx_runtime275 = require("react/jsx-runtime");
|
136683
136680
|
CreateRefundSchema = zod10.object({
|
136684
136681
|
amount: zod10.object({
|
@@ -136693,6 +136690,7 @@ var init_create_refund_form = __esm({
|
|
136693
136690
|
const { handleSuccess } = useRouteModal();
|
136694
136691
|
const { refund_reasons } = useRefundReasons();
|
136695
136692
|
const [searchParams] = (0, import_react_router_dom88.useSearchParams)();
|
136693
|
+
const hasPaymentIdInSearchParams = !!searchParams.get("paymentId");
|
136696
136694
|
const [paymentId, setPaymentId] = (0, import_react185.useState)(
|
136697
136695
|
searchParams.get("paymentId") || void 0
|
136698
136696
|
);
|
@@ -136713,6 +136711,16 @@ var init_create_refund_form = __esm({
|
|
136713
136711
|
},
|
136714
136712
|
resolver: (0, import_zod45.zodResolver)(CreateRefundSchema)
|
136715
136713
|
});
|
136714
|
+
(0, import_react185.useEffect)(() => {
|
136715
|
+
const pendingDifference = order.summary.pending_difference;
|
136716
|
+
const paymentAmount2 = payment?.amount || 0;
|
136717
|
+
const pendingAmount = pendingDifference < 0 ? Math.min(Math.abs(pendingDifference), paymentAmount2) : paymentAmount2;
|
136718
|
+
const normalizedAmount = pendingAmount < 0 ? pendingAmount * -1 : pendingAmount;
|
136719
|
+
form.setValue("amount", {
|
136720
|
+
value: normalizedAmount.toFixed(currency.decimal_digits),
|
136721
|
+
float: normalizedAmount
|
136722
|
+
});
|
136723
|
+
}, [payment?.id || ""]);
|
136716
136724
|
const { mutateAsync, isPending } = useRefundPayment(order.id, payment?.id);
|
136717
136725
|
const handleSubmit = form.handleSubmit(async (data) => {
|
136718
136726
|
await mutateAsync(
|
@@ -136746,7 +136754,56 @@ var init_create_refund_form = __esm({
|
|
136746
136754
|
className: "flex size-full flex-col overflow-hidden",
|
136747
136755
|
children: [
|
136748
136756
|
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(RouteDrawer.Body, { className: "flex-1 overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex flex-col gap-y-4", children: [
|
136749
|
-
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
136757
|
+
!hasPaymentIdInSearchParams && /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
136758
|
+
import_ui199.Select,
|
136759
|
+
{
|
136760
|
+
dir: direction,
|
136761
|
+
value: paymentId,
|
136762
|
+
onValueChange: (value) => {
|
136763
|
+
setPaymentId(value);
|
136764
|
+
},
|
136765
|
+
children: [
|
136766
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_ui199.Label, { className: "txt-compact-small mb-[-6px] font-sans font-medium", children: t5("orders.payment.selectPaymentToRefund") }),
|
136767
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_ui199.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
136768
|
+
import_ui199.Select.Value,
|
136769
|
+
{
|
136770
|
+
placeholder: t5("orders.payment.selectPaymentToRefund")
|
136771
|
+
}
|
136772
|
+
) }),
|
136773
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_ui199.Select.Content, { children: payments.map((payment2) => {
|
136774
|
+
const totalRefunded = payment2.refunds?.reduce(
|
136775
|
+
(acc, next) => next.amount + acc,
|
136776
|
+
0
|
136777
|
+
) || 0;
|
136778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
136779
|
+
import_ui199.Select.Item,
|
136780
|
+
{
|
136781
|
+
value: payment2.id,
|
136782
|
+
disabled: !!payment2.canceled_at || totalRefunded >= payment2.amount,
|
136783
|
+
className: "flex items-center justify-center",
|
136784
|
+
children: [
|
136785
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("span", { children: [
|
136786
|
+
getLocaleAmount(
|
136787
|
+
payment2.amount,
|
136788
|
+
payment2.currency_code
|
136789
|
+
),
|
136790
|
+
" - "
|
136791
|
+
] }),
|
136792
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { children: formatProvider(payment2.provider_id) }),
|
136793
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("span", { children: [
|
136794
|
+
" - (#",
|
136795
|
+
payment2.id.substring(23),
|
136796
|
+
")"
|
136797
|
+
] })
|
136798
|
+
]
|
136799
|
+
},
|
136800
|
+
payment2.id
|
136801
|
+
);
|
136802
|
+
}) })
|
136803
|
+
]
|
136804
|
+
}
|
136805
|
+
),
|
136806
|
+
hasPaymentIdInSearchParams && /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex items-center", children: [
|
136750
136807
|
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { children: getLocaleAmount(
|
136751
136808
|
payment.amount,
|
136752
136809
|
payment.currency_code
|
@@ -138643,8 +138700,7 @@ var init_constants14 = __esm({
|
|
138643
138700
|
budget: {
|
138644
138701
|
type: "usage",
|
138645
138702
|
currency_code: null,
|
138646
|
-
limit: null
|
138647
|
-
attribute: null
|
138703
|
+
limit: null
|
138648
138704
|
}
|
138649
138705
|
};
|
138650
138706
|
}
|
@@ -139178,7 +139234,6 @@ var init_create_campaign_form_fields = __esm({
|
|
139178
139234
|
init_store();
|
139179
139235
|
init_use_document_direction();
|
139180
139236
|
init_currencies2();
|
139181
|
-
init_combobox2();
|
139182
139237
|
import_jsx_runtime295 = require("react/jsx-runtime");
|
139183
139238
|
CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
139184
139239
|
const { t: t5 } = (0, import_react_i18next219.useTranslation)();
|
@@ -139330,14 +139385,13 @@ var init_create_campaign_form_fields = __esm({
|
|
139330
139385
|
import_ui214.RadioGroup,
|
139331
139386
|
{
|
139332
139387
|
dir: direction,
|
139333
|
-
className: "flex gap-
|
139388
|
+
className: "flex gap-y-3",
|
139334
139389
|
...field,
|
139335
139390
|
onValueChange: field.onChange,
|
139336
139391
|
children: [
|
139337
139392
|
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
139338
139393
|
import_ui214.RadioGroup.ChoiceBox,
|
139339
139394
|
{
|
139340
|
-
className: "flex-1",
|
139341
139395
|
value: "usage",
|
139342
139396
|
label: t5("campaigns.budget.type.usage.title"),
|
139343
139397
|
description: t5("campaigns.budget.type.usage.description")
|
@@ -139346,7 +139400,6 @@ var init_create_campaign_form_fields = __esm({
|
|
139346
139400
|
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
139347
139401
|
import_ui214.RadioGroup.ChoiceBox,
|
139348
139402
|
{
|
139349
|
-
className: "flex-1",
|
139350
139403
|
value: "spend",
|
139351
139404
|
label: t5("campaigns.budget.type.spend.title"),
|
139352
139405
|
description: t5("campaigns.budget.type.spend.description"),
|
@@ -139449,52 +139502,6 @@ var init_create_campaign_form_fields = __esm({
|
|
139449
139502
|
] });
|
139450
139503
|
}
|
139451
139504
|
}
|
139452
|
-
),
|
139453
|
-
!isTypeSpend && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
139454
|
-
Form.Field,
|
139455
|
-
{
|
139456
|
-
control: form.control,
|
139457
|
-
name: `${fieldScope}budget.attribute`,
|
139458
|
-
render: ({ field }) => {
|
139459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(Form.Item, { className: "basis-1/2", children: [
|
139460
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
139461
|
-
Form.Label,
|
139462
|
-
{
|
139463
|
-
tooltip: t5(
|
139464
|
-
"campaigns.budget.fields.budgetAttributeTooltip"
|
139465
|
-
),
|
139466
|
-
children: t5("campaigns.budget.fields.budgetAttribute")
|
139467
|
-
}
|
139468
|
-
),
|
139469
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(Form.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
|
139470
|
-
Combobox,
|
139471
|
-
{
|
139472
|
-
...field,
|
139473
|
-
onChange: (e) => {
|
139474
|
-
if (typeof e === "undefined") {
|
139475
|
-
field.onChange(null);
|
139476
|
-
} else {
|
139477
|
-
field.onChange(e);
|
139478
|
-
}
|
139479
|
-
},
|
139480
|
-
allowClear: true,
|
139481
|
-
options: [
|
139482
|
-
{
|
139483
|
-
label: t5("fields.customer"),
|
139484
|
-
value: "customer_id"
|
139485
|
-
},
|
139486
|
-
{
|
139487
|
-
label: t5("fields.email"),
|
139488
|
-
value: "customer_email"
|
139489
|
-
}
|
139490
|
-
]
|
139491
|
-
},
|
139492
|
-
"attribute"
|
139493
|
-
) }),
|
139494
|
-
/* @__PURE__ */ (0, import_jsx_runtime295.jsx)(Form.ErrorMessage, {})
|
139495
|
-
] });
|
139496
|
-
}
|
139497
|
-
}
|
139498
139505
|
)
|
139499
139506
|
] })
|
139500
139507
|
] });
|
@@ -139837,9 +139844,8 @@ var init_create_campaign_form = __esm({
|
|
139837
139844
|
starts_at: zod16.date().nullable(),
|
139838
139845
|
ends_at: zod16.date().nullable(),
|
139839
139846
|
budget: zod16.object({
|
139840
|
-
attribute: zod16.string().nullish(),
|
139841
139847
|
limit: zod16.number().min(0).nullish(),
|
139842
|
-
type: zod16.enum(["spend", "usage"
|
139848
|
+
type: zod16.enum(["spend", "usage"]),
|
139843
139849
|
currency_code: zod16.string().nullish()
|
139844
139850
|
})
|
139845
139851
|
});
|
@@ -139852,8 +139858,6 @@ var init_create_campaign_form = __esm({
|
|
139852
139858
|
resolver: (0, import_zod51.zodResolver)(CreateCampaignSchema)
|
139853
139859
|
});
|
139854
139860
|
const handleSubmit = form.handleSubmit(async (data) => {
|
139855
|
-
const attribute = data.budget.attribute || null;
|
139856
|
-
const type = attribute ? "use_by_attribute" : data.budget.type;
|
139857
139861
|
await mutateAsync(
|
139858
139862
|
{
|
139859
139863
|
name: data.name,
|
@@ -139862,8 +139866,7 @@ var init_create_campaign_form = __esm({
|
|
139862
139866
|
starts_at: data.starts_at,
|
139863
139867
|
ends_at: data.ends_at,
|
139864
139868
|
budget: {
|
139865
|
-
type,
|
139866
|
-
attribute,
|
139869
|
+
type: data.budget.type,
|
139867
139870
|
limit: data.budget.limit ? data.budget.limit : void 0,
|
139868
139871
|
currency_code: data.budget.currency_code
|
139869
139872
|
}
|
@@ -140206,10 +140209,6 @@ var init_create_promotion_form = __esm({
|
|
140206
140209
|
values: rule.values
|
140207
140210
|
}));
|
140208
140211
|
};
|
140209
|
-
if (data.campaign) {
|
140210
|
-
data.campaign.budget.attribute = data.campaign.budget.attribute || null;
|
140211
|
-
data.campaign.budget.type = data.campaign.budget.attribute ? "use_by_attribute" : data.campaign.budget.type;
|
140212
|
-
}
|
140213
140212
|
createPromotion(
|
140214
140213
|
{
|
140215
140214
|
...promotionData,
|
@@ -142787,7 +142786,7 @@ var init_campaign_budget = __esm({
|
|
142787
142786
|
{
|
142788
142787
|
className: "text-ui-fg-subtle ms-10 mt-[1.5px] font-normal",
|
142789
142788
|
level: "h3",
|
142790
|
-
children:
|
142789
|
+
children: t5("campaigns.fields.budget_limit")
|
142791
142790
|
}
|
142792
142791
|
)
|
142793
142792
|
] }),
|
package/dist/app.mjs
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import {
|
2
2
|
DashboardApp
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-RVHD6PIL.mjs";
|
4
4
|
import "./chunk-NQIC7ZFS.mjs";
|
5
5
|
import "./chunk-ONB3JEHR.mjs";
|
6
6
|
import "./chunk-VLOA5XAC.mjs";
|
7
7
|
import "./chunk-4GQOUCX6.mjs";
|
8
8
|
import "./chunk-2VTICXJR.mjs";
|
9
9
|
import "./chunk-D3YQN7HV.mjs";
|
10
|
-
import "./chunk-
|
10
|
+
import "./chunk-H4ASVW4A.mjs";
|
11
11
|
import "./chunk-MNXC6Q4F.mjs";
|
12
12
|
import "./chunk-C5P5PL3E.mjs";
|
13
13
|
import "./chunk-DG7J63J2.mjs";
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import {
|
2
2
|
CreateCampaignForm
|
3
|
-
} from "./chunk-
|
4
|
-
import "./chunk-
|
3
|
+
} from "./chunk-AXXGAOQL.mjs";
|
4
|
+
import "./chunk-CY33DS7K.mjs";
|
5
5
|
import "./chunk-F6ZOHZVB.mjs";
|
6
|
-
import "./chunk-OFN7DIZA.mjs";
|
7
6
|
import "./chunk-DK4WIVY6.mjs";
|
8
7
|
import "./chunk-IUCDCPJU.mjs";
|
9
8
|
import "./chunk-6HTZNHPT.mjs";
|
@@ -4,8 +4,8 @@ import {
|
|
4
4
|
import {
|
5
5
|
usePromotionTableColumns,
|
6
6
|
usePromotionTableQuery
|
7
|
-
} from "./chunk-
|
8
|
-
import "./chunk-
|
7
|
+
} from "./chunk-AHHACBNF.mjs";
|
8
|
+
import "./chunk-6IQV6XRM.mjs";
|
9
9
|
import "./chunk-MSDRGCRR.mjs";
|
10
10
|
import "./chunk-ADOCJB6L.mjs";
|
11
11
|
import "./chunk-LQTHYS2Z.mjs";
|
@@ -31,7 +31,7 @@ import {
|
|
31
31
|
import "./chunk-C76H5USB.mjs";
|
32
32
|
import "./chunk-PFKKVLZX.mjs";
|
33
33
|
import "./chunk-4GQOUCX6.mjs";
|
34
|
-
import "./chunk-
|
34
|
+
import "./chunk-H4ASVW4A.mjs";
|
35
35
|
import {
|
36
36
|
useExtension
|
37
37
|
} from "./chunk-C5P5PL3E.mjs";
|
@@ -128,7 +128,7 @@ var CampaignBudget = ({ campaign }) => {
|
|
128
128
|
{
|
129
129
|
className: "text-ui-fg-subtle ms-10 mt-[1.5px] font-normal",
|
130
130
|
level: "h3",
|
131
|
-
children:
|
131
|
+
children: t("campaigns.fields.budget_limit")
|
132
132
|
}
|
133
133
|
)
|
134
134
|
] }),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
CreateCampaignFormFields
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-CY33DS7K.mjs";
|
4
4
|
import {
|
5
5
|
VisuallyHidden
|
6
6
|
} from "./chunk-F6ZOHZVB.mjs";
|
@@ -32,8 +32,7 @@ var DEFAULT_CAMPAIGN_VALUES = {
|
|
32
32
|
budget: {
|
33
33
|
type: "usage",
|
34
34
|
currency_code: null,
|
35
|
-
limit: null
|
36
|
-
attribute: null
|
35
|
+
limit: null
|
37
36
|
}
|
38
37
|
};
|
39
38
|
|
@@ -46,9 +45,8 @@ var CreateCampaignSchema = zod.object({
|
|
46
45
|
starts_at: zod.date().nullable(),
|
47
46
|
ends_at: zod.date().nullable(),
|
48
47
|
budget: zod.object({
|
49
|
-
attribute: zod.string().nullish(),
|
50
48
|
limit: zod.number().min(0).nullish(),
|
51
|
-
type: zod.enum(["spend", "usage"
|
49
|
+
type: zod.enum(["spend", "usage"]),
|
52
50
|
currency_code: zod.string().nullish()
|
53
51
|
})
|
54
52
|
});
|
@@ -61,8 +59,6 @@ var CreateCampaignForm = () => {
|
|
61
59
|
resolver: zodResolver(CreateCampaignSchema)
|
62
60
|
});
|
63
61
|
const handleSubmit = form.handleSubmit(async (data) => {
|
64
|
-
const attribute = data.budget.attribute || null;
|
65
|
-
const type = attribute ? "use_by_attribute" : data.budget.type;
|
66
62
|
await mutateAsync(
|
67
63
|
{
|
68
64
|
name: data.name,
|
@@ -71,8 +67,7 @@ var CreateCampaignForm = () => {
|
|
71
67
|
starts_at: data.starts_at,
|
72
68
|
ends_at: data.ends_at,
|
73
69
|
budget: {
|
74
|
-
type,
|
75
|
-
attribute,
|
70
|
+
type: data.budget.type,
|
76
71
|
limit: data.budget.limit ? data.budget.limit : void 0,
|
77
72
|
currency_code: data.budget.currency_code
|
78
73
|
}
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
Combobox
|
3
|
-
} from "./chunk-OFN7DIZA.mjs";
|
4
1
|
import {
|
5
2
|
currencies,
|
6
3
|
getCurrencySymbol
|
@@ -180,14 +177,13 @@ var CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|
180
177
|
RadioGroup,
|
181
178
|
{
|
182
179
|
dir: direction,
|
183
|
-
className: "flex gap-
|
180
|
+
className: "flex gap-y-3",
|
184
181
|
...field,
|
185
182
|
onValueChange: field.onChange,
|
186
183
|
children: [
|
187
184
|
/* @__PURE__ */ jsx(
|
188
185
|
RadioGroup.ChoiceBox,
|
189
186
|
{
|
190
|
-
className: "flex-1",
|
191
187
|
value: "usage",
|
192
188
|
label: t("campaigns.budget.type.usage.title"),
|
193
189
|
description: t("campaigns.budget.type.usage.description")
|
@@ -196,7 +192,6 @@ var CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|
196
192
|
/* @__PURE__ */ jsx(
|
197
193
|
RadioGroup.ChoiceBox,
|
198
194
|
{
|
199
|
-
className: "flex-1",
|
200
195
|
value: "spend",
|
201
196
|
label: t("campaigns.budget.type.spend.title"),
|
202
197
|
description: t("campaigns.budget.type.spend.description"),
|
@@ -299,52 +294,6 @@ var CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|
299
294
|
] });
|
300
295
|
}
|
301
296
|
}
|
302
|
-
),
|
303
|
-
!isTypeSpend && /* @__PURE__ */ jsx(
|
304
|
-
Form.Field,
|
305
|
-
{
|
306
|
-
control: form.control,
|
307
|
-
name: `${fieldScope}budget.attribute`,
|
308
|
-
render: ({ field }) => {
|
309
|
-
return /* @__PURE__ */ jsxs(Form.Item, { className: "basis-1/2", children: [
|
310
|
-
/* @__PURE__ */ jsx(
|
311
|
-
Form.Label,
|
312
|
-
{
|
313
|
-
tooltip: t(
|
314
|
-
"campaigns.budget.fields.budgetAttributeTooltip"
|
315
|
-
),
|
316
|
-
children: t("campaigns.budget.fields.budgetAttribute")
|
317
|
-
}
|
318
|
-
),
|
319
|
-
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
320
|
-
Combobox,
|
321
|
-
{
|
322
|
-
...field,
|
323
|
-
onChange: (e) => {
|
324
|
-
if (typeof e === "undefined") {
|
325
|
-
field.onChange(null);
|
326
|
-
} else {
|
327
|
-
field.onChange(e);
|
328
|
-
}
|
329
|
-
},
|
330
|
-
allowClear: true,
|
331
|
-
options: [
|
332
|
-
{
|
333
|
-
label: t("fields.customer"),
|
334
|
-
value: "customer_id"
|
335
|
-
},
|
336
|
-
{
|
337
|
-
label: t("fields.email"),
|
338
|
-
value: "customer_email"
|
339
|
-
}
|
340
|
-
]
|
341
|
-
},
|
342
|
-
"attribute"
|
343
|
-
) }),
|
344
|
-
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
345
|
-
] });
|
346
|
-
}
|
347
|
-
}
|
348
297
|
)
|
349
298
|
] })
|
350
299
|
] });
|
@@ -10954,7 +10954,7 @@ var en_default = {
|
|
10954
10954
|
delete: {
|
10955
10955
|
title: "Are you sure?",
|
10956
10956
|
description: "You are about to delete the campaign '{{name}}'. This action cannot be undone.",
|
10957
|
-
successToast: "Campaign '{{name}}' was successfully
|
10957
|
+
successToast: "Campaign '{{name}}' was successfully created."
|
10958
10958
|
},
|
10959
10959
|
edit: {
|
10960
10960
|
header: "Edit Campaign",
|
@@ -10998,11 +10998,7 @@ var en_default = {
|
|
10998
10998
|
type: "Type",
|
10999
10999
|
currency: "Currency",
|
11000
11000
|
limit: "Limit",
|
11001
|
-
used: "Used"
|
11002
|
-
budgetAttribute: "Limit usage per",
|
11003
|
-
budgetAttributeTooltip: "Define how many times the promotion can be used by a specific customer or email.",
|
11004
|
-
limitBudgetAttributeCustomer: "Budget limit per customer",
|
11005
|
-
limitBudgetAttributeEmail: "Budget limit per email"
|
11001
|
+
used: "Used"
|
11006
11002
|
},
|
11007
11003
|
type: {
|
11008
11004
|
spend: {
|