@builder.io/sdk-react-nextjs 0.14.10 → 0.14.11
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/README.md +50 -38
- package/lib/browser/{USE_CLIENT_BUNDLE-23f56a7a.js → USE_CLIENT_BUNDLE-3b942ae2.js} +2 -2
- package/lib/{node/USE_CLIENT_BUNDLE-d7df2675.cjs → browser/USE_CLIENT_BUNDLE-4cb813ce.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-d7280e1d.js → browser/USE_SERVER_BUNDLE-0fe135ea.js} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-87f6dbbe.cjs → browser/USE_SERVER_BUNDLE-ec83933e.cjs} +1 -1
- package/lib/browser/{bundle-8b50c7b8.cjs → bundle-260ced55.cjs} +10 -10
- package/lib/browser/{bundle-53becb42.js → bundle-76453d46.js} +155 -131
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{node/USE_CLIENT_BUNDLE-1dd54b7e.js → edge/USE_CLIENT_BUNDLE-42619af6.js} +2 -2
- package/lib/{browser/USE_CLIENT_BUNDLE-eacd2786.cjs → edge/USE_CLIENT_BUNDLE-dfe5c354.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-3c851565.cjs → edge/USE_SERVER_BUNDLE-812e699d.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-df48fc17.js → edge/USE_SERVER_BUNDLE-ef053564.js} +1 -1
- package/lib/edge/{bundle-9f94b090.js → bundle-19c1b23d.js} +363 -339
- package/lib/edge/{bundle-3db41e4c.cjs → bundle-c186261f.cjs} +13 -13
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-fa4982fd.js → node/USE_CLIENT_BUNDLE-64c45aac.js} +2 -2
- package/lib/{edge/USE_CLIENT_BUNDLE-47f68f73.cjs → node/USE_CLIENT_BUNDLE-7dfe38c5.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-e0504825.cjs → node/USE_SERVER_BUNDLE-299ebfe7.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-e89c8b6f.js → node/USE_SERVER_BUNDLE-ed1c8346.js} +1 -1
- package/lib/node/{bundle-6a6e07b9.js → bundle-1a5c4f3c.js} +135 -111
- package/lib/node/{bundle-ece0becd.cjs → bundle-b5555d47.cjs} +9 -9
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/components/content-variants/helpers.d.ts +1 -1
- package/types/cjs/components/inlined-script.d.ts +1 -1
- package/types/cjs/components/inlined-styles.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/components/content-variants/helpers.d.ts +1 -1
- package/types/esm/components/inlined-script.d.ts +1 -1
- package/types/esm/components/inlined-styles.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
|
@@ -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-64c45aac.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) {
|
|
@@ -220,7 +220,7 @@ output;
|
|
|
220
220
|
const s = safeDynamicRequire("isolated-vm"), c = fastClone({
|
|
221
221
|
...a,
|
|
222
222
|
...r
|
|
223
|
-
}),
|
|
223
|
+
}), u = getFunctionArguments({
|
|
224
224
|
builder: t,
|
|
225
225
|
context: n,
|
|
226
226
|
event: o,
|
|
@@ -228,21 +228,21 @@ output;
|
|
|
228
228
|
}), g = getIsolateContext(), l = g.global;
|
|
229
229
|
l.setSync("global", l.derefInto()), l.setSync("log", function(...m) {
|
|
230
230
|
console.log(...m);
|
|
231
|
-
}), l.setSync(BUILDER_SET_STATE_NAME, function(m,
|
|
232
|
-
set(a, m,
|
|
233
|
-
}),
|
|
234
|
-
const
|
|
231
|
+
}), l.setSync(BUILDER_SET_STATE_NAME, function(m, d) {
|
|
232
|
+
set(a, m, d), i == null || i(a);
|
|
233
|
+
}), u.forEach(([m, d]) => {
|
|
234
|
+
const b = typeof d == "object" ? new s.Reference(
|
|
235
235
|
// workaround: methods with default values for arguments is not being cloned over
|
|
236
236
|
m === "builder" ? {
|
|
237
|
-
...
|
|
238
|
-
getUserAttributes: () =>
|
|
239
|
-
} :
|
|
237
|
+
...d,
|
|
238
|
+
getUserAttributes: () => d.getUserAttributes()
|
|
239
|
+
} : d
|
|
240
240
|
) : null;
|
|
241
|
-
l.setSync(getSyncValName(m),
|
|
241
|
+
l.setSync(getSyncValName(m), b);
|
|
242
242
|
}), l.setSync(INJECTED_IVM_GLOBAL, s);
|
|
243
243
|
const f = processCode({
|
|
244
244
|
code: e,
|
|
245
|
-
args:
|
|
245
|
+
args: u
|
|
246
246
|
}), p = g.evalSync(f);
|
|
247
247
|
try {
|
|
248
248
|
return JSON.parse(p);
|
|
@@ -307,19 +307,19 @@ function evaluate({
|
|
|
307
307
|
localState: n
|
|
308
308
|
};
|
|
309
309
|
if (s) {
|
|
310
|
-
const
|
|
310
|
+
const u = EvalCache.getCacheKey(c), g = EvalCache.getCachedValue(u);
|
|
311
311
|
if (g)
|
|
312
312
|
return g.value;
|
|
313
313
|
}
|
|
314
314
|
try {
|
|
315
|
-
const
|
|
315
|
+
const u = chooseBrowserOrServerEval(c);
|
|
316
316
|
if (s) {
|
|
317
317
|
const g = EvalCache.getCacheKey(c);
|
|
318
|
-
EvalCache.setCachedValue(g,
|
|
318
|
+
EvalCache.setCachedValue(g, u);
|
|
319
319
|
}
|
|
320
|
-
return
|
|
321
|
-
} catch (
|
|
322
|
-
logger.error("Failed code evaluation: " +
|
|
320
|
+
return u;
|
|
321
|
+
} catch (u) {
|
|
322
|
+
logger.error("Failed code evaluation: " + u.message, {
|
|
323
323
|
code: e
|
|
324
324
|
});
|
|
325
325
|
return;
|
|
@@ -347,7 +347,7 @@ const evaluateBindings = ({
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
for (const s in e.bindings) {
|
|
350
|
-
const c = e.bindings[s],
|
|
350
|
+
const c = e.bindings[s], u = evaluate({
|
|
351
351
|
code: c,
|
|
352
352
|
localState: n,
|
|
353
353
|
rootState: o,
|
|
@@ -355,7 +355,7 @@ const evaluateBindings = ({
|
|
|
355
355
|
context: t,
|
|
356
356
|
enableCache: !0
|
|
357
357
|
});
|
|
358
|
-
set(a, s,
|
|
358
|
+
set(a, s, u);
|
|
359
359
|
}
|
|
360
360
|
return a;
|
|
361
361
|
};
|
|
@@ -461,15 +461,15 @@ const getComponent = ({
|
|
|
461
461
|
if (!Array.isArray(r))
|
|
462
462
|
return;
|
|
463
463
|
const i = n.collection.split(".").pop(), a = n.itemName || (i ? i + "Item" : "item");
|
|
464
|
-
return r.map((c,
|
|
464
|
+
return r.map((c, u) => ({
|
|
465
465
|
context: {
|
|
466
466
|
...t,
|
|
467
467
|
localState: {
|
|
468
468
|
...t.localState,
|
|
469
|
-
$index:
|
|
469
|
+
$index: u,
|
|
470
470
|
$item: c,
|
|
471
471
|
[a]: c,
|
|
472
|
-
[`$${a}Index`]:
|
|
472
|
+
[`$${a}Index`]: u
|
|
473
473
|
}
|
|
474
474
|
},
|
|
475
475
|
block: o
|
|
@@ -518,7 +518,13 @@ const getComponent = ({
|
|
|
518
518
|
}, n;
|
|
519
519
|
};
|
|
520
520
|
function InlinedStyles(e) {
|
|
521
|
-
return /* @__PURE__ */ jsx(
|
|
521
|
+
return /* @__PURE__ */ jsx(
|
|
522
|
+
"style",
|
|
523
|
+
{
|
|
524
|
+
dangerouslySetInnerHTML: { __html: e.styles },
|
|
525
|
+
"data-id": e.id
|
|
526
|
+
}
|
|
527
|
+
);
|
|
522
528
|
}
|
|
523
529
|
function BlockStyles(e) {
|
|
524
530
|
const t = function() {
|
|
@@ -532,7 +538,7 @@ function BlockStyles(e) {
|
|
|
532
538
|
});
|
|
533
539
|
return checkIsDefined(r.hide) ? !r.hide : checkIsDefined(r.show) ? r.show : !0;
|
|
534
540
|
}, n = function() {
|
|
535
|
-
var
|
|
541
|
+
var d;
|
|
536
542
|
const r = getProcessedBlock({
|
|
537
543
|
block: e.block,
|
|
538
544
|
localState: e.context.localState,
|
|
@@ -541,16 +547,16 @@ function BlockStyles(e) {
|
|
|
541
547
|
context: e.context.context,
|
|
542
548
|
shouldEvaluateBindings: !0
|
|
543
549
|
}), i = r.responsiveStyles, a = e.context.content, s = getSizesForBreakpoints(
|
|
544
|
-
((
|
|
545
|
-
), c = i == null ? void 0 : i.large,
|
|
550
|
+
((d = a == null ? void 0 : a.meta) == null ? void 0 : d.breakpoints) || {}
|
|
551
|
+
), c = i == null ? void 0 : i.large, u = i == null ? void 0 : i.medium, g = i == null ? void 0 : i.small, l = r.id;
|
|
546
552
|
if (!l)
|
|
547
553
|
return "";
|
|
548
554
|
const f = c ? createCssClass({
|
|
549
555
|
className: l,
|
|
550
556
|
styles: c
|
|
551
|
-
}) : "", p =
|
|
557
|
+
}) : "", p = u ? createCssClass({
|
|
552
558
|
className: l,
|
|
553
|
-
styles:
|
|
559
|
+
styles: u,
|
|
554
560
|
mediaQuery: getMaxWidthQueryForSize(
|
|
555
561
|
"medium",
|
|
556
562
|
s
|
|
@@ -565,7 +571,7 @@ function BlockStyles(e) {
|
|
|
565
571
|
}) : "";
|
|
566
572
|
return [f, p, m].join(" ");
|
|
567
573
|
};
|
|
568
|
-
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
574
|
+
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { id: "builderio-block", styles: n() }) }) : null });
|
|
569
575
|
}
|
|
570
576
|
function capitalizeFirstLetter(e) {
|
|
571
577
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
@@ -701,7 +707,7 @@ function RepeatedBlock(e) {
|
|
|
701
707
|
);
|
|
702
708
|
}
|
|
703
709
|
function Block(e) {
|
|
704
|
-
var c,
|
|
710
|
+
var c, u, g;
|
|
705
711
|
const t = function() {
|
|
706
712
|
return getComponent({
|
|
707
713
|
block: e.block,
|
|
@@ -727,23 +733,23 @@ function Block(e) {
|
|
|
727
733
|
var p;
|
|
728
734
|
return e.block.tagName === "a" || ((p = o().properties) == null ? void 0 : p.href) || o().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
729
735
|
}, i = function() {
|
|
730
|
-
var m,
|
|
736
|
+
var m, d;
|
|
731
737
|
if ((m = e.block.repeat) != null && m.collection)
|
|
732
|
-
return !!((
|
|
738
|
+
return !!((d = n()) != null && d.length);
|
|
733
739
|
const f = "hide" in o() ? o().hide : !1;
|
|
734
740
|
return ("show" in o() ? o().show : !0) && !f;
|
|
735
741
|
}, a = function() {
|
|
736
742
|
var p;
|
|
737
743
|
return !((p = t()) != null && p.component) && !n() ? o().children ?? [] : [];
|
|
738
744
|
}, s = function() {
|
|
739
|
-
var f, p, m,
|
|
745
|
+
var f, p, m, d, b, h, S, k, y, C;
|
|
740
746
|
return {
|
|
741
747
|
blockChildren: o().children ?? [],
|
|
742
748
|
componentRef: (f = t()) == null ? void 0 : f.component,
|
|
743
749
|
componentOptions: {
|
|
744
750
|
...getBlockComponentOptions(o()),
|
|
745
751
|
builderContext: e.context,
|
|
746
|
-
...((p = t()) == null ? void 0 : p.name) === "Core:Button" || ((m = t()) == null ? void 0 : m.name) === "Symbol" || ((
|
|
752
|
+
...((p = t()) == null ? void 0 : p.name) === "Core:Button" || ((m = t()) == null ? void 0 : m.name) === "Symbol" || ((d = t()) == null ? void 0 : d.name) === "Columns" || ((b = t()) == null ? void 0 : b.name) === "Form:Form" ? {
|
|
747
753
|
builderLinkComponent: e.linkComponent
|
|
748
754
|
} : {},
|
|
749
755
|
...((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 +760,7 @@ function Block(e) {
|
|
|
754
760
|
linkComponent: e.linkComponent,
|
|
755
761
|
registeredComponents: e.registeredComponents,
|
|
756
762
|
builderBlock: o(),
|
|
757
|
-
includeBlockProps: ((
|
|
763
|
+
includeBlockProps: ((y = t()) == null ? void 0 : y.noWrap) === !0,
|
|
758
764
|
isInteractive: !((C = t()) != null && C.isRSC)
|
|
759
765
|
};
|
|
760
766
|
};
|
|
@@ -804,7 +810,7 @@ function Block(e) {
|
|
|
804
810
|
isInteractive: s().isInteractive
|
|
805
811
|
}
|
|
806
812
|
),
|
|
807
|
-
(
|
|
813
|
+
(u = a()) == null ? void 0 : u.map((l) => /* @__PURE__ */ jsx(
|
|
808
814
|
Block,
|
|
809
815
|
{
|
|
810
816
|
block: l,
|
|
@@ -845,23 +851,23 @@ function Blocks(e) {
|
|
|
845
851
|
}
|
|
846
852
|
function Columns(e) {
|
|
847
853
|
var p;
|
|
848
|
-
const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(
|
|
849
|
-
var
|
|
850
|
-
return ((
|
|
851
|
-
}, i = function(
|
|
852
|
-
const
|
|
853
|
-
return `calc(${r(
|
|
854
|
+
const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(d) {
|
|
855
|
+
var b;
|
|
856
|
+
return ((b = n[d]) == null ? void 0 : b.width) || 100 / n.length;
|
|
857
|
+
}, i = function(d) {
|
|
858
|
+
const b = t * (n.length - 1) / n.length;
|
|
859
|
+
return `calc(${r(d)}% - ${b}px)`;
|
|
854
860
|
}, a = function({
|
|
855
|
-
stackedStyle:
|
|
856
|
-
desktopStyle:
|
|
861
|
+
stackedStyle: d,
|
|
862
|
+
desktopStyle: b
|
|
857
863
|
}) {
|
|
858
|
-
return o === "tablet" ?
|
|
864
|
+
return o === "tablet" ? d : b;
|
|
859
865
|
}, s = function({
|
|
860
|
-
stackedStyle:
|
|
861
|
-
desktopStyle:
|
|
866
|
+
stackedStyle: d,
|
|
867
|
+
desktopStyle: b
|
|
862
868
|
}) {
|
|
863
|
-
return o === "never" ?
|
|
864
|
-
}, c = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
869
|
+
return o === "never" ? b : d;
|
|
870
|
+
}, c = e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column", u = function() {
|
|
865
871
|
return {
|
|
866
872
|
"--flex-dir": c,
|
|
867
873
|
"--flex-dir-tablet": a({
|
|
@@ -869,8 +875,8 @@ function Columns(e) {
|
|
|
869
875
|
desktopStyle: "row"
|
|
870
876
|
})
|
|
871
877
|
};
|
|
872
|
-
}, g = function(
|
|
873
|
-
const
|
|
878
|
+
}, g = function(d) {
|
|
879
|
+
const b = d === 0 ? 0 : t, h = i(d), S = `${b}px`, k = "100%", y = 0;
|
|
874
880
|
return {
|
|
875
881
|
...{
|
|
876
882
|
display: "flex",
|
|
@@ -884,7 +890,7 @@ function Columns(e) {
|
|
|
884
890
|
desktopStyle: h
|
|
885
891
|
}),
|
|
886
892
|
"--column-margin-left-mobile": s({
|
|
887
|
-
stackedStyle:
|
|
893
|
+
stackedStyle: y,
|
|
888
894
|
desktopStyle: S
|
|
889
895
|
}),
|
|
890
896
|
"--column-width-tablet": a({
|
|
@@ -892,15 +898,15 @@ function Columns(e) {
|
|
|
892
898
|
desktopStyle: h
|
|
893
899
|
}),
|
|
894
900
|
"--column-margin-left-tablet": a({
|
|
895
|
-
stackedStyle:
|
|
901
|
+
stackedStyle: y,
|
|
896
902
|
desktopStyle: S
|
|
897
903
|
})
|
|
898
904
|
};
|
|
899
|
-
}, l = function(
|
|
905
|
+
}, l = function(d) {
|
|
900
906
|
var h, S;
|
|
901
907
|
return getSizesForBreakpoints(
|
|
902
908
|
((S = (h = e.builderContext.content) == null ? void 0 : h.meta) == null ? void 0 : S.breakpoints) || {}
|
|
903
|
-
)[
|
|
909
|
+
)[d].max;
|
|
904
910
|
}, f = function() {
|
|
905
911
|
return `
|
|
906
912
|
@media (max-width: ${l("medium")}px) {
|
|
@@ -932,11 +938,11 @@ function Columns(e) {
|
|
|
932
938
|
/* @__PURE__ */ jsxs(
|
|
933
939
|
"div",
|
|
934
940
|
{
|
|
935
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
936
|
-
style:
|
|
941
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-664216e4`,
|
|
942
|
+
style: u(),
|
|
937
943
|
children: [
|
|
938
|
-
/* @__PURE__ */ jsx(InlinedStyles, { styles: f() }),
|
|
939
|
-
(p = e.columns) == null ? void 0 : p.map((m,
|
|
944
|
+
/* @__PURE__ */ jsx(InlinedStyles, { id: "builderio-columns", styles: f() }),
|
|
945
|
+
(p = e.columns) == null ? void 0 : p.map((m, d) => /* @__PURE__ */ jsx(
|
|
940
946
|
DynamicRenderer,
|
|
941
947
|
{
|
|
942
948
|
TagName: m.link ? e.builderLinkComponent || "a" : "div",
|
|
@@ -946,12 +952,12 @@ function Columns(e) {
|
|
|
946
952
|
href: m.link
|
|
947
953
|
} : {},
|
|
948
954
|
[getClassPropName()]: "builder-column",
|
|
949
|
-
style: mapStyleObjToStrIfNeeded(g(
|
|
955
|
+
style: mapStyleObjToStrIfNeeded(g(d))
|
|
950
956
|
},
|
|
951
957
|
children: /* @__PURE__ */ jsx(
|
|
952
958
|
Blocks,
|
|
953
959
|
{
|
|
954
|
-
path: `component.options.columns.${
|
|
960
|
+
path: `component.options.columns.${d}.blocks`,
|
|
955
961
|
parent: e.builderBlock.id,
|
|
956
962
|
styleProp: {
|
|
957
963
|
flexGrow: "1"
|
|
@@ -963,12 +969,12 @@ function Columns(e) {
|
|
|
963
969
|
}
|
|
964
970
|
)
|
|
965
971
|
},
|
|
966
|
-
|
|
972
|
+
d
|
|
967
973
|
))
|
|
968
974
|
]
|
|
969
975
|
}
|
|
970
976
|
),
|
|
971
|
-
/* @__PURE__ */ jsx("style", { children: `.div-
|
|
977
|
+
/* @__PURE__ */ jsx("style", { children: `.div-664216e4 {
|
|
972
978
|
display: flex;
|
|
973
979
|
line-height: normal;
|
|
974
980
|
}` })
|
|
@@ -1400,15 +1406,15 @@ const getTopLevelDomain = (e) => {
|
|
|
1400
1406
|
onChange: (e) => {
|
|
1401
1407
|
e.delete("srcset"), e.delete("noWebp");
|
|
1402
1408
|
function n(a, s = 6e4) {
|
|
1403
|
-
return new Promise((c,
|
|
1409
|
+
return new Promise((c, u) => {
|
|
1404
1410
|
const g = document.createElement("img");
|
|
1405
1411
|
let l = !1;
|
|
1406
1412
|
g.onload = () => {
|
|
1407
1413
|
l = !0, c(g);
|
|
1408
1414
|
}, g.addEventListener("error", (f) => {
|
|
1409
|
-
console.warn("Image load failed", f.error),
|
|
1415
|
+
console.warn("Image load failed", f.error), u(f.error);
|
|
1410
1416
|
}), g.src = a, setTimeout(() => {
|
|
1411
|
-
l ||
|
|
1417
|
+
l || u(new Error("Image load timed out"));
|
|
1412
1418
|
}, s);
|
|
1413
1419
|
});
|
|
1414
1420
|
}
|
|
@@ -1910,7 +1916,7 @@ const componentInfo$3 = {
|
|
|
1910
1916
|
})), checkShouldRenderVariants = ({
|
|
1911
1917
|
canTrack: e,
|
|
1912
1918
|
content: t
|
|
1913
|
-
}) => !(!(getVariants(t).length > 0) || !e || isBrowser()), getIsHydrationTarget = (e) => e === "react" || e === "reactNative", isHydrationTarget = getIsHydrationTarget(TARGET),
|
|
1919
|
+
}) => !(!(getVariants(t).length > 0) || !e || isBrowser()), getIsHydrationTarget = (e) => e === "react" || e === "reactNative", isHydrationTarget = getIsHydrationTarget(TARGET), getInitVariantsFnsScriptString = () => `
|
|
1914
1920
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
1915
1921
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
1916
1922
|
`, getUpdateCookieAndStylesScript = (e, t) => `
|
|
@@ -1927,7 +1933,7 @@ function InlinedScript(e) {
|
|
|
1927
1933
|
"script",
|
|
1928
1934
|
{
|
|
1929
1935
|
dangerouslySetInnerHTML: { __html: e.scriptStr },
|
|
1930
|
-
id: e.id
|
|
1936
|
+
"data-id": e.id
|
|
1931
1937
|
}
|
|
1932
1938
|
);
|
|
1933
1939
|
}
|
|
@@ -1995,38 +2001,38 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
1995
2001
|
enrich: a,
|
|
1996
2002
|
locale: s,
|
|
1997
2003
|
apiVersion: c = DEFAULT_API_VERSION,
|
|
1998
|
-
fields:
|
|
2004
|
+
fields: u,
|
|
1999
2005
|
omit: g,
|
|
2000
2006
|
offset: l,
|
|
2001
2007
|
cacheSeconds: f,
|
|
2002
2008
|
staleCacheSeconds: p,
|
|
2003
2009
|
sort: m,
|
|
2004
|
-
includeUnpublished:
|
|
2010
|
+
includeUnpublished: d
|
|
2005
2011
|
} = e;
|
|
2006
2012
|
if (!i)
|
|
2007
2013
|
throw new Error("Missing API key");
|
|
2008
2014
|
if (!["v3"].includes(c))
|
|
2009
2015
|
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
|
|
2016
|
+
const b = t !== 1, h = new URL(`https://cdn.builder.io/api/${c}/content/${r}`);
|
|
2017
|
+
if (h.searchParams.set("apiKey", i), h.searchParams.set("limit", String(t)), h.searchParams.set("noTraverse", String(b)), 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) {
|
|
2018
|
+
const y = flatten({
|
|
2013
2019
|
sort: m
|
|
2014
2020
|
});
|
|
2015
|
-
for (const C in
|
|
2016
|
-
h.searchParams.set(C, JSON.stringify(
|
|
2021
|
+
for (const C in y)
|
|
2022
|
+
h.searchParams.set(C, JSON.stringify(y[C]));
|
|
2017
2023
|
}
|
|
2018
2024
|
const S = {
|
|
2019
2025
|
...getBuilderSearchParamsFromWindow(),
|
|
2020
2026
|
...normalizeSearchParams(e.options || {})
|
|
2021
2027
|
}, k = flatten(S);
|
|
2022
|
-
for (const
|
|
2023
|
-
h.searchParams.set(
|
|
2028
|
+
for (const y in k)
|
|
2029
|
+
h.searchParams.set(y, String(k[y]));
|
|
2024
2030
|
if (n && h.searchParams.set("userAttributes", JSON.stringify(n)), o) {
|
|
2025
|
-
const
|
|
2031
|
+
const y = flatten({
|
|
2026
2032
|
query: o
|
|
2027
2033
|
});
|
|
2028
|
-
for (const C in
|
|
2029
|
-
h.searchParams.set(C, JSON.stringify(
|
|
2034
|
+
for (const C in y)
|
|
2035
|
+
h.searchParams.set(C, JSON.stringify(y[C]));
|
|
2030
2036
|
}
|
|
2031
2037
|
return h;
|
|
2032
2038
|
}, checkContentHasResults = (e) => "results" in e;
|
|
@@ -2272,7 +2278,7 @@ function isFromTrustedHost(e, t) {
|
|
|
2272
2278
|
const n = new URL(t.origin), o = n.hostname;
|
|
2273
2279
|
return (e || DEFAULT_TRUSTED_HOSTS).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
|
|
2274
2280
|
}
|
|
2275
|
-
const SDK_VERSION = "0.14.
|
|
2281
|
+
const SDK_VERSION = "0.14.11", registry = {};
|
|
2276
2282
|
function register(e, t) {
|
|
2277
2283
|
let n = registry[e];
|
|
2278
2284
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
|
@@ -2342,7 +2348,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2342
2348
|
if (r != null && r.type)
|
|
2343
2349
|
switch (r.type) {
|
|
2344
2350
|
case "builder.evaluate": {
|
|
2345
|
-
const s = r.data.text, c = r.data.arguments || [],
|
|
2351
|
+
const s = r.data.text, c = r.data.arguments || [], u = r.data.id, g = new Function(s);
|
|
2346
2352
|
let l, f = null;
|
|
2347
2353
|
try {
|
|
2348
2354
|
l = g.apply(null, c);
|
|
@@ -2352,7 +2358,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2352
2358
|
f ? (i = window.parent) == null || i.postMessage({
|
|
2353
2359
|
type: "builder.evaluateError",
|
|
2354
2360
|
data: {
|
|
2355
|
-
id:
|
|
2361
|
+
id: u,
|
|
2356
2362
|
error: f.message
|
|
2357
2363
|
}
|
|
2358
2364
|
}, "*") : l && typeof l.then == "function" ? l.then((p) => {
|
|
@@ -2360,7 +2366,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2360
2366
|
(m = window.parent) == null || m.postMessage({
|
|
2361
2367
|
type: "builder.evaluateResult",
|
|
2362
2368
|
data: {
|
|
2363
|
-
id:
|
|
2369
|
+
id: u,
|
|
2364
2370
|
result: p
|
|
2365
2371
|
}
|
|
2366
2372
|
}, "*");
|
|
@@ -2368,7 +2374,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2368
2374
|
type: "builder.evaluateResult",
|
|
2369
2375
|
data: {
|
|
2370
2376
|
result: l,
|
|
2371
|
-
id:
|
|
2377
|
+
id: u
|
|
2372
2378
|
}
|
|
2373
2379
|
}, "*");
|
|
2374
2380
|
break;
|
|
@@ -2525,7 +2531,7 @@ ${getFontCss({
|
|
|
2525
2531
|
})}
|
|
2526
2532
|
${getDefaultStyles(e.isNestedRender)}
|
|
2527
2533
|
`.trim();
|
|
2528
|
-
return /* @__PURE__ */ jsx(InlinedStyles, { styles: t });
|
|
2534
|
+
return /* @__PURE__ */ jsx(InlinedStyles, { id: "builderio-content", styles: t });
|
|
2529
2535
|
}
|
|
2530
2536
|
const getRootStateInitialValue = ({
|
|
2531
2537
|
content: e,
|
|
@@ -2556,7 +2562,7 @@ const getRootStateInitialValue = ({
|
|
|
2556
2562
|
meta: e == null ? void 0 : e.meta
|
|
2557
2563
|
} : void 0;
|
|
2558
2564
|
function ContentComponent(e) {
|
|
2559
|
-
var r, i, a, s, c,
|
|
2565
|
+
var r, i, a, s, c, u, g, l, f;
|
|
2560
2566
|
const t = getUpdateVariantVisibilityScript({
|
|
2561
2567
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2562
2568
|
variationId: (r = e.content) == null ? void 0 : r.testVariationId,
|
|
@@ -2566,11 +2572,11 @@ function ContentComponent(e) {
|
|
|
2566
2572
|
...getDefaultRegisteredComponents(),
|
|
2567
2573
|
...e.customComponents || []
|
|
2568
2574
|
].reduce(
|
|
2569
|
-
(p, { component: m, ...
|
|
2575
|
+
(p, { component: m, ...d }) => ({
|
|
2570
2576
|
...p,
|
|
2571
|
-
[
|
|
2577
|
+
[d.name]: {
|
|
2572
2578
|
component: m,
|
|
2573
|
-
...serializeComponentInfo(
|
|
2579
|
+
...serializeComponentInfo(d)
|
|
2574
2580
|
}
|
|
2575
2581
|
}),
|
|
2576
2582
|
{}
|
|
@@ -2593,9 +2599,9 @@ function ContentComponent(e) {
|
|
|
2593
2599
|
...getDefaultRegisteredComponents(),
|
|
2594
2600
|
...e.customComponents || []
|
|
2595
2601
|
].reduce(
|
|
2596
|
-
(p, { component: m, ...
|
|
2602
|
+
(p, { component: m, ...d }) => ({
|
|
2597
2603
|
...p,
|
|
2598
|
-
[
|
|
2604
|
+
[d.name]: serializeComponentInfo(d)
|
|
2599
2605
|
}),
|
|
2600
2606
|
{}
|
|
2601
2607
|
),
|
|
@@ -2621,14 +2627,20 @@ function ContentComponent(e) {
|
|
|
2621
2627
|
linkComponent: e.linkComponent,
|
|
2622
2628
|
trustedHosts: e.trustedHosts,
|
|
2623
2629
|
children: [
|
|
2624
|
-
e.isSsrAbTest ? /* @__PURE__ */ jsx(
|
|
2630
|
+
e.isSsrAbTest ? /* @__PURE__ */ jsx(
|
|
2631
|
+
InlinedScript,
|
|
2632
|
+
{
|
|
2633
|
+
id: "builderio-variant-visibility",
|
|
2634
|
+
scriptStr: t
|
|
2635
|
+
}
|
|
2636
|
+
) : null,
|
|
2625
2637
|
/* @__PURE__ */ jsx(
|
|
2626
2638
|
ContentStyles,
|
|
2627
2639
|
{
|
|
2628
2640
|
isNestedRender: e.isNestedRender,
|
|
2629
2641
|
contentId: (a = o.content) == null ? void 0 : a.id,
|
|
2630
2642
|
cssCode: (c = (s = o.content) == null ? void 0 : s.data) == null ? void 0 : c.cssCode,
|
|
2631
|
-
customFonts: (g = (
|
|
2643
|
+
customFonts: (g = (u = o.content) == null ? void 0 : u.data) == null ? void 0 : g.customFonts
|
|
2632
2644
|
}
|
|
2633
2645
|
),
|
|
2634
2646
|
/* @__PURE__ */ jsx(
|
|
@@ -2645,47 +2657,59 @@ function ContentComponent(e) {
|
|
|
2645
2657
|
);
|
|
2646
2658
|
}
|
|
2647
2659
|
function ContentVariants(e) {
|
|
2648
|
-
var i
|
|
2660
|
+
var i;
|
|
2649
2661
|
const t = checkShouldRenderVariants({
|
|
2650
2662
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2651
2663
|
content: e.content
|
|
2652
2664
|
}), n = function() {
|
|
2653
|
-
var
|
|
2665
|
+
var s;
|
|
2654
2666
|
return getUpdateCookieAndStylesScript(
|
|
2655
|
-
getVariants(e.content).map((
|
|
2656
|
-
id:
|
|
2657
|
-
testRatio:
|
|
2667
|
+
getVariants(e.content).map((c) => ({
|
|
2668
|
+
id: c.testVariationId,
|
|
2669
|
+
testRatio: c.testRatio
|
|
2658
2670
|
})),
|
|
2659
|
-
((
|
|
2671
|
+
((s = e.content) == null ? void 0 : s.id) || ""
|
|
2660
2672
|
);
|
|
2661
2673
|
}, o = function() {
|
|
2662
|
-
return getVariants(e.content).map((
|
|
2674
|
+
return getVariants(e.content).map((s) => `.variant-${s.testVariationId} { display: none; } `).join("");
|
|
2663
2675
|
}, r = function() {
|
|
2664
|
-
var
|
|
2676
|
+
var s;
|
|
2665
2677
|
return t ? {
|
|
2666
2678
|
...e.content,
|
|
2667
|
-
testVariationId: (
|
|
2679
|
+
testVariationId: (s = e.content) == null ? void 0 : s.id
|
|
2668
2680
|
} : handleABTestingSync({
|
|
2669
2681
|
item: e.content,
|
|
2670
2682
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
2671
2683
|
});
|
|
2672
2684
|
};
|
|
2673
2685
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2674
|
-
!e.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ jsx(
|
|
2686
|
+
!e.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ jsx(
|
|
2687
|
+
InlinedScript,
|
|
2688
|
+
{
|
|
2689
|
+
id: "builderio-init-variants-fns",
|
|
2690
|
+
scriptStr: getInitVariantsFnsScriptString()
|
|
2691
|
+
}
|
|
2692
|
+
) : null,
|
|
2675
2693
|
t ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2676
2694
|
/* @__PURE__ */ jsx(
|
|
2677
2695
|
InlinedStyles,
|
|
2678
2696
|
{
|
|
2679
|
-
id:
|
|
2697
|
+
id: "builderio-variants",
|
|
2680
2698
|
styles: o()
|
|
2681
2699
|
}
|
|
2682
2700
|
),
|
|
2683
|
-
/* @__PURE__ */ jsx(
|
|
2684
|
-
|
|
2701
|
+
/* @__PURE__ */ jsx(
|
|
2702
|
+
InlinedScript,
|
|
2703
|
+
{
|
|
2704
|
+
id: "builderio-variants-visibility",
|
|
2705
|
+
scriptStr: n()
|
|
2706
|
+
}
|
|
2707
|
+
),
|
|
2708
|
+
(i = getVariants(e.content)) == null ? void 0 : i.map((a) => /* @__PURE__ */ jsx(
|
|
2685
2709
|
ContentComponent,
|
|
2686
2710
|
{
|
|
2687
2711
|
isNestedRender: e.isNestedRender,
|
|
2688
|
-
content:
|
|
2712
|
+
content: a,
|
|
2689
2713
|
showContent: !1,
|
|
2690
2714
|
model: e.model,
|
|
2691
2715
|
data: e.data,
|
|
@@ -2704,7 +2728,7 @@ function ContentVariants(e) {
|
|
|
2704
2728
|
contentWrapperProps: e.contentWrapperProps,
|
|
2705
2729
|
trustedHosts: e.trustedHosts
|
|
2706
2730
|
},
|
|
2707
|
-
|
|
2731
|
+
a.testVariationId
|
|
2708
2732
|
))
|
|
2709
2733
|
] }) : null,
|
|
2710
2734
|
/* @__PURE__ */ jsx(
|
|
@@ -2755,11 +2779,11 @@ const fetchSymbolContent = async ({
|
|
|
2755
2779
|
async function Symbol$1(e) {
|
|
2756
2780
|
var o, r, i, a, s;
|
|
2757
2781
|
const t = function() {
|
|
2758
|
-
var
|
|
2782
|
+
var u, g;
|
|
2759
2783
|
return [
|
|
2760
2784
|
e.attributes[getClassPropName()],
|
|
2761
2785
|
"builder-symbol",
|
|
2762
|
-
(
|
|
2786
|
+
(u = e.symbol) != null && u.inline ? "builder-inline-symbol" : void 0,
|
|
2763
2787
|
(g = e.symbol) != null && g.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2764
2788
|
].filter(Boolean).join(" ");
|
|
2765
2789
|
}, n = ((o = e.symbol) == null ? void 0 : o.content) || await fetchSymbolContent({
|