@sprintup-cms/sdk 1.8.56 → 1.8.57

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.
@@ -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: 300, tags: [`cms-globals-${appId}`] }
266
+ next: { revalidate: 60, tags: [`cms-globals-${appId}`] }
267
267
  });
268
268
  if (!res.ok) {
269
269
  const [navPages, footerPages] = await Promise.all([
@@ -1155,8 +1155,10 @@ function parseNavItems(html) {
1155
1155
  }
1156
1156
  function CMSHeader({ nav }) {
1157
1157
  if (!nav) return null;
1158
- const structuredBlock = nav.blocks?.[0]?.type === "__structured__" ? nav.blocks[0].content : null;
1159
- const primary = nav.sectionData?.primary ?? structuredBlock?.primary ?? {};
1158
+ const structuredBlock = Array.isArray(nav.blocks) && nav.blocks[0]?.type === "__structured__" ? nav.blocks[0].content : null;
1159
+ const sd = nav.sectionData ?? structuredBlock;
1160
+ if (!sd) return null;
1161
+ const primary = sd.primary ?? {};
1160
1162
  const navItems = parseNavItems(primary.nav_items || "");
1161
1163
  const logoUrl = primary.logo_url || "";
1162
1164
  const logoAlt = primary.logo_alt || "";
@@ -1198,8 +1200,9 @@ function parseLegalLinks(html) {
1198
1200
  }
1199
1201
  function CMSFooter({ footer }) {
1200
1202
  if (!footer) return null;
1201
- const structuredBlock = footer.blocks?.[0]?.type === "__structured__" ? footer.blocks[0].content : null;
1202
- const sd = footer.sectionData ?? structuredBlock ?? {};
1203
+ const structuredBlock = Array.isArray(footer.blocks) && footer.blocks[0]?.type === "__structured__" ? footer.blocks[0].content : null;
1204
+ const sd = footer.sectionData ?? structuredBlock;
1205
+ if (!sd) return null;
1203
1206
  const c = sd.content ?? {};
1204
1207
  const contact = sd.contact ?? {};
1205
1208
  const social = sd.social ?? {};