@builder.io/sdk-qwik 0.6.4 → 0.6.5-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.
@@ -3097,7 +3097,7 @@ const getInteractionPropertiesForEvent = (event) => {
3097
3097
  }
3098
3098
  };
3099
3099
  };
3100
- const SDK_VERSION = "0.6.4";
3100
+ const SDK_VERSION = "0.6.5-0";
3101
3101
  const registry = {};
3102
3102
  function register(type, info) {
3103
3103
  let typeList = registry[type];
@@ -3297,7 +3297,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
3297
3297
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3298
3298
  _track({
3299
3299
  type: "click",
3300
- canTrack: state.canTrackToUse,
3300
+ canTrack: getDefaultCanTrack(props.canTrack),
3301
3301
  contentId,
3302
3302
  apiKey: props.apiKey,
3303
3303
  variationId: variationId !== contentId ? variationId : void 0,
@@ -3354,11 +3354,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3354
3354
  }
3355
3355
  }));
3356
3356
  };
3357
+ const initEditing = function initEditing2(props, state, elementRef, _event) {
3358
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3359
+ window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
3360
+ registerInsertMenu();
3361
+ setupBrowserForEditing({
3362
+ ...props.locale ? {
3363
+ locale: props.locale
3364
+ } : {},
3365
+ ...props.includeRefs ? {
3366
+ includeRefs: props.includeRefs
3367
+ } : {},
3368
+ ...props.enrich ? {
3369
+ enrich: props.enrich
3370
+ } : {}
3371
+ });
3372
+ Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3373
+ var _a;
3374
+ const message = createRegisterComponentMessage(registeredComponent);
3375
+ (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
3376
+ });
3377
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
3378
+ };
3379
+ const initPreview = function initPreview2(props, state, elementRef, _event) {
3380
+ const searchParams = new URL(location.href).searchParams;
3381
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3382
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3383
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3384
+ if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
3385
+ fetchOneEntry({
3386
+ model: props.model,
3387
+ apiKey: props.apiKey,
3388
+ apiVersion: props.builderContextSignal.apiVersion
3389
+ }).then((content) => {
3390
+ if (content)
3391
+ mergeNewContent(props, state, elementRef, content);
3392
+ });
3393
+ };
3357
3394
  const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
3358
3395
  qwik._jsxBranch();
3359
3396
  const elementRef = qwik.useSignal();
3360
3397
  const state = qwik.useStore({
3361
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3362
3398
  clicked: false,
3363
3399
  forceReRenderCount: 0,
3364
3400
  httpReqsData: {},
@@ -3367,69 +3403,48 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
3367
3403
  }, {
3368
3404
  deep: true
3369
3405
  });
3406
+ qwik.useOn("initEditingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
3407
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
3408
+ initEditing(props2, state2, elementRef2);
3409
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
3410
+ elementRef,
3411
+ props,
3412
+ state
3413
+ ]));
3414
+ qwik.useOn("initPreviewingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
3415
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
3416
+ initPreview(props2, state2, elementRef2);
3417
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
3418
+ elementRef,
3419
+ props,
3420
+ state
3421
+ ]));
3370
3422
  qwik.useContextProvider(builderContext, props.builderContextSignal);
3371
3423
  qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
3372
3424
  var _a, _b;
3373
- const [elementRef2, props2, state2] = qwik.useLexicalScope();
3425
+ const [elementRef2, props2] = qwik.useLexicalScope();
3374
3426
  if (!props2.apiKey)
3375
3427
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3376
3428
  if (isBrowser()) {
3377
- if (isEditing()) {
3378
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
3379
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3380
- registerInsertMenu();
3381
- setupBrowserForEditing({
3382
- ...props2.locale ? {
3383
- locale: props2.locale
3384
- } : {},
3385
- ...props2.includeRefs ? {
3386
- includeRefs: props2.includeRefs
3387
- } : {},
3388
- ...props2.enrich ? {
3389
- enrich: props2.enrich
3390
- } : {}
3391
- });
3392
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3393
- var _a2;
3394
- const message = createRegisterComponentMessage(registeredComponent);
3395
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3396
- });
3397
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3398
- }
3429
+ if (isEditing() && elementRef2.value)
3430
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
3399
3431
  if (props2.builderContextSignal.content) {
3400
3432
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3401
3433
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3402
3434
  _track({
3403
3435
  type: "impression",
3404
- canTrack: state2.canTrackToUse,
3436
+ canTrack: getDefaultCanTrack(props2.canTrack),
3405
3437
  contentId,
3406
3438
  apiKey: props2.apiKey,
3407
3439
  variationId: variationId !== contentId ? variationId : void 0
3408
3440
  });
3409
3441
  }
