@sprintup-cms/sdk 1.8.19 → 1.8.29
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 +27 -60
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +26 -60
- package/dist/next/index.js.map +1 -1
- package/dist/next/product-list-client.cjs +187 -0
- package/dist/next/product-list-client.cjs.map +1 -0
- package/dist/next/product-list-client.d.cts +28 -0
- package/dist/next/product-list-client.d.ts +28 -0
- package/dist/next/product-list-client.js +185 -0
- package/dist/next/product-list-client.js.map +1 -0
- package/dist/react/index.d.cts +92 -0
- package/dist/react/index.d.ts +92 -0
- package/package.json +14 -9
package/dist/next/index.cjs
CHANGED
|
@@ -6,10 +6,12 @@ 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');
|
|
9
10
|
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
|
|
12
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
|
|
13
15
|
|
|
14
16
|
/* @sprintup-cms/sdk — https://forgecms.io */
|
|
15
17
|
|
|
@@ -620,6 +622,14 @@ function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
|
|
|
620
622
|
return /* @__PURE__ */ jsxRuntime.jsx(SectionBlock, { block, pageType }, block.id);
|
|
621
623
|
}) });
|
|
622
624
|
}
|
|
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
|
+
);
|
|
623
633
|
function resolvePath(obj, path) {
|
|
624
634
|
if (!path) return void 0;
|
|
625
635
|
return path.split(/[\.\[\]]+/).filter(Boolean).reduce((acc, key) => acc?.[key], obj);
|
|
@@ -660,6 +670,8 @@ function ServerProductListBlock({ block }) {
|
|
|
660
670
|
cardStyle = "color-band",
|
|
661
671
|
ctaLabel = "",
|
|
662
672
|
ctaUrl: staticCtaUrl = "",
|
|
673
|
+
defaultLayout = "grid",
|
|
674
|
+
allowToggle = true,
|
|
663
675
|
fieldTitle,
|
|
664
676
|
fieldPrice,
|
|
665
677
|
fieldColor,
|
|
@@ -669,13 +681,6 @@ function ServerProductListBlock({ block }) {
|
|
|
669
681
|
fieldCtaUrl
|
|
670
682
|
} = cfg;
|
|
671
683
|
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
|
-
}
|
|
679
684
|
const cols = parseInt(String(columns), 10);
|
|
680
685
|
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";
|
|
681
686
|
const rawProducts = Array.isArray(block._resolvedProducts) ? block._resolvedProducts : Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts : [];
|
|
@@ -688,59 +693,21 @@ function ServerProductListBlock({ block }) {
|
|
|
688
693
|
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl md:text-3xl font-semibold tracking-tight text-balance", children: title }),
|
|
689
694
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-2 text-pretty", children: subtitle })
|
|
690
695
|
] }),
|
|
691
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
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
|
-
}) })
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
ProductListClient,
|
|
698
|
+
{
|
|
699
|
+
products,
|
|
700
|
+
defaultLayout,
|
|
701
|
+
allowToggle,
|
|
702
|
+
gridCols,
|
|
703
|
+
cardStyle,
|
|
704
|
+
showPrice,
|
|
705
|
+
showRating,
|
|
706
|
+
currency,
|
|
707
|
+
ctaLabel,
|
|
708
|
+
staticCtaUrl
|
|
709
|
+
}
|
|
710
|
+
)
|
|
744
711
|
] }) });
|
|
745
712
|
}
|
|
746
713
|
var client = createCMSClient();
|