@builder.io/sdk-react 0.12.5 → 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 +853 -705
- package/lib/edge/index.cjs +43 -43
- package/lib/edge/index.mjs +2031 -1883
- package/lib/node/index.cjs +10 -10
- package/lib/node/index.mjs +505 -357
- 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/functions/evaluate/browser-runtime/browser.d.ts +5 -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";
|
|
@@ -92,26 +92,43 @@ const getFunctionArguments = ({
|
|
|
92
92
|
context: n,
|
|
93
93
|
event: i,
|
|
94
94
|
localState: o,
|
|
95
|
-
rootSetState:
|
|
96
|
-
rootState:
|
|
95
|
+
rootSetState: a,
|
|
96
|
+
rootState: r
|
|
97
97
|
}) => {
|
|
98
98
|
const s = getFunctionArguments({
|
|
99
99
|
builder: t,
|
|
100
100
|
context: n,
|
|
101
101
|
event: i,
|
|
102
|
-
state: flattenState(
|
|
102
|
+
state: flattenState({
|
|
103
|
+
rootState: r,
|
|
104
|
+
localState: o,
|
|
105
|
+
rootSetState: a
|
|
106
|
+
})
|
|
103
107
|
});
|
|
104
|
-
return new Function(...s.map(([
|
|
108
|
+
return new Function(...s.map(([l]) => l), e)(...s.map(([, l]) => l));
|
|
105
109
|
};
|
|
106
|
-
function flattenState(
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
function flattenState({
|
|
111
|
+
rootState: e,
|
|
112
|
+
localState: t,
|
|
113
|
+
rootSetState: n
|
|
114
|
+
}) {
|
|
109
115
|
return new Proxy(e, {
|
|
110
|
-
get: (i, o) =>
|
|
111
|
-
|
|
116
|
+
get: (i, o) => {
|
|
117
|
+
if (t && o in t)
|
|
118
|
+
return t[o];
|
|
119
|
+
const a = i[o];
|
|
120
|
+
return typeof a == "object" ? flattenState({
|
|
121
|
+
rootState: a,
|
|
122
|
+
localState: void 0,
|
|
123
|
+
rootSetState: n ? (r) => {
|
|
124
|
+
i[o] = r, n(i);
|
|
125
|
+
} : void 0
|
|
126
|
+
}) : a;
|
|
127
|
+
},
|
|
128
|
+
set: (i, o, a) => {
|
|
112
129
|
if (t && o in t)
|
|
113
130
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
114
|
-
return
|
|
131
|
+
return i[o] = a, n == null || n(i), !0;
|
|
115
132
|
}
|
|
116
133
|
});
|
|
117
134
|
}
|
|
@@ -119,7 +136,7 @@ const set = (e, t, n) => {
|
|
|
119
136
|
if (Object(e) !== e)
|
|
120
137
|
return e;
|
|
121
138
|
const i = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
122
|
-
return i.slice(0, -1).reduce((o,
|
|
139
|
+
return i.slice(0, -1).reduce((o, a, r) => Object(o[a]) === o[a] ? o[a] : o[a] = Math.abs(Number(i[r + 1])) >> 0 === +i[r + 1] ? [] : {}, e)[i[i.length - 1]] = n, e;
|
|
123
140
|
}, noop = () => {
|
|
124
141
|
};
|
|
125
142
|
let safeDynamicRequire = noop;
|
|
@@ -185,40 +202,40 @@ output;
|
|
|
185
202
|
context: n,
|
|
186
203
|
event: i,
|
|
187
204
|
localState: o,
|
|
188
|
-
rootSetState:
|
|
189
|
-
rootState:
|
|
205
|
+
rootSetState: a,
|
|
206
|
+
rootState: r
|
|
190
207
|
}) => {
|
|
191
208
|
const s = fastClone({
|
|
192
|
-
...
|
|
209
|
+
...r,
|
|
193
210
|
...o
|
|
194
|
-
}),
|
|
211
|
+
}), l = getFunctionArguments({
|
|
195
212
|
builder: t,
|
|
196
213
|
context: n,
|
|
197
214
|
event: i,
|
|
198
215
|
state: s
|
|
199
|
-
}),
|
|
200
|
-
d.setSync("global", d.derefInto()), d.setSync("log", function(...
|
|
201
|
-
console.log(...
|
|
202
|
-
}), d.setSync(BUILDER_SET_STATE_NAME, function(
|
|
203
|
-
set(
|
|
204
|
-
}),
|
|
205
|
-
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(
|
|
206
223
|
// workaround: methods with default values for arguments is not being cloned over
|
|
207
|
-
|
|
208
|
-
...
|
|
209
|
-
getUserAttributes: () =>
|
|
210
|
-
} :
|
|
224
|
+
u === "builder" ? {
|
|
225
|
+
...g,
|
|
226
|
+
getUserAttributes: () => g.getUserAttributes()
|
|
227
|
+
} : g
|
|
211
228
|
) : null;
|
|
212
|
-
d.setSync(getSyncValName(
|
|
229
|
+
d.setSync(getSyncValName(u), x);
|
|
213
230
|
}), d.setSync(INJECTED_IVM_GLOBAL, ivm);
|
|
214
|
-
const
|
|
231
|
+
const h = processCode({
|
|
215
232
|
code: e,
|
|
216
|
-
args:
|
|
217
|
-
}),
|
|
233
|
+
args: l
|
|
234
|
+
}), y = c.evalSync(h);
|
|
218
235
|
try {
|
|
219
|
-
return JSON.parse(
|
|
236
|
+
return JSON.parse(y);
|
|
220
237
|
} catch {
|
|
221
|
-
return
|
|
238
|
+
return y;
|
|
222
239
|
}
|
|
223
240
|
};
|
|
224
241
|
function isNodeRuntime() {
|
|
@@ -238,8 +255,8 @@ function evaluate({
|
|
|
238
255
|
localState: n,
|
|
239
256
|
rootState: i,
|
|
240
257
|
rootSetState: o,
|
|
241
|
-
event:
|
|
242
|
-
isExpression:
|
|
258
|
+
event: a,
|
|
259
|
+
isExpression: r = !0
|
|
243
260
|
}) {
|
|
244
261
|
if (e === "") {
|
|
245
262
|
logger.warn("Skipping evaluation of empty code block.");
|
|
@@ -247,19 +264,19 @@ function evaluate({
|
|
|
247
264
|
}
|
|
248
265
|
const s = {
|
|
249
266
|
code: parseCode(e, {
|
|
250
|
-
isExpression:
|
|
267
|
+
isExpression: r
|
|
251
268
|
}),
|
|
252
269
|
builder: getBuilderGlobals(),
|
|
253
270
|
context: t,
|
|
254
|
-
event:
|
|
271
|
+
event: a,
|
|
255
272
|
rootSetState: o,
|
|
256
273
|
rootState: i,
|
|
257
274
|
localState: n
|
|
258
275
|
};
|
|
259
276
|
try {
|
|
260
277
|
return chooseBrowserOrServerEval(s);
|
|
261
|
-
} catch (
|
|
262
|
-
logger.error("Failed code evaluation: " +
|
|
278
|
+
} catch (l) {
|
|
279
|
+
logger.error("Failed code evaluation: " + l.message, {
|
|
263
280
|
code: e
|
|
264
281
|
});
|
|
265
282
|
return;
|
|
@@ -277,26 +294,26 @@ const evaluateBindings = ({
|
|
|
277
294
|
}) => {
|
|
278
295
|
if (!e.bindings)
|
|
279
296
|
return e;
|
|
280
|
-
const
|
|
281
|
-
...
|
|
297
|
+
const a = fastClone(e), r = {
|
|
298
|
+
...a,
|
|
282
299
|
properties: {
|
|
283
|
-
...
|
|
300
|
+
...a.properties
|
|
284
301
|
},
|
|
285
302
|
actions: {
|
|
286
|
-
...
|
|
303
|
+
...a.actions
|
|
287
304
|
}
|
|
288
305
|
};
|
|
289
306
|
for (const s in e.bindings) {
|
|
290
|
-
const
|
|
291
|
-
code:
|
|
307
|
+
const l = e.bindings[s], c = evaluate({
|
|
308
|
+
code: l,
|
|
292
309
|
localState: n,
|
|
293
310
|
rootState: i,
|
|
294
311
|
rootSetState: o,
|
|
295
312
|
context: t
|
|
296
313
|
});
|
|
297
|
-
set(
|
|
314
|
+
set(r, s, c);
|
|
298
315
|
}
|
|
299
|
-
return
|
|
316
|
+
return r;
|
|
300
317
|
};
|
|
301
318
|
function getProcessedBlock({
|
|
302
319
|
block: e,
|
|
@@ -304,31 +321,153 @@ function getProcessedBlock({
|
|
|
304
321
|
shouldEvaluateBindings: n,
|
|
305
322
|
localState: i,
|
|
306
323
|
rootState: o,
|
|
307
|
-
rootSetState:
|
|
324
|
+
rootSetState: a
|
|
308
325
|
}) {
|
|
309
|
-
const
|
|
326
|
+
const r = e;
|
|
310
327
|
return n ? evaluateBindings({
|
|
311
|
-
block:
|
|
328
|
+
block: r,
|
|
312
329
|
localState: i,
|
|
313
330
|
rootState: o,
|
|
314
|
-
rootSetState:
|
|
331
|
+
rootSetState: a,
|
|
315
332
|
context: t
|
|
316
|
-
}) :
|
|
333
|
+
}) : r;
|
|
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
|
+
});
|
|
317
456
|
}
|
|
318
457
|
const getComponent = ({
|
|
319
458
|
block: e,
|
|
320
459
|
context: t,
|
|
321
460
|
registeredComponents: n
|
|
322
461
|
}) => {
|
|
323
|
-
var
|
|
324
|
-
const i = (
|
|
462
|
+
var a;
|
|
463
|
+
const i = (a = getProcessedBlock({
|
|
325
464
|
block: e,
|
|
326
465
|
localState: t.localState,
|
|
327
466
|
rootState: t.rootState,
|
|
328
467
|
rootSetState: t.rootSetState,
|
|
329
468
|
context: t.context,
|
|
330
469
|
shouldEvaluateBindings: !1
|
|
331
|
-
}).component) == null ? void 0 :
|
|
470
|
+
}).component) == null ? void 0 : a.name;
|
|
332
471
|
if (!i)
|
|
333
472
|
return null;
|
|
334
473
|
const o = n[i];
|
|
@@ -356,16 +495,16 @@ const getComponent = ({
|
|
|
356
495
|
});
|
|
357
496
|
if (!Array.isArray(o))
|
|
358
497
|
return;
|
|
359
|
-
const
|
|
360
|
-
return o.map((
|
|
498
|
+
const a = n.collection.split(".").pop(), r = n.itemName || (a ? a + "Item" : "item");
|
|
499
|
+
return o.map((l, c) => ({
|
|
361
500
|
context: {
|
|
362
501
|
...t,
|
|
363
502
|
localState: {
|
|
364
503
|
...t.localState,
|
|
365
|
-
$index:
|
|
366
|
-
$item:
|
|
367
|
-
[
|
|
368
|
-
[`$${
|
|
504
|
+
$index: c,
|
|
505
|
+
$item: l,
|
|
506
|
+
[r]: l,
|
|
507
|
+
[`$${r}Index`]: c
|
|
369
508
|
}
|
|
370
509
|
},
|
|
371
510
|
block: i
|
|
@@ -405,12 +544,12 @@ const getComponent = ({
|
|
|
405
544
|
min: o,
|
|
406
545
|
default: o + 1
|
|
407
546
|
};
|
|
408
|
-
const
|
|
547
|
+
const a = n.medium.max + 1;
|
|
409
548
|
return n.large = {
|
|
410
549
|
max: 2e3,
|
|
411
550
|
// TODO: decide upper limit
|
|
412
|
-
min:
|
|
413
|
-
default:
|
|
551
|
+
min: a,
|
|
552
|
+
default: a + 1
|
|
414
553
|
}, n;
|
|
415
554
|
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, i]) => {
|
|
416
555
|
if (typeof i == "string")
|
|
@@ -444,7 +583,7 @@ function BlockStyles(e) {
|
|
|
444
583
|
return checkIsDefined(i.hide) ? !i.hide : checkIsDefined(i.show) ? i.show : !0;
|
|
445
584
|
}
|
|
446
585
|
function n() {
|
|
447
|
-
var
|
|
586
|
+
var g;
|
|
448
587
|
const i = getProcessedBlock({
|
|
449
588
|
block: e.block,
|
|
450
589
|
localState: e.context.localState,
|
|
@@ -452,30 +591,30 @@ function BlockStyles(e) {
|
|
|
452
591
|
rootSetState: e.context.rootSetState,
|
|
453
592
|
context: e.context.context,
|
|
454
593
|
shouldEvaluateBindings: !0
|
|
455
|
-
}), o = i.responsiveStyles,
|
|
456
|
-
((
|
|
457
|
-
), s = o == null ? void 0 : o.large,
|
|
594
|
+
}), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
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;
|
|
458
597
|
if (!d)
|
|
459
598
|
return "";
|
|
460
|
-
const
|
|
599
|
+
const h = s ? createCssClass({
|
|
461
600
|
className: d,
|
|
462
601
|
styles: s
|
|
463
|
-
}) : "",
|
|
602
|
+
}) : "", y = l ? createCssClass({
|
|
464
603
|
className: d,
|
|
465
|
-
styles:
|
|
604
|
+
styles: l,
|
|
466
605
|
mediaQuery: getMaxWidthQueryForSize(
|
|
467
606
|
"medium",
|
|
468
|
-
|
|
607
|
+
r
|
|
469
608
|
)
|
|
470
|
-
}) : "",
|
|
609
|
+
}) : "", u = c ? createCssClass({
|
|
471
610
|
className: d,
|
|
472
|
-
styles:
|
|
611
|
+
styles: c,
|
|
473
612
|
mediaQuery: getMaxWidthQueryForSize(
|
|
474
613
|
"small",
|
|
475
|
-
|
|
614
|
+
r
|
|
476
615
|
)
|
|
477
616
|
}) : "";
|
|
478
|
-
return [
|
|
617
|
+
return [h, y, u].join(" ");
|
|
479
618
|
}
|
|
480
619
|
return /* @__PURE__ */ jsx(Fragment, { children: n() && t() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: n() }) }) : null });
|
|
481
620
|
}
|
|
@@ -497,18 +636,18 @@ function getBlockActions(e) {
|
|
|
497
636
|
for (const o in n) {
|
|
498
637
|
if (!n.hasOwnProperty(o))
|
|
499
638
|
continue;
|
|
500
|
-
const
|
|
501
|
-
let
|
|
639
|
+
const a = n[o];
|
|
640
|
+
let r = getEventHandlerName(o);
|
|
502
641
|
if (e.stripPrefix)
|
|
503
642
|
switch (TARGET) {
|
|
504
643
|
case "vue":
|
|
505
|
-
|
|
644
|
+
r = r.replace("v-on:", "");
|
|
506
645
|
break;
|
|
507
646
|
case "svelte":
|
|
508
|
-
|
|
647
|
+
r = r.replace("on:", "");
|
|
509
648
|
break;
|
|
510
649
|
}
|
|
511
|
-
t[
|
|
650
|
+
t[r] = createEventHandler(a, e);
|
|
512
651
|
}
|
|
513
652
|
return t;
|
|
514
653
|
}
|
|
@@ -616,8 +755,8 @@ const getWrapperProps = ({
|
|
|
616
755
|
context: n,
|
|
617
756
|
componentRef: i,
|
|
618
757
|
includeBlockProps: o,
|
|
619
|
-
isInteractive:
|
|
620
|
-
contextValue:
|
|
758
|
+
isInteractive: a,
|
|
759
|
+
contextValue: r
|
|
621
760
|
}) => {
|
|
622
761
|
const s = {
|
|
623
762
|
...e,
|
|
@@ -628,11 +767,11 @@ const getWrapperProps = ({
|
|
|
628
767
|
...o ? {
|
|
629
768
|
attributes: getBlockProperties({
|
|
630
769
|
block: t,
|
|
631
|
-
context:
|
|
770
|
+
context: r
|
|
632
771
|
})
|
|
633
772
|
} : {}
|
|
634
773
|
};
|
|
635
|
-
return
|
|
774
|
+
return a ? {
|
|
636
775
|
Wrapper: i,
|
|
637
776
|
block: t,
|
|
638
777
|
context: n,
|
|
@@ -684,7 +823,7 @@ function RepeatedBlock(e) {
|
|
|
684
823
|
) });
|
|
685
824
|
}
|
|
686
825
|
function Block(e) {
|
|
687
|
-
var d,
|
|
826
|
+
var d, h, y;
|
|
688
827
|
function t() {
|
|
689
828
|
return getComponent({
|
|
690
829
|
block: e.block,
|
|
@@ -699,8 +838,8 @@ function Block(e) {
|
|
|
699
838
|
});
|
|
700
839
|
}
|
|
701
840
|
function i() {
|
|
702
|
-
var
|
|
703
|
-
return (
|
|
841
|
+
var u;
|
|
842
|
+
return (u = e.block.repeat) != null && u.collection ? e.block : getProcessedBlock({
|
|
704
843
|
block: e.block,
|
|
705
844
|
localState: e.context.localState,
|
|
706
845
|
rootState: e.context.rootState,
|
|
@@ -710,36 +849,36 @@ function Block(e) {
|
|
|
710
849
|
});
|
|
711
850
|
}
|
|
712
851
|
function o() {
|
|
713
|
-
var
|
|
714
|
-
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";
|
|
715
854
|
}
|
|
716
|
-
function
|
|
717
|
-
var
|
|
718
|
-
if ((
|
|
855
|
+
function a() {
|
|
856
|
+
var x, I;
|
|
857
|
+
if ((x = e.block.repeat) != null && x.collection)
|
|
719
858
|
return !!((I = n == null ? void 0 : n()) != null && I.length);
|
|
720
|
-
const
|
|
721
|
-
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;
|
|
722
861
|
}
|
|
723
|
-
function
|
|
724
|
-
var
|
|
725
|
-
return !((
|
|
862
|
+
function r() {
|
|
863
|
+
var g, x;
|
|
864
|
+
return !((g = t == null ? void 0 : t()) != null && g.component) && !n() ? (x = i().children) != null ? x : [] : [];
|
|
726
865
|
}
|
|
727
866
|
function s() {
|
|
728
|
-
var
|
|
867
|
+
var u, g, x, I, E, v, C, T, w;
|
|
729
868
|
return {
|
|
730
|
-
blockChildren: (
|
|
731
|
-
componentRef: (
|
|
869
|
+
blockChildren: (u = i().children) != null ? u : [],
|
|
870
|
+
componentRef: (g = t == null ? void 0 : t()) == null ? void 0 : g.component,
|
|
732
871
|
componentOptions: {
|
|
733
872
|
...getBlockComponentOptions(i()),
|
|
734
873
|
builderContext: e.context,
|
|
735
|
-
...((
|
|
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" ? {
|
|
736
875
|
builderLinkComponent: e.linkComponent
|
|
737
876
|
} : {},
|
|
738
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" ? {
|
|
739
878
|
builderComponents: e.registeredComponents
|
|
740
879
|
} : {}
|
|
741
880
|
},
|
|
742
|
-
context:
|
|
881
|
+
context: l,
|
|
743
882
|
linkComponent: e.linkComponent,
|
|
744
883
|
registeredComponents: e.registeredComponents,
|
|
745
884
|
builderBlock: i(),
|
|
@@ -747,8 +886,16 @@ function Block(e) {
|
|
|
747
886
|
isInteractive: !((w = t == null ? void 0 : t()) != null && w.isRSC)
|
|
748
887
|
};
|
|
749
888
|
}
|
|
750
|
-
const [
|
|
751
|
-
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: [
|
|
752
899
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
753
900
|
(d = t == null ? void 0 : t()) != null && d.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
754
901
|
ComponentRef,
|
|
@@ -763,15 +910,15 @@ function Block(e) {
|
|
|
763
910
|
includeBlockProps: s().includeBlockProps,
|
|
764
911
|
isInteractive: s().isInteractive
|
|
765
912
|
}
|
|
766
|
-
) }) : /* @__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(
|
|
767
914
|
RepeatedBlock,
|
|
768
915
|
{
|
|
769
|
-
repeatContext:
|
|
770
|
-
block:
|
|
916
|
+
repeatContext: u.context,
|
|
917
|
+
block: u.block,
|
|
771
918
|
registeredComponents: e.registeredComponents,
|
|
772
919
|
linkComponent: e.linkComponent
|
|
773
920
|
},
|
|
774
|
-
|
|
921
|
+
g
|
|
775
922
|
)) }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
776
923
|
BlockWrapper,
|
|
777
924
|
{
|
|
@@ -794,15 +941,15 @@ function Block(e) {
|
|
|
794
941
|
isInteractive: s().isInteractive
|
|
795
942
|
}
|
|
796
943
|
),
|
|
797
|
-
(
|
|
944
|
+
(h = r()) == null ? void 0 : h.map((u) => /* @__PURE__ */ jsx(
|
|
798
945
|
Block,
|
|
799
946
|
{
|
|
800
|
-
block:
|
|
801
|
-
context:
|
|
947
|
+
block: u,
|
|
948
|
+
context: l,
|
|
802
949
|
registeredComponents: e.registeredComponents,
|
|
803
950
|
linkComponent: e.linkComponent
|
|
804
951
|
},
|
|
805
|
-
|
|
952
|
+
u.id
|
|
806
953
|
))
|
|
807
954
|
]
|
|
808
955
|
}
|
|
@@ -815,8 +962,8 @@ function BlocksWrapper(e) {
|
|
|
815
962
|
return "builder-blocks" + ((o = e.blocks) != null && o.length ? "" : " no-blocks");
|
|
816
963
|
}
|
|
817
964
|
function n() {
|
|
818
|
-
var o,
|
|
819
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
965
|
+
var o, a;
|
|
966
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((a = window.parent) == null || a.postMessage(
|
|
820
967
|
{
|
|
821
968
|
type: "builder.clickEmptyBlocks",
|
|
822
969
|
data: {
|
|
@@ -828,8 +975,8 @@ function BlocksWrapper(e) {
|
|
|
828
975
|
));
|
|
829
976
|
}
|
|
830
977
|
function i() {
|
|
831
|
-
var o,
|
|
832
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
978
|
+
var o, a;
|
|
979
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((a = window.parent) == null || a.postMessage(
|
|
833
980
|
{
|
|
834
981
|
type: "builder.hoverEmptyBlocks",
|
|
835
982
|
data: {
|
|
@@ -863,7 +1010,7 @@ function BlocksWrapper(e) {
|
|
|
863
1010
|
] });
|
|
864
1011
|
}
|
|
865
1012
|
function Blocks(e) {
|
|
866
|
-
var i, o,
|
|
1013
|
+
var i, o, a;
|
|
867
1014
|
const t = useContext(builderContext), n = useContext(ComponentsContext);
|
|
868
1015
|
return /* @__PURE__ */ jsx(
|
|
869
1016
|
BlocksWrapper,
|
|
@@ -874,15 +1021,15 @@ function Blocks(e) {
|
|
|
874
1021
|
styleProp: e.styleProp,
|
|
875
1022
|
BlocksWrapper: (i = e.context) == null ? void 0 : i.BlocksWrapper,
|
|
876
1023
|
BlocksWrapperProps: (o = e.context) == null ? void 0 : o.BlocksWrapperProps,
|
|
877
|
-
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
1024
|
+
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (a = e.blocks) == null ? void 0 : a.map((r) => /* @__PURE__ */ jsx(
|
|
878
1025
|
Block,
|
|
879
1026
|
{
|
|
880
|
-
block:
|
|
1027
|
+
block: r,
|
|
881
1028
|
linkComponent: e.linkComponent,
|
|
882
1029
|
context: e.context || t,
|
|
883
1030
|
registeredComponents: e.registeredComponents || n.registeredComponents
|
|
884
1031
|
},
|
|
885
|
-
|
|
1032
|
+
r.id
|
|
886
1033
|
)) }) : null
|
|
887
1034
|
}
|
|
888
1035
|
);
|
|
@@ -891,43 +1038,43 @@ function Columns(e) {
|
|
|
891
1038
|
var E;
|
|
892
1039
|
const [t, n] = useState(
|
|
893
1040
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
894
|
-
), [i, o] = useState(() => e.columns || []), [
|
|
1041
|
+
), [i, o] = useState(() => e.columns || []), [a, r] = useState(
|
|
895
1042
|
() => e.stackColumnsAt || "tablet"
|
|
896
1043
|
);
|
|
897
1044
|
function s(v) {
|
|
898
1045
|
var C;
|
|
899
1046
|
return ((C = i[v]) == null ? void 0 : C.width) || 100 / i.length;
|
|
900
1047
|
}
|
|
901
|
-
function
|
|
1048
|
+
function l(v) {
|
|
902
1049
|
const C = t * (i.length - 1) / i.length;
|
|
903
1050
|
return `calc(${s(v)}% - ${C}px)`;
|
|
904
1051
|
}
|
|
905
|
-
function
|
|
1052
|
+
function c({
|
|
906
1053
|
stackedStyle: v,
|
|
907
1054
|
desktopStyle: C
|
|
908
1055
|
}) {
|
|
909
|
-
return
|
|
1056
|
+
return a === "tablet" ? v : C;
|
|
910
1057
|
}
|
|
911
1058
|
function d({
|
|
912
1059
|
stackedStyle: v,
|
|
913
1060
|
desktopStyle: C
|
|
914
1061
|
}) {
|
|
915
|
-
return
|
|
1062
|
+
return a === "never" ? C : v;
|
|
916
1063
|
}
|
|
917
|
-
const [
|
|
1064
|
+
const [h, y] = useState(
|
|
918
1065
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
919
1066
|
);
|
|
920
|
-
function
|
|
1067
|
+
function u() {
|
|
921
1068
|
return {
|
|
922
|
-
"--flex-dir":
|
|
923
|
-
"--flex-dir-tablet":
|
|
924
|
-
stackedStyle:
|
|
1069
|
+
"--flex-dir": h,
|
|
1070
|
+
"--flex-dir-tablet": c({
|
|
1071
|
+
stackedStyle: h,
|
|
925
1072
|
desktopStyle: "row"
|
|
926
1073
|
})
|
|
927
1074
|
};
|
|
928
1075
|
}
|
|
929
|
-
function
|
|
930
|
-
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;
|
|
931
1078
|
return {
|
|
932
1079
|
...{
|
|
933
1080
|
display: "flex",
|
|
@@ -941,20 +1088,20 @@ function Columns(e) {
|
|
|
941
1088
|
desktopStyle: T
|
|
942
1089
|
}),
|
|
943
1090
|
"--column-margin-left-mobile": d({
|
|
944
|
-
stackedStyle:
|
|
1091
|
+
stackedStyle: A,
|
|
945
1092
|
desktopStyle: w
|
|
946
1093
|
}),
|
|
947
|
-
"--column-width-tablet":
|
|
1094
|
+
"--column-width-tablet": c({
|
|
948
1095
|
stackedStyle: R,
|
|
949
1096
|
desktopStyle: T
|
|
950
1097
|
}),
|
|
951
|
-
"--column-margin-left-tablet":
|
|
952
|
-
stackedStyle:
|
|
1098
|
+
"--column-margin-left-tablet": c({
|
|
1099
|
+
stackedStyle: A,
|
|
953
1100
|
desktopStyle: w
|
|
954
1101
|
})
|
|
955
1102
|
};
|
|
956
1103
|
}
|
|
957
|
-
function
|
|
1104
|
+
function x(v) {
|
|
958
1105
|
var T, w;
|
|
959
1106
|
return getSizesForBreakpoints(
|
|
960
1107
|
((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
|
|
@@ -962,7 +1109,7 @@ function Columns(e) {
|
|
|
962
1109
|
}
|
|
963
1110
|
function I() {
|
|
964
1111
|
return `
|
|
965
|
-
@media (max-width: ${
|
|
1112
|
+
@media (max-width: ${x("medium")}px) {
|
|
966
1113
|
.${e.builderBlock.id}-breakpoints {
|
|
967
1114
|
flex-direction: var(--flex-dir-tablet);
|
|
968
1115
|
align-items: stretch;
|
|
@@ -974,7 +1121,7 @@ function Columns(e) {
|
|
|
974
1121
|
}
|
|
975
1122
|
}
|
|
976
1123
|
|
|
977
|
-
@media (max-width: ${
|
|
1124
|
+
@media (max-width: ${x("small")}px) {
|
|
978
1125
|
.${e.builderBlock.id}-breakpoints {
|
|
979
1126
|
flex-direction: var(--flex-dir);
|
|
980
1127
|
align-items: stretch;
|
|
@@ -992,7 +1139,7 @@ function Columns(e) {
|
|
|
992
1139
|
"div",
|
|
993
1140
|
{
|
|
994
1141
|
className: `builder-columns ${e.builderBlock.id}-breakpoints div-6f826264`,
|
|
995
|
-
style:
|
|
1142
|
+
style: u(),
|
|
996
1143
|
children: [
|
|
997
1144
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: I() }) }),
|
|
998
1145
|
(E = e.columns) == null ? void 0 : E.map((v, C) => /* @__PURE__ */ jsx(
|
|
@@ -1005,7 +1152,7 @@ function Columns(e) {
|
|
|
1005
1152
|
href: v.link
|
|
1006
1153
|
} : {},
|
|
1007
1154
|
[getClassPropName()]: "builder-column",
|
|
1008
|
-
style: mapStyleObjToStrIfNeeded(
|
|
1155
|
+
style: mapStyleObjToStrIfNeeded(g(C))
|
|
1009
1156
|
},
|
|
1010
1157
|
children: /* @__PURE__ */ jsx(
|
|
1011
1158
|
Blocks,
|
|
@@ -1050,8 +1197,8 @@ function getShopifyImageUrl(e, t) {
|
|
|
1050
1197
|
return removeProtocol(e);
|
|
1051
1198
|
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
1052
1199
|
if (n) {
|
|
1053
|
-
const i = e.split(n[0]), o = n[3],
|
|
1054
|
-
return removeProtocol(`${i[0]}_${
|
|
1200
|
+
const i = e.split(n[0]), o = n[3], a = t.match("x") ? t : `${t}x`;
|
|
1201
|
+
return removeProtocol(`${i[0]}_${a}${o}`);
|
|
1055
1202
|
}
|
|
1056
1203
|
return null;
|
|
1057
1204
|
}
|
|
@@ -1067,34 +1214,34 @@ function getSrcSet(e) {
|
|
|
1067
1214
|
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;
|
|
1068
1215
|
}
|
|
1069
1216
|
function Image(e) {
|
|
1070
|
-
var o,
|
|
1217
|
+
var o, a, r, s;
|
|
1071
1218
|
function t() {
|
|
1072
1219
|
var d;
|
|
1073
|
-
const
|
|
1074
|
-
if (!
|
|
1220
|
+
const c = e.image || e.src;
|
|
1221
|
+
if (!c || // We can auto add srcset for cdn.builder.io and shopify
|
|
1075
1222
|
// images, otherwise you can supply this prop manually
|
|
1076
|
-
!(
|
|
1223
|
+
!(c.match(/builder\.io/) || c.match(/cdn\.shopify\.com/)))
|
|
1077
1224
|
return e.srcset;
|
|
1078
1225
|
if (e.srcset && ((d = e.image) != null && d.includes("builder.io/api/v1/image"))) {
|
|
1079
1226
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1080
|
-
return console.debug("Removed given srcset"), getSrcSet(
|
|
1227
|
+
return console.debug("Removed given srcset"), getSrcSet(c);
|
|
1081
1228
|
} else if (e.image && !e.srcset)
|
|
1082
|
-
return getSrcSet(
|
|
1083
|
-
return getSrcSet(
|
|
1229
|
+
return getSrcSet(c);
|
|
1230
|
+
return getSrcSet(c);
|
|
1084
1231
|
}
|
|
1085
1232
|
function n() {
|
|
1086
|
-
var
|
|
1087
|
-
return (
|
|
1233
|
+
var l;
|
|
1234
|
+
return (l = t == null ? void 0 : t()) != null && l.match(/builder\.io/) && !e.noWebp ? t().replace(/\?/g, "?format=webp&") : "";
|
|
1088
1235
|
}
|
|
1089
1236
|
function i() {
|
|
1090
|
-
const
|
|
1237
|
+
const l = {
|
|
1091
1238
|
position: "absolute",
|
|
1092
1239
|
height: "100%",
|
|
1093
1240
|
width: "100%",
|
|
1094
1241
|
left: "0px",
|
|
1095
1242
|
top: "0px"
|
|
1096
1243
|
};
|
|
1097
|
-
return e.aspectRatio ?
|
|
1244
|
+
return e.aspectRatio ? l : void 0;
|
|
1098
1245
|
}
|
|
1099
1246
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1100
1247
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1118,7 +1265,7 @@ function Image(e) {
|
|
|
1118
1265
|
}
|
|
1119
1266
|
)
|
|
1120
1267
|
] }),
|
|
1121
|
-
e.aspectRatio && !((
|
|
1268
|
+
e.aspectRatio && !((a = (o = e.builderBlock) == null ? void 0 : o.children) != null && a.length && e.fitContent) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1122
1269
|
"div",
|
|
1123
1270
|
{
|
|
1124
1271
|
className: "builder-image-sizer div-40c70c9b",
|
|
@@ -1127,7 +1274,7 @@ function Image(e) {
|
|
|
1127
1274
|
}
|
|
1128
1275
|
}
|
|
1129
1276
|
) }) : null,
|
|
1130
|
-
(s = (
|
|
1277
|
+
(s = (r = e.builderBlock) == null ? void 0 : r.children) != null && s.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: e.children }) : null,
|
|
1131
1278
|
!e.fitContent && e.children ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
|
|
1132
1279
|
] }),
|
|
1133
1280
|
/* @__PURE__ */ jsx("style", { children: `.img-40c70c9b {
|
|
@@ -1382,7 +1529,7 @@ const componentInfo$b = {
|
|
|
1382
1529
|
});
|
|
1383
1530
|
}
|
|
1384
1531
|
const n = e.get("columns");
|
|
1385
|
-
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((
|
|
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();
|
|
1386
1533
|
}
|
|
1387
1534
|
}, {
|
|
1388
1535
|
name: "space",
|
|
@@ -1428,29 +1575,29 @@ const componentInfo$b = {
|
|
|
1428
1575
|
}]
|
|
1429
1576
|
};
|
|
1430
1577
|
function CustomCode(e) {
|
|
1431
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1578
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []);
|
|
1432
1579
|
return useEffect(() => {
|
|
1433
1580
|
var s;
|
|
1434
1581
|
if (!((s = t.current) != null && s.getElementsByTagName) || typeof window == "undefined")
|
|
1435
1582
|
return;
|
|
1436
|
-
const
|
|
1437
|
-
for (let
|
|
1438
|
-
const
|
|
1439
|
-
if (
|
|
1440
|
-
if (n.includes(
|
|
1583
|
+
const r = t.current.getElementsByTagName("script");
|
|
1584
|
+
for (let l = 0; l < r.length; l++) {
|
|
1585
|
+
const c = r[l];
|
|
1586
|
+
if (c.src) {
|
|
1587
|
+
if (n.includes(c.src))
|
|
1441
1588
|
continue;
|
|
1442
|
-
n.push(
|
|
1589
|
+
n.push(c.src);
|
|
1443
1590
|
const d = document.createElement("script");
|
|
1444
|
-
d.async = !0, d.src =
|
|
1445
|
-
} else if (!
|
|
1591
|
+
d.async = !0, d.src = c.src, document.head.appendChild(d);
|
|
1592
|
+
} else if (!c.type || [
|
|
1446
1593
|
"text/javascript",
|
|
1447
1594
|
"application/javascript",
|
|
1448
1595
|
"application/ecmascript"
|
|
1449
|
-
].includes(
|
|
1450
|
-
if (o.includes(
|
|
1596
|
+
].includes(c.type)) {
|
|
1597
|
+
if (o.includes(c.innerText))
|
|
1451
1598
|
continue;
|
|
1452
1599
|
try {
|
|
1453
|
-
o.push(
|
|
1600
|
+
o.push(c.innerText), new Function(c.innerText)();
|
|
1454
1601
|
} catch (d) {
|
|
1455
1602
|
console.warn("`CustomCode`: Error running script:", d);
|
|
1456
1603
|
}
|
|
@@ -1492,28 +1639,28 @@ const componentInfo$8 = {
|
|
|
1492
1639
|
}]
|
|
1493
1640
|
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1494
1641
|
function Embed(e) {
|
|
1495
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1496
|
-
function
|
|
1642
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r, s] = useState(() => !1);
|
|
1643
|
+
function l() {
|
|
1497
1644
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1498
1645
|
return;
|
|
1499
|
-
const
|
|
1500
|
-
for (let d = 0; d <
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
n.push(
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1506
|
-
} 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))
|
|
1507
1654
|
try {
|
|
1508
|
-
o.push(
|
|
1509
|
-
} catch (
|
|
1510
|
-
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);
|
|
1511
1658
|
}
|
|
1512
1659
|
}
|
|
1513
1660
|
}
|
|
1514
1661
|
return useEffect(() => {
|
|
1515
|
-
t.current && !
|
|
1516
|
-
}, [t.current,
|
|
1662
|
+
t.current && !r && (s(!0), l());
|
|
1663
|
+
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1517
1664
|
"div",
|
|
1518
1665
|
{
|
|
1519
1666
|
className: "builder-embed",
|
|
@@ -1548,29 +1695,29 @@ const componentInfo$7 = {
|
|
|
1548
1695
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
1549
1696
|
onChange: (e) => {
|
|
1550
1697
|
e.delete("srcset"), e.delete("noWebp");
|
|
1551
|
-
function n(
|
|
1552
|
-
return new Promise((
|
|
1698
|
+
function n(r, s = 6e4) {
|
|
1699
|
+
return new Promise((l, c) => {
|
|
1553
1700
|
const d = document.createElement("img");
|
|
1554
|
-
let
|
|
1701
|
+
let h = !1;
|
|
1555
1702
|
d.onload = () => {
|
|
1556
|
-
|
|
1557
|
-
}, d.addEventListener("error", (
|
|
1558
|
-
console.warn("Image load failed",
|
|
1559
|
-
}), d.src =
|
|
1560
|
-
|
|
1703
|
+
h = !0, l(d);
|
|
1704
|
+
}, d.addEventListener("error", (y) => {
|
|
1705
|
+
console.warn("Image load failed", y.error), c(y.error);
|
|
1706
|
+
}), d.src = r, setTimeout(() => {
|
|
1707
|
+
h || c(new Error("Image load timed out"));
|
|
1561
1708
|
}, s);
|
|
1562
1709
|
});
|
|
1563
1710
|
}
|
|
1564
|
-
function i(
|
|
1565
|
-
return Math.round(
|
|
1711
|
+
function i(r) {
|
|
1712
|
+
return Math.round(r * 1e3) / 1e3;
|
|
1566
1713
|
}
|
|
1567
|
-
const o = e.get("image"),
|
|
1568
|
-
if (fetch(o).then((
|
|
1569
|
-
|
|
1570
|
-
}), o && (!
|
|
1571
|
-
return n(o).then((
|
|
1714
|
+
const o = e.get("image"), a = e.get("aspectRatio");
|
|
1715
|
+
if (fetch(o).then((r) => r.blob()).then((r) => {
|
|
1716
|
+
r.type.includes("svg") && e.set("noWebp", !0);
|
|
1717
|
+
}), o && (!a || a === 0.7041))
|
|
1718
|
+
return n(o).then((r) => {
|
|
1572
1719
|
const s = e.get("aspectRatio");
|
|
1573
|
-
e.get("image") === o && (!s || s === 0.7041) &&
|
|
1720
|
+
e.get("image") === o && (!s || s === 0.7041) && r.width && r.height && (e.set("aspectRatio", i(r.height / r.width)), e.set("height", r.height), e.set("width", r.width));
|
|
1574
1721
|
});
|
|
1575
1722
|
}
|
|
1576
1723
|
}, {
|
|
@@ -1882,7 +2029,7 @@ const componentInfo = {
|
|
|
1882
2029
|
}]
|
|
1883
2030
|
};
|
|
1884
2031
|
function Video(e) {
|
|
1885
|
-
var i, o,
|
|
2032
|
+
var i, o, a, r, s, l, c;
|
|
1886
2033
|
function t() {
|
|
1887
2034
|
return {
|
|
1888
2035
|
...e.autoPlay === !0 ? {
|
|
@@ -1939,7 +2086,7 @@ function Video(e) {
|
|
|
1939
2086
|
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
1940
2087
|
}
|
|
1941
2088
|
),
|
|
1942
|
-
e.aspectRatio && !(e.fitContent && ((
|
|
2089
|
+
e.aspectRatio && !(e.fitContent && ((a = (o = e.builderBlock) == null ? void 0 : o.children) != null && a.length)) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1943
2090
|
"div",
|
|
1944
2091
|
{
|
|
1945
2092
|
style: {
|
|
@@ -1950,7 +2097,7 @@ function Video(e) {
|
|
|
1950
2097
|
}
|
|
1951
2098
|
}
|
|
1952
2099
|
) }) : null,
|
|
1953
|
-
(s = (
|
|
2100
|
+
(s = (r = e.builderBlock) == null ? void 0 : r.children) != null && s.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1954
2101
|
"div",
|
|
1955
2102
|
{
|
|
1956
2103
|
style: {
|
|
@@ -1961,7 +2108,7 @@ function Video(e) {
|
|
|
1961
2108
|
children: e.children
|
|
1962
2109
|
}
|
|
1963
2110
|
) }) : null,
|
|
1964
|
-
(
|
|
2111
|
+
(c = (l = e.builderBlock) == null ? void 0 : l.children) != null && c.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1965
2112
|
"div",
|
|
1966
2113
|
{
|
|
1967
2114
|
style: {
|
|
@@ -2162,10 +2309,10 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2162
2309
|
event: e,
|
|
2163
2310
|
target: t
|
|
2164
2311
|
}) => {
|
|
2165
|
-
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top,
|
|
2312
|
+
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top, a = round(i / n.width), r = round(o / n.height);
|
|
2166
2313
|
return {
|
|
2167
|
-
x:
|
|
2168
|
-
y:
|
|
2314
|
+
x: a,
|
|
2315
|
+
y: r
|
|
2169
2316
|
};
|
|
2170
2317
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
2171
2318
|
const t = e.target, n = t && findBuilderParent(t), i = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
|
|
@@ -2183,7 +2330,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2183
2330
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2184
2331
|
}
|
|
2185
2332
|
};
|
|
2186
|
-
}, SDK_VERSION = "0.12.
|
|
2333
|
+
}, SDK_VERSION = "0.12.7", registerInsertMenu = () => {
|
|
2187
2334
|
register("insertMenu", {
|
|
2188
2335
|
name: "_default",
|
|
2189
2336
|
default: !0,
|
|
@@ -2226,7 +2373,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2226
2373
|
options: e
|
|
2227
2374
|
}
|
|
2228
2375
|
}, "*"), window.addEventListener("message", (i) => {
|
|
2229
|
-
var
|
|
2376
|
+
var a, r;
|
|
2230
2377
|
if (!isFromTrustedHost(e.trustedHosts, i))
|
|
2231
2378
|
return;
|
|
2232
2379
|
const {
|
|
@@ -2235,33 +2382,33 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2235
2382
|
if (o != null && o.type)
|
|
2236
2383
|
switch (o.type) {
|
|
2237
2384
|
case "builder.evaluate": {
|
|
2238
|
-
const s = o.data.text,
|
|
2239
|
-
let
|
|
2385
|
+
const s = o.data.text, l = o.data.arguments || [], c = o.data.id, d = new Function(s);
|
|
2386
|
+
let h, y = null;
|
|
2240
2387
|
try {
|
|
2241
|
-
|
|
2242
|
-
} catch (
|
|
2243
|
-
|
|
2388
|
+
h = d.apply(null, l);
|
|
2389
|
+
} catch (u) {
|
|
2390
|
+
y = u;
|
|
2244
2391
|
}
|
|
2245
|
-
|
|
2392
|
+
y ? (a = window.parent) == null || a.postMessage({
|
|
2246
2393
|
type: "builder.evaluateError",
|
|
2247
2394
|
data: {
|
|
2248
|
-
id:
|
|
2249
|
-
error:
|
|
2395
|
+
id: c,
|
|
2396
|
+
error: y.message
|
|
2250
2397
|
}
|
|
2251
|
-
}, "*") :
|
|
2252
|
-
var
|
|
2253
|
-
(
|
|
2398
|
+
}, "*") : h && typeof h.then == "function" ? h.then((u) => {
|
|
2399
|
+
var g;
|
|
2400
|
+
(g = window.parent) == null || g.postMessage({
|
|
2254
2401
|
type: "builder.evaluateResult",
|
|
2255
2402
|
data: {
|
|
2256
|
-
id:
|
|
2257
|
-
result:
|
|
2403
|
+
id: c,
|
|
2404
|
+
result: u
|
|
2258
2405
|
}
|
|
2259
2406
|
}, "*");
|
|
2260
|
-
}).catch(console.error) : (
|
|
2407
|
+
}).catch(console.error) : (r = window.parent) == null || r.postMessage({
|
|
2261
2408
|
type: "builder.evaluateResult",
|
|
2262
2409
|
data: {
|
|
2263
|
-
result:
|
|
2264
|
-
id:
|
|
2410
|
+
result: h,
|
|
2411
|
+
id: c
|
|
2265
2412
|
}
|
|
2266
2413
|
}, "*");
|
|
2267
2414
|
break;
|
|
@@ -2270,103 +2417,107 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2270
2417
|
})));
|
|
2271
2418
|
};
|
|
2272
2419
|
function EnableEditor(e) {
|
|
2273
|
-
var
|
|
2420
|
+
var A, B, P, N, F, _, V;
|
|
2274
2421
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2275
2422
|
useState(() => !0);
|
|
2276
|
-
function o(
|
|
2423
|
+
function o(m) {
|
|
2277
2424
|
var b, S;
|
|
2278
|
-
const
|
|
2425
|
+
const f = {
|
|
2279
2426
|
...e.builderContextSignal.rootState,
|
|
2280
|
-
...
|
|
2427
|
+
...m
|
|
2281
2428
|
};
|
|
2282
|
-
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) => ({
|
|
2283
2430
|
...p,
|
|
2284
|
-
rootState:
|
|
2431
|
+
rootState: f
|
|
2285
2432
|
}));
|
|
2286
2433
|
}
|
|
2287
|
-
function
|
|
2288
|
-
var b, S, p, k,
|
|
2289
|
-
const
|
|
2434
|
+
function a(m) {
|
|
2435
|
+
var b, S, p, k, j;
|
|
2436
|
+
const f = {
|
|
2290
2437
|
...e.builderContextSignal.content,
|
|
2291
|
-
...
|
|
2438
|
+
...m,
|
|
2292
2439
|
data: {
|
|
2293
2440
|
...(b = e.builderContextSignal.content) == null ? void 0 : b.data,
|
|
2294
|
-
...
|
|
2441
|
+
...m == null ? void 0 : m.data
|
|
2295
2442
|
},
|
|
2296
2443
|
meta: {
|
|
2297
2444
|
...(S = e.builderContextSignal.content) == null ? void 0 : S.meta,
|
|
2298
|
-
...
|
|
2299
|
-
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)
|
|
2300
2447
|
}
|
|
2301
2448
|
};
|
|
2302
2449
|
e.setBuilderContextSignal(($) => ({
|
|
2303
2450
|
...$,
|
|
2304
|
-
content:
|
|
2451
|
+
content: f
|
|
2305
2452
|
}));
|
|
2306
2453
|
}
|
|
2307
2454
|
useState(() => 0);
|
|
2308
|
-
const [
|
|
2455
|
+
const [r, s] = useState(
|
|
2309
2456
|
() => !1
|
|
2310
|
-
), [
|
|
2457
|
+
), [l, c] = useState(
|
|
2311
2458
|
() => e.contentWrapper || "div"
|
|
2312
2459
|
);
|
|
2313
|
-
function d(
|
|
2460
|
+
function d(m) {
|
|
2314
2461
|
var b;
|
|
2315
|
-
if (!isFromTrustedHost(e.trustedHosts,
|
|
2462
|
+
if (!isFromTrustedHost(e.trustedHosts, m))
|
|
2316
2463
|
return;
|
|
2317
|
-
const { data:
|
|
2318
|
-
if (
|
|
2319
|
-
switch (
|
|
2464
|
+
const { data: f } = m;
|
|
2465
|
+
if (f)
|
|
2466
|
+
switch (f.type) {
|
|
2320
2467
|
case "builder.configureSdk": {
|
|
2321
|
-
const S =
|
|
2468
|
+
const S = f.data, { breakpoints: p, contentId: k } = S;
|
|
2322
2469
|
if (!k || k !== ((b = e.builderContextSignal.content) == null ? void 0 : b.id))
|
|
2323
2470
|
return;
|
|
2324
|
-
p &&
|
|
2471
|
+
p && a({
|
|
2325
2472
|
meta: {
|
|
2326
2473
|
breakpoints: p
|
|
2327
2474
|
}
|
|
2328
2475
|
}), i(n + 1);
|
|
2329
2476
|
break;
|
|
2330
2477
|
}
|
|
2478
|
+
case "builder.triggerAnimation": {
|
|
2479
|
+
triggerAnimation(f.data);
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2331
2482
|
case "builder.contentUpdate": {
|
|
2332
|
-
const S =
|
|
2333
|
-
p === e.model && (
|
|
2483
|
+
const S = f.data, p = S.key || S.alias || S.entry || S.modelName, k = S.data;
|
|
2484
|
+
p === e.model && (a(k), i(n + 1));
|
|
2334
2485
|
break;
|
|
2335
2486
|
}
|
|
2336
2487
|
}
|
|
2337
2488
|
}
|
|
2338
|
-
function
|
|
2339
|
-
var
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
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,
|
|
2343
2494
|
context: e.context || {},
|
|
2344
2495
|
localState: void 0,
|
|
2345
2496
|
rootState: e.builderContextSignal.rootState,
|
|
2346
2497
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2347
2498
|
});
|
|
2348
2499
|
}
|
|
2349
|
-
const [
|
|
2350
|
-
function I(
|
|
2351
|
-
var
|
|
2500
|
+
const [y, u] = useState(() => ({})), [g, x] = useState(() => !1);
|
|
2501
|
+
function I(m) {
|
|
2502
|
+
var f, b;
|
|
2352
2503
|
if (e.builderContextSignal.content) {
|
|
2353
|
-
const S = (
|
|
2504
|
+
const S = (f = e.builderContextSignal.content) == null ? void 0 : f.testVariationId, p = (b = e.builderContextSignal.content) == null ? void 0 : b.id;
|
|
2354
2505
|
_track({
|
|
2355
2506
|
type: "click",
|
|
2356
2507
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2357
2508
|
contentId: p,
|
|
2358
2509
|
apiKey: e.apiKey,
|
|
2359
2510
|
variationId: S !== p ? S : void 0,
|
|
2360
|
-
...getInteractionPropertiesForEvent(
|
|
2361
|
-
unique: !
|
|
2511
|
+
...getInteractionPropertiesForEvent(m),
|
|
2512
|
+
unique: !g
|
|
2362
2513
|
});
|
|
2363
2514
|
}
|
|
2364
|
-
|
|
2515
|
+
g || x(!0);
|
|
2365
2516
|
}
|
|
2366
|
-
function E(
|
|
2367
|
-
return
|
|
2517
|
+
function E(m) {
|
|
2518
|
+
return m.replace(
|
|
2368
2519
|
/{{([^}]+)}}/g,
|
|
2369
|
-
(
|
|
2520
|
+
(f, b) => evaluate({
|
|
2370
2521
|
code: b,
|
|
2371
2522
|
context: e.context || {},
|
|
2372
2523
|
localState: void 0,
|
|
@@ -2375,26 +2526,26 @@ function EnableEditor(e) {
|
|
|
2375
2526
|
})
|
|
2376
2527
|
);
|
|
2377
2528
|
}
|
|
2378
|
-
function v({ url:
|
|
2379
|
-
fetch$1(
|
|
2529
|
+
function v({ url: m, key: f }) {
|
|
2530
|
+
fetch$1(m).then((b) => b.json()).then((b) => {
|
|
2380
2531
|
var p, k;
|
|
2381
2532
|
const S = {
|
|
2382
2533
|
...e.builderContextSignal.rootState,
|
|
2383
|
-
[
|
|
2534
|
+
[f]: b
|
|
2384
2535
|
};
|
|
2385
|
-
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, S),
|
|
2536
|
+
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, S), y[f] = !0;
|
|
2386
2537
|
}).catch((b) => {
|
|
2387
|
-
console.error("error fetching dynamic data",
|
|
2538
|
+
console.error("error fetching dynamic data", m, b);
|
|
2388
2539
|
});
|
|
2389
2540
|
}
|
|
2390
2541
|
function C() {
|
|
2391
|
-
var
|
|
2392
|
-
const
|
|
2393
|
-
Object.entries(
|
|
2394
|
-
if (k && (!
|
|
2395
|
-
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);
|
|
2396
2547
|
v({
|
|
2397
|
-
url:
|
|
2548
|
+
url: j,
|
|
2398
2549
|
key: p
|
|
2399
2550
|
});
|
|
2400
2551
|
}
|
|
@@ -2415,7 +2566,7 @@ function EnableEditor(e) {
|
|
|
2415
2566
|
)
|
|
2416
2567
|
);
|
|
2417
2568
|
}
|
|
2418
|
-
function w(
|
|
2569
|
+
function w(m) {
|
|
2419
2570
|
i(n + 1), window.addEventListener("message", d), registerInsertMenu(), setupBrowserForEditing({
|
|
2420
2571
|
...e.locale ? {
|
|
2421
2572
|
locale: e.locale
|
|
@@ -2431,56 +2582,56 @@ function EnableEditor(e) {
|
|
|
2431
2582
|
} : {}
|
|
2432
2583
|
}), Object.values(
|
|
2433
2584
|
e.builderContextSignal.componentInfos
|
|
2434
|
-
).forEach((
|
|
2585
|
+
).forEach((f) => {
|
|
2435
2586
|
var S;
|
|
2436
|
-
const b = createRegisterComponentMessage(
|
|
2587
|
+
const b = createRegisterComponentMessage(f);
|
|
2437
2588
|
(S = window.parent) == null || S.postMessage(b, "*");
|
|
2438
2589
|
}), window.addEventListener(
|
|
2439
2590
|
"builder:component:stateChangeListenerActivated",
|
|
2440
2591
|
T
|
|
2441
2592
|
);
|
|
2442
2593
|
}
|
|
2443
|
-
function R(
|
|
2444
|
-
const
|
|
2594
|
+
function R(m) {
|
|
2595
|
+
const f = new URL(location.href).searchParams, b = f.get("builder.preview"), S = f.get(
|
|
2445
2596
|
`builder.preview.${b}`
|
|
2446
|
-
), p =
|
|
2597
|
+
), p = f.get("apiKey") || f.get("builder.space");
|
|
2447
2598
|
b === e.model && p === e.apiKey && (!e.content || S === e.content.id) && fetchOneEntry({
|
|
2448
2599
|
model: e.model,
|
|
2449
2600
|
apiKey: e.apiKey,
|
|
2450
2601
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2451
2602
|
}).then((k) => {
|
|
2452
|
-
k &&
|
|
2603
|
+
k && a(k);
|
|
2453
2604
|
});
|
|
2454
2605
|
}
|
|
2455
2606
|
return useEffect(() => {
|
|
2456
|
-
var
|
|
2457
|
-
return (
|
|
2607
|
+
var m;
|
|
2608
|
+
return (m = t.current) == null || m.addEventListener(
|
|
2458
2609
|
"initeditingbldr",
|
|
2459
2610
|
w
|
|
2460
2611
|
), () => {
|
|
2461
|
-
var
|
|
2462
|
-
return (
|
|
2612
|
+
var f;
|
|
2613
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2463
2614
|
"initeditingbldr",
|
|
2464
2615
|
w
|
|
2465
2616
|
);
|
|
2466
2617
|
};
|
|
2467
2618
|
}, []), useEffect(() => {
|
|
2468
|
-
var
|
|
2469
|
-
return (
|
|
2619
|
+
var m;
|
|
2620
|
+
return (m = t.current) == null || m.addEventListener(
|
|
2470
2621
|
"initpreviewingbldr",
|
|
2471
2622
|
R
|
|
2472
2623
|
), () => {
|
|
2473
|
-
var
|
|
2474
|
-
return (
|
|
2624
|
+
var f;
|
|
2625
|
+
return (f = t.current) == null ? void 0 : f.removeEventListener(
|
|
2475
2626
|
"initpreviewingbldr",
|
|
2476
2627
|
R
|
|
2477
2628
|
);
|
|
2478
2629
|
};
|
|
2479
2630
|
}, []), useEffect(() => {
|
|
2480
|
-
var
|
|
2631
|
+
var m, f;
|
|
2481
2632
|
if (isBrowser()) {
|
|
2482
2633
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2483
|
-
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;
|
|
2484
2635
|
_track({
|
|
2485
2636
|
type: "impression",
|
|
2486
2637
|
canTrack: !0,
|
|
@@ -2494,18 +2645,15 @@ function EnableEditor(e) {
|
|
|
2494
2645
|
}, []), useEffect(() => {
|
|
2495
2646
|
e.apiKey || logger.error(
|
|
2496
2647
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2497
|
-
),
|
|
2648
|
+
), h(), C(), T();
|
|
2498
2649
|
}, []), useEffect(() => {
|
|
2499
|
-
e.content &&
|
|
2650
|
+
e.content && a(e.content);
|
|
2500
2651
|
}, [e.content]), useEffect(() => {
|
|
2501
|
-
}, [
|
|
2502
|
-
|
|
2503
|
-
}, [
|
|
2504
|
-
(P = (j = e.builderContextSignal.content) == null ? void 0 : j.data) == null ? void 0 : P.jsCode,
|
|
2505
|
-
e.builderContextSignal.rootState
|
|
2506
|
-
]), useEffect(() => {
|
|
2652
|
+
}, [r]), useEffect(() => {
|
|
2653
|
+
h();
|
|
2654
|
+
}, [(B = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : B.jsCode]), useEffect(() => {
|
|
2507
2655
|
C();
|
|
2508
|
-
}, [(
|
|
2656
|
+
}, [(N = (P = e.builderContextSignal.content) == null ? void 0 : P.data) == null ? void 0 : N.httpRequests]), useEffect(() => {
|
|
2509
2657
|
T();
|
|
2510
2658
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
2511
2659
|
e.data && o(e.data);
|
|
@@ -2519,12 +2667,12 @@ function EnableEditor(e) {
|
|
|
2519
2667
|
T
|
|
2520
2668
|
));
|
|
2521
2669
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2522
|
-
|
|
2670
|
+
l,
|
|
2523
2671
|
{
|
|
2524
2672
|
key: n,
|
|
2525
2673
|
ref: t,
|
|
2526
|
-
onClick: (
|
|
2527
|
-
"builder-content-id": (
|
|
2674
|
+
onClick: (m) => I(m),
|
|
2675
|
+
"builder-content-id": (F = e.builderContextSignal.content) == null ? void 0 : F.id,
|
|
2528
2676
|
"builder-model": e.model,
|
|
2529
2677
|
...e.showContent ? {} : {
|
|
2530
2678
|
hidden: !0,
|
|
@@ -2537,8 +2685,8 @@ function EnableEditor(e) {
|
|
|
2537
2685
|
) }) : null });
|
|
2538
2686
|
}
|
|
2539
2687
|
const getCssFromFont = (e) => {
|
|
2540
|
-
var
|
|
2541
|
-
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], i = (
|
|
2688
|
+
var a, r;
|
|
2689
|
+
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], i = (r = e.fileUrl) != null ? r : (a = e == null ? void 0 : e.files) == null ? void 0 : a.regular;
|
|
2542
2690
|
let o = "";
|
|
2543
2691
|
if (i && t && n && (o += `
|
|
2544
2692
|
@font-face {
|
|
@@ -2551,11 +2699,11 @@ font-weight: 400;
|
|
|
2551
2699
|
for (const s in e.files) {
|
|
2552
2700
|
if (!(String(Number(s)) === s))
|
|
2553
2701
|
continue;
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2702
|
+
const c = e.files[s];
|
|
2703
|
+
c && c !== i && (o += `
|
|
2556
2704
|
@font-face {
|
|
2557
2705
|
font-family: "${t}";
|
|
2558
|
-
src: url('${
|
|
2706
|
+
src: url('${c}') format('woff2');
|
|
2559
2707
|
font-display: fallback;
|
|
2560
2708
|
font-weight: ${s};
|
|
2561
2709
|
}
|
|
@@ -2607,10 +2755,10 @@ const getRootStateInitialValue = ({
|
|
|
2607
2755
|
data: t,
|
|
2608
2756
|
locale: n
|
|
2609
2757
|
}) => {
|
|
2610
|
-
var
|
|
2611
|
-
const i = {}, o = ((
|
|
2612
|
-
return (s = (
|
|
2613
|
-
|
|
2758
|
+
var a, r, s;
|
|
2759
|
+
const i = {}, o = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.state) || {};
|
|
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);
|
|
2614
2762
|
}), {
|
|
2615
2763
|
...i,
|
|
2616
2764
|
...o,
|
|
@@ -2631,25 +2779,25 @@ const getRootStateInitialValue = ({
|
|
|
2631
2779
|
meta: e == null ? void 0 : e.meta
|
|
2632
2780
|
} : void 0;
|
|
2633
2781
|
function ContentComponent(e) {
|
|
2634
|
-
var
|
|
2782
|
+
var l, c, d, h, y, u, g;
|
|
2635
2783
|
const [t, n] = useState(
|
|
2636
2784
|
() => {
|
|
2637
|
-
var
|
|
2785
|
+
var x, I;
|
|
2638
2786
|
return getUpdateVariantVisibilityScript({
|
|
2639
2787
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2640
|
-
variationId: (
|
|
2788
|
+
variationId: (x = e.content) == null ? void 0 : x.testVariationId,
|
|
2641
2789
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2642
2790
|
contentId: (I = e.content) == null ? void 0 : I.id
|
|
2643
2791
|
});
|
|
2644
2792
|
}
|
|
2645
2793
|
);
|
|
2646
|
-
function i(
|
|
2794
|
+
function i(x) {
|
|
2647
2795
|
s((I) => ({
|
|
2648
2796
|
...I,
|
|
2649
|
-
rootState:
|
|
2797
|
+
rootState: x
|
|
2650
2798
|
}));
|
|
2651
2799
|
}
|
|
2652
|
-
const [o,
|
|
2800
|
+
const [o, a] = useState(
|
|
2653
2801
|
() => [
|
|
2654
2802
|
...getDefaultRegisteredComponents(),
|
|
2655
2803
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2660,8 +2808,8 @@ function ContentComponent(e) {
|
|
|
2660
2808
|
...components,
|
|
2661
2809
|
...e.customComponents || []
|
|
2662
2810
|
].reduce(
|
|
2663
|
-
(
|
|
2664
|
-
...
|
|
2811
|
+
(x, { component: I, ...E }) => ({
|
|
2812
|
+
...x,
|
|
2665
2813
|
[E.name]: {
|
|
2666
2814
|
component: I,
|
|
2667
2815
|
...serializeComponentInfo(E)
|
|
@@ -2669,7 +2817,7 @@ function ContentComponent(e) {
|
|
|
2669
2817
|
}),
|
|
2670
2818
|
{}
|
|
2671
2819
|
)
|
|
2672
|
-
), [
|
|
2820
|
+
), [r, s] = useState(() => ({
|
|
2673
2821
|
content: getContentInitialValue({
|
|
2674
2822
|
content: e.content,
|
|
2675
2823
|
data: e.data
|
|
@@ -2694,8 +2842,8 @@ function ContentComponent(e) {
|
|
|
2694
2842
|
...components,
|
|
2695
2843
|
...e.customComponents || []
|
|
2696
2844
|
].reduce(
|
|
2697
|
-
(
|
|
2698
|
-
...
|
|
2845
|
+
(x, { component: I, ...E }) => ({
|
|
2846
|
+
...x,
|
|
2699
2847
|
[E.name]: serializeComponentInfo(E)
|
|
2700
2848
|
}),
|
|
2701
2849
|
{}
|
|
@@ -2723,7 +2871,7 @@ function ContentComponent(e) {
|
|
|
2723
2871
|
includeRefs: e.includeRefs,
|
|
2724
2872
|
enrich: e.enrich,
|
|
2725
2873
|
showContent: e.showContent,
|
|
2726
|
-
builderContextSignal:
|
|
2874
|
+
builderContextSignal: r,
|
|
2727
2875
|
contentWrapper: e.contentWrapper,
|
|
2728
2876
|
contentWrapperProps: e.contentWrapperProps,
|
|
2729
2877
|
linkComponent: e.linkComponent,
|
|
@@ -2734,16 +2882,16 @@ function ContentComponent(e) {
|
|
|
2734
2882
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2735
2883
|
ContentStyles,
|
|
2736
2884
|
{
|
|
2737
|
-
contentId: (
|
|
2738
|
-
cssCode: (d = (
|
|
2739
|
-
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
|
|
2740
2888
|
}
|
|
2741
2889
|
) }),
|
|
2742
2890
|
/* @__PURE__ */ jsx(
|
|
2743
2891
|
Blocks,
|
|
2744
2892
|
{
|
|
2745
|
-
blocks: (
|
|
2746
|
-
context:
|
|
2893
|
+
blocks: (g = (u = r.content) == null ? void 0 : u.data) == null ? void 0 : g.blocks,
|
|
2894
|
+
context: r,
|
|
2747
2895
|
registeredComponents: o,
|
|
2748
2896
|
linkComponent: e.linkComponent
|
|
2749
2897
|
}
|
|
@@ -2755,7 +2903,7 @@ function ContentComponent(e) {
|
|
|
2755
2903
|
);
|
|
2756
2904
|
}
|
|
2757
2905
|
function ContentVariants(e) {
|
|
2758
|
-
var
|
|
2906
|
+
var r, s;
|
|
2759
2907
|
const [t, n] = useState(
|
|
2760
2908
|
() => checkShouldRenderVariants({
|
|
2761
2909
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
@@ -2763,23 +2911,23 @@ function ContentVariants(e) {
|
|
|
2763
2911
|
})
|
|
2764
2912
|
);
|
|
2765
2913
|
function i() {
|
|
2766
|
-
var
|
|
2914
|
+
var l;
|
|
2767
2915
|
return getUpdateCookieAndStylesScript(
|
|
2768
|
-
getVariants(e.content).map((
|
|
2769
|
-
id:
|
|
2770
|
-
testRatio:
|
|
2916
|
+
getVariants(e.content).map((c) => ({
|
|
2917
|
+
id: c.testVariationId,
|
|
2918
|
+
testRatio: c.testRatio
|
|
2771
2919
|
})),
|
|
2772
|
-
((
|
|
2920
|
+
((l = e.content) == null ? void 0 : l.id) || ""
|
|
2773
2921
|
);
|
|
2774
2922
|
}
|
|
2775
2923
|
function o() {
|
|
2776
|
-
return getVariants(e.content).map((
|
|
2924
|
+
return getVariants(e.content).map((l) => `.variant-${l.testVariationId} { display: none; } `).join("");
|
|
2777
2925
|
}
|
|
2778
|
-
function
|
|
2779
|
-
var
|
|
2926
|
+
function a() {
|
|
2927
|
+
var l;
|
|
2780
2928
|
return t ? {
|
|
2781
2929
|
...e.content,
|
|
2782
|
-
testVariationId: (
|
|
2930
|
+
testVariationId: (l = e.content) == null ? void 0 : l.id
|
|
2783
2931
|
} : handleABTestingSync({
|
|
2784
2932
|
item: e.content,
|
|
2785
2933
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
@@ -2792,15 +2940,15 @@ function ContentVariants(e) {
|
|
|
2792
2940
|
/* @__PURE__ */ jsx(
|
|
2793
2941
|
InlinedStyles,
|
|
2794
2942
|
{
|
|
2795
|
-
id: `variants-styles-${(
|
|
2943
|
+
id: `variants-styles-${(r = e.content) == null ? void 0 : r.id}`,
|
|
2796
2944
|
styles: o()
|
|
2797
2945
|
}
|
|
2798
2946
|
),
|
|
2799
2947
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2800
|
-
(s = getVariants(e.content)) == null ? void 0 : s.map((
|
|
2948
|
+
(s = getVariants(e.content)) == null ? void 0 : s.map((l) => /* @__PURE__ */ jsx(
|
|
2801
2949
|
ContentComponent,
|
|
2802
2950
|
{
|
|
2803
|
-
content:
|
|
2951
|
+
content: l,
|
|
2804
2952
|
showContent: !1,
|
|
2805
2953
|
model: e.model,
|
|
2806
2954
|
data: e.data,
|
|
@@ -2820,13 +2968,13 @@ function ContentVariants(e) {
|
|
|
2820
2968
|
contentWrapperProps: e.contentWrapperProps,
|
|
2821
2969
|
trustedHosts: e.trustedHosts
|
|
2822
2970
|
},
|
|
2823
|
-
|
|
2971
|
+
l.testVariationId
|
|
2824
2972
|
))
|
|
2825
2973
|
] }) : null,
|
|
2826
2974
|
/* @__PURE__ */ jsx(
|
|
2827
2975
|
ContentComponent,
|
|
2828
2976
|
{
|
|
2829
|
-
content:
|
|
2977
|
+
content: a(),
|
|
2830
2978
|
showContent: !0,
|
|
2831
2979
|
model: e.model,
|
|
2832
2980
|
data: e.data,
|
|
@@ -2869,26 +3017,26 @@ const fetchSymbolContent = async ({
|
|
|
2869
3017
|
});
|
|
2870
3018
|
};
|
|
2871
3019
|
function Symbol$1(e) {
|
|
2872
|
-
var
|
|
3020
|
+
var a, r, s, l;
|
|
2873
3021
|
function t() {
|
|
2874
|
-
var
|
|
3022
|
+
var c, d;
|
|
2875
3023
|
return [
|
|
2876
3024
|
e.attributes[getClassPropName()],
|
|
2877
3025
|
"builder-symbol",
|
|
2878
|
-
(
|
|
3026
|
+
(c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
|
|
2879
3027
|
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2880
3028
|
].filter(Boolean).join(" ");
|
|
2881
3029
|
}
|
|
2882
3030
|
const [n, i] = useState(() => {
|
|
2883
|
-
var
|
|
2884
|
-
return (
|
|
3031
|
+
var c;
|
|
3032
|
+
return (c = e.symbol) == null ? void 0 : c.content;
|
|
2885
3033
|
});
|
|
2886
3034
|
function o() {
|
|
2887
3035
|
n || fetchSymbolContent({
|
|
2888
3036
|
symbol: e.symbol,
|
|
2889
3037
|
builderContextValue: e.builderContext
|
|
2890
|
-
}).then((
|
|
2891
|
-
|
|
3038
|
+
}).then((c) => {
|
|
3039
|
+
c && i(c);
|
|
2892
3040
|
});
|
|
2893
3041
|
}
|
|
2894
3042
|
return useEffect(() => {
|
|
@@ -2902,15 +3050,15 @@ function Symbol$1(e) {
|
|
|
2902
3050
|
apiKey: e.builderContext.apiKey,
|
|
2903
3051
|
context: {
|
|
2904
3052
|
...e.builderContext.context,
|
|
2905
|
-
symbolId: (
|
|
3053
|
+
symbolId: (a = e.builderBlock) == null ? void 0 : a.id
|
|
2906
3054
|
},
|
|
2907
3055
|
customComponents: Object.values(e.builderComponents),
|
|
2908
3056
|
data: {
|
|
2909
|
-
...(
|
|
3057
|
+
...(r = e.symbol) == null ? void 0 : r.data,
|
|
2910
3058
|
...e.builderContext.localState,
|
|
2911
3059
|
...(s = n == null ? void 0 : n.data) == null ? void 0 : s.state
|
|
2912
3060
|
},
|
|
2913
|
-
model: (
|
|
3061
|
+
model: (l = e.symbol) == null ? void 0 : l.model,
|
|
2914
3062
|
content: n,
|
|
2915
3063
|
linkComponent: e.builderLinkComponent
|
|
2916
3064
|
}
|