@canva/intents 2.3.0 → 2.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.4.0 - 2026-03-23
4
+
5
+ ### Added
6
+
7
+ - Launch the new Email media type to public, enabling publishing and selection of email pages.
8
+
9
+ ## 2.3.1 - 2026-03-12
10
+
11
+ ### Fixed
12
+
13
+ - Re-export data types from the intents/data public API that were accidentally removed during a refactor
14
+ - Rename `Selection` type to `MediaSelection` for clarity
15
+
3
16
  ## 2.3.0 - 2026-03-06
4
17
 
5
18
  ### Added
@@ -305,6 +305,7 @@ export declare interface DesignContentMetadata {
305
305
  * The pages that make up the exported metadata
306
306
  */
307
307
  pages: OutputPageMetadata[];
308
+
308
309
  }
309
310
 
310
311
  /**
@@ -422,10 +423,75 @@ export declare type DocumentSelection = {
422
423
  export declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
423
424
 
424
425
  /**
425
- * Email preview stub used before beta preview type is fully supported.
426
+ * @public
427
+ * Exported email file ready for publishing.
428
+ *
429
+ * Contains the final HTML bundle that should be uploaded to your platform.
430
+ */
431
+ export declare type EmailOutputFile = BaseOutputFile;
432
+
433
+ /**
434
+ * @public
435
+ * Email preview in various states.
436
+ *
437
+ * Display a loading state until the preview transitions to `"ready"` or `"error"`.
438
+ */
439
+ export declare type EmailPreview = EmailPreviewLoading | EmailPreviewReady | EmailPreviewError;
440
+
441
+ /**
442
+ * @public
443
+ * Email preview in an error state.
444
+ *
445
+ * Display an error state to the user.
446
+ */
447
+ export declare interface EmailPreviewError extends BasePreview {
448
+ kind: 'email';
449
+ status: 'error';
450
+ message: string;
451
+ }
452
+
453
+ /**
454
+ * @public
455
+ * Email preview in a loading state.
456
+ *
457
+ * Display a loading spinner until the preview transitions to `"ready"` or `"error"`.
458
+ */
459
+ export declare interface EmailPreviewLoading extends BasePreview {
460
+ kind: 'email';
461
+ status: 'loading';
462
+ }
463
+
464
+ /**
465
+ * @public
466
+ * Email preview in a ready state.
467
+ *
468
+ * Display the email preview.
426
469
  */
427
- declare interface EmailPreviewStub extends BasePreview {
470
+ export declare interface EmailPreviewReady extends BasePreview {
428
471
  kind: 'email';
472
+ status: 'ready';
473
+ /**
474
+ * URL to the single html file that represents the email.
475
+ */
476
+ url: string;
477
+ }
478
+
479
+ /**
480
+ * @public
481
+ * Email file requirements for a media slot, currently only supports HTML bundle format.
482
+ *
483
+ * Note: Email output types use html_standalone previews in the preview UI.
484
+ * The actual email file is only generated for the final output in OutputMedia.
485
+ *
486
+ * @example Email bundle requirements
487
+ * ```ts
488
+ * const emailReq: EmailRequirement = {
489
+ * format: 'html_bundle',
490
+ * };
491
+ * ```
492
+ */
493
+ export declare interface EmailRequirement extends BaseFileRequirement {
494
+ format: 'html_bundle' | 'html_standalone';
429
495
  }
430
496
 
431
497
  /**
@@ -600,6 +666,15 @@ export declare type MaxValueRange = {
600
666
  max: number;
601
667
  };
602
668
 
669
+ /**
670
+ * @public
671
+ * Metadata about a selected media item in a media slot.
672
+ *
673
+ * Canva populates this when returning {@link OutputType} in Settings UI contexts.
674
+ * Apps should not set this value.
675
+ */
676
+ export declare type MediaSelection = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
677
+
603
678
  /**
604
679
  * @public
605
680
  * Configuration for a media slot within an output type.
@@ -658,7 +733,10 @@ export declare type MediaSlot = {
658
733
  image?: ImageRequirement;
659
734
  video?: VideoRequirement;
660
735
  document?: DocumentRequirement;
661
-
736
+ /**
737
+ * Email output types will show a single html file (canva hosted assets) preview in preview UI
738
+ */
739
+ email?: EmailRequirement;
662
740
  };
