@mercurjs/vendor 2.2.0-canary.20 → 2.2.0-canary.21
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]-26KNXVZ3.js → [id]-3JICOSAI.js} +111 -20
- package/dist/{[id]-7MPUE2JE.js → [id]-CR76L5TG.js} +4 -13
- package/dist/{[id]-45QR6M3C.js → [id]-E7DYRMMO.js} +141 -51
- package/dist/{[id]-W4ARB473.js → [id]-PD3ISUL5.js} +3 -3
- package/dist/{[id]-ZB25Z6NK.js → [id]-XUKQKCDN.js} +2 -2
- package/dist/{[id]-E76GYCHF.js → [id]-ZEFQ7FQQ.js} +2 -1
- package/dist/{add-TFZ5CKSA.js → add-GYXNRUAE.js} +2 -1
- package/dist/{add-promotions-3KKONG7D.js → add-promotions-EQ5MMQKG.js} +3 -3
- package/dist/{allocate-items-UOSOCC6N.js → allocate-items-URVRAFPS.js} +36 -5
- package/dist/{categories-VYVQ5G3H.js → categories-3P2DRH5V.js} +4 -2
- package/dist/{chunk-YXJYCCIU.js → chunk-3L2DVCOC.js} +1 -1
- package/dist/chunk-42R54Z2X.js +8 -0
- package/dist/{chunk-AJREJFHL.js → chunk-4EQIJMQT.js} +1 -1
- package/dist/{chunk-6XO5XJJX.js → chunk-4RFPRO2W.js} +1 -1
- package/dist/{chunk-GMIN5OB5.js → chunk-AKKIZD2P.js} +30 -32
- package/dist/chunk-EEBJYXWA.js +15 -0
- package/dist/{chunk-4XSO2NKC.js → chunk-HZCSJLGH.js} +1 -1
- package/dist/{chunk-JQV7CXEC.js → chunk-II3ACSV2.js} +17 -2
- package/dist/{chunk-GLOEJSV4.js → chunk-LRMWYKSF.js} +1 -1
- package/dist/chunk-LYYM7H7H.js +59 -0
- package/dist/{chunk-VKMNSMCS.js → chunk-N6MGVXXQ.js} +1 -1
- package/dist/{chunk-VDH3AG7D.js → chunk-R4JLYNUA.js} +2 -2
- package/dist/{chunk-M2JP43HN.js → chunk-RT3G3GEK.js} +1 -1
- package/dist/{chunk-WBFAUHKO.js → chunk-ZZIJSTXN.js} +44 -9
- package/dist/{collections-A5GNFU6H.js → collections-7M7O23NO.js} +4 -2
- package/dist/{create-KV4S6DA2.js → create-NR7ULWQS.js} +3 -2
- package/dist/{create-HU3EIJO6.js → create-SJSLOXOW.js} +4 -4
- package/dist/{edit-VPU333HQ.js → edit-3EN2H52W.js} +3 -2
- package/dist/{edit-HOIS3BEW.js → edit-6K3NSVI7.js} +1 -1
- package/dist/{edit-RXDAL7SX.js → edit-YTS77SJS.js} +2 -2
- package/dist/{fulfillment-6I3ERWZW.js → fulfillment-VEF6HG6D.js} +9 -22
- package/dist/index.js +37 -37
- package/dist/{media-Q3AN34MZ.js → media-KIIJ6WSZ.js} +3 -3
- package/dist/{offer-create-page-ZRPBFHZO.js → offer-create-page-DV4JCIL2.js} +4 -6
- package/dist/{offer-variant-detail-page-LYG62KTY.js → offer-variant-detail-page-ORH56HZI.js} +1 -1
- package/dist/pages/index.js +12 -11
- package/dist/{product-tags-RNK4N72O.js → product-tags-MW2JMRFY.js} +2 -1
- package/dist/{products-P5DGEYTS.js → products-TZS2OPK3.js} +4 -4
- package/dist/{promotions-SY4DKTT5.js → promotions-JYO23G6N.js} +4 -4
- package/dist/{register-JZK5LFZU.js → register-SR2SYX4Q.js} +1 -1
- package/dist/{reset-password-HGLJ75PJ.js → reset-password-N22YRMR3.js} +1 -1
- package/dist/{return-reasons-2TMOZGMV.js → return-reasons-POR5YPTF.js} +2 -1
- package/dist/{settings-QEARGBMK.js → settings-MHBYIZ2I.js} +2 -1
- package/dist/{shipping-UBQAPPM4.js → shipping-W4SPR3JO.js} +19 -10
- package/package.json +1 -1
- package/dist/chunk-BDZOSMAX.js +0 -23
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCollectionGallery,
|
|
3
|
+
getCollectionIcon
|
|
4
|
+
} from "./chunk-42R54Z2X.js";
|
|
1
5
|
import {
|
|
2
6
|
useProductTableColumns
|
|
3
7
|
} from "./chunk-QJI4OET7.js";
|
|
@@ -108,26 +112,109 @@ var CollectionGeneralSection = ({
|
|
|
108
112
|
] });
|
|
109
113
|
};
|
|
110
114
|
|
|
115
|
+
// src/pages/collections/[id]/_components/collection-icon-section/collection-icon-section.tsx
|
|
116
|
+
import { Container as Container2, Heading as Heading2, Text as Text2 } from "@medusajs/ui";
|
|
117
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
118
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
119
|
+
var CollectionIconSection = ({
|
|
120
|
+
collection
|
|
121
|
+
}) => {
|
|
122
|
+
const { t } = useTranslation2();
|
|
123
|
+
const icon = getCollectionIcon(collection.images);
|
|
124
|
+
return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", "data-testid": "collection-icon-section", children: [
|
|
125
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx2(Heading2, { children: t("collections.icon.label") }) }),
|
|
126
|
+
/* @__PURE__ */ jsx2("div", { className: "px-6 py-4", children: icon ? /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base shadow-elevation-card-rest relative aspect-square w-24 overflow-hidden rounded-[8px]", children: /* @__PURE__ */ jsx2(
|
|
127
|
+
"img",
|
|
128
|
+
{
|
|
129
|
+
src: icon.url,
|
|
130
|
+
alt: "",
|
|
131
|
+
className: "size-full object-contain object-center p-2",
|
|
132
|
+
"data-testid": "collection-icon-section-image"
|
|
133
|
+
}
|
|
134
|
+
) }) : /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center gap-y-1 py-8", children: [
|
|
135
|
+
/* @__PURE__ */ jsx2(
|
|
136
|
+
Text2,
|
|
137
|
+
{
|
|
138
|
+
size: "small",
|
|
139
|
+
leading: "compact",
|
|
140
|
+
weight: "plus",
|
|
141
|
+
className: "text-ui-fg-subtle",
|
|
142
|
+
children: t("collections.icon.empty.header")
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ jsx2(Text2, { size: "small", className: "text-ui-fg-muted", children: t("collections.icon.empty.description") })
|
|
146
|
+
] }) })
|
|
147
|
+
] });
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/pages/collections/[id]/_components/collection-media-section/collection-media-section.tsx
|
|
151
|
+
import { FeaturedBadge, ThumbnailBadge } from "@medusajs/icons";
|
|
152
|
+
import { Container as Container3, Heading as Heading3, Text as Text3, Tooltip } from "@medusajs/ui";
|
|
153
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
154
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
155
|
+
var CollectionMediaSection = ({
|
|
156
|
+
collection
|
|
157
|
+
}) => {
|
|
158
|
+
const { t } = useTranslation3();
|
|
159
|
+
const gallery = getCollectionGallery(collection.images);
|
|
160
|
+
return /* @__PURE__ */ jsxs3(Container3, { className: "divide-y p-0", "data-testid": "collection-media-section", children: [
|
|
161
|
+
/* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading3, { children: t("collections.media.label") }) }),
|
|
162
|
+
/* @__PURE__ */ jsx3("div", { className: "px-6 py-4", children: gallery.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4", children: gallery.map((image) => /* @__PURE__ */ jsxs3(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: "shadow-elevation-card-rest relative aspect-square size-full overflow-hidden rounded-[8px]",
|
|
166
|
+
"data-testid": `collection-media-section-item-${image.id}`,
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx3(
|
|
169
|
+
"img",
|
|
170
|
+
{
|
|
171
|
+
src: image.url,
|
|
172
|
+
alt: "",
|
|
173
|
+
className: "size-full object-cover object-center"
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
(image.is_thumbnail || image.is_banner) && /* @__PURE__ */ jsxs3("div", { className: "absolute left-2 top-2 flex items-center gap-x-1", children: [
|
|
177
|
+
image.is_thumbnail && /* @__PURE__ */ jsx3(Tooltip, { content: t("collections.media.thumbnail"), children: /* @__PURE__ */ jsx3(ThumbnailBadge, {}) }),
|
|
178
|
+
image.is_banner && /* @__PURE__ */ jsx3(Tooltip, { content: t("collections.media.banner"), children: /* @__PURE__ */ jsx3(FeaturedBadge, { className: "text-ui-fg-interactive" }) })
|
|
179
|
+
] })
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
image.id
|
|
183
|
+
)) }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center gap-y-1 py-8", children: [
|
|
184
|
+
/* @__PURE__ */ jsx3(
|
|
185
|
+
Text3,
|
|
186
|
+
{
|
|
187
|
+
size: "small",
|
|
188
|
+
leading: "compact",
|
|
189
|
+
weight: "plus",
|
|
190
|
+
className: "text-ui-fg-subtle",
|
|
191
|
+
children: t("collections.media.empty.header")
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ jsx3(Text3, { size: "small", className: "text-ui-fg-muted", children: t("collections.media.empty.description") })
|
|
195
|
+
] }) })
|
|
196
|
+
] });
|
|
197
|
+
};
|
|
198
|
+
|
|
111
199
|
// src/pages/collections/[id]/_components/collection-product-section/collection-product-section.tsx
|
|
112
200
|
import { PencilSquare, Trash } from "@medusajs/icons";
|
|
113
|
-
import { Checkbox, Container as
|
|
201
|
+
import { Checkbox, Container as Container4, Heading as Heading4, toast, usePrompt } from "@medusajs/ui";
|
|
114
202
|
import { createColumnHelper } from "@tanstack/react-table";
|
|
115
203
|
import { useMemo } from "react";
|
|
116
|
-
import { useTranslation as
|
|
204
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
117
205
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
118
|
-
import { jsx as
|
|
206
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
119
207
|
var PAGE_SIZE = 10;
|
|
120
208
|
var CollectionProductSection = ({
|
|
121
209
|
collection
|
|
122
210
|
}) => {
|
|
123
|
-
const { t } =
|
|
211
|
+
const { t } = useTranslation4();
|
|
124
212
|
const { searchParams, raw } = useProductTableQuery({
|
|
125
213
|
pageSize: PAGE_SIZE
|
|
126
214
|
});
|
|
127
215
|
const { products, count, isLoading, isError, error } = useProducts(
|
|
128
216
|
{
|
|
129
217
|
...searchParams,
|
|
130
|
-
fields: "+thumbnail",
|
|
131
218
|
collection_id: collection.id
|
|
132
219
|
},
|
|
133
220
|
{ placeholderData: keepPreviousData }
|
|
@@ -182,9 +269,9 @@ var CollectionProductSection = ({
|
|
|
182
269
|
if (isError) {
|
|
183
270
|
throw error;
|
|
184
271
|
}
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsxs4(Container4, { className: "divide-y p-0", children: [
|
|
273
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx4(Heading4, { level: "h2", children: t("products.domain") }) }),
|
|
274
|
+
/* @__PURE__ */ jsx4(
|
|
188
275
|
_DataTable,
|
|
189
276
|
{
|
|
190
277
|
table,
|
|
@@ -226,7 +313,7 @@ var ProductActions = ({
|
|
|
226
313
|
product,
|
|
227
314
|
collectionId
|
|
228
315
|
}) => {
|
|
229
|
-
const { t } =
|
|
316
|
+
const { t } = useTranslation4();
|
|
230
317
|
const prompt = usePrompt();
|
|
231
318
|
const { mutateAsync } = useUpdateCollectionProducts(collectionId);
|
|
232
319
|
const handleRemove = async () => {
|
|
@@ -259,14 +346,14 @@ var ProductActions = ({
|
|
|
259
346
|
}
|
|
260
347
|
);
|
|
261
348
|
};
|
|
262
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ jsx4(
|
|
263
350
|
ActionMenu,
|
|
264
351
|
{
|
|
265
352
|
groups: [
|
|
266
353
|
{
|
|
267
354
|
actions: [
|
|
268
355
|
{
|
|
269
|
-
icon: /* @__PURE__ */
|
|
356
|
+
icon: /* @__PURE__ */ jsx4(PencilSquare, {}),
|
|
270
357
|
label: t("actions.edit"),
|
|
271
358
|
to: `/products/${product.id}/edit`
|
|
272
359
|
}
|
|
@@ -275,7 +362,7 @@ var ProductActions = ({
|
|
|
275
362
|
{
|
|
276
363
|
actions: [
|
|
277
364
|
{
|
|
278
|
-
icon: /* @__PURE__ */
|
|
365
|
+
icon: /* @__PURE__ */ jsx4(Trash, {}),
|
|
279
366
|
label: t("actions.remove"),
|
|
280
367
|
onClick: handleRemove
|
|
281
368
|
}
|
|
@@ -293,7 +380,7 @@ var useColumns = () => {
|
|
|
293
380
|
columnHelper.display({
|
|
294
381
|
id: "select",
|
|
295
382
|
header: ({ table }) => {
|
|
296
|
-
return /* @__PURE__ */
|
|
383
|
+
return /* @__PURE__ */ jsx4(
|
|
297
384
|
Checkbox,
|
|
298
385
|
{
|
|
299
386
|
checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
|
|
@@ -302,7 +389,7 @@ var useColumns = () => {
|
|
|
302
389
|
);
|
|
303
390
|
},
|
|
304
391
|
cell: ({ row }) => {
|
|
305
|
-
return /* @__PURE__ */
|
|
392
|
+
return /* @__PURE__ */ jsx4(
|
|
306
393
|
Checkbox,
|
|
307
394
|
{
|
|
308
395
|
checked: row.getIsSelected(),
|
|
@@ -319,7 +406,7 @@ var useColumns = () => {
|
|
|
319
406
|
id: "actions",
|
|
320
407
|
cell: ({ row, table }) => {
|
|
321
408
|
const { collectionId } = table.options.meta;
|
|
322
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ jsx4(
|
|
323
410
|
ProductActions,
|
|
324
411
|
{
|
|
325
412
|
product: row.original,
|
|
@@ -334,7 +421,7 @@ var useColumns = () => {
|
|
|
334
421
|
};
|
|
335
422
|
|
|
336
423
|
// src/pages/collections/[id]/collection-detail-page.tsx
|
|
337
|
-
import { Fragment, jsx as
|
|
424
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
338
425
|
var Root = ({ children }) => {
|
|
339
426
|
const initialData = useLoaderData();
|
|
340
427
|
const { id } = useParams();
|
|
@@ -342,16 +429,20 @@ var Root = ({ children }) => {
|
|
|
342
429
|
initialData
|
|
343
430
|
});
|
|
344
431
|
if (isLoading || !collection) {
|
|
345
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx5(SingleColumnPageSkeleton, { sections: 4 });
|
|
346
433
|
}
|
|
347
434
|
if (isError) throw error;
|
|
348
|
-
return /* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ jsx5(Fragment, { children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs5(SingleColumnPage, { data: collection, children: [
|
|
436
|
+
/* @__PURE__ */ jsx5(CollectionGeneralSection, { collection }),
|
|
437
|
+
/* @__PURE__ */ jsx5(CollectionMediaSection, { collection }),
|
|
438
|
+
/* @__PURE__ */ jsx5(CollectionIconSection, { collection }),
|
|
439
|
+
/* @__PURE__ */ jsx5(CollectionProductSection, { collection })
|
|
351
440
|
] }) });
|
|
352
441
|
};
|
|
353
442
|
var CollectionDetailPage = Object.assign(Root, {
|
|
354
443
|
GeneralSection: CollectionGeneralSection,
|
|
444
|
+
MediaSection: CollectionMediaSection,
|
|
445
|
+
IconSection: CollectionIconSection,
|
|
355
446
|
ProductSection: CollectionProductSection
|
|
356
447
|
});
|
|
357
448
|
export {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getReservationsLimitCount
|
|
3
|
+
} from "./chunk-EEBJYXWA.js";
|
|
1
4
|
import {
|
|
2
5
|
useCancelOrderEdit,
|
|
3
6
|
useConfirmOrderEdit
|
|
@@ -1834,8 +1837,7 @@ var Fulfillment = ({
|
|
|
1834
1837
|
label: t("actions.cancel"),
|
|
1835
1838
|
icon: /* @__PURE__ */ jsx20(XCircle, {}),
|
|
1836
1839
|
onClick: handleCancel,
|
|
1837
|
-
disabled: cancelDisabled
|
|
1838
|
-
disabledTooltip: fulfillment.shipped_at ? t("orders.fulfillment.cancelDisabledTooltip") : void 0
|
|
1840
|
+
disabled: cancelDisabled
|
|
1839
1841
|
}
|
|
1840
1842
|
]
|
|
1841
1843
|
}
|
|
@@ -2252,17 +2254,6 @@ import {
|
|
|
2252
2254
|
toast as toast7
|
|
2253
2255
|
} from "@medusajs/ui";
|
|
2254
2256
|
|
|
2255
|
-
// src/lib/orders.ts
|
|
2256
|
-
function getReservationsLimitCount(order) {
|
|
2257
|
-
if (!order?.items?.length) {
|
|
2258
|
-
return 0;
|
|
2259
|
-
}
|
|
2260
|
-
return order.items.reduce(
|
|
2261
|
-
(acc, item) => acc + (item.variant?.inventory_items?.length || 1),
|
|
2262
|
-
0
|
|
2263
|
-
);
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
2257
|
// src/pages/orders/[id]/_components/order-summary-section/return-info-popover.tsx
|
|
2267
2258
|
import { useState as useState4 } from "react";
|
|
2268
2259
|
import { useTranslation as useTranslation22 } from "react-i18next";
|
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-7AV5EJJ5.js";
|
|
4
4
|
import {
|
|
5
5
|
getCategoryChildren,
|
|
6
|
+
getCategoryGallery,
|
|
7
|
+
getCategoryIcon,
|
|
6
8
|
getCategoryPath
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LYYM7H7H.js";
|
|
8
10
|
import {
|
|
9
11
|
useProductTableColumns
|
|
10
12
|
} from "./chunk-QJI4OET7.js";
|
|
@@ -114,26 +116,110 @@ var CategoryGeneralSection = ({
|
|
|
114
116
|
] });
|
|
115
117
|
};
|
|
116
118
|
|
|
119
|
+
// src/pages/categories/[id]/_components/category-icon-section/category-icon-section.tsx
|
|
120
|
+
import { Container as Container2, Heading as Heading2, Text as Text2 } from "@medusajs/ui";
|
|
121
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
122
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
123
|
+
var CategoryIconSection = ({
|
|
124
|
+
category
|
|
125
|
+
}) => {
|
|
126
|
+
const { t } = useTranslation2();
|
|
127
|
+
const icon = getCategoryIcon(category.images);
|
|
128
|
+
return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", "data-testid": "category-icon-section", children: [
|
|
129
|
+
/* @__PURE__ */ jsx2("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx2(Heading2, { children: t("categories.icon.label") }) }),
|
|
130
|
+
/* @__PURE__ */ jsx2("div", { className: "px-6 py-4", children: icon ? /* @__PURE__ */ jsx2("div", { className: "bg-ui-bg-base shadow-elevation-card-rest relative aspect-square w-24 overflow-hidden rounded-[8px]", children: /* @__PURE__ */ jsx2(
|
|
131
|
+
"img",
|
|
132
|
+
{
|
|
133
|
+
src: icon.url,
|
|
134
|
+
alt: "",
|
|
135
|
+
className: "size-full object-contain object-center p-2",
|
|
136
|
+
"data-testid": "category-icon-section-image"
|
|
137
|
+
}
|
|
138
|
+
) }) : /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center gap-y-1 py-8", children: [
|
|
139
|
+
/* @__PURE__ */ jsx2(
|
|
140
|
+
Text2,
|
|
141
|
+
{
|
|
142
|
+
size: "small",
|
|
143
|
+
leading: "compact",
|
|
144
|
+
weight: "plus",
|
|
145
|
+
className: "text-ui-fg-subtle",
|
|
146
|
+
children: t("categories.icon.empty.header")
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsx2(Text2, { size: "small", className: "text-ui-fg-muted", children: t("categories.icon.empty.description") })
|
|
150
|
+
] }) })
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/pages/categories/[id]/_components/category-media-section/category-media-section.tsx
|
|
155
|
+
import { FeaturedBadge, ThumbnailBadge } from "@medusajs/icons";
|
|
156
|
+
import { Container as Container3, Heading as Heading3, Text as Text3, Tooltip } from "@medusajs/ui";
|
|
157
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
158
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
159
|
+
var CategoryMediaSection = ({
|
|
160
|
+
category
|
|
161
|
+
}) => {
|
|
162
|
+
const { t } = useTranslation3();
|
|
163
|
+
const gallery = getCategoryGallery(category.images);
|
|
164
|
+
return /* @__PURE__ */ jsxs3(Container3, { className: "divide-y p-0", "data-testid": "category-media-section", children: [
|
|
165
|
+
/* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading3, { children: t("categories.media.label") }) }),
|
|
166
|
+
/* @__PURE__ */ jsx3("div", { className: "px-6 py-4", children: gallery.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(96px,1fr))] gap-4", children: gallery.map((image) => /* @__PURE__ */ jsxs3(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
className: "shadow-elevation-card-rest relative aspect-square size-full overflow-hidden rounded-[8px]",
|
|
170
|
+
"data-testid": `category-media-section-item-${image.id}`,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx3(
|
|
173
|
+
"img",
|
|
174
|
+
{
|
|
175
|
+
src: image.url,
|
|
176
|
+
alt: "",
|
|
177
|
+
className: "size-full object-cover object-center"
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
(image.is_thumbnail || image.is_banner) && /* @__PURE__ */ jsxs3("div", { className: "absolute left-2 top-2 flex items-center gap-x-1", children: [
|
|
181
|
+
image.is_thumbnail && /* @__PURE__ */ jsx3(Tooltip, { content: t("categories.media.thumbnail"), children: /* @__PURE__ */ jsx3(ThumbnailBadge, {}) }),
|
|
182
|
+
image.is_banner && /* @__PURE__ */ jsx3(Tooltip, { content: t("categories.media.banner"), children: /* @__PURE__ */ jsx3(FeaturedBadge, { className: "text-ui-fg-interactive" }) })
|
|
183
|
+
] })
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
image.id
|
|
187
|
+
)) }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center gap-y-1 py-8", children: [
|
|
188
|
+
/* @__PURE__ */ jsx3(
|
|
189
|
+
Text3,
|
|
190
|
+
{
|
|
191
|
+
size: "small",
|
|
192
|
+
leading: "compact",
|
|
193
|
+
weight: "plus",
|
|
194
|
+
className: "text-ui-fg-subtle",
|
|
195
|
+
children: t("categories.media.empty.header")
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx3(Text3, { size: "small", className: "text-ui-fg-muted", children: t("categories.media.empty.description") })
|
|
199
|
+
] }) })
|
|
200
|
+
] });
|
|
201
|
+
};
|
|
202
|
+
|
|
117
203
|
// src/pages/categories/[id]/_components/category-organize-section/category-organize-section.tsx
|
|
118
204
|
import { FolderIllustration, TriangleRightMini } from "@medusajs/icons";
|
|
119
|
-
import { Badge, Container as
|
|
205
|
+
import { Badge, Container as Container4, Heading as Heading4, Text as Text4, Tooltip as Tooltip2 } from "@medusajs/ui";
|
|
120
206
|
import { useMemo, useState } from "react";
|
|
121
|
-
import { useTranslation as
|
|
207
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
122
208
|
import { Link } from "react-router-dom";
|
|
123
|
-
import { jsx as
|
|
209
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
124
210
|
var CategoryOrganizeSection = ({
|
|
125
211
|
category
|
|
126
212
|
}) => {
|
|
127
|
-
const { t } =
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
213
|
+
const { t } = useTranslation4();
|
|
214
|
+
return /* @__PURE__ */ jsxs4(Container4, { className: "divide-y p-0", children: [
|
|
215
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx4(Heading4, { level: "h2", children: t("categories.organize.header") }) }),
|
|
216
|
+
/* @__PURE__ */ jsxs4("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start gap-3 px-6 py-4", children: [
|
|
217
|
+
/* @__PURE__ */ jsx4(Text4, { size: "small", leading: "compact", weight: "plus", children: t("categories.fields.path.label") }),
|
|
218
|
+
/* @__PURE__ */ jsx4(PathDisplay, { category })
|
|
133
219
|
] }),
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ jsxs4("div", { className: "text-ui-fg-subtle grid grid-cols-2 items-start gap-3 px-6 py-4", children: [
|
|
221
|
+
/* @__PURE__ */ jsx4(Text4, { size: "small", leading: "compact", weight: "plus", children: t("categories.fields.children.label") }),
|
|
222
|
+
/* @__PURE__ */ jsx4(ChildrenDisplay, { category })
|
|
137
223
|
] })
|
|
138
224
|
] });
|
|
139
225
|
};
|
|
@@ -141,7 +227,7 @@ var PathDisplay = ({
|
|
|
141
227
|
category
|
|
142
228
|
}) => {
|
|
143
229
|
const [expanded, setExpanded] = useState(false);
|
|
144
|
-
const { t } =
|
|
230
|
+
const { t } = useTranslation4();
|
|
145
231
|
const {
|
|
146
232
|
product_category: withParents,
|
|
147
233
|
isLoading
|
|
@@ -150,27 +236,27 @@ var PathDisplay = ({
|
|
|
150
236
|
});
|
|
151
237
|
const chips = useMemo(() => getCategoryPath(withParents), [withParents]);
|
|
152
238
|
if (isLoading || !withParents) {
|
|
153
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-16" });
|
|
154
240
|
}
|
|
155
241
|
if (!chips.length) {
|
|
156
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ jsx4(Text4, { size: "small", leading: "compact", children: "-" });
|
|
157
243
|
}
|
|
158
244
|
if (chips.length > 1 && !expanded) {
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
245
|
+
return /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[20px_1fr] items-start gap-x-2", children: [
|
|
246
|
+
/* @__PURE__ */ jsx4(FolderIllustration, {}),
|
|
247
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center gap-x-0.5 overflow-hidden", children: [
|
|
248
|
+
/* @__PURE__ */ jsx4(Tooltip2, { content: t("categories.fields.path.tooltip"), children: /* @__PURE__ */ jsx4(
|
|
163
249
|
"button",
|
|
164
250
|
{
|
|
165
251
|
className: "outline-none",
|
|
166
252
|
type: "button",
|
|
167
253
|
onClick: () => setExpanded(true),
|
|
168
|
-
children: /* @__PURE__ */
|
|
254
|
+
children: /* @__PURE__ */ jsx4(Text4, { size: "xsmall", leading: "compact", weight: "plus", children: "..." })
|
|
169
255
|
}
|
|
170
256
|
) }),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
|
|
257
|
+
/* @__PURE__ */ jsx4("div", { className: "flex size-[15px] shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx4(TriangleRightMini, {}) }),
|
|
258
|
+
/* @__PURE__ */ jsx4(
|
|
259
|
+
Text4,
|
|
174
260
|
{
|
|
175
261
|
size: "xsmall",
|
|
176
262
|
leading: "compact",
|
|
@@ -183,11 +269,11 @@ var PathDisplay = ({
|
|
|
183
269
|
] });
|
|
184
270
|
}
|
|
185
271
|
if (chips.length > 1 && expanded) {
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
return /* @__PURE__ */
|
|
190
|
-
index === chips.length - 1 ? /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-[20px_1fr] items-start gap-x-2", children: [
|
|
273
|
+
/* @__PURE__ */ jsx4(FolderIllustration, {}),
|
|
274
|
+
/* @__PURE__ */ jsx4("div", { className: "gap- flex flex-wrap items-center gap-x-0.5 gap-y-1", children: chips.map((chip, index) => {
|
|
275
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-0.5", children: [
|
|
276
|
+
index === chips.length - 1 ? /* @__PURE__ */ jsx4(Text4, { size: "xsmall", leading: "compact", weight: "plus", children: chip.name }) : /* @__PURE__ */ jsx4(
|
|
191
277
|
LinkButton,
|
|
192
278
|
{
|
|
193
279
|
to: `/categories/${chip.id}`,
|
|
@@ -195,14 +281,14 @@ var PathDisplay = ({
|
|
|
195
281
|
children: chip.name
|
|
196
282
|
}
|
|
197
283
|
),
|
|
198
|
-
index < chips.length - 1 && /* @__PURE__ */
|
|
284
|
+
index < chips.length - 1 && /* @__PURE__ */ jsx4(TriangleRightMini, {})
|
|
199
285
|
] }, chip.id);
|
|
200
286
|
}) })
|
|
201
287
|
] });
|
|
202
288
|
}
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
index < chips.length - 1 && /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ jsx4("div", { className: "grid grid-cols-1 items-start gap-x-2", children: chips.map((chip, index) => /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-x-0.5", children: [
|
|
290
|
+
/* @__PURE__ */ jsx4(Text4, { size: "xsmall", leading: "compact", weight: "plus", children: chip.name }),
|
|
291
|
+
index < chips.length - 1 && /* @__PURE__ */ jsx4(TriangleRightMini, {})
|
|
206
292
|
] }, chip.id)) });
|
|
207
293
|
};
|
|
208
294
|
var ChildrenDisplay = ({
|
|
@@ -216,25 +302,25 @@ var ChildrenDisplay = ({
|
|
|
216
302
|
});
|
|
217
303
|
const chips = useMemo(() => getCategoryChildren(withChildren), [withChildren]);
|
|
218
304
|
if (isLoading || !withChildren) {
|
|
219
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ jsx4(Skeleton, { className: "h-5 w-16" });
|
|
220
306
|
}
|
|
221
307
|
if (!chips.length) {
|
|
222
|
-
return /* @__PURE__ */
|
|
308
|
+
return /* @__PURE__ */ jsx4(Text4, { size: "small", leading: "compact", children: "-" });
|
|
223
309
|
}
|
|
224
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex w-full flex-wrap gap-1", children: chips.map((chip) => /* @__PURE__ */ jsx4(Badge, { size: "2xsmall", className: "max-w-full", asChild: true, children: /* @__PURE__ */ jsx4(Link, { to: `/categories/${chip.id}`, children: /* @__PURE__ */ jsx4("span", { className: "truncate", children: chip.name }) }) }, chip.id)) });
|
|
225
311
|
};
|
|
226
312
|
|
|
227
313
|
// src/pages/categories/[id]/_components/category-product-section/category-product-section.tsx
|
|
228
|
-
import { Container as
|
|
314
|
+
import { Container as Container5, Heading as Heading5 } from "@medusajs/ui";
|
|
229
315
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
230
316
|
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
231
|
-
import { useTranslation as
|
|
232
|
-
import { jsx as
|
|
317
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
318
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
233
319
|
var PAGE_SIZE = 10;
|
|
234
320
|
var CategoryProductSection = ({
|
|
235
321
|
category
|
|
236
322
|
}) => {
|
|
237
|
-
const { t } =
|
|
323
|
+
const { t } = useTranslation5();
|
|
238
324
|
const [selection, setSelection] = useState2({});
|
|
239
325
|
const { raw, searchParams } = useProductTableQuery({
|
|
240
326
|
pageSize: PAGE_SIZE
|
|
@@ -268,9 +354,9 @@ var CategoryProductSection = ({
|
|
|
268
354
|
updater: setSelection
|
|
269
355
|
}
|
|
270
356
|
});
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
357
|
+
return /* @__PURE__ */ jsxs5(Container5, { className: "divide-y p-0", children: [
|
|
358
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx5(Heading5, { level: "h2", children: t("products.domain") }) }),
|
|
359
|
+
/* @__PURE__ */ jsx5(
|
|
274
360
|
_DataTable,
|
|
275
361
|
{
|
|
276
362
|
table,
|
|
@@ -337,7 +423,7 @@ var useColumns = () => {
|
|
|
337
423
|
};
|
|
338
424
|
|
|
339
425
|
// src/pages/categories/[id]/category-detail-page.tsx
|
|
340
|
-
import { Fragment, jsx as
|
|
426
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
341
427
|
var Root = ({ children }) => {
|
|
342
428
|
const { id } = useParams();
|
|
343
429
|
const {
|
|
@@ -349,10 +435,10 @@ var Root = ({ children }) => {
|
|
|
349
435
|
fields: "+is_active,+is_internal"
|
|
350
436
|
});
|
|
351
437
|
if (categoryLoading || !product_category) {
|
|
352
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ jsx6(
|
|
353
439
|
TwoColumnPageSkeleton,
|
|
354
440
|
{
|
|
355
|
-
mainSections:
|
|
441
|
+
mainSections: 4,
|
|
356
442
|
sidebarSections: 1,
|
|
357
443
|
showJSON: true,
|
|
358
444
|
showMetadata: true
|
|
@@ -362,18 +448,22 @@ var Root = ({ children }) => {
|
|
|
362
448
|
if (categoryError) {
|
|
363
449
|
throw error;
|
|
364
450
|
}
|
|
365
|
-
return /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs6(TwoColumnPage, { data: product_category, children: [
|
|
452
|
+
/* @__PURE__ */ jsxs6(TwoColumnPage.Main, { children: [
|
|
453
|
+
/* @__PURE__ */ jsx6(CategoryGeneralSection, { category: product_category }),
|
|
454
|
+
/* @__PURE__ */ jsx6(CategoryMediaSection, { category: product_category }),
|
|
455
|
+
/* @__PURE__ */ jsx6(CategoryIconSection, { category: product_category }),
|
|
456
|
+
/* @__PURE__ */ jsx6(CategoryProductSection, { category: product_category })
|
|
369
457
|
] }),
|
|
370
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ jsx6(TwoColumnPage.Sidebar, { children: /* @__PURE__ */ jsx6(CategoryOrganizeSection, { category: product_category }) })
|
|
371
459
|
] }) });
|
|
372
460
|
};
|
|
373
461
|
var CategoryDetailPage = Object.assign(Root, {
|
|
374
462
|
Main: TwoColumnPage.Main,
|
|
375
463
|
Sidebar: TwoColumnPage.Sidebar,
|
|
376
464
|
MainGeneralSection: CategoryGeneralSection,
|
|
465
|
+
MainMediaSection: CategoryMediaSection,
|
|
466
|
+
MainIconSection: CategoryIconSection,
|
|
377
467
|
MainProductSection: CategoryProductSection,
|
|
378
468
|
SidebarOrganizeSection: CategoryOrganizeSection
|
|
379
469
|
});
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
usePromotionTableColumns,
|
|
9
9
|
usePromotionTableQuery
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-LRMWYKSF.js";
|
|
11
|
+
import "./chunk-N6MGVXXQ.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-ZZIJSTXN.js";
|
|
31
31
|
import {
|
|
32
32
|
TwoColumnPage
|
|
33
33
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-BWGPN6XV.js";
|
|
7
7
|
import {
|
|
8
8
|
StatusCell
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N6MGVXXQ.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-ZZIJSTXN.js";
|
|
16
16
|
import {
|
|
17
17
|
TwoColumnPage
|
|
18
18
|
} from "./chunk-YV6MK4PZ.js";
|
|
@@ -5,13 +5,14 @@ import "./chunk-N335VHD3.js";
|
|
|
5
5
|
import "./chunk-EBZ5VZEO.js";
|
|
6
6
|
import "./chunk-4F5GP7J7.js";
|
|
7
7
|
import "./chunk-7TIZP4YG.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-II3ACSV2.js";
|
|
9
9
|
import "./chunk-BI2AYXZQ.js";
|
|
10
10
|
import "./chunk-MG4GKUJW.js";
|
|
11
11
|
import "./chunk-AYVH6Q5O.js";
|
|
12
12
|
import "./chunk-VOHEQ7B5.js";
|
|
13
13
|
import "./chunk-DY3XQPHC.js";
|
|
14
14
|
import "./chunk-VKOE5J66.js";
|
|
15
|
+
import "./chunk-42R54Z2X.js";
|
|
15
16
|
import "./chunk-GJM5XI3E.js";
|
|
16
17
|
import "./chunk-PVZBDWLK.js";
|
|
17
18
|
import "./chunk-27WLUOI2.js";
|
|
@@ -12,13 +12,14 @@ import {
|
|
|
12
12
|
} from "./chunk-XRNDVICA.js";
|
|
13
13
|
import "./chunk-6IJMSVC6.js";
|
|
14
14
|
import "./chunk-7TIZP4YG.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-II3ACSV2.js";
|
|
16
16
|
import "./chunk-BI2AYXZQ.js";
|
|
17
17
|
import "./chunk-MG4GKUJW.js";
|
|
18
18
|
import "./chunk-AYVH6Q5O.js";
|
|
19
19
|
import "./chunk-VOHEQ7B5.js";
|
|
20
20
|
import "./chunk-DY3XQPHC.js";
|
|
21
21
|
import "./chunk-VKOE5J66.js";
|
|
22
|
+
import "./chunk-42R54Z2X.js";
|
|
22
23
|
import "./chunk-GJM5XI3E.js";
|
|
23
24
|
import "./chunk-PVZBDWLK.js";
|
|
24
25
|
import "./chunk-27WLUOI2.js";
|