@builder.io/sdk-solid 3.0.6 → 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/lib/edge/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
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, {
@@ -4111,8 +4111,13 @@ var provideBuilderContext = (block, context) => {
4111
4111
 
4112
4112
  // src/constants/device-sizes.ts
4113
4113
  var SIZES = {
4114
+ xsmall: {
4115
+ min: 0,
4116
+ default: 160,
4117
+ max: 320
4118
+ },
4114
4119
  small: {
4115
- min: 320,
4120
+ min: 321,
4116
4121
  default: 321,
4117
4122
  max: 640
4118
4123
  },
@@ -4128,15 +4133,28 @@ var SIZES = {
4128
4133
  }
4129
4134
  };
4130
4135
  var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
4131
- var getSizesForBreakpoints = ({
4132
- small,
4133
- medium
4134
- }) => {
4136
+ var getSizesForBreakpoints = (breakpoints) => {
4135
4137
  const newSizes = fastClone(SIZES);
4138
+ if (!breakpoints) {
4139
+ return newSizes;
4140
+ }
4141
+ const {
4142
+ xsmall,
4143
+ small,
4144
+ medium
4145
+ } = breakpoints;
4146
+ if (xsmall) {
4147
+ const xsmallMin = Math.floor(xsmall / 2);
4148
+ newSizes.xsmall = {
4149
+ max: xsmall,
4150
+ min: xsmallMin,
4151
+ default: xsmallMin + 1
4152
+ };
4153
+ }
4136
4154
  if (!small || !medium) {
4137
4155
  return newSizes;
4138
4156
  }
4139
- const smallMin = Math.floor(small / 2);
4157
+ const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
4140
4158
  newSizes.small = {
4141
4159
  max: small,
4142
4160
  min: smallMin,
@@ -4194,9 +4212,11 @@ function BlockStyles(props) {
4194
4212
  const styles = processedBlock.responsiveStyles;
4195
4213
  const content = props.context.content;
4196
4214
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
4215
+ const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
4197
4216
  const largeStyles = styles?.large;
4198
4217
  const mediumStyles = styles?.medium;
4199
4218
  const smallStyles = styles?.small;
4219
+ const xsmallStyles = styles?.xsmall;
4200
4220
  const className = processedBlock.id;
4201
4221
  if (!className) {
4202
4222
  return "";
@@ -4215,6 +4235,11 @@ function BlockStyles(props) {
4215
4235
  styles: smallStyles,
4216
4236
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
4217
4237
  }) : "";
4238
+ const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
4239
+ className,
4240
+ styles: xsmallStyles,
4241
+ mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
4242
+ }) : "";
4218
4243
  const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
4219
4244
  let hoverStylesClass = "";
4220
4245
  if (hoverAnimation) {
@@ -4228,7 +4253,7 @@ function BlockStyles(props) {
4228
4253
  }
4229
4254
  }) || "";
4230
4255
  }
4231
- return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
4256
+ return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
4232
4257
  });
