@uniformdev/canvas 16.2.0 → 16.2.1-alpha.320

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.
@@ -0,0 +1,1079 @@
1
+ import Pusher from 'pusher-js';
2
+
3
+ /**
4
+ * This file was auto-generated by openapi-typescript.
5
+ * Do not make direct changes to the file.
6
+ */
7
+ interface paths$1 {
8
+ "/api/v1/canvas-definitions": {
9
+ get: {
10
+ parameters: {
11
+ query: {
12
+ /** The project ID to get component definitions for. */
13
+ projectId: string;
14
+ /** Limit list to one result by ID (response remains an array). */
15
+ componentId?: string;
16
+ /** Number of records to skip */
17
+ offset?: number;
18
+ /** Max number of records to return */
19
+ limit?: number;
20
+ /** Whether to fetch system meta-component definitions (personalize, test, etc) */
21
+ includeSystem?: boolean;
22
+ };
23
+ };
24
+ responses: {
25
+ /** OK */
26
+ 200: {
27
+ content: {
28
+ "application/json": {
29
+ /** @description Component definitions that match the query */
30
+ componentDefinitions: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinition"][];
31
+ };
32
+ };
33
+ };
34
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
35
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
36
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
37
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
38
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
39
+ };
40
+ };
41
+ /** Upserts a component definition */
42
+ put: {
43
+ responses: {
44
+ /** OK */
45
+ 204: never;
46
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
47
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
48
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
49
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
50
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
51
+ };
52
+ requestBody: {
53
+ content: {
54
+ "application/json": {
55
+ /**
56
+ * Format: uuid
57
+ * @description The project ID to upsert the component definition to
58
+ */
59
+ projectId: string;
60
+ componentDefinition: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinition"];
61
+ };
62
+ };
63
+ };
64
+ };
65
+ /** Deletes a component definition */
66
+ delete: {
67
+ responses: {
68
+ /** OK */
69
+ 204: never;
70
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
71
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
72
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
73
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
74
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
75
+ };
76
+ requestBody: {
77
+ content: {
78
+ "application/json": {
79
+ /** @description The public ID of the component definition to delete */
80
+ componentId: string;
81
+ /**
82
+ * Format: uuid
83
+ * @description The ID of the project the composition to delete belongs to
84
+ */
85
+ projectId: string;
86
+ };
87
+ };
88
+ };
89
+ };
90
+ };
91
+ }
92
+ interface external$1 {
93
+ "swagger.yml": {
94
+ paths: {};
95
+ components: {
96
+ schemas: {
97
+ Error: {
98
+ /** @description Error message(s) that occurred while processing the request */
99
+ errorMessage?: string[] | string;
100
+ };
101
+ };
102
+ responses: {
103
+ /** Request input validation failed */
104
+ BadRequestError: {
105
+ content: {
106
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
107
+ };
108
+ };
109
+ /** API key or token was not valid */
110
+ UnauthorizedError: {
111
+ content: {
112
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
113
+ };
114
+ };
115
+ /** Permission was denied */
116
+ ForbiddenError: {
117
+ content: {
118
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
119
+ };
120
+ };
121
+ /** Too many requests in allowed time period */
122
+ RateLimitError: unknown;
123
+ /** Execution error occurred */
124
+ InternalServerError: unknown;
125
+ };
126
+ };
127
+ operations: {};
128
+ };
129
+ "uniform-canvas-types.swagger.yml": {
130
+ paths: {};
131
+ components: {
132
+ schemas: {
133
+ /** @description Public ID (used in code). Do not change after creation. */
134
+ PublicIdProperty: string;
135
+ /** @description The definition of a component parameter */
136
+ ComponentDefinitionParameter: {
137
+ id: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
138
+ /** @description Friendly name of the parameter */
139
+ name: string;
140
+ /** @description Appears next to the parameter in the Composition editor */
141
+ helpText?: string;
142
+ /** @description Type name of the parameter (provided by a Uniform integration) */
143
+ type: string;
144
+ /** @description The configuration object for the type (type-specific) */
145
+ typeConfig?: unknown;
146
+ };
147
+ /** @description The definition of a named component slot that can contain other components */
148
+ ComponentDefinitionSlot: {
149
+ id: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
150
+ /** @description Friendly name of the slot */
151
+ name: string;
152
+ /** @description A list of component definition public IDs that are allowed in this named slot */
153
+ allowedComponents: string[];
154
+ /**
155
+ * @description Whether this slot inherits its allowed components from the parent slot it lives in. If true, allowedComponents is irrelevant.
156
+ * @default false
157
+ */
158
+ inheritAllowedComponents: boolean;
159
+ /** @description Minimum valid number of components in this slot */
160
+ minComponents?: number;
161
+ /** @description Maximum valid number of components in this slot */
162
+ maxComponents?: number;
163
+ };
164
+ /** @description The definition of a composition's slug settings */
165
+ ComponentDefinitionSlugSettings: {
166
+ /**
167
+ * @description Whether the slug is required
168
+ * no: slug is optional
169
+ * yes: slug is required
170
+ * disabled: slug is disabled and will not be shown in the editor
171
+ *
172
+ * @default no
173
+ * @enum {string}
174
+ */
175
+ required?: "no" | "yes" | "disabled";
176
+ /**
177
+ * @description Slug uniqueness configuration.
178
+ * no = no unique constraint
179
+ * local = must be unique within this component type
180
+ * global = must be unique across all component types
181
+ *
182
+ * @enum {string}
183
+ */
184
+ unique?: "no" | "local" | "global";
185
+ /** @description Regular expression slugs must match */
186
+ regularExpression?: string;
187
+ /**
188
+ * @description Custom error message when regular expression validation fails.
189
+ * Has no effect if `regularExpression` is not set.
190
+ */
191
+ regularExpressionMessage?: string;
192
+ };
193
+ /** @description The definition of a component variant */
194
+ ComponentDefinitionVariant: {
195
+ id: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
196
+ /** @description Friendly name of the variant */
197
+ name: string;
198
+ };
199
+ /** @description Permission set for a component defintion */
200
+ ComponentDefinitionPermission: {
201
+ roleId: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
202
+ /**
203
+ * @description Permission type for this permission ComponentDefinition:
204
+ * read | write | delete
205
+ *
206
+ * @enum {string}
207
+ */
208
+ permission: "read" | "write" | "delete";
209
+ /** @description State of the component that this permission applies to */
210
+ state: number;
211
+ };
212
+ /** @description Defines a component type that can live on a Composition */
213
+ ComponentDefinition: {
214
+ id: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
215
+ /** @description Friendly name of the component definition */
216
+ name: string;
217
+ /**
218
+ * @description Icon name or URL for the component definition (e.g. 'screen' or 'https://s3/my-component.jpg')
219
+ * @default screen
220
+ */
221
+ icon?: string;
222
+ /**
223
+ * @description The public ID of the parameter whose value should be used to create a display title for this component in the UI.
224
+ * The parameter type must support being used as a title parameter for this to work.
225
+ */
226
+ titleParameter?: string | null;
227
+ /**
228
+ * @description Whether this component type can be the root of a composition. If false, this component is only used within slots on other components.
229
+ * @default false
230
+ */
231
+ canBeComposition?: boolean;
232
+ /** @description The parameters for this component. Parameters are key-value pairs that can be anything from text values to links to CMS entries. */
233
+ parameters?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionParameter"][];
234
+ /**
235
+ * @description if this component uses team permissions or custom permissions
236
+ * @default true
237
+ */
238
+ useTeamPermissions?: boolean;
239
+ /** @description Custom role permissions for this component definition */
240
+ permissions?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionPermission"][];
241
+ /** @description The named slots for this component; placement areas where arrays of other components can be added. */
242
+ slots?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionSlot"][];
243
+ slugSettings?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionSlugSettings"];
244
+ /** @description Default component instance value */
245
+ defaults?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"] | null;
246
+ /** @description Named variants for this component; enables creation of visual variants that use the same parameter data */
247
+ variants?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionVariant"][];
248
+ /** @description Created date string for this definition (ignored for writes) */
249
+ created?: string;
250
+ /** @description Last modified date string for this definition (ignored for writes) */
251
+ updated?: string;
252
+ };
253
+ /** @description Defines an editable parameter on a component. */
254
+ ComponentParameter: {
255
+ /** @description The value of the parameter. Any JSON-serializable value is acceptable. */
256
+ value: unknown;
257
+ /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
258
+ type: string;
259
+ binding?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameterBinding"];
260
+ };
261
+ /**
262
+ * @deprecated
263
+ * @description Defines a binding from a resource data value to a component parameter value. Do not use.
264
+ */
265
+ ComponentParameterBinding: {
266
+ /**
267
+ * @description A JSON Pointer expression that defines the binding directly to the parameter value, or
268
+ * a map of JSON Pointers in the target parameter to JSON Pointers in the source resource data.
269
+ * Used to bind to object-type values.
270
+ * e.g. { "/prop1/thing": "/res1/things/value" } would set the target parameter's `value` to
271
+ * {
272
+ * prop1: {
273
+ * thing: "value of /res1/things/value resource"
274
+ * }
275
+ * }
276
+ */
277
+ pointer: string | {
278
+ [key: string]: string;
279
+ };
280
+ /**
281
+ * @description The syntax of the binding (currently always 'jptr')
282
+ * @enum {string}
283
+ */
284
+ syntax: "jptr";
285
+ /**
286
+ * @description Whether the binding should cause an error if it cannot be resolved.
287
+ * If true, and the binding cannot be resolved, an error will be returned by the binding process.
288
+ * If false, and the binding cannot be resolved, the parameter will be removed from the bound composition.
289
+ *
290
+ * @default false
291
+ */
292
+ required?: boolean;
293
+ };
294
+ /** @description Defines the shape of a component instance served by the composition API. */
295
+ ComponentInstance: {
296
+ /** @description Type of the component instance (public_id of its definition) */
297
+ type: string;
298
+ /** @description Component parameter values for the component instance */
299
+ parameters?: {
300
+ [key: string]: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameter"];
301
+ };
302
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
303
+ variant?: string;
304
+ /** @description Slots containing any child components */
305
+ slots?: {
306
+ [key: string]: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"][];
307
+ };
308
+ /** @description Indicates this component instance should be sourced from a pattern library pattern. */
309
+ _pattern?: string;
310
+ /**
311
+ * @description Describes why the pattern could not be resolved, if a pattern could not be resolved. For PUTs, this is allowed but ignored.
312
+ * CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop.
313
+ * NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet.
314
+ *
315
+ * @enum {string}
316
+ */
317
+ _patternError?: "NOTFOUND" | "CYCLIC";
318
+ };
319
+ /** @description Defines the shape of the root component in a composition */
320
+ RootComponentInstance: {
321
+ /** @description Type of the component instance (public_id of its definition) */
322
+ type: string;
323
+ /** @description Component parameter values for the component instance */
324
+ parameters?: {
325
+ [key: string]: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameter"];
326
+ };
327
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
328
+ variant?: string;
329
+ /** @description Slots containing any child components */
330
+ slots?: {
331
+ [key: string]: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"][];
332
+ };
333
+ /** @description The public UUID of the composition. */
334
+ _id: string;
335
+ /** @description Slug pattern of this component. */
336
+ _slug?: string | null;
337
+ /** @description Friendly name of this component. */
338
+ _name: string;
339
+ };
340
+ };
341
+ };
342
+ operations: {};
343
+ };
344
+ }
345
+
346
+ interface components$1 {
347
+ schemas: {
348
+ /** @description Public ID (used in code). Do not change after creation. */
349
+ PublicIdProperty: string;
350
+ /** @description The definition of a component parameter */
351
+ ComponentDefinitionParameter: {
352
+ id: components$1["schemas"]["PublicIdProperty"];
353
+ /** @description Friendly name of the parameter */
354
+ name: string;
355
+ /** @description Appears next to the parameter in the Composition editor */
356
+ helpText?: string;
357
+ /** @description Type name of the parameter (provided by a Uniform integration) */
358
+ type: string;
359
+ /** @description The configuration object for the type (type-specific) */
360
+ typeConfig?: unknown;
361
+ };
362
+ /** @description The definition of a named component slot that can contain other components */
363
+ ComponentDefinitionSlot: {
364
+ id: components$1["schemas"]["PublicIdProperty"];
365
+ /** @description Friendly name of the slot */
366
+ name: string;
367
+ /** @description A list of component definition public IDs that are allowed in this named slot */
368
+ allowedComponents: string[];
369
+ /**
370
+ * @description Whether this slot inherits its allowed components from the parent slot it lives in. If true, allowedComponents is irrelevant.
371
+ * @default false
372
+ */
373
+ inheritAllowedComponents: boolean;
374
+ /** @description Minimum valid number of components in this slot */
375
+ minComponents?: number;
376
+ /** @description Maximum valid number of components in this slot */
377
+ maxComponents?: number;
378
+ };
379
+ /** @description The definition of a composition's slug settings */
380
+ ComponentDefinitionSlugSettings: {
381
+ /**
382
+ * @description Whether the slug is required
383
+ * no: slug is optional
384
+ * yes: slug is required
385
+ * disabled: slug is disabled and will not be shown in the editor
386
+ *
387
+ * @default no
388
+ * @enum {string}
389
+ */
390
+ required?: "no" | "yes" | "disabled";
391
+ /**
392
+ * @description Slug uniqueness configuration.
393
+ * no = no unique constraint
394
+ * local = must be unique within this component type
395
+ * global = must be unique across all component types
396
+ *
397
+ * @enum {string}
398
+ */
399
+ unique?: "no" | "local" | "global";
400
+ /** @description Regular expression slugs must match */
401
+ regularExpression?: string;
402
+ /**
403
+ * @description Custom error message when regular expression validation fails.
404
+ * Has no effect if `regularExpression` is not set.
405
+ */
406
+ regularExpressionMessage?: string;
407
+ };
408
+ /** @description The definition of a component variant */
409
+ ComponentDefinitionVariant: {
410
+ id: components$1["schemas"]["PublicIdProperty"];
411
+ /** @description Friendly name of the variant */
412
+ name: string;
413
+ };
414
+ /** @description Permission set for a component defintion */
415
+ ComponentDefinitionPermission: {
416
+ roleId: components$1["schemas"]["PublicIdProperty"];
417
+ /**
418
+ * @description Permission type for this permission ComponentDefinition:
419
+ * read | write | delete
420
+ *
421
+ * @enum {string}
422
+ */
423
+ permission: "read" | "write" | "delete";
424
+ /** @description State of the component that this permission applies to */
425
+ state: number;
426
+ };
427
+ /** @description Defines a component type that can live on a Composition */
428
+ ComponentDefinition: {
429
+ id: components$1["schemas"]["PublicIdProperty"];
430
+ /** @description Friendly name of the component definition */
431
+ name: string;
432
+ /**
433
+ * @description Icon name or URL for the component definition (e.g. 'screen' or 'https://s3/my-component.jpg')
434
+ * @default screen
435
+ */
436
+ icon?: string;
437
+ /**
438
+ * @description The public ID of the parameter whose value should be used to create a display title for this component in the UI.
439
+ * The parameter type must support being used as a title parameter for this to work.
440
+ */
441
+ titleParameter?: string | null;
442
+ /**
443
+ * @description Whether this component type can be the root of a composition. If false, this component is only used within slots on other components.
444
+ * @default false
445
+ */
446
+ canBeComposition?: boolean;
447
+ /** @description The parameters for this component. Parameters are key-value pairs that can be anything from text values to links to CMS entries. */
448
+ parameters?: components$1["schemas"]["ComponentDefinitionParameter"][];
449
+ /**
450
+ * @description if this component uses team permissions or custom permissions
451
+ * @default true
452
+ */
453
+ useTeamPermissions?: boolean;
454
+ /** @description Custom role permissions for this component definition */
455
+ permissions?: components$1["schemas"]["ComponentDefinitionPermission"][];
456
+ /** @description The named slots for this component; placement areas where arrays of other components can be added. */
457
+ slots?: components$1["schemas"]["ComponentDefinitionSlot"][];
458
+ slugSettings?: components$1["schemas"]["ComponentDefinitionSlugSettings"];
459
+ /** @description Default component instance value */
460
+ defaults?: components$1["schemas"]["ComponentInstance"] | null;
461
+ /** @description Named variants for this component; enables creation of visual variants that use the same parameter data */
462
+ variants?: components$1["schemas"]["ComponentDefinitionVariant"][];
463
+ /** @description Created date string for this definition (ignored for writes) */
464
+ created?: string;
465
+ /** @description Last modified date string for this definition (ignored for writes) */
466
+ updated?: string;
467
+ };
468
+ /** @description Defines an editable parameter on a component. */
469
+ ComponentParameter: {
470
+ /** @description The value of the parameter. Any JSON-serializable value is acceptable. */
471
+ value: unknown;
472
+ /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
473
+ type: string;
474
+ binding?: components$1["schemas"]["ComponentParameterBinding"];
475
+ };
476
+ /**
477
+ * @deprecated
478
+ * @description Defines a binding from a resource data value to a component parameter value. Do not use.
479
+ */
480
+ ComponentParameterBinding: {
481
+ /**
482
+ * @description A JSON Pointer expression that defines the binding directly to the parameter value, or
483
+ * a map of JSON Pointers in the target parameter to JSON Pointers in the source resource data.
484
+ * Used to bind to object-type values.
485
+ * e.g. { "/prop1/thing": "/res1/things/value" } would set the target parameter's `value` to
486
+ * {
487
+ * prop1: {
488
+ * thing: "value of /res1/things/value resource"
489
+ * }
490
+ * }
491
+ */
492
+ pointer: string | {
493
+ [key: string]: string;
494
+ };
495
+ /**
496
+ * @description The syntax of the binding (currently always 'jptr')
497
+ * @enum {string}
498
+ */
499
+ syntax: "jptr";
500
+ };
501
+ /** @description Defines the shape of a component instance served by the composition API. */
502
+ ComponentInstance: {
503
+ /** @description Type of the component instance (public_id of its definition) */
504
+ type: string;
505
+ /** @description Component parameter values for the component instance */
506
+ parameters?: {
507
+ [key: string]: components$1["schemas"]["ComponentParameter"];
508
+ };
509
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
510
+ variant?: string;
511
+ /** @description Slots containing any child components */
512
+ slots?: {
513
+ [key: string]: components$1["schemas"]["ComponentInstance"][];
514
+ };
515
+ /** @description Indicates this component instance should be sourced from a pattern library pattern. */
516
+ _pattern?: string;
517
+ /**
518
+ * @description Describes why the pattern could not be resolved, if a pattern could not be resolved. For PUTs, this is allowed but ignored.
519
+ * CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop.
520
+ * NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet.
521
+ *
522
+ * @enum {string}
523
+ */
524
+ _patternError?: "NOTFOUND" | "CYCLIC";
525
+ };
526
+ /** @description Defines the shape of the root component in a composition */
527
+ RootComponentInstance: {
528
+ /** @description Type of the component instance (public_id of its definition) */
529
+ type: string;
530
+ /** @description Component parameter values for the component instance */
531
+ parameters?: {
532
+ [key: string]: components$1["schemas"]["ComponentParameter"];
533
+ };
534
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
535
+ variant?: string;
536
+ /** @description Slots containing any child components */
537
+ slots?: {
538
+ [key: string]: components$1["schemas"]["ComponentInstance"][];
539
+ };
540
+ /** @description The public UUID of the composition. */
541
+ _id: string;
542
+ /** @description Slug pattern of this component. */
543
+ _slug?: string | null;
544
+ /** @description Friendly name of this component. */
545
+ _name: string;
546
+ };
547
+ };
548
+ }
549
+
550
+ declare type SharedComponents$1 = components$1['schemas'];
551
+ declare type Api$1 = paths$1['/api/v1/canvas-definitions'];
552
+ /** Shape of the GET response from /api/v1/canvas-definitions */
553
+ declare type ComponentDefinitionGetResponse = Api$1['get']['responses']['200']['content']['application/json'];
554
+ /** Shape of the PUT request body for /api/v1/canvas-definitions */
555
+ declare type ComponentDefinitionPutParameters = Api$1['put']['requestBody']['content']['application/json'];
556
+ /** Shape of the DELETE request body for /api/v1/canvas-definitions */
557
+ declare type ComponentDefinitionDeleteParameters = Api$1['delete']['requestBody']['content']['application/json'];
558
+ /** Query parameter options for GET /api/v1/canvas-definitions */
559
+ declare type ComponentDefinitionGetParameters = Api$1['get']['parameters']['query'];
560
+ /** @deprecated use ComponentDefinitionGetResponse instead */
561
+ declare type ComponentDefinitionAPIResponse = ComponentDefinitionGetResponse;
562
+ /** @deprecated use ComponentDefinitionPutParameters */
563
+ declare type ComponentDefinitionAPIPutRequest = ComponentDefinitionPutParameters;
564
+ /** @deprecated use ComponentDefinitionDeleteParameters */
565
+ declare type ComponentDefinitionAPIDeleteRequest = ComponentDefinitionDeleteParameters;
566
+ /** @deprecated use ComponentDefinitionGetParameters */
567
+ declare type ComponentDefinitionListAPIOptions = ComponentDefinitionGetParameters;
568
+ /** The definition of a component parameter */
569
+ declare type ComponentDefinitionParameter<TConfig = unknown> = Omit<components$1['schemas']['ComponentDefinitionParameter'], 'typeConfig'> & {
570
+ typeConfig?: TConfig;
571
+ };
572
+ /** The definition of a component visual variant */
573
+ declare type ComponentDefinitionVariant = SharedComponents$1['ComponentDefinitionVariant'];
574
+ /** The definition of a composition's slug settings */
575
+ declare type ComponentDefinitionSlugSettings = SharedComponents$1['ComponentDefinitionSlugSettings'];
576
+ /** The definition of a named component slot that can contain other components */
577
+ declare type ComponentDefinitionSlot = SharedComponents$1['ComponentDefinitionSlot'];
578
+ /** Permission set for a component defintion */
579
+ declare type ComponentDefinitionPermission = SharedComponents$1['ComponentDefinitionPermission'];
580
+ /** Defines a component type that can live on a Composition */
581
+ declare type ComponentDefinition = SharedComponents$1['ComponentDefinition'];
582
+ /** @deprecated use ComponentDefinition instead */
583
+ declare type CreatingComponentDefinition = Omit<Partial<ComponentDefinition>, 'created' | 'updated'>;
584
+
585
+ /**
586
+ * This file was auto-generated by openapi-typescript.
587
+ * Do not make direct changes to the file.
588
+ */
589
+ interface paths {
590
+ "/api/v1/canvas": {
591
+ get: {
592
+ parameters: {
593
+ query: {
594
+ /** The project the composition(s) are on. */
595
+ projectId: string;
596
+ /** Specify a single composition ID to fetch. Changes response from list to single. */
597
+ compositionId?: string;
598
+ /** Specify a single composition to fetch by slug. Changes response from list to single. */
599
+ slug?: string;
600
+ /** The component type to filter by */
601
+ type?: string;
602
+ /** State of compositions to fetch. 0 = draft, 64 = published. */
603
+ state?: number;
604
+ /** Number of records to skip */
605
+ offset?: number;
606
+ /** Max number of records to return */
607
+ limit?: number;
608
+ /**
609
+ * Signals an enhancer proxy to skip processing enhancements to the data and return raw data only.
610
+ * This improves performance if you do not require enhanced component data.
611
+ * If calling the Canvas API directly with no enhancer proxy, this has no effect.
612
+ */
613
+ skipEnhance?: boolean;
614
+ /**
615
+ * If true, any pattern references in the composition will be left unresolved.
616
+ * This is appropriate if you intend to serialize the composition data without pattern
617
+ * data embedded into it, and serialize the pattern data separately.
618
+ */
619
+ skipPatternResolution?: boolean;
620
+ };
621
+ };
622
+ responses: {
623
+ /** OK */
624
+ 200: {
625
+ content: {
626
+ "application/json": components["schemas"]["CompositionListResponse"] | components["schemas"]["CompositionApiResponse"];
627
+ };
628
+ };
629
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
630
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
631
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
632
+ /** Composition not found */
633
+ 404: {
634
+ content: {
635
+ "text/plain": string;
636
+ };
637
+ };
638
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
639
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
640
+ };
641
+ };
642
+ /** Upserts a composition */
643
+ put: {
644
+ responses: {
645
+ /** OK */
646
+ 204: never;
647
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
648
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
649
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
650
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
651
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
652
+ };
653
+ requestBody: {
654
+ content: {
655
+ "application/json": {
656
+ /**
657
+ * Format: uuid
658
+ * @description The project ID to upsert the composition to
659
+ */
660
+ projectId: string;
661
+ /** @description The state of the composition to upsert into. 0 = draft, 64 = published */
662
+ state: number;
663
+ composition: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["RootComponentInstance"];
664
+ /**
665
+ * @description True if the composition is a pattern (which can be referenced on other compositions)
666
+ * @default false
667
+ */
668
+ pattern?: boolean;
669
+ resources?: components["schemas"]["CompositionResourceDefinitions"];
670
+ /** @description Ignored if present */
671
+ created?: string;
672
+ /** @description Ignored if present */
673
+ modified?: string;
674
+ };
675
+ };
676
+ };
677
+ };
678
+ /** Deletes or unpublishes a composition */
679
+ delete: {
680
+ responses: {
681
+ /** OK */
682
+ 204: never;
683
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
684
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
685
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
686
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
687
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
688
+ };
689
+ requestBody: {
690
+ content: {
691
+ "application/json": {
692
+ /**
693
+ * Format: uuid
694
+ * @description The ID of the composition to delete
695
+ */
696
+ compositionId: string;
697
+ /**
698
+ * Format: uuid
699
+ * @description The ID of the project the composition to delete belongs to
700
+ */
701
+ projectId: string;
702
+ /** @description The state of the composition to delete (0 = draft, 64 = published [causes unpublishing], unspecified = all) */
703
+ state?: number;
704
+ };
705
+ };
706
+ };
707
+ };
708
+ };
709
+ }
710
+ interface components {
711
+ schemas: {
712
+ CompositionApiResponse: {
713
+ /** @description State of compositions to fetch. 0 = draft, 64 = published. */
714
+ state: number;
715
+ /**
716
+ * Format: uuid
717
+ * @description The project ID that this layout data is part of
718
+ */
719
+ projectId: string;
720
+ /**
721
+ * Format: date-time,
722
+ * @description Created date string for this definition
723
+ */
724
+ created: string;
725
+ /**
726
+ * Format: date-time,
727
+ * @description Modified date string for this definition
728
+ */
729
+ modified: string;
730
+ /** @description Whether this composition is a pattern (can be referenced by other compositions, not treated as a composition) */
731
+ pattern: boolean;
732
+ resources?: components["schemas"]["CompositionResourceDefinitions"];
733
+ composition: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["RootComponentInstance"];
734
+ };
735
+ CompositionListResponse: {
736
+ compositions: components["schemas"]["CompositionApiResponse"][];
737
+ };
738
+ /**
739
+ * @deprecated
740
+ * @description Resource definitions attached to this composition. The property name is the key of the resource in the resource document.
741
+ */
742
+ CompositionResourceDefinitions: {
743
+ [key: string]: components["schemas"]["CompositionResourceDefinition"];
744
+ };
745
+ /**
746
+ * @deprecated
747
+ * @description Resource definition attached to this composition
748
+ */
749
+ CompositionResourceDefinition: {
750
+ /** @description Integration that provides this resource */
751
+ type: string;
752
+ /** @description Type-specific data to configure resource */
753
+ data: {
754
+ [key: string]: unknown;
755
+ };
756
+ };
757
+ };
758
+ }
759
+ interface external {
760
+ "swagger.yml": {
761
+ paths: {};
762
+ components: {
763
+ schemas: {
764
+ Error: {
765
+ /** @description Error message(s) that occurred while processing the request */
766
+ errorMessage?: string[] | string;
767
+ };
768
+ };
769
+ responses: {
770
+ /** Request input validation failed */
771
+ BadRequestError: {
772
+ content: {
773
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
774
+ };
775
+ };
776
+ /** API key or token was not valid */
777
+ UnauthorizedError: {
778
+ content: {
779
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
780
+ };
781
+ };
782
+ /** Permission was denied */
783
+ ForbiddenError: {
784
+ content: {
785
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
786
+ };
787
+ };
788
+ /** Too many requests in allowed time period */
789
+ RateLimitError: unknown;
790
+ /** Execution error occurred */
791
+ InternalServerError: unknown;
792
+ };
793
+ };
794
+ operations: {};
795
+ };
796
+ "uniform-canvas-types.swagger.yml": {
797
+ paths: {};
798
+ components: {
799
+ schemas: {
800
+ /** @description Public ID (used in code). Do not change after creation. */
801
+ PublicIdProperty: string;
802
+ /** @description The definition of a component parameter */
803
+ ComponentDefinitionParameter: {
804
+ id: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
805
+ /** @description Friendly name of the parameter */
806
+ name: string;
807
+ /** @description Appears next to the parameter in the Composition editor */
808
+ helpText?: string;
809
+ /** @description Type name of the parameter (provided by a Uniform integration) */
810
+ type: string;
811
+ /** @description The configuration object for the type (type-specific) */
812
+ typeConfig?: unknown;
813
+ };
814
+ /** @description The definition of a named component slot that can contain other components */
815
+ ComponentDefinitionSlot: {
816
+ id: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
817
+ /** @description Friendly name of the slot */
818
+ name: string;
819
+ /** @description A list of component definition public IDs that are allowed in this named slot */
820
+ allowedComponents: string[];
821
+ /**
822
+ * @description Whether this slot inherits its allowed components from the parent slot it lives in. If true, allowedComponents is irrelevant.
823
+ * @default false
824
+ */
825
+ inheritAllowedComponents: boolean;
826
+ /** @description Minimum valid number of components in this slot */
827
+ minComponents?: number;
828
+ /** @description Maximum valid number of components in this slot */
829
+ maxComponents?: number;
830
+ };
831
+ /** @description The definition of a composition's slug settings */
832
+ ComponentDefinitionSlugSettings: {
833
+ /**
834
+ * @description Whether the slug is required
835
+ * no: slug is optional
836
+ * yes: slug is required
837
+ * disabled: slug is disabled and will not be shown in the editor
838
+ *
839
+ * @default no
840
+ * @enum {string}
841
+ */
842
+ required?: "no" | "yes" | "disabled";
843
+ /**
844
+ * @description Slug uniqueness configuration.
845
+ * no = no unique constraint
846
+ * local = must be unique within this component type
847
+ * global = must be unique across all component types
848
+ *
849
+ * @enum {string}
850
+ */
851
+ unique?: "no" | "local" | "global";
852
+ /** @description Regular expression slugs must match */
853
+ regularExpression?: string;
854
+ /**
855
+ * @description Custom error message when regular expression validation fails.
856
+ * Has no effect if `regularExpression` is not set.
857
+ */
858
+ regularExpressionMessage?: string;
859
+ };
860
+ /** @description The definition of a component variant */
861
+ ComponentDefinitionVariant: {
862
+ id: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
863
+ /** @description Friendly name of the variant */
864
+ name: string;
865
+ };
866
+ /** @description Permission set for a component defintion */
867
+ ComponentDefinitionPermission: {
868
+ roleId: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
869
+ /**
870
+ * @description Permission type for this permission ComponentDefinition:
871
+ * read | write | delete
872
+ *
873
+ * @enum {string}
874
+ */
875
+ permission: "read" | "write" | "delete";
876
+ /** @description State of the component that this permission applies to */
877
+ state: number;
878
+ };
879
+ /** @description Defines a component type that can live on a Composition */
880
+ ComponentDefinition: {
881
+ id: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["PublicIdProperty"];
882
+ /** @description Friendly name of the component definition */
883
+ name: string;
884
+ /**
885
+ * @description Icon name or URL for the component definition (e.g. 'screen' or 'https://s3/my-component.jpg')
886
+ * @default screen
887
+ */
888
+ icon?: string;
889
+ /**
890
+ * @description The public ID of the parameter whose value should be used to create a display title for this component in the UI.
891
+ * The parameter type must support being used as a title parameter for this to work.
892
+ */
893
+ titleParameter?: string | null;
894
+ /**
895
+ * @description Whether this component type can be the root of a composition. If false, this component is only used within slots on other components.
896
+ * @default false
897
+ */
898
+ canBeComposition?: boolean;
899
+ /** @description The parameters for this component. Parameters are key-value pairs that can be anything from text values to links to CMS entries. */
900
+ parameters?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionParameter"][];
901
+ /**
902
+ * @description if this component uses team permissions or custom permissions
903
+ * @default true
904
+ */
905
+ useTeamPermissions?: boolean;
906
+ /** @description Custom role permissions for this component definition */
907
+ permissions?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionPermission"][];
908
+ /** @description The named slots for this component; placement areas where arrays of other components can be added. */
909
+ slots?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionSlot"][];
910
+ slugSettings?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionSlugSettings"];
911
+ /** @description Default component instance value */
912
+ defaults?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"] | null;
913
+ /** @description Named variants for this component; enables creation of visual variants that use the same parameter data */
914
+ variants?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentDefinitionVariant"][];
915
+ /** @description Created date string for this definition (ignored for writes) */
916
+ created?: string;
917
+ /** @description Last modified date string for this definition (ignored for writes) */
918
+ updated?: string;
919
+ };
920
+ /** @description Defines an editable parameter on a component. */
921
+ ComponentParameter: {
922
+ /** @description The value of the parameter. Any JSON-serializable value is acceptable. */
923
+ value: unknown;
924
+ /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
925
+ type: string;
926
+ binding?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameterBinding"];
927
+ };
928
+ /**
929
+ * @deprecated
930
+ * @description Defines a binding from a resource data value to a component parameter value. Do not use.
931
+ */
932
+ ComponentParameterBinding: {
933
+ /**
934
+ * @description A JSON Pointer expression that defines the binding directly to the parameter value, or
935
+ * a map of JSON Pointers in the target parameter to JSON Pointers in the source resource data.
936
+ * Used to bind to object-type values.
937
+ * e.g. { "/prop1/thing": "/res1/things/value" } would set the target parameter's `value` to
938
+ * {
939
+ * prop1: {
940
+ * thing: "value of /res1/things/value resource"
941
+ * }
942
+ * }
943
+ */
944
+ pointer: string | {
945
+ [key: string]: string;
946
+ };
947
+ /**
948
+ * @description The syntax of the binding (currently always 'jptr')
949
+ * @enum {string}
950
+ */
951
+ syntax: "jptr";
952
+ /**
953
+ * @description Whether the binding should cause an error if it cannot be resolved.
954
+ * If true, and the binding cannot be resolved, an error will be returned by the binding process.
955
+ * If false, and the binding cannot be resolved, the parameter will be removed from the bound composition.
956
+ *
957
+ * @default false
958
+ */
959
+ required?: boolean;
960
+ };
961
+ /** @description Defines the shape of a component instance served by the composition API. */
962
+ ComponentInstance: {
963
+ /** @description Type of the component instance (public_id of its definition) */
964
+ type: string;
965
+ /** @description Component parameter values for the component instance */
966
+ parameters?: {
967
+ [key: string]: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameter"];
968
+ };
969
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
970
+ variant?: string;
971
+ /** @description Slots containing any child components */
972
+ slots?: {
973
+ [key: string]: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"][];
974
+ };
975
+ /** @description Indicates this component instance should be sourced from a pattern library pattern. */
976
+ _pattern?: string;
977
+ /**
978
+ * @description Describes why the pattern could not be resolved, if a pattern could not be resolved. For PUTs, this is allowed but ignored.
979
+ * CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop.
980
+ * NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet.
981
+ *
982
+ * @enum {string}
983
+ */
984
+ _patternError?: "NOTFOUND" | "CYCLIC";
985
+ };
986
+ /** @description Defines the shape of the root component in a composition */
987
+ RootComponentInstance: {
988
+ /** @description Type of the component instance (public_id of its definition) */
989
+ type: string;
990
+ /** @description Component parameter values for the component instance */
991
+ parameters?: {
992
+ [key: string]: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentParameter"];
993
+ };
994
+ /** @description Public ID of alternate visual appearance for this component, if any selected */
995
+ variant?: string;
996
+ /** @description Slots containing any child components */
997
+ slots?: {
998
+ [key: string]: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["ComponentInstance"][];
999
+ };
1000
+ /** @description The public UUID of the composition. */
1001
+ _id: string;
1002
+ /** @description Slug pattern of this component. */
1003
+ _slug?: string | null;
1004
+ /** @description Friendly name of this component. */
1005
+ _name: string;
1006
+ };
1007
+ };
1008
+ };
1009
+ operations: {};
1010
+ };
1011
+ }
1012
+
1013
+ declare type Components = components['schemas'];
1014
+ declare type SharedComponents = components$1['schemas'];
1015
+ declare type Api = paths['/api/v1/canvas'];
1016
+ /** Query parameter options for GET /api/v1/canvas */
1017
+ declare type CompositionGetParameters = Api['get']['parameters']['query'];
1018
+ /** The GET response from /api/v1/canvas when `component` or `slug` params are specified */
1019
+ declare type CompositionGetResponse = Components['CompositionApiResponse'];
1020
+ /** The GET response from /api/v1/canvas when `component` or `slug` are not specified */
1021
+ declare type CompositionGetListResponse = Components['CompositionListResponse'];
1022
+ /** The PUT request body for /api/v1/canvas */
1023
+ declare type CompositionPutParameters = Api['put']['requestBody']['content']['application/json'];
1024
+ /** Shape of the DELETE request body for /api/v1/canvas */
1025
+ declare type CompositionDeleteParameters = Api['delete']['requestBody']['content']['application/json'];
1026
+ /** @deprecated use CompositionGetResponse */
1027
+ declare type CompositionAPIResponse = CompositionGetResponse;
1028
+ /** @deprecated use CompositionDeleteParameters */
1029
+ declare type CompositionAPIDeleteRequest = CompositionDeleteParameters;
1030
+ /** @deprecated use CompositionGetParameters */
1031
+ declare type CompositionListAPIResponse = CompositionGetListResponse;
1032
+ /** @deprecated use CompositionGetParameters */
1033
+ declare type CompositionAPIOptions = CompositionGetParameters;
1034
+ /** Defines an editable parameter on a component. */
1035
+ declare type ComponentParameter<TValue = unknown> = Omit<SharedComponents['ComponentParameter'], 'value'> & {
1036
+ /** The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
1037
+ value: TValue;
1038
+ };
1039
+ /** Defines a binding from a resource data value to a component parameter value. */
1040
+ declare type ComponentParameterBinding = SharedComponents['ComponentParameterBinding'];
1041
+ /** Defines the shape of a component instance served by the composition API. */
1042
+ declare type ComponentInstance = SharedComponents['ComponentInstance'] & {
1043
+ /** Data for the component instance, provided by a component enhancer. Never set in unenhanced data. */
1044
+ data?: Record<string, unknown>;
1045
+ };
1046
+ /** Defines the shape of the root component in a composition */
1047
+ declare type RootComponentInstance = SharedComponents['RootComponentInstance'];
1048
+ /** Defines single structure to keep all canvas models (used in CLI commands and Starter content generations) */
1049
+ declare type CanvasDefinitions = {
1050
+ components?: Array<ComponentDefinition>;
1051
+ compositions?: Array<CompositionGetResponse>;
1052
+ };
1053
+
1054
+ /**
1055
+ * Pusher-js is large (80k) and not tree shakable so it is always bundled if directly referenced,
1056
+ * when it's only needed during preview mode. To avoid bundling it for all, we use an old-school
1057
+ * write-a-script-tag hack to load it in a poor man's approximation of a dynamic import ;)
1058
+ */
1059
+ declare type ChannelSubscription = {
1060
+ addEventHandler: (eventName: string, handler: (data: unknown) => void) => () => void;
1061
+ unsubscribe: () => void;
1062
+ };
1063
+ declare type PreviewEventBus = {
1064
+ subscribe: (channel: string) => ChannelSubscription;
1065
+ };
1066
+ declare global {
1067
+ interface Window {
1068
+ Pusher?: typeof Pusher;
1069
+ __UNIFORM_EVENT_BUS__?: PreviewEventBus;
1070
+ }
1071
+ }
1072
+ /**
1073
+ * Creates an event bus client to receive updates from Canvas
1074
+ * IMPORTANT: in a server-side context this will always return undefined
1075
+ * IMPORTANT: in a browser context this is cached in window and does not create multiple instances
1076
+ */
1077
+ declare function createEventBus(): Promise<PreviewEventBus | undefined>;
1078
+
1079
+ export { CanvasDefinitions as A, ChannelSubscription as B, ComponentInstance as C, createEventBus as D, PreviewEventBus as P, RootComponentInstance as R, ComponentParameter as a, CompositionGetParameters as b, CompositionPutParameters as c, CompositionDeleteParameters as d, ComponentDefinitionGetParameters as e, ComponentDefinitionPutParameters as f, ComponentDefinitionDeleteParameters as g, ComponentDefinitionGetResponse as h, ComponentDefinitionAPIResponse as i, ComponentDefinitionAPIPutRequest as j, ComponentDefinitionAPIDeleteRequest as k, ComponentDefinitionListAPIOptions as l, ComponentDefinitionParameter as m, ComponentDefinitionVariant as n, ComponentDefinitionSlugSettings as o, ComponentDefinitionSlot as p, ComponentDefinitionPermission as q, ComponentDefinition as r, CreatingComponentDefinition as s, CompositionGetResponse as t, CompositionGetListResponse as u, CompositionAPIResponse as v, CompositionAPIDeleteRequest as w, CompositionListAPIResponse as x, CompositionAPIOptions as y, ComponentParameterBinding as z };