@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/edge/index.jsx
CHANGED
|
@@ -3666,6 +3666,9 @@ function assign(target, ..._args) {
|
|
|
3666
3666
|
return to;
|
|
3667
3667
|
}
|
|
3668
3668
|
function bindAnimations(animations) {
|
|
3669
|
+
if (TARGET === "reactNative") {
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3669
3672
|
for (const animation of animations) {
|
|
3670
3673
|
switch (animation.trigger) {
|
|
3671
3674
|
case "pageLoad":
|
|
@@ -4606,6 +4609,7 @@ function Columns(props) {
|
|
|
4606
4609
|
return breakpointSizes[size].max;
|
|
4607
4610
|
}
|
|
4608
4611
|
function columnsStyles() {
|
|
4612
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
4609
4613
|
return `
|
|
4610
4614
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
4611
4615
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -4613,7 +4617,7 @@ function Columns(props) {
|
|
|
4613
4617
|
align-items: stretch;
|
|
4614
4618
|
}
|
|
4615
4619
|
|
|
4616
|
-
|
|
4620
|
+
${childColumnDiv} {
|
|
4617
4621
|
width: var(--column-width-tablet) !important;
|
|
4618
4622
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
4619
4623
|
}
|
|
@@ -4625,7 +4629,7 @@ function Columns(props) {
|
|
|
4625
4629
|
align-items: stretch;
|
|
4626
4630
|
}
|
|
4627
4631
|
|
|
4628
|
-
|
|
4632
|
+
${childColumnDiv} {
|
|
4629
4633
|
width: var(--column-width-mobile) !important;
|
|
4630
4634
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
4631
4635
|
}
|
|
@@ -4644,7 +4648,7 @@ function Columns(props) {
|
|
|
4644
4648
|
}
|
|
4645
4649
|
return <>
|
|
4646
4650
|
<div
|
|
4647
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
4651
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
|
|
4648
4652
|
style={columnsCssVars()}
|
|
4649
4653
|
{...{}}
|
|
4650
4654
|
>
|
|
@@ -4673,7 +4677,7 @@ function Columns(props) {
|
|
|
4673
4677
|
/></Dynamic_renderer_default>;
|
|
4674
4678
|
}}</For4>
|
|
4675
4679
|
</div>
|
|
4676
|
-
<style>{`.div-
|
|
4680
|
+
<style>{`.div-3ff242de {
|
|
4677
4681
|
display: flex;
|
|
4678
4682
|
line-height: normal;
|
|
4679
4683
|
}`}</style>
|
|
@@ -4688,7 +4692,7 @@ function FragmentComponent(props) {
|
|
|
4688
4692
|
var fragment_default = FragmentComponent;
|
|
4689
4693
|
|
|
4690
4694
|
// src/blocks/image/image.tsx
|
|
4691
|
-
import { Show as Show7, createMemo as createMemo8 } from "solid-js";
|
|
4695
|
+
import { Show as Show7, onMount as onMount2, createMemo as createMemo8 } from "solid-js";
|
|
4692
4696
|
|
|
4693
4697
|
// src/blocks/image/image.helpers.ts
|
|
4694
4698
|
function removeProtocol(path) {
|
|
@@ -4777,12 +4781,14 @@ function Image(props) {
|
|
|
4777
4781
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
4778
4782
|
return out;
|
|
4779
4783
|
});
|
|
4784
|
+
onMount2(() => {
|
|
4785
|
+
});
|
|
4780
4786
|
return <>
|
|
4781
4787
|
<>
|
|
4782
4788
|
<picture>
|
|
4783
4789
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
4784
4790
|
<img
|
|
4785
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
4791
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
|
|
4786
4792
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
4787
4793
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
4788
4794
|
alt={props.altText}
|
|
@@ -4800,22 +4806,22 @@ function Image(props) {
|
|
|
4800
4806
|
<Show7
|
|
4801
4807
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
4802
4808
|
><div
|
|
4803
|
-
class="builder-image-sizer div-
|
|
4809
|
+
class="builder-image-sizer div-4512e110"
|
|
4804
4810
|
style={{
|
|
4805
4811
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
4806
4812
|
}}
|
|
4807
4813
|
/></Show7>
|
|
4808
4814
|
<Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
|
|
4809
|
-
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
4815
|
+
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
|
|
4810
4816
|
</>
|
|
4811
|
-
<style>{`.img-
|
|
4817
|
+
<style>{`.img-4512e110 {
|
|
4812
4818
|
opacity: 1;
|
|
4813
4819
|
transition: opacity 0.2s ease-in-out;
|
|
4814
|
-
}.div-
|
|
4820
|
+
}.div-4512e110 {
|
|
4815
4821
|
width: 100%;
|
|
4816
4822
|
pointer-events: none;
|
|
4817
4823
|
font-size: 0;
|
|
4818
|
-
}.div-
|
|
4824
|
+
}.div-4512e110-2 {
|
|
4819
4825
|
display: flex;
|
|
4820
4826
|
flex-direction: column;
|
|
4821
4827
|
align-items: stretch;
|
|
@@ -4851,10 +4857,10 @@ function SectionComponent(props) {
|
|
|
4851
4857
|
var section_default = SectionComponent;
|
|
4852
4858
|
|
|
4853
4859
|
// src/blocks/symbol/symbol.tsx
|
|
4854
|
-
import { onMount as
|
|
4860
|
+
import { onMount as onMount6, on as on3, createEffect as createEffect3, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
4855
4861
|
|
|
4856
4862
|
// src/components/content-variants/content-variants.tsx
|
|
4857
|
-
import { Show as Show14, For as For9, onMount as
|
|
4863
|
+
import { Show as Show14, For as For9, onMount as onMount5, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
4858
4864
|
|
|
4859
4865
|
// src/helpers/url.ts
|
|
4860
4866
|
var getTopLevelDomain = (host) => {
|
|
@@ -5048,7 +5054,7 @@ var handleABTesting = async ({
|
|
|
5048
5054
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
5049
5055
|
|
|
5050
5056
|
// src/components/content/content.tsx
|
|
5051
|
-
import { Show as Show13, createSignal as
|
|
5057
|
+
import { Show as Show13, createSignal as createSignal18 } from "solid-js";
|
|
5052
5058
|
|
|
5053
5059
|
// src/blocks/accordion/component-info.ts
|
|
5054
5060
|
var defaultTitle = {
|
|
@@ -6061,7 +6067,8 @@ var tabs_default = Tabs;
|
|
|
6061
6067
|
// src/blocks/text/component-info.ts
|
|
6062
6068
|
var componentInfo10 = {
|
|
6063
6069
|
shouldReceiveBuilderProps: {
|
|
6064
|
-
builderBlock: TARGET === "reactNative" ? true : false
|
|
6070
|
+
builderBlock: TARGET === "reactNative" ? true : false,
|
|
6071
|
+
builderContext: true
|
|
6065
6072
|
},
|
|
6066
6073
|
name: "Text",
|
|
6067
6074
|
static: true,
|
|
@@ -6083,10 +6090,31 @@ var componentInfo10 = {
|
|
|
6083
6090
|
};
|
|
6084
6091
|
|
|
6085
6092
|
// src/blocks/text/text.tsx
|
|
6093
|
+
import { createMemo as createMemo11 } from "solid-js";
|
|
6086
6094
|
function Text(props) {
|
|
6095
|
+
const processedText = createMemo11(() => {
|
|
6096
|
+
const context = props.builderContext;
|
|
6097
|
+
const {
|
|
6098
|
+
context: contextContext,
|
|
6099
|
+
localState,
|
|
6100
|
+
rootState,
|
|
6101
|
+
rootSetState
|
|
6102
|
+
} = context;
|
|
6103
|
+
return String(props.text?.toString() || "").replace(
|
|
6104
|
+
/{{([^}]+)}}/g,
|
|
6105
|
+
(match, group) => evaluate({
|
|
6106
|
+
code: group,
|
|
6107
|
+
context: contextContext,
|
|
6108
|
+
localState,
|
|
6109
|
+
rootState,
|
|
6110
|
+
rootSetState,
|
|
6111
|
+
enableCache: false
|
|
6112
|
+
})
|
|
6113
|
+
);
|
|
6114
|
+
});
|
|
6087
6115
|
return <><div
|
|
6088
6116
|
class="builder-text"
|
|
6089
|
-
innerHTML={
|
|
6117
|
+
innerHTML={processedText()}
|
|
6090
6118
|
style={{
|
|
6091
6119
|
outline: "none"
|
|
6092
6120
|
}}
|
|
@@ -6120,12 +6148,12 @@ var componentInfo11 = {
|
|
|
6120
6148
|
};
|
|
6121
6149
|
|
|
6122
6150
|
// src/blocks/custom-code/custom-code.tsx
|
|
6123
|
-
import { onMount as
|
|
6151
|
+
import { onMount as onMount3, createSignal as createSignal12 } from "solid-js";
|
|
6124
6152
|
function CustomCode(props) {
|
|
6125
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6126
|
-
const [scriptsRun, setScriptsRun] =
|
|
6153
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
6154
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
6127
6155
|
let elementRef;
|
|
6128
|
-
|
|
6156
|
+
onMount3(() => {
|
|
6129
6157
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
6130
6158
|
return;
|
|
6131
6159
|
}
|
|
@@ -6184,7 +6212,7 @@ var componentInfo12 = {
|
|
|
6184
6212
|
};
|
|
6185
6213
|
|
|
6186
6214
|
// src/blocks/embed/embed.tsx
|
|
6187
|
-
import { on, createEffect, createMemo as
|
|
6215
|
+
import { on, createEffect, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
6188
6216
|
|
|
6189
6217
|
// src/blocks/embed/helpers.ts
|
|
6190
6218
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -6192,9 +6220,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
6192
6220
|
|
|
6193
6221
|
// src/blocks/embed/embed.tsx
|
|
6194
6222
|
function Embed(props) {
|
|
6195
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6196
|
-
const [scriptsRun, setScriptsRun] =
|
|
6197
|
-
const [ranInitFn, setRanInitFn] =
|
|
6223
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
6224
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
6225
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
6198
6226
|
function findAndRunScripts() {
|
|
6199
6227
|
if (!elem || !elem.getElementsByTagName)
|
|
6200
6228
|
return;
|
|
@@ -6217,8 +6245,8 @@ function Embed(props) {
|
|
|
6217
6245
|
}
|
|
6218
6246
|
}
|
|
6219
6247
|
let elem;
|
|
6220
|
-
const onUpdateFn_0_elem =
|
|
6221
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
6248
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
6249
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
6222
6250
|
function onUpdateFn_0() {
|
|
6223
6251
|
if (elem && !ranInitFn()) {
|
|
6224
6252
|
setRanInitFn(true);
|
|
@@ -6473,7 +6501,7 @@ var componentInfo13 = {
|
|
|
6473
6501
|
};
|
|
6474
6502
|
|
|
6475
6503
|
// src/blocks/form/form/form.tsx
|
|
6476
|
-
import { Show as Show10, For as For7, createSignal as
|
|
6504
|
+
import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
|
|
6477
6505
|
|
|
6478
6506
|
// src/functions/get-env.ts
|
|
6479
6507
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -6490,9 +6518,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
6490
6518
|
|
|
6491
6519
|
// src/blocks/form/form/form.tsx
|
|
6492
6520
|
function FormComponent(props) {
|
|
6493
|
-
const [formState, setFormState] =
|
|
6494
|
-
const [responseData, setResponseData] =
|
|
6495
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
6521
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
6522
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
6523
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
6496
6524
|
function mergeNewRootState(newData) {
|
|
6497
6525
|
const combinedState = {
|
|
6498
6526
|
...props.builderContext.rootState,
|
|
@@ -7065,9 +7093,9 @@ var componentInfo19 = {
|
|
|
7065
7093
|
};
|
|
7066
7094
|
|
|
7067
7095
|
// src/blocks/video/video.tsx
|
|
7068
|
-
import { Show as Show11, createMemo as
|
|
7096
|
+
import { Show as Show11, createMemo as createMemo15 } from "solid-js";
|
|
7069
7097
|
function Video(props) {
|
|
7070
|
-
const videoProps =
|
|
7098
|
+
const videoProps = createMemo15(() => {
|
|
7071
7099
|
return {
|
|
7072
7100
|
...props.autoPlay === true ? {
|
|
7073
7101
|
autoPlay: true
|
|
@@ -7086,7 +7114,7 @@ function Video(props) {
|
|
|
7086
7114
|
} : {}
|
|
7087
7115
|
};
|
|
7088
7116
|
});
|
|
7089
|
-
const spreadProps =
|
|
7117
|
+
const spreadProps = createMemo15(() => {
|
|
7090
7118
|
return {
|
|
7091
7119
|
...videoProps()
|
|
7092
7120
|
};
|
|
@@ -7224,17 +7252,14 @@ var serializeFn = (fnValue) => {
|
|
|
7224
7252
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
7225
7253
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
7226
7254
|
};
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
}
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
[key]: serializeValue(value)
|
|
7236
|
-
}), {}))
|
|
7237
|
-
});
|
|
7255
|
+
function serializeComponentInfo(info) {
|
|
7256
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
7257
|
+
if (typeof value === "function") {
|
|
7258
|
+
return serializeFn(value);
|
|
7259
|
+
}
|
|
7260
|
+
return value;
|
|
7261
|
+
}));
|
|
7262
|
+
}
|
|
7238
7263
|
|
|
7239
7264
|
// src/components/content-variants/inlined-fns.ts
|
|
7240
7265
|
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}";
|
|
@@ -7295,11 +7320,11 @@ var Inlined_script_default = InlinedScript;
|
|
|
7295
7320
|
// src/components/content/components/enable-editor.tsx
|
|
7296
7321
|
import {
|
|
7297
7322
|
Show as Show12,
|
|
7298
|
-
onMount as
|
|
7323
|
+
onMount as onMount4,
|
|
7299
7324
|
on as on2,
|
|
7300
7325
|
createEffect as createEffect2,
|
|
7301
|
-
createMemo as
|
|
7302
|
-
createSignal as
|
|
7326
|
+
createMemo as createMemo16,
|
|
7327
|
+
createSignal as createSignal16
|
|
7303
7328
|
} from "solid-js";
|
|
7304
7329
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
7305
7330
|
|
|
@@ -7797,7 +7822,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7797
7822
|
}
|
|
7798
7823
|
|
|
7799
7824
|
// src/constants/sdk-version.ts
|
|
7800
|
-
var SDK_VERSION = "2.0.
|
|
7825
|
+
var SDK_VERSION = "2.0.5";
|
|
7801
7826
|
|
|
7802
7827
|
// src/functions/register.ts
|
|
7803
7828
|
var registry = {};
|
|
@@ -8074,12 +8099,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
8074
8099
|
|
|
8075
8100
|
// src/components/content/components/enable-editor.tsx
|
|
8076
8101
|
function EnableEditor(props) {
|
|
8077
|
-
const [ContentWrapper, setContentWrapper] =
|
|
8102
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
8078
8103
|
props.contentWrapper || "div"
|
|
8079
8104
|
);
|
|
8080
|
-
const [httpReqsData, setHttpReqsData] =
|
|
8081
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
8082
|
-
const [clicked, setClicked] =
|
|
8105
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
8106
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
8107
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
8083
8108
|
function mergeNewRootState(newData) {
|
|
8084
8109
|
const combinedState = {
|
|
8085
8110
|
...props.builderContextSignal.rootState,
|
|
@@ -8113,7 +8138,7 @@ function EnableEditor(props) {
|
|
|
8113
8138
|
content: newContentValue
|
|
8114
8139
|
}));
|
|
8115
8140
|
}
|
|
8116
|
-
const showContentProps =
|
|
8141
|
+
const showContentProps = createMemo16(() => {
|
|
8117
8142
|
return props.showContent ? {} : {
|
|
8118
8143
|
hidden: true,
|
|
8119
8144
|
"aria-hidden": true
|
|
@@ -8232,7 +8257,7 @@ function EnableEditor(props) {
|
|
|
8232
8257
|
}
|
|
8233
8258
|
}
|
|
8234
8259
|
let elementRef;
|
|
8235
|
-
|
|
8260
|
+
onMount4(() => {
|
|
8236
8261
|
if (isBrowser()) {
|
|
8237
8262
|
if (isEditing()) {
|
|
8238
8263
|
window.addEventListener("message", processMessage);
|
|
@@ -8293,7 +8318,7 @@ function EnableEditor(props) {
|
|
|
8293
8318
|
}
|
|
8294
8319
|
}
|
|
8295
8320
|
});
|
|
8296
|
-
|
|
8321
|
+
onMount4(() => {
|
|
8297
8322
|
if (!props.apiKey) {
|
|
8298
8323
|
logger.error(
|
|
8299
8324
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -8303,14 +8328,14 @@ function EnableEditor(props) {
|
|
|
8303
8328
|
runHttpRequests();
|
|
8304
8329
|
emitStateUpdate();
|
|
8305
8330
|
});
|
|
8306
|
-
const onUpdateFn_0_props_content =
|
|
8331
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
8307
8332
|
function onUpdateFn_0() {
|
|
8308
8333
|
if (props.content) {
|
|
8309
8334
|
mergeNewContent(props.content);
|
|
8310
8335
|
}
|
|
8311
8336
|
}
|
|
8312
8337
|
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8313
|
-
const onUpdateFn_1_props_builderContextSignal_content__data__jsCode =
|
|
8338
|
+
const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
|
|
8314
8339
|
function onUpdateFn_1() {
|
|
8315
8340
|
evaluateJsCode();
|
|
8316
8341
|
}
|
|
@@ -8320,7 +8345,7 @@ function EnableEditor(props) {
|
|
|
8320
8345
|
onUpdateFn_1
|
|
8321
8346
|
)
|
|
8322
8347
|
);
|
|
8323
|
-
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests =
|
|
8348
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
8324
8349
|
function onUpdateFn_2() {
|
|
8325
8350
|
runHttpRequests();
|
|
8326
8351
|
}
|
|
@@ -8332,7 +8357,7 @@ function EnableEditor(props) {
|
|
|
8332
8357
|
onUpdateFn_2
|
|
8333
8358
|
)
|
|
8334
8359
|
);
|
|
8335
|
-
const onUpdateFn_3_props_builderContextSignal_rootState =
|
|
8360
|
+
const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
|
|
8336
8361
|
() => props.builderContextSignal.rootState
|
|
8337
8362
|
);
|
|
8338
8363
|
function onUpdateFn_3() {
|
|
@@ -8344,14 +8369,14 @@ function EnableEditor(props) {
|
|
|
8344
8369
|
onUpdateFn_3
|
|
8345
8370
|
)
|
|
8346
8371
|
);
|
|
8347
|
-
const onUpdateFn_4_props_data =
|
|
8372
|
+
const onUpdateFn_4_props_data = createMemo16(() => props.data);
|
|
8348
8373
|
function onUpdateFn_4() {
|
|
8349
8374
|
if (props.data) {
|
|
8350
8375
|
mergeNewRootState(props.data);
|
|
8351
8376
|
}
|
|
8352
8377
|
}
|
|
8353
8378
|
createEffect2(on2(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
|
|
8354
|
-
const onUpdateFn_5_props_locale =
|
|
8379
|
+
const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
|
|
8355
8380
|
function onUpdateFn_5() {
|
|
8356
8381
|
if (props.locale) {
|
|
8357
8382
|
mergeNewRootState({
|
|
@@ -8378,9 +8403,9 @@ function EnableEditor(props) {
|
|
|
8378
8403
|
var Enable_editor_default = EnableEditor;
|
|
8379
8404
|
|
|
8380
8405
|
// src/components/content/components/styles.tsx
|
|
8381
|
-
import { createSignal as
|
|
8406
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
8382
8407
|
function ContentStyles(props) {
|
|
8383
|
-
const [injectedStyles, setInjectedStyles] =
|
|
8408
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
8384
8409
|
`
|
|
8385
8410
|
${getCss({
|
|
8386
8411
|
cssCode: props.cssCode,
|
|
@@ -8438,7 +8463,7 @@ var getContentInitialValue = ({
|
|
|
8438
8463
|
|
|
8439
8464
|
// src/components/content/content.tsx
|
|
8440
8465
|
function ContentComponent(props) {
|
|
8441
|
-
const [scriptStr, setScriptStr] =
|
|
8466
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
8442
8467
|
getUpdateVariantVisibilityScript({
|
|
8443
8468
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
8444
8469
|
variationId: props.content?.testVariationId,
|
|
@@ -8446,7 +8471,7 @@ function ContentComponent(props) {
|
|
|
8446
8471
|
contentId: props.content?.id
|
|
8447
8472
|
})
|
|
8448
8473
|
);
|
|
8449
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
8474
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
8450
8475
|
[
|
|
8451
8476
|
...getDefaultRegisteredComponents(),
|
|
8452
8477
|
...props.customComponents?.filter(({ models }) => {
|
|
@@ -8467,7 +8492,7 @@ function ContentComponent(props) {
|
|
|
8467
8492
|
{}
|
|
8468
8493
|
)
|
|
8469
8494
|
);
|
|
8470
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
8495
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
8471
8496
|
content: getContentInitialValue({
|
|
8472
8497
|
content: props.content,
|
|
8473
8498
|
data: props.data
|
|
@@ -8557,13 +8582,13 @@ var Content_default = ContentComponent;
|
|
|
8557
8582
|
|
|
8558
8583
|
// src/components/content-variants/content-variants.tsx
|
|
8559
8584
|
function ContentVariants(props) {
|
|
8560
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
8585
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
8561
8586
|
checkShouldRenderVariants({
|
|
8562
8587
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8563
8588
|
content: props.content
|
|
8564
8589
|
})
|
|
8565
8590
|
);
|
|
8566
|
-
const updateCookieAndStylesScriptStr =
|
|
8591
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
8567
8592
|
return getUpdateCookieAndStylesScript(
|
|
8568
8593
|
getVariants(props.content).map((value) => ({
|
|
8569
8594
|
id: value.testVariationId,
|
|
@@ -8572,10 +8597,10 @@ function ContentVariants(props) {
|
|
|
8572
8597
|
props.content?.id || ""
|
|
8573
8598
|
);
|
|
8574
8599
|
});
|
|
8575
|
-
const hideVariantsStyleString =
|
|
8600
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
8576
8601
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8577
8602
|
});
|
|
8578
|
-
const defaultContent =
|
|
8603
|
+
const defaultContent = createMemo19(() => {
|
|
8579
8604
|
return shouldRenderVariants() ? {
|
|
8580
8605
|
...props.content,
|
|
8581
8606
|
testVariationId: props.content?.id
|
|
@@ -8584,7 +8609,7 @@ function ContentVariants(props) {
|
|
|
8584
8609
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
8585
8610
|
});
|
|
8586
8611
|
});
|
|
8587
|
-
|
|
8612
|
+
onMount5(() => {
|
|
8588
8613
|
setShouldRenderVariants(false);
|
|
8589
8614
|
});
|
|
8590
8615
|
return <><>
|
|
@@ -8684,14 +8709,14 @@ var fetchSymbolContent = async ({
|
|
|
8684
8709
|
|
|
8685
8710
|
// src/blocks/symbol/symbol.tsx
|
|
8686
8711
|
function Symbol2(props) {
|
|
8687
|
-
const [contentToUse, setContentToUse] =
|
|
8688
|
-
const blocksWrapper =
|
|
8712
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
8713
|
+
const blocksWrapper = createMemo20(() => {
|
|
8689
8714
|
return "div";
|
|
8690
8715
|
});
|
|
8691
|
-
const contentWrapper =
|
|
8716
|
+
const contentWrapper = createMemo20(() => {
|
|
8692
8717
|
return "div";
|
|
8693
8718
|
});
|
|
8694
|
-
const className =
|
|
8719
|
+
const className = createMemo20(() => {
|
|
8695
8720
|
return [
|
|
8696
8721
|
...[props.attributes[getClassPropName()]],
|
|
8697
8722
|
"builder-symbol",
|
|
@@ -8711,9 +8736,9 @@ function Symbol2(props) {
|
|
|
8711
8736
|
}
|
|
8712
8737
|
});
|
|
8713
8738
|
}
|
|
8714
|
-
|
|
8739
|
+
onMount6(() => {
|
|
8715
8740
|
});
|
|
8716
|
-
const onUpdateFn_0_props_symbol =
|
|
8741
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
8717
8742
|
function onUpdateFn_0() {
|
|
8718
8743
|
setContent();
|
|
8719
8744
|
}
|
package/lib/node/dev.js
CHANGED
|
@@ -703,6 +703,9 @@ function assign(target, ..._args) {
|
|
|
703
703
|
return to;
|
|
704
704
|
}
|
|
705
705
|
function bindAnimations(animations) {
|
|
706
|
+
if (TARGET === "reactNative") {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
706
709
|
for (const animation of animations) {
|
|
707
710
|
switch (animation.trigger) {
|
|
708
711
|
case "pageLoad":
|
|
@@ -1733,7 +1736,7 @@ var getColumnsClass = (id) => {
|
|
|
1733
1736
|
|
|
1734
1737
|
// src/blocks/columns/columns.tsx
|
|
1735
1738
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1736
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1739
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1737
1740
|
display: flex;
|
|
1738
1741
|
line-height: normal;
|
|
1739
1742
|
}`);
|
|
@@ -1813,6 +1816,7 @@ function Columns(props) {
|
|
|
1813
1816
|
return breakpointSizes[size].max;
|
|
1814
1817
|
}
|
|
1815
1818
|
function columnsStyles() {
|
|
1819
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1816
1820
|
return `
|
|
1817
1821
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1818
1822
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1820,7 +1824,7 @@ function Columns(props) {
|
|
|
1820
1824
|
align-items: stretch;
|
|
1821
1825
|
}
|
|
1822
1826
|
|
|
1823
|
-
|
|
1827
|
+
${childColumnDiv} {
|
|
1824
1828
|
width: var(--column-width-tablet) !important;
|
|
1825
1829
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1826
1830
|
}
|
|
@@ -1832,7 +1836,7 @@ function Columns(props) {
|
|
|
1832
1836
|
align-items: stretch;
|
|
1833
1837
|
}
|
|
1834
1838
|
|
|
1835
|
-
|
|
1839
|
+
${childColumnDiv} {
|
|
1836
1840
|
width: var(--column-width-mobile) !important;
|
|
1837
1841
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1838
1842
|
}
|
|
@@ -1853,7 +1857,7 @@ function Columns(props) {
|
|
|
1853
1857
|
const _el$ = _tmpl$3();
|
|
1854
1858
|
spread(_el$, mergeProps({
|
|
1855
1859
|
get ["class"]() {
|
|
1856
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1860
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1857
1861
|
},
|
|
1858
1862
|
get style() {
|
|
1859
1863
|
return columnsCssVars();
|
|
@@ -1978,16 +1982,16 @@ function getSrcSet(url) {
|
|
|
1978
1982
|
// src/blocks/image/image.tsx
|
|
1979
1983
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1980
1984
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1981
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1982
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1983
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1985
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-4512e110">`);
|
|
1986
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-4512e110-2>`);
|
|
1987
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-4512e110 {
|
|
1984
1988
|
opacity: 1;
|
|
1985
1989
|
transition: opacity 0.2s ease-in-out;
|
|
1986
|
-
}.div-
|
|
1990
|
+
}.div-4512e110 {
|
|
1987
1991
|
width: 100%;
|
|
1988
1992
|
pointer-events: none;
|
|
1989
1993
|
font-size: 0;
|
|
1990
|
-
}.div-
|
|
1994
|
+
}.div-4512e110-2 {
|
|
1991
1995
|
display: flex;
|
|
1992
1996
|
flex-direction: column;
|
|
1993
1997
|
align-items: stretch;
|
|
@@ -2037,6 +2041,8 @@ function Image(props) {
|
|
|
2037
2041
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
2038
2042
|
return out;
|
|
2039
2043
|
});
|
|
2044
|
+
onMount(() => {
|
|
2045
|
+
});
|
|
2040
2046
|
return [[(() => {
|
|
2041
2047
|
const _el$ = _tmpl$23(), _el$3 = _el$.firstChild;
|
|
2042
2048
|
insert(_el$, createComponent(Show, {
|
|
@@ -2050,7 +2056,7 @@ function Image(props) {
|
|
|
2050
2056
|
}
|
|
2051
2057
|
}), _el$3);
|
|
2052
2058
|
effect((_p$) => {
|
|
2053
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
2059
|
+
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 = {
|
|
2054
2060
|
"object-position": props.backgroundPosition || "center",
|
|
2055
2061
|
"object-fit": props.backgroundSize || "cover",
|
|
2056
2062
|
...aspectRatioCss()
|
|
@@ -3421,7 +3427,8 @@ delegateEvents(["click"]);
|
|
|
3421
3427
|
// src/blocks/text/component-info.ts
|
|
3422
3428
|
var componentInfo10 = {
|
|
3423
3429
|
shouldReceiveBuilderProps: {
|
|
3424
|
-
builderBlock: TARGET === "reactNative" ? true : false
|
|
3430
|
+
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3431
|
+
builderContext: true
|
|
3425
3432
|
},
|
|
3426
3433
|
name: "Text",
|
|
3427
3434
|
static: true,
|
|
@@ -3443,10 +3450,27 @@ var componentInfo10 = {
|
|
|
3443
3450
|
};
|
|
3444
3451
|
var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
3445
3452
|
function Text(props) {
|
|
3453
|
+
const processedText = createMemo(() => {
|
|
3454
|
+
const context = props.builderContext;
|
|
3455
|
+
const {
|
|
3456
|
+
context: contextContext,
|
|
3457
|
+
localState,
|
|
3458
|
+
rootState,
|
|
3459
|
+
rootSetState
|
|
3460
|
+
} = context;
|
|
3461
|
+
return String(props.text?.toString() || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
|
|
3462
|
+
code: group,
|
|
3463
|
+
context: contextContext,
|
|
3464
|
+
localState,
|
|
3465
|
+
rootState,
|
|
3466
|
+
rootSetState,
|
|
3467
|
+
enableCache: false
|
|
3468
|
+
}));
|
|
3469
|
+
});
|
|
3446
3470
|
return (() => {
|
|
3447
3471
|
const _el$ = _tmpl$10();
|
|
3448
3472
|
_el$.style.setProperty("outline", "none");
|
|
3449
|
-
effect(() => _el$.innerHTML =
|
|
3473
|
+
effect(() => _el$.innerHTML = processedText());
|
|
3450
3474
|
return _el$;
|
|
3451
3475
|
})();
|
|
3452
3476
|
}
|
|
@@ -4745,17 +4769,14 @@ var serializeFn = (fnValue) => {
|
|
|
4745
4769
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4746
4770
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4747
4771
|
};
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
[key]: serializeValue(value)
|
|
4757
|
-
}), {}))
|
|
4758
|
-
});
|
|
4772
|
+
function serializeComponentInfo(info) {
|
|
4773
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4774
|
+
if (typeof value === "function") {
|
|
4775
|
+
return serializeFn(value);
|
|
4776
|
+
}
|
|
4777
|
+
return value;
|
|
4778
|
+
}));
|
|
4779
|
+
}
|
|
4759
4780
|
|
|
4760
4781
|
// src/components/content-variants/inlined-fns.ts
|
|
4761
4782
|
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}";
|
|
@@ -5321,7 +5342,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5321
5342
|
}
|
|
5322
5343
|
|
|
5323
5344
|
// src/constants/sdk-version.ts
|
|
5324
|
-
var SDK_VERSION = "2.0.
|
|
5345
|
+
var SDK_VERSION = "2.0.5";
|
|
5325
5346
|
|
|
5326
5347
|
// src/functions/register.ts
|
|
5327
5348
|
var registry = {};
|