@builder.io/sdk-solid 2.0.24 → 2.0.26

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/dev.js CHANGED
@@ -7948,6 +7948,16 @@ function getPreviewContent(_searchParams) {
7948
7948
  return void 0;
7949
7949
  }
7950
7950
 
7951
+ // src/constants/sdk-version.ts
7952
+ var SDK_VERSION = "2.0.26";
7953
+
7954
+ // src/helpers/sdk-headers.ts
7955
+ var getSdkHeaders = () => ({
7956
+ "X-Builder-SDK": TARGET,
7957
+ "X-Builder-SDK-GEN": "2",
7958
+ "X-Builder-SDK-Version": SDK_VERSION
7959
+ });
7960
+
7951
7961
  // src/functions/get-global-this.ts
7952
7962
  function getGlobalThis() {
7953
7963
  if (typeof globalThis !== "undefined") {
@@ -8051,7 +8061,8 @@ var generateContentUrl = (options) => {
8051
8061
  cacheSeconds,
8052
8062
  staleCacheSeconds,
8053
8063
  sort,
8054
- includeUnpublished
8064
+ includeUnpublished,
8065
+ apiHost
8055
8066
  } = options;
8056
8067
  if (!apiKey) {
8057
8068
  throw new Error("Missing API key");
@@ -8060,7 +8071,8 @@ var generateContentUrl = (options) => {
8060
8071
  throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
8061
8072
  }
8062
8073
  const noTraverse = limit !== 1;
8063
- const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
8074
+ const baseUrl = apiHost || "https://cdn.builder.io";
8075
+ const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
8064
8076
  url.searchParams.set("apiKey", apiKey);
8065
8077
  url.searchParams.set("limit", String(limit));
8066
8078
  url.searchParams.set("noTraverse", String(noTraverse));
@@ -8130,7 +8142,14 @@ async function fetchOneEntry(options) {
8130
8142
  var _fetchContent = async (options) => {
8131
8143
  const url = generateContentUrl(options);
8132
8144
  const _fetch = options.fetch ?? fetch2;
8133
- const res = await _fetch(url.href, options.fetchOptions);
8145
+ const fetchOptions = {
8146
+ ...options.fetchOptions,
8147
+ headers: {
8148
+ ...options.fetchOptions?.headers,
8149
+ ...getSdkHeaders()
8150
+ }
8151
+ };
8152
+ const res = await _fetch(url.href, fetchOptions);
8134
8153
  const content = await res.json();
8135
8154
  return content;
8136
8155
  };
@@ -8341,7 +8360,10 @@ var createEvent = async ({
8341
8360
  ownerId: apiKey
8342
8361
  }
8343
8362
  });
8344
- async function _track(eventProps) {
8363
+ async function _track({
8364
+ apiHost,
8365
+ ...eventProps
8366
+ }) {
8345
8367
  if (!eventProps.apiKey) {
8346
8368
  logger.error("Missing API key for track call. Please provide your API key.");
8347
8369
  return;
@@ -8355,13 +8377,15 @@ async function _track(eventProps) {
8355
8377
  if (!(isBrowser() || TARGET === "reactNative")) {
8356
8378
  return;
8357
8379
  }
8358
- return fetch(`https://cdn.builder.io/api/v1/track`, {
8380
+ const baseUrl = apiHost || "https://cdn.builder.io";
8381
+ return fetch(`${baseUrl}/api/v1/track`, {
8359
8382
  method: "POST",
8360
8383
  body: JSON.stringify({
8361
8384
  events: [await createEvent(eventProps)]
8362
8385
  }),
8363
8386
  headers: {
8364
- "content-type": "application/json"
8387
+ "content-type": "application/json",
8388
+ ...getSdkHeaders()
8365
8389
  },
8366
8390
  mode: "cors"
8367
8391
  }).catch((err) => {
@@ -8441,9 +8465,6 @@ function isFromTrustedHost(trustedHosts, e) {
8441
8465
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
8442
8466
  }
8443
8467
 
8444
- // src/constants/sdk-version.ts
8445
- var SDK_VERSION = "2.0.24";
8446
-
8447
8468
  // src/functions/register.ts
8448
8469
  var registry = {};
8449
8470
  function register(type, info) {
@@ -8801,6 +8822,7 @@ function EnableEditor(props) {
8801
8822
  const variationId = props.builderContextSignal.content?.testVariationId;
8802
8823
  const contentId = props.builderContextSignal.content?.id;
8803
8824
  _track({
8825
+ apiHost: props.apiHost,
8804
8826
  type: "click",
8805
8827
  canTrack: getDefaultCanTrack(props.canTrack),
8806
8828
  contentId,
@@ -8860,7 +8882,7 @@ function EnableEditor(props) {
8860
8882
  emitStateUpdate();
8861
8883
  onMount(() => {
8862
8884
  if (isBrowser()) {
8863
- if (isEditing()) {
8885
+ if (isEditing() && !props.isNestedRender) {
8864
8886
  window.addEventListener("message", processMessage);
8865
8887
  registerInsertMenu();
8866
8888
  setupBrowserForEditing({
@@ -8886,6 +8908,7 @@ function EnableEditor(props) {
8886
8908
  const contentId = props.builderContextSignal.content?.id;
8887
8909
  const apiKeyProp = props.apiKey;
8888
8910
  _track({
8911
+ apiHost: props.apiHost,
8889
8912
  type: "impression",
8890
8913
  canTrack: true,
8891
8914
  contentId,
@@ -9134,6 +9157,9 @@ function ContentComponent(props) {
9134
9157
  },
9135
9158
  get children() {
9136
9159
  return createComponent(enable_editor_default, mergeProps({
9160
+ get apiHost() {
9161
+ return props.apiHost;
9162
+ },
9137
9163
  get nonce() {
9138
9164
  return props.nonce;
9139
9165
  },
@@ -9175,6 +9201,9 @@ function ContentComponent(props) {
9175
9201
  },
9176
9202
  get trustedHosts() {
9177
9203
  return props.trustedHosts;
9204
+ },
9205
+ get isNestedRender() {
9206
+ return props.isNestedRender;
9178
9207
  }
9179
9208
  }, {
9180
9209
  setBuilderContextSignal
@@ -9307,6 +9336,9 @@ function ContentVariants(props) {
9307
9336
  children: (variant, _index) => {
9308
9337
  _index();
9309
9338
  return createComponent(content_default, mergeProps({
9339
+ get apiHost() {
9340
+ return props.apiHost;
9341
+ },
9310
9342
  get isNestedRender() {
9311
9343
  return props.isNestedRender;
9312
9344
  },
@@ -9371,6 +9403,9 @@ function ContentVariants(props) {
9371
9403
  })];
9372
9404
  }
9373
9405
  }), createComponent(content_default, mergeProps({
9406
+ get apiHost() {
9407
+ return props.apiHost;
9408
+ },
9374
9409
  get nonce() {
9375
9410
  return props.nonce;
9376
9411
  },
package/lib/edge/dev.jsx CHANGED
@@ -7438,6 +7438,16 @@ function getPreviewContent(_searchParams) {
7438
7438
  return void 0;
7439
7439
  }
7440
7440
 
7441
+ // src/constants/sdk-version.ts
7442
+ var SDK_VERSION = "2.0.26";
7443
+
7444
+ // src/helpers/sdk-headers.ts
7445
+ var getSdkHeaders = () => ({
7446
+ "X-Builder-SDK": TARGET,
7447
+ "X-Builder-SDK-GEN": "2",
7448
+ "X-Builder-SDK-Version": SDK_VERSION
7449
+ });
7450
+
7441
7451
  // src/functions/get-global-this.ts
7442
7452
  function getGlobalThis() {
7443
7453
  if (typeof globalThis !== "undefined") {
@@ -7541,7 +7551,8 @@ var generateContentUrl = (options) => {
7541
7551
  cacheSeconds,
7542
7552
  staleCacheSeconds,
7543
7553
  sort,
7544
- includeUnpublished
7554
+ includeUnpublished,
7555
+ apiHost
7545
7556
  } = options;
7546
7557
  if (!apiKey) {
7547
7558
  throw new Error("Missing API key");
@@ -7550,7 +7561,8 @@ var generateContentUrl = (options) => {
7550
7561
  throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
7551
7562
  }
7552
7563
  const noTraverse = limit !== 1;
7553
- const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
7564
+ const baseUrl = apiHost || "https://cdn.builder.io";
7565
+ const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
7554
7566
  url.searchParams.set("apiKey", apiKey);
7555
7567
  url.searchParams.set("limit", String(limit));
7556
7568
  url.searchParams.set("noTraverse", String(noTraverse));
@@ -7620,7 +7632,14 @@ async function fetchOneEntry(options) {
7620
7632
  var _fetchContent = async (options) => {
7621
7633
  const url = generateContentUrl(options);
7622
7634
  const _fetch = options.fetch ?? fetch2;
7623
- const res = await _fetch(url.href, options.fetchOptions);
7635
+ const fetchOptions = {
7636
+ ...options.fetchOptions,
7637
+ headers: {
7638
+ ...options.fetchOptions?.headers,
7639
+ ...getSdkHeaders()
7640
+ }
7641
+ };
7642
+ const res = await _fetch(url.href, fetchOptions);
7624
7643
  const content = await res.json();
7625
7644
  return content;
7626
7645
  };
@@ -7831,7 +7850,10 @@ var createEvent = async ({
7831
7850
  ownerId: apiKey
7832
7851
  }
7833
7852
  });
7834
- async function _track(eventProps) {
7853
+ async function _track({
7854
+ apiHost,
7855
+ ...eventProps
7856
+ }) {
7835
7857
  if (!eventProps.apiKey) {
7836
7858
  logger.error("Missing API key for track call. Please provide your API key.");
7837
7859
  return;
@@ -7845,13 +7867,15 @@ async function _track(eventProps) {
7845
7867
  if (!(isBrowser() || TARGET === "reactNative")) {
7846
7868
  return;
7847
7869
  }
7848
- return fetch(`https://cdn.builder.io/api/v1/track`, {
7870
+ const baseUrl = apiHost || "https://cdn.builder.io";
7871
+ return fetch(`${baseUrl}/api/v1/track`, {
7849
7872
  method: "POST",
7850
7873
  body: JSON.stringify({
7851
7874
  events: [await createEvent(eventProps)]
7852
7875
  }),
7853
7876
  headers: {
7854
- "content-type": "application/json"
7877
+ "content-type": "application/json",
7878
+ ...getSdkHeaders()
7855
7879
  },
7856
7880
  mode: "cors"
7857
7881
  }).catch((err) => {
@@ -7931,9 +7955,6 @@ function isFromTrustedHost(trustedHosts, e) {
7931
7955
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7932
7956
  }
7933
7957
 
7934
- // src/constants/sdk-version.ts
7935
- var SDK_VERSION = "2.0.24";
7936
-
7937
7958
  // src/functions/register.ts
7938
7959
  var registry = {};
7939
7960
  function register(type, info) {
@@ -8290,6 +8311,7 @@ function EnableEditor(props) {
8290
8311
  const variationId = props.builderContextSignal.content?.testVariationId;
8291
8312
  const contentId = props.builderContextSignal.content?.id;
8292
8313
  _track({
8314
+ apiHost: props.apiHost,
8293
8315
  type: "click",
8294
8316
  canTrack: getDefaultCanTrack(props.canTrack),
8295
8317
  contentId,
@@ -8359,7 +8381,7 @@ function EnableEditor(props) {
8359
8381
  emitStateUpdate();
8360
8382
  onMount6(() => {
8361
8383
  if (isBrowser()) {
8362
- if (isEditing()) {
8384
+ if (isEditing() && !props.isNestedRender) {
8363
8385
  window.addEventListener("message", processMessage);
8364
8386
  registerInsertMenu();
8365
8387
  setupBrowserForEditing({
@@ -8390,6 +8412,7 @@ function EnableEditor(props) {
8390
8412
  const contentId = props.builderContextSignal.content?.id;
8391
8413
  const apiKeyProp = props.apiKey;
8392
8414
  _track({
8415
+ apiHost: props.apiHost,
8393
8416
  type: "impression",
8394
8417
  canTrack: true,
8395
8418
  contentId,
@@ -8629,6 +8652,7 @@ function ContentComponent(props) {
8629
8652
  registeredComponents: registeredComponents()
8630
8653
  }}
8631
8654
  ><Enable_editor_default
8655
+ apiHost={props.apiHost}
8632
8656
  nonce={props.nonce}
8633
8657
  content={props.content}
8634
8658
  data={props.data}
@@ -8643,6 +8667,7 @@ function ContentComponent(props) {
8643
8667
  contentWrapper={props.contentWrapper}
8644
8668
  contentWrapperProps={props.contentWrapperProps}
8645
8669
  trustedHosts={props.trustedHosts}
8670
+ isNestedRender={props.isNestedRender}
8646
8671
  {...{
8647
8672
  setBuilderContextSignal
8648
8673
  }}
@@ -8721,6 +8746,7 @@ function ContentVariants(props) {
8721
8746
  <For9 each={getVariants(props.content)}>{(variant, _index) => {
8722
8747
  const index = _index();
8723
8748
  return <Content_default
8749
+ apiHost={props.apiHost}
8724
8750
  isNestedRender={props.isNestedRender}
8725
8751
  key={variant.testVariationId}
8726
8752
  nonce={props.nonce}
@@ -8747,6 +8773,7 @@ function ContentVariants(props) {
8747
8773
  }}</For9>
8748
8774
  </Show15>
8749
8775
  <Content_default
8776
+ apiHost={props.apiHost}
8750
8777
  nonce={props.nonce}
8751
8778
  isNestedRender={props.isNestedRender}
8752
8779
  {...{}}
package/lib/edge/index.js CHANGED
@@ -7938,6 +7938,16 @@ function getPreviewContent(_searchParams) {
7938
7938
  return void 0;
7939
7939
  }
7940
7940
 
7941
+ // src/constants/sdk-version.ts
7942
+ var SDK_VERSION = "2.0.26";
7943
+
7944
+ // src/helpers/sdk-headers.ts
7945
+ var getSdkHeaders = () => ({
7946
+ "X-Builder-SDK": TARGET,
7947
+ "X-Builder-SDK-GEN": "2",
7948
+ "X-Builder-SDK-Version": SDK_VERSION
7949
+ });
7950
+
7941
7951
  // src/functions/get-global-this.ts
7942
7952
  function getGlobalThis() {
7943
7953
  if (typeof globalThis !== "undefined") {
@@ -8039,7 +8049,8 @@ var generateContentUrl = (options) => {
8039
8049
  cacheSeconds,
8040
8050
  staleCacheSeconds,
8041
8051
  sort,
8042
- includeUnpublished
8052
+ includeUnpublished,
8053
+ apiHost
8043
8054
  } = options;
8044
8055
  if (!apiKey) {
8045
8056
  throw new Error("Missing API key");
@@ -8048,7 +8059,8 @@ var generateContentUrl = (options) => {
8048
8059
  throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
8049
8060
  }
8050
8061
  const noTraverse = limit !== 1;
8051
- const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
8062
+ const baseUrl = apiHost || "https://cdn.builder.io";
8063
+ const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
8052
8064
  url.searchParams.set("apiKey", apiKey);
8053
8065
  url.searchParams.set("limit", String(limit));
8054
8066
  url.searchParams.set("noTraverse", String(noTraverse));
@@ -8118,7 +8130,14 @@ async function fetchOneEntry(options) {
8118
8130
  var _fetchContent = async (options) => {
8119
8131
  const url = generateContentUrl(options);
8120
8132
  const _fetch = options.fetch ?? fetch2;
8121
- const res = await _fetch(url.href, options.fetchOptions);
8133
+ const fetchOptions = {
8134
+ ...options.fetchOptions,
8135
+ headers: {
8136
+ ...options.fetchOptions?.headers,
8137
+ ...getSdkHeaders()
8138
+ }
8139
+ };
8140
+ const res = await _fetch(url.href, fetchOptions);
8122
8141
  const content = await res.json();
8123
8142
  return content;
8124
8143
  };
@@ -8327,7 +8346,10 @@ var createEvent = async ({
8327
8346
  ownerId: apiKey
8328
8347
  }
8329
8348
  });
8330
- async function _track(eventProps) {
8349
+ async function _track({
8350
+ apiHost,
8351
+ ...eventProps
8352
+ }) {
8331
8353
  if (!eventProps.apiKey) {
8332
8354
  logger.error("Missing API key for track call. Please provide your API key.");
8333
8355
  return;
@@ -8341,13 +8363,15 @@ async function _track(eventProps) {
8341
8363
  if (!(isBrowser() || TARGET === "reactNative")) {
8342
8364
  return;
8343
8365
  }
8344
- return fetch(`https://cdn.builder.io/api/v1/track`, {
8366
+ const baseUrl = apiHost || "https://cdn.builder.io";
8367
+ return fetch(`${baseUrl}/api/v1/track`, {
8345
8368
  method: "POST",
8346
8369
  body: JSON.stringify({
8347
8370
  events: [await createEvent(eventProps)]
8348
8371
  }),
8349
8372
  headers: {
8350
- "content-type": "application/json"
8373
+ "content-type": "application/json",
8374
+ ...getSdkHeaders()
8351
8375
  },
8352
8376
  mode: "cors"
8353
8377
  }).catch((err) => {
@@ -8426,9 +8450,6 @@ function isFromTrustedHost(trustedHosts, e) {
8426
8450
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
8427
8451
  }
8428
8452
 
8429
- // src/constants/sdk-version.ts
8430
- var SDK_VERSION = "2.0.24";
8431
-
8432
8453
  // src/functions/register.ts
8433
8454
  var registry = {};
8434
8455
  function register(type, info) {
@@ -8785,6 +8806,7 @@ function EnableEditor(props) {
8785
8806
  const variationId = props.builderContextSignal.content?.testVariationId;
8786
8807
  const contentId = props.builderContextSignal.content?.id;
8787
8808
  _track({
8809
+ apiHost: props.apiHost,
8788
8810
  type: "click",
8789
8811
  canTrack: getDefaultCanTrack(props.canTrack),
8790
8812
  contentId,
@@ -8843,7 +8865,7 @@ function EnableEditor(props) {
8843
8865
  emitStateUpdate();
8844
8866
  onMount(() => {
8845
8867
  if (isBrowser()) {
8846
- if (isEditing()) {
8868
+ if (isEditing() && !props.isNestedRender) {
8847
8869
  window.addEventListener("message", processMessage);
8848
8870
  registerInsertMenu();
8849
8871
  setupBrowserForEditing({
@@ -8869,6 +8891,7 @@ function EnableEditor(props) {
8869
8891
  const contentId = props.builderContextSignal.content?.id;
8870
8892
  const apiKeyProp = props.apiKey;
8871
8893
  _track({
8894
+ apiHost: props.apiHost,
8872
8895
  type: "impression",
8873
8896
  canTrack: true,
8874
8897
  contentId,
@@ -9117,6 +9140,9 @@ function ContentComponent(props) {
9117
9140
  },
9118
9141
  get children() {
9119
9142
  return createComponent(enable_editor_default, mergeProps({
9143
+ get apiHost() {
9144
+ return props.apiHost;
9145
+ },
9120
9146
  get nonce() {
9121
9147
  return props.nonce;
9122
9148
  },
@@ -9158,6 +9184,9 @@ function ContentComponent(props) {
9158
9184
  },
9159
9185
  get trustedHosts() {
9160
9186
  return props.trustedHosts;
9187
+ },
9188
+ get isNestedRender() {
9189
+ return props.isNestedRender;
9161
9190
  }
9162
9191
  }, {
9163
9192
  setBuilderContextSignal
@@ -9290,6 +9319,9 @@ function ContentVariants(props) {
9290
9319
  children: (variant, _index) => {
9291
9320
  _index();
9292
9321
  return createComponent(content_default, mergeProps({
9322
+ get apiHost() {
9323
+ return props.apiHost;
9324
+ },
9293
9325
  get isNestedRender() {
9294
9326
  return props.isNestedRender;
9295
9327
  },
@@ -9354,6 +9386,9 @@ function ContentVariants(props) {
9354
9386
  })];
9355
9387
  }
9356
9388
  }), createComponent(content_default, mergeProps({
9389
+ get apiHost() {
9390
+ return props.apiHost;
9391
+ },
9357
9392
  get nonce() {
9358
9393
  return props.nonce;
9359
9394
  },
@@ -7428,6 +7428,16 @@ function getPreviewContent(_searchParams) {
7428
7428
  return void 0;
7429
7429
  }
7430
7430
 
7431
+ // src/constants/sdk-version.ts
7432
+ var SDK_VERSION = "2.0.26";
7433
+
7434
+ // src/helpers/sdk-headers.ts
7435
+ var getSdkHeaders = () => ({
7436
+ "X-Builder-SDK": TARGET,
7437
+ "X-Builder-SDK-GEN": "2",
7438
+ "X-Builder-SDK-Version": SDK_VERSION
7439
+ });
7440
+
7431
7441
  // src/functions/get-global-this.ts
7432
7442
  function getGlobalThis() {
7433
7443
  if (typeof globalThis !== "undefined") {
@@ -7529,7 +7539,8 @@ var generateContentUrl = (options) => {
7529
7539
  cacheSeconds,
7530
7540
  staleCacheSeconds,
7531
7541
  sort,
7532
- includeUnpublished
7542
+ includeUnpublished,
7543
+ apiHost
7533
7544
  } = options;
7534
7545
  if (!apiKey) {
7535
7546
  throw new Error("Missing API key");
@@ -7538,7 +7549,8 @@ var generateContentUrl = (options) => {
7538
7549
  throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
7539
7550
  }
7540
7551
  const noTraverse = limit !== 1;
7541
- const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
7552
+ const baseUrl = apiHost || "https://cdn.builder.io";
7553
+ const url = new URL(`${baseUrl}/api/${apiVersion}/content/${model}`);
7542
7554
  url.searchParams.set("apiKey", apiKey);
7543
7555
  url.searchParams.set("limit", String(limit));
7544
7556
  url.searchParams.set("noTraverse", String(noTraverse));
@@ -7608,7 +7620,14 @@ async function fetchOneEntry(options) {
7608
7620
  var _fetchContent = async (options) => {
7609
7621
  const url = generateContentUrl(options);
7610
7622
  const _fetch = options.fetch ?? fetch2;
7611
- const res = await _fetch(url.href, options.fetchOptions);
7623
+ const fetchOptions = {
7624
+ ...options.fetchOptions,
7625
+ headers: {
7626
+ ...options.fetchOptions?.headers,
7627
+ ...getSdkHeaders()
7628
+ }
7629
+ };
7630
+ const res = await _fetch(url.href, fetchOptions);
7612
7631
  const content = await res.json();
7613
7632
  return content;
7614
7633
  };
@@ -7817,7 +7836,10 @@ var createEvent = async ({
7817
7836
  ownerId: apiKey
7818
7837
  }
7819
7838
  });
7820
- async function _track(eventProps) {
7839
+ async function _track({
7840
+ apiHost,
7841
+ ...eventProps
7842
+ }) {
7821
7843
  if (!eventProps.apiKey) {
7822
7844
  logger.error("Missing API key for track call. Please provide your API key.");
7823
7845
  return;
@@ -7831,13 +7853,15 @@ async function _track(eventProps) {
7831
7853
  if (!(isBrowser() || TARGET === "reactNative")) {
7832
7854
  return;
7833
7855
  }
7834
- return fetch(`https://cdn.builder.io/api/v1/track`, {
7856
+ const baseUrl = apiHost || "https://cdn.builder.io";
7857
+ return fetch(`${baseUrl}/api/v1/track`, {
7835
7858
  method: "POST",
7836
7859
  body: JSON.stringify({
7837
7860
  events: [await createEvent(eventProps)]
7838
7861
  }),
7839
7862
  headers: {
7840
- "content-type": "application/json"
7863
+ "content-type": "application/json",
7864
+ ...getSdkHeaders()
7841
7865
  },
7842
7866
  mode: "cors"
7843
7867
  }).catch((err) => {
@@ -7916,9 +7940,6 @@ function isFromTrustedHost(trustedHosts, e) {
7916
7940
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7917
7941
  }
7918
7942
 
7919
- // src/constants/sdk-version.ts
7920
- var SDK_VERSION = "2.0.24";
7921
-
7922
7943
  // src/functions/register.ts
7923
7944
  var registry = {};
7924
7945
  function register(type, info) {
@@ -8274,6 +8295,7 @@ function EnableEditor(props) {
8274
8295
  const variationId = props.builderContextSignal.content?.testVariationId;
8275
8296
  const contentId = props.builderContextSignal.content?.id;
8276
8297
  _track({
8298
+ apiHost: props.apiHost,
8277
8299
  type: "click",
8278
8300
  canTrack: getDefaultCanTrack(props.canTrack),
8279
8301
  contentId,
@@ -8342,7 +8364,7 @@ function EnableEditor(props) {
8342
8364
  emitStateUpdate();
8343
8365
  onMount6(() => {
8344
8366
  if (isBrowser()) {
8345
- if (isEditing()) {
8367
+ if (isEditing() && !props.isNestedRender) {
8346
8368
  window.addEventListener("message", processMessage);
8347
8369
  registerInsertMenu();
8348
8370
  setupBrowserForEditing({
@@ -8373,6 +8395,7 @@ function EnableEditor(props) {
8373
8395
  const contentId = props.builderContextSignal.content?.id;
8374
8396
  const apiKeyProp = props.apiKey;
8375
8397
  _track({
8398
+ apiHost: props.apiHost,
8376
8399
  type: "impression",
8377
8400
  canTrack: true,
8378
8401
  contentId,
@@ -8612,6 +8635,7 @@ function ContentComponent(props) {
8612
8635
  registeredComponents: registeredComponents()
8613
8636
  }}
8614
8637
  ><Enable_editor_default
8638
+ apiHost={props.apiHost}
8615
8639
  nonce={props.nonce}
8616
8640
  content={props.content}
8617
8641
  data={props.data}
@@ -8626,6 +8650,7 @@ function ContentComponent(props) {
8626
8650
  contentWrapper={props.contentWrapper}
8627
8651
  contentWrapperProps={props.contentWrapperProps}
8628
8652
  trustedHosts={props.trustedHosts}
8653
+ isNestedRender={props.isNestedRender}
8629
8654
  {...{
8630
8655
  setBuilderContextSignal
8631
8656
  }}
@@ -8704,6 +8729,7 @@ function ContentVariants(props) {
8704
8729
  <For9 each={getVariants(props.content)}>{(variant, _index) => {
8705
8730
  const index = _index();
8706
8731
  return <Content_default
8732
+ apiHost={props.apiHost}
8707
8733
  isNestedRender={props.isNestedRender}
8708
8734
  key={variant.testVariationId}
8709
8735
  nonce={props.nonce}
@@ -8730,6 +8756,7 @@ function ContentVariants(props) {
8730
8756
  }}</For9>
8731
8757
  </Show15>
8732
8758
  <Content_default
8759
+ apiHost={props.apiHost}
8733
8760
  nonce={props.nonce}
8734
8761
  isNestedRender={props.isNestedRender}
8735
8762
  {...{}}