@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/edge/index.jsx
CHANGED
|
@@ -4031,7 +4031,7 @@ function Block(props) {
|
|
|
4031
4031
|
});
|
|
4032
4032
|
}
|
|
4033
4033
|
function processedBlock() {
|
|
4034
|
-
return
|
|
4034
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
4035
4035
|
block: props.block,
|
|
4036
4036
|
localState: props.context.localState,
|
|
4037
4037
|
rootState: props.context.rootState,
|
|
@@ -4050,6 +4050,9 @@ function Block(props) {
|
|
|
4050
4050
|
if ("show" in processedBlock()) {
|
|
4051
4051
|
return processedBlock().show;
|
|
4052
4052
|
}
|
|
4053
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
4054
|
+
return false;
|
|
4055
|
+
}
|
|
4053
4056
|
return true;
|
|
4054
4057
|
}
|
|
4055
4058
|
function childrenWithoutParentComponent() {
|
|
@@ -4522,10 +4525,10 @@ function SectionComponent(props) {
|
|
|
4522
4525
|
var section_default = SectionComponent;
|
|
4523
4526
|
|
|
4524
4527
|
// src/blocks/symbol/symbol.tsx
|
|
4525
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
4528
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
4526
4529
|
|
|
4527
4530
|
// src/components/content-variants/content-variants.tsx
|
|
4528
|
-
import { Show as
|
|
4531
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
4529
4532
|
|
|
4530
4533
|
// src/helpers/url.ts
|
|
4531
4534
|
var getTopLevelDomain = (host) => {
|
|
@@ -4719,7 +4722,7 @@ var handleABTesting = async ({
|
|
|
4719
4722
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
4720
4723
|
|
|
4721
4724
|
// src/components/content/content.tsx
|
|
4722
|
-
import { Show as
|
|
4725
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
4723
4726
|
|
|
4724
4727
|
// src/blocks/button/component-info.ts
|
|
4725
4728
|
var componentInfo = {
|
|
@@ -5491,6 +5494,7 @@ var componentInfo11 = {
|
|
|
5491
5494
|
};
|
|
5492
5495
|
|
|
5493
5496
|
// src/blocks/video/video.tsx
|
|
5497
|
+
import { Show as Show9 } from "solid-js";
|
|
5494
5498
|
function Video(props) {
|
|
5495
5499
|
function videoProps() {
|
|
5496
5500
|
return {
|
|
@@ -5513,26 +5517,66 @@ function Video(props) {
|
|
|
5513
5517
|
}
|
|
5514
5518
|
function spreadProps() {
|
|
5515
5519
|
return {
|
|
5516
|
-
...props.attributes,
|
|
5517
5520
|
...videoProps()
|
|
5518
5521
|
};
|
|
5519
5522
|
}
|
|
5520
|
-
return <
|
|
5521
|
-
{...spreadProps()}
|
|
5522
|
-
preload={props.preload || "metadata"}
|
|
5523
|
+
return <div
|
|
5523
5524
|
style={{
|
|
5524
|
-
|
|
5525
|
-
height: "100%",
|
|
5526
|
-
...props.attributes?.style,
|
|
5527
|
-
"object-fit": props.fit,
|
|
5528
|
-
"object-position": props.position,
|
|
5529
|
-
// Hack to get object fit to work as expected and
|
|
5530
|
-
// not have the video overflow
|
|
5531
|
-
"border-radius": 1
|
|
5525
|
+
position: "relative"
|
|
5532
5526
|
}}
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5527
|
+
>
|
|
5528
|
+
<video
|
|
5529
|
+
class="builder-video"
|
|
5530
|
+
{...spreadProps()}
|
|
5531
|
+
preload={props.preload || "metadata"}
|
|
5532
|
+
style={{
|
|
5533
|
+
width: "100%",
|
|
5534
|
+
height: "100%",
|
|
5535
|
+
...props.attributes?.style,
|
|
5536
|
+
"object-fit": props.fit,
|
|
5537
|
+
"object-position": props.position,
|
|
5538
|
+
// Hack to get object fit to work as expected and
|
|
5539
|
+
// not have the video overflow
|
|
5540
|
+
"z-index": 2,
|
|
5541
|
+
"border-radius": "1px",
|
|
5542
|
+
...props.aspectRatio ? {
|
|
5543
|
+
position: "absolute"
|
|
5544
|
+
} : null
|
|
5545
|
+
}}
|
|
5546
|
+
src={props.video || "no-src"}
|
|
5547
|
+
poster={props.posterImage}
|
|
5548
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
5549
|
+
<Show9
|
|
5550
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
5551
|
+
><div
|
|
5552
|
+
style={{
|
|
5553
|
+
width: "100%",
|
|
5554
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
5555
|
+
"pointer-events": "none",
|
|
5556
|
+
"font-size": "0px"
|
|
5557
|
+
}}
|
|
5558
|
+
/></Show9>
|
|
5559
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
5560
|
+
style={{
|
|
5561
|
+
display: "flex",
|
|
5562
|
+
"flex-direction": "column",
|
|
5563
|
+
"align-items": "stretch"
|
|
5564
|
+
}}
|
|
5565
|
+
>{props.children}</div></Show9>
|
|
5566
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
5567
|
+
style={{
|
|
5568
|
+
"pointer-events": "none",
|
|
5569
|
+
display: "flex",
|
|
5570
|
+
"flex-direction": "column",
|
|
5571
|
+
"align-items": "stretch",
|
|
5572
|
+
position: "absolute",
|
|
5573
|
+
top: "0",
|
|
5574
|
+
left: "0",
|
|
5575
|
+
width: "100%",
|
|
5576
|
+
height: "100%"
|
|
5577
|
+
}}
|
|
5578
|
+
>{props.children}</div></Show9>
|
|
5579
|
+
</div>;
|
|
5536
5580
|
}
|
|
5537
5581
|
var video_default = Video;
|
|
5538
5582
|
|
|
@@ -5595,13 +5639,19 @@ var serializeComponentInfo = ({
|
|
|
5595
5639
|
}), {}))
|
|
5596
5640
|
});
|
|
5597
5641
|
|
|
5642
|
+
// src/components/content-variants/inlined-fns.ts
|
|
5643
|
+
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}";
|
|
5644
|
+
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}";
|
|
5645
|
+
|
|
5598
5646
|
// src/components/content-variants/helpers.ts
|
|
5647
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
5648
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
5599
5649
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
5600
5650
|
...variant,
|
|
5601
5651
|
testVariationId: variant.id,
|
|
5602
5652
|
id: content?.id
|
|
5603
5653
|
}));
|
|
5604
|
-
var
|
|
5654
|
+
var checkShouldRenderVariants = ({
|
|
5605
5655
|
canTrack,
|
|
5606
5656
|
content
|
|
5607
5657
|
}) => {
|
|
@@ -5612,142 +5662,37 @@ var checkShouldRunVariants = ({
|
|
|
5612
5662
|
return false;
|
|
5613
5663
|
if (!canTrack)
|
|
5614
5664
|
return false;
|
|
5615
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
5665
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
5616
5666
|
return true;
|
|
5617
5667
|
if (isBrowser())
|
|
5618
5668
|
return false;
|
|
5619
5669
|
return true;
|
|
5620
5670
|
};
|
|
5621
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
5622
|
-
function getAndSetVariantId2() {
|
|
5623
|
-
function setCookie2(name, value, days) {
|
|
5624
|
-
let expires = "";
|
|
5625
|
-
if (days) {
|
|
5626
|
-
const date = /* @__PURE__ */ new Date();
|
|
5627
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
5628
|
-
expires = "; expires=" + date.toUTCString();
|
|
5629
|
-
}
|
|
5630
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
5631
|
-
}
|
|
5632
|
-
function getCookie2(name) {
|
|
5633
|
-
const nameEQ = name + "=";
|
|
5634
|
-
const ca2 = document.cookie.split(";");
|
|
5635
|
-
for (let i = 0; i < ca2.length; i++) {
|
|
5636
|
-
let c = ca2[i];
|
|
5637
|
-
while (c.charAt(0) === " ")
|
|
5638
|
-
c = c.substring(1, c.length);
|
|
5639
|
-
if (c.indexOf(nameEQ) === 0)
|
|
5640
|
-
return c.substring(nameEQ.length, c.length);
|
|
5641
|
-
}
|
|
5642
|
-
return null;
|
|
5643
|
-
}
|
|
5644
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
5645
|
-
const variantInCookie = getCookie2(cookieName);
|
|
5646
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
5647
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
5648
|
-
return variantInCookie;
|
|
5649
|
-
}
|
|
5650
|
-
let n = 0;
|
|
5651
|
-
const random = Math.random();
|
|
5652
|
-
for (let i = 0; i < variants.length; i++) {
|
|
5653
|
-
const variant = variants[i];
|
|
5654
|
-
const testRatio = variant.testRatio;
|
|
5655
|
-
n += testRatio;
|
|
5656
|
-
if (random < n) {
|
|
5657
|
-
setCookie2(cookieName, variant.id);
|
|
5658
|
-
return variant.id;
|
|
5659
|
-
}
|
|
5660
|
-
}
|
|
5661
|
-
setCookie2(cookieName, contentId);
|
|
5662
|
-
return contentId;
|
|
5663
|
-
}
|
|
5664
|
-
const winningVariantId = getAndSetVariantId2();
|
|
5665
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
5666
|
-
if (isHydrationTarget2) {
|
|
5667
|
-
styleEl.remove();
|
|
5668
|
-
const thisScriptEl = document.currentScript;
|
|
5669
|
-
thisScriptEl?.remove();
|
|
5670
|
-
} else {
|
|
5671
|
-
const newStyleStr = variants.concat({
|
|
5672
|
-
id: contentId
|
|
5673
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
5674
|
-
return `.variant-${value.id} { display: none; }
|
|
5675
|
-
`;
|
|
5676
|
-
}).join("");
|
|
5677
|
-
styleEl.innerHTML = newStyleStr;
|
|
5678
|
-
}
|
|
5679
|
-
}
|
|
5680
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
5681
|
-
if (!navigator.cookieEnabled) {
|
|
5682
|
-
return;
|
|
5683
|
-
}
|
|
5684
|
-
function getCookie2(name) {
|
|
5685
|
-
const nameEQ = name + "=";
|
|
5686
|
-
const ca2 = document.cookie.split(";");
|
|
5687
|
-
for (let i = 0; i < ca2.length; i++) {
|
|
5688
|
-
let c = ca2[i];
|
|
5689
|
-
while (c.charAt(0) === " ")
|
|
5690
|
-
c = c.substring(1, c.length);
|
|
5691
|
-
if (c.indexOf(nameEQ) === 0)
|
|
5692
|
-
return c.substring(nameEQ.length, c.length);
|
|
5693
|
-
}
|
|
5694
|
-
return null;
|
|
5695
|
-
}
|
|
5696
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
5697
|
-
const variantId = getCookie2(cookieName);
|
|
5698
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
5699
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
5700
|
-
if (variantId === variantContentId) {
|
|
5701
|
-
if (variantIsDefaultContent) {
|
|
5702
|
-
return;
|
|
5703
|
-
}
|
|
5704
|
-
parentDiv?.removeAttribute("hidden");
|
|
5705
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
5706
|
-
} else {
|
|
5707
|
-
if (variantIsDefaultContent) {
|
|
5708
|
-
if (isHydrationTarget2) {
|
|
5709
|
-
parentDiv?.remove();
|
|
5710
|
-
} else {
|
|
5711
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
5712
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
5713
|
-
}
|
|
5714
|
-
}
|
|
5715
|
-
return;
|
|
5716
|
-
}
|
|
5717
|
-
return;
|
|
5718
|
-
}
|
|
5719
5671
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
5720
5672
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
5721
|
-
var
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
5725
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
5726
|
-
return `
|
|
5727
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
5728
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
5673
|
+
var getScriptString = () => `
|
|
5674
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
5675
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
5729
5676
|
`;
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
var getRenderContentScriptString = ({
|
|
5677
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
5678
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
5679
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
5680
|
+
)`;
|
|
5681
|
+
var getUpdateVariantVisibilityScript = ({
|
|
5736
5682
|
contentId,
|
|
5737
5683
|
variationId
|
|
5738
|
-
}) => {
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
};
|
|
5684
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
5685
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
5686
|
+
)`;
|
|
5742
5687
|
|
|
5743
5688
|
// src/components/inlined-script.tsx
|
|
5744
5689
|
function InlinedScript(props) {
|
|
5745
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
5690
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
5746
5691
|
}
|
|
5747
5692
|
var Inlined_script_default = InlinedScript;
|
|
5748
5693
|
|
|
5749
5694
|
// src/components/content/components/enable-editor.tsx
|
|
5750
|
-
import { Show as
|
|
5695
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
5751
5696
|
|
|
5752
5697
|
// src/helpers/preview-lru-cache/get.ts
|
|
5753
5698
|
function getPreviewContent(_searchParams) {
|
|
@@ -6229,7 +6174,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6229
6174
|
};
|
|
6230
6175
|
|
|
6231
6176
|
// src/constants/sdk-version.ts
|
|
6232
|
-
var SDK_VERSION = "0.7.
|
|
6177
|
+
var SDK_VERSION = "0.7.5";
|
|
6233
6178
|
|
|
6234
6179
|
// src/functions/register.ts
|
|
6235
6180
|
var registry = {};
|
|
@@ -6363,11 +6308,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6363
6308
|
|
|
6364
6309
|
// src/components/content/components/enable-editor.tsx
|
|
6365
6310
|
function EnableEditor(props) {
|
|
6366
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
6367
|
-
const [lastUpdated, setLastUpdated] =
|
|
6368
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
6369
|
-
const [httpReqsData, setHttpReqsData] =
|
|
6370
|
-
const [clicked, setClicked] =
|
|
6311
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
6312
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
6313
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
6314
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
6315
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
6371
6316
|
function mergeNewContent(newContent) {
|
|
6372
6317
|
const newContentValue = {
|
|
6373
6318
|
...props.builderContextSignal.content,
|
|
@@ -6609,8 +6554,8 @@ function EnableEditor(props) {
|
|
|
6609
6554
|
emitStateUpdate();
|
|
6610
6555
|
}
|
|
6611
6556
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
6612
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
6613
|
-
class={props.
|
|
6557
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
6558
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
6614
6559
|
{...{}}
|
|
6615
6560
|
key={forceReRenderCount()}
|
|
6616
6561
|
ref={elementRef}
|
|
@@ -6622,12 +6567,12 @@ function EnableEditor(props) {
|
|
|
6622
6567
|
hidden: true,
|
|
6623
6568
|
"aria-hidden": true
|
|
6624
6569
|
}}
|
|
6625
|
-
>{props.children}</div></
|
|
6570
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
6626
6571
|
}
|
|
6627
6572
|
var Enable_editor_default = EnableEditor;
|
|
6628
6573
|
|
|
6629
6574
|
// src/components/content/components/styles.tsx
|
|
6630
|
-
import { createSignal as
|
|
6575
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
6631
6576
|
|
|
6632
6577
|
// src/components/content/components/styles.helpers.ts
|
|
6633
6578
|
var getCssFromFont = (font) => {
|
|
@@ -6686,7 +6631,7 @@ var getCss = ({
|
|
|
6686
6631
|
|
|
6687
6632
|
// src/components/content/components/styles.tsx
|
|
6688
6633
|
function ContentStyles(props) {
|
|
6689
|
-
const [injectedStyles, setInjectedStyles] =
|
|
6634
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
6690
6635
|
`
|
|
6691
6636
|
${getCss({
|
|
6692
6637
|
cssCode: props.cssCode,
|
|
@@ -6721,22 +6666,20 @@ var getContextStateInitialValue = ({
|
|
|
6721
6666
|
locale
|
|
6722
6667
|
}) => {
|
|
6723
6668
|
const defaultValues = {};
|
|
6669
|
+
const initialState = content?.data?.state || {};
|
|
6724
6670
|
content?.data?.inputs?.forEach((input) => {
|
|
6725
|
-
if (input.name && input.defaultValue !== void 0
|
|
6671
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
6726
6672
|
defaultValues[input.name] = input.defaultValue;
|
|
6727
6673
|
}
|
|
6728
6674
|
});
|
|
6729
|
-
|
|
6730
|
-
...
|
|
6675
|
+
return {
|
|
6676
|
+
...defaultValues,
|
|
6677
|
+
...initialState,
|
|
6731
6678
|
...data,
|
|
6732
6679
|
...locale ? {
|
|
6733
6680
|
locale
|
|
6734
6681
|
} : {}
|
|
6735
6682
|
};
|
|
6736
|
-
return {
|
|
6737
|
-
...defaultValues,
|
|
6738
|
-
...stateToUse
|
|
6739
|
-
};
|
|
6740
6683
|
};
|
|
6741
6684
|
var getContentInitialValue = ({
|
|
6742
6685
|
content,
|
|
@@ -6754,15 +6697,15 @@ var getContentInitialValue = ({
|
|
|
6754
6697
|
|
|
6755
6698
|
// src/components/content/content.tsx
|
|
6756
6699
|
function ContentComponent(props) {
|
|
6757
|
-
const [scriptStr, setScriptStr] =
|
|
6758
|
-
|
|
6700
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
6701
|
+
getUpdateVariantVisibilityScript({
|
|
6759
6702
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
6760
6703
|
variationId: props.content?.testVariationId,
|
|
6761
6704
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
6762
6705
|
contentId: props.content?.id
|
|
6763
6706
|
})
|
|
6764
6707
|
);
|
|
6765
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
6708
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
6766
6709
|
[
|
|
6767
6710
|
...getDefaultRegisteredComponents(),
|
|
6768
6711
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -6783,7 +6726,7 @@ function ContentComponent(props) {
|
|
|
6783
6726
|
{}
|
|
6784
6727
|
)
|
|
6785
6728
|
);
|
|
6786
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
6729
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
6787
6730
|
content: getContentInitialValue({
|
|
6788
6731
|
content: props.content,
|
|
6789
6732
|
data: props.data
|
|
@@ -6835,19 +6778,18 @@ function ContentComponent(props) {
|
|
|
6835
6778
|
locale={props.locale}
|
|
6836
6779
|
includeRefs={props.includeRefs}
|
|
6837
6780
|
enrich={props.enrich}
|
|
6838
|
-
classNameProp={props.classNameProp}
|
|
6839
6781
|
showContent={props.showContent}
|
|
6840
6782
|
builderContextSignal={builderContextSignal()}
|
|
6841
6783
|
{...{
|
|
6842
6784
|
setBuilderContextSignal
|
|
6843
6785
|
}}
|
|
6844
6786
|
>
|
|
6845
|
-
<
|
|
6846
|
-
<
|
|
6787
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
6788
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
6847
6789
|
contentId={builderContextSignal().content?.id}
|
|
6848
6790
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
6849
6791
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
6850
|
-
/></
|
|
6792
|
+
/></Show11>
|
|
6851
6793
|
<Blocks_default
|
|
6852
6794
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
6853
6795
|
context={builderContextSignal()}
|
|
@@ -6859,14 +6801,14 @@ var Content_default = ContentComponent;
|
|
|
6859
6801
|
|
|
6860
6802
|
// src/components/content-variants/content-variants.tsx
|
|
6861
6803
|
function ContentVariants(props) {
|
|
6862
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
6863
|
-
|
|
6804
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
6805
|
+
checkShouldRenderVariants({
|
|
6864
6806
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
6865
6807
|
content: props.content
|
|
6866
6808
|
})
|
|
6867
6809
|
);
|
|
6868
|
-
function
|
|
6869
|
-
return
|
|
6810
|
+
function updateCookieAndStylesScriptStr() {
|
|
6811
|
+
return getUpdateCookieAndStylesScript(
|
|
6870
6812
|
getVariants(props.content).map((value) => ({
|
|
6871
6813
|
id: value.testVariationId,
|
|
6872
6814
|
testRatio: value.testRatio
|
|
@@ -6890,20 +6832,21 @@ function ContentVariants(props) {
|
|
|
6890
6832
|
setShouldRenderVariants(false);
|
|
6891
6833
|
});
|
|
6892
6834
|
return <>
|
|
6893
|
-
<
|
|
6894
|
-
<
|
|
6835
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
6836
|
+
<Show12 when={shouldRenderVariants()}>
|
|
6895
6837
|
<Inlined_styles_default
|
|
6896
6838
|
id={`variants-styles-${props.content?.id}`}
|
|
6897
6839
|
styles={hideVariantsStyleString()}
|
|
6898
6840
|
/>
|
|
6899
|
-
<Inlined_script_default
|
|
6841
|
+
<Inlined_script_default
|
|
6842
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
6843
|
+
/>
|
|
6900
6844
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
6901
6845
|
const index = _index();
|
|
6902
6846
|
return <Content_default
|
|
6903
6847
|
key={variant.testVariationId}
|
|
6904
6848
|
content={variant}
|
|
6905
6849
|
showContent={false}
|
|
6906
|
-
classNameProp={void 0}
|
|
6907
6850
|
model={props.model}
|
|
6908
6851
|
data={props.data}
|
|
6909
6852
|
context={props.context}
|
|
@@ -6917,11 +6860,10 @@ function ContentVariants(props) {
|
|
|
6917
6860
|
isSsrAbTest={shouldRenderVariants()}
|
|
6918
6861
|
/>;
|
|
6919
6862
|
}}</For5>
|
|
6920
|
-
</
|
|
6863
|
+
</Show12>
|
|
6921
6864
|
<Content_default
|
|
6922
6865
|
{...{}}
|
|
6923
6866
|
content={defaultContent()}
|
|
6924
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
6925
6867
|
showContent={true}
|
|
6926
6868
|
model={props.model}
|
|
6927
6869
|
data={props.data}
|
|
@@ -6965,7 +6907,7 @@ var fetchSymbolContent = async ({
|
|
|
6965
6907
|
|
|
6966
6908
|
// src/blocks/symbol/symbol.tsx
|
|
6967
6909
|
function Symbol2(props) {
|
|
6968
|
-
const [contentToUse, setContentToUse] =
|
|
6910
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
6969
6911
|
function className() {
|
|
6970
6912
|
return [
|
|
6971
6913
|
...[props.attributes.class],
|