@builder.io/sdk-solid 0.7.1-1 → 0.7.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/dist/index.d.ts +924 -25
- package/lib/browser/dev.js +1592 -2071
- package/lib/browser/dev.jsx +1629 -2134
- package/lib/browser/index.js +1573 -2052
- package/lib/browser/index.jsx +1624 -2129
- package/lib/edge/dev.js +1825 -2322
- package/lib/edge/dev.jsx +1787 -2310
- package/lib/edge/index.js +1758 -2255
- package/lib/edge/index.jsx +1786 -2309
- package/lib/node/dev.js +1748 -2245
- package/lib/node/dev.jsx +1628 -2149
- package/lib/node/index.js +1656 -2153
- package/lib/node/index.jsx +1640 -2161
- package/package.json +1 -1
package/lib/browser/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/blocks/button/button.
|
|
1
|
+
// src/blocks/button/button.tsx
|
|
2
2
|
import { Show } from "solid-js";
|
|
3
3
|
import { css } from "solid-styled-components";
|
|
4
4
|
function Button(props) {
|
|
@@ -13,80 +13,57 @@ function Button(props) {
|
|
|
13
13
|
>{props.text}</button>}
|
|
14
14
|
when={props.link}
|
|
15
15
|
><a
|
|
16
|
-
role="button"
|
|
17
16
|
{...{}}
|
|
18
17
|
{...props.attributes}
|
|
19
18
|
href={props.link}
|
|
20
19
|
target={props.openLinkInNewTab ? "_blank" : void 0}
|
|
20
|
+
role="button"
|
|
21
21
|
>{props.text}</a></Show>;
|
|
22
22
|
}
|
|
23
23
|
var button_default = Button;
|
|
24
24
|
|
|
25
|
-
// src/blocks/columns/columns.
|
|
26
|
-
import { Show as Show7, For as For4, createSignal as
|
|
25
|
+
// src/blocks/columns/columns.tsx
|
|
26
|
+
import { Show as Show7, For as For4, createSignal as createSignal5 } from "solid-js";
|
|
27
27
|
import { css as css3 } from "solid-styled-components";
|
|
28
28
|
|
|
29
|
-
// src/components/blocks/blocks.
|
|
29
|
+
// src/components/blocks/blocks.tsx
|
|
30
30
|
import { useContext, Show as Show6, For as For3 } from "solid-js";
|
|
31
31
|
|
|
32
|
-
// src/
|
|
33
|
-
import {
|
|
32
|
+
// src/context/builder.context.ts
|
|
33
|
+
import { createContext } from "solid-js";
|
|
34
|
+
var builder_context_default = createContext({
|
|
35
|
+
content: null,
|
|
36
|
+
context: {},
|
|
37
|
+
localState: void 0,
|
|
38
|
+
rootSetState() {
|
|
39
|
+
},
|
|
40
|
+
rootState: {},
|
|
41
|
+
apiKey: null,
|
|
42
|
+
apiVersion: void 0,
|
|
43
|
+
componentInfos: {},
|
|
44
|
+
inheritedStyles: {}
|
|
45
|
+
});
|
|
34
46
|
|
|
35
|
-
// src/
|
|
36
|
-
|
|
47
|
+
// src/context/components.context.ts
|
|
48
|
+
import { createContext as createContext2 } from "solid-js";
|
|
49
|
+
var components_context_default = createContext2({ registeredComponents: {} });
|
|
37
50
|
|
|
38
|
-
// src/
|
|
39
|
-
|
|
40
|
-
small: {
|
|
41
|
-
min: 320,
|
|
42
|
-
default: 321,
|
|
43
|
-
max: 640
|
|
44
|
-
},
|
|
45
|
-
medium: {
|
|
46
|
-
min: 641,
|
|
47
|
-
default: 642,
|
|
48
|
-
max: 991
|
|
49
|
-
},
|
|
50
|
-
large: {
|
|
51
|
-
min: 990,
|
|
52
|
-
default: 991,
|
|
53
|
-
max: 1200
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
57
|
-
var getSizesForBreakpoints = ({
|
|
58
|
-
small,
|
|
59
|
-
medium
|
|
60
|
-
}) => {
|
|
61
|
-
const newSizes = fastClone(SIZES);
|
|
62
|
-
if (!small || !medium) {
|
|
63
|
-
return newSizes;
|
|
64
|
-
}
|
|
65
|
-
const smallMin = Math.floor(small / 2);
|
|
66
|
-
newSizes.small = {
|
|
67
|
-
max: small,
|
|
68
|
-
min: smallMin,
|
|
69
|
-
default: smallMin + 1
|
|
70
|
-
};
|
|
71
|
-
const mediumMin = newSizes.small.max + 1;
|
|
72
|
-
newSizes.medium = {
|
|
73
|
-
max: medium,
|
|
74
|
-
min: mediumMin,
|
|
75
|
-
default: mediumMin + 1
|
|
76
|
-
};
|
|
77
|
-
const largeMin = newSizes.medium.max + 1;
|
|
78
|
-
newSizes.large = {
|
|
79
|
-
max: 2e3,
|
|
80
|
-
min: largeMin,
|
|
81
|
-
default: largeMin + 1
|
|
82
|
-
};
|
|
83
|
-
return newSizes;
|
|
84
|
-
};
|
|
51
|
+
// src/components/block/block.tsx
|
|
52
|
+
import { Show as Show5, For as For2, createSignal as createSignal4 } from "solid-js";
|
|
85
53
|
|
|
86
|
-
// src/
|
|
87
|
-
|
|
54
|
+
// src/functions/get-block-component-options.ts
|
|
55
|
+
function getBlockComponentOptions(block) {
|
|
56
|
+
return {
|
|
57
|
+
...block.component?.options,
|
|
58
|
+
...block.options,
|
|
59
|
+
/**
|
|
60
|
+
* Our built-in components frequently make use of the block, so we provide all of it under `builderBlock`
|
|
61
|
+
*/
|
|
62
|
+
builderBlock: block
|
|
63
|
+
};
|
|
64
|
+
}
|
|
88
65
|
|
|
89
|
-
// src/helpers/logger.
|
|
66
|
+
// src/helpers/logger.ts
|
|
90
67
|
var logger = {
|
|
91
68
|
log: (...message) => void 0,
|
|
92
69
|
error: (...message) => void 0,
|
|
@@ -94,22 +71,25 @@ var logger = {
|
|
|
94
71
|
debug: (...message) => void 0
|
|
95
72
|
};
|
|
96
73
|
|
|
97
|
-
// src/functions/is-browser.
|
|
74
|
+
// src/functions/is-browser.ts
|
|
98
75
|
function isBrowser() {
|
|
99
76
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
100
77
|
}
|
|
101
78
|
|
|
102
|
-
// src/
|
|
79
|
+
// src/constants/target.ts
|
|
80
|
+
var TARGET = "solid";
|
|
81
|
+
|
|
82
|
+
// src/functions/is-iframe.ts
|
|
103
83
|
function isIframe() {
|
|
104
84
|
return isBrowser() && window.self !== window.top;
|
|
105
85
|
}
|
|
106
86
|
|
|
107
|
-
// src/functions/is-editing.
|
|
87
|
+
// src/functions/is-editing.ts
|
|
108
88
|
function isEditing() {
|
|
109
89
|
return isIframe() && (TARGET === "reactNative" || window.location.search.indexOf("builder.frameEditing=") !== -1);
|
|
110
90
|
}
|
|
111
91
|
|
|
112
|
-
// src/functions/track/helpers.
|
|
92
|
+
// src/functions/track/helpers.ts
|
|
113
93
|
var getLocation = () => {
|
|
114
94
|
if (TARGET === "reactNative") {
|
|
115
95
|
return null;
|
|
@@ -149,13 +129,13 @@ var getUserAttributes = () => {
|
|
|
149
129
|
const isTablet = userAgent.match(/Tablet|iPad/i);
|
|
150
130
|
const url = getLocation();
|
|
151
131
|
return {
|
|
152
|
-
urlPath: url
|
|
153
|
-
host:
|
|
132
|
+
urlPath: url?.pathname,
|
|
133
|
+
host: url?.host || url?.hostname,
|
|
154
134
|
device: isTablet ? "tablet" : isMobile.any() ? "mobile" : "desktop"
|
|
155
135
|
};
|
|
156
136
|
};
|
|
157
137
|
|
|
158
|
-
// src/functions/evaluate/helpers.
|
|
138
|
+
// src/functions/evaluate/helpers.ts
|
|
159
139
|
var getFunctionArguments = ({
|
|
160
140
|
builder,
|
|
161
141
|
context,
|
|
@@ -165,6 +145,7 @@ var getFunctionArguments = ({
|
|
|
165
145
|
return Object.entries({
|
|
166
146
|
state,
|
|
167
147
|
Builder: builder,
|
|
148
|
+
// legacy
|
|
168
149
|
builder,
|
|
169
150
|
context,
|
|
170
151
|
event
|
|
@@ -179,12 +160,15 @@ var getBuilderGlobals = () => ({
|
|
|
179
160
|
var parseCode = (code, {
|
|
180
161
|
isExpression = true
|
|
181
162
|
}) => {
|
|
182
|
-
const useReturn =
|
|
163
|
+
const useReturn = (
|
|
164
|
+
// we disable this for cases where we definitely don't want a return
|
|
165
|
+
isExpression && !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "))
|
|
166
|
+
);
|
|
183
167
|
const useCode = useReturn ? `return (${code});` : code;
|
|
184
168
|
return useCode;
|
|
185
169
|
};
|
|
186
170
|
|
|
187
|
-
// src/functions/evaluate/browser-runtime/browser.
|
|
171
|
+
// src/functions/evaluate/browser-runtime/browser.ts
|
|
188
172
|
var runInBrowser = ({
|
|
189
173
|
code,
|
|
190
174
|
builder,
|
|
@@ -218,16 +202,16 @@ function flattenState(rootState, localState, rootSetState) {
|
|
|
218
202
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
219
203
|
}
|
|
220
204
|
rootState[prop] = value;
|
|
221
|
-
rootSetState
|
|
205
|
+
rootSetState?.(rootState);
|
|
222
206
|
return true;
|
|
223
207
|
}
|
|
224
208
|
});
|
|
225
209
|
}
|
|
226
210
|
|
|
227
|
-
// src/functions/evaluate/choose-eval.
|
|
211
|
+
// src/functions/evaluate/choose-eval.ts
|
|
228
212
|
var chooseBrowserOrServerEval = (args) => isBrowser() ? runInBrowser(args) : runInBrowser(args);
|
|
229
213
|
|
|
230
|
-
// src/functions/evaluate/evaluate.
|
|
214
|
+
// src/functions/evaluate/evaluate.ts
|
|
231
215
|
function evaluate({
|
|
232
216
|
code,
|
|
233
217
|
context,
|
|
@@ -262,7 +246,10 @@ function evaluate({
|
|
|
262
246
|
}
|
|
263
247
|
}
|
|
264
248
|
|
|
265
|
-
// src/functions/
|
|
249
|
+
// src/functions/fast-clone.ts
|
|
250
|
+
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
251
|
+
|
|
252
|
+
// src/functions/set.ts
|
|
266
253
|
var set = (obj, _path, value) => {
|
|
267
254
|
if (Object(obj) !== obj) {
|
|
268
255
|
return obj;
|
|
@@ -272,36 +259,12 @@ var set = (obj, _path, value) => {
|
|
|
272
259
|
return obj;
|
|
273
260
|
};
|
|
274
261
|
|
|
275
|
-
// src/functions/transform-block.
|
|
262
|
+
// src/functions/transform-block.ts
|
|
276
263
|
function transformBlock(block) {
|
|
277
264
|
return block;
|
|
278
265
|
}
|
|
279
266
|
|
|
280
|
-
// src/functions/get-processed-block.
|
|
281
|
-
var __defProp = Object.defineProperty;
|
|
282
|
-
var __defProps = Object.defineProperties;
|
|
283
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
284
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
285
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
286
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
287
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
288
|
-
enumerable: true,
|
|
289
|
-
configurable: true,
|
|
290
|
-
writable: true,
|
|
291
|
-
value
|
|
292
|
-
}) : obj[key] = value;
|
|
293
|
-
var __spreadValues = (a, b) => {
|
|
294
|
-
for (var prop in b || (b = {}))
|
|
295
|
-
if (__hasOwnProp.call(b, prop))
|
|
296
|
-
__defNormalProp(a, prop, b[prop]);
|
|
297
|
-
if (__getOwnPropSymbols)
|
|
298
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
299
|
-
if (__propIsEnum.call(b, prop))
|
|
300
|
-
__defNormalProp(a, prop, b[prop]);
|
|
301
|
-
}
|
|
302
|
-
return a;
|
|
303
|
-
};
|
|
304
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
267
|
+
// src/functions/get-processed-block.ts
|
|
305
268
|
var evaluateBindings = ({
|
|
306
269
|
block,
|
|
307
270
|
context,
|
|
@@ -313,10 +276,15 @@ var evaluateBindings = ({
|
|
|
313
276
|
return block;
|
|
314
277
|
}
|
|
315
278
|
const copy = fastClone(block);
|
|
316
|
-
const copied =
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
279
|
+
const copied = {
|
|
280
|
+
...copy,
|
|
281
|
+
properties: {
|
|
282
|
+
...copy.properties
|
|
283
|
+
},
|
|
284
|
+
actions: {
|
|
285
|
+
...copy.actions
|
|
286
|
+
}
|
|
287
|
+
};
|
|
320
288
|
for (const binding in block.bindings) {
|
|
321
289
|
const expression = block.bindings[binding];
|
|
322
290
|
const value = evaluate({
|
|
@@ -352,13 +320,132 @@ function getProcessedBlock({
|
|
|
352
320
|
}
|
|
353
321
|
}
|
|
354
322
|
|
|
355
|
-
// src/
|
|
323
|
+
// src/components/block/block.helpers.ts
|
|
324
|
+
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
325
|
+
var isEmptyHtmlElement = (tagName) => {
|
|
326
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
327
|
+
};
|
|
328
|
+
var getComponent = ({
|
|
329
|
+
block,
|
|
330
|
+
context,
|
|
331
|
+
registeredComponents
|
|
332
|
+
}) => {
|
|
333
|
+
const componentName = getProcessedBlock({
|
|
334
|
+
block,
|
|
335
|
+
localState: context.localState,
|
|
336
|
+
rootState: context.rootState,
|
|
337
|
+
rootSetState: context.rootSetState,
|
|
338
|
+
context: context.context,
|
|
339
|
+
shouldEvaluateBindings: false
|
|
340
|
+
}).component?.name;
|
|
341
|
+
if (!componentName) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const ref = registeredComponents[componentName];
|
|
345
|
+
if (!ref) {
|
|
346
|
+
return void 0;
|
|
347
|
+
} else {
|
|
348
|
+
return ref;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
var getRepeatItemData = ({
|
|
352
|
+
block,
|
|
353
|
+
context
|
|
354
|
+
}) => {
|
|
355
|
+
const {
|
|
356
|
+
repeat,
|
|
357
|
+
...blockWithoutRepeat
|
|
358
|
+
} = block;
|
|
359
|
+
if (!repeat?.collection) {
|
|
360
|
+
return void 0;
|
|
361
|
+
}
|
|
362
|
+
const itemsArray = evaluate({
|
|
363
|
+
code: repeat.collection,
|
|
364
|
+
localState: context.localState,
|
|
365
|
+
rootState: context.rootState,
|
|
366
|
+
rootSetState: context.rootSetState,
|
|
367
|
+
context: context.context
|
|
368
|
+
});
|
|
369
|
+
if (!Array.isArray(itemsArray)) {
|
|
370
|
+
return void 0;
|
|
371
|
+
}
|
|
372
|
+
const collectionName = repeat.collection.split(".").pop();
|
|
373
|
+
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
374
|
+
const repeatArray = itemsArray.map((item, index) => ({
|
|
375
|
+
context: {
|
|
376
|
+
...context,
|
|
377
|
+
localState: {
|
|
378
|
+
...context.localState,
|
|
379
|
+
$index: index,
|
|
380
|
+
$item: item,
|
|
381
|
+
[itemNameToUse]: item,
|
|
382
|
+
[`$${itemNameToUse}Index`]: index
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
block: blockWithoutRepeat
|
|
386
|
+
}));
|
|
387
|
+
return repeatArray;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// src/components/block/components/block-styles.tsx
|
|
391
|
+
import { Show as Show2 } from "solid-js";
|
|
392
|
+
|
|
393
|
+
// src/constants/device-sizes.ts
|
|
394
|
+
var SIZES = {
|
|
395
|
+
small: {
|
|
396
|
+
min: 320,
|
|
397
|
+
default: 321,
|
|
398
|
+
max: 640
|
|
399
|
+
},
|
|
400
|
+
medium: {
|
|
401
|
+
min: 641,
|
|
402
|
+
default: 642,
|
|
403
|
+
max: 991
|
|
404
|
+
},
|
|
405
|
+
large: {
|
|
406
|
+
min: 990,
|
|
407
|
+
default: 991,
|
|
408
|
+
max: 1200
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
412
|
+
var getSizesForBreakpoints = ({
|
|
413
|
+
small,
|
|
414
|
+
medium
|
|
415
|
+
}) => {
|
|
416
|
+
const newSizes = fastClone(SIZES);
|
|
417
|
+
if (!small || !medium) {
|
|
418
|
+
return newSizes;
|
|
419
|
+
}
|
|
420
|
+
const smallMin = Math.floor(small / 2);
|
|
421
|
+
newSizes.small = {
|
|
422
|
+
max: small,
|
|
423
|
+
min: smallMin,
|
|
424
|
+
default: smallMin + 1
|
|
425
|
+
};
|
|
426
|
+
const mediumMin = newSizes.small.max + 1;
|
|
427
|
+
newSizes.medium = {
|
|
428
|
+
max: medium,
|
|
429
|
+
min: mediumMin,
|
|
430
|
+
default: mediumMin + 1
|
|
431
|
+
};
|
|
432
|
+
const largeMin = newSizes.medium.max + 1;
|
|
433
|
+
newSizes.large = {
|
|
434
|
+
max: 2e3,
|
|
435
|
+
// TODO: decide upper limit
|
|
436
|
+
min: largeMin,
|
|
437
|
+
default: largeMin + 1
|
|
438
|
+
};
|
|
439
|
+
return newSizes;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// src/functions/camel-to-kebab-case.ts
|
|
356
443
|
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
357
444
|
|
|
358
|
-
// src/helpers/nullable.
|
|
445
|
+
// src/helpers/nullable.ts
|
|
359
446
|
var checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
|
|
360
447
|
|
|
361
|
-
// src/helpers/css.
|
|
448
|
+
// src/helpers/css.ts
|
|
362
449
|
var convertStyleMapToCSSArray = (style) => {
|
|
363
450
|
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
364
451
|
if (typeof value === "string") {
|
|
@@ -387,13 +474,13 @@ var createCssClass = ({
|
|
|
387
474
|
}
|
|
388
475
|
};
|
|
389
476
|
|
|
390
|
-
// src/components/inlined-styles.
|
|
477
|
+
// src/components/inlined-styles.tsx
|
|
391
478
|
function InlinedStyles(props) {
|
|
392
479
|
return <style innerHTML={props.styles} id={props.id} />;
|
|
393
480
|
}
|
|
394
481
|
var Inlined_styles_default = InlinedStyles;
|
|
395
482
|
|
|
396
|
-
// src/components/block/components/block-styles.
|
|
483
|
+
// src/components/block/components/block-styles.tsx
|
|
397
484
|
function BlockStyles(props) {
|
|
398
485
|
function canShowBlock() {
|
|
399
486
|
const processedBlock = getProcessedBlock({
|
|
@@ -459,66 +546,54 @@ function BlockStyles(props) {
|
|
|
459
546
|
}
|
|
460
547
|
var Block_styles_default = BlockStyles;
|
|
461
548
|
|
|
462
|
-
// src/components/block/block.
|
|
463
|
-
import { Show as
|
|
549
|
+
// src/components/block/components/block-wrapper.tsx
|
|
550
|
+
import { Show as Show3 } from "solid-js";
|
|
551
|
+
import { Dynamic } from "solid-js/web";
|
|
464
552
|
|
|
465
|
-
// src/functions/
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
469
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
470
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
471
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
472
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, {
|
|
473
|
-
enumerable: true,
|
|
474
|
-
configurable: true,
|
|
475
|
-
writable: true,
|
|
476
|
-
value
|
|
477
|
-
}) : obj[key] = value;
|
|
478
|
-
var __spreadValues2 = (a, b) => {
|
|
479
|
-
for (var prop in b || (b = {}))
|
|
480
|
-
if (__hasOwnProp2.call(b, prop))
|
|
481
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
482
|
-
if (__getOwnPropSymbols2)
|
|
483
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
484
|
-
if (__propIsEnum2.call(b, prop))
|
|
485
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
486
|
-
}
|
|
487
|
-
return a;
|
|
488
|
-
};
|
|
489
|
-
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
490
|
-
function getBlockComponentOptions(block) {
|
|
491
|
-
var _a;
|
|
492
|
-
return __spreadProps2(__spreadValues2(__spreadValues2({}, (_a = block.component) == null ? void 0 : _a.options), block.options), {
|
|
493
|
-
builderBlock: block
|
|
494
|
-
});
|
|
553
|
+
// src/functions/event-handler-name.ts
|
|
554
|
+
function capitalizeFirstLetter(string) {
|
|
555
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
495
556
|
}
|
|
557
|
+
var getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
|
|
496
558
|
|
|
497
|
-
// src/functions/
|
|
498
|
-
var
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
for (var prop of __getOwnPropSymbols3(b)) {
|
|
516
|
-
if (__propIsEnum3.call(b, prop))
|
|
517
|
-
__defNormalProp3(a, prop, b[prop]);
|
|
559
|
+
// src/functions/get-block-actions-handler.ts
|
|
560
|
+
var createEventHandler = (value, options) => (event) => evaluate({
|
|
561
|
+
code: value,
|
|
562
|
+
context: options.context,
|
|
563
|
+
localState: options.localState,
|
|
564
|
+
rootState: options.rootState,
|
|
565
|
+
rootSetState: options.rootSetState,
|
|
566
|
+
event,
|
|
567
|
+
isExpression: false
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
// src/functions/get-block-actions.ts
|
|
571
|
+
function getBlockActions(options) {
|
|
572
|
+
const obj = {};
|
|
573
|
+
const optionActions = options.block.actions ?? {};
|
|
574
|
+
for (const key in optionActions) {
|
|
575
|
+
if (!optionActions.hasOwnProperty(key)) {
|
|
576
|
+
continue;
|
|
518
577
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
578
|
+
const value = optionActions[key];
|
|
579
|
+
let eventHandlerName = getEventHandlerName(key);
|
|
580
|
+
if (options.stripPrefix) {
|
|
581
|
+
switch (TARGET) {
|
|
582
|
+
case "vue2":
|
|
583
|
+
case "vue3":
|
|
584
|
+
eventHandlerName = eventHandlerName.replace("v-on:", "");
|
|
585
|
+
break;
|
|
586
|
+
case "svelte":
|
|
587
|
+
eventHandlerName = eventHandlerName.replace("on:", "");
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
obj[eventHandlerName] = createEventHandler(value, options);
|
|
592
|
+
}
|
|
593
|
+
return obj;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// src/functions/sanitize-react-native-block-styles.ts
|
|
522
597
|
var propertiesThatMustBeNumber = /* @__PURE__ */ new Set(["lineHeight"]);
|
|
523
598
|
var displayValues = /* @__PURE__ */ new Set(["flex", "none"]);
|
|
524
599
|
var SHOW_WARNINGS = false;
|
|
@@ -550,46 +625,28 @@ var sanitizeReactNativeBlockStyles = (styles) => {
|
|
|
550
625
|
const newValue = parseFloat(propertyValue);
|
|
551
626
|
const normalizedValue = normalizeNumber(newValue);
|
|
552
627
|
if (normalizedValue) {
|
|
553
|
-
return
|
|
628
|
+
return {
|
|
629
|
+
...acc,
|
|
554
630
|
[key]: normalizedValue
|
|
555
|
-
}
|
|
631
|
+
};
|
|
556
632
|
} else {
|
|
557
633
|
return acc;
|
|
558
634
|
}
|
|
559
635
|
} else if (propertyValue === "0") {
|
|
560
|
-
return
|
|
636
|
+
return {
|
|
637
|
+
...acc,
|
|
561
638
|
[key]: 0
|
|
562
|
-
}
|
|
639
|
+
};
|
|
563
640
|
}
|
|
564
641
|
}
|
|
565
|
-
return
|
|
642
|
+
return {
|
|
643
|
+
...acc,
|
|
566
644
|
[key]: propertyValue
|
|
567
|
-
}
|
|
645
|
+
};
|
|
568
646
|
}, {});
|
|
569
647
|
};
|
|
570
648
|
|
|
571
|
-
// src/functions/get-react-native-block-styles.
|
|
572
|
-
var __defProp4 = Object.defineProperty;
|
|
573
|
-
var __getOwnPropSymbols4 = Object.getOwnPropertySymbols;
|
|
574
|
-
var __hasOwnProp4 = Object.prototype.hasOwnProperty;
|
|
575
|
-
var __propIsEnum4 = Object.prototype.propertyIsEnumerable;
|
|
576
|
-
var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp4(obj, key, {
|
|
577
|
-
enumerable: true,
|
|
578
|
-
configurable: true,
|
|
579
|
-
writable: true,
|
|
580
|
-
value
|
|
581
|
-
}) : obj[key] = value;
|
|
582
|
-
var __spreadValues4 = (a, b) => {
|
|
583
|
-
for (var prop in b || (b = {}))
|
|
584
|
-
if (__hasOwnProp4.call(b, prop))
|
|
585
|
-
__defNormalProp4(a, prop, b[prop]);
|
|
586
|
-
if (__getOwnPropSymbols4)
|
|
587
|
-
for (var prop of __getOwnPropSymbols4(b)) {
|
|
588
|
-
if (__propIsEnum4.call(b, prop))
|
|
589
|
-
__defNormalProp4(a, prop, b[prop]);
|
|
590
|
-
}
|
|
591
|
-
return a;
|
|
592
|
-
};
|
|
649
|
+
// src/functions/get-react-native-block-styles.ts
|
|
593
650
|
function getReactNativeBlockStyles({
|
|
594
651
|
block,
|
|
595
652
|
context,
|
|
@@ -599,41 +656,24 @@ function getReactNativeBlockStyles({
|
|
|
599
656
|
if (!responsiveStyles) {
|
|
600
657
|
return {};
|
|
601
658
|
}
|
|
602
|
-
const styles =
|
|
659
|
+
const styles = {
|
|
660
|
+
// recursively apply inherited styles so that they can be passed down to children `Text` blocks
|
|
661
|
+
...context.inheritedStyles,
|
|
662
|
+
...responsiveStyles.large || {},
|
|
663
|
+
...responsiveStyles.medium || {},
|
|
664
|
+
...responsiveStyles.small || {},
|
|
665
|
+
...blockStyles
|
|
666
|
+
};
|
|
603
667
|
const newStyles = sanitizeReactNativeBlockStyles(styles);
|
|
604
668
|
return newStyles;
|
|
605
669
|
}
|
|
606
670
|
|
|
607
|
-
// src/functions/transform-block-properties.
|
|
671
|
+
// src/functions/transform-block-properties.ts
|
|
608
672
|
function transformBlockProperties(properties) {
|
|
609
673
|
return properties;
|
|
610
674
|
}
|
|
611
675
|
|
|
612
|
-
// src/functions/get-block-properties.
|
|
613
|
-
var __defProp5 = Object.defineProperty;
|
|
614
|
-
var __defProps4 = Object.defineProperties;
|
|
615
|
-
var __getOwnPropDescs4 = Object.getOwnPropertyDescriptors;
|
|
616
|
-
var __getOwnPropSymbols5 = Object.getOwnPropertySymbols;
|
|
617
|
-
var __hasOwnProp5 = Object.prototype.hasOwnProperty;
|
|
618
|
-
var __propIsEnum5 = Object.prototype.propertyIsEnumerable;
|
|
619
|
-
var __defNormalProp5 = (obj, key, value) => key in obj ? __defProp5(obj, key, {
|
|
620
|
-
enumerable: true,
|
|
621
|
-
configurable: true,
|
|
622
|
-
writable: true,
|
|
623
|
-
value
|
|
624
|
-
}) : obj[key] = value;
|
|
625
|
-
var __spreadValues5 = (a, b) => {
|
|
626
|
-
for (var prop in b || (b = {}))
|
|
627
|
-
if (__hasOwnProp5.call(b, prop))
|
|
628
|
-
__defNormalProp5(a, prop, b[prop]);
|
|
629
|
-
if (__getOwnPropSymbols5)
|
|
630
|
-
for (var prop of __getOwnPropSymbols5(b)) {
|
|
631
|
-
if (__propIsEnum5.call(b, prop))
|
|
632
|
-
__defNormalProp5(a, prop, b[prop]);
|
|
633
|
-
}
|
|
634
|
-
return a;
|
|
635
|
-
};
|
|
636
|
-
var __spreadProps4 = (a, b) => __defProps4(a, __getOwnPropDescs4(b));
|
|
676
|
+
// src/functions/get-block-properties.ts
|
|
637
677
|
var extractRelevantRootBlockProperties = (block) => {
|
|
638
678
|
return {
|
|
639
679
|
href: block.href
|
|
@@ -643,12 +683,13 @@ function getBlockProperties({
|
|
|
643
683
|
block,
|
|
644
684
|
context
|
|
645
685
|
}) {
|
|
646
|
-
|
|
647
|
-
|
|
686
|
+
const properties = {
|
|
687
|
+
...extractRelevantRootBlockProperties(block),
|
|
688
|
+
...block.properties,
|
|
648
689
|
"builder-id": block.id,
|
|
649
690
|
style: block.style ? getStyleAttribute(block.style) : void 0,
|
|
650
|
-
class: [block.id, "builder-block", block.class,
|
|
651
|
-
}
|
|
691
|
+
class: [block.id, "builder-block", block.class, block.properties?.class].filter(Boolean).join(" ")
|
|
692
|
+
};
|
|
652
693
|
if (TARGET === "reactNative") {
|
|
653
694
|
properties.style = getReactNativeBlockStyles({
|
|
654
695
|
block,
|
|
@@ -673,190 +714,51 @@ function getStyleAttribute(style) {
|
|
|
673
714
|
}
|
|
674
715
|
}
|
|
675
716
|
|
|
676
|
-
// src/components/block/block.
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
return target;
|
|
712
|
-
};
|
|
713
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
714
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
715
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
716
|
-
};
|
|
717
|
-
var getComponent = ({
|
|
718
|
-
block,
|
|
719
|
-
context,
|
|
720
|
-
registeredComponents
|
|
721
|
-
}) => {
|
|
722
|
-
var _a;
|
|
723
|
-
const componentName = (_a = getProcessedBlock({
|
|
724
|
-
block,
|
|
725
|
-
localState: context.localState,
|
|
726
|
-
rootState: context.rootState,
|
|
727
|
-
rootSetState: context.rootSetState,
|
|
728
|
-
context: context.context,
|
|
729
|
-
shouldEvaluateBindings: false
|
|
730
|
-
}).component) == null ? void 0 : _a.name;
|
|
731
|
-
if (!componentName) {
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
const ref = registeredComponents[componentName];
|
|
735
|
-
if (!ref) {
|
|
736
|
-
return void 0;
|
|
737
|
-
} else {
|
|
738
|
-
return ref;
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
var getRepeatItemData = ({
|
|
742
|
-
block,
|
|
743
|
-
context
|
|
744
|
-
}) => {
|
|
745
|
-
const _a = block, {
|
|
746
|
-
repeat
|
|
747
|
-
} = _a, blockWithoutRepeat = __objRest(_a, ["repeat"]);
|
|
748
|
-
if (!(repeat == null ? void 0 : repeat.collection)) {
|
|
749
|
-
return void 0;
|
|
750
|
-
}
|
|
751
|
-
const itemsArray = evaluate({
|
|
752
|
-
code: repeat.collection,
|
|
753
|
-
localState: context.localState,
|
|
754
|
-
rootState: context.rootState,
|
|
755
|
-
rootSetState: context.rootSetState,
|
|
756
|
-
context: context.context
|
|
757
|
-
});
|
|
758
|
-
if (!Array.isArray(itemsArray)) {
|
|
759
|
-
return void 0;
|
|
760
|
-
}
|
|
761
|
-
const collectionName = repeat.collection.split(".").pop();
|
|
762
|
-
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
763
|
-
const repeatArray = itemsArray.map((item, index) => ({
|
|
764
|
-
context: __spreadProps5(__spreadValues6({}, context), {
|
|
765
|
-
localState: __spreadProps5(__spreadValues6({}, context.localState), {
|
|
766
|
-
$index: index,
|
|
767
|
-
$item: item,
|
|
768
|
-
[itemNameToUse]: item,
|
|
769
|
-
[`$${itemNameToUse}Index`]: index
|
|
770
|
-
})
|
|
771
|
-
}),
|
|
772
|
-
block: blockWithoutRepeat
|
|
773
|
-
}));
|
|
774
|
-
return repeatArray;
|
|
775
|
-
};
|
|
776
|
-
|
|
777
|
-
// src/components/block/components/repeated-block.jsx
|
|
778
|
-
import { createSignal as createSignal2 } from "solid-js";
|
|
779
|
-
|
|
780
|
-
// src/context/builder.context.js
|
|
781
|
-
import { createContext } from "solid-js";
|
|
782
|
-
var stdin_default = createContext({
|
|
783
|
-
content: null,
|
|
784
|
-
context: {},
|
|
785
|
-
localState: void 0,
|
|
786
|
-
rootSetState() {
|
|
787
|
-
},
|
|
788
|
-
rootState: {},
|
|
789
|
-
apiKey: null,
|
|
790
|
-
apiVersion: void 0,
|
|
791
|
-
componentInfos: {},
|
|
792
|
-
inheritedStyles: {}
|
|
793
|
-
});
|
|
794
|
-
|
|
795
|
-
// src/components/block/components/repeated-block.jsx
|
|
796
|
-
function RepeatedBlock(props) {
|
|
797
|
-
const [store, setStore] = createSignal2(props.repeatContext);
|
|
798
|
-
return <stdin_default.Provider value={store()}><Block_default
|
|
799
|
-
block={props.block}
|
|
800
|
-
context={store()}
|
|
801
|
-
registeredComponents={props.registeredComponents}
|
|
802
|
-
/></stdin_default.Provider>;
|
|
803
|
-
}
|
|
804
|
-
var Repeated_block_default = RepeatedBlock;
|
|
805
|
-
|
|
806
|
-
// src/components/block/components/component-ref/component-ref.jsx
|
|
807
|
-
import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
|
|
808
|
-
import { Dynamic as Dynamic2 } from "solid-js/web";
|
|
809
|
-
|
|
810
|
-
// src/components/block/components/interactive-element.jsx
|
|
811
|
-
import { Dynamic } from "solid-js/web";
|
|
812
|
-
|
|
813
|
-
// src/functions/event-handler-name.js
|
|
814
|
-
function capitalizeFirstLetter(string) {
|
|
815
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
717
|
+
// src/components/block/components/block-wrapper.tsx
|
|
718
|
+
function BlockWrapper(props) {
|
|
719
|
+
return <Show3
|
|
720
|
+
fallback={<Dynamic
|
|
721
|
+
{...getBlockProperties({
|
|
722
|
+
block: props.block,
|
|
723
|
+
context: props.context
|
|
724
|
+
})}
|
|
725
|
+
{...getBlockActions({
|
|
726
|
+
block: props.block,
|
|
727
|
+
rootState: props.context.rootState,
|
|
728
|
+
rootSetState: props.context.rootSetState,
|
|
729
|
+
localState: props.context.localState,
|
|
730
|
+
context: props.context.context,
|
|
731
|
+
stripPrefix: true
|
|
732
|
+
})}
|
|
733
|
+
component={props.Wrapper}
|
|
734
|
+
/>}
|
|
735
|
+
when={props.hasChildren}
|
|
736
|
+
><Dynamic
|
|
737
|
+
{...getBlockProperties({
|
|
738
|
+
block: props.block,
|
|
739
|
+
context: props.context
|
|
740
|
+
})}
|
|
741
|
+
{...getBlockActions({
|
|
742
|
+
block: props.block,
|
|
743
|
+
rootState: props.context.rootState,
|
|
744
|
+
rootSetState: props.context.rootSetState,
|
|
745
|
+
localState: props.context.localState,
|
|
746
|
+
context: props.context.context,
|
|
747
|
+
stripPrefix: true
|
|
748
|
+
})}
|
|
749
|
+
component={props.Wrapper}
|
|
750
|
+
>{props.children}</Dynamic></Show3>;
|
|
816
751
|
}
|
|
817
|
-
var
|
|
818
|
-
|
|
819
|
-
// src/functions/get-block-actions-handler.js
|
|
820
|
-
var createEventHandler = (value, options) => (event) => evaluate({
|
|
821
|
-
code: value,
|
|
822
|
-
context: options.context,
|
|
823
|
-
localState: options.localState,
|
|
824
|
-
rootState: options.rootState,
|
|
825
|
-
rootSetState: options.rootSetState,
|
|
826
|
-
event,
|
|
827
|
-
isExpression: false
|
|
828
|
-
});
|
|
752
|
+
var Block_wrapper_default = BlockWrapper;
|
|
829
753
|
|
|
830
|
-
// src/
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const obj = {};
|
|
834
|
-
const optionActions = (_a = options.block.actions) != null ? _a : {};
|
|
835
|
-
for (const key in optionActions) {
|
|
836
|
-
if (!optionActions.hasOwnProperty(key)) {
|
|
837
|
-
continue;
|
|
838
|
-
}
|
|
839
|
-
const value = optionActions[key];
|
|
840
|
-
let eventHandlerName = getEventHandlerName(key);
|
|
841
|
-
if (options.stripPrefix) {
|
|
842
|
-
switch (TARGET) {
|
|
843
|
-
case "vue2":
|
|
844
|
-
case "vue3":
|
|
845
|
-
eventHandlerName = eventHandlerName.replace("v-on:", "");
|
|
846
|
-
break;
|
|
847
|
-
case "svelte":
|
|
848
|
-
eventHandlerName = eventHandlerName.replace("on:", "");
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
obj[eventHandlerName] = createEventHandler(value, options);
|
|
853
|
-
}
|
|
854
|
-
return obj;
|
|
855
|
-
}
|
|
754
|
+
// src/components/block/components/component-ref/component-ref.tsx
|
|
755
|
+
import { Show as Show4, For, createSignal as createSignal2 } from "solid-js";
|
|
756
|
+
import { Dynamic as Dynamic3 } from "solid-js/web";
|
|
856
757
|
|
|
857
|
-
// src/components/block/components/interactive-element.
|
|
758
|
+
// src/components/block/components/interactive-element.tsx
|
|
759
|
+
import { Dynamic as Dynamic2 } from "solid-js/web";
|
|
858
760
|
function InteractiveElement(props) {
|
|
859
|
-
return <
|
|
761
|
+
return <Dynamic2
|
|
860
762
|
{...props.wrapperProps}
|
|
861
763
|
attributes={{
|
|
862
764
|
...getBlockProperties({
|
|
@@ -872,32 +774,11 @@ function InteractiveElement(props) {
|
|
|
872
774
|
})
|
|
873
775
|
}}
|
|
874
776
|
component={props.Wrapper}
|
|
875
|
-
>{props.children}</
|
|
777
|
+
>{props.children}</Dynamic2>;
|
|
876
778
|
}
|
|
877
779
|
var interactive_element_default = InteractiveElement;
|
|
878
780
|
|
|
879
|
-
// src/components/block/components/component-ref/component-ref.helpers.
|
|
880
|
-
var __defProp7 = Object.defineProperty;
|
|
881
|
-
var __getOwnPropSymbols7 = Object.getOwnPropertySymbols;
|
|
882
|
-
var __hasOwnProp7 = Object.prototype.hasOwnProperty;
|
|
883
|
-
var __propIsEnum7 = Object.prototype.propertyIsEnumerable;
|
|
884
|
-
var __defNormalProp7 = (obj, key, value) => key in obj ? __defProp7(obj, key, {
|
|
885
|
-
enumerable: true,
|
|
886
|
-
configurable: true,
|
|
887
|
-
writable: true,
|
|
888
|
-
value
|
|
889
|
-
}) : obj[key] = value;
|
|
890
|
-
var __spreadValues7 = (a, b) => {
|
|
891
|
-
for (var prop in b || (b = {}))
|
|
892
|
-
if (__hasOwnProp7.call(b, prop))
|
|
893
|
-
__defNormalProp7(a, prop, b[prop]);
|
|
894
|
-
if (__getOwnPropSymbols7)
|
|
895
|
-
for (var prop of __getOwnPropSymbols7(b)) {
|
|
896
|
-
if (__propIsEnum7.call(b, prop))
|
|
897
|
-
__defNormalProp7(a, prop, b[prop]);
|
|
898
|
-
}
|
|
899
|
-
return a;
|
|
900
|
-
};
|
|
781
|
+
// src/components/block/components/component-ref/component-ref.helpers.ts
|
|
901
782
|
var getWrapperProps = ({
|
|
902
783
|
componentOptions,
|
|
903
784
|
builderBlock,
|
|
@@ -913,20 +794,27 @@ var getWrapperProps = ({
|
|
|
913
794
|
context,
|
|
914
795
|
wrapperProps: componentOptions
|
|
915
796
|
};
|
|
916
|
-
return isInteractive ? interactiveElementProps :
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
797
|
+
return isInteractive ? interactiveElementProps : {
|
|
798
|
+
...componentOptions,
|
|
799
|
+
/**
|
|
800
|
+
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
801
|
+
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
802
|
+
*/
|
|
803
|
+
...includeBlockProps ? {
|
|
804
|
+
attributes: getBlockProperties({
|
|
805
|
+
block: builderBlock,
|
|
806
|
+
context: contextValue
|
|
807
|
+
})
|
|
808
|
+
} : {}
|
|
809
|
+
};
|
|
922
810
|
};
|
|
923
811
|
|
|
924
|
-
// src/components/block/components/component-ref/component-ref.
|
|
812
|
+
// src/components/block/components/component-ref/component-ref.tsx
|
|
925
813
|
function ComponentRef(props) {
|
|
926
|
-
const [Wrapper, setWrapper] =
|
|
814
|
+
const [Wrapper, setWrapper] = createSignal2(
|
|
927
815
|
props.isInteractive ? interactive_element_default : props.componentRef
|
|
928
816
|
);
|
|
929
|
-
return <
|
|
817
|
+
return <Show4 when={props.componentRef}><Dynamic3
|
|
930
818
|
{...getWrapperProps({
|
|
931
819
|
componentOptions: props.componentOptions,
|
|
932
820
|
builderBlock: props.builderBlock,
|
|
@@ -955,50 +843,23 @@ function ComponentRef(props) {
|
|
|
955
843
|
context={props.context}
|
|
956
844
|
/>;
|
|
957
845
|
}}</For>
|
|
958
|
-
</
|
|
846
|
+
</Dynamic3></Show4>;
|
|
959
847
|
}
|
|
960
848
|
var Component_ref_default = ComponentRef;
|
|
961
849
|
|
|
962
|
-
// src/components/block/components/block
|
|
963
|
-
import {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
return <
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
})}
|
|
972
|
-
{...getBlockActions({
|
|
973
|
-
block: props.block,
|
|
974
|
-
rootState: props.context.rootState,
|
|
975
|
-
rootSetState: props.context.rootSetState,
|
|
976
|
-
localState: props.context.localState,
|
|
977
|
-
context: props.context.context,
|
|
978
|
-
stripPrefix: true
|
|
979
|
-
})}
|
|
980
|
-
component={props.Wrapper}
|
|
981
|
-
/>}
|
|
982
|
-
when={props.hasChildren}
|
|
983
|
-
><Dynamic3
|
|
984
|
-
{...getBlockProperties({
|
|
985
|
-
block: props.block,
|
|
986
|
-
context: props.context
|
|
987
|
-
})}
|
|
988
|
-
{...getBlockActions({
|
|
989
|
-
block: props.block,
|
|
990
|
-
rootState: props.context.rootState,
|
|
991
|
-
rootSetState: props.context.rootSetState,
|
|
992
|
-
localState: props.context.localState,
|
|
993
|
-
context: props.context.context,
|
|
994
|
-
stripPrefix: true
|
|
995
|
-
})}
|
|
996
|
-
component={props.Wrapper}
|
|
997
|
-
>{props.children}</Dynamic3></Show4>;
|
|
850
|
+
// src/components/block/components/repeated-block.tsx
|
|
851
|
+
import { createSignal as createSignal3 } from "solid-js";
|
|
852
|
+
function RepeatedBlock(props) {
|
|
853
|
+
const [store, setStore] = createSignal3(props.repeatContext);
|
|
854
|
+
return <builder_context_default.Provider value={store()}><Block_default
|
|
855
|
+
block={props.block}
|
|
856
|
+
context={store()}
|
|
857
|
+
registeredComponents={props.registeredComponents}
|
|
858
|
+
/></builder_context_default.Provider>;
|
|
998
859
|
}
|
|
999
|
-
var
|
|
860
|
+
var Repeated_block_default = RepeatedBlock;
|
|
1000
861
|
|
|
1001
|
-
// src/components/block/block.
|
|
862
|
+
// src/components/block/block.tsx
|
|
1002
863
|
function Block(props) {
|
|
1003
864
|
const [childrenContext, setChildrenContext] = createSignal4(props.context);
|
|
1004
865
|
function blockComponent() {
|
|
@@ -1059,7 +920,16 @@ function Block(props) {
|
|
|
1059
920
|
};
|
|
1060
921
|
}
|
|
1061
922
|
return <Show5 when={canShowBlock()}><Show5
|
|
1062
|
-
fallback={<Component_ref_default
|
|
923
|
+
fallback={<Component_ref_default
|
|
924
|
+
componentRef={componentRefProps().componentRef}
|
|
925
|
+
componentOptions={componentRefProps().componentOptions}
|
|
926
|
+
blockChildren={componentRefProps().blockChildren}
|
|
927
|
+
context={componentRefProps().context}
|
|
928
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
929
|
+
builderBlock={componentRefProps().builderBlock}
|
|
930
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
931
|
+
isInteractive={componentRefProps().isInteractive}
|
|
932
|
+
/>}
|
|
1063
933
|
when={!blockComponent()?.noWrap}
|
|
1064
934
|
>
|
|
1065
935
|
<Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
|
|
@@ -1083,7 +953,16 @@ function Block(props) {
|
|
|
1083
953
|
context={props.context}
|
|
1084
954
|
hasChildren={true}
|
|
1085
955
|
>
|
|
1086
|
-
<Component_ref_default
|
|
956
|
+
<Component_ref_default
|
|
957
|
+
componentRef={componentRefProps().componentRef}
|
|
958
|
+
componentOptions={componentRefProps().componentOptions}
|
|
959
|
+
blockChildren={componentRefProps().blockChildren}
|
|
960
|
+
context={componentRefProps().context}
|
|
961
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
962
|
+
builderBlock={componentRefProps().builderBlock}
|
|
963
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
964
|
+
isInteractive={componentRefProps().isInteractive}
|
|
965
|
+
/>
|
|
1087
966
|
<For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
|
|
1088
967
|
const index = _index();
|
|
1089
968
|
return <Block
|
|
@@ -1106,8 +985,7 @@ function Block(props) {
|
|
|
1106
985
|
}
|
|
1107
986
|
var Block_default = Block;
|
|
1108
987
|
|
|
1109
|
-
// src/components/blocks/blocks-wrapper.
|
|
1110
|
-
import { createSignal as createSignal5 } from "solid-js";
|
|
988
|
+
// src/components/blocks/blocks-wrapper.tsx
|
|
1111
989
|
import { css as css2 } from "solid-styled-components";
|
|
1112
990
|
function BlocksWrapper(props) {
|
|
1113
991
|
function className() {
|
|
@@ -1158,14 +1036,10 @@ function BlocksWrapper(props) {
|
|
|
1158
1036
|
}
|
|
1159
1037
|
var Blocks_wrapper_default = BlocksWrapper;
|
|
1160
1038
|
|
|
1161
|
-
// src/
|
|
1162
|
-
import { createContext as createContext2 } from "solid-js";
|
|
1163
|
-
var stdin_default2 = createContext2({ registeredComponents: {} });
|
|
1164
|
-
|
|
1165
|
-
// src/components/blocks/blocks.jsx
|
|
1039
|
+
// src/components/blocks/blocks.tsx
|
|
1166
1040
|
function Blocks(props) {
|
|
1167
|
-
const builderContext = useContext(
|
|
1168
|
-
const componentsContext = useContext(
|
|
1041
|
+
const builderContext = useContext(builder_context_default);
|
|
1042
|
+
const componentsContext = useContext(components_context_default);
|
|
1169
1043
|
return <Blocks_wrapper_default
|
|
1170
1044
|
blocks={props.blocks}
|
|
1171
1045
|
parent={props.parent}
|
|
@@ -1193,14 +1067,14 @@ function Blocks(props) {
|
|
|
1193
1067
|
}
|
|
1194
1068
|
var Blocks_default = Blocks;
|
|
1195
1069
|
|
|
1196
|
-
// src/blocks/columns/columns.
|
|
1070
|
+
// src/blocks/columns/columns.tsx
|
|
1197
1071
|
function Columns(props) {
|
|
1198
|
-
const [gutterSize, setGutterSize] =
|
|
1072
|
+
const [gutterSize, setGutterSize] = createSignal5(
|
|
1199
1073
|
typeof props.space === "number" ? props.space || 0 : 20
|
|
1200
1074
|
);
|
|
1201
|
-
const [cols, setCols] =
|
|
1202
|
-
const [stackAt, setStackAt] =
|
|
1203
|
-
const [flexDir, setFlexDir] =
|
|
1075
|
+
const [cols, setCols] = createSignal5(props.columns || []);
|
|
1076
|
+
const [stackAt, setStackAt] = createSignal5(props.stackColumnsAt || "tablet");
|
|
1077
|
+
const [flexDir, setFlexDir] = createSignal5(
|
|
1204
1078
|
props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1205
1079
|
);
|
|
1206
1080
|
function getWidth(index) {
|
|
@@ -1210,10 +1084,16 @@ function Columns(props) {
|
|
|
1210
1084
|
const subtractWidth = gutterSize() * (cols().length - 1) / cols().length;
|
|
1211
1085
|
return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
|
|
1212
1086
|
}
|
|
1213
|
-
function getTabletStyle({
|
|
1087
|
+
function getTabletStyle({
|
|
1088
|
+
stackedStyle,
|
|
1089
|
+
desktopStyle
|
|
1090
|
+
}) {
|
|
1214
1091
|
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
1215
1092
|
}
|
|
1216
|
-
function getMobileStyle({
|
|
1093
|
+
function getMobileStyle({
|
|
1094
|
+
stackedStyle,
|
|
1095
|
+
desktopStyle
|
|
1096
|
+
}) {
|
|
1217
1097
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1218
1098
|
}
|
|
1219
1099
|
function columnsCssVars() {
|
|
@@ -1321,17 +1201,17 @@ function Columns(props) {
|
|
|
1321
1201
|
}
|
|
1322
1202
|
var columns_default = Columns;
|
|
1323
1203
|
|
|
1324
|
-
// src/blocks/fragment/fragment.
|
|
1204
|
+
// src/blocks/fragment/fragment.tsx
|
|
1325
1205
|
function FragmentComponent(props) {
|
|
1326
1206
|
return <span>{props.children}</span>;
|
|
1327
1207
|
}
|
|
1328
1208
|
var fragment_default = FragmentComponent;
|
|
1329
1209
|
|
|
1330
|
-
// src/blocks/image/image.
|
|
1331
|
-
import { Show as Show8
|
|
1210
|
+
// src/blocks/image/image.tsx
|
|
1211
|
+
import { Show as Show8 } from "solid-js";
|
|
1332
1212
|
import { css as css4 } from "solid-styled-components";
|
|
1333
1213
|
|
|
1334
|
-
// src/blocks/image/image.helpers.
|
|
1214
|
+
// src/blocks/image/image.helpers.ts
|
|
1335
1215
|
function removeProtocol(path) {
|
|
1336
1216
|
return path.replace(/http(s)?:/, "");
|
|
1337
1217
|
}
|
|
@@ -1344,7 +1224,7 @@ function updateQueryParam(uri = "", key, value) {
|
|
|
1344
1224
|
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
1345
1225
|
}
|
|
1346
1226
|
function getShopifyImageUrl(src, size) {
|
|
1347
|
-
if (!src || !
|
|
1227
|
+
if (!src || !src?.match(/cdn\.shopify\.com/) || !size) {
|
|
1348
1228
|
return src;
|
|
1349
1229
|
}
|
|
1350
1230
|
if (size === "master") {
|
|
@@ -1378,7 +1258,7 @@ function getSrcSet(url) {
|
|
|
1378
1258
|
return url;
|
|
1379
1259
|
}
|
|
1380
1260
|
|
|
1381
|
-
// src/blocks/image/image.
|
|
1261
|
+
// src/blocks/image/image.tsx
|
|
1382
1262
|
function Image(props) {
|
|
1383
1263
|
function srcSetToUse() {
|
|
1384
1264
|
const imageToUse = props.image || props.src;
|
|
@@ -1465,7 +1345,7 @@ function Image(props) {
|
|
|
1465
1345
|
}
|
|
1466
1346
|
var image_default = Image;
|
|
1467
1347
|
|
|
1468
|
-
// src/blocks/section/section.
|
|
1348
|
+
// src/blocks/section/section.tsx
|
|
1469
1349
|
function SectionComponent(props) {
|
|
1470
1350
|
return <section
|
|
1471
1351
|
{...{}}
|
|
@@ -1486,190 +1366,212 @@ function SectionComponent(props) {
|
|
|
1486
1366
|
}
|
|
1487
1367
|
var section_default = SectionComponent;
|
|
1488
1368
|
|
|
1489
|
-
// src/blocks/symbol/symbol.
|
|
1490
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1369
|
+
// src/blocks/symbol/symbol.tsx
|
|
1370
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal13 } from "solid-js";
|
|
1491
1371
|
|
|
1492
|
-
// src/components/content-variants/content-variants.
|
|
1493
|
-
import { Show as Show11, For as For5, onMount as onMount3, createSignal as
|
|
1372
|
+
// src/components/content-variants/content-variants.tsx
|
|
1373
|
+
import { Show as Show11, For as For5, onMount as onMount3, createSignal as createSignal12 } from "solid-js";
|
|
1494
1374
|
|
|
1495
|
-
// src/
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
var
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
__defNormalProp8(a, prop, b[prop]);
|
|
1375
|
+
// src/helpers/url.ts
|
|
1376
|
+
var getTopLevelDomain = (host) => {
|
|
1377
|
+
if (host === "localhost" || host === "127.0.0.1") {
|
|
1378
|
+
return host;
|
|
1379
|
+
}
|
|
1380
|
+
const parts = host.split(".");
|
|
1381
|
+
if (parts.length > 2) {
|
|
1382
|
+
return parts.slice(1).join(".");
|
|
1383
|
+
}
|
|
1384
|
+
return host;
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1387
|
+
// src/helpers/cookie.ts
|
|
1388
|
+
var getCookieSync = ({
|
|
1389
|
+
name,
|
|
1390
|
+
canTrack
|
|
1391
|
+
}) => {
|
|
1392
|
+
try {
|
|
1393
|
+
if (!canTrack) {
|
|
1394
|
+
return void 0;
|
|
1516
1395
|
}
|
|
1517
|
-
|
|
1396
|
+
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
1397
|
+
} catch (err) {
|
|
1398
|
+
logger.warn("[COOKIE] GET error: ", err?.message || err);
|
|
1399
|
+
return void 0;
|
|
1400
|
+
}
|
|
1518
1401
|
};
|
|
1519
|
-
var
|
|
1520
|
-
var
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
content
|
|
1402
|
+
var getCookie = async (args) => getCookieSync(args);
|
|
1403
|
+
var stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
1404
|
+
var SECURE_CONFIG = [["secure", ""], ["SameSite", "None"]];
|
|
1405
|
+
var createCookieString = ({
|
|
1406
|
+
name,
|
|
1407
|
+
value,
|
|
1408
|
+
expires
|
|
1527
1409
|
}) => {
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
return false;
|
|
1535
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
1536
|
-
return true;
|
|
1537
|
-
if (isBrowser())
|
|
1538
|
-
return false;
|
|
1539
|
-
return true;
|
|
1410
|
+
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
1411
|
+
const secureObj = secure ? SECURE_CONFIG : [[]];
|
|
1412
|
+
const expiresObj = expires ? [["expires", expires.toUTCString()]] : [[]];
|
|
1413
|
+
const cookieValue = [[name, value], ...expiresObj, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...secureObj];
|
|
1414
|
+
const cookie = stringifyCookie(cookieValue);
|
|
1415
|
+
return cookie;
|
|
1540
1416
|
};
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
}
|
|
1551
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
1552
|
-
}
|
|
1553
|
-
function getCookie2(name) {
|
|
1554
|
-
const nameEQ = name + "=";
|
|
1555
|
-
const ca = document.cookie.split(";");
|
|
1556
|
-
for (let i = 0; i < ca.length; i++) {
|
|
1557
|
-
let c = ca[i];
|
|
1558
|
-
while (c.charAt(0) === " ")
|
|
1559
|
-
c = c.substring(1, c.length);
|
|
1560
|
-
if (c.indexOf(nameEQ) === 0)
|
|
1561
|
-
return c.substring(nameEQ.length, c.length);
|
|
1562
|
-
}
|
|
1563
|
-
return null;
|
|
1564
|
-
}
|
|
1565
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
1566
|
-
const variantInCookie = getCookie2(cookieName);
|
|
1567
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
1568
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
1569
|
-
return variantInCookie;
|
|
1417
|
+
var setCookie = async ({
|
|
1418
|
+
name,
|
|
1419
|
+
value,
|
|
1420
|
+
expires,
|
|
1421
|
+
canTrack
|
|
1422
|
+
}) => {
|
|
1423
|
+
try {
|
|
1424
|
+
if (!canTrack) {
|
|
1425
|
+
return;
|
|
1570
1426
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1427
|
+
const cookie = createCookieString({
|
|
1428
|
+
name,
|
|
1429
|
+
value,
|
|
1430
|
+
expires
|
|
1431
|
+
});
|
|
1432
|
+
document.cookie = cookie;
|
|
1433
|
+
} catch (err) {
|
|
1434
|
+
logger.warn("[COOKIE] SET error: ", err?.message || err);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
// src/helpers/ab-tests.ts
|
|
1439
|
+
var BUILDER_STORE_PREFIX = "builder.tests";
|
|
1440
|
+
var getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
1441
|
+
var getContentVariationCookie = ({
|
|
1442
|
+
contentId
|
|
1443
|
+
}) => getCookie({
|
|
1444
|
+
name: getContentTestKey(contentId),
|
|
1445
|
+
canTrack: true
|
|
1446
|
+
});
|
|
1447
|
+
var getContentVariationCookieSync = ({
|
|
1448
|
+
contentId
|
|
1449
|
+
}) => getCookieSync({
|
|
1450
|
+
name: getContentTestKey(contentId),
|
|
1451
|
+
canTrack: true
|
|
1452
|
+
});
|
|
1453
|
+
var setContentVariationCookie = ({
|
|
1454
|
+
contentId,
|
|
1455
|
+
value
|
|
1456
|
+
}) => setCookie({
|
|
1457
|
+
name: getContentTestKey(contentId),
|
|
1458
|
+
value,
|
|
1459
|
+
canTrack: true
|
|
1460
|
+
});
|
|
1461
|
+
var checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
1462
|
+
var getRandomVariationId = ({
|
|
1463
|
+
id,
|
|
1464
|
+
variations
|
|
1465
|
+
}) => {
|
|
1466
|
+
let n = 0;
|
|
1467
|
+
const random = Math.random();
|
|
1468
|
+
for (const id2 in variations) {
|
|
1469
|
+
const testRatio = variations[id2]?.testRatio;
|
|
1470
|
+
n += testRatio;
|
|
1471
|
+
if (random < n) {
|
|
1472
|
+
return id2;
|
|
1581
1473
|
}
|
|
1582
|
-
setCookie2(cookieName, contentId);
|
|
1583
|
-
return contentId;
|
|
1584
1474
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1475
|
+
return id;
|
|
1476
|
+
};
|
|
1477
|
+
var getAndSetVariantId = (args) => {
|
|
1478
|
+
const randomVariationId = getRandomVariationId(args);
|
|
1479
|
+
setContentVariationCookie({
|
|
1480
|
+
contentId: args.id,
|
|
1481
|
+
value: randomVariationId
|
|
1482
|
+
}).catch((err) => {
|
|
1483
|
+
logger.error("could not store A/B test variation: ", err);
|
|
1484
|
+
});
|
|
1485
|
+
return randomVariationId;
|
|
1486
|
+
};
|
|
1487
|
+
var getTestFields = ({
|
|
1488
|
+
item,
|
|
1489
|
+
testGroupId
|
|
1490
|
+
}) => {
|
|
1491
|
+
const variationValue = item.variations[testGroupId];
|
|
1492
|
+
if (testGroupId === item.id || // handle edge-case where `testGroupId` points to non-existing variation
|
|
1493
|
+
!variationValue) {
|
|
1494
|
+
return {
|
|
1495
|
+
testVariationId: item.id,
|
|
1496
|
+
testVariationName: "Default"
|
|
1497
|
+
};
|
|
1591
1498
|
} else {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
}).join("");
|
|
1598
|
-
styleEl.innerHTML = newStyleStr;
|
|
1499
|
+
return {
|
|
1500
|
+
data: variationValue.data,
|
|
1501
|
+
testVariationId: variationValue.id,
|
|
1502
|
+
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
1503
|
+
};
|
|
1599
1504
|
}
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1505
|
+
};
|
|
1506
|
+
var handleABTestingSync = ({
|
|
1507
|
+
item,
|
|
1508
|
+
canTrack
|
|
1509
|
+
}) => {
|
|
1510
|
+
if (TARGET === "reactNative")
|
|
1511
|
+
return item;
|
|
1512
|
+
if (!canTrack) {
|
|
1513
|
+
return item;
|
|
1605
1514
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const ca = document.cookie.split(";");
|
|
1609
|
-
for (let i = 0; i < ca.length; i++) {
|
|
1610
|
-
let c = ca[i];
|
|
1611
|
-
while (c.charAt(0) === " ")
|
|
1612
|
-
c = c.substring(1, c.length);
|
|
1613
|
-
if (c.indexOf(nameEQ) === 0)
|
|
1614
|
-
return c.substring(nameEQ.length, c.length);
|
|
1615
|
-
}
|
|
1616
|
-
return null;
|
|
1515
|
+
if (!item) {
|
|
1516
|
+
return void 0;
|
|
1617
1517
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
const parentDiv = (_a = document.currentScript) == null ? void 0 : _a.parentElement;
|
|
1621
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
1622
|
-
if (variantId === variantContentId) {
|
|
1623
|
-
if (variantIsDefaultContent) {
|
|
1624
|
-
return;
|
|
1625
|
-
}
|
|
1626
|
-
parentDiv == null ? void 0 : parentDiv.removeAttribute("hidden");
|
|
1627
|
-
parentDiv == null ? void 0 : parentDiv.removeAttribute("aria-hidden");
|
|
1628
|
-
} else {
|
|
1629
|
-
if (variantIsDefaultContent) {
|
|
1630
|
-
if (isHydrationTarget2) {
|
|
1631
|
-
parentDiv == null ? void 0 : parentDiv.remove();
|
|
1632
|
-
} else {
|
|
1633
|
-
parentDiv == null ? void 0 : parentDiv.setAttribute("hidden", "true");
|
|
1634
|
-
parentDiv == null ? void 0 : parentDiv.setAttribute("aria-hidden", "true");
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
return;
|
|
1518
|
+
if (!checkIsBuilderContentWithVariations(item)) {
|
|
1519
|
+
return item;
|
|
1638
1520
|
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
};
|
|
1653
|
-
var getVariantsScriptString = (variants, contentId) => {
|
|
1654
|
-
return `
|
|
1655
|
-
window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
|
|
1521
|
+
const testGroupId = getContentVariationCookieSync({
|
|
1522
|
+
contentId: item.id
|
|
1523
|
+
}) || getAndSetVariantId({
|
|
1524
|
+
variations: item.variations,
|
|
1525
|
+
id: item.id
|
|
1526
|
+
});
|
|
1527
|
+
const variationValue = getTestFields({
|
|
1528
|
+
item,
|
|
1529
|
+
testGroupId
|
|
1530
|
+
});
|
|
1531
|
+
return {
|
|
1532
|
+
...item,
|
|
1533
|
+
...variationValue
|
|
1534
|
+
};
|
|
1656
1535
|
};
|
|
1657
|
-
var
|
|
1658
|
-
|
|
1659
|
-
|
|
1536
|
+
var handleABTesting = async ({
|
|
1537
|
+
item,
|
|
1538
|
+
canTrack
|
|
1660
1539
|
}) => {
|
|
1661
|
-
|
|
1662
|
-
|
|
1540
|
+
if (!canTrack) {
|
|
1541
|
+
return item;
|
|
1542
|
+
}
|
|
1543
|
+
if (!checkIsBuilderContentWithVariations(item)) {
|
|
1544
|
+
return item;
|
|
1545
|
+
}
|
|
1546
|
+
const cookieValue = await getContentVariationCookie({
|
|
1547
|
+
contentId: item.id
|
|
1548
|
+
});
|
|
1549
|
+
const testGroupId = cookieValue || getAndSetVariantId({
|
|
1550
|
+
variations: item.variations,
|
|
1551
|
+
id: item.id
|
|
1552
|
+
});
|
|
1553
|
+
const variationValue = getTestFields({
|
|
1554
|
+
item,
|
|
1555
|
+
testGroupId
|
|
1556
|
+
});
|
|
1557
|
+
return {
|
|
1558
|
+
...item,
|
|
1559
|
+
...variationValue
|
|
1560
|
+
};
|
|
1663
1561
|
};
|
|
1664
1562
|
|
|
1665
|
-
// src/
|
|
1666
|
-
|
|
1563
|
+
// src/helpers/canTrack.ts
|
|
1564
|
+
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1565
|
+
|
|
1566
|
+
// src/components/content/content.tsx
|
|
1567
|
+
import { Show as Show10, createSignal as createSignal11 } from "solid-js";
|
|
1667
1568
|
|
|
1668
|
-
// src/blocks/button/component-info.
|
|
1569
|
+
// src/blocks/button/component-info.ts
|
|
1669
1570
|
var componentInfo = {
|
|
1670
1571
|
name: "Core:Button",
|
|
1671
1572
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
1672
1573
|
defaultStyles: {
|
|
1574
|
+
// TODO: make min width more intuitive and set one
|
|
1673
1575
|
appearance: "none",
|
|
1674
1576
|
paddingTop: "15px",
|
|
1675
1577
|
paddingBottom: "15px",
|
|
@@ -1700,8 +1602,9 @@ var componentInfo = {
|
|
|
1700
1602
|
noWrap: true
|
|
1701
1603
|
};
|
|
1702
1604
|
|
|
1703
|
-
// src/blocks/columns/component-info.
|
|
1605
|
+
// src/blocks/columns/component-info.ts
|
|
1704
1606
|
var componentInfo2 = {
|
|
1607
|
+
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
1705
1608
|
name: "Columns",
|
|
1706
1609
|
isRSC: true,
|
|
1707
1610
|
inputs: [{
|
|
@@ -1919,54 +1822,208 @@ var componentInfo2 = {
|
|
|
1919
1822
|
}]
|
|
1920
1823
|
};
|
|
1921
1824
|
|
|
1922
|
-
// src/blocks/
|
|
1825
|
+
// src/blocks/custom-code/component-info.ts
|
|
1923
1826
|
var componentInfo3 = {
|
|
1924
|
-
name: "
|
|
1925
|
-
static: true,
|
|
1926
|
-
hidden: true,
|
|
1927
|
-
canHaveChildren: true,
|
|
1928
|
-
noWrap: true
|
|
1929
|
-
};
|
|
1930
|
-
|
|
1931
|
-
// src/blocks/image/component-info.js
|
|
1932
|
-
var componentInfo4 = {
|
|
1933
|
-
name: "Image",
|
|
1827
|
+
name: "Custom Code",
|
|
1934
1828
|
static: true,
|
|
1935
|
-
|
|
1936
|
-
defaultStyles: {
|
|
1937
|
-
position: "relative",
|
|
1938
|
-
minHeight: "20px",
|
|
1939
|
-
minWidth: "20px",
|
|
1940
|
-
overflow: "hidden"
|
|
1941
|
-
},
|
|
1942
|
-
canHaveChildren: true,
|
|
1829
|
+
requiredPermissions: ["editCode"],
|
|
1943
1830
|
inputs: [{
|
|
1944
|
-
name: "
|
|
1945
|
-
type: "
|
|
1946
|
-
bubble: true,
|
|
1947
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
1831
|
+
name: "code",
|
|
1832
|
+
type: "html",
|
|
1948
1833
|
required: true,
|
|
1949
|
-
defaultValue: "
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1834
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
1835
|
+
code: true
|
|
1836
|
+
}, {
|
|
1837
|
+
name: "replaceNodes",
|
|
1838
|
+
type: "boolean",
|
|
1839
|
+
helperText: "Preserve server rendered dom nodes",
|
|
1840
|
+
advanced: true
|
|
1841
|
+
}, {
|
|
1842
|
+
name: "scriptsClientOnly",
|
|
1843
|
+
type: "boolean",
|
|
1844
|
+
defaultValue: false,
|
|
1845
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
1846
|
+
advanced: true
|
|
1847
|
+
}]
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
// src/blocks/custom-code/custom-code.tsx
|
|
1851
|
+
import { onMount, createSignal as createSignal7 } from "solid-js";
|
|
1852
|
+
function CustomCode(props) {
|
|
1853
|
+
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
1854
|
+
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
1855
|
+
let elementRef;
|
|
1856
|
+
onMount(() => {
|
|
1857
|
+
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
const scripts = elementRef.getElementsByTagName("script");
|
|
1861
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
1862
|
+
const script = scripts[i];
|
|
1863
|
+
if (script.src) {
|
|
1864
|
+
if (scriptsInserted().includes(script.src)) {
|
|
1865
|
+
continue;
|
|
1866
|
+
}
|
|
1867
|
+
scriptsInserted().push(script.src);
|
|
1868
|
+
const newScript = document.createElement("script");
|
|
1869
|
+
newScript.async = true;
|
|
1870
|
+
newScript.src = script.src;
|
|
1871
|
+
document.head.appendChild(newScript);
|
|
1872
|
+
} else if (!script.type || [
|
|
1873
|
+
"text/javascript",
|
|
1874
|
+
"application/javascript",
|
|
1875
|
+
"application/ecmascript"
|
|
1876
|
+
].includes(script.type)) {
|
|
1877
|
+
if (scriptsRun().includes(script.innerText)) {
|
|
1878
|
+
continue;
|
|
1879
|
+
}
|
|
1880
|
+
try {
|
|
1881
|
+
scriptsRun().push(script.innerText);
|
|
1882
|
+
new Function(script.innerText)();
|
|
1883
|
+
} catch (error) {
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
});
|
|
1888
|
+
return <div
|
|
1889
|
+
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
1890
|
+
ref={elementRef}
|
|
1891
|
+
innerHTML={props.code}
|
|
1892
|
+
/>;
|
|
1893
|
+
}
|
|
1894
|
+
var custom_code_default = CustomCode;
|
|
1895
|
+
|
|
1896
|
+
// src/blocks/embed/component-info.ts
|
|
1897
|
+
var componentInfo4 = {
|
|
1898
|
+
name: "Embed",
|
|
1899
|
+
static: true,
|
|
1900
|
+
inputs: [{
|
|
1901
|
+
name: "url",
|
|
1902
|
+
type: "url",
|
|
1903
|
+
required: true,
|
|
1904
|
+
defaultValue: "",
|
|
1905
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
1906
|
+
onChange: (options) => {
|
|
1907
|
+
const url = options.get("url");
|
|
1908
|
+
if (url) {
|
|
1909
|
+
options.set("content", "Loading...");
|
|
1910
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
1911
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
1912
|
+
if (options.get("url") === url) {
|
|
1913
|
+
if (data.html) {
|
|
1914
|
+
options.set("content", data.html);
|
|
1915
|
+
} else {
|
|
1916
|
+
options.set("content", "Invalid url, please try another");
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}).catch((_err) => {
|
|
1920
|
+
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
1921
|
+
});
|
|
1922
|
+
} else {
|
|
1923
|
+
options.delete("content");
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
}, {
|
|
1927
|
+
name: "content",
|
|
1928
|
+
type: "html",
|
|
1929
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
1930
|
+
hideFromUI: true
|
|
1931
|
+
}]
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
// src/blocks/embed/embed.tsx
|
|
1935
|
+
import { on, createEffect, createSignal as createSignal8 } from "solid-js";
|
|
1936
|
+
|
|
1937
|
+
// src/blocks/embed/helpers.ts
|
|
1938
|
+
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
1939
|
+
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
1940
|
+
|
|
1941
|
+
// src/blocks/embed/embed.tsx
|
|
1942
|
+
function Embed(props) {
|
|
1943
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
1944
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
1945
|
+
const [ranInitFn, setRanInitFn] = createSignal8(false);
|
|
1946
|
+
function findAndRunScripts() {
|
|
1947
|
+
if (!elem || !elem.getElementsByTagName)
|
|
1948
|
+
return;
|
|
1949
|
+
const scripts = elem.getElementsByTagName("script");
|
|
1950
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
1951
|
+
const script = scripts[i];
|
|
1952
|
+
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
1953
|
+
scriptsInserted().push(script.src);
|
|
1954
|
+
const newScript = document.createElement("script");
|
|
1955
|
+
newScript.async = true;
|
|
1956
|
+
newScript.src = script.src;
|
|
1957
|
+
document.head.appendChild(newScript);
|
|
1958
|
+
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
1959
|
+
try {
|
|
1960
|
+
scriptsRun().push(script.innerText);
|
|
1961
|
+
new Function(script.innerText)();
|
|
1962
|
+
} catch (error) {
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
let elem;
|
|
1968
|
+
function onUpdateFn_0() {
|
|
1969
|
+
if (elem && !ranInitFn()) {
|
|
1970
|
+
setRanInitFn(true);
|
|
1971
|
+
findAndRunScripts();
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
1975
|
+
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
1976
|
+
}
|
|
1977
|
+
var embed_default = Embed;
|
|
1978
|
+
|
|
1979
|
+
// src/blocks/fragment/component-info.ts
|
|
1980
|
+
var componentInfo5 = {
|
|
1981
|
+
name: "Fragment",
|
|
1982
|
+
static: true,
|
|
1983
|
+
hidden: true,
|
|
1984
|
+
canHaveChildren: true,
|
|
1985
|
+
noWrap: true
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
// src/blocks/image/component-info.ts
|
|
1989
|
+
var componentInfo6 = {
|
|
1990
|
+
name: "Image",
|
|
1991
|
+
static: true,
|
|
1992
|
+
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",
|
|
1993
|
+
defaultStyles: {
|
|
1994
|
+
position: "relative",
|
|
1995
|
+
minHeight: "20px",
|
|
1996
|
+
minWidth: "20px",
|
|
1997
|
+
overflow: "hidden"
|
|
1998
|
+
},
|
|
1999
|
+
canHaveChildren: true,
|
|
2000
|
+
inputs: [{
|
|
2001
|
+
name: "image",
|
|
2002
|
+
type: "file",
|
|
2003
|
+
bubble: true,
|
|
2004
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
2005
|
+
required: true,
|
|
2006
|
+
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
2007
|
+
onChange: (options) => {
|
|
2008
|
+
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
2009
|
+
options.delete("srcset");
|
|
2010
|
+
options.delete("noWebp");
|
|
2011
|
+
function loadImage(url, timeout = 6e4) {
|
|
2012
|
+
return new Promise((resolve, reject) => {
|
|
2013
|
+
const img = document.createElement("img");
|
|
2014
|
+
let loaded = false;
|
|
2015
|
+
img.onload = () => {
|
|
2016
|
+
loaded = true;
|
|
2017
|
+
resolve(img);
|
|
2018
|
+
};
|
|
2019
|
+
img.addEventListener("error", (event) => {
|
|
2020
|
+
reject(event.error);
|
|
2021
|
+
});
|
|
2022
|
+
img.src = url;
|
|
2023
|
+
setTimeout(() => {
|
|
2024
|
+
if (!loaded) {
|
|
2025
|
+
reject(new Error("Image load timed out"));
|
|
2026
|
+
}
|
|
1970
2027
|
}, timeout);
|
|
1971
2028
|
});
|
|
1972
2029
|
}
|
|
@@ -2050,8 +2107,41 @@ var componentInfo4 = {
|
|
|
2050
2107
|
}]
|
|
2051
2108
|
};
|
|
2052
2109
|
|
|
2053
|
-
// src/blocks/
|
|
2054
|
-
var
|
|
2110
|
+
// src/blocks/img/component-info.ts
|
|
2111
|
+
var componentInfo7 = {
|
|
2112
|
+
// friendlyName?
|
|
2113
|
+
name: "Raw:Img",
|
|
2114
|
+
hideFromInsertMenu: true,
|
|
2115
|
+
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",
|
|
2116
|
+
inputs: [{
|
|
2117
|
+
name: "image",
|
|
2118
|
+
bubble: true,
|
|
2119
|
+
type: "file",
|
|
2120
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2121
|
+
required: true
|
|
2122
|
+
}],
|
|
2123
|
+
noWrap: true,
|
|
2124
|
+
static: true
|
|
2125
|
+
};
|
|
2126
|
+
|
|
2127
|
+
// src/blocks/img/img.tsx
|
|
2128
|
+
function ImgComponent(props) {
|
|
2129
|
+
return <img
|
|
2130
|
+
style={{
|
|
2131
|
+
"object-fit": props.backgroundSize || "cover",
|
|
2132
|
+
"object-position": props.backgroundPosition || "center"
|
|
2133
|
+
}}
|
|
2134
|
+
key={isEditing() && props.imgSrc || "default-key"}
|
|
2135
|
+
alt={props.altText}
|
|
2136
|
+
src={props.imgSrc || props.image}
|
|
2137
|
+
{...{}}
|
|
2138
|
+
{...props.attributes}
|
|
2139
|
+
/>;
|
|
2140
|
+
}
|
|
2141
|
+
var img_default = ImgComponent;
|
|
2142
|
+
|
|
2143
|
+
// src/blocks/section/component-info.ts
|
|
2144
|
+
var componentInfo8 = {
|
|
2055
2145
|
name: "Core:Section",
|
|
2056
2146
|
static: true,
|
|
2057
2147
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2092,8 +2182,8 @@ var componentInfo5 = {
|
|
|
2092
2182
|
}]
|
|
2093
2183
|
};
|
|
2094
2184
|
|
|
2095
|
-
// src/blocks/symbol/component-info.
|
|
2096
|
-
var
|
|
2185
|
+
// src/blocks/symbol/component-info.ts
|
|
2186
|
+
var componentInfo9 = {
|
|
2097
2187
|
name: "Symbol",
|
|
2098
2188
|
noWrap: true,
|
|
2099
2189
|
static: true,
|
|
@@ -2128,8 +2218,8 @@ var componentInfo6 = {
|
|
|
2128
2218
|
}]
|
|
2129
2219
|
};
|
|
2130
2220
|
|
|
2131
|
-
// src/blocks/text/component-info.
|
|
2132
|
-
var
|
|
2221
|
+
// src/blocks/text/component-info.ts
|
|
2222
|
+
var componentInfo10 = {
|
|
2133
2223
|
name: "Text",
|
|
2134
2224
|
static: true,
|
|
2135
2225
|
isRSC: true,
|
|
@@ -2149,7 +2239,7 @@ var componentInfo7 = {
|
|
|
2149
2239
|
}
|
|
2150
2240
|
};
|
|
2151
2241
|
|
|
2152
|
-
// src/blocks/text/text.
|
|
2242
|
+
// src/blocks/text/text.tsx
|
|
2153
2243
|
function Text(props) {
|
|
2154
2244
|
return <div
|
|
2155
2245
|
class="builder-text"
|
|
@@ -2161,8 +2251,8 @@ function Text(props) {
|
|
|
2161
2251
|
}
|
|
2162
2252
|
var text_default = Text;
|
|
2163
2253
|
|
|
2164
|
-
// src/blocks/video/component-info.
|
|
2165
|
-
var
|
|
2254
|
+
// src/blocks/video/component-info.ts
|
|
2255
|
+
var componentInfo11 = {
|
|
2166
2256
|
name: "Video",
|
|
2167
2257
|
canHaveChildren: true,
|
|
2168
2258
|
defaultStyles: {
|
|
@@ -2245,8 +2335,7 @@ var componentInfo8 = {
|
|
|
2245
2335
|
}]
|
|
2246
2336
|
};
|
|
2247
2337
|
|
|
2248
|
-
// src/blocks/video/video.
|
|
2249
|
-
import { createSignal as createSignal8 } from "solid-js";
|
|
2338
|
+
// src/blocks/video/video.tsx
|
|
2250
2339
|
function Video(props) {
|
|
2251
2340
|
function videoProps() {
|
|
2252
2341
|
return {
|
|
@@ -2292,275 +2381,43 @@ function Video(props) {
|
|
|
2292
2381
|
}
|
|
2293
2382
|
var video_default = Video;
|
|
2294
2383
|
|
|
2295
|
-
// src/
|
|
2296
|
-
var
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
// src/blocks/embed/embed.jsx
|
|
2334
|
-
import { on, createEffect, createSignal as createSignal9 } from "solid-js";
|
|
2335
|
-
|
|
2336
|
-
// src/blocks/embed/helpers.js
|
|
2337
|
-
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
2338
|
-
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2339
|
-
|
|
2340
|
-
// src/blocks/embed/embed.jsx
|
|
2341
|
-
function Embed(props) {
|
|
2342
|
-
const [scriptsInserted, setScriptsInserted] = createSignal9([]);
|
|
2343
|
-
const [scriptsRun, setScriptsRun] = createSignal9([]);
|
|
2344
|
-
const [ranInitFn, setRanInitFn] = createSignal9(false);
|
|
2345
|
-
function findAndRunScripts() {
|
|
2346
|
-
if (!elem || !elem.getElementsByTagName)
|
|
2347
|
-
return;
|
|
2348
|
-
const scripts = elem.getElementsByTagName("script");
|
|
2349
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2350
|
-
const script = scripts[i];
|
|
2351
|
-
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
2352
|
-
scriptsInserted().push(script.src);
|
|
2353
|
-
const newScript = document.createElement("script");
|
|
2354
|
-
newScript.async = true;
|
|
2355
|
-
newScript.src = script.src;
|
|
2356
|
-
document.head.appendChild(newScript);
|
|
2357
|
-
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
2358
|
-
try {
|
|
2359
|
-
scriptsRun().push(script.innerText);
|
|
2360
|
-
new Function(script.innerText)();
|
|
2361
|
-
} catch (error) {
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
let elem;
|
|
2367
|
-
function onUpdateFn_0() {
|
|
2368
|
-
if (elem && !ranInitFn()) {
|
|
2369
|
-
setRanInitFn(true);
|
|
2370
|
-
findAndRunScripts();
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
2374
|
-
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2375
|
-
}
|
|
2376
|
-
var embed_default = Embed;
|
|
2377
|
-
|
|
2378
|
-
// src/blocks/img/img.jsx
|
|
2379
|
-
function ImgComponent(props) {
|
|
2380
|
-
return <img
|
|
2381
|
-
style={{
|
|
2382
|
-
"object-fit": props.backgroundSize || "cover",
|
|
2383
|
-
"object-position": props.backgroundPosition || "center"
|
|
2384
|
-
}}
|
|
2385
|
-
key={isEditing() && props.imgSrc || "default-key"}
|
|
2386
|
-
alt={props.altText}
|
|
2387
|
-
src={props.imgSrc || props.image}
|
|
2388
|
-
{...{}}
|
|
2389
|
-
{...props.attributes}
|
|
2390
|
-
/>;
|
|
2391
|
-
}
|
|
2392
|
-
var img_default = ImgComponent;
|
|
2393
|
-
|
|
2394
|
-
// src/blocks/img/component-info.js
|
|
2395
|
-
var componentInfo10 = {
|
|
2396
|
-
name: "Raw:Img",
|
|
2397
|
-
hideFromInsertMenu: true,
|
|
2398
|
-
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",
|
|
2399
|
-
inputs: [{
|
|
2400
|
-
name: "image",
|
|
2401
|
-
bubble: true,
|
|
2402
|
-
type: "file",
|
|
2403
|
-
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "gif", "webp"],
|
|
2404
|
-
required: true
|
|
2405
|
-
}],
|
|
2406
|
-
noWrap: true,
|
|
2407
|
-
static: true
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
// src/blocks/custom-code/custom-code.jsx
|
|
2411
|
-
import { onMount, createSignal as createSignal10 } from "solid-js";
|
|
2412
|
-
function CustomCode(props) {
|
|
2413
|
-
const [scriptsInserted, setScriptsInserted] = createSignal10([]);
|
|
2414
|
-
const [scriptsRun, setScriptsRun] = createSignal10([]);
|
|
2415
|
-
let elementRef;
|
|
2416
|
-
onMount(() => {
|
|
2417
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
2418
|
-
return;
|
|
2419
|
-
}
|
|
2420
|
-
const scripts = elementRef.getElementsByTagName("script");
|
|
2421
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
2422
|
-
const script = scripts[i];
|
|
2423
|
-
if (script.src) {
|
|
2424
|
-
if (scriptsInserted().includes(script.src)) {
|
|
2425
|
-
continue;
|
|
2426
|
-
}
|
|
2427
|
-
scriptsInserted().push(script.src);
|
|
2428
|
-
const newScript = document.createElement("script");
|
|
2429
|
-
newScript.async = true;
|
|
2430
|
-
newScript.src = script.src;
|
|
2431
|
-
document.head.appendChild(newScript);
|
|
2432
|
-
} else if (!script.type || [
|
|
2433
|
-
"text/javascript",
|
|
2434
|
-
"application/javascript",
|
|
2435
|
-
"application/ecmascript"
|
|
2436
|
-
].includes(script.type)) {
|
|
2437
|
-
if (scriptsRun().includes(script.innerText)) {
|
|
2438
|
-
continue;
|
|
2439
|
-
}
|
|
2440
|
-
try {
|
|
2441
|
-
scriptsRun().push(script.innerText);
|
|
2442
|
-
new Function(script.innerText)();
|
|
2443
|
-
} catch (error) {
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
});
|
|
2448
|
-
return <div
|
|
2449
|
-
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
2450
|
-
ref={elementRef}
|
|
2451
|
-
innerHTML={props.code}
|
|
2452
|
-
/>;
|
|
2453
|
-
}
|
|
2454
|
-
var custom_code_default = CustomCode;
|
|
2455
|
-
|
|
2456
|
-
// src/blocks/custom-code/component-info.js
|
|
2457
|
-
var componentInfo11 = {
|
|
2458
|
-
name: "Custom Code",
|
|
2459
|
-
static: true,
|
|
2460
|
-
requiredPermissions: ["editCode"],
|
|
2461
|
-
inputs: [{
|
|
2462
|
-
name: "code",
|
|
2463
|
-
type: "html",
|
|
2464
|
-
required: true,
|
|
2465
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
2466
|
-
code: true
|
|
2467
|
-
}, {
|
|
2468
|
-
name: "replaceNodes",
|
|
2469
|
-
type: "boolean",
|
|
2470
|
-
helperText: "Preserve server rendered dom nodes",
|
|
2471
|
-
advanced: true
|
|
2472
|
-
}, {
|
|
2473
|
-
name: "scriptsClientOnly",
|
|
2474
|
-
type: "boolean",
|
|
2475
|
-
defaultValue: false,
|
|
2476
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
2477
|
-
advanced: true
|
|
2478
|
-
}]
|
|
2479
|
-
};
|
|
2480
|
-
|
|
2481
|
-
// src/constants/builder-registered-components.js
|
|
2482
|
-
var __defProp9 = Object.defineProperty;
|
|
2483
|
-
var __getOwnPropSymbols9 = Object.getOwnPropertySymbols;
|
|
2484
|
-
var __hasOwnProp9 = Object.prototype.hasOwnProperty;
|
|
2485
|
-
var __propIsEnum9 = Object.prototype.propertyIsEnumerable;
|
|
2486
|
-
var __defNormalProp9 = (obj, key, value) => key in obj ? __defProp9(obj, key, {
|
|
2487
|
-
enumerable: true,
|
|
2488
|
-
configurable: true,
|
|
2489
|
-
writable: true,
|
|
2490
|
-
value
|
|
2491
|
-
}) : obj[key] = value;
|
|
2492
|
-
var __spreadValues9 = (a, b) => {
|
|
2493
|
-
for (var prop in b || (b = {}))
|
|
2494
|
-
if (__hasOwnProp9.call(b, prop))
|
|
2495
|
-
__defNormalProp9(a, prop, b[prop]);
|
|
2496
|
-
if (__getOwnPropSymbols9)
|
|
2497
|
-
for (var prop of __getOwnPropSymbols9(b)) {
|
|
2498
|
-
if (__propIsEnum9.call(b, prop))
|
|
2499
|
-
__defNormalProp9(a, prop, b[prop]);
|
|
2500
|
-
}
|
|
2501
|
-
return a;
|
|
2502
|
-
};
|
|
2503
|
-
var getDefaultRegisteredComponents = () => [__spreadValues9({
|
|
2504
|
-
component: button_default
|
|
2505
|
-
}, componentInfo), __spreadValues9({
|
|
2506
|
-
component: columns_default
|
|
2507
|
-
}, componentInfo2), __spreadValues9({
|
|
2508
|
-
component: custom_code_default
|
|
2509
|
-
}, componentInfo11), __spreadValues9({
|
|
2510
|
-
component: embed_default
|
|
2511
|
-
}, componentInfo9), __spreadValues9({
|
|
2512
|
-
component: fragment_default
|
|
2513
|
-
}, componentInfo3), __spreadValues9({
|
|
2514
|
-
component: image_default
|
|
2515
|
-
}, componentInfo4), __spreadValues9({
|
|
2516
|
-
component: img_default
|
|
2517
|
-
}, componentInfo10), __spreadValues9({
|
|
2518
|
-
component: section_default
|
|
2519
|
-
}, componentInfo5), __spreadValues9({
|
|
2520
|
-
component: symbol_default
|
|
2521
|
-
}, componentInfo6), __spreadValues9({
|
|
2522
|
-
component: text_default
|
|
2523
|
-
}, componentInfo7), __spreadValues9({
|
|
2524
|
-
component: video_default
|
|
2525
|
-
}, componentInfo8)];
|
|
2526
|
-
|
|
2527
|
-
// src/functions/register-component.js
|
|
2528
|
-
var __defProp10 = Object.defineProperty;
|
|
2529
|
-
var __defProps7 = Object.defineProperties;
|
|
2530
|
-
var __getOwnPropDescs7 = Object.getOwnPropertyDescriptors;
|
|
2531
|
-
var __getOwnPropSymbols10 = Object.getOwnPropertySymbols;
|
|
2532
|
-
var __hasOwnProp10 = Object.prototype.hasOwnProperty;
|
|
2533
|
-
var __propIsEnum10 = Object.prototype.propertyIsEnumerable;
|
|
2534
|
-
var __defNormalProp10 = (obj, key, value) => key in obj ? __defProp10(obj, key, {
|
|
2535
|
-
enumerable: true,
|
|
2536
|
-
configurable: true,
|
|
2537
|
-
writable: true,
|
|
2538
|
-
value
|
|
2539
|
-
}) : obj[key] = value;
|
|
2540
|
-
var __spreadValues10 = (a, b) => {
|
|
2541
|
-
for (var prop in b || (b = {}))
|
|
2542
|
-
if (__hasOwnProp10.call(b, prop))
|
|
2543
|
-
__defNormalProp10(a, prop, b[prop]);
|
|
2544
|
-
if (__getOwnPropSymbols10)
|
|
2545
|
-
for (var prop of __getOwnPropSymbols10(b)) {
|
|
2546
|
-
if (__propIsEnum10.call(b, prop))
|
|
2547
|
-
__defNormalProp10(a, prop, b[prop]);
|
|
2548
|
-
}
|
|
2549
|
-
return a;
|
|
2550
|
-
};
|
|
2551
|
-
var __spreadProps7 = (a, b) => __defProps7(a, __getOwnPropDescs7(b));
|
|
2552
|
-
var __objRest2 = (source, exclude) => {
|
|
2553
|
-
var target = {};
|
|
2554
|
-
for (var prop in source)
|
|
2555
|
-
if (__hasOwnProp10.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2556
|
-
target[prop] = source[prop];
|
|
2557
|
-
if (source != null && __getOwnPropSymbols10)
|
|
2558
|
-
for (var prop of __getOwnPropSymbols10(source)) {
|
|
2559
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum10.call(source, prop))
|
|
2560
|
-
target[prop] = source[prop];
|
|
2561
|
-
}
|
|
2562
|
-
return target;
|
|
2563
|
-
};
|
|
2384
|
+
// src/constants/builder-registered-components.ts
|
|
2385
|
+
var getDefaultRegisteredComponents = () => [{
|
|
2386
|
+
component: button_default,
|
|
2387
|
+
...componentInfo
|
|
2388
|
+
}, {
|
|
2389
|
+
component: columns_default,
|
|
2390
|
+
...componentInfo2
|
|
2391
|
+
}, {
|
|
2392
|
+
component: custom_code_default,
|
|
2393
|
+
...componentInfo3
|
|
2394
|
+
}, {
|
|
2395
|
+
component: embed_default,
|
|
2396
|
+
...componentInfo4
|
|
2397
|
+
}, {
|
|
2398
|
+
component: fragment_default,
|
|
2399
|
+
...componentInfo5
|
|
2400
|
+
}, {
|
|
2401
|
+
component: image_default,
|
|
2402
|
+
...componentInfo6
|
|
2403
|
+
}, {
|
|
2404
|
+
component: img_default,
|
|
2405
|
+
...componentInfo7
|
|
2406
|
+
}, {
|
|
2407
|
+
component: section_default,
|
|
2408
|
+
...componentInfo8
|
|
2409
|
+
}, {
|
|
2410
|
+
component: symbol_default,
|
|
2411
|
+
...componentInfo9
|
|
2412
|
+
}, {
|
|
2413
|
+
component: text_default,
|
|
2414
|
+
...componentInfo10
|
|
2415
|
+
}, {
|
|
2416
|
+
component: video_default,
|
|
2417
|
+
...componentInfo11
|
|
2418
|
+
}];
|
|
2419
|
+
|
|
2420
|
+
// src/functions/register-component.ts
|
|
2564
2421
|
var components = [];
|
|
2565
2422
|
var createRegisterComponentMessage = (info) => ({
|
|
2566
2423
|
type: "builder.registerComponent",
|
|
@@ -2572,930 +2429,223 @@ var serializeFn = (fnValue) => {
|
|
|
2572
2429
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
2573
2430
|
};
|
|
2574
2431
|
var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
|
|
2575
|
-
var serializeComponentInfo = (
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
})
|
|
2584
|
-
};
|
|
2585
|
-
|
|
2586
|
-
// src/components/content/components/styles.jsx
|
|
2587
|
-
import { createSignal as createSignal11 } from "solid-js";
|
|
2432
|
+
var serializeComponentInfo = ({
|
|
2433
|
+
inputs,
|
|
2434
|
+
...info
|
|
2435
|
+
}) => ({
|
|
2436
|
+
...fastClone(info),
|
|
2437
|
+
inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
|
|
2438
|
+
...acc,
|
|
2439
|
+
[key]: serializeValue(value)
|
|
2440
|
+
}), {}))
|
|
2441
|
+
});
|
|
2588
2442
|
|
|
2589
|
-
// src/components/content/
|
|
2590
|
-
var
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
@font-face {
|
|
2599
|
-
font-family: "${family}";
|
|
2600
|
-
src: local("${name}"), url('${url}') format('woff2');
|
|
2601
|
-
font-display: fallback;
|
|
2602
|
-
font-weight: 400;
|
|
2603
|
-
}
|
|
2604
|
-
`.trim();
|
|
2605
|
-
}
|
|
2606
|
-
if (font.files) {
|
|
2607
|
-
for (const weight in font.files) {
|
|
2608
|
-
const isNumber = String(Number(weight)) === weight;
|
|
2609
|
-
if (!isNumber) {
|
|
2610
|
-
continue;
|
|
2611
|
-
}
|
|
2612
|
-
const weightUrl = font.files[weight];
|
|
2613
|
-
if (weightUrl && weightUrl !== url) {
|
|
2614
|
-
str += `
|
|
2615
|
-
@font-face {
|
|
2616
|
-
font-family: "${family}";
|
|
2617
|
-
src: url('${weightUrl}') format('woff2');
|
|
2618
|
-
font-display: fallback;
|
|
2619
|
-
font-weight: ${weight};
|
|
2620
|
-
}
|
|
2621
|
-
`.trim();
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
return str;
|
|
2626
|
-
};
|
|
2627
|
-
var getFontCss = ({
|
|
2628
|
-
customFonts
|
|
2629
|
-
}) => {
|
|
2630
|
-
var _a;
|
|
2631
|
-
return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
|
|
2632
|
-
};
|
|
2633
|
-
var getCss = ({
|
|
2634
|
-
cssCode,
|
|
2635
|
-
contentId
|
|
2443
|
+
// src/components/content-variants/helpers.ts
|
|
2444
|
+
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2445
|
+
...variant,
|
|
2446
|
+
testVariationId: variant.id,
|
|
2447
|
+
id: content?.id
|
|
2448
|
+
}));
|
|
2449
|
+
var checkShouldRunVariants = ({
|
|
2450
|
+
canTrack,
|
|
2451
|
+
content
|
|
2636
2452
|
}) => {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
if (!
|
|
2641
|
-
return
|
|
2642
|
-
|
|
2643
|
-
|
|
2453
|
+
const hasVariants = getVariants(content).length > 0;
|
|
2454
|
+
if (TARGET === "reactNative")
|
|
2455
|
+
return false;
|
|
2456
|
+
if (!hasVariants)
|
|
2457
|
+
return false;
|
|
2458
|
+
if (!canTrack)
|
|
2459
|
+
return false;
|
|
2460
|
+
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2461
|
+
return true;
|
|
2462
|
+
if (isBrowser())
|
|
2463
|
+
return false;
|
|
2464
|
+
return true;
|
|
2644
2465
|
};
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
function
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
customFonts: props.customFonts
|
|
2656
|
-
})}
|
|
2657
|
-
|
|
2658
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
2659
|
-
margin: 0;
|
|
2660
|
-
}
|
|
2661
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
2662
|
-
color: inherit;
|
|
2663
|
-
line-height: inherit;
|
|
2664
|
-
letter-spacing: inherit;
|
|
2665
|
-
font-weight: inherit;
|
|
2666
|
-
font-size: inherit;
|
|
2667
|
-
text-align: inherit;
|
|
2668
|
-
font-family: inherit;
|
|
2669
|
-
}
|
|
2670
|
-
`.trim()
|
|
2671
|
-
);
|
|
2672
|
-
return <Inlined_styles_default styles={injectedStyles()} />;
|
|
2673
|
-
}
|
|
2674
|
-
var Styles_default = ContentStyles;
|
|
2675
|
-
|
|
2676
|
-
// src/components/content/content.helpers.js
|
|
2677
|
-
var __defProp11 = Object.defineProperty;
|
|
2678
|
-
var __defProps8 = Object.defineProperties;
|
|
2679
|
-
var __getOwnPropDescs8 = Object.getOwnPropertyDescriptors;
|
|
2680
|
-
var __getOwnPropSymbols11 = Object.getOwnPropertySymbols;
|
|
2681
|
-
var __hasOwnProp11 = Object.prototype.hasOwnProperty;
|
|
2682
|
-
var __propIsEnum11 = Object.prototype.propertyIsEnumerable;
|
|
2683
|
-
var __defNormalProp11 = (obj, key, value) => key in obj ? __defProp11(obj, key, {
|
|
2684
|
-
enumerable: true,
|
|
2685
|
-
configurable: true,
|
|
2686
|
-
writable: true,
|
|
2687
|
-
value
|
|
2688
|
-
}) : obj[key] = value;
|
|
2689
|
-
var __spreadValues11 = (a, b) => {
|
|
2690
|
-
for (var prop in b || (b = {}))
|
|
2691
|
-
if (__hasOwnProp11.call(b, prop))
|
|
2692
|
-
__defNormalProp11(a, prop, b[prop]);
|
|
2693
|
-
if (__getOwnPropSymbols11)
|
|
2694
|
-
for (var prop of __getOwnPropSymbols11(b)) {
|
|
2695
|
-
if (__propIsEnum11.call(b, prop))
|
|
2696
|
-
__defNormalProp11(a, prop, b[prop]);
|
|
2466
|
+
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2467
|
+
function getAndSetVariantId2() {
|
|
2468
|
+
function setCookie2(name, value, days) {
|
|
2469
|
+
let expires = "";
|
|
2470
|
+
if (days) {
|
|
2471
|
+
const date = /* @__PURE__ */ new Date();
|
|
2472
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2473
|
+
expires = "; expires=" + date.toUTCString();
|
|
2474
|
+
}
|
|
2475
|
+
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2697
2476
|
}
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
const defaultValues = {};
|
|
2708
|
-
(_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach((input) => {
|
|
2709
|
-
var _a2;
|
|
2710
|
-
if (input.name && input.defaultValue !== void 0 && ((_a2 = content == null ? void 0 : content.data) == null ? void 0 : _a2.state) && content.data.state[input.name] === void 0) {
|
|
2711
|
-
defaultValues[input.name] = input.defaultValue;
|
|
2712
|
-
}
|
|
2713
|
-
});
|
|
2714
|
-
const stateToUse = __spreadValues11(__spreadValues11(__spreadValues11({}, (_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state), data), locale ? {
|
|
2715
|
-
locale
|
|
2716
|
-
} : {});
|
|
2717
|
-
return __spreadValues11(__spreadValues11({}, defaultValues), stateToUse);
|
|
2718
|
-
};
|
|
2719
|
-
var getContentInitialValue = ({
|
|
2720
|
-
content,
|
|
2721
|
-
data
|
|
2722
|
-
}) => {
|
|
2723
|
-
return !content ? void 0 : __spreadProps8(__spreadValues11({}, content), {
|
|
2724
|
-
data: __spreadValues11(__spreadValues11({}, content == null ? void 0 : content.data), data),
|
|
2725
|
-
meta: content == null ? void 0 : content.meta
|
|
2726
|
-
});
|
|
2727
|
-
};
|
|
2728
|
-
|
|
2729
|
-
// src/components/content/components/enable-editor.jsx
|
|
2730
|
-
import { Show as Show9, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal12 } from "solid-js";
|
|
2731
|
-
|
|
2732
|
-
// src/functions/get-global-this.js
|
|
2733
|
-
function getGlobalThis() {
|
|
2734
|
-
if (typeof globalThis !== "undefined") {
|
|
2735
|
-
return globalThis;
|
|
2736
|
-
}
|
|
2737
|
-
if (typeof window !== "undefined") {
|
|
2738
|
-
return window;
|
|
2739
|
-
}
|
|
2740
|
-
if (typeof global !== "undefined") {
|
|
2741
|
-
return global;
|
|
2742
|
-
}
|
|
2743
|
-
if (typeof self !== "undefined") {
|
|
2744
|
-
return self;
|
|
2745
|
-
}
|
|
2746
|
-
return globalThis;
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
// src/functions/get-fetch.js
|
|
2750
|
-
function getFetch() {
|
|
2751
|
-
const globalFetch = getGlobalThis().fetch;
|
|
2752
|
-
if (typeof globalFetch === "undefined") {
|
|
2753
|
-
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
2754
|
-
}
|
|
2755
|
-
return globalFetch;
|
|
2756
|
-
}
|
|
2757
|
-
var fetch2 = getFetch();
|
|
2758
|
-
|
|
2759
|
-
// src/helpers/url.js
|
|
2760
|
-
var getTopLevelDomain = (host) => {
|
|
2761
|
-
if (host === "localhost" || host === "127.0.0.1") {
|
|
2762
|
-
return host;
|
|
2763
|
-
}
|
|
2764
|
-
const parts = host.split(".");
|
|
2765
|
-
if (parts.length > 2) {
|
|
2766
|
-
return parts.slice(1).join(".");
|
|
2767
|
-
}
|
|
2768
|
-
return host;
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
// src/helpers/cookie.js
|
|
2772
|
-
var __async = (__this, __arguments, generator) => {
|
|
2773
|
-
return new Promise((resolve, reject) => {
|
|
2774
|
-
var fulfilled = (value) => {
|
|
2775
|
-
try {
|
|
2776
|
-
step(generator.next(value));
|
|
2777
|
-
} catch (e) {
|
|
2778
|
-
reject(e);
|
|
2779
|
-
}
|
|
2780
|
-
};
|
|
2781
|
-
var rejected = (value) => {
|
|
2782
|
-
try {
|
|
2783
|
-
step(generator.throw(value));
|
|
2784
|
-
} catch (e) {
|
|
2785
|
-
reject(e);
|
|
2786
|
-
}
|
|
2787
|
-
};
|
|
2788
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2789
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2790
|
-
});
|
|
2791
|
-
};
|
|
2792
|
-
var getCookieSync = ({
|
|
2793
|
-
name,
|
|
2794
|
-
canTrack
|
|
2795
|
-
}) => {
|
|
2796
|
-
var _a;
|
|
2797
|
-
try {
|
|
2798
|
-
if (!canTrack) {
|
|
2799
|
-
return void 0;
|
|
2800
|
-
}
|
|
2801
|
-
return (_a = document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
|
|
2802
|
-
} catch (err) {
|
|
2803
|
-
logger.warn("[COOKIE] GET error: ", (err == null ? void 0 : err.message) || err);
|
|
2804
|
-
return void 0;
|
|
2805
|
-
}
|
|
2806
|
-
};
|
|
2807
|
-
var getCookie = (args) => __async(void 0, null, function* () {
|
|
2808
|
-
return getCookieSync(args);
|
|
2809
|
-
});
|
|
2810
|
-
var stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
2811
|
-
var SECURE_CONFIG = [["secure", ""], ["SameSite", "None"]];
|
|
2812
|
-
var createCookieString = ({
|
|
2813
|
-
name,
|
|
2814
|
-
value,
|
|
2815
|
-
expires
|
|
2816
|
-
}) => {
|
|
2817
|
-
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
2818
|
-
const secureObj = secure ? SECURE_CONFIG : [[]];
|
|
2819
|
-
const expiresObj = expires ? [["expires", expires.toUTCString()]] : [[]];
|
|
2820
|
-
const cookieValue = [[name, value], ...expiresObj, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...secureObj];
|
|
2821
|
-
const cookie = stringifyCookie(cookieValue);
|
|
2822
|
-
return cookie;
|
|
2823
|
-
};
|
|
2824
|
-
var setCookie = (_0) => __async(void 0, [_0], function* ({
|
|
2825
|
-
name,
|
|
2826
|
-
value,
|
|
2827
|
-
expires,
|
|
2828
|
-
canTrack
|
|
2829
|
-
}) {
|
|
2830
|
-
try {
|
|
2831
|
-
if (!canTrack) {
|
|
2832
|
-
return;
|
|
2833
|
-
}
|
|
2834
|
-
const cookie = createCookieString({
|
|
2835
|
-
name,
|
|
2836
|
-
value,
|
|
2837
|
-
expires
|
|
2838
|
-
});
|
|
2839
|
-
document.cookie = cookie;
|
|
2840
|
-
} catch (err) {
|
|
2841
|
-
logger.warn("[COOKIE] SET error: ", (err == null ? void 0 : err.message) || err);
|
|
2842
|
-
}
|
|
2843
|
-
});
|
|
2844
|
-
|
|
2845
|
-
// src/helpers/uuid.js
|
|
2846
|
-
function uuidv4() {
|
|
2847
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
2848
|
-
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
2849
|
-
return v.toString(16);
|
|
2850
|
-
});
|
|
2851
|
-
}
|
|
2852
|
-
function uuid() {
|
|
2853
|
-
return uuidv4().replace(/-/g, "");
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
|
-
// src/helpers/sessionId.js
|
|
2857
|
-
var __async2 = (__this, __arguments, generator) => {
|
|
2858
|
-
return new Promise((resolve, reject) => {
|
|
2859
|
-
var fulfilled = (value) => {
|
|
2860
|
-
try {
|
|
2861
|
-
step(generator.next(value));
|
|
2862
|
-
} catch (e) {
|
|
2863
|
-
reject(e);
|
|
2864
|
-
}
|
|
2865
|
-
};
|
|
2866
|
-
var rejected = (value) => {
|
|
2867
|
-
try {
|
|
2868
|
-
step(generator.throw(value));
|
|
2869
|
-
} catch (e) {
|
|
2870
|
-
reject(e);
|
|
2871
|
-
}
|
|
2872
|
-
};
|
|
2873
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2874
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2875
|
-
});
|
|
2876
|
-
};
|
|
2877
|
-
var SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
2878
|
-
var getSessionId = (_0) => __async2(void 0, [_0], function* ({
|
|
2879
|
-
canTrack
|
|
2880
|
-
}) {
|
|
2881
|
-
if (!canTrack) {
|
|
2882
|
-
return void 0;
|
|
2883
|
-
}
|
|
2884
|
-
const sessionId = yield getCookie({
|
|
2885
|
-
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2886
|
-
canTrack
|
|
2887
|
-
});
|
|
2888
|
-
if (checkIsDefined(sessionId)) {
|
|
2889
|
-
return sessionId;
|
|
2890
|
-
} else {
|
|
2891
|
-
const newSessionId = createSessionId();
|
|
2892
|
-
setSessionId({
|
|
2893
|
-
id: newSessionId,
|
|
2894
|
-
canTrack
|
|
2895
|
-
});
|
|
2896
|
-
return newSessionId;
|
|
2897
|
-
}
|
|
2898
|
-
});
|
|
2899
|
-
var createSessionId = () => uuid();
|
|
2900
|
-
var setSessionId = ({
|
|
2901
|
-
id,
|
|
2902
|
-
canTrack
|
|
2903
|
-
}) => setCookie({
|
|
2904
|
-
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2905
|
-
value: id,
|
|
2906
|
-
canTrack
|
|
2907
|
-
});
|
|
2908
|
-
|
|
2909
|
-
// src/helpers/localStorage.js
|
|
2910
|
-
var getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
2911
|
-
var getLocalStorageItem = ({
|
|
2912
|
-
key,
|
|
2913
|
-
canTrack
|
|
2914
|
-
}) => {
|
|
2915
|
-
var _a;
|
|
2916
|
-
try {
|
|
2917
|
-
if (canTrack) {
|
|
2918
|
-
return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
|
|
2919
|
-
}
|
|
2920
|
-
return void 0;
|
|
2921
|
-
} catch (err) {
|
|
2922
|
-
return void 0;
|
|
2923
|
-
}
|
|
2924
|
-
};
|
|
2925
|
-
var setLocalStorageItem = ({
|
|
2926
|
-
key,
|
|
2927
|
-
canTrack,
|
|
2928
|
-
value
|
|
2929
|
-
}) => {
|
|
2930
|
-
var _a;
|
|
2931
|
-
try {
|
|
2932
|
-
if (canTrack) {
|
|
2933
|
-
(_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
|
|
2934
|
-
}
|
|
2935
|
-
} catch (err) {
|
|
2936
|
-
}
|
|
2937
|
-
};
|
|
2938
|
-
|
|
2939
|
-
// src/helpers/visitorId.js
|
|
2940
|
-
var VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
2941
|
-
var getVisitorId = ({
|
|
2942
|
-
canTrack
|
|
2943
|
-
}) => {
|
|
2944
|
-
if (!canTrack) {
|
|
2945
|
-
return void 0;
|
|
2946
|
-
}
|
|
2947
|
-
const visitorId = getLocalStorageItem({
|
|
2948
|
-
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2949
|
-
canTrack
|
|
2950
|
-
});
|
|
2951
|
-
if (checkIsDefined(visitorId)) {
|
|
2952
|
-
return visitorId;
|
|
2953
|
-
} else {
|
|
2954
|
-
const newVisitorId = createVisitorId();
|
|
2955
|
-
setVisitorId({
|
|
2956
|
-
id: newVisitorId,
|
|
2957
|
-
canTrack
|
|
2958
|
-
});
|
|
2959
|
-
return newVisitorId;
|
|
2960
|
-
}
|
|
2961
|
-
};
|
|
2962
|
-
var createVisitorId = () => uuid();
|
|
2963
|
-
var setVisitorId = ({
|
|
2964
|
-
id,
|
|
2965
|
-
canTrack
|
|
2966
|
-
}) => setLocalStorageItem({
|
|
2967
|
-
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2968
|
-
value: id,
|
|
2969
|
-
canTrack
|
|
2970
|
-
});
|
|
2971
|
-
|
|
2972
|
-
// src/functions/track/index.js
|
|
2973
|
-
var __defProp12 = Object.defineProperty;
|
|
2974
|
-
var __defProps9 = Object.defineProperties;
|
|
2975
|
-
var __getOwnPropDescs9 = Object.getOwnPropertyDescriptors;
|
|
2976
|
-
var __getOwnPropSymbols12 = Object.getOwnPropertySymbols;
|
|
2977
|
-
var __hasOwnProp12 = Object.prototype.hasOwnProperty;
|
|
2978
|
-
var __propIsEnum12 = Object.prototype.propertyIsEnumerable;
|
|
2979
|
-
var __defNormalProp12 = (obj, key, value) => key in obj ? __defProp12(obj, key, {
|
|
2980
|
-
enumerable: true,
|
|
2981
|
-
configurable: true,
|
|
2982
|
-
writable: true,
|
|
2983
|
-
value
|
|
2984
|
-
}) : obj[key] = value;
|
|
2985
|
-
var __spreadValues12 = (a, b) => {
|
|
2986
|
-
for (var prop in b || (b = {}))
|
|
2987
|
-
if (__hasOwnProp12.call(b, prop))
|
|
2988
|
-
__defNormalProp12(a, prop, b[prop]);
|
|
2989
|
-
if (__getOwnPropSymbols12)
|
|
2990
|
-
for (var prop of __getOwnPropSymbols12(b)) {
|
|
2991
|
-
if (__propIsEnum12.call(b, prop))
|
|
2992
|
-
__defNormalProp12(a, prop, b[prop]);
|
|
2993
|
-
}
|
|
2994
|
-
return a;
|
|
2995
|
-
};
|
|
2996
|
-
var __spreadProps9 = (a, b) => __defProps9(a, __getOwnPropDescs9(b));
|
|
2997
|
-
var __objRest3 = (source, exclude) => {
|
|
2998
|
-
var target = {};
|
|
2999
|
-
for (var prop in source)
|
|
3000
|
-
if (__hasOwnProp12.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3001
|
-
target[prop] = source[prop];
|
|
3002
|
-
if (source != null && __getOwnPropSymbols12)
|
|
3003
|
-
for (var prop of __getOwnPropSymbols12(source)) {
|
|
3004
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum12.call(source, prop))
|
|
3005
|
-
target[prop] = source[prop];
|
|
3006
|
-
}
|
|
3007
|
-
return target;
|
|
3008
|
-
};
|
|
3009
|
-
var __async3 = (__this, __arguments, generator) => {
|
|
3010
|
-
return new Promise((resolve, reject) => {
|
|
3011
|
-
var fulfilled = (value) => {
|
|
3012
|
-
try {
|
|
3013
|
-
step(generator.next(value));
|
|
3014
|
-
} catch (e) {
|
|
3015
|
-
reject(e);
|
|
3016
|
-
}
|
|
3017
|
-
};
|
|
3018
|
-
var rejected = (value) => {
|
|
3019
|
-
try {
|
|
3020
|
-
step(generator.throw(value));
|
|
3021
|
-
} catch (e) {
|
|
3022
|
-
reject(e);
|
|
2477
|
+
function getCookie2(name) {
|
|
2478
|
+
const nameEQ = name + "=";
|
|
2479
|
+
const ca = document.cookie.split(";");
|
|
2480
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2481
|
+
let c = ca[i];
|
|
2482
|
+
while (c.charAt(0) === " ")
|
|
2483
|
+
c = c.substring(1, c.length);
|
|
2484
|
+
if (c.indexOf(nameEQ) === 0)
|
|
2485
|
+
return c.substring(nameEQ.length, c.length);
|
|
3023
2486
|
}
|
|
3024
|
-
|
|
3025
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3026
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3027
|
-
});
|
|
3028
|
-
};
|
|
3029
|
-
var getTrackingEventData = (_0) => __async3(void 0, [_0], function* ({
|
|
3030
|
-
canTrack
|
|
3031
|
-
}) {
|
|
3032
|
-
if (!canTrack) {
|
|
3033
|
-
return {
|
|
3034
|
-
visitorId: void 0,
|
|
3035
|
-
sessionId: void 0
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
3038
|
-
const sessionId = yield getSessionId({
|
|
3039
|
-
canTrack
|
|
3040
|
-
});
|
|
3041
|
-
const visitorId = getVisitorId({
|
|
3042
|
-
canTrack
|
|
3043
|
-
});
|
|
3044
|
-
return {
|
|
3045
|
-
sessionId,
|
|
3046
|
-
visitorId
|
|
3047
|
-
};
|
|
3048
|
-
});
|
|
3049
|
-
var createEvent = (_a) => __async3(void 0, null, function* () {
|
|
3050
|
-
var _b = _a, {
|
|
3051
|
-
type: eventType,
|
|
3052
|
-
canTrack,
|
|
3053
|
-
apiKey,
|
|
3054
|
-
metadata
|
|
3055
|
-
} = _b, properties = __objRest3(_b, ["type", "canTrack", "apiKey", "metadata"]);
|
|
3056
|
-
return {
|
|
3057
|
-
type: eventType,
|
|
3058
|
-
data: __spreadProps9(__spreadValues12(__spreadProps9(__spreadValues12({}, properties), {
|
|
3059
|
-
metadata: __spreadValues12({
|
|
3060
|
-
url: location.href
|
|
3061
|
-
}, metadata)
|
|
3062
|
-
}), yield getTrackingEventData({
|
|
3063
|
-
canTrack
|
|
3064
|
-
})), {
|
|
3065
|
-
userAttributes: getUserAttributes(),
|
|
3066
|
-
ownerId: apiKey
|
|
3067
|
-
})
|
|
3068
|
-
};
|
|
3069
|
-
});
|
|
3070
|
-
function _track(eventProps) {
|
|
3071
|
-
return __async3(this, null, function* () {
|
|
3072
|
-
if (!eventProps.apiKey) {
|
|
3073
|
-
logger.error("Missing API key for track call. Please provide your API key.");
|
|
3074
|
-
return;
|
|
3075
|
-
}
|
|
3076
|
-
if (!eventProps.canTrack) {
|
|
3077
|
-
return;
|
|
3078
|
-
}
|
|
3079
|
-
if (isEditing()) {
|
|
3080
|
-
return;
|
|
3081
|
-
}
|
|
3082
|
-
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
3083
|
-
return;
|
|
2487
|
+
return null;
|
|
3084
2488
|
}
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
headers: {
|
|
3091
|
-
"content-type": "application/json"
|
|
3092
|
-
},
|
|
3093
|
-
mode: "cors"
|
|
3094
|
-
}).catch((err) => {
|
|
3095
|
-
});
|
|
3096
|
-
});
|
|
3097
|
-
}
|
|
3098
|
-
var track = (args) => _track(__spreadProps9(__spreadValues12({}, args), {
|
|
3099
|
-
canTrack: true
|
|
3100
|
-
}));
|
|
3101
|
-
|
|
3102
|
-
// src/constants/sdk-version.js
|
|
3103
|
-
var SDK_VERSION = "0.7.1-1";
|
|
3104
|
-
|
|
3105
|
-
// src/functions/register.js
|
|
3106
|
-
var registry = {};
|
|
3107
|
-
function register(type, info) {
|
|
3108
|
-
let typeList = registry[type];
|
|
3109
|
-
if (!typeList) {
|
|
3110
|
-
typeList = registry[type] = [];
|
|
3111
|
-
}
|
|
3112
|
-
typeList.push(info);
|
|
3113
|
-
if (isBrowser()) {
|
|
3114
|
-
const message = {
|
|
3115
|
-
type: "builder.register",
|
|
3116
|
-
data: {
|
|
3117
|
-
type,
|
|
3118
|
-
info
|
|
3119
|
-
}
|
|
3120
|
-
};
|
|
3121
|
-
try {
|
|
3122
|
-
parent.postMessage(message, "*");
|
|
3123
|
-
if (parent !== window) {
|
|
3124
|
-
window.postMessage(message, "*");
|
|
3125
|
-
}
|
|
3126
|
-
} catch (err) {
|
|
2489
|
+
const cookieName = `builder.tests.${contentId}`;
|
|
2490
|
+
const variantInCookie = getCookie2(cookieName);
|
|
2491
|
+
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2492
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2493
|
+
return variantInCookie;
|
|
3127
2494
|
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
name: "Box"
|
|
3138
|
-
}, {
|
|
3139
|
-
name: "Text"
|
|
3140
|
-
}, {
|
|
3141
|
-
name: "Image"
|
|
3142
|
-
}, {
|
|
3143
|
-
name: "Columns"
|
|
3144
|
-
}, ...TARGET === "reactNative" ? [] : [{
|
|
3145
|
-
name: "Core:Section"
|
|
3146
|
-
}, {
|
|
3147
|
-
name: "Core:Button"
|
|
3148
|
-
}, {
|
|
3149
|
-
name: "Embed"
|
|
3150
|
-
}, {
|
|
3151
|
-
name: "Custom Code"
|
|
3152
|
-
}]]
|
|
3153
|
-
});
|
|
3154
|
-
};
|
|
3155
|
-
var isSetupForEditing = false;
|
|
3156
|
-
var setupBrowserForEditing = (options = {}) => {
|
|
3157
|
-
var _a, _b;
|
|
3158
|
-
if (isSetupForEditing) {
|
|
3159
|
-
return;
|
|
3160
|
-
}
|
|
3161
|
-
isSetupForEditing = true;
|
|
3162
|
-
if (isBrowser()) {
|
|
3163
|
-
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
3164
|
-
type: "builder.sdkInfo",
|
|
3165
|
-
data: {
|
|
3166
|
-
target: TARGET,
|
|
3167
|
-
version: SDK_VERSION,
|
|
3168
|
-
supportsPatchUpdates: false,
|
|
3169
|
-
supportsAddBlockScoping: true,
|
|
3170
|
-
supportsCustomBreakpoints: true
|
|
3171
|
-
}
|
|
3172
|
-
}, "*");
|
|
3173
|
-
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
3174
|
-
type: "builder.updateContent",
|
|
3175
|
-
data: {
|
|
3176
|
-
options
|
|
3177
|
-
}
|
|
3178
|
-
}, "*");
|
|
3179
|
-
window.addEventListener("message", ({
|
|
3180
|
-
data
|
|
3181
|
-
}) => {
|
|
3182
|
-
var _a2, _b2;
|
|
3183
|
-
if (!(data == null ? void 0 : data.type)) {
|
|
3184
|
-
return;
|
|
3185
|
-
}
|
|
3186
|
-
switch (data.type) {
|
|
3187
|
-
case "builder.evaluate": {
|
|
3188
|
-
const text = data.data.text;
|
|
3189
|
-
const args = data.data.arguments || [];
|
|
3190
|
-
const id = data.data.id;
|
|
3191
|
-
const fn = new Function(text);
|
|
3192
|
-
let result;
|
|
3193
|
-
let error = null;
|
|
3194
|
-
try {
|
|
3195
|
-
result = fn.apply(null, args);
|
|
3196
|
-
} catch (err) {
|
|
3197
|
-
error = err;
|
|
3198
|
-
}
|
|
3199
|
-
if (error) {
|
|
3200
|
-
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
3201
|
-
type: "builder.evaluateError",
|
|
3202
|
-
data: {
|
|
3203
|
-
id,
|
|
3204
|
-
error: error.message
|
|
3205
|
-
}
|
|
3206
|
-
}, "*");
|
|
3207
|
-
} else {
|
|
3208
|
-
if (result && typeof result.then === "function") {
|
|
3209
|
-
result.then((finalResult) => {
|
|
3210
|
-
var _a3;
|
|
3211
|
-
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
3212
|
-
type: "builder.evaluateResult",
|
|
3213
|
-
data: {
|
|
3214
|
-
id,
|
|
3215
|
-
result: finalResult
|
|
3216
|
-
}
|
|
3217
|
-
}, "*");
|
|
3218
|
-
}).catch(console.error);
|
|
3219
|
-
} else {
|
|
3220
|
-
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
3221
|
-
type: "builder.evaluateResult",
|
|
3222
|
-
data: {
|
|
3223
|
-
result,
|
|
3224
|
-
id
|
|
3225
|
-
}
|
|
3226
|
-
}, "*");
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
break;
|
|
3230
|
-
}
|
|
2495
|
+
let n = 0;
|
|
2496
|
+
const random = Math.random();
|
|
2497
|
+
for (let i = 0; i < variants.length; i++) {
|
|
2498
|
+
const variant = variants[i];
|
|
2499
|
+
const testRatio = variant.testRatio;
|
|
2500
|
+
n += testRatio;
|
|
2501
|
+
if (random < n) {
|
|
2502
|
+
setCookie2(cookieName, variant.id);
|
|
2503
|
+
return variant.id;
|
|
3231
2504
|
}
|
|
3232
|
-
}
|
|
2505
|
+
}
|
|
2506
|
+
setCookie2(cookieName, contentId);
|
|
2507
|
+
return contentId;
|
|
2508
|
+
}
|
|
2509
|
+
const winningVariantId = getAndSetVariantId2();
|
|
2510
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
2511
|
+
if (isHydrationTarget2) {
|
|
2512
|
+
styleEl.remove();
|
|
2513
|
+
const thisScriptEl = document.currentScript;
|
|
2514
|
+
thisScriptEl?.remove();
|
|
2515
|
+
} else {
|
|
2516
|
+
const newStyleStr = variants.concat({
|
|
2517
|
+
id: contentId
|
|
2518
|
+
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2519
|
+
return `.variant-${value.id} { display: none; }
|
|
2520
|
+
`;
|
|
2521
|
+
}).join("");
|
|
2522
|
+
styleEl.innerHTML = newStyleStr;
|
|
3233
2523
|
}
|
|
3234
|
-
};
|
|
3235
|
-
|
|
3236
|
-
// src/functions/track/interaction.js
|
|
3237
|
-
function round(num) {
|
|
3238
|
-
return Math.round(num * 1e3) / 1e3;
|
|
3239
2524
|
}
|
|
3240
|
-
|
|
3241
|
-
if (!
|
|
3242
|
-
return
|
|
2525
|
+
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2526
|
+
if (!navigator.cookieEnabled) {
|
|
2527
|
+
return;
|
|
3243
2528
|
}
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
} while (parent2 = parent2.parentElement);
|
|
3254
|
-
return null;
|
|
3255
|
-
};
|
|
3256
|
-
var findBuilderParent = (target) => findParentElement(target, (el) => {
|
|
3257
|
-
const id = el.getAttribute("builder-id") || el.id;
|
|
3258
|
-
return Boolean((id == null ? void 0 : id.indexOf("builder-")) === 0);
|
|
3259
|
-
});
|
|
3260
|
-
var computeOffset = ({
|
|
3261
|
-
event,
|
|
3262
|
-
target
|
|
3263
|
-
}) => {
|
|
3264
|
-
const targetRect = target.getBoundingClientRect();
|
|
3265
|
-
const xOffset = event.clientX - targetRect.left;
|
|
3266
|
-
const yOffset = event.clientY - targetRect.top;
|
|
3267
|
-
const xRatio = round(xOffset / targetRect.width);
|
|
3268
|
-
const yRatio = round(yOffset / targetRect.height);
|
|
3269
|
-
return {
|
|
3270
|
-
x: xRatio,
|
|
3271
|
-
y: yRatio
|
|
3272
|
-
};
|
|
3273
|
-
};
|
|
3274
|
-
var getInteractionPropertiesForEvent = (event) => {
|
|
3275
|
-
const target = event.target;
|
|
3276
|
-
const targetBuilderElement = target && findBuilderParent(target);
|
|
3277
|
-
const builderId = (targetBuilderElement == null ? void 0 : targetBuilderElement.getAttribute("builder-id")) || (targetBuilderElement == null ? void 0 : targetBuilderElement.id);
|
|
3278
|
-
return {
|
|
3279
|
-
targetBuilderElement: builderId || void 0,
|
|
3280
|
-
metadata: {
|
|
3281
|
-
targetOffset: target ? computeOffset({
|
|
3282
|
-
event,
|
|
3283
|
-
target
|
|
3284
|
-
}) : void 0,
|
|
3285
|
-
builderTargetOffset: targetBuilderElement ? computeOffset({
|
|
3286
|
-
event,
|
|
3287
|
-
target: targetBuilderElement
|
|
3288
|
-
}) : void 0,
|
|
3289
|
-
builderElementIndex: targetBuilderElement && builderId ? [].slice.call(document.getElementsByClassName(builderId)).indexOf(targetBuilderElement) : void 0
|
|
2529
|
+
function getCookie2(name) {
|
|
2530
|
+
const nameEQ = name + "=";
|
|
2531
|
+
const ca = document.cookie.split(";");
|
|
2532
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2533
|
+
let c = ca[i];
|
|
2534
|
+
while (c.charAt(0) === " ")
|
|
2535
|
+
c = c.substring(1, c.length);
|
|
2536
|
+
if (c.indexOf(nameEQ) === 0)
|
|
2537
|
+
return c.substring(nameEQ.length, c.length);
|
|
3290
2538
|
}
|
|
3291
|
-
|
|
3292
|
-
}
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
enumerable: true,
|
|
3301
|
-
configurable: true,
|
|
3302
|
-
writable: true,
|
|
3303
|
-
value
|
|
3304
|
-
}) : obj[key] = value;
|
|
3305
|
-
var __spreadValues13 = (a, b) => {
|
|
3306
|
-
for (var prop in b || (b = {}))
|
|
3307
|
-
if (__hasOwnProp13.call(b, prop))
|
|
3308
|
-
__defNormalProp13(a, prop, b[prop]);
|
|
3309
|
-
if (__getOwnPropSymbols13)
|
|
3310
|
-
for (var prop of __getOwnPropSymbols13(b)) {
|
|
3311
|
-
if (__propIsEnum13.call(b, prop))
|
|
3312
|
-
__defNormalProp13(a, prop, b[prop]);
|
|
2539
|
+
return null;
|
|
2540
|
+
}
|
|
2541
|
+
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2542
|
+
const variantId = getCookie2(cookieName);
|
|
2543
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
2544
|
+
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2545
|
+
if (variantId === variantContentId) {
|
|
2546
|
+
if (variantIsDefaultContent) {
|
|
2547
|
+
return;
|
|
3313
2548
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
}
|
|
3324
|
-
};
|
|
3325
|
-
var rejected = (value) => {
|
|
3326
|
-
try {
|
|
3327
|
-
step(generator.throw(value));
|
|
3328
|
-
} catch (e) {
|
|
3329
|
-
reject(e);
|
|
2549
|
+
parentDiv?.removeAttribute("hidden");
|
|
2550
|
+
parentDiv?.removeAttribute("aria-hidden");
|
|
2551
|
+
} else {
|
|
2552
|
+
if (variantIsDefaultContent) {
|
|
2553
|
+
if (isHydrationTarget2) {
|
|
2554
|
+
parentDiv?.remove();
|
|
2555
|
+
} else {
|
|
2556
|
+
parentDiv?.setAttribute("hidden", "true");
|
|
2557
|
+
parentDiv?.setAttribute("aria-hidden", "true");
|
|
3330
2558
|
}
|
|
3331
|
-
};
|
|
3332
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3333
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3334
|
-
});
|
|
3335
|
-
};
|
|
3336
|
-
var BUILDER_STORE_PREFIX = "builder.tests";
|
|
3337
|
-
var getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
3338
|
-
var getContentVariationCookie = ({
|
|
3339
|
-
contentId
|
|
3340
|
-
}) => getCookie({
|
|
3341
|
-
name: getContentTestKey(contentId),
|
|
3342
|
-
canTrack: true
|
|
3343
|
-
});
|
|
3344
|
-
var getContentVariationCookieSync = ({
|
|
3345
|
-
contentId
|
|
3346
|
-
}) => getCookieSync({
|
|
3347
|
-
name: getContentTestKey(contentId),
|
|
3348
|
-
canTrack: true
|
|
3349
|
-
});
|
|
3350
|
-
var setContentVariationCookie = ({
|
|
3351
|
-
contentId,
|
|
3352
|
-
value
|
|
3353
|
-
}) => setCookie({
|
|
3354
|
-
name: getContentTestKey(contentId),
|
|
3355
|
-
value,
|
|
3356
|
-
canTrack: true
|
|
3357
|
-
});
|
|
3358
|
-
var checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
3359
|
-
var getRandomVariationId = ({
|
|
3360
|
-
id,
|
|
3361
|
-
variations
|
|
3362
|
-
}) => {
|
|
3363
|
-
var _a;
|
|
3364
|
-
let n = 0;
|
|
3365
|
-
const random = Math.random();
|
|
3366
|
-
for (const id2 in variations) {
|
|
3367
|
-
const testRatio = (_a = variations[id2]) == null ? void 0 : _a.testRatio;
|
|
3368
|
-
n += testRatio;
|
|
3369
|
-
if (random < n) {
|
|
3370
|
-
return id2;
|
|
3371
2559
|
}
|
|
2560
|
+
return;
|
|
3372
2561
|
}
|
|
3373
|
-
return
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2565
|
+
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2566
|
+
var AB_TEST_FN_NAME = "builderIoAbTest";
|
|
2567
|
+
var CONTENT_FN_NAME = "builderIoRenderContent";
|
|
2568
|
+
var getScriptString = () => {
|
|
2569
|
+
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2570
|
+
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2571
|
+
return `
|
|
2572
|
+
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2573
|
+
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2574
|
+
`;
|
|
3374
2575
|
};
|
|
3375
|
-
var
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
contentId: args.id,
|
|
3379
|
-
value: randomVariationId
|
|
3380
|
-
}).catch((err) => {
|
|
3381
|
-
logger.error("could not store A/B test variation: ", err);
|
|
3382
|
-
});
|
|
3383
|
-
return randomVariationId;
|
|
2576
|
+
var getVariantsScriptString = (variants, contentId) => {
|
|
2577
|
+
return `
|
|
2578
|
+
window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
|
|
3384
2579
|
};
|
|
3385
|
-
var
|
|
3386
|
-
|
|
3387
|
-
|
|
2580
|
+
var getRenderContentScriptString = ({
|
|
2581
|
+
contentId,
|
|
2582
|
+
variationId
|
|
3388
2583
|
}) => {
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
return {
|
|
3392
|
-
testVariationId: item.id,
|
|
3393
|
-
testVariationName: "Default"
|
|
3394
|
-
};
|
|
3395
|
-
} else {
|
|
3396
|
-
return {
|
|
3397
|
-
data: variationValue.data,
|
|
3398
|
-
testVariationId: variationValue.id,
|
|
3399
|
-
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
3400
|
-
};
|
|
3401
|
-
}
|
|
2584
|
+
return `
|
|
2585
|
+
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
3402
2586
|
};
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
2587
|
+
|
|
2588
|
+
// src/components/inlined-script.tsx
|
|
2589
|
+
function InlinedScript(props) {
|
|
2590
|
+
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2591
|
+
}
|
|
2592
|
+
var Inlined_script_default = InlinedScript;
|
|
2593
|
+
|
|
2594
|
+
// src/components/content/components/enable-editor.tsx
|
|
2595
|
+
import { Show as Show9, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal9 } from "solid-js";
|
|
2596
|
+
|
|
2597
|
+
// src/helpers/preview-lru-cache/get.ts
|
|
2598
|
+
function getPreviewContent(_searchParams) {
|
|
2599
|
+
return void 0;
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
// src/functions/get-global-this.ts
|
|
2603
|
+
function getGlobalThis() {
|
|
2604
|
+
if (typeof globalThis !== "undefined") {
|
|
2605
|
+
return globalThis;
|
|
3414
2606
|
}
|
|
3415
|
-
if (
|
|
3416
|
-
return
|
|
2607
|
+
if (typeof window !== "undefined") {
|
|
2608
|
+
return window;
|
|
3417
2609
|
}
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
}) || getAndSetVariantId({
|
|
3421
|
-
variations: item.variations,
|
|
3422
|
-
id: item.id
|
|
3423
|
-
});
|
|
3424
|
-
const variationValue = getTestFields({
|
|
3425
|
-
item,
|
|
3426
|
-
testGroupId
|
|
3427
|
-
});
|
|
3428
|
-
return __spreadValues13(__spreadValues13({}, item), variationValue);
|
|
3429
|
-
};
|
|
3430
|
-
var handleABTesting = (_0) => __async4(void 0, [_0], function* ({
|
|
3431
|
-
item,
|
|
3432
|
-
canTrack
|
|
3433
|
-
}) {
|
|
3434
|
-
if (!canTrack) {
|
|
3435
|
-
return item;
|
|
2610
|
+
if (typeof global !== "undefined") {
|
|
2611
|
+
return global;
|
|
3436
2612
|
}
|
|
3437
|
-
if (
|
|
3438
|
-
return
|
|
2613
|
+
if (typeof self !== "undefined") {
|
|
2614
|
+
return self;
|
|
3439
2615
|
}
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
});
|
|
3443
|
-
const testGroupId = cookieValue || getAndSetVariantId({
|
|
3444
|
-
variations: item.variations,
|
|
3445
|
-
id: item.id
|
|
3446
|
-
});
|
|
3447
|
-
const variationValue = getTestFields({
|
|
3448
|
-
item,
|
|
3449
|
-
testGroupId
|
|
3450
|
-
});
|
|
3451
|
-
return __spreadValues13(__spreadValues13({}, item), variationValue);
|
|
3452
|
-
});
|
|
3453
|
-
|
|
3454
|
-
// src/helpers/canTrack.js
|
|
3455
|
-
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2616
|
+
return globalThis;
|
|
2617
|
+
}
|
|
3456
2618
|
|
|
3457
|
-
// src/
|
|
3458
|
-
function
|
|
3459
|
-
|
|
2619
|
+
// src/functions/get-fetch.ts
|
|
2620
|
+
function getFetch() {
|
|
2621
|
+
const globalFetch = getGlobalThis().fetch;
|
|
2622
|
+
if (typeof globalFetch === "undefined") {
|
|
2623
|
+
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
2624
|
+
}
|
|
2625
|
+
return globalFetch;
|
|
3460
2626
|
}
|
|
2627
|
+
var fetch2 = getFetch();
|
|
3461
2628
|
|
|
3462
|
-
// src/helpers/flatten.
|
|
3463
|
-
var __defProp14 = Object.defineProperty;
|
|
3464
|
-
var __defProps10 = Object.defineProperties;
|
|
3465
|
-
var __getOwnPropDescs10 = Object.getOwnPropertyDescriptors;
|
|
3466
|
-
var __getOwnPropSymbols14 = Object.getOwnPropertySymbols;
|
|
3467
|
-
var __hasOwnProp14 = Object.prototype.hasOwnProperty;
|
|
3468
|
-
var __propIsEnum14 = Object.prototype.propertyIsEnumerable;
|
|
3469
|
-
var __defNormalProp14 = (obj, key, value) => key in obj ? __defProp14(obj, key, {
|
|
3470
|
-
enumerable: true,
|
|
3471
|
-
configurable: true,
|
|
3472
|
-
writable: true,
|
|
3473
|
-
value
|
|
3474
|
-
}) : obj[key] = value;
|
|
3475
|
-
var __spreadValues14 = (a, b) => {
|
|
3476
|
-
for (var prop in b || (b = {}))
|
|
3477
|
-
if (__hasOwnProp14.call(b, prop))
|
|
3478
|
-
__defNormalProp14(a, prop, b[prop]);
|
|
3479
|
-
if (__getOwnPropSymbols14)
|
|
3480
|
-
for (var prop of __getOwnPropSymbols14(b)) {
|
|
3481
|
-
if (__propIsEnum14.call(b, prop))
|
|
3482
|
-
__defNormalProp14(a, prop, b[prop]);
|
|
3483
|
-
}
|
|
3484
|
-
return a;
|
|
3485
|
-
};
|
|
3486
|
-
var __spreadProps10 = (a, b) => __defProps10(a, __getOwnPropDescs10(b));
|
|
2629
|
+
// src/helpers/flatten.ts
|
|
3487
2630
|
function flatten(object, path = null, separator = ".") {
|
|
3488
2631
|
return Object.keys(object).reduce((acc, key) => {
|
|
3489
2632
|
const value = object[key];
|
|
3490
2633
|
const newPath = [path, key].filter(Boolean).join(separator);
|
|
3491
2634
|
const isObject = [typeof value === "object", value !== null, !(Array.isArray(value) && value.length === 0)].every(Boolean);
|
|
3492
|
-
return isObject ?
|
|
2635
|
+
return isObject ? {
|
|
2636
|
+
...acc,
|
|
2637
|
+
...flatten(value, newPath, separator)
|
|
2638
|
+
} : {
|
|
2639
|
+
...acc,
|
|
3493
2640
|
[newPath]: value
|
|
3494
|
-
}
|
|
2641
|
+
};
|
|
3495
2642
|
}, {});
|
|
3496
2643
|
}
|
|
3497
2644
|
|
|
3498
|
-
// src/
|
|
2645
|
+
// src/types/api-version.ts
|
|
2646
|
+
var DEFAULT_API_VERSION = "v3";
|
|
2647
|
+
|
|
2648
|
+
// src/functions/get-builder-search-params/index.ts
|
|
3499
2649
|
var BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
3500
2650
|
var BUILDER_OPTIONS_PREFIX = "options.";
|
|
3501
2651
|
var convertSearchParamsToQueryObject = (searchParams) => {
|
|
@@ -3528,31 +2678,7 @@ var getBuilderSearchParamsFromWindow = () => {
|
|
|
3528
2678
|
};
|
|
3529
2679
|
var normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
3530
2680
|
|
|
3531
|
-
// src/
|
|
3532
|
-
var DEFAULT_API_VERSION = "v3";
|
|
3533
|
-
|
|
3534
|
-
// src/functions/get-content/generate-content-url.js
|
|
3535
|
-
var __defProp15 = Object.defineProperty;
|
|
3536
|
-
var __getOwnPropSymbols15 = Object.getOwnPropertySymbols;
|
|
3537
|
-
var __hasOwnProp15 = Object.prototype.hasOwnProperty;
|
|
3538
|
-
var __propIsEnum15 = Object.prototype.propertyIsEnumerable;
|
|
3539
|
-
var __defNormalProp15 = (obj, key, value) => key in obj ? __defProp15(obj, key, {
|
|
3540
|
-
enumerable: true,
|
|
3541
|
-
configurable: true,
|
|
3542
|
-
writable: true,
|
|
3543
|
-
value
|
|
3544
|
-
}) : obj[key] = value;
|
|
3545
|
-
var __spreadValues15 = (a, b) => {
|
|
3546
|
-
for (var prop in b || (b = {}))
|
|
3547
|
-
if (__hasOwnProp15.call(b, prop))
|
|
3548
|
-
__defNormalProp15(a, prop, b[prop]);
|
|
3549
|
-
if (__getOwnPropSymbols15)
|
|
3550
|
-
for (var prop of __getOwnPropSymbols15(b)) {
|
|
3551
|
-
if (__propIsEnum15.call(b, prop))
|
|
3552
|
-
__defNormalProp15(a, prop, b[prop]);
|
|
3553
|
-
}
|
|
3554
|
-
return a;
|
|
3555
|
-
};
|
|
2681
|
+
// src/functions/get-content/generate-content-url.ts
|
|
3556
2682
|
var isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
3557
2683
|
var generateContentUrl = (options) => {
|
|
3558
2684
|
let {
|
|
@@ -3610,7 +2736,10 @@ var generateContentUrl = (options) => {
|
|
|
3610
2736
|
url.searchParams.set(key, JSON.stringify(flattened2[key]));
|
|
3611
2737
|
}
|
|
3612
2738
|
}
|
|
3613
|
-
const queryOptions =
|
|
2739
|
+
const queryOptions = {
|
|
2740
|
+
...getBuilderSearchParamsFromWindow(),
|
|
2741
|
+
...normalizeSearchParams(options.options || {})
|
|
2742
|
+
};
|
|
3614
2743
|
const flattened = flatten(queryOptions);
|
|
3615
2744
|
for (const key in flattened) {
|
|
3616
2745
|
url.searchParams.set(key, String(flattened[key]));
|
|
@@ -3629,71 +2758,26 @@ var generateContentUrl = (options) => {
|
|
|
3629
2758
|
return url;
|
|
3630
2759
|
};
|
|
3631
2760
|
|
|
3632
|
-
// src/functions/get-content/index.
|
|
3633
|
-
var __defProp16 = Object.defineProperty;
|
|
3634
|
-
var __defProps11 = Object.defineProperties;
|
|
3635
|
-
var __getOwnPropDescs11 = Object.getOwnPropertyDescriptors;
|
|
3636
|
-
var __getOwnPropSymbols16 = Object.getOwnPropertySymbols;
|
|
3637
|
-
var __hasOwnProp16 = Object.prototype.hasOwnProperty;
|
|
3638
|
-
var __propIsEnum16 = Object.prototype.propertyIsEnumerable;
|
|
3639
|
-
var __defNormalProp16 = (obj, key, value) => key in obj ? __defProp16(obj, key, {
|
|
3640
|
-
enumerable: true,
|
|
3641
|
-
configurable: true,
|
|
3642
|
-
writable: true,
|
|
3643
|
-
value
|
|
3644
|
-
}) : obj[key] = value;
|
|
3645
|
-
var __spreadValues16 = (a, b) => {
|
|
3646
|
-
for (var prop in b || (b = {}))
|
|
3647
|
-
if (__hasOwnProp16.call(b, prop))
|
|
3648
|
-
__defNormalProp16(a, prop, b[prop]);
|
|
3649
|
-
if (__getOwnPropSymbols16)
|
|
3650
|
-
for (var prop of __getOwnPropSymbols16(b)) {
|
|
3651
|
-
if (__propIsEnum16.call(b, prop))
|
|
3652
|
-
__defNormalProp16(a, prop, b[prop]);
|
|
3653
|
-
}
|
|
3654
|
-
return a;
|
|
3655
|
-
};
|
|
3656
|
-
var __spreadProps11 = (a, b) => __defProps11(a, __getOwnPropDescs11(b));
|
|
3657
|
-
var __async5 = (__this, __arguments, generator) => {
|
|
3658
|
-
return new Promise((resolve, reject) => {
|
|
3659
|
-
var fulfilled = (value) => {
|
|
3660
|
-
try {
|
|
3661
|
-
step(generator.next(value));
|
|
3662
|
-
} catch (e) {
|
|
3663
|
-
reject(e);
|
|
3664
|
-
}
|
|
3665
|
-
};
|
|
3666
|
-
var rejected = (value) => {
|
|
3667
|
-
try {
|
|
3668
|
-
step(generator.throw(value));
|
|
3669
|
-
} catch (e) {
|
|
3670
|
-
reject(e);
|
|
3671
|
-
}
|
|
3672
|
-
};
|
|
3673
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3674
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3675
|
-
});
|
|
3676
|
-
};
|
|
2761
|
+
// src/functions/get-content/index.ts
|
|
3677
2762
|
var checkContentHasResults = (content) => "results" in content;
|
|
3678
|
-
function fetchOneEntry(options) {
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
}));
|
|
3683
|
-
if (allContent) {
|
|
3684
|
-
return allContent.results[0] || null;
|
|
3685
|
-
}
|
|
3686
|
-
return null;
|
|
2763
|
+
async function fetchOneEntry(options) {
|
|
2764
|
+
const allContent = await fetchEntries({
|
|
2765
|
+
...options,
|
|
2766
|
+
limit: 1
|
|
3687
2767
|
});
|
|
2768
|
+
if (allContent) {
|
|
2769
|
+
return allContent.results[0] || null;
|
|
2770
|
+
}
|
|
2771
|
+
return null;
|
|
3688
2772
|
}
|
|
3689
2773
|
var getContent = fetchOneEntry;
|
|
3690
|
-
var _fetchContent = (options) =>
|
|
2774
|
+
var _fetchContent = async (options) => {
|
|
3691
2775
|
const url = generateContentUrl(options);
|
|
3692
|
-
const res =
|
|
3693
|
-
const content =
|
|
2776
|
+
const res = await fetch2(url.href);
|
|
2777
|
+
const content = await res.json();
|
|
3694
2778
|
return content;
|
|
3695
|
-
}
|
|
3696
|
-
var _processContentResult =
|
|
2779
|
+
};
|
|
2780
|
+
var _processContentResult = async (options, content, url = generateContentUrl(options)) => {
|
|
3697
2781
|
const canTrack = getDefaultCanTrack(options.canTrack);
|
|
3698
2782
|
const isPreviewing2 = url.search.includes(`preview=`);
|
|
3699
2783
|
if (TARGET === "rsc" && isPreviewing2) {
|
|
@@ -3711,7 +2795,7 @@ var _processContentResult = (_0, _1, ..._2) => __async5(void 0, [_0, _1, ..._2],
|
|
|
3711
2795
|
try {
|
|
3712
2796
|
const newResults = [];
|
|
3713
2797
|
for (const item of content.results) {
|
|
3714
|
-
newResults.push(
|
|
2798
|
+
newResults.push(await handleABTesting({
|
|
3715
2799
|
item,
|
|
3716
2800
|
canTrack
|
|
3717
2801
|
}));
|
|
@@ -3720,48 +2804,415 @@ var _processContentResult = (_0, _1, ..._2) => __async5(void 0, [_0, _1, ..._2],
|
|
|
3720
2804
|
} catch (e) {
|
|
3721
2805
|
logger.error("Could not process A/B tests. ", e);
|
|
3722
2806
|
}
|
|
3723
|
-
return content;
|
|
3724
|
-
}
|
|
3725
|
-
function fetchEntries(options) {
|
|
3726
|
-
|
|
2807
|
+
return content;
|
|
2808
|
+
};
|
|
2809
|
+
async function fetchEntries(options) {
|
|
2810
|
+
try {
|
|
2811
|
+
const url = generateContentUrl(options);
|
|
2812
|
+
const content = await _fetchContent(options);
|
|
2813
|
+
if (!checkContentHasResults(content)) {
|
|
2814
|
+
logger.error("Error fetching data. ", {
|
|
2815
|
+
url,
|
|
2816
|
+
content,
|
|
2817
|
+
options
|
|
2818
|
+
});
|
|
2819
|
+
return null;
|
|
2820
|
+
}
|
|
2821
|
+
return _processContentResult(options, content);
|
|
2822
|
+
} catch (error) {
|
|
2823
|
+
logger.error("Error fetching data. ", error);
|
|
2824
|
+
return null;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
var getAllContent = fetchEntries;
|
|
2828
|
+
|
|
2829
|
+
// src/functions/is-previewing.ts
|
|
2830
|
+
function isPreviewing() {
|
|
2831
|
+
if (!isBrowser()) {
|
|
2832
|
+
return false;
|
|
2833
|
+
}
|
|
2834
|
+
if (isEditing()) {
|
|
2835
|
+
return false;
|
|
2836
|
+
}
|
|
2837
|
+
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
// src/helpers/uuid.ts
|
|
2841
|
+
function uuidv4() {
|
|
2842
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
2843
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
2844
|
+
return v.toString(16);
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
function uuid() {
|
|
2848
|
+
return uuidv4().replace(/-/g, "");
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
// src/helpers/sessionId.ts
|
|
2852
|
+
var SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
2853
|
+
var getSessionId = async ({
|
|
2854
|
+
canTrack
|
|
2855
|
+
}) => {
|
|
2856
|
+
if (!canTrack) {
|
|
2857
|
+
return void 0;
|
|
2858
|
+
}
|
|
2859
|
+
const sessionId = await getCookie({
|
|
2860
|
+
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2861
|
+
canTrack
|
|
2862
|
+
});
|
|
2863
|
+
if (checkIsDefined(sessionId)) {
|
|
2864
|
+
return sessionId;
|
|
2865
|
+
} else {
|
|
2866
|
+
const newSessionId = createSessionId();
|
|
2867
|
+
setSessionId({
|
|
2868
|
+
id: newSessionId,
|
|
2869
|
+
canTrack
|
|
2870
|
+
});
|
|
2871
|
+
return newSessionId;
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
var createSessionId = () => uuid();
|
|
2875
|
+
var setSessionId = ({
|
|
2876
|
+
id,
|
|
2877
|
+
canTrack
|
|
2878
|
+
}) => setCookie({
|
|
2879
|
+
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2880
|
+
value: id,
|
|
2881
|
+
canTrack
|
|
2882
|
+
});
|
|
2883
|
+
|
|
2884
|
+
// src/helpers/localStorage.ts
|
|
2885
|
+
var getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
2886
|
+
var getLocalStorageItem = ({
|
|
2887
|
+
key,
|
|
2888
|
+
canTrack
|
|
2889
|
+
}) => {
|
|
2890
|
+
try {
|
|
2891
|
+
if (canTrack) {
|
|
2892
|
+
return getLocalStorage()?.getItem(key);
|
|
2893
|
+
}
|
|
2894
|
+
return void 0;
|
|
2895
|
+
} catch (err) {
|
|
2896
|
+
return void 0;
|
|
2897
|
+
}
|
|
2898
|
+
};
|
|
2899
|
+
var setLocalStorageItem = ({
|
|
2900
|
+
key,
|
|
2901
|
+
canTrack,
|
|
2902
|
+
value
|
|
2903
|
+
}) => {
|
|
2904
|
+
try {
|
|
2905
|
+
if (canTrack) {
|
|
2906
|
+
getLocalStorage()?.setItem(key, value);
|
|
2907
|
+
}
|
|
2908
|
+
} catch (err) {
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
|
|
2912
|
+
// src/helpers/visitorId.ts
|
|
2913
|
+
var VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
2914
|
+
var getVisitorId = ({
|
|
2915
|
+
canTrack
|
|
2916
|
+
}) => {
|
|
2917
|
+
if (!canTrack) {
|
|
2918
|
+
return void 0;
|
|
2919
|
+
}
|
|
2920
|
+
const visitorId = getLocalStorageItem({
|
|
2921
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2922
|
+
canTrack
|
|
2923
|
+
});
|
|
2924
|
+
if (checkIsDefined(visitorId)) {
|
|
2925
|
+
return visitorId;
|
|
2926
|
+
} else {
|
|
2927
|
+
const newVisitorId = createVisitorId();
|
|
2928
|
+
setVisitorId({
|
|
2929
|
+
id: newVisitorId,
|
|
2930
|
+
canTrack
|
|
2931
|
+
});
|
|
2932
|
+
return newVisitorId;
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
var createVisitorId = () => uuid();
|
|
2936
|
+
var setVisitorId = ({
|
|
2937
|
+
id,
|
|
2938
|
+
canTrack
|
|
2939
|
+
}) => setLocalStorageItem({
|
|
2940
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2941
|
+
value: id,
|
|
2942
|
+
canTrack
|
|
2943
|
+
});
|
|
2944
|
+
|
|
2945
|
+
// src/functions/track/index.ts
|
|
2946
|
+
var getTrackingEventData = async ({
|
|
2947
|
+
canTrack
|
|
2948
|
+
}) => {
|
|
2949
|
+
if (!canTrack) {
|
|
2950
|
+
return {
|
|
2951
|
+
visitorId: void 0,
|
|
2952
|
+
sessionId: void 0
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
const sessionId = await getSessionId({
|
|
2956
|
+
canTrack
|
|
2957
|
+
});
|
|
2958
|
+
const visitorId = getVisitorId({
|
|
2959
|
+
canTrack
|
|
2960
|
+
});
|
|
2961
|
+
return {
|
|
2962
|
+
sessionId,
|
|
2963
|
+
visitorId
|
|
2964
|
+
};
|
|
2965
|
+
};
|
|
2966
|
+
var createEvent = async ({
|
|
2967
|
+
type: eventType,
|
|
2968
|
+
canTrack,
|
|
2969
|
+
apiKey,
|
|
2970
|
+
metadata,
|
|
2971
|
+
...properties
|
|
2972
|
+
}) => ({
|
|
2973
|
+
type: eventType,
|
|
2974
|
+
data: {
|
|
2975
|
+
...properties,
|
|
2976
|
+
metadata: {
|
|
2977
|
+
url: location.href,
|
|
2978
|
+
...metadata
|
|
2979
|
+
},
|
|
2980
|
+
...await getTrackingEventData({
|
|
2981
|
+
canTrack
|
|
2982
|
+
}),
|
|
2983
|
+
userAttributes: getUserAttributes(),
|
|
2984
|
+
ownerId: apiKey
|
|
2985
|
+
}
|
|
2986
|
+
});
|
|
2987
|
+
async function _track(eventProps) {
|
|
2988
|
+
if (!eventProps.apiKey) {
|
|
2989
|
+
logger.error("Missing API key for track call. Please provide your API key.");
|
|
2990
|
+
return;
|
|
2991
|
+
}
|
|
2992
|
+
if (!eventProps.canTrack) {
|
|
2993
|
+
return;
|
|
2994
|
+
}
|
|
2995
|
+
if (isEditing()) {
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
return fetch(`https://cdn.builder.io/api/v1/track`, {
|
|
3002
|
+
method: "POST",
|
|
3003
|
+
body: JSON.stringify({
|
|
3004
|
+
events: [await createEvent(eventProps)]
|
|
3005
|
+
}),
|
|
3006
|
+
headers: {
|
|
3007
|
+
"content-type": "application/json"
|
|
3008
|
+
},
|
|
3009
|
+
mode: "cors"
|
|
3010
|
+
}).catch((err) => {
|
|
3011
|
+
});
|
|
3012
|
+
}
|
|
3013
|
+
var track = (args) => _track({
|
|
3014
|
+
...args,
|
|
3015
|
+
canTrack: true
|
|
3016
|
+
});
|
|
3017
|
+
|
|
3018
|
+
// src/functions/track/interaction.ts
|
|
3019
|
+
function round(num) {
|
|
3020
|
+
return Math.round(num * 1e3) / 1e3;
|
|
3021
|
+
}
|
|
3022
|
+
var findParentElement = (target, callback, checkElement = true) => {
|
|
3023
|
+
if (!(target instanceof HTMLElement)) {
|
|
3024
|
+
return null;
|
|
3025
|
+
}
|
|
3026
|
+
let parent2 = checkElement ? target : target.parentElement;
|
|
3027
|
+
do {
|
|
3028
|
+
if (!parent2) {
|
|
3029
|
+
return null;
|
|
3030
|
+
}
|
|
3031
|
+
const matches = callback(parent2);
|
|
3032
|
+
if (matches) {
|
|
3033
|
+
return parent2;
|
|
3034
|
+
}
|
|
3035
|
+
} while (parent2 = parent2.parentElement);
|
|
3036
|
+
return null;
|
|
3037
|
+
};
|
|
3038
|
+
var findBuilderParent = (target) => findParentElement(target, (el) => {
|
|
3039
|
+
const id = el.getAttribute("builder-id") || el.id;
|
|
3040
|
+
return Boolean(id?.indexOf("builder-") === 0);
|
|
3041
|
+
});
|
|
3042
|
+
var computeOffset = ({
|
|
3043
|
+
event,
|
|
3044
|
+
target
|
|
3045
|
+
}) => {
|
|
3046
|
+
const targetRect = target.getBoundingClientRect();
|
|
3047
|
+
const xOffset = event.clientX - targetRect.left;
|
|
3048
|
+
const yOffset = event.clientY - targetRect.top;
|
|
3049
|
+
const xRatio = round(xOffset / targetRect.width);
|
|
3050
|
+
const yRatio = round(yOffset / targetRect.height);
|
|
3051
|
+
return {
|
|
3052
|
+
x: xRatio,
|
|
3053
|
+
y: yRatio
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3056
|
+
var getInteractionPropertiesForEvent = (event) => {
|
|
3057
|
+
const target = event.target;
|
|
3058
|
+
const targetBuilderElement = target && findBuilderParent(target);
|
|
3059
|
+
const builderId = targetBuilderElement?.getAttribute("builder-id") || targetBuilderElement?.id;
|
|
3060
|
+
return {
|
|
3061
|
+
targetBuilderElement: builderId || void 0,
|
|
3062
|
+
metadata: {
|
|
3063
|
+
targetOffset: target ? computeOffset({
|
|
3064
|
+
event,
|
|
3065
|
+
target
|
|
3066
|
+
}) : void 0,
|
|
3067
|
+
builderTargetOffset: targetBuilderElement ? computeOffset({
|
|
3068
|
+
event,
|
|
3069
|
+
target: targetBuilderElement
|
|
3070
|
+
}) : void 0,
|
|
3071
|
+
builderElementIndex: targetBuilderElement && builderId ? [].slice.call(document.getElementsByClassName(builderId)).indexOf(targetBuilderElement) : void 0
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
};
|
|
3075
|
+
|
|
3076
|
+
// src/constants/sdk-version.ts
|
|
3077
|
+
var SDK_VERSION = "0.7.2";
|
|
3078
|
+
|
|
3079
|
+
// src/functions/register.ts
|
|
3080
|
+
var registry = {};
|
|
3081
|
+
function register(type, info) {
|
|
3082
|
+
let typeList = registry[type];
|
|
3083
|
+
if (!typeList) {
|
|
3084
|
+
typeList = registry[type] = [];
|
|
3085
|
+
}
|
|
3086
|
+
typeList.push(info);
|
|
3087
|
+
if (isBrowser()) {
|
|
3088
|
+
const message = {
|
|
3089
|
+
type: "builder.register",
|
|
3090
|
+
data: {
|
|
3091
|
+
type,
|
|
3092
|
+
info
|
|
3093
|
+
}
|
|
3094
|
+
};
|
|
3727
3095
|
try {
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
logger.error("Error fetching data. ", {
|
|
3732
|
-
url,
|
|
3733
|
-
content,
|
|
3734
|
-
options
|
|
3735
|
-
});
|
|
3736
|
-
return null;
|
|
3096
|
+
parent.postMessage(message, "*");
|
|
3097
|
+
if (parent !== window) {
|
|
3098
|
+
window.postMessage(message, "*");
|
|
3737
3099
|
}
|
|
3738
|
-
|
|
3739
|
-
} catch (error) {
|
|
3740
|
-
logger.error("Error fetching data. ", error);
|
|
3741
|
-
return null;
|
|
3100
|
+
} catch (err) {
|
|
3742
3101
|
}
|
|
3743
|
-
}
|
|
3102
|
+
}
|
|
3744
3103
|
}
|
|
3745
|
-
var getAllContent = fetchEntries;
|
|
3746
3104
|
|
|
3747
|
-
// src/
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3105
|
+
// src/scripts/init-editing.ts
|
|
3106
|
+
var registerInsertMenu = () => {
|
|
3107
|
+
register("insertMenu", {
|
|
3108
|
+
name: "_default",
|
|
3109
|
+
default: true,
|
|
3110
|
+
items: [{
|
|
3111
|
+
name: "Box"
|
|
3112
|
+
}, {
|
|
3113
|
+
name: "Text"
|
|
3114
|
+
}, {
|
|
3115
|
+
name: "Image"
|
|
3116
|
+
}, {
|
|
3117
|
+
name: "Columns"
|
|
3118
|
+
}, ...TARGET === "reactNative" ? [] : [{
|
|
3119
|
+
name: "Core:Section"
|
|
3120
|
+
}, {
|
|
3121
|
+
name: "Core:Button"
|
|
3122
|
+
}, {
|
|
3123
|
+
name: "Embed"
|
|
3124
|
+
}, {
|
|
3125
|
+
name: "Custom Code"
|
|
3126
|
+
}]]
|
|
3127
|
+
});
|
|
3128
|
+
};
|
|
3129
|
+
var isSetupForEditing = false;
|
|
3130
|
+
var setupBrowserForEditing = (options = {}) => {
|
|
3131
|
+
if (isSetupForEditing) {
|
|
3132
|
+
return;
|
|
3751
3133
|
}
|
|
3752
|
-
|
|
3753
|
-
|
|
3134
|
+
isSetupForEditing = true;
|
|
3135
|
+
if (isBrowser()) {
|
|
3136
|
+
window.parent?.postMessage({
|
|
3137
|
+
type: "builder.sdkInfo",
|
|
3138
|
+
data: {
|
|
3139
|
+
target: TARGET,
|
|
3140
|
+
version: SDK_VERSION,
|
|
3141
|
+
supportsPatchUpdates: false,
|
|
3142
|
+
// Supports builder-model="..." attribute which is needed to
|
|
3143
|
+
// scope our '+ add block' button styling
|
|
3144
|
+
supportsAddBlockScoping: true,
|
|
3145
|
+
supportsCustomBreakpoints: true
|
|
3146
|
+
}
|
|
3147
|
+
}, "*");
|
|
3148
|
+
window.parent?.postMessage({
|
|
3149
|
+
type: "builder.updateContent",
|
|
3150
|
+
data: {
|
|
3151
|
+
options
|
|
3152
|
+
}
|
|
3153
|
+
}, "*");
|
|
3154
|
+
window.addEventListener("message", ({
|
|
3155
|
+
data
|
|
3156
|
+
}) => {
|
|
3157
|
+
if (!data?.type) {
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
switch (data.type) {
|
|
3161
|
+
case "builder.evaluate": {
|
|
3162
|
+
const text = data.data.text;
|
|
3163
|
+
const args = data.data.arguments || [];
|
|
3164
|
+
const id = data.data.id;
|
|
3165
|
+
const fn = new Function(text);
|
|
3166
|
+
let result;
|
|
3167
|
+
let error = null;
|
|
3168
|
+
try {
|
|
3169
|
+
result = fn.apply(null, args);
|
|
3170
|
+
} catch (err) {
|
|
3171
|
+
error = err;
|
|
3172
|
+
}
|
|
3173
|
+
if (error) {
|
|
3174
|
+
window.parent?.postMessage({
|
|
3175
|
+
type: "builder.evaluateError",
|
|
3176
|
+
data: {
|
|
3177
|
+
id,
|
|
3178
|
+
error: error.message
|
|
3179
|
+
}
|
|
3180
|
+
}, "*");
|
|
3181
|
+
} else {
|
|
3182
|
+
if (result && typeof result.then === "function") {
|
|
3183
|
+
result.then((finalResult) => {
|
|
3184
|
+
window.parent?.postMessage({
|
|
3185
|
+
type: "builder.evaluateResult",
|
|
3186
|
+
data: {
|
|
3187
|
+
id,
|
|
3188
|
+
result: finalResult
|
|
3189
|
+
}
|
|
3190
|
+
}, "*");
|
|
3191
|
+
}).catch(console.error);
|
|
3192
|
+
} else {
|
|
3193
|
+
window.parent?.postMessage({
|
|
3194
|
+
type: "builder.evaluateResult",
|
|
3195
|
+
data: {
|
|
3196
|
+
result,
|
|
3197
|
+
id
|
|
3198
|
+
}
|
|
3199
|
+
}, "*");
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
break;
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
});
|
|
3754
3206
|
}
|
|
3755
|
-
|
|
3756
|
-
}
|
|
3207
|
+
};
|
|
3757
3208
|
|
|
3758
|
-
// src/components/content/components/enable-editor.
|
|
3209
|
+
// src/components/content/components/enable-editor.tsx
|
|
3759
3210
|
function EnableEditor(props) {
|
|
3760
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3761
|
-
const [lastUpdated, setLastUpdated] =
|
|
3762
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3763
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3764
|
-
const [clicked, setClicked] =
|
|
3211
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal9(0);
|
|
3212
|
+
const [lastUpdated, setLastUpdated] = createSignal9(0);
|
|
3213
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal9(false);
|
|
3214
|
+
const [httpReqsData, setHttpReqsData] = createSignal9({});
|
|
3215
|
+
const [clicked, setClicked] = createSignal9(false);
|
|
3765
3216
|
function mergeNewContent(newContent) {
|
|
3766
3217
|
const newContentValue = {
|
|
3767
3218
|
...props.builderContextSignal.content,
|
|
@@ -3882,14 +3333,17 @@ function EnableEditor(props) {
|
|
|
3882
3333
|
function emitStateUpdate() {
|
|
3883
3334
|
if (isEditing()) {
|
|
3884
3335
|
window.dispatchEvent(
|
|
3885
|
-
new CustomEvent(
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3336
|
+
new CustomEvent(
|
|
3337
|
+
"builder:component:stateChange",
|
|
3338
|
+
{
|
|
3339
|
+
detail: {
|
|
3340
|
+
state: fastClone(props.builderContextSignal.rootState),
|
|
3341
|
+
ref: {
|
|
3342
|
+
name: props.model
|
|
3343
|
+
}
|
|
3890
3344
|
}
|
|
3891
3345
|
}
|
|
3892
|
-
|
|
3346
|
+
)
|
|
3893
3347
|
);
|
|
3894
3348
|
}
|
|
3895
3349
|
}
|
|
@@ -3911,12 +3365,12 @@ function EnableEditor(props) {
|
|
|
3911
3365
|
enrich: props.enrich
|
|
3912
3366
|
} : {}
|
|
3913
3367
|
});
|
|
3914
|
-
Object.values(
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
);
|
|
3368
|
+
Object.values(
|
|
3369
|
+
props.builderContextSignal.componentInfos
|
|
3370
|
+
).forEach((registeredComponent) => {
|
|
3371
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
3372
|
+
window.parent?.postMessage(message, "*");
|
|
3373
|
+
});
|
|
3920
3374
|
window.addEventListener(
|
|
3921
3375
|
"builder:component:stateChangeListenerActivated",
|
|
3922
3376
|
emitStateUpdate
|
|
@@ -4000,7 +3454,7 @@ function EnableEditor(props) {
|
|
|
4000
3454
|
emitStateUpdate();
|
|
4001
3455
|
}
|
|
4002
3456
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
4003
|
-
return <
|
|
3457
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show9 when={props.builderContextSignal.content}><div
|
|
4004
3458
|
class={props.classNameProp}
|
|
4005
3459
|
{...{}}
|
|
4006
3460
|
key={forceReRenderCount()}
|
|
@@ -4013,19 +3467,139 @@ function EnableEditor(props) {
|
|
|
4013
3467
|
hidden: true,
|
|
4014
3468
|
"aria-hidden": true
|
|
4015
3469
|
}}
|
|
4016
|
-
>{props.children}</div></Show9></
|
|
3470
|
+
>{props.children}</div></Show9></builder_context_default.Provider>;
|
|
4017
3471
|
}
|
|
4018
3472
|
var Enable_editor_default = EnableEditor;
|
|
4019
3473
|
|
|
4020
|
-
// src/components/
|
|
4021
|
-
|
|
4022
|
-
|
|
3474
|
+
// src/components/content/components/styles.tsx
|
|
3475
|
+
import { createSignal as createSignal10 } from "solid-js";
|
|
3476
|
+
|
|
3477
|
+
// src/components/content/components/styles.helpers.ts
|
|
3478
|
+
var getCssFromFont = (font) => {
|
|
3479
|
+
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
3480
|
+
const name = family.split(",")[0];
|
|
3481
|
+
const url = font.fileUrl ?? font?.files?.regular;
|
|
3482
|
+
let str = "";
|
|
3483
|
+
if (url && family && name) {
|
|
3484
|
+
str += `
|
|
3485
|
+
@font-face {
|
|
3486
|
+
font-family: "${family}";
|
|
3487
|
+
src: local("${name}"), url('${url}') format('woff2');
|
|
3488
|
+
font-display: fallback;
|
|
3489
|
+
font-weight: 400;
|
|
4023
3490
|
}
|
|
4024
|
-
|
|
3491
|
+
`.trim();
|
|
3492
|
+
}
|
|
3493
|
+
if (font.files) {
|
|
3494
|
+
for (const weight in font.files) {
|
|
3495
|
+
const isNumber = String(Number(weight)) === weight;
|
|
3496
|
+
if (!isNumber) {
|
|
3497
|
+
continue;
|
|
3498
|
+
}
|
|
3499
|
+
const weightUrl = font.files[weight];
|
|
3500
|
+
if (weightUrl && weightUrl !== url) {
|
|
3501
|
+
str += `
|
|
3502
|
+
@font-face {
|
|
3503
|
+
font-family: "${family}";
|
|
3504
|
+
src: url('${weightUrl}') format('woff2');
|
|
3505
|
+
font-display: fallback;
|
|
3506
|
+
font-weight: ${weight};
|
|
3507
|
+
}
|
|
3508
|
+
`.trim();
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
return str;
|
|
3513
|
+
};
|
|
3514
|
+
var getFontCss = ({
|
|
3515
|
+
customFonts
|
|
3516
|
+
}) => {
|
|
3517
|
+
return customFonts?.map((font) => getCssFromFont(font))?.join(" ") || "";
|
|
3518
|
+
};
|
|
3519
|
+
var getCss = ({
|
|
3520
|
+
cssCode,
|
|
3521
|
+
contentId
|
|
3522
|
+
}) => {
|
|
3523
|
+
if (!cssCode) {
|
|
3524
|
+
return "";
|
|
3525
|
+
}
|
|
3526
|
+
if (!contentId) {
|
|
3527
|
+
return cssCode;
|
|
3528
|
+
}
|
|
3529
|
+
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
3530
|
+
};
|
|
3531
|
+
|
|
3532
|
+
// src/components/content/components/styles.tsx
|
|
3533
|
+
function ContentStyles(props) {
|
|
3534
|
+
const [injectedStyles, setInjectedStyles] = createSignal10(
|
|
3535
|
+
`
|
|
3536
|
+
${getCss({
|
|
3537
|
+
cssCode: props.cssCode,
|
|
3538
|
+
contentId: props.contentId
|
|
3539
|
+
})}
|
|
3540
|
+
${getFontCss({
|
|
3541
|
+
customFonts: props.customFonts
|
|
3542
|
+
})}
|
|
3543
|
+
|
|
3544
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
3545
|
+
margin: 0;
|
|
3546
|
+
}
|
|
3547
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
3548
|
+
color: inherit;
|
|
3549
|
+
line-height: inherit;
|
|
3550
|
+
letter-spacing: inherit;
|
|
3551
|
+
font-weight: inherit;
|
|
3552
|
+
font-size: inherit;
|
|
3553
|
+
text-align: inherit;
|
|
3554
|
+
font-family: inherit;
|
|
3555
|
+
}
|
|
3556
|
+
`.trim()
|
|
3557
|
+
);
|
|
3558
|
+
return <Inlined_styles_default styles={injectedStyles()} />;
|
|
3559
|
+
}
|
|
3560
|
+
var Styles_default = ContentStyles;
|
|
3561
|
+
|
|
3562
|
+
// src/components/content/content.helpers.ts
|
|
3563
|
+
var getContextStateInitialValue = ({
|
|
3564
|
+
content,
|
|
3565
|
+
data,
|
|
3566
|
+
locale
|
|
3567
|
+
}) => {
|
|
3568
|
+
const defaultValues = {};
|
|
3569
|
+
content?.data?.inputs?.forEach((input) => {
|
|
3570
|
+
if (input.name && input.defaultValue !== void 0 && content?.data?.state && content.data.state[input.name] === void 0) {
|
|
3571
|
+
defaultValues[input.name] = input.defaultValue;
|
|
3572
|
+
}
|
|
3573
|
+
});
|
|
3574
|
+
const stateToUse = {
|
|
3575
|
+
...content?.data?.state,
|
|
3576
|
+
...data,
|
|
3577
|
+
...locale ? {
|
|
3578
|
+
locale
|
|
3579
|
+
} : {}
|
|
3580
|
+
};
|
|
3581
|
+
return {
|
|
3582
|
+
...defaultValues,
|
|
3583
|
+
...stateToUse
|
|
3584
|
+
};
|
|
3585
|
+
};
|
|
3586
|
+
var getContentInitialValue = ({
|
|
3587
|
+
content,
|
|
3588
|
+
data
|
|
3589
|
+
}) => {
|
|
3590
|
+
return !content ? void 0 : {
|
|
3591
|
+
...content,
|
|
3592
|
+
data: {
|
|
3593
|
+
...content?.data,
|
|
3594
|
+
...data
|
|
3595
|
+
},
|
|
3596
|
+
meta: content?.meta
|
|
3597
|
+
};
|
|
3598
|
+
};
|
|
4025
3599
|
|
|
4026
|
-
// src/components/content/content.
|
|
3600
|
+
// src/components/content/content.tsx
|
|
4027
3601
|
function ContentComponent(props) {
|
|
4028
|
-
const [scriptStr, setScriptStr] =
|
|
3602
|
+
const [scriptStr, setScriptStr] = createSignal11(
|
|
4029
3603
|
getRenderContentScriptString({
|
|
4030
3604
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4031
3605
|
variationId: props.content?.testVariationId,
|
|
@@ -4033,7 +3607,7 @@ function ContentComponent(props) {
|
|
|
4033
3607
|
contentId: props.content?.id
|
|
4034
3608
|
})
|
|
4035
3609
|
);
|
|
4036
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3610
|
+
const [registeredComponents, setRegisteredComponents] = createSignal11(
|
|
4037
3611
|
[
|
|
4038
3612
|
...getDefaultRegisteredComponents(),
|
|
4039
3613
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -4054,7 +3628,7 @@ function ContentComponent(props) {
|
|
|
4054
3628
|
{}
|
|
4055
3629
|
)
|
|
4056
3630
|
);
|
|
4057
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3631
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal11({
|
|
4058
3632
|
content: getContentInitialValue({
|
|
4059
3633
|
content: props.content,
|
|
4060
3634
|
data: props.data
|
|
@@ -4093,7 +3667,7 @@ function ContentComponent(props) {
|
|
|
4093
3667
|
rootState: newRootState
|
|
4094
3668
|
}));
|
|
4095
3669
|
}
|
|
4096
|
-
return <
|
|
3670
|
+
return <components_context_default.Provider
|
|
4097
3671
|
value={{
|
|
4098
3672
|
registeredComponents: registeredComponents()
|
|
4099
3673
|
}}
|
|
@@ -4124,13 +3698,13 @@ function ContentComponent(props) {
|
|
|
4124
3698
|
context={builderContextSignal()}
|
|
4125
3699
|
registeredComponents={registeredComponents()}
|
|
4126
3700
|
/>
|
|
4127
|
-
</Enable_editor_default></
|
|
3701
|
+
</Enable_editor_default></components_context_default.Provider>;
|
|
4128
3702
|
}
|
|
4129
3703
|
var Content_default = ContentComponent;
|
|
4130
3704
|
|
|
4131
|
-
// src/components/content-variants/content-variants.
|
|
3705
|
+
// src/components/content-variants/content-variants.tsx
|
|
4132
3706
|
function ContentVariants(props) {
|
|
4133
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3707
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal12(
|
|
4134
3708
|
checkShouldRunVariants({
|
|
4135
3709
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4136
3710
|
content: props.content
|
|
@@ -4158,6 +3732,7 @@ function ContentVariants(props) {
|
|
|
4158
3732
|
});
|
|
4159
3733
|
}
|
|
4160
3734
|
onMount3(() => {
|
|
3735
|
+
setShouldRenderVariants(false);
|
|
4161
3736
|
});
|
|
4162
3737
|
return <>
|
|
4163
3738
|
<Show11 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show11>
|
|
@@ -4209,72 +3784,33 @@ function ContentVariants(props) {
|
|
|
4209
3784
|
}
|
|
4210
3785
|
var Content_variants_default = ContentVariants;
|
|
4211
3786
|
|
|
4212
|
-
// src/blocks/symbol/symbol.helpers.
|
|
4213
|
-
var
|
|
4214
|
-
var __getOwnPropSymbols17 = Object.getOwnPropertySymbols;
|
|
4215
|
-
var __hasOwnProp17 = Object.prototype.hasOwnProperty;
|
|
4216
|
-
var __propIsEnum17 = Object.prototype.propertyIsEnumerable;
|
|
4217
|
-
var __defNormalProp17 = (obj, key, value) => key in obj ? __defProp17(obj, key, {
|
|
4218
|
-
enumerable: true,
|
|
4219
|
-
configurable: true,
|
|
4220
|
-
writable: true,
|
|
4221
|
-
value
|
|
4222
|
-
}) : obj[key] = value;
|
|
4223
|
-
var __spreadValues17 = (a, b) => {
|
|
4224
|
-
for (var prop in b || (b = {}))
|
|
4225
|
-
if (__hasOwnProp17.call(b, prop))
|
|
4226
|
-
__defNormalProp17(a, prop, b[prop]);
|
|
4227
|
-
if (__getOwnPropSymbols17)
|
|
4228
|
-
for (var prop of __getOwnPropSymbols17(b)) {
|
|
4229
|
-
if (__propIsEnum17.call(b, prop))
|
|
4230
|
-
__defNormalProp17(a, prop, b[prop]);
|
|
4231
|
-
}
|
|
4232
|
-
return a;
|
|
4233
|
-
};
|
|
4234
|
-
var __async6 = (__this, __arguments, generator) => {
|
|
4235
|
-
return new Promise((resolve, reject) => {
|
|
4236
|
-
var fulfilled = (value) => {
|
|
4237
|
-
try {
|
|
4238
|
-
step(generator.next(value));
|
|
4239
|
-
} catch (e) {
|
|
4240
|
-
reject(e);
|
|
4241
|
-
}
|
|
4242
|
-
};
|
|
4243
|
-
var rejected = (value) => {
|
|
4244
|
-
try {
|
|
4245
|
-
step(generator.throw(value));
|
|
4246
|
-
} catch (e) {
|
|
4247
|
-
reject(e);
|
|
4248
|
-
}
|
|
4249
|
-
};
|
|
4250
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
4251
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
4252
|
-
});
|
|
4253
|
-
};
|
|
4254
|
-
var fetchSymbolContent = (_0) => __async6(void 0, [_0], function* ({
|
|
3787
|
+
// src/blocks/symbol/symbol.helpers.ts
|
|
3788
|
+
var fetchSymbolContent = async ({
|
|
4255
3789
|
builderContextValue,
|
|
4256
3790
|
symbol
|
|
4257
|
-
}) {
|
|
4258
|
-
if (
|
|
4259
|
-
|
|
3791
|
+
}) => {
|
|
3792
|
+
if (symbol?.model && // This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
3793
|
+
builderContextValue?.apiKey) {
|
|
3794
|
+
return fetchOneEntry({
|
|
4260
3795
|
model: symbol.model,
|
|
4261
3796
|
apiKey: builderContextValue.apiKey,
|
|
4262
|
-
apiVersion: builderContextValue.apiVersion
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
3797
|
+
apiVersion: builderContextValue.apiVersion,
|
|
3798
|
+
...symbol?.entry && {
|
|
3799
|
+
query: {
|
|
3800
|
+
id: symbol.entry
|
|
3801
|
+
}
|
|
4266
3802
|
}
|
|
4267
|
-
})
|
|
3803
|
+
}).catch((err) => {
|
|
4268
3804
|
logger.error("Could not fetch symbol content: ", err);
|
|
4269
3805
|
return void 0;
|
|
4270
3806
|
});
|
|
4271
3807
|
}
|
|
4272
3808
|
return void 0;
|
|
4273
|
-
}
|
|
3809
|
+
};
|
|
4274
3810
|
|
|
4275
|
-
// src/blocks/symbol/symbol.
|
|
3811
|
+
// src/blocks/symbol/symbol.tsx
|
|
4276
3812
|
function Symbol(props) {
|
|
4277
|
-
const [contentToUse, setContentToUse] =
|
|
3813
|
+
const [contentToUse, setContentToUse] = createSignal13(props.symbol?.content);
|
|
4278
3814
|
function className() {
|
|
4279
3815
|
return [
|
|
4280
3816
|
...[props.attributes.class],
|
|
@@ -4319,11 +3855,11 @@ function Symbol(props) {
|
|
|
4319
3855
|
}
|
|
4320
3856
|
var symbol_default = Symbol;
|
|
4321
3857
|
|
|
4322
|
-
// src/index-helpers/blocks-exports.
|
|
3858
|
+
// src/index-helpers/blocks-exports.ts
|
|
4323
3859
|
var RenderBlocks = Blocks_default;
|
|
4324
3860
|
var RenderContent = Content_variants_default;
|
|
4325
3861
|
|
|
4326
|
-
// src/functions/set-editor-settings.
|
|
3862
|
+
// src/functions/set-editor-settings.ts
|
|
4327
3863
|
var settings = {};
|
|
4328
3864
|
function setEditorSettings(newSettings) {
|
|
4329
3865
|
if (isBrowser()) {
|
|
@@ -4336,68 +3872,27 @@ function setEditorSettings(newSettings) {
|
|
|
4336
3872
|
}
|
|
4337
3873
|
}
|
|
4338
3874
|
|
|
4339
|
-
// src/functions/fetch-builder-props.
|
|
4340
|
-
var
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
var __hasOwnProp18 = Object.prototype.hasOwnProperty;
|
|
4345
|
-
var __propIsEnum18 = Object.prototype.propertyIsEnumerable;
|
|
4346
|
-
var __defNormalProp18 = (obj, key, value) => key in obj ? __defProp18(obj, key, {
|
|
4347
|
-
enumerable: true,
|
|
4348
|
-
configurable: true,
|
|
4349
|
-
writable: true,
|
|
4350
|
-
value
|
|
4351
|
-
}) : obj[key] = value;
|
|
4352
|
-
var __spreadValues18 = (a, b) => {
|
|
4353
|
-
for (var prop in b || (b = {}))
|
|
4354
|
-
if (__hasOwnProp18.call(b, prop))
|
|
4355
|
-
__defNormalProp18(a, prop, b[prop]);
|
|
4356
|
-
if (__getOwnPropSymbols18)
|
|
4357
|
-
for (var prop of __getOwnPropSymbols18(b)) {
|
|
4358
|
-
if (__propIsEnum18.call(b, prop))
|
|
4359
|
-
__defNormalProp18(a, prop, b[prop]);
|
|
4360
|
-
}
|
|
4361
|
-
return a;
|
|
4362
|
-
};
|
|
4363
|
-
var __spreadProps12 = (a, b) => __defProps12(a, __getOwnPropDescs12(b));
|
|
4364
|
-
var __async7 = (__this, __arguments, generator) => {
|
|
4365
|
-
return new Promise((resolve, reject) => {
|
|
4366
|
-
var fulfilled = (value) => {
|
|
4367
|
-
try {
|
|
4368
|
-
step(generator.next(value));
|
|
4369
|
-
} catch (e) {
|
|
4370
|
-
reject(e);
|
|
4371
|
-
}
|
|
4372
|
-
};
|
|
4373
|
-
var rejected = (value) => {
|
|
4374
|
-
try {
|
|
4375
|
-
step(generator.throw(value));
|
|
4376
|
-
} catch (e) {
|
|
4377
|
-
reject(e);
|
|
4378
|
-
}
|
|
4379
|
-
};
|
|
4380
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
4381
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
4382
|
-
});
|
|
4383
|
-
};
|
|
4384
|
-
var fetchBuilderProps = (_args) => __async7(void 0, null, function* () {
|
|
4385
|
-
var _a, _b, _c;
|
|
4386
|
-
const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
|
|
4387
|
-
const getContentArgs = __spreadProps12(__spreadValues18({}, _args), {
|
|
3875
|
+
// src/functions/fetch-builder-props.ts
|
|
3876
|
+
var fetchBuilderProps = async (_args) => {
|
|
3877
|
+
const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
|
|
3878
|
+
const getContentArgs = {
|
|
3879
|
+
..._args,
|
|
4388
3880
|
apiKey: _args.apiKey,
|
|
4389
3881
|
model: _args.model || "page",
|
|
4390
|
-
userAttributes:
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
3882
|
+
userAttributes: {
|
|
3883
|
+
..._args.userAttributes,
|
|
3884
|
+
...urlPath ? {
|
|
3885
|
+
urlPath
|
|
3886
|
+
} : {}
|
|
3887
|
+
},
|
|
3888
|
+
options: getBuilderSearchParams(_args.searchParams || _args.url?.searchParams || _args.options)
|
|
3889
|
+
};
|
|
4395
3890
|
return {
|
|
4396
3891
|
apiKey: getContentArgs.apiKey,
|
|
4397
3892
|
model: getContentArgs.model,
|
|
4398
|
-
content:
|
|
3893
|
+
content: await fetchOneEntry(getContentArgs)
|
|
4399
3894
|
};
|
|
4400
|
-
}
|
|
3895
|
+
};
|
|
4401
3896
|
export {
|
|
4402
3897
|
Blocks_default as Blocks,
|
|
4403
3898
|
button_default as Button,
|