@builder.io/sdk-qwik 0.17.1 → 0.17.2

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.
Files changed (56) hide show
  1. package/lib/browser/blocks/text/text.qwik.cjs +6 -19
  2. package/lib/browser/blocks/text/text.qwik.mjs +7 -20
  3. package/lib/browser/components/block/block.qwik.cjs +2 -3
  4. package/lib/browser/components/block/block.qwik.mjs +2 -3
  5. package/lib/browser/components/content/components/enable-editor.qwik.cjs +9 -3
  6. package/lib/browser/components/content/components/enable-editor.qwik.mjs +9 -3
  7. package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
  8. package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
  9. package/lib/browser/functions/get-block-component-options.qwik.cjs +18 -2
  10. package/lib/browser/functions/get-block-component-options.qwik.mjs +18 -2
  11. package/lib/browser/functions/get-content/generate-content-url.qwik.cjs +26 -2
  12. package/lib/browser/functions/get-content/generate-content-url.qwik.mjs +27 -3
  13. package/lib/browser/functions/get-processed-block.qwik.cjs +8 -11
  14. package/lib/browser/functions/get-processed-block.qwik.mjs +8 -11
  15. package/lib/browser/helpers/flatten.qwik.cjs +18 -0
  16. package/lib/browser/helpers/flatten.qwik.mjs +19 -1
  17. package/lib/edge/blocks/text/text.qwik.cjs +6 -19
  18. package/lib/edge/blocks/text/text.qwik.mjs +7 -20
  19. package/lib/edge/components/block/block.qwik.cjs +2 -3
  20. package/lib/edge/components/block/block.qwik.mjs +2 -3
  21. package/lib/edge/components/content/components/enable-editor.qwik.cjs +9 -3
  22. package/lib/edge/components/content/components/enable-editor.qwik.mjs +9 -3
  23. package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
  24. package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
  25. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.qwik.cjs +1 -4
  26. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.qwik.mjs +1 -4
  27. package/lib/edge/functions/get-block-component-options.qwik.cjs +18 -2
  28. package/lib/edge/functions/get-block-component-options.qwik.mjs +18 -2
  29. package/lib/edge/functions/get-content/generate-content-url.qwik.cjs +26 -2
  30. package/lib/edge/functions/get-content/generate-content-url.qwik.mjs +27 -3
  31. package/lib/edge/functions/get-processed-block.qwik.cjs +8 -11
  32. package/lib/edge/functions/get-processed-block.qwik.mjs +8 -11
  33. package/lib/edge/helpers/flatten.qwik.cjs +18 -0
  34. package/lib/edge/helpers/flatten.qwik.mjs +19 -1
  35. package/lib/node/blocks/text/text.qwik.cjs +6 -19
  36. package/lib/node/blocks/text/text.qwik.mjs +7 -20
  37. package/lib/node/components/block/block.qwik.cjs +2 -3
  38. package/lib/node/components/block/block.qwik.mjs +2 -3
  39. package/lib/node/components/content/components/enable-editor.qwik.cjs +9 -3
  40. package/lib/node/components/content/components/enable-editor.qwik.mjs +9 -3
  41. package/lib/node/constants/sdk-version.qwik.cjs +1 -1
  42. package/lib/node/constants/sdk-version.qwik.mjs +1 -1
  43. package/lib/node/functions/get-block-component-options.qwik.cjs +18 -2
  44. package/lib/node/functions/get-block-component-options.qwik.mjs +18 -2
  45. package/lib/node/functions/get-content/generate-content-url.qwik.cjs +26 -2
  46. package/lib/node/functions/get-content/generate-content-url.qwik.mjs +27 -3
  47. package/lib/node/functions/get-processed-block.qwik.cjs +8 -11
  48. package/lib/node/functions/get-processed-block.qwik.mjs +8 -11
  49. package/lib/node/helpers/flatten.qwik.cjs +18 -0
  50. package/lib/node/helpers/flatten.qwik.mjs +19 -1
  51. package/package.json +1 -1
  52. package/types/src/constants/sdk-version.d.ts +1 -1
  53. package/types/src/functions/get-block-component-options.d.ts +2 -1
  54. package/types/src/functions/get-processed-block.d.ts +1 -6
  55. package/types/src/helpers/flatten.d.ts +6 -0
  56. package/types/src/server-index.d.ts +1 -1
