@builder.io/sdk-qwik 0.0.13 → 0.0.16

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.
Binary file
package/README.md CHANGED
@@ -32,11 +32,7 @@ Add Qwik SDK code to a particular route (such as `src/routes/index.tsx`)
32
32
  ```typscript
33
33
  import { component$, Resource, useResource$ } from "@builder.io/qwik";
34
34
  import { useLocation } from "@builder.io/qwik-city";
35
- import {
36
- getContent,
37
- RenderContent,
38
- getBuilderSearchParams,
39
- } from "@builder.io/sdk-qwik";
35
+ import { getContent, RenderContent, getBuilderSearchParams } from "@builder.io/sdk-qwik";
40
36
 
41
37
  export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE"; // ggignore
42
38
  export default component$(() => {
@@ -162,7 +162,7 @@ function evaluate({ code, context, state, event }) {
162
162
  try {
163
163
  return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
164
164
  } catch (e) {
165
- console.warn("Builder custom code error: ", e);
165
+ console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
166
166
  }
167
167
  }
168
168
  const set = (obj, _path, value) => {
@@ -426,10 +426,19 @@ const EMPTY_HTML_ELEMENTS = [
426
426
  const isEmptyHtmlElement = (tagName4) => {
427
427
  return typeof tagName4 === "string" && EMPTY_HTML_ELEMENTS.includes(tagName4.toLowerCase());
428
428
  };
429
+ function markMutable(value) {
430
+ return qwik.mutable(value);
431
+ }
432
+ function markPropsMutable(props) {
433
+ Object.keys(props).forEach((key) => {
434
+ props[key] = qwik.mutable(props[key]);
435
+ });
436
+ return props;
437
+ }
429
438
  const RenderComponent = (props) => {
430
439
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
431
440
  children: props.componentRef ? /* @__PURE__ */ jsxRuntime.jsxs(props.componentRef, {
432
- ...props.componentOptions,
441
+ ...markPropsMutable(props.componentOptions),
433
442
  children: [
434
443
  (props.blockChildren || []).map((child) => {
435
444
  return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock$1, {
@@ -737,7 +746,7 @@ const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
737
746
  ...columnCssVars(props, state)
738
747
  },
739
748
  children: /* @__PURE__ */ jsxRuntime.jsx(RenderBlocks$1, {
740
- blocks: column.blocks,
749
+ blocks: markMutable(column.blocks),
741
750
  path: `component.options.columns.${index}.blocks`,
742
751
  parent: props.builderBlock.id
743
752
  })
@@ -1885,7 +1894,7 @@ function getGlobalThis() {
1885
1894
  return self;
1886
1895
  return null;
1887
1896
  }
1888
- var __async$1 = (__this, __arguments, generator) => {
1897
+ var __async$2 = (__this, __arguments, generator) => {
1889
1898
  return new Promise((resolve, reject) => {
1890
1899
  var fulfilled = (value) => {
1891
1900
  try {
@@ -1906,7 +1915,7 @@ var __async$1 = (__this, __arguments, generator) => {
1906
1915
  });
1907
1916
  };
1908
1917
  function getFetch() {
1909
- return __async$1(this, null, function* () {
1918
+ return __async$2(this, null, function* () {
1910
1919
  const globalFetch = getGlobalThis().fetch;
1911
1920
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1912
1921
  const nodeFetch = Promise.resolve().then(() => require("./index.d8c1e37f.cjs")).then((d) => d.default);
@@ -1973,7 +1982,7 @@ var __spreadValues$2 = (a, b) => {
1973
1982
  return a;
1974
1983
  };
1975
1984
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1976
- var __async = (__this, __arguments, generator) => {
1985
+ var __async$1 = (__this, __arguments, generator) => {
1977
1986
  return new Promise((resolve, reject) => {
1978
1987
  var fulfilled = (value) => {
1979
1988
  try {
@@ -1995,14 +2004,14 @@ var __async = (__this, __arguments, generator) => {
1995
2004
  };
1996
2005
  const fetch$ = getFetch();
1997
2006
  function getContent(options) {
1998
- return __async(this, null, function* () {
2007
+ return __async$1(this, null, function* () {
1999
2008
  return (yield getAllContent(__spreadProps$2(__spreadValues$2({}, options), {
2000
2009
  limit: 1
2001
2010
  }))).results[0] || null;
2002
2011
  });
2003
2012
  }
2004
2013
  const generateContentUrl = (options) => {
2005
- const { limit = 1, userAttributes, query, noTraverse = false, model, apiKey } = options;
2014
+ const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey } = options;
2006
2015
  const url = new URL(`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`);
2007
2016
  const queryOptions = __spreadValues$2(__spreadValues$2({}, getBuilderSearchParamsFromWindow()), normalizeSearchParams(options.options || {}));
2008
2017
  const flattened = flatten(queryOptions);
@@ -2020,7 +2029,7 @@ const generateContentUrl = (options) => {
2020
2029
  return url;
2021
2030
  };
2022
2031
  function getAllContent(options) {
2023
- return __async(this, null, function* () {
2032
+ return __async$1(this, null, function* () {
2024
2033
  const url = generateContentUrl(options);
2025
2034
  const fetch2 = yield fetch$;
2026
2035
  const content = yield fetch2(url.href).then((res) => res.json());
@@ -2294,6 +2303,26 @@ var __objRest = (source, exclude) => {
2294
2303
  }
2295
2304
  return target;
2296
2305
  };
2306
+ var __async = (__this, __arguments, generator) => {
2307
+ return new Promise((resolve, reject) => {
2308
+ var fulfilled = (value) => {
2309
+ try {
2310
+ step(generator.next(value));
2311
+ } catch (e) {
2312
+ reject(e);
2313
+ }
2314
+ };
2315
+ var rejected = (value) => {
2316
+ try {
2317
+ step(generator.throw(value));
2318
+ } catch (e) {
2319
+ reject(e);
2320
+ }
2321
+ };
2322
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
2323
+ step((generator = generator.apply(__this, __arguments)).next());
2324
+ });
2325
+ };
2297
2326
  const getTrackingEventData = ({ canTrack }) => {
2298
2327
  if (!canTrack)
2299
2328
  return {
@@ -2329,23 +2358,27 @@ const createEvent = (_a) => {
2329
2358
  };
2330
2359
  };
2331
2360
  function track(eventProps) {
2332
- if (!eventProps.canTrack)
2333
- return;
2334
- if (isEditing())
2335
- return;
2336
- if (!(isBrowser() || TARGET === "reactNative"))
2337
- return;
2338
- return fetch(`https://builder.io/api/v1/track`, {
2339
- method: "POST",
2340
- body: JSON.stringify({
2341
- events: [
2342
- createEvent(eventProps)
2343
- ]
2344
- }),
2345
- headers: {
2346
- "content-type": "application/json"
2347
- },
2348
- mode: "cors"
2361
+ return __async(this, null, function* () {
2362
+ if (!eventProps.canTrack)
2363
+ return;
2364
+ if (isEditing())
2365
+ return;
2366
+ if (!(isBrowser() || TARGET === "reactNative"))
2367
+ return;
2368
+ return fetch(`https://builder.io/api/v1/track`, {
2369
+ method: "POST",
2370
+ body: JSON.stringify({
2371
+ events: [
2372
+ createEvent(eventProps)
2373
+ ]
2374
+ }),
2375
+ headers: {
2376
+ "content-type": "application/json"
2377
+ },
2378
+ mode: "cors"
2379
+ }).catch((err) => {
2380
+ console.error("Failed to track: ", err);
2381
+ });
2349
2382
  });
