@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/node/index.js
CHANGED
|
@@ -1049,7 +1049,7 @@ function Block(props) {
|
|
|
1049
1049
|
});
|
|
1050
1050
|
}
|
|
1051
1051
|
function processedBlock() {
|
|
1052
|
-
return
|
|
1052
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1053
1053
|
block: props.block,
|
|
1054
1054
|
localState: props.context.localState,
|
|
1055
1055
|
rootState: props.context.rootState,
|
|
@@ -1068,6 +1068,9 @@ function Block(props) {
|
|
|
1068
1068
|
if ("show" in processedBlock()) {
|
|
1069
1069
|
return processedBlock().show;
|
|
1070
1070
|
}
|
|
1071
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
1072
|
+
return false;
|
|
1073
|
+
}
|
|
1071
1074
|
return true;
|
|
1072
1075
|
}
|
|
1073
1076
|
function childrenWithoutParentComponent() {
|
|
@@ -2743,7 +2746,9 @@ var componentInfo11 = {
|
|
|
2743
2746
|
advanced: true
|
|
2744
2747
|
}]
|
|
2745
2748
|
};
|
|
2746
|
-
var _tmpl$13 = /* @__PURE__ */ template(`<video>`);
|
|
2749
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
2750
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
|
|
2751
|
+
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
2747
2752
|
function Video(props) {
|
|
2748
2753
|
function videoProps() {
|
|
2749
2754
|
return {
|
|
@@ -2766,13 +2771,13 @@ function Video(props) {
|
|
|
2766
2771
|
}
|
|
2767
2772
|
function spreadProps() {
|
|
2768
2773
|
return {
|
|
2769
|
-
...props.attributes,
|
|
2770
2774
|
...videoProps()
|
|
2771
2775
|
};
|
|
2772
2776
|
}
|
|
2773
2777
|
return (() => {
|
|
2774
|
-
const _el$ = _tmpl$
|
|
2775
|
-
|
|
2778
|
+
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
2779
|
+
_el$.style.setProperty("position", "relative");
|
|
2780
|
+
spread(_el$2, mergeProps(spreadProps, {
|
|
2776
2781
|
get preload() {
|
|
2777
2782
|
return props.preload || "metadata";
|
|
2778
2783
|
},
|
|
@@ -2785,7 +2790,11 @@ function Video(props) {
|
|
|
2785
2790
|
"object-position": props.position,
|
|
2786
2791
|
// Hack to get object fit to work as expected and
|
|
2787
2792
|
// not have the video overflow
|
|
2788
|
-
"
|
|
2793
|
+
"z-index": 2,
|
|
2794
|
+
"border-radius": "1px",
|
|
2795
|
+
...props.aspectRatio ? {
|
|
2796
|
+
position: "absolute"
|
|
2797
|
+
} : null
|
|
2789
2798
|
};
|
|
2790
2799
|
},
|
|
2791
2800
|
get src() {
|
|
@@ -2794,7 +2803,62 @@ function Video(props) {
|
|
|
2794
2803
|
get poster() {
|
|
2795
2804
|
return props.posterImage;
|
|
2796
2805
|
}
|
|
2797
|
-
}), false,
|
|
2806
|
+
}), false, true);
|
|
2807
|
+
insert(_el$2, createComponent(Show, {
|
|
2808
|
+
get when() {
|
|
2809
|
+
return !props.lazyLoad;
|
|
2810
|
+
},
|
|
2811
|
+
get children() {
|
|
2812
|
+
const _el$3 = _tmpl$13();
|
|
2813
|
+
effect(() => setAttribute(_el$3, "src", props.video));
|
|
2814
|
+
return _el$3;
|
|
2815
|
+
}
|
|
2816
|
+
}));
|
|
2817
|
+
insert(_el$, createComponent(Show, {
|
|
2818
|
+
get when() {
|
|
2819
|
+
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
2820
|
+
},
|
|
2821
|
+
get children() {
|
|
2822
|
+
const _el$4 = _tmpl$23();
|
|
2823
|
+
_el$4.style.setProperty("width", "100%");
|
|
2824
|
+
_el$4.style.setProperty("pointer-events", "none");
|
|
2825
|
+
_el$4.style.setProperty("font-size", "0px");
|
|
2826
|
+
effect(() => props.aspectRatio * 100 + "%" != null ? _el$4.style.setProperty("padding-top", props.aspectRatio * 100 + "%") : _el$4.style.removeProperty("padding-top"));
|
|
2827
|
+
return _el$4;
|
|
2828
|
+
}
|
|
2829
|
+
}), null);
|
|
2830
|
+
insert(_el$, createComponent(Show, {
|
|
2831
|
+
get when() {
|
|
2832
|
+
return props.builderBlock?.children?.length && props.fitContent;
|
|
2833
|
+
},
|
|
2834
|
+
get children() {
|
|
2835
|
+
const _el$5 = _tmpl$23();
|
|
2836
|
+
_el$5.style.setProperty("display", "flex");
|
|
2837
|
+
_el$5.style.setProperty("flex-direction", "column");
|
|
2838
|
+
_el$5.style.setProperty("align-items", "stretch");
|
|
2839
|
+
insert(_el$5, () => props.children);
|
|
2840
|
+
return _el$5;
|
|
2841
|
+
}
|
|
2842
|
+
}), null);
|
|
2843
|
+
insert(_el$, createComponent(Show, {
|
|
2844
|
+
get when() {
|
|
2845
|
+
return props.builderBlock?.children?.length && !props.fitContent;
|
|
2846
|
+
},
|
|
2847
|
+
get children() {
|
|
2848
|
+
const _el$6 = _tmpl$23();
|
|
2849
|
+
_el$6.style.setProperty("pointer-events", "none");
|
|
2850
|
+
_el$6.style.setProperty("display", "flex");
|
|
2851
|
+
_el$6.style.setProperty("flex-direction", "column");
|
|
2852
|
+
_el$6.style.setProperty("align-items", "stretch");
|
|
2853
|
+
_el$6.style.setProperty("position", "absolute");
|
|
2854
|
+
_el$6.style.setProperty("top", "0");
|
|
2855
|
+
_el$6.style.setProperty("left", "0");
|
|
2856
|
+
_el$6.style.setProperty("width", "100%");
|
|
2857
|
+
_el$6.style.setProperty("height", "100%");
|
|
2858
|
+
insert(_el$6, () => props.children);
|
|
2859
|
+
return _el$6;
|
|
2860
|
+
}
|
|
2861
|
+
}), null);
|
|
2798
2862
|
return _el$;
|
|
2799
2863
|
})();
|
|
2800
2864
|
}
|
|
@@ -2859,13 +2923,19 @@ var serializeComponentInfo = ({
|
|
|
2859
2923
|
}), {}))
|
|
2860
2924
|
});
|
|
2861
2925
|
|
|
2926
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2927
|
+
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}";
|
|
2928
|
+
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}";
|
|
2929
|
+
|
|
2862
2930
|
// src/components/content-variants/helpers.ts
|
|
2931
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2932
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2863
2933
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2864
2934
|
...variant,
|
|
2865
2935
|
testVariationId: variant.id,
|
|
2866
2936
|
id: content?.id
|
|
2867
2937
|
}));
|
|
2868
|
-
var
|
|
2938
|
+
var checkShouldRenderVariants = ({
|
|
2869
2939
|
canTrack,
|
|
2870
2940
|
content
|
|
2871
2941
|
}) => {
|
|
@@ -2876,139 +2946,34 @@ var checkShouldRunVariants = ({
|
|
|
2876
2946
|
return false;
|
|
2877
2947
|
if (!canTrack)
|
|
2878
2948
|
return false;
|
|
2879
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2949
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2880
2950
|
return true;
|
|
2881
2951
|
if (isBrowser())
|
|
2882
2952
|
return false;
|
|
2883
2953
|
return true;
|
|
2884
2954
|
};
|
|
2885
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2886
|
-
function getAndSetVariantId2() {
|
|
2887
|
-
function setCookie2(name, value, days) {
|
|
2888
|
-
let expires = "";
|
|
2889
|
-
if (days) {
|
|
2890
|
-
const date = /* @__PURE__ */ new Date();
|
|
2891
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2892
|
-
expires = "; expires=" + date.toUTCString();
|
|
2893
|
-
}
|
|
2894
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2895
|
-
}
|
|
2896
|
-
function getCookie2(name) {
|
|
2897
|
-
const nameEQ = name + "=";
|
|
2898
|
-
const ca = document.cookie.split(";");
|
|
2899
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2900
|
-
let c = ca[i];
|
|
2901
|
-
while (c.charAt(0) === " ")
|
|
2902
|
-
c = c.substring(1, c.length);
|
|
2903
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2904
|
-
return c.substring(nameEQ.length, c.length);
|
|
2905
|
-
}
|
|
2906
|
-
return null;
|
|
2907
|
-
}
|
|
2908
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2909
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2910
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2911
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2912
|
-
return variantInCookie;
|
|
2913
|
-
}
|
|
2914
|
-
let n = 0;
|
|
2915
|
-
const random = Math.random();
|
|
2916
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2917
|
-
const variant = variants[i];
|
|
2918
|
-
const testRatio = variant.testRatio;
|
|
2919
|
-
n += testRatio;
|
|
2920
|
-
if (random < n) {
|
|
2921
|
-
setCookie2(cookieName, variant.id);
|
|
2922
|
-
return variant.id;
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
setCookie2(cookieName, contentId);
|
|
2926
|
-
return contentId;
|
|
2927
|
-
}
|
|
2928
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2929
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2930
|
-
if (isHydrationTarget2) {
|
|
2931
|
-
styleEl.remove();
|
|
2932
|
-
const thisScriptEl = document.currentScript;
|
|
2933
|
-
thisScriptEl?.remove();
|
|
2934
|
-
} else {
|
|
2935
|
-
const newStyleStr = variants.concat({
|
|
2936
|
-
id: contentId
|
|
2937
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2938
|
-
return `.variant-${value.id} { display: none; }
|
|
2939
|
-
`;
|
|
2940
|
-
}).join("");
|
|
2941
|
-
styleEl.innerHTML = newStyleStr;
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2945
|
-
if (!navigator.cookieEnabled) {
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
function getCookie2(name) {
|
|
2949
|
-
const nameEQ = name + "=";
|
|
2950
|
-
const ca = document.cookie.split(";");
|
|
2951
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2952
|
-
let c = ca[i];
|
|
2953
|
-
while (c.charAt(0) === " ")
|
|
2954
|
-
c = c.substring(1, c.length);
|
|
2955
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2956
|
-
return c.substring(nameEQ.length, c.length);
|
|
2957
|
-
}
|
|
2958
|
-
return null;
|
|
2959
|
-
}
|
|
2960
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2961
|
-
const variantId = getCookie2(cookieName);
|
|
2962
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2963
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2964
|
-
if (variantId === variantContentId) {
|
|
2965
|
-
if (variantIsDefaultContent) {
|
|
2966
|
-
return;
|
|
2967
|
-
}
|
|
2968
|
-
parentDiv?.removeAttribute("hidden");
|
|
2969
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2970
|
-
} else {
|
|
2971
|
-
if (variantIsDefaultContent) {
|
|
2972
|
-
if (isHydrationTarget2) {
|
|
2973
|
-
parentDiv?.remove();
|
|
2974
|
-
} else {
|
|
2975
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2976
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
return;
|
|
2980
|
-
}
|
|
2981
|
-
return;
|
|
2982
|
-
}
|
|
2983
2955
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2984
2956
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2985
|
-
var
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2989
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2990
|
-
return `
|
|
2991
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2992
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2957
|
+
var getScriptString = () => `
|
|
2958
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2959
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2993
2960
|
`;
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
var getRenderContentScriptString = ({
|
|
2961
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2962
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2963
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2964
|
+
)`;
|
|
2965
|
+
var getUpdateVariantVisibilityScript = ({
|
|
3000
2966
|
contentId,
|
|
3001
2967
|
variationId
|
|
3002
|
-
}) => {
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
};
|
|
2968
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2969
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2970
|
+
)`;
|
|
3006
2971
|
var _tmpl$14 = /* @__PURE__ */ template(`<script>`);
|
|
3007
2972
|
function InlinedScript(props) {
|
|
3008
2973
|
return (() => {
|
|
3009
2974
|
const _el$ = _tmpl$14();
|
|
3010
2975
|
effect((_p$) => {
|
|
3011
|
-
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
2976
|
+
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
3012
2977
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
3013
2978
|
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
3014
2979
|
return _p$;
|
|
@@ -3501,7 +3466,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3501
3466
|
};
|
|
3502
3467
|
|
|
3503
3468
|
// src/constants/sdk-version.ts
|
|
3504
|
-
var SDK_VERSION = "0.7.
|
|
3469
|
+
var SDK_VERSION = "0.7.5";
|
|
3505
3470
|
|
|
3506
3471
|
// src/functions/register.ts
|
|
3507
3472
|
var registry = {};
|
|
@@ -3875,7 +3840,7 @@ function EnableEditor(props) {
|
|
|
3875
3840
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3876
3841
|
spread(_el$, mergeProps({
|
|
3877
3842
|
get ["class"]() {
|
|
3878
|
-
return props.
|
|
3843
|
+
return `variant-${props.content?.testVariationId || props.content?.id}`;
|
|
3879
3844
|
}
|
|
3880
3845
|
}, {}, {
|
|
3881
3846
|
get key() {
|
|
@@ -3995,22 +3960,20 @@ var getContextStateInitialValue = ({
|
|
|
3995
3960
|
locale
|
|
3996
3961
|
}) => {
|
|
3997
3962
|
const defaultValues = {};
|
|
3963
|
+
const initialState = content?.data?.state || {};
|
|
3998
3964
|
content?.data?.inputs?.forEach((input) => {
|
|
3999
|
-
if (input.name && input.defaultValue !== void 0
|
|
3965
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
4000
3966
|
defaultValues[input.name] = input.defaultValue;
|
|
4001
3967
|
}
|
|
4002
3968
|
});
|
|
4003
|
-
|
|
4004
|
-
...
|
|
3969
|
+
return {
|
|
3970
|
+
...defaultValues,
|
|
3971
|
+
...initialState,
|
|
4005
3972
|
...data,
|
|
4006
3973
|
...locale ? {
|
|
4007
3974
|
locale
|
|
4008
3975
|
} : {}
|
|
4009
3976
|
};
|
|
4010
|
-
return {
|
|
4011
|
-
...defaultValues,
|
|
4012
|
-
...stateToUse
|
|
4013
|
-
};
|
|
4014
3977
|
};
|
|
4015
3978
|
var getContentInitialValue = ({
|
|
4016
3979
|
content,
|
|
@@ -4028,7 +3991,7 @@ var getContentInitialValue = ({
|
|
|
4028
3991
|
|
|
4029
3992
|
// src/components/content/content.tsx
|
|
4030
3993
|
function ContentComponent(props) {
|
|
4031
|
-
const [scriptStr, setScriptStr] = createSignal(
|
|
3994
|
+
const [scriptStr, setScriptStr] = createSignal(getUpdateVariantVisibilityScript({
|
|
4032
3995
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4033
3996
|
variationId: props.content?.testVariationId,
|
|
4034
3997
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
@@ -4124,9 +4087,6 @@ function ContentComponent(props) {
|
|
|
4124
4087
|
get enrich() {
|
|
4125
4088
|
return props.enrich;
|
|
4126
4089
|
},
|
|
4127
|
-
get classNameProp() {
|
|
4128
|
-
return props.classNameProp;
|
|
4129
|
-
},
|
|
4130
4090
|
get showContent() {
|
|
4131
4091
|
return props.showContent;
|
|
4132
4092
|
},
|
|
@@ -4183,12 +4143,12 @@ var content_default = ContentComponent;
|
|
|
4183
4143
|
|
|
4184
4144
|
// src/components/content-variants/content-variants.tsx
|
|
4185
4145
|
function ContentVariants(props) {
|
|
4186
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
4146
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants({
|
|
4187
4147
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4188
4148
|
content: props.content
|
|
4189
4149
|
}));
|
|
4190
|
-
function
|
|
4191
|
-
return
|
|
4150
|
+
function updateCookieAndStylesScriptStr() {
|
|
4151
|
+
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
4192
4152
|
id: value.testVariationId,
|
|
4193
4153
|
testRatio: value.testRatio
|
|
4194
4154
|
})), props.content?.id || "");
|
|
@@ -4233,7 +4193,7 @@ function ContentVariants(props) {
|
|
|
4233
4193
|
}
|
|
4234
4194
|
}), createComponent(inlined_script_default, {
|
|
4235
4195
|
get scriptStr() {
|
|
4236
|
-
return
|
|
4196
|
+
return updateCookieAndStylesScriptStr();
|
|
4237
4197
|
}
|
|
4238
4198
|
}), createComponent(For, {
|
|
4239
4199
|
get each() {
|
|
@@ -4247,7 +4207,6 @@ function ContentVariants(props) {
|
|
|
4247
4207
|
},
|
|
4248
4208
|
content: variant,
|
|
4249
4209
|
showContent: false,
|
|
4250
|
-
classNameProp: void 0,
|
|
4251
4210
|
get model() {
|
|
4252
4211
|
return props.model;
|
|
4253
4212
|
},
|
|
@@ -4289,9 +4248,6 @@ function ContentVariants(props) {
|
|
|
4289
4248
|
get content() {
|
|
4290
4249
|
return defaultContent();
|
|
4291
4250
|
},
|
|
4292
|
-
get classNameProp() {
|
|
4293
|
-
return `variant-${props.content?.id}`;
|
|
4294
|
-
},
|
|
4295
4251
|
showContent: true,
|
|
4296
4252
|
get model() {
|
|
4297
4253
|
return props.model;
|