umwd-components 0.1.750 → 0.1.752

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.
@@ -28,7 +28,7 @@ function ProductCard({ product, sx = [] }) {
28
28
  { width: "100%", height: "100%" },
29
29
  { display: "flex", flexDirection: "column" },
30
30
  ...(Array.isArray(sx) ? sx : [sx]),
31
- ], children: [jsx(CardMedia, { component: "img", height: "140", src: `${imgURL}`, alt: image.alternativeText }), jsxs(CardContent, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: { pb: 2 }, children: [jsx(StyledLink, { href: `/shop/${slug}`, target: "_self", children: jsx(Typography, { variant: "h5", children: title }) }), jsx(Price, { price: price.price, vat: price.vat, vat_rate: price.vat_rate, price_incl_vat: price.price_incl_vat })] }), description && (jsx(MarkdownDisplay, { children: description.substring(0, 150) + "..." }))] }), jsx(Box, { sx: { flexGrow: 1 } }), jsxs(CardActions, { sx: {
31
+ ], children: [jsx(CardMedia, { component: "img", height: "140", src: `${imgURL}`, alt: image.alternativeText || "fallback alt text" }), jsxs(CardContent, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", sx: { pb: 2 }, children: [jsx(StyledLink, { href: `/shop/${slug}`, target: "_self", children: jsx(Typography, { variant: "h5", children: title }) }), jsx(Price, { price: price.price, vat: price.vat, vat_rate: price.vat_rate, price_incl_vat: price.price_incl_vat })] }), description && (jsx(MarkdownDisplay, { children: description.substring(0, 150) + "..." }))] }), jsx(Box, { sx: { flexGrow: 1 } }), jsxs(CardActions, { sx: {
32
32
  display: "flex",
33
33
  justifyContent: "flex-end",
34
34
  alignItems: "flex-end",
@@ -29,19 +29,19 @@ function SingleProduct({ product, sx = [] }) {
29
29
  sm: 12,
30
30
  md: 12,
31
31
  lg: 12,
32
- xl: 12
32
+ xl: 12,
33
33
  }, children: jsx(Typography, { variant: "h4", align: "left", component: "h1", children: title }) }), jsx(Grid, { size: {
34
34
  xs: 12,
35
35
  sm: 8,
36
36
  md: 9,
37
37
  lg: 4,
38
- xl: 4
38
+ xl: 4,
39
39
  }, children: jsx(MarkdownDisplay, { children: description }) }), jsx(Grid, { size: {
40
40
  xs: 12,
41
41
  sm: 4,
42
42
  md: 3,
43
43
  lg: 3,
44
- xl: 3
44
+ xl: 3,
45
45
  }, children: price?.price && (jsx(Paper, { sx: { p: 1 }, children: jsxs(Stack, { spacing: 1, children: [jsxs(Typography, { variant: "body2", children: ["Price excl. VAT \u20AC ", price.price.toFixed(2)] }), price.price_incl_vat && (jsxs(Typography, { variant: "body2", sx: { fontWeight: 600 }, children: ["Price incl. VAT \u20AC ", price.price_incl_vat.toFixed(2)] })), jsxs(Typography, { variant: "body2", sx: {
46
46
  fontWeight: 600,
47
47
  color: stock === 0 ? "red" : "white",
@@ -62,30 +62,31 @@ function SingleProduct({ product, sx = [] }) {
62
62
  sm: 12,
63
63
  md: 6,
64
64
  lg: 5,
65
- xl: 5
66
- }, children: imgURL !== null && (jsx(Box, { sx: { height: "400px", width: "100%", position: "relative" }, children: jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsx(StrapiImage, { id: image.id, url: imgURL, alternativeText: image.alternativeText, fill: true, style: { objectFit: "contain" } }) }) })) }), jsx(Grid, { size: {
65
+ xl: 5,
66
+ }, children: imgURL !== null && (jsx(Box, { sx: { height: "400px", width: "100%", position: "relative" }, children: jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsx(StrapiImage, { id: image.id, url: imgURL, alternativeText: image.alternativeText || "fallback alt text", fill: true, style: { objectFit: "contain" } }) }) })) }), jsx(Grid, { size: {
67
67
  xs: 12,
68
68
  sm: 12,
69
69
  md: 6,
70
70
  lg: 7,
71
- xl: 7
72
- }, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: "Image gallery" }) }), jsx(Grid, { size: 12, children: jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsx(Stack, { spacing: 1, direction: "row", children: product?.gallery &&
73
- product.gallery.map((img) => {
71
+ xl: 7,
72
+ }, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h6", children: "Image gallery" }) }), jsx(Grid, { size: 12, children: jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsx(Stack, { spacing: 1, direction: "row", children: gallery &&
73
+ gallery.data &&
74
+ gallery.data.map((img) => {
74
75
  const imgUrl = img?.url ? getStrapiMedia(img.url) : null;
75
76
  return (jsx(Box, { sx: {
76
77
  width: " 150px",
77
78
  height: "150px",
78
79
  position: "relative",
79
- }, children: imgUrl !== null && (jsx(StrapiImage, { id: img.id, url: imgUrl, alternativeText: img.alternativeText, fill: true, style: { objectFit: "contain" } })) }, img.id));
80
+ }, children: imgUrl !== null && (jsx(StrapiImage, { id: img.id, url: imgUrl, alternativeText: img.alternativeText || "fallback alt text", fill: true, style: { objectFit: "contain" } })) }, img.id));
80
81
  }) }) }) }), jsx(Grid, { size: {
81
82
  xs: 12,
82
- md: 6
83
- }, children: categories && (jsxs(Stack, { justifyContent: "center", alignItems: "center", direction: categories.length === 1 ? "row" : "column", children: [categories.length === 1 ? (jsx(Typography, { children: "Category:" })) : (jsx(Typography, { children: "Categories:" })), categories.map((categorie) => {
84
- return (jsx(Link, { href: `/shop/categories/${categorie.slug}`, legacyBehavior: true, children: jsx(Button, { variant: "text", children: categorie.slug }) }, categorie.id));
83
+ md: 6,
84
+ }, children: categories && categories.data && categories.data.length > 0 && (jsxs(Stack, { justifyContent: "center", alignItems: "center", direction: categories.data.length === 1 ? "row" : "column", children: [categories.data.length === 1 ? (jsx(Typography, { children: "Category:" })) : (jsx(Typography, { children: "Categories:" })), categories.data.map((categorie) => {
85
+ return (jsx(Link, { href: `/shop/categories/${categorie.slug}`, children: jsx(Button, { variant: "text", children: categorie.slug }) }, categorie.documentId));
85
86
  })] })) }), jsx(Grid, { size: {
86
87
  xs: 12,
87
- md: 6
88
- }, children: jsx(Stack, { children: jsx(Link, { href: "/shop", legacyBehavior: true, children: jsx(Button, { variant: "outlined", children: "continue shopping" }) }) }) })] }) })] }) }));
88
+ md: 6,
89
+ }, children: jsx(Stack, { children: jsx(Link, { href: "/shop", children: jsx(Button, { variant: "outlined", children: "continue shopping" }) }) }) })] }) })] }) }));
89
90
  }
