@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.jsx
CHANGED
|
@@ -1004,7 +1004,7 @@ function Block(props) {
|
|
|
1004
1004
|
});
|
|
1005
1005
|
}
|
|
1006
1006
|
function processedBlock() {
|
|
1007
|
-
return
|
|
1007
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1008
1008
|
block: props.block,
|
|
1009
1009
|
localState: props.context.localState,
|
|
1010
1010
|
rootState: props.context.rootState,
|
|
@@ -1023,6 +1023,9 @@ function Block(props) {
|
|
|
1023
1023
|
if ("show" in processedBlock()) {
|
|
1024
1024
|
return processedBlock().show;
|
|
1025
1025
|
}
|
|
1026
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
1027
|
+
return false;
|
|
1028
|
+
}
|
|
1026
1029
|
return true;
|
|
1027
1030
|
}
|
|
1028
1031
|
function childrenWithoutParentComponent() {
|
|
@@ -1496,10 +1499,10 @@ function SectionComponent(props) {
|
|
|
1496
1499
|
var section_default = SectionComponent;
|
|
1497
1500
|
|
|
1498
1501
|
// src/blocks/symbol/symbol.tsx
|
|
1499
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1502
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1500
1503
|
|
|
1501
1504
|
// src/components/content-variants/content-variants.tsx
|
|
1502
|
-
import { Show as
|
|
1505
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1503
1506
|
|
|
1504
1507
|
// src/helpers/url.ts
|
|
1505
1508
|
var getTopLevelDomain = (host) => {
|
|
@@ -1693,7 +1696,7 @@ var handleABTesting = async ({
|
|
|
1693
1696
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1694
1697
|
|
|
1695
1698
|
// src/components/content/content.tsx
|
|
1696
|
-
import { Show as
|
|
1699
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1697
1700
|
|
|
1698
1701
|
// src/blocks/button/component-info.ts
|
|
1699
1702
|
var componentInfo = {
|
|
@@ -2468,6 +2471,7 @@ var componentInfo11 = {
|
|
|
2468
2471
|
};
|
|
2469
2472
|
|
|
2470
2473
|
// src/blocks/video/video.tsx
|
|
2474
|
+
import { Show as Show9 } from "solid-js";
|
|
2471
2475
|
function Video(props) {
|
|
2472
2476
|
function videoProps() {
|
|
2473
2477
|
return {
|
|
@@ -2490,26 +2494,66 @@ function Video(props) {
|
|
|
2490
2494
|
}
|
|
2491
2495
|
function spreadProps() {
|
|
2492
2496
|
return {
|
|
2493
|
-
...props.attributes,
|
|
2494
2497
|
...videoProps()
|
|
2495
2498
|
};
|
|
2496
2499
|
}
|
|
2497
|
-
return <
|
|
2498
|
-
{...spreadProps()}
|
|
2499
|
-
preload={props.preload || "metadata"}
|
|
2500
|
+
return <div
|
|
2500
2501
|
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
|
|
2502
|
+
position: "relative"
|
|
2509
2503
|
}}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2504
|
+
>
|
|
2505
|
+
<video
|
|
2506
|
+
class="builder-video"
|
|
2507
|
+
{...spreadProps()}
|
|
2508
|
+
preload={props.preload || "metadata"}
|
|
2509
|
+
style={{
|
|
2510
|
+
width: "100%",
|
|
2511
|
+
height: "100%",
|
|
2512
|
+
...props.attributes?.style,
|
|
2513
|
+
"object-fit": props.fit,
|
|
2514
|
+
"object-position": props.position,
|
|
2515
|
+
// Hack to get object fit to work as expected and
|
|
2516
|
+
// not have the video overflow
|
|
2517
|
+
"z-index": 2,
|
|
2518
|
+
"border-radius": "1px",
|
|
2519
|
+
...props.aspectRatio ? {
|
|
2520
|
+
position: "absolute"
|
|
2521
|
+
} : null
|
|
2522
|
+
}}
|
|
2523
|
+
src={props.video || "no-src"}
|
|
2524
|
+
poster={props.posterImage}
|
|
2525
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2526
|
+
<Show9
|
|
2527
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2528
|
+
><div
|
|
2529
|
+
style={{
|
|
2530
|
+
width: "100%",
|
|
2531
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2532
|
+
"pointer-events": "none",
|
|
2533
|
+
"font-size": "0px"
|
|
2534
|
+
}}
|
|
2535
|
+
/></Show9>
|
|
2536
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2537
|
+
style={{
|
|
2538
|
+
display: "flex",
|
|
2539
|
+
"flex-direction": "column",
|
|
2540
|
+
"align-items": "stretch"
|
|
2541
|
+
}}
|
|
2542
|
+
>{props.children}</div></Show9>
|
|
2543
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2544
|
+
style={{
|
|
2545
|
+
"pointer-events": "none",
|
|
2546
|
+
display: "flex",
|
|
2547
|
+
"flex-direction": "column",
|
|
2548
|
+
"align-items": "stretch",
|
|
2549
|
+
position: "absolute",
|
|
2550
|
+
top: "0",
|
|
2551
|
+
left: "0",
|
|
2552
|
+
width: "100%",
|
|
2553
|
+
height: "100%"
|
|
2554
|
+
}}
|
|
2555
|
+
>{props.children}</div></Show9>
|
|
2556
|
+
</div>;
|
|
2513
2557
|
}
|
|
2514
2558
|
var video_default = Video;
|
|
2515
2559
|
|
|
@@ -2572,13 +2616,19 @@ var serializeComponentInfo = ({
|
|
|
2572
2616
|
}), {}))
|
|
2573
2617
|
});
|
|
2574
2618
|
|
|
2619
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2620
|
+
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}";
|
|
2621
|
+
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}";
|
|
2622
|
+
|
|
2575
2623
|
// src/components/content-variants/helpers.ts
|
|
2624
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2625
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2576
2626
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2577
2627
|
...variant,
|
|
2578
2628
|
testVariationId: variant.id,
|
|
2579
2629
|
id: content?.id
|
|
2580
2630
|
}));
|
|
2581
|
-
var
|
|
2631
|
+
var checkShouldRenderVariants = ({
|
|
2582
2632
|
canTrack,
|
|
2583
2633
|
content
|
|
2584
2634
|
}) => {
|
|
@@ -2589,142 +2639,37 @@ var checkShouldRunVariants = ({
|
|
|
2589
2639
|
return false;
|
|
2590
2640
|
if (!canTrack)
|
|
2591
2641
|
return false;
|
|
2592
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2642
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2593
2643
|
return true;
|
|
2594
2644
|
if (isBrowser())
|
|
2595
2645
|
return false;
|
|
2596
2646
|
return true;
|
|
2597
2647
|
};
|
|
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
2648
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2697
2649
|
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}
|
|
2650
|
+
var getScriptString = () => `
|
|
2651
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2652
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2706
2653
|
`;
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
var getRenderContentScriptString = ({
|
|
2654
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2655
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2656
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2657
|
+
)`;
|
|
2658
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2713
2659
|
contentId,
|
|
2714
2660
|
variationId
|
|
2715
|
-
}) => {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
};
|
|
2661
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2662
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2663
|
+
)`;
|
|
2719
2664
|
|
|
2720
2665
|
// src/components/inlined-script.tsx
|
|
2721
2666
|
function InlinedScript(props) {
|
|
2722
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2667
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2723
2668
|
}
|
|
2724
2669
|
var Inlined_script_default = InlinedScript;
|
|
2725
2670
|
|
|
2726
2671
|
// src/components/content/components/enable-editor.tsx
|
|
2727
|
-
import { Show as
|
|
2672
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2728
2673
|
|
|
2729
2674
|
// src/helpers/preview-lru-cache/get.ts
|
|
2730
2675
|
function getPreviewContent(_searchParams) {
|
|
@@ -3211,7 +3156,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3211
3156
|
};
|
|
3212
3157
|
|
|
3213
3158
|
// src/constants/sdk-version.ts
|
|
3214
|
-
var SDK_VERSION = "0.7.
|
|
3159
|
+
var SDK_VERSION = "0.7.5";
|
|
3215
3160
|
|
|
3216
3161
|
// src/functions/register.ts
|
|
3217
3162
|
var registry = {};
|
|
@@ -3346,11 +3291,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3346
3291
|
|
|
3347
3292
|
// src/components/content/components/enable-editor.tsx
|
|
3348
3293
|
function EnableEditor(props) {
|
|
3349
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3350
|
-
const [lastUpdated, setLastUpdated] =
|
|
3351
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3352
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3353
|
-
const [clicked, setClicked] =
|
|
3294
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3295
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3296
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3297
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3298
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3354
3299
|
function mergeNewContent(newContent) {
|
|
3355
3300
|
const newContentValue = {
|
|
3356
3301
|
...props.builderContextSignal.content,
|
|
@@ -3593,8 +3538,8 @@ function EnableEditor(props) {
|
|
|
3593
3538
|
emitStateUpdate();
|
|
3594
3539
|
}
|
|
3595
3540
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3596
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3597
|
-
class={props.
|
|
3541
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3542
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3598
3543
|
{...{}}
|
|
3599
3544
|
key={forceReRenderCount()}
|
|
3600
3545
|
ref={elementRef}
|
|
@@ -3606,12 +3551,12 @@ function EnableEditor(props) {
|
|
|
3606
3551
|
hidden: true,
|
|
3607
3552
|
"aria-hidden": true
|
|
3608
3553
|
}}
|
|
3609
|
-
>{props.children}</div></
|
|
3554
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3610
3555
|
}
|
|
3611
3556
|
var Enable_editor_default = EnableEditor;
|
|
3612
3557
|
|
|
3613
3558
|
// src/components/content/components/styles.tsx
|
|
3614
|
-
import { createSignal as
|
|
3559
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3615
3560
|
|
|
3616
3561
|
// src/components/content/components/styles.helpers.ts
|
|
3617
3562
|
var getCssFromFont = (font) => {
|
|
@@ -3670,7 +3615,7 @@ var getCss = ({
|
|
|
3670
3615
|
|
|
3671
3616
|
// src/components/content/components/styles.tsx
|
|
3672
3617
|
function ContentStyles(props) {
|
|
3673
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3618
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3674
3619
|
`
|
|
3675
3620
|
${getCss({
|
|
3676
3621
|
cssCode: props.cssCode,
|
|
@@ -3705,22 +3650,20 @@ var getContextStateInitialValue = ({
|
|
|
3705
3650
|
locale
|
|
3706
3651
|
}) => {
|
|
3707
3652
|
const defaultValues = {};
|
|
3653
|
+
const initialState = content?.data?.state || {};
|
|
3708
3654
|
content?.data?.inputs?.forEach((input) => {
|
|
3709
|
-
if (input.name && input.defaultValue !== void 0
|
|
3655
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
3710
3656
|
defaultValues[input.name] = input.defaultValue;
|
|
3711
3657
|
}
|
|
3712
3658
|
});
|
|
3713
|
-
|
|
3714
|
-
...
|
|
3659
|
+
return {
|
|
3660
|
+
...defaultValues,
|
|
3661
|
+
...initialState,
|
|
3715
3662
|
...data,
|
|
3716
3663
|
...locale ? {
|
|
3717
3664
|
locale
|
|
3718
3665
|
} : {}
|
|
3719
3666
|
};
|
|
3720
|
-
return {
|
|
3721
|
-
...defaultValues,
|
|
3722
|
-
...stateToUse
|
|
3723
|
-
};
|
|
3724
3667
|
};
|
|
3725
3668
|
var getContentInitialValue = ({
|
|
3726
3669
|
content,
|
|
@@ -3738,15 +3681,15 @@ var getContentInitialValue = ({
|
|
|
3738
3681
|
|
|
3739
3682
|
// src/components/content/content.tsx
|
|
3740
3683
|
function ContentComponent(props) {
|
|
3741
|
-
const [scriptStr, setScriptStr] =
|
|
3742
|
-
|
|
3684
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3685
|
+
getUpdateVariantVisibilityScript({
|
|
3743
3686
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3744
3687
|
variationId: props.content?.testVariationId,
|
|
3745
3688
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3746
3689
|
contentId: props.content?.id
|
|
3747
3690
|
})
|
|
3748
3691
|
);
|
|
3749
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3692
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3750
3693
|
[
|
|
3751
3694
|
...getDefaultRegisteredComponents(),
|
|
3752
3695
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3767,7 +3710,7 @@ function ContentComponent(props) {
|
|
|
3767
3710
|
{}
|
|
3768
3711
|
)
|
|
3769
3712
|
);
|
|
3770
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3713
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3771
3714
|
content: getContentInitialValue({
|
|
3772
3715
|
content: props.content,
|
|
3773
3716
|
data: props.data
|
|
@@ -3819,19 +3762,18 @@ function ContentComponent(props) {
|
|
|
3819
3762
|
locale={props.locale}
|
|
3820
3763
|
includeRefs={props.includeRefs}
|
|
3821
3764
|
enrich={props.enrich}
|
|
3822
|
-
classNameProp={props.classNameProp}
|
|
3823
3765
|
showContent={props.showContent}
|
|
3824
3766
|
builderContextSignal={builderContextSignal()}
|
|
3825
3767
|
{...{
|
|
3826
3768
|
setBuilderContextSignal
|
|
3827
3769
|
}}
|
|
3828
3770
|
>
|
|
3829
|
-
<
|
|
3830
|
-
<
|
|
3771
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3772
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3831
3773
|
contentId={builderContextSignal().content?.id}
|
|
3832
3774
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3833
3775
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3834
|
-
/></
|
|
3776
|
+
/></Show11>
|
|
3835
3777
|
<Blocks_default
|
|
3836
3778
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3837
3779
|
context={builderContextSignal()}
|
|
@@ -3843,14 +3785,14 @@ var Content_default = ContentComponent;
|
|
|
3843
3785
|
|
|
3844
3786
|
// src/components/content-variants/content-variants.tsx
|
|
3845
3787
|
function ContentVariants(props) {
|
|
3846
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3847
|
-
|
|
3788
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3789
|
+
checkShouldRenderVariants({
|
|
3848
3790
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3849
3791
|
content: props.content
|
|
3850
3792
|
})
|
|
3851
3793
|
);
|
|
3852
|
-
function
|
|
3853
|
-
return
|
|
3794
|
+
function updateCookieAndStylesScriptStr() {
|
|
3795
|
+
return getUpdateCookieAndStylesScript(
|
|
3854
3796
|
getVariants(props.content).map((value) => ({
|
|
3855
3797
|
id: value.testVariationId,
|
|
3856
3798
|
testRatio: value.testRatio
|
|
@@ -3874,20 +3816,21 @@ function ContentVariants(props) {
|
|
|
3874
3816
|
setShouldRenderVariants(false);
|
|
3875
3817
|
});
|
|
3876
3818
|
return <>
|
|
3877
|
-
<
|
|
3878
|
-
<
|
|
3819
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3820
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3879
3821
|
<Inlined_styles_default
|
|
3880
3822
|
id={`variants-styles-${props.content?.id}`}
|
|
3881
3823
|
styles={hideVariantsStyleString()}
|
|
3882
3824
|
/>
|
|
3883
|
-
<Inlined_script_default
|
|
3825
|
+
<Inlined_script_default
|
|
3826
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3827
|
+
/>
|
|
3884
3828
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3885
3829
|
const index = _index();
|
|
3886
3830
|
return <Content_default
|
|
3887
3831
|
key={variant.testVariationId}
|
|
3888
3832
|
content={variant}
|
|
3889
3833
|
showContent={false}
|
|
3890
|
-
classNameProp={void 0}
|
|
3891
3834
|
model={props.model}
|
|
3892
3835
|
data={props.data}
|
|
3893
3836
|
context={props.context}
|
|
@@ -3901,11 +3844,10 @@ function ContentVariants(props) {
|
|
|
3901
3844
|
isSsrAbTest={shouldRenderVariants()}
|
|
3902
3845
|
/>;
|
|
3903
3846
|
}}</For5>
|
|
3904
|
-
</
|
|
3847
|
+
</Show12>
|
|
3905
3848
|
<Content_default
|
|
3906
3849
|
{...{}}
|
|
3907
3850
|
content={defaultContent()}
|
|
3908
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3909
3851
|
showContent={true}
|
|
3910
3852
|
model={props.model}
|
|
3911
3853
|
data={props.data}
|
|
@@ -3949,7 +3891,7 @@ var fetchSymbolContent = async ({
|
|
|
3949
3891
|
|
|
3950
3892
|
// src/blocks/symbol/symbol.tsx
|
|
3951
3893
|
function Symbol(props) {
|
|
3952
|
-
const [contentToUse, setContentToUse] =
|
|
3894
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3953
3895
|
function className() {
|
|
3954
3896
|
return [
|
|
3955
3897
|
...[props.attributes.class],
|