@uniformdev/canvas 17.5.1-alpha.6 → 17.6.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/dist/chunk-62Q2UUAR.mjs +4 -0
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.js +41 -41
- package/dist/cli/cli.mjs +36 -36
- package/dist/{createEventBus-ae757f10.d.ts → createEventBus-e55b26b0.d.ts} +686 -686
- package/dist/index.d.ts +434 -426
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/chunk-3DNK2OLJ.mjs +0 -4
package/dist/index.d.ts
CHANGED
@@ -1,12 +1,207 @@
|
|
1
|
-
import { C as ComponentInstance, a as ComponentParameter, c as components, b as CompositionGetParameters, d as CompositionGetByNodePathParameters, D as DataResolutionOptionNegative, e as CompositionGetResponse, f as DataResolutionOptionPositive, g as DataResolutionParameters, h as CompositionResolvedGetResponse, i as CompositionGetValidResponses, j as DataResolutionOption, k as CompositionGetByNodeIdParameters, l as CompositionGetBySlugParameters, m as CompositionGetByIdParameters, n as CompositionPutParameters, o as CompositionDeleteParameters, p as ComponentDefinitionGetParameters, q as ComponentDefinitionPutParameters, r as ComponentDefinitionDeleteParameters, s as DataSourceGetParameters, t as DataSourcesGetParameters, u as DataSourcePutParameters, v as DataSourceDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, z as DataTypeDeleteParameters, R as RootComponentInstance, P as PreviewEventBus } from './createEventBus-ae757f10.js';
|
2
|
-
export { $ as CanvasDefinitions, ad as ChannelSubscription, M as ComponentDefinition, F as ComponentDefinitionAPIDeleteRequest, E as ComponentDefinitionAPIPutRequest, B as ComponentDefinitionAPIResponse, r as ComponentDefinitionDeleteParameters, p as ComponentDefinitionGetParameters, A as ComponentDefinitionGetResponse, G as ComponentDefinitionListAPIOptions, H as ComponentDefinitionParameter, L as ComponentDefinitionPermission, q as ComponentDefinitionPutParameters, K as ComponentDefinitionSlot, J as ComponentDefinitionSlugSettings, I as ComponentDefinitionVariant, C as ComponentInstance, a as ComponentParameter, U as CompositionAPIDeleteRequest, W as CompositionAPIOptions, T as CompositionAPIResponse, a6 as CompositionDataDiagnostic, o as CompositionDeleteParameters, m as CompositionGetByIdParameters, k as CompositionGetByNodeIdParameters, d as CompositionGetByNodePathParameters, l as CompositionGetBySlugParameters, S as CompositionGetListResponse, O as CompositionGetOrderBy, b as CompositionGetParameters, e as CompositionGetResponse, i as CompositionGetValidResponses, a0 as CompositionIssue, V as CompositionListAPIResponse, a1 as CompositionPatternIssue, n as CompositionPutParameters, h as CompositionResolvedGetResponse, Q as CompositionUIStatus, N as CreatingComponentDefinition, a2 as DataElementBindingIssue, X as DataElementConnectionDefinition, a5 as DataResolutionConfigIssue, j as DataResolutionOption, D as DataResolutionOptionNegative, f as DataResolutionOptionPositive, g as DataResolutionParameters, _ as DataResourceDefinition, Z as DataResourceDefinitions, a3 as DataResourceIssue, a4 as DataResourceVariableIssue, Y as DataResourceVariables, aa as DataSource, v as DataSourceDeleteParameters, s as DataSourceGetParameters, a7 as DataSourceGetResponse, ab as DataSourceInfo, u as DataSourcePutParameters, t as DataSourcesGetParameters, a8 as DataSourcesGetResponse, a9 as DataType, z as DataTypeDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, ac as DataVariableDefinition, P as PreviewEventBus, R as RootComponentInstance, ae as createEventBus } from './createEventBus-ae757f10.js';
|
3
|
-
import { Options } from 'p-throttle';
|
4
|
-
import { Options as Options$1 } from 'p-retry';
|
5
1
|
import { ApiClient, ClientOptions, ExceptProject, ApiClientError } from '@uniformdev/context/api';
|
6
2
|
export { ApiClientError } from '@uniformdev/context/api';
|
3
|
+
import { C as CompositionGetParameters, a as CompositionGetByNodePathParameters, D as DataResolutionOptionNegative, b as CompositionGetResponse, c as DataResolutionOptionPositive, d as DataResolutionParameters, e as CompositionResolvedGetResponse, f as CompositionGetValidResponses, g as DataResolutionOption, h as CompositionGetByNodeIdParameters, i as CompositionGetBySlugParameters, j as CompositionGetByIdParameters, k as CompositionPutParameters, l as CompositionDeleteParameters, m as ComponentDefinitionGetParameters, n as ComponentDefinitionPutParameters, o as ComponentDefinitionDeleteParameters, p as ComponentInstance, q as ComponentParameter, r as components, s as DataSourceGetParameters, t as DataSourcesGetParameters, u as DataSourcePutParameters, v as DataSourceDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, z as DataTypeDeleteParameters, R as RootComponentInstance, P as PreviewEventBus } from './createEventBus-e55b26b0.js';
|
4
|
+
export { a1 as CanvasDefinitions, A as ChannelSubscription, O as ComponentDefinition, H as ComponentDefinitionAPIDeleteRequest, G as ComponentDefinitionAPIPutRequest, F as ComponentDefinitionAPIResponse, o as ComponentDefinitionDeleteParameters, m as ComponentDefinitionGetParameters, E as ComponentDefinitionGetResponse, I as ComponentDefinitionListAPIOptions, J as ComponentDefinitionParameter, N as ComponentDefinitionPermission, n as ComponentDefinitionPutParameters, M as ComponentDefinitionSlot, L as ComponentDefinitionSlugSettings, K as ComponentDefinitionVariant, p as ComponentInstance, q as ComponentParameter, W as CompositionAPIDeleteRequest, Y as CompositionAPIOptions, V as CompositionAPIResponse, a8 as CompositionDataDiagnostic, l as CompositionDeleteParameters, j as CompositionGetByIdParameters, h as CompositionGetByNodeIdParameters, a as CompositionGetByNodePathParameters, i as CompositionGetBySlugParameters, U as CompositionGetListResponse, S as CompositionGetOrderBy, C as CompositionGetParameters, b as CompositionGetResponse, f as CompositionGetValidResponses, a2 as CompositionIssue, X as CompositionListAPIResponse, a3 as CompositionPatternIssue, k as CompositionPutParameters, e as CompositionResolvedGetResponse, T as CompositionUIStatus, Q as CreatingComponentDefinition, a4 as DataElementBindingIssue, Z as DataElementConnectionDefinition, a7 as DataResolutionConfigIssue, g as DataResolutionOption, D as DataResolutionOptionNegative, c as DataResolutionOptionPositive, d as DataResolutionParameters, a0 as DataResourceDefinition, $ as DataResourceDefinitions, a5 as DataResourceIssue, a6 as DataResourceVariableIssue, _ as DataResourceVariables, ac as DataSource, v as DataSourceDeleteParameters, s as DataSourceGetParameters, a9 as DataSourceGetResponse, ad as DataSourceInfo, u as DataSourcePutParameters, t as DataSourcesGetParameters, aa as DataSourcesGetResponse, ab as DataType, z as DataTypeDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, ae as DataVariableDefinition, P as PreviewEventBus, R as RootComponentInstance, B as createEventBus } from './createEventBus-e55b26b0.js';
|
5
|
+
import { Options as Options$1 } from 'p-retry';
|
6
|
+
import { Options } from 'p-throttle';
|
7
7
|
import { PersonalizedVariant, TestVariant } from '@uniformdev/context';
|
8
8
|
import 'pusher-js';
|
9
9
|
|
10
|
+
declare class CanvasClient extends ApiClient<ClientOptions> {
|
11
|
+
constructor(options: ClientOptions);
|
12
|
+
private canvasUrl;
|
13
|
+
/** Fetches lists of Canvas compositions, optionally by type */
|
14
|
+
getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'compositionId' | 'slug'>): Promise<{
|
15
|
+
compositions: {
|
16
|
+
state: number;
|
17
|
+
uiStatus?: "Draft" | "Modified" | "Published" | "Orphan" | undefined;
|
18
|
+
projectId: string;
|
19
|
+
created: string;
|
20
|
+
modified: string;
|
21
|
+
pattern: boolean;
|
22
|
+
composition: {
|
23
|
+
type: string;
|
24
|
+
parameters?: {
|
25
|
+
[key: string]: {
|
26
|
+
value: unknown;
|
27
|
+
type: string;
|
28
|
+
connectedData?: {
|
29
|
+
pointer: string;
|
30
|
+
syntax: "jptr";
|
31
|
+
required?: boolean | undefined;
|
32
|
+
} | undefined;
|
33
|
+
};
|
34
|
+
} | undefined;
|
35
|
+
variant?: string | undefined;
|
36
|
+
slots?: {
|
37
|
+
[key: string]: {
|
38
|
+
type: string;
|
39
|
+
parameters?: {
|
40
|
+
[key: string]: {
|
41
|
+
value: unknown;
|
42
|
+
type: string;
|
43
|
+
connectedData?: {
|
44
|
+
pointer: string;
|
45
|
+
syntax: "jptr";
|
46
|
+
required?: boolean | undefined;
|
47
|
+
} | undefined;
|
48
|
+
};
|
49
|
+
} | undefined;
|
50
|
+
variant?: string | undefined;
|
51
|
+
slots?: {
|
52
|
+
[key: string]: any[];
|
53
|
+
} | undefined;
|
54
|
+
_id?: string | undefined;
|
55
|
+
_pattern?: string | undefined;
|
56
|
+
_dataResources?: {
|
57
|
+
[key: string]: {
|
58
|
+
type: string;
|
59
|
+
isPatternParameter?: boolean | undefined;
|
60
|
+
variables?: {
|
61
|
+
[key: string]: string;
|
62
|
+
} | undefined;
|
63
|
+
};
|
64
|
+
} | undefined;
|
65
|
+
_patternDataResources?: {
|
66
|
+
[key: string]: {
|
67
|
+
type: string;
|
68
|
+
isPatternParameter?: boolean | undefined;
|
69
|
+
variables?: {
|
70
|
+
[key: string]: string;
|
71
|
+
} | undefined;
|
72
|
+
};
|
73
|
+
} | undefined;
|
74
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
75
|
+
}[];
|
76
|
+
} | undefined;
|
77
|
+
_id: string;
|
78
|
+
_slug?: string | null | undefined;
|
79
|
+
_name: string;
|
80
|
+
_dataResources?: {
|
81
|
+
[key: string]: {
|
82
|
+
type: string;
|
83
|
+
isPatternParameter?: boolean | undefined;
|
84
|
+
variables?: {
|
85
|
+
[key: string]: string;
|
86
|
+
} | undefined;
|
87
|
+
};
|
88
|
+
} | undefined;
|
89
|
+
};
|
90
|
+
}[];
|
91
|
+
totalCount?: number | undefined;
|
92
|
+
}>;
|
93
|
+
/** Fetches one composition by its project map node path */
|
94
|
+
unstable_getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
95
|
+
unstable_getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
96
|
+
unstable_getCompositionByNodePath<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByNodePathParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
97
|
+
/** Fetches one composition by its project map node ID */
|
98
|
+
unstable_getCompositionByNodeId(options: CompositionGetByNodeIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
99
|
+
unstable_getCompositionByNodeId(options: CompositionGetByNodeIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
100
|
+
unstable_getCompositionByNodeId<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByNodeIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
101
|
+
/** Fetches one composition by its slug */
|
102
|
+
getCompositionBySlug(options: CompositionGetBySlugParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
103
|
+
getCompositionBySlug(options: CompositionGetBySlugParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
104
|
+
getCompositionBySlug<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetBySlugParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
105
|
+
/** Fetches one composition by its ID */
|
106
|
+
getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
107
|
+
getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
108
|
+
getCompositionById<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
109
|
+
private getOneComposition;
|
110
|
+
/** Updates or creates a Canvas component definition */
|
111
|
+
updateComposition(body: Omit<CompositionPutParameters, 'projectId'>): Promise<void>;
|
112
|
+
/** Deletes a Canvas component definition */
|
113
|
+
removeComposition(body: Omit<CompositionDeleteParameters, 'projectId'>): Promise<void>;
|
114
|
+
/** Fetches all Canvas component definitions */
|
115
|
+
getComponentDefinitions(options?: Omit<ComponentDefinitionGetParameters, 'projectId'>): Promise<{
|
116
|
+
componentDefinitions: {
|
117
|
+
id: string;
|
118
|
+
name: string;
|
119
|
+
icon?: string | undefined;
|
120
|
+
titleParameter?: string | null | undefined;
|
121
|
+
canBeComposition?: boolean | undefined;
|
122
|
+
parameters?: {
|
123
|
+
id: string;
|
124
|
+
name: string;
|
125
|
+
helpText?: string | undefined;
|
126
|
+
type: string;
|
127
|
+
typeConfig?: unknown;
|
128
|
+
}[] | undefined;
|
129
|
+
useTeamPermissions?: boolean | undefined;
|
130
|
+
permissions?: {
|
131
|
+
roleId: string;
|
132
|
+
permission: "read" | "write" | "create" | "delete";
|
133
|
+
state: number;
|
134
|
+
}[] | undefined;
|
135
|
+
slots?: {
|
136
|
+
id: string;
|
137
|
+
name: string;
|
138
|
+
allowedComponents: string[];
|
139
|
+
inheritAllowedComponents: boolean;
|
140
|
+
minComponents?: number | undefined;
|
141
|
+
maxComponents?: number | undefined;
|
142
|
+
}[] | undefined;
|
143
|
+
slugSettings?: {
|
144
|
+
required?: "no" | "yes" | "disabled" | undefined;
|
145
|
+
unique?: "no" | "local" | "global" | undefined;
|
146
|
+
regularExpression?: string | undefined;
|
147
|
+
regularExpressionMessage?: string | undefined;
|
148
|
+
} | undefined;
|
149
|
+
defaults?: {
|
150
|
+
type: string;
|
151
|
+
parameters?: {
|
152
|
+
[key: string]: {
|
153
|
+
value: unknown;
|
154
|
+
type: string;
|
155
|
+
connectedData?: {
|
156
|
+
pointer: string;
|
157
|
+
syntax: "jptr";
|
158
|
+
required?: boolean | undefined;
|
159
|
+
} | undefined;
|
160
|
+
};
|
161
|
+
} | undefined;
|
162
|
+
variant?: string | undefined;
|
163
|
+
slots?: {
|
164
|
+
[key: string]: any[];
|
165
|
+
} | undefined;
|
166
|
+
_id?: string | undefined;
|
167
|
+
_pattern?: string | undefined;
|
168
|
+
_dataResources?: {
|
169
|
+
[key: string]: {
|
170
|
+
type: string;
|
171
|
+
isPatternParameter?: boolean | undefined;
|
172
|
+
variables?: {
|
173
|
+
[key: string]: string;
|
174
|
+
} | undefined;
|
175
|
+
};
|
176
|
+
} | undefined;
|
177
|
+
_patternDataResources?: {
|
178
|
+
[key: string]: {
|
179
|
+
type: string;
|
180
|
+
isPatternParameter?: boolean | undefined;
|
181
|
+
variables?: {
|
182
|
+
[key: string]: string;
|
183
|
+
} | undefined;
|
184
|
+
};
|
185
|
+
} | undefined;
|
186
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
187
|
+
} | null | undefined;
|
188
|
+
variants?: {
|
189
|
+
id: string;
|
190
|
+
name: string;
|
191
|
+
}[] | undefined;
|
192
|
+
created?: string | undefined;
|
193
|
+
updated?: string | undefined;
|
194
|
+
}[];
|
195
|
+
}>;
|
196
|
+
/** Updates or creates a Canvas component definition */
|
197
|
+
updateComponentDefinition(body: Omit<ComponentDefinitionPutParameters, 'projectId'>): Promise<void>;
|
198
|
+
/** Deletes a Canvas component definition */
|
199
|
+
removeComponentDefinition(body: Omit<ComponentDefinitionDeleteParameters, 'projectId'>): Promise<void>;
|
200
|
+
}
|
201
|
+
declare class UncachedCanvasClient extends CanvasClient {
|
202
|
+
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
203
|
+
}
|
204
|
+
|
10
205
|
declare type EnhancerContext = {
|
11
206
|
preview?: boolean;
|
12
207
|
};
|
@@ -90,64 +285,100 @@ declare type InvalidationPayload = schemas['InvalidationPayload'];
|
|
90
285
|
declare type InvalidationResult = schemas['InvalidationResult'];
|
91
286
|
declare type InvalidationInput = InvalidationResult['input'];
|
92
287
|
|
93
|
-
declare type ComponentLocationReference = {
|
94
|
-
component: ComponentInstance;
|
95
|
-
parentSlot?: string;
|
96
|
-
parentSlotIndex?: number;
|
97
|
-
};
|
98
|
-
declare type WalkComponentTreeActions<TContext> = {
|
99
|
-
/** Replaces the component being visited with a new object */
|
100
|
-
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
101
|
-
/** Removes the component being visited from the composition */
|
102
|
-
removeComponent: () => void;
|
103
|
-
/** Inserts a new component immediately after the current component in its parent slot */
|
104
|
-
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
105
|
-
/** Aborts visitation of components that are in child slots of the current component */
|
106
|
-
stopProcessingDescendants: () => void;
|
107
|
-
/**
|
108
|
-
* Set a new traversal context for descendants of this node.
|
109
|
-
* If this is not called, `context` will automatically pass through.
|
110
|
-
*/
|
111
|
-
setDescendantsContext: (context: TContext) => void;
|
112
|
-
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
113
|
-
};
|
114
|
-
/** Walks a composition's component tree, visiting each component instance depth-first, in order. */
|
115
|
-
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
116
|
-
/** Traversal context for this node */
|
117
|
-
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
118
|
-
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference>): string;
|
119
|
-
/** Returns the JSON pointer of a component based on its location */
|
120
|
-
declare function getComponentJsonPointer(ancestorsAndSelf: Array<ComponentLocationReference>, { withSlots }?: {
|
121
|
-
withSlots?: boolean | undefined;
|
122
|
-
}): string;
|
123
|
-
|
124
|
-
/** A single entry in a batch of queued enhancements. */
|
125
|
-
declare class BatchEntry<TArgs, TResult> {
|
126
|
-
private _resolve;
|
127
|
-
private _reject;
|
128
|
-
args: TArgs;
|
129
|
-
private _isCompleted;
|
130
|
-
constructor(_resolve: (result: TResult) => void, _reject: (reason: any) => void, args: TArgs);
|
131
|
-
/** Mark the batch entry as successfully completed. */
|
132
|
-
resolve(result: TResult): void;
|
133
|
-
/** Mark the batch entry as failed. */
|
134
|
-
reject(reason: any): void;
|
135
|
-
/** @return Whether the batch entry has been completed (resolved or rejected). */
|
136
|
-
get isCompleted(): boolean;
|
137
|
-
}
|
138
288
|
/**
|
139
|
-
*
|
140
|
-
* and once all enhancements have been queued handles them all in a batch.
|
141
|
-
* Note: this type is adaptable to both ComponentParameterEnhancer and ComponentEnhancer types.
|
289
|
+
* @deprecated
|
142
290
|
*/
|
143
|
-
declare
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
291
|
+
declare class DataSourceClient extends ApiClient {
|
292
|
+
constructor(options: ClientOptions);
|
293
|
+
/** Fetches all DataSources for a project */
|
294
|
+
get(options?: ExceptProject<DataSourceGetParameters>): Promise<{
|
295
|
+
result: {
|
296
|
+
id: string;
|
297
|
+
displayName: string;
|
298
|
+
connectorType: string;
|
299
|
+
baseUrl: string;
|
300
|
+
headers?: {
|
301
|
+
[key: string]: string;
|
302
|
+
} | {
|
303
|
+
key: string;
|
304
|
+
value: string;
|
305
|
+
}[] | undefined;
|
306
|
+
parameters?: {
|
307
|
+
[key: string]: string;
|
308
|
+
} | {
|
309
|
+
key: string;
|
310
|
+
value: string;
|
311
|
+
}[] | undefined;
|
312
|
+
variables?: {
|
313
|
+
[key: string]: {
|
314
|
+
displayName?: string | undefined;
|
315
|
+
helpText?: string | undefined;
|
316
|
+
type?: string | undefined;
|
317
|
+
default: string;
|
318
|
+
order?: number | undefined;
|
319
|
+
};
|
320
|
+
} | undefined;
|
321
|
+
custom?: {
|
322
|
+
[key: string]: unknown;
|
323
|
+
} | undefined;
|
324
|
+
};
|
325
|
+
}>;
|
326
|
+
/** Fetches all DataSources for a project */
|
327
|
+
getList(options?: ExceptProject<DataSourcesGetParameters>): Promise<{
|
328
|
+
results: {
|
329
|
+
id: string;
|
330
|
+
displayName: string;
|
331
|
+
connectorType: string;
|
332
|
+
baseUrl: string;
|
333
|
+
}[];
|
334
|
+
}>;
|
335
|
+
/** Updates or creates (based on id) a DataSource */
|
336
|
+
upsert(body: ExceptProject<DataSourcePutParameters>): Promise<void>;
|
337
|
+
/** Deletes a DataSource */
|
338
|
+
remove(body: ExceptProject<DataSourceDeleteParameters>): Promise<void>;
|
339
|
+
}
|
340
|
+
|
341
|
+
/**
|
342
|
+
* @deprecated
|
343
|
+
*/
|
344
|
+
declare class DataTypeClient extends ApiClient {
|
345
|
+
#private;
|
346
|
+
constructor(options: ClientOptions);
|
347
|
+
/** Fetches all DataTypes for a project */
|
348
|
+
get(options?: ExceptProject<DataTypeGetParameters>): Promise<DataTypeGetResponse>;
|
349
|
+
/** Updates or creates (based on id) a DataType */
|
350
|
+
upsert(body: ExceptProject<DataTypePutParameters>): Promise<void>;
|
351
|
+
/** Deletes a DataType */
|
352
|
+
remove(body: ExceptProject<DataTypeDeleteParameters>): Promise<void>;
|
353
|
+
}
|
354
|
+
|
355
|
+
/** A single entry in a batch of queued enhancements. */
|
356
|
+
declare class BatchEntry<TArgs, TResult> {
|
357
|
+
private _resolve;
|
358
|
+
private _reject;
|
359
|
+
args: TArgs;
|
360
|
+
private _isCompleted;
|
361
|
+
constructor(_resolve: (result: TResult) => void, _reject: (reason: any) => void, args: TArgs);
|
362
|
+
/** Mark the batch entry as successfully completed. */
|
363
|
+
resolve(result: TResult): void;
|
364
|
+
/** Mark the batch entry as failed. */
|
365
|
+
reject(reason: any): void;
|
366
|
+
/** @return Whether the batch entry has been completed (resolved or rejected). */
|
367
|
+
get isCompleted(): boolean;
|
368
|
+
}
|
369
|
+
/**
|
370
|
+
* An enhancer that queues up promises for each component that needs enhancing,
|
371
|
+
* and once all enhancements have been queued handles them all in a batch.
|
372
|
+
* Note: this type is adaptable to both ComponentParameterEnhancer and ComponentEnhancer types.
|
373
|
+
*/
|
374
|
+
declare type BatchEnhancer<TArgs, TResult> = {
|
375
|
+
/** Adds a promise to the enhancement queue. */
|
376
|
+
enhanceOne: (args: TArgs) => Promise<TResult | undefined>;
|
377
|
+
/** Calls the batch enhancer function for all queued promises and resolves them. Returns number of processed items. */
|
378
|
+
completeAll: () => Promise<number>;
|
379
|
+
limitPolicy?: LimitPolicy;
|
380
|
+
};
|
381
|
+
/**
|
151
382
|
* Creates an enhancer that batches up all enhancements for a composition into a set of promises,
|
152
383
|
* and then handles them all in a single batch. Used to reduce the number of HTTP requests
|
153
384
|
* needed to fulfill layout enhancements when a layout uses many resources from other systems.
|
@@ -161,21 +392,17 @@ declare function createBatchEnhancer<TArgs, TResult>({ handleBatch, shouldQueue,
|
|
161
392
|
}): BatchEnhancer<TArgs, TResult>;
|
162
393
|
|
163
394
|
/**
|
164
|
-
*
|
165
|
-
*
|
395
|
+
* Composes several enhancers into a synchronous chain. Can be used to modify the output of an enhancer.
|
396
|
+
* NOTE: only the first enhancer in the chain may use batching (completeAll()).
|
166
397
|
*/
|
167
|
-
declare
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
resolveKey(key: string, result: TResult): void;
|
176
|
-
/** Resolves all remaining entries that have not been otherwise resolved with a specific value */
|
177
|
-
resolveRemaining(value: TResult): void;
|
178
|
-
}
|
398
|
+
declare const compose: (input: ComponentParameterEnhancer<any, any> | ComponentParameterEnhancerFunction<any>, ...composers: ReadonlyArray<ComponentParameterEnhancer<any, any> | ComponentParameterEnhancerFunction<any>>) => ComponentParameterEnhancer<any, any>;
|
399
|
+
|
400
|
+
declare type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
401
|
+
declare function createLimitPolicy({ throttle, retry, }: {
|
402
|
+
throttle?: Options | false;
|
403
|
+
retry?: Options$1 | false;
|
404
|
+
}): LimitPolicy;
|
405
|
+
declare const nullLimitPolicy: LimitPolicy;
|
179
406
|
|
180
407
|
/**
|
181
408
|
* Builds a definition of the enhancers to run on Canvas components to add data from other systems.
|
@@ -258,360 +485,64 @@ declare function enhance<TContext extends EnhancerContext = EnhancerContext>({ c
|
|
258
485
|
onErrors?: (errors: EnhancerError[]) => void;
|
259
486
|
}): Promise<void>;
|
260
487
|
|
488
|
+
declare function extractLocales({ component }: {
|
489
|
+
component: ComponentInstance;
|
490
|
+
}): Record<string, ComponentInstance[]>;
|
491
|
+
declare function localize({ composition, locale, }: {
|
492
|
+
composition: ComponentInstance;
|
493
|
+
locale: string | ((options: {
|
494
|
+
component: Readonly<ComponentInstance>;
|
495
|
+
locales: Readonly<Record<string, ComponentInstance[]>>;
|
496
|
+
}) => string | undefined);
|
497
|
+
}): void;
|
498
|
+
|
261
499
|
/**
|
262
|
-
*
|
263
|
-
*
|
500
|
+
* Given a batch of enhancements containing potentially duplicate entries (i.e. several components referencing the same thing),
|
501
|
+
* group them together by some unique identifier and enable simpler batch processing.
|
264
502
|
*/
|
265
|
-
declare
|
503
|
+
declare class UniqueBatchEntries<TArgs, TResult> {
|
504
|
+
groups: Readonly<Record<string, ReadonlyArray<Readonly<BatchEntry<TArgs, TResult>>>>>;
|
505
|
+
constructor(
|
506
|
+
/** The batch queue being processed. */
|
507
|
+
entries: ReadonlyArray<Readonly<BatchEntry<TArgs, TResult>>>,
|
508
|
+
/** A function to select the unique identifier for a given batch entry. */
|
509
|
+
uniqueKeySelector: (entry: Readonly<TArgs>) => string);
|
510
|
+
/** Resolves all entries in a group key with the same result value. */
|
511
|
+
resolveKey(key: string, result: TResult): void;
|
512
|
+
/** Resolves all remaining entries that have not been otherwise resolved with a specific value */
|
513
|
+
resolveRemaining(value: TResult): void;
|
514
|
+
}
|
266
515
|
|
267
|
-
declare type
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
}
|
272
|
-
declare
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
/**
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
};
|
298
|
-
} | undefined;
|
299
|
-
variant?: string | undefined;
|
300
|
-
slots?: {
|
301
|
-
[key: string]: {
|
302
|
-
type: string;
|
303
|
-
parameters?: {
|
304
|
-
[key: string]: {
|
305
|
-
value: unknown;
|
306
|
-
type: string;
|
307
|
-
connectedData?: {
|
308
|
-
pointer: string;
|
309
|
-
syntax: "jptr";
|
310
|
-
required?: boolean | undefined;
|
311
|
-
} | undefined;
|
312
|
-
};
|
313
|
-
} | undefined;
|
314
|
-
variant?: string | undefined;
|
315
|
-
slots?: {
|
316
|
-
[key: string]: any[];
|
317
|
-
} | undefined;
|
318
|
-
_id?: string | undefined;
|
319
|
-
_pattern?: string | undefined;
|
320
|
-
_dataResources?: {
|
321
|
-
[key: string]: {
|
322
|
-
type: string;
|
323
|
-
isPatternParameter?: boolean | undefined;
|
324
|
-
variables?: {
|
325
|
-
[key: string]: string;
|
326
|
-
} | undefined;
|
327
|
-
};
|
328
|
-
} | undefined;
|
329
|
-
_patternDataResources?: {
|
330
|
-
[key: string]: {
|
331
|
-
type: string;
|
332
|
-
isPatternParameter?: boolean | undefined;
|
333
|
-
variables?: {
|
334
|
-
[key: string]: string;
|
335
|
-
} | undefined;
|
336
|
-
};
|
337
|
-
} | undefined;
|
338
|
-
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
339
|
-
}[];
|
340
|
-
} | undefined;
|
341
|
-
_id: string;
|
342
|
-
_slug?: string | null | undefined;
|
343
|
-
_name: string;
|
344
|
-
_dataResources?: {
|
345
|
-
[key: string]: {
|
346
|
-
type: string;
|
347
|
-
isPatternParameter?: boolean | undefined;
|
348
|
-
variables?: {
|
349
|
-
[key: string]: string;
|
350
|
-
} | undefined;
|
351
|
-
};
|
352
|
-
} | undefined;
|
353
|
-
};
|
354
|
-
}[];
|
355
|
-
totalCount?: number | undefined;
|
356
|
-
}>;
|
357
|
-
/** Fetches one composition by its project map node path */
|
358
|
-
unstable_getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
359
|
-
unstable_getCompositionByNodePath(options: CompositionGetByNodePathParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
360
|
-
unstable_getCompositionByNodePath<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByNodePathParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
361
|
-
/** Fetches one composition by its project map node ID */
|
362
|
-
unstable_getCompositionByNodeId(options: CompositionGetByNodeIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
363
|
-
unstable_getCompositionByNodeId(options: CompositionGetByNodeIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
364
|
-
unstable_getCompositionByNodeId<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByNodeIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
365
|
-
/** Fetches one composition by its slug */
|
366
|
-
getCompositionBySlug(options: CompositionGetBySlugParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
367
|
-
getCompositionBySlug(options: CompositionGetBySlugParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
368
|
-
getCompositionBySlug<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetBySlugParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
369
|
-
/** Fetches one composition by its ID */
|
370
|
-
getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
|
371
|
-
getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
|
372
|
-
getCompositionById<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
|
373
|
-
private getOneComposition;
|
374
|
-
/** Updates or creates a Canvas component definition */
|
375
|
-
updateComposition(body: Omit<CompositionPutParameters, 'projectId'>): Promise<void>;
|
376
|
-
/** Deletes a Canvas component definition */
|
377
|
-
removeComposition(body: Omit<CompositionDeleteParameters, 'projectId'>): Promise<void>;
|
378
|
-
/** Fetches all Canvas component definitions */
|
379
|
-
getComponentDefinitions(options?: Omit<ComponentDefinitionGetParameters, 'projectId'>): Promise<{
|
380
|
-
componentDefinitions: {
|
381
|
-
id: string;
|
382
|
-
name: string;
|
383
|
-
icon?: string | undefined;
|
384
|
-
titleParameter?: string | null | undefined;
|
385
|
-
canBeComposition?: boolean | undefined;
|
386
|
-
parameters?: {
|
387
|
-
id: string;
|
388
|
-
name: string;
|
389
|
-
helpText?: string | undefined;
|
390
|
-
type: string;
|
391
|
-
typeConfig?: unknown;
|
392
|
-
}[] | undefined;
|
393
|
-
useTeamPermissions?: boolean | undefined;
|
394
|
-
permissions?: {
|
395
|
-
roleId: string;
|
396
|
-
permission: "read" | "write" | "create" | "delete";
|
397
|
-
state: number;
|
398
|
-
}[] | undefined;
|
399
|
-
slots?: {
|
400
|
-
id: string;
|
401
|
-
name: string;
|
402
|
-
allowedComponents: string[];
|
403
|
-
inheritAllowedComponents: boolean;
|
404
|
-
minComponents?: number | undefined;
|
405
|
-
maxComponents?: number | undefined;
|
406
|
-
}[] | undefined;
|
407
|
-
slugSettings?: {
|
408
|
-
required?: "no" | "yes" | "disabled" | undefined;
|
409
|
-
unique?: "no" | "local" | "global" | undefined;
|
410
|
-
regularExpression?: string | undefined;
|
411
|
-
regularExpressionMessage?: string | undefined;
|
412
|
-
} | undefined;
|
413
|
-
defaults?: {
|
414
|
-
type: string;
|
415
|
-
parameters?: {
|
416
|
-
[key: string]: {
|
417
|
-
value: unknown;
|
418
|
-
type: string;
|
419
|
-
connectedData?: {
|
420
|
-
pointer: string;
|
421
|
-
syntax: "jptr";
|
422
|
-
required?: boolean | undefined;
|
423
|
-
} | undefined;
|
424
|
-
};
|
425
|
-
} | undefined;
|
426
|
-
variant?: string | undefined;
|
427
|
-
slots?: {
|
428
|
-
[key: string]: any[];
|
429
|
-
} | undefined;
|
430
|
-
_id?: string | undefined;
|
431
|
-
_pattern?: string | undefined;
|
432
|
-
_dataResources?: {
|
433
|
-
[key: string]: {
|
434
|
-
type: string;
|
435
|
-
isPatternParameter?: boolean | undefined;
|
436
|
-
variables?: {
|
437
|
-
[key: string]: string;
|
438
|
-
} | undefined;
|
439
|
-
};
|
440
|
-
} | undefined;
|
441
|
-
_patternDataResources?: {
|
442
|
-
[key: string]: {
|
443
|
-
type: string;
|
444
|
-
isPatternParameter?: boolean | undefined;
|
445
|
-
variables?: {
|
446
|
-
[key: string]: string;
|
447
|
-
} | undefined;
|
448
|
-
};
|
449
|
-
} | undefined;
|
450
|
-
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
451
|
-
} | null | undefined;
|
452
|
-
variants?: {
|
453
|
-
id: string;
|
454
|
-
name: string;
|
455
|
-
}[] | undefined;
|
456
|
-
created?: string | undefined;
|
457
|
-
updated?: string | undefined;
|
458
|
-
}[];
|
459
|
-
}>;
|
460
|
-
/** Updates or creates a Canvas component definition */
|
461
|
-
updateComponentDefinition(body: Omit<ComponentDefinitionPutParameters, 'projectId'>): Promise<void>;
|
462
|
-
/** Deletes a Canvas component definition */
|
463
|
-
removeComponentDefinition(body: Omit<ComponentDefinitionDeleteParameters, 'projectId'>): Promise<void>;
|
464
|
-
}
|
465
|
-
declare class UncachedCanvasClient extends CanvasClient {
|
466
|
-
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
467
|
-
}
|
468
|
-
|
469
|
-
/**
|
470
|
-
* @deprecated
|
471
|
-
*/
|
472
|
-
declare class DataSourceClient extends ApiClient {
|
473
|
-
constructor(options: ClientOptions);
|
474
|
-
/** Fetches all DataSources for a project */
|
475
|
-
get(options?: ExceptProject<DataSourceGetParameters>): Promise<{
|
476
|
-
result: {
|
477
|
-
id: string;
|
478
|
-
displayName: string;
|
479
|
-
connectorType: string;
|
480
|
-
baseUrl: string;
|
481
|
-
headers?: {
|
482
|
-
[key: string]: string;
|
483
|
-
} | {
|
484
|
-
key: string;
|
485
|
-
value: string;
|
486
|
-
}[] | undefined;
|
487
|
-
parameters?: {
|
488
|
-
[key: string]: string;
|
489
|
-
} | {
|
490
|
-
key: string;
|
491
|
-
value: string;
|
492
|
-
}[] | undefined;
|
493
|
-
variables?: {
|
494
|
-
[key: string]: {
|
495
|
-
displayName?: string | undefined;
|
496
|
-
helpText?: string | undefined;
|
497
|
-
type?: string | undefined;
|
498
|
-
default: string;
|
499
|
-
order?: number | undefined;
|
500
|
-
};
|
501
|
-
} | undefined;
|
502
|
-
custom?: {
|
503
|
-
[key: string]: unknown;
|
504
|
-
} | undefined;
|
505
|
-
};
|
506
|
-
}>;
|
507
|
-
/** Fetches all DataSources for a project */
|
508
|
-
getList(options?: ExceptProject<DataSourcesGetParameters>): Promise<{
|
509
|
-
results: {
|
510
|
-
id: string;
|
511
|
-
displayName: string;
|
512
|
-
connectorType: string;
|
513
|
-
baseUrl: string;
|
514
|
-
}[];
|
515
|
-
}>;
|
516
|
-
/** Updates or creates (based on id) a DataSource */
|
517
|
-
upsert(body: ExceptProject<DataSourcePutParameters>): Promise<void>;
|
518
|
-
/** Deletes a DataSource */
|
519
|
-
remove(body: ExceptProject<DataSourceDeleteParameters>): Promise<void>;
|
520
|
-
}
|
521
|
-
|
522
|
-
/**
|
523
|
-
* @deprecated
|
524
|
-
*/
|
525
|
-
declare class DataTypeClient extends ApiClient {
|
526
|
-
#private;
|
527
|
-
constructor(options: ClientOptions);
|
528
|
-
/** Fetches all DataTypes for a project */
|
529
|
-
get(options?: ExceptProject<DataTypeGetParameters>): Promise<DataTypeGetResponse>;
|
530
|
-
/** Updates or creates (based on id) a DataType */
|
531
|
-
upsert(body: ExceptProject<DataTypePutParameters>): Promise<void>;
|
532
|
-
/** Deletes a DataType */
|
533
|
-
remove(body: ExceptProject<DataTypeDeleteParameters>): Promise<void>;
|
534
|
-
}
|
535
|
-
|
536
|
-
/** Public ID of Canvas personalization component type */
|
537
|
-
declare const CANVAS_PERSONALIZE_TYPE = "$personalization";
|
538
|
-
/** Public ID of Canvas A/B test component type */
|
539
|
-
declare const CANVAS_TEST_TYPE = "$test";
|
540
|
-
/** Public ID of Canvas localization component type */
|
541
|
-
declare const CANVAS_LOCALIZATION_TYPE = "$localization";
|
542
|
-
/** Public ID of the intent tag parameter on the Canvas personalization component type */
|
543
|
-
declare const CANVAS_INTENT_TAG_PARAM = "intentTag";
|
544
|
-
/** Public ID of the locale parameter on Canvas components */
|
545
|
-
declare const CANVAS_LOCALE_TAG_PARAM = "locale";
|
546
|
-
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */
|
547
|
-
declare const CANVAS_PERSONALIZE_SLOT = "pz";
|
548
|
-
/** Name of the slot on CANVAS_TEST_TYPE */
|
549
|
-
declare const CANVAS_TEST_SLOT = "test";
|
550
|
-
/** Name of the slot on CANVAS_TEST_TYPE */
|
551
|
-
declare const CANVAS_LOCALIZATION_SLOT = "localized";
|
552
|
-
/** Constant for a draft composition state. Subject to change. */
|
553
|
-
declare const CANVAS_DRAFT_STATE = 0;
|
554
|
-
/** Constant for a published composition state. Subject to change. */
|
555
|
-
declare const CANVAS_PUBLISHED_STATE = 64;
|
556
|
-
/** Public ID of the Uniform Context personalization parameter on Canvas components */
|
557
|
-
declare const CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
558
|
-
/** Public ID of the Uniform Context test variant parameter on Canvas components */
|
559
|
-
declare const CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
560
|
-
/** Public ID of the Uniform Context enrichment tag parameter on Canvas components */
|
561
|
-
declare const CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
562
|
-
/** The name of the query string used to detect if we are in in-context editing mode */
|
563
|
-
declare const IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
564
|
-
/** The value of "data-role" in the component start <script> tag */
|
565
|
-
declare const IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
566
|
-
/** The ID we give to placeholder components */
|
567
|
-
declare const PLACEHOLDER_ID = "placeholder";
|
568
|
-
|
569
|
-
/** Determines if a given Canvas component type is a system-defined type */
|
570
|
-
declare const isSystemComponentDefinition: (componentType: string) => boolean;
|
571
|
-
|
572
|
-
/**
|
573
|
-
* Converts components in a slot into personalized variations (based on each component's intent tag in Canvas) suitable to pass to a personalize component
|
574
|
-
* Useful when implementing custom personalization settings for Canvas components.
|
575
|
-
*/
|
576
|
-
declare function mapSlotToPersonalizedVariations(slot: ComponentInstance[] | undefined): Array<ComponentInstance & PersonalizedVariant>;
|
577
|
-
|
578
|
-
/**
|
579
|
-
* Converts components in a slot into test variations (based on each component's Context tag in Canvas) suitable to pass to a personalize component
|
580
|
-
* Useful when implementing custom test settings for Canvas components.
|
581
|
-
*/
|
582
|
-
declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined): Array<ComponentInstance & TestVariant>;
|
583
|
-
|
584
|
-
declare const generateHash: ({ composition, secret, }: {
|
585
|
-
composition: RootComponentInstance;
|
586
|
-
secret: string | undefined;
|
587
|
-
}) => number | undefined;
|
588
|
-
|
589
|
-
declare function getChannelName(projectId: string, compositionId: string, state: number): string;
|
590
|
-
|
591
|
-
declare type EventNames = 'updated';
|
592
|
-
|
593
|
-
declare type SubscribeToCompositionOptions = {
|
594
|
-
projectId: string;
|
595
|
-
compositionId: string;
|
596
|
-
compositionState: number;
|
597
|
-
callback: (data: unknown) => void;
|
598
|
-
eventBus: PreviewEventBus;
|
599
|
-
event: EventNames;
|
600
|
-
};
|
601
|
-
declare type UnsubscribeCallback = () => void;
|
602
|
-
/** Subscribes to a composition event */
|
603
|
-
declare function subscribeToComposition({ projectId, compositionId, compositionState, eventBus: { subscribe }, callback, event, }: SubscribeToCompositionOptions): UnsubscribeCallback;
|
604
|
-
|
605
|
-
declare function extractLocales({ component }: {
|
606
|
-
component: ComponentInstance;
|
607
|
-
}): Record<string, ComponentInstance[]>;
|
608
|
-
declare function localize({ composition, locale, }: {
|
609
|
-
composition: ComponentInstance;
|
610
|
-
locale: string | ((options: {
|
611
|
-
component: Readonly<ComponentInstance>;
|
612
|
-
locales: Readonly<Record<string, ComponentInstance[]>>;
|
613
|
-
}) => string | undefined);
|
614
|
-
}): void;
|
516
|
+
declare type ComponentLocationReference = {
|
517
|
+
component: ComponentInstance;
|
518
|
+
parentSlot?: string;
|
519
|
+
parentSlotIndex?: number;
|
520
|
+
};
|
521
|
+
declare type WalkComponentTreeActions<TContext> = {
|
522
|
+
/** Replaces the component being visited with a new object */
|
523
|
+
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
524
|
+
/** Removes the component being visited from the composition */
|
525
|
+
removeComponent: () => void;
|
526
|
+
/** Inserts a new component immediately after the current component in its parent slot */
|
527
|
+
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
528
|
+
/** Aborts visitation of components that are in child slots of the current component */
|
529
|
+
stopProcessingDescendants: () => void;
|
530
|
+
/**
|
531
|
+
* Set a new traversal context for descendants of this node.
|
532
|
+
* If this is not called, `context` will automatically pass through.
|
533
|
+
*/
|
534
|
+
setDescendantsContext: (context: TContext) => void;
|
535
|
+
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
536
|
+
};
|
537
|
+
/** Walks a composition's component tree, visiting each component instance depth-first, in order. */
|
538
|
+
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
539
|
+
/** Traversal context for this node */
|
540
|
+
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
541
|
+
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference>): string;
|
542
|
+
/** Returns the JSON pointer of a component based on its location */
|
543
|
+
declare function getComponentJsonPointer(ancestorsAndSelf: Array<ComponentLocationReference>, { withSlots }?: {
|
544
|
+
withSlots?: boolean | undefined;
|
545
|
+
}): string;
|
615
546
|
|
616
547
|
declare type SelectComponentMessage = {
|
617
548
|
type: 'select-component';
|
@@ -665,6 +596,83 @@ declare const createCanvasChannel: ({ listenTo, broadcastTo, }: {
|
|
665
596
|
broadcastTo: Window[];
|
666
597
|
}) => Channel;
|
667
598
|
|
599
|
+
declare type EventNames = 'updated';
|
600
|
+
|
601
|
+
declare function getChannelName(projectId: string, compositionId: string, state: number): string;
|
602
|
+
|
603
|
+
declare type SubscribeToCompositionOptions = {
|
604
|
+
projectId: string;
|
605
|
+
compositionId: string;
|
606
|
+
compositionState: number;
|
607
|
+
callback: (data: unknown) => void;
|
608
|
+
eventBus: PreviewEventBus;
|
609
|
+
event: EventNames;
|
610
|
+
};
|
611
|
+
declare type UnsubscribeCallback = () => void;
|
612
|
+
/** Subscribes to a composition event */
|
613
|
+
declare function subscribeToComposition({ projectId, compositionId, compositionState, eventBus: { subscribe }, callback, event, }: SubscribeToCompositionOptions): UnsubscribeCallback;
|
614
|
+
|
615
|
+
/** Public ID of Canvas personalization component type */
|
616
|
+
declare const CANVAS_PERSONALIZE_TYPE = "$personalization";
|
617
|
+
/** Public ID of Canvas A/B test component type */
|
618
|
+
declare const CANVAS_TEST_TYPE = "$test";
|
619
|
+
/** Public ID of Canvas localization component type */
|
620
|
+
declare const CANVAS_LOCALIZATION_TYPE = "$localization";
|
621
|
+
/** Public ID of the intent tag parameter on the Canvas personalization component type */
|
622
|
+
declare const CANVAS_INTENT_TAG_PARAM = "intentTag";
|
623
|
+
/** Public ID of the locale parameter on Canvas components */
|
624
|
+
declare const CANVAS_LOCALE_TAG_PARAM = "locale";
|
625
|
+
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */
|
626
|
+
declare const CANVAS_PERSONALIZE_SLOT = "pz";
|
627
|
+
/** Name of the slot on CANVAS_TEST_TYPE */
|
628
|
+
declare const CANVAS_TEST_SLOT = "test";
|
629
|
+
/** Name of the slot on CANVAS_TEST_TYPE */
|
630
|
+
declare const CANVAS_LOCALIZATION_SLOT = "localized";
|
631
|
+
/** Constant for a draft composition state. Subject to change. */
|
632
|
+
declare const CANVAS_DRAFT_STATE = 0;
|
633
|
+
/** Constant for a published composition state. Subject to change. */
|
634
|
+
declare const CANVAS_PUBLISHED_STATE = 64;
|
635
|
+
/** Public ID of the Uniform Context personalization parameter on Canvas components */
|
636
|
+
declare const CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
637
|
+
/** Public ID of the Uniform Context test variant parameter on Canvas components */
|
638
|
+
declare const CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
639
|
+
/** Public ID of the Uniform Context enrichment tag parameter on Canvas components */
|
640
|
+
declare const CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
641
|
+
/** The name of the query string used to detect if we are in in-context editing mode */
|
642
|
+
declare const IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
643
|
+
/** The value of "data-role" in the component start <script> tag */
|
644
|
+
declare const IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
645
|
+
/** The ID we give to placeholder components */
|
646
|
+
declare const PLACEHOLDER_ID = "placeholder";
|
647
|
+
/** Minimal value for Edgehancers Cache TTL */
|
648
|
+
declare const EDGE_MIN_CACHE_TTL = 15;
|
649
|
+
/** Maximal value for Edgehancers Cache TTL */
|
650
|
+
declare const EDGE_MAX_CACHE_TTL = 600;
|
651
|
+
/** Default value for Edgehancers Cache TTL */
|
652
|
+
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
653
|
+
/** A value that indicates that Edgehancers caching is disabled */
|
654
|
+
declare const EDGE_CACHE_DISABLED = -1;
|
655
|
+
|
656
|
+
declare const generateHash: ({ composition, secret, }: {
|
657
|
+
composition: RootComponentInstance;
|
658
|
+
secret: string | undefined;
|
659
|
+
}) => number | undefined;
|
660
|
+
|
661
|
+
/** Determines if a given Canvas component type is a system-defined type */
|
662
|
+
declare const isSystemComponentDefinition: (componentType: string) => boolean;
|
663
|
+
|
664
|
+
/**
|
665
|
+
* Converts components in a slot into personalized variations (based on each component's intent tag in Canvas) suitable to pass to a personalize component
|
666
|
+
* Useful when implementing custom personalization settings for Canvas components.
|
667
|
+
*/
|
668
|
+
declare function mapSlotToPersonalizedVariations(slot: ComponentInstance[] | undefined): Array<ComponentInstance & PersonalizedVariant>;
|
669
|
+
|
670
|
+
/**
|
671
|
+
* Converts components in a slot into test variations (based on each component's Context tag in Canvas) suitable to pass to a personalize component
|
672
|
+
* Useful when implementing custom test settings for Canvas components.
|
673
|
+
*/
|
674
|
+
declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined): Array<ComponentInstance & TestVariant>;
|
675
|
+
|
668
676
|
declare const CanvasClientError: typeof ApiClientError;
|
669
677
|
|
670
|
-
export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
|
678
|
+
export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
|