@builder.io/sdk-qwik 0.5.5 → 0.5.7

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 (208) hide show
  1. package/lib/index.qwik.cjs +45 -15
  2. package/lib/index.qwik.mjs +45 -15
  3. package/package.json +5 -1
  4. package/types/blocks/symbol/symbol.helpers.d.ts +1 -1
  5. package/types/components/block/components/component-ref/component-ref.helpers.d.ts +1 -1
  6. package/types/components/blocks/blocks.d.ts +1 -1
  7. package/types/components/content/index.d.ts +1 -1
  8. package/types/constants/sdk-version.d.ts +1 -1
  9. package/types/constants/target.d.ts +1 -1
  10. package/types/functions/fetch-builder-props.d.ts +39 -0
  11. package/types/functions/get-content/index.d.ts +20 -3
  12. package/types/helpers/preview-lru-cache/get.d.ts +1 -1
  13. package/types/helpers/preview-lru-cache/set.d.ts +1 -1
  14. package/types/index-helpers/blocks-exports.d.ts +21 -10
  15. package/types/index.d.ts +4 -3
  16. package/types/src/blocks/BaseText.d.ts +5 -0
  17. package/types/src/blocks/button/button.d.ts +11 -0
  18. package/types/src/blocks/button/component-info.d.ts +2 -0
  19. package/types/src/blocks/columns/columns.d.ts +32 -0
  20. package/types/src/blocks/columns/component-info.d.ts +2 -0
  21. package/types/src/blocks/custom-code/component-info.d.ts +2 -0
  22. package/types/src/blocks/custom-code/custom-code.d.ts +7 -0
  23. package/types/src/blocks/embed/component-info.d.ts +2 -0
  24. package/types/src/blocks/embed/embed.d.ts +6 -0
  25. package/types/src/blocks/embed/helpers.d.ts +1 -0
  26. package/types/src/blocks/form/component-info.d.ts +2 -0
  27. package/types/src/blocks/fragment/component-info.d.ts +2 -0
  28. package/types/src/blocks/fragment/fragment.d.ts +7 -0
  29. package/types/src/blocks/helpers.d.ts +13 -0
  30. package/types/src/blocks/image/component-info.d.ts +2 -0
  31. package/types/src/blocks/image/image.d.ts +23 -0
  32. package/types/src/blocks/image/image.helpers.d.ts +1 -0
  33. package/types/src/blocks/img/component-info.d.ts +2 -0
  34. package/types/src/blocks/img/img.d.ts +12 -0
  35. package/types/src/blocks/input/component-info.d.ts +2 -0
  36. package/types/src/blocks/input/input.d.ts +13 -0
  37. package/types/src/blocks/raw-text/component-info.d.ts +2 -0
  38. package/types/src/blocks/raw-text/raw-text.d.ts +6 -0
  39. package/types/src/blocks/section/component-info.d.ts +2 -0
  40. package/types/src/blocks/section/section.d.ts +10 -0
  41. package/types/src/blocks/select/component-info.d.ts +2 -0
  42. package/types/src/blocks/select/select.d.ts +14 -0
  43. package/types/src/blocks/submit-button/component-info.d.ts +2 -0
  44. package/types/src/blocks/submit-button/submit-button.d.ts +8 -0
  45. package/types/src/blocks/symbol/component-info.d.ts +2 -0
  46. package/types/src/blocks/symbol/symbol.d.ts +24 -0
  47. package/types/src/blocks/symbol/symbol.helpers.d.ts +14 -0
  48. package/types/src/blocks/text/component-info.d.ts +2 -0
  49. package/types/src/blocks/text/text.d.ts +5 -0
  50. package/types/src/blocks/textarea/component-info.d.ts +2 -0
  51. package/types/src/blocks/textarea/textarea.d.ts +11 -0
  52. package/types/src/blocks/video/component-info.d.ts +2 -0
  53. package/types/src/blocks/video/video.d.ts +19 -0
  54. package/types/src/components/block/block.d.ts +9 -0
  55. package/types/src/components/block/block.helpers.d.ts +13 -0
  56. package/types/{components/render-block → src/components/block/components}/block-styles.d.ts +2 -2
  57. package/types/{components/block/components/block-wrapper → src/components/block/components}/block-wrapper.d.ts +7 -4
  58. package/types/src/components/block/components/component-ref/component-ref.d.ts +3 -0
  59. package/types/src/components/block/components/component-ref/component-ref.helpers.d.ts +35 -0
  60. package/types/src/components/block/components/interactive-element.d.ts +11 -0
  61. package/types/src/components/block/components/repeated-block.d.ts +9 -0
  62. package/types/src/components/blocks/blocks-wrapper.d.ts +13 -0
  63. package/types/src/components/blocks/blocks.d.ts +8 -0
  64. package/types/{components/render-content/render-content.d.ts → src/components/content/components/enable-editor.d.ts} +10 -7
  65. package/types/{components/content/components/content-styles.d.ts → src/components/content/components/styles.d.ts} +1 -1
  66. package/types/{components/content/components/content-styles.helpers.d.ts → src/components/content/components/styles.helpers.d.ts} +1 -1
  67. package/types/src/components/content/content.d.ts +5 -0
  68. package/types/src/components/content/content.helpers.d.ts +7 -0
  69. package/types/{components/render-content/render-content.types.d.ts → src/components/content/content.types.d.ts} +4 -4
  70. package/types/src/components/content/index.d.ts +1 -0
  71. package/types/src/components/content-variants/content-variants.d.ts +9 -0
  72. package/types/{components/render-content-variants/render-content-variants.types.d.ts → src/components/content-variants/content-variants.types.d.ts} +5 -5
  73. package/types/{components/render-content-variants → src/components/content-variants}/helpers.d.ts +7 -7
  74. package/types/src/components/inlined-script.d.ts +6 -0
  75. package/types/src/components/inlined-styles.d.ts +6 -0
  76. package/types/src/constants/builder-registered-components.d.ts +6 -0
  77. package/types/src/constants/device-sizes.d.ts +13 -0
  78. package/types/src/constants/sdk-version.d.ts +1 -0
  79. package/types/src/constants/target.d.ts +2 -0
  80. package/types/src/context/builder.context.d.ts +2 -0
  81. package/types/src/context/components.context.d.ts +2 -0
  82. package/types/src/context/types.d.ts +35 -0
  83. package/types/src/functions/apply-patch-with-mutation.d.ts +10 -0
  84. package/types/src/functions/camel-to-kebab-case.d.ts +1 -0
  85. package/types/src/functions/evaluate/browser-runtime/browser.d.ts +4 -0
  86. package/types/src/functions/evaluate/browser-runtime/index.d.ts +1 -0
  87. package/types/src/functions/evaluate/evaluate.d.ts +10 -0
  88. package/types/src/functions/evaluate/helpers.d.ts +18 -0
  89. package/types/src/functions/evaluate/index.d.ts +1 -0
  90. package/types/src/functions/evaluate/node-runtime/index.d.ts +1 -0
  91. package/types/src/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
  92. package/types/src/functions/evaluate/non-node-runtime/acorn-interpreter.d.ts +2 -0
  93. package/types/src/functions/evaluate/non-node-runtime/index.d.ts +1 -0
  94. package/types/{functions/evaluate → src/functions/evaluate/non-node-runtime}/non-node-runtime.d.ts +1 -1
  95. package/types/src/functions/evaluate/placeholder-runtime.d.ts +2 -0
  96. package/types/src/functions/evaluate/types.d.ts +11 -0
  97. package/types/src/functions/event-handler-name.d.ts +1 -0
  98. package/types/src/functions/extract-text-styles.d.ts +4 -0
  99. package/types/src/functions/fast-clone.d.ts +4 -0
  100. package/types/src/functions/fetch-builder-props.d.ts +39 -0
  101. package/types/src/functions/get-block-actions-handler.d.ts +5 -0
  102. package/types/src/functions/get-block-actions.d.ts +10 -0
  103. package/types/src/functions/get-block-component-options.d.ts +2 -0
  104. package/types/src/functions/get-block-properties.d.ts +11 -0
  105. package/types/src/functions/get-builder-search-params/index.d.ts +12 -0
  106. package/types/src/functions/get-content/generate-content-url.d.ts +2 -0
  107. package/types/src/functions/get-content/index.d.ts +29 -0
  108. package/types/src/functions/get-content/types.d.ts +51 -0
  109. package/types/src/functions/get-fetch.d.ts +1 -0
  110. package/types/src/functions/get-global-this.d.ts +4 -0
  111. package/types/src/functions/get-processed-block.d.ts +10 -0
  112. package/types/{functions/get-block-styles.d.ts → src/functions/get-react-native-block-styles.d.ts} +3 -2
  113. package/types/src/functions/if-target.d.ts +7 -0
  114. package/types/src/functions/is-browser.d.ts +1 -0
  115. package/types/src/functions/is-editing.d.ts +1 -0
  116. package/types/src/functions/is-iframe.d.ts +1 -0
  117. package/types/src/functions/is-non-node-server.d.ts +4 -0
  118. package/types/src/functions/is-previewing.d.ts +1 -0
  119. package/types/src/functions/on-change.d.ts +7 -0
  120. package/types/src/functions/register-component.d.ts +15 -0
  121. package/types/src/functions/register.d.ts +16 -0
  122. package/types/src/functions/sanitize-react-native-block-styles.d.ts +3 -0
  123. package/types/src/functions/set-editor-settings.d.ts +4 -0
  124. package/types/src/functions/set.d.ts +7 -0
  125. package/types/src/functions/track/helpers.d.ts +5 -0
  126. package/types/{functions/track.d.ts → src/functions/track/index.d.ts} +6 -11
  127. package/types/src/functions/track/interaction.d.ts +13 -0
  128. package/types/src/functions/transform-block-properties.d.ts +1 -0
  129. package/types/src/functions/transform-block.d.ts +2 -0
  130. package/types/src/helpers/ab-tests.d.ts +9 -0
  131. package/types/src/helpers/canTrack.d.ts +1 -0
  132. package/types/src/helpers/cookie.d.ts +19 -0
  133. package/types/src/helpers/css.d.ts +7 -0
  134. package/types/src/helpers/flatten.d.ts +6 -0
  135. package/types/src/helpers/localStorage.d.ts +9 -0
  136. package/types/src/helpers/logger.d.ts +6 -0
  137. package/types/src/helpers/nullable.d.ts +2 -0
  138. package/types/src/helpers/preview-lru-cache/get.d.ts +2 -0
  139. package/types/src/helpers/preview-lru-cache/helpers.d.ts +0 -0
  140. package/types/src/helpers/preview-lru-cache/init.d.ts +6 -0
  141. package/types/src/helpers/preview-lru-cache/set.d.ts +7 -0
  142. package/types/src/helpers/preview-lru-cache/types.d.ts +0 -0
  143. package/types/src/helpers/sessionId.d.ts +6 -0
  144. package/types/src/helpers/time.d.ts +1 -0
  145. package/types/src/helpers/url.d.ts +6 -0
  146. package/types/src/helpers/uuid.d.ts +8 -0
  147. package/types/src/helpers/visitorId.d.ts +6 -0
  148. package/types/src/index-helpers/blocks-exports.d.ts +21 -0
  149. package/types/src/index-helpers/top-of-file.d.ts +1 -0
  150. package/types/src/index.d.ts +16 -0
  151. package/types/src/scripts/init-editing.d.ts +6 -0
  152. package/types/src/types/api-version.d.ts +2 -0
  153. package/types/src/types/builder-block.d.ts +66 -0
  154. package/types/src/types/builder-content.d.ts +44 -0
  155. package/types/src/types/builder-props.d.ts +9 -0
  156. package/types/src/types/can-track.d.ts +3 -0
  157. package/types/src/types/components.d.ts +111 -0
  158. package/types/src/types/deep-partial.d.ts +3 -0
  159. package/types/src/types/element.d.ts +59 -0
  160. package/types/src/types/enforced-partials.d.ts +21 -0
  161. package/types/src/types/input.d.ts +121 -0
  162. package/types/src/types/targets.d.ts +1 -0
  163. package/types/src/types/typescript.d.ts +11 -0
  164. package/types/blocks/util.d.ts +0 -4
  165. package/types/components/block/components/component-ref.d.ts +0 -23
  166. package/types/components/block/components/component.d.ts +0 -21
  167. package/types/components/block/components/interactive-element/interactive-element.d.ts +0 -4
  168. package/types/components/block/components/interactive-element/interactive-element.helpers.d.ts +0 -16
  169. package/types/components/content/builder-editing.d.ts +0 -2
  170. package/types/components/content/components/render-styles.d.ts +0 -8
  171. package/types/components/content/components/render-styles.helpers.d.ts +0 -15
  172. package/types/components/render-block/render-block.d.ts +0 -8
  173. package/types/components/render-block/render-block.helpers.d.ts +0 -12
  174. package/types/components/render-block/render-component-with-context.d.ts +0 -3
  175. package/types/components/render-block/render-component.d.ts +0 -18
  176. package/types/components/render-block/render-repeated-block.d.ts +0 -8
  177. package/types/components/render-blocks.d.ts +0 -12
  178. package/types/components/render-content/builder-editing.d.ts +0 -2
  179. package/types/components/render-content/components/render-styles.d.ts +0 -8
  180. package/types/components/render-content/components/render-styles.helpers.d.ts +0 -15
  181. package/types/components/render-content/index.d.ts +0 -1
  182. package/types/components/render-content/render-content.helpers.d.ts +0 -7
  183. package/types/components/render-content-variants/render-content-variants.d.ts +0 -9
  184. package/types/components/render-inlined-styles.d.ts +0 -6
  185. package/types/functions/acorn_interpreter.d.ts +0 -1
  186. package/types/functions/apply-patch-with-mutation.test.d.ts +0 -1
  187. package/types/functions/convert-style-object.d.ts +0 -1
  188. package/types/functions/evaluate/acorn.d.ts +0 -11
  189. package/types/functions/evaluate/evaluate.test.d.ts +0 -1
  190. package/types/functions/evaluate.d.ts +0 -23
  191. package/types/functions/evaluate.test.d.ts +0 -1
  192. package/types/functions/get-block-tag.d.ts +0 -3
  193. package/types/functions/get-builder-search-params/fn.test.d.ts +0 -1
  194. package/types/functions/get-content/ab-testing.d.ts +0 -5
  195. package/types/functions/get-content/fn.test.d.ts +0 -1
  196. package/types/functions/get-content/generate-content-url.test.d.ts +0 -1
  197. package/types/functions/get-content/processCookies.d.ts +0 -2
  198. package/types/functions/get-processed-block.test.d.ts +0 -1
  199. package/types/functions/mark-mutable.d.ts +0 -2
  200. package/types/functions/on-change.test.d.ts +0 -1
  201. package/types/functions/sanitize-styles.d.ts +0 -4
  202. package/types/functions/set.test.d.ts +0 -1
  203. package/types/helpers/url.test.d.ts +0 -1
  204. package/types/talk/generators-updated.d.ts +0 -1
  205. package/types/talk/generators.d.ts +0 -6
  206. /package/types/{components/render-block → src/components/block}/types.d.ts +0 -0
  207. /package/types/{components/render-content → src/components/content}/wrap-component-ref.d.ts +0 -0
  208. /package/types/{functions/evaluate/interpreter.d.ts → src/functions/evaluate/acorn-interpreter.d.ts} +0 -0
