react-native-iap 15.6.1 → 16.0.0

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 (241) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +34 -182
  2. package/android/src/main/java/com/margelo/nitro/iap/ProductSerialization.kt +0 -69
  3. package/android/src/main/java/com/margelo/nitro/iap/RnIapLog.kt +0 -13
  4. package/ios/HybridRnIap.swift +30 -95
  5. package/ios/RnIapHelper.swift +37 -48
  6. package/ios/RnIapLog.swift +0 -11
  7. package/lib/module/hooks/useIAP.js +1 -11
  8. package/lib/module/hooks/useIAP.js.map +1 -1
  9. package/lib/module/index.js +45 -379
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/module/index.kepler.js +7 -82
  12. package/lib/module/index.kepler.js.map +1 -1
  13. package/lib/module/types.js +5 -57
  14. package/lib/module/types.js.map +1 -1
  15. package/lib/module/utils/errorMapping.js +13 -21
  16. package/lib/module/utils/errorMapping.js.map +1 -1
  17. package/lib/module/utils/type-bridge.js +39 -77
  18. package/lib/module/utils/type-bridge.js.map +1 -1
  19. package/lib/module/utils.js +5 -1
  20. package/lib/module/utils.js.map +1 -1
  21. package/lib/module/vega-adapter.js +10 -48
  22. package/lib/module/vega-adapter.js.map +1 -1
  23. package/lib/typescript/src/hooks/useIAP.d.ts +1 -49
  24. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  25. package/lib/typescript/src/index.d.ts +6 -175
  26. package/lib/typescript/src/index.d.ts.map +1 -1
  27. package/lib/typescript/src/index.kepler.d.ts +2 -54
  28. package/lib/typescript/src/index.kepler.d.ts.map +1 -1
  29. package/lib/typescript/src/specs/RnIap.nitro.d.ts +32 -173
  30. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  31. package/lib/typescript/src/types.d.ts +76 -284
  32. package/lib/typescript/src/types.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
  34. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  35. package/lib/typescript/src/utils.d.ts.map +1 -1
  36. package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
  37. package/nitrogen/generated/android/NitroIap+autolinking.cmake +5 -12
  38. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +0 -22
  39. package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +0 -2
  40. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +38 -189
  41. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -9
  42. package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +1 -7
  43. package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +1 -5
  44. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +3 -3
  45. package/nitrogen/generated/android/c++/JNitroProduct.hpp +5 -39
  46. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +25 -7
  47. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +1 -9
  48. package/nitrogen/generated/android/c++/{JNitroReceiptValidationAppleOptions.hpp → JNitroPurchaseVerificationAppleOptions.hpp} +10 -10
  49. package/nitrogen/generated/android/c++/{JNitroReceiptValidationGoogleOptions.hpp → JNitroPurchaseVerificationGoogleOptions.hpp} +10 -10
  50. package/nitrogen/generated/android/c++/{JNitroReceiptValidationHorizonOptions.hpp → JNitroPurchaseVerificationHorizonOptions.hpp} +10 -10
  51. package/nitrogen/generated/android/c++/JNitroPurchaseVerificationParams.hpp +79 -0
  52. package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultAndroid.hpp → JNitroPurchaseVerificationResultAndroid.hpp} +10 -10
  53. package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultIOS.hpp → JNitroPurchaseVerificationResultIOS.hpp} +10 -12
  54. package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +19 -3
  55. package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +1 -6
  56. package/nitrogen/generated/android/c++/JProductType.hpp +3 -3
  57. package/nitrogen/generated/android/c++/JPurchase.hpp +0 -2
  58. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +1 -7
  59. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +25 -7
  60. package/nitrogen/generated/android/c++/JPurchaseVerificationProvider.hpp +3 -3
  61. package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +19 -3
  62. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +0 -2
  63. package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.cpp +26 -0
  64. package/nitrogen/generated/android/c++/{JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp → JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp} +26 -28
  65. package/nitrogen/generated/android/c++/JVariant_NullType_InitConnectionConfig.hpp +1 -3
  66. package/nitrogen/generated/android/c++/JVariant_NullType_NitroProduct.hpp +0 -22
  67. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchase.hpp +0 -2
  68. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.cpp +26 -0
  69. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.hpp +72 -0
  70. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.cpp +26 -0
  71. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.hpp +74 -0
  72. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.cpp +26 -0
  73. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.hpp +72 -0
  74. package/nitrogen/generated/android/c++/JVariant_NullType_NitroRequestPurchaseAndroid.hpp +0 -1
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +2 -30
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +3 -8
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +2 -7
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +1 -1
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +5 -20
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +32 -7
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +3 -13
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationAppleOptions.kt → NitroPurchaseVerificationAppleOptions.kt} +6 -6
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationGoogleOptions.kt → NitroPurchaseVerificationGoogleOptions.kt} +6 -6
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationHorizonOptions.kt → NitroPurchaseVerificationHorizonOptions.kt} +6 -6
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationParams.kt → NitroPurchaseVerificationParams.kt} +9 -9
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultAndroid.kt → NitroPurchaseVerificationResultAndroid.kt} +6 -6
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultIOS.kt → NitroPurchaseVerificationResultIOS.kt} +6 -6
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +24 -4
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +2 -7
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ProductType.kt +2 -2
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +2 -7
  92. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +30 -5
  93. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseVerificationProvider.kt +2 -2
  94. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +24 -4
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.kt +62 -0
  96. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationGoogleOptions.kt → Variant_NullType_NitroPurchaseVerificationAppleOptions.kt} +9 -9
  97. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_Array_NitroOneTimePurchaseOfferDetail_.kt → Variant_NullType_NitroPurchaseVerificationGoogleOptions.kt} +9 -9
  98. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationAppleOptions.kt → Variant_NullType_NitroPurchaseVerificationHorizonOptions.kt} +9 -9
  99. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -16
  100. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +212 -570
  101. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -42
  102. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +21 -101
  103. package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid_.swift +58 -0
  104. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -9
  105. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +22 -181
  106. package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +2 -13
  107. package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +1 -38
  108. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +4 -4
  109. package/nitrogen/generated/ios/swift/NitroProduct.swift +5 -122
  110. package/nitrogen/generated/ios/swift/NitroPurchase.swift +224 -7
  111. package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +1 -75
  112. package/nitrogen/generated/ios/swift/{NitroReceiptValidationAppleOptions.swift → NitroPurchaseVerificationAppleOptions.swift} +5 -5
  113. package/nitrogen/generated/ios/swift/{NitroReceiptValidationGoogleOptions.swift → NitroPurchaseVerificationGoogleOptions.swift} +5 -5
  114. package/nitrogen/generated/ios/swift/{NitroReceiptValidationHorizonOptions.swift → NitroPurchaseVerificationHorizonOptions.swift} +5 -5
  115. package/nitrogen/generated/ios/swift/{NitroReceiptValidationParams.swift → NitroPurchaseVerificationParams.swift} +36 -36
  116. package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultAndroid.swift → NitroPurchaseVerificationResultAndroid.swift} +5 -5
  117. package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultIOS.swift → NitroPurchaseVerificationResultIOS.swift} +5 -5
  118. package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +149 -1
  119. package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +1 -38
  120. package/nitrogen/generated/ios/swift/ProductType.swift +4 -4
  121. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +2 -7
  122. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +221 -4
  123. package/nitrogen/generated/ios/swift/PurchaseVerificationProvider.swift +4 -4
  124. package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +150 -2
  125. package/nitrogen/generated/ios/swift/{Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.swift → Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.swift} +5 -5
  126. package/nitrogen/generated/ios/swift/{Variant_NullType_NitroLimitedQuantityInfoAndroid.swift → Variant_NullType_NitroPurchaseVerificationAppleOptions.swift} +4 -4
  127. package/nitrogen/generated/ios/swift/{Variant_NullType_NitroReceiptValidationAppleOptions.swift → Variant_NullType_NitroPurchaseVerificationGoogleOptions.swift} +4 -4
  128. package/nitrogen/generated/ios/swift/{Variant_NullType_NitroPreorderDetailsAndroid.swift → Variant_NullType_NitroPurchaseVerificationHorizonOptions.swift} +4 -4
  129. package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -8
  130. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +11 -18
  131. package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +2 -9
  132. package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +1 -5
  133. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +4 -4
  134. package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -22
  135. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +25 -8
  136. package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +2 -10
  137. package/nitrogen/generated/shared/c++/{NitroReceiptValidationAppleOptions.hpp → NitroPurchaseVerificationAppleOptions.hpp} +11 -11
  138. package/nitrogen/generated/shared/c++/{NitroReceiptValidationGoogleOptions.hpp → NitroPurchaseVerificationGoogleOptions.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/{NitroReceiptValidationHorizonOptions.hpp → NitroPurchaseVerificationHorizonOptions.hpp} +11 -11
  140. package/nitrogen/generated/shared/c++/NitroPurchaseVerificationParams.hpp +101 -0
  141. package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultAndroid.hpp → NitroPurchaseVerificationResultAndroid.hpp} +11 -11
  142. package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultIOS.hpp → NitroPurchaseVerificationResultIOS.hpp} +11 -11
  143. package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +18 -2
  144. package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +1 -5
  145. package/nitrogen/generated/shared/c++/ProductType.hpp +5 -5
  146. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +1 -8
  147. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +25 -8
  148. package/nitrogen/generated/shared/c++/PurchaseVerificationProvider.hpp +5 -5
  149. package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +18 -2
  150. package/openiap-versions.json +3 -3
  151. package/package.json +1 -1
  152. package/src/hooks/useIAP.ts +0 -76
  153. package/src/index.kepler.ts +11 -96
  154. package/src/index.ts +60 -457
  155. package/src/specs/RnIap.nitro.ts +35 -196
  156. package/src/types.ts +77 -295
  157. package/src/utils/errorMapping.ts +21 -20
  158. package/src/utils/type-bridge.ts +53 -90
  159. package/src/utils.ts +8 -0
  160. package/src/vega-adapter.ts +11 -59
  161. package/lib/module/utils/deprecation.js +0 -15
  162. package/lib/module/utils/deprecation.js.map +0 -1
  163. package/lib/module/utils/platform-request.js +0 -28
  164. package/lib/module/utils/platform-request.js.map +0 -1
  165. package/lib/typescript/src/utils/deprecation.d.ts +0 -3
  166. package/lib/typescript/src/utils/deprecation.d.ts.map +0 -1
  167. package/lib/typescript/src/utils/platform-request.d.ts +0 -12
  168. package/lib/typescript/src/utils/platform-request.d.ts.map +0 -1
  169. package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +0 -61
  170. package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +0 -61
  171. package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +0 -69
  172. package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +0 -61
  173. package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +0 -148
  174. package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +0 -61
  175. package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +0 -79
  176. package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +0 -66
  177. package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +0 -61
  178. package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp +0 -26
  179. package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.cpp +0 -35
  180. package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.hpp +0 -103
  181. package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.cpp +0 -26
  182. package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.hpp +0 -72
  183. package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.cpp +0 -26
  184. package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.hpp +0 -77
  185. package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.cpp +0 -26
  186. package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.hpp +0 -71
  187. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.cpp +0 -26
  188. package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.hpp +0 -72
  189. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.cpp +0 -26
  190. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.hpp +0 -72
  191. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.cpp +0 -26
  192. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.hpp +0 -74
  193. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.cpp +0 -26
  194. package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.hpp +0 -72
  195. package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.cpp +0 -26
  196. package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.hpp +0 -74
  197. package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.cpp +0 -26
  198. package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.hpp +0 -72
  199. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +0 -24
  200. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +0 -56
  201. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +0 -56
  202. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +0 -56
  203. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +0 -111
  204. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +0 -56
  205. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +0 -56
  206. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +0 -56
  207. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +0 -62
  208. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountAmountAndroid.kt +0 -62
  209. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountDisplayInfoAndroid.kt +0 -62
  210. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroLimitedQuantityInfoAndroid.kt +0 -62
  211. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroPreorderDetailsAndroid.kt +0 -62
  212. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroReceiptValidationHorizonOptions.kt +0 -62
  213. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroRentalDetailsAndroid.kt +0 -62
  214. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroValidTimeWindowAndroid.kt +0 -62
  215. package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +0 -44
  216. package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid_.swift +0 -58
  217. package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +0 -34
  218. package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +0 -98
  219. package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +0 -34
  220. package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +0 -351
  221. package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +0 -34
  222. package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +0 -66
  223. package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +0 -34
  224. package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountAmountAndroid.swift +0 -30
  225. package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountDisplayInfoAndroid.swift +0 -30
  226. package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationGoogleOptions.swift +0 -30
  227. package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationHorizonOptions.swift +0 -30
  228. package/nitrogen/generated/ios/swift/Variant_NullType_NitroRentalDetailsAndroid.swift +0 -30
  229. package/nitrogen/generated/ios/swift/Variant_NullType_NitroValidTimeWindowAndroid.swift +0 -30
  230. package/nitrogen/generated/ios/swift/Variant_NullType__NitroOneTimePurchaseOfferDetail_.swift +0 -30
  231. package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +0 -80
  232. package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +0 -87
  233. package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +0 -91
  234. package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +0 -87
  235. package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +0 -149
  236. package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +0 -87
  237. package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +0 -101
  238. package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +0 -90
  239. package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +0 -87
  240. package/src/utils/deprecation.ts +0 -16
  241. package/src/utils/platform-request.ts +0 -37