3410
- if (isPreviewing()) {
3411
- const searchParams = new URL(location.href).searchParams;
3412
- const searchParamPreviewModel = searchParams.get("builder.preview");
3413
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3414
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3415
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3416
- fetchOneEntry({
3417
- model: props2.model,
3418
- apiKey: props2.apiKey,
3419
- apiVersion: props2.builderContextSignal.apiVersion
3420
- }).then((content) => {
3421
- if (content)
3422
- mergeNewContent(props2, state2, elementRef2, content);
3423
- });
3424
- }
3425
- evaluateJsCode(props2);
3426
- runHttpRequests(props2, state2, elementRef2);
3427
- emitStateUpdate(props2);
3442
+ if (isPreviewing() && elementRef2.value)
3443
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
3428
3444
  }
3429
3445
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3430
3446
  elementRef,
3431
- props,
3432
- state
3447
+ props
3433
3448
  ]));
3434
3449
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
3435
3450
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
@@ -1,4 +1,4 @@
1
- import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
1
+ import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl, useOn } from "@builder.io/qwik";
2
2
  import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
3
  const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
4
  useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
@@ -3095,7 +3095,7 @@ const getInteractionPropertiesForEvent = (event) => {
3095
3095
  }
3096
3096
  };
3097
3097
  };
3098
- const SDK_VERSION = "0.6.4";
3098
+ const SDK_VERSION = "0.6.5-0";
3099
3099
  const registry = {};
3100
3100
  function register(type, info) {
3101
3101
  let typeList = registry[type];
@@ -3295,7 +3295,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
3295
3295
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3296
3296
  _track({
3297
3297
  type: "click",
3298
- canTrack: state.canTrackToUse,
3298
+ canTrack: getDefaultCanTrack(props.canTrack),
3299
3299
  contentId,
3300
3300
  apiKey: props.apiKey,
3301
3301
  variationId: variationId !== contentId ? variationId : void 0,
@@ -3352,11 +3352,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3352
3352
  }
3353
3353
  }));
3354
3354
  };
3355
+ const initEditing = function initEditing2(props, state, elementRef, _event) {
3356
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3357
+ window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
3358
+ registerInsertMenu();
3359
+ setupBrowserForEditing({
3360
+ ...props.locale ? {
3361
+ locale: props.locale
3362
+ } : {},
3363
+ ...props.includeRefs ? {
3364
+ includeRefs: props.includeRefs
3365
+ } : {},
3366
+ ...props.enrich ? {
3367
+ enrich: props.enrich
3368
+ } : {}
3369
+ });
3370
+ Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3371
+ var _a;
3372
+ const message = createRegisterComponentMessage(registeredComponent);
3373
+ (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
3374
+ });
3375
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
3376
+ };
3377
+ const initPreview = function initPreview2(props, state, elementRef, _event) {
3378
+ const searchParams = new URL(location.href).searchParams;
3379
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3380
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3381
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3382
+ if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
3383
+ fetchOneEntry({
3384
+ model: props.model,
3385
+ apiKey: props.apiKey,
3386
+ apiVersion: props.builderContextSignal.apiVersion
3387
+ }).then((content) => {
3388
+ if (content)
3389
+ mergeNewContent(props, state, elementRef, content);
3390
+ });
3391
+ };
3355
3392
  const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3356
3393
  _jsxBranch();
3357
3394
  const elementRef = useSignal();
3358
3395
  const state = useStore({
3359
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3360
3396
  clicked: false,
3361
3397
  forceReRenderCount: 0,
3362
3398
  httpReqsData: {},
@@ -3365,69 +3401,48 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
3365
3401
  }, {
3366
3402
  deep: true
3367
3403
  });