2350
2383
  }
2351
2384
  const getCssFromFont = function getCssFromFont2(props, state, font) {
@@ -2398,6 +2431,8 @@ const RenderContentStyles = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((p
2398
2431
  }, "RenderContentStyles_component_32XAr483K2o"));
2399
2432
  const RenderContentStyles$1 = RenderContentStyles;
2400
2433
  const useContent = function useContent2(props, state, elementRef) {
2434
+ if (!props.content && !state.overrideContent)
2435
+ return void 0;
2401
2436
  const mergedContent = {
2402
2437
  ...props.content,
2403
2438
  ...state.overrideContent,
@@ -2442,8 +2477,10 @@ const processMessage = function processMessage2(props, state, elementRef, event)
2442
2477
  const messageContent = data.data;
2443
2478
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
2444
2479
  const contentData = messageContent.data;
2445
- if (key === props.model)
2480
+ if (key === props.model) {
2446
2481
  state.overrideContent = contentData;
2482
+ state.forceReRenderCount = state.forceReRenderCount + 1;
2483
+ }
2447
2484
  break;
2448
2485
  }
2449
2486
  }
@@ -2641,7 +2678,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
2641
2678
  customFonts: useContent(props, state)?.data?.customFonts
2642
2679
  }) : null,
2643
2680
  /* @__PURE__ */ jsxRuntime.jsx(RenderBlocks$1, {
2644
- blocks: useContent(props, state)?.data?.blocks
2681
+ blocks: markMutable(useContent(props, state)?.data?.blocks)
2645
2682
  }, state.forceReRenderCount)
