@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/dev.js
CHANGED
|
@@ -1062,7 +1062,7 @@ function Block(props) {
|
|
|
1062
1062
|
});
|
|
1063
1063
|
}
|
|
1064
1064
|
function processedBlock() {
|
|
1065
|
-
return
|
|
1065
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1066
1066
|
block: props.block,
|
|
1067
1067
|
localState: props.context.localState,
|
|
1068
1068
|
rootState: props.context.rootState,
|
|
@@ -1081,6 +1081,9 @@ function Block(props) {
|
|
|
1081
1081
|
if ("show" in processedBlock()) {
|
|
1082
1082
|
return processedBlock().show;
|
|
1083
1083
|
}
|
|
1084
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1084
1087
|
return true;
|
|
1085
1088
|
}
|
|
1086
1089
|
function childrenWithoutParentComponent() {
|
|
@@ -2760,7 +2763,9 @@ var componentInfo11 = {
|
|
|
2760
2763
|
advanced: true
|
|
2761
2764
|
}]
|
|
2762
2765
|
};
|
|
2763
|
-
var _tmpl$13 = /* @__PURE__ */ template(`<video>`);
|
|
2766
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
2767
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
|
|
2768
|
+
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
2764
2769
|
function Video(props) {
|
|
2765
2770
|
function videoProps() {
|
|
2766
2771
|
return {
|
|
@@ -2783,13 +2788,13 @@ function Video(props) {
|
|
|
2783
2788
|
}
|
|
2784
2789
|
function spreadProps() {
|
|
2785
2790
|
return {
|
|
2786
|
-
...props.attributes,
|
|
2787
2791
|
...videoProps()
|
|
2788
2792
|
};
|
|
2789
2793
|
}
|
|
2790
2794
|
return (() => {
|
|
2791
|
-
const _el$ = _tmpl$
|
|
2792
|
-
|
|
2795
|
+
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
2796
|
+
_el$.style.setProperty("position", "relative");
|
|
2797
|
+
spread(_el$2, mergeProps(spreadProps, {
|
|
2793
2798
|
get preload() {
|
|
2794
2799
|
return props.preload || "metadata";
|
|
2795
2800
|
},
|
|
@@ -2802,7 +2807,11 @@ function Video(props) {
|
|
|
2802
2807
|
"object-position": props.position,
|
|
2803
2808
|
// Hack to get object fit to work as expected and
|
|
2804
2809
|
// not have the video overflow
|
|
2805
|
-
"
|
|
2810
|
+
"z-index": 2,
|
|
2811
|
+
"border-radius": "1px",
|
|
2812
|
+
...props.aspectRatio ? {
|
|
2813
|
+
position: "absolute"
|
|
2814
|
+
} : null
|
|
2806
2815
|
};
|
|
2807
2816
|
},
|
|
2808
2817
|
get src() {
|
|
@@ -2811,7 +2820,62 @@ function Video(props) {
|
|
|
2811
2820
|
get poster() {
|
|
2812
2821
|
return props.posterImage;
|
|
2813
2822
|
}
|
|
2814
|
-
}), false,
|
|
2823
|
+
}), false, true);
|
|
2824
|
+
insert(_el$2, createComponent(Show, {
|
|
2825
|
+
get when() {
|
|
2826
|
+
return !props.lazyLoad;
|
|
2827
|
+
},
|
|
2828
|
+
get children() {
|
|
2829
|
+
const _el$3 = _tmpl$13();
|
|
2830
|
+
effect(() => setAttribute(_el$3, "src", props.video));
|
|
2831
|
+
return _el$3;
|
|
2832
|
+
}
|
|
2833
|
+
}));
|
|
2834
|
+
insert(_el$, createComponent(Show, {
|
|
2835
|
+
get when() {
|
|
2836
|
+
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
2837
|
+
},
|
|
2838
|
+
get children() {
|
|
2839
|
+
const _el$4 = _tmpl$23();
|
|
2840
|
+
_el$4.style.setProperty("width", "100%");
|
|
2841
|
+
_el$4.style.setProperty("pointer-events", "none");
|
|
2842
|
+
_el$4.style.setProperty("font-size", "0px");
|
|
2843
|
+
effect(() => props.aspectRatio * 100 + "%" != null ? _el$4.style.setProperty("padding-top", props.aspectRatio * 100 + "%") : _el$4.style.removeProperty("padding-top"));
|
|
2844
|
+
return _el$4;
|
|
2845
|
+
}
|
|
2846
|
+
}), null);
|
|
2847
|
+
insert(_el$, createComponent(Show, {
|
|
2848
|
+
get when() {
|
|
2849
|
+
return props.builderBlock?.children?.length && props.fitContent;
|
|
2850
|
+
},
|
|
2851
|
+
get children() {
|
|
2852
|
+
const _el$5 = _tmpl$23();
|
|
2853
|
+
_el$5.style.setProperty("display", "flex");
|
|
2854
|
+
_el$5.style.setProperty("flex-direction", "column");
|
|
2855
|
+
_el$5.style.setProperty("align-items", "stretch");
|
|
2856
|
+
insert(_el$5, () => props.children);
|
|
2857
|
+
return _el$5;
|
|
2858
|
+
}
|
|
2859
|
+
}), null);
|
|
2860
|
+
insert(_el$, createComponent(Show, {
|
|
2861
|
+
get when() {
|
|
2862
|
+
return props.builderBlock?.children?.length && !props.fitContent;
|
|
2863
|
+
},
|
|
2864
|
+
get children() {
|
|
2865
|
+
const _el$6 = _tmpl$23();
|
|
2866
|
+
_el$6.style.setProperty("pointer-events", "none");
|
|
2867
|
+
_el$6.style.setProperty("display", "flex");
|
|
2868
|
+
_el$6.style.setProperty("flex-direction", "column");
|
|
2869
|
+
_el$6.style.setProperty("align-items", "stretch");
|
|
2870
|
+
_el$6.style.setProperty("position", "absolute");
|
|
2871
|
+
_el$6.style.setProperty("top", "0");
|
|
2872
|
+
_el$6.style.setProperty("left", "0");
|
|
2873
|
+
_el$6.style.setProperty("width", "100%");
|
|
2874
|
+
_el$6.style.setProperty("height", "100%");
|
|
2875
|
+
insert(_el$6, () => props.children);
|
|
2876
|
+
return _el$6;
|
|
2877
|
+
}
|
|
2878
|
+
}), null);
|
|
2815
2879
|
return _el$;
|
|
2816
2880
|
})();
|
|
2817
2881
|
}
|
|
@@ -2876,13 +2940,19 @@ var serializeComponentInfo = ({
|
|
|
2876
2940
|
}), {}))
|
|
2877
2941
|
});
|
|
2878
2942
|
|
|
2943
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2944
|
+
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}";
|
|
2945
|
+
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}";
|
|
2946
|
+
|
|
2879
2947
|
// src/components/content-variants/helpers.ts
|
|
2948
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2949
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2880
2950
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2881
2951
|
...variant,
|
|
2882
2952
|
testVariationId: variant.id,
|
|
2883
2953
|
id: content?.id
|
|
2884
2954
|
}));
|
|
2885
|
-
var
|
|
2955
|
+
var checkShouldRenderVariants = ({
|
|
2886
2956
|
canTrack,
|
|
2887
2957
|
content
|
|
2888
2958
|
}) => {
|
|
@@ -2893,139 +2963,34 @@ var checkShouldRunVariants = ({
|
|
|
2893
2963
|
return false;
|
|
2894
2964
|
if (!canTrack)
|
|
2895
2965
|
return false;
|
|
2896
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2966
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2897
2967
|
return true;
|
|
2898
2968
|
if (isBrowser())
|
|
2899
2969
|
return false;
|
|
2900
2970
|
return true;
|
|
2901
2971
|
};
|
|
2902
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2903
|
-
function getAndSetVariantId2() {
|
|
2904
|
-
function setCookie2(name, value, days) {
|
|
2905
|
-
let expires = "";
|
|
2906
|
-
if (days) {
|
|
2907
|
-
const date = /* @__PURE__ */ new Date();
|
|
2908
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2909
|
-
expires = "; expires=" + date.toUTCString();
|
|
2910
|
-
}
|
|
2911
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2912
|
-
}
|
|
2913
|
-
function getCookie2(name) {
|
|
2914
|
-
const nameEQ = name + "=";
|
|
2915
|
-
const ca = document.cookie.split(";");
|
|
2916
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2917
|
-
let c = ca[i];
|
|
2918
|
-
while (c.charAt(0) === " ")
|
|
2919
|
-
c = c.substring(1, c.length);
|
|
2920
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2921
|
-
return c.substring(nameEQ.length, c.length);
|
|
2922
|
-
}
|
|
2923
|
-
return null;
|
|
2924
|
-
}
|
|
2925
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2926
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2927
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2928
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2929
|
-
return variantInCookie;
|
|
2930
|
-
}
|
|
2931
|
-
let n = 0;
|
|
2932
|
-
const random = Math.random();
|
|
2933
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2934
|
-
const variant = variants[i];
|
|
2935
|
-
const testRatio = variant.testRatio;
|
|
2936
|
-
n += testRatio;
|
|
2937
|
-
if (random < n) {
|
|
2938
|
-
setCookie2(cookieName, variant.id);
|
|
2939
|
-
return variant.id;
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
setCookie2(cookieName, contentId);
|
|
2943
|
-
return contentId;
|
|
2944
|
-
}
|
|
2945
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2946
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2947
|
-
if (isHydrationTarget2) {
|
|
2948
|
-
styleEl.remove();
|
|
2949
|
-
const thisScriptEl = document.currentScript;
|
|
2950
|
-
thisScriptEl?.remove();
|
|
2951
|
-
} else {
|
|
2952
|
-
const newStyleStr = variants.concat({
|
|
2953
|
-
id: contentId
|
|
2954
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2955
|
-
return `.variant-${value.id} { display: none; }
|
|
2956
|
-
`;
|
|
2957
|
-
}).join("");
|
|
2958
|
-
styleEl.innerHTML = newStyleStr;
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2962
|
-
if (!navigator.cookieEnabled) {
|
|
2963
|
-
return;
|
|
2964
|
-
}
|
|
2965
|
-
function getCookie2(name) {
|
|
2966
|
-
const nameEQ = name + "=";
|
|
2967
|
-
const ca = document.cookie.split(";");
|
|
2968
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2969
|
-
let c = ca[i];
|
|
2970
|
-
while (c.charAt(0) === " ")
|
|
2971
|
-
c = c.substring(1, c.length);
|
|
2972
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2973
|
-
return c.substring(nameEQ.length, c.length);
|
|
2974
|
-
}
|
|
2975
|
-
return null;
|
|
2976
|
-
}
|
|
2977
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2978
|
-
const variantId = getCookie2(cookieName);
|
|
2979
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2980
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2981
|
-
if (variantId === variantContentId) {
|
|
2982
|
-
if (variantIsDefaultContent) {
|
|
2983
|
-
return;
|
|
2984
|
-
}
|
|
2985
|
-
parentDiv?.removeAttribute("hidden");
|
|
2986
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2987
|
-
} else {
|
|
2988
|
-
if (variantIsDefaultContent) {
|
|
2989
|
-
if (isHydrationTarget2) {
|
|
2990
|
-
parentDiv?.remove();
|
|
2991
|
-
} else {
|
|
2992
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2993
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
return;
|
|
2997
|
-
}
|
|
2998
|
-
return;
|
|
2999
|
-
}
|
|
3000
2972
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
3001
2973
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
3002
|
-
var
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
3006
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
3007
|
-
return `
|
|
3008
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
3009
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2974
|
+
var getScriptString = () => `
|
|
2975
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2976
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
3010
2977
|
`;
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
var getRenderContentScriptString = ({
|
|
2978
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2979
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2980
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2981
|
+
)`;
|
|
2982
|
+
var getUpdateVariantVisibilityScript = ({
|
|
3017
2983
|
contentId,
|
|
3018
2984
|
variationId
|
|
3019
|
-
}) => {
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
};
|
|
2985
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2986
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2987
|
+
)`;
|
|
3023
2988
|
var _tmpl$14 = /* @__PURE__ */ template(`<script>`);
|
|
3024
2989
|
function InlinedScript(props) {
|
|
3025
2990
|
return (() => {
|
|
3026
2991
|
const _el$ = _tmpl$14();
|
|
3027
2992
|
effect((_p$) => {
|
|
3028
|
-
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
2993
|
+
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
3029
2994
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
3030
2995
|
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
3031
2996
|
return _p$;
|
|
@@ -3523,7 +3488,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3523
3488
|
};
|
|
3524
3489
|
|
|
3525
3490
|
// src/constants/sdk-version.ts
|
|
3526
|
-
var SDK_VERSION = "0.7.
|
|
3491
|
+
var SDK_VERSION = "0.7.5";
|
|
3527
3492
|
|
|
3528
3493
|
// src/functions/register.ts
|
|
3529
3494
|
var registry = {};
|
|
@@ -3899,7 +3864,7 @@ function EnableEditor(props) {
|
|
|
3899
3864
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3900
3865
|
spread(_el$, mergeProps({
|
|
3901
3866
|
get ["class"]() {
|
|
3902
|
-
return props.
|
|
3867
|
+
return `variant-${props.content?.testVariationId || props.content?.id}`;
|
|
3903
3868
|
}
|
|
3904
3869
|
}, {}, {
|
|
3905
3870
|
get key() {
|
|
@@ -4019,22 +3984,20 @@ var getContextStateInitialValue = ({
|
|
|
4019
3984
|
locale
|
|
4020
3985
|
}) => {
|
|
4021
3986
|
const defaultValues = {};
|
|
3987
|
+
const initialState = content?.data?.state || {};
|
|
4022
3988
|
content?.data?.inputs?.forEach((input) => {
|
|
4023
|
-
if (input.name && input.defaultValue !== void 0
|
|
3989
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
4024
3990
|
defaultValues[input.name] = input.defaultValue;
|
|
4025
3991
|
}
|
|
4026
3992
|
});
|
|
4027
|
-
|
|
4028
|
-
...
|
|
3993
|
+
return {
|
|
3994
|
+
...defaultValues,
|
|
3995
|
+
...initialState,
|
|
4029
3996
|
...data,
|
|
4030
3997
|
...locale ? {
|
|
4031
3998
|
locale
|
|
4032
3999
|
} : {}
|
|
4033
4000
|
};
|
|
4034
|
-
return {
|
|
4035
|
-
...defaultValues,
|
|
4036
|
-
...stateToUse
|
|
4037
|
-
};
|
|
4038
4001
|
};
|
|
4039
4002
|
var getContentInitialValue = ({
|
|
4040
4003
|
content,
|
|
@@ -4052,7 +4015,7 @@ var getContentInitialValue = ({
|
|
|
4052
4015
|
|
|
4053
4016
|
// src/components/content/content.tsx
|
|
4054
4017
|
function ContentComponent(props) {
|
|
4055
|
-
const [scriptStr, setScriptStr] = createSignal(
|
|
4018
|
+
const [scriptStr, setScriptStr] = createSignal(getUpdateVariantVisibilityScript({
|
|
4056
4019
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4057
4020
|
variationId: props.content?.testVariationId,
|
|
4058
4021
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
@@ -4148,9 +4111,6 @@ function ContentComponent(props) {
|
|
|
4148
4111
|
get enrich() {
|
|
4149
4112
|
return props.enrich;
|
|
4150
4113
|
},
|
|
4151
|
-
get classNameProp() {
|
|
4152
|
-
return props.classNameProp;
|
|
4153
|
-
},
|
|
4154
4114
|
get showContent() {
|
|
4155
4115
|
return props.showContent;
|
|
4156
4116
|
},
|
|
@@ -4207,12 +4167,12 @@ var content_default = ContentComponent;
|
|
|
4207
4167
|
|
|
4208
4168
|
// src/components/content-variants/content-variants.tsx
|
|
4209
4169
|
function ContentVariants(props) {
|
|
4210
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
4170
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants({
|
|
4211
4171
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4212
4172
|
content: props.content
|
|
4213
4173
|
}));
|
|
4214
|
-
function
|
|
4215
|
-
return
|
|
4174
|
+
function updateCookieAndStylesScriptStr() {
|
|
4175
|
+
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
4216
4176
|
id: value.testVariationId,
|
|
4217
4177
|
testRatio: value.testRatio
|
|
4218
4178
|
})), props.content?.id || "");
|
|
@@ -4257,7 +4217,7 @@ function ContentVariants(props) {
|
|
|
4257
4217
|
}
|
|
4258
4218
|
}), createComponent(inlined_script_default, {
|
|
4259
4219
|
get scriptStr() {
|
|
4260
|
-
return
|
|
4220
|
+
return updateCookieAndStylesScriptStr();
|
|
4261
4221
|
}
|
|
4262
4222
|
}), createComponent(For, {
|
|
4263
4223
|
get each() {
|
|
@@ -4271,7 +4231,6 @@ function ContentVariants(props) {
|
|
|
4271
4231
|
},
|
|
4272
4232
|
content: variant,
|
|
4273
4233
|
showContent: false,
|
|
4274
|
-
classNameProp: void 0,
|
|
4275
4234
|
get model() {
|
|
4276
4235
|
return props.model;
|
|
4277
4236
|
},
|
|
@@ -4313,9 +4272,6 @@ function ContentVariants(props) {
|
|
|
4313
4272
|
get content() {
|
|
4314
4273
|
return defaultContent();
|
|
4315
4274
|
},
|
|
4316
|
-
get classNameProp() {
|
|
4317
|
-
return `variant-${props.content?.id}`;
|
|
4318
|
-
},
|
|
4319
4275
|
showContent: true,
|
|
4320
4276
|
get model() {
|
|
4321
4277
|
return props.model;
|