@@ -1,28 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const qwik = require("@builder.io/qwik");
4
- const evaluate = require("../../functions/evaluate/evaluate.qwik.cjs");
5
4
  const Text = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
6
- const processedText = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
7
- var _a;
8
- const [props2] = qwik.useLexicalScope();
9
- const context = props2.builderContext;
10
- const { context: contextContext, localState, rootState, rootSetState } = context;
11
- return String(((_a = props2.text) == null ? void 0 : _a.toString()) || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate.evaluate({
12
- code: group,
13
- context: contextContext,
14
- localState,
15
- rootState,
16
- rootSetState
17
- }));
18
- }, "Text_component_processedText_useComputed_FbQ0o8kZPCU", [
19
- props
20
- ]));
21
5
  return /* @__PURE__ */ qwik._jsxQ("div", null, {
22
6
  class: "builder-text",
23
- dangerouslySetInnerHTML: qwik._fnSignal((p0) => p0.value, [
24
- processedText
25
- ], "p0.value"),
7
+ dangerouslySetInnerHTML: qwik._fnSignal((p0) => {
8
+ var _a;
9
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
10
+ }, [
11
+ props
12
+ ], 'p0.text?.toString()||""'),
26
13
  style: {
27
14
  outline: "none"
28
15
  }
@@ -1,26 +1,13 @@
1
- import { componentQrl, inlinedQrl, useComputedQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
2
- import { evaluate } from "../../functions/evaluate/evaluate.qwik.mjs";
1
+ import { componentQrl, inlinedQrl, _jsxQ, _fnSignal } from "@builder.io/qwik";
3
2
  const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
- const processedText = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
5
- var _a;
6
- const [props2] = useLexicalScope();
7
- const context = props2.builderContext;
8
- const { context: contextContext, localState, rootState, rootSetState } = context;
9
- return String(((_a = props2.text) == null ? void 0 : _a.toString()) || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
10
- code: group,
11
- context: contextContext,
12
- localState,
13
- rootState,
14
- rootSetState
15
- }));
16
- }, "Text_component_processedText_useComputed_FbQ0o8kZPCU", [
17
- props
18
- ]));
19
3
  return /* @__PURE__ */ _jsxQ("div", null, {
20
4
  class: "builder-text",
21
- dangerouslySetInnerHTML: _fnSignal((p0) => p0.value, [
22
- processedText
23
- ], "p0.value"),
5
+ dangerouslySetInnerHTML: _fnSignal((p0) => {
6
+ var _a;
7
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
8
+ }, [
9
+ props
10
+ ], 'p0.text?.toString()||""'),
24
11
  style: {
25
12
  outline: "none"
26
13
  }
@@ -37,8 +37,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
37
37
  localState: props2.context.localState,
38
38
  rootState: props2.context.rootState,
39
39
  rootSetState: props2.context.rootSetState,
40
- context: props2.context.context,
41
- shouldEvaluateBindings: true
40
+ context: props2.context.context
42
41
  });
43
42
  return blockToUse;
44
43
  }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
@@ -99,7 +98,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
99
98
  blockChildren: processedBlock2.value.children ?? [],
100
99
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
101
100
  componentOptions: {
102
- ...getBlockComponentOptions.getBlockComponentOptions(processedBlock2.value),
101
+ ...getBlockComponentOptions.getBlockComponentOptions(processedBlock2.value, props2.context),
103
102
  ...block_helpers.provideBuilderBlock(blockComponent2.value, processedBlock2.value),
104
103
  ...block_helpers.provideBuilderContext(blockComponent2.value, props2.context),
105
104
  ...block_helpers.provideLinkComponent(blockComponent2.value, props2.linkComponent),
@@ -35,8 +35,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
35
35
  localState: props2.context.localState,
36
36
  rootState: props2.context.rootState,
37
37
  rootSetState: props2.context.rootSetState,
38
- context: props2.context.context,
39
- shouldEvaluateBindings: true
38
+ context: props2.context.context
40
39
  });
41
40
  return blockToUse;
42
41
  }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
@@ -97,7 +96,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
97
96
  blockChildren: processedBlock2.value.children ?? [],