3404
+ useOn("initEditingBldr", /* @__PURE__ */ inlinedQrl((event) => {
3405
+ const [elementRef2, props2, state2] = useLexicalScope();
3406
+ initEditing(props2, state2, elementRef2);
3407
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
3408
+ elementRef,
3409
+ props,
3410
+ state
3411
+ ]));
3412
+ useOn("initPreviewingBldr", /* @__PURE__ */ inlinedQrl((event) => {
3413
+ const [elementRef2, props2, state2] = useLexicalScope();
3414
+ initPreview(props2, state2, elementRef2);
3415
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
3416
+ elementRef,
3417
+ props,
3418
+ state
3419
+ ]));
3368
3420
  useContextProvider(builderContext, props.builderContextSignal);
3369
3421
  useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3370
3422
  var _a, _b;
3371
- const [elementRef2, props2, state2] = useLexicalScope();
3423
+ const [elementRef2, props2] = useLexicalScope();
3372
3424
  if (!props2.apiKey)
3373
3425
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3374
3426
  if (isBrowser()) {
3375
- if (isEditing()) {
3376
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
3377
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3378
- registerInsertMenu();
3379
- setupBrowserForEditing({
3380
- ...props2.locale ? {
3381
- locale: props2.locale
3382
- } : {},
3383
- ...props2.includeRefs ? {
3384
- includeRefs: props2.includeRefs
3385
- } : {},
3386
- ...props2.enrich ? {
3387
- enrich: props2.enrich
3388
- } : {}
3389
- });
3390
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3391
- var _a2;
3392
- const message = createRegisterComponentMessage(registeredComponent);
3393
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3394
- });
3395
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3396
- }
3427
+ if (isEditing() && elementRef2.value)
3428
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
3397
3429
  if (props2.builderContextSignal.content) {
3398
3430
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3399
3431
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3400
3432
  _track({
3401
3433
  type: "impression",
3402
- canTrack: state2.canTrackToUse,
3434
+ canTrack: getDefaultCanTrack(props2.canTrack),
3403
3435
  contentId,
3404
3436
  apiKey: props2.apiKey,
3405
3437
  variationId: variationId !== contentId ? variationId : void 0
3406
3438
  });
3407
3439
  }
3408
- if (isPreviewing()) {
3409
- const searchParams = new URL(location.href).searchParams;
3410
- const searchParamPreviewModel = searchParams.get("builder.preview");
3411
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3412
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3413
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3414
- fetchOneEntry({
3415
- model: props2.model,
3416
- apiKey: props2.apiKey,
3417
- apiVersion: props2.builderContextSignal.apiVersion
3418
- }).then((content) => {
3419
- if (content)
3420
- mergeNewContent(props2, state2, elementRef2, content);
3421
- });
3422
- }
3423
- evaluateJsCode(props2);
3424
- runHttpRequests(props2, state2, elementRef2);
3425
- emitStateUpdate(props2);
3440
+ if (isPreviewing() && elementRef2.value)
3441
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
3426
3442
  }
3427
3443
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3428
3444
  elementRef,
3429
- props,
3430
- state
3445
+ props
3431
3446
  ]));
3432
3447
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3433
3448
  const [elementRef2, props2, state2] = useLexicalScope();
@@ -6301,7 +6301,7 @@ const getInteractionPropertiesForEvent = (event) => {
6301
6301
  }
6302
6302
  };
6303
6303
  };
6304
- const SDK_VERSION = "0.6.4";
6304
+ const SDK_VERSION = "0.6.5-0";
6305
6305
  const registry = {};
6306
6306
  function register(type, info) {
6307
6307
  let typeList = registry[type];
@@ -6501,7 +6501,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
6501
6501
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
6502
6502
  _track({
6503
6503
  type: "click",
6504
- canTrack: state.canTrackToUse,
6504
+ canTrack: getDefaultCanTrack(props.canTrack),
6505
6505
  contentId,
6506
6506
  apiKey: props.apiKey,
6507
6507
  variationId: variationId !== contentId ? variationId : void 0,
@@ -6558,11 +6558,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
6558
6558
  }
6559
6559
  }));
6560
6560
  };
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
+ };
6561
6598
  const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
6562
6599
  qwik._jsxBranch();
6563
6600
  const elementRef = qwik.useSignal();
6564
6601
  const state = qwik.useStore({
6565
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
6566
6602
  clicked: false,
6567
6603
  forceReRenderCount: 0,
6568
6604
  httpReqsData: {},
@@ -6571,69 +6607,48 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6571
6607
  }, {
6572
6608
  deep: true
6573
6609
  });