4233
4258
  return createComponent(Show, {
4234
4259
  get when() {
@@ -8196,10 +8221,10 @@ var componentInfo20 = {
8196
8221
  builderBlock: true
8197
8222
  }
8198
8223
  };
8199
- var _tmpl$21 = /* @__PURE__ */ template(`<source type=video/mp4>`);
8200
- var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
8201
- var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
8224
+ var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
8225
+ var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
8202
8226
  function Video(props) {
8227
+ const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
8203
8228
  const videoProps = createMemo(() => {
8204
8229
  return {
8205
8230
  ...props.autoPlay === true ? {
@@ -8224,12 +8249,41 @@ function Video(props) {
8224
8249
  ...videoProps()
8225
8250
  };
8226
8251
  });
8252
+ let videoRef;
8253
+ onMount(() => {
8254
+ if (props.lazyLoad) {
8255
+ const oberver = new IntersectionObserver(function(entries) {
8256
+ entries.forEach(function(entry) {
8257
+ if (!entry.isIntersecting)
8258
+ return;
8259
+ const videoElement = entry.target;
8260
+ try {
8261
+ Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
8262
+ const src = source.dataset.src;
8263
+ if (src) {
8264
+ source.src = src;
8265
+ }
8266
+ });
8267
+ videoElement.load();
8268
+ oberver.unobserve(videoElement);
8269
+ } catch (error) {
8270
+ }
8271
+ });
8272
+ });
8273
+ if (videoRef) {
8274
+ oberver.observe(videoRef);
8275
+ }
8276
+ setLazyVideoObserver(oberver);
8277
+ }
8278
+ });
8227
8279
  return (() => {
8228
- const _el$ = _tmpl$35(), _el$2 = _el$.firstChild;
8280
+ const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
8229
8281
  _el$.style.setProperty("position", "relative");
8282
+ const _ref$ = videoRef;
8283
+ typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
8230
8284
  spread(_el$2, mergeProps(spreadProps, {
8231
8285
  get preload() {
8232
- return props.preload || "metadata";
8286
+ return props.lazyLoad ? "none" : props.preload || "metadata";
8233
8287
  },
8234
8288
  get style() {
8235
8289
  return {
@@ -8246,29 +8300,21 @@ function Video(props) {
8246
8300
  } : null
8247
8301
  };
8248
8302
  },
8249
- get src() {
8250
- return props.video || "no-src";
8251
- },
8252
8303
  get poster() {
8253
8304
  return props.posterImage;
8254
8305
  }
8255
8306
  }), false, true);
8256
- insert(_el$2, createComponent(Show, {
8257
- get when() {
8258
- return !props.lazyLoad;
8259
- },
8260
- get children() {
8261
- const _el$3 = _tmpl$21();
8262
- effect(() => setAttribute(_el$3, "src", props.video));
8263
- return _el$3;
8264
- }
8265
- }));
8307
+ spread(_el$3, mergeProps(() => props.lazyLoad ? {
8308
+ "data-src": props.video
8309
+ } : {
8310
+ src: props.video
8311
+ }), false, false);
8266
8312
  insert(_el$, createComponent(Show, {
8267
8313
  get when() {
8268
8314
  return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
8269
8315
  },
8270
8316
  get children() {
8271
- const _el$4 = _tmpl$29();
8317
+ const _el$4 = _tmpl$21();
8272
8318
  _el$4.style.setProperty("width", "100%");
8273
8319
  _el$4.style.setProperty("pointer-events", "none");
8274
8320
  _el$4.style.setProperty("font-size", "0px");
@@ -8281,7 +8327,7 @@ function Video(props) {
8281
8327
  return props.builderBlock?.children?.length && props.fitContent;
8282
8328
  },
8283
8329
  get children() {
8284
- const _el$5 = _tmpl$29();
8330
+ const _el$5 = _tmpl$21();
8285
8331
  _el$5.style.setProperty("display", "flex");
8286
8332
  _el$5.style.setProperty("flex-direction", "column");
8287
8333
  _el$5.style.setProperty("align-items", "stretch");
@@ -8294,7 +8340,7 @@ function Video(props) {
8294
8340
  return props.builderBlock?.children?.length && !props.fitContent;
8295
8341
  },
8296
8342
  get children() {
8297
- const _el$6 = _tmpl$29();
8343
+ const _el$6 = _tmpl$21();
8298
8344
  _el$6.style.setProperty("pointer-events", "none");
8299
8345
  _el$6.style.setProperty("display", "flex");
8300
8346
  _el$6.style.setProperty("flex-direction", "column");
@@ -8451,7 +8497,7 @@ function getPreviewContent(_searchParams) {
8451
8497
  }
8452
8498
 
8453
8499
  // src/constants/sdk-version.ts
8454
- var SDK_VERSION = "3.0.6";
8500
+ var SDK_VERSION = "4.0.0";
8455
8501
 
8456
8502
  // src/helpers/sdk-headers.ts
8457
8503
  var getSdkHeaders = () => ({
@@ -9053,7 +9099,7 @@ var registerInsertMenu = () => {
9053
9099
  });
9054
9100
  };
9055
9101
  var isSetupForEditing = false;
9056
- var setupBrowserForEditing = (options = {}) => {
9102
+ var setupBrowserForEditing = (options) => {
9057
9103
  if (isSetupForEditing) {
9058
9104
  return;
9059
9105
  }
@@ -9069,6 +9115,9 @@ var setupBrowserForEditing = (options = {}) => {
9069
9115
  // scope our '+ add block' button styling
9070
9116
  supportsAddBlockScoping: true,
9071
9117
  supportsCustomBreakpoints: true,
9118
+ modelName: options.modelName,
9119
+ apiKey: options.apiKey,
9120
+ supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
9072
9121
  blockLevelPersonalization: true
9073
9122
  }
9074
9123
  }, "*");
@@ -9173,13 +9222,21 @@ var createEditorListener = ({
9173
9222
  }
9174
9223
  };
9175
9224
  };
9176
- var subscribeToEditor = (model, callback, options) => {
9225
+ var subscribeToEditor = ({
9226
+ model,
9227
+ apiKey,
9228
+ callback,
9229
+ trustedHosts
9230
+ }) => {
9177
9231
  if (!isBrowser) {
9178
9232
  logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
9179
9233
  return () => {
9180
9234
  };
9181
9235
  }
9182
- setupBrowserForEditing();
9236
+ setupBrowserForEditing({
9237
+ modelName: model,
9238
+ apiKey
9239
+ });
9183
9240
  const listener = createEditorListener({
9184
9241
  callbacks: {
9185
9242
  contentUpdate: callback,
@@ -9189,7 +9246,7 @@ var subscribeToEditor = (model, callback, options) => {
9189
9246
  }
9190
9247
  },
9191
9248
  model,
9192
- trustedHosts: options?.trustedHosts
9249
+ trustedHosts
9193
9250
  });
9194
9251
  window.addEventListener("message", listener);
9195
9252
  return () => {
@@ -9434,10 +9491,12 @@ function EnableEditor(props) {
9434
9491
  } : {},
9435
9492
  ...props.trustedHosts ? {
9436
9493
  trustedHosts: props.trustedHosts
9437
- } : {}
9494
+ } : {},
9495
+ modelName: props.model ?? "",
9496
+ apiKey: props.apiKey
9438
9497
  });
9439
9498
  Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
9440
- if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
9499
+ if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
9441
9500
  const message = createRegisterComponentMessage(registeredComponent);
9442
9501
  window.parent?.postMessage(message, "*");
9443
9502
  }
@@ -9465,7 +9524,7 @@ function EnableEditor(props) {
9465
9524
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
9466
9525
  if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
9467
9526
  fetchOneEntry({
9468
- model: props.model || "",
9527
+ model: props.model,
9469
9528
  apiKey: props.apiKey,
9470
9529
  apiVersion: props.builderContextSignal.apiVersion,
9471
9530
  ...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
@@ -9659,7 +9718,7 @@ function ContentComponent(props) {
9659
9718
  BlocksWrapper: props.blocksWrapper || "div",
9660
9719
  BlocksWrapperProps: props.blocksWrapperProps || {},
9661
9720
  nonce: props.nonce || "",
9662
- model: props.model || ""
9721
+ model: props.model
9663
9722
  });
9664
9723
  function contentSetState(newRootState) {
9665
9724
  setBuilderContextSignal((PREVIOUS_VALUE) => ({
@@ -10100,7 +10159,7 @@ function Symbol2(props) {
10100
10159
  return props.builderContext.canTrack;
10101
10160
  },
10102
10161
  get model() {
10103
- return props.symbol?.model;
10162
+ return props.symbol?.model ?? "";
10104
10163
  },
10105
10164
  get content() {
10106
10165
  return contentToUse();
@@ -4111,8 +4111,13 @@ import { Show as Show2, createMemo } from "solid-js";
4111
4111
 
4112
4112
  // src/constants/device-sizes.ts
4113
4113
  var SIZES = {
4114
+ xsmall: {
4115
+ min: 0,
4116
+ default: 160,
4117
+ max: 320
4118
+ },
4114
4119
  small: {
4115
- min: 320,
4120
+ min: 321,
4116
4121
  default: 321,
4117
4122
  max: 640
4118
4123
  },
@@ -4128,15 +4133,28 @@ var SIZES = {
4128
4133
  }
4129
4134
  };
4130
4135
  var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
4131
- var getSizesForBreakpoints = ({
4132
- small,
4133
- medium
4134
- }) => {
4136
+ var getSizesForBreakpoints = (breakpoints) => {
4135
4137
  const newSizes = fastClone(SIZES);
4138
+ if (!breakpoints) {
4139
+ return newSizes;
4140
+ }
4141
+ const {
4142
+ xsmall,
4143
+ small,
4144
+ medium
4145
+ } = breakpoints;
4146
+ if (xsmall) {
4147
+ const xsmallMin = Math.floor(xsmall / 2);
4148
+ newSizes.xsmall = {
4149
+ max: xsmall,
4150
+ min: xsmallMin,
4151
+ default: xsmallMin + 1
4152
+ };
4153
+ }
4136
4154
  if (!small || !medium) {
4137
4155
  return newSizes;
4138
4156
  }
4139
- const smallMin = Math.floor(small / 2);
4157
+ const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
4140
4158
  newSizes.small = {
4141
4159
  max: small,
4142
4160
  min: smallMin,
@@ -4187,9 +4205,13 @@ function BlockStyles(props) {
4187
4205
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
4188
4206
  content?.meta?.breakpoints || {}
4189
4207
  );
4208
+ const contentHasXSmallBreakpoint = Boolean(
4209
+ content?.meta?.breakpoints?.xsmall
4210
+ );
4190
4211
  const largeStyles = styles?.large;
4191
4212
  const mediumStyles = styles?.medium;
4192
4213
  const smallStyles = styles?.small;
4214
+ const xsmallStyles = styles?.xsmall;
4193
4215
  const className = processedBlock.id;
4194
4216
  if (!className) {
4195
4217
  return "";
@@ -4214,6 +4236,14 @@ function BlockStyles(props) {
4214
4236
  sizesWithUpdatedBreakpoints
4215
4237
  )
4216
4238
  }) : "";
4239
+ const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
4240
+ className,
4241
+ styles: xsmallStyles,
4242
+ mediaQuery: getMaxWidthQueryForSize(
4243
+ "xsmall",
4244
+ sizesWithUpdatedBreakpoints
4245
+ )
4246
+ }) : "";
4217
4247
  const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
4218
4248
  let hoverStylesClass = "";
4219
4249
  if (hoverAnimation) {
@@ -4233,6 +4263,7 @@ function BlockStyles(props) {
4233
4263
  largeStylesClass,
4234
4264
  mediumStylesClass,
4235
4265
  smallStylesClass,
4266
+ xsmallStylesClass,
4236
4267
  hoverStylesClass
4237
4268
  ].join(" ");
4238
4269
  });
@@ -5060,10 +5091,10 @@ function SectionComponent(props) {
5060
5091
  var section_default = SectionComponent;
5061
5092
 
5062
5093
  // src/blocks/symbol/symbol.tsx
5063
- import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5094
+ import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5064
5095
 
5065
5096
  // src/components/content-variants/content-variants.tsx
5066
- import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
5097
+ import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
5067
5098
 
5068
5099
  // src/helpers/url.ts
5069
5100
  var getTopLevelDomain = (host) => {
@@ -7706,8 +7737,9 @@ var componentInfo20 = {
7706
7737
  };
7707
7738
 
7708
7739
  // src/blocks/video/video.tsx
7709
- import { Show as Show13, createMemo as createMemo15 } from "solid-js";
7740
+ import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
7710
7741
  function Video(props) {
7742
+ const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
7711
7743
  const videoProps = createMemo15(() => {
7712
7744
  return {
7713
7745
  ...props.autoPlay === true ? {
@@ -7732,6 +7764,35 @@ function Video(props) {
7732
7764
  ...videoProps()
7733
7765
  };
7734
7766
  });
7767
+ let videoRef;
7768
+ onMount6(() => {
7769
+ if (props.lazyLoad) {
7770
+ const oberver = new IntersectionObserver(function(entries) {
7771
+ entries.forEach(function(entry) {
7772
+ if (!entry.isIntersecting)
7773
+ return;
7774
+ const videoElement = entry.target;
7775
+ try {
7776
+ Array.from(videoElement.children).filter(
7777
+ (child) => child instanceof HTMLElement && child.tagName === "SOURCE"
7778
+ ).forEach((source) => {
7779
+ const src = source.dataset.src;
7780
+ if (src) {
7781
+ source.src = src;
7782
+ }
7783
+ });
7784
+ videoElement.load();
7785
+ oberver.unobserve(videoElement);
7786
+ } catch (error) {
7787
+ }
7788
+ });
7789
+ });
7790
+ if (videoRef) {
7791
+ oberver.observe(videoRef);
7792
+ }
7793
+ setLazyVideoObserver(oberver);
7794
+ }
7795
+ });
7735
7796
  return <><div
7736
7797
  style={{
7737
7798
  position: "relative"
@@ -7740,7 +7801,8 @@ function Video(props) {
7740
7801
  <video
7741
7802
  class="builder-video"
7742
7803
  {...spreadProps()}
7743
- preload={props.preload || "metadata"}
7804
+ ref={videoRef}
7805
+ preload={props.lazyLoad ? "none" : props.preload || "metadata"}
7744
7806
  style={{
7745
7807
  width: "100%",
7746
7808
  height: "100%",
@@ -7754,9 +7816,15 @@ function Video(props) {
7754
7816
  position: "absolute"
7755
7817
  } : null
7756
7818
  }}
7757
- src={props.video || "no-src"}
7758
7819
  poster={props.posterImage}
7759
- ><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
7820
+ ><source
7821
+ type="video/mp4"
7822
+ {...props.lazyLoad ? {
7823
+ "data-src": props.video
7824
+ } : {
7825
+ src: props.video
7826
+ }}
7827
+ /></video>
7760
7828
  <Show13
7761
7829
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
7762
7830
  ><div
@@ -7926,7 +7994,7 @@ var getUpdateVariantVisibilityScript = ({
7926
7994
  // src/components/content/components/enable-editor.tsx
7927
7995
  import {
7928
7996
  Show as Show14,
7929
- onMount as onMount6,
7997
+ onMount as onMount7,
7930
7998
  on as on3,
7931
7999
  createEffect as createEffect3,
7932
8000
  createMemo as createMemo16,
@@ -7940,7 +8008,7 @@ function getPreviewContent(_searchParams) {
7940
8008
  }
7941
8009
 
7942
8010
  // src/constants/sdk-version.ts
7943
- var SDK_VERSION = "3.0.6";
8011
+ var SDK_VERSION = "4.0.0";
7944
8012
 
7945
8013
  // src/helpers/sdk-headers.ts
7946
8014
  var getSdkHeaders = () => ({
@@ -8542,7 +8610,7 @@ var registerInsertMenu = () => {
8542
8610
  });
8543
8611
  };
8544
8612
  var isSetupForEditing = false;
8545
- var setupBrowserForEditing = (options = {}) => {
8613
+ var setupBrowserForEditing = (options) => {
8546
8614
  if (isSetupForEditing) {
8547
8615
  return;
8548
8616
  }
@@ -8558,6 +8626,9 @@ var setupBrowserForEditing = (options = {}) => {
8558
8626
  // scope our '+ add block' button styling
8559
8627
  supportsAddBlockScoping: true,
8560
8628
  supportsCustomBreakpoints: true,
8629
+ modelName: options.modelName,
8630
+ apiKey: options.apiKey,
8631
+ supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
8561
8632
  blockLevelPersonalization: true
8562
8633
  }
8563
8634
  }, "*");
@@ -8662,13 +8733,21 @@ var createEditorListener = ({
8662
8733
  }
8663
8734
  };
8664
8735
  };
8665
- var subscribeToEditor = (model, callback, options) => {
8736
+ var subscribeToEditor = ({
8737
+ model,
8738
+ apiKey,
8739
+ callback,
8740
+ trustedHosts
8741
+ }) => {
8666
8742
  if (!isBrowser) {
8667
8743
  logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
8668
8744
  return () => {
8669
8745
  };
8670
8746
  }
8671
- setupBrowserForEditing();
8747
+ setupBrowserForEditing({
8748
+ modelName: model,
8749
+ apiKey
8750
+ });
8672
8751
  const listener = createEditorListener({
8673
8752
  callbacks: {
8674
8753
  contentUpdate: callback,
@@ -8678,7 +8757,7 @@ var subscribeToEditor = (model, callback, options) => {
8678
8757
  }
8679
8758
  },
8680
8759
  model,
8681
- trustedHosts: options?.trustedHosts
8760
+ trustedHosts
8682
8761
  });
8683
8762
  window.addEventListener("message", listener);
8684
8763
  return () => {
@@ -8918,7 +8997,7 @@ function EnableEditor(props) {
8918
8997
  let elementRef;
8919
8998
  runHttpRequests();
8920
8999
  emitStateUpdate();
8921
- onMount6(() => {
9000
+ onMount7(() => {
8922
9001
  if (isBrowser()) {
8923
9002
  if (isEditing() && !props.isNestedRender) {
8924
9003
  window.addEventListener("message", processMessage);
@@ -8932,12 +9011,14 @@ function EnableEditor(props) {
8932
9011
  } : {},
8933
9012
  ...props.trustedHosts ? {
8934
9013
  trustedHosts: props.trustedHosts
8935
- } : {}
9014
+ } : {},
9015
+ modelName: props.model ?? "",
9016
+ apiKey: props.apiKey
8936
9017
  });
8937
9018
  Object.values(
8938
9019
  props.builderContextSignal.componentInfos
8939
9020
  ).forEach((registeredComponent) => {
8940
- if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
9021
+ if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
8941
9022
  const message = createRegisterComponentMessage(registeredComponent);
8942
9023
  window.parent?.postMessage(message, "*");
8943
9024
  }
@@ -8970,7 +9051,7 @@ function EnableEditor(props) {
8970
9051
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
8971
9052
  if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
8972
9053
  fetchOneEntry({
8973
- model: props.model || "",
9054
+ model: props.model,
8974
9055
  apiKey: props.apiKey,
8975
9056
  apiVersion: props.builderContextSignal.apiVersion,
8976
9057
  ...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
@@ -9158,7 +9239,7 @@ function ContentComponent(props) {
9158
9239
  BlocksWrapper: props.blocksWrapper || "div",
9159
9240
  BlocksWrapperProps: props.blocksWrapperProps || {},
9160
9241
  nonce: props.nonce || "",
9161
- model: props.model || ""
9242
+ model: props.model
9162
9243
  });
9163
9244
  function contentSetState(newRootState) {
9164
9245
  setBuilderContextSignal((PREVIOUS_VALUE) => ({
@@ -9263,7 +9344,7 @@ function ContentVariants(props) {
9263
9344
  canTrack: getDefaultCanTrack(props.canTrack)
9264
9345
  });
9265
9346
  });
9266
- onMount7(() => {
9347
+ onMount8(() => {
9267
9348
  setShouldRenderVariants(false);
9268
9349
  });
9269
9350
  return <><>
@@ -9393,7 +9474,7 @@ function Symbol2(props) {
9393
9474
  }
9394
9475
  });
9395
9476
  }
9396
- onMount8(() => {
9477
+ onMount9(() => {
9397
9478
  });
9398
9479
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
9399
9480
  function onUpdateFn_0() {
@@ -9416,7 +9497,7 @@ function Symbol2(props) {
9416
9497
  ...contentToUse()?.data?.state
9417
9498
  }}
9418
9499
  canTrack={props.builderContext.canTrack}
9419
- model={props.symbol?.model}
9500
+ model={props.symbol?.model ?? ""}
9420
9501
  content={contentToUse()}
9421
9502
  linkComponent={props.builderLinkComponent}
9422
9503
  blocksWrapper={blocksWrapper()}