@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/browser/index.jsx
CHANGED
|
@@ -1367,10 +1367,10 @@ function SectionComponent(props) {
|
|
|
1367
1367
|
var section_default = SectionComponent;
|
|
1368
1368
|
|
|
1369
1369
|
// src/blocks/symbol/symbol.tsx
|
|
1370
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1370
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1371
1371
|
|
|
1372
1372
|
// src/components/content-variants/content-variants.tsx
|
|
1373
|
-
import { Show as
|
|
1373
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1374
1374
|
|
|
1375
1375
|
// src/helpers/url.ts
|
|
1376
1376
|
var getTopLevelDomain = (host) => {
|
|
@@ -1564,7 +1564,7 @@ var handleABTesting = async ({
|
|
|
1564
1564
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1565
1565
|
|
|
1566
1566
|
// src/components/content/content.tsx
|
|
1567
|
-
import { Show as
|
|
1567
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1568
1568
|
|
|
1569
1569
|
// src/blocks/button/component-info.ts
|
|
1570
1570
|
var componentInfo = {
|
|
@@ -2336,6 +2336,7 @@ var componentInfo11 = {
|
|
|
2336
2336
|
};
|
|
2337
2337
|
|
|
2338
2338
|
// src/blocks/video/video.tsx
|
|
2339
|
+
import { Show as Show9 } from "solid-js";
|
|
2339
2340
|
function Video(props) {
|
|
2340
2341
|
function videoProps() {
|
|
2341
2342
|
return {
|
|
@@ -2358,26 +2359,66 @@ function Video(props) {
|
|
|
2358
2359
|
}
|
|
2359
2360
|
function spreadProps() {
|
|
2360
2361
|
return {
|
|
2361
|
-
...props.attributes,
|
|
2362
2362
|
...videoProps()
|
|
2363
2363
|
};
|
|
2364
2364
|
}
|
|
2365
|
-
return <
|
|
2366
|
-
{...spreadProps()}
|
|
2367
|
-
preload={props.preload || "metadata"}
|
|
2365
|
+
return <div
|
|
2368
2366
|
style={{
|
|
2369
|
-
|
|
2370
|
-
height: "100%",
|
|
2371
|
-
...props.attributes?.style,
|
|
2372
|
-
"object-fit": props.fit,
|
|
2373
|
-
"object-position": props.position,
|
|
2374
|
-
// Hack to get object fit to work as expected and
|
|
2375
|
-
// not have the video overflow
|
|
2376
|
-
"border-radius": 1
|
|
2367
|
+
position: "relative"
|
|
2377
2368
|
}}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2369
|
+
>
|
|
2370
|
+
<video
|
|
2371
|
+
class="builder-video"
|
|
2372
|
+
{...spreadProps()}
|
|
2373
|
+
preload={props.preload || "metadata"}
|
|
2374
|
+
style={{
|
|
2375
|
+
width: "100%",
|
|
2376
|
+
height: "100%",
|
|
2377
|
+
...props.attributes?.style,
|
|
2378
|
+
"object-fit": props.fit,
|
|
2379
|
+
"object-position": props.position,
|
|
2380
|
+
// Hack to get object fit to work as expected and
|
|
2381
|
+
// not have the video overflow
|
|
2382
|
+
"z-index": 2,
|
|
2383
|
+
"border-radius": "1px",
|
|
2384
|
+
...props.aspectRatio ? {
|
|
2385
|
+
position: "absolute"
|
|
2386
|
+
} : null
|
|
2387
|
+
}}
|
|
2388
|
+
src={props.video || "no-src"}
|
|
2389
|
+
poster={props.posterImage}
|
|
2390
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2391
|
+
<Show9
|
|
2392
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2393
|
+
><div
|
|
2394
|
+
style={{
|
|
2395
|
+
width: "100%",
|
|
2396
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2397
|
+
"pointer-events": "none",
|
|
2398
|
+
"font-size": "0px"
|
|
2399
|
+
}}
|
|
2400
|
+
/></Show9>
|
|
2401
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2402
|
+
style={{
|
|
2403
|
+
display: "flex",
|
|
2404
|
+
"flex-direction": "column",
|
|
2405
|
+
"align-items": "stretch"
|
|
2406
|
+
}}
|
|
2407
|
+
>{props.children}</div></Show9>
|
|
2408
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2409
|
+
style={{
|
|
2410
|
+
"pointer-events": "none",
|
|
2411
|
+
display: "flex",
|
|
2412
|
+
"flex-direction": "column",
|
|
2413
|
+
"align-items": "stretch",
|
|
2414
|
+
position: "absolute",
|
|
2415
|
+
top: "0",
|
|
2416
|
+
left: "0",
|
|
2417
|
+
width: "100%",
|
|
2418
|
+
height: "100%"
|
|
2419
|
+
}}
|
|
2420
|
+
>{props.children}</div></Show9>
|
|
2421
|
+
</div>;
|
|
2381
2422
|
}
|
|
2382
2423
|
var video_default = Video;
|
|
2383
2424
|
|
|
@@ -2440,13 +2481,19 @@ var serializeComponentInfo = ({
|
|
|
2440
2481
|
}), {}))
|
|
2441
2482
|
});
|
|
2442
2483
|
|
|
2484
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2485
|
+
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}";
|
|
2486
|
+
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}";
|
|
2487
|
+
|
|
2443
2488
|
// src/components/content-variants/helpers.ts
|
|
2489
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2490
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2444
2491
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2445
2492
|
...variant,
|
|
2446
2493
|
testVariationId: variant.id,
|
|
2447
2494
|
id: content?.id
|
|
2448
2495
|
}));
|
|
2449
|
-
var
|
|
2496
|
+
var checkShouldRenderVariants = ({
|
|
2450
2497
|
canTrack,
|
|
2451
2498
|
content
|
|
2452
2499
|
}) => {
|
|
@@ -2457,142 +2504,37 @@ var checkShouldRunVariants = ({
|
|
|
2457
2504
|
return false;
|
|
2458
2505
|
if (!canTrack)
|
|
2459
2506
|
return false;
|
|
2460
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2507
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2461
2508
|
return true;
|
|
2462
2509
|
if (isBrowser())
|
|
2463
2510
|
return false;
|
|
2464
2511
|
return true;
|
|
2465
2512
|
};
|
|
2466
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2467
|
-
function getAndSetVariantId2() {
|
|
2468
|
-
function setCookie2(name, value, days) {
|
|
2469
|
-
let expires = "";
|
|
2470
|
-
if (days) {
|
|
2471
|
-
const date = /* @__PURE__ */ new Date();
|
|
2472
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2473
|
-
expires = "; expires=" + date.toUTCString();
|
|
2474
|
-
}
|
|
2475
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2476
|
-
}
|
|
2477
|
-
function getCookie2(name) {
|
|
2478
|
-
const nameEQ = name + "=";
|
|
2479
|
-
const ca = document.cookie.split(";");
|
|
2480
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2481
|
-
let c = ca[i];
|
|
2482
|
-
while (c.charAt(0) === " ")
|
|
2483
|
-
c = c.substring(1, c.length);
|
|
2484
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2485
|
-
return c.substring(nameEQ.length, c.length);
|
|
2486
|
-
}
|
|
2487
|
-
return null;
|
|
2488
|
-
}
|
|
2489
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2490
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2491
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2492
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2493
|
-
return variantInCookie;
|
|
2494
|
-
}
|
|
2495
|
-
let n = 0;
|
|
2496
|
-
const random = Math.random();
|
|
2497
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2498
|
-
const variant = variants[i];
|
|
2499
|
-
const testRatio = variant.testRatio;
|
|
2500
|
-
n += testRatio;
|
|
2501
|
-
if (random < n) {
|
|
2502
|
-
setCookie2(cookieName, variant.id);
|
|
2503
|
-
return variant.id;
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
setCookie2(cookieName, contentId);
|
|
2507
|
-
return contentId;
|
|
2508
|
-
}
|
|
2509
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2510
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2511
|
-
if (isHydrationTarget2) {
|
|
2512
|
-
styleEl.remove();
|
|
2513
|
-
const thisScriptEl = document.currentScript;
|
|
2514
|
-
thisScriptEl?.remove();
|
|
2515
|
-
} else {
|
|
2516
|
-
const newStyleStr = variants.concat({
|
|
2517
|
-
id: contentId
|
|
2518
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2519
|
-
return `.variant-${value.id} { display: none; }
|
|
2520
|
-
`;
|
|
2521
|
-
}).join("");
|
|
2522
|
-
styleEl.innerHTML = newStyleStr;
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2526
|
-
if (!navigator.cookieEnabled) {
|
|
2527
|
-
return;
|
|
2528
|
-
}
|
|
2529
|
-
function getCookie2(name) {
|
|
2530
|
-
const nameEQ = name + "=";
|
|
2531
|
-
const ca = document.cookie.split(";");
|
|
2532
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2533
|
-
let c = ca[i];
|
|
2534
|
-
while (c.charAt(0) === " ")
|
|
2535
|
-
c = c.substring(1, c.length);
|
|
2536
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2537
|
-
return c.substring(nameEQ.length, c.length);
|
|
2538
|
-
}
|
|
2539
|
-
return null;
|
|
2540
|
-
}
|
|
2541
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2542
|
-
const variantId = getCookie2(cookieName);
|
|
2543
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2544
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2545
|
-
if (variantId === variantContentId) {
|
|
2546
|
-
if (variantIsDefaultContent) {
|
|
2547
|
-
return;
|
|
2548
|
-
}
|
|
2549
|
-
parentDiv?.removeAttribute("hidden");
|
|
2550
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2551
|
-
} else {
|
|
2552
|
-
if (variantIsDefaultContent) {
|
|
2553
|
-
if (isHydrationTarget2) {
|
|
2554
|
-
parentDiv?.remove();
|
|
2555
|
-
} else {
|
|
2556
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2557
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
return;
|
|
2561
|
-
}
|
|
2562
|
-
return;
|
|
2563
|
-
}
|
|
2564
2513
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2565
2514
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2566
|
-
var
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2570
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2571
|
-
return `
|
|
2572
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2573
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2515
|
+
var getScriptString = () => `
|
|
2516
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2517
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2574
2518
|
`;
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
var getRenderContentScriptString = ({
|
|
2519
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2520
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2521
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2522
|
+
)`;
|
|
2523
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2581
2524
|
contentId,
|
|
2582
2525
|
variationId
|
|
2583
|
-
}) => {
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
};
|
|
2526
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2527
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2528
|
+
)`;
|
|
2587
2529
|
|
|
2588
2530
|
// src/components/inlined-script.tsx
|
|
2589
2531
|
function InlinedScript(props) {
|
|
2590
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2532
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2591
2533
|
}
|
|
2592
2534
|
var Inlined_script_default = InlinedScript;
|
|
2593
2535
|
|
|
2594
2536
|
// src/components/content/components/enable-editor.tsx
|
|
2595
|
-
import { Show as
|
|
2537
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2596
2538
|
|
|
2597
2539
|
// src/helpers/preview-lru-cache/get.ts
|
|
2598
2540
|
function getPreviewContent(_searchParams) {
|
|
@@ -3074,7 +3016,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3074
3016
|
};
|
|
3075
3017
|
|
|
3076
3018
|
// src/constants/sdk-version.ts
|
|
3077
|
-
var SDK_VERSION = "0.7.
|
|
3019
|
+
var SDK_VERSION = "0.7.4";
|
|
3078
3020
|
|
|
3079
3021
|
// src/functions/register.ts
|
|
3080
3022
|
var registry = {};
|
|
@@ -3208,11 +3150,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3208
3150
|
|
|
3209
3151
|
// src/components/content/components/enable-editor.tsx
|
|
3210
3152
|
function EnableEditor(props) {
|
|
3211
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3212
|
-
const [lastUpdated, setLastUpdated] =
|
|
3213
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3214
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3215
|
-
const [clicked, setClicked] =
|
|
3153
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3154
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3155
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3156
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3157
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3216
3158
|
function mergeNewContent(newContent) {
|
|
3217
3159
|
const newContentValue = {
|
|
3218
3160
|
...props.builderContextSignal.content,
|
|
@@ -3454,8 +3396,8 @@ function EnableEditor(props) {
|
|
|
3454
3396
|
emitStateUpdate();
|
|
3455
3397
|
}
|
|
3456
3398
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3457
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3458
|
-
class={props.
|
|
3399
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3400
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3459
3401
|
{...{}}
|
|
3460
3402
|
key={forceReRenderCount()}
|
|
3461
3403
|
ref={elementRef}
|
|
@@ -3467,12 +3409,12 @@ function EnableEditor(props) {
|
|
|
3467
3409
|
hidden: true,
|
|
3468
3410
|
"aria-hidden": true
|
|
3469
3411
|
}}
|
|
3470
|
-
>{props.children}</div></
|
|
3412
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3471
3413
|
}
|
|
3472
3414
|
var Enable_editor_default = EnableEditor;
|
|
3473
3415
|
|
|
3474
3416
|
// src/components/content/components/styles.tsx
|
|
3475
|
-
import { createSignal as
|
|
3417
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3476
3418
|
|
|
3477
3419
|
// src/components/content/components/styles.helpers.ts
|
|
3478
3420
|
var getCssFromFont = (font) => {
|
|
@@ -3531,7 +3473,7 @@ var getCss = ({
|
|
|
3531
3473
|
|
|
3532
3474
|
// src/components/content/components/styles.tsx
|
|
3533
3475
|
function ContentStyles(props) {
|
|
3534
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3476
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3535
3477
|
`
|
|
3536
3478
|
${getCss({
|
|
3537
3479
|
cssCode: props.cssCode,
|
|
@@ -3599,15 +3541,15 @@ var getContentInitialValue = ({
|
|
|
3599
3541
|
|
|
3600
3542
|
// src/components/content/content.tsx
|
|
3601
3543
|
function ContentComponent(props) {
|
|
3602
|
-
const [scriptStr, setScriptStr] =
|
|
3603
|
-
|
|
3544
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3545
|
+
getUpdateVariantVisibilityScript({
|
|
3604
3546
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3605
3547
|
variationId: props.content?.testVariationId,
|
|
3606
3548
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3607
3549
|
contentId: props.content?.id
|
|
3608
3550
|
})
|
|
3609
3551
|
);
|
|
3610
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3552
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3611
3553
|
[
|
|
3612
3554
|
...getDefaultRegisteredComponents(),
|
|
3613
3555
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3628,7 +3570,7 @@ function ContentComponent(props) {
|
|
|
3628
3570
|
{}
|
|
3629
3571
|
)
|
|
3630
3572
|
);
|
|
3631
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3573
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3632
3574
|
content: getContentInitialValue({
|
|
3633
3575
|
content: props.content,
|
|
3634
3576
|
data: props.data
|
|
@@ -3680,19 +3622,18 @@ function ContentComponent(props) {
|
|
|
3680
3622
|
locale={props.locale}
|
|
3681
3623
|
includeRefs={props.includeRefs}
|
|
3682
3624
|
enrich={props.enrich}
|
|
3683
|
-
classNameProp={props.classNameProp}
|
|
3684
3625
|
showContent={props.showContent}
|
|
3685
3626
|
builderContextSignal={builderContextSignal()}
|
|
3686
3627
|
{...{
|
|
3687
3628
|
setBuilderContextSignal
|
|
3688
3629
|
}}
|
|
3689
3630
|
>
|
|
3690
|
-
<
|
|
3691
|
-
<
|
|
3631
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3632
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3692
3633
|
contentId={builderContextSignal().content?.id}
|
|
3693
3634
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3694
3635
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3695
|
-
/></
|
|
3636
|
+
/></Show11>
|
|
3696
3637
|
<Blocks_default
|
|
3697
3638
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3698
3639
|
context={builderContextSignal()}
|
|
@@ -3704,14 +3645,14 @@ var Content_default = ContentComponent;
|
|
|
3704
3645
|
|
|
3705
3646
|
// src/components/content-variants/content-variants.tsx
|
|
3706
3647
|
function ContentVariants(props) {
|
|
3707
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3708
|
-
|
|
3648
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3649
|
+
checkShouldRenderVariants({
|
|
3709
3650
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3710
3651
|
content: props.content
|
|
3711
3652
|
})
|
|
3712
3653
|
);
|
|
3713
|
-
function
|
|
3714
|
-
return
|
|
3654
|
+
function updateCookieAndStylesScriptStr() {
|
|
3655
|
+
return getUpdateCookieAndStylesScript(
|
|
3715
3656
|
getVariants(props.content).map((value) => ({
|
|
3716
3657
|
id: value.testVariationId,
|
|
3717
3658
|
testRatio: value.testRatio
|
|
@@ -3735,20 +3676,21 @@ function ContentVariants(props) {
|
|
|
3735
3676
|
setShouldRenderVariants(false);
|
|
3736
3677
|
});
|
|
3737
3678
|
return <>
|
|
3738
|
-
<
|
|
3739
|
-
<
|
|
3679
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3680
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3740
3681
|
<Inlined_styles_default
|
|
3741
3682
|
id={`variants-styles-${props.content?.id}`}
|
|
3742
3683
|
styles={hideVariantsStyleString()}
|
|
3743
3684
|
/>
|
|
3744
|
-
<Inlined_script_default
|
|
3685
|
+
<Inlined_script_default
|
|
3686
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3687
|
+
/>
|
|
3745
3688
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3746
3689
|
const index = _index();
|
|
3747
3690
|
return <Content_default
|
|
3748
3691
|
key={variant.testVariationId}
|
|
3749
3692
|
content={variant}
|
|
3750
3693
|
showContent={false}
|
|
3751
|
-
classNameProp={void 0}
|
|
3752
3694
|
model={props.model}
|
|
3753
3695
|
data={props.data}
|
|
3754
3696
|
context={props.context}
|
|
@@ -3762,11 +3704,10 @@ function ContentVariants(props) {
|
|
|
3762
3704
|
isSsrAbTest={shouldRenderVariants()}
|
|
3763
3705
|
/>;
|
|
3764
3706
|
}}</For5>
|
|
3765
|
-
</
|
|
3707
|
+
</Show12>
|
|
3766
3708
|
<Content_default
|
|
3767
3709
|
{...{}}
|
|
3768
3710
|
content={defaultContent()}
|
|
3769
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3770
3711
|
showContent={true}
|
|
3771
3712
|
model={props.model}
|
|
3772
3713
|
data={props.data}
|
|
@@ -3810,7 +3751,7 @@ var fetchSymbolContent = async ({
|
|
|
3810
3751
|
|
|
3811
3752
|
// src/blocks/symbol/symbol.tsx
|
|
3812
3753
|
function Symbol(props) {
|
|
3813
|
-
const [contentToUse, setContentToUse] =
|
|
3754
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3814
3755
|
function className() {
|
|
3815
3756
|
return [
|
|
3816
3757
|
...[props.attributes.class],
|