663
741
  /**
664
742
  * @public
@@ -669,7 +747,7 @@ export declare type MediaSlot = {
669
747
  * Apps should not set this value when defining output types in
670
748
  * {@link ContentPublisherIntent.getPublishConfiguration}.
671
749
  */
672
- readonly selection?: readonly Selection_2[];
750
+ readonly selection?: readonly MediaSelection[];
673
751
  };
674
752
 
675
753
  /**
@@ -905,7 +983,7 @@ export declare const prepareContentPublisher: (implementation: ContentPublisherI
905
983
  *
906
984
  * Check the `kind` and `status` properties to determine the type and state.
907
985
  */
908
- export declare type Preview = ImagePreview | VideoPreview | DocumentPreview | EmailPreviewStub;
986
+ export declare type Preview = ImagePreview | VideoPreview | DocumentPreview | EmailPreview;
909
987
 
910
988
  /**
911
989
  * @public
@@ -1369,17 +1447,8 @@ export declare type RenderSettingsUiRequest = {
1369
1447
  registerOnContextChange: (opts: {
1370
1448
  onContextChange: OnContextChange;
1371
1449
  }) => Disposer;
1372
- };
1373
1450
 
1374
- /**
1375
- * @public
1376
- * Metadata about a selected media item in a media slot.
1377
- *
1378
- * Canva populates this when returning {@link OutputType} in Settings UI contexts.
1379
- * Apps should not set this value.
1380
- */
1381
- declare type Selection_2 = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
1382
- export { Selection_2 as Selection }
1451
+ };
1383
1452
 
1384
1453
  /**
1385
1454
  * @public
package/data/index.d.ts CHANGED
@@ -117,7 +117,7 @@ declare type AppErrorInvocationContext = {
117
117
  * };
118
118
  * ```
119
119
  */
