@builder.io/sdk-solid 3.0.7 → 4.0.0
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 +15 -15
- package/lib/browser/dev.js +66 -32
- package/lib/browser/dev.jsx +70 -20
- package/lib/browser/index.js +65 -32
- package/lib/browser/index.jsx +69 -20
- package/lib/edge/dev.js +66 -32
- package/lib/edge/dev.jsx +70 -20
- package/lib/edge/index.js +65 -32
- package/lib/edge/index.jsx +69 -20
- package/lib/node/dev.js +66 -32
- package/lib/node/dev.jsx +70 -20
- package/lib/node/index.js +65 -32
- package/lib/node/index.jsx +69 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -683,11 +683,11 @@ interface ContentVariantsPrps extends ExtraFrameworkProps {
|
|
|
683
683
|
/**
|
|
684
684
|
* The Builder content JSON to render (required).
|
|
685
685
|
*/
|
|
686
|
-
content
|
|
686
|
+
content: Nullable<BuilderContent>;
|
|
687
687
|
/**
|
|
688
688
|
* The Builder content `model` to render (required).
|
|
689
689
|
*/
|
|
690
|
-
model
|
|
690
|
+
model: string;
|
|
691
691
|
/**
|
|
692
692
|
* Additional data to inject into your Builder content (optional).
|
|
693
693
|
*/
|
|
@@ -876,19 +876,19 @@ type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | '
|
|
|
876
876
|
};
|
|
877
877
|
declare const track: (args: EventProperties) => Promise<void | Response>;
|
|
878
878
|
|
|
879
|
-
type SubscribeToEditor = (
|
|
880
|
-
/**
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
model: string
|
|
884
|
-
/**
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
879
|
+
type SubscribeToEditor = ({ model, apiKey, callback, trustedHosts }: {
|
|
880
|
+
/**
|
|
881
|
+
* The Builder `model` to subscribe to
|
|
882
|
+
*/
|
|
883
|
+
model: string;
|
|
884
|
+
/**
|
|
885
|
+
* Builder API Key to use for the editor.
|
|
886
|
+
*/
|
|
887
|
+
apiKey: string;
|
|
888
|
+
/**
|
|
889
|
+
* The callback function to call when the content is updated.
|
|
890
|
+
*/
|
|
891
|
+
callback: (updatedContent: BuilderContent) => void;
|
|
892
892
|
/**
|
|
893
893
|
* List of hosts to allow editing content from.
|
|
894
894
|
*/
|
package/lib/browser/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo
|
|
1
|
+
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic, memo } from 'solid-js/web';
|
|
2
2
|
import { createContext, useContext, Show, For, createMemo, createSignal, onMount, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/blocks/button/button.tsx
|
|
@@ -5053,10 +5053,10 @@ var componentInfo20 = {
|
|
|
5053
5053
|
builderBlock: true
|
|
5054
5054
|
}
|
|
5055
5055
|
};
|
|
5056
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5057
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5058
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5056
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5057
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5059
5058
|
function Video(props) {
|
|
5059
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5060
5060
|
const videoProps = createMemo(() => {
|
|
5061
5061
|
return {
|
|
5062
5062
|
...props.autoPlay === true ? {
|
|
@@ -5081,12 +5081,42 @@ function Video(props) {
|
|
|
5081
5081
|
...videoProps()
|
|
5082
5082
|
};
|
|
5083
5083
|
});
|
|
5084
|
+
let videoRef;
|
|
5085
|
+
onMount(() => {
|
|
5086
|
+
if (props.lazyLoad) {
|
|
5087
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5088
|
+
entries.forEach(function(entry) {
|
|
5089
|
+
if (!entry.isIntersecting)
|
|
5090
|
+
return;
|
|
5091
|
+
const videoElement = entry.target;
|
|
5092
|
+
try {
|
|
5093
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5094
|
+
const src = source.dataset.src;
|
|
5095
|
+
if (src) {
|
|
5096
|
+
source.src = src;
|
|
5097
|
+
}
|
|
5098
|
+
});
|
|
5099
|
+
videoElement.load();
|
|
5100
|
+
oberver.unobserve(videoElement);
|
|
5101
|
+
} catch (error) {
|
|
5102
|
+
console.error("Error loading lazy video:", error);
|
|
5103
|
+
}
|
|
5104
|
+
});
|
|
5105
|
+
});
|
|
5106
|
+
if (videoRef) {
|
|
5107
|
+
oberver.observe(videoRef);
|
|
5108
|
+
}
|
|
5109
|
+
setLazyVideoObserver(oberver);
|
|
5110
|
+
}
|
|
5111
|
+
});
|
|
5084
5112
|
return (() => {
|
|
5085
|
-
const _el$ = _tmpl$
|
|
5113
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5086
5114
|
_el$.style.setProperty("position", "relative");
|
|
5115
|
+
const _ref$ = videoRef;
|
|
5116
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5087
5117
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5088
5118
|
get preload() {
|
|
5089
|
-
return props.preload || "metadata";
|
|
5119
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5090
5120
|
},
|
|
5091
5121
|
get style() {
|
|
5092
5122
|
return {
|
|
@@ -5103,29 +5133,21 @@ function Video(props) {
|
|
|
5103
5133
|
} : null
|
|
5104
5134
|
};
|
|
5105
5135
|
},
|
|
5106
|
-
get src() {
|
|
5107
|
-
return props.video || "no-src";
|
|
5108
|
-
},
|
|
5109
5136
|
get poster() {
|
|
5110
5137
|
return props.posterImage;
|
|
5111
5138
|
}
|
|
5112
5139
|
}), false, true);
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
const _el$3 = _tmpl$21();
|
|
5119
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5120
|
-
return _el$3;
|
|
5121
|
-
}
|
|
5122
|
-
}));
|
|
5140
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5141
|
+
"data-src": props.video
|
|
5142
|
+
} : {
|
|
5143
|
+
src: props.video
|
|
5144
|
+
}), false, false);
|
|
5123
5145
|
insert(_el$, createComponent(Show, {
|
|
5124
5146
|
get when() {
|
|
5125
5147
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5126
5148
|
},
|
|
5127
5149
|
get children() {
|
|
5128
|
-
const _el$4 = _tmpl$
|
|
5150
|
+
const _el$4 = _tmpl$21();
|
|
5129
5151
|
_el$4.style.setProperty("width", "100%");
|
|
5130
5152
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5131
5153
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5138,7 +5160,7 @@ function Video(props) {
|
|
|
5138
5160
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5139
5161
|
},
|
|
5140
5162
|
get children() {
|
|
5141
|
-
const _el$5 = _tmpl$
|
|
5163
|
+
const _el$5 = _tmpl$21();
|
|
5142
5164
|
_el$5.style.setProperty("display", "flex");
|
|
5143
5165
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5144
5166
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5151,7 +5173,7 @@ function Video(props) {
|
|
|
5151
5173
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5152
5174
|
},
|
|
5153
5175
|
get children() {
|
|
5154
|
-
const _el$6 = _tmpl$
|
|
5176
|
+
const _el$6 = _tmpl$21();
|
|
5155
5177
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5156
5178
|
_el$6.style.setProperty("display", "flex");
|
|
5157
5179
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5308,7 +5330,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5308
5330
|
}
|
|
5309
5331
|
|
|
5310
5332
|
// src/constants/sdk-version.ts
|
|
5311
|
-
var SDK_VERSION = "
|
|
5333
|
+
var SDK_VERSION = "4.0.0";
|
|
5312
5334
|
|
|
5313
5335
|
// src/helpers/sdk-headers.ts
|
|
5314
5336
|
var getSdkHeaders = () => ({
|
|
@@ -5916,7 +5938,7 @@ var registerInsertMenu = () => {
|
|
|
5916
5938
|
});
|
|
5917
5939
|
};
|
|
5918
5940
|
var isSetupForEditing = false;
|
|
5919
|
-
var setupBrowserForEditing = (options
|
|
5941
|
+
var setupBrowserForEditing = (options) => {
|
|
5920
5942
|
if (isSetupForEditing) {
|
|
5921
5943
|
return;
|
|
5922
5944
|
}
|
|
@@ -5932,6 +5954,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5932
5954
|
// scope our '+ add block' button styling
|
|
5933
5955
|
supportsAddBlockScoping: true,
|
|
5934
5956
|
supportsCustomBreakpoints: true,
|
|
5957
|
+
modelName: options.modelName,
|
|
5958
|
+
apiKey: options.apiKey,
|
|
5935
5959
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5936
5960
|
blockLevelPersonalization: true
|
|
5937
5961
|
}
|
|
@@ -6037,13 +6061,21 @@ var createEditorListener = ({
|
|
|
6037
6061
|
}
|
|
6038
6062
|
};
|
|
6039
6063
|
};
|
|
6040
|
-
var subscribeToEditor = (
|
|
6064
|
+
var subscribeToEditor = ({
|
|
6065
|
+
model,
|
|
6066
|
+
apiKey,
|
|
6067
|
+
callback,
|
|
6068
|
+
trustedHosts
|
|
6069
|
+
}) => {
|
|
6041
6070
|
if (!isBrowser) {
|
|
6042
6071
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6043
6072
|
return () => {
|
|
6044
6073
|
};
|
|
6045
6074
|
}
|
|
6046
|
-
setupBrowserForEditing(
|
|
6075
|
+
setupBrowserForEditing({
|
|
6076
|
+
modelName: model,
|
|
6077
|
+
apiKey
|
|
6078
|
+
});
|
|
6047
6079
|
const listener = createEditorListener({
|
|
6048
6080
|
callbacks: {
|
|
6049
6081
|
contentUpdate: callback,
|
|
@@ -6053,7 +6085,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
6053
6085
|
}
|
|
6054
6086
|
},
|
|
6055
6087
|
model,
|
|
6056
|
-
trustedHosts
|
|
6088
|
+
trustedHosts
|
|
6057
6089
|
});
|
|
6058
6090
|
window.addEventListener("message", listener);
|
|
6059
6091
|
return () => {
|
|
@@ -6299,10 +6331,12 @@ function EnableEditor(props) {
|
|
|
6299
6331
|
} : {},
|
|
6300
6332
|
...props.trustedHosts ? {
|
|
6301
6333
|
trustedHosts: props.trustedHosts
|
|
6302
|
-
} : {}
|
|
6334
|
+
} : {},
|
|
6335
|
+
modelName: props.model ?? "",
|
|
6336
|
+
apiKey: props.apiKey
|
|
6303
6337
|
});
|
|
6304
6338
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6305
|
-
if (!
|
|
6339
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6306
6340
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6307
6341
|
window.parent?.postMessage(message, "*");
|
|
6308
6342
|
}
|
|
@@ -6330,7 +6364,7 @@ function EnableEditor(props) {
|
|
|
6330
6364
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6331
6365
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6332
6366
|
fetchOneEntry({
|
|
6333
|
-
model: props.model
|
|
6367
|
+
model: props.model,
|
|
6334
6368
|
apiKey: props.apiKey,
|
|
6335
6369
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6336
6370
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6524,7 +6558,7 @@ function ContentComponent(props) {
|
|
|
6524
6558
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6525
6559
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6526
6560
|
nonce: props.nonce || "",
|
|
6527
|
-
model: props.model
|
|
6561
|
+
model: props.model
|
|
6528
6562
|
});
|
|
6529
6563
|
function contentSetState(newRootState) {
|
|
6530
6564
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6965,7 +6999,7 @@ function Symbol(props) {
|
|
|
6965
6999
|
return props.builderContext.canTrack;
|
|
6966
7000
|
},
|
|
6967
7001
|
get model() {
|
|
6968
|
-
return props.symbol?.model;
|
|
7002
|
+
return props.symbol?.model ?? "";
|
|
6969
7003
|
},
|
|
6970
7004
|
get content() {
|
|
6971
7005
|
return contentToUse();
|
package/lib/browser/dev.jsx
CHANGED
|
@@ -1916,10 +1916,10 @@ function SectionComponent(props) {
|
|
|
1916
1916
|
var section_default = SectionComponent;
|
|
1917
1917
|
|
|
1918
1918
|
// src/blocks/symbol/symbol.tsx
|
|
1919
|
-
import { onMount as
|
|
1919
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1920
1920
|
|
|
1921
1921
|
// src/components/content-variants/content-variants.tsx
|
|
1922
|
-
import { Show as Show16, For as For9, onMount as
|
|
1922
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1923
1923
|
|
|
1924
1924
|
// src/helpers/url.ts
|
|
1925
1925
|
var getTopLevelDomain = (host) => {
|
|
@@ -4565,8 +4565,9 @@ var componentInfo20 = {
|
|
|
4565
4565
|
};
|
|
4566
4566
|
|
|
4567
4567
|
// src/blocks/video/video.tsx
|
|
4568
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4568
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4569
4569
|
function Video(props) {
|
|
4570
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4570
4571
|
const videoProps = createMemo15(() => {
|
|
4571
4572
|
return {
|
|
4572
4573
|
...props.autoPlay === true ? {
|
|
@@ -4591,6 +4592,36 @@ function Video(props) {
|
|
|
4591
4592
|
...videoProps()
|
|
4592
4593
|
};
|
|
4593
4594
|
});
|
|
4595
|
+
let videoRef;
|
|
4596
|
+
onMount6(() => {
|
|
4597
|
+
if (props.lazyLoad) {
|
|
4598
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4599
|
+
entries.forEach(function(entry) {
|
|
4600
|
+
if (!entry.isIntersecting)
|
|
4601
|
+
return;
|
|
4602
|
+
const videoElement = entry.target;
|
|
4603
|
+
try {
|
|
4604
|
+
Array.from(videoElement.children).filter(
|
|
4605
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4606
|
+
).forEach((source) => {
|
|
4607
|
+
const src = source.dataset.src;
|
|
4608
|
+
if (src) {
|
|
4609
|
+
source.src = src;
|
|
4610
|
+
}
|
|
4611
|
+
});
|
|
4612
|
+
videoElement.load();
|
|
4613
|
+
oberver.unobserve(videoElement);
|
|
4614
|
+
} catch (error) {
|
|
4615
|
+
console.error("Error loading lazy video:", error);
|
|
4616
|
+
}
|
|
4617
|
+
});
|
|
4618
|
+
});
|
|
4619
|
+
if (videoRef) {
|
|
4620
|
+
oberver.observe(videoRef);
|
|
4621
|
+
}
|
|
4622
|
+
setLazyVideoObserver(oberver);
|
|
4623
|
+
}
|
|
4624
|
+
});
|
|
4594
4625
|
return <><div
|
|
4595
4626
|
style={{
|
|
4596
4627
|
position: "relative"
|
|
@@ -4599,7 +4630,8 @@ function Video(props) {
|
|
|
4599
4630
|
<video
|
|
4600
4631
|
class="builder-video"
|
|
4601
4632
|
{...spreadProps()}
|
|
4602
|
-
|
|
4633
|
+
ref={videoRef}
|
|
4634
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4603
4635
|
style={{
|
|
4604
4636
|
width: "100%",
|
|
4605
4637
|
height: "100%",
|
|
@@ -4613,9 +4645,15 @@ function Video(props) {
|
|
|
4613
4645
|
position: "absolute"
|
|
4614
4646
|
} : null
|
|
4615
4647
|
}}
|
|
4616
|
-
src={props.video || "no-src"}
|
|
4617
4648
|
poster={props.posterImage}
|
|
4618
|
-
><
|
|
4649
|
+
><source
|
|
4650
|
+
type="video/mp4"
|
|
4651
|
+
{...props.lazyLoad ? {
|
|
4652
|
+
"data-src": props.video
|
|
4653
|
+
} : {
|
|
4654
|
+
src: props.video
|
|
4655
|
+
}}
|
|
4656
|
+
/></video>
|
|
4619
4657
|
<Show13
|
|
4620
4658
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4621
4659
|
><div
|
|
@@ -4785,7 +4823,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4785
4823
|
// src/components/content/components/enable-editor.tsx
|
|
4786
4824
|
import {
|
|
4787
4825
|
Show as Show14,
|
|
4788
|
-
onMount as
|
|
4826
|
+
onMount as onMount7,
|
|
4789
4827
|
on as on3,
|
|
4790
4828
|
createEffect as createEffect3,
|
|
4791
4829
|
createMemo as createMemo16,
|
|
@@ -4799,7 +4837,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4799
4837
|
}
|
|
4800
4838
|
|
|
4801
4839
|
// src/constants/sdk-version.ts
|
|
4802
|
-
var SDK_VERSION = "
|
|
4840
|
+
var SDK_VERSION = "4.0.0";
|
|
4803
4841
|
|
|
4804
4842
|
// src/helpers/sdk-headers.ts
|
|
4805
4843
|
var getSdkHeaders = () => ({
|
|
@@ -5407,7 +5445,7 @@ var registerInsertMenu = () => {
|
|
|
5407
5445
|
});
|
|
5408
5446
|
};
|
|
5409
5447
|
var isSetupForEditing = false;
|
|
5410
|
-
var setupBrowserForEditing = (options
|
|
5448
|
+
var setupBrowserForEditing = (options) => {
|
|
5411
5449
|
if (isSetupForEditing) {
|
|
5412
5450
|
return;
|
|
5413
5451
|
}
|
|
@@ -5423,6 +5461,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5423
5461
|
// scope our '+ add block' button styling
|
|
5424
5462
|
supportsAddBlockScoping: true,
|
|
5425
5463
|
supportsCustomBreakpoints: true,
|
|
5464
|
+
modelName: options.modelName,
|
|
5465
|
+
apiKey: options.apiKey,
|
|
5426
5466
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5427
5467
|
blockLevelPersonalization: true
|
|
5428
5468
|
}
|
|
@@ -5528,13 +5568,21 @@ var createEditorListener = ({
|
|
|
5528
5568
|
}
|
|
5529
5569
|
};
|
|
5530
5570
|
};
|
|
5531
|
-
var subscribeToEditor = (
|
|
5571
|
+
var subscribeToEditor = ({
|
|
5572
|
+
model,
|
|
5573
|
+
apiKey,
|
|
5574
|
+
callback,
|
|
5575
|
+
trustedHosts
|
|
5576
|
+
}) => {
|
|
5532
5577
|
if (!isBrowser) {
|
|
5533
5578
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5534
5579
|
return () => {
|
|
5535
5580
|
};
|
|
5536
5581
|
}
|
|
5537
|
-
setupBrowserForEditing(
|
|
5582
|
+
setupBrowserForEditing({
|
|
5583
|
+
modelName: model,
|
|
5584
|
+
apiKey
|
|
5585
|
+
});
|
|
5538
5586
|
const listener = createEditorListener({
|
|
5539
5587
|
callbacks: {
|
|
5540
5588
|
contentUpdate: callback,
|
|
@@ -5544,7 +5592,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5544
5592
|
}
|
|
5545
5593
|
},
|
|
5546
5594
|
model,
|
|
5547
|
-
trustedHosts
|
|
5595
|
+
trustedHosts
|
|
5548
5596
|
});
|
|
5549
5597
|
window.addEventListener("message", listener);
|
|
5550
5598
|
return () => {
|
|
@@ -5785,7 +5833,7 @@ function EnableEditor(props) {
|
|
|
5785
5833
|
let elementRef;
|
|
5786
5834
|
runHttpRequests();
|
|
5787
5835
|
emitStateUpdate();
|
|
5788
|
-
|
|
5836
|
+
onMount7(() => {
|
|
5789
5837
|
if (isBrowser()) {
|
|
5790
5838
|
if (isEditing() && !props.isNestedRender) {
|
|
5791
5839
|
window.addEventListener("message", processMessage);
|
|
@@ -5799,12 +5847,14 @@ function EnableEditor(props) {
|
|
|
5799
5847
|
} : {},
|
|
5800
5848
|
...props.trustedHosts ? {
|
|
5801
5849
|
trustedHosts: props.trustedHosts
|
|
5802
|
-
} : {}
|
|
5850
|
+
} : {},
|
|
5851
|
+
modelName: props.model ?? "",
|
|
5852
|
+
apiKey: props.apiKey
|
|
5803
5853
|
});
|
|
5804
5854
|
Object.values(
|
|
5805
5855
|
props.builderContextSignal.componentInfos
|
|
5806
5856
|
).forEach((registeredComponent) => {
|
|
5807
|
-
if (!
|
|
5857
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5808
5858
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5809
5859
|
window.parent?.postMessage(message, "*");
|
|
5810
5860
|
}
|
|
@@ -5837,7 +5887,7 @@ function EnableEditor(props) {
|
|
|
5837
5887
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5838
5888
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5839
5889
|
fetchOneEntry({
|
|
5840
|
-
model: props.model
|
|
5890
|
+
model: props.model,
|
|
5841
5891
|
apiKey: props.apiKey,
|
|
5842
5892
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
5843
5893
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6025,7 +6075,7 @@ function ContentComponent(props) {
|
|
|
6025
6075
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6026
6076
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6027
6077
|
nonce: props.nonce || "",
|
|
6028
|
-
model: props.model
|
|
6078
|
+
model: props.model
|
|
6029
6079
|
});
|
|
6030
6080
|
function contentSetState(newRootState) {
|
|
6031
6081
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6130,7 +6180,7 @@ function ContentVariants(props) {
|
|
|
6130
6180
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6131
6181
|
});
|
|
6132
6182
|
});
|
|
6133
|
-
|
|
6183
|
+
onMount8(() => {
|
|
6134
6184
|
setShouldRenderVariants(false);
|
|
6135
6185
|
});
|
|
6136
6186
|
return <><>
|
|
@@ -6260,7 +6310,7 @@ function Symbol(props) {
|
|
|
6260
6310
|
}
|
|
6261
6311
|
});
|
|
6262
6312
|
}
|
|
6263
|
-
|
|
6313
|
+
onMount9(() => {
|
|
6264
6314
|
});
|
|
6265
6315
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6266
6316
|
function onUpdateFn_0() {
|
|
@@ -6283,7 +6333,7 @@ function Symbol(props) {
|
|
|
6283
6333
|
...contentToUse()?.data?.state
|
|
6284
6334
|
}}
|
|
6285
6335
|
canTrack={props.builderContext.canTrack}
|
|
6286
|
-
model={props.symbol?.model}
|
|
6336
|
+
model={props.symbol?.model ?? ""}
|
|
6287
6337
|
content={contentToUse()}
|
|
6288
6338
|
linkComponent={props.builderLinkComponent}
|
|
6289
6339
|
blocksWrapper={blocksWrapper()}
|