@builder.io/sdk-react 0.12.4 → 0.12.6
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 +24 -24
- package/lib/browser/index.mjs +485 -461
- package/lib/{edge/server-entry-0e4f0637.js → browser/server-entry-b9bdd327.js} +4 -4
- package/lib/browser/{server-entry-bcb725be.cjs → server-entry-fc715776.cjs} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/index.cjs +31 -31
- package/lib/edge/index.mjs +550 -525
- package/lib/{browser/server-entry-0e4f0637.js → edge/server-entry-57d4ae22.js} +3 -3
- package/lib/edge/{server-entry-bcb725be.cjs → server-entry-fc715776.cjs} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/node/index.cjs +10 -10
- package/lib/node/index.mjs +283 -258
- package/lib/node/{server-entry-9aa733e8.js → server-entry-0457c4c8.js} +2 -2
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/browser-runtime/browser.d.ts +5 -1
- package/types/functions/evaluate/should-force-browser-runtime-in-node.d.ts +1 -0
package/lib/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useState, useContext, useRef, useEffect, createElement } from "react";
|
|
4
|
-
import { T as TARGET, i as isEditing, j as isBrowser, k as getUserAttributes, l as fastClone, m as
|
|
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-
|
|
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
|
+
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";
|
|
7
7
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), isEmptyElement = (e) => typeof e == "string" && EMPTY_HTML_ELEMENTS.has(e.toLowerCase());
|
|
8
8
|
function DynamicRenderer(e) {
|
|
@@ -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
|
-
const
|
|
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(...
|
|
108
|
+
return new Function(...s.map(([c]) => c), e)(...s.map(([, c]) => c));
|
|
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,22 +202,22 @@ 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
|
-
const
|
|
192
|
-
...
|
|
208
|
+
const s = fastClone({
|
|
209
|
+
...r,
|
|
193
210
|
...o
|
|
194
211
|
}), c = getFunctionArguments({
|
|
195
212
|
builder: t,
|
|
196
213
|
context: n,
|
|
197
214
|
event: i,
|
|
198
|
-
state:
|
|
199
|
-
}),
|
|
215
|
+
state: s
|
|
216
|
+
}), l = getIsolateContext(), d = l.global;
|
|
200
217
|
d.setSync("global", d.derefInto()), d.setSync("log", function(...f) {
|
|
201
218
|
console.log(...f);
|
|
202
219
|
}), d.setSync(BUILDER_SET_STATE_NAME, function(f, h) {
|
|
203
|
-
set(
|
|
220
|
+
set(r, f, h), a == null || a(r);
|
|
204
221
|
}), c.forEach(([f, h]) => {
|
|
205
222
|
const y = typeof h == "object" ? new ivm.Reference(
|
|
206
223
|
// workaround: methods with default values for arguments is not being cloned over
|
|
@@ -214,39 +231,50 @@ output;
|
|
|
214
231
|
const g = processCode({
|
|
215
232
|
code: e,
|
|
216
233
|
args: c
|
|
217
|
-
}), x =
|
|
234
|
+
}), x = l.evalSync(g);
|
|
218
235
|
try {
|
|
219
236
|
return JSON.parse(x);
|
|
220
237
|
} catch {
|
|
221
238
|
return x;
|
|
222
239
|
}
|
|
223
|
-
}
|
|
240
|
+
};
|
|
241
|
+
function isNodeRuntime() {
|
|
242
|
+
var e;
|
|
243
|
+
return typeof process != "undefined" && checkIsDefined((e = process == null ? void 0 : process.versions) == null ? void 0 : e.node);
|
|
244
|
+
}
|
|
245
|
+
const shouldForceBrowserRuntimeInNode = () => {
|
|
246
|
+
var i;
|
|
247
|
+
if (!isNodeRuntime())
|
|
248
|
+
return !1;
|
|
249
|
+
const e = process.arch === "arm64", t = process.version.startsWith("v20"), n = (i = process.env.NODE_OPTIONS) == null ? void 0 : i.includes("--no-node-snapshot");
|
|
250
|
+
return e && t && !n ? (logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "), !0) : !1;
|
|
251
|
+
}, chooseBrowserOrServerEval = (e) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(e) : runInNode(e);
|
|
224
252
|
function evaluate({
|
|
225
253
|
code: e,
|
|
226
254
|
context: t,
|
|
227
255
|
localState: n,
|
|
228
256
|
rootState: i,
|
|
229
257
|
rootSetState: o,
|
|
230
|
-
event:
|
|
231
|
-
isExpression:
|
|
258
|
+
event: a,
|
|
259
|
+
isExpression: r = !0
|
|
232
260
|
}) {
|
|
233
261
|
if (e === "") {
|
|
234
262
|
logger.warn("Skipping evaluation of empty code block.");
|
|
235
263
|
return;
|
|
236
264
|
}
|
|
237
|
-
const
|
|
265
|
+
const s = {
|
|
238
266
|
code: parseCode(e, {
|
|
239
|
-
isExpression:
|
|
267
|
+
isExpression: r
|
|
240
268
|
}),
|
|
241
269
|
builder: getBuilderGlobals(),
|
|
242
270
|
context: t,
|
|
243
|
-
event:
|
|
271
|
+
event: a,
|
|
244
272
|
rootSetState: o,
|
|
245
273
|
rootState: i,
|
|
246
274
|
localState: n
|
|
247
275
|
};
|
|
248
276
|
try {
|
|
249
|
-
return chooseBrowserOrServerEval(
|
|
277
|
+
return chooseBrowserOrServerEval(s);
|
|
250
278
|
} catch (c) {
|
|
251
279
|
logger.error("Failed code evaluation: " + c.message, {
|
|
252
280
|
code: e
|
|
@@ -266,26 +294,26 @@ const evaluateBindings = ({
|
|
|
266
294
|
}) => {
|
|
267
295
|
if (!e.bindings)
|
|
268
296
|
return e;
|
|
269
|
-
const
|
|
270
|
-
...
|
|
297
|
+
const a = fastClone(e), r = {
|
|
298
|
+
...a,
|
|
271
299
|
properties: {
|
|
272
|
-
...
|
|
300
|
+
...a.properties
|
|
273
301
|
},
|
|
274
302
|
actions: {
|
|
275
|
-
...
|
|
303
|
+
...a.actions
|
|
276
304
|
}
|
|
277
305
|
};
|
|
278
|
-
for (const
|
|
279
|
-
const c = e.bindings[
|
|
306
|
+
for (const s in e.bindings) {
|
|
307
|
+
const c = e.bindings[s], l = evaluate({
|
|
280
308
|
code: c,
|
|
281
309
|
localState: n,
|
|
282
310
|
rootState: i,
|
|
283
311
|
rootSetState: o,
|
|
284
312
|
context: t
|
|
285
313
|
});
|
|
286
|
-
set(
|
|
314
|
+
set(r, s, l);
|
|
287
315
|
}
|
|
288
|
-
return
|
|
316
|
+
return r;
|
|
289
317
|
};
|
|
290
318
|
function getProcessedBlock({
|
|
291
319
|
block: e,
|
|
@@ -293,31 +321,31 @@ function getProcessedBlock({
|
|
|
293
321
|
shouldEvaluateBindings: n,
|
|
294
322
|
localState: i,
|
|
295
323
|
rootState: o,
|
|
296
|
-
rootSetState:
|
|
324
|
+
rootSetState: a
|
|
297
325
|
}) {
|
|
298
|
-
const
|
|
326
|
+
const r = e;
|
|
299
327
|
return n ? evaluateBindings({
|
|
300
|
-
block:
|
|
328
|
+
block: r,
|
|
301
329
|
localState: i,
|
|
302
330
|
rootState: o,
|
|
303
|
-
rootSetState:
|
|
331
|
+
rootSetState: a,
|
|
304
332
|
context: t
|
|
305
|
-
}) :
|
|
333
|
+
}) : r;
|
|
306
334
|
}
|
|
307
335
|
const getComponent = ({
|
|
308
336
|
block: e,
|
|
309
337
|
context: t,
|
|
310
338
|
registeredComponents: n
|
|
311
339
|
}) => {
|
|
312
|
-
var
|
|
313
|
-
const i = (
|
|
340
|
+
var a;
|
|
341
|
+
const i = (a = getProcessedBlock({
|
|
314
342
|
block: e,
|
|
315
343
|
localState: t.localState,
|
|
316
344
|
rootState: t.rootState,
|
|
317
345
|
rootSetState: t.rootSetState,
|
|
318
346
|
context: t.context,
|
|
319
347
|
shouldEvaluateBindings: !1
|
|
320
|
-
}).component) == null ? void 0 :
|
|
348
|
+
}).component) == null ? void 0 : a.name;
|
|
321
349
|
if (!i)
|
|
322
350
|
return null;
|
|
323
351
|
const o = n[i];
|
|
@@ -345,16 +373,16 @@ const getComponent = ({
|
|
|
345
373
|
});
|
|
346
374
|
if (!Array.isArray(o))
|
|
347
375
|
return;
|
|
348
|
-
const
|
|
349
|
-
return o.map((c,
|
|
376
|
+
const a = n.collection.split(".").pop(), r = n.itemName || (a ? a + "Item" : "item");
|
|
377
|
+
return o.map((c, l) => ({
|
|
350
378
|
context: {
|
|
351
379
|
...t,
|
|
352
380
|
localState: {
|
|
353
381
|
...t.localState,
|
|
354
|
-
$index:
|
|
382
|
+
$index: l,
|
|
355
383
|
$item: c,
|
|
356
|
-
[
|
|
357
|
-
[`$${
|
|
384
|
+
[r]: c,
|
|
385
|
+
[`$${r}Index`]: l
|
|
358
386
|
}
|
|
359
387
|
},
|
|
360
388
|
block: i
|
|
@@ -394,12 +422,12 @@ const getComponent = ({
|
|
|
394
422
|
min: o,
|
|
395
423
|
default: o + 1
|
|
396
424
|
};
|
|
397
|
-
const
|
|
425
|
+
const a = n.medium.max + 1;
|
|
398
426
|
return n.large = {
|
|
399
427
|
max: 2e3,
|
|
400
428
|
// TODO: decide upper limit
|
|
401
|
-
min:
|
|
402
|
-
default:
|
|
429
|
+
min: a,
|
|
430
|
+
default: a + 1
|
|
403
431
|
}, n;
|
|
404
432
|
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, i]) => {
|
|
405
433
|
if (typeof i == "string")
|
|
@@ -441,27 +469,27 @@ function BlockStyles(e) {
|
|
|
441
469
|
rootSetState: e.context.rootSetState,
|
|
442
470
|
context: e.context.context,
|
|
443
471
|
shouldEvaluateBindings: !0
|
|
444
|
-
}), o = i.responsiveStyles,
|
|
445
|
-
((h =
|
|
446
|
-
),
|
|
472
|
+
}), o = i.responsiveStyles, a = e.context.content, r = getSizesForBreakpoints(
|
|
473
|
+
((h = a == null ? void 0 : a.meta) == null ? void 0 : h.breakpoints) || {}
|
|
474
|
+
), s = o == null ? void 0 : o.large, c = o == null ? void 0 : o.medium, l = o == null ? void 0 : o.small, d = i.id;
|
|
447
475
|
if (!d)
|
|
448
476
|
return "";
|
|
449
|
-
const g =
|
|
477
|
+
const g = s ? createCssClass({
|
|
450
478
|
className: d,
|
|
451
|
-
styles:
|
|
479
|
+
styles: s
|
|
452
480
|
}) : "", x = c ? createCssClass({
|
|
453
481
|
className: d,
|
|
454
482
|
styles: c,
|
|
455
483
|
mediaQuery: getMaxWidthQueryForSize(
|
|
456
484
|
"medium",
|
|
457
|
-
|
|
485
|
+
r
|
|
458
486
|
)
|
|
459
|
-
}) : "", f =
|
|
487
|
+
}) : "", f = l ? createCssClass({
|
|
460
488
|
className: d,
|
|
461
|
-
styles:
|
|
489
|
+
styles: l,
|
|
462
490
|
mediaQuery: getMaxWidthQueryForSize(
|
|
463
491
|
"small",
|
|
464
|
-
|
|
492
|
+
r
|
|
465
493
|
)
|
|
466
494
|
}) : "";
|
|
467
495
|
return [g, x, f].join(" ");
|
|
@@ -486,18 +514,18 @@ function getBlockActions(e) {
|
|
|
486
514
|
for (const o in n) {
|
|
487
515
|
if (!n.hasOwnProperty(o))
|
|
488
516
|
continue;
|
|
489
|
-
const
|
|
490
|
-
let
|
|
517
|
+
const a = n[o];
|
|
518
|
+
let r = getEventHandlerName(o);
|
|
491
519
|
if (e.stripPrefix)
|
|
492
520
|
switch (TARGET) {
|
|
493
521
|
case "vue":
|
|
494
|
-
|
|
522
|
+
r = r.replace("v-on:", "");
|
|
495
523
|
break;
|
|
496
524
|
case "svelte":
|
|
497
|
-
|
|
525
|
+
r = r.replace("on:", "");
|
|
498
526
|
break;
|
|
499
527
|
}
|
|
500
|
-
t[
|
|
528
|
+
t[r] = createEventHandler(a, e);
|
|
501
529
|
}
|
|
502
530
|
return t;
|
|
503
531
|
}
|
|
@@ -605,10 +633,10 @@ const getWrapperProps = ({
|
|
|
605
633
|
context: n,
|
|
606
634
|
componentRef: i,
|
|
607
635
|
includeBlockProps: o,
|
|
608
|
-
isInteractive:
|
|
609
|
-
contextValue:
|
|
636
|
+
isInteractive: a,
|
|
637
|
+
contextValue: r
|
|
610
638
|
}) => {
|
|
611
|
-
const
|
|
639
|
+
const s = {
|
|
612
640
|
...e,
|
|
613
641
|
/**
|
|
614
642
|
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
@@ -617,17 +645,17 @@ const getWrapperProps = ({
|
|
|
617
645
|
...o ? {
|
|
618
646
|
attributes: getBlockProperties({
|
|
619
647
|
block: t,
|
|
620
|
-
context:
|
|
648
|
+
context: r
|
|
621
649
|
})
|
|
622
650
|
} : {}
|
|
623
651
|
};
|
|
624
|
-
return
|
|
652
|
+
return a ? {
|
|
625
653
|
Wrapper: i,
|
|
626
654
|
block: t,
|
|
627
655
|
context: n,
|
|
628
656
|
wrapperProps: e,
|
|
629
657
|
includeBlockProps: o
|
|
630
|
-
} :
|
|
658
|
+
} : s;
|
|
631
659
|
};
|
|
632
660
|
function ComponentRef(e) {
|
|
633
661
|
var i;
|
|
@@ -702,19 +730,19 @@ function Block(e) {
|
|
|
702
730
|
var h;
|
|
703
731
|
return e.block.tagName === "a" || ((h = i().properties) == null ? void 0 : h.href) || i().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
704
732
|
}
|
|
705
|
-
function
|
|
733
|
+
function a() {
|
|
706
734
|
var y, I;
|
|
707
735
|
if ((y = e.block.repeat) != null && y.collection)
|
|
708
736
|
return !!((I = n == null ? void 0 : n()) != null && I.length);
|
|
709
737
|
const f = "hide" in i() ? i().hide : !1;
|
|
710
738
|
return ("show" in i() ? i().show : !0) && !f;
|
|
711
739
|
}
|
|
712
|
-
function
|
|
740
|
+
function r() {
|
|
713
741
|
var h, y;
|
|
714
742
|
return !((h = t == null ? void 0 : t()) != null && h.component) && !n() ? (y = i().children) != null ? y : [] : [];
|
|
715
743
|
}
|
|
716
|
-
function
|
|
717
|
-
var f, h, y, I, E,
|
|
744
|
+
function s() {
|
|
745
|
+
var f, h, y, I, E, v, C, T, w;
|
|
718
746
|
return {
|
|
719
747
|
blockChildren: (f = i().children) != null ? f : [],
|
|
720
748
|
componentRef: (h = t == null ? void 0 : t()) == null ? void 0 : h.component,
|
|
@@ -724,7 +752,7 @@ function Block(e) {
|
|
|
724
752
|
...((y = t == null ? void 0 : t()) == null ? void 0 : y.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" ? {
|
|
725
753
|
builderLinkComponent: e.linkComponent
|
|
726
754
|
} : {},
|
|
727
|
-
...((
|
|
755
|
+
...((v = t == null ? void 0 : t()) == null ? void 0 : v.name) === "Symbol" || ((C = t == null ? void 0 : t()) == null ? void 0 : C.name) === "Columns" ? {
|
|
728
756
|
builderComponents: e.registeredComponents
|
|
729
757
|
} : {}
|
|
730
758
|
},
|
|
@@ -736,21 +764,21 @@ function Block(e) {
|
|
|
736
764
|
isInteractive: !((w = t == null ? void 0 : t()) != null && w.isRSC)
|
|
737
765
|
};
|
|
738
766
|
}
|
|
739
|
-
const [c,
|
|
740
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
767
|
+
const [c, l] = useState(() => e.context);
|
|
768
|
+
return /* @__PURE__ */ jsx(Fragment, { children: a() ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
741
769
|
/* @__PURE__ */ jsx(BlockStyles, { block: e.block, context: e.context }),
|
|
742
770
|
(d = t == null ? void 0 : t()) != null && d.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
743
771
|
ComponentRef,
|
|
744
772
|
{
|
|
745
|
-
componentRef:
|
|
746
|
-
componentOptions:
|
|
747
|
-
blockChildren:
|
|
748
|
-
context:
|
|
749
|
-
registeredComponents:
|
|
750
|
-
linkComponent:
|
|
751
|
-
builderBlock:
|
|
752
|
-
includeBlockProps:
|
|
753
|
-
isInteractive:
|
|
773
|
+
componentRef: s().componentRef,
|
|
774
|
+
componentOptions: s().componentOptions,
|
|
775
|
+
blockChildren: s().blockChildren,
|
|
776
|
+
context: s().context,
|
|
777
|
+
registeredComponents: s().registeredComponents,
|
|
778
|
+
linkComponent: s().linkComponent,
|
|
779
|
+
builderBlock: s().builderBlock,
|
|
780
|
+
includeBlockProps: s().includeBlockProps,
|
|
781
|
+
isInteractive: s().isInteractive
|
|
754
782
|
}
|
|
755
783
|
) }) : /* @__PURE__ */ jsx(Fragment, { children: n() ? /* @__PURE__ */ jsx(Fragment, { children: (x = n()) == null ? void 0 : x.map((f, h) => /* @__PURE__ */ jsx(
|
|
756
784
|
RepeatedBlock,
|
|
@@ -772,18 +800,18 @@ function Block(e) {
|
|
|
772
800
|
/* @__PURE__ */ jsx(
|
|
773
801
|
ComponentRef,
|
|
774
802
|
{
|
|
775
|
-
componentRef:
|
|
776
|
-
componentOptions:
|
|
777
|
-
blockChildren:
|
|
778
|
-
context:
|
|
779
|
-
registeredComponents:
|
|
780
|
-
linkComponent:
|
|
781
|
-
builderBlock:
|
|
782
|
-
includeBlockProps:
|
|
783
|
-
isInteractive:
|
|
803
|
+
componentRef: s().componentRef,
|
|
804
|
+
componentOptions: s().componentOptions,
|
|
805
|
+
blockChildren: s().blockChildren,
|
|
806
|
+
context: s().context,
|
|
807
|
+
registeredComponents: s().registeredComponents,
|
|
808
|
+
linkComponent: s().linkComponent,
|
|
809
|
+
builderBlock: s().builderBlock,
|
|
810
|
+
includeBlockProps: s().includeBlockProps,
|
|
811
|
+
isInteractive: s().isInteractive
|
|
784
812
|
}
|
|
785
813
|
),
|
|
786
|
-
(g =
|
|
814
|
+
(g = r()) == null ? void 0 : g.map((f) => /* @__PURE__ */ jsx(
|
|
787
815
|
Block,
|
|
788
816
|
{
|
|
789
817
|
block: f,
|
|
@@ -804,8 +832,8 @@ function BlocksWrapper(e) {
|
|
|
804
832
|
return "builder-blocks" + ((o = e.blocks) != null && o.length ? "" : " no-blocks");
|
|
805
833
|
}
|
|
806
834
|
function n() {
|
|
807
|
-
var o,
|
|
808
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
835
|
+
var o, a;
|
|
836
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((a = window.parent) == null || a.postMessage(
|
|
809
837
|
{
|
|
810
838
|
type: "builder.clickEmptyBlocks",
|
|
811
839
|
data: {
|
|
@@ -817,8 +845,8 @@ function BlocksWrapper(e) {
|
|
|
817
845
|
));
|
|
818
846
|
}
|
|
819
847
|
function i() {
|
|
820
|
-
var o,
|
|
821
|
-
isEditing() && !((o = e.blocks) != null && o.length) && ((
|
|
848
|
+
var o, a;
|
|
849
|
+
isEditing() && !((o = e.blocks) != null && o.length) && ((a = window.parent) == null || a.postMessage(
|
|
822
850
|
{
|
|
823
851
|
type: "builder.hoverEmptyBlocks",
|
|
824
852
|
data: {
|
|
@@ -852,7 +880,7 @@ function BlocksWrapper(e) {
|
|
|
852
880
|
] });
|
|
853
881
|
}
|
|
854
882
|
function Blocks(e) {
|
|
855
|
-
var i, o,
|
|
883
|
+
var i, o, a;
|
|
856
884
|
const t = useContext(builderContext), n = useContext(ComponentsContext);
|
|
857
885
|
return /* @__PURE__ */ jsx(
|
|
858
886
|
BlocksWrapper,
|
|
@@ -863,15 +891,15 @@ function Blocks(e) {
|
|
|
863
891
|
styleProp: e.styleProp,
|
|
864
892
|
BlocksWrapper: (i = e.context) == null ? void 0 : i.BlocksWrapper,
|
|
865
893
|
BlocksWrapperProps: (o = e.context) == null ? void 0 : o.BlocksWrapperProps,
|
|
866
|
-
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
894
|
+
children: e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (a = e.blocks) == null ? void 0 : a.map((r) => /* @__PURE__ */ jsx(
|
|
867
895
|
Block,
|
|
868
896
|
{
|
|
869
|
-
block:
|
|
897
|
+
block: r,
|
|
870
898
|
linkComponent: e.linkComponent,
|
|
871
899
|
context: e.context || t,
|
|
872
900
|
registeredComponents: e.registeredComponents || n.registeredComponents
|
|
873
901
|
},
|
|
874
|
-
|
|
902
|
+
r.id
|
|
875
903
|
)) }) : null
|
|
876
904
|
}
|
|
877
905
|
);
|
|
@@ -880,28 +908,28 @@ function Columns(e) {
|
|
|
880
908
|
var E;
|
|
881
909
|
const [t, n] = useState(
|
|
882
910
|
() => typeof e.space == "number" ? e.space || 0 : 20
|
|
883
|
-
), [i, o] = useState(() => e.columns || []), [
|
|
911
|
+
), [i, o] = useState(() => e.columns || []), [a, r] = useState(
|
|
884
912
|
() => e.stackColumnsAt || "tablet"
|
|
885
913
|
);
|
|
886
|
-
function
|
|
887
|
-
var
|
|
888
|
-
return ((
|
|
914
|
+
function s(v) {
|
|
915
|
+
var C;
|
|
916
|
+
return ((C = i[v]) == null ? void 0 : C.width) || 100 / i.length;
|
|
889
917
|
}
|
|
890
|
-
function c(
|
|
891
|
-
const
|
|
892
|
-
return `calc(${
|
|
918
|
+
function c(v) {
|
|
919
|
+
const C = t * (i.length - 1) / i.length;
|
|
920
|
+
return `calc(${s(v)}% - ${C}px)`;
|
|
893
921
|
}
|
|
894
|
-
function
|
|
895
|
-
stackedStyle:
|
|
896
|
-
desktopStyle:
|
|
922
|
+
function l({
|
|
923
|
+
stackedStyle: v,
|
|
924
|
+
desktopStyle: C
|
|
897
925
|
}) {
|
|
898
|
-
return
|
|
926
|
+
return a === "tablet" ? v : C;
|
|
899
927
|
}
|
|
900
928
|
function d({
|
|
901
|
-
stackedStyle:
|
|
902
|
-
desktopStyle:
|
|
929
|
+
stackedStyle: v,
|
|
930
|
+
desktopStyle: C
|
|
903
931
|
}) {
|
|
904
|
-
return
|
|
932
|
+
return a === "never" ? C : v;
|
|
905
933
|
}
|
|
906
934
|
const [g, x] = useState(
|
|
907
935
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
@@ -909,14 +937,14 @@ function Columns(e) {
|
|
|
909
937
|
function f() {
|
|
910
938
|
return {
|
|
911
939
|
"--flex-dir": g,
|
|
912
|
-
"--flex-dir-tablet":
|
|
940
|
+
"--flex-dir-tablet": l({
|
|
913
941
|
stackedStyle: g,
|
|
914
942
|
desktopStyle: "row"
|
|
915
943
|
})
|
|
916
944
|
};
|
|
917
945
|
}
|
|
918
|
-
function h(
|
|
919
|
-
const
|
|
946
|
+
function h(v) {
|
|
947
|
+
const C = v === 0 ? 0 : t, T = c(v), w = `${C}px`, R = "100%", j = 0;
|
|
920
948
|
return {
|
|
921
949
|
...{
|
|
922
950
|
display: "flex",
|
|
@@ -933,21 +961,21 @@ function Columns(e) {
|
|
|
933
961
|
stackedStyle: j,
|
|
934
962
|
desktopStyle: w
|
|
935
963
|
}),
|
|
936
|
-
"--column-width-tablet":
|
|
964
|
+
"--column-width-tablet": l({
|
|
937
965
|
stackedStyle: R,
|
|
938
966
|
desktopStyle: T
|
|
939
967
|
}),
|
|
940
|
-
"--column-margin-left-tablet":
|
|
968
|
+
"--column-margin-left-tablet": l({
|
|
941
969
|
stackedStyle: j,
|
|
942
970
|
desktopStyle: w
|
|
943
971
|
})
|
|
944
972
|
};
|
|
945
973
|
}
|
|
946
|
-
function y(
|
|
974
|
+
function y(v) {
|
|
947
975
|
var T, w;
|
|
948
976
|
return getSizesForBreakpoints(
|
|
949
977
|
((w = (T = e.builderContext.content) == null ? void 0 : T.meta) == null ? void 0 : w.breakpoints) || {}
|
|
950
|
-
)[
|
|
978
|
+
)[v].max;
|
|
951
979
|
}
|
|
952
980
|
function I() {
|
|
953
981
|
return `
|
|
@@ -984,22 +1012,22 @@ function Columns(e) {
|
|
|
984
1012
|
style: f(),
|
|
985
1013
|
children: [
|
|
986
1014
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedStyles, { styles: I() }) }),
|
|
987
|
-
(E = e.columns) == null ? void 0 : E.map((
|
|
1015
|
+
(E = e.columns) == null ? void 0 : E.map((v, C) => /* @__PURE__ */ jsx(
|
|
988
1016
|
DynamicRenderer,
|
|
989
1017
|
{
|
|
990
|
-
TagName:
|
|
1018
|
+
TagName: v.link ? e.builderLinkComponent || "a" : "div",
|
|
991
1019
|
actionAttributes: {},
|
|
992
1020
|
attributes: {
|
|
993
|
-
...
|
|
994
|
-
href:
|
|
1021
|
+
...v.link ? {
|
|
1022
|
+
href: v.link
|
|
995
1023
|
} : {},
|
|
996
1024
|
[getClassPropName()]: "builder-column",
|
|
997
|
-
style: mapStyleObjToStrIfNeeded(h(
|
|
1025
|
+
style: mapStyleObjToStrIfNeeded(h(C))
|
|
998
1026
|
},
|
|
999
1027
|
children: /* @__PURE__ */ jsx(
|
|
1000
1028
|
Blocks,
|
|
1001
1029
|
{
|
|
1002
|
-
path: `component.options.columns.${
|
|
1030
|
+
path: `component.options.columns.${C}.blocks`,
|
|
1003
1031
|
parent: e.builderBlock.id,
|
|
1004
1032
|
styleProp: {
|
|
1005
1033
|
flexGrow: "1"
|
|
@@ -1007,11 +1035,11 @@ function Columns(e) {
|
|
|
1007
1035
|
context: e.builderContext,
|
|
1008
1036
|
registeredComponents: e.builderComponents,
|
|
1009
1037
|
linkComponent: e.builderLinkComponent,
|
|
1010
|
-
blocks:
|
|
1038
|
+
blocks: v.blocks
|
|
1011
1039
|
}
|
|
1012
1040
|
)
|
|
1013
1041
|
},
|
|
1014
|
-
|
|
1042
|
+
C
|
|
1015
1043
|
))
|
|
1016
1044
|
]
|
|
1017
1045
|
}
|
|
@@ -1039,8 +1067,8 @@ function getShopifyImageUrl(e, t) {
|
|
|
1039
1067
|
return removeProtocol(e);
|
|
1040
1068
|
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
1041
1069
|
if (n) {
|
|
1042
|
-
const i = e.split(n[0]), o = n[3],
|
|
1043
|
-
return removeProtocol(`${i[0]}_${
|
|
1070
|
+
const i = e.split(n[0]), o = n[3], a = t.match("x") ? t : `${t}x`;
|
|
1071
|
+
return removeProtocol(`${i[0]}_${a}${o}`);
|
|
1044
1072
|
}
|
|
1045
1073
|
return null;
|
|
1046
1074
|
}
|
|
@@ -1056,20 +1084,20 @@ function getSrcSet(e) {
|
|
|
1056
1084
|
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;
|
|
1057
1085
|
}
|
|
1058
1086
|
function Image(e) {
|
|
1059
|
-
var o,
|
|
1087
|
+
var o, a, r, s;
|
|
1060
1088
|
function t() {
|
|
1061
1089
|
var d;
|
|
1062
|
-
const
|
|
1063
|
-
if (!
|
|
1090
|
+
const l = e.image || e.src;
|
|
1091
|
+
if (!l || // We can auto add srcset for cdn.builder.io and shopify
|
|
1064
1092
|
// images, otherwise you can supply this prop manually
|
|
1065
|
-
!(
|
|
1093
|
+
!(l.match(/builder\.io/) || l.match(/cdn\.shopify\.com/)))
|
|
1066
1094
|
return e.srcset;
|
|
1067
1095
|
if (e.srcset && ((d = e.image) != null && d.includes("builder.io/api/v1/image"))) {
|
|
1068
1096
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
1069
|
-
return console.debug("Removed given srcset"), getSrcSet(
|
|
1097
|
+
return console.debug("Removed given srcset"), getSrcSet(l);
|
|
1070
1098
|
} else if (e.image && !e.srcset)
|
|
1071
|
-
return getSrcSet(
|
|
1072
|
-
return getSrcSet(
|
|
1099
|
+
return getSrcSet(l);
|
|
1100
|
+
return getSrcSet(l);
|
|
1073
1101
|
}
|
|
1074
1102
|
function n() {
|
|
1075
1103
|
var c;
|
|
@@ -1107,7 +1135,7 @@ function Image(e) {
|
|
|
1107
1135
|
}
|
|
1108
1136
|
)
|
|
1109
1137
|
] }),
|
|
1110
|
-
e.aspectRatio && !((
|
|
1138
|
+
e.aspectRatio && !((a = (o = e.builderBlock) == null ? void 0 : o.children) != null && a.length && e.fitContent) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1111
1139
|
"div",
|
|
1112
1140
|
{
|
|
1113
1141
|
className: "builder-image-sizer div-40c70c9b",
|
|
@@ -1116,7 +1144,7 @@ function Image(e) {
|
|
|
1116
1144
|
}
|
|
1117
1145
|
}
|
|
1118
1146
|
) }) : null,
|
|
1119
|
-
(
|
|
1147
|
+
(s = (r = e.builderBlock) == null ? void 0 : r.children) != null && s.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: e.children }) : null,
|
|
1120
1148
|
!e.fitContent && e.children ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "div-40c70c9b-2", children: e.children }) }) : null
|
|
1121
1149
|
] }),
|
|
1122
1150
|
/* @__PURE__ */ jsx("style", { children: `.img-40c70c9b {
|
|
@@ -1371,7 +1399,7 @@ const componentInfo$b = {
|
|
|
1371
1399
|
});
|
|
1372
1400
|
}
|
|
1373
1401
|
const n = e.get("columns");
|
|
1374
|
-
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((
|
|
1402
|
+
Array.isArray(n) && n.find((o) => o.get("width")) && (n.find((a) => !a.get("width")) || n.reduce((s, c) => s + c.get("width"), 0) !== 100) && t();
|
|
1375
1403
|
}
|
|
1376
1404
|
}, {
|
|
1377
1405
|
name: "space",
|
|
@@ -1417,29 +1445,29 @@ const componentInfo$b = {
|
|
|
1417
1445
|
}]
|
|
1418
1446
|
};
|
|
1419
1447
|
function CustomCode(e) {
|
|
1420
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1448
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []);
|
|
1421
1449
|
return useEffect(() => {
|
|
1422
|
-
var
|
|
1423
|
-
if (!((
|
|
1450
|
+
var s;
|
|
1451
|
+
if (!((s = t.current) != null && s.getElementsByTagName) || typeof window == "undefined")
|
|
1424
1452
|
return;
|
|
1425
|
-
const
|
|
1426
|
-
for (let c = 0; c <
|
|
1427
|
-
const
|
|
1428
|
-
if (
|
|
1429
|
-
if (n.includes(
|
|
1453
|
+
const r = t.current.getElementsByTagName("script");
|
|
1454
|
+
for (let c = 0; c < r.length; c++) {
|
|
1455
|
+
const l = r[c];
|
|
1456
|
+
if (l.src) {
|
|
1457
|
+
if (n.includes(l.src))
|
|
1430
1458
|
continue;
|
|
1431
|
-
n.push(
|
|
1459
|
+
n.push(l.src);
|
|
1432
1460
|
const d = document.createElement("script");
|
|
1433
|
-
d.async = !0, d.src =
|
|
1434
|
-
} else if (!
|
|
1461
|
+
d.async = !0, d.src = l.src, document.head.appendChild(d);
|
|
1462
|
+
} else if (!l.type || [
|
|
1435
1463
|
"text/javascript",
|
|
1436
1464
|
"application/javascript",
|
|
1437
1465
|
"application/ecmascript"
|
|
1438
|
-
].includes(
|
|
1439
|
-
if (o.includes(
|
|
1466
|
+
].includes(l.type)) {
|
|
1467
|
+
if (o.includes(l.innerText))
|
|
1440
1468
|
continue;
|
|
1441
1469
|
try {
|
|
1442
|
-
o.push(
|
|
1470
|
+
o.push(l.innerText), new Function(l.innerText)();
|
|
1443
1471
|
} catch (d) {
|
|
1444
1472
|
console.warn("`CustomCode`: Error running script:", d);
|
|
1445
1473
|
}
|
|
@@ -1481,13 +1509,13 @@ const componentInfo$8 = {
|
|
|
1481
1509
|
}]
|
|
1482
1510
|
}, SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"], isJsScript = (e) => SCRIPT_MIME_TYPES.includes(e.type);
|
|
1483
1511
|
function Embed(e) {
|
|
1484
|
-
const t = useRef(null), [n, i] = useState(() => []), [o,
|
|
1512
|
+
const t = useRef(null), [n, i] = useState(() => []), [o, a] = useState(() => []), [r, s] = useState(() => !1);
|
|
1485
1513
|
function c() {
|
|
1486
1514
|
if (!t.current || !t.current.getElementsByTagName)
|
|
1487
1515
|
return;
|
|
1488
|
-
const
|
|
1489
|
-
for (let d = 0; d <
|
|
1490
|
-
const g =
|
|
1516
|
+
const l = t.current.getElementsByTagName("script");
|
|
1517
|
+
for (let d = 0; d < l.length; d++) {
|
|
1518
|
+
const g = l[d];
|
|
1491
1519
|
if (g.src && !n.includes(g.src)) {
|
|
1492
1520
|
n.push(g.src);
|
|
1493
1521
|
const x = document.createElement("script");
|
|
@@ -1501,8 +1529,8 @@ function Embed(e) {
|
|
|
1501
1529
|
}
|
|
1502
1530
|
}
|
|
1503
1531
|
return useEffect(() => {
|
|
1504
|
-
t.current && !
|
|
1505
|
-
}, [t.current,
|
|
1532
|
+
t.current && !r && (s(!0), c());
|
|
1533
|
+
}, [t.current, r]), /* @__PURE__ */ jsx(
|
|
1506
1534
|
"div",
|
|
1507
1535
|
{
|
|
1508
1536
|
className: "builder-embed",
|
|
@@ -1537,29 +1565,29 @@ const componentInfo$7 = {
|
|
|
1537
1565
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
1538
1566
|
onChange: (e) => {
|
|
1539
1567
|
e.delete("srcset"), e.delete("noWebp");
|
|
1540
|
-
function n(
|
|
1541
|
-
return new Promise((c,
|
|
1568
|
+
function n(r, s = 6e4) {
|
|
1569
|
+
return new Promise((c, l) => {
|
|
1542
1570
|
const d = document.createElement("img");
|
|
1543
1571
|
let g = !1;
|
|
1544
1572
|
d.onload = () => {
|
|
1545
1573
|
g = !0, c(d);
|
|
1546
1574
|
}, d.addEventListener("error", (x) => {
|
|
1547
|
-
console.warn("Image load failed", x.error),
|
|
1548
|
-
}), d.src =
|
|
1549
|
-
g ||
|
|
1550
|
-
},
|
|
1575
|
+
console.warn("Image load failed", x.error), l(x.error);
|
|
1576
|
+
}), d.src = r, setTimeout(() => {
|
|
1577
|
+
g || l(new Error("Image load timed out"));
|
|
1578
|
+
}, s);
|
|
1551
1579
|
});
|
|
1552
1580
|
}
|
|
1553
|
-
function i(
|
|
1554
|
-
return Math.round(
|
|
1581
|
+
function i(r) {
|
|
1582
|
+
return Math.round(r * 1e3) / 1e3;
|
|
1555
1583
|
}
|
|
1556
|
-
const o = e.get("image"),
|
|
1557
|
-
if (fetch(o).then((
|
|
1558
|
-
|
|
1559
|
-
}), o && (!
|
|
1560
|
-
return n(o).then((
|
|
1561
|
-
const
|
|
1562
|
-
e.get("image") === o && (!
|
|
1584
|
+
const o = e.get("image"), a = e.get("aspectRatio");
|
|
1585
|
+
if (fetch(o).then((r) => r.blob()).then((r) => {
|
|
1586
|
+
r.type.includes("svg") && e.set("noWebp", !0);
|
|
1587
|
+
}), o && (!a || a === 0.7041))
|
|
1588
|
+
return n(o).then((r) => {
|
|
1589
|
+
const s = e.get("aspectRatio");
|
|
1590
|
+
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));
|
|
1563
1591
|
});
|
|
1564
1592
|
}
|
|
1565
1593
|
}, {
|
|
@@ -1871,7 +1899,7 @@ const componentInfo = {
|
|
|
1871
1899
|
}]
|
|
1872
1900
|
};
|
|
1873
1901
|
function Video(e) {
|
|
1874
|
-
var i, o,
|
|
1902
|
+
var i, o, a, r, s, c, l;
|
|
1875
1903
|
function t() {
|
|
1876
1904
|
return {
|
|
1877
1905
|
...e.autoPlay === !0 ? {
|
|
@@ -1928,7 +1956,7 @@ function Video(e) {
|
|
|
1928
1956
|
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
1929
1957
|
}
|
|
1930
1958
|
),
|
|
1931
|
-
e.aspectRatio && !(e.fitContent && ((
|
|
1959
|
+
e.aspectRatio && !(e.fitContent && ((a = (o = e.builderBlock) == null ? void 0 : o.children) != null && a.length)) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1932
1960
|
"div",
|
|
1933
1961
|
{
|
|
1934
1962
|
style: {
|
|
@@ -1939,7 +1967,7 @@ function Video(e) {
|
|
|
1939
1967
|
}
|
|
1940
1968
|
}
|
|
1941
1969
|
) }) : null,
|
|
1942
|
-
(
|
|
1970
|
+
(s = (r = e.builderBlock) == null ? void 0 : r.children) != null && s.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1943
1971
|
"div",
|
|
1944
1972
|
{
|
|
1945
1973
|
style: {
|
|
@@ -1950,7 +1978,7 @@ function Video(e) {
|
|
|
1950
1978
|
children: e.children
|
|
1951
1979
|
}
|
|
1952
1980
|
) }) : null,
|
|
1953
|
-
(
|
|
1981
|
+
(l = (c = e.builderBlock) == null ? void 0 : c.children) != null && l.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1954
1982
|
"div",
|
|
1955
1983
|
{
|
|
1956
1984
|
style: {
|
|
@@ -2151,10 +2179,10 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2151
2179
|
event: e,
|
|
2152
2180
|
target: t
|
|
2153
2181
|
}) => {
|
|
2154
|
-
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top,
|
|
2182
|
+
const n = t.getBoundingClientRect(), i = e.clientX - n.left, o = e.clientY - n.top, a = round(i / n.width), r = round(o / n.height);
|
|
2155
2183
|
return {
|
|
2156
|
-
x:
|
|
2157
|
-
y:
|
|
2184
|
+
x: a,
|
|
2185
|
+
y: r
|
|
2158
2186
|
};
|
|
2159
2187
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
2160
2188
|
const t = e.target, n = t && findBuilderParent(t), i = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
|
|
@@ -2172,7 +2200,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2172
2200
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2173
2201
|
}
|
|
2174
2202
|
};
|
|
2175
|
-
}, SDK_VERSION = "0.12.
|
|
2203
|
+
}, SDK_VERSION = "0.12.6", registerInsertMenu = () => {
|
|
2176
2204
|
register("insertMenu", {
|
|
2177
2205
|
name: "_default",
|
|
2178
2206
|
default: !0,
|
|
@@ -2215,7 +2243,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2215
2243
|
options: e
|
|
2216
2244
|
}
|
|
2217
2245
|
}, "*"), window.addEventListener("message", (i) => {
|
|
2218
|
-
var
|
|
2246
|
+
var a, r;
|
|
2219
2247
|
if (!isFromTrustedHost(e.trustedHosts, i))
|
|
2220
2248
|
return;
|
|
2221
2249
|
const {
|
|
@@ -2224,17 +2252,17 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2224
2252
|
if (o != null && o.type)
|
|
2225
2253
|
switch (o.type) {
|
|
2226
2254
|
case "builder.evaluate": {
|
|
2227
|
-
const
|
|
2255
|
+
const s = o.data.text, c = o.data.arguments || [], l = o.data.id, d = new Function(s);
|
|
2228
2256
|
let g, x = null;
|
|
2229
2257
|
try {
|
|
2230
2258
|
g = d.apply(null, c);
|
|
2231
2259
|
} catch (f) {
|
|
2232
2260
|
x = f;
|
|
2233
2261
|
}
|
|
2234
|
-
x ? (
|
|
2262
|
+
x ? (a = window.parent) == null || a.postMessage({
|
|
2235
2263
|
type: "builder.evaluateError",
|
|
2236
2264
|
data: {
|
|
2237
|
-
id:
|
|
2265
|
+
id: l,
|
|
2238
2266
|
error: x.message
|
|
2239
2267
|
}
|
|
2240
2268
|
}, "*") : g && typeof g.then == "function" ? g.then((f) => {
|
|
@@ -2242,15 +2270,15 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2242
2270
|
(h = window.parent) == null || h.postMessage({
|
|
2243
2271
|
type: "builder.evaluateResult",
|
|
2244
2272
|
data: {
|
|
2245
|
-
id:
|
|
2273
|
+
id: l,
|
|
2246
2274
|
result: f
|
|
2247
2275
|
}
|
|
2248
2276
|
}, "*");
|
|
2249
|
-
}).catch(console.error) : (
|
|
2277
|
+
}).catch(console.error) : (r = window.parent) == null || r.postMessage({
|
|
2250
2278
|
type: "builder.evaluateResult",
|
|
2251
2279
|
data: {
|
|
2252
2280
|
result: g,
|
|
2253
|
-
id:
|
|
2281
|
+
id: l
|
|
2254
2282
|
}
|
|
2255
2283
|
}, "*");
|
|
2256
2284
|
break;
|
|
@@ -2259,7 +2287,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2259
2287
|
})));
|
|
2260
2288
|
};
|
|
2261
2289
|
function EnableEditor(e) {
|
|
2262
|
-
var j, P, A, F, _, V
|
|
2290
|
+
var j, P, A, F, N, _, V;
|
|
2263
2291
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2264
2292
|
useState(() => !0);
|
|
2265
2293
|
function o(u) {
|
|
@@ -2273,7 +2301,7 @@ function EnableEditor(e) {
|
|
|
2273
2301
|
rootState: m
|
|
2274
2302
|
}));
|
|
2275
2303
|
}
|
|
2276
|
-
function
|
|
2304
|
+
function a(u) {
|
|
2277
2305
|
var b, S, p, k, B;
|
|
2278
2306
|
const m = {
|
|
2279
2307
|
...e.builderContextSignal.content,
|
|
@@ -2294,9 +2322,9 @@ function EnableEditor(e) {
|
|
|
2294
2322
|
}));
|
|
2295
2323
|
}
|
|
2296
2324
|
useState(() => 0);
|
|
2297
|
-
const [
|
|
2325
|
+
const [r, s] = useState(
|
|
2298
2326
|
() => !1
|
|
2299
|
-
), [c,
|
|
2327
|
+
), [c, l] = useState(
|
|
2300
2328
|
() => e.contentWrapper || "div"
|
|
2301
2329
|
);
|
|
2302
2330
|
function d(u) {
|
|
@@ -2310,7 +2338,7 @@ function EnableEditor(e) {
|
|
|
2310
2338
|
const S = m.data, { breakpoints: p, contentId: k } = S;
|
|
2311
2339
|
if (!k || k !== ((b = e.builderContextSignal.content) == null ? void 0 : b.id))
|
|
2312
2340
|
return;
|
|
2313
|
-
p &&
|
|
2341
|
+
p && a({
|
|
2314
2342
|
meta: {
|
|
2315
2343
|
breakpoints: p
|
|
2316
2344
|
}
|
|
@@ -2319,7 +2347,7 @@ function EnableEditor(e) {
|
|
|
2319
2347
|
}
|
|
2320
2348
|
case "builder.contentUpdate": {
|
|
2321
2349
|
const S = m.data, p = S.key || S.alias || S.entry || S.modelName, k = S.data;
|
|
2322
|
-
p === e.model && (
|
|
2350
|
+
p === e.model && (a(k), i(n + 1));
|
|
2323
2351
|
break;
|
|
2324
2352
|
}
|
|
2325
2353
|
}
|
|
@@ -2364,7 +2392,7 @@ function EnableEditor(e) {
|
|
|
2364
2392
|
})
|
|
2365
2393
|
);
|
|
2366
2394
|
}
|
|
2367
|
-
function
|
|
2395
|
+
function v({ url: u, key: m }) {
|
|
2368
2396
|
fetch$1(u).then((b) => b.json()).then((b) => {
|
|
2369
2397
|
var p, k;
|
|
2370
2398
|
const S = {
|
|
@@ -2376,13 +2404,13 @@ function EnableEditor(e) {
|
|
|
2376
2404
|
console.error("error fetching dynamic data", u, b);
|
|
2377
2405
|
});
|
|
2378
2406
|
}
|
|
2379
|
-
function
|
|
2407
|
+
function C() {
|
|
2380
2408
|
var m, b, S;
|
|
2381
2409
|
const u = (S = (b = (m = e.builderContextSignal.content) == null ? void 0 : m.data) == null ? void 0 : b.httpRequests) != null ? S : {};
|
|
2382
2410
|
Object.entries(u).forEach(([p, k]) => {
|
|
2383
2411
|
if (k && (!x[p] || isEditing())) {
|
|
2384
2412
|
const B = E(k);
|
|
2385
|
-
|
|
2413
|
+
v({
|
|
2386
2414
|
url: B,
|
|
2387
2415
|
key: p
|
|
2388
2416
|
});
|
|
@@ -2438,7 +2466,7 @@ function EnableEditor(e) {
|
|
|
2438
2466
|
apiKey: e.apiKey,
|
|
2439
2467
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2440
2468
|
}).then((k) => {
|
|
2441
|
-
k &&
|
|
2469
|
+
k && a(k);
|
|
2442
2470
|
});
|
|
2443
2471
|
}
|
|
2444
2472
|
return useEffect(() => {
|
|
@@ -2483,17 +2511,14 @@ function EnableEditor(e) {
|
|
|
2483
2511
|
}, []), useEffect(() => {
|
|
2484
2512
|
e.apiKey || logger.error(
|
|
2485
2513
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2486
|
-
), g(),
|
|
2514
|
+
), g(), C(), T();
|
|
2487
2515
|
}, []), useEffect(() => {
|
|
2488
|
-
e.content &&
|
|
2516
|
+
e.content && a(e.content);
|
|
2489
2517
|
}, [e.content]), useEffect(() => {
|
|
2490
|
-
}, [
|
|
2518
|
+
}, [r]), useEffect(() => {
|
|
2491
2519
|
g();
|
|
2492
|
-
}, [
|
|
2493
|
-
(
|
|
2494
|
-
e.builderContextSignal.rootState
|
|
2495
|
-
]), useEffect(() => {
|
|
2496
|
-
v();
|
|
2520
|
+
}, [(P = (j = e.builderContextSignal.content) == null ? void 0 : j.data) == null ? void 0 : P.jsCode]), useEffect(() => {
|
|
2521
|
+
C();
|
|
2497
2522
|
}, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]), useEffect(() => {
|
|
2498
2523
|
T();
|
|
2499
2524
|
}, [e.builderContextSignal.rootState]), useEffect(() => {
|
|
@@ -2513,21 +2538,21 @@ function EnableEditor(e) {
|
|
|
2513
2538
|
key: n,
|
|
2514
2539
|
ref: t,
|
|
2515
2540
|
onClick: (u) => I(u),
|
|
2516
|
-
"builder-content-id": (
|
|
2541
|
+
"builder-content-id": (N = e.builderContextSignal.content) == null ? void 0 : N.id,
|
|
2517
2542
|
"builder-model": e.model,
|
|
2518
2543
|
...e.showContent ? {} : {
|
|
2519
2544
|
hidden: !0,
|
|
2520
2545
|
"aria-hidden": !0
|
|
2521
2546
|
},
|
|
2522
2547
|
...e.contentWrapperProps,
|
|
2523
|
-
className: `variant-${((
|
|
2548
|
+
className: `variant-${((_ = e.content) == null ? void 0 : _.testVariationId) || ((V = e.content) == null ? void 0 : V.id)}`
|
|
2524
2549
|
},
|
|
2525
2550
|
e.children
|
|
2526
2551
|
) }) : null });
|
|
2527
2552
|
}
|
|
2528
2553
|
const getCssFromFont = (e) => {
|
|
2529
|
-
var
|
|
2530
|
-
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], i = (
|
|
2554
|
+
var a, r;
|
|
2555
|
+
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;
|
|
2531
2556
|
let o = "";
|
|
2532
2557
|
if (i && t && n && (o += `
|
|
2533
2558
|
@font-face {
|
|
@@ -2537,16 +2562,16 @@ font-display: fallback;
|
|
|
2537
2562
|
font-weight: 400;
|
|
2538
2563
|
}
|
|
2539
2564
|
`.trim()), e.files)
|
|
2540
|
-
for (const
|
|
2541
|
-
if (!(String(Number(
|
|
2565
|
+
for (const s in e.files) {
|
|
2566
|
+
if (!(String(Number(s)) === s))
|
|
2542
2567
|
continue;
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2568
|
+
const l = e.files[s];
|
|
2569
|
+
l && l !== i && (o += `
|
|
2545
2570
|
@font-face {
|
|
2546
2571
|
font-family: "${t}";
|
|
2547
|
-
src: url('${
|
|
2572
|
+
src: url('${l}') format('woff2');
|
|
2548
2573
|
font-display: fallback;
|
|
2549
|
-
font-weight: ${
|
|
2574
|
+
font-weight: ${s};
|
|
2550
2575
|
}
|
|
2551
2576
|
`.trim());
|
|
2552
2577
|
}
|
|
@@ -2596,9 +2621,9 @@ const getRootStateInitialValue = ({
|
|
|
2596
2621
|
data: t,
|
|
2597
2622
|
locale: n
|
|
2598
2623
|
}) => {
|
|
2599
|
-
var
|
|
2600
|
-
const i = {}, o = ((
|
|
2601
|
-
return (
|
|
2624
|
+
var a, r, s;
|
|
2625
|
+
const i = {}, o = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.state) || {};
|
|
2626
|
+
return (s = (r = e == null ? void 0 : e.data) == null ? void 0 : r.inputs) == null || s.forEach((c) => {
|
|
2602
2627
|
c.name && c.defaultValue !== void 0 && (i[c.name] = c.defaultValue);
|
|
2603
2628
|
}), {
|
|
2604
2629
|
...i,
|
|
@@ -2620,7 +2645,7 @@ const getRootStateInitialValue = ({
|
|
|
2620
2645
|
meta: e == null ? void 0 : e.meta
|
|
2621
2646
|
} : void 0;
|
|
2622
2647
|
function ContentComponent(e) {
|
|
2623
|
-
var c,
|
|
2648
|
+
var c, l, d, g, x, f, h;
|
|
2624
2649
|
const [t, n] = useState(
|
|
2625
2650
|
() => {
|
|
2626
2651
|
var y, I;
|
|
@@ -2633,12 +2658,12 @@ function ContentComponent(e) {
|
|
|
2633
2658
|
}
|
|
2634
2659
|
);
|
|
2635
2660
|
function i(y) {
|
|
2636
|
-
|
|
2661
|
+
s((I) => ({
|
|
2637
2662
|
...I,
|
|
2638
2663
|
rootState: y
|
|
2639
2664
|
}));
|
|
2640
2665
|
}
|
|
2641
|
-
const [o,
|
|
2666
|
+
const [o, a] = useState(
|
|
2642
2667
|
() => [
|
|
2643
2668
|
...getDefaultRegisteredComponents(),
|
|
2644
2669
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2658,7 +2683,7 @@ function ContentComponent(e) {
|
|
|
2658
2683
|
}),
|
|
2659
2684
|
{}
|
|
2660
2685
|
)
|
|
2661
|
-
), [
|
|
2686
|
+
), [r, s] = useState(() => ({
|
|
2662
2687
|
content: getContentInitialValue({
|
|
2663
2688
|
content: e.content,
|
|
2664
2689
|
data: e.data
|
|
@@ -2712,27 +2737,27 @@ function ContentComponent(e) {
|
|
|
2712
2737
|
includeRefs: e.includeRefs,
|
|
2713
2738
|
enrich: e.enrich,
|
|
2714
2739
|
showContent: e.showContent,
|
|
2715
|
-
builderContextSignal:
|
|
2740
|
+
builderContextSignal: r,
|
|
2716
2741
|
contentWrapper: e.contentWrapper,
|
|
2717
2742
|
contentWrapperProps: e.contentWrapperProps,
|
|
2718
2743
|
linkComponent: e.linkComponent,
|
|
2719
2744
|
trustedHosts: e.trustedHosts,
|
|
2720
|
-
setBuilderContextSignal:
|
|
2745
|
+
setBuilderContextSignal: s,
|
|
2721
2746
|
children: [
|
|
2722
2747
|
e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
|
|
2723
2748
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2724
2749
|
ContentStyles,
|
|
2725
2750
|
{
|
|
2726
|
-
contentId: (c =
|
|
2727
|
-
cssCode: (d = (
|
|
2728
|
-
customFonts: (x = (g =
|
|
2751
|
+
contentId: (c = r.content) == null ? void 0 : c.id,
|
|
2752
|
+
cssCode: (d = (l = r.content) == null ? void 0 : l.data) == null ? void 0 : d.cssCode,
|
|
2753
|
+
customFonts: (x = (g = r.content) == null ? void 0 : g.data) == null ? void 0 : x.customFonts
|
|
2729
2754
|
}
|
|
2730
2755
|
) }),
|
|
2731
2756
|
/* @__PURE__ */ jsx(
|
|
2732
2757
|
Blocks,
|
|
2733
2758
|
{
|
|
2734
|
-
blocks: (h = (f =
|
|
2735
|
-
context:
|
|
2759
|
+
blocks: (h = (f = r.content) == null ? void 0 : f.data) == null ? void 0 : h.blocks,
|
|
2760
|
+
context: r,
|
|
2736
2761
|
registeredComponents: o,
|
|
2737
2762
|
linkComponent: e.linkComponent
|
|
2738
2763
|
}
|
|
@@ -2744,7 +2769,7 @@ function ContentComponent(e) {
|
|
|
2744
2769
|
);
|
|
2745
2770
|
}
|
|
2746
2771
|
function ContentVariants(e) {
|
|
2747
|
-
var
|
|
2772
|
+
var r, s;
|
|
2748
2773
|
const [t, n] = useState(
|
|
2749
2774
|
() => checkShouldRenderVariants({
|
|
2750
2775
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
@@ -2754,9 +2779,9 @@ function ContentVariants(e) {
|
|
|
2754
2779
|
function i() {
|
|
2755
2780
|
var c;
|
|
2756
2781
|
return getUpdateCookieAndStylesScript(
|
|
2757
|
-
getVariants(e.content).map((
|
|
2758
|
-
id:
|
|
2759
|
-
testRatio:
|
|
2782
|
+
getVariants(e.content).map((l) => ({
|
|
2783
|
+
id: l.testVariationId,
|
|
2784
|
+
testRatio: l.testRatio
|
|
2760
2785
|
})),
|
|
2761
2786
|
((c = e.content) == null ? void 0 : c.id) || ""
|
|
2762
2787
|
);
|
|
@@ -2764,7 +2789,7 @@ function ContentVariants(e) {
|
|
|
2764
2789
|
function o() {
|
|
2765
2790
|
return getVariants(e.content).map((c) => `.variant-${c.testVariationId} { display: none; } `).join("");
|
|
2766
2791
|
}
|
|
2767
|
-
function
|
|
2792
|
+
function a() {
|
|
2768
2793
|
var c;
|
|
2769
2794
|
return t ? {
|
|
2770
2795
|
...e.content,
|
|
@@ -2781,12 +2806,12 @@ function ContentVariants(e) {
|
|
|
2781
2806
|
/* @__PURE__ */ jsx(
|
|
2782
2807
|
InlinedStyles,
|
|
2783
2808
|
{
|
|
2784
|
-
id: `variants-styles-${(
|
|
2809
|
+
id: `variants-styles-${(r = e.content) == null ? void 0 : r.id}`,
|
|
2785
2810
|
styles: o()
|
|
2786
2811
|
}
|
|
2787
2812
|
),
|
|
2788
2813
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2789
|
-
(
|
|
2814
|
+
(s = getVariants(e.content)) == null ? void 0 : s.map((c) => /* @__PURE__ */ jsx(
|
|
2790
2815
|
ContentComponent,
|
|
2791
2816
|
{
|
|
2792
2817
|
content: c,
|
|
@@ -2815,7 +2840,7 @@ function ContentVariants(e) {
|
|
|
2815
2840
|
/* @__PURE__ */ jsx(
|
|
2816
2841
|
ContentComponent,
|
|
2817
2842
|
{
|
|
2818
|
-
content:
|
|
2843
|
+
content: a(),
|
|
2819
2844
|
showContent: !0,
|
|
2820
2845
|
model: e.model,
|
|
2821
2846
|
data: e.data,
|
|
@@ -2858,26 +2883,26 @@ const fetchSymbolContent = async ({
|
|
|
2858
2883
|
});
|
|
2859
2884
|
};
|
|
2860
2885
|
function Symbol$1(e) {
|
|
2861
|
-
var
|
|
2886
|
+
var a, r, s, c;
|
|
2862
2887
|
function t() {
|
|
2863
|
-
var
|
|
2888
|
+
var l, d;
|
|
2864
2889
|
return [
|
|
2865
2890
|
e.attributes[getClassPropName()],
|
|
2866
2891
|
"builder-symbol",
|
|
2867
|
-
(
|
|
2892
|
+
(l = e.symbol) != null && l.inline ? "builder-inline-symbol" : void 0,
|
|
2868
2893
|
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2869
2894
|
].filter(Boolean).join(" ");
|
|
2870
2895
|
}
|
|
2871
2896
|
const [n, i] = useState(() => {
|
|
2872
|
-
var
|
|
2873
|
-
return (
|
|
2897
|
+
var l;
|
|
2898
|
+
return (l = e.symbol) == null ? void 0 : l.content;
|
|
2874
2899
|
});
|
|
2875
2900
|
function o() {
|
|
2876
2901
|
n || fetchSymbolContent({
|
|
2877
2902
|
symbol: e.symbol,
|
|
2878
2903
|
builderContextValue: e.builderContext
|
|
2879
|
-
}).then((
|
|
2880
|
-
|
|
2904
|
+
}).then((l) => {
|
|
2905
|
+
l && i(l);
|
|
2881
2906
|
});
|
|
2882
2907
|
}
|
|
2883
2908
|
return useEffect(() => {
|
|
@@ -2891,13 +2916,13 @@ function Symbol$1(e) {
|
|
|
2891
2916
|
apiKey: e.builderContext.apiKey,
|
|
2892
2917
|
context: {
|
|
2893
2918
|
...e.builderContext.context,
|
|
2894
|
-
symbolId: (
|
|
2919
|
+
symbolId: (a = e.builderBlock) == null ? void 0 : a.id
|
|
2895
2920
|
},
|
|
2896
2921
|
customComponents: Object.values(e.builderComponents),
|
|
2897
2922
|
data: {
|
|
2898
|
-
...(
|
|
2923
|
+
...(r = e.symbol) == null ? void 0 : r.data,
|
|
2899
2924
|
...e.builderContext.localState,
|
|
2900
|
-
...(
|
|
2925
|
+
...(s = n == null ? void 0 : n.data) == null ? void 0 : s.state
|
|
2901
2926
|
},
|
|
2902
2927
|
model: (c = e.symbol) == null ? void 0 : c.model,
|
|
2903
2928
|
content: n,
|