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