@builder.io/sdk-qwik 0.3.1 → 0.4.0
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 +910 -594
- package/lib/index.qwik.mjs +911 -595
- package/package.json +1 -1
- package/types/components/render-content/render-content.types.d.ts +11 -2
- package/types/components/render-content/wrap-component-ref.d.ts +6 -0
- package/types/components/render-content-variants/helpers.d.ts +5 -0
- package/types/components/render-inlined-styles.d.ts +1 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-content/index.d.ts +7 -2
- package/types/functions/get-content/types.d.ts +6 -0
- package/types/helpers/ab-tests.d.ts +8 -7
- package/types/helpers/cookie.d.ts +7 -3
- package/types/helpers/logger.d.ts +1 -0
- package/types/index-helpers/blocks-exports.d.ts +1 -1
- package/types/index.d.ts +8 -7
- package/types/scripts/init-editing.d.ts +1 -0
- package/types/types/builder-content.d.ts +1 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import type { BuilderRenderContext, RegisteredComponent, BuilderRenderState } fr
|
|
|
2
2
|
import type { BuilderContent } from '../../types/builder-content';
|
|
3
3
|
import type { Nullable } from '../../types/typescript';
|
|
4
4
|
import type { ApiVersion } from '../../types/api-version';
|
|
5
|
-
export
|
|
5
|
+
export interface RenderContentProps {
|
|
6
6
|
content?: Nullable<BuilderContent>;
|
|
7
7
|
model?: string;
|
|
8
8
|
data?: {
|
|
@@ -14,8 +14,17 @@ export type RenderContentProps = {
|
|
|
14
14
|
customComponents?: RegisteredComponent[];
|
|
15
15
|
canTrack?: boolean;
|
|
16
16
|
locale?: string;
|
|
17
|
+
/** @deprecated use `enrich` instead **/
|
|
17
18
|
includeRefs?: boolean;
|
|
18
|
-
|
|
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
|
+
}
|
|
19
28
|
export interface BuilderComponentStateChange {
|
|
20
29
|
state: BuilderRenderState;
|
|
21
30
|
ref: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from '../../helpers/nullable';
|
|
2
2
|
import type { BuilderContent } from '../../types/builder-content';
|
|
3
|
+
export declare const getVariants: (content: Nullable<BuilderContent>) => import("../../types/builder-content").BuilderContentVariation[];
|
|
3
4
|
export declare const checkShouldRunVariants: ({ canTrack, content, }: {
|
|
4
5
|
canTrack: Nullable<boolean>;
|
|
5
6
|
content: Nullable<BuilderContent>;
|
|
@@ -9,4 +10,8 @@ type VariantData = {
|
|
|
9
10
|
testRatio?: number;
|
|
10
11
|
};
|
|
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;
|
|
12
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.0";
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
2
2
|
import type { GetContentOptions } from './types.js';
|
|
3
3
|
export declare function getContent(options: GetContentOptions): Promise<BuilderContent | null>;
|
|
4
|
-
type
|
|
4
|
+
type ContentResults = {
|
|
5
5
|
results: BuilderContent[];
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
type ContentResponse = ContentResults | {
|
|
7
8
|
status: number;
|
|
8
9
|
message: string;
|
|
9
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>;
|
|
10
15
|
export declare function getAllContent(options: GetContentOptions): Promise<ContentResponse | null>;
|
|
11
16
|
export {};
|
|
@@ -19,6 +19,7 @@ export interface GetContentOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* If set to `true`, it will lazy load symbols/references.
|
|
21
21
|
* If set to `false`, it will render the entire content tree eagerly.
|
|
22
|
+
* @deprecated use `enrich` instead
|
|
22
23
|
*/
|
|
23
24
|
noTraverse?: boolean;
|
|
24
25
|
/**
|
|
@@ -30,8 +31,13 @@ export interface GetContentOptions {
|
|
|
30
31
|
canTrack?: boolean;
|
|
31
32
|
/**
|
|
32
33
|
* Include references in the response. Defaults to `true`.
|
|
34
|
+
* @deprecated use `enrich` instead
|
|
33
35
|
*/
|
|
34
36
|
includeRefs?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Include multilevel references in the response.
|
|
39
|
+
*/
|
|
40
|
+
enrich?: boolean;
|
|
35
41
|
/**
|
|
36
42
|
* If provided, the API will auto-resolve localized objects to the value of this `locale` key.
|
|
37
43
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CanTrack } from '../types/can-track.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
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;
|
|
2
6
|
/**
|
|
3
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.
|
|
4
9
|
*/
|
|
5
|
-
export declare const getCookie: (
|
|
6
|
-
name: string;
|
|
7
|
-
} & CanTrack) => Promise<string | undefined>;
|
|
10
|
+
export declare const getCookie: (args: GetCookieArgs) => Promise<string | undefined>;
|
|
8
11
|
/**
|
|
9
12
|
* NOTE: This function is `async` because its react-native override is async. Do not remove the `async` keyword!
|
|
10
13
|
*/
|
|
@@ -13,3 +16,4 @@ export declare const setCookie: ({ name, value, expires, canTrack, }: {
|
|
|
13
16
|
value: string;
|
|
14
17
|
expires?: Date | undefined;
|
|
15
18
|
} & CanTrack) => Promise<void>;
|
|
19
|
+
export {};
|
|
@@ -3,8 +3,8 @@ export { default as Columns } from '../blocks/columns/columns';
|
|
|
3
3
|
export { default as Fragment } from '../blocks/fragment/fragment';
|
|
4
4
|
export { default as Image } from '../blocks/image/image';
|
|
5
5
|
export { default as RenderBlocks } from '../components/render-blocks';
|
|
6
|
-
export { default as RenderContent } from '../components/render-content/render-content';
|
|
7
6
|
export { default as Section } from '../blocks/section/section';
|
|
8
7
|
export { default as Symbol } from '../blocks/symbol/symbol';
|
|
9
8
|
export { default as Text } from '../blocks/text/text';
|
|
10
9
|
export { default as Video } from '../blocks/video/video';
|
|
10
|
+
export { default as RenderContent } from '../components/render-content-variants/render-content-variants';
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
2
|
export * from './index-helpers/blocks-exports.js';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
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';
|
|
10
11
|
export { track } from './functions/track/index.js';
|
|
11
12
|
export type { RegisteredComponent } from './context/types';
|
|
12
13
|
export type { ComponentInfo } from './types/components';
|
|
@@ -30,8 +30,6 @@ export interface BuilderContentVariation {
|
|
|
30
30
|
}
|
|
31
31
|
export interface BuilderContent extends BuilderContentVariation {
|
|
32
32
|
'@version'?: number;
|
|
33
|
-
id?: string;
|
|
34
|
-
name?: string;
|
|
35
33
|
published?: 'published' | 'draft' | 'archived';
|
|
36
34
|
modelId?: string;
|
|
37
35
|
priority?: number;
|
|
@@ -39,7 +37,7 @@ export interface BuilderContent extends BuilderContentVariation {
|
|
|
39
37
|
startDate?: number;
|
|
40
38
|
endDate?: number;
|
|
41
39
|
variations?: {
|
|
42
|
-
[id: string]: BuilderContentVariation
|
|
40
|
+
[id: string]: BuilderContentVariation;
|
|
43
41
|
};
|
|
44
42
|
testVariationId?: string;
|
|
45
43
|
testVariationName?: string;
|