@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
@@ -0,0 +1,4 @@
1
+ import type { BuilderRenderState } from '../../../context/types.js';
2
+ import type { ExecutorArgs } from '../helpers.js';
3
+ export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
4
+ export declare function flattenState(rootState: Record<string | symbol, any>, localState: Record<string | symbol, any> | undefined, rootSetState: ((rootState: BuilderRenderState) => void) | undefined): BuilderRenderState;
@@ -0,0 +1 @@
1
+ export { runInBrowser as evaluator } from './browser.js';
@@ -0,0 +1,10 @@
1
+ import type { BuilderContextInterface, BuilderRenderState } from '../../context/types.js';
2
+ import type { ExecutorArgs } from './types.js';
3
+ export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: {
4
+ code: string;
5
+ event?: Event;
6
+ isExpression?: boolean;
7
+ } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): any;
8
+ export declare const runInBrowser: ({ useCode, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
9
+ export declare const runInNode: (args: ExecutorArgs) => any;
10
+ export declare function flattenState(rootState: Record<string | symbol, any>, localState: Record<string | symbol, any> | undefined, rootSetState: ((rootState: BuilderRenderState) => void) | undefined): BuilderRenderState;
@@ -0,0 +1,18 @@
1
+ import type { BuilderContextInterface, BuilderRenderState } from '../../context/types.js';
2
+ import type { getUserAttributes } from '../track/helpers.js';
3
+ export type BuilderGlobals = {
4
+ isEditing: boolean | undefined;
5
+ isBrowser: boolean | undefined;
6
+ isServer: boolean | undefined;
7
+ getUserAttributes: typeof getUserAttributes;
8
+ };
9
+ export type ExecutorArgs = Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'> & {
10
+ code: string;
11
+ builder: BuilderGlobals;
12
+ event: Event | undefined;
13
+ };
14
+ export type Executor = (args: ExecutorArgs) => any;
15
+ export type FunctionArguments = ReturnType<typeof getFunctionArguments>;
16
+ export declare const getFunctionArguments: ({ builder, context, event, state }: Pick<ExecutorArgs, "context" | "builder" | "event"> & {
17
+ state: BuilderRenderState;
18
+ }) => [string, Event | BuilderRenderState | import("../../context/types.js").BuilderRenderContext | BuilderGlobals | undefined][];
@@ -0,0 +1 @@
1
+ export { evaluate } from './evaluate';
@@ -0,0 +1 @@
1
+ export { runInNode as evaluator } from './node-runtime.js';
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from '../helpers.js';
2
+ export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
@@ -0,0 +1,2 @@
1
+ declare const _default: Class;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export { runInNonNode } from './non-node-runtime.js';
@@ -1,2 +1,2 @@
1
- import type { ExecutorArgs } from './types';
1
+ import type { ExecutorArgs } from '../types';
2
2
  export declare const runInNonNode: ({ builder, context, event, rootState, localState, rootSetState, useCode }: ExecutorArgs) => any;
@@ -0,0 +1,2 @@
1
+ import type { ExecutorArgs } from './helpers';
2
+ export declare const evaluator: (_args: ExecutorArgs) => never;
@@ -0,0 +1,11 @@
1
+ import type { BuilderContextInterface } from '../../context/types';
2
+ export type ExecutorArgs = Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'> & {
3
+ useCode: string;
4
+ builder: {
5
+ isEditing: boolean | undefined;
6
+ isBrowser: boolean | undefined;
7
+ isServer: boolean | undefined;
8
+ };
9
+ event: Event | undefined;
10
+ };
11
+ export type Executor = (args: ExecutorArgs) => any;
@@ -0,0 +1 @@
1
+ export declare const getEventHandlerName: (key: string) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Extract styles that apply to text from a style object.
3
+ */
4
+ export declare const extractTextStyles: (styles: Partial<CSSStyleDeclaration>) => Partial<CSSStyleDeclaration>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * We need to serialize values to a string in case there are Proxy values, as is the case with SolidJS etc.
3
+ */
4
+ export declare const fastClone: <T extends object>(obj: T) => T;
@@ -0,0 +1,39 @@
1
+ import type { ContentVariantsProps } from '../components/content-variants/content-variants.types';
2
+ import type { Dictionary } from '../types/typescript';
3
+ import type { GetContentOptions } from './get-content/types';
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 {};
@@ -0,0 +1,5 @@
1
+ import type { BuilderContextInterface } from '../context/types.js';
2
+ import type { BuilderBlock } from '../types/builder-block.js';
3
+ export declare function createEventHandler(value: string, options: {
4
+ block: BuilderBlock;
5
+ } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): (event: Event) => any;
@@ -0,0 +1,10 @@
1
+ import type { BuilderContextInterface } from '../context/types.js';
2
+ import type { BuilderBlock } from '../types/builder-block.js';
3
+ type Actions = {
4
+ [index: string]: (event: Event) => any;
5
+ };
6
+ export declare function getBlockActions(options: {
7
+ block: BuilderBlock;
8
+ stripPrefix?: boolean;
9
+ } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): Actions;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { BuilderBlock } from '../types/builder-block.js';
2
+ export declare function getBlockComponentOptions(block: BuilderBlock): any;
@@ -0,0 +1,11 @@
1
+ import type { BuilderContextInterface } from '../context/types.js';
2
+ import type { BuilderBlock } from '../types/builder-block.js';
3
+ export declare function getBlockProperties({ block, context }: {
4
+ block: BuilderBlock;
5
+ context: BuilderContextInterface;
6
+ }): {
7
+ 'builder-id': string | undefined;
8
+ style: string | Partial<CSSStyleDeclaration> | undefined;
9
+ class: string;
10
+ href: any;
11
+ };
@@ -0,0 +1,12 @@
1
+ type QueryObject = Record<string, string | string[]>;
2
+ export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
3
+ /**
4
+ * Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
5
+ * relevant to the Builder SDK.
6
+ *
7
+ * @returns
8
+ */
9
+ export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
10
+ export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
11
+ export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { GetContentOptions } from './types.js';
2
+ export declare const generateContentUrl: (options: GetContentOptions) => URL;
@@ -0,0 +1,29 @@
1
+ import type { BuilderContent } from '../../types/builder-content.js';
2
+ import type { GetContentOptions } from './types.js';
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;
14
+ type ContentResults = {
15
+ results: BuilderContent[];
16
+ };
17
+ /**
18
+ * Exported only for testing purposes. Should not be used directly.
19
+ */
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;
29
+ export {};
@@ -0,0 +1,51 @@
1
+ export interface GetContentOptions {
2
+ /** The model to get content for */
3
+ model: string;
4
+ /** Your public API key */
5
+ apiKey: string;
6
+ /** Number of items to fetch. Default is 1 */
7
+ limit?: number;
8
+ /** User attributes to target on, such as { urlPath: '/foo', device: 'mobile', ...etc } */
9
+ userAttributes?: (Record<string, string> & {
10
+ urlPath?: string;
11
+ }) | null;
12
+ /** Custom query */
13
+ query?: Record<string, any>;
14
+ /**
15
+ * Any other API options.
16
+ * Accepts both a key/value object or a `URLSearchParams` instance
17
+ * */
18
+ options?: Record<string, any> | URLSearchParams;
19
+ /**
20
+ * If set to `true`, it will lazy load symbols/references.
21
+ * If set to `false`, it will render the entire content tree eagerly.
22
+ * @deprecated use `enrich` instead
23
+ */
24
+ noTraverse?: boolean;
25
+ /**
26
+ * If set to `false`, it will not use cookies to target content. Therefore, A/B Testing will be disabled and
27
+ * only the default variation will be returned to every user.
28
+ *
29
+ * Defaults to `true`.
30
+ */
31
+ canTrack?: boolean;
32
+ /**
33
+ * Include references in the response. Defaults to `true`.
34
+ * @deprecated use `enrich` instead
35
+ */
36
+ includeRefs?: boolean;
37
+ /**
38
+ * Include multilevel references in the response.
39
+ */
40
+ enrich?: boolean;
41
+ /**
42
+ * If provided, the API will auto-resolve localized objects to the value of this `locale` key.
43
+ */
44
+ locale?: string;
45
+ /**
46
+ * If provided, sets the Builder API version used to fetch content.
47
+ *
48
+ * Defaults to `v3`.
49
+ */
50
+ apiVersion?: 'v2' | 'v3';
51
+ }
@@ -0,0 +1 @@
1
+ export declare const fetch: typeof globalThis.fetch;
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ type Global = typeof global | typeof window | typeof self | typeof globalThis;
3
+ export declare function getGlobalThis(): Global;
4
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { BuilderContextInterface } from '../context/types.js';
2
+ import type { BuilderBlock } from '../types/builder-block.js';
3
+ export declare function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }: {
4
+ block: BuilderBlock;
5
+ /**
6
+ * In some cases, we want to avoid evaluating bindings and only want framework-specific block transformation. It is
7
+ * also sometimes too early to consider bindings, e.g. when we might be looking at a repeated block.
8
+ */
9
+ shouldEvaluateBindings: boolean;
10
+ } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock;
@@ -1,6 +1,7 @@
1
1
  import type { BuilderContextInterface } from '../context/types.js';
