@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.cjs
CHANGED
|
@@ -6,12 +6,10 @@ var headers = require('next/headers');
|
|
|
6
6
|
var navigation = require('next/navigation');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
var dynamic = require('next/dynamic');
|
|
10
9
|
|
|
11
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
|
|
13
12
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
-
var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
|
|
15
13
|
|
|
16
14
|
/* @sprintup-cms/sdk — https://forgecms.io */
|
|
17
15
|
|
|
@@ -622,14 +620,6 @@ function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
|
|
|
622
620
|
return /* @__PURE__ */ jsxRuntime.jsx(SectionBlock, { block, pageType }, block.id);
|
|
623
621
|
}) });
|
|
624
622
|
}
|
|
625
|
-
var clientModulePath = "./product-list-client";
|
|
626
|
-
var ProductListClient = dynamic__default.default(
|
|
627
|
-
() => import(
|
|
628
|
-
/* webpackIgnore: true */
|
|
629
|
-
clientModulePath
|
|
630
|
-
).then((m) => m.ProductListClient),
|
|
631
|
-
{ ssr: false }
|
|
632
|
-
);
|
|
633
623
|
function resolvePath(obj, path) {
|
|
634
624
|
if (!path) return void 0;
|
|
635
625
|
return path.split(/[\.\[\]]+/).filter(Boolean).reduce((acc, key) => acc?.[key], obj);
|
|
@@ -670,8 +660,6 @@ function ServerProductListBlock({ block }) {
|
|
|
670
660
|
cardStyle = "color-band",
|
|
671
661
|
ctaLabel = "",
|
|
672
662
|
ctaUrl: staticCtaUrl = "",
|
|
673
|
-
defaultLayout = "grid",
|
|
674
|
-
allowToggle = true,
|
|
675
663
|
fieldTitle,
|
|
676
664
|
fieldPrice,
|
|
677
665
|
fieldColor,
|
|
@@ -681,6 +669,13 @@ function ServerProductListBlock({ block }) {
|
|
|
681
669
|
fieldCtaUrl
|
|
682
670
|
} = cfg;
|
|
683
671
|
const fm = { fieldTitle, fieldPrice, fieldColor, fieldCategory, fieldBadge, fieldDescription, fieldCtaUrl };
|
|
672
|
+
console.log("[v0] ServerProductListBlock cfg keys:", Object.keys(cfg));
|
|
673
|
+
console.log("[v0] ServerProductListBlock fm:", JSON.stringify(fm));
|
|
674
|
+
console.log("[v0] ServerProductListBlock rawProducts count:", Array.isArray(block._resolvedProducts) ? block._resolvedProducts.length : "none", "| prefetched:", Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts.length : "none");
|
|
675
|
+
if (Array.isArray(cfg.prefetchedProducts) && cfg.prefetchedProducts[0]) {
|
|
676
|
+
console.log("[v0] first product keys:", Object.keys(cfg.prefetchedProducts[0]));
|
|
677
|
+
console.log("[v0] first product sample:", JSON.stringify(cfg.prefetchedProducts[0]).slice(0, 300));
|
|
678
|
+
}
|
|
684
679
|
const cols = parseInt(String(columns), 10);
|
|
685
680
|
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";
|
|
686
681
|
const rawProducts = Array.isArray(block._resolvedProducts) ? block._resolvedProducts : Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts : [];
|
|
@@ -693,21 +688,59 @@ function ServerProductListBlock({ block }) {
|
|
|
693
688
|
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl md:text-3xl font-semibold tracking-tight text-balance", children: title }),
|
|
694
689
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-2 text-pretty", children: subtitle })
|
|
695
690
|
] }),
|
|
696
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
691
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid gap-6 grid-cols-1 ${gridCols}`, children: products.map((product) => {
|
|
692
|
+
const accentColor = product.color ?? "#6366f1";
|
|
693
|
+
const href = staticCtaUrl || product.ctaUrl;
|
|
694
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
695
|
+
"div",
|
|
696
|
+
{
|
|
697
|
+
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"}`,
|
|
698
|
+
children: [
|
|
699
|
+
cardStyle === "color-band" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-2 w-full flex-shrink-0", style: { backgroundColor: accentColor } }),
|
|
700
|
+
cardStyle === "filled-header" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-20 w-full flex-shrink-0 flex items-end px-5 pb-3", style: { backgroundColor: accentColor }, children: product.category && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-white/80 uppercase tracking-wider", children: product.category }) }),
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 flex flex-col gap-3 flex-1", children: [
|
|
702
|
+
cardStyle !== "filled-header" && (product.category || product.badge) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
703
|
+
product.category && /* @__PURE__ */ jsxRuntime.jsx(
|
|
704
|
+
"span",
|
|
705
|
+
{
|
|
706
|
+
className: "text-xs px-2 py-0.5 rounded-full font-medium text-white",
|
|
707
|
+
style: { backgroundColor: accentColor },
|
|
708
|
+
children: product.category
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
product.badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground", children: product.badge })
|
|
712
|
+
] }),
|
|
713
|
+
cardStyle === "filled-header" && product.badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground self-start", children: product.badge }),
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-base line-clamp-2", children: product.name }),
|
|
715
|
+
product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: product.description }),
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-auto pt-3 border-t border-border flex items-center justify-between gap-3", children: [
|
|
717
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
718
|
+
showPrice && product.price > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold text-lg", children: [
|
|
719
|
+
product.price.toFixed(2),
|
|
720
|
+
" ",
|
|
721
|
+
currency
|
|
722
|
+
] }),
|
|
723
|
+
showRating && product.rating && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 fill-yellow-400 text-yellow-400", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.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" }) }),
|
|
725
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: product.rating })
|
|
726
|
+
] })
|
|
727
|
+
] }),
|
|
728
|
+
ctaLabel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
729
|
+
"a",
|
|
730
|
+
{
|
|
731
|
+
href: href || "#",
|
|
732
|
+
className: "text-xs font-semibold px-3 py-1.5 rounded-lg text-white transition-opacity hover:opacity-90 flex-shrink-0",
|
|
733
|
+
style: { backgroundColor: accentColor },
|
|
734
|
+
children: ctaLabel
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
] })
|
|
738
|
+
] })
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
product.id
|
|
742
|
+
);
|
|
743
|
+
}) })
|
|
711
744
|
] }) });
|
|
712
745
|
}
|
|
713
746
|
var client = createCMSClient();
|