90
91
 
91
92
  export { SingleProduct as default };
@@ -10,6 +10,24 @@ import { getStrapiURL } from '../../../lib/utils.js';
10
10
  import { unstable_noStore } from 'next/cache';
11
11
 
12
12
  const baseUrl = getStrapiURL();
13
+ async function getSingleCategoryBySlug(slug) {
14
+ unstable_noStore();
15
+ const url = new URL(`/api/slugify/slugs/product-category/${slug}`, baseUrl);
16
+ url.search = qs.stringify({
17
+ filters: {
18
+ is_archive: false,
19
+ },
20
+ populate: {
21
+ products: {
22
+ populate: {
23
+ image: true,
24
+ price: true,
25
+ },
26
+ },
27
+ },
28
+ });
29
+ return await fetchData(url.href);
30
+ }
13
31
  async function getSingleCategory(documentId) {
14
32
  unstable_noStore();
15
33
  const url = new URL(`/api/product-categories/${documentId}`, baseUrl);
@@ -29,4 +47,4 @@ async function getSingleCategory(documentId) {
29
47
  return await fetchData(url.href);
30
48
  }
31
49
 
32
- export { getSingleCategory };
50
+ export { getSingleCategory, getSingleCategoryBySlug };
@@ -72,7 +72,7 @@ export { PaymentStatusIndicator } from './components/e-commerce/opo/PaymentStatu
72
72
  export { InvoiceDownloadLink, InvoicePDFViewer } from './components/e-commerce/invoice/InvoicePDF.js';
73
73
  export { getCustomerProfile, getSingleOrderByUuid } from './data/loaders/e-commerce-loaders.js';
74
74
  export { getAllOpos } from './data/loaders/e-commerce/getAllOpos.js';
75
- export { getSingleCategory } from './data/loaders/e-commerce/getSingleCategory.js';
75
+ export { getSingleCategory, getSingleCategoryBySlug } from './data/loaders/e-commerce/getSingleCategory.js';
76
76
  export { getTableProducts } from './data/loaders/e-commerce/getTableProducts.js';
77
77
  export { getAllCategoryNames } from './data/loaders/e-commerce/getAllCategoryNames.js';
78
78
  export { getPaginatedCategories } from './data/loaders/e-commerce/getPaginatedCategories.js';