2
2
  import type { BuilderBlock } from '../types/builder-block.js';
3
- export declare function getBlockStyles({ block, context, }: {
3
+ export declare function getReactNativeBlockStyles({ block, context, blockStyles }: {
4
4
  block: BuilderBlock;
5
5
  context: BuilderContextInterface;
6
- }): Partial<CSSStyleDeclaration>;
6
+ blockStyles: any;
7
+ }): CSSStyleDeclaration | Record<string, string | undefined>;
@@ -0,0 +1,7 @@
1
+ type Target = import('../types/targets').Target;
2
+ export declare function ifTarget<A, B>({ targets, doThing, elseThing }: {
3
+ targets: Target[];
4
+ doThing: () => A;
5
+ elseThing?: () => B;
6
+ }): A | B | undefined;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isBrowser(): boolean;
@@ -0,0 +1 @@
1
+ export declare function isEditing(): boolean;
@@ -0,0 +1 @@
1
+ export declare function isIframe(): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Identifies non-node server runtimes (edge, workers, serverless, etc.)
3
+ */
4
+ export declare function isNonNodeServer(): boolean;
@@ -0,0 +1 @@
1
+ export declare function isPreviewing(): boolean;
@@ -0,0 +1,7 @@
1
+ export declare const onChangeProxySymbol: unique symbol;
2
+ /**
3
+ * Deeply observe an object and run a callback when it changes
4
+ *
5
+ * See ./on-change.test.ts for more info
6
+ */
7
+ export declare function onChange<T extends object = any>(obj: T, cb: () => void): T;
@@ -0,0 +1,15 @@
1
+ import type { RegisteredComponent } from '../context/types.js';
2
+ import type { ComponentInfo } from '../types/components.js';
3
+ /**
4
+ * @deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.
5
+ */
6
+ export declare const components: RegisteredComponent[];
7
+ /**
8
+ * @deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.
9
+ */
10
+ export declare function registerComponent(component: any, info: ComponentInfo): void;
11
+ export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
12
+ type: string;
13
+ data: ComponentInfo;
14
+ };
15
+ export declare const serializeComponentInfo: ({ inputs, ...info }: ComponentInfo) => ComponentInfo;
@@ -0,0 +1,16 @@
1
+ import type { BuilderBlock } from '../types/builder-block.js';
2
+ import type { DeepPartial } from '../types/deep-partial.js';
3
+ export interface InsertMenuItem {
4
+ name: string;
5
+ icon?: string;
6
+ item: DeepPartial<BuilderBlock>;
7
+ }
8
+ export interface InsertMenuConfig {
9
+ name: string;
10
+ priority?: number;
11
+ persist?: boolean;
12
+ advanced?: boolean;
13
+ items: InsertMenuItem[];
14
+ }
15
+ export declare function register(type: 'insertMenu', info: InsertMenuConfig): void;
16
+ export declare function register(type: string, info: any): void;
@@ -0,0 +1,3 @@
1
+ type Styles = Record<string, string | number>;
2
+ export declare const sanitizeReactNativeBlockStyles: (styles: Styles) => Styles;
3
+ export {};
@@ -0,0 +1,4 @@
1
+ export type Settings = {
2
+ customInsertMenu?: boolean;
3
+ };
4
+ export declare function setEditorSettings(newSettings: Settings): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Minimal implementation of lodash's _.set
3
+ * https://lodash.com/docs/4.17.15#set
4
+ *
5
+ * See ./set.test.ts for usage examples
6
+ */
7
+ export declare const set: (obj: any, _path: string | string[], value: any) => any;
@@ -0,0 +1,5 @@
1
+ export declare const getUserAttributes: () => {
2
+ urlPath: string | undefined;
3
+ host: string | undefined;
4
+ device: string;
5
+ };
@@ -1,4 +1,5 @@
1
- import type { CanTrack } from '../types/can-track.js';
1
+ import type { CanTrack } from '../../types/can-track.js';
2
+ import type { Dictionary } from '../../types/typescript.js';
2
3
  interface Event {
3
4
  /**
4
5
  * The type of your event.
@@ -16,9 +17,9 @@ interface Event {
16
17
  */
17
18
  ownerId: string;
18
19
  /**
19
- * Stringified JSON object containing any additional metadata you want to track.
20
+ * (Optional) metadata that you want to provide with your event.
20
21
  */
21
- metadata?: string;
22
+ metadata?: Dictionary<any>;
22
23
  /**
23
24
  * Session ID of the user. This is provided by the SDK by checking session storage.
24
25
  */
@@ -34,23 +35,17 @@ interface Event {
34
35
  [index: string]: any;
35
36
  };
36
37
  }
