@sprintup-cms/sdk 1.8.57 → 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/next/index.cjs +101 -84
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +101 -84
- package/dist/next/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.cjs
CHANGED
|
@@ -1151,100 +1151,117 @@ function ServerProductListBlock({ block }) {
|
|
|
1151
1151
|
}) })
|
|
1152
1152
|
] }) });
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
return text.split(/\r?\n/).filter(Boolean).map((line) => {
|
|
1158
|
-
const [label, url] = line.split("|").map((s) => s.trim());
|
|
1159
|
-
return { label: label || "", url: url || "#" };
|
|
1160
|
-
});
|
|
1154
|
+
function getSD(doc) {
|
|
1155
|
+
const structuredBlock = Array.isArray(doc?.blocks) && doc.blocks[0]?.type === "__structured__" ? doc.blocks[0].content : null;
|
|
1156
|
+
return doc?.sectionData ?? structuredBlock ?? null;
|
|
1161
1157
|
}
|
|
1162
1158
|
function CMSHeader({ nav }) {
|
|
1163
|
-
|
|
1164
|
-
const structuredBlock = Array.isArray(nav.blocks) && nav.blocks[0]?.type === "__structured__" ? nav.blocks[0].content : null;
|
|
1165
|
-
const sd = nav.sectionData ?? structuredBlock;
|
|
1159
|
+
const sd = getSD(nav);
|
|
1166
1160
|
if (!sd) return null;
|
|
1167
|
-
const
|
|
1168
|
-
const
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1161
|
+
const logoUrl = sd.logo_url?.trim() || "";
|
|
1162
|
+
const logoAlt = sd.logo_alt?.trim() || "";
|
|
1163
|
+
const items = Array.isArray(sd.items) ? sd.items : [];
|
|
1164
|
+
if (!logoUrl && !logoAlt && items.length === 0) return null;
|
|
1165
|
+
const links = items.filter((i) => i.type === "link" || i.type === "dropdown");
|
|
1166
|
+
const buttons = items.filter((i) => i.type === "button");
|
|
1167
|
+
const btnBase = { textDecoration: "none", padding: "0.4rem 1rem", borderRadius: "6px", fontWeight: 600, fontSize: "0.875rem", whiteSpace: "nowrap", transition: "opacity 0.15s" };
|
|
1168
|
+
const btnVariant = (v) => ({
|
|
1169
|
+
primary: { ...btnBase, background: "var(--foreground, #111)", color: "#fff", border: "1px solid transparent" },
|
|
1170
|
+
outline: { ...btnBase, background: "transparent", color: "var(--foreground, #111)", border: "1px solid var(--border, #e5e7eb)" },
|
|
1171
|
+
ghost: { ...btnBase, background: "transparent", color: "var(--muted-foreground, #6b7280)", border: "none", fontWeight: 500 }
|
|
1172
|
+
})[v] ?? btnBase;
|
|
1173
|
+
return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "0 1.5rem", height: "64px", display: "flex", alignItems: "center", justifyContent: "space-between", gap: "2rem" }, children: [
|
|
1174
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "/", style: { display: "flex", alignItems: "center", gap: "0.5rem", textDecoration: "none", flexShrink: 0 }, children: logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoUrl, alt: logoAlt || "Logo", style: { height: "32px", width: "auto", display: "block" } }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700, fontSize: "1.125rem", color: "var(--foreground, #111)" }, children: logoAlt }) }),
|
|
1175
|
+
links.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("nav", { style: { display: "flex", alignItems: "center", gap: "1.75rem", flex: 1 }, children: links.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1176
|
+
"a",
|
|
1177
|
+
{
|
|
1178
|
+
href: item.url || "#",
|
|
1179
|
+
target: item.openInNewTab ? "_blank" : void 0,
|
|
1180
|
+
rel: item.openInNewTab ? "noopener noreferrer" : void 0,
|
|
1181
|
+
style: { fontSize: "0.9rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none", fontWeight: 500 },
|
|
1182
|
+
children: item.label
|
|
1183
|
+
},
|
|
1184
|
+
item.id
|
|
1185
|
+
)) }),
|
|
1186
|
+
buttons.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", gap: "0.625rem", flexShrink: 0 }, children: buttons.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1187
|
+
"a",
|
|
1188
|
+
{
|
|
1189
|
+
href: item.url || "#",
|
|
1190
|
+
target: item.openInNewTab ? "_blank" : void 0,
|
|
1191
|
+
rel: item.openInNewTab ? "noopener noreferrer" : void 0,
|
|
1192
|
+
style: btnVariant(item.variant || "ghost"),
|
|
1193
|
+
children: item.label
|
|
1194
|
+
},
|
|
1195
|
+
item.id
|
|
1196
|
+
)) })
|
|
1178
1197
|
] }) });
|
|
1179
1198
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
const parts = line.split("|").map((s) => s.trim());
|
|
1188
|
-
if (parts.length === 1) {
|
|
1189
|
-
if (current) cols.push(current);
|
|
1190
|
-
current = { title: parts[0], links: [] };
|
|
1191
|
-
} else if (parts.length >= 2) {
|
|
1192
|
-
if (!current) current = { title: "", links: [] };
|
|
1193
|
-
current.links.push({ label: parts[0], url: parts[1] || "#" });
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
if (current) cols.push(current);
|
|
1197
|
-
return cols;
|
|
1198
|
-
}
|
|
1199
|
-
function parseLegalLinks(html) {
|
|
1200
|
-
if (!html) return [];
|
|
1201
|
-
const text = html.replace(/<[^>]*>/g, "").replace(/ /g, " ");
|
|
1202
|
-
return text.split(/\r?\n/).filter(Boolean).map((line) => {
|
|
1203
|
-
const [label, url] = line.split("|").map((s) => s.trim());
|
|
1204
|
-
return { label: label || "", url: url || "#" };
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1199
|
+
var SOCIAL_ICONS = [
|
|
1200
|
+
{ key: "facebook", label: "Facebook", d: "M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z" },
|
|
1201
|
+
{ key: "twitter", label: "X", d: "M18 6L6 18M6 6l12 12" },
|
|
1202
|
+
{ 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" },
|
|
1203
|
+
{ 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" },
|
|
1204
|
+
{ 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" }
|
|
1205
|
+
];
|
|
1207
1206
|
function CMSFooter({ footer }) {
|
|
1208
|
-
|
|
1209
|
-
const structuredBlock = Array.isArray(footer.blocks) && footer.blocks[0]?.type === "__structured__" ? footer.blocks[0].content : null;
|
|
1210
|
-
const sd = footer.sectionData ?? structuredBlock;
|
|
1207
|
+
const sd = getSD(footer);
|
|
1211
1208
|
if (!sd) return null;
|
|
1212
|
-
const
|
|
1213
|
-
const
|
|
1214
|
-
const social = sd.social
|
|
1215
|
-
const
|
|
1216
|
-
const
|
|
1217
|
-
const
|
|
1218
|
-
const
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1209
|
+
const brand = sd.brand || {};
|
|
1210
|
+
const columns = Array.isArray(sd.columns) ? sd.columns : [];
|
|
1211
|
+
const social = sd.social || {};
|
|
1212
|
+
const contact = sd.contact || {};
|
|
1213
|
+
const legal = sd.legal || {};
|
|
1214
|
+
const hasBrand = brand.logo_url || brand.tagline;
|
|
1215
|
+
const hasContact = contact.email || contact.phone || contact.address;
|
|
1216
|
+
const hasSocial = SOCIAL_ICONS.some((s) => social[s.key]?.trim());
|
|
1217
|
+
const hasBottom = legal.copyright || Array.isArray(legal.links) && legal.links.length > 0;
|
|
1218
|
+
const hasContent = hasBrand || columns.length > 0 || hasContact;
|
|
1219
|
+
if (!hasContent && !hasSocial && !hasBottom) return null;
|
|
1220
|
+
const totalCols = [hasBrand, ...columns.map(() => true), hasContact].filter(Boolean).length;
|
|
1221
|
+
const gridCols = totalCols <= 1 ? "1fr" : totalCols === 2 ? "repeat(2,1fr)" : totalCols === 3 ? "repeat(3,1fr)" : "repeat(4,1fr)";
|
|
1222
|
+
const mutedLink = { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" };
|
|
1223
|
+
return /* @__PURE__ */ jsxRuntime.jsx("footer", { style: { borderTop: "1px solid var(--border, #e5e7eb)", background: "var(--muted, #f9fafb)", marginTop: "4rem" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "3rem 1.5rem 1.5rem" }, children: [
|
|
1224
|
+
hasContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gridTemplateColumns: gridCols, gap: "2.5rem", marginBottom: hasSocial || hasBottom ? "2.5rem" : 0 }, children: [
|
|
1225
|
+
hasBrand && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
|
|
1226
|
+
brand.logo_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: brand.logo_url, alt: "Logo", style: { height: "32px", width: "auto", objectFit: "contain" } }),
|
|
1227
|
+
brand.tagline && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", lineHeight: 1.6, margin: 0 }, children: brand.tagline })
|
|
1226
1228
|
] }),
|
|
1227
|
-
columns.map((col
|
|
1228
|
-
col.title && /* @__PURE__ */ jsxRuntime.jsx("h4", {
|
|
1229
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", {
|
|
1230
|
-
] },
|
|
1231
|
-
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsx("h4", {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1229
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1230
|
+
col.title && /* @__PURE__ */ jsxRuntime.jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: col.title }),
|
|
1231
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.url || "#", style: mutedLink, children: link.label }) }, link.id || link.label)) })
|
|
1232
|
+
] }, col.id || col.title)),
|
|
1233
|
+
hasContact && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1234
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: "Contact" }),
|
|
1235
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
|
|
1236
|
+
contact.email && /* @__PURE__ */ jsxRuntime.jsx("a", { href: `mailto:${contact.email}`, style: mutedLink, children: contact.email }),
|
|
1237
|
+
contact.phone && /* @__PURE__ */ jsxRuntime.jsx("a", { href: `tel:${contact.phone}`, style: mutedLink, children: contact.phone }),
|
|
1238
|
+
contact.address && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { ...mutedLink, whiteSpace: "pre-line", margin: 0 }, children: contact.address })
|
|
1239
|
+
] })
|
|
1236
1240
|
] })
|
|
1237
1241
|
] }),
|
|
1238
|
-
hasSocial && /* @__PURE__ */ jsxRuntime.
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1242
|
+
hasSocial && /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
1243
|
+
"a",
|
|
1244
|
+
{
|
|
1245
|
+
href: social[s.key],
|
|
1246
|
+
target: "_blank",
|
|
1247
|
+
rel: "noopener noreferrer",
|
|
1248
|
+
"aria-label": s.label,
|
|
1249
|
+
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 },
|
|
1250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: s.d }) })
|
|
1251
|
+
},
|
|
1252
|
+
s.key
|
|
1253
|
+
)) }),
|
|
1254
|
+
hasBottom && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { borderTop: "1px solid var(--border, #e5e7eb)", paddingTop: "1.25rem", display: "flex", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: "1rem" }, children: [
|
|
1255
|
+
legal.copyright && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", margin: 0 }, children: legal.copyright }),
|
|
1256
|
+
Array.isArray(legal.links) && legal.links.filter((l) => l.label).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "1.25rem" }, children: legal.links.filter((l) => l.label).map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
|
+
"a",
|
|
1258
|
+
{
|
|
1259
|
+
href: link.url || "#",
|
|
1260
|
+
style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" },
|
|
1261
|
+
children: link.label
|
|
1262
|
+
},
|
|
1263
|
+
link.id || link.label
|
|
1264
|
+
)) })
|
|
1248
1265
|
] })
|
|
1249
1266
|
] }) });
|
|
1250
1267
|
}
|