@canva/design 2.7.6-beta.2 → 2.8.1-alpha.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 +2 -15
- package/{beta.d.ts → alpha.d.ts} +1131 -97
- package/index.d.ts +1 -1
- package/lib/cjs/sdk/design/{beta.js → alpha.js} +13 -16
- package/lib/cjs/sdk/design/fake/create_beta.js +3 -1
- package/lib/cjs/sdk/design/fake/fake_autofill_client.js +21 -0
- package/lib/cjs/sdk/design/fake/fake_design_interaction_client.js +22 -0
- package/lib/cjs/sdk/design/index.js +1 -1
- package/lib/cjs/sdk/design/public.js +0 -1
- package/lib/cjs/sdk/design/test/alpha.js +18 -0
- package/lib/cjs/sdk/design/test/index.js +1 -1
- package/lib/cjs/sdk/design/version.js +2 -2
- package/lib/esm/sdk/design/alpha.js +7 -0
- package/lib/esm/sdk/design/fake/create_beta.js +3 -1
- package/lib/esm/sdk/design/fake/fake_autofill_client.js +11 -0
- package/lib/esm/sdk/design/fake/fake_design_interaction_client.js +22 -0
- package/lib/esm/sdk/design/index.js +1 -1
- package/lib/esm/sdk/design/public.js +0 -1
- package/lib/esm/sdk/design/test/alpha.js +1 -0
- package/lib/esm/sdk/design/test/index.js +1 -1
- package/lib/esm/sdk/design/version.js +2 -2
- package/package.json +10 -10
- package/test/index.d.ts +1 -1
- package/lib/esm/sdk/design/beta.js +0 -10
- /package/test/{beta.d.ts → alpha.d.ts} +0 -0
package/{beta.d.ts → alpha.d.ts}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @beta
|
|
3
3
|
* Information about a page within a design with fixed or unbounded dimensions.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
declare type AbsolutePageMetadata = {
|
|
6
6
|
/**
|
|
7
7
|
* The type of page.
|
|
8
8
|
*/
|
|
@@ -386,6 +386,46 @@ export declare const addPage: (opts?: {
|
|
|
386
386
|
};
|
|
387
387
|
}) => Promise<void>;
|
|
388
388
|
|
|
389
|
+
/**
|
|
390
|
+
* @public
|
|
391
|
+
* A disclosure identifying if the app generated this asset using AI.
|
|
392
|
+
*
|
|
393
|
+
* @remarks
|
|
394
|
+
* Helps users make informed decisions about the content they interact with.
|
|
395
|
+
*
|
|
396
|
+
* AI is generally defined as any machine system that, given an objective, infers how to generate an output from an input.
|
|
397
|
+
* Some examples include "generative AI", "large language models", and "machine learning".
|
|
398
|
+
*
|
|
399
|
+
* **App Generated**
|
|
400
|
+
*
|
|
401
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
402
|
+
* the app makes a request to a third-party service to do so.
|
|
403
|
+
*
|
|
404
|
+
* A significantly altered asset means the AI changes key information or details, such as
|
|
405
|
+
* removing or replacing key components in the original content, which can include applying style transfer, or changing facial expressions.
|
|
406
|
+
*
|
|
407
|
+
* Label this asset as 'app_generated' under these conditions:
|
|
408
|
+
*
|
|
409
|
+
* The following is true:
|
|
410
|
+
*
|
|
411
|
+
* - 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.
|
|
412
|
+
*
|
|
413
|
+
* And any of these conditions are also true:
|
|
414
|
+
*
|
|
415
|
+
* - The AI creates entirely new content from scratch.
|
|
416
|
+
* - The AI introduces new multimedia, details, or creative elements not originally present.
|
|
417
|
+
* - The AI removes and replaces the asset's key components.
|
|
418
|
+
* - The AI alters the asset's appearance, meaning, or context in a way that conveys a different message than the original.
|
|
419
|
+
*
|
|
420
|
+
* **None**
|
|
421
|
+
*
|
|
422
|
+
* '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
|
|
423
|
+
* request, or when the asset wasn't significantly altered by AI.
|
|
424
|
+
*/
|
|
425
|
+
declare type AiDisclosure = 'app_generated' | 'none';
|
|
426
|
+
|
|
427
|
+
declare type AllOrNone<T> = T | Never<T>;
|
|
428
|
+
|
|
389
429
|
/**
|
|
390
430
|
* @public
|
|
391
431
|
* Alternative text for a11y compliance.
|
|
@@ -788,6 +828,17 @@ export declare type AppElementClientConfiguration<A extends AppElementData> = {
|
|
|
788
828
|
render: AppElementRenderer<A>;
|
|
789
829
|
};
|
|
790
830
|
|
|
831
|
+
/**
|
|
832
|
+
* @alpha
|
|
833
|
+
* Configuration for an App Element
|
|
834
|
+
*/
|
|
835
|
+
export declare type AppElementClientConfigurationV2<A extends AppElementData> = {
|
|
836
|
+
/**
|
|
837
|
+
* The AppElementRenderer to use when rendering the app element
|
|
838
|
+
*/
|
|
839
|
+
render: AppElementRendererV2<A>;
|
|
840
|
+
};
|
|
841
|
+
|
|
791
842
|
/**
|
|
792
843
|
* @public
|
|
793
844
|
* The data associated with an app element.
|
|
@@ -823,6 +874,22 @@ export declare type AppElementRenderer<A extends AppElementData> = (appElementDa
|
|
|
823
874
|
*/
|
|
824
875
|
export declare type AppElementRendererOutput = GroupContentAtPoint[];
|
|
825
876
|
|
|
877
|
+
/**
|
|
878
|
+
* @alpha
|
|
879
|
+
* A return value of {@link AppElementRendererV2} function.
|
|
880
|
+
* It is an array of elements to render within an app element.
|
|
881
|
+
*/
|
|
882
|
+
export declare type AppElementRendererOutputV2 = AppElementRendererOutput;
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* @alpha
|
|
886
|
+
* A callback that runs when an app's element is changed.
|
|
887
|
+
*
|
|
888
|
+
* @remarks
|
|
889
|
+
* This callback must return one or more elements to render within the app element.
|
|
890
|
+
*/
|
|
891
|
+
export declare type AppElementRendererV2<A extends AppElementData> = (appElementData: A) => AppElementRendererOutputV2;
|
|
892
|
+
|
|
826
893
|
/**
|
|
827
894
|
* @public
|
|
828
895
|
* A unique identifier that references an app runtime process
|
|
@@ -875,6 +942,108 @@ export declare type AudioTrack = {
|
|
|
875
942
|
ref: AudioRef;
|
|
876
943
|
};
|
|
877
944
|
|
|
945
|
+
/**
|
|
946
|
+
* @alpha
|
|
947
|
+
* Configuration for the Autofill call to request the Data Connector intent implemented by the app
|
|
948
|
+
* and skipping the data preview modal.
|
|
949
|
+
*/
|
|
950
|
+
export declare type AutofillDataConnectorNoPreview = {
|
|
951
|
+
dataSelectionDisplay: 'hide';
|
|
952
|
+
dataSourceRef: DataSourceRef;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* @alpha
|
|
957
|
+
* Configuration for the Autofill call to request the Data Connector intent implemented by the app
|
|
958
|
+
* and displaying the data preview modal.
|
|
959
|
+
*/
|
|
960
|
+
export declare type AutofillDataConnectorWithPreview = {
|
|
961
|
+
dataSelectionDisplay: 'show';
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* @alpha
|
|
966
|
+
* Wrapper for the configurations that will query the app owned Data Connector.
|
|
967
|
+
*/
|
|
968
|
+
export declare type AutofillFromDataConnector = {
|
|
969
|
+
type: 'data_connector';
|
|
970
|
+
withDataConnector: 'self';
|
|
971
|
+
limit?: DataTableLimit;
|
|
972
|
+
} & (AutofillDataConnectorWithPreview | AutofillDataConnectorNoPreview);
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* @alpha
|
|
976
|
+
* Configuration for providing a fully populated data table to the Autofill call.
|
|
977
|
+
*/
|
|
978
|
+
export declare type AutofillFromDataTable = {
|
|
979
|
+
type: 'data_table';
|
|
980
|
+
dataTable: DataTable;
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* @alpha
|
|
985
|
+
* A set of options to configure the Autofill call.
|
|
986
|
+
* @param title - an optional title that will be set to the document after Autofill is done.
|
|
987
|
+
*/
|
|
988
|
+
export declare type AutofillOptions = {
|
|
989
|
+
title?: string;
|
|
990
|
+
} & (AutofillFromDataTable | AutofillFromDataConnector);
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* @alpha
|
|
994
|
+
* Response object from the Autofill operation.
|
|
995
|
+
*/
|
|
996
|
+
export declare type AutofillResponse = {
|
|
997
|
+
status: 'success';
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* @public
|
|
1002
|
+
* Cell containing a boolean value.
|
|
1003
|
+
*
|
|
1004
|
+
* @example Creating a boolean cell
|
|
1005
|
+
* ```ts
|
|
1006
|
+
* import type { BooleanDataTableCell } from '@canva/intents/data';
|
|
1007
|
+
*
|
|
1008
|
+
* const isActiveCell: BooleanDataTableCell = {
|
|
1009
|
+
* type: 'boolean',
|
|
1010
|
+
* value: true
|
|
1011
|
+
* };
|
|
1012
|
+
* ```
|
|
1013
|
+
*
|
|
1014
|
+
* @example Creating a boolean cell with false value
|
|
1015
|
+
* ```ts
|
|
1016
|
+
* import type { BooleanDataTableCell } from '@canva/intents/data';
|
|
1017
|
+
*
|
|
1018
|
+
* const isCompleteCell: BooleanDataTableCell = {
|
|
1019
|
+
* type: 'boolean',
|
|
1020
|
+
* value: false
|
|
1021
|
+
* };
|
|
1022
|
+
* ```
|
|
1023
|
+
*
|
|
1024
|
+
* @example Creating an empty boolean cell
|
|
1025
|
+
* ```ts
|
|
1026
|
+
* import type { BooleanDataTableCell } from '@canva/intents/data';
|
|
1027
|
+
*
|
|
1028
|
+
* const emptyBooleanCell: BooleanDataTableCell = {
|
|
1029
|
+
* type: 'boolean',
|
|
1030
|
+
* value: undefined
|
|
1031
|
+
* };
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
declare type BooleanDataTableCell = {
|
|
1035
|
+
/**
|
|
1036
|
+
* Indicates this cell contains a boolean value.
|
|
1037
|
+
*/
|
|
1038
|
+
type: 'boolean';
|
|
1039
|
+
/**
|
|
1040
|
+
* Boolean value (true or false).
|
|
1041
|
+
*
|
|
1042
|
+
* Use `undefined` for an empty cell.
|
|
1043
|
+
*/
|
|
1044
|
+
value: boolean | undefined;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
878
1047
|
/**
|
|
879
1048
|
* @public
|
|
880
1049
|
* A segment of a richtext range.
|
|
@@ -903,6 +1072,23 @@ export declare type Bounds = {
|
|
|
903
1072
|
*/
|
|
904
1073
|
export declare type Box = Point & (WidthAndHeight | Width | Height);
|
|
905
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* @alpha
|
|
1077
|
+
* A unique identifier that references a brand template.
|
|
1078
|
+
*/
|
|
1079
|
+
export declare type BrandTemplateId = string & {
|
|
1080
|
+
__brandTemplateId: never;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* @alpha
|
|
1085
|
+
* Metadata for a brand template.
|
|
1086
|
+
*/
|
|
1087
|
+
export declare type BrandTemplateMetadata = Omit<TemplateMetadata, 'domain'> & {
|
|
1088
|
+
domain: 'brand';
|
|
1089
|
+
dataset?: DataField[];
|
|
1090
|
+
};
|
|
1091
|
+
|
|
906
1092
|
/**
|
|
907
1093
|
* @public
|
|
908
1094
|
* An alias for the BulkCreateLauncher interface, providing access to bulk create related functionality
|
|
@@ -987,6 +1173,26 @@ declare type CellContent = {
|
|
|
987
1173
|
value: string;
|
|
988
1174
|
};
|
|
989
1175
|
|
|
1176
|
+
/**
|
|
1177
|
+
* @public
|
|
1178
|
+
* Configuration for a table column.
|
|
1179
|
+
*/
|
|
1180
|
+
declare type ColumnConfig = {
|
|
1181
|
+
/**
|
|
1182
|
+
* Name for the column, displayed as header text.
|
|
1183
|
+
*
|
|
1184
|
+
* If `undefined`, the column will have no header text.
|
|
1185
|
+
*/
|
|
1186
|
+
name: string | undefined;
|
|
1187
|
+
/**
|
|
1188
|
+
* Expected data type for cells in this column.
|
|
1189
|
+
*
|
|
1190
|
+
* Use a specific `DataType` for columns with consistent types,
|
|
1191
|
+
* or `'variant'` for columns that may contain mixed types.
|
|
1192
|
+
*/
|
|
1193
|
+
type: DataType | 'variant';
|
|
1194
|
+
};
|
|
1195
|
+
|
|
990
1196
|
/**
|
|
991
1197
|
* Image element or content to be added to the design at the end of a drag event.
|
|
992
1198
|
*/
|
|
@@ -1078,7 +1284,7 @@ export declare interface ContentDraft<T> {
|
|
|
1078
1284
|
/**
|
|
1079
1285
|
* @beta
|
|
1080
1286
|
*/
|
|
1081
|
-
|
|
1287
|
+
declare type ContentType = 'richtext' | 'fill';
|
|
1082
1288
|
|
|
1083
1289
|
/**
|
|
1084
1290
|
* @public
|
|
@@ -1193,6 +1399,198 @@ export declare type Coordinates = {
|
|
|
1193
1399
|
*/
|
|
1194
1400
|
export declare const createRichtextRange: () => RichtextRange;
|
|
1195
1401
|
|
|
1402
|
+
/**
|
|
1403
|
+
* @beta
|
|
1404
|
+
* Metadata for a data field in a brand template.
|
|
1405
|
+
*/
|
|
1406
|
+
export declare type DataField = {
|
|
1407
|
+
label: string;
|
|
1408
|
+
type: 'image' | 'text' | 'chart';
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* @alpha
|
|
1413
|
+
* A representation of the data source that is given to the Data Connector.
|
|
1414
|
+
*/
|
|
1415
|
+
export declare type DataSourceRef = {
|
|
1416
|
+
/**
|
|
1417
|
+
* This 'source' will be passed on to the Data Connector intent.
|
|
1418
|
+
*/
|
|
1419
|
+
source: string;
|
|
1420
|
+
title?: string;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* @public
|
|
1425
|
+
* Structured tabular data for import into Canva.
|
|
1426
|
+
*
|
|
1427
|
+
* This format allows you to provide typed data with proper formatting
|
|
1428
|
+
* to ensure it displays correctly in Canva designs.
|
|
1429
|
+
*
|
|
1430
|
+
* @example Creating a data table
|
|
1431
|
+
* ```ts
|
|
1432
|
+
* import type { ColumnConfig, DataTableCell, DataTable, DataTableRow } from '@canva/intents/data';
|
|
1433
|
+
*
|
|
1434
|
+
* const myTable: DataTable = {
|
|
1435
|
+
* columnConfigs: [
|
|
1436
|
+
* { name: 'Name', type: 'string' },
|
|
1437
|
+
* { name: 'Age', type: 'number' },
|
|
1438
|
+
* { name: 'Subscribed', type: 'boolean' },
|
|
1439
|
+
* { name: 'Join Date', type: 'date' }
|
|
1440
|
+
* ],
|
|
1441
|
+
* rows: [
|
|
1442
|
+
* {
|
|
1443
|
+
* cells: [
|
|
1444
|
+
* { type: 'string', value: 'Alice' },
|
|
1445
|
+
* { type: 'number', value: 30 },
|
|
1446
|
+
* { type: 'boolean', value: true },
|
|
1447
|
+
* { type: 'date', value: Math.floor(new Date('2023-01-15').getTime() / 1000) }
|
|
1448
|
+
* ]
|
|
1449
|
+
* },
|
|
1450
|
+
* {
|
|
1451
|
+
* cells: [
|
|
1452
|
+
* { type: 'string', value: 'Bob' },
|
|
1453
|
+
* { type: 'number', value: 24 },
|
|
1454
|
+
* { type: 'boolean', value: false },
|
|
1455
|
+
* { type: 'date', value: Math.floor(new Date('2022-07-20').getTime() / 1000) }
|
|
1456
|
+
* ]
|
|
1457
|
+
* }
|
|
1458
|
+
* ]
|
|
1459
|
+
* };
|
|
1460
|
+
* ```
|
|
1461
|
+
*/
|
|
1462
|
+
declare type DataTable = {
|
|
1463
|
+
/**
|
|
1464
|
+
* Column definitions with names and data types.
|
|
1465
|
+
*
|
|
1466
|
+
* These help Canva interpret and display your data correctly.
|
|
1467
|
+
*/
|
|
1468
|
+
columnConfigs?: ColumnConfig[];
|
|
1469
|
+
/**
|
|
1470
|
+
* The data rows containing the actual values.
|
|
1471
|
+
*
|
|
1472
|
+
* Each row contains an array of cells with typed data values.
|
|
1473
|
+
*/
|
|
1474
|
+
rows: DataTableRow[];
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* @public
|
|
1479
|
+
* Generic type for table cells that resolves to a specific cell type.
|
|
1480
|
+
*/
|
|
1481
|
+
declare type DataTableCell<T extends DataType = DataType> = {
|
|
1482
|
+
date: DateDataTableCell;
|
|
1483
|
+
string: StringDataTableCell;
|
|
1484
|
+
number: NumberDataTableCell;
|
|
1485
|
+
boolean: BooleanDataTableCell;
|
|
1486
|
+
media: MediaCollectionDataTableCell;
|
|
1487
|
+
}[T];
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* @public
|
|
1491
|
+
* Options for uploading an image asset to the user's private media library.
|
|
1492
|
+
*/
|
|
1493
|
+
declare type DataTableImageUpload = Omit<ImageUploadOptions, 'type' | 'parentRef'> & {
|
|
1494
|
+
/**
|
|
1495
|
+
* Indicates this value contains options for image uploading.
|
|
1496
|
+
*/
|
|
1497
|
+
type: 'image_upload';
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* @public
|
|
1502
|
+
* Maximum dimensions for imported data tables.
|
|
1503
|
+
*/
|
|
1504
|
+
declare type DataTableLimit = {
|
|
1505
|
+
/**
|
|
1506
|
+
* The maximum number of rows allowed.
|
|
1507
|
+
*
|
|
1508
|
+
* Your app should ensure data does not exceed this limit.
|
|
1509
|
+
*/
|
|
1510
|
+
row: number;
|
|
1511
|
+
/**
|
|
1512
|
+
* The maximum number of columns allowed.
|
|
1513
|
+
*
|
|
1514
|
+
* Your app should ensure data does not exceed this limit.
|
|
1515
|
+
*/
|
|
1516
|
+
column: number;
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* @public
|
|
1521
|
+
* A row in the data table.
|
|
1522
|
+
*
|
|
1523
|
+
* @example Creating a single row of data cells
|
|
1524
|
+
* ```ts
|
|
1525
|
+
* import type { DataTableCell, DataTableRow } from '@canva/intents/data';
|
|
1526
|
+
*
|
|
1527
|
+
* const row: DataTableRow = {
|
|
1528
|
+
* cells: [
|
|
1529
|
+
* { type: 'string', value: 'Product Alpha' },
|
|
1530
|
+
* { type: 'number', value: 199.99 },
|
|
1531
|
+
* { type: 'boolean', value: true }
|
|
1532
|
+
* ]
|
|
1533
|
+
* };
|
|
1534
|
+
* ```
|
|
1535
|
+
*/
|
|
1536
|
+
declare type DataTableRow = {
|
|
1537
|
+
/**
|
|
1538
|
+
* Array of cells containing the data values.
|
|
1539
|
+
*
|
|
1540
|
+
* Each cell must have a type that matches the corresponding column definition (if provided).
|
|
1541
|
+
*/
|
|
1542
|
+
cells: DataTableCell<DataType>[];
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* @public
|
|
1547
|
+
* Options for uploading a video asset to the user's private media library.
|
|
1548
|
+
*/
|
|
1549
|
+
declare type DataTableVideoUpload = Omit<VideoUploadOptions, 'type' | 'parentRef'> & {
|
|
1550
|
+
/**
|
|
1551
|
+
* Indicates this value contains options for video uploading.
|
|
1552
|
+
*/
|
|
1553
|
+
type: 'video_upload';
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* @public
|
|
1558
|
+
* Data types supported for table cells.
|
|
1559
|
+
*/
|
|
1560
|
+
declare type DataType = 'string' | 'number' | 'date' | 'boolean' | 'media';
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* @public
|
|
1564
|
+
* Cell containing a date value.
|
|
1565
|
+
*
|
|
1566
|
+
* @example Creating a date cell
|
|
1567
|
+
* ```ts
|
|
1568
|
+
* import type { DateDataTableCell } from '@canva/intents/data';
|
|
1569
|
+
*
|
|
1570
|
+
* const todayCell: DateDataTableCell = {
|
|
1571
|
+
* type: 'date',
|
|
1572
|
+
* value: Math.floor(Date.now() / 1000) // Unix timestamp in seconds
|
|
1573
|
+
* };
|
|
1574
|
+
*
|
|
1575
|
+
* const emptyDateCell: DateDataTableCell = {
|
|
1576
|
+
* type: 'date',
|
|
1577
|
+
* value: undefined
|
|
1578
|
+
* };
|
|
1579
|
+
* ```
|
|
1580
|
+
*/
|
|
1581
|
+
declare type DateDataTableCell = {
|
|
1582
|
+
/**
|
|
1583
|
+
* Indicates this cell contains a date value.
|
|
1584
|
+
*/
|
|
1585
|
+
type: 'date';
|
|
1586
|
+
/**
|
|
1587
|
+
* Unix timestamp in seconds representing the date.
|
|
1588
|
+
*
|
|
1589
|
+
* Use `undefined` for an empty cell.
|
|
1590
|
+
*/
|
|
1591
|
+
value: number | undefined;
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1196
1594
|
/**
|
|
1197
1595
|
* @public
|
|
1198
1596
|
* Describes a part of a design.
|
|
@@ -2728,7 +3126,7 @@ export declare type DesignElement = ImageElement | VideoElement | EmbedElement |
|
|
|
2728
3126
|
* @beta
|
|
2729
3127
|
* Information about the design.
|
|
2730
3128
|
*/
|
|
2731
|
-
|
|
3129
|
+
declare type DesignMetadata = {
|
|
2732
3130
|
/**
|
|
2733
3131
|
* The title of the user's design.
|
|
2734
3132
|
* @remarks
|
|
@@ -2756,6 +3154,46 @@ export declare type DesignMetadata = {
|
|
|
2756
3154
|
* This is the precise value, which differs from what is displayed in the UI as duration in Canva UI is formatted differently.
|
|
2757
3155
|
*/
|
|
2758
3156
|
durationInSeconds: number;
|
|
3157
|
+
/**
|
|
3158
|
+
* The set of data fields that were tagged for Autofill.
|
|
3159
|
+
* @remarks
|
|
3160
|
+
* This field might be undefined or empty to represent a design that has no tagged fields.
|
|
3161
|
+
*/
|
|
3162
|
+
dataset?: DataField[];
|
|
3163
|
+
};
|
|
3164
|
+
|
|
3165
|
+
/**
|
|
3166
|
+
* @public
|
|
3167
|
+
* Information about the design.
|
|
3168
|
+
*/
|
|
3169
|
+
declare type DesignMetadata_2 = {
|
|
3170
|
+
/**
|
|
3171
|
+
* The title of the user's design.
|
|
3172
|
+
* @remarks
|
|
3173
|
+
* This is optional and will be `undefined` if the user hasn't set a title.
|
|
3174
|
+
*/
|
|
3175
|
+
title?: string;
|
|
3176
|
+
/**
|
|
3177
|
+
* The default dimensions that a new page will have when it is added to a design.
|
|
3178
|
+
* It is possible for a user to resize a page without resizing the entire design, e.g. by clicking
|
|
3179
|
+
* "Expand to Whiteboard". However, there will always be a single set of default dimensions for a
|
|
3180
|
+
* design that is applied whenever a new page is created.
|
|
3181
|
+
* @remarks
|
|
3182
|
+
* This is optional and will be `undefined` if the design is unbounded (e.g. Whiteboard or Doc).
|
|
3183
|
+
*/
|
|
3184
|
+
defaultPageDimensions?: PageDimensions;
|
|
3185
|
+
/**
|
|
3186
|
+
* The information associated with each page of the design.
|
|
3187
|
+
* @remarks
|
|
3188
|
+
* The order of pages is not guaranteed.
|
|
3189
|
+
*/
|
|
3190
|
+
pageMetadata: Iterable<PageMetadata_2>;
|
|
3191
|
+
/**
|
|
3192
|
+
* The duration of the whole design in seconds.
|
|
3193
|
+
* @remarks
|
|
3194
|
+
* This is the precise value, which differs from what is displayed in the UI as duration in Canva UI is formatted differently.
|
|
3195
|
+
*/
|
|
3196
|
+
durationInSeconds: number;
|
|
2759
3197
|
};
|
|
2760
3198
|
|
|
2761
3199
|
/**
|
|
@@ -2783,12 +3221,6 @@ export declare type DesignOpenAllPagesOptions = {
|
|
|
2783
3221
|
*/
|
|
2784
3222
|
export declare type DesignOpenCallback = (session: DesignEditing.CurrentPageSession) => Promise<void>;
|
|
2785
3223
|
|
|
2786
|
-
/**
|
|
2787
|
-
* @beta
|
|
2788
|
-
* A callback for operating on the design.
|
|
2789
|
-
*/
|
|
2790
|
-
declare type DesignOpenCallback_2 = DesignOpenCurrentPageCallback | DesignOpenAllPagesCallback;
|
|
2791
|
-
|
|
2792
3224
|
/**
|
|
2793
3225
|
* @beta
|
|
2794
3226
|
* A callback for operating on the current page of the design.
|
|
@@ -3092,51 +3524,53 @@ export declare type Dimensions = {
|
|
|
3092
3524
|
|
|
3093
3525
|
/**
|
|
3094
3526
|
* @public
|
|
3095
|
-
*
|
|
3527
|
+
* A set of dimensions.
|
|
3096
3528
|
*/
|
|
3097
|
-
|
|
3098
|
-
|
|
3529
|
+
declare type Dimensions_2 = {
|
|
3530
|
+
/**
|
|
3531
|
+
* A width, in pixels.
|
|
3532
|
+
*/
|
|
3533
|
+
width: number;
|
|
3534
|
+
/**
|
|
3535
|
+
* A height, in pixels.
|
|
3536
|
+
*/
|
|
3537
|
+
height: number;
|
|
3099
3538
|
};
|
|
3100
3539
|
|
|
3101
3540
|
/**
|
|
3102
|
-
* @
|
|
3103
|
-
*
|
|
3104
|
-
* @param options - Options for configuring how a design is read. Must specify `contentType: 'richtext'`.
|
|
3105
|
-
* @param callback - A callback that receives a `RichtextContentSession` for editing.
|
|
3106
|
-
* @returns A promise that resolves when editing is complete.
|
|
3541
|
+
* @public
|
|
3542
|
+
* An event that occurs when a user starts dragging an HTML element.
|
|
3107
3543
|
*/
|
|
3108
|
-
export declare
|
|
3109
|
-
|
|
3110
|
-
}
|
|
3544
|
+
export declare type DragStartEvent<E extends Element> = Pick<DragEvent, 'dataTransfer' | 'currentTarget' | 'preventDefault' | 'clientX' | 'clientY'> & {
|
|
3545
|
+
currentTarget: E;
|
|
3546
|
+
};
|
|
3111
3547
|
|
|
3112
3548
|
/**
|
|
3113
|
-
* @
|
|
3114
|
-
* Reads and edits
|
|
3115
|
-
* @param options - Options for configuring how a design is read.
|
|
3116
|
-
* @param callback - A callback
|
|
3117
|
-
*
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
*
|
|
3125
|
-
*
|
|
3126
|
-
*
|
|
3127
|
-
*
|
|
3128
|
-
*
|
|
3549
|
+
* @public
|
|
3550
|
+
* Reads and edits content of the specified type from the user's design.
|
|
3551
|
+
* @param options - Options for configuring how a design is read.
|
|
3552
|
+
* @param callback - A callback for operating on the read content.
|
|
3553
|
+
*
|
|
3554
|
+
* @example Read richtext content
|
|
3555
|
+
* ```typescript
|
|
3556
|
+
* import { editContent } from "@canva/design";
|
|
3557
|
+
*
|
|
3558
|
+
* await editContent(
|
|
3559
|
+
* { contentType: 'richtext', target: 'current_page' },
|
|
3560
|
+
* async (session) => {
|
|
3561
|
+
* // Do something with the richtext content, e.g. `session.contents`
|
|
3562
|
+
* }
|
|
3563
|
+
* );
|
|
3564
|
+
* ```
|
|
3129
3565
|
*/
|
|
3130
|
-
export declare
|
|
3131
|
-
contentType: T;
|
|
3132
|
-
}, callback: (session: ContentTypeMap[T]) => Promise<void> | void): Promise<void>;
|
|
3566
|
+
export declare const editContent: (options: EditContentOptions_2, callback: EditContentCallback_2) => Promise<void>;
|
|
3133
3567
|
|
|
3134
3568
|
/**
|
|
3135
3569
|
* @beta
|
|
3136
3570
|
* A callback for reading and updating the requested design content.
|
|
3137
3571
|
* @param session - Session for reading and updating content in the design.
|
|
3138
3572
|
*/
|
|
3139
|
-
|
|
3573
|
+
declare type EditContentCallback = (session: RichtextContentSession | FillContentSession) => Promise<void> | void;
|
|
3140
3574
|
|
|
3141
3575
|
/**
|
|
3142
3576
|
* @public
|
|
@@ -3149,7 +3583,7 @@ declare type EditContentCallback_2 = (session: RichtextContentSession) => Promis
|
|
|
3149
3583
|
* @beta
|
|
3150
3584
|
* Options for configuring how the design content is read.
|
|
3151
3585
|
*/
|
|
3152
|
-
|
|
3586
|
+
declare type EditContentOptions = {
|
|
3153
3587
|
/**
|
|
3154
3588
|
* The type of content to edit from the user's design
|
|
3155
3589
|
*/
|
|
@@ -3494,6 +3928,21 @@ export declare type FontRef = string & {
|
|
|
3494
3928
|
**/
|
|
3495
3929
|
export declare type FontWeight = 'normal' | 'thin' | 'extralight' | 'light' | 'medium' | 'semibold' | 'bold' | 'ultrabold' | 'heavy';
|
|
3496
3930
|
|
|
3931
|
+
/**
|
|
3932
|
+
* @alpha
|
|
3933
|
+
* Return metadata for a brand template given its ID.
|
|
3934
|
+
*
|
|
3935
|
+
* @example Get brand template metadata
|
|
3936
|
+
* ```typescript
|
|
3937
|
+
* import { getBrandTemplateMetadata, BrandTemplateId } from "@canva/design";
|
|
3938
|
+
*
|
|
3939
|
+
* const templateId = resolveToken(requestBrandTemplates()) as BrandTemplateId;
|
|
3940
|
+
*
|
|
3941
|
+
* const metadata = await getBrandTemplateMetadata(templateId);
|
|
3942
|
+
* ```
|
|
3943
|
+
*/
|
|
3944
|
+
export declare const getBrandTemplateMetadata: (id: BrandTemplateId) => Promise<BrandTemplateMetadata>;
|
|
3945
|
+
|
|
3497
3946
|
/**
|
|
3498
3947
|
* Allows to get the context of currently selected page.
|
|
3499
3948
|
* @public
|
|
@@ -3564,25 +4013,19 @@ export declare const getCurrentPageContext: () => Promise<PageContext>;
|
|
|
3564
4013
|
export declare const getDefaultPageDimensions: () => Promise<Dimensions | undefined>;
|
|
3565
4014
|
|
|
3566
4015
|
/**
|
|
3567
|
-
* @
|
|
4016
|
+
* @public
|
|
3568
4017
|
* Retrieves information about the design.
|
|
3569
|
-
*/
|
|
3570
|
-
export declare const getDesignMetadata: () => Promise<DesignMetadata>;
|
|
3571
|
-
|
|
3572
|
-
/**
|
|
3573
|
-
* @beta
|
|
3574
|
-
* Retrieves information about the template that was used in a design.
|
|
3575
4018
|
*
|
|
3576
|
-
* @example Get design
|
|
4019
|
+
* @example Get design metadata
|
|
3577
4020
|
* ```typescript
|
|
3578
|
-
* import {
|
|
4021
|
+
* import { getDesignMetadata } from "@canva/design";
|
|
3579
4022
|
*
|
|
3580
|
-
* const
|
|
4023
|
+
* const metadata = await getDesignMetadata();
|
|
3581
4024
|
*
|
|
3582
|
-
* const {
|
|
4025
|
+
* const { title, defaultPageDimensions, pageMetadata, durationInSeconds } = metadata;
|
|
3583
4026
|
* ```
|
|
3584
4027
|
*/
|
|
3585
|
-
export declare const
|
|
4028
|
+
export declare const getDesignMetadata: () => Promise<DesignMetadata_2>;
|
|
3586
4029
|
|
|
3587
4030
|
/**
|
|
3588
4031
|
* @public
|
|
@@ -3742,6 +4185,12 @@ export declare type ImageFill = {
|
|
|
3742
4185
|
altText?: AltText;
|
|
3743
4186
|
};
|
|
3744
4187
|
|
|
4188
|
+
/**
|
|
4189
|
+
* @public
|
|
4190
|
+
* The MIME type of an image file that's supported by Canva's backend.
|
|
4191
|
+
*/
|
|
4192
|
+
declare type ImageMimeType = 'image/jpeg' | 'image/heic' | 'image/png' | 'image/svg+xml' | 'image/webp' | 'image/tiff';
|
|
4193
|
+
|
|
3745
4194
|
/**
|
|
3746
4195
|
* @public
|
|
3747
4196
|
* A unique identifier that references an image asset in Canva's backend.
|
|
@@ -3752,43 +4201,185 @@ export declare type ImageRef = string & {
|
|
|
3752
4201
|
|
|
3753
4202
|
/**
|
|
3754
4203
|
* @public
|
|
4204
|
+
* A unique identifier that points to an image asset in Canva's backend.
|
|
4205
|
+
*/
|
|
4206
|
+
declare type ImageRef_2 = string & {
|
|
4207
|
+
__imageRef: never;
|
|
4208
|
+
};
|
|
4209
|
+
|
|
4210
|
+
/**
|
|
4211
|
+
* @public
|
|
4212
|
+
* Options for uploading an image asset to the user's private media library.
|
|
4213
|
+
*/
|
|
4214
|
+
declare type ImageUploadOptions = {
|
|
4215
|
+
/**
|
|
4216
|
+
* The type of asset.
|
|
4217
|
+
*/
|
|
4218
|
+
type: 'image';
|
|
4219
|
+
/**
|
|
4220
|
+
* A human-readable name for the image asset.
|
|
4221
|
+
*
|
|
4222
|
+
* @remarks
|
|
4223
|
+
* This name is displayed in the user's media library and helps users identify
|
|
4224
|
+
* and find the asset later. If not provided, Canva will generate a name based
|
|
4225
|
+
* on the asset's URL or a unique identifier.
|
|
4226
|
+
*
|
|
4227
|
+
* Requirements:
|
|
4228
|
+
* - Minimum length: 1 character (empty strings are not allowed)
|
|
4229
|
+
* - Maximum length: 255 characters
|
|
4230
|
+
*/
|
|
4231
|
+
name?: string;
|
|
4232
|
+
/**
|
|
4233
|
+
* The ref of the original asset from which this new asset was derived.
|
|
4234
|
+
*
|
|
4235
|
+
* @remarks
|
|
4236
|
+
* For example, if an app applies an effect to an image, `parentRef` should contain the ref of the original image.
|
|
4237
|
+
*/
|
|
4238
|
+
parentRef?: ImageRef_2;
|
|
4239
|
+
/**
|
|
4240
|
+
* The URL of the image file to upload.
|
|
4241
|
+
* This can be an external URL or a data URL.
|
|
4242
|
+
*
|
|
4243
|
+
* @remarks
|
|
4244
|
+
* Requirements for external URLs:
|
|
4245
|
+
*
|
|
4246
|
+
* - Must use HTTPS
|
|
4247
|
+
* - Must return a `200` status code
|
|
4248
|
+
* - `Content-Type` must match the file's MIME type
|
|
4249
|
+
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
4250
|
+
* - Must not redirect
|
|
4251
|
+
* - Must not contain an IP address
|
|
4252
|
+
* - Maximum length: 4096 characters
|
|
4253
|
+
* - Must not contain whitespace
|
|
4254
|
+
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
4255
|
+
* - Maximum file size: 50MB
|
|
4256
|
+
*
|
|
4257
|
+
* Requirements for data URLs:
|
|
4258
|
+
*
|
|
4259
|
+
* - Must include `;base64` for base64-encoded data
|
|
4260
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
4261
|
+
*
|
|
4262
|
+
* Requirements for SVGs:
|
|
4263
|
+
*
|
|
4264
|
+
* - Disallowed elements:
|
|
4265
|
+
* - `a`
|
|
4266
|
+
* - `altglyph`
|
|
4267
|
+
* - `altglyphdef`
|
|
4268
|
+
* - `altglyphitem`
|
|
4269
|
+
* - `animate`
|
|
4270
|
+
* - `animatemotion`
|
|
4271
|
+
* - `animatetransform`
|
|
4272
|
+
* - `cursor`
|
|
4273
|
+
* - `discard`
|
|
4274
|
+
* - `font`
|
|
4275
|
+
* - `font-face`
|
|
4276
|
+
* - `font-face-format`
|
|
4277
|
+
* - `font-face-name`
|
|
4278
|
+
* - `font-face-src`
|
|
4279
|
+
* - `font-face-uri`
|
|
4280
|
+
* - `foreignobject`
|
|
4281
|
+
* - `glyph`
|
|
4282
|
+
* - `glyphref`
|
|
4283
|
+
* - `missing-glyph`
|
|
4284
|
+
* - `mpath`
|
|
4285
|
+
* - `script`
|
|
4286
|
+
* - `set`
|
|
4287
|
+
* - `switch`
|
|
4288
|
+
* - `tref`
|
|
4289
|
+
* - Disallowed attributes:
|
|
4290
|
+
* - `crossorigin`
|
|
4291
|
+
* - `lang`
|
|
4292
|
+
* - `media`
|
|
4293
|
+
* - `onload`
|
|
4294
|
+
* - `ping`
|
|
4295
|
+
* - `referrerpolicy`
|
|
4296
|
+
* - `rel`
|
|
4297
|
+
* - `rendering-intent`
|
|
4298
|
+
* - `requiredextensions`
|
|
4299
|
+
* - `requiredfeatures`
|
|
4300
|
+
* - `systemlanguage`
|
|
4301
|
+
* - `tabindex`
|
|
4302
|
+
* - `transform-origin`
|
|
4303
|
+
* - `unicode`
|
|
4304
|
+
* - `vector-effect`
|
|
4305
|
+
* - The `href` attribute of an `image` element only supports data URLs for PNG and JPEG images.
|
|
4306
|
+
* - The URL in the `href` attribute must not point to a location outside of the SVG.
|
|
4307
|
+
* - The `style` attribute must not use the `mix-blend-mode` property.
|
|
4308
|
+
*/
|
|
4309
|
+
url: string;
|
|
4310
|
+
/**
|
|
4311
|
+
* The MIME type of the image file.
|
|
4312
|
+
*/
|
|
4313
|
+
mimeType: ImageMimeType;
|
|
4314
|
+
/**
|
|
4315
|
+
* The URL of a thumbnail image to display while the image is queued for upload.
|
|
4316
|
+
* This can be an external URL or a data URL.
|
|
4317
|
+
*
|
|
4318
|
+
* @remarks
|
|
4319
|
+
* Requirements for external URLs:
|
|
4320
|
+
*
|
|
4321
|
+
* - Must use HTTPS
|
|
4322
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
4323
|
+
* - Must be a PNG, JPEG, or SVG file
|
|
4324
|
+
* - Maximum length: 4096 characters
|
|
4325
|
+
*
|
|
4326
|
+
* Requirements for data URLs:
|
|
4327
|
+
*
|
|
4328
|
+
* - Must include `;base64` for base64-encoded data
|
|
4329
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
4330
|
+
*/
|
|
4331
|
+
thumbnailUrl: string;
|
|
4332
|
+
/**
|
|
4333
|
+
* A disclosure identifying if the app generated this image using AI
|
|
4334
|
+
*
|
|
4335
|
+
* @remarks
|
|
4336
|
+
* Helps users make informed decisions about the content they interact with.
|
|
4337
|
+
* See {@link AiDisclosure} for the full definition.
|
|
4338
|
+
*
|
|
4339
|
+
* **App Generated**
|
|
4340
|
+
*
|
|
4341
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
4342
|
+
* the app requests a third-party service to take similar action on an image using AI.
|
|
4343
|
+
*
|
|
4344
|
+
* Required for the following cases (this list is not exhaustive):
|
|
4345
|
+
* | Case | Reason |
|
|
4346
|
+
* | -- | -- |
|
|
4347
|
+
* | AI generates a new image from scratch | Creates new creative content |
|
|
4348
|
+
* | AI changes the style of the image e.g. makes it cartoon | Significantly alters the style |
|
|
4349
|
+
* | AI removes an object and replaces it with new content | Creates new creative content |
|
|
4350
|
+
* | AI changes the facial expression of a person in an image | Can alter content's original meaning |
|
|
4351
|
+
* | AI composites multiple images together | Significantly alters context |
|
|
4352
|
+
* | AI expands an image by generating new content to fill the edges | Creates new creative content |
|
|
4353
|
+
* | AI replaces background by generating new content | Creates new creative content |
|
|
4354
|
+
*
|
|
4355
|
+
* **None**
|
|
4356
|
+
*
|
|
4357
|
+
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of a request
|
|
4358
|
+
* to third-party hosted content.
|
|
4359
|
+
*
|
|
4360
|
+
* Required for the following cases (this list is not exhaustive):
|
|
4361
|
+
* | Case | Reason |
|
|
4362
|
+
* | -- | -- |
|
|
4363
|
+
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
4364
|
+
* | AI corrects red eyes | A minor correction |
|
|
4365
|
+
* | AI removes background without replacement | Doesn't change original meaning by itself |
|
|
4366
|
+
* | AI changes the color of an object in an image | Doesn't change original meaning by itself |
|
|
4367
|
+
* | AI detects image defects and suggests manual fixes | Didn't change the asset itself |
|
|
4368
|
+
* | AI adjusts brightness and contrast on an image | Doesn't change original meaning by itself |
|
|
4369
|
+
* | AI upscales an image | Doesn't change original meaning by itself |
|
|
4370
|
+
*/
|
|
4371
|
+
aiDisclosure: AiDisclosure;
|
|
4372
|
+
|
|
4373
|
+
} & AllOrNone<Dimensions_2>;
|
|
4374
|
+
|
|
4375
|
+
/**
|
|
4376
|
+
* @alpha
|
|
3755
4377
|
* @param appElementConfig - Configuration for an AppElementClient
|
|
3756
|
-
*
|
|
3757
|
-
* @example Initialize app element client
|
|
3758
|
-
* ```typescript
|
|
3759
|
-
* import { initAppElement } from "@canva/design";
|
|
3760
|
-
*
|
|
3761
|
-
* const appElement = initAppElement<{ content: string }>({
|
|
3762
|
-
* render: (data) => {
|
|
3763
|
-
* return [{
|
|
3764
|
-
* type: 'text',
|
|
3765
|
-
* children: [data.content],
|
|
3766
|
-
* top: 100,
|
|
3767
|
-
* left: 100,
|
|
3768
|
-
* width: 200
|
|
3769
|
-
* }];
|
|
3770
|
-
* }
|
|
3771
|
-
* });
|
|
3772
|
-
* ```
|
|
3773
|
-
*
|
|
3774
|
-
* @example Initialize V2 app element client
|
|
3775
|
-
* ```typescript
|
|
3776
|
-
* import { initAppElement } from "@canva/design";
|
|
3777
|
-
*
|
|
3778
|
-
* const appElement = initAppElement<{ content: string }>({
|
|
3779
|
-
* render: (data) => {
|
|
3780
|
-
* return [{
|
|
3781
|
-
* type: 'text',
|
|
3782
|
-
* children: [data.content],
|
|
3783
|
-
* top: 100,
|
|
3784
|
-
* left: 100,
|
|
3785
|
-
* width: 200
|
|
3786
|
-
* }];
|
|
3787
|
-
* }
|
|
3788
|
-
* });
|
|
3789
|
-
* ```
|
|
3790
4378
|
*/
|
|
3791
|
-
export declare const initAppElement:
|
|
4379
|
+
export declare const initAppElement: {
|
|
4380
|
+
<A extends AppElementData>(appElementConfig: AppElementClientConfigurationV2<A>): AppElementClient<A>;
|
|
4381
|
+
<A extends AppElementData>(appElementConfig: AppElementClientConfiguration<A>): AppElementClient<A>;
|
|
4382
|
+
};
|
|
3792
4383
|
|
|
3793
4384
|
/**
|
|
3794
4385
|
* @public
|
|
@@ -3857,6 +4448,49 @@ export declare type LaunchPublishOpts = {
|
|
|
3857
4448
|
withContentPublisher: 'self';
|
|
3858
4449
|
};
|
|
3859
4450
|
|
|
4451
|
+
/**
|
|
4452
|
+
* @public
|
|
4453
|
+
* Cell containing a media collection (images) value.
|
|
4454
|
+
*
|
|
4455
|
+
* @example Creating a media cell with an image
|
|
4456
|
+
* ```ts
|
|
4457
|
+
* import type { MediaCollectionDataTableCell } from '@canva/intents/data';
|
|
4458
|
+
*
|
|
4459
|
+
* const mediaCell: MediaCollectionDataTableCell = {
|
|
4460
|
+
* type: 'media',
|
|
4461
|
+
* value: [{
|
|
4462
|
+
* type: 'image_upload',
|
|
4463
|
+
* url: 'https://www.canva.dev/example-assets/image-import/image.jpg',
|
|
4464
|
+
* mimeType: 'image/jpeg',
|
|
4465
|
+
* thumbnailUrl: 'https://www.canva.dev/example-assets/image-import/thumbnail.jpg',
|
|
4466
|
+
* aiDisclosure: 'none'
|
|
4467
|
+
* }]
|
|
4468
|
+
* };
|
|
4469
|
+
* ```
|
|
4470
|
+
*
|
|
4471
|
+
* @example Creating an empty media cell
|
|
4472
|
+
* ```ts
|
|
4473
|
+
* import type { MediaCollectionDataTableCell } from '@canva/intents/data';
|
|
4474
|
+
*
|
|
4475
|
+
* const emptyMediaCell: MediaCollectionDataTableCell = {
|
|
4476
|
+
* type: 'media',
|
|
4477
|
+
* value: []
|
|
4478
|
+
* };
|
|
4479
|
+
* ```
|
|
4480
|
+
*/
|
|
4481
|
+
declare type MediaCollectionDataTableCell = {
|
|
4482
|
+
/**
|
|
4483
|
+
* Indicates this cell contains a media collection.
|
|
4484
|
+
*/
|
|
4485
|
+
type: 'media';
|
|
4486
|
+
/**
|
|
4487
|
+
* Media collection values.
|
|
4488
|
+
*
|
|
4489
|
+
* Use empty array for an empty cell.
|
|
4490
|
+
*/
|
|
4491
|
+
value: (DataTableImageUpload | DataTableVideoUpload)[];
|
|
4492
|
+
};
|
|
4493
|
+
|
|
3860
4494
|
/**
|
|
3861
4495
|
* @deprecated The type has been superseded by `DesignElement`.
|
|
3862
4496
|
* @public
|
|
@@ -3969,22 +4603,130 @@ export declare type NativeVideoElement = VideoElement;
|
|
|
3969
4603
|
*/
|
|
3970
4604
|
export declare type NativeVideoElementWithBox = VideoElementAtPoint;
|
|
3971
4605
|
|
|
4606
|
+
declare type Never<T> = {
|
|
4607
|
+
[key in keyof T]?: never;
|
|
4608
|
+
};
|
|
4609
|
+
|
|
4610
|
+
/**
|
|
4611
|
+
* @public
|
|
4612
|
+
* Formatting metadata for number cells.
|
|
4613
|
+
*
|
|
4614
|
+
* @example Formatting as currency
|
|
4615
|
+
* ```ts
|
|
4616
|
+
* import type { NumberDataTableCell } from '@canva/intents/data';
|
|
4617
|
+
*
|
|
4618
|
+
* const currencyCell: NumberDataTableCell = {
|
|
4619
|
+
* type: 'number',
|
|
4620
|
+
* value: 1234.57,
|
|
4621
|
+
* metadata: { formatting: '[$$]#,##0.00' }
|
|
4622
|
+
* };
|
|
4623
|
+
* ```
|
|
4624
|
+
*
|
|
4625
|
+
* @example Formatting as a percentage
|
|
4626
|
+
* ```ts
|
|
4627
|
+
* import type { NumberDataTableCell } from '@canva/intents/data';
|
|
4628
|
+
*
|
|
4629
|
+
* const percentCell: NumberDataTableCell = {
|
|
4630
|
+
* type: 'number',
|
|
4631
|
+
* value: 0.1234,
|
|
4632
|
+
* metadata: { formatting: '0.00%' }
|
|
4633
|
+
* };
|
|
4634
|
+
* ```
|
|
4635
|
+
*
|
|
4636
|
+
* @example Applying a thousands separator
|
|
4637
|
+
* ```ts
|
|
4638
|
+
* import type { NumberDataTableCell } from '@canva/intents/data';
|
|
4639
|
+
*
|
|
4640
|
+
* const largeNumberCell: NumberDataTableCell = {
|
|
4641
|
+
* type: 'number',
|
|
4642
|
+
* value: 1234567.89234,
|
|
4643
|
+
* metadata: { formatting: '#,##0.00' }
|
|
4644
|
+
* };
|
|
4645
|
+
* ```
|
|
4646
|
+
*/
|
|
4647
|
+
declare type NumberCellMetadata = {
|
|
4648
|
+
/**
|
|
4649
|
+
* Formatting pattern using Office Open XML Format.
|
|
4650
|
+
*
|
|
4651
|
+
* These patterns control how numbers are displayed to users,
|
|
4652
|
+
* including currency symbols, decimal places, and separators.
|
|
4653
|
+
*/
|
|
4654
|
+
formatting?: string;
|
|
4655
|
+
};
|
|
4656
|
+
|
|
4657
|
+
/**
|
|
4658
|
+
* @public
|
|
4659
|
+
* Cell containing a numeric value.
|
|
4660
|
+
*
|
|
4661
|
+
* @example Creating a number cell
|
|
4662
|
+
* ```ts
|
|
4663
|
+
* import type { NumberCellMetadata, NumberDataTableCell } from '@canva/intents/data';
|
|
4664
|
+
*
|
|
4665
|
+
* const priceCell: NumberDataTableCell = {
|
|
4666
|
+
* type: 'number',
|
|
4667
|
+
* value: 29.99,
|
|
4668
|
+
* metadata: { formatting: '[$$]#,##0.00' }
|
|
4669
|
+
* };
|
|
4670
|
+
*
|
|
4671
|
+
* const quantityCell: NumberDataTableCell = {
|
|
4672
|
+
* type: 'number',
|
|
4673
|
+
* value: 150
|
|
4674
|
+
* };
|
|
4675
|
+
*
|
|
4676
|
+
* const emptyNumberCell: NumberDataTableCell = {
|
|
4677
|
+
* type: 'number',
|
|
4678
|
+
* value: undefined
|
|
4679
|
+
* };
|
|
4680
|
+
* ```
|
|
4681
|
+
*/
|
|
4682
|
+
declare type NumberDataTableCell = {
|
|
4683
|
+
/**
|
|
4684
|
+
* Indicates this cell contains a number value.
|
|
4685
|
+
*/
|
|
4686
|
+
type: 'number';
|
|
4687
|
+
/**
|
|
4688
|
+
* Numeric value within safe integer range.
|
|
4689
|
+
*
|
|
4690
|
+
* Valid range: `Number.MIN_SAFE_INTEGER` to `Number.MAX_SAFE_INTEGER`
|
|
4691
|
+
*
|
|
4692
|
+
* Invalid values:
|
|
4693
|
+
*
|
|
4694
|
+
* - Infinity or -Infinity
|
|
4695
|
+
* - NaN
|
|
4696
|
+
* - Negative zero (-0)
|
|
4697
|
+
* - Denormalized numbers
|
|
4698
|
+
*
|
|
4699
|
+
* Use `undefined` for an empty cell.
|
|
4700
|
+
*/
|
|
4701
|
+
value: number | undefined;
|
|
4702
|
+
/**
|
|
4703
|
+
* Optional formatting information for displaying the number.
|
|
4704
|
+
*
|
|
4705
|
+
* @example Applying display formatting to a number
|
|
4706
|
+
* ```ts
|
|
4707
|
+
* import type { NumberCellMetadata } from '@canva/intents/data';
|
|
4708
|
+
*
|
|
4709
|
+
* const currencyFormatting: NumberCellMetadata = { formatting: '[$USD]#,##0.00' };
|
|
4710
|
+
* const percentageFormatting: NumberCellMetadata = { formatting: '0.00%' };
|
|
4711
|
+
* ```
|
|
4712
|
+
*/
|
|
4713
|
+
metadata?: NumberCellMetadata;
|
|
4714
|
+
};
|
|
4715
|
+
|
|
3972
4716
|
/**
|
|
3973
4717
|
* An object primitive data type that can be used in app element data.
|
|
3974
4718
|
*/
|
|
3975
4719
|
declare type ObjectPrimitive = Boolean | String;
|
|
3976
4720
|
|
|
3977
4721
|
/**
|
|
3978
|
-
* @
|
|
3979
|
-
*
|
|
4722
|
+
* @public
|
|
4723
|
+
*
|
|
4724
|
+
* Reads a specified part of the user's design and returns all elements in that part.
|
|
4725
|
+
*
|
|
3980
4726
|
* @param options - Options for configuring how the design is read.
|
|
3981
4727
|
* @param callback - A callback for operating on the design.
|
|
3982
4728
|
*/
|
|
3983
|
-
export declare const openDesign:
|
|
3984
|
-
(options: DesignOpenCurrentPageOptions, callback: DesignOpenCurrentPageCallback): Promise<void>;
|
|
3985
|
-
(options: DesignOpenAllPagesOptions, callback: DesignOpenAllPagesCallback): Promise<void>;
|
|
3986
|
-
(options: DesignOpenOptions_2, callback: DesignOpenCallback_2): Promise<void>;
|
|
3987
|
-
};
|
|
4729
|
+
export declare const openDesign: (options: DesignOpenOptions, callback: DesignOpenCallback) => Promise<void>;
|
|
3988
4730
|
|
|
3989
4731
|
/**
|
|
3990
4732
|
* @public
|
|
@@ -4081,7 +4823,23 @@ export declare type PageDimensions = {
|
|
|
4081
4823
|
* @beta
|
|
4082
4824
|
* Information about a page within a design.
|
|
4083
4825
|
*/
|
|
4084
|
-
|
|
4826
|
+
declare type PageMetadata = AbsolutePageMetadata | UnsupportedPageMetadata;
|
|
4827
|
+
|
|
4828
|
+
/**
|
|
4829
|
+
* @public
|
|
4830
|
+
* Information about a page.
|
|
4831
|
+
*/
|
|
4832
|
+
declare type PageMetadata_2 = {
|
|
4833
|
+
|
|
4834
|
+
/**
|
|
4835
|
+
*
|
|
4836
|
+
* The dimensions of the page, in pixels.
|
|
4837
|
+
*
|
|
4838
|
+
* @remarks
|
|
4839
|
+
* This may be `undefined` because some types of pages don't have dimensions, such as whiteboards.
|
|
4840
|
+
*/
|
|
4841
|
+
dimensions?: PageDimensions;
|
|
4842
|
+
};
|
|
4085
4843
|
|
|
4086
4844
|
/**
|
|
4087
4845
|
* @public
|
|
@@ -4188,6 +4946,106 @@ export declare type PublishLauncher = {
|
|
|
4188
4946
|
launch(opts: LaunchPublishOpts): Promise<void>;
|
|
4189
4947
|
};
|
|
4190
4948
|
|
|
4949
|
+
/**
|
|
4950
|
+
* @alpha
|
|
4951
|
+
* Requests the Autofill flow to start of the given options. The flow can request data from the app
|
|
4952
|
+
* owned Data Connector, or use any given data that is passed in the options object.
|
|
4953
|
+
*
|
|
4954
|
+
* @param opts - The configuration options for this Autofill flow.
|
|
4955
|
+
*
|
|
4956
|
+
* @example Basic usage - Open data connector preview dialog to request data
|
|
4957
|
+
* ```typescript
|
|
4958
|
+
* import { requestAutofillDesign } from "@canva/design";
|
|
4959
|
+
* import type { AutofillOptions } from "@canva/design";
|
|
4960
|
+
*
|
|
4961
|
+
* const opts: AutofillOptions = {
|
|
4962
|
+
* title: 'Updated design',
|
|
4963
|
+
* type: 'data_connector',
|
|
4964
|
+
* dataSelectionDisplay: 'show',
|
|
4965
|
+
* };
|
|
4966
|
+
*
|
|
4967
|
+
* const response = await requestAutofillDesign(element);
|
|
4968
|
+
* ```
|
|
4969
|
+
*
|
|
4970
|
+
* @example Basic usage - Request data from the data connector without preview
|
|
4971
|
+
* ```typescript
|
|
4972
|
+
* import { requestAutofillDesign } from "@canva/design";
|
|
4973
|
+
* import type { AutofillOptions } from "@canva/design";
|
|
4974
|
+
*
|
|
4975
|
+
* const opts: AutofillOptions = {
|
|
4976
|
+
* title: 'Updated design',
|
|
4977
|
+
* type: 'data_connector',
|
|
4978
|
+
* dataSelectionDisplay: 'hide',
|
|
4979
|
+
* dataSourceRef: { source: 'serialized_content' }
|
|
4980
|
+
* };
|
|
4981
|
+
*
|
|
4982
|
+
* const response = await requestAutofillDesign(element);
|
|
4983
|
+
* ```
|
|
4984
|
+
*
|
|
4985
|
+
* @example Basic usage - Use the data given in the options
|
|
4986
|
+
* ```typescript
|
|
4987
|
+
* import { requestAutofillDesign } from "@canva/design";
|
|
4988
|
+
* import type { AutofillOptions } from "@canva/design";
|
|
4989
|
+
*
|
|
4990
|
+
* const opts: AutofillOptions = {
|
|
4991
|
+
* title: 'Updated design',
|
|
4992
|
+
* type: 'data_table',
|
|
4993
|
+
* dataTable: // Set the data table containing the data entries for each field.
|
|
4994
|
+
* };
|
|
4995
|
+
*
|
|
4996
|
+
* const response = await requestAutofillDesign(element);
|
|
4997
|
+
* ```
|
|
4998
|
+
*/
|
|
4999
|
+
export declare const requestAutofillDesign: (opts: AutofillOptions) => Promise<AutofillResponse>;
|
|
5000
|
+
|
|
5001
|
+
/**
|
|
5002
|
+
* @alpha
|
|
5003
|
+
* Trigger brand template selection panel and returns the selected template token.
|
|
5004
|
+
*
|
|
5005
|
+
* @example Request brand templates
|
|
5006
|
+
* ```typescript
|
|
5007
|
+
* import { requestBrandTemplates } from "@canva/design";
|
|
5008
|
+
*
|
|
5009
|
+
* const response = await requestBrandTemplates();
|
|
5010
|
+
*
|
|
5011
|
+
* if (response.status === 'aborted') return;
|
|
5012
|
+
*
|
|
5013
|
+
* const { token } = response.brandTemplates[0];
|
|
5014
|
+
* ```
|
|
5015
|
+
*/
|
|
5016
|
+
export declare const requestBrandTemplates: () => Promise<RequestBrandTemplatesResponse>;
|
|
5017
|
+
|
|
5018
|
+
/**
|
|
5019
|
+
* @alpha
|
|
5020
|
+
* Response object from the RequestBrandTemplate operation.
|
|
5021
|
+
*/
|
|
5022
|
+
export declare type RequestBrandTemplatesResponse = RequestBrandTemplatesResponseCompleted | RequestBrandTemplatesResponseAborted;
|
|
5023
|
+
|
|
5024
|
+
/**
|
|
5025
|
+
* @alpha
|
|
5026
|
+
* Response object from the RequestBrandTemplate operation that was aborted.
|
|
5027
|
+
*/
|
|
5028
|
+
export declare type RequestBrandTemplatesResponseAborted = {
|
|
5029
|
+
status: 'aborted';
|
|
5030
|
+
};
|
|
5031
|
+
|
|
5032
|
+
/**
|
|
5033
|
+
* @alpha
|
|
5034
|
+
* Response object from the RequestBrandTemplate operation completed successfully.
|
|
5035
|
+
*/
|
|
5036
|
+
export declare type RequestBrandTemplatesResponseCompleted = {
|
|
5037
|
+
status: 'completed';
|
|
5038
|
+
brandTemplates: RequestBrandTemplatesResponseContent[];
|
|
5039
|
+
};
|
|
5040
|
+
|
|
5041
|
+
/**
|
|
5042
|
+
* @alpha
|
|
5043
|
+
* Response object from the RequestBrandTemplate operation completed successfully.
|
|
5044
|
+
*/
|
|
5045
|
+
export declare type RequestBrandTemplatesResponseContent = {
|
|
5046
|
+
token: string;
|
|
5047
|
+
};
|
|
5048
|
+
|
|
4191
5049
|
/**
|
|
4192
5050
|
* @public
|
|
4193
5051
|
* Exports the user's design as one or more static files.
|
|
@@ -4966,6 +5824,40 @@ export declare type ShapeViewBox = {
|
|
|
4966
5824
|
height: number;
|
|
4967
5825
|
};
|
|
4968
5826
|
|
|
5827
|
+
/**
|
|
5828
|
+
* @public
|
|
5829
|
+
* Cell containing a text value.
|
|
5830
|
+
*
|
|
5831
|
+
* @example Creating a string cell
|
|
5832
|
+
* ```ts
|
|
5833
|
+
* import type { StringDataTableCell } from '@canva/intents/data';
|
|
5834
|
+
*
|
|
5835
|
+
* const nameCell: StringDataTableCell = {
|
|
5836
|
+
* type: 'string',
|
|
5837
|
+
* value: 'John Doe'
|
|
5838
|
+
* };
|
|
5839
|
+
*
|
|
5840
|
+
* const emptyStringCell: StringDataTableCell = {
|
|
5841
|
+
* type: 'string',
|
|
5842
|
+
* value: undefined
|
|
5843
|
+
* };
|
|
5844
|
+
* ```
|
|
5845
|
+
*/
|
|
5846
|
+
declare type StringDataTableCell = {
|
|
5847
|
+
/**
|
|
5848
|
+
* Indicates this cell contains a string value.
|
|
5849
|
+
*/
|
|
5850
|
+
type: 'string';
|
|
5851
|
+
/**
|
|
5852
|
+
* Text content of the cell.
|
|
5853
|
+
*
|
|
5854
|
+
* Maximum length: 10,000 characters
|
|
5855
|
+
*
|
|
5856
|
+
* Use `undefined` for an empty cell.
|
|
5857
|
+
*/
|
|
5858
|
+
value: string | undefined;
|
|
5859
|
+
};
|
|
5860
|
+
|
|
4969
5861
|
/**
|
|
4970
5862
|
* @public
|
|
4971
5863
|
* An element that renders a table.
|
|
@@ -5192,7 +6084,7 @@ export declare const ui: UI;
|
|
|
5192
6084
|
* @beta
|
|
5193
6085
|
* Pages that do not have fixed or unbounded dimensions currently do not return metadata.
|
|
5194
6086
|
*/
|
|
5195
|
-
|
|
6087
|
+
declare type UnsupportedPageMetadata = {
|
|
5196
6088
|
/**
|
|
5197
6089
|
* The type of page.
|
|
5198
6090
|
*/
|
|
@@ -5296,6 +6188,16 @@ export declare type VideoFill = {
|
|
|
5296
6188
|
altText?: AltText;
|
|
5297
6189
|
};
|
|
5298
6190
|
|
|
6191
|
+
/**
|
|
6192
|
+
* @public
|
|
6193
|
+
* The MIME type of a video file that's supported by Canva's backend.
|
|
6194
|
+
*
|
|
6195
|
+
* @remarks
|
|
6196
|
+
* - GIFs are treated as videos, not images.
|
|
6197
|
+
* - `"application/json"` is only used for Lottie files.
|
|
6198
|
+
*/
|
|
6199
|
+
declare type VideoMimeType = 'video/avi' | 'video/x-msvideo' | 'image/gif' | 'video/x-m4v' | 'video/x-matroska' | 'video/quicktime' | 'video/mp4' | 'video/mpeg' | 'video/webm' | 'application/json';
|
|
6200
|
+
|
|
5299
6201
|
/**
|
|
5300
6202
|
* @public
|
|
5301
6203
|
* A unique identifier that references a video asset in Canva's backend.
|
|
@@ -5304,6 +6206,138 @@ export declare type VideoRef = string & {
|
|
|
5304
6206
|
__videoRef: never;
|
|
5305
6207
|
};
|
|
5306
6208
|
|
|
6209
|
+
/**
|
|
6210
|
+
* @public
|
|
6211
|
+
* A unique identifier that points to a video asset in Canva's backend.
|
|
6212
|
+
*/
|
|
6213
|
+
declare type VideoRef_2 = string & {
|
|
6214
|
+
__videoRef: never;
|
|
6215
|
+
};
|
|
6216
|
+
|
|
6217
|
+
/**
|
|
6218
|
+
* @public
|
|
6219
|
+
* Options for uploading a video asset to the user's private media library.
|
|
6220
|
+
*/
|
|
6221
|
+
declare type VideoUploadOptions = {
|
|
6222
|
+
/**
|
|
6223
|
+
* The type of asset.
|
|
6224
|
+
*/
|
|
6225
|
+
type: 'video';
|
|
6226
|
+
/**
|
|
6227
|
+
* A human-readable name for the video asset.
|
|
6228
|
+
*
|
|
6229
|
+
* @remarks
|
|
6230
|
+
* This name is displayed in the user's media library and helps users identify
|
|
6231
|
+
* and find the asset later. If not provided, Canva will generate a name based
|
|
6232
|
+
* on the asset's URL or a unique identifier.
|
|
6233
|
+
*
|
|
6234
|
+
* Requirements:
|
|
6235
|
+
* - Minimum length: 1 character (empty strings are not allowed)
|
|
6236
|
+
* - Maximum length: 255 characters
|
|
6237
|
+
*/
|
|
6238
|
+
name?: string;
|
|
6239
|
+
/**
|
|
6240
|
+
* The ref of the original asset from which this new asset was derived.
|
|
6241
|
+
*
|
|
6242
|
+
* @remarks
|
|
6243
|
+
* For example, if an app applies an effect to a video, `parentRef` should contain the ref of the original video.
|
|
6244
|
+
*/
|
|
6245
|
+
parentRef?: VideoRef_2;
|
|
6246
|
+
/**
|
|
6247
|
+
* The URL of the video file to upload.
|
|
6248
|
+
*
|
|
6249
|
+
* @remarks
|
|
6250
|
+
* Requirements:
|
|
6251
|
+
*
|
|
6252
|
+
* - Must use HTTPS
|
|
6253
|
+
* - Must return a `200` status code
|
|
6254
|
+
* - `Content-Type` must match the file's MIME type
|
|
6255
|
+
* - Must be publicly accessible (i.e. not a localhost URL)
|
|
6256
|
+
* - Must not redirect
|
|
6257
|
+
* - Must not contain an IP address
|
|
6258
|
+
* - Maximum length: 4096 characters
|
|
6259
|
+
* - Must not contain whitespace
|
|
6260
|
+
* - Must not contain these characters: `>`, `<`, `{`, `}`, `^`, backticks
|
|
6261
|
+
* - Maximum file size: 1000MB (1GB)
|
|
6262
|
+
*/
|
|
6263
|
+
url: string;
|
|
6264
|
+
/**
|
|
6265
|
+
* The MIME type of the video file.
|
|
6266
|
+
*/
|
|
6267
|
+
mimeType: VideoMimeType;
|
|
6268
|
+
/**
|
|
6269
|
+
* The URL of a thumbnail video to display while the video is queued for upload.
|
|
6270
|
+
*
|
|
6271
|
+
* @remarks
|
|
6272
|
+
* Requirements:
|
|
6273
|
+
*
|
|
6274
|
+
* - Must use HTTPS
|
|
6275
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6276
|
+
* - Maximum length: 4096 characters
|
|
6277
|
+
* - The dimensions of the thumbnail video must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6278
|
+
* - Must not be an AVI file. Although our APIs support uploading AVI videos, Canva can't preview them because of native support of browsers
|
|
6279
|
+
*/
|
|
6280
|
+
thumbnailVideoUrl?: string;
|
|
6281
|
+
/**
|
|
6282
|
+
* The URL of a thumbnail image to use as a fallback if `thumbnailVideoUrl` isn't provided.
|
|
6283
|
+
* This can be an external URL or a data URL.
|
|
6284
|
+
*
|
|
6285
|
+
* @remarks
|
|
6286
|
+
* Requirements for external URLs:
|
|
6287
|
+
*
|
|
6288
|
+
* - Must use HTTPS
|
|
6289
|
+
* - Must support [Cross-Origin Resource Sharing](https://www.canva.dev/docs/apps/cross-origin-resource-sharing/)
|
|
6290
|
+
* - Must be a PNG, JPEG, or SVG file
|
|
6291
|
+
* - Maximum length: 4096 characters
|
|
6292
|
+
*
|
|
6293
|
+
* Requirements for data URLs:
|
|
6294
|
+
*
|
|
6295
|
+
* - Must include `;base64` for base64-encoded data
|
|
6296
|
+
* - Maximum size: 10MB (10 × 1024 × 1024 characters)
|
|
6297
|
+
* - The dimensions of the thumbnail must match the video's aspect ratio to prevent the thumbnail from appearing squashed or stretched
|
|
6298
|
+
*/
|
|
6299
|
+
thumbnailImageUrl: string;
|
|
6300
|
+
/**
|
|
6301
|
+
* A disclosure identifying if the app generated this video using AI.
|
|
6302
|
+
*
|
|
6303
|
+
* @remarks
|
|
6304
|
+
* Helps users make informed decisions about the content they interact with.
|
|
6305
|
+
* See {@link AiDisclosure} for the full definition.
|
|
6306
|
+
*
|
|
6307
|
+
* **App Generated**
|
|
6308
|
+
*
|
|
6309
|
+
* 'app_generated' indicates when the app creates or significantly alters an asset using AI. Includes when
|
|
6310
|
+
* the app requests a third-party service to take similar action on a video using AI.
|
|
6311
|
+
*
|
|
6312
|
+
* Required for the following cases (this list is not exhaustive):
|
|
6313
|
+
* | Case | Reason |
|
|
6314
|
+
* | -- | -- |
|
|
6315
|
+
* | AI generates a new video from scratch | Creates new creative content |
|
|
6316
|
+
* | AI changes the style of the video e.g. makes it cartoon | Significantly alters the style |
|
|
6317
|
+
* | AI adds subtitles that rely on subjective interpretation | Creates new creative content |
|
|
6318
|
+
* | AI expands a video by generating new content to fill the edges | Creates new creative content |
|
|
6319
|
+
* | AI animates an image | Creates new creative content |
|
|
6320
|
+
* | AI fixes defects e.g. blur in a video by generating details | Creates new creative content |
|
|
6321
|
+
* | AI generates a talking head presenter | Creates new creative content |
|
|
6322
|
+
*
|
|
6323
|
+
* **None**
|
|
6324
|
+
*
|
|
6325
|
+
* 'none' indicates when the app doesn't create or significantly alter an asset using AI, or as a part of
|
|
6326
|
+
* a request to third-party hosted content.
|
|
6327
|
+
*
|
|
6328
|
+
* Required for the following cases (this list is not exhaustive):
|
|
6329
|
+
* | Case | Reason |
|
|
6330
|
+
* | -- | -- |
|
|
6331
|
+
* | Asset comes from an asset library | Didn't generate the asset itself |
|
|
6332
|
+
* | AI corrects red eyes | A minor correction |
|
|
6333
|
+
* | AI adjusts brightness and contrast on a video | Doesn't change original meaning by itself |
|
|
6334
|
+
* | AI creates a slow motion effect in a video | Doesn't change original meaning by itself |
|
|
6335
|
+
* | AI adds AI word-by-word transcribed subtitles to a video | Doesn't change original meaning by itself |
|
|
6336
|
+
*/
|
|
6337
|
+
aiDisclosure: AiDisclosure;
|
|
6338
|
+
|
|
6339
|
+
} & AllOrNone<Dimensions_2>;
|
|
6340
|
+
|
|
5307
6341
|
/**
|
|
5308
6342
|
* A set of dimensions with an auto-calculated height.
|
|
5309
6343
|
*/
|