@sprintup-cms/sdk 1.8.56 → 1.8.59
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 +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +104 -84
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +104 -84
- package/dist/next/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -263,7 +263,7 @@ function createCMSClient(options) {
|
|
|
263
263
|
try {
|
|
264
264
|
const res = await fetch(`${baseUrl}/api/v1/${appId}/globals`, {
|
|
265
265
|
headers: headers(),
|
|
266
|
-
next: { revalidate:
|
|
266
|
+
next: { revalidate: 60, tags: [`cms-globals-${appId}`] }
|
|
267
267
|
});
|
|
268
268
|
if (!res.ok) {
|
|
269
269
|
const [navPages, footerPages] = await Promise.all([
|
|
@@ -1145,97 +1145,117 @@ function ServerProductListBlock({ block }) {
|
|
|
1145
1145
|
}) })
|
|
1146
1146
|
] }) });
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
return text.split(/\r?\n/).filter(Boolean).map((line) => {
|
|
1152
|
-
const [label, url] = line.split("|").map((s) => s.trim());
|
|
1153
|
-
return { label: label || "", url: url || "#" };
|
|
1154
|
-
});
|
|
1148
|
+
function getSD(doc) {
|
|
1149
|
+
const structuredBlock = Array.isArray(doc?.blocks) && doc.blocks[0]?.type === "__structured__" ? doc.blocks[0].content : null;
|
|
1150
|
+
return doc?.sectionData ?? structuredBlock ?? null;
|
|
1155
1151
|
}
|
|
1156
1152
|
function CMSHeader({ nav }) {
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1160
|
-
const
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1153
|
+
const sd = getSD(nav);
|
|
1154
|
+
if (!sd) return null;
|
|
1155
|
+
const logoUrl = sd.logo_url?.trim() || "";
|
|
1156
|
+
const logoAlt = sd.logo_alt?.trim() || "";
|
|
1157
|
+
const items = Array.isArray(sd.items) ? sd.items : [];
|
|
1158
|
+
if (!logoUrl && !logoAlt && items.length === 0) return null;
|
|
1159
|
+
const links = items.filter((i) => i.type === "link" || i.type === "dropdown");
|
|
1160
|
+
const buttons = items.filter((i) => i.type === "button");
|
|
1161
|
+
const btnBase = { textDecoration: "none", padding: "0.4rem 1rem", borderRadius: "6px", fontWeight: 600, fontSize: "0.875rem", whiteSpace: "nowrap", transition: "opacity 0.15s" };
|
|
1162
|
+
const btnVariant = (v) => ({
|
|
1163
|
+
primary: { ...btnBase, background: "var(--foreground, #111)", color: "#fff", border: "1px solid transparent" },
|
|
1164
|
+
outline: { ...btnBase, background: "transparent", color: "var(--foreground, #111)", border: "1px solid var(--border, #e5e7eb)" },
|
|
1165
|
+
ghost: { ...btnBase, background: "transparent", color: "var(--muted-foreground, #6b7280)", border: "none", fontWeight: 500 }
|
|
1166
|
+
})[v] ?? btnBase;
|
|
1167
|
+
return /* @__PURE__ */ jsx("header", { style: { position: "sticky", top: 0, zIndex: 50, width: "100%", borderBottom: "1px solid var(--border, #e5e7eb)", background: "rgba(255,255,255,0.97)", backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)" }, children: /* @__PURE__ */ jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "0 1.5rem", height: "64px", display: "flex", alignItems: "center", justifyContent: "space-between", gap: "2rem" }, children: [
|
|
1168
|
+
/* @__PURE__ */ jsx("a", { href: "/", style: { display: "flex", alignItems: "center", gap: "0.5rem", textDecoration: "none", flexShrink: 0 }, children: logoUrl ? /* @__PURE__ */ jsx("img", { src: logoUrl, alt: logoAlt || "Logo", style: { height: "32px", width: "auto", display: "block" } }) : /* @__PURE__ */ jsx("span", { style: { fontWeight: 700, fontSize: "1.125rem", color: "var(--foreground, #111)" }, children: logoAlt }) }),
|
|
1169
|
+
links.length > 0 && /* @__PURE__ */ jsx("nav", { style: { display: "flex", alignItems: "center", gap: "1.75rem", flex: 1 }, children: links.map((item) => /* @__PURE__ */ jsx(
|
|
1170
|
+
"a",
|
|
1171
|
+
{
|
|
1172
|
+
href: item.url || "#",
|
|
1173
|
+
target: item.openInNewTab ? "_blank" : void 0,
|
|
1174
|
+
rel: item.openInNewTab ? "noopener noreferrer" : void 0,
|
|
1175
|
+
style: { fontSize: "0.9rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none", fontWeight: 500 },
|
|
1176
|
+
children: item.label
|
|
1177
|
+
},
|
|
1178
|
+
item.id
|
|
1179
|
+
)) }),
|
|
1180
|
+
buttons.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "0.625rem", flexShrink: 0 }, children: buttons.map((item) => /* @__PURE__ */ jsx(
|
|
1181
|
+
"a",
|
|
1182
|
+
{
|
|
1183
|
+
href: item.url || "#",
|
|
1184
|
+
target: item.openInNewTab ? "_blank" : void 0,
|
|
1185
|
+
rel: item.openInNewTab ? "noopener noreferrer" : void 0,
|
|
1186
|
+
style: btnVariant(item.variant || "ghost"),
|
|
1187
|
+
children: item.label
|
|
1188
|
+
},
|
|
1189
|
+
item.id
|
|
1190
|
+
)) })
|
|
1170
1191
|
] }) });
|
|
1171
1192
|
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
const parts = line.split("|").map((s) => s.trim());
|
|
1180
|
-
if (parts.length === 1) {
|
|
1181
|
-
if (current) cols.push(current);
|
|
1182
|
-
current = { title: parts[0], links: [] };
|
|
1183
|
-
} else if (parts.length >= 2) {
|
|
1184
|
-
if (!current) current = { title: "", links: [] };
|
|
1185
|
-
current.links.push({ label: parts[0], url: parts[1] || "#" });
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
if (current) cols.push(current);
|
|
1189
|
-
return cols;
|
|
1190
|
-
}
|
|
1191
|
-
function parseLegalLinks(html) {
|
|
1192
|
-
if (!html) return [];
|
|
1193
|
-
const text = html.replace(/<[^>]*>/g, "").replace(/ /g, " ");
|
|
1194
|
-
return text.split(/\r?\n/).filter(Boolean).map((line) => {
|
|
1195
|
-
const [label, url] = line.split("|").map((s) => s.trim());
|
|
1196
|
-
return { label: label || "", url: url || "#" };
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1193
|
+
var SOCIAL_ICONS = [
|
|
1194
|
+
{ key: "facebook", label: "Facebook", d: "M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z" },
|
|
1195
|
+
{ key: "twitter", label: "X", d: "M18 6L6 18M6 6l12 12" },
|
|
1196
|
+
{ key: "instagram", label: "Instagram", d: "M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37zm1.5-4.87h.01M6.5 2h11A4.5 4.5 0 0 1 22 6.5v11A4.5 4.5 0 0 1 17.5 22h-11A4.5 4.5 0 0 1 2 17.5v-11A4.5 4.5 0 0 1 6.5 2z" },
|
|
1197
|
+
{ key: "linkedin", label: "LinkedIn", d: "M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-4 0v7h-4v-7a6 6 0 0 1 6-6zM2 9h4v12H2zm2-3a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" },
|
|
1198
|
+
{ key: "youtube", label: "YouTube", d: "M22.54 6.42a2.78 2.78 0 0 0-1.94-1.96C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 1.96A29 29 0 0 0 1 12a29 29 0 0 0 .46 5.58 2.78 2.78 0 0 0 1.94 1.96C5.12 20 12 20 12 20s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-1.96A29 29 0 0 0 23 12a29 29 0 0 0-.46-5.58zM9.75 15.02V8.98L15.5 12l-5.75 3.02z" }
|
|
1199
|
+
];
|
|
1199
1200
|
function CMSFooter({ footer }) {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
const
|
|
1203
|
-
const
|
|
1204
|
-
const
|
|
1205
|
-
const
|
|
1206
|
-
const legal = sd.legal
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1209
|
-
const hasSocial =
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1201
|
+
const sd = getSD(footer);
|
|
1202
|
+
if (!sd) return null;
|
|
1203
|
+
const brand = sd.brand || {};
|
|
1204
|
+
const columns = Array.isArray(sd.columns) ? sd.columns : [];
|
|
1205
|
+
const social = sd.social || {};
|
|
1206
|
+
const contact = sd.contact || {};
|
|
1207
|
+
const legal = sd.legal || {};
|
|
1208
|
+
const hasBrand = brand.logo_url || brand.tagline;
|
|
1209
|
+
const hasContact = contact.email || contact.phone || contact.address;
|
|
1210
|
+
const hasSocial = SOCIAL_ICONS.some((s) => social[s.key]?.trim());
|
|
1211
|
+
const hasBottom = legal.copyright || Array.isArray(legal.links) && legal.links.length > 0;
|
|
1212
|
+
const hasContent = hasBrand || columns.length > 0 || hasContact;
|
|
1213
|
+
if (!hasContent && !hasSocial && !hasBottom) return null;
|
|
1214
|
+
const totalCols = [hasBrand, ...columns.map(() => true), hasContact].filter(Boolean).length;
|
|
1215
|
+
const gridCols = totalCols <= 1 ? "1fr" : totalCols === 2 ? "repeat(2,1fr)" : totalCols === 3 ? "repeat(3,1fr)" : "repeat(4,1fr)";
|
|
1216
|
+
const mutedLink = { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" };
|
|
1217
|
+
return /* @__PURE__ */ jsx("footer", { style: { borderTop: "1px solid var(--border, #e5e7eb)", background: "var(--muted, #f9fafb)", marginTop: "4rem" }, children: /* @__PURE__ */ jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "3rem 1.5rem 1.5rem" }, children: [
|
|
1218
|
+
hasContent && /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: gridCols, gap: "2.5rem", marginBottom: hasSocial || hasBottom ? "2.5rem" : 0 }, children: [
|
|
1219
|
+
hasBrand && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
|
|
1220
|
+
brand.logo_url && /* @__PURE__ */ jsx("img", { src: brand.logo_url, alt: "Logo", style: { height: "32px", width: "auto", objectFit: "contain" } }),
|
|
1221
|
+
brand.tagline && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", lineHeight: 1.6, margin: 0 }, children: brand.tagline })
|
|
1217
1222
|
] }),
|
|
1218
|
-
columns.map((col
|
|
1219
|
-
col.title && /* @__PURE__ */ jsx("h4", {
|
|
1220
|
-
/* @__PURE__ */ jsx("ul", {
|
|
1221
|
-
] },
|
|
1222
|
-
|
|
1223
|
-
/* @__PURE__ */ jsx("h4", {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1223
|
+
columns.map((col) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1224
|
+
col.title && /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: col.title }),
|
|
1225
|
+
/* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "0.5rem" }, children: (col.links || []).filter((l) => l.label).map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: link.url || "#", style: mutedLink, children: link.label }) }, link.id || link.label)) })
|
|
1226
|
+
] }, col.id || col.title)),
|
|
1227
|
+
hasContact && /* @__PURE__ */ jsxs("div", { children: [
|
|
1228
|
+
/* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: "Contact" }),
|
|
1229
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
|
|
1230
|
+
contact.email && /* @__PURE__ */ jsx("a", { href: `mailto:${contact.email}`, style: mutedLink, children: contact.email }),
|
|
1231
|
+
contact.phone && /* @__PURE__ */ jsx("a", { href: `tel:${contact.phone}`, style: mutedLink, children: contact.phone }),
|
|
1232
|
+
contact.address && /* @__PURE__ */ jsx("p", { style: { ...mutedLink, whiteSpace: "pre-line", margin: 0 }, children: contact.address })
|
|
1233
|
+
] })
|
|
1227
1234
|
] })
|
|
1228
1235
|
] }),
|
|
1229
|
-
hasSocial && /* @__PURE__ */
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1236
|
+
hasSocial && /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.75rem", marginBottom: hasBottom ? "1.5rem" : 0 }, children: SOCIAL_ICONS.filter((s) => social[s.key]?.trim()).map((s) => /* @__PURE__ */ jsx(
|
|
1237
|
+
"a",
|
|
1238
|
+
{
|
|
1239
|
+
href: social[s.key],
|
|
1240
|
+
target: "_blank",
|
|
1241
|
+
rel: "noopener noreferrer",
|
|
1242
|
+
"aria-label": s.label,
|
|
1243
|
+
style: { display: "flex", alignItems: "center", justifyContent: "center", width: "36px", height: "36px", borderRadius: "8px", border: "1px solid var(--border, #e5e7eb)", color: "var(--muted-foreground, #6b7280)", textDecoration: "none", flexShrink: 0 },
|
|
1244
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: s.d }) })
|
|
1245
|
+
},
|
|
1246
|
+
s.key
|
|
1247
|
+
)) }),
|
|
1248
|
+
hasBottom && /* @__PURE__ */ jsxs("div", { style: { borderTop: "1px solid var(--border, #e5e7eb)", paddingTop: "1.25rem", display: "flex", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: "1rem" }, children: [
|
|
1249
|
+
legal.copyright && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", margin: 0 }, children: legal.copyright }),
|
|
1250
|
+
Array.isArray(legal.links) && legal.links.filter((l) => l.label).length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "1.25rem" }, children: legal.links.filter((l) => l.label).map((link) => /* @__PURE__ */ jsx(
|
|
1251
|
+
"a",
|
|
1252
|
+
{
|
|
1253
|
+
href: link.url || "#",
|
|
1254
|
+
style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" },
|
|
1255
|
+
children: link.label
|
|
1256
|
+
},
|
|
1257
|
+
link.id || link.label
|
|
1258
|
+
)) })
|
|
1239
1259
|
] })
|
|
1240
1260
|
] }) });
|
|
1241
1261
|
}
|