@builder.io/sdk-solid 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/lib/browser/dev.js +94 -139
- package/lib/browser/dev.jsx +109 -168
- package/lib/browser/index.js +94 -139
- package/lib/browser/index.jsx +109 -168
- package/lib/edge/dev.js +94 -139
- package/lib/edge/dev.jsx +109 -168
- package/lib/edge/index.js +94 -139
- package/lib/edge/index.jsx +109 -168
- package/lib/node/dev.js +94 -139
- package/lib/node/dev.jsx +109 -168
- package/lib/node/index.js +94 -139
- package/lib/node/index.jsx +109 -168
- package/package.json +8 -1
package/lib/browser/dev.jsx
CHANGED
|
@@ -1375,10 +1375,10 @@ function SectionComponent(props) {
|
|
|
1375
1375
|
var section_default = SectionComponent;
|
|
1376
1376
|
|
|
1377
1377
|
// src/blocks/symbol/symbol.tsx
|
|
1378
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1378
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1379
1379
|
|
|
1380
1380
|
// src/components/content-variants/content-variants.tsx
|
|
1381
|
-
import { Show as
|
|
1381
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1382
1382
|
|
|
1383
1383
|
// src/helpers/url.ts
|
|
1384
1384
|
var getTopLevelDomain = (host) => {
|
|
@@ -1572,7 +1572,7 @@ var handleABTesting = async ({
|
|
|
1572
1572
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1573
1573
|
|
|
1574
1574
|
// src/components/content/content.tsx
|
|
1575
|
-
import { Show as
|
|
1575
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1576
1576
|
|
|
1577
1577
|
// src/blocks/button/component-info.ts
|
|
1578
1578
|
var componentInfo = {
|
|
@@ -2347,6 +2347,7 @@ var componentInfo11 = {
|
|
|
2347
2347
|
};
|
|
2348
2348
|
|
|
2349
2349
|
// src/blocks/video/video.tsx
|
|
2350
|
+
import { Show as Show9 } from "solid-js";
|
|
2350
2351
|
function Video(props) {
|
|
2351
2352
|
function videoProps() {
|
|
2352
2353
|
return {
|
|
@@ -2369,26 +2370,66 @@ function Video(props) {
|
|
|
2369
2370
|
}
|
|
2370
2371
|
function spreadProps() {
|
|
2371
2372
|
return {
|
|
2372
|
-
...props.attributes,
|
|
2373
2373
|
...videoProps()
|
|
2374
2374
|
};
|
|
2375
2375
|
}
|
|
2376
|
-
return <
|
|
2377
|
-
{...spreadProps()}
|
|
2378
|
-
preload={props.preload || "metadata"}
|
|
2376
|
+
return <div
|
|
2379
2377
|
style={{
|
|
2380
|
-
|
|
2381
|
-
height: "100%",
|
|
2382
|
-
...props.attributes?.style,
|
|
2383
|
-
"object-fit": props.fit,
|
|
2384
|
-
"object-position": props.position,
|
|
2385
|
-
// Hack to get object fit to work as expected and
|
|
2386
|
-
// not have the video overflow
|
|
2387
|
-
"border-radius": 1
|
|
2378
|
+
position: "relative"
|
|
2388
2379
|
}}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2380
|
+
>
|
|
2381
|
+
<video
|
|
2382
|
+
class="builder-video"
|
|
2383
|
+
{...spreadProps()}
|
|
2384
|
+
preload={props.preload || "metadata"}
|
|
2385
|
+
style={{
|
|
2386
|
+
width: "100%",
|
|
2387
|
+
height: "100%",
|
|
2388
|
+
...props.attributes?.style,
|
|
2389
|
+
"object-fit": props.fit,
|
|
2390
|
+
"object-position": props.position,
|
|
2391
|
+
// Hack to get object fit to work as expected and
|
|
2392
|
+
// not have the video overflow
|
|
2393
|
+
"z-index": 2,
|
|
2394
|
+
"border-radius": "1px",
|
|
2395
|
+
...props.aspectRatio ? {
|
|
2396
|
+
position: "absolute"
|
|
2397
|
+
} : null
|
|
2398
|
+
}}
|
|
2399
|
+
src={props.video || "no-src"}
|
|
2400
|
+
poster={props.posterImage}
|
|
2401
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2402
|
+
<Show9
|
|
2403
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2404
|
+
><div
|
|
2405
|
+
style={{
|
|
2406
|
+
width: "100%",
|
|
2407
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2408
|
+
"pointer-events": "none",
|
|
2409
|
+
"font-size": "0px"
|
|
2410
|
+
}}
|
|
2411
|
+
/></Show9>
|
|
2412
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2413
|
+
style={{
|
|
2414
|
+
display: "flex",
|
|
2415
|
+
"flex-direction": "column",
|
|
2416
|
+
"align-items": "stretch"
|
|
2417
|
+
}}
|
|
2418
|
+
>{props.children}</div></Show9>
|
|
2419
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2420
|
+
style={{
|
|
2421
|
+
"pointer-events": "none",
|
|
2422
|
+
display: "flex",
|
|
2423
|
+
"flex-direction": "column",
|
|
2424
|
+
"align-items": "stretch",
|
|
2425
|
+
position: "absolute",
|
|
2426
|
+
top: "0",
|
|
2427
|
+
left: "0",
|
|
2428
|
+
width: "100%",
|
|
2429
|
+
height: "100%"
|
|
2430
|
+
}}
|
|
2431
|
+
>{props.children}</div></Show9>
|
|
2432
|
+
</div>;
|
|
2392
2433
|
}
|
|
2393
2434
|
var video_default = Video;
|
|
2394
2435
|
|
|
@@ -2451,13 +2492,19 @@ var serializeComponentInfo = ({
|
|
|
2451
2492
|
}), {}))
|
|
2452
2493
|
});
|
|
2453
2494
|
|
|
2495
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2496
|
+
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}";
|
|
2497
|
+
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}";
|
|
2498
|
+
|
|
2454
2499
|
// src/components/content-variants/helpers.ts
|
|
2500
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2501
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2455
2502
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2456
2503
|
...variant,
|
|
2457
2504
|
testVariationId: variant.id,
|
|
2458
2505
|
id: content?.id
|
|
2459
2506
|
}));
|
|
2460
|
-
var
|
|
2507
|
+
var checkShouldRenderVariants = ({
|
|
2461
2508
|
canTrack,
|
|
2462
2509
|
content
|
|
2463
2510
|
}) => {
|
|
@@ -2468,142 +2515,37 @@ var checkShouldRunVariants = ({
|
|
|
2468
2515
|
return false;
|
|
2469
2516
|
if (!canTrack)
|
|
2470
2517
|
return false;
|
|
2471
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2518
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2472
2519
|
return true;
|
|
2473
2520
|
if (isBrowser())
|
|
2474
2521
|
return false;
|
|
2475
2522
|
return true;
|
|
2476
2523
|
};
|
|
2477
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
2478
|
-
function getAndSetVariantId2() {
|
|
2479
|
-
function setCookie2(name, value, days) {
|
|
2480
|
-
let expires = "";
|
|
2481
|
-
if (days) {
|
|
2482
|
-
const date = /* @__PURE__ */ new Date();
|
|
2483
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
2484
|
-
expires = "; expires=" + date.toUTCString();
|
|
2485
|
-
}
|
|
2486
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
2487
|
-
}
|
|
2488
|
-
function getCookie2(name) {
|
|
2489
|
-
const nameEQ = name + "=";
|
|
2490
|
-
const ca = document.cookie.split(";");
|
|
2491
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2492
|
-
let c = ca[i];
|
|
2493
|
-
while (c.charAt(0) === " ")
|
|
2494
|
-
c = c.substring(1, c.length);
|
|
2495
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2496
|
-
return c.substring(nameEQ.length, c.length);
|
|
2497
|
-
}
|
|
2498
|
-
return null;
|
|
2499
|
-
}
|
|
2500
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
2501
|
-
const variantInCookie = getCookie2(cookieName);
|
|
2502
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
2503
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
2504
|
-
return variantInCookie;
|
|
2505
|
-
}
|
|
2506
|
-
let n = 0;
|
|
2507
|
-
const random = Math.random();
|
|
2508
|
-
for (let i = 0; i < variants.length; i++) {
|
|
2509
|
-
const variant = variants[i];
|
|
2510
|
-
const testRatio = variant.testRatio;
|
|
2511
|
-
n += testRatio;
|
|
2512
|
-
if (random < n) {
|
|
2513
|
-
setCookie2(cookieName, variant.id);
|
|
2514
|
-
return variant.id;
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
setCookie2(cookieName, contentId);
|
|
2518
|
-
return contentId;
|
|
2519
|
-
}
|
|
2520
|
-
const winningVariantId = getAndSetVariantId2();
|
|
2521
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
2522
|
-
if (isHydrationTarget2) {
|
|
2523
|
-
styleEl.remove();
|
|
2524
|
-
const thisScriptEl = document.currentScript;
|
|
2525
|
-
thisScriptEl?.remove();
|
|
2526
|
-
} else {
|
|
2527
|
-
const newStyleStr = variants.concat({
|
|
2528
|
-
id: contentId
|
|
2529
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
2530
|
-
return `.variant-${value.id} { display: none; }
|
|
2531
|
-
`;
|
|
2532
|
-
}).join("");
|
|
2533
|
-
styleEl.innerHTML = newStyleStr;
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
2537
|
-
if (!navigator.cookieEnabled) {
|
|
2538
|
-
return;
|
|
2539
|
-
}
|
|
2540
|
-
function getCookie2(name) {
|
|
2541
|
-
const nameEQ = name + "=";
|
|
2542
|
-
const ca = document.cookie.split(";");
|
|
2543
|
-
for (let i = 0; i < ca.length; i++) {
|
|
2544
|
-
let c = ca[i];
|
|
2545
|
-
while (c.charAt(0) === " ")
|
|
2546
|
-
c = c.substring(1, c.length);
|
|
2547
|
-
if (c.indexOf(nameEQ) === 0)
|
|
2548
|
-
return c.substring(nameEQ.length, c.length);
|
|
2549
|
-
}
|
|
2550
|
-
return null;
|
|
2551
|
-
}
|
|
2552
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
2553
|
-
const variantId = getCookie2(cookieName);
|
|
2554
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
2555
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
2556
|
-
if (variantId === variantContentId) {
|
|
2557
|
-
if (variantIsDefaultContent) {
|
|
2558
|
-
return;
|
|
2559
|
-
}
|
|
2560
|
-
parentDiv?.removeAttribute("hidden");
|
|
2561
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
2562
|
-
} else {
|
|
2563
|
-
if (variantIsDefaultContent) {
|
|
2564
|
-
if (isHydrationTarget2) {
|
|
2565
|
-
parentDiv?.remove();
|
|
2566
|
-
} else {
|
|
2567
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
2568
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2573
|
-
return;
|
|
2574
|
-
}
|
|
2575
2524
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2576
2525
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
2577
|
-
var
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
2581
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
2582
|
-
return `
|
|
2583
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
2584
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
2526
|
+
var getScriptString = () => `
|
|
2527
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2528
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2585
2529
|
`;
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
var getRenderContentScriptString = ({
|
|
2530
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2531
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2532
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2533
|
+
)`;
|
|
2534
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2592
2535
|
contentId,
|
|
2593
2536
|
variationId
|
|
2594
|
-
}) => {
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
};
|
|
2537
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2538
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2539
|
+
)`;
|
|
2598
2540
|
|
|
2599
2541
|
// src/components/inlined-script.tsx
|
|
2600
2542
|
function InlinedScript(props) {
|
|
2601
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2543
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2602
2544
|
}
|
|
2603
2545
|
var Inlined_script_default = InlinedScript;
|
|
2604
2546
|
|
|
2605
2547
|
// src/components/content/components/enable-editor.tsx
|
|
2606
|
-
import { Show as
|
|
2548
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2607
2549
|
|
|
2608
2550
|
// src/helpers/preview-lru-cache/get.ts
|
|
2609
2551
|
function getPreviewContent(_searchParams) {
|
|
@@ -3090,7 +3032,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3090
3032
|
};
|
|
3091
3033
|
|
|
3092
3034
|
// src/constants/sdk-version.ts
|
|
3093
|
-
var SDK_VERSION = "0.7.
|
|
3035
|
+
var SDK_VERSION = "0.7.4";
|
|
3094
3036
|
|
|
3095
3037
|
// src/functions/register.ts
|
|
3096
3038
|
var registry = {};
|
|
@@ -3225,11 +3167,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3225
3167
|
|
|
3226
3168
|
// src/components/content/components/enable-editor.tsx
|
|
3227
3169
|
function EnableEditor(props) {
|
|
3228
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3229
|
-
const [lastUpdated, setLastUpdated] =
|
|
3230
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3231
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3232
|
-
const [clicked, setClicked] =
|
|
3170
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3171
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3172
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3173
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3174
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3233
3175
|
function mergeNewContent(newContent) {
|
|
3234
3176
|
const newContentValue = {
|
|
3235
3177
|
...props.builderContextSignal.content,
|
|
@@ -3472,8 +3414,8 @@ function EnableEditor(props) {
|
|
|
3472
3414
|
emitStateUpdate();
|
|
3473
3415
|
}
|
|
3474
3416
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3475
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3476
|
-
class={props.
|
|
3417
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3418
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3477
3419
|
{...{}}
|
|
3478
3420
|
key={forceReRenderCount()}
|
|
3479
3421
|
ref={elementRef}
|
|
@@ -3485,12 +3427,12 @@ function EnableEditor(props) {
|
|
|
3485
3427
|
hidden: true,
|
|
3486
3428
|
"aria-hidden": true
|
|
3487
3429
|
}}
|
|
3488
|
-
>{props.children}</div></
|
|
3430
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3489
3431
|
}
|
|
3490
3432
|
var Enable_editor_default = EnableEditor;
|
|
3491
3433
|
|
|
3492
3434
|
// src/components/content/components/styles.tsx
|
|
3493
|
-
import { createSignal as
|
|
3435
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3494
3436
|
|
|
3495
3437
|
// src/components/content/components/styles.helpers.ts
|
|
3496
3438
|
var getCssFromFont = (font) => {
|
|
@@ -3549,7 +3491,7 @@ var getCss = ({
|
|
|
3549
3491
|
|
|
3550
3492
|
// src/components/content/components/styles.tsx
|
|
3551
3493
|
function ContentStyles(props) {
|
|
3552
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3494
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3553
3495
|
`
|
|
3554
3496
|
${getCss({
|
|
3555
3497
|
cssCode: props.cssCode,
|
|
@@ -3617,15 +3559,15 @@ var getContentInitialValue = ({
|
|
|
3617
3559
|
|
|
3618
3560
|
// src/components/content/content.tsx
|
|
3619
3561
|
function ContentComponent(props) {
|
|
3620
|
-
const [scriptStr, setScriptStr] =
|
|
3621
|
-
|
|
3562
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3563
|
+
getUpdateVariantVisibilityScript({
|
|
3622
3564
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3623
3565
|
variationId: props.content?.testVariationId,
|
|
3624
3566
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3625
3567
|
contentId: props.content?.id
|
|
3626
3568
|
})
|
|
3627
3569
|
);
|
|
3628
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3570
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3629
3571
|
[
|
|
3630
3572
|
...getDefaultRegisteredComponents(),
|
|
3631
3573
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3646,7 +3588,7 @@ function ContentComponent(props) {
|
|
|
3646
3588
|
{}
|
|
3647
3589
|
)
|
|
3648
3590
|
);
|
|
3649
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3591
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3650
3592
|
content: getContentInitialValue({
|
|
3651
3593
|
content: props.content,
|
|
3652
3594
|
data: props.data
|
|
@@ -3698,19 +3640,18 @@ function ContentComponent(props) {
|
|
|
3698
3640
|
locale={props.locale}
|
|
3699
3641
|
includeRefs={props.includeRefs}
|
|
3700
3642
|
enrich={props.enrich}
|
|
3701
|
-
classNameProp={props.classNameProp}
|
|
3702
3643
|
showContent={props.showContent}
|
|
3703
3644
|
builderContextSignal={builderContextSignal()}
|
|
3704
3645
|
{...{
|
|
3705
3646
|
setBuilderContextSignal
|
|
3706
3647
|
}}
|
|
3707
3648
|
>
|
|
3708
|
-
<
|
|
3709
|
-
<
|
|
3649
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3650
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3710
3651
|
contentId={builderContextSignal().content?.id}
|
|
3711
3652
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3712
3653
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3713
|
-
/></
|
|
3654
|
+
/></Show11>
|
|
3714
3655
|
<Blocks_default
|
|
3715
3656
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3716
3657
|
context={builderContextSignal()}
|
|
@@ -3722,14 +3663,14 @@ var Content_default = ContentComponent;
|
|
|
3722
3663
|
|
|
3723
3664
|
// src/components/content-variants/content-variants.tsx
|
|
3724
3665
|
function ContentVariants(props) {
|
|
3725
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3726
|
-
|
|
3666
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3667
|
+
checkShouldRenderVariants({
|
|
3727
3668
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3728
3669
|
content: props.content
|
|
3729
3670
|
})
|
|
3730
3671
|
);
|
|
3731
|
-
function
|
|
3732
|
-
return
|
|
3672
|
+
function updateCookieAndStylesScriptStr() {
|
|
3673
|
+
return getUpdateCookieAndStylesScript(
|
|
3733
3674
|
getVariants(props.content).map((value) => ({
|
|
3734
3675
|
id: value.testVariationId,
|
|
3735
3676
|
testRatio: value.testRatio
|
|
@@ -3753,20 +3694,21 @@ function ContentVariants(props) {
|
|
|
3753
3694
|
setShouldRenderVariants(false);
|
|
3754
3695
|
});
|
|
3755
3696
|
return <>
|
|
3756
|
-
<
|
|
3757
|
-
<
|
|
3697
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3698
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3758
3699
|
<Inlined_styles_default
|
|
3759
3700
|
id={`variants-styles-${props.content?.id}`}
|
|
3760
3701
|
styles={hideVariantsStyleString()}
|
|
3761
3702
|
/>
|
|
3762
|
-
<Inlined_script_default
|
|
3703
|
+
<Inlined_script_default
|
|
3704
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3705
|
+
/>
|
|
3763
3706
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3764
3707
|
const index = _index();
|
|
3765
3708
|
return <Content_default
|
|
3766
3709
|
key={variant.testVariationId}
|
|
3767
3710
|
content={variant}
|
|
3768
3711
|
showContent={false}
|
|
3769
|
-
classNameProp={void 0}
|
|
3770
3712
|
model={props.model}
|
|
3771
3713
|
data={props.data}
|
|
3772
3714
|
context={props.context}
|
|
@@ -3780,11 +3722,10 @@ function ContentVariants(props) {
|
|
|
3780
3722
|
isSsrAbTest={shouldRenderVariants()}
|
|
3781
3723
|
/>;
|
|
3782
3724
|
}}</For5>
|
|
3783
|
-
</
|
|
3725
|
+
</Show12>
|
|
3784
3726
|
<Content_default
|
|
3785
3727
|
{...{}}
|
|
3786
3728
|
content={defaultContent()}
|
|
3787
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3788
3729
|
showContent={true}
|
|
3789
3730
|
model={props.model}
|
|
3790
3731
|
data={props.data}
|
|
@@ -3828,7 +3769,7 @@ var fetchSymbolContent = async ({
|
|
|
3828
3769
|
|
|
3829
3770
|
// src/blocks/symbol/symbol.tsx
|
|
3830
3771
|
function Symbol(props) {
|
|
3831
|
-
const [contentToUse, setContentToUse] =
|
|
3772
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3832
3773
|
function className() {
|
|
3833
3774
|
return [
|
|
3834
3775
|
...[props.attributes.class],
|