@canva/intents 2.0.1-beta.2 → 2.0.2-beta.3

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/asset/beta.d.ts CHANGED
@@ -1 +1,236 @@
1
+ /**
2
+ * @beta
3
+ * Union of all supported asset types.
4
+ */
5
+ export declare type Asset =
6
+ | ImageAsset
7
+ | VideoAsset
8
+ | AudioAsset
9
+ | DocumentAsset
10
+ | SheetAsset
11
+ | GenericAsset;
12
+
13
+ /**
14
+ * @beta
15
+ * Reference to an asset. Used as a unique identifier.
16
+ */
17
+ export declare type AssetRef = string & {
18
+ __assetRef: never;
19
+ };
20
+
21
+ /**
22
+ * @beta
23
+ * Audio asset result structure.
24
+ */
25
+ export declare type AudioAsset = BaseAsset & {
26
+ type: "audio";
27
+ mimeType:
28
+ | "audio/mpeg"
29
+ | "audio/mp4"
30
+ | "audio/x-m4a"
31
+ | "audio/mp3"
32
+ | "audio/ogg"
33
+ | "audio/wav"
34
+ | "audio/x-wav"
35
+ | "audio/x-pn-wav"
36
+ | "audio/wave"
37
+ | "audio/vnd.wave"
38
+ | "audio/webm";
39
+ };
40
+
41
+ /**
42
+ * @beta
43
+ * Base structure for an asset result.
44
+ */
45
+ export declare type BaseAsset = {
46
+ name: string;
47
+ url: string;
48
+ };
49
+
50
+ /**
51
+ * @beta
52
+ * Document asset result structure.
53
+ */
54
+ export declare type DocumentAsset = BaseAsset & {
55
+ type: "document";
56
+ parentRef?: AssetRef;
57
+ mimeType: DocumentMimeType;
58
+ };
59
+
60
+ /**
61
+ * @beta
62
+ * Supported mimetype for document assets.
63
+ */
64
+ export declare type DocumentMimeType =
65
+ | "application/pdf"
66
+ | "application/msword"
67
+ | "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
68
+ | "text/plain"
69
+ | "text/markdown";
70
+
71
+ /**
72
+ * @beta
73
+ * Request parameters for URL expansion.
74
+ */
75
+ export declare type ExpandUrlRequest = {
76
+ url: string;
77
+ requestConnection: () => Promise<void>;
78
+ };
79
+
80
+ /**
81
+ * @beta
82
+ * Response from URL expansion operation.
83
+ */
84
+ export declare type ExpandUrlResponse =
85
+ | {
86
+ status: "completed";
87
+ result: ExpandUrlResult;
88
+ }
89
+ | {
90
+ status: "not_found";
91
+ };
92
+
93
+ /**
94
+ * @beta
95
+ * Result of completed URL expansion.
96
+ */
97
+ export declare type ExpandUrlResult = {
98
+ ref: UrlExpanderAssetRef;
99
+ };
100
+
101
+ /**
102
+ * @beta
103
+ * Generic asset result structure.
104
+ * A generic asset is any file that is not already covered by other asset types such as ImageAsset etc.
105
+ * It is an error to pass a mime type that is covered by another asset type.
106
+ */
107
+ export declare type GenericAsset = BaseAsset & {
108
+ type: "generic";
109
+ mimeType: string;
110
+ };
111
+
112
+ /**
113
+ * @beta
114
+ * Completed response from content retrieval operation.
115
+ */
116
+ export declare type GetContentCompletedResponse = {
117
+ status: "completed";
118
+ result: {
119
+ type: "asset";
120
+ asset: Asset;
121
+ };
122
+ };
123
+
124
+ /**
125
+ * @beta
126
+ * Error response from content retrieval operation.
127
+ */
128
+ export declare type GetContentErrorResponse = {
129
+ status: "app_error";
130
+ message: string;
131
+ };
132
+
133
+ /**
134
+ * @beta
135
+ * Request parameters for content retrieval.
136
+ */
137
+ export declare type GetContentRequest = {
138
+ ref: UrlExpanderAssetRef;
139
+ requestConnection: () => Promise<void>;
140
+ };
141
+
142
+ /**
143
+ * @beta
144
+ * Response from content retrieval operation.
145
+ */
146
+ export declare type GetContentResponse =
147
+ | GetContentCompletedResponse
148
+ | GetContentErrorResponse;
149
+
150
+ /**
151
+ * @beta
152
+ * Image asset result structure.
153
+ */
154
+ export declare type ImageAsset = BaseAsset & {
155
+ type: "image";
156
+ thumbnailUrl: string;
157
+ parentRef?: AssetRef;
158
+ mimeType:
159
+ | "image/heic"
160
+ | "image/jpeg"
161
+ | "image/png"
162
+ | "image/svg+xml"
163
+ | "image/tiff"
164
+ | "image/webp";
165
+ };
166
+
167
+ /**
168
+ * @beta
169
+ *
170
+ * Prepares the `UrlExpanderIntent`.
171
+ */
172
+ export declare const prepareUrlExpander: (
173
+ implementation: UrlExpanderIntent,
174
+ ) => void;
175
+
176
+ /**
177
+ * @beta
178
+ * Sheet asset result structure.
179
+ */
180
+ export declare type SheetAsset = BaseAsset & {
181
+ type: "sheet";
182
+ parentRef?: AssetRef;
183
+ mimeType: SheetMimeType;
184
+ };
185
+
186
+ /**
187
+ * @beta
188
+ * Supported mimetype for sheet assets.
189
+ */
190
+ export declare type SheetMimeType =
191
+ | "text/csv"
192
+ | "application/vnd.ms-excel"
193
+ | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
194
+
195
+ /**
196
+ * @beta
197
+ * Reference to an asset with metadata.
198
+ */
199
+ export declare type UrlExpanderAssetRef = {
200
+ type: "asset";
201
+ id: string;
202
+ name: string;
203
+ iconUrl?: string;
204
+ description?: string;
205
+ };
206
+
207
+ /**
208
+ * @beta
209
+ * Intent interface for URL expansion and content retrieval operations.
210
+ */
211
+ export declare type UrlExpanderIntent = {
212
+ expandUrl(request: ExpandUrlRequest): Promise<ExpandUrlResponse>;
213
+ getContent(request: GetContentRequest): Promise<GetContentResponse>;
214
+ };
215
+
216
+ /**
217
+ * @beta
218
+ * Video asset result structure.
219
+ */
220
+ export declare type VideoAsset = BaseAsset & {
221
+ type: "video";
222
+ thumbnailImageUrl: string;
223
+ parentRef?: AssetRef;
224
+ mimeType:
225
+ | "video/avi"
226
+ | "video/x-msvideo"
227
+ | "image/gif"
228
+ | "video/x-m4v"
229
+ | "video/x-matroska"
230
+ | "video/quicktime"
231
+ | "video/mp4"
232
+ | "video/mpeg"
233
+ | "video/webm";
234
+ };
235
+
1
236
  export {};
