@builder.io/sdk-react 0.12.6 → 0.12.7
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 +27 -27
- package/lib/browser/index.mjs +760 -626
- package/lib/edge/index.cjs +43 -43
- package/lib/edge/index.mjs +2017 -1883
- package/lib/node/index.cjs +7 -7
- package/lib/node/index.mjs +383 -249
- package/package.json +1 -1
- package/types/components/block/animator.d.ts +5 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/types/builder-block.d.ts +18 -1
package/lib/node/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useState, useContext, useRef,
|
|
3
|
+
import { createContext, useState, useEffect, useContext, useRef, createElement } from "react";
|
|
4
4
|
import { T as TARGET, i as isEditing, j as isBrowser, k as getUserAttributes, l as fastClone, m as checkIsDefined, n as logger, 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-0457c4c8.js";
|
|
5
5
|
import { _ as H, h as K, f as z, g as q, e as Y, d as G, s as J, t as Q } from "./server-entry-0457c4c8.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -105,7 +105,7 @@ const getFunctionArguments = ({
|
|
|
105
105
|
rootSetState: a
|
|
106
106
|
})
|
|
107
107
|
});
|
|
108
|
-
return new Function(...s.map(([
|
|
108
|
+
return new Function(...s.map(([l]) => l), e)(...s.map(([, l]) => l));
|
|
109
109
|
};
|
|
110
110
|
function flattenState({
|
|
111
111
|
rootState: e,
|
|
@@ -208,34 +208,34 @@ output;
|
|
|
208
208
|
const s = fastClone({
|
|
209
209
|
...r,
|
|
210
210
|
...o
|
|
211
|
-
}),
|
|
211
|
+
}), l = getFunctionArguments({
|
|
212
212
|
builder: t,
|
|
213
213
|
context: n,
|
|
214
214
|
event: i,
|
|
215
215
|
state: s
|
|
216
|
-
}),
|
|
217
|
-
d.setSync("global", d.derefInto()), d.setSync("log", function(...
|
|
218
|
-
console.log(...
|
|
219
|
-
}), d.setSync(BUILDER_SET_STATE_NAME, function(
|
|
220
|
-
set(r,
|
|
221
|
-
}),
|
|
222
|
-
const
|
|
216
|
+
}), c = getIsolateContext(), d = c.global;
|
|
217
|
+
d.setSync("global", d.derefInto()), d.setSync("log", function(...u) {
|
|
218
|
+
console.log(...u);
|
|
219
|
+
}), d.setSync(BUILDER_SET_STATE_NAME, function(u, g) {
|
|
220
|
+
set(r, u, g), a == null || a(r);
|
|
221
|
+
}), l.forEach(([u, g]) => {
|
|
222
|
+
const x = typeof g == "object" ? new ivm.Reference(
|
|
223
223
|
// workaround: methods with default values for arguments is not being cloned over
|
|
224
|
-
|
|
225
|
-
...
|
|
226
|
-
getUserAttributes: () =>
|
|
227
|
-
} :
|
|
224
|
+
u === "builder" ? {
|
|
225
|
+
...g,
|
|
226
|
+
getUserAttributes: () => g.getUserAttributes()
|
|
227
|
+
} : g
|
|
228
228
|
) : null;
|
|
229
|
-
d.setSync(getSyncValName(
|
|
229
|
+
d.setSync(getSyncValName(u), x);
|
|
230
230
|
}), d.setSync(INJECTED_IVM_GLOBAL, ivm);
|
|
231
|
-
const
|
|
231
|
+
const h = processCode({
|
|
232
232
|
code: e,
|
|
233
|
-
args:
|
|
234
|
-
}),
|
|
233
|
+
args: l
|
|
234
|
+
}), y = c.evalSync(h);
|
|
235
235
|
try {
|
|
236
|
-
return JSON.parse(
|
|
236
|
+
return JSON.parse(y);
|
|
237
237
|
} catch {
|
|
238
|
-
return
|
|
238
|
+
return y;
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
function isNodeRuntime() {
|
|
@@ -275,8 +275,8 @@ function evaluate({
|
|
|
275
275
|
};
|
|
276
276
|
try {
|
|
277
277
|
return chooseBrowserOrServerEval(s);
|
|
278
|
-
} catch (
|
|
279
|
-
logger.error("Failed code evaluation: " +
|
|
278
|
+
} catch (l) {
|
|
279
|
+
logger.error("Failed code evaluation: " + l.message, {
|
|
280
280
|
code: e
|
|
281
281
|
});
|
|
282
282
|
return;
|
|
@@ -304,14 +304,14 @@ const evaluateBindings = ({
|
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
306
|
for (const s in e.bindings) {
|
|
307
|
-
const
|
|
308
|
-
code:
|
|
307
|
+
const l = e.bindings[s], c = evaluate({
|
|
308
|
+
code: l,
|
|
309
309
|
localState: n,
|
|
310
310
|
rootState: i,
|
|
311
311
|
rootSetState: o,
|
|
312
312
|
context: t
|
|
313
313
|
});
|
|
314
|
-
set(r, s,
|
|
314
|
+
set(r, s, c);
|
|
315
315
|
}
|
|
316
316
|
return r;
|
|
317
317
|
};
|
|
@@ -332,6 +332,128 @@ function getProcessedBlock({
|
|
|
332
332
|
context: t
|
|
333
333
|
}) : r;
|
|
334
334
|
}
|
|
335
|
+
function throttle(e, t, n = {}) {
|
|
336
|
+
let i, o, a, r = null, s = 0;
|
|
337
|
+
const l = function() {
|
|
338
|
+
s = n.leading === !1 ? 0 : Date.now(), r = null, a = e.apply(i, o), r || (i = o = null);
|
|
339
|
+
};
|
|
340
|
+
return function() {
|
|
341
|
+
const c = Date.now();
|
|
342
|
+
!s && n.leading === !1 && (s = c);
|
|
343
|
+
const d = t - (c - s);
|
|
344
|
+
return i = this, o = arguments, d <= 0 || d > t ? (r && (clearTimeout(r), r = null), s = c, a = e.apply(i, o), r || (i = o = null)) : !r && n.trailing !== !1 && (r = setTimeout(l, d)), a;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function assign(e, ...t) {
|
|
348
|
+
const n = Object(e);
|
|
349
|
+
for (let i = 1; i < arguments.length; i++) {
|
|
350
|
+
const o = arguments[i];
|
|
351
|
+
if (o != null)
|
|
352
|
+
for (const a in o)
|
|
353
|
+
Object.prototype.hasOwnProperty.call(o, a) && (n[a] = o[a]);
|
|
354
|
+
}
|
|
355
|
+
return n;
|
|
356
|
+
}
|
|
357
|
+
const camelCaseToKebabCase = (e) => e ? e.replace(/([A-Z])/g, (t) => `-${t[0].toLowerCase()}`) : "";
|
|
358
|
+
function bindAnimations(e) {
|
|
359
|
+
for (const t of e)
|
|
360
|
+
switch (t.trigger) {
|
|
361
|
+
case "pageLoad":
|
|
362
|
+
triggerAnimation(t);
|
|
363
|
+
break;
|
|
364
|
+
case "hover":
|
|
365
|
+
bindHoverAnimation(t);
|
|
366
|
+
break;
|
|
367
|
+
case "scrollInView":
|
|
368
|
+
bindScrollInViewAnimation(t);
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function warnElementNotPresent(e) {
|
|
373
|
+
console.warn(`Cannot animate element: element with ID ${e} not found!`);
|
|
374
|
+
}
|
|
375
|
+
function augmentAnimation(e, t) {
|
|
376
|
+
const n = getAllStylesUsed(e), i = getComputedStyle(t), o = e.steps[0].styles, a = e.steps[e.steps.length - 1].styles, r = [o, a];
|
|
377
|
+
for (const s of r)
|
|
378
|
+
for (const l of n)
|
|
379
|
+
l in s || (s[l] = i[l]);
|
|
380
|
+
}
|
|
381
|
+
function getAllStylesUsed(e) {
|
|
382
|
+
const t = [];
|
|
383
|
+
for (const n of e.steps)
|
|
384
|
+
for (const i in n.styles)
|
|
385
|
+
t.indexOf(i) === -1 && t.push(i);
|
|
386
|
+
return t;
|
|
387
|
+
}
|
|
388
|
+
function triggerAnimation(e) {
|
|
389
|
+
const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
|
|
390
|
+
if (!t.length) {
|
|
391
|
+
warnElementNotPresent(e.elementId || e.id || "");
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
Array.from(t).forEach((n) => {
|
|
395
|
+
augmentAnimation(e, n), n.style.transition = "none", n.style.transitionDelay = "0", assign(n.style, e.steps[0].styles), setTimeout(() => {
|
|
396
|
+
n.style.transition = `all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s"), assign(n.style, e.steps[1].styles), setTimeout(() => {
|
|
397
|
+
n.style.transition = "", n.style.transitionDelay = "";
|
|
398
|
+
}, (e.delay || 0) * 1e3 + e.duration * 1e3 + 100);
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function bindHoverAnimation(e) {
|
|
403
|
+
const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
|
|
404
|
+
if (!t.length) {
|
|
405
|
+
warnElementNotPresent(e.elementId || e.id || "");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
Array.from(t).forEach((n) => {
|
|
409
|
+
augmentAnimation(e, n);
|
|
410
|
+
const i = e.steps[0].styles, o = e.steps[1].styles;
|
|
411
|
+
function a() {
|
|
412
|
+
assign(n.style, i);
|
|
413
|
+
}
|
|
414
|
+
function r() {
|
|
415
|
+
assign(n.style, o);
|
|
416
|
+
}
|
|
417
|
+
a(), n.addEventListener("mouseenter", r), n.addEventListener("mouseleave", a), setTimeout(() => {
|
|
418
|
+
n.style.transition = `all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s");
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function bindScrollInViewAnimation(e) {
|
|
423
|
+
const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
|
|
424
|
+
if (!t.length) {
|
|
425
|
+
warnElementNotPresent(e.elementId || e.id || "");
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
Array.from(t).forEach((n) => {
|
|
429
|
+
augmentAnimation(e, n);
|
|
430
|
+
let i = !1, o = !1;
|
|
431
|
+
function a() {
|
|
432
|
+
!i && s(n) ? (i = !0, o = !0, setTimeout(() => {
|
|
433
|
+
assign(n.style, e.steps[1].styles), e.repeat || document.removeEventListener("scroll", r), setTimeout(() => {
|
|
434
|
+
o = !1, e.repeat || (n.style.transition = "", n.style.transitionDelay = "");
|
|
435
|
+
}, (e.duration + (e.delay || 0)) * 1e3 + 100);
|
|
436
|
+
})) : e.repeat && i && !o && !s(n) && (i = !1, assign(n.style, e.steps[0].styles));
|
|
437
|
+
}
|
|
438
|
+
const r = throttle(a, 200, {
|
|
439
|
+
leading: !1
|
|
440
|
+
});
|
|
441
|
+
function s(d) {
|
|
442
|
+
const h = d.getBoundingClientRect(), y = window.innerHeight, g = (e.thresholdPercent || 0) / 100 * y;
|
|
443
|
+
return h.bottom > g && h.top < y - g;
|
|
444
|
+
}
|
|
445
|
+
const l = e.steps[0].styles;
|
|
446
|
+
function c() {
|
|
447
|
+
assign(n.style, l);
|
|
448
|
+
}
|
|
449
|
+
c(), setTimeout(() => {
|
|
450
|
+
n.style.transition = `all ${e.duration}s ${camelCaseToKebabCase(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s");
|
|
451
|
+
}), document.addEventListener("scroll", r, {
|
|
452
|
+
capture: !0,
|
|
453
|
+
passive: !0
|
|
454
|
+
}), a();
|
|
455
|
+
});
|
|
456
|
+
}
|
|
335
457
|
const getComponent = ({
|
|
336
458
|
block: e,
|
|
337
459
|
context: t,
|
|
@@ -374,15 +496,15 @@ const getComponent = ({
|
|
|
374
496
|
if (!Array.isArray(o))
|
|
375
497
|
return;
|
|
376
498
|
const a = n.collection.split(".").pop(), r = n.itemName || (a ? a + "Item" : "item");
|
|
377
|
-
return o.map((
|
|
499
|
+
return o.map((l, c) => ({
|
|
378
500
|
context: {
|
|
379
501
|
...t,
|
|
380
502
|
localState: {
|
|
381
503
|
...t.localState,
|
|
382
|
-
$index:
|
|
383
|
-
$item:
|
|
384
|
-
[r]:
|
|
385
|
-
[`$${r}Index`]:
|
|
504
|
+
$index: c,
|
|
505
|
+
$item: l,
|
|
506
|
+
[r]: l,
|
|
507
|
+
[`$${r}Index`]: c
|
|
386
508
|
}
|
|
387
509
|
},
|
|
388
510
|
block: i
|
|
@@ -461,7 +583,7 @@ function BlockStyles(e) {
|
|
|
461
583
|
return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
|
|
462
584
|
}
|
|
463
585
|
function n() {
|
|
464
|
-
var
|
|
586
|
+
var g;
|
|
465
587
|
const i = getProcessedBlock({
|
|
466
588
|
block: e.block,
|
|
467
589
|
localState: e.context.localState,
|
|
@@ -470,29 +592,29 @@ function BlockStyles(e) {
|
|
|
470
592
|
context: e.context.context,
|
|
471
593
|
shouldEvaluateBindings: !0
|
|
472
594
|
}), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
473
|
-
((
|
|
474
|
-
), s = o == null ? void 0 : o.large,
|
|
595
|
+
((g = a == null ? void 0 : a.meta) == null ? void 0 : g.breakpoints) || {}
|
|
596
|
+
), s = o == null ? void 0 : o.large, l = o == null ? void 0 : o.medium, c = o == null ? void 0 : o.small, d = i.id;
|
|
475
597
|
if (!d)
|
|
476
598
|
return "";
|
|
477
|
-
const
|
|
599
|
+
const h = s ? createCssClass({
|
|
478
600
|
className: d,
|
|
479
601
|
styles: s
|
|
480
|
-
}) : "",
|
|
602
|
+
}) : "", y = l ? createCssClass({
|
|
481
603
|
className: d,
|
|
482
|
-
styles:
|
|
604
|
+
styles: l,
|
|
483
605
|
mediaQuery: getMaxWidthQueryForSize(
|
|
484
606
|
"medium",
|
|
485
607
|
r
|
|
486
608
|
)
|
|
487
|
-
}) : "",
|
|
609
|
+
}) : "", u = c ? createCssClass({
|
|
488
610
|
className: d,
|
|
489
|
-
styles:
|
|
611
|
+
styles: c,
|
|
490
612
|
mediaQuery: getMaxWidthQueryForSize(
|
|
491
613
|
"small",
|
|
492
614
|
r
|
|
493
615
|
)
|
|
494
616
|
}) : "";
|
|
495
|
-
return [
|
|
617
|
+
return [h, y, u].join(" ");
|
|
496
618
|
}
|
|
497
619
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
498
620
|
}
|
|
@@ -701,7 +823,7 @@ function RepeatedBlock(e) {
|
|
|
701
823
|
) });
|
|
702
824
|
}
|
|
703
825
|
function Block(e) {
|
|
704
|
-
var d,
|
|
826
|
+
var d, h, y;
|
|
705
827
|
function t() {
|
|
706
828
|
return getComponent({
|
|
707
829
|
block: e.block,
|
|
@@ -716,8 +838,8 @@ function Block(e) {
|
|
|
716
838
|
});
|
|
717
839
|
}
|
|
718
840
|
function i() {
|
|
719
|
-
var
|
|
720
|
-
return (
|
|
841
|
+
var u;
|
|
842
|
+
return (u = e.block.repeat) != null && u.collection ? e.block : getProcessedBlock({
|
|
721
843
|
block: e.block,
|
|
722
844
|
localState: e.context.localState,
|
|
723
845
|
rootState: e.context.rootState,
|
|
@@ -727,36 +849,36 @@ function Block(e) {
|
|
|
727
849
|
});
|
|
728
850
|
}
|
|
729
851
|
function o() {
|
|
730
|
-
var
|
|
731
|
-
return e.block.tagName === "a" || ((
|
|
852
|
+
var g;
|
|
853
|
+
return e.block.tagName === "a" || ((g = i().properties) == null ? void 0 : g.href) || i().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
732
854
|
}
|
|
733
855
|
function a() {
|
|
734
|
-
var
|
|
735
|
-
if ((
|
|
856
|
+
var x, I;
|
|
857
|
+
if ((x = e.block.repeat) != null && x.collection)
|
|
736
858
|
return !!((I = n == null ? void 0 : n()) != null && I.length);
|
|
737
|
-
const
|
|
738
|
-
return ("show" in i() ? i().show : !0) && !
|
|
859
|
+
const u = "hide" in i() ? i().hide : !1;
|
|
860
|
+
return ("show" in i() ? i().show : !0) && !u;
|
|
739
861
|
}
|
|
740
862
|
function r() {
|
|
741
|
-
var
|
|
742
|
-
return !((
|
|
863
|
+
var g, x;
|
|
864
|
+
return !((g = t == null ? void 0 : t()) != null && g.component) && !n() ? (x = i().children) != null ? x : [] : [];
|
|
743
865
|
}
|
|
744
866
|
function s() {
|
|
745
|
-
var
|
|
867
|
+
var u, g, x, I, E, v, C, T, w;
|
|
746
868
|
return {
|
|
747
|
-
blockChildren: (
|
|
748
|
-
componentRef: (
|
|
869
|
+
blockChildren: (u = i().children) != null ? u : [],
|
|
870
|
+
componentRef: (g = t == null ? void 0 : t()) == null ? void 0 : g.component,
|
|
749
871
|
componentOptions: {
|
|
750
872
|
...getBlockComponentOptions(i()),
|
|
751
873
|
builderContext: e.context,
|
|
752
|
-
...((
|
|
874
|
+
...((x = t == null ? void 0 : t()) == null ? void 0 : x.name) === "Core:Button" || ((I = t == null ? void 0 : t()) == null ? void 0 : I.name) === "Symbol" || ((E = t == null ? void 0 : t()) == null ? void 0 : E.name) === "Columns" ? {
|
|
753
875
|
builderLinkComponent: e.linkComponent
|
|
754
876
|
} : {},
|
|
755
877
|
...((v = t == null ? void 0 : t()) == null ? void 0 : v.name) === "Symbol" || ((C = t == null ? void 0 : t()) == null ? void 0 : C.name) === "Columns" ? {
|
|
756
878
|
builderComponents: e.registeredComponents
|
|
757
879
|
} : {}
|
|
758
880
|
},
|
|
759
|
-
context:
|
|
881
|
+
context: l,
|
|
760
882
|
linkComponent: e.linkComponent,
|
|
761
883
|
registeredComponents: e.registeredComponents,
|
|
762
884
|
builderBlock: i(),
|
|
@@ -764,8 +886,16 @@ function Block(e) {
|
|
|
764
886
|
isInteractive: !((w = t == null ? void 0 : t()) != null && w.isRSC)
|
|
765
887
|
};
|
|
766
888
|
}
|
|
767
|
-
const [
|
|
768
|
-
return
|
|
889
|
+
const [l, c] = useState(() => e.context);
|
|
890
|
+
return useEffect(() => {
|
|
891
|
+
const u = i().id, g = i().animations;
|
|
892
|
+
g && u && bindAnimations(
|
|
893
|
+
g.filter((x) => x.trigger !== "hover").map((x) => ({
|
|
894
|
+
...x,
|
|
895
|
+
elementId: u
|
|
896
|
+
}))
|
|
897
|
+
);
|
|
898
|
+
}, []), /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
769
899
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
770
900
|
(d = t == null ? void 0 : t()) != null && d.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
771
901
|
ComponentRef,
|
|
@@ -780,15 +910,15 @@ function Block(e) {
|
|
|
780
910
|
includeBlockProps: s().includeBlockProps,
|
|
781
911
|
isInteractive: s().isInteractive
|
|
782
912
|
}
|
|
783
|
-
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
913
|
+
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (y = n()) == null ? void 0 : y.map((u, g) => /* @__PURE__ */ jsx(
|
|
784
914
|
RepeatedBlock,
|
|
785
915
|
{
|
|
786
|
-
repeatContext:
|
|
787
|
-
block:
|
|
916
|
+
repeatContext: u.context,
|
|
917
|
+
block: u.block,
|
|
788
918
|
registeredComponents: e.registeredComponents,
|
|
789
919
|
linkComponent: e.linkComponent
|
|
790
920
|
},
|
|
791
|
-
|
|
921
|
+
g
|
|
792
922
|
)) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
793
923
|
BlockWrapper,
|
|
794
924
|
{
|
|
@@ -811,15 +941,15 @@ function Block(e) {
|
|
|
811
941
|
isInteractive: s().isInteractive
|
|
812
942
|
}
|
|
813
943
|
),
|
|
814
|
-
(
|
|
944
|
+
(h = r()) == null ? void 0 : h.map((u) => /* @__PURE__ */ jsx(
|
|
815
945
|
Block,
|
|
816
946
|
{
|
|
817
|
-
block:
|
|
818
|
-
context:
|
|
947
|
+
block: u,
|
|
948
|
+
context: l,
|
|
819
949
|
registeredComponents: e.registeredComponents,
|
|
820
950
|
linkComponent: e.linkComponent
|
|
821
951
|
},
|
|
822
|
-
|
|
952
|
+
u.id
|
|
823
953
|
))
|
|
824
954
|
]
|
|
825
955
|
}
|
|
@@ -915,11 +1045,11 @@ function Columns(e) {
|
|
|
915
1045
|
var C;
|
|
916
1046
|
return ((C = i[v]) == null ? void 0 : C.width) || 100 / i.length;
|
|
917
1047
|
}
|
|
918
|
-
function
|
|
1048
|
+
function l(v) {
|
|
919
1049
|
const C = t * (i.length - 1) / i.length;
|
|
920
1050
|
return `calc(${s(v)}% - ${C}px)`;
|
|
921
1051
|
}
|
|
922
|
-
function
|
|
1052
|
+
function c({
|
|
923
1053
|
stackedStyle: v,
|
|
924
1054
|
desktopStyle: C
|
|
925
1055
|
}) {
|
|
@@ -931,20 +1061,20 @@ function Columns(e) {
|
|
|
931
1061
|
}) {
|
|
932
1062
|
return a === "never" ? C : v;
|
|
933
1063
|
}
|
|
934
|
-
const [
|
|
1064
|
+
const [h, y] = useState(
|
|
935
1065
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
936
1066
|
);
|
|
937
|
-
function
|
|
1067
|
+
function u() {
|
|
938
1068
|
return {
|
|
939
|
-
"--flex-dir":
|
|
940
|
-
"--flex-dir-tablet":
|
|
941
|
-
stackedStyle:
|
|
1069
|
+
"--flex-dir": h,
|
|
1070
|
+
"--flex-dir-tablet": c({
|
|
1071
|
+
stackedStyle: h,
|
|
942
1072
|
desktopStyle: "row"
|
|
943
1073
|
})
|
|
944
1074
|
};
|
|
945
1075
|
}
|
|
946
|
-
function
|
|
947
|
-
const C = v === 0 ? 0 : t, T =
|
|
1076
|
+
function g(v) {
|
|
1077
|
+
const C = v === 0 ? 0 : t, T = l(v), w = `${C}px`, R = "100%", A = 0;
|
|
948
1078
|
return {
|
|
949
1079
|
...{
|
|
950
1080
|
display: "flex",
|
|
@@ -958,20 +1088,20 @@ function Columns(e) {
|
|
|
958
1088
|
desktopStyle: T
|
|
959
1089
|
}),
|
|
960
1090
|
"--column-margin-left-mobile": d({
|
|
961
|
-
stackedStyle:
|
|
1091
|
+
stackedStyle: A,
|
|
962
1092
|
desktopStyle: w
|
|
963
1093
|
}),
|
|
964
|
-
"--column-width-tablet":
|
|
1094
|
+
"--column-width-tablet": c({
|
|
965
1095
|
stackedStyle: R,
|
|
966
1096
|
desktopStyle: T
|
|
967
1097
|
}),
|
|
968
|
-
"--column-margin-left-tablet":
|
|
969
|
-
stackedStyle:
|
|
1098
|
+
"--column-margin-left-tablet": c({
|
|
1099
|
+
stackedStyle: A,
|
|
970
1100
|
desktopStyle: w
|
|
971
1101
|
})
|
|
972
1102
|
};
|
|
973
1103
|
}
|
|
974
|
-
function
|
|
1104
|
+
function x(v) {
|
|
975
1105
|
var T, w;
|
|
976
1106
|
return getSizesForBreakpoints(
|
|
977
1107
|
((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
|
|
@@ -979,7 +1109,7 @@ function Columns(e) {
|
|
|
979
1109
|
}
|
|
980
1110
|
function I() {
|
|
981
1111
|
return `
|
|
982
|
-
@media (max-width: ${
|
|
1112
|
+
@media (max-width: ${x("medium")}px) {
|
|
983
1113
|
.${e.builderBlock.id}-breakpoints {
|
|
984
1114
|
flex-direction: var(--flex-dir-tablet);
|
|
985
1115
|
align-items: stretch;
|
|
@@ -991,7 +1121,7 @@ function Columns(e) {
|
|
|
991
1121
|
}
|
|
992
1122
|
}
|
|
993
1123
|
|
|
994
|
-
@media (max-width: ${
|
|
1124
|
+
@media (max-width: ${x("small")}px) {
|
|
995
1125
|
.${e.builderBlock.id}-breakpoints {
|
|
996
1126
|
flex-direction: var(--flex-dir);
|
|
997
1127
|
align-items: stretch;
|
|
@@ -1009,7 +1139,7 @@ function Columns(e) {
|
|
|
1009
1139
|
"div",
|
|
1010
1140
|
{
|
|
1011
1141
|
className: `builder-columns ${e.builderBlock.id}-breakpoints div-6f826264`,
|
|
1012
|
-
style:
|
|
1142
|
+
style: u(),
|
|
1013
1143
|
children: [
|
|
1014
1144
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: I() }) }),
|
|
1015
1145
|
(E = e.columns) == null ? void 0 : E.map((v, C) => /* @__PURE__ */ jsx(
|
|
@@ -1022,7 +1152,7 @@ function Columns(e) {
|
|
|
1022
1152
|
href: v.link
|
|
1023
1153
|
} : {},
|
|
1024
1154
|
[getClassPropName()]: "builder-column",
|
|
1025
|
-
style: mapStyleObjToStrIfNeeded(
|
|
1155
|
+
style: mapStyleObjToStrIfNeeded(g(C))
|
|
1026
1156
|
},
|
|
1027
1157
|
children: /* @__PURE__ */ jsx(
|
|
1028
1158
|
Blocks,
|
|
@@ -1087,31 +1217,31 @@ function Image(e) {
|
|
|
1087
1217
|
var o, a, r, s;
|
|
1088
1218
|
function t() {
|
|
1089
1219
|
var d;
|
|
1090
|
-
const
|
|
1091
|
-
if (!
|
|
1220
|
+
const c = e.image || e.src;
|
|
1221
|
+
if (!c || // We can auto add srcset for cdn.builder.io and shopify
|
|
1092
1222
|
// images, otherwise you can supply this prop manually
|
|
1093
|
-
!(
|
|
1223
|
+
!(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
|
|
1094
1224
|
return e.srcset;
|
|
1095
1225
|
if (e.srcset && ((d = e.image) != null && d.includes("builder.io/api/v1/image"))) {
|
|
1096
1226
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1097
|
-
return console.debug("Removed given srcset"), getSrcSet(
|
|
1227
|
+
return console.debug("Removed given srcset"), getSrcSet(c);
|
|
1098
1228
|
} else if (e.image && !e.srcset)
|
|
1099
|
-
return getSrcSet(
|
|
1100
|
-
return getSrcSet(
|
|
1229
|
+
return getSrcSet(c);
|
|
1230
|
+
return getSrcSet(c);
|
|
1101
1231
|
}
|
|
1102
1232
|
function n() {
|
|
1103
|
-
var
|
|
1104
|
-
return (
|
|
1233
|
+
var l;
|
|
1234
|
+
return (l = t == null ? void 0 : t()) != null && l.match(/builder\.io/) && !e.noWebp ? t().replace(/\?/g, "?format=webp&") : "";
|
|
1105
1235
|
}
|
|
1106
1236
|
function i() {
|
|
1107
|
-
const
|
|
1237
|
+
const l = {
|
|
1108
1238
|
position: "absolute",
|
|
1109
1239
|
height: "100%",
|
|
1110
1240
|
width: "100%",
|
|
1111
1241
|
left: "0px",
|
|
1112
1242
|
top: "0px"
|
|
1113
1243
|
};
|
|
1114
|
-
return e.aspectRatio ?
|
|
1244
|
+
return e.aspectRatio ? l : void 0;
|
|
1115
1245
|
}
|
|
1116
1246
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1117
1247
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1399,7 +1529,7 @@ const componentInfo$b = {
|
|
|
1399
1529
|
});
|
|
1400
1530
|
}
|
|
1401
1531
|
const n = e.get("columns");
|
|
1402
|
-
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((s,
|
|
1532
|
+
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((s, l) => s + l.get("width"), 0) !== 100) && t();
|
|
1403
1533
|
}
|
|
1404
1534
|
}, {
|
|
1405
1535
|
name: "space",
|
|
@@ -1451,23 +1581,23 @@ function CustomCode(e) {
|
|
|
1451
1581
|
if (!((s = t.current) != null && s.getElementsByTagName) || typeof window == "undefined")
|
|
1452
1582
|
return;
|
|
1453
1583
|
const r = t.current.getElementsByTagName("script");
|
|
1454
|
-
for (let
|
|
1455
|
-
const
|
|
1456
|
-
if (
|
|
1457
|
-
if (n.includes(
|
|
1584
|
+
for (let l = 0; l < r.length; l++) {
|
|
1585
|
+
const c = r[l];
|
|
1586
|
+
if (c.src) {
|
|
1587
|
+
if (n.includes(c.src))
|
|
1458
1588
|
continue;
|
|
1459
|
-
n.push(
|
|
1589
|
+
n.push(c.src);
|
|
1460
1590
|
const d = document.createElement("script");
|
|
1461
|
-
d.async = !0, d.src =
|
|
1462
|
-
} else if (!
|
|
1591
|
+
d.async = !0, d.src = c.src, document.head.appendChild(d);
|
|
1592
|
+
} else if (!c.type || [
|
|
1463
1593
|
"text/javascript",
|
|
1464
1594
|
"application/javascript",
|
|
1465
1595
|
"application/ecmascript"
|
|
1466
|
-
].includes(
|
|
1467
|
-
if (o.includes(
|
|
1596
|
+
].includes(c.type)) {
|
|
1597
|
+
if (o.includes(c.innerText))
|
|
1468
1598
|
continue;
|
|
1469
1599
|
try {
|
|
1470
|
-
o.push(
|
|
1600
|
+
o.push(c.innerText), new Function(c.innerText)();
|
|
1471
1601
|
} catch (d) {
|
|
1472
1602
|
console.warn("`CustomCode`: Error running script:", d);
|
|
1473
1603
|
}
|
|
@@ -1510,26 +1640,26 @@ const componentInfo$8 = {
|
|
|
1510
1640
|
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1511
1641
|
function Embed(e) {
|
|
1512
1642
|
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r, s] = useState(() => !1);
|
|
1513
|
-
function
|
|
1643
|
+
function l() {
|
|
1514
1644
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1515
1645
|
return;
|
|
1516
|
-
const
|
|
1517
|
-
for (let d = 0; d <
|
|
1518
|
-
const
|
|
1519
|
-
if (
|
|
1520
|
-
n.push(
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
} else if (isJsScript(
|
|
1646
|
+
const c = t.current.getElementsByTagName("script");
|
|
1647
|
+
for (let d = 0; d < c.length; d++) {
|
|
1648
|
+
const h = c[d];
|
|
1649
|
+
if (h.src && !n.includes(h.src)) {
|
|
1650
|
+
n.push(h.src);
|
|
1651
|
+
const y = document.createElement("script");
|
|
1652
|
+
y.async = !0, y.src = h.src, document.head.appendChild(y);
|
|
1653
|
+
} else if (isJsScript(h) && !o.includes(h.innerText))
|
|
1524
1654
|
try {
|
|
1525
|
-
o.push(
|
|
1526
|
-
} catch (
|
|
1527
|
-
console.warn("`Embed`: Error running script:",
|
|
1655
|
+
o.push(h.innerText), new Function(h.innerText)();
|
|
1656
|
+
} catch (y) {
|
|
1657
|
+
console.warn("`Embed`: Error running script:", y);
|
|
1528
1658
|
}
|
|
1529
1659
|
}
|
|
1530
1660
|
}
|
|
1531
1661
|
return useEffect(() => {
|
|
1532
|
-
t.current && !r && (s(!0),
|
|
1662
|
+
t.current && !r && (s(!0), l());
|
|
1533
1663
|
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1534
1664
|
"div",
|
|
1535
1665
|
{
|
|
@@ -1566,15 +1696,15 @@ const componentInfo$7 = {
|
|
|
1566
1696
|
onChange: (e) => {
|
|
1567
1697
|
e.delete("srcset"), e.delete("noWebp");
|
|
1568
1698
|
function n(r, s = 6e4) {
|
|
1569
|
-
return new Promise((
|
|
1699
|
+
return new Promise((l, c) => {
|
|
1570
1700
|
const d = document.createElement("img");
|
|
1571
|
-
let
|
|
1701
|
+
let h = !1;
|
|
1572
1702
|
d.onload = () => {
|
|
1573
|
-
|
|
1574
|
-
}, d.addEventListener("error", (
|
|
1575
|
-
console.warn("Image load failed",
|
|
1703
|
+
h = !0, l(d);
|
|
1704
|
+
}, d.addEventListener("error", (y) => {
|
|
1705
|
+
console.warn("Image load failed", y.error), c(y.error);
|
|
1576
1706
|
}), d.src = r, setTimeout(() => {
|
|
1577
|
-
|
|
1707
|
+
h || c(new Error("Image load timed out"));
|
|
1578
1708
|
}, s);
|
|
1579
1709
|
});
|
|
1580
1710
|
}
|
|
@@ -1899,7 +2029,7 @@ const componentInfo = {
|
|
|
1899
2029
|
}]
|
|
1900
2030
|
};
|
|
1901
2031
|
function Video(e) {
|
|
1902
|
-
var i, o, a, r, s,
|
|
2032
|
+
var i, o, a, r, s, l, c;
|
|
1903
2033
|
function t() {
|
|
1904
2034
|
return {
|
|
1905
2035
|
...e.autoPlay === !0 ? {
|
|
@@ -1978,7 +2108,7 @@ function Video(e) {
|
|
|
1978
2108
|
children: e.children
|
|
1979
2109
|
}
|
|
1980
2110
|
) }) : null,
|
|
1981
|
-
(
|
|
2111
|
+
(c = (l = e.builderBlock) == null ? void 0 : l.children) != null && c.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1982
2112
|
"div",
|
|
1983
2113
|
{
|
|
1984
2114
|
style: {
|
|
@@ -2200,7 +2330,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2200
2330
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2201
2331
|
}
|
|
2202
2332
|
};
|
|
2203
|
-
}, SDK_VERSION = "0.12.
|
|
2333
|
+
}, SDK_VERSION = "0.12.7", registerInsertMenu = () => {
|
|
2204
2334
|
register("insertMenu", {
|
|
2205
2335
|
name: "_default",
|
|
2206
2336
|
default: !0,
|
|
@@ -2252,33 +2382,33 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2252
2382
|
if (o != null && o.type)
|
|
2253
2383
|
switch (o.type) {
|
|
2254
2384
|
case "builder.evaluate": {
|
|
2255
|
-
const s = o.data.text,
|
|
2256
|
-
let
|
|
2385
|
+
const s = o.data.text, l = o.data.arguments || [], c = o.data.id, d = new Function(s);
|
|
2386
|
+
let h, y = null;
|
|
2257
2387
|
try {
|
|
2258
|
-
|
|
2259
|
-
} catch (
|
|
2260
|
-
|
|
2388
|
+
h = d.apply(null, l);
|
|
2389
|
+
} catch (u) {
|
|
2390
|
+
y = u;
|
|
2261
2391
|
}
|
|
2262
|
-
|
|
2392
|
+
y ? (a = window.parent) == null || a.postMessage({
|
|
2263
2393
|
type: "builder.evaluateError",
|
|
2264
2394
|
data: {
|
|
2265
|
-
id:
|
|
2266
|
-
error:
|
|
2395
|
+
id: c,
|
|
2396
|
+
error: y.message
|
|
2267
2397
|
}
|
|
2268
|
-
}, "*") :
|
|
2269
|
-
var
|
|
2270
|
-
(
|
|
2398
|
+
}, "*") : h && typeof h.then == "function" ? h.then((u) => {
|
|
2399
|
+
var g;
|
|
2400
|
+
(g = window.parent) == null || g.postMessage({
|
|
2271
2401
|
type: "builder.evaluateResult",
|
|
2272
2402
|
data: {
|
|
2273
|
-
id:
|
|
2274
|
-
result:
|
|
2403
|
+
id: c,
|
|
2404
|
+
result: u
|
|
2275
2405
|
}
|
|
2276
2406
|
}, "*");
|
|
2277
2407
|
}).catch(console.error) : (r = window.parent) == null || r.postMessage({
|
|
2278
2408
|
type: "builder.evaluateResult",
|
|
2279
2409
|
data: {
|
|
2280
|
-
result:
|
|
2281
|
-
id:
|
|
2410
|
+
result: h,
|
|
2411
|
+
id: c
|
|
2282
2412
|
}
|
|
2283
2413
|
}, "*");
|
|
2284
2414
|
break;
|
|
@@ -2287,55 +2417,55 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2287
2417
|
})));
|
|
2288
2418
|
};
|
|
2289
2419
|
function EnableEditor(e) {
|
|
2290
|
-
var
|
|
2420
|
+
var A, B, P, N, F, _, V;
|
|
2291
2421
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2292
2422
|
useState(() => !0);
|
|
2293
|
-
function o(
|
|
2423
|
+
function o(m) {
|
|
2294
2424
|
var b, S;
|
|
2295
|
-
const
|
|
2425
|
+
const f = {
|
|
2296
2426
|
...e.builderContextSignal.rootState,
|
|
2297
|
-
...
|
|
2427
|
+
...m
|
|
2298
2428
|
};
|
|
2299
|
-
e.builderContextSignal.rootSetState ? (S = (b = e.builderContextSignal).rootSetState) == null || S.call(b,
|
|
2429
|
+
e.builderContextSignal.rootSetState ? (S = (b = e.builderContextSignal).rootSetState) == null || S.call(b, f) : e.setBuilderContextSignal((p) => ({
|
|
2300
2430
|
...p,
|
|
2301
|
-
rootState:
|
|
2431
|
+
rootState: f
|
|
2302
2432
|
}));
|
|
2303
2433
|
}
|
|
2304
|
-
function a(
|
|
2305
|
-
var b, S, p, k,
|
|
2306
|
-
const
|
|
2434
|
+
function a(m) {
|
|
2435
|
+
var b, S, p, k, j;
|
|
2436
|
+
const f = {
|
|
2307
2437
|
...e.builderContextSignal.content,
|
|
2308
|
-
...
|
|
2438
|
+
...m,
|
|
2309
2439
|
data: {
|
|
2310
2440
|
...(b = e.builderContextSignal.content) == null ? void 0 : b.data,
|
|
2311
|
-
...
|
|
2441
|
+
...m == null ? void 0 : m.data
|
|
2312
2442
|
},
|
|
2313
2443
|
meta: {
|
|
2314
2444
|
...(S = e.builderContextSignal.content) == null ? void 0 : S.meta,
|
|
2315
|
-
...
|
|
2316
|
-
breakpoints: ((p =
|
|
2445
|
+
...m == null ? void 0 : m.meta,
|
|
2446
|
+
breakpoints: ((p = m == null ? void 0 : m.meta) == null ? void 0 : p.breakpoints) || ((j = (k = e.builderContextSignal.content) == null ? void 0 : k.meta) == null ? void 0 : j.breakpoints)
|
|
2317
2447
|
}
|
|
2318
2448
|
};
|
|
2319
2449
|
e.setBuilderContextSignal(($) => ({
|
|
2320
2450
|
...$,
|
|
2321
|
-
content:
|
|
2451
|
+
content: f
|
|
2322
2452
|
}));
|
|
2323
2453
|
}
|
|
2324
2454
|
useState(() => 0);
|
|
2325
2455
|
const [r, s] = useState(
|
|
2326
2456
|
() => !1
|
|
2327
|
-
), [
|
|
2457
|
+
), [l, c] = useState(
|
|
2328
2458
|
() => e.contentWrapper || "div"
|
|
2329
2459
|
);
|
|
2330
|
-
function d(
|
|
2460
|
+
function d(m) {
|
|
2331
2461
|
var b;
|
|
2332
|
-
if (!isFromTrustedHost(e.trustedHosts,
|
|
2462
|
+
if (!isFromTrustedHost(e.trustedHosts, m))
|
|
2333
2463
|
return;
|
|
2334
|
-
const { data:
|
|
2335
|
-
if (
|
|
2336
|
-
switch (
|
|
2464
|
+
const { data: f } = m;
|
|
2465
|
+
if (f)
|
|
2466
|
+
switch (f.type) {
|
|
2337
2467
|
case "builder.configureSdk": {
|
|
2338
|
-
const S =
|
|
2468
|
+
const S = f.data, { breakpoints: p, contentId: k } = S;
|
|
2339
2469
|
if (!k || k !== ((b = e.builderContextSignal.content) == null ? void 0 : b.id))
|
|
2340
2470
|
return;
|
|
2341
2471
|
p && a({
|
|
@@ -2345,45 +2475,49 @@ function EnableEditor(e) {
|
|
|
2345
2475
|
}), i(n + 1);
|
|
2346
2476
|
break;
|
|
2347
2477
|
}
|
|
2478
|
+
case "builder.triggerAnimation": {
|
|
2479
|
+
triggerAnimation(f.data);
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2348
2482
|
case "builder.contentUpdate": {
|
|
2349
|
-
const S =
|
|
2483
|
+
const S = f.data, p = S.key || S.alias || S.entry || S.modelName, k = S.data;
|
|
2350
2484
|
p === e.model && (a(k), i(n + 1));
|
|
2351
2485
|
break;
|
|
2352
2486
|
}
|
|
2353
2487
|
}
|
|
2354
2488
|
}
|
|
2355
|
-
function
|
|
2356
|
-
var
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2359
|
-
code:
|
|
2489
|
+
function h() {
|
|
2490
|
+
var f, b;
|
|
2491
|
+
const m = (b = (f = e.builderContextSignal.content) == null ? void 0 : f.data) == null ? void 0 : b.jsCode;
|
|
2492
|
+
m && evaluate({
|
|
2493
|
+
code: m,
|
|
2360
2494
|
context: e.context || {},
|
|
2361
2495
|
localState: void 0,
|
|
2362
2496
|
rootState: e.builderContextSignal.rootState,
|
|
2363
2497
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2364
2498
|
});
|
|
2365
2499
|
}
|
|
2366
|
-
const [
|
|
2367
|
-
function I(
|
|
2368
|
-
var
|
|
2500
|
+
const [y, u] = useState(() => ({})), [g, x] = useState(() => !1);
|
|
2501
|
+
function I(m) {
|
|
2502
|
+
var f, b;
|
|
2369
2503
|
if (e.builderContextSignal.content) {
|
|
2370
|
-
const S = (
|
|
2504
|
+
const S = (f = e.builderContextSignal.content) == null ? void 0 : f.testVariationId, p = (b = e.builderContextSignal.content) == null ? void 0 : b.id;
|
|
2371
2505
|
_track({
|
|
2372
2506
|
type: "click",
|
|
2373
2507
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2374
2508
|
contentId: p,
|
|
2375
2509
|
apiKey: e.apiKey,
|
|
2376
2510
|
variationId: S !== p ? S : void 0,
|
|
2377
|
-
...getInteractionPropertiesForEvent(
|
|
2378
|
-
unique: !
|
|
2511
|
+
...getInteractionPropertiesForEvent(m),
|
|
2512
|
+
unique: !g
|
|
2379
2513
|
});
|
|
2380
2514
|
}
|
|
2381
|
-
|
|
2515
|
+
g || x(!0);
|
|
2382
2516
|
}
|
|
2383
|
-
function E(
|
|
2384
|
-
return
|
|
2517
|
+
function E(m) {
|
|
2518
|
+
return m.replace(
|
|
2385
2519
|
/{{([^}]+)}}/g,
|
|
2386
|
-
(
|
|
2520
|
+
(f, b) => evaluate({
|
|
2387
2521
|
code: b,
|
|
2388
2522
|
context: e.context || {},
|
|
2389
2523
|
localState: void 0,
|
|
@@ -2392,26 +2526,26 @@ function EnableEditor(e) {
|
|
|
2392
2526
|
})
|
|
2393
2527
|
);
|
|
2394
2528
|
}
|
|
2395
|
-
function v({ url:
|
|
2396
|
-
fetch$1(
|
|
2529
|
+
function v({ url: m, key: f }) {
|
|
2530
|
+
fetch$1(m).then((b) => b.json()).then((b) => {
|
|
2397
2531
|
var p, k;
|
|
2398
2532
|
const S = {
|
|
2399
2533
|
...e.builderContextSignal.rootState,
|
|
2400
|
-
[
|
|
2534
|
+
[f]: b
|
|
2401
2535
|
};
|
|
2402
|
-
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, S),
|
|
2536
|
+
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, S), y[f] = !0;
|
|
2403
2537
|
}).catch((b) => {
|
|
2404
|
-
console.error("error fetching dynamic data",
|
|
2538
|
+
console.error("error fetching dynamic data", m, b);
|
|
2405
2539
|
});
|
|
2406
2540
|
}
|
|
2407
2541
|
function C() {
|
|
2408
|
-
var
|
|
2409
|
-
const
|
|
2410
|
-
Object.entries(
|
|
2411
|
-
if (k && (!
|
|
2412
|
-
const
|
|
2542
|
+
var f, b, S;
|
|
2543
|
+
const m = (S = (b = (f = e.builderContextSignal.content) == null ? void 0 : f.data) == null ? void 0 : b.httpRequests) != null ? S : {};
|
|
2544
|
+
Object.entries(m).forEach(([p, k]) => {
|
|
2545
|
+
if (k && (!y[p] || isEditing())) {
|
|
2546
|
+
const j = E(k);
|
|
2413
2547
|
v({
|
|
2414
|
-
url:
|
|
2548
|
+
url: j,
|
|
2415
2549
|
key: p
|
|
2416
2550
|
});
|
|
2417
2551
|
}
|
|
@@ -2432,7 +2566,7 @@ function EnableEditor(e) {
|
|
|
2432
2566
|
)
|
|
2433
2567
|
);
|
|
2434
2568
|
}
|
|
2435
|
-
function w(
|
|
2569
|
+
function w(m) {
|
|
2436
2570
|
i(n + 1), window.addEventListener("message", d), registerInsertMenu(), setupBrowserForEditing({
|
|
2437
2571
|
...e.locale ? {
|
|
2438
2572
|
locale: e.locale
|
|
@@ -2448,19 +2582,19 @@ function EnableEditor(e) {
|
|
|
2448
2582
|
} : {}
|
|
2449
2583
|
}), Object.values(
|
|
2450
2584
|
e.builderContextSignal.componentInfos
|
|
2451
|
-
).forEach((
|
|
2585
|
+
).forEach((f) => {
|
|
2452
2586
|
var S;
|
|
2453
|
-
const b = createRegisterComponentMessage(
|
|
2587
|
+
const b = createRegisterComponentMessage(f);
|
|
2454
2588
|
(S = window.parent) == null || S.postMessage(b, "*");
|
|
2455
2589
|
}), window.addEventListener(
|
|
2456
2590
|
"builder:component:stateChangeListenerActivated",
|
|
2457
2591
|
T
|
|
2458
2592
|
);
|
|
2459
2593
|
}
|
|
2460
|
-
function R(
|
|
2461
|
-
const
|
|
2594
|
+
function R(m) {
|
|
2595
|
+
const f = new URL(location.href).searchParams, b = f.get("builder.preview"), S = f.get(
|
|
2462
2596
|
`builder.preview.${b}`
|
|
2463
|
-
), p =
|
|
2597
|
+
), p = f.get("apiKey") || f.get("builder.space");
|
|
2464
2598
|
b === e.model && p === e.apiKey && (!e.content || S === e.content.id) && fetchOneEntry({
|
|
2465
2599
|
model: e.model,
|
|
2466
2600
|
apiKey: e.apiKey,
|
|
@@ -2470,34 +2604,34 @@ function EnableEditor(e) {
|
|
|
2470
2604
|
});
|
|
2471
2605
|
}
|
|
2472
2606
|
return useEffect(() => {
|
|
2473
|
-
var
|
|
2474
|
-
return (
|
|
2607
|
+
var m;
|
|
2608
|
+
return (m = t.current) == null || m.addEventListener(
|
|
2475
2609
|
"initeditingbldr",
|
|
2476
2610
|
w
|
|
2477
2611
|
), () => {
|
|
2478
|
-
var
|
|
2479
|
-
return (
|
|
2612
|
+
var f;
|
|
2613
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2480
2614
|
"initeditingbldr",
|
|
2481
2615
|
w
|
|
2482
2616
|
);
|
|
2483
2617
|
};
|
|
2484
2618
|
}, []), useEffect(() => {
|
|
2485
|
-
var
|
|
2486
|
-
return (
|
|
2619
|
+
var m;
|
|
2620
|
+
return (m = t.current) == null || m.addEventListener(
|
|
2487
2621
|
"initpreviewingbldr",
|
|
2488
2622
|
R
|
|
2489
2623
|
), () => {
|
|
2490
|
-
var
|
|
2491
|
-
return (
|
|
2624
|
+
var f;
|
|
2625
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2492
2626
|
"initpreviewingbldr",
|
|
2493
2627
|
R
|
|
2494
2628
|
);
|
|
2495
2629
|
};
|
|
2496
2630
|
}, []), useEffect(() => {
|
|
2497
|
-
var
|
|
2631
|
+
var m, f;
|
|
2498
2632
|
if (isBrowser()) {
|
|
2499
2633
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2500
|
-
const S = (
|
|
2634
|
+
const S = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, p = (f = e.builderContextSignal.content) == null ? void 0 : f.id, k = e.apiKey;
|
|
2501
2635
|
_track({
|
|
2502
2636
|
type: "impression",
|
|
2503
2637
|
canTrack: !0,
|
|
@@ -2511,15 +2645,15 @@ function EnableEditor(e) {
|
|
|
2511
2645
|
}, []), useEffect(() => {
|
|
2512
2646
|
e.apiKey || logger.error(
|
|
2513
2647
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2514
|
-
),
|
|
2648
|
+
), h(), C(), T();
|
|
2515
2649
|
}, []), useEffect(() => {
|
|
2516
2650
|
e.content && a(e.content);
|
|
2517
2651
|
}, [e.content]), useEffect(() => {
|
|
2518
2652
|
}, [r]), useEffect(() => {
|
|
2519
|
-
|
|
2520
|
-
}, [(
|
|
2653
|
+
h();
|
|
2654
|
+
}, [(B = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : B.jsCode]), useEffect(() => {
|
|
2521
2655
|
C();
|
|
2522
|
-
}, [(
|
|
2656
|
+
}, [(N = (P = e.builderContextSignal.content) == null ? void 0 : P.data) == null ? void 0 : N.httpRequests]), useEffect(() => {
|
|
2523
2657
|
T();
|
|
2524
2658
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
2525
2659
|
e.data && o(e.data);
|
|
@@ -2533,12 +2667,12 @@ function EnableEditor(e) {
|
|
|
2533
2667
|
T
|
|
2534
2668
|
));
|
|
2535
2669
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2536
|
-
|
|
2670
|
+
l,
|
|
2537
2671
|
{
|
|
2538
2672
|
key: n,
|
|
2539
2673
|
ref: t,
|
|
2540
|
-
onClick: (
|
|
2541
|
-
"builder-content-id": (
|
|
2674
|
+
onClick: (m) => I(m),
|
|
2675
|
+
"builder-content-id": (F = e.builderContextSignal.content) == null ? void 0 : F.id,
|
|
2542
2676
|
"builder-model": e.model,
|
|
2543
2677
|
...e.showContent ? {} : {
|
|
2544
2678
|
hidden: !0,
|
|
@@ -2565,11 +2699,11 @@ font-weight: 400;
|
|
|
2565
2699
|
for (const s in e.files) {
|
|
2566
2700
|
if (!(String(Number(s)) === s))
|
|
2567
2701
|
continue;
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2702
|
+
const c = e.files[s];
|
|
2703
|
+
c && c !== i && (o += `
|
|
2570
2704
|
@font-face {
|
|
2571
2705
|
font-family: "${t}";
|
|
2572
|
-
src: url('${
|
|
2706
|
+
src: url('${c}') format('woff2');
|
|
2573
2707
|
font-display: fallback;
|
|
2574
2708
|
font-weight: ${s};
|
|
2575
2709
|
}
|
|
@@ -2623,8 +2757,8 @@ const getRootStateInitialValue = ({
|
|
|
2623
2757
|
}) => {
|
|
2624
2758
|
var a, r, s;
|
|
2625
2759
|
const i = {}, o = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.state) || {};
|
|
2626
|
-
return (s = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || s.forEach((
|
|
2627
|
-
|
|
2760
|
+
return (s = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || s.forEach((l) => {
|
|
2761
|
+
l.name && l.defaultValue !== void 0 && (i[l.name] = l.defaultValue);
|
|
2628
2762
|
}), {
|
|
2629
2763
|
...i,
|
|
2630
2764
|
...o,
|
|
@@ -2645,22 +2779,22 @@ const getRootStateInitialValue = ({
|
|
|
2645
2779
|
meta: e == null ? void 0 : e.meta
|
|
2646
2780
|
} : void 0;
|
|
2647
2781
|
function ContentComponent(e) {
|
|
2648
|
-
var
|
|
2782
|
+
var l, c, d, h, y, u, g;
|
|
2649
2783
|
const [t, n] = useState(
|
|
2650
2784
|
() => {
|
|
2651
|
-
var
|
|
2785
|
+
var x, I;
|
|
2652
2786
|
return getUpdateVariantVisibilityScript({
|
|
2653
2787
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2654
|
-
variationId: (
|
|
2788
|
+
variationId: (x = e.content) == null ? void 0 : x.testVariationId,
|
|
2655
2789
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2656
2790
|
contentId: (I = e.content) == null ? void 0 : I.id
|
|
2657
2791
|
});
|
|
2658
2792
|
}
|
|
2659
2793
|
);
|
|
2660
|
-
function i(
|
|
2794
|
+
function i(x) {
|
|
2661
2795
|
s((I) => ({
|
|
2662
2796
|
...I,
|
|
2663
|
-
rootState:
|
|
2797
|
+
rootState: x
|
|
2664
2798
|
}));
|
|
2665
2799
|
}
|
|
2666
2800
|
const [o, a] = useState(
|
|
@@ -2674,8 +2808,8 @@ function ContentComponent(e) {
|
|
|
2674
2808
|
...components,
|
|
2675
2809
|
...e.customComponents || []
|
|
2676
2810
|
].reduce(
|
|
2677
|
-
(
|
|
2678
|
-
...
|
|
2811
|
+
(x, { component: I, ...E }) => ({
|
|
2812
|
+
...x,
|
|
2679
2813
|
[E.name]: {
|
|
2680
2814
|
component: I,
|
|
2681
2815
|
...serializeComponentInfo(E)
|
|
@@ -2708,8 +2842,8 @@ function ContentComponent(e) {
|
|
|
2708
2842
|
...components,
|
|
2709
2843
|
...e.customComponents || []
|
|
2710
2844
|
].reduce(
|
|
2711
|
-
(
|
|
2712
|
-
...
|
|
2845
|
+
(x, { component: I, ...E }) => ({
|
|
2846
|
+
...x,
|
|
2713
2847
|
[E.name]: serializeComponentInfo(E)
|
|
2714
2848
|
}),
|
|
2715
2849
|
{}
|
|
@@ -2748,15 +2882,15 @@ function ContentComponent(e) {
|
|
|
2748
2882
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2749
2883
|
ContentStyles,
|
|
2750
2884
|
{
|
|
2751
|
-
contentId: (
|
|
2752
|
-
cssCode: (d = (
|
|
2753
|
-
customFonts: (
|
|
2885
|
+
contentId: (l = r.content) == null ? void 0 : l.id,
|
|
2886
|
+
cssCode: (d = (c = r.content) == null ? void 0 : c.data) == null ? void 0 : d.cssCode,
|
|
2887
|
+
customFonts: (y = (h = r.content) == null ? void 0 : h.data) == null ? void 0 : y.customFonts
|
|
2754
2888
|
}
|
|
2755
2889
|
) }),
|
|
2756
2890
|
/* @__PURE__ */ jsx(
|
|
2757
2891
|
Blocks,
|
|
2758
2892
|
{
|
|
2759
|
-
blocks: (
|
|
2893
|
+
blocks: (g = (u = r.content) == null ? void 0 : u.data) == null ? void 0 : g.blocks,
|
|
2760
2894
|
context: r,
|
|
2761
2895
|
registeredComponents: o,
|
|
2762
2896
|
linkComponent: e.linkComponent
|
|
@@ -2777,23 +2911,23 @@ function ContentVariants(e) {
|
|
|
2777
2911
|
})
|
|
2778
2912
|
);
|
|
2779
2913
|
function i() {
|
|
2780
|
-
var
|
|
2914
|
+
var l;
|
|
2781
2915
|
return getUpdateCookieAndStylesScript(
|
|
2782
|
-
getVariants(e.content).map((
|
|
2783
|
-
id:
|
|
2784
|
-
testRatio:
|
|
2916
|
+
getVariants(e.content).map((c) => ({
|
|
2917
|
+
id: c.testVariationId,
|
|
2918
|
+
testRatio: c.testRatio
|
|
2785
2919
|
})),
|
|
2786
|
-
((
|
|
2920
|
+
((l = e.content) == null ? void 0 : l.id) || ""
|
|
2787
2921
|
);
|
|
2788
2922
|
}
|
|
2789
2923
|
function o() {
|
|
2790
|
-
return getVariants(e.content).map((
|
|
2924
|
+
return getVariants(e.content).map((l) => `.variant-${l.testVariationId} { display: none; } `).join("");
|
|
2791
2925
|
}
|
|
2792
2926
|
function a() {
|
|
2793
|
-
var
|
|
2927
|
+
var l;
|
|
2794
2928
|
return t ? {
|
|
2795
2929
|
...e.content,
|
|
2796
|
-
testVariationId: (
|
|
2930
|
+
testVariationId: (l = e.content) == null ? void 0 : l.id
|
|
2797
2931
|
} : handleABTestingSync({
|
|
2798
2932
|
item: e.content,
|
|
2799
2933
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
@@ -2811,10 +2945,10 @@ function ContentVariants(e) {
|
|
|
2811
2945
|
}
|
|
2812
2946
|
),
|
|
2813
2947
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2814
|
-
(s = getVariants(e.content)) == null ? void 0 : s.map((
|
|
2948
|
+
(s = getVariants(e.content)) == null ? void 0 : s.map((l) => /* @__PURE__ */ jsx(
|
|
2815
2949
|
ContentComponent,
|
|
2816
2950
|
{
|
|
2817
|
-
content:
|
|
2951
|
+
content: l,
|
|
2818
2952
|
showContent: !1,
|
|
2819
2953
|
model: e.model,
|
|
2820
2954
|
data: e.data,
|
|
@@ -2834,7 +2968,7 @@ function ContentVariants(e) {
|
|
|
2834
2968
|
contentWrapperProps: e.contentWrapperProps,
|
|
2835
2969
|
trustedHosts: e.trustedHosts
|
|
2836
2970
|
},
|
|
2837
|
-
|
|
2971
|
+
l.testVariationId
|
|
2838
2972
|
))
|
|
2839
2973
|
] }) : null,
|
|
2840
2974
|
/* @__PURE__ */ jsx(
|
|
@@ -2883,26 +3017,26 @@ const fetchSymbolContent = async ({
|
|
|
2883
3017
|
});
|
|
2884
3018
|
};
|
|
2885
3019
|
function Symbol$1(e) {
|
|
2886
|
-
var a, r, s,
|
|
3020
|
+
var a, r, s, l;
|
|
2887
3021
|
function t() {
|
|
2888
|
-
var
|
|
3022
|
+
var c, d;
|
|
2889
3023
|
return [
|
|
2890
3024
|
e.attributes[getClassPropName()],
|
|
2891
3025
|
"builder-symbol",
|
|
2892
|
-
(
|
|
3026
|
+
(c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
|
|
2893
3027
|
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2894
3028
|
].filter(Boolean).join(" ");
|
|
2895
3029
|
}
|
|
2896
3030
|
const [n, i] = useState(() => {
|
|
2897
|
-
var
|
|
2898
|
-
return (
|
|
3031
|
+
var c;
|
|
3032
|
+
return (c = e.symbol) == null ? void 0 : c.content;
|
|
2899
3033
|
});
|
|
2900
3034
|
function o() {
|
|
2901
3035
|
n || fetchSymbolContent({
|
|
2902
3036
|
symbol: e.symbol,
|
|
2903
3037
|
builderContextValue: e.builderContext
|
|
2904
|
-
}).then((
|
|
2905
|
-
|
|
3038
|
+
}).then((c) => {
|
|
3039
|
+
c && i(c);
|
|
2906
3040
|
});
|
|
2907
3041
|
}
|
|
2908
3042
|
return useEffect(() => {
|
|
@@ -2924,7 +3058,7 @@ function Symbol$1(e) {
|
|
|
2924
3058
|
...e.builderContext.localState,
|
|
2925
3059
|
...(s = n == null ? void 0 : n.data) == null ? void 0 : s.state
|
|
2926
3060
|
},
|
|
2927
|
-
model: (
|
|
3061
|
+
model: (l = e.symbol) == null ? void 0 : l.model,
|
|
2928
3062
|
content: n,
|
|
2929
3063
|
linkComponent: e.builderLinkComponent
|
|
2930
3064
|
}
|