@canva/intents 2.5.0 → 2.5.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +20 -37
  2. package/asset/beta.d.ts +190 -0
  3. package/asset/index.d.ts +1 -1
  4. package/beta.d.ts +3138 -0
  5. package/content/beta.d.ts +1738 -0
  6. package/content/index.d.ts +1 -1738
  7. package/data/beta.d.ts +1229 -0
  8. package/data/index.d.ts +1 -1229
  9. package/design/beta.d.ts +41 -0
  10. package/design/index.d.ts +1 -41
  11. package/index.d.ts +1 -3138
  12. package/lib/cjs/sdk/intents/asset/beta.js +13 -0
  13. package/lib/cjs/sdk/intents/asset/index.js +15 -1
  14. package/lib/cjs/sdk/intents/beta.js +20 -0
  15. package/lib/cjs/sdk/intents/content/beta.js +20 -0
  16. package/lib/cjs/sdk/intents/data/beta.js +20 -0
  17. package/lib/cjs/sdk/intents/design/beta.js +20 -0
  18. package/lib/cjs/sdk/intents/fake/{create.js → create_beta.js} +9 -6
  19. package/lib/cjs/sdk/intents/index.js +2 -4
  20. package/lib/cjs/sdk/intents/test/beta.js +19 -0
  21. package/lib/cjs/sdk/intents/test/index.js +13 -14
  22. package/lib/cjs/sdk/intents/version.js +1 -1
  23. package/lib/esm/sdk/intents/asset/beta.js +3 -0
  24. package/lib/esm/sdk/intents/asset/index.js +1 -1
  25. package/lib/esm/sdk/intents/beta.js +3 -0
  26. package/lib/esm/sdk/intents/content/beta.js +3 -0
  27. package/lib/esm/sdk/intents/data/beta.js +3 -0
  28. package/lib/esm/sdk/intents/design/beta.js +3 -0
  29. package/lib/esm/sdk/intents/fake/{create.js → create_beta.js} +7 -4
  30. package/lib/esm/sdk/intents/index.js +1 -3
  31. package/lib/esm/sdk/intents/test/beta.js +9 -0
  32. package/lib/esm/sdk/intents/test/index.js +1 -9
  33. package/lib/esm/sdk/intents/version.js +1 -1
  34. package/package.json +23 -23
  35. package/test/beta.d.ts +11 -0
  36. package/test/index.d.ts +1 -11
package/CHANGELOG.md CHANGED
@@ -1,63 +1,46 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 2.5.0 - 2026-04-09
3
+ ## 2.5.1-beta.0 - 2026-04-10
4
4
 
5
5
  ### Changed
6
6
 
7
- - Increased the `publishRef` size limit from 5KB to 32KB, allowing apps to store more complex publishing settings.
7
+ - Promotion intents from preview to ga
8
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
-
14
- ## 2.4.0 - 2026-03-23
9
+ ## 2.4.1-beta.0 - 2026-03-30
15
10
 
16
11
  ### Added
17
12
 
18
- - Launch the new Email media type to public, enabling publishing and selection of email pages.
13
+ - Added `Selection`, `ImageSelection`, `VideoSelection`, `DocumentSelection`, and `EmailSelection` types representing metadata about user-selected media in a media slot
14
+ - Added optional `selection` field to `MediaSlot`, populated by Canva when returning output types in Settings UI contexts
19
15
 
20
- ## 2.3.1 - 2026-03-12
16
+ ## 2.2.1-beta.1 - 2026-02-27
21
17
 
22
18
  ### Fixed
23
19
 
24
- - Re-export data types from the intents/data public API that were accidentally removed during a refactor
25
- - Rename `Selection` type to `MediaSelection` for clarity
20
+ - Beta PreviewMedia and Preview types now correctly use full EmailPreview variants throughout RenderPreviewUiRequest, PublishPreviewUiInvocationContext, and ContentPublisherIntent.
26
21
 
27
- ## 2.3.0 - 2026-03-06
22
+ ## 2.2.1-beta.0 - 2026-02-24
28
23
 
29
24
  ### Added
30
25
 
31
- - Promoted `Selection`, `ImageSelection`, `VideoSelection`, `DocumentSelection`, `EmailSelection` types and `MediaSlot.selection` field from beta to public
26
+ - Added new html_standalone publish format for single html files
32
27
 
