@canva/intents 2.0.1-beta.2 → 2.1.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 (39) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/asset/index.d.ts +1 -1
  3. package/content/index.d.ts +1440 -1
  4. package/data/index.d.ts +1229 -1
  5. package/design/index.d.ts +41 -1
  6. package/index.d.ts +2821 -1
  7. package/lib/cjs/sdk/intents/asset/index.js +1 -15
  8. package/lib/cjs/sdk/intents/content/index.js +4 -2
  9. package/lib/cjs/sdk/intents/content/{beta.js → public.js} +0 -2
  10. package/lib/cjs/sdk/intents/fake/create.js +3 -0
  11. package/lib/cjs/sdk/intents/index.js +4 -2
  12. package/lib/cjs/sdk/intents/public.js +8 -4
  13. package/lib/cjs/sdk/intents/version.js +17 -4
  14. package/lib/esm/sdk/intents/asset/index.js +1 -1
  15. package/lib/esm/sdk/intents/content/index.js +3 -1
  16. package/lib/esm/sdk/intents/content/public.js +2 -0
  17. package/lib/esm/sdk/intents/fake/create.js +3 -0
  18. package/lib/esm/sdk/intents/index.js +3 -1
  19. package/lib/esm/sdk/intents/public.js +2 -1
  20. package/lib/esm/sdk/intents/version.js +3 -1
  21. package/package.json +22 -22
  22. package/test/index.d.ts +11 -1
  23. package/asset/beta.d.ts +0 -1
  24. package/beta.d.ts +0 -1309
  25. package/content/beta.d.ts +0 -1410
  26. package/data/beta.d.ts +0 -1242
  27. package/design/beta.d.ts +0 -43
  28. package/lib/cjs/sdk/intents/asset/beta.js +0 -4
  29. package/lib/cjs/sdk/intents/beta.js +0 -20
  30. package/lib/cjs/sdk/intents/data/beta.js +0 -20
  31. package/lib/cjs/sdk/intents/design/beta.js +0 -20
  32. package/lib/cjs/sdk/intents/test/beta.js +0 -18
  33. package/lib/esm/sdk/intents/asset/beta.js +0 -1
  34. package/lib/esm/sdk/intents/beta.js +0 -3
  35. package/lib/esm/sdk/intents/content/beta.js +0 -4
  36. package/lib/esm/sdk/intents/data/beta.js +0 -3
  37. package/lib/esm/sdk/intents/design/beta.js +0 -3
  38. package/lib/esm/sdk/intents/test/beta.js +0 -1
  39. package/test/beta.d.ts +0 -11
