@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/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -5222,10 +5222,10 @@ var componentInfo20 = {
|
|
|
5222
5222
|
builderBlock: true
|
|
5223
5223
|
}
|
|
5224
5224
|
};
|
|
5225
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5226
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5227
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5225
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5226
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5228
5227
|
function Video(props) {
|
|
5228
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5229
5229
|
const videoProps = createMemo(() => {
|
|
5230
5230
|
return {
|
|
5231
5231
|
...props.autoPlay === true ? {
|
|
@@ -5250,12 +5250,42 @@ function Video(props) {
|
|
|
5250
5250
|
...videoProps()
|
|
5251
5251
|
};
|
|
5252
5252
|
});
|
|
5253
|
+
let videoRef;
|
|
5254
|
+
onMount(() => {
|
|
5255
|
+
if (props.lazyLoad) {
|
|
5256
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5257
|
+
entries.forEach(function(entry) {
|
|
5258
|
+
if (!entry.isIntersecting)
|
|
5259
|
+
return;
|
|
5260
|
+
const videoElement = entry.target;
|
|
5261
|
+
try {
|
|
5262
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5263
|
+
const src = source.dataset.src;
|
|
5264
|
+
if (src) {
|
|
5265
|
+
source.src = src;
|
|
5266
|
+
}
|
|
5267
|
+
});
|
|
5268
|
+
videoElement.load();
|
|
5269
|
+
oberver.unobserve(videoElement);
|
|
5270
|
+
} catch (error2) {
|
|
5271
|
+
console.error("Error loading lazy video:", error2);
|
|
5272
|
+
}
|
|
5273
|
+
});
|
|
5274
|
+
});
|
|
5275
|
+
if (videoRef) {
|
|
5276
|
+
oberver.observe(videoRef);
|
|
5277
|
+
}
|
|
5278
|
+
setLazyVideoObserver(oberver);
|
|
5279
|
+
}
|
|
5280
|
+
});
|
|
5253
5281
|
return (() => {
|
|
5254
|
-
const _el$ = _tmpl$
|
|
5282
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5255
5283
|
_el$.style.setProperty("position", "relative");
|
|
5284
|
+
const _ref$ = videoRef;
|
|
5285
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5256
5286
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5257
5287
|
get preload() {
|
|
5258
|
-
return props.preload || "metadata";
|
|
5288
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5259
5289
|
},
|
|
5260
5290
|
get style() {
|
|
5261
5291
|
return {
|
|
@@ -5272,29 +5302,21 @@ function Video(props) {
|
|
|
5272
5302
|
} : null
|
|
5273
5303
|
};
|
|
5274
5304
|
},
|
|
5275
|
-
get src() {
|
|
5276
|
-
return props.video || "no-src";
|
|
5277
|
-
},
|
|
5278
5305
|
get poster() {
|
|
5279
5306
|
return props.posterImage;
|
|
5280
5307
|
}
|
|
5281
5308
|
}), false, true);
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
const _el$3 = _tmpl$21();
|
|
5288
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5289
|
-
return _el$3;
|
|
5290
|
-
}
|
|
5291
|
-
}));
|
|
5309
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5310
|
+
"data-src": props.video
|
|
5311
|
+
} : {
|
|
5312
|
+
src: props.video
|
|
5313
|
+
}), false, false);
|
|
5292
5314
|
insert(_el$, createComponent(Show, {
|
|
5293
5315
|
get when() {
|
|
5294
5316
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5295
5317
|
},
|
|
5296
5318
|
get children() {
|
|
5297
|
-
const _el$4 = _tmpl$
|
|
5319
|
+
const _el$4 = _tmpl$21();
|
|
5298
5320
|
_el$4.style.setProperty("width", "100%");
|
|
5299
5321
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5300
5322
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5307,7 +5329,7 @@ function Video(props) {
|
|
|
5307
5329
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5308
5330
|
},
|
|
5309
5331
|
get children() {
|
|
5310
|
-
const _el$5 = _tmpl$
|
|
5332
|
+
const _el$5 = _tmpl$21();
|
|
5311
5333
|
_el$5.style.setProperty("display", "flex");
|
|
5312
5334
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5313
5335
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5320,7 +5342,7 @@ function Video(props) {
|
|
|
5320
5342
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5321
5343
|
},
|
|
5322
5344
|
get children() {
|
|
5323
|
-
const _el$6 = _tmpl$
|
|
5345
|
+
const _el$6 = _tmpl$21();
|
|
5324
5346
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5325
5347
|
_el$6.style.setProperty("display", "flex");
|
|
5326
5348
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5477,7 +5499,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5477
5499
|
}
|
|
5478
5500
|
|
|
5479
5501
|
// src/constants/sdk-version.ts
|
|
5480
|
-
var SDK_VERSION = "
|
|
5502
|
+
var SDK_VERSION = "4.0.1";
|
|
5481
5503
|
|
|
5482
5504
|
// src/helpers/sdk-headers.ts
|
|
5483
5505
|
var getSdkHeaders = () => ({
|
|
@@ -6085,7 +6107,7 @@ var registerInsertMenu = () => {
|
|
|
6085
6107
|
});
|
|
6086
6108
|
};
|
|
6087
6109
|
var isSetupForEditing = false;
|
|
6088
|
-
var setupBrowserForEditing = (options
|
|
6110
|
+
var setupBrowserForEditing = (options) => {
|
|
6089
6111
|
if (isSetupForEditing) {
|
|
6090
6112
|
return;
|
|
6091
6113
|
}
|
|
@@ -6101,6 +6123,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6101
6123
|
// scope our '+ add block' button styling
|
|
6102
6124
|
supportsAddBlockScoping: true,
|
|
6103
6125
|
supportsCustomBreakpoints: true,
|
|
6126
|
+
modelName: options.modelName,
|
|
6127
|
+
apiKey: options.apiKey,
|
|
6104
6128
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
6105
6129
|
blockLevelPersonalization: true
|
|
6106
6130
|
}
|
|
@@ -6193,6 +6217,15 @@ var createEditorListener = ({
|
|
|
6193
6217
|
callbacks.animation(data.data);
|
|
6194
6218
|
break;
|
|
6195
6219
|
}
|
|
6220
|
+
case "builder.resetState": {
|
|
6221
|
+
const messageContent = data.data;
|
|
6222
|
+
const modelName = messageContent.model;
|
|
6223
|
+
const newState = messageContent?.state;
|
|
6224
|
+
if (modelName === model && newState) {
|
|
6225
|
+
callbacks.stateUpdate(newState);
|
|
6226
|
+
}
|
|
6227
|
+
break;
|
|
6228
|
+
}
|
|
6196
6229
|
case "builder.contentUpdate": {
|
|
6197
6230
|
const messageContent = data.data;
|
|
6198
6231
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -6206,23 +6239,33 @@ var createEditorListener = ({
|
|
|
6206
6239
|
}
|
|
6207
6240
|
};
|
|
6208
6241
|
};
|
|
6209
|
-
var subscribeToEditor = (
|
|
6242
|
+
var subscribeToEditor = ({
|
|
6243
|
+
model,
|
|
6244
|
+
apiKey,
|
|
6245
|
+
callback,
|
|
6246
|
+
trustedHosts
|
|
6247
|
+
}) => {
|
|
6210
6248
|
if (!isBrowser) {
|
|
6211
6249
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6212
6250
|
return () => {
|
|
6213
6251
|
};
|
|
6214
6252
|
}
|
|
6215
|
-
setupBrowserForEditing(
|
|
6253
|
+
setupBrowserForEditing({
|
|
6254
|
+
modelName: model,
|
|
6255
|
+
apiKey
|
|
6256
|
+
});
|
|
6216
6257
|
const listener = createEditorListener({
|
|
6217
6258
|
callbacks: {
|
|
6218
6259
|
contentUpdate: callback,
|
|
6219
6260
|
animation: () => {
|
|
6220
6261
|
},
|
|
6221
6262
|
configureSdk: () => {
|
|
6263
|
+
},
|
|
6264
|
+
stateUpdate: () => {
|
|
6222
6265
|
}
|
|
6223
6266
|
},
|
|
6224
6267
|
model,
|
|
6225
|
-
trustedHosts
|
|
6268
|
+
trustedHosts
|
|
6226
6269
|
});
|
|
6227
6270
|
window.addEventListener("message", listener);
|
|
6228
6271
|
return () => {
|
|
@@ -6386,6 +6429,9 @@ function EnableEditor(props) {
|
|
|
6386
6429
|
},
|
|
6387
6430
|
contentUpdate: (newContent) => {
|
|
6388
6431
|
mergeNewContent(newContent);
|
|
6432
|
+
},
|
|
6433
|
+
stateUpdate: (newState) => {
|
|
6434
|
+
mergeNewRootState(newState);
|
|
6389
6435
|
}
|
|
6390
6436
|
}
|
|
6391
6437
|
})(event);
|
|
@@ -6468,10 +6514,12 @@ function EnableEditor(props) {
|
|
|
6468
6514
|
} : {},
|
|
6469
6515
|
...props.trustedHosts ? {
|
|
6470
6516
|
trustedHosts: props.trustedHosts
|
|
6471
|
-
} : {}
|
|
6517
|
+
} : {},
|
|
6518
|
+
modelName: props.model ?? "",
|
|
6519
|
+
apiKey: props.apiKey
|
|
6472
6520
|
});
|
|
6473
6521
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6474
|
-
if (!
|
|
6522
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6475
6523
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6476
6524
|
window.parent?.postMessage(message, "*");
|
|
6477
6525
|
}
|
|
@@ -6499,7 +6547,7 @@ function EnableEditor(props) {
|
|
|
6499
6547
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6500
6548
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6501
6549
|
fetchOneEntry({
|
|
6502
|
-
model: props.model
|
|
6550
|
+
model: props.model,
|
|
6503
6551
|
apiKey: props.apiKey,
|
|
6504
6552
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6505
6553
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6693,7 +6741,7 @@ function ContentComponent(props) {
|
|
|
6693
6741
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6694
6742
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6695
6743
|
nonce: props.nonce || "",
|
|
6696
|
-
model: props.model
|
|
6744
|
+
model: props.model
|
|
6697
6745
|
});
|
|
6698
6746
|
function contentSetState(newRootState) {
|
|
6699
6747
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -7134,7 +7182,7 @@ function Symbol(props) {
|
|
|
7134
7182
|
return props.builderContext.canTrack;
|
|
7135
7183
|
},
|
|
7136
7184
|
get model() {
|
|
7137
|
-
return props.symbol?.model;
|
|
7185
|
+
return props.symbol?.model ?? "";
|
|
7138
7186
|
},
|
|
7139
7187
|
get content() {
|
|
7140
7188
|
return contentToUse();
|
package/lib/node/dev.jsx
CHANGED
|
@@ -2087,10 +2087,10 @@ function SectionComponent(props) {
|
|
|
2087
2087
|
var section_default = SectionComponent;
|
|
2088
2088
|
|
|
2089
2089
|
// src/blocks/symbol/symbol.tsx
|
|
2090
|
-
import { onMount as
|
|
2090
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2091
2091
|
|
|
2092
2092
|
// src/components/content-variants/content-variants.tsx
|
|
2093
|
-
import { Show as Show16, For as For9, onMount as
|
|
2093
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
2094
2094
|
|
|
2095
2095
|
// src/helpers/url.ts
|
|
2096
2096
|
var getTopLevelDomain = (host) => {
|
|
@@ -4736,8 +4736,9 @@ var componentInfo20 = {
|
|
|
4736
4736
|
};
|
|
4737
4737
|
|
|
4738
4738
|
// src/blocks/video/video.tsx
|
|
4739
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4739
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4740
4740
|
function Video(props) {
|
|
4741
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4741
4742
|
const videoProps = createMemo15(() => {
|
|
4742
4743
|
return {
|
|
4743
4744
|
...props.autoPlay === true ? {
|
|
@@ -4762,6 +4763,36 @@ function Video(props) {
|
|
|
4762
4763
|
...videoProps()
|
|
4763
4764
|
};
|
|
4764
4765
|
});
|
|
4766
|
+
let videoRef;
|
|
4767
|
+
onMount6(() => {
|
|
4768
|
+
if (props.lazyLoad) {
|
|
4769
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4770
|
+
entries.forEach(function(entry) {
|
|
4771
|
+
if (!entry.isIntersecting)
|
|
4772
|
+
return;
|
|
4773
|
+
const videoElement = entry.target;
|
|
4774
|
+
try {
|
|
4775
|
+
Array.from(videoElement.children).filter(
|
|
4776
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4777
|
+
).forEach((source) => {
|
|
4778
|
+
const src = source.dataset.src;
|
|
4779
|
+
if (src) {
|
|
4780
|
+
source.src = src;
|
|
4781
|
+
}
|
|
4782
|
+
});
|
|
4783
|
+
videoElement.load();
|
|
4784
|
+
oberver.unobserve(videoElement);
|
|
4785
|
+
} catch (error2) {
|
|
4786
|
+
console.error("Error loading lazy video:", error2);
|
|
4787
|
+
}
|
|
4788
|
+
});
|
|
4789
|
+
});
|
|
4790
|
+
if (videoRef) {
|
|
4791
|
+
oberver.observe(videoRef);
|
|
4792
|
+
}
|
|
4793
|
+
setLazyVideoObserver(oberver);
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4765
4796
|
return <><div
|
|
4766
4797
|
style={{
|
|
4767
4798
|
position: "relative"
|
|
@@ -4770,7 +4801,8 @@ function Video(props) {
|
|
|
4770
4801
|
<video
|
|
4771
4802
|
class="builder-video"
|
|
4772
4803
|
{...spreadProps()}
|
|
4773
|
-
|
|
4804
|
+
ref={videoRef}
|
|
4805
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4774
4806
|
style={{
|
|
4775
4807
|
width: "100%",
|
|
4776
4808
|
height: "100%",
|
|
@@ -4784,9 +4816,15 @@ function Video(props) {
|
|
|
4784
4816
|
position: "absolute"
|
|
4785
4817
|
} : null
|
|
4786
4818
|
}}
|
|
4787
|
-
src={props.video || "no-src"}
|
|
4788
4819
|
poster={props.posterImage}
|
|
4789
|
-
><
|
|
4820
|
+
><source
|
|
4821
|
+
type="video/mp4"
|
|
4822
|
+
{...props.lazyLoad ? {
|
|
4823
|
+
"data-src": props.video
|
|
4824
|
+
} : {
|
|
4825
|
+
src: props.video
|
|
4826
|
+
}}
|
|
4827
|
+
/></video>
|
|
4790
4828
|
<Show13
|
|
4791
4829
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4792
4830
|
><div
|
|
@@ -4956,7 +4994,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4956
4994
|
// src/components/content/components/enable-editor.tsx
|
|
4957
4995
|
import {
|
|
4958
4996
|
Show as Show14,
|
|
4959
|
-
onMount as
|
|
4997
|
+
onMount as onMount7,
|
|
4960
4998
|
on as on3,
|
|
4961
4999
|
createEffect as createEffect3,
|
|
4962
5000
|
createMemo as createMemo16,
|
|
@@ -4970,7 +5008,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4970
5008
|
}
|
|
4971
5009
|
|
|
4972
5010
|
// src/constants/sdk-version.ts
|
|
4973
|
-
var SDK_VERSION = "
|
|
5011
|
+
var SDK_VERSION = "4.0.1";
|
|
4974
5012
|
|
|
4975
5013
|
// src/helpers/sdk-headers.ts
|
|
4976
5014
|
var getSdkHeaders = () => ({
|
|
@@ -5578,7 +5616,7 @@ var registerInsertMenu = () => {
|
|
|
5578
5616
|
});
|
|
5579
5617
|
};
|
|
5580
5618
|
var isSetupForEditing = false;
|
|
5581
|
-
var setupBrowserForEditing = (options
|
|
5619
|
+
var setupBrowserForEditing = (options) => {
|
|
5582
5620
|
if (isSetupForEditing) {
|
|
5583
5621
|
return;
|
|
5584
5622
|
}
|
|
@@ -5594,6 +5632,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5594
5632
|
// scope our '+ add block' button styling
|
|
5595
5633
|
supportsAddBlockScoping: true,
|
|
5596
5634
|
supportsCustomBreakpoints: true,
|
|
5635
|
+
modelName: options.modelName,
|
|
5636
|
+
apiKey: options.apiKey,
|
|
5597
5637
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5598
5638
|
blockLevelPersonalization: true
|
|
5599
5639
|
}
|
|
@@ -5686,6 +5726,15 @@ var createEditorListener = ({
|
|
|
5686
5726
|
callbacks.animation(data.data);
|
|
5687
5727
|
break;
|
|
5688
5728
|
}
|
|
5729
|
+
case "builder.resetState": {
|
|
5730
|
+
const messageContent = data.data;
|
|
5731
|
+
const modelName = messageContent.model;
|
|
5732
|
+
const newState = messageContent?.state;
|
|
5733
|
+
if (modelName === model && newState) {
|
|
5734
|
+
callbacks.stateUpdate(newState);
|
|
5735
|
+
}
|
|
5736
|
+
break;
|
|
5737
|
+
}
|
|
5689
5738
|
case "builder.contentUpdate": {
|
|
5690
5739
|
const messageContent = data.data;
|
|
5691
5740
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -5699,23 +5748,33 @@ var createEditorListener = ({
|
|
|
5699
5748
|
}
|
|
5700
5749
|
};
|
|
5701
5750
|
};
|
|
5702
|
-
var subscribeToEditor = (
|
|
5751
|
+
var subscribeToEditor = ({
|
|
5752
|
+
model,
|
|
5753
|
+
apiKey,
|
|
5754
|
+
callback,
|
|
5755
|
+
trustedHosts
|
|
5756
|
+
}) => {
|
|
5703
5757
|
if (!isBrowser) {
|
|
5704
5758
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5705
5759
|
return () => {
|
|
5706
5760
|
};
|
|
5707
5761
|
}
|
|
5708
|
-
setupBrowserForEditing(
|
|
5762
|
+
setupBrowserForEditing({
|
|
5763
|
+
modelName: model,
|
|
5764
|
+
apiKey
|
|
5765
|
+
});
|
|
5709
5766
|
const listener = createEditorListener({
|
|
5710
5767
|
callbacks: {
|
|
5711
5768
|
contentUpdate: callback,
|
|
5712
5769
|
animation: () => {
|
|
5713
5770
|
},
|
|
5714
5771
|
configureSdk: () => {
|
|
5772
|
+
},
|
|
5773
|
+
stateUpdate: () => {
|
|
5715
5774
|
}
|
|
5716
5775
|
},
|
|
5717
5776
|
model,
|
|
5718
|
-
trustedHosts
|
|
5777
|
+
trustedHosts
|
|
5719
5778
|
});
|
|
5720
5779
|
window.addEventListener("message", listener);
|
|
5721
5780
|
return () => {
|
|
@@ -5878,6 +5937,9 @@ function EnableEditor(props) {
|
|
|
5878
5937
|
},
|
|
5879
5938
|
contentUpdate: (newContent) => {
|
|
5880
5939
|
mergeNewContent(newContent);
|
|
5940
|
+
},
|
|
5941
|
+
stateUpdate: (newState) => {
|
|
5942
|
+
mergeNewRootState(newState);
|
|
5881
5943
|
}
|
|
5882
5944
|
}
|
|
5883
5945
|
})(event);
|
|
@@ -5956,7 +6018,7 @@ function EnableEditor(props) {
|
|
|
5956
6018
|
let elementRef;
|
|
5957
6019
|
runHttpRequests();
|
|
5958
6020
|
emitStateUpdate();
|
|
5959
|
-
|
|
6021
|
+
onMount7(() => {
|
|
5960
6022
|
if (isBrowser()) {
|
|
5961
6023
|
if (isEditing() && !props.isNestedRender) {
|
|
5962
6024
|
window.addEventListener("message", processMessage);
|
|
@@ -5970,12 +6032,14 @@ function EnableEditor(props) {
|
|
|
5970
6032
|
} : {},
|
|
5971
6033
|
...props.trustedHosts ? {
|
|
5972
6034
|
trustedHosts: props.trustedHosts
|
|
5973
|
-
} : {}
|
|
6035
|
+
} : {},
|
|
6036
|
+
modelName: props.model ?? "",
|
|
6037
|
+
apiKey: props.apiKey
|
|
5974
6038
|
});
|
|
5975
6039
|
Object.values(
|
|
5976
6040
|
props.builderContextSignal.componentInfos
|
|
5977
6041
|
).forEach((registeredComponent) => {
|
|
5978
|
-
if (!
|
|
6042
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5979
6043
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5980
6044
|
window.parent?.postMessage(message, "*");
|
|
5981
6045
|
}
|
|
@@ -6008,7 +6072,7 @@ function EnableEditor(props) {
|
|
|
6008
6072
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6009
6073
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6010
6074
|
fetchOneEntry({
|
|
6011
|
-
model: props.model
|
|
6075
|
+
model: props.model,
|
|
6012
6076
|
apiKey: props.apiKey,
|
|
6013
6077
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6014
6078
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6196,7 +6260,7 @@ function ContentComponent(props) {
|
|
|
6196
6260
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6197
6261
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6198
6262
|
nonce: props.nonce || "",
|
|
6199
|
-
model: props.model
|
|
6263
|
+
model: props.model
|
|
6200
6264
|
});
|
|
6201
6265
|
function contentSetState(newRootState) {
|
|
6202
6266
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6301,7 +6365,7 @@ function ContentVariants(props) {
|
|
|
6301
6365
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6302
6366
|
});
|
|
6303
6367
|
});
|
|
6304
|
-
|
|
6368
|
+
onMount8(() => {
|
|
6305
6369
|
setShouldRenderVariants(false);
|
|
6306
6370
|
});
|
|
6307
6371
|
return <><>
|
|
@@ -6431,7 +6495,7 @@ function Symbol(props) {
|
|
|
6431
6495
|
}
|
|
6432
6496
|
});
|
|
6433
6497
|
}
|
|
6434
|
-
|
|
6498
|
+
onMount9(() => {
|
|
6435
6499
|
});
|
|
6436
6500
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6437
6501
|
function onUpdateFn_0() {
|
|
@@ -6454,7 +6518,7 @@ function Symbol(props) {
|
|
|
6454
6518
|
...contentToUse()?.data?.state
|
|
6455
6519
|
}}
|
|
6456
6520
|
canTrack={props.builderContext.canTrack}
|
|
6457
|
-
model={props.symbol?.model}
|
|
6521
|
+
model={props.symbol?.model ?? ""}
|
|
6458
6522
|
content={contentToUse()}
|
|
6459
6523
|
linkComponent={props.builderLinkComponent}
|
|
6460
6524
|
blocksWrapper={blocksWrapper()}
|