120
- declare type BooleanDataTableCell = {
120
+ export declare type BooleanDataTableCell = {
121
121
  /**
122
122
  * Indicates this cell contains a boolean value.
123
123
  */
@@ -134,7 +134,7 @@ declare type BooleanDataTableCell = {
134
134
  * @public
135
135
  * Configuration for a table column.
136
136
  */
137
- declare type ColumnConfig = {
137
+ export declare type ColumnConfig = {
138
138
  /**
139
139
  * Name for the column, displayed as header text.
140
140
  *
@@ -330,7 +330,7 @@ export declare type DataSourceRef = {
330
330
  * };
331
331
  * ```
332
332
  */
333
- declare type DataTable = {
333
+ export declare type DataTable = {
334
334
  /**
335
335
  * Column definitions with names and data types.
336
336
  *
@@ -349,7 +349,7 @@ declare type DataTable = {
349
349
  * @public
350
350
  * Generic type for table cells that resolves to a specific cell type.
351
351
  */
352
- declare type DataTableCell<T extends DataType = DataType> = {
352
+ export declare type DataTableCell<T extends DataType = DataType> = {
353
353
  date: DateDataTableCell;
354
354
  string: StringDataTableCell;
355
355
  number: NumberDataTableCell;
@@ -361,7 +361,7 @@ declare type DataTableCell<T extends DataType = DataType> = {
361
361
  * @public
362
362
  * Options for uploading an image asset to the user's private media library.
363
363
  */
364
- declare type DataTableImageUpload = Omit<ImageUploadOptions, 'type' | 'parentRef'> & {
364
+ export declare type DataTableImageUpload = Omit<ImageUploadOptions, 'type' | 'parentRef'> & {
365
365
  /**
366
366
  * Indicates this value contains options for image uploading.
367
367
  */
@@ -372,7 +372,7 @@ declare type DataTableImageUpload = Omit<ImageUploadOptions, 'type' | 'parentRef
372
372
  * @public
373
373
  * Maximum dimensions for imported data tables.
374
374
  */
375
- declare type DataTableLimit = {
375
+ export declare type DataTableLimit = {
376
376
  /**
377
377
  * The maximum number of rows allowed.
378
378
  *
@@ -430,7 +430,7 @@ export declare type DataTableMetadata = {
430
430
  * };
431
431
  * ```
432
432
  */
433
- declare type DataTableRow = {
433
+ export declare type DataTableRow = {
434
434
  /**
435
435
  * Array of cells containing the data values.
436
436
  *
@@ -443,7 +443,7 @@ declare type DataTableRow = {
443
443
  * @public
444
444
  * Options for uploading a video asset to the user's private media library.
445
445
  */
446
- declare type DataTableVideoUpload = Omit<VideoUploadOptions, 'type' | 'parentRef'> & {
446
+ export declare type DataTableVideoUpload = Omit<VideoUploadOptions, 'type' | 'parentRef'> & {
447
447
  /**
448
448
  * Indicates this value contains options for video uploading.
449
449
  */
@@ -454,7 +454,7 @@ declare type DataTableVideoUpload = Omit<VideoUploadOptions, 'type' | 'parentRef
454
454
  * @public
455
455
  * Data types supported for table cells.
456
456
  */
457
- declare type DataType = 'string' | 'number' | 'date' | 'boolean' | 'media';
457
+ export declare type DataType = 'string' | 'number' | 'date' | 'boolean' | 'media';
458
458
 
459
459
  /**
460
460
  * @public
@@ -475,7 +475,7 @@ declare type DataType = 'string' | 'number' | 'date' | 'boolean' | 'media';
475
475
  * };
476
476
  * ```
477
477
  */
478
- declare type DateDataTableCell = {
478
+ export declare type DateDataTableCell = {
479
479
  /**
480
480
  * Indicates this cell contains a date value.
481
481
  */
@@ -782,7 +782,7 @@ export declare type InvocationContext = DataSelectionInvocationContext | Outdate
782
782
  * };
783
783
  * ```
784
784
  */
785
- declare type MediaCollectionDataTableCell = {
785
+ export declare type MediaCollectionDataTableCell = {
786
786
  /**
787
787
  * Indicates this cell contains a media collection.
788
788
  */
@@ -836,7 +836,7 @@ declare type Never<T> = {
836
836
  * };
837
837
  * ```
838
838
  */
839
- declare type NumberCellMetadata = {
839
+ export declare type NumberCellMetadata = {
840
840
  /**
841
841
  * Formatting pattern using Office Open XML Format.
842
842
  *
@@ -871,7 +871,7 @@ declare type NumberCellMetadata = {
871
871
  * };
872
872
  * ```
873
873
  */
874
- declare type NumberDataTableCell = {
874
+ export declare type NumberDataTableCell = {
875
875
  /**
876
876
  * Indicates this cell contains a number value.
877
877
  */
@@ -1051,7 +1051,7 @@ export declare type RenderSelectionUiRequest = {
1051
1051
  * };
1052
1052
  * ```
1053
1053
  */
1054
- declare type StringDataTableCell = {
1054
+ export declare type StringDataTableCell = {
1055
1055
  /**
1056
1056
  * Indicates this cell contains a string value.
1057
1057
  */
package/index.d.ts CHANGED
@@ -267,6 +267,12 @@ declare namespace content {
267
267
  prepareContentPublisher,
268
268
  Disposer,
269
269
  PublishContentRequest,
270
+ Preview,
271
+ PreviewMedia,
272
+ RenderPreviewUiInvocationContext,
273
+ PublishPreviewUiInvocationContext,
274
+ RenderPreviewUiRequest,
275
+ ContentPublisherIntent,
270
276
  RenderSettingsUiInvocationContext,
271
277
  PublishSettingsUiInvocationContext,
272
278
  RenderSettingsUiRequest,
@@ -297,7 +303,8 @@ declare namespace content {
297
303
  ImageRequirement,
298
304
  VideoRequirement,
299
305
  DocumentRequirement,
300
- Selection_2 as Selection,
306
+ EmailRequirement,
307
+ MediaSelection,
301
308
  ImageSelection,
302
309
  VideoSelection,
303
310
  DocumentSelection,
@@ -323,6 +330,10 @@ declare namespace content {
323
330
  VideoPreviewUpgrading,
324
331
  VideoPreviewReady,
325
332
  VideoPreviewError,
333
+ EmailPreview,
334
+ EmailPreviewLoading,
335
+ EmailPreviewReady,
336
+ EmailPreviewError,
326
337
  BasePreview,
327
338
  SizedPreview,
328
339
  PreviewKind,
@@ -333,15 +344,10 @@ declare namespace content {
333
344
  VideoOutputFile,
334
345
  BaseOutputFile,
335
346
  DocumentOutputFile,
347
+ EmailOutputFile,
336
348
  ContentMetadata,
337
349
  DesignContentMetadata,
338
- OutputPageMetadata,
339
- Preview,
340
- PreviewMedia,
341
- RenderPreviewUiInvocationContext,
342
- PublishPreviewUiInvocationContext,
343
- RenderPreviewUiRequest,
344
- ContentPublisherIntent
350
+ OutputPageMetadata
345
351
  }
346
352
  }
347
353
  export { content }
@@ -535,7 +541,21 @@ declare namespace data {
535
541
  DataTableMetadata,
536
542
  GetDataTableError,
537
543
  UpdateDataRefResponse,
538
- DataSourceRef
544
+ DataSourceRef,
545
+ DataTableLimit,
546
+ DataType,
547
+ DataTable,
548
+ ColumnConfig,
549
+ DataTableRow,
550
+ DataTableCell,
551
+ DateDataTableCell,
552
+ StringDataTableCell,
553
+ NumberDataTableCell,
554
+ NumberCellMetadata,
555
+ BooleanDataTableCell,
556
+ MediaCollectionDataTableCell,
557
+ DataTableImageUpload,
558
+ DataTableVideoUpload
539
559
  }
540
560
  }
541
561
  export { data }
@@ -904,6 +924,7 @@ declare interface DesignContentMetadata {
904
924
  * The pages that make up the exported metadata
905
925
  */
906
926
  pages: OutputPageMetadata[];
927
+
907
928
  }
908
929
 
909
930
  /**
@@ -1058,10 +1079,75 @@ declare type DocumentSelection = {
1058
1079
  declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
1059
1080
 
1060
1081
  /**
1061
- * Email preview stub used before beta preview type is fully supported.
1082
+ * @public
1083
+ * Exported email file ready for publishing.
1084
+ *
1085
+ * Contains the final HTML bundle that should be uploaded to your platform.
1086
+ */
1087
+ declare type EmailOutputFile = BaseOutputFile;
1088
+
1089
+ /**
1090
+ * @public
1091
+ * Email preview in various states.
1092
+ *
1093
+ * Display a loading state until the preview transitions to `"ready"` or `"error"`.
1094
+ */
1095
+ declare type EmailPreview = EmailPreviewLoading | EmailPreviewReady | EmailPreviewError;
1096
+
1097
+ /**
1098
+ * @public
1099
+ * Email preview in an error state.
1100
+ *
1101
+ * Display an error state to the user.
1102
+ */
1103
+ declare interface EmailPreviewError extends BasePreview {
1104
+ kind: 'email';
1105
+ status: 'error';
1106
+ message: string;
1107
+ }
1108
+
1109
+ /**
1110
+ * @public
1111
+ * Email preview in a loading state.
1112
+ *
1113
+ * Display a loading spinner until the preview transitions to `"ready"` or `"error"`.
1114
+ */
1115
+ declare interface EmailPreviewLoading extends BasePreview {
1116
+ kind: 'email';
1117
+ status: 'loading';
1118
+ }
1119
+
1120
+ /**
1121
+ * @public
1122
+ * Email preview in a ready state.
1123
+ *
1124
+ * Display the email preview.
1062
1125
  */
1063
- declare interface EmailPreviewStub extends BasePreview {
1126
+ declare interface EmailPreviewReady extends BasePreview {
1064
1127
  kind: 'email';
1128
+ status: 'ready';
1129
+ /**
1130
+ * URL to the single html file that represents the email.
1131
+ */
1132
+ url: string;
1133
+ }
1134
+
1135
+ /**
1136
+ * @public
1137
+ * Email file requirements for a media slot, currently only supports HTML bundle format.
1138
+ *
1139
+ * Note: Email output types use html_standalone previews in the preview UI.
1140
+ * The actual email file is only generated for the final output in OutputMedia.
1141
+ *
1142
+ * @example Email bundle requirements
1143
+ * ```ts
1144
+ * const emailReq: EmailRequirement = {
1145
+ * format: 'html_bundle',
1146
+ * };
1147
+ * ```
1148
+ */
1149
+ declare interface EmailRequirement extends BaseFileRequirement {
1150
+ format: 'html_bundle' | 'html_standalone';
1065
1151
  }
1066
1152
 
1067
1153
  /**
@@ -1528,6 +1614,15 @@ declare type MediaCollectionDataTableCell = {
1528
1614
  value: (DataTableImageUpload | DataTableVideoUpload)[];
1529
1615
  };
1530
1616
 
1617
+ /**
1618
+ * @public
1619
+ * Metadata about a selected media item in a media slot.
1620
+ *
1621
+ * Canva populates this when returning {@link OutputType} in Settings UI contexts.
1622
+ * Apps should not set this value.
1623
+ */
1624
+ declare type MediaSelection = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
1625
+
1531
1626
  /**
1532
1627
  * @public
1533
1628
  * Configuration for a media slot within an output type.
@@ -1586,7 +1681,10 @@ declare type MediaSlot = {
1586
1681
  image?: ImageRequirement;
1587
1682
  video?: VideoRequirement;
1588
1683
  document?: DocumentRequirement;
1589
-
1684
+ /**
1685
+ * Email output types will show a single html file (canva hosted assets) preview in preview UI
1686
+ */
1687
+ email?: EmailRequirement;
1590
1688
  };
1591
1689
  /**
1592
1690
  * @public
@@ -1597,7 +1695,7 @@ declare type MediaSlot = {
1597
1695
  * Apps should not set this value when defining output types in
1598
1696
  * {@link ContentPublisherIntent.getPublishConfiguration}.
1599
1697
  */
1600
- readonly selection?: readonly Selection_2[];
1698
+ readonly selection?: readonly MediaSelection[];
1601
1699
  };
1602
1700
 
1603
1701
  /**
@@ -2027,7 +2125,7 @@ declare const prepareDesignEditor: (implementation: DesignEditorIntent) => void;
2027
2125
  *
2028
2126
  * Check the `kind` and `status` properties to determine the type and state.
2029
2127
  */
2030
- declare type Preview = ImagePreview | VideoPreview | DocumentPreview | EmailPreviewStub;
2128
+ declare type Preview = ImagePreview | VideoPreview | DocumentPreview | EmailPreview;
2031
2129
 
2032
2130
  /**
2033
2131
  * @public
@@ -2552,16 +2650,8 @@ declare type RenderSettingsUiRequest = {
2552
2650
  registerOnContextChange: (opts: {
2553
2651
  onContextChange: OnContextChange;
2554
2652
  }) => Disposer;
2555
- };
2556
2653
 
2557
- /**
2558
- * @public
2559
- * Metadata about a selected media item in a media slot.
2560
- *
2561
- * Canva populates this when returning {@link OutputType} in Settings UI contexts.
2562
- * Apps should not set this value.
2563
- */
2564
- declare type Selection_2 = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
2654
+ };
2565
2655
 
2566
2656
  /**
2567
2657
  * @public
@@ -19,6 +19,6 @@ _export(exports, {
19
19
  return LATEST_VERSION_BETA;
20
20
  }
21
21
  });
22
- const LATEST_VERSION = '2.3.0';
22
+ const LATEST_VERSION = '2.4.0';
23
23
  const LATEST_VERSION_BETA = '2.2.1-beta.1';
24
24
  const LATEST_VERSION_ALPHA = 'NONE';
@@ -1,3 +1,3 @@
1
- export const LATEST_VERSION = '2.3.0';
1
+ export const LATEST_VERSION = '2.4.0';
2
2
  export const LATEST_VERSION_BETA = '2.2.1-beta.1';
3
3
  export const LATEST_VERSION_ALPHA = 'NONE';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/intents",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "The Canva Apps SDK Intents library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",