98
97
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
99
98
  componentOptions: {
100
- ...getBlockComponentOptions(processedBlock2.value),
99
+ ...getBlockComponentOptions(processedBlock2.value, props2.context),
101
100
  ...provideBuilderBlock(blockComponent2.value, processedBlock2.value),
102
101
  ...provideBuilderContext(blockComponent2.value, props2.context),
103
102
  ...provideLinkComponent(blockComponent2.value, props2.linkComponent),
@@ -185,16 +185,22 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
185
185
  state
186
186
  ]));
187
187
  qwik.useOn("initpreviewingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
188
+ var _a2;
188
189
  const [elementRef2, props2, showContentProps2, state2] = qwik.useLexicalScope();
189
190
  const searchParams = new URL(location.href).searchParams;
190
191
  const searchParamPreviewModel = searchParams.get("builder.preview");
191
192
  const searchParamPreviewId = searchParams.get(`builder.overrides.${searchParamPreviewModel}`);
192
193
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
193
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
194
+ if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
194
195
  index.fetchOneEntry({
195
- model: props2.model,
196
+ model: props2.model || "",
196
197
  apiKey: props2.apiKey,
197
- apiVersion: props2.builderContextSignal.apiVersion
198
+ apiVersion: props2.builderContextSignal.apiVersion,
199
+ ...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
200
+ query: {
201
+ id: props2.context.symbolId
202
+ }
203
+ } : {}
198
204
  }).then((content) => {
199
205
  if (content)
200
206
  mergeNewContent(props2, state2, showContentProps2, elementRef2, content);
@@ -183,16 +183,22 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
183
183
  state
184
184
  ]));
185
185
  useOn("initpreviewingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
186
+ var _a2;
186
187
  const [elementRef2, props2, showContentProps2, state2] = useLexicalScope();
187
188
  const searchParams = new URL(location.href).searchParams;
188
189
  const searchParamPreviewModel = searchParams.get("builder.preview");
189
190
  const searchParamPreviewId = searchParams.get(`builder.overrides.${searchParamPreviewModel}`);
190
191
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
191
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
192
+ if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
192
193
  fetchOneEntry({
193
- model: props2.model,
194
+ model: props2.model || "",
194
195
  apiKey: props2.apiKey,
195
- apiVersion: props2.builderContextSignal.apiVersion
196
+ apiVersion: props2.builderContextSignal.apiVersion,
197
+ ...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
198
+ query: {
199
+ id: props2.context.symbolId
200
+ }
201
+ } : {}
196
202
  }).then((content) => {
197
203
  if (content)
198
204
  mergeNewContent(props2, state2, showContentProps2, elementRef2, content);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.17.1";
3
+ const SDK_VERSION = "0.17.2";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.17.1";
1
+ const SDK_VERSION = "0.17.2";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function getBlockComponentOptions(block) {
3
+ const evaluate = require("./evaluate/evaluate.qwik.cjs");
4
+ function getBlockComponentOptions(block, context) {
4
5
  var _a;
5
6
  return {
6
7
  ...(_a = block.component) == null ? void 0 : _a.options,
7
- ...block.options
8
+ ...block.options,
9
+ ...evaluateTextComponentTextOption(block, context)
8
10
  };
9
11
  }
12
+ const evaluateTextComponentTextOption = (block, context) => {
13
+ var _a, _b;
14
+ if (((_a = block.component) == null ? void 0 : _a.name) === "Text" && ((_b = block.component.options) == null ? void 0 : _b.text) && typeof block.component.options.text === "string")
15
+ return {
16
+ ...block.component.options,
17
+ text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate.evaluate({
18
+ code: group,
19
+ context,
20
+ localState: context.localState,
21
+ rootState: context.rootState,
22
+ rootSetState: context.rootSetState
23
+ }))
24
+ };
25
+ };
10
26
  exports.getBlockComponentOptions = getBlockComponentOptions;
@@ -1,10 +1,26 @@
1
- function getBlockComponentOptions(block) {
1
+ import { evaluate } from "./evaluate/evaluate.qwik.mjs";
2
+ function getBlockComponentOptions(block, context) {
2
3
  var _a;
3
4
  return {
4
5
  ...(_a = block.component) == null ? void 0 : _a.options,
5
- ...block.options
6
+ ...block.options,
7
+ ...evaluateTextComponentTextOption(block, context)
6
8
  };
7
9
  }
10
+ const evaluateTextComponentTextOption = (block, context) => {
11
+ var _a, _b;
12
+ if (((_a = block.component) == null ? void 0 : _a.name) === "Text" && ((_b = block.component.options) == null ? void 0 : _b.text) && typeof block.component.options.text === "string")
13
+ return {
14
+ ...block.component.options,
15
+ text: block.component.options.text.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
16
+ code: group,
17
+ context,
18
+ localState: context.localState,
19
+ rootState: context.rootState,
20
+ rootSetState: context.rootSetState
21
+ }))
22
+ };
23
+ };
8
24
  export {
9
25
  getBlockComponentOptions
10
26
  };
