@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/index.jsx
CHANGED
|
@@ -996,7 +996,7 @@ function Block(props) {
|
|
|
996
996
|
});
|
|
997
997
|
}
|
|
998
998
|
function processedBlock() {
|
|
999
|
-
return
|
|
999
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1000
1000
|
block: props.block,
|
|
1001
1001
|
localState: props.context.localState,
|
|
1002
1002
|
rootState: props.context.rootState,
|
|
@@ -1015,6 +1015,9 @@ function Block(props) {
|
|
|
1015
1015
|
if ("show" in processedBlock()) {
|
|
1016
1016
|
return processedBlock().show;
|
|
1017
1017
|
}
|
|
1018
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1018
1021
|
return true;
|
|
1019
1022
|
}
|
|
1020
1023
|
function childrenWithoutParentComponent() {
|
|
@@ -1487,10 +1490,10 @@ function SectionComponent(props) {
|
|
|
1487
1490
|
var section_default = SectionComponent;
|
|
1488
1491
|
|
|
1489
1492
|
// src/blocks/symbol/symbol.tsx
|
|
1490
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1493
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1491
1494
|
|
|
1492
1495
|
// src/components/content-variants/content-variants.tsx
|
|
1493
|
-
import { Show as
|
|
1496
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1494
1497
|
|
|
1495
1498
|
// src/helpers/url.ts
|
|
1496
1499
|
var getTopLevelDomain = (host) => {
|
|
@@ -1684,7 +1687,7 @@ var handleABTesting = async ({
|
|
|
1684
1687
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1685
1688
|
|
|
1686
1689
|
// src/components/content/content.tsx
|
|
1687
|
-
import { Show as
|
|
1690
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1688
1691
|
|
|
1689
1692
|
// src/blocks/button/component-info.ts
|
|
1690
1693
|
var componentInfo = {
|
|
@@ -2456,6 +2459,7 @@ var componentInfo11 = {
|
|
|
2456
2459
|
};
|
|
2457
2460
|
|
|
2458
2461
|
// src/blocks/video/video.tsx
|
|
2462
|
+
import { Show as Show9 } from "solid-js";
|
|
2459
2463
|
function Video(props) {
|
|
2460
2464
|
function videoProps() {
|
|
2461
2465
|
return {
|
|
@@ -2478,26 +2482,66 @@ function Video(props) {
|
|
|
2478
2482
|
}
|
|
2479
2483
|
function spreadProps() {
|
|
2480
2484
|
return {
|
|
2481
|
-
...props.attributes,
|
|
2482
2485
|
...videoProps()
|
|
2483
2486
|
};
|
|
2484
2487
|
}
|
|
2485
|
-
return <
|
|
2486
|
-
{...spreadProps()}
|
|
2487
|
-
preload={props.preload || "metadata"}
|
|
2488
|
+
return <div
|
|
2488
2489
|
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
|
|
2490
|
+
position: "relative"
|
|
2497
2491
|
}}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2492
|
+
>
|
|
2493
|
+
<video
|
|
2494
|
+
class="builder-video"
|
|
2495
|
+
{...spreadProps()}
|
|
2496
|
+
preload={props.preload || "metadata"}
|
|
2497
|
+
style={{
|
|
2498
|
+
width: "100%",
|
|
2499
|
+
height: "100%",
|
|
2500
|
+
...props.attributes?.style,
|
|
2501
|
+
"object-fit": props.fit,
|
|
2502
|
+
"object-position": props.position,
|
|
2503
|
+
// Hack to get object fit to work as expected and
|
|
2504
|
+
// not have the video overflow
|
|
2505
|
+
"z-index": 2,
|
|
2506
|
+
"border-radius": "1px",
|
|
2507
|
+
...props.aspectRatio ? {
|
|
2508
|
+
position: "absolute"
|
|
2509
|
+
} : null
|
|
2510
|
+
}}
|
|
2511
|
+
src={props.video || "no-src"}
|
|
2512
|
+
poster={props.posterImage}
|
|
2513
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2514
|
+
<Show9
|
|
2515
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2516
|
+
><div
|
|
2517
|
+
style={{
|
|
2518
|
+
width: "100%",
|
|
2519
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2520
|
+
"pointer-events": "none",
|
|
2521
|
+
"font-size": "0px"
|
|
2522
|
+
}}
|
|
2523
|
+
/></Show9>
|
|
2524
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2525
|
+
style={{
|
|
2526
|
+
display: "flex",
|
|
2527
|
+
"flex-direction": "column",
|
|
2528
|
+
"align-items": "stretch"
|
|
2529
|
+
}}
|
|
2530
|
+
>{props.children}</div></Show9>
|
|
2531
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2532
|
+
style={{
|
|
2533
|
+
"pointer-events": "none",
|
|
2534
|
+
display: "flex",
|
|
2535
|
+
"flex-direction": "column",
|
|
2536
|
+
"align-items": "stretch",
|
|
2537
|
+
position: "absolute",
|
|
2538
|
+
top: "0",
|
|
2539
|
+
left: "0",
|
|
2540
|
+
width: "100%",
|
|
2541
|
+
height: "100%"
|
|
2542
|
+
}}
|
|
2543
|
+
>{props.children}</div></Show9>
|
|
2544
|
+
</div>;
|
|
2501
2545
|
}
|
|
2502
2546
|
var video_default = Video;
|
|
2503
2547
|
|
|
@@ -2560,13 +2604,19 @@ var serializeComponentInfo = ({
|
|
|
2560
2604
|
}), {}))
|
|
2561
2605
|
});
|
|
2562
2606
|
|
|
2607
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2608
|
+
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}";
|
|
2609
|
+
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}";
|
|
2610
|
+
|
|
2563
2611
|
// src/components/content-variants/helpers.ts
|
|
2612
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2613
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2564
2614
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2565
2615
|
...variant,
|
|
2566
2616
|
testVariationId: variant.id,
|
|
2567
2617
|
id: content?.id
|
|
2568
2618
|
}));
|
|
2569
|
-
var
|
|
2619
|
+
var checkShouldRenderVariants = ({
|
|
2570
2620
|
canTrack,
|
|
2571
2621
|
content
|
|
2572
2622
|
}) => {
|
|
@@ -2577,142 +2627,37 @@ var checkShouldRunVariants = ({
|
|
|
2577
2627
|
return false;
|
|
2578
2628
|
if (!canTrack)
|
|
2579
2629
|
return false;
|
|
2580
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2630
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2581
2631
|
return true;
|
|
2582
2632
|
if (isBrowser())
|
|
2583
2633
|
return false;
|
|
2584
2634
|
return true;
|
|
2585
2635
|
};
|
|
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
2636
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2685
2637
|
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}
|
|
2638
|
+
var getScriptString = () => `
|
|
2639
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2640
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2694
2641
|
`;
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
var getRenderContentScriptString = ({
|
|
2642
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2643
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2644
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2645
|
+
)`;
|
|
2646
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2701
2647
|
contentId,
|
|
2702
2648
|
variationId
|
|
2703
|
-
}) => {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
};
|
|
2649
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2650
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2651
|
+
)`;
|
|
2707
2652
|
|
|
2708
2653
|
// src/components/inlined-script.tsx
|
|
2709
2654
|
function InlinedScript(props) {
|
|
2710
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2655
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2711
2656
|
}
|
|
2712
2657
|
var Inlined_script_default = InlinedScript;
|
|
2713
2658
|
|
|
2714
2659
|
// src/components/content/components/enable-editor.tsx
|
|
2715
|
-
import { Show as
|
|
2660
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2716
2661
|
|
|
2717
2662
|
// src/helpers/preview-lru-cache/get.ts
|
|
2718
2663
|
function getPreviewContent(_searchParams) {
|
|
@@ -3194,7 +3139,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3194
3139
|
};
|
|
3195
3140
|
|
|
3196
3141
|
// src/constants/sdk-version.ts
|
|
3197
|
-
var SDK_VERSION = "0.7.
|
|
3142
|
+
var SDK_VERSION = "0.7.5";
|
|
3198
3143
|
|
|
3199
3144
|
// src/functions/register.ts
|
|
3200
3145
|
var registry = {};
|
|
@@ -3328,11 +3273,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3328
3273
|
|
|
3329
3274
|
// src/components/content/components/enable-editor.tsx
|
|
3330
3275
|
function EnableEditor(props) {
|
|
3331
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3332
|
-
const [lastUpdated, setLastUpdated] =
|
|
3333
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3334
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3335
|
-
const [clicked, setClicked] =
|
|
3276
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3277
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3278
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3279
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3280
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3336
3281
|
function mergeNewContent(newContent) {
|
|
3337
3282
|
const newContentValue = {
|
|
3338
3283
|
...props.builderContextSignal.content,
|
|
@@ -3574,8 +3519,8 @@ function EnableEditor(props) {
|
|
|
3574
3519
|
emitStateUpdate();
|
|
3575
3520
|
}
|
|
3576
3521
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3577
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3578
|
-
class={props.
|
|
3522
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3523
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3579
3524
|
{...{}}
|
|
3580
3525
|
key={forceReRenderCount()}
|
|
3581
3526
|
ref={elementRef}
|
|
@@ -3587,12 +3532,12 @@ function EnableEditor(props) {
|
|
|
3587
3532
|
hidden: true,
|
|
3588
3533
|
"aria-hidden": true
|
|
3589
3534
|
}}
|
|
3590
|
-
>{props.children}</div></
|
|
3535
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3591
3536
|
}
|
|
3592
3537
|
var Enable_editor_default = EnableEditor;
|
|
3593
3538
|
|
|
3594
3539
|
// src/components/content/components/styles.tsx
|
|
3595
|
-
import { createSignal as
|
|
3540
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3596
3541
|
|
|
3597
3542
|
// src/components/content/components/styles.helpers.ts
|
|
3598
3543
|
var getCssFromFont = (font) => {
|
|
@@ -3651,7 +3596,7 @@ var getCss = ({
|
|
|
3651
3596
|
|
|
3652
3597
|
// src/components/content/components/styles.tsx
|
|
3653
3598
|
function ContentStyles(props) {
|
|
3654
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3599
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3655
3600
|
`
|
|
3656
3601
|
${getCss({
|
|
3657
3602
|
cssCode: props.cssCode,
|
|
@@ -3686,22 +3631,20 @@ var getContextStateInitialValue = ({
|
|
|
3686
3631
|
locale
|
|
3687
3632
|
}) => {
|
|
3688
3633
|
const defaultValues = {};
|
|
3634
|
+
const initialState = content?.data?.state || {};
|
|
3689
3635
|
content?.data?.inputs?.forEach((input) => {
|
|
3690
|
-
if (input.name && input.defaultValue !== void 0
|
|
3636
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
3691
3637
|
defaultValues[input.name] = input.defaultValue;
|
|
3692
3638
|
}
|
|
3693
3639
|
});
|
|
3694
|
-
|
|
3695
|
-
...
|
|
3640
|
+
return {
|
|
3641
|
+
...defaultValues,
|
|
3642
|
+
...initialState,
|
|
3696
3643
|
...data,
|
|
3697
3644
|
...locale ? {
|
|
3698
3645
|
locale
|
|
3699
3646
|
} : {}
|
|
3700
3647
|
};
|
|
3701
|
-
return {
|
|
3702
|
-
...defaultValues,
|
|
3703
|
-
...stateToUse
|
|
3704
|
-
};
|
|
3705
3648
|
};
|
|
3706
3649
|
var getContentInitialValue = ({
|
|
3707
3650
|
content,
|
|
@@ -3719,15 +3662,15 @@ var getContentInitialValue = ({
|
|
|
3719
3662
|
|
|
3720
3663
|
// src/components/content/content.tsx
|
|
3721
3664
|
function ContentComponent(props) {
|
|
3722
|
-
const [scriptStr, setScriptStr] =
|
|
3723
|
-
|
|
3665
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3666
|
+
getUpdateVariantVisibilityScript({
|
|
3724
3667
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3725
3668
|
variationId: props.content?.testVariationId,
|
|
3726
3669
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3727
3670
|
contentId: props.content?.id
|
|
3728
3671
|
})
|
|
3729
3672
|
);
|
|
3730
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3673
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3731
3674
|
[
|
|
3732
3675
|
...getDefaultRegisteredComponents(),
|
|
3733
3676
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3748,7 +3691,7 @@ function ContentComponent(props) {
|
|
|
3748
3691
|
{}
|
|
3749
3692
|
)
|
|
3750
3693
|
);
|
|
3751
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3694
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3752
3695
|
content: getContentInitialValue({
|
|
3753
3696
|
content: props.content,
|
|
3754
3697
|
data: props.data
|
|
@@ -3800,19 +3743,18 @@ function ContentComponent(props) {
|
|
|
3800
3743
|
locale={props.locale}
|
|
3801
3744
|
includeRefs={props.includeRefs}
|
|
3802
3745
|
enrich={props.enrich}
|
|
3803
|
-
classNameProp={props.classNameProp}
|
|
3804
3746
|
showContent={props.showContent}
|
|
3805
3747
|
builderContextSignal={builderContextSignal()}
|
|
3806
3748
|
{...{
|
|
3807
3749
|
setBuilderContextSignal
|
|
3808
3750
|
}}
|
|
3809
3751
|
>
|
|
3810
|
-
<
|
|
3811
|
-
<
|
|
3752
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3753
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3812
3754
|
contentId={builderContextSignal().content?.id}
|
|
3813
3755
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3814
3756
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3815
|
-
/></
|
|
3757
|
+
/></Show11>
|
|
3816
3758
|
<Blocks_default
|
|
3817
3759
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3818
3760
|
context={builderContextSignal()}
|
|
@@ -3824,14 +3766,14 @@ var Content_default = ContentComponent;
|
|
|
3824
3766
|
|
|
3825
3767
|
// src/components/content-variants/content-variants.tsx
|
|
3826
3768
|
function ContentVariants(props) {
|
|
3827
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3828
|
-
|
|
3769
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3770
|
+
checkShouldRenderVariants({
|
|
3829
3771
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3830
3772
|
content: props.content
|
|
3831
3773
|
})
|
|
3832
3774
|
);
|
|
3833
|
-
function
|
|
3834
|
-
return
|
|
3775
|
+
function updateCookieAndStylesScriptStr() {
|
|
3776
|
+
return getUpdateCookieAndStylesScript(
|
|
3835
3777
|
getVariants(props.content).map((value) => ({
|
|
3836
3778
|
id: value.testVariationId,
|
|
3837
3779
|
testRatio: value.testRatio
|
|
@@ -3855,20 +3797,21 @@ function ContentVariants(props) {
|
|
|
3855
3797
|
setShouldRenderVariants(false);
|
|
3856
3798
|
});
|
|
3857
3799
|
return <>
|
|
3858
|
-
<
|
|
3859
|
-
<
|
|
3800
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3801
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3860
3802
|
<Inlined_styles_default
|
|
3861
3803
|
id={`variants-styles-${props.content?.id}`}
|
|
3862
3804
|
styles={hideVariantsStyleString()}
|
|
3863
3805
|
/>
|
|
3864
|
-
<Inlined_script_default
|
|
3806
|
+
<Inlined_script_default
|
|
3807
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3808
|
+
/>
|
|
3865
3809
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3866
3810
|
const index = _index();
|
|
3867
3811
|
return <Content_default
|
|
3868
3812
|
key={variant.testVariationId}
|
|
3869
3813
|
content={variant}
|
|
3870
3814
|
showContent={false}
|
|
3871
|
-
classNameProp={void 0}
|
|
3872
3815
|
model={props.model}
|
|
3873
3816
|
data={props.data}
|
|
3874
3817
|
context={props.context}
|
|
@@ -3882,11 +3825,10 @@ function ContentVariants(props) {
|
|
|
3882
3825
|
isSsrAbTest={shouldRenderVariants()}
|
|
3883
3826
|
/>;
|
|
3884
3827
|
}}</For5>
|
|
3885
|
-
</
|
|
3828
|
+
</Show12>
|
|
3886
3829
|
<Content_default
|
|
3887
3830
|
{...{}}
|
|
3888
3831
|
content={defaultContent()}
|
|
3889
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3890
3832
|
showContent={true}
|
|
3891
3833
|
model={props.model}
|
|
3892
3834
|
data={props.data}
|
|
@@ -3930,7 +3872,7 @@ var fetchSymbolContent = async ({
|
|
|
3930
3872
|
|
|
3931
3873
|
// src/blocks/symbol/symbol.tsx
|
|
3932
3874
|
function Symbol(props) {
|
|
3933
|
-
const [contentToUse, setContentToUse] =
|
|
3875
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3934
3876
|
function className() {
|
|
3935
3877
|
return [
|
|
3936
3878
|
...[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.5",
|
|
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
|
],
|