@canva/intents 2.5.1-beta.2 → 2.6.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/beta.d.ts +30 -20
- package/content/beta.d.ts +38 -30
- package/lib/cjs/sdk/intents/content/beta.js +0 -7
- package/lib/cjs/sdk/intents/version.js +2 -2
- package/lib/esm/sdk/intents/content/beta.js +0 -1
- package/lib/esm/sdk/intents/version.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/beta.d.ts
CHANGED
|
@@ -279,7 +279,7 @@ declare interface BasePreview {
|
|
|
279
279
|
/**
|
|
280
280
|
* Unique identifier for this preview.
|
|
281
281
|
*
|
|
282
|
-
* Use this ID with `requestPreviewUpgrade` to upgrade
|
|
282
|
+
* Use this ID with `requestPreviewUpgrade` to upgrade thumbnails to full previews.
|
|
283
283
|
*/
|
|
284
284
|
id: string;
|
|
285
285
|
/**
|
|
@@ -425,6 +425,7 @@ declare namespace content {
|
|
|
425
425
|
MaxValueRange,
|
|
426
426
|
MinMaxValueRange,
|
|
427
427
|
ValueRange,
|
|
428
|
+
DocumentPreview,
|
|
428
429
|
DocumentPreviewLoading,
|
|
429
430
|
DocumentPreviewThumbnail,
|
|
430
431
|
DocumentPreviewUpgrading,
|
|
@@ -476,7 +477,7 @@ declare namespace content {
|
|
|
476
477
|
GetContentSummaryCompleted,
|
|
477
478
|
GetContentSummaryError,
|
|
478
479
|
GetContentSummaryResponse,
|
|
479
|
-
|
|
480
|
+
GetContentSummaryRequest,
|
|
480
481
|
Preview,
|
|
481
482
|
PreviewMedia,
|
|
482
483
|
RenderPreviewUiInvocationContext,
|
|
@@ -498,7 +499,7 @@ declare type ContentMetadata = DesignContentMetadata;
|
|
|
498
499
|
* Describes what kind of content an output type produces. Canva uses this to tailor and improve
|
|
499
500
|
* the publish experience.
|
|
500
501
|
*/
|
|
501
|
-
declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content';
|
|
502
|
+
declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content' | 'content_export';
|
|
502
503
|
|
|
503
504
|
/**
|
|
504
505
|
* @public
|
|
@@ -1159,10 +1160,11 @@ declare type DocumentOutputFile = BaseOutputFile;
|
|
|
1159
1160
|
* @public
|
|
1160
1161
|
* Document preview in various states.
|
|
1161
1162
|
*
|
|
1162
|
-
* Documents transition through states: `"loading"` → `"thumbnail"`.
|
|
1163
|
-
* Start with a lightweight thumbnail of the first page
|
|
1163
|
+
* Documents transition through states: `"loading"` → `"thumbnail"` → `"upgrading"` → `"ready"`.
|
|
1164
|
+
* Start with a lightweight thumbnail of the first page, then upgrade to full multi-page
|
|
1165
|
+
* preview using `requestPreviewUpgrade`.
|
|
1164
1166
|
*/
|
|
1165
|
-
declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewError;
|
|
1167
|
+
declare type DocumentPreview = DocumentPreviewLoading | DocumentPreviewThumbnail | DocumentPreviewUpgrading | DocumentPreviewReady | DocumentPreviewError;
|
|
1166
1168
|
|
|
1167
1169
|
/**
|
|
1168
1170
|
* @public
|
|
@@ -1191,7 +1193,7 @@ declare interface DocumentPreviewLoading extends SizedPreview {
|
|
|
1191
1193
|
}
|
|
1192
1194
|
|
|
1193
1195
|
/**
|
|
1194
|
-
* @
|
|
1196
|
+
* @public
|
|
1195
1197
|
* Thumbnail for a single page within a document preview.
|
|
1196
1198
|
*/
|
|
1197
1199
|
declare interface DocumentPreviewPage {
|
|
@@ -1210,7 +1212,7 @@ declare interface DocumentPreviewPage {
|
|
|
1210
1212
|
}
|
|
1211
1213
|
|
|
1212
1214
|
/**
|
|
1213
|
-
* @
|
|
1215
|
+
* @public
|
|
1214
1216
|
* Final state after a document preview has been upgraded. Contains thumbnail
|
|
1215
1217
|
* URLs for every selected page in the document.
|
|
1216
1218
|
*/
|
|
@@ -1232,8 +1234,8 @@ declare interface DocumentPreviewReady extends BasePreview {
|
|
|
1232
1234
|
* Document preview with first page thumbnail available.
|
|
1233
1235
|
*
|
|
1234
1236
|
* This is the initial state for document previews. Show the thumbnail image
|
|
1235
|
-
* of the first page
|
|
1236
|
-
*
|
|
1237
|
+
* of the first page to give users a quick preview of the document.
|
|
1238
|
+
* Call `requestPreviewUpgrade` to load all page thumbnails.
|
|
1237
1239
|
*/
|
|
1238
1240
|
declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
1239
1241
|
kind: 'document';
|
|
@@ -1251,7 +1253,7 @@ declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
1251
1253
|
}
|
|
1252
1254
|
|
|
1253
1255
|
/**
|
|
1254
|
-
* @
|
|
1256
|
+
* @public
|
|
1255
1257
|
* Intermediate state while multi-page document thumbnails are being fetched
|
|
1256
1258
|
* via {@link requestPreviewUpgrade}. The single-page thumbnail remains
|
|
1257
1259
|
* available for display during the upgrade.
|
|
@@ -1259,8 +1261,15 @@ declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
1259
1261
|
declare interface DocumentPreviewUpgrading extends SizedPreview {
|
|
1260
1262
|
kind: 'document';
|
|
1261
1263
|
status: 'upgrading';
|
|
1264
|
+
/**
|
|
1265
|
+
* Format of the thumbnail image.
|
|
1266
|
+
*/
|
|
1262
1267
|
thumbnailFormat: 'png' | 'jpg';
|
|
1263
|
-
/**
|
|
1268
|
+
/**
|
|
1269
|
+
* URL to the first page thumbnail.
|
|
1270
|
+
*
|
|
1271
|
+
* Continue showing this while the upgrade loads.
|
|
1272
|
+
*/
|
|
1264
1273
|
thumbnailUrl: string;
|
|
1265
1274
|
}
|
|
1266
1275
|
|
|
@@ -2786,20 +2795,21 @@ declare type RenderPreviewUiRequest = {
|
|
|
2786
2795
|
*/
|
|
2787
2796
|
invocationContext: RenderPreviewUiInvocationContext;
|
|
2788
2797
|
/**
|
|
2789
|
-
* Callback to upgrade
|
|
2798
|
+
* Callback to upgrade thumbnail previews to full media.
|
|
2790
2799
|
*
|
|
2791
|
-
* Call this function when you need full video
|
|
2792
|
-
* This helps optimize performance by deferring
|
|
2800
|
+
* Call this function when you need full video or multi-page document previews
|
|
2801
|
+
* instead of lightweight thumbnails. This helps optimize performance by deferring
|
|
2802
|
+
* full media loading until needed.
|
|
2793
2803
|
*
|
|
2794
2804
|
* Upgrades may complete asynchronously; listen to `registerOnPreviewChange` for updates
|
|
2795
|
-
* to receive the upgraded
|
|
2805
|
+
* to receive the upgraded previews.
|
|
2796
2806
|
*
|
|
2797
|
-
* @param previewIds - Array of preview IDs to upgrade from thumbnail to full
|
|
2807
|
+
* @param previewIds - Array of preview IDs to upgrade from thumbnail to full media
|
|
2798
2808
|
*
|
|
2799
|
-
* @example Upgrading
|
|
2809
|
+
* @example Upgrading previews on user interaction
|
|
2800
2810
|
* ```ts
|
|
2801
|
-
* // When user clicks on a
|
|
2802
|
-
* if (preview.
|
|
2811
|
+
* // When user clicks on a thumbnail, upgrade to full preview
|
|
2812
|
+
* if (preview.status === 'thumbnail') {
|
|
2803
2813
|
* requestPreviewUpgrade([preview.id]);
|
|
2804
2814
|
* }
|
|
2805
2815
|
* ```
|
package/content/beta.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ export declare interface BasePreview {
|
|
|
194
194
|
/**
|
|
195
195
|
* Unique identifier for this preview.
|
|
196
196
|
*
|
|
197
|
-
* Use this ID with `requestPreviewUpgrade` to upgrade
|
|
197
|
+
* Use this ID with `requestPreviewUpgrade` to upgrade thumbnails to full previews.
|
|
198
198
|
*/
|
|
199
199
|
id: string;
|
|
200
200
|
/**
|
|
@@ -232,10 +232,10 @@ export declare type ContentMetadata = DesignContentMetadata;
|
|
|
232
232
|
* Describes what kind of content an output type produces. Canva uses this to tailor and improve
|
|
233
233
|
* the publish experience.
|
|
234
234
|
*/
|
|
235
|
-
export declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content';
|
|
235
|
+
export declare type ContentNoun = 'email' | 'post' | 'schedule' | 'asset' | 'draft' | 'publication' | 'content' | 'content_export';
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
|
-
* @
|
|
238
|
+
* @public
|
|
239
239
|
* Main interface for implementing the ContentPublisher intent.
|
|
240
240
|
*
|
|
241
241
|
* Implementing the ContentPublisher intent enables apps to publish contents to external platforms.
|
|
@@ -327,13 +327,13 @@ export declare type ContentPublisherIntent = {
|
|
|
327
327
|
* This action is called after the settings UI is rendered. Your UI should display
|
|
328
328
|
* a preview of how the content will appear on the target platform.
|
|
329
329
|
*
|
|
330
|
-
* Previews update dynamically as users modify their content or settings. For videos
|
|
331
|
-
*
|
|
332
|
-
*
|
|
330
|
+
* Previews update dynamically as users modify their content or settings. For videos,
|
|
331
|
+
* start with lightweight thumbnails and use `requestPreviewUpgrade` to load full
|
|
332
|
+
* video previews on demand to optimize performance.
|
|
333
333
|
*
|
|
334
334
|
* @param request - Configuration and callbacks for the preview UI.
|
|
335
335
|
*
|
|
336
|
-
* @example Rendering a preview UI with
|
|
336
|
+
* @example Rendering a preview UI with video optimization
|
|
337
337
|
* ```ts
|
|
338
338
|
* import { createRoot } from 'react-dom/client';
|
|
339
339
|
* import type { RenderPreviewUiRequest } from '@canva/intents/content';
|
|
@@ -476,7 +476,7 @@ export declare type Disposer = () => void;
|
|
|
476
476
|
export declare type DocumentOutputFile = BaseOutputFile;
|
|
477
477
|
|
|
478
478
|
/**
|
|
479
|
-
* @
|
|
479
|
+
* @public
|
|
480
480
|
* Document preview in various states.
|
|
481
481
|
*
|
|
482
482
|
* Documents transition through states: `"loading"` → `"thumbnail"` → `"upgrading"` → `"ready"`.
|
|
@@ -512,7 +512,7 @@ export declare interface DocumentPreviewLoading extends SizedPreview {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
/**
|
|
515
|
-
* @
|
|
515
|
+
* @public
|
|
516
516
|
* Thumbnail for a single page within a document preview.
|
|
517
517
|
*/
|
|
518
518
|
export declare interface DocumentPreviewPage {
|
|
@@ -531,7 +531,7 @@ export declare interface DocumentPreviewPage {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
/**
|
|
534
|
-
* @
|
|
534
|
+
* @public
|
|
535
535
|
* Final state after a document preview has been upgraded. Contains thumbnail
|
|
536
536
|
* URLs for every selected page in the document.
|
|
537
537
|
*/
|
|
@@ -553,8 +553,8 @@ export declare interface DocumentPreviewReady extends BasePreview {
|
|
|
553
553
|
* Document preview with first page thumbnail available.
|
|
554
554
|
*
|
|
555
555
|
* This is the initial state for document previews. Show the thumbnail image
|
|
556
|
-
* of the first page
|
|
557
|
-
*
|
|
556
|
+
* of the first page to give users a quick preview of the document.
|
|
557
|
+
* Call `requestPreviewUpgrade` to load all page thumbnails.
|
|
558
558
|
*/
|
|
559
559
|
export declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
560
560
|
kind: 'document';
|
|
@@ -572,7 +572,7 @@ export declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
/**
|
|
575
|
-
* @
|
|
575
|
+
* @public
|
|
576
576
|
* Intermediate state while multi-page document thumbnails are being fetched
|
|
577
577
|
* via {@link requestPreviewUpgrade}. The single-page thumbnail remains
|
|
578
578
|
* available for display during the upgrade.
|
|
@@ -580,8 +580,15 @@ export declare interface DocumentPreviewThumbnail extends SizedPreview {
|
|
|
580
580
|
export declare interface DocumentPreviewUpgrading extends SizedPreview {
|
|
581
581
|
kind: 'document';
|
|
582
582
|
status: 'upgrading';
|
|
583
|
+
/**
|
|
584
|
+
* Format of the thumbnail image.
|
|
585
|
+
*/
|
|
583
586
|
thumbnailFormat: 'png' | 'jpg';
|
|
584
|
-
/**
|
|
587
|
+
/**
|
|
588
|
+
* URL to the first page thumbnail.
|
|
589
|
+
*
|
|
590
|
+
* Continue showing this while the upgrade loads.
|
|
591
|
+
*/
|
|
585
592
|
thumbnailUrl: string;
|
|
586
593
|
}
|
|
587
594
|
|
|
@@ -1256,9 +1263,9 @@ export declare type PostPublishActionRedirect = {
|
|
|
1256
1263
|
};
|
|
1257
1264
|
|
|
1258
1265
|
/**
|
|
1259
|
-
* @
|
|
1266
|
+
* @public
|
|
1260
1267
|
*
|
|
1261
|
-
* Prepares a
|
|
1268
|
+
* Prepares a {@link ContentPublisherIntent|Content Publisher Intent}.
|
|
1262
1269
|
*
|
|
1263
1270
|
* @example
|
|
1264
1271
|
* ```tsx
|
|
@@ -1283,8 +1290,8 @@ export declare type PostPublishActionRedirect = {
|
|
|
1283
1290
|
export declare const prepareContentPublisher: (implementation: ContentPublisherIntent) => void;
|
|
1284
1291
|
|
|
1285
1292
|
/**
|
|
1286
|
-
* @
|
|
1287
|
-
* Preview item for an image
|
|
1293
|
+
* @public
|
|
1294
|
+
* Preview item for an image or video.
|
|
1288
1295
|
*
|
|
1289
1296
|
* Check the `kind` and `status` properties to determine the type and state.
|
|
1290
1297
|
*/
|
|
@@ -1297,10 +1304,10 @@ export declare type Preview = ImagePreview | VideoPreview | DocumentPreview | Em
|
|
|
1297
1304
|
export declare type PreviewKind = 'image' | 'video' | 'document' | 'email';
|
|
1298
1305
|
|
|
1299
1306
|
/**
|
|
1300
|
-
* @
|
|
1307
|
+
* @public
|
|
1301
1308
|
* Preview media for a specific media slot.
|
|
1302
1309
|
*
|
|
1303
|
-
* Contains preview URLs and metadata for images
|
|
1310
|
+
* Contains preview URLs and metadata for images or videos in the design.
|
|
1304
1311
|
*/
|
|
1305
1312
|
export declare type PreviewMedia = {
|
|
1306
1313
|
/**
|
|
@@ -1456,7 +1463,7 @@ export declare type PublishErrorSettingsUiContext = {
|
|
|
1456
1463
|
export declare type PublishFileFormat = 'png' | 'jpg' | 'mp4' | 'pdf_standard' | 'html_bundle' | 'html_standalone';
|
|
1457
1464
|
|
|
1458
1465
|
/**
|
|
1459
|
-
* @
|
|
1466
|
+
* @public
|
|
1460
1467
|
* Initial payload provided from cache.
|
|
1461
1468
|
*/
|
|
1462
1469
|
export declare type PublishPreviewUiInvocationContext = {
|
|
@@ -1584,21 +1591,21 @@ export declare type RemoteRequestFailedError = {
|
|
|
1584
1591
|
};
|
|
1585
1592
|
|
|
1586
1593
|
/**
|
|
1587
|
-
* @
|
|
1594
|
+
* @public
|
|
1588
1595
|
* Initial payload provided when the preview UI is rendered.
|
|
1589
1596
|
* Contains the preview data and settings needed to initialize the preview interface.
|
|
1590
1597
|
*/
|
|
1591
1598
|
export declare type RenderPreviewUiInvocationContext = PublishPreviewUiInvocationContext;
|
|
1592
1599
|
|
|
1593
1600
|
/**
|
|
1594
|
-
* @
|
|
1601
|
+
* @public
|
|
1595
1602
|
* Configuration required for rendering the preview UI.
|
|
1596
1603
|
*
|
|
1597
1604
|
* Provides callbacks for managing preview media and responding to preview updates.
|
|
1598
1605
|
*/
|
|
1599
1606
|
export declare type RenderPreviewUiRequest = {
|
|
1600
1607
|
/**
|
|
1601
|
-
* @
|
|
1608
|
+
* @public
|
|
1602
1609
|
* The initial preview data and context provided when the preview UI is rendered.
|
|
1603
1610
|
*
|
|
1604
1611
|
* Contains the initial preview media, output type information, and any existing
|
|
@@ -1606,10 +1613,11 @@ export declare type RenderPreviewUiRequest = {
|
|
|
1606
1613
|
*/
|
|
1607
1614
|
invocationContext: RenderPreviewUiInvocationContext;
|
|
1608
1615
|
/**
|
|
1609
|
-
* Callback to upgrade thumbnail previews to
|
|
1616
|
+
* Callback to upgrade thumbnail previews to full media.
|
|
1610
1617
|
*
|
|
1611
|
-
* Call this function when you need full
|
|
1612
|
-
* This helps optimize performance by deferring
|
|
1618
|
+
* Call this function when you need full video or multi-page document previews
|
|
1619
|
+
* instead of lightweight thumbnails. This helps optimize performance by deferring
|
|
1620
|
+
* full media loading until needed.
|
|
1613
1621
|
*
|
|
1614
1622
|
* Upgrades may complete asynchronously; listen to `registerOnPreviewChange` for updates
|
|
1615
1623
|
* to receive the upgraded previews.
|
|
@@ -1618,8 +1626,8 @@ export declare type RenderPreviewUiRequest = {
|
|
|
1618
1626
|
*
|
|
1619
1627
|
* @example Upgrading previews on user interaction
|
|
1620
1628
|
* ```ts
|
|
1621
|
-
* // When user clicks on a
|
|
1622
|
-
* if (preview.
|
|
1629
|
+
* // When user clicks on a thumbnail, upgrade to full preview
|
|
1630
|
+
* if (preview.status === 'thumbnail') {
|
|
1623
1631
|
* requestPreviewUpgrade([preview.id]);
|
|
1624
1632
|
* }
|
|
1625
1633
|
* ```
|
|
@@ -1632,7 +1640,7 @@ export declare type RenderPreviewUiRequest = {
|
|
|
1632
1640
|
*
|
|
1633
1641
|
* - The design content changes
|
|
1634
1642
|
* - The output type changes
|
|
1635
|
-
* - Preview media is upgraded from thumbnail to full
|
|
1643
|
+
* - Preview media is upgraded from thumbnail to full video
|
|
1636
1644
|
* - Export settings are modified
|
|
1637
1645
|
*
|
|
1638
1646
|
* Use this to update your preview UI in real-time as users modify their design.
|
|
@@ -2,12 +2,6 @@
|
|
|
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
|
-
});
|
|
11
5
|
const _version = require("../version");
|
|
12
6
|
_export_star(require("./public"), exports);
|
|
13
7
|
function _export_star(from, to) {
|
|
@@ -23,5 +17,4 @@ function _export_star(from, to) {
|
|
|
23
17
|
});
|
|
24
18
|
return from;
|
|
25
19
|
}
|
|
26
|
-
const prepareContentPublisher = canva_sdk.intents.v1.content.prepareContentPublisher;
|
|
27
20
|
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', _version.LATEST_VERSION_BETA, 'beta');
|
|
@@ -19,6 +19,6 @@ _export(exports, {
|
|
|
19
19
|
return LATEST_VERSION_BETA;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const LATEST_VERSION = '2.
|
|
23
|
-
const LATEST_VERSION_BETA = '2.
|
|
22
|
+
const LATEST_VERSION = '2.6.0';
|
|
23
|
+
const LATEST_VERSION_BETA = '2.6.1-beta.0';
|
|
24
24
|
const LATEST_VERSION_ALPHA = 'NONE';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { LATEST_VERSION_BETA } from '../version';
|
|
2
2
|
export * from './public';
|
|
3
|
-
export const prepareContentPublisher = canva_sdk.intents.v1.content.prepareContentPublisher;
|
|
4
3
|
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', LATEST_VERSION_BETA, 'beta');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const LATEST_VERSION = '2.
|
|
2
|
-
export const LATEST_VERSION_BETA = '2.
|
|
1
|
+
export const LATEST_VERSION = '2.6.0';
|
|
2
|
+
export const LATEST_VERSION_BETA = '2.6.1-beta.0';
|
|
3
3
|
export const LATEST_VERSION_ALPHA = 'NONE';
|