@builder.io/sdk-react 0.13.4 → 1.0.2
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 +16 -16
- package/lib/browser/index.mjs +254 -277
- package/lib/browser/server-entry-a595b1cf.cjs +2 -0
- package/lib/browser/{server-entry-2a8acf68.js → server-entry-f6f9bdcb.js} +221 -230
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +9 -11
- package/lib/edge/index.cjs +28 -28
- package/lib/edge/index.mjs +381 -404
- package/lib/edge/server-entry-a595b1cf.cjs +2 -0
- package/lib/{node/server-entry-c8223f30.js → edge/server-entry-f6f9bdcb.js} +221 -230
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +9 -11
- package/lib/node/index.cjs +10 -10
- package/lib/node/index.mjs +274 -294
- package/lib/node/server-entry-31b5d683.cjs +2 -0
- package/lib/{edge/server-entry-13732838.js → node/server-entry-c2b6d198.js} +221 -230
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +9 -11
- package/package.json +1 -1
- package/types/components/content-variants/content-variants.types.d.ts +0 -2
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-content/index.d.ts +0 -10
- package/types/functions/get-content/types.d.ts +0 -11
- package/types/functions/register-component.d.ts +0 -9
- package/types/index-helpers/blocks-exports.d.ts +0 -8
- package/types/server-index.d.ts +1 -1
- package/lib/browser/server-entry-881c178e.cjs +0 -2
- package/lib/edge/server-entry-881c178e.cjs +0 -2
- package/lib/node/server-entry-ad7cbbbf.cjs +0 -2
package/lib/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { T as TARGET, i as isEditing, h as isBrowser, j as getUserAttributes, k as fastClone, l as checkIsDefined, m as logger, n as getDefaultCanTrack, o as _track, a as isPreviewing, p as createEditorListener, q as registerInsertMenu, u as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, v as fetch$1, w as serializeComponentInfo, x as handleABTestingSync } from "./server-entry-c2b6d198.js";
|
|
4
|
+
import { _ as H, f as K, d as q, g as z, r as J, s as Y, b as G, t as Q } from "./server-entry-c2b6d198.js";
|
|
3
5
|
import { createContext, useState, useEffect, useContext, useRef, createElement } from "react";
|
|
4
|
-
import { T as TARGET, i as isEditing, k as isBrowser, l as getUserAttributes, m as fastClone, n as checkIsDefined, o as logger, p as getDefaultCanTrack, q as _track, a as isPreviewing, u as createEditorListener, v as registerInsertMenu, w as setupBrowserForEditing, c as createRegisterComponentMessage, e as fetchOneEntry, x as fetch$1, y as components, z as serializeComponentInfo, A as handleABTestingSync } from "./server-entry-c8223f30.js";
|
|
5
|
-
import { _ as H, f as K, d as q, h as z, g as J, j as Y, r as G, s as Q, b as X, t as Z } from "./server-entry-c8223f30.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
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());
|
|
8
8
|
function DynamicRenderer(e) {
|
|
@@ -25,7 +25,6 @@ function Button(e) {
|
|
|
25
25
|
return /* @__PURE__ */ jsx(
|
|
26
26
|
DynamicRenderer,
|
|
27
27
|
{
|
|
28
|
-
TagName: e.link ? e.builderLinkComponent || "a" : "button",
|
|
29
28
|
attributes: {
|
|
30
29
|
...e.attributes,
|
|
31
30
|
[getClassPropName()]: `${e.link ? "" : "builder-button"} ${e.attributes[getClassPropName()] || ""}`,
|
|
@@ -37,6 +36,7 @@ function Button(e) {
|
|
|
37
36
|
role: "button"
|
|
38
37
|
}
|
|
39
38
|
},
|
|
39
|
+
TagName: e.link ? e.builderLinkComponent || "a" : "button",
|
|
40
40
|
actionAttributes: {},
|
|
41
41
|
children: e.text
|
|
42
42
|
}
|
|
@@ -148,7 +148,7 @@ try {
|
|
|
148
148
|
} catch (e) {
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const getSyncValName = (e) => `bldr_${e}_sync`, BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE", INJECTED_IVM_GLOBAL = "BUILDER_IVM", REF_TO_PROXY_FN = `
|
|
152
152
|
var refToProxy = (obj) => {
|
|
153
153
|
if (typeof obj !== 'object' || obj === null) {
|
|
154
154
|
return obj;
|
|
@@ -194,9 +194,12 @@ if (typeof output === 'object' && output !== null) {
|
|
|
194
194
|
|
|
195
195
|
output;
|
|
196
196
|
`;
|
|
197
|
-
}, getIsolateContext = () =>
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
}, getIsolateContext = () => {
|
|
198
|
+
const e = safeDynamicRequire("isolated-vm");
|
|
199
|
+
return new e.Isolate({
|
|
200
|
+
memoryLimit: 128
|
|
201
|
+
}).createContextSync();
|
|
202
|
+
}, runInNode = ({
|
|
200
203
|
code: e,
|
|
201
204
|
builder: t,
|
|
202
205
|
context: n,
|
|
@@ -205,37 +208,37 @@ output;
|
|
|
205
208
|
rootSetState: a,
|
|
206
209
|
rootState: r
|
|
207
210
|
}) => {
|
|
208
|
-
const s = fastClone({
|
|
211
|
+
const s = safeDynamicRequire("isolated-vm"), l = fastClone({
|
|
209
212
|
...r,
|
|
210
213
|
...o
|
|
211
|
-
}),
|
|
214
|
+
}), c = getFunctionArguments({
|
|
212
215
|
builder: t,
|
|
213
216
|
context: n,
|
|
214
217
|
event: i,
|
|
215
|
-
state:
|
|
216
|
-
}),
|
|
217
|
-
|
|
218
|
-
console.log(...
|
|
219
|
-
}),
|
|
220
|
-
set(r,
|
|
221
|
-
}),
|
|
222
|
-
const
|
|
218
|
+
state: l
|
|
219
|
+
}), u = getIsolateContext(), y = u.global;
|
|
220
|
+
y.setSync("global", y.derefInto()), y.setSync("log", function(...d) {
|
|
221
|
+
console.log(...d);
|
|
222
|
+
}), y.setSync(BUILDER_SET_STATE_NAME, function(d, f) {
|
|
223
|
+
set(r, d, f), a == null || a(r);
|
|
224
|
+
}), c.forEach(([d, f]) => {
|
|
225
|
+
const v = typeof f == "object" ? new s.Reference(
|
|
223
226
|
// workaround: methods with default values for arguments is not being cloned over
|
|
224
|
-
|
|
225
|
-
...
|
|
226
|
-
getUserAttributes: () =>
|
|
227
|
-
} :
|
|
227
|
+
d === "builder" ? {
|
|
228
|
+
...f,
|
|
229
|
+
getUserAttributes: () => f.getUserAttributes()
|
|
230
|
+
} : f
|
|
228
231
|
) : null;
|
|
229
|
-
|
|
230
|
-
}),
|
|
231
|
-
const
|
|
232
|
+
y.setSync(getSyncValName(d), v);
|
|
233
|
+
}), y.setSync(INJECTED_IVM_GLOBAL, s);
|
|
234
|
+
const x = processCode({
|
|
232
235
|
code: e,
|
|
233
|
-
args:
|
|
234
|
-
}),
|
|
236
|
+
args: c
|
|
237
|
+
}), m = u.evalSync(x);
|
|
235
238
|
try {
|
|
236
|
-
return JSON.parse(
|
|
239
|
+
return JSON.parse(m);
|
|
237
240
|
} catch {
|
|
238
|
-
return
|
|
241
|
+
return m;
|
|
239
242
|
}
|
|
240
243
|
};
|
|
241
244
|
function isNodeRuntime() {
|
|
@@ -340,8 +343,8 @@ function throttle(e, t, n = {}) {
|
|
|
340
343
|
return function() {
|
|
341
344
|
const c = Date.now();
|
|
342
345
|
!s && n.leading === !1 && (s = c);
|
|
343
|
-
const
|
|
344
|
-
return i = this, o = arguments,
|
|
346
|
+
const u = t - (c - s);
|
|
347
|
+
return i = this, o = arguments, u <= 0 || u > t ? (r && (clearTimeout(r), r = null), s = c, a = e.apply(i, o), r || (i = o = null)) : !r && n.trailing !== !1 && (r = setTimeout(l, u)), a;
|
|
345
348
|
};
|
|
346
349
|
}
|
|
347
350
|
function assign(e, ...t) {
|
|
@@ -438,9 +441,9 @@ function bindScrollInViewAnimation(e) {
|
|
|
438
441
|
const r = throttle(a, 200, {
|
|
439
442
|
leading: !1
|
|
440
443
|
});
|
|
441
|
-
function s(
|
|
442
|
-
const y =
|
|
443
|
-
return y.bottom >
|
|
444
|
+
function s(u) {
|
|
445
|
+
const y = u.getBoundingClientRect(), x = window.innerHeight, d = (e.thresholdPercent || 0) / 100 * x;
|
|
446
|
+
return y.bottom > d && y.top < x - d;
|
|
444
447
|
}
|
|
445
448
|
const l = e.steps[0].styles;
|
|
446
449
|
function c() {
|
|
@@ -583,7 +586,7 @@ function BlockStyles(e) {
|
|
|
583
586
|
return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
|
|
584
587
|
}
|
|
585
588
|
function n() {
|
|
586
|
-
var
|
|
589
|
+
var d;
|
|
587
590
|
const i = getProcessedBlock({
|
|
588
591
|
block: e.block,
|
|
589
592
|
localState: e.context.localState,
|
|
@@ -592,29 +595,29 @@ function BlockStyles(e) {
|
|
|
592
595
|
context: e.context.context,
|
|
593
596
|
shouldEvaluateBindings: !0
|
|
594
597
|
}), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
595
|
-
((
|
|
596
|
-
), s = o == null ? void 0 : o.large, l = o == null ? void 0 : o.medium, c = o == null ? void 0 : o.small,
|
|
597
|
-
if (!
|
|
598
|
+
((d = a == null ? void 0 : a.meta) == null ? void 0 : d.breakpoints) || {}
|
|
599
|
+
), s = o == null ? void 0 : o.large, l = o == null ? void 0 : o.medium, c = o == null ? void 0 : o.small, u = i.id;
|
|
600
|
+
if (!u)
|
|
598
601
|
return "";
|
|
599
602
|
const y = s ? createCssClass({
|
|
600
|
-
className:
|
|
603
|
+
className: u,
|
|
601
604
|
styles: s
|
|
602
605
|
}) : "", x = l ? createCssClass({
|
|
603
|
-
className:
|
|
606
|
+
className: u,
|
|
604
607
|
styles: l,
|
|
605
608
|
mediaQuery: getMaxWidthQueryForSize(
|
|
606
609
|
"medium",
|
|
607
610
|
r
|
|
608
611
|
)
|
|
609
|
-
}) : "",
|
|
610
|
-
className:
|
|
612
|
+
}) : "", m = c ? createCssClass({
|
|
613
|
+
className: u,
|
|
611
614
|
styles: c,
|
|
612
615
|
mediaQuery: getMaxWidthQueryForSize(
|
|
613
616
|
"small",
|
|
614
617
|
r
|
|
615
618
|
)
|
|
616
619
|
}) : "";
|
|
617
|
-
return [y, x,
|
|
620
|
+
return [y, x, m].join(" ");
|
|
618
621
|
}
|
|
619
622
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
620
623
|
}
|
|
@@ -823,7 +826,7 @@ function RepeatedBlock(e) {
|
|
|
823
826
|
) });
|
|
824
827
|
}
|
|
825
828
|
function Block(e) {
|
|
826
|
-
var
|
|
829
|
+
var u, y, x;
|
|
827
830
|
function t() {
|
|
828
831
|
return getComponent({
|
|
829
832
|
block: e.block,
|
|
@@ -838,8 +841,8 @@ function Block(e) {
|
|
|
838
841
|
});
|
|
839
842
|
}
|
|
840
843
|
function i() {
|
|
841
|
-
var
|
|
842
|
-
return (
|
|
844
|
+
var m;
|
|
845
|
+
return (m = e.block.repeat) != null && m.collection ? e.block : getProcessedBlock({
|
|
843
846
|
block: e.block,
|
|
844
847
|
localState: e.context.localState,
|
|
845
848
|
rootState: e.context.rootState,
|
|
@@ -849,32 +852,32 @@ function Block(e) {
|
|
|
849
852
|
});
|
|
850
853
|
}
|
|
851
854
|
function o() {
|
|
852
|
-
var
|
|
853
|
-
return e.block.tagName === "a" || ((
|
|
855
|
+
var d;
|
|
856
|
+
return e.block.tagName === "a" || ((d = i().properties) == null ? void 0 : d.href) || i().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
854
857
|
}
|
|
855
858
|
function a() {
|
|
856
|
-
var
|
|
857
|
-
if ((
|
|
858
|
-
return !!((
|
|
859
|
-
const
|
|
860
|
-
return ("show" in i() ? i().show : !0) && !
|
|
859
|
+
var f, v;
|
|
860
|
+
if ((f = e.block.repeat) != null && f.collection)
|
|
861
|
+
return !!((v = n == null ? void 0 : n()) != null && v.length);
|
|
862
|
+
const m = "hide" in i() ? i().hide : !1;
|
|
863
|
+
return ("show" in i() ? i().show : !0) && !m;
|
|
861
864
|
}
|
|
862
865
|
function r() {
|
|
863
|
-
var
|
|
864
|
-
return !((
|
|
866
|
+
var d, f;
|
|
867
|
+
return !((d = t == null ? void 0 : t()) != null && d.component) && !n() ? (f = i().children) != null ? f : [] : [];
|
|
865
868
|
}
|
|
866
869
|
function s() {
|
|
867
|
-
var
|
|
870
|
+
var m, d, f, v, R, S, C, w, E, B, F;
|
|
868
871
|
return {
|
|
869
|
-
blockChildren: (
|
|
870
|
-
componentRef: (
|
|
872
|
+
blockChildren: (m = i().children) != null ? m : [],
|
|
873
|
+
componentRef: (d = t == null ? void 0 : t()) == null ? void 0 : d.component,
|
|
871
874
|
componentOptions: {
|
|
872
875
|
...getBlockComponentOptions(i()),
|
|
873
876
|
builderContext: e.context,
|
|
874
|
-
...((
|
|
877
|
+
...((f = t == null ? void 0 : t()) == null ? void 0 : f.name) === "Core:Button" || ((v = t == null ? void 0 : t()) == null ? void 0 : v.name) === "Symbol" || ((R = t == null ? void 0 : t()) == null ? void 0 : R.name) === "Columns" || ((S = t == null ? void 0 : t()) == null ? void 0 : S.name) === "Form:Form" ? {
|
|
875
878
|
builderLinkComponent: e.linkComponent
|
|
876
879
|
} : {},
|
|
877
|
-
...((
|
|
880
|
+
...((C = t == null ? void 0 : t()) == null ? void 0 : C.name) === "Symbol" || ((w = t == null ? void 0 : t()) == null ? void 0 : w.name) === "Columns" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Form:Form" ? {
|
|
878
881
|
builderComponents: e.registeredComponents
|
|
879
882
|
} : {}
|
|
880
883
|
},
|
|
@@ -883,21 +886,21 @@ function Block(e) {
|
|
|
883
886
|
registeredComponents: e.registeredComponents,
|
|
884
887
|
builderBlock: i(),
|
|
885
888
|
includeBlockProps: ((B = t == null ? void 0 : t()) == null ? void 0 : B.noWrap) === !0,
|
|
886
|
-
isInteractive: !((
|
|
889
|
+
isInteractive: !((F = t == null ? void 0 : t()) != null && F.isRSC)
|
|
887
890
|
};
|
|
888
891
|
}
|
|
889
892
|
const [l, c] = useState(() => e.context);
|
|
890
893
|
return useEffect(() => {
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
...
|
|
895
|
-
elementId:
|
|
894
|
+
const m = i().id, d = i().animations;
|
|
895
|
+
d && m && bindAnimations(
|
|
896
|
+
d.filter((f) => f.trigger !== "hover").map((f) => ({
|
|
897
|
+
...f,
|
|
898
|
+
elementId: m
|
|
896
899
|
}))
|
|
897
900
|
);
|
|
898
901
|
}, []), /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
899
902
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
900
|
-
(
|
|
903
|
+
(u = t == null ? void 0 : t()) != null && u.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
901
904
|
ComponentRef,
|
|
902
905
|
{
|
|
903
906
|
componentRef: s().componentRef,
|
|
@@ -910,15 +913,15 @@ function Block(e) {
|
|
|
910
913
|
includeBlockProps: s().includeBlockProps,
|
|
911
914
|
isInteractive: s().isInteractive
|
|
912
915
|
}
|
|
913
|
-
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((
|
|
916
|
+
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((m, d) => /* @__PURE__ */ jsx(
|
|
914
917
|
RepeatedBlock,
|
|
915
918
|
{
|
|
916
|
-
repeatContext:
|
|
917
|
-
block:
|
|
919
|
+
repeatContext: m.context,
|
|
920
|
+
block: m.block,
|
|
918
921
|
registeredComponents: e.registeredComponents,
|
|
919
922
|
linkComponent: e.linkComponent
|
|
920
923
|
},
|
|
921
|
-
|
|
924
|
+
d
|
|
922
925
|
)) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
923
926
|
BlockWrapper,
|
|
924
927
|
{
|
|
@@ -941,15 +944,15 @@ function Block(e) {
|
|
|
941
944
|
isInteractive: s().isInteractive
|
|
942
945
|
}
|
|
943
946
|
),
|
|
944
|
-
(y = r()) == null ? void 0 : y.map((
|
|
947
|
+
(y = r()) == null ? void 0 : y.map((m) => /* @__PURE__ */ jsx(
|
|
945
948
|
Block,
|
|
946
949
|
{
|
|
947
|
-
block:
|
|
950
|
+
block: m,
|
|
948
951
|
context: l,
|
|
949
952
|
registeredComponents: e.registeredComponents,
|
|
950
953
|
linkComponent: e.linkComponent
|
|
951
954
|
},
|
|
952
|
-
|
|
955
|
+
m.id
|
|
953
956
|
))
|
|
954
957
|
]
|
|
955
958
|
}
|
|
@@ -1042,29 +1045,29 @@ function Columns(e) {
|
|
|
1042
1045
|
() => e.stackColumnsAt || "tablet"
|
|
1043
1046
|
);
|
|
1044
1047
|
function s(S) {
|
|
1045
|
-
var
|
|
1046
|
-
return ((
|
|
1048
|
+
var C;
|
|
1049
|
+
return ((C = i[S]) == null ? void 0 : C.width) || 100 / i.length;
|
|
1047
1050
|
}
|
|
1048
1051
|
function l(S) {
|
|
1049
|
-
const
|
|
1050
|
-
return `calc(${s(S)}% - ${
|
|
1052
|
+
const C = t * (i.length - 1) / i.length;
|
|
1053
|
+
return `calc(${s(S)}% - ${C}px)`;
|
|
1051
1054
|
}
|
|
1052
1055
|
function c({
|
|
1053
1056
|
stackedStyle: S,
|
|
1054
|
-
desktopStyle:
|
|
1057
|
+
desktopStyle: C
|
|
1055
1058
|
}) {
|
|
1056
|
-
return a === "tablet" ? S :
|
|
1059
|
+
return a === "tablet" ? S : C;
|
|
1057
1060
|
}
|
|
1058
|
-
function
|
|
1061
|
+
function u({
|
|
1059
1062
|
stackedStyle: S,
|
|
1060
|
-
desktopStyle:
|
|
1063
|
+
desktopStyle: C
|
|
1061
1064
|
}) {
|
|
1062
|
-
return a === "never" ?
|
|
1065
|
+
return a === "never" ? C : S;
|
|
1063
1066
|
}
|
|
1064
1067
|
const [y, x] = useState(
|
|
1065
1068
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1066
1069
|
);
|
|
1067
|
-
function
|
|
1070
|
+
function m() {
|
|
1068
1071
|
return {
|
|
1069
1072
|
"--flex-dir": y,
|
|
1070
1073
|
"--flex-dir-tablet": c({
|
|
@@ -1073,8 +1076,8 @@ function Columns(e) {
|
|
|
1073
1076
|
})
|
|
1074
1077
|
};
|
|
1075
1078
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const
|
|
1079
|
+
function d(S) {
|
|
1080
|
+
const C = S === 0 ? 0 : t, w = l(S), E = `${C}px`, B = "100%", F = 0;
|
|
1078
1081
|
return {
|
|
1079
1082
|
...{
|
|
1080
1083
|
display: "flex",
|
|
@@ -1083,12 +1086,12 @@ function Columns(e) {
|
|
|
1083
1086
|
},
|
|
1084
1087
|
width: w,
|
|
1085
1088
|
["marginLeft"]: E,
|
|
1086
|
-
"--column-width-mobile":
|
|
1089
|
+
"--column-width-mobile": u({
|
|
1087
1090
|
stackedStyle: B,
|
|
1088
1091
|
desktopStyle: w
|
|
1089
1092
|
}),
|
|
1090
|
-
"--column-margin-left-mobile":
|
|
1091
|
-
stackedStyle:
|
|
1093
|
+
"--column-margin-left-mobile": u({
|
|
1094
|
+
stackedStyle: F,
|
|
1092
1095
|
desktopStyle: E
|
|
1093
1096
|
}),
|
|
1094
1097
|
"--column-width-tablet": c({
|
|
@@ -1096,20 +1099,20 @@ function Columns(e) {
|
|
|
1096
1099
|
desktopStyle: w
|
|
1097
1100
|
}),
|
|
1098
1101
|
"--column-margin-left-tablet": c({
|
|
1099
|
-
stackedStyle:
|
|
1102
|
+
stackedStyle: F,
|
|
1100
1103
|
desktopStyle: E
|
|
1101
1104
|
})
|
|
1102
1105
|
};
|
|
1103
1106
|
}
|
|
1104
|
-
function
|
|
1107
|
+
function f(S) {
|
|
1105
1108
|
var w, E;
|
|
1106
1109
|
return getSizesForBreakpoints(
|
|
1107
1110
|
((E = (w = e.builderContext.content) == null ? void 0 : w.meta) == null ? void 0 : E.breakpoints) || {}
|
|
1108
1111
|
)[S].max;
|
|
1109
1112
|
}
|
|
1110
|
-
function
|
|
1113
|
+
function v() {
|
|
1111
1114
|
return `
|
|
1112
|
-
@media (max-width: ${
|
|
1115
|
+
@media (max-width: ${f("medium")}px) {
|
|
1113
1116
|
.${e.builderBlock.id}-breakpoints {
|
|
1114
1117
|
flex-direction: var(--flex-dir-tablet);
|
|
1115
1118
|
align-items: stretch;
|
|
@@ -1121,7 +1124,7 @@ function Columns(e) {
|
|
|
1121
1124
|
}
|
|
1122
1125
|
}
|
|
1123
1126
|
|
|
1124
|
-
@media (max-width: ${
|
|
1127
|
+
@media (max-width: ${f("small")}px) {
|
|
1125
1128
|
.${e.builderBlock.id}-breakpoints {
|
|
1126
1129
|
flex-direction: var(--flex-dir);
|
|
1127
1130
|
align-items: stretch;
|
|
@@ -1138,11 +1141,11 @@ function Columns(e) {
|
|
|
1138
1141
|
/* @__PURE__ */ jsxs(
|
|
1139
1142
|
"div",
|
|
1140
1143
|
{
|
|
1141
|
-
className: `builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
1142
|
-
style:
|
|
1144
|
+
className: `builder-columns ${e.builderBlock.id}-breakpoints div-f5024694`,
|
|
1145
|
+
style: m(),
|
|
1143
1146
|
children: [
|
|
1144
|
-
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles:
|
|
1145
|
-
(R = e.columns) == null ? void 0 : R.map((S,
|
|
1147
|
+
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: v() }) }),
|
|
1148
|
+
(R = e.columns) == null ? void 0 : R.map((S, C) => /* @__PURE__ */ jsx(
|
|
1146
1149
|
DynamicRenderer,
|
|
1147
1150
|
{
|
|
1148
1151
|
TagName: S.link ? e.builderLinkComponent || "a" : "div",
|
|
@@ -1152,12 +1155,12 @@ function Columns(e) {
|
|
|
1152
1155
|
href: S.link
|
|
1153
1156
|
} : {},
|
|
1154
1157
|
[getClassPropName()]: "builder-column",
|
|
1155
|
-
style: mapStyleObjToStrIfNeeded(
|
|
1158
|
+
style: mapStyleObjToStrIfNeeded(d(C))
|
|
1156
1159
|
},
|
|
1157
1160
|
children: /* @__PURE__ */ jsx(
|
|
1158
1161
|
Blocks,
|
|
1159
1162
|
{
|
|
1160
|
-
path: `component.options.columns.${
|
|
1163
|
+
path: `component.options.columns.${C}.blocks`,
|
|
1161
1164
|
parent: e.builderBlock.id,
|
|
1162
1165
|
styleProp: {
|
|
1163
1166
|
flexGrow: "1"
|
|
@@ -1169,12 +1172,12 @@ function Columns(e) {
|
|
|
1169
1172
|
}
|
|
1170
1173
|
)
|
|
1171
1174
|
},
|
|
1172
|
-
|
|
1175
|
+
C
|
|
1173
1176
|
))
|
|
1174
1177
|
]
|
|
1175
1178
|
}
|
|
1176
1179
|
),
|
|
1177
|
-
/* @__PURE__ */ jsx("style", { children: `.div-
|
|
1180
|
+
/* @__PURE__ */ jsx("style", { children: `.div-f5024694 {
|
|
1178
1181
|
display: flex;
|
|
1179
1182
|
line-height: normal;
|
|
1180
1183
|
}` })
|
|
@@ -1216,13 +1219,13 @@ function getSrcSet(e) {
|
|
|
1216
1219
|
function Image(e) {
|
|
1217
1220
|
var o, a, r, s;
|
|
1218
1221
|
function t() {
|
|
1219
|
-
var
|
|
1222
|
+
var u;
|
|
1220
1223
|
const c = e.image || e.src;
|
|
1221
1224
|
if (!c || // We can auto add srcset for cdn.builder.io and shopify
|
|
1222
1225
|
// images, otherwise you can supply this prop manually
|
|
1223
1226
|
!(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
|
|
1224
1227
|
return e.srcset;
|
|
1225
|
-
if (e.srcset && ((
|
|
1228
|
+
if (e.srcset && ((u = e.image) != null && u.includes("builder.io/api/v1/image"))) {
|
|
1226
1229
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1227
1230
|
return console.debug("Removed given srcset"), getSrcSet(c);
|
|
1228
1231
|
} else if (e.image && !e.srcset)
|
|
@@ -1579,13 +1582,13 @@ const componentInfo$f = {
|
|
|
1579
1582
|
e.delete("srcset"), e.delete("noWebp");
|
|
1580
1583
|
function n(r, s = 6e4) {
|
|
1581
1584
|
return new Promise((l, c) => {
|
|
1582
|
-
const
|
|
1585
|
+
const u = document.createElement("img");
|
|
1583
1586
|
let y = !1;
|
|
1584
|
-
|
|
1585
|
-
y = !0, l(
|
|
1586
|
-
},
|
|
1587
|
+
u.onload = () => {
|
|
1588
|
+
y = !0, l(u);
|
|
1589
|
+
}, u.addEventListener("error", (x) => {
|
|
1587
1590
|
console.warn("Image load failed", x.error), c(x.error);
|
|
1588
|
-
}),
|
|
1591
|
+
}), u.src = r, setTimeout(() => {
|
|
1589
1592
|
y || c(new Error("Image load timed out"));
|
|
1590
1593
|
}, s);
|
|
1591
1594
|
});
|
|
@@ -1834,8 +1837,8 @@ function CustomCode(e) {
|
|
|
1834
1837
|
if (n.includes(c.src))
|
|
1835
1838
|
continue;
|
|
1836
1839
|
n.push(c.src);
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1840
|
+
const u = document.createElement("script");
|
|
1841
|
+
u.async = !0, u.src = c.src, document.head.appendChild(u);
|
|
1839
1842
|
} else if (!c.type || [
|
|
1840
1843
|
"text/javascript",
|
|
1841
1844
|
"application/javascript",
|
|
@@ -1845,8 +1848,8 @@ function CustomCode(e) {
|
|
|
1845
1848
|
continue;
|
|
1846
1849
|
try {
|
|
1847
1850
|
o.push(c.innerText), new Function(c.innerText)();
|
|
1848
|
-
} catch (
|
|
1849
|
-
console.warn("`CustomCode`: Error running script:",
|
|
1851
|
+
} catch (u) {
|
|
1852
|
+
console.warn("`CustomCode`: Error running script:", u);
|
|
1850
1853
|
}
|
|
1851
1854
|
}
|
|
1852
1855
|
}
|
|
@@ -1891,8 +1894,8 @@ function Embed(e) {
|
|
|
1891
1894
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1892
1895
|
return;
|
|
1893
1896
|
const c = t.current.getElementsByTagName("script");
|
|
1894
|
-
for (let
|
|
1895
|
-
const y = c[
|
|
1897
|
+
for (let u = 0; u < c.length; u++) {
|
|
1898
|
+
const y = c[u];
|
|
1896
1899
|
if (y.src && !n.includes(y.src)) {
|
|
1897
1900
|
n.push(y.src);
|
|
1898
1901
|
const x = document.createElement("script");
|
|
@@ -2157,89 +2160,89 @@ const componentInfo$5 = {
|
|
|
2157
2160
|
function FormComponent(e) {
|
|
2158
2161
|
var y, x;
|
|
2159
2162
|
const t = useRef(null), [n, i] = useState(() => "unsubmitted"), [o, a] = useState(() => null), [r, s] = useState(() => "");
|
|
2160
|
-
function l(
|
|
2161
|
-
var
|
|
2162
|
-
const
|
|
2163
|
+
function l(m) {
|
|
2164
|
+
var f, v;
|
|
2165
|
+
const d = {
|
|
2163
2166
|
...e.builderContext.rootState,
|
|
2164
|
-
...
|
|
2167
|
+
...m
|
|
2165
2168
|
};
|
|
2166
|
-
e.builderContext.rootSetState ? (
|
|
2169
|
+
e.builderContext.rootSetState ? (v = (f = e.builderContext).rootSetState) == null || v.call(f, d) : e.builderContext.rootState = d;
|
|
2167
2170
|
}
|
|
2168
2171
|
function c() {
|
|
2169
2172
|
return isEditing() && e.previewState || n;
|
|
2170
2173
|
}
|
|
2171
|
-
function
|
|
2172
|
-
var
|
|
2173
|
-
const
|
|
2174
|
+
function u(m) {
|
|
2175
|
+
var f;
|
|
2176
|
+
const d = e.sendWithJs || e.sendSubmissionsTo === "email";
|
|
2174
2177
|
if (e.sendSubmissionsTo === "zapier")
|
|
2175
|
-
|
|
2176
|
-
else if (
|
|
2178
|
+
m.preventDefault();
|
|
2179
|
+
else if (d) {
|
|
2177
2180
|
if (!(e.action || e.sendSubmissionsTo === "email")) {
|
|
2178
|
-
|
|
2181
|
+
m.preventDefault();
|
|
2179
2182
|
return;
|
|
2180
2183
|
}
|
|
2181
|
-
|
|
2182
|
-
const
|
|
2184
|
+
m.preventDefault();
|
|
2185
|
+
const v = m.currentTarget, R = e.customHeaders || {};
|
|
2183
2186
|
let S;
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
).filter((
|
|
2187
|
-
let
|
|
2188
|
-
const
|
|
2189
|
-
if (
|
|
2190
|
-
if (
|
|
2191
|
-
if (
|
|
2192
|
-
return
|
|
2193
|
-
key:
|
|
2194
|
-
value:
|
|
2187
|
+
const C = new FormData(v), w = Array.from(
|
|
2188
|
+
m.currentTarget.querySelectorAll("input,select,textarea")
|
|
2189
|
+
).filter((g) => !!g.name).map((g) => {
|
|
2190
|
+
let I;
|
|
2191
|
+
const A = g.name;
|
|
2192
|
+
if (g instanceof HTMLInputElement)
|
|
2193
|
+
if (g.type === "radio") {
|
|
2194
|
+
if (g.checked)
|
|
2195
|
+
return I = g.name, {
|
|
2196
|
+
key: A,
|
|
2197
|
+
value: I
|
|
2195
2198
|
};
|
|
2196
|
-
} else if (
|
|
2197
|
-
|
|
2198
|
-
else if (
|
|
2199
|
-
const j =
|
|
2200
|
-
isNaN(j) || (
|
|
2199
|
+
} else if (g.type === "checkbox")
|
|
2200
|
+
I = g.checked;
|
|
2201
|
+
else if (g.type === "number" || g.type === "range") {
|
|
2202
|
+
const j = g.valueAsNumber;
|
|
2203
|
+
isNaN(j) || (I = j);
|
|
2201
2204
|
} else
|
|
2202
|
-
|
|
2205
|
+
g.type === "file" ? I = g.files : I = g.value;
|
|
2203
2206
|
else
|
|
2204
|
-
|
|
2207
|
+
I = g.value;
|
|
2205
2208
|
return {
|
|
2206
|
-
key:
|
|
2207
|
-
value:
|
|
2209
|
+
key: A,
|
|
2210
|
+
value: I
|
|
2208
2211
|
};
|
|
2209
2212
|
});
|
|
2210
2213
|
let E = e.contentType;
|
|
2211
|
-
if (e.sendSubmissionsTo === "email" && (E = "multipart/form-data"), Array.from(w).forEach(({ value:
|
|
2212
|
-
(
|
|
2214
|
+
if (e.sendSubmissionsTo === "email" && (E = "multipart/form-data"), Array.from(w).forEach(({ value: g }) => {
|
|
2215
|
+
(g instanceof File || Array.isArray(g) && g[0] instanceof File || g instanceof FileList) && (E = "multipart/form-data");
|
|
2213
2216
|
}), E !== "application/json")
|
|
2214
|
-
S =
|
|
2217
|
+
S = C;
|
|
2215
2218
|
else {
|
|
2216
|
-
const
|
|
2217
|
-
Array.from(w).forEach(({ value:
|
|
2218
|
-
set(
|
|
2219
|
-
}), S = JSON.stringify(
|
|
2219
|
+
const g = {};
|
|
2220
|
+
Array.from(w).forEach(({ value: I, key: A }) => {
|
|
2221
|
+
set(g, A, I);
|
|
2222
|
+
}), S = JSON.stringify(g);
|
|
2220
2223
|
}
|
|
2221
|
-
E && E !== "multipart/form-data" && (
|
|
2224
|
+
E && E !== "multipart/form-data" && (d && ((f = e.action) != null && f.includes("zapier.com")) || (R["content-type"] = E));
|
|
2222
2225
|
const B = new CustomEvent("presubmit", { detail: { body: S } });
|
|
2223
2226
|
if (t.current && (t.current.dispatchEvent(B), B.defaultPrevented))
|
|
2224
2227
|
return;
|
|
2225
2228
|
i("sending");
|
|
2226
|
-
const
|
|
2229
|
+
const F = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(
|
|
2227
2230
|
e.sendSubmissionsToEmail || ""
|
|
2228
2231
|
)}&name=${encodeURIComponent(e.name || "")}`;
|
|
2229
2232
|
fetch(
|
|
2230
|
-
e.sendSubmissionsTo === "email" ?
|
|
2233
|
+
e.sendSubmissionsTo === "email" ? F : e.action,
|
|
2231
2234
|
{ body: S, headers: R, method: e.method || "post" }
|
|
2232
2235
|
).then(
|
|
2233
|
-
async (
|
|
2234
|
-
let
|
|
2235
|
-
const
|
|
2236
|
-
if (
|
|
2237
|
-
let j = get(
|
|
2236
|
+
async (g) => {
|
|
2237
|
+
let I;
|
|
2238
|
+
const A = g.headers.get("content-type");
|
|
2239
|
+
if (A && A.indexOf("application/json") !== -1 ? I = await g.json() : I = await g.text(), !g.ok && e.errorMessagePath) {
|
|
2240
|
+
let j = get(I, e.errorMessagePath);
|
|
2238
2241
|
j && (typeof j != "string" && (j = JSON.stringify(j)), s(j), l({ formErrorMessage: j }));
|
|
2239
2242
|
}
|
|
2240
|
-
if (a(
|
|
2243
|
+
if (a(I), i(g.ok ? "success" : "error"), g.ok) {
|
|
2241
2244
|
const j = new CustomEvent("submit:success", {
|
|
2242
|
-
detail: { res:
|
|
2245
|
+
detail: { res: g, body: I }
|
|
2243
2246
|
});
|
|
2244
2247
|
if (t.current) {
|
|
2245
2248
|
if (t.current.dispatchEvent(j), j.defaultPrevented)
|
|
@@ -2256,11 +2259,11 @@ function FormComponent(e) {
|
|
|
2256
2259
|
location.href = e.successUrl;
|
|
2257
2260
|
}
|
|
2258
2261
|
},
|
|
2259
|
-
(
|
|
2260
|
-
const
|
|
2261
|
-
detail: { error:
|
|
2262
|
+
(g) => {
|
|
2263
|
+
const I = new CustomEvent("submit:error", {
|
|
2264
|
+
detail: { error: g }
|
|
2262
2265
|
});
|
|
2263
|
-
t.current && (t.current.dispatchEvent(
|
|
2266
|
+
t.current && (t.current.dispatchEvent(I), I.defaultPrevented) || (a(g), i("error"));
|
|
2264
2267
|
}
|
|
2265
2268
|
);
|
|
2266
2269
|
}
|
|
@@ -2275,19 +2278,19 @@ function FormComponent(e) {
|
|
|
2275
2278
|
action: !e.sendWithJs && e.action,
|
|
2276
2279
|
method: e.method,
|
|
2277
2280
|
name: e.name,
|
|
2278
|
-
onSubmit: (
|
|
2281
|
+
onSubmit: (m) => u(m),
|
|
2279
2282
|
...e.attributes,
|
|
2280
2283
|
children: [
|
|
2281
2284
|
" ",
|
|
2282
|
-
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ jsx(Fragment, { children: (x = (y = e.builderBlock) == null ? void 0 : y.children) == null ? void 0 : x.map((
|
|
2285
|
+
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ jsx(Fragment, { children: (x = (y = e.builderBlock) == null ? void 0 : y.children) == null ? void 0 : x.map((m, d) => /* @__PURE__ */ jsx(
|
|
2283
2286
|
Block,
|
|
2284
2287
|
{
|
|
2285
|
-
block:
|
|
2288
|
+
block: m,
|
|
2286
2289
|
context: e.builderContext,
|
|
2287
2290
|
registeredComponents: e.builderComponents,
|
|
2288
2291
|
linkComponent: e.builderLinkComponent
|
|
2289
2292
|
},
|
|
2290
|
-
`form-block-${
|
|
2293
|
+
`form-block-${d}`
|
|
2291
2294
|
)) }) : null,
|
|
2292
2295
|
" ",
|
|
2293
2296
|
c() === "error" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -2907,38 +2910,38 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2907
2910
|
};
|
|
2908
2911
|
};
|
|
2909
2912
|
function EnableEditor(e) {
|
|
2910
|
-
var
|
|
2913
|
+
var F, g, I, A, j, V, $;
|
|
2911
2914
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2912
2915
|
useState(() => !0);
|
|
2913
|
-
function o(
|
|
2914
|
-
var p,
|
|
2915
|
-
const
|
|
2916
|
+
function o(h) {
|
|
2917
|
+
var p, k;
|
|
2918
|
+
const b = {
|
|
2916
2919
|
...e.builderContextSignal.rootState,
|
|
2917
|
-
...
|
|
2920
|
+
...h
|
|
2918
2921
|
};
|
|
2919
|
-
e.builderContextSignal.rootSetState ? (
|
|
2922
|
+
e.builderContextSignal.rootSetState ? (k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, b) : e.setBuilderContextSignal((T) => ({
|
|
2920
2923
|
...T,
|
|
2921
|
-
rootState:
|
|
2924
|
+
rootState: b
|
|
2922
2925
|
}));
|
|
2923
2926
|
}
|
|
2924
|
-
function a(
|
|
2925
|
-
var p,
|
|
2926
|
-
const
|
|
2927
|
+
function a(h) {
|
|
2928
|
+
var p, k, T, P, N;
|
|
2929
|
+
const b = {
|
|
2927
2930
|
...e.builderContextSignal.content,
|
|
2928
|
-
...
|
|
2931
|
+
...h,
|
|
2929
2932
|
data: {
|
|
2930
2933
|
...(p = e.builderContextSignal.content) == null ? void 0 : p.data,
|
|
2931
|
-
...
|
|
2934
|
+
...h == null ? void 0 : h.data
|
|
2932
2935
|
},
|
|
2933
2936
|
meta: {
|
|
2934
|
-
...(
|
|
2935
|
-
...
|
|
2936
|
-
breakpoints: ((T =
|
|
2937
|
+
...(k = e.builderContextSignal.content) == null ? void 0 : k.meta,
|
|
2938
|
+
...h == null ? void 0 : h.meta,
|
|
2939
|
+
breakpoints: ((T = h == null ? void 0 : h.meta) == null ? void 0 : T.breakpoints) || ((N = (P = e.builderContextSignal.content) == null ? void 0 : P.meta) == null ? void 0 : N.breakpoints)
|
|
2937
2940
|
}
|
|
2938
2941
|
};
|
|
2939
2942
|
e.setBuilderContextSignal((W) => ({
|
|
2940
2943
|
...W,
|
|
2941
|
-
content:
|
|
2944
|
+
content: b
|
|
2942
2945
|
}));
|
|
2943
2946
|
}
|
|
2944
2947
|
useState(() => 0);
|
|
@@ -2947,61 +2950,61 @@ function EnableEditor(e) {
|
|
|
2947
2950
|
), [l, c] = useState(
|
|
2948
2951
|
() => e.contentWrapper || "div"
|
|
2949
2952
|
);
|
|
2950
|
-
function
|
|
2953
|
+
function u(h) {
|
|
2951
2954
|
return createEditorListener({
|
|
2952
2955
|
model: e.model,
|
|
2953
2956
|
trustedHosts: e.trustedHosts,
|
|
2954
2957
|
callbacks: {
|
|
2955
|
-
configureSdk: (
|
|
2958
|
+
configureSdk: (b) => {
|
|
2956
2959
|
var T;
|
|
2957
|
-
const { breakpoints: p, contentId:
|
|
2958
|
-
!
|
|
2960
|
+
const { breakpoints: p, contentId: k } = b;
|
|
2961
|
+
!k || k !== ((T = e.builderContextSignal.content) == null ? void 0 : T.id) || p && (a({
|
|
2959
2962
|
meta: {
|
|
2960
2963
|
breakpoints: p
|
|
2961
2964
|
}
|
|
2962
2965
|
}), i(n + 1));
|
|
2963
2966
|
},
|
|
2964
|
-
animation: (
|
|
2965
|
-
triggerAnimation(
|
|
2967
|
+
animation: (b) => {
|
|
2968
|
+
triggerAnimation(b);
|
|
2966
2969
|
},
|
|
2967
|
-
contentUpdate: (
|
|
2968
|
-
a(
|
|
2970
|
+
contentUpdate: (b) => {
|
|
2971
|
+
a(b), i(n + 1);
|
|
2969
2972
|
}
|
|
2970
2973
|
}
|
|
2971
|
-
})(
|
|
2974
|
+
})(h);
|
|
2972
2975
|
}
|
|
2973
2976
|
function y() {
|
|
2974
|
-
var
|
|
2975
|
-
const
|
|
2976
|
-
|
|
2977
|
-
code:
|
|
2977
|
+
var b, p;
|
|
2978
|
+
const h = (p = (b = e.builderContextSignal.content) == null ? void 0 : b.data) == null ? void 0 : p.jsCode;
|
|
2979
|
+
h && evaluate({
|
|
2980
|
+
code: h,
|
|
2978
2981
|
context: e.context || {},
|
|
2979
2982
|
localState: void 0,
|
|
2980
2983
|
rootState: e.builderContextSignal.rootState,
|
|
2981
2984
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2982
2985
|
});
|
|
2983
2986
|
}
|
|
2984
|
-
const [x,
|
|
2985
|
-
function
|
|
2986
|
-
var
|
|
2987
|
+
const [x, m] = useState(() => ({})), [d, f] = useState(() => !1);
|
|
2988
|
+
function v(h) {
|
|
2989
|
+
var b, p;
|
|
2987
2990
|
if (e.builderContextSignal.content) {
|
|
2988
|
-
const
|
|
2991
|
+
const k = (b = e.builderContextSignal.content) == null ? void 0 : b.testVariationId, T = (p = e.builderContextSignal.content) == null ? void 0 : p.id;
|
|
2989
2992
|
_track({
|
|
2990
2993
|
type: "click",
|
|
2991
2994
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2992
2995
|
contentId: T,
|
|
2993
2996
|
apiKey: e.apiKey,
|
|
2994
|
-
variationId:
|
|
2995
|
-
...getInteractionPropertiesForEvent(
|
|
2996
|
-
unique: !
|
|
2997
|
+
variationId: k !== T ? k : void 0,
|
|
2998
|
+
...getInteractionPropertiesForEvent(h),
|
|
2999
|
+
unique: !d
|
|
2997
3000
|
});
|
|
2998
3001
|
}
|
|
2999
|
-
|
|
3002
|
+
d || f(!0);
|
|
3000
3003
|
}
|
|
3001
|
-
function R(
|
|
3002
|
-
return
|
|
3004
|
+
function R(h) {
|
|
3005
|
+
return h.replace(
|
|
3003
3006
|
/{{([^}]+)}}/g,
|
|
3004
|
-
(
|
|
3007
|
+
(b, p) => evaluate({
|
|
3005
3008
|
code: p,
|
|
3006
3009
|
context: e.context || {},
|
|
3007
3010
|
localState: void 0,
|
|
@@ -3010,22 +3013,22 @@ function EnableEditor(e) {
|
|
|
3010
3013
|
})
|
|
3011
3014
|
);
|
|
3012
3015
|
}
|
|
3013
|
-
function S({ url:
|
|
3014
|
-
fetch$1(
|
|
3016
|
+
function S({ url: h, key: b }) {
|
|
3017
|
+
fetch$1(h).then((p) => p.json()).then((p) => {
|
|
3015
3018
|
var T, P;
|
|
3016
|
-
const
|
|
3019
|
+
const k = {
|
|
3017
3020
|
...e.builderContextSignal.rootState,
|
|
3018
|
-
[
|
|
3021
|
+
[b]: p
|
|
3019
3022
|
};
|
|
3020
|
-
(P = (T = e.builderContextSignal).rootSetState) == null || P.call(T,
|
|
3023
|
+
(P = (T = e.builderContextSignal).rootSetState) == null || P.call(T, k), x[b] = !0;
|
|
3021
3024
|
}).catch((p) => {
|
|
3022
|
-
console.error("error fetching dynamic data",
|
|
3025
|
+
console.error("error fetching dynamic data", h, p);
|
|
3023
3026
|
});
|
|
3024
3027
|
}
|
|
3025
|
-
function
|
|
3026
|
-
var
|
|
3027
|
-
const
|
|
3028
|
-
Object.entries(
|
|
3028
|
+
function C() {
|
|
3029
|
+
var b, p, k;
|
|
3030
|
+
const h = (k = (p = (b = e.builderContextSignal.content) == null ? void 0 : b.data) == null ? void 0 : p.httpRequests) != null ? k : {};
|
|
3031
|
+
Object.entries(h).forEach(([T, P]) => {
|
|
3029
3032
|
if (P && (!x[T] || isEditing())) {
|
|
3030
3033
|
const N = R(P);
|
|
3031
3034
|
S({
|
|
@@ -3050,14 +3053,11 @@ function EnableEditor(e) {
|
|
|
3050
3053
|
)
|
|
3051
3054
|
);
|
|
3052
3055
|
}
|
|
3053
|
-
function E(
|
|
3054
|
-
i(n + 1), window.addEventListener("message",
|
|
3056
|
+
function E(h) {
|
|
3057
|
+
i(n + 1), window.addEventListener("message", u), registerInsertMenu(), setupBrowserForEditing({
|
|
3055
3058
|
...e.locale ? {
|
|
3056
3059
|
locale: e.locale
|
|
3057
3060
|
} : {},
|
|
3058
|
-
...e.includeRefs ? {
|
|
3059
|
-
includeRefs: e.includeRefs
|
|
3060
|
-
} : {},
|
|
3061
3061
|
...e.enrich ? {
|
|
3062
3062
|
enrich: e.enrich
|
|
3063
3063
|
} : {},
|
|
@@ -3066,20 +3066,20 @@ function EnableEditor(e) {
|
|
|
3066
3066
|
} : {}
|
|
3067
3067
|
}), Object.values(
|
|
3068
3068
|
e.builderContextSignal.componentInfos
|
|
3069
|
-
).forEach((
|
|
3070
|
-
var
|
|
3071
|
-
const p = createRegisterComponentMessage(
|
|
3072
|
-
(
|
|
3069
|
+
).forEach((b) => {
|
|
3070
|
+
var k;
|
|
3071
|
+
const p = createRegisterComponentMessage(b);
|
|
3072
|
+
(k = window.parent) == null || k.postMessage(p, "*");
|
|
3073
3073
|
}), window.addEventListener(
|
|
3074
3074
|
"builder:component:stateChangeListenerActivated",
|
|
3075
3075
|
w
|
|
3076
3076
|
);
|
|
3077
3077
|
}
|
|
3078
|
-
function B(
|
|
3079
|
-
const
|
|
3078
|
+
function B(h) {
|
|
3079
|
+
const b = new URL(location.href).searchParams, p = b.get("builder.preview"), k = b.get(
|
|
3080
3080
|
`builder.preview.${p}`
|
|
3081
|
-
), T =
|
|
3082
|
-
p === e.model && T === e.apiKey && (!e.content ||
|
|
3081
|
+
), T = b.get("apiKey") || b.get("builder.space");
|
|
3082
|
+
p === e.model && T === e.apiKey && (!e.content || k === e.content.id) && fetchOneEntry({
|
|
3083
3083
|
model: e.model,
|
|
3084
3084
|
apiKey: e.apiKey,
|
|
3085
3085
|
apiVersion: e.builderContextSignal.apiVersion
|
|
@@ -3088,40 +3088,40 @@ function EnableEditor(e) {
|
|
|
3088
3088
|
});
|
|
3089
3089
|
}
|
|
3090
3090
|
return useEffect(() => {
|
|
3091
|
-
var
|
|
3092
|
-
return (
|
|
3091
|
+
var h;
|
|
3092
|
+
return (h = t.current) == null || h.addEventListener(
|
|
3093
3093
|
"initeditingbldr",
|
|
3094
3094
|
E
|
|
3095
3095
|
), () => {
|
|
3096
|
-
var
|
|
3097
|
-
return (
|
|
3096
|
+
var b;
|
|
3097
|
+
return (b = t.current) == null ? void 0 : b.removeEventListener(
|
|
3098
3098
|
"initeditingbldr",
|
|
3099
3099
|
E
|
|
3100
3100
|
);
|
|
3101
3101
|
};
|
|
3102
3102
|
}, []), useEffect(() => {
|
|
3103
|
-
var
|
|
3104
|
-
return (
|
|
3103
|
+
var h;
|
|
3104
|
+
return (h = t.current) == null || h.addEventListener(
|
|
3105
3105
|
"initpreviewingbldr",
|
|
3106
3106
|
B
|
|
3107
3107
|
), () => {
|
|
3108
|
-
var
|
|
3109
|
-
return (
|
|
3108
|
+
var b;
|
|
3109
|
+
return (b = t.current) == null ? void 0 : b.removeEventListener(
|
|
3110
3110
|
"initpreviewingbldr",
|
|
3111
3111
|
B
|
|
3112
3112
|
);
|
|
3113
3113
|
};
|
|
3114
3114
|
}, []), useEffect(() => {
|
|
3115
|
-
var
|
|
3115
|
+
var h, b;
|
|
3116
3116
|
if (isBrowser()) {
|
|
3117
3117
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
3118
|
-
const
|
|
3118
|
+
const k = (h = e.builderContextSignal.content) == null ? void 0 : h.testVariationId, T = (b = e.builderContextSignal.content) == null ? void 0 : b.id, P = e.apiKey;
|
|
3119
3119
|
_track({
|
|
3120
3120
|
type: "impression",
|
|
3121
3121
|
canTrack: !0,
|
|
3122
3122
|
contentId: T,
|
|
3123
3123
|
apiKey: P,
|
|
3124
|
-
variationId:
|
|
3124
|
+
variationId: k !== T ? k : void 0
|
|
3125
3125
|
});
|
|
3126
3126
|
}
|
|
3127
3127
|
isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
@@ -3129,15 +3129,15 @@ function EnableEditor(e) {
|
|
|
3129
3129
|
}, []), useEffect(() => {
|
|
3130
3130
|
e.apiKey || logger.error(
|
|
3131
3131
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
3132
|
-
), y(),
|
|
3132
|
+
), y(), C(), w();
|
|
3133
3133
|
}, []), useEffect(() => {
|
|
3134
3134
|
e.content && a(e.content);
|
|
3135
3135
|
}, [e.content]), useEffect(() => {
|
|
3136
3136
|
}, [r]), useEffect(() => {
|
|
3137
3137
|
y();
|
|
3138
|
-
}, [(
|
|
3139
|
-
|
|
3140
|
-
}, [(
|
|
3138
|
+
}, [(g = (F = e.builderContextSignal.content) == null ? void 0 : F.data) == null ? void 0 : g.jsCode]), useEffect(() => {
|
|
3139
|
+
C();
|
|
3140
|
+
}, [(A = (I = e.builderContextSignal.content) == null ? void 0 : I.data) == null ? void 0 : A.httpRequests]), useEffect(() => {
|
|
3141
3141
|
w();
|
|
3142
3142
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
3143
3143
|
e.data && o(e.data);
|
|
@@ -3146,7 +3146,7 @@ function EnableEditor(e) {
|
|
|
3146
3146
|
locale: e.locale
|
|
3147
3147
|
});
|
|
3148
3148
|
}, [e.locale]), useEffect(() => () => {
|
|
3149
|
-
isBrowser() && (window.removeEventListener("message",
|
|
3149
|
+
isBrowser() && (window.removeEventListener("message", u), window.removeEventListener(
|
|
3150
3150
|
"builder:component:stateChangeListenerActivated",
|
|
3151
3151
|
w
|
|
3152
3152
|
));
|
|
@@ -3155,7 +3155,7 @@ function EnableEditor(e) {
|
|
|
3155
3155
|
{
|
|
3156
3156
|
key: n,
|
|
3157
3157
|
ref: t,
|
|
3158
|
-
onClick: (
|
|
3158
|
+
onClick: (h) => v(h),
|
|
3159
3159
|
"builder-content-id": (j = e.builderContextSignal.content) == null ? void 0 : j.id,
|
|
3160
3160
|
"builder-model": e.model,
|
|
3161
3161
|
...e.showContent ? {} : {
|
|
@@ -3263,39 +3263,33 @@ const getRootStateInitialValue = ({
|
|
|
3263
3263
|
meta: e == null ? void 0 : e.meta
|
|
3264
3264
|
} : void 0;
|
|
3265
3265
|
function ContentComponent(e) {
|
|
3266
|
-
var l, c,
|
|
3266
|
+
var l, c, u, y, x, m, d;
|
|
3267
3267
|
const [t, n] = useState(
|
|
3268
3268
|
() => {
|
|
3269
|
-
var
|
|
3269
|
+
var f, v;
|
|
3270
3270
|
return getUpdateVariantVisibilityScript({
|
|
3271
3271
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3272
|
-
variationId: (
|
|
3272
|
+
variationId: (f = e.content) == null ? void 0 : f.testVariationId,
|
|
3273
3273
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3274
|
-
contentId: (
|
|
3274
|
+
contentId: (v = e.content) == null ? void 0 : v.id
|
|
3275
3275
|
});
|
|
3276
3276
|
}
|
|
3277
3277
|
);
|
|
3278
|
-
function i(
|
|
3279
|
-
s((
|
|
3280
|
-
...
|
|
3281
|
-
rootState:
|
|
3278
|
+
function i(f) {
|
|
3279
|
+
s((v) => ({
|
|
3280
|
+
...v,
|
|
3281
|
+
rootState: f
|
|
3282
3282
|
}));
|
|
3283
3283
|
}
|
|
3284
3284
|
const [o, a] = useState(
|
|
3285
3285
|
() => [
|
|
3286
3286
|
...getDefaultRegisteredComponents(),
|
|
3287
|
-
// While this `components` object is deprecated, we must maintain support for it.
|
|
3288
|
-
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
3289
|
-
// existing usage.
|
|
3290
|
-
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
3291
|
-
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
3292
|
-
...components,
|
|
3293
3287
|
...e.customComponents || []
|
|
3294
3288
|
].reduce(
|
|
3295
|
-
(
|
|
3296
|
-
...
|
|
3289
|
+
(f, { component: v, ...R }) => ({
|
|
3290
|
+
...f,
|
|
3297
3291
|
[R.name]: {
|
|
3298
|
-
component:
|
|
3292
|
+
component: v,
|
|
3299
3293
|
...serializeComponentInfo(R)
|
|
3300
3294
|
}
|
|
3301
3295
|
}),
|
|
@@ -3318,16 +3312,10 @@ function ContentComponent(e) {
|
|
|
3318
3312
|
apiVersion: e.apiVersion,
|
|
3319
3313
|
componentInfos: [
|
|
3320
3314
|
...getDefaultRegisteredComponents(),
|
|
3321
|
-
// While this `components` object is deprecated, we must maintain support for it.
|
|
3322
|
-
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
3323
|
-
// existing usage.
|
|
3324
|
-
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
3325
|
-
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
3326
|
-
...components,
|
|
3327
3315
|
...e.customComponents || []
|
|
3328
3316
|
].reduce(
|
|
3329
|
-
(
|
|
3330
|
-
...
|
|
3317
|
+
(f, { component: v, ...R }) => ({
|
|
3318
|
+
...f,
|
|
3331
3319
|
[R.name]: serializeComponentInfo(R)
|
|
3332
3320
|
}),
|
|
3333
3321
|
{}
|
|
@@ -3352,7 +3340,6 @@ function ContentComponent(e) {
|
|
|
3352
3340
|
apiKey: e.apiKey,
|
|
3353
3341
|
canTrack: e.canTrack,
|
|
3354
3342
|
locale: e.locale,
|
|
3355
|
-
includeRefs: e.includeRefs,
|
|
3356
3343
|
enrich: e.enrich,
|
|
3357
3344
|
showContent: e.showContent,
|
|
3358
3345
|
builderContextSignal: r,
|
|
@@ -3367,14 +3354,14 @@ function ContentComponent(e) {
|
|
|
3367
3354
|
ContentStyles,
|
|
3368
3355
|
{
|
|
3369
3356
|
contentId: (l = r.content) == null ? void 0 : l.id,
|
|
3370
|
-
cssCode: (
|
|
3357
|
+
cssCode: (u = (c = r.content) == null ? void 0 : c.data) == null ? void 0 : u.cssCode,
|
|
3371
3358
|
customFonts: (x = (y = r.content) == null ? void 0 : y.data) == null ? void 0 : x.customFonts
|
|
3372
3359
|
}
|
|
3373
3360
|
) }),
|
|
3374
3361
|
/* @__PURE__ */ jsx(
|
|
3375
3362
|
Blocks,
|
|
3376
3363
|
{
|
|
3377
|
-
blocks: (
|
|
3364
|
+
blocks: (d = (m = r.content) == null ? void 0 : m.data) == null ? void 0 : d.blocks,
|
|
3378
3365
|
context: r,
|
|
3379
3366
|
registeredComponents: o,
|
|
3380
3367
|
linkComponent: e.linkComponent
|
|
@@ -3443,7 +3430,6 @@ function ContentVariants(e) {
|
|
|
3443
3430
|
linkComponent: e.linkComponent,
|
|
3444
3431
|
canTrack: e.canTrack,
|
|
3445
3432
|
locale: e.locale,
|
|
3446
|
-
includeRefs: e.includeRefs,
|
|
3447
3433
|
enrich: e.enrich,
|
|
3448
3434
|
isSsrAbTest: t,
|
|
3449
3435
|
blocksWrapper: e.blocksWrapper,
|
|
@@ -3469,7 +3455,6 @@ function ContentVariants(e) {
|
|
|
3469
3455
|
linkComponent: e.linkComponent,
|
|
3470
3456
|
canTrack: e.canTrack,
|
|
3471
3457
|
locale: e.locale,
|
|
3472
|
-
includeRefs: e.includeRefs,
|
|
3473
3458
|
enrich: e.enrich,
|
|
3474
3459
|
isSsrAbTest: t,
|
|
3475
3460
|
blocksWrapper: e.blocksWrapper,
|
|
@@ -3503,12 +3488,12 @@ const fetchSymbolContent = async ({
|
|
|
3503
3488
|
function Symbol$1(e) {
|
|
3504
3489
|
var a, r, s, l;
|
|
3505
3490
|
function t() {
|
|
3506
|
-
var c,
|
|
3491
|
+
var c, u;
|
|
3507
3492
|
return [
|
|
3508
3493
|
e.attributes[getClassPropName()],
|
|
3509
3494
|
"builder-symbol",
|
|
3510
3495
|
(c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
|
|
3511
|
-
(
|
|
3496
|
+
(u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
3512
3497
|
].filter(Boolean).join(" ");
|
|
3513
3498
|
}
|
|
3514
3499
|
const [n, i] = useState(() => {
|
|
@@ -3548,7 +3533,6 @@ function Symbol$1(e) {
|
|
|
3548
3533
|
}
|
|
3549
3534
|
) });
|
|
3550
3535
|
}
|
|
3551
|
-
const RenderBlocks = Blocks, RenderContent = ContentVariants;
|
|
3552
3536
|
export {
|
|
3553
3537
|
Blocks,
|
|
3554
3538
|
Button,
|
|
@@ -3556,8 +3540,6 @@ export {
|
|
|
3556
3540
|
ContentVariants as Content,
|
|
3557
3541
|
FragmentComponent as Fragment,
|
|
3558
3542
|
Image,
|
|
3559
|
-
RenderBlocks,
|
|
3560
|
-
RenderContent,
|
|
3561
3543
|
SectionComponent as Section,
|
|
3562
3544
|
Symbol$1 as Symbol,
|
|
3563
3545
|
Text,
|
|
@@ -3567,13 +3549,11 @@ export {
|
|
|
3567
3549
|
K as fetchBuilderProps,
|
|
3568
3550
|
q as fetchEntries,
|
|
3569
3551
|
fetchOneEntry,
|
|
3570
|
-
z as
|
|
3571
|
-
J as getBuilderSearchParams,
|
|
3572
|
-
Y as getContent,
|
|
3552
|
+
z as getBuilderSearchParams,
|
|
3573
3553
|
isEditing,
|
|
3574
3554
|
isPreviewing,
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3555
|
+
J as register,
|
|
3556
|
+
Y as setEditorSettings,
|
|
3557
|
+
G as subscribeToEditor,
|
|
3558
|
+
Q as track
|
|
3579
3559
|
};
|