@canva/platform 0.0.1-rc.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/LICENSE.md ADDED
@@ -0,0 +1,48 @@
1
+ # A message from Canva
2
+
3
+ By making these software components available to you, our goal is to give you
4
+ the right to use the components to build your apps for Canva's ecosystem. See
5
+ below for the specific licence terms that apply to your use.
6
+
7
+ # Licence
8
+
9
+ Canva Pty Ltd (ACN 158 929 938) ("Canva") owns the copyright in the software and
10
+ associated documentation files to which this Licence relates (each a "Software
11
+ Component"). Canva reserves all of its rights.
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
14
+ the Software Components ("You"), to use the Software Components, but strictly
15
+ subject to the following restrictions and conditions:
16
+
17
+ 1. You must only use the Software Components and any Derivative on the Canva
18
+ Platform.
19
+
20
+ 2. You must only use the Software Components and any Derivative for the purpose
21
+ of building or updating Permitted Apps, and for no other purpose.
22
+
23
+ 3. You must include a copy of this Licence in all copies of any Software
24
+ Component and Derivative.
25
+
26
+ 4. To the fullest extent permitted by law, the Software Components are provided
27
+ "as is", without warranty of any kind, express or implied, including but not
28
+ limited to the warranties of merchantability, fitness for a particular
29
+ purpose and non-infringement. To the fullest extent permitted by law, in no
30
+ event shall the authors or copyright holders be liable for any claim,
31
+ damages or other liability, whether in an action of contract, tort or
32
+ otherwise, arising from, out of or in connection with the Software Components
33
+ or any Derivative, or the use of or other dealings in the Software Components
34
+ or any Derivative.
35
+
36
+ 5. In this Licence:
37
+
38
+ (a) "Canva Platform" means the visual communications platform owned and
39
+ operated by Canva that is made available on Canva.com (as well as any
40
+ sub-domains and international versions) and via mobile applications, desktop
41
+ applications, and in other forms provided or made available by Canva;
42
+
43
+ (b) "Derivative" means any software, document or other material that: (i)
44
+ contains any Software Component; and/or (ii) comprises or contains a
45
+ derivative, adaptation or substantial part of any Software Component; and
46
+
47
+ (c) "Permitted App" means a software application that is solely offered to
48
+ end-users on the Canva Platform.
package/index.d.ts ADDED
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @public
3
+ * The result of opening an external URL when a user chooses to not navigate away from Canva.
4
+ */
5
+ export declare type OpenExternalUrlAborted = {
6
+ /**
7
+ * The status of the request.
8
+ */
9
+ status: "ABORTED";
10
+ };
11
+
12
+ /**
13
+ * @public
14
+ * The result of opening an external URL when a user agrees to navigate away from Canva.
15
+ */
16
+ export declare type OpenExternalUrlCompleted = {
17
+ /**
18
+ * The status of the request.
19
+ */
20
+ status: "COMPLETED";
21
+ };
22
+
23
+ /**
24
+ * @public
25
+ * The options for opening an external URL.
26
+ */
27
+ export declare type OpenExternalUrlRequest = {
28
+ /**
29
+ * The URL to open in a new window
30
+ */
31
+ url: string;
32
+ };
33
+
34
+ /**
35
+ * @public
36
+ * The result of opening an external URL.
37
+ */
38
+ export declare type OpenExternalUrlResponse =
39
+ | OpenExternalUrlCompleted
40
+ | OpenExternalUrlAborted;
41
+
42
+ /**
43
+ * @public
44
+ * Opens an external URL.
45
+ *
46
+ * @remarks
47
+ * The URL is opened natively, such as in a new browser tab on desktop or in a browser sheet on mobile.
48
+ *
49
+ * In some browsers, the user must enable popup permissions before any URL can be opened.
50
+ */
51
+ export declare function requestOpenExternalUrl(
52
+ request: OpenExternalUrlRequest
53
+ ): Promise<OpenExternalUrlResponse>;
54
+
55
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./public"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestOpenExternalUrl = void 0;
4
+ const { canva } = window;
5
+ /**
6
+ * @public
7
+ * Opens an external URL.
8
+ *
9
+ * @remarks
10
+ * The URL is opened natively, such as in a new browser tab on desktop or in a browser sheet on mobile.
11
+ *
12
+ * In some browsers, the user must enable popup permissions before any URL can be opened.
13
+ */
14
+ function requestOpenExternalUrl(request) {
15
+ return canva.platform.requestOpenExternalUrl(request);
16
+ }
17
+ exports.requestOpenExternalUrl = requestOpenExternalUrl;
@@ -0,0 +1 @@
1
+ export * from './public';
@@ -0,0 +1,13 @@
1
+ const { canva } = window;
2
+ /**
3
+ * @public
4
+ * Opens an external URL.
5
+ *
6
+ * @remarks
7
+ * The URL is opened natively, such as in a new browser tab on desktop or in a browser sheet on mobile.
8
+ *
9
+ * In some browsers, the user must enable popup permissions before any URL can be opened.
10
+ */
11
+ export function requestOpenExternalUrl(request) {
12
+ return canva.platform.requestOpenExternalUrl(request);
13
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@canva/platform",
3
+ "version": "0.0.1-rc.1",
4
+ "description": "The Canva Apps SDK App Platform Library",
5
+ "author": "Canva Pty Ltd.",
6
+ "license": "SEE LICENSE IN LICENSE.md FILE",
7
+ "peerDependencies": {
8
+ "@canva/error": "^0.0.1-rc.1"
9
+ },
10
+ "main": "lib/cjs/sdk/platform/index.js",
11
+ "module": "lib/esm/sdk/platform/index.js",
12
+ "exports": {
13
+ ".": {
14
+ "require": "./lib/cjs/sdk/platform/index.js",
15
+ "import": "./lib/esm/sdk/platform/index.js"
16
+ }
17
+ },
18
+ "typings": "./index.d.ts"
19
+ }