@builder.io/sdk-qwik 0.7.1-3 → 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} +365 -280
- package/package.json +26 -38
- 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 -4276
- package/lib/edge/index.qwik.cjs +0 -7480
- package/lib/edge/index.qwik.mjs +0 -7480
- package/lib/node/index.qwik.cjs +0 -4276
- package/lib/node/index.qwik.mjs +0 -4276
|
@@ -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, useOn } from
|
|
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,12 +2488,14 @@ 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);
|
|
2498
|
+
|
|
2361
2499
|
const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
2362
2500
|
if (!elem.value || !elem.value.getElementsByTagName)
|
|
2363
2501
|
return;
|
|
@@ -2386,10 +2524,10 @@ 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
2533
|
findAndRunScripts(props2, state2, elem2);
|
|
@@ -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,6 +2590,7 @@ const componentInfo$1 = {
|
|
|
2450
2590
|
noWrap: true,
|
|
2451
2591
|
static: true
|
|
2452
2592
|
};
|
|
2593
|
+
|
|
2453
2594
|
const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2454
2595
|
const elementRef = useSignal();
|
|
2455
2596
|
const state = useStore({
|
|
@@ -2458,7 +2599,7 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
2458
2599
|
});
|
|
2459
2600
|
useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
2460
2601
|
const [state2] = useLexicalScope();
|
|
2461
|
-
if (!
|
|
2602
|
+
if (!element?.getElementsByTagName || typeof window === "undefined")
|
|
2462
2603
|
return;
|
|
2463
2604
|
const scripts = element.getElementsByTagName("script");
|
|
2464
2605
|
for (let i = 0; i < scripts.length; i++) {
|
|
@@ -2500,6 +2641,7 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
2500
2641
|
], "p0.code")
|
|
2501
2642
|
}, null, 3, "bY_0");
|
|
2502
2643
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
2644
|
+
|
|
2503
2645
|
const componentInfo = {
|
|
2504
2646
|
name: "Custom Code",
|
|
2505
2647
|
static: true,
|
|
@@ -2529,6 +2671,7 @@ const componentInfo = {
|
|
|
2529
2671
|
}
|
|
2530
2672
|
]
|
|
2531
2673
|
};
|
|
2674
|
+
|
|
2532
2675
|
const getDefaultRegisteredComponents = () => [
|
|
2533
2676
|
{
|
|
2534
2677
|
component: Button,
|
|
@@ -2575,6 +2718,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
2575
2718
|
...componentInfo$3
|
|
2576
2719
|
}
|
|
2577
2720
|
];
|
|
2721
|
+
|
|
2578
2722
|
const components = [];
|
|
2579
2723
|
const createRegisterComponentMessage = (info) => ({
|
|
2580
2724
|
type: "builder.registerComponent",
|
|
@@ -2588,15 +2732,16 @@ const serializeFn = (fnValue) => {
|
|
|
2588
2732
|
const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
|
|
2589
2733
|
const serializeComponentInfo = ({ inputs, ...info }) => ({
|
|
2590
2734
|
...fastClone(info),
|
|
2591
|
-
inputs: inputs
|
|
2735
|
+
inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
|
|
2592
2736
|
...acc,
|
|
2593
2737
|
[key]: serializeValue(value)
|
|
2594
2738
|
}), {}))
|
|
2595
2739
|
});
|
|
2596
|
-
|
|
2740
|
+
|
|
2741
|
+
const getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2597
2742
|
...variant,
|
|
2598
2743
|
testVariationId: variant.id,
|
|
2599
|
-
id: content
|
|
2744
|
+
id: content?.id
|
|
2600
2745
|
}));
|
|
2601
2746
|
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
2602
2747
|
const hasVariants = getVariants(content).length > 0;
|
|
@@ -2609,9 +2754,8 @@ const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
|
2609
2754
|
return true;
|
|
2610
2755
|
};
|
|
2611
2756
|
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
function setCookie2(name, value, days) {
|
|
2757
|
+
function getAndSetVariantId() {
|
|
2758
|
+
function setCookie(name, value, days) {
|
|
2615
2759
|
let expires = "";
|
|
2616
2760
|
if (days) {
|
|
2617
2761
|
const date = /* @__PURE__ */ new Date();
|
|
@@ -2620,7 +2764,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2620
2764
|
}
|
|
2621
2765
|
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2622
2766
|
}
|
|
2623
|
-
function
|
|
2767
|
+
function getCookie(name) {
|
|
2624
2768
|
const nameEQ = name + "=";
|
|
2625
2769
|
const ca = document.cookie.split(";");
|
|
2626
2770
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -2633,7 +2777,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2633
2777
|
return null;
|
|
2634
2778
|
}
|
|
2635
2779
|
const cookieName = `builder.tests.${contentId}`;
|
|
2636
|
-
const variantInCookie =
|
|
2780
|
+
const variantInCookie = getCookie(cookieName);
|
|
2637
2781
|
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2638
2782
|
if (variantInCookie && availableIDs.includes(variantInCookie))
|
|
2639
2783
|
return variantInCookie;
|
|
@@ -2644,19 +2788,19 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2644
2788
|
const testRatio = variant.testRatio;
|
|
2645
2789
|
n += testRatio;
|
|
2646
2790
|
if (random < n) {
|
|
2647
|
-
|
|
2791
|
+
setCookie(cookieName, variant.id);
|
|
2648
2792
|
return variant.id;
|
|
2649
2793
|
}
|
|
2650
2794
|
}
|
|
2651
|
-
|
|
2795
|
+
setCookie(cookieName, contentId);
|
|
2652
2796
|
return contentId;
|
|
2653
2797
|
}
|
|
2654
|
-
const winningVariantId =
|
|
2655
|
-
const styleEl =
|
|
2798
|
+
const winningVariantId = getAndSetVariantId();
|
|
2799
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
2656
2800
|
if (isHydrationTarget2) {
|
|
2657
2801
|
styleEl.remove();
|
|
2658
2802
|
const thisScriptEl = document.currentScript;
|
|
2659
|
-
thisScriptEl
|
|
2803
|
+
thisScriptEl?.remove();
|
|
2660
2804
|
} else {
|
|
2661
2805
|
const newStyleStr = variants.concat({
|
|
2662
2806
|
id: contentId
|
|
@@ -2668,10 +2812,9 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
2668
2812
|
}
|
|
2669
2813
|
}
|
|
2670
2814
|
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2671
|
-
var _a;
|
|
2672
2815
|
if (!navigator.cookieEnabled)
|
|
2673
2816
|
return;
|
|
2674
|
-
function
|
|
2817
|
+
function getCookie(name) {
|
|
2675
2818
|
const nameEQ = name + "=";
|
|
2676
2819
|
const ca = document.cookie.split(";");
|
|
2677
2820
|
for (let i = 0; i < ca.length; i++) {
|
|
@@ -2684,21 +2827,21 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
2684
2827
|
return null;
|
|
2685
2828
|
}
|
|
2686
2829
|
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2687
|
-
const variantId =
|
|
2688
|
-
const parentDiv =
|
|
2830
|
+
const variantId = getCookie(cookieName);
|
|
2831
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
2689
2832
|
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2690
2833
|
if (variantId === variantContentId) {
|
|
2691
2834
|
if (variantIsDefaultContent)
|
|
2692
2835
|
return;
|
|
2693
|
-
parentDiv
|
|
2694
|
-
parentDiv
|
|
2836
|
+
parentDiv?.removeAttribute("hidden");
|
|
2837
|
+
parentDiv?.removeAttribute("aria-hidden");
|
|
2695
2838
|
} else {
|
|
2696
2839
|
if (variantIsDefaultContent) {
|
|
2697
2840
|
if (isHydrationTarget2)
|
|
2698
|
-
parentDiv
|
|
2841
|
+
parentDiv?.remove();
|
|
2699
2842
|
else {
|
|
2700
|
-
parentDiv
|
|
2701
|
-
parentDiv
|
|
2843
|
+
parentDiv?.setAttribute("hidden", "true");
|
|
2844
|
+
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2702
2845
|
}
|
|
2703
2846
|
}
|
|
2704
2847
|
return;
|
|
@@ -2725,6 +2868,7 @@ const getRenderContentScriptString = ({ contentId, variationId }) => {
|
|
|
2725
2868
|
return `
|
|
2726
2869
|
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
2727
2870
|
};
|
|
2871
|
+
|
|
2728
2872
|
const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2729
2873
|
return /* @__PURE__ */ _jsxQ("script", null, {
|
|
2730
2874
|
dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
|
|
@@ -2735,6 +2879,7 @@ const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
2735
2879
|
], "p0.id")
|
|
2736
2880
|
}, null, 3, "WO_0");
|
|
2737
2881
|
}, "InlinedScript_component_hwThBdhA8rw"));
|
|
2882
|
+
|
|
2738
2883
|
function getGlobalThis() {
|
|
2739
2884
|
if (typeof globalThis !== "undefined")
|
|
2740
2885
|
return globalThis;
|
|
@@ -2746,6 +2891,7 @@ function getGlobalThis() {
|
|
|
2746
2891
|
return self;
|
|
2747
2892
|
return globalThis;
|
|
2748
2893
|
}
|
|
2894
|
+
|
|
2749
2895
|
function getFetch() {
|
|
2750
2896
|
const globalFetch = getGlobalThis().fetch;
|
|
2751
2897
|
if (typeof globalFetch === "undefined") {
|
|
@@ -2756,6 +2902,7 @@ function getFetch() {
|
|
|
2756
2902
|
return globalFetch;
|
|
2757
2903
|
}
|
|
2758
2904
|
const fetch$1 = getFetch();
|
|
2905
|
+
|
|
2759
2906
|
function flatten(object, path = null, separator = ".") {
|
|
2760
2907
|
return Object.keys(object).reduce((acc, key) => {
|
|
2761
2908
|
const value = object[key];
|
|
@@ -2777,6 +2924,7 @@ function flatten(object, path = null, separator = ".") {
|
|
|
2777
2924
|
};
|
|
2778
2925
|
}, {});
|
|
2779
2926
|
}
|
|
2927
|
+
|
|
2780
2928
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
2781
2929
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
2782
2930
|
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
@@ -2806,7 +2954,9 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
2806
2954
|
return getBuilderSearchParams(searchParams);
|
|
2807
2955
|
};
|
|
2808
2956
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
2957
|
+
|
|
2809
2958
|
const DEFAULT_API_VERSION = "v3";
|
|
2959
|
+
|
|
2810
2960
|
const generateContentUrl = (options) => {
|
|
2811
2961
|
let { noTraverse = false } = options;
|
|
2812
2962
|
const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
@@ -2838,6 +2988,7 @@ const generateContentUrl = (options) => {
|
|
|
2838
2988
|
}
|
|
2839
2989
|
return url;
|
|
2840
2990
|
};
|
|
2991
|
+
|
|
2841
2992
|
const checkContentHasResults = (content) => "results" in content;
|
|
2842
2993
|
async function fetchOneEntry(options) {
|
|
2843
2994
|
const allContent = await fetchEntries({
|
|
@@ -2894,6 +3045,7 @@ async function fetchEntries(options) {
|
|
|
2894
3045
|
}
|
|
2895
3046
|
}
|
|
2896
3047
|
const getAllContent = fetchEntries;
|
|
3048
|
+
|
|
2897
3049
|
function isPreviewing() {
|
|
2898
3050
|
if (!isBrowser())
|
|
2899
3051
|
return false;
|
|
@@ -2901,6 +3053,7 @@ function isPreviewing() {
|
|
|
2901
3053
|
return false;
|
|
2902
3054
|
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2903
3055
|
}
|
|
3056
|
+
|
|
2904
3057
|
function uuidv4() {
|
|
2905
3058
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
2906
3059
|
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
@@ -2910,6 +3063,7 @@ function uuidv4() {
|
|
|
2910
3063
|
function uuid() {
|
|
2911
3064
|
return uuidv4().replace(/-/g, "");
|
|
2912
3065
|
}
|
|
3066
|
+
|
|
2913
3067
|
const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
2914
3068
|
const getSessionId = async ({ canTrack }) => {
|
|
2915
3069
|
if (!canTrack)
|
|
@@ -2935,12 +3089,12 @@ const setSessionId = ({ id, canTrack }) => setCookie({
|
|
|
2935
3089
|
value: id,
|
|
2936
3090
|
canTrack
|
|
2937
3091
|
});
|
|
3092
|
+
|
|
2938
3093
|
const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
2939
3094
|
const getLocalStorageItem = ({ key, canTrack }) => {
|
|
2940
|
-
var _a;
|
|
2941
3095
|
try {
|
|
2942
3096
|
if (canTrack)
|
|
2943
|
-
return
|
|
3097
|
+
return getLocalStorage()?.getItem(key);
|
|
2944
3098
|
return void 0;
|
|
2945
3099
|
} catch (err) {
|
|
2946
3100
|
console.debug("[LocalStorage] GET error: ", err);
|
|
@@ -2948,14 +3102,14 @@ const getLocalStorageItem = ({ key, canTrack }) => {
|
|
|
2948
3102
|
}
|
|
2949
3103
|
};
|
|
2950
3104
|
const setLocalStorageItem = ({ key, canTrack, value }) => {
|
|
2951
|
-
var _a;
|
|
2952
3105
|
try {
|
|
2953
3106
|
if (canTrack)
|
|
2954
|
-
|
|
3107
|
+
getLocalStorage()?.setItem(key, value);
|
|
2955
3108
|
} catch (err) {
|
|
2956
3109
|
console.debug("[LocalStorage] SET error: ", err);
|
|
2957
3110
|
}
|
|
2958
3111
|
};
|
|
3112
|
+
|
|
2959
3113
|
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
2960
3114
|
const getVisitorId = ({ canTrack }) => {
|
|
2961
3115
|
if (!canTrack)
|
|
@@ -2981,6 +3135,7 @@ const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
|
|
|
2981
3135
|
value: id,
|
|
2982
3136
|
canTrack
|
|
2983
3137
|
});
|
|
3138
|
+
|
|
2984
3139
|
const getTrackingEventData = async ({ canTrack }) => {
|
|
2985
3140
|
if (!canTrack)
|
|
2986
3141
|
return {
|
|
@@ -3043,25 +3198,26 @@ const track = (args) => _track({
|
|
|
3043
3198
|
...args,
|
|
3044
3199
|
canTrack: true
|
|
3045
3200
|
});
|
|
3201
|
+
|
|
3046
3202
|
function round(num) {
|
|
3047
3203
|
return Math.round(num * 1e3) / 1e3;
|
|
3048
3204
|
}
|
|
3049
3205
|
const findParentElement = (target, callback, checkElement = true) => {
|
|
3050
3206
|
if (!(target instanceof HTMLElement))
|
|
3051
3207
|
return null;
|
|
3052
|
-
let
|
|
3208
|
+
let parent = checkElement ? target : target.parentElement;
|
|
3053
3209
|
do {
|
|
3054
|
-
if (!
|
|
3210
|
+
if (!parent)
|
|
3055
3211
|
return null;
|
|
3056
|
-
const matches = callback(
|
|
3212
|
+
const matches = callback(parent);
|
|
3057
3213
|
if (matches)
|
|
3058
|
-
return
|
|
3059
|
-
} while (
|
|
3214
|
+
return parent;
|
|
3215
|
+
} while (parent = parent.parentElement);
|
|
3060
3216
|
return null;
|
|
3061
3217
|
};
|
|
3062
3218
|
const findBuilderParent = (target) => findParentElement(target, (el) => {
|
|
3063
3219
|
const id = el.getAttribute("builder-id") || el.id;
|
|
3064
|
-
return Boolean(
|
|
3220
|
+
return Boolean(id?.indexOf("builder-") === 0);
|
|
3065
3221
|
});
|
|
3066
3222
|
const computeOffset = ({ event, target }) => {
|
|
3067
3223
|
const targetRect = target.getBoundingClientRect();
|
|
@@ -3077,7 +3233,7 @@ const computeOffset = ({ event, target }) => {
|
|
|
3077
3233
|
const getInteractionPropertiesForEvent = (event) => {
|
|
3078
3234
|
const target = event.target;
|
|
3079
3235
|
const targetBuilderElement = target && findBuilderParent(target);
|
|
3080
|
-
const builderId =
|
|
3236
|
+
const builderId = targetBuilderElement?.getAttribute("builder-id") || targetBuilderElement?.id;
|
|
3081
3237
|
return {
|
|
3082
3238
|
targetBuilderElement: builderId || void 0,
|
|
3083
3239
|
metadata: {
|
|
@@ -3093,7 +3249,9 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
3093
3249
|
}
|
|
3094
3250
|
};
|
|
3095
3251
|
};
|
|
3252
|
+
|
|
3096
3253
|
const SDK_VERSION = "0.7.1-3";
|
|
3254
|
+
|
|
3097
3255
|
const registry = {};
|
|
3098
3256
|
function register(type, info) {
|
|
3099
3257
|
let typeList = registry[type];
|
|
@@ -3117,6 +3275,7 @@ function register(type, info) {
|
|
|
3117
3275
|
}
|
|
3118
3276
|
}
|
|
3119
3277
|
}
|
|
3278
|
+
|
|
3120
3279
|
const registerInsertMenu = () => {
|
|
3121
3280
|
register("insertMenu", {
|
|
3122
3281
|
name: "_default",
|
|
@@ -3153,12 +3312,11 @@ const registerInsertMenu = () => {
|
|
|
3153
3312
|
};
|
|
3154
3313
|
let isSetupForEditing = false;
|
|
3155
3314
|
const setupBrowserForEditing = (options = {}) => {
|
|
3156
|
-
var _a, _b;
|
|
3157
3315
|
if (isSetupForEditing)
|
|
3158
3316
|
return;
|
|
3159
3317
|
isSetupForEditing = true;
|
|
3160
3318
|
if (isBrowser()) {
|
|
3161
|
-
|
|
3319
|
+
window.parent?.postMessage({
|
|
3162
3320
|
type: "builder.sdkInfo",
|
|
3163
3321
|
data: {
|
|
3164
3322
|
target: TARGET,
|
|
@@ -3170,15 +3328,14 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3170
3328
|
supportsCustomBreakpoints: true
|
|
3171
3329
|
}
|
|
3172
3330
|
}, "*");
|
|
3173
|
-
|
|
3331
|
+
window.parent?.postMessage({
|
|
3174
3332
|
type: "builder.updateContent",
|
|
3175
3333
|
data: {
|
|
3176
3334
|
options
|
|
3177
3335
|
}
|
|
3178
3336
|
}, "*");
|
|
3179
3337
|
window.addEventListener("message", ({ data }) => {
|
|
3180
|
-
|
|
3181
|
-
if (!(data == null ? void 0 : data.type))
|
|
3338
|
+
if (!data?.type)
|
|
3182
3339
|
return;
|
|
3183
3340
|
switch (data.type) {
|
|
3184
3341
|
case "builder.evaluate": {
|
|
@@ -3194,7 +3351,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3194
3351
|
error = err;
|
|
3195
3352
|
}
|
|
3196
3353
|
if (error)
|
|
3197
|
-
|
|
3354
|
+
window.parent?.postMessage({
|
|
3198
3355
|
type: "builder.evaluateError",
|
|
3199
3356
|
data: {
|
|
3200
3357
|
id,
|
|
@@ -3203,8 +3360,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3203
3360
|
}, "*");
|
|
3204
3361
|
else if (result && typeof result.then === "function")
|
|
3205
3362
|
result.then((finalResult) => {
|
|
3206
|
-
|
|
3207
|
-
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
3363
|
+
window.parent?.postMessage({
|
|
3208
3364
|
type: "builder.evaluateResult",
|
|
3209
3365
|
data: {
|
|
3210
3366
|
id,
|
|
@@ -3213,7 +3369,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3213
3369
|
}, "*");
|
|
3214
3370
|
}).catch(console.error);
|
|
3215
3371
|
else
|
|
3216
|
-
|
|
3372
|
+
window.parent?.postMessage({
|
|
3217
3373
|
type: "builder.evaluateResult",
|
|
3218
3374
|
data: {
|
|
3219
3375
|
result,
|
|
@@ -3226,32 +3382,31 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
3226
3382
|
});
|
|
3227
3383
|
}
|
|
3228
3384
|
};
|
|
3385
|
+
|
|
3229
3386
|
const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
|
|
3230
|
-
var _a, _b, _c, _d, _e;
|
|
3231
3387
|
const newContentValue = {
|
|
3232
3388
|
...props.builderContextSignal.content,
|
|
3233
3389
|
...newContent,
|
|
3234
3390
|
data: {
|
|
3235
|
-
...
|
|
3236
|
-
...newContent
|
|
3391
|
+
...props.builderContextSignal.content?.data,
|
|
3392
|
+
...newContent?.data
|
|
3237
3393
|
},
|
|
3238
3394
|
meta: {
|
|
3239
|
-
...
|
|
3240
|
-
...newContent
|
|
3241
|
-
breakpoints:
|
|
3395
|
+
...props.builderContextSignal.content?.meta,
|
|
3396
|
+
...newContent?.meta,
|
|
3397
|
+
breakpoints: newContent?.meta?.breakpoints || props.builderContextSignal.content?.meta?.breakpoints
|
|
3242
3398
|
}
|
|
3243
3399
|
};
|
|
3244
3400
|
props.builderContextSignal.content = newContentValue;
|
|
3245
3401
|
};
|
|
3246
3402
|
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
3247
|
-
var _a;
|
|
3248
3403
|
const { data } = event;
|
|
3249
3404
|
if (data)
|
|
3250
3405
|
switch (data.type) {
|
|
3251
3406
|
case "builder.configureSdk": {
|
|
3252
3407
|
const messageContent = data.data;
|
|
3253
3408
|
const { breakpoints, contentId } = messageContent;
|
|
3254
|
-
if (!contentId || contentId !==
|
|
3409
|
+
if (!contentId || contentId !== props.builderContextSignal.content?.id)
|
|
3255
3410
|
return;
|
|
3256
3411
|
if (breakpoints)
|
|
3257
3412
|
mergeNewContent(props, state, elementRef, {
|
|
@@ -3275,8 +3430,7 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3275
3430
|
}
|
|
3276
3431
|
};
|
|
3277
3432
|
const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
3278
|
-
|
|
3279
|
-
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;
|
|
3280
3434
|
if (jsCode)
|
|
3281
3435
|
evaluate({
|
|
3282
3436
|
code: jsCode,
|
|
@@ -3286,11 +3440,10 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
|
3286
3440
|
rootSetState: props.builderContextSignal.rootSetState
|
|
3287
3441
|
});
|
|
3288
3442
|
};
|
|
3289
|
-
const onClick = function
|
|
3290
|
-
var _a, _b;
|
|
3443
|
+
const onClick = function onClick2(props, state, elementRef, event) {
|
|
3291
3444
|
if (props.builderContextSignal.content) {
|
|
3292
|
-
const variationId =
|
|
3293
|
-
const contentId =
|
|
3445
|
+
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
3446
|
+
const contentId = props.builderContextSignal.content?.id;
|
|
3294
3447
|
_track({
|
|
3295
3448
|
type: "click",
|
|
3296
3449
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
@@ -3315,20 +3468,18 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
|
|
|
3315
3468
|
};
|
|
3316
3469
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
3317
3470
|
fetch$1(url).then((response) => response.json()).then((json) => {
|
|
3318
|
-
var _a, _b;
|
|
3319
3471
|
const newState = {
|
|
3320
3472
|
...props.builderContextSignal.rootState,
|
|
3321
3473
|
[key]: json
|
|
3322
3474
|
};
|
|
3323
|
-
|
|
3475
|
+
props.builderContextSignal.rootSetState?.(newState);
|
|
3324
3476
|
state.httpReqsData[key] = true;
|
|
3325
3477
|
}).catch((err) => {
|
|
3326
3478
|
console.error("error fetching dynamic data", url, err);
|
|
3327
3479
|
});
|
|
3328
3480
|
};
|
|
3329
3481
|
const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
|
|
3330
|
-
|
|
3331
|
-
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 ?? {};
|
|
3332
3483
|
Object.entries(requests).forEach(([key, url]) => {
|
|
3333
3484
|
if (url && (!state.httpReqsData[key] || isEditing())) {
|
|
3334
3485
|
const evaluatedUrl = evalExpression(props, state, elementRef, url);
|
|
@@ -3351,7 +3502,6 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3351
3502
|
}));
|
|
3352
3503
|
};
|
|
3353
3504
|
const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3354
|
-
var _a, _b, _c;
|
|
3355
3505
|
_jsxBranch();
|
|
3356
3506
|
const elementRef = useSignal();
|
|
3357
3507
|
const state = useStore({
|
|
@@ -3380,9 +3530,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3380
3530
|
} : {}
|
|
3381
3531
|
});
|
|
3382
3532
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3383
|
-
var _a2;
|
|
3384
3533
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
3385
|
-
|
|
3534
|
+
window.parent?.postMessage(message, "*");
|
|
3386
3535
|
});
|
|
3387
3536
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3388
3537
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
@@ -3411,15 +3560,14 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3411
3560
|
state
|
|
3412
3561
|
]));
|
|
3413
3562
|
useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
3414
|
-
var _a2, _b2, _c2, _d;
|
|
3415
3563
|
if (isBrowser()) {
|
|
3416
3564
|
if (isEditing() && element)
|
|
3417
3565
|
element.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
3418
|
-
const shouldTrackImpression =
|
|
3566
|
+
const shouldTrackImpression = element.attributes.getNamedItem("shouldTrack")?.value === "true";
|
|
3419
3567
|
if (shouldTrackImpression) {
|
|
3420
|
-
const variationId =
|
|
3421
|
-
const contentId =
|
|
3422
|
-
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;
|
|
3423
3571
|
_track({
|
|
3424
3572
|
type: "impression",
|
|
3425
3573
|
canTrack: true,
|
|
@@ -3445,9 +3593,9 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3445
3593
|
props,
|
|
3446
3594
|
state
|
|
3447
3595
|
]));
|
|
3448
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3596
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3449
3597
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3450
|
-
|
|
3598
|
+
track(() => props2.content);
|
|
3451
3599
|
if (props2.content)
|
|
3452
3600
|
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3453
3601
|
}, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
|
|
@@ -3455,40 +3603,34 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3455
3603
|
props,
|
|
3456
3604
|
state
|
|
3457
3605
|
]));
|
|
3458
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3606
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3459
3607
|
const [state2] = useLexicalScope();
|
|
3460
|
-
|
|
3608
|
+
track(() => state2.shouldSendResetCookie);
|
|
3461
3609
|
}, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
|
|
3462
3610
|
state
|
|
3463
3611
|
]));
|
|
3464
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3612
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3465
3613
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
3469
|
-
});
|
|
3470
|
-
track2(() => props2.builderContextSignal.rootState);
|
|
3614
|
+
track(() => props2.builderContextSignal.content?.data?.jsCode);
|
|
3615
|
+
track(() => props2.builderContextSignal.rootState);
|
|
3471
3616
|
evaluateJsCode(props2);
|
|
3472
3617
|
}, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
|
|
3473
3618
|
elementRef,
|
|
3474
3619
|
props,
|
|
3475
3620
|
state
|
|
3476
3621
|
]));
|
|
3477
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3622
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3478
3623
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3479
|
-
|
|
3480
|
-
var _a2, _b2;
|
|
3481
|
-
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
3482
|
-
});
|
|
3624
|
+
track(() => props2.builderContextSignal.content?.data?.httpRequests);
|
|
3483
3625
|
runHttpRequests(props2, state2, elementRef2);
|
|
3484
3626
|
}, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
|
|
3485
3627
|
elementRef,
|
|
3486
3628
|
props,
|
|
3487
3629
|
state
|
|
3488
3630
|
]));
|
|
3489
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
3631
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
3490
3632
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3491
|
-
|
|
3633
|
+
track(() => props2.builderContextSignal.rootState);
|
|
3492
3634
|
emitStateUpdate(props2);
|
|
3493
3635
|
}, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
|
|
3494
3636
|
elementRef,
|
|
@@ -3498,8 +3640,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3498
3640
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3499
3641
|
children: props.builderContextSignal.content ? /* @__PURE__ */ createElement("div", {
|
|
3500
3642
|
apiKey: props.apiKey,
|
|
3501
|
-
contentId:
|
|
3502
|
-
variationId:
|
|
3643
|
+
contentId: props.builderContextSignal.content?.id,
|
|
3644
|
+
variationId: props.builderContextSignal.content?.testVariationId,
|
|
3503
3645
|
shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
|
|
3504
3646
|
key: state.forceReRenderCount,
|
|
3505
3647
|
ref: elementRef,
|
|
@@ -3511,7 +3653,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3511
3653
|
props,
|
|
3512
3654
|
state
|
|
3513
3655
|
]),
|
|
3514
|
-
"builder-content-id":
|
|
3656
|
+
"builder-content-id": props.builderContextSignal.content?.id,
|
|
3515
3657
|
"builder-model": props.model,
|
|
3516
3658
|
...props.showContent ? {} : {
|
|
3517
3659
|
hidden: true,
|
|
@@ -3521,11 +3663,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3521
3663
|
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0")) : null
|
|
3522
3664
|
}, 1, "06_1");
|
|
3523
3665
|
}, "EnableEditor_component_ko1mO8oaj8k"));
|
|
3666
|
+
|
|
3524
3667
|
const getCssFromFont = (font) => {
|
|
3525
|
-
var _a;
|
|
3526
3668
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
3527
3669
|
const name = family.split(",")[0];
|
|
3528
|
-
const url = font.fileUrl ??
|
|
3670
|
+
const url = font.fileUrl ?? font?.files?.regular;
|
|
3529
3671
|
let str = "";
|
|
3530
3672
|
if (url && family && name)
|
|
3531
3673
|
str += `
|
|
@@ -3555,16 +3697,16 @@ font-weight: ${weight};
|
|
|
3555
3697
|
return str;
|
|
3556
3698
|
};
|
|
3557
3699
|
const getFontCss = ({ customFonts }) => {
|
|
3558
|
-
|
|
3559
|
-
return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
|
|
3700
|
+
return customFonts?.map((font) => getCssFromFont(font))?.join(" ") || "";
|
|
3560
3701
|
};
|
|
3561
3702
|
const getCss = ({ cssCode, contentId }) => {
|
|
3562
3703
|
if (!cssCode)
|
|
3563
3704
|
return "";
|
|
3564
3705
|
if (!contentId)
|
|
3565
3706
|
return cssCode;
|
|
3566
|
-
return
|
|
3707
|
+
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
3567
3708
|
};
|
|
3709
|
+
|
|
3568
3710
|
const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3569
3711
|
const state = useStore({
|
|
3570
3712
|
injectedStyles: `
|
|
@@ -3601,16 +3743,15 @@ ${getFontCss({
|
|
|
3601
3743
|
}
|
|
3602
3744
|
}, 3, "8O_0");
|
|
3603
3745
|
}, "ContentStyles_component_Qbhu1myPWm0"));
|
|
3746
|
+
|
|
3604
3747
|
const getContextStateInitialValue = ({ content, data, locale }) => {
|
|
3605
|
-
var _a, _b, _c;
|
|
3606
3748
|
const defaultValues = {};
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
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)
|
|
3610
3751
|
defaultValues[input.name] = input.defaultValue;
|
|
3611
3752
|
});
|
|
3612
3753
|
const stateToUse = {
|
|
3613
|
-
...
|
|
3754
|
+
...content?.data?.state,
|
|
3614
3755
|
...data,
|
|
3615
3756
|
...locale ? {
|
|
3616
3757
|
locale
|
|
@@ -3625,14 +3766,14 @@ const getContentInitialValue = ({ content, data }) => {
|
|
|
3625
3766
|
return !content ? void 0 : {
|
|
3626
3767
|
...content,
|
|
3627
3768
|
data: {
|
|
3628
|
-
...content
|
|
3769
|
+
...content?.data,
|
|
3629
3770
|
...data
|
|
3630
3771
|
},
|
|
3631
|
-
meta: content
|
|
3772
|
+
meta: content?.meta
|
|
3632
3773
|
};
|
|
3633
3774
|
};
|
|
3775
|
+
|
|
3634
3776
|
const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3635
|
-
var _a, _b;
|
|
3636
3777
|
_jsxBranch();
|
|
3637
3778
|
const state = useStore({
|
|
3638
3779
|
builderContextSignal: {
|
|
@@ -3683,9 +3824,9 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3683
3824
|
}), {}),
|
|
3684
3825
|
scriptStr: getRenderContentScriptString({
|
|
3685
3826
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3686
|
-
variationId:
|
|
3827
|
+
variationId: props.content?.testVariationId,
|
|
3687
3828
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3688
|
-
contentId:
|
|
3829
|
+
contentId: props.content?.id
|
|
3689
3830
|
})
|
|
3690
3831
|
}, {
|
|
3691
3832
|
deep: true
|
|
@@ -3740,42 +3881,29 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3740
3881
|
}, 3, "LQ_0") : null,
|
|
3741
3882
|
/* @__PURE__ */ _jsxC(ContentStyles, {
|
|
3742
3883
|
get contentId() {
|
|
3743
|
-
|
|
3744
|
-
return (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.id;
|
|
3884
|
+
return state.builderContextSignal.content?.id;
|
|
3745
3885
|
},
|
|
3746
3886
|
get cssCode() {
|
|
3747
|
-
|
|
3748
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
|
|
3887
|
+
return state.builderContextSignal.content?.data?.cssCode;
|
|
3749
3888
|
},
|
|
3750
3889
|
get customFonts() {
|
|
3751
|
-
|
|
3752
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
|
|
3890
|
+
return state.builderContextSignal.content?.data?.customFonts;
|
|
3753
3891
|
},
|
|
3754
3892
|
[_IMMUTABLE]: {
|
|
3755
|
-
contentId: _fnSignal((p0) =>
|
|
3756
|
-
var _a2;
|
|
3757
|
-
return (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.id;
|
|
3758
|
-
}, [
|
|
3893
|
+
contentId: _fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3759
3894
|
state
|
|
3760
3895
|
], "p0.builderContextSignal.content?.id"),
|
|
3761
|
-
cssCode: _fnSignal((p0) =>
|
|
3762
|
-
var _a2, _b2;
|
|
3763
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
|
|
3764
|
-
}, [
|
|
3896
|
+
cssCode: _fnSignal((p0) => p0.builderContextSignal.content?.data?.cssCode, [
|
|
3765
3897
|
state
|
|
3766
3898
|
], "p0.builderContextSignal.content?.data?.cssCode"),
|
|
3767
|
-
customFonts: _fnSignal((p0) =>
|
|
3768
|
-
var _a2, _b2;
|
|
3769
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
|
|
3770
|
-
}, [
|
|
3899
|
+
customFonts: _fnSignal((p0) => p0.builderContextSignal.content?.data?.customFonts, [
|
|
3771
3900
|
state
|
|
3772
3901
|
], "p0.builderContextSignal.content?.data?.customFonts")
|
|
3773
3902
|
}
|
|
3774
|
-
}, 3, "LQ_1"),
|
|
3903
|
+
}, 3, "LQ_1") ,
|
|
3775
3904
|
/* @__PURE__ */ _jsxC(Blocks, {
|
|
3776
3905
|
get blocks() {
|
|
3777
|
-
|
|
3778
|
-
return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
|
|
3906
|
+
return state.builderContextSignal.content?.data?.blocks;
|
|
3779
3907
|
},
|
|
3780
3908
|
get context() {
|
|
3781
3909
|
return state.builderContextSignal;
|
|
@@ -3784,10 +3912,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3784
3912
|
return state.registeredComponents;
|
|
3785
3913
|
},
|
|
3786
3914
|
[_IMMUTABLE]: {
|
|
3787
|
-
blocks: _fnSignal((p0) =>
|
|
3788
|
-
var _a2, _b2;
|
|
3789
|
-
return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
|
|
3790
|
-
}, [
|
|
3915
|
+
blocks: _fnSignal((p0) => p0.builderContextSignal.content?.data?.blocks, [
|
|
3791
3916
|
state
|
|
3792
3917
|
], "p0.builderContextSignal.content?.data?.blocks"),
|
|
3793
3918
|
context: _fnSignal((p0) => p0.builderContextSignal, [
|
|
@@ -3836,6 +3961,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
3836
3961
|
}
|
|
3837
3962
|
}, 1, "LQ_3");
|
|
3838
3963
|
}, "ContentComponent_component_HIsczUcxjCE"));
|
|
3964
|
+
|
|
3839
3965
|
const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3840
3966
|
_jsxBranch();
|
|
3841
3967
|
const state = useStore({
|
|
@@ -3845,12 +3971,11 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3845
3971
|
})
|
|
3846
3972
|
});
|
|
3847
3973
|
const variantScriptStr = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3848
|
-
var _a;
|
|
3849
3974
|
const [props2] = useLexicalScope();
|
|
3850
3975
|
return getVariantsScriptString(getVariants(props2.content).map((value) => ({
|
|
3851
3976
|
id: value.testVariationId,
|
|
3852
3977
|
testRatio: value.testRatio
|
|
3853
|
-
})),
|
|
3978
|
+
})), props2.content?.id || "");
|
|
3854
3979
|
}, "ContentVariants_component_variantScriptStr_useComputed_ldWqWafT8Ww", [
|
|
3855
3980
|
props
|
|
3856
3981
|
]));
|
|
@@ -3861,11 +3986,10 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3861
3986
|
props
|
|
3862
3987
|
]));
|
|
3863
3988
|
const defaultContent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3864
|
-
var _a;
|
|
3865
3989
|
const [props2, state2] = useLexicalScope();
|
|
3866
3990
|
return state2.shouldRenderVariants ? {
|
|
3867
3991
|
...props2.content,
|
|
3868
|
-
testVariationId:
|
|
3992
|
+
testVariationId: props2.content?.id
|
|
3869
3993
|
} : handleABTestingSync({
|
|
3870
3994
|
item: props2.content,
|
|
3871
3995
|
canTrack: getDefaultCanTrack(props2.canTrack)
|
|
@@ -3888,17 +4012,13 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
3888
4012
|
children: [
|
|
3889
4013
|
/* @__PURE__ */ _jsxC(InlinedStyles, {
|
|
3890
4014
|
get id() {
|
|
3891
|
-
|
|
3892
|
-
return `variants-styles-${(_a = props.content) == null ? void 0 : _a.id}`;
|
|
4015
|
+
return `variants-styles-${props.content?.id}`;
|
|
3893
4016
|
},
|
|
3894
4017
|
get styles() {
|
|
3895
4018
|
return hideVariantsStyleString.value;
|
|
3896
4019
|
},
|
|
3897
4020
|
[_IMMUTABLE]: {
|
|
3898
|
-
id: _fnSignal((p0) => {
|
|
3899
|
-
var _a;
|
|
3900
|
-
return `variants-styles-${(_a = p0.content) == null ? void 0 : _a.id}`;
|
|
3901
|
-
}, [
|
|
4021
|
+
id: _fnSignal((p0) => `variants-styles-${p0.content?.id}`, [
|
|
3902
4022
|
props
|
|
3903
4023
|
], "`variants-styles-${p0.content?.id}`"),
|
|
3904
4024
|
styles: _fnSignal((p0) => p0.value, [
|
|
@@ -4002,8 +4122,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4002
4122
|
return defaultContent.value;
|
|
4003
4123
|
},
|
|
4004
4124
|
get classNameProp() {
|
|
4005
|
-
|
|
4006
|
-
return `variant-${(_a = props.content) == null ? void 0 : _a.id}`;
|
|
4125
|
+
return `variant-${props.content?.id}`;
|
|
4007
4126
|
},
|
|
4008
4127
|
showContent: true,
|
|
4009
4128
|
get model() {
|
|
@@ -4049,10 +4168,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4049
4168
|
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
4050
4169
|
props
|
|
4051
4170
|
], "p0.canTrack"),
|
|
4052
|
-
classNameProp: _fnSignal((p0) => {
|
|
4053
|
-
var _a;
|
|
4054
|
-
return `variant-${(_a = p0.content) == null ? void 0 : _a.id}`;
|
|
4055
|
-
}, [
|
|
4171
|
+
classNameProp: _fnSignal((p0) => `variant-${p0.content?.id}`, [
|
|
4056
4172
|
props
|
|
4057
4173
|
], "`variant-${p0.content?.id}`"),
|
|
4058
4174
|
content: _fnSignal((p0) => p0.value, [
|
|
@@ -4088,14 +4204,15 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4088
4204
|
]
|
|
4089
4205
|
}, 1, "XM_5");
|
|
4090
4206
|
}, "ContentVariants_component_4tFRiQMMEfM"));
|
|
4207
|
+
|
|
4091
4208
|
const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
|
|
4092
|
-
if (
|
|
4093
|
-
|
|
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)
|
|
4094
4211
|
return fetchOneEntry({
|
|
4095
4212
|
model: symbol.model,
|
|
4096
4213
|
apiKey: builderContextValue.apiKey,
|
|
4097
4214
|
apiVersion: builderContextValue.apiVersion,
|
|
4098
|
-
...
|
|
4215
|
+
...symbol?.entry && {
|
|
4099
4216
|
query: {
|
|
4100
4217
|
id: symbol.entry
|
|
4101
4218
|
}
|
|
@@ -4106,6 +4223,7 @@ const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
|
|
|
4106
4223
|
});
|
|
4107
4224
|
return void 0;
|
|
4108
4225
|
};
|
|
4226
|
+
|
|
4109
4227
|
const setContent = function setContent2(props, state) {
|
|
4110
4228
|
if (state.contentToUse)
|
|
4111
4229
|
return;
|
|
@@ -4118,25 +4236,23 @@ const setContent = function setContent2(props, state) {
|
|
|
4118
4236
|
});
|
|
4119
4237
|
};
|
|
4120
4238
|
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4121
|
-
var _a;
|
|
4122
4239
|
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
4123
|
-
var _a2, _b;
|
|
4124
4240
|
const [props2] = useLexicalScope();
|
|
4125
4241
|
return [
|
|
4126
4242
|
props2.attributes.class,
|
|
4127
4243
|
"builder-symbol",
|
|
4128
|
-
|
|
4129
|
-
|
|
4244
|
+
props2.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4245
|
+
props2.symbol?.dynamic || props2.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4130
4246
|
].filter(Boolean).join(" ");
|
|
4131
4247
|
}, "Symbol_component_className_useComputed_Wb6GqgtDHpE", [
|
|
4132
4248
|
props
|
|
4133
4249
|
]));
|
|
4134
4250
|
const state = useStore({
|
|
4135
|
-
contentToUse:
|
|
4251
|
+
contentToUse: props.symbol?.content
|
|
4136
4252
|
});
|
|
4137
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track
|
|
4253
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track }) => {
|
|
4138
4254
|
const [props2, state2] = useLexicalScope();
|
|
4139
|
-
|
|
4255
|
+
track(() => props2.symbol);
|
|
4140
4256
|
setContent(props2, state2);
|
|
4141
4257
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
4142
4258
|
props,
|
|
@@ -4158,16 +4274,14 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4158
4274
|
return Object.values(props.builderComponents);
|
|
4159
4275
|
},
|
|
4160
4276
|
get data() {
|
|
4161
|
-
var _a2, _b, _c;
|
|
4162
4277
|
return {
|
|
4163
|
-
...
|
|
4278
|
+
...props.symbol?.data,
|
|
4164
4279
|
...props.builderContext.localState,
|
|
4165
|
-
...
|
|
4280
|
+
...state.contentToUse?.data?.state
|
|
4166
4281
|
};
|
|
4167
4282
|
},
|
|
4168
4283
|
get model() {
|
|
4169
|
-
|
|
4170
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
4284
|
+
return props.symbol?.model;
|
|
4171
4285
|
},
|
|
4172
4286
|
get content() {
|
|
4173
4287
|
return state.contentToUse;
|
|
@@ -4188,21 +4302,15 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4188
4302
|
customComponents: _fnSignal((p0) => Object.values(p0.builderComponents), [
|
|
4189
4303
|
props
|
|
4190
4304
|
], "Object.values(p0.builderComponents)"),
|
|
4191
|
-
data: _fnSignal((p0, p1) => {
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
...(_c = (_b = p1.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
|
|
4197
|
-
};
|
|
4198
|
-
}, [
|
|
4305
|
+
data: _fnSignal((p0, p1) => ({
|
|
4306
|
+
...p0.symbol?.data,
|
|
4307
|
+
...p0.builderContext.localState,
|
|
4308
|
+
...p1.contentToUse?.data?.state
|
|
4309
|
+
}), [
|
|
4199
4310
|
props,
|
|
4200
4311
|
state
|
|
4201
4312
|
], "{...p0.symbol?.data,...p0.builderContext.localState,...p1.contentToUse?.data?.state}"),
|
|
4202
|
-
model: _fnSignal((p0) =>
|
|
4203
|
-
var _a2;
|
|
4204
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
4205
|
-
}, [
|
|
4313
|
+
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
4206
4314
|
props
|
|
4207
4315
|
], "p0.symbol?.model")
|
|
4208
4316
|
}
|
|
@@ -4213,8 +4321,10 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4213
4321
|
], "p0.value")
|
|
4214
4322
|
}, 0, "Wt_1");
|
|
4215
4323
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
4324
|
+
|
|
4216
4325
|
const RenderBlocks = Blocks;
|
|
4217
4326
|
const RenderContent = ContentVariants;
|
|
4327
|
+
|
|
4218
4328
|
const settings = {};
|
|
4219
4329
|
function setEditorSettings(newSettings) {
|
|
4220
4330
|
if (isBrowser()) {
|
|
@@ -4226,9 +4336,9 @@ function setEditorSettings(newSettings) {
|
|
|
4226
4336
|
parent.postMessage(message, "*");
|
|
4227
4337
|
}
|
|
4228
4338
|
}
|
|
4339
|
+
|
|
4229
4340
|
const fetchBuilderProps = async (_args) => {
|
|
4230
|
-
|
|
4231
|
-
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;
|
|
4232
4342
|
const getContentArgs = {
|
|
4233
4343
|
..._args,
|
|
4234
4344
|
apiKey: _args.apiKey,
|
|
@@ -4239,7 +4349,7 @@ const fetchBuilderProps = async (_args) => {
|
|
|
4239
4349
|
urlPath
|
|
4240
4350
|
} : {}
|
|
4241
4351
|
},
|
|
4242
|
-
options: getBuilderSearchParams(_args.searchParams ||
|
|
4352
|
+
options: getBuilderSearchParams(_args.searchParams || _args.url?.searchParams || _args.options)
|
|
4243
4353
|
};
|
|
4244
4354
|
return {
|
|
4245
4355
|
apiKey: getContentArgs.apiKey,
|
|
@@ -4247,30 +4357,5 @@ const fetchBuilderProps = async (_args) => {
|
|
|
4247
4357
|
content: await fetchOneEntry(getContentArgs)
|
|
4248
4358
|
};
|
|
4249
4359
|
};
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
Button,
|
|
4253
|
-
Columns,
|
|
4254
|
-
ContentVariants as Content,
|
|
4255
|
-
FragmentComponent as Fragment,
|
|
4256
|
-
Image,
|
|
4257
|
-
RenderBlocks,
|
|
4258
|
-
RenderContent,
|
|
4259
|
-
SectionComponent as Section,
|
|
4260
|
-
Symbol$1 as Symbol,
|
|
4261
|
-
Text,
|
|
4262
|
-
Video,
|
|
4263
|
-
_processContentResult,
|
|
4264
|
-
createRegisterComponentMessage,
|
|
4265
|
-
fetchBuilderProps,
|
|
4266
|
-
fetchEntries,
|
|
4267
|
-
fetchOneEntry,
|
|
4268
|
-
getAllContent,
|
|
4269
|
-
getBuilderSearchParams,
|
|
4270
|
-
getContent,
|
|
4271
|
-
isEditing,
|
|
4272
|
-
isPreviewing,
|
|
4273
|
-
register,
|
|
4274
|
-
setEditorSettings,
|
|
4275
|
-
track
|
|
4276
|
-
};
|
|
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 };
|