33
- ## 2.2.0 - 2026-02-06
28
+ ## 2.1.3-beta.0 - 2026-02-03
34
29
 
35
30
  ### Added
36
31
 
37
- - Added invocation context to provide initial state when rendering UIs
38
-
39
- ## 2.1.2 - 2026-02-03
32
+ - Added a CHANGELOG.md to track changes
33
+ - **Breaking:** Added enhanced error handling between `publishContent` and the `SettingsUi`
34
+ - Added a new `PublishErrorClearedSettingsUiContext` for when the UI clears an error
35
+ - Include design title in content metadata for the content publisher intent
36
+ - Added `html_bundle` support in content publisher for email media slots
37
+ - Added `InvoctationContext` to provide initial state for content publisher intent
38
+ - Promoted the email requirements in content publisher from alpha to beta
40
39
 
41
40
  ### Fixed
42
41
 
43
- - Fix missing id and status fields in Content Publisher email preview type
44
-
45
- ## 2.1.1 - 2026-01-30
46
-
47
- ### Changed
48
-
49
- - Update NPM readme
50
-
51
- ## 2.1.0 - 2026-01-30
52
-
53
- ### Added
42
+ - Fixed the `initTestEnvironment` API not mocking some intents
54
43
 
55
- - Added a CHANGELOG.md to track changes.
56
- - Added a test harness method `initTestEnvionment` which can be imported from `@canva/intents/test`
57
- - Promoted the Content Publisher Intent API from beta to general availability
58
-
59
- ## 2.0.0 - 2025-06-12
60
-
61
- ### Added
44
+ ## 2.0.2-beta.3 - 2025-11-11
62
45
 
