@builder.io/sdk-solid 3.0.0 → 3.0.2
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 +6 -1
- package/lib/browser/dev.js +227 -98
- package/lib/browser/dev.jsx +272 -142
- package/lib/browser/index.js +224 -98
- package/lib/browser/index.jsx +271 -142
- package/lib/edge/dev.js +228 -101
- package/lib/edge/dev.jsx +273 -145
- package/lib/edge/index.js +225 -101
- package/lib/edge/index.jsx +272 -145
- package/lib/node/dev.js +227 -98
- package/lib/node/dev.jsx +272 -142
- package/lib/node/index.js +224 -98
- package/lib/node/index.jsx +271 -142
- package/package.json +1 -1
package/lib/node/dev.jsx
CHANGED
|
@@ -95,7 +95,8 @@ var builder_context_default = createContext({
|
|
|
95
95
|
inheritedStyles: {},
|
|
96
96
|
BlocksWrapper: "div",
|
|
97
97
|
BlocksWrapperProps: {},
|
|
98
|
-
nonce: ""
|
|
98
|
+
nonce: "",
|
|
99
|
+
model: ""
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
// src/context/components.context.ts
|
|
@@ -111,23 +112,6 @@ import {
|
|
|
111
112
|
createSignal as createSignal5
|
|
112
113
|
} from "solid-js";
|
|
113
114
|
|
|
114
|
-
// src/functions/get-block-component-options.ts
|
|
115
|
-
function getBlockComponentOptions(block) {
|
|
116
|
-
return {
|
|
117
|
-
...block.component?.options,
|
|
118
|
-
...block.options
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// src/helpers/omit.ts
|
|
123
|
-
function omit(obj, ...values) {
|
|
124
|
-
const newObject = Object.assign({}, obj);
|
|
125
|
-
for (const key of values) {
|
|
126
|
-
delete newObject[key];
|
|
127
|
-
}
|
|
128
|
-
return newObject;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
115
|
// src/helpers/logger.ts
|
|
132
116
|
var MSG_PREFIX = "[Builder.io]: ";
|
|
133
117
|
var logger = {
|
|
@@ -578,6 +562,109 @@ function evaluate({
|
|
|
578
562
|
}
|
|
579
563
|
}
|
|
580
564
|
|
|
565
|
+
// src/functions/get-block-component-options.ts
|
|
566
|
+
function getBlockComponentOptions(block, context) {
|
|
567
|
+
return {
|
|
568
|
+
...block.component?.options,
|
|
569
|
+
...block.options,
|
|
570
|
+
...evaluateTextComponentTextOption(block, context)
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
574
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
575
|
+
return {
|
|
576
|
+
...block.component.options,
|
|
577
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
578
|
+
code: group,
|
|
579
|
+
context,
|
|
580
|
+
localState: context.localState,
|
|
581
|
+
rootState: context.rootState,
|
|
582
|
+
rootSetState: context.rootSetState
|
|
583
|
+
}))
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// src/helpers/omit.ts
|
|
589
|
+
function omit(obj, ...values) {
|
|
590
|
+
const newObject = Object.assign({}, obj);
|
|
591
|
+
for (const key of values) {
|
|
592
|
+
delete newObject[key];
|
|
593
|
+
}
|
|
594
|
+
return newObject;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/functions/traverse.ts
|
|
598
|
+
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
599
|
+
if (obj == null || typeof obj !== "object") {
|
|
600
|
+
callback(obj, (newValue) => {
|
|
601
|
+
if (parent2 !== null && key !== null) {
|
|
602
|
+
parent2[key] = newValue;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
if (visited.has(obj)) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
visited.add(obj);
|
|
611
|
+
if (Array.isArray(obj)) {
|
|
612
|
+
obj.forEach((item, index) => {
|
|
613
|
+
const update = (newValue) => {
|
|
614
|
+
obj[index] = newValue;
|
|
615
|
+
};
|
|
616
|
+
callback(item, update);
|
|
617
|
+
traverse(item, callback, obj, index, visited);
|
|
618
|
+
});
|
|
619
|
+
} else {
|
|
620
|
+
Object.entries(obj).forEach(([key2, value]) => {
|
|
621
|
+
const update = (newValue) => {
|
|
622
|
+
obj[key2] = newValue;
|
|
623
|
+
};
|
|
624
|
+
callback(value, update);
|
|
625
|
+
traverse(value, callback, obj, key2, visited);
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/functions/extract-localized-values.ts
|
|
631
|
+
function isLocalizedField(value) {
|
|
632
|
+
return value && typeof value === "object" && value["@type"] === "@builder.io/core:LocalizedValue";
|
|
633
|
+
}
|
|
634
|
+
function containsLocalizedValues(data) {
|
|
635
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
let hasLocalizedValues = false;
|
|
639
|
+
traverse(data, (value) => {
|
|
640
|
+
if (isLocalizedField(value)) {
|
|
641
|
+
hasLocalizedValues = true;
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
return hasLocalizedValues;
|
|
646
|
+
}
|
|
647
|
+
function extractLocalizedValues(data, locale) {
|
|
648
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
649
|
+
return {};
|
|
650
|
+
}
|
|
651
|
+
traverse(data, (value, update) => {
|
|
652
|
+
if (isLocalizedField(value)) {
|
|
653
|
+
update(value[locale] ?? void 0);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
return data;
|
|
657
|
+
}
|
|
658
|
+
function resolveLocalizedValues(block, locale) {
|
|
659
|
+
if (block.component?.options && containsLocalizedValues(block.component?.options)) {
|
|
660
|
+
if (!locale) {
|
|
661
|
+
console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization");
|
|
662
|
+
}
|
|
663
|
+
block.component.options = extractLocalizedValues(block.component.options, locale ?? "Default");
|
|
664
|
+
}
|
|
665
|
+
return block;
|
|
666
|
+
}
|
|
667
|
+
|
|
581
668
|
// src/functions/transform-block.ts
|
|
582
669
|
function transformBlock(block) {
|
|
583
670
|
return block;
|
|
@@ -658,23 +745,19 @@ var evaluateBindings = ({
|
|
|
658
745
|
function getProcessedBlock({
|
|
659
746
|
block,
|
|
660
747
|
context,
|
|
661
|
-
shouldEvaluateBindings,
|
|
662
748
|
localState,
|
|
663
749
|
rootState,
|
|
664
750
|
rootSetState
|
|
665
751
|
}) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
} else {
|
|
676
|
-
return transformedBlock;
|
|
677
|
-
}
|
|
752
|
+
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
753
|
+
transformedBlock = transformBlock(transformedBlock);
|
|
754
|
+
return evaluateBindings({
|
|
755
|
+
block: transformedBlock,
|
|
756
|
+
localState,
|
|
757
|
+
rootState,
|
|
758
|
+
rootSetState,
|
|
759
|
+
context
|
|
760
|
+
});
|
|
678
761
|
}
|
|
679
762
|
|
|
680
763
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -921,16 +1004,24 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
921
1004
|
}
|
|
922
1005
|
|
|
923
1006
|
// src/components/block/block.helpers.ts
|
|
1007
|
+
var checkIsComponentRestricted = (component, model) => {
|
|
1008
|
+
if (!component)
|
|
1009
|
+
return true;
|
|
1010
|
+
if (!model)
|
|
1011
|
+
return false;
|
|
1012
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
1013
|
+
};
|
|
924
1014
|
var getComponent = ({
|
|
925
1015
|
block,
|
|
926
|
-
registeredComponents
|
|
1016
|
+
registeredComponents,
|
|
1017
|
+
model
|
|
927
1018
|
}) => {
|
|
928
1019
|
const componentName = block.component?.name;
|
|
929
1020
|
if (!componentName) {
|
|
930
1021
|
return null;
|
|
931
1022
|
}
|
|
932
1023
|
const ref = registeredComponents[componentName];
|
|
933
|
-
if (!ref) {
|
|
1024
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
934
1025
|
console.warn(`
|
|
935
1026
|
Could not find a registered component named "${componentName}".
|
|
936
1027
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -984,11 +1075,15 @@ var provideLinkComponent = (block, linkComponent) => {
|
|
|
984
1075
|
};
|
|
985
1076
|
return {};
|
|
986
1077
|
};
|
|
987
|
-
var provideRegisteredComponents = (block, registeredComponents) => {
|
|
988
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
1078
|
+
var provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
1079
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
1080
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
1081
|
+
return !checkIsComponentRestricted(component, model);
|
|
1082
|
+
}));
|
|
989
1083
|
return {
|
|
990
|
-
builderComponents:
|
|
1084
|
+
builderComponents: filteredRegisteredComponents
|
|
991
1085
|
};
|
|
1086
|
+
}
|
|
992
1087
|
return {};
|
|
993
1088
|
};
|
|
994
1089
|
var provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -1384,15 +1479,15 @@ function Block(props) {
|
|
|
1384
1479
|
localState: props.context.localState,
|
|
1385
1480
|
rootState: props.context.rootState,
|
|
1386
1481
|
rootSetState: props.context.rootSetState,
|
|
1387
|
-
context: props.context.context
|
|
1388
|
-
shouldEvaluateBindings: true
|
|
1482
|
+
context: props.context.context
|
|
1389
1483
|
});
|
|
1390
1484
|
return blockToUse;
|
|
1391
1485
|
});
|
|
1392
1486
|
const blockComponent = createMemo5(() => {
|
|
1393
1487
|
return getComponent({
|
|
1394
1488
|
block: processedBlock(),
|
|
1395
|
-
registeredComponents: props.registeredComponents
|
|
1489
|
+
registeredComponents: props.registeredComponents,
|
|
1490
|
+
model: props.context.model
|
|
1396
1491
|
});
|
|
1397
1492
|
});
|
|
1398
1493
|
const Tag = createMemo5(() => {
|
|
@@ -1421,13 +1516,14 @@ function Block(props) {
|
|
|
1421
1516
|
blockChildren: processedBlock().children ?? [],
|
|
1422
1517
|
componentRef: blockComponent()?.component,
|
|
1423
1518
|
componentOptions: {
|
|
1424
|
-
...getBlockComponentOptions(processedBlock()),
|
|
1519
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
1425
1520
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1426
1521
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1427
1522
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
1428
1523
|
...provideRegisteredComponents(
|
|
1429
1524
|
blockComponent(),
|
|
1430
|
-
props.registeredComponents
|
|
1525
|
+
props.registeredComponents,
|
|
1526
|
+
props.context.model
|
|
1431
1527
|
)
|
|
1432
1528
|
},
|
|
1433
1529
|
context: props.context,
|
|
@@ -1851,7 +1947,7 @@ function Image(props) {
|
|
|
1851
1947
|
const url = imageToUse;
|
|
1852
1948
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
1853
1949
|
// images, otherwise you can supply this prop manually
|
|
1854
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1950
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))) {
|
|
1855
1951
|
return props.srcset;
|
|
1856
1952
|
}
|
|
1857
1953
|
if (props.noWebp) {
|
|
@@ -1892,7 +1988,7 @@ function Image(props) {
|
|
|
1892
1988
|
<picture>
|
|
1893
1989
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1894
1990
|
<img
|
|
1895
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1991
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-070d7e88"}
|
|
1896
1992
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1897
1993
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1898
1994
|
alt={props.altText}
|
|
@@ -1910,22 +2006,22 @@ function Image(props) {
|
|
|
1910
2006
|
<Show8
|
|
1911
2007
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1912
2008
|
><div
|
|
1913
|
-
class="builder-image-sizer div-
|
|
2009
|
+
class="builder-image-sizer div-070d7e88"
|
|
1914
2010
|
style={{
|
|
1915
2011
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1916
2012
|
}}
|
|
1917
2013
|
/></Show8>
|
|
1918
2014
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
1919
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
2015
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-070d7e88-2">{props.children}</div></Show8>
|
|
1920
2016
|
</>
|
|
1921
|
-
<style>{`.img-
|
|
2017
|
+
<style>{`.img-070d7e88 {
|
|
1922
2018
|
opacity: 1;
|
|
1923
2019
|
transition: opacity 0.2s ease-in-out;
|
|
1924
|
-
}.div-
|
|
2020
|
+
}.div-070d7e88 {
|
|
1925
2021
|
width: 100%;
|
|
1926
2022
|
pointer-events: none;
|
|
1927
2023
|
font-size: 0;
|
|
1928
|
-
}.div-
|
|
2024
|
+
}.div-070d7e88-2 {
|
|
1929
2025
|
display: flex;
|
|
1930
2026
|
flex-direction: column;
|
|
1931
2027
|
align-items: stretch;
|
|
@@ -1961,10 +2057,10 @@ function SectionComponent(props) {
|
|
|
1961
2057
|
var section_default = SectionComponent;
|
|
1962
2058
|
|
|
1963
2059
|
// src/blocks/symbol/symbol.tsx
|
|
1964
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
2060
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1965
2061
|
|
|
1966
2062
|
// src/components/content-variants/content-variants.tsx
|
|
1967
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
2063
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1968
2064
|
|
|
1969
2065
|
// src/helpers/url.ts
|
|
1970
2066
|
var getTopLevelDomain = (host) => {
|
|
@@ -2158,7 +2254,7 @@ var handleABTesting = async ({
|
|
|
2158
2254
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
2159
2255
|
|
|
2160
2256
|
// src/components/content/content.tsx
|
|
2161
|
-
import { Show as Show14, createSignal as
|
|
2257
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
2162
2258
|
|
|
2163
2259
|
// src/blocks/accordion/component-info.ts
|
|
2164
2260
|
var defaultTitle = {
|
|
@@ -2718,6 +2814,10 @@ var componentInfo4 = {
|
|
|
2718
2814
|
noWrap: true
|
|
2719
2815
|
};
|
|
2720
2816
|
|
|
2817
|
+
// src/constants/file-types.ts
|
|
2818
|
+
var IMAGE_FILE_TYPES = ["jpeg", "jpg", "png", "svg", "webp", "gif", "jfif", "pjpeg", "pjp", "apng", "avif", "tif", "tiff", "heif", "bmp", "eps", "raw", "cr2", "nef", "orf", "sr2", "psd", "heic", "dib", "ai"];
|
|
2819
|
+
var VIDEO_FILE_TYPES = ["mp4", "webm", "mkv", "flv", "vob", "ogv", "ogg", "drc", "gif", "gifv", "mng", "avi", "mov", "qt", "mts", "m2ts", "ts", "wmv", "yuv", "rm", "rmvb", "viv", "asf", "amv", "m4p", "mpeg", "mpe", "m2v", "m4v", "svi", "3gp", "3g2", "mxf", "roq", "nsv", "f4v", "f4p", "f4a", "f4b"];
|
|
2820
|
+
|
|
2721
2821
|
// src/blocks/image/component-info.ts
|
|
2722
2822
|
var componentInfo5 = {
|
|
2723
2823
|
name: "Image",
|
|
@@ -2734,7 +2834,7 @@ var componentInfo5 = {
|
|
|
2734
2834
|
name: "image",
|
|
2735
2835
|
type: "file",
|
|
2736
2836
|
bubble: true,
|
|
2737
|
-
allowedFileTypes:
|
|
2837
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
2738
2838
|
required: true,
|
|
2739
2839
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
2740
2840
|
onChange: (options) => {
|
|
@@ -3199,30 +3299,10 @@ var componentInfo10 = {
|
|
|
3199
3299
|
};
|
|
3200
3300
|
|
|
3201
3301
|
// src/blocks/text/text.tsx
|
|
3202
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
3203
3302
|
function Text(props) {
|
|
3204
|
-
const processedText = createMemo11(() => {
|
|
3205
|
-
const context = props.builderContext;
|
|
3206
|
-
const {
|
|
3207
|
-
context: contextContext,
|
|
3208
|
-
localState,
|
|
3209
|
-
rootState,
|
|
3210
|
-
rootSetState
|
|
3211
|
-
} = context;
|
|
3212
|
-
return String(props.text?.toString() || "").replace(
|
|
3213
|
-
/{{([^}]+)}}/g,
|
|
3214
|
-
(match, group) => evaluate({
|
|
3215
|
-
code: group,
|
|
3216
|
-
context: contextContext,
|
|
3217
|
-
localState,
|
|
3218
|
-
rootState,
|
|
3219
|
-
rootSetState
|
|
3220
|
-
})
|
|
3221
|
-
);
|
|
3222
|
-
});
|
|
3223
3303
|
return <><div
|
|
3224
3304
|
class="builder-text"
|
|
3225
|
-
innerHTML={
|
|
3305
|
+
innerHTML={props.text?.toString() || ""}
|
|
3226
3306
|
style={{
|
|
3227
3307
|
outline: "none"
|
|
3228
3308
|
}}
|
|
@@ -3256,10 +3336,10 @@ var componentInfo11 = {
|
|
|
3256
3336
|
};
|
|
3257
3337
|
|
|
3258
3338
|
// src/blocks/custom-code/custom-code.tsx
|
|
3259
|
-
import { onMount as onMount5, createSignal as
|
|
3339
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
3260
3340
|
function CustomCode(props) {
|
|
3261
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3262
|
-
const [scriptsRun, setScriptsRun] =
|
|
3341
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
3342
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
3263
3343
|
let elementRef;
|
|
3264
3344
|
onMount5(() => {
|
|
3265
3345
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -3321,7 +3401,7 @@ var componentInfo12 = {
|
|
|
3321
3401
|
};
|
|
3322
3402
|
|
|
3323
3403
|
// src/blocks/embed/embed.tsx
|
|
3324
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3404
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3325
3405
|
|
|
3326
3406
|
// src/blocks/embed/helpers.ts
|
|
3327
3407
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3329,9 +3409,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3329
3409
|
|
|
3330
3410
|
// src/blocks/embed/embed.tsx
|
|
3331
3411
|
function Embed(props) {
|
|
3332
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3333
|
-
const [scriptsRun, setScriptsRun] =
|
|
3334
|
-
const [ranInitFn, setRanInitFn] =
|
|
3412
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3413
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3414
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
3335
3415
|
function findAndRunScripts() {
|
|
3336
3416
|
if (!elem || !elem.getElementsByTagName)
|
|
3337
3417
|
return;
|
|
@@ -3355,8 +3435,8 @@ function Embed(props) {
|
|
|
3355
3435
|
}
|
|
3356
3436
|
}
|
|
3357
3437
|
let elem;
|
|
3358
|
-
const onUpdateFn_0_elem =
|
|
3359
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3438
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
3439
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
3360
3440
|
function onUpdateFn_0() {
|
|
3361
3441
|
if (elem && !ranInitFn()) {
|
|
3362
3442
|
setRanInitFn(true);
|
|
@@ -3611,7 +3691,7 @@ var componentInfo13 = {
|
|
|
3611
3691
|
};
|
|
3612
3692
|
|
|
3613
3693
|
// src/blocks/form/form/form.tsx
|
|
3614
|
-
import { Show as Show11, For as For7, createSignal as
|
|
3694
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
3615
3695
|
|
|
3616
3696
|
// src/functions/get-env.ts
|
|
3617
3697
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3631,9 +3711,9 @@ function logFetch(url) {
|
|
|
3631
3711
|
|
|
3632
3712
|
// src/blocks/form/form/form.tsx
|
|
3633
3713
|
function FormComponent(props) {
|
|
3634
|
-
const [formState, setFormState] =
|
|
3635
|
-
const [responseData, setResponseData] =
|
|
3636
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3714
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
3715
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
3716
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
3637
3717
|
function mergeNewRootState(newData) {
|
|
3638
3718
|
const combinedState = {
|
|
3639
3719
|
...props.builderContext.rootState,
|
|
@@ -4094,7 +4174,7 @@ var componentInfo18 = {
|
|
|
4094
4174
|
name: "image",
|
|
4095
4175
|
bubble: true,
|
|
4096
4176
|
type: "file",
|
|
4097
|
-
allowedFileTypes:
|
|
4177
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
4098
4178
|
required: true
|
|
4099
4179
|
}],
|
|
4100
4180
|
noWrap: true,
|
|
@@ -4129,14 +4209,14 @@ var componentInfo19 = {
|
|
|
4129
4209
|
inputs: [{
|
|
4130
4210
|
name: "video",
|
|
4131
4211
|
type: "file",
|
|
4132
|
-
allowedFileTypes:
|
|
4212
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
4133
4213
|
bubble: true,
|
|
4134
4214
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
4135
4215
|
required: true
|
|
4136
4216
|
}, {
|
|
4137
4217
|
name: "posterImage",
|
|
4138
4218
|
type: "file",
|
|
4139
|
-
allowedFileTypes:
|
|
4219
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
4140
4220
|
helperText: "Image to show before the video plays"
|
|
4141
4221
|
}, {
|
|
4142
4222
|
name: "autoPlay",
|
|
@@ -4205,9 +4285,9 @@ var componentInfo19 = {
|
|
|
4205
4285
|
};
|
|
4206
4286
|
|
|
4207
4287
|
// src/blocks/video/video.tsx
|
|
4208
|
-
import { Show as Show12, createMemo as
|
|
4288
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
4209
4289
|
function Video(props) {
|
|
4210
|
-
const videoProps =
|
|
4290
|
+
const videoProps = createMemo14(() => {
|
|
4211
4291
|
return {
|
|
4212
4292
|
...props.autoPlay === true ? {
|
|
4213
4293
|
autoPlay: true
|
|
@@ -4226,7 +4306,7 @@ function Video(props) {
|
|
|
4226
4306
|
} : {}
|
|
4227
4307
|
};
|
|
4228
4308
|
});
|
|
4229
|
-
const spreadProps =
|
|
4309
|
+
const spreadProps = createMemo14(() => {
|
|
4230
4310
|
return {
|
|
4231
4311
|
...videoProps()
|
|
4232
4312
|
};
|
|
@@ -4362,7 +4442,7 @@ var createRegisterComponentMessage = (info) => ({
|
|
|
4362
4442
|
var serializeFn = (fnValue) => {
|
|
4363
4443
|
const fnStr = fnValue.toString().trim();
|
|
4364
4444
|
const isArrowWithoutParens = /^[a-zA-Z0-9_]+\s*=>/i.test(fnStr);
|
|
4365
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4445
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("async") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4366
4446
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4367
4447
|
};
|
|
4368
4448
|
function serializeIncludingFunctions(info) {
|
|
@@ -4436,8 +4516,8 @@ import {
|
|
|
4436
4516
|
onMount as onMount6,
|
|
4437
4517
|
on as on3,
|
|
4438
4518
|
createEffect as createEffect3,
|
|
4439
|
-
createMemo as
|
|
4440
|
-
createSignal as
|
|
4519
|
+
createMemo as createMemo15,
|
|
4520
|
+
createSignal as createSignal15
|
|
4441
4521
|
} from "solid-js";
|
|
4442
4522
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4443
4523
|
|
|
@@ -4447,7 +4527,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4447
4527
|
}
|
|
4448
4528
|
|
|
4449
4529
|
// src/constants/sdk-version.ts
|
|
4450
|
-
var SDK_VERSION = "3.0.
|
|
4530
|
+
var SDK_VERSION = "3.0.2";
|
|
4451
4531
|
|
|
4452
4532
|
// src/helpers/sdk-headers.ts
|
|
4453
4533
|
var getSdkHeaders = () => ({
|
|
@@ -4512,6 +4592,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
4512
4592
|
}
|
|
4513
4593
|
return _res;
|
|
4514
4594
|
}
|
|
4595
|
+
function unflatten(obj) {
|
|
4596
|
+
const result = {};
|
|
4597
|
+
for (const key in obj) {
|
|
4598
|
+
const parts = key.split(".");
|
|
4599
|
+
let current = result;
|
|
4600
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4601
|
+
const part = parts[i];
|
|
4602
|
+
if (i === parts.length - 1) {
|
|
4603
|
+
current[part] = obj[key];
|
|
4604
|
+
} else {
|
|
4605
|
+
current[part] = current[part] || {};
|
|
4606
|
+
current = current[part];
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
return result;
|
|
4611
|
+
}
|
|
4515
4612
|
|
|
4516
4613
|
// src/types/api-version.ts
|
|
4517
4614
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -4576,7 +4673,7 @@ var generateContentUrl = (options) => {
|
|
|
4576
4673
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
4577
4674
|
url.searchParams.set("includeRefs", String(true));
|
|
4578
4675
|
const finalLocale = locale || userAttributes?.locale;
|
|
4579
|
-
let finalUserAttributes = userAttributes;
|
|
4676
|
+
let finalUserAttributes = userAttributes || {};
|
|
4580
4677
|
if (finalLocale) {
|
|
4581
4678
|
url.searchParams.set("locale", finalLocale);
|
|
4582
4679
|
finalUserAttributes = {
|
|
@@ -4614,11 +4711,15 @@ var generateContentUrl = (options) => {
|
|
|
4614
4711
|
...getBuilderSearchParamsFromWindow(),
|
|
4615
4712
|
...normalizeSearchParams(options.options || {})
|
|
4616
4713
|
};
|
|
4714
|
+
finalUserAttributes = {
|
|
4715
|
+
...finalUserAttributes,
|
|
4716
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
4717
|
+
};
|
|
4617
4718
|
const flattened = flatten(queryOptions);
|
|
4618
4719
|
for (const key in flattened) {
|
|
4619
4720
|
url.searchParams.set(key, String(flattened[key]));
|
|
4620
4721
|
}
|
|
4621
|
-
if (finalUserAttributes) {
|
|
4722
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
4622
4723
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
4623
4724
|
}
|
|
4624
4725
|
if (query) {
|
|
@@ -4631,6 +4732,28 @@ var generateContentUrl = (options) => {
|
|
|
4631
4732
|
}
|
|
4632
4733
|
return url;
|
|
4633
4734
|
};
|
|
4735
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
4736
|
+
const newUserAttributes = {};
|
|
4737
|
+
for (const key in queryOptions) {
|
|
4738
|
+
if (key.startsWith("userAttributes.")) {
|
|
4739
|
+
newUserAttributes[key] = queryOptions[key];
|
|
4740
|
+
delete queryOptions[key];
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
return newUserAttributes;
|
|
4744
|
+
};
|
|
4745
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
4746
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
4747
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
4748
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
4749
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
4750
|
+
const {
|
|
4751
|
+
userAttributes
|
|
4752
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
4753
|
+
return userAttributes;
|
|
4754
|
+
}
|
|
4755
|
+
return {};
|
|
4756
|
+
};
|
|
4634
4757
|
|
|
4635
4758
|
// src/functions/get-content/index.ts
|
|
4636
4759
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -5165,6 +5288,12 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5165
5288
|
};
|
|
5166
5289
|
};
|
|
5167
5290
|
|
|
5291
|
+
// src/components/content/components/enable-editor.helpers.ts
|
|
5292
|
+
var SDKS_USING_ELEMENT_REF_APPROACH = ["svelte", "qwik", "vue"];
|
|
5293
|
+
var needsElementRefDivForEditing = () => {
|
|
5294
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
5295
|
+
};
|
|
5296
|
+
|
|
5168
5297
|
// src/components/content/components/styles.helpers.ts
|
|
5169
5298
|
var getCssFromFont = (font) => {
|
|
5170
5299
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -5246,12 +5375,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5246
5375
|
|
|
5247
5376
|
// src/components/content/components/enable-editor.tsx
|
|
5248
5377
|
function EnableEditor(props) {
|
|
5249
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5378
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
5250
5379
|
props.contentWrapper || "div"
|
|
5251
5380
|
);
|
|
5252
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5253
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5254
|
-
const [clicked, setClicked] =
|
|
5381
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
5382
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
5383
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
5255
5384
|
function mergeNewRootState(newData) {
|
|
5256
5385
|
const combinedState = {
|
|
5257
5386
|
...props.builderContextSignal.rootState,
|
|
@@ -5285,7 +5414,7 @@ function EnableEditor(props) {
|
|
|
5285
5414
|
content: newContentValue
|
|
5286
5415
|
}));
|
|
5287
5416
|
}
|
|
5288
|
-
const showContentProps =
|
|
5417
|
+
const showContentProps = createMemo15(() => {
|
|
5289
5418
|
return props.showContent ? {} : {
|
|
5290
5419
|
hidden: true,
|
|
5291
5420
|
"aria-hidden": true
|
|
@@ -5411,8 +5540,10 @@ function EnableEditor(props) {
|
|
|
5411
5540
|
Object.values(
|
|
5412
5541
|
props.builderContextSignal.componentInfos
|
|
5413
5542
|
).forEach((registeredComponent) => {
|
|
5414
|
-
|
|
5415
|
-
|
|
5543
|
+
if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5544
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
5545
|
+
window.parent?.postMessage(message, "*");
|
|
5546
|
+
}
|
|
5416
5547
|
});
|
|
5417
5548
|
window.addEventListener(
|
|
5418
5549
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -5440,11 +5571,16 @@ function EnableEditor(props) {
|
|
|
5440
5571
|
`builder.overrides.${searchParamPreviewModel}`
|
|
5441
5572
|
);
|
|
5442
5573
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5443
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5574
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5444
5575
|
fetchOneEntry({
|
|
5445
|
-
model: props.model,
|
|
5576
|
+
model: props.model || "",
|
|
5446
5577
|
apiKey: props.apiKey,
|
|
5447
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
5578
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
5579
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
5580
|
+
query: {
|
|
5581
|
+
id: props.context.symbolId
|
|
5582
|
+
}
|
|
5583
|
+
} : {}
|
|
5448
5584
|
}).then((content) => {
|
|
5449
5585
|
if (content) {
|
|
5450
5586
|
mergeNewContent(content);
|
|
@@ -5454,14 +5590,14 @@ function EnableEditor(props) {
|
|
|
5454
5590
|
}
|
|
5455
5591
|
}
|
|
5456
5592
|
});
|
|
5457
|
-
const onUpdateFn_0_props_content =
|
|
5593
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
5458
5594
|
function onUpdateFn_0() {
|
|
5459
5595
|
if (props.content) {
|
|
5460
5596
|
mergeNewContent(props.content);
|
|
5461
5597
|
}
|
|
5462
5598
|
}
|
|
5463
5599
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5464
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5600
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
5465
5601
|
() => props.builderContextSignal.rootState
|
|
5466
5602
|
);
|
|
5467
5603
|
function onUpdateFn_1() {
|
|
@@ -5473,14 +5609,14 @@ function EnableEditor(props) {
|
|
|
5473
5609
|
onUpdateFn_1
|
|
5474
5610
|
)
|
|
5475
5611
|
);
|
|
5476
|
-
const onUpdateFn_2_props_data =
|
|
5612
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
5477
5613
|
function onUpdateFn_2() {
|
|
5478
5614
|
if (props.data) {
|
|
5479
5615
|
mergeNewRootState(props.data);
|
|
5480
5616
|
}
|
|
5481
5617
|
}
|
|
5482
5618
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5483
|
-
const onUpdateFn_3_props_locale =
|
|
5619
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
5484
5620
|
function onUpdateFn_3() {
|
|
5485
5621
|
if (props.locale) {
|
|
5486
5622
|
mergeNewRootState({
|
|
@@ -5489,7 +5625,9 @@ function EnableEditor(props) {
|
|
|
5489
5625
|
}
|
|
5490
5626
|
}
|
|
5491
5627
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5492
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
5628
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
5629
|
+
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5630
|
+
><Dynamic5
|
|
5493
5631
|
class={getWrapperClassName(
|
|
5494
5632
|
props.content?.testVariationId || props.content?.id
|
|
5495
5633
|
)}
|
|
@@ -5498,6 +5636,9 @@ function EnableEditor(props) {
|
|
|
5498
5636
|
onClick={(event) => onClick(event)}
|
|
5499
5637
|
builder-content-id={props.builderContextSignal.content?.id}
|
|
5500
5638
|
builder-model={props.model}
|
|
5639
|
+
style={{
|
|
5640
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
5641
|
+
}}
|
|
5501
5642
|
{...{}}
|
|
5502
5643
|
{...showContentProps()}
|
|
5503
5644
|
{...props.contentWrapperProps}
|
|
@@ -5507,9 +5648,9 @@ function EnableEditor(props) {
|
|
|
5507
5648
|
var Enable_editor_default = EnableEditor;
|
|
5508
5649
|
|
|
5509
5650
|
// src/components/content/components/styles.tsx
|
|
5510
|
-
import { createSignal as
|
|
5651
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
5511
5652
|
function ContentStyles(props) {
|
|
5512
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5653
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
5513
5654
|
`
|
|
5514
5655
|
${getCss({
|
|
5515
5656
|
cssCode: props.cssCode,
|
|
@@ -5567,7 +5708,7 @@ var getContentInitialValue = ({
|
|
|
5567
5708
|
|
|
5568
5709
|
// src/components/content/content.tsx
|
|
5569
5710
|
function ContentComponent(props) {
|
|
5570
|
-
const [scriptStr, setScriptStr] =
|
|
5711
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
5571
5712
|
getUpdateVariantVisibilityScript({
|
|
5572
5713
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5573
5714
|
variationId: props.content?.testVariationId,
|
|
@@ -5575,16 +5716,10 @@ function ContentComponent(props) {
|
|
|
5575
5716
|
contentId: props.content?.id
|
|
5576
5717
|
})
|
|
5577
5718
|
);
|
|
5578
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5719
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5579
5720
|
[
|
|
5580
5721
|
...getDefaultRegisteredComponents(),
|
|
5581
|
-
...props.customComponents
|
|
5582
|
-
if (!models?.length)
|
|
5583
|
-
return true;
|
|
5584
|
-
if (!props.model)
|
|
5585
|
-
return true;
|
|
5586
|
-
return models.includes(props.model);
|
|
5587
|
-
}) || []
|
|
5722
|
+
...props.customComponents || []
|
|
5588
5723
|
].reduce(
|
|
5589
5724
|
(acc, { component, ...info }) => ({
|
|
5590
5725
|
...acc,
|
|
@@ -5596,7 +5731,7 @@ function ContentComponent(props) {
|
|
|
5596
5731
|
{}
|
|
5597
5732
|
)
|
|
5598
5733
|
);
|
|
5599
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5734
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
5600
5735
|
content: getContentInitialValue({
|
|
5601
5736
|
content: props.content,
|
|
5602
5737
|
data: props.data
|
|
@@ -5614,13 +5749,7 @@ function ContentComponent(props) {
|
|
|
5614
5749
|
apiVersion: props.apiVersion,
|
|
5615
5750
|
componentInfos: [
|
|
5616
5751
|
...getDefaultRegisteredComponents(),
|
|
5617
|
-
...props.customComponents
|
|
5618
|
-
if (!models?.length)
|
|
5619
|
-
return true;
|
|
5620
|
-
if (!props.model)
|
|
5621
|
-
return true;
|
|
5622
|
-
return models.includes(props.model);
|
|
5623
|
-
}) || []
|
|
5752
|
+
...props.customComponents || []
|
|
5624
5753
|
].reduce(
|
|
5625
5754
|
(acc, { component: _, ...info }) => ({
|
|
5626
5755
|
...acc,
|
|
@@ -5631,7 +5760,8 @@ function ContentComponent(props) {
|
|
|
5631
5760
|
inheritedStyles: {},
|
|
5632
5761
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
5633
5762
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
5634
|
-
nonce: props.nonce || ""
|
|
5763
|
+
nonce: props.nonce || "",
|
|
5764
|
+
model: props.model || ""
|
|
5635
5765
|
});
|
|
5636
5766
|
function contentSetState(newRootState) {
|
|
5637
5767
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -5709,13 +5839,13 @@ var Content_default = ContentComponent;
|
|
|
5709
5839
|
|
|
5710
5840
|
// src/components/content-variants/content-variants.tsx
|
|
5711
5841
|
function ContentVariants(props) {
|
|
5712
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5842
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
5713
5843
|
checkShouldRenderVariants({
|
|
5714
5844
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5715
5845
|
content: props.content
|
|
5716
5846
|
})
|
|
5717
5847
|
);
|
|
5718
|
-
const updateCookieAndStylesScriptStr =
|
|
5848
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
5719
5849
|
return getUpdateCookieAndStylesScript(
|
|
5720
5850
|
getVariants(props.content).map((value) => ({
|
|
5721
5851
|
id: value.testVariationId,
|
|
@@ -5724,10 +5854,10 @@ function ContentVariants(props) {
|
|
|
5724
5854
|
props.content?.id || ""
|
|
5725
5855
|
);
|
|
5726
5856
|
});
|
|
5727
|
-
const hideVariantsStyleString =
|
|
5857
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
5728
5858
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5729
5859
|
});
|
|
5730
|
-
const defaultContent =
|
|
5860
|
+
const defaultContent = createMemo18(() => {
|
|
5731
5861
|
return shouldRenderVariants() ? {
|
|
5732
5862
|
...props.content,
|
|
5733
5863
|
testVariationId: props.content?.id
|
|
@@ -5839,14 +5969,14 @@ var fetchSymbolContent = async ({
|
|
|
5839
5969
|
|
|
5840
5970
|
// src/blocks/symbol/symbol.tsx
|
|
5841
5971
|
function Symbol(props) {
|
|
5842
|
-
const [contentToUse, setContentToUse] =
|
|
5843
|
-
const blocksWrapper =
|
|
5972
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
5973
|
+
const blocksWrapper = createMemo19(() => {
|
|
5844
5974
|
return "div";
|
|
5845
5975
|
});
|
|
5846
|
-
const contentWrapper =
|
|
5976
|
+
const contentWrapper = createMemo19(() => {
|
|
5847
5977
|
return "div";
|
|
5848
5978
|
});
|
|
5849
|
-
const className =
|
|
5979
|
+
const className = createMemo19(() => {
|
|
5850
5980
|
return [
|
|
5851
5981
|
...[props.attributes[getClassPropName()]],
|
|
5852
5982
|
"builder-symbol",
|
|
@@ -5868,7 +5998,7 @@ function Symbol(props) {
|
|
|
5868
5998
|
}
|
|
5869
5999
|
onMount8(() => {
|
|
5870
6000
|
});
|
|
5871
|
-
const onUpdateFn_0_props_symbol =
|
|
6001
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
5872
6002
|
function onUpdateFn_0() {
|
|
5873
6003
|
setContent();
|
|
5874
6004
|
}
|