package/src/index.ts CHANGED
@@ -7,9 +7,9 @@ import {NitroModules} from 'react-native-nitro-modules';
7
7
  // Internal modules
8
8
  import type {
9
9
  NitroActiveSubscription,
10
- NitroReceiptValidationParams,
11
- NitroReceiptValidationResultIOS,
12
- NitroReceiptValidationResultAndroid,
10
+ NitroPurchaseVerificationParams,
11
+ NitroPurchaseVerificationResultIOS,
12
+ NitroPurchaseVerificationResultAndroid,
13
13
  NitroPurchaseUpdatedListenerOptions,
14
14
  NitroSubscriptionStatus,
15
15
  RnIap,
@@ -57,8 +57,6 @@ import {
57
57
  DUPLICATE_PURCHASE_CODE,
58
58
  } from './utils/errorMapping';
59
59
  import {RnIapConsole} from './utils/debug';
60
- import {warnLegacyOnce} from './utils/deprecation';
61
- import {selectCanonicalPlatformRequest} from './utils/platform-request';
62
60
  import {getSuccessFromPurchaseVariant} from './utils/purchase';
63
61
  import {parseAppTransactionPayload} from './utils';
64
62
  import {getVegaIapModule, isVegaOS} from './vega';
@@ -93,16 +91,8 @@ export * from './types';
93
91
  export * from './utils/error';
94
92
  export * from './vega';
95
93
 
96
- /**
97
- * Product type accepted by public query and purchase helpers.
98
- *
99
- * Compatibility note: the `'inapp'` member is deprecated. Use `'in-app'`
100
- * instead; the alias will be removed in react-native-iap 16.0.0.
101
- */
102
- export type ProductTypeInput = 'inapp' | 'in-app' | 'subs';
103
-
104
- const LEGACY_INAPP_WARNING =
105
- "[react-native-iap] `type: 'inapp'` is deprecated and will be removed in react-native-iap 16.0.0. Use 'in-app' instead.";
94
+ /** Product type accepted by public query and purchase helpers. */
95
+ export type ProductTypeInput = 'in-app' | 'subs';
106
96
 
107
97
  type NitroPurchaseRequest = Parameters<RnIap['requestPurchase']>[0];
108
98
  type NitroAvailablePurchasesOptions = NonNullable<
@@ -887,8 +877,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
887
877
  })),
