@builder.io/sdk-solid 2.0.2 → 2.0.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 -1
- package/lib/browser/dev.js +45 -24
- package/lib/browser/dev.jsx +102 -77
- package/lib/browser/index.js +45 -24
- package/lib/browser/index.jsx +102 -77
- package/lib/edge/dev.js +45 -24
- package/lib/edge/dev.jsx +102 -77
- package/lib/edge/index.js +45 -24
- package/lib/edge/index.jsx +102 -77
- package/lib/node/dev.js +45 -24
- package/lib/node/dev.jsx +102 -77
- package/lib/node/index.js +45 -24
- package/lib/node/index.jsx +102 -77
- package/package.json +1 -1
package/lib/node/dev.jsx
CHANGED
|
@@ -692,6 +692,9 @@ function assign(target, ..._args) {
|
|
|
692
692
|
return to;
|
|
693
693
|
}
|
|
694
694
|
function bindAnimations(animations) {
|
|
695
|
+
if (TARGET === "reactNative") {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
695
698
|
for (const animation of animations) {
|
|
696
699
|
switch (animation.trigger) {
|
|
697
700
|
case "pageLoad":
|
|
@@ -1636,6 +1639,7 @@ function Columns(props) {
|
|
|
1636
1639
|
return breakpointSizes[size].max;
|
|
1637
1640
|
}
|
|
1638
1641
|
function columnsStyles() {
|
|
1642
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1639
1643
|
return `
|
|
1640
1644
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1641
1645
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1643,7 +1647,7 @@ function Columns(props) {
|
|
|
1643
1647
|
align-items: stretch;
|
|
1644
1648
|
}
|
|
1645
1649
|
|
|
1646
|
-
|
|
1650
|
+
${childColumnDiv} {
|
|
1647
1651
|
width: var(--column-width-tablet) !important;
|
|
1648
1652
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1649
1653
|
}
|
|
@@ -1655,7 +1659,7 @@ function Columns(props) {
|
|
|
1655
1659
|
align-items: stretch;
|
|
1656
1660
|
}
|
|
1657
1661
|
|
|
1658
|
-
|
|
1662
|
+
${childColumnDiv} {
|
|
1659
1663
|
width: var(--column-width-mobile) !important;
|
|
1660
1664
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1661
1665
|
}
|
|
@@ -1674,7 +1678,7 @@ function Columns(props) {
|
|
|
1674
1678
|
}
|
|
1675
1679
|
return <>
|
|
1676
1680
|
<div
|
|
1677
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1681
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
|
|
1678
1682
|
style={columnsCssVars()}
|
|
1679
1683
|
{...{}}
|
|
1680
1684
|
>
|
|
@@ -1703,7 +1707,7 @@ function Columns(props) {
|
|
|
1703
1707
|
/></Dynamic_renderer_default>;
|
|
1704
1708
|
}}</For4>
|
|
1705
1709
|
</div>
|
|
1706
|
-
<style>{`.div-
|
|
1710
|
+
<style>{`.div-3ff242de {
|
|
1707
1711
|
display: flex;
|
|
1708
1712
|
line-height: normal;
|
|
1709
1713
|
}`}</style>
|
|
@@ -1718,7 +1722,7 @@ function FragmentComponent(props) {
|
|
|
1718
1722
|
var fragment_default = FragmentComponent;
|
|
1719
1723
|
|
|
1720
1724
|
// src/blocks/image/image.tsx
|
|
1721
|
-
import { Show as Show7, createMemo as createMemo8 } from "solid-js";
|
|
1725
|
+
import { Show as Show7, onMount as onMount2, createMemo as createMemo8 } from "solid-js";
|
|
1722
1726
|
|
|
1723
1727
|
// src/blocks/image/image.helpers.ts
|
|
1724
1728
|
function removeProtocol(path) {
|
|
@@ -1808,12 +1812,14 @@ function Image(props) {
|
|
|
1808
1812
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1809
1813
|
return out;
|
|
1810
1814
|
});
|
|
1815
|
+
onMount2(() => {
|
|
1816
|
+
});
|
|
1811
1817
|
return <>
|
|
1812
1818
|
<>
|
|
1813
1819
|
<picture>
|
|
1814
1820
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
1815
1821
|
<img
|
|
1816
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1822
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
|
|
1817
1823
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1818
1824
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1819
1825
|
alt={props.altText}
|
|
@@ -1831,22 +1837,22 @@ function Image(props) {
|
|
|
1831
1837
|
<Show7
|
|
1832
1838
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1833
1839
|
><div
|
|
1834
|
-
class="builder-image-sizer div-
|
|
1840
|
+
class="builder-image-sizer div-4512e110"
|
|
1835
1841
|
style={{
|
|
1836
1842
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1837
1843
|
}}
|
|
1838
1844
|
/></Show7>
|
|
1839
1845
|
<Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
|
|
1840
|
-
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1846
|
+
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
|
|
1841
1847
|
</>
|
|
1842
|
-
<style>{`.img-
|
|
1848
|
+
<style>{`.img-4512e110 {
|
|
1843
1849
|
opacity: 1;
|
|
1844
1850
|
transition: opacity 0.2s ease-in-out;
|
|
1845
|
-
}.div-
|
|
1851
|
+
}.div-4512e110 {
|
|
1846
1852
|
width: 100%;
|
|
1847
1853
|
pointer-events: none;
|
|
1848
1854
|
font-size: 0;
|
|
1849
|
-
}.div-
|
|
1855
|
+
}.div-4512e110-2 {
|
|
1850
1856
|
display: flex;
|
|
1851
1857
|
flex-direction: column;
|
|
1852
1858
|
align-items: stretch;
|
|
@@ -1882,10 +1888,10 @@ function SectionComponent(props) {
|
|
|
1882
1888
|
var section_default = SectionComponent;
|
|
1883
1889
|
|
|
1884
1890
|
// src/blocks/symbol/symbol.tsx
|
|
1885
|
-
import { onMount as
|
|
1891
|
+
import { onMount as onMount6, on as on3, createEffect as createEffect3, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1886
1892
|
|
|
1887
1893
|
// src/components/content-variants/content-variants.tsx
|
|
1888
|
-
import { Show as Show14, For as For9, onMount as
|
|
1894
|
+
import { Show as Show14, For as For9, onMount as onMount5, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1889
1895
|
|
|
1890
1896
|
// src/helpers/url.ts
|
|
1891
1897
|
var getTopLevelDomain = (host) => {
|
|
@@ -2079,7 +2085,7 @@ var handleABTesting = async ({
|
|
|
2079
2085
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2080
2086
|
|
|
2081
2087
|
// src/components/content/content.tsx
|
|
2082
|
-
import { Show as Show13, createSignal as
|
|
2088
|
+
import { Show as Show13, createSignal as createSignal18 } from "solid-js";
|
|
2083
2089
|
|
|
2084
2090
|
// src/blocks/accordion/component-info.ts
|
|
2085
2091
|
var defaultTitle = {
|
|
@@ -3093,7 +3099,8 @@ var tabs_default = Tabs;
|
|
|
3093
3099
|
// src/blocks/text/component-info.ts
|
|
3094
3100
|
var componentInfo10 = {
|
|
3095
3101
|
shouldReceiveBuilderProps: {
|
|
3096
|
-
builderBlock: TARGET === "reactNative" ? true : false
|
|
3102
|
+
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3103
|
+
builderContext: true
|
|
3097
3104
|
},
|
|
3098
3105
|
name: "Text",
|
|
3099
3106
|
static: true,
|
|
@@ -3115,10 +3122,31 @@ var componentInfo10 = {
|
|
|
3115
3122
|
};
|
|
3116
3123
|
|
|
3117
3124
|
// src/blocks/text/text.tsx
|
|
3125
|
+
import { createMemo as createMemo11 } from "solid-js";
|
|
3118
3126
|
function Text(props) {
|
|
3127
|
+
const processedText = createMemo11(() => {
|
|
3128
|
+
const context = props.builderContext;
|
|
3129
|
+
const {
|
|
3130
|
+
context: contextContext,
|
|
3131
|
+
localState,
|
|
3132
|
+
rootState,
|
|
3133
|
+
rootSetState
|
|
3134
|
+
} = context;
|
|
3135
|
+
return String(props.text?.toString() || "").replace(
|
|
3136
|
+
/{{([^}]+)}}/g,
|
|
3137
|
+
(match, group) => evaluate({
|
|
3138
|
+
code: group,
|
|
3139
|
+
context: contextContext,
|
|
3140
|
+
localState,
|
|
3141
|
+
rootState,
|
|
3142
|
+
rootSetState,
|
|
3143
|
+
enableCache: false
|
|
3144
|
+
})
|
|
3145
|
+
);
|
|
3146
|
+
});
|
|
3119
3147
|
return <><div
|
|
3120
3148
|
class="builder-text"
|
|
3121
|
-
innerHTML={
|
|
3149
|
+
innerHTML={processedText()}
|
|
3122
3150
|
style={{
|
|
3123
3151
|
outline: "none"
|
|
3124
3152
|
}}
|
|
@@ -3152,12 +3180,12 @@ var componentInfo11 = {
|
|
|
3152
3180
|
};
|
|
3153
3181
|
|
|
3154
3182
|
// src/blocks/custom-code/custom-code.tsx
|
|
3155
|
-
import { onMount as
|
|
3183
|
+
import { onMount as onMount3, createSignal as createSignal12 } from "solid-js";
|
|
3156
3184
|
function CustomCode(props) {
|
|
3157
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3158
|
-
const [scriptsRun, setScriptsRun] =
|
|
3185
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3186
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3159
3187
|
let elementRef;
|
|
3160
|
-
|
|
3188
|
+
onMount3(() => {
|
|
3161
3189
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3162
3190
|
return;
|
|
3163
3191
|
}
|
|
@@ -3217,7 +3245,7 @@ var componentInfo12 = {
|
|
|
3217
3245
|
};
|
|
3218
3246
|
|
|
3219
3247
|
// src/blocks/embed/embed.tsx
|
|
3220
|
-
import { on, createEffect, createMemo as
|
|
3248
|
+
import { on, createEffect, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3221
3249
|
|
|
3222
3250
|
// src/blocks/embed/helpers.ts
|
|
3223
3251
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3225,9 +3253,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3225
3253
|
|
|
3226
3254
|
// src/blocks/embed/embed.tsx
|
|
3227
3255
|
function Embed(props) {
|
|
3228
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3229
|
-
const [scriptsRun, setScriptsRun] =
|
|
3230
|
-
const [ranInitFn, setRanInitFn] =
|
|
3256
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
3257
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
3258
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
3231
3259
|
function findAndRunScripts() {
|
|
3232
3260
|
if (!elem || !elem.getElementsByTagName)
|
|
3233
3261
|
return;
|
|
@@ -3251,8 +3279,8 @@ function Embed(props) {
|
|
|
3251
3279
|
}
|
|
3252
3280
|
}
|
|
3253
3281
|
let elem;
|
|
3254
|
-
const onUpdateFn_0_elem =
|
|
3255
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3282
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
3283
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
3256
3284
|
function onUpdateFn_0() {
|
|
3257
3285
|
if (elem && !ranInitFn()) {
|
|
3258
3286
|
setRanInitFn(true);
|
|
@@ -3507,7 +3535,7 @@ var componentInfo13 = {
|
|
|
3507
3535
|
};
|
|
3508
3536
|
|
|
3509
3537
|
// src/blocks/form/form/form.tsx
|
|
3510
|
-
import { Show as Show10, For as For7, createSignal as
|
|
3538
|
+
import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
|
|
3511
3539
|
|
|
3512
3540
|
// src/functions/get-env.ts
|
|
3513
3541
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3524,9 +3552,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
3524
3552
|
|
|
3525
3553
|
// src/blocks/form/form/form.tsx
|
|
3526
3554
|
function FormComponent(props) {
|
|
3527
|
-
const [formState, setFormState] =
|
|
3528
|
-
const [responseData, setResponseData] =
|
|
3529
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3555
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
3556
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
3557
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
3530
3558
|
function mergeNewRootState(newData) {
|
|
3531
3559
|
const combinedState = {
|
|
3532
3560
|
...props.builderContext.rootState,
|
|
@@ -4099,9 +4127,9 @@ var componentInfo19 = {
|
|
|
4099
4127
|
};
|
|
4100
4128
|
|
|
4101
4129
|
// src/blocks/video/video.tsx
|
|
4102
|
-
import { Show as Show11, createMemo as
|
|
4130
|
+
import { Show as Show11, createMemo as createMemo15 } from "solid-js";
|
|
4103
4131
|
function Video(props) {
|
|
4104
|
-
const videoProps =
|
|
4132
|
+
const videoProps = createMemo15(() => {
|
|
4105
4133
|
return {
|
|
4106
4134
|
...props.autoPlay === true ? {
|
|
4107
4135
|
autoPlay: true
|
|
@@ -4120,7 +4148,7 @@ function Video(props) {
|
|
|
4120
4148
|
} : {}
|
|
4121
4149
|
};
|
|
4122
4150
|
});
|
|
4123
|
-
const spreadProps =
|
|
4151
|
+
const spreadProps = createMemo15(() => {
|
|
4124
4152
|
return {
|
|
4125
4153
|
...videoProps()
|
|
4126
4154
|
};
|
|
@@ -4258,17 +4286,14 @@ var serializeFn = (fnValue) => {
|
|
|
4258
4286
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4259
4287
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4260
4288
|
};
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
}
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
[key]: serializeValue(value)
|
|
4270
|
-
}), {}))
|
|
4271
|
-
});
|
|
4289
|
+
function serializeComponentInfo(info) {
|
|
4290
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4291
|
+
if (typeof value === "function") {
|
|
4292
|
+
return serializeFn(value);
|
|
4293
|
+
}
|
|
4294
|
+
return value;
|
|
4295
|
+
}));
|
|
4296
|
+
}
|
|
4272
4297
|
|
|
4273
4298
|
// src/components/content-variants/inlined-fns.ts
|
|
4274
4299
|
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}";
|
|
@@ -4329,11 +4354,11 @@ var Inlined_script_default = InlinedScript;
|
|
|
4329
4354
|
// src/components/content/components/enable-editor.tsx
|
|
4330
4355
|
import {
|
|
4331
4356
|
Show as Show12,
|
|
4332
|
-
onMount as
|
|
4357
|
+
onMount as onMount4,
|
|
4333
4358
|
on as on2,
|
|
4334
4359
|
createEffect as createEffect2,
|
|
4335
|
-
createMemo as
|
|
4336
|
-
createSignal as
|
|
4360
|
+
createMemo as createMemo16,
|
|
4361
|
+
createSignal as createSignal16
|
|
4337
4362
|
} from "solid-js";
|
|
4338
4363
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4339
4364
|
|
|
@@ -4836,7 +4861,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4836
4861
|
}
|
|
4837
4862
|
|
|
4838
4863
|
// src/constants/sdk-version.ts
|
|
4839
|
-
var SDK_VERSION = "2.0.
|
|
4864
|
+
var SDK_VERSION = "2.0.5";
|
|
4840
4865
|
|
|
4841
4866
|
// src/functions/register.ts
|
|
4842
4867
|
var registry = {};
|
|
@@ -5114,12 +5139,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5114
5139
|
|
|
5115
5140
|
// src/components/content/components/enable-editor.tsx
|
|
5116
5141
|
function EnableEditor(props) {
|
|
5117
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5142
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
5118
5143
|
props.contentWrapper || "div"
|
|
5119
5144
|
);
|
|
5120
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5121
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5122
|
-
const [clicked, setClicked] =
|
|
5145
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
5146
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
5147
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
5123
5148
|
function mergeNewRootState(newData) {
|
|
5124
5149
|
const combinedState = {
|
|
5125
5150
|
...props.builderContextSignal.rootState,
|
|
@@ -5153,7 +5178,7 @@ function EnableEditor(props) {
|
|
|
5153
5178
|
content: newContentValue
|
|
5154
5179
|
}));
|
|
5155
5180
|
}
|
|
5156
|
-
const showContentProps =
|
|
5181
|
+
const showContentProps = createMemo16(() => {
|
|
5157
5182
|
return props.showContent ? {} : {
|
|
5158
5183
|
hidden: true,
|
|
5159
5184
|
"aria-hidden": true
|
|
@@ -5273,7 +5298,7 @@ function EnableEditor(props) {
|
|
|
5273
5298
|
}
|
|
5274
5299
|
}
|
|
5275
5300
|
let elementRef;
|
|
5276
|
-
|
|
5301
|
+
onMount4(() => {
|
|
5277
5302
|
if (isBrowser()) {
|
|
5278
5303
|
if (isEditing()) {
|
|
5279
5304
|
window.addEventListener("message", processMessage);
|
|
@@ -5334,7 +5359,7 @@ function EnableEditor(props) {
|
|
|
5334
5359
|
}
|
|
5335
5360
|
}
|
|
5336
5361
|
});
|
|
5337
|
-
|
|
5362
|
+
onMount4(() => {
|
|
5338
5363
|
if (!props.apiKey) {
|
|
5339
5364
|
logger.error(
|
|
5340
5365
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -5344,14 +5369,14 @@ function EnableEditor(props) {
|
|
|
5344
5369
|
runHttpRequests();
|
|
5345
5370
|
emitStateUpdate();
|
|
5346
5371
|
});
|
|
5347
|
-
const onUpdateFn_0_props_content =
|
|
5372
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
5348
5373
|
function onUpdateFn_0() {
|
|
5349
5374
|
if (props.content) {
|
|
5350
5375
|
mergeNewContent(props.content);
|
|
5351
5376
|
}
|
|
5352
5377
|
}
|
|
5353
5378
|
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5354
|
-
const onUpdateFn_1_props_builderContextSignal_content__data__jsCode =
|
|
5379
|
+
const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
|
|
5355
5380
|
function onUpdateFn_1() {
|
|
5356
5381
|
evaluateJsCode();
|
|
5357
5382
|
}
|
|
@@ -5361,7 +5386,7 @@ function EnableEditor(props) {
|
|
|
5361
5386
|
onUpdateFn_1
|
|
5362
5387
|
)
|
|
5363
5388
|
);
|
|
5364
|
-
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests =
|
|
5389
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
5365
5390
|
function onUpdateFn_2() {
|
|
5366
5391
|
runHttpRequests();
|
|
5367
5392
|
}
|
|
@@ -5373,7 +5398,7 @@ function EnableEditor(props) {
|
|
|
5373
5398
|
onUpdateFn_2
|
|
5374
5399
|
)
|
|
5375
5400
|
);
|
|
5376
|
-
const onUpdateFn_3_props_builderContextSignal_rootState =
|
|
5401
|
+
const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
|
|
5377
5402
|
() => props.builderContextSignal.rootState
|
|
5378
5403
|
);
|
|
5379
5404
|
function onUpdateFn_3() {
|
|
@@ -5385,14 +5410,14 @@ function EnableEditor(props) {
|
|
|
5385
5410
|
onUpdateFn_3
|
|
5386
5411
|
)
|
|
5387
5412
|
);
|
|
5388
|
-
const onUpdateFn_4_props_data =
|
|
5413
|
+
const onUpdateFn_4_props_data = createMemo16(() => props.data);
|
|
5389
5414
|
function onUpdateFn_4() {
|
|
5390
5415
|
if (props.data) {
|
|
5391
5416
|
mergeNewRootState(props.data);
|
|
5392
5417
|
}
|
|
5393
5418
|
}
|
|
5394
5419
|
createEffect2(on2(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
|
|
5395
|
-
const onUpdateFn_5_props_locale =
|
|
5420
|
+
const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
|
|
5396
5421
|
function onUpdateFn_5() {
|
|
5397
5422
|
if (props.locale) {
|
|
5398
5423
|
mergeNewRootState({
|
|
@@ -5419,9 +5444,9 @@ function EnableEditor(props) {
|
|
|
5419
5444
|
var Enable_editor_default = EnableEditor;
|
|
5420
5445
|
|
|
5421
5446
|
// src/components/content/components/styles.tsx
|
|
5422
|
-
import { createSignal as
|
|
5447
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
5423
5448
|
function ContentStyles(props) {
|
|
5424
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5449
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
5425
5450
|
`
|
|
5426
5451
|
${getCss({
|
|
5427
5452
|
cssCode: props.cssCode,
|
|
@@ -5479,7 +5504,7 @@ var getContentInitialValue = ({
|
|
|
5479
5504
|
|
|
5480
5505
|
// src/components/content/content.tsx
|
|
5481
5506
|
function ContentComponent(props) {
|
|
5482
|
-
const [scriptStr, setScriptStr] =
|
|
5507
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
5483
5508
|
getUpdateVariantVisibilityScript({
|
|
5484
5509
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5485
5510
|
variationId: props.content?.testVariationId,
|
|
@@ -5487,7 +5512,7 @@ function ContentComponent(props) {
|
|
|
5487
5512
|
contentId: props.content?.id
|
|
5488
5513
|
})
|
|
5489
5514
|
);
|
|
5490
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5515
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
5491
5516
|
[
|
|
5492
5517
|
...getDefaultRegisteredComponents(),
|
|
5493
5518
|
...props.customComponents?.filter(({ models }) => {
|
|
@@ -5508,7 +5533,7 @@ function ContentComponent(props) {
|
|
|
5508
5533
|
{}
|
|
5509
5534
|
)
|
|
5510
5535
|
);
|
|
5511
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5536
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
5512
5537
|
content: getContentInitialValue({
|
|
5513
5538
|
content: props.content,
|
|
5514
5539
|
data: props.data
|
|
@@ -5598,13 +5623,13 @@ var Content_default = ContentComponent;
|
|
|
5598
5623
|
|
|
5599
5624
|
// src/components/content-variants/content-variants.tsx
|
|
5600
5625
|
function ContentVariants(props) {
|
|
5601
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5626
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
5602
5627
|
checkShouldRenderVariants({
|
|
5603
5628
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5604
5629
|
content: props.content
|
|
5605
5630
|
})
|
|
5606
5631
|
);
|
|
5607
|
-
const updateCookieAndStylesScriptStr =
|
|
5632
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
5608
5633
|
return getUpdateCookieAndStylesScript(
|
|
5609
5634
|
getVariants(props.content).map((value) => ({
|
|
5610
5635
|
id: value.testVariationId,
|
|
@@ -5613,10 +5638,10 @@ function ContentVariants(props) {
|
|
|
5613
5638
|
props.content?.id || ""
|
|
5614
5639
|
);
|
|
5615
5640
|
});
|
|
5616
|
-
const hideVariantsStyleString =
|
|
5641
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
5617
5642
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5618
5643
|
});
|
|
5619
|
-
const defaultContent =
|
|
5644
|
+
const defaultContent = createMemo19(() => {
|
|
5620
5645
|
return shouldRenderVariants() ? {
|
|
5621
5646
|
...props.content,
|
|
5622
5647
|
testVariationId: props.content?.id
|
|
@@ -5625,7 +5650,7 @@ function ContentVariants(props) {
|
|
|
5625
5650
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5626
5651
|
});
|
|
5627
5652
|
});
|
|
5628
|
-
|
|
5653
|
+
onMount5(() => {
|
|
5629
5654
|
setShouldRenderVariants(false);
|
|
5630
5655
|
});
|
|
5631
5656
|
return <><>
|
|
@@ -5725,14 +5750,14 @@ var fetchSymbolContent = async ({
|
|
|
5725
5750
|
|
|
5726
5751
|
// src/blocks/symbol/symbol.tsx
|
|
5727
5752
|
function Symbol(props) {
|
|
5728
|
-
const [contentToUse, setContentToUse] =
|
|
5729
|
-
const blocksWrapper =
|
|
5753
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
5754
|
+
const blocksWrapper = createMemo20(() => {
|
|
5730
5755
|
return "div";
|
|
5731
5756
|
});
|
|
5732
|
-
const contentWrapper =
|
|
5757
|
+
const contentWrapper = createMemo20(() => {
|
|
5733
5758
|
return "div";
|
|
5734
5759
|
});
|
|
5735
|
-
const className =
|
|
5760
|
+
const className = createMemo20(() => {
|
|
5736
5761
|
return [
|
|
5737
5762
|
...[props.attributes[getClassPropName()]],
|
|
5738
5763
|
"builder-symbol",
|
|
@@ -5752,9 +5777,9 @@ function Symbol(props) {
|
|
|
5752
5777
|
}
|
|
5753
5778
|
});
|
|
5754
5779
|
}
|
|
5755
|
-
|
|
5780
|
+
onMount6(() => {
|
|
5756
5781
|
});
|
|
5757
|
-
const onUpdateFn_0_props_symbol =
|
|
5782
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
5758
5783
|
function onUpdateFn_0() {
|
|
5759
5784
|
setContent();
|
|
5760
5785
|
}
|
package/lib/node/index.js
CHANGED
|
@@ -701,6 +701,9 @@ function assign(target, ..._args) {
|
|
|
701
701
|
return to;
|
|
702
702
|
}
|
|
703
703
|
function bindAnimations(animations) {
|
|
704
|
+
if (TARGET === "reactNative") {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
704
707
|
for (const animation of animations) {
|
|
705
708
|
switch (animation.trigger) {
|
|
706
709
|
case "pageLoad":
|
|
@@ -1727,7 +1730,7 @@ var getColumnsClass = (id) => {
|
|
|
1727
1730
|
|
|
1728
1731
|
// src/blocks/columns/columns.tsx
|
|
1729
1732
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1730
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1733
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1731
1734
|
display: flex;
|
|
1732
1735
|
line-height: normal;
|
|
1733
1736
|
}`);
|
|
@@ -1807,6 +1810,7 @@ function Columns(props) {
|
|
|
1807
1810
|
return breakpointSizes[size].max;
|
|
1808
1811
|
}
|
|
1809
1812
|
function columnsStyles() {
|
|
1813
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1810
1814
|
return `
|
|
1811
1815
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1812
1816
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1814,7 +1818,7 @@ function Columns(props) {
|
|
|
1814
1818
|
align-items: stretch;
|
|
1815
1819
|
}
|
|
1816
1820
|
|
|
1817
|
-
|
|
1821
|
+
${childColumnDiv} {
|
|
1818
1822
|
width: var(--column-width-tablet) !important;
|
|
1819
1823
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1820
1824
|
}
|
|
@@ -1826,7 +1830,7 @@ function Columns(props) {
|
|
|
1826
1830
|
align-items: stretch;
|
|
1827
1831
|
}
|
|
1828
1832
|
|
|
1829
|
-
|
|
1833
|
+
${childColumnDiv} {
|
|
1830
1834
|
width: var(--column-width-mobile) !important;
|
|
1831
1835
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1832
1836
|
}
|
|
@@ -1847,7 +1851,7 @@ function Columns(props) {
|
|
|
1847
1851
|
const _el$ = _tmpl$3();
|
|
1848
1852
|
spread(_el$, mergeProps({
|
|
1849
1853
|
get ["class"]() {
|
|
1850
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1854
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1851
1855
|
},
|
|
1852
1856
|
get style() {
|
|
1853
1857
|
return columnsCssVars();
|
|
@@ -1972,16 +1976,16 @@ function getSrcSet(url) {
|
|
|
1972
1976
|
// src/blocks/image/image.tsx
|
|
1973
1977
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1974
1978
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1975
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1976
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1977
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1979
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-4512e110">`);
|
|
1980
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-4512e110-2>`);
|
|
1981
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-4512e110 {
|
|
1978
1982
|
opacity: 1;
|
|
1979
1983
|
transition: opacity 0.2s ease-in-out;
|
|
1980
|
-
}.div-
|
|
1984
|
+
}.div-4512e110 {
|
|
1981
1985
|
width: 100%;
|
|
1982
1986
|
pointer-events: none;
|
|
1983
1987
|
font-size: 0;
|
|
1984
|
-
}.div-
|
|
1988
|
+
}.div-4512e110-2 {
|
|
1985
1989
|
display: flex;
|
|
1986
1990
|
flex-direction: column;
|
|
1987
1991
|
align-items: stretch;
|
|
@@ -2030,6 +2034,8 @@ function Image(props) {
|
|
|
2030
2034
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
2031
2035
|
return out;
|
|
2032
2036
|
});
|
|
2037
|
+
onMount(() => {
|
|
2038
|
+
});
|
|
2033
2039
|
return [[(() => {
|
|
2034
2040
|
const _el$ = _tmpl$23(), _el$3 = _el$.firstChild;
|
|
2035
2041
|
insert(_el$, createComponent(Show, {
|
|
@@ -2043,7 +2049,7 @@ function Image(props) {
|
|
|
2043
2049
|
}
|
|
2044
2050
|
}), _el$3);
|
|
2045
2051
|
effect((_p$) => {
|
|
2046
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
2052
|
+
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-4512e110", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
|
|
2047
2053
|
"object-position": props.backgroundPosition || "center",
|
|
2048
2054
|
"object-fit": props.backgroundSize || "cover",
|
|
2049
2055
|
...aspectRatioCss()
|
|
@@ -3413,7 +3419,8 @@ delegateEvents(["click"]);
|
|
|
3413
3419
|
// src/blocks/text/component-info.ts
|
|
3414
3420
|
var componentInfo10 = {
|
|
3415
3421
|
shouldReceiveBuilderProps: {
|
|
3416
|
-
builderBlock: TARGET === "reactNative" ? true : false
|
|
3422
|
+
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3423
|
+
builderContext: true
|
|
3417
3424
|
},
|
|
3418
3425
|
name: "Text",
|
|
3419
3426
|
static: true,
|
|
@@ -3435,10 +3442,27 @@ var componentInfo10 = {
|
|
|
3435
3442
|
};
|
|
3436
3443
|
var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
3437
3444
|
function Text(props) {
|
|
3445
|
+
const processedText = createMemo(() => {
|
|
3446
|
+
const context = props.builderContext;
|
|
3447
|
+
const {
|
|
3448
|
+
context: contextContext,
|
|
3449
|
+
localState,
|
|
3450
|
+
rootState,
|
|
3451
|
+
rootSetState
|
|
3452
|
+
} = context;
|
|
3453
|
+
return String(props.text?.toString() || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
|
|
3454
|
+
code: group,
|
|
3455
|
+
context: contextContext,
|
|
3456
|
+
localState,
|
|
3457
|
+
rootState,
|
|
3458
|
+
rootSetState,
|
|
3459
|
+
enableCache: false
|
|
3460
|
+
}));
|
|
3461
|
+
});
|
|
3438
3462
|
return (() => {
|
|
3439
3463
|
const _el$ = _tmpl$10();
|
|
3440
3464
|
_el$.style.setProperty("outline", "none");
|
|
3441
|
-
effect(() => _el$.innerHTML =
|
|
3465
|
+
effect(() => _el$.innerHTML = processedText());
|
|
3442
3466
|
return _el$;
|
|
3443
3467
|
})();
|
|
3444
3468
|
}
|
|
@@ -4735,17 +4759,14 @@ var serializeFn = (fnValue) => {
|
|
|
4735
4759
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4736
4760
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4737
4761
|
};
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
}
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
[key]: serializeValue(value)
|
|
4747
|
-
}), {}))
|
|
4748
|
-
});
|
|
4762
|
+
function serializeComponentInfo(info) {
|
|
4763
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4764
|
+
if (typeof value === "function") {
|
|
4765
|
+
return serializeFn(value);
|
|
4766
|
+
}
|
|
4767
|
+
return value;
|
|
4768
|
+
}));
|
|
4769
|
+
}
|
|
4749
4770
|
|
|
4750
4771
|
// src/components/content-variants/inlined-fns.ts
|
|
4751
4772
|
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}";
|
|
@@ -5306,7 +5327,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5306
5327
|
}
|
|
5307
5328
|
|
|
5308
5329
|
// src/constants/sdk-version.ts
|
|
5309
|
-
var SDK_VERSION = "2.0.
|
|
5330
|
+
var SDK_VERSION = "2.0.5";
|
|
5310
5331
|
|
|
5311
5332
|
// src/functions/register.ts
|
|
5312
5333
|
var registry = {};
|