@canva/platform 0.0.1-rc.1 → 0.0.1-rc.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/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @public
3
+ * Returns information about the platform on which the app is running.
4
+ */
5
+ export declare function getPlatformInfo(): PlatformInfo;
6
+
1
7
  /**
2
8
  * @public
3
9
  * The result of opening an external URL when a user chooses to not navigate away from Canva.
@@ -39,6 +45,31 @@ export declare type OpenExternalUrlResponse =
39
45
  | OpenExternalUrlCompleted
40
46
  | OpenExternalUrlAborted;
41
47
 
48
+ /**
49
+ * @public
50
+ * Information about the platform on which the app is running.
51
+ */
52
+ export declare type PlatformInfo = {
53
+ /**
54
+ * If `true`, the app is allowed to directly link to payment and upgrade flows.
55
+ *
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."
60
+ *
61
+ * @example
62
+ * const info = getPlatformInfo();
63
+ * if (info.canAcceptPayments) {
64
+ * // Display payment links and upgrade flows
65
+ * } else {
66
+ * // Hide payment links and upgrade flows
67
+ * // Optionally show an appropriate message
68
+ * }
69
+ */
70
+ canAcceptPayments: boolean;
71
+ };
72
+
42
73
  /**
43
74
  * @public
44
75
  * Opens an external URL.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requestOpenExternalUrl = void 0;
3
+ exports.getPlatformInfo = exports.requestOpenExternalUrl = void 0;
4
4
  const { canva } = window;
5
5
  /**
6
6
  * @public
@@ -15,3 +15,11 @@ function requestOpenExternalUrl(request) {
15
15
  return canva.platform.requestOpenExternalUrl(request);
16
16
  }
17
17
  exports.requestOpenExternalUrl = requestOpenExternalUrl;
18
+ /**
19
+ * @public
20
+ * Returns information about the platform on which the app is running.
21
+ */
22
+ function getPlatformInfo() {
23
+ return canva.platform.getPlatformInfo();
24
+ }
25
+ exports.getPlatformInfo = getPlatformInfo;
@@ -11,3 +11,10 @@ const { canva } = window;
11
11
  export function requestOpenExternalUrl(request) {
12
12
  return canva.platform.requestOpenExternalUrl(request);
13
13
  }
14
+ /**
15
+ * @public
16
+ * Returns information about the platform on which the app is running.
17
+ */
18
+ export function getPlatformInfo() {
19
+ return canva.platform.getPlatformInfo();
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/platform",
3
- "version": "0.0.1-rc.1",
3
+ "version": "0.0.1-rc.2",
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",