@builder.io/sdk-react-native 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/BaseText.d.ts +6 -0
- package/dist/blocks/button/button.d.ts +9 -0
- package/dist/blocks/button/component-info.d.ts +2 -0
- package/dist/blocks/columns/columns.d.ts +16 -0
- package/dist/blocks/columns/component-info.d.ts +2 -0
- package/dist/blocks/custom-code/component-info.d.ts +2 -0
- package/dist/blocks/custom-code/custom-code.d.ts +5 -0
- package/dist/blocks/embed/component-info.d.ts +2 -0
- package/dist/blocks/embed/embed.d.ts +5 -0
- package/dist/blocks/embed/helpers.d.ts +1 -0
- package/dist/blocks/form/component-info.d.ts +2 -0
- package/dist/blocks/form/form.d.ts +28 -0
- package/dist/blocks/fragment/component-info.d.ts +2 -0
- package/dist/blocks/fragment/fragment.d.ts +8 -0
- package/dist/blocks/image/component-info.d.ts +2 -0
- package/dist/blocks/image/image.d.ts +17 -0
- package/dist/blocks/image/image.helpers.d.ts +1 -0
- package/dist/blocks/img/component-info.d.ts +2 -0
- package/dist/blocks/img/component-info.js +1 -1
- package/dist/blocks/img/img.d.ts +11 -0
- package/dist/blocks/input/component-info.d.ts +2 -0
- package/dist/blocks/input/input.d.ts +12 -0
- package/dist/blocks/raw-text/component-info.d.ts +2 -0
- package/dist/blocks/raw-text/raw-text.d.ts +5 -0
- package/dist/blocks/section/component-info.d.ts +2 -0
- package/dist/blocks/section/section.d.ts +9 -0
- package/dist/blocks/select/component-info.d.ts +2 -0
- package/dist/blocks/select/select.d.ts +13 -0
- package/dist/blocks/submit-button/component-info.d.ts +2 -0
- package/dist/blocks/submit-button/submit-button.d.ts +7 -0
- package/dist/blocks/symbol/component-info.d.ts +2 -0
- package/dist/blocks/symbol/symbol.d.ts +21 -0
- package/dist/blocks/text/component-info.d.ts +2 -0
- package/dist/blocks/text/text.d.ts +7 -0
- package/dist/blocks/textarea/component-info.d.ts +2 -0
- package/dist/blocks/textarea/textarea.d.ts +10 -0
- package/dist/blocks/util.d.ts +4 -0
- package/dist/blocks/video/component-info.d.ts +2 -0
- package/dist/blocks/video/video.d.ts +31 -0
- package/dist/components/render-block/block-styles.d.ts +9 -0
- package/dist/components/render-block/render-block.d.ts +9 -0
- package/dist/components/render-block/render-block.helpers.d.ts +12 -0
- package/dist/components/render-block/render-block.js +18 -26
- package/dist/components/render-block/render-component.d.ts +17 -0
- package/dist/components/render-block/render-repeated-block.d.ts +9 -0
- package/dist/components/render-block/render-repeated-block.js +3 -12
- package/dist/components/render-block/types.d.ts +6 -0
- package/dist/components/render-blocks.d.ts +10 -0
- package/dist/components/render-blocks.js +1 -1
- package/dist/components/render-content/builder-editing.d.ts +3 -0
- package/dist/components/render-content/components/render-styles.d.ts +9 -0
- package/dist/components/render-content/components/render-styles.helpers.d.ts +15 -0
- package/dist/components/render-content/index.d.ts +1 -0
- package/dist/components/render-content/render-content.d.ts +4 -0
- package/dist/components/render-content/render-content.helpers.d.ts +7 -0
- package/dist/components/render-content/render-content.js +77 -71
- package/dist/components/render-content/render-content.types.d.ts +38 -0
- package/dist/components/render-content/wrap-component-ref.d.ts +6 -0
- package/dist/components/render-content-variants/helpers.d.ts +17 -0
- package/dist/components/render-content-variants/render-content-variants.d.ts +5 -0
- package/dist/components/render-inlined-styles.d.ts +7 -0
- package/dist/constants/builder-registered-components.d.ts +6 -0
- package/dist/constants/device-sizes.d.ts +13 -0
- package/dist/constants/sdk-version.d.ts +1 -0
- package/dist/constants/sdk-version.js +1 -1
- package/dist/constants/target.d.ts +3 -0
- package/dist/context/builder.context.d.ts +3 -0
- package/dist/context/types.d.ts +35 -0
- package/dist/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/functions/evaluate.d.ts +7 -0
- package/dist/functions/evaluate.test.d.ts +1 -0
- package/dist/functions/event-handler-name.d.ts +1 -0
- package/dist/functions/extract-text-styles.d.ts +4 -0
- package/dist/functions/fast-clone.d.ts +4 -0
- package/dist/functions/get-block-actions-handler.d.ts +8 -0
- package/dist/functions/get-block-actions.d.ts +9 -0
- package/dist/functions/get-block-component-options.d.ts +2 -0
- package/dist/functions/get-block-properties.d.ts +2 -0
- package/dist/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/functions/get-builder-search-params/index.d.ts +12 -0
- package/dist/functions/get-content/generate-content-url.d.ts +2 -0
- package/dist/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/functions/get-content/index.d.ts +16 -0
- package/dist/functions/get-content/types.d.ts +51 -0
- package/dist/functions/get-fetch.d.ts +1 -0
- package/dist/functions/get-processed-block.d.ts +10 -0
- package/dist/functions/get-processed-block.test.d.ts +1 -0
- package/dist/functions/get-react-native-block-styles.d.ts +7 -0
- package/dist/functions/if-target.d.ts +7 -0
- package/dist/functions/is-browser.d.ts +1 -0
- package/dist/functions/is-editing.d.ts +1 -0
- package/dist/functions/is-iframe.d.ts +1 -0
- package/dist/functions/is-previewing.d.ts +1 -0
- package/dist/functions/on-change.d.ts +7 -0
- package/dist/functions/on-change.test.d.ts +1 -0
- package/dist/functions/register-component.d.ts +14 -0
- package/dist/functions/register.d.ts +16 -0
- package/dist/functions/sanitize-react-native-block-styles.d.ts +3 -0
- package/dist/functions/set-editor-settings.d.ts +4 -0
- package/dist/functions/set.d.ts +7 -0
- package/dist/functions/set.test.d.ts +1 -0
- package/dist/functions/track/helpers.d.ts +5 -0
- package/dist/functions/track/index.d.ts +51 -0
- package/dist/functions/track/interaction.d.ts +13 -0
- package/dist/functions/transform-block-properties.d.ts +3 -0
- package/dist/functions/transform-block.d.ts +2 -0
- package/dist/helpers/ab-tests.d.ts +9 -0
- package/dist/helpers/canTrack.d.ts +1 -0
- package/dist/helpers/cookie.d.ts +9 -0
- package/dist/helpers/css.d.ts +7 -0
- package/dist/helpers/flatten.d.ts +6 -0
- package/dist/helpers/localStorage.d.ts +9 -0
- package/dist/helpers/logger.d.ts +6 -0
- package/dist/helpers/nullable.d.ts +2 -0
- package/dist/helpers/sessionId.d.ts +6 -0
- package/dist/helpers/time.d.ts +1 -0
- package/dist/helpers/url.d.ts +6 -0
- package/dist/helpers/url.test.d.ts +1 -0
- package/dist/helpers/uuid.d.ts +8 -0
- package/dist/helpers/visitorId.d.ts +6 -0
- package/dist/index-helpers/blocks-exports.d.ts +8 -0
- package/dist/index-helpers/top-of-file.d.ts +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +5 -3
- package/dist/scripts/init-editing.d.ts +6 -0
- package/dist/types/api-version.d.ts +2 -0
- package/dist/types/builder-block.d.ts +66 -0
- package/dist/types/builder-content.d.ts +44 -0
- package/dist/types/can-track.d.ts +3 -0
- package/dist/types/components.d.ts +105 -0
- package/dist/types/deep-partial.d.ts +3 -0
- package/dist/types/element.d.ts +59 -0
- package/dist/types/input.d.ts +121 -0
- package/dist/types/targets.d.ts +3 -0
- package/dist/types/typescript.d.ts +5 -0
- package/package.json +1 -1
- package/src/blocks/img/component-info.js +1 -1
- package/src/components/render-block/render-block.jsx +21 -29
- package/src/components/render-block/render-repeated-block.jsx +5 -15
- package/src/components/render-blocks.jsx +1 -0
- package/src/components/render-content/render-content.jsx +77 -85
- package/src/constants/sdk-version.js +1 -1
- package/src/index.js +2 -0
- package/dist/components/render-block/render-component-with-context.js +0 -45
- package/dist/functions/get-block-tag.js +0 -8
- package/dist/functions/get-content/ab-testing.js +0 -89
- package/dist/functions/track.js +0 -120
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPreviewing(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CanTrack } from '../../types/can-track.js';
|
|
2
|
+
import type { Dictionary } from '../../types/typescript.js';
|
|
3
|
+
interface Event {
|
|
4
|
+
/**
|
|
5
|
+
* The type of your event.
|
|
6
|
+
*
|
|
7
|
+
* Examples: `click`, `conversion`, `pageview`, `impression`
|
|
8
|
+
*/
|
|
9
|
+
type: string;
|
|
10
|
+
data: {
|
|
11
|
+
/**
|
|
12
|
+
* (Optional) The content's ID. Useful if this event pertains to a specific piece of content.
|
|
13
|
+
*/
|
|
14
|
+
contentId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* This is the ID of the space that the content belongs to.
|
|
17
|
+
*/
|
|
18
|
+
ownerId: string;
|
|
19
|
+
/**
|
|
20
|
+
* (Optional) metadata that you want to provide with your event.
|
|
21
|
+
*/
|
|
22
|
+
metadata?: Dictionary<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Session ID of the user. This is provided by the SDK by checking session storage.
|
|
25
|
+
*/
|
|
26
|
+
sessionId: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Visitor ID of the user. This is provided by the SDK by checking cookies.
|
|
29
|
+
*/
|
|
30
|
+
visitorId: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* (Optional) If running an A/B test, the ID of the variation that the user is in.
|
|
33
|
+
*/
|
|
34
|
+
variationId?: string;
|
|
35
|
+
[index: string]: any;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
type EventProperties = Pick<Event, 'type'> & Pick<Event['data'], 'contentId' | 'variationId' | 'metadata'> & {
|
|
39
|
+
/**
|
|
40
|
+
* Your organization's API key.
|
|
41
|
+
*/
|
|
42
|
+
apiKey: Event['data']['ownerId'];
|
|
43
|
+
/**
|
|
44
|
+
* (Optional) Any additional (non-metadata) properties to add to the event.
|
|
45
|
+
*/
|
|
46
|
+
[index: string]: any;
|
|
47
|
+
};
|
|
48
|
+
export type EventProps = EventProperties & CanTrack;
|
|
49
|
+
export declare function _track(eventProps: EventProps): Promise<void | Response>;
|
|
50
|
+
export declare const track: (args: EventProperties) => Promise<void | Response>;
|
|
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,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,9 @@
|
|
|
1
|
+
import type { CanTrack } from '../types/can-track.js';
|
|
2
|
+
export declare const getCookie: ({ name, canTrack, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
} & CanTrack) => Promise<any>;
|
|
5
|
+
export declare const setCookie: ({ name, value, expires, canTrack, }: {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
expires?: Date | undefined;
|
|
9
|
+
} & CanTrack) => Promise<undefined>;
|
|
@@ -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;
|
|
@@ -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<undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCurrentDatePlusMinutes: (minutes?: number) => Date;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Columns } from '../blocks/columns/columns';
|
|
2
|
+
export { default as Image } from '../blocks/image/image';
|
|
3
|
+
export { default as Text } from '../blocks/text/text';
|
|
4
|
+
export { default as Symbol } from '../blocks/symbol/symbol';
|
|
5
|
+
export { default as Button } from '../blocks/button/button';
|
|
6
|
+
export { default as Section } from '../blocks/section/section';
|
|
7
|
+
export { default as Fragment } from '../blocks/fragment/fragment';
|
|
8
|
+
export { default as RenderContent } from '../components/render-content/render-content';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'react-native-url-polyfill/auto';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
export * from './index-helpers/blocks-exports.js';
|
|
3
|
+
export { isEditing } from './functions/is-editing.js';
|
|
4
|
+
export { isPreviewing } from './functions/is-previewing.js';
|
|
5
|
+
export { createRegisterComponentMessage } from './functions/register-component.js';
|
|
6
|
+
export { register } from './functions/register.js';
|
|
7
|
+
export type { InsertMenuConfig, InsertMenuItem } from './functions/register.js';
|
|
8
|
+
export { setEditorSettings } from './functions/set-editor-settings.js';
|
|
9
|
+
export type { Settings } from './functions/set-editor-settings.js';
|
|
10
|
+
export { getAllContent, getContent, processContentResult, } from './functions/get-content/index.js';
|
|
11
|
+
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
12
|
+
export { track } from './functions/track/index.js';
|
|
13
|
+
export type { RegisteredComponent } from './context/types';
|
|
14
|
+
export type { ComponentInfo } from './types/components';
|
|
15
|
+
export type { RenderContentProps } from './components/render-content/render-content.types.js';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.track = exports.setEditorSettings = exports.register = exports.processContentResult = exports.isPreviewing = exports.isEditing = exports.getContent = exports.getAllContent = exports.createRegisterComponentMessage = void 0;
|
|
17
|
+
exports.track = exports.setEditorSettings = exports.register = exports.processContentResult = exports.isPreviewing = exports.isEditing = exports.getContent = exports.getBuilderSearchParams = exports.getAllContent = exports.createRegisterComponentMessage = void 0;
|
|
18
18
|
__exportStar(require("./index-helpers/top-of-file.js"), exports);
|
|
19
19
|
__exportStar(require("./index-helpers/blocks-exports.js"), exports);
|
|
20
20
|
const is_editing_js_1 = require("./functions/is-editing.js");
|
|
@@ -31,5 +31,7 @@ const index_js_1 = require("./functions/get-content/index.js");
|
|
|
31
31
|
Object.defineProperty(exports, "getAllContent", { enumerable: true, get: function () { return index_js_1.getAllContent; } });
|
|
32
32
|
Object.defineProperty(exports, "getContent", { enumerable: true, get: function () { return index_js_1.getContent; } });
|
|
33
33
|
Object.defineProperty(exports, "processContentResult", { enumerable: true, get: function () { return index_js_1.processContentResult; } });
|
|
34
|
-
const index_js_2 = require("./functions/
|
|
35
|
-
Object.defineProperty(exports, "
|
|
34
|
+
const index_js_2 = require("./functions/get-builder-search-params/index.js");
|
|
35
|
+
Object.defineProperty(exports, "getBuilderSearchParams", { enumerable: true, get: function () { return index_js_2.getBuilderSearchParams; } });
|
|
36
|
+
const index_js_3 = require("./functions/track/index.js");
|
|
37
|
+
Object.defineProperty(exports, "track", { enumerable: true, get: function () { return index_js_3.track; } });
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
type JSONValue = string | number | boolean | JSONObject | JSONArray;
|
|
2
|
+
interface JSONObject {
|
|
3
|
+
[x: string]: JSONValue;
|
|
4
|
+
}
|
|
5
|
+
interface JSONArray extends Array<JSONValue> {
|
|
6
|
+
}
|
|
7
|
+
/** @todo typedoc this */
|
|
8
|
+
export interface BuilderBlock {
|
|
9
|
+
'@type': '@builder.io/sdk:Element';
|
|
10
|
+
'@version'?: number;
|
|
11
|
+
id?: string;
|
|
12
|
+
tagName?: string;
|
|
13
|
+
layerName?: string;
|
|
14
|
+
groupLocked?: boolean;
|
|
15
|
+
layerLocked?: boolean;
|
|
16
|
+
/** @todo make alias for properties.class */
|
|
17
|
+
class?: string;
|
|
18
|
+
children?: BuilderBlock[];
|
|
19
|
+
responsiveStyles?: {
|
|
20
|
+
large?: Partial<CSSStyleDeclaration>;
|
|
21
|
+
medium?: Partial<CSSStyleDeclaration>;
|
|
22
|
+
small?: Partial<CSSStyleDeclaration>;
|
|
23
|
+
/** @deprecated */
|
|
24
|
+
xsmall?: Partial<CSSStyleDeclaration>;
|
|
25
|
+
};
|
|
26
|
+
component?: {
|
|
27
|
+
name: string;
|
|
28
|
+
options?: any;
|
|
29
|
+
tag?: string;
|
|
30
|
+
};
|
|
31
|
+
bindings?: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
meta?: {
|
|
35
|
+
[key: string]: JSONValue;
|
|
36
|
+
};
|
|
37
|
+
actions?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
};
|
|
40
|
+
properties?: {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
};
|
|
43
|
+
code?: {
|
|
44
|
+
bindings?: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
actions?: {
|
|
48
|
+
[key: string]: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
repeat?: {
|
|
52
|
+
collection: string;
|
|
53
|
+
itemName?: string;
|
|
54
|
+
} | null;
|
|
55
|
+
animations?: any[];
|
|
56
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
57
|
+
/**
|
|
58
|
+
* generated by the "Hide If" binding
|
|
59
|
+
*/
|
|
60
|
+
hide?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* generated by the "Show If" binding
|
|
63
|
+
*/
|
|
64
|
+
show?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { BuilderBlock } from './builder-block.js';
|
|
2
|
+
import type { Input } from './input.js';
|
|
3
|
+
import type { Nullable } from './typescript.js';
|
|
4
|
+
export interface Breakpoints {
|
|
5
|
+
small: number;
|
|
6
|
+
medium: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BuilderContentVariation {
|
|
9
|
+
data?: {
|
|
10
|
+
title?: string;
|
|
11
|
+
blocks?: BuilderBlock[];
|
|
12
|
+
inputs?: Input[];
|
|
13
|
+
state?: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
jsCode?: string;
|
|
17
|
+
tsCode?: string;
|
|
18
|
+
httpRequests?: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
};
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
name?: string;
|
|
24
|
+
testRatio?: number;
|
|
25
|
+
id?: string;
|
|
26
|
+
meta?: {
|
|
27
|
+
breakpoints?: Nullable<Breakpoints>;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface BuilderContent extends BuilderContentVariation {
|
|
32
|
+
'@version'?: number;
|
|
33
|
+
published?: 'published' | 'draft' | 'archived';
|
|
34
|
+
modelId?: string;
|
|
35
|
+
priority?: number;
|
|
36
|
+
lastUpdated?: number;
|
|
37
|
+
startDate?: number;
|
|
38
|
+
endDate?: number;
|
|
39
|
+
variations?: {
|
|
40
|
+
[id: string]: BuilderContentVariation;
|
|
41
|
+
};
|
|
42
|
+
testVariationId?: string;
|
|
43
|
+
testVariationName?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { BuilderElement } from './element';
|
|
2
|
+
import type { Input } from './input';
|
|
3
|
+
export interface ComponentInfo {
|
|
4
|
+
/**
|
|
5
|
+
* Name your component something unique, e.g. 'MyButton'. You can override built-in components
|
|
6
|
+
* by registering a component with the same name, e.g. 'Text', to replace the built-in text component
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Link to a documentation page for this component
|
|
12
|
+
*/
|
|
13
|
+
docsLink?: string;
|
|
14
|
+
image?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Input schema for your component for users to fill in the options
|
|
17
|
+
*/
|
|
18
|
+
inputs?: Input[];
|
|
19
|
+
class?: any;
|
|
20
|
+
type?: 'angular' | 'webcomponent' | 'react' | 'vue';
|
|
21
|
+
defaultStyles?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Turn on if your component can accept children. Be sure to use in combination with
|
|
26
|
+
* withChildren(YourComponent) like here
|
|
27
|
+
* github.com/BuilderIO/builder/blob/master/examples/react-design-system/src/components/HeroWithChildren/HeroWithChildren.builder.js#L5
|
|
28
|
+
*/
|
|
29
|
+
canHaveChildren?: boolean;
|
|
30
|
+
fragment?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Do not wrap a component in a dom element. Be sure to use {...props.attributes} with this option
|
|
33
|
+
* like here github.com/BuilderIO/builder/blob/master/packages/react/src/blocks/forms/Input.tsx#L34
|
|
34
|
+
*/
|
|
35
|
+
noWrap?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Default children
|
|
38
|
+
*/
|
|
39
|
+
defaultChildren?: BuilderElement[];
|
|
40
|
+
defaults?: Partial<BuilderElement>;
|
|
41
|
+
hooks?: {
|
|
42
|
+
[key: string]: string | Function;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Hide your component in editor, useful for gradually deprecating components
|
|
46
|
+
*/
|
|
47
|
+
hideFromInsertMenu?: boolean;
|
|
48
|
+
tag?: string;
|
|
49
|
+
static?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Passing a list of model names will restrict using the component to only the models listed here, otherwise it'll be available for all models
|
|
52
|
+
*/
|
|
53
|
+
models?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Specify restrictions direct children must match
|
|
56
|
+
*/
|
|
57
|
+
childRequirements?: {
|
|
58
|
+
/** Message to show when this doesn't match, e.g. "Children of 'Columns' must be a 'Column'" */
|
|
59
|
+
message: string;
|
|
60
|
+
/** Simple way to say children must be a specific component name */
|
|
61
|
+
component?: string;
|
|
62
|
+
/**
|
|
63
|
+
* More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
|
|
64
|
+
* of what the children objects should match, e.g.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* query: {
|
|
68
|
+
* // Child of this element must be a 'Button' or 'Text' component
|
|
69
|
+
* 'component.name': { $in: ['Button', 'Text'] }
|
|
70
|
+
* }
|
|
71
|
+
*/
|
|
72
|
+
query?: any;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Specify restrictions any parent must match
|
|
76
|
+
*/
|
|
77
|
+
requiresParent?: {
|
|
78
|
+
/** Message to show when this doesn't match, e.g. "'Add to cart' buttons must be within a 'Product box'" */
|
|
79
|
+
message: string;
|
|
80
|
+
/** Simple way to say a parent must be a specific component name, e.g. 'Product box' */
|
|
81
|
+
component?: string;
|
|
82
|
+
/**
|
|
83
|
+
* More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
|
|
84
|
+
* of what at least one parent in the parents hierarchy should match, e.g.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* query: {
|
|
88
|
+
* // Thils element must be somewhere inside either a 'Product box' or 'Collection' component
|
|
89
|
+
* 'component.name': { $in: ['Product Box', 'Collection'] }
|
|
90
|
+
* }
|
|
91
|
+
*/
|
|
92
|
+
query?: any;
|
|
93
|
+
};
|
|
94
|
+
/** not yet implemented */
|
|
95
|
+
friendlyName?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Use to restrict access to your component based on a the current user permissions
|
|
98
|
+
* By default components will show to all users
|
|
99
|
+
* for more information on permissions in builder check https://www.builder.io/c/docs/guides/roles-and-permissions
|
|
100
|
+
*/
|
|
101
|
+
requiredPermissions?: Array<Permission>;
|
|
102
|
+
hidden?: boolean;
|
|
103
|
+
}
|
|
104
|
+
type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
type JSONValue = string | number | boolean | JSONObject | JSONArray;
|
|
2
|
+
interface JSONObject {
|
|
3
|
+
[x: string]: JSONValue;
|
|
4
|
+
}
|
|
5
|
+
interface JSONArray extends Array<JSONValue> {
|
|
6
|
+
}
|
|
7
|
+
/** @todo typedoc this */
|
|
8
|
+
export interface BuilderElement {
|
|
9
|
+
'@type': '@builder.io/sdk:Element';
|
|
10
|
+
'@version'?: number;
|
|
11
|
+
id?: string;
|
|
12
|
+
tagName?: string;
|
|
13
|
+
layerName?: string;
|
|
14
|
+
groupLocked?: boolean;
|
|
15
|
+
layerLocked?: boolean;
|
|
16
|
+
/** @todo make alias for properties.class */
|
|
17
|
+
class?: string;
|
|
18
|
+
children?: BuilderElement[];
|
|
19
|
+
responsiveStyles?: {
|
|
20
|
+
large?: Partial<CSSStyleDeclaration>;
|
|
21
|
+
medium?: Partial<CSSStyleDeclaration>;
|
|
22
|
+
small?: Partial<CSSStyleDeclaration>;
|
|
23
|
+
/** @deprecated */
|
|
24
|
+
xsmall?: Partial<CSSStyleDeclaration>;
|
|
25
|
+
};
|
|
26
|
+
component?: {
|
|
27
|
+
name: string;
|
|
28
|
+
options?: any;
|
|
29
|
+
tag?: string;
|
|
30
|
+
};
|
|
31
|
+
bindings?: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
meta?: {
|
|
35
|
+
[key: string]: JSONValue;
|
|
36
|
+
};
|
|
37
|
+
actions?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
};
|
|
40
|
+
properties?: {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
};
|
|
43
|
+
code?: {
|
|
44
|
+
bindings?: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
actions?: {
|
|
48
|
+
[key: string]: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
repeat?: {
|
|
52
|
+
collection: string;
|
|
53
|
+
itemName?: string;
|
|
54
|
+
} | null;
|
|
55
|
+
animations?: Animation[];
|
|
56
|
+
}
|
|
57
|
+
interface Animation {
|
|
58
|
+
}
|
|
59
|
+
export {};
|