6610
+ qwik.useOn("initEditingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
6611
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
6612
+ initEditing(props2, state2, elementRef2);
6613
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
6614
+ elementRef,
6615
+ props,
6616
+ state
6617
+ ]));
6618
+ qwik.useOn("initPreviewingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
6619
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
6620
+ initPreview(props2, state2, elementRef2);
6621
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
6622
+ elementRef,
6623
+ props,
6624
+ state
6625
+ ]));
6574
6626
  qwik.useContextProvider(builderContext, props.builderContextSignal);
6575
6627
  qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
6576
6628
  var _a, _b;
6577
- const [elementRef2, props2, state2] = qwik.useLexicalScope();
6629
+ const [elementRef2, props2] = qwik.useLexicalScope();
6578
6630
  if (!props2.apiKey)
6579
6631
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6580
6632
  if (isBrowser()) {
6581
- if (isEditing()) {
6582
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
6583
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
6584
- registerInsertMenu();
6585
- setupBrowserForEditing({
6586
- ...props2.locale ? {
6587
- locale: props2.locale
6588
- } : {},
6589
- ...props2.includeRefs ? {
6590
- includeRefs: props2.includeRefs
6591
- } : {},
6592
- ...props2.enrich ? {
6593
- enrich: props2.enrich
6594
- } : {}
6595
- });
6596
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6597
- var _a2;
6598
- const message = createRegisterComponentMessage(registeredComponent);
6599
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
6600
- });
6601
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
6602
- }
6633
+ if (isEditing() && elementRef2.value)
6634
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
6603
6635
  if (props2.builderContextSignal.content) {
6604
6636
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
6605
6637
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
6606
6638
  _track({
6607
6639
  type: "impression",
6608
- canTrack: state2.canTrackToUse,
6640
+ canTrack: getDefaultCanTrack(props2.canTrack),
6609
6641
  contentId,
6610
6642
  apiKey: props2.apiKey,
6611
6643
  variationId: variationId !== contentId ? variationId : void 0
6612
6644
  });
6613
6645
  }
6614
- if (isPreviewing()) {
6615
- const searchParams = new URL(location.href).searchParams;
6616
- const searchParamPreviewModel = searchParams.get("builder.preview");
6617
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6618
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6619
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6620
- fetchOneEntry({
6621
- model: props2.model,
6622
- apiKey: props2.apiKey,
6623
- apiVersion: props2.builderContextSignal.apiVersion
6624
- }).then((content) => {
6625
- if (content)
6626
- mergeNewContent(props2, state2, elementRef2, content);
6627
- });
6628
- }
6629
- evaluateJsCode(props2);
6630
- runHttpRequests(props2, state2, elementRef2);
6631
- emitStateUpdate(props2);
6646
+ if (isPreviewing() && elementRef2.value)
6647
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
6632
6648
  }
6633
6649
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
6634
6650
  elementRef,
6635
- props,
6636
- state
6651
+ props
6637
6652
  ]));
6638
6653
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
6639
6654
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
@@ -1,4 +1,4 @@
1
- import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
1
+ import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl, useOn } from "@builder.io/qwik";
2
2
  import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
3
  const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
4
  useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
@@ -6299,7 +6299,7 @@ const getInteractionPropertiesForEvent = (event) => {
6299
6299
  }
6300
6300
  };
6301
6301
  };
6302
- const SDK_VERSION = "0.6.4";
6302
+ const SDK_VERSION = "0.6.5-0";
6303
6303
  const registry = {};
6304
6304
  function register(type, info) {
6305
6305
  let typeList = registry[type];
@@ -6499,7 +6499,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
6499
6499
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
6500
6500
  _track({
6501
6501
  type: "click",
6502
- canTrack: state.canTrackToUse,
6502
+ canTrack: getDefaultCanTrack(props.canTrack),
6503
6503
  contentId,
6504
6504
  apiKey: props.apiKey,
6505
6505
  variationId: variationId !== contentId ? variationId : void 0,
@@ -6556,11 +6556,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
6556
6556
  }
6557
6557
  }));
6558
6558
  };
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
+ };
6559
6596
  const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
6560
6597
  _jsxBranch();
6561
6598
  const elementRef = useSignal();
6562
6599
  const state = useStore({
6563
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
6564
6600
  clicked: false,
6565
6601
  forceReRenderCount: 0,
6566
6602
  httpReqsData: {},
@@ -6569,69 +6605,48 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6569
6605
  }, {
6570
6606
  deep: true
6571
6607
  });
