@canva/intents 2.1.1 → 2.1.3-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 +13 -13
  2. package/asset/beta.d.ts +190 -0
  3. package/asset/index.d.ts +1 -1
  4. package/beta.d.ts +2995 -0
  5. package/content/beta.d.ts +1606 -0
  6. package/content/index.d.ts +1 -1440
  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 -2821
  12. package/lib/cjs/sdk/intents/asset/beta.js +14 -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 +2 -2
  23. package/lib/esm/sdk/intents/asset/beta.js +4 -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 +2 -2
  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,21 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 2.1.1 - 2026-01-30
4
-
5
- ### Changed
6
-
7
- - Update NPM readme
8
-
9
- ## 2.1.0 - 2026-01-30
3
+ ## 2.1.3-beta.0 - 2026-02-03
10
4
 
11
5
  ### Added
12
6
 
13
- - Added a CHANGELOG.md to track changes.
14
- - Added a test harness method `initTestEnvionment` which can be imported from `@canva/intents/test`
15
- - Promoted the Content Publisher Intent API from beta to general availability
7
+ - Added a CHANGELOG.md to track changes
8
+ - **Breaking:** Added enhanced error handling between `publishContent` and the `SettingsUi`
9
+ - Added a new `PublishErrorClearedSettingsUiContext` for when the UI clears an error
10
+ - Include design title in content metadata for the content publisher intent
11
+ - Added `html_bundle` support in content publisher for email media slots
12
+ - Added `InvoctationContext` to provide initial state for content publisher intent
13
+ - Promoted the email requirements in content publisher from alpha to beta
16
14
 
17
- ## 2.0.0 - 2025-06-12
15
+ ### Fixed
18
16
 
19
- ### Added
17
+ - Fixed the `initTestEnvironment` API not mocking some intents
18
+
19
+ ## 2.0.2-beta.3 - 2025-11-11
20
20
 
21
- - 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.
21
+ - 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";