@canva/platform 2.1.1 → 2.2.0-beta.1
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/{index.d.ts → beta.d.ts} +75 -0
- package/lib/cjs/sdk/platform/{index.js → beta.js} +1 -1
- package/lib/cjs/sdk/platform/public.js +9 -5
- package/lib/cjs/sdk/platform/test/beta.js +18 -0
- package/lib/cjs/sdk/utils/canva_sdk.js +5 -5
- package/lib/esm/sdk/platform/{index.js → beta.js} +1 -1
- package/lib/esm/sdk/platform/public.js +1 -0
- package/lib/esm/sdk/platform/test/beta.js +1 -0
- package/package.json +11 -11
- /package/test/{index.d.ts → beta.d.ts} +0 -0
package/{index.d.ts → beta.d.ts}
RENAMED
|
@@ -475,6 +475,41 @@ export declare interface FeatureSupport {
|
|
|
475
475
|
*/
|
|
476
476
|
export declare const getPlatformInfo: () => PlatformInfo;
|
|
477
477
|
|
|
478
|
+
/**
|
|
479
|
+
* @public
|
|
480
|
+
* Provides methods for interacting with notifications.
|
|
481
|
+
*/
|
|
482
|
+
export declare const notification: NotificationClient;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* @public
|
|
486
|
+
*
|
|
487
|
+
* Provides methods for interacting with notifications.
|
|
488
|
+
*/
|
|
489
|
+
export declare interface NotificationClient {
|
|
490
|
+
/**
|
|
491
|
+
* @public
|
|
492
|
+
*
|
|
493
|
+
* A method that shows a toast notification to the user.
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* ```tsx
|
|
497
|
+
* import { notification } from '@canva/platform';
|
|
498
|
+
* import type { ToastRequest } from '@canva/platform';
|
|
499
|
+
*
|
|
500
|
+
* const showToast = () => {
|
|
501
|
+
* const request: ToastRequest = {
|
|
502
|
+
* messageText: "Hello world!",
|
|
503
|
+
* };
|
|
504
|
+
* notification.addToast(request);
|
|
505
|
+
* };
|
|
506
|
+
*
|
|
507
|
+
* <Button onClick={() => showToast()}>Show Toast</Button>
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
addToast: (request: ToastRequest) => Promise<ToastResponse>;
|
|
511
|
+
}
|
|
512
|
+
|
|
478
513
|
/**
|
|
479
514
|
* @public
|
|
480
515
|
* A callback that runs when an app process is about to close.
|
|
@@ -646,4 +681,44 @@ export declare const requestOpenExternalUrl: (
|
|
|
646
681
|
request: OpenExternalUrlRequest,
|
|
647
682
|
) => Promise<OpenExternalUrlResponse>;
|
|
648
683
|
|
|
684
|
+
/**
|
|
685
|
+
* @public
|
|
686
|
+
* The result when a toast notification is successfully added.
|
|
687
|
+
*/
|
|
688
|
+
export declare type ToastCompleted = {
|
|
689
|
+
/**
|
|
690
|
+
* The status of the request.
|
|
691
|
+
*/
|
|
692
|
+
status: "completed";
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* @public
|
|
697
|
+
*
|
|
698
|
+
* Options for configuring a toast notification.
|
|
699
|
+
*/
|
|
700
|
+
export declare type ToastRequest = {
|
|
701
|
+
/**
|
|
702
|
+
* Text to show within the toast notification.
|
|
703
|
+
*/
|
|
704
|
+
messageText: string;
|
|
705
|
+
/**
|
|
706
|
+
* The duration that the notification will be visible.
|
|
707
|
+
*
|
|
708
|
+
* If set to `"infinite"`, the notification will be displayed until manually dismissed by the user.
|
|
709
|
+
*
|
|
710
|
+
* If set to a number, the notification will automatically disappear after that duration (in milliseconds).
|
|
711
|
+
*
|
|
712
|
+
* @defaultValue 5000
|
|
713
|
+
*/
|
|
714
|
+
timeoutMs?: number | "infinite";
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* @public
|
|
719
|
+
*
|
|
720
|
+
* The response from adding a toast notification.
|
|
721
|
+
*/
|
|
722
|
+
export declare type ToastResponse = ToastCompleted;
|
|
723
|
+
|
|
649
724
|
export {};
|
|
@@ -17,4 +17,4 @@ function _export_star(from, to) {
|
|
|
17
17
|
return from;
|
|
18
18
|
}
|
|
19
19
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
20
|
-
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('platform', '2.
|
|
20
|
+
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('platform', '2.2.0', 'beta');
|
|
@@ -5,25 +5,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
appProcess
|
|
12
|
+
get appProcess () {
|
|
13
13
|
return appProcess;
|
|
14
14
|
},
|
|
15
|
-
features
|
|
15
|
+
get features () {
|
|
16
16
|
return features;
|
|
17
17
|
},
|
|
18
|
-
getPlatformInfo
|
|
18
|
+
get getPlatformInfo () {
|
|
19
19
|
return getPlatformInfo;
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
get notification () {
|
|
22
|
+
return notification;
|
|
23
|
+
},
|
|
24
|
+
get requestOpenExternalUrl () {
|
|
22
25
|
return requestOpenExternalUrl;
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
28
|
const { canva_sdk } = window;
|
|
26
29
|
const appProcess = canva_sdk.platform.v2.appProcess;
|
|
27
30
|
const features = canva_sdk.platform.v2.features;
|
|
31
|
+
const notification = canva_sdk.platform.v2.notification;
|
|
28
32
|
const requestOpenExternalUrl = canva_sdk.platform.v2.platform.requestOpenExternalUrl;
|
|
29
33
|
const getPlatformInfo = canva_sdk.platform.v2.platform.getPlatformInfo;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./index"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
assertIsTestCanvaSdk
|
|
12
|
+
get assertIsTestCanvaSdk () {
|
|
13
13
|
return assertIsTestCanvaSdk;
|
|
14
14
|
},
|
|
15
|
-
bindMethodsToClients
|
|
15
|
+
get bindMethodsToClients () {
|
|
16
16
|
return bindMethodsToClients;
|
|
17
17
|
},
|
|
18
|
-
getCanvaSdk
|
|
18
|
+
get getCanvaSdk () {
|
|
19
19
|
return getCanvaSdk;
|
|
20
20
|
},
|
|
21
|
-
injectFakeAPIClients
|
|
21
|
+
get injectFakeAPIClients () {
|
|
22
22
|
return injectFakeAPIClients;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var _window___canva___sdkRegistration, _window___canva__;
|
|
2
2
|
export * from './public';
|
|
3
|
-
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('platform', '2.
|
|
3
|
+
(_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('platform', '2.2.0', 'beta');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { canva_sdk } = window;
|
|
2
2
|
export const appProcess = canva_sdk.platform.v2.appProcess;
|
|
3
3
|
export const features = canva_sdk.platform.v2.features;
|
|
4
|
+
export const notification = canva_sdk.platform.v2.notification;
|
|
4
5
|
export const requestOpenExternalUrl = canva_sdk.platform.v2.platform.requestOpenExternalUrl;
|
|
5
6
|
export const getPlatformInfo = canva_sdk.platform.v2.platform.getPlatformInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canva/platform",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-beta.1",
|
|
4
4
|
"description": "The Canva Apps SDK app platform library",
|
|
5
5
|
"author": "Canva Pty Ltd.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md FILE",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@canva/error": "^2.0.0"
|
|
9
9
|
},
|
|
10
|
-
"main": "./lib/cjs/sdk/platform/
|
|
11
|
-
"module": "./lib/esm/sdk/platform/
|
|
10
|
+
"main": "./lib/cjs/sdk/platform/beta.js",
|
|
11
|
+
"module": "./lib/esm/sdk/platform/beta.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"require": "./lib/cjs/sdk/platform/
|
|
16
|
-
"import": "./lib/esm/sdk/platform/
|
|
14
|
+
"types": "./beta.d.ts",
|
|
15
|
+
"require": "./lib/cjs/sdk/platform/beta.js",
|
|
16
|
+
"import": "./lib/esm/sdk/platform/beta.js"
|
|
17
17
|
},
|
|
18
18
|
"./test": {
|
|
19
|
-
"types": "./test/
|
|
20
|
-
"require": "./lib/cjs/sdk/platform/test/
|
|
21
|
-
"import": "./lib/esm/sdk/platform/test/
|
|
19
|
+
"types": "./test/beta.d.ts",
|
|
20
|
+
"require": "./lib/cjs/sdk/platform/test/beta.js",
|
|
21
|
+
"import": "./lib/esm/sdk/platform/test/beta.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"typings": "./
|
|
25
|
-
}
|
|
24
|
+
"typings": "./beta.d.ts"
|
|
25
|
+
}
|
|
File without changes
|