@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/edge/index.jsx
CHANGED
|
@@ -103,7 +103,8 @@ var builder_context_default = createContext({
|
|
|
103
103
|
inheritedStyles: {},
|
|
104
104
|
BlocksWrapper: "div",
|
|
105
105
|
BlocksWrapperProps: {},
|
|
106
|
-
nonce: ""
|
|
106
|
+
nonce: "",
|
|
107
|
+
model: ""
|
|
107
108
|
});
|
|
108
109
|
|
|
109
110
|
// src/context/components.context.ts
|
|
@@ -119,23 +120,6 @@ import {
|
|
|
119
120
|
createSignal as createSignal5
|
|
120
121
|
} from "solid-js";
|
|
121
122
|
|
|
122
|
-
// src/functions/get-block-component-options.ts
|
|
123
|
-
function getBlockComponentOptions(block) {
|
|
124
|
-
return {
|
|
125
|
-
...block.component?.options,
|
|
126
|
-
...block.options
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/helpers/omit.ts
|
|
131
|
-
function omit(obj, ...values) {
|
|
132
|
-
const newObject = Object.assign({}, obj);
|
|
133
|
-
for (const key of values) {
|
|
134
|
-
delete newObject[key];
|
|
135
|
-
}
|
|
136
|
-
return newObject;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
123
|
// src/helpers/logger.ts
|
|
140
124
|
var logger = {
|
|
141
125
|
log: (...message) => void 0,
|
|
@@ -3468,10 +3452,8 @@ var runInEdge = ({
|
|
|
3468
3452
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
3469
3453
|
}).join("\n");
|
|
3470
3454
|
const cleanedCode = processCode(code);
|
|
3471
|
-
if (cleanedCode === "")
|
|
3472
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
3455
|
+
if (cleanedCode === "")
|
|
3473
3456
|
return;
|
|
3474
|
-
}
|
|
3475
3457
|
const transformed = `
|
|
3476
3458
|
function theFunction() {
|
|
3477
3459
|
${prependedCode}
|
|
@@ -3577,6 +3559,108 @@ function evaluate({
|
|
|
3577
3559
|
}
|
|
3578
3560
|
}
|
|
3579
3561
|
|
|
3562
|
+
// src/functions/get-block-component-options.ts
|
|
3563
|
+
function getBlockComponentOptions(block, context) {
|
|
3564
|
+
return {
|
|
3565
|
+
...block.component?.options,
|
|
3566
|
+
...block.options,
|
|
3567
|
+
...evaluateTextComponentTextOption(block, context)
|
|
3568
|
+
};
|
|
3569
|
+
}
|
|
3570
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
3571
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
3572
|
+
return {
|
|
3573
|
+
...block.component.options,
|
|
3574
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
3575
|
+
code: group,
|
|
3576
|
+
context,
|
|
3577
|
+
localState: context.localState,
|
|
3578
|
+
rootState: context.rootState,
|
|
3579
|
+
rootSetState: context.rootSetState
|
|
3580
|
+
}))
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3583
|
+
};
|
|
3584
|
+
|
|
3585
|
+
// src/helpers/omit.ts
|
|
3586
|
+
function omit(obj, ...values) {
|
|
3587
|
+
const newObject = Object.assign({}, obj);
|
|
3588
|
+
for (const key of values) {
|
|
3589
|
+
delete newObject[key];
|
|
3590
|
+
}
|
|
3591
|
+
return newObject;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
// src/functions/traverse.ts
|
|
3595
|
+
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
3596
|
+
if (obj == null || typeof obj !== "object") {
|
|
3597
|
+
callback(obj, (newValue) => {
|
|
3598
|
+
if (parent2 !== null && key !== null) {
|
|
3599
|
+
parent2[key] = newValue;
|
|
3600
|
+
}
|
|
3601
|
+
});
|
|
3602
|
+
return;
|
|
3603
|
+
}
|
|
3604
|
+
if (visited.has(obj)) {
|
|
3605
|
+
return;
|
|
3606
|
+
}
|
|
3607
|
+
visited.add(obj);
|
|
3608
|
+
if (Array.isArray(obj)) {
|
|
3609
|
+
obj.forEach((item, index) => {
|
|
3610
|
+
const update = (newValue) => {
|
|
3611
|
+
obj[index] = newValue;
|
|
3612
|
+
};
|
|
3613
|
+
callback(item, update);
|
|
3614
|
+
traverse(item, callback, obj, index, visited);
|
|
3615
|
+
});
|
|
3616
|
+
} else {
|
|
3617
|
+
Object.entries(obj).forEach(([key2, value]) => {
|
|
3618
|
+
const update = (newValue) => {
|
|
3619
|
+
obj[key2] = newValue;
|
|
3620
|
+
};
|
|
3621
|
+
callback(value, update);
|
|
3622
|
+
traverse(value, callback, obj, key2, visited);
|
|
3623
|
+
});
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3627
|
+
// src/functions/extract-localized-values.ts
|
|
3628
|
+
function isLocalizedField(value) {
|
|
3629
|
+
return value && typeof value === "object" && value["@type"] === "@builder.io/core:LocalizedValue";
|
|
3630
|
+
}
|
|
3631
|
+
function containsLocalizedValues(data) {
|
|
3632
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
3633
|
+
return false;
|
|
3634
|
+
}
|
|
3635
|
+
let hasLocalizedValues = false;
|
|
3636
|
+
traverse(data, (value) => {
|
|
3637
|
+
if (isLocalizedField(value)) {
|
|
3638
|
+
hasLocalizedValues = true;
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
});
|
|
3642
|
+
return hasLocalizedValues;
|
|
3643
|
+
}
|
|
3644
|
+
function extractLocalizedValues(data, locale) {
|
|
3645
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
3646
|
+
return {};
|
|
3647
|
+
}
|
|
3648
|
+
traverse(data, (value, update) => {
|
|
3649
|
+
if (isLocalizedField(value)) {
|
|
3650
|
+
update(value[locale] ?? void 0);
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
return data;
|
|
3654
|
+
}
|
|
3655
|
+
function resolveLocalizedValues(block, locale) {
|
|
3656
|
+
if (block.component?.options && containsLocalizedValues(block.component?.options)) {
|
|
3657
|
+
if (!locale) {
|
|
3658
|
+
}
|
|
3659
|
+
block.component.options = extractLocalizedValues(block.component.options, locale ?? "Default");
|
|
3660
|
+
}
|
|
3661
|
+
return block;
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3580
3664
|
// src/functions/fast-clone.ts
|
|
3581
3665
|
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
3582
3666
|
|
|
@@ -3670,23 +3754,19 @@ var evaluateBindings = ({
|
|
|
3670
3754
|
function getProcessedBlock({
|
|
3671
3755
|
block,
|
|
3672
3756
|
context,
|
|
3673
|
-
shouldEvaluateBindings,
|
|
3674
3757
|
localState,
|
|
3675
3758
|
rootState,
|
|
3676
3759
|
rootSetState
|
|
3677
3760
|
}) {
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
} else {
|
|
3688
|
-
return transformedBlock;
|
|
3689
|
-
}
|
|
3761
|
+
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
3762
|
+
transformedBlock = transformBlock(transformedBlock);
|
|
3763
|
+
return evaluateBindings({
|
|
3764
|
+
block: transformedBlock,
|
|
3765
|
+
localState,
|
|
3766
|
+
rootState,
|
|
3767
|
+
rootSetState,
|
|
3768
|
+
context
|
|
3769
|
+
});
|
|
3690
3770
|
}
|
|
3691
3771
|
|
|
3692
3772
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -3932,16 +4012,24 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
3932
4012
|
}
|
|
3933
4013
|
|
|
3934
4014
|
// src/components/block/block.helpers.ts
|
|
4015
|
+
var checkIsComponentRestricted = (component, model) => {
|
|
4016
|
+
if (!component)
|
|
4017
|
+
return true;
|
|
4018
|
+
if (!model)
|
|
4019
|
+
return false;
|
|
4020
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
4021
|
+
};
|
|
3935
4022
|
var getComponent = ({
|
|
3936
4023
|
block,
|
|
3937
|
-
registeredComponents
|
|
4024
|
+
registeredComponents,
|
|
4025
|
+
model
|
|
3938
4026
|
}) => {
|
|
3939
4027
|
const componentName = block.component?.name;
|
|
3940
4028
|
if (!componentName) {
|
|
3941
4029
|
return null;
|
|
3942
4030
|
}
|
|
3943
4031
|
const ref = registeredComponents[componentName];
|
|
3944
|
-
if (!ref) {
|
|
4032
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
3945
4033
|
return void 0;
|
|
3946
4034
|
} else {
|
|
3947
4035
|
return ref;
|
|
@@ -3992,11 +4080,15 @@ var provideLinkComponent = (block, linkComponent) => {
|
|
|
3992
4080
|
};
|
|
3993
4081
|
return {};
|
|
3994
4082
|
};
|
|
3995
|
-
var provideRegisteredComponents = (block, registeredComponents) => {
|
|
3996
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
4083
|
+
var provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
4084
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
4085
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
4086
|
+
return !checkIsComponentRestricted(component, model);
|
|
4087
|
+
}));
|
|
3997
4088
|
return {
|
|
3998
|
-
builderComponents:
|
|
4089
|
+
builderComponents: filteredRegisteredComponents
|
|
3999
4090
|
};
|
|
4091
|
+
}
|
|
4000
4092
|
return {};
|
|
4001
4093
|
};
|
|
4002
4094
|
var provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -4392,15 +4484,15 @@ function Block(props) {
|
|
|
4392
4484
|
localState: props.context.localState,
|
|
4393
4485
|
rootState: props.context.rootState,
|
|
4394
4486
|
rootSetState: props.context.rootSetState,
|
|
4395
|
-
context: props.context.context
|
|
4396
|
-
shouldEvaluateBindings: true
|
|
4487
|
+
context: props.context.context
|
|
4397
4488
|
});
|
|
4398
4489
|
return blockToUse;
|
|
4399
4490
|
});
|
|
4400
4491
|
const blockComponent = createMemo5(() => {
|
|
4401
4492
|
return getComponent({
|
|
4402
4493
|
block: processedBlock(),
|
|
4403
|
-
registeredComponents: props.registeredComponents
|
|
4494
|
+
registeredComponents: props.registeredComponents,
|
|
4495
|
+
model: props.context.model
|
|
4404
4496
|
});
|
|
4405
4497
|
});
|
|
4406
4498
|
const Tag = createMemo5(() => {
|
|
@@ -4429,13 +4521,14 @@ function Block(props) {
|
|
|
4429
4521
|
blockChildren: processedBlock().children ?? [],
|
|
4430
4522
|
componentRef: blockComponent()?.component,
|
|
4431
4523
|
componentOptions: {
|
|
4432
|
-
...getBlockComponentOptions(processedBlock()),
|
|
4524
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
4433
4525
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
4434
4526
|
...provideBuilderContext(blockComponent(), props.context),
|
|
4435
4527
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
4436
4528
|
...provideRegisteredComponents(
|
|
4437
4529
|
blockComponent(),
|
|
4438
|
-
props.registeredComponents
|
|
4530
|
+
props.registeredComponents,
|
|
4531
|
+
props.context.model
|
|
4439
4532
|
)
|
|
4440
4533
|
},
|
|
4441
4534
|
context: props.context,
|
|
@@ -4859,7 +4952,7 @@ function Image(props) {
|
|
|
4859
4952
|
const url = imageToUse;
|
|
4860
4953
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
4861
4954
|
// images, otherwise you can supply this prop manually
|
|
4862
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
4955
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))) {
|
|
4863
4956
|
return props.srcset;
|
|
4864
4957
|
}
|
|
4865
4958
|
if (props.noWebp) {
|
|
@@ -4899,7 +4992,7 @@ function Image(props) {
|
|
|
4899
4992
|
<picture>
|
|
4900
4993
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
4901
4994
|
<img
|
|
4902
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
4995
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-070d7e88"}
|
|
4903
4996
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
4904
4997
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
4905
4998
|
alt={props.altText}
|
|
@@ -4917,22 +5010,22 @@ function Image(props) {
|
|
|
4917
5010
|
<Show8
|
|
4918
5011
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
4919
5012
|
><div
|
|
4920
|
-
class="builder-image-sizer div-
|
|
5013
|
+
class="builder-image-sizer div-070d7e88"
|
|
4921
5014
|
style={{
|
|
4922
5015
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
4923
5016
|
}}
|
|
4924
5017
|
/></Show8>
|
|
4925
5018
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
4926
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
5019
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-070d7e88-2">{props.children}</div></Show8>
|
|
4927
5020
|
</>
|
|
4928
|
-
<style>{`.img-
|
|
5021
|
+
<style>{`.img-070d7e88 {
|
|
4929
5022
|
opacity: 1;
|
|
4930
5023
|
transition: opacity 0.2s ease-in-out;
|
|
4931
|
-
}.div-
|
|
5024
|
+
}.div-070d7e88 {
|
|
4932
5025
|
width: 100%;
|
|
4933
5026
|
pointer-events: none;
|
|
4934
5027
|
font-size: 0;
|
|
4935
|
-
}.div-
|
|
5028
|
+
}.div-070d7e88-2 {
|
|
4936
5029
|
display: flex;
|
|
4937
5030
|
flex-direction: column;
|
|
4938
5031
|
align-items: stretch;
|
|
@@ -4968,10 +5061,10 @@ function SectionComponent(props) {
|
|
|
4968
5061
|
var section_default = SectionComponent;
|
|
4969
5062
|
|
|
4970
5063
|
// src/blocks/symbol/symbol.tsx
|
|
4971
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
5064
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
4972
5065
|
|
|
4973
5066
|
// src/components/content-variants/content-variants.tsx
|
|
4974
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
5067
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
4975
5068
|
|
|
4976
5069
|
// src/helpers/url.ts
|
|
4977
5070
|
var getTopLevelDomain = (host) => {
|
|
@@ -5165,7 +5258,7 @@ var handleABTesting = async ({
|
|
|
5165
5258
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
5166
5259
|
|
|
5167
5260
|
// src/components/content/content.tsx
|
|
5168
|
-
import { Show as Show14, createSignal as
|
|
5261
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
5169
5262
|
|
|
5170
5263
|
// src/blocks/accordion/component-info.ts
|
|
5171
5264
|
var defaultTitle = {
|
|
@@ -5725,6 +5818,10 @@ var componentInfo4 = {
|
|
|
5725
5818
|
noWrap: true
|
|
5726
5819
|
};
|
|
5727
5820
|
|
|
5821
|
+
// src/constants/file-types.ts
|
|
5822
|
+
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"];
|
|
5823
|
+
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"];
|
|
5824
|
+
|
|
5728
5825
|
// src/blocks/image/component-info.ts
|
|
5729
5826
|
var componentInfo5 = {
|
|
5730
5827
|
name: "Image",
|
|
@@ -5741,7 +5838,7 @@ var componentInfo5 = {
|
|
|
5741
5838
|
name: "image",
|
|
5742
5839
|
type: "file",
|
|
5743
5840
|
bubble: true,
|
|
5744
|
-
allowedFileTypes:
|
|
5841
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
5745
5842
|
required: true,
|
|
5746
5843
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
5747
5844
|
onChange: (options) => {
|
|
@@ -6205,30 +6302,10 @@ var componentInfo10 = {
|
|
|
6205
6302
|
};
|
|
6206
6303
|
|
|
6207
6304
|
// src/blocks/text/text.tsx
|
|
6208
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
6209
6305
|
function Text(props) {
|
|
6210
|
-
const processedText = createMemo11(() => {
|
|
6211
|
-
const context = props.builderContext;
|
|
6212
|
-
const {
|
|
6213
|
-
context: contextContext,
|
|
6214
|
-
localState,
|
|
6215
|
-
rootState,
|
|
6216
|
-
rootSetState
|
|
6217
|
-
} = context;
|
|
6218
|
-
return String(props.text?.toString() || "").replace(
|
|
6219
|
-
/{{([^}]+)}}/g,
|
|
6220
|
-
(match, group) => evaluate({
|
|
6221
|
-
code: group,
|
|
6222
|
-
context: contextContext,
|
|
6223
|
-
localState,
|
|
6224
|
-
rootState,
|
|
6225
|
-
rootSetState
|
|
6226
|
-
})
|
|
6227
|
-
);
|
|
6228
|
-
});
|
|
6229
6306
|
return <><div
|
|
6230
6307
|
class="builder-text"
|
|
6231
|
-
innerHTML={
|
|
6308
|
+
innerHTML={props.text?.toString() || ""}
|
|
6232
6309
|
style={{
|
|
6233
6310
|
outline: "none"
|
|
6234
6311
|
}}
|
|
@@ -6262,10 +6339,10 @@ var componentInfo11 = {
|
|
|
6262
6339
|
};
|
|
6263
6340
|
|
|
6264
6341
|
// src/blocks/custom-code/custom-code.tsx
|
|
6265
|
-
import { onMount as onMount5, createSignal as
|
|
6342
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
6266
6343
|
function CustomCode(props) {
|
|
6267
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6268
|
-
const [scriptsRun, setScriptsRun] =
|
|
6344
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
6345
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
6269
6346
|
let elementRef;
|
|
6270
6347
|
onMount5(() => {
|
|
6271
6348
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -6326,7 +6403,7 @@ var componentInfo12 = {
|
|
|
6326
6403
|
};
|
|
6327
6404
|
|
|
6328
6405
|
// src/blocks/embed/embed.tsx
|
|
6329
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
6406
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
6330
6407
|
|
|
6331
6408
|
// src/blocks/embed/helpers.ts
|
|
6332
6409
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -6334,9 +6411,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
6334
6411
|
|
|
6335
6412
|
// src/blocks/embed/embed.tsx
|
|
6336
6413
|
function Embed(props) {
|
|
6337
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6338
|
-
const [scriptsRun, setScriptsRun] =
|
|
6339
|
-
const [ranInitFn, setRanInitFn] =
|
|
6414
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
6415
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
6416
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
6340
6417
|
function findAndRunScripts() {
|
|
6341
6418
|
if (!elem || !elem.getElementsByTagName)
|
|
6342
6419
|
return;
|
|
@@ -6359,8 +6436,8 @@ function Embed(props) {
|
|
|
6359
6436
|
}
|
|
6360
6437
|
}
|
|
6361
6438
|
let elem;
|
|
6362
|
-
const onUpdateFn_0_elem =
|
|
6363
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
6439
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
6440
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
6364
6441
|
function onUpdateFn_0() {
|
|
6365
6442
|
if (elem && !ranInitFn()) {
|
|
6366
6443
|
setRanInitFn(true);
|
|
@@ -6615,7 +6692,7 @@ var componentInfo13 = {
|
|
|
6615
6692
|
};
|
|
6616
6693
|
|
|
6617
6694
|
// src/blocks/form/form/form.tsx
|
|
6618
|
-
import { Show as Show11, For as For7, createSignal as
|
|
6695
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
6619
6696
|
|
|
6620
6697
|
// src/functions/get-env.ts
|
|
6621
6698
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -6635,9 +6712,9 @@ function logFetch(url) {
|
|
|
6635
6712
|
|
|
6636
6713
|
// src/blocks/form/form/form.tsx
|
|
6637
6714
|
function FormComponent(props) {
|
|
6638
|
-
const [formState, setFormState] =
|
|
6639
|
-
const [responseData, setResponseData] =
|
|
6640
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
6715
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
6716
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
6717
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
6641
6718
|
function mergeNewRootState(newData) {
|
|
6642
6719
|
const combinedState = {
|
|
6643
6720
|
...props.builderContext.rootState,
|
|
@@ -7098,7 +7175,7 @@ var componentInfo18 = {
|
|
|
7098
7175
|
name: "image",
|
|
7099
7176
|
bubble: true,
|
|
7100
7177
|
type: "file",
|
|
7101
|
-
allowedFileTypes:
|
|
7178
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
7102
7179
|
required: true
|
|
7103
7180
|
}],
|
|
7104
7181
|
noWrap: true,
|
|
@@ -7133,14 +7210,14 @@ var componentInfo19 = {
|
|
|
7133
7210
|
inputs: [{
|
|
7134
7211
|
name: "video",
|
|
7135
7212
|
type: "file",
|
|
7136
|
-
allowedFileTypes:
|
|
7213
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
7137
7214
|
bubble: true,
|
|
7138
7215
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
7139
7216
|
required: true
|
|
7140
7217
|
}, {
|
|
7141
7218
|
name: "posterImage",
|
|
7142
7219
|
type: "file",
|
|
7143
|
-
allowedFileTypes:
|
|
7220
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
7144
7221
|
helperText: "Image to show before the video plays"
|
|
7145
7222
|
}, {
|
|
7146
7223
|
name: "autoPlay",
|
|
@@ -7209,9 +7286,9 @@ var componentInfo19 = {
|
|
|
7209
7286
|
};
|
|
7210
7287
|
|
|
7211
7288
|
// src/blocks/video/video.tsx
|
|
7212
|
-
import { Show as Show12, createMemo as
|
|
7289
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
7213
7290
|
function Video(props) {
|
|
7214
|
-
const videoProps =
|
|
7291
|
+
const videoProps = createMemo14(() => {
|
|
7215
7292
|
return {
|
|
7216
7293
|
...props.autoPlay === true ? {
|
|
7217
7294
|
autoPlay: true
|
|
@@ -7230,7 +7307,7 @@ function Video(props) {
|
|
|
7230
7307
|
} : {}
|
|
7231
7308
|
};
|
|
7232
7309
|
});
|
|
7233
|
-
const spreadProps =
|
|
7310
|
+
const spreadProps = createMemo14(() => {
|
|
7234
7311
|
return {
|
|
7235
7312
|
...videoProps()
|
|
7236
7313
|
};
|
|
@@ -7366,7 +7443,7 @@ var createRegisterComponentMessage = (info) => ({
|
|
|
7366
7443
|
var serializeFn = (fnValue) => {
|
|
7367
7444
|
const fnStr = fnValue.toString().trim();
|
|
7368
7445
|
const isArrowWithoutParens = /^[a-zA-Z0-9_]+\s*=>/i.test(fnStr);
|
|
7369
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
7446
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("async") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
7370
7447
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
7371
7448
|
};
|
|
7372
7449
|
function serializeIncludingFunctions(info) {
|
|
@@ -7440,8 +7517,8 @@ import {
|
|
|
7440
7517
|
onMount as onMount6,
|
|
7441
7518
|
on as on3,
|
|
7442
7519
|
createEffect as createEffect3,
|
|
7443
|
-
createMemo as
|
|
7444
|
-
createSignal as
|
|
7520
|
+
createMemo as createMemo15,
|
|
7521
|
+
createSignal as createSignal15
|
|
7445
7522
|
} from "solid-js";
|
|
7446
7523
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
7447
7524
|
|
|
@@ -7451,7 +7528,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7451
7528
|
}
|
|
7452
7529
|
|
|
7453
7530
|
// src/constants/sdk-version.ts
|
|
7454
|
-
var SDK_VERSION = "3.0.
|
|
7531
|
+
var SDK_VERSION = "3.0.2";
|
|
7455
7532
|
|
|
7456
7533
|
// src/helpers/sdk-headers.ts
|
|
7457
7534
|
var getSdkHeaders = () => ({
|
|
@@ -7514,6 +7591,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
7514
7591
|
}
|
|
7515
7592
|
return _res;
|
|
7516
7593
|
}
|
|
7594
|
+
function unflatten(obj) {
|
|
7595
|
+
const result = {};
|
|
7596
|
+
for (const key in obj) {
|
|
7597
|
+
const parts = key.split(".");
|
|
7598
|
+
let current = result;
|
|
7599
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7600
|
+
const part = parts[i];
|
|
7601
|
+
if (i === parts.length - 1) {
|
|
7602
|
+
current[part] = obj[key];
|
|
7603
|
+
} else {
|
|
7604
|
+
current[part] = current[part] || {};
|
|
7605
|
+
current = current[part];
|
|
7606
|
+
}
|
|
7607
|
+
}
|
|
7608
|
+
}
|
|
7609
|
+
return result;
|
|
7610
|
+
}
|
|
7517
7611
|
|
|
7518
7612
|
// src/types/api-version.ts
|
|
7519
7613
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -7578,7 +7672,7 @@ var generateContentUrl = (options) => {
|
|
|
7578
7672
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
7579
7673
|
url.searchParams.set("includeRefs", String(true));
|
|
7580
7674
|
const finalLocale = locale || userAttributes?.locale;
|
|
7581
|
-
let finalUserAttributes = userAttributes;
|
|
7675
|
+
let finalUserAttributes = userAttributes || {};
|
|
7582
7676
|
if (finalLocale) {
|
|
7583
7677
|
url.searchParams.set("locale", finalLocale);
|
|
7584
7678
|
finalUserAttributes = {
|
|
@@ -7616,11 +7710,15 @@ var generateContentUrl = (options) => {
|
|
|
7616
7710
|
...getBuilderSearchParamsFromWindow(),
|
|
7617
7711
|
...normalizeSearchParams(options.options || {})
|
|
7618
7712
|
};
|
|
7713
|
+
finalUserAttributes = {
|
|
7714
|
+
...finalUserAttributes,
|
|
7715
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
7716
|
+
};
|
|
7619
7717
|
const flattened = flatten(queryOptions);
|
|
7620
7718
|
for (const key in flattened) {
|
|
7621
7719
|
url.searchParams.set(key, String(flattened[key]));
|
|
7622
7720
|
}
|
|
7623
|
-
if (finalUserAttributes) {
|
|
7721
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
7624
7722
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
7625
7723
|
}
|
|
7626
7724
|
if (query) {
|
|
@@ -7633,6 +7731,28 @@ var generateContentUrl = (options) => {
|
|
|
7633
7731
|
}
|
|
7634
7732
|
return url;
|
|
7635
7733
|
};
|
|
7734
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
7735
|
+
const newUserAttributes = {};
|
|
7736
|
+
for (const key in queryOptions) {
|
|
7737
|
+
if (key.startsWith("userAttributes.")) {
|
|
7738
|
+
newUserAttributes[key] = queryOptions[key];
|
|
7739
|
+
delete queryOptions[key];
|
|
7740
|
+
}
|
|
7741
|
+
}
|
|
7742
|
+
return newUserAttributes;
|
|
7743
|
+
};
|
|
7744
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
7745
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
7746
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
7747
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
7748
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
7749
|
+
const {
|
|
7750
|
+
userAttributes
|
|
7751
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
7752
|
+
return userAttributes;
|
|
7753
|
+
}
|
|
7754
|
+
return {};
|
|
7755
|
+
};
|
|
7636
7756
|
|
|
7637
7757
|
// src/functions/get-content/index.ts
|
|
7638
7758
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -8163,6 +8283,12 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
8163
8283
|
};
|
|
8164
8284
|
};
|
|
8165
8285
|
|
|
8286
|
+
// src/components/content/components/enable-editor.helpers.ts
|
|
8287
|
+
var SDKS_USING_ELEMENT_REF_APPROACH = ["svelte", "qwik", "vue"];
|
|
8288
|
+
var needsElementRefDivForEditing = () => {
|
|
8289
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
8290
|
+
};
|
|
8291
|
+
|
|
8166
8292
|
// src/components/content/components/styles.helpers.ts
|
|
8167
8293
|
var getCssFromFont = (font) => {
|
|
8168
8294
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -8244,12 +8370,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
8244
8370
|
|
|
8245
8371
|
// src/components/content/components/enable-editor.tsx
|
|
8246
8372
|
function EnableEditor(props) {
|
|
8247
|
-
const [ContentWrapper, setContentWrapper] =
|
|
8373
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
8248
8374
|
props.contentWrapper || "div"
|
|
8249
8375
|
);
|
|
8250
|
-
const [httpReqsData, setHttpReqsData] =
|
|
8251
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
8252
|
-
const [clicked, setClicked] =
|
|
8376
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
8377
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
8378
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
8253
8379
|
function mergeNewRootState(newData) {
|
|
8254
8380
|
const combinedState = {
|
|
8255
8381
|
...props.builderContextSignal.rootState,
|
|
@@ -8283,7 +8409,7 @@ function EnableEditor(props) {
|
|
|
8283
8409
|
content: newContentValue
|
|
8284
8410
|
}));
|
|
8285
8411
|
}
|
|
8286
|
-
const showContentProps =
|
|
8412
|
+
const showContentProps = createMemo15(() => {
|
|
8287
8413
|
return props.showContent ? {} : {
|
|
8288
8414
|
hidden: true,
|
|
8289
8415
|
"aria-hidden": true
|
|
@@ -8408,8 +8534,10 @@ function EnableEditor(props) {
|
|
|
8408
8534
|
Object.values(
|
|
8409
8535
|
props.builderContextSignal.componentInfos
|
|
8410
8536
|
).forEach((registeredComponent) => {
|
|
8411
|
-
|
|
8412
|
-
|
|
8537
|
+
if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8538
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
8539
|
+
window.parent?.postMessage(message, "*");
|
|
8540
|
+
}
|
|
8413
8541
|
});
|
|
8414
8542
|
window.addEventListener(
|
|
8415
8543
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -8437,11 +8565,16 @@ function EnableEditor(props) {
|
|
|
8437
8565
|
`builder.overrides.${searchParamPreviewModel}`
|
|
8438
8566
|
);
|
|
8439
8567
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
8440
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8568
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8441
8569
|
fetchOneEntry({
|
|
8442
|
-
model: props.model,
|
|
8570
|
+
model: props.model || "",
|
|
8443
8571
|
apiKey: props.apiKey,
|
|
8444
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
8572
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
8573
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
8574
|
+
query: {
|
|
8575
|
+
id: props.context.symbolId
|
|
8576
|
+
}
|
|
8577
|
+
} : {}
|
|
8445
8578
|
}).then((content) => {
|
|
8446
8579
|
if (content) {
|
|
8447
8580
|
mergeNewContent(content);
|
|
@@ -8451,14 +8584,14 @@ function EnableEditor(props) {
|
|
|
8451
8584
|
}
|
|
8452
8585
|
}
|
|
8453
8586
|
});
|
|
8454
|
-
const onUpdateFn_0_props_content =
|
|
8587
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
8455
8588
|
function onUpdateFn_0() {
|
|
8456
8589
|
if (props.content) {
|
|
8457
8590
|
mergeNewContent(props.content);
|
|
8458
8591
|
}
|
|
8459
8592
|
}
|
|
8460
8593
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8461
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
8594
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
8462
8595
|
() => props.builderContextSignal.rootState
|
|
8463
8596
|
);
|
|
8464
8597
|
function onUpdateFn_1() {
|
|
@@ -8470,14 +8603,14 @@ function EnableEditor(props) {
|
|
|
8470
8603
|
onUpdateFn_1
|
|
8471
8604
|
)
|
|
8472
8605
|
);
|
|
8473
|
-
const onUpdateFn_2_props_data =
|
|
8606
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
8474
8607
|
function onUpdateFn_2() {
|
|
8475
8608
|
if (props.data) {
|
|
8476
8609
|
mergeNewRootState(props.data);
|
|
8477
8610
|
}
|
|
8478
8611
|
}
|
|
8479
8612
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
8480
|
-
const onUpdateFn_3_props_locale =
|
|
8613
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
8481
8614
|
function onUpdateFn_3() {
|
|
8482
8615
|
if (props.locale) {
|
|
8483
8616
|
mergeNewRootState({
|
|
@@ -8486,7 +8619,9 @@ function EnableEditor(props) {
|
|
|
8486
8619
|
}
|
|
8487
8620
|
}
|
|
8488
8621
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
8489
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
8622
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
8623
|
+
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
8624
|
+
><Dynamic5
|
|
8490
8625
|
class={getWrapperClassName(
|
|
8491
8626
|
props.content?.testVariationId || props.content?.id
|
|
8492
8627
|
)}
|
|
@@ -8495,6 +8630,9 @@ function EnableEditor(props) {
|
|
|
8495
8630
|
onClick={(event) => onClick(event)}
|
|
8496
8631
|
builder-content-id={props.builderContextSignal.content?.id}
|
|
8497
8632
|
builder-model={props.model}
|
|
8633
|
+
style={{
|
|
8634
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
8635
|
+
}}
|
|
8498
8636
|
{...{}}
|
|
8499
8637
|
{...showContentProps()}
|
|
8500
8638
|
{...props.contentWrapperProps}
|
|
@@ -8504,9 +8642,9 @@ function EnableEditor(props) {
|
|
|
8504
8642
|
var Enable_editor_default = EnableEditor;
|
|
8505
8643
|
|
|
8506
8644
|
// src/components/content/components/styles.tsx
|
|
8507
|
-
import { createSignal as
|
|
8645
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
8508
8646
|
function ContentStyles(props) {
|
|
8509
|
-
const [injectedStyles, setInjectedStyles] =
|
|
8647
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
8510
8648
|
`
|
|
8511
8649
|
${getCss({
|
|
8512
8650
|
cssCode: props.cssCode,
|
|
@@ -8564,7 +8702,7 @@ var getContentInitialValue = ({
|
|
|
8564
8702
|
|
|
8565
8703
|
// src/components/content/content.tsx
|
|
8566
8704
|
function ContentComponent(props) {
|
|
8567
|
-
const [scriptStr, setScriptStr] =
|
|
8705
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
8568
8706
|
getUpdateVariantVisibilityScript({
|
|
8569
8707
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
8570
8708
|
variationId: props.content?.testVariationId,
|
|
@@ -8572,16 +8710,10 @@ function ContentComponent(props) {
|
|
|
8572
8710
|
contentId: props.content?.id
|
|
8573
8711
|
})
|
|
8574
8712
|
);
|
|
8575
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
8713
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
8576
8714
|
[
|
|
8577
8715
|
...getDefaultRegisteredComponents(),
|
|
8578
|
-
...props.customComponents
|
|
8579
|
-
if (!models?.length)
|
|
8580
|
-
return true;
|
|
8581
|
-
if (!props.model)
|
|
8582
|
-
return true;
|
|
8583
|
-
return models.includes(props.model);
|
|
8584
|
-
}) || []
|
|
8716
|
+
...props.customComponents || []
|
|
8585
8717
|
].reduce(
|
|
8586
8718
|
(acc, { component, ...info }) => ({
|
|
8587
8719
|
...acc,
|
|
@@ -8593,7 +8725,7 @@ function ContentComponent(props) {
|
|
|
8593
8725
|
{}
|
|
8594
8726
|
)
|
|
8595
8727
|
);
|
|
8596
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
8728
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
8597
8729
|
content: getContentInitialValue({
|
|
8598
8730
|
content: props.content,
|
|
8599
8731
|
data: props.data
|
|
@@ -8611,13 +8743,7 @@ function ContentComponent(props) {
|
|
|
8611
8743
|
apiVersion: props.apiVersion,
|
|
8612
8744
|
componentInfos: [
|
|
8613
8745
|
...getDefaultRegisteredComponents(),
|
|
8614
|
-
...props.customComponents
|
|
8615
|
-
if (!models?.length)
|
|
8616
|
-
return true;
|
|
8617
|
-
if (!props.model)
|
|
8618
|
-
return true;
|
|
8619
|
-
return models.includes(props.model);
|
|
8620
|
-
}) || []
|
|
8746
|
+
...props.customComponents || []
|
|
8621
8747
|
].reduce(
|
|
8622
8748
|
(acc, { component: _, ...info }) => ({
|
|
8623
8749
|
...acc,
|
|
@@ -8628,7 +8754,8 @@ function ContentComponent(props) {
|
|
|
8628
8754
|
inheritedStyles: {},
|
|
8629
8755
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
8630
8756
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
8631
|
-
nonce: props.nonce || ""
|
|
8757
|
+
nonce: props.nonce || "",
|
|
8758
|
+
model: props.model || ""
|
|
8632
8759
|
});
|
|
8633
8760
|
function contentSetState(newRootState) {
|
|
8634
8761
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -8706,13 +8833,13 @@ var Content_default = ContentComponent;
|
|
|
8706
8833
|
|
|
8707
8834
|
// src/components/content-variants/content-variants.tsx
|
|
8708
8835
|
function ContentVariants(props) {
|
|
8709
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
8836
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
8710
8837
|
checkShouldRenderVariants({
|
|
8711
8838
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8712
8839
|
content: props.content
|
|
8713
8840
|
})
|
|
8714
8841
|
);
|
|
8715
|
-
const updateCookieAndStylesScriptStr =
|
|
8842
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
8716
8843
|
return getUpdateCookieAndStylesScript(
|
|
8717
8844
|
getVariants(props.content).map((value) => ({
|
|
8718
8845
|
id: value.testVariationId,
|
|
@@ -8721,10 +8848,10 @@ function ContentVariants(props) {
|
|
|
8721
8848
|
props.content?.id || ""
|
|
8722
8849
|
);
|
|
8723
8850
|
});
|
|
8724
|
-
const hideVariantsStyleString =
|
|
8851
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
8725
8852
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8726
8853
|
});
|
|
8727
|
-
const defaultContent =
|
|
8854
|
+
const defaultContent = createMemo18(() => {
|
|
8728
8855
|
return shouldRenderVariants() ? {
|
|
8729
8856
|
...props.content,
|
|
8730
8857
|
testVariationId: props.content?.id
|
|
@@ -8836,14 +8963,14 @@ var fetchSymbolContent = async ({
|
|
|
8836
8963
|
|
|
8837
8964
|
// src/blocks/symbol/symbol.tsx
|
|
8838
8965
|
function Symbol2(props) {
|
|
8839
|
-
const [contentToUse, setContentToUse] =
|
|
8840
|
-
const blocksWrapper =
|
|
8966
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
8967
|
+
const blocksWrapper = createMemo19(() => {
|
|
8841
8968
|
return "div";
|
|
8842
8969
|
});
|
|
8843
|
-
const contentWrapper =
|
|
8970
|
+
const contentWrapper = createMemo19(() => {
|
|
8844
8971
|
return "div";
|
|
8845
8972
|
});
|
|
8846
|
-
const className =
|
|
8973
|
+
const className = createMemo19(() => {
|
|
8847
8974
|
return [
|
|
8848
8975
|
...[props.attributes[getClassPropName()]],
|
|
8849
8976
|
"builder-symbol",
|
|
@@ -8865,7 +8992,7 @@ function Symbol2(props) {
|
|
|
8865
8992
|
}
|
|
8866
8993
|
onMount8(() => {
|
|
8867
8994
|
});
|
|
8868
|
-
const onUpdateFn_0_props_symbol =
|
|
8995
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
8869
8996
|
function onUpdateFn_0() {
|
|
8870
8997
|
setContent();
|
|
8871
8998
|
}
|