@sprintup-cms/sdk 1.8.45 → 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.
- package/dist/client.cjs +30 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +7 -1
- package/dist/client.d.ts +7 -1
- package/dist/client.js +30 -0
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +43 -2
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +43 -2
- package/dist/next/index.js.map +1 -1
- package/dist/react/index.cjs +13 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +13 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/next/index.js
CHANGED
|
@@ -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,
|
|
@@ -794,8 +824,19 @@ function ColumnsBlock({ block }) {
|
|
|
794
824
|
function ContainerBlock({ block }) {
|
|
795
825
|
const d = getData(block);
|
|
796
826
|
const maxW = { sm: "max-w-sm", md: "max-w-md", lg: "max-w-lg", xl: "max-w-xl", "2xl": "max-w-2xl", "4xl": "max-w-4xl", full: "max-w-full" };
|
|
797
|
-
const pad = { none: "", sm: "px-4 py-4", md: "px-6 py-8", lg: "px-8 py-12" };
|
|
798
|
-
|
|
827
|
+
const pad = { none: "px-0 py-0", sm: "px-4 py-4", md: "px-6 py-8", lg: "px-8 py-12" };
|
|
828
|
+
const align = { left: "text-left", center: "text-center", right: "text-right" };
|
|
829
|
+
const style = d.bgColor ? { backgroundColor: d.bgColor } : void 0;
|
|
830
|
+
return /* @__PURE__ */ jsx("section", { style, className: d.bgColor ? "rounded-xl" : "", children: /* @__PURE__ */ jsxs("div", { className: `mx-auto ${maxW[d.maxWidth || "4xl"] ?? "max-w-4xl"} ${pad[d.padding || "md"] ?? "px-6 py-8"} ${align[d.align || "left"] ?? "text-left"}`, children: [
|
|
831
|
+
d.title && /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold tracking-tight text-balance mb-4", children: d.title }),
|
|
832
|
+
d.content && /* @__PURE__ */ jsx(
|
|
833
|
+
"div",
|
|
834
|
+
{
|
|
835
|
+
className: "prose prose-sm max-w-none leading-relaxed",
|
|
836
|
+
dangerouslySetInnerHTML: { __html: d.content }
|
|
837
|
+
}
|
|
838
|
+
)
|
|
839
|
+
] }) });
|
|
799
840
|
}
|
|
800
841
|
function CarouselBlock({ block }) {
|
|
801
842
|
const d = getData(block);
|