@builder.io/sdk-qwik 0.7.1-2 → 0.7.1-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{browser/index.qwik.mjs → index.qwik.js} +384 -306
- package/package.json +26 -38
- package/types/src/blocks/custom-code/custom-code.d.ts +0 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/functions/evaluate/node-runtime/index.d.ts +1 -1
- package/types/src/functions/evaluate/placeholder-runtime.d.ts +1 -2
- package/lib/browser/index.qwik.cjs +0 -4283
- package/lib/edge/index.qwik.cjs +0 -7487
- package/lib/edge/index.qwik.mjs +0 -7487
- package/lib/node/index.qwik.cjs +0 -4283
- package/lib/node/index.qwik.mjs +0 -4283
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl,
|
|
2
|
-
import { Fragment } from
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useOn } from '@builder.io/qwik';
|
|
2
|
+
import { Fragment } from '@builder.io/qwik/jsx-runtime';
|
|
3
|
+
import ivm from 'isolated-vm';
|
|
4
|
+
import { isServer } from '@builder.io/qwik/build';
|
|
5
|
+
|
|
3
6
|
const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4
7
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
5
8
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
@@ -36,12 +39,14 @@ const STYLES$3 = `
|
|
|
36
39
|
all: unset;
|
|
37
40
|
}
|
|
38
41
|
`;
|
|
42
|
+
|
|
39
43
|
const builderContext = createContextId("Builder");
|
|
44
|
+
|
|
40
45
|
const ComponentsContext = createContextId("Components");
|
|
46
|
+
|
|
41
47
|
function getBlockComponentOptions(block) {
|
|
42
|
-
var _a;
|
|
43
48
|
return {
|
|
44
|
-
...
|
|
49
|
+
...block.component?.options,
|
|
45
50
|
...block.options,
|
|
46
51
|
/**
|
|
47
52
|
* Our built-in components frequently make use of the block, so we provide all of it under `builderBlock`
|
|
@@ -49,6 +54,7 @@ function getBlockComponentOptions(block) {
|
|
|
49
54
|
builderBlock: block
|
|
50
55
|
};
|
|
51
56
|
}
|
|
57
|
+
|
|
52
58
|
const MSG_PREFIX = "[Builder.io]: ";
|
|
53
59
|
const logger = {
|
|
54
60
|
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
@@ -56,16 +62,21 @@ const logger = {
|
|
|
56
62
|
warn: (...message) => console.warn(MSG_PREFIX, ...message),
|
|
57
63
|
debug: (...message) => console.debug(MSG_PREFIX, ...message)
|
|
58
64
|
};
|
|
65
|
+
|
|
59
66
|
function isBrowser() {
|
|
60
67
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
61
68
|
}
|
|
69
|
+
|
|
62
70
|
const TARGET = "qwik";
|
|
71
|
+
|
|
63
72
|
function isIframe() {
|
|
64
73
|
return isBrowser() && window.self !== window.top;
|
|
65
74
|
}
|
|
75
|
+
|
|
66
76
|
function isEditing() {
|
|
67
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
77
|
+
return isIframe() && (window.location.search.indexOf("builder.frameEditing=") !== -1);
|
|
68
78
|
}
|
|
79
|
+
|
|
69
80
|
const getLocation = () => {
|
|
70
81
|
if (isBrowser()) {
|
|
71
82
|
const parsedLocation = new URL(location.href);
|
|
@@ -103,11 +114,12 @@ const getUserAttributes = () => {
|
|
|
103
114
|
const isTablet = userAgent.match(/Tablet|iPad/i);
|
|
104
115
|
const url = getLocation();
|
|
105
116
|
return {
|
|
106
|
-
urlPath: url
|
|
107
|
-
host:
|
|
117
|
+
urlPath: url?.pathname,
|
|
118
|
+
host: url?.host || url?.hostname,
|
|
108
119
|
device: isTablet ? "tablet" : isMobile.any() ? "mobile" : "desktop"
|
|
109
120
|
};
|
|
110
121
|
};
|
|
122
|
+
|
|
111
123
|
const getFunctionArguments = ({ builder, context, event, state }) => {
|
|
112
124
|
return Object.entries({
|
|
113
125
|
state,
|
|
@@ -118,6 +130,102 @@ const getFunctionArguments = ({ builder, context, event, state }) => {
|
|
|
118
130
|
event
|
|
119
131
|
});
|
|
120
132
|
};
|
|
133
|
+
|
|
134
|
+
const getSyncValName = (key) => `bldr_${key}_sync`;
|
|
135
|
+
const BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE";
|
|
136
|
+
const REF_TO_PROXY_FN = `
|
|
137
|
+
var refToProxy = (obj) => {
|
|
138
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
139
|
+
return obj;
|
|
140
|
+
}
|
|
141
|
+
return new Proxy({}, {
|
|
142
|
+
get(target, key) {
|
|
143
|
+
if (key === 'copySync') {
|
|
144
|
+
return () => obj.copySync();
|
|
145
|
+
}
|
|
146
|
+
const val = obj.getSync(key);
|
|
147
|
+
if (typeof val?.getSync === 'function') {
|
|
148
|
+
return refToProxy(val);
|
|
149
|
+
}
|
|
150
|
+
return val;
|
|
151
|
+
},
|
|
152
|
+
set(target, key, value) {
|
|
153
|
+
obj.setSync(key, value);
|
|
154
|
+
${BUILDER_SET_STATE_NAME}(obj.copySync())
|
|
155
|
+
},
|
|
156
|
+
deleteProperty(target, key) {
|
|
157
|
+
obj.deleteSync(key);
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
const processCode = ({ code, args }) => {
|
|
163
|
+
const fnArgs = args.map(([name]) => `var ${name} = refToProxy(${getSyncValName(name)}); `).join("");
|
|
164
|
+
return `
|
|
165
|
+
${REF_TO_PROXY_FN}
|
|
166
|
+
${fnArgs}
|
|
167
|
+
function theFunction() {
|
|
168
|
+
${code}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const output = theFunction()
|
|
172
|
+
|
|
173
|
+
if (typeof output === 'object' && output !== null) {
|
|
174
|
+
JSON.stringify(output.copySync ? output.copySync() : output);
|
|
175
|
+
}
|
|
176
|
+
output;
|
|
177
|
+
`;
|
|
178
|
+
};
|
|
179
|
+
const getIsolateContext = () => {
|
|
180
|
+
const isolate = new ivm.Isolate({
|
|
181
|
+
memoryLimit: 128
|
|
182
|
+
});
|
|
183
|
+
return isolate.createContextSync();
|
|
184
|
+
};
|
|
185
|
+
const evaluator$1 = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
186
|
+
const state = {
|
|
187
|
+
...rootState,
|
|
188
|
+
...localState
|
|
189
|
+
};
|
|
190
|
+
const args = getFunctionArguments({
|
|
191
|
+
builder,
|
|
192
|
+
context,
|
|
193
|
+
event,
|
|
194
|
+
state
|
|
195
|
+
});
|
|
196
|
+
const isolateContext = getIsolateContext();
|
|
197
|
+
const jail = isolateContext.global;
|
|
198
|
+
jail.setSync("global", jail.derefInto());
|
|
199
|
+
jail.setSync("log", function(...logArgs) {
|
|
200
|
+
console.log(...logArgs);
|
|
201
|
+
});
|
|
202
|
+
jail.setSync(BUILDER_SET_STATE_NAME, function(newState) {
|
|
203
|
+
if (rootSetState)
|
|
204
|
+
rootSetState(newState);
|
|
205
|
+
});
|
|
206
|
+
args.forEach(([key, arg]) => {
|
|
207
|
+
const val = typeof arg === "object" ? new ivm.Reference(
|
|
208
|
+
// workaround: methods with default values for arguments is not being cloned over
|
|
209
|
+
key === "builder" ? {
|
|
210
|
+
...arg,
|
|
211
|
+
getUserAttributes: () => arg.getUserAttributes()
|
|
212
|
+
} : arg
|
|
213
|
+
) : null;
|
|
214
|
+
jail.setSync(getSyncValName(key), val);
|
|
215
|
+
});
|
|
216
|
+
const evalStr = processCode({
|
|
217
|
+
code,
|
|
218
|
+
args
|
|
219
|
+
});
|
|
220
|
+
const resultStr = isolateContext.evalSync(evalStr);
|
|
221
|
+
try {
|
|
222
|
+
const res = JSON.parse(resultStr);
|
|
223
|
+
return res;
|
|
224
|
+
} catch (_error) {
|
|
225
|
+
return resultStr;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
121
229
|
const runInBrowser = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
122
230
|
const functionArgs = getFunctionArguments({
|
|
123
231
|
builder,
|
|
@@ -140,11 +248,16 @@ function flattenState(rootState, localState, rootSetState) {
|
|
|
140
248
|
if (localState && prop in localState)
|
|
141
249
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
142
250
|
rootState[prop] = value;
|
|
143
|
-
rootSetState
|
|
251
|
+
rootSetState?.(rootState);
|
|
144
252
|
return true;
|
|
145
253
|
}
|
|
146
254
|
});
|
|
147
255
|
}
|
|
256
|
+
|
|
257
|
+
console.log("inside placeholder-runtime.ts");
|
|
258
|
+
const evaluator = isServer ? evaluator$1 : runInBrowser;
|
|
259
|
+
console.log("chose runtime");
|
|
260
|
+
|
|
148
261
|
function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
|
|
149
262
|
if (code === "") {
|
|
150
263
|
logger.warn("Skipping evaluation of empty code block.");
|
|
@@ -171,7 +284,7 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
|
|
|
171
284
|
localState
|
|
172
285
|
};
|
|
173
286
|
try {
|
|
174
|
-
return
|
|
287
|
+
return evaluator(args);
|
|
175
288
|
} catch (e) {
|
|
176
289
|
logger.error("Failed code evaluation: " + e.message, {
|
|
177
290
|
code
|
|
@@ -179,7 +292,9 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
|
|
|
179
292
|
return void 0;
|
|
180
293
|
}
|
|
181
294
|
}
|
|
295
|
+
|
|
182
296
|
const fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
297
|
+
|
|
183
298
|
const set = (obj, _path, value) => {
|
|
184
299
|
if (Object(obj) !== obj)
|
|
185
300
|
return obj;
|
|
@@ -187,9 +302,11 @@ const set = (obj, _path, value) => {
|
|
|
187
302
|
path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
|
|
188
303
|
return obj;
|
|
189
304
|
};
|
|
305
|
+
|
|
190
306
|
function transformBlock(block) {
|
|
191
307
|
return block;
|
|
192
308
|
}
|
|
309
|
+
|
|
193
310
|
const evaluateBindings = ({ block, context, localState, rootState, rootSetState }) => {
|
|
194
311
|
if (!block.bindings)
|
|
195
312
|
return block;
|
|
@@ -229,6 +346,7 @@ function getProcessedBlock({ block, context, shouldEvaluateBindings, localState,
|
|
|
229
346
|
else
|
|
230
347
|
return transformedBlock;
|
|
231
348
|
}
|
|
349
|
+
|
|
232
350
|
const EMPTY_HTML_ELEMENTS = [
|
|
233
351
|
"area",
|
|
234
352
|
"base",
|
|
@@ -250,15 +368,14 @@ const isEmptyHtmlElement = (tagName) => {
|
|
|
250
368
|
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
251
369
|
};
|
|
252
370
|
const getComponent = ({ block, context, registeredComponents }) => {
|
|
253
|
-
|
|
254
|
-
const componentName = (_a = getProcessedBlock({
|
|
371
|
+
const componentName = getProcessedBlock({
|
|
255
372
|
block,
|
|
256
373
|
localState: context.localState,
|
|
257
374
|
rootState: context.rootState,
|
|
258
375
|
rootSetState: context.rootSetState,
|
|
259
376
|
context: context.context,
|
|
260
377
|
shouldEvaluateBindings: false
|
|
261
|
-
}).component
|
|
378
|
+
}).component?.name;
|
|
262
379
|
if (!componentName)
|
|
263
380
|
return null;
|
|
264
381
|
const ref = registeredComponents[componentName];
|
|
@@ -272,7 +389,7 @@ const getComponent = ({ block, context, registeredComponents }) => {
|
|
|
272
389
|
};
|
|
273
390
|
const getRepeatItemData = ({ block, context }) => {
|
|
274
391
|
const { repeat, ...blockWithoutRepeat } = block;
|
|
275
|
-
if (!
|
|
392
|
+
if (!repeat?.collection)
|
|
276
393
|
return void 0;
|
|
277
394
|
const itemsArray = evaluate({
|
|
278
395
|
code: repeat.collection,
|
|
@@ -300,6 +417,7 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
300
417
|
}));
|
|
301
418
|
return repeatArray;
|
|
302
419
|
};
|
|
420
|
+
|
|
303
421
|
const SIZES = {
|
|
304
422
|
small: {
|
|
305
423
|
min: 320,
|
|
@@ -343,8 +461,11 @@ const getSizesForBreakpoints = ({ small, medium }) => {
|
|
|
343
461
|
};
|
|
344
462
|
return newSizes;
|
|
345
463
|
};
|
|
464
|
+
|
|
346
465
|
const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
466
|
+
|
|
347
467
|
const checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
|
|
468
|
+
|
|
348
469
|
const convertStyleMapToCSSArray = (style) => {
|
|
349
470
|
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
350
471
|
if (typeof value === "string")
|
|
@@ -366,6 +487,7 @@ const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
|
366
487
|
else
|
|
367
488
|
return cssClass;
|
|
368
489
|
};
|
|
490
|
+
|
|
369
491
|
const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
370
492
|
return /* @__PURE__ */ _jsxQ("style", null, {
|
|
371
493
|
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
@@ -376,6 +498,7 @@ const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
376
498
|
], "p0.id")
|
|
377
499
|
}, null, 3, "NG_0");
|
|
378
500
|
}, "InlinedStyles_component_IOsg46hMexk"));
|
|
501
|
+
|
|
379
502
|
const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
380
503
|
_jsxBranch();
|
|
381
504
|
const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
@@ -397,7 +520,6 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
397
520
|
props
|
|
398
521
|
]));
|
|
399
522
|
const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
400
|
-
var _a;
|
|
401
523
|
const [props2] = useLexicalScope();
|
|
402
524
|
const processedBlock = getProcessedBlock({
|
|
403
525
|
block: props2.block,
|
|
@@ -409,10 +531,10 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
409
531
|
});
|
|
410
532
|
const styles = processedBlock.responsiveStyles;
|
|
411
533
|
const content = props2.context.content;
|
|
412
|
-
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
|
|
413
|
-
const largeStyles = styles
|
|
414
|
-
const mediumStyles = styles
|
|
415
|
-
const smallStyles = styles
|
|
534
|
+
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
535
|
+
const largeStyles = styles?.large;
|
|
536
|
+
const mediumStyles = styles?.medium;
|
|
537
|
+
const smallStyles = styles?.small;
|
|
416
538
|
const className = processedBlock.id;
|
|
417
539
|
if (!className)
|
|
418
540
|
return "";
|
|
@@ -451,10 +573,12 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
451
573
|
}, 3, "8B_0") : null
|
|
452
574
|
}, 1, "8B_1");
|
|
453
575
|
}, "BlockStyles_component_0lZeirBI638"));
|
|
576
|
+
|
|
454
577
|
function capitalizeFirstLetter(string) {
|
|
455
578
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
456
579
|
}
|
|
457
580
|
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}$`;
|
|
581
|
+
|
|
458
582
|
function createEventHandler(value, options) {
|
|
459
583
|
return /* @__PURE__ */ inlinedQrl((event) => {
|
|
460
584
|
const [options2, value2] = useLexicalScope();
|
|
@@ -471,6 +595,7 @@ function createEventHandler(value, options) {
|
|
|
471
595
|
value
|
|
472
596
|
]);
|
|
473
597
|
}
|
|
598
|
+
|
|
474
599
|
function getBlockActions(options) {
|
|
475
600
|
const obj = {};
|
|
476
601
|
const optionActions = options.block.actions ?? {};
|
|
@@ -493,16 +618,17 @@ function getBlockActions(options) {
|
|
|
493
618
|
}
|
|
494
619
|
return obj;
|
|
495
620
|
}
|
|
621
|
+
|
|
496
622
|
function transformBlockProperties(properties) {
|
|
497
623
|
return properties;
|
|
498
624
|
}
|
|
625
|
+
|
|
499
626
|
const extractRelevantRootBlockProperties = (block) => {
|
|
500
627
|
return {
|
|
501
628
|
href: block.href
|
|
502
629
|
};
|
|
503
630
|
};
|
|
504
631
|
function getBlockProperties({ block, context }) {
|
|
505
|
-
var _a;
|
|
506
632
|
const properties = {
|
|
507
633
|
...extractRelevantRootBlockProperties(block),
|
|
508
634
|
...block.properties,
|
|
@@ -512,7 +638,7 @@ function getBlockProperties({ block, context }) {
|
|
|
512
638
|
block.id,
|
|
513
639
|
"builder-block",
|
|
514
640
|
block.class,
|
|
515
|
-
|
|
641
|
+
block.properties?.class
|
|
516
642
|
].filter(Boolean).join(" ")
|
|
517
643
|
};
|
|
518
644
|
return transformBlockProperties(properties);
|
|
@@ -531,6 +657,7 @@ function getStyleAttribute(style) {
|
|
|
531
657
|
return style;
|
|
532
658
|
}
|
|
533
659
|
}
|
|
660
|
+
|
|
534
661
|
const BlockWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
535
662
|
_jsxBranch();
|
|
536
663
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
@@ -564,6 +691,7 @@ const BlockWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
564
691
|
}, 0, "87_2")
|
|
565
692
|
}, 1, "87_3");
|
|
566
693
|
}, "BlockWrapper_component_kOI0j0aW8Nw"));
|
|
694
|
+
|
|
567
695
|
const InteractiveElement = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
568
696
|
return /* @__PURE__ */ _jsxC(props.Wrapper, {
|
|
569
697
|
...props.wrapperProps,
|
|
@@ -583,6 +711,7 @@ const InteractiveElement = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQ
|
|
|
583
711
|
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "q0_0")
|
|
584
712
|
}, 0, "q0_1");
|
|
585
713
|
}, "InteractiveElement_component_0UqfJpjhn0g"));
|
|
714
|
+
|
|
586
715
|
const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }) => {
|
|
587
716
|
const interactiveElementProps = {
|
|
588
717
|
Wrapper: componentRef,
|
|
@@ -604,6 +733,7 @@ const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef
|
|
|
604
733
|
} : {}
|
|
605
734
|
};
|
|
606
735
|
};
|
|
736
|
+
|
|
607
737
|
const ComponentRef = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
608
738
|
const state = useStore({
|
|
609
739
|
Wrapper: props.isInteractive ? InteractiveElement : props.componentRef
|
|
@@ -656,6 +786,7 @@ const ComponentRef = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
656
786
|
}, 0, "z6_0") : null
|
|
657
787
|
}, 1, "z6_1");
|
|
658
788
|
}, "ComponentRef_component_tFQoBV6UFdc"));
|
|
789
|
+
|
|
659
790
|
const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
660
791
|
const state = useStore({
|
|
661
792
|
store: props.repeatContext
|
|
@@ -684,8 +815,8 @@ const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
684
815
|
}
|
|
685
816
|
}, 3, "GO_0");
|
|
686
817
|
}, "RepeatedBlock_component_JK1l2jKcfwA"));
|
|
818
|
+
|
|
687
819
|
const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
688
|
-
var _a;
|
|
689
820
|
_jsxBranch();
|
|
690
821
|
const state = useStore({
|
|
691
822
|
childrenContext: props.context
|
|
@@ -740,9 +871,8 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
740
871
|
processedBlock
|
|
741
872
|
]));
|
|
742
873
|
const childrenWithoutParentComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
743
|
-
var _a2;
|
|
744
874
|
const [blockComponent2, processedBlock2, repeatItem2] = useLexicalScope();
|
|
745
|
-
const shouldRenderChildrenOutsideRef = !
|
|
875
|
+
const shouldRenderChildrenOutsideRef = !blockComponent2.value?.component && !repeatItem2.value;
|
|
746
876
|
return shouldRenderChildrenOutsideRef ? processedBlock2.value.children ?? [] : [];
|
|
747
877
|
}, "Block_component_childrenWithoutParentComponent_useComputed_0WENYGElWnc", [
|
|
748
878
|
blockComponent,
|
|
@@ -750,23 +880,22 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
750
880
|
repeatItem
|
|
751
881
|
]));
|
|
752
882
|
const componentRefProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
753
|
-
var _a2, _b, _c, _d, _e;
|
|
754
883
|
const [blockComponent2, processedBlock2, props2, state2] = useLexicalScope();
|
|
755
884
|
return {
|
|
756
885
|
blockChildren: processedBlock2.value.children ?? [],
|
|
757
|
-
componentRef:
|
|
886
|
+
componentRef: blockComponent2.value?.component,
|
|
758
887
|
componentOptions: {
|
|
759
888
|
...getBlockComponentOptions(processedBlock2.value),
|
|
760
889
|
builderContext: props2.context,
|
|
761
|
-
...
|
|
890
|
+
...blockComponent2.value?.name === "Symbol" || blockComponent2.value?.name === "Columns" ? {
|
|
762
891
|
builderComponents: props2.registeredComponents
|
|
763
892
|
} : {}
|
|
764
893
|
},
|
|
765
894
|
context: state2.childrenContext,
|
|
766
895
|
registeredComponents: props2.registeredComponents,
|
|
767
896
|
builderBlock: processedBlock2.value,
|
|
768
|
-
includeBlockProps:
|
|
769
|
-
isInteractive: !
|
|
897
|
+
includeBlockProps: blockComponent2.value?.noWrap === true,
|
|
898
|
+
isInteractive: !blockComponent2.value?.isRSC
|
|
770
899
|
};
|
|
771
900
|
}, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
|
|
772
901
|
blockComponent,
|
|
@@ -775,7 +904,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
775
904
|
state
|
|
776
905
|
]));
|
|
777
906
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
778
|
-
children: canShowBlock.value ? !
|
|
907
|
+
children: canShowBlock.value ? !blockComponent.value?.noWrap ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
779
908
|
children: [
|
|
780
909
|
isEmptyHtmlElement(Tag.value) ? /* @__PURE__ */ _jsxC(BlockWrapper, {
|
|
781
910
|
get Wrapper() {
|
|
@@ -888,10 +1017,10 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
888
1017
|
}, 0, "jN_4") : null
|
|
889
1018
|
}, 1, "jN_5");
|
|
890
1019
|
}, "Block_component_nnPv0RY0U0k"));
|
|
1020
|
+
|
|
891
1021
|
const onClick$1 = function onClick2(props, state) {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
1022
|
+
if (isEditing() && !props.blocks?.length)
|
|
1023
|
+
window.parent?.postMessage({
|
|
895
1024
|
type: "builder.clickEmptyBlocks",
|
|
896
1025
|
data: {
|
|
897
1026
|
parentElementId: props.parent,
|
|
@@ -900,9 +1029,8 @@ const onClick$1 = function onClick2(props, state) {
|
|
|
900
1029
|
}, "*");
|
|
901
1030
|
};
|
|
902
1031
|
const onMouseEnter = function onMouseEnter2(props, state) {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
1032
|
+
if (isEditing() && !props.blocks?.length)
|
|
1033
|
+
window.parent?.postMessage({
|
|
906
1034
|
type: "builder.hoverEmptyBlocks",
|
|
907
1035
|
data: {
|
|
908
1036
|
parentElementId: props.parent,
|
|
@@ -913,9 +1041,8 @@ const onMouseEnter = function onMouseEnter2(props, state) {
|
|
|
913
1041
|
const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
914
1042
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "BlocksWrapper_component_useStylesScoped_Kj0S9AOXQ0o"));
|
|
915
1043
|
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
916
|
-
var _a;
|
|
917
1044
|
const [props2] = useLexicalScope();
|
|
918
|
-
return "builder-blocks" + (!
|
|
1045
|
+
return "builder-blocks" + (!props2.blocks?.length ? " no-blocks" : "");
|
|
919
1046
|
}, "BlocksWrapper_component_className_useComputed_J5SSSH2Xf08", [
|
|
920
1047
|
props
|
|
921
1048
|
]));
|
|
@@ -964,6 +1091,7 @@ const STYLES$2 = `
|
|
|
964
1091
|
align-items: stretch;
|
|
965
1092
|
}
|
|
966
1093
|
`;
|
|
1094
|
+
|
|
967
1095
|
const Blocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
968
1096
|
const builderContext$1 = useContext(builderContext);
|
|
969
1097
|
const componentsContext = useContext(ComponentsContext);
|
|
@@ -1033,12 +1161,13 @@ const Blocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =
|
|
|
1033
1161
|
}
|
|
1034
1162
|
}, 1, "0n_0");
|
|
1035
1163
|
}, "Blocks_component_PI1ErWPzPEg"));
|
|
1164
|
+
|
|
1036
1165
|
function deoptSignal(value) {
|
|
1037
1166
|
return value;
|
|
1038
1167
|
}
|
|
1168
|
+
|
|
1039
1169
|
const getWidth = function getWidth2(props, state, index) {
|
|
1040
|
-
|
|
1041
|
-
return ((_a = state.cols[index]) == null ? void 0 : _a.width) || 100 / state.cols.length;
|
|
1170
|
+
return state.cols[index]?.width || 100 / state.cols.length;
|
|
1042
1171
|
};
|
|
1043
1172
|
const getColumnCssWidth = function getColumnCssWidth2(props, state, index) {
|
|
1044
1173
|
const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
|
|
@@ -1079,8 +1208,7 @@ const columnCssVars = function columnCssVars2(props, state, index) {
|
|
|
1079
1208
|
};
|
|
1080
1209
|
};
|
|
1081
1210
|
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, size) {
|
|
1082
|
-
|
|
1083
|
-
const breakpointSizes = getSizesForBreakpoints(((_b = (_a = props.builderContext.content) == null ? void 0 : _a.meta) == null ? void 0 : _b.breakpoints) || {});
|
|
1211
|
+
const breakpointSizes = getSizesForBreakpoints(props.builderContext.content?.meta?.breakpoints || {});
|
|
1084
1212
|
return breakpointSizes[size].max;
|
|
1085
1213
|
};
|
|
1086
1214
|
const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
@@ -1153,7 +1281,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
1153
1281
|
columnsStyles
|
|
1154
1282
|
], "p0.value")
|
|
1155
1283
|
}
|
|
1156
|
-
}, 3, "c0_0"),
|
|
1284
|
+
}, 3, "c0_0") ,
|
|
1157
1285
|
(props.columns || []).map((column, index) => {
|
|
1158
1286
|
return /* @__PURE__ */ createElement("div", {
|
|
1159
1287
|
class: "builder-column div-Columns-2",
|
|
@@ -1203,9 +1331,11 @@ const STYLES$1 = `
|
|
|
1203
1331
|
align-items: stretch;
|
|
1204
1332
|
}
|
|
1205
1333
|
`;
|
|
1334
|
+
|
|
1206
1335
|
const FragmentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1207
1336
|
return /* @__PURE__ */ _jsxQ("span", null, null, /* @__PURE__ */ _jsxC(Slot, null, 3, "oj_0"), 1, "oj_1");
|
|
1208
1337
|
}, "FragmentComponent_component_T0AypnadAK0"));
|
|
1338
|
+
|
|
1209
1339
|
function removeProtocol(path) {
|
|
1210
1340
|
return path.replace(/http(s)?:/, "");
|
|
1211
1341
|
}
|
|
@@ -1217,7 +1347,7 @@ function updateQueryParam(uri = "", key, value) {
|
|
|
1217
1347
|
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
1218
1348
|
}
|
|
1219
1349
|
function getShopifyImageUrl(src, size) {
|
|
1220
|
-
if (!src || !
|
|
1350
|
+
if (!src || !src?.match(/cdn\.shopify\.com/) || !size)
|
|
1221
1351
|
return src;
|
|
1222
1352
|
if (size === "master")
|
|
1223
1353
|
return removeProtocol(src);
|
|
@@ -1260,12 +1390,11 @@ function getSrcSet(url) {
|
|
|
1260
1390
|
]).join(", ");
|
|
1261
1391
|
return url;
|
|
1262
1392
|
}
|
|
1393
|
+
|
|
1263
1394
|
const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1264
|
-
var _a, _b, _c, _d;
|
|
1265
1395
|
_jsxBranch();
|
|
1266
1396
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES, "Image_component_useStylesScoped_fBMYiVf9fuU"));
|
|
1267
1397
|
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1268
|
-
var _a2;
|
|
1269
1398
|
const [props2] = useLexicalScope();
|
|
1270
1399
|
const imageToUse = props2.image || props2.src;
|
|
1271
1400
|
const url = imageToUse;
|
|
@@ -1273,7 +1402,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1273
1402
|
// images, otherwise you can supply this prop manually
|
|
1274
1403
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
|
|
1275
1404
|
return props2.srcset;
|
|
1276
|
-
if (props2.srcset &&
|
|
1405
|
+
if (props2.srcset && props2.image?.includes("builder.io/api/v1/image")) {
|
|
1277
1406
|
if (!props2.srcset.includes(props2.image.split("?")[0])) {
|
|
1278
1407
|
console.debug("Removed given srcset");
|
|
1279
1408
|
return getSrcSet(url);
|
|
@@ -1285,9 +1414,8 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1285
1414
|
props
|
|
1286
1415
|
]));
|
|
1287
1416
|
const webpSrcSet = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1288
|
-
var _a2;
|
|
1289
1417
|
const [props2, srcSetToUse2] = useLexicalScope();
|
|
1290
|
-
if (
|
|
1418
|
+
if (srcSetToUse2.value?.match(/builder\.io/) && !props2.noWebp)
|
|
1291
1419
|
return srcSetToUse2.value.replace(/\?/g, "?format=webp&");
|
|
1292
1420
|
else
|
|
1293
1421
|
return "";
|
|
@@ -1348,7 +1476,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1348
1476
|
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}')
|
|
1349
1477
|
}, null, 3, null)
|
|
1350
1478
|
], 1, null),
|
|
1351
|
-
props.aspectRatio && !(
|
|
1479
|
+
props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent) ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
1352
1480
|
class: "builder-image-sizer div-Image",
|
|
1353
1481
|
style: _fnSignal((p0) => ({
|
|
1354
1482
|
paddingTop: p0.aspectRatio * 100 + "%"
|
|
@@ -1356,7 +1484,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1356
1484
|
props
|
|
1357
1485
|
], '{paddingTop:p0.aspectRatio*100+"%"}')
|
|
1358
1486
|
}, null, 3, "0A_1") : null,
|
|
1359
|
-
|
|
1487
|
+
props.builderBlock?.children?.length && props.fitContent ? /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_2") : null,
|
|
1360
1488
|
!props.fitContent && props.children ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
1361
1489
|
class: "div-Image-2"
|
|
1362
1490
|
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_3"), 1, "0A_4") : null
|
|
@@ -1384,6 +1512,7 @@ const STYLES = `
|
|
|
1384
1512
|
height: 100%;
|
|
1385
1513
|
}
|
|
1386
1514
|
`;
|
|
1515
|
+
|
|
1387
1516
|
const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1388
1517
|
return /* @__PURE__ */ _jsxS("section", {
|
|
1389
1518
|
...props.attributes,
|
|
@@ -1402,6 +1531,7 @@ const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
1402
1531
|
}
|
|
1403
1532
|
}, null, 0, "2Y_1");
|
|
1404
1533
|
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1534
|
+
|
|
1405
1535
|
const getTopLevelDomain = (host) => {
|
|
1406
1536
|
if (host === "localhost" || host === "127.0.0.1")
|
|
1407
1537
|
return host;
|
|
@@ -1410,14 +1540,14 @@ const getTopLevelDomain = (host) => {
|
|
|
1410
1540
|
return parts.slice(1).join(".");
|
|
1411
1541
|
return host;
|
|
1412
1542
|
};
|
|
1543
|
+
|
|
1413
1544
|
const getCookieSync = ({ name, canTrack }) => {
|
|
1414
|
-
var _a;
|
|
1415
1545
|
try {
|
|
1416
1546
|
if (!canTrack)
|
|
1417
1547
|
return void 0;
|
|
1418
|
-
return
|
|
1548
|
+
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
1419
1549
|
} catch (err) {
|
|
1420
|
-
logger.warn("[COOKIE] GET error: ",
|
|
1550
|
+
logger.warn("[COOKIE] GET error: ", err?.message || err);
|
|
1421
1551
|
return void 0;
|
|
1422
1552
|
}
|
|
1423
1553
|
};
|
|
@@ -1476,9 +1606,10 @@ const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
|
1476
1606
|
});
|
|
1477
1607
|
document.cookie = cookie;
|
|
1478
1608
|
} catch (err) {
|
|
1479
|
-
logger.warn("[COOKIE] SET error: ",
|
|
1609
|
+
logger.warn("[COOKIE] SET error: ", err?.message || err);
|
|
1480
1610
|
}
|
|
1481
1611
|
};
|
|
1612
|
+
|
|
1482
1613
|
const BUILDER_STORE_PREFIX = "builder.tests";
|
|
1483
1614
|
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
1484
1615
|
const getContentVariationCookie = ({ contentId }) => getCookie({
|
|
@@ -1496,11 +1627,10 @@ const setContentVariationCookie = ({ contentId, value }) => setCookie({
|
|
|
1496
1627
|
});
|
|
1497
1628
|
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
1498
1629
|
const getRandomVariationId = ({ id, variations }) => {
|
|
1499
|
-
var _a;
|
|
1500
1630
|
let n = 0;
|
|
1501
1631
|
const random = Math.random();
|
|
1502
1632
|
for (const id2 in variations) {
|
|
1503
|
-
const testRatio =
|
|
1633
|
+
const testRatio = variations[id2]?.testRatio;
|
|
1504
1634
|
n += testRatio;
|
|
1505
1635
|
if (random < n)
|
|
1506
1636
|
return id2;
|
|
@@ -1575,7 +1705,9 @@ const handleABTesting = async ({ item, canTrack }) => {
|
|
|
1575
1705
|
...variationValue
|
|
1576
1706
|
};
|
|
1577
1707
|
};
|
|
1708
|
+
|
|
1578
1709
|
const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1710
|
+
|
|
1579
1711
|
const componentInfo$a = {
|
|
1580
1712
|
name: "Core:Button",
|
|
1581
1713
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1614,6 +1746,7 @@ const componentInfo$a = {
|
|
|
1614
1746
|
static: true,
|
|
1615
1747
|
noWrap: true
|
|
1616
1748
|
};
|
|
1749
|
+
|
|
1617
1750
|
const componentInfo$9 = {
|
|
1618
1751
|
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
1619
1752
|
name: "Columns",
|
|
@@ -1856,6 +1989,7 @@ const componentInfo$9 = {
|
|
|
1856
1989
|
}
|
|
1857
1990
|
]
|
|
1858
1991
|
};
|
|
1992
|
+
|
|
1859
1993
|
const componentInfo$8 = {
|
|
1860
1994
|
name: "Fragment",
|
|
1861
1995
|
static: true,
|
|
@@ -1863,6 +1997,7 @@ const componentInfo$8 = {
|
|
|
1863
1997
|
canHaveChildren: true,
|
|
1864
1998
|
noWrap: true
|
|
1865
1999
|
};
|
|
2000
|
+
|
|
1866
2001
|
const componentInfo$7 = {
|
|
1867
2002
|
name: "Image",
|
|
1868
2003
|
static: true,
|
|
@@ -1910,7 +2045,7 @@ const componentInfo$7 = {
|
|
|
1910
2045
|
}, timeout);
|
|
1911
2046
|
});
|
|
1912
2047
|
}
|
|
1913
|
-
function
|
|
2048
|
+
function round(num) {
|
|
1914
2049
|
return Math.round(num * 1e3) / 1e3;
|
|
1915
2050
|
}
|
|
1916
2051
|
const value = options.get("image");
|
|
@@ -1924,7 +2059,7 @@ const componentInfo$7 = {
|
|
|
1924
2059
|
const possiblyUpdatedAspectRatio = options.get("aspectRatio");
|
|
1925
2060
|
if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
1926
2061
|
if (img.width && img.height) {
|
|
1927
|
-
options.set("aspectRatio",
|
|
2062
|
+
options.set("aspectRatio", round(img.height / img.width));
|
|
1928
2063
|
options.set("height", img.height);
|
|
1929
2064
|
options.set("width", img.width);
|
|
1930
2065
|
}
|
|
@@ -2011,6 +2146,7 @@ const componentInfo$7 = {
|
|
|
2011
2146
|
}
|
|
2012
2147
|
]
|
|
2013
2148
|
};
|
|
2149
|
+
|
|
2014
2150
|
const componentInfo$6 = {
|
|
2015
2151
|
name: "Core:Section",
|
|
2016
2152
|
static: true,
|
|
@@ -2056,6 +2192,7 @@ const componentInfo$6 = {
|
|
|
2056
2192
|
}
|
|
2057
2193
|
]
|
|
2058
2194
|
};
|
|
2195
|
+
|
|
2059
2196
|
const componentInfo$5 = {
|
|
2060
2197
|
name: "Symbol",
|
|
2061
2198
|
noWrap: true,
|
|
@@ -2096,6 +2233,7 @@ const componentInfo$5 = {
|
|
|
2096
2233
|
}
|
|
2097
2234
|
]
|
|
2098
2235
|
};
|
|
2236
|
+
|
|
2099
2237
|
const componentInfo$4 = {
|
|
2100
2238
|
name: "Text",
|
|
2101
2239
|
static: true,
|
|
@@ -2117,13 +2255,11 @@ const componentInfo$4 = {
|
|
|
2117
2255
|
textAlign: "center"
|
|
2118
2256
|
}
|
|
2119
2257
|
};
|
|
2258
|
+
|
|
2120
2259
|
const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2121
2260
|
return /* @__PURE__ */ _jsxQ("div", null, {
|
|
2122
2261
|
class: "builder-text",
|
|
2123
|
-
dangerouslySetInnerHTML: _fnSignal((p0) =>
|
|
2124
|
-
var _a;
|
|
2125
|
-
return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
|
|
2126
|
-
}, [
|
|
2262
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.text?.toString() || "", [
|
|
2127
2263
|
props
|
|
2128
2264
|
], 'p0.text?.toString()||""'),
|
|
2129
2265
|
style: {
|
|
@@ -2131,6 +2267,7 @@ const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2131
2267
|
}
|
|
2132
2268
|
}, null, 3, "yO_0");
|
|
2133
2269
|
}, "Text_component_15p0cKUxgIE"));
|
|
2270
|
+
|
|
2134
2271
|
const componentInfo$3 = {
|
|
2135
2272
|
name: "Video",
|
|
2136
2273
|
canHaveChildren: true,
|
|
@@ -2253,6 +2390,7 @@ const componentInfo$3 = {
|
|
|
2253
2390
|
}
|
|
2254
2391
|
]
|
|
2255
2392
|
};
|
|
2393
|
+
|
|
2256
2394
|
const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2257
2395
|
const videoProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
2258
2396
|
const [props2] = useLexicalScope();
|
|
@@ -2298,23 +2436,21 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2298
2436
|
src: _fnSignal((p0) => p0.video || "no-src", [
|
|
2299
2437
|
props
|
|
2300
2438
|
], 'p0.video||"no-src"'),
|
|
2301
|
-
style: _fnSignal((p0) => {
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
borderRadius: 1
|
|
2312
|
-
};
|
|
2313
|
-
}, [
|
|
2439
|
+
style: _fnSignal((p0) => ({
|
|
2440
|
+
width: "100%",
|
|
2441
|
+
height: "100%",
|
|
2442
|
+
...p0.attributes?.style,
|
|
2443
|
+
objectFit: p0.fit,
|
|
2444
|
+
objectPosition: p0.position,
|
|
2445
|
+
// Hack to get object fit to work as expected and
|
|
2446
|
+
// not have the video overflow
|
|
2447
|
+
borderRadius: 1
|
|
2448
|
+
}), [
|
|
2314
2449
|
props
|
|
2315
2450
|
], '{width:"100%",height:"100%",...p0.attributes?.style,objectFit:p0.fit,objectPosition:p0.position,borderRadius:1}')
|
|
2316
2451
|
}, 0, "j7_0");
|
|
2317
2452
|
}, "Video_component_qdcTZflYyoQ"));
|
|
2453
|
+
|
|
2318
2454
|
const componentInfo$2 = {
|
|
2319
2455
|
name: "Embed",
|
|
2320
2456
|
static: true,
|
|
@@ -2352,13 +2488,15 @@ const componentInfo$2 = {
|
|
|
2352
2488
|
}
|
|
2353
2489
|
]
|
|
2354
2490
|
};
|
|
2491
|
+
|
|
2355
2492
|
const SCRIPT_MIME_TYPES = [
|
|
2356
2493
|
"text/javascript",
|
|
2357
2494
|
"application/javascript",
|
|
2358
2495
|
"application/ecmascript"
|
|
2359
2496
|
];
|
|
2360
2497
|
const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
2361
|
-
|
|
2498
|
+
|
|
2499
|
+
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
2362
2500
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
2363
2501
|
return;
|
|
2364
2502
|
const scripts = elem.value.getElementsByTagName("script");
|
|
@@ -2386,13 +2524,13 @@ const Embed = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2386
2524
|
scriptsInserted: [],
|
|
2387
2525
|
scriptsRun: []
|
|
2388
2526
|
});
|
|
2389
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
2527
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
2390
2528
|
const [elem2, props2, state2] = useLexicalScope();
|
|
2391
|
-
|
|
2392
|
-
|
|
2529
|
+
track(() => elem2.value);
|
|
2530
|
+
track(() => state2.ranInitFn);
|
|
2393
2531
|
if (elem2.value && !state2.ranInitFn) {
|
|
2394
2532
|
state2.ranInitFn = true;
|
|
2395
|
-
findAndRunScripts
|
|
2533
|
+
findAndRunScripts(props2, state2, elem2);
|
|
2396
2534
|
}
|
|
2397
2535
|
}, "Embed_component_useTask_bg7ez0XUtiM", [
|
|
2398
2536
|
elem,
|
|
@@ -2408,6 +2546,7 @@ const Embed = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2408
2546
|
], "p0.content")
|
|
2409
2547
|
}, null, 3, "9r_0");
|
|
2410
2548
|
}, "Embed_component_Uji08ORjXbE"));
|
|
2549
|
+
|
|
2411
2550
|
const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2412
2551
|
return /* @__PURE__ */ _jsxS("img", {
|
|
2413
2552
|
...props.attributes
|
|
@@ -2426,6 +2565,7 @@ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
2426
2565
|
], '{objectFit:p0.backgroundSize||"cover",objectPosition:p0.backgroundPosition||"center"}')
|
|
2427
2566
|
}, 0, isEditing() && props.imgSrc || "default-key");
|
|
2428
2567
|
}, "ImgComponent_component_FXvIDBSffO8"));
|
|
2568
|
+
|
|
2429
2569
|
const componentInfo$1 = {
|
|
2430
2570
|
// friendlyName?
|
|
2431
2571
|
name: "Raw:Img",
|
|
@@ -2450,15 +2590,24 @@ const componentInfo$1 = {
|
|
|
2450
2590
|
noWrap: true,
|
|
2451
2591
|
static: true
|
|
2452
2592
|
};
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2593
|
+
|
|
2594
|
+
const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2595
|
+
const elementRef = useSignal();
|
|
2596
|
+
const state = useStore({
|
|
2597
|
+
scriptsInserted: [],
|
|
2598
|
+
scriptsRun: []
|
|
2599
|
+
});
|
|
2600
|
+
useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
2601
|
+
const [state2] = useLexicalScope();
|
|
2602
|
+
if (!element?.getElementsByTagName || typeof window === "undefined")
|
|
2603
|
+
return;
|
|
2604
|
+
const scripts = element.getElementsByTagName("script");
|
|
2456
2605
|
for (let i = 0; i < scripts.length; i++) {
|
|
2457
2606
|
const script = scripts[i];
|
|
2458
2607
|
if (script.src) {
|
|
2459
|
-
if (
|
|
2608
|
+
if (state2.scriptsInserted.includes(script.src))
|
|
2460
2609
|
continue;
|
|
2461
|
-
|
|
2610
|
+
state2.scriptsInserted.push(script.src);
|
|
2462
2611
|
const newScript = document.createElement("script");
|
|
2463
2612
|
newScript.async = true;
|
|
2464
2613
|
newScript.src = script.src;
|
|
@@ -2468,34 +2617,21 @@ const findAndRunScripts = function findAndRunScripts22(props, state, elem) {
|
|
|
2468
2617
|
"application/javascript",
|
|
2469
2618
|
"application/ecmascript"
|
|
2470
2619
|
].includes(script.type)) {
|
|
2471
|
-
if (
|
|
2620
|
+
if (state2.scriptsRun.includes(script.innerText))
|
|
2472
2621
|
continue;
|
|
2473
2622
|
try {
|
|
2474
|
-
|
|
2623
|
+
state2.scriptsRun.push(script.innerText);
|
|
2475
2624
|
new Function(script.innerText)();
|
|
2476
2625
|
} catch (error) {
|
|
2477
2626
|
console.warn("`CustomCode`: Error running script:", error);
|
|
2478
2627
|
}
|
|
2479
2628
|
}
|
|
2480
2629
|
}
|
|
2481
|
-
}
|
|
2482
|
-
};
|
|
2483
|
-
const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2484
|
-
const elem = useSignal();
|
|
2485
|
-
const state = useStore({
|
|
2486
|
-
scriptsInserted: [],
|
|
2487
|
-
scriptsRun: []
|
|
2488
|
-
});
|
|
2489
|
-
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
2490
|
-
const [elem2, props2, state2] = useLexicalScope();
|
|
2491
|
-
findAndRunScripts(props2, state2, elem2);
|
|
2492
|
-
}, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
|
|
2493
|
-
elem,
|
|
2494
|
-
props,
|
|
2630
|
+
}, "CustomCode_component_useOn_zjAgBhFOiCs", [
|
|
2495
2631
|
state
|
|
2496
2632
|
]));
|
|
2497
2633
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
2498
|
-
ref:
|
|
2634
|
+
ref: elementRef
|
|
2499
2635
|
}, {
|
|
2500
2636
|
class: _fnSignal((p0) => "builder-custom-code" + (p0.replaceNodes ? " replace-nodes" : ""), [
|
|
2501
2637
|
props
|
|
@@ -2505,6 +2641,7 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
2505
2641
|
], "p0.code")
|
|
2506
2642
|
}, null, 3, "bY_0");
|
|
2507
2643
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
2644
|
+
|
|
2508
2645
|
const componentInfo = {
|
|
2509
2646
|
name: "Custom Code",
|
|
2510
2647
|
static: true,
|
|
@@ -2534,6 +2671,7 @@ const componentInfo = {
|
|
|
2534
2671
|
}
|
|
2535
2672
|
]
|
|
2536
2673
|
};
|
|
2674
|
+
|
|
2537
2675
|
const getDefaultRegisteredComponents = () => [
|
|
2538
2676
|
{
|
|
2539
2677
|
component: Button,
|
|
@@ -2580,6 +2718,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
2580
2718
|
...componentInfo$3
|
|
2581
2719
|
}
|
|
2582
2720
|
];
|
|
2721
|
+
|
|
2583
2722
|
const components = [];
|
|
2584
2723
|
const createRegisterComponentMessage = (info) => ({
|
|
2585
2724
|
type: "builder.registerComponent",
|
|
@@ -2593,15 +2732,16 @@ const serializeFn = (fnValue) => {
|
|
|
2593
2732
|
const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
|
|
2594
2733
|
const serializeComponentInfo = ({ inputs, ...info }) => ({
|
|
2595
2734
|
...fastClone(info),
|
|
2596
|
-
inputs: inputs
|
|
2735
|
+
inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
|
|
2597
2736
|
...acc,
|
|
2598
2737
|
[key]: serializeValue(value)
|
|
2599
2738
|
}), {}))
|
|
2600
2739
|
});
|
|
2601
|
-
|
|
2740
|
+
|
|
2741
|
+
const getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2602
2742
|
...variant,
|
|
2603
2743
|
testVariationId: variant.id,
|
|
2604
|
-
id: content
|
|
2744
|
+
id: content?.id
|
|
2605
2745
|
}));
|
|
2606
2746
|
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
2607
2747
|
const hasVariants = getVariants(content).length > 0;
|
|
@@ -2614,9 +2754,8 @@ const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
|
2614
2754
|
return true;
|
|
2615
2755
|
};
|
|
2616
2756
|
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
function setCookie2(name, value, days) {
|
|
2757
|
+
function getAndSetVariantId() {
|
|
2758
|
+
function setCookie(name, value, days) {
|
|
2620
2759
|
let expires = "";
|
|
2621
2760
|
if (days) {
|
|
2622
2761
|
const date = /* @__PURE__ */ new Date();
|
|
@@ -2625,7 +2764,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2625
2764
|
}
|
|
2626
2765
|
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2627
2766
|
}
|
|
2628
|
-
function
|
|
2767
|
+
function getCookie(name) {
|
|
2629
2768
|
const nameEQ = name + "=";
|
|
2630
2769
|
const ca = document.cookie.split(";");
|
|
2631
2770
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -2638,7 +2777,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2638
2777
|
return null;
|
|
2639
2778
|
}
|
|
2640
2779
|
const cookieName = `builder.tests.${contentId}`;
|
|
2641
|
-
const variantInCookie =
|
|
2780
|
+
const variantInCookie = getCookie(cookieName);
|
|
2642
2781
|
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2643
2782
|
if (variantInCookie && availableIDs.includes(variantInCookie))
|
|
2644
2783
|
return variantInCookie;
|
|
@@ -2649,19 +2788,19 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2649
2788
|
const testRatio = variant.testRatio;
|
|
2650
2789
|
n += testRatio;
|
|
2651
2790
|
if (random < n) {
|
|
2652
|
-
|
|
2791
|
+
setCookie(cookieName, variant.id);
|
|
2653
2792
|
return variant.id;
|
|
2654
2793
|
}
|
|
2655
2794
|
}
|
|
2656
|
-
|
|
2795
|
+
setCookie(cookieName, contentId);
|
|
2657
2796
|
return contentId;
|
|
2658
2797
|
}
|
|
2659
|
-
const winningVariantId =
|
|
2660
|
-
const styleEl =
|
|
2798
|
+
const winningVariantId = getAndSetVariantId();
|
|
2799
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
2661
2800
|
if (isHydrationTarget2) {
|
|
2662
2801
|
styleEl.remove();
|
|
2663
2802
|
const thisScriptEl = document.currentScript;
|
|
2664
|
-
thisScriptEl
|
|
2803
|
+
thisScriptEl?.remove();
|
|
2665
2804
|
} else {
|
|
2666
2805
|
const newStyleStr = variants.concat({
|
|
2667
2806
|
id: contentId
|
|
@@ -2673,10 +2812,9 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2673
2812
|
}
|
|
2674
2813
|
}
|
|
2675
2814
|
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2676
|
-
var _a;
|
|
2677
2815
|
if (!navigator.cookieEnabled)
|
|
2678
2816
|
return;
|
|
2679
|
-
function
|
|
2817
|
+
function getCookie(name) {
|
|
2680
2818
|
const nameEQ = name + "=";
|
|
2681
2819
|
const ca = document.cookie.split(";");
|
|
2682
2820
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -2689,21 +2827,21 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
2689
2827
|
return null;
|
|
2690
2828
|
}
|
|
2691
2829
|
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2692
|
-
const variantId =
|
|
2693
|
-
const parentDiv =
|
|
2830
|
+
const variantId = getCookie(cookieName);
|
|
2831
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
2694
2832
|
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2695
2833
|
if (variantId === variantContentId) {
|
|
2696
2834
|
if (variantIsDefaultContent)
|
|
2697
2835
|
return;
|
|
2698
|
-
parentDiv
|
|
2699
|
-
parentDiv
|
|
2836
|
+
parentDiv?.removeAttribute("hidden");
|
|
2837
|
+
parentDiv?.removeAttribute("aria-hidden");
|
|
2700
2838
|
} else {
|
|
2701
2839
|
if (variantIsDefaultContent) {
|
|
2702
2840
|
if (isHydrationTarget2)
|
|
2703
|
-
parentDiv
|
|
2841
|
+
parentDiv?.remove();
|
|
2704
2842
|
else {
|
|
2705
|
-
parentDiv
|
|
2706
|
-
parentDiv
|
|
2843
|
+
parentDiv?.setAttribute("hidden", "true");
|
|
2844
|
+
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2707
2845
|
}
|
|
2708
2846
|
}
|
|
2709
2847
|
return;
|
|
@@ -2730,6 +2868,7 @@ const getRenderContentScriptString = ({ contentId, variationId }) => {
|
|
|
2730
2868
|
return `
|
|
2731
2869
|
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
2732
2870
|
};
|
|
2871
|
+
|
|
2733
2872
|
const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2734
2873
|
return /* @__PURE__ */ _jsxQ("script", null, {
|
|
2735
2874
|
dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
|
|
@@ -2740,6 +2879,7 @@ const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
2740
2879
|
], "p0.id")
|
|
2741
2880
|
}, null, 3, "WO_0");
|
|
2742
2881
|
}, "InlinedScript_component_hwThBdhA8rw"));
|
|
2882
|
+
|
|
2743
2883
|
function getGlobalThis() {
|
|
2744
2884
|
if (typeof globalThis !== "undefined")
|
|
2745
2885
|
return globalThis;
|
|
@@ -2751,6 +2891,7 @@ function getGlobalThis() {
|
|
|
2751
2891
|
return self;
|
|
2752
2892
|
return globalThis;
|
|
2753
2893
|
}
|
|
2894
|
+
|
|
2754
2895
|
function getFetch() {
|
|
2755
2896
|
const globalFetch = getGlobalThis().fetch;
|
|
2756
2897
|
if (typeof globalFetch === "undefined") {
|
|
@@ -2761,6 +2902,7 @@ function getFetch() {
|
|
|
2761
2902
|
return globalFetch;
|
|
2762
2903
|
}
|
|
2763
2904
|
const fetch$1 = getFetch();
|
|
2905
|
+
|
|
2764
2906
|
function flatten(object, path = null, separator = ".") {
|
|
2765
2907
|
return Object.keys(object).reduce((acc, key) => {
|
|
2766
2908
|
const value = object[key];
|
|
@@ -2782,6 +2924,7 @@ function flatten(object, path = null, separator = ".") {
|
|
|
2782
2924
|
};
|
|
2783
2925
|
}, {});
|
|
2784
2926
|
}
|
|
2927
|
+
|
|
2785
2928
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
2786
2929
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
2787
2930
|
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
@@ -2811,7 +2954,9 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
2811
2954
|
return getBuilderSearchParams(searchParams);
|
|
2812
2955
|
};
|
|
2813
2956
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
2957
|
+
|
|
2814
2958
|
const DEFAULT_API_VERSION = "v3";
|
|
2959
|
+
|
|
2815
2960
|
const generateContentUrl = (options) => {
|
|
2816
2961
|
let { noTraverse = false } = options;
|
|
2817
2962
|
const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
@@ -2843,6 +2988,7 @@ const generateContentUrl = (options) => {
|
|
|
2843
2988
|
}
|
|
2844
2989
|
return url;
|
|
2845
2990
|
};
|
|
2991
|
+
|
|
2846
2992
|
const checkContentHasResults = (content) => "results" in content;
|
|
2847
2993
|
async function fetchOneEntry(options) {
|
|
2848
2994
|
const allContent = await fetchEntries({
|
|
@@ -2899,6 +3045,7 @@ async function fetchEntries(options) {
|
|
|
2899
3045
|
}
|
|
2900
3046
|
}
|
|
2901
3047
|
const getAllContent = fetchEntries;
|
|
3048
|
+
|
|
2902
3049
|
function isPreviewing() {
|
|
2903
3050
|
if (!isBrowser())
|
|
2904
3051
|
return false;
|
|
@@ -2906,6 +3053,7 @@ function isPreviewing() {
|
|
|
2906
3053
|
return false;
|
|
2907
3054
|
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2908
3055
|
}
|
|
3056
|
+
|
|
2909
3057
|
function uuidv4() {
|
|
2910
3058
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
2911
3059
|
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
@@ -2915,6 +3063,7 @@ function uuidv4() {
|
|
|
2915
3063
|
function uuid() {
|
|
2916
3064
|
return uuidv4().replace(/-/g, "");
|
|
2917
3065
|
}
|
|
3066
|
+
|
|
2918
3067
|
const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
2919
3068
|
const getSessionId = async ({ canTrack }) => {
|
|
2920
3069
|
if (!canTrack)
|
|
@@ -2940,12 +3089,12 @@ const setSessionId = ({ id, canTrack }) => setCookie({
|
|
|
2940
3089
|
value: id,
|
|
2941
3090
|
canTrack
|
|
2942
3091
|
});
|
|
3092
|
+
|
|
2943
3093
|
const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
2944
3094
|
const getLocalStorageItem = ({ key, canTrack }) => {
|
|
2945
|
-
var _a;
|
|
2946
3095
|
try {
|
|
2947
3096
|
if (canTrack)
|
|
2948
|
-
return
|
|
3097
|
+
return getLocalStorage()?.getItem(key);
|
|
2949
3098
|
return void 0;
|
|
2950
3099
|
} catch (err) {
|
|
2951
3100
|
console.debug("[LocalStorage] GET error: ", err);
|
|
@@ -2953,14 +3102,14 @@ const getLocalStorageItem = ({ key, canTrack }) => {
|
|
|
2953
3102
|
}
|
|
2954
3103
|
};
|
|
2955
3104
|
const setLocalStorageItem = ({ key, canTrack, value }) => {
|
|
2956
|
-
var _a;
|
|
2957
3105
|
try {
|
|
2958
3106
|
if (canTrack)
|
|
2959
|
-
|
|
3107
|
+
getLocalStorage()?.setItem(key, value);
|
|
2960
3108
|
} catch (err) {
|
|
2961
3109
|
console.debug("[LocalStorage] SET error: ", err);
|
|
2962
3110
|
}
|
|
2963
3111
|
};
|
|
3112
|
+
|
|
2964
3113
|
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
2965
3114
|
const getVisitorId = ({ canTrack }) => {
|
|
2966
3115
|
if (!canTrack)
|
|
@@ -2986,6 +3135,7 @@ const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
|
|
|
2986
3135
|
value: id,
|
|
2987
3136
|
canTrack
|
|
2988
3137
|
});
|
|
3138
|
+
|
|
2989
3139
|
const getTrackingEventData = async ({ canTrack }) => {
|
|
2990
3140
|
if (!canTrack)
|
|
2991
3141
|
return {
|
|
@@ -3048,25 +3198,26 @@ const track = (args) => _track({
|
|
|
3048
3198
|
...args,
|
|
3049
3199
|
canTrack: true
|
|
3050
3200
|
});
|
|
3201
|
+
|
|
3051
3202
|
function round(num) {
|
|
3052
3203
|
return Math.round(num * 1e3) / 1e3;
|
|
3053
3204
|
}
|
|
3054
3205
|
const findParentElement = (target, callback, checkElement = true) => {
|
|
3055
3206
|
if (!(target instanceof HTMLElement))
|
|
3056
3207
|
return null;
|
|
3057
|
-
let
|
|
3208
|
+
let parent = checkElement ? target : target.parentElement;
|
|
3058
3209
|
do {
|
|
3059
|
-
if (!
|
|
3210
|
+
if (!parent)
|
|
3060
3211
|
return null;
|
|
3061
|
-
const matches = callback(
|
|
3212
|
+
const matches = callback(parent);
|
|
3062
3213
|
if (matches)
|
|
3063
|
-
return
|
|
3064
|
-
} while (
|
|
3214
|
+
return parent;
|
|
3215
|
+
} while (parent = parent.parentElement);
|
|
3065
3216
|
return null;
|
|
3066
3217
|
};
|
|
3067
3218
|
const findBuilderParent = (target) => findParentElement(target, (el) => {
|
|
3068
3219
|
const id = el.getAttribute("builder-id") || el.id;
|
|
3069
|
-
return Boolean(
|
|
3220
|
+
return Boolean(id?.indexOf("builder-") === 0);
|
|
3070
3221
|
});
|
|
3071
3222
|
const computeOffset = ({ event, target }) => {
|
|
3072
3223
|
const targetRect = target.getBoundingClientRect();
|
|
@@ -3082,7 +3233,7 @@ const computeOffset = ({ event, target }) => {
|
|
|
3082
3233
|
const getInteractionPropertiesForEvent = (event) => {
|
|
3083
3234
|
const target = event.target;
|
|
3084
3235
|
const targetBuilderElement = target && findBuilderParent(target);
|
|
3085
|
-
const builderId =
|
|
3236
|
+
const builderId = targetBuilderElement?.getAttribute("builder-id") || targetBuilderElement?.id;
|
|
3086
3237
|
return {
|
|
3087
3238
|
targetBuilderElement: builderId || void 0,
|
|
3088
3239
|
metadata: {
|
|
@@ -3098,7 +3249,9 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
3098
3249
|
}
|
|
3099
3250
|
};
|
|
3100
3251
|
};
|
|
3101
|
-
|
|
3252
|
+
|
|
3253
|
+
const SDK_VERSION = "0.7.1-3";
|
|
3254
|
+
|
|
3102
3255
|
const registry = {};
|
|
3103
3256
|
function register(type, info) {
|
|
3104
3257
|
let typeList = registry[type];
|
|
@@ -3122,6 +3275,7 @@ function register(type, info) {
|
|
|
3122
3275
|
}
|
|
3123
3276
|
}
|
|
3124
3277
|
}
|
|
3278
|
+
|
|
3125
3279
|
const registerInsertMenu = () => {
|
|
3126
3280
|
register("insertMenu", {
|
|
3127
3281
|
name: "_default",
|
|
@@ -3158,12 +3312,11 @@ const registerInsertMenu = () => {
|
|
|
3158
3312
|
};
|
|
3159
3313
|
let isSetupForEditing = false;
|
|
3160
3314
|
const setupBrowserForEditing = (options = {}) => {
|
|
3161
|
-
var _a, _b;
|
|
3162
3315
|
if (isSetupForEditing)
|
|
3163
3316
|
return;
|
|
3164
3317
|
isSetupForEditing = true;
|
|
3165
3318
|
if (isBrowser()) {
|
|
3166
|
-
|
|
3319
|
+
window.parent?.postMessage({
|
|
3167
3320
|
type: "builder.sdkInfo",
|
|
3168
3321
|
data: {
|
|
3169
3322
|
target: TARGET,
|
|
@@ -3175,15 +3328,14 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3175
3328
|
supportsCustomBreakpoints: true
|
|
3176
3329
|
}
|
|
3177
3330
|
}, "*");
|
|
3178
|
-
|
|
3331
|
+
window.parent?.postMessage({
|
|
3179
3332
|
type: "builder.updateContent",
|
|
3180
3333
|
data: {
|
|
3181
3334
|
options
|
|
3182
3335
|
}
|
|
3183
3336
|
}, "*");
|
|
3184
3337
|
window.addEventListener("message", ({ data }) => {
|
|
3185
|
-
|
|
3186
|
-
if (!(data == null ? void 0 : data.type))
|
|
3338
|
+
if (!data?.type)
|
|
3187
3339
|
return;
|
|
3188
3340
|
switch (data.type) {
|
|
3189
3341
|
case "builder.evaluate": {
|
|
@@ -3199,7 +3351,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3199
3351
|
error = err;
|
|
3200
3352
|
}
|
|
3201
3353
|
if (error)
|
|
3202
|
-
|
|
3354
|
+
window.parent?.postMessage({
|
|
3203
3355
|
type: "builder.evaluateError",
|
|
3204
3356
|
data: {
|
|
3205
3357
|
id,
|
|
@@ -3208,8 +3360,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3208
3360
|
}, "*");
|
|
3209
3361
|
else if (result && typeof result.then === "function")
|
|
3210
3362
|
result.then((finalResult) => {
|
|
3211
|
-
|
|
3212
|
-
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
3363
|
+
window.parent?.postMessage({
|
|
3213
3364
|
type: "builder.evaluateResult",
|
|
3214
3365
|
data: {
|
|
3215
3366
|
id,
|
|
@@ -3218,7 +3369,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3218
3369
|
}, "*");
|
|
3219
3370
|
}).catch(console.error);
|
|
3220
3371
|
else
|
|
3221
|
-
|
|
3372
|
+
window.parent?.postMessage({
|
|
3222
3373
|
type: "builder.evaluateResult",
|
|
3223
3374
|
data: {
|
|
3224
3375
|
result,
|
|
@@ -3231,32 +3382,31 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3231
3382
|
});
|
|
3232
3383
|
}
|
|
3233
3384
|
};
|
|
3385
|
+
|
|
3234
3386
|
const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
|
|
3235
|
-
var _a, _b, _c, _d, _e;
|
|
3236
3387
|
const newContentValue = {
|
|
3237
3388
|
...props.builderContextSignal.content,
|
|
3238
3389
|
...newContent,
|
|
3239
3390
|
data: {
|
|
3240
|
-
...
|
|
3241
|
-
...newContent
|
|
3391
|
+
...props.builderContextSignal.content?.data,
|
|
3392
|
+
...newContent?.data
|
|
3242
3393
|
},
|
|
3243
3394
|
meta: {
|
|
3244
|
-
...
|
|
3245
|
-
...newContent
|
|
3246
|
-
breakpoints:
|
|
3395
|
+
...props.builderContextSignal.content?.meta,
|
|
3396
|
+
...newContent?.meta,
|
|
3397
|
+
breakpoints: newContent?.meta?.breakpoints || props.builderContextSignal.content?.meta?.breakpoints
|
|
3247
3398
|
}
|
|
3248
3399
|
};
|
|
3249
3400
|
props.builderContextSignal.content = newContentValue;
|
|
3250
3401
|
};
|
|
3251
3402
|
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
3252
|
-
var _a;
|
|
3253
3403
|
const { data } = event;
|
|
3254
3404
|
if (data)
|
|
3255
3405
|
switch (data.type) {
|
|
3256
3406
|
case "builder.configureSdk": {
|
|
3257
3407
|
const messageContent = data.data;
|
|
3258
3408
|
const { breakpoints, contentId } = messageContent;
|
|
3259
|
-
if (!contentId || contentId !==
|
|
3409
|
+
if (!contentId || contentId !== props.builderContextSignal.content?.id)
|
|
3260
3410
|
return;
|
|
3261
3411
|
if (breakpoints)
|
|
3262
3412
|
mergeNewContent(props, state, elementRef, {
|
|
@@ -3280,8 +3430,7 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3280
3430
|
}
|
|
3281
3431
|
};
|
|
3282
3432
|
const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
3283
|
-
|
|
3284
|
-
const jsCode = (_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
|
|
3433
|
+
const jsCode = props.builderContextSignal.content?.data?.jsCode;
|
|
3285
3434
|
if (jsCode)
|
|
3286
3435
|
evaluate({
|
|
3287
3436
|
code: jsCode,
|
|
@@ -3291,11 +3440,10 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
|
3291
3440
|
rootSetState: props.builderContextSignal.rootSetState
|
|
3292
3441
|
});
|
|
3293
3442
|
};
|
|
3294
|
-
const onClick = function
|
|
3295
|
-
var _a, _b;
|
|
3443
|
+
const onClick = function onClick2(props, state, elementRef, event) {
|
|
3296
3444
|
if (props.builderContextSignal.content) {
|
|
3297
|
-
const variationId =
|
|
3298
|
-
const contentId =
|
|
3445
|
+
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
3446
|
+
const contentId = props.builderContextSignal.content?.id;
|
|
3299
3447
|
_track({
|
|
3300
3448
|
type: "click",
|
|
3301
3449
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
@@ -3320,20 +3468,18 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
|
|
|
3320
3468
|
};
|
|
3321
3469
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
3322
3470
|
fetch$1(url).then((response) => response.json()).then((json) => {
|
|
3323
|
-
var _a, _b;
|
|
3324
3471
|
const newState = {
|
|
3325
3472
|
...props.builderContextSignal.rootState,
|
|
3326
3473
|
[key]: json
|
|
3327
3474
|
};
|
|
3328
|
-
|
|
3475
|
+
props.builderContextSignal.rootSetState?.(newState);
|
|
3329
3476
|
state.httpReqsData[key] = true;
|
|
3330
3477
|
}).catch((err) => {
|
|
3331
3478
|
console.error("error fetching dynamic data", url, err);
|
|
3332
3479
|
});
|
|
3333
3480
|
};
|
|
3334
3481
|
const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
|
|
3335
|
-
|
|
3336
|
-
const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
|
|
3482
|
+
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
3337
3483
|
Object.entries(requests).forEach(([key, url]) => {
|
|
3338
3484
|
if (url && (!state.httpReqsData[key] || isEditing())) {
|
|
3339
3485
|
const evaluatedUrl = evalExpression(props, state, elementRef, url);
|
|
@@ -3356,7 +3502,6 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3356
3502
|
}));
|
|
3357
3503
|
};
|
|
3358
3504
|
const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3359
|
-
var _a, _b, _c;
|
|
3360
3505
|
_jsxBranch();
|
|
3361
3506
|
const elementRef = useSignal();
|
|
3362
3507
|
const state = useStore({
|
|
@@ -3385,9 +3530,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3385
3530
|
} : {}
|
|
3386
3531
|
});
|
|
3387
3532
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3388
|
-
var _a2;
|
|
3389
3533
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
3390
|
-
|
|
3534
|
+
window.parent?.postMessage(message, "*");
|
|
3391
3535
|
});
|
|
3392
3536
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3393
3537
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
@@ -3416,15 +3560,14 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3416
3560
|
state
|
|
3417
3561
|
]));
|
|
3418
3562
|
useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
3419
|
-
var _a2, _b2, _c2, _d;
|
|
3420
3563
|
if (isBrowser()) {
|
|
3421
3564
|
if (isEditing() && element)
|
|
3422
3565
|
element.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
3423
|
-
const shouldTrackImpression =
|
|
3566
|
+
const shouldTrackImpression = element.attributes.getNamedItem("shouldTrack")?.value === "true";
|
|
3424
3567
|
if (shouldTrackImpression) {
|
|
3425
|
-
const variationId =
|
|
3426
|
-
const contentId =
|
|
3427
|
-
const apiKeyProp =
|
|
3568
|
+
const variationId = element.attributes.getNamedItem("variationId")?.value;
|
|
3569
|
+
const contentId = element.attributes.getNamedItem("contentId")?.value;
|
|
3570
|
+
const apiKeyProp = element.attributes.getNamedItem("apiKey")?.value;
|
|
3428
3571
|
_track({
|
|
3429
3572
|
type: "impression",
|
|
3430
3573
|
canTrack: true,
|
|
@@ -3450,9 +3593,9 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3450
3593
|
props,
|
|
3451
3594
|
state
|
|
3452
3595
|
]));
|
|
3453
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3596
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3454
3597
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3455
|
-
|
|
3598
|
+
track(() => props2.content);
|
|
3456
3599
|
if (props2.content)
|
|
3457
3600
|
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3458
3601
|
}, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
|
|
@@ -3460,40 +3603,34 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3460
3603
|
props,
|
|
3461
3604
|
state
|
|
3462
3605
|
]));
|
|
3463
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3606
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3464
3607
|
const [state2] = useLexicalScope();
|
|
3465
|
-
|
|
3608
|
+
track(() => state2.shouldSendResetCookie);
|
|
3466
3609
|
}, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
|
|
3467
3610
|
state
|
|
3468
3611
|
]));
|
|
3469
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3612
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3470
3613
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
3474
|
-
});
|
|
3475
|
-
track2(() => props2.builderContextSignal.rootState);
|
|
3614
|
+
track(() => props2.builderContextSignal.content?.data?.jsCode);
|
|
3615
|
+
track(() => props2.builderContextSignal.rootState);
|
|
3476
3616
|
evaluateJsCode(props2);
|
|
3477
3617
|
}, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
|
|
3478
3618
|
elementRef,
|
|
3479
3619
|
props,
|
|
3480
3620
|
state
|
|
3481
3621
|
]));
|
|
3482
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3622
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3483
3623
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3484
|
-
|
|
3485
|
-
var _a2, _b2;
|
|
3486
|
-
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
3487
|
-
});
|
|
3624
|
+
track(() => props2.builderContextSignal.content?.data?.httpRequests);
|
|
3488
3625
|
runHttpRequests(props2, state2, elementRef2);
|
|
3489
3626
|
}, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
|
|
3490
3627
|
elementRef,
|
|
3491
3628
|
props,
|
|
3492
3629
|
state
|
|
3493
3630
|
]));
|
|
3494
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3631
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3495
3632
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3496
|
-
|
|
3633
|
+
track(() => props2.builderContextSignal.rootState);
|
|
3497
3634
|
emitStateUpdate(props2);
|
|
3498
3635
|
}, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
|
|
3499
3636
|
elementRef,
|
|
@@ -3503,8 +3640,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3503
3640
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3504
3641
|
children: props.builderContextSignal.content ? /* @__PURE__ */ createElement("div", {
|
|
3505
3642
|
apiKey: props.apiKey,
|
|
3506
|
-
contentId:
|
|
3507
|
-
variationId:
|
|
3643
|
+
contentId: props.builderContextSignal.content?.id,
|
|
3644
|
+
variationId: props.builderContextSignal.content?.testVariationId,
|
|
3508
3645
|
shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
|
|
3509
3646
|
key: state.forceReRenderCount,
|
|
3510
3647
|
ref: elementRef,
|
|
@@ -3516,7 +3653,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3516
3653
|
props,
|
|
3517
3654
|
state
|
|
3518
3655
|
]),
|
|
3519
|
-
"builder-content-id":
|
|
3656
|
+
"builder-content-id": props.builderContextSignal.content?.id,
|
|
3520
3657
|
"builder-model": props.model,
|
|
3521
3658
|
...props.showContent ? {} : {
|
|
3522
3659
|
hidden: true,
|
|
@@ -3526,11 +3663,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3526
3663
|
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0")) : null
|
|
3527
3664
|
}, 1, "06_1");
|
|
3528
3665
|
}, "EnableEditor_component_ko1mO8oaj8k"));
|
|
3666
|
+
|
|
3529
3667
|
const getCssFromFont = (font) => {
|
|
3530
|
-
var _a;
|
|
3531
3668
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
3532
3669
|
const name = family.split(",")[0];
|
|
3533
|
-
const url = font.fileUrl ??
|
|
3670
|
+
const url = font.fileUrl ?? font?.files?.regular;
|
|
3534
3671
|
let str = "";
|
|
3535
3672
|
if (url && family && name)
|
|
3536
3673
|
str += `
|
|
@@ -3560,16 +3697,16 @@ font-weight: ${weight};
|
|
|
3560
3697
|
return str;
|
|
3561
3698
|
};
|
|
3562
3699
|
const getFontCss = ({ customFonts }) => {
|
|
3563
|
-
|
|
3564
|
-
return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
|
|
3700
|
+
return customFonts?.map((font) => getCssFromFont(font))?.join(" ") || "";
|
|
3565
3701
|
};
|
|
3566
3702
|
const getCss = ({ cssCode, contentId }) => {
|
|
3567
3703
|
if (!cssCode)
|
|
3568
3704
|
return "";
|
|
3569
3705
|
if (!contentId)
|
|
3570
3706
|
return cssCode;
|
|
3571
|
-
return
|
|
3707
|
+
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
3572
3708
|
};
|
|
3709
|
+
|
|
3573
3710
|
const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3574
3711
|
const state = useStore({
|
|
3575
3712
|
injectedStyles: `
|
|
@@ -3606,16 +3743,15 @@ ${getFontCss({
|
|
|
3606
3743
|
}
|
|
3607
3744
|
}, 3, "8O_0");
|
|
3608
3745
|
}, "ContentStyles_component_Qbhu1myPWm0"));
|
|
3746
|
+
|
|
3609
3747
|
const getContextStateInitialValue = ({ content, data, locale }) => {
|
|
3610
|
-
var _a, _b, _c;
|
|
3611
3748
|
const defaultValues = {};
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
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)
|
|
3749
|
+
content?.data?.inputs?.forEach((input) => {
|
|
3750
|
+
if (input.name && input.defaultValue !== void 0 && content?.data?.state && content.data.state[input.name] === void 0)
|
|
3615
3751
|
defaultValues[input.name] = input.defaultValue;
|
|
3616
3752
|
});
|
|
3617
3753
|
const stateToUse = {
|
|
3618
|
-
...
|
|
3754
|
+
...content?.data?.state,
|
|
3619
3755
|
...data,
|
|
3620
3756
|
...locale ? {
|
|
3621
3757
|
locale
|
|
@@ -3630,14 +3766,14 @@ const getContentInitialValue = ({ content, data }) => {
|
|
|
3630
3766
|
return !content ? void 0 : {
|
|
3631
3767
|
...content,
|
|
3632
3768
|
data: {
|
|
3633
|
-
...content
|
|
3769
|
+
...content?.data,
|
|
3634
3770
|
...data
|
|
3635
3771
|
},
|
|
3636
|
-
meta: content
|
|
3772
|
+
meta: content?.meta
|
|
3637
3773
|
};
|
|
3638
3774
|
};
|
|
3775
|
+
|
|
3639
3776
|
const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3640
|
-
var _a, _b;
|
|
3641
3777
|
_jsxBranch();
|
|
3642
3778
|
const state = useStore({
|
|
3643
3779
|
builderContextSignal: {
|
|
@@ -3688,9 +3824,9 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3688
3824
|
}), {}),
|
|
3689
3825
|
scriptStr: getRenderContentScriptString({
|
|
3690
3826
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3691
|
-
variationId:
|
|
3827
|
+
variationId: props.content?.testVariationId,
|
|
3692
3828
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3693
|
-
contentId:
|
|
3829
|
+
contentId: props.content?.id
|
|
3694
3830
|
})
|
|
3695
3831
|
}, {
|
|
3696
3832
|
deep: true
|
|
@@ -3745,42 +3881,29 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3745
3881
|
}, 3, "LQ_0") : null,
|
|
3746
3882
|
/* @__PURE__ */ _jsxC(ContentStyles, {
|
|
3747
3883
|
get contentId() {
|
|
3748
|
-
|
|
3749
|
-
return (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.id;
|
|
3884
|
+
return state.builderContextSignal.content?.id;
|
|
3750
3885
|
},
|
|
3751
3886
|
get cssCode() {
|
|
3752
|
-
|
|
3753
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
|
|
3887
|
+
return state.builderContextSignal.content?.data?.cssCode;
|
|
3754
3888
|
},
|
|
3755
3889
|
get customFonts() {
|
|
3756
|
-
|
|
3757
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
|
|
3890
|
+
return state.builderContextSignal.content?.data?.customFonts;
|
|
3758
3891
|
},
|
|
3759
3892
|
[_IMMUTABLE]: {
|
|
3760
|
-
contentId: _fnSignal((p0) =>
|
|
3761
|
-
var _a2;
|
|
3762
|
-
return (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.id;
|
|
3763
|
-
}, [
|
|
3893
|
+
contentId: _fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3764
3894
|
state
|
|
3765
3895
|
], "p0.builderContextSignal.content?.id"),
|
|
3766
|
-
cssCode: _fnSignal((p0) =>
|
|
3767
|
-
var _a2, _b2;
|
|
3768
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
|
|
3769
|
-
}, [
|
|
3896
|
+
cssCode: _fnSignal((p0) => p0.builderContextSignal.content?.data?.cssCode, [
|
|
3770
3897
|
state
|
|
3771
3898
|
], "p0.builderContextSignal.content?.data?.cssCode"),
|
|
3772
|
-
customFonts: _fnSignal((p0) =>
|
|
3773
|
-
var _a2, _b2;
|
|
3774
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
|
|
3775
|
-
}, [
|
|
3899
|
+
customFonts: _fnSignal((p0) => p0.builderContextSignal.content?.data?.customFonts, [
|
|
3776
3900
|
state
|
|
3777
3901
|
], "p0.builderContextSignal.content?.data?.customFonts")
|
|
3778
3902
|
}
|
|
3779
|
-
}, 3, "LQ_1"),
|
|
3903
|
+
}, 3, "LQ_1") ,
|
|
3780
3904
|
/* @__PURE__ */ _jsxC(Blocks, {
|
|
3781
3905
|
get blocks() {
|
|
3782
|
-
|
|
3783
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
|
|
3906
|
+
return state.builderContextSignal.content?.data?.blocks;
|
|
3784
3907
|
},
|
|
3785
3908
|
get context() {
|
|
3786
3909
|
return state.builderContextSignal;
|
|
@@ -3789,10 +3912,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3789
3912
|
return state.registeredComponents;
|
|
3790
3913
|
},
|
|
3791
3914
|
[_IMMUTABLE]: {
|
|
3792
|
-
blocks: _fnSignal((p0) =>
|
|
3793
|
-
var _a2, _b2;
|
|
3794
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
|
|
3795
|
-
}, [
|
|
3915
|
+
blocks: _fnSignal((p0) => p0.builderContextSignal.content?.data?.blocks, [
|
|
3796
3916
|
state
|
|
3797
3917
|
], "p0.builderContextSignal.content?.data?.blocks"),
|
|
3798
3918
|
context: _fnSignal((p0) => p0.builderContextSignal, [
|
|
@@ -3841,6 +3961,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3841
3961
|
}
|
|
3842
3962
|
}, 1, "LQ_3");
|
|
3843
3963
|
}, "ContentComponent_component_HIsczUcxjCE"));
|
|
3964
|
+
|
|
3844
3965
|
const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3845
3966
|
_jsxBranch();
|
|
3846
3967
|
const state = useStore({
|
|
@@ -3850,12 +3971,11 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3850
3971
|
})
|
|
3851
3972
|
});
|
|
3852
3973
|
const variantScriptStr = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3853
|
-
var _a;
|
|
3854
3974
|
const [props2] = useLexicalScope();
|
|
3855
3975
|
return getVariantsScriptString(getVariants(props2.content).map((value) => ({
|
|
3856
3976
|
id: value.testVariationId,
|
|
3857
3977
|
testRatio: value.testRatio
|
|
3858
|
-
})),
|
|
3978
|
+
})), props2.content?.id || "");
|
|
3859
3979
|
}, "ContentVariants_component_variantScriptStr_useComputed_ldWqWafT8Ww", [
|
|
3860
3980
|
props
|
|
3861
3981
|
]));
|
|
@@ -3866,11 +3986,10 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3866
3986
|
props
|
|
3867
3987
|
]));
|
|
3868
3988
|
const defaultContent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3869
|
-
var _a;
|
|
3870
3989
|
const [props2, state2] = useLexicalScope();
|
|
3871
3990
|
return state2.shouldRenderVariants ? {
|
|
3872
3991
|
...props2.content,
|
|
3873
|
-
testVariationId:
|
|
3992
|
+
testVariationId: props2.content?.id
|
|
3874
3993
|
} : handleABTestingSync({
|
|
3875
3994
|
item: props2.content,
|
|
3876
3995
|
canTrack: getDefaultCanTrack(props2.canTrack)
|
|
@@ -3879,8 +3998,6 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3879
3998
|
props,
|
|
3880
3999
|
state
|
|
3881
4000
|
]));
|
|
3882
|
-
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3883
|
-
}, "ContentVariants_component_useVisibleTask_10cWAqcJ45I"));
|
|
3884
4001
|
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
3885
4002
|
children: [
|
|
3886
4003
|
!props.__isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
|
@@ -3895,17 +4012,13 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3895
4012
|
children: [
|
|
3896
4013
|
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
3897
4014
|
get id() {
|
|
3898
|
-
|
|
3899
|
-
return `variants-styles-${(_a = props.content) == null ? void 0 : _a.id}`;
|
|
4015
|
+
return `variants-styles-${props.content?.id}`;
|
|
3900
4016
|
},
|
|
3901
4017
|
get styles() {
|
|
3902
4018
|
return hideVariantsStyleString.value;
|
|
3903
4019
|
},
|
|
3904
4020
|
[_IMMUTABLE]: {
|
|
3905
|
-
id: _fnSignal((p0) => {
|
|
3906
|
-
var _a;
|
|
3907
|
-
return `variants-styles-${(_a = p0.content) == null ? void 0 : _a.id}`;
|
|
3908
|
-
}, [
|
|
4021
|
+
id: _fnSignal((p0) => `variants-styles-${p0.content?.id}`, [
|
|
3909
4022
|
props
|
|
3910
4023
|
], "`variants-styles-${p0.content?.id}`"),
|
|
3911
4024
|
styles: _fnSignal((p0) => p0.value, [
|
|
@@ -4009,8 +4122,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4009
4122
|
return defaultContent.value;
|
|
4010
4123
|
},
|
|
4011
4124
|
get classNameProp() {
|
|
4012
|
-
|
|
4013
|
-
return `variant-${(_a = props.content) == null ? void 0 : _a.id}`;
|
|
4125
|
+
return `variant-${props.content?.id}`;
|
|
4014
4126
|
},
|
|
4015
4127
|
showContent: true,
|
|
4016
4128
|
get model() {
|
|
@@ -4056,10 +4168,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4056
4168
|
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
4057
4169
|
props
|
|
4058
4170
|
], "p0.canTrack"),
|
|
4059
|
-
classNameProp: _fnSignal((p0) => {
|
|
4060
|
-
var _a;
|
|
4061
|
-
return `variant-${(_a = p0.content) == null ? void 0 : _a.id}`;
|
|
4062
|
-
}, [
|
|
4171
|
+
classNameProp: _fnSignal((p0) => `variant-${p0.content?.id}`, [
|
|
4063
4172
|
props
|
|
4064
4173
|
], "`variant-${p0.content?.id}`"),
|
|
4065
4174
|
content: _fnSignal((p0) => p0.value, [
|
|
@@ -4095,14 +4204,15 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4095
4204
|
]
|
|
4096
4205
|
}, 1, "XM_5");
|
|
4097
4206
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
4207
|
+
|
|
4098
4208
|
const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
|
|
4099
|
-
if (
|
|
4100
|
-
|
|
4209
|
+
if (symbol?.model && // This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
4210
|
+
builderContextValue?.apiKey)
|
|
4101
4211
|
return fetchOneEntry({
|
|
4102
4212
|
model: symbol.model,
|
|
4103
4213
|
apiKey: builderContextValue.apiKey,
|
|
4104
4214
|
apiVersion: builderContextValue.apiVersion,
|
|
4105
|
-
...
|
|
4215
|
+
...symbol?.entry && {
|
|
4106
4216
|
query: {
|
|
4107
4217
|
id: symbol.entry
|
|
4108
4218
|
}
|
|
@@ -4113,6 +4223,7 @@ const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
|
|
|
4113
4223
|
});
|
|
4114
4224
|
return void 0;
|
|
4115
4225
|
};
|
|
4226
|
+
|
|
4116
4227
|
const setContent = function setContent2(props, state) {
|
|
4117
4228
|
if (state.contentToUse)
|
|
4118
4229
|
return;
|
|
@@ -4125,25 +4236,23 @@ const setContent = function setContent2(props, state) {
|
|
|
4125
4236
|
});
|
|
4126
4237
|
};
|
|
4127
4238
|
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4128
|
-
var _a;
|
|
4129
4239
|
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
4130
|
-
var _a2, _b;
|
|
4131
4240
|
const [props2] = useLexicalScope();
|
|
4132
4241
|
return [
|
|
4133
4242
|
props2.attributes.class,
|
|
4134
4243
|
"builder-symbol",
|
|
4135
|
-
|
|
4136
|
-
|
|
4244
|
+
props2.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4245
|
+
props2.symbol?.dynamic || props2.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4137
4246
|
].filter(Boolean).join(" ");
|
|
4138
4247
|
}, "Symbol_component_className_useComputed_Wb6GqgtDHpE", [
|
|
4139
4248
|
props
|
|
4140
4249
|
]));
|
|
4141
4250
|
const state = useStore({
|
|
4142
|
-
contentToUse:
|
|
4251
|
+
contentToUse: props.symbol?.content
|
|
4143
4252
|
});
|
|
4144
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
4253
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
4145
4254
|
const [props2, state2] = useLexicalScope();
|
|
4146
|
-
|
|
4255
|
+
track(() => props2.symbol);
|
|
4147
4256
|
setContent(props2, state2);
|
|
4148
4257
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
4149
4258
|
props,
|
|
@@ -4165,16 +4274,14 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4165
4274
|
return Object.values(props.builderComponents);
|
|
4166
4275
|
},
|
|
4167
4276
|
get data() {
|
|
4168
|
-
var _a2, _b, _c;
|
|
4169
4277
|
return {
|
|
4170
|
-
...
|
|
4278
|
+
...props.symbol?.data,
|
|
4171
4279
|
...props.builderContext.localState,
|
|
4172
|
-
...
|
|
4280
|
+
...state.contentToUse?.data?.state
|
|
4173
4281
|
};
|
|
4174
4282
|
},
|
|
4175
4283
|
get model() {
|
|
4176
|
-
|
|
4177
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
4284
|
+
return props.symbol?.model;
|
|
4178
4285
|
},
|
|
4179
4286
|
get content() {
|
|
4180
4287
|
return state.contentToUse;
|
|
@@ -4195,21 +4302,15 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4195
4302
|
customComponents: _fnSignal((p0) => Object.values(p0.builderComponents), [
|
|
4196
4303
|
props
|
|
4197
4304
|
], "Object.values(p0.builderComponents)"),
|
|
4198
|
-
data: _fnSignal((p0, p1) => {
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
...(_c = (_b = p1.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
|
|
4204
|
-
};
|
|
4205
|
-
}, [
|
|
4305
|
+
data: _fnSignal((p0, p1) => ({
|
|
4306
|
+
...p0.symbol?.data,
|
|
4307
|
+
...p0.builderContext.localState,
|
|
4308
|
+
...p1.contentToUse?.data?.state
|
|
4309
|
+
}), [
|
|
4206
4310
|
props,
|
|
4207
4311
|
state
|
|
4208
4312
|
], "{...p0.symbol?.data,...p0.builderContext.localState,...p1.contentToUse?.data?.state}"),
|
|
4209
|
-
model: _fnSignal((p0) =>
|
|
4210
|
-
var _a2;
|
|
4211
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
4212
|
-
}, [
|
|
4313
|
+
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
4213
4314
|
props
|
|
4214
4315
|
], "p0.symbol?.model")
|
|
4215
4316
|
}
|
|
@@ -4220,8 +4321,10 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4220
4321
|
], "p0.value")
|
|
4221
4322
|
}, 0, "Wt_1");
|
|
4222
4323
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
4324
|
+
|
|
4223
4325
|
const RenderBlocks = Blocks;
|
|
4224
4326
|
const RenderContent = ContentVariants;
|
|
4327
|
+
|
|
4225
4328
|
const settings = {};
|
|
4226
4329
|
function setEditorSettings(newSettings) {
|
|
4227
4330
|
if (isBrowser()) {
|
|
@@ -4233,9 +4336,9 @@ function setEditorSettings(newSettings) {
|
|
|
4233
4336
|
parent.postMessage(message, "*");
|
|
4234
4337
|
}
|
|
4235
4338
|
}
|
|
4339
|
+
|
|
4236
4340
|
const fetchBuilderProps = async (_args) => {
|
|
4237
|
-
|
|
4238
|
-
const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
|
|
4341
|
+
const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
|
|
4239
4342
|
const getContentArgs = {
|
|
4240
4343
|
..._args,
|
|
4241
4344
|
apiKey: _args.apiKey,
|
|
@@ -4246,7 +4349,7 @@ const fetchBuilderProps = async (_args) => {
|
|
|
4246
4349
|
urlPath
|
|
4247
4350
|
} : {}
|
|
4248
4351
|
},
|
|
4249
|
-
options: getBuilderSearchParams(_args.searchParams ||
|
|
4352
|
+
options: getBuilderSearchParams(_args.searchParams || _args.url?.searchParams || _args.options)
|
|
4250
4353
|
};
|
|
4251
4354
|
return {
|
|
4252
4355
|
apiKey: getContentArgs.apiKey,
|
|
@@ -4254,30 +4357,5 @@ const fetchBuilderProps = async (_args) => {
|
|
|
4254
4357
|
content: await fetchOneEntry(getContentArgs)
|
|
4255
4358
|
};
|
|
4256
4359
|
};
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
Button,
|
|
4260
|
-
Columns,
|
|
4261
|
-
ContentVariants as Content,
|
|
4262
|
-
FragmentComponent as Fragment,
|
|
4263
|
-
Image,
|
|
4264
|
-
RenderBlocks,
|
|
4265
|
-
RenderContent,
|
|
4266
|
-
SectionComponent as Section,
|
|
4267
|
-
Symbol$1 as Symbol,
|
|
4268
|
-
Text,
|
|
4269
|
-
Video,
|
|
4270
|
-
_processContentResult,
|
|
4271
|
-
createRegisterComponentMessage,
|
|
4272
|
-
fetchBuilderProps,
|
|
4273
|
-
fetchEntries,
|
|
4274
|
-
fetchOneEntry,
|
|
4275
|
-
getAllContent,
|
|
4276
|
-
getBuilderSearchParams,
|
|
4277
|
-
getContent,
|
|
4278
|
-
isEditing,
|
|
4279
|
-
isPreviewing,
|
|
4280
|
-
register,
|
|
4281
|
-
setEditorSettings,
|
|
4282
|
-
track
|
|
4283
|
-
};
|
|
4360
|
+
|
|
4361
|
+
export { Blocks, Button, Columns, ContentVariants as Content, FragmentComponent as Fragment, Image, RenderBlocks, RenderContent, SectionComponent as Section, Symbol$1 as Symbol, Text, Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getAllContent, getBuilderSearchParams, getContent, isEditing, isPreviewing, register, setEditorSettings, track };
|