@mercurjs/vendor 2.2.0-canary.11 → 2.2.0-canary.13
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]-EKLRGVBA.js → [id]-ET35KT2M.js} +3 -3
- package/dist/{[id]-A55T2ORL.js → [id]-FALIOGXK.js} +3 -4
- package/dist/{[id]-GC3ZYPK4.js → [id]-GY5R652O.js} +5 -6
- package/dist/{[id]-GBT6VB4S.js → [id]-IGQTT3AM.js} +4 -5
- package/dist/{[id]-SHAJTJNZ.js → [id]-IW2AZE77.js} +5 -6
- package/dist/{[id]-FE5GYYVZ.js → [id]-OTK2NOXT.js} +3 -4
- package/dist/{[id]-U5KZEQDR.js → [id]-PEUI67SP.js} +2 -2
- package/dist/{[id]-T5ECVBPF.js → [id]-RFEYRBLI.js} +4 -5
- package/dist/{[id]-B4YZTANM.js → [id]-US6IULL2.js} +205 -484
- package/dist/{[id]-QOEO3JOV.js → [id]-YZSVSJWU.js} +3 -4
- package/dist/{[id]-QQU5HVFU.js → [id]-ZMLS73X5.js} +4 -5
- package/dist/{[province_id]-6GUA4PV5.js → [province_id]-J3OB2LZ4.js} +5 -6
- package/dist/{add-NTRYWOJF.js → add-XEUXK63F.js} +6 -7
- package/dist/{add-customer-groups-U5RZWW4B.js → add-customer-groups-HZNWWRVG.js} +3 -4
- package/dist/{add-products-Q4MMDQKT.js → add-products-E5GULF6B.js} +4 -5
- package/dist/{add-promotions-3AYXQXTP.js → add-promotions-KW5YZHLS.js} +3 -3
- package/dist/{address-77Y3AOQ3.js → address-6T4H6P7O.js} +3 -4
- package/dist/{breadcrumb-EVZIOB2G.js → breadcrumb-5HYIEPCL.js} +3 -4
- package/dist/{breadcrumb-TNJSGX4T.js → breadcrumb-HL7NKNX4.js} +3 -4
- package/dist/{breadcrumb-THJ2HPRB.js → breadcrumb-L3MFH4I2.js} +9 -8
- package/dist/{breadcrumb-5NP23D6X.js → breadcrumb-LKLWHB63.js} +4 -5
- package/dist/breadcrumb-ZMACILH3.js +28 -0
- package/dist/chunk-4WCPN4OA.js +315 -0
- package/dist/{chunk-LDZCCWJB.js → chunk-5YCDZ4AU.js} +1 -1
- package/dist/{chunk-OYKUQXJX.js → chunk-A6QH53CS.js} +21 -10
- package/dist/{chunk-GN6KB75Z.js → chunk-AQTEEQWX.js} +1 -1
- package/dist/{chunk-K6LOZ4S3.js → chunk-DEJIBIQZ.js} +1 -1
- package/dist/{chunk-4LVP635F.js → chunk-DNEPOMOX.js} +125 -125
- package/dist/{chunk-25E4KME5.js → chunk-J7ZU2HZZ.js} +1 -1
- package/dist/{chunk-OZ44ATGE.js → chunk-KJWVLGXG.js} +2 -2
- package/dist/{chunk-LKUW5SV4.js → chunk-LDX23XPT.js} +1 -1
- package/dist/{chunk-XP23ZVQT.js → chunk-MVYAN2RR.js} +4 -4
- package/dist/{chunk-TBYCZRZ7.js → chunk-R5QZO3QY.js} +14 -5
- package/dist/{chunk-UORPTGV2.js → chunk-SIEEMXNZ.js} +10 -14
- package/dist/chunk-SJT6A4AV.js +354 -0
- package/dist/{chunk-FWS4YJ4B.js → chunk-STWHJLVV.js} +1 -1
- package/dist/{chunk-TYESCFYW.js → chunk-UDOBGAP7.js} +1 -1
- package/dist/{chunk-6K6EQOJF.js → chunk-VAOJVT7R.js} +1 -1
- package/dist/{chunk-VCOQ7WQ2.js → chunk-VMFC2UDJ.js} +1 -1
- package/dist/chunk-XQUF3WIS.js +159 -0
- package/dist/{chunk-7IPCLQ5V.js → chunk-YPTJETJQ.js} +2 -2
- package/dist/{chunk-X4GWB6AT.js → chunk-ZBSFGCWY.js} +2 -2
- package/dist/{chunk-YGJCJBPM.js → chunk-ZPH3WXJ6.js} +1 -1
- package/dist/{collections-URH2TCWJ.js → collections-HO2F62RN.js} +4 -5
- package/dist/{create-FKRYB7ZS.js → create-7EVR4N6N.js} +1 -1
- package/dist/{create-JF2OUZQA.js → create-DB4EYPJ5.js} +3 -4
- package/dist/{create-JGYG5SBM.js → create-EFMCNOR5.js} +6 -7
- package/dist/{create-MS6KKFSV.js → create-FBPPNBLQ.js} +3 -4
- package/dist/{create-ODOFJF5N.js → create-J5OLH7OJ.js} +7 -8
- package/dist/{create-O35JRZEF.js → create-QAEOARJO.js} +4 -5
- package/dist/{create-HVZYJ3YC.js → create-QZBCYHHQ.js} +8 -9
- package/dist/{create-A7B3MLJX.js → create-SLJ2BMH7.js} +5 -6
- package/dist/{create-7R6CZU53.js → create-WBZJFMA7.js} +12 -3
- package/dist/{create-GGACODDN.js → create-WQ5TM5IZ.js} +1 -1
- package/dist/{edit-4G5D7TES.js → edit-3O6WVIMM.js} +5 -6
- package/dist/{edit-VVLITC2E.js → edit-G57GESSR.js} +1 -1
- package/dist/edit-PUZ23M7V.js +102 -0
- package/dist/{edit-G2E5SNGU.js → edit-PVJ3S4TW.js} +3 -4
- package/dist/{edit-2R5QCPTB.js → edit-RJE7L3PH.js} +3 -4
- package/dist/{edit-HTLLYECP.js → edit-TIRMXOLT.js} +6 -7
- package/dist/{edit-5CROKEJE.js → edit-W6WKYNOG.js} +5 -6
- package/dist/{edit-OKU6FMHJ.js → edit-WPX2ANVI.js} +3 -4
- package/dist/{edit-3E4ZO7HT.js → edit-YW4RBDPH.js} +6 -7
- package/dist/edit-price-5ICQPJ42.js +196 -0
- package/dist/edit-stock-KS2NFC2Z.js +229 -0
- package/dist/{fulfillment-76IVZ266.js → fulfillment-ZV2R43N2.js} +3 -4
- package/dist/{fulfillment-providers-G2L6LEVO.js → fulfillment-providers-KKCL25KA.js} +4 -5
- package/dist/index.css +6 -6
- package/dist/index.js +142 -106
- package/dist/{offer-inventory-batch-page-BD6PMDLW.js → inventory-5UNDKYDL.js} +12 -12
- package/dist/{invite-2673PU4I.js → invite-KKIJNMER.js} +6 -7
- package/dist/{invite-HRXZ5YBP.js → invite-P7I5BGOJ.js} +3 -4
- package/dist/loader-UZTTBKYF.js +33 -0
- package/dist/loader-WEJZTX5Q.js +34 -0
- package/dist/{login-TWUBU6I6.js → login-A65IAXSI.js} +4 -5
- package/dist/{media-Z4N5MKFG.js → media-EM3K4AWO.js} +6 -7
- package/dist/{metadata-Q74OJWUD.js → metadata-A5XZKPL4.js} +4 -5
- package/dist/{metadata-D6M66NQK.js → metadata-JFLFWXOS.js} +3 -4
- package/dist/{metadata-YVHJPDLD.js → metadata-SFO3J5O5.js} +3 -4
- package/dist/{metadata-NIDIBXJT.js → metadata-USXOQUIX.js} +3 -4
- package/dist/{metadata-REQIFWWH.js → metadata-WJ4CNB6I.js} +3 -4
- package/dist/{offer-create-page-E4FLSDJQ.js → offer-create-page-3PIJXHWZ.js} +169 -173
- package/dist/offer-detail-page-SPHP3XKC.js +580 -0
- package/dist/{offer-detail-page-6SIBQTLP.js → offer-variant-detail-page-KTHKV6WW.js} +144 -215
- package/dist/offers-GWMIEPCM.js +54 -0
- package/dist/{onboarding-MK2RIFD4.js → onboarding-JOGRNDPI.js} +3 -4
- package/dist/{orders-TVQDR4OJ.js → orders-Q2IKEJIM.js} +4 -5
- package/dist/{organization-XO3T2K2X.js → organization-HRYDC66D.js} +3 -4
- package/dist/pages/index.js +25 -27
- package/dist/{payment-details-CFTX3QDL.js → payment-details-YLPIR52N.js} +3 -4
- package/dist/{pricing-ECXV6K7G.js → pricing-ECJH4VXZ.js} +5 -6
- package/dist/{offer-pricing-edit-page-4TINK42V.js → pricing-EPNQ63NT.js} +15 -13
- package/dist/{product-tags-5O7ZG6SA.js → product-tags-WMC7G3C4.js} +5 -6
- package/dist/{product-variant-detail-PUWOMVHQ.js → product-variant-detail-BQL2NGVE.js} +3 -4
- package/dist/{product-variant-edit-WZNO4CQX.js → product-variant-edit-GACQHD46.js} +9 -20
- package/dist/{products-CPTRYL2Z.js → products-LGQMESEZ.js} +10 -11
- package/dist/{products-BM3IIH5P.js → products-PQ3FG5KC.js} +4 -5
- package/dist/{professional-details-ED4HNYXY.js → professional-details-AASVGTUO.js} +3 -4
- package/dist/{profile-6TGCNNUU.js → profile-ZNQEDSDM.js} +3 -4
- package/dist/{promotions-4336KI7E.js → promotions-MFAFFHF3.js} +4 -4
- package/dist/{register-OZ5CRANZ.js → register-3A6G6QNI.js} +5 -6
- package/dist/{reset-password-5UHZU4D3.js → reset-password-FV5762CA.js} +1 -1
- package/dist/{settings-2GCQQTO6.js → settings-OKNGWUKL.js} +12 -13
- package/dist/{shipment-HWQHMX2L.js → shipment-ZF7IRKKS.js} +3 -4
- package/dist/shipping-HWJPX34K.js +113 -0
- package/dist/{shipping-profile-ZP7M6VSS.js → shipping-profile-3QKTQI6L.js} +2 -6
- package/dist/{shipping-profiles-C5WBXWZ2.js → shipping-profiles-FZCKGCBU.js} +3 -4
- package/dist/{stock-MQA7PRO6.js → stock-FI5WXVWN.js} +4 -5
- package/dist/{store-5ZHZR4JI.js → store-VFRKJYMD.js} +3 -4
- package/dist/{store-closure-H5WHV3LA.js → store-closure-WZIWGESD.js} +3 -4
- package/dist/{store-select-PZS556FB.js → store-select-GKRDFGEY.js} +4 -5
- package/dist/{team-CLKJCZNH.js → team-CXEAYN7O.js} +3 -4
- package/package.json +1 -1
- package/dist/chunk-27KRIXMQ.js +0 -71
- package/dist/chunk-CFRWIQIZ.js +0 -43
- package/dist/chunk-RXV7INUV.js +0 -426
- package/dist/chunk-T6LHVNWO.js +0 -27
- package/dist/loader-VDYPD3RI.js +0 -31
- package/dist/offer-edit-page-3MO566RP.js +0 -151
- package/dist/offers-GVN5LCK6.js +0 -32
- package/dist/{chunk-SPOHNK4X.js → chunk-BPVMJN2D.js} +3 -3
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OFFERS_PAGE_SIZE,
|
|
3
|
+
OFFER_PRODUCT_LIST_FIELDS
|
|
4
|
+
} from "./chunk-XQUF3WIS.js";
|
|
5
|
+
import {
|
|
6
|
+
CategoryCell,
|
|
7
|
+
CategoryHeader,
|
|
8
|
+
ProductStatusCell,
|
|
9
|
+
ProductStatusHeader
|
|
10
|
+
} from "./chunk-U5G3AVED.js";
|
|
11
|
+
import {
|
|
12
|
+
ProductCell,
|
|
13
|
+
ProductHeader
|
|
14
|
+
} from "./chunk-FWPGOIFA.js";
|
|
15
|
+
import {
|
|
16
|
+
useProductTableFilters
|
|
17
|
+
} from "./chunk-DEJIBIQZ.js";
|
|
18
|
+
import {
|
|
19
|
+
PlaceholderCell
|
|
20
|
+
} from "./chunk-PHOCVOZ5.js";
|
|
21
|
+
import {
|
|
22
|
+
_DataTable,
|
|
23
|
+
useDataTable
|
|
24
|
+
} from "./chunk-SSUUT5LK.js";
|
|
25
|
+
import {
|
|
26
|
+
SingleColumnPage
|
|
27
|
+
} from "./chunk-YV6MK4PZ.js";
|
|
28
|
+
import {
|
|
29
|
+
useQueryParams
|
|
30
|
+
} from "./chunk-THHRRYRS.js";
|
|
31
|
+
import {
|
|
32
|
+
useBulkDeleteOffers
|
|
33
|
+
} from "./chunk-SIEEMXNZ.js";
|
|
34
|
+
import {
|
|
35
|
+
ActionMenu
|
|
36
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
37
|
+
import {
|
|
38
|
+
useProducts
|
|
39
|
+
} from "./chunk-JAUZ73XE.js";
|
|
40
|
+
|
|
41
|
+
// src/pages/offers/offer-list-page.tsx
|
|
42
|
+
import { Children as Children2 } from "react";
|
|
43
|
+
|
|
44
|
+
// src/pages/offers/_components/offer-list-table.tsx
|
|
45
|
+
import { Container } from "@medusajs/ui";
|
|
46
|
+
import { Children } from "react";
|
|
47
|
+
import { Outlet } from "react-router-dom";
|
|
48
|
+
|
|
49
|
+
// src/pages/offers/_components/offer-list-data-table.tsx
|
|
50
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
51
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
52
|
+
|
|
53
|
+
// src/pages/offers/_components/use-offer-table-columns.tsx
|
|
54
|
+
import { Text } from "@medusajs/ui";
|
|
55
|
+
import { createColumnHelper } from "@tanstack/react-table";
|
|
56
|
+
import { useMemo } from "react";
|
|
57
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
58
|
+
|
|
59
|
+
// src/pages/offers/_components/offer-actions.tsx
|
|
60
|
+
import { Buildings, CurrencyDollar, Trash } from "@medusajs/icons";
|
|
61
|
+
import { toast, usePrompt } from "@medusajs/ui";
|
|
62
|
+
import { useTranslation } from "react-i18next";
|
|
63
|
+
import { jsx } from "react/jsx-runtime";
|
|
64
|
+
var OfferActions = ({ product }) => {
|
|
65
|
+
const { t } = useTranslation();
|
|
66
|
+
const prompt = usePrompt();
|
|
67
|
+
const { mutateAsync: bulkDelete } = useBulkDeleteOffers();
|
|
68
|
+
const handleDelete = async () => {
|
|
69
|
+
if (!product.offerIds.length) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const confirmed = await prompt({
|
|
73
|
+
title: t("general.areYouSure"),
|
|
74
|
+
// The product listing is one offer to the seller, regardless of how
|
|
75
|
+
// many of its variants are offered under the hood.
|
|
76
|
+
description: t("offers.bulkDelete.description", { count: 1 }),
|
|
77
|
+
confirmText: t("actions.delete"),
|
|
78
|
+
cancelText: t("actions.cancel"),
|
|
79
|
+
variant: "danger"
|
|
80
|
+
});
|
|
81
|
+
if (!confirmed) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const result = await bulkDelete(product.offerIds);
|
|
85
|
+
if (result.failed.length === 0) {
|
|
86
|
+
toast.success(t("offers.bulkDelete.successToast", { count: 1 }));
|
|
87
|
+
} else {
|
|
88
|
+
toast.warning(
|
|
89
|
+
t("offers.bulkDelete.partialToast", {
|
|
90
|
+
succeeded: result.succeeded.length,
|
|
91
|
+
total: product.offerIds.length,
|
|
92
|
+
failed: result.failed.length
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
ActionMenu,
|
|
99
|
+
{
|
|
100
|
+
groups: [
|
|
101
|
+
{
|
|
102
|
+
actions: [
|
|
103
|
+
{
|
|
104
|
+
icon: /* @__PURE__ */ jsx(CurrencyDollar, {}),
|
|
105
|
+
label: t("offers.actions.edit_prices"),
|
|
106
|
+
to: `${product.id}/edit-price`
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
icon: /* @__PURE__ */ jsx(Buildings, {}),
|
|
110
|
+
label: t("offers.actions.edit_stock_levels"),
|
|
111
|
+
to: `${product.id}/edit-stock`
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
actions: [
|
|
117
|
+
{
|
|
118
|
+
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
119
|
+
label: t("actions.delete"),
|
|
120
|
+
onClick: handleDelete,
|
|
121
|
+
disabled: product.offerIds.length === 0
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/pages/offers/_components/use-offer-table-columns.tsx
|
|
131
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
132
|
+
var columnHelper = createColumnHelper();
|
|
133
|
+
var countOfferedVariants = (row) => (row.variants ?? []).filter((v) => (v.offers?.length ?? 0) > 0).length;
|
|
134
|
+
var collectOfferIds = (row) => (row.variants ?? []).flatMap((v) => (v.offers ?? []).map((o) => o.id));
|
|
135
|
+
var useOfferTableColumns = () => {
|
|
136
|
+
const { t } = useTranslation2();
|
|
137
|
+
return useMemo(
|
|
138
|
+
() => [
|
|
139
|
+
columnHelper.display({
|
|
140
|
+
id: "product",
|
|
141
|
+
header: () => /* @__PURE__ */ jsx2(ProductHeader, {}),
|
|
142
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(
|
|
143
|
+
ProductCell,
|
|
144
|
+
{
|
|
145
|
+
product: {
|
|
146
|
+
title: row.original.title ?? "",
|
|
147
|
+
thumbnail: row.original.thumbnail ?? null
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}),
|
|
152
|
+
columnHelper.display({
|
|
153
|
+
id: "categories",
|
|
154
|
+
header: () => /* @__PURE__ */ jsx2(CategoryHeader, {}),
|
|
155
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(CategoryCell, { categories: row.original.categories })
|
|
156
|
+
}),
|
|
157
|
+
columnHelper.display({
|
|
158
|
+
id: "collection",
|
|
159
|
+
header: t("fields.collection"),
|
|
160
|
+
cell: ({ row }) => {
|
|
161
|
+
const collection = row.original.collection;
|
|
162
|
+
if (!collection?.title) return /* @__PURE__ */ jsx2(PlaceholderCell, {});
|
|
163
|
+
return /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "truncate", children: collection.title });
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
columnHelper.display({
|
|
167
|
+
id: "variants",
|
|
168
|
+
header: t("offers.fields.variants"),
|
|
169
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(Text, { size: "small", leading: "compact", className: "truncate", children: t("offers.fields.variantsCount", {
|
|
170
|
+
count: countOfferedVariants(row.original)
|
|
171
|
+
}) })
|
|
172
|
+
}),
|
|
173
|
+
columnHelper.display({
|
|
174
|
+
id: "status",
|
|
175
|
+
header: () => /* @__PURE__ */ jsx2(ProductStatusHeader, {}),
|
|
176
|
+
cell: ({ row }) => {
|
|
177
|
+
const status = row.original.status;
|
|
178
|
+
if (!status) return /* @__PURE__ */ jsx2(PlaceholderCell, {});
|
|
179
|
+
return /* @__PURE__ */ jsx2(ProductStatusCell, { status });
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
182
|
+
columnHelper.display({
|
|
183
|
+
id: "actions",
|
|
184
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(
|
|
185
|
+
OfferActions,
|
|
186
|
+
{
|
|
187
|
+
product: {
|
|
188
|
+
id: row.original.id,
|
|
189
|
+
title: row.original.title ?? "",
|
|
190
|
+
offerIds: collectOfferIds(row.original)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
})
|
|
195
|
+
],
|
|
196
|
+
[t]
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// src/pages/offers/_components/use-offer-table-filters.tsx
|
|
201
|
+
var useOfferTableFilters = () => useProductTableFilters();
|
|
202
|
+
|
|
203
|
+
// src/pages/offers/_components/use-offer-table-query.tsx
|
|
204
|
+
var useOfferTableQuery = ({
|
|
205
|
+
pageSize = 10,
|
|
206
|
+
prefix
|
|
207
|
+
}) => {
|
|
208
|
+
const raw = useQueryParams(
|
|
209
|
+
[
|
|
210
|
+
"q",
|
|
211
|
+
"order",
|
|
212
|
+
"offset",
|
|
213
|
+
"created_at",
|
|
214
|
+
"updated_at",
|
|
215
|
+
"category_id",
|
|
216
|
+
"collection_id",
|
|
217
|
+
"type_id",
|
|
218
|
+
"tag_id",
|
|
219
|
+
"status",
|
|
220
|
+
"id"
|
|
221
|
+
],
|
|
222
|
+
prefix
|
|
223
|
+
);
|
|
224
|
+
const {
|
|
225
|
+
offset,
|
|
226
|
+
created_at,
|
|
227
|
+
updated_at,
|
|
228
|
+
category_id,
|
|
229
|
+
collection_id,
|
|
230
|
+
type_id,
|
|
231
|
+
tag_id,
|
|
232
|
+
status,
|
|
233
|
+
order,
|
|
234
|
+
q
|
|
235
|
+
} = raw;
|
|
236
|
+
const searchParams = {
|
|
237
|
+
limit: pageSize,
|
|
238
|
+
offset: offset ? Number(offset) : 0,
|
|
239
|
+
order: order || "title",
|
|
240
|
+
q,
|
|
241
|
+
category_id: category_id ? category_id.split(",") : void 0,
|
|
242
|
+
collection_id: collection_id ? collection_id.split(",") : void 0,
|
|
243
|
+
type_id: type_id ? type_id.split(",") : void 0,
|
|
244
|
+
tag_id: tag_id ? tag_id.split(",") : void 0,
|
|
245
|
+
status: status ? status.split(",") : void 0,
|
|
246
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
247
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
248
|
+
has_offer: "true",
|
|
249
|
+
fields: OFFER_PRODUCT_LIST_FIELDS
|
|
250
|
+
};
|
|
251
|
+
return {
|
|
252
|
+
searchParams,
|
|
253
|
+
raw
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// src/pages/offers/_components/offer-list-data-table.tsx
|
|
258
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
259
|
+
var OfferListDataTable = () => {
|
|
260
|
+
const { t } = useTranslation3();
|
|
261
|
+
const { raw, searchParams } = useOfferTableQuery({
|
|
262
|
+
pageSize: OFFERS_PAGE_SIZE
|
|
263
|
+
});
|
|
264
|
+
const { products, count, isLoading, isError, error } = useProducts(
|
|
265
|
+
searchParams,
|
|
266
|
+
{ placeholderData: keepPreviousData }
|
|
267
|
+
);
|
|
268
|
+
const rows = products ?? [];
|
|
269
|
+
const filters = useOfferTableFilters();
|
|
270
|
+
const columns = useOfferTableColumns();
|
|
271
|
+
const { table } = useDataTable({
|
|
272
|
+
data: rows,
|
|
273
|
+
columns,
|
|
274
|
+
count,
|
|
275
|
+
enablePagination: true,
|
|
276
|
+
getRowId: (row) => row.id,
|
|
277
|
+
pageSize: OFFERS_PAGE_SIZE
|
|
278
|
+
});
|
|
279
|
+
if (isError) {
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
282
|
+
return /* @__PURE__ */ jsx3(
|
|
283
|
+
_DataTable,
|
|
284
|
+
{
|
|
285
|
+
table,
|
|
286
|
+
columns,
|
|
287
|
+
pageSize: OFFERS_PAGE_SIZE,
|
|
288
|
+
count,
|
|
289
|
+
isLoading,
|
|
290
|
+
pagination: true,
|
|
291
|
+
search: true,
|
|
292
|
+
filters,
|
|
293
|
+
queryObject: raw,
|
|
294
|
+
orderBy: [
|
|
295
|
+
{ key: "title", label: t("fields.title") },
|
|
296
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
297
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
298
|
+
],
|
|
299
|
+
defaultOrderBy: "title",
|
|
300
|
+
navigateTo: (row) => `${row.original.id}`,
|
|
301
|
+
noRecords: {
|
|
302
|
+
title: t("offers.empty.heading"),
|
|
303
|
+
message: t("offers.empty.description"),
|
|
304
|
+
action: {
|
|
305
|
+
to: "create",
|
|
306
|
+
label: t("offers.actions.create")
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/pages/offers/_components/offer-list-header.tsx
|
|
314
|
+
import { Button, Heading } from "@medusajs/ui";
|
|
315
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
316
|
+
import { Link } from "react-router-dom";
|
|
317
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
318
|
+
var OfferListTitle = () => {
|
|
319
|
+
const { t } = useTranslation4();
|
|
320
|
+
return /* @__PURE__ */ jsx4(Heading, { children: t("offers.domain") });
|
|
321
|
+
};
|
|
322
|
+
var OfferListActions = () => {
|
|
323
|
+
const { t } = useTranslation4();
|
|
324
|
+
return /* @__PURE__ */ jsx4(Button, { size: "small", variant: "primary", asChild: true, children: /* @__PURE__ */ jsx4(Link, { to: "create", "data-testid": "offer-list-create-button", children: t("offers.actions.create") }) });
|
|
325
|
+
};
|
|
326
|
+
var OfferListHeader = () => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
327
|
+
/* @__PURE__ */ jsx4(OfferListTitle, {}),
|
|
328
|
+
/* @__PURE__ */ jsx4(OfferListActions, {})
|
|
329
|
+
] });
|
|
330
|
+
|
|
331
|
+
// src/pages/offers/_components/offer-list-table.tsx
|
|
332
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
333
|
+
var OfferListTable = ({ children }) => /* @__PURE__ */ jsxs2(Container, { className: "divide-y p-0", "data-testid": "offer-list-table", children: [
|
|
334
|
+
Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
335
|
+
/* @__PURE__ */ jsx5(OfferListHeader, {}),
|
|
336
|
+
/* @__PURE__ */ jsx5(OfferListDataTable, {})
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ jsx5(Outlet, {})
|
|
339
|
+
] });
|
|
340
|
+
|
|
341
|
+
// src/pages/offers/offer-list-page.tsx
|
|
342
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
343
|
+
var Root = ({ children }) => /* @__PURE__ */ jsx6(SingleColumnPage, { children: Children2.count(children) > 0 ? children : /* @__PURE__ */ jsx6(OfferListTable, {}) });
|
|
344
|
+
var OfferListPage = Object.assign(Root, {
|
|
345
|
+
Table: OfferListTable,
|
|
346
|
+
Header: OfferListHeader,
|
|
347
|
+
HeaderTitle: OfferListTitle,
|
|
348
|
+
HeaderActions: OfferListActions,
|
|
349
|
+
DataTable: OfferListDataTable
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
export {
|
|
353
|
+
OfferListPage
|
|
354
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// src/pages/offers/common/constants.ts
|
|
2
|
+
var OFFERS_PAGE_SIZE = 10;
|
|
3
|
+
var OFFER_DETAIL_FIELDS = [
|
|
4
|
+
"id",
|
|
5
|
+
"sku",
|
|
6
|
+
"ean",
|
|
7
|
+
"upc",
|
|
8
|
+
"variant_id",
|
|
9
|
+
"seller_id",
|
|
10
|
+
"shipping_profile_id",
|
|
11
|
+
"metadata",
|
|
12
|
+
"created_at",
|
|
13
|
+
"updated_at",
|
|
14
|
+
"deleted_at",
|
|
15
|
+
"product_variant.id",
|
|
16
|
+
"product_variant.title",
|
|
17
|
+
"product_variant.sku",
|
|
18
|
+
"product_variant.product_id",
|
|
19
|
+
"product_variant.product.id",
|
|
20
|
+
"product_variant.product.title",
|
|
21
|
+
"product_variant.product.thumbnail",
|
|
22
|
+
"shipping_profile.id",
|
|
23
|
+
"shipping_profile.name",
|
|
24
|
+
"shipping_profile.type",
|
|
25
|
+
"prices.id",
|
|
26
|
+
"prices.amount",
|
|
27
|
+
"prices.currency_code",
|
|
28
|
+
"prices.min_quantity",
|
|
29
|
+
"prices.max_quantity",
|
|
30
|
+
"prices.rules_count",
|
|
31
|
+
"prices.price_rules.attribute",
|
|
32
|
+
"prices.price_rules.value",
|
|
33
|
+
"inventory_item_link.id",
|
|
34
|
+
"inventory_item_link.required_quantity",
|
|
35
|
+
"inventory_item_link.inventory_item_id",
|
|
36
|
+
"inventory_item_link.inventory_item.id",
|
|
37
|
+
"inventory_item_link.inventory_item.sku",
|
|
38
|
+
"inventory_item_link.inventory_item.title",
|
|
39
|
+
"inventory_item_link.inventory_item.location_levels.id",
|
|
40
|
+
"inventory_item_link.inventory_item.location_levels.location_id",
|
|
41
|
+
"inventory_item_link.inventory_item.location_levels.stocked_quantity",
|
|
42
|
+
"inventory_item_link.inventory_item.location_levels.reserved_quantity",
|
|
43
|
+
"inventory_item_link.inventory_item.location_levels.incoming_quantity",
|
|
44
|
+
"inventory_item_link.inventory_item.location_levels.available_quantity"
|
|
45
|
+
].join(",");
|
|
46
|
+
var OFFER_VARIANT_DETAIL_FIELDS = [
|
|
47
|
+
"id",
|
|
48
|
+
"sku",
|
|
49
|
+
"ean",
|
|
50
|
+
"upc",
|
|
51
|
+
"variant_id",
|
|
52
|
+
"seller_id",
|
|
53
|
+
"shipping_profile_id",
|
|
54
|
+
"metadata",
|
|
55
|
+
"created_at",
|
|
56
|
+
"updated_at",
|
|
57
|
+
"product_variant.id",
|
|
58
|
+
"product_variant.title",
|
|
59
|
+
"product_variant.sku",
|
|
60
|
+
"product_variant.product_id",
|
|
61
|
+
"product_variant.product.id",
|
|
62
|
+
"product_variant.product.title",
|
|
63
|
+
"product_variant.product.thumbnail",
|
|
64
|
+
"product_variant.options.id",
|
|
65
|
+
"product_variant.options.value",
|
|
66
|
+
"product_variant.options.option.id",
|
|
67
|
+
"product_variant.options.option.title",
|
|
68
|
+
"shipping_profile.id",
|
|
69
|
+
"shipping_profile.name",
|
|
70
|
+
"shipping_profile.type",
|
|
71
|
+
"prices.id",
|
|
72
|
+
"prices.amount",
|
|
73
|
+
"prices.currency_code",
|
|
74
|
+
"prices.min_quantity",
|
|
75
|
+
"prices.max_quantity",
|
|
76
|
+
"prices.rules_count",
|
|
77
|
+
"prices.price_rules.attribute",
|
|
78
|
+
"prices.price_rules.value",
|
|
79
|
+
"inventory_item_link.id",
|
|
80
|
+
"inventory_item_link.required_quantity",
|
|
81
|
+
"inventory_item_link.inventory_item_id",
|
|
82
|
+
"inventory_item_link.inventory_item.id",
|
|
83
|
+
"inventory_item_link.inventory_item.sku",
|
|
84
|
+
"inventory_item_link.inventory_item.title",
|
|
85
|
+
"inventory_item_link.inventory_item.location_levels.id",
|
|
86
|
+
"inventory_item_link.inventory_item.location_levels.location_id",
|
|
87
|
+
"inventory_item_link.inventory_item.location_levels.stocked_quantity",
|
|
88
|
+
"inventory_item_link.inventory_item.location_levels.available_quantity"
|
|
89
|
+
].join(",");
|
|
90
|
+
var OFFER_LIST_FIELDS = [
|
|
91
|
+
"id",
|
|
92
|
+
"sku",
|
|
93
|
+
"variant_id",
|
|
94
|
+
"seller_id",
|
|
95
|
+
"created_at",
|
|
96
|
+
"updated_at",
|
|
97
|
+
"deleted_at",
|
|
98
|
+
"product_variant.id",
|
|
99
|
+
"product_variant.title",
|
|
100
|
+
"product_variant.product_id",
|
|
101
|
+
"product_variant.product.id",
|
|
102
|
+
"product_variant.product.title",
|
|
103
|
+
"product_variant.product.status",
|
|
104
|
+
"product_variant.product.thumbnail",
|
|
105
|
+
"product_variant.product.categories.id",
|
|
106
|
+
"product_variant.product.categories.name",
|
|
107
|
+
"shipping_profile.id",
|
|
108
|
+
"shipping_profile.name"
|
|
109
|
+
].join(",");
|
|
110
|
+
var OFFER_PRODUCT_LIST_FIELDS = [
|
|
111
|
+
"id",
|
|
112
|
+
"title",
|
|
113
|
+
"handle",
|
|
114
|
+
"status",
|
|
115
|
+
"thumbnail",
|
|
116
|
+
"created_at",
|
|
117
|
+
"updated_at",
|
|
118
|
+
"*collection",
|
|
119
|
+
"categories.id",
|
|
120
|
+
"categories.name",
|
|
121
|
+
"variants.id",
|
|
122
|
+
"variants.offers.id"
|
|
123
|
+
].join(",");
|
|
124
|
+
var OFFER_PRODUCT_DETAIL_FIELDS = [
|
|
125
|
+
"id",
|
|
126
|
+
"title",
|
|
127
|
+
"subtitle",
|
|
128
|
+
"description",
|
|
129
|
+
"handle",
|
|
130
|
+
"discountable",
|
|
131
|
+
"status",
|
|
132
|
+
"thumbnail",
|
|
133
|
+
"*collection",
|
|
134
|
+
"*images",
|
|
135
|
+
"variants.id",
|
|
136
|
+
"variants.title",
|
|
137
|
+
"variants.sku",
|
|
138
|
+
"variants.options.id",
|
|
139
|
+
"variants.options.value",
|
|
140
|
+
"variants.options.option.id",
|
|
141
|
+
"variants.options.option.title",
|
|
142
|
+
"variants.offers.id",
|
|
143
|
+
"variants.offers.sku",
|
|
144
|
+
"variants.offers.created_at",
|
|
145
|
+
"variants.offers.updated_at",
|
|
146
|
+
"variants.offers.prices.amount",
|
|
147
|
+
"variants.offers.prices.currency_code",
|
|
148
|
+
"variants.offers.shipping_profile.id",
|
|
149
|
+
"variants.offers.shipping_profile.name",
|
|
150
|
+
"variants.offers.inventory_items.id",
|
|
151
|
+
"variants.offers.inventory_items.required_quantity"
|
|
152
|
+
].join(",");
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
OFFERS_PAGE_SIZE,
|
|
156
|
+
OFFER_VARIANT_DETAIL_FIELDS,
|
|
157
|
+
OFFER_PRODUCT_LIST_FIELDS,
|
|
158
|
+
OFFER_PRODUCT_DETAIL_FIELDS
|
|
159
|
+
};
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
DataGrid,
|
|
6
6
|
createDataGridHelper,
|
|
7
7
|
createDataGridPriceColumns
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DNEPOMOX.js";
|
|
9
9
|
import {
|
|
10
10
|
Thumbnail
|
|
11
11
|
} from "./chunk-WIYFXWRI.js";
|
|
12
12
|
import {
|
|
13
13
|
useRegions
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-R5QZO3QY.js";
|
|
15
15
|
import {
|
|
16
16
|
usePricePreferences
|
|
17
17
|
} from "./chunk-4S6XGIC6.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PriceListUpdateProductsSchema,
|
|
3
3
|
usePriceListGridColumns
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YPTJETJQ.js";
|
|
5
5
|
import {
|
|
6
6
|
isProductRow
|
|
7
7
|
} from "./chunk-XRNDVICA.js";
|
|
8
8
|
import {
|
|
9
9
|
DataGrid
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DNEPOMOX.js";
|
|
11
11
|
import {
|
|
12
12
|
castNumber
|
|
13
13
|
} from "./chunk-SMQT3ZNO.js";
|
|
@@ -22,7 +22,7 @@ import "./chunk-X22KTLZ7.js";
|
|
|
22
22
|
import "./chunk-UAE6XBYL.js";
|
|
23
23
|
import "./chunk-MJCL3WID.js";
|
|
24
24
|
import "./chunk-FQERBIVS.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-DEJIBIQZ.js";
|
|
26
26
|
import "./chunk-PHOCVOZ5.js";
|
|
27
27
|
import "./chunk-SSUUT5LK.js";
|
|
28
28
|
import "./chunk-YN3FGNJM.js";
|
|
@@ -33,7 +33,7 @@ import "./chunk-THHRRYRS.js";
|
|
|
33
33
|
import "./chunk-LRD242C7.js";
|
|
34
34
|
import "./chunk-UCYSCKZV.js";
|
|
35
35
|
import "./chunk-INNFZYX2.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-R5QZO3QY.js";
|
|
37
37
|
import "./chunk-F4OJN2F2.js";
|
|
38
38
|
import "./chunk-LRARA622.js";
|
|
39
39
|
import "./chunk-M6N4ISXL.js";
|
|
@@ -41,10 +41,9 @@ import "./chunk-S7EKBD2C.js";
|
|
|
41
41
|
import "./chunk-VV6IKGCN.js";
|
|
42
42
|
import "./chunk-BXRNZS5K.js";
|
|
43
43
|
import "./chunk-BOZJOOGW.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-IQWK723D.js";
|
|
45
45
|
import "./chunk-4S6XGIC6.js";
|
|
46
46
|
import "./chunk-S23FD6FA.js";
|
|
47
|
-
import "./chunk-IQWK723D.js";
|
|
48
47
|
import "./chunk-DDJQRV6E.js";
|
|
49
48
|
import "./chunk-LWJF63JW.js";
|
|
50
49
|
import "./chunk-VXWN37PT.js";
|
|
@@ -52,7 +51,7 @@ import "./chunk-5QI3NDJG.js";
|
|
|
52
51
|
import "./chunk-VZUA5SRD.js";
|
|
53
52
|
import "./chunk-VXMOPVRH.js";
|
|
54
53
|
import "./chunk-NBPMNUKZ.js";
|
|
55
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-SIEEMXNZ.js";
|
|
56
55
|
import "./chunk-Y2MQ5EMD.js";
|
|
57
56
|
import "./chunk-3B34B2M2.js";
|
|
58
57
|
import "./chunk-LAVHRER2.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
Form
|
|
19
19
|
} from "./chunk-3QSRE5LS.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-R5QZO3QY.js";
|
|
21
21
|
import "./chunk-F4OJN2F2.js";
|
|
22
22
|
import "./chunk-LRARA622.js";
|
|
23
23
|
import {
|
|
@@ -27,10 +27,9 @@ import "./chunk-S7EKBD2C.js";
|
|
|
27
27
|
import "./chunk-VV6IKGCN.js";
|
|
28
28
|
import "./chunk-BXRNZS5K.js";
|
|
29
29
|
import "./chunk-BOZJOOGW.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-IQWK723D.js";
|
|
31
31
|
import "./chunk-4S6XGIC6.js";
|
|
32
32
|
import "./chunk-S23FD6FA.js";
|
|
33
|
-
import "./chunk-IQWK723D.js";
|
|
34
33
|
import "./chunk-DDJQRV6E.js";
|
|
35
34
|
import "./chunk-LWJF63JW.js";
|
|
36
35
|
import "./chunk-VXWN37PT.js";
|
|
@@ -38,7 +37,7 @@ import "./chunk-5QI3NDJG.js";
|
|
|
38
37
|
import "./chunk-VZUA5SRD.js";
|
|
39
38
|
import "./chunk-VXMOPVRH.js";
|
|
40
39
|
import "./chunk-NBPMNUKZ.js";
|
|
41
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-SIEEMXNZ.js";
|
|
42
41
|
import "./chunk-Y2MQ5EMD.js";
|
|
43
42
|
import "./chunk-3B34B2M2.js";
|
|
44
43
|
import "./chunk-JAUZ73XE.js";
|