react-native-iap 8.0.9 → 8.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.
Binary file
@@ -51,7 +51,10 @@ class RNIapAmazonModule(reactContext: ReactApplicationContext?) :
51
51
  var ii = 0
52
52
  val skuSize = skuArr.size()
53
53
  while (ii < skuSize) {
54
- productSkus.add(skuArr.getString(ii))
54
+ val sku = skuArr.getString(ii)
55
+ if (sku is String) {
56
+ productSkus.add(sku)
57
+ }
55
58
  ii++
56
59
  }
57
60
  DoobooUtils.instance.addPromiseForKey(PROMISE_GET_PRODUCT_DATA, promise)
@@ -203,7 +203,10 @@ class RNIapModule(reactContext: ReactApplicationContext) :
203
203
  override fun run(billingClient: BillingClient) {
204
204
  val skuList = ArrayList<String>()
205
205
  for (i in 0 until skuArr.size()) {
206
- skuList.add(skuArr.getString(i))
206
+ val sku = skuArr.getString(i)
207
+ if (sku is String) {
208
+ skuList.add(sku)
209
+ }
207
210
  }
208
211
  val params = SkuDetailsParams.newBuilder()
209
212
  params.setSkusList(skuList).setType(type!!)
package/index.js.flow CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Flowtype definitions for index
3
3
  * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.16.0
4
+ * Flowgen v1.19.0
5
5
  */
6
6
 
7
7
  declare export * from "./src";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "8.0.9",
3
+ "version": "8.1.1",
4
4
  "packageManager": "yarn@3.2.0",
5
5
  "description": "React Native In App Purchase Module.",
6
6
  "main": "index.js",
@@ -44,31 +44,31 @@
44
44
  "dooboolab-welcome": "1.3.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/core": "7.16.0",
48
- "@babel/plugin-proposal-class-properties": "7.16.0",
49
- "@babel/plugin-proposal-private-methods": "7.16.0",
50
- "@babel/preset-env": "7.16.4",
51
- "@babel/preset-react": "7.16.0",
52
- "@babel/preset-typescript": "7.16.0",
53
- "@dooboo/eslint-config": "1.2.2",
54
- "@testing-library/jest-native": "4.0.4",
55
- "@testing-library/react-native": "8.0.0",
56
- "@types/eslint": "8.2.0",
57
- "@types/jest": "27.0.3",
58
- "@types/react": "17.0.37",
59
- "@types/react-native": "0.66.6",
60
- "@typescript-eslint/eslint-plugin": "^5.9.0",
47
+ "@babel/core": "7.18.2",
48
+ "@babel/plugin-proposal-class-properties": "7.17.12",
49
+ "@babel/plugin-proposal-private-methods": "7.17.12",
50
+ "@babel/preset-env": "7.18.2",
51
+ "@babel/preset-react": "7.17.12",
52
+ "@babel/preset-typescript": "7.17.12",
53
+ "@dooboo/eslint-config": "1.3.4",
54
+ "@testing-library/jest-native": "4.0.5",
55
+ "@testing-library/react-native": "9.1.0",
56
+ "@types/eslint": "8.4.2",
57
+ "@types/jest": "27.5.1",
58
+ "@types/react": "18.0.10",
59
+ "@types/react-native": "0.67.7",
60
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
61
61
  "babel-core": "7.0.0-bridge.0",
62
- "babel-jest": "27.4.2",
63
- "eslint": "8.3.0",
64
- "flow-bin": "0.166.1",
65
- "flowgen": "1.16.0",
66
- "jest": "27.4.3",
67
- "metro-react-native-babel-preset": "0.66.2",
62
+ "babel-jest": "28.1.0",
63
+ "eslint": "8.16.0",
64
+ "flow-bin": "0.179.0",
65
+ "flowgen": "1.19.0",
66
+ "jest": "28.1.0",
67
+ "metro-react-native-babel-preset": "0.71.0",
68
68
  "monolinter": "1.0.4",
69
- "prettier": "2.5.0",
70
- "react-native": "0.65.1",
71
- "ts-jest": "27.0.7",
72
- "typescript": "4.5.2"
69
+ "prettier": "2.6.2",
70
+ "react-native": "0.66.4",
71
+ "ts-jest": "28.0.3",
72
+ "typescript": "4.7.2"
73
73
  }
