@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
@@ -25,11 +25,7 @@ export const CampaignBudget = ({ campaign }: CampaignBudgetProps) => {
|
|
25
25
|
className="text-ui-fg-subtle ms-10 mt-[1.5px] font-normal"
|
26
26
|
level="h3"
|
27
27
|
>
|
28
|
-
{
|
29
|
-
? campaign.budget?.attribute === "customer_id"
|
30
|
-
? t("campaigns.budget.fields.limitBudgetAttributeCustomer")
|
31
|
-
: t("campaigns.budget.fields.limitBudgetAttributeEmail")
|
32
|
-
: t("campaigns.fields.budget_limit")}
|
28
|
+
{t("campaigns.fields.budget_limit")}
|
33
29
|
</Heading>
|
34
30
|
</div>
|
35
31
|
|
@@ -19,7 +19,6 @@ import {
|
|
19
19
|
currencies,
|
20
20
|
getCurrencySymbol,
|
21
21
|
} from "../../../../../lib/data/currencies"
|
22
|
-
import { Combobox } from "../../../../../components/inputs/combobox"
|
23
22
|
|
24
23
|
export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
25
24
|
const { t } = useTranslation()
|
@@ -210,19 +209,17 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|
210
209
|
<Form.Control>
|
211
210
|
<RadioGroup
|
212
211
|
dir={direction}
|
213
|
-
className="flex gap-
|
212
|
+
className="flex gap-y-3"
|
214
213
|
{...field}
|
215
214
|
onValueChange={field.onChange}
|
216
215
|
>
|
217
216
|
<RadioGroup.ChoiceBox
|
218
|
-
className="flex-1"
|
219
217
|
value={"usage"}
|
220
218
|
label={t("campaigns.budget.type.usage.title")}
|
221
219
|
description={t("campaigns.budget.type.usage.description")}
|
222
220
|
/>
|
223
221
|
|
224
222
|
<RadioGroup.ChoiceBox
|
225
|
-
className="flex-1"
|
226
223
|
value={"spend"}
|
227
224
|
label={t("campaigns.budget.type.spend.title")}
|
228
225
|
description={t("campaigns.budget.type.spend.description")}
|
@@ -345,52 +342,6 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|
345
342
|
)
|
346
343
|
}}
|
347
344
|
/>
|
348
|
-
|
349
|
-
{!isTypeSpend && (
|
350
|
-
<Form.Field
|
351
|
-
control={form.control}
|
352
|
-
name={`${fieldScope}budget.attribute`}
|
353
|
-
render={({ field }) => {
|
354
|
-
return (
|
355
|
-
<Form.Item className="basis-1/2">
|
356
|
-
<Form.Label
|
357
|
-
tooltip={t(
|
358
|
-
"campaigns.budget.fields.budgetAttributeTooltip"
|
359
|
-
)}
|
360
|
-
>
|
361
|
-
{t("campaigns.budget.fields.budgetAttribute")}
|
362
|
-
</Form.Label>
|
363
|
-
|
364
|
-
<Form.Control>
|
365
|
-
<Combobox
|
366
|
-
key="attribute"
|
367
|
-
{...field}
|
368
|
-
onChange={(e) => {
|
369
|
-
if (typeof e === "undefined") {
|
370
|
-
field.onChange(null)
|
371
|
-
} else {
|
372
|
-
field.onChange(e)
|
373
|
-
}
|
374
|
-
}}
|
375
|
-
allowClear
|
376
|
-
options={[
|
377
|
-
{
|
378
|
-
label: t("fields.customer"),
|
379
|
-
value: "customer_id",
|
380
|
-
},
|
381
|
-
{
|
382
|
-
label: t("fields.email"),
|
383
|
-
value: "customer_email",
|
384
|
-
},
|
385
|
-
]}
|
386
|
-
></Combobox>
|
387
|
-
</Form.Control>
|
388
|
-
<Form.ErrorMessage />
|
389
|
-
</Form.Item>
|
390
|
-
)
|
391
|
-
}}
|
392
|
-
/>
|
393
|
-
)}
|
394
345
|
</div>
|
395
346
|
</div>
|
396
347
|
)
|
package/src/routes/orders/order-create-refund/components/create-refund-form/create-refund-form.tsx
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
import { zodResolver } from "@hookform/resolvers/zod"
|
2
2
|
import { HttpTypes } from "@medusajs/types"
|
3
|
-
import {
|
4
|
-
|
3
|
+
import {
|
4
|
+
Button,
|
5
|
+
CurrencyInput,
|
6
|
+
Label,
|
7
|
+
Select,
|
8
|
+
Textarea,
|
9
|
+
toast,
|
10
|
+
} from "@medusajs/ui"
|
11
|
+
import { useEffect, useMemo, useState } from "react"
|
5
12
|
import { formatValue } from "react-currency-input-field"
|
6
13
|
import { useForm } from "react-hook-form"
|
7
14
|
import { useTranslation } from "react-i18next"
|
@@ -16,6 +23,7 @@ import { formatCurrency } from "../../../../../lib/format-currency"
|
|
16
23
|
import { getLocaleAmount } from "../../../../../lib/money-amount-helpers"
|
17
24
|
import { getPaymentsFromOrder } from "../../../../../lib/orders"
|
18
25
|
import { useDocumentDirection } from "../../../../../hooks/use-document-direction"
|
26
|
+
import { formatProvider } from "../../../../../lib/format-provider.ts"
|
19
27
|
|
20
28
|
type CreateRefundFormProps = {
|
21
29
|
order: HttpTypes.AdminOrder
|
@@ -36,11 +44,12 @@ export const CreateRefundForm = ({ order }: CreateRefundFormProps) => {
|
|
36
44
|
const { refund_reasons } = useRefundReasons()
|
37
45
|
|
38
46
|
const [searchParams] = useSearchParams()
|
47
|
+
const hasPaymentIdInSearchParams = !!searchParams.get("paymentId")
|
39
48
|
const [paymentId, setPaymentId] = useState<string | undefined>(
|
40
49
|
searchParams.get("paymentId") || undefined
|
41
50
|
)
|
42
51
|
const payments = getPaymentsFromOrder(order)
|
43
|
-
const payment = payments.find((p) => p.id === paymentId)
|
52
|
+
const payment = payments.find((p) => p.id === paymentId)
|
44
53
|
const paymentAmount = payment?.amount || 0
|
45
54
|
|
46
55
|
const currency = useMemo(
|
@@ -59,6 +68,23 @@ export const CreateRefundForm = ({ order }: CreateRefundFormProps) => {
|
|
59
68
|
resolver: zodResolver(CreateRefundSchema),
|
60
69
|
})
|
61
70
|
|
71
|
+
useEffect(() => {
|
72
|
+
const pendingDifference = order.summary.pending_difference as number
|
73
|
+
const paymentAmount = (payment?.amount || 0) as number
|
74
|
+
const pendingAmount =
|
75
|
+
pendingDifference < 0
|
76
|
+
? Math.min(Math.abs(pendingDifference), paymentAmount)
|
77
|
+
: paymentAmount
|
78
|
+
|
79
|
+
const normalizedAmount =
|
80
|
+
pendingAmount < 0 ? pendingAmount * -1 : pendingAmount
|
81
|
+
|
82
|
+
form.setValue("amount", {
|
83
|
+
value: normalizedAmount.toFixed(currency.decimal_digits),
|
84
|
+
float: normalizedAmount,
|
85
|
+
})
|
86
|
+
}, [payment?.id || ""])
|
87
|
+
|
62
88
|
const { mutateAsync, isPending } = useRefundPayment(order.id, payment?.id!)
|
63
89
|
|
64
90
|
const handleSubmit = form.handleSubmit(async (data) => {
|
@@ -96,16 +122,69 @@ export const CreateRefundForm = ({ order }: CreateRefundFormProps) => {
|
|
96
122
|
>
|
97
123
|
<RouteDrawer.Body className="flex-1 overflow-auto">
|
98
124
|
<div className="flex flex-col gap-y-4">
|
99
|
-
|
100
|
-
<
|
101
|
-
{
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
125
|
+
{!hasPaymentIdInSearchParams && (
|
126
|
+
<Select
|
127
|
+
dir={direction}
|
128
|
+
value={paymentId}
|
129
|
+
onValueChange={(value) => {
|
130
|
+
setPaymentId(value)
|
131
|
+
}}
|
132
|
+
>
|
133
|
+
<Label className="txt-compact-small mb-[-6px] font-sans font-medium">
|
134
|
+
{t("orders.payment.selectPaymentToRefund")}
|
135
|
+
</Label>
|
136
|
+
|
137
|
+
<Select.Trigger>
|
138
|
+
<Select.Value
|
139
|
+
placeholder={t("orders.payment.selectPaymentToRefund")}
|
140
|
+
/>
|
141
|
+
</Select.Trigger>
|
142
|
+
|
143
|
+
<Select.Content>
|
144
|
+
{payments.map((payment) => {
|
145
|
+
const totalRefunded =
|
146
|
+
payment.refunds?.reduce(
|
147
|
+
(acc, next) => next.amount + acc,
|
148
|
+
0
|
149
|
+
) || 0
|
150
|
+
|
151
|
+
return (
|
152
|
+
<Select.Item
|
153
|
+
value={payment!.id}
|
154
|
+
key={payment.id}
|
155
|
+
disabled={
|
156
|
+
!!payment.canceled_at ||
|
157
|
+
totalRefunded >= payment.amount
|
158
|
+
}
|
159
|
+
className="flex items-center justify-center"
|
160
|
+
>
|
161
|
+
<span>
|
162
|
+
{getLocaleAmount(
|
163
|
+
payment.amount as number,
|
164
|
+
payment.currency_code
|
165
|
+
)}
|
166
|
+
{" - "}
|
167
|
+
</span>
|
168
|
+
<span>{formatProvider(payment.provider_id)}</span>
|
169
|
+
<span> - (#{payment.id.substring(23)})</span>
|
170
|
+
</Select.Item>
|
171
|
+
)
|
172
|
+
})}
|
173
|
+
</Select.Content>
|
174
|
+
</Select>
|
175
|
+
)}
|
176
|
+
{hasPaymentIdInSearchParams && (
|
177
|
+
<div className="flex items-center">
|
178
|
+
<span>
|
179
|
+
{getLocaleAmount(
|
180
|
+
payment!.amount as number,
|
181
|
+
payment!.currency_code
|
182
|
+
)}
|
183
|
+
</span>
|
184
|
+
<span> - </span>
|
185
|
+
<span>(#{payment!.id.substring(23)})</span>
|
186
|
+
</div>
|
187
|
+
)}
|
109
188
|
|
110
189
|
<Form.Field
|
111
190
|
control={form.control}
|
@@ -139,13 +139,6 @@ export const CreatePromotionForm = () => {
|
|
139
139
|
}))
|
140
140
|
}
|
141
141
|
|
142
|
-
if (data.campaign) {
|
143
|
-
data.campaign.budget.attribute = data.campaign.budget.attribute || null
|
144
|
-
data.campaign.budget.type = data.campaign.budget.attribute
|
145
|
-
? "use_by_attribute"
|
146
|
-
: data.campaign.budget.type
|
147
|
-
}
|
148
|
-
|
149
142
|
createPromotion(
|
150
143
|
{
|
151
144
|
...promotionData,
|
@@ -2,15 +2,15 @@ import {
|
|
2
2
|
By
|
3
3
|
} from "./chunk-GXXQ33F7.mjs";
|
4
4
|
import "./chunk-PYIO3TDQ.mjs";
|
5
|
-
import {
|
6
|
-
formatProvider
|
7
|
-
} from "./chunk-IR5DHEKS.mjs";
|
8
5
|
import {
|
9
6
|
formatPercentage
|
10
7
|
} from "./chunk-4FM6S5CX.mjs";
|
11
8
|
import {
|
12
9
|
getLoyaltyPlugin
|
13
10
|
} from "./chunk-AMRS4CSX.mjs";
|
11
|
+
import {
|
12
|
+
formatProvider
|
13
|
+
} from "./chunk-IR5DHEKS.mjs";
|
14
14
|
import {
|
15
15
|
formatCurrency
|
16
16
|
} from "./chunk-WATKBUHQ.mjs";
|
@@ -20,10 +20,10 @@ import {
|
|
20
20
|
import {
|
21
21
|
useTaxRegionTableQuery
|
22
22
|
} from "./chunk-RIV7FKGN.mjs";
|
23
|
+
import "./chunk-4FM6S5CX.mjs";
|
23
24
|
import {
|
24
25
|
formatProvider
|
25
26
|
} from "./chunk-IR5DHEKS.mjs";
|
26
|
-
import "./chunk-4FM6S5CX.mjs";
|
27
27
|
import "./chunk-YEDAFXMB.mjs";
|
28
28
|
import "./chunk-HQKGZADC.mjs";
|
29
29
|
import "./chunk-EMIHDNB7.mjs";
|