37
- declare type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | 'variationId'> & {
38
+ type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | 'variationId' | 'metadata'> & {
38
39
  /**
39
40
  * Your organization's API key.
40
41
  */
41
42
  apiKey: Event['data']['ownerId'];
42
- /**
43
- * (Optional) metadata that you want to provide with your event.
44
- */
45
- metadata?: {
46
- [index: string]: any;
47
- };
48
43
  /**
49
44
  * (Optional) Any additional (non-metadata) properties to add to the event.
50
45
  */
51
46
  [index: string]: any;
52
47
  };
53
- export declare type EventProps = EventProperties & CanTrack;
48
+ export type EventProps = EventProperties & CanTrack;
54
49
  export declare function _track(eventProps: EventProps): Promise<void | Response>;
55
50
  export declare const track: (args: EventProperties) => Promise<void | Response>;
56
51
  export {};
@@ -0,0 +1,13 @@
1
+ type Offset = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ export declare const getInteractionPropertiesForEvent: (event: MouseEvent) => {
6
+ targetBuilderElement: string | undefined;
7
+ metadata: {
8
+ targetOffset: Offset | undefined;
9
+ builderTargetOffset: Offset | undefined;
10
+ builderElementIndex: number | undefined;
11
+ };
12
+ };
13
+ export {};
@@ -0,0 +1 @@
1
+ export declare function transformBlockProperties<T>(properties: T): T;
@@ -0,0 +1,2 @@
1
+ import type { BuilderBlock } from '../types/builder-block.js';
2
+ export declare function transformBlock(block: BuilderBlock): BuilderBlock;
@@ -0,0 +1,9 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ import type { BuilderContent } from '../types/builder-content.js';
3
+ import type { Nullable } from '../types/typescript.js';
4
+ export declare const handleABTestingSync: ({ item, canTrack }: {
5
+ item: Nullable<BuilderContent>;
6
+ } & CanTrack) => Nullable<BuilderContent>;
7
+ export declare const handleABTesting: ({ item, canTrack }: {
8
+ item: BuilderContent;
9
+ } & CanTrack) => Promise<BuilderContent>;
@@ -0,0 +1 @@
1
+ export declare const getDefaultCanTrack: (canTrack?: boolean) => boolean;
@@ -0,0 +1,19 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ type GetCookieArgs = {
3
+ name: string;
4
+ } & CanTrack;
5
+ export declare const getCookieSync: ({ name, canTrack }: GetCookieArgs) => string | undefined;
6
+ /**
7
+ * NOTE: This function is `async` because its react-native override is async. Do not remove the `async` keyword!
8
+ * The sync version is only safe to use in code blocks that `react-native` is guaranteed not to not run.
9
+ */
10
+ export declare const getCookie: (args: GetCookieArgs) => Promise<string | undefined>;
11
+ /**
12
+ * NOTE: This function is `async` because its react-native override is async. Do not remove the `async` keyword!
13
+ */
14
+ export declare const setCookie: ({ name, value, expires, canTrack }: {
15
+ name: string;
16
+ value: string;
17
+ expires?: Date | undefined;
18
+ } & CanTrack) => Promise<void>;
19
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const convertStyleMapToCSSArray: (style: Partial<CSSStyleDeclaration>) => string[];
2
+ export declare const convertStyleMapToCSS: (style: Partial<CSSStyleDeclaration>) => string;
3
+ export declare const createCssClass: ({ mediaQuery, className, styles }: {
4
+ mediaQuery?: string | undefined;
5
+ className: string;
6
+ styles: Partial<CSSStyleDeclaration>;
7
+ }) => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Convert deep object to a flat object with dots
3
+ *
4
+ * { foo: { bar: 'baz' }} -> { 'foo.bar': 'baz' }
5
+ */
6
+ export declare function flatten<T extends Record<string, any>>(object: T, path?: string | null, separator?: string): T;
@@ -0,0 +1,9 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ import type { Nullable } from './nullable.js';
3
+ export declare const getLocalStorageItem: ({ key, canTrack }: {
4
+ key: string;
5
+ } & CanTrack) => Nullable<string>;
6
+ export declare const setLocalStorageItem: ({ key, canTrack, value }: {
7
+ key: string;
8
+ value: string;
9
+ } & CanTrack) => void;
@@ -0,0 +1,6 @@
1
+ export declare const logger: {
2
+ log: (...message: any[]) => void;
3
+ error: (...message: any[]) => void;
4
+ warn: (...message: any[]) => void;
5
+ debug: (...message: any[]) => void;
6
+ };
@@ -0,0 +1,2 @@
1
+ export type Nullable<T> = T | null | undefined;
2
+ export declare const checkIsDefined: <T>(maybeT: Nullable<T>) => maybeT is T;
@@ -0,0 +1,2 @@
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ export declare function getPreviewContent(_searchParams: URLSearchParams): BuilderContent | undefined;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This is an LRU cache to hold preview content on the server-side.
3
+ *
4
+ * Note: This logic is only used by the NextJS SDK.
5
+ */
6
+ export declare function init(): void;
@@ -0,0 +1,7 @@
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ export declare function postPreviewContent({ key, value }: {
3
+ key: string;
4
+ value: BuilderContent;
5
+ }): Promise<{
6
+ [x: string]: BuilderContent;
7
+ }>;
File without changes
@@ -0,0 +1,6 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ export declare const getSessionId: ({ canTrack }: CanTrack) => Promise<string | undefined>;
3
+ export declare const createSessionId: () => string;
4
+ export declare const setSessionId: ({ id, canTrack }: {
5
+ id: string;
6
+ } & CanTrack) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const getCurrentDatePlusMinutes: (minutes?: number) => Date;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Only gets one level up from hostname
3
+ * wwww.example.com -> example.com
4
+ * www.example.co.uk -> example.co.uk
5
+ */
6
+ export declare const getTopLevelDomain: (host: string) => string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @credit https://stackoverflow.com/a/2117523
3
+ */
4
+ export declare function uuidv4(): string;
5
+ /**
6
+ * Slightly cleaner and smaller UUIDs
7
+ */
8
+ export declare function uuid(): string;
@@ -0,0 +1,6 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ export declare const getVisitorId: ({ canTrack }: CanTrack) => string | undefined;
3
+ export declare const createVisitorId: () => string;
4
+ export declare const setVisitorId: ({ id, canTrack }: {
5
+ id: string;
6
+ } & CanTrack) => void;