@builder.io/sdk-qwik 0.6.5-4 → 0.7.1-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.
@@ -6019,7 +6019,8 @@ const getBuilderSearchParamsFromWindow = () => {
6019
6019
  const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
6020
6020
  const DEFAULT_API_VERSION = "v3";
6021
6021
  const generateContentUrl = (options) => {
6022
- const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
6022
+ let { noTraverse = false } = options;
6023
+ const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
6023
6024
  if (!apiKey)
6024
6025
  throw new Error("Missing API key");
6025
6026
  if (![
@@ -6027,6 +6028,8 @@ const generateContentUrl = (options) => {
6027
6028
  "v3"
6028
6029
  ].includes(apiVersion))
6029
6030
  throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
6031
+ if ((options.limit === void 0 || options.limit > 1) && !("noTraverse" in options))
6032
+ noTraverse = true;
6030
6033
  const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
6031
6034
  const queryOptions = {
6032
6035
  ...getBuilderSearchParamsFromWindow(),
@@ -6301,7 +6304,7 @@ const getInteractionPropertiesForEvent = (event) => {
6301
6304
  }
6302
6305
  };
6303
6306
  };
6304
- const SDK_VERSION = "0.6.5-4";
6307
+ const SDK_VERSION = "0.7.1-0";
6305
6308
  const registry = {};
6306
6309
  function register(type, info) {
6307
6310
  let typeList = registry[type];
@@ -6558,44 +6561,8 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
6558
6561
  }
6559
6562
  }));
6560
6563
  };
6561
- const initEditing = function initEditing2(props, state, elementRef, _event) {
6562
- state.forceReRenderCount = state.forceReRenderCount + 1;
6563
- window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
6564
- registerInsertMenu();
6565
- setupBrowserForEditing({
6566
- ...props.locale ? {
6567
- locale: props.locale
6568
- } : {},
6569
- ...props.includeRefs ? {
6570
- includeRefs: props.includeRefs
6571
- } : {},
6572
- ...props.enrich ? {
6573
- enrich: props.enrich
6574
- } : {}
6575
- });
6576
- Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6577
- var _a;
6578
- const message = createRegisterComponentMessage(registeredComponent);
6579
- (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
6580
- });
6581
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
6582
- };
6583
- const initPreview = function initPreview2(props, state, elementRef, _event) {
6584
- const searchParams = new URL(location.href).searchParams;
6585
- const searchParamPreviewModel = searchParams.get("builder.preview");
6586
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6587
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6588
- if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
6589
- fetchOneEntry({
6590
- model: props.model,
6591
- apiKey: props.apiKey,
6592
- apiVersion: props.builderContextSignal.apiVersion
6593
- }).then((content) => {
6594
- if (content)
6595
- mergeNewContent(props, state, elementRef, content);
6596
- });
6597
- };
6598
6564
  const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
6565
+ var _a, _b, _c;
6599
6566
  qwik._jsxBranch();
6600
6567
  const elementRef = qwik.useSignal();
6601
6568
  const state = qwik.useStore({
@@ -6607,55 +6574,94 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6607
6574
  }, {
6608
6575
  deep: true
6609
6576
  });
6610
- qwik.useOn("initEditingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
6577
+ qwik.useOn("initeditingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
6611
6578
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6612
- initEditing(props2, state2, elementRef2);
6579
+ state2.forceReRenderCount = state2.forceReRenderCount + 1;
6580
+ window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
6581
+ registerInsertMenu();
6582
+ setupBrowserForEditing({
6583
+ ...props2.locale ? {
6584
+ locale: props2.locale
6585
+ } : {},
6586
+ ...props2.includeRefs ? {
6587
+ includeRefs: props2.includeRefs
6588
+ } : {},
6589
+ ...props2.enrich ? {
6590
+ enrich: props2.enrich
6591
+ } : {}
6592
+ });
6593
+ Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6594
+ var _a2;
6595
+ const message = createRegisterComponentMessage(registeredComponent);
6596
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
6597
+ });
6598
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
6613
6599
  }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
6614
6600
  elementRef,
6615
6601
  props,
6616
6602
  state
6617
6603
  ]));
6618
- qwik.useOn("initPreviewingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
6604
+ qwik.useOn("initpreviewingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
6619
6605
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6620
- initPreview(props2, state2, elementRef2);
6606
+ const searchParams = new URL(location.href).searchParams;
6607
+ const searchParamPreviewModel = searchParams.get("builder.preview");
6608
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6609
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6610
+ if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6611
+ fetchOneEntry({
6612
+ model: props2.model,
6613
+ apiKey: props2.apiKey,
6614
+ apiVersion: props2.builderContextSignal.apiVersion
6615
+ }).then((content) => {
6616
+ if (content)
6617
+ mergeNewContent(props2, state2, elementRef2, content);
6618
+ });
6621
6619
  }, "EnableEditor_component_useOn_1_F94YipmknvI", [
6622
6620
  elementRef,
6623
6621
  props,
6624
6622
  state
6625
6623
  ]));
