react-native-iap 9.0.0-beta → 9.0.0-beta12
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 +11 -22
- package/RNIap.podspec +33 -18
- package/android/build.gradle +137 -38
- package/android/gradle.properties +8 -0
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +99 -89
- package/android/src/play/java/com/dooboolab/RNIap/RNIapPackage.kt +0 -1
- package/android/src/testPlay/java/com/dooboolab/RNIap/{RNIapModuleTestV4.kt → RNIapModuleTest.kt} +47 -35
- package/ios/RNIapIos-Bridging-Header.h +2 -0
- package/ios/RNIapIos.m +14 -1
- package/ios/RNIapIos.swift +903 -883
- package/ios/{RNIap.xcodeproj → RNIapIos.xcodeproj}/project.pbxproj +29 -116
- package/lib/commonjs/__test__/iap.test.js +21 -0
- package/lib/commonjs/__test__/iap.test.js.map +1 -0
- package/lib/commonjs/hooks/useIAP.js +78 -0
- package/lib/commonjs/hooks/useIAP.js.map +1 -0
- package/lib/commonjs/hooks/withIAPContext.js +92 -0
- package/lib/commonjs/hooks/withIAPContext.js.map +1 -0
- package/lib/commonjs/iap.js +586 -0
- package/lib/commonjs/iap.js.map +1 -0
- package/lib/commonjs/index.js +59 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types/amazon.js +2 -0
- package/lib/commonjs/types/amazon.js.map +1 -0
- package/lib/commonjs/types/android.js +55 -0
- package/lib/commonjs/types/android.js.map +1 -0
- package/lib/commonjs/types/apple.js +165 -0
- package/lib/commonjs/types/apple.js.map +1 -0
- package/lib/commonjs/types/index.js +59 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/module/__test__/iap.test.js +17 -0
- package/lib/module/__test__/iap.test.js.map +1 -0
- package/lib/module/hooks/useIAP.js +68 -0
- package/lib/module/hooks/useIAP.js.map +1 -0
- package/lib/module/hooks/withIAPContext.js +76 -0
- package/lib/module/hooks/withIAPContext.js.map +1 -0
- package/lib/module/iap.js +494 -0
- package/lib/module/iap.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types/amazon.js +2 -0
- package/lib/module/types/amazon.js.map +1 -0
- package/lib/module/types/android.js +44 -0
- package/lib/module/types/android.js.map +1 -0
- package/lib/module/types/apple.js +153 -0
- package/lib/module/types/apple.js.map +1 -0
- package/lib/module/types/index.js +48 -0
- package/lib/module/types/index.js.map +1 -0
- package/{src → lib/typescript}/__test__/iap.test.d.ts +0 -0
- package/{src → lib/typescript}/hooks/useIAP.d.ts +1 -1
- package/{src → lib/typescript}/hooks/withIAPContext.d.ts +1 -1
- package/{src → lib/typescript}/iap.d.ts +17 -12
- package/{src → lib/typescript}/index.d.ts +2 -1
- package/{src → lib/typescript}/types/amazon.d.ts +0 -0
- package/{src → lib/typescript}/types/android.d.ts +0 -0
- package/{src → lib/typescript}/types/apple.d.ts +0 -0
- package/{src → lib/typescript}/types/index.d.ts +35 -22
- package/package.json +87 -57
- package/src/__test__/iap.test.ts +20 -0
- package/src/hooks/useIAP.ts +130 -0
- package/src/hooks/withIAPContext.tsx +160 -0
- package/src/iap.ts +700 -0
- package/src/{index.js → index.ts} +4 -1
- package/src/types/amazon.ts +23 -0
- package/src/types/android.ts +51 -0
- package/src/types/apple.ts +467 -0
- package/src/types/index.ts +185 -0
- package/.editorconfig +0 -10
- package/.flowconfig +0 -11
- package/.monolinterrc +0 -3
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-3.2.0.cjs +0 -785
- package/.yarnrc.yml +0 -3
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -160
- package/android/gradlew.bat +0 -90
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleInterface.kt +0 -44
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleV4.kt +0 -656
- package/babel.config.js +0 -10
- package/index.d.ts +0 -3
- package/index.js +0 -3
- package/index.js.flow +0 -9
- package/ios/RNIap.xcodeproj/xcshareddata/xcschemes/RNIap.xcscheme +0 -80
- package/ios/RNIapQueue.swift +0 -36
- package/jest.config.js +0 -194
- package/src/__test__/iap.test.js +0 -59
- package/src/hooks/useIAP.js +0 -141
- package/src/hooks/withIAPContext.js +0 -150
- package/src/iap.js +0 -640
- package/src/types/amazon.js +0 -1
- package/src/types/android.js +0 -22
- package/src/types/apple.js +0 -165
- package/src/types/index.js +0 -40
- package/test/mocks/react-native-modules.js +0 -14
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export enum IAPErrorCode {
|
|
2
|
+
E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',
|
|
3
|
+
E_UNKNOWN = 'E_UNKNOWN',
|
|
4
|
+
E_USER_CANCELLED = 'E_USER_CANCELLED',
|
|
5
|
+
E_USER_ERROR = 'E_USER_ERROR',
|
|
6
|
+
E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',
|
|
7
|
+
E_REMOTE_ERROR = 'E_REMOTE_ERROR',
|
|
8
|
+
E_NETWORK_ERROR = 'E_NETWORK_ERROR',
|
|
9
|
+
E_SERVICE_ERROR = 'E_SERVICE_ERROR',
|
|
10
|
+
E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',
|
|
11
|
+
E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',
|
|
12
|
+
E_NOT_PREPARED = 'E_NOT_PREPARED',
|
|
13
|
+
E_NOT_ENDED = 'E_NOT_ENDED',
|
|
14
|
+
E_ALREADY_OWNED = 'E_ALREADY_OWNED',
|
|
15
|
+
E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',
|
|
16
|
+
E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',
|
|
17
|
+
E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum ProrationModesAndroid {
|
|
21
|
+
IMMEDIATE_WITH_TIME_PRORATION = 1,
|
|
22
|
+
IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,
|
|
23
|
+
IMMEDIATE_WITHOUT_PRORATION = 3,
|
|
24
|
+
DEFERRED = 4,
|
|
25
|
+
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum PurchaseStateAndroid {
|
|
29
|
+
UNSPECIFIED_STATE = 0,
|
|
30
|
+
PURCHASED = 1,
|
|
31
|
+
PENDING = 2,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const PROMOTED_PRODUCT = 'iap-promoted-product';
|
|
35
|
+
|
|
36
|
+
export enum InstallSourceAndroid {
|
|
37
|
+
NOT_SET = 0,
|
|
38
|
+
GOOGLE_PLAY = 1,
|
|
39
|
+
AMAZON = 2,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ProductCommon {
|
|
43
|
+
type: 'subs' | 'sub' | 'inapp' | 'iap';
|
|
44
|
+
productId: string;
|
|
45
|
+
productIds?: string[];
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
price: string;
|
|
49
|
+
currency: string;
|
|
50
|
+
localizedPrice: string;
|
|
51
|
+
countryCode?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ProductPurchase {
|
|
55
|
+
productId: string;
|
|
56
|
+
transactionId?: string;
|
|
57
|
+
transactionDate: number;
|
|
58
|
+
transactionReceipt: string;
|
|
59
|
+
purchaseToken?: string;
|
|
60
|
+
//iOS
|
|
61
|
+
quantityIOS?: number;
|
|
62
|
+
originalTransactionDateIOS?: string;
|
|
63
|
+
originalTransactionIdentifierIOS?: string;
|
|
64
|
+
//Android
|
|
65
|
+
productIds?: string[];
|
|
66
|
+
dataAndroid?: string;
|
|
67
|
+
signatureAndroid?: string;
|
|
68
|
+
autoRenewingAndroid?: boolean;
|
|
69
|
+
purchaseStateAndroid?: PurchaseStateAndroid;
|
|
70
|
+
isAcknowledgedAndroid?: boolean;
|
|
71
|
+
packageNameAndroid?: string;
|
|
72
|
+
developerPayloadAndroid?: string;
|
|
73
|
+
obfuscatedAccountIdAndroid?: string;
|
|
74
|
+
obfuscatedProfileIdAndroid?: string;
|
|
75
|
+
//Amazon
|
|
76
|
+
userIdAmazon?: string;
|
|
77
|
+
userMarketplaceAmazon?: string;
|
|
78
|
+
userJsonAmazon?: string;
|
|
79
|
+
isCanceledAmazon?: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface PurchaseResult {
|
|
83
|
+
responseCode?: number;
|
|
84
|
+
debugMessage?: string;
|
|
85
|
+
code?: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface PurchaseError {
|
|
90
|
+
responseCode?: number;
|
|
91
|
+
debugMessage?: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
message?: string;
|
|
94
|
+
productId?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type InAppPurchase = ProductPurchase;
|
|
98
|
+
|
|
99
|
+
export interface SubscriptionPurchase extends ProductPurchase {
|
|
100
|
+
autoRenewingAndroid?: boolean;
|
|
101
|
+
originalTransactionDateIOS?: string;
|
|
102
|
+
originalTransactionIdentifierIOS?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type Purchase = InAppPurchase | SubscriptionPurchase;
|
|
106
|
+
|
|
107
|
+
export interface Discount {
|
|
108
|
+
identifier: string;
|
|
109
|
+
type: string;
|
|
110
|
+
numberOfPeriods: string;
|
|
111
|
+
price: string;
|
|
112
|
+
localizedPrice: string;
|
|
113
|
+
paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
114
|
+
subscriptionPeriod: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface Product extends ProductCommon {
|
|
118
|
+
type: 'inapp' | 'iap';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface Subscription extends ProductCommon {
|
|
122
|
+
type: 'subs' | 'sub';
|
|
123
|
+
|
|
124
|
+
discounts?: Discount[];
|
|
125
|
+
|
|
126
|
+
introductoryPrice?: string;
|
|
127
|
+
introductoryPriceAsAmountIOS?: string;
|
|
128
|
+
introductoryPricePaymentModeIOS?:
|
|
129
|
+
| ''
|
|
130
|
+
| 'FREETRIAL'
|
|
131
|
+
| 'PAYASYOUGO'
|
|
132
|
+
| 'PAYUPFRONT';
|
|
133
|
+
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
134
|
+
introductoryPriceSubscriptionPeriodIOS?:
|
|
135
|
+
| 'DAY'
|
|
136
|
+
| 'WEEK'
|
|
137
|
+
| 'MONTH'
|
|
138
|
+
| 'YEAR'
|
|
139
|
+
| '';
|
|
140
|
+
|
|
141
|
+
subscriptionPeriodNumberIOS?: string;
|
|
142
|
+
subscriptionPeriodUnitIOS?: '' | 'YEAR' | 'MONTH' | 'WEEK' | 'DAY';
|
|
143
|
+
|
|
144
|
+
introductoryPriceAsAmountAndroid: string;
|
|
145
|
+
introductoryPriceCyclesAndroid?: string;
|
|
146
|
+
introductoryPricePeriodAndroid?: string;
|
|
147
|
+
subscriptionPeriodAndroid?: string;
|
|
148
|
+
freeTrialPeriodAndroid?: string;
|
|
149
|
+
//Android V5
|
|
150
|
+
productType?: string;
|
|
151
|
+
name?: string;
|
|
152
|
+
oneTimePurchaseOfferDetails?: {
|
|
153
|
+
priceCurrencyCode?: string;
|
|
154
|
+
formattedPrice?: string;
|
|
155
|
+
priceAmountMicros?: string;
|
|
156
|
+
}[];
|
|
157
|
+
subscriptionOfferDetails?: {
|
|
158
|
+
offerToken?: string[];
|
|
159
|
+
pricingPhases: {
|
|
160
|
+
pricingPhaseList: {
|
|
161
|
+
formattedPrice?: string;
|
|
162
|
+
priceCurrencyCode?: string;
|
|
163
|
+
billingPeriod?: string;
|
|
164
|
+
billingCycleCount?: number;
|
|
165
|
+
priceAmountMicros?: string;
|
|
166
|
+
recurrenceMode?: number;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
}[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface RequestPurchase {
|
|
173
|
+
sku: string;
|
|
174
|
+
andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;
|
|
175
|
+
applicationUsername?: string;
|
|
176
|
+
obfuscatedAccountIdAndroid?: string;
|
|
177
|
+
obfuscatedProfileIdAndroid?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface RequestSubscription extends RequestPurchase {
|
|
181
|
+
purchaseTokenAndroid?: string;
|
|
182
|
+
prorationModeAndroid?: ProrationModesAndroid;
|
|
183
|
+
selectedOfferIndices?: number[] | undefined; //For Android Billing V5
|
|
184
|
+
skus?: string[] | undefined; // For AndroidBilling V5
|
|
185
|
+
}
|
package/.editorconfig
DELETED
package/.flowconfig
DELETED
package/.monolinterrc
DELETED
package/.yarn/install-state.gz
DELETED
|
Binary file
|