@builder.io/sdk-react-native 0.4.3 → 0.4.5

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 (176) hide show
  1. package/dist/blocks/columns/columns.js +2 -2
  2. package/dist/blocks/symbol/symbol.js +8 -6
  3. package/dist/components/block/block.helpers.js +113 -0
  4. package/dist/components/block/block.js +171 -0
  5. package/dist/components/block/components/block-styles.js +95 -0
  6. package/dist/components/block/components/component.js +41 -0
  7. package/dist/components/block/components/repeated-block.js +40 -0
  8. package/dist/components/block/types.js +1 -0
  9. package/dist/components/blocks/blocks-wrapper.js +66 -0
  10. package/dist/components/blocks/blocks.js +41 -0
  11. package/dist/components/content/components/content-styles.helpers.js +55 -0
  12. package/dist/components/content/components/content-styles.js +61 -0
  13. package/dist/components/content/components/enable-editor.js +313 -0
  14. package/dist/components/content/content.helpers.js +42 -0
  15. package/dist/components/content/content.js +127 -0
  16. package/dist/components/content/content.types.js +1 -0
  17. package/dist/components/content/index.js +8 -0
  18. package/dist/components/content/wrap-component-ref.js +5 -0
  19. package/dist/components/content-variants/content-variants.js +73 -0
  20. package/dist/components/content-variants/helpers.js +139 -0
  21. package/dist/components/inlined-script.js +32 -0
  22. package/dist/components/{render-inlined-styles.js → inlined-styles.js} +2 -2
  23. package/dist/components/render-block/block-styles.js +2 -2
  24. package/dist/components/render-content/components/render-styles.js +2 -2
  25. package/dist/components/render-content/render-content.js +10 -8
  26. package/dist/components/render-content-variants/helpers.js +49 -20
  27. package/dist/components/render-content-variants/render-content-variants.js +29 -24
  28. package/dist/components/render-content-variants/render-content-variants.types.js +1 -0
  29. package/dist/constants/sdk-version.js +1 -1
  30. package/dist/functions/track/index.js +1 -1
  31. package/dist/helpers/ab-tests.js +3 -0
  32. package/dist/types/builder-props.js +1 -0
  33. package/dist/types/enforced-partials.js +1 -0
  34. package/package.json +1 -1
  35. package/src/blocks/columns/columns.jsx +2 -2
  36. package/src/blocks/symbol/symbol.jsx +8 -5
  37. package/src/components/inlined-script.jsx +18 -0
  38. package/src/components/{render-inlined-styles.jsx → inlined-styles.jsx} +2 -2
  39. package/src/components/render-block/block-styles.jsx +2 -2
  40. package/src/components/render-content/components/render-styles.jsx +2 -2
  41. package/src/components/render-content/render-content.jsx +8 -6
  42. package/src/components/render-content-variants/helpers.js +49 -20
  43. package/src/components/render-content-variants/render-content-variants.jsx +57 -35
  44. package/src/components/render-content-variants/render-content-variants.types.js +0 -0
  45. package/src/constants/sdk-version.js +1 -1
  46. package/src/functions/track/index.js +1 -1
  47. package/src/helpers/ab-tests.js +3 -0
  48. package/src/types/enforced-partials.js +0 -0
  49. package/dist/blocks/BaseText.d.ts +0 -6
  50. package/dist/blocks/button/button.d.ts +0 -9
  51. package/dist/blocks/button/component-info.d.ts +0 -2
  52. package/dist/blocks/columns/columns.d.ts +0 -16
  53. package/dist/blocks/columns/component-info.d.ts +0 -2
  54. package/dist/blocks/custom-code/component-info.d.ts +0 -2
  55. package/dist/blocks/custom-code/custom-code.d.ts +0 -5
  56. package/dist/blocks/embed/component-info.d.ts +0 -2
  57. package/dist/blocks/embed/embed.d.ts +0 -5
  58. package/dist/blocks/embed/helpers.d.ts +0 -1
  59. package/dist/blocks/form/component-info.d.ts +0 -2
  60. package/dist/blocks/form/form.d.ts +0 -28
  61. package/dist/blocks/fragment/component-info.d.ts +0 -2
  62. package/dist/blocks/fragment/fragment.d.ts +0 -8
  63. package/dist/blocks/image/component-info.d.ts +0 -2
  64. package/dist/blocks/image/image.d.ts +0 -17
  65. package/dist/blocks/image/image.helpers.d.ts +0 -1
  66. package/dist/blocks/img/component-info.d.ts +0 -2
  67. package/dist/blocks/img/img.d.ts +0 -11
  68. package/dist/blocks/input/component-info.d.ts +0 -2
  69. package/dist/blocks/input/input.d.ts +0 -12
  70. package/dist/blocks/raw-text/component-info.d.ts +0 -2
  71. package/dist/blocks/raw-text/raw-text.d.ts +0 -5
  72. package/dist/blocks/section/component-info.d.ts +0 -2
  73. package/dist/blocks/section/section.d.ts +0 -9
  74. package/dist/blocks/select/component-info.d.ts +0 -2
  75. package/dist/blocks/select/select.d.ts +0 -13
  76. package/dist/blocks/submit-button/component-info.d.ts +0 -2
  77. package/dist/blocks/submit-button/submit-button.d.ts +0 -7
  78. package/dist/blocks/symbol/component-info.d.ts +0 -2
  79. package/dist/blocks/symbol/symbol.d.ts +0 -21
  80. package/dist/blocks/text/component-info.d.ts +0 -2
  81. package/dist/blocks/text/text.d.ts +0 -7
  82. package/dist/blocks/textarea/component-info.d.ts +0 -2
  83. package/dist/blocks/textarea/textarea.d.ts +0 -10
  84. package/dist/blocks/util.d.ts +0 -4
  85. package/dist/blocks/video/component-info.d.ts +0 -2
  86. package/dist/blocks/video/video.d.ts +0 -31
  87. package/dist/components/render-block/block-styles.d.ts +0 -9
  88. package/dist/components/render-block/render-block.d.ts +0 -9
  89. package/dist/components/render-block/render-block.helpers.d.ts +0 -12
  90. package/dist/components/render-block/render-component.d.ts +0 -17
  91. package/dist/components/render-block/render-repeated-block.d.ts +0 -9
  92. package/dist/components/render-block/types.d.ts +0 -6
  93. package/dist/components/render-blocks.d.ts +0 -10
  94. package/dist/components/render-content/builder-editing.d.ts +0 -3
  95. package/dist/components/render-content/components/render-styles.d.ts +0 -9
  96. package/dist/components/render-content/components/render-styles.helpers.d.ts +0 -15
  97. package/dist/components/render-content/index.d.ts +0 -1
  98. package/dist/components/render-content/render-content.d.ts +0 -4
  99. package/dist/components/render-content/render-content.helpers.d.ts +0 -7
  100. package/dist/components/render-content/render-content.types.d.ts +0 -38
  101. package/dist/components/render-content/wrap-component-ref.d.ts +0 -6
  102. package/dist/components/render-content-variants/helpers.d.ts +0 -17
  103. package/dist/components/render-content-variants/render-content-variants.d.ts +0 -5
  104. package/dist/components/render-inlined-styles.d.ts +0 -7
  105. package/dist/constants/builder-registered-components.d.ts +0 -6
  106. package/dist/constants/device-sizes.d.ts +0 -13
  107. package/dist/constants/sdk-version.d.ts +0 -1
  108. package/dist/constants/target.d.ts +0 -3
  109. package/dist/context/builder.context.d.ts +0 -3
  110. package/dist/context/types.d.ts +0 -35
  111. package/dist/functions/camel-to-kebab-case.d.ts +0 -1
  112. package/dist/functions/evaluate.d.ts +0 -7
  113. package/dist/functions/evaluate.test.d.ts +0 -1
  114. package/dist/functions/event-handler-name.d.ts +0 -1
  115. package/dist/functions/extract-text-styles.d.ts +0 -4
  116. package/dist/functions/fast-clone.d.ts +0 -4
  117. package/dist/functions/get-block-actions-handler.d.ts +0 -8
  118. package/dist/functions/get-block-actions.d.ts +0 -9
  119. package/dist/functions/get-block-component-options.d.ts +0 -2
  120. package/dist/functions/get-block-properties.d.ts +0 -2
  121. package/dist/functions/get-builder-search-params/fn.test.d.ts +0 -1
  122. package/dist/functions/get-builder-search-params/index.d.ts +0 -12
  123. package/dist/functions/get-content/generate-content-url.d.ts +0 -2
  124. package/dist/functions/get-content/generate-content-url.test.d.ts +0 -1
  125. package/dist/functions/get-content/index.d.ts +0 -16
  126. package/dist/functions/get-content/types.d.ts +0 -51
  127. package/dist/functions/get-fetch.d.ts +0 -1
  128. package/dist/functions/get-processed-block.d.ts +0 -10
  129. package/dist/functions/get-processed-block.test.d.ts +0 -1
  130. package/dist/functions/get-react-native-block-styles.d.ts +0 -7
  131. package/dist/functions/if-target.d.ts +0 -7
  132. package/dist/functions/is-browser.d.ts +0 -1
  133. package/dist/functions/is-editing.d.ts +0 -1
  134. package/dist/functions/is-iframe.d.ts +0 -1
  135. package/dist/functions/is-previewing.d.ts +0 -1
  136. package/dist/functions/on-change.d.ts +0 -7
  137. package/dist/functions/on-change.test.d.ts +0 -1
  138. package/dist/functions/register-component.d.ts +0 -14
  139. package/dist/functions/register.d.ts +0 -16
  140. package/dist/functions/sanitize-react-native-block-styles.d.ts +0 -3
  141. package/dist/functions/set-editor-settings.d.ts +0 -4
  142. package/dist/functions/set.d.ts +0 -7
  143. package/dist/functions/set.test.d.ts +0 -1
  144. package/dist/functions/track/helpers.d.ts +0 -5
  145. package/dist/functions/track/index.d.ts +0 -51
  146. package/dist/functions/track/interaction.d.ts +0 -13
  147. package/dist/functions/transform-block-properties.d.ts +0 -3
  148. package/dist/functions/transform-block.d.ts +0 -2
  149. package/dist/helpers/ab-tests.d.ts +0 -9
  150. package/dist/helpers/canTrack.d.ts +0 -1
  151. package/dist/helpers/cookie.d.ts +0 -9
  152. package/dist/helpers/css.d.ts +0 -7
  153. package/dist/helpers/flatten.d.ts +0 -6
  154. package/dist/helpers/localStorage.d.ts +0 -9
  155. package/dist/helpers/logger.d.ts +0 -6
  156. package/dist/helpers/nullable.d.ts +0 -2
  157. package/dist/helpers/sessionId.d.ts +0 -6
  158. package/dist/helpers/time.d.ts +0 -1
  159. package/dist/helpers/url.d.ts +0 -6
  160. package/dist/helpers/url.test.d.ts +0 -1
  161. package/dist/helpers/uuid.d.ts +0 -8
  162. package/dist/helpers/visitorId.d.ts +0 -6
  163. package/dist/index-helpers/blocks-exports.d.ts +0 -8
  164. package/dist/index-helpers/top-of-file.d.ts +0 -1
  165. package/dist/index.d.ts +0 -15
  166. package/dist/scripts/init-editing.d.ts +0 -6
  167. package/dist/types/api-version.d.ts +0 -2
  168. package/dist/types/builder-block.d.ts +0 -66
  169. package/dist/types/builder-content.d.ts +0 -44
  170. package/dist/types/can-track.d.ts +0 -3
  171. package/dist/types/components.d.ts +0 -105
  172. package/dist/types/deep-partial.d.ts +0 -3
  173. package/dist/types/element.d.ts +0 -59
  174. package/dist/types/input.d.ts +0 -121
  175. package/dist/types/targets.d.ts +0 -3
  176. package/dist/types/typescript.d.ts +0 -5
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export interface ButtonProps {
3
- attributes?: any;
4
- text?: string;
5
- }
6
- declare function SubmitButton(props: ButtonProps): JSX.Element;
7
- export default SubmitButton;
@@ -1,2 +0,0 @@
1
- import type { ComponentInfo } from '../../types/components';
2
- export declare const componentInfo: ComponentInfo;
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- export interface SymbolInfo {
3
- model?: string;
4
- entry?: string;
5
- data?: any;
6
- content?: BuilderContent;
7
- inline?: boolean;
8
- dynamic?: boolean;
9
- }
10
- export interface SymbolProps {
11
- symbol?: SymbolInfo;
12
- dataOnly?: boolean;
13
- dynamic?: boolean;
14
- builderBlock?: BuilderBlock;
15
- attributes?: any;
16
- inheritState?: boolean;
17
- }
18
- import type { BuilderContent } from "../../types/builder-content.js";
19
- import type { BuilderBlock } from "../../types/builder-block.js";
20
- declare function Symbol(props: SymbolProps): JSX.Element;
21
- export default Symbol;
@@ -1,2 +0,0 @@
1
- import type { ComponentInfo } from '../../types/components';
2
- export declare const componentInfo: ComponentInfo;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- *
4
- * @param {{ text: string; builderBlock: BuilderBlock}} props
5
- * @returns
6
- */
7
- export default function Text(props: any): JSX.Element;
@@ -1,2 +0,0 @@
1
- import type { ComponentInfo } from '../../types/components';
2
- export declare const componentInfo: ComponentInfo;
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- export interface TextareaProps {
3
- attributes?: any;
4
- name?: string;
5
- value?: string;
6
- defaultValue?: string;
7
- placeholder?: string;
8
- }
9
- declare function Textarea(props: TextareaProps): JSX.Element;
10
- export default Textarea;
@@ -1,4 +0,0 @@
1
- /**
2
- * Input attributes that are functions must be converted to strings before being serialized to JSON.
3
- */
4
- export declare const serializeFn: (fnValue: Function) => string;
@@ -1,2 +0,0 @@
1
- import type { ComponentInfo } from '../../types/components';
2
- export declare const componentInfo: ComponentInfo;
@@ -1,31 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- *
4
- * @typedef {{
5
- * attributes?: any;
6
- * video?: string;
7
- * autoPlay?: boolean;
8
- * controls?: boolean;
9
- * muted?: boolean;
10
- * loop?: boolean;
11
- * playsInline?: boolean;
12
- * aspectRatio?: number;
13
- * fit?: 'contain' | 'cover' | 'stretch';
14
- * position?:
15
- * | 'center'
16
- * | 'top'
17
- * | 'left'
18
- * | 'right'
19
- * | 'bottom'
20
- * | 'top left'
21
- * | 'top right'
22
- * | 'bottom left'
23
- * | 'bottom right';
24
- * posterImage?: string;
25
- * children?: any;
26
- * }} VideoProps
27
- */
28
- /**
29
- * @param {VideoProps} props
30
- */
31
- export default function Video(props: any): JSX.Element;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- export type BlockStylesProps = {
3
- block: BuilderBlock;
4
- context: BuilderContextInterface;
5
- };
6
- import type { BuilderContextInterface } from "../../context/types.js";
7
- import type { BuilderBlock } from "../../types/builder-block.js";
8
- declare function BlockStyles(props: BlockStylesProps): JSX.Element;
9
- export default BlockStyles;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- export type RenderBlockProps = {
3
- block: BuilderBlock;
4
- context: BuilderContextInterface;
5
- };
6
- import type { BuilderContextInterface } from "../../context/types.js";
7
- import type { BuilderBlock } from "../../types/builder-block.js";
8
- declare function RenderBlock(props: RenderBlockProps): JSX.Element;
9
- export default RenderBlock;
@@ -1,12 +0,0 @@
1
- import type { BuilderContextInterface } from '../../context/types';
2
- import type { BuilderBlock } from '../../types/builder-block';
3
- import type { RepeatData } from './types';
4
- export declare const isEmptyHtmlElement: (tagName: unknown) => boolean;
5
- export declare const getComponent: ({ block, context, }: {
6
- block: BuilderBlock;
7
- context: BuilderContextInterface;
8
- }) => import("../../context/types").RegisteredComponent | null | undefined;
9
- export declare const getRepeatItemData: ({ block, context, }: {
10
- block: BuilderBlock;
11
- context: BuilderContextInterface;
12
- }) => RepeatData[] | undefined;
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- type ComponentOptions = {
3
- [index: string]: any;
4
- attributes?: {
5
- [index: string]: any;
6
- };
7
- };
8
- export interface RenderComponentProps {
9
- componentRef: any;
10
- componentOptions: ComponentOptions;
11
- blockChildren: BuilderBlock[];
12
- context: BuilderContextInterface;
13
- }
14
- import type { BuilderBlock } from "../../types/builder-block.js";
15
- import type { BuilderContextInterface } from "../../context/types.js";
16
- declare function RenderComponent(props: RenderComponentProps): JSX.Element;
17
- export default RenderComponent;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- block: BuilderBlock;
4
- repeatContext: BuilderContextInterface;
5
- };
6
- import type { BuilderContextInterface } from "../../context/types.js";
7
- import type { BuilderBlock } from "../../types/builder-block";
8
- declare function RenderRepeatedBlock(props: Props): JSX.Element;
9
- export default RenderRepeatedBlock;
@@ -1,6 +0,0 @@
1
- import type { BuilderContextInterface } from '../../context/types.js';
2
- import type { BuilderBlock } from '../../types/builder-block.js';
3
- export interface RepeatData {
4
- block: BuilderBlock;
5
- context: BuilderContextInterface;
6
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- export type RenderBlockProps = {
3
- blocks?: BuilderBlock[];
4
- parent?: string;
5
- path?: string;
6
- styleProp?: Record<string, any>;
7
- };
8
- import type { BuilderBlock } from "../types/builder-block.js";
9
- declare function RenderBlocks(props: RenderBlockProps): JSX.Element;
10
- export default RenderBlocks;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare function BuilderEditing(props: any): JSX.Element;
3
- export default BuilderEditing;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- interface Props {
3
- cssCode?: string;
4
- customFonts?: CustomFont[];
5
- contentId?: string;
6
- }
7
- import type { CustomFont } from "./render-styles.helpers";
8
- declare function RenderContentStyles(props: Props): JSX.Element;
9
- export default RenderContentStyles;
@@ -1,15 +0,0 @@
1
- export interface CustomFont {
2
- family?: string;
3
- kind?: string;
4
- fileUrl?: string;
5
- files?: {
6
- [key: string]: string;
7
- };
8
- }
9
- export declare const getFontCss: ({ customFonts }: {
10
- customFonts?: CustomFont[] | undefined;
11
- }) => string;
12
- export declare const getCss: ({ cssCode, contentId, }: {
13
- cssCode?: string | undefined;
14
- contentId?: string | undefined;
15
- }) => string;
@@ -1 +0,0 @@
1
- export { default } from './render-content';
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import type { RenderContentProps } from "./render-content.types.js";
3
- declare function RenderContent(props: RenderContentProps): JSX.Element;
4
- export default RenderContent;
@@ -1,7 +0,0 @@
1
- import type { BuilderContent } from '../../types/builder-content';
2
- import type { Nullable } from '../../types/typescript';
3
- import type { RenderContentProps } from './render-content.types';
4
- export declare const getContextStateInitialValue: ({ content, data, locale, }: Pick<RenderContentProps, 'content' | 'data' | 'locale'>) => {
5
- [x: string]: unknown;
6
- };
7
- export declare const getContentInitialValue: ({ content, data, }: Pick<RenderContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
@@ -1,38 +0,0 @@
1
- import type { BuilderRenderContext, RegisteredComponent, BuilderRenderState } from '../../context/types';
2
- import type { BuilderContent } from '../../types/builder-content';
3
- import type { Nullable } from '../../types/typescript';
4
- import type { ApiVersion } from '../../types/api-version';
5
- export interface RenderContentProps {
6
- content?: Nullable<BuilderContent>;
7
- model?: string;
8
- data?: {
9
- [key: string]: any;
10
- };
11
- context?: BuilderRenderContext;
12
- apiKey: string;
13
- apiVersion?: ApiVersion;
14
- customComponents?: RegisteredComponent[];
15
- canTrack?: boolean;
16
- locale?: string;
17
- /** @deprecated use `enrich` instead **/
18
- includeRefs?: boolean;
19
- enrich?: boolean;
20
- /**
21
- * TO-DO: improve qwik generator to not remap this name for non-HTML tags, then name it `className`
22
- */
23
- classNameProp?: string;
24
- hideContent?: boolean;
25
- parentContentId?: string;
26
- isSsrAbTest?: boolean;
27
- }
28
- export interface BuilderComponentStateChange {
29
- state: BuilderRenderState;
30
- ref: {
31
- name?: string;
32
- props?: {
33
- builderBlock?: {
34
- id?: string;
35
- };
36
- };
37
- };
38
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Apply target-specific transformations to the component reference.
3
- *
4
- * See overrides/* for examples.
5
- */
6
- export declare const wrapComponentRef: (component: any) => any;
@@ -1,17 +0,0 @@
1
- import type { Nullable } from '../../helpers/nullable';
2
- import type { BuilderContent } from '../../types/builder-content';
3
- export declare const getVariants: (content: Nullable<BuilderContent>) => import("../../types/builder-content").BuilderContentVariation[];
4
- export declare const checkShouldRunVariants: ({ canTrack, content, }: {
5
- canTrack: Nullable<boolean>;
6
- content: Nullable<BuilderContent>;
7
- }) => boolean;
8
- type VariantData = {
9
- id: string;
10
- testRatio?: number;
11
- };
12
- export declare const getVariantsScriptString: (variants: VariantData[], contentId: string) => string;
13
- export declare const getRenderContentScriptString: ({ parentContentId, contentId, }: {
14
- contentId: string;
15
- parentContentId: string;
16
- }) => string;
17
- export {};
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- type VariantsProviderProps = RenderContentProps;
3
- import type { RenderContentProps } from "../render-content/render-content.types";
4
- declare function RenderContentVariants(props: VariantsProviderProps): JSX.Element;
5
- export default RenderContentVariants;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface Props {
3
- styles: string;
4
- id?: string;
5
- }
6
- declare function RenderInlinedStyles(props: Props): JSX.Element;
7
- export default RenderInlinedStyles;
@@ -1,6 +0,0 @@
1
- import type { RegisteredComponent } from '../context/types.js';
2
- /**
3
- * Returns a list of all registered components.
4
- * NOTE: This needs to be a function to work around ESM circular dependencies.
5
- */
6
- export declare const getDefaultRegisteredComponents: () => RegisteredComponent[];
@@ -1,13 +0,0 @@
1
- export type SizeName = 'large' | 'medium' | 'small';
2
- interface Size {
3
- min: number;
4
- default: number;
5
- max: number;
6
- }
7
- export declare const getMaxWidthQueryForSize: (size: SizeName, sizeValues?: Record<SizeName, Size>) => string;
8
- interface Breakpoints {
9
- small?: number;
10
- medium?: number;
11
- }
12
- export declare const getSizesForBreakpoints: ({ small, medium }: Breakpoints) => Record<SizeName, Size>;
13
- export {};
@@ -1 +0,0 @@
1
- export declare const SDK_VERSION = "UNKNOWN_VERSION";
@@ -1,3 +0,0 @@
1
- type Target = import('../types/targets').Target;
2
- export declare const TARGET: Target;
3
- export {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: React.Context<any>;
3
- export default _default;
@@ -1,35 +0,0 @@
1
- import type { BuilderContent } from '../types/builder-content.js';
2
- import type { ComponentInfo } from '../types/components.js';
3
- import type { Dictionary, Nullable } from '../types/typescript.js';
4
- import type { ApiVersion } from '../types/api-version.js';
5
- export type RegisteredComponent = ComponentInfo & {
6
- component: any;
7
- };
8
- export type RegisteredComponents = Dictionary<RegisteredComponent>;
9
- export type BuilderRenderState = Record<string, unknown>;
10
- export type BuilderRenderContext = Record<string, unknown>;
11
- export interface BuilderContextInterface {
12
- content: Nullable<BuilderContent>;
13
- context: BuilderRenderContext;
14
- /**
15
- * The state of the application.
16
- *
17
- * NOTE: see `localState` below to understand how it is different from `rootState`.
18
- */
19
- rootState: BuilderRenderState;
20
- /**
21
- * Some frameworks have a `setState` function which needs to be invoked to notify
22
- * the framework of state change. (other frameworks don't in which case it is `undefined')
23
- */
24
- rootSetState: ((rootState: BuilderRenderState) => void) | undefined;
25
- /**
26
- * The local state of the current component. This is different from `rootState` in that
27
- * it can be a child state created by a repeater containing local state.
28
- * The `rootState` is where all of the state mutations are actually stored.
29
- */
30
- localState: BuilderRenderState | undefined;
31
- apiKey: string | null;
32
- apiVersion: ApiVersion | undefined;
33
- registeredComponents: RegisteredComponents;
34
- inheritedStyles: Record<string, unknown>;
35
- }
@@ -1 +0,0 @@
1
- export declare const camelToKebabCase: (string: string) => string;
@@ -1,7 +0,0 @@
1
- import type { BuilderContextInterface, BuilderRenderState } from '../context/types.js';
2
- export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression, }: {
3
- code: string;
4
- event?: Event;
5
- isExpression?: boolean;
6
- } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): any;
7
- export declare function flattenState(rootState: Record<string | symbol, any>, localState: Record<string | symbol, any> | undefined, rootSetState: ((rootState: BuilderRenderState) => void) | undefined): BuilderRenderState;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const getEventHandlerName: (key: string) => string;
@@ -1,4 +0,0 @@
1
- /**
2
- * Extract styles that apply to text from a style object.
3
- */
4
- export declare const extractTextStyles: (styles: Partial<CSSStyleDeclaration>) => Partial<CSSStyleDeclaration>;
@@ -1,4 +0,0 @@
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;
@@ -1,8 +0,0 @@
1
- import type { BuilderContextInterface } from '../context/types.js';
2
- import type { BuilderBlock } from '../types/builder-block.js';
3
- type Options = {
4
- block: BuilderBlock;
5
- } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>;
6
- type EventHandler = (event: Event) => any;
7
- export declare const createEventHandler: (value: string, options: Options) => EventHandler;
8
- export {};
@@ -1,9 +0,0 @@
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
- } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): Actions;
9
- export {};
@@ -1,2 +0,0 @@
1
- import type { BuilderBlock } from '../types/builder-block.js';
2
- export declare function getBlockComponentOptions(block: BuilderBlock): any;
@@ -1,2 +0,0 @@
1
- import type { BuilderBlock } from '../types/builder-block.js';
2
- export declare function getBlockProperties(block: BuilderBlock): any;
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
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 {};
@@ -1,2 +0,0 @@
1
- import type { GetContentOptions } from './types.js';
2
- export declare const generateContentUrl: (options: GetContentOptions) => URL;
@@ -1,16 +0,0 @@
1
- import type { BuilderContent } from '../../types/builder-content.js';
2
- import type { GetContentOptions } from './types.js';
3
- export declare function getContent(options: GetContentOptions): Promise<BuilderContent | null>;
4
- type ContentResults = {
5
- results: BuilderContent[];
6
- };
7
- type ContentResponse = ContentResults | {
8
- status: number;
9
- message: string;
10
- };
11
- /**
12
- * Exported only for testing purposes. Should not be used directly.
13
- */
14
- export declare const processContentResult: (options: GetContentOptions, content: ContentResults) => Promise<ContentResults>;
15
- export declare function getAllContent(options: GetContentOptions): Promise<ContentResponse | null>;
16
- export {};
@@ -1,51 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export declare const fetch: any;
@@ -1,10 +0,0 @@
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 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import type { BuilderContextInterface } from '../context/types.js';
2
- import type { BuilderBlock } from '../types/builder-block.js';
3
- export declare function getReactNativeBlockStyles({ block, context, blockStyles, }: {
4
- block: BuilderBlock;
5
- context: BuilderContextInterface;
6
- blockStyles: any;
7
- }): CSSStyleDeclaration | Record<string, string | undefined>;
@@ -1,7 +0,0 @@
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 {};
@@ -1 +0,0 @@
1
- export declare function isBrowser(): boolean;
@@ -1 +0,0 @@
1
- export declare function isEditing(): boolean;
@@ -1 +0,0 @@
1
- export declare function isIframe(): boolean;
@@ -1 +0,0 @@
1
- export declare function isPreviewing(): boolean;
@@ -1,7 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
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: ({ component: _, ...info }: RegisteredComponent) => {
12
- type: string;
13
- data: ComponentInfo;
14
- };