@getsupertab/supertab-js 3.53.0 → 3.53.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/README.md +27 -13
- package/dist/pkg/prod/{browser-ponyfill-DN54DaX4.js → browser-ponyfill-DLEgFbYS.js} +1 -1
- package/dist/pkg/prod/{index-C6tos9Uc.js → index-r__jBsqX.js} +2776 -2776
- package/dist/pkg/prod/{sentry-COwwrnEj.js → sentry-BhHX203q.js} +1 -1
- package/dist/pkg/prod/supertab.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,32 +5,46 @@ This package allows [Supertab.js](https://docs.supertab.co/) to be imported as a
|
|
|
5
5
|
[](https://www.npmjs.com/package/@getsupertab/supertab-js)
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Install Supertab.js from npm::
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
11
|
npm install @getsupertab/supertab-js
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Import, load and initialize the client in your application:
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
import { loadSupertab } from "@getsupertab/supertab-js";
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
(async () => {
|
|
20
|
+
const { Supertab } = await loadSupertab();
|
|
21
|
+
const supertabClient = new Supertab({ clientId: "test_client.X" });
|
|
22
|
+
})();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`loadSupertab()` loads the latest compatible Supertab.js version from our CDN. It must be called in a browser environment—it won't work server-side.
|
|
26
|
+
|
|
27
|
+
## Usage Example
|
|
17
28
|
|
|
18
29
|
```javascript
|
|
19
|
-
import
|
|
30
|
+
import { loadSupertab } from "@getsupertab/supertab-js";
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
(async () => {
|
|
33
|
+
const { Supertab } = await loadSupertab();
|
|
34
|
+
const supertabClient = new Supertab({
|
|
35
|
+
clientId: "client.xyz",
|
|
36
|
+
});
|
|
24
37
|
|
|
25
|
-
const { show } =
|
|
26
|
-
|
|
27
|
-
});
|
|
38
|
+
const { show } = await supertabClient.createPaywall({
|
|
39
|
+
experienceId: "experience.xyz",
|
|
40
|
+
});
|
|
28
41
|
|
|
29
|
-
const paywallResult = await show();
|
|
30
|
-
console.log(paywallResult);
|
|
42
|
+
const paywallResult = await show();
|
|
43
|
+
console.log(paywallResult);
|
|
44
|
+
})();
|
|
31
45
|
```
|
|
32
46
|
|
|
33
|
-
This example creates a new Supertab.js instance using the `new Supertab()` constructor.
|
|
47
|
+
This example loads Supertab and creates a new Supertab.js instance using the `new Supertab()` constructor.
|
|
34
48
|
Then, the `createPaywall` method is used to create a new paywall.
|
|
35
49
|
The `show` function renders the paywall. Finally, once the user has completed or cancelled the purchase,
|
|
36
50
|
we print the result data to the browser console.
|