@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.
Files changed (99) hide show
  1. package/dist/{add-campaign-promotions-FBS4ELIA.js → add-campaign-promotions-26SSHLLG.js} +3 -3
  2. package/dist/{campaign-detail-HMU2FMJL.js → campaign-detail-VMJQISAE.js} +4 -4
  3. package/dist/{category-create-7UTOSFO5.js → category-create-AIS2MG7E.js} +2 -2
  4. package/dist/{category-detail-PMNXMTV3.js → category-detail-I3EEPAQR.js} +3 -3
  5. package/dist/{category-icon-edit-FMVPTC27.js → category-icon-edit-W2TPCSDC.js} +1 -1
  6. package/dist/{category-list-B6B3ZANX.js → category-list-QLHQST3D.js} +2 -2
  7. package/dist/{category-media-4SLUTBZS.js → category-media-PC4V7YU4.js} +1 -1
  8. package/dist/{category-products-YMPKVXV4.js → category-products-XGLUDL73.js} +3 -2
  9. package/dist/{chunk-GQUGCSJV.js → chunk-2MRYNLVT.js} +1 -1
  10. package/dist/{chunk-XBD7UZZX.js → chunk-3UJQT6UR.js} +93 -45
  11. package/dist/{chunk-HHW4PPNH.js → chunk-4OCWOY2F.js} +8 -1
  12. package/dist/{chunk-VTHMDGGJ.js → chunk-4X4MNAXL.js} +1 -1
  13. package/dist/{chunk-P4GIBTTG.js → chunk-5BSSIDW6.js} +1 -1
  14. package/dist/{chunk-TJ5IONZX.js → chunk-5YWQDIVG.js} +2 -1
  15. package/dist/{chunk-HOUYHVRG.js → chunk-6YEVK7JJ.js} +22 -8
  16. package/dist/{chunk-TRXFVQXD.js → chunk-BLR3NTU6.js} +1 -1
  17. package/dist/{chunk-DPFGN6S6.js → chunk-C6AU3U22.js} +1 -1
  18. package/dist/{chunk-IUOZZMSQ.js → chunk-CMZ4KATG.js} +3 -3
  19. package/dist/{chunk-R3YD5UOZ.js → chunk-CU4UVEHX.js} +36 -1
  20. package/dist/{chunk-CBKKZYGU.js → chunk-E32O3DUM.js} +1 -1
  21. package/dist/{chunk-LNOZHSZV.js → chunk-EMW5WXXR.js} +1 -1
  22. package/dist/chunk-FU3QYH6H.js +111 -0
  23. package/dist/{chunk-TUPWRX62.js → chunk-GML7DINQ.js} +1 -1
  24. package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
  25. package/dist/{chunk-NDIVJLA3.js → chunk-GX7YQ6GM.js} +36 -4
  26. package/dist/{chunk-WMVLWFFU.js → chunk-HBT7GVJD.js} +3 -4
  27. package/dist/{chunk-CASK2IOQ.js → chunk-HMKXCYCJ.js} +29 -10
  28. package/dist/{chunk-YAOYZQDK.js → chunk-KUKBV4XN.js} +1 -1
  29. package/dist/{chunk-ISSZIRBL.js → chunk-LRKN7IQH.js} +1 -1
  30. package/dist/{chunk-RHFFLVYG.js → chunk-MHCIHDGF.js} +1 -1
  31. package/dist/{chunk-JHL6ZNJW.js → chunk-MKNQ6BT6.js} +1 -1
  32. package/dist/{chunk-PH24SLKA.js → chunk-NXMD36QG.js} +1 -1
  33. package/dist/{chunk-SU444Q24.js → chunk-O53E5U52.js} +0 -21
  34. package/dist/{chunk-3OZRK7TN.js → chunk-OTXOV6YU.js} +1 -1
  35. package/dist/{chunk-23R7IMRV.js → chunk-PAUULPNC.js} +1 -1
  36. package/dist/{chunk-WEWBHUEB.js → chunk-POMQZ6PN.js} +1 -1
  37. package/dist/{chunk-JDMYGQRU.js → chunk-PPMWEQP3.js} +9 -113
  38. package/dist/{chunk-LECZPR6R.js → chunk-QJCUPZZQ.js} +4 -2
  39. package/dist/{chunk-HLUWC7C3.js → chunk-RLGMY7JJ.js} +1 -1
  40. package/dist/{chunk-UULZCRTC.js → chunk-RZ43M34Q.js} +1 -1
  41. package/dist/{chunk-4ZXFOBOB.js → chunk-SWQC5UPD.js} +3 -3
  42. package/dist/{chunk-7WUQR3ZU.js → chunk-U725ING6.js} +1 -1
  43. package/dist/{chunk-T2WVIET2.js → chunk-VM56ZITS.js} +4 -2
  44. package/dist/{chunk-TFDRETCH.js → chunk-X3TWPSUM.js} +19 -23
  45. package/dist/{chunk-NX3YQW2B.js → chunk-XEB5I2KE.js} +2 -2
  46. package/dist/{chunk-C45OXCZW.js → chunk-YRGPQ2C4.js} +29 -2
  47. package/dist/{chunk-KW5DS5GL.js → chunk-ZDEIYWCK.js} +14 -4
  48. package/dist/{collection-add-products-E7YLYPY5.js → collection-add-products-2G37ZL2J.js} +1 -1
  49. package/dist/{collection-create-T6HBO4LU.js → collection-create-5IGFVQKE.js} +1 -1
  50. package/dist/{collection-detail-M4ETYKBU.js → collection-detail-AB6HGJDM.js} +3 -3
  51. package/dist/{collection-icon-edit-VZP3W6AZ.js → collection-icon-edit-WCSKUDXE.js} +1 -1
  52. package/dist/{collection-list-RSFOKJBX.js → collection-list-UHFUKA5U.js} +4 -4
  53. package/dist/{collection-media-3Z2RJDVG.js → collection-media-YIV5BV3Y.js} +1 -1
  54. package/dist/{commission-rule-commission-edit-6675TZCZ.js → commission-rule-commission-edit-EXLLNUKM.js} +19 -4
  55. package/dist/{commission-rule-create-PEYCFGCW.js → commission-rule-create-3MCNOSWN.js} +9 -28
  56. package/dist/{commission-rule-edit-GCI67KZU.js → commission-rule-edit-X45EQ6BK.js} +24 -1
  57. package/dist/{customer-detail-QH4IXPIR.js → customer-detail-ZYJDB47Y.js} +2 -1
  58. package/dist/{customer-group-add-customers-EOS25HL4.js → customer-group-add-customers-GSEUGBTJ.js} +1 -1
  59. package/dist/{customer-group-detail-XQOG6SZY.js → customer-group-detail-5VSUJTR3.js} +2 -2
  60. package/dist/{customer-list-ELN5NIKN.js → customer-list-6PRFTWMO.js} +2 -2
  61. package/dist/{customers-add-customer-group-PJ24V5YA.js → customers-add-customer-group-56GS7TR7.js} +3 -2
  62. package/dist/{global-commission-edit-AOZ6XLH7.js → global-commission-edit-7ZMMIV7B.js} +19 -12
  63. package/dist/index.js +72 -72
  64. package/dist/{inventory-create-HOQVSL2G.js → inventory-create-WJ3CCFTD.js} +2 -2
  65. package/dist/{inventory-stock-E4U2SS3Z.js → inventory-stock-F2BKMXY3.js} +1 -1
  66. package/dist/{location-service-zone-shipping-option-create-K6USZASG.js → location-service-zone-shipping-option-create-OLABLTSL.js} +3 -3
  67. package/dist/{location-service-zone-shipping-option-pricing-ZENGURN3.js → location-service-zone-shipping-option-pricing-TARZ34TW.js} +2 -2
  68. package/dist/{order-edit-billing-address-RN32LNJH.js → order-edit-billing-address-IU6W76P3.js} +1 -1
  69. package/dist/{order-list-ASX7QDPT.js → order-list-FFPY5OGR.js} +3 -2
  70. package/dist/pages/index.js +37 -36
  71. package/dist/{price-list-create-TDPYBF7D.js → price-list-create-UMA2NB3L.js} +4 -4
  72. package/dist/{price-list-detail-U5LPEFWH.js → price-list-detail-7ANY3XOC.js} +2 -2
  73. package/dist/{price-list-prices-add-J4GDJTQY.js → price-list-prices-add-XLFLGFVG.js} +4 -4
  74. package/dist/{price-list-prices-edit-LNSUSN4V.js → price-list-prices-edit-MT6BFF3M.js} +2 -2
  75. package/dist/{product-bulk-edit-34KKEPJQ.js → product-bulk-edit-3AJGOE6E.js} +1 -1
  76. package/dist/{product-create-OSG3NREE.js → product-create-2SELD5CI.js} +4 -4
  77. package/dist/{product-detail-T4FOYZK7.js → product-detail-O7MVTHSN.js} +1 -1
  78. package/dist/{product-edit-attribute-RE6L525Z.js → product-edit-attribute-BSPIDAZJ.js} +4 -27
  79. package/dist/{product-list-PQ3UMA2U.js → product-list-SIQDX4AT.js} +2 -2
  80. package/dist/{product-media-7HLOXWZZ.js → product-media-S6L3IHUO.js} +2 -2
  81. package/dist/{product-organization-XHIT5HXK.js → product-organization-BYPV5QSZ.js} +1 -1
  82. package/dist/{product-tag-detail-W3NUBZ6N.js → product-tag-detail-SVDEVPMA.js} +5 -5
  83. package/dist/{product-tag-list-4KNHKDAV.js → product-tag-list-4ECQFBOA.js} +4 -4
  84. package/dist/{product-type-detail-GNCVQKQU.js → product-type-detail-WSHUE56F.js} +2 -2
  85. package/dist/{promotion-detail-7V235FES.js → promotion-detail-25JCCLU2.js} +3 -3
  86. package/dist/{promotion-list-LKK3V2CK.js → promotion-list-RXLVU4G2.js} +4 -4
  87. package/dist/{refund-reason-list-AC3RCTYI.js → refund-reason-list-XMDZO34F.js} +4 -4
  88. package/dist/{reset-password-R6KN32M2.js → reset-password-GBVMOKXP.js} +1 -1
  89. package/dist/{return-reason-list-KRLDNVBC.js → return-reason-list-AW6MMUKD.js} +4 -4
  90. package/dist/{sales-channel-add-products-HFS7S4XB.js → sales-channel-add-products-LRANEISZ.js} +1 -1
  91. package/dist/{sales-channel-detail-SZVBKHKH.js → sales-channel-detail-5XXO3BXP.js} +2 -2
  92. package/dist/{store-bulk-edit-5DZ7RZS3.js → store-bulk-edit-I6QHGMEC.js} +1 -1
  93. package/dist/{store-details-5JNTBHRP.js → store-details-XNBFIWDL.js} +3 -3
  94. package/dist/{store-edit-KUNXCGSI.js → store-edit-BBOEDZNV.js} +2 -2
  95. package/dist/{store-list-ISPAQ4U3.js → store-list-RVZG3UD3.js} +1 -1
  96. package/dist/{tax-region-create-E63FR7XD.js → tax-region-create-7432IFN5.js} +1 -1
  97. package/dist/{tax-region-tax-override-create-K6EV53SE.js → tax-region-tax-override-create-WRUNCP67.js} +5 -5
  98. package/dist/{tax-region-tax-override-edit-A5UDUAMZ.js → tax-region-tax-override-edit-EOIDY4LX.js} +5 -5
  99. package/package.json +6 -6
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-MDABSESI.js";
22
22
  import {
23
23
  useProductTableColumns
24
- } from "./chunk-SU444Q24.js";
24
+ } from "./chunk-O53E5U52.js";
25
25
  import {
26
26
  useProductTableFilters
27
27
  } from "./chunk-P4LTLPTK.js";