888
878
  );
889
879
 
890
- // For 'all' type, need to properly distinguish between products and subscriptions
891
- // On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription
880
+ // The major schema uses the canonical `type` discriminator on every store.
892
881
  const productItems: Product[] = [];
893
882
  const subscriptionItems: ProductSubscription[] = [];
894
883
 
@@ -899,39 +888,7 @@ export const fetchProducts: QueryField<'fetchProducts'> = async (request) => {
899
888
  return;
900
889
  }
901
890
 
902
- // item.type === 'subs' case
903
- // For Android, check if subscription items have actual offers
904
- if (
905
- isAndroidStoreRuntime() &&
906
- item.platform === 'android' &&
907
- item.type === 'subs'
908
- ) {
909
- // TypeScript now knows this is ProductSubscriptionAndroid
910
- const hasSubscriptionOffers =
911
- item.subscriptionOfferDetailsAndroid &&
912
- Array.isArray(item.subscriptionOfferDetailsAndroid) &&
913
- item.subscriptionOfferDetailsAndroid.length > 0;
914
-
915
- RnIapConsole.debug(
916
- `[fetchProducts] ${item.id}: type=${item.type}, hasOffers=${hasSubscriptionOffers}`,
917
- );
918
-
919
- if (hasSubscriptionOffers) {
920
- subscriptionItems.push(item);
921
- } else {
922
- // Treat as product if no offers - convert type
923
- const {subscriptionOfferDetailsAndroid: _, ...productFields} =
924
- item as any;
925
- productItems.push({
926
- ...productFields,
927
- type: 'in-app' as const,
928
- } as Product);
929
- }
930
- } else if (item.platform === 'ios' && item.type === 'subs') {
931
- // iOS: type field is reliable with discriminated unions
932
- // TypeScript now knows this is ProductSubscriptionIOS
933
- subscriptionItems.push(item);
934
- }
891
+ subscriptionItems.push(item);
935
892
  });
936
893
 
