@sprintup-cms/sdk 1.8.29 → 1.8.30
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/next/index.cjs +60 -27
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +60 -26
- package/dist/next/index.js.map +1 -1
- package/package.json +9 -14
- package/dist/next/product-list-client.cjs +0 -187
- package/dist/next/product-list-client.cjs.map +0 -1
- package/dist/next/product-list-client.d.cts +0 -28
- package/dist/next/product-list-client.d.ts +0 -28
- package/dist/next/product-list-client.js +0 -185
- package/dist/next/product-list-client.js.map +0 -1
- package/dist/react/index.d.cts +0 -92
- package/dist/react/index.d.ts +0 -92
package/dist/next/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { draftMode, cookies } from 'next/headers';
|
|
|
4
4
|
import { notFound } from 'next/navigation';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import dynamic from 'next/dynamic';
|
|
8
7
|
|
|
9
8
|
/* @sprintup-cms/sdk — https://forgecms.io */
|
|
10
9
|
|
|
@@ -615,14 +614,6 @@ function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
|
|
|
615
614
|
return /* @__PURE__ */ jsx(SectionBlock, { block, pageType }, block.id);
|
|
616
615
|
}) });
|
|
617
616
|
}
|
|
618
|
-
var clientModulePath = "./product-list-client";
|
|
619
|
-
var ProductListClient = dynamic(
|
|
620
|
-
() => import(
|
|
621
|
-
/* webpackIgnore: true */
|
|
622
|
-
clientModulePath
|
|
623
|
-
).then((m) => m.ProductListClient),
|
|
624
|
-
{ ssr: false }
|
|
625
|
-
);
|
|
626
617
|
function resolvePath(obj, path) {
|
|
627
618
|
if (!path) return void 0;
|
|
628
619
|
return path.split(/[\.\[\]]+/).filter(Boolean).reduce((acc, key) => acc?.[key], obj);
|
|
@@ -663,8 +654,6 @@ function ServerProductListBlock({ block }) {
|
|
|
663
654
|
cardStyle = "color-band",
|
|
664
655
|
ctaLabel = "",
|
|
665
656
|
ctaUrl: staticCtaUrl = "",
|
|
666
|
-
defaultLayout = "grid",
|
|
667
|
-
allowToggle = true,
|
|
668
657
|
fieldTitle,
|
|
669
658
|
fieldPrice,
|
|
670
659
|
fieldColor,
|
|
@@ -674,6 +663,13 @@ function ServerProductListBlock({ block }) {
|
|
|
674
663
|
fieldCtaUrl
|
|
675
664
|
} = cfg;
|
|
676
665
|
const fm = { fieldTitle, fieldPrice, fieldColor, fieldCategory, fieldBadge, fieldDescription, fieldCtaUrl };
|
|
666
|
+
console.log("[v0] ServerProductListBlock cfg keys:", Object.keys(cfg));
|
|
667
|
+
console.log("[v0] ServerProductListBlock fm:", JSON.stringify(fm));
|
|
668
|
+
console.log("[v0] ServerProductListBlock rawProducts count:", Array.isArray(block._resolvedProducts) ? block._resolvedProducts.length : "none", "| prefetched:", Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts.length : "none");
|
|
669
|
+
if (Array.isArray(cfg.prefetchedProducts) && cfg.prefetchedProducts[0]) {
|
|
670
|
+
console.log("[v0] first product keys:", Object.keys(cfg.prefetchedProducts[0]));
|
|
671
|
+
console.log("[v0] first product sample:", JSON.stringify(cfg.prefetchedProducts[0]).slice(0, 300));
|
|
672
|
+
}
|
|
677
673
|
const cols = parseInt(String(columns), 10);
|
|
678
674
|
const gridCols = cols === 2 ? "sm:grid-cols-2" : cols === 4 ? "sm:grid-cols-2 lg:grid-cols-4" : "sm:grid-cols-2 lg:grid-cols-3";
|
|
679
675
|
const rawProducts = Array.isArray(block._resolvedProducts) ? block._resolvedProducts : Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts : [];
|
|
@@ -686,21 +682,59 @@ function ServerProductListBlock({ block }) {
|
|
|
686
682
|
title && /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-semibold tracking-tight text-balance", children: title }),
|
|
687
683
|
subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-2 text-pretty", children: subtitle })
|
|
688
684
|
] }),
|
|
689
|
-
/* @__PURE__ */ jsx(
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
685
|
+
/* @__PURE__ */ jsx("div", { className: `grid gap-6 grid-cols-1 ${gridCols}`, children: products.map((product) => {
|
|
686
|
+
const accentColor = product.color ?? "#6366f1";
|
|
687
|
+
const href = staticCtaUrl || product.ctaUrl;
|
|
688
|
+
return /* @__PURE__ */ jsxs(
|
|
689
|
+
"div",
|
|
690
|
+
{
|
|
691
|
+
className: `overflow-hidden group transition-shadow flex flex-col ${cardStyle === "minimal" ? "border-0 shadow-none bg-transparent" : "border rounded-xl hover:shadow-lg bg-card"}`,
|
|
692
|
+
children: [
|
|
693
|
+
cardStyle === "color-band" && /* @__PURE__ */ jsx("div", { className: "h-2 w-full flex-shrink-0", style: { backgroundColor: accentColor } }),
|
|
694
|
+
cardStyle === "filled-header" && /* @__PURE__ */ jsx("div", { className: "h-20 w-full flex-shrink-0 flex items-end px-5 pb-3", style: { backgroundColor: accentColor }, children: product.category && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-white/80 uppercase tracking-wider", children: product.category }) }),
|
|
695
|
+
/* @__PURE__ */ jsxs("div", { className: "p-5 flex flex-col gap-3 flex-1", children: [
|
|
696
|
+
cardStyle !== "filled-header" && (product.category || product.badge) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
697
|
+
product.category && /* @__PURE__ */ jsx(
|
|
698
|
+
"span",
|
|
699
|
+
{
|
|
700
|
+
className: "text-xs px-2 py-0.5 rounded-full font-medium text-white",
|
|
701
|
+
style: { backgroundColor: accentColor },
|
|
702
|
+
children: product.category
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
product.badge && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground", children: product.badge })
|
|
706
|
+
] }),
|
|
707
|
+
cardStyle === "filled-header" && product.badge && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground self-start", children: product.badge }),
|
|
708
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-base line-clamp-2", children: product.name }),
|
|
709
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: product.description }),
|
|
710
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-auto pt-3 border-t border-border flex items-center justify-between gap-3", children: [
|
|
711
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
712
|
+
showPrice && product.price > 0 && /* @__PURE__ */ jsxs("span", { className: "font-bold text-lg", children: [
|
|
713
|
+
product.price.toFixed(2),
|
|
714
|
+
" ",
|
|
715
|
+
currency
|
|
716
|
+
] }),
|
|
717
|
+
showRating && product.rating && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
718
|
+
/* @__PURE__ */ jsx("svg", { className: "w-3.5 h-3.5 fill-yellow-400 text-yellow-400", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" }) }),
|
|
719
|
+
/* @__PURE__ */ jsx("span", { children: product.rating })
|
|
720
|
+
] })
|
|
721
|
+
] }),
|
|
722
|
+
ctaLabel && /* @__PURE__ */ jsx(
|
|
723
|
+
"a",
|
|
724
|
+
{
|
|
725
|
+
href: href || "#",
|
|
726
|
+
className: "text-xs font-semibold px-3 py-1.5 rounded-lg text-white transition-opacity hover:opacity-90 flex-shrink-0",
|
|
727
|
+
style: { backgroundColor: accentColor },
|
|
728
|
+
children: ctaLabel
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] })
|
|
732
|
+
] })
|
|
733
|
+
]
|
|
734
|
+
},
|
|
735
|
+
product.id
|
|
736
|
+
);
|
|
737
|
+
}) })
|
|
704
738
|
] }) });
|
|
705
739
|
}
|
|
706
740
|
var client = createCMSClient();
|