@builder.io/sdk-react 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/index.cjs +115 -23
- package/lib/browser/index.mjs +828 -763
- package/lib/edge/index.cjs +121 -29
- package/lib/edge/index.mjs +1098 -1033
- package/lib/node/index.cjs +104 -12
- package/lib/node/index.mjs +499 -434
- package/package.json +8 -1
- package/types/blocks/video/video.d.ts +4 -0
- package/types/components/content/content.helpers.d.ts +1 -1
- package/types/components/content/content.types.d.ts +0 -4
- package/types/components/content-variants/helpers.d.ts +3 -3
- package/types/components/content-variants/inlined-fns.d.ts +14 -0
- package/types/constants/sdk-version.d.ts +1 -1
package/lib/node/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useState, useContext, createElement, useRef, useEffect } from "react";
|
|
4
4
|
import { i as isEditing, j as isBrowser, k as getUserAttributes, l as fastClone, m as logger, n as checkIsDefined, T as TARGET, r as register, o as getDefaultCanTrack, p as _track, a as isPreviewing, c as createRegisterComponentMessage, b as fetchOneEntry, q as fetch$1, u as components, v as serializeComponentInfo, w as handleABTestingSync } from "./server-entry-e4cd1e05.mjs";
|
|
5
|
-
import { _ as
|
|
5
|
+
import { _ as L, h as W, f as O, g as U, e as H, d as K, s as z, t as q } from "./server-entry-e4cd1e05.mjs";
|
|
6
6
|
function Button(e) {
|
|
7
7
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8
8
|
e.link ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -79,13 +79,13 @@ const getFunctionArguments = ({
|
|
|
79
79
|
rootSetState: a,
|
|
80
80
|
rootState: r
|
|
81
81
|
}) => {
|
|
82
|
-
const
|
|
82
|
+
const l = getFunctionArguments({
|
|
83
83
|
builder: t,
|
|
84
84
|
context: n,
|
|
85
85
|
event: i,
|
|
86
86
|
state: flattenState(r, o, a)
|
|
87
87
|
});
|
|
88
|
-
return new Function(...
|
|
88
|
+
return new Function(...l.map(([c]) => c), e)(...l.map(([, c]) => c));
|
|
89
89
|
};
|
|
90
90
|
function flattenState(e, t, n) {
|
|
91
91
|
if (e === t)
|
|
@@ -167,37 +167,37 @@ output;
|
|
|
167
167
|
rootSetState: a,
|
|
168
168
|
rootState: r
|
|
169
169
|
}) => {
|
|
170
|
-
const
|
|
170
|
+
const l = fastClone({
|
|
171
171
|
...r,
|
|
172
172
|
...o
|
|
173
173
|
}), c = getFunctionArguments({
|
|
174
174
|
builder: t,
|
|
175
175
|
context: n,
|
|
176
176
|
event: i,
|
|
177
|
-
state:
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
console.log(...
|
|
181
|
-
}),
|
|
182
|
-
set(r,
|
|
183
|
-
}), c.forEach(([
|
|
184
|
-
const x = typeof
|
|
177
|
+
state: l
|
|
178
|
+
}), s = getIsolateContext(), d = s.global;
|
|
179
|
+
d.setSync("global", d.derefInto()), d.setSync("log", function(...y) {
|
|
180
|
+
console.log(...y);
|
|
181
|
+
}), d.setSync(BUILDER_SET_STATE_NAME, function(y, m) {
|
|
182
|
+
set(r, y, m), a == null || a(r);
|
|
183
|
+
}), c.forEach(([y, m]) => {
|
|
184
|
+
const x = typeof m == "object" ? new ivm.Reference(
|
|
185
185
|
// workaround: methods with default values for arguments is not being cloned over
|
|
186
|
-
|
|
187
|
-
...
|
|
188
|
-
getUserAttributes: () =>
|
|
189
|
-
} :
|
|
186
|
+
y === "builder" ? {
|
|
187
|
+
...m,
|
|
188
|
+
getUserAttributes: () => m.getUserAttributes()
|
|
189
|
+
} : m
|
|
190
190
|
) : null;
|
|
191
|
-
|
|
192
|
-
}),
|
|
193
|
-
const
|
|
191
|
+
d.setSync(getSyncValName(y), x);
|
|
192
|
+
}), d.setSync(INJECTED_IVM_GLOBAL, ivm);
|
|
193
|
+
const g = processCode({
|
|
194
194
|
code: e,
|
|
195
195
|
args: c
|
|
196
|
-
}),
|
|
196
|
+
}), b = s.evalSync(g);
|
|
197
197
|
try {
|
|
198
|
-
return JSON.parse(
|
|
198
|
+
return JSON.parse(b);
|
|
199
199
|
} catch {
|
|
200
|
-
return
|
|
200
|
+
return b;
|
|
201
201
|
}
|
|
202
202
|
}, chooseBrowserOrServerEval = (e) => isBrowser() ? runInBrowser(e) : runInNode(e);
|
|
203
203
|
function evaluate({
|
|
@@ -213,7 +213,7 @@ function evaluate({
|
|
|
213
213
|
logger.warn("Skipping evaluation of empty code block.");
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const l = {
|
|
217
217
|
code: parseCode(e, {
|
|
218
218
|
isExpression: r
|
|
219
219
|
}),
|
|
@@ -225,7 +225,7 @@ function evaluate({
|
|
|
225
225
|
localState: n
|
|
226
226
|
};
|
|
227
227
|
try {
|
|
228
|
-
return chooseBrowserOrServerEval(
|
|
228
|
+
return chooseBrowserOrServerEval(l);
|
|
229
229
|
} catch (c) {
|
|
230
230
|
logger.error("Failed code evaluation: " + c.message, {
|
|
231
231
|
code: e
|
|
@@ -254,15 +254,15 @@ const evaluateBindings = ({
|
|
|
254
254
|
...a.actions
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
for (const
|
|
258
|
-
const c = e.bindings[
|
|
257
|
+
for (const l in e.bindings) {
|
|
258
|
+
const c = e.bindings[l], s = evaluate({
|
|
259
259
|
code: c,
|
|
260
260
|
localState: n,
|
|
261
261
|
rootState: i,
|
|
262
262
|
rootSetState: o,
|
|
263
263
|
context: t
|
|
264
264
|
});
|
|
265
|
-
set(r,
|
|
265
|
+
set(r, l, s);
|
|
266
266
|
}
|
|
267
267
|
return r;
|
|
268
268
|
};
|
|
@@ -325,15 +325,15 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
325
325
|
if (!Array.isArray(o))
|
|
326
326
|
return;
|
|
327
327
|
const a = n.collection.split(".").pop(), r = n.itemName || (a ? a + "Item" : "item");
|
|
328
|
-
return o.map((c,
|
|
328
|
+
return o.map((c, s) => ({
|
|
329
329
|
context: {
|
|
330
330
|
...t,
|
|
331
331
|
localState: {
|
|
332
332
|
...t.localState,
|
|
333
|
-
$index:
|
|
333
|
+
$index: s,
|
|
334
334
|
$item: c,
|
|
335
335
|
[r]: c,
|
|
336
|
-
[`$${r}Index`]:
|
|
336
|
+
[`$${r}Index`]: s
|
|
337
337
|
}
|
|
338
338
|
},
|
|
339
339
|
block: i
|
|
@@ -412,7 +412,7 @@ function BlockStyles(e) {
|
|
|
412
412
|
return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
|
|
413
413
|
}
|
|
414
414
|
function n() {
|
|
415
|
-
var
|
|
415
|
+
var m;
|
|
416
416
|
const i = getProcessedBlock({
|
|
417
417
|
block: e.block,
|
|
418
418
|
localState: e.context.localState,
|
|
@@ -421,29 +421,29 @@ function BlockStyles(e) {
|
|
|
421
421
|
context: e.context.context,
|
|
422
422
|
shouldEvaluateBindings: !0
|
|
423
423
|
}), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
424
|
-
((
|
|
425
|
-
),
|
|
426
|
-
if (!
|
|
424
|
+
((m = a == null ? void 0 : a.meta) == null ? void 0 : m.breakpoints) || {}
|
|
425
|
+
), l = o == null ? void 0 : o.large, c = o == null ? void 0 : o.medium, s = o == null ? void 0 : o.small, d = i.id;
|
|
426
|
+
if (!d)
|
|
427
427
|
return "";
|
|
428
|
-
const
|
|
429
|
-
className:
|
|
430
|
-
styles:
|
|
431
|
-
}) : "",
|
|
432
|
-
className:
|
|
428
|
+
const g = l ? createCssClass({
|
|
429
|
+
className: d,
|
|
430
|
+
styles: l
|
|
431
|
+
}) : "", b = c ? createCssClass({
|
|
432
|
+
className: d,
|
|
433
433
|
styles: c,
|
|
434
434
|
mediaQuery: getMaxWidthQueryForSize(
|
|
435
435
|
"medium",
|
|
436
436
|
r
|
|
437
437
|
)
|
|
438
|
-
}) : "",
|
|
439
|
-
className:
|
|
440
|
-
styles:
|
|
438
|
+
}) : "", y = s ? createCssClass({
|
|
439
|
+
className: d,
|
|
440
|
+
styles: s,
|
|
441
441
|
mediaQuery: getMaxWidthQueryForSize(
|
|
442
442
|
"small",
|
|
443
443
|
r
|
|
444
444
|
)
|
|
445
445
|
}) : "";
|
|
446
|
-
return [
|
|
446
|
+
return [g, b, y].join(" ");
|
|
447
447
|
}
|
|
448
448
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
449
449
|
}
|
|
@@ -657,7 +657,7 @@ function RepeatedBlock(e) {
|
|
|
657
657
|
) });
|
|
658
658
|
}
|
|
659
659
|
function Block(e) {
|
|
660
|
-
var
|
|
660
|
+
var d, g, b, y;
|
|
661
661
|
function t() {
|
|
662
662
|
return getComponent({
|
|
663
663
|
block: e.block,
|
|
@@ -672,7 +672,8 @@ function Block(e) {
|
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
674
|
function i() {
|
|
675
|
-
|
|
675
|
+
var m;
|
|
676
|
+
return (m = e.block.repeat) != null && m.collection ? e.block : getProcessedBlock({
|
|
676
677
|
block: e.block,
|
|
677
678
|
localState: e.context.localState,
|
|
678
679
|
rootState: e.context.rootState,
|
|
@@ -685,43 +686,44 @@ function Block(e) {
|
|
|
685
686
|
return e.block.tagName || "div";
|
|
686
687
|
}
|
|
687
688
|
function a() {
|
|
688
|
-
|
|
689
|
+
var m, x;
|
|
690
|
+
return "hide" in i() ? !i().hide : "show" in i() ? i().show : !((m = e.block.repeat) != null && m.collection && !((x = n == null ? void 0 : n()) != null && x.length));
|
|
689
691
|
}
|
|
690
692
|
function r() {
|
|
691
693
|
var x;
|
|
692
694
|
return !((x = t == null ? void 0 : t()) != null && x.component) && !n() ? i().children ?? [] : [];
|
|
693
695
|
}
|
|
694
|
-
function
|
|
695
|
-
var
|
|
696
|
+
function l() {
|
|
697
|
+
var m, x, E, I, v;
|
|
696
698
|
return {
|
|
697
699
|
blockChildren: i().children ?? [],
|
|
698
|
-
componentRef: (
|
|
700
|
+
componentRef: (m = t == null ? void 0 : t()) == null ? void 0 : m.component,
|
|
699
701
|
componentOptions: {
|
|
700
702
|
...getBlockComponentOptions(i()),
|
|
701
703
|
builderContext: e.context,
|
|
702
|
-
...((x = t == null ? void 0 : t()) == null ? void 0 : x.name) === "Symbol" || ((
|
|
704
|
+
...((x = t == null ? void 0 : t()) == null ? void 0 : x.name) === "Symbol" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Columns" ? {
|
|
703
705
|
builderComponents: e.registeredComponents
|
|
704
706
|
} : {}
|
|
705
707
|
},
|
|
706
708
|
context: c,
|
|
707
709
|
registeredComponents: e.registeredComponents,
|
|
708
710
|
builderBlock: i(),
|
|
709
|
-
includeBlockProps: ((
|
|
710
|
-
isInteractive: !((
|
|
711
|
+
includeBlockProps: ((I = t == null ? void 0 : t()) == null ? void 0 : I.noWrap) === !0,
|
|
712
|
+
isInteractive: !((v = t == null ? void 0 : t()) != null && v.isRSC)
|
|
711
713
|
};
|
|
712
714
|
}
|
|
713
|
-
const [c,
|
|
714
|
-
return /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
715
|
+
const [c, s] = useState(() => e.context);
|
|
716
|
+
return /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsx(Fragment, { children: (d = t == null ? void 0 : t()) != null && d.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
715
717
|
ComponentRef,
|
|
716
718
|
{
|
|
717
|
-
componentRef:
|
|
718
|
-
componentOptions:
|
|
719
|
-
blockChildren:
|
|
720
|
-
context:
|
|
721
|
-
registeredComponents:
|
|
722
|
-
builderBlock:
|
|
723
|
-
includeBlockProps:
|
|
724
|
-
isInteractive:
|
|
719
|
+
componentRef: l().componentRef,
|
|
720
|
+
componentOptions: l().componentOptions,
|
|
721
|
+
blockChildren: l().blockChildren,
|
|
722
|
+
context: l().context,
|
|
723
|
+
registeredComponents: l().registeredComponents,
|
|
724
|
+
builderBlock: l().builderBlock,
|
|
725
|
+
includeBlockProps: l().includeBlockProps,
|
|
726
|
+
isInteractive: l().isInteractive
|
|
725
727
|
}
|
|
726
728
|
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
727
729
|
isEmptyHtmlElement(o()) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -733,11 +735,11 @@ function Block(e) {
|
|
|
733
735
|
hasChildren: !1
|
|
734
736
|
}
|
|
735
737
|
) }) : null,
|
|
736
|
-
!isEmptyHtmlElement(o()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
738
|
+
!isEmptyHtmlElement(o()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (g = n()) == null ? void 0 : g.map((m, x) => /* @__PURE__ */ jsx(
|
|
737
739
|
RepeatedBlock,
|
|
738
740
|
{
|
|
739
|
-
repeatContext:
|
|
740
|
-
block:
|
|
741
|
+
repeatContext: m.context,
|
|
742
|
+
block: m.block,
|
|
741
743
|
registeredComponents: e.registeredComponents
|
|
742
744
|
},
|
|
743
745
|
x
|
|
@@ -753,32 +755,32 @@ function Block(e) {
|
|
|
753
755
|
/* @__PURE__ */ jsx(
|
|
754
756
|
ComponentRef,
|
|
755
757
|
{
|
|
756
|
-
componentRef:
|
|
757
|
-
componentOptions:
|
|
758
|
-
blockChildren:
|
|
759
|
-
context:
|
|
760
|
-
registeredComponents:
|
|
761
|
-
builderBlock:
|
|
762
|
-
includeBlockProps:
|
|
763
|
-
isInteractive:
|
|
758
|
+
componentRef: l().componentRef,
|
|
759
|
+
componentOptions: l().componentOptions,
|
|
760
|
+
blockChildren: l().blockChildren,
|
|
761
|
+
context: l().context,
|
|
762
|
+
registeredComponents: l().registeredComponents,
|
|
763
|
+
builderBlock: l().builderBlock,
|
|
764
|
+
includeBlockProps: l().includeBlockProps,
|
|
765
|
+
isInteractive: l().isInteractive
|
|
764
766
|
}
|
|
765
767
|
),
|
|
766
|
-
(
|
|
768
|
+
(b = r()) == null ? void 0 : b.map((m) => /* @__PURE__ */ jsx(
|
|
767
769
|
Block,
|
|
768
770
|
{
|
|
769
|
-
block:
|
|
771
|
+
block: m,
|
|
770
772
|
context: c,
|
|
771
773
|
registeredComponents: e.registeredComponents
|
|
772
774
|
},
|
|
773
|
-
"block-" +
|
|
775
|
+
"block-" + m.id
|
|
774
776
|
)),
|
|
775
|
-
(
|
|
777
|
+
(y = r()) == null ? void 0 : y.map((m) => /* @__PURE__ */ jsx(
|
|
776
778
|
BlockStyles,
|
|
777
779
|
{
|
|
778
|
-
block:
|
|
780
|
+
block: m,
|
|
779
781
|
context: c
|
|
780
782
|
},
|
|
781
|
-
"block-style-" +
|
|
783
|
+
"block-style-" + m.id
|
|
782
784
|
))
|
|
783
785
|
]
|
|
784
786
|
}
|
|
@@ -870,74 +872,74 @@ function Blocks(e) {
|
|
|
870
872
|
);
|
|
871
873
|
}
|
|
872
874
|
function Columns(e) {
|
|
873
|
-
var
|
|
875
|
+
var I;
|
|
874
876
|
const [t, n] = useState(
|
|
875
877
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
876
878
|
), [i, o] = useState(() => e.columns || []), [a, r] = useState(
|
|
877
879
|
() => e.stackColumnsAt || "tablet"
|
|
878
880
|
);
|
|
879
|
-
function
|
|
880
|
-
var
|
|
881
|
-
return ((
|
|
881
|
+
function l(v) {
|
|
882
|
+
var C;
|
|
883
|
+
return ((C = i[v]) == null ? void 0 : C.width) || 100 / i.length;
|
|
882
884
|
}
|
|
883
|
-
function c(
|
|
884
|
-
const
|
|
885
|
-
return `calc(${
|
|
885
|
+
function c(v) {
|
|
886
|
+
const C = t * (i.length - 1) / i.length;
|
|
887
|
+
return `calc(${l(v)}% - ${C}px)`;
|
|
886
888
|
}
|
|
887
|
-
function
|
|
888
|
-
stackedStyle:
|
|
889
|
-
desktopStyle:
|
|
889
|
+
function s({
|
|
890
|
+
stackedStyle: v,
|
|
891
|
+
desktopStyle: C
|
|
890
892
|
}) {
|
|
891
|
-
return a === "tablet" ?
|
|
893
|
+
return a === "tablet" ? v : C;
|
|
892
894
|
}
|
|
893
|
-
function
|
|
894
|
-
stackedStyle:
|
|
895
|
-
desktopStyle:
|
|
895
|
+
function d({
|
|
896
|
+
stackedStyle: v,
|
|
897
|
+
desktopStyle: C
|
|
896
898
|
}) {
|
|
897
|
-
return a === "never" ?
|
|
899
|
+
return a === "never" ? C : v;
|
|
898
900
|
}
|
|
899
|
-
const [
|
|
901
|
+
const [g, b] = useState(
|
|
900
902
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
901
903
|
);
|
|
902
|
-
function
|
|
904
|
+
function y() {
|
|
903
905
|
return {
|
|
904
|
-
"--flex-dir":
|
|
905
|
-
"--flex-dir-tablet":
|
|
906
|
-
stackedStyle:
|
|
906
|
+
"--flex-dir": g,
|
|
907
|
+
"--flex-dir-tablet": s({
|
|
908
|
+
stackedStyle: g,
|
|
907
909
|
desktopStyle: "row"
|
|
908
910
|
})
|
|
909
911
|
};
|
|
910
912
|
}
|
|
911
|
-
function
|
|
912
|
-
const
|
|
913
|
+
function m(v) {
|
|
914
|
+
const C = v === 0 ? 0 : t, T = c(v), w = `${C}px`, R = "100%", j = 0;
|
|
913
915
|
return {
|
|
914
|
-
width:
|
|
915
|
-
["marginLeft"]:
|
|
916
|
-
"--column-width-mobile":
|
|
916
|
+
width: T,
|
|
917
|
+
["marginLeft"]: w,
|
|
918
|
+
"--column-width-mobile": d({
|
|
917
919
|
stackedStyle: R,
|
|
918
|
-
desktopStyle:
|
|
920
|
+
desktopStyle: T
|
|
919
921
|
}),
|
|
920
|
-
"--column-margin-left-mobile":
|
|
922
|
+
"--column-margin-left-mobile": d({
|
|
921
923
|
stackedStyle: j,
|
|
922
|
-
desktopStyle:
|
|
924
|
+
desktopStyle: w
|
|
923
925
|
}),
|
|
924
|
-
"--column-width-tablet":
|
|
926
|
+
"--column-width-tablet": s({
|
|
925
927
|
stackedStyle: R,
|
|
926
|
-
desktopStyle:
|
|
928
|
+
desktopStyle: T
|
|
927
929
|
}),
|
|
928
|
-
"--column-margin-left-tablet":
|
|
930
|
+
"--column-margin-left-tablet": s({
|
|
929
931
|
stackedStyle: j,
|
|
930
|
-
desktopStyle:
|
|
932
|
+
desktopStyle: w
|
|
931
933
|
})
|
|
932
934
|
};
|
|
933
935
|
}
|
|
934
|
-
function x(
|
|
935
|
-
var
|
|
936
|
+
function x(v) {
|
|
937
|
+
var T, w;
|
|
936
938
|
return getSizesForBreakpoints(
|
|
937
|
-
((
|
|
938
|
-
)[
|
|
939
|
+
((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
|
|
940
|
+
)[v].max;
|
|
939
941
|
}
|
|
940
|
-
function
|
|
942
|
+
function E() {
|
|
941
943
|
return `
|
|
942
944
|
@media (max-width: ${x("medium")}px) {
|
|
943
945
|
.${e.builderBlock.id}-breakpoints {
|
|
@@ -969,27 +971,27 @@ function Columns(e) {
|
|
|
969
971
|
"div",
|
|
970
972
|
{
|
|
971
973
|
className: `builder-columns ${e.builderBlock.id}-breakpoints div-53636e90`,
|
|
972
|
-
style:
|
|
974
|
+
style: y(),
|
|
973
975
|
children: [
|
|
974
|
-
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles:
|
|
975
|
-
(
|
|
976
|
+
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: E() }) }),
|
|
977
|
+
(I = e.columns) == null ? void 0 : I.map((v, C) => /* @__PURE__ */ createElement(
|
|
976
978
|
"div",
|
|
977
979
|
{
|
|
978
980
|
className: "builder-column div-53636e90-2",
|
|
979
|
-
style:
|
|
980
|
-
key:
|
|
981
|
+
style: m(C),
|
|
982
|
+
key: C
|
|
981
983
|
},
|
|
982
984
|
/* @__PURE__ */ jsx(
|
|
983
985
|
Blocks,
|
|
984
986
|
{
|
|
985
|
-
path: `component.options.columns.${
|
|
987
|
+
path: `component.options.columns.${C}.blocks`,
|
|
986
988
|
parent: e.builderBlock.id,
|
|
987
989
|
styleProp: {
|
|
988
990
|
flexGrow: "1"
|
|
989
991
|
},
|
|
990
992
|
context: e.builderContext,
|
|
991
993
|
registeredComponents: e.builderComponents,
|
|
992
|
-
blocks:
|
|
994
|
+
blocks: v.blocks
|
|
993
995
|
}
|
|
994
996
|
)
|
|
995
997
|
))
|
|
@@ -1040,20 +1042,20 @@ function getSrcSet(e) {
|
|
|
1040
1042
|
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, i]) => `${n} ${i}w`).concat([e]).join(", ") : e;
|
|
1041
1043
|
}
|
|
1042
1044
|
function Image(e) {
|
|
1043
|
-
var o, a, r,
|
|
1045
|
+
var o, a, r, l;
|
|
1044
1046
|
function t() {
|
|
1045
|
-
var
|
|
1046
|
-
const
|
|
1047
|
-
if (!
|
|
1047
|
+
var d;
|
|
1048
|
+
const s = e.image || e.src;
|
|
1049
|
+
if (!s || // We can auto add srcset for cdn.builder.io and shopify
|
|
1048
1050
|
// images, otherwise you can supply this prop manually
|
|
1049
|
-
!(
|
|
1051
|
+
!(s.match(/builder\.io/) || s.match(/cdn\.shopify\.com/)))
|
|
1050
1052
|
return e.srcset;
|
|
1051
|
-
if (e.srcset && ((
|
|
1053
|
+
if (e.srcset && ((d = e.image) != null && d.includes("builder.io/api/v1/image"))) {
|
|
1052
1054
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1053
|
-
return console.debug("Removed given srcset"), getSrcSet(
|
|
1055
|
+
return console.debug("Removed given srcset"), getSrcSet(s);
|
|
1054
1056
|
} else if (e.image && !e.srcset)
|
|
1055
|
-
return getSrcSet(
|
|
1056
|
-
return getSrcSet(
|
|
1057
|
+
return getSrcSet(s);
|
|
1058
|
+
return getSrcSet(s);
|
|
1057
1059
|
}
|
|
1058
1060
|
function n() {
|
|
1059
1061
|
var c;
|
|
@@ -1100,7 +1102,7 @@ function Image(e) {
|
|
|
1100
1102
|
}
|
|
1101
1103
|
}
|
|
1102
1104
|
) }) : null,
|
|
1103
|
-
(
|
|
1105
|
+
(l = (r = e.builderBlock) == null ? void 0 : r.children) != null && l.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: e.children }) : null,
|
|
1104
1106
|
!e.fitContent && e.children ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "div-dbab4030-2", children: e.children }) }) : null
|
|
1105
1107
|
] }),
|
|
1106
1108
|
/* @__PURE__ */ jsx("style", { children: `.img-dbab4030 {
|
|
@@ -1355,7 +1357,7 @@ const componentInfo$a = {
|
|
|
1355
1357
|
});
|
|
1356
1358
|
}
|
|
1357
1359
|
const n = e.get("columns");
|
|
1358
|
-
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((
|
|
1360
|
+
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((l, c) => l + c.get("width"), 0) !== 100) && t();
|
|
1359
1361
|
}
|
|
1360
1362
|
}, {
|
|
1361
1363
|
name: "space",
|
|
@@ -1403,29 +1405,29 @@ const componentInfo$a = {
|
|
|
1403
1405
|
function CustomCode(e) {
|
|
1404
1406
|
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []);
|
|
1405
1407
|
return useEffect(() => {
|
|
1406
|
-
var
|
|
1407
|
-
if (!((
|
|
1408
|
+
var l;
|
|
1409
|
+
if (!((l = t.current) != null && l.getElementsByTagName) || typeof window > "u")
|
|
1408
1410
|
return;
|
|
1409
1411
|
const r = t.current.getElementsByTagName("script");
|
|
1410
1412
|
for (let c = 0; c < r.length; c++) {
|
|
1411
|
-
const
|
|
1412
|
-
if (
|
|
1413
|
-
if (n.includes(
|
|
1413
|
+
const s = r[c];
|
|
1414
|
+
if (s.src) {
|
|
1415
|
+
if (n.includes(s.src))
|
|
1414
1416
|
continue;
|
|
1415
|
-
n.push(
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
} else if (!
|
|
1417
|
+
n.push(s.src);
|
|
1418
|
+
const d = document.createElement("script");
|
|
1419
|
+
d.async = !0, d.src = s.src, document.head.appendChild(d);
|
|
1420
|
+
} else if (!s.type || [
|
|
1419
1421
|
"text/javascript",
|
|
1420
1422
|
"application/javascript",
|
|
1421
1423
|
"application/ecmascript"
|
|
1422
|
-
].includes(
|
|
1423
|
-
if (o.includes(
|
|
1424
|
+
].includes(s.type)) {
|
|
1425
|
+
if (o.includes(s.innerText))
|
|
1424
1426
|
continue;
|
|
1425
1427
|
try {
|
|
1426
|
-
o.push(
|
|
1427
|
-
} catch (
|
|
1428
|
-
console.warn("`CustomCode`: Error running script:",
|
|
1428
|
+
o.push(s.innerText), new Function(s.innerText)();
|
|
1429
|
+
} catch (d) {
|
|
1430
|
+
console.warn("`CustomCode`: Error running script:", d);
|
|
1429
1431
|
}
|
|
1430
1432
|
}
|
|
1431
1433
|
}
|
|
@@ -1465,27 +1467,27 @@ const componentInfo$7 = {
|
|
|
1465
1467
|
}]
|
|
1466
1468
|
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1467
1469
|
function Embed(e) {
|
|
1468
|
-
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r,
|
|
1470
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r, l] = useState(() => !1);
|
|
1469
1471
|
function c() {
|
|
1470
1472
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1471
1473
|
return;
|
|
1472
|
-
const
|
|
1473
|
-
for (let
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
n.push(
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
} else if (isJsScript(
|
|
1474
|
+
const s = t.current.getElementsByTagName("script");
|
|
1475
|
+
for (let d = 0; d < s.length; d++) {
|
|
1476
|
+
const g = s[d];
|
|
1477
|
+
if (g.src && !n.includes(g.src)) {
|
|
1478
|
+
n.push(g.src);
|
|
1479
|
+
const b = document.createElement("script");
|
|
1480
|
+
b.async = !0, b.src = g.src, document.head.appendChild(b);
|
|
1481
|
+
} else if (isJsScript(g) && !o.includes(g.innerText))
|
|
1480
1482
|
try {
|
|
1481
|
-
o.push(
|
|
1482
|
-
} catch (
|
|
1483
|
-
console.warn("`Embed`: Error running script:",
|
|
1483
|
+
o.push(g.innerText), new Function(g.innerText)();
|
|
1484
|
+
} catch (b) {
|
|
1485
|
+
console.warn("`Embed`: Error running script:", b);
|
|
1484
1486
|
}
|
|
1485
1487
|
}
|
|
1486
1488
|
}
|
|
1487
1489
|
return useEffect(() => {
|
|
1488
|
-
t.current && !r && (
|
|
1490
|
+
t.current && !r && (l(!0), c());
|
|
1489
1491
|
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1490
1492
|
"div",
|
|
1491
1493
|
{
|
|
@@ -1521,17 +1523,17 @@ const componentInfo$6 = {
|
|
|
1521
1523
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
1522
1524
|
onChange: (e) => {
|
|
1523
1525
|
e.delete("srcset"), e.delete("noWebp");
|
|
1524
|
-
function n(r,
|
|
1525
|
-
return new Promise((c,
|
|
1526
|
-
const
|
|
1527
|
-
let
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
},
|
|
1531
|
-
console.warn("Image load failed",
|
|
1532
|
-
}),
|
|
1533
|
-
|
|
1534
|
-
},
|
|
1526
|
+
function n(r, l = 6e4) {
|
|
1527
|
+
return new Promise((c, s) => {
|
|
1528
|
+
const d = document.createElement("img");
|
|
1529
|
+
let g = !1;
|
|
1530
|
+
d.onload = () => {
|
|
1531
|
+
g = !0, c(d);
|
|
1532
|
+
}, d.addEventListener("error", (b) => {
|
|
1533
|
+
console.warn("Image load failed", b.error), s(b.error);
|
|
1534
|
+
}), d.src = r, setTimeout(() => {
|
|
1535
|
+
g || s(new Error("Image load timed out"));
|
|
1536
|
+
}, l);
|
|
1535
1537
|
});
|
|
1536
1538
|
}
|
|
1537
1539
|
function i(r) {
|
|
@@ -1542,8 +1544,8 @@ const componentInfo$6 = {
|
|
|
1542
1544
|
r.type.includes("svg") && e.set("noWebp", !0);
|
|
1543
1545
|
}), o && (!a || a === 0.7041))
|
|
1544
1546
|
return n(o).then((r) => {
|
|
1545
|
-
const
|
|
1546
|
-
e.get("image") === o && (!
|
|
1547
|
+
const l = e.get("aspectRatio");
|
|
1548
|
+
e.get("image") === o && (!l || l === 0.7041) && r.width && r.height && (e.set("aspectRatio", i(r.height / r.width)), e.set("height", r.height), e.set("width", r.width));
|
|
1547
1549
|
});
|
|
1548
1550
|
}
|
|
1549
1551
|
}, {
|
|
@@ -1818,7 +1820,7 @@ const componentInfo = {
|
|
|
1818
1820
|
}]
|
|
1819
1821
|
};
|
|
1820
1822
|
function Video(e) {
|
|
1821
|
-
var i;
|
|
1823
|
+
var i, o, a, r, l, c, s;
|
|
1822
1824
|
function t() {
|
|
1823
1825
|
return {
|
|
1824
1826
|
...e.autoPlay === !0 ? {
|
|
@@ -1840,27 +1842,81 @@ function Video(e) {
|
|
|
1840
1842
|
}
|
|
1841
1843
|
function n() {
|
|
1842
1844
|
return {
|
|
1843
|
-
...e.attributes,
|
|
1844
1845
|
...t()
|
|
1845
1846
|
};
|
|
1846
1847
|
}
|
|
1847
|
-
return /* @__PURE__ */
|
|
1848
|
-
"
|
|
1848
|
+
return /* @__PURE__ */ jsxs(
|
|
1849
|
+
"div",
|
|
1849
1850
|
{
|
|
1850
|
-
...n(),
|
|
1851
|
-
preload: e.preload || "metadata",
|
|
1852
1851
|
style: {
|
|
1853
|
-
|
|
1854
|
-
height: "100%",
|
|
1855
|
-
...(i = e.attributes) == null ? void 0 : i.style,
|
|
1856
|
-
objectFit: e.fit,
|
|
1857
|
-
objectPosition: e.position,
|
|
1858
|
-
// Hack to get object fit to work as expected and
|
|
1859
|
-
// not have the video overflow
|
|
1860
|
-
borderRadius: 1
|
|
1852
|
+
position: "relative"
|
|
1861
1853
|
},
|
|
1862
|
-
|
|
1863
|
-
|
|
1854
|
+
children: [
|
|
1855
|
+
/* @__PURE__ */ jsx(
|
|
1856
|
+
"video",
|
|
1857
|
+
{
|
|
1858
|
+
className: "builder-video",
|
|
1859
|
+
...n(),
|
|
1860
|
+
preload: e.preload || "metadata",
|
|
1861
|
+
style: {
|
|
1862
|
+
width: "100%",
|
|
1863
|
+
height: "100%",
|
|
1864
|
+
...(i = e.attributes) == null ? void 0 : i.style,
|
|
1865
|
+
objectFit: e.fit,
|
|
1866
|
+
objectPosition: e.position,
|
|
1867
|
+
// Hack to get object fit to work as expected and
|
|
1868
|
+
// not have the video overflow
|
|
1869
|
+
zIndex: 2,
|
|
1870
|
+
borderRadius: "1px",
|
|
1871
|
+
...e.aspectRatio ? {
|
|
1872
|
+
position: "absolute"
|
|
1873
|
+
} : null
|
|
1874
|
+
},
|
|
1875
|
+
src: e.video || "no-src",
|
|
1876
|
+
poster: e.posterImage,
|
|
1877
|
+
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
1878
|
+
}
|
|
1879
|
+
),
|
|
1880
|
+
e.aspectRatio && !(e.fitContent && ((a = (o = e.builderBlock) == null ? void 0 : o.children) != null && a.length)) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1881
|
+
"div",
|
|
1882
|
+
{
|
|
1883
|
+
style: {
|
|
1884
|
+
width: "100%",
|
|
1885
|
+
paddingTop: e.aspectRatio * 100 + "%",
|
|
1886
|
+
pointerEvents: "none",
|
|
1887
|
+
fontSize: "0px"
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
) }) : null,
|
|
1891
|
+
(l = (r = e.builderBlock) == null ? void 0 : r.children) != null && l.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1892
|
+
"div",
|
|
1893
|
+
{
|
|
1894
|
+
style: {
|
|
1895
|
+
display: "flex",
|
|
1896
|
+
flexDirection: "column",
|
|
1897
|
+
alignItems: "stretch"
|
|
1898
|
+
},
|
|
1899
|
+
children: e.children
|
|
1900
|
+
}
|
|
1901
|
+
) }) : null,
|
|
1902
|
+
(s = (c = e.builderBlock) == null ? void 0 : c.children) != null && s.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1903
|
+
"div",
|
|
1904
|
+
{
|
|
1905
|
+
style: {
|
|
1906
|
+
pointerEvents: "none",
|
|
1907
|
+
display: "flex",
|
|
1908
|
+
flexDirection: "column",
|
|
1909
|
+
alignItems: "stretch",
|
|
1910
|
+
position: "absolute",
|
|
1911
|
+
top: "0",
|
|
1912
|
+
left: "0",
|
|
1913
|
+
width: "100%",
|
|
1914
|
+
height: "100%"
|
|
1915
|
+
},
|
|
1916
|
+
children: e.children
|
|
1917
|
+
}
|
|
1918
|
+
) }) : null
|
|
1919
|
+
]
|
|
1864
1920
|
}
|
|
1865
1921
|
);
|
|
1866
1922
|
}
|
|
@@ -1897,104 +1953,121 @@ const getDefaultRegisteredComponents = () => [{
|
|
|
1897
1953
|
}, {
|
|
1898
1954
|
component: Video,
|
|
1899
1955
|
...componentInfo
|
|
1900
|
-
}],
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
function bldrAbTest(e, t, n) {
|
|
1909
|
-
var r;
|
|
1910
|
-
function i() {
|
|
1911
|
-
function s(d, x, v) {
|
|
1912
|
-
let C = "";
|
|
1913
|
-
if (v) {
|
|
1914
|
-
const S = /* @__PURE__ */ new Date();
|
|
1915
|
-
S.setTime(S.getTime() + v * 24 * 60 * 60 * 1e3), C = "; expires=" + S.toUTCString();
|
|
1956
|
+
}], UPDATE_COOKIES_AND_STYLES_SCRIPT = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1957
|
+
function getAndSetVariantId() {
|
|
1958
|
+
function setCookie(name, value, days) {
|
|
1959
|
+
let expires = '';
|
|
1960
|
+
if (days) {
|
|
1961
|
+
const date = new Date();
|
|
1962
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
1963
|
+
expires = '; expires=' + date.toUTCString();
|
|
1916
1964
|
}
|
|
1917
|
-
document.cookie =
|
|
1965
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
|
|
1918
1966
|
}
|
|
1919
|
-
function
|
|
1920
|
-
const
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (
|
|
1926
|
-
return S.substring(x.length, S.length);
|
|
1967
|
+
function getCookie(name) {
|
|
1968
|
+
const nameEQ = name + '=';
|
|
1969
|
+
const ca = document.cookie.split(';');
|
|
1970
|
+
for (let i = 0; i < ca.length; i++) {
|
|
1971
|
+
let c = ca[i];
|
|
1972
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
1973
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
1927
1974
|
}
|
|
1928
1975
|
return null;
|
|
1929
1976
|
}
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
for (let d = 0; d < t.length; d++) {
|
|
1936
|
-
const x = t[d], v = x.testRatio;
|
|
1937
|
-
if (h += v, b < h)
|
|
1938
|
-
return s(l, x.id), x.id;
|
|
1977
|
+
const cookieName = \`builder.tests.\${contentId}\`;
|
|
1978
|
+
const variantInCookie = getCookie(cookieName);
|
|
1979
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
1980
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
1981
|
+
return variantInCookie;
|
|
1939
1982
|
}
|
|
1940
|
-
|
|
1983
|
+
let n = 0;
|
|
1984
|
+
const random = Math.random();
|
|
1985
|
+
for (let i = 0; i < variants.length; i++) {
|
|
1986
|
+
const variant = variants[i];
|
|
1987
|
+
const testRatio = variant.testRatio;
|
|
1988
|
+
n += testRatio;
|
|
1989
|
+
if (random < n) {
|
|
1990
|
+
setCookie(cookieName, variant.id);
|
|
1991
|
+
return variant.id;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
setCookie(cookieName, contentId);
|
|
1995
|
+
return contentId;
|
|
1941
1996
|
}
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1997
|
+
const winningVariantId = getAndSetVariantId();
|
|
1998
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
1999
|
+
if (isHydrationTarget) {
|
|
2000
|
+
styleEl.remove();
|
|
2001
|
+
const thisScriptEl = document.currentScript;
|
|
2002
|
+
thisScriptEl?.remove();
|
|
1947
2003
|
} else {
|
|
1948
|
-
const
|
|
1949
|
-
id:
|
|
1950
|
-
}).filter(
|
|
1951
|
-
|
|
1952
|
-
|
|
2004
|
+
const newStyleStr = variants.concat({
|
|
2005
|
+
id: contentId
|
|
2006
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
2007
|
+
return \`.variant-\${value.id} { display: none; }
|
|
2008
|
+
\`;
|
|
2009
|
+
}).join('');
|
|
2010
|
+
styleEl.innerHTML = newStyleStr;
|
|
1953
2011
|
}
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
var c;
|
|
1957
|
-
if (!navigator.cookieEnabled)
|
|
2012
|
+
}`, UPDATE_VARIANT_VISIBILITY_SCRIPT = `function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
2013
|
+
if (!navigator.cookieEnabled) {
|
|
1958
2014
|
return;
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
2015
|
+
}
|
|
2016
|
+
function getCookie(name) {
|
|
2017
|
+
const nameEQ = name + '=';
|
|
2018
|
+
const ca = document.cookie.split(';');
|
|
2019
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2020
|
+
let c = ca[i];
|
|
2021
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
2022
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
1967
2023
|
}
|
|
1968
2024
|
return null;
|
|
1969
2025
|
}
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2026
|
+
const cookieName = \`builder.tests.\${defaultContentId}\`;
|
|
2027
|
+
const winningVariant = getCookie(cookieName);
|
|
2028
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
2029
|
+
const isDefaultContent = variantContentId === defaultContentId;
|
|
2030
|
+
const isWinningVariant = winningVariant === variantContentId;
|
|
2031
|
+
if (isWinningVariant && !isDefaultContent) {
|
|
2032
|
+
parentDiv?.removeAttribute('hidden');
|
|
2033
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
2034
|
+
} else if (!isWinningVariant && isDefaultContent) {
|
|
2035
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
2036
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
1978
2037
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2038
|
+
if (isHydrationTarget) {
|
|
2039
|
+
if (!isWinningVariant) {
|
|
2040
|
+
parentDiv?.remove();
|
|
2041
|
+
}
|
|
2042
|
+
const thisScriptEl = document.currentScript;
|
|
2043
|
+
thisScriptEl?.remove();
|
|
2044
|
+
}
|
|
2045
|
+
return;
|
|
2046
|
+
}`, UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest", UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent", getVariants = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
|
|
2047
|
+
...t,
|
|
2048
|
+
testVariationId: t.id,
|
|
2049
|
+
id: e == null ? void 0 : e.id
|
|
2050
|
+
})), checkShouldRenderVariants = ({
|
|
2051
|
+
canTrack: e,
|
|
2052
|
+
content: t
|
|
2053
|
+
}) => !(!(getVariants(t).length > 0) || !e || isBrowser()), getIsHydrationTarget = (e) => e === "react" || e === "reactNative", isHydrationTarget = getIsHydrationTarget(TARGET), getScriptString = () => `
|
|
2054
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2055
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2056
|
+
`, getUpdateCookieAndStylesScript = (e, t) => `
|
|
2057
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2058
|
+
"${t}",${JSON.stringify(e)}, ${isHydrationTarget}
|
|
2059
|
+
)`, getUpdateVariantVisibilityScript = ({
|
|
1988
2060
|
contentId: e,
|
|
1989
2061
|
variationId: t
|
|
1990
|
-
}) => `
|
|
1991
|
-
|
|
2062
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2063
|
+
"${t}", "${e}", ${isHydrationTarget}
|
|
2064
|
+
)`;
|
|
1992
2065
|
function InlinedScript(e) {
|
|
1993
2066
|
return /* @__PURE__ */ jsx(
|
|
1994
2067
|
"script",
|
|
1995
2068
|
{
|
|
1996
2069
|
dangerouslySetInnerHTML: { __html: e.scriptStr },
|
|
1997
|
-
id: e.id
|
|
2070
|
+
id: e.id || ""
|
|
1998
2071
|
}
|
|
1999
2072
|
);
|
|
2000
2073
|
}
|
|
@@ -2040,7 +2113,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2040
2113
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2041
2114
|
}
|
|
2042
2115
|
};
|
|
2043
|
-
}, SDK_VERSION = "0.7.
|
|
2116
|
+
}, SDK_VERSION = "0.7.5", registerInsertMenu = () => {
|
|
2044
2117
|
register("insertMenu", {
|
|
2045
2118
|
name: "_default",
|
|
2046
2119
|
default: !0,
|
|
@@ -2089,32 +2162,32 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2089
2162
|
if (i != null && i.type)
|
|
2090
2163
|
switch (i.type) {
|
|
2091
2164
|
case "builder.evaluate": {
|
|
2092
|
-
const r = i.data.text,
|
|
2093
|
-
let
|
|
2165
|
+
const r = i.data.text, l = i.data.arguments || [], c = i.data.id, s = new Function(r);
|
|
2166
|
+
let d, g = null;
|
|
2094
2167
|
try {
|
|
2095
|
-
|
|
2096
|
-
} catch (
|
|
2097
|
-
|
|
2168
|
+
d = s.apply(null, l);
|
|
2169
|
+
} catch (b) {
|
|
2170
|
+
g = b;
|
|
2098
2171
|
}
|
|
2099
|
-
|
|
2172
|
+
g ? (o = window.parent) == null || o.postMessage({
|
|
2100
2173
|
type: "builder.evaluateError",
|
|
2101
2174
|
data: {
|
|
2102
2175
|
id: c,
|
|
2103
|
-
error:
|
|
2176
|
+
error: g.message
|
|
2104
2177
|
}
|
|
2105
|
-
}, "*") :
|
|
2106
|
-
var
|
|
2107
|
-
(
|
|
2178
|
+
}, "*") : d && typeof d.then == "function" ? d.then((b) => {
|
|
2179
|
+
var y;
|
|
2180
|
+
(y = window.parent) == null || y.postMessage({
|
|
2108
2181
|
type: "builder.evaluateResult",
|
|
2109
2182
|
data: {
|
|
2110
2183
|
id: c,
|
|
2111
|
-
result:
|
|
2184
|
+
result: b
|
|
2112
2185
|
}
|
|
2113
2186
|
}, "*");
|
|
2114
2187
|
}).catch(console.error) : (a = window.parent) == null || a.postMessage({
|
|
2115
2188
|
type: "builder.evaluateResult",
|
|
2116
2189
|
data: {
|
|
2117
|
-
result:
|
|
2190
|
+
result: d,
|
|
2118
2191
|
id: c
|
|
2119
2192
|
}
|
|
2120
2193
|
}, "*");
|
|
@@ -2124,88 +2197,88 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2124
2197
|
})));
|
|
2125
2198
|
};
|
|
2126
2199
|
function EnableEditor(e) {
|
|
2127
|
-
var
|
|
2200
|
+
var T, w, R, j, B, A, P;
|
|
2128
2201
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2129
|
-
function o(
|
|
2130
|
-
var
|
|
2131
|
-
const
|
|
2202
|
+
function o(u) {
|
|
2203
|
+
var h, S, p, k, F;
|
|
2204
|
+
const f = {
|
|
2132
2205
|
...e.builderContextSignal.content,
|
|
2133
|
-
...
|
|
2206
|
+
...u,
|
|
2134
2207
|
data: {
|
|
2135
|
-
...(
|
|
2136
|
-
...
|
|
2208
|
+
...(h = e.builderContextSignal.content) == null ? void 0 : h.data,
|
|
2209
|
+
...u == null ? void 0 : u.data
|
|
2137
2210
|
},
|
|
2138
2211
|
meta: {
|
|
2139
|
-
...(
|
|
2140
|
-
...
|
|
2141
|
-
breakpoints: ((
|
|
2212
|
+
...(S = e.builderContextSignal.content) == null ? void 0 : S.meta,
|
|
2213
|
+
...u == null ? void 0 : u.meta,
|
|
2214
|
+
breakpoints: ((p = u == null ? void 0 : u.meta) == null ? void 0 : p.breakpoints) || ((F = (k = e.builderContextSignal.content) == null ? void 0 : k.meta) == null ? void 0 : F.breakpoints)
|
|
2142
2215
|
}
|
|
2143
2216
|
};
|
|
2144
|
-
e.setBuilderContextSignal((
|
|
2145
|
-
...
|
|
2146
|
-
content:
|
|
2217
|
+
e.setBuilderContextSignal((_) => ({
|
|
2218
|
+
..._,
|
|
2219
|
+
content: f
|
|
2147
2220
|
}));
|
|
2148
2221
|
}
|
|
2149
2222
|
useState(() => 0);
|
|
2150
2223
|
const [a, r] = useState(
|
|
2151
2224
|
() => !1
|
|
2152
2225
|
);
|
|
2153
|
-
function
|
|
2154
|
-
var
|
|
2155
|
-
const { data:
|
|
2156
|
-
if (
|
|
2157
|
-
switch (
|
|
2226
|
+
function l(u) {
|
|
2227
|
+
var h;
|
|
2228
|
+
const { data: f } = u;
|
|
2229
|
+
if (f)
|
|
2230
|
+
switch (f.type) {
|
|
2158
2231
|
case "builder.configureSdk": {
|
|
2159
|
-
const
|
|
2160
|
-
if (!
|
|
2232
|
+
const S = f.data, { breakpoints: p, contentId: k } = S;
|
|
2233
|
+
if (!k || k !== ((h = e.builderContextSignal.content) == null ? void 0 : h.id))
|
|
2161
2234
|
return;
|
|
2162
|
-
|
|
2235
|
+
p && o({
|
|
2163
2236
|
meta: {
|
|
2164
|
-
breakpoints:
|
|
2237
|
+
breakpoints: p
|
|
2165
2238
|
}
|
|
2166
2239
|
}), i(n + 1);
|
|
2167
2240
|
break;
|
|
2168
2241
|
}
|
|
2169
2242
|
case "builder.contentUpdate": {
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2243
|
+
const S = f.data, p = S.key || S.alias || S.entry || S.modelName, k = S.data;
|
|
2244
|
+
p === e.model && (o(k), i(n + 1));
|
|
2172
2245
|
break;
|
|
2173
2246
|
}
|
|
2174
2247
|
}
|
|
2175
2248
|
}
|
|
2176
2249
|
function c() {
|
|
2177
|
-
var
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
code:
|
|
2250
|
+
var f, h;
|
|
2251
|
+
const u = (h = (f = e.builderContextSignal.content) == null ? void 0 : f.data) == null ? void 0 : h.jsCode;
|
|
2252
|
+
u && evaluate({
|
|
2253
|
+
code: u,
|
|
2181
2254
|
context: e.context || {},
|
|
2182
2255
|
localState: void 0,
|
|
2183
2256
|
rootState: e.builderContextSignal.rootState,
|
|
2184
2257
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2185
2258
|
});
|
|
2186
2259
|
}
|
|
2187
|
-
const [
|
|
2188
|
-
function
|
|
2189
|
-
var
|
|
2260
|
+
const [s, d] = useState(() => ({})), [g, b] = useState(() => !1);
|
|
2261
|
+
function y(u) {
|
|
2262
|
+
var f, h;
|
|
2190
2263
|
if (e.builderContextSignal.content) {
|
|
2191
|
-
const
|
|
2264
|
+
const S = (f = e.builderContextSignal.content) == null ? void 0 : f.testVariationId, p = (h = e.builderContextSignal.content) == null ? void 0 : h.id;
|
|
2192
2265
|
_track({
|
|
2193
2266
|
type: "click",
|
|
2194
2267
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2195
|
-
contentId:
|
|
2268
|
+
contentId: p,
|
|
2196
2269
|
apiKey: e.apiKey,
|
|
2197
|
-
variationId:
|
|
2198
|
-
...getInteractionPropertiesForEvent(
|
|
2199
|
-
unique: !
|
|
2270
|
+
variationId: S !== p ? S : void 0,
|
|
2271
|
+
...getInteractionPropertiesForEvent(u),
|
|
2272
|
+
unique: !g
|
|
2200
2273
|
});
|
|
2201
2274
|
}
|
|
2202
|
-
|
|
2275
|
+
g || b(!0);
|
|
2203
2276
|
}
|
|
2204
|
-
function
|
|
2205
|
-
return
|
|
2277
|
+
function m(u) {
|
|
2278
|
+
return u.replace(
|
|
2206
2279
|
/{{([^}]+)}}/g,
|
|
2207
|
-
(
|
|
2208
|
-
code:
|
|
2280
|
+
(f, h) => evaluate({
|
|
2281
|
+
code: h,
|
|
2209
2282
|
context: e.context || {},
|
|
2210
2283
|
localState: void 0,
|
|
2211
2284
|
rootState: e.builderContextSignal.rootState,
|
|
@@ -2213,32 +2286,32 @@ function EnableEditor(e) {
|
|
|
2213
2286
|
})
|
|
2214
2287
|
);
|
|
2215
2288
|
}
|
|
2216
|
-
function x({ url:
|
|
2217
|
-
fetch$1(
|
|
2218
|
-
var
|
|
2219
|
-
const
|
|
2289
|
+
function x({ url: u, key: f }) {
|
|
2290
|
+
fetch$1(u).then((h) => h.json()).then((h) => {
|
|
2291
|
+
var p, k;
|
|
2292
|
+
const S = {
|
|
2220
2293
|
...e.builderContextSignal.rootState,
|
|
2221
|
-
[
|
|
2294
|
+
[f]: h
|
|
2222
2295
|
};
|
|
2223
|
-
(
|
|
2224
|
-
}).catch((
|
|
2225
|
-
console.error("error fetching dynamic data",
|
|
2296
|
+
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, S), s[f] = !0;
|
|
2297
|
+
}).catch((h) => {
|
|
2298
|
+
console.error("error fetching dynamic data", u, h);
|
|
2226
2299
|
});
|
|
2227
2300
|
}
|
|
2228
|
-
function
|
|
2229
|
-
var
|
|
2230
|
-
const
|
|
2231
|
-
Object.entries(
|
|
2232
|
-
if (
|
|
2233
|
-
const
|
|
2301
|
+
function E() {
|
|
2302
|
+
var f, h;
|
|
2303
|
+
const u = ((h = (f = e.builderContextSignal.content) == null ? void 0 : f.data) == null ? void 0 : h.httpRequests) ?? {};
|
|
2304
|
+
Object.entries(u).forEach(([S, p]) => {
|
|
2305
|
+
if (p && (!s[S] || isEditing())) {
|
|
2306
|
+
const k = m(p);
|
|
2234
2307
|
x({
|
|
2235
|
-
url:
|
|
2236
|
-
key:
|
|
2308
|
+
url: k,
|
|
2309
|
+
key: S
|
|
2237
2310
|
});
|
|
2238
2311
|
}
|
|
2239
2312
|
});
|
|
2240
2313
|
}
|
|
2241
|
-
function
|
|
2314
|
+
function I() {
|
|
2242
2315
|
isEditing() && window.dispatchEvent(
|
|
2243
2316
|
new CustomEvent(
|
|
2244
2317
|
"builder:component:stateChange",
|
|
@@ -2253,8 +2326,8 @@ function EnableEditor(e) {
|
|
|
2253
2326
|
)
|
|
2254
2327
|
);
|
|
2255
2328
|
}
|
|
2256
|
-
function
|
|
2257
|
-
i(n + 1), window.addEventListener("message",
|
|
2329
|
+
function v(u) {
|
|
2330
|
+
i(n + 1), window.addEventListener("message", l), registerInsertMenu(), setupBrowserForEditing({
|
|
2258
2331
|
...e.locale ? {
|
|
2259
2332
|
locale: e.locale
|
|
2260
2333
|
} : {},
|
|
@@ -2266,62 +2339,62 @@ function EnableEditor(e) {
|
|
|
2266
2339
|
} : {}
|
|
2267
2340
|
}), Object.values(
|
|
2268
2341
|
e.builderContextSignal.componentInfos
|
|
2269
|
-
).forEach((
|
|
2270
|
-
var
|
|
2271
|
-
const
|
|
2272
|
-
(
|
|
2342
|
+
).forEach((f) => {
|
|
2343
|
+
var S;
|
|
2344
|
+
const h = createRegisterComponentMessage(f);
|
|
2345
|
+
(S = window.parent) == null || S.postMessage(h, "*");
|
|
2273
2346
|
}), window.addEventListener(
|
|
2274
2347
|
"builder:component:stateChangeListenerActivated",
|
|
2275
|
-
|
|
2348
|
+
I
|
|
2276
2349
|
);
|
|
2277
2350
|
}
|
|
2278
|
-
function
|
|
2279
|
-
const
|
|
2280
|
-
`builder.preview.${
|
|
2281
|
-
),
|
|
2282
|
-
|
|
2351
|
+
function C(u) {
|
|
2352
|
+
const f = new URL(location.href).searchParams, h = f.get("builder.preview"), S = f.get(
|
|
2353
|
+
`builder.preview.${h}`
|
|
2354
|
+
), p = f.get("apiKey") || f.get("builder.space");
|
|
2355
|
+
h === e.model && p === e.apiKey && (!e.content || S === e.content.id) && fetchOneEntry({
|
|
2283
2356
|
model: e.model,
|
|
2284
2357
|
apiKey: e.apiKey,
|
|
2285
2358
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2286
|
-
}).then((
|
|
2287
|
-
|
|
2359
|
+
}).then((k) => {
|
|
2360
|
+
k && o(k);
|
|
2288
2361
|
});
|
|
2289
2362
|
}
|
|
2290
2363
|
return useEffect(() => {
|
|
2291
|
-
var
|
|
2292
|
-
return (
|
|
2364
|
+
var u;
|
|
2365
|
+
return (u = t.current) == null || u.addEventListener(
|
|
2293
2366
|
"initeditingbldr",
|
|
2294
|
-
|
|
2367
|
+
v
|
|
2295
2368
|
), () => {
|
|
2296
|
-
var
|
|
2297
|
-
return (
|
|
2369
|
+
var f;
|
|
2370
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2298
2371
|
"initeditingbldr",
|
|
2299
|
-
|
|
2372
|
+
v
|
|
2300
2373
|
);
|
|
2301
2374
|
};
|
|
2302
2375
|
}, []), useEffect(() => {
|
|
2303
|
-
var
|
|
2304
|
-
return (
|
|
2376
|
+
var u;
|
|
2377
|
+
return (u = t.current) == null || u.addEventListener(
|
|
2305
2378
|
"initpreviewingbldr",
|
|
2306
|
-
|
|
2379
|
+
C
|
|
2307
2380
|
), () => {
|
|
2308
|
-
var
|
|
2309
|
-
return (
|
|
2381
|
+
var f;
|
|
2382
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2310
2383
|
"initpreviewingbldr",
|
|
2311
|
-
|
|
2384
|
+
C
|
|
2312
2385
|
);
|
|
2313
2386
|
};
|
|
2314
2387
|
}, []), useEffect(() => {
|
|
2315
|
-
var
|
|
2388
|
+
var u, f;
|
|
2316
2389
|
if (isBrowser()) {
|
|
2317
2390
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2318
|
-
const
|
|
2391
|
+
const S = (u = e.builderContextSignal.content) == null ? void 0 : u.testVariationId, p = (f = e.builderContextSignal.content) == null ? void 0 : f.id, k = e.apiKey;
|
|
2319
2392
|
_track({
|
|
2320
2393
|
type: "impression",
|
|
2321
2394
|
canTrack: !0,
|
|
2322
|
-
contentId:
|
|
2323
|
-
apiKey:
|
|
2324
|
-
variationId:
|
|
2395
|
+
contentId: p,
|
|
2396
|
+
apiKey: k,
|
|
2397
|
+
variationId: S !== p ? S : void 0
|
|
2325
2398
|
});
|
|
2326
2399
|
}
|
|
2327
2400
|
isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
@@ -2329,37 +2402,37 @@ function EnableEditor(e) {
|
|
|
2329
2402
|
}, []), useEffect(() => {
|
|
2330
2403
|
e.apiKey || logger.error(
|
|
2331
2404
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2332
|
-
), c(),
|
|
2405
|
+
), c(), E(), I();
|
|
2333
2406
|
}, []), useEffect(() => {
|
|
2334
2407
|
e.content && o(e.content);
|
|
2335
2408
|
}, [e.content]), useEffect(() => {
|
|
2336
2409
|
}, [a]), useEffect(() => {
|
|
2337
2410
|
c();
|
|
2338
2411
|
}, [
|
|
2339
|
-
(
|
|
2412
|
+
(w = (T = e.builderContextSignal.content) == null ? void 0 : T.data) == null ? void 0 : w.jsCode,
|
|
2340
2413
|
e.builderContextSignal.rootState
|
|
2341
2414
|
]), useEffect(() => {
|
|
2342
|
-
|
|
2415
|
+
E();
|
|
2343
2416
|
}, [(j = (R = e.builderContextSignal.content) == null ? void 0 : R.data) == null ? void 0 : j.httpRequests]), useEffect(() => {
|
|
2344
|
-
|
|
2417
|
+
I();
|
|
2345
2418
|
}, [e.builderContextSignal.rootState]), useEffect(() => () => {
|
|
2346
|
-
isBrowser() && (window.removeEventListener("message",
|
|
2419
|
+
isBrowser() && (window.removeEventListener("message", l), window.removeEventListener(
|
|
2347
2420
|
"builder:component:stateChangeListenerActivated",
|
|
2348
|
-
|
|
2421
|
+
I
|
|
2349
2422
|
));
|
|
2350
2423
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2351
2424
|
"div",
|
|
2352
2425
|
{
|
|
2353
2426
|
key: n,
|
|
2354
2427
|
ref: t,
|
|
2355
|
-
onClick: (
|
|
2428
|
+
onClick: (u) => y(u),
|
|
2356
2429
|
"builder-content-id": (B = e.builderContextSignal.content) == null ? void 0 : B.id,
|
|
2357
2430
|
"builder-model": e.model,
|
|
2358
2431
|
...e.showContent ? {} : {
|
|
2359
2432
|
hidden: !0,
|
|
2360
2433
|
"aria-hidden": !0
|
|
2361
2434
|
},
|
|
2362
|
-
className: e.
|
|
2435
|
+
className: `variant-${((A = e.content) == null ? void 0 : A.testVariationId) || ((P = e.content) == null ? void 0 : P.id)}`
|
|
2363
2436
|
},
|
|
2364
2437
|
e.children
|
|
2365
2438
|
) }) : null });
|
|
@@ -2431,23 +2504,18 @@ const getContextStateInitialValue = ({
|
|
|
2431
2504
|
data: t,
|
|
2432
2505
|
locale: n
|
|
2433
2506
|
}) => {
|
|
2434
|
-
var a, r,
|
|
2435
|
-
const i = {};
|
|
2436
|
-
(
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
...(s = e == null ? void 0 : e.data) == null ? void 0 : s.state,
|
|
2507
|
+
var a, r, l;
|
|
2508
|
+
const i = {}, o = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.state) || {};
|
|
2509
|
+
return (l = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || l.forEach((c) => {
|
|
2510
|
+
c.name && c.defaultValue !== void 0 && (i[c.name] = c.defaultValue);
|
|
2511
|
+
}), {
|
|
2512
|
+
...i,
|
|
2513
|
+
...o,
|
|
2442
2514
|
...t,
|
|
2443
2515
|
...n ? {
|
|
2444
2516
|
locale: n
|
|
2445
2517
|
} : {}
|
|
2446
2518
|
};
|
|
2447
|
-
return {
|
|
2448
|
-
...i,
|
|
2449
|
-
...o
|
|
2450
|
-
};
|
|
2451
2519
|
}, getContentInitialValue = ({
|
|
2452
2520
|
content: e,
|
|
2453
2521
|
data: t
|
|
@@ -2460,21 +2528,21 @@ const getContextStateInitialValue = ({
|
|
|
2460
2528
|
meta: e == null ? void 0 : e.meta
|
|
2461
2529
|
} : void 0;
|
|
2462
2530
|
function ContentComponent(e) {
|
|
2463
|
-
var c,
|
|
2531
|
+
var c, s, d, g, b, y, m;
|
|
2464
2532
|
const [t, n] = useState(
|
|
2465
2533
|
() => {
|
|
2466
|
-
var x,
|
|
2467
|
-
return
|
|
2534
|
+
var x, E;
|
|
2535
|
+
return getUpdateVariantVisibilityScript({
|
|
2468
2536
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2469
2537
|
variationId: (x = e.content) == null ? void 0 : x.testVariationId,
|
|
2470
2538
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2471
|
-
contentId: (
|
|
2539
|
+
contentId: (E = e.content) == null ? void 0 : E.id
|
|
2472
2540
|
});
|
|
2473
2541
|
}
|
|
2474
2542
|
);
|
|
2475
2543
|
function i(x) {
|
|
2476
|
-
|
|
2477
|
-
...
|
|
2544
|
+
l((E) => ({
|
|
2545
|
+
...E,
|
|
2478
2546
|
rootState: x
|
|
2479
2547
|
}));
|
|
2480
2548
|
}
|
|
@@ -2489,16 +2557,16 @@ function ContentComponent(e) {
|
|
|
2489
2557
|
...components,
|
|
2490
2558
|
...e.customComponents || []
|
|
2491
2559
|
].reduce(
|
|
2492
|
-
(x, { component:
|
|
2560
|
+
(x, { component: E, ...I }) => ({
|
|
2493
2561
|
...x,
|
|
2494
|
-
[
|
|
2495
|
-
component:
|
|
2496
|
-
...serializeComponentInfo(
|
|
2562
|
+
[I.name]: {
|
|
2563
|
+
component: E,
|
|
2564
|
+
...serializeComponentInfo(I)
|
|
2497
2565
|
}
|
|
2498
2566
|
}),
|
|
2499
2567
|
{}
|
|
2500
2568
|
)
|
|
2501
|
-
), [r,
|
|
2569
|
+
), [r, l] = useState(() => ({
|
|
2502
2570
|
content: getContentInitialValue({
|
|
2503
2571
|
content: e.content,
|
|
2504
2572
|
data: e.data
|
|
@@ -2523,9 +2591,9 @@ function ContentComponent(e) {
|
|
|
2523
2591
|
...components,
|
|
2524
2592
|
...e.customComponents || []
|
|
2525
2593
|
].reduce(
|
|
2526
|
-
(x, { component:
|
|
2594
|
+
(x, { component: E, ...I }) => ({
|
|
2527
2595
|
...x,
|
|
2528
|
-
[
|
|
2596
|
+
[I.name]: serializeComponentInfo(I)
|
|
2529
2597
|
}),
|
|
2530
2598
|
{}
|
|
2531
2599
|
),
|
|
@@ -2548,24 +2616,23 @@ function ContentComponent(e) {
|
|
|
2548
2616
|
locale: e.locale,
|
|
2549
2617
|
includeRefs: e.includeRefs,
|
|
2550
2618
|
enrich: e.enrich,
|
|
2551
|
-
classNameProp: e.classNameProp,
|
|
2552
2619
|
showContent: e.showContent,
|
|
2553
2620
|
builderContextSignal: r,
|
|
2554
|
-
setBuilderContextSignal:
|
|
2621
|
+
setBuilderContextSignal: l,
|
|
2555
2622
|
children: [
|
|
2556
2623
|
e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
|
|
2557
2624
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2558
2625
|
ContentStyles,
|
|
2559
2626
|
{
|
|
2560
2627
|
contentId: (c = r.content) == null ? void 0 : c.id,
|
|
2561
|
-
cssCode: (
|
|
2562
|
-
customFonts: (
|
|
2628
|
+
cssCode: (d = (s = r.content) == null ? void 0 : s.data) == null ? void 0 : d.cssCode,
|
|
2629
|
+
customFonts: (b = (g = r.content) == null ? void 0 : g.data) == null ? void 0 : b.customFonts
|
|
2563
2630
|
}
|
|
2564
2631
|
) }),
|
|
2565
2632
|
/* @__PURE__ */ jsx(
|
|
2566
2633
|
Blocks,
|
|
2567
2634
|
{
|
|
2568
|
-
blocks: (
|
|
2635
|
+
blocks: (m = (y = r.content) == null ? void 0 : y.data) == null ? void 0 : m.blocks,
|
|
2569
2636
|
context: r,
|
|
2570
2637
|
registeredComponents: o
|
|
2571
2638
|
}
|
|
@@ -2577,31 +2644,31 @@ function ContentComponent(e) {
|
|
|
2577
2644
|
);
|
|
2578
2645
|
}
|
|
2579
2646
|
function ContentVariants(e) {
|
|
2580
|
-
var r,
|
|
2647
|
+
var r, l;
|
|
2581
2648
|
const [t, n] = useState(
|
|
2582
|
-
() =>
|
|
2649
|
+
() => checkShouldRenderVariants({
|
|
2583
2650
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2584
2651
|
content: e.content
|
|
2585
2652
|
})
|
|
2586
2653
|
);
|
|
2587
2654
|
function i() {
|
|
2588
|
-
var
|
|
2589
|
-
return
|
|
2590
|
-
getVariants(e.content).map((
|
|
2591
|
-
id:
|
|
2592
|
-
testRatio:
|
|
2655
|
+
var c;
|
|
2656
|
+
return getUpdateCookieAndStylesScript(
|
|
2657
|
+
getVariants(e.content).map((s) => ({
|
|
2658
|
+
id: s.testVariationId,
|
|
2659
|
+
testRatio: s.testRatio
|
|
2593
2660
|
})),
|
|
2594
|
-
((
|
|
2661
|
+
((c = e.content) == null ? void 0 : c.id) || ""
|
|
2595
2662
|
);
|
|
2596
2663
|
}
|
|
2597
2664
|
function o() {
|
|
2598
|
-
return getVariants(e.content).map((
|
|
2665
|
+
return getVariants(e.content).map((c) => `.variant-${c.testVariationId} { display: none; } `).join("");
|
|
2599
2666
|
}
|
|
2600
2667
|
function a() {
|
|
2601
|
-
var
|
|
2668
|
+
var c;
|
|
2602
2669
|
return t ? {
|
|
2603
2670
|
...e.content,
|
|
2604
|
-
testVariationId: (
|
|
2671
|
+
testVariationId: (c = e.content) == null ? void 0 : c.id
|
|
2605
2672
|
} : handleABTestingSync({
|
|
2606
2673
|
item: e.content,
|
|
2607
2674
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
@@ -2619,12 +2686,11 @@ function ContentVariants(e) {
|
|
|
2619
2686
|
}
|
|
2620
2687
|
),
|
|
2621
2688
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2622
|
-
(
|
|
2689
|
+
(l = getVariants(e.content)) == null ? void 0 : l.map((c) => /* @__PURE__ */ jsx(
|
|
2623
2690
|
ContentComponent,
|
|
2624
2691
|
{
|
|
2625
|
-
content:
|
|
2692
|
+
content: c,
|
|
2626
2693
|
showContent: !1,
|
|
2627
|
-
classNameProp: void 0,
|
|
2628
2694
|
model: e.model,
|
|
2629
2695
|
data: e.data,
|
|
2630
2696
|
context: e.context,
|
|
@@ -2637,14 +2703,13 @@ function ContentVariants(e) {
|
|
|
2637
2703
|
enrich: e.enrich,
|
|
2638
2704
|
isSsrAbTest: t
|
|
2639
2705
|
},
|
|
2640
|
-
|
|
2706
|
+
c.testVariationId
|
|
2641
2707
|
))
|
|
2642
2708
|
] }) : null,
|
|
2643
2709
|
/* @__PURE__ */ jsx(
|
|
2644
2710
|
ContentComponent,
|
|
2645
2711
|
{
|
|
2646
2712
|
content: a(),
|
|
2647
|
-
classNameProp: `variant-${(c = e.content) == null ? void 0 : c.id}`,
|
|
2648
2713
|
showContent: !0,
|
|
2649
2714
|
model: e.model,
|
|
2650
2715
|
data: e.data,
|
|
@@ -2681,14 +2746,14 @@ const fetchSymbolContent = async ({
|
|
|
2681
2746
|
});
|
|
2682
2747
|
};
|
|
2683
2748
|
function Symbol$1(e) {
|
|
2684
|
-
var a, r,
|
|
2749
|
+
var a, r, l;
|
|
2685
2750
|
function t() {
|
|
2686
|
-
var c,
|
|
2751
|
+
var c, s;
|
|
2687
2752
|
return [
|
|
2688
2753
|
e.attributes.className,
|
|
2689
2754
|
"builder-symbol",
|
|
2690
2755
|
(c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
|
|
2691
|
-
(
|
|
2756
|
+
(s = e.symbol) != null && s.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2692
2757
|
].filter(Boolean).join(" ");
|
|
2693
2758
|
}
|
|
2694
2759
|
const [n, i] = useState(() => {
|
|
@@ -2719,7 +2784,7 @@ function Symbol$1(e) {
|
|
|
2719
2784
|
...e.builderContext.localState,
|
|
2720
2785
|
...(r = n == null ? void 0 : n.data) == null ? void 0 : r.state
|
|
2721
2786
|
},
|
|
2722
|
-
model: (
|
|
2787
|
+
model: (l = e.symbol) == null ? void 0 : l.model,
|
|
2723
2788
|
content: n
|
|
2724
2789
|
}
|
|
2725
2790
|
) });
|
|
@@ -2738,17 +2803,17 @@ export {
|
|
|
2738
2803
|
Symbol$1 as Symbol,
|
|
2739
2804
|
Text,
|
|
2740
2805
|
Video,
|
|
2741
|
-
|
|
2806
|
+
L as _processContentResult,
|
|
2742
2807
|
createRegisterComponentMessage,
|
|
2743
2808
|
W as fetchBuilderProps,
|
|
2744
|
-
|
|
2809
|
+
O as fetchEntries,
|
|
2745
2810
|
fetchOneEntry,
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2811
|
+
U as getAllContent,
|
|
2812
|
+
H as getBuilderSearchParams,
|
|
2813
|
+
K as getContent,
|
|
2749
2814
|
isEditing,
|
|
2750
2815
|
isPreviewing,
|
|
2751
2816
|
register,
|
|
2752
|
-
|
|
2753
|
-
|
|
2817
|
+
z as setEditorSettings,
|
|
2818
|
+
q as track
|
|
2754
2819
|
};
|