@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 CHANGED
@@ -5,32 +5,46 @@ This package allows [Supertab.js](https://docs.supertab.co/) to be imported as a
5
5
  [![npm version](https://img.shields.io/npm/v/@getsupertab/supertab-js.svg?style=flat-square)](https://www.npmjs.com/package/@getsupertab/supertab-js)
6
6
  ## Installation
7
7
 
8
- Use `npm` to install the Supertab.js module:
8
+ Install Supertab.js from npm::
9
9
 
10
10
  ```sh
11
11
  npm install @getsupertab/supertab-js
12
12
  ```
13
13
 
14
- ## Usage Example
14
+ Import, load and initialize the client in your application:
15
+
16
+ ```javascript
17
+ import { loadSupertab } from "@getsupertab/supertab-js";
15
18
 
16
- Run the following code in a browser environment, it won't work on the server-side.
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 Supertab from "@getsupertab/supertab-js";
30
+ import { loadSupertab } from "@getsupertab/supertab-js";
20
31
 
21
- const supertab = new Supertab({
22
- clientId: "client.xyz",
23
- });
32
+ (async () => {
33
+ const { Supertab } = await loadSupertab();
34
+ const supertabClient = new Supertab({
35
+ clientId: "client.xyz",
36
+ });
24
37
 
25
- const { show } = supertab.createPaywall({
26
- experienceId: "experience.xyz",
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.
@@ -1,4 +1,4 @@
1
- import { c as R, g as z } from "./index-C6tos9Uc.js";
1
+ import { c as R, g as z } from "./index-r__jBsqX.js";
2
2
  function X(w, d) {
3
3
  for (var b = 0; b < d.length; b++) {
4
4
  const y = d[b];