@builder.io/sdk-qwik 0.3.1 → 0.4.1
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 +910 -593
- package/lib/index.qwik.mjs +911 -594
- package/package.json +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 +5 -0
- package/types/components/render-inlined-styles.d.ts +1 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-builder-search-params/index.d.ts +6 -0
- package/types/functions/get-content/index.d.ts +7 -2
- package/types/functions/get-content/types.d.ts +6 -0
- package/types/helpers/ab-tests.d.ts +8 -7
- 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 +9 -7
- package/types/scripts/init-editing.d.ts +1 -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";
|
|
@@ -195,23 +195,14 @@ const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
|
195
195
|
return cssClass;
|
|
196
196
|
};
|
|
197
197
|
const RenderInlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
tag
|
|
207
|
-
]));
|
|
208
|
-
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
209
|
-
children: /* @__PURE__ */ _jsxQ("style", null, {
|
|
210
|
-
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
211
|
-
props
|
|
212
|
-
], "p0.styles")
|
|
213
|
-
}, null, 3, "zz_0")
|
|
214
|
-
}, 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");
|
|
215
206
|
}, "RenderInlinedStyles_component_ejNQtXd1ahM"));
|
|
216
207
|
const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
217
208
|
_jsxBranch();
|
|
@@ -463,7 +454,7 @@ const RenderComponent = (props) => {
|
|
|
463
454
|
}, 1, "R9_1");
|
|
464
455
|
};
|
|
465
456
|
const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
466
|
-
useContextProvider(
|
|
457
|
+
useContextProvider(BuilderContext, useStore({
|
|
467
458
|
content: props.repeatContext.content,
|
|
468
459
|
localState: props.repeatContext.localState,
|
|
469
460
|
rootState: props.repeatContext.rootState,
|
|
@@ -494,7 +485,7 @@ const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlined
|
|
|
494
485
|
const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
495
486
|
_jsxBranch();
|
|
496
487
|
const state = useStore({
|
|
497
|
-
|
|
488
|
+
Tag: props.block.tagName || "div"
|
|
498
489
|
});
|
|
499
490
|
const component = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
500
491
|
const [props2] = useLexicalScope();
|
|
@@ -618,11 +609,11 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
618
609
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
619
610
|
children: canShowBlock.value ? !component.value?.noWrap ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
620
611
|
children: [
|
|
621
|
-
isEmptyHtmlElement(state.
|
|
612
|
+
isEmptyHtmlElement(state.Tag) ? /* @__PURE__ */ _jsxC(state.Tag, {
|
|
622
613
|
...attributes.value,
|
|
623
614
|
...actions.value
|
|
624
615
|
}, 0, "9d_0") : null,
|
|
625
|
-
!isEmptyHtmlElement(state.
|
|
616
|
+
!isEmptyHtmlElement(state.Tag) && repeatItem.value ? (repeatItem.value || []).map(function(data, index) {
|
|
626
617
|
return /* @__PURE__ */ _jsxC(RenderRepeatedBlock, {
|
|
627
618
|
get repeatContext() {
|
|
628
619
|
return data.context;
|
|
@@ -636,7 +627,7 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
636
627
|
}
|
|
637
628
|
}, 3, index);
|
|
638
629
|
}) : null,
|
|
639
|
-
!isEmptyHtmlElement(state.
|
|
630
|
+
!isEmptyHtmlElement(state.Tag) && !repeatItem.value ? /* @__PURE__ */ _jsxC(state.Tag, {
|
|
640
631
|
...attributes.value,
|
|
641
632
|
...actions.value,
|
|
642
633
|
children: [
|
|
@@ -677,7 +668,7 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
677
668
|
}, 0, "9d_4") : null
|
|
678
669
|
}, 1, "9d_5");
|
|
679
670
|
}, "RenderBlock_component_m0hg0zT573Q"));
|
|
680
|
-
const onClick$1 = function onClick2(props, state,
|
|
671
|
+
const onClick$1 = function onClick2(props, state, builderContext) {
|
|
681
672
|
if (isEditing() && !props.blocks?.length)
|
|
682
673
|
window.parent?.postMessage({
|
|
683
674
|
type: "builder.clickEmptyBlocks",
|
|
@@ -687,7 +678,7 @@ const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
|
687
678
|
}
|
|
688
679
|
}, "*");
|
|
689
680
|
};
|
|
690
|
-
const onMouseEnter = function onMouseEnter2(props, state,
|
|
681
|
+
const onMouseEnter = function onMouseEnter2(props, state, builderContext) {
|
|
691
682
|
if (isEditing() && !props.blocks?.length)
|
|
692
683
|
window.parent?.postMessage({
|
|
693
684
|
type: "builder.hoverEmptyBlocks",
|
|
@@ -699,7 +690,7 @@ const onMouseEnter = function onMouseEnter2(props, state, builderContext2) {
|
|
|
699
690
|
};
|
|
700
691
|
const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
701
692
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "RenderBlocks_component_useStylesScoped_0XKYzaR059E"));
|
|
702
|
-
const builderContext
|
|
693
|
+
const builderContext = useContext(BuilderContext);
|
|
703
694
|
const state = {};
|
|
704
695
|
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
705
696
|
const [props2] = useLexicalScope();
|
|
@@ -712,7 +703,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
712
703
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
713
704
|
return onClick$1(props2);
|
|
714
705
|
}, "RenderBlocks_component_div_onClick_RzhhZa265Yg", [
|
|
715
|
-
builderContext
|
|
706
|
+
builderContext,
|
|
716
707
|
props,
|
|
717
708
|
state
|
|
718
709
|
]),
|
|
@@ -720,7 +711,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
720
711
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
721
712
|
return onMouseEnter(props2);
|
|
722
713
|
}, "RenderBlocks_component_div_onMouseEnter_nG7I7RYG3JQ", [
|
|
723
|
-
builderContext
|
|
714
|
+
builderContext,
|
|
724
715
|
props,
|
|
725
716
|
state
|
|
726
717
|
])
|
|
@@ -741,7 +732,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
741
732
|
props.blocks ? (props.blocks || []).map(function(block) {
|
|
742
733
|
return /* @__PURE__ */ _jsxC(RenderBlock, {
|
|
743
734
|
block,
|
|
744
|
-
context: builderContext
|
|
735
|
+
context: builderContext,
|
|
745
736
|
[_IMMUTABLE]: {
|
|
746
737
|
context: _IMMUTABLE
|
|
747
738
|
}
|
|
@@ -750,7 +741,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
750
741
|
props.blocks ? (props.blocks || []).map(function(block) {
|
|
751
742
|
return /* @__PURE__ */ _jsxC(BlockStyles, {
|
|
752
743
|
block,
|
|
753
|
-
context: builderContext
|
|
744
|
+
context: builderContext,
|
|
754
745
|
[_IMMUTABLE]: {
|
|
755
746
|
context: _IMMUTABLE
|
|
756
747
|
}
|
|
@@ -765,54 +756,54 @@ const STYLES$2 = `
|
|
|
765
756
|
align-items: stretch;
|
|
766
757
|
}
|
|
767
758
|
`;
|
|
768
|
-
const getWidth = function getWidth2(props, state,
|
|
759
|
+
const getWidth = function getWidth2(props, state, builderContext, index) {
|
|
769
760
|
return state.cols[index]?.width || 100 / state.cols.length;
|
|
770
761
|
};
|
|
771
|
-
const getColumnCssWidth = function getColumnCssWidth2(props, state,
|
|
762
|
+
const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext, index) {
|
|
772
763
|
const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
|
|
773
|
-
return `calc(${getWidth(props, state,
|
|
764
|
+
return `calc(${getWidth(props, state, builderContext, index)}% - ${subtractWidth}px)`;
|
|
774
765
|
};
|
|
775
|
-
const getTabletStyle = function getTabletStyle2(props, state,
|
|
766
|
+
const getTabletStyle = function getTabletStyle2(props, state, builderContext, { stackedStyle, desktopStyle }) {
|
|
776
767
|
return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
777
768
|
};
|
|
778
|
-
const getMobileStyle = function getMobileStyle2(props, state,
|
|
769
|
+
const getMobileStyle = function getMobileStyle2(props, state, builderContext, { stackedStyle, desktopStyle }) {
|
|
779
770
|
return state.stackAt === "never" ? desktopStyle : stackedStyle;
|
|
780
771
|
};
|
|
781
|
-
const columnCssVars = function columnCssVars2(props, state,
|
|
772
|
+
const columnCssVars = function columnCssVars2(props, state, builderContext, index) {
|
|
782
773
|
const gutter = index === 0 ? 0 : state.gutterSize;
|
|
783
|
-
const width = getColumnCssWidth(props, state,
|
|
774
|
+
const width = getColumnCssWidth(props, state, builderContext, index);
|
|
784
775
|
const gutterPixels = `${gutter}px`;
|
|
785
776
|
const mobileWidth = "100%";
|
|
786
777
|
const mobileMarginLeft = 0;
|
|
787
778
|
return {
|
|
788
779
|
width,
|
|
789
780
|
"margin-left": gutterPixels,
|
|
790
|
-
"--column-width-mobile": getMobileStyle(props, state,
|
|
781
|
+
"--column-width-mobile": getMobileStyle(props, state, builderContext, {
|
|
791
782
|
stackedStyle: mobileWidth,
|
|
792
783
|
desktopStyle: width
|
|
793
784
|
}),
|
|
794
|
-
"--column-margin-left-mobile": getMobileStyle(props, state,
|
|
785
|
+
"--column-margin-left-mobile": getMobileStyle(props, state, builderContext, {
|
|
795
786
|
stackedStyle: mobileMarginLeft,
|
|
796
787
|
desktopStyle: gutterPixels
|
|
797
788
|
}),
|
|
798
|
-
"--column-width-tablet": getTabletStyle(props, state,
|
|
789
|
+
"--column-width-tablet": getTabletStyle(props, state, builderContext, {
|
|
799
790
|
stackedStyle: mobileWidth,
|
|
800
791
|
desktopStyle: width
|
|
801
792
|
}),
|
|
802
|
-
"--column-margin-left-tablet": getTabletStyle(props, state,
|
|
793
|
+
"--column-margin-left-tablet": getTabletStyle(props, state, builderContext, {
|
|
803
794
|
stackedStyle: mobileMarginLeft,
|
|
804
795
|
desktopStyle: gutterPixels
|
|
805
796
|
})
|
|
806
797
|
};
|
|
807
798
|
};
|
|
808
|
-
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state,
|
|
809
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
799
|
+
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext, size) {
|
|
800
|
+
const breakpointSizes = getSizesForBreakpoints(builderContext.content?.meta?.breakpoints || {});
|
|
810
801
|
return breakpointSizes[size].max;
|
|
811
802
|
};
|
|
812
803
|
const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
813
804
|
_jsxBranch();
|
|
814
805
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
|
|
815
|
-
const builderContext
|
|
806
|
+
const builderContext = useContext(BuilderContext);
|
|
816
807
|
const state = useStore({
|
|
817
808
|
cols: props.columns || [],
|
|
818
809
|
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
@@ -829,7 +820,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
829
820
|
})
|
|
830
821
|
};
|
|
831
822
|
}, "Columns_component_columnsCssVars_useComputed_adFEq2RWT9s", [
|
|
832
|
-
builderContext
|
|
823
|
+
builderContext,
|
|
833
824
|
props,
|
|
834
825
|
state
|
|
835
826
|
]));
|
|
@@ -861,7 +852,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
861
852
|
},
|
|
862
853
|
`;
|
|
863
854
|
}, "Columns_component_columnsStyles_useComputed_nBtMPbzd1Wc", [
|
|
864
|
-
builderContext
|
|
855
|
+
builderContext,
|
|
865
856
|
props,
|
|
866
857
|
state
|
|
867
858
|
]));
|
|
@@ -885,7 +876,7 @@ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
885
876
|
}, 3, "c0_0"),
|
|
886
877
|
(props.columns || []).map(function(column, index) {
|
|
887
878
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
888
|
-
style: columnCssVars(props, state, builderContext
|
|
879
|
+
style: columnCssVars(props, state, builderContext, index)
|
|
889
880
|
}, {
|
|
890
881
|
class: "builder-column div-Columns-2"
|
|
891
882
|
}, /* @__PURE__ */ _jsxC(RenderBlocks, {
|
|
@@ -1096,6 +1087,24 @@ const STYLES = `
|
|
|
1096
1087
|
height: 100%;
|
|
1097
1088
|
}
|
|
1098
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"));
|
|
1099
1108
|
const componentInfo$a = {
|
|
1100
1109
|
name: "Core:Button",
|
|
1101
1110
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1578,24 +1587,6 @@ const componentInfo$6 = {
|
|
|
1578
1587
|
}
|
|
1579
1588
|
]
|
|
1580
1589
|
};
|
|
1581
|
-
const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1582
|
-
return /* @__PURE__ */ _jsxS("section", {
|
|
1583
|
-
...props.attributes,
|
|
1584
|
-
style: {
|
|
1585
|
-
width: "100%",
|
|
1586
|
-
alignSelf: "stretch",
|
|
1587
|
-
flexGrow: 1,
|
|
1588
|
-
boxSizing: "border-box",
|
|
1589
|
-
maxWidth: props.maxWidth || 1200,
|
|
1590
|
-
display: "flex",
|
|
1591
|
-
flexDirection: "column",
|
|
1592
|
-
alignItems: "stretch",
|
|
1593
|
-
marginLeft: "auto",
|
|
1594
|
-
marginRight: "auto"
|
|
1595
|
-
},
|
|
1596
|
-
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0")
|
|
1597
|
-
}, null, 0, "2Y_1");
|
|
1598
|
-
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1599
1590
|
const componentInfo$5 = {
|
|
1600
1591
|
name: "Symbol",
|
|
1601
1592
|
noWrap: true,
|
|
@@ -1635,435 +1626,30 @@ const componentInfo$5 = {
|
|
|
1635
1626
|
}
|
|
1636
1627
|
]
|
|
1637
1628
|
};
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
if (typeof self !== "undefined")
|
|
1652
|
-
return self;
|
|
1653
|
-
return globalThis;
|
|
1654
|
-
}
|
|
1655
|
-
function getFetch() {
|
|
1656
|
-
const globalFetch = getGlobalThis().fetch;
|
|
1657
|
-
if (typeof globalFetch === "undefined") {
|
|
1658
|
-
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
1659
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
1660
|
-
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
1661
|
-
}
|
|
1662
|
-
return globalFetch;
|
|
1663
|
-
}
|
|
1664
|
-
const fetch$1 = getFetch();
|
|
1665
|
-
const getTopLevelDomain = (host) => {
|
|
1666
|
-
if (host === "localhost" || host === "127.0.0.1")
|
|
1667
|
-
return host;
|
|
1668
|
-
const parts = host.split(".");
|
|
1669
|
-
if (parts.length > 2)
|
|
1670
|
-
return parts.slice(1).join(".");
|
|
1671
|
-
return host;
|
|
1672
|
-
};
|
|
1673
|
-
const getCookie = async ({ name, canTrack }) => {
|
|
1674
|
-
try {
|
|
1675
|
-
if (!canTrack)
|
|
1676
|
-
return void 0;
|
|
1677
|
-
return document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))?.split("=")[1];
|
|
1678
|
-
} catch (err) {
|
|
1679
|
-
console.debug("[COOKIE] GET error: ", err);
|
|
1680
|
-
return void 0;
|
|
1681
|
-
}
|
|
1682
|
-
};
|
|
1683
|
-
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
|
|
1684
|
-
const SECURE_CONFIG = [
|
|
1685
|
-
[
|
|
1686
|
-
"secure",
|
|
1687
|
-
""
|
|
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
|
+
}
|
|
1688
1642
|
],
|
|
1689
|
-
|
|
1690
|
-
"
|
|
1691
|
-
"
|
|
1692
|
-
|
|
1693
|
-
];
|
|
1694
|
-
const createCookieString = ({ name, value, expires }) => {
|
|
1695
|
-
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
1696
|
-
const secureObj = secure ? SECURE_CONFIG : [
|
|
1697
|
-
[]
|
|
1698
|
-
];
|
|
1699
|
-
const expiresObj = expires ? [
|
|
1700
|
-
[
|
|
1701
|
-
"expires",
|
|
1702
|
-
expires.toUTCString()
|
|
1703
|
-
]
|
|
1704
|
-
] : [
|
|
1705
|
-
[]
|
|
1706
|
-
];
|
|
1707
|
-
const cookieValue = [
|
|
1708
|
-
[
|
|
1709
|
-
name,
|
|
1710
|
-
value
|
|
1711
|
-
],
|
|
1712
|
-
...expiresObj,
|
|
1713
|
-
[
|
|
1714
|
-
"path",
|
|
1715
|
-
"/"
|
|
1716
|
-
],
|
|
1717
|
-
[
|
|
1718
|
-
"domain",
|
|
1719
|
-
getTopLevelDomain(window.location.hostname)
|
|
1720
|
-
],
|
|
1721
|
-
...secureObj
|
|
1722
|
-
];
|
|
1723
|
-
const cookie = stringifyCookie(cookieValue);
|
|
1724
|
-
return cookie;
|
|
1725
|
-
};
|
|
1726
|
-
const setCookie = async ({ name, value, expires, canTrack }) => {
|
|
1727
|
-
try {
|
|
1728
|
-
if (!canTrack)
|
|
1729
|
-
return;
|
|
1730
|
-
const cookie = createCookieString({
|
|
1731
|
-
name,
|
|
1732
|
-
value,
|
|
1733
|
-
expires
|
|
1734
|
-
});
|
|
1735
|
-
document.cookie = cookie;
|
|
1736
|
-
} catch (err) {
|
|
1737
|
-
console.warn("[COOKIE] SET error: ", err);
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
const BUILDER_STORE_PREFIX = "builderio.variations";
|
|
1741
|
-
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
1742
|
-
const getContentVariationCookie = ({ contentId, canTrack }) => getCookie({
|
|
1743
|
-
name: getContentTestKey(contentId),
|
|
1744
|
-
canTrack
|
|
1745
|
-
});
|
|
1746
|
-
const setContentVariationCookie = ({ contentId, canTrack, value }) => setCookie({
|
|
1747
|
-
name: getContentTestKey(contentId),
|
|
1748
|
-
value,
|
|
1749
|
-
canTrack
|
|
1750
|
-
});
|
|
1751
|
-
const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
|
|
1752
|
-
const getRandomVariationId = ({ id, variations }) => {
|
|
1753
|
-
let n = 0;
|
|
1754
|
-
const random = Math.random();
|
|
1755
|
-
for (const id2 in variations) {
|
|
1756
|
-
const testRatio = variations[id2]?.testRatio;
|
|
1757
|
-
n += testRatio;
|
|
1758
|
-
if (random < n)
|
|
1759
|
-
return id2;
|
|
1760
|
-
}
|
|
1761
|
-
return id;
|
|
1762
|
-
};
|
|
1763
|
-
const getTestFields = ({ item, testGroupId }) => {
|
|
1764
|
-
const variationValue = item.variations[testGroupId];
|
|
1765
|
-
if (testGroupId === item.id || !variationValue)
|
|
1766
|
-
return {
|
|
1767
|
-
testVariationId: item.id,
|
|
1768
|
-
testVariationName: "Default"
|
|
1769
|
-
};
|
|
1770
|
-
else
|
|
1771
|
-
return {
|
|
1772
|
-
data: variationValue.data,
|
|
1773
|
-
testVariationId: variationValue.id,
|
|
1774
|
-
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
1775
|
-
};
|
|
1776
|
-
};
|
|
1777
|
-
const getContentVariation = async ({ item, canTrack }) => {
|
|
1778
|
-
const testGroupId = await getContentVariationCookie({
|
|
1779
|
-
canTrack,
|
|
1780
|
-
contentId: item.id
|
|
1781
|
-
});
|
|
1782
|
-
const testFields = testGroupId ? getTestFields({
|
|
1783
|
-
item,
|
|
1784
|
-
testGroupId
|
|
1785
|
-
}) : void 0;
|
|
1786
|
-
if (testFields)
|
|
1787
|
-
return testFields;
|
|
1788
|
-
else {
|
|
1789
|
-
const randomVariationId = getRandomVariationId({
|
|
1790
|
-
variations: item.variations,
|
|
1791
|
-
id: item.id
|
|
1792
|
-
});
|
|
1793
|
-
setContentVariationCookie({
|
|
1794
|
-
contentId: item.id,
|
|
1795
|
-
value: randomVariationId,
|
|
1796
|
-
canTrack
|
|
1797
|
-
}).catch((err) => {
|
|
1798
|
-
console.error("could not store A/B test variation: ", err);
|
|
1799
|
-
});
|
|
1800
|
-
return getTestFields({
|
|
1801
|
-
item,
|
|
1802
|
-
testGroupId: randomVariationId
|
|
1803
|
-
});
|
|
1643
|
+
defaultStyles: {
|
|
1644
|
+
lineHeight: "normal",
|
|
1645
|
+
height: "auto",
|
|
1646
|
+
textAlign: "center"
|
|
1804
1647
|
}
|
|
1805
1648
|
};
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
item,
|
|
1811
|
-
canTrack
|
|
1812
|
-
});
|
|
1813
|
-
Object.assign(item, variationValue);
|
|
1814
|
-
};
|
|
1815
|
-
function flatten(object, path = null, separator = ".") {
|
|
1816
|
-
return Object.keys(object).reduce((acc, key) => {
|
|
1817
|
-
const value = object[key];
|
|
1818
|
-
const newPath = [
|
|
1819
|
-
path,
|
|
1820
|
-
key
|
|
1821
|
-
].filter(Boolean).join(separator);
|
|
1822
|
-
const isObject = [
|
|
1823
|
-
typeof value === "object",
|
|
1824
|
-
value !== null,
|
|
1825
|
-
!(Array.isArray(value) && value.length === 0)
|
|
1826
|
-
].every(Boolean);
|
|
1827
|
-
return isObject ? {
|
|
1828
|
-
...acc,
|
|
1829
|
-
...flatten(value, newPath, separator)
|
|
1830
|
-
} : {
|
|
1831
|
-
...acc,
|
|
1832
|
-
[newPath]: value
|
|
1833
|
-
};
|
|
1834
|
-
}, {});
|
|
1835
|
-
}
|
|
1836
|
-
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
1837
|
-
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
1838
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
1839
|
-
const options = {};
|
|
1840
|
-
searchParams.forEach((value, key) => {
|
|
1841
|
-
options[key] = value;
|
|
1842
|
-
});
|
|
1843
|
-
return options;
|
|
1844
|
-
};
|
|
1845
|
-
const getBuilderSearchParams = (_options) => {
|
|
1846
|
-
if (!_options)
|
|
1847
|
-
return {};
|
|
1848
|
-
const options = normalizeSearchParams(_options);
|
|
1849
|
-
const newOptions = {};
|
|
1850
|
-
Object.keys(options).forEach((key) => {
|
|
1851
|
-
if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
1852
|
-
const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
|
|
1853
|
-
newOptions[trimmedKey] = options[key];
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
return newOptions;
|
|
1857
|
-
};
|
|
1858
|
-
const getBuilderSearchParamsFromWindow = () => {
|
|
1859
|
-
if (!isBrowser())
|
|
1860
|
-
return {};
|
|
1861
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
1862
|
-
return getBuilderSearchParams(searchParams);
|
|
1863
|
-
};
|
|
1864
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1865
|
-
const DEFAULT_API_VERSION = "v3";
|
|
1866
|
-
const generateContentUrl = (options) => {
|
|
1867
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
1868
|
-
if (!apiKey)
|
|
1869
|
-
throw new Error("Missing API key");
|
|
1870
|
-
if (![
|
|
1871
|
-
"v2",
|
|
1872
|
-
"v3"
|
|
1873
|
-
].includes(apiVersion))
|
|
1874
|
-
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1875
|
-
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1876
|
-
const queryOptions = {
|
|
1877
|
-
...getBuilderSearchParamsFromWindow(),
|
|
1878
|
-
...normalizeSearchParams(options.options || {})
|
|
1879
|
-
};
|
|
1880
|
-
const flattened = flatten(queryOptions);
|
|
1881
|
-
for (const key in flattened)
|
|
1882
|
-
url.searchParams.set(key, String(flattened[key]));
|
|
1883
|
-
if (userAttributes)
|
|
1884
|
-
url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
|
|
1885
|
-
if (query) {
|
|
1886
|
-
const flattened2 = flatten({
|
|
1887
|
-
query
|
|
1888
|
-
});
|
|
1889
|
-
for (const key in flattened2)
|
|
1890
|
-
url.searchParams.set(key, JSON.stringify(flattened2[key]));
|
|
1891
|
-
}
|
|
1892
|
-
return url;
|
|
1893
|
-
};
|
|
1894
|
-
async function getContent(options) {
|
|
1895
|
-
const allContent = await getAllContent({
|
|
1896
|
-
...options,
|
|
1897
|
-
limit: 1
|
|
1898
|
-
});
|
|
1899
|
-
if (allContent && "results" in allContent)
|
|
1900
|
-
return allContent?.results[0] || null;
|
|
1901
|
-
return null;
|
|
1902
|
-
}
|
|
1903
|
-
async function getAllContent(options) {
|
|
1904
|
-
try {
|
|
1905
|
-
const url = generateContentUrl(options);
|
|
1906
|
-
const res = await fetch$1(url.href);
|
|
1907
|
-
const content = await res.json();
|
|
1908
|
-
if ("status" in content && !("results" in content)) {
|
|
1909
|
-
logger.error("Error fetching data. ", {
|
|
1910
|
-
url,
|
|
1911
|
-
content,
|
|
1912
|
-
options
|
|
1913
|
-
});
|
|
1914
|
-
return content;
|
|
1915
|
-
}
|
|
1916
|
-
const canTrack = options.canTrack !== false;
|
|
1917
|
-
try {
|
|
1918
|
-
if (canTrack && Array.isArray(content.results))
|
|
1919
|
-
for (const item of content.results)
|
|
1920
|
-
await handleABTesting({
|
|
1921
|
-
item,
|
|
1922
|
-
canTrack
|
|
1923
|
-
});
|
|
1924
|
-
} catch (e) {
|
|
1925
|
-
logger.error("Could not setup A/B testing. ", e);
|
|
1926
|
-
}
|
|
1927
|
-
return content;
|
|
1928
|
-
} catch (error) {
|
|
1929
|
-
logger.error("Error fetching data. ", error);
|
|
1930
|
-
return null;
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1934
|
-
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1935
|
-
getContent({
|
|
1936
|
-
model: props.symbol.model,
|
|
1937
|
-
apiKey: builderContext2.apiKey,
|
|
1938
|
-
apiVersion: builderContext2.apiVersion,
|
|
1939
|
-
query: {
|
|
1940
|
-
id: props.symbol.entry
|
|
1941
|
-
}
|
|
1942
|
-
}).then((response) => {
|
|
1943
|
-
if (response)
|
|
1944
|
-
state.contentToUse = response;
|
|
1945
|
-
}).catch((err) => {
|
|
1946
|
-
logger.error("Could not fetch symbol content: ", err);
|
|
1947
|
-
});
|
|
1948
|
-
};
|
|
1949
|
-
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1950
|
-
const builderContext$1 = useContext(builderContext);
|
|
1951
|
-
const state = useStore({
|
|
1952
|
-
className: [
|
|
1953
|
-
...[
|
|
1954
|
-
props.attributes.class
|
|
1955
|
-
],
|
|
1956
|
-
"builder-symbol",
|
|
1957
|
-
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1958
|
-
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1959
|
-
].filter(Boolean).join(" "),
|
|
1960
|
-
contentToUse: props.symbol?.content
|
|
1961
|
-
});
|
|
1962
|
-
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1963
|
-
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1964
|
-
fetchContent(props2, state2, builderContext2);
|
|
1965
|
-
}, "Symbol_component_useVisibleTask_oMPs8W5ZhwE", [
|
|
1966
|
-
builderContext$1,
|
|
1967
|
-
props,
|
|
1968
|
-
state
|
|
1969
|
-
]));
|
|
1970
|
-
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
1971
|
-
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1972
|
-
track2(() => props2.symbol);
|
|
1973
|
-
fetchContent(props2, state2, builderContext2);
|
|
1974
|
-
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1975
|
-
builderContext$1,
|
|
1976
|
-
props,
|
|
1977
|
-
state
|
|
1978
|
-
]));
|
|
1979
|
-
return /* @__PURE__ */ _jsxS("div", {
|
|
1980
|
-
...props.attributes,
|
|
1981
|
-
children: /* @__PURE__ */ _jsxC(RenderContent, {
|
|
1982
|
-
get apiVersion() {
|
|
1983
|
-
return builderContext$1.apiVersion;
|
|
1984
|
-
},
|
|
1985
|
-
get apiKey() {
|
|
1986
|
-
return builderContext$1.apiKey;
|
|
1987
|
-
},
|
|
1988
|
-
get context() {
|
|
1989
|
-
return builderContext$1.context;
|
|
1990
|
-
},
|
|
1991
|
-
get customComponents() {
|
|
1992
|
-
return Object.values(builderContext$1.registeredComponents);
|
|
1993
|
-
},
|
|
1994
|
-
get data() {
|
|
1995
|
-
return {
|
|
1996
|
-
...props.symbol?.data,
|
|
1997
|
-
...builderContext$1.localState,
|
|
1998
|
-
...state.contentToUse?.data?.state
|
|
1999
|
-
};
|
|
2000
|
-
},
|
|
2001
|
-
get model() {
|
|
2002
|
-
return props.symbol?.model;
|
|
2003
|
-
},
|
|
2004
|
-
get content() {
|
|
2005
|
-
return state.contentToUse;
|
|
2006
|
-
},
|
|
2007
|
-
[_IMMUTABLE]: {
|
|
2008
|
-
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
2009
|
-
builderContext$1
|
|
2010
|
-
], "p0.apiVersion"),
|
|
2011
|
-
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
2012
|
-
builderContext$1
|
|
2013
|
-
], "p0.apiKey"),
|
|
2014
|
-
context: _fnSignal((p0) => p0.context, [
|
|
2015
|
-
builderContext$1
|
|
2016
|
-
], "p0.context"),
|
|
2017
|
-
customComponents: _fnSignal((p0) => Object.values(p0.registeredComponents), [
|
|
2018
|
-
builderContext$1
|
|
2019
|
-
], "Object.values(p0.registeredComponents)"),
|
|
2020
|
-
data: _fnSignal((p0, p1, p2) => ({
|
|
2021
|
-
...p1.symbol?.data,
|
|
2022
|
-
...p0.localState,
|
|
2023
|
-
...p2.contentToUse?.data?.state
|
|
2024
|
-
}), [
|
|
2025
|
-
builderContext$1,
|
|
2026
|
-
props,
|
|
2027
|
-
state
|
|
2028
|
-
], "{...p1.symbol?.data,...p0.localState,...p2.contentToUse?.data?.state}"),
|
|
2029
|
-
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
2030
|
-
props
|
|
2031
|
-
], "p0.symbol?.model"),
|
|
2032
|
-
content: _fnSignal((p0) => p0.contentToUse, [
|
|
2033
|
-
state
|
|
2034
|
-
], "p0.contentToUse")
|
|
2035
|
-
}
|
|
2036
|
-
}, 3, "Wt_0")
|
|
2037
|
-
}, {
|
|
2038
|
-
class: _fnSignal((p0) => p0.className, [
|
|
2039
|
-
state
|
|
2040
|
-
], "p0.className")
|
|
2041
|
-
}, 0, "Wt_1");
|
|
2042
|
-
}, "Symbol_component_WVvggdkUPdk"));
|
|
2043
|
-
const componentInfo$4 = {
|
|
2044
|
-
name: "Text",
|
|
2045
|
-
static: true,
|
|
2046
|
-
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",
|
|
2047
|
-
inputs: [
|
|
2048
|
-
{
|
|
2049
|
-
name: "text",
|
|
2050
|
-
type: "html",
|
|
2051
|
-
required: true,
|
|
2052
|
-
autoFocus: true,
|
|
2053
|
-
bubble: true,
|
|
2054
|
-
defaultValue: "Enter some text..."
|
|
2055
|
-
}
|
|
2056
|
-
],
|
|
2057
|
-
defaultStyles: {
|
|
2058
|
-
lineHeight: "normal",
|
|
2059
|
-
height: "auto",
|
|
2060
|
-
textAlign: "center"
|
|
2061
|
-
}
|
|
2062
|
-
};
|
|
2063
|
-
const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2064
|
-
return /* @__PURE__ */ _jsxQ("span", {
|
|
2065
|
-
style: {
|
|
2066
|
-
outline: "none"
|
|
1649
|
+
const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1650
|
+
return /* @__PURE__ */ _jsxQ("span", {
|
|
1651
|
+
style: {
|
|
1652
|
+
outline: "none"
|
|
2067
1653
|
}
|
|
2068
1654
|
}, {
|
|
2069
1655
|
class: "builder-text",
|
|
@@ -2454,52 +2040,383 @@ const componentInfo = {
|
|
|
2454
2040
|
}
|
|
2455
2041
|
]
|
|
2456
2042
|
};
|
|
2457
|
-
const getDefaultRegisteredComponents = () => [
|
|
2458
|
-
{
|
|
2459
|
-
component: Button,
|
|
2460
|
-
...componentInfo$a
|
|
2461
|
-
},
|
|
2462
|
-
{
|
|
2463
|
-
component: Columns,
|
|
2464
|
-
...componentInfo$9
|
|
2465
|
-
},
|
|
2466
|
-
{
|
|
2467
|
-
component: CustomCode,
|
|
2468
|
-
...componentInfo
|
|
2469
|
-
},
|
|
2470
|
-
{
|
|
2471
|
-
component: Embed,
|
|
2472
|
-
...componentInfo$2
|
|
2473
|
-
},
|
|
2474
|
-
{
|
|
2475
|
-
component: FragmentComponent,
|
|
2476
|
-
...componentInfo$8
|
|
2477
|
-
},
|
|
2478
|
-
{
|
|
2479
|
-
component: Image,
|
|
2480
|
-
...componentInfo$7
|
|
2481
|
-
},
|
|
2482
|
-
{
|
|
2483
|
-
component: ImgComponent,
|
|
2484
|
-
...componentInfo$1
|
|
2485
|
-
},
|
|
2486
|
-
{
|
|
2487
|
-
component: SectionComponent,
|
|
2488
|
-
...componentInfo$6
|
|
2489
|
-
},
|
|
2490
|
-
{
|
|
2491
|
-
component: Symbol$1,
|
|
2492
|
-
...componentInfo$5
|
|
2493
|
-
},
|
|
2494
|
-
{
|
|
2495
|
-
component: Text,
|
|
2496
|
-
...componentInfo$4
|
|
2497
|
-
},
|
|
2498
|
-
{
|
|
2499
|
-
component: Video,
|
|
2500
|
-
...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;
|
|
2501
2418
|
}
|
|
2502
|
-
|
|
2419
|
+
}
|
|
2503
2420
|
function isPreviewing() {
|
|
2504
2421
|
if (!isBrowser())
|
|
2505
2422
|
return false;
|
|
@@ -2508,14 +2425,6 @@ function isPreviewing() {
|
|
|
2508
2425
|
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2509
2426
|
}
|
|
2510
2427
|
const components = [];
|
|
2511
|
-
function registerComponent(component, info) {
|
|
2512
|
-
components.push({
|
|
2513
|
-
component,
|
|
2514
|
-
...info
|
|
2515
|
-
});
|
|
2516
|
-
console.warn("registerComponent is deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.");
|
|
2517
|
-
return component;
|
|
2518
|
-
}
|
|
2519
2428
|
const createRegisterComponentMessage = ({ component: _, ...info }) => ({
|
|
2520
2429
|
type: "builder.registerComponent",
|
|
2521
2430
|
data: prepareComponentInfoToSend(info)
|
|
@@ -2760,7 +2669,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
2760
2669
|
}
|
|
2761
2670
|
};
|
|
2762
2671
|
};
|
|
2763
|
-
const SDK_VERSION = "0.
|
|
2672
|
+
const SDK_VERSION = "0.4.1";
|
|
2764
2673
|
const registry = {};
|
|
2765
2674
|
function register(type, info) {
|
|
2766
2675
|
let typeList = registry[type];
|
|
@@ -2888,6 +2797,128 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
2888
2797
|
});
|
|
2889
2798
|
}
|
|
2890
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
|
+
};
|
|
2891
2922
|
const getCssFromFont = (font) => {
|
|
2892
2923
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
2893
2924
|
const name = family.split(",")[0];
|
|
@@ -2953,7 +2984,7 @@ ${getFontCss({
|
|
|
2953
2984
|
text-align: inherit;
|
|
2954
2985
|
font-family: inherit;
|
|
2955
2986
|
}
|
|
2956
|
-
|
|
2987
|
+
`.trim()
|
|
2957
2988
|
});
|
|
2958
2989
|
return /* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
2959
2990
|
get styles() {
|
|
@@ -3126,9 +3157,12 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3126
3157
|
...getDefaultRegisteredComponents(),
|
|
3127
3158
|
...components,
|
|
3128
3159
|
...props.customComponents || []
|
|
3129
|
-
].reduce((acc, curr) => ({
|
|
3160
|
+
].reduce((acc, { component, ...curr }) => ({
|
|
3130
3161
|
...acc,
|
|
3131
|
-
[curr.name]:
|
|
3162
|
+
[curr.name]: {
|
|
3163
|
+
component,
|
|
3164
|
+
...curr
|
|
3165
|
+
}
|
|
3132
3166
|
}), {}),
|
|
3133
3167
|
canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
|
|
3134
3168
|
clicked: false,
|
|
@@ -3140,6 +3174,10 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3140
3174
|
forceReRenderCount: 0,
|
|
3141
3175
|
httpReqsData: {},
|
|
3142
3176
|
overrideContent: null,
|
|
3177
|
+
scriptStr: getRenderContentScriptString({
|
|
3178
|
+
contentId: props.content?.id,
|
|
3179
|
+
parentContentId: props.parentContentId
|
|
3180
|
+
}),
|
|
3143
3181
|
update: 0,
|
|
3144
3182
|
useContent: getContentInitialValue({
|
|
3145
3183
|
content: props.content,
|
|
@@ -3148,7 +3186,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3148
3186
|
}, {
|
|
3149
3187
|
deep: true
|
|
3150
3188
|
});
|
|
3151
|
-
useContextProvider(
|
|
3189
|
+
useContextProvider(BuilderContext, useStore({
|
|
3152
3190
|
content: state.useContent,
|
|
3153
3191
|
localState: void 0,
|
|
3154
3192
|
rootState: state.contentState,
|
|
@@ -3173,6 +3211,9 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3173
3211
|
} : {},
|
|
3174
3212
|
...props2.includeRefs ? {
|
|
3175
3213
|
includeRefs: props2.includeRefs
|
|
3214
|
+
} : {},
|
|
3215
|
+
...props2.enrich ? {
|
|
3216
|
+
enrich: props2.enrich
|
|
3176
3217
|
} : {}
|
|
3177
3218
|
});
|
|
3178
3219
|
Object.values(state2.allRegisteredComponents).forEach((registeredComponent) => {
|
|
@@ -3256,15 +3297,52 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3256
3297
|
state
|
|
3257
3298
|
]));
|
|
3258
3299
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3259
|
-
children: state.useContent ? /* @__PURE__ */
|
|
3260
|
-
ref: elementRef
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
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
|
+
],
|
|
3268
3346
|
onClick$: /* @__PURE__ */ inlinedQrl((event) => {
|
|
3269
3347
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3270
3348
|
return onClick(props2, state2, elementRef2, event);
|
|
@@ -3273,42 +3351,285 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3273
3351
|
props,
|
|
3274
3352
|
state
|
|
3275
3353
|
])
|
|
3276
|
-
},
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
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;
|
|
3280
3575
|
},
|
|
3281
|
-
get
|
|
3282
|
-
return state.
|
|
3576
|
+
get content() {
|
|
3577
|
+
return state.contentToRender;
|
|
3283
3578
|
},
|
|
3284
|
-
get
|
|
3285
|
-
return
|
|
3579
|
+
get apiKey() {
|
|
3580
|
+
return props.apiKey;
|
|
3286
3581
|
},
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
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;
|
|
3302
3599
|
},
|
|
3303
3600
|
[_IMMUTABLE]: {
|
|
3304
|
-
|
|
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, [
|
|
3305
3626
|
state
|
|
3306
|
-
], "p0.
|
|
3627
|
+
], "p0.shouldRenderVariants")
|
|
3307
3628
|
}
|
|
3308
|
-
}, 3,
|
|
3309
|
-
]
|
|
3310
|
-
}, 1, "
|
|
3311
|
-
}, "
|
|
3629
|
+
}, 3, "Bz_2")
|
|
3630
|
+
]
|
|
3631
|
+
}, 1, "Bz_3");
|
|
3632
|
+
}, "RenderContentVariants_component_OMvvre8Ofjw"));
|
|
3312
3633
|
const settings = {};
|
|
3313
3634
|
function setEditorSettings(newSettings) {
|
|
3314
3635
|
if (isBrowser()) {
|
|
@@ -3326,23 +3647,19 @@ export {
|
|
|
3326
3647
|
FragmentComponent as Fragment,
|
|
3327
3648
|
Image,
|
|
3328
3649
|
RenderBlocks,
|
|
3329
|
-
RenderContent,
|
|
3650
|
+
RenderContentVariants as RenderContent,
|
|
3330
3651
|
SectionComponent as Section,
|
|
3331
3652
|
Symbol$1 as Symbol,
|
|
3332
3653
|
Text,
|
|
3333
3654
|
Video,
|
|
3334
|
-
components,
|
|
3335
|
-
convertSearchParamsToQueryObject,
|
|
3336
3655
|
createRegisterComponentMessage,
|
|
3337
3656
|
getAllContent,
|
|
3338
3657
|
getBuilderSearchParams,
|
|
3339
|
-
getBuilderSearchParamsFromWindow,
|
|
3340
3658
|
getContent,
|
|
3341
3659
|
isEditing,
|
|
3342
3660
|
isPreviewing,
|
|
3343
|
-
|
|
3661
|
+
processContentResult,
|
|
3344
3662
|
register,
|
|
3345
|
-
registerComponent,
|
|
3346
3663
|
setEditorSettings,
|
|
3347
3664
|
track
|
|
3348
3665
|
};
|