@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.
- package/lib/index.qwik.cjs +45 -15
- package/lib/index.qwik.mjs +45 -15
- package/package.json +5 -1
- package/types/blocks/symbol/symbol.helpers.d.ts +1 -1
- package/types/components/block/components/component-ref/component-ref.helpers.d.ts +1 -1
- package/types/components/blocks/blocks.d.ts +1 -1
- package/types/components/content/index.d.ts +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/constants/target.d.ts +1 -1
- package/types/functions/fetch-builder-props.d.ts +39 -0
- package/types/functions/get-content/index.d.ts +20 -3
- package/types/helpers/preview-lru-cache/get.d.ts +1 -1
- package/types/helpers/preview-lru-cache/set.d.ts +1 -1
- package/types/index-helpers/blocks-exports.d.ts +21 -10
- package/types/index.d.ts +4 -3
- package/types/src/blocks/BaseText.d.ts +5 -0
- package/types/src/blocks/button/button.d.ts +11 -0
- package/types/src/blocks/button/component-info.d.ts +2 -0
- package/types/src/blocks/columns/columns.d.ts +32 -0
- package/types/src/blocks/columns/component-info.d.ts +2 -0
- package/types/src/blocks/custom-code/component-info.d.ts +2 -0
- package/types/src/blocks/custom-code/custom-code.d.ts +7 -0
- package/types/src/blocks/embed/component-info.d.ts +2 -0
- package/types/src/blocks/embed/embed.d.ts +6 -0
- package/types/src/blocks/embed/helpers.d.ts +1 -0
- package/types/src/blocks/form/component-info.d.ts +2 -0
- package/types/src/blocks/fragment/component-info.d.ts +2 -0
- package/types/src/blocks/fragment/fragment.d.ts +7 -0
- package/types/src/blocks/helpers.d.ts +13 -0
- package/types/src/blocks/image/component-info.d.ts +2 -0
- package/types/src/blocks/image/image.d.ts +23 -0
- package/types/src/blocks/image/image.helpers.d.ts +1 -0
- package/types/src/blocks/img/component-info.d.ts +2 -0
- package/types/src/blocks/img/img.d.ts +12 -0
- package/types/src/blocks/input/component-info.d.ts +2 -0
- package/types/src/blocks/input/input.d.ts +13 -0
- package/types/src/blocks/raw-text/component-info.d.ts +2 -0
- package/types/src/blocks/raw-text/raw-text.d.ts +6 -0
- package/types/src/blocks/section/component-info.d.ts +2 -0
- package/types/src/blocks/section/section.d.ts +10 -0
- package/types/src/blocks/select/component-info.d.ts +2 -0
- package/types/src/blocks/select/select.d.ts +14 -0
- package/types/src/blocks/submit-button/component-info.d.ts +2 -0
- package/types/src/blocks/submit-button/submit-button.d.ts +8 -0
- package/types/src/blocks/symbol/component-info.d.ts +2 -0
- package/types/src/blocks/symbol/symbol.d.ts +24 -0
- package/types/src/blocks/symbol/symbol.helpers.d.ts +14 -0
- package/types/src/blocks/text/component-info.d.ts +2 -0
- package/types/src/blocks/text/text.d.ts +5 -0
- package/types/src/blocks/textarea/component-info.d.ts +2 -0
- package/types/src/blocks/textarea/textarea.d.ts +11 -0
- package/types/src/blocks/video/component-info.d.ts +2 -0
- package/types/src/blocks/video/video.d.ts +19 -0
- package/types/src/components/block/block.d.ts +9 -0
- package/types/src/components/block/block.helpers.d.ts +13 -0
- package/types/{components/render-block → src/components/block/components}/block-styles.d.ts +2 -2
- package/types/{components/block/components/block-wrapper → src/components/block/components}/block-wrapper.d.ts +7 -4
- package/types/src/components/block/components/component-ref/component-ref.d.ts +3 -0
- package/types/src/components/block/components/component-ref/component-ref.helpers.d.ts +35 -0
- package/types/src/components/block/components/interactive-element.d.ts +11 -0
- package/types/src/components/block/components/repeated-block.d.ts +9 -0
- package/types/src/components/blocks/blocks-wrapper.d.ts +13 -0
- package/types/src/components/blocks/blocks.d.ts +8 -0
- package/types/{components/render-content/render-content.d.ts → src/components/content/components/enable-editor.d.ts} +10 -7
- package/types/{components/content/components/content-styles.d.ts → src/components/content/components/styles.d.ts} +1 -1
- package/types/{components/content/components/content-styles.helpers.d.ts → src/components/content/components/styles.helpers.d.ts} +1 -1
- package/types/src/components/content/content.d.ts +5 -0
- package/types/src/components/content/content.helpers.d.ts +7 -0
- package/types/{components/render-content/render-content.types.d.ts → src/components/content/content.types.d.ts} +4 -4
- package/types/src/components/content/index.d.ts +1 -0
- package/types/src/components/content-variants/content-variants.d.ts +9 -0
- package/types/{components/render-content-variants/render-content-variants.types.d.ts → src/components/content-variants/content-variants.types.d.ts} +5 -5
- package/types/{components/render-content-variants → src/components/content-variants}/helpers.d.ts +7 -7
- package/types/src/components/inlined-script.d.ts +6 -0
- package/types/src/components/inlined-styles.d.ts +6 -0
- package/types/src/constants/builder-registered-components.d.ts +6 -0
- package/types/src/constants/device-sizes.d.ts +13 -0
- package/types/src/constants/sdk-version.d.ts +1 -0
- package/types/src/constants/target.d.ts +2 -0
- package/types/src/context/builder.context.d.ts +2 -0
- package/types/src/context/components.context.d.ts +2 -0
- package/types/src/context/types.d.ts +35 -0
- package/types/src/functions/apply-patch-with-mutation.d.ts +10 -0
- package/types/src/functions/camel-to-kebab-case.d.ts +1 -0
- package/types/src/functions/evaluate/browser-runtime/browser.d.ts +4 -0
- package/types/src/functions/evaluate/browser-runtime/index.d.ts +1 -0
- package/types/src/functions/evaluate/evaluate.d.ts +10 -0
- package/types/src/functions/evaluate/helpers.d.ts +18 -0
- package/types/src/functions/evaluate/index.d.ts +1 -0
- package/types/src/functions/evaluate/node-runtime/index.d.ts +1 -0
- package/types/src/functions/evaluate/node-runtime/node-runtime.d.ts +2 -0
- package/types/src/functions/evaluate/non-node-runtime/acorn-interpreter.d.ts +2 -0
- package/types/src/functions/evaluate/non-node-runtime/index.d.ts +1 -0
- package/types/{functions/evaluate → src/functions/evaluate/non-node-runtime}/non-node-runtime.d.ts +1 -1
- package/types/src/functions/evaluate/placeholder-runtime.d.ts +2 -0
- package/types/src/functions/evaluate/types.d.ts +11 -0
- package/types/src/functions/event-handler-name.d.ts +1 -0
- package/types/src/functions/extract-text-styles.d.ts +4 -0
- package/types/src/functions/fast-clone.d.ts +4 -0
- package/types/src/functions/fetch-builder-props.d.ts +39 -0
- package/types/src/functions/get-block-actions-handler.d.ts +5 -0
- package/types/src/functions/get-block-actions.d.ts +10 -0
- package/types/src/functions/get-block-component-options.d.ts +2 -0
- package/types/src/functions/get-block-properties.d.ts +11 -0
- package/types/src/functions/get-builder-search-params/index.d.ts +12 -0
- package/types/src/functions/get-content/generate-content-url.d.ts +2 -0
- package/types/src/functions/get-content/index.d.ts +29 -0
- package/types/src/functions/get-content/types.d.ts +51 -0
- package/types/src/functions/get-fetch.d.ts +1 -0
- package/types/src/functions/get-global-this.d.ts +4 -0
- package/types/src/functions/get-processed-block.d.ts +10 -0
- package/types/{functions/get-block-styles.d.ts → src/functions/get-react-native-block-styles.d.ts} +3 -2
- package/types/src/functions/if-target.d.ts +7 -0
- package/types/src/functions/is-browser.d.ts +1 -0
- package/types/src/functions/is-editing.d.ts +1 -0
- package/types/src/functions/is-iframe.d.ts +1 -0
- package/types/src/functions/is-non-node-server.d.ts +4 -0
- package/types/src/functions/is-previewing.d.ts +1 -0
- package/types/src/functions/on-change.d.ts +7 -0
- package/types/src/functions/register-component.d.ts +15 -0
- package/types/src/functions/register.d.ts +16 -0
- package/types/src/functions/sanitize-react-native-block-styles.d.ts +3 -0
- package/types/src/functions/set-editor-settings.d.ts +4 -0
- package/types/src/functions/set.d.ts +7 -0
- package/types/src/functions/track/helpers.d.ts +5 -0
- package/types/{functions/track.d.ts → src/functions/track/index.d.ts} +6 -11
- package/types/src/functions/track/interaction.d.ts +13 -0
- package/types/src/functions/transform-block-properties.d.ts +1 -0
- package/types/src/functions/transform-block.d.ts +2 -0
- package/types/src/helpers/ab-tests.d.ts +9 -0
- package/types/src/helpers/canTrack.d.ts +1 -0
- package/types/src/helpers/cookie.d.ts +19 -0
- package/types/src/helpers/css.d.ts +7 -0
- package/types/src/helpers/flatten.d.ts +6 -0
- package/types/src/helpers/localStorage.d.ts +9 -0
- package/types/src/helpers/logger.d.ts +6 -0
- package/types/src/helpers/nullable.d.ts +2 -0
- package/types/src/helpers/preview-lru-cache/get.d.ts +2 -0
- package/types/src/helpers/preview-lru-cache/helpers.d.ts +0 -0
- package/types/src/helpers/preview-lru-cache/init.d.ts +6 -0
- package/types/src/helpers/preview-lru-cache/set.d.ts +7 -0
- package/types/src/helpers/preview-lru-cache/types.d.ts +0 -0
- package/types/src/helpers/sessionId.d.ts +6 -0
- package/types/src/helpers/time.d.ts +1 -0
- package/types/src/helpers/url.d.ts +6 -0
- package/types/src/helpers/uuid.d.ts +8 -0
- package/types/src/helpers/visitorId.d.ts +6 -0
- package/types/src/index-helpers/blocks-exports.d.ts +21 -0
- package/types/src/index-helpers/top-of-file.d.ts +1 -0
- package/types/src/index.d.ts +16 -0
- package/types/src/scripts/init-editing.d.ts +6 -0
- package/types/src/types/api-version.d.ts +2 -0
- package/types/src/types/builder-block.d.ts +66 -0
- package/types/src/types/builder-content.d.ts +44 -0
- package/types/src/types/builder-props.d.ts +9 -0
- package/types/src/types/can-track.d.ts +3 -0
- package/types/src/types/components.d.ts +111 -0
- package/types/src/types/deep-partial.d.ts +3 -0
- package/types/src/types/element.d.ts +59 -0
- package/types/src/types/enforced-partials.d.ts +21 -0
- package/types/src/types/input.d.ts +121 -0
- package/types/src/types/targets.d.ts +1 -0
- package/types/src/types/typescript.d.ts +11 -0
- package/types/blocks/util.d.ts +0 -4
- package/types/components/block/components/component-ref.d.ts +0 -23
- package/types/components/block/components/component.d.ts +0 -21
- package/types/components/block/components/interactive-element/interactive-element.d.ts +0 -4
- package/types/components/block/components/interactive-element/interactive-element.helpers.d.ts +0 -16
- package/types/components/content/builder-editing.d.ts +0 -2
- package/types/components/content/components/render-styles.d.ts +0 -8
- package/types/components/content/components/render-styles.helpers.d.ts +0 -15
- package/types/components/render-block/render-block.d.ts +0 -8
- package/types/components/render-block/render-block.helpers.d.ts +0 -12
- package/types/components/render-block/render-component-with-context.d.ts +0 -3
- package/types/components/render-block/render-component.d.ts +0 -18
- package/types/components/render-block/render-repeated-block.d.ts +0 -8
- package/types/components/render-blocks.d.ts +0 -12
- package/types/components/render-content/builder-editing.d.ts +0 -2
- package/types/components/render-content/components/render-styles.d.ts +0 -8
- package/types/components/render-content/components/render-styles.helpers.d.ts +0 -15
- package/types/components/render-content/index.d.ts +0 -1
- package/types/components/render-content/render-content.helpers.d.ts +0 -7
- package/types/components/render-content-variants/render-content-variants.d.ts +0 -9
- package/types/components/render-inlined-styles.d.ts +0 -6
- package/types/functions/acorn_interpreter.d.ts +0 -1
- package/types/functions/apply-patch-with-mutation.test.d.ts +0 -1
- package/types/functions/convert-style-object.d.ts +0 -1
- package/types/functions/evaluate/acorn.d.ts +0 -11
- package/types/functions/evaluate/evaluate.test.d.ts +0 -1
- package/types/functions/evaluate.d.ts +0 -23
- package/types/functions/evaluate.test.d.ts +0 -1
- package/types/functions/get-block-tag.d.ts +0 -3
- package/types/functions/get-builder-search-params/fn.test.d.ts +0 -1
- package/types/functions/get-content/ab-testing.d.ts +0 -5
- package/types/functions/get-content/fn.test.d.ts +0 -1
- package/types/functions/get-content/generate-content-url.test.d.ts +0 -1
- package/types/functions/get-content/processCookies.d.ts +0 -2
- package/types/functions/get-processed-block.test.d.ts +0 -1
- package/types/functions/mark-mutable.d.ts +0 -2
- package/types/functions/on-change.test.d.ts +0 -1
- package/types/functions/sanitize-styles.d.ts +0 -4
- package/types/functions/set.test.d.ts +0 -1
- package/types/helpers/url.test.d.ts +0 -1
- package/types/talk/generators-updated.d.ts +0 -1
- package/types/talk/generators.d.ts +0 -6
- /package/types/{components/render-block → src/components/block}/types.d.ts +0 -0
- /package/types/{components/render-content → src/components/content}/wrap-component-ref.d.ts +0 -0
- /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 @@
|
|
|
1
|
+
export { runInNonNode } from './non-node-runtime.js';
|
package/types/{functions/evaluate → src/functions/evaluate/non-node-runtime}/non-node-runtime.d.ts
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ExecutorArgs } from '
|
|
1
|
+
import type { ExecutorArgs } from '../types';
|
|
2
2
|
export declare const runInNonNode: ({ builder, context, event, rootState, localState, rootSetState, useCode }: ExecutorArgs) => any;
|
|
@@ -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,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,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,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,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;
|
package/types/{functions/get-block-styles.d.ts → src/functions/get-react-native-block-styles.d.ts}
RENAMED
|
@@ -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
|
|
3
|
+
export declare function getReactNativeBlockStyles({ block, context, blockStyles }: {
|
|
4
4
|
block: BuilderBlock;
|
|
5
5
|
context: BuilderContextInterface;
|
|
6
|
-
|
|
6
|
+
blockStyles: any;
|
|
7
|
+
}): CSSStyleDeclaration | Record<string, string | undefined>;
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function isPreviewing(): boolean;
|
|
@@ -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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CanTrack } from '
|
|
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
|
-
*
|
|
20
|
+
* (Optional) metadata that you want to provide with your event.
|
|
20
21
|
*/
|
|
21
|
-
metadata?:
|
|
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
|
-
|
|
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
|
|
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,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,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;
|
|
File without changes
|
|
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
|
+
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;
|