@@ -4,6 +4,7 @@ const flatten = require("../../helpers/flatten.qwik.cjs");
4
4
  const search = require("../../helpers/search/search.qwik.cjs");
5
5
  const apiVersion = require("../../types/api-version.qwik.cjs");
6
6
  const index = require("../get-builder-search-params/index.qwik.cjs");
7
+ const isBrowser = require("../is-browser.qwik.cjs");
7
8
  const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
8
9
  const generateContentUrl = (options) => {
9
10
  const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion: apiVersion$1 = apiVersion.DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished, apiHost } = options;
@@ -21,7 +22,7 @@ const generateContentUrl = (options) => {
21
22
  url.searchParams.set("noTraverse", String(noTraverse));
22
23
  url.searchParams.set("includeRefs", String(true));
23
24
  const finalLocale = locale || (userAttributes == null ? void 0 : userAttributes.locale);
24
- let finalUserAttributes = userAttributes;
25
+ let finalUserAttributes = userAttributes || {};
25
26
  if (finalLocale) {
26
27
  url.searchParams.set("locale", finalLocale);
27
28
  finalUserAttributes = {
@@ -53,10 +54,14 @@ const generateContentUrl = (options) => {
53
54
  ...index.getBuilderSearchParamsFromWindow(),
54
55
  ...search.normalizeSearchParams(options.options || {})
55
56
  };
57
+ finalUserAttributes = {
58
+ ...finalUserAttributes,
59
+ ...getUserAttributesAsJSON(queryOptions)
60
+ };
56
61
  const flattened = flatten.flatten(queryOptions);
57
62
  for (const key in flattened)
58
63
  url.searchParams.set(key, String(flattened[key]));
59
- if (finalUserAttributes)
64
+ if (Object.keys(finalUserAttributes).length > 0)
60
65
  url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
61
66
  if (query) {
62
67
  const flattened2 = flatten.flattenMongoQuery({
@@ -67,4 +72,23 @@ const generateContentUrl = (options) => {
67
72
  }
68
73
  return url;
69
74
  };
75
+ const getUserAttributesFromQueryOptions = (queryOptions) => {
76
+ const newUserAttributes = {};
77
+ for (const key in queryOptions)
78
+ if (key.startsWith("userAttributes.")) {
79
+ newUserAttributes[key] = queryOptions[key];
80
+ delete queryOptions[key];
81
+ }
82
+ return newUserAttributes;
83
+ };
84
+ const getUserAttributesAsJSON = (queryOptions) => {
85
+ if (isBrowser.isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
86
+ queryOptions["userAttributes.urlPath"] = window.location.pathname;
87
+ queryOptions["userAttributes.host"] = window.location.host;
88
+ const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
89
+ const { userAttributes } = flatten.unflatten(queryOptionsForUserAttributes);
90
+ return userAttributes;
91
+ }
92
+ return {};
93
+ };
70
94
  exports.generateContentUrl = generateContentUrl;
@@ -1,7 +1,8 @@
1
- import { flatten, flattenMongoQuery } from "../../helpers/flatten.qwik.mjs";
1
+ import { flatten, flattenMongoQuery, unflatten } from "../../helpers/flatten.qwik.mjs";
2
2
  import { normalizeSearchParams } from "../../helpers/search/search.qwik.mjs";
3
3
  import { DEFAULT_API_VERSION } from "../../types/api-version.qwik.mjs";
4
4
  import { getBuilderSearchParamsFromWindow } from "../get-builder-search-params/index.qwik.mjs";
5
+ import { isBrowser } from "../is-browser.qwik.mjs";
5
6
  const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
6
7
  const generateContentUrl = (options) => {
7
8
  const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished, apiHost } = options;
@@ -19,7 +20,7 @@ const generateContentUrl = (options) => {
19
20
  url.searchParams.set("noTraverse", String(noTraverse));
20
21
  url.searchParams.set("includeRefs", String(true));
21
22
  const finalLocale = locale || (userAttributes == null ? void 0 : userAttributes.locale);
22
- let finalUserAttributes = userAttributes;
23
+ let finalUserAttributes = userAttributes || {};
23
24
  if (finalLocale) {
24
25
  url.searchParams.set("locale", finalLocale);
25
26
  finalUserAttributes = {
@@ -51,10 +52,14 @@ const generateContentUrl = (options) => {
51
52
  ...getBuilderSearchParamsFromWindow(),
52
53
  ...normalizeSearchParams(options.options || {})
53
54
  };
55
+ finalUserAttributes = {
56
+ ...finalUserAttributes,
57
+ ...getUserAttributesAsJSON(queryOptions)
58
+ };
54
59
  const flattened = flatten(queryOptions);
55
60
  for (const key in flattened)
56
61
  url.searchParams.set(key, String(flattened[key]));
57
- if (finalUserAttributes)
62
+ if (Object.keys(finalUserAttributes).length > 0)
58
63
  url.searchParams.set("userAttributes", JSON.stringify(finalUserAttributes));
59
64
  if (query) {
60
65
  const flattened2 = flattenMongoQuery({
@@ -65,6 +70,25 @@ const generateContentUrl = (options) => {
65
70
  }
66
71
  return url;
67
72
  };
73
+ const getUserAttributesFromQueryOptions = (queryOptions) => {
74
+ const newUserAttributes = {};
75
+ for (const key in queryOptions)
76
+ if (key.startsWith("userAttributes.")) {
77
+ newUserAttributes[key] = queryOptions[key];
78
+ delete queryOptions[key];
79
+ }
80
+ return newUserAttributes;
81
+ };
82
+ const getUserAttributesAsJSON = (queryOptions) => {
83
+ if (isBrowser() && queryOptions["preview"] === "BUILDER_STUDIO") {
84
+ queryOptions["userAttributes.urlPath"] = window.location.pathname;
85
+ queryOptions["userAttributes.host"] = window.location.host;
86
+ const queryOptionsForUserAttributes = getUserAttributesFromQueryOptions(queryOptions);
87
+ const { userAttributes } = unflatten(queryOptionsForUserAttributes);
88
+ return userAttributes;
89
+ }
90
+ return {};
91
+ };
68
92
  export {
69
93
  generateContentUrl
70
94
  };
@@ -72,19 +72,16 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
72
72
  }
73
73
  return copied;
74
74
  };
75
- function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }) {
75
+ function getProcessedBlock({ block, context, localState, rootState, rootSetState }) {
76
76
  let transformedBlock = extractLocalizedValues.resolveLocalizedValues(block, rootState.locale);
77
77
  transformedBlock = transformBlock.transformBlock(transformedBlock);
78
- if (shouldEvaluateBindings)
79
- return evaluateBindings({
80
- block: transformedBlock,
81
- localState,
82
- rootState,
83
- rootSetState,
84
- context
85
- });
86
- else
87
- return transformedBlock;
78
+ return evaluateBindings({
79
+ block: transformedBlock,
80
+ localState,
81
+ rootState,
82
+ rootSetState,
83
+ context
84
+ });
88
85
  }
89
86
  exports.deepCloneWithConditions = deepCloneWithConditions;
90
87
  exports.getProcessedBlock = getProcessedBlock;
@@ -70,19 +70,16 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
70
70
  }
71
71
  return copied;
72
72
  };
73
- function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }) {
73
+ function getProcessedBlock({ block, context, localState, rootState, rootSetState }) {
74
74
  let transformedBlock = resolveLocalizedValues(block, rootState.locale);
75
75
  transformedBlock = transformBlock(transformedBlock);
76
- if (shouldEvaluateBindings)
77
- return evaluateBindings({
78
- block: transformedBlock,
79
- localState,
80
- rootState,
81
- rootSetState,
82
- context
83
- });
84
- else
85
- return transformedBlock;
76
+ return evaluateBindings({
77
+ block: transformedBlock,
78
+ localState,
79
+ rootState,
80
+ rootSetState,
81
+ context
82
+ });
86
83
  }
87
84
  export {
88
85
  deepCloneWithConditions,
@@ -32,5 +32,23 @@ function flattenMongoQuery(obj, _current, _res = {}) {
32
32
  }
33
33
  return _res;
34
34
  }
35
+ function unflatten(obj) {
36
+ const result = {};
37
+ for (const key in obj) {
38
+ const parts = key.split(".");
39
+ let current = result;
40
+ for (let i = 0; i < parts.length; i++) {
41
+ const part = parts[i];
42
+ if (i === parts.length - 1)
43
+ current[part] = obj[key];
44
+ else {
45
+ current[part] = current[part] || {};
46
+ current = current[part];
47
+ }
48
+ }
49
+ }
50
+ return result;
51
+ }
35
52
  exports.flatten = flatten;
36
53
  exports.flattenMongoQuery = flattenMongoQuery;
54
+ exports.unflatten = unflatten;
@@ -30,7 +30,25 @@ function flattenMongoQuery(obj, _current, _res = {}) {
30
30
  }
31
31
  return _res;
32
32
  }
33
+ function unflatten(obj) {
34
+ const result = {};
35
+ for (const key in obj) {
36
+ const parts = key.split(".");
37
+ let current = result;
38
+ for (let i = 0; i < parts.length; i++) {
39
+ const part = parts[i];
40
+ if (i === parts.length - 1)
41
+ current[part] = obj[key];
42
+ else {
43
+ current[part] = current[part] || {};
44
+ current = current[part];
45
+ }
46
+ }
47
+ }
48
+ return result;
49
+ }
33
50
  export {
34
51
  flatten,
35
- flattenMongoQuery
52
+ flattenMongoQuery,
53
+ unflatten
36
54
  };
@@ -1,28 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const qwik = require("@builder.io/qwik");
4
- const evaluate = require("../../functions/evaluate/evaluate.qwik.cjs");
5
4
  const Text = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
6
- const processedText = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
7
- var _a;
8
- const [props2] = qwik.useLexicalScope();
9
- const context = props2.builderContext;
10
- const { context: contextContext, localState, rootState, rootSetState } = context;
11
- return String(((_a = props2.text) == null ? void 0 : _a.toString()) || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate.evaluate({
12
- code: group,
13
- context: contextContext,
14
- localState,
15
- rootState,
16
- rootSetState
17
- }));
18
- }, "Text_component_processedText_useComputed_FbQ0o8kZPCU", [
19
- props
20
- ]));
21
5
  return /* @__PURE__ */ qwik._jsxQ("div", null, {
22
6
  class: "builder-text",
23
- dangerouslySetInnerHTML: qwik._fnSignal((p0) => p0.value, [
24
- processedText
25
- ], "p0.value"),
7
+ dangerouslySetInnerHTML: qwik._fnSignal((p0) => {
8
+ var _a;
9
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
10
+ }, [
11
+ props
12
+ ], 'p0.text?.toString()||""'),
26
13
  style: {
27
14
  outline: "none"
28
15
  }
@@ -1,26 +1,13 @@
1
- import { componentQrl, inlinedQrl, useComputedQrl, useLexicalScope, _jsxQ, _fnSignal } from "@builder.io/qwik";
2
- import { evaluate } from "../../functions/evaluate/evaluate.qwik.mjs";
1
+ import { componentQrl, inlinedQrl, _jsxQ, _fnSignal } from "@builder.io/qwik";
3
2
  const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4
- const processedText = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
5
- var _a;
6
- const [props2] = useLexicalScope();
7
- const context = props2.builderContext;
8
- const { context: contextContext, localState, rootState, rootSetState } = context;
9
- return String(((_a = props2.text) == null ? void 0 : _a.toString()) || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
10
- code: group,
11
- context: contextContext,
12
- localState,
13
- rootState,
14
- rootSetState
15
- }));
16
- }, "Text_component_processedText_useComputed_FbQ0o8kZPCU", [
17
- props
18
- ]));
19
3
  return /* @__PURE__ */ _jsxQ("div", null, {
20
4
  class: "builder-text",
21
- dangerouslySetInnerHTML: _fnSignal((p0) => p0.value, [
22
- processedText
23
- ], "p0.value"),
5
+ dangerouslySetInnerHTML: _fnSignal((p0) => {
6
+ var _a;
7
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
8
+ }, [
9
+ props
10
+ ], 'p0.text?.toString()||""'),
24
11
  style: {
25
12
  outline: "none"
26
13
  }
@@ -37,8 +37,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
37
37
  localState: props2.context.localState,
38
38
  rootState: props2.context.rootState,
39
39
  rootSetState: props2.context.rootSetState,
40
- context: props2.context.context,
41
- shouldEvaluateBindings: true
40
+ context: props2.context.context
42
41
  });