6626
- qwik.useContextProvider(builderContext, props.builderContextSignal);
6627
- qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
6628
- var _a, _b;
6629
- const [elementRef2, props2] = qwik.useLexicalScope();
6630
- if (!props2.apiKey)
6631
- logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6624
+ qwik.useOn("qvisible", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
6625
+ var _a2, _b2, _c2, _d;
6632
6626
  if (isBrowser()) {
6633
- if (isEditing() && elementRef2.value)
6634
- elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
6635
- if (props2.builderContextSignal.content) {
6636
- const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
6637
- const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
6627
+ if (isEditing() && element)
6628
+ element.dispatchEvent(new CustomEvent("initeditingbldr"));
6629
+ const shouldTrackImpression = ((_a2 = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a2.value) === "true";
6630
+ if (shouldTrackImpression) {
6631
+ const variationId = (_b2 = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b2.value;
6632
+ const contentId = (_c2 = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c2.value;
6633
+ const apiKeyProp = (_d = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d.value;
6638
6634
  _track({
6639
6635
  type: "impression",
6640
- canTrack: getDefaultCanTrack(props2.canTrack),
6636
+ canTrack: true,
6641
6637
  contentId,
6642
- apiKey: props2.apiKey,
6638
+ apiKey: apiKeyProp,
6643
6639
  variationId: variationId !== contentId ? variationId : void 0
6644
6640
  });
6645
6641
  }
6646
- if (isPreviewing() && elementRef2.value)
6647
- elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
6642
+ if (isPreviewing() && element)
6643
+ element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
6648
6644
  }
6649
- }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
6645
+ }, "EnableEditor_component_useOn_2_FyR0YPSlJlw"));
6646
+ qwik.useContextProvider(builderContext, props.builderContextSignal);
6647
+ qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
6648
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
6649
+ if (!props2.apiKey)
6650
+ logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6651
+ evaluateJsCode(props2);
6652
+ runHttpRequests(props2, state2, elementRef2);
6653
+ emitStateUpdate(props2);
6654
+ }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
6650
6655
  elementRef,
6651
- props
6656
+ props,
6657
+ state
6652
6658
  ]));
6653
6659
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
6654
6660
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6655
6661
  track2(() => props2.content);
6656
6662
  if (props2.content)
6657
6663
  mergeNewContent(props2, state2, elementRef2, props2.content);
6658
- }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
6664
+ }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
6659
6665
  elementRef,
6660
6666
  props,
6661
6667
  state
@@ -6663,18 +6669,18 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6663
6669
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
6664
6670
  const [state2] = qwik.useLexicalScope();
6665
6671
  track2(() => state2.shouldSendResetCookie);
6666
- }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
6672
+ }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
6667
6673
  state
6668
6674
  ]));
6669
6675
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
6670
6676
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6671
6677
  track2(() => {
6672
- var _a, _b;
6673
- return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
6678
+ var _a2, _b2;
6679
+ return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
6674
6680
  });
6675
6681
  track2(() => props2.builderContextSignal.rootState);
6676
6682
  evaluateJsCode(props2);
6677
- }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
6683
+ }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
6678
6684
  elementRef,
6679
6685
  props,
6680
6686
  state
@@ -6682,11 +6688,11 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6682
6688
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
6683
6689
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6684
6690
  track2(() => {
6685
- var _a, _b;
6686
- return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests;
6691
+ var _a2, _b2;
6692
+ return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
6687
6693
  });
6688
6694
  runHttpRequests(props2, state2, elementRef2);
6689
- }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
6695
+ }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
6690
6696
  elementRef,
6691
6697
  props,
6692
6698
  state
@@ -6695,41 +6701,35 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6695
6701
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6696
6702
  track2(() => props2.builderContextSignal.rootState);
6697
6703
  emitStateUpdate(props2);
6698
- }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
6704
+ }, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
6699
6705
  elementRef,
6700
6706
  props,
6701
6707
  state
6702
6708
  ]));
6703
6709
  return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
