@canva/intents 2.2.1-beta.1 → 2.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +24 -18
  2. package/asset/index.d.ts +1 -1
  3. package/content/index.d.ts +1618 -1
  4. package/data/index.d.ts +1229 -1
  5. package/design/index.d.ts +41 -1
  6. package/index.d.ts +2994 -1
  7. package/lib/cjs/sdk/intents/asset/index.js +1 -15
  8. package/lib/cjs/sdk/intents/fake/{create_beta.js → create.js} +6 -9
  9. package/lib/cjs/sdk/intents/index.js +4 -2
  10. package/lib/cjs/sdk/intents/test/index.js +14 -13
  11. package/lib/cjs/sdk/intents/version.js +1 -1
  12. package/lib/esm/sdk/intents/asset/index.js +1 -1
  13. package/lib/esm/sdk/intents/fake/{create_beta.js → create.js} +4 -7
  14. package/lib/esm/sdk/intents/index.js +3 -1
  15. package/lib/esm/sdk/intents/test/index.js +9 -1
  16. package/lib/esm/sdk/intents/version.js +1 -1
  17. package/package.json +23 -23
  18. package/test/index.d.ts +11 -1
  19. package/asset/beta.d.ts +0 -190
  20. package/beta.d.ts +0 -2963
  21. package/content/beta.d.ts +0 -1567
  22. package/data/beta.d.ts +0 -1229
  23. package/design/beta.d.ts +0 -41
  24. package/lib/cjs/sdk/intents/asset/beta.js +0 -13
  25. package/lib/cjs/sdk/intents/beta.js +0 -20
  26. package/lib/cjs/sdk/intents/content/beta.js +0 -27
  27. package/lib/cjs/sdk/intents/data/beta.js +0 -20
  28. package/lib/cjs/sdk/intents/design/beta.js +0 -20
  29. package/lib/cjs/sdk/intents/test/beta.js +0 -19
  30. package/lib/esm/sdk/intents/asset/beta.js +0 -3
  31. package/lib/esm/sdk/intents/beta.js +0 -3
  32. package/lib/esm/sdk/intents/content/beta.js +0 -4
  33. package/lib/esm/sdk/intents/data/beta.js +0 -3
  34. package/lib/esm/sdk/intents/design/beta.js +0 -3
  35. package/lib/esm/sdk/intents/test/beta.js +0 -9
  36. package/test/beta.d.ts +0 -11
