react-native-iap 15.6.2 → 16.0.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.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +34 -182
- package/android/src/main/java/com/margelo/nitro/iap/ProductSerialization.kt +0 -69
- package/android/src/main/java/com/margelo/nitro/iap/RnIapLog.kt +0 -13
- package/ios/HybridRnIap.swift +30 -95
- package/ios/RnIapHelper.swift +37 -48
- package/ios/RnIapLog.swift +0 -11
- package/lib/module/hooks/useIAP.js +6 -11
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +64 -380
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js +7 -82
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/types.js +5 -57
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/errorMapping.js +13 -21
- package/lib/module/utils/errorMapping.js.map +1 -1
- package/lib/module/utils/type-bridge.js +39 -77
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/module/utils.js +5 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/vega-adapter.js +10 -48
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +1 -49
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -175
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +2 -54
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +32 -173
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +76 -284
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/errorMapping.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +5 -12
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +0 -22
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +38 -189
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +2 -9
- package/nitrogen/generated/android/c++/JInitConnectionConfig.hpp +1 -7
- package/nitrogen/generated/android/c++/JNitroActiveSubscription.hpp +1 -5
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +3 -3
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +5 -39
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +25 -7
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +1 -9
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationAppleOptions.hpp → JNitroPurchaseVerificationAppleOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationGoogleOptions.hpp → JNitroPurchaseVerificationGoogleOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationHorizonOptions.hpp → JNitroPurchaseVerificationHorizonOptions.hpp} +10 -10
- package/nitrogen/generated/android/c++/JNitroPurchaseVerificationParams.hpp +79 -0
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultAndroid.hpp → JNitroPurchaseVerificationResultAndroid.hpp} +10 -10
- package/nitrogen/generated/android/c++/{JNitroReceiptValidationResultIOS.hpp → JNitroPurchaseVerificationResultIOS.hpp} +10 -12
- package/nitrogen/generated/android/c++/JNitroRenewalInfoIOS.hpp +19 -3
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +1 -6
- package/nitrogen/generated/android/c++/JProductType.hpp +3 -3
- package/nitrogen/generated/android/c++/JPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +1 -7
- package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +25 -7
- package/nitrogen/generated/android/c++/JPurchaseVerificationProvider.hpp +3 -3
- package/nitrogen/generated/android/c++/JRenewalInfoIOS.hpp +19 -3
- package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +0 -2
- package/nitrogen/generated/android/c++/JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/{JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp → JVariant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.hpp} +26 -28
- package/nitrogen/generated/android/c++/JVariant_NullType_InitConnectionConfig.hpp +1 -3
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroProduct.hpp +0 -22
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchase.hpp +0 -2
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationAppleOptions.hpp +72 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationGoogleOptions.hpp +74 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPurchaseVerificationHorizonOptions.hpp +72 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRequestPurchaseAndroid.hpp +0 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +2 -30
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/InitConnectionConfig.kt +3 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroActiveSubscription.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +5 -20
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +32 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +3 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationAppleOptions.kt → NitroPurchaseVerificationAppleOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationGoogleOptions.kt → NitroPurchaseVerificationGoogleOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationHorizonOptions.kt → NitroPurchaseVerificationHorizonOptions.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationParams.kt → NitroPurchaseVerificationParams.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultAndroid.kt → NitroPurchaseVerificationResultAndroid.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroReceiptValidationResultIOS.kt → NitroPurchaseVerificationResultIOS.kt} +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRenewalInfoIOS.kt +24 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ProductType.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +2 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +30 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseVerificationProvider.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RenewalInfoIOS.kt +24 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationGoogleOptions.kt → Variant_NullType_NitroPurchaseVerificationAppleOptions.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_Array_NitroOneTimePurchaseOfferDetail_.kt → Variant_NullType_NitroPurchaseVerificationGoogleOptions.kt} +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{Variant_NullType_NitroReceiptValidationAppleOptions.kt → Variant_NullType_NitroPurchaseVerificationHorizonOptions.kt} +9 -9
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -16
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +212 -570
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -42
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +21 -101
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroPurchaseVerificationResultIOS__NitroPurchaseVerificationResultAndroid_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +2 -9
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +22 -181
- package/nitrogen/generated/ios/swift/InitConnectionConfig.swift +2 -13
- package/nitrogen/generated/ios/swift/NitroActiveSubscription.swift +1 -38
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +4 -4
- package/nitrogen/generated/ios/swift/NitroProduct.swift +5 -122
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +224 -7
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +1 -75
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationAppleOptions.swift → NitroPurchaseVerificationAppleOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationGoogleOptions.swift → NitroPurchaseVerificationGoogleOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationHorizonOptions.swift → NitroPurchaseVerificationHorizonOptions.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationParams.swift → NitroPurchaseVerificationParams.swift} +36 -36
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultAndroid.swift → NitroPurchaseVerificationResultAndroid.swift} +5 -5
- package/nitrogen/generated/ios/swift/{NitroReceiptValidationResultIOS.swift → NitroPurchaseVerificationResultIOS.swift} +5 -5
- package/nitrogen/generated/ios/swift/NitroRenewalInfoIOS.swift +149 -1
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +1 -38
- package/nitrogen/generated/ios/swift/ProductType.swift +4 -4
- package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +2 -7
- package/nitrogen/generated/ios/swift/PurchaseIOS.swift +221 -4
- package/nitrogen/generated/ios/swift/PurchaseVerificationProvider.swift +4 -4
- package/nitrogen/generated/ios/swift/RenewalInfoIOS.swift +150 -2
- package/nitrogen/generated/ios/swift/{Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.swift → Variant_NitroPurchaseVerificationResultIOS_NitroPurchaseVerificationResultAndroid.swift} +5 -5
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroLimitedQuantityInfoAndroid.swift → Variant_NullType_NitroPurchaseVerificationAppleOptions.swift} +4 -4
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroReceiptValidationAppleOptions.swift → Variant_NullType_NitroPurchaseVerificationGoogleOptions.swift} +4 -4
- package/nitrogen/generated/ios/swift/{Variant_NullType_NitroPreorderDetailsAndroid.swift → Variant_NullType_NitroPurchaseVerificationHorizonOptions.swift} +4 -4
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +1 -8
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +11 -18
- package/nitrogen/generated/shared/c++/InitConnectionConfig.hpp +2 -9
- package/nitrogen/generated/shared/c++/NitroActiveSubscription.hpp +1 -5
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +4 -4
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +6 -22
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +25 -8
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +2 -10
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationAppleOptions.hpp → NitroPurchaseVerificationAppleOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationGoogleOptions.hpp → NitroPurchaseVerificationGoogleOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationHorizonOptions.hpp → NitroPurchaseVerificationHorizonOptions.hpp} +11 -11
- package/nitrogen/generated/shared/c++/NitroPurchaseVerificationParams.hpp +101 -0
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultAndroid.hpp → NitroPurchaseVerificationResultAndroid.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{NitroReceiptValidationResultIOS.hpp → NitroPurchaseVerificationResultIOS.hpp} +11 -11
- package/nitrogen/generated/shared/c++/NitroRenewalInfoIOS.hpp +18 -2
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +1 -5
- package/nitrogen/generated/shared/c++/ProductType.hpp +5 -5
- package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +1 -8
- package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +25 -8
- package/nitrogen/generated/shared/c++/PurchaseVerificationProvider.hpp +5 -5
- package/nitrogen/generated/shared/c++/RenewalInfoIOS.hpp +18 -2
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +5 -76
- package/src/index.kepler.ts +11 -96
- package/src/index.ts +80 -458
- package/src/specs/RnIap.nitro.ts +35 -196
- package/src/types.ts +77 -295
- package/src/utils/errorMapping.ts +21 -20
- package/src/utils/type-bridge.ts +53 -90
- package/src/utils.ts +8 -0
- package/src/vega-adapter.ts +11 -59
- package/lib/module/utils/deprecation.js +0 -15
- package/lib/module/utils/deprecation.js.map +0 -1
- package/lib/module/utils/platform-request.js +0 -28
- package/lib/module/utils/platform-request.js.map +0 -1
- package/lib/typescript/src/utils/deprecation.d.ts +0 -3
- package/lib/typescript/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/src/utils/platform-request.d.ts +0 -12
- package/lib/typescript/src/utils/platform-request.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JAlternativeBillingModeAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroDiscountAmountAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroDiscountDisplayInfoAndroid.hpp +0 -69
- package/nitrogen/generated/android/c++/JNitroLimitedQuantityInfoAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroOneTimePurchaseOfferDetail.hpp +0 -148
- package/nitrogen/generated/android/c++/JNitroPreorderDetailsAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +0 -79
- package/nitrogen/generated/android/c++/JNitroRentalDetailsAndroid.hpp +0 -66
- package/nitrogen/generated/android/c++/JNitroValidTimeWindowAndroid.hpp +0 -61
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.cpp +0 -35
- package/nitrogen/generated/android/c++/JVariant_NullType_Array_NitroOneTimePurchaseOfferDetail_.hpp +0 -103
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountAmountAndroid.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroDiscountDisplayInfoAndroid.hpp +0 -77
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroLimitedQuantityInfoAndroid.hpp +0 -71
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroPreorderDetailsAndroid.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationAppleOptions.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationGoogleOptions.hpp +0 -74
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroReceiptValidationHorizonOptions.hpp +0 -72
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroRentalDetailsAndroid.hpp +0 -74
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroValidTimeWindowAndroid.hpp +0 -72
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/AlternativeBillingModeAndroid.kt +0 -24
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountAmountAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroDiscountDisplayInfoAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroLimitedQuantityInfoAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroOneTimePurchaseOfferDetail.kt +0 -111
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPreorderDetailsAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRentalDetailsAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroValidTimeWindowAndroid.kt +0 -56
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountAmountAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroDiscountDisplayInfoAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroLimitedQuantityInfoAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroPreorderDetailsAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroReceiptValidationHorizonOptions.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroRentalDetailsAndroid.kt +0 -62
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroValidTimeWindowAndroid.kt +0 -62
- package/nitrogen/generated/ios/swift/AlternativeBillingModeAndroid.swift +0 -44
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid_.swift +0 -58
- package/nitrogen/generated/ios/swift/NitroDiscountAmountAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroDiscountDisplayInfoAndroid.swift +0 -98
- package/nitrogen/generated/ios/swift/NitroLimitedQuantityInfoAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroOneTimePurchaseOfferDetail.swift +0 -351
- package/nitrogen/generated/ios/swift/NitroPreorderDetailsAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/NitroRentalDetailsAndroid.swift +0 -66
- package/nitrogen/generated/ios/swift/NitroValidTimeWindowAndroid.swift +0 -34
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountAmountAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroDiscountDisplayInfoAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationGoogleOptions.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroReceiptValidationHorizonOptions.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroRentalDetailsAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroValidTimeWindowAndroid.swift +0 -30
- package/nitrogen/generated/ios/swift/Variant_NullType__NitroOneTimePurchaseOfferDetail_.swift +0 -30
- package/nitrogen/generated/shared/c++/AlternativeBillingModeAndroid.hpp +0 -80
- package/nitrogen/generated/shared/c++/NitroDiscountAmountAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroDiscountDisplayInfoAndroid.hpp +0 -91
- package/nitrogen/generated/shared/c++/NitroLimitedQuantityInfoAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroOneTimePurchaseOfferDetail.hpp +0 -149
- package/nitrogen/generated/shared/c++/NitroPreorderDetailsAndroid.hpp +0 -87
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +0 -101
- package/nitrogen/generated/shared/c++/NitroRentalDetailsAndroid.hpp +0 -90
- package/nitrogen/generated/shared/c++/NitroValidTimeWindowAndroid.hpp +0 -87
- package/src/utils/deprecation.ts +0 -16
- package/src/utils/platform-request.ts +0 -37
package/lib/module/index.js
CHANGED
|
@@ -13,8 +13,6 @@ import { convertNitroProductToProduct, convertNitroPurchaseToPurchase, convertPr
|
|
|
13
13
|
import { isUserCancelledError, parseErrorStringToJsonObj } from "./utils/error.js";
|
|
14
14
|
import { normalizeErrorCodeFromNative, createPurchaseError, DUPLICATE_PURCHASE_CODE } from "./utils/errorMapping.js";
|
|
15
15
|
import { RnIapConsole } from "./utils/debug.js";
|
|
16
|
-
import { warnLegacyOnce } from "./utils/deprecation.js";
|
|
17
|
-
import { selectCanonicalPlatformRequest } from "./utils/platform-request.js";
|
|
18
16
|
import { getSuccessFromPurchaseVariant } from "./utils/purchase.js";
|
|
19
17
|
import { parseAppTransactionPayload } from "./utils.js";
|
|
20
18
|
import { getVegaIapModule, isVegaOS } from "./vega.js";
|
|
@@ -33,14 +31,8 @@ export * from "./types.js";
|
|
|
33
31
|
export * from "./utils/error.js";
|
|
34
32
|
export * from "./vega.js";
|
|
35
33
|
|
|
36
|
-
/**
|
|
37
|
-
* Product type accepted by public query and purchase helpers.
|
|
38
|
-
*
|
|
39
|
-
* Compatibility note: the `'inapp'` member is deprecated. Use `'in-app'`
|
|
40
|
-
* instead; the alias will be removed in react-native-iap 16.0.0.
|
|
41
|
-
*/
|
|
34
|
+
/** Product type accepted by public query and purchase helpers. */
|
|
42
35
|
|
|
43
|
-
const LEGACY_INAPP_WARNING = "[react-native-iap] `type: 'inapp'` is deprecated and will be removed in react-native-iap 16.0.0. Use 'in-app' instead.";
|
|
44
36
|
const toErrorMessage = error => {
|
|
45
37
|
if (typeof error === 'object' && error !== null && 'message' in error && error.message != null) {
|
|
46
38
|
return String(error.message);
|
|
@@ -281,6 +273,13 @@ export const purchaseUpdatedListener = (listener, options) => {
|
|
|
281
273
|
if (listeners.size > 0) {
|
|
282
274
|
return;
|
|
283
275
|
}
|
|
276
|
+
|
|
277
|
+
// StoreKit-backed Nitro listener disposal can abort in iOS release builds
|
|
278
|
+
// when a native modal is being popped. Keep the singleton native listener
|
|
279
|
+
// attached for the app session and only remove the JS callback above.
|
|
280
|
+
if (Platform.OS === 'ios') {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
284
283
|
const token = receiveDuplicateTransactionUpdatesIOS ? purchaseUpdateDuplicateNativeToken : purchaseUpdateNativeToken;
|
|
285
284
|
if (token == null) {
|
|
286
285
|
return;
|
|
@@ -318,7 +317,18 @@ export const purchaseErrorListener = listener => {
|
|
|
318
317
|
return {
|
|
319
318
|
remove: () => {
|
|
320
319
|
purchaseErrorJsListeners.delete(listener);
|
|
321
|
-
if (purchaseErrorJsListeners.size
|
|
320
|
+
if (purchaseErrorJsListeners.size > 0) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Same iOS policy as purchaseUpdatedListener: releasing the stored
|
|
325
|
+
// native callback from a JS unsubscribe can race an in-flight dispatch
|
|
326
|
+
// snapshot on another thread. Keep the singleton attached; endConnection
|
|
327
|
+
// owns native disposal.
|
|
328
|
+
if (Platform.OS === 'ios') {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (purchaseErrorNativeAttached) {
|
|
322
332
|
try {
|
|
323
333
|
IAP.instance.removePurchaseErrorListener(purchaseErrorNativeHandler);
|
|
324
334
|
purchaseErrorNativeAttached = false;
|
|
@@ -619,8 +629,7 @@ export const fetchProducts = async request => {
|
|
|
619
629
|
platform: item.platform
|
|
620
630
|
})));
|
|
621
631
|
|
|
622
|
-
//
|
|
623
|
-
// On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription
|
|
632
|
+
// The major schema uses the canonical `type` discriminator on every store.
|
|
624
633
|
const productItems = [];
|
|
625
634
|
const subscriptionItems = [];
|
|
626
635
|
converted.forEach(item => {
|
|
@@ -629,31 +638,7 @@ export const fetchProducts = async request => {
|
|
|
629
638
|
productItems.push(item);
|
|
630
639
|
return;
|
|
631
640
|
}
|
|
632
|
-
|
|
633
|
-
// item.type === 'subs' case
|
|
634
|
-
// For Android, check if subscription items have actual offers
|
|
635
|
-
if (isAndroidStoreRuntime() && item.platform === 'android' && item.type === 'subs') {
|
|
636
|
-
// TypeScript now knows this is ProductSubscriptionAndroid
|
|
637
|
-
const hasSubscriptionOffers = item.subscriptionOfferDetailsAndroid && Array.isArray(item.subscriptionOfferDetailsAndroid) && item.subscriptionOfferDetailsAndroid.length > 0;
|
|
638
|
-
RnIapConsole.debug(`[fetchProducts] ${item.id}: type=${item.type}, hasOffers=${hasSubscriptionOffers}`);
|
|
639
|
-
if (hasSubscriptionOffers) {
|
|
640
|
-
subscriptionItems.push(item);
|
|
641
|
-
} else {
|
|
642
|
-
// Treat as product if no offers - convert type
|
|
643
|
-
const {
|
|
644
|
-
subscriptionOfferDetailsAndroid: _,
|
|
645
|
-
...productFields
|
|
646
|
-
} = item;
|
|
647
|
-
productItems.push({
|
|
648
|
-
...productFields,
|
|
649
|
-
type: 'in-app'
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
} else if (item.platform === 'ios' && item.type === 'subs') {
|
|
653
|
-
// iOS: type field is reliable with discriminated unions
|
|
654
|
-
// TypeScript now knows this is ProductSubscriptionIOS
|
|
655
|
-
subscriptionItems.push(item);
|
|
656
|
-
}
|
|
641
|
+
subscriptionItems.push(item);
|
|
657
642
|
});
|
|
658
643
|
RnIapConsole.debug('[fetchProducts] After filtering - products:', productItems.length, 'subs:', subscriptionItems.length);
|
|
659
644
|
return [...productItems, ...subscriptionItems];
|
|
@@ -736,7 +721,7 @@ export const getAvailablePurchases = async options => {
|
|
|
736
721
|
// For Android Play/Horizon/Fire OS, query in-app items and subscriptions separately.
|
|
737
722
|
const inappNitroPurchases = await IAP.instance.getAvailablePurchases({
|
|
738
723
|
android: {
|
|
739
|
-
type: '
|
|
724
|
+
type: 'in-app',
|
|
740
725
|
includeSuspended
|
|
741
726
|
}
|
|
742
727
|
});
|
|
@@ -775,7 +760,7 @@ export const getPromotedProductIOS = async () => {
|
|
|
775
760
|
return null;
|
|
776
761
|
}
|
|
777
762
|
try {
|
|
778
|
-
const nitroProduct =
|
|
763
|
+
const nitroProduct = await IAP.instance.getPromotedProductIOS();
|
|
779
764
|
if (!nitroProduct) {
|
|
780
765
|
return null;
|
|
781
766
|
}
|
|
@@ -792,46 +777,6 @@ export const getPromotedProductIOS = async () => {
|
|
|
792
777
|
}
|
|
793
778
|
};
|
|
794
779
|
|
|
795
|
-
/**
|
|
796
|
-
* @deprecated Use `getPromotedProductIOS` instead. This compatibility alias
|
|
797
|
-
* will be removed in react-native-iap 16.0.0.
|
|
798
|
-
*/
|
|
799
|
-
export const requestPromotedProductIOS = getPromotedProductIOS;
|
|
800
|
-
|
|
801
|
-
/**
|
|
802
|
-
* Get the storefront identifier for the user's App Store account (iOS only)
|
|
803
|
-
* @returns Promise<string> - The storefront identifier (e.g., 'USA' for United States)
|
|
804
|
-
* @platform iOS
|
|
805
|
-
*
|
|
806
|
-
* @example
|
|
807
|
-
* ```typescript
|
|
808
|
-
* const storefront = await getStorefrontIOS();
|
|
809
|
-
* console.log('User storefront:', storefront); // e.g., 'USA', 'GBR', 'KOR'
|
|
810
|
-
* ```
|
|
811
|
-
*
|
|
812
|
-
* @see {@link https://openiap.dev/docs/apis/ios/get-storefront-ios}
|
|
813
|
-
* @deprecated Use `getStorefront` instead. Scheduled for removal in
|
|
814
|
-
* react-native-iap 16.0.0.
|
|
815
|
-
*/
|
|
816
|
-
export const getStorefrontIOS = async () => {
|
|
817
|
-
if (Platform.OS !== 'ios') {
|
|
818
|
-
throw new Error('getStorefrontIOS is only available on iOS');
|
|
819
|
-
}
|
|
820
|
-
try {
|
|
821
|
-
const storefront = await IAP.instance.getStorefrontIOS();
|
|
822
|
-
if (typeof storefront !== 'string' || storefront.trim().length === 0) {
|
|
823
|
-
throw createPurchaseError({
|
|
824
|
-
code: ErrorCode.ServiceError,
|
|
825
|
-
message: 'Storefront lookup returned no country code.'
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
return storefront;
|
|
829
|
-
} catch (error) {
|
|
830
|
-
RnIapConsole.error('Failed to get storefront:', error);
|
|
831
|
-
throw error;
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
|
|
835
780
|
/**
|
|
836
781
|
* Return the user's storefront country code.
|
|
837
782
|
*
|
|
@@ -844,17 +789,9 @@ export const getStorefront = async () => {
|
|
|
844
789
|
message: `Storefront lookup is not supported on ${Platform.OS}.`
|
|
845
790
|
});
|
|
846
791
|
}
|
|
847
|
-
const hasUnifiedMethod = typeof IAP.instance.getStorefront === 'function';
|
|
848
|
-
if (!hasUnifiedMethod && Platform.OS !== 'ios') {
|
|
849
|
-
throw createPurchaseError({
|
|
850
|
-
code: ErrorCode.FeatureNotSupported,
|
|
851
|
-
message: 'Native getStorefront is not available on this build.',
|
|
852
|
-
platform: 'android'
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
792
|
let storefront;
|
|
856
793
|
try {
|
|
857
|
-
storefront =
|
|
794
|
+
storefront = await IAP.instance.getStorefront();
|
|
858
795
|
} catch (error) {
|
|
859
796
|
const parsedError = parseErrorAndLogIfNeeded(`[getStorefront] Failed to get storefront on ${Platform.OS}:`, error);
|
|
860
797
|
throw createPurchaseError({
|
|
@@ -966,7 +903,7 @@ export const currentEntitlementIOS = async sku => {
|
|
|
966
903
|
const nitroPurchase = await IAP.instance.currentEntitlementIOS(sku);
|
|
967
904
|
if (nitroPurchase) {
|
|
968
905
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
969
|
-
return converted.
|
|
906
|
+
return converted.store === 'apple' ? converted : null;
|
|
970
907
|
}
|
|
971
908
|
return null;
|
|
972
909
|
} catch (error) {
|
|
@@ -996,7 +933,7 @@ export const latestTransactionIOS = async sku => {
|
|
|
996
933
|
const nitroPurchase = await IAP.instance.latestTransactionIOS(sku);
|
|
997
934
|
if (nitroPurchase) {
|
|
998
935
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
999
|
-
return converted.
|
|
936
|
+
return converted.store === 'apple' ? converted : null;
|
|
1000
937
|
}
|
|
1001
938
|
return null;
|
|
1002
939
|
} catch (error) {
|
|
@@ -1023,7 +960,7 @@ export const getPendingTransactionsIOS = async () => {
|
|
|
1023
960
|
}
|
|
1024
961
|
try {
|
|
1025
962
|
const nitroPurchases = await IAP.instance.getPendingTransactionsIOS();
|
|
1026
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
963
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1027
964
|
} catch (error) {
|
|
1028
965
|
const parsedError = parseErrorAndLogIfNeeded('[getPendingTransactionsIOS] Failed:', error);
|
|
1029
966
|
throw createPurchaseError({
|
|
@@ -1046,7 +983,7 @@ export const getAllTransactionsIOS = async () => {
|
|
|
1046
983
|
}
|
|
1047
984
|
try {
|
|
1048
985
|
const nitroPurchases = await IAP.instance.getAllTransactionsIOS();
|
|
1049
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
986
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1050
987
|
} catch (error) {
|
|
1051
988
|
const parsedError = parseErrorAndLogIfNeeded('[getAllTransactionsIOS] Failed:', error);
|
|
1052
989
|
throw createPurchaseError({
|
|
@@ -1071,7 +1008,7 @@ export const showManageSubscriptionsIOS = async () => {
|
|
|
1071
1008
|
}
|
|
1072
1009
|
try {
|
|
1073
1010
|
const nitroPurchases = await IAP.instance.showManageSubscriptionsIOS();
|
|
1074
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
1011
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1075
1012
|
} catch (error) {
|
|
1076
1013
|
const parsedError = parseErrorAndLogIfNeeded('[showManageSubscriptionsIOS] Failed:', error);
|
|
1077
1014
|
throw createPurchaseError({
|
|
@@ -1132,34 +1069,6 @@ export const getReceiptDataIOS = async () => {
|
|
|
1132
1069
|
});
|
|
1133
1070
|
}
|
|
1134
1071
|
};
|
|
1135
|
-
|
|
1136
|
-
/**
|
|
1137
|
-
* Legacy alias for `getReceiptDataIOS`.
|
|
1138
|
-
*
|
|
1139
|
-
* @deprecated Use `getReceiptDataIOS` for the cumulative App Store receipt or
|
|
1140
|
-
* `getTransactionJwsIOS(productId)` for one transaction. This alias will be
|
|
1141
|
-
* removed in react-native-iap 16.0.0.
|
|
1142
|
-
*/
|
|
1143
|
-
export const getReceiptIOS = async () => {
|
|
1144
|
-
if (Platform.OS !== 'ios') {
|
|
1145
|
-
throw new Error('getReceiptIOS is only available on iOS');
|
|
1146
|
-
}
|
|
1147
|
-
RnIapConsole.warn('[getReceiptIOS] is deprecated and will be removed in react-native-iap 16.0.0. ' + 'Use getReceiptDataIOS() for the cumulative receipt. iOS receipts contain ALL transactions, not just the latest one. ' + 'For individual purchase validation, use getTransactionJwsIOS(productId) instead. ' + 'See: https://react-native-iap.hyo.dev/docs/guides/receipt-validation');
|
|
1148
|
-
try {
|
|
1149
|
-
if (typeof IAP.instance.getReceiptIOS === 'function') {
|
|
1150
|
-
return await IAP.instance.getReceiptIOS();
|
|
1151
|
-
}
|
|
1152
|
-
return await IAP.instance.getReceiptDataIOS();
|
|
1153
|
-
} catch (error) {
|
|
1154
|
-
const parsedError = parseErrorAndLogIfNeeded('[getReceiptIOS] Failed:', error);
|
|
1155
|
-
throw createPurchaseError({
|
|
1156
|
-
code: parsedError.code,
|
|
1157
|
-
message: parsedError.message,
|
|
1158
|
-
responseCode: parsedError.responseCode,
|
|
1159
|
-
debugMessage: parsedError.debugMessage
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
1072
|
export const requestReceiptRefreshIOS = async () => {
|
|
1164
1073
|
if (Platform.OS !== 'ios') {
|
|
1165
1074
|
throw new Error('requestReceiptRefreshIOS is only available on iOS');
|
|
@@ -1361,8 +1270,8 @@ export const requestPurchase = async request => {
|
|
|
1361
1270
|
if (!perPlatformRequest) {
|
|
1362
1271
|
throw new Error('Missing purchase request configuration');
|
|
1363
1272
|
}
|
|
1364
|
-
const iosRequestSource = Platform.OS === 'ios' ?
|
|
1365
|
-
const androidRequestSource = isAndroidStoreRuntime() ?
|
|
1273
|
+
const iosRequestSource = Platform.OS === 'ios' ? perPlatformRequest.apple : undefined;
|
|
1274
|
+
const androidRequestSource = isAndroidStoreRuntime() ? perPlatformRequest.google : undefined;
|
|
1366
1275
|
if (Platform.OS === 'ios') {
|
|
1367
1276
|
if (!iosRequestSource?.sku) {
|
|
1368
1277
|
throw new Error('Invalid request for iOS. The `sku` property is required.');
|
|
@@ -1446,9 +1355,6 @@ export const requestPurchase = async request => {
|
|
|
1446
1355
|
if (subsRequest.originalExternalTransactionId) {
|
|
1447
1356
|
androidPayload.originalExternalTransactionId = subsRequest.originalExternalTransactionId;
|
|
1448
1357
|
}
|
|
1449
|
-
if (subsRequest.replacementMode != null) {
|
|
1450
|
-
androidPayload.replacementMode = subsRequest.replacementMode;
|
|
1451
|
-
}
|
|
1452
1358
|
if (subsRequest.subscriptionProductReplacementParams) {
|
|
1453
1359
|
androidPayload.subscriptionProductReplacementParams = subsRequest.subscriptionProductReplacementParams;
|
|
1454
1360
|
}
|
|
@@ -1648,8 +1554,7 @@ export const openRedeemOfferCodeAndroid = async () => {
|
|
|
1648
1554
|
// ============================================================================
|
|
1649
1555
|
|
|
1650
1556
|
/**
|
|
1651
|
-
*
|
|
1652
|
-
* @deprecated Use `verifyPurchase` instead. This function will be removed in react-native-iap 16.0.0.
|
|
1557
|
+
* Verify a purchase on iOS or Android.
|
|
1653
1558
|
* @param options - Platform-specific verification options
|
|
1654
1559
|
* @param options.apple - Apple App Store verification options (iOS)
|
|
1655
1560
|
* @param options.google - Google Play verification options (Android)
|
|
@@ -1673,7 +1578,7 @@ export const openRedeemOfferCodeAndroid = async () => {
|
|
|
1673
1578
|
*
|
|
1674
1579
|
* @see {@link https://openiap.dev/docs/apis/validate-receipt}
|
|
1675
1580
|
*/
|
|
1676
|
-
export const
|
|
1581
|
+
export const verifyPurchase = async options => {
|
|
1677
1582
|
const {
|
|
1678
1583
|
apple,
|
|
1679
1584
|
google,
|
|
@@ -1721,7 +1626,7 @@ export const validateReceipt = async options => {
|
|
|
1721
1626
|
accessToken: horizon.accessToken
|
|
1722
1627
|
} : null
|
|
1723
1628
|
};
|
|
1724
|
-
const nitroResult = await IAP.instance.
|
|
1629
|
+
const nitroResult = await IAP.instance.verifyPurchase(params);
|
|
1725
1630
|
|
|
1726
1631
|
// Convert Nitro result to public API result
|
|
1727
1632
|
if (Platform.OS === 'ios') {
|
|
@@ -1759,7 +1664,7 @@ export const validateReceipt = async options => {
|
|
|
1759
1664
|
return result;
|
|
1760
1665
|
}
|
|
1761
1666
|
} catch (error) {
|
|
1762
|
-
const parsedError = parseErrorAndLogIfNeeded('[
|
|
1667
|
+
const parsedError = parseErrorAndLogIfNeeded('[verifyPurchase] Failed:', error);
|
|
1763
1668
|
throw createPurchaseError({
|
|
1764
1669
|
code: parsedError.code,
|
|
1765
1670
|
message: parsedError.message,
|
|
@@ -1769,36 +1674,6 @@ export const validateReceipt = async options => {
|
|
|
1769
1674
|
}
|
|
1770
1675
|
};
|
|
1771
1676
|
|
|
1772
|
-
/**
|
|
1773
|
-
* Verify purchase with the configured providers
|
|
1774
|
-
*
|
|
1775
|
-
* This function uses the native OpenIAP verifyPurchase implementation
|
|
1776
|
-
* which validates purchases using platform-specific methods.
|
|
1777
|
-
* This is an alias for validateReceipt for API consistency with OpenIAP.
|
|
1778
|
-
*
|
|
1779
|
-
* @param options - Receipt validation options containing the SKU
|
|
1780
|
-
* @returns Promise resolving to receipt validation result
|
|
1781
|
-
*
|
|
1782
|
-
* @see {@link https://openiap.dev/docs/features/validation#verify-purchase}
|
|
1783
|
-
*/
|
|
1784
|
-
export const verifyPurchase = validateReceipt;
|
|
1785
|
-
|
|
1786
|
-
/**
|
|
1787
|
-
* iOS-only receipt validation alias.
|
|
1788
|
-
*
|
|
1789
|
-
* @deprecated Use `verifyPurchase` instead. This compatibility alias will be
|
|
1790
|
-
* removed in react-native-iap 16.0.0. Throws on non-iOS platforms.
|
|
1791
|
-
*
|
|
1792
|
-
* @see {@link https://openiap.dev/docs/apis/ios/validate-receipt-ios}
|
|
1793
|
-
*/
|
|
1794
|
-
export const validateReceiptIOS = async options => {
|
|
1795
|
-
if (Platform.OS !== 'ios') {
|
|
1796
|
-
throw new Error('validateReceiptIOS is only available on iOS');
|
|
1797
|
-
}
|
|
1798
|
-
const result = await validateReceipt(options);
|
|
1799
|
-
return result;
|
|
1800
|
-
};
|
|
1801
|
-
|
|
1802
1677
|
/**
|
|
1803
1678
|
* Verify purchase with a specific provider (e.g., IAPKit)
|
|
1804
1679
|
*
|
|
@@ -1894,18 +1769,25 @@ export const syncIOS = async () => {
|
|
|
1894
1769
|
|
|
1895
1770
|
/**
|
|
1896
1771
|
* Present the code redemption sheet for offer codes (iOS only)
|
|
1897
|
-
* @returns
|
|
1772
|
+
* @returns The verified redeemed purchase on iOS 27+, or null after the
|
|
1773
|
+
* legacy sheet is presented on earlier iOS versions.
|
|
1898
1774
|
* @platform iOS
|
|
1899
1775
|
*
|
|
1900
1776
|
* @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
|
|
1901
1777
|
*/
|
|
1902
1778
|
export const presentCodeRedemptionSheetIOS = async () => {
|
|
1903
1779
|
if (Platform.OS !== 'ios') {
|
|
1904
|
-
return
|
|
1780
|
+
return null;
|
|
1905
1781
|
}
|
|
1906
1782
|
try {
|
|
1907
1783
|
const result = await IAP.instance.presentCodeRedemptionSheetIOS();
|
|
1908
|
-
|
|
1784
|
+
if (result == null) {
|
|
1785
|
+
return null;
|
|
1786
|
+
}
|
|
1787
|
+
if (!validateNitroPurchase(result)) {
|
|
1788
|
+
throw new Error('Invalid redeemed purchase returned by native StoreKit');
|
|
1789
|
+
}
|
|
1790
|
+
return convertNitroPurchaseToPurchase(result);
|
|
1909
1791
|
} catch (error) {
|
|
1910
1792
|
const parsedError = parseErrorAndLogIfNeeded('[presentCodeRedemptionSheetIOS] Failed:', error);
|
|
1911
1793
|
throw createPurchaseError({
|
|
@@ -1917,47 +1799,6 @@ export const presentCodeRedemptionSheetIOS = async () => {
|
|
|
1917
1799
|
}
|
|
1918
1800
|
};
|
|
1919
1801
|
|
|
1920
|
-
/**
|
|
1921
|
-
* Buy promoted product on iOS
|
|
1922
|
-
* @deprecated In StoreKit 2, promoted products can be purchased directly via
|
|
1923
|
-
* the standard `requestPurchase()` flow. This alias will be removed in
|
|
1924
|
-
* react-native-iap 16.0.0.
|
|
1925
|
-
* Use `promotedProductListenerIOS` to receive the product ID when a user taps a promoted product,
|
|
1926
|
-
* then call `requestPurchase()` with the received SKU directly.
|
|
1927
|
-
*
|
|
1928
|
-
* @example
|
|
1929
|
-
* ```typescript
|
|
1930
|
-
* // Recommended approach
|
|
1931
|
-
* promotedProductListenerIOS(async (product) => {
|
|
1932
|
-
* await requestPurchase({
|
|
1933
|
-
* request: { apple: { sku: product.id } },
|
|
1934
|
-
* type: 'in-app'
|
|
1935
|
-
* });
|
|
1936
|
-
* });
|
|
1937
|
-
* ```
|
|
1938
|
-
*
|
|
1939
|
-
* @returns Promise<boolean> - true when the request triggers successfully
|
|
1940
|
-
* @platform iOS
|
|
1941
|
-
*
|
|
1942
|
-
* @see {@link https://openiap.dev/docs/apis/ios/request-purchase-on-promoted-product-ios}
|
|
1943
|
-
*/
|
|
1944
|
-
export const requestPurchaseOnPromotedProductIOS = async () => {
|
|
1945
|
-
if (Platform.OS !== 'ios') {
|
|
1946
|
-
throw new Error('requestPurchaseOnPromotedProductIOS is only available on iOS');
|
|
1947
|
-
}
|
|
1948
|
-
try {
|
|
1949
|
-
return await IAP.instance.buyPromotedProductIOS();
|
|
1950
|
-
} catch (error) {
|
|
1951
|
-
const parsedError = parseErrorAndLogIfNeeded('[requestPurchaseOnPromotedProductIOS] Failed:', error);
|
|
1952
|
-
throw createPurchaseError({
|
|
1953
|
-
code: parsedError.code,
|
|
1954
|
-
message: parsedError.message,
|
|
1955
|
-
responseCode: parsedError.responseCode,
|
|
1956
|
-
debugMessage: parsedError.debugMessage
|
|
1957
|
-
});
|
|
1958
|
-
}
|
|
1959
|
-
};
|
|
1960
|
-
|
|
1961
1802
|
/**
|
|
1962
1803
|
* Clear unfinished transactions on iOS
|
|
1963
1804
|
* @returns Promise<boolean>
|
|
@@ -2087,12 +1928,14 @@ export const getActiveSubscriptions = async subscriptionIds => {
|
|
|
2087
1928
|
// iOS specific fields
|
|
2088
1929
|
expirationDateIOS: sub.expirationDateIOS ?? null,
|
|
2089
1930
|
environmentIOS: sub.environmentIOS ?? null,
|
|
2090
|
-
willExpireSoon: sub.willExpireSoon ?? null,
|
|
2091
1931
|
daysUntilExpirationIOS: sub.daysUntilExpirationIOS ?? null,
|
|
2092
1932
|
// renewalInfoIOS contains subscription lifecycle information on iOS.
|
|
2093
1933
|
renewalInfoIOS: sub.renewalInfoIOS ? {
|
|
2094
1934
|
willAutoRenew: sub.renewalInfoIOS.willAutoRenew ?? false,
|
|
2095
1935
|
autoRenewPreference: sub.renewalInfoIOS.autoRenewPreference ?? null,
|
|
1936
|
+
bundleOriginalTransactionId: sub.renewalInfoIOS.bundleOriginalTransactionId ?? null,
|
|
1937
|
+
bundleProductId: sub.renewalInfoIOS.bundleProductId ?? null,
|
|
1938
|
+
bundleSubscriptionGroupId: sub.renewalInfoIOS.bundleSubscriptionGroupId ?? null,
|
|
2096
1939
|
commitmentInfo: sub.renewalInfoIOS.commitmentInfo ?? null,
|
|
2097
1940
|
pendingUpgradeProductId: sub.renewalInfoIOS.pendingUpgradeProductId ?? null,
|
|
2098
1941
|
renewalDate: sub.renewalInfoIOS.renewalDate ?? null,
|
|
@@ -2103,7 +1946,8 @@ export const getActiveSubscriptions = async subscriptionIds => {
|
|
|
2103
1946
|
renewalBillingPlanType: sub.renewalInfoIOS.renewalBillingPlanType ?? null,
|
|
2104
1947
|
renewalOfferType: sub.renewalInfoIOS.renewalOfferType ?? null,
|
|
2105
1948
|
renewalOfferId: sub.renewalInfoIOS.renewalOfferId ?? null,
|
|
2106
|
-
jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null
|
|
1949
|
+
jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null,
|
|
1950
|
+
willUnbundle: sub.renewalInfoIOS.willUnbundle ?? null
|
|
2107
1951
|
} : null,
|
|
2108
1952
|
// Android specific fields
|
|
2109
1953
|
autoRenewingAndroid: sub.autoRenewingAndroid ?? null,
|
|
@@ -2150,37 +1994,10 @@ export const hasActiveSubscriptions = async subscriptionIds => {
|
|
|
2150
1994
|
// Type conversion utilities
|
|
2151
1995
|
export { convertNitroProductToProduct, convertNitroPurchaseToPurchase, convertProductToProductSubscription, validateNitroProduct, validateNitroPurchase, checkTypeSynchronization } from "./utils/type-bridge.js";
|
|
2152
1996
|
|
|
2153
|
-
// Deprecated exports for backward compatibility
|
|
2154
|
-
/**
|
|
2155
|
-
* @deprecated Use acknowledgePurchaseAndroid instead. This alias will be
|
|
2156
|
-
* removed in react-native-iap 16.0.0.
|
|
2157
|
-
*/
|
|
2158
|
-
export const acknowledgePurchase = acknowledgePurchaseAndroid;
|
|
2159
|
-
|
|
2160
|
-
/**
|
|
2161
|
-
* @deprecated Use consumePurchaseAndroid instead. This alias will be removed
|
|
2162
|
-
* in react-native-iap 16.0.0.
|
|
2163
|
-
*/
|
|
2164
|
-
export const consumePurchase = consumePurchaseAndroid;
|
|
2165
|
-
|
|
2166
1997
|
// ============================================================================
|
|
2167
1998
|
// Internal Helpers
|
|
2168
1999
|
// ============================================================================
|
|
2169
2000
|
|
|
2170
|
-
const selectApplePurchaseRequest = request => {
|
|
2171
|
-
const selection = selectCanonicalPlatformRequest(request, 'apple', 'ios');
|
|
2172
|
-
if (selection.usesLegacyKey && selection.value != null) {
|
|
2173
|
-
warnLegacyOnce('request-purchase.ios', '[react-native-iap] `request.ios` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.apple` instead.');
|
|
2174
|
-
}
|
|
2175
|
-
return selection.value;
|
|
2176
|
-
};
|
|
2177
|
-
const selectGooglePurchaseRequest = request => {
|
|
2178
|
-
const selection = selectCanonicalPlatformRequest(request, 'google', 'android');
|
|
2179
|
-
if (selection.usesLegacyKey && selection.value != null) {
|
|
2180
|
-
warnLegacyOnce('request-purchase.android', '[react-native-iap] `request.android` is deprecated and will be removed in react-native-iap 16.0.0. Use `request.google` instead.');
|
|
2181
|
-
}
|
|
2182
|
-
return selection.value;
|
|
2183
|
-
};
|
|
2184
2001
|
const toDiscountOfferRecordIOS = offer => {
|
|
2185
2002
|
if (!offer) {
|
|
2186
2003
|
return undefined;
|
|
@@ -2194,159 +2011,26 @@ const toDiscountOfferRecordIOS = offer => {
|
|
|
2194
2011
|
};
|
|
2195
2012
|
};
|
|
2196
2013
|
const toNitroProductType = type => {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2014
|
+
switch (type) {
|
|
2015
|
+
case 'in-app':
|
|
2016
|
+
return 'in-app';
|
|
2017
|
+
case 'subs':
|
|
2018
|
+
return 'subs';
|
|
2019
|
+
case 'all':
|
|
2020
|
+
return 'all';
|
|
2021
|
+
default:
|
|
2022
|
+
throw new Error(`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`);
|
|
2206
2023
|
}
|
|
2207
|
-
return 'in-app';
|
|
2208
2024
|
};
|
|
2209
2025
|
const isSubscriptionQuery = type => type === 'subs';
|
|
2210
2026
|
const normalizeProductQueryType = type => {
|
|
2027
|
+
if (type == null) {
|
|
2028
|
+
return 'in-app';
|
|
2029
|
+
}
|
|
2211
2030
|
if (type === 'all' || type === 'subs' || type === 'in-app') {
|
|
2212
2031
|
return type;
|
|
2213
2032
|
}
|
|
2214
|
-
|
|
2215
|
-
const normalized = type.trim().toLowerCase().replace(/_/g, '-');
|
|
2216
|
-
if (normalized === 'all') {
|
|
2217
|
-
return 'all';
|
|
2218
|
-
}
|
|
2219
|
-
if (normalized === 'subs') {
|
|
2220
|
-
return 'subs';
|
|
2221
|
-
}
|
|
2222
|
-
if (normalized === 'inapp') {
|
|
2223
|
-
warnLegacyOnce('product-type.inapp', LEGACY_INAPP_WARNING);
|
|
2224
|
-
return 'in-app';
|
|
2225
|
-
}
|
|
2226
|
-
if (normalized === 'in-app') {
|
|
2227
|
-
return 'in-app';
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
return 'in-app';
|
|
2231
|
-
};
|
|
2232
|
-
|
|
2233
|
-
// ============================================================================
|
|
2234
|
-
// ALTERNATIVE BILLING APIs
|
|
2235
|
-
// ============================================================================
|
|
2236
|
-
|
|
2237
|
-
// ------------------------------
|
|
2238
|
-
// Android Alternative Billing
|
|
2239
|
-
// ------------------------------
|
|
2240
|
-
|
|
2241
|
-
/**
|
|
2242
|
-
* Check if alternative billing is available for this user/device (Android only).
|
|
2243
|
-
* Step 1 of alternative billing flow.
|
|
2244
|
-
*
|
|
2245
|
-
* @returns Promise<boolean> - true if available, false otherwise
|
|
2246
|
-
* @throws Error if billing client not ready
|
|
2247
|
-
* @platform Android
|
|
2248
|
-
*
|
|
2249
|
-
* @example
|
|
2250
|
-
* ```typescript
|
|
2251
|
-
* const isAvailable = await checkAlternativeBillingAvailabilityAndroid();
|
|
2252
|
-
* if (isAvailable) {
|
|
2253
|
-
* // Proceed with alternative billing flow
|
|
2254
|
-
* }
|
|
2255
|
-
* ```
|
|
2256
|
-
*
|
|
2257
|
-
* @see {@link https://openiap.dev/docs/apis/android/check-alternative-billing-availability-android}
|
|
2258
|
-
* @deprecated Use `isBillingProgramAvailableAndroid('external-offer')`
|
|
2259
|
-
* instead. Scheduled for removal in react-native-iap 16.0.0.
|
|
2260
|
-
*/
|
|
2261
|
-
export const checkAlternativeBillingAvailabilityAndroid = async () => {
|
|
2262
|
-
if (Platform.OS !== 'android') {
|
|
2263
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2264
|
-
}
|
|
2265
|
-
try {
|
|
2266
|
-
return await IAP.instance.checkAlternativeBillingAvailabilityAndroid();
|
|
2267
|
-
} catch (error) {
|
|
2268
|
-
RnIapConsole.error('Failed to check alternative billing availability:', error);
|
|
2269
|
-
throw error;
|
|
2270
|
-
}
|
|
2271
|
-
};
|
|
2272
|
-
|
|
2273
|
-
/**
|
|
2274
|
-
* Show alternative billing information dialog to user (Android only).
|
|
2275
|
-
* Step 2 of alternative billing flow.
|
|
2276
|
-
* Must be called BEFORE processing payment in your payment system.
|
|
2277
|
-
*
|
|
2278
|
-
* @returns Promise<boolean> - true if user accepted, false if user canceled
|
|
2279
|
-
* @throws Error if billing client not ready
|
|
2280
|
-
* @platform Android
|
|
2281
|
-
*
|
|
2282
|
-
* @example
|
|
2283
|
-
* ```typescript
|
|
2284
|
-
* const userAccepted = await showAlternativeBillingDialogAndroid();
|
|
2285
|
-
* if (userAccepted) {
|
|
2286
|
-
* // Process payment in your payment system
|
|
2287
|
-
* const success = await processCustomPayment();
|
|
2288
|
-
* if (success) {
|
|
2289
|
-
* // Create reporting token
|
|
2290
|
-
* const token = await createAlternativeBillingTokenAndroid();
|
|
2291
|
-
* // Send token to your backend for Google Play reporting
|
|
2292
|
-
* }
|
|
2293
|
-
* }
|
|
2294
|
-
* ```
|
|
2295
|
-
*
|
|
2296
|
-
* @see {@link https://openiap.dev/docs/apis/android/show-alternative-billing-dialog-android}
|
|
2297
|
-
* @deprecated Use `launchExternalLinkAndroid` instead. Scheduled for removal in
|
|
2298
|
-
* react-native-iap 16.0.0.
|
|
2299
|
-
*/
|
|
2300
|
-
export const showAlternativeBillingDialogAndroid = async () => {
|
|
2301
|
-
if (Platform.OS !== 'android') {
|
|
2302
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2303
|
-
}
|
|
2304
|
-
try {
|
|
2305
|
-
return await IAP.instance.showAlternativeBillingDialogAndroid();
|
|
2306
|
-
} catch (error) {
|
|
2307
|
-
RnIapConsole.error('Failed to show alternative billing dialog:', error);
|
|
2308
|
-
throw error;
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
|
|
2312
|
-
/**
|
|
2313
|
-
* Create external transaction token for Google Play reporting (Android only).
|
|
2314
|
-
* Step 3 of alternative billing flow.
|
|
2315
|
-
* Must be called AFTER successful payment in your payment system.
|
|
2316
|
-
* Token must be reported to Google Play backend within 24 hours.
|
|
2317
|
-
*
|
|
2318
|
-
* @param sku - Optional product SKU that was purchased
|
|
2319
|
-
* @returns Promise<string | null> - Token string or null if creation failed
|
|
2320
|
-
* @throws Error if billing client not ready
|
|
2321
|
-
* @platform Android
|
|
2322
|
-
*
|
|
2323
|
-
* @example
|
|
2324
|
-
* ```typescript
|
|
2325
|
-
* const token = await createAlternativeBillingTokenAndroid('premium_subscription');
|
|
2326
|
-
* if (token) {
|
|
2327
|
-
* // Send token to your backend
|
|
2328
|
-
* await fetch('/api/report-transaction', {
|
|
2329
|
-
* method: 'POST',
|
|
2330
|
-
* body: JSON.stringify({ token, sku: 'premium_subscription' })
|
|
2331
|
-
* });
|
|
2332
|
-
* }
|
|
2333
|
-
* ```
|
|
2334
|
-
*
|
|
2335
|
-
* @see {@link https://openiap.dev/docs/apis/android/create-alternative-billing-token-android}
|
|
2336
|
-
* @deprecated Use
|
|
2337
|
-
* `createBillingProgramReportingDetailsAndroid('external-offer')` instead.
|
|
2338
|
-
* Scheduled for removal in react-native-iap 16.0.0.
|
|
2339
|
-
*/
|
|
2340
|
-
export const createAlternativeBillingTokenAndroid = async sku => {
|
|
2341
|
-
if (Platform.OS !== 'android') {
|
|
2342
|
-
throw new Error('Alternative billing is only supported on Android');
|
|
2343
|
-
}
|
|
2344
|
-
try {
|
|
2345
|
-
return await IAP.instance.createAlternativeBillingTokenAndroid(sku ?? null);
|
|
2346
|
-
} catch (error) {
|
|
2347
|
-
RnIapConsole.error('Failed to create alternative billing token:', error);
|
|
2348
|
-
throw error;
|
|
2349
|
-
}
|
|
2033
|
+
throw new Error(`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`);
|
|
2350
2034
|
};
|
|
2351
2035
|
|
|
2352
2036
|
/**
|