@sprintup-cms/sdk 1.9.6 → 1.9.8
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/client.cjs +27 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +4 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +27 -0
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +70 -33
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +70 -33
- package/dist/next/index.js.map +1 -1
- package/dist/react/index.cjs +43 -33
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +43 -33
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -184,6 +184,32 @@ function createCMSClient(options) {
|
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
+
async function getRootPage() {
|
|
188
|
+
const { baseUrl, apiKey, appId } = cfg();
|
|
189
|
+
if (!baseUrl || !apiKey || !appId) {
|
|
190
|
+
console.warn("[sprintup-cms] getRootPage: Missing config \u2014 returning null");
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
const res = await fetch(
|
|
195
|
+
`${baseUrl}/api/v1/${appId}/pages?isRootPage=true&limit=1`,
|
|
196
|
+
{
|
|
197
|
+
headers: headers(),
|
|
198
|
+
next: { revalidate: 60, tags: [`cms-pages-${appId}`] }
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
if (!res.ok) {
|
|
202
|
+
console.error(`[sprintup-cms] getRootPage (${res.status})`);
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const json = await res.json();
|
|
206
|
+
const pages = Array.isArray(json.data) ? json.data : [];
|
|
207
|
+
return pages.find((p) => p.isRootPage === true) ?? pages[0] ?? null;
|
|
208
|
+
} catch (err) {
|
|
209
|
+
console.error("[sprintup-cms] getRootPage error:", err);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
187
213
|
async function getBlogPosts() {
|
|
188
214
|
return getPages({ type: "blog-post" });
|
|
189
215
|
}
|
|
@@ -312,6 +338,7 @@ function createCMSClient(options) {
|
|
|
312
338
|
return {
|
|
313
339
|
getPages,
|
|
314
340
|
getPage,
|
|
341
|
+
getRootPage,
|
|
315
342
|
getGlobals,
|
|
316
343
|
getBlogPosts,
|
|
317
344
|
getEvents,
|
|
@@ -898,20 +925,24 @@ function BentoHeroBlock({ block }) {
|
|
|
898
925
|
)
|
|
899
926
|
] })
|
|
900
927
|
] }),
|
|
901
|
-
cards.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
928
|
+
cards.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", style: { gridAutoRows: "1fr" }, children: cards.map((card, i) => {
|
|
929
|
+
const colSpan = card.featured ? 2 : 1;
|
|
930
|
+
const rowSpan = card.rows || 1;
|
|
931
|
+
return /* @__PURE__ */ jsxs(
|
|
932
|
+
"div",
|
|
933
|
+
{
|
|
934
|
+
style: { gridColumn: `span ${colSpan}`, gridRow: `span ${rowSpan}`, background: card.background || "var(--muted)" },
|
|
935
|
+
className: "rounded-2xl border border-border p-6 flex flex-col gap-3 transition-shadow hover:shadow-md",
|
|
936
|
+
children: [
|
|
937
|
+
card.icon && /* @__PURE__ */ jsx("span", { className: "text-2xl", role: "img", "aria-label": card.title, children: card.icon }),
|
|
938
|
+
card.image && /* @__PURE__ */ jsx("img", { src: card.image, alt: card.imageAlt || card.title || "Feature illustration", className: "w-full rounded-lg object-cover mb-1", style: { maxHeight: card.featured ? "180px" : "120px" } }),
|
|
939
|
+
card.title && /* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm", children: card.title }),
|
|
940
|
+
card.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: card.description })
|
|
941
|
+
]
|
|
942
|
+
},
|
|
943
|
+
i
|
|
944
|
+
);
|
|
945
|
+
}) })
|
|
915
946
|
] }) });
|
|
916
947
|
}
|
|
917
948
|
function MinimalHeroBlock({ block }) {
|
|
@@ -1200,31 +1231,37 @@ function TwoColumnBlock({ block }) {
|
|
|
1200
1231
|
function BentoGridBlock({ block }) {
|
|
1201
1232
|
const d = getData(block);
|
|
1202
1233
|
const items = Array.isArray(d.items) ? d.items : [];
|
|
1203
|
-
const
|
|
1204
|
-
small:
|
|
1205
|
-
wide:
|
|
1206
|
-
tall:
|
|
1207
|
-
large:
|
|
1234
|
+
const SPAN = {
|
|
1235
|
+
small: [1, 1],
|
|
1236
|
+
wide: [2, 1],
|
|
1237
|
+
tall: [1, 2],
|
|
1238
|
+
large: [2, 2],
|
|
1239
|
+
"wide-2": [2, 2],
|
|
1240
|
+
"wide-3": [2, 3]
|
|
1208
1241
|
};
|
|
1209
1242
|
return /* @__PURE__ */ jsxs("section", { className: "py-12", children: [
|
|
1210
1243
|
(d.title || d.subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
1211
1244
|
d.title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-semibold tracking-tight", children: d.title }),
|
|
1212
1245
|
d.subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children: d.subtitle })
|
|
1213
1246
|
] }),
|
|
1214
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-4
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1247
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-3", style: { gridAutoRows: "180px" }, children: items.map((item, i) => {
|
|
1248
|
+
const [cs, rs] = SPAN[item.size] ?? [1, 1];
|
|
1249
|
+
return /* @__PURE__ */ jsxs(
|
|
1250
|
+
"div",
|
|
1251
|
+
{
|
|
1252
|
+
style: { gridColumn: `span ${cs}`, gridRow: `span ${rs}` },
|
|
1253
|
+
className: "rounded-xl border border-border bg-card p-5 flex flex-col justify-between hover:bg-muted/40 transition-colors",
|
|
1254
|
+
children: [
|
|
1255
|
+
/* @__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" }) }) }),
|
|
1256
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1257
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm", children: item.title }),
|
|
1258
|
+
item.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs mt-0.5 leading-relaxed", children: item.description })
|
|
1259
|
+
] })
|
|
1260
|
+
]
|
|
1261
|
+
},
|
|
1262
|
+
i
|
|
1263
|
+
);
|
|
1264
|
+
}) })
|
|
1228
1265
|
] });
|
|
1229
1266
|
}
|
|
1230
1267
|
function GridLayoutBlock({ block }) {
|