74
74
  }
package/src/iap.d.ts CHANGED
@@ -5,7 +5,7 @@ import { EmitterSubscription } from 'react-native';
5
5
  import { InAppPurchase, InstallSourceAndroid, Product, ProductPurchase, ProrationModesAndroid, PurchaseError, PurchaseResult, Subscription, SubscriptionPurchase } from './types';
6
6
  export declare const getInstallSourceAndroid: () => InstallSourceAndroid;
7
7
  /**
8
- * Init module for purchase flow. Required on Android. In ios it will check wheter user canMakePayment.
8
+ * Init module for purchase flow. Required on Android. In ios it will check whether user canMakePayment.
9
9
  * @returns {Promise<boolean>}
10
10
  */
11
11
  export declare const initConnection: () => Promise<boolean>;
@@ -79,7 +79,7 @@ export declare const requestPurchaseWithQuantityIOS: (sku: string, quantity: num
79
79
  * @param {string} developerPayloadAndroid Android developerPayload.
80
80
  * @returns {Promise<string | void> }
81
81
  */
82
- export declare const finishTransaction: (purchase: InAppPurchase | ProductPurchase, isConsumable?: boolean | undefined, developerPayloadAndroid?: string | undefined) => Promise<string | void>;
82
+ export declare const finishTransaction: (purchase: InAppPurchase | ProductPurchase, isConsumable?: boolean, developerPayloadAndroid?: string) => Promise<string | void>;
83
83
  /**
84
84
  * Clear Transaction (iOS only)
85
85
  * Finish remaining transactions. Related to issue #257 and #801
@@ -99,7 +99,7 @@ export declare const clearProductsIOS: () => Promise<void>;
99
99
  * @param {string} token The product's token (on Android)
100
100
  * @returns {Promise<PurchaseResult | void>}
101
101
  */
102
- export declare const acknowledgePurchaseAndroid: (token: string, developerPayload?: string | undefined) => Promise<PurchaseResult | void>;
102
+ export declare const acknowledgePurchaseAndroid: (token: string, developerPayload?: string) => Promise<PurchaseResult | void>;
103
103
  /**
104
104
  * Deep link to subscriptions screen on Android. No-op on iOS.
105
105
  * @param {string} sku The product's SKU (on Android)
@@ -121,7 +121,7 @@ export declare const buyPromotedProductIOS: () => Promise<void>;
121
121
  /**
122
122
  * Buy products or subscriptions with offers (iOS only)
123
123
  *
124
- * Runs the payment process with some infor you must fetch
124
+ * Runs the payment process with some info you must fetch
125
125
  * from your server.
126
126
  * @param {string} sku The product identifier
127
127
  * @param {string} forUser An user identifier on you system
@@ -140,7 +140,7 @@ export declare const requestPurchaseWithOfferIOS: (sku: string, forUser: string,
140
140
  * @param {boolean} isTest whether this is in test environment which is sandbox.
141
141
  * @returns {Promise<Apple.ReceiptValidationResponse | false>}
142
142
  */
143
- export declare const validateReceiptIos: (receiptBody: Record<string, unknown>, isTest?: boolean | undefined) => Promise<Apple.ReceiptValidationResponse | false>;
143
+ export declare const validateReceiptIos: (receiptBody: Record<string, unknown>, isTest?: boolean) => Promise<Apple.ReceiptValidationResponse | false>;
144
144
  /**
145
145
  * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
146
146
  * your access token in the binary you ship to users is potentially dangerous.
@@ -152,7 +152,7 @@ export declare const validateReceiptIos: (receiptBody: Record<string, unknown>,
152
152
  * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
153
153
  * @returns {Promise<object>}
154
154
  */
155
- export declare const validateReceiptAndroid: (packageName: string, productId: string, productToken: string, accessToken: string, isSub?: boolean | undefined) => Promise<Android.ReceiptType>;
155
+ export declare const validateReceiptAndroid: (packageName: string, productId: string, productToken: string, accessToken: string, isSub?: boolean) => Promise<Android.ReceiptType>;
156
156
  /**
157
157
  * Validate receipt for Amazon. NOTE: This method is here for debugging purposes only. Including
158
158
  * your developer secret in the binary you ship to users is potentially dangerous.
@@ -179,7 +179,7 @@ export declare const purchaseErrorListener: (listener: (errorEvent: PurchaseErro
179
179
  * @param {forceRefresh?:boolean}
180
180
  * @returns {Promise<string>}
181
181
  */
182
- export declare const getReceiptIOS: (forceRefresh?: boolean | undefined) => Promise<string>;
182
+ export declare const getReceiptIOS: (forceRefresh?: boolean) => Promise<string>;
183
183
  /**
184
184
  * Get the pending purchases in IOS.
185
185
  * @returns {Promise<ProductPurchase[]>}
@@ -190,8 +190,3 @@ export declare const getPendingPurchasesIOS: () => Promise<ProductPurchase[]>;
190
190
  * @returns {Promise<null>}
191
191
  */
192
192
  export declare const presentCodeRedemptionSheetIOS: () => Promise<null>;
193
- /**
194
- * Checks if the internal client is ready to be used (Android only)
195
- * @returns {Promise<boolean>}
196
- */
197
- export declare const isReadyAndroid: () => Promise<boolean>;
package/src/iap.js CHANGED
@@ -71,7 +71,7 @@ var getNativeModule = function () {
71
71
  : RNIapIos;
72
72
  };
73
73
  /**
74
- * Init module for purchase flow. Required on Android. In ios it will check wheter user canMakePayment.
74
+ * Init module for purchase flow. Required on Android. In ios it will check whether user canMakePayment.
75
75
  * @returns {Promise<boolean>}
76
76
  */
77
77
  export var initConnection = function () {
@@ -463,7 +463,7 @@ var requestAgnosticReceiptValidationIos = function (receiptBody) { return __awai
463
463
  /**
464
464
  * Buy products or subscriptions with offers (iOS only)
465
465
  *
466
- * Runs the payment process with some infor you must fetch
466
+ * Runs the payment process with some info you must fetch
467
467
  * from your server.
468
468
  * @param {string} sku The product identifier
469
469
  * @param {string} forUser An user identifier on you system
@@ -551,12 +551,12 @@ export var validateReceiptAndroid = function (packageName, productId, productTok
551
551
  export var validateReceiptAmazon = function (developerSecret, userId, receiptId, useSandbox) {
552
552
  if (useSandbox === void 0) { useSandbox = true; }
553
553
  return __awaiter(void 0, void 0, void 0, function () {
554
- var sandoboxUrl, url, response;
554
+ var sandBoxUrl, url, response;
555
555
  return __generator(this, function (_a) {
556
556
  switch (_a.label) {
557
557
  case 0:
558
- sandoboxUrl = useSandbox ? 'sandbox/' : '';
559
- url = "https://appstore-sdk.amazon.com/".concat(sandoboxUrl, "version/1.0/verifyReceiptId/developer/").concat(developerSecret, "/user/").concat(userId, "/receiptId/").concat(receiptId);
558
+ sandBoxUrl = useSandbox ? 'sandbox/' : '';
559
+ url = "https://appstore-sdk.amazon.com/".concat(sandBoxUrl, "version/1.0/verifyReceiptId/developer/").concat(developerSecret, "/user/").concat(userId, "/receiptId/").concat(receiptId);
560
560
  return [4 /*yield*/, fetch(url, {
561
561
  method: 'GET',
562
562
  headers: {
@@ -616,10 +616,3 @@ export var getPendingPurchasesIOS = function () { return __awaiter(void 0, void
616
616
  export var presentCodeRedemptionSheetIOS = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
617
617
  return [2 /*return*/, getIosModule().presentCodeRedemptionSheet()];
618
618
  }); }); };
619
- /**
620
- * Checks if the internal client is ready to be used (Android only)
621
- * @returns {Promise<boolean>}
622
- */
623
- export var isReadyAndroid = function () {
624
- return getAndroidModule().isReadyAndroid();
625
- };