@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -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 type RenderContentProps = {
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: {
@@ -0,0 +1,6 @@
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,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,5 +1,6 @@
1
1
  interface Props {
2
2
  styles: string;
3
+ id?: string;
3
4
  }
4
5
  export declare const RenderInlinedStyles: import("@builder.io/qwik").Component<Props>;
5
6
  export default RenderInlinedStyles;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.3.1";
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 ContentResponse = {
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
- export declare const getContentVariationCookie: ({ contentId, canTrack, }: {
3
- contentId: string;
4
- } & CanTrack) => Promise<string | undefined>;
5
- export declare const setContentVariationCookie: ({ contentId, canTrack, value, }: {
6
- contentId: string;
7
- value: string;
8
- } & CanTrack) => Promise<void>;
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: ({ name, canTrack, }: {
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 {};
@@ -2,4 +2,5 @@ export declare const logger: {
2
2
  log: (...message: any[]) => void;
3
3
  error: (...message: any[]) => void;
4
4
  warn: (...message: any[]) => void;
5
+ debug: (...message: any[]) => void;
5
6
  };
@@ -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 * from './functions/is-editing.js';
4
- export * from './functions/is-previewing.js';
5
- export * from './functions/register-component.js';
6
- export * from './functions/register.js';
7
- export * from './functions/set-editor-settings.js';
8
- export * from './functions/get-content/index.js';
9
- export * from './functions/get-builder-search-params/index.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';
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';
@@ -1,5 +1,6 @@
1
1
  export declare const registerInsertMenu: () => void;
2
2
  export declare const setupBrowserForEditing: (options?: {
3
+ enrich?: boolean;
3
4
  includeRefs?: boolean;
4
5
  locale?: string;
5
6
  }) => void;
@@ -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 | undefined;
40
+ [id: string]: BuilderContentVariation;
43
41
  };
44
42
  testVariationId?: string;
45
43
  testVariationName?: string;