6704
- children: props.builderContextSignal.content ? /* @__PURE__ */ qwik._jsxS("div", {
6710
+ children: props.builderContextSignal.content ? /* @__PURE__ */ qwik.createElement("div", {
6711
+ apiKey: props.apiKey,
6712
+ contentId: (_a = props.builderContextSignal.content) == null ? void 0 : _a.id,
6713
+ variationId: (_b = props.builderContextSignal.content) == null ? void 0 : _b.testVariationId,
6714
+ shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
6715
+ key: state.forceReRenderCount,
6705
6716
  ref: elementRef,
6706
- ...props.showContent ? {} : {
6707
- hidden: true,
6708
- "aria-hidden": true
6709
- },
6710
- children: /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "06_0"),
6711
6717
  onClick$: /* @__PURE__ */ qwik.inlinedQrl((event) => {
6712
6718
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
6713
6719
  return onClick(props2, state2, elementRef2, event);
6714
- }, "EnableEditor_component__Fragment_div_onClick_1QOkLijjH0M", [
6720
+ }, "EnableEditor_component__Fragment__createElement_PT7eU9x80Lw", [
6715
6721
  elementRef,
6716
6722
  props,
6717
6723
  state
6718
- ])
6719
- }, {
6720
- "builder-content-id": qwik._fnSignal((p0) => {
6721
- var _a;
6722
- return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
6723
- }, [
6724
- props
6725
- ], "p0.builderContextSignal.content?.id"),
6726
- "builder-model": qwik._fnSignal((p0) => p0.model, [
6727
- props
6728
- ], "p0.model"),
6729
- class: qwik._fnSignal((p0) => p0.classNameProp, [
6730
- props
6731
- ], "p0.classNameProp")
6732
- }, 0, state.forceReRenderCount) : null
6724
+ ]),
6725
+ "builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
6726
+ "builder-model": props.model,
6727
+ ...props.showContent ? {} : {
6728
+ hidden: true,
6729
+ "aria-hidden": true
6730
+ },
6731
+ class: props.classNameProp
6732
+ }, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "06_0")) : null
6733
6733
  }, 1, "06_1");
6734
6734
  }, "EnableEditor_component_ko1mO8oaj8k"));
6735
6735
  const getCssFromFont = (font) => {
@@ -6017,7 +6017,8 @@ const getBuilderSearchParamsFromWindow = () => {
6017
6017
  const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
6018
6018
  const DEFAULT_API_VERSION = "v3";
6019
6019
  const generateContentUrl = (options) => {
6020
- const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
6020
+ let { noTraverse = false } = options;
6021
+ const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
6021
6022
  if (!apiKey)
6022
6023
  throw new Error("Missing API key");
6023
6024
  if (![
@@ -6025,6 +6026,8 @@ const generateContentUrl = (options) => {
6025
6026
  "v3"
6026
6027
  ].includes(apiVersion))
6027
6028
  throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
6029
+ if ((options.limit === void 0 || options.limit > 1) && !("noTraverse" in options))
6030
+ noTraverse = true;
6028
6031
  const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
6029
6032
  const queryOptions = {
6030
6033
  ...getBuilderSearchParamsFromWindow(),
@@ -6299,7 +6302,7 @@ const getInteractionPropertiesForEvent = (event) => {
6299
6302
  }
6300
6303
  };
6301
6304
  };
6302
- const SDK_VERSION = "0.6.5-4";
6305
+ const SDK_VERSION = "0.7.1-0";
6303
6306
  const registry = {};
6304
6307
  function register(type, info) {
6305
6308
  let typeList = registry[type];
@@ -6556,44 +6559,8 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
6556
6559
  }
6557
6560
  }));
6558
6561
  };
6559
- const initEditing = function initEditing2(props, state, elementRef, _event) {
6560
- state.forceReRenderCount = state.forceReRenderCount + 1;
6561
- window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
6562
- registerInsertMenu();
6563
- setupBrowserForEditing({
6564
- ...props.locale ? {
6565
- locale: props.locale
6566
- } : {},
6567
- ...props.includeRefs ? {
6568
- includeRefs: props.includeRefs
6569
- } : {},
6570
- ...props.enrich ? {
6571
- enrich: props.enrich
6572
- } : {}
6573
- });
6574
- Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6575
- var _a;
6576
- const message = createRegisterComponentMessage(registeredComponent);
6577
- (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
6578
- });
6579
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
6580
- };
6581
- const initPreview = function initPreview2(props, state, elementRef, _event) {
6582
- const searchParams = new URL(location.href).searchParams;
6583
- const searchParamPreviewModel = searchParams.get("builder.preview");
6584
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6585
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6586
- if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
6587
- fetchOneEntry({
6588
- model: props.model,
6589
- apiKey: props.apiKey,
6590
- apiVersion: props.builderContextSignal.apiVersion
6591
- }).then((content) => {
6592
- if (content)
6593
- mergeNewContent(props, state, elementRef, content);
6594
- });
6595
- };
6596
6562
  const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
