@tryheliumai/paywall-sdk-react-native 0.1.11 → 0.1.12
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.
|
@@ -48,14 +48,23 @@ 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
|
+
|
|
51
58
|
// Store continuation callback
|
|
52
59
|
purchaseState.pendingResponses[transactionId] = { response in
|
|
53
60
|
let status: HeliumPaywallTransactionStatus = switch response.status {
|
|
61
|
+
case "completed": .purchased
|
|
54
62
|
case "purchased": .purchased
|
|
55
63
|
case "cancelled": .cancelled
|
|
56
64
|
case "restored": .restored
|
|
65
|
+
case "failed": .failed(failureError)
|
|
57
66
|
case "pending": .pending
|
|
58
|
-
default: .failed(
|
|
67
|
+
default: .failed(failureError)
|
|
59
68
|
}
|
|
60
69
|
continuation.resume(returning: status)
|
|
61
70
|
}
|
|
@@ -185,7 +194,7 @@ class HeliumBridge: RCTEventEmitter {
|
|
|
185
194
|
self.bridgingDelegate = BridgingPaywallDelegate(
|
|
186
195
|
bridge: self
|
|
187
196
|
)
|
|
188
|
-
|
|
197
|
+
|
|
189
198
|
// Always do view lookup on main queue
|
|
190
199
|
DispatchQueue.main.async {
|
|
191
200
|
let startTime = CFAbsoluteTimeGetCurrent()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HeliumTransactionStatus = '
|
|
1
|
+
export type HeliumTransactionStatus = 'purchased' | '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 = 'purchased' | '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
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HeliumTransactionStatus = '
|
|
1
|
+
export type HeliumTransactionStatus = 'purchased' | 'failed' | 'cancelled' | 'pending' | 'restored';
|
|
2
2
|
export type HeliumDownloadStatus = 'success' | 'failed' | 'inProgress' | 'notStarted';
|
|
3
3
|
|
|
4
4
|
export interface HeliumCallbacks {
|