@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/browser/index.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 logger = {
|
|
133
117
|
log: (...message) => void 0,
|
|
@@ -392,6 +376,108 @@ function evaluate({
|
|
|
392
376
|
}
|
|
393
377
|
}
|
|
394
378
|
|
|
379
|
+
// src/functions/get-block-component-options.ts
|
|
380
|
+
function getBlockComponentOptions(block, context) {
|
|
381
|
+
return {
|
|
382
|
+
...block.component?.options,
|
|
383
|
+
...block.options,
|
|
384
|
+
...evaluateTextComponentTextOption(block, context)
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
388
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
389
|
+
return {
|
|
390
|
+
...block.component.options,
|
|
391
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
392
|
+
code: group,
|
|
393
|
+
context,
|
|
394
|
+
localState: context.localState,
|
|
395
|
+
rootState: context.rootState,
|
|
396
|
+
rootSetState: context.rootSetState
|
|
397
|
+
}))
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// src/helpers/omit.ts
|
|
403
|
+
function omit(obj, ...values) {
|
|
404
|
+
const newObject = Object.assign({}, obj);
|
|
405
|
+
for (const key of values) {
|
|
406
|
+
delete newObject[key];
|
|
407
|
+
}
|
|
408
|
+
return newObject;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// src/functions/traverse.ts
|
|
412
|
+
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
413
|
+
if (obj == null || typeof obj !== "object") {
|
|
414
|
+
callback(obj, (newValue) => {
|
|
415
|
+
if (parent2 !== null && key !== null) {
|
|
416
|
+
parent2[key] = newValue;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (visited.has(obj)) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
visited.add(obj);
|
|
425
|
+
if (Array.isArray(obj)) {
|
|
426
|
+
obj.forEach((item, index) => {
|
|
427
|
+
const update = (newValue) => {
|
|
428
|
+
obj[index] = newValue;
|
|
429
|
+
};
|
|
430
|
+
callback(item, update);
|
|
431
|
+
traverse(item, callback, obj, index, visited);
|
|
432
|
+
});
|
|
433
|
+
} else {
|
|
434
|
+
Object.entries(obj).forEach(([key2, value]) => {
|
|
435
|
+
const update = (newValue) => {
|
|
436
|
+
obj[key2] = newValue;
|
|
437
|
+
};
|
|
438
|
+
callback(value, update);
|
|
439
|
+
traverse(value, callback, obj, key2, visited);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/functions/extract-localized-values.ts
|
|
445
|
+
function isLocalizedField(value) {
|
|
446
|
+
return value && typeof value === "object" && value["@type"] === "@builder.io/core:LocalizedValue";
|
|
447
|
+
}
|
|
448
|
+
function containsLocalizedValues(data) {
|
|
449
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
let hasLocalizedValues = false;
|
|
453
|
+
traverse(data, (value) => {
|
|
454
|
+
if (isLocalizedField(value)) {
|
|
455
|
+
hasLocalizedValues = true;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
return hasLocalizedValues;
|
|
460
|
+
}
|
|
461
|
+
function extractLocalizedValues(data, locale) {
|
|
462
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
463
|
+
return {};
|
|
464
|
+
}
|
|
465
|
+
traverse(data, (value, update) => {
|
|
466
|
+
if (isLocalizedField(value)) {
|
|
467
|
+
update(value[locale] ?? void 0);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
return data;
|
|
471
|
+
}
|
|
472
|
+
function resolveLocalizedValues(block, locale) {
|
|
473
|
+
if (block.component?.options && containsLocalizedValues(block.component?.options)) {
|
|
474
|
+
if (!locale) {
|
|
475
|
+
}
|
|
476
|
+
block.component.options = extractLocalizedValues(block.component.options, locale ?? "Default");
|
|
477
|
+
}
|
|
478
|
+
return block;
|
|
479
|
+
}
|
|
480
|
+
|
|
395
481
|
// src/functions/fast-clone.ts
|
|
396
482
|
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
397
483
|
|
|
@@ -485,23 +571,19 @@ var evaluateBindings = ({
|
|
|
485
571
|
function getProcessedBlock({
|
|
486
572
|
block,
|
|
487
573
|
context,
|
|
488
|
-
shouldEvaluateBindings,
|
|
489
574
|
localState,
|
|
490
575
|
rootState,
|
|
491
576
|
rootSetState
|
|
492
577
|
}) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
} else {
|
|
503
|
-
return transformedBlock;
|
|
504
|
-
}
|
|
578
|
+
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
579
|
+
transformedBlock = transformBlock(transformedBlock);
|
|
580
|
+
return evaluateBindings({
|
|
581
|
+
block: transformedBlock,
|
|
582
|
+
localState,
|
|
583
|
+
rootState,
|
|
584
|
+
rootSetState,
|
|
585
|
+
context
|
|
586
|
+
});
|
|
505
587
|
}
|
|
506
588
|
|
|
507
589
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -747,16 +829,24 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
747
829
|
}
|
|
748
830
|
|
|
749
831
|
// src/components/block/block.helpers.ts
|
|
832
|
+
var checkIsComponentRestricted = (component, model) => {
|
|
833
|
+
if (!component)
|
|
834
|
+
return true;
|
|
835
|
+
if (!model)
|
|
836
|
+
return false;
|
|
837
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
838
|
+
};
|
|
750
839
|
var getComponent = ({
|
|
751
840
|
block,
|
|
752
|
-
registeredComponents
|
|
841
|
+
registeredComponents,
|
|
842
|
+
model
|
|
753
843
|
}) => {
|
|
754
844
|
const componentName = block.component?.name;
|
|
755
845
|
if (!componentName) {
|
|
756
846
|
return null;
|
|
757
847
|
}
|
|
758
848
|
const ref = registeredComponents[componentName];
|
|
759
|
-
if (!ref) {
|
|
849
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
760
850
|
return void 0;
|
|
761
851
|
} else {
|
|
762
852
|
return ref;
|
|
@@ -807,11 +897,15 @@ var provideLinkComponent = (block, linkComponent) => {
|
|
|
807
897
|
};
|
|
808
898
|
return {};
|
|
809
899
|
};
|
|
810
|
-
var provideRegisteredComponents = (block, registeredComponents) => {
|
|
811
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
900
|
+
var provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
901
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
902
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
903
|
+
return !checkIsComponentRestricted(component, model);
|
|
904
|
+
}));
|
|
812
905
|
return {
|
|
813
|
-
builderComponents:
|
|
906
|
+
builderComponents: filteredRegisteredComponents
|
|
814
907
|
};
|
|
908
|
+
}
|
|
815
909
|
return {};
|
|
816
910
|
};
|
|
817
911
|
var provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -1207,15 +1301,15 @@ function Block(props) {
|
|
|
1207
1301
|
localState: props.context.localState,
|
|
1208
1302
|
rootState: props.context.rootState,
|
|
1209
1303
|
rootSetState: props.context.rootSetState,
|
|
1210
|
-
context: props.context.context
|
|
1211
|
-
shouldEvaluateBindings: true
|
|
1304
|
+
context: props.context.context
|
|
1212
1305
|
});
|
|
1213
1306
|
return blockToUse;
|
|
1214
1307
|
});
|
|
1215
1308
|
const blockComponent = createMemo5(() => {
|
|
1216
1309
|
return getComponent({
|
|
1217
1310
|
block: processedBlock(),
|
|
1218
|
-
registeredComponents: props.registeredComponents
|
|
1311
|
+
registeredComponents: props.registeredComponents,
|
|
1312
|
+
model: props.context.model
|
|
1219
1313
|
});
|
|
1220
1314
|
});
|
|
1221
1315
|
const Tag = createMemo5(() => {
|
|
@@ -1244,13 +1338,14 @@ function Block(props) {
|
|
|
1244
1338
|
blockChildren: processedBlock().children ?? [],
|
|
1245
1339
|
componentRef: blockComponent()?.component,
|
|
1246
1340
|
componentOptions: {
|
|
1247
|
-
...getBlockComponentOptions(processedBlock()),
|
|
1341
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
1248
1342
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1249
1343
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1250
1344
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
1251
1345
|
...provideRegisteredComponents(
|
|
1252
1346
|
blockComponent(),
|
|
1253
|
-
props.registeredComponents
|
|
1347
|
+
props.registeredComponents,
|
|
1348
|
+
props.context.model
|
|
1254
1349
|
)
|
|
1255
1350
|
},
|
|
1256
1351
|
context: props.context,
|
|
@@ -1674,7 +1769,7 @@ function Image(props) {
|
|
|
1674
1769
|
const url = imageToUse;
|
|
1675
1770
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
1676
1771
|
// images, otherwise you can supply this prop manually
|
|
1677
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1772
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))) {
|
|
1678
1773
|
return props.srcset;
|
|
1679
1774
|
}
|
|
1680
1775
|
if (props.noWebp) {
|
|
@@ -1714,7 +1809,7 @@ function Image(props) {
|
|
|
1714
1809
|
<picture>
|
|
1715
1810
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1716
1811
|
<img
|
|
1717
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1812
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-070d7e88"}
|
|
1718
1813
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1719
1814
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1720
1815
|
alt={props.altText}
|
|
@@ -1732,22 +1827,22 @@ function Image(props) {
|
|
|
1732
1827
|
<Show8
|
|
1733
1828
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1734
1829
|
><div
|
|
1735
|
-
class="builder-image-sizer div-
|
|
1830
|
+
class="builder-image-sizer div-070d7e88"
|
|
1736
1831
|
style={{
|
|
1737
1832
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1738
1833
|
}}
|
|
1739
1834
|
/></Show8>
|
|
1740
1835
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
1741
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1836
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-070d7e88-2">{props.children}</div></Show8>
|
|
1742
1837
|
</>
|
|
1743
|
-
<style>{`.img-
|
|
1838
|
+
<style>{`.img-070d7e88 {
|
|
1744
1839
|
opacity: 1;
|
|
1745
1840
|
transition: opacity 0.2s ease-in-out;
|
|
1746
|
-
}.div-
|
|
1841
|
+
}.div-070d7e88 {
|
|
1747
1842
|
width: 100%;
|
|
1748
1843
|
pointer-events: none;
|
|
1749
1844
|
font-size: 0;
|
|
1750
|
-
}.div-
|
|
1845
|
+
}.div-070d7e88-2 {
|
|
1751
1846
|
display: flex;
|
|
1752
1847
|
flex-direction: column;
|
|
1753
1848
|
align-items: stretch;
|
|
@@ -1783,10 +1878,10 @@ function SectionComponent(props) {
|
|
|
1783
1878
|
var section_default = SectionComponent;
|
|
1784
1879
|
|
|
1785
1880
|
// src/blocks/symbol/symbol.tsx
|
|
1786
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
1881
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1787
1882
|
|
|
1788
1883
|
// src/components/content-variants/content-variants.tsx
|
|
1789
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
1884
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1790
1885
|
|
|
1791
1886
|
// src/helpers/url.ts
|
|
1792
1887
|
var getTopLevelDomain = (host) => {
|
|
@@ -1980,7 +2075,7 @@ var handleABTesting = async ({
|
|
|
1980
2075
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1981
2076
|
|
|
1982
2077
|
// src/components/content/content.tsx
|
|
1983
|
-
import { Show as Show14, createSignal as
|
|
2078
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
1984
2079
|
|
|
1985
2080
|
// src/blocks/accordion/component-info.ts
|
|
1986
2081
|
var defaultTitle = {
|
|
@@ -2540,6 +2635,10 @@ var componentInfo4 = {
|
|
|
2540
2635
|
noWrap: true
|
|
2541
2636
|
};
|
|
2542
2637
|
|
|
2638
|
+
// src/constants/file-types.ts
|
|
2639
|
+
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"];
|
|
2640
|
+
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"];
|
|
2641
|
+
|
|
2543
2642
|
// src/blocks/image/component-info.ts
|
|
2544
2643
|
var componentInfo5 = {
|
|
2545
2644
|
name: "Image",
|
|
@@ -2556,7 +2655,7 @@ var componentInfo5 = {
|
|
|
2556
2655
|
name: "image",
|
|
2557
2656
|
type: "file",
|
|
2558
2657
|
bubble: true,
|
|
2559
|
-
allowedFileTypes:
|
|
2658
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
2560
2659
|
required: true,
|
|
2561
2660
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
2562
2661
|
onChange: (options) => {
|
|
@@ -3020,30 +3119,10 @@ var componentInfo10 = {
|
|
|
3020
3119
|
};
|
|
3021
3120
|
|
|
3022
3121
|
// src/blocks/text/text.tsx
|
|
3023
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
3024
3122
|
function Text(props) {
|
|
3025
|
-
const processedText = createMemo11(() => {
|
|
3026
|
-
const context = props.builderContext;
|
|
3027
|
-
const {
|
|
3028
|
-
context: contextContext,
|
|
3029
|
-
localState,
|
|
3030
|
-
rootState,
|
|
3031
|
-
rootSetState
|
|
3032
|
-
} = context;
|
|
3033
|
-
return String(props.text?.toString() || "").replace(
|
|
3034
|
-
/{{([^}]+)}}/g,
|
|
3035
|
-
(match, group) => evaluate({
|
|
3036
|
-
code: group,
|
|
3037
|
-
context: contextContext,
|
|
3038
|
-
localState,
|
|
3039
|
-
rootState,
|
|
3040
|
-
rootSetState
|
|
3041
|
-
})
|
|
3042
|
-
);
|
|
3043
|
-
});
|
|
3044
3123
|
return <><div
|
|
3045
3124
|
class="builder-text"
|
|
3046
|
-
innerHTML={
|
|
3125
|
+
innerHTML={props.text?.toString() || ""}
|
|
3047
3126
|
style={{
|
|
3048
3127
|
outline: "none"
|
|
3049
3128
|
}}
|
|
@@ -3077,10 +3156,10 @@ var componentInfo11 = {
|
|
|
3077
3156
|
};
|
|
3078
3157
|
|
|
3079
3158
|
// src/blocks/custom-code/custom-code.tsx
|
|
3080
|
-
import { onMount as onMount5, createSignal as
|
|
3159
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
3081
3160
|
function CustomCode(props) {
|
|
3082
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3083
|
-
const [scriptsRun, setScriptsRun] =
|
|
3161
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
3162
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
3084
3163
|
let elementRef;
|
|
3085
3164
|
onMount5(() => {
|
|
3086
3165
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -3141,7 +3220,7 @@ var componentInfo12 = {
|
|
|
3141
3220
|
};
|
|
3142
3221
|
|
|
3143
3222
|
// src/blocks/embed/embed.tsx
|
|
3144
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3223
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3145
3224
|
|
|
3146
3225
|
// src/blocks/embed/helpers.ts
|
|
3147
3226
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3149,9 +3228,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3149
3228
|
|
|
3150
3229
|
// src/blocks/embed/embed.tsx
|
|
3151
3230
|
function Embed(props) {
|
|
3152
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3153
|
-
const [scriptsRun, setScriptsRun] =
|
|
3154
|
-
const [ranInitFn, setRanInitFn] =
|
|
3231
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3232
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3233
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
3155
3234
|
function findAndRunScripts() {
|
|
3156
3235
|
if (!elem || !elem.getElementsByTagName)
|
|
3157
3236
|
return;
|
|
@@ -3174,8 +3253,8 @@ function Embed(props) {
|
|
|
3174
3253
|
}
|
|
3175
3254
|
}
|
|
3176
3255
|
let elem;
|
|
3177
|
-
const onUpdateFn_0_elem =
|
|
3178
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3256
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
3257
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
3179
3258
|
function onUpdateFn_0() {
|
|
3180
3259
|
if (elem && !ranInitFn()) {
|
|
3181
3260
|
setRanInitFn(true);
|
|
@@ -3430,7 +3509,7 @@ var componentInfo13 = {
|
|
|
3430
3509
|
};
|
|
3431
3510
|
|
|
3432
3511
|
// src/blocks/form/form/form.tsx
|
|
3433
|
-
import { Show as Show11, For as For7, createSignal as
|
|
3512
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
3434
3513
|
|
|
3435
3514
|
// src/functions/get-env.ts
|
|
3436
3515
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3450,9 +3529,9 @@ function logFetch(url) {
|
|
|
3450
3529
|
|
|
3451
3530
|
// src/blocks/form/form/form.tsx
|
|
3452
3531
|
function FormComponent(props) {
|
|
3453
|
-
const [formState, setFormState] =
|
|
3454
|
-
const [responseData, setResponseData] =
|
|
3455
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3532
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
3533
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
3534
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
3456
3535
|
function mergeNewRootState(newData) {
|
|
3457
3536
|
const combinedState = {
|
|
3458
3537
|
...props.builderContext.rootState,
|
|
@@ -3913,7 +3992,7 @@ var componentInfo18 = {
|
|
|
3913
3992
|
name: "image",
|
|
3914
3993
|
bubble: true,
|
|
3915
3994
|
type: "file",
|
|
3916
|
-
allowedFileTypes:
|
|
3995
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
3917
3996
|
required: true
|
|
3918
3997
|
}],
|
|
3919
3998
|
noWrap: true,
|
|
@@ -3948,14 +4027,14 @@ var componentInfo19 = {
|
|
|
3948
4027
|
inputs: [{
|
|
3949
4028
|
name: "video",
|
|
3950
4029
|
type: "file",
|
|
3951
|
-
allowedFileTypes:
|
|
4030
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
3952
4031
|
bubble: true,
|
|
3953
4032
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
3954
4033
|
required: true
|
|
3955
4034
|
}, {
|
|
3956
4035
|
name: "posterImage",
|
|
3957
4036
|
type: "file",
|
|
3958
|
-
allowedFileTypes:
|
|
4037
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
3959
4038
|
helperText: "Image to show before the video plays"
|
|
3960
4039
|
}, {
|
|
3961
4040
|
name: "autoPlay",
|
|
@@ -4024,9 +4103,9 @@ var componentInfo19 = {
|
|
|
4024
4103
|
};
|
|
4025
4104
|
|
|
4026
4105
|
// src/blocks/video/video.tsx
|
|
4027
|
-
import { Show as Show12, createMemo as
|
|
4106
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
4028
4107
|
function Video(props) {
|
|
4029
|
-
const videoProps =
|
|
4108
|
+
const videoProps = createMemo14(() => {
|
|
4030
4109
|
return {
|
|
4031
4110
|
...props.autoPlay === true ? {
|
|
4032
4111
|
autoPlay: true
|
|
@@ -4045,7 +4124,7 @@ function Video(props) {
|
|
|
4045
4124
|
} : {}
|
|
4046
4125
|
};
|
|
4047
4126
|
});
|
|
4048
|
-
const spreadProps =
|
|
4127
|
+
const spreadProps = createMemo14(() => {
|
|
4049
4128
|
return {
|
|
4050
4129
|
...videoProps()
|
|
4051
4130
|
};
|
|
@@ -4181,7 +4260,7 @@ var createRegisterComponentMessage = (info) => ({
|
|
|
4181
4260
|
var serializeFn = (fnValue) => {
|
|
4182
4261
|
const fnStr = fnValue.toString().trim();
|
|
4183
4262
|
const isArrowWithoutParens = /^[a-zA-Z0-9_]+\s*=>/i.test(fnStr);
|
|
4184
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4263
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("async") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4185
4264
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4186
4265
|
};
|
|
4187
4266
|
function serializeIncludingFunctions(info) {
|
|
@@ -4255,8 +4334,8 @@ import {
|
|
|
4255
4334
|
onMount as onMount6,
|
|
4256
4335
|
on as on3,
|
|
4257
4336
|
createEffect as createEffect3,
|
|
4258
|
-
createMemo as
|
|
4259
|
-
createSignal as
|
|
4337
|
+
createMemo as createMemo15,
|
|
4338
|
+
createSignal as createSignal15
|
|
4260
4339
|
} from "solid-js";
|
|
4261
4340
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4262
4341
|
|
|
@@ -4266,7 +4345,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4266
4345
|
}
|
|
4267
4346
|
|
|
4268
4347
|
// src/constants/sdk-version.ts
|
|
4269
|
-
var SDK_VERSION = "3.0.
|
|
4348
|
+
var SDK_VERSION = "3.0.2";
|
|
4270
4349
|
|
|
4271
4350
|
// src/helpers/sdk-headers.ts
|
|
4272
4351
|
var getSdkHeaders = () => ({
|
|
@@ -4329,6 +4408,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
4329
4408
|
}
|
|
4330
4409
|
return _res;
|
|
4331
4410
|
}
|
|
4411
|
+
function unflatten(obj) {
|
|
4412
|
+
const result = {};
|
|
4413
|
+
for (const key in obj) {
|
|
4414
|
+
const parts = key.split(".");
|
|
4415
|
+
let current = result;
|
|
4416
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4417
|
+
const part = parts[i];
|
|
4418
|
+
if (i === parts.length - 1) {
|
|
4419
|
+
current[part] = obj[key];
|
|
4420
|
+
} else {
|
|
4421
|
+
current[part] = current[part] || {};
|
|
4422
|
+
current = current[part];
|
|
4423
|
+
}
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
return result;
|
|
4427
|
+
}
|
|
4332
4428
|
|
|
4333
4429
|
// src/types/api-version.ts
|
|
4334
4430
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -4393,7 +4489,7 @@ var generateContentUrl = (options) => {
|
|
|
4393
4489
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
4394
4490
|
url.searchParams.set("includeRefs", String(true));
|
|
4395
4491
|
const finalLocale = locale || userAttributes?.locale;
|
|
4396
|
-
let finalUserAttributes = userAttributes;
|
|
4492
|
+
let finalUserAttributes = userAttributes || {};
|
|
4397
4493
|
if (finalLocale) {
|
|
4398
4494
|
url.searchParams.set("locale", finalLocale);
|
|
4399
4495
|
finalUserAttributes = {
|
|
@@ -4431,11 +4527,15 @@ var generateContentUrl = (options) => {
|
|
|
4431
4527
|
...getBuilderSearchParamsFromWindow(),
|
|
4432
4528
|
...normalizeSearchParams(options.options || {})
|
|
4433
4529
|
};
|
|
4530
|
+
finalUserAttributes = {
|
|
4531
|
+
...finalUserAttributes,
|
|
4532
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
4533
|
+
};
|
|
4434
4534
|
const flattened = flatten(queryOptions);
|
|
4435
4535
|
for (const key in flattened) {
|
|
4436
4536
|
url.searchParams.set(key, String(flattened[key]));
|
|
4437
4537
|
}
|
|
4438
|
-
if (finalUserAttributes) {
|
|
4538
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
4439
4539
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
4440
4540
|
}
|
|
4441
4541
|
if (query) {
|
|
@@ -4448,6 +4548,28 @@ var generateContentUrl = (options) => {
|
|
|
4448
4548
|
}
|
|
4449
4549
|
return url;
|
|
4450
4550
|
};
|
|
4551
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
4552
|
+
const newUserAttributes = {};
|
|
4553
|
+
for (const key in queryOptions) {
|
|
4554
|
+
if (key.startsWith("userAttributes.")) {
|
|
4555
|
+
newUserAttributes[key] = queryOptions[key];
|
|
4556
|
+
delete queryOptions[key];
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
return newUserAttributes;
|
|
4560
|
+
};
|
|
4561
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
4562
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
4563
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
4564
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
4565
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
4566
|
+
const {
|
|
4567
|
+
userAttributes
|
|
4568
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
4569
|
+
return userAttributes;
|
|
4570
|
+
}
|
|
4571
|
+
return {};
|
|
4572
|
+
};
|
|
4451
4573
|
|
|
4452
4574
|
// src/functions/get-content/index.ts
|
|
4453
4575
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -4978,6 +5100,12 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
4978
5100
|
};
|
|
4979
5101
|
};
|
|
4980
5102
|
|
|
5103
|
+
// src/components/content/components/enable-editor.helpers.ts
|
|
5104
|
+
var SDKS_USING_ELEMENT_REF_APPROACH = ["svelte", "qwik", "vue"];
|
|
5105
|
+
var needsElementRefDivForEditing = () => {
|
|
5106
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
5107
|
+
};
|
|
5108
|
+
|
|
4981
5109
|
// src/components/content/components/styles.helpers.ts
|
|
4982
5110
|
var getCssFromFont = (font) => {
|
|
4983
5111
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -5059,12 +5187,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5059
5187
|
|
|
5060
5188
|
// src/components/content/components/enable-editor.tsx
|
|
5061
5189
|
function EnableEditor(props) {
|
|
5062
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5190
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
5063
5191
|
props.contentWrapper || "div"
|
|
5064
5192
|
);
|
|
5065
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5066
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5067
|
-
const [clicked, setClicked] =
|
|
5193
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
5194
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
5195
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
5068
5196
|
function mergeNewRootState(newData) {
|
|
5069
5197
|
const combinedState = {
|
|
5070
5198
|
...props.builderContextSignal.rootState,
|
|
@@ -5098,7 +5226,7 @@ function EnableEditor(props) {
|
|
|
5098
5226
|
content: newContentValue
|
|
5099
5227
|
}));
|
|
5100
5228
|
}
|
|
5101
|
-
const showContentProps =
|
|
5229
|
+
const showContentProps = createMemo15(() => {
|
|
5102
5230
|
return props.showContent ? {} : {
|
|
5103
5231
|
hidden: true,
|
|
5104
5232
|
"aria-hidden": true
|
|
@@ -5223,8 +5351,10 @@ function EnableEditor(props) {
|
|
|
5223
5351
|
Object.values(
|
|
5224
5352
|
props.builderContextSignal.componentInfos
|
|
5225
5353
|
).forEach((registeredComponent) => {
|
|
5226
|
-
|
|
5227
|
-
|
|
5354
|
+
if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5355
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
5356
|
+
window.parent?.postMessage(message, "*");
|
|
5357
|
+
}
|
|
5228
5358
|
});
|
|
5229
5359
|
window.addEventListener(
|
|
5230
5360
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -5252,11 +5382,16 @@ function EnableEditor(props) {
|
|
|
5252
5382
|
`builder.overrides.${searchParamPreviewModel}`
|
|
5253
5383
|
);
|
|
5254
5384
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5255
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5385
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5256
5386
|
fetchOneEntry({
|
|
5257
|
-
model: props.model,
|
|
5387
|
+
model: props.model || "",
|
|
5258
5388
|
apiKey: props.apiKey,
|
|
5259
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
5389
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
5390
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
5391
|
+
query: {
|
|
5392
|
+
id: props.context.symbolId
|
|
5393
|
+
}
|
|
5394
|
+
} : {}
|
|
5260
5395
|
}).then((content) => {
|
|
5261
5396
|
if (content) {
|
|
5262
5397
|
mergeNewContent(content);
|
|
@@ -5266,14 +5401,14 @@ function EnableEditor(props) {
|
|
|
5266
5401
|
}
|
|
5267
5402
|
}
|
|
5268
5403
|
});
|
|
5269
|
-
const onUpdateFn_0_props_content =
|
|
5404
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
5270
5405
|
function onUpdateFn_0() {
|
|
5271
5406
|
if (props.content) {
|
|
5272
5407
|
mergeNewContent(props.content);
|
|
5273
5408
|
}
|
|
5274
5409
|
}
|
|
5275
5410
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5276
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5411
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
5277
5412
|
() => props.builderContextSignal.rootState
|
|
5278
5413
|
);
|
|
5279
5414
|
function onUpdateFn_1() {
|
|
@@ -5285,14 +5420,14 @@ function EnableEditor(props) {
|
|
|
5285
5420
|
onUpdateFn_1
|
|
5286
5421
|
)
|
|
5287
5422
|
);
|
|
5288
|
-
const onUpdateFn_2_props_data =
|
|
5423
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
5289
5424
|
function onUpdateFn_2() {
|
|
5290
5425
|
if (props.data) {
|
|
5291
5426
|
mergeNewRootState(props.data);
|
|
5292
5427
|
}
|
|
5293
5428
|
}
|
|
5294
5429
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5295
|
-
const onUpdateFn_3_props_locale =
|
|
5430
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
5296
5431
|
function onUpdateFn_3() {
|
|
5297
5432
|
if (props.locale) {
|
|
5298
5433
|
mergeNewRootState({
|
|
@@ -5301,7 +5436,9 @@ function EnableEditor(props) {
|
|
|
5301
5436
|
}
|
|
5302
5437
|
}
|
|
5303
5438
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5304
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
5439
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
5440
|
+
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5441
|
+
><Dynamic5
|
|
5305
5442
|
class={getWrapperClassName(
|
|
5306
5443
|
props.content?.testVariationId || props.content?.id
|
|
5307
5444
|
)}
|
|
@@ -5310,6 +5447,9 @@ function EnableEditor(props) {
|
|
|
5310
5447
|
onClick={(event) => onClick(event)}
|
|
5311
5448
|
builder-content-id={props.builderContextSignal.content?.id}
|
|
5312
5449
|
builder-model={props.model}
|
|
5450
|
+
style={{
|
|
5451
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
5452
|
+
}}
|
|
5313
5453
|
{...{}}
|
|
5314
5454
|
{...showContentProps()}
|
|
5315
5455
|
{...props.contentWrapperProps}
|
|
@@ -5319,9 +5459,9 @@ function EnableEditor(props) {
|
|
|
5319
5459
|
var Enable_editor_default = EnableEditor;
|
|
5320
5460
|
|
|
5321
5461
|
// src/components/content/components/styles.tsx
|
|
5322
|
-
import { createSignal as
|
|
5462
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
5323
5463
|
function ContentStyles(props) {
|
|
5324
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5464
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
5325
5465
|
`
|
|
5326
5466
|
${getCss({
|
|
5327
5467
|
cssCode: props.cssCode,
|
|
@@ -5379,7 +5519,7 @@ var getContentInitialValue = ({
|
|
|
5379
5519
|
|
|
5380
5520
|
// src/components/content/content.tsx
|
|
5381
5521
|
function ContentComponent(props) {
|
|
5382
|
-
const [scriptStr, setScriptStr] =
|
|
5522
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
5383
5523
|
getUpdateVariantVisibilityScript({
|
|
5384
5524
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5385
5525
|
variationId: props.content?.testVariationId,
|
|
@@ -5387,16 +5527,10 @@ function ContentComponent(props) {
|
|
|
5387
5527
|
contentId: props.content?.id
|
|
5388
5528
|
})
|
|
5389
5529
|
);
|
|
5390
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5530
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5391
5531
|
[
|
|
5392
5532
|
...getDefaultRegisteredComponents(),
|
|
5393
|
-
...props.customComponents
|
|
5394
|
-
if (!models?.length)
|
|
5395
|
-
return true;
|
|
5396
|
-
if (!props.model)
|
|
5397
|
-
return true;
|
|
5398
|
-
return models.includes(props.model);
|
|
5399
|
-
}) || []
|
|
5533
|
+
...props.customComponents || []
|
|
5400
5534
|
].reduce(
|
|
5401
5535
|
(acc, { component, ...info }) => ({
|
|
5402
5536
|
...acc,
|
|
@@ -5408,7 +5542,7 @@ function ContentComponent(props) {
|
|
|
5408
5542
|
{}
|
|
5409
5543
|
)
|
|
5410
5544
|
);
|
|
5411
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5545
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
5412
5546
|
content: getContentInitialValue({
|
|
5413
5547
|
content: props.content,
|
|
5414
5548
|
data: props.data
|
|
@@ -5426,13 +5560,7 @@ function ContentComponent(props) {
|
|
|
5426
5560
|
apiVersion: props.apiVersion,
|
|
5427
5561
|
componentInfos: [
|
|
5428
5562
|
...getDefaultRegisteredComponents(),
|
|
5429
|
-
...props.customComponents
|
|
5430
|
-
if (!models?.length)
|
|
5431
|
-
return true;
|
|
5432
|
-
if (!props.model)
|
|
5433
|
-
return true;
|
|
5434
|
-
return models.includes(props.model);
|
|
5435
|
-
}) || []
|
|
5563
|
+
...props.customComponents || []
|
|
5436
5564
|
].reduce(
|
|
5437
5565
|
(acc, { component: _, ...info }) => ({
|
|
5438
5566
|
...acc,
|
|
@@ -5443,7 +5571,8 @@ function ContentComponent(props) {
|
|
|
5443
5571
|
inheritedStyles: {},
|
|
5444
5572
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
5445
5573
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
5446
|
-
nonce: props.nonce || ""
|
|
5574
|
+
nonce: props.nonce || "",
|
|
5575
|
+
model: props.model || ""
|
|
5447
5576
|
});
|
|
5448
5577
|
function contentSetState(newRootState) {
|
|
5449
5578
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -5521,13 +5650,13 @@ var Content_default = ContentComponent;
|
|
|
5521
5650
|
|
|
5522
5651
|
// src/components/content-variants/content-variants.tsx
|
|
5523
5652
|
function ContentVariants(props) {
|
|
5524
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5653
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
5525
5654
|
checkShouldRenderVariants({
|
|
5526
5655
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5527
5656
|
content: props.content
|
|
5528
5657
|
})
|
|
5529
5658
|
);
|
|
5530
|
-
const updateCookieAndStylesScriptStr =
|
|
5659
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
5531
5660
|
return getUpdateCookieAndStylesScript(
|
|
5532
5661
|
getVariants(props.content).map((value) => ({
|
|
5533
5662
|
id: value.testVariationId,
|
|
@@ -5536,10 +5665,10 @@ function ContentVariants(props) {
|
|
|
5536
5665
|
props.content?.id || ""
|
|
5537
5666
|
);
|
|
5538
5667
|
});
|
|
5539
|
-
const hideVariantsStyleString =
|
|
5668
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
5540
5669
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5541
5670
|
});
|
|
5542
|
-
const defaultContent =
|
|
5671
|
+
const defaultContent = createMemo18(() => {
|
|
5543
5672
|
return shouldRenderVariants() ? {
|
|
5544
5673
|
...props.content,
|
|
5545
5674
|
testVariationId: props.content?.id
|
|
@@ -5651,14 +5780,14 @@ var fetchSymbolContent = async ({
|
|
|
5651
5780
|
|
|
5652
5781
|
// src/blocks/symbol/symbol.tsx
|
|
5653
5782
|
function Symbol(props) {
|
|
5654
|
-
const [contentToUse, setContentToUse] =
|
|
5655
|
-
const blocksWrapper =
|
|
5783
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
5784
|
+
const blocksWrapper = createMemo19(() => {
|
|
5656
5785
|
return "div";
|
|
5657
5786
|
});
|
|
5658
|
-
const contentWrapper =
|
|
5787
|
+
const contentWrapper = createMemo19(() => {
|
|
5659
5788
|
return "div";
|
|
5660
5789
|
});
|
|
5661
|
-
const className =
|
|
5790
|
+
const className = createMemo19(() => {
|
|
5662
5791
|
return [
|
|
5663
5792
|
...[props.attributes[getClassPropName()]],
|
|
5664
5793
|
"builder-symbol",
|
|
@@ -5680,7 +5809,7 @@ function Symbol(props) {
|
|
|
5680
5809
|
}
|
|
5681
5810
|
onMount8(() => {
|
|
5682
5811
|
});
|
|
5683
|
-
const onUpdateFn_0_props_symbol =
|
|
5812
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
5684
5813
|
function onUpdateFn_0() {
|
|
5685
5814
|
setContent();
|
|
5686
5815
|
}
|