6608
+ useOn("initEditingBldr", /* @__PURE__ */ inlinedQrl((event) => {
6609
+ const [elementRef2, props2, state2] = useLexicalScope();
6610
+ initEditing(props2, state2, elementRef2);
6611
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
6612
+ elementRef,
6613
+ props,
6614
+ state
6615
+ ]));
6616
+ useOn("initPreviewingBldr", /* @__PURE__ */ inlinedQrl((event) => {
6617
+ const [elementRef2, props2, state2] = useLexicalScope();
6618
+ initPreview(props2, state2, elementRef2);
6619
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
6620
+ elementRef,
6621
+ props,
6622
+ state
6623
+ ]));
6572
6624
  useContextProvider(builderContext, props.builderContextSignal);
6573
6625
  useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
6574
6626
  var _a, _b;
6575
- const [elementRef2, props2, state2] = useLexicalScope();
6627
+ const [elementRef2, props2] = useLexicalScope();
6576
6628
  if (!props2.apiKey)
6577
6629
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
6578
6630
  if (isBrowser()) {
6579
- if (isEditing()) {
6580
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
6581
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
6582
- registerInsertMenu();
6583
- setupBrowserForEditing({
6584
- ...props2.locale ? {
6585
- locale: props2.locale
6586
- } : {},
6587
- ...props2.includeRefs ? {
6588
- includeRefs: props2.includeRefs
6589
- } : {},
6590
- ...props2.enrich ? {
6591
- enrich: props2.enrich
6592
- } : {}
6593
- });
6594
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6595
- var _a2;
6596
- const message = createRegisterComponentMessage(registeredComponent);
6597
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
6598
- });
6599
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
6600
- }
6631
+ if (isEditing() && elementRef2.value)
6632
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
6601
6633
  if (props2.builderContextSignal.content) {
6602
6634
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
6603
6635
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
6604
6636
  _track({
6605
6637
  type: "impression",
6606
- canTrack: state2.canTrackToUse,
6638
+ canTrack: getDefaultCanTrack(props2.canTrack),
6607
6639
  contentId,
6608
6640
  apiKey: props2.apiKey,
6609
6641
  variationId: variationId !== contentId ? variationId : void 0
6610
6642
  });
6611
6643
  }
6612
- if (isPreviewing()) {
6613
- const searchParams = new URL(location.href).searchParams;
6614
- const searchParamPreviewModel = searchParams.get("builder.preview");
6615
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6616
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6617
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6618
- fetchOneEntry({
6619
- model: props2.model,
6620
- apiKey: props2.apiKey,
6621
- apiVersion: props2.builderContextSignal.apiVersion
6622
- }).then((content) => {
6623
- if (content)
6624
- mergeNewContent(props2, state2, elementRef2, content);
6625
- });
6626
- }
6627
- evaluateJsCode(props2);
6628
- runHttpRequests(props2, state2, elementRef2);
6629
- emitStateUpdate(props2);
6644
+ if (isPreviewing() && elementRef2.value)
6645
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
6630
6646
  }
6631
6647
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
6632
6648
  elementRef,
6633
- props,
6634
- state
6649
+ props
6635
6650
  ]));
6636
6651
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
6637
6652
  const [elementRef2, props2, state2] = useLexicalScope();
@@ -3097,7 +3097,7 @@ const getInteractionPropertiesForEvent = (event) => {
3097
3097
  }
3098
3098
  };
3099
3099
  };
3100
- const SDK_VERSION = "0.6.4";
3100
+ const SDK_VERSION = "0.6.5-0";
3101
3101
  const registry = {};
3102
3102
  function register(type, info) {
3103
3103
  let typeList = registry[type];
@@ -3297,7 +3297,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
3297
3297
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3298
3298
  _track({
3299
3299
  type: "click",
3300
- canTrack: state.canTrackToUse,
3300
+ canTrack: getDefaultCanTrack(props.canTrack),
3301
3301
  contentId,
3302
3302
  apiKey: props.apiKey,
3303
3303
  variationId: variationId !== contentId ? variationId : void 0,
@@ -3354,11 +3354,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3354
3354
  }
3355
3355
  }));
3356
3356
  };
