@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/dev.jsx
CHANGED
|
@@ -4038,7 +4038,7 @@ function Block(props) {
|
|
|
4038
4038
|
});
|
|
4039
4039
|
}
|
|
4040
4040
|
function processedBlock() {
|
|
4041
|
-
return
|
|
4041
|
+
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
4042
4042
|
block: props.block,
|
|
4043
4043
|
localState: props.context.localState,
|
|
4044
4044
|
rootState: props.context.rootState,
|
|
@@ -4057,6 +4057,9 @@ function Block(props) {
|
|
|
4057
4057
|
if ("show" in processedBlock()) {
|
|
4058
4058
|
return processedBlock().show;
|
|
4059
4059
|
}
|
|
4060
|
+
if (props.block.repeat?.collection && !repeatItem()?.length) {
|
|
4061
|
+
return false;
|
|
4062
|
+
}
|
|
4060
4063
|
return true;
|
|
4061
4064
|
}
|
|
4062
4065
|
function childrenWithoutParentComponent() {
|
|
@@ -4530,10 +4533,10 @@ function SectionComponent(props) {
|
|
|
4530
4533
|
var section_default = SectionComponent;
|
|
4531
4534
|
|
|
4532
4535
|
// src/blocks/symbol/symbol.tsx
|
|
4533
|
-
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as
|
|
4536
|
+
import { onMount as onMount4, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
4534
4537
|
|
|
4535
4538
|
// src/components/content-variants/content-variants.tsx
|
|
4536
|
-
import { Show as
|
|
4539
|
+
import { Show as Show12, For as For5, onMount as onMount3, createSignal as createSignal13 } from "solid-js";
|
|
4537
4540
|
|
|
4538
4541
|
// src/helpers/url.ts
|
|
4539
4542
|
var getTopLevelDomain = (host) => {
|
|
@@ -4727,7 +4730,7 @@ var handleABTesting = async ({
|
|
|
4727
4730
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
4728
4731
|
|
|
4729
4732
|
// src/components/content/content.tsx
|
|
4730
|
-
import { Show as
|
|
4733
|
+
import { Show as Show11, createSignal as createSignal12 } from "solid-js";
|
|
4731
4734
|
|
|
4732
4735
|
// src/blocks/button/component-info.ts
|
|
4733
4736
|
var componentInfo = {
|
|
@@ -5502,6 +5505,7 @@ var componentInfo11 = {
|
|
|
5502
5505
|
};
|
|
5503
5506
|
|
|
5504
5507
|
// src/blocks/video/video.tsx
|
|
5508
|
+
import { Show as Show9 } from "solid-js";
|
|
5505
5509
|
function Video(props) {
|
|
5506
5510
|
function videoProps() {
|
|
5507
5511
|
return {
|
|
@@ -5524,26 +5528,66 @@ function Video(props) {
|
|
|
5524
5528
|
}
|
|
5525
5529
|
function spreadProps() {
|
|
5526
5530
|
return {
|
|
5527
|
-
...props.attributes,
|
|
5528
5531
|
...videoProps()
|
|
5529
5532
|
};
|
|
5530
5533
|
}
|
|
5531
|
-
return <
|
|
5532
|
-
{...spreadProps()}
|
|
5533
|
-
preload={props.preload || "metadata"}
|
|
5534
|
+
return <div
|
|
5534
5535
|
style={{
|
|
5535
|
-
|
|
5536
|
-
height: "100%",
|
|
5537
|
-
...props.attributes?.style,
|
|
5538
|
-
"object-fit": props.fit,
|
|
5539
|
-
"object-position": props.position,
|
|
5540
|
-
// Hack to get object fit to work as expected and
|
|
5541
|
-
// not have the video overflow
|
|
5542
|
-
"border-radius": 1
|
|
5536
|
+
position: "relative"
|
|
5543
5537
|
}}
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5538
|
+
>
|
|
5539
|
+
<video
|
|
5540
|
+
class="builder-video"
|
|
5541
|
+
{...spreadProps()}
|
|
5542
|
+
preload={props.preload || "metadata"}
|
|
5543
|
+
style={{
|
|
5544
|
+
width: "100%",
|
|
5545
|
+
height: "100%",
|
|
5546
|
+
...props.attributes?.style,
|
|
5547
|
+
"object-fit": props.fit,
|
|
5548
|
+
"object-position": props.position,
|
|
5549
|
+
// Hack to get object fit to work as expected and
|
|
5550
|
+
// not have the video overflow
|
|
5551
|
+
"z-index": 2,
|
|
5552
|
+
"border-radius": "1px",
|
|
5553
|
+
...props.aspectRatio ? {
|
|
5554
|
+
position: "absolute"
|
|
5555
|
+
} : null
|
|
5556
|
+
}}
|
|
5557
|
+
src={props.video || "no-src"}
|
|
5558
|
+
poster={props.posterImage}
|
|
5559
|
+
><Show9 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show9></video>
|
|
5560
|
+
<Show9
|
|
5561
|
+
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
5562
|
+
><div
|
|
5563
|
+
style={{
|
|
5564
|
+
width: "100%",
|
|
5565
|
+
"padding-top": props.aspectRatio * 100 + "%",
|
|
5566
|
+
"pointer-events": "none",
|
|
5567
|
+
"font-size": "0px"
|
|
5568
|
+
}}
|
|
5569
|
+
/></Show9>
|
|
5570
|
+
<Show9 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
5571
|
+
style={{
|
|
5572
|
+
display: "flex",
|
|
5573
|
+
"flex-direction": "column",
|
|
5574
|
+
"align-items": "stretch"
|
|
5575
|
+
}}
|
|
5576
|
+
>{props.children}</div></Show9>
|
|
5577
|
+
<Show9 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
5578
|
+
style={{
|
|
5579
|
+
"pointer-events": "none",
|
|
5580
|
+
display: "flex",
|
|
5581
|
+
"flex-direction": "column",
|
|
5582
|
+
"align-items": "stretch",
|
|
5583
|
+
position: "absolute",
|
|
5584
|
+
top: "0",
|
|
5585
|
+
left: "0",
|
|
5586
|
+
width: "100%",
|
|
5587
|
+
height: "100%"
|
|
5588
|
+
}}
|
|
5589
|
+
>{props.children}</div></Show9>
|
|
5590
|
+
</div>;
|
|
5547
5591
|
}
|
|
5548
5592
|
var video_default = Video;
|
|
5549
5593
|
|
|
@@ -5606,13 +5650,19 @@ var serializeComponentInfo = ({
|
|
|
5606
5650
|
}), {}))
|
|
5607
5651
|
});
|
|
5608
5652
|
|
|
5653
|
+
// src/components/content-variants/inlined-fns.ts
|
|
5654
|
+
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}";
|
|
5655
|
+
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}";
|
|
5656
|
+
|
|
5609
5657
|
// src/components/content-variants/helpers.ts
|
|
5658
|
+
var UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = "builderIoAbTest";
|
|
5659
|
+
var UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = "builderIoRenderContent";
|
|
5610
5660
|
var getVariants = (content) => Object.values(content?.variations || {}).map((variant) => ({
|
|
5611
5661
|
...variant,
|
|
5612
5662
|
testVariationId: variant.id,
|
|
5613
5663
|
id: content?.id
|
|
5614
5664
|
}));
|
|
5615
|
-
var
|
|
5665
|
+
var checkShouldRenderVariants = ({
|
|
5616
5666
|
canTrack,
|
|
5617
5667
|
content
|
|
5618
5668
|
}) => {
|
|
@@ -5623,142 +5673,37 @@ var checkShouldRunVariants = ({
|
|
|
5623
5673
|
return false;
|
|
5624
5674
|
if (!canTrack)
|
|
5625
5675
|
return false;
|
|
5626
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
5676
|
+
if (TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte")
|
|
5627
5677
|
return true;
|
|
5628
5678
|
if (isBrowser())
|
|
5629
5679
|
return false;
|
|
5630
5680
|
return true;
|
|
5631
5681
|
};
|
|
5632
|
-
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
5633
|
-
function getAndSetVariantId2() {
|
|
5634
|
-
function setCookie2(name, value, days) {
|
|
5635
|
-
let expires = "";
|
|
5636
|
-
if (days) {
|
|
5637
|
-
const date = /* @__PURE__ */ new Date();
|
|
5638
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
5639
|
-
expires = "; expires=" + date.toUTCString();
|
|
5640
|
-
}
|
|
5641
|
-
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
5642
|
-
}
|
|
5643
|
-
function getCookie2(name) {
|
|
5644
|
-
const nameEQ = name + "=";
|
|
5645
|
-
const ca2 = document.cookie.split(";");
|
|
5646
|
-
for (let i = 0; i < ca2.length; i++) {
|
|
5647
|
-
let c = ca2[i];
|
|
5648
|
-
while (c.charAt(0) === " ")
|
|
5649
|
-
c = c.substring(1, c.length);
|
|
5650
|
-
if (c.indexOf(nameEQ) === 0)
|
|
5651
|
-
return c.substring(nameEQ.length, c.length);
|
|
5652
|
-
}
|
|
5653
|
-
return null;
|
|
5654
|
-
}
|
|
5655
|
-
const cookieName = `builder.tests.${contentId}`;
|
|
5656
|
-
const variantInCookie = getCookie2(cookieName);
|
|
5657
|
-
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
5658
|
-
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
5659
|
-
return variantInCookie;
|
|
5660
|
-
}
|
|
5661
|
-
let n = 0;
|
|
5662
|
-
const random = Math.random();
|
|
5663
|
-
for (let i = 0; i < variants.length; i++) {
|
|
5664
|
-
const variant = variants[i];
|
|
5665
|
-
const testRatio = variant.testRatio;
|
|
5666
|
-
n += testRatio;
|
|
5667
|
-
if (random < n) {
|
|
5668
|
-
setCookie2(cookieName, variant.id);
|
|
5669
|
-
return variant.id;
|
|
5670
|
-
}
|
|
5671
|
-
}
|
|
5672
|
-
setCookie2(cookieName, contentId);
|
|
5673
|
-
return contentId;
|
|
5674
|
-
}
|
|
5675
|
-
const winningVariantId = getAndSetVariantId2();
|
|
5676
|
-
const styleEl = document.currentScript?.previousElementSibling;
|
|
5677
|
-
if (isHydrationTarget2) {
|
|
5678
|
-
styleEl.remove();
|
|
5679
|
-
const thisScriptEl = document.currentScript;
|
|
5680
|
-
thisScriptEl?.remove();
|
|
5681
|
-
} else {
|
|
5682
|
-
const newStyleStr = variants.concat({
|
|
5683
|
-
id: contentId
|
|
5684
|
-
}).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
5685
|
-
return `.variant-${value.id} { display: none; }
|
|
5686
|
-
`;
|
|
5687
|
-
}).join("");
|
|
5688
|
-
styleEl.innerHTML = newStyleStr;
|
|
5689
|
-
}
|
|
5690
|
-
}
|
|
5691
|
-
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
5692
|
-
if (!navigator.cookieEnabled) {
|
|
5693
|
-
return;
|
|
5694
|
-
}
|
|
5695
|
-
function getCookie2(name) {
|
|
5696
|
-
const nameEQ = name + "=";
|
|
5697
|
-
const ca2 = document.cookie.split(";");
|
|
5698
|
-
for (let i = 0; i < ca2.length; i++) {
|
|
5699
|
-
let c = ca2[i];
|
|
5700
|
-
while (c.charAt(0) === " ")
|
|
5701
|
-
c = c.substring(1, c.length);
|
|
5702
|
-
if (c.indexOf(nameEQ) === 0)
|
|
5703
|
-
return c.substring(nameEQ.length, c.length);
|
|
5704
|
-
}
|
|
5705
|
-
return null;
|
|
5706
|
-
}
|
|
5707
|
-
const cookieName = `builder.tests.${defaultContentId}`;
|
|
5708
|
-
const variantId = getCookie2(cookieName);
|
|
5709
|
-
const parentDiv = document.currentScript?.parentElement;
|
|
5710
|
-
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
5711
|
-
if (variantId === variantContentId) {
|
|
5712
|
-
if (variantIsDefaultContent) {
|
|
5713
|
-
return;
|
|
5714
|
-
}
|
|
5715
|
-
parentDiv?.removeAttribute("hidden");
|
|
5716
|
-
parentDiv?.removeAttribute("aria-hidden");
|
|
5717
|
-
} else {
|
|
5718
|
-
if (variantIsDefaultContent) {
|
|
5719
|
-
if (isHydrationTarget2) {
|
|
5720
|
-
parentDiv?.remove();
|
|
5721
|
-
} else {
|
|
5722
|
-
parentDiv?.setAttribute("hidden", "true");
|
|
5723
|
-
parentDiv?.setAttribute("aria-hidden", "true");
|
|
5724
|
-
}
|
|
5725
|
-
}
|
|
5726
|
-
return;
|
|
5727
|
-
}
|
|
5728
|
-
return;
|
|
5729
|
-
}
|
|
5730
5682
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
5731
5683
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
5732
|
-
var
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
5736
|
-
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
5737
|
-
return `
|
|
5738
|
-
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
5739
|
-
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
5684
|
+
var getScriptString = () => `
|
|
5685
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
5686
|
+
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
5740
5687
|
`;
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
var getRenderContentScriptString = ({
|
|
5688
|
+
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
5689
|
+
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
5690
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
5691
|
+
)`;
|
|
5692
|
+
var getUpdateVariantVisibilityScript = ({
|
|
5747
5693
|
contentId,
|
|
5748
5694
|
variationId
|
|
5749
|
-
}) => {
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
};
|
|
5695
|
+
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
5696
|
+
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
5697
|
+
)`;
|
|
5753
5698
|
|
|
5754
5699
|
// src/components/inlined-script.tsx
|
|
5755
5700
|
function InlinedScript(props) {
|
|
5756
|
-
return <script innerHTML={props.scriptStr} id={props.id} />;
|
|
5701
|
+
return <script innerHTML={props.scriptStr} id={props.id || ""} />;
|
|
5757
5702
|
}
|
|
5758
5703
|
var Inlined_script_default = InlinedScript;
|
|
5759
5704
|
|
|
5760
5705
|
// src/components/content/components/enable-editor.tsx
|
|
5761
|
-
import { Show as
|
|
5706
|
+
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
5762
5707
|
|
|
5763
5708
|
// src/helpers/preview-lru-cache/get.ts
|
|
5764
5709
|
function getPreviewContent(_searchParams) {
|
|
@@ -6245,7 +6190,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6245
6190
|
};
|
|
6246
6191
|
|
|
6247
6192
|
// src/constants/sdk-version.ts
|
|
6248
|
-
var SDK_VERSION = "0.7.
|
|
6193
|
+
var SDK_VERSION = "0.7.5";
|
|
6249
6194
|
|
|
6250
6195
|
// src/functions/register.ts
|
|
6251
6196
|
var registry = {};
|
|
@@ -6380,11 +6325,11 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6380
6325
|
|
|
6381
6326
|
// src/components/content/components/enable-editor.tsx
|
|
6382
6327
|
function EnableEditor(props) {
|
|
6383
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
6384
|
-
const [lastUpdated, setLastUpdated] =
|
|
6385
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
6386
|
-
const [httpReqsData, setHttpReqsData] =
|
|
6387
|
-
const [clicked, setClicked] =
|
|
6328
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
6329
|
+
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
6330
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
6331
|
+
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
6332
|
+
const [clicked, setClicked] = createSignal10(false);
|
|
6388
6333
|
function mergeNewContent(newContent) {
|
|
6389
6334
|
const newContentValue = {
|
|
6390
6335
|
...props.builderContextSignal.content,
|
|
@@ -6627,8 +6572,8 @@ function EnableEditor(props) {
|
|
|
6627
6572
|
emitStateUpdate();
|
|
6628
6573
|
}
|
|
6629
6574
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
6630
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><
|
|
6631
|
-
class={props.
|
|
6575
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
|
|
6576
|
+
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
6632
6577
|
{...{}}
|
|
6633
6578
|
key={forceReRenderCount()}
|
|
6634
6579
|
ref={elementRef}
|
|
@@ -6640,12 +6585,12 @@ function EnableEditor(props) {
|
|
|
6640
6585
|
hidden: true,
|
|
6641
6586
|
"aria-hidden": true
|
|
6642
6587
|
}}
|
|
6643
|
-
>{props.children}</div></
|
|
6588
|
+
>{props.children}</div></Show10></builder_context_default.Provider>;
|
|
6644
6589
|
}
|
|
6645
6590
|
var Enable_editor_default = EnableEditor;
|
|
6646
6591
|
|
|
6647
6592
|
// src/components/content/components/styles.tsx
|
|
6648
|
-
import { createSignal as
|
|
6593
|
+
import { createSignal as createSignal11 } from "solid-js";
|
|
6649
6594
|
|
|
6650
6595
|
// src/components/content/components/styles.helpers.ts
|
|
6651
6596
|
var getCssFromFont = (font) => {
|
|
@@ -6704,7 +6649,7 @@ var getCss = ({
|
|
|
6704
6649
|
|
|
6705
6650
|
// src/components/content/components/styles.tsx
|
|
6706
6651
|
function ContentStyles(props) {
|
|
6707
|
-
const [injectedStyles, setInjectedStyles] =
|
|
6652
|
+
const [injectedStyles, setInjectedStyles] = createSignal11(
|
|
6708
6653
|
`
|
|
6709
6654
|
${getCss({
|
|
6710
6655
|
cssCode: props.cssCode,
|
|
@@ -6739,22 +6684,20 @@ var getContextStateInitialValue = ({
|
|
|
6739
6684
|
locale
|
|
6740
6685
|
}) => {
|
|
6741
6686
|
const defaultValues = {};
|
|
6687
|
+
const initialState = content?.data?.state || {};
|
|
6742
6688
|
content?.data?.inputs?.forEach((input) => {
|
|
6743
|
-
if (input.name && input.defaultValue !== void 0
|
|
6689
|
+
if (input.name && input.defaultValue !== void 0) {
|
|
6744
6690
|
defaultValues[input.name] = input.defaultValue;
|
|
6745
6691
|
}
|
|
6746
6692
|
});
|
|
6747
|
-
|
|
6748
|
-
...
|
|
6693
|
+
return {
|
|
6694
|
+
...defaultValues,
|
|
6695
|
+
...initialState,
|
|
6749
6696
|
...data,
|
|
6750
6697
|
...locale ? {
|
|
6751
6698
|
locale
|
|
6752
6699
|
} : {}
|
|
6753
6700
|
};
|
|
6754
|
-
return {
|
|
6755
|
-
...defaultValues,
|
|
6756
|
-
...stateToUse
|
|
6757
|
-
};
|
|
6758
6701
|
};
|
|
6759
6702
|
var getContentInitialValue = ({
|
|
6760
6703
|
content,
|
|
@@ -6772,15 +6715,15 @@ var getContentInitialValue = ({
|
|
|
6772
6715
|
|
|
6773
6716
|
// src/components/content/content.tsx
|
|
6774
6717
|
function ContentComponent(props) {
|
|
6775
|
-
const [scriptStr, setScriptStr] =
|
|
6776
|
-
|
|
6718
|
+
const [scriptStr, setScriptStr] = createSignal12(
|
|
6719
|
+
getUpdateVariantVisibilityScript({
|
|
6777
6720
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
6778
6721
|
variationId: props.content?.testVariationId,
|
|
6779
6722
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
6780
6723
|
contentId: props.content?.id
|
|
6781
6724
|
})
|
|
6782
6725
|
);
|
|
6783
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
6726
|
+
const [registeredComponents, setRegisteredComponents] = createSignal12(
|
|
6784
6727
|
[
|
|
6785
6728
|
...getDefaultRegisteredComponents(),
|
|
6786
6729
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -6801,7 +6744,7 @@ function ContentComponent(props) {
|
|
|
6801
6744
|
{}
|
|
6802
6745
|
)
|
|
6803
6746
|
);
|
|
6804
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
6747
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal12({
|
|
6805
6748
|
content: getContentInitialValue({
|
|
6806
6749
|
content: props.content,
|
|
6807
6750
|
data: props.data
|
|
@@ -6853,19 +6796,18 @@ function ContentComponent(props) {
|
|
|
6853
6796
|
locale={props.locale}
|
|
6854
6797
|
includeRefs={props.includeRefs}
|
|
6855
6798
|
enrich={props.enrich}
|
|
6856
|
-
classNameProp={props.classNameProp}
|
|
6857
6799
|
showContent={props.showContent}
|
|
6858
6800
|
builderContextSignal={builderContextSignal()}
|
|
6859
6801
|
{...{
|
|
6860
6802
|
setBuilderContextSignal
|
|
6861
6803
|
}}
|
|
6862
6804
|
>
|
|
6863
|
-
<
|
|
6864
|
-
<
|
|
6805
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
6806
|
+
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
6865
6807
|
contentId={builderContextSignal().content?.id}
|
|
6866
6808
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
6867
6809
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
6868
|
-
/></
|
|
6810
|
+
/></Show11>
|
|
6869
6811
|
<Blocks_default
|
|
6870
6812
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
6871
6813
|
context={builderContextSignal()}
|
|
@@ -6877,14 +6819,14 @@ var Content_default = ContentComponent;
|
|
|
6877
6819
|
|
|
6878
6820
|
// src/components/content-variants/content-variants.tsx
|
|
6879
6821
|
function ContentVariants(props) {
|
|
6880
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
6881
|
-
|
|
6822
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal13(
|
|
6823
|
+
checkShouldRenderVariants({
|
|
6882
6824
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
6883
6825
|
content: props.content
|
|
6884
6826
|
})
|
|
6885
6827
|
);
|
|
6886
|
-
function
|
|
6887
|
-
return
|
|
6828
|
+
function updateCookieAndStylesScriptStr() {
|
|
6829
|
+
return getUpdateCookieAndStylesScript(
|
|
6888
6830
|
getVariants(props.content).map((value) => ({
|
|
6889
6831
|
id: value.testVariationId,
|
|
6890
6832
|
testRatio: value.testRatio
|
|
@@ -6908,20 +6850,21 @@ function ContentVariants(props) {
|
|
|
6908
6850
|
setShouldRenderVariants(false);
|
|
6909
6851
|
});
|
|
6910
6852
|
return <>
|
|
6911
|
-
<
|
|
6912
|
-
<
|
|
6853
|
+
<Show12 when={!props.__isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
6854
|
+
<Show12 when={shouldRenderVariants()}>
|
|
6913
6855
|
<Inlined_styles_default
|
|
6914
6856
|
id={`variants-styles-${props.content?.id}`}
|
|
6915
6857
|
styles={hideVariantsStyleString()}
|
|
6916
6858
|
/>
|
|
6917
|
-
<Inlined_script_default
|
|
6859
|
+
<Inlined_script_default
|
|
6860
|
+
scriptStr={updateCookieAndStylesScriptStr()}
|
|
6861
|
+
/>
|
|
6918
6862
|
<For5 each={getVariants(props.content)}>{(variant, _index) => {
|
|
6919
6863
|
const index = _index();
|
|
6920
6864
|
return <Content_default
|
|
6921
6865
|
key={variant.testVariationId}
|
|
6922
6866
|
content={variant}
|
|
6923
6867
|
showContent={false}
|
|
6924
|
-
classNameProp={void 0}
|
|
6925
6868
|
model={props.model}
|
|
6926
6869
|
data={props.data}
|
|
6927
6870
|
context={props.context}
|
|
@@ -6935,11 +6878,10 @@ function ContentVariants(props) {
|
|
|
6935
6878
|
isSsrAbTest={shouldRenderVariants()}
|
|
6936
6879
|
/>;
|
|
6937
6880
|
}}</For5>
|
|
6938
|
-
</
|
|
6881
|
+
</Show12>
|
|
6939
6882
|
<Content_default
|
|
6940
6883
|
{...{}}
|
|
6941
6884
|
content={defaultContent()}
|
|
6942
|
-
classNameProp={`variant-${props.content?.id}`}
|
|
6943
6885
|
showContent={true}
|
|
6944
6886
|
model={props.model}
|
|
6945
6887
|
data={props.data}
|
|
@@ -6983,7 +6925,7 @@ var fetchSymbolContent = async ({
|
|
|
6983
6925
|
|
|
6984
6926
|
// src/blocks/symbol/symbol.tsx
|
|
6985
6927
|
function Symbol2(props) {
|
|
6986
|
-
const [contentToUse, setContentToUse] =
|
|
6928
|
+
const [contentToUse, setContentToUse] = createSignal14(props.symbol?.content);
|
|
6987
6929
|
function className() {
|
|
6988
6930
|
return [
|
|
6989
6931
|
...[props.attributes.class],
|