@@ -6,14 +6,14 @@ import {
6
6
  PriceListRulesSchema,
7
7
  usePriceListCurrencyData,
8
8
  usePriceListGridColumns
9
- } from "./chunk-3OZRK7TN.js";
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-SU444Q24.js";
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-HHW4PPNH.js";
30
+ } from "./chunk-4OCWOY2F.js";
31
31
  import {
32
32
  RouteFocusModal,
33
33
  StackedFocusModal,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-RK5N3XIX.js";
13
13
  import {
14
14
  useProductTableColumns
15
- } from "./chunk-SU444Q24.js";
15
+ } from "./chunk-O53E5U52.js";
16
16
  import {
17
17
  useProductTableFilters
18
18
  } from "./chunk-P4LTLPTK.js";
@@ -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(ThumbnailBadge, {}),
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(ListBadge, {}),
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-T2WVIET2.js";
4
+ } from "./chunk-VM56ZITS.js";
5
5
  import {
6
6
  useProductTableColumns
7
- } from "./chunk-SU444Q24.js";
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
- return /* @__PURE__ */ jsx4(
430
- Checkbox,
431
- {
432
- checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
433
- onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
434
- }
435
- );
436
- },
437
- cell: ({ row }) => {
438
- return /* @__PURE__ */ jsx4(
439
- Checkbox,
440
- {
441
- checked: row.getIsSelected(),
442
- onCheckedChange: (value) => row.toggleSelected(!!value),
443
- onClick: (e) => {
444
- e.stopPropagation();
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-GQUGCSJV.js";
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-HHW4PPNH.js";
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-SU444Q24.js";
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 { Button, Container, Heading, toast, usePrompt } from "@medusajs/ui";
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-HOUYHVRG.js";
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("products.create.errors.requiredAttribute")
282
+ message: i18n.t(messageKey)
273
283
  });
274
284
  }
275
285
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useProductTableColumns
3
- } from "./chunk-SU444Q24.js";
3
+ } from "./chunk-O53E5U52.js";
4
4
  import "./chunk-WBSUHLO7.js";
