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.
- 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 +1 -11
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +45 -379
- 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 +0 -76
- package/src/index.kepler.ts +11 -96
- package/src/index.ts +60 -457
- 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);
|
|
@@ -619,8 +611,7 @@ export const fetchProducts = async request => {
|
|
|
619
611
|
platform: item.platform
|
|
620
612
|
})));
|
|
621
613
|
|
|
622
|
-
//
|
|
623
|
-
// On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription
|
|
614
|
+
// The major schema uses the canonical `type` discriminator on every store.
|
|
624
615
|
const productItems = [];
|
|
625
616
|
const subscriptionItems = [];
|
|
626
617
|
converted.forEach(item => {
|
|
@@ -629,31 +620,7 @@ export const fetchProducts = async request => {
|
|
|
629
620
|
productItems.push(item);
|
|
630
621
|
return;
|
|
631
622
|
}
|
|
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
|
-
}
|
|
623
|
+
subscriptionItems.push(item);
|
|
657
624
|
});
|
|
658
625
|
RnIapConsole.debug('[fetchProducts] After filtering - products:', productItems.length, 'subs:', subscriptionItems.length);
|
|
659
626
|
return [...productItems, ...subscriptionItems];
|
|
@@ -736,7 +703,7 @@ export const getAvailablePurchases = async options => {
|
|
|
736
703
|
// For Android Play/Horizon/Fire OS, query in-app items and subscriptions separately.
|
|
737
704
|
const inappNitroPurchases = await IAP.instance.getAvailablePurchases({
|
|
738
705
|
android: {
|
|
739
|
-
type: '
|
|
706
|
+
type: 'in-app',
|
|
740
707
|
includeSuspended
|
|
741
708
|
}
|
|
742
709
|
});
|
|
@@ -775,7 +742,7 @@ export const getPromotedProductIOS = async () => {
|
|
|
775
742
|
return null;
|
|
776
743
|
}
|
|
777
744
|
try {
|
|
778
|
-
const nitroProduct =
|
|
745
|
+
const nitroProduct = await IAP.instance.getPromotedProductIOS();
|
|
779
746
|
if (!nitroProduct) {
|
|
780
747
|
return null;
|
|
781
748
|
}
|
|
@@ -792,46 +759,6 @@ export const getPromotedProductIOS = async () => {
|
|
|
792
759
|
}
|
|
793
760
|
};
|
|
794
761
|
|
|
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
762
|
/**
|
|
836
763
|
* Return the user's storefront country code.
|
|
837
764
|
*
|
|
@@ -844,17 +771,9 @@ export const getStorefront = async () => {
|
|
|
844
771
|
message: `Storefront lookup is not supported on ${Platform.OS}.`
|
|
845
772
|
});
|
|
846
773
|
}
|
|
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
774
|
let storefront;
|
|
856
775
|
try {
|
|
857
|
-
storefront =
|
|
776
|
+
storefront = await IAP.instance.getStorefront();
|
|
858
777
|
} catch (error) {
|
|
859
778
|
const parsedError = parseErrorAndLogIfNeeded(`[getStorefront] Failed to get storefront on ${Platform.OS}:`, error);
|
|
860
779
|
throw createPurchaseError({
|
|
@@ -966,7 +885,7 @@ export const currentEntitlementIOS = async sku => {
|
|
|
966
885
|
const nitroPurchase = await IAP.instance.currentEntitlementIOS(sku);
|
|
967
886
|
if (nitroPurchase) {
|
|
968
887
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
969
|
-
return converted.
|
|
888
|
+
return converted.store === 'apple' ? converted : null;
|
|
970
889
|
}
|
|
971
890
|
return null;
|
|
972
891
|
} catch (error) {
|
|
@@ -996,7 +915,7 @@ export const latestTransactionIOS = async sku => {
|
|
|
996
915
|
const nitroPurchase = await IAP.instance.latestTransactionIOS(sku);
|
|
997
916
|
if (nitroPurchase) {
|
|
998
917
|
const converted = convertNitroPurchaseToPurchase(nitroPurchase);
|
|
999
|
-
return converted.
|
|
918
|
+
return converted.store === 'apple' ? converted : null;
|
|
1000
919
|
}
|
|
1001
920
|
return null;
|
|
1002
921
|
} catch (error) {
|
|
@@ -1023,7 +942,7 @@ export const getPendingTransactionsIOS = async () => {
|
|
|
1023
942
|
}
|
|
1024
943
|
try {
|
|
1025
944
|
const nitroPurchases = await IAP.instance.getPendingTransactionsIOS();
|
|
1026
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
945
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1027
946
|
} catch (error) {
|
|
1028
947
|
const parsedError = parseErrorAndLogIfNeeded('[getPendingTransactionsIOS] Failed:', error);
|
|
1029
948
|
throw createPurchaseError({
|
|
@@ -1046,7 +965,7 @@ export const getAllTransactionsIOS = async () => {
|
|
|
1046
965
|
}
|
|
1047
966
|
try {
|
|
1048
967
|
const nitroPurchases = await IAP.instance.getAllTransactionsIOS();
|
|
1049
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
968
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1050
969
|
} catch (error) {
|
|
1051
970
|
const parsedError = parseErrorAndLogIfNeeded('[getAllTransactionsIOS] Failed:', error);
|
|
1052
971
|
throw createPurchaseError({
|
|
@@ -1071,7 +990,7 @@ export const showManageSubscriptionsIOS = async () => {
|
|
|
1071
990
|
}
|
|
1072
991
|
try {
|
|
1073
992
|
const nitroPurchases = await IAP.instance.showManageSubscriptionsIOS();
|
|
1074
|
-
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.
|
|
993
|
+
return nitroPurchases.map(convertNitroPurchaseToPurchase).filter(purchase => purchase.store === 'apple');
|
|
1075
994
|
} catch (error) {
|
|
1076
995
|
const parsedError = parseErrorAndLogIfNeeded('[showManageSubscriptionsIOS] Failed:', error);
|
|
1077
996
|
throw createPurchaseError({
|
|
@@ -1132,34 +1051,6 @@ export const getReceiptDataIOS = async () => {
|
|
|
1132
1051
|
});
|
|
1133
1052
|
}
|
|
1134
1053
|
};
|
|
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
1054
|
export const requestReceiptRefreshIOS = async () => {
|
|
1164
1055
|
if (Platform.OS !== 'ios') {
|
|
1165
1056
|
throw new Error('requestReceiptRefreshIOS is only available on iOS');
|
|
@@ -1361,8 +1252,8 @@ export const requestPurchase = async request => {
|
|
|
1361
1252
|
if (!perPlatformRequest) {
|
|
1362
1253
|
throw new Error('Missing purchase request configuration');
|
|
1363
1254
|
}
|
|
1364
|
-
const iosRequestSource = Platform.OS === 'ios' ?
|
|
1365
|
-
const androidRequestSource = isAndroidStoreRuntime() ?
|
|
1255
|
+
const iosRequestSource = Platform.OS === 'ios' ? perPlatformRequest.apple : undefined;
|
|
1256
|
+
const androidRequestSource = isAndroidStoreRuntime() ? perPlatformRequest.google : undefined;
|
|
1366
1257
|
if (Platform.OS === 'ios') {
|
|
1367
1258
|
if (!iosRequestSource?.sku) {
|
|
1368
1259
|
throw new Error('Invalid request for iOS. The `sku` property is required.');
|
|
@@ -1446,9 +1337,6 @@ export const requestPurchase = async request => {
|
|
|
1446
1337
|
if (subsRequest.originalExternalTransactionId) {
|
|
1447
1338
|
androidPayload.originalExternalTransactionId = subsRequest.originalExternalTransactionId;
|
|
1448
1339
|
}
|
|
1449
|
-
if (subsRequest.replacementMode != null) {
|
|
1450
|
-
androidPayload.replacementMode = subsRequest.replacementMode;
|
|
1451
|
-
}
|
|
1452
1340
|
if (subsRequest.subscriptionProductReplacementParams) {
|
|
1453
1341
|
androidPayload.subscriptionProductReplacementParams = subsRequest.subscriptionProductReplacementParams;
|
|
1454
1342
|
}
|
|
@@ -1648,8 +1536,7 @@ export const openRedeemOfferCodeAndroid = async () => {
|
|
|
1648
1536
|
// ============================================================================
|
|
1649
1537
|
|
|
1650
1538
|
/**
|
|
1651
|
-
*
|
|
1652
|
-
* @deprecated Use `verifyPurchase` instead. This function will be removed in react-native-iap 16.0.0.
|
|
1539
|
+
* Verify a purchase on iOS or Android.
|
|
1653
1540
|
* @param options - Platform-specific verification options
|
|
1654
1541
|
* @param options.apple - Apple App Store verification options (iOS)
|
|
1655
1542
|
* @param options.google - Google Play verification options (Android)
|
|
@@ -1673,7 +1560,7 @@ export const openRedeemOfferCodeAndroid = async () => {
|
|
|
1673
1560
|
*
|
|
1674
1561
|
* @see {@link https://openiap.dev/docs/apis/validate-receipt}
|
|
1675
1562
|
*/
|
|
1676
|
-
export const
|
|
1563
|
+
export const verifyPurchase = async options => {
|
|
1677
1564
|
const {
|
|
1678
1565
|
apple,
|
|
1679
1566
|
google,
|
|
@@ -1721,7 +1608,7 @@ export const validateReceipt = async options => {
|
|
|
1721
1608
|
accessToken: horizon.accessToken
|
|
1722
1609
|
} : null
|
|
1723
1610
|
};
|
|
1724
|
-
const nitroResult = await IAP.instance.
|
|
1611
|
+
const nitroResult = await IAP.instance.verifyPurchase(params);
|
|
1725
1612
|
|
|
1726
1613
|
// Convert Nitro result to public API result
|
|
1727
1614
|
if (Platform.OS === 'ios') {
|
|
@@ -1759,7 +1646,7 @@ export const validateReceipt = async options => {
|
|
|
1759
1646
|
return result;
|
|
1760
1647
|
}
|
|
1761
1648
|
} catch (error) {
|
|
1762
|
-
const parsedError = parseErrorAndLogIfNeeded('[
|
|
1649
|
+
const parsedError = parseErrorAndLogIfNeeded('[verifyPurchase] Failed:', error);
|
|
1763
1650
|
throw createPurchaseError({
|
|
1764
1651
|
code: parsedError.code,
|
|
1765
1652
|
message: parsedError.message,
|
|
@@ -1769,36 +1656,6 @@ export const validateReceipt = async options => {
|
|
|
1769
1656
|
}
|
|
1770
1657
|
};
|
|
1771
1658
|
|
|
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
1659
|
/**
|
|
1803
1660
|
* Verify purchase with a specific provider (e.g., IAPKit)
|
|
1804
1661
|
*
|
|
@@ -1894,18 +1751,25 @@ export const syncIOS = async () => {
|
|
|
1894
1751
|
|
|
1895
1752
|
/**
|
|
1896
1753
|
* Present the code redemption sheet for offer codes (iOS only)
|
|
1897
|
-
* @returns
|
|
1754
|
+
* @returns The verified redeemed purchase on iOS 27+, or null after the
|
|
1755
|
+
* legacy sheet is presented on earlier iOS versions.
|
|
1898
1756
|
* @platform iOS
|
|
1899
1757
|
*
|
|
1900
1758
|
* @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}
|
|
1901
1759
|
*/
|
|
1902
1760
|
export const presentCodeRedemptionSheetIOS = async () => {
|
|
1903
1761
|
if (Platform.OS !== 'ios') {
|
|
1904
|
-
return
|
|
1762
|
+
return null;
|
|
1905
1763
|
}
|
|
1906
1764
|
try {
|
|
1907
1765
|
const result = await IAP.instance.presentCodeRedemptionSheetIOS();
|
|
1908
|
-
|
|
1766
|
+
if (result == null) {
|
|
1767
|
+
return null;
|
|
1768
|
+
}
|
|
1769
|
+
if (!validateNitroPurchase(result)) {
|
|
1770
|
+
throw new Error('Invalid redeemed purchase returned by native StoreKit');
|
|
1771
|
+
}
|
|
1772
|
+
return convertNitroPurchaseToPurchase(result);
|
|
1909
1773
|
} catch (error) {
|
|
1910
1774
|
const parsedError = parseErrorAndLogIfNeeded('[presentCodeRedemptionSheetIOS] Failed:', error);
|
|
1911
1775
|
throw createPurchaseError({
|
|
@@ -1917,47 +1781,6 @@ export const presentCodeRedemptionSheetIOS = async () => {
|
|
|
1917
1781
|
}
|
|
1918
1782
|
};
|
|
1919
1783
|
|
|
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
1784
|
/**
|
|
1962
1785
|
* Clear unfinished transactions on iOS
|
|
1963
1786
|
* @returns Promise<boolean>
|
|
@@ -2087,12 +1910,14 @@ export const getActiveSubscriptions = async subscriptionIds => {
|
|
|
2087
1910
|
// iOS specific fields
|
|
2088
1911
|
expirationDateIOS: sub.expirationDateIOS ?? null,
|
|
2089
1912
|
environmentIOS: sub.environmentIOS ?? null,
|
|
2090
|
-
willExpireSoon: sub.willExpireSoon ?? null,
|
|
2091
1913
|
daysUntilExpirationIOS: sub.daysUntilExpirationIOS ?? null,
|
|
2092
1914
|
// renewalInfoIOS contains subscription lifecycle information on iOS.
|
|
2093
1915
|
renewalInfoIOS: sub.renewalInfoIOS ? {
|
|
2094
1916
|
willAutoRenew: sub.renewalInfoIOS.willAutoRenew ?? false,
|
|
2095
1917
|
autoRenewPreference: sub.renewalInfoIOS.autoRenewPreference ?? null,
|
|
1918
|
+
bundleOriginalTransactionId: sub.renewalInfoIOS.bundleOriginalTransactionId ?? null,
|
|
1919
|
+
bundleProductId: sub.renewalInfoIOS.bundleProductId ?? null,
|
|
1920
|
+
bundleSubscriptionGroupId: sub.renewalInfoIOS.bundleSubscriptionGroupId ?? null,
|
|
2096
1921
|
commitmentInfo: sub.renewalInfoIOS.commitmentInfo ?? null,
|
|
2097
1922
|
pendingUpgradeProductId: sub.renewalInfoIOS.pendingUpgradeProductId ?? null,
|
|
2098
1923
|
renewalDate: sub.renewalInfoIOS.renewalDate ?? null,
|
|
@@ -2103,7 +1928,8 @@ export const getActiveSubscriptions = async subscriptionIds => {
|
|
|
2103
1928
|
renewalBillingPlanType: sub.renewalInfoIOS.renewalBillingPlanType ?? null,
|
|
2104
1929
|
renewalOfferType: sub.renewalInfoIOS.renewalOfferType ?? null,
|
|
2105
1930
|
renewalOfferId: sub.renewalInfoIOS.renewalOfferId ?? null,
|
|
2106
|
-
jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null
|
|
1931
|
+
jsonRepresentation: sub.renewalInfoIOS.jsonRepresentation ?? null,
|
|
1932
|
+
willUnbundle: sub.renewalInfoIOS.willUnbundle ?? null
|
|
2107
1933
|
} : null,
|
|
2108
1934
|
// Android specific fields
|
|
2109
1935
|
autoRenewingAndroid: sub.autoRenewingAndroid ?? null,
|
|
@@ -2150,37 +1976,10 @@ export const hasActiveSubscriptions = async subscriptionIds => {
|
|
|
2150
1976
|
// Type conversion utilities
|
|
2151
1977
|
export { convertNitroProductToProduct, convertNitroPurchaseToPurchase, convertProductToProductSubscription, validateNitroProduct, validateNitroPurchase, checkTypeSynchronization } from "./utils/type-bridge.js";
|
|
2152
1978
|
|
|
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
1979
|
// ============================================================================
|
|
2167
1980
|
// Internal Helpers
|
|
2168
1981
|
// ============================================================================
|
|
2169
1982
|
|
|
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
1983
|
const toDiscountOfferRecordIOS = offer => {
|
|
2185
1984
|
if (!offer) {
|
|
2186
1985
|
return undefined;
|
|
@@ -2194,159 +1993,26 @@ const toDiscountOfferRecordIOS = offer => {
|
|
|
2194
1993
|
};
|
|
2195
1994
|
};
|
|
2196
1995
|
const toNitroProductType = type => {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
1996
|
+
switch (type) {
|
|
1997
|
+
case 'in-app':
|
|
1998
|
+
return 'in-app';
|
|
1999
|
+
case 'subs':
|
|
2000
|
+
return 'subs';
|
|
2001
|
+
case 'all':
|
|
2002
|
+
return 'all';
|
|
2003
|
+
default:
|
|
2004
|
+
throw new Error(`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`);
|
|
2206
2005
|
}
|
|
2207
|
-
return 'in-app';
|
|
2208
2006
|
};
|
|
2209
2007
|
const isSubscriptionQuery = type => type === 'subs';
|
|
2210
2008
|
const normalizeProductQueryType = type => {
|
|
2009
|
+
if (type == null) {
|
|
2010
|
+
return 'in-app';
|
|
2011
|
+
}
|
|
2211
2012
|
if (type === 'all' || type === 'subs' || type === 'in-app') {
|
|
2212
2013
|
return type;
|
|
2213
2014
|
}
|
|
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
|
-
}
|
|
2015
|
+
throw new Error(`Unsupported product type: ${String(type)}. Use in-app, subs, or all.`);
|
|
2350
2016
|
};
|
|
2351
2017
|
|
|
2352
2018
|
/**
|