@builder.io/sdk-react-nextjs 0.8.1 → 0.10.0
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/{USE_CLIENT_BUNDLE-0479ddc8.js → USE_CLIENT_BUNDLE-8a469a88.js} +195 -189
- package/lib/browser/USE_CLIENT_BUNDLE-bd42f34e.cjs +23 -0
- package/lib/{edge/USE_SERVER_BUNDLE-70f5e4b2.cjs → browser/USE_SERVER_BUNDLE-608eb1c6.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-de23a873.js → browser/USE_SERVER_BUNDLE-b0fcc116.js} +1 -1
- package/lib/browser/{bundle-e4200429.cjs → bundle-6593f46a.cjs} +10 -10
- package/lib/browser/{bundle-179c65a2.js → bundle-f23172a5.js} +288 -268
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/edge/USE_CLIENT_BUNDLE-2ee2538b.cjs +23 -0
- package/lib/{node/USE_CLIENT_BUNDLE-ac10325c.js → edge/USE_CLIENT_BUNDLE-474e3242.js} +195 -189
- package/lib/{node/USE_SERVER_BUNDLE-de4b4ff0.cjs → edge/USE_SERVER_BUNDLE-b5ccb43b.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-2b7a9305.js → edge/USE_SERVER_BUNDLE-da7c49b1.js} +1 -1
- package/lib/edge/{bundle-a1501121.cjs → bundle-7c571d18.cjs} +30 -30
- package/lib/edge/{bundle-a958c31b.js → bundle-bd18331d.js} +1037 -1017
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-8c3da5c9.js → node/USE_CLIENT_BUNDLE-39759ac3.js} +195 -189
- package/lib/node/USE_CLIENT_BUNDLE-fcb61de5.cjs +23 -0
- package/lib/{browser/USE_SERVER_BUNDLE-71c86494.cjs → node/USE_SERVER_BUNDLE-9a538e9b.cjs} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-88940a10.js → node/USE_SERVER_BUNDLE-9cade0d5.js} +1 -1
- package/lib/node/{bundle-59bd1206.js → bundle-49222e30.js} +188 -168
- package/lib/node/{bundle-ef482315.cjs → bundle-ad89090d.cjs} +9 -9
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/components/blocks/blocks-wrapper.d.ts +8 -0
- package/types/cjs/components/blocks/blocks.d.ts +1 -1
- package/types/cjs/components/content/components/enable-editor.d.ts +1 -1
- package/types/cjs/components/content-variants/content-variants.types.d.ts +16 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/types.d.ts +2 -1
- package/types/cjs/functions/get-content/index.d.ts +2 -2
- package/types/cjs/functions/transform-block-properties.d.ts +5 -1
- package/types/cjs/types/enforced-partials.d.ts +7 -2
- package/types/esm/components/blocks/blocks-wrapper.d.ts +8 -0
- package/types/esm/components/blocks/blocks.d.ts +1 -1
- package/types/esm/components/content/components/enable-editor.d.ts +1 -1
- package/types/esm/components/content-variants/content-variants.types.d.ts +16 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/types.d.ts +2 -1
- package/types/esm/functions/get-content/index.d.ts +2 -2
- package/types/esm/functions/transform-block-properties.d.ts +5 -1
- package/types/esm/types/enforced-partials.d.ts +7 -2
- package/lib/browser/USE_CLIENT_BUNDLE-38635250.cjs +0 -23
- package/lib/edge/USE_CLIENT_BUNDLE-7d1db7a7.cjs +0 -23
- package/lib/node/USE_CLIENT_BUNDLE-1fd9261f.cjs +0 -23
- package/types/cjs/functions/get-react-native-block-styles.d.ts +0 -7
- package/types/cjs/functions/sanitize-react-native-block-styles.d.ts +0 -3
- package/types/esm/functions/get-react-native-block-styles.d.ts +0 -7
- package/types/esm/functions/sanitize-react-native-block-styles.d.ts +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache } from "lru-cache";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createElement } from "react";
|
|
4
|
-
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-
|
|
4
|
+
import { I as InteractiveElement, B as BlockWrapper, a as BlocksWrapper, b as Button, C as CustomCode, E as Embed, F as FragmentComponent, c as Image, d as ImgComponent, S as SectionComponent, V as Video, e as EnableEditor } from "./USE_CLIENT_BUNDLE-39759ac3.js";
|
|
5
5
|
import "next/navigation";
|
|
6
6
|
function getBlockComponentOptions(e) {
|
|
7
7
|
var t;
|
|
@@ -86,15 +86,15 @@ const getLocation = () => {
|
|
|
86
86
|
builder: t,
|
|
87
87
|
context: n,
|
|
88
88
|
event: o,
|
|
89
|
-
localState:
|
|
90
|
-
rootSetState:
|
|
89
|
+
localState: r,
|
|
90
|
+
rootSetState: i,
|
|
91
91
|
rootState: a
|
|
92
92
|
}) => {
|
|
93
93
|
const s = getFunctionArguments({
|
|
94
94
|
builder: t,
|
|
95
95
|
context: n,
|
|
96
96
|
event: o,
|
|
97
|
-
state: flattenState(a,
|
|
97
|
+
state: flattenState(a, r, i)
|
|
98
98
|
});
|
|
99
99
|
return new Function(...s.map(([c]) => c), e)(...s.map(([, c]) => c));
|
|
100
100
|
};
|
|
@@ -102,11 +102,11 @@ function flattenState(e, t, n) {
|
|
|
102
102
|
if (e === t)
|
|
103
103
|
throw new Error("rootState === localState");
|
|
104
104
|
return new Proxy(e, {
|
|
105
|
-
get: (o,
|
|
106
|
-
set: (o,
|
|
107
|
-
if (t &&
|
|
105
|
+
get: (o, r) => t && r in t ? t[r] : e[r],
|
|
106
|
+
set: (o, r, i) => {
|
|
107
|
+
if (t && r in t)
|
|
108
108
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
109
|
-
return e[
|
|
109
|
+
return e[r] = i, n == null || n(e), !0;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@ const fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t, n) => {
|
|
|
114
114
|
if (Object(e) !== e)
|
|
115
115
|
return e;
|
|
116
116
|
const o = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
117
|
-
return o.slice(0, -1).reduce((
|
|
117
|
+
return o.slice(0, -1).reduce((r, i, a) => Object(r[i]) === r[i] ? r[i] : r[i] = Math.abs(Number(o[a + 1])) >> 0 === +o[a + 1] ? [] : {}, e)[o[o.length - 1]] = n, e;
|
|
118
118
|
}, noop = () => {
|
|
119
119
|
};
|
|
120
120
|
let safeDynamicRequire = noop;
|
|
@@ -175,13 +175,13 @@ output;
|
|
|
175
175
|
builder: t,
|
|
176
176
|
context: n,
|
|
177
177
|
event: o,
|
|
178
|
-
localState:
|
|
179
|
-
rootSetState:
|
|
178
|
+
localState: r,
|
|
179
|
+
rootSetState: i,
|
|
180
180
|
rootState: a
|
|
181
181
|
}) => {
|
|
182
182
|
const s = fastClone({
|
|
183
183
|
...a,
|
|
184
|
-
...
|
|
184
|
+
...r
|
|
185
185
|
}), c = getFunctionArguments({
|
|
186
186
|
builder: t,
|
|
187
187
|
context: n,
|
|
@@ -191,7 +191,7 @@ output;
|
|
|
191
191
|
f.setSync("global", f.derefInto()), f.setSync("log", function(...l) {
|
|
192
192
|
console.log(...l);
|
|
193
193
|
}), f.setSync(BUILDER_SET_STATE_NAME, function(l, u) {
|
|
194
|
-
set(a, l, u),
|
|
194
|
+
set(a, l, u), i == null || i(a);
|
|
195
195
|
}), c.forEach(([l, u]) => {
|
|
196
196
|
const d = typeof u == "object" ? new ivm.Reference(
|
|
197
197
|
// workaround: methods with default values for arguments is not being cloned over
|
|
@@ -217,8 +217,8 @@ function evaluate({
|
|
|
217
217
|
context: t,
|
|
218
218
|
localState: n,
|
|
219
219
|
rootState: o,
|
|
220
|
-
rootSetState:
|
|
221
|
-
event:
|
|
220
|
+
rootSetState: r,
|
|
221
|
+
event: i,
|
|
222
222
|
isExpression: a = !0
|
|
223
223
|
}) {
|
|
224
224
|
if (e === "") {
|
|
@@ -231,8 +231,8 @@ function evaluate({
|
|
|
231
231
|
}),
|
|
232
232
|
builder: getBuilderGlobals(),
|
|
233
233
|
context: t,
|
|
234
|
-
event:
|
|
235
|
-
rootSetState:
|
|
234
|
+
event: i,
|
|
235
|
+
rootSetState: r,
|
|
236
236
|
rootState: o,
|
|
237
237
|
localState: n
|
|
238
238
|
};
|
|
@@ -253,17 +253,17 @@ const evaluateBindings = ({
|
|
|
253
253
|
context: t,
|
|
254
254
|
localState: n,
|
|
255
255
|
rootState: o,
|
|
256
|
-
rootSetState:
|
|
256
|
+
rootSetState: r
|
|
257
257
|
}) => {
|
|
258
258
|
if (!e.bindings)
|
|
259
259
|
return e;
|
|
260
|
-
const
|
|
261
|
-
...
|
|
260
|
+
const i = fastClone(e), a = {
|
|
261
|
+
...i,
|
|
262
262
|
properties: {
|
|
263
|
-
...
|
|
263
|
+
...i.properties
|
|
264
264
|
},
|
|
265
265
|
actions: {
|
|
266
|
-
...
|
|
266
|
+
...i.actions
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
269
|
for (const s in e.bindings) {
|
|
@@ -271,7 +271,7 @@ const evaluateBindings = ({
|
|
|
271
271
|
code: c,
|
|
272
272
|
localState: n,
|
|
273
273
|
rootState: o,
|
|
274
|
-
rootSetState:
|
|
274
|
+
rootSetState: r,
|
|
275
275
|
context: t
|
|
276
276
|
});
|
|
277
277
|
set(a, s, m);
|
|
@@ -283,15 +283,15 @@ function getProcessedBlock({
|
|
|
283
283
|
context: t,
|
|
284
284
|
shouldEvaluateBindings: n,
|
|
285
285
|
localState: o,
|
|
286
|
-
rootState:
|
|
287
|
-
rootSetState:
|
|
286
|
+
rootState: r,
|
|
287
|
+
rootSetState: i
|
|
288
288
|
}) {
|
|
289
289
|
const a = e;
|
|
290
290
|
return n ? evaluateBindings({
|
|
291
291
|
block: a,
|
|
292
292
|
localState: o,
|
|
293
|
-
rootState:
|
|
294
|
-
rootSetState:
|
|
293
|
+
rootState: r,
|
|
294
|
+
rootSetState: i,
|
|
295
295
|
context: t
|
|
296
296
|
}) : a;
|
|
297
297
|
}
|
|
@@ -300,20 +300,20 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
300
300
|
context: t,
|
|
301
301
|
registeredComponents: n
|
|
302
302
|
}) => {
|
|
303
|
-
var
|
|
304
|
-
const o = (
|
|
303
|
+
var i;
|
|
304
|
+
const o = (i = getProcessedBlock({
|
|
305
305
|
block: e,
|
|
306
306
|
localState: t.localState,
|
|
307
307
|
rootState: t.rootState,
|
|
308
308
|
rootSetState: t.rootSetState,
|
|
309
309
|
context: t.context,
|
|
310
310
|
shouldEvaluateBindings: !1
|
|
311
|
-
}).component) == null ? void 0 :
|
|
311
|
+
}).component) == null ? void 0 : i.name;
|
|
312
312
|
if (!o)
|
|
313
313
|
return null;
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
316
|
-
return
|
|
314
|
+
const r = n[o];
|
|
315
|
+
if (r)
|
|
316
|
+
return r;
|
|
317
317
|
console.warn(`
|
|
318
318
|
Could not find a registered component named "${o}".
|
|
319
319
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -327,17 +327,17 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
327
327
|
} = e;
|
|
328
328
|
if (!(n != null && n.collection))
|
|
329
329
|
return;
|
|
330
|
-
const
|
|
330
|
+
const r = evaluate({
|
|
331
331
|
code: n.collection,
|
|
332
332
|
localState: t.localState,
|
|
333
333
|
rootState: t.rootState,
|
|
334
334
|
rootSetState: t.rootSetState,
|
|
335
335
|
context: t.context
|
|
336
336
|
});
|
|
337
|
-
if (!Array.isArray(
|
|
337
|
+
if (!Array.isArray(r))
|
|
338
338
|
return;
|
|
339
|
-
const
|
|
340
|
-
return
|
|
339
|
+
const i = n.collection.split(".").pop(), a = n.itemName || (i ? i + "Item" : "item");
|
|
340
|
+
return r.map((c, m) => ({
|
|
341
341
|
context: {
|
|
342
342
|
...t,
|
|
343
343
|
localState: {
|
|
@@ -379,18 +379,18 @@ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img",
|
|
|
379
379
|
min: o,
|
|
380
380
|
default: o + 1
|
|
381
381
|
};
|
|
382
|
-
const
|
|
382
|
+
const r = n.small.max + 1;
|
|
383
383
|
n.medium = {
|
|
384
384
|
max: t,
|
|
385
|
-
min:
|
|
386
|
-
default:
|
|
385
|
+
min: r,
|
|
386
|
+
default: r + 1
|
|
387
387
|
};
|
|
388
|
-
const
|
|
388
|
+
const i = n.medium.max + 1;
|
|
389
389
|
return n.large = {
|
|
390
390
|
max: 2e3,
|
|
391
391
|
// TODO: decide upper limit
|
|
392
|
-
min:
|
|
393
|
-
default:
|
|
392
|
+
min: i,
|
|
393
|
+
default: i + 1
|
|
394
394
|
}, n;
|
|
395
395
|
}, camelToKebabCase = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), checkIsDefined = (e) => e != null, convertStyleMapToCSSArray = (e) => Object.entries(e).map(([n, o]) => {
|
|
396
396
|
if (typeof o == "string")
|
|
@@ -413,7 +413,7 @@ function InlinedStyles(e) {
|
|
|
413
413
|
}
|
|
414
414
|
function BlockStyles(e) {
|
|
415
415
|
const t = function() {
|
|
416
|
-
const
|
|
416
|
+
const r = getProcessedBlock({
|
|
417
417
|
block: e.block,
|
|
418
418
|
localState: e.context.localState,
|
|
419
419
|
rootState: e.context.rootState,
|
|
@@ -421,19 +421,19 @@ function BlockStyles(e) {
|
|
|
421
421
|
context: e.context.context,
|
|
422
422
|
shouldEvaluateBindings: !0
|
|
423
423
|
});
|
|
424
|
-
return checkIsDefined(
|
|
424
|
+
return checkIsDefined(r.hide) ? !r.hide : checkIsDefined(r.show) ? r.show : !0;
|
|
425
425
|
}, n = function() {
|
|
426
426
|
var d;
|
|
427
|
-
const
|
|
427
|
+
const r = getProcessedBlock({
|
|
428
428
|
block: e.block,
|
|
429
429
|
localState: e.context.localState,
|
|
430
430
|
rootState: e.context.rootState,
|
|
431
431
|
rootSetState: e.context.rootSetState,
|
|
432
432
|
context: e.context.context,
|
|
433
433
|
shouldEvaluateBindings: !0
|
|
434
|
-
}),
|
|
434
|
+
}), i = r.responsiveStyles, a = e.context.content, s = getSizesForBreakpoints(
|
|
435
435
|
((d = a == null ? void 0 : a.meta) == null ? void 0 : d.breakpoints) || {}
|
|
436
|
-
), c =
|
|
436
|
+
), c = i == null ? void 0 : i.large, m = i == null ? void 0 : i.medium, f = i == null ? void 0 : i.small, g = r.id;
|
|
437
437
|
if (!g)
|
|
438
438
|
return "";
|
|
439
439
|
const p = c ? createCssClass({
|
|
@@ -475,23 +475,25 @@ function getBlockActions(e) {
|
|
|
475
475
|
for (const o in n) {
|
|
476
476
|
if (!n.hasOwnProperty(o))
|
|
477
477
|
continue;
|
|
478
|
-
const
|
|
479
|
-
let
|
|
478
|
+
const r = n[o];
|
|
479
|
+
let i = getEventHandlerName(o);
|
|
480
480
|
if (e.stripPrefix)
|
|
481
481
|
switch (TARGET) {
|
|
482
482
|
case "vue2":
|
|
483
483
|
case "vue3":
|
|
484
|
-
|
|
484
|
+
i = i.replace("v-on:", "");
|
|
485
485
|
break;
|
|
486
486
|
case "svelte":
|
|
487
|
-
|
|
487
|
+
i = i.replace("on:", "");
|
|
488
488
|
break;
|
|
489
489
|
}
|
|
490
|
-
t[
|
|
490
|
+
t[i] = createEventHandler(r, e);
|
|
491
491
|
}
|
|
492
492
|
return t;
|
|
493
493
|
}
|
|
494
|
-
function transformBlockProperties(
|
|
494
|
+
function transformBlockProperties({
|
|
495
|
+
properties: e
|
|
496
|
+
}) {
|
|
495
497
|
return e.className = e.class, delete e.class, e;
|
|
496
498
|
}
|
|
497
499
|
const extractRelevantRootBlockProperties = (e) => ({
|
|
@@ -509,7 +511,11 @@ function getBlockProperties({
|
|
|
509
511
|
style: e.style ? getStyleAttribute(e.style) : void 0,
|
|
510
512
|
class: [e.id, "builder-block", e.class, (o = e.properties) == null ? void 0 : o.class].filter(Boolean).join(" ")
|
|
511
513
|
};
|
|
512
|
-
return transformBlockProperties(
|
|
514
|
+
return transformBlockProperties({
|
|
515
|
+
properties: n,
|
|
516
|
+
context: t,
|
|
517
|
+
block: e
|
|
518
|
+
});
|
|
513
519
|
}
|
|
514
520
|
function getStyleAttribute(e) {
|
|
515
521
|
switch (TARGET) {
|
|
@@ -530,10 +536,10 @@ const getWrapperProps = ({
|
|
|
530
536
|
builderBlock: t,
|
|
531
537
|
context: n,
|
|
532
538
|
componentRef: o,
|
|
533
|
-
includeBlockProps:
|
|
534
|
-
isInteractive:
|
|
539
|
+
includeBlockProps: r,
|
|
540
|
+
isInteractive: i,
|
|
535
541
|
contextValue: a
|
|
536
|
-
}) =>
|
|
542
|
+
}) => i ? {
|
|
537
543
|
Wrapper: o,
|
|
538
544
|
block: t,
|
|
539
545
|
context: n,
|
|
@@ -544,7 +550,7 @@ const getWrapperProps = ({
|
|
|
544
550
|
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
545
551
|
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
546
552
|
*/
|
|
547
|
-
...
|
|
553
|
+
...r ? {
|
|
548
554
|
attributes: getBlockProperties({
|
|
549
555
|
block: t,
|
|
550
556
|
context: a
|
|
@@ -567,22 +573,22 @@ function ComponentRef(e) {
|
|
|
567
573
|
contextValue: e.context
|
|
568
574
|
}),
|
|
569
575
|
children: [
|
|
570
|
-
(n = e.blockChildren) == null ? void 0 : n.map((
|
|
576
|
+
(n = e.blockChildren) == null ? void 0 : n.map((r) => /* @__PURE__ */ jsx(
|
|
571
577
|
Block,
|
|
572
578
|
{
|
|
573
|
-
block:
|
|
579
|
+
block: r,
|
|
574
580
|
context: e.context,
|
|
575
581
|
registeredComponents: e.registeredComponents
|
|
576
582
|
},
|
|
577
|
-
"block-" +
|
|
583
|
+
"block-" + r.id
|
|
578
584
|
)),
|
|
579
|
-
(o = e.blockChildren) == null ? void 0 : o.map((
|
|
585
|
+
(o = e.blockChildren) == null ? void 0 : o.map((r) => /* @__PURE__ */ jsx(
|
|
580
586
|
BlockStyles,
|
|
581
587
|
{
|
|
582
|
-
block:
|
|
588
|
+
block: r,
|
|
583
589
|
context: e.context
|
|
584
590
|
},
|
|
585
|
-
"block-style-" +
|
|
591
|
+
"block-style-" + r.id
|
|
586
592
|
))
|
|
587
593
|
]
|
|
588
594
|
}
|
|
@@ -622,9 +628,9 @@ function Block(e) {
|
|
|
622
628
|
context: e.context.context,
|
|
623
629
|
shouldEvaluateBindings: !0
|
|
624
630
|
});
|
|
625
|
-
}, i = function() {
|
|
626
|
-
return e.block.tagName || "div";
|
|
627
631
|
}, r = function() {
|
|
632
|
+
return e.block.tagName || "div";
|
|
633
|
+
}, i = function() {
|
|
628
634
|
var b, y;
|
|
629
635
|
if ((b = e.block.repeat) != null && b.collection)
|
|
630
636
|
return !!((y = n()) != null && y.length);
|
|
@@ -652,7 +658,7 @@ function Block(e) {
|
|
|
652
658
|
isInteractive: !((h = t()) != null && h.isRSC)
|
|
653
659
|
};
|
|
654
660
|
}, c = e.context;
|
|
655
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
661
|
+
return /* @__PURE__ */ jsx(Fragment, { children: i() ? /* @__PURE__ */ jsx(Fragment, { children: (m = t()) != null && m.noWrap ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
656
662
|
ComponentRef,
|
|
657
663
|
{
|
|
658
664
|
componentRef: s().componentRef,
|
|
@@ -665,16 +671,16 @@ function Block(e) {
|
|
|
665
671
|
isInteractive: s().isInteractive
|
|
666
672
|
}
|
|
667
673
|
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
668
|
-
isEmptyHtmlElement(
|
|
674
|
+
isEmptyHtmlElement(r()) ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
669
675
|
BlockWrapper,
|
|
670
676
|
{
|
|
671
|
-
Wrapper:
|
|
677
|
+
Wrapper: r(),
|
|
672
678
|
block: o(),
|
|
673
679
|
context: e.context,
|
|
674
680
|
hasChildren: !1
|
|
675
681
|
}
|
|
676
682
|
) }) : null,
|
|
677
|
-
!isEmptyHtmlElement(
|
|
683
|
+
!isEmptyHtmlElement(r()) && n() ? /* @__PURE__ */ jsx(Fragment, { children: (f = n()) == null ? void 0 : f.map((l, u) => /* @__PURE__ */ jsx(
|
|
678
684
|
RepeatedBlock,
|
|
679
685
|
{
|
|
680
686
|
repeatContext: l.context,
|
|
@@ -683,10 +689,10 @@ function Block(e) {
|
|
|
683
689
|
},
|
|
684
690
|
u
|
|
685
691
|
)) }) : null,
|
|
686
|
-
!isEmptyHtmlElement(
|
|
692
|
+
!isEmptyHtmlElement(r()) && !n() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
687
693
|
BlockWrapper,
|
|
688
694
|
{
|
|
689
|
-
Wrapper:
|
|
695
|
+
Wrapper: r(),
|
|
690
696
|
block: o(),
|
|
691
697
|
context: e.context,
|
|
692
698
|
hasChildren: !0,
|
|
@@ -727,7 +733,7 @@ function Block(e) {
|
|
|
727
733
|
] }) }) : null });
|
|
728
734
|
}
|
|
729
735
|
function Blocks(e) {
|
|
730
|
-
var t, n;
|
|
736
|
+
var t, n, o, r;
|
|
731
737
|
return /* @__PURE__ */ jsxs(
|
|
732
738
|
BlocksWrapper,
|
|
733
739
|
{
|
|
@@ -735,23 +741,25 @@ function Blocks(e) {
|
|
|
735
741
|
parent: e.parent,
|
|
736
742
|
path: e.path,
|
|
737
743
|
styleProp: e.styleProp,
|
|
744
|
+
BlocksWrapper: (t = e.context) == null ? void 0 : t.BlocksWrapper,
|
|
745
|
+
BlocksWrapperProps: (n = e.context) == null ? void 0 : n.BlocksWrapperProps,
|
|
738
746
|
children: [
|
|
739
|
-
e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
747
|
+
e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (o = e.blocks) == null ? void 0 : o.map((i) => /* @__PURE__ */ jsx(
|
|
740
748
|
Block,
|
|
741
749
|
{
|
|
742
|
-
block:
|
|
750
|
+
block: i,
|
|
743
751
|
context: e.context,
|
|
744
752
|
registeredComponents: e.registeredComponents
|
|
745
753
|
},
|
|
746
|
-
"render-block-" +
|
|
754
|
+
"render-block-" + i.id
|
|
747
755
|
)) }) : null,
|
|
748
|
-
e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (
|
|
756
|
+
e.blocks ? /* @__PURE__ */ jsx(Fragment, { children: (r = e.blocks) == null ? void 0 : r.map((i) => /* @__PURE__ */ jsx(
|
|
749
757
|
BlockStyles,
|
|
750
758
|
{
|
|
751
|
-
block:
|
|
759
|
+
block: i,
|
|
752
760
|
context: e.context
|
|
753
761
|
},
|
|
754
|
-
"block-style-" +
|
|
762
|
+
"block-style-" + i.id
|
|
755
763
|
)) }) : null
|
|
756
764
|
]
|
|
757
765
|
}
|
|
@@ -759,12 +767,12 @@ function Blocks(e) {
|
|
|
759
767
|
}
|
|
760
768
|
function Columns(e) {
|
|
761
769
|
var l;
|
|
762
|
-
const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet",
|
|
770
|
+
const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", r = function(d) {
|
|
763
771
|
var b;
|
|
764
772
|
return ((b = n[d]) == null ? void 0 : b.width) || 100 / n.length;
|
|
765
|
-
},
|
|
773
|
+
}, i = function(d) {
|
|
766
774
|
const b = t * (n.length - 1) / n.length;
|
|
767
|
-
return `calc(${
|
|
775
|
+
return `calc(${r(d)}% - ${b}px)`;
|
|
768
776
|
}, a = function({
|
|
769
777
|
stackedStyle: d,
|
|
770
778
|
desktopStyle: b
|
|
@@ -784,7 +792,7 @@ function Columns(e) {
|
|
|
784
792
|
})
|
|
785
793
|
};
|
|
786
794
|
}, f = function(d) {
|
|
787
|
-
const b = d === 0 ? 0 : t, y =
|
|
795
|
+
const b = d === 0 ? 0 : t, y = i(d), h = `${b}px`, v = "100%", x = 0;
|
|
788
796
|
return {
|
|
789
797
|
width: y,
|
|
790
798
|
["marginLeft"]: h,
|
|
@@ -883,8 +891,8 @@ function removeProtocol(e) {
|
|
|
883
891
|
return e.replace(/http(s)?:/, "");
|
|
884
892
|
}
|
|
885
893
|
function updateQueryParam(e = "", t, n) {
|
|
886
|
-
const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"),
|
|
887
|
-
return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e +
|
|
894
|
+
const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), r = e.indexOf("?") !== -1 ? "&" : "?";
|
|
895
|
+
return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + r + t + "=" + encodeURIComponent(n);
|
|
888
896
|
}
|
|
889
897
|
function getShopifyImageUrl(e, t) {
|
|
890
898
|
if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
|
|
@@ -893,8 +901,8 @@ function getShopifyImageUrl(e, t) {
|
|
|
893
901
|
return removeProtocol(e);
|
|
894
902
|
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
895
903
|
if (n) {
|
|
896
|
-
const o = e.split(n[0]),
|
|
897
|
-
return removeProtocol(`${o[0]}_${
|
|
904
|
+
const o = e.split(n[0]), r = n[3], i = t.match("x") ? t : `${t}x`;
|
|
905
|
+
return removeProtocol(`${o[0]}_${i}${r}`);
|
|
898
906
|
}
|
|
899
907
|
return null;
|
|
900
908
|
}
|
|
@@ -905,7 +913,7 @@ function getSrcSet(e) {
|
|
|
905
913
|
if (e.match(/builder\.io/)) {
|
|
906
914
|
let n = e;
|
|
907
915
|
const o = Number(e.split("?width=")[1]);
|
|
908
|
-
return isNaN(o) || (n = `${n} ${o}w`), t.filter((
|
|
916
|
+
return isNaN(o) || (n = `${n} ${o}w`), t.filter((r) => r !== o).map((r) => `${updateQueryParam(e, "width", r)} ${r}w`).concat([n]).join(", ");
|
|
909
917
|
}
|
|
910
918
|
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [getShopifyImageUrl(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
|
|
911
919
|
}
|
|
@@ -930,7 +938,7 @@ const getTopLevelDomain = (e) => {
|
|
|
930
938
|
value: t,
|
|
931
939
|
expires: n
|
|
932
940
|
}) => {
|
|
933
|
-
const
|
|
941
|
+
const r = (isBrowser() ? location.protocol === "https:" : !0) ? SECURE_CONFIG : [[]], i = n ? [["expires", n.toUTCString()]] : [[]], a = [[e, t], ...i, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...r];
|
|
934
942
|
return stringifyCookie(a);
|
|
935
943
|
}, setCookie = async ({
|
|
936
944
|
name: e,
|
|
@@ -941,14 +949,14 @@ const getTopLevelDomain = (e) => {
|
|
|
941
949
|
try {
|
|
942
950
|
if (!o)
|
|
943
951
|
return;
|
|
944
|
-
const
|
|
952
|
+
const r = createCookieString({
|
|
945
953
|
name: e,
|
|
946
954
|
value: t,
|
|
947
955
|
expires: n
|
|
948
956
|
});
|
|
949
|
-
document.cookie =
|
|
950
|
-
} catch (
|
|
951
|
-
logger.warn("[COOKIE] SET error: ", (
|
|
957
|
+
document.cookie = r;
|
|
958
|
+
} catch (r) {
|
|
959
|
+
logger.warn("[COOKIE] SET error: ", (r == null ? void 0 : r.message) || r);
|
|
952
960
|
}
|
|
953
961
|
}, BUILDER_STORE_PREFIX = "builder.tests", getContentTestKey = (e) => `${BUILDER_STORE_PREFIX}.${e}`, getContentVariationCookie = ({
|
|
954
962
|
contentId: e
|
|
@@ -971,13 +979,13 @@ const getTopLevelDomain = (e) => {
|
|
|
971
979
|
id: e,
|
|
972
980
|
variations: t
|
|
973
981
|
}) => {
|
|
974
|
-
var
|
|
982
|
+
var r;
|
|
975
983
|
let n = 0;
|
|
976
984
|
const o = Math.random();
|
|
977
|
-
for (const
|
|
978
|
-
const a = (
|
|
985
|
+
for (const i in t) {
|
|
986
|
+
const a = (r = t[i]) == null ? void 0 : r.testRatio;
|
|
979
987
|
if (n += a, o < n)
|
|
980
|
-
return
|
|
988
|
+
return i;
|
|
981
989
|
}
|
|
982
990
|
return e;
|
|
983
991
|
}, getAndSetVariantId = (e) => {
|
|
@@ -1036,13 +1044,13 @@ const getTopLevelDomain = (e) => {
|
|
|
1036
1044
|
}) || getAndSetVariantId({
|
|
1037
1045
|
variations: e.variations,
|
|
1038
1046
|
id: e.id
|
|
1039
|
-
}),
|
|
1047
|
+
}), r = getTestFields({
|
|
1040
1048
|
item: e,
|
|
1041
1049
|
testGroupId: o
|
|
1042
1050
|
});
|
|
1043
1051
|
return {
|
|
1044
1052
|
...e,
|
|
1045
|
-
...
|
|
1053
|
+
...r
|
|
1046
1054
|
};
|
|
1047
1055
|
}, getDefaultCanTrack = (e) => checkIsDefined(e) ? e : !0, componentInfo$a = {
|
|
1048
1056
|
name: "Core:Button",
|
|
@@ -1256,7 +1264,7 @@ const getTopLevelDomain = (e) => {
|
|
|
1256
1264
|
});
|
|
1257
1265
|
}
|
|
1258
1266
|
const n = e.get("columns");
|
|
1259
|
-
Array.isArray(n) && n.find((
|
|
1267
|
+
Array.isArray(n) && n.find((r) => r.get("width")) && (n.find((i) => !i.get("width")) || n.reduce((s, c) => s + c.get("width"), 0) !== 100) && t();
|
|
1260
1268
|
}
|
|
1261
1269
|
}, {
|
|
1262
1270
|
name: "space",
|
|
@@ -1367,13 +1375,13 @@ const getTopLevelDomain = (e) => {
|
|
|
1367
1375
|
function o(a) {
|
|
1368
1376
|
return Math.round(a * 1e3) / 1e3;
|
|
1369
1377
|
}
|
|
1370
|
-
const
|
|
1371
|
-
if (fetch(
|
|
1378
|
+
const r = e.get("image"), i = e.get("aspectRatio");
|
|
1379
|
+
if (fetch(r).then((a) => a.blob()).then((a) => {
|
|
1372
1380
|
a.type.includes("svg") && e.set("noWebp", !0);
|
|
1373
|
-
}),
|
|
1374
|
-
return n(
|
|
1381
|
+
}), r && (!i || i === 0.7041))
|
|
1382
|
+
return n(r).then((a) => {
|
|
1375
1383
|
const s = e.get("aspectRatio");
|
|
1376
|
-
e.get("image") ===
|
|
1384
|
+
e.get("image") === r && (!s || s === 0.7041) && a.width && a.height && (e.set("aspectRatio", o(a.height / a.width)), e.set("height", a.height), e.set("width", a.width));
|
|
1377
1385
|
});
|
|
1378
1386
|
}
|
|
1379
1387
|
}, {
|
|
@@ -1674,9 +1682,9 @@ const componentInfo = {
|
|
|
1674
1682
|
...t
|
|
1675
1683
|
}) => ({
|
|
1676
1684
|
...fastClone(t),
|
|
1677
|
-
inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((o, [
|
|
1685
|
+
inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((o, [r, i]) => ({
|
|
1678
1686
|
...o,
|
|
1679
|
-
[
|
|
1687
|
+
[r]: serializeValue(i)
|
|
1680
1688
|
}), {}))
|
|
1681
1689
|
}), UPDATE_COOKIES_AND_STYLES_SCRIPT = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1682
1690
|
function getAndSetVariantId() {
|
|
@@ -1824,14 +1832,14 @@ function getFetch() {
|
|
|
1824
1832
|
}
|
|
1825
1833
|
const fetch$1 = getFetch();
|
|
1826
1834
|
function flatten(e, t = null, n = ".") {
|
|
1827
|
-
return Object.keys(e).reduce((o,
|
|
1828
|
-
const
|
|
1829
|
-
return [typeof
|
|
1835
|
+
return Object.keys(e).reduce((o, r) => {
|
|
1836
|
+
const i = e[r], a = [t, r].filter(Boolean).join(n);
|
|
1837
|
+
return [typeof i == "object", i !== null, !(Array.isArray(i) && i.length === 0)].every(Boolean) ? {
|
|
1830
1838
|
...o,
|
|
1831
|
-
...flatten(
|
|
1839
|
+
...flatten(i, a, n)
|
|
1832
1840
|
} : {
|
|
1833
1841
|
...o,
|
|
1834
|
-
[a]:
|
|
1842
|
+
[a]: i
|
|
1835
1843
|
};
|
|
1836
1844
|
}, {});
|
|
1837
1845
|
}
|
|
@@ -1846,8 +1854,8 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
1846
1854
|
const t = normalizeSearchParams(e), n = {};
|
|
1847
1855
|
return Object.keys(t).forEach((o) => {
|
|
1848
1856
|
if (o.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
1849
|
-
const
|
|
1850
|
-
n[
|
|
1857
|
+
const r = o.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
|
|
1858
|
+
n[r] = t[o];
|
|
1851
1859
|
}
|
|
1852
1860
|
}), n;
|
|
1853
1861
|
}, getBuilderSearchParamsFromWindow = () => {
|
|
@@ -1862,8 +1870,8 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
1862
1870
|
const {
|
|
1863
1871
|
limit: n = 30,
|
|
1864
1872
|
userAttributes: o,
|
|
1865
|
-
query:
|
|
1866
|
-
model:
|
|
1873
|
+
query: r,
|
|
1874
|
+
model: i,
|
|
1867
1875
|
apiKey: a,
|
|
1868
1876
|
includeRefs: s = !0,
|
|
1869
1877
|
enrich: c,
|
|
@@ -1882,7 +1890,7 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
1882
1890
|
if (!["v2", "v3"].includes(f))
|
|
1883
1891
|
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
|
|
1884
1892
|
(e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
|
|
1885
|
-
const h = new URL(`https://cdn.builder.io/api/${f}/content/${
|
|
1893
|
+
const h = new URL(`https://cdn.builder.io/api/${f}/content/${i}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${s}${m ? `&locale=${m}` : ""}${c ? `&enrich=${c}` : ""}`);
|
|
1886
1894
|
if (h.searchParams.set("omit", p || "meta.componentsUsed"), g && h.searchParams.set("fields", g), Number.isFinite(l) && l > -1 && h.searchParams.set("offset", String(Math.floor(l))), typeof y == "boolean" && h.searchParams.set("includeUnpublished", String(y)), u && isPositiveNumber(u) && h.searchParams.set("cacheSeconds", String(u)), d && isPositiveNumber(d) && h.searchParams.set("staleCacheSeconds", String(d)), b) {
|
|
1887
1895
|
const S = flatten({
|
|
1888
1896
|
sort: b
|
|
@@ -1896,9 +1904,9 @@ const DEFAULT_API_VERSION = "v3", BUILDER_SEARCHPARAMS_PREFIX = "builder.", BUIL
|
|
|
1896
1904
|
}, x = flatten(v);
|
|
1897
1905
|
for (const S in x)
|
|
1898
1906
|
h.searchParams.set(S, String(x[S]));
|
|
1899
|
-
if (o && h.searchParams.set("userAttributes", JSON.stringify(o)),
|
|
1907
|
+
if (o && h.searchParams.set("userAttributes", JSON.stringify(o)), r) {
|
|
1900
1908
|
const S = flatten({
|
|
1901
|
-
query:
|
|
1909
|
+
query: r
|
|
1902
1910
|
});
|
|
1903
1911
|
for (const C in S)
|
|
1904
1912
|
h.searchParams.set(C, JSON.stringify(S[C]));
|
|
@@ -1910,7 +1918,7 @@ async function fetchOneEntry(e) {
|
|
|
1910
1918
|
...e,
|
|
1911
1919
|
limit: 1
|
|
1912
1920
|
});
|
|
1913
|
-
return t && t
|
|
1921
|
+
return t && t[0] || null;
|
|
1914
1922
|
}
|
|
1915
1923
|
const getContent = fetchOneEntry, _fetchContent = async (e) => {
|
|
1916
1924
|
const t = generateContentUrl(e);
|
|
@@ -1918,27 +1926,27 @@ const getContent = fetchOneEntry, _fetchContent = async (e) => {
|
|
|
1918
1926
|
}, _processContentResult = async (e, t, n = generateContentUrl(e)) => {
|
|
1919
1927
|
const o = getDefaultCanTrack(e.canTrack);
|
|
1920
1928
|
if (n.search.includes("preview=")) {
|
|
1921
|
-
const
|
|
1929
|
+
const i = [];
|
|
1922
1930
|
for (const a of t.results) {
|
|
1923
1931
|
const s = getPreviewContent(n.searchParams);
|
|
1924
|
-
|
|
1932
|
+
i.push(s || a);
|
|
1925
1933
|
}
|
|
1926
|
-
t.results =
|
|
1934
|
+
t.results = i;
|
|
1927
1935
|
}
|
|
1928
1936
|
if (!o || !(isBrowser() || TARGET === "reactNative"))
|
|
1929
|
-
return t;
|
|
1937
|
+
return t.results;
|
|
1930
1938
|
try {
|
|
1931
|
-
const
|
|
1939
|
+
const i = [];
|
|
1932
1940
|
for (const a of t.results)
|
|
1933
|
-
|
|
1941
|
+
i.push(await handleABTesting({
|
|
1934
1942
|
item: a,
|
|
1935
1943
|
canTrack: o
|
|
1936
1944
|
}));
|
|
1937
|
-
t.results =
|
|
1938
|
-
} catch (
|
|
1939
|
-
logger.error("Could not process A/B tests. ",
|
|
1945
|
+
t.results = i;
|
|
1946
|
+
} catch (i) {
|
|
1947
|
+
logger.error("Could not process A/B tests. ", i);
|
|
1940
1948
|
}
|
|
1941
|
-
return t;
|
|
1949
|
+
return t.results;
|
|
1942
1950
|
};
|
|
1943
1951
|
async function fetchEntries(e) {
|
|
1944
1952
|
try {
|
|
@@ -2009,8 +2017,8 @@ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId", getSessionId = async ({
|
|
|
2009
2017
|
var o;
|
|
2010
2018
|
try {
|
|
2011
2019
|
t && ((o = getLocalStorage()) == null || o.setItem(e, n));
|
|
2012
|
-
} catch (
|
|
2013
|
-
console.debug("[LocalStorage] SET error: ",
|
|
2020
|
+
} catch (r) {
|
|
2021
|
+
console.debug("[LocalStorage] SET error: ", r);
|
|
2014
2022
|
}
|
|
2015
2023
|
}, VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId", getVisitorId = ({
|
|
2016
2024
|
canTrack: e
|
|
@@ -2059,11 +2067,11 @@ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId", getSessionId = async ({
|
|
|
2059
2067
|
canTrack: t,
|
|
2060
2068
|
apiKey: n,
|
|
2061
2069
|
metadata: o,
|
|
2062
|
-
...
|
|
2070
|
+
...r
|
|
2063
2071
|
}) => ({
|
|
2064
2072
|
type: e,
|
|
2065
2073
|
data: {
|
|
2066
|
-
...
|
|
2074
|
+
...r,
|
|
2067
2075
|
metadata: {
|
|
2068
2076
|
url: location.href,
|
|
2069
2077
|
...o
|
|
@@ -2119,9 +2127,9 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2119
2127
|
event: e,
|
|
2120
2128
|
target: t
|
|
2121
2129
|
}) => {
|
|
2122
|
-
const n = t.getBoundingClientRect(), o = e.clientX - n.left,
|
|
2130
|
+
const n = t.getBoundingClientRect(), o = e.clientX - n.left, r = e.clientY - n.top, i = round(o / n.width), a = round(r / n.height);
|
|
2123
2131
|
return {
|
|
2124
|
-
x:
|
|
2132
|
+
x: i,
|
|
2125
2133
|
y: a
|
|
2126
2134
|
};
|
|
2127
2135
|
}, getInteractionPropertiesForEvent = (e) => {
|
|
@@ -2140,7 +2148,7 @@ const findParentElement = (e, t, n = !0) => {
|
|
|
2140
2148
|
builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
|
|
2141
2149
|
}
|
|
2142
2150
|
};
|
|
2143
|
-
}, SDK_VERSION = "0.
|
|
2151
|
+
}, SDK_VERSION = "0.10.0", registry = {};
|
|
2144
2152
|
function register(e, t) {
|
|
2145
2153
|
let n = registry[e];
|
|
2146
2154
|
if (n || (n = registry[e] = []), n.push(t), isBrowser()) {
|
|
@@ -2153,8 +2161,8 @@ function register(e, t) {
|
|
|
2153
2161
|
};
|
|
2154
2162
|
try {
|
|
2155
2163
|
parent.postMessage(o, "*"), parent !== window && window.postMessage(o, "*");
|
|
2156
|
-
} catch (
|
|
2157
|
-
console.debug("Could not postmessage",
|
|
2164
|
+
} catch (r) {
|
|
2165
|
+
console.debug("Could not postmessage", r);
|
|
2158
2166
|
}
|
|
2159
2167
|
}
|
|
2160
2168
|
}
|
|
@@ -2203,7 +2211,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2203
2211
|
}, "*"), window.addEventListener("message", ({
|
|
2204
2212
|
data: o
|
|
2205
2213
|
}) => {
|
|
2206
|
-
var
|
|
2214
|
+
var r, i;
|
|
2207
2215
|
if (o != null && o.type)
|
|
2208
2216
|
switch (o.type) {
|
|
2209
2217
|
case "builder.evaluate": {
|
|
@@ -2214,7 +2222,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2214
2222
|
} catch (p) {
|
|
2215
2223
|
g = p;
|
|
2216
2224
|
}
|
|
2217
|
-
g ? (
|
|
2225
|
+
g ? (r = window.parent) == null || r.postMessage({
|
|
2218
2226
|
type: "builder.evaluateError",
|
|
2219
2227
|
data: {
|
|
2220
2228
|
id: c,
|
|
@@ -2229,7 +2237,7 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2229
2237
|
result: p
|
|
2230
2238
|
}
|
|
2231
2239
|
}, "*");
|
|
2232
|
-
}).catch(console.error) : (
|
|
2240
|
+
}).catch(console.error) : (i = window.parent) == null || i.postMessage({
|
|
2233
2241
|
type: "builder.evaluateResult",
|
|
2234
2242
|
data: {
|
|
2235
2243
|
result: f,
|
|
@@ -2241,10 +2249,10 @@ const setupBrowserForEditing = (e = {}) => {
|
|
|
2241
2249
|
}
|
|
2242
2250
|
})));
|
|
2243
2251
|
}, getCssFromFont = (e) => {
|
|
2244
|
-
var
|
|
2245
|
-
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = e.fileUrl ?? ((
|
|
2246
|
-
let
|
|
2247
|
-
if (o && t && n && (
|
|
2252
|
+
var i;
|
|
2253
|
+
const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = e.fileUrl ?? ((i = e == null ? void 0 : e.files) == null ? void 0 : i.regular);
|
|
2254
|
+
let r = "";
|
|
2255
|
+
if (o && t && n && (r += `
|
|
2248
2256
|
@font-face {
|
|
2249
2257
|
font-family: "${t}";
|
|
2250
2258
|
src: local("${n}"), url('${o}') format('woff2');
|
|
@@ -2256,7 +2264,7 @@ font-weight: 400;
|
|
|
2256
2264
|
if (!(String(Number(a)) === a))
|
|
2257
2265
|
continue;
|
|
2258
2266
|
const c = e.files[a];
|
|
2259
|
-
c && c !== o && (
|
|
2267
|
+
c && c !== o && (r += `
|
|
2260
2268
|
@font-face {
|
|
2261
2269
|
font-family: "${t}";
|
|
2262
2270
|
src: url('${c}') format('woff2');
|
|
@@ -2265,7 +2273,7 @@ font-weight: ${a};
|
|
|
2265
2273
|
}
|
|
2266
2274
|
`.trim());
|
|
2267
2275
|
}
|
|
2268
|
-
return
|
|
2276
|
+
return r;
|
|
2269
2277
|
}, getFontCss = ({
|
|
2270
2278
|
customFonts: e
|
|
2271
2279
|
}) => {
|
|
@@ -2305,13 +2313,13 @@ const getContextStateInitialValue = ({
|
|
|
2305
2313
|
data: t,
|
|
2306
2314
|
locale: n
|
|
2307
2315
|
}) => {
|
|
2308
|
-
var
|
|
2309
|
-
const o = {},
|
|
2316
|
+
var i, a, s;
|
|
2317
|
+
const o = {}, r = ((i = e == null ? void 0 : e.data) == null ? void 0 : i.state) || {};
|
|
2310
2318
|
return (s = (a = e == null ? void 0 : e.data) == null ? void 0 : a.inputs) == null || s.forEach((c) => {
|
|
2311
2319
|
c.name && c.defaultValue !== void 0 && (o[c.name] = c.defaultValue);
|
|
2312
2320
|
}), {
|
|
2313
2321
|
...o,
|
|
2314
|
-
...
|
|
2322
|
+
...r,
|
|
2315
2323
|
...t,
|
|
2316
2324
|
...n ? {
|
|
2317
2325
|
locale: n
|
|
@@ -2329,12 +2337,12 @@ const getContextStateInitialValue = ({
|
|
|
2329
2337
|
meta: e == null ? void 0 : e.meta
|
|
2330
2338
|
} : void 0;
|
|
2331
2339
|
function ContentComponent(e) {
|
|
2332
|
-
var
|
|
2340
|
+
var r, i, a, s, c, m, f, g, p;
|
|
2333
2341
|
const t = getUpdateVariantVisibilityScript({
|
|
2334
2342
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2335
|
-
variationId: (
|
|
2343
|
+
variationId: (r = e.content) == null ? void 0 : r.testVariationId,
|
|
2336
2344
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
2337
|
-
contentId: (
|
|
2345
|
+
contentId: (i = e.content) == null ? void 0 : i.id
|
|
2338
2346
|
}), n = [
|
|
2339
2347
|
...getDefaultRegisteredComponents(),
|
|
2340
2348
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -2384,7 +2392,9 @@ function ContentComponent(e) {
|
|
|
2384
2392
|
}),
|
|
2385
2393
|
{}
|
|
2386
2394
|
),
|
|
2387
|
-
inheritedStyles: {}
|
|
2395
|
+
inheritedStyles: {},
|
|
2396
|
+
BlocksWrapper: e.blocksWrapper || "div",
|
|
2397
|
+
BlocksWrapperProps: e.blocksWrapperProps || {}
|
|
2388
2398
|
};
|
|
2389
2399
|
return /* @__PURE__ */ jsxs(
|
|
2390
2400
|
EnableEditor,
|
|
@@ -2399,6 +2409,8 @@ function ContentComponent(e) {
|
|
|
2399
2409
|
enrich: e.enrich,
|
|
2400
2410
|
showContent: e.showContent,
|
|
2401
2411
|
builderContextSignal: o,
|
|
2412
|
+
contentWrapper: e.contentWrapper,
|
|
2413
|
+
contentWrapperProps: e.contentWrapperProps,
|
|
2402
2414
|
children: [
|
|
2403
2415
|
e.isSsrAbTest ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(InlinedScript, { scriptStr: t }) }) : null,
|
|
2404
2416
|
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -2422,7 +2434,7 @@ function ContentComponent(e) {
|
|
|
2422
2434
|
);
|
|
2423
2435
|
}
|
|
2424
2436
|
function ContentVariants(e) {
|
|
2425
|
-
var
|
|
2437
|
+
var i, a;
|
|
2426
2438
|
const t = checkShouldRenderVariants({
|
|
2427
2439
|
canTrack: getDefaultCanTrack(e.canTrack),
|
|
2428
2440
|
content: e.content
|
|
@@ -2437,7 +2449,7 @@ function ContentVariants(e) {
|
|
|
2437
2449
|
);
|
|
2438
2450
|
}, o = function() {
|
|
2439
2451
|
return getVariants(e.content).map((c) => `.variant-${c.testVariationId} { display: none; } `).join("");
|
|
2440
|
-
},
|
|
2452
|
+
}, r = function() {
|
|
2441
2453
|
var c;
|
|
2442
2454
|
return t ? {
|
|
2443
2455
|
...e.content,
|
|
@@ -2453,7 +2465,7 @@ function ContentVariants(e) {
|
|
|
2453
2465
|
/* @__PURE__ */ jsx(
|
|
2454
2466
|
InlinedStyles,
|
|
2455
2467
|
{
|
|
2456
|
-
id: `variants-styles-${(
|
|
2468
|
+
id: `variants-styles-${(i = e.content) == null ? void 0 : i.id}`,
|
|
2457
2469
|
styles: o()
|
|
2458
2470
|
}
|
|
2459
2471
|
),
|
|
@@ -2473,7 +2485,11 @@ function ContentVariants(e) {
|
|
|
2473
2485
|
locale: e.locale,
|
|
2474
2486
|
includeRefs: e.includeRefs,
|
|
2475
2487
|
enrich: e.enrich,
|
|
2476
|
-
isSsrAbTest: t
|
|
2488
|
+
isSsrAbTest: t,
|
|
2489
|
+
blocksWrapper: e.blocksWrapper,
|
|
2490
|
+
blocksWrapperProps: e.blocksWrapperProps,
|
|
2491
|
+
contentWrapper: e.contentWrapper,
|
|
2492
|
+
contentWrapperProps: e.contentWrapperProps
|
|
2477
2493
|
},
|
|
2478
2494
|
s.testVariationId
|
|
2479
2495
|
))
|
|
@@ -2481,7 +2497,7 @@ function ContentVariants(e) {
|
|
|
2481
2497
|
/* @__PURE__ */ jsx(
|
|
2482
2498
|
ContentComponent,
|
|
2483
2499
|
{
|
|
2484
|
-
content:
|
|
2500
|
+
content: r(),
|
|
2485
2501
|
showContent: !0,
|
|
2486
2502
|
model: e.model,
|
|
2487
2503
|
data: e.data,
|
|
@@ -2493,7 +2509,11 @@ function ContentVariants(e) {
|
|
|
2493
2509
|
locale: e.locale,
|
|
2494
2510
|
includeRefs: e.includeRefs,
|
|
2495
2511
|
enrich: e.enrich,
|
|
2496
|
-
isSsrAbTest: t
|
|
2512
|
+
isSsrAbTest: t,
|
|
2513
|
+
blocksWrapper: e.blocksWrapper,
|
|
2514
|
+
blocksWrapperProps: e.blocksWrapperProps,
|
|
2515
|
+
contentWrapper: e.contentWrapper,
|
|
2516
|
+
contentWrapperProps: e.contentWrapperProps
|
|
2497
2517
|
}
|
|
2498
2518
|
)
|
|
2499
2519
|
] });
|
|
@@ -2518,7 +2538,7 @@ const fetchSymbolContent = async ({
|
|
|
2518
2538
|
});
|
|
2519
2539
|
};
|
|
2520
2540
|
async function Symbol$1(e) {
|
|
2521
|
-
var o,
|
|
2541
|
+
var o, r, i, a;
|
|
2522
2542
|
const t = function() {
|
|
2523
2543
|
var c, m;
|
|
2524
2544
|
return [
|
|
@@ -2540,9 +2560,9 @@ async function Symbol$1(e) {
|
|
|
2540
2560
|
context: e.builderContext.context,
|
|
2541
2561
|
customComponents: Object.values(e.builderComponents),
|
|
2542
2562
|
data: {
|
|
2543
|
-
...(
|
|
2563
|
+
...(r = e.symbol) == null ? void 0 : r.data,
|
|
2544
2564
|
...e.builderContext.localState,
|
|
2545
|
-
...(
|
|
2565
|
+
...(i = n == null ? void 0 : n.data) == null ? void 0 : i.state
|
|
2546
2566
|
},
|
|
2547
2567
|
model: (a = e.symbol) == null ? void 0 : a.model,
|
|
2548
2568
|
content: n
|
|
@@ -2561,8 +2581,8 @@ function setEditorSettings(e) {
|
|
|
2561
2581
|
}
|
|
2562
2582
|
}
|
|
2563
2583
|
const fetchBuilderProps = async (e) => {
|
|
2564
|
-
var o,
|
|
2565
|
-
const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((
|
|
2584
|
+
var o, r, i;
|
|
2585
|
+
const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((r = e.userAttributes) == null ? void 0 : r.urlPath), n = {
|
|
2566
2586
|
...e,
|
|
2567
2587
|
apiKey: e.apiKey,
|
|
2568
2588
|
model: e.model || "page",
|
|
@@ -2572,7 +2592,7 @@ const fetchBuilderProps = async (e) => {
|
|
|
2572
2592
|
urlPath: t
|
|
2573
2593
|
} : {}
|
|
2574
2594
|
},
|
|
2575
|
-
options: getBuilderSearchParams(e.searchParams || ((
|
|
2595
|
+
options: getBuilderSearchParams(e.searchParams || ((i = e.url) == null ? void 0 : i.searchParams) || e.options)
|
|
2576
2596
|
};
|
|
2577
2597
|
return {
|
|
2578
2598
|
apiKey: n.apiKey,
|