5
5
  import {
6
6
  useProductTableFilters
@@ -3,7 +3,7 @@ import {
3
3
  CollectionIconTip,
4
4
  CollectionMediaInput,
5
5
  uploadCollectionImages
6
- } from "./chunk-T2WVIET2.js";
6
+ } from "./chunk-VM56ZITS.js";
7
7
  import {
8
8
  HandleInput
9
9
  } from "./chunk-HJ56YXBU.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  CollectionDetailPage
3
- } from "./chunk-TFDRETCH.js";
4
- import "./chunk-T2WVIET2.js";
5
- import "./chunk-SU444Q24.js";
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";
@@ -3,7 +3,7 @@ import {
3
3
  CollectionIconTip,
4
4
  getCollectionIcon,
5
5
  uploadCollectionImages
6
- } from "./chunk-T2WVIET2.js";
6
+ } from "./chunk-VM56ZITS.js";
7
7
  import "./chunk-VSLHL2AZ.js";
8
8
  import "./chunk-TKGWSUEI.js";
9
9
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CollectionListPage
3
- } from "./chunk-YAOYZQDK.js";
4
- import "./chunk-P4GIBTTG.js";
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-T2WVIET2.js";
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-PVZBDWLK.js";
23
+ import "./chunk-GRH7C3QN.js";
24
24
  import "./chunk-DY3XQPHC.js";
