@sprintup-cms/sdk 1.8.20 → 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 -195
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +61 -196
- package/dist/next/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { revalidateTag, revalidatePath } from 'next/cache';
|
|
3
3
|
import { draftMode, cookies } from 'next/headers';
|
|
4
4
|
import { notFound } from 'next/navigation';
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
/* @sprintup-cms/sdk — https://forgecms.io */
|
|
@@ -614,184 +614,6 @@ function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
|
|
|
614
614
|
return /* @__PURE__ */ jsx(SectionBlock, { block, pageType }, block.id);
|
|
615
615
|
}) });
|
|
616
616
|
}
|
|
617
|
-
function StarIcon() {
|
|
618
|
-
return /* @__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" }) });
|
|
619
|
-
}
|
|
620
|
-
function GridIcon({ active }) {
|
|
621
|
-
return /* @__PURE__ */ jsxs(
|
|
622
|
-
"svg",
|
|
623
|
-
{
|
|
624
|
-
viewBox: "0 0 16 16",
|
|
625
|
-
className: `w-4 h-4 ${active ? "text-foreground" : "text-muted-foreground"}`,
|
|
626
|
-
fill: "currentColor",
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "6", height: "6", rx: "1" }),
|
|
629
|
-
/* @__PURE__ */ jsx("rect", { x: "9", y: "1", width: "6", height: "6", rx: "1" }),
|
|
630
|
-
/* @__PURE__ */ jsx("rect", { x: "1", y: "9", width: "6", height: "6", rx: "1" }),
|
|
631
|
-
/* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "6", height: "6", rx: "1" })
|
|
632
|
-
]
|
|
633
|
-
}
|
|
634
|
-
);
|
|
635
|
-
}
|
|
636
|
-
function ListIcon({ active }) {
|
|
637
|
-
return /* @__PURE__ */ jsxs(
|
|
638
|
-
"svg",
|
|
639
|
-
{
|
|
640
|
-
viewBox: "0 0 16 16",
|
|
641
|
-
className: `w-4 h-4 ${active ? "text-foreground" : "text-muted-foreground"}`,
|
|
642
|
-
fill: "currentColor",
|
|
643
|
-
children: [
|
|
644
|
-
/* @__PURE__ */ jsx("rect", { x: "1", y: "2", width: "14", height: "3", rx: "1" }),
|
|
645
|
-
/* @__PURE__ */ jsx("rect", { x: "1", y: "7", width: "14", height: "3", rx: "1" }),
|
|
646
|
-
/* @__PURE__ */ jsx("rect", { x: "1", y: "12", width: "14", height: "3", rx: "1" })
|
|
647
|
-
]
|
|
648
|
-
}
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
function ProductCard({ product, cardStyle, showPrice, showRating, currency, ctaLabel, staticCtaUrl }) {
|
|
652
|
-
const accentColor = product.color ?? "#6366f1";
|
|
653
|
-
const href = staticCtaUrl || product.ctaUrl;
|
|
654
|
-
return /* @__PURE__ */ jsxs(
|
|
655
|
-
"div",
|
|
656
|
-
{
|
|
657
|
-
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"}`,
|
|
658
|
-
children: [
|
|
659
|
-
cardStyle === "color-band" && /* @__PURE__ */ jsx("div", { className: "h-2 w-full flex-shrink-0", style: { backgroundColor: accentColor } }),
|
|
660
|
-
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 }) }),
|
|
661
|
-
/* @__PURE__ */ jsxs("div", { className: "p-5 flex flex-col gap-3 flex-1", children: [
|
|
662
|
-
cardStyle !== "filled-header" && (product.category || product.badge) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
663
|
-
product.category && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full font-medium text-white", style: { backgroundColor: accentColor }, children: product.category }),
|
|
664
|
-
product.badge && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground", children: product.badge })
|
|
665
|
-
] }),
|
|
666
|
-
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 }),
|
|
667
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-base line-clamp-2", children: product.name }),
|
|
668
|
-
product.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: product.description }),
|
|
669
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-auto pt-3 border-t border-border flex items-center justify-between gap-3", children: [
|
|
670
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
671
|
-
showPrice && product.price > 0 && /* @__PURE__ */ jsxs("span", { className: "font-bold text-lg", children: [
|
|
672
|
-
product.price.toFixed(2),
|
|
673
|
-
" ",
|
|
674
|
-
currency
|
|
675
|
-
] }),
|
|
676
|
-
showRating && product.rating && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
677
|
-
/* @__PURE__ */ jsx(StarIcon, {}),
|
|
678
|
-
/* @__PURE__ */ jsx("span", { children: product.rating })
|
|
679
|
-
] })
|
|
680
|
-
] }),
|
|
681
|
-
ctaLabel && /* @__PURE__ */ jsx(
|
|
682
|
-
"a",
|
|
683
|
-
{
|
|
684
|
-
href: href || "#",
|
|
685
|
-
className: "text-xs font-semibold px-3 py-1.5 rounded-lg text-white transition-opacity hover:opacity-90 flex-shrink-0",
|
|
686
|
-
style: { backgroundColor: accentColor },
|
|
687
|
-
children: ctaLabel
|
|
688
|
-
}
|
|
689
|
-
)
|
|
690
|
-
] })
|
|
691
|
-
] })
|
|
692
|
-
]
|
|
693
|
-
}
|
|
694
|
-
);
|
|
695
|
-
}
|
|
696
|
-
function ProductRow({ product, showPrice, showRating, currency, ctaLabel, staticCtaUrl }) {
|
|
697
|
-
const accentColor = product.color ?? "#6366f1";
|
|
698
|
-
const href = staticCtaUrl || product.ctaUrl;
|
|
699
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 border rounded-xl bg-card px-5 py-4 hover:shadow-md transition-shadow group", children: [
|
|
700
|
-
/* @__PURE__ */ jsx("div", { className: "w-1 self-stretch rounded-full flex-shrink-0", style: { backgroundColor: accentColor } }),
|
|
701
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
702
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap mb-1", children: [
|
|
703
|
-
product.category && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full font-medium text-white", style: { backgroundColor: accentColor }, children: product.category }),
|
|
704
|
-
product.badge && /* @__PURE__ */ jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground", children: product.badge })
|
|
705
|
-
] }),
|
|
706
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm truncate", children: product.name }),
|
|
707
|
-
product.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate mt-0.5", children: product.description })
|
|
708
|
-
] }),
|
|
709
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 flex-shrink-0", children: [
|
|
710
|
-
showRating && product.rating && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
711
|
-
/* @__PURE__ */ jsx(StarIcon, {}),
|
|
712
|
-
/* @__PURE__ */ jsx("span", { children: product.rating })
|
|
713
|
-
] }),
|
|
714
|
-
showPrice && product.price > 0 && /* @__PURE__ */ jsxs("span", { className: "font-bold text-base", children: [
|
|
715
|
-
product.price.toFixed(2),
|
|
716
|
-
" ",
|
|
717
|
-
currency
|
|
718
|
-
] }),
|
|
719
|
-
ctaLabel && /* @__PURE__ */ jsx(
|
|
720
|
-
"a",
|
|
721
|
-
{
|
|
722
|
-
href: href || "#",
|
|
723
|
-
className: "text-xs font-semibold px-3 py-1.5 rounded-lg text-white transition-opacity hover:opacity-90",
|
|
724
|
-
style: { backgroundColor: accentColor },
|
|
725
|
-
children: ctaLabel
|
|
726
|
-
}
|
|
727
|
-
)
|
|
728
|
-
] })
|
|
729
|
-
] });
|
|
730
|
-
}
|
|
731
|
-
function ProductListClient({
|
|
732
|
-
products,
|
|
733
|
-
defaultLayout,
|
|
734
|
-
allowToggle,
|
|
735
|
-
gridCols,
|
|
736
|
-
cardStyle,
|
|
737
|
-
showPrice,
|
|
738
|
-
showRating,
|
|
739
|
-
currency,
|
|
740
|
-
ctaLabel,
|
|
741
|
-
staticCtaUrl
|
|
742
|
-
}) {
|
|
743
|
-
const [layout, setLayout] = useState(defaultLayout);
|
|
744
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
745
|
-
allowToggle && /* @__PURE__ */ jsx("div", { className: "flex justify-end mb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 border border-border rounded-lg p-1 bg-muted/30", children: [
|
|
746
|
-
/* @__PURE__ */ jsx(
|
|
747
|
-
"button",
|
|
748
|
-
{
|
|
749
|
-
type: "button",
|
|
750
|
-
onClick: () => setLayout("grid"),
|
|
751
|
-
className: `p-1.5 rounded-md transition-colors ${layout === "grid" ? "bg-background shadow-sm" : "hover:bg-muted"}`,
|
|
752
|
-
"aria-label": "Grid view",
|
|
753
|
-
"aria-pressed": layout === "grid",
|
|
754
|
-
children: /* @__PURE__ */ jsx(GridIcon, { active: layout === "grid" })
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
/* @__PURE__ */ jsx(
|
|
758
|
-
"button",
|
|
759
|
-
{
|
|
760
|
-
type: "button",
|
|
761
|
-
onClick: () => setLayout("list"),
|
|
762
|
-
className: `p-1.5 rounded-md transition-colors ${layout === "list" ? "bg-background shadow-sm" : "hover:bg-muted"}`,
|
|
763
|
-
"aria-label": "List view",
|
|
764
|
-
"aria-pressed": layout === "list",
|
|
765
|
-
children: /* @__PURE__ */ jsx(ListIcon, { active: layout === "list" })
|
|
766
|
-
}
|
|
767
|
-
)
|
|
768
|
-
] }) }),
|
|
769
|
-
layout === "grid" ? /* @__PURE__ */ jsx("div", { className: `grid gap-6 grid-cols-1 ${gridCols}`, children: products.map((product) => /* @__PURE__ */ jsx(
|
|
770
|
-
ProductCard,
|
|
771
|
-
{
|
|
772
|
-
product,
|
|
773
|
-
cardStyle,
|
|
774
|
-
showPrice,
|
|
775
|
-
showRating,
|
|
776
|
-
currency,
|
|
777
|
-
ctaLabel,
|
|
778
|
-
staticCtaUrl
|
|
779
|
-
},
|
|
780
|
-
product.id
|
|
781
|
-
)) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: products.map((product) => /* @__PURE__ */ jsx(
|
|
782
|
-
ProductRow,
|
|
783
|
-
{
|
|
784
|
-
product,
|
|
785
|
-
showPrice,
|
|
786
|
-
showRating,
|
|
787
|
-
currency,
|
|
788
|
-
ctaLabel,
|
|
789
|
-
staticCtaUrl
|
|
790
|
-
},
|
|
791
|
-
product.id
|
|
792
|
-
)) })
|
|
793
|
-
] });
|
|
794
|
-
}
|
|
795
617
|
function resolvePath(obj, path) {
|
|
796
618
|
if (!path) return void 0;
|
|
797
619
|
return path.split(/[\.\[\]]+/).filter(Boolean).reduce((acc, key) => acc?.[key], obj);
|
|
@@ -832,8 +654,6 @@ function ServerProductListBlock({ block }) {
|
|
|
832
654
|
cardStyle = "color-band",
|
|
833
655
|
ctaLabel = "",
|
|
834
656
|
ctaUrl: staticCtaUrl = "",
|
|
835
|
-
defaultLayout = "grid",
|
|
836
|
-
allowToggle = true,
|
|
837
657
|
fieldTitle,
|
|
838
658
|
fieldPrice,
|
|
839
659
|
fieldColor,
|
|
@@ -843,6 +663,13 @@ function ServerProductListBlock({ block }) {
|
|
|
843
663
|
fieldCtaUrl
|
|
844
664
|
} = cfg;
|
|
845
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
|
+
}
|
|
846
673
|
const cols = parseInt(String(columns), 10);
|
|
847
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";
|
|
848
675
|
const rawProducts = Array.isArray(block._resolvedProducts) ? block._resolvedProducts : Array.isArray(cfg.prefetchedProducts) ? cfg.prefetchedProducts : [];
|
|
@@ -855,21 +682,59 @@ function ServerProductListBlock({ block }) {
|
|
|
855
682
|
title && /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-semibold tracking-tight text-balance", children: title }),
|
|
856
683
|
subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-2 text-pretty", children: subtitle })
|
|
857
684
|
] }),
|
|
858
|
-
/* @__PURE__ */ jsx(
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
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
|
+
}) })
|
|
873
738
|
] }) });
|
|
874
739
|
}
|
|
875
740
|
var client = createCMSClient();
|