2646
2683
  ]
2647
2684
  }) : null
@@ -2690,14 +2727,14 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
2690
2727
  children: /* @__PURE__ */ jsxRuntime.jsx(RenderContent$1, {
2691
2728
  apiKey: builderContext.apiKey,
2692
2729
  context: builderContext.context,
2693
- customComponents: Object.values(builderContext.registeredComponents),
2694
- data: {
2730
+ customComponents: markMutable(Object.values(builderContext.registeredComponents)),
2731
+ data: markMutable({
2695
2732
  ...props.symbol?.data,
2696
2733
  ...builderContext.state,
2697
2734
  ...props.symbol?.content?.data?.state
2698
- },
2735
+ }),
2699
2736
  model: props.symbol?.model,
2700
- content: state.content
2737
+ content: markMutable(state.content)
2701
2738
  })
2702
2739
  });
2703
2740
  }, "Symbol_component_Dn8mGpai87I"));
@@ -1,4 +1,4 @@
1
- import { createContext, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
1
+ import { createContext, mutable, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
2
2
  import { jsx, Fragment as Fragment$1, jsxs } from "@builder.io/qwik/jsx-runtime";
3
3
  const TARGET = "qwik";
4
4
  function isBrowser() {
@@ -160,7 +160,7 @@ function evaluate({ code, context, state, event }) {
160
160
  try {
161
161
  return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
162
162
  } catch (e) {
163
- console.warn("Builder custom code error: ", e);
163
+ console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
164
164
  }
165
165
  }
166
166
  const set = (obj, _path, value) => {
@@ -424,10 +424,19 @@ const EMPTY_HTML_ELEMENTS = [
424
424
  const isEmptyHtmlElement = (tagName4) => {
425
425
  return typeof tagName4 === "string" && EMPTY_HTML_ELEMENTS.includes(tagName4.toLowerCase());
426
426
  };
427
+ function markMutable(value) {
428
+ return mutable(value);
429
+ }
430
+ function markPropsMutable(props) {
431
+ Object.keys(props).forEach((key) => {
432
+ props[key] = mutable(props[key]);
433
+ });
434
+ return props;
435
+ }
427
436
  const RenderComponent = (props) => {
428
437
  return /* @__PURE__ */ jsx(Fragment$1, {
429
438
  children: props.componentRef ? /* @__PURE__ */ jsxs(props.componentRef, {
430
- ...props.componentOptions,
439
+ ...markPropsMutable(props.componentOptions),
431
440
  children: [
432
441
  (props.blockChildren || []).map((child) => {
433
442
  return /* @__PURE__ */ jsx(RenderBlock$1, {
@@ -735,7 +744,7 @@ const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
735
744
  ...columnCssVars(props, state)
736
745
  },
737
746
  children: /* @__PURE__ */ jsx(RenderBlocks$1, {
738
- blocks: column.blocks,
747
+ blocks: markMutable(column.blocks),
739
748
  path: `component.options.columns.${index}.blocks`,
740
749
  parent: props.builderBlock.id
741
750
  })
@@ -1883,7 +1892,7 @@ function getGlobalThis() {
1883
1892
  return self;
1884
1893
  return null;
1885
1894
  }
1886
- var __async$1 = (__this, __arguments, generator) => {
1895
+ var __async$2 = (__this, __arguments, generator) => {
1887
1896
  return new Promise((resolve, reject) => {
1888
1897
  var fulfilled = (value) => {
1889
1898
  try {
@@ -1904,7 +1913,7 @@ var __async$1 = (__this, __arguments, generator) => {
1904
1913
  });
1905
1914
  };
1906
1915
  function getFetch() {
1907
- return __async$1(this, null, function* () {
1916
+ return __async$2(this, null, function* () {
1908
1917
  const globalFetch = getGlobalThis().fetch;
1909
1918
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1910
1919
  const nodeFetch = import("./index.97024df8.js").then((d) => d.default);
@@ -1971,7 +1980,7 @@ var __spreadValues$2 = (a, b) => {
1971
1980
  return a;
1972
1981
  };
1973
1982
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
1974
- var __async = (__this, __arguments, generator) => {
1983
+ var __async$1 = (__this, __arguments, generator) => {
1975
1984
  return new Promise((resolve, reject) => {
1976
1985
  var fulfilled = (value) => {
1977
1986
  try {
@@ -1993,14 +2002,14 @@ var __async = (__this, __arguments, generator) => {
1993
2002
  };
1994
2003
  const fetch$ = getFetch();
1995
2004
  function getContent(options) {
1996
- return __async(this, null, function* () {
2005
+ return __async$1(this, null, function* () {
1997
2006
  return (yield getAllContent(__spreadProps$2(__spreadValues$2({}, options), {
1998
2007
  limit: 1
1999
2008
  }))).results[0] || null;
2000
2009
  });
2001
2010
  }
2002
2011
  const generateContentUrl = (options) => {
2003
- const { limit = 1, userAttributes, query, noTraverse = false, model, apiKey } = options;
2012
+ const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey } = options;
2004
2013
  const url = new URL(`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`);
2005
2014
  const queryOptions = __spreadValues$2(__spreadValues$2({}, getBuilderSearchParamsFromWindow()), normalizeSearchParams(options.options || {}));
2006
2015
  const flattened = flatten(queryOptions);
@@ -2018,7 +2027,7 @@ const generateContentUrl = (options) => {
2018
2027
  return url;
2019
2028
  };
2020
2029
  function getAllContent(options) {
2021
- return __async(this, null, function* () {
2030
+ return __async$1(this, null, function* () {
2022
2031
  const url = generateContentUrl(options);
2023
2032
  const fetch2 = yield fetch$;
2024
2033
  const content = yield fetch2(url.href).then((res) => res.json());
@@ -2292,6 +2301,26 @@ var __objRest = (source, exclude) => {
2292
2301
  }
2293
2302
  return target;
2294
2303
  };
2304
+ var __async = (__this, __arguments, generator) => {
2305
+ return new Promise((resolve, reject) => {
2306
+ var fulfilled = (value) => {
2307
+ try {
2308
+ step(generator.next(value));
2309
+ } catch (e) {
2310
+ reject(e);
2311
+ }
2312
+ };
2313
+ var rejected = (value) => {
2314
+ try {
2315
+ step(generator.throw(value));
2316
+ } catch (e) {
2317
+ reject(e);
2318
+ }
2319
+ };
2320
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
2321
+ step((generator = generator.apply(__this, __arguments)).next());
2322
+ });
2323
+ };
2295
2324
  const getTrackingEventData = ({ canTrack }) => {
2296
2325
  if (!canTrack)
2297
2326
  return {
@@ -2327,23 +2356,27 @@ const createEvent = (_a) => {
2327
2356
  };
2328
2357
  };
2329
2358
  function track(eventProps) {
2330
- if (!eventProps.canTrack)
2331
- return;
2332
- if (isEditing())
2333
- return;
2334
- if (!(isBrowser() || TARGET === "reactNative"))
2335
- return;
2336
- return fetch(`https://builder.io/api/v1/track`, {
2337
- method: "POST",
2338
- body: JSON.stringify({
2339
- events: [
2340
- createEvent(eventProps)
2341
- ]
2342
- }),
2343
- headers: {
2344
- "content-type": "application/json"
2345
- },
2346
- mode: "cors"
2359
+ return __async(this, null, function* () {
2360
+ if (!eventProps.canTrack)
2361
+ return;
2362
+ if (isEditing())
2363
+ return;
2364
+ if (!(isBrowser() || TARGET === "reactNative"))
2365
+ return;
2366
+ return fetch(`https://builder.io/api/v1/track`, {
2367
+ method: "POST",
2368
+ body: JSON.stringify({
2369
+ events: [
2370
+ createEvent(eventProps)
2371
+ ]
2372
+ }),
2373
+ headers: {
2374
+ "content-type": "application/json"
2375
+ },
2376
+ mode: "cors"
2377
+ }).catch((err) => {
2378
+ console.error("Failed to track: ", err);
2379
+ });
2347
2380
  });
2348
2381
  }
2349
2382
  const getCssFromFont = function getCssFromFont2(props, state, font) {
@@ -2396,6 +2429,8 @@ const RenderContentStyles = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2396
2429
  }, "RenderContentStyles_component_32XAr483K2o"));
2397
2430
  const RenderContentStyles$1 = RenderContentStyles;
2398
2431
  const useContent = function useContent2(props, state, elementRef) {
2432
+ if (!props.content && !state.overrideContent)
2433
+ return void 0;
2399
2434
  const mergedContent = {
2400
2435
  ...props.content,
2401
2436
  ...state.overrideContent,
@@ -2440,8 +2475,10 @@ const processMessage = function processMessage2(props, state, elementRef, event)
2440
2475
  const messageContent = data.data;
2441
2476
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
2442
2477
  const contentData = messageContent.data;
2443
- if (key === props.model)
2478
+ if (key === props.model) {
2444
2479
  state.overrideContent = contentData;
2480
+ state.forceReRenderCount = state.forceReRenderCount + 1;
2481
+ }
2445
2482
  break;
2446
2483
  }
2447
2484
  }
@@ -2639,7 +2676,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2639
2676
  customFonts: useContent(props, state)?.data?.customFonts
2640
2677
  }) : null,
2641
2678
  /* @__PURE__ */ jsx(RenderBlocks$1, {
2642
- blocks: useContent(props, state)?.data?.blocks
2679
+ blocks: markMutable(useContent(props, state)?.data?.blocks)
2643
2680
  }, state.forceReRenderCount)
2644
2681
  ]
2645
2682
  }) : null
@@ -2688,14 +2725,14 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2688
2725
  children: /* @__PURE__ */ jsx(RenderContent$1, {
2689
2726
  apiKey: builderContext.apiKey,
2690
2727
  context: builderContext.context,
2691
- customComponents: Object.values(builderContext.registeredComponents),
2692
- data: {
2728
+ customComponents: markMutable(Object.values(builderContext.registeredComponents)),
2729
+ data: markMutable({
2693
2730
  ...props.symbol?.data,
2694
2731
  ...builderContext.state,
2695
2732
  ...props.symbol?.content?.data?.state
2696
- },
2733
+ }),
2697
2734
  model: props.symbol?.model,
2698
- content: state.content
2735
+ content: markMutable(state.content)
2699
2736
  })
2700
2737
  });
2701
2738
  }, "Symbol_component_Dn8mGpai87I"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -1,6 +1,7 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
3
  import RenderBlocks from "../../components/render-blocks";
4
+ import { markMutable } from "../../functions/mark-mutable";
4
5
  import { Fragment, component$, h, useStylesScoped$ } from "@builder.io/qwik";
5
6
  export const getGutterSize = function getGutterSize(props, state) {
6
7
  return typeof props.space === "number" ? props.space || 0 : 20;
@@ -77,7 +78,7 @@ export const Columns = component$((props) => {
77
78
  key={index}
78
79
  >
79
80
  <RenderBlocks
80
- blocks={column.blocks}
81
+ blocks={markMutable(column.blocks)}
81
82
  path={`component.options.columns.${index}.blocks`}
82
83
  parent={props.builderBlock.id}
83
84
  ></RenderBlocks>
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util";
1
+ import { markSerializable } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Columns",
4
4
  builtIn: true,
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util";
1
+ import { markSerializable } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Embed",
4
4
  static: true,
@@ -1,6 +1,6 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
- import { isJsScript } from "./helpers";
3
+ import { isJsScript } from "./helpers.js";
4
4
  import {
5
5
  Fragment,
6
6
  component$,
@@ -1,8 +1,8 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
3
  import RenderBlock from "../../components/render-block/render-block";
4
+ import BuilderBlocks from "../../components/render-blocks";
4
5
  import { isEditing } from "../../functions/is-editing.js";
5
- import BuilderBlocks from "./builder-blocks";
6
6
  import {
7
7
  Fragment,
8
8
  component$,
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util";
1
+ import { markSerializable } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Image",
4
4
  static: true,
@@ -1,6 +1,6 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
- import { getSrcSet } from "./image.helpers";
3
+ import { getSrcSet } from "./image.helpers.js";
4
4
  import {
5
5
  Fragment,
6
6
  Slot,
@@ -3,6 +3,7 @@
3
3
  import RenderContent from "../../components/render-content/render-content";
4
4
  import BuilderContext from "../../context/builder.context";
5
5
  import { getContent } from "../../functions/get-content/index.js";
6
+ import { markMutable } from "../../functions/mark-mutable";
6
7
  import {
7
8
  Fragment,
8
9
  component$,
@@ -60,14 +61,16 @@ export const Symbol = component$((props) => {
60
61
  <RenderContent
61
62
  apiKey={builderContext.apiKey}
62
63
  context={builderContext.context}
63
- customComponents={Object.values(builderContext.registeredComponents)}
64
- data={{
64
+ customComponents={markMutable(
65
+ Object.values(builderContext.registeredComponents)
66
+ )}
67
+ data={markMutable({
65
68
  ...props.symbol?.data,
66
69
  ...builderContext.state,
67
70
  ...props.symbol?.content?.data?.state,
68
- }}
71
+ })}
69
72
  model={props.symbol?.model}
70
- content={state.content}
73
+ content={markMutable(state.content)}
71
74
  ></RenderContent>
72
75
  </div>
73
76
  );
@@ -1,5 +1,6 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
+ import { markPropsMutable } from "../../functions/mark-mutable.js";
3
4
  import BlockStyles from "./block-styles";
4
5
  import RenderBlock from "./render-block";
5
6
  import { Fragment, h } from "@builder.io/qwik";
@@ -7,7 +8,7 @@ export const RenderComponent = (props) => {
7
8
  return (
8
9
  <>
9
10
  {props.componentRef ? (
10
- <props.componentRef {...props.componentOptions}>
11
+ <props.componentRef {...markPropsMutable(props.componentOptions)}>
11
12
  {(props.blockChildren || []).map((child) => {
12
13
  return (
13
14
  <RenderBlock
@@ -9,6 +9,7 @@ import { getFetch } from "../../functions/get-fetch.js";
9
9
  import { isBrowser } from "../../functions/is-browser.js";
10
10
  import { isEditing } from "../../functions/is-editing.js";
11
11
  import { isPreviewing } from "../../functions/is-previewing.js";
12
+ import { markMutable } from "../../functions/mark-mutable.js";
12
13
  import {
13
14
  components,
14
15
  createRegisterComponentMessage,
@@ -33,6 +34,10 @@ import {
33
34
  useWatch$,
34
35
  } from "@builder.io/qwik";
35
36
  export const useContent = function useContent(props, state, elementRef) {
37
+ if (!props.content && !state.overrideContent) {
38
+ return undefined;
39
+ }
40
+
36
41
  const mergedContent = {
37
42
  ...props.content,
38
43
  ...state.overrideContent,
@@ -102,6 +107,7 @@ export const processMessage = function processMessage(
102
107
 
103
108
  if (key === props.model) {
104
109
  state.overrideContent = contentData;
110
+ state.forceReRenderCount = state.forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
105
111
  }
106
112
 
107
113
  break;
@@ -349,7 +355,9 @@ export const RenderContent = component$((props) => {
349
355
  ></RenderContentStyles>
350
356
  ) : null}
351
357
  <RenderBlocks
352
- blocks={useContent(props, state, elementRef)?.data?.blocks}
358
+ blocks={markMutable(
359
+ useContent(props, state, elementRef)?.data?.blocks
360
+ )}
353
361
  key={state.forceReRenderCount}
354
362
  ></RenderBlocks>
355
363
  </div>
@@ -15,25 +15,25 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  import { default as Button } from "../blocks/button/button.jsx";
18
- import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info";
18
+ import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info.js";
19
19
  import { default as Columns } from "../blocks/columns/columns.jsx";
20
- import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info";
21
- import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info";
20
+ import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info.js";
21
+ import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info.js";
22
22
  import { default as Fragment } from "../blocks/fragment/fragment.jsx";
23
- import { componentInfo as imageComponentInfo } from "../blocks/image/component-info";
23
+ import { componentInfo as imageComponentInfo } from "../blocks/image/component-info.js";
24
24
  import { default as Image } from "../blocks/image/image.jsx";
25
- import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info";
25
+ import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info.js";
26
26
  import { default as Section } from "../blocks/section/section.jsx";
27
- import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info";
27
+ import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info.js";
28
28
  import { default as Symbol } from "../blocks/symbol/symbol.jsx";
29
- import { componentInfo as textComponentInfo } from "../blocks/text/component-info";
29
+ import { componentInfo as textComponentInfo } from "../blocks/text/component-info.js";
30
30
  import { default as Text } from "../blocks/text/text.jsx";
31
- import { componentInfo as videoComponentInfo } from "../blocks/video/component-info";
31
+ import { componentInfo as videoComponentInfo } from "../blocks/video/component-info.js";
32
32
  import { default as Video } from "../blocks/video/video.jsx";
33
- import { componentInfo as embedComponentInfo } from "../blocks/embed/component-info";
33
+ import { componentInfo as embedComponentInfo } from "../blocks/embed/component-info.js";
34
34
  import { default as embed } from "../blocks/embed/embed.jsx";
35
35
  import { default as Img } from "../blocks/img/img.jsx";
36
- import { componentInfo as imgComponentInfo } from "../blocks/img/component-info";
36
+ import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
37
37
  const getDefaultRegisteredComponents = () => [
38
38
  __spreadValues({ component: Columns }, columnsComponentInfo),
39
39
  __spreadValues({ component: Image }, imageComponentInfo),
@@ -20,7 +20,7 @@ function evaluate({
20
20
  try {
21
21
  return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
22
22
  } catch (e) {
23
- console.warn("Builder custom code error: ", e);
23
+ console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
24
24
  }
25
25
  }
26
26
  export {
@@ -1,4 +1,4 @@
1
- import { isBrowser } from "../is-browser";
1
+ import { isBrowser } from "../is-browser.js";
2
2
  const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
3
3
  const convertSearchParamsToQueryObject = (searchParams) => {
4
4
  const options = {};
@@ -52,7 +52,7 @@ function getContent(options) {
52
52
  }
53
53
  const generateContentUrl = (options) => {
54
54
  const {
55
- limit = 1,
55
+ limit = 30,
56
56
  userAttributes,
57
57
  query,
58
58
  noTraverse = false,
@@ -0,0 +1,14 @@
1
+ import { mutable } from "@builder.io/qwik";
2
+ function markMutable(value) {
3
+ return mutable(value);
4
+ }
5
+ function markPropsMutable(props) {
6
+ Object.keys(props).forEach((key) => {
7
+ props[key] = mutable(props[key]);
8
+ });
9
+ return props;
10
+ }
11
+ export {
12
+ markMutable,
13
+ markPropsMutable
14
+ };
@@ -29,6 +29,26 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
32
52
  import { TARGET } from "../constants/target.js";
33
53
  import { getSessionId } from "../helpers/sessionId.js";
34
54
  import { getVisitorId } from "../helpers/visitorId.js";
@@ -66,24 +86,28 @@ const createEvent = (_a) => {
66
86
  };
67
87
  };
68
88
  function track(eventProps) {
69
- if (!eventProps.canTrack) {
70
- return;
71
- }
72
- if (isEditing()) {
73
- return;
74
- }
75
- if (!(isBrowser() || TARGET === "reactNative")) {
76
- return;
77
- }
78
- return fetch(`https://builder.io/api/v1/track`, {
79
- method: "POST",
80
- body: JSON.stringify({
81
- events: [createEvent(eventProps)]
82
- }),
83
- headers: {
84
- "content-type": "application/json"
85
- },
86
- mode: "cors"
89
+ return __async(this, null, function* () {
90
+ if (!eventProps.canTrack) {
91
+ return;
92
+ }
93
+ if (isEditing()) {
94
+ return;
95
+ }
96
+ if (!(isBrowser() || TARGET === "reactNative")) {
97
+ return;
98
+ }
99
+ return fetch(`https://builder.io/api/v1/track`, {
100
+ method: "POST",
101
+ body: JSON.stringify({
102
+ events: [createEvent(eventProps)]
103
+ }),
104
+ headers: {
105
+ "content-type": "application/json"
106
+ },
107
+ mode: "cors"
108
+ }).catch((err) => {
109
+ console.error("Failed to track: ", err);
110
+ });
87
111
  });
88
112
  }
89
113
  export {
@@ -1,5 +1,5 @@
1
- import { isBrowser } from "../functions/is-browser";
2
- import { getTopLevelDomain } from "./url";
1
+ import { isBrowser } from "../functions/is-browser.js";
2
+ import { getTopLevelDomain } from "./url.js";
3
3
  const getCookie = ({
4
4
  name,
5
5
  canTrack
@@ -1,4 +1,4 @@
1
- import { camelToKebabCase } from "../functions/camel-to-kebab-case";
1
+ import { camelToKebabCase } from "../functions/camel-to-kebab-case.js";
2
2
  const convertStyleMaptoCSS = (style) => {
3
3
  const cssProps = Object.entries(style).map(([key, value]) => {
4
4
  if (typeof value === "string") {
@@ -1,4 +1,4 @@
1
- import { isBrowser } from "../functions/is-browser";
1
+ import { isBrowser } from "../functions/is-browser.js";
2
2
  const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
3
3
  const getLocalStorageItem = ({
4
4
  key,
@@ -1,6 +1,6 @@
1
- import { getCookie, setCookie } from "./cookie";
2
- import { checkIsDefined } from "./nullable";
3
- import { uuid } from "./uuid";
1
+ import { getCookie, setCookie } from "./cookie.js";
2
+ import { checkIsDefined } from "./nullable.js";
3
+ import { uuid } from "./uuid.js";
4
4
  const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
5
5
  const getSessionId = ({ canTrack }) => {
6
6
  if (!canTrack) {
@@ -1,6 +1,6 @@
1
- import { getLocalStorageItem, setLocalStorageItem } from "./localStorage";
2
- import { checkIsDefined } from "./nullable";
3
- import { uuid } from "./uuid";
1
+ import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
2
+ import { checkIsDefined } from "./nullable.js";
3
+ import { uuid } from "./uuid.js";
4
4
  const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
5
5
  const getVisitorId = ({ canTrack }) => {
6
6
  if (!canTrack) {
@@ -1,11 +0,0 @@
1
- // GENERATED BY MITOSIS
2
-
3
- import { Fragment, component$, h } from "@builder.io/qwik";
4
- export const BuilderBlocks = component$((props) => {
5
- return (
6
- <Fragment>
7
- NOT YET IMPLEMENTED: <code>BuilderBlocks {JSON.stringify(props)}</code>
8
- </Fragment>
9
- );
10
- });
11
- export default BuilderBlocks;