@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/edge/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
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -8234,10 +8234,10 @@ var componentInfo20 = {
|
|
|
8234
8234
|
builderBlock: true
|
|
8235
8235
|
}
|
|
8236
8236
|
};
|
|
8237
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
8238
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
8239
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
8237
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
8238
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
8240
8239
|
function Video(props) {
|
|
8240
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8241
8241
|
const videoProps = createMemo(() => {
|
|
8242
8242
|
return {
|
|
8243
8243
|
...props.autoPlay === true ? {
|
|
@@ -8262,12 +8262,42 @@ function Video(props) {
|
|
|
8262
8262
|
...videoProps()
|
|
8263
8263
|
};
|
|
8264
8264
|
});
|
|
8265
|
+
let videoRef;
|
|
8266
|
+
onMount(() => {
|
|
8267
|
+
if (props.lazyLoad) {
|
|
8268
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
8269
|
+
entries.forEach(function(entry) {
|
|
8270
|
+
if (!entry.isIntersecting)
|
|
8271
|
+
return;
|
|
8272
|
+
const videoElement = entry.target;
|
|
8273
|
+
try {
|
|
8274
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
8275
|
+
const src = source.dataset.src;
|
|
8276
|
+
if (src) {
|
|
8277
|
+
source.src = src;
|
|
8278
|
+
}
|
|
8279
|
+
});
|
|
8280
|
+
videoElement.load();
|
|
8281
|
+
oberver.unobserve(videoElement);
|
|
8282
|
+
} catch (error) {
|
|
8283
|
+
console.error("Error loading lazy video:", error);
|
|
8284
|
+
}
|
|
8285
|
+
});
|
|
8286
|
+
});
|
|
8287
|
+
if (videoRef) {
|
|
8288
|
+
oberver.observe(videoRef);
|
|
8289
|
+
}
|
|
8290
|
+
setLazyVideoObserver(oberver);
|
|
8291
|
+
}
|
|
8292
|
+
});
|
|
8265
8293
|
return (() => {
|
|
8266
|
-
const _el$ = _tmpl$
|
|
8294
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8267
8295
|
_el$.style.setProperty("position", "relative");
|
|
8296
|
+
const _ref$ = videoRef;
|
|
8297
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
8268
8298
|
spread(_el$2, mergeProps(spreadProps, {
|
|
8269
8299
|
get preload() {
|
|
8270
|
-
return props.preload || "metadata";
|
|
8300
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
8271
8301
|
},
|
|
8272
8302
|
get style() {
|
|
8273
8303
|
return {
|
|
@@ -8284,29 +8314,21 @@ function Video(props) {
|
|
|
8284
8314
|
} : null
|
|
8285
8315
|
};
|
|
8286
8316
|
},
|
|
8287
|
-
get src() {
|
|
8288
|
-
return props.video || "no-src";
|
|
8289
|
-
},
|
|
8290
8317
|
get poster() {
|
|
8291
8318
|
return props.posterImage;
|
|
8292
8319
|
}
|
|
8293
8320
|
}), false, true);
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
const _el$3 = _tmpl$21();
|
|
8300
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
8301
|
-
return _el$3;
|
|
8302
|
-
}
|
|
8303
|
-
}));
|
|
8321
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
8322
|
+
"data-src": props.video
|
|
8323
|
+
} : {
|
|
8324
|
+
src: props.video
|
|
8325
|
+
}), false, false);
|
|
8304
8326
|
insert(_el$, createComponent(Show, {
|
|
8305
8327
|
get when() {
|
|
8306
8328
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
8307
8329
|
},
|
|
8308
8330
|
get children() {
|
|
8309
|
-
const _el$4 = _tmpl$
|
|
8331
|
+
const _el$4 = _tmpl$21();
|
|
8310
8332
|
_el$4.style.setProperty("width", "100%");
|
|
8311
8333
|
_el$4.style.setProperty("pointer-events", "none");
|
|
8312
8334
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -8319,7 +8341,7 @@ function Video(props) {
|
|
|
8319
8341
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
8320
8342
|
},
|
|
8321
8343
|
get children() {
|
|
8322
|
-
const _el$5 = _tmpl$
|
|
8344
|
+
const _el$5 = _tmpl$21();
|
|
8323
8345
|
_el$5.style.setProperty("display", "flex");
|
|
8324
8346
|
_el$5.style.setProperty("flex-direction", "column");
|
|
8325
8347
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -8332,7 +8354,7 @@ function Video(props) {
|
|
|
8332
8354
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
8333
8355
|
},
|
|
8334
8356
|
get children() {
|
|
8335
|
-
const _el$6 = _tmpl$
|
|
8357
|
+
const _el$6 = _tmpl$21();
|
|
8336
8358
|
_el$6.style.setProperty("pointer-events", "none");
|
|
8337
8359
|
_el$6.style.setProperty("display", "flex");
|
|
8338
8360
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -8489,7 +8511,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8489
8511
|
}
|
|
8490
8512
|
|
|
8491
8513
|
// src/constants/sdk-version.ts
|
|
8492
|
-
var SDK_VERSION = "
|
|
8514
|
+
var SDK_VERSION = "4.0.1";
|
|
8493
8515
|
|
|
8494
8516
|
// src/helpers/sdk-headers.ts
|
|
8495
8517
|
var getSdkHeaders = () => ({
|
|
@@ -9097,7 +9119,7 @@ var registerInsertMenu = () => {
|
|
|
9097
9119
|
});
|
|
9098
9120
|
};
|
|
9099
9121
|
var isSetupForEditing = false;
|
|
9100
|
-
var setupBrowserForEditing = (options
|
|
9122
|
+
var setupBrowserForEditing = (options) => {
|
|
9101
9123
|
if (isSetupForEditing) {
|
|
9102
9124
|
return;
|
|
9103
9125
|
}
|
|
@@ -9113,6 +9135,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
9113
9135
|
// scope our '+ add block' button styling
|
|
9114
9136
|
supportsAddBlockScoping: true,
|
|
9115
9137
|
supportsCustomBreakpoints: true,
|
|
9138
|
+
modelName: options.modelName,
|
|
9139
|
+
apiKey: options.apiKey,
|
|
9116
9140
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
9117
9141
|
blockLevelPersonalization: true
|
|
9118
9142
|
}
|
|
@@ -9205,6 +9229,15 @@ var createEditorListener = ({
|
|
|
9205
9229
|
callbacks.animation(data.data);
|
|
9206
9230
|
break;
|
|
9207
9231
|
}
|
|
9232
|
+
case "builder.resetState": {
|
|
9233
|
+
const messageContent = data.data;
|
|
9234
|
+
const modelName = messageContent.model;
|
|
9235
|
+
const newState = messageContent?.state;
|
|
9236
|
+
if (modelName === model && newState) {
|
|
9237
|
+
callbacks.stateUpdate(newState);
|
|
9238
|
+
}
|
|
9239
|
+
break;
|
|
9240
|
+
}
|
|
9208
9241
|
case "builder.contentUpdate": {
|
|
9209
9242
|
const messageContent = data.data;
|
|
9210
9243
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -9218,23 +9251,33 @@ var createEditorListener = ({
|
|
|
9218
9251
|
}
|
|
9219
9252
|
};
|
|
9220
9253
|
};
|
|
9221
|
-
var subscribeToEditor = (
|
|
9254
|
+
var subscribeToEditor = ({
|
|
9255
|
+
model,
|
|
9256
|
+
apiKey,
|
|
9257
|
+
callback,
|
|
9258
|
+
trustedHosts
|
|
9259
|
+
}) => {
|
|
9222
9260
|
if (!isBrowser) {
|
|
9223
9261
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
9224
9262
|
return () => {
|
|
9225
9263
|
};
|
|
9226
9264
|
}
|
|
9227
|
-
setupBrowserForEditing(
|
|
9265
|
+
setupBrowserForEditing({
|
|
9266
|
+
modelName: model,
|
|
9267
|
+
apiKey
|
|
9268
|
+
});
|
|
9228
9269
|
const listener = createEditorListener({
|
|
9229
9270
|
callbacks: {
|
|
9230
9271
|
contentUpdate: callback,
|
|
9231
9272
|
animation: () => {
|
|
9232
9273
|
},
|
|
9233
9274
|
configureSdk: () => {
|
|
9275
|
+
},
|
|
9276
|
+
stateUpdate: () => {
|
|
9234
9277
|
}
|
|
9235
9278
|
},
|
|
9236
9279
|
model,
|
|
9237
|
-
trustedHosts
|
|
9280
|
+
trustedHosts
|
|
9238
9281
|
});
|
|
9239
9282
|
window.addEventListener("message", listener);
|
|
9240
9283
|
return () => {
|
|
@@ -9398,6 +9441,9 @@ function EnableEditor(props) {
|
|
|
9398
9441
|
},
|
|
9399
9442
|
contentUpdate: (newContent) => {
|
|
9400
9443
|
mergeNewContent(newContent);
|
|
9444
|
+
},
|
|
9445
|
+
stateUpdate: (newState) => {
|
|
9446
|
+
mergeNewRootState(newState);
|
|
9401
9447
|
}
|
|
9402
9448
|
}
|
|
9403
9449
|
})(event);
|
|
@@ -9480,10 +9526,12 @@ function EnableEditor(props) {
|
|
|
9480
9526
|
} : {},
|
|
9481
9527
|
...props.trustedHosts ? {
|
|
9482
9528
|
trustedHosts: props.trustedHosts
|
|
9483
|
-
} : {}
|
|
9529
|
+
} : {},
|
|
9530
|
+
modelName: props.model ?? "",
|
|
9531
|
+
apiKey: props.apiKey
|
|
9484
9532
|
});
|
|
9485
9533
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
9486
|
-
if (!
|
|
9534
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
9487
9535
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
9488
9536
|
window.parent?.postMessage(message, "*");
|
|
9489
9537
|
}
|
|
@@ -9511,7 +9559,7 @@ function EnableEditor(props) {
|
|
|
9511
9559
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9512
9560
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9513
9561
|
fetchOneEntry({
|
|
9514
|
-
model: props.model
|
|
9562
|
+
model: props.model,
|
|
9515
9563
|
apiKey: props.apiKey,
|
|
9516
9564
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9517
9565
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9705,7 +9753,7 @@ function ContentComponent(props) {
|
|
|
9705
9753
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9706
9754
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9707
9755
|
nonce: props.nonce || "",
|
|
9708
|
-
model: props.model
|
|
9756
|
+
model: props.model
|
|
9709
9757
|
});
|
|
9710
9758
|
function contentSetState(newRootState) {
|
|
9711
9759
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -10146,7 +10194,7 @@ function Symbol2(props) {
|
|
|
10146
10194
|
return props.builderContext.canTrack;
|
|
10147
10195
|
},
|
|
10148
10196
|
get model() {
|
|
10149
|
-
return props.symbol?.model;
|
|
10197
|
+
return props.symbol?.model ?? "";
|
|
10150
10198
|
},
|
|
10151
10199
|
get content() {
|
|
10152
10200
|
return contentToUse();
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -5099,10 +5099,10 @@ function SectionComponent(props) {
|
|
|
5099
5099
|
var section_default = SectionComponent;
|
|
5100
5100
|
|
|
5101
5101
|
// src/blocks/symbol/symbol.tsx
|
|
5102
|
-
import { onMount as
|
|
5102
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
5103
5103
|
|
|
5104
5104
|
// src/components/content-variants/content-variants.tsx
|
|
5105
|
-
import { Show as Show16, For as For9, onMount as
|
|
5105
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
5106
5106
|
|
|
5107
5107
|
// src/helpers/url.ts
|
|
5108
5108
|
var getTopLevelDomain = (host) => {
|
|
@@ -7748,8 +7748,9 @@ var componentInfo20 = {
|
|
|
7748
7748
|
};
|
|
7749
7749
|
|
|
7750
7750
|
// src/blocks/video/video.tsx
|
|
7751
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
7751
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
7752
7752
|
function Video(props) {
|
|
7753
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
7753
7754
|
const videoProps = createMemo15(() => {
|
|
7754
7755
|
return {
|
|
7755
7756
|
...props.autoPlay === true ? {
|
|
@@ -7774,6 +7775,36 @@ function Video(props) {
|
|
|
7774
7775
|
...videoProps()
|
|
7775
7776
|
};
|
|
7776
7777
|
});
|
|
7778
|
+
let videoRef;
|
|
7779
|
+
onMount6(() => {
|
|
7780
|
+
if (props.lazyLoad) {
|
|
7781
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
7782
|
+
entries.forEach(function(entry) {
|
|
7783
|
+
if (!entry.isIntersecting)
|
|
7784
|
+
return;
|
|
7785
|
+
const videoElement = entry.target;
|
|
7786
|
+
try {
|
|
7787
|
+
Array.from(videoElement.children).filter(
|
|
7788
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
7789
|
+
).forEach((source) => {
|
|
7790
|
+
const src = source.dataset.src;
|
|
7791
|
+
if (src) {
|
|
7792
|
+
source.src = src;
|
|
7793
|
+
}
|
|
7794
|
+
});
|
|
7795
|
+
videoElement.load();
|
|
7796
|
+
oberver.unobserve(videoElement);
|
|
7797
|
+
} catch (error) {
|
|
7798
|
+
console.error("Error loading lazy video:", error);
|
|
7799
|
+
}
|
|
7800
|
+
});
|
|
7801
|
+
});
|
|
7802
|
+
if (videoRef) {
|
|
7803
|
+
oberver.observe(videoRef);
|
|
7804
|
+
}
|
|
7805
|
+
setLazyVideoObserver(oberver);
|
|
7806
|
+
}
|
|
7807
|
+
});
|
|
7777
7808
|
return <><div
|
|
7778
7809
|
style={{
|
|
7779
7810
|
position: "relative"
|
|
@@ -7782,7 +7813,8 @@ function Video(props) {
|
|
|
7782
7813
|
<video
|
|
7783
7814
|
class="builder-video"
|
|
7784
7815
|
{...spreadProps()}
|
|
7785
|
-
|
|
7816
|
+
ref={videoRef}
|
|
7817
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
7786
7818
|
style={{
|
|
7787
7819
|
width: "100%",
|
|
7788
7820
|
height: "100%",
|
|
@@ -7796,9 +7828,15 @@ function Video(props) {
|
|
|
7796
7828
|
position: "absolute"
|
|
7797
7829
|
} : null
|
|
7798
7830
|
}}
|
|
7799
|
-
src={props.video || "no-src"}
|
|
7800
7831
|
poster={props.posterImage}
|
|
7801
|
-
><
|
|
7832
|
+
><source
|
|
7833
|
+
type="video/mp4"
|
|
7834
|
+
{...props.lazyLoad ? {
|
|
7835
|
+
"data-src": props.video
|
|
7836
|
+
} : {
|
|
7837
|
+
src: props.video
|
|
7838
|
+
}}
|
|
7839
|
+
/></video>
|
|
7802
7840
|
<Show13
|
|
7803
7841
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
7804
7842
|
><div
|
|
@@ -7968,7 +8006,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
7968
8006
|
// src/components/content/components/enable-editor.tsx
|
|
7969
8007
|
import {
|
|
7970
8008
|
Show as Show14,
|
|
7971
|
-
onMount as
|
|
8009
|
+
onMount as onMount7,
|
|
7972
8010
|
on as on3,
|
|
7973
8011
|
createEffect as createEffect3,
|
|
7974
8012
|
createMemo as createMemo16,
|
|
@@ -7982,7 +8020,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7982
8020
|
}
|
|
7983
8021
|
|
|
7984
8022
|
// src/constants/sdk-version.ts
|
|
7985
|
-
var SDK_VERSION = "
|
|
8023
|
+
var SDK_VERSION = "4.0.1";
|
|
7986
8024
|
|
|
7987
8025
|
// src/helpers/sdk-headers.ts
|
|
7988
8026
|
var getSdkHeaders = () => ({
|
|
@@ -8590,7 +8628,7 @@ var registerInsertMenu = () => {
|
|
|
8590
8628
|
});
|
|
8591
8629
|
};
|
|
8592
8630
|
var isSetupForEditing = false;
|
|
8593
|
-
var setupBrowserForEditing = (options
|
|
8631
|
+
var setupBrowserForEditing = (options) => {
|
|
8594
8632
|
if (isSetupForEditing) {
|
|
8595
8633
|
return;
|
|
8596
8634
|
}
|
|
@@ -8606,6 +8644,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
8606
8644
|
// scope our '+ add block' button styling
|
|
8607
8645
|
supportsAddBlockScoping: true,
|
|
8608
8646
|
supportsCustomBreakpoints: true,
|
|
8647
|
+
modelName: options.modelName,
|
|
8648
|
+
apiKey: options.apiKey,
|
|
8609
8649
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
8610
8650
|
blockLevelPersonalization: true
|
|
8611
8651
|
}
|
|
@@ -8698,6 +8738,15 @@ var createEditorListener = ({
|
|
|
8698
8738
|
callbacks.animation(data.data);
|
|
8699
8739
|
break;
|
|
8700
8740
|
}
|
|
8741
|
+
case "builder.resetState": {
|
|
8742
|
+
const messageContent = data.data;
|
|
8743
|
+
const modelName = messageContent.model;
|
|
8744
|
+
const newState = messageContent?.state;
|
|
8745
|
+
if (modelName === model && newState) {
|
|
8746
|
+
callbacks.stateUpdate(newState);
|
|
8747
|
+
}
|
|
8748
|
+
break;
|
|
8749
|
+
}
|
|
8701
8750
|
case "builder.contentUpdate": {
|
|
8702
8751
|
const messageContent = data.data;
|
|
8703
8752
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -8711,23 +8760,33 @@ var createEditorListener = ({
|
|
|
8711
8760
|
}
|
|
8712
8761
|
};
|
|
8713
8762
|
};
|
|
8714
|
-
var subscribeToEditor = (
|
|
8763
|
+
var subscribeToEditor = ({
|
|
8764
|
+
model,
|
|
8765
|
+
apiKey,
|
|
8766
|
+
callback,
|
|
8767
|
+
trustedHosts
|
|
8768
|
+
}) => {
|
|
8715
8769
|
if (!isBrowser) {
|
|
8716
8770
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
8717
8771
|
return () => {
|
|
8718
8772
|
};
|
|
8719
8773
|
}
|
|
8720
|
-
setupBrowserForEditing(
|
|
8774
|
+
setupBrowserForEditing({
|
|
8775
|
+
modelName: model,
|
|
8776
|
+
apiKey
|
|
8777
|
+
});
|
|
8721
8778
|
const listener = createEditorListener({
|
|
8722
8779
|
callbacks: {
|
|
8723
8780
|
contentUpdate: callback,
|
|
8724
8781
|
animation: () => {
|
|
8725
8782
|
},
|
|
8726
8783
|
configureSdk: () => {
|
|
8784
|
+
},
|
|
8785
|
+
stateUpdate: () => {
|
|
8727
8786
|
}
|
|
8728
8787
|
},
|
|
8729
8788
|
model,
|
|
8730
|
-
trustedHosts
|
|
8789
|
+
trustedHosts
|
|
8731
8790
|
});
|
|
8732
8791
|
window.addEventListener("message", listener);
|
|
8733
8792
|
return () => {
|
|
@@ -8890,6 +8949,9 @@ function EnableEditor(props) {
|
|
|
8890
8949
|
},
|
|
8891
8950
|
contentUpdate: (newContent) => {
|
|
8892
8951
|
mergeNewContent(newContent);
|
|
8952
|
+
},
|
|
8953
|
+
stateUpdate: (newState) => {
|
|
8954
|
+
mergeNewRootState(newState);
|
|
8893
8955
|
}
|
|
8894
8956
|
}
|
|
8895
8957
|
})(event);
|
|
@@ -8968,7 +9030,7 @@ function EnableEditor(props) {
|
|
|
8968
9030
|
let elementRef;
|
|
8969
9031
|
runHttpRequests();
|
|
8970
9032
|
emitStateUpdate();
|
|
8971
|
-
|
|
9033
|
+
onMount7(() => {
|
|
8972
9034
|
if (isBrowser()) {
|
|
8973
9035
|
if (isEditing() && !props.isNestedRender) {
|
|
8974
9036
|
window.addEventListener("message", processMessage);
|
|
@@ -8982,12 +9044,14 @@ function EnableEditor(props) {
|
|
|
8982
9044
|
} : {},
|
|
8983
9045
|
...props.trustedHosts ? {
|
|
8984
9046
|
trustedHosts: props.trustedHosts
|
|
8985
|
-
} : {}
|
|
9047
|
+
} : {},
|
|
9048
|
+
modelName: props.model ?? "",
|
|
9049
|
+
apiKey: props.apiKey
|
|
8986
9050
|
});
|
|
8987
9051
|
Object.values(
|
|
8988
9052
|
props.builderContextSignal.componentInfos
|
|
8989
9053
|
).forEach((registeredComponent) => {
|
|
8990
|
-
if (!
|
|
9054
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8991
9055
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
8992
9056
|
window.parent?.postMessage(message, "*");
|
|
8993
9057
|
}
|
|
@@ -9020,7 +9084,7 @@ function EnableEditor(props) {
|
|
|
9020
9084
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9021
9085
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9022
9086
|
fetchOneEntry({
|
|
9023
|
-
model: props.model
|
|
9087
|
+
model: props.model,
|
|
9024
9088
|
apiKey: props.apiKey,
|
|
9025
9089
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9026
9090
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9208,7 +9272,7 @@ function ContentComponent(props) {
|
|
|
9208
9272
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9209
9273
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9210
9274
|
nonce: props.nonce || "",
|
|
9211
|
-
model: props.model
|
|
9275
|
+
model: props.model
|
|
9212
9276
|
});
|
|
9213
9277
|
function contentSetState(newRootState) {
|
|
9214
9278
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -9313,7 +9377,7 @@ function ContentVariants(props) {
|
|
|
9313
9377
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
9314
9378
|
});
|
|
9315
9379
|
});
|
|
9316
|
-
|
|
9380
|
+
onMount8(() => {
|
|
9317
9381
|
setShouldRenderVariants(false);
|
|
9318
9382
|
});
|
|
9319
9383
|
return <><>
|
|
@@ -9443,7 +9507,7 @@ function Symbol2(props) {
|
|
|
9443
9507
|
}
|
|
9444
9508
|
});
|
|
9445
9509
|
}
|
|
9446
|
-
|
|
9510
|
+
onMount9(() => {
|
|
9447
9511
|
});
|
|
9448
9512
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
9449
9513
|
function onUpdateFn_0() {
|
|
@@ -9466,7 +9530,7 @@ function Symbol2(props) {
|
|
|
9466
9530
|
...contentToUse()?.data?.state
|
|
9467
9531
|
}}
|
|
9468
9532
|
canTrack={props.builderContext.canTrack}
|
|
9469
|
-
model={props.symbol?.model}
|
|
9533
|
+
model={props.symbol?.model ?? ""}
|
|
9470
9534
|
content={contentToUse()}
|
|
9471
9535
|
linkComponent={props.builderLinkComponent}
|
|
9472
9536
|
blocksWrapper={blocksWrapper()}
|