@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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useSellers
|
|
3
|
+
} from "./chunk-NS3GQ2J6.js";
|
|
4
|
+
import {
|
|
5
|
+
useCustomers
|
|
6
|
+
} from "./chunk-RGS5ZOY7.js";
|
|
7
|
+
import {
|
|
8
|
+
useSalesChannels
|
|
9
|
+
} from "./chunk-MW47LDBT.js";
|
|
10
|
+
|
|
11
|
+
// src/pages/orders/order-list/components/order-list-table/use-order-table-filters.tsx
|
|
12
|
+
import { useMemo } from "react";
|
|
13
|
+
import { useTranslation } from "react-i18next";
|
|
14
|
+
var useOrderGroupTableFilters = () => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const { customers } = useCustomers({
|
|
17
|
+
limit: 1e3,
|
|
18
|
+
fields: "id,first_name,last_name,email"
|
|
19
|
+
});
|
|
20
|
+
const { sellers } = useSellers({
|
|
21
|
+
limit: 1e3,
|
|
22
|
+
fields: "id,name"
|
|
23
|
+
});
|
|
24
|
+
const { sales_channels } = useSalesChannels({
|
|
25
|
+
limit: 1e3,
|
|
26
|
+
fields: "id,name"
|
|
27
|
+
});
|
|
28
|
+
return useMemo(() => {
|
|
29
|
+
const filters = [];
|
|
30
|
+
if (customers?.length) {
|
|
31
|
+
filters.push({
|
|
32
|
+
key: "customer_id",
|
|
33
|
+
label: t("fields.customer"),
|
|
34
|
+
type: "select",
|
|
35
|
+
multiple: true,
|
|
36
|
+
searchable: true,
|
|
37
|
+
options: customers.map((c) => ({
|
|
38
|
+
label: [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email,
|
|
39
|
+
value: c.id
|
|
40
|
+
}))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (sellers?.length) {
|
|
44
|
+
filters.push({
|
|
45
|
+
key: "seller_id",
|
|
46
|
+
label: "Store",
|
|
47
|
+
type: "select",
|
|
48
|
+
multiple: true,
|
|
49
|
+
searchable: true,
|
|
50
|
+
options: sellers.map((s) => ({
|
|
51
|
+
label: s.name,
|
|
52
|
+
value: s.id
|
|
53
|
+
}))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (sales_channels?.length) {
|
|
57
|
+
filters.push({
|
|
58
|
+
key: "sales_channel_id",
|
|
59
|
+
label: t("fields.salesChannel"),
|
|
60
|
+
type: "select",
|
|
61
|
+
multiple: true,
|
|
62
|
+
searchable: true,
|
|
63
|
+
options: sales_channels.map((s) => ({
|
|
64
|
+
label: s.name,
|
|
65
|
+
value: s.id
|
|
66
|
+
}))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
filters.push({
|
|
70
|
+
key: "status",
|
|
71
|
+
label: t("fields.status"),
|
|
72
|
+
type: "select",
|
|
73
|
+
multiple: true,
|
|
74
|
+
options: [
|
|
75
|
+
{ label: "Pending", value: "pending" },
|
|
76
|
+
{ label: "Completed", value: "completed" },
|
|
77
|
+
{ label: "Canceled", value: "canceled" },
|
|
78
|
+
{ label: "Requires action", value: "requires_action" }
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
filters.push({
|
|
82
|
+
key: "request",
|
|
83
|
+
label: t("orders.filters.request.label"),
|
|
84
|
+
type: "select",
|
|
85
|
+
multiple: true,
|
|
86
|
+
options: [
|
|
87
|
+
{ label: t("orders.filters.request.edit"), value: "edit" },
|
|
88
|
+
{ label: t("orders.filters.request.return"), value: "return" },
|
|
89
|
+
{ label: t("orders.filters.request.exchange"), value: "exchange" },
|
|
90
|
+
{ label: t("orders.filters.request.claim"), value: "claim" }
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
filters.push(
|
|
94
|
+
{
|
|
95
|
+
key: "created_at",
|
|
96
|
+
label: t("fields.createdAt"),
|
|
97
|
+
type: "date"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: "updated_at",
|
|
101
|
+
label: t("fields.updatedAt"),
|
|
102
|
+
type: "date"
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
return filters;
|
|
106
|
+
}, [customers, sellers, sales_channels, t]);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
useOrderGroupTableFilters
|
|
111
|
+
};
|
|
@@ -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
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getCategoryGallery,
|
|
15
15
|
getCategoryIcon
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QJCUPZZQ.js";
|
|
17
17
|
import {
|
|
18
18
|
useProductTableColumns
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-O53E5U52.js";
|
|
20
20
|
import {
|
|
21
21
|
useProductTableFilters
|
|
22
22
|
} from "./chunk-P4LTLPTK.js";
|
|
@@ -381,6 +381,7 @@ var ChildrenDisplay = ({
|
|
|
381
381
|
// src/pages/categories/category-detail/components/category-product-section/category-product-section.tsx
|
|
382
382
|
import { ExclamationCircle, PlusMini } from "@medusajs/icons";
|
|
383
383
|
import {
|
|
384
|
+
Checkbox,
|
|
384
385
|
CommandBar,
|
|
385
386
|
Container as Container5,
|
|
386
387
|
Heading as Heading5,
|
|
@@ -389,7 +390,8 @@ import {
|
|
|
389
390
|
usePrompt
|
|
390
391
|
} from "@medusajs/ui";
|
|
391
392
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
392
|
-
import {
|
|
393
|
+
import { createColumnHelper } from "@tanstack/react-table";
|
|
394
|
+
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
393
395
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
394
396
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
395
397
|
var PAGE_SIZE = 10;
|
|
@@ -409,7 +411,7 @@ var CategoryProductSection = ({
|
|
|
409
411
|
placeholderData: keepPreviousData
|
|
410
412
|
}
|
|
411
413
|
);
|
|
412
|
-
const columns =
|
|
414
|
+
const columns = useColumns();
|
|
413
415
|
const filters = useProductTableFilters(["categories"]);
|
|
414
416
|
const { table } = useDataTable({
|
|
415
417
|
data: products || [],
|
|
@@ -520,6 +522,36 @@ var CategoryProductSection = ({
|
|
|
520
522
|
] }) })
|
|
521
523
|
] });
|
|
522
524
|
};
|
|
525
|
+
var columnHelper = createColumnHelper();
|
|
526
|
+
var useColumns = () => {
|
|
527
|
+
const base = useProductTableColumns();
|
|
528
|
+
return useMemo2(
|
|
529
|
+
() => [
|
|
530
|
+
columnHelper.display({
|
|
531
|
+
id: "select",
|
|
532
|
+
header: ({ table }) => /* @__PURE__ */ jsx5(
|
|
533
|
+
Checkbox,
|
|
534
|
+
{
|
|
535
|
+
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
536
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
537
|
+
"data-testid": "products-table-header-select-checkbox"
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
cell: ({ row }) => /* @__PURE__ */ jsx5(
|
|
541
|
+
Checkbox,
|
|
542
|
+
{
|
|
543
|
+
checked: row.getIsSelected(),
|
|
544
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
545
|
+
onClick: (e) => e.stopPropagation(),
|
|
546
|
+
"data-testid": `products-table-cell-${row.id}-select-checkbox`
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
}),
|
|
550
|
+
...base
|
|
551
|
+
],
|
|
552
|
+
[base]
|
|
553
|
+
);
|
|
554
|
+
};
|
|
523
555
|
|
|
524
556
|
// src/pages/categories/category-detail/category-detail.tsx
|
|
525
557
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -459,7 +459,6 @@ var ProductActiveRequestSection = ({
|
|
|
459
459
|
|
|
460
460
|
// src/pages/products/product-detail/components/product-attribute-section/product-attribute-section.tsx
|
|
461
461
|
import {
|
|
462
|
-
ListBullet,
|
|
463
462
|
Plus,
|
|
464
463
|
Trash,
|
|
465
464
|
Swatch,
|
|
@@ -613,12 +612,12 @@ var ProductAttributeSection = ({
|
|
|
613
612
|
{
|
|
614
613
|
label: t("products.create.attributes.addExisting"),
|
|
615
614
|
to: "attributes/add",
|
|
616
|
-
icon: /* @__PURE__ */ jsx4(
|
|
615
|
+
icon: /* @__PURE__ */ jsx4(Plus, {})
|
|
617
616
|
},
|
|
618
617
|
{
|
|
619
618
|
label: t("products.create.attributes.createNew"),
|
|
620
619
|
to: "attributes/create",
|
|
621
|
-
icon: /* @__PURE__ */ jsx4(
|
|
620
|
+
icon: /* @__PURE__ */ jsx4(PencilSquare, {})
|
|
622
621
|
}
|
|
623
622
|
]
|
|
624
623
|
}
|
|
@@ -632,7 +631,7 @@ var ProductAttributeSection = ({
|
|
|
632
631
|
AttributeGroup,
|
|
633
632
|
{
|
|
634
633
|
icon: /* @__PURE__ */ jsx4(Swatch, {}),
|
|
635
|
-
title: t("products.
|
|
634
|
+
title: t("products.attributeVariations"),
|
|
636
635
|
description: t("products.attributeVariantsDescription"),
|
|
637
636
|
attributes: variantAttributes,
|
|
638
637
|
productId: product.id
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
useCustomerGroupTableFilters
|
|
6
6
|
} from "./chunk-OI4DJXUL.js";
|
|
7
|
+
import {
|
|
8
|
+
useOrderGroupTableFilters
|
|
9
|
+
} from "./chunk-FU3QYH6H.js";
|
|
7
10
|
import {
|
|
8
11
|
useOrderTableQuery
|
|
9
12
|
} from "./chunk-QUHSHIAC.js";
|
|
@@ -131,8 +134,8 @@ var CustomerAddressSection = ({
|
|
|
131
134
|
"flex h-full flex-col overflow-hidden border-t p-6": true
|
|
132
135
|
}),
|
|
133
136
|
icon: null,
|
|
134
|
-
title: t2("
|
|
135
|
-
message: t2("
|
|
137
|
+
title: t2("customers.addresses.emptyTitle"),
|
|
138
|
+
message: t2("customers.addresses.emptyMessage")
|
|
136
139
|
}
|
|
137
140
|
) }),
|
|
138
141
|
addresses.map((address) => {
|
|
@@ -293,6 +296,7 @@ import { Link as Link2 } from "react-router-dom";
|
|
|
293
296
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
294
297
|
var PAGE_SIZE = 10;
|
|
295
298
|
var PREFIX = "cusgr";
|
|
299
|
+
var DEFAULT_ORDER = "-created_at";
|
|
296
300
|
var CustomerGroupSection = ({
|
|
297
301
|
customer
|
|
298
302
|
}) => {
|
|
@@ -305,6 +309,7 @@ var CustomerGroupSection = ({
|
|
|
305
309
|
const { customer_groups, count, isLoading, isError, error } = useCustomerGroups(
|
|
306
310
|
{
|
|
307
311
|
...searchParams,
|
|
312
|
+
order: searchParams.order || DEFAULT_ORDER,
|
|
308
313
|
fields: "+customers.id,+seller.id,+seller.name",
|
|
309
314
|
customers: { id: customer.id }
|
|
310
315
|
},
|
|
@@ -331,11 +336,12 @@ var CustomerGroupSection = ({
|
|
|
331
336
|
});
|
|
332
337
|
const handleRemove = async () => {
|
|
333
338
|
const customerGroupIds = Object.keys(rowSelection);
|
|
339
|
+
const selectedGroups = customer_groups?.filter((g) => customerGroupIds.includes(g.id)) ?? [];
|
|
340
|
+
const names = selectedGroups.map((g) => g.name);
|
|
341
|
+
const isSingle = selectedGroups.length === 1;
|
|
334
342
|
const res = await prompt({
|
|
335
|
-
title: t("
|
|
336
|
-
description: t("customers.groups.removeMany", {
|
|
337
|
-
groups: customer_groups?.filter((g) => customerGroupIds.includes(g.id)).map((g) => g.name).join(",")
|
|
338
|
-
}),
|
|
343
|
+
title: t("customers.groups.removeTitle"),
|
|
344
|
+
description: isSingle ? t("customers.groups.remove", { name: names[0] }) : t("customers.groups.removeMany", { groups: names.join(", ") }),
|
|
339
345
|
confirmText: t("actions.remove"),
|
|
340
346
|
cancelText: t("actions.cancel")
|
|
341
347
|
});
|
|
@@ -347,8 +353,8 @@ var CustomerGroupSection = ({
|
|
|
347
353
|
{
|
|
348
354
|
onSuccess: () => {
|
|
349
355
|
toast3.success(
|
|
350
|
-
t("customers.groups.removed.
|
|
351
|
-
groups:
|
|
356
|
+
isSingle ? t("customers.groups.removed.successOne", { groups: names[0] }) : t("customers.groups.removed.successMany", {
|
|
357
|
+
groups: names.join(", ")
|
|
352
358
|
})
|
|
353
359
|
);
|
|
354
360
|
},
|
|
@@ -384,6 +390,7 @@ var CustomerGroupSection = ({
|
|
|
384
390
|
{ key: "created_at", label: t("fields.createdAt") },
|
|
385
391
|
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
386
392
|
],
|
|
393
|
+
defaultOrder: DEFAULT_ORDER,
|
|
387
394
|
commands: [
|
|
388
395
|
{
|
|
389
396
|
action: handleRemove,
|
|
@@ -393,7 +400,9 @@ var CustomerGroupSection = ({
|
|
|
393
400
|
],
|
|
394
401
|
queryObject: raw,
|
|
395
402
|
noRecords: {
|
|
396
|
-
|
|
403
|
+
title: t("customers.groups.list.emptyTitle"),
|
|
404
|
+
message: t("customers.groups.list.noRecordsMessage"),
|
|
405
|
+
icon: null
|
|
397
406
|
}
|
|
398
407
|
}
|
|
399
408
|
)
|
|
@@ -408,7 +417,7 @@ var CustomerGroupRowActions = ({
|
|
|
408
417
|
const { mutateAsync } = useRemoveCustomersFromGroup(group.id);
|
|
409
418
|
const onRemove = async () => {
|
|
410
419
|
const res = await prompt({
|
|
411
|
-
title: t2("
|
|
420
|
+
title: t2("customers.groups.removeTitle"),
|
|
412
421
|
description: t2("customers.groups.remove", {
|
|
413
422
|
name: group.name
|
|
414
423
|
}),
|
|
@@ -419,6 +428,11 @@ var CustomerGroupRowActions = ({
|
|
|
419
428
|
return;
|
|
420
429
|
}
|
|
421
430
|
await mutateAsync([customerId], {
|
|
431
|
+
onSuccess: () => {
|
|
432
|
+
toast3.success(
|
|
433
|
+
t2("customers.groups.removed.successOne", { groups: group.name })
|
|
434
|
+
);
|
|
435
|
+
},
|
|
422
436
|
onError: (error) => {
|
|
423
437
|
toast3.error(error.message);
|
|
424
438
|
}
|
|
@@ -585,6 +599,9 @@ var CustomerOrderSection = ({
|
|
|
585
599
|
() => transformOrderGroups(order_groups ?? [], t2),
|
|
586
600
|
[order_groups, t2]
|
|
587
601
|
);
|
|
602
|
+
const filters = useOrderGroupTableFilters().filter(
|
|
603
|
+
(f) => f.key !== "customer_id"
|
|
604
|
+
);
|
|
588
605
|
const columns = useColumns2();
|
|
589
606
|
const { table } = useDataTable({
|
|
590
607
|
data: rows,
|
|
@@ -612,11 +629,13 @@ var CustomerOrderSection = ({
|
|
|
612
629
|
count,
|
|
613
630
|
isLoading,
|
|
614
631
|
pageSize: PAGE_SIZE2,
|
|
632
|
+
filters,
|
|
615
633
|
orderBy: [
|
|
616
634
|
{ key: "display_id", label: t2("orders.fields.displayId") },
|
|
617
635
|
{ key: "created_at", label: t2("fields.createdAt") },
|
|
618
636
|
{ key: "updated_at", label: t2("fields.updatedAt") }
|
|
619
637
|
],
|
|
638
|
+
defaultOrder: "-display_id",
|
|
620
639
|
search: true,
|
|
621
640
|
queryObject: raw,
|
|
622
641
|
prefix: PREFIX2
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from "./chunk-PHOCVOZ5.js";
|
|
14
14
|
|
|
15
15
|
// src/hooks/table/columns/use-product-table-columns.tsx
|
|
16
|
-
import { Checkbox } from "@medusajs/ui";
|
|
17
16
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
18
17
|
import { useMemo } from "react";
|
|
19
18
|
|
|
@@ -52,26 +51,6 @@ var columnHelper = createColumnHelper();
|
|
|
52
51
|
var useProductTableColumns = () => {
|
|
53
52
|
return useMemo(
|
|
54
53
|
() => [
|
|
55
|
-
columnHelper.display({
|
|
56
|
-
id: "select",
|
|
57
|
-
header: ({ table }) => /* @__PURE__ */ jsx3(
|
|
58
|
-
Checkbox,
|
|
59
|
-
{
|
|
60
|
-
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
61
|
-
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
62
|
-
"data-testid": "products-table-header-select-checkbox"
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
cell: ({ row }) => /* @__PURE__ */ jsx3(
|
|
66
|
-
Checkbox,
|
|
67
|
-
{
|
|
68
|
-
checked: row.getIsSelected(),
|
|
69
|
-
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
70
|
-
onClick: (e) => e.stopPropagation(),
|
|
71
|
-
"data-testid": `products-table-cell-${row.id}-select-checkbox`
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
}),
|
|
75
54
|
columnHelper.display({
|
|
76
55
|
id: "product",
|
|
77
56
|
header: () => /* @__PURE__ */ jsx3(ProductHeader, {}),
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useOrderGroupTableFilters
|
|
3
|
+
} from "./chunk-FU3QYH6H.js";
|
|
1
4
|
import {
|
|
2
5
|
useOrderTableQuery
|
|
3
6
|
} from "./chunk-QUHSHIAC.js";
|
|
@@ -28,15 +31,6 @@ import {
|
|
|
28
31
|
import {
|
|
29
32
|
useOrderGroups
|
|
30
33
|
} from "./chunk-PYF5EER5.js";
|
|
31
|
-
import {
|
|
32
|
-
useSellers
|
|
33
|
-
} from "./chunk-NS3GQ2J6.js";
|
|
34
|
-
import {
|
|
35
|
-
useCustomers
|
|
36
|
-
} from "./chunk-RGS5ZOY7.js";
|
|
37
|
-
import {
|
|
38
|
-
useSalesChannels
|
|
39
|
-
} from "./chunk-MW47LDBT.js";
|
|
40
34
|
|
|
41
35
|
// src/pages/orders/order-list/order-list.tsx
|
|
42
36
|
import { Children as Children3 } from "react";
|
|
@@ -77,8 +71,8 @@ import { IconButton, clx } from "@medusajs/ui";
|
|
|
77
71
|
import { TriangleRightMini } from "@medusajs/icons";
|
|
78
72
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
79
73
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
80
|
-
import { useMemo
|
|
81
|
-
import { useTranslation as
|
|
74
|
+
import { useMemo } from "react";
|
|
75
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
82
76
|
|
|
83
77
|
// src/pages/orders/order-list/const.ts
|
|
84
78
|
var DEFAULT_PROPERTIES = [
|
|
@@ -109,104 +103,6 @@ var DEFAULT_FIELDS = `${DEFAULT_PROPERTIES.join(
|
|
|
109
103
|
","
|
|
110
104
|
)},${DEFAULT_RELATIONS.join(",")}`;
|
|
111
105
|
|
|
112
|
-
// src/pages/orders/order-list/components/order-list-table/use-order-table-filters.tsx
|
|
113
|
-
import { useMemo } from "react";
|
|
114
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
115
|
-
var useOrderGroupTableFilters = () => {
|
|
116
|
-
const { t } = useTranslation2();
|
|
117
|
-
const { customers } = useCustomers({
|
|
118
|
-
limit: 1e3,
|
|
119
|
-
fields: "id,first_name,last_name,email"
|
|
120
|
-
});
|
|
121
|
-
const { sellers } = useSellers({
|
|
122
|
-
limit: 1e3,
|
|
123
|
-
fields: "id,name"
|
|
124
|
-
});
|
|
125
|
-
const { sales_channels } = useSalesChannels({
|
|
126
|
-
limit: 1e3,
|
|
127
|
-
fields: "id,name"
|
|
128
|
-
});
|
|
129
|
-
return useMemo(() => {
|
|
130
|
-
const filters = [];
|
|
131
|
-
if (customers?.length) {
|
|
132
|
-
filters.push({
|
|
133
|
-
key: "customer_id",
|
|
134
|
-
label: t("fields.customer"),
|
|
135
|
-
type: "select",
|
|
136
|
-
multiple: true,
|
|
137
|
-
searchable: true,
|
|
138
|
-
options: customers.map((c) => ({
|
|
139
|
-
label: [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email,
|
|
140
|
-
value: c.id
|
|
141
|
-
}))
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
if (sellers?.length) {
|
|
145
|
-
filters.push({
|
|
146
|
-
key: "seller_id",
|
|
147
|
-
label: "Store",
|
|
148
|
-
type: "select",
|
|
149
|
-
multiple: true,
|
|
150
|
-
searchable: true,
|
|
151
|
-
options: sellers.map((s) => ({
|
|
152
|
-
label: s.name,
|
|
153
|
-
value: s.id
|
|
154
|
-
}))
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (sales_channels?.length) {
|
|
158
|
-
filters.push({
|
|
159
|
-
key: "sales_channel_id",
|
|
160
|
-
label: t("fields.salesChannel"),
|
|
161
|
-
type: "select",
|
|
162
|
-
multiple: true,
|
|
163
|
-
searchable: true,
|
|
164
|
-
options: sales_channels.map((s) => ({
|
|
165
|
-
label: s.name,
|
|
166
|
-
value: s.id
|
|
167
|
-
}))
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
filters.push({
|
|
171
|
-
key: "status",
|
|
172
|
-
label: t("fields.status"),
|
|
173
|
-
type: "select",
|
|
174
|
-
multiple: true,
|
|
175
|
-
options: [
|
|
176
|
-
{ label: "Pending", value: "pending" },
|
|
177
|
-
{ label: "Completed", value: "completed" },
|
|
178
|
-
{ label: "Canceled", value: "canceled" },
|
|
179
|
-
{ label: "Requires action", value: "requires_action" }
|
|
180
|
-
]
|
|
181
|
-
});
|
|
182
|
-
filters.push({
|
|
183
|
-
key: "request",
|
|
184
|
-
label: t("orders.filters.request.label"),
|
|
185
|
-
type: "select",
|
|
186
|
-
multiple: true,
|
|
187
|
-
options: [
|
|
188
|
-
{ label: t("orders.filters.request.edit"), value: "edit" },
|
|
189
|
-
{ label: t("orders.filters.request.return"), value: "return" },
|
|
190
|
-
{ label: t("orders.filters.request.exchange"), value: "exchange" },
|
|
191
|
-
{ label: t("orders.filters.request.claim"), value: "claim" }
|
|
192
|
-
]
|
|
193
|
-
});
|
|
194
|
-
filters.push(
|
|
195
|
-
{
|
|
196
|
-
key: "created_at",
|
|
197
|
-
label: t("fields.createdAt"),
|
|
198
|
-
type: "date"
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
key: "updated_at",
|
|
202
|
-
label: t("fields.updatedAt"),
|
|
203
|
-
type: "date"
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
return filters;
|
|
207
|
-
}, [customers, sellers, sales_channels, t]);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
106
|
// src/pages/orders/order-list/components/order-list-table/order-list-data-table.tsx
|
|
211
107
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
212
108
|
var PAGE_SIZE = 20;
|
|
@@ -253,7 +149,7 @@ function transformOrderGroups(orderGroups, t) {
|
|
|
253
149
|
});
|
|
254
150
|
}
|
|
255
151
|
var OrderListDataTable = () => {
|
|
256
|
-
const { t } =
|
|
152
|
+
const { t } = useTranslation2();
|
|
257
153
|
const { searchParams, raw } = useOrderTableQuery({
|
|
258
154
|
pageSize: PAGE_SIZE
|
|
259
155
|
});
|
|
@@ -266,7 +162,7 @@ var OrderListDataTable = () => {
|
|
|
266
162
|
placeholderData: keepPreviousData
|
|
267
163
|
}
|
|
268
164
|
);
|
|
269
|
-
const rows =
|
|
165
|
+
const rows = useMemo(
|
|
270
166
|
() => transformOrderGroups(order_groups ?? [], t),
|
|
271
167
|
[order_groups, t]
|
|
272
168
|
);
|
|
@@ -311,8 +207,8 @@ var OrderListDataTable = () => {
|
|
|
311
207
|
};
|
|
312
208
|
var columnHelper = createColumnHelper();
|
|
313
209
|
var useColumns = () => {
|
|
314
|
-
const { t } =
|
|
315
|
-
return
|
|
210
|
+
const { t } = useTranslation2();
|
|
211
|
+
return useMemo(
|
|
316
212
|
() => [
|
|
317
213
|
columnHelper.accessor("display_id", {
|
|
318
214
|
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("orders.fields.groupId") }),
|
|
@@ -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 CategoryMediaItemMenu = ({
|
|
|
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("categories.media.actions.removeThumbnail") : t("categories.media.actions.setThumbnail"),
|
|
293
295
|
tooltip: t("categories.media.tooltips.thumbnail"),
|
|
294
296
|
onClick: onToggleThumbnail
|
|
@@ -297,7 +299,7 @@ var CategoryMediaItemMenu = ({
|
|
|
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("categories.media.actions.removeBanner") : t("categories.media.actions.setBanner"),
|
|
302
304
|
tooltip: t("categories.media.tooltips.banner"),
|
|
303
305
|
onClick: onToggleBanner
|