6563
+ var _a, _b, _c;
6597
6564
  _jsxBranch();
6598
6565
  const elementRef = useSignal();
6599
6566
  const state = useStore({
@@ -6605,55 +6572,94 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6605
6572
  }, {
6606
6573
  deep: true
6607
6574
  });
6608
- useOn("initEditingBldr", /* @__PURE__ */ inlinedQrl((event) => {
6575
+ useOn("initeditingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
6609
6576
  const [elementRef2, props2, state2] = useLexicalScope();
6610
- initEditing(props2, state2, elementRef2);
6577
+ state2.forceReRenderCount = state2.forceReRenderCount + 1;
6578
+ window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
6579
+ registerInsertMenu();
6580
+ setupBrowserForEditing({
6581
+ ...props2.locale ? {
6582
+ locale: props2.locale
6583
+ } : {},
6584
+ ...props2.includeRefs ? {
6585
+ includeRefs: props2.includeRefs
6586
+ } : {},
6587
+ ...props2.enrich ? {
6588
+ enrich: props2.enrich
6589
+ } : {}
6590
+ });
6591
+ Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6592
+ var _a2;
6593
+ const message = createRegisterComponentMessage(registeredComponent);
6594
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
6595
+ });
6596
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
6611
6597
  }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
6612
6598
  elementRef,
6613
6599
  props,
6614
6600
  state
6615
6601
  ]));
6616
- useOn("initPreviewingBldr", /* @__PURE__ */ inlinedQrl((event) => {
6602
+ useOn("initpreviewingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
6617
6603
  const [elementRef2, props2, state2] = useLexicalScope();
6618
- initPreview(props2, state2, elementRef2);
6604
+ const searchParams = new URL(location.href).searchParams;
6605
+ const searchParamPreviewModel = searchParams.get("builder.preview");
6606
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6607
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6608
+ if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6609
+ fetchOneEntry({
6610
+ model: props2.model,
6611
+ apiKey: props2.apiKey,
6612
+ apiVersion: props2.builderContextSignal.apiVersion
6613
+ }).then((content) => {
6614
+ if (content)
6615
+ mergeNewContent(props2, state2, elementRef2, content);
6616
+ });
6619
6617
  }, "EnableEditor_component_useOn_1_F94YipmknvI", [
6620
6618
  elementRef,
6621
6619
  props,
6622
6620
  state
6623
6621
  ]));
6624
- useContextProvider(builderContext, props.builderContextSignal);
6625
- useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
6626
- var _a, _b;
6627
- const [elementRef2, props2] = useLexicalScope();
6628
- if (!props2.apiKey)
6629
- logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6622
+ useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
6623
+ var _a2, _b2, _c2, _d;
6630
6624
  if (isBrowser()) {
6631
- if (isEditing() && elementRef2.value)
6632
- elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
6633
- if (props2.builderContextSignal.content) {
6634
- const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
6635
- const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
6625
+ if (isEditing() && element)
6626
+ element.dispatchEvent(new CustomEvent("initeditingbldr"));
6627
+ const shouldTrackImpression = ((_a2 = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a2.value) === "true";
6628
+ if (shouldTrackImpression) {
6629
+ const variationId = (_b2 = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b2.value;
6630
+ const contentId = (_c2 = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c2.value;
6631
+ const apiKeyProp = (_d = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d.value;
6636
6632
  _track({
6637
6633
  type: "impression",
6638
- canTrack: getDefaultCanTrack(props2.canTrack),
6634
+ canTrack: true,
6639
6635
  contentId,
6640
- apiKey: props2.apiKey,
6636
+ apiKey: apiKeyProp,
6641
6637
  variationId: variationId !== contentId ? variationId : void 0
6642
6638
  });
6643
6639
  }
6644
- if (isPreviewing() && elementRef2.value)
6645
- elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
6640
+ if (isPreviewing() && element)
6641
+ element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
6646
6642
  }
6647
- }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
6643
+ }, "EnableEditor_component_useOn_2_FyR0YPSlJlw"));
6644
+ useContextProvider(builderContext, props.builderContextSignal);
6645
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
6646
+ const [elementRef2, props2, state2] = useLexicalScope();
6647
+ if (!props2.apiKey)
6648
+ logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6649
+ evaluateJsCode(props2);
6650
+ runHttpRequests(props2, state2, elementRef2);
6651
+ emitStateUpdate(props2);
6652
+ }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
6648
6653
  elementRef,
6649
- props
6654
+ props,
6655
+ state
6650
6656
  ]));