43
42
  return blockToUse;
44
43
  }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
@@ -99,7 +98,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
99
98
  blockChildren: processedBlock2.value.children ?? [],
100
99
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
101
100
  componentOptions: {
102
- ...getBlockComponentOptions.getBlockComponentOptions(processedBlock2.value),
101
+ ...getBlockComponentOptions.getBlockComponentOptions(processedBlock2.value, props2.context),
103
102
  ...block_helpers.provideBuilderBlock(blockComponent2.value, processedBlock2.value),
104
103
  ...block_helpers.provideBuilderContext(blockComponent2.value, props2.context),
105
104
  ...block_helpers.provideLinkComponent(blockComponent2.value, props2.linkComponent),
@@ -35,8 +35,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
35
35
  localState: props2.context.localState,
36
36
  rootState: props2.context.rootState,
37
37
  rootSetState: props2.context.rootSetState,
38
- context: props2.context.context,
39
- shouldEvaluateBindings: true
38
+ context: props2.context.context
40
39
  });
41
40
  return blockToUse;
42
41
  }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
@@ -97,7 +96,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
97
96
  blockChildren: processedBlock2.value.children ?? [],
98
97
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
99
98
  componentOptions: {
100
- ...getBlockComponentOptions(processedBlock2.value),
99
+ ...getBlockComponentOptions(processedBlock2.value, props2.context),
101
100
  ...provideBuilderBlock(blockComponent2.value, processedBlock2.value),
102
101
  ...provideBuilderContext(blockComponent2.value, props2.context),
103
102
  ...provideLinkComponent(blockComponent2.value, props2.linkComponent),
@@ -185,16 +185,22 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
185
185
  state
186
186
  ]));
