@canva/intents 2.4.0 → 2.5.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 +11 -0
- package/content/index.d.ts +72 -21
- package/index.d.ts +75 -21
- package/lib/cjs/sdk/intents/version.js +2 -2
- package/lib/esm/sdk/intents/version.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.5.0 - 2026-04-09
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Increased the `publishRef` size limit from 5KB to 32KB, allowing apps to store more complex publishing settings.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Add selection metadata in MediaSelection
|
|
12
|
+
- Enable apps to support transparent PNG exports in publish flow by adding optional allowTransparentBackground capability to ImageRequirement
|
|
13
|
+
|
|
3
14
|
## 2.4.0 - 2026-03-23
|
|
4
15
|
|
|
5
16
|
### Added
|
package/content/index.d.ts
CHANGED
|
@@ -110,6 +110,20 @@ export declare interface BasePreview {
|
|
|
110
110
|
status: PreviewStatus;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
* Base metadata available for a selected media item in a media slot.
|
|
116
|
+
*
|
|
117
|
+
* Canva populates this when returning {@link OutputType} in Settings UI contexts.
|
|
118
|
+
* Apps should not set this value.
|
|
119
|
+
*/
|
|
120
|
+
export declare interface BaseSelection {
|
|
121
|
+
/**
|
|
122
|
+
* Metadata about the source content represented by this selection.
|
|
123
|
+
*/
|
|
124
|
+
selectionMetadata?: readonly SelectionMetadata[];
|
|
125
|
+
}
|
|
126
|
+
|
|
113
127
|
/**
|
|
114
128
|
* @public
|
|
115
129
|
* Metadata about the source content used to create an exported file.
|
|
@@ -182,7 +196,7 @@ export declare type ContentPublisherIntent = {
|
|
|
182
196
|
* privacy settings, or publishing destinations.
|
|
183
197
|
*
|
|
184
198
|
* Use the `updatePublishSettings` callback to save user settings and validate them.
|
|
185
|
-
* Settings are stored in the `publishRef` string (maximum
|
|
199
|
+
* Settings are stored in the `publishRef` string (maximum 32KB).
|
|
186
200
|
*
|
|
187
201
|
* @param request - Configuration and callbacks for the publish settings UI.
|
|
188
202
|
*
|
|
@@ -412,9 +426,9 @@ export declare interface DocumentRequirement extends BaseFileRequirement {
|
|
|
412
426
|
* @public
|
|
413
427
|
* Selection metadata for a document media item.
|
|
414
428
|
*/
|
|
415
|
-
export declare
|
|
429
|
+
export declare interface DocumentSelection extends BaseSelection {
|
|
416
430
|
kind: 'document';
|
|
417
|
-
}
|
|
431
|
+
}
|
|
418
432
|
|
|
419
433
|
/**
|
|
420
434
|
* @public
|
|
@@ -498,9 +512,9 @@ export declare interface EmailRequirement extends BaseFileRequirement {
|
|
|
498
512
|
* @public
|
|
499
513
|
* Selection metadata for an email media item.
|
|
500
514
|
*/
|
|
501
|
-
export declare
|
|
515
|
+
export declare interface EmailSelection extends BaseSelection {
|
|
502
516
|
kind: 'email';
|
|
503
|
-
}
|
|
517
|
+
}
|
|
504
518
|
|
|
505
519
|
/**
|
|
506
520
|
* @public
|
|
@@ -631,11 +645,7 @@ export declare interface ImagePreviewReady extends SizedPreview {
|
|
|
631
645
|
* };
|
|
632
646
|
* ```
|
|
633
647
|
*/
|
|
634
|
-
export declare
|
|
635
|
-
/**
|
|
636
|
-
* Supported image format.
|
|
637
|
-
*/
|
|
638
|
-
format: 'png' | 'jpg';
|
|
648
|
+
export declare type ImageRequirement = BaseFileRequirement & {
|
|
639
649
|
/**
|
|
640
650
|
* Aspect ratio constraint (width / height).
|
|
641
651
|
*
|
|
@@ -644,15 +654,37 @@ export declare interface ImageRequirement extends BaseFileRequirement {
|
|
|
644
654
|
* - `{ min: 0.8, max: 1.91 }`: Instagram range
|
|
645
655
|
*/
|
|
646
656
|
aspectRatio?: ValueRange;
|
|
647
|
-
}
|
|
657
|
+
} & ({
|
|
658
|
+
/**
|
|
659
|
+
* JPG image export.
|
|
660
|
+
*/
|
|
661
|
+
format: 'jpg';
|
|
662
|
+
} | {
|
|
663
|
+
/**
|
|
664
|
+
* PNG image export.
|
|
665
|
+
*/
|
|
666
|
+
format: 'png';
|
|
667
|
+
/**
|
|
668
|
+
* Controls transparent-background support for PNG exports.
|
|
669
|
+
*
|
|
670
|
+
* @remarks
|
|
671
|
+
* - Only applies when `format` is `'png'`
|
|
672
|
+
* - If omitted or `false`, Canva exports a standard opaque PNG
|
|
673
|
+
* - If `true`, Canva shows a `Transparent background` toggle in the publish flow
|
|
674
|
+
* - Users without the required Canva entitlement may be prompted to upgrade before a transparent export is produced
|
|
675
|
+
*
|
|
676
|
+
* @defaultValue false
|
|
677
|
+
*/
|
|
678
|
+
allowTransparentBackground?: boolean;
|
|
679
|
+
});
|
|
648
680
|
|
|
649
681
|
/**
|
|
650
682
|
* @public
|
|
651
683
|
* Selection metadata for an image media item.
|
|
652
684
|
*/
|
|
653
|
-
export declare
|
|
685
|
+
export declare interface ImageSelection extends BaseSelection {
|
|
654
686
|
kind: 'image';
|
|
655
|
-
}
|
|
687
|
+
}
|
|
656
688
|
|
|
657
689
|
/**
|
|
658
690
|
* @public
|
|
@@ -669,9 +701,6 @@ export declare type MaxValueRange = {
|
|
|
669
701
|
/**
|
|
670
702
|
* @public
|
|
671
703
|
* 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
704
|
*/
|
|
676
705
|
export declare type MediaSelection = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
|
|
677
706
|
|
|
@@ -1092,7 +1121,7 @@ export declare type PublishContentRequest = {
|
|
|
1092
1121
|
* This is the same reference you saved via `updatePublishSettings` in the settings UI.
|
|
1093
1122
|
* Parse this string to retrieve the user's publish settings (e.g., captions, tags, privacy).
|
|
1094
1123
|
*
|
|
1095
|
-
* Maximum size:
|
|
1124
|
+
* Maximum size: 32KB
|
|
1096
1125
|
*/
|
|
1097
1126
|
publishRef?: string;
|
|
1098
1127
|
/**
|
|
@@ -1198,7 +1227,7 @@ export declare type PublishSettings = {
|
|
|
1198
1227
|
*
|
|
1199
1228
|
* This reference will be provided to your `publishContent` method when publishing.
|
|
1200
1229
|
*
|
|
1201
|
-
* Maximum size:
|
|
1230
|
+
* Maximum size: 32KB
|
|
1202
1231
|
*
|
|
1203
1232
|
* @example Serializing settings
|
|
1204
1233
|
* ```ts
|
|
@@ -1398,7 +1427,7 @@ export declare type RenderSettingsUiRequest = {
|
|
|
1398
1427
|
*
|
|
1399
1428
|
* @param settings - The new publish settings to save
|
|
1400
1429
|
* @returns A promise that resolves when the settings are successfully saved
|
|
1401
|
-
* @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds
|
|
1430
|
+
* @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds 32KB.
|
|
1402
1431
|
*
|
|
1403
1432
|
* @example Updating settings as user types
|
|
1404
1433
|
* ```ts
|
|
@@ -1450,6 +1479,28 @@ export declare type RenderSettingsUiRequest = {
|
|
|
1450
1479
|
|
|
1451
1480
|
};
|
|
1452
1481
|
|
|
1482
|
+
/**
|
|
1483
|
+
* @public
|
|
1484
|
+
* Metadata specific to design content represented by a media selection.
|
|
1485
|
+
*/
|
|
1486
|
+
export declare interface SelectionDesignMetadata {
|
|
1487
|
+
type: 'design';
|
|
1488
|
+
/**
|
|
1489
|
+
* A signed JWT token containing the design id
|
|
1490
|
+
*/
|
|
1491
|
+
designToken: string;
|
|
1492
|
+
/**
|
|
1493
|
+
* The user given title of the design
|
|
1494
|
+
*/
|
|
1495
|
+
title: string | undefined;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* @public
|
|
1500
|
+
* Metadata about the source content represented by a media selection.
|
|
1501
|
+
*/
|
|
1502
|
+
export declare type SelectionMetadata = SelectionDesignMetadata;
|
|
1503
|
+
|
|
1453
1504
|
/**
|
|
1454
1505
|
* @public
|
|
1455
1506
|
* Context information for the publish settings UI.
|
|
@@ -1676,12 +1727,12 @@ export declare interface VideoRequirement extends BaseFileRequirement {
|
|
|
1676
1727
|
* @public
|
|
1677
1728
|
* Selection metadata for a video media item.
|
|
1678
1729
|
*/
|
|
1679
|
-
export declare
|
|
1730
|
+
export declare interface VideoSelection extends BaseSelection {
|
|
1680
1731
|
kind: 'video';
|
|
1681
1732
|
/**
|
|
1682
1733
|
* Duration of the selected video in milliseconds.
|
|
1683
1734
|
*/
|
|
1684
1735
|
durationMs: number;
|
|
1685
|
-
}
|
|
1736
|
+
}
|
|
1686
1737
|
|
|
1687
1738
|
export { }
|
package/index.d.ts
CHANGED
|
@@ -195,6 +195,20 @@ declare interface BasePreview {
|
|
|
195
195
|
status: PreviewStatus;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
/**
|
|
199
|
+
* @public
|
|
200
|
+
* Base metadata available for a selected media item in a media slot.
|
|
201
|
+
*
|
|
202
|
+
* Canva populates this when returning {@link OutputType} in Settings UI contexts.
|
|
203
|
+
* Apps should not set this value.
|
|
204
|
+
*/
|
|
205
|
+
declare interface BaseSelection {
|
|
206
|
+
/**
|
|
207
|
+
* Metadata about the source content represented by this selection.
|
|
208
|
+
*/
|
|
209
|
+
selectionMetadata?: readonly SelectionMetadata[];
|
|
210
|
+
}
|
|
211
|
+
|
|
198
212
|
/**
|
|
199
213
|
* @public
|
|
200
214
|
* Cell containing a boolean value.
|
|
@@ -304,11 +318,14 @@ declare namespace content {
|
|
|
304
318
|
VideoRequirement,
|
|
305
319
|
DocumentRequirement,
|
|
306
320
|
EmailRequirement,
|
|
321
|
+
BaseSelection,
|
|
307
322
|
MediaSelection,
|
|
308
323
|
ImageSelection,
|
|
309
324
|
VideoSelection,
|
|
310
325
|
DocumentSelection,
|
|
311
326
|
EmailSelection,
|
|
327
|
+
SelectionMetadata,
|
|
328
|
+
SelectionDesignMetadata,
|
|
312
329
|
DocumentSize,
|
|
313
330
|
PublishFileFormat,
|
|
314
331
|
ExactValueRange,
|
|
@@ -424,7 +441,7 @@ declare type ContentPublisherIntent = {
|
|
|
424
441
|
* privacy settings, or publishing destinations.
|
|
425
442
|
*
|
|
426
443
|
* Use the `updatePublishSettings` callback to save user settings and validate them.
|
|
427
|
-
* Settings are stored in the `publishRef` string (maximum
|
|
444
|
+
* Settings are stored in the `publishRef` string (maximum 32KB).
|
|
428
445
|
*
|
|
429
446
|
* @param request - Configuration and callbacks for the publish settings UI.
|
|
430
447
|
*
|
|
@@ -1068,9 +1085,9 @@ declare interface DocumentRequirement extends BaseFileRequirement {
|
|
|
1068
1085
|
* @public
|
|
1069
1086
|
* Selection metadata for a document media item.
|
|
1070
1087
|
*/
|
|
1071
|
-
declare
|
|
1088
|
+
declare interface DocumentSelection extends BaseSelection {
|
|
1072
1089
|
kind: 'document';
|
|
1073
|
-
}
|
|
1090
|
+
}
|
|
1074
1091
|
|
|
1075
1092
|
/**
|
|
1076
1093
|
* @public
|
|
@@ -1154,9 +1171,9 @@ declare interface EmailRequirement extends BaseFileRequirement {
|
|
|
1154
1171
|
* @public
|
|
1155
1172
|
* Selection metadata for an email media item.
|
|
1156
1173
|
*/
|
|
1157
|
-
declare
|
|
1174
|
+
declare interface EmailSelection extends BaseSelection {
|
|
1158
1175
|
kind: 'email';
|
|
1159
|
-
}
|
|
1176
|
+
}
|
|
1160
1177
|
|
|
1161
1178
|
/**
|
|
1162
1179
|
* @public
|
|
@@ -1365,11 +1382,7 @@ declare type ImageRef = string & {
|
|
|
1365
1382
|
* };
|
|
1366
1383
|
* ```
|
|
1367
1384
|
*/
|
|
1368
|
-
declare
|
|
1369
|
-
/**
|
|
1370
|
-
* Supported image format.
|
|
1371
|
-
*/
|
|
1372
|
-
format: 'png' | 'jpg';
|
|
1385
|
+
declare type ImageRequirement = BaseFileRequirement & {
|
|
1373
1386
|
/**
|
|
1374
1387
|
* Aspect ratio constraint (width / height).
|
|
1375
1388
|
*
|
|
@@ -1378,15 +1391,37 @@ declare interface ImageRequirement extends BaseFileRequirement {
|
|
|
1378
1391
|
* - `{ min: 0.8, max: 1.91 }`: Instagram range
|
|
1379
1392
|
*/
|
|
1380
1393
|
aspectRatio?: ValueRange;
|
|
1381
|
-
}
|
|
1394
|
+
} & ({
|
|
1395
|
+
/**
|
|
1396
|
+
* JPG image export.
|
|
1397
|
+
*/
|
|
1398
|
+
format: 'jpg';
|
|
1399
|
+
} | {
|
|
1400
|
+
/**
|
|
1401
|
+
* PNG image export.
|
|
1402
|
+
*/
|
|
1403
|
+
format: 'png';
|
|
1404
|
+
/**
|
|
1405
|
+
* Controls transparent-background support for PNG exports.
|
|
1406
|
+
*
|
|
1407
|
+
* @remarks
|
|
1408
|
+
* - Only applies when `format` is `'png'`
|
|
1409
|
+
* - If omitted or `false`, Canva exports a standard opaque PNG
|
|
1410
|
+
* - If `true`, Canva shows a `Transparent background` toggle in the publish flow
|
|
1411
|
+
* - Users without the required Canva entitlement may be prompted to upgrade before a transparent export is produced
|
|
1412
|
+
*
|
|
1413
|
+
* @defaultValue false
|
|
1414
|
+
*/
|
|
1415
|
+
allowTransparentBackground?: boolean;
|
|
1416
|
+
});
|
|
1382
1417
|
|
|
1383
1418
|
/**
|
|
1384
1419
|
* @public
|
|
1385
1420
|
* Selection metadata for an image media item.
|
|
1386
1421
|
*/
|
|
1387
|
-
declare
|
|
1422
|
+
declare interface ImageSelection extends BaseSelection {
|
|
1388
1423
|
kind: 'image';
|
|
1389
|
-
}
|
|
1424
|
+
}
|
|
1390
1425
|
|
|
1391
1426
|
/**
|
|
1392
1427
|
* @public
|
|
@@ -1617,9 +1652,6 @@ declare type MediaCollectionDataTableCell = {
|
|
|
1617
1652
|
/**
|
|
1618
1653
|
* @public
|
|
1619
1654
|
* 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
1655
|
*/
|
|
1624
1656
|
declare type MediaSelection = ImageSelection | VideoSelection | DocumentSelection | EmailSelection;
|
|
1625
1657
|
|
|
@@ -2234,7 +2266,7 @@ declare type PublishContentRequest = {
|
|
|
2234
2266
|
* This is the same reference you saved via `updatePublishSettings` in the settings UI.
|
|
2235
2267
|
* Parse this string to retrieve the user's publish settings (e.g., captions, tags, privacy).
|
|
2236
2268
|
*
|
|
2237
|
-
* Maximum size:
|
|
2269
|
+
* Maximum size: 32KB
|
|
2238
2270
|
*/
|
|
2239
2271
|
publishRef?: string;
|
|
2240
2272
|
/**
|
|
@@ -2340,7 +2372,7 @@ declare type PublishSettings = {
|
|
|
2340
2372
|
*
|
|
2341
2373
|
* This reference will be provided to your `publishContent` method when publishing.
|
|
2342
2374
|
*
|
|
2343
|
-
* Maximum size:
|
|
2375
|
+
* Maximum size: 32KB
|
|
2344
2376
|
*
|
|
2345
2377
|
* @example Serializing settings
|
|
2346
2378
|
* ```ts
|
|
@@ -2601,7 +2633,7 @@ declare type RenderSettingsUiRequest = {
|
|
|
2601
2633
|
*
|
|
2602
2634
|
* @param settings - The new publish settings to save
|
|
2603
2635
|
* @returns A promise that resolves when the settings are successfully saved
|
|
2604
|
-
* @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds
|
|
2636
|
+
* @throws Will throw `CanvaError('bad_request')` if {@link PublishSettings.publishRef} exceeds 32KB.
|
|
2605
2637
|
*
|
|
2606
2638
|
* @example Updating settings as user types
|
|
2607
2639
|
* ```ts
|
|
@@ -2653,6 +2685,28 @@ declare type RenderSettingsUiRequest = {
|
|
|
2653
2685
|
|
|
2654
2686
|
};
|
|
2655
2687
|
|
|
2688
|
+
/**
|
|
2689
|
+
* @public
|
|
2690
|
+
* Metadata specific to design content represented by a media selection.
|
|
2691
|
+
*/
|
|
2692
|
+
declare interface SelectionDesignMetadata {
|
|
2693
|
+
type: 'design';
|
|
2694
|
+
/**
|
|
2695
|
+
* A signed JWT token containing the design id
|
|
2696
|
+
*/
|
|
2697
|
+
designToken: string;
|
|
2698
|
+
/**
|
|
2699
|
+
* The user given title of the design
|
|
2700
|
+
*/
|
|
2701
|
+
title: string | undefined;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
/**
|
|
2705
|
+
* @public
|
|
2706
|
+
* Metadata about the source content represented by a media selection.
|
|
2707
|
+
*/
|
|
2708
|
+
declare type SelectionMetadata = SelectionDesignMetadata;
|
|
2709
|
+
|
|
2656
2710
|
/**
|
|
2657
2711
|
* @public
|
|
2658
2712
|
* Context information for the publish settings UI.
|
|
@@ -2949,13 +3003,13 @@ declare interface VideoRequirement extends BaseFileRequirement {
|
|
|
2949
3003
|
* @public
|
|
2950
3004
|
* Selection metadata for a video media item.
|
|
2951
3005
|
*/
|
|
2952
|
-
declare
|
|
3006
|
+
declare interface VideoSelection extends BaseSelection {
|
|
2953
3007
|
kind: 'video';
|
|
2954
3008
|
/**
|
|
2955
3009
|
* Duration of the selected video in milliseconds.
|
|
2956
3010
|
*/
|
|
2957
3011
|
durationMs: number;
|
|
2958
|
-
}
|
|
3012
|
+
}
|
|
2959
3013
|
|
|
2960
3014
|
/**
|
|
2961
3015
|
* @public
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return LATEST_VERSION_BETA;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const LATEST_VERSION = '2.
|
|
23
|
-
const LATEST_VERSION_BETA = '2.
|
|
22
|
+
const LATEST_VERSION = '2.5.0';
|
|
23
|
+
const LATEST_VERSION_BETA = '2.4.1-beta.0';
|
|
24
24
|
const LATEST_VERSION_ALPHA = 'NONE';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const LATEST_VERSION = '2.
|
|
2
|
-
export const LATEST_VERSION_BETA = '2.
|
|
1
|
+
export const LATEST_VERSION = '2.5.0';
|
|
2
|
+
export const LATEST_VERSION_BETA = '2.4.1-beta.0';
|
|
3
3
|
export const LATEST_VERSION_ALPHA = 'NONE';
|