react-native-iap 8.0.7 → 8.0.10
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/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-3.2.0.cjs +785 -0
- package/.yarnrc.yml +1 -1
- package/README.md +2 -0
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonModule.kt +4 -1
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +4 -1
- package/index.js.flow +1 -1
- package/ios/RNIapIos.swift +18 -18
- package/package.json +26 -26
- package/src/iap.d.ts +5 -5
- package/.yarn/releases/yarn-3.1.1.cjs +0 -768
package/.yarnrc.yml
CHANGED
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ Published in [website](https://react-native-iap.dooboolab.com).
|
|
|
20
20
|
|
|
21
21
|
## Announcement
|
|
22
22
|
|
|
23
|
+
- Current module is ported to [expo-iap](https://www.npmjs.com/package/expo-iap) which share the same codebase but different environment. This is currently experimental but you can use it in expo managed workflow. The source code is maintained in branch [expo](https://github.com/dooboolab/react-native-iap/tree/expo).
|
|
24
|
+
|
|
23
25
|
- Version `8.0.0` has finally landed in Jan 28th. Since this is early release, please use it with caution 🚧. We recommend user to use `>=8.0.0` with react-native `>=0.65.1`. The `next` package is no longer updated until we organize the roadmap for `9.0.0`.
|
|
24
26
|
|
|
25
27
|
- Version `8.0.0` is currently in release candidate. The module is completely rewritten with `Kotlin` and `Swift` for maintenenance issue by [andresesfm](https://github.com/andresesfm) 🔆. You may install this for early preview.
|
|
@@ -51,7 +51,10 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext?) :
|
|
|
51
51
|
var ii = 0
|
|
52
52
|
val skuSize = skuArr.size()
|
|
53
53
|
while (ii < skuSize) {
|
|
54
|
-
|
|
54
|
+
val sku = skuArr.getString(ii)
|
|
55
|
+
if (sku is String) {
|
|
56
|
+
productSkus.add(sku)
|
|
57
|
+
}
|
|
55
58
|
ii++
|
|
56
59
|
}
|
|
57
60
|
DoobooUtils.instance.addPromiseForKey(PROMISE_GET_PRODUCT_DATA, promise)
|
|
@@ -203,7 +203,10 @@ class RNIapModule(reactContext: ReactApplicationContext) :
|
|
|
203
203
|
override fun run(billingClient: BillingClient) {
|
|
204
204
|
val skuList = ArrayList<String>()
|
|
205
205
|
for (i in 0 until skuArr.size()) {
|
|
206
|
-
|
|
206
|
+
val sku = skuArr.getString(i)
|
|
207
|
+
if (sku is String) {
|
|
208
|
+
skuList.add(sku)
|
|
209
|
+
}
|
|
207
210
|
}
|
|
208
211
|
val params = SkuDetailsParams.newBuilder()
|
|
209
212
|
params.setSkusList(skuList).setType(type!!)
|
package/index.js.flow
CHANGED
package/ios/RNIapIos.swift
CHANGED
|
@@ -215,8 +215,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
215
215
|
|
|
216
216
|
@objc public func buyProductWithOffer(
|
|
217
217
|
_ sku: String,
|
|
218
|
-
usernameHash: String,
|
|
219
|
-
discountOffer: Dictionary<String,String>,
|
|
218
|
+
forUser usernameHash: String,
|
|
219
|
+
withOffer discountOffer: Dictionary<String,String>,
|
|
220
220
|
resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
221
221
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
222
222
|
) {
|
|
@@ -236,8 +236,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
236
236
|
addPromise(forKey: prod.productIdentifier, resolve: resolve, reject: reject)
|
|
237
237
|
|
|
238
238
|
let payment: SKMutablePayment = SKMutablePayment(product: prod)
|
|
239
|
-
|
|
240
|
-
if #available(iOS 12.2, *) {
|
|
239
|
+
|
|
240
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
241
241
|
let discount: SKPaymentDiscount = SKPaymentDiscount(
|
|
242
242
|
identifier: discountOffer["identifier"]!,
|
|
243
243
|
keyIdentifier: discountOffer["keyIdentifier"]!,
|
|
@@ -416,7 +416,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
416
416
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
417
417
|
) {
|
|
418
418
|
#if !os(tvOS)
|
|
419
|
-
if #available(iOS 14.0, *) {
|
|
419
|
+
if #available(iOS 14.0, tvOS 14.0, *) {
|
|
420
420
|
SKPaymentQueue.default().presentCodeRedemptionSheet()
|
|
421
421
|
resolve(nil)
|
|
422
422
|
} else {
|
|
@@ -627,7 +627,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
627
627
|
return descriptions[0]
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
if code > descriptions.count - 1 {
|
|
630
|
+
if code > descriptions.count - 1 || code < 0 { // Fix crash app without internet connection
|
|
631
631
|
return descriptions[0]
|
|
632
632
|
}
|
|
633
633
|
return descriptions[code]
|
|
@@ -654,8 +654,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
654
654
|
var periodUnitIOS = ""
|
|
655
655
|
|
|
656
656
|
var itemType = "iap"
|
|
657
|
-
|
|
658
|
-
if #available(iOS 11.2, *) {
|
|
657
|
+
|
|
658
|
+
if #available(iOS 11.2, tvOS 11.2, *) {
|
|
659
659
|
let numOfUnits = UInt(product.subscriptionPeriod?.numberOfUnits ?? 0)
|
|
660
660
|
let unit = product.subscriptionPeriod?.unit
|
|
661
661
|
|
|
@@ -718,22 +718,22 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
718
718
|
introductoryPriceSubscriptionPeriod = ""
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
if #available(iOS 10.0, *) {
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
if #available(iOS 10.0, tvOS 10.0, *) {
|
|
725
725
|
currencyCode = product.priceLocale.currencyCode
|
|
726
726
|
}
|
|
727
|
-
|
|
728
|
-
if #available(iOS 13.0, *) {
|
|
727
|
+
|
|
728
|
+
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
729
729
|
countryCode = SKPaymentQueue.default().storefront?.countryCode
|
|
730
|
-
} else if #available(iOS 10.0, *) {
|
|
730
|
+
} else if #available(iOS 10.0, tvOS 10.0, *) {
|
|
731
731
|
countryCode = product.priceLocale.regionCode
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
var discounts: [[String: String?]]?
|
|
735
|
-
|
|
736
|
-
if #available(iOS 12.2, *) {
|
|
735
|
+
|
|
736
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
737
737
|
discounts = getDiscountData(product)
|
|
738
738
|
}
|
|
739
739
|
|
|
@@ -763,7 +763,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
763
763
|
|
|
764
764
|
|
|
765
765
|
func getDiscountData(_ product: SKProduct) -> [[String:String?]]? {
|
|
766
|
-
if #available(iOS 12.2, *) {
|
|
766
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
767
767
|
var mappedDiscounts : [[String:String?]] = []
|
|
768
768
|
var localizedPrice: String?
|
|
769
769
|
var paymendMode: String?
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "8.0.
|
|
4
|
-
"packageManager": "yarn@3.
|
|
3
|
+
"version": "8.0.10",
|
|
4
|
+
"packageManager": "yarn@3.2.0",
|
|
5
5
|
"description": "React Native In App Purchase Module.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -44,31 +44,31 @@
|
|
|
44
44
|
"dooboolab-welcome": "1.3.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "7.
|
|
48
|
-
"@babel/plugin-proposal-class-properties": "7.
|
|
49
|
-
"@babel/plugin-proposal-private-methods": "7.
|
|
50
|
-
"@babel/preset-env": "7.
|
|
51
|
-
"@babel/preset-react": "7.
|
|
52
|
-
"@babel/preset-typescript": "7.
|
|
53
|
-
"@dooboo/eslint-config": "1.
|
|
54
|
-
"@testing-library/jest-native": "4.0.
|
|
55
|
-
"@testing-library/react-native": "
|
|
56
|
-
"@types/eslint": "8.2
|
|
57
|
-
"@types/jest": "27.
|
|
58
|
-
"@types/react": "
|
|
59
|
-
"@types/react-native": "0.
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
47
|
+
"@babel/core": "7.18.2",
|
|
48
|
+
"@babel/plugin-proposal-class-properties": "7.17.12",
|
|
49
|
+
"@babel/plugin-proposal-private-methods": "7.17.12",
|
|
50
|
+
"@babel/preset-env": "7.18.2",
|
|
51
|
+
"@babel/preset-react": "7.17.12",
|
|
52
|
+
"@babel/preset-typescript": "7.17.12",
|
|
53
|
+
"@dooboo/eslint-config": "1.3.4",
|
|
54
|
+
"@testing-library/jest-native": "4.0.5",
|
|
55
|
+
"@testing-library/react-native": "9.1.0",
|
|
56
|
+
"@types/eslint": "8.4.2",
|
|
57
|
+
"@types/jest": "27.5.1",
|
|
58
|
+
"@types/react": "18.0.10",
|
|
59
|
+
"@types/react-native": "0.67.7",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
|
61
61
|
"babel-core": "7.0.0-bridge.0",
|
|
62
|
-
"babel-jest": "
|
|
63
|
-
"eslint": "8.
|
|
64
|
-
"flow-bin": "0.
|
|
65
|
-
"flowgen": "1.
|
|
66
|
-
"jest": "
|
|
67
|
-
"metro-react-native-babel-preset": "0.
|
|
62
|
+
"babel-jest": "28.1.0",
|
|
63
|
+
"eslint": "8.16.0",
|
|
64
|
+
"flow-bin": "0.179.0",
|
|
65
|
+
"flowgen": "1.19.0",
|
|
66
|
+
"jest": "28.1.0",
|
|
67
|
+
"metro-react-native-babel-preset": "0.71.0",
|
|
68
68
|
"monolinter": "1.0.4",
|
|
69
|
-
"prettier": "2.
|
|
70
|
-
"react-native": "0.
|
|
71
|
-
"ts-jest": "
|
|
72
|
-
"typescript": "4.
|
|
69
|
+
"prettier": "2.6.2",
|
|
70
|
+
"react-native": "0.66.4",
|
|
71
|
+
"ts-jest": "28.0.3",
|
|
72
|
+
"typescript": "4.7.2"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/iap.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export declare const requestPurchaseWithQuantityIOS: (sku: string, quantity: num
|
|
|
79
79
|
* @param {string} developerPayloadAndroid Android developerPayload.
|
|
80
80
|
* @returns {Promise<string | void> }
|
|
81
81
|
*/
|
|
82
|
-
export declare const finishTransaction: (purchase: InAppPurchase | ProductPurchase, isConsumable?: boolean
|
|
82
|
+
export declare const finishTransaction: (purchase: InAppPurchase | ProductPurchase, isConsumable?: boolean, developerPayloadAndroid?: string) => Promise<string | void>;
|
|
83
83
|
/**
|
|
84
84
|
* Clear Transaction (iOS only)
|
|
85
85
|
* Finish remaining transactions. Related to issue #257 and #801
|
|
@@ -99,7 +99,7 @@ export declare const clearProductsIOS: () => Promise<void>;
|
|
|
99
99
|
* @param {string} token The product's token (on Android)
|
|
100
100
|
* @returns {Promise<PurchaseResult | void>}
|
|
101
101
|
*/
|
|
102
|
-
export declare const acknowledgePurchaseAndroid: (token: string, developerPayload?: string
|
|
102
|
+
export declare const acknowledgePurchaseAndroid: (token: string, developerPayload?: string) => Promise<PurchaseResult | void>;
|
|
103
103
|
/**
|
|
104
104
|
* Deep link to subscriptions screen on Android. No-op on iOS.
|
|
105
105
|
* @param {string} sku The product's SKU (on Android)
|
|
@@ -140,7 +140,7 @@ export declare const requestPurchaseWithOfferIOS: (sku: string, forUser: string,
|
|
|
140
140
|
* @param {boolean} isTest whether this is in test environment which is sandbox.
|
|
141
141
|
* @returns {Promise<Apple.ReceiptValidationResponse | false>}
|
|
142
142
|
*/
|
|
143
|
-
export declare const validateReceiptIos: (receiptBody: Record<string, unknown>, isTest?: boolean
|
|
143
|
+
export declare const validateReceiptIos: (receiptBody: Record<string, unknown>, isTest?: boolean) => Promise<Apple.ReceiptValidationResponse | false>;
|
|
144
144
|
/**
|
|
145
145
|
* Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
|
|
146
146
|
* your access token in the binary you ship to users is potentially dangerous.
|
|
@@ -152,7 +152,7 @@ export declare const validateReceiptIos: (receiptBody: Record<string, unknown>,
|
|
|
152
152
|
* @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
|
|
153
153
|
* @returns {Promise<object>}
|
|
154
154
|
*/
|
|
155
|
-
export declare const validateReceiptAndroid: (packageName: string, productId: string, productToken: string, accessToken: string, isSub?: boolean
|
|
155
|
+
export declare const validateReceiptAndroid: (packageName: string, productId: string, productToken: string, accessToken: string, isSub?: boolean) => Promise<Android.ReceiptType>;
|
|
156
156
|
/**
|
|
157
157
|
* Validate receipt for Amazon. NOTE: This method is here for debugging purposes only. Including
|
|
158
158
|
* your developer secret in the binary you ship to users is potentially dangerous.
|
|
@@ -179,7 +179,7 @@ export declare const purchaseErrorListener: (listener: (errorEvent: PurchaseErro
|
|
|
179
179
|
* @param {forceRefresh?:boolean}
|
|
180
180
|
* @returns {Promise<string>}
|
|
181
181
|
*/
|
|
182
|
-
export declare const getReceiptIOS: (forceRefresh?: boolean
|
|
182
|
+
export declare const getReceiptIOS: (forceRefresh?: boolean) => Promise<string>;
|
|
183
183
|
/**
|
|
184
184
|
* Get the pending purchases in IOS.
|
|
185
185
|
* @returns {Promise<ProductPurchase[]>}
|