react-native-iap 12.1.2 → 12.3.0
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 +32 -33
- package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonModule.kt +20 -21
- package/android/src/main/java/com/dooboolab/RNIap/PromiseUtils.kt +54 -0
- package/android/src/main/java/com/dooboolab/RNIap/PromiseUtlis.kt +1 -1
- package/android/src/play/java/com/dooboolab/RNIap/PlayUtils.kt +49 -34
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +24 -30
- package/ios/IapSerializationUtils.swift +11 -0
- package/ios/RNIapIosSk2.m +8 -0
- package/ios/RNIapIosSk2.swift +96 -2
- package/lib/commonjs/modules/iosSk2.js +9 -1
- package/lib/commonjs/modules/iosSk2.js.map +1 -1
- package/lib/commonjs/types/appleSk2.js.map +1 -1
- package/lib/module/modules/iosSk2.js +5 -0
- package/lib/module/modules/iosSk2.js.map +1 -1
- package/lib/module/types/appleSk2.js.map +1 -1
- package/lib/typescript/modules/iosSk2.d.ts +8 -1
- package/lib/typescript/types/appleSk2.d.ts +1 -0
- package/package.json +1 -1
- package/src/modules/iosSk2.ts +10 -0
- package/src/types/appleSk2.ts +2 -0
- package/android/src/main/java/com/dooboolab/RNIap/DoobooUtils.kt +0 -188
|
@@ -66,7 +66,7 @@ class RNIapModule(
|
|
|
66
66
|
if (connectedBillingClient?.isReady == true) {
|
|
67
67
|
callback(connectedBillingClient)
|
|
68
68
|
} else {
|
|
69
|
-
promise.safeReject(
|
|
69
|
+
promise.safeReject(PromiseUtils.E_NOT_PREPARED, "Unable to auto-initialize connection")
|
|
70
70
|
}
|
|
71
71
|
} else {
|
|
72
72
|
Log.i(TAG, "Incorrect parameter in resolve")
|
|
@@ -93,7 +93,7 @@ class RNIapModule(
|
|
|
93
93
|
!= ConnectionResult.SUCCESS
|
|
94
94
|
) {
|
|
95
95
|
Log.i(TAG, "Google Play Services are not available on this device")
|
|
96
|
-
promise.safeReject(
|
|
96
|
+
promise.safeReject(PromiseUtils.E_NOT_PREPARED, "Google Play Services are not available on this device")
|
|
97
97
|
return
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -128,7 +128,7 @@ class RNIapModule(
|
|
|
128
128
|
billingClientCache?.endConnection()
|
|
129
129
|
billingClientCache = null
|
|
130
130
|
skus.clear()
|
|
131
|
-
|
|
131
|
+
PromiseUtils.rejectAllPendingPromises()
|
|
132
132
|
promise.safeResolve(true)
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -147,11 +147,10 @@ class RNIapModule(
|
|
|
147
147
|
val listener =
|
|
148
148
|
ConsumeResponseListener { billingResult: BillingResult, outToken: String? ->
|
|
149
149
|
if (billingResult.responseCode != expectedResponseCode) {
|
|
150
|
-
PlayUtils.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
150
|
+
PlayUtils.rejectPromiseWithBillingError(
|
|
151
|
+
promise,
|
|
152
|
+
billingResult.responseCode
|
|
153
|
+
)
|
|
155
154
|
return@ConsumeResponseListener
|
|
156
155
|
}
|
|
157
156
|
|
|
@@ -301,8 +300,7 @@ class RNIapModule(
|
|
|
301
300
|
): Boolean {
|
|
302
301
|
Log.d(TAG, "responseCode: " + billingResult.responseCode)
|
|
303
302
|
if (billingResult.responseCode != BillingClient.BillingResponseCode.OK) {
|
|
304
|
-
PlayUtils.
|
|
305
|
-
.rejectPromiseWithBillingError(promise, billingResult.responseCode)
|
|
303
|
+
PlayUtils.rejectPromiseWithBillingError(promise, billingResult.responseCode)
|
|
306
304
|
return false
|
|
307
305
|
}
|
|
308
306
|
return true
|
|
@@ -403,13 +401,13 @@ class RNIapModule(
|
|
|
403
401
|
) {
|
|
404
402
|
val activity = currentActivity
|
|
405
403
|
if (activity == null) {
|
|
406
|
-
promise.safeReject(
|
|
404
|
+
promise.safeReject(PromiseUtils.E_UNKNOWN, "getCurrentActivity returned null")
|
|
407
405
|
return
|
|
408
406
|
}
|
|
409
407
|
ensureConnection(
|
|
410
408
|
promise
|
|
411
409
|
) { billingClient ->
|
|
412
|
-
|
|
410
|
+
PromiseUtils.addPromiseForKey(
|
|
413
411
|
PROMISE_BUY_ITEM,
|
|
414
412
|
promise
|
|
415
413
|
)
|
|
@@ -520,9 +518,8 @@ class RNIapModule(
|
|
|
520
518
|
promise.safeResolve(true)
|
|
521
519
|
return@ensureConnection
|
|
522
520
|
} else {
|
|
523
|
-
val errorData
|
|
524
|
-
|
|
525
|
-
promise.safeReject(errorData[0], errorData[1])
|
|
521
|
+
val errorData = PlayUtils.getBillingResponseData(billingResultCode)
|
|
522
|
+
promise.safeReject(errorData.code, errorData.message)
|
|
526
523
|
}
|
|
527
524
|
}
|
|
528
525
|
}
|
|
@@ -548,10 +545,9 @@ class RNIapModule(
|
|
|
548
545
|
val map = Arguments.createMap()
|
|
549
546
|
map.putInt("responseCode", billingResult.responseCode)
|
|
550
547
|
map.putString("debugMessage", billingResult.debugMessage)
|
|
551
|
-
val errorData
|
|
552
|
-
|
|
553
|
-
map.putString("
|
|
554
|
-
map.putString("message", errorData[1])
|
|
548
|
+
val errorData = PlayUtils.getBillingResponseData(billingResult.responseCode)
|
|
549
|
+
map.putString("code", errorData.code)
|
|
550
|
+
map.putString("message", errorData.message)
|
|
555
551
|
promise.safeResolve(map)
|
|
556
552
|
}
|
|
557
553
|
}
|
|
@@ -575,10 +571,9 @@ class RNIapModule(
|
|
|
575
571
|
val map = Arguments.createMap()
|
|
576
572
|
map.putInt("responseCode", billingResult.responseCode)
|
|
577
573
|
map.putString("debugMessage", billingResult.debugMessage)
|
|
578
|
-
val errorData
|
|
579
|
-
|
|
580
|
-
map.putString("
|
|
581
|
-
map.putString("message", errorData[1])
|
|
574
|
+
val errorData = PlayUtils.getBillingResponseData(billingResult.responseCode)
|
|
575
|
+
map.putString("code", errorData.code)
|
|
576
|
+
map.putString("message", errorData.message)
|
|
582
577
|
map.putString("purchaseToken", purchaseToken)
|
|
583
578
|
promise.safeResolve(map)
|
|
584
579
|
}
|
|
@@ -591,12 +586,11 @@ class RNIapModule(
|
|
|
591
586
|
val error = Arguments.createMap()
|
|
592
587
|
error.putInt("responseCode", responseCode)
|
|
593
588
|
error.putString("debugMessage", billingResult.debugMessage)
|
|
594
|
-
val errorData
|
|
595
|
-
|
|
596
|
-
error.putString("
|
|
597
|
-
error.putString("message", errorData[1])
|
|
589
|
+
val errorData = PlayUtils.getBillingResponseData(responseCode)
|
|
590
|
+
error.putString("code", errorData.code)
|
|
591
|
+
error.putString("message", errorData.message)
|
|
598
592
|
sendEvent(reactContext, "purchase-error", error)
|
|
599
|
-
PlayUtils.
|
|
593
|
+
PlayUtils.rejectPromisesWithBillingError(PROMISE_BUY_ITEM, responseCode)
|
|
600
594
|
return
|
|
601
595
|
}
|
|
602
596
|
if (purchases != null) {
|
|
@@ -632,7 +626,7 @@ class RNIapModule(
|
|
|
632
626
|
promiseItems.pushMap(item.copy())
|
|
633
627
|
sendEvent(reactContext, "purchase-updated", item)
|
|
634
628
|
}
|
|
635
|
-
|
|
629
|
+
PromiseUtils.resolvePromisesForKey(PROMISE_BUY_ITEM, promiseItems)
|
|
636
630
|
} else {
|
|
637
631
|
val result = Arguments.createMap()
|
|
638
632
|
result.putInt("responseCode", billingResult.responseCode)
|
|
@@ -643,7 +637,7 @@ class RNIapModule(
|
|
|
643
637
|
" proration. If not please report an issue."
|
|
644
638
|
)
|
|
645
639
|
sendEvent(reactContext, "purchase-updated", result)
|
|
646
|
-
|
|
640
|
+
PromiseUtils.resolvePromisesForKey(PROMISE_BUY_ITEM, null)
|
|
647
641
|
}
|
|
648
642
|
}
|
|
649
643
|
|
|
@@ -196,3 +196,14 @@ func serialize(_ pt: Product.ProductType?) -> String? {
|
|
|
196
196
|
return nil
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
+
|
|
200
|
+
@available(iOS 15.0, tvOS 15.0, *)
|
|
201
|
+
func serialize(_ rs: Transaction.RefundRequestStatus?) -> String? {
|
|
202
|
+
guard let rs = rs else {return nil}
|
|
203
|
+
switch rs {
|
|
204
|
+
case .success: return "success"
|
|
205
|
+
case .userCancelled: return "userCancelled"
|
|
206
|
+
default:
|
|
207
|
+
return nil
|
|
208
|
+
}
|
|
209
|
+
}
|
package/ios/RNIapIosSk2.m
CHANGED
|
@@ -85,9 +85,17 @@ 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)
|
|
91
95
|
|
|
96
|
+
RCT_EXTERN_METHOD(beginRefundRequest:
|
|
97
|
+
(NSString*)sku
|
|
98
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
99
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
92
100
|
@end
|
|
93
101
|
#endif
|
package/ios/RNIapIosSk2.swift
CHANGED
|
@@ -85,11 +85,22 @@ 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
|
|
91
96
|
)
|
|
92
97
|
|
|
98
|
+
func beginRefundRequest(
|
|
99
|
+
_ sku: String,
|
|
100
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
101
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
102
|
+
)
|
|
103
|
+
|
|
93
104
|
func startObserving()
|
|
94
105
|
func stopObserving()
|
|
95
106
|
}
|
|
@@ -208,10 +219,25 @@ class DummySk2: Sk2Delegate {
|
|
|
208
219
|
reject(errorCode, errorMessage, nil)
|
|
209
220
|
}
|
|
210
221
|
|
|
222
|
+
func showManageSubscriptions(
|
|
223
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
224
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
225
|
+
) {
|
|
226
|
+
reject(errorCode, errorMessage, nil)
|
|
227
|
+
}
|
|
228
|
+
|
|
211
229
|
func clearTransaction(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
212
230
|
reject(errorCode, errorMessage, nil)
|
|
213
231
|
}
|
|
214
232
|
|
|
233
|
+
func beginRefundRequest(
|
|
234
|
+
_ sku: String,
|
|
235
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
236
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
237
|
+
) {
|
|
238
|
+
reject(errorCode, errorMessage, nil)
|
|
239
|
+
}
|
|
240
|
+
|
|
215
241
|
func startObserving() {
|
|
216
242
|
}
|
|
217
243
|
|
|
@@ -342,7 +368,7 @@ class RNIapIosSk2: RCTEventEmitter, Sk2Delegate {
|
|
|
342
368
|
delegate.latestTransaction(sku, resolve: resolve, reject: reject)
|
|
343
369
|
}
|
|
344
370
|
|
|
345
|
-
@objc public func
|
|
371
|
+
@objc public func finishTransaction(
|
|
346
372
|
_ transactionIdentifier: String,
|
|
347
373
|
resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
348
374
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
@@ -364,18 +390,33 @@ class RNIapIosSk2: RCTEventEmitter, Sk2Delegate {
|
|
|
364
390
|
delegate.sync(resolve, reject: reject)
|
|
365
391
|
}
|
|
366
392
|
|
|
367
|
-
@objc public func
|
|
393
|
+
@objc public func presentCodeRedemptionSheet(
|
|
368
394
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
369
395
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
370
396
|
) {
|
|
371
397
|
delegate.presentCodeRedemptionSheet(resolve, reject: reject)
|
|
372
398
|
}
|
|
373
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
|
+
|
|
374
407
|
@objc func clearTransaction(
|
|
375
408
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
376
409
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }) {
|
|
377
410
|
delegate.clearTransaction(resolve, reject: reject)
|
|
378
411
|
}
|
|
412
|
+
|
|
413
|
+
@objc public func beginRefundRequest(
|
|
414
|
+
_ sku: String,
|
|
415
|
+
resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
416
|
+
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
417
|
+
) {
|
|
418
|
+
delegate.beginRefundRequest(sku, resolve: resolve, reject: reject)
|
|
419
|
+
}
|
|
379
420
|
}
|
|
380
421
|
|
|
381
422
|
@available(iOS 15.0, tvOS 15.0, *)
|
|
@@ -826,6 +867,30 @@ class RNIapIosSk2iOS15: Sk2Delegate {
|
|
|
826
867
|
#endif
|
|
827
868
|
}
|
|
828
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
|
+
|
|
829
894
|
func clearTransaction(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
830
895
|
Task {
|
|
831
896
|
for await result in Transaction.unfinished {
|
|
@@ -843,4 +908,33 @@ class RNIapIosSk2iOS15: Sk2Delegate {
|
|
|
843
908
|
resolve(nil)
|
|
844
909
|
}
|
|
845
910
|
}
|
|
911
|
+
|
|
912
|
+
// TODO: Duplicated code to get the latest transaction, can be cleaned up.
|
|
913
|
+
func beginRefundRequest(_ sku: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
914
|
+
Task {
|
|
915
|
+
if let windowScene = await UIApplication.shared.keyWindow?.windowScene {
|
|
916
|
+
if let product = products[sku] {
|
|
917
|
+
if let result = await product.latestTransaction {
|
|
918
|
+
do {
|
|
919
|
+
// Check whether the transaction is verified. If it isn’t, catch `failedVerification` error.
|
|
920
|
+
let transaction = try checkVerified(result)
|
|
921
|
+
let refund = try await transaction.beginRefundRequest(in: windowScene )
|
|
922
|
+
resolve(serialize(refund))
|
|
923
|
+
} catch StoreError.failedVerification {
|
|
924
|
+
reject(IapErrors.E_UNKNOWN.rawValue, "Failed to verify transaction for sku \(sku)", StoreError.failedVerification)
|
|
925
|
+
} catch {
|
|
926
|
+
debugMessage(error)
|
|
927
|
+
reject(IapErrors.E_UNKNOWN.rawValue, "Failed to refund purchase", error)
|
|
928
|
+
}
|
|
929
|
+
} else {
|
|
930
|
+
reject(IapErrors.E_DEVELOPER_ERROR.rawValue, "Can't find latest transaction for sku \(sku)", nil)
|
|
931
|
+
}
|
|
932
|
+
} else {
|
|
933
|
+
reject(IapErrors.E_DEVELOPER_ERROR.rawValue, "Can't find product for sku \(sku)", nil)
|
|
934
|
+
}
|
|
935
|
+
} else {
|
|
936
|
+
reject(IapErrors.E_DEVELOPER_ERROR.rawValue, "Cannon find window Scene", nil)
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
846
940
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.sync = exports.subscriptionStatus = exports.latestTransaction = exports.isEligibleForIntroOffer = exports.currentEntitlement = void 0;
|
|
6
|
+
exports.sync = exports.subscriptionStatus = exports.latestTransaction = exports.isEligibleForIntroOffer = exports.currentEntitlement = exports.beginRefundRequest = void 0;
|
|
7
7
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
|
|
@@ -48,6 +48,14 @@ const currentEntitlement = sku => RNIapIosSk2.currentEntitlement(sku);
|
|
|
48
48
|
exports.currentEntitlement = currentEntitlement;
|
|
49
49
|
|
|
50
50
|
const latestTransaction = sku => RNIapIosSk2.latestTransaction(sku);
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
|
|
51
55
|
|
|
52
56
|
exports.latestTransaction = latestTransaction;
|
|
57
|
+
|
|
58
|
+
const beginRefundRequest = sku => RNIapIosSk2.beginRefundRequest(sku);
|
|
59
|
+
|
|
60
|
+
exports.beginRefundRequest = beginRefundRequest;
|
|
53
61
|
//# sourceMappingURL=iosSk2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNIapIosSk2","NativeModules","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction"],"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 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}\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"],"mappings":";;;;;;;AAAA;;
|
|
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":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","SubscriptionPlatform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;AASA;;
|
|
1
|
+
{"version":3,"names":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","SubscriptionPlatform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;AASA;;AAuCO,MAAMA,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;;;;AAmBA,MAAMO,kBAAkB,GAAG,SAOC;EAAA;;EAAA,IAPA;IACjCZ,EADiC;IAEjCC,WAFiC;IAGjCC,WAHiC;IAIjCC,KAJiC;IAKjCC,YALiC;IAMjCS;EANiC,CAOA;EACjC,MAAMR,IAAqB,GAAG;IAC5BS,QAAQ,EAAEC,sBAAA,CAAqBC,GADH;IAE5BV,KAAK,EAAEJ,WAFqB;IAG5BK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAHW;IAI5BC,WAJ4B;IAK5BQ,IAAI,EAAE,MALsB;IAM5BN,KAAK,EAAEK,MAAM,CAACL,KAAD,CANe;IAO5BO,cAAc,EAAEN,YAPY;IAQ5BO,QAAQ,EAAE,EARkB;IAQd;IACdM,2BAA2B,EAAG,GAAEJ,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEK,kBAAjB,0DAAG,sBAAkCC,KAAM,EAT5C;IAU5BC,yBAAyB,EACvBP,YADuB,aACvBA,YADuB,iDACvBA,YAAY,CAAEK,kBADS,2DACvB,uBAAkCG,IAAlC,CAAuCC,WAAvC;EAX0B,CAA9B;EAaA,OAAOjB,IAAP;AACD,CAtBM;;;;AAuEA,MAAMkB,iBAAiB,GAAG,SAMD;EAAA,IANE;IAChCvB,EADgC;IAEhCwB,oBAFgC;IAGhCC,SAHgC;IAIhCC,YAJgC;IAKhCC;EALgC,CAMF;EAC9B,MAAMC,QAAkB,GAAG;IACzBrB,SAAS,EAAEkB,SADc;IAEzBI,aAAa,EAAErB,MAAM,CAACR,EAAD,CAFI;IAGzB8B,eAAe,EAAEJ,YAHQ;IAGM;IAC/BK,kBAAkB,EAAE,EAJK;IAID;IACxBC,aAAa,EAAE,EALU;IAKN;IACnBC,WAAW,EAAEN,iBANY;IAOzBO,0BAA0B,EAAE1B,MAAM,CAACgB,oBAAD,CAPT;IAQzBW,gCAAgC,EAAE3B,MAAM,CAACR,EAAD,CARf,CAQqB;;EARrB,CAA3B;EAUA,OAAO4B,QAAP;AACD,CAlBM;AAoBP;AACA;AACA;;;;;AA4BO,MAAMQ,WAAW,GACtBC,KADyB,IAEgC;EACzD,IAAI,CAACA,KAAL,EAAY;IACV,OAAOC,SAAP;EACD;;EACD,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UADV;IAELC,KAAK,EAAEJ,KAAK,CAACK,aAFR;IAGLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
|
|
@@ -28,4 +28,9 @@ export const currentEntitlement = sku => RNIapIosSk2.currentEntitlement(sku);
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
export const latestTransaction = sku => RNIapIosSk2.latestTransaction(sku);
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export const beginRefundRequest = sku => RNIapIosSk2.beginRefundRequest(sku);
|
|
31
36
|
//# sourceMappingURL=iosSk2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","RNIapIosSk2","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction"],"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 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}\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"],"mappings":"AAAA,SAAQA,aAAR,QAA4B,cAA5B;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SubscriptionPlatform","productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":"AASA,SAAQA,oBAAR,QAAmC,GAAnC;
|
|
1
|
+
{"version":3,"names":["SubscriptionPlatform","productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type RefundRequestStatus = 'success' | 'userCancelled';\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":"AASA,SAAQA,oBAAR,QAAmC,GAAnC;AAuCA,OAAO,MAAMC,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;AAmBP,OAAO,MAAMO,kBAAkB,GAAG,SAOC;EAAA;;EAAA,IAPA;IACjCZ,EADiC;IAEjCC,WAFiC;IAGjCC,WAHiC;IAIjCC,KAJiC;IAKjCC,YALiC;IAMjCS;EANiC,CAOA;EACjC,MAAMR,IAAqB,GAAG;IAC5BS,QAAQ,EAAEhB,oBAAoB,CAACiB,GADH;IAE5BT,KAAK,EAAEJ,WAFqB;IAG5BK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAHW;IAI5BC,WAJ4B;IAK5BQ,IAAI,EAAE,MALsB;IAM5BN,KAAK,EAAEK,MAAM,CAACL,KAAD,CANe;IAO5BO,cAAc,EAAEN,YAPY;IAQ5BO,QAAQ,EAAE,EARkB;IAQd;IACdK,2BAA2B,EAAG,GAAEH,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEI,kBAAjB,0DAAG,sBAAkCC,KAAM,EAT5C;IAU5BC,yBAAyB,EACvBN,YADuB,aACvBA,YADuB,iDACvBA,YAAY,CAAEI,kBADS,2DACvB,uBAAkCG,IAAlC,CAAuCC,WAAvC;EAX0B,CAA9B;EAaA,OAAOhB,IAAP;AACD,CAtBM;AAuEP,OAAO,MAAMiB,iBAAiB,GAAG,SAMD;EAAA,IANE;IAChCtB,EADgC;IAEhCuB,oBAFgC;IAGhCC,SAHgC;IAIhCC,YAJgC;IAKhCC;EALgC,CAMF;EAC9B,MAAMC,QAAkB,GAAG;IACzBpB,SAAS,EAAEiB,SADc;IAEzBI,aAAa,EAAEpB,MAAM,CAACR,EAAD,CAFI;IAGzB6B,eAAe,EAAEJ,YAHQ;IAGM;IAC/BK,kBAAkB,EAAE,EAJK;IAID;IACxBC,aAAa,EAAE,EALU;IAKN;IACnBC,WAAW,EAAEN,iBANY;IAOzBO,0BAA0B,EAAEzB,MAAM,CAACe,oBAAD,CAPT;IAQzBW,gCAAgC,EAAE1B,MAAM,CAACR,EAAD,CARf,CAQqB;;EARrB,CAA3B;EAUA,OAAO2B,QAAP;AACD,CAlBM;AAoBP;AACA;AACA;;AA4BA,OAAO,MAAMQ,WAAW,GACtBC,KADyB,IAEgC;EACzD,IAAI,CAACA,KAAL,EAAY;IACV,OAAOC,SAAP;EACD;;EACD,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UADV;IAELC,KAAK,EAAEJ,KAAK,CAACK,aAFR;IAGLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Product, ProductPurchase, Purchase, Sku } from '../types';
|
|
2
|
-
import type { PaymentDiscountSk2, ProductSk2, ProductStatus, TransactionSk2 } from '../types/appleSk2';
|
|
2
|
+
import type { PaymentDiscountSk2, ProductSk2, ProductStatus, RefundRequestStatus, TransactionSk2 } from '../types/appleSk2';
|
|
3
3
|
import type { NativeModuleProps } from './common';
|
|
4
4
|
declare type getItems = (skus: Sku[]) => Promise<ProductSk2[]>;
|
|
5
5
|
declare type getAvailableItems = (alsoPublishToEventListener?: boolean) => Promise<TransactionSk2[]>;
|
|
@@ -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,7 +29,9 @@ 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>;
|
|
34
|
+
beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Sync state with Appstore (iOS only)
|
|
@@ -51,4 +54,8 @@ export declare const currentEntitlement: (sku: string) => Promise<TransactionSk2
|
|
|
51
54
|
*
|
|
52
55
|
*/
|
|
53
56
|
export declare const latestTransaction: (sku: string) => Promise<TransactionSk2>;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
export declare const beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
54
61
|
export {};
|
|
@@ -21,6 +21,7 @@ export declare type SubscriptionInfo = {
|
|
|
21
21
|
subscriptionGroupID: string;
|
|
22
22
|
subscriptionPeriod: SubscriptionPeriod;
|
|
23
23
|
};
|
|
24
|
+
export declare type RefundRequestStatus = 'success' | 'userCancelled';
|
|
24
25
|
export declare type ProductSk2 = {
|
|
25
26
|
description: string;
|
|
26
27
|
displayName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
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
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
PaymentDiscountSk2,
|
|
6
6
|
ProductSk2,
|
|
7
7
|
ProductStatus,
|
|
8
|
+
RefundRequestStatus,
|
|
8
9
|
TransactionSk2,
|
|
9
10
|
} from '../types/appleSk2';
|
|
10
11
|
|
|
@@ -34,6 +35,7 @@ type finishTransaction = (transactionIdentifier: string) => Promise<boolean>;
|
|
|
34
35
|
|
|
35
36
|
type getPendingTransactions = () => Promise<ProductPurchase[]>;
|
|
36
37
|
type presentCodeRedemptionSheet = () => Promise<null>;
|
|
38
|
+
type showManageSubscriptions = () => Promise<null>;
|
|
37
39
|
|
|
38
40
|
export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
39
41
|
isAvailable(): number;
|
|
@@ -52,7 +54,9 @@ export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
|
52
54
|
finishTransaction: finishTransaction;
|
|
53
55
|
getPendingTransactions: getPendingTransactions;
|
|
54
56
|
presentCodeRedemptionSheet: presentCodeRedemptionSheet;
|
|
57
|
+
showManageSubscriptions: showManageSubscriptions;
|
|
55
58
|
disable: () => Promise<null>;
|
|
59
|
+
beginRefundRequest: (sku: string) => Promise<RefundRequestStatus>;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
/**
|
|
@@ -85,3 +89,9 @@ export const currentEntitlement = (sku: string): Promise<TransactionSk2> =>
|
|
|
85
89
|
*/
|
|
86
90
|
export const latestTransaction = (sku: string): Promise<TransactionSk2> =>
|
|
87
91
|
RNIapIosSk2.latestTransaction(sku);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
export const beginRefundRequest = (sku: string): Promise<RefundRequestStatus> =>
|
|
97
|
+
RNIapIosSk2.beginRefundRequest(sku);
|
package/src/types/appleSk2.ts
CHANGED