@@ -1 +1,1440 @@
1
- export * from "./beta";
1
+ /**
2
+ * @public
3
+ * {@link PublishContentError} indicating a custom error occurred in your app's implementation.
4
+ *
5
+ * Return this for application-specific errors such as:
6
+ *
7
+ * - Validation failures
8
+ * - Authentication errors
9
+ * - Rate limiting
10
+ * - Platform-specific restrictions
11
+ *
12
+ * @example Returning custom error with message
13
+ * ```ts
14
+ * if (userQuotaExceeded) {
15
+ * return {
16
+ * status: 'app_error',
17
+ * message: 'You have reached your monthly publish limit. Please upgrade your plan.'
18
+ * };
19
+ * }
20
+ * ```
21
+ */
22
+ export declare type AppError = {
23
+ status: 'app_error';
24
+ /**
25
+ * (required) The raw error message, for logging purposes. It will not display in the UI.
26
+ * To display custom error messages in the UI use `localizedMessageId`.
27
+ *
28
+ * This should typically be the javascript error.message or a REST JSON error message
29
+ * body passed without modification.
30
+ *
31
+ * WARNING: Do not include personally identifiable information (PII) in this
32
+ * message, such as names, emails, usernames, etc.
33
+ */
34
+ message: string;
35
+ /**
36
+ * (optional) Message ID of the translated error message that will be
37
+ * displayed to the user. The message ID should be present and uploaded in
38
+ * your translation file. If omitted, Canva will display a generic error
39
+ * message.
40
+ */
41
+ localizedMessageId?: string;
42
+ /** HTTP status code, if applicable */
43
+ httpCode?: number;
44
+ /**
45
+ * Used only by app developer. Canva does not use this value. Use this to pass
46
+ * additional information like JSON to your settings frame.
47
+ */
48
+ appDefinedPayload?: string;
49
+ /**
50
+ * (optional) Source of the error if it relates to a component on the Canva
51
+ * UI. When present, the error may render near a relevant Canva component.
52
+ * When omitted, the cause is considered unspecified or "generic".
53
+ */
54
+ errorCause?: ErrorCause;
55
+ };
56
+
57
+ /**
58
+ * @public
59
+ * Base file requirement interface.
60
+ */
61
+ declare interface BaseFileRequirement {
62
+ /**
63
+ * File format for this requirement.
64
+ */
65
+ format: PublishFileFormat;
66
+
67
+ }
68
+
69
+ /**
70
+ * @public
71
+ * Base interface for exported files.
72
+ */
73
+ export declare interface BaseOutputFile {
74
+ /**
75
+ * File format.
76
+ */
77
+ format: PublishFileFormat;
78
+ /**
79
+ * URL to download the exported file.
80
+ *
81
+ * Your app should download from this URL and upload to your platform.
82
+ */
83
+ url: string;
84
+ /**
85
+ * Metadata about the source content used to create this exported file.
86
+ */
87
+ contentMetadata: ContentMetadata;
88
+ }
89
+
90
+ /**
91
+ * @public
92
+ * Base interface for all preview types.
93
+ *
94
+ * Contains common properties shared by all preview types.
95
+ */
96
+ export declare interface BasePreview {
97
+ /**
98
+ * Unique identifier for this preview.
99
+ *
100
+ * Use this ID with `requestPreviewUpgrade` to upgrade video thumbnails.
101
+ */
102
+ id: string;
103
+ /**
104
+ * Type of media in this preview.
105
+ */
106
+ kind: PreviewKind;
107
+ /**
108
+ * Current state of the preview.
109
+ */
110
+ status: PreviewStatus;
111
+ }
112
+
113
+ /**
114
+ * @public
115
+ * Metadata about the source content used to create an exported file.
116
+ */
117
+ export declare type ContentMetadata = DesignContentMetadata;
118
+
119
+ /**
120
+ * @public
121
+ * Main interface for implementing the ContentPublisher intent.
122
+ *
123
+ * Implementing the ContentPublisher intent enables apps to publish contents to external platforms.
124
+ * This allows users to configure publish settings, preview their designs, and share with others.
125
+ *
126
+ * The publishing flow follows this process:
127
+ *
128
+ * 1. User initiates publish action
129
+ * 2. Your app provides publish configuration via `getPublishConfiguration`
130
+ * 3. User selects an output type
131
+ * 4. Your app renders settings UI via `renderSettingsUi`
132
+ * 5. Your app renders preview UI via `renderPreviewUi`
133
+ * 6. User reviews settings and preview
134
+ * 7. Your app publishes the content via `publishContent`
135
+ */
136
+ export declare type ContentPublisherIntent = {
137
+ /**
138
+ * Provides the configuration for the publishing platform.
139
+ *
140
+ * This action is called when the user initiates the publish flow and needs to
141
+ * select an output type for the target platform.
142
+ *
143
+ * Use this to define different publishing configurations for your platform,
144
+ * such as social media posts, videos, or other output types.
145
+ *
146
+ * @returns A promise resolving to the publish configuration or an error
147
+ *
148
+ * @example Defining publish configuration for a social media platform
149
+ * ```ts
150
+ * import type { GetPublishConfigurationResponse } from '@canva/intents/content';
151
+ *
152
+ * async function getPublishConfiguration(): Promise<GetPublishConfigurationResponse> {
153
+ * return {
154
+ * status: 'completed',
155
+ * outputTypes: [
156
+ * {
157
+ * id: 'instagram_post',
158
+ * displayName: 'Instagram Post',
159
+ * mediaSlots: [
160
+ * {
161
+ * id: 'main_image',
162
+ * displayName: 'Post Image',
163
+ * fileCount: { min: 1, max: 10 },
164
+ * accepts: {
165
+ * image: { format: 'jpg', aspectRatio: { min: 0.8, max: 1.91 } }
166
+ * }
167
+ * }
168
+ * ]
169
+ * }
170
+ * ]
171
+ * };
172
+ * }
173
+ * ```
174
+ */
175
+ getPublishConfiguration: () => Promise<GetPublishConfigurationResponse>;
176
+
177
+ /**
178
+ * Renders a user interface for configuring publish settings.
179
+ *
180
+ * This action is called after the user selects an output type. Your UI should
181
+ * allow users to configure platform-specific settings such as captions, tags,
182
+ * privacy settings, or publishing destinations.
183
+ *
184
+ * Use the `updatePublishSettings` callback to save user settings and validate them.
185
+ * Settings are stored in the `publishRef` string (maximum 5KB).
186
+ *
187
+ * @param request - Configuration and callbacks for the publish settings UI.
188
+ *
189
+ * @example Rendering a settings UI with publish configuration
190
+ * ```ts
191
+ * import { createRoot } from 'react-dom/client';
192
+ * import type { RenderSettingsUiRequest } from '@canva/intents/content';
193
+ *
194
+ * function renderSettingsUi(request: RenderSettingsUiRequest): void {
195
+ * const SettingsUiApp = () => (
196
+ * <AppUiProvider>
197
+ * <SettingsUi request={request} />
198
+ * </AppUiProvider>
199
+ * );
200
+ *
201
+ * createRoot().render(<SettingsUiApp />)
202
+ * }
203
+ * ```
204
+ */
205
+ renderSettingsUi: (request: RenderSettingsUiRequest) => void;
206
+ /**
207
+ * Renders a user interface for previewing the content.
208
+ *
209
+ * This action is called after the settings UI is rendered. Your UI should display
210
+ * a preview of how the content will appear on the target platform.
211
+ *
212
+ * Previews update dynamically as users modify their content or settings. For videos,
213
+ * start with lightweight thumbnails and use `requestPreviewUpgrade` to load full
214
+ * video previews on demand to optimize performance.
215
+ *
216
+ * @param request - Configuration and callbacks for the preview UI.
217
+ *
218
+ * @example Rendering a preview UI with video optimization
219
+ * ```ts
220
+ * import { createRoot } from 'react-dom/client';
221
+ * import type { RenderPreviewUiRequest } from '@canva/intents/content';
222
+ *
223
+ * function renderPreviewUi(request: RenderPreviewUiRequest): void {
224
+ * const PreviewUiApp = () => (
225
+ * <AppUiProvider>
226
+ * <PreviewUi request={request} />
227
+ * </AppUiProvider>
228
+ * );
229
+ *
230
+ * createRoot().render(<PreviewUiApp />)
231
+ * }
232
+ * ```
233
+ */
234
+ renderPreviewUi: (request: RenderPreviewUiRequest) => void;
235
+ /**
236
+ * Publishes the content to the external platform.
237
+ *
238
+ * This action is called when the user confirms the publish action after reviewing
239
+ * settings and preview. Your implementation should send the exported files
240
+ * to your platform's API.
241
+ *
242
+ * The `outputMedia` contains production-ready files that match the requirements
243
+ * specified in your output types. The `publishRef` contains the user's settings
244
+ * from the settings UI.
245
+ *
246
+ * @param request - Parameters for the publish operation.
247
+ * @returns A promise resolving to either a successful result with the published content details or an error.
248
+ *
249
+ * @example Publishing content to an external platform
250
+ * ```ts
251
+ * import type { PublishContentRequest, PublishContentResponse } from '@canva/intents/content';
252
+ *
253
+ * async function publishContent(request: PublishContentRequest): Promise<PublishContentResponse> {
254
+ * const { publishRef, outputType, outputMedia } = request;
255
+ *
256
+ * try {
257
+ * // Parse settings from publishRef
258
+ * const settings = publishRef ? JSON.parse(publishRef) : {};
259
+ *
260
+ * // Upload files to your platform
261
+ * const uploadedFiles = await Promise.all(
262
+ * outputMedia.flatMap(media =>
263
+ * media.files.map(file => uploadFile(file.url))
264
+ * )
265
+ * );
266
+ *
267
+ * // Create post on your platform
268
+ * const result = await createPost({
269
+ * files: uploadedFiles,
270
+ * caption: settings.caption
271
+ * });
272
+ *
273
+ * return {
274
+ * status: 'completed',
275
+ * externalId: result.id,
276
+ * externalUrl: result.url
277
+ * };
278
+ * } catch (error) {
279
+ * return {
280
+ * status: 'remote_request_failed'
281
+ * };
282
+ * }
283
+ * }
284
+ * ```
285
+ */
286
+ publishContent: (request: PublishContentRequest) => Promise<PublishContentResponse>;
287
+
288
+ };
289
+
290
+ /**
291
+ * @public
292
+ * Metadata specific to design content.
293
+ */
294
+ export declare interface DesignContentMetadata {
295
+ type: 'design';
296
+ /**
297
+ * A signed JWT token containing the design id
298
+ */
299
+ designToken: string;
300
+ /**
301
+ * The user given title of the design
302
+ */
303
+ title: string | undefined;
304
+ /**
305
+ * The pages that make up the exported metadata
306
+ */
307
+ pages: OutputPageMetadata[];
308
+ }
309
+
310
+ /**
311
+ * @public
312
+ * A function that can be called to dispose of a callback.
313
+ */
314
+ export declare type Disposer = () => void;
315
+
316
+ /**
317
+ * @public
318
+ * Exported PDF file ready for publishing.
319
+ *
320
+ * Contains the final PDF document that should be uploaded to your platform.
321
+ * The document format is `pdf_standard` and the file is ready to use.
322
+ */
323
+ export declare type DocumentOutputFile = BaseOutputFile;
324
+
325
+ /**
326
+ * @public
327
+ * Document preview in various states.
328
+ *
329
+ * Documents transition through states: `"loading"` → `"thumbnail"`.
330
+ * Start with a lightweight thumbnail of the first page for quick preview rendering.
331
+ */
332
+ export declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewError;
333
+
334
+ /**
335
+ * @public
336
+ * Document preview that failed to generate.
337
+ *
338
+ * Display an error state to the user.
339
+ */
340
+ export declare interface DocumentPreviewError extends SizedPreview {
341
+ kind: 'document';
342
+ status: 'error';
343
+ /**
344
+ * The error message to display to the user.
345
+ */
346
+ message: string;
347
+ }
348
+
349
+ /**
350
+ * @public
351
+ * Document preview that is currently being generated.
352
+ *
353
+ * Display a loading state until the preview transitions to `"thumbnail"` or `"error"`.
354
+ */
355
+ export declare interface DocumentPreviewLoading extends SizedPreview {
356
+ kind: 'document';
357
+ status: 'loading';
358
+ }
359
+
360
+ /**
361
+ * @public
362
+ * Document preview with first page thumbnail available.
363
+ *
364
+ * This is the initial state for document previews. Show the thumbnail image
365
+ * of the first page along with the page count to give users a preview of
366
+ * the document before publishing.
367
+ */
368
+ export declare interface DocumentPreviewThumbnail extends SizedPreview {
369
+ kind: 'document';
370
+ status: 'thumbnail';
371
+ /**
372
+ * Format of the thumbnail image.
373
+ */
374
+ thumbnailFormat: 'png' | 'jpg';
375
+ /**
376
+ * URL to the first page thumbnail.
377
+ *
378
+ * Display this lightweight image to preview the document content.
379
+ */
380
+ thumbnailUrl: string;
381
+ }
382
+
383
+ /**
384
+ * @public
385
+ * Document file requirements for a media slot.
386
+ *
387
+ * Note: Document output types use image previews (PNG thumbnails) in the preview UI.
388
+ * The actual document file is only generated for the final output in OutputMedia.
389
+ *
390
+ * @example Document requirements
391
+ * ```ts
392
+ * const documentReq: DocumentRequirement = {
393
+ * format: 'pdf_standard',
394
+ * size: 'a4',
395
+ * };
396
+ * ```
397
+ */
398
+ export declare interface DocumentRequirement extends BaseFileRequirement {
399
+ /**
400
+ * Supported document export format.
401
+ * Currently supports PDF standard format.
402
+ */
403
+ format: 'pdf_standard';
404
+ /**
405
+ * The document size of the export file.
406
+ */
407
+ size: DocumentSize;
408
+ }
409
+
410
+ /**
411
+ * @public
412
+ * Document size for document exports.
413
+ */
414
+ export declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
415
+
416
+ /**
417
+ * @public
418
+ *
419
+ * The cause of an error
420
+ */
421
+ export declare type ErrorCause = 'invalid_selection' | 'invalid_format';
422
+
423
+ /**
424
+ * @public
425
+ * Exact value range constraint.
426
+ * @example Exact value range
427
+ * ```ts
428
+ * const exactValue: ValueRange = { exact: 1 }; // Must be exactly 1
429
+ * ```
430
+ */
431
+ export declare type ExactValueRange = {
432
+ exact: number;
433
+ };
434
+
435
+ /**
436
+ * @public
437
+ * Successful response from getting publish configuration.
438
+ */
439
+ export declare type GetPublishConfigurationCompleted = {
440
+ status: 'completed';
441
+ /**
442
+ * Array of available output types for your platform.
443
+ *
444
+ * Define different output types for various content formats that
445
+ * your platform supports (e.g., posts, stories, videos).
446
+ */
447
+ outputTypes: OutputType[];
448
+ };
449
+
450
+ /**
451
+ * @public
452
+ * {@link GetPublishConfigurationError} error indicating a custom error occurred.
453
+ */
454
+ export declare type GetPublishConfigurationError = AppError;
455
+
456
+ /**
457
+ * @public
458
+ * Response from getting publish configuration.
459
+ */
460
+ export declare type GetPublishConfigurationResponse = GetPublishConfigurationCompleted | GetPublishConfigurationError;
461
+
462
+ /**
463
+ * @public
464
+ * Exported image file ready for publishing.
465
+ */
466
+ export declare interface ImageOutputFile extends BaseOutputFile {
467
+ /**
468
+ * Width of the image in pixels.
469
+ */
470
+ widthPx: number;
471
+ /**
472
+ * Height of the image in pixels.
473
+ */
474
+ heightPx: number;
475
+ }
476
+
477
+ /**
478
+ * @public
479
+ * Image preview in various states.
480
+ */
481
+ export declare type ImagePreview = ImagePreviewLoading | ImagePreviewReady | ImagePreviewError;
482
+
483
+ /**
484
+ * @public
485
+ * Image preview that failed to generate.
486
+ *
487
+ * Display an error state to the user.
488
+ */
489
+ export declare interface ImagePreviewError extends SizedPreview {
490
+ kind: 'image';
491
+ status: 'error';
492
+
493
+ /**
494
+ * The error message to display to the user.
495
+ */
496
+ message: string;
497
+ }
498
+
499
+ /**
500
+ * @public
501
+ * Image preview that is currently being generated.
502
+ *
503
+ * Display a loading state until the preview transitions to `"ready"` or `"error"`.
504
+ */
505
+ export declare interface ImagePreviewLoading extends SizedPreview {
506
+ kind: 'image';
507
+ status: 'loading';
508
+ }
509
+
510
+ /**
511
+ * @public
512
+ * Image preview that is ready to display.
513
+ *
514
+ * Contains the URL to the preview image.
515
+ */
516
+ export declare interface ImagePreviewReady extends SizedPreview {
517
+ kind: 'image';
518
+ status: 'ready';
519
+ /**
520
+ * Image format of the preview.
521
+ */
522
+ format: 'png' | 'jpg';
523
+ /**
524
+ * URL to the preview image.
525
+ *
526
+ * Use this URL to display the preview to users.
527
+ */
528
+ url: string;
529
+ }
530
+
531
+ /**
532
+ * @public
533
+ * Image file requirements for a media slot.
534
+ *
535
+ * Specifies format, aspect ratio, and size constraints for images.
536
+ *
537
+ * @example Image requirements for social media post
538
+ * ```ts
539
+ * const imageReq: ImageRequirement = {
540
+ * format: 'jpg',
541
+ * aspectRatio: { min: 0.8, max: 1.91 },
542
+ * };
543
+ * ```
544
+ */
545
+ export declare interface ImageRequirement extends BaseFileRequirement {
546
+ /**
547
+ * Supported image format.
548
+ */
549
+ format: 'png' | 'jpg';
550
+ /**
551
+ * Aspect ratio constraint (width / height).
552
+ *
553
+ * Examples:
554
+ * - `{ exact: 16/9 }`: Widescreen (16:9)
555
+ * - `{ min: 0.8, max: 1.91 }`: Instagram range
556
+ */
557
+ aspectRatio?: ValueRange;
558
+ }
559
+
560
+ /**
561
+ * @public
562
+ * Maximum value range constraint.
563
+ * @example Maximum value range
564
+ * ```ts
565
+ * const maxValue: ValueRange = { max: 10 }; // At most 10
566
+ * ```
567
+ */
568
+ export declare type MaxValueRange = {
569
+ max: number;
570
+ };
571
+
572
+ /**
573
+ * @public
574
+ * Configuration for a media slot within an output type.
575
+ *
576
+ * Defines what type of media is accepted, requirements, and constraints.
577
+ *
578
+ * @example Image slot with aspect ratio requirements
579
+ * ```ts
580
+ * const thumbnailSlot: MediaSlot = {
581
+ * id: 'thumbnail',
582
+ * displayName: 'Video Thumbnail',
583
+ * fileCount: { exact: 1 },
584
+ * accepts: {
585
+ * image: {
586
+ * format: 'jpg',
587
+ * aspectRatio: { exact: 16/9 },
588
+ * }
589
+ * }
590
+ * };
591
+ * ```
592
+ */
593
+ export declare type MediaSlot = {
594
+ /**
595
+ * Unique identifier for this media slot within the output type.
596
+ */
597
+ id: string;
598
+ /**
599
+ * User-facing name for this media slot.
600
+ *
601
+ * Examples: `"Post Image"`, `"Video Thumbnail"`, `"Main Video"`.
602
+ */
603
+ displayName: string;
604
+ /**
605
+ * Number of files accepted in this slot.
606
+ *
607
+ * Use this to specify single or multiple file requirements.
608
+ * Examples:
609
+ * - `{ exact: 1 }`: Exactly one file
610
+ * - `{ min: 1, max: 10 }`: Between 1 and 10 files
611
+ * - undefined: Any number of files
612
+ */
613
+ fileCount?: ValueRange;
614
+ /**
615
+ * File type requirements for this slot.
616
+ *
617
+ * Note the following behavior:
618
+ *
619
+ * - Provide at least one of `image` or `video`
620
+ * - If both are provided, files for this slot may be either images or videos; each file
621
+ * must satisfy the corresponding requirement for its media type
622
+ * - To restrict the slot to a single media type, provide only that requirement
623
+ * - `fileCount` applies across all files accepted by the slot regardless of media type
624
+ * - Document output types will show image previews (PNG thumbnail) in preview UI
625
+ */
626
+ accepts: {
627
+ image?: ImageRequirement;
628
+ video?: VideoRequirement;
629
+ document?: DocumentRequirement;
630
+
631
+ };
632
+ };
633
+
634
+ /**
635
+ * @public
636
+ * Minimum and maximum value range constraint.
637
+ * Ranges are inclusive `(min ≤ value ≤ max)`.
638
+ * @example Minimum and maximum value range
639
+ * ```ts
640
+ * const minMaxValue: ValueRange = { min: 1, max: 10 }; // Between 1 and 10
641
+ * ```
642
+ */
643
+ export declare type MinMaxValueRange = {
644
+ min: number;
645
+ max: number;
646
+ };
647
+
648
+ /**
649
+ * @public
650
+ * Minimum value range constraint.
651
+ * @example Minimum value range
652
+ * ```ts
653
+ * const minValue: ValueRange = { min: 3 }; // At least 3
654
+ * ```
655
+ */
656
+ export declare type MinValueRange = {
657
+ min: number;
658
+ };
659
+
660
+ /** @public */
661
+ export declare type OnContextChange = (context: SettingsUiContext) => void;
662
+
663
+ /**
664
+ * @public
665
+ * Exported file ready for publishing.
666
+ */
667
+ export declare type OutputFile = ImageOutputFile | VideoOutputFile | DocumentOutputFile;
668
+
669
+ /**
670
+ * @public
671
+ * Production-ready exported files for a specific media slot.
672
+ *
673
+ * These are the final files that should be uploaded to your platform.
674
+ */
675
+ export declare type OutputMedia = {
676
+ /**
677
+ * ID of the media slot these files belong to.
678
+ *
679
+ * Matches a media slot ID from your output type definition.
680
+ */
681
+ mediaSlotId: string;
682
+ /**
683
+ * Array of exported files for this media slot.
684
+ *
685
+ * Files match the requirements specified in your media slot configuration.
686
+ */
687
+ files: OutputFile[];
688
+ };
689
+
690
+ /**
691
+ * @public
692
+ * Metadata about a specific page in the exported content.
693
+ */
694
+ export declare type OutputPageMetadata = {
695
+ /**
696
+ * The unique identifier for the page.
697
+ */
698
+ pageId: string | undefined;
699
+ /**
700
+ * The position of the page within the design, starting from 1 for the first page.
701
+ */
702
+ pageNumber: number;
703
+ };
704
+
705
+ /**
706
+ * @public
707
+ * Configuration for an output type.
708
+ *
709
+ * Defines a specific publishing format your platform supports,
710
+ * including what media is required and accepted file types.
711
+ *
712
+ * @example Defining an Instagram post output type
713
+ * ```ts
714
+ * const instagramPost: OutputType = {
715
+ * id: 'instagram_post',
716
+ * displayName: 'Instagram Post',
717
+ * mediaSlots: [
718
+ * {
719
+ * id: 'main_image',
720
+ * displayName: 'Post Image',
721
+ * fileCount: { min: 1, max: 10 },
722
+ * accepts: {
723
+ * image: {
724
+ * format: 'jpg',
725
+ * aspectRatio: { min: 0.8, max: 1.91 },
726
+ * }
727
+ * }
728
+ * }
729
+ * ]
730
+ * };
731
+ * ```
732
+ */
733
+ export declare type OutputType = {
734
+ /**
735
+ * Unique identifier for this output type.
736
+ *
737
+ * Use descriptive IDs like `"instagram_post"` or `"youtube_video"`.
738
+ */
739
+ id: string;
740
+ /**
741
+ * User-facing name for this output type.
742
+ *
743
+ * This is displayed to users when selecting where to publish.
744
+ * Examples: `"Instagram Post"`, `"YouTube Video"`, `"Twitter Post"`.
745
+ */
746
+ displayName: string;
747
+ /**
748
+ * Array of media slots defining what content is needed.
749
+ *
750
+ * Each slot represents a piece of media required for publishing,
751
+ * such as a main image, thumbnail, or video.
752
+ */
753
+ mediaSlots: MediaSlot[];
754
+ };
755
+
756
+ /**
757
+ * @public
758
+ * Action to be taken after publishing completes successfully.
759
+ */
760
+ export declare type PostPublishAction = PostPublishActionRedirect;
761
+
762
+ /**
763
+ * @public
764
+ * Redirect action to navigate the user to a URL after publishing.
765
+ *
766
+ * @example Redirecting to content editor
767
+ * ```ts
768
+ * const postPublishAction: PostPublishActionRedirect = {
769
+ * type: 'redirect',
770
+ * url: 'https://example.com/posts/12345/edit'
771
+ * };
772
+ * ```
773
+ */
774
+ export declare type PostPublishActionRedirect = {
775
+ type: 'redirect';
776
+ /**
777
+ * The URL to redirect the user to after publishing.
778
+ */
779
+ url: string;
780
+ };
781
+
782
+ /**
783
+ * @public
784
+ *
785
+ * Prepares a {@link ContentPublisherIntent|Content Publisher Intent}.
786
+ *
787
+ * @example
788
+ * ```tsx
789
+ * import { prepareContentPublisher } from "@canva/intents/content";
790
+ *
791
+ * prepareContentPublisher({
792
+ * getPublishConfiguration: async (params) => {
793
+ * // Implement the logic to get the publish configuration
794
+ * },
795
+ * renderSettingsUi: (params) => {
796
+ * // Implement the UI for settings view
797
+ * },
798
+ * renderPreviewUi: (params) => {
799
+ * // Implement the UI for preview view
800
+ * },
801
+ * publishContent: async (params) => {
802
+ * // Implement the logic to publish the content
803
+ * },
804
+ * });
805
+ * ```
806
+ */
807
+ export declare const prepareContentPublisher: (implementation: ContentPublisherIntent) => void;
808
+
809
+ /**
810
+ * @public
811
+ * Preview item for an image or video.
812
+ *
813
+ * Check the `kind` and `status` properties to determine the type and state.
814
+ */
815
+ export declare type Preview = ImagePreview | VideoPreview | DocumentPreview | {
816
+ kind: 'email';
817
+ };
818
+
819
+ /**
820
+ * @public
821
+ * Type of preview media.
822
+ */
823
+ export declare type PreviewKind = 'image' | 'video' | 'document' | 'email';
824
+
825
+ /**
826
+ * @public
827
+ * Preview media for a specific media slot.
828
+ *
829
+ * Contains preview URLs and metadata for images or videos in the design.
830
+ */
831
+ export declare type PreviewMedia = {
832
+ /**
833
+ * ID of the media slot this preview belongs to.
834
+ *
835
+ * Matches a media slot ID from your output type definition.
836
+ */
837
+ mediaSlotId: string;
838
+ /**
839
+ * Array of preview items for this media slot.
840
+ *
841
+ * May contain multiple previews if the media slot accepts multiple files.
842
+ */
843
+ previews: Preview[];
844
+ };
845
+
846
+ /**
847
+ * @public
848
+ * State of a preview item.
849
+ */
850
+ export declare type PreviewStatus = 'loading' | 'thumbnail' | 'upgrading' | 'ready' | 'error';
851
+
852
+ /**
853
+ * @public
854
+ * Successful response from publishing a content.
855
+ *
856
+ * @example Basic successful publish
857
+ * ```ts
858
+ * return {
859
+ * status: 'completed',
860
+ * externalId: 'post_12345',
861
+ * externalUrl: 'https://example.com/posts/12345'
862
+ * };
863
+ * ```
864
+ *
865
+ * @example Successful publish with redirect
866
+ * ```ts
867
+ * return {
868
+ * status: 'completed',
869
+ * externalId: 'video_67890',
870
+ * externalUrl: 'https://example.com/videos/67890',
871
+ * postPublishAction: {
872
+ * type: 'redirect',
873
+ * url: 'https://example.com/videos/67890/edit'
874
+ * }
875
+ * };
876
+ * ```
877
+ */
878
+ export declare type PublishContentCompleted = {
879
+ status: 'completed';
880
+ /**
881
+ * Unique identifier returned from your external platform. You can use this for:
882
+ *
883
+ * - Tracking published content
884
+ * - Fetching insights data for the published content
885
+ * - Linking back to the content in future operations
886
+ */
887
+ externalId?: string;
888
+ /**
889
+ * Direct URL to the published content on your platform.
890
+ *
891
+ * Users can visit this URL to view their published content.
892
+ * This may be displayed to users or used for sharing.
893
+ */
894
+ externalUrl?: string;
895
+ /**
896
+ * Optional action to perform after publishing completes.
897
+ *
898
+ * Currently supports redirecting users to a specific URL after publishing.
899
+ */
900
+ postPublishAction?: PostPublishAction;
901
+ };
902
+
903
+ /**
904
+ * @public
905
+ * Error response from publishing a content.
906
+ *
907
+ * Return the appropriate error type based on the failure:
908
+ *
909
+ * - `"remote_request_failed"`: Network or API errors with your platform
910
+ * - `"app_error"`: Custom application errors with optional message
911
+ */
912
+ export declare type PublishContentError = RemoteRequestFailedError | AppError;
913
+
914
+ /**
915
+ * @public
916
+ * Parameters required for publishing the content.
917
+ * Contains all the information needed to send the content to your external platform.
918
+ */
919
+ export declare type PublishContentRequest = {
920
+ /**
921
+ * Platform-specific settings reference containing user configurations.
922
+ *
923
+ * This is the same reference you saved via `updatePublishSettings` in the settings UI.
924
+ * Parse this string to retrieve the user's publish settings (e.g., captions, tags, privacy).
925
+ *
926
+ * Maximum size: 5KB
927
+ */
928
+ publishRef?: string;
929
+ /**
930
+ * The output type selected by the user for this publish operation.
931
+ *
932
+ * This matches one of the output types you provided in `getPublishConfiguration`.
933
+ */
934
+ outputType: OutputType;
935
+ /**
936
+ * Production-ready exported files matching the requirements from your output type.
937
+ *
938
+ * These files are ready to upload to your platform and match the format, size,
939
+ * and aspect ratio requirements specified in your media slots.
940
+ */
941
+ outputMedia: OutputMedia[];
942
+ };
943
+
944
+ /**
945
+ * @public
946
+ * Response from a publish content operation.
947
+ *
948
+ * This can be either a successful completion or an error response.
949
+ */
950
+ export declare type PublishContentResponse = PublishContentCompleted | PublishContentError;
951
+
952
+ /** @public */
953
+ export declare type PublishError = {
954
+ appDefinedPayload?: string;
955
+ };
956
+
957
+ /**
958
+ * @public
959
+ * Signals that the publish error was cleared.
960
+ */
961
+ export declare type PublishErrorClearedSettingsUiContext = {
962
+ reason: 'publish_error_cleared';
963
+ };
964
+
965
+ /**
966
+ * @public
967
+ * Provides information about an error that occurred in publishContent.
968
+ */
969
+ export declare type PublishErrorSettingsUiContext = {
970
+ reason: 'publish_error';
971
+ /**
972
+ * The error that occurred. Undefined means no error occurred or the previous
973
+ * error was cleared by Canva.
974
+ */
975
+ error: PublishError;
976
+ };
977
+
978
+ /**
979
+ * @public
980
+ * Supported file formats for publishing.
981
+ */
982
+ export declare type PublishFileFormat = 'png' | 'jpg' | 'mp4' | 'pdf_standard' | 'html_bundle';
983
+
984
+ /**
985
+ * @public
986
+ * Validation state indicating whether publish settings are complete and valid.
987
+ */
988
+ export declare type PublishRefValidityState = 'valid' | 'invalid_missing_required_fields' | 'invalid_authentication_required';
989
+
990
+ /**
991
+ * @public
992
+ * Configuration for publish settings.
993
+ *
994
+ * Contains the user's settings and their validation state. Use this to
995
+ * control whether the publish button is enabled.
996
+ */
997
+ export declare type PublishSettings = {
998
+ /**
999
+ * Serialized platform-specific settings for publishing.
1000
+ *
1001
+ * Store all information your app needs to publish the content in this string.
1002
+ * This might include:
1003
+ *
1004
+ * - Captions or descriptions
1005
+ * - Tags or hashtags
1006
+ * - Privacy settings
1007
+ * - Publishing destination (account, page, etc.)
1008
+ * - Scheduling information
1009
+ *
1010
+ * This reference will be provided to your `publishContent` method when publishing.
1011
+ *
1012
+ * Maximum size: 5KB
1013
+ *
1014
+ * @example Serializing settings
1015
+ * ```ts
1016
+ * const settings = {
1017
+ * caption: 'Check out my design!',
1018
+ * tags: ['design', 'creative'],
1019
+ * privacy: 'public'
1020
+ * };
1021
+ * const publishRef = JSON.stringify(settings);
1022
+ * ```
1023
+ */
1024
+ publishRef?: string;
1025
+ /**
1026
+ * Validation state of the publish settings.
1027
+ *
1028
+ * Controls whether the publish button is enabled:
1029
+ *
1030
+ * - `"valid"`: Settings are complete and valid, publish button is enabled
1031
+ * - `"invalid_missing_required_fields"`: Required settings are missing, publish button is disabled
1032
+ * - `"invalid_authentication_required"`: User must authenticate before publishing can proceed
1033
+ */
1034
+ validityState: PublishRefValidityState;
1035
+ };
1036
+
1037
+ /**
1038
+ * @public
1039
+ * Provides information about the current state of the settings UI to help
1040
+ * you adapt the interface based on the selected output type.
1041
+ */
1042
+ export declare type PublishSettingsSettingsUiContext = {
1043
+ reason: 'publish_settings';
1044
+ /**
1045
+ * The currently selected output type.
1046
+ *
1047
+ * Use this to customize your settings UI based on the requirements
1048
+ * of different output types.
1049
+ */
1050
+ outputType: OutputType;
1051
+ };
1052
+
1053
+ /**
1054
+ * @public
1055
+ * {@link PublishContentError} indicating failure of the remote request to the external platform.
1056
+ *
1057
+ * Return this error for:
1058
+ *
1059
+ * - Network connectivity issues
1060
+ * - API endpoint failures
1061
+ * - HTTP errors from your platform
1062
+ * - Timeout errors
1063
+ *
1064
+ * @example Handling network errors
1065
+ * ```ts
1066
+ * try {
1067
+ * await uploadToExternalPlatform(file);
1068
+ * } catch (error) {
1069
+ * return { status: 'remote_request_failed' };
1070
+ * }
1071
+ * ```
1072
+ */
1073
+ export declare type RemoteRequestFailedError = {
1074
+ status: 'remote_request_failed';
1075
+ };
1076
+
1077
+ /**
1078
+ * @public
1079
+ * Configuration required for rendering the preview UI.
1080
+ *
1081
+ * Provides callbacks for managing preview media and responding to preview updates.
1082
+ */
1083
+ export declare type RenderPreviewUiRequest = {
1084
+ /**
1085
+ * Callback to upgrade video thumbnail previews to full video media.
1086
+ *
1087
+ * Call this function when you need full video previews instead of lightweight thumbnails.
1088
+ * This helps optimize performance by deferring full video loading until needed.
1089
+ *
1090
+ * Upgrades may complete asynchronously; listen to `registerOnPreviewChange` for updates
1091
+ * to receive the upgraded video previews.
1092
+ *
1093
+ * @param previewIds - Array of preview IDs to upgrade from thumbnail to full video
1094
+ *
1095
+ * @example Upgrading video previews on user interaction
1096
+ * ```ts
1097
+ * // When user clicks on a video thumbnail, upgrade to full video
1098
+ * if (preview.kind === 'video' && preview.status === 'thumbnail') {
1099
+ * requestPreviewUpgrade([preview.id]);
1100
+ * }
1101
+ * ```
1102
+ */
1103
+ requestPreviewUpgrade: (previewIds: string[]) => void;
1104
+ /**
1105
+ * Registers a callback to be invoked when preview data changes.
1106
+ *
1107
+ * This callback is triggered when:
1108
+ *
1109
+ * - The design content changes
1110
+ * - The output type changes
1111
+ * - Preview media is upgraded from thumbnail to full video
1112
+ * - Export settings are modified
1113
+ *
1114
+ * Use this to update your preview UI in real-time as users modify their design.
1115
+ *
1116
+ * @param callback - The callback invoked when preview data is updated
1117
+ * @returns A disposer function that cleans up the registered callback
1118
+ *
1119
+ * @example Handling preview updates
1120
+ * ```ts
1121
+ * const disposer = registerOnPreviewChange(({ previewMedia, outputType, publishRef }) => {
1122
+ * // Update your preview UI with the new preview media
1123
+ * previewMedia.forEach((media) => {
1124
+ * media.previews.forEach((preview) => {
1125
+ * if (preview.status === 'ready') {
1126
+ * displayPreview(preview);
1127
+ * }
1128
+ * });
1129
+ * });
1130
+ * });
1131
+ *
1132
+ * // Clean up when preview UI is unmounted
1133
+ * onUnmount(() => disposer());
1134
+ * ```
1135
+ */
1136
+ registerOnPreviewChange: (callback: (opts: {
1137
+ previewMedia: PreviewMedia[];
1138
+ /** The output type that the preview data is for */
1139
+ outputType: OutputType;
1140
+ /** The current publish settings reference, if available */
1141
+ publishRef?: string;
1142
+ }) => void) => Disposer;
1143
+ };
1144
+
1145
+ /**
1146
+ * @public
1147
+ * Configuration for the publish settings UI.
1148
+ *
1149
+ * This type provides the necessary callbacks and configuration for rendering
1150
+ * a custom publish settings interface where users configure platform-specific options.
1151
+ */
1152
+ export declare type RenderSettingsUiRequest = {
1153
+ /**
1154
+ * Callback to save and validate the user's publish settings.
1155
+ *
1156
+ * Call this function whenever the user modifies their settings to:
1157
+ *
1158
+ * - Save the settings for later use in `publishContent`
1159
+ * - Validate that required fields are filled
1160
+ * - Enable or disable the publish button based on validity
1161
+ *
1162
+ * Store all necessary publishing information in the `publishRef` string.
1163
+ * This will be provided to your `publishContent` method when the user publishes.
1164
+ *
1165
+ * @param settings - The new publish settings to save
1166
+ * @returns A promise that resolves when the settings are successfully saved
1167
+ * @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds 5KB.
1168
+ *
1169
+ * @example Updating settings as user types
1170
+ * ```ts
1171
+ * // As user fills in form fields, update settings
1172
+ * function handleCaptionChange(caption: string) {
1173
+ * const settings = { caption, tags: currentTags };
1174
+ * const publishRef = JSON.stringify(settings);
1175
+ *
1176
+ * updatePublishSettings({
1177
+ * publishRef,
1178
+ * validityState: caption ? 'valid' : 'invalid_missing_required_fields'
1179
+ * });
1180
+ * }
1181
+ * ```
1182
+ */
1183
+ updatePublishSettings: (publishSettings: PublishSettings) => Promise<UpdatePublishSettingsResponse>;
1184
+
1185
+ /**
1186
+ * Registers a callback to be invoked when the settings UI context changes.
1187
+ *
1188
+ * This callback is triggered when:
1189
+ * - the user changes the output type in the publish flow.
1190
+ * - an error occurs in the publish flow.
1191
+ *
1192
+ * Use this to respond to Canva changes and update your settings UI accordingly.
1193
+ *
1194
+ * @param opts - The options for registering a callback.
1195
+ * @returns A disposer function that cleans up the registered callback.
1196
+ *
1197
+ * @example Adapting UI for different output types
1198
+ * ```ts
1199
+ * registerOnContextChange({
1200
+ * onContextChange: (ctx) => {
1201
+ * if (ctx.reason === 'publish_settings') {
1202
+ * if (ctx.outputType.id === 'instagram_post') {
1203
+ * showHashtagField();
1204
+ * }
1205
+ * }
1206
+ * if (ctx.reason === 'publish_error') {
1207
+ * setError(ctx.error);
1208
+ * }
1209
+ * }
1210
+ * });
1211
+ * ```
1212
+ */
1213
+ registerOnContextChange: (opts: {
1214
+ onContextChange: OnContextChange;
1215
+ }) => Disposer;
1216
+ };
1217
+
1218
+ /**
1219
+ * @public
1220
+ * Context information for the publish settings UI.
1221
+ */
1222
+ export declare type SettingsUiContext = PublishSettingsSettingsUiContext | PublishErrorSettingsUiContext | PublishErrorClearedSettingsUiContext;
1223
+
1224
+ /**
1225
+ * @public
1226
+ * Base interface for all preview types that have a fixed width and height.
1227
+ */
1228
+ export declare interface SizedPreview extends BasePreview {
1229
+ /**
1230
+ * Width of the preview in pixels.
1231
+ */
1232
+ widthPx: number;
1233
+ /**
1234
+ * Height of the preview in pixels.
1235
+ */
1236
+ heightPx: number;
1237
+ }
1238
+
1239
+ /**
1240
+ * @public
1241
+ * Successful response from updating the publish settings.
1242
+ */
1243
+ export declare type UpdatePublishSettingsCompleted = {
1244
+ status: 'completed';
1245
+ };
1246
+
1247
+ /**
1248
+ * @public
1249
+ * Response from updating the publish settings.
1250
+ */
1251
+ export declare type UpdatePublishSettingsResponse = UpdatePublishSettingsCompleted;
1252
+
1253
+ /**
1254
+ * @public
1255
+ * Numeric value range constraint.
1256
+ * Used to specify requirements for aspect ratios, durations, file counts, etc.
1257
+ */
1258
+ export declare type ValueRange = ExactValueRange | MinValueRange | MaxValueRange | MinMaxValueRange;
1259
+
1260
+ /**
1261
+ * @public
1262
+ * Exported video file ready for publishing.
1263
+ */
1264
+ export declare interface VideoOutputFile extends BaseOutputFile {
1265
+ /**
1266
+ * Width of the video in pixels.
1267
+ */
1268
+ widthPx: number;
1269
+ /**
1270
+ * Height of the video in pixels.
1271
+ */
1272
+ heightPx: number;
1273
+ }
1274
+
1275
+ /**
1276
+ * @public
1277
+ * Video preview in various states.
1278
+ *
1279
+ * Videos transition through states: `"loading"` → `"thumbnail"` → `"upgrading"` → `"ready"`.
1280
+ * Start with thumbnails for better performance, then upgrade to full video using `requestPreviewUpgrade`.
1281
+ */
1282
+ export declare type VideoPreview = VideoPreviewLoading | VideoPreviewThumbnail | VideoPreviewUpgrading | VideoPreviewReady | VideoPreviewError;
1283
+
1284
+ /**
1285
+ * @public
1286
+ * Video preview that failed to generate.
1287
+ *
1288
+ * Display an error state to the user.
1289
+ */
1290
+ export declare interface VideoPreviewError extends SizedPreview {
1291
+ kind: 'video';
1292
+ status: 'error';
1293
+
1294
+ /**
1295
+ * The error message to display to the user.
1296
+ */
1297
+ message: string;
1298
+ }
1299
+
1300
+ /**
1301
+ * @public
1302
+ * Video preview that is currently being generated.
1303
+ *
1304
+ * Display a loading state until the preview transitions to `"thumbnail"` or `"error"`.
1305
+ */
1306
+ export declare interface VideoPreviewLoading extends SizedPreview {
1307
+ kind: 'video';
1308
+ status: 'loading';
1309
+ /**
1310
+ * Video duration in milliseconds.
1311
+ */
1312
+ durationMs?: number;
1313
+ }
1314
+
1315
+ /**
1316
+ * @public
1317
+ * Video preview with full video ready to play.
1318
+ *
1319
+ * Contains URLs for both the video and thumbnail.
1320
+ */
1321
+ export declare interface VideoPreviewReady extends SizedPreview {
1322
+ kind: 'video';
1323
+ status: 'ready';
1324
+ /**
1325
+ * Video format.
1326
+ */
1327
+ format: 'mp4';
1328
+ /**
1329
+ * URL to the full video.
1330
+ *
1331
+ * Use this URL in a video player.
1332
+ */
1333
+ url: string;
1334
+ /**
1335
+ * Format of the thumbnail image.
1336
+ */
1337
+ thumbnailFormat: 'png' | 'jpg';
1338
+ /**
1339
+ * URL to the thumbnail image.
1340
+ *
1341
+ * Can be used as a poster image for the video player.
1342
+ */
1343
+ thumbnailUrl: string;
1344
+ /**
1345
+ * Video duration in milliseconds.
1346
+ */
1347
+ durationMs?: number;
1348
+ }
1349
+
1350
+ /**
1351
+ * @public
1352
+ * Video preview with lightweight thumbnail available.
1353
+ *
1354
+ * This is the initial state for video previews. Show the thumbnail image
1355
+ * and call `requestPreviewUpgrade` when the user needs the full video.
1356
+ */
1357
+ export declare interface VideoPreviewThumbnail extends SizedPreview {
1358
+ kind: 'video';
1359
+ status: 'thumbnail';
1360
+ /**
1361
+ * Format of the thumbnail image.
1362
+ */
1363
+ thumbnailFormat: 'png' | 'jpg';
1364
+ /**
1365
+ * URL to the thumbnail image.
1366
+ *
1367
+ * Display this lightweight image until full video is needed.
1368
+ */
1369
+ thumbnailUrl: string;
1370
+ /**
1371
+ * Video duration in milliseconds.
1372
+ */
1373
+ durationMs?: number;
1374
+ }
1375
+
1376
+ /**
1377
+ * @public
1378
+ * Video preview that is being upgraded from thumbnail to full video.
1379
+ *
1380
+ * Display the thumbnail with a loading indicator until the video is ready.
1381
+ */
1382
+ export declare interface VideoPreviewUpgrading extends SizedPreview {
1383
+ kind: 'video';
1384
+ status: 'upgrading';
1385
+ /**
1386
+ * Format of the thumbnail image.
1387
+ */
1388
+ thumbnailFormat: 'png' | 'jpg';
1389
+ /**
1390
+ * URL to the thumbnail image.
1391
+ *
1392
+ * Continue showing the thumbnail while the full video loads.
1393
+ */
1394
+ thumbnailUrl: string;
1395
+ /**
1396
+ * Video duration in milliseconds.
1397
+ */
1398
+ durationMs?: number;
1399
+ }
1400
+
1401
+ /**
1402
+ * @public
1403
+ * Video file requirements for a media slot.
1404
+ *
1405
+ * Specifies format, aspect ratio, duration, and size constraints for videos.
1406
+ *
1407
+ * @example Video requirements for YouTube
1408
+ * ```ts
1409
+ * const videoReq: VideoRequirement = {
1410
+ * format: 'mp4',
1411
+ * aspectRatio: { exact: 16/9 },
1412
+ * durationMs: { min: 1000, max: 600000 },
1413
+ * };
1414
+ * ```
1415
+ */
1416
+ export declare interface VideoRequirement extends BaseFileRequirement {
1417
+ /**
1418
+ * Supported video format.
1419
+ */
1420
+ format: 'mp4';
1421
+ /**
1422
+ * Aspect ratio constraint (width / height).
1423
+ *
1424
+ * Examples:
1425
+ * - `{ exact: 16/9 }`: Widescreen
1426
+ * - `{ exact: 9/16 }`: Vertical/Story format
1427
+ */
1428
+ aspectRatio?: ValueRange;
1429
+ /**
1430
+ * Duration constraint in milliseconds.
1431
+ *
1432
+ * Examples:
1433
+ * - `{ max: 60000 }`: Maximum 60 seconds
1434
+ * - `{ min: 3000, max: 600000 }`: Between 3 seconds and 10 minutes
1435
+ */
1436
+ durationMs?: ValueRange;
1437
+
1438
+ }
1439
+
1440
+ export { }