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.
Files changed (94) hide show
  1. package/README.md +11 -22
  2. package/RNIap.podspec +33 -18
  3. package/android/build.gradle +137 -38
  4. package/android/gradle.properties +8 -0
  5. package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +99 -89
  6. package/android/src/play/java/com/dooboolab/RNIap/RNIapPackage.kt +0 -1
  7. package/android/src/testPlay/java/com/dooboolab/RNIap/{RNIapModuleTestV4.kt → RNIapModuleTest.kt} +47 -35
  8. package/ios/RNIapIos-Bridging-Header.h +2 -0
  9. package/ios/RNIapIos.m +14 -1
  10. package/ios/RNIapIos.swift +903 -883
  11. package/ios/{RNIap.xcodeproj → RNIapIos.xcodeproj}/project.pbxproj +29 -116
  12. package/lib/commonjs/__test__/iap.test.js +21 -0
  13. package/lib/commonjs/__test__/iap.test.js.map +1 -0
  14. package/lib/commonjs/hooks/useIAP.js +78 -0
  15. package/lib/commonjs/hooks/useIAP.js.map +1 -0
  16. package/lib/commonjs/hooks/withIAPContext.js +92 -0
  17. package/lib/commonjs/hooks/withIAPContext.js.map +1 -0
  18. package/lib/commonjs/iap.js +586 -0
  19. package/lib/commonjs/iap.js.map +1 -0
  20. package/lib/commonjs/index.js +59 -0
  21. package/lib/commonjs/index.js.map +1 -0
  22. package/lib/commonjs/types/amazon.js +2 -0
  23. package/lib/commonjs/types/amazon.js.map +1 -0
  24. package/lib/commonjs/types/android.js +55 -0
  25. package/lib/commonjs/types/android.js.map +1 -0
  26. package/lib/commonjs/types/apple.js +165 -0
  27. package/lib/commonjs/types/apple.js.map +1 -0
  28. package/lib/commonjs/types/index.js +59 -0
  29. package/lib/commonjs/types/index.js.map +1 -0
  30. package/lib/module/__test__/iap.test.js +17 -0
  31. package/lib/module/__test__/iap.test.js.map +1 -0
  32. package/lib/module/hooks/useIAP.js +68 -0
  33. package/lib/module/hooks/useIAP.js.map +1 -0
  34. package/lib/module/hooks/withIAPContext.js +76 -0
  35. package/lib/module/hooks/withIAPContext.js.map +1 -0
  36. package/lib/module/iap.js +494 -0
  37. package/lib/module/iap.js.map +1 -0
  38. package/lib/module/index.js +6 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/types/amazon.js +2 -0
  41. package/lib/module/types/amazon.js.map +1 -0
  42. package/lib/module/types/android.js +44 -0
  43. package/lib/module/types/android.js.map +1 -0
  44. package/lib/module/types/apple.js +153 -0
  45. package/lib/module/types/apple.js.map +1 -0
  46. package/lib/module/types/index.js +48 -0
  47. package/lib/module/types/index.js.map +1 -0
  48. package/{src → lib/typescript}/__test__/iap.test.d.ts +0 -0
  49. package/{src → lib/typescript}/hooks/useIAP.d.ts +1 -1
  50. package/{src → lib/typescript}/hooks/withIAPContext.d.ts +1 -1
  51. package/{src → lib/typescript}/iap.d.ts +17 -12
  52. package/{src → lib/typescript}/index.d.ts +2 -1
  53. package/{src → lib/typescript}/types/amazon.d.ts +0 -0
  54. package/{src → lib/typescript}/types/android.d.ts +0 -0
  55. package/{src → lib/typescript}/types/apple.d.ts +0 -0
  56. package/{src → lib/typescript}/types/index.d.ts +35 -22
  57. package/package.json +87 -57
  58. package/src/__test__/iap.test.ts +20 -0
  59. package/src/hooks/useIAP.ts +130 -0
  60. package/src/hooks/withIAPContext.tsx +160 -0
  61. package/src/iap.ts +700 -0
  62. package/src/{index.js → index.ts} +4 -1
  63. package/src/types/amazon.ts +23 -0
  64. package/src/types/android.ts +51 -0
  65. package/src/types/apple.ts +467 -0
  66. package/src/types/index.ts +185 -0
  67. package/.editorconfig +0 -10
  68. package/.flowconfig +0 -11
  69. package/.monolinterrc +0 -3
  70. package/.yarn/install-state.gz +0 -0
  71. package/.yarn/releases/yarn-3.2.0.cjs +0 -785
  72. package/.yarnrc.yml +0 -3
  73. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  74. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  75. package/android/gradlew +0 -160
  76. package/android/gradlew.bat +0 -90
  77. package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleInterface.kt +0 -44
  78. package/android/src/play/java/com/dooboolab/RNIap/RNIapModuleV4.kt +0 -656
  79. package/babel.config.js +0 -10
  80. package/index.d.ts +0 -3
  81. package/index.js +0 -3
  82. package/index.js.flow +0 -9
  83. package/ios/RNIap.xcodeproj/xcshareddata/xcschemes/RNIap.xcscheme +0 -80
  84. package/ios/RNIapQueue.swift +0 -36
  85. package/jest.config.js +0 -194
  86. package/src/__test__/iap.test.js +0 -59
  87. package/src/hooks/useIAP.js +0 -141
  88. package/src/hooks/withIAPContext.js +0 -150
  89. package/src/iap.js +0 -640
  90. package/src/types/amazon.js +0 -1
  91. package/src/types/android.js +0 -22
  92. package/src/types/apple.js +0 -165
  93. package/src/types/index.js +0 -40
  94. 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
@@ -1,10 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- end_of_line = lf
5
- insert_final_newline = true
6
-
7
- [*.{js,json,yml}]
8
- charset = utf-8
9
- indent_style = space
10
- indent_size = 2
package/.flowconfig DELETED
@@ -1,11 +0,0 @@
1
- [ignore]
2
- <PROJECT_ROOT>/node_modules/.*
3
- [include]
4
-
5
- [libs]
6
-
7
- [lints]
8
-
9
- [options]
10
-
11
- [strict]
package/.monolinterrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "include":["package.json","docs/package.json","IapExample/package.json"]
3
- }
Binary file