@builder.io/sdk-solid 2.0.31 → 3.0.1
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 +5 -0
- package/lib/browser/dev.js +142 -59
- package/lib/browser/dev.jsx +143 -55
- package/lib/browser/index.js +139 -59
- package/lib/browser/index.jsx +142 -55
- package/lib/edge/dev.js +142 -59
- package/lib/edge/dev.jsx +143 -55
- package/lib/edge/index.js +139 -59
- package/lib/edge/index.jsx +142 -55
- package/lib/node/dev.js +142 -59
- package/lib/node/dev.jsx +143 -55
- package/lib/node/index.js +139 -59
- package/lib/node/index.jsx +142 -55
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -478,6 +478,9 @@ interface ComponentInfo {
|
|
|
478
478
|
*/
|
|
479
479
|
builderLinkComponent?: boolean;
|
|
480
480
|
};
|
|
481
|
+
meta?: {
|
|
482
|
+
[key: string]: any;
|
|
483
|
+
};
|
|
481
484
|
}
|
|
482
485
|
type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
|
|
483
486
|
|
|
@@ -524,6 +527,7 @@ interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrappe
|
|
|
524
527
|
componentInfos: Dictionary<ComponentInfo>;
|
|
525
528
|
inheritedStyles: Record<string, unknown>;
|
|
526
529
|
nonce: string;
|
|
530
|
+
model: string;
|
|
527
531
|
canTrack?: boolean;
|
|
528
532
|
}
|
|
529
533
|
|
|
@@ -761,6 +765,7 @@ declare const _default: solid_js.Context<{
|
|
|
761
765
|
BlocksWrapper: string;
|
|
762
766
|
BlocksWrapperProps: {};
|
|
763
767
|
nonce: string;
|
|
768
|
+
model: string;
|
|
764
769
|
}>;
|
|
765
770
|
|
|
766
771
|
type QueryObject = Record<string, string | string[]>;
|
package/lib/browser/dev.js
CHANGED
|
@@ -114,7 +114,8 @@ var builder_context_default = createContext({
|
|
|
114
114
|
inheritedStyles: {},
|
|
115
115
|
BlocksWrapper: "div",
|
|
116
116
|
BlocksWrapperProps: {},
|
|
117
|
-
nonce: ""
|
|
117
|
+
nonce: "",
|
|
118
|
+
model: ""
|
|
118
119
|
});
|
|
119
120
|
var components_context_default = createContext({ registeredComponents: {} });
|
|
120
121
|
|
|
@@ -401,6 +402,77 @@ function evaluate({
|
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
|
|
405
|
+
// src/functions/traverse.ts
|
|
406
|
+
function traverse(obj, callback, parent2 = null, key = null, visited = /* @__PURE__ */ new WeakSet()) {
|
|
407
|
+
if (obj == null || typeof obj !== "object") {
|
|
408
|
+
callback(obj, (newValue) => {
|
|
409
|
+
if (parent2 !== null && key !== null) {
|
|
410
|
+
parent2[key] = newValue;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (visited.has(obj)) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
visited.add(obj);
|
|
419
|
+
if (Array.isArray(obj)) {
|
|
420
|
+
obj.forEach((item, index) => {
|
|
421
|
+
const update = (newValue) => {
|
|
422
|
+
obj[index] = newValue;
|
|
423
|
+
};
|
|
424
|
+
callback(item, update);
|
|
425
|
+
traverse(item, callback, obj, index, visited);
|
|
426
|
+
});
|
|
427
|
+
} else {
|
|
428
|
+
Object.entries(obj).forEach(([key2, value]) => {
|
|
429
|
+
const update = (newValue) => {
|
|
430
|
+
obj[key2] = newValue;
|
|
431
|
+
};
|
|
432
|
+
callback(value, update);
|
|
433
|
+
traverse(value, callback, obj, key2, visited);
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// src/functions/extract-localized-values.ts
|
|
439
|
+
function isLocalizedField(value) {
|
|
440
|
+
return value && typeof value === "object" && value["@type"] === "@builder.io/core:LocalizedValue";
|
|
441
|
+
}
|
|
442
|
+
function containsLocalizedValues(data) {
|
|
443
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
let hasLocalizedValues = false;
|
|
447
|
+
traverse(data, (value) => {
|
|
448
|
+
if (isLocalizedField(value)) {
|
|
449
|
+
hasLocalizedValues = true;
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
return hasLocalizedValues;
|
|
454
|
+
}
|
|
455
|
+
function extractLocalizedValues(data, locale) {
|
|
456
|
+
if (!data || !Object.getOwnPropertyNames(data).length) {
|
|
457
|
+
return {};
|
|
458
|
+
}
|
|
459
|
+
traverse(data, (value, update) => {
|
|
460
|
+
if (isLocalizedField(value)) {
|
|
461
|
+
update(value[locale] ?? void 0);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
return data;
|
|
465
|
+
}
|
|
466
|
+
function resolveLocalizedValues(block, locale) {
|
|
467
|
+
if (block.component?.options && containsLocalizedValues(block.component?.options)) {
|
|
468
|
+
if (!locale) {
|
|
469
|
+
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");
|
|
470
|
+
}
|
|
471
|
+
block.component.options = extractLocalizedValues(block.component.options, locale ?? "Default");
|
|
472
|
+
}
|
|
473
|
+
return block;
|
|
474
|
+
}
|
|
475
|
+
|
|
404
476
|
// src/functions/fast-clone.ts
|
|
405
477
|
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
406
478
|
|
|
@@ -499,7 +571,8 @@ function getProcessedBlock({
|
|
|
499
571
|
rootState,
|
|
500
572
|
rootSetState
|
|
501
573
|
}) {
|
|
502
|
-
|
|
574
|
+
let transformedBlock = resolveLocalizedValues(block, rootState.locale);
|
|
575
|
+
transformedBlock = transformBlock(transformedBlock);
|
|
503
576
|
if (shouldEvaluateBindings) {
|
|
504
577
|
return evaluateBindings({
|
|
505
578
|
block: transformedBlock,
|
|
@@ -757,16 +830,24 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
757
830
|
}
|
|
758
831
|
|
|
759
832
|
// src/components/block/block.helpers.ts
|
|
833
|
+
var checkIsComponentRestricted = (component, model) => {
|
|
834
|
+
if (!component)
|
|
835
|
+
return true;
|
|
836
|
+
if (!model)
|
|
837
|
+
return false;
|
|
838
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
839
|
+
};
|
|
760
840
|
var getComponent = ({
|
|
761
841
|
block,
|
|
762
|
-
registeredComponents
|
|
842
|
+
registeredComponents,
|
|
843
|
+
model
|
|
763
844
|
}) => {
|
|
764
845
|
const componentName = block.component?.name;
|
|
765
846
|
if (!componentName) {
|
|
766
847
|
return null;
|
|
767
848
|
}
|
|
768
849
|
const ref = registeredComponents[componentName];
|
|
769
|
-
if (!ref) {
|
|
850
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
770
851
|
console.warn(`
|
|
771
852
|
Could not find a registered component named "${componentName}".
|
|
772
853
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -820,11 +901,15 @@ var provideLinkComponent = (block, linkComponent) => {
|
|
|
820
901
|
};
|
|
821
902
|
return {};
|
|
822
903
|
};
|
|
823
|
-
var provideRegisteredComponents = (block, registeredComponents) => {
|
|
824
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
904
|
+
var provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
905
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
906
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
907
|
+
return !checkIsComponentRestricted(component, model);
|
|
908
|
+
}));
|
|
825
909
|
return {
|
|
826
|
-
builderComponents:
|
|
910
|
+
builderComponents: filteredRegisteredComponents
|
|
827
911
|
};
|
|
912
|
+
}
|
|
828
913
|
return {};
|
|
829
914
|
};
|
|
830
915
|
var provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -1286,7 +1371,8 @@ function Block(props) {
|
|
|
1286
1371
|
const blockComponent = createMemo(() => {
|
|
1287
1372
|
return getComponent({
|
|
1288
1373
|
block: processedBlock(),
|
|
1289
|
-
registeredComponents: props.registeredComponents
|
|
1374
|
+
registeredComponents: props.registeredComponents,
|
|
1375
|
+
model: props.context.model
|
|
1290
1376
|
});
|
|
1291
1377
|
});
|
|
1292
1378
|
const Tag = createMemo(() => {
|
|
@@ -1319,7 +1405,7 @@ function Block(props) {
|
|
|
1319
1405
|
...provideBuilderBlock(blockComponent(), processedBlock()),
|
|
1320
1406
|
...provideBuilderContext(blockComponent(), props.context),
|
|
1321
1407
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
1322
|
-
...provideRegisteredComponents(blockComponent(), props.registeredComponents)
|
|
1408
|
+
...provideRegisteredComponents(blockComponent(), props.registeredComponents, props.context.model)
|
|
1323
1409
|
},
|
|
1324
1410
|
context: props.context,
|
|
1325
1411
|
linkComponent: props.linkComponent,
|
|
@@ -1917,16 +2003,16 @@ function getSrcSet(url) {
|
|
|
1917
2003
|
// src/blocks/image/image.tsx
|
|
1918
2004
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1919
2005
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1920
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1921
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1922
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
2006
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-070d7e88">`);
|
|
2007
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-070d7e88-2>`);
|
|
2008
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-070d7e88 {
|
|
1923
2009
|
opacity: 1;
|
|
1924
2010
|
transition: opacity 0.2s ease-in-out;
|
|
1925
|
-
}.div-
|
|
2011
|
+
}.div-070d7e88 {
|
|
1926
2012
|
width: 100%;
|
|
1927
2013
|
pointer-events: none;
|
|
1928
2014
|
font-size: 0;
|
|
1929
|
-
}.div-
|
|
2015
|
+
}.div-070d7e88-2 {
|
|
1930
2016
|
display: flex;
|
|
1931
2017
|
flex-direction: column;
|
|
1932
2018
|
align-items: stretch;
|
|
@@ -1942,7 +2028,7 @@ function Image(props) {
|
|
|
1942
2028
|
const url = imageToUse;
|
|
1943
2029
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
1944
2030
|
// images, otherwise you can supply this prop manually
|
|
1945
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
2031
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))) {
|
|
1946
2032
|
return props.srcset;
|
|
1947
2033
|
}
|
|
1948
2034
|
if (props.noWebp) {
|
|
@@ -1991,7 +2077,7 @@ function Image(props) {
|
|
|
1991
2077
|
}
|
|
1992
2078
|
}), _el$3);
|
|
1993
2079
|
effect((_p$) => {
|
|
1994
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
2080
|
+
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-070d7e88", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
|
|
1995
2081
|
"object-position": props.backgroundPosition || "center",
|
|
1996
2082
|
"object-fit": props.backgroundSize || "cover",
|
|
1997
2083
|
...aspectRatioCss()
|
|
@@ -2857,6 +2943,10 @@ var componentInfo4 = {
|
|
|
2857
2943
|
noWrap: true
|
|
2858
2944
|
};
|
|
2859
2945
|
|
|
2946
|
+
// src/constants/file-types.ts
|
|
2947
|
+
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"];
|
|
2948
|
+
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"];
|
|
2949
|
+
|
|
2860
2950
|
// src/blocks/image/component-info.ts
|
|
2861
2951
|
var componentInfo5 = {
|
|
2862
2952
|
name: "Image",
|
|
@@ -2873,7 +2963,7 @@ var componentInfo5 = {
|
|
|
2873
2963
|
name: "image",
|
|
2874
2964
|
type: "file",
|
|
2875
2965
|
bubble: true,
|
|
2876
|
-
allowedFileTypes:
|
|
2966
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
2877
2967
|
required: true,
|
|
2878
2968
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
2879
2969
|
onChange: (options) => {
|
|
@@ -4405,7 +4495,7 @@ var componentInfo18 = {
|
|
|
4405
4495
|
name: "image",
|
|
4406
4496
|
bubble: true,
|
|
4407
4497
|
type: "file",
|
|
4408
|
-
allowedFileTypes:
|
|
4498
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
4409
4499
|
required: true
|
|
4410
4500
|
}],
|
|
4411
4501
|
noWrap: true,
|
|
@@ -4449,14 +4539,14 @@ var componentInfo19 = {
|
|
|
4449
4539
|
inputs: [{
|
|
4450
4540
|
name: "video",
|
|
4451
4541
|
type: "file",
|
|
4452
|
-
allowedFileTypes:
|
|
4542
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
4453
4543
|
bubble: true,
|
|
4454
4544
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
4455
4545
|
required: true
|
|
4456
4546
|
}, {
|
|
4457
4547
|
name: "posterImage",
|
|
4458
4548
|
type: "file",
|
|
4459
|
-
allowedFileTypes:
|
|
4549
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
4460
4550
|
helperText: "Image to show before the video plays"
|
|
4461
4551
|
}, {
|
|
4462
4552
|
name: "autoPlay",
|
|
@@ -4712,7 +4802,7 @@ var createRegisterComponentMessage = (info) => ({
|
|
|
4712
4802
|
var serializeFn = (fnValue) => {
|
|
4713
4803
|
const fnStr = fnValue.toString().trim();
|
|
4714
4804
|
const isArrowWithoutParens = /^[a-zA-Z0-9_]+\s*=>/i.test(fnStr);
|
|
4715
|
-
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4805
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("async") && !fnStr.startsWith("(") && !isArrowWithoutParens;
|
|
4716
4806
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4717
4807
|
};
|
|
4718
4808
|
function serializeIncludingFunctions(info) {
|
|
@@ -4795,7 +4885,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4795
4885
|
}
|
|
4796
4886
|
|
|
4797
4887
|
// src/constants/sdk-version.ts
|
|
4798
|
-
var SDK_VERSION = "
|
|
4888
|
+
var SDK_VERSION = "3.0.1";
|
|
4799
4889
|
|
|
4800
4890
|
// src/helpers/sdk-headers.ts
|
|
4801
4891
|
var getSdkHeaders = () => ({
|
|
@@ -5036,22 +5126,17 @@ var _processContentResult = async (options, content, url = generateContentUrl(op
|
|
|
5036
5126
|
return content.results;
|
|
5037
5127
|
};
|
|
5038
5128
|
async function fetchEntries(options) {
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
return null;
|
|
5049
|
-
}
|
|
5050
|
-
return _processContentResult(options, content);
|
|
5051
|
-
} catch (error) {
|
|
5052
|
-
logger.error("Error fetching data. ", error);
|
|
5053
|
-
return null;
|
|
5129
|
+
const url = generateContentUrl(options);
|
|
5130
|
+
const content = await _fetchContent(options);
|
|
5131
|
+
if (!checkContentHasResults(content)) {
|
|
5132
|
+
logger.error("Error fetching data. ", {
|
|
5133
|
+
url,
|
|
5134
|
+
content,
|
|
5135
|
+
options
|
|
5136
|
+
});
|
|
5137
|
+
throw content;
|
|
5054
5138
|
}
|
|
5139
|
+
return _processContentResult(options, content);
|
|
5055
5140
|
}
|
|
5056
5141
|
|
|
5057
5142
|
// src/functions/is-previewing.ts
|
|
@@ -5518,6 +5603,12 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5518
5603
|
};
|
|
5519
5604
|
};
|
|
5520
5605
|
|
|
5606
|
+
// src/components/content/components/enable-editor.helpers.ts
|
|
5607
|
+
var SDKS_USING_ELEMENT_REF_APPROACH = ["svelte", "qwik", "vue"];
|
|
5608
|
+
var needsElementRefDivForEditing = () => {
|
|
5609
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
5610
|
+
};
|
|
5611
|
+
|
|
5521
5612
|
// src/components/content/components/styles.helpers.ts
|
|
5522
5613
|
var getCssFromFont = (font) => {
|
|
5523
5614
|
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
@@ -5753,8 +5844,10 @@ function EnableEditor(props) {
|
|
|
5753
5844
|
} : {}
|
|
5754
5845
|
});
|
|
5755
5846
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
5756
|
-
|
|
5757
|
-
|
|
5847
|
+
if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5848
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
5849
|
+
window.parent?.postMessage(message, "*");
|
|
5850
|
+
}
|
|
5758
5851
|
});
|
|
5759
5852
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
|
|
5760
5853
|
}
|
|
@@ -5826,7 +5919,7 @@ function EnableEditor(props) {
|
|
|
5826
5919
|
get children() {
|
|
5827
5920
|
return createComponent(Show, {
|
|
5828
5921
|
get when() {
|
|
5829
|
-
return props.builderContextSignal.content;
|
|
5922
|
+
return props.builderContextSignal.content || needsElementRefDivForEditing();
|
|
5830
5923
|
},
|
|
5831
5924
|
get children() {
|
|
5832
5925
|
return createComponent(Dynamic, mergeProps({
|
|
@@ -5844,6 +5937,11 @@ function EnableEditor(props) {
|
|
|
5844
5937
|
},
|
|
5845
5938
|
get ["builder-model"]() {
|
|
5846
5939
|
return props.model;
|
|
5940
|
+
},
|
|
5941
|
+
get style() {
|
|
5942
|
+
return {
|
|
5943
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
5944
|
+
};
|
|
5847
5945
|
}
|
|
5848
5946
|
}, {}, showContentProps, () => props.contentWrapperProps, {
|
|
5849
5947
|
get component() {
|
|
@@ -5926,15 +6024,7 @@ function ContentComponent(props) {
|
|
|
5926
6024
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5927
6025
|
contentId: props.content?.id
|
|
5928
6026
|
}));
|
|
5929
|
-
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5930
|
-
models
|
|
5931
|
-
}) => {
|
|
5932
|
-
if (!models?.length)
|
|
5933
|
-
return true;
|
|
5934
|
-
if (!props.model)
|
|
5935
|
-
return true;
|
|
5936
|
-
return models.includes(props.model);
|
|
5937
|
-
}) || []].reduce((acc, {
|
|
6027
|
+
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
|
|
5938
6028
|
component,
|
|
5939
6029
|
...info
|
|
5940
6030
|
}) => ({
|
|
@@ -5960,15 +6050,7 @@ function ContentComponent(props) {
|
|
|
5960
6050
|
canTrack: props.canTrack,
|
|
5961
6051
|
apiKey: props.apiKey,
|
|
5962
6052
|
apiVersion: props.apiVersion,
|
|
5963
|
-
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5964
|
-
models
|
|
5965
|
-
}) => {
|
|
5966
|
-
if (!models?.length)
|
|
5967
|
-
return true;
|
|
5968
|
-
if (!props.model)
|
|
5969
|
-
return true;
|
|
5970
|
-
return models.includes(props.model);
|
|
5971
|
-
}) || []].reduce((acc, {
|
|
6053
|
+
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
|
|
5972
6054
|
component: _,
|
|
5973
6055
|
...info
|
|
5974
6056
|
}) => ({
|
|
@@ -5978,7 +6060,8 @@ function ContentComponent(props) {
|
|
|
5978
6060
|
inheritedStyles: {},
|
|
5979
6061
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
5980
6062
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
5981
|
-
nonce: props.nonce || ""
|
|
6063
|
+
nonce: props.nonce || "",
|
|
6064
|
+
model: props.model || ""
|
|
5982
6065
|
});
|
|
5983
6066
|
function contentSetState(newRootState) {
|
|
5984
6067
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|