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