@canva/intents 0.0.0-beta.2 → 0.0.0-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/README.md +4 -6
- package/beta.d.ts +539 -205
- package/data/beta.d.ts +518 -174
- package/design/beta.d.ts +5 -7
- package/lib/cjs/sdk/intents/beta.js +13 -56
- package/lib/cjs/sdk/intents/data/beta.js +15 -9
- package/lib/cjs/sdk/intents/data/index.js +20 -0
- package/lib/cjs/sdk/intents/data/public.js +12 -0
- package/lib/cjs/sdk/intents/design/beta.js +15 -9
- package/lib/cjs/sdk/intents/design/index.js +20 -0
- package/lib/cjs/sdk/intents/design/public.js +12 -0
- package/lib/cjs/sdk/intents/public.js +61 -0
- package/lib/esm/sdk/intents/beta.js +2 -4
- package/lib/esm/sdk/intents/data/beta.js +2 -3
- package/lib/esm/sdk/intents/data/index.js +3 -0
- package/lib/esm/sdk/intents/data/public.js +2 -0
- package/lib/esm/sdk/intents/design/beta.js +2 -3
- package/lib/esm/sdk/intents/design/index.js +3 -0
- package/lib/esm/sdk/intents/design/public.js +2 -0
- package/lib/esm/sdk/intents/public.js +3 -0
- package/package.json +1 -1
package/beta.d.ts
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
*
|
|
2
|
+
* @public
|
|
3
|
+
* A disclosure identifying if the app generated this asset using AI.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Helps users make informed decisions about the content they interact with.
|
|
7
|
+
*
|
|
8
|
+
* AI is generally defined as any machine system that, given an objective, infers how to generate an output from an input.
|
|
9
|
+
* Some examples include "generative AI", "large language models", and "machine learning".
|
|
10
|
+
*
|
|
11
|
+
* **App Generated**
|
|
12
|
+
*
|
|
13
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
14
|
+
* the app makes a request to a third-party service to do so.
|
|
15
|
+
*
|
|
16
|
+
* A significantly altered asset means the AI changes key information or details, such as
|
|
17
|
+
* removing or replacing key components in the original content, which can include applying style transfer, or changing facial expressions.
|
|
18
|
+
*
|
|
19
|
+
* Label this asset as 'app_generated' under these conditions:
|
|
20
|
+
*
|
|
21
|
+
* The following is true:
|
|
22
|
+
*
|
|
23
|
+
* - The app generates the asset in response to a user's request (including past requests), for example, the asset is not from an asset library.
|
|
24
|
+
*
|
|
25
|
+
* And any of these conditions are also true:
|
|
26
|
+
*
|
|
27
|
+
* - The AI creates entirely new content from scratch.
|
|
28
|
+
* - The AI introduces new multimedia, details, or creative elements not originally present.
|
|
29
|
+
* - The AI removes and replaces the asset's key components.
|
|
30
|
+
* - The AI alters the asset's appearance, meaning, or context in a way that conveys a different message than the original.
|
|
31
|
+
*
|
|
32
|
+
* **None**
|
|
33
|
+
*
|
|
34
|
+
* 'none' indicates when the asset wasn't generated by the app as a part of any user's specific request, for example, a third-party
|
|
35
|
+
* request, or when the asset wasn't significantly altered by AI.
|
|
36
|
+
*/
|
|
37
|
+
declare type AiDisclosure = "app_generated" | "none";
|
|
38
|
+
|
|
39
|
+
declare type AllOrNone<T> = T | Never<T>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
* {@link GetDataTableError} indicating custom error occurred in the app's implementation.
|
|
4
44
|
* This can be used to indicate specific issues that are not covered by other error types.
|
|
5
45
|
*/
|
|
6
46
|
declare type AppError = {
|
|
@@ -19,16 +59,16 @@ declare type AppError = {
|
|
|
19
59
|
};
|
|
20
60
|
|
|
21
61
|
/**
|
|
22
|
-
* @
|
|
62
|
+
* @public
|
|
23
63
|
* {@link InvocationContext} indicating a custom error occurred during data refresh.
|
|
24
|
-
* Triggered when
|
|
64
|
+
* Triggered when getDataTable returned 'app_error' status.
|
|
25
65
|
* UI should display the error message and help users recover.
|
|
26
66
|
*/
|
|
27
67
|
declare type AppErrorInvocationContext = {
|
|
28
68
|
/**
|
|
29
69
|
* A custom error occurred during data refresh.
|
|
30
70
|
*
|
|
31
|
-
* This occurs when `
|
|
71
|
+
* This occurs when `getDataTable` returned 'app_error' during a refresh attempt.
|
|
32
72
|
* Your UI should display the error message and help users recover from the specific
|
|
33
73
|
* issue.
|
|
34
74
|
*/
|
|
@@ -44,7 +84,7 @@ declare type AppErrorInvocationContext = {
|
|
|
44
84
|
};
|
|
45
85
|
|
|
46
86
|
/**
|
|
47
|
-
* @
|
|
87
|
+
* @public
|
|
48
88
|
* Cell containing a boolean value.
|
|
49
89
|
*
|
|
50
90
|
* @example Creating a boolean cell
|
|
@@ -77,7 +117,7 @@ declare type AppErrorInvocationContext = {
|
|
|
77
117
|
* };
|
|
78
118
|
* ```
|
|
79
119
|
*/
|
|
80
|
-
|
|
120
|
+
declare type BooleanDataTableCell = {
|
|
81
121
|
/**
|
|
82
122
|
* Indicates this cell contains a boolean value.
|
|
83
123
|
*/
|
|
@@ -91,10 +131,10 @@ export declare type BooleanDataTableCell = {
|
|
|
91
131
|
};
|
|
92
132
|
|
|
93
133
|
/**
|
|
94
|
-
* @
|
|
134
|
+
* @public
|
|
95
135
|
* Configuration for a table column.
|
|
96
136
|
*/
|
|
97
|
-
|
|
137
|
+
declare type ColumnConfig = {
|
|
98
138
|
/**
|
|
99
139
|
* Name for the column, displayed as header text.
|
|
100
140
|
*
|
|
@@ -114,16 +154,14 @@ declare namespace data {
|
|
|
114
154
|
export {
|
|
115
155
|
prepareDataConnector,
|
|
116
156
|
DataConnectorIntent,
|
|
117
|
-
|
|
118
|
-
|
|
157
|
+
GetDataTableRequest,
|
|
158
|
+
RenderSelectionUiRequest,
|
|
119
159
|
InvocationContext,
|
|
120
|
-
|
|
121
|
-
|
|
160
|
+
GetDataTableResponse,
|
|
161
|
+
GetDataTableCompleted,
|
|
122
162
|
DataTableMetadata,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
InternalError,
|
|
126
|
-
UpdateDataRefResult,
|
|
163
|
+
GetDataTableError,
|
|
164
|
+
UpdateDataRefResponse,
|
|
127
165
|
DataSourceRef,
|
|
128
166
|
DataTableLimit,
|
|
129
167
|
DataType,
|
|
@@ -136,35 +174,38 @@ declare namespace data {
|
|
|
136
174
|
NumberDataTableCell,
|
|
137
175
|
NumberCellMetadata,
|
|
138
176
|
BooleanDataTableCell,
|
|
177
|
+
MediaCollectionDataTableCell,
|
|
178
|
+
DataTableImageUpload,
|
|
179
|
+
DataTableVideoUpload,
|
|
139
180
|
};
|
|
140
181
|
}
|
|
141
182
|
export { data };
|
|
142
183
|
|
|
143
184
|
/**
|
|
144
|
-
* @
|
|
185
|
+
* @public
|
|
145
186
|
* Main interface for implementing the Data Connector intent.
|
|
146
187
|
*
|
|
147
188
|
* Implementing the Data Connector intent enables apps to import external data into Canva.
|
|
148
189
|
* This allows users to select, preview, and refresh data from external sources.
|
|
149
190
|
*/
|
|
150
|
-
|
|
191
|
+
declare type DataConnectorIntent = {
|
|
151
192
|
/**
|
|
152
|
-
*
|
|
193
|
+
* Gets structured data from an external source.
|
|
153
194
|
*
|
|
154
195
|
* This action is called in two scenarios:
|
|
155
196
|
*
|
|
156
|
-
* - During data selection to preview data before import (when {@link
|
|
197
|
+
* - During data selection to preview data before import (when {@link RenderSelectionUiRequest.updateDataRef} is called).
|
|
157
198
|
* - When refreshing previously imported data (when the user requests an update).
|
|
158
199
|
*
|
|
159
|
-
* @param
|
|
200
|
+
* @param request - Parameters for the data fetching operation.
|
|
160
201
|
* @returns A promise resolving to either a successful result with data or an error.
|
|
161
202
|
*
|
|
162
|
-
* @example
|
|
203
|
+
* @example Getting data from an external source
|
|
163
204
|
* ```ts
|
|
164
|
-
* import type {
|
|
205
|
+
* import type { GetDataTableRequest, GetDataTableResponse } from '@canva/intents/data';
|
|
165
206
|
*
|
|
166
|
-
* async function
|
|
167
|
-
* const { dataSourceRef, limit, signal } =
|
|
207
|
+
* async function getDataTable(request: GetDataTableRequest): Promise<GetDataTableResponse> {
|
|
208
|
+
* const { dataSourceRef, limit, signal } = request;
|
|
168
209
|
*
|
|
169
210
|
* // Check if the operation has been aborted.
|
|
170
211
|
* if (signal.aborted) {
|
|
@@ -181,24 +222,23 @@ export declare type DataConnectorIntent = {
|
|
|
181
222
|
* }
|
|
182
223
|
* ```
|
|
183
224
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
) => Promise<FetchDataTableResult>;
|
|
225
|
+
getDataTable: (request: GetDataTableRequest) => Promise<GetDataTableResponse>;
|
|
226
|
+
|
|
187
227
|
/**
|
|
188
228
|
* Renders a user interface for selecting and configuring data from your external sources.
|
|
189
229
|
*
|
|
190
|
-
* @param
|
|
230
|
+
* @param request - Configuration and callbacks for the data selection UI.
|
|
191
231
|
*
|
|
192
232
|
* @example Rendering a data selection UI
|
|
193
233
|
* ```ts
|
|
194
|
-
* import type {
|
|
234
|
+
* import type { RenderSelectionUiRequest } from '@canva/intents/data';
|
|
195
235
|
*
|
|
196
|
-
* async function renderSelectionUi(
|
|
236
|
+
* async function renderSelectionUi(request: RenderSelectionUiRequest): Promise<void> {
|
|
197
237
|
* // UI rendering logic.
|
|
198
238
|
* // Example: if user selects data 'ref123'.
|
|
199
239
|
* const selectedRef = { source: 'ref123', title: 'My Selected Table' };
|
|
200
240
|
* try {
|
|
201
|
-
* const result = await
|
|
241
|
+
* const result = await request.updateDataRef(selectedRef);
|
|
202
242
|
* if (result.status === 'completed') {
|
|
203
243
|
* console.log('Selection valid and preview updated.');
|
|
204
244
|
* } else {
|
|
@@ -210,11 +250,11 @@ export declare type DataConnectorIntent = {
|
|
|
210
250
|
* }
|
|
211
251
|
* ```
|
|
212
252
|
*/
|
|
213
|
-
renderSelectionUi: (
|
|
253
|
+
renderSelectionUi: (request: RenderSelectionUiRequest) => void;
|
|
214
254
|
};
|
|
215
255
|
|
|
216
256
|
/**
|
|
217
|
-
* @
|
|
257
|
+
* @public
|
|
218
258
|
* {@link InvocationContext} indicating initial data selection flow or edit of existing data.
|
|
219
259
|
*/
|
|
220
260
|
declare type DataSelectionInvocationContext = {
|
|
@@ -237,7 +277,7 @@ declare type DataSelectionInvocationContext = {
|
|
|
237
277
|
};
|
|
238
278
|
|
|
239
279
|
/**
|
|
240
|
-
* @
|
|
280
|
+
* @public
|
|
241
281
|
* Reference to an external data source that can be used to fetch data.
|
|
242
282
|
* Created by Data Connector apps and stored by Canva for data refresh operations.
|
|
243
283
|
*
|
|
@@ -258,7 +298,7 @@ declare type DataSelectionInvocationContext = {
|
|
|
258
298
|
* };
|
|
259
299
|
* ```
|
|
260
300
|
*/
|
|
261
|
-
|
|
301
|
+
declare type DataSourceRef = {
|
|
262
302
|
/**
|
|
263
303
|
* Information needed to identify and retrieve data from your source.
|
|
264
304
|
*
|
|
@@ -283,33 +323,7 @@ export declare type DataSourceRef = {
|
|
|
283
323
|
};
|
|
284
324
|
|
|
285
325
|
/**
|
|
286
|
-
* @
|
|
287
|
-
* {@link ValidationError} indicating the data source reference {@link DataSourceRef} exceeds the 5KB size limit.
|
|
288
|
-
*/
|
|
289
|
-
declare type DataSourceRefLimitExceeded = {
|
|
290
|
-
/**
|
|
291
|
-
* The data source reference exceeds the 5KB size limit.
|
|
292
|
-
*
|
|
293
|
-
* Your app should reduce the size of the `DataSourceRef.source` string.
|
|
294
|
-
*/
|
|
295
|
-
status: "data_source_ref_limit_exceeded";
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* @beta
|
|
300
|
-
* {@link ValidationError} indicating the data source title {@link DataSourceRef.title} exceeds the 255 character limit.
|
|
301
|
-
*/
|
|
302
|
-
declare type DataSourceTitleLimitExceed = {
|
|
303
|
-
/**
|
|
304
|
-
* The data source title exceeds the 255 character limit.
|
|
305
|
-
*
|
|
306
|
-
* Your app should provide a shorter title for the data source.
|
|
307
|
-
*/
|
|
308
|
-
status: "data_source_title_limit_exceeded";
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* @beta
|
|
326
|
+
* @public
|
|
313
327
|
* Structured tabular data for import into Canva.
|
|
314
328
|
*
|
|
315
329
|
* This format allows you to provide typed data with proper formatting
|
|
@@ -347,7 +361,7 @@ declare type DataSourceTitleLimitExceed = {
|
|
|
347
361
|
* };
|
|
348
362
|
* ```
|
|
349
363
|
*/
|
|
350
|
-
|
|
364
|
+
declare type DataTable = {
|
|
351
365
|
/**
|
|
352
366
|
* Column definitions with names and data types.
|
|
353
367
|
*
|
|
@@ -363,46 +377,36 @@ export declare type DataTable = {
|
|
|
363
377
|
};
|
|
364
378
|
|
|
365
379
|
/**
|
|
366
|
-
* @
|
|
380
|
+
* @public
|
|
367
381
|
* Generic type for table cells that resolves to a specific cell type.
|
|
368
382
|
*/
|
|
369
|
-
|
|
383
|
+
declare type DataTableCell<T extends DataType = DataType> = {
|
|
370
384
|
date: DateDataTableCell;
|
|
371
385
|
string: StringDataTableCell;
|
|
372
386
|
number: NumberDataTableCell;
|
|
373
387
|
boolean: BooleanDataTableCell;
|
|
388
|
+
media: MediaCollectionDataTableCell;
|
|
374
389
|
}[T];
|
|
375
390
|
|
|
376
391
|
/**
|
|
377
|
-
* @
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* This can happen due to:
|
|
381
|
-
*
|
|
382
|
-
* - {@link DataType} mismatches (e.g., a number in a string-typed column, a number value in a string cell type)
|
|
383
|
-
* - Unsupported cell types
|
|
384
|
-
* - Inconsistent column configurations (e.g., the number of columns in the data table does not match the number of {@link ColumnConfig})
|
|
392
|
+
* @public
|
|
393
|
+
* Options for uploading an image asset to the user's private media library.
|
|
385
394
|
*/
|
|
386
|
-
declare type
|
|
395
|
+
declare type DataTableImageUpload = Omit<
|
|
396
|
+
ImageUploadOptions,
|
|
397
|
+
"type" | "parentRef"
|
|
398
|
+
> & {
|
|
387
399
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* This error occurs due to:
|
|
391
|
-
*
|
|
392
|
-
* - Data type mismatches (e.g., number in string column)
|
|
393
|
-
* - Unsupported cell types
|
|
394
|
-
* - Inconsistent column configurations
|
|
395
|
-
*
|
|
396
|
-
* Your app should ensure the data conforms to the expected format.
|
|
400
|
+
* Indicates this value contains options for image uploading.
|
|
397
401
|
*/
|
|
398
|
-
|
|
402
|
+
type: "image_upload";
|
|
399
403
|
};
|
|
400
404
|
|
|
401
405
|
/**
|
|
402
|
-
* @
|
|
406
|
+
* @public
|
|
403
407
|
* Maximum dimensions for imported data tables.
|
|
404
408
|
*/
|
|
405
|
-
|
|
409
|
+
declare type DataTableLimit = {
|
|
406
410
|
/**
|
|
407
411
|
* The maximum number of rows allowed.
|
|
408
412
|
*
|
|
@@ -418,35 +422,10 @@ export declare type DataTableLimit = {
|
|
|
418
422
|
};
|
|
419
423
|
|
|
420
424
|
/**
|
|
421
|
-
* @
|
|
422
|
-
* {@link ValidationError} indicating that the data table exceeds the allowed limits.
|
|
423
|
-
*
|
|
424
|
-
* This can happen when:
|
|
425
|
-
* - Number of rows exceeds the row limit
|
|
426
|
-
* - Number of columns exceeds the column limit
|
|
427
|
-
* - Total data size exceeds 200KB
|
|
428
|
-
*/
|
|
429
|
-
declare type DataTableLimitExceeded = {
|
|
430
|
-
/**
|
|
431
|
-
* The data exceeds the maximum allowed limits.
|
|
432
|
-
*
|
|
433
|
-
* This error occurs when:
|
|
434
|
-
*
|
|
435
|
-
* - Number of rows exceeds the row limit
|
|
436
|
-
* - Number of columns exceeds the column limit
|
|
437
|
-
* - Total data size exceeds the allowed size limit
|
|
438
|
-
*
|
|
439
|
-
* Your app should help users select a subset of their data,
|
|
440
|
-
* or provide filtering options to reduce the data size.
|
|
441
|
-
*/
|
|
442
|
-
status: "data_table_limit_exceeded";
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* @beta
|
|
425
|
+
* @public
|
|
447
426
|
* Metadata providing additional context about the imported data.
|
|
448
427
|
*/
|
|
449
|
-
|
|
428
|
+
declare type DataTableMetadata = {
|
|
450
429
|
/**
|
|
451
430
|
* A human-readable description of the dataset.
|
|
452
431
|
*
|
|
@@ -469,20 +448,7 @@ export declare type DataTableMetadata = {
|
|
|
469
448
|
};
|
|
470
449
|
|
|
471
450
|
/**
|
|
472
|
-
* @
|
|
473
|
-
* {@link ValidationError} indicating the provided data table metadata is invalid (e.g not a valid OXML formatting string in {@link NumberCellMetadata.formatting}).
|
|
474
|
-
*/
|
|
475
|
-
declare type DataTableMetadataInvalid = {
|
|
476
|
-
/**
|
|
477
|
-
* The provided metadata is invalid.
|
|
478
|
-
*
|
|
479
|
-
* This typically happens with invalid formatting patterns in {@link NumberCellMetadata.formatting} strings.
|
|
480
|
-
*/
|
|
481
|
-
status: "data_table_metadata_invalid";
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* @beta
|
|
451
|
+
* @public
|
|
486
452
|
* A row in the data table.
|
|
487
453
|
*
|
|
488
454
|
* @example Creating a single row of data cells
|
|
@@ -498,7 +464,7 @@ declare type DataTableMetadataInvalid = {
|
|
|
498
464
|
* };
|
|
499
465
|
* ```
|
|
500
466
|
*/
|
|
501
|
-
|
|
467
|
+
declare type DataTableRow = {
|
|
502
468
|
/**
|
|
503
469
|
* Array of cells containing the data values.
|
|
504
470
|
*
|
|
@@ -508,13 +474,27 @@ export declare type DataTableRow = {
|
|
|
508
474
|
};
|
|
509
475
|
|
|
510
476
|
/**
|
|
511
|
-
* @
|
|
477
|
+
* @public
|
|
478
|
+
* Options for uploading a video asset to the user's private media library.
|
|
479
|
+
*/
|
|
480
|
+
declare type DataTableVideoUpload = Omit<
|
|
481
|
+
VideoUploadOptions,
|
|
482
|
+
"type" | "parentRef"
|
|
483
|
+
> & {
|
|
484
|
+
/**
|
|
485
|
+
* Indicates this value contains options for video uploading.
|
|
486
|
+
*/
|
|
487
|
+
type: "video_upload";
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @public
|
|
512
492
|
* Data types supported for table cells.
|
|
513
493
|
*/
|
|
514
|
-
|
|
494
|
+
declare type DataType = "string" | "number" | "date" | "boolean" | "media";
|
|
515
495
|
|
|
516
496
|
/**
|
|
517
|
-
* @
|
|
497
|
+
* @public
|
|
518
498
|
* Cell containing a date value.
|
|
519
499
|
*
|
|
520
500
|
* @example Creating a date cell
|
|
@@ -532,7 +512,7 @@ export declare type DataType = "string" | "number" | "date" | "boolean";
|
|
|
532
512
|
* };
|
|
533
513
|
* ```
|
|
534
514
|
*/
|
|
535
|
-
|
|
515
|
+
declare type DateDataTableCell = {
|
|
536
516
|
/**
|
|
537
517
|
* Indicates this cell contains a date value.
|
|
538
518
|
*/
|
|
@@ -551,14 +531,14 @@ declare namespace design {
|
|
|
551
531
|
export { design };
|
|
552
532
|
|
|
553
533
|
/**
|
|
554
|
-
* @
|
|
534
|
+
* @public
|
|
555
535
|
*
|
|
556
536
|
* Main interface for implementing the DesignEditor intent.
|
|
557
537
|
*
|
|
558
538
|
* Implementing the DesignEditor Intent enables apps to assist users in editing designs,
|
|
559
539
|
* by presenting interactive and creative tooling alongside the Canva design surface.
|
|
560
540
|
*/
|
|
561
|
-
|
|
541
|
+
declare type DesignEditorIntent = {
|
|
562
542
|
/**
|
|
563
543
|
* Renders the UI containing the app’s functionality.
|
|
564
544
|
*
|
|
@@ -573,12 +553,27 @@ export declare type DesignEditorIntent = {
|
|
|
573
553
|
};
|
|
574
554
|
|
|
575
555
|
/**
|
|
576
|
-
* @
|
|
577
|
-
*
|
|
556
|
+
* @public
|
|
557
|
+
* A set of dimensions.
|
|
558
|
+
*/
|
|
559
|
+
declare type Dimensions = {
|
|
560
|
+
/**
|
|
561
|
+
* A width, in pixels.
|
|
562
|
+
*/
|
|
563
|
+
width: number;
|
|
564
|
+
/**
|
|
565
|
+
* A height, in pixels.
|
|
566
|
+
*/
|
|
567
|
+
height: number;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @public
|
|
572
|
+
* Successful result from `getDataTable` action.
|
|
578
573
|
*/
|
|
579
|
-
|
|
574
|
+
declare type GetDataTableCompleted = {
|
|
580
575
|
/**
|
|
581
|
-
* Indicates the
|
|
576
|
+
* Indicates the operation completed successfully
|
|
582
577
|
*/
|
|
583
578
|
status: "completed";
|
|
584
579
|
/**
|
|
@@ -592,19 +587,19 @@ export declare type FetchDataTableCompleted = {
|
|
|
592
587
|
};
|
|
593
588
|
|
|
594
589
|
/**
|
|
595
|
-
* @
|
|
596
|
-
* Error results that can be returned from `
|
|
590
|
+
* @public
|
|
591
|
+
* Error results that can be returned from `getDataTable` method.
|
|
597
592
|
*/
|
|
598
|
-
|
|
593
|
+
declare type GetDataTableError =
|
|
599
594
|
| OutdatedSourceRefError
|
|
600
595
|
| RemoteRequestFailedError
|
|
601
596
|
| AppError;
|
|
602
597
|
|
|
603
598
|
/**
|
|
604
|
-
* @
|
|
605
|
-
* Parameters for the
|
|
599
|
+
* @public
|
|
600
|
+
* Parameters for the getDataTable action.
|
|
606
601
|
*/
|
|
607
|
-
|
|
602
|
+
declare type GetDataTableRequest = {
|
|
608
603
|
/**
|
|
609
604
|
* Reference to the data source to fetch.
|
|
610
605
|
*
|
|
@@ -634,42 +629,240 @@ export declare type FetchDataTableParams = {
|
|
|
634
629
|
};
|
|
635
630
|
|
|
636
631
|
/**
|
|
637
|
-
* @
|
|
638
|
-
* Result returned from the `
|
|
632
|
+
* @public
|
|
633
|
+
* Result returned from the `getDataTable` action.
|
|
634
|
+
*/
|
|
635
|
+
declare type GetDataTableResponse = GetDataTableCompleted | GetDataTableError;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* @public
|
|
639
|
+
* The MIME type of an image file that's supported by Canva's backend.
|
|
640
|
+
*/
|
|
641
|
+
declare type ImageMimeType =
|
|
642
|
+
| "image/jpeg"
|
|
643
|
+
| "image/heic"
|
|
644
|
+
| "image/png"
|
|
645
|
+
| "image/svg+xml"
|
|
646
|
+
| "image/webp"
|
|
647
|
+
| "image/tiff";
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* @public
|
|
651
|
+
* A unique identifier that points to an image asset in Canva's backend.
|
|
639
652
|
*/
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
653
|
+
declare type ImageRef = string & {
|
|
654
|
+
__imageRef: never;
|
|
655
|
+
};
|
|
643
656
|
|
|
644
657
|
/**
|
|
645
|
-
* @
|
|
646
|
-
*
|
|
658
|
+
* @public
|
|
659
|
+
* Options for uploading an image asset to the user's private media library.
|
|
647
660
|
*/
|
|
648
|
-
|
|
661
|
+
declare type ImageUploadOptions = {
|
|
649
662
|
/**
|
|
650
|
-
*
|
|
663
|
+
* The type of asset.
|
|
664
|
+
*/
|
|
665
|
+
type: "image";
|
|
666
|
+
/**
|
|
667
|
+
* The ref of the original asset from which this new asset was derived.
|
|
651
668
|
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
669
|
+
* @remarks
|
|
670
|
+
* For example, if an app applies an effect to an image, `parentRef` should contain the ref of the original image.
|
|
654
671
|
*/
|
|
655
|
-
|
|
672
|
+
parentRef?: ImageRef;
|
|
656
673
|
/**
|
|
657
|
-
* The
|
|
674
|
+
* The URL of the image file to upload.
|
|
675
|
+
* This can be an external URL or a data URL.
|
|
676
|
+
*
|
|
677
|
+
* @remarks
|
|
678
|
+
* Requirements for external URLs:
|
|
679
|
+
*
|
|
680
|
+
* - Must use HTTPS
|
|
681
|
+
* - Must return a `200` status code
|
|
682
|
+
* - `Content-Type` must match the file's MIME type
|
|
683
|
+
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
684
|
+
* - Must not redirect
|
|
685
|
+
* - Must not contain an IP address
|
|
686
|
+
* - Maximum length: 4096 characters
|
|
687
|
+
* - Must not contain whitespace
|
|
688
|
+
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
689
|
+
* - Maximum file size: 50MB
|
|
690
|
+
*
|
|
691
|
+
* Requirements for data URLs:
|
|
692
|
+
*
|
|
693
|
+
* - Must include `;base64` for base64-encoded data
|
|
694
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
695
|
+
*
|
|
696
|
+
* Requirements for SVGs:
|
|
697
|
+
*
|
|
698
|
+
* - Disallowed elements:
|
|
699
|
+
* - `a`
|
|
700
|
+
* - `altglyph`
|
|
701
|
+
* - `altglyphdef`
|
|
702
|
+
* - `altglyphitem`
|
|
703
|
+
* - `animate`
|
|
704
|
+
* - `animatemotion`
|
|
705
|
+
* - `animatetransform`
|
|
706
|
+
* - `cursor`
|
|
707
|
+
* - `discard`
|
|
708
|
+
* - `font`
|
|
709
|
+
* - `font-face`
|
|
710
|
+
* - `font-face-format`
|
|
711
|
+
* - `font-face-name`
|
|
712
|
+
* - `font-face-src`
|
|
713
|
+
* - `font-face-uri`
|
|
714
|
+
* - `foreignobject`
|
|
715
|
+
* - `glyph`
|
|
716
|
+
* - `glyphref`
|
|
717
|
+
* - `missing-glyph`
|
|
718
|
+
* - `mpath`
|
|
719
|
+
* - `script`
|
|
720
|
+
* - `set`
|
|
721
|
+
* - `switch`
|
|
722
|
+
* - `tref`
|
|
723
|
+
* - Disallowed attributes:
|
|
724
|
+
* - `crossorigin`
|
|
725
|
+
* - `lang`
|
|
726
|
+
* - `media`
|
|
727
|
+
* - `onload`
|
|
728
|
+
* - `ping`
|
|
729
|
+
* - `referrerpolicy`
|
|
730
|
+
* - `rel`
|
|
731
|
+
* - `rendering-intent`
|
|
732
|
+
* - `requiredextensions`
|
|
733
|
+
* - `requiredfeatures`
|
|
734
|
+
* - `systemlanguage`
|
|
735
|
+
* - `tabindex`
|
|
736
|
+
* - `transform-origin`
|
|
737
|
+
* - `unicode`
|
|
738
|
+
* - `vector-effect`
|
|
739
|
+
* - The `href` attribute of an `image` element only supports data URLs for PNG and JPEG images.
|
|
740
|
+
* - The URL in the `href` attribute must not point to a location outside of the SVG.
|
|
741
|
+
* - The `style` attribute must not use the `mix-blend-mode` property.
|
|
658
742
|
*/
|
|
659
|
-
|
|
660
|
-
|
|
743
|
+
url: string;
|
|
744
|
+
/**
|
|
745
|
+
* The MIME type of the image file.
|
|
746
|
+
*/
|
|
747
|
+
mimeType: ImageMimeType;
|
|
748
|
+
/**
|
|
749
|
+
* The URL of a thumbnail image to display while the image is queued for upload.
|
|
750
|
+
* This can be an external URL or a data URL.
|
|
751
|
+
*
|
|
752
|
+
* @remarks
|
|
753
|
+
* Requirements for external URLs:
|
|
754
|
+
*
|
|
755
|
+
* - Must use HTTPS
|
|
756
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
757
|
+
* - Must be a PNG, JPEG, or SVG file
|
|
758
|
+
* - Maximum length: 4096 characters
|
|
759
|
+
*
|
|
760
|
+
* Requirements for data URLs:
|
|
761
|
+
*
|
|
762
|
+
* - Must include `;base64` for base64-encoded data
|
|
763
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
764
|
+
*/
|
|
765
|
+
thumbnailUrl: string;
|
|
766
|
+
/**
|
|
767
|
+
* A disclosure identifying if the app generated this image using AI
|
|
768
|
+
*
|
|
769
|
+
* @remarks
|
|
770
|
+
* Helps users make informed decisions about the content they interact with.
|
|
771
|
+
* See {@link AiDisclosure} for the full definition.
|
|
772
|
+
*
|
|
773
|
+
* **App Generated**
|
|
774
|
+
*
|
|
775
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
776
|
+
* the app requests a third-party service to take similar action on an image using AI.
|
|
777
|
+
*
|
|
778
|
+
* Required for the following cases (this list is not exhaustive):
|
|
779
|
+
* | Case | Reason |
|
|
780
|
+
* | -- | -- |
|
|
781
|
+
* | AI generates a new image from scratch | Creates new creative content |
|
|
782
|
+
* | AI changes the style of the image e.g. makes it cartoon | Significantly alters the style |
|
|
783
|
+
* | AI removes an object and replaces it with new content | Creates new creative content |
|
|
784
|
+
* | AI changes the facial expression of a person in an image | Can alter content's original meaning |
|
|
785
|
+
* | AI composites multiple images together | Significantly alters context |
|
|
786
|
+
* | AI expands an image by generating new content to fill the edges | Creates new creative content |
|
|
787
|
+
* | AI replaces background by generating new content | Creates new creative content |
|
|
788
|
+
*
|
|
789
|
+
* **None**
|
|
790
|
+
*
|
|
791
|
+
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of a request
|
|
792
|
+
* to third-party hosted content.
|
|
793
|
+
*
|
|
794
|
+
* Required for the following cases (this list is not exhaustive):
|
|
795
|
+
* | Case | Reason |
|
|
796
|
+
* | -- | -- |
|
|
797
|
+
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
798
|
+
* | AI corrects red eyes | A minor correction |
|
|
799
|
+
* | AI removes background without replacement | Doesn't change original meaning by itself |
|
|
800
|
+
* | AI changes the color of an object in an image | Doesn't change original meaning by itself |
|
|
801
|
+
* | AI detects image defects and suggests manual fixes | Didn't change the asset itself |
|
|
802
|
+
* | AI adjusts brightness and contrast on an image | Doesn't change original meaning by itself |
|
|
803
|
+
* | AI upscales an image | Doesn't change original meaning by itself |
|
|
804
|
+
*/
|
|
805
|
+
aiDisclosure: AiDisclosure;
|
|
806
|
+
} & AllOrNone<Dimensions>;
|
|
661
807
|
|
|
662
808
|
/**
|
|
663
|
-
* @
|
|
809
|
+
* @public
|
|
664
810
|
* Information explaining why the data selection UI was launched.
|
|
665
811
|
*/
|
|
666
|
-
|
|
812
|
+
declare type InvocationContext =
|
|
667
813
|
| DataSelectionInvocationContext
|
|
668
814
|
| OutdatedSourceRefInvocationContext
|
|
669
815
|
| AppErrorInvocationContext;
|
|
670
816
|
|
|
671
817
|
/**
|
|
672
|
-
* @
|
|
818
|
+
* @public
|
|
819
|
+
* Cell containing a media collection (images) value.
|
|
820
|
+
*
|
|
821
|
+
* @example Creating a media cell with an image
|
|
822
|
+
* ```ts
|
|
823
|
+
* import type { MediaCollectionDataTableCell } from '@canva/intents/data';
|
|
824
|
+
*
|
|
825
|
+
* const mediaCell: MediaCollectionDataTableCell = {
|
|
826
|
+
* type: 'media',
|
|
827
|
+
* value: [{
|
|
828
|
+
* type: 'image_upload',
|
|
829
|
+
* url: 'https://www.canva.dev/example-assets/image-import/image.jpg',
|
|
830
|
+
* mimeType: 'image/jpeg',
|
|
831
|
+
* thumbnailUrl: 'https://www.canva.dev/example-assets/image-import/thumbnail.jpg',
|
|
832
|
+
* aiDisclosure: 'none'
|
|
833
|
+
* }]
|
|
834
|
+
* };
|
|
835
|
+
* ```
|
|
836
|
+
*
|
|
837
|
+
* @example Creating an empty media cell
|
|
838
|
+
* ```ts
|
|
839
|
+
* import type { MediaCollectionDataTableCell } from '@canva/intents/data';
|
|
840
|
+
*
|
|
841
|
+
* const emptyMediaCell: MediaCollectionDataTableCell = {
|
|
842
|
+
* type: 'media',
|
|
843
|
+
* value: []
|
|
844
|
+
* };
|
|
845
|
+
* ```
|
|
846
|
+
*/
|
|
847
|
+
declare type MediaCollectionDataTableCell = {
|
|
848
|
+
/**
|
|
849
|
+
* Indicates this cell contains a media collection.
|
|
850
|
+
*/
|
|
851
|
+
type: "media";
|
|
852
|
+
/**
|
|
853
|
+
* Media collection values.
|
|
854
|
+
*
|
|
855
|
+
* Use empty array for an empty cell.
|
|
856
|
+
*/
|
|
857
|
+
value: (DataTableImageUpload | DataTableVideoUpload)[];
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
declare type Never<T> = {
|
|
861
|
+
[key in keyof T]?: never;
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* @public
|
|
673
866
|
* Formatting metadata for number cells.
|
|
674
867
|
*
|
|
675
868
|
* @example Formatting as currency
|
|
@@ -705,7 +898,7 @@ export declare type InvocationContext =
|
|
|
705
898
|
* };
|
|
706
899
|
* ```
|
|
707
900
|
*/
|
|
708
|
-
|
|
901
|
+
declare type NumberCellMetadata = {
|
|
709
902
|
/**
|
|
710
903
|
* Formatting pattern using Office Open XML Format.
|
|
711
904
|
*
|
|
@@ -716,7 +909,7 @@ export declare type NumberCellMetadata = {
|
|
|
716
909
|
};
|
|
717
910
|
|
|
718
911
|
/**
|
|
719
|
-
* @
|
|
912
|
+
* @public
|
|
720
913
|
* Cell containing a numeric value.
|
|
721
914
|
*
|
|
722
915
|
* @example Creating a number cell
|
|
@@ -740,7 +933,7 @@ export declare type NumberCellMetadata = {
|
|
|
740
933
|
* };
|
|
741
934
|
* ```
|
|
742
935
|
*/
|
|
743
|
-
|
|
936
|
+
declare type NumberDataTableCell = {
|
|
744
937
|
/**
|
|
745
938
|
* Indicates this cell contains a number value.
|
|
746
939
|
*/
|
|
@@ -775,8 +968,8 @@ export declare type NumberDataTableCell = {
|
|
|
775
968
|
};
|
|
776
969
|
|
|
777
970
|
/**
|
|
778
|
-
* @
|
|
779
|
-
* {@link
|
|
971
|
+
* @public
|
|
972
|
+
* {@link GetDataTableError} indicating the data source reference is no longer valid.
|
|
780
973
|
* This will trigger a re-selection flow for the user.
|
|
781
974
|
*/
|
|
782
975
|
declare type OutdatedSourceRefError = {
|
|
@@ -797,16 +990,16 @@ declare type OutdatedSourceRefError = {
|
|
|
797
990
|
};
|
|
798
991
|
|
|
799
992
|
/**
|
|
800
|
-
* @
|
|
993
|
+
* @public
|
|
801
994
|
* {@link InvocationContext} indicating an error occurred because the previously selected data source reference is no longer valid.
|
|
802
|
-
* Triggered when
|
|
995
|
+
* Triggered when getDataTable returned 'outdated_source_ref' during data refresh.
|
|
803
996
|
* UI should guide the user to reselect or reconfigure their data.
|
|
804
997
|
*/
|
|
805
998
|
declare type OutdatedSourceRefInvocationContext = {
|
|
806
999
|
/**
|
|
807
1000
|
* Previously selected data source reference is no longer valid.
|
|
808
1001
|
*
|
|
809
|
-
* This occurs when `
|
|
1002
|
+
* This occurs when `getDataTable` returned 'outdated_source_ref' during a
|
|
810
1003
|
* refresh attempt. Your UI should guide the user to select a new data source
|
|
811
1004
|
* or update their selection.
|
|
812
1005
|
*
|
|
@@ -820,16 +1013,30 @@ declare type OutdatedSourceRefInvocationContext = {
|
|
|
820
1013
|
};
|
|
821
1014
|
|
|
822
1015
|
/**
|
|
823
|
-
* @
|
|
1016
|
+
* @public
|
|
824
1017
|
*
|
|
825
|
-
* Prepares
|
|
1018
|
+
* Prepares a {@link DataConnectorIntent|DataConnector Intent}.
|
|
1019
|
+
*
|
|
1020
|
+
* @example
|
|
1021
|
+
* ```tsx
|
|
1022
|
+
* import { prepareDataConnector } from "@canva/intents/data";
|
|
1023
|
+
*
|
|
1024
|
+
* prepareDataConnector({
|
|
1025
|
+
* fetchDataTable: async (params) => {
|
|
1026
|
+
* // Implement the logic to fetch the data table
|
|
1027
|
+
* },
|
|
1028
|
+
* renderSelectionUi: (params) => {
|
|
1029
|
+
* // Implement the UI for the data table selection
|
|
1030
|
+
* },
|
|
1031
|
+
* });
|
|
1032
|
+
* ```
|
|
826
1033
|
*/
|
|
827
1034
|
declare const prepareDataConnector: (
|
|
828
1035
|
implementation: DataConnectorIntent,
|
|
829
1036
|
) => void;
|
|
830
1037
|
|
|
831
1038
|
/**
|
|
832
|
-
* @
|
|
1039
|
+
* @public
|
|
833
1040
|
*
|
|
834
1041
|
* Prepares a {@link DesignEditorIntent|DesignEditor Intent}.
|
|
835
1042
|
*
|
|
@@ -837,20 +1044,18 @@ declare const prepareDataConnector: (
|
|
|
837
1044
|
* ```tsx
|
|
838
1045
|
* import { prepareDesignEditor } from '@canva/intents/design';
|
|
839
1046
|
*
|
|
840
|
-
* function render() {
|
|
841
|
-
* // render your UI using your preferred framework
|
|
842
|
-
* }
|
|
843
|
-
*
|
|
844
1047
|
* prepareDesignEditor({
|
|
845
|
-
*
|
|
1048
|
+
* render: async () => {
|
|
1049
|
+
* // TODO: Implement the logic to render your app's UI
|
|
1050
|
+
* },
|
|
846
1051
|
* });
|
|
847
1052
|
* ```
|
|
848
1053
|
*/
|
|
849
1054
|
declare const prepareDesignEditor: (implementation: DesignEditorIntent) => void;
|
|
850
1055
|
|
|
851
1056
|
/**
|
|
852
|
-
* @
|
|
853
|
-
* {@link
|
|
1057
|
+
* @public
|
|
1058
|
+
* {@link GetDataTableError} indicating failure to fetch data from the external source.
|
|
854
1059
|
* Typically due to network issues or API failures.
|
|
855
1060
|
*/
|
|
856
1061
|
declare type RemoteRequestFailedError = {
|
|
@@ -864,10 +1069,10 @@ declare type RemoteRequestFailedError = {
|
|
|
864
1069
|
};
|
|
865
1070
|
|
|
866
1071
|
/**
|
|
867
|
-
* @
|
|
1072
|
+
* @public
|
|
868
1073
|
* Parameters for rendering the data selection UI.
|
|
869
1074
|
*/
|
|
870
|
-
|
|
1075
|
+
declare type RenderSelectionUiRequest = {
|
|
871
1076
|
/**
|
|
872
1077
|
* Context information about why the data selection UI is being launched.
|
|
873
1078
|
*
|
|
@@ -896,17 +1101,23 @@ export declare type RenderSelectionUiParams = {
|
|
|
896
1101
|
* 1. Show a preview of the selected data to the user
|
|
897
1102
|
* 2. Validate that the selection meets system requirements
|
|
898
1103
|
*
|
|
899
|
-
* Calling this function will trigger your `
|
|
1104
|
+
* Calling this function will trigger your `getDataTable` implementation.
|
|
900
1105
|
* Wait for the promise to resolve to determine if the selection is valid.
|
|
901
1106
|
*
|
|
902
1107
|
* @param dataSourceRef - Reference object identifying the selected data
|
|
903
1108
|
* @returns Promise resolving to success or an error result
|
|
1109
|
+
* @throws Will throw CanvaError('bad_request') if
|
|
1110
|
+
* 1. {@link DataSourceRef.source} exceeds 5kb.
|
|
1111
|
+
* 2. {@link DataSourceRef.title} exceeds 255 characters.
|
|
1112
|
+
* 3. {@link GetDataTableCompleted.dataTable} exceeds {@link DataTableLimit} or contains invalid data.
|
|
904
1113
|
*/
|
|
905
|
-
updateDataRef: (
|
|
1114
|
+
updateDataRef: (
|
|
1115
|
+
dataSourceRef: DataSourceRef,
|
|
1116
|
+
) => Promise<UpdateDataRefResponse>;
|
|
906
1117
|
};
|
|
907
1118
|
|
|
908
1119
|
/**
|
|
909
|
-
* @
|
|
1120
|
+
* @public
|
|
910
1121
|
* Cell containing a text value.
|
|
911
1122
|
*
|
|
912
1123
|
* @example Creating a string cell
|
|
@@ -924,7 +1135,7 @@ export declare type RenderSelectionUiParams = {
|
|
|
924
1135
|
* };
|
|
925
1136
|
* ```
|
|
926
1137
|
*/
|
|
927
|
-
|
|
1138
|
+
declare type StringDataTableCell = {
|
|
928
1139
|
/**
|
|
929
1140
|
* Indicates this cell contains a string value.
|
|
930
1141
|
*/
|
|
@@ -940,8 +1151,8 @@ export declare type StringDataTableCell = {
|
|
|
940
1151
|
};
|
|
941
1152
|
|
|
942
1153
|
/**
|
|
943
|
-
* @
|
|
944
|
-
* Successful result from the {@link
|
|
1154
|
+
* @public
|
|
1155
|
+
* Successful result from the {@link RenderSelectionUiRequest.updateDataRef} callback.
|
|
945
1156
|
*/
|
|
946
1157
|
declare type UpdateDataRefCompleted = {
|
|
947
1158
|
/**
|
|
@@ -951,25 +1162,148 @@ declare type UpdateDataRefCompleted = {
|
|
|
951
1162
|
};
|
|
952
1163
|
|
|
953
1164
|
/**
|
|
954
|
-
* @
|
|
955
|
-
* Result returned from the {@link
|
|
1165
|
+
* @public
|
|
1166
|
+
* Result returned from the {@link RenderSelectionUiRequest.updateDataRef} callback.
|
|
956
1167
|
* Indicates whether {@link DataSourceRef} update succeeded or failed.
|
|
957
1168
|
*/
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1169
|
+
declare type UpdateDataRefResponse = UpdateDataRefCompleted | GetDataTableError;
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* @public
|
|
1173
|
+
* The MIME type of a video file that's supported by Canva's backend.
|
|
1174
|
+
*
|
|
1175
|
+
* @remarks
|
|
1176
|
+
* - GIFs are treated as videos, not images.
|
|
1177
|
+
* - `"application/json"` is only used for Lottie files.
|
|
1178
|
+
*/
|
|
1179
|
+
declare type VideoMimeType =
|
|
1180
|
+
| "video/avi"
|
|
1181
|
+
| "video/x-msvideo"
|
|
1182
|
+
| "image/gif"
|
|
1183
|
+
| "video/x-m4v"
|
|
1184
|
+
| "video/x-matroska"
|
|
1185
|
+
| "video/quicktime"
|
|
1186
|
+
| "video/mp4"
|
|
1187
|
+
| "video/mpeg"
|
|
1188
|
+
| "video/webm"
|
|
1189
|
+
| "application/json";
|
|
963
1190
|
|
|
964
1191
|
/**
|
|
965
|
-
* @
|
|
966
|
-
*
|
|
1192
|
+
* @public
|
|
1193
|
+
* A unique identifier that points to a video asset in Canva's backend.
|
|
967
1194
|
*/
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1195
|
+
declare type VideoRef = string & {
|
|
1196
|
+
__videoRef: never;
|
|
1197
|
+
};
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @public
|
|
1201
|
+
* Options for uploading a video asset to the user's private media library.
|
|
1202
|
+
*/
|
|
1203
|
+
declare type VideoUploadOptions = {
|
|
1204
|
+
/**
|
|
1205
|
+
* The type of asset.
|
|
1206
|
+
*/
|
|
1207
|
+
type: "video";
|
|
1208
|
+
/**
|
|
1209
|
+
* The ref of the original asset from which this new asset was derived.
|
|
1210
|
+
*
|
|
1211
|
+
* @remarks
|
|
1212
|
+
* For example, if an app applies an effect to a video, `parentRef` should contain the ref of the original video.
|
|
1213
|
+
*/
|
|
1214
|
+
parentRef?: VideoRef;
|
|
1215
|
+
/**
|
|
1216
|
+
* The URL of the video file to upload.
|
|
1217
|
+
*
|
|
1218
|
+
* @remarks
|
|
1219
|
+
* Requirements:
|
|
1220
|
+
*
|
|
1221
|
+
* - Must use HTTPS
|
|
1222
|
+
* - Must return a `200` status code
|
|
1223
|
+
* - `Content-Type` must match the file's MIME type
|
|
1224
|
+
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
1225
|
+
* - Must not redirect
|
|
1226
|
+
* - Must not contain an IP address
|
|
1227
|
+
* - Maximum length: 4096 characters
|
|
1228
|
+
* - Must not contain whitespace
|
|
1229
|
+
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
1230
|
+
* - Maximum file size: 100MB
|
|
1231
|
+
*/
|
|
1232
|
+
url: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* The MIME type of the video file.
|
|
1235
|
+
*/
|
|
1236
|
+
mimeType: VideoMimeType;
|
|
1237
|
+
/**
|
|
1238
|
+
* The URL of a thumbnail video to display while the video is queued for upload.
|
|
1239
|
+
*
|
|
1240
|
+
* @remarks
|
|
1241
|
+
* Requirements:
|
|
1242
|
+
*
|
|
1243
|
+
* - Must use HTTPS
|
|
1244
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
1245
|
+
* - Maximum length: 4096 characters
|
|
1246
|
+
* - The dimensions of the thumbnail video must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
1247
|
+
* - Must not be an AVI file. Although our APIs support uploading AVI videos, Canva can't preview them because of native support of browsers
|
|
1248
|
+
*/
|
|
1249
|
+
thumbnailVideoUrl?: string;
|
|
1250
|
+
/**
|
|
1251
|
+
* The URL of a thumbnail image to use as a fallback if `thumbnailVideoUrl` isn't provided.
|
|
1252
|
+
* This can be an external URL or a data URL.
|
|
1253
|
+
*
|
|
1254
|
+
* @remarks
|
|
1255
|
+
* Requirements for external URLs:
|
|
1256
|
+
*
|
|
1257
|
+
* - Must use HTTPS
|
|
1258
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
1259
|
+
* - Must be a PNG, JPEG, or SVG file
|
|
1260
|
+
* - Maximum length: 4096 characters
|
|
1261
|
+
*
|
|
1262
|
+
* Requirements for data URLs:
|
|
1263
|
+
*
|
|
1264
|
+
* - Must include `;base64` for base64-encoded data
|
|
1265
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
1266
|
+
* - The dimensions of the thumbnail must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
1267
|
+
*/
|
|
1268
|
+
thumbnailImageUrl: string;
|
|
1269
|
+
/**
|
|
1270
|
+
* A disclosure identifying if the app generated this video using AI.
|
|
1271
|
+
*
|
|
1272
|
+
* @remarks
|
|
1273
|
+
* Helps users make informed decisions about the content they interact with.
|
|
1274
|
+
* See {@link AiDisclosure} for the full definition.
|
|
1275
|
+
*
|
|
1276
|
+
* **App Generated**
|
|
1277
|
+
*
|
|
1278
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
1279
|
+
* the app requests a third-party service to take similar action on a video using AI.
|
|
1280
|
+
*
|
|
1281
|
+
* Required for the following cases (this list is not exhaustive):
|
|
1282
|
+
* | Case | Reason |
|
|
1283
|
+
* | -- | -- |
|
|
1284
|
+
* | AI generates a new video from scratch | Creates new creative content |
|
|
1285
|
+
* | AI changes the style of the video e.g. makes it cartoon | Significantly alters the style |
|
|
1286
|
+
* | AI adds subtitles that rely on subjective interpretation | Creates new creative content |
|
|
1287
|
+
* | AI expands a video by generating new content to fill the edges | Creates new creative content |
|
|
1288
|
+
* | AI animates an image | Creates new creative content |
|
|
1289
|
+
* | AI fixes defects e.g. blur in a video by generating details | Creates new creative content |
|
|
1290
|
+
* | AI generates a talking head presenter | Creates new creative content |
|
|
1291
|
+
*
|
|
1292
|
+
* **None**
|
|
1293
|
+
*
|
|
1294
|
+
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of
|
|
1295
|
+
* a request to third-party hosted content.
|
|
1296
|
+
*
|
|
1297
|
+
* Required for the following cases (this list is not exhaustive):
|
|
1298
|
+
* | Case | Reason |
|
|
1299
|
+
* | -- | -- |
|
|
1300
|
+
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
1301
|
+
* | AI corrects red eyes | A minor correction |
|
|
1302
|
+
* | AI adjusts brightness and contrast on a video | Doesn't change original meaning by itself |
|
|
1303
|
+
* | AI creates a slow motion effect in a video | Doesn't change original meaning by itself |
|
|
1304
|
+
* | AI adds AI word-by-word transcribed subtitles to a video | Doesn't change original meaning by itself |
|
|
1305
|
+
*/
|
|
1306
|
+
aiDisclosure: AiDisclosure;
|
|
1307
|
+
} & AllOrNone<Dimensions>;
|
|
974
1308
|
|
|
975
1309
|
export {};
|