@builder.io/sdk-svelte 0.11.2 → 0.11.4
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/browser/blocks/button/button.svelte +0 -5
- package/lib/browser/blocks/button/button.svelte.d.ts +20 -0
- package/lib/browser/blocks/button/button.types.d.ts +6 -0
- package/lib/browser/blocks/button/button.types.js +1 -0
- package/lib/browser/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/browser/blocks/columns/columns.types.d.ts +15 -0
- package/lib/browser/blocks/columns/columns.types.js +1 -0
- package/lib/browser/blocks/fragment/fragment.svelte +0 -2
- package/lib/browser/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/browser/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/browser/blocks/fragment/fragment.types.js +1 -0
- package/lib/browser/blocks/image/image.svelte +0 -2
- package/lib/browser/blocks/image/image.svelte.d.ts +30 -0
- package/lib/browser/blocks/image/image.types.d.ts +19 -0
- package/lib/browser/blocks/image/image.types.js +1 -0
- package/lib/browser/blocks/section/section.svelte +0 -5
- package/lib/browser/blocks/section/section.svelte.d.ts +20 -0
- package/lib/browser/blocks/section/section.types.d.ts +6 -0
- package/lib/browser/blocks/section/section.types.js +1 -0
- package/lib/browser/blocks/symbol/symbol.svelte +0 -5
- package/lib/browser/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/browser/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/browser/blocks/symbol/symbol.types.js +1 -0
- package/lib/browser/blocks/text/text.svelte +0 -2
- package/lib/browser/blocks/text/text.svelte.d.ts +17 -0
- package/lib/browser/blocks/text/text.types.d.ts +3 -0
- package/lib/browser/blocks/text/text.types.js +1 -0
- package/lib/browser/blocks/video/video.svelte +0 -2
- package/lib/browser/blocks/video/video.svelte.d.ts +33 -0
- package/lib/browser/blocks/video/video.types.d.ts +21 -0
- package/lib/browser/blocks/video/video.types.js +1 -0
- package/lib/browser/components/block/block.svelte +3 -5
- package/lib/browser/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/browser/components/blocks/blocks.svelte +1 -10
- package/lib/browser/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/browser/components/blocks/blocks.types.d.ts +8 -0
- package/lib/browser/components/blocks/blocks.types.js +1 -0
- package/lib/browser/components/content/components/enable-editor.svelte +28 -0
- package/lib/browser/components/content/components/enable-editor.svelte.d.ts +2 -1
- package/lib/browser/components/content/content.helpers.d.ts +1 -1
- package/lib/browser/components/content/content.helpers.js +1 -1
- package/lib/browser/components/content/content.svelte +3 -2
- package/lib/browser/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/get-content/index.d.ts +1 -1
- package/lib/browser/functions/get-content/index.js +1 -1
- package/lib/browser/functions/get-content/types.d.ts +2 -2
- package/lib/browser/server-index.d.ts +10 -1
- package/lib/edge/blocks/button/button.svelte +0 -5
- package/lib/edge/blocks/button/button.svelte.d.ts +20 -0
- package/lib/edge/blocks/button/button.types.d.ts +6 -0
- package/lib/edge/blocks/button/button.types.js +1 -0
- package/lib/edge/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/edge/blocks/columns/columns.types.d.ts +15 -0
- package/lib/edge/blocks/columns/columns.types.js +1 -0
- package/lib/edge/blocks/fragment/fragment.svelte +0 -2
- package/lib/edge/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/edge/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/edge/blocks/fragment/fragment.types.js +1 -0
- package/lib/edge/blocks/image/image.svelte +0 -2
- package/lib/edge/blocks/image/image.svelte.d.ts +30 -0
- package/lib/edge/blocks/image/image.types.d.ts +19 -0
- package/lib/edge/blocks/image/image.types.js +1 -0
- package/lib/edge/blocks/section/section.svelte +0 -5
- package/lib/edge/blocks/section/section.svelte.d.ts +20 -0
- package/lib/edge/blocks/section/section.types.d.ts +6 -0
- package/lib/edge/blocks/section/section.types.js +1 -0
- package/lib/edge/blocks/symbol/symbol.svelte +0 -5
- package/lib/edge/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/edge/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/edge/blocks/symbol/symbol.types.js +1 -0
- package/lib/edge/blocks/text/text.svelte +0 -2
- package/lib/edge/blocks/text/text.svelte.d.ts +17 -0
- package/lib/edge/blocks/text/text.types.d.ts +3 -0
- package/lib/edge/blocks/text/text.types.js +1 -0
- package/lib/edge/blocks/video/video.svelte +0 -2
- package/lib/edge/blocks/video/video.svelte.d.ts +33 -0
- package/lib/edge/blocks/video/video.types.d.ts +21 -0
- package/lib/edge/blocks/video/video.types.js +1 -0
- package/lib/edge/components/block/block.svelte +3 -5
- package/lib/edge/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/edge/components/blocks/blocks.svelte +1 -10
- package/lib/edge/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/edge/components/blocks/blocks.types.d.ts +8 -0
- package/lib/edge/components/blocks/blocks.types.js +1 -0
- package/lib/edge/components/content/components/enable-editor.svelte +28 -0
- package/lib/edge/components/content/components/enable-editor.svelte.d.ts +2 -1
- package/lib/edge/components/content/content.helpers.d.ts +1 -1
- package/lib/edge/components/content/content.helpers.js +1 -1
- package/lib/edge/components/content/content.svelte +3 -2
- package/lib/edge/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/get-content/index.d.ts +1 -1
- package/lib/edge/functions/get-content/index.js +1 -1
- package/lib/edge/functions/get-content/types.d.ts +2 -2
- package/lib/edge/server-index.d.ts +10 -1
- package/lib/node/blocks/button/button.svelte +0 -5
- package/lib/node/blocks/button/button.svelte.d.ts +20 -0
- package/lib/node/blocks/button/button.types.d.ts +6 -0
- package/lib/node/blocks/button/button.types.js +1 -0
- package/lib/node/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/node/blocks/columns/columns.types.d.ts +15 -0
- package/lib/node/blocks/columns/columns.types.js +1 -0
- package/lib/node/blocks/fragment/fragment.svelte +0 -2
- package/lib/node/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/node/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/node/blocks/fragment/fragment.types.js +1 -0
- package/lib/node/blocks/image/image.svelte +0 -2
- package/lib/node/blocks/image/image.svelte.d.ts +30 -0
- package/lib/node/blocks/image/image.types.d.ts +19 -0
- package/lib/node/blocks/image/image.types.js +1 -0
- package/lib/node/blocks/section/section.svelte +0 -5
- package/lib/node/blocks/section/section.svelte.d.ts +20 -0
- package/lib/node/blocks/section/section.types.d.ts +6 -0
- package/lib/node/blocks/section/section.types.js +1 -0
- package/lib/node/blocks/symbol/symbol.svelte +0 -5
- package/lib/node/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/node/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/node/blocks/symbol/symbol.types.js +1 -0
- package/lib/node/blocks/text/text.svelte +0 -2
- package/lib/node/blocks/text/text.svelte.d.ts +17 -0
- package/lib/node/blocks/text/text.types.d.ts +3 -0
- package/lib/node/blocks/text/text.types.js +1 -0
- package/lib/node/blocks/video/video.svelte +0 -2
- package/lib/node/blocks/video/video.svelte.d.ts +33 -0
- package/lib/node/blocks/video/video.types.d.ts +21 -0
- package/lib/node/blocks/video/video.types.js +1 -0
- package/lib/node/components/block/block.svelte +3 -5
- package/lib/node/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/node/components/blocks/blocks.svelte +1 -10
- package/lib/node/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/node/components/blocks/blocks.types.d.ts +8 -0
- package/lib/node/components/blocks/blocks.types.js +1 -0
- package/lib/node/components/content/components/enable-editor.svelte +28 -0
- package/lib/node/components/content/components/enable-editor.svelte.d.ts +2 -1
- package/lib/node/components/content/content.helpers.d.ts +1 -1
- package/lib/node/components/content/content.helpers.js +1 -1
- package/lib/node/components/content/content.svelte +3 -2
- package/lib/node/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/get-content/index.d.ts +1 -1
- package/lib/node/functions/get-content/index.js +1 -1
- package/lib/node/functions/get-content/types.d.ts +2 -2
- package/lib/node/server-index.d.ts +10 -1
- package/package.json +1 -1
- package/src/blocks/button/button.svelte +1 -13
- package/src/blocks/button/button.types.ts +6 -0
- package/src/blocks/columns/columns.svelte +2 -20
- package/src/blocks/columns/columns.types.ts +14 -0
- package/src/blocks/fragment/fragment.svelte +1 -8
- package/src/blocks/fragment/fragment.types.ts +5 -0
- package/src/blocks/image/image.svelte +1 -22
- package/src/blocks/image/image.types.ts +19 -0
- package/src/blocks/section/section.svelte +1 -13
- package/src/blocks/section/section.types.ts +6 -0
- package/src/blocks/symbol/symbol.svelte +2 -31
- package/src/blocks/symbol/symbol.types.ts +17 -0
- package/src/blocks/text/text.svelte +2 -6
- package/src/blocks/text/text.types.ts +3 -0
- package/src/blocks/video/video.svelte +1 -33
- package/src/blocks/video/video.types.ts +21 -0
- package/src/components/block/block.svelte +3 -5
- package/src/components/block/components/component-ref/component-ref.svelte +1 -6
- package/src/components/blocks/blocks.svelte +2 -23
- package/src/components/blocks/blocks.types.ts +7 -0
- package/src/components/content/components/enable-editor.svelte +29 -1
- package/src/components/content/content.helpers.ts +1 -1
- package/src/components/content/content.svelte +3 -2
- package/src/components/content-variants/content-variants.types.ts +43 -1
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/get-content/index.ts +1 -1
- package/src/functions/get-content/types.ts +2 -2
- package/src/server-index.ts +10 -1
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
</script>
|
|
113
113
|
|
|
114
114
|
{#if canShowBlock()}
|
|
115
|
+
<BlockStyles {block} context={$context} />
|
|
116
|
+
|
|
115
117
|
{#if !blockComponent?.()?.noWrap}
|
|
116
118
|
{#if isEmptyHtmlElement(Tag())}
|
|
117
119
|
<BlockWrapper
|
|
@@ -150,17 +152,13 @@
|
|
|
150
152
|
isInteractive={componentRefProps().isInteractive}
|
|
151
153
|
/>
|
|
152
154
|
|
|
153
|
-
{#each childrenWithoutParentComponent() as child (
|
|
155
|
+
{#each childrenWithoutParentComponent() as child (child.id)}
|
|
154
156
|
<svelte:self
|
|
155
157
|
block={child}
|
|
156
158
|
context={childrenContext}
|
|
157
159
|
{registeredComponents}
|
|
158
160
|
/>
|
|
159
161
|
{/each}
|
|
160
|
-
|
|
161
|
-
{#each childrenWithoutParentComponent() as child ("block-style-" + child.id)}
|
|
162
|
-
<BlockStyles block={child} context={$childrenContext} />
|
|
163
|
-
{/each}
|
|
164
162
|
</BlockWrapper>
|
|
165
163
|
{/if}
|
|
166
164
|
{:else}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { wrapComponentRef } from "../../../content/wrap-component-ref.js";
|
|
3
3
|
import Block from "../../block.svelte";
|
|
4
|
-
import BlockStyles from "../block-styles.svelte";
|
|
5
4
|
import InteractiveElement from "../interactive-element.svelte";
|
|
6
5
|
import type { ComponentProps } from "./component-ref.helpers.js";
|
|
7
6
|
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
@@ -31,12 +30,8 @@
|
|
|
31
30
|
contextValue: $context,
|
|
32
31
|
})}
|
|
33
32
|
>
|
|
34
|
-
{#each blockChildren as child (
|
|
33
|
+
{#each blockChildren as child (child.id)}
|
|
35
34
|
<Block block={child} {context} {registeredComponents} />
|
|
36
35
|
{/each}
|
|
37
|
-
|
|
38
|
-
{#each blockChildren as child ("block-style-" + child.id)}
|
|
39
|
-
<BlockStyles block={child} context={$context} />
|
|
40
|
-
{/each}
|
|
41
36
|
</svelte:component>
|
|
42
37
|
{/if}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export type BlocksProps = Partial<
|
|
3
|
-
Omit<BlocksWrapperProps, "BlocksWrapper" | "BlocksWrapperProps">
|
|
4
|
-
> & {
|
|
5
|
-
context?: Writable<BuilderContextInterface>;
|
|
6
|
-
registeredComponents?: RegisteredComponents;
|
|
7
|
-
};
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
1
|
<script lang="ts">
|
|
11
2
|
import { getContext } from "svelte";
|
|
12
3
|
|
|
13
4
|
import BuilderContext from "../../context/builder.context.js";
|
|
14
5
|
import ComponentsContext from "../../context/components.context.js";
|
|
15
|
-
import type {
|
|
16
|
-
BuilderContextInterface,
|
|
17
|
-
RegisteredComponents,
|
|
18
|
-
} from "../../context/types.js";
|
|
19
6
|
import Block from "../block/block.svelte";
|
|
20
|
-
import BlockStyles from "../block/components/block-styles.svelte";
|
|
21
|
-
import type { BlocksWrapperProps } from "./blocks-wrapper.svelte";
|
|
22
7
|
import BlocksWrapper from "./blocks-wrapper.svelte";
|
|
23
|
-
import type {
|
|
8
|
+
import type { BlocksProps } from "./blocks.types.js";
|
|
24
9
|
|
|
25
10
|
export let blocks: BlocksProps["blocks"];
|
|
26
11
|
export let parent: BlocksProps["parent"];
|
|
@@ -43,7 +28,7 @@
|
|
|
43
28
|
BlocksWrapperProps={$context?.BlocksWrapperProps}
|
|
44
29
|
>
|
|
45
30
|
{#if blocks}
|
|
46
|
-
{#each blocks as block (
|
|
31
|
+
{#each blocks as block (block.id)}
|
|
47
32
|
<Block
|
|
48
33
|
{block}
|
|
49
34
|
context={context || builderContext}
|
|
@@ -52,10 +37,4 @@
|
|
|
52
37
|
/>
|
|
53
38
|
{/each}
|
|
54
39
|
{/if}
|
|
55
|
-
|
|
56
|
-
{#if blocks}
|
|
57
|
-
{#each blocks as block ("block-style-" + block.id)}
|
|
58
|
-
<BlockStyles {block} context={$context || $builderContext} />
|
|
59
|
-
{/each}
|
|
60
|
-
{/if}
|
|
61
40
|
</BlocksWrapper>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Writable } from "svelte/store";
|
|
2
|
+
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types.js';
|
|
3
|
+
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
4
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
5
|
+
context?: Writable<BuilderContextInterface>;
|
|
6
|
+
registeredComponents?: RegisteredComponents;
|
|
7
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
type BuilderEditorProps = Omit<
|
|
3
3
|
ContentProps,
|
|
4
4
|
| "customComponents"
|
|
5
|
-
| "data"
|
|
6
5
|
| "apiVersion"
|
|
7
6
|
| "isSsrAbTest"
|
|
8
7
|
| "blocksWrapper"
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
} from "../../../scripts/init-editing.js";
|
|
39
38
|
import type { BuilderContent } from "../../../types/builder-content.js";
|
|
40
39
|
import type { ComponentInfo } from "../../../types/components.js";
|
|
40
|
+
import type { Dictionary } from "../../../types/typescript.js";
|
|
41
41
|
import type {
|
|
42
42
|
BuilderComponentStateChange,
|
|
43
43
|
ContentProps,
|
|
@@ -58,6 +58,19 @@
|
|
|
58
58
|
export let contentWrapperProps: BuilderEditorProps["contentWrapperProps"] =
|
|
59
59
|
undefined;
|
|
60
60
|
|
|
61
|
+
export let data: BuilderEditorProps["data"] = undefined;
|
|
62
|
+
|
|
63
|
+
function mergeNewRootState(newData: Dictionary<any>) {
|
|
64
|
+
const combinedState = {
|
|
65
|
+
...$builderContextSignal.rootState,
|
|
66
|
+
...newData,
|
|
67
|
+
};
|
|
68
|
+
if ($builderContextSignal.rootSetState) {
|
|
69
|
+
$builderContextSignal.rootSetState?.(combinedState);
|
|
70
|
+
} else {
|
|
71
|
+
$builderContextSignal.rootState = combinedState;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
function mergeNewContent(newContent: BuilderContent) {
|
|
62
75
|
const newContentValue = {
|
|
63
76
|
...$builderContextSignal.content,
|
|
@@ -271,6 +284,7 @@
|
|
|
271
284
|
let elementRef;
|
|
272
285
|
|
|
273
286
|
let forceReRenderCount = 0;
|
|
287
|
+
let firstRender = true;
|
|
274
288
|
let lastUpdated = 0;
|
|
275
289
|
let shouldSendResetCookie = false;
|
|
276
290
|
let ContentWrapper = contentWrapper || "div";
|
|
@@ -339,6 +353,20 @@
|
|
|
339
353
|
emitStateUpdate();
|
|
340
354
|
}
|
|
341
355
|
$: onUpdateFn_4(...[$builderContextSignal.rootState]);
|
|
356
|
+
function onUpdateFn_5(..._args: any[]) {
|
|
357
|
+
if (data) {
|
|
358
|
+
mergeNewRootState(data);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
$: onUpdateFn_5(...[data]);
|
|
362
|
+
function onUpdateFn_6(..._args: any[]) {
|
|
363
|
+
if (locale) {
|
|
364
|
+
mergeNewRootState({
|
|
365
|
+
locale: locale,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
$: onUpdateFn_6(...[locale]);
|
|
342
370
|
|
|
343
371
|
setContext(builderContext.key, builderContextSignal);
|
|
344
372
|
|
|
@@ -2,7 +2,7 @@ import type { BuilderRenderState } from '../../context/types.js';
|
|
|
2
2
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
3
3
|
import type { Nullable } from '../../types/typescript.js';
|
|
4
4
|
import type { ContentProps } from './content.types.js';
|
|
5
|
-
export const
|
|
5
|
+
export const getRootStateInitialValue = ({
|
|
6
6
|
content,
|
|
7
7
|
data,
|
|
8
8
|
locale
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import ContentStyles from "./components/styles.svelte";
|
|
24
24
|
import {
|
|
25
25
|
getContentInitialValue,
|
|
26
|
-
|
|
26
|
+
getRootStateInitialValue,
|
|
27
27
|
} from "./content.helpers.js";
|
|
28
28
|
import type { ContentProps } from "./content.types.js";
|
|
29
29
|
import { wrapComponentRef } from "./wrap-component-ref.js";
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
data: data,
|
|
83
83
|
}),
|
|
84
84
|
localState: undefined,
|
|
85
|
-
rootState:
|
|
85
|
+
rootState: getRootStateInitialValue({
|
|
86
86
|
content: content,
|
|
87
87
|
data: data,
|
|
88
88
|
locale: locale,
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
|
|
120
120
|
<EnableEditor
|
|
121
121
|
{content}
|
|
122
|
+
{data}
|
|
122
123
|
{model}
|
|
123
124
|
{context}
|
|
124
125
|
{apiKey}
|
|
@@ -3,32 +3,74 @@ import type { ApiVersion } from '../../types/api-version.js';
|
|
|
3
3
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
4
4
|
import type { Nullable } from '../../types/typescript.js';
|
|
5
5
|
export interface ContentVariantsPrps {
|
|
6
|
+
/**
|
|
7
|
+
* The Builder content JSON to render (required).
|
|
8
|
+
*/
|
|
6
9
|
content?: Nullable<BuilderContent>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Builder content `model` to render (required).
|
|
13
|
+
*/
|
|
7
14
|
model?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Additional data to inject into your Builder content (optional).
|
|
18
|
+
*/
|
|
8
19
|
data?: {
|
|
9
20
|
[key: string]: any;
|
|
10
21
|
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
11
26
|
context?: BuilderRenderContext;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Your API Key: needed to dynamically fetch symbols (required).
|
|
30
|
+
*/
|
|
12
31
|
apiKey: string;
|
|
13
32
|
apiVersion?: ApiVersion;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* An array of custom components to register (optional).
|
|
36
|
+
*/
|
|
14
37
|
customComponents?: RegisteredComponent[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A boolean to enable or disable tracking (optional). Defaults to `true`.
|
|
41
|
+
*/
|
|
15
42
|
canTrack?: boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* If provided, the API will auto-resolve localized objects to the value of this `locale` key (optional).
|
|
46
|
+
*/
|
|
16
47
|
locale?: string;
|
|
17
|
-
|
|
48
|
+
|
|
49
|
+
/** @deprecated use `enrich` instead */
|
|
18
50
|
includeRefs?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A boolean to enable or disable enriching API content (optional).
|
|
54
|
+
*
|
|
55
|
+
* Enriching will Include multilevel references in the response. Defaults to `false`.
|
|
56
|
+
*/
|
|
19
57
|
enrich?: boolean;
|
|
58
|
+
|
|
20
59
|
/**
|
|
21
60
|
* The element that wraps your content. Defaults to `div` ('ScrollView' in React Native).
|
|
22
61
|
*/
|
|
23
62
|
contentWrapper?: any;
|
|
63
|
+
|
|
24
64
|
/**
|
|
25
65
|
* Additonal props to pass to `contentWrapper`. Defaults to `{}`.
|
|
26
66
|
*/
|
|
27
67
|
contentWrapperProps?: any;
|
|
68
|
+
|
|
28
69
|
/**
|
|
29
70
|
* The element that wraps your blocks. Defaults to `div` ('ScrollView' in React Native).
|
|
30
71
|
*/
|
|
31
72
|
blocksWrapper?: any;
|
|
73
|
+
|
|
32
74
|
/**
|
|
33
75
|
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
34
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.11.
|
|
1
|
+
export const SDK_VERSION = "0.11.4"
|
|
@@ -11,7 +11,7 @@ import type { GetContentOptions } from './types.js';
|
|
|
11
11
|
const checkContentHasResults = (content: ContentResponse): content is ContentResults => 'results' in content;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Returns
|
|
14
|
+
* Returns the first content entry that matches the given options.
|
|
15
15
|
*/
|
|
16
16
|
export async function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null> {
|
|
17
17
|
const allContent = await fetchEntries({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface GetContentOptions {
|
|
2
|
-
/** The model to get content for */
|
|
2
|
+
/** The model to get content for (required) */
|
|
3
3
|
model: string;
|
|
4
4
|
|
|
5
|
-
/** Your public API key */
|
|
5
|
+
/** Your public API key (required) */
|
|
6
6
|
apiKey: string;
|
|
7
7
|
|
|
8
8
|
/** Number of items to fetch. Default is 1 */
|
package/src/server-index.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
export type { ButtonProps } from './blocks/button/button.types.js';
|
|
3
|
+
export type { ColumnProps } from './blocks/columns/columns.types.js';
|
|
4
|
+
export type { FragmentProps } from './blocks/fragment/fragment.types.js';
|
|
5
|
+
export type { ImageProps } from './blocks/image/image.types.js';
|
|
6
|
+
export type { SectionProps } from './blocks/section/section.types.js';
|
|
7
|
+
export type { SymbolProps } from './blocks/symbol/symbol.types.js';
|
|
8
|
+
export type { TextProps } from './blocks/text/text.types.js';
|
|
9
|
+
export type { VideoProps } from './blocks/video/video.types.js';
|
|
10
|
+
export type { BlocksProps } from './components/blocks/blocks.types.js';
|
|
11
|
+
export type { ContentVariantsPrps as ContentProps } from './components/content-variants/content-variants.types.js';
|
|
2
12
|
export { isEditing } from './functions/is-editing.js';
|
|
3
13
|
export { isPreviewing } from './functions/is-previewing.js';
|
|
4
14
|
export { createRegisterComponentMessage } from './functions/register-component.js';
|
|
@@ -9,7 +19,6 @@ export type { Settings } from './functions/set-editor-settings.js';
|
|
|
9
19
|
export { _processContentResult, fetchEntries, fetchOneEntry, getAllContent, getContent } from './functions/get-content/index.js';
|
|
10
20
|
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
11
21
|
export { track } from './functions/track/index.js';
|
|
12
|
-
export type { ContentProps } from './components/content/content.types.js';
|
|
13
22
|
export type { RegisteredComponent } from './context/types.js';
|
|
14
23
|
export type { ComponentInfo } from './types/components.js';
|
|
15
24
|
export { fetchBuilderProps } from './functions/fetch-builder-props.js'
|