3357
+ const initEditing = function initEditing2(props, state, elementRef, _event) {
3358
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3359
+ window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
3360
+ registerInsertMenu();
3361
+ setupBrowserForEditing({
3362
+ ...props.locale ? {
3363
+ locale: props.locale
3364
+ } : {},
3365
+ ...props.includeRefs ? {
3366
+ includeRefs: props.includeRefs
3367
+ } : {},
3368
+ ...props.enrich ? {
3369
+ enrich: props.enrich
3370
+ } : {}
3371
+ });
3372
+ Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3373
+ var _a;
3374
+ const message = createRegisterComponentMessage(registeredComponent);
3375
+ (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
3376
+ });
3377
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
3378
+ };
3379
+ const initPreview = function initPreview2(props, state, elementRef, _event) {
3380
+ const searchParams = new URL(location.href).searchParams;
3381
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3382
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3383
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3384
+ if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
3385
+ fetchOneEntry({
3386
+ model: props.model,
3387
+ apiKey: props.apiKey,
3388
+ apiVersion: props.builderContextSignal.apiVersion
3389
+ }).then((content) => {
3390
+ if (content)
3391
+ mergeNewContent(props, state, elementRef, content);
3392
+ });
3393
+ };
3357
3394
  const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
3358
3395
  qwik._jsxBranch();
3359
3396
  const elementRef = qwik.useSignal();
3360
3397
  const state = qwik.useStore({
3361
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3362
3398
  clicked: false,
3363
3399
  forceReRenderCount: 0,
3364
3400
  httpReqsData: {},
@@ -3367,69 +3403,48 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
3367
3403
  }, {
3368
3404
  deep: true
3369
3405
  });
3406
+ qwik.useOn("initEditingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
3407
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
3408
+ initEditing(props2, state2, elementRef2);
3409
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
3410
+ elementRef,
3411
+ props,
3412
+ state
3413
+ ]));
3414
+ qwik.useOn("initPreviewingBldr", /* @__PURE__ */ qwik.inlinedQrl((event) => {
3415
+ const [elementRef2, props2, state2] = qwik.useLexicalScope();
3416
+ initPreview(props2, state2, elementRef2);
3417
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
3418
+ elementRef,
3419
+ props,
3420
+ state
3421
+ ]));
3370
3422
  qwik.useContextProvider(builderContext, props.builderContextSignal);
3371
3423
  qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
3372
3424
  var _a, _b;
3373
- const [elementRef2, props2, state2] = qwik.useLexicalScope();
3425
+ const [elementRef2, props2] = qwik.useLexicalScope();
3374
3426
  if (!props2.apiKey)
3375
3427
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3376
3428
  if (isBrowser()) {
3377
- if (isEditing()) {
3378
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
3379
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3380
- registerInsertMenu();
3381
- setupBrowserForEditing({
3382
- ...props2.locale ? {
3383
- locale: props2.locale
3384
- } : {},
3385
- ...props2.includeRefs ? {
3386
- includeRefs: props2.includeRefs
3387
- } : {},
3388
- ...props2.enrich ? {
3389
- enrich: props2.enrich
3390
- } : {}
3391
- });
3392
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3393
- var _a2;
3394
- const message = createRegisterComponentMessage(registeredComponent);
3395
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3396
- });
3397
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3398
- }
3429
+ if (isEditing() && elementRef2.value)
3430
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
3399
3431
  if (props2.builderContextSignal.content) {
3400
3432
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3401
3433
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3402
3434
  _track({
3403
3435
  type: "impression",
3404
- canTrack: state2.canTrackToUse,
3436
+ canTrack: getDefaultCanTrack(props2.canTrack),
3405
3437
  contentId,
3406
3438
  apiKey: props2.apiKey,
3407
3439
  variationId: variationId !== contentId ? variationId : void 0
3408
3440
  });
3409
3441
  }
3410
- if (isPreviewing()) {
3411
- const searchParams = new URL(location.href).searchParams;
3412
- const searchParamPreviewModel = searchParams.get("builder.preview");
3413
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3414
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3415
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3416
- fetchOneEntry({
3417
- model: props2.model,
3418
- apiKey: props2.apiKey,
3419
- apiVersion: props2.builderContextSignal.apiVersion
3420
- }).then((content) => {
3421
- if (content)
3422
- mergeNewContent(props2, state2, elementRef2, content);
3423
- });
3424
- }
3425
- evaluateJsCode(props2);
3426
- runHttpRequests(props2, state2, elementRef2);
3427
- emitStateUpdate(props2);
3442
+ if (isPreviewing() && elementRef2.value)
3443
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
3428
3444
  }
