@builder.io/sdk-react 0.12.0 → 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 +29 -29
- package/lib/browser/index.mjs +701 -674
- package/lib/edge/index.cjs +39 -39
- package/lib/edge/index.mjs +1127 -1100
- package/lib/node/index.cjs +12 -12
- package/lib/node/index.mjs +436 -409
- package/package.json +1 -1
- package/types/blocks/slot/component-info.d.ts +2 -0
- package/types/blocks/slot/slot.d.ts +11 -0
- 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
|
-
const
|
|
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(...
|
|
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
|
-
const
|
|
179
|
-
...
|
|
178
|
+
const c = fastClone({
|
|
179
|
+
...a,
|
|
180
180
|
...o
|
|
181
|
-
}),
|
|
181
|
+
}), s = getFunctionArguments({
|
|
182
182
|
builder: t,
|
|
183
183
|
context: n,
|
|
184
184
|
event: i,
|
|
185
|
-
state:
|
|
186
|
-
}),
|
|
185
|
+
state: c
|
|
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,28 +214,28 @@ 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.");
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
const
|
|
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
|
-
return chooseBrowserOrServerEval(
|
|
237
|
-
} catch (
|
|
238
|
-
logger.error("Failed code evaluation: " +
|
|
236
|
+
return chooseBrowserOrServerEval(c);
|
|
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
|
-
for (const
|
|
266
|
-
const
|
|
267
|
-
code:
|
|
265
|
+
for (const c in e.bindings) {
|
|
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
|
-
),
|
|
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
|
-
const g =
|
|
436
|
+
const g = c ? createCssClass({
|
|
437
437
|
className: d,
|
|
438
|
-
styles:
|
|
439
|
-
}) : "",
|
|
438
|
+
styles: c
|
|
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,10 +580,10 @@ 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
|
-
const
|
|
586
|
+
const c = {
|
|
606
587
|
...e,
|
|
607
588
|
/**
|
|
608
589
|
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
@@ -611,17 +592,17 @@ 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,
|
|
622
603
|
wrapperProps: e,
|
|
623
604
|
includeBlockProps: o
|
|
624
|
-
} :
|
|
605
|
+
} : c;
|
|
625
606
|
};
|
|
626
607
|
function ComponentRef(e) {
|
|
627
608
|
var i;
|
|
@@ -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
|
-
function
|
|
707
|
-
var f,
|
|
687
|
+
function c() {
|
|
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,81 +696,68 @@ 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,
|
|
730
711
|
{
|
|
731
|
-
componentRef:
|
|
732
|
-
componentOptions:
|
|
733
|
-
blockChildren:
|
|
734
|
-
context:
|
|
735
|
-
registeredComponents:
|
|
736
|
-
builderBlock:
|
|
737
|
-
includeBlockProps:
|
|
738
|
-
isInteractive:
|
|
712
|
+
componentRef: c().componentRef,
|
|
713
|
+
componentOptions: c().componentOptions,
|
|
714
|
+
blockChildren: c().blockChildren,
|
|
715
|
+
context: c().context,
|
|
716
|
+
registeredComponents: c().registeredComponents,
|
|
717
|
+
builderBlock: c().builderBlock,
|
|
718
|
+
includeBlockProps: c().includeBlockProps,
|
|
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: c,
|
|
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,43 +841,43 @@ 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
|
-
function
|
|
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
|
-
return `calc(${
|
|
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, 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
882
|
width: T,
|
|
915
883
|
["marginLeft"]: w,
|
|
@@ -921,11 +889,11 @@ function Columns(e) {
|
|
|
921
889
|
stackedStyle: j,
|
|
922
890
|
desktopStyle: w
|
|
923
891
|
}),
|
|
924
|
-
"--column-width-tablet":
|
|
892
|
+
"--column-width-tablet": l({
|
|
925
893
|
stackedStyle: R,
|
|
926
894
|
desktopStyle: T
|
|
927
895
|
}),
|
|
928
|
-
"--column-margin-left-tablet":
|
|
896
|
+
"--column-margin-left-tablet": l({
|
|
929
897
|
stackedStyle: j,
|
|
930
898
|
desktopStyle: w
|
|
931
899
|
})
|
|
@@ -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
|
-
(
|
|
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 {
|
|
@@ -1143,7 +1111,7 @@ function SectionComponent(e) {
|
|
|
1143
1111
|
}
|
|
1144
1112
|
);
|
|
1145
1113
|
}
|
|
1146
|
-
const componentInfo$
|
|
1114
|
+
const componentInfo$b = {
|
|
1147
1115
|
name: "Core:Button",
|
|
1148
1116
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
1149
1117
|
defaultStyles: {
|
|
@@ -1176,7 +1144,7 @@ const componentInfo$a = {
|
|
|
1176
1144
|
}],
|
|
1177
1145
|
static: !0,
|
|
1178
1146
|
noWrap: !0
|
|
1179
|
-
}, componentInfo$
|
|
1147
|
+
}, componentInfo$a = {
|
|
1180
1148
|
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
1181
1149
|
name: "Columns",
|
|
1182
1150
|
isRSC: !0,
|
|
@@ -1355,7 +1323,7 @@ const componentInfo$a = {
|
|
|
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",
|
|
@@ -1377,7 +1345,7 @@ const componentInfo$a = {
|
|
|
1377
1345
|
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
1378
1346
|
advanced: !0
|
|
1379
1347
|
}]
|
|
1380
|
-
}, componentInfo$
|
|
1348
|
+
}, componentInfo$9 = {
|
|
1381
1349
|
name: "Custom Code",
|
|
1382
1350
|
static: !0,
|
|
1383
1351
|
requiredPermissions: ["editCode"],
|
|
@@ -1401,29 +1369,29 @@ const componentInfo$a = {
|
|
|
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
|
-
var
|
|
1407
|
-
if (!((
|
|
1374
|
+
var c;
|
|
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
|
}
|
|
@@ -1438,7 +1406,7 @@ function CustomCode(e) {
|
|
|
1438
1406
|
}
|
|
1439
1407
|
);
|
|
1440
1408
|
}
|
|
1441
|
-
const componentInfo$
|
|
1409
|
+
const componentInfo$8 = {
|
|
1442
1410
|
name: "Embed",
|
|
1443
1411
|
static: !0,
|
|
1444
1412
|
inputs: [{
|
|
@@ -1465,28 +1433,28 @@ const componentInfo$7 = {
|
|
|
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",
|
|
@@ -1495,13 +1463,13 @@ function Embed(e) {
|
|
|
1495
1463
|
}
|
|
1496
1464
|
);
|
|
1497
1465
|
}
|
|
1498
|
-
const componentInfo$
|
|
1466
|
+
const componentInfo$7 = {
|
|
1499
1467
|
name: "Fragment",
|
|
1500
1468
|
static: !0,
|
|
1501
1469
|
hidden: !0,
|
|
1502
1470
|
canHaveChildren: !0,
|
|
1503
1471
|
noWrap: !0
|
|
1504
|
-
}, componentInfo$
|
|
1472
|
+
}, componentInfo$6 = {
|
|
1505
1473
|
name: "Image",
|
|
1506
1474
|
static: !0,
|
|
1507
1475
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -1521,29 +1489,29 @@ const componentInfo$6 = {
|
|
|
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 ||
|
|
1534
|
-
},
|
|
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"));
|
|
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((
|
|
1545
|
-
const
|
|
1546
|
-
e.get("image") === o && (!
|
|
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) => {
|
|
1513
|
+
const c = e.get("aspectRatio");
|
|
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
|
}, {
|
|
@@ -1601,7 +1569,7 @@ const componentInfo$6 = {
|
|
|
1601
1569
|
advanced: !0,
|
|
1602
1570
|
defaultValue: 0.7041
|
|
1603
1571
|
}]
|
|
1604
|
-
}, componentInfo$
|
|
1572
|
+
}, componentInfo$5 = {
|
|
1605
1573
|
// friendlyName?
|
|
1606
1574
|
name: "Raw:Img",
|
|
1607
1575
|
hideFromInsertMenu: !0,
|
|
@@ -1631,7 +1599,7 @@ function ImgComponent(e) {
|
|
|
1631
1599
|
isEditing() && e.imgSrc || "default-key"
|
|
1632
1600
|
);
|
|
1633
1601
|
}
|
|
1634
|
-
const componentInfo$
|
|
1602
|
+
const componentInfo$4 = {
|
|
1635
1603
|
name: "Core:Section",
|
|
1636
1604
|
static: !0,
|
|
1637
1605
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -1670,7 +1638,44 @@ const componentInfo$3 = {
|
|
|
1670
1638
|
}
|
|
1671
1639
|
}
|
|
1672
1640
|
}]
|
|
1673
|
-
}, componentInfo$
|
|
1641
|
+
}, componentInfo$3 = {
|
|
1642
|
+
name: "Slot",
|
|
1643
|
+
isRSC: !0,
|
|
1644
|
+
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
1645
|
+
docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
|
|
1646
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
|
|
1647
|
+
// Maybe wrap this for canHaveChildren so bind children to this hm
|
|
1648
|
+
inputs: [{
|
|
1649
|
+
name: "name",
|
|
1650
|
+
type: "string",
|
|
1651
|
+
required: !0,
|
|
1652
|
+
defaultValue: "children"
|
|
1653
|
+
}]
|
|
1654
|
+
};
|
|
1655
|
+
function Slot(e) {
|
|
1656
|
+
var t, n, i;
|
|
1657
|
+
return /* @__PURE__ */ jsx(
|
|
1658
|
+
"div",
|
|
1659
|
+
{
|
|
1660
|
+
style: {
|
|
1661
|
+
pointerEvents: "auto"
|
|
1662
|
+
},
|
|
1663
|
+
...!((t = e.builderContext.context) != null && t.symbolId) && {
|
|
1664
|
+
"builder-slot": e.name
|
|
1665
|
+
},
|
|
1666
|
+
children: /* @__PURE__ */ jsx(
|
|
1667
|
+
Blocks,
|
|
1668
|
+
{
|
|
1669
|
+
parent: (n = e.builderContext.context) == null ? void 0 : n.symbolId,
|
|
1670
|
+
path: `symbol.data.${e.name}`,
|
|
1671
|
+
context: e.builderContext,
|
|
1672
|
+
blocks: (i = e.builderContext.rootState) == null ? void 0 : i[e.name]
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
const componentInfo$2 = {
|
|
1674
1679
|
name: "Symbol",
|
|
1675
1680
|
noWrap: !0,
|
|
1676
1681
|
static: !0,
|
|
@@ -1818,7 +1823,7 @@ const componentInfo = {
|
|
|
1818
1823
|
}]
|
|
1819
1824
|
};
|
|
1820
1825
|
function Video(e) {
|
|
1821
|
-
var i, o,
|
|
1826
|
+
var i, o, r, a, c, s, l;
|
|
1822
1827
|
function t() {
|
|
1823
1828
|
return {
|
|
1824
1829
|
...e.autoPlay === !0 ? {
|
|
@@ -1875,7 +1880,7 @@ function Video(e) {
|
|
|
1875
1880
|
children: e.lazyLoad ? null : /* @__PURE__ */ jsx("source", { type: "video/mp4", src: e.video })
|
|
1876
1881
|
}
|
|
1877
1882
|
),
|
|
1878
|
-
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(
|
|
1879
1884
|
"div",
|
|
1880
1885
|
{
|
|
1881
1886
|
style: {
|
|
@@ -1886,7 +1891,7 @@ function Video(e) {
|
|
|
1886
1891
|
}
|
|
1887
1892
|
}
|
|
1888
1893
|
) }) : null,
|
|
1889
|
-
(
|
|
1894
|
+
(c = (a = e.builderBlock) == null ? void 0 : a.children) != null && c.length && e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1890
1895
|
"div",
|
|
1891
1896
|
{
|
|
1892
1897
|
style: {
|
|
@@ -1897,7 +1902,7 @@ function Video(e) {
|
|
|
1897
1902
|
children: e.children
|
|
1898
1903
|
}
|
|
1899
1904
|
) }) : null,
|
|
1900
|
-
(
|
|
1905
|
+
(l = (s = e.builderBlock) == null ? void 0 : s.children) != null && l.length && !e.fitContent ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1901
1906
|
"div",
|
|
1902
1907
|
{
|
|
1903
1908
|
style: {
|
|
@@ -1920,28 +1925,28 @@ function Video(e) {
|
|
|
1920
1925
|
}
|
|
1921
1926
|
const getDefaultRegisteredComponents = () => [{
|
|
1922
1927
|
component: Button,
|
|
1923
|
-
...componentInfo$
|
|
1928
|
+
...componentInfo$b
|
|
1924
1929
|
}, {
|
|
1925
1930
|
component: Columns,
|
|
1926
|
-
...componentInfo$
|
|
1931
|
+
...componentInfo$a
|
|
1927
1932
|
}, {
|
|
1928
1933
|
component: CustomCode,
|
|
1929
|
-
...componentInfo$
|
|
1934
|
+
...componentInfo$9
|
|
1930
1935
|
}, {
|
|
1931
1936
|
component: Embed,
|
|
1932
|
-
...componentInfo$
|
|
1937
|
+
...componentInfo$8
|
|
1933
1938
|
}, {
|
|
1934
1939
|
component: FragmentComponent,
|
|
1935
|
-
...componentInfo$
|
|
1940
|
+
...componentInfo$7
|
|
1936
1941
|
}, {
|
|
1937
1942
|
component: Image,
|
|
1938
|
-
...componentInfo$
|
|
1943
|
+
...componentInfo$6
|
|
1939
1944
|
}, {
|
|
1940
1945
|
component: ImgComponent,
|
|
1941
|
-
...componentInfo$
|
|
1946
|
+
...componentInfo$5
|
|
1942
1947
|
}, {
|
|
1943
1948
|
component: SectionComponent,
|
|
1944
|
-
...componentInfo$
|
|
1949
|
+
...componentInfo$4
|
|
1945
1950
|
}, {
|
|
1946
1951
|
component: Symbol$1,
|
|
1947
1952
|
...componentInfo$2
|
|
@@ -1951,6 +1956,9 @@ const getDefaultRegisteredComponents = () => [{
|
|
|
1951
1956
|
}, {
|
|
1952
1957
|
component: Video,
|
|
1953
1958
|
...componentInfo
|
|
1959
|
+
}, {
|
|
1960
|
+
component: Slot,
|
|
1961
|
+
...componentInfo$3
|
|
1954
1962
|
}], UPDATE_COOKIES_AND_STYLES_SCRIPT = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1955
1963
|
function getAndSetVariantId() {
|
|
1956
1964
|
function setCookie(name, value, days) {
|
|
@@ -2069,6 +2077,11 @@ function InlinedScript(e) {
|
|
|
2069
2077
|
}
|
|
2070
2078
|
);
|
|
2071
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
|
+
}
|
|
2072
2085
|
function round(e) {
|
|
2073
2086
|
return Math.round(e * 1e3) / 1e3;
|
|
2074
2087
|
}
|
|
@@ -2090,10 +2103,10 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2090
2103
|
event: e,
|
|
2091
2104
|
target: t
|
|
2092
2105
|
}) => {
|
|
2093
|
-
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);
|
|
2094
2107
|
return {
|
|
2095
|
-
x:
|
|
2096
|
-
y:
|
|
2108
|
+
x: r,
|
|
2109
|
+
y: a
|
|
2097
2110
|
};
|
|
2098
2111
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
2099
2112
|
const t = e.target, n = t && findBuilderParent(t), i = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
|
|
@@ -2111,7 +2124,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2111
2124
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2112
2125
|
}
|
|
2113
2126
|
};
|
|
2114
|
-
}, SDK_VERSION = "0.12.
|
|
2127
|
+
}, SDK_VERSION = "0.12.2", registerInsertMenu = () => {
|
|
2115
2128
|
register("insertMenu", {
|
|
2116
2129
|
name: "_default",
|
|
2117
2130
|
default: !0,
|
|
@@ -2153,40 +2166,43 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2153
2166
|
data: {
|
|
2154
2167
|
options: e
|
|
2155
2168
|
}
|
|
2156
|
-
}, "*"), window.addEventListener("message", ({
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
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) {
|
|
2162
2178
|
case "builder.evaluate": {
|
|
2163
|
-
const
|
|
2164
|
-
let
|
|
2179
|
+
const c = o.data.text, s = o.data.arguments || [], l = o.data.id, d = new Function(c);
|
|
2180
|
+
let g, S = null;
|
|
2165
2181
|
try {
|
|
2166
|
-
|
|
2167
|
-
} catch (
|
|
2168
|
-
|
|
2182
|
+
g = d.apply(null, s);
|
|
2183
|
+
} catch (f) {
|
|
2184
|
+
S = f;
|
|
2169
2185
|
}
|
|
2170
|
-
|
|
2186
|
+
S ? (r = window.parent) == null || r.postMessage({
|
|
2171
2187
|
type: "builder.evaluateError",
|
|
2172
2188
|
data: {
|
|
2173
|
-
id:
|
|
2174
|
-
error:
|
|
2189
|
+
id: l,
|
|
2190
|
+
error: S.message
|
|
2175
2191
|
}
|
|
2176
|
-
}, "*") :
|
|
2177
|
-
var
|
|
2178
|
-
(
|
|
2192
|
+
}, "*") : g && typeof g.then == "function" ? g.then((f) => {
|
|
2193
|
+
var b;
|
|
2194
|
+
(b = window.parent) == null || b.postMessage({
|
|
2179
2195
|
type: "builder.evaluateResult",
|
|
2180
2196
|
data: {
|
|
2181
|
-
id:
|
|
2182
|
-
result:
|
|
2197
|
+
id: l,
|
|
2198
|
+
result: f
|
|
2183
2199
|
}
|
|
2184
2200
|
}, "*");
|
|
2185
2201
|
}).catch(console.error) : (a = window.parent) == null || a.postMessage({
|
|
2186
2202
|
type: "builder.evaluateResult",
|
|
2187
2203
|
data: {
|
|
2188
|
-
result:
|
|
2189
|
-
id:
|
|
2204
|
+
result: g,
|
|
2205
|
+
id: l
|
|
2190
2206
|
}
|
|
2191
2207
|
}, "*");
|
|
2192
2208
|
break;
|
|
@@ -2195,22 +2211,22 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2195
2211
|
})));
|
|
2196
2212
|
};
|
|
2197
2213
|
function EnableEditor(e) {
|
|
2198
|
-
var j, P, A, F, _, V,
|
|
2214
|
+
var j, P, A, F, _, V, N;
|
|
2199
2215
|
const t = useRef(null), [n, i] = useState(() => 0);
|
|
2200
2216
|
useState(() => !0);
|
|
2201
2217
|
function o(u) {
|
|
2202
|
-
var h,
|
|
2218
|
+
var h, x;
|
|
2203
2219
|
const m = {
|
|
2204
2220
|
...e.builderContextSignal.rootState,
|
|
2205
2221
|
...u
|
|
2206
2222
|
};
|
|
2207
|
-
e.builderContextSignal.rootSetState ? (
|
|
2223
|
+
e.builderContextSignal.rootSetState ? (x = (h = e.builderContextSignal).rootSetState) == null || x.call(h, m) : e.setBuilderContextSignal((p) => ({
|
|
2208
2224
|
...p,
|
|
2209
2225
|
rootState: m
|
|
2210
2226
|
}));
|
|
2211
2227
|
}
|
|
2212
|
-
function
|
|
2213
|
-
var h,
|
|
2228
|
+
function r(u) {
|
|
2229
|
+
var h, x, p, k, B;
|
|
2214
2230
|
const m = {
|
|
2215
2231
|
...e.builderContextSignal.content,
|
|
2216
2232
|
...u,
|
|
@@ -2219,7 +2235,7 @@ function EnableEditor(e) {
|
|
|
2219
2235
|
...u == null ? void 0 : u.data
|
|
2220
2236
|
},
|
|
2221
2237
|
meta: {
|
|
2222
|
-
...(
|
|
2238
|
+
...(x = e.builderContextSignal.content) == null ? void 0 : x.meta,
|
|
2223
2239
|
...u == null ? void 0 : u.meta,
|
|
2224
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)
|
|
2225
2241
|
}
|
|
@@ -2230,21 +2246,23 @@ function EnableEditor(e) {
|
|
|
2230
2246
|
}));
|
|
2231
2247
|
}
|
|
2232
2248
|
useState(() => 0);
|
|
2233
|
-
const [
|
|
2249
|
+
const [a, c] = useState(
|
|
2234
2250
|
() => !1
|
|
2235
|
-
), [
|
|
2251
|
+
), [s, l] = useState(
|
|
2236
2252
|
() => e.contentWrapper || "div"
|
|
2237
2253
|
);
|
|
2238
2254
|
function d(u) {
|
|
2239
2255
|
var h;
|
|
2256
|
+
if (!isFromTrustedHost(e.trustedHosts, u))
|
|
2257
|
+
return;
|
|
2240
2258
|
const { data: m } = u;
|
|
2241
2259
|
if (m)
|
|
2242
2260
|
switch (m.type) {
|
|
2243
2261
|
case "builder.configureSdk": {
|
|
2244
|
-
const
|
|
2262
|
+
const x = m.data, { breakpoints: p, contentId: k } = x;
|
|
2245
2263
|
if (!k || k !== ((h = e.builderContextSignal.content) == null ? void 0 : h.id))
|
|
2246
2264
|
return;
|
|
2247
|
-
p &&
|
|
2265
|
+
p && r({
|
|
2248
2266
|
meta: {
|
|
2249
2267
|
breakpoints: p
|
|
2250
2268
|
}
|
|
@@ -2252,8 +2270,8 @@ function EnableEditor(e) {
|
|
|
2252
2270
|
break;
|
|
2253
2271
|
}
|
|
2254
2272
|
case "builder.contentUpdate": {
|
|
2255
|
-
const
|
|
2256
|
-
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));
|
|
2257
2275
|
break;
|
|
2258
2276
|
}
|
|
2259
2277
|
}
|
|
@@ -2269,22 +2287,22 @@ function EnableEditor(e) {
|
|
|
2269
2287
|
rootSetState: e.builderContextSignal.rootSetState
|
|
2270
2288
|
});
|
|
2271
2289
|
}
|
|
2272
|
-
const [
|
|
2290
|
+
const [S, f] = useState(() => ({})), [b, y] = useState(() => !1);
|
|
2273
2291
|
function I(u) {
|
|
2274
2292
|
var m, h;
|
|
2275
2293
|
if (e.builderContextSignal.content) {
|
|
2276
|
-
const
|
|
2294
|
+
const x = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, p = (h = e.builderContextSignal.content) == null ? void 0 : h.id;
|
|
2277
2295
|
_track({
|
|
2278
2296
|
type: "click",
|
|
2279
2297
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2280
2298
|
contentId: p,
|
|
2281
2299
|
apiKey: e.apiKey,
|
|
2282
|
-
variationId:
|
|
2300
|
+
variationId: x !== p ? x : void 0,
|
|
2283
2301
|
...getInteractionPropertiesForEvent(u),
|
|
2284
|
-
unique: !
|
|
2302
|
+
unique: !b
|
|
2285
2303
|
});
|
|
2286
2304
|
}
|
|
2287
|
-
|
|
2305
|
+
b || y(!0);
|
|
2288
2306
|
}
|
|
2289
2307
|
function E(u) {
|
|
2290
2308
|
return u.replace(
|
|
@@ -2301,20 +2319,20 @@ function EnableEditor(e) {
|
|
|
2301
2319
|
function v({ url: u, key: m }) {
|
|
2302
2320
|
fetch$1(u).then((h) => h.json()).then((h) => {
|
|
2303
2321
|
var p, k;
|
|
2304
|
-
const
|
|
2322
|
+
const x = {
|
|
2305
2323
|
...e.builderContextSignal.rootState,
|
|
2306
2324
|
[m]: h
|
|
2307
2325
|
};
|
|
2308
|
-
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p,
|
|
2326
|
+
(k = (p = e.builderContextSignal).rootSetState) == null || k.call(p, x), S[m] = !0;
|
|
2309
2327
|
}).catch((h) => {
|
|
2310
2328
|
console.error("error fetching dynamic data", u, h);
|
|
2311
2329
|
});
|
|
2312
2330
|
}
|
|
2313
2331
|
function C() {
|
|
2314
|
-
var m, h,
|
|
2315
|
-
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 : {};
|
|
2316
2334
|
Object.entries(u).forEach(([p, k]) => {
|
|
2317
|
-
if (k && (!
|
|
2335
|
+
if (k && (!S[p] || isEditing())) {
|
|
2318
2336
|
const B = E(k);
|
|
2319
2337
|
v({
|
|
2320
2338
|
url: B,
|
|
@@ -2348,28 +2366,31 @@ function EnableEditor(e) {
|
|
|
2348
2366
|
} : {},
|
|
2349
2367
|
...e.enrich ? {
|
|
2350
2368
|
enrich: e.enrich
|
|
2369
|
+
} : {},
|
|
2370
|
+
...e.trustedHosts ? {
|
|
2371
|
+
trustedHosts: e.trustedHosts
|
|
2351
2372
|
} : {}
|
|
2352
2373
|
}), Object.values(
|
|
2353
2374
|
e.builderContextSignal.componentInfos
|
|
2354
2375
|
).forEach((m) => {
|
|
2355
|
-
var
|
|
2376
|
+
var x;
|
|
2356
2377
|
const h = createRegisterComponentMessage(m);
|
|
2357
|
-
(
|
|
2378
|
+
(x = window.parent) == null || x.postMessage(h, "*");
|
|
2358
2379
|
}), window.addEventListener(
|
|
2359
2380
|
"builder:component:stateChangeListenerActivated",
|
|
2360
2381
|
T
|
|
2361
2382
|
);
|
|
2362
2383
|
}
|
|
2363
2384
|
function R(u) {
|
|
2364
|
-
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(
|
|
2365
2386
|
`builder.preview.${h}`
|
|
2366
2387
|
), p = m.get("apiKey") || m.get("builder.space");
|
|
2367
|
-
h === e.model && p === e.apiKey && (!e.content ||
|
|
2388
|
+
h === e.model && p === e.apiKey && (!e.content || x === e.content.id) && fetchOneEntry({
|
|
2368
2389
|
model: e.model,
|
|
2369
2390
|
apiKey: e.apiKey,
|
|
2370
2391
|
apiVersion: e.builderContextSignal.apiVersion
|
|
2371
2392
|
}).then((k) => {
|
|
2372
|
-
k &&
|
|
2393
|
+
k && r(k);
|
|
2373
2394
|
});
|
|
2374
2395
|
}
|
|
2375
2396
|
return useEffect(() => {
|
|
@@ -2400,13 +2421,13 @@ function EnableEditor(e) {
|
|
|
2400
2421
|
var u, m;
|
|
2401
2422
|
if (isBrowser()) {
|
|
2402
2423
|
if (isEditing() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && getDefaultCanTrack(e.canTrack)) {
|
|
2403
|
-
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;
|
|
2404
2425
|
_track({
|
|
2405
2426
|
type: "impression",
|
|
2406
2427
|
canTrack: !0,
|
|
2407
2428
|
contentId: p,
|
|
2408
2429
|
apiKey: k,
|
|
2409
|
-
variationId:
|
|
2430
|
+
variationId: x !== p ? x : void 0
|
|
2410
2431
|
});
|
|
2411
2432
|
}
|
|
2412
2433
|
isPreviewing() && t.current && t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
@@ -2416,9 +2437,9 @@ function EnableEditor(e) {
|
|
|
2416
2437
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
2417
2438
|
), g(), C(), T();
|
|
2418
2439
|
}, []), useEffect(() => {
|
|
2419
|
-
e.content &&
|
|
2440
|
+
e.content && r(e.content);
|
|
2420
2441
|
}, [e.content]), useEffect(() => {
|
|
2421
|
-
}, [
|
|
2442
|
+
}, [a]), useEffect(() => {
|
|
2422
2443
|
g();
|
|
2423
2444
|
}, [
|
|
2424
2445
|
(P = (j = e.builderContextSignal.content) == null ? void 0 : j.data) == null ? void 0 : P.jsCode,
|
|
@@ -2439,7 +2460,7 @@ function EnableEditor(e) {
|
|
|
2439
2460
|
T
|
|
2440
2461
|
));
|
|
2441
2462
|
}, []), /* @__PURE__ */ jsx(builderContext.Provider, { value: e.builderContextSignal, children: e.builderContextSignal.content ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
2442
|
-
|
|
2463
|
+
s,
|
|
2443
2464
|
{
|
|
2444
2465
|
key: n,
|
|
2445
2466
|
ref: t,
|
|
@@ -2451,14 +2472,14 @@ function EnableEditor(e) {
|
|
|
2451
2472
|
"aria-hidden": !0
|
|
2452
2473
|
},
|
|
2453
2474
|
...e.contentWrapperProps,
|
|
2454
|
-
className: `variant-${((V = e.content) == null ? void 0 : V.testVariationId) || ((
|
|
2475
|
+
className: `variant-${((V = e.content) == null ? void 0 : V.testVariationId) || ((N = e.content) == null ? void 0 : N.id)}`
|
|
2455
2476
|
},
|
|
2456
2477
|
e.children
|
|
2457
2478
|
) }) : null });
|
|
2458
2479
|
}
|
|
2459
2480
|
const getCssFromFont = (e) => {
|
|
2460
|
-
var
|
|
2461
|
-
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;
|
|
2462
2483
|
let o = "";
|
|
2463
2484
|
if (i && t && n && (o += `
|
|
2464
2485
|
@font-face {
|
|
@@ -2468,16 +2489,16 @@ font-display: fallback;
|
|
|
2468
2489
|
font-weight: 400;
|
|
2469
2490
|
}
|
|
2470
2491
|
`.trim()), e.files)
|
|
2471
|
-
for (const
|
|
2472
|
-
if (!(String(Number(
|
|
2492
|
+
for (const c in e.files) {
|
|
2493
|
+
if (!(String(Number(c)) === c))
|
|
2473
2494
|
continue;
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2495
|
+
const l = e.files[c];
|
|
2496
|
+
l && l !== i && (o += `
|
|
2476
2497
|
@font-face {
|
|
2477
2498
|
font-family: "${t}";
|
|
2478
|
-
src: url('${
|
|
2499
|
+
src: url('${l}') format('woff2');
|
|
2479
2500
|
font-display: fallback;
|
|
2480
|
-
font-weight: ${
|
|
2501
|
+
font-weight: ${c};
|
|
2481
2502
|
}
|
|
2482
2503
|
`.trim());
|
|
2483
2504
|
}
|
|
@@ -2523,10 +2544,10 @@ const getRootStateInitialValue = ({
|
|
|
2523
2544
|
data: t,
|
|
2524
2545
|
locale: n
|
|
2525
2546
|
}) => {
|
|
2526
|
-
var
|
|
2527
|
-
const i = {}, o = ((
|
|
2528
|
-
return (
|
|
2529
|
-
|
|
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);
|
|
2530
2551
|
}), {
|
|
2531
2552
|
...i,
|
|
2532
2553
|
...o,
|
|
@@ -2547,7 +2568,7 @@ const getRootStateInitialValue = ({
|
|
|
2547
2568
|
meta: e == null ? void 0 : e.meta
|
|
2548
2569
|
} : void 0;
|
|
2549
2570
|
function ContentComponent(e) {
|
|
2550
|
-
var
|
|
2571
|
+
var s, l, d, g, S, f, b;
|
|
2551
2572
|
const [t, n] = useState(
|
|
2552
2573
|
() => {
|
|
2553
2574
|
var y, I;
|
|
@@ -2560,12 +2581,12 @@ function ContentComponent(e) {
|
|
|
2560
2581
|
}
|
|
2561
2582
|
);
|
|
2562
2583
|
function i(y) {
|
|
2563
|
-
|
|
2584
|
+
c((I) => ({
|
|
2564
2585
|
...I,
|
|
2565
2586
|
rootState: y
|
|
2566
2587
|
}));
|
|
2567
2588
|
}
|
|
2568
|
-
const [o,
|
|
2589
|
+
const [o, r] = useState(
|
|
2569
2590
|
() => [
|
|
2570
2591
|
...getDefaultRegisteredComponents(),
|
|
2571
2592
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2585,7 +2606,7 @@ function ContentComponent(e) {
|
|
|
2585
2606
|
}),
|
|
2586
2607
|
{}
|
|
2587
2608
|
)
|
|
2588
|
-
), [
|
|
2609
|
+
), [a, c] = useState(() => ({
|
|
2589
2610
|
content: getContentInitialValue({
|
|
2590
2611
|
content: e.content,
|
|
2591
2612
|
data: e.data
|
|
@@ -2639,25 +2660,26 @@ function ContentComponent(e) {
|
|
|
2639
2660
|
includeRefs: e.includeRefs,
|
|
2640
2661
|
enrich: e.enrich,
|
|
2641
2662
|
showContent: e.showContent,
|
|
2642
|
-
builderContextSignal:
|
|
2663
|
+
builderContextSignal: a,
|
|
2643
2664
|
contentWrapper: e.contentWrapper,
|
|
2644
2665
|
contentWrapperProps: e.contentWrapperProps,
|
|
2645
|
-
|
|
2666
|
+
trustedHosts: e.trustedHosts,
|
|
2667
|
+
setBuilderContextSignal: c,
|
|
2646
2668
|
children: [
|
|
2647
2669
|
e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
|
|
2648
2670
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2649
2671
|
ContentStyles,
|
|
2650
2672
|
{
|
|
2651
|
-
contentId: (
|
|
2652
|
-
cssCode: (d = (
|
|
2653
|
-
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
|
|
2654
2676
|
}
|
|
2655
2677
|
) }),
|
|
2656
2678
|
/* @__PURE__ */ jsx(
|
|
2657
2679
|
Blocks,
|
|
2658
2680
|
{
|
|
2659
|
-
blocks: (
|
|
2660
|
-
context:
|
|
2681
|
+
blocks: (b = (f = a.content) == null ? void 0 : f.data) == null ? void 0 : b.blocks,
|
|
2682
|
+
context: a,
|
|
2661
2683
|
registeredComponents: o
|
|
2662
2684
|
}
|
|
2663
2685
|
)
|
|
@@ -2668,7 +2690,7 @@ function ContentComponent(e) {
|
|
|
2668
2690
|
);
|
|
2669
2691
|
}
|
|
2670
2692
|
function ContentVariants(e) {
|
|
2671
|
-
var
|
|
2693
|
+
var a, c;
|
|
2672
2694
|
const [t, n] = useState(
|
|
2673
2695
|
() => checkShouldRenderVariants({
|
|
2674
2696
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
@@ -2676,23 +2698,23 @@ function ContentVariants(e) {
|
|
|
2676
2698
|
})
|
|
2677
2699
|
);
|
|
2678
2700
|
function i() {
|
|
2679
|
-
var
|
|
2701
|
+
var s;
|
|
2680
2702
|
return getUpdateCookieAndStylesScript(
|
|
2681
|
-
getVariants(e.content).map((
|
|
2682
|
-
id:
|
|
2683
|
-
testRatio:
|
|
2703
|
+
getVariants(e.content).map((l) => ({
|
|
2704
|
+
id: l.testVariationId,
|
|
2705
|
+
testRatio: l.testRatio
|
|
2684
2706
|
})),
|
|
2685
|
-
((
|
|
2707
|
+
((s = e.content) == null ? void 0 : s.id) || ""
|
|
2686
2708
|
);
|
|
2687
2709
|
}
|
|
2688
2710
|
function o() {
|
|
2689
|
-
return getVariants(e.content).map((
|
|
2711
|
+
return getVariants(e.content).map((s) => `.variant-${s.testVariationId} { display: none; } `).join("");
|
|
2690
2712
|
}
|
|
2691
|
-
function
|
|
2692
|
-
var
|
|
2713
|
+
function r() {
|
|
2714
|
+
var s;
|
|
2693
2715
|
return t ? {
|
|
2694
2716
|
...e.content,
|
|
2695
|
-
testVariationId: (
|
|
2717
|
+
testVariationId: (s = e.content) == null ? void 0 : s.id
|
|
2696
2718
|
} : handleABTestingSync({
|
|
2697
2719
|
item: e.content,
|
|
2698
2720
|
canTrack: getDefaultCanTrack(e.canTrack)
|
|
@@ -2705,15 +2727,15 @@ function ContentVariants(e) {
|
|
|
2705
2727
|
/* @__PURE__ */ jsx(
|
|
2706
2728
|
InlinedStyles,
|
|
2707
2729
|
{
|
|
2708
|
-
id: `variants-styles-${(
|
|
2730
|
+
id: `variants-styles-${(a = e.content) == null ? void 0 : a.id}`,
|
|
2709
2731
|
styles: o()
|
|
2710
2732
|
}
|
|
2711
2733
|
),
|
|
2712
2734
|
/* @__PURE__ */ jsx(InlinedScript, { scriptStr: i() }),
|
|
2713
|
-
(
|
|
2735
|
+
(c = getVariants(e.content)) == null ? void 0 : c.map((s) => /* @__PURE__ */ jsx(
|
|
2714
2736
|
ContentComponent,
|
|
2715
2737
|
{
|
|
2716
|
-
content:
|
|
2738
|
+
content: s,
|
|
2717
2739
|
showContent: !1,
|
|
2718
2740
|
model: e.model,
|
|
2719
2741
|
data: e.data,
|
|
@@ -2729,15 +2751,16 @@ function ContentVariants(e) {
|
|
|
2729
2751
|
blocksWrapper: e.blocksWrapper,
|
|
2730
2752
|
blocksWrapperProps: e.blocksWrapperProps,
|
|
2731
2753
|
contentWrapper: e.contentWrapper,
|
|
2732
|
-
contentWrapperProps: e.contentWrapperProps
|
|
2754
|
+
contentWrapperProps: e.contentWrapperProps,
|
|
2755
|
+
trustedHosts: e.trustedHosts
|
|
2733
2756
|
},
|
|
2734
|
-
|
|
2757
|
+
s.testVariationId
|
|
2735
2758
|
))
|
|
2736
2759
|
] }) : null,
|
|
2737
2760
|
/* @__PURE__ */ jsx(
|
|
2738
2761
|
ContentComponent,
|
|
2739
2762
|
{
|
|
2740
|
-
content:
|
|
2763
|
+
content: r(),
|
|
2741
2764
|
showContent: !0,
|
|
2742
2765
|
model: e.model,
|
|
2743
2766
|
data: e.data,
|
|
@@ -2753,7 +2776,8 @@ function ContentVariants(e) {
|
|
|
2753
2776
|
blocksWrapper: e.blocksWrapper,
|
|
2754
2777
|
blocksWrapperProps: e.blocksWrapperProps,
|
|
2755
2778
|
contentWrapper: e.contentWrapper,
|
|
2756
|
-
contentWrapperProps: e.contentWrapperProps
|
|
2779
|
+
contentWrapperProps: e.contentWrapperProps,
|
|
2780
|
+
trustedHosts: e.trustedHosts
|
|
2757
2781
|
}
|
|
2758
2782
|
)
|
|
2759
2783
|
] });
|
|
@@ -2778,26 +2802,26 @@ const fetchSymbolContent = async ({
|
|
|
2778
2802
|
});
|
|
2779
2803
|
};
|
|
2780
2804
|
function Symbol$1(e) {
|
|
2781
|
-
var a,
|
|
2805
|
+
var r, a, c, s;
|
|
2782
2806
|
function t() {
|
|
2783
|
-
var
|
|
2807
|
+
var l, d;
|
|
2784
2808
|
return [
|
|
2785
2809
|
e.attributes.className,
|
|
2786
2810
|
"builder-symbol",
|
|
2787
|
-
(
|
|
2788
|
-
(
|
|
2811
|
+
(l = e.symbol) != null && l.inline ? "builder-inline-symbol" : void 0,
|
|
2812
|
+
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
2789
2813
|
].filter(Boolean).join(" ");
|
|
2790
2814
|
}
|
|
2791
2815
|
const [n, i] = useState(() => {
|
|
2792
|
-
var
|
|
2793
|
-
return (
|
|
2816
|
+
var l;
|
|
2817
|
+
return (l = e.symbol) == null ? void 0 : l.content;
|
|
2794
2818
|
});
|
|
2795
2819
|
function o() {
|
|
2796
2820
|
n || fetchSymbolContent({
|
|
2797
2821
|
symbol: e.symbol,
|
|
2798
2822
|
builderContextValue: e.builderContext
|
|
2799
|
-
}).then((
|
|
2800
|
-
|
|
2823
|
+
}).then((l) => {
|
|
2824
|
+
l && i(l);
|
|
2801
2825
|
});
|
|
2802
2826
|
}
|
|
2803
2827
|
return useEffect(() => {
|
|
@@ -2809,14 +2833,17 @@ function Symbol$1(e) {
|
|
|
2809
2833
|
__isNestedRender: !0,
|
|
2810
2834
|
apiVersion: e.builderContext.apiVersion,
|
|
2811
2835
|
apiKey: e.builderContext.apiKey,
|
|
2812
|
-
context:
|
|
2836
|
+
context: {
|
|
2837
|
+
...e.builderContext.context,
|
|
2838
|
+
symbolId: (r = e.builderBlock) == null ? void 0 : r.id
|
|
2839
|
+
},
|
|
2813
2840
|
customComponents: Object.values(e.builderComponents),
|
|
2814
2841
|
data: {
|
|
2815
2842
|
...(a = e.symbol) == null ? void 0 : a.data,
|
|
2816
2843
|
...e.builderContext.localState,
|
|
2817
|
-
...(
|
|
2844
|
+
...(c = n == null ? void 0 : n.data) == null ? void 0 : c.state
|
|
2818
2845
|
},
|
|
2819
|
-
model: (
|
|
2846
|
+
model: (s = e.symbol) == null ? void 0 : s.model,
|
|
2820
2847
|
content: n
|
|
2821
2848
|
}
|
|
2822
2849
|
) });
|