@tryheliumai/paywall-sdk-react-native 0.1.12 → 0.1.14
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
|
@@ -26,6 +26,30 @@ cd ..
|
|
|
26
26
|
npx react-native link @tryheliumai/paywall-sdk-react-native
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
### TypeScript Configuration
|
|
30
|
+
|
|
31
|
+
If you encounter TypeScript errors related to module resolution, you may need to update your `tsconfig.json` file. The SDK uses modern module resolution, so you'll need to set the `moduleResolution` option to one of the following:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"compilerOptions": {
|
|
36
|
+
"moduleResolution": "node16" // or "nodenext" or "bundler"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Alternatively, you can add a `paths` entry to your `tsconfig.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"compilerOptions": {
|
|
46
|
+
"paths": {
|
|
47
|
+
"@tryheliumai/paywall-sdk-react-native": ["./node_modules/@tryheliumai/paywall-sdk-react-native/lib/typescript/module/src/index.d.ts"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
29
53
|
## **Configuration**
|
|
30
54
|
|
|
31
55
|
### Provider Setup
|
|
@@ -48,13 +48,6 @@ class BridgingPaywallDelegate: HeliumPaywallDelegate {
|
|
|
48
48
|
return await withCheckedContinuation { continuation in
|
|
49
49
|
let transactionId = UUID().uuidString
|
|
50
50
|
|
|
51
|
-
let userInfo: [String: Any] = [
|
|
52
|
-
NSLocalizedDescriptionKey: "Failed to make purchase",
|
|
53
|
-
NSLocalizedFailureReasonErrorKey: "An unknown error occurred",
|
|
54
|
-
NSLocalizedRecoverySuggestionErrorKey: "Please try again later"
|
|
55
|
-
]
|
|
56
|
-
let failureError = NSError(domain: "PaywallErrorDomain", code: 1001, userInfo: userInfo)
|
|
57
|
-
|
|
58
51
|
// Store continuation callback
|
|
59
52
|
purchaseState.pendingResponses[transactionId] = { response in
|
|
60
53
|
let status: HeliumPaywallTransactionStatus = switch response.status {
|
|
@@ -62,9 +55,8 @@ class BridgingPaywallDelegate: HeliumPaywallDelegate {
|
|
|
62
55
|
case "purchased": .purchased
|
|
63
56
|
case "cancelled": .cancelled
|
|
64
57
|
case "restored": .restored
|
|
65
|
-
case "failed": .failed(failureError)
|
|
66
58
|
case "pending": .pending
|
|
67
|
-
default: .failed(
|
|
59
|
+
default: .failed(NSError())
|
|
68
60
|
}
|
|
69
61
|
continuation.resume(returning: status)
|
|
70
62
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HeliumTransactionStatus = '
|
|
1
|
+
export type HeliumTransactionStatus = 'completed' | 'failed' | 'cancelled' | 'pending' | 'restored';
|
|
2
2
|
export type HeliumDownloadStatus = 'success' | 'failed' | 'inProgress' | 'notStarted';
|
|
3
3
|
export interface HeliumCallbacks {
|
|
4
4
|
makePurchase: (productId: string) => Promise<HeliumTransactionStatus>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HeliumTransactionStatus = '
|
|
1
|
+
export type HeliumTransactionStatus = 'completed' | 'failed' | 'cancelled' | 'pending' | 'restored';
|
|
2
2
|
export type HeliumDownloadStatus = 'success' | 'failed' | 'inProgress' | 'notStarted';
|
|
3
3
|
export interface HeliumCallbacks {
|
|
4
4
|
makePurchase: (productId: string) => Promise<HeliumTransactionStatus>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryheliumai/paywall-sdk-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Paywall SDK Helium",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
7
7
|
"module": "./lib/module/index.js",
|
|
8
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
9
|
+
"typesVersions": {
|
|
10
|
+
"*": {
|
|
11
|
+
"*": [
|
|
12
|
+
"./lib/typescript/module/src/index.d.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"exports": {
|
|
9
17
|
".": {
|
|
10
18
|
"import": {
|
|
@@ -14,7 +22,8 @@
|
|
|
14
22
|
"require": {
|
|
15
23
|
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
24
|
"default": "./lib/commonjs/index.js"
|
|
17
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./lib/typescript/module/src/index.d.ts"
|
|
18
27
|
}
|
|
19
28
|
},
|
|
20
29
|
"files": [
|
|
@@ -175,7 +184,8 @@
|
|
|
175
184
|
"typescript",
|
|
176
185
|
{
|
|
177
186
|
"project": "tsconfig.build.json",
|
|
178
|
-
"esm": true
|
|
187
|
+
"esm": true,
|
|
188
|
+
"tscOptions": ["--declaration", "--emitDeclarationOnly"]
|
|
179
189
|
}
|
|
180
190
|
]
|
|
181
191
|
]
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HeliumTransactionStatus = '
|
|
1
|
+
export type HeliumTransactionStatus = 'completed' | 'failed' | 'cancelled' | 'pending' | 'restored';
|
|
2
2
|
export type HeliumDownloadStatus = 'success' | 'failed' | 'inProgress' | 'notStarted';
|
|
3
3
|
|
|
4
4
|
export interface HeliumCallbacks {
|