3429
3445
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3430
3446
  elementRef,
3431
- props,
3432
- state
3447
+ props
3433
3448
  ]));
3434
3449
  qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
3435
3450
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
@@ -1,4 +1,4 @@
1
- import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
1
+ import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useStore, useContextProvider, _wrapProp, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl, useOn } from "@builder.io/qwik";
2
2
  import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
3
  const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
4
  useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
@@ -3095,7 +3095,7 @@ const getInteractionPropertiesForEvent = (event) => {
3095
3095
  }
3096
3096
  };
3097
3097
  };
3098
- const SDK_VERSION = "0.6.4";
3098
+ const SDK_VERSION = "0.6.5-0";
3099
3099
  const registry = {};
3100
3100
  function register(type, info) {
3101
3101
  let typeList = registry[type];
@@ -3295,7 +3295,7 @@ const onClick = function onClick22(props, state, elementRef, event) {
3295
3295
  const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3296
3296
  _track({
3297
3297
  type: "click",
3298
- canTrack: state.canTrackToUse,
3298
+ canTrack: getDefaultCanTrack(props.canTrack),
3299
3299
  contentId,
3300
3300
  apiKey: props.apiKey,
3301
3301
  variationId: variationId !== contentId ? variationId : void 0,
@@ -3352,11 +3352,47 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3352
3352
  }
3353
3353
  }));
3354
3354
  };
3355
+ const initEditing = function initEditing2(props, state, elementRef, _event) {
3356
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3357
+ window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
3358
+ registerInsertMenu();
3359
+ setupBrowserForEditing({
3360
+ ...props.locale ? {
3361
+ locale: props.locale
3362
+ } : {},
3363
+ ...props.includeRefs ? {
3364
+ includeRefs: props.includeRefs
3365
+ } : {},
3366
+ ...props.enrich ? {
3367
+ enrich: props.enrich
3368
+ } : {}
3369
+ });
3370
+ Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3371
+ var _a;
3372
+ const message = createRegisterComponentMessage(registeredComponent);
3373
+ (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
3374
+ });
3375
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
3376
+ };
3377
+ const initPreview = function initPreview2(props, state, elementRef, _event) {
3378
+ const searchParams = new URL(location.href).searchParams;
3379
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3380
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3381
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3382
+ if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
3383
+ fetchOneEntry({
3384
+ model: props.model,
3385
+ apiKey: props.apiKey,
3386
+ apiVersion: props.builderContextSignal.apiVersion
3387
+ }).then((content) => {
3388
+ if (content)
3389
+ mergeNewContent(props, state, elementRef, content);
3390
+ });
3391
+ };
3355
3392
  const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3356
3393
  _jsxBranch();
3357
3394
  const elementRef = useSignal();
3358
3395
  const state = useStore({
3359
- canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3360
3396
  clicked: false,
3361
3397
  forceReRenderCount: 0,
3362
3398
  httpReqsData: {},
@@ -3365,69 +3401,48 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
3365
3401
  }, {
3366
3402
  deep: true
3367
3403
  });
3404
+ useOn("initEditingBldr", /* @__PURE__ */ inlinedQrl((event) => {
3405
+ const [elementRef2, props2, state2] = useLexicalScope();
3406
+ initEditing(props2, state2, elementRef2);
3407
+ }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
3408
+ elementRef,
3409
+ props,
3410
+ state
3411
+ ]));
3412
+ useOn("initPreviewingBldr", /* @__PURE__ */ inlinedQrl((event) => {
3413
+ const [elementRef2, props2, state2] = useLexicalScope();
3414
+ initPreview(props2, state2, elementRef2);
3415
+ }, "EnableEditor_component_useOn_1_F94YipmknvI", [
3416
+ elementRef,
3417
+ props,
3418
+ state
3419
+ ]));
3368
3420
  useContextProvider(builderContext, props.builderContextSignal);
3369
3421
  useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3370
3422
  var _a, _b;
3371
- const [elementRef2, props2, state2] = useLexicalScope();
3423
+ const [elementRef2, props2] = useLexicalScope();
3372
3424
  if (!props2.apiKey)
3373
3425
  logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3374