@@ -6042,8 +6042,8 @@ const generateContentUrl = (options) => {
6042
6042
  return url;
6043
6043
  };
6044
6044
  const checkContentHasResults = (content) => "results" in content;
6045
- async function getContent(options) {
6046
- const allContent = await getAllContent({
6045
+ async function fetchOneEntry(options) {
6046
+ const allContent = await fetchEntries({
6047
6047
  ...options,
6048
6048
  limit: 1
6049
6049
  });
@@ -6051,13 +6051,14 @@ async function getContent(options) {
6051
6051
  return allContent.results[0] || null;
6052
6052
  return null;
6053
6053
  }
6054
- const fetchContent$1 = async (options) => {
6054
+ const getContent = fetchOneEntry;
6055
+ const _fetchContent = async (options) => {
6055
6056
  const url = generateContentUrl(options);
6056
6057
  const res = await fetch$1(url.href);
6057
6058
  const content = await res.json();
6058
6059
  return content;
6059
6060
  };
6060
- const processContentResult = async (options, content, url = generateContentUrl(options)) => {
6061
+ const _processContentResult = async (options, content, url = generateContentUrl(options)) => {
6061
6062
  const canTrack = getDefaultCanTrack(options.canTrack);
6062
6063
  url.search.includes(`preview=`);
6063
6064
  if (!canTrack)
@@ -6077,10 +6078,10 @@ const processContentResult = async (options, content, url = generateContentUrl(o
6077
6078
  }
6078
6079
  return content;
6079
6080
  };
6080
- async function getAllContent(options) {
6081
+ async function fetchEntries(options) {
6081
6082
  try {
6082
6083
  const url = generateContentUrl(options);
6083
- const content = await fetchContent$1(options);
6084
+ const content = await _fetchContent(options);
6084
6085
  if (!checkContentHasResults(content)) {
6085
6086
  logger.error("Error fetching data. ", {
6086
6087
  url,
@@ -6089,12 +6090,13 @@ async function getAllContent(options) {
6089
6090
  });
6090
6091
  return null;
6091
6092
  }
6092
- return processContentResult(options, content);
6093
+ return _processContentResult(options, content);
6093
6094
  } catch (error) {
6094
6095
  logger.error("Error fetching data. ", error);
6095
6096
  return null;
6096
6097
  }
6097
6098
  }
6099
+ const getAllContent = fetchEntries;
6098
6100
  function isPreviewing() {
6099
6101
  if (!isBrowser())
6100
6102
  return false;
@@ -6336,7 +6338,7 @@ const getInteractionPropertiesForEvent = (event) => {
6336
6338
  }
6337
6339
  };
6338
6340
  };
6339
- const SDK_VERSION = "UNKNOWN_VERSION";
6341
+ const SDK_VERSION = "0.5.7";
6340
6342
  const registry = {};
6341
6343
  function register(type, info) {
6342
6344
  let typeList = registry[type];
@@ -6652,7 +6654,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
6652
6654
  const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6653
6655
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6654
6656
  if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6655
- getContent({
6657
+ fetchOneEntry({
6656
6658
  model: props2.model,
6657
6659
  apiKey: props2.apiKey,
6658
6660
  apiVersion: props2.builderContextSignal.apiVersion
@@ -7324,10 +7326,10 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
7324
7326
  ]
7325
7327
  }, 1, "XM_5");
7326
7328
  }, "ContentVariants_component_4tFRiQMMEfM"));
7327
- const fetchContent = async ({ builderContextValue, symbol }) => {
7329
+ const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
7328
7330
  if ((symbol == null ? void 0 : symbol.model) && // This is a hack, we should not need to check for this, but it is needed for Svelte.
7329
7331
  (builderContextValue == null ? void 0 : builderContextValue.apiKey))
7330
- return getContent({
7332
+ return fetchOneEntry({
7331
7333
  model: symbol.model,
7332
7334
  apiKey: builderContextValue.apiKey,
7333
7335
  apiVersion: builderContextValue.apiVersion,
@@ -7345,7 +7347,7 @@ const fetchContent = async ({ builderContextValue, symbol }) => {
7345
7347
  const setContent = function setContent2(props, state) {
7346
7348
  if (state.contentToUse)
7347
7349
  return;
7348
- fetchContent({
7350
+ fetchSymbolContent({
7349
7351
  symbol: props.symbol,
7350
7352
  builderContextValue: props.builderContext
7351
7353
  }).then((newContent) => {
@@ -7456,6 +7458,8 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQ
7456
7458
  ], "p0.value")
7457
7459
  }, 0, "Wt_1");
7458
7460
  }, "Symbol_component_WVvggdkUPdk"));
7461
+ const RenderBlocks = Blocks;
7462
+ const RenderContent = ContentVariants;
7459
7463
  const settings = {};
7460
7464
  function setEditorSettings(newSettings) {
7461
7465
  if (isBrowser()) {
@@ -7467,23 +7471,49 @@ function setEditorSettings(newSettings) {
7467
7471
  parent.postMessage(message, "*");
7468
7472
  }
7469
7473
  }
7474
+ const fetchBuilderProps = async (_args) => {
7475
+ var _a, _b, _c;
7476
+ const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
7477
+ const getContentArgs = {
7478
+ ..._args,
7479
+ apiKey: _args.apiKey,
7480
+ model: _args.model || "page",
7481
+ userAttributes: {
7482
+ ..._args.userAttributes,
7483
+ ...urlPath ? {
7484
+ urlPath
7485
+ } : {}
7486
+ },
7487
+ options: getBuilderSearchParams(_args.searchParams || ((_c = _args.url) == null ? void 0 : _c.searchParams) || _args.options)
7488
+ };
7489
+ return {
7490
+ apiKey: getContentArgs.apiKey,
7491
+ model: getContentArgs.model,
7492
+ content: await fetchOneEntry(getContentArgs)
7493
+ };
7494
+ };
7495
+ exports.Blocks = Blocks;
7470
7496
  exports.Button = Button;
7471
7497
  exports.Columns = Columns;
7498
+ exports.Content = ContentVariants;
7472
7499
  exports.Fragment = FragmentComponent;
7473
7500
  exports.Image = Image;
7474
- exports.RenderBlocks = Blocks;
7475
- exports.RenderContent = ContentVariants;
7501
+ exports.RenderBlocks = RenderBlocks;
7502
+ exports.RenderContent = RenderContent;
7476
7503
  exports.Section = SectionComponent;
7477
7504
  exports.Symbol = Symbol$1;
7478
7505
  exports.Text = Text;
7479
7506
  exports.Video = Video;
7507
+ exports._processContentResult = _processContentResult;
7480
7508
  exports.createRegisterComponentMessage = createRegisterComponentMessage;
7509
+ exports.fetchBuilderProps = fetchBuilderProps;
7510
+ exports.fetchEntries = fetchEntries;
7511
+ exports.fetchOneEntry = fetchOneEntry;
7481
7512
  exports.getAllContent = getAllContent;
7482
7513
  exports.getBuilderSearchParams = getBuilderSearchParams;
7483
7514
  exports.getContent = getContent;
7484
7515
  exports.isEditing = isEditing;
7485
7516
  exports.isPreviewing = isPreviewing;
7486
- exports.processContentResult = processContentResult;
7487
7517
  exports.register = register;
7488
7518
  exports.setEditorSettings = setEditorSettings;
7489
7519
  exports.track = track;
@@ -6040,8 +6040,8 @@ const generateContentUrl = (options) => {
6040
6040
  return url;
6041
6041
  };
6042
6042
  const checkContentHasResults = (content) => "results" in content;
6043
- async function getContent(options) {
6044
- const allContent = await getAllContent({
6043
+ async function fetchOneEntry(options) {
6044
+ const allContent = await fetchEntries({
6045
6045
  ...options,
6046
6046
  limit: 1
6047
6047
  });
@@ -6049,13 +6049,14 @@ async function getContent(options) {
6049
6049
  return allContent.results[0] || null;
6050
6050
  return null;
6051
6051
  }
6052
- const fetchContent$1 = async (options) => {
6052
+ const getContent = fetchOneEntry;
6053
+ const _fetchContent = async (options) => {
6053
6054
  const url = generateContentUrl(options);
6054
6055
  const res = await fetch$1(url.href);
6055
6056
  const content = await res.json();
6056
6057
  return content;
6057
6058
  };
6058
- const processContentResult = async (options, content, url = generateContentUrl(options)) => {
6059
+ const _processContentResult = async (options, content, url = generateContentUrl(options)) => {
6059
6060
  const canTrack = getDefaultCanTrack(options.canTrack);
6060
6061
  url.search.includes(`preview=`);
6061
6062
  if (!canTrack)
@@ -6075,10 +6076,10 @@ const processContentResult = async (options, content, url = generateContentUrl(o
6075
6076
  }
6076
6077
  return content;
6077
6078
  };
6078
- async function getAllContent(options) {
6079
+ async function fetchEntries(options) {
6079
6080
  try {
6080
6081
  const url = generateContentUrl(options);
6081
- const content = await fetchContent$1(options);
6082
+ const content = await _fetchContent(options);
6082
6083
  if (!checkContentHasResults(content)) {
6083
6084
  logger.error("Error fetching data. ", {
6084
6085
  url,
@@ -6087,12 +6088,13 @@ async function getAllContent(options) {
6087
6088
  });
6088
6089
  return null;
6089
6090
  }
6090
- return processContentResult(options, content);
6091
+ return _processContentResult(options, content);
6091
6092
  } catch (error) {
6092
6093
  logger.error("Error fetching data. ", error);
6093
6094
  return null;
6094
6095
  }
6095
6096
  }
6097
+ const getAllContent = fetchEntries;
6096
6098
  function isPreviewing() {
6097
6099
  if (!isBrowser())
6098
6100
  return false;
@@ -6334,7 +6336,7 @@ const getInteractionPropertiesForEvent = (event) => {
6334
6336
  }
6335
6337
  };
6336
6338
  };
6337
- const SDK_VERSION = "UNKNOWN_VERSION";
6339
+ const SDK_VERSION = "0.5.7";
6338
6340
  const registry = {};
6339
6341
  function register(type, info) {
6340
6342
  let typeList = registry[type];
@@ -6650,7 +6652,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
6650
6652
  const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
6651
6653
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6652
6654
  if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
6653
- getContent({
6655
+ fetchOneEntry({
6654
6656
  model: props2.model,
6655
6657
  apiKey: props2.apiKey,
6656
6658
  apiVersion: props2.builderContextSignal.apiVersion
@@ -7322,10 +7324,10 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
7322
7324
  ]
7323
7325
  }, 1, "XM_5");
7324
7326
  }, "ContentVariants_component_4tFRiQMMEfM"));
7325
- const fetchContent = async ({ builderContextValue, symbol }) => {
7327
+ const fetchSymbolContent = async ({ builderContextValue, symbol }) => {
7326
7328
  if ((symbol == null ? void 0 : symbol.model) && // This is a hack, we should not need to check for this, but it is needed for Svelte.
7327
7329
  (builderContextValue == null ? void 0 : builderContextValue.apiKey))
7328
- return getContent({
7330
+ return fetchOneEntry({
7329
7331
  model: symbol.model,
7330
7332
  apiKey: builderContextValue.apiKey,
7331
7333
  apiVersion: builderContextValue.apiVersion,
@@ -7343,7 +7345,7 @@ const fetchContent = async ({ builderContextValue, symbol }) => {
7343
7345
  const setContent = function setContent2(props, state) {
7344
7346
  if (state.contentToUse)
7345
7347
  return;
7346
- fetchContent({
7348
+ fetchSymbolContent({
7347
7349
  symbol: props.symbol,
7348
7350
  builderContextValue: props.builderContext
7349
7351
  }).then((newContent) => {
@@ -7454,6 +7456,8 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
7454
7456
  ], "p0.value")
7455
7457
  }, 0, "Wt_1");
7456
7458
  }, "Symbol_component_WVvggdkUPdk"));
7459
+ const RenderBlocks = Blocks;
7460
+ const RenderContent = ContentVariants;
7457
7461
  const settings = {};
7458
7462
  function setEditorSettings(newSettings) {
7459
7463
  if (isBrowser()) {
@@ -7465,24 +7469,50 @@ function setEditorSettings(newSettings) {
7465
7469
  parent.postMessage(message, "*");
7466
7470
  }
7467
7471
  }
7472
+ const fetchBuilderProps = async (_args) => {
7473
+ var _a, _b, _c;
7474
+ const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
7475
+ const getContentArgs = {
7476
+ ..._args,
7477
+ apiKey: _args.apiKey,
7478
+ model: _args.model || "page",
7479
+ userAttributes: {
7480
+ ..._args.userAttributes,
7481
+ ...urlPath ? {
7482
+ urlPath
7483
+ } : {}
7484
+ },
7485
+ options: getBuilderSearchParams(_args.searchParams || ((_c = _args.url) == null ? void 0 : _c.searchParams) || _args.options)
7486
+ };
7487
+ return {
7488
+ apiKey: getContentArgs.apiKey,
7489
+ model: getContentArgs.model,
7490
+ content: await fetchOneEntry(getContentArgs)
7491
+ };
7492
+ };
7468
7493
  export {
7494
+ Blocks,
7469
7495
  Button,
7470
7496
  Columns,
7497
+ ContentVariants as Content,
7471
7498
  FragmentComponent as Fragment,
7472
7499
  Image,
7473
- Blocks as RenderBlocks,
7474
- ContentVariants as RenderContent,
7500
+ RenderBlocks,
7501
+ RenderContent,
7475
7502
  SectionComponent as Section,
7476
7503
  Symbol$1 as Symbol,
7477
7504
  Text,
7478
7505
  Video,
7506
+ _processContentResult,
7479
7507
  createRegisterComponentMessage,
7508
+ fetchBuilderProps,
7509
+ fetchEntries,
7510
+ fetchOneEntry,
7480
7511
  getAllContent,
7481
7512
  getBuilderSearchParams,
7482
7513
  getContent,
7483
7514
  isEditing,
7484
7515
  isPreviewing,
7485
- processContentResult,
7486
7516
  register,
7487
7517
  setEditorSettings,
7488
7518
  track
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -42,6 +42,10 @@
42
42
  ],
43
43
  "targets": {
44
44
  "build": {
45
+ "dependsOn": [
46
+ "^build:qwik",
47
+ "^build"
48
+ ],
45
49
  "outputs": [
46
50
  "{projectRoot}/lib",
47
51
  "{projectRoot}/types",
@@ -8,7 +8,7 @@ export interface SymbolInfo {
8
8
  inline?: boolean;
9
9
  dynamic?: boolean;
10
10
  }
11
- export declare const fetchContent: ({ builderContextValue, symbol }: {
11
+ export declare const fetchSymbolContent: ({ builderContextValue, symbol }: {
12
12
  symbol: SymbolInfo | undefined;
13
13
  builderContextValue: BuilderContextInterface;
14
14
  }) => Promise<BuilderContent | null | undefined>;
@@ -1,7 +1,7 @@
1
1
  import type { BuilderContextInterface, RegisteredComponents } from '../../../../context/types.js';
2
2
  import type { BuilderBlock } from '../../../../types/builder-block.js';
3
3
  import type { PropsWithBuilderData } from '../../../../types/builder-props.js';
4
- import type { InteractiveElementProps } from '../interactive-element';
4
+ import type { InteractiveElementProps } from '../interactive-element.jsx';
5
5
  type ComponentOptions = PropsWithBuilderData<{
6
6
  [index: string]: any;
7
7
  attributes?: {
@@ -1,5 +1,5 @@
1
1
  import { BuilderContextInterface, RegisteredComponents } from "../../context/types.js";
2
- import { BlocksWrapperProps } from "./blocks-wrapper";
2
+ import { BlocksWrapperProps } from "./blocks-wrapper.jsx";
3
3
  export type BlocksProps = Partial<BlocksWrapperProps> & {
4
4
  context?: BuilderContextInterface;
5
5
  registeredComponents?: RegisteredComponents;
@@ -1 +1 @@
1
- export { default } from './content';
1
+ export { default } from './content.jsx';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "UNKNOWN_VERSION";
1
+ export declare const SDK_VERSION = "0.5.7";
@@ -1,2 +1,2 @@
1
1
  /** This file should be overriden for each framework. Ideally this would be implemented in Mitosis. */
2
- export declare const TARGET: import("../types/targets").Target;
2
+ export declare const TARGET: import("../types/targets.js").Target;
@@ -0,0 +1,39 @@
1
+ import type { ContentVariantsProps } from '../components/content-variants/content-variants.types.js';
2
+ import type { Dictionary } from '../types/typescript.js';
3
+ import type { GetContentOptions } from './get-content/types.js';
4
+ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
5
+ model?: string;
6
+ }) & ({
7
+ /**
8
+ * The current URL path. Used to determine the `urlPath` for targeting content.
9
+ *
10
+ * Cannot be used with `url`.
11
+ */
12
+ path: string;
13
+ /**
14
+ * The current URL search params. Used to parse the `searchParams` for targeting content.
15
+ *
16
+ * Cannot be used with `url`.
17
+ */
18
+ searchParams?: URLSearchParams | Dictionary<string | string[]>;
19
+ url?: undefined;
20
+ } | {
21
+ /**
22
+ * The current URL. Used to determine the `urlPath` for targeting content and
23
+ * to parse the `searchParams` for targeting content.
24
+ *
25
+ * Cannot be used with `path` or `searchParams`.
26
+ */
27
+ url: URL;
28
+ path?: undefined;
29
+ searchParams?: undefined;
30
+ } | {
31
+ url?: undefined;
32
+ path?: undefined;
33
+ searchParams?: undefined;
34
+ });
35
+ /**
36
+ * Fetches builder content, and returns it along with sensible defaults for other props that `Content` needs to render.
37
+ */
38
+ export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<ContentVariantsProps>;
39
+ export {};
@@ -1,12 +1,29 @@
1
1
  import type { BuilderContent } from '../../types/builder-content.js';
2
2
  import type { GetContentOptions } from './types.js';
3
- export declare function getContent(options: GetContentOptions): Promise<BuilderContent | null>;
3
+ /**
4
+ * Returns a the first entry that matches the given options.
5
+ */
6
+ export declare function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null>;
7
+ /**
8
+ * @deprecated
9
+ * Consider using `fetchBuilderProps` instead for easier setup.
10
+ *
11
+ * NOTE: `getContent` was renamed to `fetchOneEntry` and will be removed in a future release.
12
+ */
13
+ export declare const getContent: typeof fetchOneEntry;
4
14
  type ContentResults = {
5
15
  results: BuilderContent[];
6
16
  };
7
17
  /**
8
18
  * Exported only for testing purposes. Should not be used directly.
9
19
  */
10
- export declare const processContentResult: (options: GetContentOptions, content: ContentResults, url?: URL) => Promise<ContentResults>;
11
- export declare function getAllContent(options: GetContentOptions): Promise<ContentResults | null>;
20
+ export declare const _processContentResult: (options: GetContentOptions, content: ContentResults, url?: URL) => Promise<ContentResults>;
21
+ /**
22
+ * Returns a paginated array of entries that match the given options.
23
+ */
24
+ export declare function fetchEntries(options: GetContentOptions): Promise<ContentResults | null>;
25
+ /**
26
+ * @deprecated Use `fetchEntries` instead.
27
+ */
28
+ export declare const getAllContent: typeof fetchEntries;
12
29
  export {};
@@ -1,2 +1,2 @@
1
- import type { BuilderContent } from '../../types/builder-content';
1
+ import type { BuilderContent } from '../../types/builder-content.js';
2
2
  export declare function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined;
@@ -1,4 +1,4 @@
1
- import type { BuilderContent } from '../../types/builder-content';
1
+ import type { BuilderContent } from '../../types/builder-content.js';
2
2
  export declare function postPreviewContent({ key, value }: {
3
3
  key: string;
4
4
  value: BuilderContent;
@@ -1,10 +1,21 @@
1
- export { default as Button } from '../blocks/button/button';
2
- export { default as Columns } from '../blocks/columns/columns';
3
- export { default as Fragment } from '../blocks/fragment/fragment';
4
- export { default as Image } from '../blocks/image/image';
5
- export { default as RenderBlocks } from '../components/blocks/blocks';
6
- export { default as Section } from '../blocks/section/section';
7
- export { default as Symbol } from '../blocks/symbol/symbol';
8
- export { default as Text } from '../blocks/text/text';
9
- export { default as Video } from '../blocks/video/video';
10
- export { default as RenderContent } from '../components/content-variants/content-variants';
1
+ export { default as Button } from '../blocks/button/button.jsx';
2
+ export { default as Columns } from '../blocks/columns/columns.jsx';
3
+ export { default as Fragment } from '../blocks/fragment/fragment.jsx';
4
+ export { default as Image } from '../blocks/image/image.jsx';
5
+ export { default as Section } from '../blocks/section/section.jsx';
6
+ export { default as Symbol } from '../blocks/symbol/symbol.jsx';
7
+ export { default as Text } from '../blocks/text/text.jsx';
8
+ export { default as Video } from '../blocks/video/video.jsx';
9
+ import { default as Blocks } from '../components/blocks/blocks.jsx';
10
+ import { default as Content } from '../components/content-variants/content-variants.jsx';
11
+ export { Blocks, Content };
12
+ /**
13
+ * @deprecated Use `Blocks` instead.
14
+ */
15
+ export declare const RenderBlocks: import("@builder.io/qwik").Component<import("../components/blocks/blocks.jsx").BlocksProps>;
16
+ /**
17
+ * @deprecated Use `Content` instead.
18
+ */
19
+ export declare const RenderContent: import("@builder.io/qwik").Component<import("../components/content-variants/content-variants.types.js").ContentVariantsProps & {
20
+ __isNestedRender?: boolean | undefined;
21
+ }>;
package/types/index.d.ts CHANGED
@@ -7,9 +7,10 @@ export { register } from './functions/register.js';
7
7
  export type { InsertMenuConfig, InsertMenuItem } from './functions/register.js';
8
8
  export { setEditorSettings } from './functions/set-editor-settings.js';
9
9
  export type { Settings } from './functions/set-editor-settings.js';
10
- export { getAllContent, getContent, processContentResult } from './functions/get-content/index.js';
10
+ export { fetchEntries, fetchOneEntry, getAllContent, getContent, _processContentResult } from './functions/get-content/index.js';
11
11
  export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
12
12
  export { track } from './functions/track/index.js';
13
- export type { RegisteredComponent } from './context/types';
14
- export type { ComponentInfo } from './types/components';
13
+ export type { RegisteredComponent } from './context/types.js';
14
+ export type { ComponentInfo } from './types/components.js';
15
15
  export type { ContentProps } from './components/content/content.types.js';
16
+ export { fetchBuilderProps } from './functions/fetch-builder-props.js';
@@ -0,0 +1,5 @@
1
+ export interface BaseTextProps {
2
+ text: string;
3
+ }
4
+ export declare const BaseText: import("@builder.io/qwik").Component<BaseTextProps>;
5
+ export default BaseText;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This import is used by the Svelte SDK. Do not remove.
3
+ */ export interface ButtonProps {
4
+ attributes?: any;
5
+ text?: string;
6
+ link?: string;
7
+ openLinkInNewTab?: boolean;
8
+ }
9
+ export declare const Button: import("@builder.io/qwik").Component<ButtonProps>;
10
+ export default Button;
11
+ export declare const STYLES = "\n.button-Button {\n all: unset;\n}\n";
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,32 @@
1
+ import { SizeName } from "../../constants/device-sizes.js";
2
+ import { BuilderBlock } from "../../types/builder-block.js";
3
+ import { BuilderComponentsProp, PropsWithBuilderData } from "../../types/builder-props.js";
4
+ import { Dictionary } from "../../types/typescript.js";
5
+ type Column = {
6
+ blocks: BuilderBlock[];
7
+ width?: number;
8
+ };
9
+ type CSSVal = string | number;
10
+ type StackColumnsAt = "tablet" | "mobile" | "never";
11
+ export interface ColumnProps extends BuilderComponentsProp {
12
+ columns?: Column[];
13
+ builderBlock: BuilderBlock;
14
+ space?: number;
15
+ stackColumnsAt?: StackColumnsAt;
16
+ reverseColumnsWhenStacked?: boolean;
17
+ }
18
+ export declare const getWidth: (props: any, state: any, index: number) => any;
19
+ export declare const getColumnCssWidth: (props: any, state: any, index: number) => string;
20
+ export declare const getTabletStyle: (props: any, state: any, { stackedStyle, desktopStyle, }: {
21
+ stackedStyle: CSSVal;
22
+ desktopStyle: CSSVal;
23
+ }) => CSSVal;
24
+ export declare const getMobileStyle: (props: any, state: any, { stackedStyle, desktopStyle, }: {
25
+ stackedStyle: CSSVal;
26
+ desktopStyle: CSSVal;
27
+ }) => CSSVal;
28
+ export declare const columnCssVars: (props: any, state: any, index: number) => Dictionary<string>;
29
+ export declare const getWidthForBreakpointSize: (props: any, state: any, size: SizeName) => number;
30
+ export declare const Columns: import("@builder.io/qwik").Component<PropsWithBuilderData<ColumnProps>>;
31
+ export default Columns;
32
+ export declare const STYLES = "\n.div-Columns {\n display: flex;\n line-height: normal;\n}\n.div-Columns-2 {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n";
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,7 @@
1
+ export interface CustomCodeProps {
2
+ code: string;
3
+ replaceNodes?: boolean;
4
+ }
5
+ export declare const findAndRunScripts: (props: any, state: any, elem: any) => void;
6
+ export declare const CustomCode: import("@builder.io/qwik").Component<CustomCodeProps>;
7
+ export default CustomCode;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,6 @@
1
+ export interface EmbedProps {
2
+ content: string;
3
+ }
4
+ export declare const findAndRunScripts: (props: any, state: any, elem: any) => void;
5
+ export declare const Embed: import("@builder.io/qwik").Component<EmbedProps>;
6
+ export default Embed;
@@ -0,0 +1 @@
1
+ export declare const isJsScript: (script: HTMLScriptElement) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;
@@ -0,0 +1,7 @@
1
+ export interface FragmentProps {
2
+ maxWidth?: number;
3
+ attributes?: any;
4
+ children?: any;
5
+ }
6
+ export declare const FragmentComponent: import("@builder.io/qwik").Component<FragmentProps>;
7
+ export default FragmentComponent;
@@ -0,0 +1,13 @@
1
+ export declare function filterAttrs(attrs: {
2
+ [index: string]: any;
3
+ } | undefined, prefix: string, isEvent: boolean): {
4
+ [index: string]: any;
5
+ };
6
+ /**
7
+ * Svelte SDK: workaround to dynamically provide event handlers to components/elements.
8
+ * https://svelte.dev/repl/1246699e266f41218a8eeb45b9b58b54?version=3.24.1
9
+ */
10
+ export declare function setAttrs(node: HTMLElement, attrs?: Record<string, (event: Event) => void>): {
11
+ update(attrs?: {}): void;
12
+ destroy(): void;
13
+ };
@@ -0,0 +1,2 @@
1
+ import type { ComponentInfo } from '../../types/components.js';
2
+ export declare const componentInfo: ComponentInfo;