937
894
  RnIapConsole.debug(
@@ -1044,7 +1001,7 @@ export const getAvailablePurchases: QueryField<
1044
1001
 
1045
1002
  // For Android Play/Horizon/Fire OS, query in-app items and subscriptions separately.
1046
1003
  const inappNitroPurchases = await IAP.instance.getAvailablePurchases({
1047
- android: {type: 'inapp', includeSuspended},
1004
+ android: {type: 'in-app', includeSuspended},
1048
1005
  });
1049
1006
  const subsNitroPurchases = await IAP.instance.getAvailablePurchases({
1050
1007
  android: {type: 'subs', includeSuspended},
@@ -1084,10 +1041,7 @@ export const getPromotedProductIOS: QueryField<
1084
1041
  }
1085
1042
 
1086
1043
  try {
1087
- const nitroProduct =
1088
- typeof IAP.instance.getPromotedProductIOS === 'function'
1089
- ? await IAP.instance.getPromotedProductIOS()
1090
- : await IAP.instance.requestPromotedProductIOS();
1044
+ const nitroProduct = await IAP.instance.getPromotedProductIOS();
1091
1045
  if (!nitroProduct) {
1092
1046
  return null;
1093
1047
  }
@@ -1107,47 +1061,6 @@ export const getPromotedProductIOS: QueryField<
1107
1061
  }
1108
1062
  };
1109
1063
 
1110
- /**
1111
- * @deprecated Use `getPromotedProductIOS` instead. This compatibility alias
1112
- * will be removed in react-native-iap 16.0.0.
1113
- */
1114
- export const requestPromotedProductIOS = getPromotedProductIOS;
1115
-
1116
- /**
1117
- * Get the storefront identifier for the user's App Store account (iOS only)
1118
- * @returns Promise<string> - The storefront identifier (e.g., 'USA' for United States)
1119
- * @platform iOS
1120
- *
1121
- * @example
1122
- * ```typescript
1123
- * const storefront = await getStorefrontIOS();
1124
- * console.log('User storefront:', storefront); // e.g., 'USA', 'GBR', 'KOR'
1125
- * ```
1126
- *
1127
- * @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}
1128
- * @deprecated Use `getStorefront` instead. Scheduled for removal in
1129
- * react-native-iap 16.0.0.
1130
- */
1131
- export const getStorefrontIOS: QueryField<'getStorefrontIOS'> = async () => {
1132
- if (Platform.OS !== 'ios') {
1133
- throw new Error('getStorefrontIOS is only available on iOS');
1134
- }
1135
-
1136
- try {
1137
- const storefront = await IAP.instance.getStorefrontIOS();
1138
- if (typeof storefront !== 'string' || storefront.trim().length === 0) {
1139
- throw createPurchaseError({
1140
- code: ErrorCode.ServiceError,
1141
- message: 'Storefront lookup returned no country code.',
1142
- });
1143
- }
1144
- return storefront;
1145
- } catch (error) {
1146
- RnIapConsole.error('Failed to get storefront:', error);
1147
- throw error;
1148
- }
1149
- };
1150
-
1151
1064
  /**
1152
1065
  * Return the user's storefront country code.
1153
1066
  *
@@ -1161,21 +1074,9 @@ export const getStorefront: QueryField<'getStorefront'> = async () => {
1161
1074
  });
1162
1075
  }
1163
1076
 
1164
- const hasUnifiedMethod = typeof IAP.instance.getStorefront === 'function';
1165
-
1166
- if (!hasUnifiedMethod && Platform.OS !== 'ios') {
1167
- throw createPurchaseError({
1168
- code: ErrorCode.FeatureNotSupported,
1169
- message: 'Native getStorefront is not available on this build.',
1170
- platform: 'android',
1171
- });
1172
- }
1173
-
1174
1077
  let storefront: string | null | undefined;
1175
1078
  try {
1176
- storefront = hasUnifiedMethod
1177
- ? await IAP.instance.getStorefront()
1178
- : await getStorefrontIOS();
1079
+ storefront = await IAP.instance.getStorefront();
1179
1080
  } catch (error) {
1180
1081
  const parsedError = parseErrorAndLogIfNeeded(
1181
1082
  `[getStorefront] Failed to get storefront on ${Platform.OS}:`,
@@ -1309,7 +1210,7 @@ export const currentEntitlementIOS: QueryField<
1309
1210
  const nitroPurchase = await IAP.instance.currentEntitlementIOS(sku);
1310
1211
  if (nitroPurchase) {
1311
1212
  const converted = convertNitroPurchaseToPurchase(nitroPurchase);
1312
- return converted.platform === 'ios' ? (converted as PurchaseIOS) : null;
1213
+ return converted.store === 'apple' ? (converted as PurchaseIOS) : null;
1313
1214
  }
1314
1215
  return null;
1315
1216
  } catch (error) {
@@ -1345,7 +1246,7 @@ export const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (
1345
1246
  const nitroPurchase = await IAP.instance.latestTransactionIOS(sku);
1346
1247
  if (nitroPurchase) {
1347
1248
  const converted = convertNitroPurchaseToPurchase(nitroPurchase);
1348
- return converted.platform === 'ios' ? (converted as PurchaseIOS) : null;
1249
+ return converted.store === 'apple' ? (converted as PurchaseIOS) : null;
1349
1250
  }
1350
1251
  return null;
1351
1252
  } catch (error) {
@@ -1381,7 +1282,7 @@ export const getPendingTransactionsIOS: QueryField<
1381
1282
  return nitroPurchases
1382
1283
  .map(convertNitroPurchaseToPurchase)
1383
1284
  .filter(
1384
- (purchase): purchase is PurchaseIOS => purchase.platform === 'ios',
1285
+ (purchase): purchase is PurchaseIOS => purchase.store === 'apple',
1385
1286
  );
1386
1287
  } catch (error) {
1387
1288
  const parsedError = parseErrorAndLogIfNeeded(
@@ -1414,7 +1315,7 @@ export const getAllTransactionsIOS: QueryField<
1414
1315
  return nitroPurchases
1415
1316
  .map(convertNitroPurchaseToPurchase)
1416
1317
  .filter(
1417
- (purchase): purchase is PurchaseIOS => purchase.platform === 'ios',
1318
+ (purchase): purchase is PurchaseIOS => purchase.store === 'apple',
1418
1319
  );
1419
1320
  } catch (error) {
1420
1321
  const parsedError = parseErrorAndLogIfNeeded(
@@ -1449,7 +1350,7 @@ export const showManageSubscriptionsIOS: MutationField<
1449
1350
  return nitroPurchases
1450
1351
  .map(convertNitroPurchaseToPurchase)
1451
1352
  .filter(
1452
- (purchase): purchase is PurchaseIOS => purchase.platform === 'ios',
1353
+ (purchase): purchase is PurchaseIOS => purchase.store === 'apple',
1453
1354
  );
1454
1355
  } catch (error) {
1455
1356
  const parsedError = parseErrorAndLogIfNeeded(
@@ -1530,44 +1431,6 @@ export const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {
1530
1431
  }
1531
1432
  };
1532
1433
 
1533
- /**
1534
- * Legacy alias for `getReceiptDataIOS`.
1535
- *
1536
- * @deprecated Use `getReceiptDataIOS` for the cumulative App Store receipt or
1537
- * `getTransactionJwsIOS(productId)` for one transaction. This alias will be
1538
- * removed in react-native-iap 16.0.0.
1539
- */
1540
- export const getReceiptIOS = async (): Promise<string> => {
1541
- if (Platform.OS !== 'ios') {
1542
- throw new Error('getReceiptIOS is only available on iOS');
1543
- }
1544
-
1545
- RnIapConsole.warn(
1546
- '[getReceiptIOS] is deprecated and will be removed in react-native-iap 16.0.0. ' +
1547
- 'Use getReceiptDataIOS() for the cumulative receipt. iOS receipts contain ALL transactions, not just the latest one. ' +
1548
- 'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' +
1549
- 'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation',
1550
- );
1551
-
1552
- try {
1553
- if (typeof IAP.instance.getReceiptIOS === 'function') {
1554
- return await IAP.instance.getReceiptIOS();
1555
- }
1556
- return await IAP.instance.getReceiptDataIOS();
1557
- } catch (error) {
1558
- const parsedError = parseErrorAndLogIfNeeded(
1559
- '[getReceiptIOS] Failed:',
1560
- error,
1561
- );
1562
- throw createPurchaseError({
1563
- code: parsedError.code,
1564
- message: parsedError.message,
1565
- responseCode: parsedError.responseCode,
1566
- debugMessage: parsedError.debugMessage,
1567
- });
1568
- }
1569
- };
1570
-
1571
1434
  export const requestReceiptRefreshIOS = async (): Promise<string> => {
1572
1435
  if (Platform.OS !== 'ios') {
1573
1436
  throw new Error('requestReceiptRefreshIOS is only available on iOS');
@@ -1809,11 +1672,9 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
1809
1672
  }
1810
1673
 
1811
1674
  const iosRequestSource =
1812
- Platform.OS === 'ios'
1813
- ? selectApplePurchaseRequest(perPlatformRequest)
1814
- : undefined;
1675
+ Platform.OS === 'ios' ? perPlatformRequest.apple : undefined;
1815
1676
  const androidRequestSource = isAndroidStoreRuntime()
1816
- ? selectGooglePurchaseRequest(perPlatformRequest)
1677
+ ? perPlatformRequest.google
1817
1678
  : undefined;
1818
1679
 
1819
1680
  if (Platform.OS === 'ios') {
@@ -1922,9 +1783,6 @@ export const requestPurchase: MutationField<'requestPurchase'> = async (
1922
1783
  androidPayload.originalExternalTransactionId =
1923
1784
  subsRequest.originalExternalTransactionId;
1924
1785
  }
1925
- if (subsRequest.replacementMode != null) {
1926
- androidPayload.replacementMode = subsRequest.replacementMode;
1927
- }
1928
1786
  if (subsRequest.subscriptionProductReplacementParams) {
1929
1787
  androidPayload.subscriptionProductReplacementParams =
1930
1788
  subsRequest.subscriptionProductReplacementParams;
@@ -2159,8 +2017,7 @@ export const openRedeemOfferCodeAndroid: MutationField<
2159
2017
  // ============================================================================
2160
2018
 
2161
2019
  /**
2162
- * Validate receipt on both iOS and Android platforms
2163
- * @deprecated Use `verifyPurchase` instead. This function will be removed in react-native-iap 16.0.0.
2020
+ * Verify a purchase on iOS or Android.
2164
2021
  * @param options - Platform-specific verification options
2165
2022
  * @param options.apple - Apple App Store verification options (iOS)
2166
2023
  * @param options.google - Google Play verification options (Android)
@@ -2184,7 +2041,7 @@ export const openRedeemOfferCodeAndroid: MutationField<
2184
2041
  *
2185
2042
  * @see {@link https://openiap.dev/docs/apis/validate-receipt}
2186
2043
  */
2187
- export const validateReceipt: MutationField<'validateReceipt'> = async (
2044
+ export const verifyPurchase: MutationField<'verifyPurchase'> = async (
2188
2045
  options,
2189
2046
  ) => {
2190
2047
  const {apple, google, horizon} = options;
@@ -2223,7 +2080,7 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
2223
2080
  }
2224
2081
  }
2225
2082
 
2226
- const params: NitroReceiptValidationParams = {
2083
+ const params: NitroPurchaseVerificationParams = {
2227
2084
  apple: apple?.sku
2228
2085
  ? {
2229
2086
  sku: apple.sku,
@@ -2252,11 +2109,11 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
2252
2109
  : null,
2253
2110
  };
2254
2111
 
2255
- const nitroResult = await IAP.instance.validateReceipt(params);
2112
+ const nitroResult = await IAP.instance.verifyPurchase(params);
2256
2113
 
2257
2114
  // Convert Nitro result to public API result
2258
2115
  if (Platform.OS === 'ios') {
2259
- const iosResult = nitroResult as NitroReceiptValidationResultIOS;
2116
+ const iosResult = nitroResult as NitroPurchaseVerificationResultIOS;
2260
2117
  const result: VerifyPurchaseResultIOS = {
2261
2118
  isValid: iosResult.isValid,
2262
2119
  receiptData: iosResult.receiptData,
@@ -2268,7 +2125,8 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
2268
2125
  return result;
2269
2126
  } else {
2270
2127
  // Android
2271
- const androidResult = nitroResult as NitroReceiptValidationResultAndroid;
2128
+ const androidResult =
2129
+ nitroResult as NitroPurchaseVerificationResultAndroid;
2272
2130
  const result: VerifyPurchaseResultAndroid = {
2273
2131
  autoRenewing: androidResult.autoRenewing,
2274
2132
  betaProduct: androidResult.betaProduct,
@@ -2293,7 +2151,7 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
2293
2151
  }
2294
2152
  } catch (error) {
2295
2153
  const parsedError = parseErrorAndLogIfNeeded(
2296
- '[validateReceipt] Failed:',
2154
+ '[verifyPurchase] Failed:',
2297
2155
  error,
2298
2156
  );
2299
2157
  throw createPurchaseError({
@@ -2305,38 +2163,6 @@ export const validateReceipt: MutationField<'validateReceipt'> = async (
2305
2163
  }
2306
2164
  };
2307
2165
 
2308
- /**
2309
- * Verify purchase with the configured providers
2310
- *
2311
- * This function uses the native OpenIAP verifyPurchase implementation
2312
- * which validates purchases using platform-specific methods.
2313
- * This is an alias for validateReceipt for API consistency with OpenIAP.
2314
- *
2315
- * @param options - Receipt validation options containing the SKU
2316
- * @returns Promise resolving to receipt validation result
2317
- *
2318
- * @see {@link https://openiap.dev/docs/features/validation#verify-purchase}
2319
- */
2320
- export const verifyPurchase: MutationField<'verifyPurchase'> = validateReceipt;
2321
-
2322
- /**
2323
- * iOS-only receipt validation alias.
2324
- *
2325
- * @deprecated Use `verifyPurchase` instead. This compatibility alias will be
2326
- * removed in react-native-iap 16.0.0. Throws on non-iOS platforms.
2327
- *
2328
- * @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}
2329
- */
2330
- export const validateReceiptIOS: QueryField<'validateReceiptIOS'> = async (
2331
- options,
2332
- ) => {
2333
- if (Platform.OS !== 'ios') {
2334
- throw new Error('validateReceiptIOS is only available on iOS');
2335
- }
2336
- const result = await validateReceipt(options);
2337
- return result as VerifyPurchaseResultIOS;
2338
- };
2339
-
2340
2166
  /**
2341
2167
  * Verify purchase with a specific provider (e.g., IAPKit)
2342
2168
  *
@@ -2440,7 +2266,8 @@ export const syncIOS: MutationField<'syncIOS'> = async () => {
2440
2266
 
2441
2267
  /**
2442
2268
  * Present the code redemption sheet for offer codes (iOS only)
2443
- * @returns Promise<boolean> - Indicates whether the redemption sheet was presented
2269
+ * @returns The verified redeemed purchase on iOS 27+, or null after the
2270
+ * legacy sheet is presented on earlier iOS versions.
2444
2271
  * @platform iOS
2445
2272
  *
2446
2273
  * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
@@ -2449,12 +2276,18 @@ export const presentCodeRedemptionSheetIOS: MutationField<
2449
2276
  'presentCodeRedemptionSheetIOS'
2450
2277
  > = async () => {
2451
2278
  if (Platform.OS !== 'ios') {
2452
- return false;
2279
+ return null;
2453
2280
  }
2454
2281
 
2455
2282
  try {
2456
2283
  const result = await IAP.instance.presentCodeRedemptionSheetIOS();
2457
- return Boolean(result);
2284
+ if (result == null) {
2285
+ return null;
2286
+ }
2287
+ if (!validateNitroPurchase(result)) {
2288
+ throw new Error('Invalid redeemed purchase returned by native StoreKit');
2289
+ }
2290
+ return convertNitroPurchaseToPurchase(result) as PurchaseIOS;
2458
2291
  } catch (error) {
2459
2292
  const parsedError = parseErrorAndLogIfNeeded(
2460
2293
  '[presentCodeRedemptionSheetIOS] Failed:',
@@ -2469,55 +2302,6 @@ export const presentCodeRedemptionSheetIOS: MutationField<
2469
2302
  }
2470
2303
  };
2471
2304
 
2472
- /**
2473
- * Buy promoted product on iOS
2474
- * @deprecated In StoreKit 2, promoted products can be purchased directly via
2475
- * the standard `requestPurchase()` flow. This alias will be removed in
2476
- * react-native-iap 16.0.0.
2477
- * Use `promotedProductListenerIOS` to receive the product ID when a user taps a promoted product,
2478
- * then call `requestPurchase()` with the received SKU directly.
2479
- *
2480
- * @example
2481
- * ```typescript
2482
- * // Recommended approach
2483
- * promotedProductListenerIOS(async (product) => {
2484
- * await requestPurchase({
2485
- * request: { apple: { sku: product.id } },
2486
- * type: 'in-app'
2487
- * });
2488
- * });
2489
- * ```
2490
- *
2491
- * @returns Promise<boolean> - true when the request triggers successfully
2492
- * @platform iOS
2493
- *
2494
- * @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}
2495
- */
2496
- export const requestPurchaseOnPromotedProductIOS: MutationField<
2497
- 'requestPurchaseOnPromotedProductIOS'
2498
- > = async () => {
2499
- if (Platform.OS !== 'ios') {
2500
- throw new Error(
2501
- 'requestPurchaseOnPromotedProductIOS is only available on iOS',
2502
- );
2503
- }
2504
-
2505
- try {
2506
- return await IAP.instance.buyPromotedProductIOS();
2507
- } catch (error) {
2508
- const parsedError = parseErrorAndLogIfNeeded(
2509
- '[requestPurchaseOnPromotedProductIOS] Failed:',
2510
- error,
2511
- );
2512
- throw createPurchaseError({
2513
- code: parsedError.code,
2514
- message: parsedError.message,
2515
- responseCode: parsedError.responseCode,
2516
- debugMessage: parsedError.debugMessage,
2517
- });
2518
- }
2519
- };
2520
-
2521
2305
  /**
2522
2306
  * Clear unfinished transactions on iOS
2523
2307
  * @returns Promise<boolean>
@@ -2673,7 +2457,6 @@ export const getActiveSubscriptions: QueryField<
2673
2457
  // iOS specific fields
2674
2458
  expirationDateIOS: sub.expirationDateIOS ?? null,
2675
2459
  environmentIOS: sub.environmentIOS ?? null,
2676
- willExpireSoon: sub.willExpireSoon ?? null,
2677
2460
  daysUntilExpirationIOS: sub.daysUntilExpirationIOS ?? null,
2678
2461
  // renewalInfoIOS contains subscription lifecycle information on iOS.
2679
2462
  renewalInfoIOS: sub.renewalInfoIOS
@@ -2681,6 +2464,12 @@ export const getActiveSubscriptions: QueryField<
2681
2464
  willAutoRenew: sub.renewalInfoIOS.willAutoRenew ?? false,
2682
2465
  autoRenewPreference:
2683
2466
  sub.renewalInfoIOS.autoRenewPreference ?? null,
2467
+ bundleOriginalTransactionId:
2468
+ sub.renewalInfoIOS.bundleOriginalTransactionId ?? null,
2469
+ bundleProductId:
2470
+ sub.renewalInfoIOS.bundleProductId ?? null,
2471
+ bundleSubscriptionGroupId:
2472
+ sub.renewalInfoIOS.bundleSubscriptionGroupId ?? null,
2684
2473
  commitmentInfo: sub.renewalInfoIOS.commitmentInfo ?? null,
2685
2474
  pendingUpgradeProductId:
2686
2475
  sub.renewalInfoIOS.pendingUpgradeProductId ?? null,
@@ -2696,6 +2485,7 @@ export const getActiveSubscriptions: QueryField<
2696
2485
  renewalOfferType: sub.renewalInfoIOS.renewalOfferType ?? null,
2697
2486
  renewalOfferId: sub.renewalInfoIOS.renewalOfferId ?? null,
2698
2487
  jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null,
2488
+ willUnbundle: sub.renewalInfoIOS.willUnbundle ?? null,
2699
2489
  }
2700
2490
  : null,
2701
2491
  // Android specific fields
@@ -2757,19 +2547,6 @@ export {
2757
2547
  checkTypeSynchronization,
2758
2548
  } from './utils/type-bridge';
2759
2549
 
2760
- // Deprecated exports for backward compatibility
2761
- /**
2762
- * @deprecated Use acknowledgePurchaseAndroid instead. This alias will be
2763
- * removed in react-native-iap 16.0.0.
2764
- */
2765
- export const acknowledgePurchase = acknowledgePurchaseAndroid;
2766
-
2767
- /**
2768
- * @deprecated Use consumePurchaseAndroid instead. This alias will be removed
2769
- * in react-native-iap 16.0.0.
2770
- */
2771
- export const consumePurchase = consumePurchaseAndroid;
2772
-
2773
2550
  // ============================================================================
2774
2551
  // Internal Helpers
2775
2552
  // ============================================================================
@@ -2778,42 +2555,6 @@ type NitroDiscountOfferRecord = NonNullable<
2778
2555
  NonNullable<NitroPurchaseRequest['apple']>['withOffer']
2779
2556
  >;
2780
2557
 
2781
- const selectApplePurchaseRequest = (
2782
- request:
2783
- RequestPurchasePropsByPlatforms | RequestSubscriptionPropsByPlatforms,
2784
- ): RequestPurchaseIosProps | RequestSubscriptionIosProps | null | undefined => {
2785
- const selection = selectCanonicalPlatformRequest<
2786
- RequestPurchaseIosProps | RequestSubscriptionIosProps
2787
- >(request, 'apple', 'ios');
2788
- if (selection.usesLegacyKey && selection.value != null) {
2789
- warnLegacyOnce(
2790
- 'request-purchase.ios',
2791
- '[react-native-iap] `request.ios` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.apple` instead.',
2792
- );
2793
- }
2794
- return selection.value;
2795
- };
2796
-
2797
- const selectGooglePurchaseRequest = (
2798
- request:
2799
- RequestPurchasePropsByPlatforms | RequestSubscriptionPropsByPlatforms,
2800
- ):
2801
- | RequestPurchaseAndroidProps
2802
- | RequestSubscriptionAndroidProps
2803
- | null
2804
- | undefined => {
2805
- const selection = selectCanonicalPlatformRequest<
2806
- RequestPurchaseAndroidProps | RequestSubscriptionAndroidProps
2807
- >(request, 'google', 'android');
2808
- if (selection.usesLegacyKey && selection.value != null) {
2809
- warnLegacyOnce(
2810
- 'request-purchase.android',
2811
- '[react-native-iap] `request.android` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.google` instead.',
2812
- );
2813
- }
2814
- return selection.value;
2815
- };
2816
-
2817
2558
  const toDiscountOfferRecordIOS = (
2818
2559
  offer: DiscountOfferInputIOS | null | undefined,
2819
2560
  ): NitroDiscountOfferRecord | undefined => {
@@ -2832,17 +2573,18 @@ const toDiscountOfferRecordIOS = (
2832
2573
  const toNitroProductType = (
2833
2574
  type?: ProductTypeInput | ProductQueryType | null,
2834
2575
  ): 'in-app' | 'subs' | 'all' => {
2835
- if (type === 'subs') {
2836
- return 'subs';
2837
- }
2838
- if (type === 'all') {
2839
- return 'all';
2840
- }
2841
- if (type === 'inapp') {
2842
- warnLegacyOnce('product-type.inapp', LEGACY_INAPP_WARNING);
2843
- return 'in-app';
2576
+ switch (type) {
2577
+ case 'in-app':
2578
+ return 'in-app';
2579
+ case 'subs':
2580
+ return 'subs';
2581
+ case 'all':
2582
+ return 'all';
2583
+ default:
2584
+ throw new Error(
2585
+ `Unsupported product type: ${String(type)}. Use in-app, subs, or all.`,
2586
+ );
2844
2587
  }
2845
- return 'in-app';
2846
2588
  };
2847
2589
 
2848
2590
  const isSubscriptionQuery = (type?: ProductQueryType | null): boolean =>
@@ -2851,156 +2593,17 @@ const isSubscriptionQuery = (type?: ProductQueryType | null): boolean =>
2851
2593
  const normalizeProductQueryType = (
2852
2594
  type?: ProductQueryType | string | null,
2853
2595
  ): ProductQueryType => {
2854
- if (type === 'all' || type === 'subs' || type === 'in-app') {
2855
- return type;
2856
- }
2857
-
2858
- if (typeof type === 'string') {
2859
- const normalized = type.trim().toLowerCase().replace(/_/g, '-');
2860
-
2861
- if (normalized === 'all') {
2862
- return 'all';
2863
- }
2864
- if (normalized === 'subs') {
2865
- return 'subs';
2866
- }
2867
- if (normalized === 'inapp') {
2868
- warnLegacyOnce('product-type.inapp', LEGACY_INAPP_WARNING);
2869
- return 'in-app';
2870
- }
2871
- if (normalized === 'in-app') {
2872
- return 'in-app';
2873
- }
2874
- }
2875
- return 'in-app';
2876
- };
2877
-
2878
- // ============================================================================
2879
- // ALTERNATIVE BILLING APIs
2880
- // ============================================================================
2881
-
2882
- // ------------------------------
2883
- // Android Alternative Billing
2884
- // ------------------------------
2885
-
2886
- /**
2887
- * Check if alternative billing is available for this user/device (Android only).
2888
- * Step 1 of alternative billing flow.
2889
- *
2890
- * @returns Promise<boolean> - true if available, false otherwise
2891
- * @throws Error if billing client not ready
2892
- * @platform Android
2893
- *
2894
- * @example
2895
- * ```typescript
2896
- * const isAvailable = await checkAlternativeBillingAvailabilityAndroid();
2897
- * if (isAvailable) {
2898
- * // Proceed with alternative billing flow
2899
- * }
2900
- * ```
2901
- *
2902
- * @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}
2903
- * @deprecated Use `isBillingProgramAvailableAndroid('external-offer')`
2904
- * instead. Scheduled for removal in react-native-iap 16.0.0.
2905
- */
2906
- export const checkAlternativeBillingAvailabilityAndroid: MutationField<
2907
- 'checkAlternativeBillingAvailabilityAndroid'
2908
- > = async () => {
2909
- if (Platform.OS !== 'android') {
2910
- throw new Error('Alternative billing is only supported on Android');
2911
- }
2912
- try {
2913
- return await IAP.instance.checkAlternativeBillingAvailabilityAndroid();
2914
- } catch (error) {
2915
- RnIapConsole.error(
2916
- 'Failed to check alternative billing availability:',
2917
- error,
2918
- );
2919
- throw error;
2596
+ if (type == null) {
2597
+ return 'in-app';
2920
2598
  }
2921
- };
2922
2599
 
2923
- /**
2924
- * Show alternative billing information dialog to user (Android only).
2925
- * Step 2 of alternative billing flow.
2926
- * Must be called BEFORE processing payment in your payment system.
2927
- *
2928
- * @returns Promise<boolean> - true if user accepted, false if user canceled
2929
- * @throws Error if billing client not ready
2930
- * @platform Android
2931
- *
2932
- * @example
2933
- * ```typescript
2934
- * const userAccepted = await showAlternativeBillingDialogAndroid();
2935
- * if (userAccepted) {
2936
- * // Process payment in your payment system
2937
- * const success = await processCustomPayment();
2938
- * if (success) {
2939
- * // Create reporting token
2940
- * const token = await createAlternativeBillingTokenAndroid();
2941
- * // Send token to your backend for Google Play reporting
2942
- * }
2943
- * }
2944
- * ```
2945
- *
2946
- * @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}
2947
- * @deprecated Use `launchExternalLinkAndroid` instead. Scheduled for removal in
2948
- * react-native-iap 16.0.0.
2949
- */
2950
- export const showAlternativeBillingDialogAndroid: MutationField<
2951
- 'showAlternativeBillingDialogAndroid'
2952
- > = async () => {
2953
- if (Platform.OS !== 'android') {
2954
- throw new Error('Alternative billing is only supported on Android');
2955
- }
2956
- try {
2957
- return await IAP.instance.showAlternativeBillingDialogAndroid();
2958
- } catch (error) {
2959
- RnIapConsole.error('Failed to show alternative billing dialog:', error);
2960
- throw error;
2600
+ if (type === 'all' || type === 'subs' || type === 'in-app') {
2601
+ return type;
2961
2602
  }
2962
- };
2963
2603
 
2964
- /**
2965
- * Create external transaction token for Google Play reporting (Android only).
2966
- * Step 3 of alternative billing flow.
2967
- * Must be called AFTER successful payment in your payment system.
2968
- * Token must be reported to Google Play backend within 24 hours.
2969
- *
2970
- * @param sku - Optional product SKU that was purchased
2971
- * @returns Promise<string | null> - Token string or null if creation failed
2972
- * @throws Error if billing client not ready
2973
- * @platform Android
2974
- *
2975
- * @example
2976
- * ```typescript
2977
- * const token = await createAlternativeBillingTokenAndroid('premium_subscription');
2978
- * if (token) {
2979
- * // Send token to your backend
2980
- * await fetch('/api/report-transaction', {
2981
- * method: 'POST',
2982
- * body: JSON.stringify({ token, sku: 'premium_subscription' })
2983
- * });
2984
- * }
2985
- * ```
2986
- *
2987
- * @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}
2988
- * @deprecated Use
2989
- * `createBillingProgramReportingDetailsAndroid('external-offer')` instead.
2990
- * Scheduled for removal in react-native-iap 16.0.0.
2991
- */
2992
- export const createAlternativeBillingTokenAndroid: MutationField<
2993
- 'createAlternativeBillingTokenAndroid'
2994
- > = async (sku?: string) => {
2995
- if (Platform.OS !== 'android') {
2996
- throw new Error('Alternative billing is only supported on Android');
2997
- }
2998
- try {
2999
- return await IAP.instance.createAlternativeBillingTokenAndroid(sku ?? null);
3000
- } catch (error) {
3001
- RnIapConsole.error('Failed to create alternative billing token:', error);
3002
- throw error;
3003
- }
2604
+ throw new Error(
2605
+ `Unsupported product type: ${String(type)}. Use in-app, subs, or all.`,
2606
+ );
3004
2607
  };
3005
2608
 
3006
2609
  /**