187
187
  qwik.useOn("initpreviewingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
188
+ var _a2;
188
189
  const [elementRef2, props2, showContentProps2, state2] = qwik.useLexicalScope();
189
190
  const searchParams = new URL(location.href).searchParams;
190
191
  const searchParamPreviewModel = searchParams.get("builder.preview");
191
192
  const searchParamPreviewId = searchParams.get(`builder.overrides.${searchParamPreviewModel}`);
192
193
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
193
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
194
+ if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
194
195
  index.fetchOneEntry({
195
- model: props2.model,
196
+ model: props2.model || "",
196
197
  apiKey: props2.apiKey,
197
- apiVersion: props2.builderContextSignal.apiVersion
198
+ apiVersion: props2.builderContextSignal.apiVersion,
199
+ ...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
200
+ query: {
201
+ id: props2.context.symbolId
202
+ }
203
+ } : {}
198
204
  }).then((content) => {
199
205
  if (content)
200
206
  mergeNewContent(props2, state2, showContentProps2, elementRef2, content);
@@ -183,16 +183,22 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
183
183
  state
184
184
  ]));
185
185
  useOn("initpreviewingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
186
+ var _a2;
186
187
  const [elementRef2, props2, showContentProps2, state2] = useLexicalScope();
187
188
  const searchParams = new URL(location.href).searchParams;
188
189
  const searchParamPreviewModel = searchParams.get("builder.preview");
189
190
  const searchParamPreviewId = searchParams.get(`builder.overrides.${searchParamPreviewModel}`);
190
191
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
191
- if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
192
+ if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
192
193
  fetchOneEntry({
193
- model: props2.model,
194
+ model: props2.model || "",
194
195
  apiKey: props2.apiKey,
195
- apiVersion: props2.builderContextSignal.apiVersion
196
+ apiVersion: props2.builderContextSignal.apiVersion,
197
+ ...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
198
+ query: {
199
+ id: props2.context.symbolId
200
+ }
201
+ } : {}
196
202
  }).then((content) => {
197
203
  if (content)
198
204
  mergeNewContent(props2, state2, showContentProps2, elementRef2, content);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.17.1";
3
+ const SDK_VERSION = "0.17.2";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.17.1";
1
+ const SDK_VERSION = "0.17.2";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };