react-native-iap 9.0.0-beta4 → 9.0.0-beta7
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/.prettierignore +6 -0
- package/README.md +7 -2
- package/android/src/play/java/com/dooboolab/RNIap/RNIapModule.kt +13 -3
- package/babel.config.js +6 -4
- package/ios/RNIapIos.m +0 -1
- package/jest.config.js +8 -12
- package/package.json +7 -4
- package/src/types/index.d.ts +4 -6
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-3.2.0.cjs +0 -785
- package/.yarnrc.yml +0 -3
package/.prettierignore
ADDED
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# 
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/react-native-iap)
|
|
4
|
-
|
|
4
|
+
[](https://npmjs.org/package/react-native-iap)
|
|
5
|
+
|
|
5
6
|
[](https://npmjs.org/package/react-native-iap)
|
|
6
7
|
[](https://github.com/dooboolab/react-native-iap/actions/workflows/ci.yml)
|
|
7
8
|
[](https://github.com/dooboolab/react-native-iap/actions/workflows/deploy-document.yml)
|
|
@@ -20,7 +21,11 @@ Published in [website](https://react-native-iap.dooboolab.com).
|
|
|
20
21
|
|
|
21
22
|
## Announcement
|
|
22
23
|
|
|
23
|
-
-
|
|
24
|
+
- Version `9.0.0` is currently in release candidate. The module migrates android sdk to [play billing library v5](https://qonversion.io/blog/google-play-billing-library-5-0) and iOS sdk to [storekit2](https://developer.apple.com/videos/play/wwdc2021/10114). Our core maintainer [andresesfm](https://github.com/andresesfm) is working hard on this. Please [fund the project](https://opencollective.com/react-native-iap) if you wish to support his effort. The fund goes to maintainers. To try the earlier version please use the `next` package.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
yarn add react-native-iap@next
|
|
28
|
+
```
|
|
24
29
|
|
|
25
30
|
- Version `8.0.0` has finally landed in Jan 28th. Since this is early release, please use it with caution 🚧. We recommend user to use `>=8.0.0` with react-native `>=0.65.1`. The `next` package is no longer updated until we organize the roadmap for `9.0.0`.
|
|
26
31
|
|
|
@@ -321,7 +321,10 @@ class RNIapModule(
|
|
|
321
321
|
for (i in purchases.indices) {
|
|
322
322
|
val purchase = purchases[i]
|
|
323
323
|
val item = WritableNativeMap()
|
|
324
|
-
item.putString("productId", purchase.products[0])
|
|
324
|
+
item.putString("productId", purchase.products[0])// kept for convenience/backward-compatibility. productIds has the complete list
|
|
325
|
+
val products = Arguments.createArray()
|
|
326
|
+
purchase.products.forEach { products.pushString(it) }
|
|
327
|
+
item.putArray("productIds", products)
|
|
325
328
|
item.putString("transactionId", purchase.orderId)
|
|
326
329
|
item.putDouble("transactionDate", purchase.purchaseTime.toDouble())
|
|
327
330
|
item.putString("transactionReceipt", purchase.originalJson)
|
|
@@ -370,6 +373,9 @@ class RNIapModule(
|
|
|
370
373
|
purchaseHistoryRecordList?.forEach { purchase ->
|
|
371
374
|
val item = Arguments.createMap()
|
|
372
375
|
item.putString("productId", purchase.products[0])
|
|
376
|
+
val products = Arguments.createArray()
|
|
377
|
+
purchase.products.forEach { products.pushString(it) }
|
|
378
|
+
item.putArray("productIds", products)
|
|
373
379
|
item.putDouble("transactionDate", purchase.purchaseTime.toDouble())
|
|
374
380
|
item.putString("transactionReceipt", purchase.originalJson)
|
|
375
381
|
item.putString("purchaseToken", purchase.purchaseToken)
|
|
@@ -442,14 +448,14 @@ class RNIapModule(
|
|
|
442
448
|
if (obfuscatedProfileId != null) {
|
|
443
449
|
builder.setObfuscatedProfileId(obfuscatedProfileId)
|
|
444
450
|
}
|
|
445
|
-
if (prorationMode !=
|
|
451
|
+
if (prorationMode != -1) {
|
|
446
452
|
if (prorationMode
|
|
447
453
|
== BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE
|
|
448
454
|
) {
|
|
449
455
|
subscriptionUpdateParamsBuilder.setReplaceProrationMode(
|
|
450
456
|
BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE
|
|
451
457
|
)
|
|
452
|
-
if (type != BillingClient.
|
|
458
|
+
if (type != BillingClient.ProductType.SUBS) {
|
|
453
459
|
val debugMessage =
|
|
454
460
|
(
|
|
455
461
|
"IMMEDIATE_AND_CHARGE_PRORATED_PRICE for proration mode only works in" +
|
|
@@ -561,6 +567,7 @@ class RNIapModule(
|
|
|
561
567
|
.getBillingResponseData(billingResult.responseCode)
|
|
562
568
|
map.putString("code", errorData[0])
|
|
563
569
|
map.putString("message", errorData[1])
|
|
570
|
+
map.putString("purchaseToken",purchaseToken)
|
|
564
571
|
promise.safeResolve(map)
|
|
565
572
|
}
|
|
566
573
|
}
|
|
@@ -586,6 +593,9 @@ class RNIapModule(
|
|
|
586
593
|
val item = Arguments.createMap()
|
|
587
594
|
val purchase = purchases[i]
|
|
588
595
|
item.putString("productId", purchase.products[0])
|
|
596
|
+
val products = Arguments.createArray()
|
|
597
|
+
purchase.products.forEach { products.pushString(it) }
|
|
598
|
+
item.putArray("productIds", products)
|
|
589
599
|
item.putString("transactionId", purchase.orderId)
|
|
590
600
|
item.putDouble("transactionDate", purchase.purchaseTime.toDouble())
|
|
591
601
|
item.putString("transactionReceipt", purchase.originalJson)
|
package/babel.config.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
presets: [
|
|
3
|
+
'module:metro-react-native-babel-preset',
|
|
4
|
+
'@babel/preset-typescript',
|
|
5
|
+
'@babel/preset-env',
|
|
6
|
+
'@babel/preset-react',
|
|
7
|
+
],
|
|
6
8
|
plugins: [
|
|
7
9
|
'@babel/plugin-proposal-class-properties',
|
|
8
10
|
'@babel/plugin-proposal-private-methods',
|
package/ios/RNIapIos.m
CHANGED
|
@@ -18,7 +18,6 @@ RCT_EXTERN_METHOD(getAvailableItems:
|
|
|
18
18
|
reject:(RCTPromiseRejectBlock)reject)
|
|
19
19
|
RCT_EXTERN_METHOD(buyProduct:
|
|
20
20
|
(NSString*)sku
|
|
21
|
-
appAccountToken:(NSString*)appAccountToken
|
|
22
21
|
andDangerouslyFinishTransactionAutomatically:(BOOL)andDangerouslyFinishTransactionAutomatically
|
|
23
22
|
applicationUsername:(NSString)applicationUsername
|
|
24
23
|
resolve:(RCTPromiseResolveBlock)resolve
|
package/jest.config.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
|
21
21
|
// collectCoverageFrom: undefined,
|
|
22
22
|
|
|
23
23
|
// The directory where Jest should output its coverage files
|
|
24
|
-
coverageDirectory:
|
|
24
|
+
coverageDirectory: 'coverage',
|
|
25
25
|
|
|
26
26
|
// An array of regexp pattern strings used to skip coverage collection
|
|
27
27
|
// coveragePathIgnorePatterns: [
|
|
@@ -64,9 +64,7 @@ module.exports = {
|
|
|
64
64
|
// maxWorkers: "50%",
|
|
65
65
|
|
|
66
66
|
// An array of directory names to be searched recursively up from the requiring module's location
|
|
67
|
-
moduleDirectories: [
|
|
68
|
-
"node_modules","src"
|
|
69
|
-
],
|
|
67
|
+
moduleDirectories: ['node_modules', 'src'],
|
|
70
68
|
|
|
71
69
|
// An array of file extensions your modules use
|
|
72
70
|
// moduleFileExtensions: [
|
|
@@ -82,7 +80,7 @@ module.exports = {
|
|
|
82
80
|
// moduleNameMapper: {},
|
|
83
81
|
|
|
84
82
|
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
85
|
-
modulePathIgnorePatterns: [
|
|
83
|
+
modulePathIgnorePatterns: ['IapExample'],
|
|
86
84
|
|
|
87
85
|
// Activates notifications for test results
|
|
88
86
|
// notify: false,
|
|
@@ -123,7 +121,7 @@ module.exports = {
|
|
|
123
121
|
// runner: "jest-runner",
|
|
124
122
|
|
|
125
123
|
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
126
|
-
setupFiles: [
|
|
124
|
+
setupFiles: ['<rootDir>/test/mocks/react-native-modules.js'],
|
|
127
125
|
|
|
128
126
|
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
129
127
|
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
|
|
@@ -170,15 +168,13 @@ module.exports = {
|
|
|
170
168
|
// timers: "real",
|
|
171
169
|
|
|
172
170
|
// A map from regular expressions to paths to transformers
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
transform: {
|
|
172
|
+
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
|
|
173
|
+
'\\.(ts|tsx)$': 'ts-jest',
|
|
176
174
|
},
|
|
177
175
|
|
|
178
176
|
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
179
|
-
transformIgnorePatterns: [
|
|
180
|
-
'node_modules/(?!@react-native|react-native)'
|
|
181
|
-
],
|
|
177
|
+
transformIgnorePatterns: ['node_modules/(?!@react-native|react-native)'],
|
|
182
178
|
|
|
183
179
|
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
184
180
|
// unmockedModulePathPatterns: undefined,
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "9.0.0-
|
|
4
|
-
"packageManager": "yarn@3.2.0",
|
|
3
|
+
"version": "9.0.0-beta7",
|
|
5
4
|
"description": "React Native In App Purchase Module.",
|
|
6
5
|
"main": "index.js",
|
|
7
6
|
"types": "index.d.ts",
|
|
@@ -16,7 +15,8 @@
|
|
|
16
15
|
"test:typescript": "tsc --noEmit",
|
|
17
16
|
"tsc:sync": "npx typesync",
|
|
18
17
|
"tsc": "tsc",
|
|
19
|
-
"validate": "yarn lint && yarn test:typescript && yarn test:flow && yarn test"
|
|
18
|
+
"validate": "yarn lint && yarn test:typescript && yarn test:flow && yarn test",
|
|
19
|
+
"lint:prettier": "prettier --write \"**/*.{md,js,jsx,ts,tsx}\""
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -66,9 +66,12 @@
|
|
|
66
66
|
"jest": "28.1.0",
|
|
67
67
|
"metro-react-native-babel-preset": "0.71.0",
|
|
68
68
|
"monolinter": "1.0.4",
|
|
69
|
-
"prettier": "2.
|
|
69
|
+
"prettier": "2.7.1",
|
|
70
70
|
"react-native": "0.66.4",
|
|
71
71
|
"ts-jest": "28.0.3",
|
|
72
72
|
"typescript": "4.7.2"
|
|
73
|
+
},
|
|
74
|
+
"resolutions": {
|
|
75
|
+
"@react-native-community/eslint-config": "3.0.1"
|
|
73
76
|
}
|
|
74
77
|
}
|
package/src/types/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare enum InstallSourceAndroid {
|
|
|
37
37
|
export interface ProductCommon {
|
|
38
38
|
type: 'subs' | 'sub' | 'inapp' | 'iap';
|
|
39
39
|
productId: string;
|
|
40
|
+
productIds?: string[];
|
|
40
41
|
title: string;
|
|
41
42
|
description: string;
|
|
42
43
|
price: string;
|
|
@@ -46,6 +47,7 @@ export interface ProductCommon {
|
|
|
46
47
|
}
|
|
47
48
|
export interface ProductPurchase {
|
|
48
49
|
productId: string;
|
|
50
|
+
productIds?: string[];
|
|
49
51
|
transactionId?: string;
|
|
50
52
|
transactionDate: number;
|
|
51
53
|
transactionReceipt: string;
|
|
@@ -142,12 +144,8 @@ export interface RequestPurchase {
|
|
|
142
144
|
obfuscatedAccountIdAndroid: string | undefined;
|
|
143
145
|
obfuscatedProfileIdAndroid: string | undefined;
|
|
144
146
|
}
|
|
145
|
-
export interface RequestSubscription {
|
|
146
|
-
sku: string;
|
|
147
|
-
andDangerouslyFinishTransactionAutomaticallyIOS: boolean;
|
|
147
|
+
export interface RequestSubscription extends RequestPurchase {
|
|
148
148
|
purchaseTokenAndroid: string | undefined;
|
|
149
149
|
prorationModeAndroid: ProrationModesAndroid;
|
|
150
|
-
|
|
151
|
-
obfuscatedProfileIdAndroid: string | undefined;
|
|
152
|
-
selectedOfferIndex?: number | undefined;
|
|
150
|
+
selectedOfferIndex: number | undefined;
|
|
153
151
|
}
|
package/.yarn/install-state.gz
DELETED
|
Binary file
|