react-native-iap 10.0.7 → 10.1.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.
Files changed (73) hide show
  1. package/README.md +0 -1
  2. package/android/src/amazon/java/com/dooboolab/RNIap/RNIapAmazonModule.kt +1 -2
  3. package/lib/commonjs/hooks/index.js +19 -0
  4. package/lib/commonjs/hooks/index.js.map +1 -0
  5. package/lib/commonjs/hooks/useIAP.js +8 -4
  6. package/lib/commonjs/hooks/useIAP.js.map +1 -1
  7. package/lib/commonjs/iap.js +390 -51
  8. package/lib/commonjs/iap.js.map +1 -1
  9. package/lib/commonjs/index.js +13 -0
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/modules/amazon.js +12 -0
  12. package/lib/commonjs/modules/amazon.js.map +1 -0
  13. package/lib/commonjs/modules/android.js +12 -0
  14. package/lib/commonjs/modules/android.js.map +1 -0
  15. package/lib/commonjs/modules/common.js +2 -0
  16. package/lib/commonjs/modules/common.js.map +1 -0
  17. package/lib/commonjs/modules/index.js +58 -0
  18. package/lib/commonjs/modules/index.js.map +1 -0
  19. package/lib/commonjs/modules/ios.js +6 -0
  20. package/lib/commonjs/modules/ios.js.map +1 -0
  21. package/lib/commonjs/types/amazon.js.map +1 -1
  22. package/lib/commonjs/types/apple.js +0 -163
  23. package/lib/commonjs/types/apple.js.map +1 -1
  24. package/lib/commonjs/types/index.js +11 -1
  25. package/lib/commonjs/types/index.js.map +1 -1
  26. package/lib/module/hooks/index.js +2 -0
  27. package/lib/module/hooks/index.js.map +1 -0
  28. package/lib/module/hooks/useIAP.js +6 -4
  29. package/lib/module/hooks/useIAP.js.map +1 -1
  30. package/lib/module/iap.js +391 -50
  31. package/lib/module/iap.js.map +1 -1
  32. package/lib/module/index.js +1 -0
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/modules/amazon.js +3 -0
  35. package/lib/module/modules/amazon.js.map +1 -0
  36. package/lib/module/modules/android.js +3 -0
  37. package/lib/module/modules/android.js.map +1 -0
  38. package/lib/module/modules/common.js +2 -0
  39. package/lib/module/modules/common.js.map +1 -0
  40. package/lib/module/modules/index.js +5 -0
  41. package/lib/module/modules/index.js.map +1 -0
  42. package/lib/module/modules/ios.js +2 -0
  43. package/lib/module/modules/ios.js.map +1 -0
  44. package/lib/module/types/amazon.js.map +1 -1
  45. package/lib/module/types/apple.js +0 -151
  46. package/lib/module/types/apple.js.map +1 -1
  47. package/lib/module/types/index.js +9 -0
  48. package/lib/module/types/index.js.map +1 -1
  49. package/lib/typescript/hooks/index.d.ts +1 -0
  50. package/lib/typescript/hooks/useIAP.d.ts +6 -3
  51. package/lib/typescript/iap.d.ts +356 -65
  52. package/lib/typescript/index.d.ts +1 -0
  53. package/lib/typescript/modules/amazon.d.ts +23 -0
  54. package/lib/typescript/modules/android.d.ts +24 -0
  55. package/lib/typescript/modules/common.d.ts +13 -0
  56. package/lib/typescript/modules/index.d.ts +4 -0
  57. package/lib/typescript/modules/ios.d.ts +32 -0
  58. package/lib/typescript/types/amazon.d.ts +8 -0
  59. package/lib/typescript/types/apple.d.ts +0 -399
  60. package/lib/typescript/types/index.d.ts +51 -1
  61. package/package.json +7 -2
  62. package/src/hooks/index.ts +1 -0
  63. package/src/hooks/useIAP.ts +11 -5
  64. package/src/iap.ts +420 -91
  65. package/src/index.ts +1 -0
  66. package/src/modules/amazon.ts +40 -0
  67. package/src/modules/android.ts +65 -0
  68. package/src/modules/common.ts +16 -0
  69. package/src/modules/index.ts +4 -0
  70. package/src/modules/ios.ts +57 -0
  71. package/src/types/amazon.ts +9 -0
  72. package/src/types/apple.ts +0 -438
  73. package/src/types/index.ts +71 -4
