@builder.io/sdk-react 0.12.1 → 0.12.3
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 +29 -27
- package/lib/browser/index.mjs +603 -619
- package/lib/edge/index.cjs +35 -33
- package/lib/edge/index.mjs +1036 -1052
- package/lib/node/index.cjs +14 -12
- package/lib/node/index.mjs +385 -401
- package/package.json +1 -1
- package/types/components/block/block.helpers.d.ts +0 -1
- package/types/components/block/components/block-wrapper.d.ts +2 -6
- package/types/components/content-variants/content-variants.types.d.ts +4 -0
- package/types/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
- package/types/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/is-from-trusted-host.d.ts +3 -0
- package/types/scripts/init-editing.d.ts +1 -0
package/lib/node/index.mjs
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useState, useContext, createElement, useRef, useEffect } from "react";
|
|
4
4
|
import { i as isEditing, j as isBrowser, k as getUserAttributes, l as fastClone, m as logger, n as checkIsDefined, T as TARGET, r as register, o as getDefaultCanTrack, p as _track, a as isPreviewing, c as createRegisterComponentMessage, b as fetchOneEntry, q as fetch$1, u as components, v as serializeComponentInfo, w as handleABTestingSync } from "./server-entry-46908b1b.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-46908b1b.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
function Button(e) {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/* @__PURE__ */ jsx("style", { children: `.button-fdf49de0 {
|
|
28
|
-
all: unset;
|
|
29
|
-
}` })
|
|
30
|
-
] });
|
|
8
|
+
return /* @__PURE__ */ jsx(Fragment, { children: e.link ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
9
|
+
"a",
|
|
10
|
+
{
|
|
11
|
+
...e.attributes,
|
|
12
|
+
href: e.link,
|
|
13
|
+
target: e.openLinkInNewTab ? "_blank" : void 0,
|
|
14
|
+
role: "button",
|
|
15
|
+
children: e.text
|
|
16
|
+
}
|
|
17
|
+
) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
role: "button",
|
|
21
|
+
...e.attributes,
|
|
22
|
+
className: `builder-button ${e.attributes.className}`,
|
|
23
|
+
style: e.attributes.style,
|
|
24
|
+
children: e.text
|
|
25
|
+
}
|
|
26
|
+
) }) });
|
|
31
27
|
}
|
|
32
28
|
const builderContext = createContext({
|
|
33
29
|
content: null,
|
|
@@ -79,26 +75,26 @@ const getFunctionArguments = ({
|
|
|
79
75
|
context: n,
|
|
80
76
|
event: i,
|
|
81
77
|
localState: o,
|
|
82
|
-
rootSetState:
|
|
83
|
-
rootState:
|
|
78
|
+
rootSetState: r,
|
|
79
|
+
rootState: a
|
|
84
80
|
}) => {
|
|
85
81
|
const c = getFunctionArguments({
|
|
86
82
|
builder: t,
|
|
87
83
|
context: n,
|
|
88
84
|
event: i,
|
|
89
|
-
state: flattenState(
|
|
85
|
+
state: flattenState(a, o, r)
|
|
90
86
|
});
|
|
91
|
-
return new Function(...c.map(([
|
|
87
|
+
return new Function(...c.map(([s]) => s), e)(...c.map(([, s]) => s));
|
|
92
88
|
};
|
|
93
89
|
function flattenState(e, t, n) {
|
|
94
90
|
if (e === t)
|
|
95
91
|
throw new Error("rootState === localState");
|
|
96
92
|
return new Proxy(e, {
|
|
97
93
|
get: (i, o) => t && o in t ? t[o] : e[o],
|
|
98
|
-
set: (i, o,
|
|
94
|
+
set: (i, o, r) => {
|
|
99
95
|
if (t && o in t)
|
|
100
96
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
101
|
-
return e[o] =
|
|
97
|
+
return e[o] = r, n == null || n(e), !0;
|
|
102
98
|
}
|
|
103
99
|
});
|
|
104
100
|
}
|
|
@@ -106,7 +102,7 @@ const set = (e, t, n) => {
|
|
|
106
102
|
if (Object(e) !== e)
|
|
107
103
|
return e;
|
|
108
104
|
const i = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
109
|
-
return i.slice(0, -1).reduce((o,
|
|
105
|
+
return i.slice(0, -1).reduce((o, r, a) => Object(o[r]) === o[r] ? o[r] : o[r] = Math.abs(Number(i[a + 1])) >> 0 === +i[a + 1] ? [] : {}, e)[i[i.length - 1]] = n, e;
|
|
110
106
|
}, noop = () => {
|
|
111
107
|
};
|
|
112
108
|
let safeDynamicRequire = noop;
|
|
@@ -172,40 +168,40 @@ output;
|
|
|
172
168
|
context: n,
|
|
173
169
|
event: i,
|
|
174
170
|
localState: o,
|
|
175
|
-
rootSetState:
|
|
176
|
-
rootState:
|
|
171
|
+
rootSetState: r,
|
|
172
|
+
rootState: a
|
|
177
173
|
}) => {
|
|
178
174
|
const c = fastClone({
|
|
179
|
-
...
|
|
175
|
+
...a,
|
|
180
176
|
...o
|
|
181
|
-
}),
|
|
177
|
+
}), s = getFunctionArguments({
|
|
182
178
|
builder: t,
|
|
183
179
|
context: n,
|
|
184
180
|
event: i,
|
|
185
181
|
state: c
|
|
186
|
-
}),
|
|
182
|
+
}), l = getIsolateContext(), d = l.global;
|
|
187
183
|
d.setSync("global", d.derefInto()), d.setSync("log", function(...f) {
|
|
188
184
|
console.log(...f);
|
|
189
|
-
}), d.setSync(BUILDER_SET_STATE_NAME, function(f,
|
|
190
|
-
set(
|
|
191
|
-
}),
|
|
192
|
-
const y = typeof
|
|
185
|
+
}), d.setSync(BUILDER_SET_STATE_NAME, function(f, b) {
|
|
186
|
+
set(a, f, b), r == null || r(a);
|
|
187
|
+
}), s.forEach(([f, b]) => {
|
|
188
|
+
const y = typeof b == "object" ? new ivm.Reference(
|
|
193
189
|
// workaround: methods with default values for arguments is not being cloned over
|
|
194
190
|
f === "builder" ? {
|
|
195
|
-
...
|
|
196
|
-
getUserAttributes: () =>
|
|
197
|
-
} :
|
|
191
|
+
...b,
|
|
192
|
+
getUserAttributes: () => b.getUserAttributes()
|
|
193
|
+
} : b
|
|
198
194
|
) : null;
|
|
199
195
|
d.setSync(getSyncValName(f), y);
|
|
200
196
|
}), d.setSync(INJECTED_IVM_GLOBAL, ivm);
|
|
201
197
|
const g = processCode({
|
|
202
198
|
code: e,
|
|
203
|
-
args:
|
|
204
|
-
}),
|
|
199
|
+
args: s
|
|
200
|
+
}), S = l.evalSync(g);
|
|
205
201
|
try {
|
|
206
|
-
return JSON.parse(
|
|
202
|
+
return JSON.parse(S);
|
|
207
203
|
} catch {
|
|
208
|
-
return
|
|
204
|
+
return S;
|
|
209
205
|
}
|
|
210
206
|
}, chooseBrowserOrServerEval = (e) => isBrowser() ? runInBrowser(e) : runInNode(e);
|
|
211
207
|
function evaluate({
|
|
@@ -214,8 +210,8 @@ function evaluate({
|
|
|
214
210
|
localState: n,
|
|
215
211
|
rootState: i,
|
|
216
212
|
rootSetState: o,
|
|
217
|
-
event:
|
|
218
|
-
isExpression:
|
|
213
|
+
event: r,
|
|
214
|
+
isExpression: a = !0
|
|
219
215
|
}) {
|
|
220
216
|
if (e === "") {
|
|
221
217
|
logger.warn("Skipping evaluation of empty code block.");
|
|
@@ -223,19 +219,19 @@ function evaluate({
|
|
|
223
219
|
}
|
|
224
220
|
const c = {
|
|
225
221
|
code: parseCode(e, {
|
|
226
|
-
isExpression:
|
|
222
|
+
isExpression: a
|
|
227
223
|
}),
|
|
228
224
|
builder: getBuilderGlobals(),
|
|
229
225
|
context: t,
|
|
230
|
-
event:
|
|
226
|
+
event: r,
|
|
231
227
|
rootSetState: o,
|
|
232
228
|
rootState: i,
|
|
233
229
|
localState: n
|
|
234
230
|
};
|
|
235
231
|
try {
|
|
236
232
|
return chooseBrowserOrServerEval(c);
|
|
237
|
-
} catch (
|
|
238
|
-
logger.error("Failed code evaluation: " +
|
|
233
|
+
} catch (s) {
|
|
234
|
+
logger.error("Failed code evaluation: " + s.message, {
|
|
239
235
|
code: e
|
|
240
236
|
});
|
|
241
237
|
return;
|
|
@@ -253,26 +249,26 @@ const evaluateBindings = ({
|
|
|
253
249
|
}) => {
|
|
254
250
|
if (!e.bindings)
|
|
255
251
|
return e;
|
|
256
|
-
const
|
|
257
|
-
...
|
|
252
|
+
const r = fastClone(e), a = {
|
|
253
|
+
...r,
|
|
258
254
|
properties: {
|
|
259
|
-
...
|
|
255
|
+
...r.properties
|
|
260
256
|
},
|
|
261
257
|
actions: {
|
|
262
|
-
...
|
|
258
|
+
...r.actions
|
|
263
259
|
}
|
|
264
260
|
};
|
|
265
261
|
for (const c in e.bindings) {
|
|
266
|
-
const
|
|
267
|
-
code:
|
|
262
|
+
const s = e.bindings[c], l = evaluate({
|
|
263
|
+
code: s,
|
|
268
264
|
localState: n,
|
|
269
265
|
rootState: i,
|
|
270
266
|
rootSetState: o,
|
|
271
267
|
context: t
|
|
272
268
|
});
|
|
273
|
-
set(
|
|
269
|
+
set(a, c, l);
|
|
274
270
|
}
|
|
275
|
-
return
|
|
271
|
+
return a;
|
|
276
272
|
};
|
|
277
273
|
function getProcessedBlock({
|
|
278
274
|
block: e,
|
|
@@ -280,31 +276,31 @@ function getProcessedBlock({
|
|
|
280
276
|
shouldEvaluateBindings: n,
|
|
281
277
|
localState: i,
|
|
282
278
|
rootState: o,
|
|
283
|
-
rootSetState:
|
|
279
|
+
rootSetState: r
|
|
284
280
|
}) {
|
|
285
|
-
const
|
|
281
|
+
const a = e;
|
|
286
282
|
return n ? evaluateBindings({
|
|
287
|
-
block:
|
|
283
|
+
block: a,
|
|
288
284
|
localState: i,
|
|
289
285
|
rootState: o,
|
|
290
|
-
rootSetState:
|
|
286
|
+
rootSetState: r,
|
|
291
287
|
context: t
|
|
292
|
-
}) :
|
|
288
|
+
}) : a;
|
|
293
289
|
}
|
|
294
|
-
const
|
|
290
|
+
const getComponent = ({
|
|
295
291
|
block: e,
|
|
296
292
|
context: t,
|
|
297
293
|
registeredComponents: n
|
|
298
294
|
}) => {
|
|
299
|
-
var
|
|
300
|
-
const i = (
|
|
295
|
+
var r;
|
|
296
|
+
const i = (r = getProcessedBlock({
|
|
301
297
|
block: e,
|
|
302
298
|
localState: t.localState,
|
|
303
299
|
rootState: t.rootState,
|
|
304
300
|
rootSetState: t.rootSetState,
|
|
305
301
|
context: t.context,
|
|
306
302
|
shouldEvaluateBindings: !1
|
|
307
|
-
}).component) == null ? void 0 :
|
|
303
|
+
}).component) == null ? void 0 : r.name;
|
|
308
304
|
if (!i)
|
|
309
305
|
return null;
|
|
310
306
|
const o = n[i];
|
|
@@ -332,16 +328,16 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
332
328
|
});
|
|
333
329
|
if (!Array.isArray(o))
|
|
334
330
|
return;
|
|
335
|
-
const
|
|
336
|
-
return o.map((
|
|
331
|
+
const r = n.collection.split(".").pop(), a = n.itemName || (r ? r + "Item" : "item");
|
|
332
|
+
return o.map((s, l) => ({
|
|
337
333
|
context: {
|
|
338
334
|
...t,
|
|
339
335
|
localState: {
|
|
340
336
|
...t.localState,
|
|
341
|
-
$index:
|
|
342
|
-
$item:
|
|
343
|
-
[
|
|
344
|
-
[`$${
|
|
337
|
+
$index: l,
|
|
338
|
+
$item: s,
|
|
339
|
+
[a]: s,
|
|
340
|
+
[`$${a}Index`]: l
|
|
345
341
|
}
|
|
346
342
|
},
|
|
347
343
|
block: i
|
|
@@ -381,12 +377,12 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
381
377
|
min: o,
|
|
382
378
|
default: o + 1
|
|
383
379
|
};
|
|
384
|
-
const
|
|
380
|
+
const r = n.medium.max + 1;
|
|
385
381
|
return n.large = {
|
|
386
382
|
max: 2e3,
|
|
387
383
|
// TODO: decide upper limit
|
|
388
|
-
min:
|
|
389
|
-
default:
|
|
384
|
+
min: r,
|
|
385
|
+
default: r + 1
|
|
390
386
|
}, n;
|
|
391
387
|
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, i]) => {
|
|
392
388
|
if (typeof i == "string")
|
|
@@ -420,7 +416,7 @@ function BlockStyles(e) {
|
|
|
420
416
|
return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
|
|
421
417
|
}
|
|
422
418
|
function n() {
|
|
423
|
-
var
|
|
419
|
+
var b;
|
|
424
420
|
const i = getProcessedBlock({
|
|
425
421
|
block: e.block,
|
|
426
422
|
localState: e.context.localState,
|
|
@@ -428,30 +424,30 @@ function BlockStyles(e) {
|
|
|
428
424
|
rootSetState: e.context.rootSetState,
|
|
429
425
|
context: e.context.context,
|
|
430
426
|
shouldEvaluateBindings: !0
|
|
431
|
-
}), o = i.responsiveStyles,
|
|
432
|
-
((
|
|
433
|
-
), c = o == null ? void 0 : o.large,
|
|
427
|
+
}), o = i.responsiveStyles, r = e.context.content, a = getSizesForBreakpoints(
|
|
428
|
+
((b = r == null ? void 0 : r.meta) == null ? void 0 : b.breakpoints) || {}
|
|
429
|
+
), c = o == null ? void 0 : o.large, s = o == null ? void 0 : o.medium, l = o == null ? void 0 : o.small, d = i.id;
|
|
434
430
|
if (!d)
|
|
435
431
|
return "";
|
|
436
432
|
const g = c ? createCssClass({
|
|
437
433
|
className: d,
|
|
438
434
|
styles: c
|
|
439
|
-
}) : "",
|
|
435
|
+
}) : "", S = s ? createCssClass({
|
|
440
436
|
className: d,
|
|
441
|
-
styles:
|
|
437
|
+
styles: s,
|
|
442
438
|
mediaQuery: getMaxWidthQueryForSize(
|
|
443
439
|
"medium",
|
|
444
|
-
|
|
440
|
+
a
|
|
445
441
|
)
|
|
446
|
-
}) : "", f =
|
|
442
|
+
}) : "", f = l ? createCssClass({
|
|
447
443
|
className: d,
|
|
448
|
-
styles:
|
|
444
|
+
styles: l,
|
|
449
445
|
mediaQuery: getMaxWidthQueryForSize(
|
|
450
446
|
"small",
|
|
451
|
-
|
|
447
|
+
a
|
|
452
448
|
)
|
|
453
449
|
}) : "";
|
|
454
|
-
return [g,
|
|
450
|
+
return [g, S, f].join(" ");
|
|
455
451
|
}
|
|
456
452
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
457
453
|
}
|
|
@@ -473,18 +469,18 @@ function getBlockActions(e) {
|
|
|
473
469
|
for (const o in n) {
|
|
474
470
|
if (!n.hasOwnProperty(o))
|
|
475
471
|
continue;
|
|
476
|
-
const
|
|
477
|
-
let
|
|
472
|
+
const r = n[o];
|
|
473
|
+
let a = getEventHandlerName(o);
|
|
478
474
|
if (e.stripPrefix)
|
|
479
475
|
switch (TARGET) {
|
|
480
476
|
case "vue":
|
|
481
|
-
|
|
477
|
+
a = a.replace("v-on:", "");
|
|
482
478
|
break;
|
|
483
479
|
case "svelte":
|
|
484
|
-
|
|
480
|
+
a = a.replace("on:", "");
|
|
485
481
|
break;
|
|
486
482
|
}
|
|
487
|
-
t[
|
|
483
|
+
t[a] = createEventHandler(r, e);
|
|
488
484
|
}
|
|
489
485
|
return t;
|
|
490
486
|
}
|
|
@@ -527,49 +523,30 @@ function getStyleAttribute(e) {
|
|
|
527
523
|
return e;
|
|
528
524
|
}
|
|
529
525
|
}
|
|
526
|
+
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());
|
|
527
|
+
function DynamicRenderer(e) {
|
|
528
|
+
return /* @__PURE__ */ jsx(Fragment, { children: isEmptyElement(e.TagName) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ jsx(Fragment, { children: typeof e.TagName == "string" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) }) });
|
|
529
|
+
}
|
|
530
530
|
function BlockWrapper(e) {
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
e.Wrapper,
|
|
535
|
-
{
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
e.children,
|
|
551
|
-
" "
|
|
552
|
-
]
|
|
553
|
-
}
|
|
554
|
-
) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
555
|
-
e.Wrapper,
|
|
556
|
-
{
|
|
557
|
-
...getBlockProperties({
|
|
558
|
-
block: e.block,
|
|
559
|
-
context: e.context
|
|
560
|
-
}),
|
|
561
|
-
...getBlockActions({
|
|
562
|
-
block: e.block,
|
|
563
|
-
rootState: e.context.rootState,
|
|
564
|
-
rootSetState: e.context.rootSetState,
|
|
565
|
-
localState: e.context.localState,
|
|
566
|
-
context: e.context.context,
|
|
567
|
-
stripPrefix: !0
|
|
568
|
-
})
|
|
569
|
-
}
|
|
570
|
-
) }),
|
|
571
|
-
" "
|
|
572
|
-
] });
|
|
531
|
+
return /* @__PURE__ */ jsx(
|
|
532
|
+
DynamicRenderer,
|
|
533
|
+
{
|
|
534
|
+
TagName: e.Wrapper,
|
|
535
|
+
attributes: getBlockProperties({
|
|
536
|
+
block: e.block,
|
|
537
|
+
context: e.context
|
|
538
|
+
}),
|
|
539
|
+
actionAttributes: getBlockActions({
|
|
540
|
+
block: e.block,
|
|
541
|
+
rootState: e.context.rootState,
|
|
542
|
+
rootSetState: e.context.rootSetState,
|
|
543
|
+
localState: e.context.localState,
|
|
544
|
+
context: e.context.context,
|
|
545
|
+
stripPrefix: !0
|
|
546
|
+
}),
|
|
547
|
+
children: e.children
|
|
548
|
+
}
|
|
549
|
+
);
|
|
573
550
|
}
|
|
574
551
|
function InteractiveElement(e) {
|
|
575
552
|
return /* @__PURE__ */ jsx(
|
|
@@ -599,8 +576,8 @@ const getWrapperProps = ({
|
|
|
599
576
|
context: n,
|
|
600
577
|
componentRef: i,
|
|
601
578
|
includeBlockProps: o,
|
|
602
|
-
isInteractive:
|
|
603
|
-
contextValue:
|
|
579
|
+
isInteractive: r,
|
|
580
|
+
contextValue: a
|
|
604
581
|
}) => {
|
|
605
582
|
const c = {
|
|
606
583
|
...e,
|
|
@@ -611,11 +588,11 @@ const getWrapperProps = ({
|
|
|
611
588
|
...o ? {
|
|
612
589
|
attributes: getBlockProperties({
|
|
613
590
|
block: t,
|
|
614
|
-
context:
|
|
591
|
+
context: a
|
|
615
592
|
})
|
|
616
593
|
} : {}
|
|
617
594
|
};
|
|
618
|
-
return
|
|
595
|
+
return r ? {
|
|
619
596
|
Wrapper: i,
|
|
620
597
|
block: t,
|
|
621
598
|
context: n,
|
|
@@ -664,7 +641,7 @@ function RepeatedBlock(e) {
|
|
|
664
641
|
) });
|
|
665
642
|
}
|
|
666
643
|
function Block(e) {
|
|
667
|
-
var d, g,
|
|
644
|
+
var d, g, S;
|
|
668
645
|
function t() {
|
|
669
646
|
return getComponent({
|
|
670
647
|
block: e.block,
|
|
@@ -692,22 +669,22 @@ function Block(e) {
|
|
|
692
669
|
function o() {
|
|
693
670
|
return e.block.tagName || "div";
|
|
694
671
|
}
|
|
695
|
-
function
|
|
672
|
+
function r() {
|
|
696
673
|
var y, I;
|
|
697
674
|
if ((y = e.block.repeat) != null && y.collection)
|
|
698
675
|
return !!((I = n == null ? void 0 : n()) != null && I.length);
|
|
699
676
|
const f = "hide" in i() ? i().hide : !1;
|
|
700
677
|
return ("show" in i() ? i().show : !0) && !f;
|
|
701
678
|
}
|
|
702
|
-
function
|
|
703
|
-
var
|
|
704
|
-
return !((
|
|
679
|
+
function a() {
|
|
680
|
+
var b, y;
|
|
681
|
+
return !((b = t == null ? void 0 : t()) != null && b.component) && !n() ? (y = i().children) != null ? y : [] : [];
|
|
705
682
|
}
|
|
706
683
|
function c() {
|
|
707
|
-
var f,
|
|
684
|
+
var f, b, y, I, E, v;
|
|
708
685
|
return {
|
|
709
686
|
blockChildren: (f = i().children) != null ? f : [],
|
|
710
|
-
componentRef: (
|
|
687
|
+
componentRef: (b = t == null ? void 0 : t()) == null ? void 0 : b.component,
|
|
711
688
|
componentOptions: {
|
|
712
689
|
...getBlockComponentOptions(i()),
|
|
713
690
|
builderContext: e.context,
|
|
@@ -715,15 +692,15 @@ function Block(e) {
|
|
|
715
692
|
builderComponents: e.registeredComponents
|
|
716
693
|
} : {}
|
|
717
694
|
},
|
|
718
|
-
context:
|
|
695
|
+
context: s,
|
|
719
696
|
registeredComponents: e.registeredComponents,
|
|
720
697
|
builderBlock: i(),
|
|
721
698
|
includeBlockProps: ((E = t == null ? void 0 : t()) == null ? void 0 : E.noWrap) === !0,
|
|
722
699
|
isInteractive: !((v = t == null ? void 0 : t()) != null && v.isRSC)
|
|
723
700
|
};
|
|
724
701
|
}
|
|
725
|
-
const [
|
|
726
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
702
|
+
const [s, l] = useState(() => e.context);
|
|
703
|
+
return /* @__PURE__ */ jsx(Fragment, { children: r() ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
727
704
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
728
705
|
(d = t == null ? void 0 : t()) != null && d.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
729
706
|
ComponentRef,
|
|
@@ -737,59 +714,46 @@ function Block(e) {
|
|
|
737
714
|
includeBlockProps: c().includeBlockProps,
|
|
738
715
|
isInteractive: c().isInteractive
|
|
739
716
|
}
|
|
740
|
-
) }) : /* @__PURE__ */
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
(x = r()) == null ? void 0 : x.map((f) => /* @__PURE__ */ jsx(
|
|
781
|
-
Block,
|
|
782
|
-
{
|
|
783
|
-
block: f,
|
|
784
|
-
context: l,
|
|
785
|
-
registeredComponents: e.registeredComponents
|
|
786
|
-
},
|
|
787
|
-
f.id
|
|
788
|
-
))
|
|
789
|
-
]
|
|
790
|
-
}
|
|
791
|
-
) }) : null
|
|
792
|
-
] })
|
|
717
|
+
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (S = n()) == null ? void 0 : S.map((f, b) => /* @__PURE__ */ jsx(
|
|
718
|
+
RepeatedBlock,
|
|
719
|
+
{
|
|
720
|
+
repeatContext: f.context,
|
|
721
|
+
block: f.block,
|
|
722
|
+
registeredComponents: e.registeredComponents
|
|
723
|
+
},
|
|
724
|
+
b
|
|
725
|
+
)) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
726
|
+
BlockWrapper,
|
|
727
|
+
{
|
|
728
|
+
Wrapper: o(),
|
|
729
|
+
block: i(),
|
|
730
|
+
context: e.context,
|
|
731
|
+
children: [
|
|
732
|
+
/* @__PURE__ */ jsx(
|
|
733
|
+
ComponentRef,
|
|
734
|
+
{
|
|
735
|
+
componentRef: c().componentRef,
|
|
736
|
+
componentOptions: c().componentOptions,
|
|
737
|
+
blockChildren: c().blockChildren,
|
|
738
|
+
context: c().context,
|
|
739
|
+
registeredComponents: c().registeredComponents,
|
|
740
|
+
builderBlock: c().builderBlock,
|
|
741
|
+
includeBlockProps: c().includeBlockProps,
|
|
742
|
+
isInteractive: c().isInteractive
|
|
743
|
+
}
|
|
744
|
+
),
|
|
745
|
+
(g = a()) == null ? void 0 : g.map((f) => /* @__PURE__ */ jsx(
|
|
746
|
+
Block,
|
|
747
|
+
{
|
|
748
|
+
block: f,
|
|
749
|
+
context: s,
|
|
750
|
+
registeredComponents: e.registeredComponents
|
|
751
|
+
},
|
|
752
|
+
f.id
|
|
753
|
+
))
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
) }) })
|
|
793
757
|
] }) : null });
|
|
794
758
|
}
|
|
795
759
|
function BlocksWrapper(e) {
|
|
@@ -798,8 +762,8 @@ function BlocksWrapper(e) {
|
|
|
798
762
|
return "builder-blocks" + ((o = e.blocks) != null && o.length ? "" : " no-blocks");
|
|
799
763
|
}
|
|
800
764
|
function n() {
|
|
801
|
-
var o,
|
|
802
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
765
|
+
var o, r;
|
|
766
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((r = window.parent) == null || r.postMessage(
|
|
803
767
|
{
|
|
804
768
|
type: "builder.clickEmptyBlocks",
|
|
805
769
|
data: {
|
|
@@ -811,8 +775,8 @@ function BlocksWrapper(e) {
|
|
|
811
775
|
));
|
|
812
776
|
}
|
|
813
777
|
function i() {
|
|
814
|
-
var o,
|
|
815
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
778
|
+
var o, r;
|
|
779
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((r = window.parent) == null || r.postMessage(
|
|
816
780
|
{
|
|
817
781
|
type: "builder.hoverEmptyBlocks",
|
|
818
782
|
data: {
|
|
@@ -846,7 +810,7 @@ function BlocksWrapper(e) {
|
|
|
846
810
|
] });
|
|
847
811
|
}
|
|
848
812
|
function Blocks(e) {
|
|
849
|
-
var i, o,
|
|
813
|
+
var i, o, r;
|
|
850
814
|
const t = useContext(builderContext), n = useContext(ComponentsContext);
|
|
851
815
|
return /* @__PURE__ */ jsx(
|
|
852
816
|
BlocksWrapper,
|
|
@@ -857,14 +821,14 @@ function Blocks(e) {
|
|
|
857
821
|
styleProp: e.styleProp,
|
|
858
822
|
BlocksWrapper: (i = e.context) == null ? void 0 : i.BlocksWrapper,
|
|
859
823
|
BlocksWrapperProps: (o = e.context) == null ? void 0 : o.BlocksWrapperProps,
|
|
860
|
-
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
824
|
+
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (r = e.blocks) == null ? void 0 : r.map((a) => /* @__PURE__ */ jsx(
|
|
861
825
|
Block,
|
|
862
826
|
{
|
|
863
|
-
block:
|
|
827
|
+
block: a,
|
|
864
828
|
context: e.context || t,
|
|
865
829
|
registeredComponents: e.registeredComponents || n.registeredComponents
|
|
866
830
|
},
|
|
867
|
-
|
|
831
|
+
a.id
|
|
868
832
|
)) }) : null
|
|
869
833
|
}
|
|
870
834
|
);
|
|
@@ -873,68 +837,68 @@ function Columns(e) {
|
|
|
873
837
|
var E;
|
|
874
838
|
const [t, n] = useState(
|
|
875
839
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
876
|
-
), [i, o] = useState(() => e.columns || []), [
|
|
840
|
+
), [i, o] = useState(() => e.columns || []), [r, a] = useState(
|
|
877
841
|
() => e.stackColumnsAt || "tablet"
|
|
878
842
|
);
|
|
879
843
|
function c(v) {
|
|
880
844
|
var C;
|
|
881
845
|
return ((C = i[v]) == null ? void 0 : C.width) || 100 / i.length;
|
|
882
846
|
}
|
|
883
|
-
function
|
|
847
|
+
function s(v) {
|
|
884
848
|
const C = t * (i.length - 1) / i.length;
|
|
885
849
|
return `calc(${c(v)}% - ${C}px)`;
|
|
886
850
|
}
|
|
887
|
-
function
|
|
851
|
+
function l({
|
|
888
852
|
stackedStyle: v,
|
|
889
853
|
desktopStyle: C
|
|
890
854
|
}) {
|
|
891
|
-
return
|
|
855
|
+
return r === "tablet" ? v : C;
|
|
892
856
|
}
|
|
893
857
|
function d({
|
|
894
858
|
stackedStyle: v,
|
|
895
859
|
desktopStyle: C
|
|
896
860
|
}) {
|
|
897
|
-
return
|
|
861
|
+
return r === "never" ? C : v;
|
|
898
862
|
}
|
|
899
|
-
const [g,
|
|
863
|
+
const [g, S] = useState(
|
|
900
864
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
901
865
|
);
|
|
902
866
|
function f() {
|
|
903
867
|
return {
|
|
904
868
|
"--flex-dir": g,
|
|
905
|
-
"--flex-dir-tablet":
|
|
869
|
+
"--flex-dir-tablet": l({
|
|
906
870
|
stackedStyle: g,
|
|
907
871
|
desktopStyle: "row"
|
|
908
872
|
})
|
|
909
873
|
};
|
|
910
874
|
}
|
|
911
|
-
function
|
|
912
|
-
const C = v === 0 ? 0 : t,
|
|
875
|
+
function b(v) {
|
|
876
|
+
const C = v === 0 ? 0 : t, T = s(v), w = `${C}px`, R = "100%", j = 0;
|
|
913
877
|
return {
|
|
914
|
-
width:
|
|
915
|
-
["marginLeft"]:
|
|
878
|
+
width: T,
|
|
879
|
+
["marginLeft"]: w,
|
|
916
880
|
"--column-width-mobile": d({
|
|
917
881
|
stackedStyle: R,
|
|
918
|
-
desktopStyle:
|
|
882
|
+
desktopStyle: T
|
|
919
883
|
}),
|
|
920
884
|
"--column-margin-left-mobile": d({
|
|
921
885
|
stackedStyle: j,
|
|
922
|
-
desktopStyle:
|
|
886
|
+
desktopStyle: w
|
|
923
887
|
}),
|
|
924
|
-
"--column-width-tablet":
|
|
888
|
+
"--column-width-tablet": l({
|
|
925
889
|
stackedStyle: R,
|
|
926
|
-
desktopStyle:
|
|
890
|
+
desktopStyle: T
|
|
927
891
|
}),
|
|
928
|
-
"--column-margin-left-tablet":
|
|
892
|
+
"--column-margin-left-tablet": l({
|
|
929
893
|
stackedStyle: j,
|
|
930
|
-
desktopStyle:
|
|
894
|
+
desktopStyle: w
|
|
931
895
|
})
|
|
932
896
|
};
|
|
933
897
|
}
|
|
934
898
|
function y(v) {
|
|
935
|
-
var
|
|
899
|
+
var T, w;
|
|
936
900
|
return getSizesForBreakpoints(
|
|
937
|
-
((
|
|
901
|
+
((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
|
|
938
902
|
)[v].max;
|
|
939
903
|
}
|
|
940
904
|
function I() {
|
|
@@ -976,7 +940,7 @@ function Columns(e) {
|
|
|
976
940
|
"div",
|
|
977
941
|
{
|
|
978
942
|
className: "builder-column div-3c01d6ec-2",
|
|
979
|
-
style:
|
|
943
|
+
style: b(C),
|
|
980
944
|
key: C
|
|
981
945
|
},
|
|
982
946
|
/* @__PURE__ */ jsx(
|
|
@@ -1023,8 +987,8 @@ function getShopifyImageUrl(e, t) {
|
|
|
1023
987
|
return removeProtocol(e);
|
|
1024
988
|
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
1025
989
|
if (n) {
|
|
1026
|
-
const i = e.split(n[0]), o = n[3],
|
|
1027
|
-
return removeProtocol(`${i[0]}_${
|
|
990
|
+
const i = e.split(n[0]), o = n[3], r = t.match("x") ? t : `${t}x`;
|
|
991
|
+
return removeProtocol(`${i[0]}_${r}${o}`);
|
|
1028
992
|
}
|
|
1029
993
|
return null;
|
|
1030
994
|
}
|
|
@@ -1040,34 +1004,34 @@ function getSrcSet(e) {
|
|
|
1040
1004
|
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, i]) => `${n} ${i}w`).concat([e]).join(", ") : e;
|
|
1041
1005
|
}
|
|
1042
1006
|
function Image(e) {
|
|
1043
|
-
var o,
|
|
1007
|
+
var o, r, a, c;
|
|
1044
1008
|
function t() {
|
|
1045
1009
|
var d;
|
|
1046
|
-
const
|
|
1047
|
-
if (!
|
|
1010
|
+
const l = e.image || e.src;
|
|
1011
|
+
if (!l || // We can auto add srcset for cdn.builder.io and shopify
|
|
1048
1012
|
// images, otherwise you can supply this prop manually
|
|
1049
|
-
!(
|
|
1013
|
+
!(l.match(/builder\.io/) || l.match(/cdn\.shopify\.com/)))
|
|
1050
1014
|
return e.srcset;
|
|
1051
1015
|
if (e.srcset && ((d = e.image) != null && d.includes("builder.io/api/v1/image"))) {
|
|
1052
1016
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1053
|
-
return console.debug("Removed given srcset"), getSrcSet(
|
|
1017
|
+
return console.debug("Removed given srcset"), getSrcSet(l);
|
|
1054
1018
|
} else if (e.image && !e.srcset)
|
|
1055
|
-
return getSrcSet(
|
|
1056
|
-
return getSrcSet(
|
|
1019
|
+
return getSrcSet(l);
|
|
1020
|
+
return getSrcSet(l);
|
|
1057
1021
|
}
|
|
1058
1022
|
function n() {
|
|
1059
|
-
var
|
|
1060
|
-
return (
|
|
1023
|
+
var s;
|
|
1024
|
+
return (s = t == null ? void 0 : t()) != null && s.match(/builder\.io/) && !e.noWebp ? t().replace(/\?/g, "?format=webp&") : "";
|
|
1061
1025
|
}
|
|
1062
1026
|
function i() {
|
|
1063
|
-
const
|
|
1027
|
+
const s = {
|
|
1064
1028
|
position: "absolute",
|
|
1065
1029
|
height: "100%",
|
|
1066
1030
|
width: "100%",
|
|
1067
1031
|
left: "0px",
|
|
1068
1032
|
top: "0px"
|
|
1069
1033
|
};
|
|
1070
|
-
return e.aspectRatio ?
|
|
1034
|
+
return e.aspectRatio ? s : void 0;
|
|
1071
1035
|
}
|
|
1072
1036
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1073
1037
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1091,7 +1055,7 @@ function Image(e) {
|
|
|
1091
1055
|
}
|
|
1092
1056
|
)
|
|
1093
1057
|
] }),
|
|
1094
|
-
e.aspectRatio && !((
|
|
1058
|
+
e.aspectRatio && !((r = (o = e.builderBlock) == null ? void 0 : o.children) != null && r.length && e.fitContent) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1095
1059
|
"div",
|
|
1096
1060
|
{
|
|
1097
1061
|
className: "builder-image-sizer div-40c70c9b",
|
|
@@ -1100,7 +1064,7 @@ function Image(e) {
|
|
|
1100
1064
|
}
|
|
1101
1065
|
}
|
|
1102
1066
|
) }) : null,
|
|
1103
|
-
(c = (
|
|
1067
|
+
(c = (a = e.builderBlock) == null ? void 0 : a.children) != null && c.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: e.children }) : null,
|
|
1104
1068
|
!e.fitContent && e.children ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
|
|
1105
1069
|
] }),
|
|
1106
1070
|
/* @__PURE__ */ jsx("style", { children: `.img-40c70c9b {
|
|
@@ -1355,7 +1319,7 @@ const componentInfo$b = {
|
|
|
1355
1319
|
});
|
|
1356
1320
|
}
|
|
1357
1321
|
const n = e.get("columns");
|
|
1358
|
-
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((
|
|
1322
|
+
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((r) => !r.get("width")) || n.reduce((c, s) => c + s.get("width"), 0) !== 100) && t();
|
|
1359
1323
|
}
|
|
1360
1324
|
}, {
|
|
1361
1325
|
name: "space",
|
|
@@ -1401,29 +1365,29 @@ const componentInfo$b = {
|
|
|
1401
1365
|
}]
|
|
1402
1366
|
};
|
|
1403
1367
|
function CustomCode(e) {
|
|
1404
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1368
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, r] = useState(() => []);
|
|
1405
1369
|
return useEffect(() => {
|
|
1406
1370
|
var c;
|
|
1407
1371
|
if (!((c = t.current) != null && c.getElementsByTagName) || typeof window == "undefined")
|
|
1408
1372
|
return;
|
|
1409
|
-
const
|
|
1410
|
-
for (let
|
|
1411
|
-
const
|
|
1412
|
-
if (
|
|
1413
|
-
if (n.includes(
|
|
1373
|
+
const a = t.current.getElementsByTagName("script");
|
|
1374
|
+
for (let s = 0; s < a.length; s++) {
|
|
1375
|
+
const l = a[s];
|
|
1376
|
+
if (l.src) {
|
|
1377
|
+
if (n.includes(l.src))
|
|
1414
1378
|
continue;
|
|
1415
|
-
n.push(
|
|
1379
|
+
n.push(l.src);
|
|
1416
1380
|
const d = document.createElement("script");
|
|
1417
|
-
d.async = !0, d.src =
|
|
1418
|
-
} else if (!
|
|
1381
|
+
d.async = !0, d.src = l.src, document.head.appendChild(d);
|
|
1382
|
+
} else if (!l.type || [
|
|
1419
1383
|
"text/javascript",
|
|
1420
1384
|
"application/javascript",
|
|
1421
1385
|
"application/ecmascript"
|
|
1422
|
-
].includes(
|
|
1423
|
-
if (o.includes(
|
|
1386
|
+
].includes(l.type)) {
|
|
1387
|
+
if (o.includes(l.innerText))
|
|
1424
1388
|
continue;
|
|
1425
1389
|
try {
|
|
1426
|
-
o.push(
|
|
1390
|
+
o.push(l.innerText), new Function(l.innerText)();
|
|
1427
1391
|
} catch (d) {
|
|
1428
1392
|
console.warn("`CustomCode`: Error running script:", d);
|
|
1429
1393
|
}
|
|
@@ -1465,28 +1429,28 @@ const componentInfo$8 = {
|
|
|
1465
1429
|
}]
|
|
1466
1430
|
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1467
1431
|
function Embed(e) {
|
|
1468
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1469
|
-
function
|
|
1432
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, r] = useState(() => []), [a, c] = useState(() => !1);
|
|
1433
|
+
function s() {
|
|
1470
1434
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1471
1435
|
return;
|
|
1472
|
-
const
|
|
1473
|
-
for (let d = 0; d <
|
|
1474
|
-
const g =
|
|
1436
|
+
const l = t.current.getElementsByTagName("script");
|
|
1437
|
+
for (let d = 0; d < l.length; d++) {
|
|
1438
|
+
const g = l[d];
|
|
1475
1439
|
if (g.src && !n.includes(g.src)) {
|
|
1476
1440
|
n.push(g.src);
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1441
|
+
const S = document.createElement("script");
|
|
1442
|
+
S.async = !0, S.src = g.src, document.head.appendChild(S);
|
|
1479
1443
|
} else if (isJsScript(g) && !o.includes(g.innerText))
|
|
1480
1444
|
try {
|
|
1481
1445
|
o.push(g.innerText), new Function(g.innerText)();
|
|
1482
|
-
} catch (
|
|
1483
|
-
console.warn("`Embed`: Error running script:",
|
|
1446
|
+
} catch (S) {
|
|
1447
|
+
console.warn("`Embed`: Error running script:", S);
|
|
1484
1448
|
}
|
|
1485
1449
|
}
|
|
1486
1450
|
}
|
|
1487
1451
|
return useEffect(() => {
|
|
1488
|
-
t.current && !
|
|
1489
|
-
}, [t.current,
|
|
1452
|
+
t.current && !a && (c(!0), s());
|
|
1453
|
+
}, [t.current, a]), /* @__PURE__ */ jsx(
|
|
1490
1454
|
"div",
|
|
1491
1455
|
{
|
|
1492
1456
|
className: "builder-embed",
|
|
@@ -1521,29 +1485,29 @@ const componentInfo$7 = {
|
|
|
1521
1485
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
1522
1486
|
onChange: (e) => {
|
|
1523
1487
|
e.delete("srcset"), e.delete("noWebp");
|
|
1524
|
-
function n(
|
|
1525
|
-
return new Promise((
|
|
1488
|
+
function n(a, c = 6e4) {
|
|
1489
|
+
return new Promise((s, l) => {
|
|
1526
1490
|
const d = document.createElement("img");
|
|
1527
1491
|
let g = !1;
|
|
1528
1492
|
d.onload = () => {
|
|
1529
|
-
g = !0,
|
|
1530
|
-
}, d.addEventListener("error", (
|
|
1531
|
-
console.warn("Image load failed",
|
|
1532
|
-
}), d.src =
|
|
1533
|
-
g ||
|
|
1493
|
+
g = !0, s(d);
|
|
1494
|
+
}, d.addEventListener("error", (S) => {
|
|
1495
|
+
console.warn("Image load failed", S.error), l(S.error);
|
|
1496
|
+
}), d.src = a, setTimeout(() => {
|
|
1497
|
+
g || l(new Error("Image load timed out"));
|
|
1534
1498
|
}, c);
|
|
1535
1499
|
});
|
|
1536
1500
|
}
|
|
1537
|
-
function i(
|
|
1538
|
-
return Math.round(
|
|
1501
|
+
function i(a) {
|
|
1502
|
+
return Math.round(a * 1e3) / 1e3;
|
|
1539
1503
|
}
|
|
1540
|
-
const o = e.get("image"),
|
|
1541
|
-
if (fetch(o).then((
|
|
1542
|
-
|
|
1543
|
-
}), o && (!
|
|
1544
|
-
return n(o).then((
|
|
1504
|
+
const o = e.get("image"), r = e.get("aspectRatio");
|
|
1505
|
+
if (fetch(o).then((a) => a.blob()).then((a) => {
|
|
1506
|
+
a.type.includes("svg") && e.set("noWebp", !0);
|
|
1507
|
+
}), o && (!r || r === 0.7041))
|
|
1508
|
+
return n(o).then((a) => {
|
|
1545
1509
|
const c = e.get("aspectRatio");
|
|
1546
|
-
e.get("image") === o && (!c || c === 0.7041) &&
|
|
1510
|
+
e.get("image") === o && (!c || c === 0.7041) && a.width && a.height && (e.set("aspectRatio", i(a.height / a.width)), e.set("height", a.height), e.set("width", a.width));
|
|
1547
1511
|
});
|
|
1548
1512
|
}
|
|
1549
1513
|
}, {
|
|
@@ -1855,7 +1819,7 @@ const componentInfo = {
|
|
|
1855
1819
|
}]
|
|
1856
1820
|
};
|
|
1857
1821
|
function Video(e) {
|
|
1858
|
-
var i, o,
|
|
1822
|
+
var i, o, r, a, c, s, l;
|
|
1859
1823
|
function t() {
|
|
1860
1824
|
return {
|
|
1861
1825
|
...e.autoPlay === !0 ? {
|
|
@@ -1912,7 +1876,7 @@ function Video(e) {
|
|
|
1912
1876
|
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
1913
1877
|
}
|
|
1914
1878
|
),
|
|
1915
|
-
e.aspectRatio && !(e.fitContent && ((
|
|
1879
|
+
e.aspectRatio && !(e.fitContent && ((r = (o = e.builderBlock) == null ? void 0 : o.children) != null && r.length)) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1916
1880
|
"div",
|
|
1917
1881
|
{
|
|
1918
1882
|
style: {
|
|
@@ -1923,7 +1887,7 @@ function Video(e) {
|
|
|
1923
1887
|
}
|
|
1924
1888
|
}
|
|
1925
1889
|
) }) : null,
|
|
1926
|
-
(c = (
|
|
1890
|
+
(c = (a = e.builderBlock) == null ? void 0 : a.children) != null && c.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1927
1891
|
"div",
|
|
1928
1892
|
{
|
|
1929
1893
|
style: {
|
|
@@ -1934,7 +1898,7 @@ function Video(e) {
|
|
|
1934
1898
|
children: e.children
|
|
1935
1899
|
}
|
|
1936
1900
|
) }) : null,
|
|
1937
|
-
(
|
|
1901
|
+
(l = (s = e.builderBlock) == null ? void 0 : s.children) != null && l.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1938
1902
|
"div",
|
|
1939
1903
|
{
|
|
1940
1904
|
style: {
|
|
@@ -2109,6 +2073,11 @@ function InlinedScript(e) {
|
|
|
2109
2073
|
}
|
|
2110
2074
|
);
|
|
2111
2075
|
}
|
|
2076
|
+
const DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
2077
|
+
function isFromTrustedHost(e, t) {
|
|
2078
|
+
const n = new URL(t.origin), i = n.hostname;
|
|
2079
|
+
return (e || DEFAULT_TRUSTED_HOSTS).findIndex((o) => o.startsWith("*.") ? i.endsWith(o.slice(1)) : o === i) > -1;
|
|
2080
|
+
}
|
|
2112
2081
|
function round(e) {
|
|
2113
2082
|
return Math.round(e * 1e3) / 1e3;
|
|
2114
2083
|
}
|
|
@@ -2130,10 +2099,10 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2130
2099
|
event: e,
|
|
2131
2100
|
target: t
|
|
2132
2101
|
}) => {
|
|
2133
|
-
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top,
|
|
2102
|
+
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top, r = round(i / n.width), a = round(o / n.height);
|
|
2134
2103
|
return {
|
|
2135
|
-
x:
|
|
2136
|
-
y:
|
|
2104
|
+
x: r,
|
|
2105
|
+
y: a
|
|
2137
2106
|
};
|
|
2138
2107
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
2139
2108
|
const t = e.target, n = t && findBuilderParent(t), i = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
|
|
@@ -2151,7 +2120,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2151
2120
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2152
2121
|
}
|
|
2153
2122
|
};
|
|
2154
|
-
}, SDK_VERSION = "0.12.
|
|
2123
|
+
}, SDK_VERSION = "0.12.3", registerInsertMenu = () => {
|
|
2155
2124
|
register("insertMenu", {
|
|
2156
2125
|
name: "_default",
|
|
2157
2126
|
default: !0,
|
|
@@ -2193,39 +2162,42 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2193
2162
|
data: {
|
|
2194
2163
|
options: e
|
|
2195
2164
|
}
|
|
2196
|
-
}, "*"), window.addEventListener("message", ({
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2165
|
+
}, "*"), window.addEventListener("message", (i) => {
|
|
2166
|
+
var r, a;
|
|
2167
|
+
if (!isFromTrustedHost(e.trustedHosts, i))
|
|
2168
|
+
return;
|
|
2169
|
+
const {
|
|
2170
|
+
data: o
|
|
2171
|
+
} = i;
|
|
2172
|
+
if (o != null && o.type)
|
|
2173
|
+
switch (o.type) {
|
|
2202
2174
|
case "builder.evaluate": {
|
|
2203
|
-
const
|
|
2204
|
-
let
|
|
2175
|
+
const c = o.data.text, s = o.data.arguments || [], l = o.data.id, d = new Function(c);
|
|
2176
|
+
let g, S = null;
|
|
2205
2177
|
try {
|
|
2206
|
-
|
|
2207
|
-
} catch (
|
|
2208
|
-
|
|
2178
|
+
g = d.apply(null, s);
|
|
2179
|
+
} catch (f) {
|
|
2180
|
+
S = f;
|
|
2209
2181
|
}
|
|
2210
|
-
|
|
2182
|
+
S ? (r = window.parent) == null || r.postMessage({
|
|
2211
2183
|
type: "builder.evaluateError",
|
|
2212
2184
|
data: {
|
|
2213
2185
|
id: l,
|
|
2214
|
-
error:
|
|
2186
|
+
error: S.message
|
|
2215
2187
|
}
|
|
2216
|
-
}, "*") :
|
|
2217
|
-
var
|
|
2218
|
-
(
|
|
2188
|
+
}, "*") : g && typeof g.then == "function" ? g.then((f) => {
|
|
2189
|
+
var b;
|
|
2190
|
+
(b = window.parent) == null || b.postMessage({
|
|
2219
2191
|
type: "builder.evaluateResult",
|
|
2220
2192
|
data: {
|
|
2221
2193
|
id: l,
|
|
2222
|
-
result:
|
|
2194
|
+
result: f
|
|
2223
2195
|
}
|
|
2224
2196
|
}, "*");
|
|
2225
2197
|
}).catch(console.error) : (a = window.parent) == null || a.postMessage({
|
|
2226
2198
|
type: "builder.evaluateResult",
|
|
2227
2199
|
data: {
|
|
2228
|
-
result:
|
|
2200
|
+
result: g,
|
|
2229
2201
|
id: l
|
|
2230
2202
|
}
|
|
2231
2203
|
}, "*");
|
|
@@ -2235,22 +2207,22 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2235
2207
|
})));
|
|
2236
2208
|
};
|
|
2237
2209
|
function EnableEditor(e) {
|
|
2238
|
-
var j, P, A, F,
|
|
2210
|
+
var j, P, A, F, _, V, $;
|
|
2239
2211
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2240
2212
|
useState(() => !0);
|
|
2241
2213
|
function o(u) {
|
|
2242
|
-
var h,
|
|
2214
|
+
var h, x;
|
|
2243
2215
|
const m = {
|
|
2244
2216
|
...e.builderContextSignal.rootState,
|
|
2245
2217
|
...u
|
|
2246
2218
|
};
|
|
2247
|
-
e.builderContextSignal.rootSetState ? (
|
|
2219
|
+
e.builderContextSignal.rootSetState ? (x = (h = e.builderContextSignal).rootSetState) == null || x.call(h, m) : e.setBuilderContextSignal((p) => ({
|
|
2248
2220
|
...p,
|
|
2249
2221
|
rootState: m
|
|
2250
2222
|
}));
|
|
2251
2223
|
}
|
|
2252
|
-
function
|
|
2253
|
-
var h,
|
|
2224
|
+
function r(u) {
|
|
2225
|
+
var h, x, p, k, B;
|
|
2254
2226
|
const m = {
|
|
2255
2227
|
...e.builderContextSignal.content,
|
|
2256
2228
|
...u,
|
|
@@ -2259,32 +2231,34 @@ function EnableEditor(e) {
|
|
|
2259
2231
|
...u == null ? void 0 : u.data
|
|
2260
2232
|
},
|
|
2261
2233
|
meta: {
|
|
2262
|
-
...(
|
|
2234
|
+
...(x = e.builderContextSignal.content) == null ? void 0 : x.meta,
|
|
2263
2235
|
...u == null ? void 0 : u.meta,
|
|
2264
2236
|
breakpoints: ((p = u == null ? void 0 : u.meta) == null ? void 0 : p.breakpoints) || ((B = (k = e.builderContextSignal.content) == null ? void 0 : k.meta) == null ? void 0 : B.breakpoints)
|
|
2265
2237
|
}
|
|
2266
2238
|
};
|
|
2267
|
-
e.setBuilderContextSignal((
|
|
2268
|
-
...
|
|
2239
|
+
e.setBuilderContextSignal((N) => ({
|
|
2240
|
+
...N,
|
|
2269
2241
|
content: m
|
|
2270
2242
|
}));
|
|
2271
2243
|
}
|
|
2272
2244
|
useState(() => 0);
|
|
2273
|
-
const [
|
|
2245
|
+
const [a, c] = useState(
|
|
2274
2246
|
() => !1
|
|
2275
|
-
), [
|
|
2247
|
+
), [s, l] = useState(
|
|
2276
2248
|
() => e.contentWrapper || "div"
|
|
2277
2249
|
);
|
|
2278
2250
|
function d(u) {
|
|
2279
2251
|
var h;
|
|
2252
|
+
if (!isFromTrustedHost(e.trustedHosts, u))
|
|
2253
|
+
return;
|
|
2280
2254
|
const { data: m } = u;
|
|
2281
2255
|
if (m)
|
|
2282
2256
|
switch (m.type) {
|
|
2283
2257
|
case "builder.configureSdk": {
|
|
2284
|
-
const
|
|
2258
|
+
const x = m.data, { breakpoints: p, contentId: k } = x;
|
|
2285
2259
|
if (!k || k !== ((h = e.builderContextSignal.content) == null ? void 0 : h.id))
|
|
2286
2260
|
return;
|
|
2287
|
-
p &&
|
|
2261
|
+
p && r({
|
|
2288
2262
|
meta: {
|
|
2289
2263
|
breakpoints: p
|
|
2290
2264
|
}
|
|
@@ -2292,8 +2266,8 @@ function EnableEditor(e) {
|
|
|
2292
2266
|
break;
|
|
2293
2267
|
}
|
|
2294
2268
|
case "builder.contentUpdate": {
|
|
2295
|
-
const
|
|
2296
|
-
p === e.model && (
|
|
2269
|
+
const x = m.data, p = x.key || x.alias || x.entry || x.modelName, k = x.data;
|
|
2270
|
+
p === e.model && (r(k), i(n + 1));
|
|
2297
2271
|
break;
|
|
2298
2272
|
}
|
|
2299
2273
|
}
|
|
@@ -2309,22 +2283,22 @@ function EnableEditor(e) {
|
|
|
2309
2283
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2310
2284
|
});
|
|
2311
2285
|
}
|
|
2312
|
-
const [
|
|
2286
|
+
const [S, f] = useState(() => ({})), [b, y] = useState(() => !1);
|
|
2313
2287
|
function I(u) {
|
|
2314
2288
|
var m, h;
|
|
2315
2289
|
if (e.builderContextSignal.content) {
|
|
2316
|
-
const
|
|
2290
|
+
const x = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, p = (h = e.builderContextSignal.content) == null ? void 0 : h.id;
|
|
2317
2291
|
_track({
|
|
2318
2292
|
type: "click",
|
|
2319
2293
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2320
2294
|
contentId: p,
|
|
2321
2295
|
apiKey: e.apiKey,
|
|
2322
|
-
variationId:
|
|
2296
|
+
variationId: x !== p ? x : void 0,
|
|
2323
2297
|
...getInteractionPropertiesForEvent(u),
|
|
2324
|
-
unique: !
|
|
2298
|
+
unique: !b
|
|
2325
2299
|
});
|
|
2326
2300
|
}
|
|
2327
|
-
|
|
2301
|
+
b || y(!0);
|
|
2328
2302
|
}
|
|
2329
2303
|
function E(u) {
|
|
2330
2304
|
return u.replace(
|
|
@@ -2341,20 +2315,20 @@ function EnableEditor(e) {
|
|
|
2341
2315
|
function v({ url: u, key: m }) {
|
|
2342
2316
|
fetch$1(u).then((h) => h.json()).then((h) => {
|
|
2343
2317
|
var p, k;
|
|
2344
|
-
const
|
|
2318
|
+
const x = {
|
|
2345
2319
|
...e.builderContextSignal.rootState,
|
|
2346
2320
|
[m]: h
|
|
2347
2321
|
};
|
|
2348
|
-
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p,
|
|
2322
|
+
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, x), S[m] = !0;
|
|
2349
2323
|
}).catch((h) => {
|
|
2350
2324
|
console.error("error fetching dynamic data", u, h);
|
|
2351
2325
|
});
|
|
2352
2326
|
}
|
|
2353
2327
|
function C() {
|
|
2354
|
-
var m, h,
|
|
2355
|
-
const u = (
|
|
2328
|
+
var m, h, x;
|
|
2329
|
+
const u = (x = (h = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : h.httpRequests) != null ? x : {};
|
|
2356
2330
|
Object.entries(u).forEach(([p, k]) => {
|
|
2357
|
-
if (k && (!
|
|
2331
|
+
if (k && (!S[p] || isEditing())) {
|
|
2358
2332
|
const B = E(k);
|
|
2359
2333
|
v({
|
|
2360
2334
|
url: B,
|
|
@@ -2363,7 +2337,7 @@ function EnableEditor(e) {
|
|
|
2363
2337
|
}
|
|
2364
2338
|
});
|
|
2365
2339
|
}
|
|
2366
|
-
function
|
|
2340
|
+
function T() {
|
|
2367
2341
|
isEditing() && window.dispatchEvent(
|
|
2368
2342
|
new CustomEvent(
|
|
2369
2343
|
"builder:component:stateChange",
|
|
@@ -2378,7 +2352,7 @@ function EnableEditor(e) {
|
|
|
2378
2352
|
)
|
|
2379
2353
|
);
|
|
2380
2354
|
}
|
|
2381
|
-
function
|
|
2355
|
+
function w(u) {
|
|
2382
2356
|
i(n + 1), window.addEventListener("message", d), registerInsertMenu(), setupBrowserForEditing({
|
|
2383
2357
|
...e.locale ? {
|
|
2384
2358
|
locale: e.locale
|
|
@@ -2388,40 +2362,43 @@ function EnableEditor(e) {
|
|
|
2388
2362
|
} : {},
|
|
2389
2363
|
...e.enrich ? {
|
|
2390
2364
|
enrich: e.enrich
|
|
2365
|
+
} : {},
|
|
2366
|
+
...e.trustedHosts ? {
|
|
2367
|
+
trustedHosts: e.trustedHosts
|
|
2391
2368
|
} : {}
|
|
2392
2369
|
}), Object.values(
|
|
2393
2370
|
e.builderContextSignal.componentInfos
|
|
2394
2371
|
).forEach((m) => {
|
|
2395
|
-
var
|
|
2372
|
+
var x;
|
|
2396
2373
|
const h = createRegisterComponentMessage(m);
|
|
2397
|
-
(
|
|
2374
|
+
(x = window.parent) == null || x.postMessage(h, "*");
|
|
2398
2375
|
}), window.addEventListener(
|
|
2399
2376
|
"builder:component:stateChangeListenerActivated",
|
|
2400
|
-
|
|
2377
|
+
T
|
|
2401
2378
|
);
|
|
2402
2379
|
}
|
|
2403
2380
|
function R(u) {
|
|
2404
|
-
const m = new URL(location.href).searchParams, h = m.get("builder.preview"),
|
|
2381
|
+
const m = new URL(location.href).searchParams, h = m.get("builder.preview"), x = m.get(
|
|
2405
2382
|
`builder.preview.${h}`
|
|
2406
2383
|
), p = m.get("apiKey") || m.get("builder.space");
|
|
2407
|
-
h === e.model && p === e.apiKey && (!e.content ||
|
|
2384
|
+
h === e.model && p === e.apiKey && (!e.content || x === e.content.id) && fetchOneEntry({
|
|
2408
2385
|
model: e.model,
|
|
2409
2386
|
apiKey: e.apiKey,
|
|
2410
2387
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2411
2388
|
}).then((k) => {
|
|
2412
|
-
k &&
|
|
2389
|
+
k && r(k);
|
|
2413
2390
|
});
|
|
2414
2391
|
}
|
|
2415
2392
|
return useEffect(() => {
|
|
2416
2393
|
var u;
|
|
2417
2394
|
return (u = t.current) == null || u.addEventListener(
|
|
2418
2395
|
"initeditingbldr",
|
|
2419
|
-
|
|
2396
|
+
w
|
|
2420
2397
|
), () => {
|
|
2421
2398
|
var m;
|
|
2422
2399
|
return (m = t.current) == null ? void 0 : m.removeEventListener(
|
|
2423
2400
|
"initeditingbldr",
|
|
2424
|
-
|
|
2401
|
+
w
|
|
2425
2402
|
);
|
|
2426
2403
|
};
|
|
2427
2404
|
}, []), useEffect(() => {
|
|
@@ -2440,13 +2417,13 @@ function EnableEditor(e) {
|
|
|
2440
2417
|
var u, m;
|
|
2441
2418
|
if (isBrowser()) {
|
|
2442
2419
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2443
|
-
const
|
|
2420
|
+
const x = (u = e.builderContextSignal.content) == null ? void 0 : u.testVariationId, p = (m = e.builderContextSignal.content) == null ? void 0 : m.id, k = e.apiKey;
|
|
2444
2421
|
_track({
|
|
2445
2422
|
type: "impression",
|
|
2446
2423
|
canTrack: !0,
|
|
2447
2424
|
contentId: p,
|
|
2448
2425
|
apiKey: k,
|
|
2449
|
-
variationId:
|
|
2426
|
+
variationId: x !== p ? x : void 0
|
|
2450
2427
|
});
|
|
2451
2428
|
}
|
|
2452
2429
|
isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
@@ -2454,11 +2431,11 @@ function EnableEditor(e) {
|
|
|
2454
2431
|
}, []), useEffect(() => {
|
|
2455
2432
|
e.apiKey || logger.error(
|
|
2456
2433
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2457
|
-
), g(), C(),
|
|
2434
|
+
), g(), C(), T();
|
|
2458
2435
|
}, []), useEffect(() => {
|
|
2459
|
-
e.content &&
|
|
2436
|
+
e.content && r(e.content);
|
|
2460
2437
|
}, [e.content]), useEffect(() => {
|
|
2461
|
-
}, [
|
|
2438
|
+
}, [a]), useEffect(() => {
|
|
2462
2439
|
g();
|
|
2463
2440
|
}, [
|
|
2464
2441
|
(P = (j = e.builderContextSignal.content) == null ? void 0 : j.data) == null ? void 0 : P.jsCode,
|
|
@@ -2466,7 +2443,7 @@ function EnableEditor(e) {
|
|
|
2466
2443
|
]), useEffect(() => {
|
|
2467
2444
|
C();
|
|
2468
2445
|
}, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]), useEffect(() => {
|
|
2469
|
-
|
|
2446
|
+
T();
|
|
2470
2447
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
2471
2448
|
e.data && o(e.data);
|
|
2472
2449
|
}, [e.data]), useEffect(() => {
|
|
@@ -2476,29 +2453,29 @@ function EnableEditor(e) {
|
|
|
2476
2453
|
}, [e.locale]), useEffect(() => () => {
|
|
2477
2454
|
isBrowser() && (window.removeEventListener("message", d), window.removeEventListener(
|
|
2478
2455
|
"builder:component:stateChangeListenerActivated",
|
|
2479
|
-
|
|
2456
|
+
T
|
|
2480
2457
|
));
|
|
2481
2458
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2482
|
-
|
|
2459
|
+
s,
|
|
2483
2460
|
{
|
|
2484
2461
|
key: n,
|
|
2485
2462
|
ref: t,
|
|
2486
2463
|
onClick: (u) => I(u),
|
|
2487
|
-
"builder-content-id": (
|
|
2464
|
+
"builder-content-id": (_ = e.builderContextSignal.content) == null ? void 0 : _.id,
|
|
2488
2465
|
"builder-model": e.model,
|
|
2489
2466
|
...e.showContent ? {} : {
|
|
2490
2467
|
hidden: !0,
|
|
2491
2468
|
"aria-hidden": !0
|
|
2492
2469
|
},
|
|
2493
2470
|
...e.contentWrapperProps,
|
|
2494
|
-
className: `variant-${((
|
|
2471
|
+
className: `variant-${((V = e.content) == null ? void 0 : V.testVariationId) || (($ = e.content) == null ? void 0 : $.id)}`
|
|
2495
2472
|
},
|
|
2496
2473
|
e.children
|
|
2497
2474
|
) }) : null });
|
|
2498
2475
|
}
|
|
2499
2476
|
const getCssFromFont = (e) => {
|
|
2500
|
-
var
|
|
2501
|
-
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], i = (
|
|
2477
|
+
var r, a;
|
|
2478
|
+
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], i = (a = e.fileUrl) != null ? a : (r = e == null ? void 0 : e.files) == null ? void 0 : r.regular;
|
|
2502
2479
|
let o = "";
|
|
2503
2480
|
if (i && t && n && (o += `
|
|
2504
2481
|
@font-face {
|
|
@@ -2511,11 +2488,11 @@ font-weight: 400;
|
|
|
2511
2488
|
for (const c in e.files) {
|
|
2512
2489
|
if (!(String(Number(c)) === c))
|
|
2513
2490
|
continue;
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2491
|
+
const l = e.files[c];
|
|
2492
|
+
l && l !== i && (o += `
|
|
2516
2493
|
@font-face {
|
|
2517
2494
|
font-family: "${t}";
|
|
2518
|
-
src: url('${
|
|
2495
|
+
src: url('${l}') format('woff2');
|
|
2519
2496
|
font-display: fallback;
|
|
2520
2497
|
font-weight: ${c};
|
|
2521
2498
|
}
|
|
@@ -2542,6 +2519,10 @@ ${getFontCss({
|
|
|
2542
2519
|
customFonts: e.customFonts
|
|
2543
2520
|
})}
|
|
2544
2521
|
|
|
2522
|
+
.builder-button {
|
|
2523
|
+
all: unset;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2545
2526
|
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
2546
2527
|
margin: 0;
|
|
2547
2528
|
}
|
|
@@ -2563,10 +2544,10 @@ const getRootStateInitialValue = ({
|
|
|
2563
2544
|
data: t,
|
|
2564
2545
|
locale: n
|
|
2565
2546
|
}) => {
|
|
2566
|
-
var
|
|
2567
|
-
const i = {}, o = ((
|
|
2568
|
-
return (c = (
|
|
2569
|
-
|
|
2547
|
+
var r, a, c;
|
|
2548
|
+
const i = {}, o = ((r = e == null ? void 0 : e.data) == null ? void 0 : r.state) || {};
|
|
2549
|
+
return (c = (a = e == null ? void 0 : e.data) == null ? void 0 : a.inputs) == null || c.forEach((s) => {
|
|
2550
|
+
s.name && s.defaultValue !== void 0 && (i[s.name] = s.defaultValue);
|
|
2570
2551
|
}), {
|
|
2571
2552
|
...i,
|
|
2572
2553
|
...o,
|
|
@@ -2587,7 +2568,7 @@ const getRootStateInitialValue = ({
|
|
|
2587
2568
|
meta: e == null ? void 0 : e.meta
|
|
2588
2569
|
} : void 0;
|
|
2589
2570
|
function ContentComponent(e) {
|
|
2590
|
-
var
|
|
2571
|
+
var s, l, d, g, S, f, b;
|
|
2591
2572
|
const [t, n] = useState(
|
|
2592
2573
|
() => {
|
|
2593
2574
|
var y, I;
|
|
@@ -2605,7 +2586,7 @@ function ContentComponent(e) {
|
|
|
2605
2586
|
rootState: y
|
|
2606
2587
|
}));
|
|
2607
2588
|
}
|
|
2608
|
-
const [o,
|
|
2589
|
+
const [o, r] = useState(
|
|
2609
2590
|
() => [
|
|
2610
2591
|
...getDefaultRegisteredComponents(),
|
|
2611
2592
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2625,7 +2606,7 @@ function ContentComponent(e) {
|
|
|
2625
2606
|
}),
|
|
2626
2607
|
{}
|
|
2627
2608
|
)
|
|
2628
|
-
), [
|
|
2609
|
+
), [a, c] = useState(() => ({
|
|
2629
2610
|
content: getContentInitialValue({
|
|
2630
2611
|
content: e.content,
|
|
2631
2612
|
data: e.data
|
|
@@ -2679,25 +2660,26 @@ function ContentComponent(e) {
|
|
|
2679
2660
|
includeRefs: e.includeRefs,
|
|
2680
2661
|
enrich: e.enrich,
|
|
2681
2662
|
showContent: e.showContent,
|
|
2682
|
-
builderContextSignal:
|
|
2663
|
+
builderContextSignal: a,
|
|
2683
2664
|
contentWrapper: e.contentWrapper,
|
|
2684
2665
|
contentWrapperProps: e.contentWrapperProps,
|
|
2666
|
+
trustedHosts: e.trustedHosts,
|
|
2685
2667
|
setBuilderContextSignal: c,
|
|
2686
2668
|
children: [
|
|
2687
2669
|
e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
|
|
2688
2670
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2689
2671
|
ContentStyles,
|
|
2690
2672
|
{
|
|
2691
|
-
contentId: (
|
|
2692
|
-
cssCode: (d = (
|
|
2693
|
-
customFonts: (
|
|
2673
|
+
contentId: (s = a.content) == null ? void 0 : s.id,
|
|
2674
|
+
cssCode: (d = (l = a.content) == null ? void 0 : l.data) == null ? void 0 : d.cssCode,
|
|
2675
|
+
customFonts: (S = (g = a.content) == null ? void 0 : g.data) == null ? void 0 : S.customFonts
|
|
2694
2676
|
}
|
|
2695
2677
|
) }),
|
|
2696
2678
|
/* @__PURE__ */ jsx(
|
|
2697
2679
|
Blocks,
|
|
2698
2680
|
{
|
|
2699
|
-
blocks: (
|
|
2700
|
-
context:
|
|
2681
|
+
blocks: (b = (f = a.content) == null ? void 0 : f.data) == null ? void 0 : b.blocks,
|
|
2682
|
+
context: a,
|
|
2701
2683
|
registeredComponents: o
|
|
2702
2684
|
}
|
|
2703
2685
|
)
|
|
@@ -2708,7 +2690,7 @@ function ContentComponent(e) {
|
|
|
2708
2690
|
);
|
|
2709
2691
|
}
|
|
2710
2692
|
function ContentVariants(e) {
|
|
2711
|
-
var
|
|
2693
|
+
var a, c;
|
|
2712
2694
|
const [t, n] = useState(
|
|
2713
2695
|
() => checkShouldRenderVariants({
|
|
2714
2696
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
@@ -2716,23 +2698,23 @@ function ContentVariants(e) {
|
|
|
2716
2698
|
})
|
|
2717
2699
|
);
|
|
2718
2700
|
function i() {
|
|
2719
|
-
var
|
|
2701
|
+
var s;
|
|
2720
2702
|
return getUpdateCookieAndStylesScript(
|
|
2721
|
-
getVariants(e.content).map((
|
|
2722
|
-
id:
|
|
2723
|
-
testRatio:
|
|
2703
|
+
getVariants(e.content).map((l) => ({
|
|
2704
|
+
id: l.testVariationId,
|
|
2705
|
+
testRatio: l.testRatio
|
|
2724
2706
|
})),
|
|
2725
|
-
((
|
|
2707
|
+
((s = e.content) == null ? void 0 : s.id) || ""
|
|
2726
2708
|
);
|
|
2727
2709
|
}
|
|
2728
2710
|
function o() {
|
|
2729
|
-
return getVariants(e.content).map((
|
|
2711
|
+
return getVariants(e.content).map((s) => `.variant-${s.testVariationId} { display: none; } `).join("");
|
|
2730
2712
|
}
|
|
2731
|
-
function
|
|
2732
|
-
var
|
|
2713
|
+
function r() {
|
|
2714
|
+
var s;
|
|
2733
2715
|
return t ? {
|
|
2734
2716
|
...e.content,
|
|
2735
|
-
testVariationId: (
|
|
2717
|
+
testVariationId: (s = e.content) == null ? void 0 : s.id
|
|
2736
2718
|
} : handleABTestingSync({
|
|
2737
2719
|
item: e.content,
|
|
2738
2720
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
@@ -2745,15 +2727,15 @@ function ContentVariants(e) {
|
|
|
2745
2727
|
/* @__PURE__ */ jsx(
|
|
2746
2728
|
InlinedStyles,
|
|
2747
2729
|
{
|
|
2748
|
-
id: `variants-styles-${(
|
|
2730
|
+
id: `variants-styles-${(a = e.content) == null ? void 0 : a.id}`,
|
|
2749
2731
|
styles: o()
|
|
2750
2732
|
}
|
|
2751
2733
|
),
|
|
2752
2734
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2753
|
-
(c = getVariants(e.content)) == null ? void 0 : c.map((
|
|
2735
|
+
(c = getVariants(e.content)) == null ? void 0 : c.map((s) => /* @__PURE__ */ jsx(
|
|
2754
2736
|
ContentComponent,
|
|
2755
2737
|
{
|
|
2756
|
-
content:
|
|
2738
|
+
content: s,
|
|
2757
2739
|
showContent: !1,
|
|
2758
2740
|
model: e.model,
|
|
2759
2741
|
data: e.data,
|
|
@@ -2769,15 +2751,16 @@ function ContentVariants(e) {
|
|
|
2769
2751
|
blocksWrapper: e.blocksWrapper,
|
|
2770
2752
|
blocksWrapperProps: e.blocksWrapperProps,
|
|
2771
2753
|
contentWrapper: e.contentWrapper,
|
|
2772
|
-
contentWrapperProps: e.contentWrapperProps
|
|
2754
|
+
contentWrapperProps: e.contentWrapperProps,
|
|
2755
|
+
trustedHosts: e.trustedHosts
|
|
2773
2756
|
},
|
|
2774
|
-
|
|
2757
|
+
s.testVariationId
|
|
2775
2758
|
))
|
|
2776
2759
|
] }) : null,
|
|
2777
2760
|
/* @__PURE__ */ jsx(
|
|
2778
2761
|
ContentComponent,
|
|
2779
2762
|
{
|
|
2780
|
-
content:
|
|
2763
|
+
content: r(),
|
|
2781
2764
|
showContent: !0,
|
|
2782
2765
|
model: e.model,
|
|
2783
2766
|
data: e.data,
|
|
@@ -2793,7 +2776,8 @@ function ContentVariants(e) {
|
|
|
2793
2776
|
blocksWrapper: e.blocksWrapper,
|
|
2794
2777
|
blocksWrapperProps: e.blocksWrapperProps,
|
|
2795
2778
|
contentWrapper: e.contentWrapper,
|
|
2796
|
-
contentWrapperProps: e.contentWrapperProps
|
|
2779
|
+
contentWrapperProps: e.contentWrapperProps,
|
|
2780
|
+
trustedHosts: e.trustedHosts
|
|
2797
2781
|
}
|
|
2798
2782
|
)
|
|
2799
2783
|
] });
|
|
@@ -2818,26 +2802,26 @@ const fetchSymbolContent = async ({
|
|
|
2818
2802
|
});
|
|
2819
2803
|
};
|
|
2820
2804
|
function Symbol$1(e) {
|
|
2821
|
-
var
|
|
2805
|
+
var r, a, c, s;
|
|
2822
2806
|
function t() {
|
|
2823
|
-
var
|
|
2807
|
+
var l, d;
|
|
2824
2808
|
return [
|
|
2825
2809
|
e.attributes.className,
|
|
2826
2810
|
"builder-symbol",
|
|
2827
|
-
(
|
|
2811
|
+
(l = e.symbol) != null && l.inline ? "builder-inline-symbol" : void 0,
|
|
2828
2812
|
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2829
2813
|
].filter(Boolean).join(" ");
|
|
2830
2814
|
}
|
|
2831
2815
|
const [n, i] = useState(() => {
|
|
2832
|
-
var
|
|
2833
|
-
return (
|
|
2816
|
+
var l;
|
|
2817
|
+
return (l = e.symbol) == null ? void 0 : l.content;
|
|
2834
2818
|
});
|
|
2835
2819
|
function o() {
|
|
2836
2820
|
n || fetchSymbolContent({
|
|
2837
2821
|
symbol: e.symbol,
|
|
2838
2822
|
builderContextValue: e.builderContext
|
|
2839
|
-
}).then((
|
|
2840
|
-
|
|
2823
|
+
}).then((l) => {
|
|
2824
|
+
l && i(l);
|
|
2841
2825
|
});
|
|
2842
2826
|
}
|
|
2843
2827
|
return useEffect(() => {
|
|
@@ -2851,15 +2835,15 @@ function Symbol$1(e) {
|
|
|
2851
2835
|
apiKey: e.builderContext.apiKey,
|
|
2852
2836
|
context: {
|
|
2853
2837
|
...e.builderContext.context,
|
|
2854
|
-
symbolId: (
|
|
2838
|
+
symbolId: (r = e.builderBlock) == null ? void 0 : r.id
|
|
2855
2839
|
},
|
|
2856
2840
|
customComponents: Object.values(e.builderComponents),
|
|
2857
2841
|
data: {
|
|
2858
|
-
...(
|
|
2842
|
+
...(a = e.symbol) == null ? void 0 : a.data,
|
|
2859
2843
|
...e.builderContext.localState,
|
|
2860
2844
|
...(c = n == null ? void 0 : n.data) == null ? void 0 : c.state
|
|
2861
2845
|
},
|
|
2862
|
-
model: (
|
|
2846
|
+
model: (s = e.symbol) == null ? void 0 : s.model,
|
|
2863
2847
|
content: n
|
|
2864
2848
|
}
|
|
2865
2849
|
) });
|