react-native-iap 11.0.0-beta.1 → 11.0.0-rc.2
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/README.md +0 -1
- package/ios/IapSerializationUtils.swift +30 -0
- package/ios/RNIapIosSk2.m +5 -0
- package/ios/RNIapIosSk2.swift +63 -49
- package/lib/commonjs/eventEmitter.js +4 -4
- package/lib/commonjs/eventEmitter.js.map +1 -1
- package/lib/commonjs/hooks/withIAPContext.js +1 -1
- package/lib/commonjs/hooks/withIAPContext.js.map +1 -1
- package/lib/commonjs/iap.js +50 -297
- package/lib/commonjs/iap.js.map +1 -1
- package/lib/commonjs/internal/platform.js +75 -2
- package/lib/commonjs/internal/platform.js.map +1 -1
- package/lib/commonjs/modules/amazon.js +28 -1
- package/lib/commonjs/modules/amazon.js.map +1 -1
- package/lib/commonjs/modules/android.js +73 -1
- package/lib/commonjs/modules/android.js.map +1 -1
- package/lib/commonjs/modules/ios.js +126 -0
- package/lib/commonjs/modules/ios.js.map +1 -1
- package/lib/commonjs/modules/iosSk2.js +47 -0
- package/lib/commonjs/modules/iosSk2.js.map +1 -1
- package/lib/commonjs/types/appleSk2.js.map +1 -1
- package/lib/module/eventEmitter.js +2 -2
- package/lib/module/eventEmitter.js.map +1 -1
- package/lib/module/hooks/withIAPContext.js +2 -2
- package/lib/module/hooks/withIAPContext.js.map +1 -1
- package/lib/module/iap.js +8 -223
- package/lib/module/iap.js.map +1 -1
- package/lib/module/internal/platform.js +48 -1
- package/lib/module/internal/platform.js.map +1 -1
- package/lib/module/modules/amazon.js +23 -0
- package/lib/module/modules/amazon.js.map +1 -1
- package/lib/module/modules/android.js +59 -1
- package/lib/module/modules/android.js.map +1 -1
- package/lib/module/modules/ios.js +102 -1
- package/lib/module/modules/ios.js.map +1 -1
- package/lib/module/modules/iosSk2.js +30 -1
- package/lib/module/modules/iosSk2.js.map +1 -1
- package/lib/module/types/appleSk2.js.map +1 -1
- package/lib/typescript/iap.d.ts +7 -120
- package/lib/typescript/internal/platform.d.ts +9 -0
- package/lib/typescript/modules/amazon.d.ts +17 -0
- package/lib/typescript/modules/android.d.ts +38 -1
- package/lib/typescript/modules/ios.d.ts +56 -0
- package/lib/typescript/modules/iosSk2.d.ts +27 -1
- package/lib/typescript/types/appleSk2.d.ts +4 -0
- package/package.json +1 -1
- package/src/eventEmitter.ts +4 -3
- package/src/hooks/withIAPContext.tsx +2 -2
- package/src/iap.ts +20 -297
- package/src/internal/platform.ts +78 -1
- package/src/modules/amazon.ts +29 -1
- package/src/modules/android.ts +83 -2
- package/src/modules/ios.ts +121 -0
- package/src/modules/iosSk2.ts +45 -1
- package/src/types/appleSk2.ts +12 -0
package/src/modules/iosSk2.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import {NativeModules} from 'react-native';
|
|
2
|
+
|
|
1
3
|
import type {Product, ProductPurchase, Purchase, Sku} from '../types';
|
|
2
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
PaymentDiscountSk2,
|
|
6
|
+
ProductSk2,
|
|
7
|
+
ProductStatus,
|
|
8
|
+
TransactionSk2,
|
|
9
|
+
} from '../types/appleSk2';
|
|
3
10
|
|
|
4
11
|
import type {NativeModuleProps} from './common';
|
|
12
|
+
const {RNIapIosSk2} = NativeModules;
|
|
5
13
|
|
|
6
14
|
type getItems = (skus: Sku[]) => Promise<ProductSk2[]>;
|
|
7
15
|
|
|
@@ -27,6 +35,11 @@ type getPendingTransactions = () => Promise<ProductPurchase[]>;
|
|
|
27
35
|
type presentCodeRedemptionSheet = () => Promise<null>;
|
|
28
36
|
|
|
29
37
|
export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
38
|
+
latestTransaction(sku: string): Promise<TransactionSk2>;
|
|
39
|
+
currentEntitlement(sku: string): Promise<TransactionSk2>;
|
|
40
|
+
subscriptionStatus(sku: string): Promise<ProductStatus[]>;
|
|
41
|
+
isEligibleForIntroOffer(groupID: string): Promise<Boolean>;
|
|
42
|
+
sync(): Promise<null>;
|
|
30
43
|
getItems: getItems;
|
|
31
44
|
getAvailableItems: getAvailableItems;
|
|
32
45
|
buyProduct: BuyProduct;
|
|
@@ -39,3 +52,34 @@ export interface IosModulePropsSk2 extends NativeModuleProps {
|
|
|
39
52
|
getPendingTransactions: getPendingTransactions;
|
|
40
53
|
presentCodeRedemptionSheet: presentCodeRedemptionSheet;
|
|
41
54
|
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sync state with Appstore (iOS only)
|
|
58
|
+
* https://developer.apple.com/documentation/storekit/appstore/3791906-sync
|
|
59
|
+
*/
|
|
60
|
+
export const sync = (): Promise<null> => RNIapIosSk2.sync();
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
export const isEligibleForIntroOffer = (groupID: string): Promise<Boolean> =>
|
|
66
|
+
RNIapIosSk2.isEligibleForIntroOffer(groupID);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
export const subscriptionStatus = (sku: string): Promise<ProductStatus[]> =>
|
|
73
|
+
RNIapIosSk2.subscriptionStatus(sku);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export const currentEntitlement = (sku: string): Promise<TransactionSk2> =>
|
|
79
|
+
RNIapIosSk2.currentEntitlement(sku);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
export const latestTransaction = (sku: string): Promise<TransactionSk2> =>
|
|
85
|
+
RNIapIosSk2.latestTransaction(sku);
|
package/src/types/appleSk2.ts
CHANGED
|
@@ -74,6 +74,18 @@ export type TransactionSk2 = {
|
|
|
74
74
|
subscriptionGroupID: number;
|
|
75
75
|
webOrderLineItemID: number;
|
|
76
76
|
};
|
|
77
|
+
|
|
78
|
+
export type SubscriptionStatus =
|
|
79
|
+
| 'expired'
|
|
80
|
+
| 'inBillingRetryPeriod'
|
|
81
|
+
| 'inGracePeriod'
|
|
82
|
+
| 'revoked'
|
|
83
|
+
| 'subscribed';
|
|
84
|
+
|
|
85
|
+
export type ProductStatus = {
|
|
86
|
+
state: SubscriptionStatus;
|
|
87
|
+
};
|
|
88
|
+
|
|
77
89
|
export const transactionSk2Map = ({
|
|
78
90
|
id,
|
|
79
91
|
originalPurchaseDate,
|