@mercurjs/vendor 2.2.0-canary.21 → 2.2.0-canary.22
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/{[id]-PD3ISUL5.js → [id]-BGVYXNSX.js} +3 -3
- package/dist/{[id]-ZEFQ7FQQ.js → [id]-MXNIHS2A.js} +1 -1
- package/dist/{[id]-FIP4UMQ4.js → [id]-NXWDM34U.js} +58 -28
- package/dist/{[id]-XUKQKCDN.js → [id]-W5RBRUBB.js} +2 -2
- package/dist/{add-GYXNRUAE.js → add-2OW5QLU2.js} +1 -1
- package/dist/{add-customer-groups-KIGBZT5G.js → add-customer-groups-MB2GJP77.js} +6 -1
- package/dist/{add-promotions-EQ5MMQKG.js → add-promotions-EEQV6QFY.js} +3 -3
- package/dist/{chunk-RT3G3GEK.js → chunk-5IFNEL6A.js} +1 -1
- package/dist/{chunk-4RFPRO2W.js → chunk-7DZCHZHR.js} +1 -1
- package/dist/{chunk-ZZIJSTXN.js → chunk-AYCX7QNB.js} +21 -9
- package/dist/{chunk-4OIOYUQE.js → chunk-BYQDKFTG.js} +3 -8
- package/dist/{chunk-PVZBDWLK.js → chunk-GRH7C3QN.js} +1 -1
- package/dist/{chunk-R4JLYNUA.js → chunk-KIOTMXSI.js} +2 -2
- package/dist/{chunk-LRMWYKSF.js → chunk-KPF6WMZI.js} +1 -1
- package/dist/{chunk-3L2DVCOC.js → chunk-MDRCW3OQ.js} +1 -1
- package/dist/{chunk-N6MGVXXQ.js → chunk-MP2H5ZC6.js} +1 -1
- package/dist/{chunk-H7BVANDX.js → chunk-XCPANKUF.js} +37 -10
- package/dist/{collections-7M7O23NO.js → collections-C5XCGVCG.js} +1 -1
- package/dist/{create-NR7ULWQS.js → create-22MSY7W6.js} +1 -1
- package/dist/{create-SJSLOXOW.js → create-7TV3IEVG.js} +4 -4
- package/dist/{customer-group-add-customers-GTM556QA.js → customer-group-add-customers-QPIYYEXU.js} +1 -1
- package/dist/{customer-group-create-OYHAXX2T.js → customer-group-create-DQHTB3SK.js} +9 -2
- package/dist/{customer-group-detail-KW62TLWA.js → customer-group-detail-B446EA7L.js} +2 -2
- package/dist/{customer-group-edit-WH7O4N4L.js → customer-group-edit-H255WS2E.js} +2 -1
- package/dist/{customer-groups-UJFZBZ2B.js → customer-groups-YIEFOZ4F.js} +12 -4
- package/dist/{customers-4WKIFPUU.js → customers-6KNDRYB4.js} +2 -2
- package/dist/{edit-3EN2H52W.js → edit-CSOADLGQ.js} +1 -1
- package/dist/{edit-YTS77SJS.js → edit-DQFUUWUB.js} +2 -2
- package/dist/{edit-price-K6K2FTMF.js → edit-price-BNEAFMUE.js} +1 -0
- package/dist/{edit-stock-6TUSJD5R.js → edit-stock-XK6NE4NH.js} +1 -0
- package/dist/index.js +39 -39
- package/dist/{invite-VWNUFOFI.js → invite-QMJJAEB5.js} +1 -1
- package/dist/{media-KIIJ6WSZ.js → media-EBDOAHHL.js} +3 -3
- package/dist/{offer-variant-detail-page-ORH56HZI.js → offer-variant-detail-page-2X5JF5LG.js} +4 -23
- package/dist/pages/index.js +9 -9
- package/dist/{product-tags-MW2JMRFY.js → product-tags-4FHA7A6P.js} +1 -1
- package/dist/{products-TZS2OPK3.js → products-KNJDYGOO.js} +4 -4
- package/dist/{promotions-JYO23G6N.js → promotions-VCNOCGYA.js} +4 -4
- package/dist/{register-SR2SYX4Q.js → register-V77I2H42.js} +1 -1
- package/dist/{reset-password-N22YRMR3.js → reset-password-HVJ7JG6D.js} +1 -1
- package/dist/{return-reasons-POR5YPTF.js → return-reasons-IXSWNVGX.js} +1 -1
- package/dist/{settings-MHBYIZ2I.js → settings-KRUN36KA.js} +1 -1
- package/dist/{team-MY24J5WO.js → team-WSE7PKUH.js} +1 -1
- package/package.json +1 -1
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
usePromotionTableColumns,
|
|
9
9
|
usePromotionTableQuery
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-KPF6WMZI.js";
|
|
11
|
+
import "./chunk-MP2H5ZC6.js";
|
|
12
12
|
import "./chunk-JHIMVLB2.js";
|
|
13
13
|
import {
|
|
14
14
|
usePromotionTableFilters
|
|
@@ -27,7 +27,7 @@ import "./chunk-3EF54XFY.js";
|
|
|
27
27
|
import {
|
|
28
28
|
currencies
|
|
29
29
|
} from "./chunk-IQPN4PZJ.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-AYCX7QNB.js";
|
|
31
31
|
import {
|
|
32
32
|
TwoColumnPage
|
|
33
33
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -14,7 +14,7 @@ import "./chunk-DY3XQPHC.js";
|
|
|
14
14
|
import "./chunk-VKOE5J66.js";
|
|
15
15
|
import "./chunk-42R54Z2X.js";
|
|
16
16
|
import "./chunk-GJM5XI3E.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-GRH7C3QN.js";
|
|
18
18
|
import "./chunk-27WLUOI2.js";
|
|
19
19
|
import "./chunk-N3T24SEK.js";
|
|
20
20
|
import "./chunk-JHIMVLB2.js";
|
|
@@ -141,8 +141,8 @@ var CustomerAddressSection = ({
|
|
|
141
141
|
{
|
|
142
142
|
className: "flex h-full flex-col overflow-hidden p-6",
|
|
143
143
|
icon: null,
|
|
144
|
-
title: t2("
|
|
145
|
-
message: t2("
|
|
144
|
+
title: t2("customers.addresses.emptyTitle"),
|
|
145
|
+
message: t2("customers.addresses.emptyMessage")
|
|
146
146
|
}
|
|
147
147
|
) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-2 p-3", children: addresses.map((address) => {
|
|
148
148
|
const country = getCountryByIso2(address.country_code)?.display_name ?? address.country_code?.toUpperCase();
|
|
@@ -238,6 +238,7 @@ import {
|
|
|
238
238
|
toast,
|
|
239
239
|
usePrompt
|
|
240
240
|
} from "@medusajs/ui";
|
|
241
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
241
242
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
242
243
|
import { t } from "i18next";
|
|
243
244
|
import { useMemo, useState } from "react";
|
|
@@ -247,32 +248,53 @@ import { Link } from "react-router-dom";
|
|
|
247
248
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
248
249
|
var PAGE_SIZE = 10;
|
|
249
250
|
var PREFIX = "cusgr";
|
|
251
|
+
var DEFAULT_ORDER = "-created_at";
|
|
250
252
|
var CustomerGroupSection = ({
|
|
251
253
|
customer
|
|
252
254
|
}) => {
|
|
253
255
|
const prompt = usePrompt();
|
|
254
256
|
const [rowSelection, setRowSelection] = useState({});
|
|
255
|
-
const { raw } = useCustomerGroupTableQuery({
|
|
257
|
+
const { searchParams, raw } = useCustomerGroupTableQuery({
|
|
256
258
|
pageSize: PAGE_SIZE,
|
|
257
259
|
prefix: PREFIX
|
|
258
260
|
});
|
|
259
261
|
const flatCustomerGroups = customer.groups ?? [];
|
|
260
|
-
const groupIds =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
{ enabled: groupIds.length > 0 }
|
|
262
|
+
const groupIds = useMemo(
|
|
263
|
+
() => flatCustomerGroups.map((g) => g.id),
|
|
264
|
+
[flatCustomerGroups]
|
|
264
265
|
);
|
|
266
|
+
const {
|
|
267
|
+
customer_groups: customerGroups = [],
|
|
268
|
+
count = 0,
|
|
269
|
+
isLoading,
|
|
270
|
+
isError,
|
|
271
|
+
error
|
|
272
|
+
} = useCustomerGroups(
|
|
273
|
+
{
|
|
274
|
+
...searchParams,
|
|
275
|
+
id: groupIds,
|
|
276
|
+
order: searchParams.order || DEFAULT_ORDER,
|
|
277
|
+
fields: "id,name,created_at,updated_at,customers.id"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
enabled: groupIds.length > 0,
|
|
281
|
+
placeholderData: keepPreviousData
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
if (isError) {
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
265
287
|
const customerCountByGroup = {};
|
|
266
|
-
for (const g of
|
|
288
|
+
for (const g of customerGroups) {
|
|
267
289
|
customerCountByGroup[g.id] = g.customers?.length ?? 0;
|
|
268
290
|
}
|
|
269
291
|
const { mutateAsync: batchCustomerCustomerGroups } = useBatchCustomerCustomerGroups(customer.id);
|
|
270
292
|
const filters = useCustomerGroupTableFilters();
|
|
271
293
|
const columns = useColumns(customer.id, customerCountByGroup);
|
|
272
294
|
const { table } = useDataTable({
|
|
273
|
-
data:
|
|
295
|
+
data: customerGroups,
|
|
274
296
|
columns,
|
|
275
|
-
count
|
|
297
|
+
count,
|
|
276
298
|
getRowId: (row) => row.id,
|
|
277
299
|
enablePagination: true,
|
|
278
300
|
enableRowSelection: true,
|
|
@@ -285,30 +307,33 @@ var CustomerGroupSection = ({
|
|
|
285
307
|
});
|
|
286
308
|
const handleRemove = async () => {
|
|
287
309
|
const selectedIds = Object.keys(rowSelection);
|
|
310
|
+
const selectedGroups = flatCustomerGroups.filter(
|
|
311
|
+
(g) => selectedIds.includes(g.id)
|
|
312
|
+
);
|
|
313
|
+
const names = selectedGroups.map((g) => g.name);
|
|
314
|
+
const isSingle = selectedGroups.length === 1;
|
|
288
315
|
const res = await prompt({
|
|
289
316
|
title: t("general.areYouSure"),
|
|
290
|
-
description: t("customers.groups.removeMany", {
|
|
291
|
-
groups: flatCustomerGroups?.filter((g) => selectedIds.includes(g.id)).map((g) => g.name).join(",")
|
|
292
|
-
}),
|
|
317
|
+
description: isSingle ? t("customers.groups.remove", { name: names[0] }) : t("customers.groups.removeMany", { groups: names.join(", ") }),
|
|
293
318
|
confirmText: t("actions.remove"),
|
|
294
319
|
cancelText: t("actions.cancel")
|
|
295
320
|
});
|
|
296
321
|
if (!res) {
|
|
297
322
|
return;
|
|
298
323
|
}
|
|
299
|
-
const customerGroupIds =
|
|
324
|
+
const customerGroupIds = selectedGroups.map((g) => g.id);
|
|
300
325
|
await batchCustomerCustomerGroups(
|
|
301
326
|
{ remove: customerGroupIds, add: [] },
|
|
302
327
|
{
|
|
303
328
|
onSuccess: () => {
|
|
304
329
|
toast.success(
|
|
305
|
-
t("customers.groups.removed.
|
|
306
|
-
groups:
|
|
330
|
+
isSingle ? t("customers.groups.removed.successOne", { groups: names[0] }) : t("customers.groups.removed.successMany", {
|
|
331
|
+
groups: names.join(", ")
|
|
307
332
|
})
|
|
308
333
|
);
|
|
309
334
|
},
|
|
310
|
-
onError: (
|
|
311
|
-
toast.error(
|
|
335
|
+
onError: (e) => {
|
|
336
|
+
toast.error(e.message);
|
|
312
337
|
}
|
|
313
338
|
}
|
|
314
339
|
);
|
|
@@ -324,8 +349,8 @@ var CustomerGroupSection = ({
|
|
|
324
349
|
table,
|
|
325
350
|
columns,
|
|
326
351
|
pageSize: PAGE_SIZE,
|
|
327
|
-
isLoading
|
|
328
|
-
count
|
|
352
|
+
isLoading,
|
|
353
|
+
count,
|
|
329
354
|
prefix: PREFIX,
|
|
330
355
|
navigateTo: (row) => `/customer-groups/${row.original.id}`,
|
|
331
356
|
filters,
|
|
@@ -336,6 +361,7 @@ var CustomerGroupSection = ({
|
|
|
336
361
|
{ key: "created_at", label: t("fields.createdAt") },
|
|
337
362
|
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
338
363
|
],
|
|
364
|
+
defaultOrderBy: DEFAULT_ORDER,
|
|
339
365
|
commands: [
|
|
340
366
|
{
|
|
341
367
|
action: handleRemove,
|
|
@@ -345,7 +371,9 @@ var CustomerGroupSection = ({
|
|
|
345
371
|
],
|
|
346
372
|
queryObject: raw,
|
|
347
373
|
noRecords: {
|
|
348
|
-
|
|
374
|
+
title: t("customers.groups.list.emptyTitle"),
|
|
375
|
+
message: t("customers.groups.list.noRecordsMessage"),
|
|
376
|
+
icon: null
|
|
349
377
|
}
|
|
350
378
|
}
|
|
351
379
|
)
|
|
@@ -371,6 +399,11 @@ var CustomerGroupRowActions = ({
|
|
|
371
399
|
return;
|
|
372
400
|
}
|
|
373
401
|
await mutateAsync([customerId], {
|
|
402
|
+
onSuccess: () => {
|
|
403
|
+
toast.success(
|
|
404
|
+
t2("customers.groups.removed.successOne", { groups: group.name })
|
|
405
|
+
);
|
|
406
|
+
},
|
|
374
407
|
onError: (error) => {
|
|
375
408
|
toast.error(error.message);
|
|
376
409
|
}
|
|
@@ -472,18 +505,13 @@ var CustomerOrderSection = ({
|
|
|
472
505
|
pageSize: PAGE_SIZE2,
|
|
473
506
|
prefix: PREFIX2
|
|
474
507
|
});
|
|
475
|
-
const { orders, isLoading, isError, error } = useOrders({
|
|
508
|
+
const { orders, count, isLoading, isError, error } = useOrders({
|
|
476
509
|
fields: DEFAULT_FIELDS + "," + DEFAULT_RELATIONS,
|
|
477
|
-
|
|
478
|
-
offset: searchParams.offset,
|
|
479
|
-
created_at: searchParams.created_at,
|
|
480
|
-
updated_at: searchParams.updated_at,
|
|
481
|
-
order: searchParams.order,
|
|
510
|
+
...searchParams,
|
|
482
511
|
customer_id: customer.id
|
|
483
512
|
});
|
|
484
513
|
const columns = useColumns2();
|
|
485
514
|
const filters = useOrderTableFilters();
|
|
486
|
-
const count = orders?.length || 0;
|
|
487
515
|
const { table } = useDataTable({
|
|
488
516
|
data: orders ?? [],
|
|
489
517
|
columns,
|
|
@@ -503,6 +531,7 @@ var CustomerOrderSection = ({
|
|
|
503
531
|
columns,
|
|
504
532
|
table,
|
|
505
533
|
pagination: true,
|
|
534
|
+
search: true,
|
|
506
535
|
navigateTo: (row) => `/orders/${row.original.id}`,
|
|
507
536
|
filters,
|
|
508
537
|
count,
|
|
@@ -522,6 +551,7 @@ var CustomerOrderSection = ({
|
|
|
522
551
|
label: t2("fields.updatedAt")
|
|
523
552
|
}
|
|
524
553
|
],
|
|
554
|
+
defaultOrderBy: "-display_id",
|
|
525
555
|
queryObject: raw,
|
|
526
556
|
prefix: PREFIX2
|
|
527
557
|
}
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-BWGPN6XV.js";
|
|
7
7
|
import {
|
|
8
8
|
StatusCell
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MP2H5ZC6.js";
|
|
10
10
|
import "./chunk-FMFVTERD.js";
|
|
11
11
|
import "./chunk-DB6ANJBO.js";
|
|
12
12
|
import {
|
|
13
13
|
NoRecords
|
|
14
14
|
} from "./chunk-3EF54XFY.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-AYCX7QNB.js";
|
|
16
16
|
import {
|
|
17
17
|
TwoColumnPage
|
|
18
18
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -21,7 +21,7 @@ import "./chunk-DY3XQPHC.js";
|
|
|
21
21
|
import "./chunk-VKOE5J66.js";
|
|
22
22
|
import "./chunk-42R54Z2X.js";
|
|
23
23
|
import "./chunk-GJM5XI3E.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-GRH7C3QN.js";
|
|
25
25
|
import "./chunk-27WLUOI2.js";
|
|
26
26
|
import "./chunk-N3T24SEK.js";
|
|
27
27
|
import "./chunk-JHIMVLB2.js";
|
|
@@ -152,7 +152,12 @@ var AddCustomerGroupsForm = ({
|
|
|
152
152
|
add: data.customer_group_ids,
|
|
153
153
|
remove: []
|
|
154
154
|
});
|
|
155
|
-
|
|
155
|
+
const names = data.customer_group_ids.map((id) => customer_groups?.find((g) => g.id === id)?.name).filter(Boolean);
|
|
156
|
+
toast.success(
|
|
157
|
+
names.length === 1 ? t("customers.groups.add.successOne", { groups: names[0] }) : t("customers.groups.add.successMany", {
|
|
158
|
+
groups: names.join(", ")
|
|
159
|
+
})
|
|
160
|
+
);
|
|
156
161
|
handleSuccess(`/customers/${customerId}`);
|
|
157
162
|
} catch (e) {
|
|
158
163
|
toast.error(e.message);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePromotionTableColumns,
|
|
3
3
|
usePromotionTableQuery
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-KPF6WMZI.js";
|
|
5
|
+
import "./chunk-MP2H5ZC6.js";
|
|
6
6
|
import "./chunk-JHIMVLB2.js";
|
|
7
7
|
import {
|
|
8
8
|
usePromotionTableFilters
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import "./chunk-YN3FGNJM.js";
|
|
19
19
|
import "./chunk-KCHYLLVG.js";
|
|
20
20
|
import "./chunk-3EF54XFY.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-AYCX7QNB.js";
|
|
22
22
|
import "./chunk-TKGWSUEI.js";
|
|
23
23
|
import {
|
|
24
24
|
KeyboundForm
|
|
@@ -10052,20 +10052,23 @@ var en_default = {
|
|
|
10052
10052
|
},
|
|
10053
10053
|
groups: {
|
|
10054
10054
|
label: "Customer groups",
|
|
10055
|
-
remove:
|
|
10056
|
-
removeMany: "
|
|
10055
|
+
remove: "You are about to remove customer from {{name}} group. This action cannot be undone.",
|
|
10056
|
+
removeMany: "You are about to remove customer from {{groups}} groups. This action cannot be undone.",
|
|
10057
10057
|
alreadyAddedTooltip: "The customer is already in this customer group.",
|
|
10058
10058
|
list: {
|
|
10059
|
+
emptyTitle: "No customer groups yet",
|
|
10059
10060
|
noRecordsMessage: "This customer doesn't belong to any group."
|
|
10060
10061
|
},
|
|
10061
10062
|
add: {
|
|
10062
|
-
|
|
10063
|
+
successOne: "Customer was successfully added to {{groups}} group.",
|
|
10064
|
+
successMany: "Customer was successfully added to {{groups}} groups.",
|
|
10063
10065
|
list: {
|
|
10064
10066
|
noRecordsMessage: "Please create a customer group first."
|
|
10065
10067
|
}
|
|
10066
10068
|
},
|
|
10067
10069
|
removed: {
|
|
10068
|
-
|
|
10070
|
+
successOne: "Customer was successfully removed from {{groups}} group.",
|
|
10071
|
+
successMany: "Customer was successfully removed from {{groups}} groups.",
|
|
10069
10072
|
list: {
|
|
10070
10073
|
noRecordsMessage: "Please create a customer group first."
|
|
10071
10074
|
}
|
|
@@ -10091,6 +10094,8 @@ var en_default = {
|
|
|
10091
10094
|
hasAccount: "Has account",
|
|
10092
10095
|
addresses: {
|
|
10093
10096
|
title: "Addresses",
|
|
10097
|
+
emptyTitle: "No addresses yet",
|
|
10098
|
+
emptyMessage: "This customer doesn't have any addresses",
|
|
10094
10099
|
fields: {
|
|
10095
10100
|
addressName: "Address name",
|
|
10096
10101
|
address1: "Address 1",
|
|
@@ -10114,10 +10119,13 @@ var en_default = {
|
|
|
10114
10119
|
customerGroups: {
|
|
10115
10120
|
domain: "Customer Groups",
|
|
10116
10121
|
subtitle: "Organize customers into groups. Groups can have different promotions and prices.",
|
|
10122
|
+
validation: {
|
|
10123
|
+
nameRequired: "Please enter a name."
|
|
10124
|
+
},
|
|
10117
10125
|
list: {
|
|
10118
10126
|
empty: {
|
|
10119
|
-
heading: "No customer groups",
|
|
10120
|
-
description: "
|
|
10127
|
+
heading: "No customer groups yet",
|
|
10128
|
+
description: "Create customer groups to organize customers"
|
|
10121
10129
|
},
|
|
10122
10130
|
filtered: {
|
|
10123
10131
|
heading: "No results",
|
|
@@ -10127,7 +10135,8 @@ var en_default = {
|
|
|
10127
10135
|
create: {
|
|
10128
10136
|
header: "Create Customer Group",
|
|
10129
10137
|
hint: "Create a new customer group to segment your customers.",
|
|
10130
|
-
successToast: "Customer group {{name}} was successfully created."
|
|
10138
|
+
successToast: "Customer group {{name}} was successfully created.",
|
|
10139
|
+
alreadyExistsToast: "Customer group with name {{name}} already exists."
|
|
10131
10140
|
},
|
|
10132
10141
|
edit: {
|
|
10133
10142
|
header: "Edit Customer Group",
|
|
@@ -10151,10 +10160,13 @@ var en_default = {
|
|
|
10151
10160
|
title_one: "Remove customer",
|
|
10152
10161
|
title_other: "Remove customers",
|
|
10153
10162
|
description_one: "You are about to remove {{count}} customer from the customer group. This action cannot be undone.",
|
|
10154
|
-
description_other: "You are about to remove {{count}} customers from the customer group. This action cannot be undone."
|
|
10163
|
+
description_other: "You are about to remove {{count}} customers from the customer group. This action cannot be undone.",
|
|
10164
|
+
successToast_one: "Customer was successfully removed from the group.",
|
|
10165
|
+
successToast_other: "Customers were successfully removed from the group."
|
|
10155
10166
|
},
|
|
10156
10167
|
list: {
|
|
10157
|
-
|
|
10168
|
+
noRecordsTitle: "No customers yet",
|
|
10169
|
+
noRecordsMessage: "This group doesn't have any customers"
|
|
10158
10170
|
}
|
|
10159
10171
|
}
|
|
10160
10172
|
},
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-GJM5XI3E.js";
|
|
4
4
|
import {
|
|
5
5
|
useCustomerTableQuery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GRH7C3QN.js";
|
|
7
7
|
import {
|
|
8
8
|
useCustomerTableFilters
|
|
9
9
|
} from "./chunk-UO6IX5Y7.js";
|
|
@@ -62,16 +62,10 @@ var CustomerListDataTable = () => {
|
|
|
62
62
|
});
|
|
63
63
|
const { customers, count, isLoading, isError, error } = useCustomers(
|
|
64
64
|
{
|
|
65
|
-
|
|
66
|
-
limit: searchParams.limit
|
|
65
|
+
...searchParams
|
|
67
66
|
},
|
|
68
67
|
{
|
|
69
68
|
placeholderData: keepPreviousData
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
has_account: searchParams.has_account,
|
|
73
|
-
order: searchParams.order,
|
|
74
|
-
q: searchParams.q
|
|
75
69
|
}
|
|
76
70
|
);
|
|
77
71
|
const filters = useCustomerTableFilters();
|
|
@@ -115,6 +109,7 @@ var CustomerListDataTable = () => {
|
|
|
115
109
|
label: t("fields.updatedAt")
|
|
116
110
|
}
|
|
117
111
|
],
|
|
112
|
+
defaultOrderBy: "-created_at",
|
|
118
113
|
isLoading,
|
|
119
114
|
navigateTo: (row) => row.original.id,
|
|
120
115
|
queryObject: raw,
|
|
@@ -25,7 +25,7 @@ var useCustomerTableQuery = ({
|
|
|
25
25
|
offset: offset ? Number(offset) : 0,
|
|
26
26
|
groups: groups?.split(","),
|
|
27
27
|
has_account: has_account ? has_account === "true" : void 0,
|
|
28
|
-
order,
|
|
28
|
+
order: order ? order : "-created_at",
|
|
29
29
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
30
30
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
31
31
|
q
|
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
} from "./chunk-OVPAOBZB.js";
|
|
27
27
|
import {
|
|
28
28
|
UploadMediaFormItem
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-MDRCW3OQ.js";
|
|
30
30
|
import {
|
|
31
31
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
32
32
|
ProductCreateSchema,
|
|
33
33
|
generateVariantsFromAttributes,
|
|
34
34
|
normalizeProductFormValues
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-5IFNEL6A.js";
|
|
36
36
|
import {
|
|
37
37
|
ChipInput
|
|
38
38
|
} from "./chunk-KDE4HKH2.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-GJM5XI3E.js";
|
|
7
7
|
import {
|
|
8
8
|
useCustomerTableQuery
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GRH7C3QN.js";
|
|
10
10
|
import {
|
|
11
11
|
useCustomerTableFilters
|
|
12
12
|
} from "./chunk-UO6IX5Y7.js";
|
|
@@ -35,8 +35,15 @@ import { Children } from "react";
|
|
|
35
35
|
import { useLoaderData, useParams } from "react-router-dom";
|
|
36
36
|
|
|
37
37
|
// src/pages/customer-groups/customer-group-detail/components/customer-group-customer-section/customer-group-customer-section.tsx
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
38
|
+
import { XCircle } from "@medusajs/icons";
|
|
39
|
+
import {
|
|
40
|
+
Button,
|
|
41
|
+
Checkbox,
|
|
42
|
+
Container,
|
|
43
|
+
Heading,
|
|
44
|
+
toast,
|
|
45
|
+
usePrompt
|
|
46
|
+
} from "@medusajs/ui";
|
|
40
47
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
41
48
|
import { useMemo, useState } from "react";
|
|
42
49
|
import { useTranslation } from "react-i18next";
|
|
@@ -52,6 +59,7 @@ var CustomerGroupCustomerSection = ({
|
|
|
52
59
|
const { searchParams, raw } = useCustomerTableQuery({ pageSize: PAGE_SIZE });
|
|
53
60
|
const { customers, count, isLoading, isError, error } = useCustomers({
|
|
54
61
|
...searchParams,
|
|
62
|
+
order: searchParams.order || "email",
|
|
55
63
|
groups: [group.id]
|
|
56
64
|
});
|
|
57
65
|
const columns = useColumns();
|
|
@@ -94,6 +102,14 @@ var CustomerGroupCustomerSection = ({
|
|
|
94
102
|
await mutateAsync(keys, {
|
|
95
103
|
onSuccess: () => {
|
|
96
104
|
setRowSelection({});
|
|
105
|
+
toast.success(
|
|
106
|
+
t("customerGroups.customers.remove.successToast", {
|
|
107
|
+
count: keys.length
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
onError: (e) => {
|
|
112
|
+
toast.error(e.message);
|
|
97
113
|
}
|
|
98
114
|
});
|
|
99
115
|
};
|
|
@@ -156,6 +172,7 @@ var CustomerGroupCustomerSection = ({
|
|
|
156
172
|
{ key: "created_at", label: t("fields.createdAt") },
|
|
157
173
|
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
158
174
|
],
|
|
175
|
+
defaultOrderBy: "email",
|
|
159
176
|
queryObject: raw,
|
|
160
177
|
commands: [
|
|
161
178
|
{
|
|
@@ -165,6 +182,7 @@ var CustomerGroupCustomerSection = ({
|
|
|
165
182
|
}
|
|
166
183
|
],
|
|
167
184
|
noRecords: {
|
|
185
|
+
title: t("customerGroups.customers.list.noRecordsTitle"),
|
|
168
186
|
message: t("customerGroups.customers.list.noRecordsMessage")
|
|
169
187
|
}
|
|
170
188
|
}
|
|
@@ -194,7 +212,16 @@ var CustomerActions = ({
|
|
|
194
212
|
if (!res) {
|
|
195
213
|
return;
|
|
196
214
|
}
|
|
197
|
-
await mutateAsync([customer.id]
|
|
215
|
+
await mutateAsync([customer.id], {
|
|
216
|
+
onSuccess: () => {
|
|
217
|
+
toast.success(
|
|
218
|
+
t("customerGroups.customers.remove.successToast", { count: 1 })
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
onError: (e) => {
|
|
222
|
+
toast.error(e.message);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
198
225
|
};
|
|
199
226
|
return /* @__PURE__ */ jsx(
|
|
200
227
|
ActionMenu,
|
|
@@ -203,7 +230,7 @@ var CustomerActions = ({
|
|
|
203
230
|
{
|
|
204
231
|
actions: [
|
|
205
232
|
{
|
|
206
|
-
icon: /* @__PURE__ */ jsx(
|
|
233
|
+
icon: /* @__PURE__ */ jsx(XCircle, {}),
|
|
207
234
|
label: t("actions.remove"),
|
|
208
235
|
onClick: handleRemove
|
|
209
236
|
}
|
|
@@ -262,8 +289,8 @@ var useColumns = () => {
|
|
|
262
289
|
};
|
|
263
290
|
|
|
264
291
|
// src/pages/customer-groups/customer-group-detail/components/customer-group-general-section/customer-group-general-section.tsx
|
|
265
|
-
import { PencilSquare, Trash
|
|
266
|
-
import { Container as Container2, Heading as Heading2, Text, toast, usePrompt as usePrompt2 } from "@medusajs/ui";
|
|
292
|
+
import { PencilSquare, Trash } from "@medusajs/icons";
|
|
293
|
+
import { Container as Container2, Heading as Heading2, Text, toast as toast2, usePrompt as usePrompt2 } from "@medusajs/ui";
|
|
267
294
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
268
295
|
import { useNavigate } from "react-router-dom";
|
|
269
296
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -288,7 +315,7 @@ var CustomerGroupGeneralSection = ({
|
|
|
288
315
|
}
|
|
289
316
|
await mutateAsync(void 0, {
|
|
290
317
|
onSuccess: () => {
|
|
291
|
-
|
|
318
|
+
toast2.success(
|
|
292
319
|
t("customerGroups.delete.successToast", {
|
|
293
320
|
name: group.name
|
|
294
321
|
})
|
|
@@ -296,7 +323,7 @@ var CustomerGroupGeneralSection = ({
|
|
|
296
323
|
navigate("/customer-groups", { replace: true });
|
|
297
324
|
},
|
|
298
325
|
onError: (error) => {
|
|
299
|
-
|
|
326
|
+
toast2.error(error.message);
|
|
300
327
|
}
|
|
301
328
|
});
|
|
302
329
|
};
|
|
@@ -329,7 +356,7 @@ var CustomerGroupGeneralSection = ({
|
|
|
329
356
|
{
|
|
330
357
|
actions: [
|
|
331
358
|
{
|
|
332
|
-
icon: /* @__PURE__ */ jsx2(
|
|
359
|
+
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
333
360
|
label: t("actions.delete"),
|
|
334
361
|
onClick: handleDelete
|
|
335
362
|
}
|
|
@@ -9,7 +9,7 @@ import "./chunk-VOHEQ7B5.js";
|
|
|
9
9
|
import "./chunk-DY3XQPHC.js";
|
|
10
10
|
import "./chunk-VKOE5J66.js";
|
|
11
11
|
import "./chunk-42R54Z2X.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-GRH7C3QN.js";
|
|
13
13
|
import "./chunk-N3T24SEK.js";
|
|
14
14
|
import "./chunk-JHIMVLB2.js";
|
|
15
15
|
import "./chunk-HHD2VUED.js";
|
|
@@ -21,7 +21,7 @@ import "./chunk-DY3XQPHC.js";
|
|
|
21
21
|
import "./chunk-VKOE5J66.js";
|
|
22
22
|
import "./chunk-42R54Z2X.js";
|
|
23
23
|
import "./chunk-GJM5XI3E.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-GRH7C3QN.js";
|
|
25
25
|
import "./chunk-27WLUOI2.js";
|
|
26
26
|
import "./chunk-N3T24SEK.js";
|
|
27
27
|
import "./chunk-JHIMVLB2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductCreate,
|
|
3
3
|
ProductCreatePage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KIOTMXSI.js";
|
|
5
5
|
import "./chunk-LEWA4BPH.js";
|
|
6
6
|
import "./chunk-TKSKCYM3.js";
|
|
7
7
|
import "./chunk-HJ56YXBU.js";
|
|
@@ -14,20 +14,20 @@ import "./chunk-IQPN4PZJ.js";
|
|
|
14
14
|
import "./chunk-YVCBMOJG.js";
|
|
15
15
|
import "./chunk-J434WDD3.js";
|
|
16
16
|
import "./chunk-OVPAOBZB.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-MDRCW3OQ.js";
|
|
18
18
|
import {
|
|
19
19
|
EditProductMediaSchema,
|
|
20
20
|
MediaSchema,
|
|
21
21
|
PRODUCT_CREATE_FORM_DEFAULTS,
|
|
22
22
|
ProductCreateSchema
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5IFNEL6A.js";
|
|
24
24
|
import "./chunk-AJLGY3LQ.js";
|
|
25
25
|
import "./chunk-SMQT3ZNO.js";
|
|
26
26
|
import "./chunk-KDE4HKH2.js";
|
|
27
27
|
import "./chunk-4YWKKCTT.js";
|
|
28
28
|
import "./chunk-VBRTC2VU.js";
|
|
29
29
|
import "./chunk-WJ5EU3KW.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-AYCX7QNB.js";
|
|
31
31
|
import "./chunk-TKGWSUEI.js";
|
|
32
32
|
import "./chunk-SITRHMZZ.js";
|
|
33
33
|
import "./chunk-GDWBOQI5.js";
|