expo-iap 2.9.0-rc.2 → 2.9.0-rc.4
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/CHANGELOG.md +29 -6
- package/CLAUDE.md +40 -0
- package/CONTRIBUTING.md +4 -3
- package/build/helpers/subscription.d.ts +3 -0
- package/build/helpers/subscription.d.ts.map +1 -1
- package/build/helpers/subscription.js +9 -3
- package/build/helpers/subscription.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +29 -10
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts +1 -2
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts +5 -7
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +2 -3
- package/build/modules/ios.js.map +1 -1
- package/build/types/ExpoIapAndroid.types.d.ts +2 -2
- package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
- package/build/types/ExpoIapAndroid.types.js.map +1 -1
- package/build/types/ExpoIapIOS.types.d.ts +3 -3
- package/build/types/ExpoIapIOS.types.d.ts.map +1 -1
- package/build/types/ExpoIapIOS.types.js.map +1 -1
- package/build/useIAP.d.ts +1 -1
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +54 -33
- package/build/useIAP.js.map +1 -1
- package/build/utils/constants.d.ts +4 -0
- package/build/utils/constants.d.ts.map +1 -0
- package/build/utils/constants.js +12 -0
- package/build/utils/constants.js.map +1 -0
- package/ios/ExpoIap.podspec +1 -1
- package/ios/ExpoIapModule.swift +334 -334
- package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/jest.config.js +19 -14
- package/package.json +1 -1
- package/plugin/build/withIAP.js +84 -17
- package/plugin/src/withIAP.ts +71 -25
- package/plugin/src/withLocalOpenIAP.ts +3 -1
- package/src/helpers/subscription.ts +34 -21
- package/src/index.ts +53 -36
- package/src/modules/android.ts +8 -9
- package/src/modules/ios.ts +10 -15
- package/src/types/ExpoIapAndroid.types.ts +4 -3
- package/src/types/ExpoIapIOS.types.ts +3 -4
- package/src/useIAP.ts +73 -52
- package/src/utils/constants.ts +14 -0
- package/ios/ProductStore.swift +0 -27
- package/ios/Types.swift +0 -96
package/ios/Types.swift
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IapTypes.swift
|
|
3
|
-
// RNIap
|
|
4
|
-
//
|
|
5
|
-
// Created by Andres Aguilar on 8/18/22.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import StoreKit
|
|
10
|
-
|
|
11
|
-
public enum StoreError: Error {
|
|
12
|
-
case failedVerification
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Error codes for IAP operations - centralized error code management
|
|
16
|
-
struct IapErrorCode {
|
|
17
|
-
// Constants for code usage - safe pattern without force unwrapping
|
|
18
|
-
static let unknown = "E_UNKNOWN"
|
|
19
|
-
static let serviceError = "E_SERVICE_ERROR"
|
|
20
|
-
static let userCancelled = "E_USER_CANCELLED"
|
|
21
|
-
static let userError = "E_USER_ERROR"
|
|
22
|
-
static let itemUnavailable = "E_ITEM_UNAVAILABLE"
|
|
23
|
-
static let remoteError = "E_REMOTE_ERROR"
|
|
24
|
-
static let networkError = "E_NETWORK_ERROR"
|
|
25
|
-
static let receiptFailed = "E_RECEIPT_FAILED"
|
|
26
|
-
static let receiptFinishedFailed = "E_RECEIPT_FINISHED_FAILED"
|
|
27
|
-
static let notPrepared = "E_NOT_PREPARED"
|
|
28
|
-
static let notEnded = "E_NOT_ENDED"
|
|
29
|
-
static let alreadyOwned = "E_ALREADY_OWNED"
|
|
30
|
-
static let developerError = "E_DEVELOPER_ERROR"
|
|
31
|
-
static let purchaseError = "E_PURCHASE_ERROR"
|
|
32
|
-
static let syncError = "E_SYNC_ERROR"
|
|
33
|
-
static let deferredPayment = "E_DEFERRED_PAYMENT"
|
|
34
|
-
static let transactionValidationFailed = "E_TRANSACTION_VALIDATION_FAILED"
|
|
35
|
-
static let billingResponseJsonParseError = "E_BILLING_RESPONSE_JSON_PARSE_ERROR"
|
|
36
|
-
static let interrupted = "E_INTERRUPTED"
|
|
37
|
-
static let iapNotAvailable = "E_IAP_NOT_AVAILABLE"
|
|
38
|
-
static let activityUnavailable = "E_ACTIVITY_UNAVAILABLE"
|
|
39
|
-
static let alreadyPrepared = "E_ALREADY_PREPARED"
|
|
40
|
-
static let pending = "E_PENDING"
|
|
41
|
-
static let connectionClosed = "E_CONNECTION_CLOSED"
|
|
42
|
-
|
|
43
|
-
// Cached dictionary for Constants export - using constants as keys to avoid duplication
|
|
44
|
-
private static let _cachedDictionary: [String: String] = [
|
|
45
|
-
unknown: unknown,
|
|
46
|
-
serviceError: serviceError,
|
|
47
|
-
userCancelled: userCancelled,
|
|
48
|
-
userError: userError,
|
|
49
|
-
itemUnavailable: itemUnavailable,
|
|
50
|
-
remoteError: remoteError,
|
|
51
|
-
networkError: networkError,
|
|
52
|
-
receiptFailed: receiptFailed,
|
|
53
|
-
receiptFinishedFailed: receiptFinishedFailed,
|
|
54
|
-
notPrepared: notPrepared,
|
|
55
|
-
notEnded: notEnded,
|
|
56
|
-
alreadyOwned: alreadyOwned,
|
|
57
|
-
developerError: developerError,
|
|
58
|
-
purchaseError: purchaseError,
|
|
59
|
-
syncError: syncError,
|
|
60
|
-
deferredPayment: deferredPayment,
|
|
61
|
-
transactionValidationFailed: transactionValidationFailed,
|
|
62
|
-
billingResponseJsonParseError: billingResponseJsonParseError,
|
|
63
|
-
interrupted: interrupted,
|
|
64
|
-
iapNotAvailable: iapNotAvailable,
|
|
65
|
-
activityUnavailable: activityUnavailable,
|
|
66
|
-
alreadyPrepared: alreadyPrepared,
|
|
67
|
-
pending: pending,
|
|
68
|
-
connectionClosed: connectionClosed
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
// Return cached dictionary - no allocation on repeated calls
|
|
72
|
-
static func toDictionary() -> [String: String] {
|
|
73
|
-
return _cachedDictionary
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Based on https://stackoverflow.com/a/40135192/570612
|
|
78
|
-
extension Date {
|
|
79
|
-
var millisecondsSince1970: Int64 {
|
|
80
|
-
return Int64((self.timeIntervalSince1970 * 1000.0).rounded())
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var millisecondsSince1970String: String {
|
|
84
|
-
return String(self.millisecondsSince1970)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
init(milliseconds: Int64) {
|
|
88
|
-
self = Date(timeIntervalSince1970: TimeInterval(milliseconds) / 1000)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
extension SKProductsRequest {
|
|
93
|
-
var key: String {
|
|
94
|
-
return String(self.hashValue)
|
|
95
|
-
}
|
|
96
|
-
}
|