@builder.io/sdk-solid 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/lib/browser/dev.js +103 -147
- package/lib/browser/dev.jsx +118 -176
- package/lib/browser/index.js +103 -147
- package/lib/browser/index.jsx +118 -176
- package/lib/edge/dev.js +103 -147
- package/lib/edge/dev.jsx +118 -176
- package/lib/edge/index.js +103 -147
- package/lib/edge/index.jsx +118 -176
- package/lib/node/dev.js +103 -147
- package/lib/node/dev.jsx +118 -176
- package/lib/node/index.js +103 -147
- package/lib/node/index.jsx +118 -176
- package/package.json +8 -1
package/lib/browser/index.js
CHANGED
|
@@ -931,7 +931,7 @@ function Block(props) {
|
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
933
|
function processedBlock() {
|
|
934
|
-
return
|
|
934
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
935
935
|
block: props.block,
|
|
936
936
|
localState: props.context.localState,
|
|
937
937
|
rootState: props.context.rootState,
|
|
@@ -950,6 +950,9 @@ function Block(props) {
|
|
|
950
950
|
if ("show" in processedBlock()) {
|
|
951
951
|
return processedBlock().show;
|
|
952
952
|
}
|
|
953
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
954
|
+
return false;
|
|
955
|
+
}
|
|
953
956
|
return true;
|
|
954
957
|
}
|
|
955
958
|
function childrenWithoutParentComponent() {
|
|
@@ -2625,7 +2628,9 @@ var componentInfo11 = {
|
|
|
2625
2628
|
advanced: true
|
|
2626
2629
|
}]
|
|
2627
2630
|
};
|
|
2628
|
-
var _tmpl$13 = /* @__PURE__ */ template(`<video>`);
|
|
2631
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
2632
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
|
|
2633
|
+
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
2629
2634
|
function Video(props) {
|
|
2630
2635
|
function videoProps() {
|
|
2631
2636
|
return {
|
|
@@ -2648,13 +2653,13 @@ function Video(props) {
|
|
|
2648
2653
|
}
|
|
2649
2654
|
function spreadProps() {
|
|
2650
2655
|
return {
|
|
2651
|
-
...props.attributes,
|
|
2652
2656
|
...videoProps()
|
|
2653
2657
|
};
|
|
2654
2658
|
}
|
|
2655
2659
|
return (() => {
|
|
2656
|
-
const _el$ = _tmpl$
|
|
2657
|
-
|
|
2660
|
+
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
2661
|
+
_el$.style.setProperty("position", "relative");
|
|
2662
|
+
spread(_el$2, mergeProps(spreadProps, {
|
|
2658
2663
|
get preload() {
|
|
2659
2664
|
return props.preload || "metadata";
|
|
2660
2665
|
},
|
|
@@ -2667,7 +2672,11 @@ function Video(props) {
|
|
|
2667
2672
|
"object-position": props.position,
|
|
2668
2673
|
// Hack to get object fit to work as expected and
|
|
2669
2674
|
// not have the video overflow
|
|
2670
|
-
"
|
|
2675
|
+
"z-index": 2,
|
|
2676
|
+
"border-radius": "1px",
|
|
2677
|
+
...props.aspectRatio ? {
|
|
2678
|
+
position: "absolute"
|
|
2679
|
+
} : null
|
|
2671
2680
|
};
|
|
2672
2681
|
},
|
|
2673
2682
|
get src() {
|
|
@@ -2676,7 +2685,62 @@ function Video(props) {
|
|
|
2676
2685
|
get poster() {
|
|
2677
2686
|
return props.posterImage;
|
|
2678
2687
|
}
|
|
2679
|
-
}), false,
|
|
2688
|
+
}), false, true);
|
|
2689
|
+
insert(_el$2, createComponent(Show, {
|
|
2690
|
+
get when() {
|
|
2691
|
+
return !props.lazyLoad;
|
|
2692
|
+
},
|
|
2693
|
+
get children() {
|
|
2694
|
+
const _el$3 = _tmpl$13();
|
|
2695
|
+
effect(() => setAttribute(_el$3, "src", props.video));
|
|
2696
|
+
return _el$3;
|
|
2697
|
+
}
|
|
2698
|
+
}));
|
|
2699
|
+
insert(_el$, createComponent(Show, {
|
|
2700
|
+
get when() {
|
|
2701
|
+
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
2702
|
+
},
|
|
2703
|
+
get children() {
|
|
2704
|
+
const _el$4 = _tmpl$23();
|
|
2705
|
+
_el$4.style.setProperty("width", "100%");
|
|
2706
|
+
_el$4.style.setProperty("pointer-events", "none");
|
|
2707
|
+
_el$4.style.setProperty("font-size", "0px");
|
|
2708
|
+
effect(() => props.aspectRatio * 100 + "%" != null ? _el$4.style.setProperty("padding-top", props.aspectRatio * 100 + "%") : _el$4.style.removeProperty("padding-top"));
|
|
2709
|
+
return _el$4;
|
|
2710
|
+
}
|
|
2711
|
+
}), null);
|
|
2712
|
+
insert(_el$, createComponent(Show, {
|
|
2713
|
+
get when() {
|
|
2714
|
+
return props.builderBlock?.children?.length && props.fitContent;
|
|
2715
|
+
},
|
|
2716
|
+
get children() {
|
|
2717
|
+
const _el$5 = _tmpl$23();
|
|
2718
|
+
_el$5.style.setProperty("display", "flex");
|
|
2719
|
+
_el$5.style.setProperty("flex-direction", "column");
|
|
2720
|
+
_el$5.style.setProperty("align-items", "stretch");
|
|
2721
|
+
insert(_el$5, () => props.children);
|
|
2722
|
+
return _el$5;
|
|
2723
|
+
}
|
|
2724
|
+
}), null);
|
|
2725
|
+
insert(_el$, createComponent(Show, {
|
|
2726
|
+
get when() {
|
|
2727
|
+
return props.builderBlock?.children?.length && !props.fitContent;
|
|
2728
|
+
},
|
|
2729
|
+
get children() {
|
|
2730
|
+
const _el$6 = _tmpl$23();
|
|
2731
|
+
_el$6.style.setProperty("pointer-events", "none");
|
|
2732
|
+
_el$6.style.setProperty("display", "flex");
|
|
2733
|
+
_el$6.style.setProperty("flex-direction", "column");
|
|
2734
|
+
_el$6.style.setProperty("align-items", "stretch");
|
|
2735
|
+
_el$6.style.setProperty("position", "absolute");
|
|
2736
|
+
_el$6.style.setProperty("top", "0");
|
|
2737
|
+
_el$6.style.setProperty("left", "0");
|
|
2738
|
+
_el$6.style.setProperty("width", "100%");
|
|
2739
|
+
_el$6.style.setProperty("height", "100%");
|
|
2740
|
+
insert(_el$6, () => props.children);
|
|
2741
|
+
return _el$6;
|
|
2742
|
+
}
|
|
2743
|
+
}), null);
|
|
2680
2744
|
return _el$;
|
|
2681
2745
|
})();
|
|
2682
2746
|
}
|
|
@@ -2741,13 +2805,19 @@ var serializeComponentInfo = ({
|
|
|
2741
2805
|
}), {}))
|
|
2742
2806
|
});
|
|
2743
2807
|
|
|
2808
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2809
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
2810
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
|
|
2811
|
+
|
|
2744
2812
|
// src/components/content-variants/helpers.ts
|
|
2813
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2814
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2745
2815
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2746
2816
|
...variant,
|
|
2747
2817
|
testVariationId: variant.id,
|
|
2748
2818
|
id: content?.id
|
|
2749
2819
|
}));
|
|
2750
|
-
var
|
|
2820
|
+
var checkShouldRenderVariants = ({
|
|
2751
2821
|
canTrack,
|
|
2752
2822
|
content
|
|
2753
2823
|
}) => {
|
|
@@ -2758,139 +2828,34 @@ var checkShouldRunVariants = ({
|
|
|
2758
2828
|
return false;
|
|
2759
2829
|
if (!canTrack)
|
|
2760
2830
|
return false;
|
|
2761
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2831
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2762
2832
|
return true;
|
|
2763
2833
|
if (isBrowser())
|
|
2764
2834
|
return false;
|
|
2765
2835
|
return true;
|
|
2766
2836
|
};
|
|
2767
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2768
|
-
function getAndSetVariantId2() {
|
|
2769
|
-
function setCookie2(name, value, days) {
|
|
2770
|
-
let expires = "";
|
|
2771
|
-
if (days) {
|
|
2772
|
-
const date = /* @__PURE__ */ new Date();
|
|
2773
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2774
|
-
expires = "; expires=" + date.toUTCString();
|
|
2775
|
-
}
|
|
2776
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2777
|
-
}
|
|
2778
|
-
function getCookie2(name) {
|
|
2779
|
-
const nameEQ = name + "=";
|
|
2780
|
-
const ca = document.cookie.split(";");
|
|
2781
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2782
|
-
let c = ca[i];
|
|
2783
|
-
while (c.charAt(0) === " ")
|
|
2784
|
-
c = c.substring(1, c.length);
|
|
2785
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2786
|
-
return c.substring(nameEQ.length, c.length);
|
|
2787
|
-
}
|
|
2788
|
-
return null;
|
|
2789
|
-
}
|
|
2790
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2791
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2792
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2793
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2794
|
-
return variantInCookie;
|
|
2795
|
-
}
|
|
2796
|
-
let n = 0;
|
|
2797
|
-
const random = Math.random();
|
|
2798
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2799
|
-
const variant = variants[i];
|
|
2800
|
-
const testRatio = variant.testRatio;
|
|
2801
|
-
n += testRatio;
|
|
2802
|
-
if (random < n) {
|
|
2803
|
-
setCookie2(cookieName, variant.id);
|
|
2804
|
-
return variant.id;
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
setCookie2(cookieName, contentId);
|
|
2808
|
-
return contentId;
|
|
2809
|
-
}
|
|
2810
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2811
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2812
|
-
if (isHydrationTarget2) {
|
|
2813
|
-
styleEl.remove();
|
|
2814
|
-
const thisScriptEl = document.currentScript;
|
|
2815
|
-
thisScriptEl?.remove();
|
|
2816
|
-
} else {
|
|
2817
|
-
const newStyleStr = variants.concat({
|
|
2818
|
-
id: contentId
|
|
2819
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2820
|
-
return `.variant-${value.id} { display: none; }
|
|
2821
|
-
`;
|
|
2822
|
-
}).join("");
|
|
2823
|
-
styleEl.innerHTML = newStyleStr;
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2827
|
-
if (!navigator.cookieEnabled) {
|
|
2828
|
-
return;
|
|
2829
|
-
}
|
|
2830
|
-
function getCookie2(name) {
|
|
2831
|
-
const nameEQ = name + "=";
|
|
2832
|
-
const ca = document.cookie.split(";");
|
|
2833
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2834
|
-
let c = ca[i];
|
|
2835
|
-
while (c.charAt(0) === " ")
|
|
2836
|
-
c = c.substring(1, c.length);
|
|
2837
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2838
|
-
return c.substring(nameEQ.length, c.length);
|
|
2839
|
-
}
|
|
2840
|
-
return null;
|
|
2841
|
-
}
|
|
2842
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2843
|
-
const variantId = getCookie2(cookieName);
|
|
2844
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2845
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2846
|
-
if (variantId === variantContentId) {
|
|
2847
|
-
if (variantIsDefaultContent) {
|
|
2848
|
-
return;
|
|
2849
|
-
}
|
|
2850
|
-
parentDiv?.removeAttribute("hidden");
|
|
2851
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2852
|
-
} else {
|
|
2853
|
-
if (variantIsDefaultContent) {
|
|
2854
|
-
if (isHydrationTarget2) {
|
|
2855
|
-
parentDiv?.remove();
|
|
2856
|
-
} else {
|
|
2857
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2858
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2859
|
-
}
|
|
2860
|
-
}
|
|
2861
|
-
return;
|
|
2862
|
-
}
|
|
2863
|
-
return;
|
|
2864
|
-
}
|
|
2865
2837
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2866
2838
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2867
|
-
var
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2871
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2872
|
-
return `
|
|
2873
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2874
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2839
|
+
var getScriptString = () => `
|
|
2840
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2841
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2875
2842
|
`;
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
var getRenderContentScriptString = ({
|
|
2843
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2844
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2845
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2846
|
+
)`;
|
|
2847
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2882
2848
|
contentId,
|
|
2883
2849
|
variationId
|
|
2884
|
-
}) => {
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
};
|
|
2850
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2851
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2852
|
+
)`;
|
|
2888
2853
|
var _tmpl$14 = /* @__PURE__ */ template(`<script>`);
|
|
2889
2854
|
function InlinedScript(props) {
|
|
2890
2855
|
return (() => {
|
|
2891
2856
|
const _el$ = _tmpl$14();
|
|
2892
2857
|
effect((_p$) => {
|
|
2893
|
-
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
2858
|
+
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
2894
2859
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
2895
2860
|
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
2896
2861
|
return _p$;
|
|
@@ -3383,7 +3348,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3383
3348
|
};
|
|
3384
3349
|
|
|
3385
3350
|
// src/constants/sdk-version.ts
|
|
3386
|
-
var SDK_VERSION = "0.7.
|
|
3351
|
+
var SDK_VERSION = "0.7.5";
|
|
3387
3352
|
|
|
3388
3353
|
// src/functions/register.ts
|
|
3389
3354
|
var registry = {};
|
|
@@ -3757,7 +3722,7 @@ function EnableEditor(props) {
|
|
|
3757
3722
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3758
3723
|
spread(_el$, mergeProps({
|
|
3759
3724
|
get ["class"]() {
|
|
3760
|
-
return props.
|
|
3725
|
+
return `variant-${props.content?.testVariationId || props.content?.id}`;
|
|
3761
3726
|
}
|
|
3762
3727
|
}, {}, {
|
|
3763
3728
|
get key() {
|
|
@@ -3877,22 +3842,20 @@ var getContextStateInitialValue = ({
|
|
|
3877
3842
|
locale
|
|
3878
3843
|
}) => {
|
|
3879
3844
|
const defaultValues = {};
|
|
3845
|
+
const initialState = content?.data?.state || {};
|
|
3880
3846
|
content?.data?.inputs?.forEach((input) => {
|
|
3881
|
-
if (input.name && input.defaultValue !== void 0
|
|
3847
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
3882
3848
|
defaultValues[input.name] = input.defaultValue;
|
|
3883
3849
|
}
|
|
3884
3850
|
});
|
|
3885
|
-
|
|
3886
|
-
...
|
|
3851
|
+
return {
|
|
3852
|
+
...defaultValues,
|
|
3853
|
+
...initialState,
|
|
3887
3854
|
...data,
|
|
3888
3855
|
...locale ? {
|
|
3889
3856
|
locale
|
|
3890
3857
|
} : {}
|
|
3891
3858
|
};
|
|
3892
|
-
return {
|
|
3893
|
-
...defaultValues,
|
|
3894
|
-
...stateToUse
|
|
3895
|
-
};
|
|
3896
3859
|
};
|
|
3897
3860
|
var getContentInitialValue = ({
|
|
3898
3861
|
content,
|
|
@@ -3910,7 +3873,7 @@ var getContentInitialValue = ({
|
|
|
3910
3873
|
|
|
3911
3874
|
// src/components/content/content.tsx
|
|
3912
3875
|
function ContentComponent(props) {
|
|
3913
|
-
const [scriptStr, setScriptStr] = createSignal(
|
|
3876
|
+
const [scriptStr, setScriptStr] = createSignal(getUpdateVariantVisibilityScript({
|
|
3914
3877
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3915
3878
|
variationId: props.content?.testVariationId,
|
|
3916
3879
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
@@ -4006,9 +3969,6 @@ function ContentComponent(props) {
|
|
|
4006
3969
|
get enrich() {
|
|
4007
3970
|
return props.enrich;
|
|
4008
3971
|
},
|
|
4009
|
-
get classNameProp() {
|
|
4010
|
-
return props.classNameProp;
|
|
4011
|
-
},
|
|
4012
3972
|
get showContent() {
|
|
4013
3973
|
return props.showContent;
|
|
4014
3974
|
},
|
|
@@ -4065,12 +4025,12 @@ var content_default = ContentComponent;
|
|
|
4065
4025
|
|
|
4066
4026
|
// src/components/content-variants/content-variants.tsx
|
|
4067
4027
|
function ContentVariants(props) {
|
|
4068
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
4028
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants({
|
|
4069
4029
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4070
4030
|
content: props.content
|
|
4071
4031
|
}));
|
|
4072
|
-
function
|
|
4073
|
-
return
|
|
4032
|
+
function updateCookieAndStylesScriptStr() {
|
|
4033
|
+
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
4074
4034
|
id: value.testVariationId,
|
|
4075
4035
|
testRatio: value.testRatio
|
|
4076
4036
|
})), props.content?.id || "");
|
|
@@ -4115,7 +4075,7 @@ function ContentVariants(props) {
|
|
|
4115
4075
|
}
|
|
4116
4076
|
}), createComponent(inlined_script_default, {
|
|
4117
4077
|
get scriptStr() {
|
|
4118
|
-
return
|
|
4078
|
+
return updateCookieAndStylesScriptStr();
|
|
4119
4079
|
}
|
|
4120
4080
|
}), createComponent(For, {
|
|
4121
4081
|
get each() {
|
|
@@ -4129,7 +4089,6 @@ function ContentVariants(props) {
|
|
|
4129
4089
|
},
|
|
4130
4090
|
content: variant,
|
|
4131
4091
|
showContent: false,
|
|
4132
|
-
classNameProp: void 0,
|
|
4133
4092
|
get model() {
|
|
4134
4093
|
return props.model;
|
|
4135
4094
|
},
|
|
@@ -4171,9 +4130,6 @@ function ContentVariants(props) {
|
|
|
4171
4130
|
get content() {
|
|
4172
4131
|
return defaultContent();
|
|
4173
4132
|
},
|
|
4174
|
-
get classNameProp() {
|
|
4175
|
-
return `variant-${props.content?.id}`;
|
|
4176
|
-
},
|
|
4177
4133
|
showContent: true,
|
|
4178
4134
|
get model() {
|
|
4179
4135
|
return props.model;
|