@sprintup-cms/sdk 1.8.46 → 1.8.48

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.
@@ -195,6 +195,35 @@ function createCMSClient(options) {
195
195
  }
196
196
  return getPage(slug);
197
197
  }
198
+ async function getGlobals() {
199
+ const { baseUrl, apiKey, appId } = cfg();
200
+ if (!baseUrl || !apiKey || !appId) {
201
+ return { navigation: null, footer: null };
202
+ }
203
+ try {
204
+ const res = await fetch(`${baseUrl}/api/v1/${appId}/globals`, {
205
+ headers: headers(),
206
+ next: { revalidate: 300, tags: [`cms-globals-${appId}`] }
207
+ });
208
+ if (!res.ok) {
209
+ const [navPages, footerPages] = await Promise.all([
210
+ getPages({ type: "navigation" }),
211
+ getPages({ type: "footer" })
212
+ ]);
213
+ return {
214
+ navigation: navPages[0] ?? null,
215
+ footer: footerPages[0] ?? null
216
+ };
217
+ }
218
+ const json = await res.json();
219
+ return {
220
+ navigation: json.data?.navigation ?? null,
221
+ footer: json.data?.footer ?? null
222
+ };
223
+ } catch {
224
+ return { navigation: null, footer: null };
225
+ }
226
+ }
198
227
  async function getPageType(pageTypeId) {
199
228
  const { baseUrl, apiKey, appId } = cfg();
200
229
  if (!baseUrl || !apiKey || !appId || !pageTypeId) return null;
@@ -260,6 +289,7 @@ function createCMSClient(options) {
260
289
  return {
261
290
  getPages,
262
291
  getPage,
292
+ getGlobals,
263
293
  getBlogPosts,
264
294
  getEvents,
265
295
  getAnnouncements,