@sprintup-cms/sdk 1.9.4 → 1.9.6

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.
@@ -285,23 +285,28 @@ function createCMSClient(options) {
285
285
  }
286
286
  async function getGlobals() {
287
287
  const { baseUrl, appId } = cfg();
288
- if (!baseUrl || !appId) return { navigation: null, footer: null, navItems: [] };
288
+ const empty = { navigation: null, footer: null, navItems: [], logoUrl: "", logoAlt: "", logoShape: "rectangle" };
289
+ if (!baseUrl || !appId) return empty;
289
290
  try {
290
291
  const res = await fetch(`${baseUrl}/api/v1/${appId}/globals`, {
291
292
  headers: headers(),
292
293
  next: { revalidate: 60, tags: [`cms-globals-${appId}`] }
293
294
  });
294
- if (!res.ok) return { navigation: null, footer: null, navItems: [] };
295
+ if (!res.ok) return empty;
295
296
  const json = await res.json();
296
297
  const navigation = json.data?.navigation ?? null;
297
- const rawItems = navigation?.sectionData?.items ?? navigation?.blocks?.[0]?.content?.items ?? [];
298
+ const sd = navigation?.sectionData ?? {};
299
+ const rawItems = sd.items ?? navigation?.blocks?.[0]?.content?.items ?? [];
298
300
  return {
299
301
  navigation,
300
302
  footer: json.data?.footer ?? null,
301
- navItems: resolveNavItems(rawItems)
303
+ navItems: resolveNavItems(rawItems),
304
+ logoUrl: sd.logo_url ?? "",
305
+ logoAlt: sd.logo_alt ?? "",
306
+ logoShape: sd.logo_shape ?? "rectangle"
302
307
  };
303
308
  } catch {
304
- return { navigation: null, footer: null, navItems: [] };
309
+ return empty;
305
310
  }
306
311
  }
307
312
  return {
@@ -1192,6 +1197,50 @@ function TwoColumnBlock({ block }) {
1192
1197
  !hasImage && /* @__PURE__ */ jsx("div", { className: "flex-1 w-full rounded-xl bg-muted border border-border aspect-video flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "No image set" }) })
1193
1198
  ] }) });
1194
1199
  }
1200
+ function BentoGridBlock({ block }) {
1201
+ const d = getData(block);
1202
+ const items = Array.isArray(d.items) ? d.items : [];
1203
+ const sizeClass = {
1204
+ small: "col-span-1 row-span-1",
1205
+ wide: "col-span-2 row-span-1",
1206
+ tall: "col-span-1 row-span-2",
1207
+ large: "col-span-2 row-span-2"
1208
+ };
1209
+ return /* @__PURE__ */ jsxs("section", { className: "py-12", children: [
1210
+ (d.title || d.subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
1211
+ d.title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-semibold tracking-tight", children: d.title }),
1212
+ d.subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children: d.subtitle })
1213
+ ] }),
1214
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 auto-rows-[180px] gap-3", children: items.map((item, i) => /* @__PURE__ */ jsxs(
1215
+ "div",
1216
+ {
1217
+ className: `rounded-xl border border-border bg-card p-5 flex flex-col justify-between hover:bg-muted/40 transition-colors ${sizeClass[item.size] ?? sizeClass.small}`,
1218
+ children: [
1219
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg bg-muted flex items-center justify-center mb-3", children: FEATURE_ICONS[item.icon] ?? /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "w-4 h-4", children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }) }) }),
1220
+ /* @__PURE__ */ jsxs("div", { children: [
1221
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm", children: item.title }),
1222
+ item.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs mt-0.5 leading-relaxed", children: item.description })
1223
+ ] })
1224
+ ]
1225
+ },
1226
+ i
1227
+ )) })
1228
+ ] });
1229
+ }
1230
+ function GridLayoutBlock({ block }) {
1231
+ const d = getData(block);
1232
+ const cols = Number(d.columns) || 3;
1233
+ const gap = String(d.gap ?? "md");
1234
+ const children = Array.isArray(d.children) ? d.children : [];
1235
+ const gapMap = { none: "gap-0", sm: "gap-2", md: "gap-4", lg: "gap-6", xl: "gap-8" };
1236
+ const colsMap = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4", 5: "grid-cols-5", 6: "grid-cols-6" };
1237
+ return /* @__PURE__ */ jsx("div", { className: `grid ${colsMap[cols] ?? "grid-cols-3"} ${gapMap[gap] ?? "gap-4"}`, children: children.map((child) => /* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(GridLayoutChildBlock, { block: child }) }, child.id)) });
1238
+ }
1239
+ function GridLayoutChildBlock({ block }) {
1240
+ const renderer = BUILT_IN[block.type];
1241
+ if (renderer) return /* @__PURE__ */ jsx(Fragment, { children: renderer(block, null) });
1242
+ return /* @__PURE__ */ jsx(SectionBlock, { block, pageType: null });
1243
+ }
1195
1244
  var BUILT_IN = {
1196
1245
  // Structured page type — content is nested { sectionName: { fieldName: value } }
1197
1246
  "__structured__": (b, pt) => /* @__PURE__ */ jsx(StructuredBlock, { block: b, pageType: pt }),
@@ -1231,7 +1280,9 @@ var BUILT_IN = {
1231
1280
  columns: (b) => /* @__PURE__ */ jsx(ColumnsBlock, { block: b }),
1232
1281
  container: (b) => /* @__PURE__ */ jsx(ContainerBlock, { block: b }),
1233
1282
  carousel: (b) => /* @__PURE__ */ jsx(CarouselBlock, { block: b }),
1234
- "product-list": (b) => /* @__PURE__ */ jsx(ProductListBlock, { block: b })
1283
+ "product-list": (b) => /* @__PURE__ */ jsx(ProductListBlock, { block: b }),
1284
+ "bento-grid": (b) => /* @__PURE__ */ jsx(BentoGridBlock, { block: b }),
1285
+ "grid-layout": (b) => /* @__PURE__ */ jsx(GridLayoutBlock, { block: b })
1235
1286
  };
1236
1287
  function CMSBlocks({ blocks, pageType, className = "", custom = {} }) {
1237
1288
  if (!blocks?.length) return null;