6651
6657
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
6652
6658
  const [elementRef2, props2, state2] = useLexicalScope();
6653
6659
  track2(() => props2.content);
6654
6660
  if (props2.content)
6655
6661
  mergeNewContent(props2, state2, elementRef2, props2.content);
6656
- }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
6662
+ }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
6657
6663
  elementRef,
6658
6664
  props,
6659
6665
  state
@@ -6661,18 +6667,18 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6661
6667
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
6662
6668
  const [state2] = useLexicalScope();
6663
6669
  track2(() => state2.shouldSendResetCookie);
6664
- }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
6670
+ }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
6665
6671
  state
6666
6672
  ]));
6667
6673
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
6668
6674
  const [elementRef2, props2, state2] = useLexicalScope();
6669
6675
  track2(() => {
6670
- var _a, _b;
6671
- return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
6676
+ var _a2, _b2;
6677
+ return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
6672
6678
  });
6673
6679
  track2(() => props2.builderContextSignal.rootState);
6674
6680
  evaluateJsCode(props2);
6675
- }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
6681
+ }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
6676
6682
  elementRef,
6677
6683
  props,
6678
6684
  state
@@ -6680,11 +6686,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6680
6686
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
6681
6687
  const [elementRef2, props2, state2] = useLexicalScope();
6682
6688
  track2(() => {
6683
- var _a, _b;
6684
- return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests;
6689
+ var _a2, _b2;
6690
+ return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
6685
6691
  });
6686
6692
  runHttpRequests(props2, state2, elementRef2);
6687
- }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
6693
+ }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
6688
6694
  elementRef,
6689
6695
  props,
6690
6696
  state
@@ -6693,41 +6699,35 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6693
6699
  const [elementRef2, props2, state2] = useLexicalScope();
6694
6700
  track2(() => props2.builderContextSignal.rootState);
6695
6701
  emitStateUpdate(props2);
6696
- }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
6702
+ }, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
6697
6703
  elementRef,
6698
6704
  props,
6699
6705
  state
6700
6706
  ]));
6701
6707
  return /* @__PURE__ */ _jsxC(Fragment, {
6702
- children: props.builderContextSignal.content ? /* @__PURE__ */ _jsxS("div", {
6708
+ children: props.builderContextSignal.content ? /* @__PURE__ */ createElement("div", {
6709
+ apiKey: props.apiKey,
6710
+ contentId: (_a = props.builderContextSignal.content) == null ? void 0 : _a.id,
6711
+ variationId: (_b = props.builderContextSignal.content) == null ? void 0 : _b.testVariationId,
6712
+ shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
6713
+ key: state.forceReRenderCount,
6703
6714
  ref: elementRef,
6704
- ...props.showContent ? {} : {
6705
- hidden: true,
6706
- "aria-hidden": true
6707
- },
6708
- children: /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0"),
6709
6715
  onClick$: /* @__PURE__ */ inlinedQrl((event) => {
6710
6716
  const [elementRef2, props2, state2] = useLexicalScope();
6711
6717
  return onClick(props2, state2, elementRef2, event);
6712
- }, "EnableEditor_component__Fragment_div_onClick_1QOkLijjH0M", [
6718
+ }, "EnableEditor_component__Fragment__createElement_PT7eU9x80Lw", [
6713
6719
  elementRef,
6714
6720
  props,
6715
6721
  state
6716
- ])
6717
- }, {
6718
- "builder-content-id": _fnSignal((p0) => {
6719
- var _a;
6720
- return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
6721
- }, [
6722
- props
6723
- ], "p0.builderContextSignal.content?.id"),
6724
- "builder-model": _fnSignal((p0) => p0.model, [
6725
- props
6726
- ], "p0.model"),
6727
- class: _fnSignal((p0) => p0.classNameProp, [
6728
- props
6729
- ], "p0.classNameProp")
6730
- }, 0, state.forceReRenderCount) : null
6722
+ ]),
6723
+ "builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
6724
+ "builder-model": props.model,
6725
+ ...props.showContent ? {} : {
6726
+ hidden: true,
6727
+ "aria-hidden": true
6728
+ },
6729
+ class: props.classNameProp
6730
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0")) : null
6731
6731
  }, 1, "06_1");
6732
6732
  }, "EnableEditor_component_ko1mO8oaj8k"));
6733
6733
  const getCssFromFont = (font) => {