@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/browser/dev.jsx
CHANGED
|
@@ -883,7 +883,7 @@ function Block(props) {
|
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
function processedBlock() {
|
|
886
|
-
return
|
|
886
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
887
887
|
block: props.block,
|
|
888
888
|
localState: props.context.localState,
|
|
889
889
|
rootState: props.context.rootState,
|
|
@@ -902,6 +902,9 @@ function Block(props) {
|
|
|
902
902
|
if ("show" in processedBlock()) {
|
|
903
903
|
return processedBlock().show;
|
|
904
904
|
}
|
|
905
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
906
|
+
return false;
|
|
907
|
+
}
|
|
905
908
|
return true;
|
|
906
909
|
}
|
|
907
910
|
function childrenWithoutParentComponent() {
|
|
@@ -1375,10 +1378,10 @@ function SectionComponent(props) {
|
|
|
1375
1378
|
var section_default = SectionComponent;
|
|
1376
1379
|
|
|
1377
1380
|
// src/blocks/symbol/symbol.tsx
|
|
1378
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
1381
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1379
1382
|
|
|
1380
1383
|
// src/components/content-variants/content-variants.tsx
|
|
1381
|
-
import { Show as
|
|
1384
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
1382
1385
|
|
|
1383
1386
|
// src/helpers/url.ts
|
|
1384
1387
|
var getTopLevelDomain = (host) => {
|
|
@@ -1572,7 +1575,7 @@ var handleABTesting = async ({
|
|
|
1572
1575
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1573
1576
|
|
|
1574
1577
|
// src/components/content/content.tsx
|
|
1575
|
-
import { Show as
|
|
1578
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
1576
1579
|
|
|
1577
1580
|
// src/blocks/button/component-info.ts
|
|
1578
1581
|
var componentInfo = {
|
|
@@ -2347,6 +2350,7 @@ var componentInfo11 = {
|
|
|
2347
2350
|
};
|
|
2348
2351
|
|
|
2349
2352
|
// src/blocks/video/video.tsx
|
|
2353
|
+
import { Show as Show9 } from "solid-js";
|
|
2350
2354
|
function Video(props) {
|
|
2351
2355
|
function videoProps() {
|
|
2352
2356
|
return {
|
|
@@ -2369,26 +2373,66 @@ function Video(props) {
|
|
|
2369
2373
|
}
|
|
2370
2374
|
function spreadProps() {
|
|
2371
2375
|
return {
|
|
2372
|
-
...props.attributes,
|
|
2373
2376
|
...videoProps()
|
|
2374
2377
|
};
|
|
2375
2378
|
}
|
|
2376
|
-
return <
|
|
2377
|
-
{...spreadProps()}
|
|
2378
|
-
preload={props.preload || "metadata"}
|
|
2379
|
+
return <div
|
|
2379
2380
|
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
|
|
2381
|
+
position: "relative"
|
|
2388
2382
|
}}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2383
|
+
>
|
|
2384
|
+
<video
|
|
2385
|
+
class="builder-video"
|
|
2386
|
+
{...spreadProps()}
|
|
2387
|
+
preload={props.preload || "metadata"}
|
|
2388
|
+
style={{
|
|
2389
|
+
width: "100%",
|
|
2390
|
+
height: "100%",
|
|
2391
|
+
...props.attributes?.style,
|
|
2392
|
+
"object-fit": props.fit,
|
|
2393
|
+
"object-position": props.position,
|
|
2394
|
+
// Hack to get object fit to work as expected and
|
|
2395
|
+
// not have the video overflow
|
|
2396
|
+
"z-index": 2,
|
|
2397
|
+
"border-radius": "1px",
|
|
2398
|
+
...props.aspectRatio ? {
|
|
2399
|
+
position: "absolute"
|
|
2400
|
+
} : null
|
|
2401
|
+
}}
|
|
2402
|
+
src={props.video || "no-src"}
|
|
2403
|
+
poster={props.posterImage}
|
|
2404
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
2405
|
+
<Show9
|
|
2406
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
2407
|
+
><div
|
|
2408
|
+
style={{
|
|
2409
|
+
width: "100%",
|
|
2410
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
2411
|
+
"pointer-events": "none",
|
|
2412
|
+
"font-size": "0px"
|
|
2413
|
+
}}
|
|
2414
|
+
/></Show9>
|
|
2415
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
2416
|
+
style={{
|
|
2417
|
+
display: "flex",
|
|
2418
|
+
"flex-direction": "column",
|
|
2419
|
+
"align-items": "stretch"
|
|
2420
|
+
}}
|
|
2421
|
+
>{props.children}</div></Show9>
|
|
2422
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
2423
|
+
style={{
|
|
2424
|
+
"pointer-events": "none",
|
|
2425
|
+
display: "flex",
|
|
2426
|
+
"flex-direction": "column",
|
|
2427
|
+
"align-items": "stretch",
|
|
2428
|
+
position: "absolute",
|
|
2429
|
+
top: "0",
|
|
2430
|
+
left: "0",
|
|
2431
|
+
width: "100%",
|
|
2432
|
+
height: "100%"
|
|
2433
|
+
}}
|
|
2434
|
+
>{props.children}</div></Show9>
|
|
2435
|
+
</div>;
|
|
2392
2436
|
}
|
|
2393
2437
|
var video_default = Video;
|
|
2394
2438
|
|
|
@@ -2451,13 +2495,19 @@ var serializeComponentInfo = ({
|
|
|
2451
2495
|
}), {}))
|
|
2452
2496
|
});
|
|
2453
2497
|
|
|
2498
|
+
// src/components/content-variants/inlined-fns.ts
|
|
2499
|
+
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}";
|
|
2500
|
+
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}";
|
|
2501
|
+
|
|
2454
2502
|
// src/components/content-variants/helpers.ts
|
|
2503
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
2504
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
2455
2505
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
2456
2506
|
...variant,
|
|
2457
2507
|
testVariationId: variant.id,
|
|
2458
2508
|
id: content?.id
|
|
2459
2509
|
}));
|
|
2460
|
-
var
|
|
2510
|
+
var checkShouldRenderVariants = ({
|
|
2461
2511
|
canTrack,
|
|
2462
2512
|
content
|
|
2463
2513
|
}) => {
|
|
@@ -2468,142 +2518,37 @@ var checkShouldRunVariants = ({
|
|
|
2468
2518
|
return false;
|
|
2469
2519
|
if (!canTrack)
|
|
2470
2520
|
return false;
|
|
2471
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
2521
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
2472
2522
|
return true;
|
|
2473
2523
|
if (isBrowser())
|
|
2474
2524
|
return false;
|
|
2475
2525
|
return true;
|
|
2476
2526
|
};
|
|
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
2527
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
2576
2528
|
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}
|
|
2529
|
+
var getScriptString = () => `
|
|
2530
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
2531
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
2585
2532
|
`;
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
var getRenderContentScriptString = ({
|
|
2533
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
2534
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
2535
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
2536
|
+
)`;
|
|
2537
|
+
var getUpdateVariantVisibilityScript = ({
|
|
2592
2538
|
contentId,
|
|
2593
2539
|
variationId
|
|
2594
|
-
}) => {
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
};
|
|
2540
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
2541
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
2542
|
+
)`;
|
|
2598
2543
|
|
|
2599
2544
|
// src/components/inlined-script.tsx
|
|
2600
2545
|
function InlinedScript(props) {
|
|
2601
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
2546
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
2602
2547
|
}
|
|
2603
2548
|
var Inlined_script_default = InlinedScript;
|
|
2604
2549
|
|
|
2605
2550
|
// src/components/content/components/enable-editor.tsx
|
|
2606
|
-
import { Show as
|
|
2551
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2607
2552
|
|
|
2608
2553
|
// src/helpers/preview-lru-cache/get.ts
|
|
2609
2554
|
function getPreviewContent(_searchParams) {
|
|
@@ -3090,7 +3035,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3090
3035
|
};
|
|
3091
3036
|
|
|
3092
3037
|
// src/constants/sdk-version.ts
|
|
3093
|
-
var SDK_VERSION = "0.7.
|
|
3038
|
+
var SDK_VERSION = "0.7.5";
|
|
3094
3039
|
|
|
3095
3040
|
// src/functions/register.ts
|
|
3096
3041
|
var registry = {};
|
|
@@ -3225,11 +3170,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
3225
3170
|
|
|
3226
3171
|
// src/components/content/components/enable-editor.tsx
|
|
3227
3172
|
function EnableEditor(props) {
|
|
3228
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
3229
|
-
const [lastUpdated, setLastUpdated] =
|
|
3230
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
3231
|
-
const [httpReqsData, setHttpReqsData] =
|
|
3232
|
-
const [clicked, setClicked] =
|
|
3173
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
3174
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
3175
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
3176
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
3177
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
3233
3178
|
function mergeNewContent(newContent) {
|
|
3234
3179
|
const newContentValue = {
|
|
3235
3180
|
...props.builderContextSignal.content,
|
|
@@ -3472,8 +3417,8 @@ function EnableEditor(props) {
|
|
|
3472
3417
|
emitStateUpdate();
|
|
3473
3418
|
}
|
|
3474
3419
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
3475
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
3476
|
-
class={props.
|
|
3420
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
3421
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
3477
3422
|
{...{}}
|
|
3478
3423
|
key={forceReRenderCount()}
|
|
3479
3424
|
ref={elementRef}
|
|
@@ -3485,12 +3430,12 @@ function EnableEditor(props) {
|
|
|
3485
3430
|
hidden: true,
|
|
3486
3431
|
"aria-hidden": true
|
|
3487
3432
|
}}
|
|
3488
|
-
>{props.children}</div></
|
|
3433
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
3489
3434
|
}
|
|
3490
3435
|
var Enable_editor_default = EnableEditor;
|
|
3491
3436
|
|
|
3492
3437
|
// src/components/content/components/styles.tsx
|
|
3493
|
-
import { createSignal as
|
|
3438
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
3494
3439
|
|
|
3495
3440
|
// src/components/content/components/styles.helpers.ts
|
|
3496
3441
|
var getCssFromFont = (font) => {
|
|
@@ -3549,7 +3494,7 @@ var getCss = ({
|
|
|
3549
3494
|
|
|
3550
3495
|
// src/components/content/components/styles.tsx
|
|
3551
3496
|
function ContentStyles(props) {
|
|
3552
|
-
const [injectedStyles, setInjectedStyles] =
|
|
3497
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
3553
3498
|
`
|
|
3554
3499
|
${getCss({
|
|
3555
3500
|
cssCode: props.cssCode,
|
|
@@ -3584,22 +3529,20 @@ var getContextStateInitialValue = ({
|
|
|
3584
3529
|
locale
|
|
3585
3530
|
}) => {
|
|
3586
3531
|
const defaultValues = {};
|
|
3532
|
+
const initialState = content?.data?.state || {};
|
|
3587
3533
|
content?.data?.inputs?.forEach((input) => {
|
|
3588
|
-
if (input.name && input.defaultValue !== void 0
|
|
3534
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
3589
3535
|
defaultValues[input.name] = input.defaultValue;
|
|
3590
3536
|
}
|
|
3591
3537
|
});
|
|
3592
|
-
|
|
3593
|
-
...
|
|
3538
|
+
return {
|
|
3539
|
+
...defaultValues,
|
|
3540
|
+
...initialState,
|
|
3594
3541
|
...data,
|
|
3595
3542
|
...locale ? {
|
|
3596
3543
|
locale
|
|
3597
3544
|
} : {}
|
|
3598
3545
|
};
|
|
3599
|
-
return {
|
|
3600
|
-
...defaultValues,
|
|
3601
|
-
...stateToUse
|
|
3602
|
-
};
|
|
3603
3546
|
};
|
|
3604
3547
|
var getContentInitialValue = ({
|
|
3605
3548
|
content,
|
|
@@ -3617,15 +3560,15 @@ var getContentInitialValue = ({
|
|
|
3617
3560
|
|
|
3618
3561
|
// src/components/content/content.tsx
|
|
3619
3562
|
function ContentComponent(props) {
|
|
3620
|
-
const [scriptStr, setScriptStr] =
|
|
3621
|
-
|
|
3563
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
3564
|
+
getUpdateVariantVisibilityScript({
|
|
3622
3565
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3623
3566
|
variationId: props.content?.testVariationId,
|
|
3624
3567
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3625
3568
|
contentId: props.content?.id
|
|
3626
3569
|
})
|
|
3627
3570
|
);
|
|
3628
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
3571
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
3629
3572
|
[
|
|
3630
3573
|
...getDefaultRegisteredComponents(),
|
|
3631
3574
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -3646,7 +3589,7 @@ function ContentComponent(props) {
|
|
|
3646
3589
|
{}
|
|
3647
3590
|
)
|
|
3648
3591
|
);
|
|
3649
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
3592
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
3650
3593
|
content: getContentInitialValue({
|
|
3651
3594
|
content: props.content,
|
|
3652
3595
|
data: props.data
|
|
@@ -3698,19 +3641,18 @@ function ContentComponent(props) {
|
|
|
3698
3641
|
locale={props.locale}
|
|
3699
3642
|
includeRefs={props.includeRefs}
|
|
3700
3643
|
enrich={props.enrich}
|
|
3701
|
-
classNameProp={props.classNameProp}
|
|
3702
3644
|
showContent={props.showContent}
|
|
3703
3645
|
builderContextSignal={builderContextSignal()}
|
|
3704
3646
|
{...{
|
|
3705
3647
|
setBuilderContextSignal
|
|
3706
3648
|
}}
|
|
3707
3649
|
>
|
|
3708
|
-
<
|
|
3709
|
-
<
|
|
3650
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
3651
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
3710
3652
|
contentId={builderContextSignal().content?.id}
|
|
3711
3653
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
3712
3654
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
3713
|
-
/></
|
|
3655
|
+
/></Show11>
|
|
3714
3656
|
<Blocks_default
|
|
3715
3657
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
3716
3658
|
context={builderContextSignal()}
|
|
@@ -3722,14 +3664,14 @@ var Content_default = ContentComponent;
|
|
|
3722
3664
|
|
|
3723
3665
|
// src/components/content-variants/content-variants.tsx
|
|
3724
3666
|
function ContentVariants(props) {
|
|
3725
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
3726
|
-
|
|
3667
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
3668
|
+
checkShouldRenderVariants({
|
|
3727
3669
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
3728
3670
|
content: props.content
|
|
3729
3671
|
})
|
|
3730
3672
|
);
|
|
3731
|
-
function
|
|
3732
|
-
return
|
|
3673
|
+
function updateCookieAndStylesScriptStr() {
|
|
3674
|
+
return getUpdateCookieAndStylesScript(
|
|
3733
3675
|
getVariants(props.content).map((value) => ({
|
|
3734
3676
|
id: value.testVariationId,
|
|
3735
3677
|
testRatio: value.testRatio
|
|
@@ -3753,20 +3695,21 @@ function ContentVariants(props) {
|
|
|
3753
3695
|
setShouldRenderVariants(false);
|
|
3754
3696
|
});
|
|
3755
3697
|
return <>
|
|
3756
|
-
<
|
|
3757
|
-
<
|
|
3698
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
3699
|
+
<Show12 when={shouldRenderVariants()}>
|
|
3758
3700
|
<Inlined_styles_default
|
|
3759
3701
|
id={`variants-styles-${props.content?.id}`}
|
|
3760
3702
|
styles={hideVariantsStyleString()}
|
|
3761
3703
|
/>
|
|
3762
|
-
<Inlined_script_default
|
|
3704
|
+
<Inlined_script_default
|
|
3705
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
3706
|
+
/>
|
|
3763
3707
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
3764
3708
|
const index = _index();
|
|
3765
3709
|
return <Content_default
|
|
3766
3710
|
key={variant.testVariationId}
|
|
3767
3711
|
content={variant}
|
|
3768
3712
|
showContent={false}
|
|
3769
|
-
classNameProp={void 0}
|
|
3770
3713
|
model={props.model}
|
|
3771
3714
|
data={props.data}
|
|
3772
3715
|
context={props.context}
|
|
@@ -3780,11 +3723,10 @@ function ContentVariants(props) {
|
|
|
3780
3723
|
isSsrAbTest={shouldRenderVariants()}
|
|
3781
3724
|
/>;
|
|
3782
3725
|
}}</For5>
|
|
3783
|
-
</
|
|
3726
|
+
</Show12>
|
|
3784
3727
|
<Content_default
|
|
3785
3728
|
{...{}}
|
|
3786
3729
|
content={defaultContent()}
|
|
3787
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
3788
3730
|
showContent={true}
|
|
3789
3731
|
model={props.model}
|
|
3790
3732
|
data={props.data}
|
|
@@ -3828,7 +3770,7 @@ var fetchSymbolContent = async ({
|
|
|
3828
3770
|
|
|
3829
3771
|
// src/blocks/symbol/symbol.tsx
|
|
3830
3772
|
function Symbol(props) {
|
|
3831
|
-
const [contentToUse, setContentToUse] =
|
|
3773
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
3832
3774
|
function className() {
|
|
3833
3775
|
return [
|
|
3834
3776
|
...[props.attributes.class],
|