@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/node/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -5209,10 +5209,10 @@ var componentInfo20 = {
|
|
|
5209
5209
|
builderBlock: true
|
|
5210
5210
|
}
|
|
5211
5211
|
};
|
|
5212
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5213
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5214
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5212
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5213
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5215
5214
|
function Video(props) {
|
|
5215
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5216
5216
|
const videoProps = createMemo(() => {
|
|
5217
5217
|
return {
|
|
5218
5218
|
...props.autoPlay === true ? {
|
|
@@ -5237,12 +5237,41 @@ function Video(props) {
|
|
|
5237
5237
|
...videoProps()
|
|
5238
5238
|
};
|
|
5239
5239
|
});
|
|
5240
|
+
let videoRef;
|
|
5241
|
+
onMount(() => {
|
|
5242
|
+
if (props.lazyLoad) {
|
|
5243
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5244
|
+
entries.forEach(function(entry) {
|
|
5245
|
+
if (!entry.isIntersecting)
|
|
5246
|
+
return;
|
|
5247
|
+
const videoElement = entry.target;
|
|
5248
|
+
try {
|
|
5249
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5250
|
+
const src = source.dataset.src;
|
|
5251
|
+
if (src) {
|
|
5252
|
+
source.src = src;
|
|
5253
|
+
}
|
|
5254
|
+
});
|
|
5255
|
+
videoElement.load();
|
|
5256
|
+
oberver.unobserve(videoElement);
|
|
5257
|
+
} catch (error2) {
|
|
5258
|
+
}
|
|
5259
|
+
});
|
|
5260
|
+
});
|
|
5261
|
+
if (videoRef) {
|
|
5262
|
+
oberver.observe(videoRef);
|
|
5263
|
+
}
|
|
5264
|
+
setLazyVideoObserver(oberver);
|
|
5265
|
+
}
|
|
5266
|
+
});
|
|
5240
5267
|
return (() => {
|
|
5241
|
-
const _el$ = _tmpl$
|
|
5268
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5242
5269
|
_el$.style.setProperty("position", "relative");
|
|
5270
|
+
const _ref$ = videoRef;
|
|
5271
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5243
5272
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5244
5273
|
get preload() {
|
|
5245
|
-
return props.preload || "metadata";
|
|
5274
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5246
5275
|
},
|
|
5247
5276
|
get style() {
|
|
5248
5277
|
return {
|
|
@@ -5259,29 +5288,21 @@ function Video(props) {
|
|
|
5259
5288
|
} : null
|
|
5260
5289
|
};
|
|
5261
5290
|
},
|
|
5262
|
-
get src() {
|
|
5263
|
-
return props.video || "no-src";
|
|
5264
|
-
},
|
|
5265
5291
|
get poster() {
|
|
5266
5292
|
return props.posterImage;
|
|
5267
5293
|
}
|
|
5268
5294
|
}), false, true);
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
const _el$3 = _tmpl$21();
|
|
5275
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5276
|
-
return _el$3;
|
|
5277
|
-
}
|
|
5278
|
-
}));
|
|
5295
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5296
|
+
"data-src": props.video
|
|
5297
|
+
} : {
|
|
5298
|
+
src: props.video
|
|
5299
|
+
}), false, false);
|
|
5279
5300
|
insert(_el$, createComponent(Show, {
|
|
5280
5301
|
get when() {
|
|
5281
5302
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5282
5303
|
},
|
|
5283
5304
|
get children() {
|
|
5284
|
-
const _el$4 = _tmpl$
|
|
5305
|
+
const _el$4 = _tmpl$21();
|
|
5285
5306
|
_el$4.style.setProperty("width", "100%");
|
|
5286
5307
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5287
5308
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5294,7 +5315,7 @@ function Video(props) {
|
|
|
5294
5315
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5295
5316
|
},
|
|
5296
5317
|
get children() {
|
|
5297
|
-
const _el$5 = _tmpl$
|
|
5318
|
+
const _el$5 = _tmpl$21();
|
|
5298
5319
|
_el$5.style.setProperty("display", "flex");
|
|
5299
5320
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5300
5321
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5307,7 +5328,7 @@ function Video(props) {
|
|
|
5307
5328
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5308
5329
|
},
|
|
5309
5330
|
get children() {
|
|
5310
|
-
const _el$6 = _tmpl$
|
|
5331
|
+
const _el$6 = _tmpl$21();
|
|
5311
5332
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5312
5333
|
_el$6.style.setProperty("display", "flex");
|
|
5313
5334
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5464,7 +5485,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5464
5485
|
}
|
|
5465
5486
|
|
|
5466
5487
|
// src/constants/sdk-version.ts
|
|
5467
|
-
var SDK_VERSION = "
|
|
5488
|
+
var SDK_VERSION = "4.0.1";
|
|
5468
5489
|
|
|
5469
5490
|
// src/helpers/sdk-headers.ts
|
|
5470
5491
|
var getSdkHeaders = () => ({
|
|
@@ -6066,7 +6087,7 @@ var registerInsertMenu = () => {
|
|
|
6066
6087
|
});
|
|
6067
6088
|
};
|
|
6068
6089
|
var isSetupForEditing = false;
|
|
6069
|
-
var setupBrowserForEditing = (options
|
|
6090
|
+
var setupBrowserForEditing = (options) => {
|
|
6070
6091
|
if (isSetupForEditing) {
|
|
6071
6092
|
return;
|
|
6072
6093
|
}
|
|
@@ -6082,6 +6103,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6082
6103
|
// scope our '+ add block' button styling
|
|
6083
6104
|
supportsAddBlockScoping: true,
|
|
6084
6105
|
supportsCustomBreakpoints: true,
|
|
6106
|
+
modelName: options.modelName,
|
|
6107
|
+
apiKey: options.apiKey,
|
|
6085
6108
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
6086
6109
|
blockLevelPersonalization: true
|
|
6087
6110
|
}
|
|
@@ -6174,6 +6197,15 @@ var createEditorListener = ({
|
|
|
6174
6197
|
callbacks.animation(data.data);
|
|
6175
6198
|
break;
|
|
6176
6199
|
}
|
|
6200
|
+
case "builder.resetState": {
|
|
6201
|
+
const messageContent = data.data;
|
|
6202
|
+
const modelName = messageContent.model;
|
|
6203
|
+
const newState = messageContent?.state;
|
|
6204
|
+
if (modelName === model && newState) {
|
|
6205
|
+
callbacks.stateUpdate(newState);
|
|
6206
|
+
}
|
|
6207
|
+
break;
|
|
6208
|
+
}
|
|
6177
6209
|
case "builder.contentUpdate": {
|
|
6178
6210
|
const messageContent = data.data;
|
|
6179
6211
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -6187,23 +6219,33 @@ var createEditorListener = ({
|
|
|
6187
6219
|
}
|
|
6188
6220
|
};
|
|
6189
6221
|
};
|
|
6190
|
-
var subscribeToEditor = (
|
|
6222
|
+
var subscribeToEditor = ({
|
|
6223
|
+
model,
|
|
6224
|
+
apiKey,
|
|
6225
|
+
callback,
|
|
6226
|
+
trustedHosts
|
|
6227
|
+
}) => {
|
|
6191
6228
|
if (!isBrowser) {
|
|
6192
6229
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6193
6230
|
return () => {
|
|
6194
6231
|
};
|
|
6195
6232
|
}
|
|
6196
|
-
setupBrowserForEditing(
|
|
6233
|
+
setupBrowserForEditing({
|
|
6234
|
+
modelName: model,
|
|
6235
|
+
apiKey
|
|
6236
|
+
});
|
|
6197
6237
|
const listener = createEditorListener({
|
|
6198
6238
|
callbacks: {
|
|
6199
6239
|
contentUpdate: callback,
|
|
6200
6240
|
animation: () => {
|
|
6201
6241
|
},
|
|
6202
6242
|
configureSdk: () => {
|
|
6243
|
+
},
|
|
6244
|
+
stateUpdate: () => {
|
|
6203
6245
|
}
|
|
6204
6246
|
},
|
|
6205
6247
|
model,
|
|
6206
|
-
trustedHosts
|
|
6248
|
+
trustedHosts
|
|
6207
6249
|
});
|
|
6208
6250
|
window.addEventListener("message", listener);
|
|
6209
6251
|
return () => {
|
|
@@ -6367,6 +6409,9 @@ function EnableEditor(props) {
|
|
|
6367
6409
|
},
|
|
6368
6410
|
contentUpdate: (newContent) => {
|
|
6369
6411
|
mergeNewContent(newContent);
|
|
6412
|
+
},
|
|
6413
|
+
stateUpdate: (newState) => {
|
|
6414
|
+
mergeNewRootState(newState);
|
|
6370
6415
|
}
|
|
6371
6416
|
}
|
|
6372
6417
|
})(event);
|
|
@@ -6448,10 +6493,12 @@ function EnableEditor(props) {
|
|
|
6448
6493
|
} : {},
|
|
6449
6494
|
...props.trustedHosts ? {
|
|
6450
6495
|
trustedHosts: props.trustedHosts
|
|
6451
|
-
} : {}
|
|
6496
|
+
} : {},
|
|
6497
|
+
modelName: props.model ?? "",
|
|
6498
|
+
apiKey: props.apiKey
|
|
6452
6499
|
});
|
|
6453
6500
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6454
|
-
if (!
|
|
6501
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6455
6502
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6456
6503
|
window.parent?.postMessage(message, "*");
|
|
6457
6504
|
}
|
|
@@ -6479,7 +6526,7 @@ function EnableEditor(props) {
|
|
|
6479
6526
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6480
6527
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6481
6528
|
fetchOneEntry({
|
|
6482
|
-
model: props.model
|
|
6529
|
+
model: props.model,
|
|
6483
6530
|
apiKey: props.apiKey,
|
|
6484
6531
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6485
6532
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6673,7 +6720,7 @@ function ContentComponent(props) {
|
|
|
6673
6720
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6674
6721
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6675
6722
|
nonce: props.nonce || "",
|
|
6676
|
-
model: props.model
|
|
6723
|
+
model: props.model
|
|
6677
6724
|
});
|
|
6678
6725
|
function contentSetState(newRootState) {
|
|
6679
6726
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -7114,7 +7161,7 @@ function Symbol(props) {
|
|
|
7114
7161
|
return props.builderContext.canTrack;
|
|
7115
7162
|
},
|
|
7116
7163
|
get model() {
|
|
7117
|
-
return props.symbol?.model;
|
|
7164
|
+
return props.symbol?.model ?? "";
|
|
7118
7165
|
},
|
|
7119
7166
|
get content() {
|
|
7120
7167
|
return contentToUse();
|
package/lib/node/index.jsx
CHANGED
|
@@ -2079,10 +2079,10 @@ function SectionComponent(props) {
|
|
|
2079
2079
|
var section_default = SectionComponent;
|
|
2080
2080
|
|
|
2081
2081
|
// src/blocks/symbol/symbol.tsx
|
|
2082
|
-
import { onMount as
|
|
2082
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2083
2083
|
|
|
2084
2084
|
// src/components/content-variants/content-variants.tsx
|
|
2085
|
-
import { Show as Show16, For as For9, onMount as
|
|
2085
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
2086
2086
|
|
|
2087
2087
|
// src/helpers/url.ts
|
|
2088
2088
|
var getTopLevelDomain = (host) => {
|
|
@@ -4725,8 +4725,9 @@ var componentInfo20 = {
|
|
|
4725
4725
|
};
|
|
4726
4726
|
|
|
4727
4727
|
// src/blocks/video/video.tsx
|
|
4728
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4728
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4729
4729
|
function Video(props) {
|
|
4730
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4730
4731
|
const videoProps = createMemo15(() => {
|
|
4731
4732
|
return {
|
|
4732
4733
|
...props.autoPlay === true ? {
|
|
@@ -4751,6 +4752,35 @@ function Video(props) {
|
|
|
4751
4752
|
...videoProps()
|
|
4752
4753
|
};
|
|
4753
4754
|
});
|
|
4755
|
+
let videoRef;
|
|
4756
|
+
onMount6(() => {
|
|
4757
|
+
if (props.lazyLoad) {
|
|
4758
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4759
|
+
entries.forEach(function(entry) {
|
|
4760
|
+
if (!entry.isIntersecting)
|
|
4761
|
+
return;
|
|
4762
|
+
const videoElement = entry.target;
|
|
4763
|
+
try {
|
|
4764
|
+
Array.from(videoElement.children).filter(
|
|
4765
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4766
|
+
).forEach((source) => {
|
|
4767
|
+
const src = source.dataset.src;
|
|
4768
|
+
if (src) {
|
|
4769
|
+
source.src = src;
|
|
4770
|
+
}
|
|
4771
|
+
});
|
|
4772
|
+
videoElement.load();
|
|
4773
|
+
oberver.unobserve(videoElement);
|
|
4774
|
+
} catch (error2) {
|
|
4775
|
+
}
|
|
4776
|
+
});
|
|
4777
|
+
});
|
|
4778
|
+
if (videoRef) {
|
|
4779
|
+
oberver.observe(videoRef);
|
|
4780
|
+
}
|
|
4781
|
+
setLazyVideoObserver(oberver);
|
|
4782
|
+
}
|
|
4783
|
+
});
|
|
4754
4784
|
return <><div
|
|
4755
4785
|
style={{
|
|
4756
4786
|
position: "relative"
|
|
@@ -4759,7 +4789,8 @@ function Video(props) {
|
|
|
4759
4789
|
<video
|
|
4760
4790
|
class="builder-video"
|
|
4761
4791
|
{...spreadProps()}
|
|
4762
|
-
|
|
4792
|
+
ref={videoRef}
|
|
4793
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4763
4794
|
style={{
|
|
4764
4795
|
width: "100%",
|
|
4765
4796
|
height: "100%",
|
|
@@ -4773,9 +4804,15 @@ function Video(props) {
|
|
|
4773
4804
|
position: "absolute"
|
|
4774
4805
|
} : null
|
|
4775
4806
|
}}
|
|
4776
|
-
src={props.video || "no-src"}
|
|
4777
4807
|
poster={props.posterImage}
|
|
4778
|
-
><
|
|
4808
|
+
><source
|
|
4809
|
+
type="video/mp4"
|
|
4810
|
+
{...props.lazyLoad ? {
|
|
4811
|
+
"data-src": props.video
|
|
4812
|
+
} : {
|
|
4813
|
+
src: props.video
|
|
4814
|
+
}}
|
|
4815
|
+
/></video>
|
|
4779
4816
|
<Show13
|
|
4780
4817
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4781
4818
|
><div
|
|
@@ -4945,7 +4982,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4945
4982
|
// src/components/content/components/enable-editor.tsx
|
|
4946
4983
|
import {
|
|
4947
4984
|
Show as Show14,
|
|
4948
|
-
onMount as
|
|
4985
|
+
onMount as onMount7,
|
|
4949
4986
|
on as on3,
|
|
4950
4987
|
createEffect as createEffect3,
|
|
4951
4988
|
createMemo as createMemo16,
|
|
@@ -4959,7 +4996,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4959
4996
|
}
|
|
4960
4997
|
|
|
4961
4998
|
// src/constants/sdk-version.ts
|
|
4962
|
-
var SDK_VERSION = "
|
|
4999
|
+
var SDK_VERSION = "4.0.1";
|
|
4963
5000
|
|
|
4964
5001
|
// src/helpers/sdk-headers.ts
|
|
4965
5002
|
var getSdkHeaders = () => ({
|
|
@@ -5561,7 +5598,7 @@ var registerInsertMenu = () => {
|
|
|
5561
5598
|
});
|
|
5562
5599
|
};
|
|
5563
5600
|
var isSetupForEditing = false;
|
|
5564
|
-
var setupBrowserForEditing = (options
|
|
5601
|
+
var setupBrowserForEditing = (options) => {
|
|
5565
5602
|
if (isSetupForEditing) {
|
|
5566
5603
|
return;
|
|
5567
5604
|
}
|
|
@@ -5577,6 +5614,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5577
5614
|
// scope our '+ add block' button styling
|
|
5578
5615
|
supportsAddBlockScoping: true,
|
|
5579
5616
|
supportsCustomBreakpoints: true,
|
|
5617
|
+
modelName: options.modelName,
|
|
5618
|
+
apiKey: options.apiKey,
|
|
5580
5619
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5581
5620
|
blockLevelPersonalization: true
|
|
5582
5621
|
}
|
|
@@ -5669,6 +5708,15 @@ var createEditorListener = ({
|
|
|
5669
5708
|
callbacks.animation(data.data);
|
|
5670
5709
|
break;
|
|
5671
5710
|
}
|
|
5711
|
+
case "builder.resetState": {
|
|
5712
|
+
const messageContent = data.data;
|
|
5713
|
+
const modelName = messageContent.model;
|
|
5714
|
+
const newState = messageContent?.state;
|
|
5715
|
+
if (modelName === model && newState) {
|
|
5716
|
+
callbacks.stateUpdate(newState);
|
|
5717
|
+
}
|
|
5718
|
+
break;
|
|
5719
|
+
}
|
|
5672
5720
|
case "builder.contentUpdate": {
|
|
5673
5721
|
const messageContent = data.data;
|
|
5674
5722
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -5682,23 +5730,33 @@ var createEditorListener = ({
|
|
|
5682
5730
|
}
|
|
5683
5731
|
};
|
|
5684
5732
|
};
|
|
5685
|
-
var subscribeToEditor = (
|
|
5733
|
+
var subscribeToEditor = ({
|
|
5734
|
+
model,
|
|
5735
|
+
apiKey,
|
|
5736
|
+
callback,
|
|
5737
|
+
trustedHosts
|
|
5738
|
+
}) => {
|
|
5686
5739
|
if (!isBrowser) {
|
|
5687
5740
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5688
5741
|
return () => {
|
|
5689
5742
|
};
|
|
5690
5743
|
}
|
|
5691
|
-
setupBrowserForEditing(
|
|
5744
|
+
setupBrowserForEditing({
|
|
5745
|
+
modelName: model,
|
|
5746
|
+
apiKey
|
|
5747
|
+
});
|
|
5692
5748
|
const listener = createEditorListener({
|
|
5693
5749
|
callbacks: {
|
|
5694
5750
|
contentUpdate: callback,
|
|
5695
5751
|
animation: () => {
|
|
5696
5752
|
},
|
|
5697
5753
|
configureSdk: () => {
|
|
5754
|
+
},
|
|
5755
|
+
stateUpdate: () => {
|
|
5698
5756
|
}
|
|
5699
5757
|
},
|
|
5700
5758
|
model,
|
|
5701
|
-
trustedHosts
|
|
5759
|
+
trustedHosts
|
|
5702
5760
|
});
|
|
5703
5761
|
window.addEventListener("message", listener);
|
|
5704
5762
|
return () => {
|
|
@@ -5861,6 +5919,9 @@ function EnableEditor(props) {
|
|
|
5861
5919
|
},
|
|
5862
5920
|
contentUpdate: (newContent) => {
|
|
5863
5921
|
mergeNewContent(newContent);
|
|
5922
|
+
},
|
|
5923
|
+
stateUpdate: (newState) => {
|
|
5924
|
+
mergeNewRootState(newState);
|
|
5864
5925
|
}
|
|
5865
5926
|
}
|
|
5866
5927
|
})(event);
|
|
@@ -5938,7 +5999,7 @@ function EnableEditor(props) {
|
|
|
5938
5999
|
let elementRef;
|
|
5939
6000
|
runHttpRequests();
|
|
5940
6001
|
emitStateUpdate();
|
|
5941
|
-
|
|
6002
|
+
onMount7(() => {
|
|
5942
6003
|
if (isBrowser()) {
|
|
5943
6004
|
if (isEditing() && !props.isNestedRender) {
|
|
5944
6005
|
window.addEventListener("message", processMessage);
|
|
@@ -5952,12 +6013,14 @@ function EnableEditor(props) {
|
|
|
5952
6013
|
} : {},
|
|
5953
6014
|
...props.trustedHosts ? {
|
|
5954
6015
|
trustedHosts: props.trustedHosts
|
|
5955
|
-
} : {}
|
|
6016
|
+
} : {},
|
|
6017
|
+
modelName: props.model ?? "",
|
|
6018
|
+
apiKey: props.apiKey
|
|
5956
6019
|
});
|
|
5957
6020
|
Object.values(
|
|
5958
6021
|
props.builderContextSignal.componentInfos
|
|
5959
6022
|
).forEach((registeredComponent) => {
|
|
5960
|
-
if (!
|
|
6023
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5961
6024
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5962
6025
|
window.parent?.postMessage(message, "*");
|
|
5963
6026
|
}
|
|
@@ -5990,7 +6053,7 @@ function EnableEditor(props) {
|
|
|
5990
6053
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5991
6054
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5992
6055
|
fetchOneEntry({
|
|
5993
|
-
model: props.model
|
|
6056
|
+
model: props.model,
|
|
5994
6057
|
apiKey: props.apiKey,
|
|
5995
6058
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
5996
6059
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6178,7 +6241,7 @@ function ContentComponent(props) {
|
|
|
6178
6241
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6179
6242
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6180
6243
|
nonce: props.nonce || "",
|
|
6181
|
-
model: props.model
|
|
6244
|
+
model: props.model
|
|
6182
6245
|
});
|
|
6183
6246
|
function contentSetState(newRootState) {
|
|
6184
6247
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6283,7 +6346,7 @@ function ContentVariants(props) {
|
|
|
6283
6346
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6284
6347
|
});
|
|
6285
6348
|
});
|
|
6286
|
-
|
|
6349
|
+
onMount8(() => {
|
|
6287
6350
|
setShouldRenderVariants(false);
|
|
6288
6351
|
});
|
|
6289
6352
|
return <><>
|
|
@@ -6413,7 +6476,7 @@ function Symbol(props) {
|
|
|
6413
6476
|
}
|
|
6414
6477
|
});
|
|
6415
6478
|
}
|
|
6416
|
-
|
|
6479
|
+
onMount9(() => {
|
|
6417
6480
|
});
|
|
6418
6481
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6419
6482
|
function onUpdateFn_0() {
|
|
@@ -6436,7 +6499,7 @@ function Symbol(props) {
|
|
|
6436
6499
|
...contentToUse()?.data?.state
|
|
6437
6500
|
}}
|
|
6438
6501
|
canTrack={props.builderContext.canTrack}
|
|
6439
|
-
model={props.symbol?.model}
|
|
6502
|
+
model={props.symbol?.model ?? ""}
|
|
6440
6503
|
content={contentToUse()}
|
|
6441
6504
|
linkComponent={props.builderLinkComponent}
|
|
6442
6505
|
blocksWrapper={blocksWrapper()}
|