@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/dev.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 MSG_PREFIX = "[Builder.io]: ";
|
|
141
125
|
var logger = {
|
|
@@ -3470,10 +3454,8 @@ var runInEdge = ({
|
|
|
3470
3454
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
3471
3455
|
}).join("\n");
|
|
3472
3456
|
const cleanedCode = processCode(code);
|
|
3473
|
-
if (cleanedCode === "")
|
|
3474
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
3457
|
+
if (cleanedCode === "")
|
|
3475
3458
|
return;
|
|
3476
|
-
}
|
|
3477
3459
|
const transformed = `
|
|
3478
3460
|
function theFunction() {
|
|
3479
3461
|
${prependedCode}
|
|
@@ -3579,6 +3561,109 @@ function evaluate({
|
|
|
3579
3561
|
}
|
|
3580
3562
|
}
|
|
3581
3563
|
|
|
3564
|
+
// src/functions/get-block-component-options.ts
|
|
3565
|
+
function getBlockComponentOptions(block, context) {
|
|
3566
|
+
return {
|
|
3567
|
+
...block.component?.options,
|
|
3568
|
+
...block.options,
|
|
3569
|
+
...evaluateTextComponentTextOption(block, context)
|
|
3570
|
+
};
|
|
3571
|
+
}
|
|
3572
|
+
var evaluateTextComponentTextOption = (block, context) => {
|
|
3573
|
+
if (block.component?.name === "Text" && block.component.options?.text && typeof block.component.options.text === "string") {
|
|
3574
|
+
return {
|
|
3575
|
+
...block.component.options,
|
|
3576
|
+
text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
3577
|
+
code: group,
|
|
3578
|
+
context,
|
|
3579
|
+
localState: context.localState,
|
|
3580
|
+
rootState: context.rootState,
|
|
3581
|
+
rootSetState: context.rootSetState
|
|
3582
|
+
}))
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
};
|
|
3586
|
+
|
|
3587
|
+
// src/helpers/omit.ts
|
|
3588
|
+
function omit(obj, ...values) {
|
|
3589
|
+
const newObject = Object.assign({}, obj);
|
|
3590
|
+
for (const key of values) {
|
|
3591
|
+
delete newObject[key];
|
|
3592
|
+
}
|
|
3593
|
+
return newObject;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
// src/functions/traverse.ts
|
|
3597
|
+
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
3598
|
+
if (obj == null || typeof obj !== "object") {
|
|
3599
|
+
callback(obj, (newValue) => {
|
|
3600
|
+
if (parent2 !== null && key !== null) {
|
|
3601
|
+
parent2[key] = newValue;
|
|
3602
|
+
}
|
|
3603
|
+
});
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
if (visited.has(obj)) {
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
visited.add(obj);
|
|
3610
|
+
if (Array.isArray(obj)) {
|
|
3611
|
+
obj.forEach((item, index) => {
|
|
3612
|
+
const update = (newValue) => {
|
|
3613
|
+
obj[index] = newValue;
|
|
3614
|
+
};
|
|
3615
|
+
callback(item, update);
|
|
3616
|
+
traverse(item, callback, obj, index, visited);
|
|
3617
|
+
});
|
|
3618
|
+
} else {
|
|
3619
|
+
Object.entries(obj).forEach(([key2, value]) => {
|
|
3620
|
+
const update = (newValue) => {
|
|
3621
|
+
obj[key2] = newValue;
|
|
3622
|
+
};
|
|
3623
|
+
callback(value, update);
|
|
3624
|
+
traverse(value, callback, obj, key2, visited);
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
// src/functions/extract-localized-values.ts
|
|
3630
|
+
function isLocalizedField(value) {
|
|
3631
|
+
return value && typeof value === "object" && value["@type"] === "@builder.io/core:LocalizedValue";
|
|
3632
|
+
}
|
|
3633
|
+
function containsLocalizedValues(data) {
|
|
3634
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
3635
|
+
return false;
|
|
3636
|
+
}
|
|
3637
|
+
let hasLocalizedValues = false;
|
|
3638
|
+
traverse(data, (value) => {
|
|
3639
|
+
if (isLocalizedField(value)) {
|
|
3640
|
+
hasLocalizedValues = true;
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
});
|
|
3644
|
+
return hasLocalizedValues;
|
|
3645
|
+
}
|
|
3646
|
+
function extractLocalizedValues(data, locale) {
|
|
3647
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
3648
|
+
return {};
|
|
3649
|
+
}
|
|
3650
|
+
traverse(data, (value, update) => {
|
|
3651
|
+
if (isLocalizedField(value)) {
|
|
3652
|
+
update(value[locale] ?? void 0);
|
|
3653
|
+
}
|
|
3654
|
+
});
|
|
3655
|
+
return data;
|
|
3656
|
+
}
|
|
3657
|
+
function resolveLocalizedValues(block, locale) {
|
|
3658
|
+
if (block.component?.options && containsLocalizedValues(block.component?.options)) {
|
|
3659
|
+
if (!locale) {
|
|
3660
|
+
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");
|
|
3661
|
+
}
|
|
3662
|
+
block.component.options = extractLocalizedValues(block.component.options, locale ?? "Default");
|
|
3663
|
+
}
|
|
3664
|
+
return block;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3582
3667
|
// src/functions/fast-clone.ts
|
|
3583
3668
|
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
3584
3669
|
|
|
@@ -3672,23 +3757,19 @@ var evaluateBindings = ({
|
|
|
3672
3757
|
function getProcessedBlock({
|
|
3673
3758
|
block,
|
|
3674
3759
|
context,
|
|
3675
|
-
shouldEvaluateBindings,
|
|
3676
3760
|
localState,
|
|
3677
3761
|
rootState,
|
|
3678
3762
|
rootSetState
|
|
3679
3763
|
}) {
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
} else {
|
|
3690
|
-
return transformedBlock;
|
|
3691
|
-
}
|
|
3764
|
+
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
3765
|
+
transformedBlock = transformBlock(transformedBlock);
|
|
3766
|
+
return evaluateBindings({
|
|
3767
|
+
block: transformedBlock,
|
|
3768
|
+
localState,
|
|
3769
|
+
rootState,
|
|
3770
|
+
rootSetState,
|
|
3771
|
+
context
|
|
3772
|
+
});
|
|
3692
3773
|
}
|
|
3693
3774
|
|
|
3694
3775
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -3935,16 +4016,24 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
3935
4016
|
}
|
|
3936
4017
|
|
|
3937
4018
|
// src/components/block/block.helpers.ts
|
|
4019
|
+
var checkIsComponentRestricted = (component, model) => {
|
|
4020
|
+
if (!component)
|
|
4021
|
+
return true;
|
|
4022
|
+
if (!model)
|
|
4023
|
+
return false;
|
|
4024
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
4025
|
+
};
|
|
3938
4026
|
var getComponent = ({
|
|
3939
4027
|
block,
|
|
3940
|
-
registeredComponents
|
|
4028
|
+
registeredComponents,
|
|
4029
|
+
model
|
|
3941
4030
|
}) => {
|
|
3942
4031
|
const componentName = block.component?.name;
|
|
3943
4032
|
if (!componentName) {
|
|
3944
4033
|
return null;
|
|
3945
4034
|
}
|
|
3946
4035
|
const ref = registeredComponents[componentName];
|
|
3947
|
-
if (!ref) {
|
|
4036
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
3948
4037
|
console.warn(`
|
|
3949
4038
|
Could not find a registered component named "${componentName}".
|
|
3950
4039
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -3998,11 +4087,15 @@ var provideLinkComponent = (block, linkComponent) => {
|
|
|
3998
4087
|
};
|
|
3999
4088
|
return {};
|
|
4000
4089
|
};
|
|
4001
|
-
var provideRegisteredComponents = (block, registeredComponents) => {
|
|
4002
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
4090
|
+
var provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
4091
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
4092
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
4093
|
+
return !checkIsComponentRestricted(component, model);
|
|
4094
|
+
}));
|
|
4003
4095
|
return {
|
|
4004
|
-
builderComponents:
|
|
4096
|
+
builderComponents: filteredRegisteredComponents
|
|
4005
4097
|
};
|
|
4098
|
+
}
|
|
4006
4099
|
return {};
|
|
4007
4100
|
};
|
|
4008
4101
|
var provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -4398,15 +4491,15 @@ function Block(props) {
|
|
|
4398
4491
|
localState: props.context.localState,
|
|
4399
4492
|
rootState: props.context.rootState,
|
|
4400
4493
|
rootSetState: props.context.rootSetState,
|
|
4401
|
-
context: props.context.context
|
|
4402
|
-
shouldEvaluateBindings: true
|
|
4494
|
+
context: props.context.context
|
|
4403
4495
|
});
|
|
4404
4496
|
return blockToUse;
|
|
4405
4497
|
});
|
|
4406
4498
|
const blockComponent = createMemo5(() => {
|
|
4407
4499
|
return getComponent({
|
|
4408
4500
|
block: processedBlock(),
|
|
4409
|
-
registeredComponents: props.registeredComponents
|
|
4501
|
+
registeredComponents: props.registeredComponents,
|
|
4502
|
+
model: props.context.model
|
|
4410
4503
|
});
|
|
4411
4504
|
});
|
|
4412
4505
|
const Tag = createMemo5(() => {
|
|
@@ -4435,13 +4528,14 @@ function Block(props) {
|
|
|
4435
4528
|
blockChildren: processedBlock().children ?? [],
|
|
4436
4529
|
componentRef: blockComponent()?.component,
|
|
4437
4530
|
componentOptions: {
|
|
4438
|
-
...getBlockComponentOptions(processedBlock()),
|
|
4531
|
+
...getBlockComponentOptions(processedBlock(), props.context),
|
|
4439
4532
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
4440
4533
|
...provideBuilderContext(blockComponent(), props.context),
|
|
4441
4534
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
4442
4535
|
...provideRegisteredComponents(
|
|
4443
4536
|
blockComponent(),
|
|
4444
|
-
props.registeredComponents
|
|
4537
|
+
props.registeredComponents,
|
|
4538
|
+
props.context.model
|
|
4445
4539
|
)
|
|
4446
4540
|
},
|
|
4447
4541
|
context: props.context,
|
|
@@ -4865,7 +4959,7 @@ function Image(props) {
|
|
|
4865
4959
|
const url = imageToUse;
|
|
4866
4960
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
4867
4961
|
// images, otherwise you can supply this prop manually
|
|
4868
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
4962
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))) {
|
|
4869
4963
|
return props.srcset;
|
|
4870
4964
|
}
|
|
4871
4965
|
if (props.noWebp) {
|
|
@@ -4906,7 +5000,7 @@ function Image(props) {
|
|
|
4906
5000
|
<picture>
|
|
4907
5001
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
4908
5002
|
<img
|
|
4909
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
5003
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-070d7e88"}
|
|
4910
5004
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
4911
5005
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
4912
5006
|
alt={props.altText}
|
|
@@ -4924,22 +5018,22 @@ function Image(props) {
|
|
|
4924
5018
|
<Show8
|
|
4925
5019
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
4926
5020
|
><div
|
|
4927
|
-
class="builder-image-sizer div-
|
|
5021
|
+
class="builder-image-sizer div-070d7e88"
|
|
4928
5022
|
style={{
|
|
4929
5023
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
4930
5024
|
}}
|
|
4931
5025
|
/></Show8>
|
|
4932
5026
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
4933
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
5027
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-070d7e88-2">{props.children}</div></Show8>
|
|
4934
5028
|
</>
|
|
4935
|
-
<style>{`.img-
|
|
5029
|
+
<style>{`.img-070d7e88 {
|
|
4936
5030
|
opacity: 1;
|
|
4937
5031
|
transition: opacity 0.2s ease-in-out;
|
|
4938
|
-
}.div-
|
|
5032
|
+
}.div-070d7e88 {
|
|
4939
5033
|
width: 100%;
|
|
4940
5034
|
pointer-events: none;
|
|
4941
5035
|
font-size: 0;
|
|
4942
|
-
}.div-
|
|
5036
|
+
}.div-070d7e88-2 {
|
|
4943
5037
|
display: flex;
|
|
4944
5038
|
flex-direction: column;
|
|
4945
5039
|
align-items: stretch;
|
|
@@ -4975,10 +5069,10 @@ function SectionComponent(props) {
|
|
|
4975
5069
|
var section_default = SectionComponent;
|
|
4976
5070
|
|
|
4977
5071
|
// src/blocks/symbol/symbol.tsx
|
|
4978
|
-
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as
|
|
5072
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
4979
5073
|
|
|
4980
5074
|
// src/components/content-variants/content-variants.tsx
|
|
4981
|
-
import { Show as Show15, For as For9, onMount as onMount7, createSignal as
|
|
5075
|
+
import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
4982
5076
|
|
|
4983
5077
|
// src/helpers/url.ts
|
|
4984
5078
|
var getTopLevelDomain = (host) => {
|
|
@@ -5172,7 +5266,7 @@ var handleABTesting = async ({
|
|
|
5172
5266
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
5173
5267
|
|
|
5174
5268
|
// src/components/content/content.tsx
|
|
5175
|
-
import { Show as Show14, createSignal as
|
|
5269
|
+
import { Show as Show14, createSignal as createSignal17 } from "solid-js";
|
|
5176
5270
|
|
|
5177
5271
|
// src/blocks/accordion/component-info.ts
|
|
5178
5272
|
var defaultTitle = {
|
|
@@ -5732,6 +5826,10 @@ var componentInfo4 = {
|
|
|
5732
5826
|
noWrap: true
|
|
5733
5827
|
};
|
|
5734
5828
|
|
|
5829
|
+
// src/constants/file-types.ts
|
|
5830
|
+
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"];
|
|
5831
|
+
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"];
|
|
5832
|
+
|
|
5735
5833
|
// src/blocks/image/component-info.ts
|
|
5736
5834
|
var componentInfo5 = {
|
|
5737
5835
|
name: "Image",
|
|
@@ -5748,7 +5846,7 @@ var componentInfo5 = {
|
|
|
5748
5846
|
name: "image",
|
|
5749
5847
|
type: "file",
|
|
5750
5848
|
bubble: true,
|
|
5751
|
-
allowedFileTypes:
|
|
5849
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
5752
5850
|
required: true,
|
|
5753
5851
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
5754
5852
|
onChange: (options) => {
|
|
@@ -6213,30 +6311,10 @@ var componentInfo10 = {
|
|
|
6213
6311
|
};
|
|
6214
6312
|
|
|
6215
6313
|
// src/blocks/text/text.tsx
|
|
6216
|
-
import { createMemo as createMemo11 } from "solid-js";
|
|
6217
6314
|
function Text(props) {
|
|
6218
|
-
const processedText = createMemo11(() => {
|
|
6219
|
-
const context = props.builderContext;
|
|
6220
|
-
const {
|
|
6221
|
-
context: contextContext,
|
|
6222
|
-
localState,
|
|
6223
|
-
rootState,
|
|
6224
|
-
rootSetState
|
|
6225
|
-
} = context;
|
|
6226
|
-
return String(props.text?.toString() || "").replace(
|
|
6227
|
-
/{{([^}]+)}}/g,
|
|
6228
|
-
(match, group) => evaluate({
|
|
6229
|
-
code: group,
|
|
6230
|
-
context: contextContext,
|
|
6231
|
-
localState,
|
|
6232
|
-
rootState,
|
|
6233
|
-
rootSetState
|
|
6234
|
-
})
|
|
6235
|
-
);
|
|
6236
|
-
});
|
|
6237
6315
|
return <><div
|
|
6238
6316
|
class="builder-text"
|
|
6239
|
-
innerHTML={
|
|
6317
|
+
innerHTML={props.text?.toString() || ""}
|
|
6240
6318
|
style={{
|
|
6241
6319
|
outline: "none"
|
|
6242
6320
|
}}
|
|
@@ -6270,10 +6348,10 @@ var componentInfo11 = {
|
|
|
6270
6348
|
};
|
|
6271
6349
|
|
|
6272
6350
|
// src/blocks/custom-code/custom-code.tsx
|
|
6273
|
-
import { onMount as onMount5, createSignal as
|
|
6351
|
+
import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
|
|
6274
6352
|
function CustomCode(props) {
|
|
6275
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6276
|
-
const [scriptsRun, setScriptsRun] =
|
|
6353
|
+
const [scriptsInserted, setScriptsInserted] = createSignal11([]);
|
|
6354
|
+
const [scriptsRun, setScriptsRun] = createSignal11([]);
|
|
6277
6355
|
let elementRef;
|
|
6278
6356
|
onMount5(() => {
|
|
6279
6357
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -6335,7 +6413,7 @@ var componentInfo12 = {
|
|
|
6335
6413
|
};
|
|
6336
6414
|
|
|
6337
6415
|
// src/blocks/embed/embed.tsx
|
|
6338
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
6416
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
6339
6417
|
|
|
6340
6418
|
// src/blocks/embed/helpers.ts
|
|
6341
6419
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -6343,9 +6421,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
6343
6421
|
|
|
6344
6422
|
// src/blocks/embed/embed.tsx
|
|
6345
6423
|
function Embed(props) {
|
|
6346
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6347
|
-
const [scriptsRun, setScriptsRun] =
|
|
6348
|
-
const [ranInitFn, setRanInitFn] =
|
|
6424
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
6425
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
6426
|
+
const [ranInitFn, setRanInitFn] = createSignal12(false);
|
|
6349
6427
|
function findAndRunScripts() {
|
|
6350
6428
|
if (!elem || !elem.getElementsByTagName)
|
|
6351
6429
|
return;
|
|
@@ -6369,8 +6447,8 @@ function Embed(props) {
|
|
|
6369
6447
|
}
|
|
6370
6448
|
}
|
|
6371
6449
|
let elem;
|
|
6372
|
-
const onUpdateFn_0_elem =
|
|
6373
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
6450
|
+
const onUpdateFn_0_elem = createMemo12(() => elem);
|
|
6451
|
+
const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
|
|
6374
6452
|
function onUpdateFn_0() {
|
|
6375
6453
|
if (elem && !ranInitFn()) {
|
|
6376
6454
|
setRanInitFn(true);
|
|
@@ -6625,7 +6703,7 @@ var componentInfo13 = {
|
|
|
6625
6703
|
};
|
|
6626
6704
|
|
|
6627
6705
|
// src/blocks/form/form/form.tsx
|
|
6628
|
-
import { Show as Show11, For as For7, createSignal as
|
|
6706
|
+
import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
|
|
6629
6707
|
|
|
6630
6708
|
// src/functions/get-env.ts
|
|
6631
6709
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -6645,9 +6723,9 @@ function logFetch(url) {
|
|
|
6645
6723
|
|
|
6646
6724
|
// src/blocks/form/form/form.tsx
|
|
6647
6725
|
function FormComponent(props) {
|
|
6648
|
-
const [formState, setFormState] =
|
|
6649
|
-
const [responseData, setResponseData] =
|
|
6650
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
6726
|
+
const [formState, setFormState] = createSignal13("unsubmitted");
|
|
6727
|
+
const [responseData, setResponseData] = createSignal13(null);
|
|
6728
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal13("");
|
|
6651
6729
|
function mergeNewRootState(newData) {
|
|
6652
6730
|
const combinedState = {
|
|
6653
6731
|
...props.builderContext.rootState,
|
|
@@ -7108,7 +7186,7 @@ var componentInfo18 = {
|
|
|
7108
7186
|
name: "image",
|
|
7109
7187
|
bubble: true,
|
|
7110
7188
|
type: "file",
|
|
7111
|
-
allowedFileTypes:
|
|
7189
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
7112
7190
|
required: true
|
|
7113
7191
|
}],
|
|
7114
7192
|
noWrap: true,
|
|
@@ -7143,14 +7221,14 @@ var componentInfo19 = {
|
|
|
7143
7221
|
inputs: [{
|
|
7144
7222
|
name: "video",
|
|
7145
7223
|
type: "file",
|
|
7146
|
-
allowedFileTypes:
|
|
7224
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
7147
7225
|
bubble: true,
|
|
7148
7226
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
7149
7227
|
required: true
|
|
7150
7228
|
}, {
|
|
7151
7229
|
name: "posterImage",
|
|
7152
7230
|
type: "file",
|
|
7153
|
-
allowedFileTypes:
|
|
7231
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
7154
7232
|
helperText: "Image to show before the video plays"
|
|
7155
7233
|
}, {
|
|
7156
7234
|
name: "autoPlay",
|
|
@@ -7219,9 +7297,9 @@ var componentInfo19 = {
|
|
|
7219
7297
|
};
|
|
7220
7298
|
|
|
7221
7299
|
// src/blocks/video/video.tsx
|
|
7222
|
-
import { Show as Show12, createMemo as
|
|
7300
|
+
import { Show as Show12, createMemo as createMemo14 } from "solid-js";
|
|
7223
7301
|
function Video(props) {
|
|
7224
|
-
const videoProps =
|
|
7302
|
+
const videoProps = createMemo14(() => {
|
|
7225
7303
|
return {
|
|
7226
7304
|
...props.autoPlay === true ? {
|
|
7227
7305
|
autoPlay: true
|
|
@@ -7240,7 +7318,7 @@ function Video(props) {
|
|
|
7240
7318
|
} : {}
|
|
7241
7319
|
};
|
|
7242
7320
|
});
|
|
7243
|
-
const spreadProps =
|
|
7321
|
+
const spreadProps = createMemo14(() => {
|
|
7244
7322
|
return {
|
|
7245
7323
|
...videoProps()
|
|
7246
7324
|
};
|
|
@@ -7376,7 +7454,7 @@ var createRegisterComponentMessage = (info) => ({
|
|
|
7376
7454
|
var serializeFn = (fnValue) => {
|
|
7377
7455
|
const fnStr = fnValue.toString().trim();
|
|
7378
7456
|
const isArrowWithoutParens = /^[a-zA-Z0-9_]+\s*=>/i.test(fnStr);
|
|
7379
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
7457
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("async") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
7380
7458
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
7381
7459
|
};
|
|
7382
7460
|
function serializeIncludingFunctions(info) {
|
|
@@ -7450,8 +7528,8 @@ import {
|
|
|
7450
7528
|
onMount as onMount6,
|
|
7451
7529
|
on as on3,
|
|
7452
7530
|
createEffect as createEffect3,
|
|
7453
|
-
createMemo as
|
|
7454
|
-
createSignal as
|
|
7531
|
+
createMemo as createMemo15,
|
|
7532
|
+
createSignal as createSignal15
|
|
7455
7533
|
} from "solid-js";
|
|
7456
7534
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
7457
7535
|
|
|
@@ -7461,7 +7539,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7461
7539
|
}
|
|
7462
7540
|
|
|
7463
7541
|
// src/constants/sdk-version.ts
|
|
7464
|
-
var SDK_VERSION = "3.0.
|
|
7542
|
+
var SDK_VERSION = "3.0.2";
|
|
7465
7543
|
|
|
7466
7544
|
// src/helpers/sdk-headers.ts
|
|
7467
7545
|
var getSdkHeaders = () => ({
|
|
@@ -7526,6 +7604,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
|
|
|
7526
7604
|
}
|
|
7527
7605
|
return _res;
|
|
7528
7606
|
}
|
|
7607
|
+
function unflatten(obj) {
|
|
7608
|
+
const result = {};
|
|
7609
|
+
for (const key in obj) {
|
|
7610
|
+
const parts = key.split(".");
|
|
7611
|
+
let current = result;
|
|
7612
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7613
|
+
const part = parts[i];
|
|
7614
|
+
if (i === parts.length - 1) {
|
|
7615
|
+
current[part] = obj[key];
|
|
7616
|
+
} else {
|
|
7617
|
+
current[part] = current[part] || {};
|
|
7618
|
+
current = current[part];
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
}
|
|
7622
|
+
return result;
|
|
7623
|
+
}
|
|
7529
7624
|
|
|
7530
7625
|
// src/types/api-version.ts
|
|
7531
7626
|
var DEFAULT_API_VERSION = "v3";
|
|
@@ -7590,7 +7685,7 @@ var generateContentUrl = (options) => {
|
|
|
7590
7685
|
url.searchParams.set("noTraverse", String(noTraverse));
|
|
7591
7686
|
url.searchParams.set("includeRefs", String(true));
|
|
7592
7687
|
const finalLocale = locale || userAttributes?.locale;
|
|
7593
|
-
let finalUserAttributes = userAttributes;
|
|
7688
|
+
let finalUserAttributes = userAttributes || {};
|
|
7594
7689
|
if (finalLocale) {
|
|
7595
7690
|
url.searchParams.set("locale", finalLocale);
|
|
7596
7691
|
finalUserAttributes = {
|
|
@@ -7628,11 +7723,15 @@ var generateContentUrl = (options) => {
|
|
|
7628
7723
|
...getBuilderSearchParamsFromWindow(),
|
|
7629
7724
|
...normalizeSearchParams(options.options || {})
|
|
7630
7725
|
};
|
|
7726
|
+
finalUserAttributes = {
|
|
7727
|
+
...finalUserAttributes,
|
|
7728
|
+
...getUserAttributesAsJSON(queryOptions)
|
|
7729
|
+
};
|
|
7631
7730
|
const flattened = flatten(queryOptions);
|
|
7632
7731
|
for (const key in flattened) {
|
|
7633
7732
|
url.searchParams.set(key, String(flattened[key]));
|
|
7634
7733
|
}
|
|
7635
|
-
if (finalUserAttributes) {
|
|
7734
|
+
if (Object.keys(finalUserAttributes).length > 0) {
|
|
7636
7735
|
url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
|
|
7637
7736
|
}
|
|
7638
7737
|
if (query) {
|
|
@@ -7645,6 +7744,28 @@ var generateContentUrl = (options) => {
|
|
|
7645
7744
|
}
|
|
7646
7745
|
return url;
|
|
7647
7746
|
};
|
|
7747
|
+
var getUserAttributesFromQueryOptions = (queryOptions) => {
|
|
7748
|
+
const newUserAttributes = {};
|
|
7749
|
+
for (const key in queryOptions) {
|
|
7750
|
+
if (key.startsWith("userAttributes.")) {
|
|
7751
|
+
newUserAttributes[key] = queryOptions[key];
|
|
7752
|
+
delete queryOptions[key];
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
return newUserAttributes;
|
|
7756
|
+
};
|
|
7757
|
+
var getUserAttributesAsJSON = (queryOptions) => {
|
|
7758
|
+
if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
|
|
7759
|
+
queryOptions["userAttributes.urlPath"] = window.location.pathname;
|
|
7760
|
+
queryOptions["userAttributes.host"] = window.location.host;
|
|
7761
|
+
const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
|
|
7762
|
+
const {
|
|
7763
|
+
userAttributes
|
|
7764
|
+
} = unflatten(queryOptionsForUserAttributes);
|
|
7765
|
+
return userAttributes;
|
|
7766
|
+
}
|
|
7767
|
+
return {};
|
|
7768
|
+
};
|
|
7648
7769
|
|
|
7649
7770
|
// src/functions/get-content/index.ts
|
|
7650
7771
|
var checkContentHasResults = (content) => "results" in content;
|
|
@@ -8179,6 +8300,12 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
8179
8300
|
};
|
|
8180
8301
|
};
|
|
8181
8302
|
|
|
8303
|
+
// src/components/content/components/enable-editor.helpers.ts
|
|
8304
|
+
var SDKS_USING_ELEMENT_REF_APPROACH = ["svelte", "qwik", "vue"];
|
|
8305
|
+
var needsElementRefDivForEditing = () => {
|
|
8306
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
8307
|
+
};
|
|
8308
|
+
|
|
8182
8309
|
// src/components/content/components/styles.helpers.ts
|
|
8183
8310
|
var getCssFromFont = (font) => {
|
|
8184
8311
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -8260,12 +8387,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
8260
8387
|
|
|
8261
8388
|
// src/components/content/components/enable-editor.tsx
|
|
8262
8389
|
function EnableEditor(props) {
|
|
8263
|
-
const [ContentWrapper, setContentWrapper] =
|
|
8390
|
+
const [ContentWrapper, setContentWrapper] = createSignal15(
|
|
8264
8391
|
props.contentWrapper || "div"
|
|
8265
8392
|
);
|
|
8266
|
-
const [httpReqsData, setHttpReqsData] =
|
|
8267
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
8268
|
-
const [clicked, setClicked] =
|
|
8393
|
+
const [httpReqsData, setHttpReqsData] = createSignal15({});
|
|
8394
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal15({});
|
|
8395
|
+
const [clicked, setClicked] = createSignal15(false);
|
|
8269
8396
|
function mergeNewRootState(newData) {
|
|
8270
8397
|
const combinedState = {
|
|
8271
8398
|
...props.builderContextSignal.rootState,
|
|
@@ -8299,7 +8426,7 @@ function EnableEditor(props) {
|
|
|
8299
8426
|
content: newContentValue
|
|
8300
8427
|
}));
|
|
8301
8428
|
}
|
|
8302
|
-
const showContentProps =
|
|
8429
|
+
const showContentProps = createMemo15(() => {
|
|
8303
8430
|
return props.showContent ? {} : {
|
|
8304
8431
|
hidden: true,
|
|
8305
8432
|
"aria-hidden": true
|
|
@@ -8425,8 +8552,10 @@ function EnableEditor(props) {
|
|
|
8425
8552
|
Object.values(
|
|
8426
8553
|
props.builderContextSignal.componentInfos
|
|
8427
8554
|
).forEach((registeredComponent) => {
|
|
8428
|
-
|
|
8429
|
-
|
|
8555
|
+
if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8556
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
8557
|
+
window.parent?.postMessage(message, "*");
|
|
8558
|
+
}
|
|
8430
8559
|
});
|
|
8431
8560
|
window.addEventListener(
|
|
8432
8561
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -8454,11 +8583,16 @@ function EnableEditor(props) {
|
|
|
8454
8583
|
`builder.overrides.${searchParamPreviewModel}`
|
|
8455
8584
|
);
|
|
8456
8585
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
8457
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8586
|
+
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8458
8587
|
fetchOneEntry({
|
|
8459
|
-
model: props.model,
|
|
8588
|
+
model: props.model || "",
|
|
8460
8589
|
apiKey: props.apiKey,
|
|
8461
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
8590
|
+
apiVersion: props.builderContextSignal.apiVersion,
|
|
8591
|
+
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
8592
|
+
query: {
|
|
8593
|
+
id: props.context.symbolId
|
|
8594
|
+
}
|
|
8595
|
+
} : {}
|
|
8462
8596
|
}).then((content) => {
|
|
8463
8597
|
if (content) {
|
|
8464
8598
|
mergeNewContent(content);
|
|
@@ -8468,14 +8602,14 @@ function EnableEditor(props) {
|
|
|
8468
8602
|
}
|
|
8469
8603
|
}
|
|
8470
8604
|
});
|
|
8471
|
-
const onUpdateFn_0_props_content =
|
|
8605
|
+
const onUpdateFn_0_props_content = createMemo15(() => props.content);
|
|
8472
8606
|
function onUpdateFn_0() {
|
|
8473
8607
|
if (props.content) {
|
|
8474
8608
|
mergeNewContent(props.content);
|
|
8475
8609
|
}
|
|
8476
8610
|
}
|
|
8477
8611
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8478
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
8612
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
|
|
8479
8613
|
() => props.builderContextSignal.rootState
|
|
8480
8614
|
);
|
|
8481
8615
|
function onUpdateFn_1() {
|
|
@@ -8487,14 +8621,14 @@ function EnableEditor(props) {
|
|
|
8487
8621
|
onUpdateFn_1
|
|
8488
8622
|
)
|
|
8489
8623
|
);
|
|
8490
|
-
const onUpdateFn_2_props_data =
|
|
8624
|
+
const onUpdateFn_2_props_data = createMemo15(() => props.data);
|
|
8491
8625
|
function onUpdateFn_2() {
|
|
8492
8626
|
if (props.data) {
|
|
8493
8627
|
mergeNewRootState(props.data);
|
|
8494
8628
|
}
|
|
8495
8629
|
}
|
|
8496
8630
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
8497
|
-
const onUpdateFn_3_props_locale =
|
|
8631
|
+
const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
|
|
8498
8632
|
function onUpdateFn_3() {
|
|
8499
8633
|
if (props.locale) {
|
|
8500
8634
|
mergeNewRootState({
|
|
@@ -8503,7 +8637,9 @@ function EnableEditor(props) {
|
|
|
8503
8637
|
}
|
|
8504
8638
|
}
|
|
8505
8639
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
8506
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
8640
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
|
|
8641
|
+
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
8642
|
+
><Dynamic5
|
|
8507
8643
|
class={getWrapperClassName(
|
|
8508
8644
|
props.content?.testVariationId || props.content?.id
|
|
8509
8645
|
)}
|
|
@@ -8512,6 +8648,9 @@ function EnableEditor(props) {
|
|
|
8512
8648
|
onClick={(event) => onClick(event)}
|
|
8513
8649
|
builder-content-id={props.builderContextSignal.content?.id}
|
|
8514
8650
|
builder-model={props.model}
|
|
8651
|
+
style={{
|
|
8652
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
8653
|
+
}}
|
|
8515
8654
|
{...{}}
|
|
8516
8655
|
{...showContentProps()}
|
|
8517
8656
|
{...props.contentWrapperProps}
|
|
@@ -8521,9 +8660,9 @@ function EnableEditor(props) {
|
|
|
8521
8660
|
var Enable_editor_default = EnableEditor;
|
|
8522
8661
|
|
|
8523
8662
|
// src/components/content/components/styles.tsx
|
|
8524
|
-
import { createSignal as
|
|
8663
|
+
import { createSignal as createSignal16 } from "solid-js";
|
|
8525
8664
|
function ContentStyles(props) {
|
|
8526
|
-
const [injectedStyles, setInjectedStyles] =
|
|
8665
|
+
const [injectedStyles, setInjectedStyles] = createSignal16(
|
|
8527
8666
|
`
|
|
8528
8667
|
${getCss({
|
|
8529
8668
|
cssCode: props.cssCode,
|
|
@@ -8581,7 +8720,7 @@ var getContentInitialValue = ({
|
|
|
8581
8720
|
|
|
8582
8721
|
// src/components/content/content.tsx
|
|
8583
8722
|
function ContentComponent(props) {
|
|
8584
|
-
const [scriptStr, setScriptStr] =
|
|
8723
|
+
const [scriptStr, setScriptStr] = createSignal17(
|
|
8585
8724
|
getUpdateVariantVisibilityScript({
|
|
8586
8725
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
8587
8726
|
variationId: props.content?.testVariationId,
|
|
@@ -8589,16 +8728,10 @@ function ContentComponent(props) {
|
|
|
8589
8728
|
contentId: props.content?.id
|
|
8590
8729
|
})
|
|
8591
8730
|
);
|
|
8592
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
8731
|
+
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
8593
8732
|
[
|
|
8594
8733
|
...getDefaultRegisteredComponents(),
|
|
8595
|
-
...props.customComponents
|
|
8596
|
-
if (!models?.length)
|
|
8597
|
-
return true;
|
|
8598
|
-
if (!props.model)
|
|
8599
|
-
return true;
|
|
8600
|
-
return models.includes(props.model);
|
|
8601
|
-
}) || []
|
|
8734
|
+
...props.customComponents || []
|
|
8602
8735
|
].reduce(
|
|
8603
8736
|
(acc, { component, ...info }) => ({
|
|
8604
8737
|
...acc,
|
|
@@ -8610,7 +8743,7 @@ function ContentComponent(props) {
|
|
|
8610
8743
|
{}
|
|
8611
8744
|
)
|
|
8612
8745
|
);
|
|
8613
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
8746
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal17({
|
|
8614
8747
|
content: getContentInitialValue({
|
|
8615
8748
|
content: props.content,
|
|
8616
8749
|
data: props.data
|
|
@@ -8628,13 +8761,7 @@ function ContentComponent(props) {
|
|
|
8628
8761
|
apiVersion: props.apiVersion,
|
|
8629
8762
|
componentInfos: [
|
|
8630
8763
|
...getDefaultRegisteredComponents(),
|
|
8631
|
-
...props.customComponents
|
|
8632
|
-
if (!models?.length)
|
|
8633
|
-
return true;
|
|
8634
|
-
if (!props.model)
|
|
8635
|
-
return true;
|
|
8636
|
-
return models.includes(props.model);
|
|
8637
|
-
}) || []
|
|
8764
|
+
...props.customComponents || []
|
|
8638
8765
|
].reduce(
|
|
8639
8766
|
(acc, { component: _, ...info }) => ({
|
|
8640
8767
|
...acc,
|
|
@@ -8645,7 +8772,8 @@ function ContentComponent(props) {
|
|
|
8645
8772
|
inheritedStyles: {},
|
|
8646
8773
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
8647
8774
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
8648
|
-
nonce: props.nonce || ""
|
|
8775
|
+
nonce: props.nonce || "",
|
|
8776
|
+
model: props.model || ""
|
|
8649
8777
|
});
|
|
8650
8778
|
function contentSetState(newRootState) {
|
|
8651
8779
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -8723,13 +8851,13 @@ var Content_default = ContentComponent;
|
|
|
8723
8851
|
|
|
8724
8852
|
// src/components/content-variants/content-variants.tsx
|
|
8725
8853
|
function ContentVariants(props) {
|
|
8726
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
8854
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
|
|
8727
8855
|
checkShouldRenderVariants({
|
|
8728
8856
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8729
8857
|
content: props.content
|
|
8730
8858
|
})
|
|
8731
8859
|
);
|
|
8732
|
-
const updateCookieAndStylesScriptStr =
|
|
8860
|
+
const updateCookieAndStylesScriptStr = createMemo18(() => {
|
|
8733
8861
|
return getUpdateCookieAndStylesScript(
|
|
8734
8862
|
getVariants(props.content).map((value) => ({
|
|
8735
8863
|
id: value.testVariationId,
|
|
@@ -8738,10 +8866,10 @@ function ContentVariants(props) {
|
|
|
8738
8866
|
props.content?.id || ""
|
|
8739
8867
|
);
|
|
8740
8868
|
});
|
|
8741
|
-
const hideVariantsStyleString =
|
|
8869
|
+
const hideVariantsStyleString = createMemo18(() => {
|
|
8742
8870
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8743
8871
|
});
|
|
8744
|
-
const defaultContent =
|
|
8872
|
+
const defaultContent = createMemo18(() => {
|
|
8745
8873
|
return shouldRenderVariants() ? {
|
|
8746
8874
|
...props.content,
|
|
8747
8875
|
testVariationId: props.content?.id
|
|
@@ -8853,14 +8981,14 @@ var fetchSymbolContent = async ({
|
|
|
8853
8981
|
|
|
8854
8982
|
// src/blocks/symbol/symbol.tsx
|
|
8855
8983
|
function Symbol2(props) {
|
|
8856
|
-
const [contentToUse, setContentToUse] =
|
|
8857
|
-
const blocksWrapper =
|
|
8984
|
+
const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
|
|
8985
|
+
const blocksWrapper = createMemo19(() => {
|
|
8858
8986
|
return "div";
|
|
8859
8987
|
});
|
|
8860
|
-
const contentWrapper =
|
|
8988
|
+
const contentWrapper = createMemo19(() => {
|
|
8861
8989
|
return "div";
|
|
8862
8990
|
});
|
|
8863
|
-
const className =
|
|
8991
|
+
const className = createMemo19(() => {
|
|
8864
8992
|
return [
|
|
8865
8993
|
...[props.attributes[getClassPropName()]],
|
|
8866
8994
|
"builder-symbol",
|
|
@@ -8882,7 +9010,7 @@ function Symbol2(props) {
|
|
|
8882
9010
|
}
|
|
8883
9011
|
onMount8(() => {
|
|
8884
9012
|
});
|
|
8885
|
-
const onUpdateFn_0_props_symbol =
|
|
9013
|
+
const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
|
|
8886
9014
|
function onUpdateFn_0() {
|
|
8887
9015
|
setContent();
|
|
8888
9016
|
}
|