@mercurjs/admin 2.2.0-canary.35 → 2.2.0-canary.37
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-FBS4ELIA.js → add-campaign-promotions-26SSHLLG.js} +3 -3
- package/dist/{campaign-detail-HMU2FMJL.js → campaign-detail-VMJQISAE.js} +4 -4
- package/dist/{category-create-7UTOSFO5.js → category-create-AIS2MG7E.js} +2 -2
- package/dist/{category-detail-PMNXMTV3.js → category-detail-I3EEPAQR.js} +3 -3
- package/dist/{category-icon-edit-FMVPTC27.js → category-icon-edit-W2TPCSDC.js} +1 -1
- package/dist/{category-list-B6B3ZANX.js → category-list-QLHQST3D.js} +2 -2
- package/dist/{category-media-4SLUTBZS.js → category-media-PC4V7YU4.js} +1 -1
- package/dist/{category-products-YMPKVXV4.js → category-products-XGLUDL73.js} +3 -2
- package/dist/{chunk-GQUGCSJV.js → chunk-2MRYNLVT.js} +1 -1
- package/dist/{chunk-XBD7UZZX.js → chunk-3UJQT6UR.js} +93 -45
- package/dist/{chunk-HHW4PPNH.js → chunk-4OCWOY2F.js} +8 -1
- package/dist/{chunk-VTHMDGGJ.js → chunk-4X4MNAXL.js} +1 -1
- package/dist/{chunk-P4GIBTTG.js → chunk-5BSSIDW6.js} +1 -1
- package/dist/{chunk-TJ5IONZX.js → chunk-5YWQDIVG.js} +2 -1
- package/dist/{chunk-HOUYHVRG.js → chunk-6YEVK7JJ.js} +22 -8
- package/dist/{chunk-TRXFVQXD.js → chunk-BLR3NTU6.js} +1 -1
- package/dist/{chunk-DPFGN6S6.js → chunk-C6AU3U22.js} +1 -1
- package/dist/{chunk-IUOZZMSQ.js → chunk-CMZ4KATG.js} +3 -3
- package/dist/{chunk-R3YD5UOZ.js → chunk-CU4UVEHX.js} +36 -1
- package/dist/{chunk-CBKKZYGU.js → chunk-E32O3DUM.js} +1 -1
- package/dist/{chunk-LNOZHSZV.js → chunk-EMW5WXXR.js} +1 -1
- package/dist/chunk-FU3QYH6H.js +111 -0
- package/dist/{chunk-TUPWRX62.js → chunk-GML7DINQ.js} +1 -1
- package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
- package/dist/{chunk-NDIVJLA3.js → chunk-GX7YQ6GM.js} +36 -4
- package/dist/{chunk-WMVLWFFU.js → chunk-HBT7GVJD.js} +3 -4
- package/dist/{chunk-CASK2IOQ.js → chunk-HMKXCYCJ.js} +29 -10
- package/dist/{chunk-YAOYZQDK.js → chunk-KUKBV4XN.js} +1 -1
- package/dist/{chunk-ISSZIRBL.js → chunk-LRKN7IQH.js} +1 -1
- package/dist/{chunk-RHFFLVYG.js → chunk-MHCIHDGF.js} +1 -1
- package/dist/{chunk-JHL6ZNJW.js → chunk-MKNQ6BT6.js} +1 -1
- package/dist/{chunk-PH24SLKA.js → chunk-NXMD36QG.js} +1 -1
- package/dist/{chunk-SU444Q24.js → chunk-O53E5U52.js} +0 -21
- package/dist/{chunk-3OZRK7TN.js → chunk-OTXOV6YU.js} +1 -1
- package/dist/{chunk-23R7IMRV.js → chunk-PAUULPNC.js} +1 -1
- package/dist/{chunk-WEWBHUEB.js → chunk-POMQZ6PN.js} +1 -1
- package/dist/{chunk-JDMYGQRU.js → chunk-PPMWEQP3.js} +9 -113
- package/dist/{chunk-LECZPR6R.js → chunk-QJCUPZZQ.js} +4 -2
- package/dist/{chunk-HLUWC7C3.js → chunk-RLGMY7JJ.js} +1 -1
- package/dist/{chunk-UULZCRTC.js → chunk-RZ43M34Q.js} +1 -1
- package/dist/{chunk-4ZXFOBOB.js → chunk-SWQC5UPD.js} +3 -3
- package/dist/{chunk-7WUQR3ZU.js → chunk-U725ING6.js} +1 -1
- package/dist/{chunk-T2WVIET2.js → chunk-VM56ZITS.js} +4 -2
- package/dist/{chunk-TFDRETCH.js → chunk-X3TWPSUM.js} +19 -23
- package/dist/{chunk-NX3YQW2B.js → chunk-XEB5I2KE.js} +2 -2
- package/dist/{chunk-C45OXCZW.js → chunk-YRGPQ2C4.js} +29 -2
- package/dist/{chunk-KW5DS5GL.js → chunk-ZDEIYWCK.js} +14 -4
- package/dist/{collection-add-products-E7YLYPY5.js → collection-add-products-2G37ZL2J.js} +1 -1
- package/dist/{collection-create-T6HBO4LU.js → collection-create-5IGFVQKE.js} +1 -1
- package/dist/{collection-detail-M4ETYKBU.js → collection-detail-AB6HGJDM.js} +3 -3
- package/dist/{collection-icon-edit-VZP3W6AZ.js → collection-icon-edit-WCSKUDXE.js} +1 -1
- package/dist/{collection-list-RSFOKJBX.js → collection-list-UHFUKA5U.js} +4 -4
- package/dist/{collection-media-3Z2RJDVG.js → collection-media-YIV5BV3Y.js} +1 -1
- package/dist/{commission-rule-commission-edit-6675TZCZ.js → commission-rule-commission-edit-EXLLNUKM.js} +19 -4
- package/dist/{commission-rule-create-PEYCFGCW.js → commission-rule-create-3MCNOSWN.js} +9 -28
- package/dist/{commission-rule-edit-GCI67KZU.js → commission-rule-edit-X45EQ6BK.js} +24 -1
- package/dist/{customer-detail-QH4IXPIR.js → customer-detail-ZYJDB47Y.js} +2 -1
- package/dist/{customer-group-add-customers-EOS25HL4.js → customer-group-add-customers-GSEUGBTJ.js} +1 -1
- package/dist/{customer-group-detail-XQOG6SZY.js → customer-group-detail-5VSUJTR3.js} +2 -2
- package/dist/{customer-list-ELN5NIKN.js → customer-list-6PRFTWMO.js} +2 -2
- package/dist/{customers-add-customer-group-PJ24V5YA.js → customers-add-customer-group-56GS7TR7.js} +3 -2
- package/dist/{global-commission-edit-AOZ6XLH7.js → global-commission-edit-7ZMMIV7B.js} +19 -12
- package/dist/index.js +72 -72
- package/dist/{inventory-create-HOQVSL2G.js → inventory-create-WJ3CCFTD.js} +2 -2
- package/dist/{inventory-stock-E4U2SS3Z.js → inventory-stock-F2BKMXY3.js} +1 -1
- package/dist/{location-service-zone-shipping-option-create-K6USZASG.js → location-service-zone-shipping-option-create-OLABLTSL.js} +3 -3
- package/dist/{location-service-zone-shipping-option-pricing-ZENGURN3.js → location-service-zone-shipping-option-pricing-TARZ34TW.js} +2 -2
- package/dist/{order-edit-billing-address-RN32LNJH.js → order-edit-billing-address-IU6W76P3.js} +1 -1
- package/dist/{order-list-ASX7QDPT.js → order-list-FFPY5OGR.js} +3 -2
- package/dist/pages/index.js +37 -36
- package/dist/{price-list-create-TDPYBF7D.js → price-list-create-UMA2NB3L.js} +4 -4
- package/dist/{price-list-detail-U5LPEFWH.js → price-list-detail-7ANY3XOC.js} +2 -2
- package/dist/{price-list-prices-add-J4GDJTQY.js → price-list-prices-add-XLFLGFVG.js} +4 -4
- package/dist/{price-list-prices-edit-LNSUSN4V.js → price-list-prices-edit-MT6BFF3M.js} +2 -2
- package/dist/{product-bulk-edit-34KKEPJQ.js → product-bulk-edit-3AJGOE6E.js} +1 -1
- package/dist/{product-create-OSG3NREE.js → product-create-2SELD5CI.js} +4 -4
- package/dist/{product-detail-T4FOYZK7.js → product-detail-O7MVTHSN.js} +1 -1
- package/dist/{product-edit-attribute-RE6L525Z.js → product-edit-attribute-BSPIDAZJ.js} +4 -27
- package/dist/{product-list-PQ3UMA2U.js → product-list-SIQDX4AT.js} +2 -2
- package/dist/{product-media-7HLOXWZZ.js → product-media-S6L3IHUO.js} +2 -2
- package/dist/{product-organization-XHIT5HXK.js → product-organization-BYPV5QSZ.js} +1 -1
- package/dist/{product-tag-detail-W3NUBZ6N.js → product-tag-detail-SVDEVPMA.js} +5 -5
- package/dist/{product-tag-list-4KNHKDAV.js → product-tag-list-4ECQFBOA.js} +4 -4
- package/dist/{product-type-detail-GNCVQKQU.js → product-type-detail-WSHUE56F.js} +2 -2
- package/dist/{promotion-detail-7V235FES.js → promotion-detail-25JCCLU2.js} +3 -3
- package/dist/{promotion-list-LKK3V2CK.js → promotion-list-RXLVU4G2.js} +4 -4
- package/dist/{refund-reason-list-AC3RCTYI.js → refund-reason-list-XMDZO34F.js} +4 -4
- package/dist/{reset-password-R6KN32M2.js → reset-password-GBVMOKXP.js} +1 -1
- package/dist/{return-reason-list-KRLDNVBC.js → return-reason-list-AW6MMUKD.js} +4 -4
- package/dist/{sales-channel-add-products-HFS7S4XB.js → sales-channel-add-products-LRANEISZ.js} +1 -1
- package/dist/{sales-channel-detail-SZVBKHKH.js → sales-channel-detail-5XXO3BXP.js} +2 -2
- package/dist/{store-bulk-edit-5DZ7RZS3.js → store-bulk-edit-I6QHGMEC.js} +1 -1
- package/dist/{store-details-5JNTBHRP.js → store-details-XNBFIWDL.js} +3 -3
- package/dist/{store-edit-KUNXCGSI.js → store-edit-BBOEDZNV.js} +2 -2
- package/dist/{store-list-ISPAQ4U3.js → store-list-RVZG3UD3.js} +1 -1
- package/dist/{tax-region-create-E63FR7XD.js → tax-region-create-7432IFN5.js} +1 -1
- package/dist/{tax-region-tax-override-create-K6EV53SE.js → tax-region-tax-override-create-WRUNCP67.js} +5 -5
- package/dist/{tax-region-tax-override-edit-A5UDUAMZ.js → tax-region-tax-override-edit-EOIDY4LX.js} +5 -5
- package/package.json +6 -6
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
PriceListRulesSchema,
|
|
7
7
|
usePriceListCurrencyData,
|
|
8
8
|
usePriceListGridColumns
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OTXOV6YU.js";
|
|
10
10
|
import {
|
|
11
11
|
exctractPricesFromProducts,
|
|
12
12
|
isProductRow
|
|
13
13
|
} from "./chunk-U5MJIHLY.js";
|
|
14
14
|
import {
|
|
15
15
|
useProductTableColumns
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-O53E5U52.js";
|
|
17
17
|
import {
|
|
18
18
|
useProductTableFilters
|
|
19
19
|
} from "./chunk-P4LTLPTK.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./chunk-FREUYHMS.js";
|
|
28
28
|
import {
|
|
29
29
|
DataGrid
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4OCWOY2F.js";
|
|
31
31
|
import {
|
|
32
32
|
RouteFocusModal,
|
|
33
33
|
StackedFocusModal,
|
|
@@ -158,6 +158,8 @@ import {
|
|
|
158
158
|
EllipsisHorizontal,
|
|
159
159
|
InformationCircleSolid,
|
|
160
160
|
Photo,
|
|
161
|
+
QueueList,
|
|
162
|
+
StackPerspective,
|
|
161
163
|
ThumbnailBadge,
|
|
162
164
|
Trash,
|
|
163
165
|
XMark as XMark2
|
|
@@ -288,7 +290,7 @@ var CollectionMediaItemMenu = ({
|
|
|
288
290
|
/* @__PURE__ */ jsx3(
|
|
289
291
|
MenuItemWithTooltip,
|
|
290
292
|
{
|
|
291
|
-
icon: /* @__PURE__ */ jsx3(
|
|
293
|
+
icon: /* @__PURE__ */ jsx3(StackPerspective, {}),
|
|
292
294
|
label: item.is_thumbnail ? t("collections.media.actions.removeThumbnail") : t("collections.media.actions.setThumbnail"),
|
|
293
295
|
tooltip: t("collections.media.tooltips.thumbnail"),
|
|
294
296
|
onClick: onToggleThumbnail
|
|
@@ -297,7 +299,7 @@ var CollectionMediaItemMenu = ({
|
|
|
297
299
|
/* @__PURE__ */ jsx3(
|
|
298
300
|
MenuItemWithTooltip,
|
|
299
301
|
{
|
|
300
|
-
icon: /* @__PURE__ */ jsx3(
|
|
302
|
+
icon: /* @__PURE__ */ jsx3(QueueList, {}),
|
|
301
303
|
label: item.is_banner ? t("collections.media.actions.removeBanner") : t("collections.media.actions.setBanner"),
|
|
302
304
|
tooltip: t("collections.media.tooltips.banner"),
|
|
303
305
|
onClick: onToggleBanner
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCollectionGallery,
|
|
3
3
|
getCollectionIcon
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VM56ZITS.js";
|
|
5
5
|
import {
|
|
6
6
|
useProductTableColumns
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O53E5U52.js";
|
|
8
8
|
import {
|
|
9
9
|
useProductTableFilters
|
|
10
10
|
} from "./chunk-P4LTLPTK.js";
|
|
@@ -425,27 +425,23 @@ var useColumns = () => {
|
|
|
425
425
|
() => [
|
|
426
426
|
columnHelper.display({
|
|
427
427
|
id: "select",
|
|
428
|
-
header: ({ table }) =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
);
|
|
448
|
-
}
|
|
428
|
+
header: ({ table }) => /* @__PURE__ */ jsx4(
|
|
429
|
+
Checkbox,
|
|
430
|
+
{
|
|
431
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
432
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
433
|
+
"data-testid": "products-table-header-select-checkbox"
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
cell: ({ row }) => /* @__PURE__ */ jsx4(
|
|
437
|
+
Checkbox,
|
|
438
|
+
{
|
|
439
|
+
checked: row.getIsSelected(),
|
|
440
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
441
|
+
onClick: (e) => e.stopPropagation(),
|
|
442
|
+
"data-testid": `products-table-cell-${row.id}-select-checkbox`
|
|
443
|
+
}
|
|
444
|
+
)
|
|
449
445
|
}),
|
|
450
446
|
...columns,
|
|
451
447
|
columnHelper.display({
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ShippingOptionPriceProvider,
|
|
5
5
|
buildShippingOptionPriceRules,
|
|
6
6
|
useShippingOptionPriceColumns
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2MRYNLVT.js";
|
|
8
8
|
import {
|
|
9
9
|
CONDITIONAL_PRICES_STACKED_MODAL_ID,
|
|
10
10
|
ShippingOptionPriceType
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from "./chunk-2EME4AWX.js";
|
|
32
32
|
import {
|
|
33
33
|
DataGrid
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4OCWOY2F.js";
|
|
35
35
|
import {
|
|
36
36
|
RouteFocusModal,
|
|
37
37
|
StackedFocusModal,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useProductTableColumns
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O53E5U52.js";
|
|
4
4
|
import {
|
|
5
5
|
useProductTableFilters
|
|
6
6
|
} from "./chunk-P4LTLPTK.js";
|
|
@@ -31,7 +31,14 @@ import { Children as Children2 } from "react";
|
|
|
31
31
|
|
|
32
32
|
// src/pages/products/product-list/components/product-list-table/product-list-table.tsx
|
|
33
33
|
import { PencilSquare, Trash } from "@medusajs/icons";
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
Button,
|
|
36
|
+
Checkbox,
|
|
37
|
+
Container,
|
|
38
|
+
Heading,
|
|
39
|
+
toast,
|
|
40
|
+
usePrompt
|
|
41
|
+
} from "@medusajs/ui";
|
|
35
42
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
36
43
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
37
44
|
import { useMemo, useState, Children } from "react";
|
|
@@ -261,6 +268,26 @@ var useColumns = () => {
|
|
|
261
268
|
const base = useProductTableColumns();
|
|
262
269
|
const columns = useMemo(
|
|
263
270
|
() => [
|
|
271
|
+
columnHelper.display({
|
|
272
|
+
id: "select",
|
|
273
|
+
header: ({ table }) => /* @__PURE__ */ jsx(
|
|
274
|
+
Checkbox,
|
|
275
|
+
{
|
|
276
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
277
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
278
|
+
"data-testid": "products-table-header-select-checkbox"
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
282
|
+
Checkbox,
|
|
283
|
+
{
|
|
284
|
+
checked: row.getIsSelected(),
|
|
285
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
286
|
+
onClick: (e) => e.stopPropagation(),
|
|
287
|
+
"data-testid": `products-table-cell-${row.id}-select-checkbox`
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
}),
|
|
264
291
|
...base,
|
|
265
292
|
columnHelper.display({
|
|
266
293
|
id: "actions",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-AJLGY3LQ.js";
|
|
4
4
|
import {
|
|
5
5
|
i18n
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6YEVK7JJ.js";
|
|
7
7
|
import {
|
|
8
8
|
require_dist
|
|
9
9
|
} from "./chunk-YZBEJ3CY.js";
|
|
@@ -220,7 +220,9 @@ var ProductCreateVariantSchema = z.object({
|
|
|
220
220
|
variant_rank: z.number()
|
|
221
221
|
});
|
|
222
222
|
var ProductCreateSchema = z.object({
|
|
223
|
-
title: z.string().min(1
|
|
223
|
+
title: z.string().min(1, {
|
|
224
|
+
message: i18n.t("products.create.errors.requiredTitle")
|
|
225
|
+
}),
|
|
224
226
|
subtitle: z.string().optional(),
|
|
225
227
|
handle: z.string().optional(),
|
|
226
228
|
description: z.string().optional(),
|
|
@@ -228,7 +230,7 @@ var ProductCreateSchema = z.object({
|
|
|
228
230
|
globally_available: z.boolean(),
|
|
229
231
|
type_id: z.string().optional(),
|
|
230
232
|
collection_id: z.string().optional(),
|
|
231
|
-
category_id: z.string().min(1),
|
|
233
|
+
category_id: z.string().min(1, i18n.t("products.create.errors.requiredCategory")),
|
|
232
234
|
seller_ids: z.array(z.string()).optional(),
|
|
233
235
|
tags: z.array(z.string()).optional(),
|
|
234
236
|
origin_country: z.string().optional(),
|
|
@@ -266,10 +268,18 @@ var ProductCreateSchema = z.object({
|
|
|
266
268
|
if (!attr.is_required) return;
|
|
267
269
|
const isEmpty = attr.values === void 0 || attr.values === "" || Array.isArray(attr.values) && attr.values.length === 0;
|
|
268
270
|
if (isEmpty) {
|
|
271
|
+
let messageKey = "products.create.errors.requiredAttribute";
|
|
272
|
+
if (attr.type === "single_select" || attr.type === "toggle") {
|
|
273
|
+
messageKey = "products.create.errors.requiredAttributeSelect";
|
|
274
|
+
} else if (attr.type === "multi_select") {
|
|
275
|
+
messageKey = "products.create.errors.requiredAttributeMultiSelect";
|
|
276
|
+
} else if (attr.type === "text" || attr.type === "unit") {
|
|
277
|
+
messageKey = "products.create.errors.requiredAttributeEnter";
|
|
278
|
+
}
|
|
269
279
|
ctx.addIssue({
|
|
270
280
|
code: z.ZodIssueCode.custom,
|
|
271
281
|
path: [`attributes.${index}.values`],
|
|
272
|
-
message: i18n.t(
|
|
282
|
+
message: i18n.t(messageKey)
|
|
273
283
|
});
|
|
274
284
|
}
|
|
275
285
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectionDetailPage
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-X3TWPSUM.js";
|
|
4
|
+
import "./chunk-VM56ZITS.js";
|
|
5
|
+
import "./chunk-O53E5U52.js";
|
|
6
6
|
import "./chunk-WBSUHLO7.js";
|
|
7
7
|
import "./chunk-P4LTLPTK.js";
|
|
8
8
|
import "./chunk-FWPGOIFA.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectionListPage
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KUKBV4XN.js";
|
|
4
|
+
import "./chunk-5BSSIDW6.js";
|
|
5
5
|
import "./chunk-KOURHC2N.js";
|
|
6
6
|
import "./chunk-2ZFELO2L.js";
|
|
7
7
|
import "./chunk-26OOAKQ6.js";
|
|
@@ -9,7 +9,7 @@ import "./chunk-ZQZHFMD7.js";
|
|
|
9
9
|
import "./chunk-C4N5EJAD.js";
|
|
10
10
|
import "./chunk-OI4DJXUL.js";
|
|
11
11
|
import "./chunk-HGTPUAHD.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VM56ZITS.js";
|
|
13
13
|
import "./chunk-S2WEYEQR.js";
|
|
14
14
|
import "./chunk-WKTRJNOK.js";
|
|
15
15
|
import "./chunk-MG4GKUJW.js";
|
|
@@ -20,7 +20,7 @@ import "./chunk-7SVLKK6Q.js";
|
|
|
20
20
|
import "./chunk-GR6JUIRU.js";
|
|
21
21
|
import "./chunk-QUHSHIAC.js";
|
|
22
22
|
import "./chunk-3XOE4NV5.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-GRH7C3QN.js";
|
|
24
24
|
import "./chunk-DY3XQPHC.js";
|
|
25
25
|
import "./chunk-JHIMVLB2.js";
|
|
26
26
|
import "./chunk-P4LTLPTK.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionValueFields,
|
|
3
|
+
addCommissionValueIssues,
|
|
4
|
+
optionalAmount,
|
|
3
5
|
useStoreCurrencies
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CU4UVEHX.js";
|
|
5
7
|
import {
|
|
6
8
|
buildValuesPayload,
|
|
7
9
|
fixedValuesFromRate
|
|
@@ -39,6 +41,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
39
41
|
// src/pages/commissions/commission-rule-commission-edit/commission-rule-commission-edit.tsx
|
|
40
42
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
41
43
|
import { Button, Heading, toast } from "@medusajs/ui";
|
|
44
|
+
import { useMemo } from "react";
|
|
42
45
|
import { useForm } from "react-hook-form";
|
|
43
46
|
import { useTranslation } from "react-i18next";
|
|
44
47
|
import { useParams } from "react-router-dom";
|
|
@@ -46,11 +49,19 @@ import * as zod from "zod";
|
|
|
46
49
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
47
50
|
var EditCommissionSchema = zod.object({
|
|
48
51
|
type: zod.enum(["percentage", "fixed"]),
|
|
49
|
-
value:
|
|
50
|
-
fixed_values: zod.record(zod.string(),
|
|
52
|
+
value: optionalAmount,
|
|
53
|
+
fixed_values: zod.record(zod.string(), optionalAmount).optional(),
|
|
51
54
|
include_tax: zod.boolean(),
|
|
52
55
|
include_shipping: zod.boolean()
|
|
53
56
|
});
|
|
57
|
+
var createEditCommissionSchema = (currencies) => EditCommissionSchema.superRefine((data, ctx) => {
|
|
58
|
+
addCommissionValueIssues(ctx, {
|
|
59
|
+
type: data.type,
|
|
60
|
+
value: data.value,
|
|
61
|
+
fixedValues: data.fixed_values,
|
|
62
|
+
currencies
|
|
63
|
+
});
|
|
64
|
+
});
|
|
54
65
|
var EditCommissionForm = ({ rule }) => {
|
|
55
66
|
const { t } = useTranslation();
|
|
56
67
|
const { handleSuccess } = useRouteModal();
|
|
@@ -59,6 +70,10 @@ var EditCommissionForm = ({ rule }) => {
|
|
|
59
70
|
{ value: "percentage", label: t("commissions.fields.type.percentage") },
|
|
60
71
|
{ value: "fixed", label: t("commissions.fields.type.fixed") }
|
|
61
72
|
];
|
|
73
|
+
const resolver = useMemo(
|
|
74
|
+
() => zodResolver(createEditCommissionSchema(currencies)),
|
|
75
|
+
[currencies]
|
|
76
|
+
);
|
|
62
77
|
const form = useForm({
|
|
63
78
|
defaultValues: {
|
|
64
79
|
type: rule.type,
|
|
@@ -67,7 +82,7 @@ var EditCommissionForm = ({ rule }) => {
|
|
|
67
82
|
include_tax: rule.include_tax,
|
|
68
83
|
include_shipping: rule.include_shipping
|
|
69
84
|
},
|
|
70
|
-
resolver
|
|
85
|
+
resolver
|
|
71
86
|
});
|
|
72
87
|
const { mutateAsync, isPending } = useUpdateCommissionRule(rule.id);
|
|
73
88
|
const handleSubmit = form.handleSubmit(async (values) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionValueFields,
|
|
3
|
+
addCommissionValueIssues,
|
|
4
|
+
optionalAmount,
|
|
3
5
|
useStoreCurrencies
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CU4UVEHX.js";
|
|
5
7
|
import "./chunk-QR3GYYX6.js";
|
|
6
8
|
import {
|
|
7
9
|
SCOPE_TYPE_DIMENSIONS,
|
|
@@ -323,13 +325,6 @@ CreateCommissionRuleDetails._tabMeta = defineTabMeta(
|
|
|
323
325
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/schema.ts
|
|
324
326
|
import i18n from "i18next";
|
|
325
327
|
import * as zod from "zod";
|
|
326
|
-
var optionalAmount = zod.preprocess((val) => {
|
|
327
|
-
if (val === "" || val === null || val === void 0) {
|
|
328
|
-
return void 0;
|
|
329
|
-
}
|
|
330
|
-
const parsed = typeof val === "number" ? val : Number(val);
|
|
331
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
332
|
-
}, zod.number().optional());
|
|
333
328
|
var baseCommissionRuleSchema = zod.object({
|
|
334
329
|
title: zod.string().min(1, { message: i18n.t("commissions.validation.titleRequired") }),
|
|
335
330
|
code: zod.string().min(1, { message: i18n.t("commissions.validation.codeRequired") }),
|
|
@@ -372,26 +367,12 @@ var createCommissionRuleSchema = (currencies = []) => baseCommissionRuleSchema.s
|
|
|
372
367
|
message: i18n.t("commissions.validation.categoriesRequired")
|
|
373
368
|
});
|
|
374
369
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
} else {
|
|
384
|
-
currencies.forEach((code) => {
|
|
385
|
-
const amount = data.fixed_values?.[code];
|
|
386
|
-
if (amount === void 0 || Number.isNaN(amount)) {
|
|
387
|
-
ctx.addIssue({
|
|
388
|
-
code: zod.ZodIssueCode.custom,
|
|
389
|
-
path: ["fixed_values", code],
|
|
390
|
-
message: i18n.t("commissions.validation.value")
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
}
|
|
370
|
+
addCommissionValueIssues(ctx, {
|
|
371
|
+
type: data.commissionType,
|
|
372
|
+
value: data.value,
|
|
373
|
+
fixedValues: data.fixed_values,
|
|
374
|
+
currencies
|
|
375
|
+
});
|
|
395
376
|
});
|
|
396
377
|
|
|
397
378
|
// src/pages/commissions/commission-rule-create/components/create-commission-rule-form/create-commission-rule-form.tsx
|
|
@@ -49,7 +49,7 @@ import * as zod from "zod";
|
|
|
49
49
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
50
50
|
var EditCommissionRuleSchema = zod.object({
|
|
51
51
|
status: zod.enum(["active", "inactive"]),
|
|
52
|
-
name: zod.string().min(1),
|
|
52
|
+
name: zod.string().min(1, { message: i18n.t("commissions.validation.titleRequired") }),
|
|
53
53
|
code: zod.string().min(1, { message: i18n.t("commissions.validation.codeRequired") }),
|
|
54
54
|
scopeType: zod.enum([
|
|
55
55
|
"store",
|
|
@@ -61,6 +61,29 @@ var EditCommissionRuleSchema = zod.object({
|
|
|
61
61
|
stores: zod.array(zod.string()),
|
|
62
62
|
productTypes: zod.array(zod.string()),
|
|
63
63
|
categories: zod.array(zod.string())
|
|
64
|
+
}).superRefine((data, ctx) => {
|
|
65
|
+
const dimensions = SCOPE_TYPE_DIMENSIONS[data.scopeType];
|
|
66
|
+
if (dimensions.includes("seller") && data.stores.length === 0) {
|
|
67
|
+
ctx.addIssue({
|
|
68
|
+
code: zod.ZodIssueCode.custom,
|
|
69
|
+
path: ["stores"],
|
|
70
|
+
message: i18n.t("commissions.validation.storesRequired")
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (dimensions.includes("product_type") && data.productTypes.length === 0) {
|
|
74
|
+
ctx.addIssue({
|
|
75
|
+
code: zod.ZodIssueCode.custom,
|
|
76
|
+
path: ["productTypes"],
|
|
77
|
+
message: i18n.t("commissions.validation.productTypesRequired")
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (dimensions.includes("product_category") && data.categories.length === 0) {
|
|
81
|
+
ctx.addIssue({
|
|
82
|
+
code: zod.ZodIssueCode.custom,
|
|
83
|
+
path: ["categories"],
|
|
84
|
+
message: i18n.t("commissions.validation.categoriesRequired")
|
|
85
|
+
});
|
|
86
|
+
}
|
|
64
87
|
});
|
|
65
88
|
var EditCommissionRuleForm = ({ rule }) => {
|
|
66
89
|
const { t } = useTranslation();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomerDetailPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HMKXCYCJ.js";
|
|
4
4
|
import "./chunk-54EPH67T.js";
|
|
5
5
|
import "./chunk-OI4DJXUL.js";
|
|
6
|
+
import "./chunk-FU3QYH6H.js";
|
|
6
7
|
import "./chunk-QUHSHIAC.js";
|
|
7
8
|
import "./chunk-3XOE4NV5.js";
|
|
8
9
|
import "./chunk-TZSOL34K.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CUSTOMER_GROUP_DETAIL_FIELDS,
|
|
3
3
|
CustomerGroupDetailPage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EMW5WXXR.js";
|
|
5
5
|
import "./chunk-QG6PLWNH.js";
|
|
6
6
|
import "./chunk-HGTPUAHD.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-GRH7C3QN.js";
|
|
8
8
|
import "./chunk-25LYVP3C.js";
|
|
9
9
|
import "./chunk-DB6ANJBO.js";
|
|
10
10
|
import "./chunk-PHOCVOZ5.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomerListPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5YWQDIVG.js";
|
|
4
4
|
import "./chunk-QG6PLWNH.js";
|
|
5
5
|
import "./chunk-HGTPUAHD.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-GRH7C3QN.js";
|
|
7
7
|
import "./chunk-25LYVP3C.js";
|
|
8
8
|
import "./chunk-DB6ANJBO.js";
|
|
9
9
|
import "./chunk-PHOCVOZ5.js";
|
package/dist/{customers-add-customer-group-PJ24V5YA.js → customers-add-customer-group-56GS7TR7.js}
RENAMED
|
@@ -158,9 +158,10 @@ var AddCustomerGroupsForm = ({
|
|
|
158
158
|
setIsPending(true);
|
|
159
159
|
try {
|
|
160
160
|
await batchCustomerCustomerGroups({ add: data.customer_group_ids });
|
|
161
|
+
const names = data.customer_group_ids.map((id) => customer_groups?.find((g) => g.id === id)?.name).filter(Boolean);
|
|
161
162
|
toast.success(
|
|
162
|
-
t("customers.groups.add.
|
|
163
|
-
groups:
|
|
163
|
+
names.length === 1 ? t("customers.groups.add.successOne", { groups: names[0] }) : t("customers.groups.add.successMany", {
|
|
164
|
+
groups: names.join(", ")
|
|
164
165
|
})
|
|
165
166
|
);
|
|
166
167
|
handleSuccess(`/customers/${customerId}`);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommissionValueFields,
|
|
3
|
+
addCommissionValueIssues,
|
|
4
|
+
optionalAmount,
|
|
3
5
|
useStoreCurrencies
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CU4UVEHX.js";
|
|
5
7
|
import {
|
|
6
8
|
buildValuesPayload,
|
|
7
9
|
fixedValuesFromRate
|
|
@@ -40,6 +42,7 @@ import "./chunk-NBMM2TZK.js";
|
|
|
40
42
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
41
43
|
import { Button, Heading, Input, toast } from "@medusajs/ui";
|
|
42
44
|
import i18n from "i18next";
|
|
45
|
+
import { useMemo } from "react";
|
|
43
46
|
import { useForm } from "react-hook-form";
|
|
44
47
|
import { useTranslation } from "react-i18next";
|
|
45
48
|
import * as zod from "zod";
|
|
@@ -47,18 +50,18 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
47
50
|
var EditGlobalCommissionSchema = zod.object({
|
|
48
51
|
code: zod.string().min(1, { message: i18n.t("commissions.validation.codeRequired") }),
|
|
49
52
|
type: zod.enum(["percentage", "fixed"]),
|
|
50
|
-
value:
|
|
51
|
-
fixed_values: zod.record(zod.string(),
|
|
53
|
+
value: optionalAmount,
|
|
54
|
+
fixed_values: zod.record(zod.string(), optionalAmount).optional(),
|
|
52
55
|
include_tax: zod.boolean(),
|
|
53
56
|
include_shipping: zod.boolean()
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
57
|
+
});
|
|
58
|
+
var createEditGlobalCommissionSchema = (currencies) => EditGlobalCommissionSchema.superRefine((data, ctx) => {
|
|
59
|
+
addCommissionValueIssues(ctx, {
|
|
60
|
+
type: data.type,
|
|
61
|
+
value: data.value,
|
|
62
|
+
fixedValues: data.fixed_values,
|
|
63
|
+
currencies
|
|
64
|
+
});
|
|
62
65
|
});
|
|
63
66
|
var EditGlobalCommissionForm = ({ rate }) => {
|
|
64
67
|
const { t } = useTranslation();
|
|
@@ -68,6 +71,10 @@ var EditGlobalCommissionForm = ({ rate }) => {
|
|
|
68
71
|
{ value: "percentage", label: t("commissions.fields.type.percentage") },
|
|
69
72
|
{ value: "fixed", label: t("commissions.fields.type.fixed") }
|
|
70
73
|
];
|
|
74
|
+
const resolver = useMemo(
|
|
75
|
+
() => zodResolver(createEditGlobalCommissionSchema(currencies)),
|
|
76
|
+
[currencies]
|
|
77
|
+
);
|
|
71
78
|
const form = useForm({
|
|
72
79
|
defaultValues: {
|
|
73
80
|
code: rate.code,
|
|
@@ -77,7 +84,7 @@ var EditGlobalCommissionForm = ({ rate }) => {
|
|
|
77
84
|
include_tax: rate.include_tax,
|
|
78
85
|
include_shipping: rate.include_shipping
|
|
79
86
|
},
|
|
80
|
-
resolver
|
|
87
|
+
resolver
|
|
81
88
|
});
|
|
82
89
|
const { mutateAsync, isPending } = useUpdateCommissionRule(rate.id);
|
|
83
90
|
const handleSubmit = form.handleSubmit(async (values) => {
|