3426
  if (isBrowser()) {
3375
- if (isEditing()) {
3376
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
3377
- window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3378
- registerInsertMenu();
3379
- setupBrowserForEditing({
3380
- ...props2.locale ? {
3381
- locale: props2.locale
3382
- } : {},
3383
- ...props2.includeRefs ? {
3384
- includeRefs: props2.includeRefs
3385
- } : {},
3386
- ...props2.enrich ? {
3387
- enrich: props2.enrich
3388
- } : {}
3389
- });
3390
- Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3391
- var _a2;
3392
- const message = createRegisterComponentMessage(registeredComponent);
3393
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3394
- });
3395
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3396
- }
3427
+ if (isEditing() && elementRef2.value)
3428
+ elementRef2.value.dispatchEvent(new CustomEvent("initEditingBldr"));
3397
3429
  if (props2.builderContextSignal.content) {
3398
3430
  const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3399
3431
  const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3400
3432
  _track({
3401
3433
  type: "impression",
3402
- canTrack: state2.canTrackToUse,
3434
+ canTrack: getDefaultCanTrack(props2.canTrack),
3403
3435
  contentId,
3404
3436
  apiKey: props2.apiKey,
3405
3437
  variationId: variationId !== contentId ? variationId : void 0
3406
3438
  });
3407
3439
  }
3408
- if (isPreviewing()) {
3409
- const searchParams = new URL(location.href).searchParams;
3410
- const searchParamPreviewModel = searchParams.get("builder.preview");
3411
- const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3412
- const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3413
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3414
- fetchOneEntry({
3415
- model: props2.model,
3416
- apiKey: props2.apiKey,
3417
- apiVersion: props2.builderContextSignal.apiVersion
3418
- }).then((content) => {
3419
- if (content)
3420
- mergeNewContent(props2, state2, elementRef2, content);
3421
- });
3422
- }
3423
- evaluateJsCode(props2);
3424
- runHttpRequests(props2, state2, elementRef2);
3425
- emitStateUpdate(props2);
3440
+ if (isPreviewing() && elementRef2.value)
3441
+ elementRef2.value.dispatchEvent(new CustomEvent("initPreviewingBldr"));
3426
3442
  }
3427
3443
  }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3428
3444
  elementRef,
3429
- props,
3430
- state
3445
+ props
3431
3446
  ]));
3432
3447
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3433
3448
  const [elementRef2, props2, state2] = useLexicalScope();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.6.4",
3
+ "version": "0.6.5-0",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/edge/index.qwik.cjs",
@@ -89,6 +89,7 @@
89
89
  }
90
90
  },
91
91
  "scripts": {
92
+ "publish": "npm publish",
92
93
  "typecheck": "tsc --noEmit",
93
94
  "tsc": "tsc",
94
95
  "build": "nx run-many -p @builder.io/sdk-qwik -t tsc build:node build:edge build:browser",
@@ -1,5 +1,4 @@
1
1
  import { BuilderBlock } from "../../types/builder-block.js";
2
- import { JSX } from "@builder.io/mitosis/jsx-runtime";
3
2
  export interface ImageProps {
4
3
  className?: string;
5
4
  image: string;
@@ -12,7 +11,7 @@ export interface ImageProps {
12
11
  backgroundPosition?: string;
13
12
  srcset?: string;
14
13
  aspectRatio?: number;
15
- children?: JSX.Element;
14
+ children?: any;
16
15
  fitContent?: boolean;
17
16
  builderBlock?: BuilderBlock;
18
17
  noWebp?: boolean;
@@ -17,5 +17,9 @@ export declare const handleRequest: (props: any, state: any, elementRef: any, {
17
17
  }) => void;
18
18
  export declare const runHttpRequests: (props: any, state: any, elementRef: any) => void;
19
19
  export declare const emitStateUpdate: (props: any, state: any, elementRef: any) => void;
20
+ export declare const initEditing: (props: any, state: any, elementRef: any, _event: Event) => void;
21
+ export declare const initPreview: (props: any, state: any, elementRef: any, _event: Event) => void;
22
+ export declare const elementRef_onInitEditingBldr: (props: any, state: any, elementRef: any, event: any) => void;
23
+ export declare const elementRef_onInitPreviewingBldr: (props: any, state: any, elementRef: any, event: any) => void;
20
24
  export declare const EnableEditor: import("@builder.io/qwik").Component<BuilderEditorProps>;
21
25
  export default EnableEditor;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.6.4";
1
+ export declare const SDK_VERSION = "0.6.5-0";