@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/lib/node/index.jsx
CHANGED
|
@@ -1487,10 +1487,10 @@ function SectionComponent(props) {
|
|
|
1487
1487
|
var section_default = SectionComponent;
|
|
1488
1488
|
|
|
1489
1489
|
// src/blocks/symbol/symbol.tsx
|
|
1490
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1490
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1491
1491
|
|
|
1492
1492
|
// src/components/content-variants/content-variants.tsx
|
|
1493
|
-
import { Show as
|
|
1493
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1494
1494
|
|
|
1495
1495
|
// src/helpers/url.ts
|
|
1496
1496
|
var getTopLevelDomain = (host) => {
|
|
@@ -1684,7 +1684,7 @@ var handleABTesting = async ({
|
|
|
1684
1684
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1685
1685
|
|
|
1686
1686
|
// src/components/content/content.tsx
|
|
1687
|
-
import { Show as
|
|
1687
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1688
1688
|
|
|
1689
1689
|
// src/blocks/button/component-info.ts
|
|
1690
1690
|
var componentInfo = {
|
|
@@ -2456,6 +2456,7 @@ var componentInfo11 = {
|
|
|
2456
2456
|
};
|
|
2457
2457
|
|
|
2458
2458
|
// src/blocks/video/video.tsx
|
|
2459
|
+
import { Show as Show9 } from "solid-js";
|
|
2459
2460
|
function Video(props) {
|
|
2460
2461
|
function videoProps() {
|
|
2461
2462
|
return {
|
|
@@ -2478,26 +2479,66 @@ function Video(props) {
|
|
|
2478
2479
|
}
|
|
2479
2480
|
function spreadProps() {
|
|
2480
2481
|
return {
|
|
2481
|
-
...props.attributes,
|
|
2482
2482
|
...videoProps()
|
|
2483
2483
|
};
|
|
2484
2484
|
}
|
|
2485
|
-
return <
|
|
2486
|
-
{...spreadProps()}
|
|
2487
|
-
preload={props.preload || "metadata"}
|
|
2485
|
+
return <div
|
|
2488
2486
|
style={{
|
|
2489
|
-
|
|
2490
|
-
height: "100%",
|
|
2491
|
-
...props.attributes?.style,
|
|
2492
|
-
"object-fit": props.fit,
|
|
2493
|
-
"object-position": props.position,
|
|
2494
|
-
// Hack to get object fit to work as expected and
|
|
2495
|
-
// not have the video overflow
|
|
2496
|
-
"border-radius": 1
|
|
2487
|
+
position: "relative"
|
|
2497
2488
|
}}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2489
|
+
>
|
|
2490
|
+
<video
|
|
2491
|
+
class="builder-video"
|
|
2492
|
+
{...spreadProps()}
|
|
2493
|
+
preload={props.preload || "metadata"}
|
|
2494
|
+
style={{
|
|
2495
|
+
width: "100%",
|
|
2496
|
+
height: "100%",
|
|
2497
|
+
...props.attributes?.style,
|
|
2498
|
+
"object-fit": props.fit,
|
|
2499
|
+
"object-position": props.position,
|
|
2500
|
+
// Hack to get object fit to work as expected and
|
|
2501
|
+
// not have the video overflow
|
|
2502
|
+
"z-index": 2,
|
|
2503
|
+
"border-radius": "1px",
|
|
2504
|
+
...props.aspectRatio ? {
|
|
2505
|
+
position: "absolute"
|
|
2506
|
+
} : null
|
|
2507
|
+
}}
|
|
2508
|
+
src={props.video || "no-src"}
|
|
2509
|
+
poster={props.posterImage}
|
|
2510
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2511
|
+
<Show9
|
|
2512
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2513
|
+
><div
|
|
2514
|
+
style={{
|
|
2515
|
+
width: "100%",
|
|
2516
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2517
|
+
"pointer-events": "none",
|
|
2518
|
+
"font-size": "0px"
|
|
2519
|
+
}}
|
|
2520
|
+
/></Show9>
|
|
2521
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2522
|
+
style={{
|
|
2523
|
+
display: "flex",
|
|
2524
|
+
"flex-direction": "column",
|
|
2525
|
+
"align-items": "stretch"
|
|
2526
|
+
}}
|
|
2527
|
+
>{props.children}</div></Show9>
|
|
2528
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2529
|
+
style={{
|
|
2530
|
+
"pointer-events": "none",
|
|
2531
|
+
display: "flex",
|
|
2532
|
+
"flex-direction": "column",
|
|
2533
|
+
"align-items": "stretch",
|
|
2534
|
+
position: "absolute",
|
|
2535
|
+
top: "0",
|
|
2536
|
+
left: "0",
|
|
2537
|
+
width: "100%",
|
|
2538
|
+
height: "100%"
|
|
2539
|
+
}}
|
|
2540
|
+
>{props.children}</div></Show9>
|
|
2541
|
+
</div>;
|
|
2501
2542
|
}
|
|
2502
2543
|
var video_default = Video;
|
|
2503
2544
|
|
|
@@ -2560,13 +2601,19 @@ var serializeComponentInfo = ({
|
|
|
2560
2601
|
}), {}))
|
|
2561
2602
|
});
|
|
2562
2603
|
|
|
2604
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2605
|
+
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}";
|
|
2606
|
+
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}";
|
|
2607
|
+
|
|
2563
2608
|
// src/components/content-variants/helpers.ts
|
|
2609
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2610
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2564
2611
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2565
2612
|
...variant,
|
|
2566
2613
|
testVariationId: variant.id,
|
|
2567
2614
|
id: content?.id
|
|
2568
2615
|
}));
|
|
2569
|
-
var
|
|
2616
|
+
var checkShouldRenderVariants = ({
|
|
2570
2617
|
canTrack,
|
|
2571
2618
|
content
|
|
2572
2619
|
}) => {
|
|
@@ -2577,142 +2624,37 @@ var checkShouldRunVariants = ({
|
|
|
2577
2624
|
return false;
|
|
2578
2625
|
if (!canTrack)
|
|
2579
2626
|
return false;
|
|
2580
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2627
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2581
2628
|
return true;
|
|
2582
2629
|
if (isBrowser())
|
|
2583
2630
|
return false;
|
|
2584
2631
|
return true;
|
|
2585
2632
|
};
|
|
2586
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2587
|
-
function getAndSetVariantId2() {
|
|
2588
|
-
function setCookie2(name, value, days) {
|
|
2589
|
-
let expires = "";
|
|
2590
|
-
if (days) {
|
|
2591
|
-
const date = /* @__PURE__ */ new Date();
|
|
2592
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2593
|
-
expires = "; expires=" + date.toUTCString();
|
|
2594
|
-
}
|
|
2595
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2596
|
-
}
|
|
2597
|
-
function getCookie2(name) {
|
|
2598
|
-
const nameEQ = name + "=";
|
|
2599
|
-
const ca = document.cookie.split(";");
|
|
2600
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2601
|
-
let c = ca[i];
|
|
2602
|
-
while (c.charAt(0) === " ")
|
|
2603
|
-
c = c.substring(1, c.length);
|
|
2604
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2605
|
-
return c.substring(nameEQ.length, c.length);
|
|
2606
|
-
}
|
|
2607
|
-
return null;
|
|
2608
|
-
}
|
|
2609
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2610
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2611
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2612
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2613
|
-
return variantInCookie;
|
|
2614
|
-
}
|
|
2615
|
-
let n = 0;
|
|
2616
|
-
const random = Math.random();
|
|
2617
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2618
|
-
const variant = variants[i];
|
|
2619
|
-
const testRatio = variant.testRatio;
|
|
2620
|
-
n += testRatio;
|
|
2621
|
-
if (random < n) {
|
|
2622
|
-
setCookie2(cookieName, variant.id);
|
|
2623
|
-
return variant.id;
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2626
|
-
setCookie2(cookieName, contentId);
|
|
2627
|
-
return contentId;
|
|
2628
|
-
}
|
|
2629
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2630
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2631
|
-
if (isHydrationTarget2) {
|
|
2632
|
-
styleEl.remove();
|
|
2633
|
-
const thisScriptEl = document.currentScript;
|
|
2634
|
-
thisScriptEl?.remove();
|
|
2635
|
-
} else {
|
|
2636
|
-
const newStyleStr = variants.concat({
|
|
2637
|
-
id: contentId
|
|
2638
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2639
|
-
return `.variant-${value.id} { display: none; }
|
|
2640
|
-
`;
|
|
2641
|
-
}).join("");
|
|
2642
|
-
styleEl.innerHTML = newStyleStr;
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2646
|
-
if (!navigator.cookieEnabled) {
|
|
2647
|
-
return;
|
|
2648
|
-
}
|
|
2649
|
-
function getCookie2(name) {
|
|
2650
|
-
const nameEQ = name + "=";
|
|
2651
|
-
const ca = document.cookie.split(";");
|
|
2652
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2653
|
-
let c = ca[i];
|
|
2654
|
-
while (c.charAt(0) === " ")
|
|
2655
|
-
c = c.substring(1, c.length);
|
|
2656
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2657
|
-
return c.substring(nameEQ.length, c.length);
|
|
2658
|
-
}
|
|
2659
|
-
return null;
|
|
2660
|
-
}
|
|
2661
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2662
|
-
const variantId = getCookie2(cookieName);
|
|
2663
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2664
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2665
|
-
if (variantId === variantContentId) {
|
|
2666
|
-
if (variantIsDefaultContent) {
|
|
2667
|
-
return;
|
|
2668
|
-
}
|
|
2669
|
-
parentDiv?.removeAttribute("hidden");
|
|
2670
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2671
|
-
} else {
|
|
2672
|
-
if (variantIsDefaultContent) {
|
|
2673
|
-
if (isHydrationTarget2) {
|
|
2674
|
-
parentDiv?.remove();
|
|
2675
|
-
} else {
|
|
2676
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2677
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
return;
|
|
2681
|
-
}
|
|
2682
|
-
return;
|
|
2683
|
-
}
|
|
2684
2633
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2685
2634
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2686
|
-
var
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2690
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2691
|
-
return `
|
|
2692
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2693
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2635
|
+
var getScriptString = () => `
|
|
2636
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2637
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2694
2638
|
`;
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
var getRenderContentScriptString = ({
|
|
2639
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2640
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2641
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2642
|
+
)`;
|
|
2643
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2701
2644
|
contentId,
|
|
2702
2645
|
variationId
|
|
2703
|
-
}) => {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
};
|
|
2646
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2647
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2648
|
+
)`;
|
|
2707
2649
|
|
|
2708
2650
|
// src/components/inlined-script.tsx
|
|
2709
2651
|
function InlinedScript(props) {
|
|
2710
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2652
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2711
2653
|
}
|
|
2712
2654
|
var Inlined_script_default = InlinedScript;
|
|
2713
2655
|
|
|
2714
2656
|
// src/components/content/components/enable-editor.tsx
|
|
2715
|
-
import { Show as
|
|
2657
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2716
2658
|
|
|
2717
2659
|
// src/helpers/preview-lru-cache/get.ts
|
|
2718
2660
|
function getPreviewContent(_searchParams) {
|
|
@@ -3194,7 +3136,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3194
3136
|
};
|
|
3195
3137
|
|
|
3196
3138
|
// src/constants/sdk-version.ts
|
|
3197
|
-
var SDK_VERSION = "0.7.
|
|
3139
|
+
var SDK_VERSION = "0.7.4";
|
|
3198
3140
|
|
|
3199
3141
|
// src/functions/register.ts
|
|
3200
3142
|
var registry = {};
|
|
@@ -3328,11 +3270,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3328
3270
|
|
|
3329
3271
|
// src/components/content/components/enable-editor.tsx
|
|
3330
3272
|
function EnableEditor(props) {
|
|
3331
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3332
|
-
const [lastUpdated, setLastUpdated] =
|
|
3333
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3334
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3335
|
-
const [clicked, setClicked] =
|
|
3273
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3274
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3275
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3276
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3277
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3336
3278
|
function mergeNewContent(newContent) {
|
|
3337
3279
|
const newContentValue = {
|
|
3338
3280
|
...props.builderContextSignal.content,
|
|
@@ -3574,8 +3516,8 @@ function EnableEditor(props) {
|
|
|
3574
3516
|
emitStateUpdate();
|
|
3575
3517
|
}
|
|
3576
3518
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3577
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3578
|
-
class={props.
|
|
3519
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3520
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3579
3521
|
{...{}}
|
|
3580
3522
|
key={forceReRenderCount()}
|
|
3581
3523
|
ref={elementRef}
|
|
@@ -3587,12 +3529,12 @@ function EnableEditor(props) {
|
|
|
3587
3529
|
hidden: true,
|
|
3588
3530
|
"aria-hidden": true
|
|
3589
3531
|
}}
|
|
3590
|
-
>{props.children}</div></
|
|
3532
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3591
3533
|
}
|
|
3592
3534
|
var Enable_editor_default = EnableEditor;
|
|
3593
3535
|
|
|
3594
3536
|
// src/components/content/components/styles.tsx
|
|
3595
|
-
import { createSignal as
|
|
3537
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3596
3538
|
|
|
3597
3539
|
// src/components/content/components/styles.helpers.ts
|
|
3598
3540
|
var getCssFromFont = (font) => {
|
|
@@ -3651,7 +3593,7 @@ var getCss = ({
|
|
|
3651
3593
|
|
|
3652
3594
|
// src/components/content/components/styles.tsx
|
|
3653
3595
|
function ContentStyles(props) {
|
|
3654
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3596
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3655
3597
|
`
|
|
3656
3598
|
${getCss({
|
|
3657
3599
|
cssCode: props.cssCode,
|
|
@@ -3719,15 +3661,15 @@ var getContentInitialValue = ({
|
|
|
3719
3661
|
|
|
3720
3662
|
// src/components/content/content.tsx
|
|
3721
3663
|
function ContentComponent(props) {
|
|
3722
|
-
const [scriptStr, setScriptStr] =
|
|
3723
|
-
|
|
3664
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3665
|
+
getUpdateVariantVisibilityScript({
|
|
3724
3666
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3725
3667
|
variationId: props.content?.testVariationId,
|
|
3726
3668
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3727
3669
|
contentId: props.content?.id
|
|
3728
3670
|
})
|
|
3729
3671
|
);
|
|
3730
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3672
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3731
3673
|
[
|
|
3732
3674
|
...getDefaultRegisteredComponents(),
|
|
3733
3675
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3748,7 +3690,7 @@ function ContentComponent(props) {
|
|
|
3748
3690
|
{}
|
|
3749
3691
|
)
|
|
3750
3692
|
);
|
|
3751
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3693
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3752
3694
|
content: getContentInitialValue({
|
|
3753
3695
|
content: props.content,
|
|
3754
3696
|
data: props.data
|
|
@@ -3800,19 +3742,18 @@ function ContentComponent(props) {
|
|
|
3800
3742
|
locale={props.locale}
|
|
3801
3743
|
includeRefs={props.includeRefs}
|
|
3802
3744
|
enrich={props.enrich}
|
|
3803
|
-
classNameProp={props.classNameProp}
|
|
3804
3745
|
showContent={props.showContent}
|
|
3805
3746
|
builderContextSignal={builderContextSignal()}
|
|
3806
3747
|
{...{
|
|
3807
3748
|
setBuilderContextSignal
|
|
3808
3749
|
}}
|
|
3809
3750
|
>
|
|
3810
|
-
<
|
|
3811
|
-
<
|
|
3751
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3752
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3812
3753
|
contentId={builderContextSignal().content?.id}
|
|
3813
3754
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3814
3755
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3815
|
-
/></
|
|
3756
|
+
/></Show11>
|
|
3816
3757
|
<Blocks_default
|
|
3817
3758
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3818
3759
|
context={builderContextSignal()}
|
|
@@ -3824,14 +3765,14 @@ var Content_default = ContentComponent;
|
|
|
3824
3765
|
|
|
3825
3766
|
// src/components/content-variants/content-variants.tsx
|
|
3826
3767
|
function ContentVariants(props) {
|
|
3827
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3828
|
-
|
|
3768
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3769
|
+
checkShouldRenderVariants({
|
|
3829
3770
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3830
3771
|
content: props.content
|
|
3831
3772
|
})
|
|
3832
3773
|
);
|
|
3833
|
-
function
|
|
3834
|
-
return
|
|
3774
|
+
function updateCookieAndStylesScriptStr() {
|
|
3775
|
+
return getUpdateCookieAndStylesScript(
|
|
3835
3776
|
getVariants(props.content).map((value) => ({
|
|
3836
3777
|
id: value.testVariationId,
|
|
3837
3778
|
testRatio: value.testRatio
|
|
@@ -3855,20 +3796,21 @@ function ContentVariants(props) {
|
|
|
3855
3796
|
setShouldRenderVariants(false);
|
|
3856
3797
|
});
|
|
3857
3798
|
return <>
|
|
3858
|
-
<
|
|
3859
|
-
<
|
|
3799
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3800
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3860
3801
|
<Inlined_styles_default
|
|
3861
3802
|
id={`variants-styles-${props.content?.id}`}
|
|
3862
3803
|
styles={hideVariantsStyleString()}
|
|
3863
3804
|
/>
|
|
3864
|
-
<Inlined_script_default
|
|
3805
|
+
<Inlined_script_default
|
|
3806
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3807
|
+
/>
|
|
3865
3808
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3866
3809
|
const index = _index();
|
|
3867
3810
|
return <Content_default
|
|
3868
3811
|
key={variant.testVariationId}
|
|
3869
3812
|
content={variant}
|
|
3870
3813
|
showContent={false}
|
|
3871
|
-
classNameProp={void 0}
|
|
3872
3814
|
model={props.model}
|
|
3873
3815
|
data={props.data}
|
|
3874
3816
|
context={props.context}
|
|
@@ -3882,11 +3824,10 @@ function ContentVariants(props) {
|
|
|
3882
3824
|
isSsrAbTest={shouldRenderVariants()}
|
|
3883
3825
|
/>;
|
|
3884
3826
|
}}</For5>
|
|
3885
|
-
</
|
|
3827
|
+
</Show12>
|
|
3886
3828
|
<Content_default
|
|
3887
3829
|
{...{}}
|
|
3888
3830
|
content={defaultContent()}
|
|
3889
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3890
3831
|
showContent={true}
|
|
3891
3832
|
model={props.model}
|
|
3892
3833
|
data={props.data}
|
|
@@ -3930,7 +3871,7 @@ var fetchSymbolContent = async ({
|
|
|
3930
3871
|
|
|
3931
3872
|
// src/blocks/symbol/symbol.tsx
|
|
3932
3873
|
function Symbol(props) {
|
|
3933
|
-
const [contentToUse, setContentToUse] =
|
|
3874
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3934
3875
|
function className() {
|
|
3935
3876
|
return [
|
|
3936
3877
|
...[props.attributes.class],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-solid",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"typesVersions": {},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"release": "npm publish",
|
|
76
|
+
"build-inline-fns": "yarn g:build-inline-fns",
|
|
76
77
|
"build": "nx run-many -p @builder.io/sdk-solid -t build:node build:edge build:browser",
|
|
77
78
|
"build:one": "tsup",
|
|
78
79
|
"build:node": "SDK_ENV=node yarn build:one",
|
|
@@ -102,8 +103,14 @@
|
|
|
102
103
|
],
|
|
103
104
|
"nx": {
|
|
104
105
|
"targets": {
|
|
106
|
+
"build-inline-fns": {
|
|
107
|
+
"dependsOn": [
|
|
108
|
+
"^build:solid"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
105
111
|
"build": {
|
|
106
112
|
"dependsOn": [
|
|
113
|
+
"build-inline-fns",
|
|
107
114
|
"^build:solid",
|
|
108
115
|
"^build"
|
|
109
116
|
],
|