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