package/beta.d.ts DELETED
@@ -1,2963 +0,0 @@
1
- /**
2
- * @public
3
- * A disclosure identifying if the app generated this asset using AI.
4
- *
5
- * @remarks
6
- * Helps users make informed decisions about the content they interact with.
7
- *
8
- * AI is generally defined as any machine system that, given an objective, infers how to generate an output from an input.
9
- * Some examples include "generative AI", "large language models", and "machine learning".
10
- *
11
- * **App Generated**
12
- *
13
- * 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
14
- * the app makes a request to a third-party service to do so.
15
- *
16
- * A significantly altered asset means the AI changes key information or details, such as
17
- * removing or replacing key components in the original content, which can include applying style transfer, or changing facial expressions.
18
- *
19
- * Label this asset as 'app_generated' under these conditions:
20
- *
21
- * The following is true:
22
- *
23
- * - The app generates the asset in response to a user's request (including past requests), for example, the asset is not from an asset library.
24
- *
25
- * And any of these conditions are also true:
26
- *
27
- * - The AI creates entirely new content from scratch.
28
- * - The AI introduces new multimedia, details, or creative elements not originally present.
29
- * - The AI removes and replaces the asset's key components.
30
- * - The AI alters the asset's appearance, meaning, or context in a way that conveys a different message than the original.
31
- *
32
- * **None**
33
- *
34
- * 'none' indicates when the asset wasn't generated by the app as a part of any user's specific request, for example, a third-party
35
- * request, or when the asset wasn't significantly altered by AI.
36
- */
37
- declare type AiDisclosure = 'app_generated' | 'none';
38
-
39
- declare type AllOrNone<T> = T | Never<T>;
40
-
41
- /**
42
- * @public
43
- * {@link GetDataTableError} indicating custom error occurred in the app's implementation.
44
- * This can be used to indicate specific issues that are not covered by other error types.
45
- */
46
- declare type AppError = {
47
- /**
48
- * A custom error occurred in your app.
49
- *
50
- * Return this for application-specific errors that don't fit
51
- * the other categories. Include a descriptive message explaining
52
- * the error to the user.
53
- */
54
- status: 'app_error';
55
- /**
56
- * Optional message explaining the error.
57
- */
58
- message?: string;
59
- };
60
-
61
- /**
62
- * @public
63
- * {@link PublishContentError} indicating a custom error occurred in your app's implementation.
64
- *
65
- * Return this for application-specific errors such as:
66
- *
67
- * - Validation failures
68
- * - Authentication errors
69
- * - Rate limiting
70
- * - Platform-specific restrictions
71
- *
72
- * @example Returning custom error with message
73
- * ```ts
74
- * if (userQuotaExceeded) {
75
- * return {
76
- * status: 'app_error',
77
- * message: 'You have reached your monthly publish limit. Please upgrade your plan.'
78
- * };
79
- * }
80
- * ```
81
- */
82
- declare type AppError_2 = {
83
- status: 'app_error';
84
- /**
85
- * (required) The raw error message, for logging purposes. It will not display in the UI.
86
- * To display custom error messages in the UI use `localizedMessageId`.
87
- *
88
- * This should typically be the javascript error.message or a REST JSON error message
89
- * body passed without modification.
90
- *
91
- * WARNING: Do not include personally identifiable information (PII) in this
92
- * message, such as names, emails, usernames, etc.
93
- */
94
- message: string;
95
- /**
96
- * (optional) Message ID of the translated error message that will be
97
- * displayed to the user. The message ID should be present and uploaded in
98
- * your translation file. If omitted, Canva will display a generic error
99
- * message.
100
- */
101
- localizedMessageId?: string;
102
- /** HTTP status code, if applicable */
103
- httpCode?: number;
104
- /**
105
- * Used only by app developer. Canva does not use this value. Use this to pass
106
- * additional information like JSON to your settings frame.
107
- */
108
- appDefinedPayload?: string;
109
- /**
110
- * (optional) Source of the error if it relates to a component on the Canva
111
- * UI. When present, the error may render near a relevant Canva component.
112
- * When omitted, the cause is considered unspecified or "generic".
113
- */
114
- errorCause?: ErrorCause;
115
- };
116
-
117
- /**
118
- * @public
119
- * {@link InvocationContext} indicating a custom error occurred during data refresh.
120
- * Triggered when getDataTable returned 'app_error' status.
121
- * UI should display the error message and help users recover.
122
- */
123
- declare type AppErrorInvocationContext = {
124
- /**
125
- * A custom error occurred during data refresh.
126
- *
127
- * This occurs when `getDataTable` returned 'app_error' during a refresh attempt.
128
- * Your UI should display the error message and help users recover from the specific
129
- * issue.
130
- */
131
- reason: 'app_error';
132
- /**
133
- * The data source reference that caused the error during refresh.
134
- */
135
- dataSourceRef?: DataSourceRef;
136
- /**
137
- * The error message to display to the user.
138
- */
139
- message?: string;
140
- };
141
-
142
- /**
143
- * @public
144
- * Base file requirement interface.
145
- */
146
- declare interface BaseFileRequirement {
147
- /**
148
- * File format for this requirement.
149
- */
150
- format: PublishFileFormat;
151
-
152
- }
153
-
154
- /**
155
- * @public
156
- * Base interface for exported files.
157
- */
158
- declare interface BaseOutputFile {
159
- /**
160
- * File format.
161
- */
162
- format: PublishFileFormat;
163
- /**
164
- * URL to download the exported file.
165
- *
166
- * Your app should download from this URL and upload to your platform.
167
- */
168
- url: string;
169
- /**
170
- * Metadata about the source content used to create this exported file.
171
- */
172
- contentMetadata: ContentMetadata;
173
- }
174
-
175
- /**
176
- * @public
177
- * Base interface for all preview types.
178
- *
179
- * Contains common properties shared by all preview types.
180
- */
181
- declare interface BasePreview {
182
- /**
183
- * Unique identifier for this preview.
184
- *
185
- * Use this ID with `requestPreviewUpgrade` to upgrade video thumbnails.
186
- */
187
- id: string;
188
- /**
189
- * Type of media in this preview.
190
- */
191
- kind: PreviewKind;
192
- /**
193
- * Current state of the preview.
194
- */
195
- status: PreviewStatus;
196
- }
197
-
198
- /**
199
- * @public
200
- * Cell containing a boolean value.
201
- *
202
- * @example Creating a boolean cell
203
- * ```ts
204
- * import type { BooleanDataTableCell } from '@canva/intents/data';
205
- *
206
- * const isActiveCell: BooleanDataTableCell = {
207
- * type: 'boolean',
208
- * value: true
209
- * };
210
- * ```
211
- *
212
- * @example Creating a boolean cell with false value
213
- * ```ts
214
- * import type { BooleanDataTableCell } from '@canva/intents/data';
215
- *
216
- * const isCompleteCell: BooleanDataTableCell = {
217
- * type: 'boolean',
218
- * value: false
219
- * };
220
- * ```
221
- *
222
- * @example Creating an empty boolean cell
223
- * ```ts
224
- * import type { BooleanDataTableCell } from '@canva/intents/data';
225
- *
226
- * const emptyBooleanCell: BooleanDataTableCell = {
227
- * type: 'boolean',
228
- * value: undefined
229
- * };
230
- * ```
231
- */
232
- declare type BooleanDataTableCell = {
233
- /**
234
- * Indicates this cell contains a boolean value.
235
- */
236
- type: 'boolean';
237
- /**
238
- * Boolean value (true or false).
239
- *
240
- * Use `undefined` for an empty cell.
241
- */
242
- value: boolean | undefined;
243
- };
244
-
245
- /**
246
- * @public
247
- * Configuration for a table column.
248
- */
249
- declare type ColumnConfig = {
250
- /**
251
- * Name for the column, displayed as header text.
252
- *
253
- * If `undefined`, the column will have no header text.
254
- */
255
- name: string | undefined;
256
- /**
257
- * Expected data type for cells in this column.
258
- *
259
- * Use a specific `DataType` for columns with consistent types,
260
- * or `'variant'` for columns that may contain mixed types.
261
- */
262
- type: DataType | 'variant';
263
- };
264
-
265
- declare namespace content {
266
- export {
267
- prepareContentPublisher,
268
- Disposer,
269
- PublishContentRequest,
270
- RenderSettingsUiInvocationContext,
271
- PublishSettingsUiInvocationContext,
272
- RenderSettingsUiRequest,
273
- OnContextChange,
274
- SettingsUiContext,
275
- PublishSettingsSettingsUiContext,
276
- PublishErrorSettingsUiContext,
277
- PublishErrorClearedSettingsUiContext,
278
- PublishError,
279
- PublishSettings,
280
- PublishRefValidityState,
281
- UpdatePublishSettingsResponse,
282
- UpdatePublishSettingsCompleted,
283
- PublishContentResponse,
284
- PublishContentCompleted,
285
- PostPublishAction,
286
- PostPublishActionRedirect,
287
- PublishContentError,
288
- RemoteRequestFailedError_2 as RemoteRequestFailedError,
289
- AppError_2 as AppError,
290
- ErrorCause,
291
- GetPublishConfigurationResponse,
292
- GetPublishConfigurationCompleted,
293
- GetPublishConfigurationError,
294
- OutputType,
295
- MediaSlot,
296
- ImageRequirement,
297
- VideoRequirement,
298
- DocumentRequirement,
299
- EmailRequirement,
300
- DocumentSize,
301
- PublishFileFormat,
302
- ExactValueRange,
303
- MinValueRange,
304
- MaxValueRange,
305
- MinMaxValueRange,
306
- ValueRange,
307
- DocumentPreview,
308
- DocumentPreviewLoading,
309
- DocumentPreviewThumbnail,
310
- DocumentPreviewError,
311
- ImagePreview,
312
- ImagePreviewLoading,
313
- ImagePreviewReady,
314
- ImagePreviewError,
315
- VideoPreview,
316
- VideoPreviewLoading,
317
- VideoPreviewThumbnail,
318
- VideoPreviewUpgrading,
319
- VideoPreviewReady,
320
- VideoPreviewError,
321
- EmailPreview,
322
- EmailPreviewLoading,
323
- EmailPreviewReady,
324
- EmailPreviewError,
325
- BasePreview,
326
- SizedPreview,
327
- PreviewKind,
328
- PreviewStatus,
329
- OutputMedia,
330
- OutputFile,
331
- ImageOutputFile,
332
- VideoOutputFile,
333
- BaseOutputFile,
334
- DocumentOutputFile,
335
- EmailOutputFile,
336
- ContentMetadata,
337
- DesignContentMetadata,
338
- OutputPageMetadata,
339
- Preview,
340
- PreviewMedia,
341
- RenderPreviewUiInvocationContext,
342
- PublishPreviewUiInvocationContext,
343
- RenderPreviewUiRequest,
344
- ContentPublisherIntent
345
- }
346
- }
347
- export { content }
348
-
349
- /**
350
- * @public
351
- * Metadata about the source content used to create an exported file.
352
- */
353
- declare type ContentMetadata = DesignContentMetadata;
354
-
355
- /**
356
- * @public
357
- * Main interface for implementing the ContentPublisher intent.
358
- *
359
- * Implementing the ContentPublisher intent enables apps to publish contents to external platforms.
360
- * This allows users to configure publish settings, preview their designs, and share with others.
361
- *
362
- * The publishing flow follows this process:
363
- *
364
- * 1. User initiates publish action
365
- * 2. Your app provides publish configuration via `getPublishConfiguration`
366
- * 3. User selects an output type
367
- * 4. Your app renders settings UI via `renderSettingsUi`
368
- * 5. Your app renders preview UI via `renderPreviewUi`
369
- * 6. User reviews settings and preview
370
- * 7. Your app publishes the content via `publishContent`
371
- */
372
- declare type ContentPublisherIntent = {
373
- /**
374
- * Provides the configuration for the publishing platform.
375
- *
376
- * This action is called when the user initiates the publish flow and needs to
377
- * select an output type for the target platform.
378
- *
379
- * Use this to define different publishing configurations for your platform,
380
- * such as social media posts, videos, or other output types.
381
- *
382
- * @returns A promise resolving to the publish configuration or an error
383
- *
384
- * @example Defining publish configuration for a social media platform
385
- * ```ts
386
- * import type { GetPublishConfigurationResponse } from '@canva/intents/content';
387
- *
388
- * async function getPublishConfiguration(): Promise<GetPublishConfigurationResponse> {
389
- * return {
390
- * status: 'completed',
391
- * outputTypes: [
392
- * {
393
- * id: 'instagram_post',
394
- * displayName: 'Instagram Post',
395
- * mediaSlots: [
396
- * {
397
- * id: 'main_image',
398
- * displayName: 'Post Image',
399
- * fileCount: { min: 1, max: 10 },
400
- * accepts: {
401
- * image: { format: 'jpg', aspectRatio: { min: 0.8, max: 1.91 } }
402
- * }
403
- * }
404
- * ]
405
- * }
406
- * ]
407
- * };
408
- * }
409
- * ```
410
- */
411
- getPublishConfiguration: () => Promise<GetPublishConfigurationResponse>;
412
-
413
- /**
414
- * Renders a user interface for configuring publish settings.
415
- *
416
- * This action is called after the user selects an output type. Your UI should
417
- * allow users to configure platform-specific settings such as captions, tags,
418
- * privacy settings, or publishing destinations.
419
- *
420
- * Use the `updatePublishSettings` callback to save user settings and validate them.
421
- * Settings are stored in the `publishRef` string (maximum 5KB).
422
- *
423
- * @param request - Configuration and callbacks for the publish settings UI.
424
- *
425
- * @example Rendering a settings UI with publish configuration
426
- * ```ts
427
- * import { createRoot } from 'react-dom/client';
428
- * import type { RenderSettingsUiRequest } from '@canva/intents/content';
429
- *
430
- * function renderSettingsUi(request: RenderSettingsUiRequest): void {
431
- * const SettingsUiApp = () => (
432
- * <AppUiProvider>
433
- * <SettingsUi request={request} />
434
- * </AppUiProvider>
435
- * );
436
- *
437
- * createRoot().render(<SettingsUiApp />)
438
- * }
439
- * ```
440
- */
441
- renderSettingsUi: (request: RenderSettingsUiRequest) => void;
442
- /**
443
- * Renders a user interface for previewing the content.
444
- *
445
- * This action is called after the settings UI is rendered. Your UI should display
446
- * a preview of how the content will appear on the target platform.
447
- *
448
- * Previews update dynamically as users modify their content or settings. For videos,
449
- * start with lightweight thumbnails and use `requestPreviewUpgrade` to load full
450
- * video previews on demand to optimize performance.
451
- *
452
- * @param request - Configuration and callbacks for the preview UI.
453
- *
454
- * @example Rendering a preview UI with video optimization
455
- * ```ts
456
- * import { createRoot } from 'react-dom/client';
457
- * import type { RenderPreviewUiRequest } from '@canva/intents/content';
458
- *
459
- * function renderPreviewUi(request: RenderPreviewUiRequest): void {
460
- * const PreviewUiApp = () => (
461
- * <AppUiProvider>
462
- * <PreviewUi request={request} />
463
- * </AppUiProvider>
464
- * );
465
- *
466
- * createRoot().render(<PreviewUiApp />)
467
- * }
468
- * ```
469
- */
470
- renderPreviewUi: (request: RenderPreviewUiRequest) => void;
471
- /**
472
- * Publishes the content to the external platform.
473
- *
474
- * This action is called when the user confirms the publish action after reviewing
475
- * settings and preview. Your implementation should send the exported files
476
- * to your platform's API.
477
- *
478
- * The `outputMedia` contains production-ready files that match the requirements
479
- * specified in your output types. The `publishRef` contains the user's settings
480
- * from the settings UI.
481
- *
482
- * @param request - Parameters for the publish operation.
483
- * @returns A promise resolving to either a successful result with the published content details or an error.
484
- *
485
- * @example Publishing content to an external platform
486
- * ```ts
487
- * import type { PublishContentRequest, PublishContentResponse } from '@canva/intents/content';
488
- *
489
- * async function publishContent(request: PublishContentRequest): Promise<PublishContentResponse> {
490
- * const { publishRef, outputType, outputMedia } = request;
491
- *
492
- * try {
493
- * // Parse settings from publishRef
494
- * const settings = publishRef ? JSON.parse(publishRef) : {};
495
- *
496
- * // Upload files to your platform
497
- * const uploadedFiles = await Promise.all(
498
- * outputMedia.flatMap(media =>
499
- * media.files.map(file => uploadFile(file.url))
500
- * )
501
- * );
502
- *
503
- * // Create post on your platform
504
- * const result = await createPost({
505
- * files: uploadedFiles,
506
- * caption: settings.caption
507
- * });
508
- *
509
- * return {
510
- * status: 'completed',
511
- * externalId: result.id,
512
- * externalUrl: result.url
513
- * };
514
- * } catch (error) {
515
- * return {
516
- * status: 'remote_request_failed'
517
- * };
518
- * }
519
- * }
520
- * ```
521
- */
522
- publishContent: (request: PublishContentRequest) => Promise<PublishContentResponse>;
523
-
524
- };
525
-
526
- declare namespace data {
527
- export {
528
- prepareDataConnector,
529
- DataConnectorIntent,
530
- GetDataTableRequest,
531
- RenderSelectionUiRequest,
532
- InvocationContext,
533
- GetDataTableResponse,
534
- GetDataTableCompleted,
535
- DataTableMetadata,
536
- GetDataTableError,
537
- UpdateDataRefResponse,
538
- DataSourceRef
539
- }
540
- }
541
- export { data }
542
-
543
- /**
544
- * @public
545
- * Main interface for implementing the Data Connector intent.
546
- *
547
- * Implementing the Data Connector intent enables apps to import external data into Canva.
548
- * This allows users to select, preview, and refresh data from external sources.
549
- */
550
- declare type DataConnectorIntent = {
551
- /**
552
- * Gets structured data from an external source.
553
- *
554
- * This action is called in two scenarios:
555
- *
556
- * - During data selection to preview data before import (when {@link RenderSelectionUiRequest.updateDataRef} is called).
557
- * - When refreshing previously imported data (when the user requests an update).
558
- *
559
- * @param request - Parameters for the data fetching operation.
560
- * @returns A promise resolving to either a successful result with data or an error.
561
- *
562
- * @example Getting data from an external source
563
- * ```ts
564
- * import type { GetDataTableRequest, GetDataTableResponse } from '@canva/intents/data';
565
- *
566
- * async function getDataTable(request: GetDataTableRequest): Promise<GetDataTableResponse> {
567
- * const { dataSourceRef, limit, signal } = request;
568
- *
569
- * // Check if the operation has been aborted.
570
- * if (signal.aborted) {
571
- * return { status: 'app_error', message: 'The data fetch operation was cancelled.' };
572
- * }
573
- *
574
- * // ... data fetching logic using dataSourceRef, limit, and signal ...
575
- *
576
- * // Placeholder for a successful result.
577
- * return {
578
- * status: 'completed',
579
- * dataTable: { rows: [{ cells: [{ type: 'string', value: 'Fetched data' }] }] }
580
- * };
581
- * }
582
- * ```
583
- */
584
- getDataTable: (request: GetDataTableRequest) => Promise<GetDataTableResponse>;
585
-
586
- /**
587
- * Renders a user interface for selecting and configuring data from your external sources.
588
- *
589
- * @param request - Configuration and callbacks for the data selection UI.
590
- *
591
- * @example Rendering a data selection UI
592
- * ```ts
593
- * import type { RenderSelectionUiRequest } from '@canva/intents/data';
594
- *
595
- * async function renderSelectionUi(request: RenderSelectionUiRequest): Promise<void> {
596
- * // UI rendering logic.
597
- * // Example: if user selects data 'ref123'.
598
- * const selectedRef = { source: 'ref123', title: 'My Selected Table' };
599
- * try {
600
- * const result = await request.updateDataRef(selectedRef);
601
- * if (result.status === 'completed') {
602
- * console.log('Selection valid and preview updated.');
603
- * } else {
604
- * console.error('Selection error:', result.status);
605
- * }
606
- * } catch (error) {
607
- * console.error('An unexpected error occurred during data ref update:', error);
608
- * }
609
- * }
610
- * ```
611
- */
612
- renderSelectionUi: (request: RenderSelectionUiRequest) => void;
613
- };
614
-
615
- /**
616
- * @public
617
- * {@link InvocationContext} indicating initial data selection flow or edit of existing data.
618
- */
619
- declare type DataSelectionInvocationContext = {
620
- /**
621
- * Initial data selection or editing existing data.
622
- *
623
- * This is the standard flow when:
624
- *
625
- * - A user is selecting data for the first time
626
- * - A user is editing a previous selection
627
- *
628
- * If `dataSourceRef` is provided, this indicates an edit flow, and you should
629
- * pre-populate your UI with this selection.
630
- */
631
- reason: 'data_selection';
632
- /**
633
- * If dataSourceRef is provided, this is an edit of existing data flow and UI should be pre-populated.
634
- */
635
- dataSourceRef?: DataSourceRef;
636
- };
637
-
638
- /**
639
- * @public
640
- * Reference to an external data source that can be used to fetch data.
641
- * Created by Data Connector apps and stored by Canva for data refresh operations.
642
- *
643
- * You create this object in your data selection UI and pass it to the
644
- * `updateDataRef` callback. Canva stores this reference and uses it for
645
- * future data refresh operations.
646
- *
647
- * Maximum size: 5KB
648
- *
649
- * @example Defining how to locate external data
650
- * ```ts
651
- * const dataSourceRef: DataSourceRef = {
652
- * source: JSON.stringify({
653
- * reportId: "monthly_sales_001",
654
- * filters: { year: 2023, region: "NA" }
655
- * }),
656
- * title: "Monthly Sales Report (NA, 2023)"
657
- * };
658
- * ```
659
- */
660
- declare type DataSourceRef = {
661
- /**
662
- * Information needed to identify and retrieve data from your source.
663
- *
664
- * This string should contain all the information your app needs to
665
- * fetch the exact data selection later. Typically, this is a serialized
666
- * object with query parameters, identifiers, or filters.
667
- *
668
- * You are responsible for encoding and decoding this value appropriately.
669
- *
670
- * Maximum size: 5KB
671
- */
672
- source: string;
673
- /**
674
- * A human-readable description of the data reference.
675
- *
676
- * This title may be displayed to users in the Canva interface to help
677
- * them identify the data source.
678
- *
679
- * Maximum length: 255 characters
680
- */
681
- title?: string;
682
- };
683
-
684
- /**
685
- * @public
686
- * Structured tabular data for import into Canva.
687
- *
688
- * This format allows you to provide typed data with proper formatting
689
- * to ensure it displays correctly in Canva designs.
690
- *
691
- * @example Creating a data table
692
- * ```ts
693
- * import type { ColumnConfig, DataTableCell, DataTable, DataTableRow } from '@canva/intents/data';
694
- *
695
- * const myTable: DataTable = {
696
- * columnConfigs: [
697
- * { name: 'Name', type: 'string' },
698
- * { name: 'Age', type: 'number' },
699
- * { name: 'Subscribed', type: 'boolean' },
700
- * { name: 'Join Date', type: 'date' }
701
- * ],
702
- * rows: [
703
- * {
704
- * cells: [
705
- * { type: 'string', value: 'Alice' },
706
- * { type: 'number', value: 30 },
707
- * { type: 'boolean', value: true },
708
- * { type: 'date', value: Math.floor(new Date('2023-01-15').getTime() / 1000) }
709
- * ]
710
- * },
711
- * {
712
- * cells: [
713
- * { type: 'string', value: 'Bob' },
714
- * { type: 'number', value: 24 },
715
- * { type: 'boolean', value: false },
716
- * { type: 'date', value: Math.floor(new Date('2022-07-20').getTime() / 1000) }
717
- * ]
718
- * }
719
- * ]
720
- * };
721
- * ```
722
- */
723
- declare type DataTable = {
724
- /**
725
- * Column definitions with names and data types.
726
- *
727
- * These help Canva interpret and display your data correctly.
728
- */
729
- columnConfigs?: ColumnConfig[];
730
- /**
731
- * The data rows containing the actual values.
732
- *
733
- * Each row contains an array of cells with typed data values.
734
- */
735
- rows: DataTableRow[];
736
- };
737
-
738
- /**
739
- * @public
740
- * Generic type for table cells that resolves to a specific cell type.
741
- */
742
- declare type DataTableCell<T extends DataType = DataType> = {
743
- date: DateDataTableCell;
744
- string: StringDataTableCell;
745
- number: NumberDataTableCell;
746
- boolean: BooleanDataTableCell;
747
- media: MediaCollectionDataTableCell;
748
- }[T];
749
-
750
- /**
751
- * @public
752
- * Options for uploading an image asset to the user's private media library.
753
- */
754
- declare type DataTableImageUpload = Omit<ImageUploadOptions, 'type' | 'parentRef'> & {
755
- /**
756
- * Indicates this value contains options for image uploading.
757
- */
758
- type: 'image_upload';
759
- };
760
-
761
- /**
762
- * @public
763
- * Maximum dimensions for imported data tables.
764
- */
765
- declare type DataTableLimit = {
766
- /**
767
- * The maximum number of rows allowed.
768
- *
769
- * Your app should ensure data does not exceed this limit.
770
- */
771
- row: number;
772
- /**
773
- * The maximum number of columns allowed.
774
- *
775
- * Your app should ensure data does not exceed this limit.
776
- */
777
- column: number;
778
- };
779
-
780
- /**
781
- * @public
782
- * Metadata providing additional context about the imported data.
783
- */
784
- declare type DataTableMetadata = {
785
- /**
786
- * A human-readable description of the dataset.
787
- *
788
- * This description helps users understand what data they are importing.
789
- */
790
- description?: string;
791
- /**
792
- * Information about the data provider or source.
793
- */
794
- providerInfo?: {
795
- /**
796
- * Name of the data provider.
797
- */
798
- name: string;
799
- /**
800
- * URL to the provider's website or related resource.
801
- */
802
- url?: string;
803
- };
804
- };
805
-
806
- /**
807
- * @public
808
- * A row in the data table.
809
- *
810
- * @example Creating a single row of data cells
811
- * ```ts
812
- * import type { DataTableCell, DataTableRow } from '@canva/intents/data';
813
- *
814
- * const row: DataTableRow = {
815
- * cells: [
816
- * { type: 'string', value: 'Product Alpha' },
817
- * { type: 'number', value: 199.99 },
818
- * { type: 'boolean', value: true }
819
- * ]
820
- * };
821
- * ```
822
- */
823
- declare type DataTableRow = {
824
- /**
825
- * Array of cells containing the data values.
826
- *
827
- * Each cell must have a type that matches the corresponding column definition (if provided).
828
- */
829
- cells: DataTableCell<DataType>[];
830
- };
831
-
832
- /**
833
- * @public
834
- * Options for uploading a video asset to the user's private media library.
835
- */
836
- declare type DataTableVideoUpload = Omit<VideoUploadOptions, 'type' | 'parentRef'> & {
837
- /**
838
- * Indicates this value contains options for video uploading.
839
- */
840
- type: 'video_upload';
841
- };
842
-
843
- /**
844
- * @public
845
- * Data types supported for table cells.
846
- */
847
- declare type DataType = 'string' | 'number' | 'date' | 'boolean' | 'media';
848
-
849
- /**
850
- * @public
851
- * Cell containing a date value.
852
- *
853
- * @example Creating a date cell
854
- * ```ts
855
- * import type { DateDataTableCell } from '@canva/intents/data';
856
- *
857
- * const todayCell: DateDataTableCell = {
858
- * type: 'date',
859
- * value: Math.floor(Date.now() / 1000) // Unix timestamp in seconds
860
- * };
861
- *
862
- * const emptyDateCell: DateDataTableCell = {
863
- * type: 'date',
864
- * value: undefined
865
- * };
866
- * ```
867
- */
868
- declare type DateDataTableCell = {
869
- /**
870
- * Indicates this cell contains a date value.
871
- */
872
- type: 'date';
873
- /**
874
- * Unix timestamp in seconds representing the date.
875
- *
876
- * Use `undefined` for an empty cell.
877
- */
878
- value: number | undefined;
879
- };
880
-
881
- declare namespace design {
882
- export {
883
- prepareDesignEditor,
884
- DesignEditorIntent
885
- }
886
- }
887
- export { design }
888
-
889
- /**
890
- * @public
891
- * Metadata specific to design content.
892
- */
893
- declare interface DesignContentMetadata {
894
- type: 'design';
895
- /**
896
- * A signed JWT token containing the design id
897
- */
898
- designToken: string;
899
- /**
900
- * The user given title of the design
901
- */
902
- title: string | undefined;
903
- /**
904
- * The pages that make up the exported metadata
905
- */
906
- pages: OutputPageMetadata[];
907
- }
908
-
909
- /**
910
- * @public
911
- *
912
- * Main interface for implementing the DesignEditor intent.
913
- *
914
- * Implementing the DesignEditor Intent enables apps to assist users in editing designs,
915
- * by presenting interactive and creative tooling alongside the Canva design surface.
916
- */
917
- declare type DesignEditorIntent = {
918
- /**
919
- * Renders the UI containing the app’s functionality.
920
- *
921
- * @example
922
- * ```tsx
923
- * function render() {
924
- * // render your UI using your preferred framework
925
- * }
926
- * ```
927
- */
928
- render: () => void;
929
- };
930
-
931
- /**
932
- * @public
933
- * A set of dimensions.
934
- */
935
- declare type Dimensions = {
936
- /**
937
- * A width, in pixels.
938
- */
939
- width: number;
940
- /**
941
- * A height, in pixels.
942
- */
943
- height: number;
944
- };
945
-
946
- /**
947
- * @public
948
- * A function that can be called to dispose of a callback.
949
- */
950
- declare type Disposer = () => void;
951
-
952
- /**
953
- * @public
954
- * Exported PDF file ready for publishing.
955
- *
956
- * Contains the final PDF document that should be uploaded to your platform.
957
- * The document format is `pdf_standard` and the file is ready to use.
958
- */
959
- declare type DocumentOutputFile = BaseOutputFile;
960
-
961
- /**
962
- * @public
963
- * Document preview in various states.
964
- *
965
- * Documents transition through states: `"loading"` → `"thumbnail"`.
966
- * Start with a lightweight thumbnail of the first page for quick preview rendering.
967
- */
968
- declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewError;
969
-
970
- /**
971
- * @public
972
- * Document preview that failed to generate.
973
- *
974
- * Display an error state to the user.
975
- */
976
- declare interface DocumentPreviewError extends SizedPreview {
977
- kind: 'document';
978
- status: 'error';
979
- /**
980
- * The error message to display to the user.
981
- */
982
- message: string;
983
- }
984
-
985
- /**
986
- * @public
987
- * Document preview that is currently being generated.
988
- *
989
- * Display a loading state until the preview transitions to `"thumbnail"` or `"error"`.
990
- */
991
- declare interface DocumentPreviewLoading extends SizedPreview {
992
- kind: 'document';
993
- status: 'loading';
994
- }
995
-
996
- /**
997
- * @public
998
- * Document preview with first page thumbnail available.
999
- *
1000
- * This is the initial state for document previews. Show the thumbnail image
1001
- * of the first page along with the page count to give users a preview of
1002
- * the document before publishing.
1003
- */
1004
- declare interface DocumentPreviewThumbnail extends SizedPreview {
1005
- kind: 'document';
1006
- status: 'thumbnail';
1007
- /**
1008
- * Format of the thumbnail image.
1009
- */
1010
- thumbnailFormat: 'png' | 'jpg';
1011
- /**
1012
- * URL to the first page thumbnail.
1013
- *
1014
- * Display this lightweight image to preview the document content.
1015
- */
1016
- thumbnailUrl: string;
1017
- }
1018
-
1019
- /**
1020
- * @public
1021
- * Document file requirements for a media slot.
1022
- *
1023
- * Note: Document output types use image previews (PNG thumbnails) in the preview UI.
1024
- * The actual document file is only generated for the final output in OutputMedia.
1025
- *
1026
- * @example Document requirements
1027
- * ```ts
1028
- * const documentReq: DocumentRequirement = {
1029
- * format: 'pdf_standard',
1030
- * size: 'a4',
1031
- * };
1032
- * ```
1033
- */
1034
- declare interface DocumentRequirement extends BaseFileRequirement {
1035
- /**
1036
- * Supported document export format.
1037
- * Currently supports PDF standard format.
1038
- */
1039
- format: 'pdf_standard';
1040
- /**
1041
- * The document size of the export file.
1042
- */
1043
- size: DocumentSize;
1044
- }
1045
-
1046
- /**
1047
- * @public
1048
- * Document size for document exports.
1049
- */
1050
- declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
1051
-
1052
- /**
1053
- * @beta
1054
- * Exported email file ready for publishing.
1055
- *
1056
- * Contains the final HTML bundle that should be uploaded to your platform.
1057
- */
1058
- declare type EmailOutputFile = BaseOutputFile;
1059
-
1060
- /**
1061
- * @beta
1062
- * Email preview in various states.
1063
- *
1064
- * Display a loading state until the preview transitions to `"ready"` or `"error"`.
1065
- */
1066
- declare type EmailPreview = EmailPreviewLoading | EmailPreviewReady | EmailPreviewError;
1067
-
1068
- /**
1069
- * @beta
1070
- * Email preview in an error state.
1071
- *
1072
- * Display an error state to the user.
1073
- */
1074
- declare interface EmailPreviewError extends BasePreview {
1075
- kind: 'email';
1076
- status: 'error';
1077
- message: string;
1078
- }
1079
-
1080
- /**
1081
- * @beta
1082
- * Email preview in a loading state.
1083
- *
1084
- * Display a loading spinner until the preview transitions to `"ready"` or `"error"`.
1085
- */
1086
- declare interface EmailPreviewLoading extends BasePreview {
1087
- kind: 'email';
1088
- status: 'loading';
1089
- }
1090
-
1091
- /**
1092
- * @beta
1093
- * Email preview in a ready state.
1094
- *
1095
- * Display the email preview.
1096
- */
1097
- declare interface EmailPreviewReady extends BasePreview {
1098
- kind: 'email';
1099
- status: 'ready';
1100
- /**
1101
- * URL to the single html file that represents the email.
1102
- */
1103
- url: string;
1104
- }
1105
-
1106
- /**
1107
- * Email preview stub used before beta preview type is fully supported.
1108
- */
1109
- declare interface EmailPreviewStub extends BasePreview {
1110
- kind: 'email';
1111
- }
1112
-
1113
- /**
1114
- * @beta
1115
- * Email file requirements for a media slot, currently only supports HTML bundle format.
1116
- *
1117
- * Note: Email output types use html_standalone previews in the preview UI.
1118
- * The actual email file is only generated for the final output in OutputMedia.
1119
- *
1120
- * @example Email bundle requirements
1121
- * ```ts
1122
- * const emailReq: EmailRequirement = {
1123
- * format: 'html_bundle',
1124
- * };
1125
- * ```
1126
- */
1127
- declare interface EmailRequirement extends BaseFileRequirement {
1128
- format: 'html_bundle' | 'html_standalone';
1129
- }
1130
-
1131
- /**
1132
- * @public
1133
- *
1134
- * The cause of an error
1135
- */
1136
- declare type ErrorCause = 'invalid_selection' | 'invalid_format';
1137
-
1138
- /**
1139
- * @public
1140
- * Exact value range constraint.
1141
- * @example Exact value range
1142
- * ```ts
1143
- * const exactValue: ValueRange = { exact: 1 }; // Must be exactly 1
1144
- * ```
1145
- */
1146
- declare type ExactValueRange = {
1147
- exact: number;
1148
- };
1149
-
1150
- /**
1151
- * @public
1152
- * Successful result from `getDataTable` action.
1153
- */
1154
- declare type GetDataTableCompleted = {
1155
- /**
1156
- * Indicates the operation completed successfully
1157
- */
1158
- status: 'completed';
1159
- /**
1160
- * The fetched data formatted as a data table.
1161
- */
1162
- dataTable: DataTable;
1163
- /**
1164
- * Optional metadata providing additional context about the data.
1165
- */
1166
- metadata?: DataTableMetadata;
1167
- };
1168
-
1169
- /**
1170
- * @public
1171
- * Error results that can be returned from `getDataTable` method.
1172
- */
1173
- declare type GetDataTableError = OutdatedSourceRefError | RemoteRequestFailedError | AppError;
1174
-
1175
- /**
1176
- * @public
1177
- * Parameters for the getDataTable action.
1178
- */
1179
- declare type GetDataTableRequest = {
1180
- /**
1181
- * Reference to the data source to fetch.
1182
- *
1183
- * This contains the information needed to identify and retrieve the specific data
1184
- * that was previously selected by the user.
1185
- *
1186
- * Use this to query your external data service.
1187
- */
1188
- dataSourceRef: DataSourceRef;
1189
- /**
1190
- * Maximum row and column limits for the imported data.
1191
- *
1192
- * Your app must ensure the returned data does not exceed these limits.
1193
- *
1194
- * If the requested data would exceed these limits, either:
1195
- *
1196
- * - Truncate the data to fit within limits, or
1197
- * - Return a 'data_table_limit_exceeded' error
1198
- */
1199
- limit: DataTableLimit;
1200
- /**
1201
- * Standard DOM AbortSignal for cancellation support.
1202
- *
1203
- * Your app should monitor this signal and abort any ongoing operations if it becomes aborted.
1204
- */
1205
- signal: AbortSignal;
1206
- };
1207
-
1208
- /**
1209
- * @public
1210
- * Result returned from the `getDataTable` action.
1211
- */
1212
- declare type GetDataTableResponse = GetDataTableCompleted | GetDataTableError;
1213
-
1214
- /**
1215
- * @public
1216
- * Successful response from getting publish configuration.
1217
- */
1218
- declare type GetPublishConfigurationCompleted = {
1219
- status: 'completed';
1220
- /**
1221
- * Array of available output types for your platform.
1222
- *
1223
- * Define different output types for various content formats that
1224
- * your platform supports (e.g., posts, stories, videos).
1225
- */
1226
- outputTypes: OutputType[];
1227
- };
1228
-
1229
- /**
1230
- * @public
1231
- * {@link GetPublishConfigurationError} error indicating a custom error occurred.
1232
- */
1233
- declare type GetPublishConfigurationError = AppError_2;
1234
-
1235
- /**
1236
- * @public
1237
- * Response from getting publish configuration.
1238
- */
1239
- declare type GetPublishConfigurationResponse = GetPublishConfigurationCompleted | GetPublishConfigurationError;
1240
-
1241
- /**
1242
- * @public
1243
- * The MIME type of an image file that's supported by Canva's backend.
1244
- */
1245
- declare type ImageMimeType = 'image/jpeg' | 'image/heic' | 'image/png' | 'image/svg+xml' | 'image/webp' | 'image/tiff';
1246
-
1247
- /**
1248
- * @public
1249
- * Exported image file ready for publishing.
1250
- */
1251
- declare interface ImageOutputFile extends BaseOutputFile {
1252
- /**
1253
- * Width of the image in pixels.
1254
- */
1255
- widthPx: number;
1256
- /**
1257
- * Height of the image in pixels.
1258
- */
1259
- heightPx: number;
1260
- }
1261
-
1262
- /**
1263
- * @public
1264
- * Image preview in various states.
1265
- */
1266
- declare type ImagePreview = ImagePreviewLoading | ImagePreviewReady | ImagePreviewError;
1267
-
1268
- /**
1269
- * @public
1270
- * Image preview that failed to generate.
1271
- *
1272
- * Display an error state to the user.
1273
- */
1274
- declare interface ImagePreviewError extends SizedPreview {
1275
- kind: 'image';
1276
- status: 'error';
1277
-
1278
- /**
1279
- * The error message to display to the user.
1280
- */
1281
- message: string;
1282
- }
1283
-
1284
- /**
1285
- * @public
1286
- * Image preview that is currently being generated.
1287
- *
1288
- * Display a loading state until the preview transitions to `"ready"` or `"error"`.
1289
- */
1290
- declare interface ImagePreviewLoading extends SizedPreview {
1291
- kind: 'image';
1292
- status: 'loading';
1293
- }
1294
-
1295
- /**
1296
- * @public
1297
- * Image preview that is ready to display.
1298
- *
1299
- * Contains the URL to the preview image.
1300
- */
1301
- declare interface ImagePreviewReady extends SizedPreview {
1302
- kind: 'image';
1303
- status: 'ready';
1304
- /**
1305
- * Image format of the preview.
1306
- */
1307
- format: 'png' | 'jpg';
1308
- /**
1309
- * URL to the preview image.
1310
- *
1311
- * Use this URL to display the preview to users.
1312
- */
1313
- url: string;
1314
- }
1315
-
1316
- /**
1317
- * @public
1318
- * A unique identifier that points to an image asset in Canva's backend.
1319
- */
1320
- declare type ImageRef = string & {
1321
- __imageRef: never;
1322
- };
1323
-
1324
- /**
1325
- * @public
1326
- * Image file requirements for a media slot.
1327
- *
1328
- * Specifies format, aspect ratio, and size constraints for images.
1329
- *
1330
- * @example Image requirements for social media post
1331
- * ```ts
1332
- * const imageReq: ImageRequirement = {
1333
- * format: 'jpg',
1334
- * aspectRatio: { min: 0.8, max: 1.91 },
1335
- * };
1336
- * ```
1337
- */
1338
- declare interface ImageRequirement extends BaseFileRequirement {
1339
- /**
1340
- * Supported image format.
1341
- */
1342
- format: 'png' | 'jpg';
1343
- /**
1344
- * Aspect ratio constraint (width / height).
1345
- *
1346
- * Examples:
1347
- * - `{ exact: 16/9 }`: Widescreen (16:9)
1348
- * - `{ min: 0.8, max: 1.91 }`: Instagram range
1349
- */
1350
- aspectRatio?: ValueRange;
1351
- }
1352
-
1353
- /**
1354
- * @public
1355
- * Options for uploading an image asset to the user's private media library.
1356
- */
1357
- declare type ImageUploadOptions = {
1358
- /**
1359
- * The type of asset.
1360
- */
1361
- type: 'image';
1362
- /**
1363
- * A human-readable name for the image asset.
1364
- *
1365
- * @remarks
1366
- * This name is displayed in the user's media library and helps users identify
1367
- * and find the asset later. If not provided, Canva will generate a name based
1368
- * on the asset's URL or a unique identifier.
1369
- *
1370
- * Requirements:
1371
- * - Minimum length: 1 character (empty strings are not allowed)
1372
- * - Maximum length: 255 characters
1373
- */
1374
- name?: string;
1375
- /**
1376
- * The ref of the original asset from which this new asset was derived.
1377
- *
1378
- * @remarks
1379
- * For example, if an app applies an effect to an image, `parentRef` should contain the ref of the original image.
1380
- */
1381
- parentRef?: ImageRef;
1382
- /**
1383
- * The URL of the image file to upload.
1384
- * This can be an external URL or a data URL.
1385
- *
1386
- * @remarks
1387
- * Requirements for external URLs:
1388
- *
1389
- * - Must use HTTPS
1390
- * - Must return a `200` status code
1391
- * - `Content-Type` must match the file's MIME type
1392
- * - Must be publicly accessible (i.e. not a localhost URL)
1393
- * - Must not redirect
1394
- * - Must not contain an IP address
1395
- * - Maximum length: 4096 characters
1396
- * - Must not contain whitespace
1397
- * - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
1398
- * - Maximum file size: 50MB
1399
- *
1400
- * Requirements for data URLs:
1401
- *
1402
- * - Must include `;base64` for base64-encoded data
1403
- * - Maximum size: 10MB (10 × 1024 × 1024 characters)
1404
- *
1405
- * Requirements for SVGs:
1406
- *
1407
- * - Disallowed elements:
1408
- * - `a`
1409
- * - `altglyph`
1410
- * - `altglyphdef`
1411
- * - `altglyphitem`
1412
- * - `animate`
1413
- * - `animatemotion`
1414
- * - `animatetransform`
1415
- * - `cursor`
1416
- * - `discard`
1417
- * - `font`
1418
- * - `font-face`
1419
- * - `font-face-format`
1420
- * - `font-face-name`
1421
- * - `font-face-src`
1422
- * - `font-face-uri`
1423
- * - `foreignobject`
1424
- * - `glyph`
1425
- * - `glyphref`
1426
- * - `missing-glyph`
1427
- * - `mpath`
1428
- * - `script`
1429
- * - `set`
1430
- * - `switch`
1431
- * - `tref`
1432
- * - Disallowed attributes:
1433
- * - `crossorigin`
1434
- * - `lang`
1435
- * - `media`
1436
- * - `onload`
1437
- * - `ping`
1438
- * - `referrerpolicy`
1439
- * - `rel`
1440
- * - `rendering-intent`
1441
- * - `requiredextensions`
1442
- * - `requiredfeatures`
1443
- * - `systemlanguage`
1444
- * - `tabindex`
1445
- * - `transform-origin`
1446
- * - `unicode`
1447
- * - `vector-effect`
1448
- * - The `href` attribute of an `image` element only supports data URLs for PNG and JPEG images.
1449
- * - The URL in the `href` attribute must not point to a location outside of the SVG.
1450
- * - The `style` attribute must not use the `mix-blend-mode` property.
1451
- */
1452
- url: string;
1453
- /**
1454
- * The MIME type of the image file.
1455
- */
1456
- mimeType: ImageMimeType;
1457
- /**
1458
- * The URL of a thumbnail image to display while the image is queued for upload.
1459
- * This can be an external URL or a data URL.
1460
- *
1461
- * @remarks
1462
- * Requirements for external URLs:
1463
- *
1464
- * - Must use HTTPS
1465
- * - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
1466
- * - Must be a PNG, JPEG, or SVG file
1467
- * - Maximum length: 4096 characters
1468
- *
1469
- * Requirements for data URLs:
1470
- *
1471
- * - Must include `;base64` for base64-encoded data
1472
- * - Maximum size: 10MB (10 × 1024 × 1024 characters)
1473
- */
1474
- thumbnailUrl: string;
1475
- /**
1476
- * A disclosure identifying if the app generated this image using AI
1477
- *
1478
- * @remarks
1479
- * Helps users make informed decisions about the content they interact with.
1480
- * See {@link AiDisclosure} for the full definition.
1481
- *
1482
- * **App Generated**
1483
- *
1484
- * 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
1485
- * the app requests a third-party service to take similar action on an image using AI.
1486
- *
1487
- * Required for the following cases (this list is not exhaustive):
1488
- * | Case | Reason |
1489
- * | -- | -- |
1490
- * | AI generates a new image from scratch | Creates new creative content |
1491
- * | AI changes the style of the image e.g. makes it cartoon | Significantly alters the style |
1492
- * | AI removes an object and replaces it with new content | Creates new creative content |
1493
- * | AI changes the facial expression of a person in an image | Can alter content's original meaning |
1494
- * | AI composites multiple images together | Significantly alters context |
1495
- * | AI expands an image by generating new content to fill the edges | Creates new creative content |
1496
- * | AI replaces background by generating new content | Creates new creative content |
1497
- *
1498
- * **None**
1499
- *
1500
- * 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of a request
1501
- * to third-party hosted content.
1502
- *
1503
- * Required for the following cases (this list is not exhaustive):
1504
- * | Case | Reason |
1505
- * | -- | -- |
1506
- * | Asset comes from an asset library | Didn't generate the asset itself |
1507
- * | AI corrects red eyes | A minor correction |
1508
- * | AI removes background without replacement | Doesn't change original meaning by itself |
1509
- * | AI changes the color of an object in an image | Doesn't change original meaning by itself |
1510
- * | AI detects image defects and suggests manual fixes | Didn't change the asset itself |
1511
- * | AI adjusts brightness and contrast on an image | Doesn't change original meaning by itself |
1512
- * | AI upscales an image | Doesn't change original meaning by itself |
1513
- */
1514
- aiDisclosure: AiDisclosure;
1515
-
1516
- } & AllOrNone<Dimensions>;
1517
-
1518
- /**
1519
- * @public
1520
- * Information explaining why the data selection UI was launched.
1521
- */
1522
- declare type InvocationContext = DataSelectionInvocationContext | OutdatedSourceRefInvocationContext | AppErrorInvocationContext;
1523
-
1524
- /**
1525
- * @public
1526
- * Maximum value range constraint.
1527
- * @example Maximum value range
1528
- * ```ts
1529
- * const maxValue: ValueRange = { max: 10 }; // At most 10
1530
- * ```
1531
- */
1532
- declare type MaxValueRange = {
1533
- max: number;
1534
- };
1535
-
1536
- /**
1537
- * @public
1538
- * Cell containing a media collection (images) value.
1539
- *
1540
- * @example Creating a media cell with an image
1541
- * ```ts
1542
- * import type { MediaCollectionDataTableCell } from '@canva/intents/data';
1543
- *
1544
- * const mediaCell: MediaCollectionDataTableCell = {
1545
- * type: 'media',
1546
- * value: [{
1547
- * type: 'image_upload',
1548
- * url: 'https://www.canva.dev/example-assets/image-import/image.jpg',
1549
- * mimeType: 'image/jpeg',
1550
- * thumbnailUrl: 'https://www.canva.dev/example-assets/image-import/thumbnail.jpg',
1551
- * aiDisclosure: 'none'
1552
- * }]
1553
- * };
1554
- * ```
1555
- *
1556
- * @example Creating an empty media cell
1557
- * ```ts
1558
- * import type { MediaCollectionDataTableCell } from '@canva/intents/data';
1559
- *
1560
- * const emptyMediaCell: MediaCollectionDataTableCell = {
1561
- * type: 'media',
1562
- * value: []
1563
- * };
1564
- * ```
1565
- */
1566
- declare type MediaCollectionDataTableCell = {
1567
- /**
1568
- * Indicates this cell contains a media collection.
1569
- */
1570
- type: 'media';
1571
- /**
1572
- * Media collection values.
1573
- *
1574
- * Use empty array for an empty cell.
1575
- */
1576
- value: (DataTableImageUpload | DataTableVideoUpload)[];
1577
- };
1578
-
1579
- /**
1580
- * @public
1581
- * Configuration for a media slot within an output type.
1582
- *
1583
- * Defines what type of media is accepted, requirements, and constraints.
1584
- *
1585
- * @example Image slot with aspect ratio requirements
1586
- * ```ts
1587
- * const thumbnailSlot: MediaSlot = {
1588
- * id: 'thumbnail',
1589
- * displayName: 'Video Thumbnail',
1590
- * fileCount: { exact: 1 },
1591
- * accepts: {
1592
- * image: {
1593
- * format: 'jpg',
1594
- * aspectRatio: { exact: 16/9 },
1595
- * }
1596
- * }
1597
- * };
1598
- * ```
1599
- */
1600
- declare type MediaSlot = {
1601
- /**
1602
- * Unique identifier for this media slot within the output type.
1603
- */
1604
- id: string;
1605
- /**
1606
- * User-facing name for this media slot.
1607
- *
1608
- * Examples: `"Post Image"`, `"Video Thumbnail"`, `"Main Video"`.
1609
- */
1610
- displayName: string;
1611
- /**
1612
- * Number of files accepted in this slot.
1613
- *
1614
- * Use this to specify single or multiple file requirements.
1615
- * Examples:
1616
- * - `{ exact: 1 }`: Exactly one file
1617
- * - `{ min: 1, max: 10 }`: Between 1 and 10 files
1618
- * - undefined: Any number of files
1619
- */
1620
- fileCount?: ValueRange;
1621
- /**
1622
- * File type requirements for this slot.
1623
- *
1624
- * Note the following behavior:
1625
- *
1626
- * - Provide at least one of `image` or `video`
1627
- * - If both are provided, files for this slot may be either images or videos; each file
1628
- * must satisfy the corresponding requirement for its media type
1629
- * - To restrict the slot to a single media type, provide only that requirement
1630
- * - `fileCount` applies across all files accepted by the slot regardless of media type
1631
- * - Document output types will show image previews (PNG thumbnail) in preview UI
1632
- */
1633
- accepts: {
1634
- image?: ImageRequirement;
1635
- video?: VideoRequirement;
1636
- document?: DocumentRequirement;
1637
- /**
1638
- * @beta
1639
- * Email output types will show a single html file (canva hosted assets) preview in preview UI
1640
- */
1641
- email?: EmailRequirement;
1642
- };
1643
- };
1644
-
1645
- /**
1646
- * @public
1647
- * Minimum and maximum value range constraint.
1648
- * Ranges are inclusive `(min ≤ value ≤ max)`.
1649
- * @example Minimum and maximum value range
1650
- * ```ts
1651
- * const minMaxValue: ValueRange = { min: 1, max: 10 }; // Between 1 and 10
1652
- * ```
1653
- */
1654
- declare type MinMaxValueRange = {
1655
- min: number;
1656
- max: number;
1657
- };
1658
-
1659
- /**
1660
- * @public
1661
- * Minimum value range constraint.
1662
- * @example Minimum value range
1663
- * ```ts
1664
- * const minValue: ValueRange = { min: 3 }; // At least 3
1665
- * ```
1666
- */
1667
- declare type MinValueRange = {
1668
- min: number;
1669
- };
1670
-
1671
- declare type Never<T> = {
1672
- [key in keyof T]?: never;
1673
- };
1674
-
1675
- /**
1676
- * @public
1677
- * Formatting metadata for number cells.
1678
- *
1679
- * @example Formatting as currency
1680
- * ```ts
1681
- * import type { NumberDataTableCell } from '@canva/intents/data';
1682
- *
1683
- * const currencyCell: NumberDataTableCell = {
1684
- * type: 'number',
1685
- * value: 1234.57,
1686
- * metadata: { formatting: '[$$]#,##0.00' }
1687
- * };
1688
- * ```
1689
- *
1690
- * @example Formatting as a percentage
1691
- * ```ts
1692
- * import type { NumberDataTableCell } from '@canva/intents/data';
1693
- *
1694
- * const percentCell: NumberDataTableCell = {
1695
- * type: 'number',
1696
- * value: 0.1234,
1697
- * metadata: { formatting: '0.00%' }
1698
- * };
1699
- * ```
1700
- *
1701
- * @example Applying a thousands separator
1702
- * ```ts
1703
- * import type { NumberDataTableCell } from '@canva/intents/data';
1704
- *
1705
- * const largeNumberCell: NumberDataTableCell = {
1706
- * type: 'number',
1707
- * value: 1234567.89234,
1708
- * metadata: { formatting: '#,##0.00' }
1709
- * };
1710
- * ```
1711
- */
1712
- declare type NumberCellMetadata = {
1713
- /**
1714
- * Formatting pattern using Office Open XML Format.
1715
- *
1716
- * These patterns control how numbers are displayed to users,
1717
- * including currency symbols, decimal places, and separators.
1718
- */
1719
- formatting?: string;
1720
- };
1721
-
1722
- /**
1723
- * @public
1724
- * Cell containing a numeric value.
1725
- *
1726
- * @example Creating a number cell
1727
- * ```ts
1728
- * import type { NumberCellMetadata, NumberDataTableCell } from '@canva/intents/data';
1729
- *
1730
- * const priceCell: NumberDataTableCell = {
1731
- * type: 'number',
1732
- * value: 29.99,
1733
- * metadata: { formatting: '[$$]#,##0.00' }
1734
- * };
1735
- *
1736
- * const quantityCell: NumberDataTableCell = {
1737
- * type: 'number',
1738
- * value: 150
1739
- * };
1740
- *
1741
- * const emptyNumberCell: NumberDataTableCell = {
1742
- * type: 'number',
1743
- * value: undefined
1744
- * };
1745
- * ```
1746
- */
1747
- declare type NumberDataTableCell = {
1748
- /**
1749
- * Indicates this cell contains a number value.
1750
- */
1751
- type: 'number';
1752
- /**
1753
- * Numeric value within safe integer range.
1754
- *
1755
- * Valid range: `Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`
1756
- *
1757
- * Invalid values:
1758
- *
1759
- * - Infinity or -Infinity
1760
- * - NaN
1761
- * - Negative zero (-0)
1762
- * - Denormalized numbers
1763
- *
1764
- * Use `undefined` for an empty cell.
1765
- */
1766
- value: number | undefined;
1767
- /**
1768
- * Optional formatting information for displaying the number.
1769
- *
1770
- * @example Applying display formatting to a number
1771
- * ```ts
1772
- * import type { NumberCellMetadata } from '@canva/intents/data';
1773
- *
1774
- * const currencyFormatting: NumberCellMetadata = { formatting: '[$USD]#,##0.00' };
1775
- * const percentageFormatting: NumberCellMetadata = { formatting: '0.00%' };
1776
- * ```
1777
- */
1778
- metadata?: NumberCellMetadata;
1779
- };
1780
-
1781
- /** @public */
1782
- declare type OnContextChange = (context: SettingsUiContext) => void;
1783
-
1784
- /**
1785
- * @public
1786
- * {@link GetDataTableError} indicating the data source reference is no longer valid.
1787
- * This will trigger a re-selection flow for the user.
1788
- */
1789
- declare type OutdatedSourceRefError = {
1790
- /**
1791
- * The data source reference is no longer valid.
1792
- *
1793
- * Return this error when the DataSourceRef cannot be used to retrieve data,
1794
- * for example:
1795
- *
1796
- * - The referenced dataset has been deleted
1797
- * - Access permissions have changed
1798
- * - The structure of the data has fundamentally changed
1799
- *
1800
- * This will trigger a re-selection flow, allowing the user to choose a new
1801
- * data source.
1802
- */
1803
- status: 'outdated_source_ref';
1804
- };
1805
-
1806
- /**
1807
- * @public
1808
- * {@link InvocationContext} indicating an error occurred because the previously selected data source reference is no longer valid.
1809
- * Triggered when getDataTable returned 'outdated_source_ref' during data refresh.
1810
- * UI should guide the user to reselect or reconfigure their data.
1811
- */
1812
- declare type OutdatedSourceRefInvocationContext = {
1813
- /**
1814
- * Previously selected data source reference is no longer valid.
1815
- *
1816
- * This occurs when `getDataTable` returned 'outdated_source_ref' during a
1817
- * refresh attempt. Your UI should guide the user to select a new data source
1818
- * or update their selection.
1819
- *
1820
- * The outdated reference is provided to help you suggest an appropriate replacement.
1821
- */
1822
- reason: 'outdated_source_ref';
1823
- /**
1824
- * The outdated data source reference that caused the error during refresh.
1825
- */
1826
- dataSourceRef?: DataSourceRef;
1827
- };
1828
-
1829
- /**
1830
- * @public
1831
- * Exported file ready for publishing.
1832
- */
1833
- declare type OutputFile = ImageOutputFile | VideoOutputFile | DocumentOutputFile;
1834
-
1835
- /**
1836
- * @public
1837
- * Production-ready exported files for a specific media slot.
1838
- *
1839
- * These are the final files that should be uploaded to your platform.
1840
- */
1841
- declare type OutputMedia = {
1842
- /**
1843
- * ID of the media slot these files belong to.
1844
- *
1845
- * Matches a media slot ID from your output type definition.
1846
- */
1847
- mediaSlotId: string;
1848
- /**
1849
- * Array of exported files for this media slot.
1850
- *
1851
- * Files match the requirements specified in your media slot configuration.
1852
- */
1853
- files: OutputFile[];
1854
- };
1855
-
1856
- /**
1857
- * @public
1858
- * Metadata about a specific page in the exported content.
1859
- */
1860
- declare type OutputPageMetadata = {
1861
- /**
1862
- * The unique identifier for the page.
1863
- */
1864
- pageId: string | undefined;
1865
- /**
1866
- * The position of the page within the design, starting from 1 for the first page.
1867
- */
1868
- pageNumber: number;
1869
- };
1870
-
1871
- /**
1872
- * @public
1873
- * Configuration for an output type.
1874
- *
1875
- * Defines a specific publishing format your platform supports,
1876
- * including what media is required and accepted file types.
1877
- *
1878
- * @example Defining an Instagram post output type
1879
- * ```ts
1880
- * const instagramPost: OutputType = {
1881
- * id: 'instagram_post',
1882
- * displayName: 'Instagram Post',
1883
- * mediaSlots: [
1884
- * {
1885
- * id: 'main_image',
1886
- * displayName: 'Post Image',
1887
- * fileCount: { min: 1, max: 10 },
1888
- * accepts: {
1889
- * image: {
1890
- * format: 'jpg',
1891
- * aspectRatio: { min: 0.8, max: 1.91 },
1892
- * }
1893
- * }
1894
- * }
1895
- * ]
1896
- * };
1897
- * ```
1898
- */
1899
- declare type OutputType = {
1900
- /**
1901
- * Unique identifier for this output type.
1902
- *
1903
- * Use descriptive IDs like `"instagram_post"` or `"youtube_video"`.
1904
- */
1905
- id: string;
1906
- /**
1907
- * User-facing name for this output type.
1908
- *
1909
- * This is displayed to users when selecting where to publish.
1910
- * Examples: `"Instagram Post"`, `"YouTube Video"`, `"Twitter Post"`.
1911
- */
1912
- displayName: string;
1913
- /**
1914
- * Array of media slots defining what content is needed.
1915
- *
1916
- * Each slot represents a piece of media required for publishing,
1917
- * such as a main image, thumbnail, or video.
1918
- */
1919
- mediaSlots: MediaSlot[];
1920
- };
1921
-
1922
- /**
1923
- * @public
1924
- * Action to be taken after publishing completes successfully.
1925
- */
1926
- declare type PostPublishAction = PostPublishActionRedirect;
1927
-
1928
- /**
1929
- * @public
1930
- * Redirect action to navigate the user to a URL after publishing.
1931
- *
1932
- * @example Redirecting to content editor
1933
- * ```ts
1934
- * const postPublishAction: PostPublishActionRedirect = {
1935
- * type: 'redirect',
1936
- * url: 'https://example.com/posts/12345/edit'
1937
- * };
1938
- * ```
1939
- */
1940
- declare type PostPublishActionRedirect = {
1941
- type: 'redirect';
1942
- /**
1943
- * The URL to redirect the user to after publishing.
1944
- */
1945
- url: string;
1946
- };
1947
-
1948
- /**
1949
- * @public
1950
- *
1951
- * Prepares a {@link ContentPublisherIntent|Content Publisher Intent}.
1952
- *
1953
- * @example
1954
- * ```tsx
1955
- * import { prepareContentPublisher } from "@canva/intents/content";
1956
- *
1957
- * prepareContentPublisher({
1958
- * getPublishConfiguration: async (params) => {
1959
- * // Implement the logic to get the publish configuration
1960
- * },
1961
- * renderSettingsUi: (params) => {
1962
- * // Implement the UI for settings view
1963
- * },
1964
- * renderPreviewUi: (params) => {
1965
- * // Implement the UI for preview view
1966
- * },
1967
- * publishContent: async (params) => {
1968
- * // Implement the logic to publish the content
1969
- * },
1970
- * });
1971
- * ```
1972
- */
1973
- declare const prepareContentPublisher: (implementation: ContentPublisherIntent) => void;
1974
-
1975
- /**
1976
- * @public
1977
- *
1978
- * Prepares a {@link DataConnectorIntent|DataConnector Intent}.
1979
- *
1980
- * @example
1981
- * ```tsx
1982
- * import { prepareDataConnector } from "@canva/intents/data";
1983
- *
1984
- * prepareDataConnector({
1985
- * getDataTable: async (params) => {
1986
- * // Implement the logic to fetch the data table
1987
- * },
1988
- * renderSelectionUi: (params) => {
1989
- * // Implement the UI for the data table selection
1990
- * },
1991
- * });
1992
- * ```
1993
- */
1994
- declare const prepareDataConnector: (implementation: DataConnectorIntent) => void;
1995
-
1996
- /**
1997
- * @public
1998
- *
1999
- * Prepares a {@link DesignEditorIntent|DesignEditor Intent}.
2000
- *
2001
- * @example
2002
- * ```tsx
2003
- * import { prepareDesignEditor } from '@canva/intents/design';
2004
- *
2005
- * prepareDesignEditor({
2006
- * render: async () => {
2007
- * // TODO: Implement the logic to render your app's UI
2008
- * },
2009
- * });
2010
- * ```
2011
- */
2012
- declare const prepareDesignEditor: (implementation: DesignEditorIntent) => void;
2013
-
2014
- /**
2015
- * @public
2016
- * Preview item for an image or video.
2017
- *
2018
- * Check the `kind` and `status` properties to determine the type and state.
2019
- */
2020
- declare type Preview = ImagePreview | VideoPreview | DocumentPreview | EmailPreviewStub;
2021
-
2022
- /**
2023
- * @public
2024
- * Type of preview media.
2025
- */
2026
- declare type PreviewKind = 'image' | 'video' | 'document' | 'email';
2027
-
2028
- /**
2029
- * @public
2030
- * Preview media for a specific media slot.
2031
- *
2032
- * Contains preview URLs and metadata for images or videos in the design.
2033
- */
2034
- declare type PreviewMedia = {
2035
- /**
2036
- * ID of the media slot this preview belongs to.
2037
- *
2038
- * Matches a media slot ID from your output type definition.
2039
- */
2040
- mediaSlotId: string;
2041
- /**
2042
- * Array of preview items for this media slot.
2043
- *
2044
- * May contain multiple previews if the media slot accepts multiple files.
2045
- */
2046
- previews: Preview[];
2047
- };
2048
-
2049
- /**
2050
- * @public
2051
- * State of a preview item.
2052
- */
2053
- declare type PreviewStatus = 'loading' | 'thumbnail' | 'upgrading' | 'ready' | 'error';
2054
-
2055
- /**
2056
- * @public
2057
- * Successful response from publishing a content.
2058
- *
2059
- * @example Basic successful publish
2060
- * ```ts
2061
- * return {
2062
- * status: 'completed',
2063
- * externalId: 'post_12345',
2064
- * externalUrl: 'https://example.com/posts/12345'
2065
- * };
2066
- * ```
2067
- *
2068
- * @example Successful publish with redirect
2069
- * ```ts
2070
- * return {
2071
- * status: 'completed',
2072
- * externalId: 'video_67890',
2073
- * externalUrl: 'https://example.com/videos/67890',
2074
- * postPublishAction: {
2075
- * type: 'redirect',
2076
- * url: 'https://example.com/videos/67890/edit'
2077
- * }
2078
- * };
2079
- * ```
2080
- */
2081
- declare type PublishContentCompleted = {
2082
- status: 'completed';
2083
- /**
2084
- * Unique identifier returned from your external platform. You can use this for:
2085
- *
2086
- * - Tracking published content
2087
- * - Fetching insights data for the published content
2088
- * - Linking back to the content in future operations
2089
- */
2090
- externalId?: string;
2091
- /**
2092
- * Direct URL to the published content on your platform.
2093
- *
2094
- * Users can visit this URL to view their published content.
2095
- * This may be displayed to users or used for sharing.
2096
- */
2097
- externalUrl?: string;
2098
- /**
2099
- * Optional action to perform after publishing completes.
2100
- *
2101
- * Currently supports redirecting users to a specific URL after publishing.
2102
- */
2103
- postPublishAction?: PostPublishAction;
2104
- };
2105
-
2106
- /**
2107
- * @public
2108
- * Error response from publishing a content.
2109
- *
2110
- * Return the appropriate error type based on the failure:
2111
- *
2112
- * - `"remote_request_failed"`: Network or API errors with your platform
2113
- * - `"app_error"`: Custom application errors with optional message
2114
- */
2115
- declare type PublishContentError = RemoteRequestFailedError_2 | AppError_2;
2116
-
2117
- /**
2118
- * @public
2119
- * Parameters required for publishing the content.
2120
- * Contains all the information needed to send the content to your external platform.
2121
- */
2122
- declare type PublishContentRequest = {
2123
- /**
2124
- * Platform-specific settings reference containing user configurations.
2125
- *
2126
- * This is the same reference you saved via `updatePublishSettings` in the settings UI.
2127
- * Parse this string to retrieve the user's publish settings (e.g., captions, tags, privacy).
2128
- *
2129
- * Maximum size: 5KB
2130
- */
2131
- publishRef?: string;
2132
- /**
2133
- * The output type selected by the user for this publish operation.
2134
- *
2135
- * This matches one of the output types you provided in `getPublishConfiguration`.
2136
- */
2137
- outputType: OutputType;
2138
- /**
2139
- * Production-ready exported files matching the requirements from your output type.
2140
- *
2141
- * These files are ready to upload to your platform and match the format, size,
2142
- * and aspect ratio requirements specified in your media slots.
2143
- */
2144
- outputMedia: OutputMedia[];
2145
- };
2146
-
2147
- /**
2148
- * @public
2149
- * Response from a publish content operation.
2150
- *
2151
- * This can be either a successful completion or an error response.
2152
- */
2153
- declare type PublishContentResponse = PublishContentCompleted | PublishContentError;
2154
-
2155
- /** @public */
2156
- declare type PublishError = {
2157
- appDefinedPayload?: string;
2158
- };
2159
-
2160
- /**
2161
- * @public
2162
- * Signals that the publish error was cleared.
2163
- */
2164
- declare type PublishErrorClearedSettingsUiContext = {
2165
- reason: 'publish_error_cleared';
2166
- };
2167
-
2168
- /**
2169
- * @public
2170
- * Provides information about an error that occurred in publishContent.
2171
- */
2172
- declare type PublishErrorSettingsUiContext = {
2173
- reason: 'publish_error';
2174
- /**
2175
- * The error that occurred. Undefined means no error occurred or the previous
2176
- * error was cleared by Canva.
2177
- */
2178
- error: PublishError;
2179
- };
2180
-
2181
- /**
2182
- * @public
2183
- * Supported file formats for publishing.
2184
- */
2185
- declare type PublishFileFormat = 'png' | 'jpg' | 'mp4' | 'pdf_standard' | 'html_bundle' | 'html_standalone';
2186
-
2187
- /**
2188
- * @public
2189
- * Initial payload provided from cache.
2190
- */
2191
- declare type PublishPreviewUiInvocationContext = {
2192
- /**
2193
- * Initial preview data and context provided when the preview UI is rendered.
2194
- */
2195
- reason: 'publish';
2196
- /**
2197
- * Initial preview media to display
2198
- * This will only be used for scheduling and not caching
2199
- */
2200
- previewMedia?: PreviewMedia[];
2201
- /** Information about the current output type being previewed */
2202
- outputType?: OutputType;
2203
- /** Current publish reference, if available */
2204
- publishRef?: string;
2205
- };
2206
-
2207
- /**
2208
- * @public
2209
- * Validation state indicating whether publish settings are complete and valid.
2210
- */
2211
- declare type PublishRefValidityState = 'valid' | 'invalid_missing_required_fields' | 'invalid_authentication_required';
2212
-
2213
- /**
2214
- * @public
2215
- * Configuration for publish settings.
2216
- *
2217
- * Contains the user's settings and their validation state. Use this to
2218
- * control whether the publish button is enabled.
2219
- */
2220
- declare type PublishSettings = {
2221
- /**
2222
- * Serialized platform-specific settings for publishing.
2223
- *
2224
- * Store all information your app needs to publish the content in this string.
2225
- * This might include:
2226
- *
2227
- * - Captions or descriptions
2228
- * - Tags or hashtags
2229
- * - Privacy settings
2230
- * - Publishing destination (account, page, etc.)
2231
- * - Scheduling information
2232
- *
2233
- * This reference will be provided to your `publishContent` method when publishing.
2234
- *
2235
- * Maximum size: 5KB
2236
- *
2237
- * @example Serializing settings
2238
- * ```ts
2239
- * const settings = {
2240
- * caption: 'Check out my design!',
2241
- * tags: ['design', 'creative'],
2242
- * privacy: 'public'
2243
- * };
2244
- * const publishRef = JSON.stringify(settings);
2245
- * ```
2246
- */
2247
- publishRef?: string;
2248
- /**
2249
- * Validation state of the publish settings.
2250
- *
2251
- * Controls whether the publish button is enabled:
2252
- *
2253
- * - `"valid"`: Settings are complete and valid, publish button is enabled
2254
- * - `"invalid_missing_required_fields"`: Required settings are missing, publish button is disabled
2255
- * - `"invalid_authentication_required"`: User must authenticate before publishing can proceed
2256
- */
2257
- validityState: PublishRefValidityState;
2258
- };
2259
-
2260
- /**
2261
- * @public
2262
- * Provides information about the current state of the settings UI to help
2263
- * you adapt the interface based on the selected output type.
2264
- */
2265
- declare type PublishSettingsSettingsUiContext = {
2266
- reason: 'publish_settings';
2267
- /**
2268
- * The currently selected output type.
2269
- *
2270
- * Use this to customize your settings UI based on the requirements
2271
- * of different output types.
2272
- */
2273
- outputType: OutputType;
2274
- };
2275
-
2276
- /**
2277
- * @public
2278
- * Initial payload provided from cache.
2279
- */
2280
- declare type PublishSettingsUiInvocationContext = {
2281
- /**
2282
- * Initial settings and context provided when the settings UI is rendered.
2283
- */
2284
- reason: 'publish';
2285
- /** Current publish reference to populate the UI, if any exist */
2286
- publishRef?: string;
2287
- /** Information about the current output type being configured */
2288
- outputType?: OutputType;
2289
- };
2290
-
2291
- /**
2292
- * @public
2293
- * {@link GetDataTableError} indicating failure to fetch data from the external source.
2294
- * Typically due to network issues or API failures.
2295
- */
2296
- declare type RemoteRequestFailedError = {
2297
- /**
2298
- * Failed to fetch data from the external source.
2299
- *
2300
- * Return this error for network issues, API failures, or other
2301
- * connectivity problems that prevent data retrieval.
2302
- */
2303
- status: 'remote_request_failed';
2304
- };
2305
-
2306
- /**
2307
- * @public
2308
- * {@link PublishContentError} indicating failure of the remote request to the external platform.
2309
- *
2310
- * Return this error for:
2311
- *
2312
- * - Network connectivity issues
2313
- * - API endpoint failures
2314
- * - HTTP errors from your platform
2315
- * - Timeout errors
2316
- *
2317
- * @example Handling network errors
2318
- * ```ts
2319
- * try {
2320
- * await uploadToExternalPlatform(file);
2321
- * } catch (error) {
2322
- * return { status: 'remote_request_failed' };
2323
- * }
2324
- * ```
2325
- */
2326
- declare type RemoteRequestFailedError_2 = {
2327
- status: 'remote_request_failed';
2328
- };
2329
-
2330
- /**
2331
- * @public
2332
- * Initial payload provided when the preview UI is rendered.
2333
- * Contains the preview data and settings needed to initialize the preview interface.
2334
- */
2335
- declare type RenderPreviewUiInvocationContext = PublishPreviewUiInvocationContext;
2336
-
2337
- /**
2338
- * @public
2339
- * Configuration required for rendering the preview UI.
2340
- *
2341
- * Provides callbacks for managing preview media and responding to preview updates.
2342
- */
2343
- declare type RenderPreviewUiRequest = {
2344
- /**
2345
- * @public
2346
- * The initial preview data and context provided when the preview UI is rendered.
2347
- *
2348
- * Contains the initial preview media, output type information, and any existing
2349
- * publish settings needed to properly display the preview interface.
2350
- */
2351
- invocationContext: RenderPreviewUiInvocationContext;
2352
- /**
2353
- * Callback to upgrade video thumbnail previews to full video media.
2354
- *
2355
- * Call this function when you need full video previews instead of lightweight thumbnails.
2356
- * This helps optimize performance by deferring full video loading until needed.
2357
- *
2358
- * Upgrades may complete asynchronously; listen to `registerOnPreviewChange` for updates
2359
- * to receive the upgraded video previews.
2360
- *
2361
- * @param previewIds - Array of preview IDs to upgrade from thumbnail to full video
2362
- *
2363
- * @example Upgrading video previews on user interaction
2364
- * ```ts
2365
- * // When user clicks on a video thumbnail, upgrade to full video
2366
- * if (preview.kind === 'video' && preview.status === 'thumbnail') {
2367
- * requestPreviewUpgrade([preview.id]);
2368
- * }
2369
- * ```
2370
- */
2371
- requestPreviewUpgrade: (previewIds: string[]) => void;
2372
- /**
2373
- * Registers a callback to be invoked when preview data changes.
2374
- *
2375
- * This callback is triggered when:
2376
- *
2377
- * - The design content changes
2378
- * - The output type changes
2379
- * - Preview media is upgraded from thumbnail to full video
2380
- * - Export settings are modified
2381
- *
2382
- * Use this to update your preview UI in real-time as users modify their design.
2383
- *
2384
- * @param callback - The callback invoked when preview data is updated
2385
- * @returns A disposer function that cleans up the registered callback
2386
- *
2387
- * @example Handling preview updates
2388
- * ```ts
2389
- * const disposer = registerOnPreviewChange(({ previewMedia, outputType, publishRef }) => {
2390
- * // Update your preview UI with the new preview media
2391
- * previewMedia.forEach((media) => {
2392
- * media.previews.forEach((preview) => {
2393
- * if (preview.status === 'ready') {
2394
- * displayPreview(preview);
2395
- * }
2396
- * });
2397
- * });
2398
- * });
2399
- *
2400
- * // Clean up when preview UI is unmounted
2401
- * onUnmount(() => disposer());
2402
- * ```
2403
- */
2404
- registerOnPreviewChange: (callback: (opts: {
2405
- previewMedia: PreviewMedia[];
2406
- /** The output type that the preview data is for */
2407
- outputType: OutputType;
2408
- /** The current publish settings reference, if available */
2409
- publishRef?: string;
2410
- }) => void) => Disposer;
2411
- };
2412
-
2413
- /**
2414
- * @public
2415
- * Parameters for rendering the data selection UI.
2416
- */
2417
- declare type RenderSelectionUiRequest = {
2418
- /**
2419
- * Context information about why the data selection UI is being launched.
2420
- *
2421
- * Use this to adapt your UI for different scenarios:
2422
- *
2423
- * - 'data_selection': Initial data selection or editing existing data
2424
- * - 'outdated_source_ref': Previous reference is no longer valid, guide user to reselect
2425
- * - 'app_error': Custom error occurred, show error message and recovery options
2426
- *
2427
- * When `dataSourceRef` is provided, pre-populate your UI with this selection.
2428
- */
2429
- invocationContext: InvocationContext;
2430
- /**
2431
- * Maximum allowed rows and columns for the imported data.
2432
- *
2433
- * Your UI should inform users of these constraints and prevent or warn about
2434
- * selections that would exceed them. This helps users understand why certain
2435
- * data sets might not be available for selection.
2436
- */
2437
- limit: DataTableLimit;
2438
- /**
2439
- * Callback to preview selected data before finalizing import.
2440
- *
2441
- * Call this function when the user selects data to:
2442
- *
2443
- * 1. Show a preview of the selected data to the user
2444
- * 2. Validate that the selection meets system requirements
2445
- *
2446
- * Calling this function will trigger your `getDataTable` implementation.
2447
- * Wait for the promise to resolve to determine if the selection is valid.
2448
- *
2449
- * @param dataSourceRef - Reference object identifying the selected data
2450
- * @returns Promise resolving to success or an error result
2451
- * @throws Will throw CanvaError('bad_request') if
2452
- * 1. {@link DataSourceRef.source} exceeds 5kb.
2453
- * 2. {@link DataSourceRef.title} exceeds 255 characters.
2454
- * 3. {@link GetDataTableCompleted.dataTable} exceeds {@link DataTableLimit} or contains invalid data.
2455
- */
2456
- updateDataRef: (dataSourceRef: DataSourceRef) => Promise<UpdateDataRefResponse>;
2457
- };
2458
-
2459
- /**
2460
- * @public
2461
- * Initial payload provided when the publish settings UI is rendered.
2462
- * Contains the current settings state needed to initialize the settings interface.
2463
- */
2464
- declare type RenderSettingsUiInvocationContext = PublishSettingsUiInvocationContext;
2465
-
2466
- /**
2467
- * @public
2468
- * Configuration for the publish settings UI.
2469
- *
2470
- * This type provides the necessary callbacks and configuration for rendering
2471
- * a custom publish settings interface where users configure platform-specific options.
2472
- */
2473
- declare type RenderSettingsUiRequest = {
2474
- /**
2475
- * @public
2476
- * The initial settings and context provided when the settings UI is rendered.
2477
- *
2478
- * Contains any previously saved publish settings and information about the current output type being configured.
2479
- * Use this to restore the UI to its previous state or initialise it with appropriate defaults.
2480
- */
2481
- invocationContext: RenderSettingsUiInvocationContext;
2482
- /**
2483
- * Callback to save and validate the user's publish settings.
2484
- *
2485
- * Call this function whenever the user modifies their settings to:
2486
- *
2487
- * - Save the settings for later use in `publishContent`
2488
- * - Validate that required fields are filled
2489
- * - Enable or disable the publish button based on validity
2490
- *
2491
- * Store all necessary publishing information in the `publishRef` string.
2492
- * This will be provided to your `publishContent` method when the user publishes.
2493
- *
2494
- * @param settings - The new publish settings to save
2495
- * @returns A promise that resolves when the settings are successfully saved
2496
- * @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds 5KB.
2497
- *
2498
- * @example Updating settings as user types
2499
- * ```ts
2500
- * // As user fills in form fields, update settings
2501
- * function handleCaptionChange(caption: string) {
2502
- * const settings = { caption, tags: currentTags };
2503
- * const publishRef = JSON.stringify(settings);
2504
- *
2505
- * updatePublishSettings({
2506
- * publishRef,
2507
- * validityState: caption ? 'valid' : 'invalid_missing_required_fields'
2508
- * });
2509
- * }
2510
- * ```
2511
- */
2512
- updatePublishSettings: (publishSettings: PublishSettings) => Promise<UpdatePublishSettingsResponse>;
2513
-
2514
- /**
2515
- * Registers a callback to be invoked when the settings UI context changes.
2516
- *
2517
- * This callback is triggered when:
2518
- * - the user changes the output type in the publish flow.
2519
- * - an error occurs in the publish flow.
2520
- *
2521
- * Use this to respond to Canva changes and update your settings UI accordingly.
2522
- *
2523
- * @param opts - The options for registering a callback.
2524
- * @returns A disposer function that cleans up the registered callback.
2525
- *
2526
- * @example Adapting UI for different output types
2527
- * ```ts
2528
- * registerOnContextChange({
2529
- * onContextChange: (ctx) => {
2530
- * if (ctx.reason === 'publish_settings') {
2531
- * if (ctx.outputType.id === 'instagram_post') {
2532
- * showHashtagField();
2533
- * }
2534
- * }
2535
- * if (ctx.reason === 'publish_error') {
2536
- * setError(ctx.error);
2537
- * }
2538
- * }
2539
- * });
2540
- * ```
2541
- */
2542
- registerOnContextChange: (opts: {
2543
- onContextChange: OnContextChange;
2544
- }) => Disposer;
2545
- };
2546
-
2547
- /**
2548
- * @public
2549
- * Context information for the publish settings UI.
2550
- */
2551
- declare type SettingsUiContext = PublishSettingsSettingsUiContext | PublishErrorSettingsUiContext | PublishErrorClearedSettingsUiContext;
2552
-
2553
- /**
2554
- * @public
2555
- * Base interface for all preview types that have a fixed width and height.
2556
- */
2557
- declare interface SizedPreview extends BasePreview {
2558
- /**
2559
- * Width of the preview in pixels.
2560
- */
2561
- widthPx: number;
2562
- /**
2563
- * Height of the preview in pixels.
2564
- */
2565
- heightPx: number;
2566
- }
2567
-
2568
- /**
2569
- * @public
2570
- * Cell containing a text value.
2571
- *
2572
- * @example Creating a string cell
2573
- * ```ts
2574
- * import type { StringDataTableCell } from '@canva/intents/data';
2575
- *
2576
- * const nameCell: StringDataTableCell = {
2577
- * type: 'string',
2578
- * value: 'John Doe'
2579
- * };
2580
- *
2581
- * const emptyStringCell: StringDataTableCell = {
2582
- * type: 'string',
2583
- * value: undefined
2584
- * };
2585
- * ```
2586
- */
2587
- declare type StringDataTableCell = {
2588
- /**
2589
- * Indicates this cell contains a string value.
2590
- */
2591
- type: 'string';
2592
- /**
2593
- * Text content of the cell.
2594
- *
2595
- * Maximum length: 10,000 characters
2596
- *
2597
- * Use `undefined` for an empty cell.
2598
- */
2599
- value: string | undefined;
2600
- };
2601
-
2602
- /**
2603
- * @public
2604
- * Successful result from the {@link RenderSelectionUiRequest.updateDataRef} callback.
2605
- */
2606
- declare type UpdateDataRefCompleted = {
2607
- /**
2608
- * The data selection was successful and can be previewed.
2609
- */
2610
- status: 'completed';
2611
- };
2612
-
2613
- /**
2614
- * @public
2615
- * Result returned from the {@link RenderSelectionUiRequest.updateDataRef} callback.
2616
- * Indicates whether {@link DataSourceRef} update succeeded or failed.
2617
- */
2618
- declare type UpdateDataRefResponse = UpdateDataRefCompleted | GetDataTableError;
2619
-
2620
- /**
2621
- * @public
2622
- * Successful response from updating the publish settings.
2623
- */
2624
- declare type UpdatePublishSettingsCompleted = {
2625
- status: 'completed';
2626
- };
2627
-
2628
- /**
2629
- * @public
2630
- * Response from updating the publish settings.
2631
- */
2632
- declare type UpdatePublishSettingsResponse = UpdatePublishSettingsCompleted;
2633
-
2634
- /**
2635
- * @public
2636
- * Numeric value range constraint.
2637
- * Used to specify requirements for aspect ratios, durations, file counts, etc.
2638
- */
2639
- declare type ValueRange = ExactValueRange | MinValueRange | MaxValueRange | MinMaxValueRange;
2640
-
2641
- /**
2642
- * @public
2643
- * The MIME type of a video file that's supported by Canva's backend.
2644
- *
2645
- * @remarks
2646
- * - GIFs are treated as videos, not images.
2647
- * - `"application/json"` is only used for Lottie files.
2648
- */
2649
- declare type VideoMimeType = 'video/avi' | 'video/x-msvideo' | 'image/gif' | 'video/x-m4v' | 'video/x-matroska' | 'video/quicktime' | 'video/mp4' | 'video/mpeg' | 'video/webm' | 'application/json';
2650
-
2651
- /**
2652
- * @public
2653
- * Exported video file ready for publishing.
2654
- */
2655
- declare interface VideoOutputFile extends BaseOutputFile {
2656
- /**
2657
- * Width of the video in pixels.
2658
- */
2659
- widthPx: number;
2660
- /**
2661
- * Height of the video in pixels.
2662
- */
2663
- heightPx: number;
2664
- }
2665
-
2666
- /**
2667
- * @public
2668
- * Video preview in various states.
2669
- *
2670
- * Videos transition through states: `"loading"` → `"thumbnail"` → `"upgrading"` → `"ready"`.
2671
- * Start with thumbnails for better performance, then upgrade to full video using `requestPreviewUpgrade`.
2672
- */
2673
- declare type VideoPreview = VideoPreviewLoading | VideoPreviewThumbnail | VideoPreviewUpgrading | VideoPreviewReady | VideoPreviewError;
2674
-
2675
- /**
2676
- * @public
2677
- * Video preview that failed to generate.
2678
- *
2679
- * Display an error state to the user.
2680
- */
2681
- declare interface VideoPreviewError extends SizedPreview {
2682
- kind: 'video';
2683
- status: 'error';
2684
-
2685
- /**
2686
- * The error message to display to the user.
2687
- */
2688
- message: string;
2689
- }
2690
-
2691
- /**
2692
- * @public
2693
- * Video preview that is currently being generated.
2694
- *
2695
- * Display a loading state until the preview transitions to `"thumbnail"` or `"error"`.
2696
- */
2697
- declare interface VideoPreviewLoading extends SizedPreview {
2698
- kind: 'video';
2699
- status: 'loading';
2700
- /**
2701
- * Video duration in milliseconds.
2702
- */
2703
- durationMs?: number;
2704
- }
2705
-
2706
- /**
2707
- * @public
2708
- * Video preview with full video ready to play.
2709
- *
2710
- * Contains URLs for both the video and thumbnail.
2711
- */
2712
- declare interface VideoPreviewReady extends SizedPreview {
2713
- kind: 'video';
2714
- status: 'ready';
2715
- /**
2716
- * Video format.
2717
- */
2718
- format: 'mp4';
2719
- /**
2720
- * URL to the full video.
2721
- *
2722
- * Use this URL in a video player.
2723
- */
2724
- url: string;
2725
- /**
2726
- * Format of the thumbnail image.
2727
- */
2728
- thumbnailFormat: 'png' | 'jpg';
2729
- /**
2730
- * URL to the thumbnail image.
2731
- *
2732
- * Can be used as a poster image for the video player.
2733
- */
2734
- thumbnailUrl: string;
2735
- /**
2736
- * Video duration in milliseconds.
2737
- */
2738
- durationMs?: number;
2739
- }
2740
-
2741
- /**
2742
- * @public
2743
- * Video preview with lightweight thumbnail available.
2744
- *
2745
- * This is the initial state for video previews. Show the thumbnail image
2746
- * and call `requestPreviewUpgrade` when the user needs the full video.
2747
- */
2748
- declare interface VideoPreviewThumbnail extends SizedPreview {
2749
- kind: 'video';
2750
- status: 'thumbnail';
2751
- /**
2752
- * Format of the thumbnail image.
2753
- */
2754
- thumbnailFormat: 'png' | 'jpg';
2755
- /**
2756
- * URL to the thumbnail image.
2757
- *
2758
- * Display this lightweight image until full video is needed.
2759
- */
2760
- thumbnailUrl: string;
2761
- /**
2762
- * Video duration in milliseconds.
2763
- */
2764
- durationMs?: number;
2765
- }
2766
-
2767
- /**
2768
- * @public
2769
- * Video preview that is being upgraded from thumbnail to full video.
2770
- *
2771
- * Display the thumbnail with a loading indicator until the video is ready.
2772
- */
2773
- declare interface VideoPreviewUpgrading extends SizedPreview {
2774
- kind: 'video';
2775
- status: 'upgrading';
2776
- /**
2777
- * Format of the thumbnail image.
2778
- */
2779
- thumbnailFormat: 'png' | 'jpg';
2780
- /**
2781
- * URL to the thumbnail image.
2782
- *
2783
- * Continue showing the thumbnail while the full video loads.
2784
- */
2785
- thumbnailUrl: string;
2786
- /**
2787
- * Video duration in milliseconds.
2788
- */
2789
- durationMs?: number;
2790
- }
2791
-
2792
- /**
2793
- * @public
2794
- * A unique identifier that points to a video asset in Canva's backend.
2795
- */
2796
- declare type VideoRef = string & {
2797
- __videoRef: never;
2798
- };
2799
-
2800
- /**
2801
- * @public
2802
- * Video file requirements for a media slot.
2803
- *
2804
- * Specifies format, aspect ratio, duration, and size constraints for videos.
2805
- *
2806
- * @example Video requirements for YouTube
2807
- * ```ts
2808
- * const videoReq: VideoRequirement = {
2809
- * format: 'mp4',
2810
- * aspectRatio: { exact: 16/9 },
2811
- * durationMs: { min: 1000, max: 600000 },
2812
- * };
2813
- * ```
2814
- */
2815
- declare interface VideoRequirement extends BaseFileRequirement {
2816
- /**
2817
- * Supported video format.
2818
- */
2819
- format: 'mp4';
2820
- /**
2821
- * Aspect ratio constraint (width / height).
2822
- *
2823
- * Examples:
2824
- * - `{ exact: 16/9 }`: Widescreen
2825
- * - `{ exact: 9/16 }`: Vertical/Story format
2826
- */
2827
- aspectRatio?: ValueRange;
2828
- /**
2829
- * Duration constraint in milliseconds.
2830
- *
2831
- * Examples:
2832
- * - `{ max: 60000 }`: Maximum 60 seconds
2833
- * - `{ min: 3000, max: 600000 }`: Between 3 seconds and 10 minutes
2834
- */
2835
- durationMs?: ValueRange;
2836
-
2837
- }
2838
-
2839
- /**
2840
- * @public
2841
- * Options for uploading a video asset to the user's private media library.
2842
- */
2843
- declare type VideoUploadOptions = {
2844
- /**
2845
- * The type of asset.
2846
- */
2847
- type: 'video';
2848
- /**
2849
- * A human-readable name for the video asset.
2850
- *
2851
- * @remarks
2852
- * This name is displayed in the user's media library and helps users identify
2853
- * and find the asset later. If not provided, Canva will generate a name based
2854
- * on the asset's URL or a unique identifier.
2855
- *
2856
- * Requirements:
2857
- * - Minimum length: 1 character (empty strings are not allowed)
2858
- * - Maximum length: 255 characters
2859
- */
2860
- name?: string;
2861
- /**
2862
- * The ref of the original asset from which this new asset was derived.
2863
- *
2864
- * @remarks
2865
- * For example, if an app applies an effect to a video, `parentRef` should contain the ref of the original video.
2866
- */
2867
- parentRef?: VideoRef;
2868
- /**
2869
- * The URL of the video file to upload.
2870
- *
2871
- * @remarks
2872
- * Requirements:
2873
- *
2874
- * - Must use HTTPS
2875
- * - Must return a `200` status code
2876
- * - `Content-Type` must match the file's MIME type
2877
- * - Must be publicly accessible (i.e. not a localhost URL)
2878
- * - Must not redirect
2879
- * - Must not contain an IP address
2880
- * - Maximum length: 4096 characters
2881
- * - Must not contain whitespace
2882
- * - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
2883
- * - Maximum file size: 1000MB (1GB)
2884
- */
2885
- url: string;
2886
- /**
2887
- * The MIME type of the video file.
2888
- */
2889
- mimeType: VideoMimeType;
2890
- /**
2891
- * The URL of a thumbnail video to display while the video is queued for upload.
2892
- *
2893
- * @remarks
2894
- * Requirements:
2895
- *
2896
- * - Must use HTTPS
2897
- * - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
2898
- * - Maximum length: 4096 characters
2899
- * - The dimensions of the thumbnail video must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
2900
- * - Must not be an AVI file. Although our APIs support uploading AVI videos, Canva can't preview them because of native support of browsers
2901
- */
2902
- thumbnailVideoUrl?: string;
2903
- /**
2904
- * The URL of a thumbnail image to use as a fallback if `thumbnailVideoUrl` isn't provided.
2905
- * This can be an external URL or a data URL.
2906
- *
2907
- * @remarks
2908
- * Requirements for external URLs:
2909
- *
2910
- * - Must use HTTPS
2911
- * - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
2912
- * - Must be a PNG, JPEG, or SVG file
2913
- * - Maximum length: 4096 characters
2914
- *
2915
- * Requirements for data URLs:
2916
- *
2917
- * - Must include `;base64` for base64-encoded data
2918
- * - Maximum size: 10MB (10 × 1024 × 1024 characters)
2919
- * - The dimensions of the thumbnail must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
2920
- */
2921
- thumbnailImageUrl: string;
2922
- /**
2923
- * A disclosure identifying if the app generated this video using AI.
2924
- *
2925
- * @remarks
2926
- * Helps users make informed decisions about the content they interact with.
2927
- * See {@link AiDisclosure} for the full definition.
2928
- *
2929
- * **App Generated**
2930
- *
2931
- * 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
2932
- * the app requests a third-party service to take similar action on a video using AI.
2933
- *
2934
- * Required for the following cases (this list is not exhaustive):
2935
- * | Case | Reason |
2936
- * | -- | -- |
2937
- * | AI generates a new video from scratch | Creates new creative content |
2938
- * | AI changes the style of the video e.g. makes it cartoon | Significantly alters the style |
2939
- * | AI adds subtitles that rely on subjective interpretation | Creates new creative content |
2940
- * | AI expands a video by generating new content to fill the edges | Creates new creative content |
2941
- * | AI animates an image | Creates new creative content |
2942
- * | AI fixes defects e.g. blur in a video by generating details | Creates new creative content |
2943
- * | AI generates a talking head presenter | Creates new creative content |
2944
- *
2945
- * **None**
2946
- *
2947
- * 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of
2948
- * a request to third-party hosted content.
2949
- *
2950
- * Required for the following cases (this list is not exhaustive):
2951
- * | Case | Reason |
2952
- * | -- | -- |
2953
- * | Asset comes from an asset library | Didn't generate the asset itself |
2954
- * | AI corrects red eyes | A minor correction |
2955
- * | AI adjusts brightness and contrast on a video | Doesn't change original meaning by itself |
2956
- * | AI creates a slow motion effect in a video | Doesn't change original meaning by itself |
2957
- * | AI adds AI word-by-word transcribed subtitles to a video | Doesn't change original meaning by itself |
2958
- */
2959
- aiDisclosure: AiDisclosure;
2960
-
2961
- } & AllOrNone<Dimensions>;
2962
-
2963
- export { }