@builder.io/sdk-qwik 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.qwik.cjs +1012 -656
- package/lib/index.qwik.mjs +1013 -657
- package/package.json +3 -6
- package/types/components/render-block/render-block.helpers.d.ts +0 -1
- package/types/components/render-block/render-component-with-context.d.ts +3 -0
- package/types/components/render-content/render-content.d.ts +1 -1
- package/types/components/render-content/render-content.types.d.ts +11 -2
- package/types/components/render-content/wrap-component-ref.d.ts +6 -0
- package/types/components/render-content-variants/helpers.d.ts +17 -0
- package/types/components/render-content-variants/render-content-variants.d.ts +3 -0
- package/types/components/render-inlined-styles.d.ts +1 -0
- package/types/constants/sdk-version.d.ts +1 -0
- package/types/context/types.d.ts +17 -2
- package/types/functions/convert-style-object.d.ts +1 -0
- package/types/functions/evaluate.d.ts +4 -3
- package/types/functions/evaluate.test.d.ts +1 -0
- package/types/functions/get-block-actions-handler.d.ts +1 -1
- package/types/functions/get-block-actions.d.ts +1 -1
- package/types/functions/get-block-styles.d.ts +6 -0
- package/types/functions/get-block-tag.d.ts +3 -0
- package/types/functions/get-content/fn.test.d.ts +1 -0
- package/types/functions/get-content/index.d.ts +7 -2
- package/types/functions/get-content/types.d.ts +6 -0
- package/types/functions/get-processed-block.d.ts +2 -2
- package/types/functions/mark-mutable.d.ts +2 -0
- package/types/functions/sanitize-styles.d.ts +4 -0
- package/types/functions/track.d.ts +56 -0
- package/types/helpers/ab-tests.d.ts +8 -7
- package/types/helpers/canTrack.d.ts +1 -0
- package/types/helpers/cookie.d.ts +7 -3
- package/types/helpers/logger.d.ts +1 -0
- package/types/index-helpers/blocks-exports.d.ts +1 -1
- package/types/index.d.ts +8 -7
- package/types/scripts/init-editing.d.ts +1 -0
- package/types/talk/generators-updated.d.ts +1 -0
- package/types/talk/generators.d.ts +6 -0
- package/types/types/builder-content.d.ts +1 -3
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, _wrapProp, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
@@ -32,7 +32,7 @@ const STYLES$3 = `
|
|
|
32
32
|
all: unset;
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
|
-
const
|
|
35
|
+
const BuilderContext = createContextId("Builder");
|
|
36
36
|
const TARGET = "qwik";
|
|
37
37
|
function isBrowser() {
|
|
38
38
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -86,7 +86,7 @@ const getSizesForBreakpoints = ({ small, medium }) => {
|
|
|
86
86
|
};
|
|
87
87
|
return newSizes;
|
|
88
88
|
};
|
|
89
|
-
function evaluate({ code, context,
|
|
89
|
+
function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
|
|
90
90
|
if (code === "") {
|
|
91
91
|
console.warn("Skipping evaluation of empty code block.");
|
|
92
92
|
return;
|
|
@@ -99,11 +99,29 @@ function evaluate({ code, context, state, event, isExpression = true }) {
|
|
|
99
99
|
const useReturn = isExpression && !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "));
|
|
100
100
|
const useCode = useReturn ? `return (${code});` : code;
|
|
101
101
|
try {
|
|
102
|
-
return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder,
|
|
102
|
+
return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, flattenState(rootState, localState, rootSetState), context, event);
|
|
103
103
|
} catch (e) {
|
|
104
104
|
console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
function flattenState(rootState, localState, rootSetState) {
|
|
108
|
+
if (rootState === localState)
|
|
109
|
+
throw new Error("rootState === localState");
|
|
110
|
+
return new Proxy(rootState, {
|
|
111
|
+
get: (_, prop) => {
|
|
112
|
+
if (localState && prop in localState)
|
|
113
|
+
return localState[prop];
|
|
114
|
+
return rootState[prop];
|
|
115
|
+
},
|
|
116
|
+
set: (_, prop, value) => {
|
|
117
|
+
if (localState && prop in localState)
|
|
118
|
+
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
119
|
+
rootState[prop] = value;
|
|
120
|
+
rootSetState?.(rootState);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
107
125
|
const set = (obj, _path, value) => {
|
|
108
126
|
if (Object(obj) !== obj)
|
|
109
127
|
return obj;
|
|
@@ -114,7 +132,7 @@ const set = (obj, _path, value) => {
|
|
|
114
132
|
function transformBlock(block) {
|
|
115
133
|
return block;
|
|
116
134
|
}
|
|
117
|
-
const evaluateBindings = ({ block, context,
|
|
135
|
+
const evaluateBindings = ({ block, context, localState, rootState, rootSetState }) => {
|
|
118
136
|
if (!block.bindings)
|
|
119
137
|
return block;
|
|
120
138
|
const copy = fastClone(block);
|
|
@@ -131,19 +149,23 @@ const evaluateBindings = ({ block, context, state }) => {
|
|
|
131
149
|
const expression = block.bindings[binding];
|
|
132
150
|
const value = evaluate({
|
|
133
151
|
code: expression,
|
|
134
|
-
|
|
152
|
+
localState,
|
|
153
|
+
rootState,
|
|
154
|
+
rootSetState,
|
|
135
155
|
context
|
|
136
156
|
});
|
|
137
157
|
set(copied, binding, value);
|
|
138
158
|
}
|
|
139
159
|
return copied;
|
|
140
160
|
};
|
|
141
|
-
function getProcessedBlock({ block, context, shouldEvaluateBindings,
|
|
161
|
+
function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }) {
|
|
142
162
|
const transformedBlock = transformBlock(block);
|
|
143
163
|
if (shouldEvaluateBindings)
|
|
144
164
|
return evaluateBindings({
|
|
145
165
|
block: transformedBlock,
|
|
146
|
-
|
|
166
|
+
localState,
|
|
167
|
+
rootState,
|
|
168
|
+
rootSetState,
|
|
147
169
|
context
|
|
148
170
|
});
|
|
149
171
|
else
|
|
@@ -173,23 +195,14 @@ const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
|
173
195
|
return cssClass;
|
|
174
196
|
};
|
|
175
197
|
const RenderInlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
tag
|
|
185
|
-
]));
|
|
186
|
-
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
187
|
-
children: /* @__PURE__ */ _jsxQ("style", null, {
|
|
188
|
-
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
189
|
-
props
|
|
190
|
-
], "p0.styles")
|
|
191
|
-
}, null, 3, "zz_0")
|
|
192
|
-
}, 1, "zz_2");
|
|
198
|
+
return /* @__PURE__ */ _jsxQ("style", null, {
|
|
199
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
200
|
+
props
|
|
201
|
+
], "p0.styles"),
|
|
202
|
+
id: _fnSignal((p0) => p0.id, [
|
|
203
|
+
props
|
|
204
|
+
], "p0.id")
|
|
205
|
+
}, null, 3, "zz_0");
|
|
193
206
|
}, "RenderInlinedStyles_component_ejNQtXd1ahM"));
|
|
194
207
|
const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
195
208
|
_jsxBranch();
|
|
@@ -197,7 +210,9 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
197
210
|
const [props2] = useLexicalScope();
|
|
198
211
|
return getProcessedBlock({
|
|
199
212
|
block: props2.block,
|
|
200
|
-
|
|
213
|
+
localState: props2.context.localState,
|
|
214
|
+
rootState: props2.context.rootState,
|
|
215
|
+
rootSetState: props2.context.rootSetState,
|
|
201
216
|
context: props2.context.context,
|
|
202
217
|
shouldEvaluateBindings: true
|
|
203
218
|
});
|
|
@@ -271,7 +286,9 @@ function createEventHandler(value, options) {
|
|
|
271
286
|
return evaluate({
|
|
272
287
|
code: value2,
|
|
273
288
|
context: options2.context,
|
|
274
|
-
|
|
289
|
+
localState: options2.localState,
|
|
290
|
+
rootState: options2.rootState,
|
|
291
|
+
rootSetState: options2.rootSetState,
|
|
275
292
|
event
|
|
276
293
|
});
|
|
277
294
|
}, "createEventHandler_7wCAiJVliNE", [
|
|
@@ -358,7 +375,9 @@ const isEmptyHtmlElement = (tagName) => {
|
|
|
358
375
|
const getComponent = ({ block, context }) => {
|
|
359
376
|
const componentName = getProcessedBlock({
|
|
360
377
|
block,
|
|
361
|
-
|
|
378
|
+
localState: context.localState,
|
|
379
|
+
rootState: context.rootState,
|
|
380
|
+
rootSetState: context.rootSetState,
|
|
362
381
|
context: context.context,
|
|
363
382
|
shouldEvaluateBindings: false
|
|
364
383
|
}).component?.name;
|
|
@@ -379,7 +398,9 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
379
398
|
return void 0;
|
|
380
399
|
const itemsArray = evaluate({
|
|
381
400
|
code: repeat.collection,
|
|
382
|
-
|
|
401
|
+
localState: context.localState,
|
|
402
|
+
rootState: context.rootState,
|
|
403
|
+
rootSetState: context.rootSetState,
|
|
383
404
|
context: context.context
|
|
384
405
|
});
|
|
385
406
|
if (!Array.isArray(itemsArray))
|
|
@@ -389,8 +410,8 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
389
410
|
const repeatArray = itemsArray.map((item, index) => ({
|
|
390
411
|
context: {
|
|
391
412
|
...context,
|
|
392
|
-
|
|
393
|
-
...context.
|
|
413
|
+
localState: {
|
|
414
|
+
...context.localState,
|
|
394
415
|
$index: index,
|
|
395
416
|
$item: item,
|
|
396
417
|
[itemNameToUse]: item,
|
|
@@ -401,20 +422,6 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
401
422
|
}));
|
|
402
423
|
return repeatArray;
|
|
403
424
|
};
|
|
404
|
-
const getProxyState = (context) => {
|
|
405
|
-
if (typeof Proxy === "undefined") {
|
|
406
|
-
console.error("no Proxy available in this environment, cannot proxy state.");
|
|
407
|
-
return context.state;
|
|
408
|
-
}
|
|
409
|
-
const useState = new Proxy(context.state, {
|
|
410
|
-
set: (obj, prop, value) => {
|
|
411
|
-
obj[prop] = value;
|
|
412
|
-
context.setState?.(obj);
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
return useState;
|
|
417
|
-
};
|
|
418
425
|
const RenderComponent = (props) => {
|
|
419
426
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
420
427
|
children: props.componentRef ? /* @__PURE__ */ _jsxC(props.componentRef, {
|
|
@@ -447,9 +454,11 @@ const RenderComponent = (props) => {
|
|
|
447
454
|
}, 1, "R9_1");
|
|
448
455
|
};
|
|
449
456
|
const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
450
|
-
useContextProvider(
|
|
457
|
+
useContextProvider(BuilderContext, useStore({
|
|
451
458
|
content: props.repeatContext.content,
|
|
452
|
-
|
|
459
|
+
localState: props.repeatContext.localState,
|
|
460
|
+
rootState: props.repeatContext.rootState,
|
|
461
|
+
rootSetState: props.repeatContext.rootSetState,
|
|
453
462
|
context: props.repeatContext.context,
|
|
454
463
|
apiKey: props.repeatContext.apiKey,
|
|
455
464
|
registeredComponents: props.repeatContext.registeredComponents,
|
|
@@ -476,8 +485,7 @@ const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlined
|
|
|
476
485
|
const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
477
486
|
_jsxBranch();
|
|
478
487
|
const state = useStore({
|
|
479
|
-
|
|
480
|
-
tag: props.block.tagName || "div"
|
|
488
|
+
Tag: props.block.tagName || "div"
|
|
481
489
|
});
|
|
482
490
|
const component = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
483
491
|
const [props2] = useLexicalScope();
|
|
@@ -488,26 +496,28 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
488
496
|
}, "RenderBlock_component_component_useComputed_qb7DMTJ9XGY", [
|
|
489
497
|
props
|
|
490
498
|
]));
|
|
491
|
-
const
|
|
499
|
+
const repeatItem = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
492
500
|
const [props2] = useLexicalScope();
|
|
493
501
|
return getRepeatItemData({
|
|
494
502
|
block: props2.block,
|
|
495
503
|
context: props2.context
|
|
496
504
|
});
|
|
497
|
-
}, "
|
|
505
|
+
}, "RenderBlock_component_repeatItem_useComputed_NslhinGDzrU", [
|
|
498
506
|
props
|
|
499
507
|
]));
|
|
500
508
|
const useBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
501
|
-
const [props2,
|
|
502
|
-
return
|
|
509
|
+
const [props2, repeatItem2] = useLexicalScope();
|
|
510
|
+
return repeatItem2.value ? props2.block : getProcessedBlock({
|
|
503
511
|
block: props2.block,
|
|
504
|
-
|
|
512
|
+
localState: props2.context.localState,
|
|
513
|
+
rootState: props2.context.rootState,
|
|
514
|
+
rootSetState: props2.context.rootSetState,
|
|
505
515
|
context: props2.context.context,
|
|
506
516
|
shouldEvaluateBindings: true
|
|
507
517
|
});
|
|
508
518
|
}, "RenderBlock_component_useBlock_useComputed_4ZTSqMpaluI", [
|
|
509
519
|
props,
|
|
510
|
-
|
|
520
|
+
repeatItem
|
|
511
521
|
]));
|
|
512
522
|
const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
513
523
|
const [useBlock2] = useLexicalScope();
|
|
@@ -520,15 +530,16 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
520
530
|
useBlock
|
|
521
531
|
]));
|
|
522
532
|
const actions = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
523
|
-
const [props2,
|
|
533
|
+
const [props2, useBlock2] = useLexicalScope();
|
|
524
534
|
return getBlockActions({
|
|
525
535
|
block: useBlock2.value,
|
|
526
|
-
|
|
536
|
+
rootState: props2.context.rootState,
|
|
537
|
+
rootSetState: props2.context.rootSetState,
|
|
538
|
+
localState: props2.context.localState,
|
|
527
539
|
context: props2.context.context
|
|
528
540
|
});
|
|
529
541
|
}, "RenderBlock_component_actions_useComputed_AOTwdXfwCqY", [
|
|
530
542
|
props,
|
|
531
|
-
state,
|
|
532
543
|
useBlock
|
|
533
544
|
]));
|
|
534
545
|
const attributes = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
@@ -543,12 +554,12 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
543
554
|
useBlock
|
|
544
555
|
]));
|
|
545
556
|
const childrenWithoutParentComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
546
|
-
const [component2,
|
|
547
|
-
const shouldRenderChildrenOutsideRef = !component2.value?.component && !
|
|
557
|
+
const [component2, repeatItem2, useBlock2] = useLexicalScope();
|
|
558
|
+
const shouldRenderChildrenOutsideRef = !component2.value?.component && !repeatItem2.value;
|
|
548
559
|
return shouldRenderChildrenOutsideRef ? useBlock2.value.children ?? [] : [];
|
|
549
560
|
}, "RenderBlock_component_childrenWithoutParentComponent_useComputed_l4hT2V9liQc", [
|
|
550
561
|
component,
|
|
551
|
-
|
|
562
|
+
repeatItem,
|
|
552
563
|
useBlock
|
|
553
564
|
]));
|
|
554
565
|
const childrenContext = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
@@ -559,10 +570,11 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
559
570
|
return {
|
|
560
571
|
apiKey: props2.context.apiKey,
|
|
561
572
|
apiVersion: props2.context.apiVersion,
|
|
562
|
-
|
|
573
|
+
localState: props2.context.localState,
|
|
574
|
+
rootState: props2.context.rootState,
|
|
575
|
+
rootSetState: props2.context.rootSetState,
|
|
563
576
|
content: props2.context.content,
|
|
564
577
|
context: props2.context.context,
|
|
565
|
-
setState: props2.context.setState,
|
|
566
578
|
registeredComponents: props2.context.registeredComponents,
|
|
567
579
|
inheritedStyles: getInheritedTextStyles()
|
|
568
580
|
};
|
|
@@ -597,11 +609,11 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
597
609
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
598
610
|
children: canShowBlock.value ? !component.value?.noWrap ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
599
611
|
children: [
|
|
600
|
-
isEmptyHtmlElement(state.
|
|
612
|
+
isEmptyHtmlElement(state.Tag) ? /* @__PURE__ */ _jsxC(state.Tag, {
|
|
601
613
|
...attributes.value,
|
|
602
614
|
...actions.value
|
|
603
615
|
}, 0, "9d_0") : null,
|
|
604
|
-
!isEmptyHtmlElement(state.
|
|
616
|
+
!isEmptyHtmlElement(state.Tag) && repeatItem.value ? (repeatItem.value || []).map(function(data, index) {
|
|
605
617
|
return /* @__PURE__ */ _jsxC(RenderRepeatedBlock, {
|
|
606
618
|
get repeatContext() {
|
|
607
619
|
return data.context;
|
|
@@ -615,7 +627,7 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
615
627
|
}
|
|
616
628
|
}, 3, index);
|
|
617
629
|
}) : null,
|
|
618
|
-
!isEmptyHtmlElement(state.
|
|
630
|
+
!isEmptyHtmlElement(state.Tag) && !repeatItem.value ? /* @__PURE__ */ _jsxC(state.Tag, {
|
|
619
631
|
...attributes.value,
|
|
620
632
|
...actions.value,
|
|
621
633
|
children: [
|
|
@@ -656,7 +668,7 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
656
668
|
}, 0, "9d_4") : null
|
|
657
669
|
}, 1, "9d_5");
|
|
658
670
|
}, "RenderBlock_component_m0hg0zT573Q"));
|
|
659
|
-
const onClick$1 = function onClick2(props, state,
|
|
671
|
+
const onClick$1 = function onClick2(props, state, builderContext) {
|
|
660
672
|
if (isEditing() && !props.blocks?.length)
|
|
661
673
|
window.parent?.postMessage({
|
|
662
674
|
type: "builder.clickEmptyBlocks",
|
|
@@ -666,7 +678,7 @@ const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
|
666
678
|
}
|
|
667
679
|
}, "*");
|
|
668
680
|
};
|
|
669
|
-
const onMouseEnter = function onMouseEnter2(props, state,
|
|
681
|
+
const onMouseEnter = function onMouseEnter2(props, state, builderContext) {
|
|
670
682
|
if (isEditing() && !props.blocks?.length)
|
|
671
683
|
window.parent?.postMessage({
|
|
672
684
|
type: "builder.hoverEmptyBlocks",
|
|
@@ -678,7 +690,7 @@ const onMouseEnter = function onMouseEnter2(props, state, builderContext2) {
|
|
|
678
690
|
};
|
|
679
691
|
const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
680
692
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "RenderBlocks_component_useStylesScoped_0XKYzaR059E"));
|
|
681
|
-
const builderContext
|
|
693
|
+
const builderContext = useContext(BuilderContext);
|
|
682
694
|
const state = {};
|
|
683
695
|
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
684
696
|
const [props2] = useLexicalScope();
|
|
@@ -691,7 +703,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
691
703
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
692
704
|
return onClick$1(props2);
|
|
693
705
|
}, "RenderBlocks_component_div_onClick_RzhhZa265Yg", [
|
|
694
|
-
builderContext
|
|
706
|
+
builderContext,
|
|
695
707
|
props,
|
|
696
708
|
state
|
|
697
709
|
]),
|
|
@@ -699,7 +711,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
699
711
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
700
712
|
return onMouseEnter(props2);
|
|
701
713
|
}, "RenderBlocks_component_div_onMouseEnter_nG7I7RYG3JQ", [
|
|
702
|
-
builderContext
|
|
714
|
+
builderContext,
|
|
703
715
|
props,
|
|
704
716
|
state
|
|
705
717
|
])
|
|
@@ -720,7 +732,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
720
732
|
props.blocks ? (props.blocks || []).map(function(block) {
|
|
721
733
|
return /* @__PURE__ */ _jsxC(RenderBlock, {
|
|
722
734
|
block,
|
|
723
|
-
context: builderContext
|
|
735
|
+
context: builderContext,
|
|
724
736
|
[_IMMUTABLE]: {
|
|
725
737
|
context: _IMMUTABLE
|
|
726
738
|
}
|
|
@@ -729,7 +741,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
729
741
|
props.blocks ? (props.blocks || []).map(function(block) {
|
|
730
742
|
return /* @__PURE__ */ _jsxC(BlockStyles, {
|
|
731
743
|
block,
|
|
732
|
-
context: builderContext
|
|
744
|
+
context: builderContext,
|
|
733
745
|
[_IMMUTABLE]: {
|
|
734
746
|
context: _IMMUTABLE
|
|
735
747
|
}
|
|
@@ -744,52 +756,54 @@ const STYLES$2 = `
|
|
|
744
756
|
align-items: stretch;
|
|
745
757
|
}
|
|
746
758
|
`;
|
|
747
|
-
const getWidth = function getWidth2(props, state,
|
|
759
|
+
const getWidth = function getWidth2(props, state, builderContext, index) {
|
|
748
760
|
return state.cols[index]?.width || 100 / state.cols.length;
|
|
749
761
|
};
|
|
750
|
-
const getColumnCssWidth = function getColumnCssWidth2(props, state,
|
|
762
|
+
const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext, index) {
|
|
751
763
|
const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
|
|
752
|
-
return `calc(${getWidth(props, state,
|
|
764
|
+
return `calc(${getWidth(props, state, builderContext, index)}% - ${subtractWidth}px)`;
|
|
753
765
|
};
|
|
754
|
-
const getTabletStyle = function getTabletStyle2(props, state,
|
|
766
|
+
const getTabletStyle = function getTabletStyle2(props, state, builderContext, { stackedStyle, desktopStyle }) {
|
|
755
767
|
return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
756
768
|
};
|
|
757
|
-
const getMobileStyle = function getMobileStyle2(props, state,
|
|
769
|
+
const getMobileStyle = function getMobileStyle2(props, state, builderContext, { stackedStyle, desktopStyle }) {
|
|
758
770
|
return state.stackAt === "never" ? desktopStyle : stackedStyle;
|
|
759
771
|
};
|
|
760
|
-
const columnCssVars = function columnCssVars2(props, state,
|
|
761
|
-
index === 0 ? 0 : state.gutterSize;
|
|
762
|
-
const width = getColumnCssWidth(props, state,
|
|
763
|
-
const gutterPixels = `${
|
|
772
|
+
const columnCssVars = function columnCssVars2(props, state, builderContext, index) {
|
|
773
|
+
const gutter = index === 0 ? 0 : state.gutterSize;
|
|
774
|
+
const width = getColumnCssWidth(props, state, builderContext, index);
|
|
775
|
+
const gutterPixels = `${gutter}px`;
|
|
776
|
+
const mobileWidth = "100%";
|
|
777
|
+
const mobileMarginLeft = 0;
|
|
764
778
|
return {
|
|
765
779
|
width,
|
|
766
780
|
"margin-left": gutterPixels,
|
|
767
|
-
"--column-width-mobile": getMobileStyle(props, state,
|
|
768
|
-
stackedStyle:
|
|
781
|
+
"--column-width-mobile": getMobileStyle(props, state, builderContext, {
|
|
782
|
+
stackedStyle: mobileWidth,
|
|
769
783
|
desktopStyle: width
|
|
770
784
|
}),
|
|
771
|
-
"--column-margin-left-mobile": getMobileStyle(props, state,
|
|
772
|
-
stackedStyle:
|
|
785
|
+
"--column-margin-left-mobile": getMobileStyle(props, state, builderContext, {
|
|
786
|
+
stackedStyle: mobileMarginLeft,
|
|
773
787
|
desktopStyle: gutterPixels
|
|
774
788
|
}),
|
|
775
|
-
"--column-width-tablet": getTabletStyle(props, state,
|
|
776
|
-
stackedStyle:
|
|
789
|
+
"--column-width-tablet": getTabletStyle(props, state, builderContext, {
|
|
790
|
+
stackedStyle: mobileWidth,
|
|
777
791
|
desktopStyle: width
|
|
778
792
|
}),
|
|
779
|
-
"--column-margin-left-tablet": getTabletStyle(props, state,
|
|
780
|
-
stackedStyle:
|
|
793
|
+
"--column-margin-left-tablet": getTabletStyle(props, state, builderContext, {
|
|
794
|
+
stackedStyle: mobileMarginLeft,
|
|
781
795
|
desktopStyle: gutterPixels
|
|
782
796
|
})
|
|
783
797
|
};
|
|
784
798
|
};
|
|
785
|
-
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state,
|
|
786
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
799
|
+
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext, size) {
|
|
800
|
+
const breakpointSizes = getSizesForBreakpoints(builderContext.content?.meta?.breakpoints || {});
|
|
787
801
|
return breakpointSizes[size].max;
|
|
788
802
|
};
|
|
789
803
|
const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
790
804
|
_jsxBranch();
|
|
791
805
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
|
|
792
|
-
const builderContext
|
|
806
|
+
const builderContext = useContext(BuilderContext);
|
|
793
807
|
const state = useStore({
|
|
794
808
|
cols: props.columns || [],
|
|
795
809
|
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
@@ -806,7 +820,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
806
820
|
})
|
|
807
821
|
};
|
|
808
822
|
}, "Columns_component_columnsCssVars_useComputed_adFEq2RWT9s", [
|
|
809
|
-
builderContext
|
|
823
|
+
builderContext,
|
|
810
824
|
props,
|
|
811
825
|
state
|
|
812
826
|
]));
|
|
@@ -838,7 +852,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
838
852
|
},
|
|
839
853
|
`;
|
|
840
854
|
}, "Columns_component_columnsStyles_useComputed_nBtMPbzd1Wc", [
|
|
841
|
-
builderContext
|
|
855
|
+
builderContext,
|
|
842
856
|
props,
|
|
843
857
|
state
|
|
844
858
|
]));
|
|
@@ -862,7 +876,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
862
876
|
}, 3, "c0_0"),
|
|
863
877
|
(props.columns || []).map(function(column, index) {
|
|
864
878
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
865
|
-
style: columnCssVars(props, state, builderContext
|
|
879
|
+
style: columnCssVars(props, state, builderContext, index)
|
|
866
880
|
}, {
|
|
867
881
|
class: "builder-column div-Columns-2"
|
|
868
882
|
}, /* @__PURE__ */ _jsxC(RenderBlocks, {
|
|
@@ -960,16 +974,17 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
960
974
|
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
961
975
|
const [props2] = useLexicalScope();
|
|
962
976
|
const imageToUse = props2.image || props2.src;
|
|
963
|
-
|
|
977
|
+
const url = imageToUse;
|
|
978
|
+
if (!url || !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
|
|
964
979
|
return props2.srcset;
|
|
965
980
|
if (props2.srcset && props2.image?.includes("builder.io/api/v1/image")) {
|
|
966
981
|
if (!props2.srcset.includes(props2.image.split("?")[0])) {
|
|
967
982
|
console.debug("Removed given srcset");
|
|
968
|
-
return getSrcSet(
|
|
983
|
+
return getSrcSet(url);
|
|
969
984
|
}
|
|
970
985
|
} else if (props2.image && !props2.srcset)
|
|
971
|
-
return getSrcSet(
|
|
972
|
-
return getSrcSet(
|
|
986
|
+
return getSrcSet(url);
|
|
987
|
+
return getSrcSet(url);
|
|
973
988
|
}, "Image_component_srcSetToUse_useComputed_TZMibf9Gpvw", [
|
|
974
989
|
props
|
|
975
990
|
]));
|
|
@@ -1072,6 +1087,24 @@ const STYLES = `
|
|
|
1072
1087
|
height: 100%;
|
|
1073
1088
|
}
|
|
1074
1089
|
`;
|
|
1090
|
+
const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1091
|
+
return /* @__PURE__ */ _jsxS("section", {
|
|
1092
|
+
...props.attributes,
|
|
1093
|
+
style: {
|
|
1094
|
+
width: "100%",
|
|
1095
|
+
alignSelf: "stretch",
|
|
1096
|
+
flexGrow: 1,
|
|
1097
|
+
boxSizing: "border-box",
|
|
1098
|
+
maxWidth: props.maxWidth || 1200,
|
|
1099
|
+
display: "flex",
|
|
1100
|
+
flexDirection: "column",
|
|
1101
|
+
alignItems: "stretch",
|
|
1102
|
+
marginLeft: "auto",
|
|
1103
|
+
marginRight: "auto"
|
|
1104
|
+
},
|
|
1105
|
+
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0")
|
|
1106
|
+
}, null, 0, "2Y_1");
|
|
1107
|
+
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1075
1108
|
const componentInfo$a = {
|
|
1076
1109
|
name: "Core:Button",
|
|
1077
1110
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1386,6 +1419,7 @@ const componentInfo$7 = {
|
|
|
1386
1419
|
required: true,
|
|
1387
1420
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
1388
1421
|
onChange: serializeFn((options) => {
|
|
1422
|
+
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
1389
1423
|
options.delete("srcset");
|
|
1390
1424
|
options.delete("noWebp");
|
|
1391
1425
|
function loadImage(url, timeout = 6e4) {
|
|
@@ -1416,10 +1450,10 @@ const componentInfo$7 = {
|
|
|
1416
1450
|
if (blob.type.includes("svg"))
|
|
1417
1451
|
options.set("noWebp", true);
|
|
1418
1452
|
});
|
|
1419
|
-
if (value && (!aspectRatio || aspectRatio ===
|
|
1453
|
+
if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO))
|
|
1420
1454
|
return loadImage(value).then((img) => {
|
|
1421
1455
|
const possiblyUpdatedAspectRatio = options.get("aspectRatio");
|
|
1422
|
-
if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio ===
|
|
1456
|
+
if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
1423
1457
|
if (img.width && img.height) {
|
|
1424
1458
|
options.set("aspectRatio", round2(img.height / img.width));
|
|
1425
1459
|
options.set("height", img.height);
|
|
@@ -1553,24 +1587,6 @@ const componentInfo$6 = {
|
|
|
1553
1587
|
}
|
|
1554
1588
|
]
|
|
1555
1589
|
};
|
|
1556
|
-
const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1557
|
-
return /* @__PURE__ */ _jsxS("section", {
|
|
1558
|
-
...props.attributes,
|
|
1559
|
-
style: {
|
|
1560
|
-
width: "100%",
|
|
1561
|
-
alignSelf: "stretch",
|
|
1562
|
-
flexGrow: 1,
|
|
1563
|
-
boxSizing: "border-box",
|
|
1564
|
-
maxWidth: props.maxWidth || 1200,
|
|
1565
|
-
display: "flex",
|
|
1566
|
-
flexDirection: "column",
|
|
1567
|
-
alignItems: "stretch",
|
|
1568
|
-
marginLeft: "auto",
|
|
1569
|
-
marginRight: "auto"
|
|
1570
|
-
},
|
|
1571
|
-
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0")
|
|
1572
|
-
}, null, 0, "2Y_1");
|
|
1573
|
-
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1574
1590
|
const componentInfo$5 = {
|
|
1575
1591
|
name: "Symbol",
|
|
1576
1592
|
noWrap: true,
|
|
@@ -1610,431 +1626,30 @@ const componentInfo$5 = {
|
|
|
1610
1626
|
}
|
|
1611
1627
|
]
|
|
1612
1628
|
};
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
return self;
|
|
1627
|
-
return globalThis;
|
|
1628
|
-
}
|
|
1629
|
-
function getFetch() {
|
|
1630
|
-
const globalFetch = getGlobalThis().fetch;
|
|
1631
|
-
if (typeof globalFetch === "undefined") {
|
|
1632
|
-
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
1633
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
1634
|
-
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
1635
|
-
}
|
|
1636
|
-
return globalFetch;
|
|
1637
|
-
}
|
|
1638
|
-
const fetch$1 = getFetch();
|
|
1639
|
-
const getTopLevelDomain = (host) => {
|
|
1640
|
-
if (host === "localhost" || host === "127.0.0.1")
|
|
1641
|
-
return host;
|
|
1642
|
-
const parts = host.split(".");
|
|
1643
|
-
if (parts.length > 2)
|
|
1644
|
-
return parts.slice(1).join(".");
|
|
1645
|
-
return host;
|
|
1646
|
-
};
|
|
1647
|
-
const getCookie = async ({ name, canTrack }) => {
|
|
1648
|
-
try {
|
|
1649
|
-
if (!canTrack)
|
|
1650
|
-
return void 0;
|
|
1651
|
-
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
1652
|
-
} catch (err) {
|
|
1653
|
-
console.debug("[COOKIE] GET error: ", err);
|
|
1654
|
-
return void 0;
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
1658
|
-
const SECURE_CONFIG = [
|
|
1659
|
-
[
|
|
1660
|
-
"secure",
|
|
1661
|
-
""
|
|
1629
|
+
const componentInfo$4 = {
|
|
1630
|
+
name: "Text",
|
|
1631
|
+
static: true,
|
|
1632
|
+
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
1633
|
+
inputs: [
|
|
1634
|
+
{
|
|
1635
|
+
name: "text",
|
|
1636
|
+
type: "html",
|
|
1637
|
+
required: true,
|
|
1638
|
+
autoFocus: true,
|
|
1639
|
+
bubble: true,
|
|
1640
|
+
defaultValue: "Enter some text..."
|
|
1641
|
+
}
|
|
1662
1642
|
],
|
|
1663
|
-
|
|
1664
|
-
"
|
|
1665
|
-
"
|
|
1666
|
-
|
|
1667
|
-
];
|
|
1668
|
-
const createCookieString = ({ name, value, expires }) => {
|
|
1669
|
-
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
1670
|
-
const secureObj = secure ? SECURE_CONFIG : [
|
|
1671
|
-
[]
|
|
1672
|
-
];
|
|
1673
|
-
const expiresObj = expires ? [
|
|
1674
|
-
[
|
|
1675
|
-
"expires",
|
|
1676
|
-
expires.toUTCString()
|
|
1677
|
-
]
|
|
1678
|
-
] : [
|
|
1679
|
-
[]
|
|
1680
|
-
];
|
|
1681
|
-
const cookieValue = [
|
|
1682
|
-
[
|
|
1683
|
-
name,
|
|
1684
|
-
value
|
|
1685
|
-
],
|
|
1686
|
-
...expiresObj,
|
|
1687
|
-
[
|
|
1688
|
-
"path",
|
|
1689
|
-
"/"
|
|
1690
|
-
],
|
|
1691
|
-
[
|
|
1692
|
-
"domain",
|
|
1693
|
-
getTopLevelDomain(window.location.hostname)
|
|
1694
|
-
],
|
|
1695
|
-
...secureObj
|
|
1696
|
-
];
|
|
1697
|
-
const cookie = stringifyCookie(cookieValue);
|
|
1698
|
-
return cookie;
|
|
1699
|
-
};
|
|
1700
|
-
const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
1701
|
-
try {
|
|
1702
|
-
if (!canTrack)
|
|
1703
|
-
return;
|
|
1704
|
-
const cookie = createCookieString({
|
|
1705
|
-
name,
|
|
1706
|
-
value,
|
|
1707
|
-
expires
|
|
1708
|
-
});
|
|
1709
|
-
document.cookie = cookie;
|
|
1710
|
-
} catch (err) {
|
|
1711
|
-
console.warn("[COOKIE] SET error: ", err);
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
const getContentTestKey = (id) => `${"builderio.variations"}.${id}`;
|
|
1715
|
-
const getContentVariationCookie = ({ contentId, canTrack }) => getCookie({
|
|
1716
|
-
name: getContentTestKey(contentId),
|
|
1717
|
-
canTrack
|
|
1718
|
-
});
|
|
1719
|
-
const setContentVariationCookie = ({ contentId, canTrack, value }) => setCookie({
|
|
1720
|
-
name: getContentTestKey(contentId),
|
|
1721
|
-
value,
|
|
1722
|
-
canTrack
|
|
1723
|
-
});
|
|
1724
|
-
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
1725
|
-
const getRandomVariationId = ({ id, variations }) => {
|
|
1726
|
-
let n = 0;
|
|
1727
|
-
const random = Math.random();
|
|
1728
|
-
for (const id2 in variations) {
|
|
1729
|
-
const testRatio = variations[id2]?.testRatio;
|
|
1730
|
-
n += testRatio;
|
|
1731
|
-
if (random < n)
|
|
1732
|
-
return id2;
|
|
1733
|
-
}
|
|
1734
|
-
return id;
|
|
1735
|
-
};
|
|
1736
|
-
const getTestFields = ({ item, testGroupId }) => {
|
|
1737
|
-
const variationValue = item.variations[testGroupId];
|
|
1738
|
-
if (testGroupId === item.id || !variationValue)
|
|
1739
|
-
return {
|
|
1740
|
-
testVariationId: item.id,
|
|
1741
|
-
testVariationName: "Default"
|
|
1742
|
-
};
|
|
1743
|
-
else
|
|
1744
|
-
return {
|
|
1745
|
-
data: variationValue.data,
|
|
1746
|
-
testVariationId: variationValue.id,
|
|
1747
|
-
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
1748
|
-
};
|
|
1749
|
-
};
|
|
1750
|
-
const getContentVariation = async ({ item, canTrack }) => {
|
|
1751
|
-
const testGroupId = await getContentVariationCookie({
|
|
1752
|
-
canTrack,
|
|
1753
|
-
contentId: item.id
|
|
1754
|
-
});
|
|
1755
|
-
const testFields = testGroupId ? getTestFields({
|
|
1756
|
-
item,
|
|
1757
|
-
testGroupId
|
|
1758
|
-
}) : void 0;
|
|
1759
|
-
if (testFields)
|
|
1760
|
-
return testFields;
|
|
1761
|
-
else {
|
|
1762
|
-
const randomVariationId = getRandomVariationId({
|
|
1763
|
-
variations: item.variations,
|
|
1764
|
-
id: item.id
|
|
1765
|
-
});
|
|
1766
|
-
setContentVariationCookie({
|
|
1767
|
-
contentId: item.id,
|
|
1768
|
-
value: randomVariationId,
|
|
1769
|
-
canTrack
|
|
1770
|
-
}).catch((err) => {
|
|
1771
|
-
console.error("could not store A/B test variation: ", err);
|
|
1772
|
-
});
|
|
1773
|
-
return getTestFields({
|
|
1774
|
-
item,
|
|
1775
|
-
testGroupId: randomVariationId
|
|
1776
|
-
});
|
|
1643
|
+
defaultStyles: {
|
|
1644
|
+
lineHeight: "normal",
|
|
1645
|
+
height: "auto",
|
|
1646
|
+
textAlign: "center"
|
|
1777
1647
|
}
|
|
1778
1648
|
};
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
item,
|
|
1784
|
-
canTrack
|
|
1785
|
-
});
|
|
1786
|
-
Object.assign(item, variationValue);
|
|
1787
|
-
};
|
|
1788
|
-
function flatten(object, path = null, separator = ".") {
|
|
1789
|
-
return Object.keys(object).reduce((acc, key) => {
|
|
1790
|
-
const value = object[key];
|
|
1791
|
-
const newPath = [
|
|
1792
|
-
path,
|
|
1793
|
-
key
|
|
1794
|
-
].filter(Boolean).join(separator);
|
|
1795
|
-
const isObject = [
|
|
1796
|
-
typeof value === "object",
|
|
1797
|
-
value !== null,
|
|
1798
|
-
!(Array.isArray(value) && value.length === 0)
|
|
1799
|
-
].every(Boolean);
|
|
1800
|
-
return isObject ? {
|
|
1801
|
-
...acc,
|
|
1802
|
-
...flatten(value, newPath, separator)
|
|
1803
|
-
} : {
|
|
1804
|
-
...acc,
|
|
1805
|
-
[newPath]: value
|
|
1806
|
-
};
|
|
1807
|
-
}, {});
|
|
1808
|
-
}
|
|
1809
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
1810
|
-
const options = {};
|
|
1811
|
-
searchParams.forEach((value, key) => {
|
|
1812
|
-
options[key] = value;
|
|
1813
|
-
});
|
|
1814
|
-
return options;
|
|
1815
|
-
};
|
|
1816
|
-
const getBuilderSearchParams = (_options) => {
|
|
1817
|
-
if (!_options)
|
|
1818
|
-
return {};
|
|
1819
|
-
const options = normalizeSearchParams(_options);
|
|
1820
|
-
const newOptions = {};
|
|
1821
|
-
Object.keys(options).forEach((key) => {
|
|
1822
|
-
if (key.startsWith("builder.")) {
|
|
1823
|
-
const trimmedKey = key.replace("builder.", "").replace("options.", "");
|
|
1824
|
-
newOptions[trimmedKey] = options[key];
|
|
1825
|
-
}
|
|
1826
|
-
});
|
|
1827
|
-
return newOptions;
|
|
1828
|
-
};
|
|
1829
|
-
const getBuilderSearchParamsFromWindow = () => {
|
|
1830
|
-
if (!isBrowser())
|
|
1831
|
-
return {};
|
|
1832
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
1833
|
-
return getBuilderSearchParams(searchParams);
|
|
1834
|
-
};
|
|
1835
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1836
|
-
const DEFAULT_API_VERSION = "v3";
|
|
1837
|
-
const generateContentUrl = (options) => {
|
|
1838
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
1839
|
-
if (!apiKey)
|
|
1840
|
-
throw new Error("Missing API key");
|
|
1841
|
-
if (![
|
|
1842
|
-
"v2",
|
|
1843
|
-
"v3"
|
|
1844
|
-
].includes(apiVersion))
|
|
1845
|
-
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1846
|
-
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1847
|
-
const queryOptions = {
|
|
1848
|
-
...getBuilderSearchParamsFromWindow(),
|
|
1849
|
-
...normalizeSearchParams(options.options || {})
|
|
1850
|
-
};
|
|
1851
|
-
const flattened = flatten(queryOptions);
|
|
1852
|
-
for (const key in flattened)
|
|
1853
|
-
url.searchParams.set(key, String(flattened[key]));
|
|
1854
|
-
if (userAttributes)
|
|
1855
|
-
url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
|
|
1856
|
-
if (query) {
|
|
1857
|
-
const flattened2 = flatten({
|
|
1858
|
-
query
|
|
1859
|
-
});
|
|
1860
|
-
for (const key in flattened2)
|
|
1861
|
-
url.searchParams.set(key, JSON.stringify(flattened2[key]));
|
|
1862
|
-
}
|
|
1863
|
-
return url;
|
|
1864
|
-
};
|
|
1865
|
-
async function getContent(options) {
|
|
1866
|
-
const allContent = await getAllContent({
|
|
1867
|
-
...options,
|
|
1868
|
-
limit: 1
|
|
1869
|
-
});
|
|
1870
|
-
if (allContent && "results" in allContent)
|
|
1871
|
-
return allContent?.results[0] || null;
|
|
1872
|
-
return null;
|
|
1873
|
-
}
|
|
1874
|
-
async function getAllContent(options) {
|
|
1875
|
-
try {
|
|
1876
|
-
const url = generateContentUrl(options);
|
|
1877
|
-
const res = await fetch$1(url.href);
|
|
1878
|
-
const content = await res.json();
|
|
1879
|
-
if ("status" in content && !("results" in content)) {
|
|
1880
|
-
logger.error("Error fetching data. ", {
|
|
1881
|
-
url,
|
|
1882
|
-
content,
|
|
1883
|
-
options
|
|
1884
|
-
});
|
|
1885
|
-
return content;
|
|
1886
|
-
}
|
|
1887
|
-
const canTrack = options.canTrack !== false;
|
|
1888
|
-
try {
|
|
1889
|
-
if (canTrack && Array.isArray(content.results))
|
|
1890
|
-
for (const item of content.results)
|
|
1891
|
-
await handleABTesting({
|
|
1892
|
-
item,
|
|
1893
|
-
canTrack
|
|
1894
|
-
});
|
|
1895
|
-
} catch (e) {
|
|
1896
|
-
logger.error("Could not setup A/B testing. ", e);
|
|
1897
|
-
}
|
|
1898
|
-
return content;
|
|
1899
|
-
} catch (error) {
|
|
1900
|
-
logger.error("Error fetching data. ", error);
|
|
1901
|
-
return null;
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1905
|
-
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1906
|
-
getContent({
|
|
1907
|
-
model: props.symbol.model,
|
|
1908
|
-
apiKey: builderContext2.apiKey,
|
|
1909
|
-
apiVersion: builderContext2.apiVersion,
|
|
1910
|
-
query: {
|
|
1911
|
-
id: props.symbol.entry
|
|
1912
|
-
}
|
|
1913
|
-
}).then((response) => {
|
|
1914
|
-
if (response)
|
|
1915
|
-
state.contentToUse = response;
|
|
1916
|
-
}).catch((err) => {
|
|
1917
|
-
logger.error("Could not fetch symbol content: ", err);
|
|
1918
|
-
});
|
|
1919
|
-
};
|
|
1920
|
-
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1921
|
-
const builderContext$1 = useContext(builderContext);
|
|
1922
|
-
const state = useStore({
|
|
1923
|
-
className: [
|
|
1924
|
-
...[
|
|
1925
|
-
props.attributes.class
|
|
1926
|
-
],
|
|
1927
|
-
"builder-symbol",
|
|
1928
|
-
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1929
|
-
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1930
|
-
].filter(Boolean).join(" "),
|
|
1931
|
-
contentToUse: props.symbol?.content
|
|
1932
|
-
});
|
|
1933
|
-
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1934
|
-
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1935
|
-
fetchContent(props2, state2, builderContext2);
|
|
1936
|
-
}, "Symbol_component_useVisibleTask_oMPs8W5ZhwE", [
|
|
1937
|
-
builderContext$1,
|
|
1938
|
-
props,
|
|
1939
|
-
state
|
|
1940
|
-
]));
|
|
1941
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
1942
|
-
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1943
|
-
track2(() => props2.symbol);
|
|
1944
|
-
fetchContent(props2, state2, builderContext2);
|
|
1945
|
-
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1946
|
-
builderContext$1,
|
|
1947
|
-
props,
|
|
1948
|
-
state
|
|
1949
|
-
]));
|
|
1950
|
-
return /* @__PURE__ */ _jsxS("div", {
|
|
1951
|
-
...props.attributes,
|
|
1952
|
-
children: /* @__PURE__ */ _jsxC(RenderContent, {
|
|
1953
|
-
get apiVersion() {
|
|
1954
|
-
return builderContext$1.apiVersion;
|
|
1955
|
-
},
|
|
1956
|
-
get apiKey() {
|
|
1957
|
-
return builderContext$1.apiKey;
|
|
1958
|
-
},
|
|
1959
|
-
get context() {
|
|
1960
|
-
return builderContext$1.context;
|
|
1961
|
-
},
|
|
1962
|
-
get customComponents() {
|
|
1963
|
-
return Object.values(builderContext$1.registeredComponents);
|
|
1964
|
-
},
|
|
1965
|
-
get data() {
|
|
1966
|
-
return {
|
|
1967
|
-
...props.symbol?.data,
|
|
1968
|
-
...builderContext$1.state,
|
|
1969
|
-
...state.contentToUse?.data?.state
|
|
1970
|
-
};
|
|
1971
|
-
},
|
|
1972
|
-
get model() {
|
|
1973
|
-
return props.symbol?.model;
|
|
1974
|
-
},
|
|
1975
|
-
get content() {
|
|
1976
|
-
return state.contentToUse;
|
|
1977
|
-
},
|
|
1978
|
-
[_IMMUTABLE]: {
|
|
1979
|
-
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
1980
|
-
builderContext$1
|
|
1981
|
-
], "p0.apiVersion"),
|
|
1982
|
-
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
1983
|
-
builderContext$1
|
|
1984
|
-
], "p0.apiKey"),
|
|
1985
|
-
context: _fnSignal((p0) => p0.context, [
|
|
1986
|
-
builderContext$1
|
|
1987
|
-
], "p0.context"),
|
|
1988
|
-
customComponents: _fnSignal((p0) => Object.values(p0.registeredComponents), [
|
|
1989
|
-
builderContext$1
|
|
1990
|
-
], "Object.values(p0.registeredComponents)"),
|
|
1991
|
-
data: _fnSignal((p0, p1, p2) => ({
|
|
1992
|
-
...p1.symbol?.data,
|
|
1993
|
-
...p0.state,
|
|
1994
|
-
...p2.contentToUse?.data?.state
|
|
1995
|
-
}), [
|
|
1996
|
-
builderContext$1,
|
|
1997
|
-
props,
|
|
1998
|
-
state
|
|
1999
|
-
], "{...p1.symbol?.data,...p0.state,...p2.contentToUse?.data?.state}"),
|
|
2000
|
-
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
2001
|
-
props
|
|
2002
|
-
], "p0.symbol?.model"),
|
|
2003
|
-
content: _fnSignal((p0) => p0.contentToUse, [
|
|
2004
|
-
state
|
|
2005
|
-
], "p0.contentToUse")
|
|
2006
|
-
}
|
|
2007
|
-
}, 3, "Wt_0")
|
|
2008
|
-
}, {
|
|
2009
|
-
class: _fnSignal((p0) => p0.className, [
|
|
2010
|
-
state
|
|
2011
|
-
], "p0.className")
|
|
2012
|
-
}, 0, "Wt_1");
|
|
2013
|
-
}, "Symbol_component_WVvggdkUPdk"));
|
|
2014
|
-
const componentInfo$4 = {
|
|
2015
|
-
name: "Text",
|
|
2016
|
-
static: true,
|
|
2017
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
2018
|
-
inputs: [
|
|
2019
|
-
{
|
|
2020
|
-
name: "text",
|
|
2021
|
-
type: "html",
|
|
2022
|
-
required: true,
|
|
2023
|
-
autoFocus: true,
|
|
2024
|
-
bubble: true,
|
|
2025
|
-
defaultValue: "Enter some text..."
|
|
2026
|
-
}
|
|
2027
|
-
],
|
|
2028
|
-
defaultStyles: {
|
|
2029
|
-
lineHeight: "normal",
|
|
2030
|
-
height: "auto",
|
|
2031
|
-
textAlign: "center"
|
|
2032
|
-
}
|
|
2033
|
-
};
|
|
2034
|
-
const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2035
|
-
return /* @__PURE__ */ _jsxQ("span", {
|
|
2036
|
-
style: {
|
|
2037
|
-
outline: "none"
|
|
1649
|
+
const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1650
|
+
return /* @__PURE__ */ _jsxQ("span", {
|
|
1651
|
+
style: {
|
|
1652
|
+
outline: "none"
|
|
2038
1653
|
}
|
|
2039
1654
|
}, {
|
|
2040
1655
|
class: "builder-text",
|
|
@@ -2223,7 +1838,8 @@ const componentInfo$2 = {
|
|
|
2223
1838
|
const url = options.get("url");
|
|
2224
1839
|
if (url) {
|
|
2225
1840
|
options.set("content", "Loading...");
|
|
2226
|
-
|
|
1841
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
1842
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
2227
1843
|
if (options.get("url") === url) {
|
|
2228
1844
|
if (data.html)
|
|
2229
1845
|
options.set("content", data.html);
|
|
@@ -2424,52 +2040,383 @@ const componentInfo = {
|
|
|
2424
2040
|
}
|
|
2425
2041
|
]
|
|
2426
2042
|
};
|
|
2427
|
-
const getDefaultRegisteredComponents = () => [
|
|
2428
|
-
{
|
|
2429
|
-
component: Button,
|
|
2430
|
-
...componentInfo$a
|
|
2431
|
-
},
|
|
2432
|
-
{
|
|
2433
|
-
component: Columns,
|
|
2434
|
-
...componentInfo$9
|
|
2435
|
-
},
|
|
2436
|
-
{
|
|
2437
|
-
component: CustomCode,
|
|
2438
|
-
...componentInfo
|
|
2439
|
-
},
|
|
2440
|
-
{
|
|
2441
|
-
component: Embed,
|
|
2442
|
-
...componentInfo$2
|
|
2443
|
-
},
|
|
2444
|
-
{
|
|
2445
|
-
component: FragmentComponent,
|
|
2446
|
-
...componentInfo$8
|
|
2447
|
-
},
|
|
2448
|
-
{
|
|
2449
|
-
component: Image,
|
|
2450
|
-
...componentInfo$7
|
|
2451
|
-
},
|
|
2452
|
-
{
|
|
2453
|
-
component: ImgComponent,
|
|
2454
|
-
...componentInfo$1
|
|
2455
|
-
},
|
|
2456
|
-
{
|
|
2457
|
-
component: SectionComponent,
|
|
2458
|
-
...componentInfo$6
|
|
2459
|
-
},
|
|
2460
|
-
{
|
|
2461
|
-
component: Symbol$1,
|
|
2462
|
-
...componentInfo$5
|
|
2463
|
-
},
|
|
2464
|
-
{
|
|
2465
|
-
component: Text,
|
|
2466
|
-
...componentInfo$4
|
|
2467
|
-
},
|
|
2468
|
-
{
|
|
2469
|
-
component: Video,
|
|
2470
|
-
...componentInfo$3
|
|
2043
|
+
const getDefaultRegisteredComponents = () => [
|
|
2044
|
+
{
|
|
2045
|
+
component: Button,
|
|
2046
|
+
...componentInfo$a
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
component: Columns,
|
|
2050
|
+
...componentInfo$9
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
component: CustomCode,
|
|
2054
|
+
...componentInfo
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
component: Embed,
|
|
2058
|
+
...componentInfo$2
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
component: FragmentComponent,
|
|
2062
|
+
...componentInfo$8
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
component: Image,
|
|
2066
|
+
...componentInfo$7
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
component: ImgComponent,
|
|
2070
|
+
...componentInfo$1
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
component: SectionComponent,
|
|
2074
|
+
...componentInfo$6
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
component: Symbol$1,
|
|
2078
|
+
...componentInfo$5
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
component: Text,
|
|
2082
|
+
...componentInfo$4
|
|
2083
|
+
},
|
|
2084
|
+
{
|
|
2085
|
+
component: Video,
|
|
2086
|
+
...componentInfo$3
|
|
2087
|
+
}
|
|
2088
|
+
];
|
|
2089
|
+
const MSG_PREFIX = "[Builder.io]: ";
|
|
2090
|
+
const logger = {
|
|
2091
|
+
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
2092
|
+
error: (...message) => console.error(MSG_PREFIX, ...message),
|
|
2093
|
+
warn: (...message) => console.warn(MSG_PREFIX, ...message),
|
|
2094
|
+
debug: (...message) => console.debug(MSG_PREFIX, ...message)
|
|
2095
|
+
};
|
|
2096
|
+
const getTopLevelDomain = (host) => {
|
|
2097
|
+
if (host === "localhost" || host === "127.0.0.1")
|
|
2098
|
+
return host;
|
|
2099
|
+
const parts = host.split(".");
|
|
2100
|
+
if (parts.length > 2)
|
|
2101
|
+
return parts.slice(1).join(".");
|
|
2102
|
+
return host;
|
|
2103
|
+
};
|
|
2104
|
+
const getCookieSync = ({ name, canTrack }) => {
|
|
2105
|
+
try {
|
|
2106
|
+
if (!canTrack)
|
|
2107
|
+
return void 0;
|
|
2108
|
+
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
2109
|
+
} catch (err) {
|
|
2110
|
+
logger.warn("[COOKIE] GET error: ", err?.message || err);
|
|
2111
|
+
return void 0;
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
const getCookie = async (args) => getCookieSync(args);
|
|
2115
|
+
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
2116
|
+
const SECURE_CONFIG = [
|
|
2117
|
+
[
|
|
2118
|
+
"secure",
|
|
2119
|
+
""
|
|
2120
|
+
],
|
|
2121
|
+
[
|
|
2122
|
+
"SameSite",
|
|
2123
|
+
"None"
|
|
2124
|
+
]
|
|
2125
|
+
];
|
|
2126
|
+
const createCookieString = ({ name, value, expires }) => {
|
|
2127
|
+
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
2128
|
+
const secureObj = secure ? SECURE_CONFIG : [
|
|
2129
|
+
[]
|
|
2130
|
+
];
|
|
2131
|
+
const expiresObj = expires ? [
|
|
2132
|
+
[
|
|
2133
|
+
"expires",
|
|
2134
|
+
expires.toUTCString()
|
|
2135
|
+
]
|
|
2136
|
+
] : [
|
|
2137
|
+
[]
|
|
2138
|
+
];
|
|
2139
|
+
const cookieValue = [
|
|
2140
|
+
[
|
|
2141
|
+
name,
|
|
2142
|
+
value
|
|
2143
|
+
],
|
|
2144
|
+
...expiresObj,
|
|
2145
|
+
[
|
|
2146
|
+
"path",
|
|
2147
|
+
"/"
|
|
2148
|
+
],
|
|
2149
|
+
[
|
|
2150
|
+
"domain",
|
|
2151
|
+
getTopLevelDomain(window.location.hostname)
|
|
2152
|
+
],
|
|
2153
|
+
...secureObj
|
|
2154
|
+
];
|
|
2155
|
+
const cookie = stringifyCookie(cookieValue);
|
|
2156
|
+
return cookie;
|
|
2157
|
+
};
|
|
2158
|
+
const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
2159
|
+
try {
|
|
2160
|
+
if (!canTrack)
|
|
2161
|
+
return;
|
|
2162
|
+
const cookie = createCookieString({
|
|
2163
|
+
name,
|
|
2164
|
+
value,
|
|
2165
|
+
expires
|
|
2166
|
+
});
|
|
2167
|
+
document.cookie = cookie;
|
|
2168
|
+
} catch (err) {
|
|
2169
|
+
logger.warn("[COOKIE] SET error: ", err?.message || err);
|
|
2170
|
+
}
|
|
2171
|
+
};
|
|
2172
|
+
const BUILDER_STORE_PREFIX = "builder.tests";
|
|
2173
|
+
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
2174
|
+
const getContentVariationCookie = ({ contentId }) => getCookie({
|
|
2175
|
+
name: getContentTestKey(contentId),
|
|
2176
|
+
canTrack: true
|
|
2177
|
+
});
|
|
2178
|
+
const getContentVariationCookieSync = ({ contentId }) => getCookieSync({
|
|
2179
|
+
name: getContentTestKey(contentId),
|
|
2180
|
+
canTrack: true
|
|
2181
|
+
});
|
|
2182
|
+
const setContentVariationCookie = ({ contentId, value }) => setCookie({
|
|
2183
|
+
name: getContentTestKey(contentId),
|
|
2184
|
+
value,
|
|
2185
|
+
canTrack: true
|
|
2186
|
+
});
|
|
2187
|
+
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
2188
|
+
const getRandomVariationId = ({ id, variations }) => {
|
|
2189
|
+
let n = 0;
|
|
2190
|
+
const random = Math.random();
|
|
2191
|
+
for (const id2 in variations) {
|
|
2192
|
+
const testRatio = variations[id2]?.testRatio;
|
|
2193
|
+
n += testRatio;
|
|
2194
|
+
if (random < n)
|
|
2195
|
+
return id2;
|
|
2196
|
+
}
|
|
2197
|
+
return id;
|
|
2198
|
+
};
|
|
2199
|
+
const getAndSetVariantId = (args) => {
|
|
2200
|
+
const randomVariationId = getRandomVariationId(args);
|
|
2201
|
+
setContentVariationCookie({
|
|
2202
|
+
contentId: args.id,
|
|
2203
|
+
value: randomVariationId
|
|
2204
|
+
}).catch((err) => {
|
|
2205
|
+
logger.error("could not store A/B test variation: ", err);
|
|
2206
|
+
});
|
|
2207
|
+
return randomVariationId;
|
|
2208
|
+
};
|
|
2209
|
+
const getTestFields = ({ item, testGroupId }) => {
|
|
2210
|
+
const variationValue = item.variations[testGroupId];
|
|
2211
|
+
if (testGroupId === item.id || !variationValue)
|
|
2212
|
+
return {
|
|
2213
|
+
testVariationId: item.id,
|
|
2214
|
+
testVariationName: "Default"
|
|
2215
|
+
};
|
|
2216
|
+
else
|
|
2217
|
+
return {
|
|
2218
|
+
data: variationValue.data,
|
|
2219
|
+
testVariationId: variationValue.id,
|
|
2220
|
+
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
const handleABTestingSync = ({ item, canTrack }) => {
|
|
2224
|
+
if (!canTrack)
|
|
2225
|
+
return item;
|
|
2226
|
+
if (!item)
|
|
2227
|
+
return void 0;
|
|
2228
|
+
if (!checkIsBuilderContentWithVariations(item))
|
|
2229
|
+
return item;
|
|
2230
|
+
const testGroupId = getContentVariationCookieSync({
|
|
2231
|
+
contentId: item.id
|
|
2232
|
+
}) || getAndSetVariantId({
|
|
2233
|
+
variations: item.variations,
|
|
2234
|
+
id: item.id
|
|
2235
|
+
});
|
|
2236
|
+
const variationValue = getTestFields({
|
|
2237
|
+
item,
|
|
2238
|
+
testGroupId
|
|
2239
|
+
});
|
|
2240
|
+
return {
|
|
2241
|
+
...item,
|
|
2242
|
+
...variationValue
|
|
2243
|
+
};
|
|
2244
|
+
};
|
|
2245
|
+
const handleABTesting = async ({ item, canTrack }) => {
|
|
2246
|
+
if (!canTrack)
|
|
2247
|
+
return item;
|
|
2248
|
+
if (!checkIsBuilderContentWithVariations(item))
|
|
2249
|
+
return item;
|
|
2250
|
+
const cookieValue = await getContentVariationCookie({
|
|
2251
|
+
contentId: item.id
|
|
2252
|
+
});
|
|
2253
|
+
const testGroupId = cookieValue || getAndSetVariantId({
|
|
2254
|
+
variations: item.variations,
|
|
2255
|
+
id: item.id
|
|
2256
|
+
});
|
|
2257
|
+
const variationValue = getTestFields({
|
|
2258
|
+
item,
|
|
2259
|
+
testGroupId
|
|
2260
|
+
});
|
|
2261
|
+
return {
|
|
2262
|
+
...item,
|
|
2263
|
+
...variationValue
|
|
2264
|
+
};
|
|
2265
|
+
};
|
|
2266
|
+
const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2267
|
+
function getGlobalThis() {
|
|
2268
|
+
if (typeof globalThis !== "undefined")
|
|
2269
|
+
return globalThis;
|
|
2270
|
+
if (typeof window !== "undefined")
|
|
2271
|
+
return window;
|
|
2272
|
+
if (typeof global !== "undefined")
|
|
2273
|
+
return global;
|
|
2274
|
+
if (typeof self !== "undefined")
|
|
2275
|
+
return self;
|
|
2276
|
+
return globalThis;
|
|
2277
|
+
}
|
|
2278
|
+
function getFetch() {
|
|
2279
|
+
const globalFetch = getGlobalThis().fetch;
|
|
2280
|
+
if (typeof globalFetch === "undefined") {
|
|
2281
|
+
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2282
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
2283
|
+
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
2284
|
+
}
|
|
2285
|
+
return globalFetch;
|
|
2286
|
+
}
|
|
2287
|
+
const fetch$1 = getFetch();
|
|
2288
|
+
function flatten(object, path = null, separator = ".") {
|
|
2289
|
+
return Object.keys(object).reduce((acc, key) => {
|
|
2290
|
+
const value = object[key];
|
|
2291
|
+
const newPath = [
|
|
2292
|
+
path,
|
|
2293
|
+
key
|
|
2294
|
+
].filter(Boolean).join(separator);
|
|
2295
|
+
const isObject = [
|
|
2296
|
+
typeof value === "object",
|
|
2297
|
+
value !== null,
|
|
2298
|
+
!(Array.isArray(value) && value.length === 0)
|
|
2299
|
+
].every(Boolean);
|
|
2300
|
+
return isObject ? {
|
|
2301
|
+
...acc,
|
|
2302
|
+
...flatten(value, newPath, separator)
|
|
2303
|
+
} : {
|
|
2304
|
+
...acc,
|
|
2305
|
+
[newPath]: value
|
|
2306
|
+
};
|
|
2307
|
+
}, {});
|
|
2308
|
+
}
|
|
2309
|
+
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
2310
|
+
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
2311
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
2312
|
+
const options = {};
|
|
2313
|
+
searchParams.forEach((value, key) => {
|
|
2314
|
+
options[key] = value;
|
|
2315
|
+
});
|
|
2316
|
+
return options;
|
|
2317
|
+
};
|
|
2318
|
+
const getBuilderSearchParams = (_options) => {
|
|
2319
|
+
if (!_options)
|
|
2320
|
+
return {};
|
|
2321
|
+
const options = normalizeSearchParams(_options);
|
|
2322
|
+
const newOptions = {};
|
|
2323
|
+
Object.keys(options).forEach((key) => {
|
|
2324
|
+
if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
2325
|
+
const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
|
|
2326
|
+
newOptions[trimmedKey] = options[key];
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
return newOptions;
|
|
2330
|
+
};
|
|
2331
|
+
const getBuilderSearchParamsFromWindow = () => {
|
|
2332
|
+
if (!isBrowser())
|
|
2333
|
+
return {};
|
|
2334
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
2335
|
+
return getBuilderSearchParams(searchParams);
|
|
2336
|
+
};
|
|
2337
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
2338
|
+
const DEFAULT_API_VERSION = "v3";
|
|
2339
|
+
const generateContentUrl = (options) => {
|
|
2340
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
2341
|
+
if (!apiKey)
|
|
2342
|
+
throw new Error("Missing API key");
|
|
2343
|
+
if (![
|
|
2344
|
+
"v2",
|
|
2345
|
+
"v3"
|
|
2346
|
+
].includes(apiVersion))
|
|
2347
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
2348
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
|
|
2349
|
+
const queryOptions = {
|
|
2350
|
+
...getBuilderSearchParamsFromWindow(),
|
|
2351
|
+
...normalizeSearchParams(options.options || {})
|
|
2352
|
+
};
|
|
2353
|
+
const flattened = flatten(queryOptions);
|
|
2354
|
+
for (const key in flattened)
|
|
2355
|
+
url.searchParams.set(key, String(flattened[key]));
|
|
2356
|
+
if (userAttributes)
|
|
2357
|
+
url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
|
|
2358
|
+
if (query) {
|
|
2359
|
+
const flattened2 = flatten({
|
|
2360
|
+
query
|
|
2361
|
+
});
|
|
2362
|
+
for (const key in flattened2)
|
|
2363
|
+
url.searchParams.set(key, JSON.stringify(flattened2[key]));
|
|
2364
|
+
}
|
|
2365
|
+
return url;
|
|
2366
|
+
};
|
|
2367
|
+
const checkContentHasResults = (content) => "results" in content;
|
|
2368
|
+
async function getContent(options) {
|
|
2369
|
+
const allContent = await getAllContent({
|
|
2370
|
+
...options,
|
|
2371
|
+
limit: 1
|
|
2372
|
+
});
|
|
2373
|
+
if (allContent && checkContentHasResults(allContent))
|
|
2374
|
+
return allContent.results[0] || null;
|
|
2375
|
+
return null;
|
|
2376
|
+
}
|
|
2377
|
+
const fetchContent$1 = async (options) => {
|
|
2378
|
+
const url = generateContentUrl(options);
|
|
2379
|
+
const res = await fetch$1(url.href);
|
|
2380
|
+
const content = await res.json();
|
|
2381
|
+
return content;
|
|
2382
|
+
};
|
|
2383
|
+
const processContentResult = async (options, content) => {
|
|
2384
|
+
const canTrack = getDefaultCanTrack(options.canTrack);
|
|
2385
|
+
if (!canTrack)
|
|
2386
|
+
return content;
|
|
2387
|
+
if (!(isBrowser() || TARGET === "reactNative"))
|
|
2388
|
+
return content;
|
|
2389
|
+
try {
|
|
2390
|
+
const newResults = [];
|
|
2391
|
+
for (const item of content.results)
|
|
2392
|
+
newResults.push(await handleABTesting({
|
|
2393
|
+
item,
|
|
2394
|
+
canTrack
|
|
2395
|
+
}));
|
|
2396
|
+
content.results = newResults;
|
|
2397
|
+
} catch (e) {
|
|
2398
|
+
logger.error("Could not process A/B tests. ", e);
|
|
2399
|
+
}
|
|
2400
|
+
return content;
|
|
2401
|
+
};
|
|
2402
|
+
async function getAllContent(options) {
|
|
2403
|
+
try {
|
|
2404
|
+
const url = generateContentUrl(options);
|
|
2405
|
+
const content = await fetchContent$1(options);
|
|
2406
|
+
if (!checkContentHasResults(content)) {
|
|
2407
|
+
logger.error("Error fetching data. ", {
|
|
2408
|
+
url,
|
|
2409
|
+
content,
|
|
2410
|
+
options
|
|
2411
|
+
});
|
|
2412
|
+
return content;
|
|
2413
|
+
}
|
|
2414
|
+
return processContentResult(options, content);
|
|
2415
|
+
} catch (error) {
|
|
2416
|
+
logger.error("Error fetching data. ", error);
|
|
2417
|
+
return null;
|
|
2471
2418
|
}
|
|
2472
|
-
|
|
2419
|
+
}
|
|
2473
2420
|
function isPreviewing() {
|
|
2474
2421
|
if (!isBrowser())
|
|
2475
2422
|
return false;
|
|
@@ -2478,14 +2425,6 @@ function isPreviewing() {
|
|
|
2478
2425
|
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2479
2426
|
}
|
|
2480
2427
|
const components = [];
|
|
2481
|
-
function registerComponent(component, info) {
|
|
2482
|
-
components.push({
|
|
2483
|
-
component,
|
|
2484
|
-
...info
|
|
2485
|
-
});
|
|
2486
|
-
console.warn("registerComponent is deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.");
|
|
2487
|
-
return component;
|
|
2488
|
-
}
|
|
2489
2428
|
const createRegisterComponentMessage = ({ component: _, ...info }) => ({
|
|
2490
2429
|
type: "builder.registerComponent",
|
|
2491
2430
|
data: prepareComponentInfoToSend(info)
|
|
@@ -2507,11 +2446,12 @@ function uuidv4() {
|
|
|
2507
2446
|
function uuid() {
|
|
2508
2447
|
return uuidv4().replace(/-/g, "");
|
|
2509
2448
|
}
|
|
2449
|
+
const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
2510
2450
|
const getSessionId = async ({ canTrack }) => {
|
|
2511
2451
|
if (!canTrack)
|
|
2512
2452
|
return void 0;
|
|
2513
2453
|
const sessionId = await getCookie({
|
|
2514
|
-
name:
|
|
2454
|
+
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2515
2455
|
canTrack
|
|
2516
2456
|
});
|
|
2517
2457
|
if (checkIsDefined(sessionId))
|
|
@@ -2527,7 +2467,7 @@ const getSessionId = async ({ canTrack }) => {
|
|
|
2527
2467
|
};
|
|
2528
2468
|
const createSessionId = () => uuid();
|
|
2529
2469
|
const setSessionId = ({ id, canTrack }) => setCookie({
|
|
2530
|
-
name:
|
|
2470
|
+
name: SESSION_LOCAL_STORAGE_KEY,
|
|
2531
2471
|
value: id,
|
|
2532
2472
|
canTrack
|
|
2533
2473
|
});
|
|
@@ -2550,11 +2490,12 @@ const setLocalStorageItem = ({ key, canTrack, value }) => {
|
|
|
2550
2490
|
console.debug("[LocalStorage] SET error: ", err);
|
|
2551
2491
|
}
|
|
2552
2492
|
};
|
|
2493
|
+
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
2553
2494
|
const getVisitorId = ({ canTrack }) => {
|
|
2554
2495
|
if (!canTrack)
|
|
2555
2496
|
return void 0;
|
|
2556
2497
|
const visitorId = getLocalStorageItem({
|
|
2557
|
-
key:
|
|
2498
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2558
2499
|
canTrack
|
|
2559
2500
|
});
|
|
2560
2501
|
if (checkIsDefined(visitorId))
|
|
@@ -2570,7 +2511,7 @@ const getVisitorId = ({ canTrack }) => {
|
|
|
2570
2511
|
};
|
|
2571
2512
|
const createVisitorId = () => uuid();
|
|
2572
2513
|
const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
|
|
2573
|
-
key:
|
|
2514
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
2574
2515
|
value: id,
|
|
2575
2516
|
canTrack
|
|
2576
2517
|
});
|
|
@@ -2728,6 +2669,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
2728
2669
|
}
|
|
2729
2670
|
};
|
|
2730
2671
|
};
|
|
2672
|
+
const SDK_VERSION = "0.4.0";
|
|
2731
2673
|
const registry = {};
|
|
2732
2674
|
function register(type, info) {
|
|
2733
2675
|
let typeList = registry[type];
|
|
@@ -2795,6 +2737,7 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
2795
2737
|
type: "builder.sdkInfo",
|
|
2796
2738
|
data: {
|
|
2797
2739
|
target: TARGET,
|
|
2740
|
+
version: SDK_VERSION,
|
|
2798
2741
|
supportsPatchUpdates: false,
|
|
2799
2742
|
supportsAddBlockScoping: true,
|
|
2800
2743
|
supportsCustomBreakpoints: true
|
|
@@ -2854,6 +2797,128 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
2854
2797
|
});
|
|
2855
2798
|
}
|
|
2856
2799
|
};
|
|
2800
|
+
const getVariants = (content) => Object.values(content?.variations || {});
|
|
2801
|
+
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
2802
|
+
const hasVariants = getVariants(content).length > 0;
|
|
2803
|
+
if (!hasVariants)
|
|
2804
|
+
return false;
|
|
2805
|
+
if (!canTrack)
|
|
2806
|
+
return false;
|
|
2807
|
+
if (isBrowser())
|
|
2808
|
+
return false;
|
|
2809
|
+
return true;
|
|
2810
|
+
};
|
|
2811
|
+
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2812
|
+
function getAndSetVariantId2() {
|
|
2813
|
+
function setCookie2(name, value, days) {
|
|
2814
|
+
let expires = "";
|
|
2815
|
+
if (days) {
|
|
2816
|
+
const date = new Date();
|
|
2817
|
+
date.setTime(date.getTime() + days * 864e5);
|
|
2818
|
+
expires = "; expires=" + date.toUTCString();
|
|
2819
|
+
}
|
|
2820
|
+
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2821
|
+
}
|
|
2822
|
+
function getCookie2(name) {
|
|
2823
|
+
const nameEQ = name + "=";
|
|
2824
|
+
const ca = document.cookie.split(";");
|
|
2825
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2826
|
+
let c = ca[i];
|
|
2827
|
+
while (c.charAt(0) === " ")
|
|
2828
|
+
c = c.substring(1, c.length);
|
|
2829
|
+
if (c.indexOf(nameEQ) === 0)
|
|
2830
|
+
return c.substring(nameEQ.length, c.length);
|
|
2831
|
+
}
|
|
2832
|
+
return null;
|
|
2833
|
+
}
|
|
2834
|
+
const cookieName = `builder.tests.${contentId}`;
|
|
2835
|
+
const variantInCookie = getCookie2(cookieName);
|
|
2836
|
+
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2837
|
+
if (variantInCookie && availableIDs.includes(variantInCookie))
|
|
2838
|
+
return variantInCookie;
|
|
2839
|
+
let n = 0;
|
|
2840
|
+
const random = Math.random();
|
|
2841
|
+
for (let i = 0; i < variants.length; i++) {
|
|
2842
|
+
const variant = variants[i];
|
|
2843
|
+
const testRatio = variant.testRatio;
|
|
2844
|
+
n += testRatio;
|
|
2845
|
+
if (random < n) {
|
|
2846
|
+
setCookie2(cookieName, variant.id);
|
|
2847
|
+
return variant.id;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
setCookie2(cookieName, contentId);
|
|
2851
|
+
return contentId;
|
|
2852
|
+
}
|
|
2853
|
+
const winningVariantId = getAndSetVariantId2();
|
|
2854
|
+
const styleEl = document.getElementById(`variants-styles-${contentId}`);
|
|
2855
|
+
if (isHydrationTarget2) {
|
|
2856
|
+
styleEl.remove();
|
|
2857
|
+
const thisScriptEl = document.getElementById(`variants-script-${contentId}`);
|
|
2858
|
+
thisScriptEl?.remove();
|
|
2859
|
+
} else {
|
|
2860
|
+
const newStyleStr = variants.concat({
|
|
2861
|
+
id: contentId
|
|
2862
|
+
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2863
|
+
return `.variant-${value.id} { display: none; }
|
|
2864
|
+
`;
|
|
2865
|
+
}).join("");
|
|
2866
|
+
styleEl.innerHTML = newStyleStr;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2870
|
+
if (!navigator.cookieEnabled)
|
|
2871
|
+
return;
|
|
2872
|
+
function getCookie2(name) {
|
|
2873
|
+
const nameEQ = name + "=";
|
|
2874
|
+
const ca = document.cookie.split(";");
|
|
2875
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2876
|
+
let c = ca[i];
|
|
2877
|
+
while (c.charAt(0) === " ")
|
|
2878
|
+
c = c.substring(1, c.length);
|
|
2879
|
+
if (c.indexOf(nameEQ) === 0)
|
|
2880
|
+
return c.substring(nameEQ.length, c.length);
|
|
2881
|
+
}
|
|
2882
|
+
return null;
|
|
2883
|
+
}
|
|
2884
|
+
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2885
|
+
const variantId = getCookie2(cookieName);
|
|
2886
|
+
const parentDiv = document.querySelector(`[builder-content-id="${variantContentId}"]`);
|
|
2887
|
+
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2888
|
+
if (variantId === variantContentId) {
|
|
2889
|
+
if (variantIsDefaultContent)
|
|
2890
|
+
return;
|
|
2891
|
+
parentDiv?.removeAttribute("hidden");
|
|
2892
|
+
parentDiv?.removeAttribute("aria-hidden");
|
|
2893
|
+
} else {
|
|
2894
|
+
if (variantIsDefaultContent) {
|
|
2895
|
+
if (isHydrationTarget2)
|
|
2896
|
+
parentDiv?.remove();
|
|
2897
|
+
else {
|
|
2898
|
+
parentDiv?.setAttribute("hidden", "true");
|
|
2899
|
+
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
return;
|
|
2903
|
+
}
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
const isHydrationTarget = (target) => target === "react" || target === "reactNative" || target === "vue3" || target === "vue2";
|
|
2907
|
+
const AB_TEST_FN_NAME = "bldrAbTest";
|
|
2908
|
+
const CONTENT_FN_NAME = "bldrCntntScrpt";
|
|
2909
|
+
const getVariantsScriptString = (variants, contentId) => {
|
|
2910
|
+
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2911
|
+
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2912
|
+
return `
|
|
2913
|
+
const ${AB_TEST_FN_NAME} = ${fnStr}
|
|
2914
|
+
const ${CONTENT_FN_NAME} = ${fnStr2}
|
|
2915
|
+
${AB_TEST_FN_NAME}("${contentId}", ${JSON.stringify(variants)}, ${isHydrationTarget})
|
|
2916
|
+
`;
|
|
2917
|
+
};
|
|
2918
|
+
const getRenderContentScriptString = ({ parentContentId, contentId }) => {
|
|
2919
|
+
return `
|
|
2920
|
+
${CONTENT_FN_NAME}("${contentId}", "${parentContentId}", ${isHydrationTarget})`;
|
|
2921
|
+
};
|
|
2857
2922
|
const getCssFromFont = (font) => {
|
|
2858
2923
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
2859
2924
|
const name = family.split(",")[0];
|
|
@@ -2919,7 +2984,7 @@ ${getFontCss({
|
|
|
2919
2984
|
text-align: inherit;
|
|
2920
2985
|
font-family: inherit;
|
|
2921
2986
|
}
|
|
2922
|
-
|
|
2987
|
+
`.trim()
|
|
2923
2988
|
});
|
|
2924
2989
|
return /* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
2925
2990
|
get styles() {
|
|
@@ -2984,8 +3049,8 @@ const setBreakpoints = function setBreakpoints2(props, state, elementRef, breakp
|
|
|
2984
3049
|
}
|
|
2985
3050
|
};
|
|
2986
3051
|
};
|
|
2987
|
-
const
|
|
2988
|
-
state.contentState =
|
|
3052
|
+
const contentSetState = function contentSetState2(props, state, elementRef, newRootState) {
|
|
3053
|
+
state.contentState = newRootState;
|
|
2989
3054
|
};
|
|
2990
3055
|
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
2991
3056
|
const { data } = event;
|
|
@@ -3019,7 +3084,9 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
|
3019
3084
|
evaluate({
|
|
3020
3085
|
code: jsCode,
|
|
3021
3086
|
context: props.context || {},
|
|
3022
|
-
|
|
3087
|
+
localState: void 0,
|
|
3088
|
+
rootState: state.contentState,
|
|
3089
|
+
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3023
3090
|
});
|
|
3024
3091
|
};
|
|
3025
3092
|
const onClick = function onClick22(props, state, elementRef, event) {
|
|
@@ -3043,7 +3110,9 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
|
|
|
3043
3110
|
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
3044
3111
|
code: group,
|
|
3045
3112
|
context: props.context || {},
|
|
3046
|
-
|
|
3113
|
+
localState: void 0,
|
|
3114
|
+
rootState: state.contentState,
|
|
3115
|
+
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3047
3116
|
}));
|
|
3048
3117
|
};
|
|
3049
3118
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
@@ -3052,7 +3121,7 @@ const handleRequest = function handleRequest2(props, state, elementRef, { url, k
|
|
|
3052
3121
|
...state.contentState,
|
|
3053
3122
|
[key]: json
|
|
3054
3123
|
};
|
|
3055
|
-
|
|
3124
|
+
contentSetState(props, state, elementRef, newState);
|
|
3056
3125
|
}).catch((err) => {
|
|
3057
3126
|
console.error("error fetching dynamic data", url, err);
|
|
3058
3127
|
});
|
|
@@ -3088,9 +3157,12 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3088
3157
|
...getDefaultRegisteredComponents(),
|
|
3089
3158
|
...components,
|
|
3090
3159
|
...props.customComponents || []
|
|
3091
|
-
].reduce((acc, curr) => ({
|
|
3160
|
+
].reduce((acc, { component, ...curr }) => ({
|
|
3092
3161
|
...acc,
|
|
3093
|
-
[curr.name]:
|
|
3162
|
+
[curr.name]: {
|
|
3163
|
+
component,
|
|
3164
|
+
...curr
|
|
3165
|
+
}
|
|
3094
3166
|
}), {}),
|
|
3095
3167
|
canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
|
|
3096
3168
|
clicked: false,
|
|
@@ -3102,6 +3174,10 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3102
3174
|
forceReRenderCount: 0,
|
|
3103
3175
|
httpReqsData: {},
|
|
3104
3176
|
overrideContent: null,
|
|
3177
|
+
scriptStr: getRenderContentScriptString({
|
|
3178
|
+
contentId: props.content?.id,
|
|
3179
|
+
parentContentId: props.parentContentId
|
|
3180
|
+
}),
|
|
3105
3181
|
update: 0,
|
|
3106
3182
|
useContent: getContentInitialValue({
|
|
3107
3183
|
content: props.content,
|
|
@@ -3110,9 +3186,11 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3110
3186
|
}, {
|
|
3111
3187
|
deep: true
|
|
3112
3188
|
});
|
|
3113
|
-
useContextProvider(
|
|
3189
|
+
useContextProvider(BuilderContext, useStore({
|
|
3114
3190
|
content: state.useContent,
|
|
3115
|
-
|
|
3191
|
+
localState: void 0,
|
|
3192
|
+
rootState: state.contentState,
|
|
3193
|
+
rootSetState: void 0,
|
|
3116
3194
|
context: props.context || {},
|
|
3117
3195
|
apiKey: props.apiKey,
|
|
3118
3196
|
apiVersion: props.apiVersion,
|
|
@@ -3133,6 +3211,9 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3133
3211
|
} : {},
|
|
3134
3212
|
...props2.includeRefs ? {
|
|
3135
3213
|
includeRefs: props2.includeRefs
|
|
3214
|
+
} : {},
|
|
3215
|
+
...props2.enrich ? {
|
|
3216
|
+
enrich: props2.enrich
|
|
3136
3217
|
} : {}
|
|
3137
3218
|
});
|
|
3138
3219
|
Object.values(state2.allRegisteredComponents).forEach((registeredComponent) => {
|
|
@@ -3168,7 +3249,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3168
3249
|
mergeNewContent(props2, state2, elementRef2, content);
|
|
3169
3250
|
});
|
|
3170
3251
|
}
|
|
3171
|
-
evaluateJsCode(props2, state2);
|
|
3252
|
+
evaluateJsCode(props2, state2, elementRef2);
|
|
3172
3253
|
runHttpRequests(props2, state2, elementRef2);
|
|
3173
3254
|
emitStateUpdate(props2, state2);
|
|
3174
3255
|
}
|
|
@@ -3191,7 +3272,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3191
3272
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3192
3273
|
track2(() => state2.useContent?.data?.jsCode);
|
|
3193
3274
|
track2(() => state2.contentState);
|
|
3194
|
-
evaluateJsCode(props2, state2);
|
|
3275
|
+
evaluateJsCode(props2, state2, elementRef2);
|
|
3195
3276
|
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3196
3277
|
elementRef,
|
|
3197
3278
|
props,
|
|
@@ -3216,15 +3297,52 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3216
3297
|
state
|
|
3217
3298
|
]));
|
|
3218
3299
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3219
|
-
children: state.useContent ? /* @__PURE__ */
|
|
3220
|
-
ref: elementRef
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3300
|
+
children: state.useContent ? /* @__PURE__ */ _jsxS("div", {
|
|
3301
|
+
ref: elementRef,
|
|
3302
|
+
...{},
|
|
3303
|
+
...props.hideContent ? {
|
|
3304
|
+
hidden: true,
|
|
3305
|
+
"aria-hidden": true
|
|
3306
|
+
} : {},
|
|
3307
|
+
children: [
|
|
3308
|
+
props.isSsrAbTest ? /* @__PURE__ */ _jsxQ("script", null, {
|
|
3309
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
|
|
3310
|
+
state
|
|
3311
|
+
], "p0.scriptStr")
|
|
3312
|
+
}, null, 3, "03_0") : null,
|
|
3313
|
+
/* @__PURE__ */ _jsxC(RenderContentStyles, {
|
|
3314
|
+
get contentId() {
|
|
3315
|
+
return state.useContent?.id;
|
|
3316
|
+
},
|
|
3317
|
+
get cssCode() {
|
|
3318
|
+
return state.useContent?.data?.cssCode;
|
|
3319
|
+
},
|
|
3320
|
+
get customFonts() {
|
|
3321
|
+
return state.useContent?.data?.customFonts;
|
|
3322
|
+
},
|
|
3323
|
+
[_IMMUTABLE]: {
|
|
3324
|
+
contentId: _fnSignal((p0) => p0.useContent?.id, [
|
|
3325
|
+
state
|
|
3326
|
+
], "p0.useContent?.id"),
|
|
3327
|
+
cssCode: _fnSignal((p0) => p0.useContent?.data?.cssCode, [
|
|
3328
|
+
state
|
|
3329
|
+
], "p0.useContent?.data?.cssCode"),
|
|
3330
|
+
customFonts: _fnSignal((p0) => p0.useContent?.data?.customFonts, [
|
|
3331
|
+
state
|
|
3332
|
+
], "p0.useContent?.data?.customFonts")
|
|
3333
|
+
}
|
|
3334
|
+
}, 3, "03_1"),
|
|
3335
|
+
/* @__PURE__ */ _jsxC(RenderBlocks, {
|
|
3336
|
+
get blocks() {
|
|
3337
|
+
return state.useContent?.data?.blocks;
|
|
3338
|
+
},
|
|
3339
|
+
[_IMMUTABLE]: {
|
|
3340
|
+
blocks: _fnSignal((p0) => p0.useContent?.data?.blocks, [
|
|
3341
|
+
state
|
|
3342
|
+
], "p0.useContent?.data?.blocks")
|
|
3343
|
+
}
|
|
3344
|
+
}, 3, state.forceReRenderCount)
|
|
3345
|
+
],
|
|
3228
3346
|
onClick$: /* @__PURE__ */ inlinedQrl((event) => {
|
|
3229
3347
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3230
3348
|
return onClick(props2, state2, elementRef2, event);
|
|
@@ -3233,42 +3351,285 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3233
3351
|
props,
|
|
3234
3352
|
state
|
|
3235
3353
|
])
|
|
3236
|
-
},
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3354
|
+
}, {
|
|
3355
|
+
"builder-content-id": _fnSignal((p0) => p0.useContent?.id, [
|
|
3356
|
+
state
|
|
3357
|
+
], "p0.useContent?.id"),
|
|
3358
|
+
"builder-model": _fnSignal((p0) => p0.model, [
|
|
3359
|
+
props
|
|
3360
|
+
], "p0.model"),
|
|
3361
|
+
class: _fnSignal((p0) => p0.classNameProp, [
|
|
3362
|
+
props
|
|
3363
|
+
], "p0.classNameProp")
|
|
3364
|
+
}, 0, "03_2") : null
|
|
3365
|
+
}, 1, "03_3");
|
|
3366
|
+
}, "RenderContent_component_hEAI0ahViXM"));
|
|
3367
|
+
const fetchContent = function fetchContent2(props, state, builderContext) {
|
|
3368
|
+
if (!state.contentToUse && props.symbol?.model && builderContext?.apiKey)
|
|
3369
|
+
getContent({
|
|
3370
|
+
model: props.symbol.model,
|
|
3371
|
+
apiKey: builderContext.apiKey,
|
|
3372
|
+
apiVersion: builderContext.apiVersion,
|
|
3373
|
+
query: {
|
|
3374
|
+
id: props.symbol.entry
|
|
3375
|
+
}
|
|
3376
|
+
}).then((response) => {
|
|
3377
|
+
if (response)
|
|
3378
|
+
state.contentToUse = response;
|
|
3379
|
+
}).catch((err) => {
|
|
3380
|
+
logger.error("Could not fetch symbol content: ", err);
|
|
3381
|
+
});
|
|
3382
|
+
};
|
|
3383
|
+
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3384
|
+
const builderContext = useContext(BuilderContext);
|
|
3385
|
+
const state = useStore({
|
|
3386
|
+
className: [
|
|
3387
|
+
...[
|
|
3388
|
+
props.attributes.class
|
|
3389
|
+
],
|
|
3390
|
+
"builder-symbol",
|
|
3391
|
+
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
3392
|
+
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
3393
|
+
].filter(Boolean).join(" "),
|
|
3394
|
+
contentToUse: props.symbol?.content
|
|
3395
|
+
});
|
|
3396
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3397
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
3398
|
+
fetchContent(props2, state2, builderContext2);
|
|
3399
|
+
}, "Symbol_component_useVisibleTask_oMPs8W5ZhwE", [
|
|
3400
|
+
builderContext,
|
|
3401
|
+
props,
|
|
3402
|
+
state
|
|
3403
|
+
]));
|
|
3404
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3405
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
3406
|
+
track2(() => props2.symbol);
|
|
3407
|
+
fetchContent(props2, state2, builderContext2);
|
|
3408
|
+
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
3409
|
+
builderContext,
|
|
3410
|
+
props,
|
|
3411
|
+
state
|
|
3412
|
+
]));
|
|
3413
|
+
return /* @__PURE__ */ _jsxS("div", {
|
|
3414
|
+
...props.attributes,
|
|
3415
|
+
children: /* @__PURE__ */ _jsxC(RenderContent, {
|
|
3416
|
+
get apiVersion() {
|
|
3417
|
+
return builderContext.apiVersion;
|
|
3418
|
+
},
|
|
3419
|
+
get apiKey() {
|
|
3420
|
+
return builderContext.apiKey;
|
|
3421
|
+
},
|
|
3422
|
+
get context() {
|
|
3423
|
+
return builderContext.context;
|
|
3424
|
+
},
|
|
3425
|
+
get customComponents() {
|
|
3426
|
+
return Object.values(builderContext.registeredComponents);
|
|
3427
|
+
},
|
|
3428
|
+
get data() {
|
|
3429
|
+
return {
|
|
3430
|
+
...props.symbol?.data,
|
|
3431
|
+
...builderContext.localState,
|
|
3432
|
+
...state.contentToUse?.data?.state
|
|
3433
|
+
};
|
|
3434
|
+
},
|
|
3435
|
+
get model() {
|
|
3436
|
+
return props.symbol?.model;
|
|
3437
|
+
},
|
|
3438
|
+
get content() {
|
|
3439
|
+
return state.contentToUse;
|
|
3440
|
+
},
|
|
3441
|
+
[_IMMUTABLE]: {
|
|
3442
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3443
|
+
builderContext
|
|
3444
|
+
], "p0.apiVersion"),
|
|
3445
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3446
|
+
builderContext
|
|
3447
|
+
], "p0.apiKey"),
|
|
3448
|
+
context: _fnSignal((p0) => p0.context, [
|
|
3449
|
+
builderContext
|
|
3450
|
+
], "p0.context"),
|
|
3451
|
+
customComponents: _fnSignal((p0) => Object.values(p0.registeredComponents), [
|
|
3452
|
+
builderContext
|
|
3453
|
+
], "Object.values(p0.registeredComponents)"),
|
|
3454
|
+
data: _fnSignal((p0, p1, p2) => ({
|
|
3455
|
+
...p1.symbol?.data,
|
|
3456
|
+
...p0.localState,
|
|
3457
|
+
...p2.contentToUse?.data?.state
|
|
3458
|
+
}), [
|
|
3459
|
+
builderContext,
|
|
3460
|
+
props,
|
|
3461
|
+
state
|
|
3462
|
+
], "{...p1.symbol?.data,...p0.localState,...p2.contentToUse?.data?.state}"),
|
|
3463
|
+
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
3464
|
+
props
|
|
3465
|
+
], "p0.symbol?.model"),
|
|
3466
|
+
content: _fnSignal((p0) => p0.contentToUse, [
|
|
3467
|
+
state
|
|
3468
|
+
], "p0.contentToUse")
|
|
3469
|
+
}
|
|
3470
|
+
}, 3, "Wt_0")
|
|
3471
|
+
}, {
|
|
3472
|
+
class: _fnSignal((p0) => p0.className, [
|
|
3473
|
+
state
|
|
3474
|
+
], "p0.className")
|
|
3475
|
+
}, 0, "Wt_1");
|
|
3476
|
+
}, "Symbol_component_WVvggdkUPdk"));
|
|
3477
|
+
const RenderContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3478
|
+
_jsxBranch();
|
|
3479
|
+
const state = useStore({
|
|
3480
|
+
contentToRender: checkShouldRunVariants({
|
|
3481
|
+
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3482
|
+
content: props.content
|
|
3483
|
+
}) ? props.content : handleABTestingSync({
|
|
3484
|
+
item: props.content,
|
|
3485
|
+
canTrack: getDefaultCanTrack(props.canTrack)
|
|
3486
|
+
}),
|
|
3487
|
+
hideVariantsStyleString: getVariants(props.content).map((value) => `.variant-${value.id} { display: none; } `).join(""),
|
|
3488
|
+
shouldRenderVariants: checkShouldRunVariants({
|
|
3489
|
+
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3490
|
+
content: props.content
|
|
3491
|
+
}),
|
|
3492
|
+
variantScriptStr: getVariantsScriptString(getVariants(props.content).map((value) => ({
|
|
3493
|
+
id: value.id,
|
|
3494
|
+
testRatio: value.testRatio
|
|
3495
|
+
})), props.content?.id || "")
|
|
3496
|
+
});
|
|
3497
|
+
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
3498
|
+
children: [
|
|
3499
|
+
state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
3500
|
+
children: [
|
|
3501
|
+
/* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
3502
|
+
get id() {
|
|
3503
|
+
return `variants-styles-${props.content?.id}`;
|
|
3504
|
+
},
|
|
3505
|
+
get styles() {
|
|
3506
|
+
return state.hideVariantsStyleString;
|
|
3507
|
+
},
|
|
3508
|
+
[_IMMUTABLE]: {
|
|
3509
|
+
id: _fnSignal((p0) => `variants-styles-${p0.content?.id}`, [
|
|
3510
|
+
props
|
|
3511
|
+
], "`variants-styles-${p0.content?.id}`"),
|
|
3512
|
+
styles: _fnSignal((p0) => p0.hideVariantsStyleString, [
|
|
3513
|
+
state
|
|
3514
|
+
], "p0.hideVariantsStyleString")
|
|
3515
|
+
}
|
|
3516
|
+
}, 3, "Bz_0"),
|
|
3517
|
+
/* @__PURE__ */ _jsxQ("script", null, {
|
|
3518
|
+
id: _fnSignal((p0) => `variants-script-${p0.content?.id}`, [
|
|
3519
|
+
props
|
|
3520
|
+
], "`variants-script-${p0.content?.id}`"),
|
|
3521
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.variantScriptStr, [
|
|
3522
|
+
state
|
|
3523
|
+
], "p0.variantScriptStr")
|
|
3524
|
+
}, null, 3, null),
|
|
3525
|
+
(getVariants(props.content) || []).map(function(variant) {
|
|
3526
|
+
return /* @__PURE__ */ _jsxC(RenderContent, {
|
|
3527
|
+
content: variant,
|
|
3528
|
+
get apiKey() {
|
|
3529
|
+
return props.apiKey;
|
|
3530
|
+
},
|
|
3531
|
+
get apiVersion() {
|
|
3532
|
+
return props.apiVersion;
|
|
3533
|
+
},
|
|
3534
|
+
get canTrack() {
|
|
3535
|
+
return props.canTrack;
|
|
3536
|
+
},
|
|
3537
|
+
get customComponents() {
|
|
3538
|
+
return props.customComponents;
|
|
3539
|
+
},
|
|
3540
|
+
hideContent: true,
|
|
3541
|
+
get parentContentId() {
|
|
3542
|
+
return props.content?.id;
|
|
3543
|
+
},
|
|
3544
|
+
get isSsrAbTest() {
|
|
3545
|
+
return state.shouldRenderVariants;
|
|
3546
|
+
},
|
|
3547
|
+
[_IMMUTABLE]: {
|
|
3548
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3549
|
+
props
|
|
3550
|
+
], "p0.apiKey"),
|
|
3551
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3552
|
+
props
|
|
3553
|
+
], "p0.apiVersion"),
|
|
3554
|
+
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3555
|
+
props
|
|
3556
|
+
], "p0.canTrack"),
|
|
3557
|
+
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3558
|
+
props
|
|
3559
|
+
], "p0.customComponents"),
|
|
3560
|
+
hideContent: _IMMUTABLE,
|
|
3561
|
+
parentContentId: _fnSignal((p0) => p0.content?.id, [
|
|
3562
|
+
props
|
|
3563
|
+
], "p0.content?.id"),
|
|
3564
|
+
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3565
|
+
state
|
|
3566
|
+
], "p0.shouldRenderVariants")
|
|
3567
|
+
}
|
|
3568
|
+
}, 3, variant.id);
|
|
3569
|
+
})
|
|
3570
|
+
]
|
|
3571
|
+
}, 1, "Bz_1") : null,
|
|
3572
|
+
/* @__PURE__ */ _jsxC(RenderContent, {
|
|
3573
|
+
get model() {
|
|
3574
|
+
return props.model;
|
|
3240
3575
|
},
|
|
3241
|
-
get
|
|
3242
|
-
return state.
|
|
3576
|
+
get content() {
|
|
3577
|
+
return state.contentToRender;
|
|
3243
3578
|
},
|
|
3244
|
-
get
|
|
3245
|
-
return
|
|
3579
|
+
get apiKey() {
|
|
3580
|
+
return props.apiKey;
|
|
3246
3581
|
},
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3582
|
+
get apiVersion() {
|
|
3583
|
+
return props.apiVersion;
|
|
3584
|
+
},
|
|
3585
|
+
get canTrack() {
|
|
3586
|
+
return props.canTrack;
|
|
3587
|
+
},
|
|
3588
|
+
get customComponents() {
|
|
3589
|
+
return props.customComponents;
|
|
3590
|
+
},
|
|
3591
|
+
get classNameProp() {
|
|
3592
|
+
return `variant-${props.content?.id}`;
|
|
3593
|
+
},
|
|
3594
|
+
get parentContentId() {
|
|
3595
|
+
return props.content?.id;
|
|
3596
|
+
},
|
|
3597
|
+
get isSsrAbTest() {
|
|
3598
|
+
return state.shouldRenderVariants;
|
|
3262
3599
|
},
|
|
3263
3600
|
[_IMMUTABLE]: {
|
|
3264
|
-
|
|
3601
|
+
model: _fnSignal((p0) => p0.model, [
|
|
3602
|
+
props
|
|
3603
|
+
], "p0.model"),
|
|
3604
|
+
content: _fnSignal((p0) => p0.contentToRender, [
|
|
3605
|
+
state
|
|
3606
|
+
], "p0.contentToRender"),
|
|
3607
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
3608
|
+
props
|
|
3609
|
+
], "p0.apiKey"),
|
|
3610
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
3611
|
+
props
|
|
3612
|
+
], "p0.apiVersion"),
|
|
3613
|
+
canTrack: _fnSignal((p0) => p0.canTrack, [
|
|
3614
|
+
props
|
|
3615
|
+
], "p0.canTrack"),
|
|
3616
|
+
customComponents: _fnSignal((p0) => p0.customComponents, [
|
|
3617
|
+
props
|
|
3618
|
+
], "p0.customComponents"),
|
|
3619
|
+
classNameProp: _fnSignal((p0) => `variant-${p0.content?.id}`, [
|
|
3620
|
+
props
|
|
3621
|
+
], "`variant-${p0.content?.id}`"),
|
|
3622
|
+
parentContentId: _fnSignal((p0) => p0.content?.id, [
|
|
3623
|
+
props
|
|
3624
|
+
], "p0.content?.id"),
|
|
3625
|
+
isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
|
|
3265
3626
|
state
|
|
3266
|
-
], "p0.
|
|
3627
|
+
], "p0.shouldRenderVariants")
|
|
3267
3628
|
}
|
|
3268
|
-
}, 3,
|
|
3269
|
-
]
|
|
3270
|
-
}, 1, "
|
|
3271
|
-
}, "
|
|
3629
|
+
}, 3, "Bz_2")
|
|
3630
|
+
]
|
|
3631
|
+
}, 1, "Bz_3");
|
|
3632
|
+
}, "RenderContentVariants_component_OMvvre8Ofjw"));
|
|
3272
3633
|
const settings = {};
|
|
3273
3634
|
function setEditorSettings(newSettings) {
|
|
3274
3635
|
if (isBrowser()) {
|
|
@@ -3286,23 +3647,18 @@ export {
|
|
|
3286
3647
|
FragmentComponent as Fragment,
|
|
3287
3648
|
Image,
|
|
3288
3649
|
RenderBlocks,
|
|
3289
|
-
RenderContent,
|
|
3650
|
+
RenderContentVariants as RenderContent,
|
|
3290
3651
|
SectionComponent as Section,
|
|
3291
3652
|
Symbol$1 as Symbol,
|
|
3292
3653
|
Text,
|
|
3293
3654
|
Video,
|
|
3294
|
-
components,
|
|
3295
|
-
convertSearchParamsToQueryObject,
|
|
3296
3655
|
createRegisterComponentMessage,
|
|
3297
3656
|
getAllContent,
|
|
3298
|
-
getBuilderSearchParams,
|
|
3299
|
-
getBuilderSearchParamsFromWindow,
|
|
3300
3657
|
getContent,
|
|
3301
3658
|
isEditing,
|
|
3302
3659
|
isPreviewing,
|
|
3303
|
-
|
|
3660
|
+
processContentResult,
|
|
3304
3661
|
register,
|
|
3305
|
-
registerComponent,
|
|
3306
3662
|
setEditorSettings,
|
|
3307
3663
|
track
|
|
3308
3664
|
};
|