@canva/intents 2.2.1-beta.1 → 2.3.0

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