@@ -1,3 +1,11 @@
1
+ import type {
2
+ AmazonModuleProps,
3
+ AndroidModuleProps,
4
+ IosModuleProps,
5
+ } from '../modules';
6
+
7
+ import type * as Apple from './apple';
8
+
1
9
  export type Sku = string;
2
10
 
3
11
  export enum ProrationModesAndroid {
@@ -23,9 +31,23 @@ export enum InstallSourceAndroid {
23
31
  AMAZON = 2,
24
32
  }
25
33
 
34
+ export enum ProductType {
35
+ /** Subscription */
36
+ subs = 'subs',
37
+
38
+ /** Subscription */
39
+ sub = 'sub',
40
+
41
+ /** Consumable */
42
+ inapp = 'inapp',
43
+
44
+ /** Consumable */
45
+ iap = 'iap',
46
+ }
47
+
26
48
  export interface ProductCommon {
27
49
  type: 'subs' | 'sub' | 'inapp' | 'iap';
28
- productId: string;
50
+ productId: string; //iOS
29
51
  productIds?: string[];
30
52
  title: string;
31
53
  description: string;
@@ -68,6 +90,7 @@ export interface PurchaseResult {
68
90
  debugMessage?: string;
69
91
  code?: string;
70
92
  message?: string;
93
+ purchaseToken?: string;
71
94
  }
72
95
 
73
96
  export interface SubscriptionPurchase extends ProductPurchase {
@@ -88,15 +111,19 @@ export interface Discount {
88
111
  subscriptionPeriod: string;
89
112
  }
90
113
 
91
- export interface Product extends ProductCommon {
114
+ export interface ProductAndroid extends ProductCommon {
92
115
  type: 'inapp' | 'iap';
93
- // Android V5
94
116
  oneTimePurchaseOfferDetails?: {
95
117
  priceCurrencyCode: string;
96
118
  formattedPrice: string;
97
119
  priceAmountMicros: string;
98
120
  };
99
121
  }
122
+ export interface ProductIOS extends ProductCommon {
123
+ type: 'inapp' | 'iap';
124
+ }
125
+
126
+ export type Product = ProductAndroid & ProductIOS;
100
127
 
101
128
  // Android V5
102
129
  export interface SubscriptionAndroid extends ProductCommon {
@@ -124,7 +151,6 @@ export interface SubscriptionAndroid extends ProductCommon {
124
151
 
125
152
  export interface SubscriptionIOS extends ProductCommon {
126
153
  type: 'subs';
127
-
128
154
  discounts?: Discount[];
129
155
  introductoryPrice?: string;
130
156
  introductoryPriceAsAmountIOS?: string;
@@ -146,6 +172,28 @@ export interface SubscriptionIOS extends ProductCommon {
146
172
  }
147
173
 
148
174
  export type Subscription = SubscriptionAndroid & SubscriptionIOS;
175
+ export interface RequestPurchaseBaseAndroid {
176
+ obfuscatedAccountIdAndroid?: string;
177
+ obfuscatedProfileIdAndroid?: string;
178
+ isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price
179
+ }
180
+
181
+ export interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {
182
+ skus?: Sku[];
183
+ }
184
+
185
+ export interface RequestPurchaseIOS {
186
+ sku?: Sku;
187
+ andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;
188
+ /**
189
+ * UUID representing user account
190
+ */
191
+ applicationUsername?: string;
192
+ quantity?: number;
193
+ withOffer?: Apple.PaymentDiscount;
194
+ }
195
+
196
+ export type RequestPurchase = RequestPurchaseAndroid & RequestPurchaseIOS;
149
197
 
150
198
  /**
151
199
  * In order to purchase a new subscription, every sku must have a selected offerToken
@@ -155,3 +203,22 @@ export interface SubscriptionOffer {
155
203
  sku: Sku;
156
204
  offerToken: string;
157
205
  }
206
+
207
+ export interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {
208
+ purchaseTokenAndroid?: string;
209
+ prorationModeAndroid?: ProrationModesAndroid;
210
+ subscriptionOffers?: SubscriptionOffer[]; // For AndroidBilling V5
211
+ }
212
+
213
+ export type RequestSubscriptionIOS = RequestPurchaseIOS;
214
+
215
+ export type RequestSubscription = RequestSubscriptionAndroid &
216
+ RequestSubscriptionIOS;
217
+
218
+ declare module 'react-native' {
219
+ interface NativeModulesStatic {
220
+ RNIapIos: IosModuleProps;
221
+ RNIapModule: AndroidModuleProps;
222
+ RNIapAmazonModule: AmazonModuleProps;
223
+ }
224
+ }