@canva/platform 0.0.1-rc.2 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +65 -0
  2. package/index.d.ts +5 -3
  3. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @canva/platform
2
+
3
+ A package for Canva's Apps SDK that provides utility methods.
4
+
5
+ ![](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
6
+
7
+ ## Table of contents
8
+
9
+ - [Introduction](#introduction)
10
+ - [Installation](#installation)
11
+ - [Usage](#usage)
12
+ - [API reference](#api-reference)
13
+ - [Related packages](#related-packages)
14
+ - [Contributing](#contributing)
15
+ - [License](#license)
16
+
17
+ ## Introduction
18
+
19
+ `@canva/platform` is an npm package for Canva's [Apps SDK](https://www.canva.dev/docs/apps). It provides utility methods that are useful for a broad range of apps. For example, the `requestOpenExternalUrl` method opens an external web page.
20
+
21
+ **Note:** To get up and running with the Apps SDK, check out [the quick start guide](https://www.canva.dev/docs/apps/quick-start).
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install @canva/platform
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ 1. Import a method or namespace from the `@canva/platform` package:
32
+
33
+ ```ts
34
+ import { getPlatformInfo } from '@canva/platform';
35
+ ```
36
+
37
+ 2. Call a method, passing in the required arguments (if any):
38
+
39
+ ```ts
40
+ getPlatformInfo();
41
+ ```
42
+
43
+ ## API reference
44
+
45
+ - [`getPlatformInfo`](https://www.canva.dev/docs/apps/api/platform-get-platform-info)
46
+ - [`requestOpenExternalUrl`](https://www.canva.dev/docs/apps/api/platform-request-open-external-url)
47
+
48
+ ## Related packages
49
+
50
+ The Apps SDK is made up of the following packages:
51
+
52
+ - [`@canva/app-ui-kit`](https://www.npmjs.com/package/@canva/app-ui-kit) - React-based component library for creating apps that mimic the look and feel of Canva.
53
+ - [`@canva/asset`](https://www.npmjs.com/package/@canva/asset) - Provides methods for working with assets, such as image and video files.
54
+ - [`@canva/design`](https://www.npmjs.com/package/@canva/design) - Provides methods for interacting with the user's design, such as creating elements.
55
+ - [`@canva/error`](https://www.npmjs.com/package/@canva/error) - Provides a `CanvaError` class for handling errors.
56
+ - [`@canva/platform`](https://www.npmjs.com/package/@canva/platform) - Provides utility methods, such as a method for opening external links.
57
+ - [`@canva/user`](https://www.npmjs.com/package/@canva/user) - Provides methods for accessing user data and authenticating users.
58
+
59
+ ## Contributing
60
+
61
+ We're actively developing this package but are not currently accepting third-party contributions. If you'd like to request any changes or additions to the package, submit a feature request via the [Canva Developers Community](https://community.canva.dev/).
62
+
63
+ ## License
64
+
65
+ See the `LICENSE.md` file.
package/index.d.ts CHANGED
@@ -54,12 +54,14 @@ export declare type PlatformInfo = {
54
54
  * If `true`, the app is allowed to directly link to payment and upgrade flows.
55
55
  *
56
56
  * @remarks
57
- * An example of when this is `false` is when the app is opened in Canva's iOS app.
58
- * This is because Apple's Human Interface Guidelines don't allow "calls to action that
59
- * direct customers to purchasing mechanisms other than in-app purchase."
57
+ * This property is always `true` when the app is running in a web browser, but may otherwise be `false` in
58
+ * order to comply with the policies of the platforms on which Canva is available. For example, some platforms
59
+ * only allow payment-related actions that use their own payment mechanisms and apps are therefore not allowed
60
+ * to render payment-related call-to-actions while running on those platforms.
60
61
  *
61
62
  * @example
62
63
  * const info = getPlatformInfo();
64
+ *
63
65
  * if (info.canAcceptPayments) {
64
66
  * // Display payment links and upgrade flows
65
67
  * } else {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@canva/platform",
3
- "version": "0.0.1-rc.2",
4
- "description": "The Canva Apps SDK App Platform Library",
3
+ "version": "1.0.1",
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
- "@canva/error": "^0.0.1-rc.1"
8
+ "@canva/error": "^1.0.0"
9
9
  },
10
10
  "main": "lib/cjs/sdk/platform/index.js",
11
11
  "module": "lib/esm/sdk/platform/index.js",