@builder.io/sdk-react-nextjs 0.14.7 → 0.14.8
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/lib/browser/{USE_CLIENT_BUNDLE-9a694813.cjs → USE_CLIENT_BUNDLE-2046b4f7.cjs} +1 -1
- package/lib/{node/USE_CLIENT_BUNDLE-04e65a8b.js → browser/USE_CLIENT_BUNDLE-78517750.js} +2 -2
- package/lib/{edge/USE_SERVER_BUNDLE-536a078a.js → browser/USE_SERVER_BUNDLE-29f23050.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-0165e9c2.cjs → browser/USE_SERVER_BUNDLE-d3d0c3a5.cjs} +1 -1
- package/lib/browser/{bundle-187b6567.js → bundle-d78727c9.js} +92 -88
- package/lib/browser/{bundle-f2d9f409.cjs → bundle-eca4b0ba.cjs} +12 -11
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{browser/USE_CLIENT_BUNDLE-f0eac1bb.js → edge/USE_CLIENT_BUNDLE-01cf3cc1.js} +2 -2
- package/lib/{node/USE_CLIENT_BUNDLE-4e14ccee.cjs → edge/USE_CLIENT_BUNDLE-23418377.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-dee3041b.js → edge/USE_SERVER_BUNDLE-2cb317bc.js} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-6f53d199.cjs → edge/USE_SERVER_BUNDLE-7cb08770.cjs} +1 -1
- package/lib/edge/{bundle-f84983cc.cjs → bundle-07c68bbe.cjs} +19 -18
- package/lib/edge/{bundle-d26182eb.js → bundle-7da386a2.js} +199 -195
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-7cf0df22.js → node/USE_CLIENT_BUNDLE-690f58c3.js} +2 -2
- package/lib/{edge/USE_CLIENT_BUNDLE-bda05805.cjs → node/USE_CLIENT_BUNDLE-f9317c5f.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-280036e3.js → node/USE_SERVER_BUNDLE-649f2942.js} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-ea761ee7.cjs → node/USE_SERVER_BUNDLE-e8d80664.cjs} +1 -1
- package/lib/node/{bundle-29f6bee7.js → bundle-001f0cdc.js} +45 -41
- package/lib/node/{bundle-b303d0db.cjs → bundle-77f045ce.cjs} +8 -7
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/components/content/components/enable-editor.d.ts +1 -1
- package/types/cjs/components/content/components/styles.d.ts +1 -0
- package/types/cjs/components/content/components/styles.helpers.d.ts +1 -0
- package/types/cjs/components/content/contentProps.types.d.ts +6 -1
- package/types/cjs/components/content-variants/content-variants.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/components/content/components/enable-editor.d.ts +1 -1
- package/types/esm/components/content/components/styles.d.ts +1 -0
- package/types/esm/components/content/components/styles.helpers.d.ts +1 -0
- package/types/esm/components/content/contentProps.types.d.ts +6 -1
- package/types/esm/components/content-variants/content-variants.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-23418377.cjs"),e=require("./bundle-07c68bbe.cjs");require("react/jsx-runtime");require("react");require("./USE_SERVER_BUNDLE-7cb08770.cjs");require("next/navigation");require("lru-cache");exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as n, F as m, d as c, S as p, V as g } from "./USE_CLIENT_BUNDLE-
|
|
2
|
-
import { B as l, C as u, w as E, S, T as f, F as B, p as C, E as h, G as x, q as b, z as y, c as F, j as P, x as T, y as k, D as w, A as R } from "./bundle-
|
|
1
|
+
import { c as n, F as m, d as c, S as p, V as g } from "./USE_CLIENT_BUNDLE-01cf3cc1.js";
|
|
2
|
+
import { B as l, C as u, w as E, S, T as f, F as B, p as C, E as h, G as x, q as b, z as y, c as F, j as P, x as T, y as k, D as w, A as R } from "./bundle-7da386a2.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./USE_SERVER_BUNDLE-
|
|
5
|
+
import "./USE_SERVER_BUNDLE-2cb317bc.js";
|
|
6
6
|
import "next/navigation";
|
|
7
7
|
import "lru-cache";
|
|
8
8
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as c, Fragment as C, jsxs as E } from "react/jsx-runtime";
|
|
3
|
-
import { i as p, g as H, a as $, b as O, c as w, d as R, e as ee, f as P, h as V, _ as D, j as te, l as ne, k as ie, t as ae, m as U, n as ce, o as re, r as le, s as oe, p as de, q as se, u as ue } from "./bundle-
|
|
3
|
+
import { i as p, g as H, a as $, b as O, c as w, d as R, e as ee, f as P, h as V, _ as D, j as te, l as ne, k as ie, t as ae, m as U, n as ce, o as re, r as le, s as oe, p as de, q as se, u as ue } from "./bundle-001f0cdc.js";
|
|
4
4
|
import { useRef as T, useState as v, useEffect as b, createContext as me, createElement as ge } from "react";
|
|
5
|
-
import { p as be } from "./USE_SERVER_BUNDLE-
|
|
5
|
+
import { p as be } from "./USE_SERVER_BUNDLE-649f2942.js";
|
|
6
6
|
import { useRouter as he } from "next/navigation";
|
|
7
7
|
function J(e) {
|
|
8
8
|
return /* @__PURE__ */ c(C, { children: p(e.TagName) ? /* @__PURE__ */ c(C, { children: /* @__PURE__ */ c(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ c(C, { children: typeof e.TagName == "string" ? /* @__PURE__ */ c(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ c(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";const n=require("react/jsx-runtime"),a=require("./bundle-
|
|
1
|
+
"use client";"use strict";const n=require("react/jsx-runtime"),a=require("./bundle-77f045ce.cjs"),r=require("react"),D=require("./USE_SERVER_BUNDLE-e8d80664.cjs"),V=require("next/navigation");function E(e){return n.jsx(n.Fragment,{children:a.isEmptyElement(e.TagName)?n.jsx(n.Fragment,{children:n.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):n.jsx(n.Fragment,{children:typeof e.TagName=="string"?n.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):n.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function H(e){return n.jsx(E,{attributes:{...e.attributes,[a.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[a.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function U(e){return n.jsx(E,{TagName:e.Wrapper,attributes:a.getBlockProperties({block:e.block,context:e.context}),actionAttributes:a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function $(e){return n.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...a.getBlockProperties({block:e.block,context:e.context}),...a.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}function O(e){function o(){var l;return"builder-blocks"+((l=e.blocks)!=null&&l.length?"":" no-blocks")}function g(){var l,m;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((m=window.parent)==null||m.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var l,m;a.isEditing()&&!((l=e.blocks)!=null&&l.length)&&((m=window.parent)==null||m.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return n.jsxs(n.Fragment,{children:[n.jsx(e.BlocksWrapper,{className:o()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:l=>g(),onMouseEnter:l=>S(),onKeyPress:l=>g(),...e.BlocksWrapperProps,children:e.children}),n.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-77f045ce.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { LRUCache } from "lru-cache";
|
|
4
|
-
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-
|
|
4
|
+
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, D as DynamicRenderer, C as CustomCode, E as Embed, b as ImgComponent, V as Video, c as Button, F as FragmentComponent, d as Image, S as SectionComponent, e as EnableEditor } from "./USE_CLIENT_BUNDLE-690f58c3.js";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase()), TARGET = "rsc", getClassPropName = () => {
|
|
7
7
|
switch (TARGET) {
|
|
@@ -231,14 +231,14 @@ output;
|
|
|
231
231
|
}), l.setSync(BUILDER_SET_STATE_NAME, function(m, u) {
|
|
232
232
|
set(a, m, u), i == null || i(a);
|
|
233
233
|
}), d.forEach(([m, u]) => {
|
|
234
|
-
const
|
|
234
|
+
const y = typeof u == "object" ? new s.Reference(
|
|
235
235
|
// workaround: methods with default values for arguments is not being cloned over
|
|
236
236
|
m === "builder" ? {
|
|
237
237
|
...u,
|
|
238
238
|
getUserAttributes: () => u.getUserAttributes()
|
|
239
239
|
} : u
|
|
240
240
|
) : null;
|
|
241
|
-
l.setSync(getSyncValName(m),
|
|
241
|
+
l.setSync(getSyncValName(m), y);
|
|
242
242
|
}), l.setSync(INJECTED_IVM_GLOBAL, s);
|
|
243
243
|
const f = processCode({
|
|
244
244
|
code: e,
|
|
@@ -736,14 +736,14 @@ function Block(e) {
|
|
|
736
736
|
var p;
|
|
737
737
|
return !((p = t()) != null && p.component) && !n() ? o().children ?? [] : [];
|
|
738
738
|
}, s = function() {
|
|
739
|
-
var f, p, m, u,
|
|
739
|
+
var f, p, m, u, y, h, S, k, b, C;
|
|
740
740
|
return {
|
|
741
741
|
blockChildren: o().children ?? [],
|
|
742
742
|
componentRef: (f = t()) == null ? void 0 : f.component,
|
|
743
743
|
componentOptions: {
|
|
744
744
|
...getBlockComponentOptions(o()),
|
|
745
745
|
builderContext: e.context,
|
|
746
|
-
...((p = t()) == null ? void 0 : p.name) === "Core:Button" || ((m = t()) == null ? void 0 : m.name) === "Symbol" || ((u = t()) == null ? void 0 : u.name) === "Columns" || ((
|
|
746
|
+
...((p = t()) == null ? void 0 : p.name) === "Core:Button" || ((m = t()) == null ? void 0 : m.name) === "Symbol" || ((u = t()) == null ? void 0 : u.name) === "Columns" || ((y = t()) == null ? void 0 : y.name) === "Form:Form" ? {
|
|
747
747
|
builderLinkComponent: e.linkComponent
|
|
748
748
|
} : {},
|
|
749
749
|
...((h = t()) == null ? void 0 : h.name) === "Symbol" || ((S = t()) == null ? void 0 : S.name) === "Columns" || ((k = t()) == null ? void 0 : k.name) === "Form:Form" ? {
|
|
@@ -754,7 +754,7 @@ function Block(e) {
|
|
|
754
754
|
linkComponent: e.linkComponent,
|
|
755
755
|
registeredComponents: e.registeredComponents,
|
|
756
756
|
builderBlock: o(),
|
|
757
|
-
includeBlockProps: ((
|
|
757
|
+
includeBlockProps: ((b = t()) == null ? void 0 : b.noWrap) === !0,
|
|
758
758
|
isInteractive: !((C = t()) != null && C.isRSC)
|
|
759
759
|
};
|
|
760
760
|
};
|
|
@@ -846,21 +846,21 @@ function Blocks(e) {
|
|
|
846
846
|
function Columns(e) {
|
|
847
847
|
var p;
|
|
848
848
|
const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(u) {
|
|
849
|
-
var
|
|
850
|
-
return ((
|
|
849
|
+
var y;
|
|
850
|
+
return ((y = n[u]) == null ? void 0 : y.width) || 100 / n.length;
|
|
851
851
|
}, i = function(u) {
|
|
852
|
-
const
|
|
853
|
-
return `calc(${r(u)}% - ${
|
|
852
|
+
const y = t * (n.length - 1) / n.length;
|
|
853
|
+
return `calc(${r(u)}% - ${y}px)`;
|
|
854
854
|
}, a = function({
|
|
855
855
|
stackedStyle: u,
|
|
856
|
-
desktopStyle:
|
|
856
|
+
desktopStyle: y
|
|
857
857
|
}) {
|
|
858
|
-
return o === "tablet" ? u :
|
|
858
|
+
return o === "tablet" ? u : y;
|
|
859
859
|
}, s = function({
|
|
860
860
|
stackedStyle: u,
|
|
861
|
-
desktopStyle:
|
|
861
|
+
desktopStyle: y
|
|
862
862
|
}) {
|
|
863
|
-
return o === "never" ?
|
|
863
|
+
return o === "never" ? y : u;
|
|
864
864
|
}, c = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column", d = function() {
|
|
865
865
|
return {
|
|
866
866
|
"--flex-dir": c,
|
|
@@ -870,7 +870,7 @@ function Columns(e) {
|
|
|
870
870
|
})
|
|
871
871
|
};
|
|
872
872
|
}, g = function(u) {
|
|
873
|
-
const
|
|
873
|
+
const y = u === 0 ? 0 : t, h = i(u), S = `${y}px`, k = "100%", b = 0;
|
|
874
874
|
return {
|
|
875
875
|
...{
|
|
876
876
|
display: "flex",
|
|
@@ -884,7 +884,7 @@ function Columns(e) {
|
|
|
884
884
|
desktopStyle: h
|
|
885
885
|
}),
|
|
886
886
|
"--column-margin-left-mobile": s({
|
|
887
|
-
stackedStyle:
|
|
887
|
+
stackedStyle: b,
|
|
888
888
|
desktopStyle: S
|
|
889
889
|
}),
|
|
890
890
|
"--column-width-tablet": a({
|
|
@@ -892,7 +892,7 @@ function Columns(e) {
|
|
|
892
892
|
desktopStyle: h
|
|
893
893
|
}),
|
|
894
894
|
"--column-margin-left-tablet": a({
|
|
895
|
-
stackedStyle:
|
|
895
|
+
stackedStyle: b,
|
|
896
896
|
desktopStyle: S
|
|
897
897
|
})
|
|
898
898
|
};
|
|
@@ -2007,26 +2007,26 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
2007
2007
|
throw new Error("Missing API key");
|
|
2008
2008
|
if (!["v3"].includes(c))
|
|
2009
2009
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);
|
|
2010
|
-
const
|
|
2011
|
-
if (h.searchParams.set("apiKey", i), h.searchParams.set("limit", String(t)), h.searchParams.set("noTraverse", String(
|
|
2012
|
-
const
|
|
2010
|
+
const y = t !== 1, h = new URL(`https://cdn.builder.io/api/${c}/content/${r}`);
|
|
2011
|
+
if (h.searchParams.set("apiKey", i), h.searchParams.set("limit", String(t)), h.searchParams.set("noTraverse", String(y)), h.searchParams.set("includeRefs", String(!0)), s && h.searchParams.set("locale", s), a && h.searchParams.set("enrich", String(a)), h.searchParams.set("omit", g || "meta.componentsUsed"), d && h.searchParams.set("fields", d), Number.isFinite(l) && l > -1 && h.searchParams.set("offset", String(Math.floor(l))), typeof u == "boolean" && h.searchParams.set("includeUnpublished", String(u)), f && isPositiveNumber(f) && h.searchParams.set("cacheSeconds", String(f)), p && isPositiveNumber(p) && h.searchParams.set("staleCacheSeconds", String(p)), m) {
|
|
2012
|
+
const b = flatten({
|
|
2013
2013
|
sort: m
|
|
2014
2014
|
});
|
|
2015
|
-
for (const C in
|
|
2016
|
-
h.searchParams.set(C, JSON.stringify(
|
|
2015
|
+
for (const C in b)
|
|
2016
|
+
h.searchParams.set(C, JSON.stringify(b[C]));
|
|
2017
2017
|
}
|
|
2018
2018
|
const S = {
|
|
2019
2019
|
...getBuilderSearchParamsFromWindow(),
|
|
2020
2020
|
...normalizeSearchParams(e.options || {})
|
|
2021
2021
|
}, k = flatten(S);
|
|
2022
|
-
for (const
|
|
2023
|
-
h.searchParams.set(
|
|
2022
|
+
for (const b in k)
|
|
2023
|
+
h.searchParams.set(b, String(k[b]));
|
|
2024
2024
|
if (n && h.searchParams.set("userAttributes", JSON.stringify(n)), o) {
|
|
2025
|
-
const
|
|
2025
|
+
const b = flatten({
|
|
2026
2026
|
query: o
|
|
2027
2027
|
});
|
|
2028
|
-
for (const C in
|
|
2029
|
-
h.searchParams.set(C, JSON.stringify(
|
|
2028
|
+
for (const C in b)
|
|
2029
|
+
h.searchParams.set(C, JSON.stringify(b[C]));
|
|
2030
2030
|
}
|
|
2031
2031
|
return h;
|
|
2032
2032
|
}, checkContentHasResults = (e) => "results" in e;
|
|
@@ -2272,7 +2272,7 @@ function isFromTrustedHost(e, t) {
|
|
|
2272
2272
|
const n = new URL(t.origin), o = n.hostname;
|
|
2273
2273
|
return (e || DEFAULT_TRUSTED_HOSTS).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
|
|
2274
2274
|
}
|
|
2275
|
-
const SDK_VERSION = "0.14.
|
|
2275
|
+
const SDK_VERSION = "0.14.8", registry = {};
|
|
2276
2276
|
function register(e, t) {
|
|
2277
2277
|
let n = registry[e];
|
|
2278
2278
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
|
@@ -2496,17 +2496,7 @@ font-weight: ${a};
|
|
|
2496
2496
|
}, getCss = ({
|
|
2497
2497
|
cssCode: e,
|
|
2498
2498
|
contentId: t
|
|
2499
|
-
}) => e ? t ? (e == null ? void 0 : e.replace(/&/g, `div[builder-content-id="${t}"]`)) || "" : e : ""
|
|
2500
|
-
function ContentStyles(e) {
|
|
2501
|
-
const t = `
|
|
2502
|
-
${getCss({
|
|
2503
|
-
cssCode: e.cssCode,
|
|
2504
|
-
contentId: e.contentId
|
|
2505
|
-
})}
|
|
2506
|
-
${getFontCss({
|
|
2507
|
-
customFonts: e.customFonts
|
|
2508
|
-
})}
|
|
2509
|
-
|
|
2499
|
+
}) => e ? t ? (e == null ? void 0 : e.replace(/&/g, `div[builder-content-id="${t}"]`)) || "" : e : "", DEFAULT_STYLES = `
|
|
2510
2500
|
.builder-button {
|
|
2511
2501
|
all: unset;
|
|
2512
2502
|
}
|
|
@@ -2523,6 +2513,17 @@ ${getFontCss({
|
|
|
2523
2513
|
text-align: inherit;
|
|
2524
2514
|
font-family: inherit;
|
|
2525
2515
|
}
|
|
2516
|
+
`, getDefaultStyles = (e) => e ? "" : DEFAULT_STYLES;
|
|
2517
|
+
function ContentStyles(e) {
|
|
2518
|
+
const t = `
|
|
2519
|
+
${getCss({
|
|
2520
|
+
cssCode: e.cssCode,
|
|
2521
|
+
contentId: e.contentId
|
|
2522
|
+
})}
|
|
2523
|
+
${getFontCss({
|
|
2524
|
+
customFonts: e.customFonts
|
|
2525
|
+
})}
|
|
2526
|
+
${getDefaultStyles(e.isNestedRender)}
|
|
2526
2527
|
`.trim();
|
|
2527
2528
|
return /* @__PURE__ */ jsx(InlinedStyles, { styles: t });
|
|
2528
2529
|
}
|
|
@@ -2624,6 +2625,7 @@ function ContentComponent(e) {
|
|
|
2624
2625
|
/* @__PURE__ */ jsx(
|
|
2625
2626
|
ContentStyles,
|
|
2626
2627
|
{
|
|
2628
|
+
isNestedRender: e.isNestedRender,
|
|
2627
2629
|
contentId: (a = o.content) == null ? void 0 : a.id,
|
|
2628
2630
|
cssCode: (c = (s = o.content) == null ? void 0 : s.data) == null ? void 0 : c.cssCode,
|
|
2629
2631
|
customFonts: (g = (d = o.content) == null ? void 0 : d.data) == null ? void 0 : g.customFonts
|
|
@@ -2669,7 +2671,7 @@ function ContentVariants(e) {
|
|
|
2669
2671
|
});
|
|
2670
2672
|
};
|
|
2671
2673
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2672
|
-
!e.
|
|
2674
|
+
!e.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ jsx(InlinedScript, { scriptStr: getScriptString() }) : null,
|
|
2673
2675
|
t ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2674
2676
|
/* @__PURE__ */ jsx(
|
|
2675
2677
|
InlinedStyles,
|
|
@@ -2682,6 +2684,7 @@ function ContentVariants(e) {
|
|
|
2682
2684
|
(a = getVariants(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ jsx(
|
|
2683
2685
|
ContentComponent,
|
|
2684
2686
|
{
|
|
2687
|
+
isNestedRender: e.isNestedRender,
|
|
2685
2688
|
content: s,
|
|
2686
2689
|
showContent: !1,
|
|
2687
2690
|
model: e.model,
|
|
@@ -2707,6 +2710,7 @@ function ContentVariants(e) {
|
|
|
2707
2710
|
/* @__PURE__ */ jsx(
|
|
2708
2711
|
ContentComponent,
|
|
2709
2712
|
{
|
|
2713
|
+
isNestedRender: e.isNestedRender,
|
|
2710
2714
|
content: r(),
|
|
2711
2715
|
showContent: !0,
|
|
2712
2716
|
model: e.model,
|
|
@@ -2765,7 +2769,7 @@ async function Symbol$1(e) {
|
|
|
2765
2769
|
return /* @__PURE__ */ jsx("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ jsx(
|
|
2766
2770
|
ContentVariants,
|
|
2767
2771
|
{
|
|
2768
|
-
|
|
2772
|
+
isNestedRender: !0,
|
|
2769
2773
|
apiVersion: e.builderContext.apiVersion,
|
|
2770
2774
|
apiKey: e.builderContext.apiKey,
|
|
2771
2775
|
context: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const jsxRuntime=require("react/jsx-runtime");require("react");const lruCache=require("lru-cache"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";const jsxRuntime=require("react/jsx-runtime");require("react");const lruCache=require("lru-cache"),USE_CLIENT_BUNDLE=require("./USE_CLIENT_BUNDLE-f9317c5f.cjs");require("next/navigation");const EMPTY_HTML_ELEMENTS=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),isEmptyElement=e=>typeof e=="string"&&EMPTY_HTML_ELEMENTS.has(e.toLowerCase()),TARGET="rsc",getClassPropName=()=>{switch(TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function getBlockComponentOptions(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}const convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,getSearchString=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(e){return isIframe()&&getSearchString(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||TARGET==="reactNative"}},n=e.match(/Tablet|iPad/i),o=getLocation();return{urlPath:o==null?void 0:o.pathname,host:(o==null?void 0:o.host)||(o==null?void 0:o.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:n,event:o,localState:r,rootSetState:i,rootState:a})=>{const s=getFunctionArguments({builder:t,context:n,event:o,state:flattenState({rootState:a,localState:r,rootSetState:i})});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState({rootState:e,localState:t,rootSetState:n}){return new Proxy(e,{get:(o,r)=>{if(t&&r in t)return t[r];const i=o[r];return typeof i=="object"&&i!==null?flattenState({rootState:i,localState:void 0,rootSetState:n?a=>{o[r]=a,n(o)}:void 0}):i},set:(o,r,i)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return o[r]=i,n==null||n(o),!0}})}const fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,n)=>{if(Object(e)!==e)return e;const o=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return o.slice(0,-1).reduce((r,i,a)=>Object(r[i])===r[i]?r[i]:r[i]=Math.abs(Number(o[a+1]))>>0===+o[a+1]?[]:{},e)[o[o.length-1]]=n,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
2
|
var refToProxy = (obj) => {
|
|
3
3
|
if (typeof obj !== 'object' || obj === null) {
|
|
4
4
|
return obj;
|
|
@@ -171,7 +171,7 @@ output;
|
|
|
171
171
|
)`,getUpdateVariantVisibilityScript=({contentId:e,variationId:t})=>`window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
172
172
|
"${t}", "${e}", ${isHydrationTarget}
|
|
173
173
|
)`;function InlinedScript(e){return jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const getIdFromSearchParams=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||logger.warn("No previewed ID found in search params."),n};function init(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new lruCache.LRUCache({max:500,ttl:1e3*60*5}))}function getPreviewContent(e){init();const t=getIdFromSearchParams(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function getGlobalThis(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function getFetch(){const e=getGlobalThis().fetch;if(typeof e>"u")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
174
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const fetch$1=getFetch();function flatten(e,t=null,n="."){return Object.keys(e).reduce((o,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{const{limit:t=30,userAttributes:n,query:o,model:r,apiKey:i,enrich:a,locale:s,apiVersion:c=DEFAULT_API_VERSION,fields:u,omit:g,offset:l,cacheSeconds:f,staleCacheSeconds:p,sort:m,includeUnpublished:d}=e;if(!i)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const y=t!==1,h=new URL(`https://cdn.builder.io/api/${c}/content/${r}`);if(h.searchParams.set("apiKey",i),h.searchParams.set("limit",String(t)),h.searchParams.set("noTraverse",String(y)),h.searchParams.set("includeRefs",String(!0)),s&&h.searchParams.set("locale",s),a&&h.searchParams.set("enrich",String(a)),h.searchParams.set("omit",g||"meta.componentsUsed"),u&&h.searchParams.set("fields",u),Number.isFinite(l)&&l>-1&&h.searchParams.set("offset",String(Math.floor(l))),typeof d=="boolean"&&h.searchParams.set("includeUnpublished",String(d)),f&&isPositiveNumber(f)&&h.searchParams.set("cacheSeconds",String(f)),p&&isPositiveNumber(p)&&h.searchParams.set("staleCacheSeconds",String(p)),m){const b=flatten({sort:m});for(const x in b)h.searchParams.set(x,JSON.stringify(b[x]))}const S={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(S);for(const b in C)h.searchParams.set(b,String(C[b]));if(n&&h.searchParams.set("userAttributes",JSON.stringify(n)),o){const b=flatten({query:o});for(const x in b)h.searchParams.set(x,JSON.stringify(b[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const _fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}function isPreviewing(e){if(!isBrowser())return!1;const t=getSearchString(e||window.location.search);return isEditing(t)?!1:t.indexOf("builder.preview=")!==-1}function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(r){console.debug("[LocalStorage] SET error: ",r)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...r})=>({type:e,data:{...r,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.14.7",registry={};function register(e,t){let n=registry[e];if(n||(n=registry[e]=[]),n.push(t),isBrowser()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(r){console.debug("Could not postmessage",r)}}}const registerInsertMenu=()=>{register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:TARGET,version:SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],u=r.data.id,g=new Function(s);let l,f=null;try{l=g.apply(null,c)}catch(p){f=p}f?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:u,error:f.message}},"*"):l&&typeof l.then=="function"?l.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:u,result:p}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:l,id:u}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
174
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const fetch$1=getFetch();function flatten(e,t=null,n="."){return Object.keys(e).reduce((o,r)=>{const i=e[r],a=[t,r].filter(Boolean).join(n);return[typeof i=="object",i!==null,!(Array.isArray(i)&&i.length===0)].every(Boolean)?{...o,...flatten(i,a,n)}:{...o,[a]:i}},{})}const DEFAULT_API_VERSION="v3",BUILDER_SEARCHPARAMS_PREFIX="builder.",BUILDER_OPTIONS_PREFIX="options.",getBuilderSearchParams=e=>{if(!e)return{};const t=normalizeSearchParams(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)){const r=o.replace(BUILDER_SEARCHPARAMS_PREFIX,"").replace(BUILDER_OPTIONS_PREFIX,"");n[r]=t[o]}}),n},getBuilderSearchParamsFromWindow=()=>{if(!isBrowser())return{};const e=new URLSearchParams(window.location.search);return getBuilderSearchParams(e)},isPositiveNumber=e=>typeof e=="number"&&!isNaN(e)&&e>=0,generateContentUrl=e=>{const{limit:t=30,userAttributes:n,query:o,model:r,apiKey:i,enrich:a,locale:s,apiVersion:c=DEFAULT_API_VERSION,fields:u,omit:g,offset:l,cacheSeconds:f,staleCacheSeconds:p,sort:m,includeUnpublished:d}=e;if(!i)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const y=t!==1,h=new URL(`https://cdn.builder.io/api/${c}/content/${r}`);if(h.searchParams.set("apiKey",i),h.searchParams.set("limit",String(t)),h.searchParams.set("noTraverse",String(y)),h.searchParams.set("includeRefs",String(!0)),s&&h.searchParams.set("locale",s),a&&h.searchParams.set("enrich",String(a)),h.searchParams.set("omit",g||"meta.componentsUsed"),u&&h.searchParams.set("fields",u),Number.isFinite(l)&&l>-1&&h.searchParams.set("offset",String(Math.floor(l))),typeof d=="boolean"&&h.searchParams.set("includeUnpublished",String(d)),f&&isPositiveNumber(f)&&h.searchParams.set("cacheSeconds",String(f)),p&&isPositiveNumber(p)&&h.searchParams.set("staleCacheSeconds",String(p)),m){const b=flatten({sort:m});for(const x in b)h.searchParams.set(x,JSON.stringify(b[x]))}const S={...getBuilderSearchParamsFromWindow(),...normalizeSearchParams(e.options||{})},C=flatten(S);for(const b in C)h.searchParams.set(b,String(C[b]));if(n&&h.searchParams.set("userAttributes",JSON.stringify(n)),o){const b=flatten({query:o});for(const x in b)h.searchParams.set(x,JSON.stringify(b[x]))}return h},checkContentHasResults=e=>"results"in e;async function fetchOneEntry(e){const t=await fetchEntries({...e,limit:1});return t&&t[0]||null}const _fetchContent=async e=>{const t=generateContentUrl(e);return await(await fetch$1(t.href)).json()},_processContentResult=async(e,t,n=generateContentUrl(e))=>{const o=getDefaultCanTrack(e.canTrack);if(n.search.includes("preview=")){const i=[];for(const a of t.results){const s=getPreviewContent(n.searchParams);i.push(s||a)}t.results=i}if(!o||!(isBrowser()||TARGET==="reactNative"))return t.results;try{const i=[];for(const a of t.results)i.push(await handleABTesting({item:a,canTrack:o}));t.results=i}catch(i){logger.error("Could not process A/B tests. ",i)}return t.results};async function fetchEntries(e){try{const t=generateContentUrl(e),n=await _fetchContent(e);return checkContentHasResults(n)?_processContentResult(e,n):(logger.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return logger.error("Error fetching data. ",t),null}}function isPreviewing(e){if(!isBrowser())return!1;const t=getSearchString(e||window.location.search);return isEditing(t)?!1:t.indexOf("builder.preview=")!==-1}function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function uuid(){return uuidv4().replace(/-/g,"")}const SESSION_LOCAL_STORAGE_KEY="builderSessionId",getSessionId=async({canTrack:e})=>{if(!e)return;const t=await getCookie({name:SESSION_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createSessionId();return setSessionId({id:n,canTrack:e}),n}},createSessionId=()=>uuid(),setSessionId=({id:e,canTrack:t})=>setCookie({name:SESSION_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getLocalStorage=()=>isBrowser()&&typeof localStorage<"u"?localStorage:void 0,getLocalStorageItem=({key:e,canTrack:t})=>{var n;try{return t?(n=getLocalStorage())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},setLocalStorageItem=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=getLocalStorage())==null||o.setItem(e,n))}catch(r){console.debug("[LocalStorage] SET error: ",r)}},VISITOR_LOCAL_STORAGE_KEY="builderVisitorId",getVisitorId=({canTrack:e})=>{if(!e)return;const t=getLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,canTrack:e});if(checkIsDefined(t))return t;{const n=createVisitorId();return setVisitorId({id:n,canTrack:e}),n}},createVisitorId=()=>uuid(),setVisitorId=({id:e,canTrack:t})=>setLocalStorageItem({key:VISITOR_LOCAL_STORAGE_KEY,value:e,canTrack:t}),getTrackingEventData=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await getSessionId({canTrack:e}),n=getVisitorId({canTrack:e});return{sessionId:t,visitorId:n}},createEvent=async({type:e,canTrack:t,apiKey:n,metadata:o,...r})=>({type:e,data:{...r,metadata:{url:location.href,...o},...await getTrackingEventData({canTrack:t}),userAttributes:getUserAttributes(),ownerId:n}});async function _track(e){if(!e.apiKey){logger.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!isEditing()&&(isBrowser()||TARGET==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await createEvent(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const track=e=>_track({...e,canTrack:!0});function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,r=e.clientY-n.top,i=round(o/n.width),a=round(r/n.height);return{x:i,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),o=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?o.endsWith(r.slice(1)):r===o)>-1}const SDK_VERSION="0.14.8",registry={};function register(e,t){let n=registry[e];if(n||(n=registry[e]=[]),n.push(t),isBrowser()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(r){console.debug("Could not postmessage",r)}}}const registerInsertMenu=()=>{register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:TARGET,version:SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var i,a;if(!isFromTrustedHost(e.trustedHosts,o))return;const{data:r}=o;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],u=r.data.id,g=new Function(s);let l,f=null;try{l=g.apply(null,c)}catch(p){f=p}f?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:u,error:f.message}},"*"):l&&typeof l.then=="function"?l.then(p=>{var m;(m=window.parent)==null||m.postMessage({type:"builder.evaluateResult",data:{id:u,result:p}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:l,id:u}},"*");break}}})))},createEditorListener=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!isFromTrustedHost(t,o))return;const{data:r}=o;if(r)switch(r.type){case"builder.configureSdk":{n.configureSdk(r.data);break}case"builder.triggerAnimation":{n.animation(r.data);break}case"builder.contentUpdate":{const i=r.data,a=i.key||i.alias||i.entry||i.modelName,s=i.data;a===e&&n.contentUpdate(s);break}}},subscribeToEditor=(e,t,n)=>{if(!isBrowser)return logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};setupBrowserForEditing();const o=createEditorListener({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function assign(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const r=arguments[o];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}const camelCaseToKebabCase=e=>e?e.replace(/([A-Z])/g,t=>`-${t[0].toLowerCase()}`):"";function warnElementNotPresent(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function augmentAnimation(e,t){const n=getAllStylesUsed(e),o=getComputedStyle(t),r=e.steps[0].styles,i=e.steps[e.steps.length-1].styles,a=[r,i];for(const s of a)for(const c of n)c in s||(s[c]=o[c])}function getAllStylesUsed(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function triggerAnimation(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){warnElementNotPresent(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{augmentAnimation(e,n),n.style.transition="none",n.style.transitionDelay="0",assign(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),assign(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const getCssFromFont=e=>{var i;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((i=e==null?void 0:e.files)==null?void 0:i.regular);let r="";if(o&&t&&n&&(r+=`
|
|
175
175
|
@font-face {
|
|
176
176
|
font-family: "${t}";
|
|
177
177
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -185,10 +185,7 @@ src: url('${c}') format('woff2');
|
|
|
185
185
|
font-display: fallback;
|
|
186
186
|
font-weight: ${a};
|
|
187
187
|
}
|
|
188
|
-
`.trim())}return r},getFontCss=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>getCssFromFont(n)))==null?void 0:t.join(" "))||""},getCss=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:""
|
|
189
|
-
${getCss({cssCode:e.cssCode,contentId:e.contentId})}
|
|
190
|
-
${getFontCss({customFonts:e.customFonts})}
|
|
191
|
-
|
|
188
|
+
`.trim())}return r},getFontCss=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>getCssFromFont(n)))==null?void 0:t.join(" "))||""},getCss=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",DEFAULT_STYLES=`
|
|
192
189
|
.builder-button {
|
|
193
190
|
all: unset;
|
|
194
191
|
}
|
|
@@ -205,4 +202,8 @@ ${getFontCss({customFonts:e.customFonts})}
|
|
|
205
202
|
text-align: inherit;
|
|
206
203
|
font-family: inherit;
|
|
207
204
|
}
|
|
208
|
-
|
|
205
|
+
`,getDefaultStyles=e=>e?"":DEFAULT_STYLES;function ContentStyles(e){const t=`
|
|
206
|
+
${getCss({cssCode:e.cssCode,contentId:e.contentId})}
|
|
207
|
+
${getFontCss({customFonts:e.customFonts})}
|
|
208
|
+
${getDefaultStyles(e.isNestedRender)}
|
|
209
|
+
`.trim();return jsxRuntime.jsx(InlinedStyles,{styles:t})}const getRootStateInitialValue=({content:e,data:t,locale:n})=>{var i,a,s;const o={},r=((i=e==null?void 0:e.data)==null?void 0:i.state)||{};return(s=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||s.forEach(c=>{c.name&&c.defaultValue!==void 0&&(o[c.name]=c.defaultValue)}),{...o,...r,...t,...n?{locale:n}:{}}},getContentInitialValue=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function ContentComponent(e){var r,i,a,s,c,u,g,l,f;const t=getUpdateVariantVisibilityScript({variationId:(r=e.content)==null?void 0:r.testVariationId,contentId:(i=e.content)==null?void 0:i.id}),n=[...getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((p,{component:m,...d})=>({...p,[d.name]:{component:m,...serializeComponentInfo(d)}}),{}),o={content:getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...getDefaultRegisteredComponents(),...e.customComponents||[]].reduce((p,{component:m,...d})=>({...p,[d.name]:serializeComponentInfo(d)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}};return jsxRuntime.jsxs(USE_CLIENT_BUNDLE.EnableEditor,{content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:o,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,linkComponent:e.linkComponent,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?jsxRuntime.jsx(InlinedScript,{scriptStr:t}):null,jsxRuntime.jsx(ContentStyles,{isNestedRender:e.isNestedRender,contentId:(a=o.content)==null?void 0:a.id,cssCode:(c=(s=o.content)==null?void 0:s.data)==null?void 0:c.cssCode,customFonts:(g=(u=o.content)==null?void 0:u.data)==null?void 0:g.customFonts}),jsxRuntime.jsx(Blocks,{blocks:(f=(l=o.content)==null?void 0:l.data)==null?void 0:f.blocks,context:o,registeredComponents:n,linkComponent:e.linkComponent})]})}function ContentVariants(e){var i,a;const t=checkShouldRenderVariants({canTrack:getDefaultCanTrack(e.canTrack),content:e.content}),n=function(){var c;return getUpdateCookieAndStylesScript(getVariants(e.content).map(u=>({id:u.testVariationId,testRatio:u.testRatio})),((c=e.content)==null?void 0:c.id)||"")},o=function(){return getVariants(e.content).map(c=>`.variant-${c.testVariationId} { display: none; } `).join("")},r=function(){var c;return t?{...e.content,testVariationId:(c=e.content)==null?void 0:c.id}:handleABTestingSync({item:e.content,canTrack:getDefaultCanTrack(e.canTrack)})};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.isNestedRender&&TARGET!=="reactNative"?jsxRuntime.jsx(InlinedScript,{scriptStr:getScriptString()}):null,t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(InlinedStyles,{id:`variants-styles-${(i=e.content)==null?void 0:i.id}`,styles:o()}),jsxRuntime.jsx(InlinedScript,{scriptStr:n()}),(a=getVariants(e.content))==null?void 0:a.map(s=>jsxRuntime.jsx(ContentComponent,{isNestedRender:e.isNestedRender,content:s,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},s.testVariationId))]}):null,jsxRuntime.jsx(ContentComponent,{isNestedRender:e.isNestedRender,content:r(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts})]})}const fetchSymbolContent=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{logger.error("Could not fetch symbol content: ",n)})};async function Symbol$1(e){var o,r,i,a,s;const t=function(){var u,g;return[e.attributes[getClassPropName()],"builder-symbol",(u=e.symbol)!=null&&u.inline?"builder-inline-symbol":void 0,(g=e.symbol)!=null&&g.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},n=((o=e.symbol)==null?void 0:o.content)||await fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return jsxRuntime.jsx("div",{...e.attributes,className:t(),children:jsxRuntime.jsx(ContentVariants,{isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(r=e.builderBlock)==null?void 0:r.id},customComponents:Object.values(e.builderComponents),data:{...(i=e.symbol)==null?void 0:i.data,...e.builderContext.localState,...(a=n==null?void 0:n.data)==null?void 0:a.state},model:(s=e.symbol)==null?void 0:s.model,content:n,linkComponent:e.builderLinkComponent,blocksWrapper:"div",contentWrapper:"div"})})}const settings={};function setEditorSettings(e){if(isBrowser()){Object.assign(settings,e);const t={type:"builder.settingsChange",data:settings};parent.postMessage(t,"*")}}const fetchBuilderProps=async e=>{var o,r,i;const t=e.path||((o=e.url)==null?void 0:o.pathname)||((r=e.userAttributes)==null?void 0:r.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:getBuilderSearchParams(e.searchParams||((i=e.url)==null?void 0:i.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await fetchOneEntry(n)}};exports.Blocks=Blocks;exports.Columns=Columns;exports.ContentVariants=ContentVariants;exports.Symbol=Symbol$1;exports.Text=Text;exports._processContentResult=_processContentResult;exports._track=_track;exports.createEditorListener=createEditorListener;exports.createRegisterComponentMessage=createRegisterComponentMessage;exports.evaluate=evaluate;exports.fastClone=fastClone;exports.fetch=fetch$1;exports.fetchBuilderProps=fetchBuilderProps;exports.fetchEntries=fetchEntries;exports.fetchOneEntry=fetchOneEntry;exports.getBlockActions=getBlockActions;exports.getBlockProperties=getBlockProperties;exports.getBuilderSearchParams=getBuilderSearchParams;exports.getClassPropName=getClassPropName;exports.getDefaultCanTrack=getDefaultCanTrack;exports.getInteractionPropertiesForEvent=getInteractionPropertiesForEvent;exports.getSrcSet=getSrcSet;exports.init=init;exports.isBrowser=isBrowser;exports.isEditing=isEditing;exports.isEmptyElement=isEmptyElement;exports.isJsScript=isJsScript;exports.isPreviewing=isPreviewing;exports.logger=logger;exports.register=register;exports.registerInsertMenu=registerInsertMenu;exports.setEditorSettings=setEditorSettings;exports.setupBrowserForEditing=setupBrowserForEditing;exports.subscribeToEditor=subscribeToEditor;exports.track=track;exports.triggerAnimation=triggerAnimation;
|
package/lib/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-f9317c5f.cjs"),e=require("./bundle-77f045ce.cjs");require("react/jsx-runtime");require("react");require("./USE_SERVER_BUNDLE-e8d80664.cjs");require("next/navigation");require("lru-cache");exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as n, F as m, d as c, S as p, V as g } from "./USE_CLIENT_BUNDLE-
|
|
2
|
-
import { B as l, C as u, w as E, S, T as f, F as B, p as C, E as h, G as x, q as b, z as y, c as F, j as P, x as T, y as k, D as w, A as R } from "./bundle-
|
|
1
|
+
import { c as n, F as m, d as c, S as p, V as g } from "./USE_CLIENT_BUNDLE-690f58c3.js";
|
|
2
|
+
import { B as l, C as u, w as E, S, T as f, F as B, p as C, E as h, G as x, q as b, z as y, c as F, j as P, x as T, y as k, D as w, A as R } from "./bundle-001f0cdc.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./USE_SERVER_BUNDLE-
|
|
5
|
+
import "./USE_SERVER_BUNDLE-649f2942.js";
|
|
6
6
|
import "next/navigation";
|
|
7
7
|
import "lru-cache";
|
|
8
8
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.8",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps"> & {
|
|
2
|
+
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps" | "isNestedRender"> & {
|
|
3
3
|
builderContextSignal: BuilderContextInterface;
|
|
4
4
|
setBuilderContextSignal?: (signal: any) => any;
|
|
5
5
|
children?: any;
|
|
@@ -13,3 +13,4 @@ export declare const getCss: ({ cssCode, contentId }: {
|
|
|
13
13
|
cssCode?: string;
|
|
14
14
|
contentId?: string;
|
|
15
15
|
}) => string;
|
|
16
|
+
export declare const getDefaultStyles: (isNested: boolean | undefined) => "" | "\n.builder-button {\n all: unset;\n}\n\n.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {\n margin: 0;\n}\n.builder-text > p, .builder-text > .builder-paragraph {\n color: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n font-weight: inherit;\n font-size: inherit;\n text-align: inherit;\n font-family: inherit;\n}\n";
|
|
@@ -8,5 +8,10 @@ interface InternalRenderProps {
|
|
|
8
8
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
9
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
10
|
*/
|
|
11
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
12
|
+
/**
|
|
13
|
+
* For internal use only. Do not provide this prop.
|
|
14
|
+
*/
|
|
15
|
+
isNestedRender?: boolean;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -3,7 +3,7 @@ type VariantsProviderProps = ContentVariantsPrps & {
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare function ContentVariants(props: VariantsProviderProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.14.
|
|
1
|
+
export declare const SDK_VERSION = "0.14.8";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps"> & {
|
|
2
|
+
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps" | "isNestedRender"> & {
|
|
3
3
|
builderContextSignal: BuilderContextInterface;
|
|
4
4
|
setBuilderContextSignal?: (signal: any) => any;
|
|
5
5
|
children?: any;
|
|
@@ -13,3 +13,4 @@ export declare const getCss: ({ cssCode, contentId }: {
|
|
|
13
13
|
cssCode?: string;
|
|
14
14
|
contentId?: string;
|
|
15
15
|
}) => string;
|
|
16
|
+
export declare const getDefaultStyles: (isNested: boolean | undefined) => "" | "\n.builder-button {\n all: unset;\n}\n\n.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {\n margin: 0;\n}\n.builder-text > p, .builder-text > .builder-paragraph {\n color: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n font-weight: inherit;\n font-size: inherit;\n text-align: inherit;\n font-family: inherit;\n}\n";
|
|
@@ -8,5 +8,10 @@ interface InternalRenderProps {
|
|
|
8
8
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
9
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
10
|
*/
|
|
11
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
12
|
+
/**
|
|
13
|
+
* For internal use only. Do not provide this prop.
|
|
14
|
+
*/
|
|
15
|
+
isNestedRender?: boolean;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -3,7 +3,7 @@ type VariantsProviderProps = ContentVariantsPrps & {
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare function ContentVariants(props: VariantsProviderProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.14.
|
|
1
|
+
export declare const SDK_VERSION = "0.14.8";
|