@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.js
CHANGED
|
@@ -4,6 +4,7 @@ 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';
|
|
7
8
|
|
|
8
9
|
/* @sprintup-cms/sdk — https://forgecms.io */
|
|
9
10
|
|
|
@@ -614,6 +615,14 @@ function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
|
|
|
614
615
|
return /* @__PURE__ */ jsx(SectionBlock, { block, pageType }, block.id);
|
|
615
616
|
}) });
|
|
616
617
|
}
|
|
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
|
+
);
|
|
617
626
|
function resolvePath(obj, path) {
|
|
618
627
|
if (!path) return void 0;
|
|
619
628
|
return path.split(/[\.\[\]]+/).filter(Boolean).reduce((acc, key) => acc?.[key], obj);
|
|
@@ -654,6 +663,8 @@ function ServerProductListBlock({ block }) {
|
|
|
654
663
|
cardStyle = "color-band",
|
|
655
664
|
ctaLabel = "",
|
|
656
665
|
ctaUrl: staticCtaUrl = "",
|
|
666
|
+
defaultLayout = "grid",
|
|
667
|
+
allowToggle = true,
|
|
657
668
|
fieldTitle,
|
|
658
669
|
fieldPrice,
|
|
659
670
|
fieldColor,
|
|
@@ -663,13 +674,6 @@ function ServerProductListBlock({ block }) {
|
|
|
663
674
|
fieldCtaUrl
|
|
664
675
|
} = cfg;
|
|
665
676
|
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
|
-
}
|
|
673
677
|
const cols = parseInt(String(columns), 10);
|
|
674
678
|
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";
|
|
675
679
|
const rawProducts = Array.isArray(block._resolvedProducts) ? block._resolvedProducts : Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts : [];
|
|
@@ -682,59 +686,21 @@ function ServerProductListBlock({ block }) {
|
|
|
682
686
|
title && /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-semibold tracking-tight text-balance", children: title }),
|
|
683
687
|
subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-2 text-pretty", children: subtitle })
|
|
684
688
|
] }),
|
|
685
|
-
/* @__PURE__ */ jsx(
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
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
|
-
}) })
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
690
|
+
ProductListClient,
|
|
691
|
+
{
|
|
692
|
+
products,
|
|
693
|
+
defaultLayout,
|
|
694
|
+
allowToggle,
|
|
695
|
+
gridCols,
|
|
696
|
+
cardStyle,
|
|
697
|
+
showPrice,
|
|
698
|
+
showRating,
|
|
699
|
+
currency,
|
|
700
|
+
ctaLabel,
|
|
701
|
+
staticCtaUrl
|
|
702
|
+
}
|
|
703
|
+
)
|
|
738
704
|
] }) });
|
|
739
705
|
}
|
|
740
706
|
var client = createCMSClient();
|