@@ -2,3 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ Object.defineProperty(exports, "prepareUrlExpander", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return prepareUrlExpander;
9
+ }
10
+ });
11
+ const _version = require("../version");
12
+ const { canva_sdk } = window;
13
+ const prepareUrlExpander = canva_sdk.intents.v1.asset.prepareUrlExpander;
14
+ window.__canva__?.sdkRegistration?.registerPackageVersion('intents/asset', _version.LATEST_VERSION, 'beta');
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "LATEST_VERSION", {
8
8
  return LATEST_VERSION;
9
9
  }
10
10
  });
11
- const LATEST_VERSION = '2.0.1';
11
+ const LATEST_VERSION = '2.0.2';
@@ -1 +1,4 @@
1
- export { };
1
+ import { LATEST_VERSION } from '../version';
2
+ const { canva_sdk } = window;
3
+ export const prepareUrlExpander = canva_sdk.intents.v1.asset.prepareUrlExpander;
4
+ window.__canva__?.sdkRegistration?.registerPackageVersion('intents/asset', LATEST_VERSION, 'beta');
@@ -1 +1 @@
1
- export const LATEST_VERSION = '2.0.1';
1
+ export const LATEST_VERSION = '2.0.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/intents",
3
- "version": "2.0.1-beta.2",
3
+ "version": "2.0.2-beta.3",
4
4
  "description": "The Canva Apps SDK Intents library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",
@@ -42,4 +42,4 @@
42
42
  }
43
43
  },
44
44
  "typings": "./beta.d.ts"
45
- }
45
+ }