25
25
  import "./chunk-JHIMVLB2.js";
26
26
  import "./chunk-P4LTLPTK.js";
@@ -2,7 +2,7 @@ import {
2
2
  COLLECTION_IMAGE_FORMATS,
3
3
  getCollectionGallery,
4
4
  uploadCollectionImages
5
- } from "./chunk-T2WVIET2.js";
5
+ } from "./chunk-VM56ZITS.js";
6
6
  import {
7
7
  FileUpload
8
8
  } from "./chunk-VSLHL2AZ.js";
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  CommissionValueFields,
3
+ addCommissionValueIssues,
4
+ optionalAmount,
3
5
  useStoreCurrencies
4
- } from "./chunk-R3YD5UOZ.js";
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: zod.coerce.number().min(0),
50
- fixed_values: zod.record(zod.string(), zod.coerce.number()).optional(),
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: zodResolver(EditCommissionSchema)
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-R3YD5UOZ.js";
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
- if (data.commissionType === "percentage") {
376
- if (data.value === void 0 || Number.isNaN(data.value)) {
377
- ctx.addIssue({
378
- code: zod.ZodIssueCode.custom,
379
- path: ["value"],
380
- message: i18n.t("commissions.validation.value")
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-CASK2IOQ.js";
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";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-HGTPUAHD.js";
7
7
  import {
8
8
  useCustomerTableQuery
9
- } from "./chunk-PVZBDWLK.js";
9
+ } from "./chunk-GRH7C3QN.js";
10
10
  import "./chunk-25LYVP3C.js";
11
11
  import "./chunk-DB6ANJBO.js";
12
12
  import "./chunk-PHOCVOZ5.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CUSTOMER_GROUP_DETAIL_FIELDS,
3
3
  CustomerGroupDetailPage
4
- } from "./chunk-LNOZHSZV.js";
4
+ } from "./chunk-EMW5WXXR.js";
5
5
  import "./chunk-QG6PLWNH.js";
6
6
  import "./chunk-HGTPUAHD.js";
7
- import "./chunk-PVZBDWLK.js";
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-TJ5IONZX.js";
3
+ } from "./chunk-5YWQDIVG.js";
4
4
  import "./chunk-QG6PLWNH.js";
5
5
  import "./chunk-HGTPUAHD.js";
6
- import "./chunk-PVZBDWLK.js";
6
+ import "./chunk-GRH7C3QN.js";
7
7
  import "./chunk-25LYVP3C.js";
8
8
  import "./chunk-DB6ANJBO.js";
9
9
  import "./chunk-PHOCVOZ5.js";
@@ -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.success", {
163
- groups: data.customer_group_ids.map((id) => customer_groups?.find((g) => g.id === id)).filter(Boolean).map((cg) => cg?.name)
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-R3YD5UOZ.js";
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: zod.coerce.number().optional(),
51
- fixed_values: zod.record(zod.string(), zod.coerce.number()).optional(),
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
- }).superRefine((data, ctx) => {
55
- if (data.type === "percentage" && (data.value === void 0 || Number.isNaN(data.value))) {
56
- ctx.addIssue({
57
- code: zod.ZodIssueCode.custom,
58
- path: ["value"],
59
- message: i18n.t("commissions.validation.valueRequired")
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: zodResolver(EditGlobalCommissionSchema)
87
+ resolver
81
88
  });
82
89
  const { mutateAsync, isPending } = useUpdateCommissionRule(rate.id);
83
90
  const handleSubmit = form.handleSubmit(async (values) => {