react-native-iap 14.4.29 → 14.4.30

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.
@@ -222,7 +222,9 @@ class HybridRnIap : HybridRnIapSpec() {
222
222
 
223
223
  val products: List<ProductCommon> = when (queryType) {
224
224
  ProductQueryType.All -> {
225
- val collected = linkedMapOf<String, ProductCommon>()
225
+ // Fetch both InApp and Subs products
226
+ val byId = mutableMapOf<String, ProductCommon>()
227
+
226
228
  listOf(ProductQueryType.InApp, ProductQueryType.Subs).forEach { kind ->
227
229
  RnIapLog.payload(
228
230
  "fetchProducts.native",
@@ -233,9 +235,15 @@ class HybridRnIap : HybridRnIapSpec() {
233
235
  "fetchProducts.native",
234
236
  fetched.map { mapOf("id" to it.id, "type" to it.type.rawValue) }
235
237
  )
236
- fetched.forEach { collected[it.id] = it }
238
+
239
+ // Collect products by ID (no duplicates possible in Play Billing)
240
+ fetched.forEach { product ->
241
+ byId.putIfAbsent(product.id, product)
242
+ }
237
243
  }
238
- collected.values.toList()
244
+
245
+ // Return products in the same order as input skusList
246
+ skusList.mapNotNull { byId[it] }
239
247
  }
240
248
  else -> {
241
249
  RnIapLog.payload(
@@ -247,7 +255,10 @@ class HybridRnIap : HybridRnIapSpec() {
247
255
  "fetchProducts.native",
248
256
  fetched.map { mapOf("id" to it.id, "type" to it.type.rawValue) }
249
257
  )
250
- fetched
258
+
259
+ // Preserve input order for non-All queries
260
+ val byId = fetched.associateBy { it.id }
261
+ skusList.mapNotNull { byId[it] }
251
262
  }
252
263
  }
253
264
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "14.4.29",
3
+ "version": "14.4.30",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",