@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.
@@ -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("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
- }) })
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();