react-native-iap 15.6.2 → 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
|
@@ -21,20 +21,23 @@ const ERROR_CODE_ALIASES: Record<string, ErrorCode> = {
|
|
|
21
21
|
USER_CANCELED: ErrorCode.UserCancelled,
|
|
22
22
|
E_USER_CANCELLED: ErrorCode.UserCancelled,
|
|
23
23
|
USER_CANCELLED: ErrorCode.UserCancelled,
|
|
24
|
-
// Deprecated error code mappings (map old Receipt* codes to new PurchaseVerification* codes)
|
|
25
|
-
// These ensure backwards compatibility while preferring new codes
|
|
26
24
|
RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,
|
|
27
25
|
E_RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,
|
|
28
26
|
RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,
|
|
29
27
|
E_RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,
|
|
30
28
|
RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,
|
|
31
29
|
E_RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,
|
|
32
|
-
// Also handle kebab-case versions
|
|
33
|
-
'receipt-failed': ErrorCode.PurchaseVerificationFailed,
|
|
34
|
-
'receipt-finished': ErrorCode.PurchaseVerificationFinished,
|
|
35
|
-
'receipt-finished-failed': ErrorCode.PurchaseVerificationFinishFailed,
|
|
36
30
|
};
|
|
37
31
|
|
|
32
|
+
const errorAlias = (code: string): ErrorCode | undefined =>
|
|
33
|
+
ERROR_CODE_ALIASES[
|
|
34
|
+
code
|
|
35
|
+
.trim()
|
|
36
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
37
|
+
.replace(/-/g, '_')
|
|
38
|
+
.toUpperCase()
|
|
39
|
+
];
|
|
40
|
+
|
|
38
41
|
const toKebabCase = (str: string): string => {
|
|
39
42
|
if (str.includes('_')) {
|
|
40
43
|
return str
|
|
@@ -87,9 +90,6 @@ const COMMON_ERROR_CODE_MAP: Record<ErrorCode, string> = {
|
|
|
87
90
|
[ErrorCode.RemoteError]: ErrorCode.RemoteError,
|
|
88
91
|
[ErrorCode.NetworkError]: ErrorCode.NetworkError,
|
|
89
92
|
[ErrorCode.ServiceError]: ErrorCode.ServiceError,
|
|
90
|
-
[ErrorCode.ReceiptFailed]: ErrorCode.ReceiptFailed,
|
|
91
|
-
[ErrorCode.ReceiptFinished]: ErrorCode.ReceiptFinished,
|
|
92
|
-
[ErrorCode.ReceiptFinishedFailed]: ErrorCode.ReceiptFinishedFailed,
|
|
93
93
|
[ErrorCode.NotPrepared]: ErrorCode.NotPrepared,
|
|
94
94
|
[ErrorCode.NotEnded]: ErrorCode.NotEnded,
|
|
95
95
|
[ErrorCode.AlreadyOwned]: ErrorCode.AlreadyOwned,
|
|
@@ -191,6 +191,11 @@ export const ErrorCodeUtils = {
|
|
|
191
191
|
_platform: IapPlatform,
|
|
192
192
|
): ErrorCode => {
|
|
193
193
|
if (typeof platformCode === 'string') {
|
|
194
|
+
const alias = errorAlias(platformCode);
|
|
195
|
+
if (alias) {
|
|
196
|
+
return alias;
|
|
197
|
+
}
|
|
198
|
+
|
|
194
199
|
// Handle direct ErrorCode enum values
|
|
195
200
|
if (OPENIAP_ERROR_CODE_SET.has(platformCode)) {
|
|
196
201
|
return platformCode as ErrorCode;
|
|
@@ -258,6 +263,11 @@ const normalizeErrorCode = (
|
|
|
258
263
|
return code as string;
|
|
259
264
|
}
|
|
260
265
|
|
|
266
|
+
const alias = errorAlias(code as string);
|
|
267
|
+
if (alias) {
|
|
268
|
+
return alias;
|
|
269
|
+
}
|
|
270
|
+
|
|
261
271
|
const camelCased = toKebabCase(code as string);
|
|
262
272
|
if (ERROR_CODES.has(camelCased)) {
|
|
263
273
|
return camelCased;
|
|
@@ -369,13 +379,10 @@ export function getUserFriendlyErrorMessage(error: ErrorLike): string {
|
|
|
369
379
|
return 'This feature is not supported on this device.';
|
|
370
380
|
case ErrorCode.TransactionValidationFailed:
|
|
371
381
|
return 'Transaction could not be verified';
|
|
372
|
-
case ErrorCode.ReceiptFailed:
|
|
373
382
|
case ErrorCode.PurchaseVerificationFailed:
|
|
374
383
|
return 'Purchase verification failed';
|
|
375
|
-
case ErrorCode.ReceiptFinished:
|
|
376
384
|
case ErrorCode.PurchaseVerificationFinished:
|
|
377
385
|
return 'Purchase verification completed';
|
|
378
|
-
case ErrorCode.ReceiptFinishedFailed:
|
|
379
386
|
case ErrorCode.PurchaseVerificationFinishFailed:
|
|
380
387
|
return 'Failed to complete purchase verification';
|
|
381
388
|
case ErrorCode.EmptySkuList:
|
|
@@ -402,18 +409,12 @@ export const normalizeErrorCodeFromNative = (code: unknown): ErrorCode => {
|
|
|
402
409
|
if (typeof code === 'string') {
|
|
403
410
|
const upper = code.toUpperCase();
|
|
404
411
|
|
|
405
|
-
// Check aliases first
|
|
406
|
-
const alias =
|
|
412
|
+
// Check platform spelling aliases first.
|
|
413
|
+
const alias = errorAlias(code);
|
|
407
414
|
if (alias) {
|
|
408
415
|
return alias;
|
|
409
416
|
}
|
|
410
417
|
|
|
411
|
-
// Also check lowercase alias for kebab-case codes
|
|
412
|
-
const lowerAlias = ERROR_CODE_ALIASES[code];
|
|
413
|
-
if (lowerAlias) {
|
|
414
|
-
return lowerAlias;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
418
|
// Handle various user cancelled formats
|
|
418
419
|
if (
|
|
419
420
|
upper === 'USER_CANCELLED' ||
|
package/src/utils/type-bridge.ts
CHANGED
|
@@ -100,6 +100,14 @@ function normalizeProductTypeIOS(value?: Nullable<string>): ProductTypeIOS {
|
|
|
100
100
|
case 'non_renewing_subscription':
|
|
101
101
|
case 'non-renewing-subscription':
|
|
102
102
|
return 'non-renewing-subscription';
|
|
103
|
+
case 'subscriptionbundle':
|
|
104
|
+
case 'subscription_bundle':
|
|
105
|
+
case 'subscription-bundle':
|
|
106
|
+
return 'subscription-bundle';
|
|
107
|
+
case 'subscriptionsuite':
|
|
108
|
+
case 'subscription_suite':
|
|
109
|
+
case 'subscription-suite':
|
|
110
|
+
return 'subscription-suite';
|
|
103
111
|
default:
|
|
104
112
|
if (value) {
|
|
105
113
|
RnIapConsole.warn(
|
|
@@ -198,6 +206,13 @@ function convertNitroRenewalInfoToRenewalInfoIOS(
|
|
|
198
206
|
): RenewalInfoIOS {
|
|
199
207
|
return {
|
|
200
208
|
autoRenewPreference: toNullableString(renewalInfo.autoRenewPreference),
|
|
209
|
+
bundleOriginalTransactionId: toNullableString(
|
|
210
|
+
renewalInfo.bundleOriginalTransactionId,
|
|
211
|
+
),
|
|
212
|
+
bundleProductId: toNullableString(renewalInfo.bundleProductId),
|
|
213
|
+
bundleSubscriptionGroupId: toNullableString(
|
|
214
|
+
renewalInfo.bundleSubscriptionGroupId,
|
|
215
|
+
),
|
|
201
216
|
commitmentInfo: renewalInfo.commitmentInfo ?? null,
|
|
202
217
|
expirationReason: toNullableString(renewalInfo.expirationReason),
|
|
203
218
|
gracePeriodExpirationDate: toNullableNumber(
|
|
@@ -214,32 +229,10 @@ function convertNitroRenewalInfoToRenewalInfoIOS(
|
|
|
214
229
|
renewalOfferId: toNullableString(renewalInfo.renewalOfferId),
|
|
215
230
|
renewalOfferType: toNullableString(renewalInfo.renewalOfferType),
|
|
216
231
|
willAutoRenew: renewalInfo.willAutoRenew ?? false,
|
|
232
|
+
willUnbundle: toNullableBoolean(renewalInfo.willUnbundle),
|
|
217
233
|
};
|
|
218
234
|
}
|
|
219
235
|
|
|
220
|
-
function parseSubscriptionOffers(value?: Nullable<string> | any[]) {
|
|
221
|
-
if (!value) return undefined;
|
|
222
|
-
|
|
223
|
-
// Keep pre-normalized native values intact.
|
|
224
|
-
if (Array.isArray(value)) {
|
|
225
|
-
return value;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Otherwise, try to parse it as JSON string
|
|
229
|
-
try {
|
|
230
|
-
const parsed = JSON.parse(value as string);
|
|
231
|
-
if (Array.isArray(parsed)) {
|
|
232
|
-
return parsed;
|
|
233
|
-
}
|
|
234
|
-
} catch (error) {
|
|
235
|
-
RnIapConsole.warn(
|
|
236
|
-
'Failed to parse subscriptionOfferDetailsAndroid:',
|
|
237
|
-
error,
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
return undefined;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
236
|
/**
|
|
244
237
|
* Convert NitroProduct (from native) to generated Product type
|
|
245
238
|
*/
|
|
@@ -298,17 +291,6 @@ export function convertNitroProductToProduct(
|
|
|
298
291
|
nitroProduct.subscriptionPeriodUnitIOS,
|
|
299
292
|
);
|
|
300
293
|
|
|
301
|
-
// Parse discountsIOS from JSON string if present
|
|
302
|
-
if (nitroProduct.discountsIOS) {
|
|
303
|
-
try {
|
|
304
|
-
iosProduct.discountsIOS = JSON.parse(nitroProduct.discountsIOS);
|
|
305
|
-
} catch {
|
|
306
|
-
iosProduct.discountsIOS = null;
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
iosProduct.discountsIOS = null;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
294
|
if (nitroProduct.pricingTermsIOS) {
|
|
313
295
|
try {
|
|
314
296
|
const parsed = JSON.parse(nitroProduct.pricingTermsIOS);
|
|
@@ -320,18 +302,17 @@ export function convertNitroProductToProduct(
|
|
|
320
302
|
iosProduct.pricingTermsIOS = null;
|
|
321
303
|
}
|
|
322
304
|
|
|
323
|
-
if (nitroProduct.
|
|
305
|
+
if (nitroProduct.bundledSubscriptionsIOS) {
|
|
324
306
|
try {
|
|
325
|
-
const parsed = JSON.parse(nitroProduct.
|
|
326
|
-
iosProduct.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
: null;
|
|
307
|
+
const parsed = JSON.parse(nitroProduct.bundledSubscriptionsIOS);
|
|
308
|
+
iosProduct.bundledSubscriptionsIOS = Array.isArray(parsed)
|
|
309
|
+
? parsed
|
|
310
|
+
: null;
|
|
330
311
|
} catch {
|
|
331
|
-
iosProduct.
|
|
312
|
+
iosProduct.bundledSubscriptionsIOS = null;
|
|
332
313
|
}
|
|
333
314
|
} else {
|
|
334
|
-
iosProduct.
|
|
315
|
+
iosProduct.bundledSubscriptionsIOS = null;
|
|
335
316
|
}
|
|
336
317
|
|
|
337
318
|
// Parse standardized subscriptionOffers (cross-platform, OpenIAP 1.3.10+)
|
|
@@ -347,28 +328,12 @@ export function convertNitroProductToProduct(
|
|
|
347
328
|
iosProduct.subscriptionOffers = null;
|
|
348
329
|
}
|
|
349
330
|
|
|
350
|
-
// Parse standardized discountOffers (cross-platform, OpenIAP 1.3.10+)
|
|
351
|
-
if (nitroProduct.discountOffers) {
|
|
352
|
-
try {
|
|
353
|
-
iosProduct.discountOffers = JSON.parse(nitroProduct.discountOffers);
|
|
354
|
-
} catch {
|
|
355
|
-
iosProduct.discountOffers = null;
|
|
356
|
-
}
|
|
357
|
-
} else {
|
|
358
|
-
iosProduct.discountOffers = null;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
331
|
return iosProduct as Product;
|
|
362
332
|
}
|
|
363
333
|
|
|
364
334
|
const androidProduct: any = {
|
|
365
335
|
...base,
|
|
366
336
|
nameAndroid: nitroProduct.nameAndroid ?? nitroProduct.title,
|
|
367
|
-
oneTimePurchaseOfferDetailsAndroid:
|
|
368
|
-
nitroProduct.oneTimePurchaseOfferDetailsAndroid ?? null,
|
|
369
|
-
subscriptionOfferDetailsAndroid: parseSubscriptionOffers(
|
|
370
|
-
nitroProduct.subscriptionOfferDetailsAndroid,
|
|
371
|
-
),
|
|
372
337
|
// Product status (Billing Library 8.0+, OpenIAP 1.3.14+)
|
|
373
338
|
productStatusAndroid: nitroProduct.productStatusAndroid ?? null,
|
|
374
339
|
};
|
|
@@ -386,8 +351,12 @@ export function convertNitroProductToProduct(
|
|
|
386
351
|
androidProduct.subscriptionOffers = null;
|
|
387
352
|
}
|
|
388
353
|
|
|
389
|
-
|
|
390
|
-
|
|
354
|
+
if (type === PRODUCT_TYPE_SUBS) {
|
|
355
|
+
// Ensure subscriptionOffers is always an array for subscriptions (non-nullable in ProductSubscriptionAndroid)
|
|
356
|
+
if (!Array.isArray(androidProduct.subscriptionOffers)) {
|
|
357
|
+
androidProduct.subscriptionOffers = [];
|
|
358
|
+
}
|
|
359
|
+
} else if (nitroProduct.discountOffers) {
|
|
391
360
|
try {
|
|
392
361
|
androidProduct.discountOffers = JSON.parse(nitroProduct.discountOffers);
|
|
393
362
|
} catch {
|
|
@@ -397,17 +366,6 @@ export function convertNitroProductToProduct(
|
|
|
397
366
|
androidProduct.discountOffers = null;
|
|
398
367
|
}
|
|
399
368
|
|
|
400
|
-
if (type === PRODUCT_TYPE_SUBS) {
|
|
401
|
-
// Ensure subscriptionOfferDetailsAndroid is always an array for subscriptions
|
|
402
|
-
if (!Array.isArray(androidProduct.subscriptionOfferDetailsAndroid)) {
|
|
403
|
-
androidProduct.subscriptionOfferDetailsAndroid = [];
|
|
404
|
-
}
|
|
405
|
-
// Ensure subscriptionOffers is always an array for subscriptions (non-nullable in ProductSubscriptionAndroid)
|
|
406
|
-
if (!Array.isArray(androidProduct.subscriptionOffers)) {
|
|
407
|
-
androidProduct.subscriptionOffers = [];
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
369
|
return androidProduct as Product;
|
|
412
370
|
}
|
|
413
371
|
|
|
@@ -424,15 +382,7 @@ export function convertProductToProductSubscription(
|
|
|
424
382
|
);
|
|
425
383
|
}
|
|
426
384
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (output.platform === PLATFORM_ANDROID) {
|
|
430
|
-
if (!Array.isArray(output.subscriptionOfferDetailsAndroid)) {
|
|
431
|
-
output.subscriptionOfferDetailsAndroid = [];
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
return output;
|
|
385
|
+
return {...(product as any)};
|
|
436
386
|
}
|
|
437
387
|
|
|
438
388
|
/**
|
|
@@ -441,8 +391,6 @@ export function convertProductToProductSubscription(
|
|
|
441
391
|
export function convertNitroPurchaseToPurchase(
|
|
442
392
|
nitroPurchase: NitroPurchase,
|
|
443
393
|
): Purchase {
|
|
444
|
-
const platform = normalizePlatform(nitroPurchase.platform);
|
|
445
|
-
|
|
446
394
|
let purchaseState = normalizePurchaseState(
|
|
447
395
|
nitroPurchase.purchaseState ?? nitroPurchase.purchaseStateAndroid,
|
|
448
396
|
);
|
|
@@ -457,24 +405,36 @@ export function convertNitroPurchaseToPurchase(
|
|
|
457
405
|
|
|
458
406
|
const store = normalizeStore(nitroPurchase.store);
|
|
459
407
|
|
|
460
|
-
if (
|
|
408
|
+
if (store === STORE_APPLE) {
|
|
409
|
+
const transactionId = toNullableString(nitroPurchase.transactionId);
|
|
410
|
+
if (transactionId == null) {
|
|
411
|
+
throw new Error('Apple purchase is missing transactionId');
|
|
412
|
+
}
|
|
413
|
+
|
|
461
414
|
const iosPurchase: PurchaseIOS = {
|
|
462
415
|
id: nitroPurchase.id,
|
|
463
416
|
productId: nitroPurchase.productId,
|
|
464
417
|
transactionDate: nitroPurchase.transactionDate ?? Date.now(),
|
|
465
418
|
purchaseToken: nitroPurchase.purchaseToken ?? null,
|
|
466
|
-
platform,
|
|
467
419
|
store,
|
|
468
420
|
quantity: nitroPurchase.quantity ?? 1,
|
|
469
421
|
purchaseState,
|
|
470
422
|
isAutoRenewing: Boolean(nitroPurchase.isAutoRenewing),
|
|
471
423
|
currentPlanId: toNullableString(nitroPurchase.currentPlanId),
|
|
472
424
|
ids: nitroPurchase.ids ?? null,
|
|
473
|
-
|
|
474
|
-
transactionId:
|
|
475
|
-
toNullableString(nitroPurchase.transactionId) ?? nitroPurchase.id,
|
|
425
|
+
transactionId,
|
|
476
426
|
advancedCommerceInfoIOS: nitroPurchase.advancedCommerceInfoIOS ?? null,
|
|
477
427
|
billingPlanTypeIOS: nitroPurchase.billingPlanTypeIOS ?? null,
|
|
428
|
+
bundleOriginalTransactionIdIOS: toNullableString(
|
|
429
|
+
nitroPurchase.bundleOriginalTransactionIdIOS,
|
|
430
|
+
),
|
|
431
|
+
bundleProductIdIOS: toNullableString(nitroPurchase.bundleProductIdIOS),
|
|
432
|
+
bundleSubscriptionGroupIdIOS: toNullableString(
|
|
433
|
+
nitroPurchase.bundleSubscriptionGroupIdIOS,
|
|
434
|
+
),
|
|
435
|
+
bundleTransactionIdIOS: toNullableString(
|
|
436
|
+
nitroPurchase.bundleTransactionIdIOS,
|
|
437
|
+
),
|
|
478
438
|
commitmentInfoIOS: nitroPurchase.commitmentInfoIOS ?? null,
|
|
479
439
|
quantityIOS: toNullableNumber(nitroPurchase.quantityIOS),
|
|
480
440
|
originalTransactionDateIOS: toNullableNumber(
|
|
@@ -483,6 +443,9 @@ export function convertNitroPurchaseToPurchase(
|
|
|
483
443
|
originalTransactionIdentifierIOS: toNullableString(
|
|
484
444
|
nitroPurchase.originalTransactionIdentifierIOS,
|
|
485
445
|
),
|
|
446
|
+
previousOriginalTransactionIdIOS: toNullableString(
|
|
447
|
+
nitroPurchase.previousOriginalTransactionIdIOS,
|
|
448
|
+
),
|
|
486
449
|
appAccountToken: toNullableString(nitroPurchase.appAccountToken),
|
|
487
450
|
appBundleIdIOS: toNullableString(nitroPurchase.appBundleIdIOS),
|
|
488
451
|
countryCodeIOS: toNullableString(nitroPurchase.countryCodeIOS),
|
|
@@ -507,6 +470,7 @@ export function convertNitroPurchaseToPurchase(
|
|
|
507
470
|
),
|
|
508
471
|
revocationDateIOS: toNullableNumber(nitroPurchase.revocationDateIOS),
|
|
509
472
|
revocationReasonIOS: toNullableString(nitroPurchase.revocationReasonIOS),
|
|
473
|
+
revocationTypeIOS: toNullableString(nitroPurchase.revocationTypeIOS),
|
|
510
474
|
storefrontCountryCodeIOS: toNullableString(
|
|
511
475
|
nitroPurchase.storefrontCountryCodeIOS,
|
|
512
476
|
),
|
|
@@ -546,7 +510,6 @@ export function convertNitroPurchaseToPurchase(
|
|
|
546
510
|
transactionDate: nitroPurchase.transactionDate ?? Date.now(),
|
|
547
511
|
purchaseToken:
|
|
548
512
|
nitroPurchase.purchaseToken ?? nitroPurchase.purchaseTokenAndroid ?? null,
|
|
549
|
-
platform,
|
|
550
513
|
store,
|
|
551
514
|
quantity: nitroPurchase.quantity ?? 1,
|
|
552
515
|
purchaseState,
|
|
@@ -629,7 +592,7 @@ export function validateNitroPurchase(nitroPurchase: NitroPurchase): boolean {
|
|
|
629
592
|
return false;
|
|
630
593
|
}
|
|
631
594
|
|
|
632
|
-
const required = ['id', 'productId', 'transactionDate', '
|
|
595
|
+
const required = ['id', 'productId', 'transactionDate', 'store'];
|
|
633
596
|
for (const field of required) {
|
|
634
597
|
if (
|
|
635
598
|
!(field in nitroPurchase) ||
|
|
@@ -660,7 +623,7 @@ export function checkTypeSynchronization(): {
|
|
|
660
623
|
id: 'test',
|
|
661
624
|
title: 'Test',
|
|
662
625
|
description: 'Test product',
|
|
663
|
-
type: '
|
|
626
|
+
type: 'in-app',
|
|
664
627
|
platform: PLATFORM_IOS,
|
|
665
628
|
displayPrice: '$1.00',
|
|
666
629
|
currency: 'USD',
|
package/src/utils.ts
CHANGED
|
@@ -32,6 +32,9 @@ export const parseAppTransactionPayload = (
|
|
|
32
32
|
const preorderDateRaw = raw.preorderDate;
|
|
33
33
|
const preorderDate =
|
|
34
34
|
preorderDateRaw == null ? null : Number(preorderDateRaw);
|
|
35
|
+
const revocationDateRaw = raw.revocationDate;
|
|
36
|
+
const revocationDate =
|
|
37
|
+
revocationDateRaw == null ? null : Number(revocationDateRaw);
|
|
35
38
|
|
|
36
39
|
return {
|
|
37
40
|
appId,
|
|
@@ -60,7 +63,12 @@ export const parseAppTransactionPayload = (
|
|
|
60
63
|
preorderDate != null && !Number.isNaN(preorderDate)
|
|
61
64
|
? preorderDate
|
|
62
65
|
: null,
|
|
66
|
+
revocationDate:
|
|
67
|
+
revocationDate != null && !Number.isNaN(revocationDate)
|
|
68
|
+
? revocationDate
|
|
69
|
+
: null,
|
|
63
70
|
signedDate,
|
|
71
|
+
storeType: typeof raw.storeType === 'string' ? raw.storeType : null,
|
|
64
72
|
};
|
|
65
73
|
} catch (error) {
|
|
66
74
|
RnIapConsole.warn(
|
package/src/vega-adapter.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type {
|
|
|
11
11
|
} from './specs/RnIap.nitro';
|
|
12
12
|
import {ErrorCode} from './types';
|
|
13
13
|
import type {SubResponseCodeAndroid} from './types';
|
|
14
|
-
import {selectCanonicalPlatformRequest} from './utils/platform-request';
|
|
15
14
|
|
|
16
15
|
type ResponseOperation =
|
|
17
16
|
| 'product-data'
|
|
@@ -643,20 +642,6 @@ function createPricingPhase(product: VegaProduct) {
|
|
|
643
642
|
};
|
|
644
643
|
}
|
|
645
644
|
|
|
646
|
-
function createSubscriptionOffer(product: VegaProduct) {
|
|
647
|
-
const pricingPhase = createPricingPhase(product);
|
|
648
|
-
const sku = product.sku ?? '';
|
|
649
|
-
return {
|
|
650
|
-
basePlanId: sku,
|
|
651
|
-
offerId: null,
|
|
652
|
-
offerTags: [],
|
|
653
|
-
offerToken: '',
|
|
654
|
-
pricingPhases: {
|
|
655
|
-
pricingPhaseList: [pricingPhase],
|
|
656
|
-
},
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
|
|
660
645
|
function createStandardizedSubscriptionOffer(product: VegaProduct) {
|
|
661
646
|
const pricingPhase = createPricingPhase(product);
|
|
662
647
|
const sku = product.sku ?? '';
|
|
@@ -680,8 +665,6 @@ function createStandardizedSubscriptionOffer(product: VegaProduct) {
|
|
|
680
665
|
function mapProduct(product: VegaProduct): NitroProduct {
|
|
681
666
|
const sku = product.sku ?? '';
|
|
682
667
|
const type = productTypeToOpenIap(getProductType(product));
|
|
683
|
-
const subscriptionOfferDetails =
|
|
684
|
-
type === 'subs' ? [createSubscriptionOffer(product)] : null;
|
|
685
668
|
const subscriptionOffers =
|
|
686
669
|
type === 'subs' ? [createStandardizedSubscriptionOffer(product)] : null;
|
|
687
670
|
|
|
@@ -699,9 +682,6 @@ function mapProduct(product: VegaProduct): NitroProduct {
|
|
|
699
682
|
nameAndroid: product.title ?? sku,
|
|
700
683
|
subscriptionPeriodAndroid: getSubscriptionPeriod(product) || null,
|
|
701
684
|
freeTrialPeriodAndroid: product.freeTrialPeriod ?? null,
|
|
702
|
-
subscriptionOfferDetailsAndroid: subscriptionOfferDetails
|
|
703
|
-
? stringifyJson(subscriptionOfferDetails)
|
|
704
|
-
: null,
|
|
705
685
|
subscriptionOffers: subscriptionOffers
|
|
706
686
|
? stringifyJson(subscriptionOffers)
|
|
707
687
|
: null,
|
|
@@ -730,7 +710,6 @@ function mapReceipt(
|
|
|
730
710
|
currentPlanId:
|
|
731
711
|
type === 'subs' ? (nonBlankString(receipt.termSku) ?? productId) : null,
|
|
732
712
|
ids: productId ? [productId] : [],
|
|
733
|
-
platform: 'android',
|
|
734
713
|
store: 'amazon',
|
|
735
714
|
quantity: 1,
|
|
736
715
|
purchaseState: isActive ? 'purchased' : 'unknown',
|
|
@@ -759,11 +738,7 @@ type VegaAndroidPurchaseRequest = NonNullable<VegaPurchaseRequest['google']>;
|
|
|
759
738
|
function selectGooglePurchaseRequest(
|
|
760
739
|
request: VegaPurchaseRequest,
|
|
761
740
|
): VegaAndroidPurchaseRequest | null | undefined {
|
|
762
|
-
return
|
|
763
|
-
request,
|
|
764
|
-
'google',
|
|
765
|
-
'android',
|
|
766
|
-
).value;
|
|
741
|
+
return request.google;
|
|
767
742
|
}
|
|
768
743
|
|
|
769
744
|
function getSkuFromRequest(
|
|
@@ -1062,7 +1037,7 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1062
1037
|
getCachedProductType(receipt, productTypesBySku),
|
|
1063
1038
|
);
|
|
1064
1039
|
if (requestedType === 'subs') return openIapType === 'subs';
|
|
1065
|
-
if (requestedType === '
|
|
1040
|
+
if (requestedType === 'in-app') return openIapType === 'in-app';
|
|
1066
1041
|
return true;
|
|
1067
1042
|
})
|
|
1068
1043
|
.map((receipt) =>
|
|
@@ -1268,7 +1243,7 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1268
1243
|
json.store !== 'amazon'
|
|
1269
1244
|
) {
|
|
1270
1245
|
throw createVegaError(
|
|
1271
|
-
ErrorCode.
|
|
1246
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1272
1247
|
`IAPKit returned malformed response (HTTP ${status}).`,
|
|
1273
1248
|
);
|
|
1274
1249
|
}
|
|
@@ -1276,7 +1251,7 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1276
1251
|
const productId = json.productId;
|
|
1277
1252
|
if (productId != null && typeof productId !== 'string') {
|
|
1278
1253
|
throw createVegaError(
|
|
1279
|
-
ErrorCode.
|
|
1254
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1280
1255
|
`IAPKit returned malformed response (HTTP ${status}).`,
|
|
1281
1256
|
);
|
|
1282
1257
|
}
|
|
@@ -1377,28 +1352,28 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1377
1352
|
|
|
1378
1353
|
if (!response.ok) {
|
|
1379
1354
|
throw createVegaError(
|
|
1380
|
-
ErrorCode.
|
|
1355
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1381
1356
|
extractIapkitErrorMessage(json) ?? `HTTP ${response.status}`,
|
|
1382
1357
|
);
|
|
1383
1358
|
}
|
|
1384
1359
|
|
|
1385
1360
|
if (json === null) {
|
|
1386
1361
|
throw createVegaError(
|
|
1387
|
-
ErrorCode.
|
|
1362
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1388
1363
|
`IAPKit returned non-JSON response (HTTP ${response.status}).`,
|
|
1389
1364
|
);
|
|
1390
1365
|
}
|
|
1391
1366
|
|
|
1392
1367
|
if (!isIapkitResultObject(json)) {
|
|
1393
1368
|
throw createVegaError(
|
|
1394
|
-
ErrorCode.
|
|
1369
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1395
1370
|
`IAPKit returned malformed response (HTTP ${response.status}).`,
|
|
1396
1371
|
);
|
|
1397
1372
|
}
|
|
1398
1373
|
|
|
1399
1374
|
if (hasIapkitErrors(json)) {
|
|
1400
1375
|
throw createVegaError(
|
|
1401
|
-
ErrorCode.
|
|
1376
|
+
ErrorCode.PurchaseVerificationFailed,
|
|
1402
1377
|
extractIapkitErrorMessage(json) ?? 'IAPKit verification failed.',
|
|
1403
1378
|
);
|
|
1404
1379
|
}
|
|
@@ -1586,16 +1561,10 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1586
1561
|
async getAppTransactionIOS(): Promise<null> {
|
|
1587
1562
|
return throwUnsupportedFeature('getAppTransactionIOS');
|
|
1588
1563
|
},
|
|
1589
|
-
async requestPromotedProductIOS(): Promise<null> {
|
|
1590
|
-
return throwUnsupportedFeature('requestPromotedProductIOS');
|
|
1591
|
-
},
|
|
1592
1564
|
async getPromotedProductIOS(): Promise<null> {
|
|
1593
1565
|
return throwUnsupportedFeature('getPromotedProductIOS');
|
|
1594
1566
|
},
|
|
1595
|
-
async
|
|
1596
|
-
return throwUnsupportedFeature('buyPromotedProductIOS');
|
|
1597
|
-
},
|
|
1598
|
-
async presentCodeRedemptionSheetIOS(): Promise<boolean> {
|
|
1567
|
+
async presentCodeRedemptionSheetIOS(): Promise<null> {
|
|
1599
1568
|
return throwUnsupportedFeature('presentCodeRedemptionSheetIOS');
|
|
1600
1569
|
},
|
|
1601
1570
|
async clearTransactionIOS(): Promise<void> {
|
|
@@ -1634,9 +1603,6 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1634
1603
|
async getReceiptDataIOS(): Promise<string> {
|
|
1635
1604
|
return throwUnsupportedFeature('getReceiptDataIOS');
|
|
1636
1605
|
},
|
|
1637
|
-
async getReceiptIOS(): Promise<string> {
|
|
1638
|
-
return throwUnsupportedFeature('getReceiptIOS');
|
|
1639
|
-
},
|
|
1640
1606
|
async requestReceiptRefreshIOS(): Promise<string> {
|
|
1641
1607
|
return throwUnsupportedFeature('requestReceiptRefreshIOS');
|
|
1642
1608
|
},
|
|
@@ -1646,32 +1612,18 @@ export function createVegaIapModule(service: VegaPurchasingService): RnIap {
|
|
|
1646
1612
|
async getTransactionJwsIOS(): Promise<null> {
|
|
1647
1613
|
return throwUnsupportedFeature('getTransactionJwsIOS');
|
|
1648
1614
|
},
|
|
1649
|
-
async
|
|
1650
|
-
return throwUnsupportedFeature('
|
|
1615
|
+
async verifyPurchase(): Promise<never> {
|
|
1616
|
+
return throwUnsupportedFeature('verifyPurchase');
|
|
1651
1617
|
},
|
|
1652
1618
|
async getStorefront(): Promise<string> {
|
|
1653
1619
|
return getStorefront();
|
|
1654
1620
|
},
|
|
1655
|
-
async getStorefrontIOS(): Promise<string> {
|
|
1656
|
-
return getStorefront();
|
|
1657
|
-
},
|
|
1658
1621
|
async verifyPurchaseWithProvider(params) {
|
|
1659
1622
|
return verifyWithIapkit(params);
|
|
1660
1623
|
},
|
|
1661
1624
|
async deepLinkToSubscriptionsAndroid(): Promise<void> {
|
|
1662
1625
|
return throwUnsupportedFeature('deepLinkToSubscriptionsAndroid');
|
|
1663
1626
|
},
|
|
1664
|
-
async checkAlternativeBillingAvailabilityAndroid(): Promise<boolean> {
|
|
1665
|
-
return throwUnsupportedFeature(
|
|
1666
|
-
'checkAlternativeBillingAvailabilityAndroid',
|
|
1667
|
-
);
|
|
1668
|
-
},
|
|
1669
|
-
async showAlternativeBillingDialogAndroid(): Promise<boolean> {
|
|
1670
|
-
return throwUnsupportedFeature('showAlternativeBillingDialogAndroid');
|
|
1671
|
-
},
|
|
1672
|
-
async createAlternativeBillingTokenAndroid(): Promise<null> {
|
|
1673
|
-
return throwUnsupportedFeature('createAlternativeBillingTokenAndroid');
|
|
1674
|
-
},
|
|
1675
1627
|
addUserChoiceBillingListenerAndroid(): void {},
|
|
1676
1628
|
removeUserChoiceBillingListenerAndroid(): void {},
|
|
1677
1629
|
addDeveloperProvidedBillingListenerAndroid(): void {},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { RnIapConsole } from "./debug.js";
|
|
4
|
-
const emittedLegacyWarnings = new Set();
|
|
5
|
-
export const warnLegacyOnce = (key, message) => {
|
|
6
|
-
if (emittedLegacyWarnings.has(key)) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
emittedLegacyWarnings.add(key);
|
|
10
|
-
RnIapConsole.warn(message);
|
|
11
|
-
};
|
|
12
|
-
export const resetLegacyWarningsForTesting = () => {
|
|
13
|
-
emittedLegacyWarnings.clear();
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=deprecation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RnIapConsole","emittedLegacyWarnings","Set","warnLegacyOnce","key","message","has","add","warn","resetLegacyWarningsForTesting","clear"],"sourceRoot":"../../../src","sources":["utils/deprecation.ts"],"mappings":";;AAAA,SAAQA,YAAY,QAAO,YAAS;AAEpC,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAAS,CAAC;AAE/C,OAAO,MAAMC,cAAc,GAAGA,CAACC,GAAW,EAAEC,OAAe,KAAW;EACpE,IAAIJ,qBAAqB,CAACK,GAAG,CAACF,GAAG,CAAC,EAAE;IAClC;EACF;EAEAH,qBAAqB,CAACM,GAAG,CAACH,GAAG,CAAC;EAC9BJ,YAAY,CAACQ,IAAI,CAACH,OAAO,CAAC;AAC5B,CAAC;AAED,OAAO,MAAMI,6BAA6B,GAAGA,CAAA,KAAY;EACvDR,qBAAqB,CAACS,KAAK,CAAC,CAAC;AAC/B,CAAC","ignoreList":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Selects a canonical platform request by key presence, not value.
|
|
5
|
-
*
|
|
6
|
-
* An explicitly supplied canonical `null` or `undefined` is authoritative and
|
|
7
|
-
* must not fall back to the deprecated alias.
|
|
8
|
-
*/
|
|
9
|
-
export const selectCanonicalPlatformRequest = (request, canonicalKey, legacyKey) => {
|
|
10
|
-
const record = request;
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(record, canonicalKey)) {
|
|
12
|
-
return {
|
|
13
|
-
usesLegacyKey: false,
|
|
14
|
-
value: record[canonicalKey]
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(record, legacyKey)) {
|
|
18
|
-
return {
|
|
19
|
-
usesLegacyKey: true,
|
|
20
|
-
value: record[legacyKey]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
usesLegacyKey: false,
|
|
25
|
-
value: undefined
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=platform-request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["selectCanonicalPlatformRequest","request","canonicalKey","legacyKey","record","Object","prototype","hasOwnProperty","call","usesLegacyKey","value","undefined"],"sourceRoot":"../../../src","sources":["utils/platform-request.ts"],"mappings":";;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,8BAA8B,GAAGA,CAC5CC,OAAe,EACfC,YAAyB,EACzBC,SAAsB,KACU;EAChC,MAAMC,MAAM,GAAGH,OAAoD;EAEnE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,MAAM,EAAEF,YAAY,CAAC,EAAE;IAC9D,OAAO;MACLO,aAAa,EAAE,KAAK;MACpBC,KAAK,EAAEN,MAAM,CAACF,YAAY;IAC5B,CAAC;EACH;EAEA,IAAIG,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,MAAM,EAAED,SAAS,CAAC,EAAE;IAC3D,OAAO;MACLM,aAAa,EAAE,IAAI;MACnBC,KAAK,EAAEN,MAAM,CAACD,SAAS;IACzB,CAAC;EACH;EAEA,OAAO;IACLM,aAAa,EAAE,KAAK;IACpBC,KAAK,EAAEC;EACT,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,KAAG,IAO7D,CAAC;AAEF,eAAO,MAAM,6BAA6B,QAAO,IAEhD,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PlatformRequestSelection<T> {
|
|
2
|
-
usesLegacyKey: boolean;
|
|
3
|
-
value: T | null | undefined;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Selects a canonical platform request by key presence, not value.
|
|
7
|
-
*
|
|
8
|
-
* An explicitly supplied canonical `null` or `undefined` is authoritative and
|
|
9
|
-
* must not fall back to the deprecated alias.
|
|
10
|
-
*/
|
|
11
|
-
export declare const selectCanonicalPlatformRequest: <T>(request: object, canonicalKey: PropertyKey, legacyKey: PropertyKey) => PlatformRequestSelection<T>;
|
|
12
|
-
//# sourceMappingURL=platform-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platform-request.d.ts","sourceRoot":"","sources":["../../../../src/utils/platform-request.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GAAI,CAAC,EAC9C,SAAS,MAAM,EACf,cAAc,WAAW,EACzB,WAAW,WAAW,KACrB,wBAAwB,CAAC,CAAC,CAqB5B,CAAC"}
|