react-native-iap 12.2.0 → 12.3.1
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/RNIap.podspec +1 -2
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonListener.kt +3 -4
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonModule.kt +14 -15
- package/android/src/main/java/com/dooboolab/RNIap/PromiseUtils.kt +17 -19
- package/android/src/play/java/com/dooboolab/RNIap/PlayUtils.kt +45 -26
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +4 -7
- package/ios/RNIapIosSk2.m +4 -0
- package/ios/RNIapIosSk2.swift +45 -2
- package/lib/commonjs/modules/iosSk2.js.map +1 -1
- package/lib/module/modules/iosSk2.js.map +1 -1
- package/lib/typescript/modules/iosSk2.d.ts +2 -0
- package/package.json +1 -1
- package/src/modules/iosSk2.ts +2 -0
package/RNIap.podspec
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_version = '2021.06.28.00-v2'
|
|
5
4
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
6
5
|
|
|
7
6
|
Pod::Spec.new do |s|
|
|
@@ -30,7 +29,7 @@ Pod::Spec.new do |s|
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
s.dependency "React-Codegen"
|
|
33
|
-
s.dependency "RCT-Folly"
|
|
32
|
+
s.dependency "RCT-Folly"
|
|
34
33
|
s.dependency "RCTRequired"
|
|
35
34
|
s.dependency "RCTTypeSafety"
|
|
36
35
|
s.dependency "ReactCommon/turbomodule/core"
|
|
@@ -46,7 +46,7 @@ class RNIapAmazonListener(private val reactContext: ReactContext) : PurchasingLi
|
|
|
46
46
|
var priceNumber: Number = 0.00
|
|
47
47
|
val priceString = product.price
|
|
48
48
|
try {
|
|
49
|
-
if (priceString?.isNotEmpty()== true) {
|
|
49
|
+
if (priceString?.isNotEmpty() == true) {
|
|
50
50
|
priceNumber = priceString.replace("[^\\d.,]+".toRegex(), "").toDouble()
|
|
51
51
|
}
|
|
52
52
|
} catch (e: NumberFormatException) {
|
|
@@ -206,7 +206,7 @@ class RNIapAmazonListener(private val reactContext: ReactContext) : PurchasingLi
|
|
|
206
206
|
item.putString("userMarketplaceAmazon", userData.marketplace)
|
|
207
207
|
item.putString("userJsonAmazon", userData.toJSON().toString())
|
|
208
208
|
item.putBoolean("isCanceledAmazon", receipt.isCanceled)
|
|
209
|
-
item.putString("termSku",receipt.termSku)
|
|
209
|
+
item.putString("termSku", receipt.termSku)
|
|
210
210
|
return item
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -330,9 +330,8 @@ class RNIapAmazonListener(private val reactContext: ReactContext) : PurchasingLi
|
|
|
330
330
|
)
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
fun clear(){
|
|
333
|
+
fun clear() {
|
|
334
334
|
skus.clear()
|
|
335
|
-
|
|
336
335
|
}
|
|
337
336
|
|
|
338
337
|
private fun sendEvent(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package com.dooboolab.RNIap
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
|
-
import com.amazon.device.drm.LicensingListener
|
|
5
4
|
import com.amazon.device.drm.LicensingService
|
|
6
5
|
import com.amazon.device.drm.model.LicenseResponse
|
|
7
6
|
import com.amazon.device.iap.PurchasingService
|
|
@@ -15,7 +14,6 @@ import com.facebook.react.bridge.ReadableArray
|
|
|
15
14
|
import com.facebook.react.bridge.UiThreadUtil
|
|
16
15
|
import com.facebook.react.module.annotations.ReactModule
|
|
17
16
|
|
|
18
|
-
|
|
19
17
|
@ReactModule(name = RNIapAmazonModule.TAG)
|
|
20
18
|
class RNIapAmazonModule(reactContext: ReactApplicationContext) :
|
|
21
19
|
ReactContextBaseJavaModule(reactContext) {
|
|
@@ -32,25 +30,26 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext) :
|
|
|
32
30
|
this.amazonListener = amazonListener
|
|
33
31
|
UiThreadUtil.runOnUiThread {
|
|
34
32
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}catch (e:Exception){
|
|
33
|
+
PurchasingService.registerListener(context.applicationContext, amazonListener)
|
|
34
|
+
hasListener = true
|
|
35
|
+
// Prefetch user and purchases as per Amazon SDK documentation:
|
|
36
|
+
PurchasingService.getUserData()
|
|
37
|
+
PurchasingService.getPurchaseUpdates(false)
|
|
38
|
+
promise.safeResolve(true)
|
|
39
|
+
} catch (e: Exception) {
|
|
43
40
|
promise.safeReject("Error initializing Amazon appstore sdk", e)
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
@ReactMethod
|
|
49
|
-
fun verifyLicense(promise: Promise){
|
|
46
|
+
fun verifyLicense(promise: Promise) {
|
|
50
47
|
try {
|
|
51
48
|
LicensingService.verifyLicense(reactApplicationContext) { licenseResponse ->
|
|
52
|
-
when (
|
|
53
|
-
|
|
49
|
+
when (
|
|
50
|
+
val status: LicenseResponse.RequestStatus =
|
|
51
|
+
licenseResponse.requestStatus
|
|
52
|
+
) {
|
|
54
53
|
LicenseResponse.RequestStatus.LICENSED -> {
|
|
55
54
|
Log.d(TAG, "LicenseResponse status: $status")
|
|
56
55
|
promise.resolve("LICENSED")
|
|
@@ -77,8 +76,8 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext) :
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
}catch (exception: Exception){
|
|
81
|
-
promise.reject("Error while attempting to check for License",exception)
|
|
79
|
+
} catch (exception: Exception) {
|
|
80
|
+
promise.reject("Error while attempting to check for License", exception)
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -11,7 +11,7 @@ object PromiseUtils {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
fun resolvePromisesForKey(key: String, value: Any?) {
|
|
14
|
-
promises[key]?.forEach{ promise ->
|
|
14
|
+
promises[key]?.forEach { promise ->
|
|
15
15
|
promise.safeResolve(value)
|
|
16
16
|
}
|
|
17
17
|
promises.remove(key)
|
|
@@ -30,27 +30,25 @@ object PromiseUtils {
|
|
|
30
30
|
message: String?,
|
|
31
31
|
err: Exception?
|
|
32
32
|
) {
|
|
33
|
-
promises[key]?.forEach{ promise ->
|
|
33
|
+
promises[key]?.forEach { promise ->
|
|
34
34
|
promise.safeReject(code, message, err)
|
|
35
35
|
}
|
|
36
36
|
promises.remove(key)
|
|
37
|
-
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
private const val TAG = "PromiseUtils"
|
|
40
|
+
const val E_UNKNOWN = "E_UNKNOWN"
|
|
41
|
+
const val E_NOT_PREPARED = "E_NOT_PREPARED"
|
|
42
|
+
const val E_ALREADY_PREPARED = "E_ALREADY_PREPARED"
|
|
43
|
+
const val E_NOT_ENDED = "E_NOT_ENDED"
|
|
44
|
+
const val E_USER_CANCELLED = "E_USER_CANCELLED"
|
|
45
|
+
const val E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE"
|
|
46
|
+
const val E_NETWORK_ERROR = "E_NETWORK_ERROR"
|
|
47
|
+
const val E_SERVICE_ERROR = "E_SERVICE_ERROR"
|
|
48
|
+
const val E_ALREADY_OWNED = "E_ALREADY_OWNED"
|
|
49
|
+
const val E_REMOTE_ERROR = "E_REMOTE_ERROR"
|
|
50
|
+
const val E_USER_ERROR = "E_USER_ERROR"
|
|
51
|
+
const val E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR"
|
|
52
|
+
const val E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR"
|
|
53
|
+
const val E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED"
|
|
56
54
|
}
|
|
@@ -13,53 +13,72 @@ object PlayUtils {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
fun getBillingResponseData(responseCode: Int): BillingResponse {
|
|
16
|
-
val errorData=
|
|
17
|
-
when (responseCode) {
|
|
16
|
+
val errorData = when (responseCode) {
|
|
18
17
|
BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED -> {
|
|
19
|
-
BillingResponse(
|
|
20
|
-
|
|
18
|
+
BillingResponse(
|
|
19
|
+
PromiseUtils.E_SERVICE_ERROR,
|
|
20
|
+
"This feature is not available on your device."
|
|
21
|
+
)
|
|
21
22
|
}
|
|
22
23
|
BillingClient.BillingResponseCode.SERVICE_DISCONNECTED -> {
|
|
23
|
-
BillingResponse(
|
|
24
|
-
|
|
24
|
+
BillingResponse(
|
|
25
|
+
PromiseUtils.E_NETWORK_ERROR,
|
|
26
|
+
"The service is disconnected (check your internet connection.)"
|
|
27
|
+
)
|
|
25
28
|
}
|
|
26
29
|
BillingClient.BillingResponseCode.OK -> {
|
|
27
|
-
BillingResponse(
|
|
28
|
-
|
|
30
|
+
BillingResponse(
|
|
31
|
+
"OK",
|
|
32
|
+
""
|
|
33
|
+
)
|
|
29
34
|
}
|
|
30
35
|
BillingClient.BillingResponseCode.USER_CANCELED -> {
|
|
31
|
-
BillingResponse(
|
|
32
|
-
|
|
36
|
+
BillingResponse(
|
|
37
|
+
PromiseUtils.E_USER_CANCELLED,
|
|
38
|
+
"Payment is Cancelled."
|
|
39
|
+
)
|
|
33
40
|
}
|
|
34
41
|
BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE -> {
|
|
35
|
-
BillingResponse(
|
|
36
|
-
|
|
37
|
-
"The service is unreachable. This may be your internet connection, or the Play Store may be down."
|
|
42
|
+
BillingResponse(
|
|
43
|
+
PromiseUtils.E_SERVICE_ERROR,
|
|
44
|
+
"The service is unreachable. This may be your internet connection, or the Play Store may be down."
|
|
45
|
+
)
|
|
38
46
|
}
|
|
39
47
|
BillingClient.BillingResponseCode.BILLING_UNAVAILABLE -> {
|
|
40
|
-
BillingResponse(
|
|
41
|
-
|
|
42
|
-
"Billing is unavailable. This may be a problem with your device, or the Play Store may be down."
|
|
48
|
+
BillingResponse(
|
|
49
|
+
PromiseUtils.E_SERVICE_ERROR,
|
|
50
|
+
"Billing is unavailable. This may be a problem with your device, or the Play Store may be down."
|
|
51
|
+
)
|
|
43
52
|
}
|
|
44
53
|
BillingClient.BillingResponseCode.ITEM_UNAVAILABLE -> {
|
|
45
|
-
BillingResponse(
|
|
46
|
-
|
|
54
|
+
BillingResponse(
|
|
55
|
+
PromiseUtils.E_ITEM_UNAVAILABLE,
|
|
56
|
+
"That item is unavailable."
|
|
57
|
+
)
|
|
47
58
|
}
|
|
48
59
|
BillingClient.BillingResponseCode.DEVELOPER_ERROR -> {
|
|
49
|
-
BillingResponse(
|
|
50
|
-
|
|
60
|
+
BillingResponse(
|
|
61
|
+
PromiseUtils.E_DEVELOPER_ERROR,
|
|
62
|
+
"Google is indicating that we have some issue connecting to payment."
|
|
63
|
+
)
|
|
51
64
|
}
|
|
52
65
|
BillingClient.BillingResponseCode.ERROR -> {
|
|
53
|
-
BillingResponse(
|
|
54
|
-
|
|
66
|
+
BillingResponse(
|
|
67
|
+
PromiseUtils.E_UNKNOWN,
|
|
68
|
+
"An unknown or unexpected error has occurred. Please try again later."
|
|
69
|
+
)
|
|
55
70
|
}
|
|
56
71
|
BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
|
|
57
|
-
BillingResponse(
|
|
58
|
-
|
|
72
|
+
BillingResponse(
|
|
73
|
+
PromiseUtils.E_ALREADY_OWNED,
|
|
74
|
+
"You already own this item."
|
|
75
|
+
)
|
|
59
76
|
}
|
|
60
77
|
else -> {
|
|
61
|
-
BillingResponse(
|
|
62
|
-
|
|
78
|
+
BillingResponse(
|
|
79
|
+
PromiseUtils.E_UNKNOWN,
|
|
80
|
+
"Purchase failed with code: $responseCode"
|
|
81
|
+
)
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
Log.e(TAG, "Error Code : $responseCode")
|
|
@@ -148,9 +148,9 @@ class RNIapModule(
|
|
|
148
148
|
ConsumeResponseListener { billingResult: BillingResult, outToken: String? ->
|
|
149
149
|
if (billingResult.responseCode != expectedResponseCode) {
|
|
150
150
|
PlayUtils.rejectPromiseWithBillingError(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
promise,
|
|
152
|
+
billingResult.responseCode
|
|
153
|
+
)
|
|
154
154
|
return@ConsumeResponseListener
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -514,10 +514,7 @@ class RNIapModule(
|
|
|
514
514
|
}
|
|
515
515
|
val flowParams = builder.build()
|
|
516
516
|
val billingResultCode = billingClient.launchBillingFlow(activity, flowParams).responseCode
|
|
517
|
-
if (billingResultCode
|
|
518
|
-
promise.safeResolve(true)
|
|
519
|
-
return@ensureConnection
|
|
520
|
-
} else {
|
|
517
|
+
if (billingResultCode != BillingClient.BillingResponseCode.OK) {
|
|
521
518
|
val errorData = PlayUtils.getBillingResponseData(billingResultCode)
|
|
522
519
|
promise.safeReject(errorData.code, errorData.message)
|
|
523
520
|
}
|
package/ios/RNIapIosSk2.m
CHANGED
|
@@ -85,6 +85,10 @@ RCT_EXTERN_METHOD(presentCodeRedemptionSheet:
|
|
|
85
85
|
(RCTPromiseResolveBlock)resolve
|
|
86
86
|
reject:(RCTPromiseRejectBlock)reject)
|
|
87
87
|
|
|
88
|
+
RCT_EXTERN_METHOD(showManageSubscriptions:
|
|
89
|
+
(RCTPromiseResolveBlock)resolve
|
|
90
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
91
|
+
|
|
88
92
|
RCT_EXTERN_METHOD(clearTransaction:
|
|
89
93
|
(RCTPromiseResolveBlock)resolve
|
|
90
94
|
reject:(RCTPromiseRejectBlock)reject)
|
package/ios/RNIapIosSk2.swift
CHANGED
|
@@ -85,6 +85,11 @@ protocol Sk2Delegate {
|
|
|
85
85
|
reject: @escaping RCTPromiseRejectBlock
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
+
func showManageSubscriptions(
|
|
89
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
90
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
91
|
+
)
|
|
92
|
+
|
|
88
93
|
func clearTransaction(
|
|
89
94
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
90
95
|
reject: @escaping RCTPromiseRejectBlock
|
|
@@ -214,6 +219,13 @@ class DummySk2: Sk2Delegate {
|
|
|
214
219
|
reject(errorCode, errorMessage, nil)
|
|
215
220
|
}
|
|
216
221
|
|
|
222
|
+
func showManageSubscriptions(
|
|
223
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
224
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
225
|
+
) {
|
|
226
|
+
reject(errorCode, errorMessage, nil)
|
|
227
|
+
}
|
|
228
|
+
|
|
217
229
|
func clearTransaction(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
218
230
|
reject(errorCode, errorMessage, nil)
|
|
219
231
|
}
|
|
@@ -356,7 +368,7 @@ class RNIapIosSk2: RCTEventEmitter, Sk2Delegate {
|
|
|
356
368
|
delegate.latestTransaction(sku, resolve: resolve, reject: reject)
|
|
357
369
|
}
|
|
358
370
|
|
|
359
|
-
@objc public func
|
|
371
|
+
@objc public func finishTransaction(
|
|
360
372
|
_ transactionIdentifier: String,
|
|
361
373
|
resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
362
374
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
@@ -378,13 +390,20 @@ class RNIapIosSk2: RCTEventEmitter, Sk2Delegate {
|
|
|
378
390
|
delegate.sync(resolve, reject: reject)
|
|
379
391
|
}
|
|
380
392
|
|
|
381
|
-
@objc public func
|
|
393
|
+
@objc public func presentCodeRedemptionSheet(
|
|
382
394
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
383
395
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
384
396
|
) {
|
|
385
397
|
delegate.presentCodeRedemptionSheet(resolve, reject: reject)
|
|
386
398
|
}
|
|
387
399
|
|
|
400
|
+
@objc public func showManageSubscriptions(
|
|
401
|
+
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
402
|
+
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
403
|
+
) {
|
|
404
|
+
delegate.showManageSubscriptions(resolve, reject: reject)
|
|
405
|
+
}
|
|
406
|
+
|
|
388
407
|
@objc func clearTransaction(
|
|
389
408
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
390
409
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }) {
|
|
@@ -848,6 +867,30 @@ class RNIapIosSk2iOS15: Sk2Delegate {
|
|
|
848
867
|
#endif
|
|
849
868
|
}
|
|
850
869
|
|
|
870
|
+
@objc public func showManageSubscriptions(
|
|
871
|
+
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
872
|
+
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
873
|
+
) {
|
|
874
|
+
#if !os(tvOS)
|
|
875
|
+
guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
876
|
+
!ProcessInfo.processInfo.isiOSAppOnMac else {
|
|
877
|
+
return
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
Task {
|
|
881
|
+
do {
|
|
882
|
+
try await AppStore.showManageSubscriptions(in: scene)
|
|
883
|
+
} catch {
|
|
884
|
+
print("Error:(error)")
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
resolve(nil)
|
|
889
|
+
#else
|
|
890
|
+
reject(IapErrors.E_USER_CANCELLED.rawValue, "This method is not available on tvOS", nil)
|
|
891
|
+
#endif
|
|
892
|
+
}
|
|
893
|
+
|
|
851
894
|
func clearTransaction(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
852
895
|
Task {
|
|
853
896
|
for await result in Transaction.unfinished {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNIapIosSk2","NativeModules","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sources":["iosSk2.ts"],"sourcesContent":["import {NativeModules} from 'react-native';\n\nimport type {Product, ProductPurchase, Purchase, Sku} from '../types';\nimport type {\n PaymentDiscountSk2,\n ProductSk2,\n ProductStatus,\n RefundRequestStatus,\n TransactionSk2,\n} from '../types/appleSk2';\n\nimport type {NativeModuleProps} from './common';\nconst {RNIapIosSk2} = NativeModules;\n\ntype getItems = (skus: Sku[]) => Promise<ProductSk2[]>;\n\ntype getAvailableItems = (\n alsoPublishToEventListener?: boolean,\n) => Promise<TransactionSk2[]>;\n\nexport type BuyProduct = (\n sku: Sku,\n andDangerouslyFinishTransactionAutomaticallyIOS: boolean,\n applicationUsername: string | undefined,\n quantity: number,\n withOffer: Record<keyof PaymentDiscountSk2, string> | undefined,\n) => Promise<Purchase>;\n\ntype clearTransaction = () => Promise<void>;\ntype clearProducts = () => Promise<void>;\ntype promotedProduct = () => Promise<Product | null>;\ntype buyPromotedProduct = () => Promise<void>;\n\ntype finishTransaction = (transactionIdentifier: string) => Promise<boolean>;\n\ntype getPendingTransactions = () => Promise<ProductPurchase[]>;\ntype presentCodeRedemptionSheet = () => Promise<null>;\n\nexport interface IosModulePropsSk2 extends NativeModuleProps {\n isAvailable(): number;\n latestTransaction(sku: string): Promise<TransactionSk2>;\n currentEntitlement(sku: string): Promise<TransactionSk2>;\n subscriptionStatus(sku: string): Promise<ProductStatus[]>;\n isEligibleForIntroOffer(groupID: string): Promise<Boolean>;\n sync(): Promise<null>;\n getItems: getItems;\n getAvailableItems: getAvailableItems;\n buyProduct: BuyProduct;\n clearTransaction: clearTransaction;\n clearProducts: clearProducts;\n promotedProduct: promotedProduct;\n buyPromotedProduct: buyPromotedProduct;\n finishTransaction: finishTransaction;\n getPendingTransactions: getPendingTransactions;\n presentCodeRedemptionSheet: presentCodeRedemptionSheet;\n disable: () => Promise<null>;\n beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;\n}\n\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n */\nexport const sync = (): Promise<null> => RNIapIosSk2.sync();\n\n/**\n *\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<Boolean> =>\n RNIapIosSk2.isEligibleForIntroOffer(groupID);\n\n/**\n *\n */\n\nexport const subscriptionStatus = (sku: string): Promise<ProductStatus[]> =>\n RNIapIosSk2.subscriptionStatus(sku);\n\n/**\n *\n */\nexport const currentEntitlement = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.currentEntitlement(sku);\n\n/**\n *\n */\nexport const latestTransaction = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.latestTransaction(sku);\n\n/**\n *\n */\nexport const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>\n RNIapIosSk2.beginRefundRequest(sku);\n"],"mappings":";;;;;;;AAAA;;AAYA,MAAM;EAACA;AAAD,IAAgBC,0BAAtB;;
|
|
1
|
+
{"version":3,"names":["RNIapIosSk2","NativeModules","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sources":["iosSk2.ts"],"sourcesContent":["import {NativeModules} from 'react-native';\n\nimport type {Product, ProductPurchase, Purchase, Sku} from '../types';\nimport type {\n PaymentDiscountSk2,\n ProductSk2,\n ProductStatus,\n RefundRequestStatus,\n TransactionSk2,\n} from '../types/appleSk2';\n\nimport type {NativeModuleProps} from './common';\nconst {RNIapIosSk2} = NativeModules;\n\ntype getItems = (skus: Sku[]) => Promise<ProductSk2[]>;\n\ntype getAvailableItems = (\n alsoPublishToEventListener?: boolean,\n) => Promise<TransactionSk2[]>;\n\nexport type BuyProduct = (\n sku: Sku,\n andDangerouslyFinishTransactionAutomaticallyIOS: boolean,\n applicationUsername: string | undefined,\n quantity: number,\n withOffer: Record<keyof PaymentDiscountSk2, string> | undefined,\n) => Promise<Purchase>;\n\ntype clearTransaction = () => Promise<void>;\ntype clearProducts = () => Promise<void>;\ntype promotedProduct = () => Promise<Product | null>;\ntype buyPromotedProduct = () => Promise<void>;\n\ntype finishTransaction = (transactionIdentifier: string) => Promise<boolean>;\n\ntype getPendingTransactions = () => Promise<ProductPurchase[]>;\ntype presentCodeRedemptionSheet = () => Promise<null>;\ntype showManageSubscriptions = () => Promise<null>;\n\nexport interface IosModulePropsSk2 extends NativeModuleProps {\n isAvailable(): number;\n latestTransaction(sku: string): Promise<TransactionSk2>;\n currentEntitlement(sku: string): Promise<TransactionSk2>;\n subscriptionStatus(sku: string): Promise<ProductStatus[]>;\n isEligibleForIntroOffer(groupID: string): Promise<Boolean>;\n sync(): Promise<null>;\n getItems: getItems;\n getAvailableItems: getAvailableItems;\n buyProduct: BuyProduct;\n clearTransaction: clearTransaction;\n clearProducts: clearProducts;\n promotedProduct: promotedProduct;\n buyPromotedProduct: buyPromotedProduct;\n finishTransaction: finishTransaction;\n getPendingTransactions: getPendingTransactions;\n presentCodeRedemptionSheet: presentCodeRedemptionSheet;\n showManageSubscriptions: showManageSubscriptions;\n disable: () => Promise<null>;\n beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;\n}\n\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n */\nexport const sync = (): Promise<null> => RNIapIosSk2.sync();\n\n/**\n *\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<Boolean> =>\n RNIapIosSk2.isEligibleForIntroOffer(groupID);\n\n/**\n *\n */\n\nexport const subscriptionStatus = (sku: string): Promise<ProductStatus[]> =>\n RNIapIosSk2.subscriptionStatus(sku);\n\n/**\n *\n */\nexport const currentEntitlement = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.currentEntitlement(sku);\n\n/**\n *\n */\nexport const latestTransaction = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.latestTransaction(sku);\n\n/**\n *\n */\nexport const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>\n RNIapIosSk2.beginRefundRequest(sku);\n"],"mappings":";;;;;;;AAAA;;AAYA,MAAM;EAACA;AAAD,IAAgBC,0BAAtB;;AAiDA;AACA;AACA;AACA;AACO,MAAMC,IAAI,GAAG,MAAqBF,WAAW,CAACE,IAAZ,EAAlC;AAEP;AACA;AACA;;;;;AACO,MAAMC,uBAAuB,GAAIC,OAAD,IACrCJ,WAAW,CAACG,uBAAZ,CAAoCC,OAApC,CADK;AAGP;AACA;AACA;;;;;AAEO,MAAMC,kBAAkB,GAAIC,GAAD,IAChCN,WAAW,CAACK,kBAAZ,CAA+BC,GAA/B,CADK;AAGP;AACA;AACA;;;;;AACO,MAAMC,kBAAkB,GAAID,GAAD,IAChCN,WAAW,CAACO,kBAAZ,CAA+BD,GAA/B,CADK;AAGP;AACA;AACA;;;;;AACO,MAAME,iBAAiB,GAAIF,GAAD,IAC/BN,WAAW,CAACQ,iBAAZ,CAA8BF,GAA9B,CADK;AAGP;AACA;AACA;;;;;AACO,MAAMG,kBAAkB,GAAIH,GAAD,IAChCN,WAAW,CAACS,kBAAZ,CAA+BH,GAA/B,CADK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","RNIapIosSk2","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sources":["iosSk2.ts"],"sourcesContent":["import {NativeModules} from 'react-native';\n\nimport type {Product, ProductPurchase, Purchase, Sku} from '../types';\nimport type {\n PaymentDiscountSk2,\n ProductSk2,\n ProductStatus,\n RefundRequestStatus,\n TransactionSk2,\n} from '../types/appleSk2';\n\nimport type {NativeModuleProps} from './common';\nconst {RNIapIosSk2} = NativeModules;\n\ntype getItems = (skus: Sku[]) => Promise<ProductSk2[]>;\n\ntype getAvailableItems = (\n alsoPublishToEventListener?: boolean,\n) => Promise<TransactionSk2[]>;\n\nexport type BuyProduct = (\n sku: Sku,\n andDangerouslyFinishTransactionAutomaticallyIOS: boolean,\n applicationUsername: string | undefined,\n quantity: number,\n withOffer: Record<keyof PaymentDiscountSk2, string> | undefined,\n) => Promise<Purchase>;\n\ntype clearTransaction = () => Promise<void>;\ntype clearProducts = () => Promise<void>;\ntype promotedProduct = () => Promise<Product | null>;\ntype buyPromotedProduct = () => Promise<void>;\n\ntype finishTransaction = (transactionIdentifier: string) => Promise<boolean>;\n\ntype getPendingTransactions = () => Promise<ProductPurchase[]>;\ntype presentCodeRedemptionSheet = () => Promise<null>;\n\nexport interface IosModulePropsSk2 extends NativeModuleProps {\n isAvailable(): number;\n latestTransaction(sku: string): Promise<TransactionSk2>;\n currentEntitlement(sku: string): Promise<TransactionSk2>;\n subscriptionStatus(sku: string): Promise<ProductStatus[]>;\n isEligibleForIntroOffer(groupID: string): Promise<Boolean>;\n sync(): Promise<null>;\n getItems: getItems;\n getAvailableItems: getAvailableItems;\n buyProduct: BuyProduct;\n clearTransaction: clearTransaction;\n clearProducts: clearProducts;\n promotedProduct: promotedProduct;\n buyPromotedProduct: buyPromotedProduct;\n finishTransaction: finishTransaction;\n getPendingTransactions: getPendingTransactions;\n presentCodeRedemptionSheet: presentCodeRedemptionSheet;\n disable: () => Promise<null>;\n beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;\n}\n\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n */\nexport const sync = (): Promise<null> => RNIapIosSk2.sync();\n\n/**\n *\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<Boolean> =>\n RNIapIosSk2.isEligibleForIntroOffer(groupID);\n\n/**\n *\n */\n\nexport const subscriptionStatus = (sku: string): Promise<ProductStatus[]> =>\n RNIapIosSk2.subscriptionStatus(sku);\n\n/**\n *\n */\nexport const currentEntitlement = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.currentEntitlement(sku);\n\n/**\n *\n */\nexport const latestTransaction = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.latestTransaction(sku);\n\n/**\n *\n */\nexport const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>\n RNIapIosSk2.beginRefundRequest(sku);\n"],"mappings":"AAAA,SAAQA,aAAR,QAA4B,cAA5B;AAYA,MAAM;EAACC;AAAD,IAAgBD,aAAtB;;
|
|
1
|
+
{"version":3,"names":["NativeModules","RNIapIosSk2","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sources":["iosSk2.ts"],"sourcesContent":["import {NativeModules} from 'react-native';\n\nimport type {Product, ProductPurchase, Purchase, Sku} from '../types';\nimport type {\n PaymentDiscountSk2,\n ProductSk2,\n ProductStatus,\n RefundRequestStatus,\n TransactionSk2,\n} from '../types/appleSk2';\n\nimport type {NativeModuleProps} from './common';\nconst {RNIapIosSk2} = NativeModules;\n\ntype getItems = (skus: Sku[]) => Promise<ProductSk2[]>;\n\ntype getAvailableItems = (\n alsoPublishToEventListener?: boolean,\n) => Promise<TransactionSk2[]>;\n\nexport type BuyProduct = (\n sku: Sku,\n andDangerouslyFinishTransactionAutomaticallyIOS: boolean,\n applicationUsername: string | undefined,\n quantity: number,\n withOffer: Record<keyof PaymentDiscountSk2, string> | undefined,\n) => Promise<Purchase>;\n\ntype clearTransaction = () => Promise<void>;\ntype clearProducts = () => Promise<void>;\ntype promotedProduct = () => Promise<Product | null>;\ntype buyPromotedProduct = () => Promise<void>;\n\ntype finishTransaction = (transactionIdentifier: string) => Promise<boolean>;\n\ntype getPendingTransactions = () => Promise<ProductPurchase[]>;\ntype presentCodeRedemptionSheet = () => Promise<null>;\ntype showManageSubscriptions = () => Promise<null>;\n\nexport interface IosModulePropsSk2 extends NativeModuleProps {\n isAvailable(): number;\n latestTransaction(sku: string): Promise<TransactionSk2>;\n currentEntitlement(sku: string): Promise<TransactionSk2>;\n subscriptionStatus(sku: string): Promise<ProductStatus[]>;\n isEligibleForIntroOffer(groupID: string): Promise<Boolean>;\n sync(): Promise<null>;\n getItems: getItems;\n getAvailableItems: getAvailableItems;\n buyProduct: BuyProduct;\n clearTransaction: clearTransaction;\n clearProducts: clearProducts;\n promotedProduct: promotedProduct;\n buyPromotedProduct: buyPromotedProduct;\n finishTransaction: finishTransaction;\n getPendingTransactions: getPendingTransactions;\n presentCodeRedemptionSheet: presentCodeRedemptionSheet;\n showManageSubscriptions: showManageSubscriptions;\n disable: () => Promise<null>;\n beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;\n}\n\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n */\nexport const sync = (): Promise<null> => RNIapIosSk2.sync();\n\n/**\n *\n */\nexport const isEligibleForIntroOffer = (groupID: string): Promise<Boolean> =>\n RNIapIosSk2.isEligibleForIntroOffer(groupID);\n\n/**\n *\n */\n\nexport const subscriptionStatus = (sku: string): Promise<ProductStatus[]> =>\n RNIapIosSk2.subscriptionStatus(sku);\n\n/**\n *\n */\nexport const currentEntitlement = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.currentEntitlement(sku);\n\n/**\n *\n */\nexport const latestTransaction = (sku: string): Promise<TransactionSk2> =>\n RNIapIosSk2.latestTransaction(sku);\n\n/**\n *\n */\nexport const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>\n RNIapIosSk2.beginRefundRequest(sku);\n"],"mappings":"AAAA,SAAQA,aAAR,QAA4B,cAA5B;AAYA,MAAM;EAACC;AAAD,IAAgBD,aAAtB;;AAiDA;AACA;AACA;AACA;AACA,OAAO,MAAME,IAAI,GAAG,MAAqBD,WAAW,CAACC,IAAZ,EAAlC;AAEP;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GAAIC,OAAD,IACrCH,WAAW,CAACE,uBAAZ,CAAoCC,OAApC,CADK;AAGP;AACA;AACA;;AAEA,OAAO,MAAMC,kBAAkB,GAAIC,GAAD,IAChCL,WAAW,CAACI,kBAAZ,CAA+BC,GAA/B,CADK;AAGP;AACA;AACA;;AACA,OAAO,MAAMC,kBAAkB,GAAID,GAAD,IAChCL,WAAW,CAACM,kBAAZ,CAA+BD,GAA/B,CADK;AAGP;AACA;AACA;;AACA,OAAO,MAAME,iBAAiB,GAAIF,GAAD,IAC/BL,WAAW,CAACO,iBAAZ,CAA8BF,GAA9B,CADK;AAGP;AACA;AACA;;AACA,OAAO,MAAMG,kBAAkB,GAAIH,GAAD,IAChCL,WAAW,CAACQ,kBAAZ,CAA+BH,GAA/B,CADK"}
|
|
@@ -11,6 +11,7 @@ declare type buyPromotedProduct = () => Promise<void>;
|
|
|
11
11
|
declare type finishTransaction = (transactionIdentifier: string) => Promise<boolean>;
|
|
12
12
|
declare type getPendingTransactions = () => Promise<ProductPurchase[]>;
|
|
13
13
|
declare type presentCodeRedemptionSheet = () => Promise<null>;
|
|
14
|
+
declare type showManageSubscriptions = () => Promise<null>;
|
|
14
15
|
export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
15
16
|
isAvailable(): number;
|
|
16
17
|
latestTransaction(sku: string): Promise<TransactionSk2>;
|
|
@@ -28,6 +29,7 @@ export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
|
28
29
|
finishTransaction: finishTransaction;
|
|
29
30
|
getPendingTransactions: getPendingTransactions;
|
|
30
31
|
presentCodeRedemptionSheet: presentCodeRedemptionSheet;
|
|
32
|
+
showManageSubscriptions: showManageSubscriptions;
|
|
31
33
|
disable: () => Promise<null>;
|
|
32
34
|
beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
33
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.1",
|
|
4
4
|
"description": "React Native In App Purchase Module.",
|
|
5
5
|
"repository": "https://github.com/dooboolab/react-native-iap",
|
|
6
6
|
"author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab)",
|
package/src/modules/iosSk2.ts
CHANGED
|
@@ -35,6 +35,7 @@ type finishTransaction = (transactionIdentifier: string) => Promise<boolean>;
|
|
|
35
35
|
|
|
36
36
|
type getPendingTransactions = () => Promise<ProductPurchase[]>;
|
|
37
37
|
type presentCodeRedemptionSheet = () => Promise<null>;
|
|
38
|
+
type showManageSubscriptions = () => Promise<null>;
|
|
38
39
|
|
|
39
40
|
export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
40
41
|
isAvailable(): number;
|
|
@@ -53,6 +54,7 @@ export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
|
53
54
|
finishTransaction: finishTransaction;
|
|
54
55
|
getPendingTransactions: getPendingTransactions;
|
|
55
56
|
presentCodeRedemptionSheet: presentCodeRedemptionSheet;
|
|
57
|
+
showManageSubscriptions: showManageSubscriptions;
|
|
56
58
|
disable: () => Promise<null>;
|
|
57
59
|
beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
58
60
|
}
|