@sprintup-cms/sdk 1.9.4 → 1.9.5
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/CHANGELOG.md +41 -0
- package/README.md +113 -8
- package/dist/client.cjs +10 -5
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +15 -1
- package/dist/client.d.ts +15 -1
- package/dist/client.js +10 -5
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +10 -5
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +10 -5
- package/dist/next/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -285,23 +285,28 @@ function createCMSClient(options) {
|
|
|
285
285
|
}
|
|
286
286
|
async function getGlobals() {
|
|
287
287
|
const { baseUrl, appId } = cfg();
|
|
288
|
-
|
|
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
|
|
295
|
+
if (!res.ok) return empty;
|
|
295
296
|
const json = await res.json();
|
|
296
297
|
const navigation = json.data?.navigation ?? null;
|
|
297
|
-
const
|
|
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
|
|
309
|
+
return empty;
|
|
305
310
|
}
|
|
306
311
|
}
|
|
307
312
|
return {
|