@builder.io/sdk-solid 0.7.3 → 0.7.4
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 +94 -139
- package/lib/browser/dev.jsx +109 -168
- package/lib/browser/index.js +94 -139
- package/lib/browser/index.jsx +109 -168
- package/lib/edge/dev.js +94 -139
- package/lib/edge/dev.jsx +109 -168
- package/lib/edge/index.js +94 -139
- package/lib/edge/index.jsx +109 -168
- package/lib/node/dev.js +94 -139
- package/lib/node/dev.jsx +109 -168
- package/lib/node/index.js +94 -139
- package/lib/node/index.jsx +109 -168
- package/package.json +8 -1
package/dist/index.d.ts
CHANGED
|
@@ -557,7 +557,11 @@ interface VideoProps {
|
|
|
557
557
|
position?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
558
558
|
posterImage?: string;
|
|
559
559
|
lazyLoad?: boolean;
|
|
560
|
+
children?: any;
|
|
561
|
+
fitContent?: boolean;
|
|
562
|
+
builderBlock?: BuilderBlock;
|
|
560
563
|
}
|
|
564
|
+
|
|
561
565
|
declare function Video(props: VideoProps): solid_js.JSX.Element;
|
|
562
566
|
|
|
563
567
|
type BlocksWrapperProps = {
|
|
@@ -888,10 +892,6 @@ type AndUndefined<T> = {
|
|
|
888
892
|
type EnforcePartials<From> = Prettify<AndUndefined<Enforced<OptionalFieldsOnly<From>>> & RequiredFieldsOnly<From>>;
|
|
889
893
|
|
|
890
894
|
interface InternalRenderProps {
|
|
891
|
-
/**
|
|
892
|
-
* TO-DO: improve qwik generator to not remap this name for non-HTML tags, then name it `className`
|
|
893
|
-
*/
|
|
894
|
-
classNameProp: string | undefined;
|
|
895
895
|
showContent: boolean;
|
|
896
896
|
isSsrAbTest: boolean;
|
|
897
897
|
}
|
package/lib/browser/dev.js
CHANGED
|
@@ -2641,7 +2641,9 @@ var componentInfo11 = {
|
|
|
2641
2641
|
advanced: true
|
|
2642
2642
|
}]
|
|
2643
2643
|
};
|
|
2644
|
-
var _tmpl$13 = /* @__PURE__ */ template(`<video>`);
|
|
2644
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
2645
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
|
|
2646
|
+
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
2645
2647
|
function Video(props) {
|
|
2646
2648
|
function videoProps() {
|
|
2647
2649
|
return {
|
|
@@ -2664,13 +2666,13 @@ function Video(props) {
|
|
|
2664
2666
|
}
|
|
2665
2667
|
function spreadProps() {
|
|
2666
2668
|
return {
|
|
2667
|
-
...props.attributes,
|
|
2668
2669
|
...videoProps()
|
|
2669
2670
|
};
|
|
2670
2671
|
}
|
|
2671
2672
|
return (() => {
|
|
2672
|
-
const _el$ = _tmpl$
|
|
2673
|
-
|
|
2673
|
+
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
2674
|
+
_el$.style.setProperty("position", "relative");
|
|
2675
|
+
spread(_el$2, mergeProps(spreadProps, {
|
|
2674
2676
|
get preload() {
|
|
2675
2677
|
return props.preload || "metadata";
|
|
2676
2678
|
},
|
|
@@ -2683,7 +2685,11 @@ function Video(props) {
|
|
|
2683
2685
|
"object-position": props.position,
|
|
2684
2686
|
// Hack to get object fit to work as expected and
|
|
2685
2687
|
// not have the video overflow
|
|
2686
|
-
"
|
|
2688
|
+
"z-index": 2,
|
|
2689
|
+
"border-radius": "1px",
|
|
2690
|
+
...props.aspectRatio ? {
|
|
2691
|
+
position: "absolute"
|
|
2692
|
+
} : null
|
|
2687
2693
|
};
|
|
2688
2694
|
},
|
|
2689
2695
|
get src() {
|
|
@@ -2692,7 +2698,62 @@ function Video(props) {
|
|
|
2692
2698
|
get poster() {
|
|
2693
2699
|
return props.posterImage;
|
|
2694
2700
|
}
|
|
2695
|
-
}), false,
|
|
2701
|
+
}), false, true);
|
|
2702
|
+
insert(_el$2, createComponent(Show, {
|
|
2703
|
+
get when() {
|
|
2704
|
+
return !props.lazyLoad;
|
|
2705
|
+
},
|
|
2706
|
+
get children() {
|
|
2707
|
+
const _el$3 = _tmpl$13();
|
|
2708
|
+
effect(() => setAttribute(_el$3, "src", props.video));
|
|
2709
|
+
return _el$3;
|
|
2710
|
+
}
|
|
2711
|
+
}));
|
|
2712
|
+
insert(_el$, createComponent(Show, {
|
|
2713
|
+
get when() {
|
|
2714
|
+
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
2715
|
+
},
|
|
2716
|
+
get children() {
|
|
2717
|
+
const _el$4 = _tmpl$23();
|
|
2718
|
+
_el$4.style.setProperty("width", "100%");
|
|
2719
|
+
_el$4.style.setProperty("pointer-events", "none");
|
|
2720
|
+
_el$4.style.setProperty("font-size", "0px");
|
|
2721
|
+
effect(() => props.aspectRatio * 100 + "%" != null ? _el$4.style.setProperty("padding-top", props.aspectRatio * 100 + "%") : _el$4.style.removeProperty("padding-top"));
|
|
2722
|
+
return _el$4;
|
|
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$5 = _tmpl$23();
|
|
2731
|
+
_el$5.style.setProperty("display", "flex");
|
|
2732
|
+
_el$5.style.setProperty("flex-direction", "column");
|
|
2733
|
+
_el$5.style.setProperty("align-items", "stretch");
|
|
2734
|
+
insert(_el$5, () => props.children);
|
|
2735
|
+
return _el$5;
|
|
2736
|
+
}
|
|
2737
|
+
}), null);
|
|
2738
|
+
insert(_el$, createComponent(Show, {
|
|
2739
|
+
get when() {
|
|
2740
|
+
return props.builderBlock?.children?.length && !props.fitContent;
|
|
2741
|
+
},
|
|
2742
|
+
get children() {
|
|
2743
|
+
const _el$6 = _tmpl$23();
|
|
2744
|
+
_el$6.style.setProperty("pointer-events", "none");
|
|
2745
|
+
_el$6.style.setProperty("display", "flex");
|
|
2746
|
+
_el$6.style.setProperty("flex-direction", "column");
|
|
2747
|
+
_el$6.style.setProperty("align-items", "stretch");
|
|
2748
|
+
_el$6.style.setProperty("position", "absolute");
|
|
2749
|
+
_el$6.style.setProperty("top", "0");
|
|
2750
|
+
_el$6.style.setProperty("left", "0");
|
|
2751
|
+
_el$6.style.setProperty("width", "100%");
|
|
2752
|
+
_el$6.style.setProperty("height", "100%");
|
|
2753
|
+
insert(_el$6, () => props.children);
|
|
2754
|
+
return _el$6;
|
|
2755
|
+
}
|
|
2756
|
+
}), null);
|
|
2696
2757
|
return _el$;
|
|
2697
2758
|
})();
|
|
2698
2759
|
}
|
|
@@ -2757,13 +2818,19 @@ var serializeComponentInfo = ({
|
|
|
2757
2818
|
}), {}))
|
|
2758
2819
|
});
|
|
2759
2820
|
|
|
2821
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2822
|
+
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}";
|
|
2823
|
+
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}";
|
|
2824
|
+
|
|
2760
2825
|
// src/components/content-variants/helpers.ts
|
|
2826
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2827
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2761
2828
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2762
2829
|
...variant,
|
|
2763
2830
|
testVariationId: variant.id,
|
|
2764
2831
|
id: content?.id
|
|
2765
2832
|
}));
|
|
2766
|
-
var
|
|
2833
|
+
var checkShouldRenderVariants = ({
|
|
2767
2834
|
canTrack,
|
|
2768
2835
|
content
|
|
2769
2836
|
}) => {
|
|
@@ -2774,139 +2841,34 @@ var checkShouldRunVariants = ({
|
|
|
2774
2841
|
return false;
|
|
2775
2842
|
if (!canTrack)
|
|
2776
2843
|
return false;
|
|
2777
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2844
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2778
2845
|
return true;
|
|
2779
2846
|
if (isBrowser())
|
|
2780
2847
|
return false;
|
|
2781
2848
|
return true;
|
|
2782
2849
|
};
|
|
2783
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2784
|
-
function getAndSetVariantId2() {
|
|
2785
|
-
function setCookie2(name, value, days) {
|
|
2786
|
-
let expires = "";
|
|
2787
|
-
if (days) {
|
|
2788
|
-
const date = /* @__PURE__ */ new Date();
|
|
2789
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2790
|
-
expires = "; expires=" + date.toUTCString();
|
|
2791
|
-
}
|
|
2792
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2793
|
-
}
|
|
2794
|
-
function getCookie2(name) {
|
|
2795
|
-
const nameEQ = name + "=";
|
|
2796
|
-
const ca = document.cookie.split(";");
|
|
2797
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2798
|
-
let c = ca[i];
|
|
2799
|
-
while (c.charAt(0) === " ")
|
|
2800
|
-
c = c.substring(1, c.length);
|
|
2801
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2802
|
-
return c.substring(nameEQ.length, c.length);
|
|
2803
|
-
}
|
|
2804
|
-
return null;
|
|
2805
|
-
}
|
|
2806
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2807
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2808
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2809
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2810
|
-
return variantInCookie;
|
|
2811
|
-
}
|
|
2812
|
-
let n = 0;
|
|
2813
|
-
const random = Math.random();
|
|
2814
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2815
|
-
const variant = variants[i];
|
|
2816
|
-
const testRatio = variant.testRatio;
|
|
2817
|
-
n += testRatio;
|
|
2818
|
-
if (random < n) {
|
|
2819
|
-
setCookie2(cookieName, variant.id);
|
|
2820
|
-
return variant.id;
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
setCookie2(cookieName, contentId);
|
|
2824
|
-
return contentId;
|
|
2825
|
-
}
|
|
2826
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2827
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2828
|
-
if (isHydrationTarget2) {
|
|
2829
|
-
styleEl.remove();
|
|
2830
|
-
const thisScriptEl = document.currentScript;
|
|
2831
|
-
thisScriptEl?.remove();
|
|
2832
|
-
} else {
|
|
2833
|
-
const newStyleStr = variants.concat({
|
|
2834
|
-
id: contentId
|
|
2835
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2836
|
-
return `.variant-${value.id} { display: none; }
|
|
2837
|
-
`;
|
|
2838
|
-
}).join("");
|
|
2839
|
-
styleEl.innerHTML = newStyleStr;
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2843
|
-
if (!navigator.cookieEnabled) {
|
|
2844
|
-
return;
|
|
2845
|
-
}
|
|
2846
|
-
function getCookie2(name) {
|
|
2847
|
-
const nameEQ = name + "=";
|
|
2848
|
-
const ca = document.cookie.split(";");
|
|
2849
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2850
|
-
let c = ca[i];
|
|
2851
|
-
while (c.charAt(0) === " ")
|
|
2852
|
-
c = c.substring(1, c.length);
|
|
2853
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2854
|
-
return c.substring(nameEQ.length, c.length);
|
|
2855
|
-
}
|
|
2856
|
-
return null;
|
|
2857
|
-
}
|
|
2858
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2859
|
-
const variantId = getCookie2(cookieName);
|
|
2860
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2861
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2862
|
-
if (variantId === variantContentId) {
|
|
2863
|
-
if (variantIsDefaultContent) {
|
|
2864
|
-
return;
|
|
2865
|
-
}
|
|
2866
|
-
parentDiv?.removeAttribute("hidden");
|
|
2867
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2868
|
-
} else {
|
|
2869
|
-
if (variantIsDefaultContent) {
|
|
2870
|
-
if (isHydrationTarget2) {
|
|
2871
|
-
parentDiv?.remove();
|
|
2872
|
-
} else {
|
|
2873
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2874
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
return;
|
|
2878
|
-
}
|
|
2879
|
-
return;
|
|
2880
|
-
}
|
|
2881
2850
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2882
2851
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2883
|
-
var
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2887
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2888
|
-
return `
|
|
2889
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2890
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2852
|
+
var getScriptString = () => `
|
|
2853
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2854
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2891
2855
|
`;
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
var getRenderContentScriptString = ({
|
|
2856
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2857
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2858
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2859
|
+
)`;
|
|
2860
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2898
2861
|
contentId,
|
|
2899
2862
|
variationId
|
|
2900
|
-
}) => {
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
};
|
|
2863
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2864
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2865
|
+
)`;
|
|
2904
2866
|
var _tmpl$14 = /* @__PURE__ */ template(`<script>`);
|
|
2905
2867
|
function InlinedScript(props) {
|
|
2906
2868
|
return (() => {
|
|
2907
2869
|
const _el$ = _tmpl$14();
|
|
2908
2870
|
effect((_p$) => {
|
|
2909
|
-
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
2871
|
+
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
2910
2872
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
2911
2873
|
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
2912
2874
|
return _p$;
|
|
@@ -3404,7 +3366,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3404
3366
|
};
|
|
3405
3367
|
|
|
3406
3368
|
// src/constants/sdk-version.ts
|
|
3407
|
-
var SDK_VERSION = "0.7.
|
|
3369
|
+
var SDK_VERSION = "0.7.4";
|
|
3408
3370
|
|
|
3409
3371
|
// src/functions/register.ts
|
|
3410
3372
|
var registry = {};
|
|
@@ -3780,7 +3742,7 @@ function EnableEditor(props) {
|
|
|
3780
3742
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3781
3743
|
spread(_el$, mergeProps({
|
|
3782
3744
|
get ["class"]() {
|
|
3783
|
-
return props.
|
|
3745
|
+
return `variant-${props.content?.testVariationId || props.content?.id}`;
|
|
3784
3746
|
}
|
|
3785
3747
|
}, {}, {
|
|
3786
3748
|
get key() {
|
|
@@ -3933,7 +3895,7 @@ var getContentInitialValue = ({
|
|
|
3933
3895
|
|
|
3934
3896
|
// src/components/content/content.tsx
|
|
3935
3897
|
function ContentComponent(props) {
|
|
3936
|
-
const [scriptStr, setScriptStr] = createSignal(
|
|
3898
|
+
const [scriptStr, setScriptStr] = createSignal(getUpdateVariantVisibilityScript({
|
|
3937
3899
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3938
3900
|
variationId: props.content?.testVariationId,
|
|
3939
3901
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
@@ -4029,9 +3991,6 @@ function ContentComponent(props) {
|
|
|
4029
3991
|
get enrich() {
|
|
4030
3992
|
return props.enrich;
|
|
4031
3993
|
},
|
|
4032
|
-
get classNameProp() {
|
|
4033
|
-
return props.classNameProp;
|
|
4034
|
-
},
|
|
4035
3994
|
get showContent() {
|
|
4036
3995
|
return props.showContent;
|
|
4037
3996
|
},
|
|
@@ -4088,12 +4047,12 @@ var content_default = ContentComponent;
|
|
|
4088
4047
|
|
|
4089
4048
|
// src/components/content-variants/content-variants.tsx
|
|
4090
4049
|
function ContentVariants(props) {
|
|
4091
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
4050
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants({
|
|
4092
4051
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4093
4052
|
content: props.content
|
|
4094
4053
|
}));
|
|
4095
|
-
function
|
|
4096
|
-
return
|
|
4054
|
+
function updateCookieAndStylesScriptStr() {
|
|
4055
|
+
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
4097
4056
|
id: value.testVariationId,
|
|
4098
4057
|
testRatio: value.testRatio
|
|
4099
4058
|
})), props.content?.id || "");
|
|
@@ -4138,7 +4097,7 @@ function ContentVariants(props) {
|
|
|
4138
4097
|
}
|
|
4139
4098
|
}), createComponent(inlined_script_default, {
|
|
4140
4099
|
get scriptStr() {
|
|
4141
|
-
return
|
|
4100
|
+
return updateCookieAndStylesScriptStr();
|
|
4142
4101
|
}
|
|
4143
4102
|
}), createComponent(For, {
|
|
4144
4103
|
get each() {
|
|
@@ -4152,7 +4111,6 @@ function ContentVariants(props) {
|
|
|
4152
4111
|
},
|
|
4153
4112
|
content: variant,
|
|
4154
4113
|
showContent: false,
|
|
4155
|
-
classNameProp: void 0,
|
|
4156
4114
|
get model() {
|
|
4157
4115
|
return props.model;
|
|
4158
4116
|
},
|
|
@@ -4194,9 +4152,6 @@ function ContentVariants(props) {
|
|
|
4194
4152
|
get content() {
|
|
4195
4153
|
return defaultContent();
|
|
4196
4154
|
},
|
|
4197
|
-
get classNameProp() {
|
|
4198
|
-
return `variant-${props.content?.id}`;
|
|
4199
|
-
},
|
|
4200
4155
|
showContent: true,
|
|
4201
4156
|
get model() {
|
|
4202
4157
|
return props.model;
|