@canva/intents 2.5.1-beta.1 → 2.5.1-beta.2
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 +8 -0
- package/beta.d.ts +225 -8
- package/content/beta.d.ts +231 -26
- package/lib/cjs/sdk/intents/content/beta.js +7 -0
- package/lib/cjs/sdk/intents/version.js +1 -1
- package/lib/esm/sdk/intents/content/beta.js +1 -0
- package/lib/esm/sdk/intents/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.5.1-beta.2 - 2026-05-28
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add multi-page document preview support to Content Publisher
|
|
8
|
+
- Add optional `contentNoun` on Content Publisher `OutputType` so apps can describe what kind of content is published (for example post, email, or publication) and Canva can tailor publish-flow UX accordingly. When omitted, behavior defaults to generic `content`.
|
|
9
|
+
- Add `getContentSummary` action to the Content Publisher
|
|
10
|
+
|
|
3
11
|
## 2.5.1-beta.1 - 2026-05-12
|
|
4
12
|
|
|
5
13
|
### Added
|
package/beta.d.ts
CHANGED
|
@@ -185,6 +185,18 @@ declare type AppErrorInvocationContext = {
|
|
|
185
185
|
message?: string;
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @beta
|
|
190
|
+
* Content summary for file-destination apps (e.g. Google Drive, Dropbox).
|
|
191
|
+
*/
|
|
192
|
+
declare type AssetContentSummary = BaseContentSummary & {
|
|
193
|
+
type: 'asset';
|
|
194
|
+
/** Asset title or filename. */
|
|
195
|
+
title: string;
|
|
196
|
+
/** Folder path (e.g. "/My Projects/Designs"). */
|
|
197
|
+
path?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
188
200
|
/**
|
|
189
201
|
* @beta
|
|
190
202
|
* Base interface for AI content requests.
|
|
@@ -210,6 +222,20 @@ declare type BaseAiContentRequest = {
|
|
|
210
222
|
fieldLabel: string;
|
|
211
223
|
};
|
|
212
224
|
|
|
225
|
+
/**
|
|
226
|
+
* @beta
|
|
227
|
+
* Base fields shared by all content summary variants.
|
|
228
|
+
*/
|
|
229
|
+
declare type BaseContentSummary = {
|
|
230
|
+
/**
|
|
231
|
+
* The account, page, or list this post was published to.
|
|
232
|
+
*
|
|
233
|
+
* For example, a Facebook Page, a mailing list, or a personal profile.
|
|
234
|
+
* Use the connected account's display name and icon when there is no distinct destination.
|
|
235
|
+
*/
|
|
236
|
+
destination: Destination;
|
|
237
|
+
};
|
|
238
|
+
|
|
213
239
|
/**
|
|
214
240
|
* @public
|
|
215
241
|
* Base file requirement interface.
|
|
@@ -352,12 +378,6 @@ declare namespace content {
|
|
|
352
378
|
prepareContentPublisher,
|
|
353
379
|
Disposer,
|
|
354
380
|
PublishContentRequest,
|
|
355
|
-
Preview,
|
|
356
|
-
PreviewMedia,
|
|
357
|
-
RenderPreviewUiInvocationContext,
|
|
358
|
-
PublishPreviewUiInvocationContext,
|
|
359
|
-
RenderPreviewUiRequest,
|
|
360
|
-
ContentPublisherIntent,
|
|
361
381
|
RenderSettingsUiInvocationContext,
|
|
362
382
|
PublishSettingsUiInvocationContext,
|
|
363
383
|
RenderSettingsUiRequest,
|
|
@@ -369,6 +389,7 @@ declare namespace content {
|
|
|
369
389
|
PublishError,
|
|
370
390
|
PublishSettings,
|
|
371
391
|
PublishRefValidityState,
|
|
392
|
+
ContentNoun,
|
|
372
393
|
UpdatePublishSettingsResponse,
|
|
373
394
|
UpdatePublishSettingsCompleted,
|
|
374
395
|
PublishContentResponse,
|
|
@@ -404,9 +425,11 @@ declare namespace content {
|
|
|
404
425
|
MaxValueRange,
|
|
405
426
|
MinMaxValueRange,
|
|
406
427
|
ValueRange,
|
|
407
|
-
DocumentPreview,
|
|
408
428
|
DocumentPreviewLoading,
|
|
409
429
|
DocumentPreviewThumbnail,
|
|
430
|
+
DocumentPreviewUpgrading,
|
|
431
|
+
DocumentPreviewReady,
|
|
432
|
+
DocumentPreviewPage,
|
|
410
433
|
DocumentPreviewError,
|
|
411
434
|
ImagePreview,
|
|
412
435
|
ImagePreviewLoading,
|
|
@@ -443,7 +466,23 @@ declare namespace content {
|
|
|
443
466
|
AiContentCompletedResponse,
|
|
444
467
|
AiContentCancelledResponse,
|
|
445
468
|
AiContentResponse,
|
|
446
|
-
RequestAiContent
|
|
469
|
+
RequestAiContent,
|
|
470
|
+
Destination,
|
|
471
|
+
PostContentSummary,
|
|
472
|
+
EmailContentSummary,
|
|
473
|
+
AssetContentSummary,
|
|
474
|
+
GenericContentSummary,
|
|
475
|
+
ContentSummary,
|
|
476
|
+
GetContentSummaryCompleted,
|
|
477
|
+
GetContentSummaryError,
|
|
478
|
+
GetContentSummaryResponse,
|
|
479
|
+
DocumentPreview,
|
|
480
|
+
Preview,
|
|
481
|
+
PreviewMedia,
|
|
482
|
+
RenderPreviewUiInvocationContext,
|
|
483
|
+
PublishPreviewUiInvocationContext,
|
|
484
|
+
RenderPreviewUiRequest,
|
|
485
|
+
ContentPublisherIntent
|
|
447
486
|
}
|
|
448
487
|
}
|
|
449
488
|
export { content }
|
|
@@ -454,6 +493,13 @@ export { content }
|
|
|
454
493
|
*/
|
|
455
494
|
declare type ContentMetadata = DesignContentMetadata;
|
|
456
495
|
|
|
496
|
+
/**
|
|
497
|
+
* @beta
|
|
498
|
+
* Describes what kind of content an output type produces. Canva uses this to tailor and improve
|
|
499
|
+
* the publish experience.
|
|
500
|
+
*/
|
|
501
|
+
declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content';
|
|
502
|
+
|
|
457
503
|
/**
|
|
458
504
|
* @public
|
|
459
505
|
* Main interface for implementing the ContentPublisher intent.
|
|
@@ -623,8 +669,31 @@ declare type ContentPublisherIntent = {
|
|
|
623
669
|
*/
|
|
624
670
|
publishContent: (request: PublishContentRequest) => Promise<PublishContentResponse>;
|
|
625
671
|
|
|
672
|
+
/**
|
|
673
|
+
* @beta
|
|
674
|
+
* Extracts a structured summary of the post's content for historical display.
|
|
675
|
+
*
|
|
676
|
+
* Called at `createPost` / `updatePost` time while the app is loaded. The returned
|
|
677
|
+
* snapshot is stored with the post and used to render historical post views in the
|
|
678
|
+
* content planner (calendar, list views, insights) without re-invoking the app.
|
|
679
|
+
*
|
|
680
|
+
* The snapshot is frozen at write time — it reflects what was published, not the
|
|
681
|
+
* app's current rendering logic. If the app's payload shape or output types change
|
|
682
|
+
* later, historical views remain accurate.
|
|
683
|
+
*
|
|
684
|
+
* @param request - The `publishRef` and `outputType` for the post being published.
|
|
685
|
+
* @returns A promise resolving to the `ContentSummary`, or an error.
|
|
686
|
+
*/
|
|
687
|
+
getContentSummary?: (request: GetContentSummaryRequest) => Promise<GetContentSummaryResponse>;
|
|
626
688
|
};
|
|
627
689
|
|
|
690
|
+
/**
|
|
691
|
+
* @beta
|
|
692
|
+
* A structured snapshot of a post's content for historical display.
|
|
693
|
+
* Discriminated by `type`.
|
|
694
|
+
*/
|
|
695
|
+
declare type ContentSummary = PostContentSummary | EmailContentSummary | AssetContentSummary | GenericContentSummary;
|
|
696
|
+
|
|
628
697
|
declare namespace data {
|
|
629
698
|
export {
|
|
630
699
|
prepareDataConnector,
|
|
@@ -1045,6 +1114,17 @@ declare type DesignEditorIntent = {
|
|
|
1045
1114
|
render: () => void;
|
|
1046
1115
|
};
|
|
1047
1116
|
|
|
1117
|
+
/**
|
|
1118
|
+
* @beta
|
|
1119
|
+
* The publishing destination when distinct from the connected account.
|
|
1120
|
+
*/
|
|
1121
|
+
declare type Destination = {
|
|
1122
|
+
/** User-facing name (e.g. "Bob's Cool Page", "Product Newsletter"). */
|
|
1123
|
+
displayName: string;
|
|
1124
|
+
/** Avatar or icon URL for the destination. */
|
|
1125
|
+
iconUrl?: string;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1048
1128
|
/**
|
|
1049
1129
|
* @public
|
|
1050
1130
|
* A set of dimensions.
|
|
@@ -1110,6 +1190,43 @@ declare interface DocumentPreviewLoading extends SizedPreview {
|
|
|
1110
1190
|
status: 'loading';
|
|
1111
1191
|
}
|
|
1112
1192
|
|
|
1193
|
+
/**
|
|
1194
|
+
* @beta
|
|
1195
|
+
* Thumbnail for a single page within a document preview.
|
|
1196
|
+
*/
|
|
1197
|
+
declare interface DocumentPreviewPage {
|
|
1198
|
+
/**
|
|
1199
|
+
* URL to the page thumbnail image.
|
|
1200
|
+
*/
|
|
1201
|
+
url: string;
|
|
1202
|
+
/**
|
|
1203
|
+
* Width of the page thumbnail in pixels.
|
|
1204
|
+
*/
|
|
1205
|
+
widthPx: number;
|
|
1206
|
+
/**
|
|
1207
|
+
* Height of the page thumbnail in pixels.
|
|
1208
|
+
*/
|
|
1209
|
+
heightPx: number;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* @beta
|
|
1214
|
+
* Final state after a document preview has been upgraded. Contains thumbnail
|
|
1215
|
+
* URLs for every selected page in the document.
|
|
1216
|
+
*/
|
|
1217
|
+
declare interface DocumentPreviewReady extends BasePreview {
|
|
1218
|
+
kind: 'document';
|
|
1219
|
+
status: 'ready';
|
|
1220
|
+
/**
|
|
1221
|
+
* Format of the per-page thumbnails.
|
|
1222
|
+
*/
|
|
1223
|
+
format: 'png' | 'jpg';
|
|
1224
|
+
/**
|
|
1225
|
+
* Thumbnail pages for each page. Index corresponds to the page number.
|
|
1226
|
+
*/
|
|
1227
|
+
pages: DocumentPreviewPage[];
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1113
1230
|
/**
|
|
1114
1231
|
* @public
|
|
1115
1232
|
* Document preview with first page thumbnail available.
|
|
@@ -1133,6 +1250,20 @@ declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
1133
1250
|
thumbnailUrl: string;
|
|
1134
1251
|
}
|
|
1135
1252
|
|
|
1253
|
+
/**
|
|
1254
|
+
* @beta
|
|
1255
|
+
* Intermediate state while multi-page document thumbnails are being fetched
|
|
1256
|
+
* via {@link requestPreviewUpgrade}. The single-page thumbnail remains
|
|
1257
|
+
* available for display during the upgrade.
|
|
1258
|
+
*/
|
|
1259
|
+
declare interface DocumentPreviewUpgrading extends SizedPreview {
|
|
1260
|
+
kind: 'document';
|
|
1261
|
+
status: 'upgrading';
|
|
1262
|
+
thumbnailFormat: 'png' | 'jpg';
|
|
1263
|
+
/** The first-page thumbnail URL, available immediately. */
|
|
1264
|
+
thumbnailUrl: string;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1136
1267
|
/**
|
|
1137
1268
|
* @public
|
|
1138
1269
|
* Document file requirements for a media slot.
|
|
@@ -1174,6 +1305,18 @@ declare interface DocumentSelection extends BaseSelection {
|
|
|
1174
1305
|
*/
|
|
1175
1306
|
declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
|
|
1176
1307
|
|
|
1308
|
+
/**
|
|
1309
|
+
* @beta
|
|
1310
|
+
* Content summary for email sends.
|
|
1311
|
+
*/
|
|
1312
|
+
declare type EmailContentSummary = BaseContentSummary & {
|
|
1313
|
+
type: 'email';
|
|
1314
|
+
/** Subject line. */
|
|
1315
|
+
subject?: string;
|
|
1316
|
+
/** Email body preview or preheader. */
|
|
1317
|
+
body?: string;
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1177
1320
|
/**
|
|
1178
1321
|
* @public
|
|
1179
1322
|
* Exported email file ready for publishing.
|
|
@@ -1273,6 +1416,54 @@ declare type ExactValueRange = {
|
|
|
1273
1416
|
exact: number;
|
|
1274
1417
|
};
|
|
1275
1418
|
|
|
1419
|
+
/**
|
|
1420
|
+
* @beta
|
|
1421
|
+
* Generic content summary for apps that don't fit a more specific type.
|
|
1422
|
+
*/
|
|
1423
|
+
declare type GenericContentSummary = BaseContentSummary & {
|
|
1424
|
+
type: 'content';
|
|
1425
|
+
/** Title or headline. */
|
|
1426
|
+
title?: string;
|
|
1427
|
+
/** Body text or description. */
|
|
1428
|
+
body?: string;
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* @beta
|
|
1433
|
+
* Successful response from getContentSummary.
|
|
1434
|
+
*/
|
|
1435
|
+
declare type GetContentSummaryCompleted = {
|
|
1436
|
+
status: 'completed';
|
|
1437
|
+
contentSummary: ContentSummary;
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* @beta
|
|
1442
|
+
* Error response from getContentSummary.
|
|
1443
|
+
*/
|
|
1444
|
+
declare type GetContentSummaryError = AppError_2;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* @beta
|
|
1448
|
+
* Request payload for the getContentSummary action.
|
|
1449
|
+
*/
|
|
1450
|
+
declare type GetContentSummaryRequest = {
|
|
1451
|
+
/** The user's saved publish settings. Parse to retrieve app-specific state. */
|
|
1452
|
+
publishRef?: string;
|
|
1453
|
+
/**
|
|
1454
|
+
* The output type selected for this publish operation.
|
|
1455
|
+
*
|
|
1456
|
+
* Use `id` to distinguish between output types.
|
|
1457
|
+
*/
|
|
1458
|
+
outputType: OutputType;
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* @beta
|
|
1463
|
+
* Response from getContentSummary.
|
|
1464
|
+
*/
|
|
1465
|
+
declare type GetContentSummaryResponse = GetContentSummaryCompleted | GetContentSummaryError;
|
|
1466
|
+
|
|
1276
1467
|
/**
|
|
1277
1468
|
* @public
|
|
1278
1469
|
* Successful result from `getDataTable` action.
|
|
@@ -2084,6 +2275,12 @@ declare type OutputType = {
|
|
|
2084
2275
|
* such as a main image, thumbnail, or video.
|
|
2085
2276
|
*/
|
|
2086
2277
|
mediaSlots: MediaSlot[];
|
|
2278
|
+
/**
|
|
2279
|
+
* @beta
|
|
2280
|
+
* The type of content being published. When set, Canva uses this to tailor and improve the
|
|
2281
|
+
* publish experience. When omitted, defaults to `'content'` (generic behavior).
|
|
2282
|
+
*/
|
|
2283
|
+
contentNoun?: ContentNoun;
|
|
2087
2284
|
};
|
|
2088
2285
|
|
|
2089
2286
|
/**
|
|
@@ -2136,6 +2333,26 @@ declare type OutputTypeConfiguration = {
|
|
|
2136
2333
|
* do not provide selection data when defining output types.
|
|
2137
2334
|
*/
|
|
2138
2335
|
mediaSlots: Omit<MediaSlot, 'selection'>[];
|
|
2336
|
+
/**
|
|
2337
|
+
* @beta
|
|
2338
|
+
* The type of content being published. When set, Canva uses this to tailor and improve the
|
|
2339
|
+
* publish experience. When omitted, defaults to `'content'` (generic behavior).
|
|
2340
|
+
*/
|
|
2341
|
+
contentNoun?: ContentNoun;
|
|
2342
|
+
};
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* @beta
|
|
2346
|
+
* Content summary for social media posts (e.g. Instagram, Facebook, LinkedIn, YouTube).
|
|
2347
|
+
*/
|
|
2348
|
+
declare type PostContentSummary = BaseContentSummary & {
|
|
2349
|
+
type: 'post';
|
|
2350
|
+
/** Post heading (e.g. YouTube title, LinkedIn article headline). */
|
|
2351
|
+
title?: string;
|
|
2352
|
+
/** Post caption or body text. */
|
|
2353
|
+
body?: string;
|
|
2354
|
+
/** Hashtags without the leading `#` (e.g. `["fashion", "design"]`). */
|
|
2355
|
+
hashtags?: string[];
|
|
2139
2356
|
};
|
|
2140
2357
|
|
|
2141
2358
|
/**
|
package/content/beta.d.ts
CHANGED
|
@@ -100,6 +100,18 @@ export declare type AppError = {
|
|
|
100
100
|
errorCause?: ErrorCause;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @beta
|
|
105
|
+
* Content summary for file-destination apps (e.g. Google Drive, Dropbox).
|
|
106
|
+
*/
|
|
107
|
+
export declare type AssetContentSummary = BaseContentSummary & {
|
|
108
|
+
type: 'asset';
|
|
109
|
+
/** Asset title or filename. */
|
|
110
|
+
title: string;
|
|
111
|
+
/** Folder path (e.g. "/My Projects/Designs"). */
|
|
112
|
+
path?: string;
|
|
113
|
+
};
|
|
114
|
+
|
|
103
115
|
/**
|
|
104
116
|
* @beta
|
|
105
117
|
* Base interface for AI content requests.
|
|
@@ -125,6 +137,20 @@ declare type BaseAiContentRequest = {
|
|
|
125
137
|
fieldLabel: string;
|
|
126
138
|
};
|
|
127
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @beta
|
|
142
|
+
* Base fields shared by all content summary variants.
|
|
143
|
+
*/
|
|
144
|
+
declare type BaseContentSummary = {
|
|
145
|
+
/**
|
|
146
|
+
* The account, page, or list this post was published to.
|
|
147
|
+
*
|
|
148
|
+
* For example, a Facebook Page, a mailing list, or a personal profile.
|
|
149
|
+
* Use the connected account's display name and icon when there is no distinct destination.
|
|
150
|
+
*/
|
|
151
|
+
destination: Destination;
|
|
152
|
+
};
|
|
153
|
+
|
|
128
154
|
/**
|
|
129
155
|
* @public
|
|
130
156
|
* Base file requirement interface.
|
|
@@ -202,7 +228,14 @@ export declare interface BaseSelection {
|
|
|
202
228
|
export declare type ContentMetadata = DesignContentMetadata;
|
|
203
229
|
|
|
204
230
|
/**
|
|
205
|
-
* @
|
|
231
|
+
* @beta
|
|
232
|
+
* Describes what kind of content an output type produces. Canva uses this to tailor and improve
|
|
233
|
+
* the publish experience.
|
|
234
|
+
*/
|
|
235
|
+
export declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content';
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @beta
|
|
206
239
|
* Main interface for implementing the ContentPublisher intent.
|
|
207
240
|
*
|
|
208
241
|
* Implementing the ContentPublisher intent enables apps to publish contents to external platforms.
|
|
@@ -294,13 +327,13 @@ export declare type ContentPublisherIntent = {
|
|
|
294
327
|
* This action is called after the settings UI is rendered. Your UI should display
|
|
295
328
|
* a preview of how the content will appear on the target platform.
|
|
296
329
|
*
|
|
297
|
-
* Previews update dynamically as users modify their content or settings. For videos
|
|
298
|
-
* start with lightweight thumbnails and use `requestPreviewUpgrade`
|
|
299
|
-
*
|
|
330
|
+
* Previews update dynamically as users modify their content or settings. For videos
|
|
331
|
+
* and documents, start with lightweight thumbnails and use `requestPreviewUpgrade`
|
|
332
|
+
* to load full previews on demand to optimize performance.
|
|
300
333
|
*
|
|
301
334
|
* @param request - Configuration and callbacks for the preview UI.
|
|
302
335
|
*
|
|
303
|
-
* @example Rendering a preview UI with
|
|
336
|
+
* @example Rendering a preview UI with media optimization
|
|
304
337
|
* ```ts
|
|
305
338
|
* import { createRoot } from 'react-dom/client';
|
|
306
339
|
* import type { RenderPreviewUiRequest } from '@canva/intents/content';
|
|
@@ -370,8 +403,31 @@ export declare type ContentPublisherIntent = {
|
|
|
370
403
|
*/
|
|
371
404
|
publishContent: (request: PublishContentRequest) => Promise<PublishContentResponse>;
|
|
372
405
|
|
|
406
|
+
/**
|
|
407
|
+
* @beta
|
|
408
|
+
* Extracts a structured summary of the post's content for historical display.
|
|
409
|
+
*
|
|
410
|
+
* Called at `createPost` / `updatePost` time while the app is loaded. The returned
|
|
411
|
+
* snapshot is stored with the post and used to render historical post views in the
|
|
412
|
+
* content planner (calendar, list views, insights) without re-invoking the app.
|
|
413
|
+
*
|
|
414
|
+
* The snapshot is frozen at write time — it reflects what was published, not the
|
|
415
|
+
* app's current rendering logic. If the app's payload shape or output types change
|
|
416
|
+
* later, historical views remain accurate.
|
|
417
|
+
*
|
|
418
|
+
* @param request - The `publishRef` and `outputType` for the post being published.
|
|
419
|
+
* @returns A promise resolving to the `ContentSummary`, or an error.
|
|
420
|
+
*/
|
|
421
|
+
getContentSummary?: (request: GetContentSummaryRequest) => Promise<GetContentSummaryResponse>;
|
|
373
422
|
};
|
|
374
423
|
|
|
424
|
+
/**
|
|
425
|
+
* @beta
|
|
426
|
+
* A structured snapshot of a post's content for historical display.
|
|
427
|
+
* Discriminated by `type`.
|
|
428
|
+
*/
|
|
429
|
+
export declare type ContentSummary = PostContentSummary | EmailContentSummary | AssetContentSummary | GenericContentSummary;
|
|
430
|
+
|
|
375
431
|
/**
|
|
376
432
|
* @public
|
|
377
433
|
* Metadata specific to design content.
|
|
@@ -393,6 +449,17 @@ export declare interface DesignContentMetadata {
|
|
|
393
449
|
|
|
394
450
|
}
|
|
395
451
|
|
|
452
|
+
/**
|
|
453
|
+
* @beta
|
|
454
|
+
* The publishing destination when distinct from the connected account.
|
|
455
|
+
*/
|
|
456
|
+
export declare type Destination = {
|
|
457
|
+
/** User-facing name (e.g. "Bob's Cool Page", "Product Newsletter"). */
|
|
458
|
+
displayName: string;
|
|
459
|
+
/** Avatar or icon URL for the destination. */
|
|
460
|
+
iconUrl?: string;
|
|
461
|
+
};
|
|
462
|
+
|
|
396
463
|
/**
|
|
397
464
|
* @public
|
|
398
465
|
* A function that can be called to dispose of a callback.
|
|
@@ -409,13 +476,14 @@ export declare type Disposer = () => void;
|
|
|
409
476
|
export declare type DocumentOutputFile = BaseOutputFile;
|
|
410
477
|
|
|
411
478
|
/**
|
|
412
|
-
* @
|
|
479
|
+
* @beta
|
|
413
480
|
* Document preview in various states.
|
|
414
481
|
*
|
|
415
|
-
* Documents transition through states: `"loading"` → `"thumbnail"`.
|
|
416
|
-
* Start with a lightweight thumbnail of the first page
|
|
482
|
+
* Documents transition through states: `"loading"` → `"thumbnail"` → `"upgrading"` → `"ready"`.
|
|
483
|
+
* Start with a lightweight thumbnail of the first page, then upgrade to full multi-page
|
|
484
|
+
* preview using `requestPreviewUpgrade`.
|
|
417
485
|
*/
|
|
418
|
-
export declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewError;
|
|
486
|
+
export declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewUpgrading | DocumentPreviewReady | DocumentPreviewError;
|
|
419
487
|
|
|
420
488
|
/**
|
|
421
489
|
* @public
|
|
@@ -443,6 +511,43 @@ export declare interface DocumentPreviewLoading extends SizedPreview {
|
|
|
443
511
|
status: 'loading';
|
|
444
512
|
}
|
|
445
513
|
|
|
514
|
+
/**
|
|
515
|
+
* @beta
|
|
516
|
+
* Thumbnail for a single page within a document preview.
|
|
517
|
+
*/
|
|
518
|
+
export declare interface DocumentPreviewPage {
|
|
519
|
+
/**
|
|
520
|
+
* URL to the page thumbnail image.
|
|
521
|
+
*/
|
|
522
|
+
url: string;
|
|
523
|
+
/**
|
|
524
|
+
* Width of the page thumbnail in pixels.
|
|
525
|
+
*/
|
|
526
|
+
widthPx: number;
|
|
527
|
+
/**
|
|
528
|
+
* Height of the page thumbnail in pixels.
|
|
529
|
+
*/
|
|
530
|
+
heightPx: number;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @beta
|
|
535
|
+
* Final state after a document preview has been upgraded. Contains thumbnail
|
|
536
|
+
* URLs for every selected page in the document.
|
|
537
|
+
*/
|
|
538
|
+
export declare interface DocumentPreviewReady extends BasePreview {
|
|
539
|
+
kind: 'document';
|
|
540
|
+
status: 'ready';
|
|
541
|
+
/**
|
|
542
|
+
* Format of the per-page thumbnails.
|
|
543
|
+
*/
|
|
544
|
+
format: 'png' | 'jpg';
|
|
545
|
+
/**
|
|
546
|
+
* Thumbnail pages for each page. Index corresponds to the page number.
|
|
547
|
+
*/
|
|
548
|
+
pages: DocumentPreviewPage[];
|
|
549
|
+
}
|
|
550
|
+
|
|
446
551
|
/**
|
|
447
552
|
* @public
|
|
448
553
|
* Document preview with first page thumbnail available.
|
|
@@ -466,6 +571,20 @@ export declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
466
571
|
thumbnailUrl: string;
|
|
467
572
|
}
|
|
468
573
|
|
|
574
|
+
/**
|
|
575
|
+
* @beta
|
|
576
|
+
* Intermediate state while multi-page document thumbnails are being fetched
|
|
577
|
+
* via {@link requestPreviewUpgrade}. The single-page thumbnail remains
|
|
578
|
+
* available for display during the upgrade.
|
|
579
|
+
*/
|
|
580
|
+
export declare interface DocumentPreviewUpgrading extends SizedPreview {
|
|
581
|
+
kind: 'document';
|
|
582
|
+
status: 'upgrading';
|
|
583
|
+
thumbnailFormat: 'png' | 'jpg';
|
|
584
|
+
/** The first-page thumbnail URL, available immediately. */
|
|
585
|
+
thumbnailUrl: string;
|
|
586
|
+
}
|
|
587
|
+
|
|
469
588
|
/**
|
|
470
589
|
* @public
|
|
471
590
|
* Document file requirements for a media slot.
|
|
@@ -507,6 +626,18 @@ export declare interface DocumentSelection extends BaseSelection {
|
|
|
507
626
|
*/
|
|
508
627
|
export declare type DocumentSize = 'a4' | 'a3' | 'letter' | 'legal';
|
|
509
628
|
|
|
629
|
+
/**
|
|
630
|
+
* @beta
|
|
631
|
+
* Content summary for email sends.
|
|
632
|
+
*/
|
|
633
|
+
export declare type EmailContentSummary = BaseContentSummary & {
|
|
634
|
+
type: 'email';
|
|
635
|
+
/** Subject line. */
|
|
636
|
+
subject?: string;
|
|
637
|
+
/** Email body preview or preheader. */
|
|
638
|
+
body?: string;
|
|
639
|
+
};
|
|
640
|
+
|
|
510
641
|
/**
|
|
511
642
|
* @public
|
|
512
643
|
* Exported email file ready for publishing.
|
|
@@ -606,6 +737,54 @@ export declare type ExactValueRange = {
|
|
|
606
737
|
exact: number;
|
|
607
738
|
};
|
|
608
739
|
|
|
740
|
+
/**
|
|
741
|
+
* @beta
|
|
742
|
+
* Generic content summary for apps that don't fit a more specific type.
|
|
743
|
+
*/
|
|
744
|
+
export declare type GenericContentSummary = BaseContentSummary & {
|
|
745
|
+
type: 'content';
|
|
746
|
+
/** Title or headline. */
|
|
747
|
+
title?: string;
|
|
748
|
+
/** Body text or description. */
|
|
749
|
+
body?: string;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @beta
|
|
754
|
+
* Successful response from getContentSummary.
|
|
755
|
+
*/
|
|
756
|
+
export declare type GetContentSummaryCompleted = {
|
|
757
|
+
status: 'completed';
|
|
758
|
+
contentSummary: ContentSummary;
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* @beta
|
|
763
|
+
* Error response from getContentSummary.
|
|
764
|
+
*/
|
|
765
|
+
export declare type GetContentSummaryError = AppError;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* @beta
|
|
769
|
+
* Request payload for the getContentSummary action.
|
|
770
|
+
*/
|
|
771
|
+
export declare type GetContentSummaryRequest = {
|
|
772
|
+
/** The user's saved publish settings. Parse to retrieve app-specific state. */
|
|
773
|
+
publishRef?: string;
|
|
774
|
+
/**
|
|
775
|
+
* The output type selected for this publish operation.
|
|
776
|
+
*
|
|
777
|
+
* Use `id` to distinguish between output types.
|
|
778
|
+
*/
|
|
779
|
+
outputType: OutputType;
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* @beta
|
|
784
|
+
* Response from getContentSummary.
|
|
785
|
+
*/
|
|
786
|
+
export declare type GetContentSummaryResponse = GetContentSummaryCompleted | GetContentSummaryError;
|
|
787
|
+
|
|
609
788
|
/**
|
|
610
789
|
* @public
|
|
611
790
|
* Successful response from getting publish configuration.
|
|
@@ -970,6 +1149,12 @@ export declare type OutputType = {
|
|
|
970
1149
|
* such as a main image, thumbnail, or video.
|
|
971
1150
|
*/
|
|
972
1151
|
mediaSlots: MediaSlot[];
|
|
1152
|
+
/**
|
|
1153
|
+
* @beta
|
|
1154
|
+
* The type of content being published. When set, Canva uses this to tailor and improve the
|
|
1155
|
+
* publish experience. When omitted, defaults to `'content'` (generic behavior).
|
|
1156
|
+
*/
|
|
1157
|
+
contentNoun?: ContentNoun;
|
|
973
1158
|
};
|
|
974
1159
|
|
|
975
1160
|
/**
|
|
@@ -1022,6 +1207,26 @@ export declare type OutputTypeConfiguration = {
|
|
|
1022
1207
|
* do not provide selection data when defining output types.
|
|
1023
1208
|
*/
|
|
1024
1209
|
mediaSlots: Omit<MediaSlot, 'selection'>[];
|
|
1210
|
+
/**
|
|
1211
|
+
* @beta
|
|
1212
|
+
* The type of content being published. When set, Canva uses this to tailor and improve the
|
|
1213
|
+
* publish experience. When omitted, defaults to `'content'` (generic behavior).
|
|
1214
|
+
*/
|
|
1215
|
+
contentNoun?: ContentNoun;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* @beta
|
|
1220
|
+
* Content summary for social media posts (e.g. Instagram, Facebook, LinkedIn, YouTube).
|
|
1221
|
+
*/
|
|
1222
|
+
export declare type PostContentSummary = BaseContentSummary & {
|
|
1223
|
+
type: 'post';
|
|
1224
|
+
/** Post heading (e.g. YouTube title, LinkedIn article headline). */
|
|
1225
|
+
title?: string;
|
|
1226
|
+
/** Post caption or body text. */
|
|
1227
|
+
body?: string;
|
|
1228
|
+
/** Hashtags without the leading `#` (e.g. `["fashion", "design"]`). */
|
|
1229
|
+
hashtags?: string[];
|
|
1025
1230
|
};
|
|
1026
1231
|
|
|
1027
1232
|
/**
|
|
@@ -1051,9 +1256,9 @@ export declare type PostPublishActionRedirect = {
|
|
|
1051
1256
|
};
|
|
1052
1257
|
|
|
1053
1258
|
/**
|
|
1054
|
-
* @
|
|
1259
|
+
* @beta
|
|
1055
1260
|
*
|
|
1056
|
-
* Prepares a
|
|
1261
|
+
* Prepares a `ContentPublisherIntent`.
|
|
1057
1262
|
*
|
|
1058
1263
|
* @example
|
|
1059
1264
|
* ```tsx
|
|
@@ -1078,8 +1283,8 @@ export declare type PostPublishActionRedirect = {
|
|
|
1078
1283
|
export declare const prepareContentPublisher: (implementation: ContentPublisherIntent) => void;
|
|
1079
1284
|
|
|
1080
1285
|
/**
|
|
1081
|
-
* @
|
|
1082
|
-
* Preview item for an image or
|
|
1286
|
+
* @beta
|
|
1287
|
+
* Preview item for an image, video, document, or email.
|
|
1083
1288
|
*
|
|
1084
1289
|
* Check the `kind` and `status` properties to determine the type and state.
|
|
1085
1290
|
*/
|
|
@@ -1092,10 +1297,10 @@ export declare type Preview = ImagePreview | VideoPreview | DocumentPreview | Em
|
|
|
1092
1297
|
export declare type PreviewKind = 'image' | 'video' | 'document' | 'email';
|
|
1093
1298
|
|
|
1094
1299
|
/**
|
|
1095
|
-
* @
|
|
1300
|
+
* @beta
|
|
1096
1301
|
* Preview media for a specific media slot.
|
|
1097
1302
|
*
|
|
1098
|
-
* Contains preview URLs and metadata for images or
|
|
1303
|
+
* Contains preview URLs and metadata for images, videos, documents, or emails in the design.
|
|
1099
1304
|
*/
|
|
1100
1305
|
export declare type PreviewMedia = {
|
|
1101
1306
|
/**
|
|
@@ -1251,7 +1456,7 @@ export declare type PublishErrorSettingsUiContext = {
|
|
|
1251
1456
|
export declare type PublishFileFormat = 'png' | 'jpg' | 'mp4' | 'pdf_standard' | 'html_bundle' | 'html_standalone';
|
|
1252
1457
|
|
|
1253
1458
|
/**
|
|
1254
|
-
* @
|
|
1459
|
+
* @beta
|
|
1255
1460
|
* Initial payload provided from cache.
|
|
1256
1461
|
*/
|
|
1257
1462
|
export declare type PublishPreviewUiInvocationContext = {
|
|
@@ -1379,21 +1584,21 @@ export declare type RemoteRequestFailedError = {
|
|
|
1379
1584
|
};
|
|
1380
1585
|
|
|
1381
1586
|
/**
|
|
1382
|
-
* @
|
|
1587
|
+
* @beta
|
|
1383
1588
|
* Initial payload provided when the preview UI is rendered.
|
|
1384
1589
|
* Contains the preview data and settings needed to initialize the preview interface.
|
|
1385
1590
|
*/
|
|
1386
1591
|
export declare type RenderPreviewUiInvocationContext = PublishPreviewUiInvocationContext;
|
|
1387
1592
|
|
|
1388
1593
|
/**
|
|
1389
|
-
* @
|
|
1594
|
+
* @beta
|
|
1390
1595
|
* Configuration required for rendering the preview UI.
|
|
1391
1596
|
*
|
|
1392
1597
|
* Provides callbacks for managing preview media and responding to preview updates.
|
|
1393
1598
|
*/
|
|
1394
1599
|
export declare type RenderPreviewUiRequest = {
|
|
1395
1600
|
/**
|
|
1396
|
-
* @
|
|
1601
|
+
* @beta
|
|
1397
1602
|
* The initial preview data and context provided when the preview UI is rendered.
|
|
1398
1603
|
*
|
|
1399
1604
|
* Contains the initial preview media, output type information, and any existing
|
|
@@ -1401,17 +1606,17 @@ export declare type RenderPreviewUiRequest = {
|
|
|
1401
1606
|
*/
|
|
1402
1607
|
invocationContext: RenderPreviewUiInvocationContext;
|
|
1403
1608
|
/**
|
|
1404
|
-
* Callback to upgrade
|
|
1609
|
+
* Callback to upgrade thumbnail previews to their full media variant.
|
|
1405
1610
|
*
|
|
1406
|
-
* Call this function when you need full
|
|
1407
|
-
* This helps optimize performance by deferring full
|
|
1611
|
+
* Call this function when you need full previews instead of lightweight thumbnails.
|
|
1612
|
+
* This helps optimize performance by deferring full media loading until needed.
|
|
1408
1613
|
*
|
|
1409
1614
|
* Upgrades may complete asynchronously; listen to `registerOnPreviewChange` for updates
|
|
1410
|
-
* to receive the upgraded
|
|
1615
|
+
* to receive the upgraded previews.
|
|
1411
1616
|
*
|
|
1412
|
-
* @param previewIds - Array of preview IDs to upgrade from thumbnail to full
|
|
1617
|
+
* @param previewIds - Array of preview IDs to upgrade from thumbnail to full media
|
|
1413
1618
|
*
|
|
1414
|
-
* @example Upgrading
|
|
1619
|
+
* @example Upgrading previews on user interaction
|
|
1415
1620
|
* ```ts
|
|
1416
1621
|
* // When user clicks on a video thumbnail, upgrade to full video
|
|
1417
1622
|
* if (preview.kind === 'video' && preview.status === 'thumbnail') {
|
|
@@ -1427,7 +1632,7 @@ export declare type RenderPreviewUiRequest = {
|
|
|
1427
1632
|
*
|
|
1428
1633
|
* - The design content changes
|
|
1429
1634
|
* - The output type changes
|
|
1430
|
-
* - Preview media is upgraded from thumbnail to full
|
|
1635
|
+
* - Preview media is upgraded from thumbnail to full media
|
|
1431
1636
|
* - Export settings are modified
|
|
1432
1637
|
*
|
|
1433
1638
|
* Use this to update your preview UI in real-time as users modify their design.
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
Object.defineProperty(exports, "prepareContentPublisher", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return prepareContentPublisher;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
5
11
|
const _version = require("../version");
|
|
6
12
|
_export_star(require("./public"), exports);
|
|
7
13
|
function _export_star(from, to) {
|
|
@@ -17,4 +23,5 @@ function _export_star(from, to) {
|
|
|
17
23
|
});
|
|
18
24
|
return from;
|
|
19
25
|
}
|
|
26
|
+
const prepareContentPublisher = canva_sdk.intents.v1.content.prepareContentPublisher;
|
|
20
27
|
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', _version.LATEST_VERSION_BETA, 'beta');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LATEST_VERSION_BETA } from '../version';
|
|
2
2
|
export * from './public';
|
|
3
|
+
export const prepareContentPublisher = canva_sdk.intents.v1.content.prepareContentPublisher;
|
|
3
4
|
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', LATEST_VERSION_BETA, 'beta');
|