@mercurjs/admin 2.3.7-canary.1 → 2.3.8-canary.0
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-HHMISUZB.js → add-campaign-promotions-6BYWL6AA.js} +1 -1
- package/dist/{api-key-management-list-D3W4HEBM.js → api-key-management-list-7L7OLDGO.js} +2 -2
- package/dist/{attribute-detail-4B2P7UFG.js → attribute-detail-5AB2NEZE.js} +1 -1
- package/dist/{attribute-list-TZH5MVDT.js → attribute-list-QPJM77HR.js} +2 -2
- package/dist/{campaign-detail-W57XZ472.js → campaign-detail-VT62HOSX.js} +2 -2
- package/dist/{campaign-list-QVXUWMO5.js → campaign-list-4UPMYKLS.js} +2 -2
- package/dist/{category-detail-T27AGZ6B.js → category-detail-WM5PKZHS.js} +2 -2
- package/dist/{category-list-F6ZFHTGZ.js → category-list-67JSNVXT.js} +2 -2
- package/dist/{category-products-UE5Y3VG3.js → category-products-RYOQ5TM5.js} +1 -1
- package/dist/{chunk-W76OQ4UW.js → chunk-2D5NZTA6.js} +1 -1
- package/dist/chunk-35TFC2OI.js +210 -0
- package/dist/{chunk-OIMNVZDF.js → chunk-37GE6N5V.js} +1 -1
- package/dist/{chunk-DL3P6W63.js → chunk-4NMCASJ4.js} +1 -1
- package/dist/{chunk-OIWWUZDL.js → chunk-64EWPXUL.js} +1 -1
- package/dist/{chunk-K6WZ5WW5.js → chunk-66YS5LUL.js} +1 -1
- package/dist/{chunk-46WZTQ36.js → chunk-6QXWDLBA.js} +1 -1
- package/dist/{chunk-FCV5FSUM.js → chunk-7CNMMPNC.js} +1 -1
- package/dist/{chunk-BIL56N3K.js → chunk-7WTDVMPJ.js} +1 -1
- package/dist/{chunk-F6OU2QCY.js → chunk-7ZFSINKL.js} +1 -1
- package/dist/{chunk-SU36MZXC.js → chunk-AJZPQDDW.js} +12 -4
- package/dist/{chunk-DM52HEOD.js → chunk-BJCD2G3U.js} +1 -1
- package/dist/{chunk-YIFUH266.js → chunk-BRC3VJXF.js} +1 -1
- package/dist/{chunk-EHNOBH5I.js → chunk-CDFZKJSC.js} +1 -1
- package/dist/{chunk-AXCRJBUY.js → chunk-D7PXCIZX.js} +1 -1
- package/dist/{chunk-EP5CUH4C.js → chunk-FVC2Z3LR.js} +1 -1
- package/dist/{chunk-ATZPWIEI.js → chunk-GF4BJFSQ.js} +1 -1
- package/dist/{chunk-6A4PFRRO.js → chunk-GIFVQPFT.js} +1 -1
- package/dist/{chunk-D2VI737U.js → chunk-IG6ODEES.js} +1 -1
- package/dist/{chunk-GMJLK3IK.js → chunk-JOIE6CIR.js} +20 -1
- package/dist/{chunk-X6NX7BIG.js → chunk-MXIRZGYW.js} +1 -1
- package/dist/{chunk-4CGY6T44.js → chunk-NGYIAHMG.js} +1 -1
- package/dist/{chunk-22WJ7M7K.js → chunk-O3JRFTHJ.js} +1 -1
- package/dist/{chunk-AR3A6ZV4.js → chunk-O4L5V6TE.js} +1 -1
- package/dist/{chunk-6BX43GXE.js → chunk-ODBRDDOZ.js} +1 -1
- package/dist/{chunk-YQUS4QOS.js → chunk-OHL76ICJ.js} +1 -1
- package/dist/{chunk-BB4C372O.js → chunk-OHTFAHSD.js} +1 -1
- package/dist/{chunk-PQJ2KGLD.js → chunk-PFP6ZXLY.js} +2 -2
- package/dist/{chunk-AAVL5MJC.js → chunk-PTE652T6.js} +1 -1
- package/dist/{chunk-HZ4ADOD4.js → chunk-PTEWKH52.js} +1 -1
- package/dist/{chunk-MXMLUPAQ.js → chunk-Q254WWFS.js} +1 -1
- package/dist/{chunk-FHZ6TGFK.js → chunk-Q2ZJOBFJ.js} +1 -1
- package/dist/{chunk-6HHWBWQS.js → chunk-QHWI5KGN.js} +1 -1
- package/dist/{chunk-XZ2I74IZ.js → chunk-QPMAY54N.js} +1 -1
- package/dist/{chunk-MBSBOJFI.js → chunk-T3IV6KW3.js} +1 -1
- package/dist/{chunk-NRR55ZC2.js → chunk-UUQEZYGA.js} +1 -1
- package/dist/{chunk-5R457J2W.js → chunk-V2N6JLWD.js} +1 -1
- package/dist/{chunk-WXZYC4LI.js → chunk-V6OUOIBQ.js} +1 -1
- package/dist/{chunk-TSYSLFEE.js → chunk-VHO5PEEO.js} +1 -1
- package/dist/{chunk-NJAKCRO2.js → chunk-WDTE56OU.js} +1 -1
- package/dist/{chunk-AMRK755L.js → chunk-WISQFAJG.js} +177 -176
- package/dist/{chunk-CGKIYXZ6.js → chunk-WUCZ7VH3.js} +1 -1
- package/dist/{chunk-GOHCQWAJ.js → chunk-Y3P5VQ64.js} +1 -1
- package/dist/{chunk-AHRICJVV.js → chunk-YRMMQMSK.js} +1 -1
- package/dist/{chunk-TVCHVG2A.js → chunk-YZ7TYYVL.js} +1 -1
- package/dist/{chunk-J7FYKWJU.js → chunk-ZCPG6OV7.js} +1 -1
- package/dist/{chunk-R7LXMTIT.js → chunk-ZPKQWWCF.js} +2 -2
- package/dist/{chunk-QE36PNTV.js → chunk-ZQMCTQ2T.js} +1 -1
- package/dist/{collection-add-products-VNSPLNGL.js → collection-add-products-YQP5YOZO.js} +1 -1
- package/dist/{collection-detail-2XGAQMMS.js → collection-detail-IQV54EVJ.js} +2 -2
- package/dist/{collection-list-D23O4C7N.js → collection-list-Z7IA57OF.js} +2 -2
- package/dist/{commissions-list-ENJJOKHU.js → commissions-list-4MRDFAN6.js} +2 -2
- package/dist/{customer-detail-DROF3TFM.js → customer-detail-KOWSLCSV.js} +4 -3
- package/dist/{customer-group-add-customers-BRAX5VEC.js → customer-group-add-customers-KF432FE3.js} +1 -1
- package/dist/{customer-group-detail-7SRN7XGR.js → customer-group-detail-KYEP2WK5.js} +2 -2
- package/dist/{customer-group-list-3UV4JFIC.js → customer-group-list-GOAFY7WR.js} +2 -2
- package/dist/{customer-list-IF5HB6CU.js → customer-list-NVJX3U6Z.js} +2 -2
- package/dist/{customers-add-customer-group-7XSK3ZI6.js → customers-add-customer-group-CAPDOFBQ.js} +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +86 -86
- package/dist/{inventory-detail-YMY427YA.js → inventory-detail-5MBZ3WUH.js} +2 -2
- package/dist/{inventory-list-RNA7PFS5.js → inventory-list-PUHEUY6U.js} +2 -2
- package/dist/{location-fulfillment-providers-RI6OE65I.js → location-fulfillment-providers-RHFROGUA.js} +1 -1
- package/dist/{location-service-zone-create-Y3QEVCV2.js → location-service-zone-create-76EAFAJQ.js} +2 -2
- package/dist/{location-service-zone-manage-areas-7GT26QCN.js → location-service-zone-manage-areas-AU6O2R7D.js} +2 -2
- package/dist/{marketplace-add-currencies-2LCP4XJV.js → marketplace-add-currencies-LP54QP2F.js} +1 -1
- package/dist/{marketplace-detail-J7GVUZ7T.js → marketplace-detail-XIWEU2BP.js} +2 -2
- package/dist/{offer-detail-page-3H5APJUL.js → offer-detail-page-XNA63LSW.js} +2 -2
- package/dist/{offer-variant-detail-page-V6MP4SDN.js → offer-variant-detail-page-UATB4UIF.js} +2 -2
- package/dist/{offers-V4LY624Q.js → offers-3VVLBXXT.js} +1 -1
- package/dist/{order-create-claim-HRKNY4UI.js → order-create-claim-SA7G3BF7.js} +1 -1
- package/dist/{order-create-edit-LRHRGV4I.js → order-create-edit-MTLZ4MH6.js} +1 -1
- package/dist/{order-create-exchange-O23CVHIT.js → order-create-exchange-EY5GJP46.js} +1 -1
- package/dist/{order-create-return-R7YVDNVA.js → order-create-return-A7F4OQUD.js} +1 -1
- package/dist/{order-detail-56D3JKHO.js → order-detail-RJFKE5JR.js} +2 -2
- package/dist/{order-list-WJBA7YQN.js → order-list-V5SXVY4C.js} +4 -3
- package/dist/pages/index.js +45 -45
- package/dist/{payout-list-RYMCSVCT.js → payout-list-J5QBFBDQ.js} +2 -2
- package/dist/{price-list-create-UM63JWQQ.js → price-list-create-M7DT7DIB.js} +2 -2
- package/dist/{price-list-detail-G74QPX4O.js → price-list-detail-K5GT75MR.js} +2 -2
- package/dist/{price-list-list-IRVQYOHC.js → price-list-list-RVA2BXQB.js} +2 -2
- package/dist/{price-list-prices-add-H2MEQ2QR.js → price-list-prices-add-MNDRESKR.js} +2 -2
- package/dist/{product-create-WNSDDRLU.js → product-create-UZOSX5CO.js} +3 -3
- package/dist/{product-detail-3BCNKITT.js → product-detail-P5TG7T7B.js} +2 -2
- package/dist/{product-list-7CP6FHMX.js → product-list-YDYL765G.js} +2 -2
- package/dist/{product-media-SHV2VX7L.js → product-media-K2EC5Z2P.js} +1 -1
- package/dist/{product-tag-detail-LIAIYUDS.js → product-tag-detail-VJW4TMI6.js} +2 -2
- package/dist/{product-tag-list-BHRUK7QW.js → product-tag-list-ZF44FBU3.js} +2 -2
- package/dist/{product-type-detail-2K3HSKEC.js → product-type-detail-O5MQCKY2.js} +2 -2
- package/dist/{product-type-list-QA4OOOCL.js → product-type-list-B6RRMREU.js} +2 -2
- package/dist/{promotion-list-FXWF6U3M.js → promotion-list-AKK3OZJO.js} +2 -2
- package/dist/{region-add-countries-DV54R2PN.js → region-add-countries-IA2HWUQX.js} +1 -1
- package/dist/{region-create-CJM7NXOM.js → region-create-HRJDZSAK.js} +1 -1
- package/dist/{region-detail-3RF2GD3W.js → region-detail-UDNWHURY.js} +2 -2
- package/dist/{region-list-3QKAMIKS.js → region-list-QQ3XRZBU.js} +2 -2
- package/dist/{reservation-list-X4C45DYL.js → reservation-list-FJEIO3S2.js} +2 -2
- package/dist/{return-reason-list-OKMBV3IZ.js → return-reason-list-3PS25BKE.js} +2 -2
- package/dist/{review-list-M7LNFCKQ.js → review-list-TWXSIZOP.js} +2 -2
- package/dist/{sales-channel-add-products-Q6TSFJKU.js → sales-channel-add-products-KC4RYJT3.js} +1 -1
- package/dist/{sales-channel-detail-IISFMMEN.js → sales-channel-detail-2NIKTQNB.js} +2 -2
- package/dist/{shipping-option-type-list-TR3OGBEP.js → shipping-option-type-list-SC3AKZ3A.js} +2 -2
- package/dist/{shipping-profiles-list-WJI2DCLN.js → shipping-profiles-list-OC45TR2L.js} +2 -2
- package/dist/{store-details-GR4XNG6J.js → store-details-CGAKQDWN.js} +2 -2
- package/dist/{store-edit-JMRDCFIC.js → store-edit-XBWOY5CE.js} +1 -1
- package/dist/{store-list-6UMZQV5N.js → store-list-7FX5VPU2.js} +2 -2
- package/dist/{tax-region-tax-override-create-WPCZ47CE.js → tax-region-tax-override-create-5FUN3FYU.js} +2 -2
- package/dist/{tax-region-tax-override-edit-O5CTVPCG.js → tax-region-tax-override-edit-AGHJ76KK.js} +2 -2
- package/dist/{user-invite-S3SL2HJF.js → user-invite-DMUC4EQ4.js} +1 -1
- package/dist/{user-list-7P2ZSQGM.js → user-list-ZK63T6SJ.js} +2 -2
- package/package.json +6 -6
- package/dist/chunk-W7TEZYU7.js +0 -98
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiKeyManagementListPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZCPG6OV7.js";
|
|
4
4
|
import "./chunk-XFR5JLNF.js";
|
|
5
5
|
import "./chunk-F3XPA5ID.js";
|
|
6
6
|
import "./chunk-JHIMVLB2.js";
|
|
@@ -11,7 +11,7 @@ import "./chunk-E74OUNA3.js";
|
|
|
11
11
|
import "./chunk-H6MYB7GB.js";
|
|
12
12
|
import "./chunk-THHRRYRS.js";
|
|
13
13
|
import "./chunk-FQERBIVS.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-AJZPQDDW.js";
|
|
15
15
|
import "./chunk-YN3FGNJM.js";
|
|
16
16
|
import "./chunk-ZAOEFQ6K.js";
|
|
17
17
|
import "./chunk-4J74G7N2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AttributeListPage,
|
|
3
3
|
attributeListLoader
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T3IV6KW3.js";
|
|
5
5
|
import "./chunk-JHIMVLB2.js";
|
|
6
6
|
import "./chunk-PHOCVOZ5.js";
|
|
7
7
|
import "./chunk-RT6L7JXU.js";
|
|
@@ -11,7 +11,7 @@ import "./chunk-E74OUNA3.js";
|
|
|
11
11
|
import "./chunk-H6MYB7GB.js";
|
|
12
12
|
import "./chunk-THHRRYRS.js";
|
|
13
13
|
import "./chunk-FQERBIVS.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-AJZPQDDW.js";
|
|
15
15
|
import "./chunk-YN3FGNJM.js";
|
|
16
16
|
import "./chunk-ZAOEFQ6K.js";
|
|
17
17
|
import "./chunk-4J74G7N2.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CAMPAIGN_DETAIL_FIELDS,
|
|
3
3
|
CampaignDetailPage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QHWI5KGN.js";
|
|
5
5
|
import "./chunk-WP3B4NEU.js";
|
|
6
6
|
import "./chunk-7CGMFCSU.js";
|
|
7
7
|
import "./chunk-FB2PJHN5.js";
|
|
@@ -17,7 +17,7 @@ import "./chunk-E74OUNA3.js";
|
|
|
17
17
|
import "./chunk-H6MYB7GB.js";
|
|
18
18
|
import "./chunk-THHRRYRS.js";
|
|
19
19
|
import "./chunk-FQERBIVS.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-AJZPQDDW.js";
|
|
21
21
|
import "./chunk-YN3FGNJM.js";
|
|
22
22
|
import "./chunk-ZAOEFQ6K.js";
|
|
23
23
|
import "./chunk-4J74G7N2.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CampaignListPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IG6ODEES.js";
|
|
4
4
|
import "./chunk-7VO6VJZJ.js";
|
|
5
5
|
import "./chunk-WP3B4NEU.js";
|
|
6
6
|
import "./chunk-LISOKQBZ.js";
|
|
@@ -12,7 +12,7 @@ import "./chunk-E74OUNA3.js";
|
|
|
12
12
|
import "./chunk-H6MYB7GB.js";
|
|
13
13
|
import "./chunk-THHRRYRS.js";
|
|
14
14
|
import "./chunk-FQERBIVS.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-AJZPQDDW.js";
|
|
16
16
|
import "./chunk-YN3FGNJM.js";
|
|
17
17
|
import "./chunk-ZAOEFQ6K.js";
|
|
18
18
|
import "./chunk-4J74G7N2.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CategoryDetailPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WUCZ7VH3.js";
|
|
4
4
|
import "./chunk-7AV5EJJ5.js";
|
|
5
5
|
import "./chunk-N4G3RFLY.js";
|
|
6
6
|
import "./chunk-Y456KVIN.js";
|
|
@@ -19,7 +19,7 @@ import "./chunk-U3I6S3RO.js";
|
|
|
19
19
|
import "./chunk-THHRRYRS.js";
|
|
20
20
|
import "./chunk-ESRIX7ZH.js";
|
|
21
21
|
import "./chunk-FQERBIVS.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-AJZPQDDW.js";
|
|
23
23
|
import "./chunk-YN3FGNJM.js";
|
|
24
24
|
import "./chunk-ZAOEFQ6K.js";
|
|
25
25
|
import "./chunk-4J74G7N2.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CategoryListPage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7CNMMPNC.js";
|
|
4
4
|
import "./chunk-N4G3RFLY.js";
|
|
5
5
|
import "./chunk-JHIMVLB2.js";
|
|
6
6
|
import "./chunk-Y456KVIN.js";
|
|
@@ -14,7 +14,7 @@ import "./chunk-H6MYB7GB.js";
|
|
|
14
14
|
import "./chunk-U3I6S3RO.js";
|
|
15
15
|
import "./chunk-THHRRYRS.js";
|
|
16
16
|
import "./chunk-FQERBIVS.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-AJZPQDDW.js";
|
|
18
18
|
import "./chunk-YN3FGNJM.js";
|
|
19
19
|
import "./chunk-ZAOEFQ6K.js";
|
|
20
20
|
import "./chunk-4J74G7N2.js";
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDebouncedSearch
|
|
3
|
+
} from "./chunk-PYDRHQTY.js";
|
|
4
|
+
import {
|
|
5
|
+
useCustomers
|
|
6
|
+
} from "./chunk-DEEY267U.js";
|
|
7
|
+
import {
|
|
8
|
+
useSellers
|
|
9
|
+
} from "./chunk-RP3J3X7P.js";
|
|
10
|
+
import {
|
|
11
|
+
useSalesChannels
|
|
12
|
+
} from "./chunk-7NXOLMSS.js";
|
|
13
|
+
|
|
14
|
+
// src/pages/orders/order-list/components/order-list-table/use-order-table-filters.tsx
|
|
15
|
+
import { usePermissions } from "@mercurjs/dashboard-shared";
|
|
16
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
17
|
+
import { useMemo } from "react";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
19
|
+
import { useSearchParams } from "react-router-dom";
|
|
20
|
+
var OPTIONS_PAGE_SIZE = 50;
|
|
21
|
+
var mergeOptions = (selected, found) => {
|
|
22
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23
|
+
return [...selected, ...found].filter((option) => {
|
|
24
|
+
if (seen.has(option.value)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
seen.add(option.value);
|
|
28
|
+
return true;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var useSelectedIds = (key) => {
|
|
32
|
+
const [searchParams] = useSearchParams();
|
|
33
|
+
const raw = searchParams.get(key);
|
|
34
|
+
return useMemo(() => raw?.split(",").filter(Boolean) ?? [], [raw]);
|
|
35
|
+
};
|
|
36
|
+
var PAYMENT_STATUSES = [
|
|
37
|
+
"not_paid",
|
|
38
|
+
"awaiting",
|
|
39
|
+
"authorized",
|
|
40
|
+
"partially_authorized",
|
|
41
|
+
"captured",
|
|
42
|
+
"partially_captured",
|
|
43
|
+
"refunded",
|
|
44
|
+
"partially_refunded",
|
|
45
|
+
"canceled",
|
|
46
|
+
"requires_action"
|
|
47
|
+
];
|
|
48
|
+
var camelCase = (value) => value.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
49
|
+
var useOrderGroupTableFilters = () => {
|
|
50
|
+
const { t } = useTranslation();
|
|
51
|
+
const { can } = usePermissions();
|
|
52
|
+
const customerSearch = useDebouncedSearch();
|
|
53
|
+
const sellerSearch = useDebouncedSearch();
|
|
54
|
+
const salesChannelSearch = useDebouncedSearch();
|
|
55
|
+
const selectedCustomerIds = useSelectedIds("customer_id");
|
|
56
|
+
const selectedSellerIds = useSelectedIds("seller_id");
|
|
57
|
+
const selectedSalesChannelIds = useSelectedIds("sales_channel_id");
|
|
58
|
+
const canViewCustomers = can("customers");
|
|
59
|
+
const canViewSellers = can("sellers");
|
|
60
|
+
const canViewSalesChannels = can("sales_channels");
|
|
61
|
+
const customerFields = "id,first_name,last_name,email";
|
|
62
|
+
const { customers, isFetching: isFetchingCustomers } = useCustomers(
|
|
63
|
+
{
|
|
64
|
+
limit: OPTIONS_PAGE_SIZE,
|
|
65
|
+
fields: customerFields,
|
|
66
|
+
...customerSearch.query ? { q: customerSearch.query } : {}
|
|
67
|
+
},
|
|
68
|
+
{ enabled: canViewCustomers, placeholderData: keepPreviousData }
|
|
69
|
+
);
|
|
70
|
+
const { customers: selectedCustomers } = useCustomers(
|
|
71
|
+
{
|
|
72
|
+
id: selectedCustomerIds,
|
|
73
|
+
limit: selectedCustomerIds.length,
|
|
74
|
+
fields: customerFields
|
|
75
|
+
},
|
|
76
|
+
{ enabled: canViewCustomers && selectedCustomerIds.length > 0 }
|
|
77
|
+
);
|
|
78
|
+
const { sellers, isFetching: isFetchingSellers } = useSellers(
|
|
79
|
+
{
|
|
80
|
+
limit: OPTIONS_PAGE_SIZE,
|
|
81
|
+
fields: "id,name",
|
|
82
|
+
...sellerSearch.query ? { q: sellerSearch.query } : {}
|
|
83
|
+
},
|
|
84
|
+
{ enabled: canViewSellers, placeholderData: keepPreviousData }
|
|
85
|
+
);
|
|
86
|
+
const { sellers: selectedSellers } = useSellers(
|
|
87
|
+
{
|
|
88
|
+
id: selectedSellerIds,
|
|
89
|
+
limit: selectedSellerIds.length,
|
|
90
|
+
fields: "id,name"
|
|
91
|
+
},
|
|
92
|
+
{ enabled: canViewSellers && selectedSellerIds.length > 0 }
|
|
93
|
+
);
|
|
94
|
+
const { sales_channels, isFetching: isFetchingSalesChannels } = useSalesChannels(
|
|
95
|
+
{
|
|
96
|
+
limit: OPTIONS_PAGE_SIZE,
|
|
97
|
+
fields: "id,name",
|
|
98
|
+
...salesChannelSearch.query ? { q: salesChannelSearch.query } : {}
|
|
99
|
+
},
|
|
100
|
+
{ enabled: canViewSalesChannels, placeholderData: keepPreviousData }
|
|
101
|
+
);
|
|
102
|
+
const { sales_channels: selectedSalesChannels } = useSalesChannels(
|
|
103
|
+
{
|
|
104
|
+
id: selectedSalesChannelIds,
|
|
105
|
+
limit: selectedSalesChannelIds.length,
|
|
106
|
+
fields: "id,name"
|
|
107
|
+
},
|
|
108
|
+
{ enabled: canViewSalesChannels && selectedSalesChannelIds.length > 0 }
|
|
109
|
+
);
|
|
110
|
+
return useMemo(() => {
|
|
111
|
+
const filters = [];
|
|
112
|
+
const customerOption = (c) => ({
|
|
113
|
+
label: [c.first_name, c.last_name].filter(Boolean).join(" ") || c.email || c.id,
|
|
114
|
+
value: c.id
|
|
115
|
+
});
|
|
116
|
+
const namedOption = (s) => ({
|
|
117
|
+
label: s.name || s.id,
|
|
118
|
+
value: s.id
|
|
119
|
+
});
|
|
120
|
+
if (canViewCustomers) {
|
|
121
|
+
filters.push({
|
|
122
|
+
key: "customer_id",
|
|
123
|
+
label: t("fields.customer"),
|
|
124
|
+
type: "select",
|
|
125
|
+
multiple: true,
|
|
126
|
+
searchable: true,
|
|
127
|
+
onSearch: customerSearch.onSearchValueChange,
|
|
128
|
+
isLoading: isFetchingCustomers,
|
|
129
|
+
options: mergeOptions(
|
|
130
|
+
(selectedCustomers ?? []).map(customerOption),
|
|
131
|
+
(customers ?? []).map(customerOption)
|
|
132
|
+
)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (canViewSellers) {
|
|
136
|
+
filters.push({
|
|
137
|
+
key: "seller_id",
|
|
138
|
+
label: t("fields.store"),
|
|
139
|
+
type: "select",
|
|
140
|
+
multiple: true,
|
|
141
|
+
searchable: true,
|
|
142
|
+
onSearch: sellerSearch.onSearchValueChange,
|
|
143
|
+
isLoading: isFetchingSellers,
|
|
144
|
+
options: mergeOptions(
|
|
145
|
+
(selectedSellers ?? []).map(namedOption),
|
|
146
|
+
(sellers ?? []).map(namedOption)
|
|
147
|
+
)
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (canViewSalesChannels) {
|
|
151
|
+
filters.push({
|
|
152
|
+
key: "sales_channel_id",
|
|
153
|
+
label: t("fields.salesChannel"),
|
|
154
|
+
type: "select",
|
|
155
|
+
multiple: true,
|
|
156
|
+
searchable: true,
|
|
157
|
+
onSearch: salesChannelSearch.onSearchValueChange,
|
|
158
|
+
isLoading: isFetchingSalesChannels,
|
|
159
|
+
options: mergeOptions(
|
|
160
|
+
(selectedSalesChannels ?? []).map(namedOption),
|
|
161
|
+
(sales_channels ?? []).map(namedOption)
|
|
162
|
+
)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
filters.push(
|
|
166
|
+
{
|
|
167
|
+
key: "payment_status",
|
|
168
|
+
label: t("orders.payment.statusLabel"),
|
|
169
|
+
type: "select",
|
|
170
|
+
multiple: true,
|
|
171
|
+
options: PAYMENT_STATUSES.map((status) => ({
|
|
172
|
+
label: t(`orders.payment.status.${camelCase(status)}`),
|
|
173
|
+
value: status
|
|
174
|
+
}))
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: "created_at",
|
|
178
|
+
label: t("fields.createdAt"),
|
|
179
|
+
type: "date"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
key: "updated_at",
|
|
183
|
+
label: t("fields.updatedAt"),
|
|
184
|
+
type: "date"
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
return filters;
|
|
188
|
+
}, [
|
|
189
|
+
t,
|
|
190
|
+
canViewCustomers,
|
|
191
|
+
canViewSellers,
|
|
192
|
+
canViewSalesChannels,
|
|
193
|
+
customers,
|
|
194
|
+
selectedCustomers,
|
|
195
|
+
isFetchingCustomers,
|
|
196
|
+
customerSearch.onSearchValueChange,
|
|
197
|
+
sellers,
|
|
198
|
+
selectedSellers,
|
|
199
|
+
isFetchingSellers,
|
|
200
|
+
sellerSearch.onSearchValueChange,
|
|
201
|
+
sales_channels,
|
|
202
|
+
selectedSalesChannels,
|
|
203
|
+
isFetchingSalesChannels,
|
|
204
|
+
salesChannelSearch.onSearchValueChange
|
|
205
|
+
]);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
useOrderGroupTableFilters
|
|
210
|
+
};
|
|
@@ -649,6 +649,8 @@ var SelectFilter = ({
|
|
|
649
649
|
readonly,
|
|
650
650
|
multiple,
|
|
651
651
|
searchable,
|
|
652
|
+
onSearch,
|
|
653
|
+
isLoading,
|
|
652
654
|
options,
|
|
653
655
|
openOnMount
|
|
654
656
|
}) => {
|
|
@@ -679,8 +681,12 @@ var SelectFilter = ({
|
|
|
679
681
|
}, 200);
|
|
680
682
|
}
|
|
681
683
|
};
|
|
684
|
+
const handleSearchChange = (value) => {
|
|
685
|
+
setSearch(value);
|
|
686
|
+
onSearch?.(value);
|
|
687
|
+
};
|
|
682
688
|
const handleClearSearch = () => {
|
|
683
|
-
|
|
689
|
+
handleSearchChange("");
|
|
684
690
|
if (searchRef) {
|
|
685
691
|
searchRef.focus();
|
|
686
692
|
}
|
|
@@ -725,14 +731,14 @@ var SelectFilter = ({
|
|
|
725
731
|
}
|
|
726
732
|
}
|
|
727
733
|
},
|
|
728
|
-
children: /* @__PURE__ */ jsxs4(Command, { className: "h-full", children: [
|
|
734
|
+
children: /* @__PURE__ */ jsxs4(Command, { className: "h-full", shouldFilter: !onSearch, children: [
|
|
729
735
|
searchable && /* @__PURE__ */ jsx4("div", { className: "border-b p-1", children: /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[1fr_20px] gap-x-2 rounded-md px-2 py-1", children: [
|
|
730
736
|
/* @__PURE__ */ jsx4(
|
|
731
737
|
Command.Input,
|
|
732
738
|
{
|
|
733
739
|
ref: setSearchRef,
|
|
734
740
|
value: search,
|
|
735
|
-
onValueChange:
|
|
741
|
+
onValueChange: handleSearchChange,
|
|
736
742
|
className: "txt-compact-small placeholder:text-ui-fg-muted bg-transparent outline-none",
|
|
737
743
|
placeholder: t2("general.search")
|
|
738
744
|
}
|
|
@@ -752,7 +758,7 @@ var SelectFilter = ({
|
|
|
752
758
|
}
|
|
753
759
|
) })
|
|
754
760
|
] }) }),
|
|
755
|
-
/* @__PURE__ */ jsx4(Command.Empty, { className: "txt-compact-small flex items-center justify-center p-1", children: /* @__PURE__ */ jsx4("span", { className: "w-full px-2 py-1 text-center", children: t2("general.noResultsTitle") }) }),
|
|
761
|
+
/* @__PURE__ */ jsx4(Command.Empty, { className: "txt-compact-small flex items-center justify-center p-1", children: /* @__PURE__ */ jsx4("span", { className: "w-full px-2 py-1 text-center", children: isLoading ? t2("general.loading") : t2("general.noResultsTitle") }) }),
|
|
756
762
|
/* @__PURE__ */ jsx4(Command.List, { className: "h-full max-h-[163px] min-h-[0] overflow-auto p-1 outline-none", children: options.map((option) => {
|
|
757
763
|
const isSelected = selectedParams.get().includes(String(option.value));
|
|
758
764
|
return /* @__PURE__ */ jsxs4(
|
|
@@ -966,6 +972,8 @@ var DataTableFilter = ({
|
|
|
966
972
|
options: filter.options,
|
|
967
973
|
multiple: filter.multiple,
|
|
968
974
|
searchable: filter.searchable,
|
|
975
|
+
onSearch: filter.onSearch,
|
|
976
|
+
isLoading: filter.isLoading,
|
|
969
977
|
openOnMount: filter.openOnMount
|
|
970
978
|
},
|
|
971
979
|
filter.key
|
|
@@ -191,6 +191,25 @@ var generateVariantsFromAttributes = (attributes, currentVariants) => {
|
|
|
191
191
|
}
|
|
192
192
|
return newVariants;
|
|
193
193
|
};
|
|
194
|
+
var syncVariantsWithAttributes = (form) => {
|
|
195
|
+
const currentVariants = form.getValues("variants") ?? [];
|
|
196
|
+
const nextVariants = generateVariantsFromAttributes(
|
|
197
|
+
form.getValues("attributes") ?? [],
|
|
198
|
+
currentVariants
|
|
199
|
+
);
|
|
200
|
+
const sameOptions = JSON.stringify(nextVariants.map((v) => v.options)) === JSON.stringify(currentVariants.map((v) => v.options));
|
|
201
|
+
if (!sameOptions) {
|
|
202
|
+
form.setValue("variants", nextVariants);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var subscribeVariantsToAttributes = (form) => {
|
|
206
|
+
syncVariantsWithAttributes(form);
|
|
207
|
+
return form.subscribe({
|
|
208
|
+
name: "attributes",
|
|
209
|
+
formState: { values: true },
|
|
210
|
+
callback: () => syncVariantsWithAttributes(form)
|
|
211
|
+
});
|
|
212
|
+
};
|
|
194
213
|
|
|
195
214
|
// src/pages/products/product-create/constants.ts
|
|
196
215
|
var MediaSchema = z.object({
|
|
@@ -343,7 +362,7 @@ var PRODUCT_CREATE_FORM_DEFAULTS = {
|
|
|
343
362
|
export {
|
|
344
363
|
normalizeProductFormValues,
|
|
345
364
|
decorateVariantsWithDefaultValues,
|
|
346
|
-
|
|
365
|
+
subscribeVariantsToAttributes,
|
|
347
366
|
MediaSchema,
|
|
348
367
|
ProductCreateSchema,
|
|
349
368
|
EditProductMediaSchema,
|