63
- - Added the new `@canva/intents` package at version `2.0.0` with the brand new [Data Connector](https://www.canva.dev/docs/apps/data-connector/) intent.
46
+ - Initial changelog for the Preview Intents SDK.
@@ -0,0 +1,190 @@
1
+ /**
2
+ * @beta
3
+ * Union of all supported asset types.
4
+ */
5
+ export declare type Asset = ImageAsset | VideoAsset | AudioAsset | DocumentAsset | SheetAsset | GenericAsset;
6
+
7
+ /**
8
+ * @beta
9
+ * Reference to an asset. Used as a unique identifier.
10
+ */
11
+ export declare type AssetRef = string & {
12
+ __assetRef: never;
13
+ };
14
+
15
+ /**
16
+ * @beta
17
+ * Audio asset result structure.
18
+ */
19
+ export declare type AudioAsset = BaseAsset & {
20
+ type: 'audio';
21
+ mimeType: 'audio/mpeg' | 'audio/mp4' | 'audio/x-m4a' | 'audio/mp3' | 'audio/ogg' | 'audio/wav' | 'audio/x-wav' | 'audio/x-pn-wav' | 'audio/wave' | 'audio/vnd.wave' | 'audio/webm';
22
+ };
23
+
24
+ /**
25
+ * @beta
26
+ * Base structure for an asset result.
27
+ */
28
+ export declare type BaseAsset = {
29
+ name: string;
30
+ url: string;
31
+ };
32
+
33
+ /**
34
+ * @beta
35
+ * Document asset result structure.
36
+ */
37
+ export declare type DocumentAsset = BaseAsset & {
38
+ type: 'document';
39
+ parentRef?: AssetRef;
40
+ mimeType: DocumentMimeType;
41
+ };
42
+
43
+ /**
44
+ * @beta
45
+ * Supported mimetype for document assets.
46
+ */
47
+ export declare type DocumentMimeType = 'application/pdf' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'text/plain' | 'text/markdown';
48
+
49
+ /**
50
+ * @beta
51
+ * Request parameters for URL expansion.
52
+ */
53
+ export declare type ExpandUrlRequest = {
54
+ url: string;
55
+ requestConnection: () => Promise<void>;
56
+ };
57
+
58
+ /**
59
+ * @beta
60
+ * Response from URL expansion operation.
61
+ */
62
+ export declare type ExpandUrlResponse = {
63
+ status: 'completed';
64
+ result: ExpandUrlResult;
65
+ } | {
66
+ status: 'not_found';
67
+ };
68
+
69
+ /**
70
+ * @beta
71
+ * Result of completed URL expansion.
72
+ */
73
+ export declare type ExpandUrlResult = {
74
+ ref: UrlExpanderAssetRef;
75
+ };
76
+
77
+ /**
78
+ * @beta
79
+ * Generic asset result structure.
80
+ * A generic asset is any file that is not already covered by other asset types such as ImageAsset etc.
81
+ * It is an error to pass a mime type that is covered by another asset type.
82
+ */
83
+ export declare type GenericAsset = BaseAsset & {
84
+ type: 'generic';
85
+ mimeType: string;
86
+ };
87
+
88
+ /**
89
+ * @beta
90
+ * Completed response from content retrieval operation.
91
+ */
92
+ export declare type GetContentCompletedResponse = {
93
+ status: 'completed';
94
+ result: {
95
+ type: 'asset';
96
+ asset: Asset;
97
+ };
98
+ };
99
+
100
+ /**
101
+ * @beta
102
+ * Error response from content retrieval operation.
103
+ */
104
+ export declare type GetContentErrorResponse = {
105
+ status: 'app_error';
106
+ message: string;
107
+ };
108
+
109
+ /**
110
+ * @beta
111
+ * Request parameters for content retrieval.
112
+ */
113
+ export declare type GetContentRequest = {
114
+ ref: UrlExpanderAssetRef;
115
+ requestConnection: () => Promise<void>;
116
+ };
117
+
118
+ /**
119
+ * @beta
120
+ * Response from content retrieval operation.
121
+ */
122
+ export declare type GetContentResponse = GetContentCompletedResponse | GetContentErrorResponse;
123
+
124
+ /**
125
+ * @beta
126
+ * Image asset result structure.
127
+ */
128
+ export declare type ImageAsset = BaseAsset & {
129
+ type: 'image';
130
+ thumbnailUrl: string;
131
+ parentRef?: AssetRef;
132
+ mimeType: 'image/heic' | 'image/jpeg' | 'image/png' | 'image/svg+xml' | 'image/tiff' | 'image/webp';
133
+ };
134
+
135
+ /**
136
+ * @beta
137
+ *
138
+ * Prepares the `UrlExpanderIntent`.
139
+ */
140
+ export declare const prepareUrlExpander: (implementation: UrlExpanderIntent) => void;
141
+
142
+ /**
143
+ * @beta
144
+ * Sheet asset result structure.
145
+ */
146
+ export declare type SheetAsset = BaseAsset & {
147
+ type: 'sheet';
148
+ parentRef?: AssetRef;
149
+ mimeType: SheetMimeType;
150
+ };
151
+
152
+ /**
153
+ * @beta
154
+ * Supported mimetype for sheet assets.
155
+ */
156
+ export declare type SheetMimeType = 'text/csv' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
157
+
158
+ /**
159
+ * @beta
160
+ * Reference to an asset with metadata.
161
+ */
162
+ export declare type UrlExpanderAssetRef = {
163
+ type: 'asset';
164
+ id: string;
165
+ name: string;
166
+ iconUrl?: string;
167
+ description?: string;
168
+ };
169
+
170
+ /**
171
+ * @beta
172
+ * Intent interface for URL expansion and content retrieval operations.
173
+ */
174
+ export declare type UrlExpanderIntent = {
175
+ expandUrl(request: ExpandUrlRequest): Promise<ExpandUrlResponse>;
176
+ getContent(request: GetContentRequest): Promise<GetContentResponse>;
177
+ };
178
+
179
+ /**
180
+ * @beta
181
+ * Video asset result structure.
182
+ */
183
+ export declare type VideoAsset = BaseAsset & {
184
+ type: 'video';
185
+ thumbnailImageUrl: string;
186
+ parentRef?: AssetRef;
187
+ mimeType: 'video/avi' | 'video/x-msvideo' | 'image/gif' | 'video/x-m4v' | 'video/x-matroska' | 'video/quicktime' | 'video/mp4' | 'video/mpeg' | 'video/webm';
188
+ };
189
+
190
+ export { }
package/asset/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { }
1
+ export * from "./beta";