@builder.io/sdk-solid 0.7.2 → 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/lib/node/dev.jsx
CHANGED
|
@@ -1496,10 +1496,10 @@ function SectionComponent(props) {
|
|
|
1496
1496
|
var section_default = SectionComponent;
|
|
1497
1497
|
|
|
1498
1498
|
// src/blocks/symbol/symbol.tsx
|
|
1499
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1499
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1500
1500
|
|
|
1501
1501
|
// src/components/content-variants/content-variants.tsx
|
|
1502
|
-
import { Show as
|
|
1502
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1503
1503
|
|
|
1504
1504
|
// src/helpers/url.ts
|
|
1505
1505
|
var getTopLevelDomain = (host) => {
|
|
@@ -1693,7 +1693,7 @@ var handleABTesting = async ({
|
|
|
1693
1693
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1694
1694
|
|
|
1695
1695
|
// src/components/content/content.tsx
|
|
1696
|
-
import { Show as
|
|
1696
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1697
1697
|
|
|
1698
1698
|
// src/blocks/button/component-info.ts
|
|
1699
1699
|
var componentInfo = {
|
|
@@ -2468,6 +2468,7 @@ var componentInfo11 = {
|
|
|
2468
2468
|
};
|
|
2469
2469
|
|
|
2470
2470
|
// src/blocks/video/video.tsx
|
|
2471
|
+
import { Show as Show9 } from "solid-js";
|
|
2471
2472
|
function Video(props) {
|
|
2472
2473
|
function videoProps() {
|
|
2473
2474
|
return {
|
|
@@ -2490,26 +2491,66 @@ function Video(props) {
|
|
|
2490
2491
|
}
|
|
2491
2492
|
function spreadProps() {
|
|
2492
2493
|
return {
|
|
2493
|
-
...props.attributes,
|
|
2494
2494
|
...videoProps()
|
|
2495
2495
|
};
|
|
2496
2496
|
}
|
|
2497
|
-
return <
|
|
2498
|
-
{...spreadProps()}
|
|
2499
|
-
preload={props.preload || "metadata"}
|
|
2497
|
+
return <div
|
|
2500
2498
|
style={{
|
|
2501
|
-
|
|
2502
|
-
height: "100%",
|
|
2503
|
-
...props.attributes?.style,
|
|
2504
|
-
"object-fit": props.fit,
|
|
2505
|
-
"object-position": props.position,
|
|
2506
|
-
// Hack to get object fit to work as expected and
|
|
2507
|
-
// not have the video overflow
|
|
2508
|
-
"border-radius": 1
|
|
2499
|
+
position: "relative"
|
|
2509
2500
|
}}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2501
|
+
>
|
|
2502
|
+
<video
|
|
2503
|
+
class="builder-video"
|
|
2504
|
+
{...spreadProps()}
|
|
2505
|
+
preload={props.preload || "metadata"}
|
|
2506
|
+
style={{
|
|
2507
|
+
width: "100%",
|
|
2508
|
+
height: "100%",
|
|
2509
|
+
...props.attributes?.style,
|
|
2510
|
+
"object-fit": props.fit,
|
|
2511
|
+
"object-position": props.position,
|
|
2512
|
+
// Hack to get object fit to work as expected and
|
|
2513
|
+
// not have the video overflow
|
|
2514
|
+
"z-index": 2,
|
|
2515
|
+
"border-radius": "1px",
|
|
2516
|
+
...props.aspectRatio ? {
|
|
2517
|
+
position: "absolute"
|
|
2518
|
+
} : null
|
|
2519
|
+
}}
|
|
2520
|
+
src={props.video || "no-src"}
|
|
2521
|
+
poster={props.posterImage}
|
|
2522
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2523
|
+
<Show9
|
|
2524
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2525
|
+
><div
|
|
2526
|
+
style={{
|
|
2527
|
+
width: "100%",
|
|
2528
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2529
|
+
"pointer-events": "none",
|
|
2530
|
+
"font-size": "0px"
|
|
2531
|
+
}}
|
|
2532
|
+
/></Show9>
|
|
2533
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2534
|
+
style={{
|
|
2535
|
+
display: "flex",
|
|
2536
|
+
"flex-direction": "column",
|
|
2537
|
+
"align-items": "stretch"
|
|
2538
|
+
}}
|
|
2539
|
+
>{props.children}</div></Show9>
|
|
2540
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2541
|
+
style={{
|
|
2542
|
+
"pointer-events": "none",
|
|
2543
|
+
display: "flex",
|
|
2544
|
+
"flex-direction": "column",
|
|
2545
|
+
"align-items": "stretch",
|
|
2546
|
+
position: "absolute",
|
|
2547
|
+
top: "0",
|
|
2548
|
+
left: "0",
|
|
2549
|
+
width: "100%",
|
|
2550
|
+
height: "100%"
|
|
2551
|
+
}}
|
|
2552
|
+
>{props.children}</div></Show9>
|
|
2553
|
+
</div>;
|
|
2513
2554
|
}
|
|
2514
2555
|
var video_default = Video;
|
|
2515
2556
|
|
|
@@ -2572,13 +2613,19 @@ var serializeComponentInfo = ({
|
|
|
2572
2613
|
}), {}))
|
|
2573
2614
|
});
|
|
2574
2615
|
|
|
2616
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2617
|
+
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}";
|
|
2618
|
+
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}";
|
|
2619
|
+
|
|
2575
2620
|
// src/components/content-variants/helpers.ts
|
|
2621
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2622
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2576
2623
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2577
2624
|
...variant,
|
|
2578
2625
|
testVariationId: variant.id,
|
|
2579
2626
|
id: content?.id
|
|
2580
2627
|
}));
|
|
2581
|
-
var
|
|
2628
|
+
var checkShouldRenderVariants = ({
|
|
2582
2629
|
canTrack,
|
|
2583
2630
|
content
|
|
2584
2631
|
}) => {
|
|
@@ -2589,142 +2636,37 @@ var checkShouldRunVariants = ({
|
|
|
2589
2636
|
return false;
|
|
2590
2637
|
if (!canTrack)
|
|
2591
2638
|
return false;
|
|
2592
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2639
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2593
2640
|
return true;
|
|
2594
2641
|
if (isBrowser())
|
|
2595
2642
|
return false;
|
|
2596
2643
|
return true;
|
|
2597
2644
|
};
|
|
2598
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2599
|
-
function getAndSetVariantId2() {
|
|
2600
|
-
function setCookie2(name, value, days) {
|
|
2601
|
-
let expires = "";
|
|
2602
|
-
if (days) {
|
|
2603
|
-
const date = /* @__PURE__ */ new Date();
|
|
2604
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2605
|
-
expires = "; expires=" + date.toUTCString();
|
|
2606
|
-
}
|
|
2607
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2608
|
-
}
|
|
2609
|
-
function getCookie2(name) {
|
|
2610
|
-
const nameEQ = name + "=";
|
|
2611
|
-
const ca = document.cookie.split(";");
|
|
2612
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2613
|
-
let c = ca[i];
|
|
2614
|
-
while (c.charAt(0) === " ")
|
|
2615
|
-
c = c.substring(1, c.length);
|
|
2616
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2617
|
-
return c.substring(nameEQ.length, c.length);
|
|
2618
|
-
}
|
|
2619
|
-
return null;
|
|
2620
|
-
}
|
|
2621
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2622
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2623
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2624
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2625
|
-
return variantInCookie;
|
|
2626
|
-
}
|
|
2627
|
-
let n = 0;
|
|
2628
|
-
const random = Math.random();
|
|
2629
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2630
|
-
const variant = variants[i];
|
|
2631
|
-
const testRatio = variant.testRatio;
|
|
2632
|
-
n += testRatio;
|
|
2633
|
-
if (random < n) {
|
|
2634
|
-
setCookie2(cookieName, variant.id);
|
|
2635
|
-
return variant.id;
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
setCookie2(cookieName, contentId);
|
|
2639
|
-
return contentId;
|
|
2640
|
-
}
|
|
2641
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2642
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2643
|
-
if (isHydrationTarget2) {
|
|
2644
|
-
styleEl.remove();
|
|
2645
|
-
const thisScriptEl = document.currentScript;
|
|
2646
|
-
thisScriptEl?.remove();
|
|
2647
|
-
} else {
|
|
2648
|
-
const newStyleStr = variants.concat({
|
|
2649
|
-
id: contentId
|
|
2650
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2651
|
-
return `.variant-${value.id} { display: none; }
|
|
2652
|
-
`;
|
|
2653
|
-
}).join("");
|
|
2654
|
-
styleEl.innerHTML = newStyleStr;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2658
|
-
if (!navigator.cookieEnabled) {
|
|
2659
|
-
return;
|
|
2660
|
-
}
|
|
2661
|
-
function getCookie2(name) {
|
|
2662
|
-
const nameEQ = name + "=";
|
|
2663
|
-
const ca = document.cookie.split(";");
|
|
2664
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2665
|
-
let c = ca[i];
|
|
2666
|
-
while (c.charAt(0) === " ")
|
|
2667
|
-
c = c.substring(1, c.length);
|
|
2668
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2669
|
-
return c.substring(nameEQ.length, c.length);
|
|
2670
|
-
}
|
|
2671
|
-
return null;
|
|
2672
|
-
}
|
|
2673
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2674
|
-
const variantId = getCookie2(cookieName);
|
|
2675
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2676
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2677
|
-
if (variantId === variantContentId) {
|
|
2678
|
-
if (variantIsDefaultContent) {
|
|
2679
|
-
return;
|
|
2680
|
-
}
|
|
2681
|
-
parentDiv?.removeAttribute("hidden");
|
|
2682
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2683
|
-
} else {
|
|
2684
|
-
if (variantIsDefaultContent) {
|
|
2685
|
-
if (isHydrationTarget2) {
|
|
2686
|
-
parentDiv?.remove();
|
|
2687
|
-
} else {
|
|
2688
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2689
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
return;
|
|
2693
|
-
}
|
|
2694
|
-
return;
|
|
2695
|
-
}
|
|
2696
2645
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2697
2646
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2698
|
-
var
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2702
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2703
|
-
return `
|
|
2704
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2705
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2647
|
+
var getScriptString = () => `
|
|
2648
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2649
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2706
2650
|
`;
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
var getRenderContentScriptString = ({
|
|
2651
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2652
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2653
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2654
|
+
)`;
|
|
2655
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2713
2656
|
contentId,
|
|
2714
2657
|
variationId
|
|
2715
|
-
}) => {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
};
|
|
2658
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2659
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2660
|
+
)`;
|
|
2719
2661
|
|
|
2720
2662
|
// src/components/inlined-script.tsx
|
|
2721
2663
|
function InlinedScript(props) {
|
|
2722
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2664
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2723
2665
|
}
|
|
2724
2666
|
var Inlined_script_default = InlinedScript;
|
|
2725
2667
|
|
|
2726
2668
|
// src/components/content/components/enable-editor.tsx
|
|
2727
|
-
import { Show as
|
|
2669
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2728
2670
|
|
|
2729
2671
|
// src/helpers/preview-lru-cache/get.ts
|
|
2730
2672
|
function getPreviewContent(_searchParams) {
|
|
@@ -3211,7 +3153,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3211
3153
|
};
|
|
3212
3154
|
|
|
3213
3155
|
// src/constants/sdk-version.ts
|
|
3214
|
-
var SDK_VERSION = "0.7.
|
|
3156
|
+
var SDK_VERSION = "0.7.4";
|
|
3215
3157
|
|
|
3216
3158
|
// src/functions/register.ts
|
|
3217
3159
|
var registry = {};
|
|
@@ -3346,11 +3288,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3346
3288
|
|
|
3347
3289
|
// src/components/content/components/enable-editor.tsx
|
|
3348
3290
|
function EnableEditor(props) {
|
|
3349
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3350
|
-
const [lastUpdated, setLastUpdated] =
|
|
3351
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3352
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3353
|
-
const [clicked, setClicked] =
|
|
3291
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3292
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3293
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3294
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3295
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3354
3296
|
function mergeNewContent(newContent) {
|
|
3355
3297
|
const newContentValue = {
|
|
3356
3298
|
...props.builderContextSignal.content,
|
|
@@ -3593,8 +3535,8 @@ function EnableEditor(props) {
|
|
|
3593
3535
|
emitStateUpdate();
|
|
3594
3536
|
}
|
|
3595
3537
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3596
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3597
|
-
class={props.
|
|
3538
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3539
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3598
3540
|
{...{}}
|
|
3599
3541
|
key={forceReRenderCount()}
|
|
3600
3542
|
ref={elementRef}
|
|
@@ -3606,12 +3548,12 @@ function EnableEditor(props) {
|
|
|
3606
3548
|
hidden: true,
|
|
3607
3549
|
"aria-hidden": true
|
|
3608
3550
|
}}
|
|
3609
|
-
>{props.children}</div></
|
|
3551
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3610
3552
|
}
|
|
3611
3553
|
var Enable_editor_default = EnableEditor;
|
|
3612
3554
|
|
|
3613
3555
|
// src/components/content/components/styles.tsx
|
|
3614
|
-
import { createSignal as
|
|
3556
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3615
3557
|
|
|
3616
3558
|
// src/components/content/components/styles.helpers.ts
|
|
3617
3559
|
var getCssFromFont = (font) => {
|
|
@@ -3670,7 +3612,7 @@ var getCss = ({
|
|
|
3670
3612
|
|
|
3671
3613
|
// src/components/content/components/styles.tsx
|
|
3672
3614
|
function ContentStyles(props) {
|
|
3673
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3615
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3674
3616
|
`
|
|
3675
3617
|
${getCss({
|
|
3676
3618
|
cssCode: props.cssCode,
|
|
@@ -3738,15 +3680,15 @@ var getContentInitialValue = ({
|
|
|
3738
3680
|
|
|
3739
3681
|
// src/components/content/content.tsx
|
|
3740
3682
|
function ContentComponent(props) {
|
|
3741
|
-
const [scriptStr, setScriptStr] =
|
|
3742
|
-
|
|
3683
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3684
|
+
getUpdateVariantVisibilityScript({
|
|
3743
3685
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3744
3686
|
variationId: props.content?.testVariationId,
|
|
3745
3687
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3746
3688
|
contentId: props.content?.id
|
|
3747
3689
|
})
|
|
3748
3690
|
);
|
|
3749
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3691
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3750
3692
|
[
|
|
3751
3693
|
...getDefaultRegisteredComponents(),
|
|
3752
3694
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3767,7 +3709,7 @@ function ContentComponent(props) {
|
|
|
3767
3709
|
{}
|
|
3768
3710
|
)
|
|
3769
3711
|
);
|
|
3770
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3712
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3771
3713
|
content: getContentInitialValue({
|
|
3772
3714
|
content: props.content,
|
|
3773
3715
|
data: props.data
|
|
@@ -3819,19 +3761,18 @@ function ContentComponent(props) {
|
|
|
3819
3761
|
locale={props.locale}
|
|
3820
3762
|
includeRefs={props.includeRefs}
|
|
3821
3763
|
enrich={props.enrich}
|
|
3822
|
-
classNameProp={props.classNameProp}
|
|
3823
3764
|
showContent={props.showContent}
|
|
3824
3765
|
builderContextSignal={builderContextSignal()}
|
|
3825
3766
|
{...{
|
|
3826
3767
|
setBuilderContextSignal
|
|
3827
3768
|
}}
|
|
3828
3769
|
>
|
|
3829
|
-
<
|
|
3830
|
-
<
|
|
3770
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3771
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3831
3772
|
contentId={builderContextSignal().content?.id}
|
|
3832
3773
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3833
3774
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3834
|
-
/></
|
|
3775
|
+
/></Show11>
|
|
3835
3776
|
<Blocks_default
|
|
3836
3777
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3837
3778
|
context={builderContextSignal()}
|
|
@@ -3843,14 +3784,14 @@ var Content_default = ContentComponent;
|
|
|
3843
3784
|
|
|
3844
3785
|
// src/components/content-variants/content-variants.tsx
|
|
3845
3786
|
function ContentVariants(props) {
|
|
3846
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3847
|
-
|
|
3787
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3788
|
+
checkShouldRenderVariants({
|
|
3848
3789
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3849
3790
|
content: props.content
|
|
3850
3791
|
})
|
|
3851
3792
|
);
|
|
3852
|
-
function
|
|
3853
|
-
return
|
|
3793
|
+
function updateCookieAndStylesScriptStr() {
|
|
3794
|
+
return getUpdateCookieAndStylesScript(
|
|
3854
3795
|
getVariants(props.content).map((value) => ({
|
|
3855
3796
|
id: value.testVariationId,
|
|
3856
3797
|
testRatio: value.testRatio
|
|
@@ -3874,20 +3815,21 @@ function ContentVariants(props) {
|
|
|
3874
3815
|
setShouldRenderVariants(false);
|
|
3875
3816
|
});
|
|
3876
3817
|
return <>
|
|
3877
|
-
<
|
|
3878
|
-
<
|
|
3818
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3819
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3879
3820
|
<Inlined_styles_default
|
|
3880
3821
|
id={`variants-styles-${props.content?.id}`}
|
|
3881
3822
|
styles={hideVariantsStyleString()}
|
|
3882
3823
|
/>
|
|
3883
|
-
<Inlined_script_default
|
|
3824
|
+
<Inlined_script_default
|
|
3825
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3826
|
+
/>
|
|
3884
3827
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3885
3828
|
const index = _index();
|
|
3886
3829
|
return <Content_default
|
|
3887
3830
|
key={variant.testVariationId}
|
|
3888
3831
|
content={variant}
|
|
3889
3832
|
showContent={false}
|
|
3890
|
-
classNameProp={void 0}
|
|
3891
3833
|
model={props.model}
|
|
3892
3834
|
data={props.data}
|
|
3893
3835
|
context={props.context}
|
|
@@ -3901,11 +3843,10 @@ function ContentVariants(props) {
|
|
|
3901
3843
|
isSsrAbTest={shouldRenderVariants()}
|
|
3902
3844
|
/>;
|
|
3903
3845
|
}}</For5>
|
|
3904
|
-
</
|
|
3846
|
+
</Show12>
|
|
3905
3847
|
<Content_default
|
|
3906
3848
|
{...{}}
|
|
3907
3849
|
content={defaultContent()}
|
|
3908
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3909
3850
|
showContent={true}
|
|
3910
3851
|
model={props.model}
|
|
3911
3852
|
data={props.data}
|
|
@@ -3949,7 +3890,7 @@ var fetchSymbolContent = async ({
|
|
|
3949
3890
|
|
|
3950
3891
|
// src/blocks/symbol/symbol.tsx
|
|
3951
3892
|
function Symbol(props) {
|
|
3952
|
-
const [contentToUse, setContentToUse] =
|
|
3893
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3953
3894
|
function className() {
|
|
3954
3895
|
return [
|
|
3955
3896
|
...[props.attributes.class],
|