@builder.io/sdk-solid 3.0.7 → 4.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 +15 -15
- package/lib/browser/dev.js +80 -32
- package/lib/browser/dev.jsx +84 -20
- package/lib/browser/index.js +79 -32
- package/lib/browser/index.jsx +83 -20
- package/lib/edge/dev.js +80 -32
- package/lib/edge/dev.jsx +84 -20
- package/lib/edge/index.js +79 -32
- package/lib/edge/index.jsx +83 -20
- package/lib/node/dev.js +80 -32
- package/lib/node/dev.jsx +84 -20
- package/lib/node/index.js +79 -32
- package/lib/node/index.jsx +83 -20
- package/package.json +1 -1
package/lib/browser/index.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
|
|
@@ -5040,10 +5040,10 @@ var componentInfo20 = {
|
|
|
5040
5040
|
builderBlock: true
|
|
5041
5041
|
}
|
|
5042
5042
|
};
|
|
5043
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5044
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5045
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5043
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5044
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5046
5045
|
function Video(props) {
|
|
5046
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5047
5047
|
const videoProps = createMemo(() => {
|
|
5048
5048
|
return {
|
|
5049
5049
|
...props.autoPlay === true ? {
|
|
@@ -5068,12 +5068,41 @@ function Video(props) {
|
|
|
5068
5068
|
...videoProps()
|
|
5069
5069
|
};
|
|
5070
5070
|
});
|
|
5071
|
+
let videoRef;
|
|
5072
|
+
onMount(() => {
|
|
5073
|
+
if (props.lazyLoad) {
|
|
5074
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5075
|
+
entries.forEach(function(entry) {
|
|
5076
|
+
if (!entry.isIntersecting)
|
|
5077
|
+
return;
|
|
5078
|
+
const videoElement = entry.target;
|
|
5079
|
+
try {
|
|
5080
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5081
|
+
const src = source.dataset.src;
|
|
5082
|
+
if (src) {
|
|
5083
|
+
source.src = src;
|
|
5084
|
+
}
|
|
5085
|
+
});
|
|
5086
|
+
videoElement.load();
|
|
5087
|
+
oberver.unobserve(videoElement);
|
|
5088
|
+
} catch (error) {
|
|
5089
|
+
}
|
|
5090
|
+
});
|
|
5091
|
+
});
|
|
5092
|
+
if (videoRef) {
|
|
5093
|
+
oberver.observe(videoRef);
|
|
5094
|
+
}
|
|
5095
|
+
setLazyVideoObserver(oberver);
|
|
5096
|
+
}
|
|
5097
|
+
});
|
|
5071
5098
|
return (() => {
|
|
5072
|
-
const _el$ = _tmpl$
|
|
5099
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5073
5100
|
_el$.style.setProperty("position", "relative");
|
|
5101
|
+
const _ref$ = videoRef;
|
|
5102
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5074
5103
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5075
5104
|
get preload() {
|
|
5076
|
-
return props.preload || "metadata";
|
|
5105
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5077
5106
|
},
|
|
5078
5107
|
get style() {
|
|
5079
5108
|
return {
|
|
@@ -5090,29 +5119,21 @@ function Video(props) {
|
|
|
5090
5119
|
} : null
|
|
5091
5120
|
};
|
|
5092
5121
|
},
|
|
5093
|
-
get src() {
|
|
5094
|
-
return props.video || "no-src";
|
|
5095
|
-
},
|
|
5096
5122
|
get poster() {
|
|
5097
5123
|
return props.posterImage;
|
|
5098
5124
|
}
|
|
5099
5125
|
}), false, true);
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
const _el$3 = _tmpl$21();
|
|
5106
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5107
|
-
return _el$3;
|
|
5108
|
-
}
|
|
5109
|
-
}));
|
|
5126
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5127
|
+
"data-src": props.video
|
|
5128
|
+
} : {
|
|
5129
|
+
src: props.video
|
|
5130
|
+
}), false, false);
|
|
5110
5131
|
insert(_el$, createComponent(Show, {
|
|
5111
5132
|
get when() {
|
|
5112
5133
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5113
5134
|
},
|
|
5114
5135
|
get children() {
|
|
5115
|
-
const _el$4 = _tmpl$
|
|
5136
|
+
const _el$4 = _tmpl$21();
|
|
5116
5137
|
_el$4.style.setProperty("width", "100%");
|
|
5117
5138
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5118
5139
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5125,7 +5146,7 @@ function Video(props) {
|
|
|
5125
5146
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5126
5147
|
},
|
|
5127
5148
|
get children() {
|
|
5128
|
-
const _el$5 = _tmpl$
|
|
5149
|
+
const _el$5 = _tmpl$21();
|
|
5129
5150
|
_el$5.style.setProperty("display", "flex");
|
|
5130
5151
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5131
5152
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5138,7 +5159,7 @@ function Video(props) {
|
|
|
5138
5159
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5139
5160
|
},
|
|
5140
5161
|
get children() {
|
|
5141
|
-
const _el$6 = _tmpl$
|
|
5162
|
+
const _el$6 = _tmpl$21();
|
|
5142
5163
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5143
5164
|
_el$6.style.setProperty("display", "flex");
|
|
5144
5165
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5295,7 +5316,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5295
5316
|
}
|
|
5296
5317
|
|
|
5297
5318
|
// src/constants/sdk-version.ts
|
|
5298
|
-
var SDK_VERSION = "
|
|
5319
|
+
var SDK_VERSION = "4.0.1";
|
|
5299
5320
|
|
|
5300
5321
|
// src/helpers/sdk-headers.ts
|
|
5301
5322
|
var getSdkHeaders = () => ({
|
|
@@ -5897,7 +5918,7 @@ var registerInsertMenu = () => {
|
|
|
5897
5918
|
});
|
|
5898
5919
|
};
|
|
5899
5920
|
var isSetupForEditing = false;
|
|
5900
|
-
var setupBrowserForEditing = (options
|
|
5921
|
+
var setupBrowserForEditing = (options) => {
|
|
5901
5922
|
if (isSetupForEditing) {
|
|
5902
5923
|
return;
|
|
5903
5924
|
}
|
|
@@ -5913,6 +5934,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5913
5934
|
// scope our '+ add block' button styling
|
|
5914
5935
|
supportsAddBlockScoping: true,
|
|
5915
5936
|
supportsCustomBreakpoints: true,
|
|
5937
|
+
modelName: options.modelName,
|
|
5938
|
+
apiKey: options.apiKey,
|
|
5916
5939
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5917
5940
|
blockLevelPersonalization: true
|
|
5918
5941
|
}
|
|
@@ -6005,6 +6028,15 @@ var createEditorListener = ({
|
|
|
6005
6028
|
callbacks.animation(data.data);
|
|
6006
6029
|
break;
|
|
6007
6030
|
}
|
|
6031
|
+
case "builder.resetState": {
|
|
6032
|
+
const messageContent = data.data;
|
|
6033
|
+
const modelName = messageContent.model;
|
|
6034
|
+
const newState = messageContent?.state;
|
|
6035
|
+
if (modelName === model && newState) {
|
|
6036
|
+
callbacks.stateUpdate(newState);
|
|
6037
|
+
}
|
|
6038
|
+
break;
|
|
6039
|
+
}
|
|
6008
6040
|
case "builder.contentUpdate": {
|
|
6009
6041
|
const messageContent = data.data;
|
|
6010
6042
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -6018,23 +6050,33 @@ var createEditorListener = ({
|
|
|
6018
6050
|
}
|
|
6019
6051
|
};
|
|
6020
6052
|
};
|
|
6021
|
-
var subscribeToEditor = (
|
|
6053
|
+
var subscribeToEditor = ({
|
|
6054
|
+
model,
|
|
6055
|
+
apiKey,
|
|
6056
|
+
callback,
|
|
6057
|
+
trustedHosts
|
|
6058
|
+
}) => {
|
|
6022
6059
|
if (!isBrowser) {
|
|
6023
6060
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6024
6061
|
return () => {
|
|
6025
6062
|
};
|
|
6026
6063
|
}
|
|
6027
|
-
setupBrowserForEditing(
|
|
6064
|
+
setupBrowserForEditing({
|
|
6065
|
+
modelName: model,
|
|
6066
|
+
apiKey
|
|
6067
|
+
});
|
|
6028
6068
|
const listener = createEditorListener({
|
|
6029
6069
|
callbacks: {
|
|
6030
6070
|
contentUpdate: callback,
|
|
6031
6071
|
animation: () => {
|
|
6032
6072
|
},
|
|
6033
6073
|
configureSdk: () => {
|
|
6074
|
+
},
|
|
6075
|
+
stateUpdate: () => {
|
|
6034
6076
|
}
|
|
6035
6077
|
},
|
|
6036
6078
|
model,
|
|
6037
|
-
trustedHosts
|
|
6079
|
+
trustedHosts
|
|
6038
6080
|
});
|
|
6039
6081
|
window.addEventListener("message", listener);
|
|
6040
6082
|
return () => {
|
|
@@ -6198,6 +6240,9 @@ function EnableEditor(props) {
|
|
|
6198
6240
|
},
|
|
6199
6241
|
contentUpdate: (newContent) => {
|
|
6200
6242
|
mergeNewContent(newContent);
|
|
6243
|
+
},
|
|
6244
|
+
stateUpdate: (newState) => {
|
|
6245
|
+
mergeNewRootState(newState);
|
|
6201
6246
|
}
|
|
6202
6247
|
}
|
|
6203
6248
|
})(event);
|
|
@@ -6279,10 +6324,12 @@ function EnableEditor(props) {
|
|
|
6279
6324
|
} : {},
|
|
6280
6325
|
...props.trustedHosts ? {
|
|
6281
6326
|
trustedHosts: props.trustedHosts
|
|
6282
|
-
} : {}
|
|
6327
|
+
} : {},
|
|
6328
|
+
modelName: props.model ?? "",
|
|
6329
|
+
apiKey: props.apiKey
|
|
6283
6330
|
});
|
|
6284
6331
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6285
|
-
if (!
|
|
6332
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6286
6333
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6287
6334
|
window.parent?.postMessage(message, "*");
|
|
6288
6335
|
}
|
|
@@ -6310,7 +6357,7 @@ function EnableEditor(props) {
|
|
|
6310
6357
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6311
6358
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6312
6359
|
fetchOneEntry({
|
|
6313
|
-
model: props.model
|
|
6360
|
+
model: props.model,
|
|
6314
6361
|
apiKey: props.apiKey,
|
|
6315
6362
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6316
6363
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6504,7 +6551,7 @@ function ContentComponent(props) {
|
|
|
6504
6551
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6505
6552
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6506
6553
|
nonce: props.nonce || "",
|
|
6507
|
-
model: props.model
|
|
6554
|
+
model: props.model
|
|
6508
6555
|
});
|
|
6509
6556
|
function contentSetState(newRootState) {
|
|
6510
6557
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6945,7 +6992,7 @@ function Symbol(props) {
|
|
|
6945
6992
|
return props.builderContext.canTrack;
|
|
6946
6993
|
},
|
|
6947
6994
|
get model() {
|
|
6948
|
-
return props.symbol?.model;
|
|
6995
|
+
return props.symbol?.model ?? "";
|
|
6949
6996
|
},
|
|
6950
6997
|
get content() {
|
|
6951
6998
|
return contentToUse();
|
package/lib/browser/index.jsx
CHANGED
|
@@ -1908,10 +1908,10 @@ function SectionComponent(props) {
|
|
|
1908
1908
|
var section_default = SectionComponent;
|
|
1909
1909
|
|
|
1910
1910
|
// src/blocks/symbol/symbol.tsx
|
|
1911
|
-
import { onMount as
|
|
1911
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1912
1912
|
|
|
1913
1913
|
// src/components/content-variants/content-variants.tsx
|
|
1914
|
-
import { Show as Show16, For as For9, onMount as
|
|
1914
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1915
1915
|
|
|
1916
1916
|
// src/helpers/url.ts
|
|
1917
1917
|
var getTopLevelDomain = (host) => {
|
|
@@ -4554,8 +4554,9 @@ var componentInfo20 = {
|
|
|
4554
4554
|
};
|
|
4555
4555
|
|
|
4556
4556
|
// src/blocks/video/video.tsx
|
|
4557
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4557
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4558
4558
|
function Video(props) {
|
|
4559
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4559
4560
|
const videoProps = createMemo15(() => {
|
|
4560
4561
|
return {
|
|
4561
4562
|
...props.autoPlay === true ? {
|
|
@@ -4580,6 +4581,35 @@ function Video(props) {
|
|
|
4580
4581
|
...videoProps()
|
|
4581
4582
|
};
|
|
4582
4583
|
});
|
|
4584
|
+
let videoRef;
|
|
4585
|
+
onMount6(() => {
|
|
4586
|
+
if (props.lazyLoad) {
|
|
4587
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4588
|
+
entries.forEach(function(entry) {
|
|
4589
|
+
if (!entry.isIntersecting)
|
|
4590
|
+
return;
|
|
4591
|
+
const videoElement = entry.target;
|
|
4592
|
+
try {
|
|
4593
|
+
Array.from(videoElement.children).filter(
|
|
4594
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4595
|
+
).forEach((source) => {
|
|
4596
|
+
const src = source.dataset.src;
|
|
4597
|
+
if (src) {
|
|
4598
|
+
source.src = src;
|
|
4599
|
+
}
|
|
4600
|
+
});
|
|
4601
|
+
videoElement.load();
|
|
4602
|
+
oberver.unobserve(videoElement);
|
|
4603
|
+
} catch (error) {
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
});
|
|
4607
|
+
if (videoRef) {
|
|
4608
|
+
oberver.observe(videoRef);
|
|
4609
|
+
}
|
|
4610
|
+
setLazyVideoObserver(oberver);
|
|
4611
|
+
}
|
|
4612
|
+
});
|
|
4583
4613
|
return <><div
|
|
4584
4614
|
style={{
|
|
4585
4615
|
position: "relative"
|
|
@@ -4588,7 +4618,8 @@ function Video(props) {
|
|
|
4588
4618
|
<video
|
|
4589
4619
|
class="builder-video"
|
|
4590
4620
|
{...spreadProps()}
|
|
4591
|
-
|
|
4621
|
+
ref={videoRef}
|
|
4622
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4592
4623
|
style={{
|
|
4593
4624
|
width: "100%",
|
|
4594
4625
|
height: "100%",
|
|
@@ -4602,9 +4633,15 @@ function Video(props) {
|
|
|
4602
4633
|
position: "absolute"
|
|
4603
4634
|
} : null
|
|
4604
4635
|
}}
|
|
4605
|
-
src={props.video || "no-src"}
|
|
4606
4636
|
poster={props.posterImage}
|
|
4607
|
-
><
|
|
4637
|
+
><source
|
|
4638
|
+
type="video/mp4"
|
|
4639
|
+
{...props.lazyLoad ? {
|
|
4640
|
+
"data-src": props.video
|
|
4641
|
+
} : {
|
|
4642
|
+
src: props.video
|
|
4643
|
+
}}
|
|
4644
|
+
/></video>
|
|
4608
4645
|
<Show13
|
|
4609
4646
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4610
4647
|
><div
|
|
@@ -4774,7 +4811,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4774
4811
|
// src/components/content/components/enable-editor.tsx
|
|
4775
4812
|
import {
|
|
4776
4813
|
Show as Show14,
|
|
4777
|
-
onMount as
|
|
4814
|
+
onMount as onMount7,
|
|
4778
4815
|
on as on3,
|
|
4779
4816
|
createEffect as createEffect3,
|
|
4780
4817
|
createMemo as createMemo16,
|
|
@@ -4788,7 +4825,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4788
4825
|
}
|
|
4789
4826
|
|
|
4790
4827
|
// src/constants/sdk-version.ts
|
|
4791
|
-
var SDK_VERSION = "
|
|
4828
|
+
var SDK_VERSION = "4.0.1";
|
|
4792
4829
|
|
|
4793
4830
|
// src/helpers/sdk-headers.ts
|
|
4794
4831
|
var getSdkHeaders = () => ({
|
|
@@ -5390,7 +5427,7 @@ var registerInsertMenu = () => {
|
|
|
5390
5427
|
});
|
|
5391
5428
|
};
|
|
5392
5429
|
var isSetupForEditing = false;
|
|
5393
|
-
var setupBrowserForEditing = (options
|
|
5430
|
+
var setupBrowserForEditing = (options) => {
|
|
5394
5431
|
if (isSetupForEditing) {
|
|
5395
5432
|
return;
|
|
5396
5433
|
}
|
|
@@ -5406,6 +5443,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5406
5443
|
// scope our '+ add block' button styling
|
|
5407
5444
|
supportsAddBlockScoping: true,
|
|
5408
5445
|
supportsCustomBreakpoints: true,
|
|
5446
|
+
modelName: options.modelName,
|
|
5447
|
+
apiKey: options.apiKey,
|
|
5409
5448
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5410
5449
|
blockLevelPersonalization: true
|
|
5411
5450
|
}
|
|
@@ -5498,6 +5537,15 @@ var createEditorListener = ({
|
|
|
5498
5537
|
callbacks.animation(data.data);
|
|
5499
5538
|
break;
|
|
5500
5539
|
}
|
|
5540
|
+
case "builder.resetState": {
|
|
5541
|
+
const messageContent = data.data;
|
|
5542
|
+
const modelName = messageContent.model;
|
|
5543
|
+
const newState = messageContent?.state;
|
|
5544
|
+
if (modelName === model && newState) {
|
|
5545
|
+
callbacks.stateUpdate(newState);
|
|
5546
|
+
}
|
|
5547
|
+
break;
|
|
5548
|
+
}
|
|
5501
5549
|
case "builder.contentUpdate": {
|
|
5502
5550
|
const messageContent = data.data;
|
|
5503
5551
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -5511,23 +5559,33 @@ var createEditorListener = ({
|
|
|
5511
5559
|
}
|
|
5512
5560
|
};
|
|
5513
5561
|
};
|
|
5514
|
-
var subscribeToEditor = (
|
|
5562
|
+
var subscribeToEditor = ({
|
|
5563
|
+
model,
|
|
5564
|
+
apiKey,
|
|
5565
|
+
callback,
|
|
5566
|
+
trustedHosts
|
|
5567
|
+
}) => {
|
|
5515
5568
|
if (!isBrowser) {
|
|
5516
5569
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5517
5570
|
return () => {
|
|
5518
5571
|
};
|
|
5519
5572
|
}
|
|
5520
|
-
setupBrowserForEditing(
|
|
5573
|
+
setupBrowserForEditing({
|
|
5574
|
+
modelName: model,
|
|
5575
|
+
apiKey
|
|
5576
|
+
});
|
|
5521
5577
|
const listener = createEditorListener({
|
|
5522
5578
|
callbacks: {
|
|
5523
5579
|
contentUpdate: callback,
|
|
5524
5580
|
animation: () => {
|
|
5525
5581
|
},
|
|
5526
5582
|
configureSdk: () => {
|
|
5583
|
+
},
|
|
5584
|
+
stateUpdate: () => {
|
|
5527
5585
|
}
|
|
5528
5586
|
},
|
|
5529
5587
|
model,
|
|
5530
|
-
trustedHosts
|
|
5588
|
+
trustedHosts
|
|
5531
5589
|
});
|
|
5532
5590
|
window.addEventListener("message", listener);
|
|
5533
5591
|
return () => {
|
|
@@ -5690,6 +5748,9 @@ function EnableEditor(props) {
|
|
|
5690
5748
|
},
|
|
5691
5749
|
contentUpdate: (newContent) => {
|
|
5692
5750
|
mergeNewContent(newContent);
|
|
5751
|
+
},
|
|
5752
|
+
stateUpdate: (newState) => {
|
|
5753
|
+
mergeNewRootState(newState);
|
|
5693
5754
|
}
|
|
5694
5755
|
}
|
|
5695
5756
|
})(event);
|
|
@@ -5767,7 +5828,7 @@ function EnableEditor(props) {
|
|
|
5767
5828
|
let elementRef;
|
|
5768
5829
|
runHttpRequests();
|
|
5769
5830
|
emitStateUpdate();
|
|
5770
|
-
|
|
5831
|
+
onMount7(() => {
|
|
5771
5832
|
if (isBrowser()) {
|
|
5772
5833
|
if (isEditing() && !props.isNestedRender) {
|
|
5773
5834
|
window.addEventListener("message", processMessage);
|
|
@@ -5781,12 +5842,14 @@ function EnableEditor(props) {
|
|
|
5781
5842
|
} : {},
|
|
5782
5843
|
...props.trustedHosts ? {
|
|
5783
5844
|
trustedHosts: props.trustedHosts
|
|
5784
|
-
} : {}
|
|
5845
|
+
} : {},
|
|
5846
|
+
modelName: props.model ?? "",
|
|
5847
|
+
apiKey: props.apiKey
|
|
5785
5848
|
});
|
|
5786
5849
|
Object.values(
|
|
5787
5850
|
props.builderContextSignal.componentInfos
|
|
5788
5851
|
).forEach((registeredComponent) => {
|
|
5789
|
-
if (!
|
|
5852
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5790
5853
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5791
5854
|
window.parent?.postMessage(message, "*");
|
|
5792
5855
|
}
|
|
@@ -5819,7 +5882,7 @@ function EnableEditor(props) {
|
|
|
5819
5882
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5820
5883
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5821
5884
|
fetchOneEntry({
|
|
5822
|
-
model: props.model
|
|
5885
|
+
model: props.model,
|
|
5823
5886
|
apiKey: props.apiKey,
|
|
5824
5887
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
5825
5888
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6007,7 +6070,7 @@ function ContentComponent(props) {
|
|
|
6007
6070
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6008
6071
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6009
6072
|
nonce: props.nonce || "",
|
|
6010
|
-
model: props.model
|
|
6073
|
+
model: props.model
|
|
6011
6074
|
});
|
|
6012
6075
|
function contentSetState(newRootState) {
|
|
6013
6076
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6112,7 +6175,7 @@ function ContentVariants(props) {
|
|
|
6112
6175
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6113
6176
|
});
|
|
6114
6177
|
});
|
|
6115
|
-
|
|
6178
|
+
onMount8(() => {
|
|
6116
6179
|
setShouldRenderVariants(false);
|
|
6117
6180
|
});
|
|
6118
6181
|
return <><>
|
|
@@ -6242,7 +6305,7 @@ function Symbol(props) {
|
|
|
6242
6305
|
}
|
|
6243
6306
|
});
|
|
6244
6307
|
}
|
|
6245
|
-
|
|
6308
|
+
onMount9(() => {
|
|
6246
6309
|
});
|
|
6247
6310
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6248
6311
|
function onUpdateFn_0() {
|
|
@@ -6265,7 +6328,7 @@ function Symbol(props) {
|
|
|
6265
6328
|
...contentToUse()?.data?.state
|
|
6266
6329
|
}}
|
|
6267
6330
|
canTrack={props.builderContext.canTrack}
|
|
6268
|
-
model={props.symbol?.model}
|
|
6331
|
+
model={props.symbol?.model ?? ""}
|
|
6269
6332
|
content={contentToUse()}
|
|
6270
6333
|
linkComponent={props.builderLinkComponent}
|
|
6271
6334
|
blocksWrapper={blocksWrapper()}
|