react-native-iap 13.0.4 → 14.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroIap.podspec +33 -0
- package/README.md +163 -51
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +107 -138
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -13
- package/android/src/main/AndroidManifest.xml +1 -4
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +843 -0
- package/android/src/main/java/com/margelo/nitro/iap/NitroIapPackage.java +33 -0
- package/android/src/main/java/com/margelo/nitro/iap/Types.kt +173 -0
- package/ios/Bridge.h +8 -0
- package/ios/ErrorUtils.swift +153 -0
- package/ios/HybridRnIap.swift +1326 -0
- package/ios/ProductStore.swift +33 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/helpers/subscription.js +56 -0
- package/lib/module/helpers/subscription.js.map +1 -0
- package/lib/module/hooks/useIAP.js +175 -123
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +1015 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/specs/RnIap.nitro.js +4 -0
- package/lib/{commonjs/modules/common.js.map → module/specs/RnIap.nitro.js.map} +1 -1
- package/lib/module/types.js +187 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/error.js +80 -0
- package/lib/module/utils/error.js.map +1 -0
- package/lib/module/utils/type-bridge.js +202 -0
- package/lib/module/utils/type-bridge.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/plugin/src/withIAP.d.ts +2 -7
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/scripts/check-nitro-versions.d.ts +3 -0
- package/lib/typescript/scripts/check-nitro-versions.d.ts.map +1 -0
- package/lib/typescript/src/helpers/subscription.d.ts +14 -0
- package/lib/typescript/src/helpers/subscription.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useIAP.d.ts +42 -26
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +356 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +404 -0
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +544 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/error.d.ts +30 -0
- package/lib/typescript/src/utils/error.d.ts.map +1 -0
- package/lib/typescript/src/utils/type-bridge.d.ts +40 -0
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +80 -0
- package/nitrogen/generated/android/NitroIap+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +50 -0
- package/nitrogen/generated/android/NitroIapOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchaseResult.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +577 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +93 -0
- package/nitrogen/generated/android/c++/JNitroAndroidReceiptValidationOptions.hpp +66 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +54 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesIosOptions.hpp +65 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionAndroidParams.hpp +58 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionIosParams.hpp +53 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionParams.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +154 -0
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +122 -0
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +66 -0
- package/nitrogen/generated/android/c++/JNitroPurchaseResult.hpp +70 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +60 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +122 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +68 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +115 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseIos.hpp +84 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionOffer.hpp +57 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionRenewalInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionStatus.hpp +64 -0
- package/nitrogen/generated/android/c++/JVariant_Boolean_NitroPurchaseResult.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Boolean_NitroPurchaseResult.hpp +71 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroProduct.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchase.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchaseResult.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +198 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAndroidReceiptValidationOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesIosOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesOptions.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionAndroidParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionIosParams.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +104 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseResult.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultIOS.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseIos.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionOffer.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionRenewalInfo.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionStatus.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +42 -0
- package/nitrogen/generated/ios/NitroIap+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +152 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +1061 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +107 -0
- package/nitrogen/generated/ios/NitroIapAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroIapAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +355 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroProduct.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroPurchase.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroPurchaseResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroProduct_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroPurchase_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__vector_NitroSubscriptionStatus__.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_bool__NitroPurchaseResult_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroProduct_.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroPurchase_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +78 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +750 -0
- package/nitrogen/generated/ios/swift/NitroAndroidReceiptValidationOptions.swift +80 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +54 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesIosOptions.swift +116 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesOptions.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionAndroidParams.swift +58 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionIosParams.swift +35 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionParams.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +653 -0
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +453 -0
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroPurchaseResult.swift +117 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationResultAndroid.swift +258 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationResultIOS.swift +87 -0
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +225 -0
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseIos.swift +161 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionOffer.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionRenewalInfo.swift +152 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionStatus.swift +76 -0
- package/nitrogen/generated/ios/swift/Variant_Bool_NitroPurchaseResult.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.swift +18 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +50 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +125 -0
- package/nitrogen/generated/shared/c++/NitroAndroidReceiptValidationOptions.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +68 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesIosOptions.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesOptions.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionAndroidParams.hpp +72 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionIosParams.hpp +67 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionParams.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +168 -0
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +136 -0
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroPurchaseResult.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +74 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +136 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationResultIOS.hpp +82 -0
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +95 -0
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseIos.hpp +85 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionOffer.hpp +71 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionRenewalInfo.hpp +88 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionStatus.hpp +78 -0
- package/package.json +145 -104
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/build/withIAP.d.ts +2 -7
- package/plugin/build/withIAP.js +62 -51
- package/plugin/src/withIAP.ts +119 -0
- package/plugin/tsconfig.json +18 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/src/helpers/subscription.ts +65 -0
- package/src/hooks/useIAP.ts +361 -222
- package/src/index.ts +1194 -9
- package/src/specs/RnIap.nitro.ts +501 -0
- package/src/types.ts +680 -0
- package/src/utils/error.ts +97 -0
- package/src/utils/type-bridge.ts +209 -0
- package/LICENSE +0 -21
- package/RNIap.podspec +0 -36
- package/android/src/amazon/AndroidManifest.xml +0 -14
- package/android/src/amazon/java/com/dooboolab/rniap/EventSender.kt +0 -10
- package/android/src/amazon/java/com/dooboolab/rniap/PurchasingServiceProxy.kt +0 -29
- package/android/src/amazon/java/com/dooboolab/rniap/PurchasingServiceProxyAmazonImpl.kt +0 -31
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapActivityListener.kt +0 -55
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt +0 -325
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonModule.kt +0 -244
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapPackage.kt +0 -17
- package/android/src/amazon/java/com/dooboolab/rniap/modifysubscription/RNIapAmazonModifySubscriptionListener.kt +0 -88
- package/android/src/amazon/java/com/dooboolab/rniap/utils/Extensions.kt +0 -22
- package/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt +0 -62
- package/android/src/main/java/com/dooboolab/rniap/PromiseUtlis.kt +0 -43
- package/android/src/play/java/com/dooboolab/rniap/PlayUtils.kt +0 -114
- package/android/src/play/java/com/dooboolab/rniap/RNIapActivityListener.kt +0 -15
- package/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt +0 -911
- package/android/src/play/java/com/dooboolab/rniap/RNIapPackage.kt +0 -17
- package/android/src/testAmazon/java/com/dooboolab/rniap/RNIapAmazonModuleTest.kt +0 -170
- package/app.plugin.js +0 -1
- package/ios/IapSerializationUtils.swift +0 -290
- package/ios/IapTypes.swift +0 -56
- package/ios/IapUtils.swift +0 -40
- package/ios/LatestPromiseKeeper.swift +0 -52
- package/ios/RNIapIos-Bridging-Header.h +0 -2
- package/ios/RNIapIos.m +0 -69
- package/ios/RNIapIos.swift +0 -868
- package/ios/RNIapIos.xcodeproj/project.pbxproj +0 -289
- package/ios/RNIapIosSk2.m +0 -126
- package/ios/RNIapIosSk2.swift +0 -1413
- package/ios/ThreadSafe.swift +0 -18
- package/lib/commonjs/eventEmitter.js +0 -195
- package/lib/commonjs/eventEmitter.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -17
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useIAP.js +0 -203
- package/lib/commonjs/hooks/useIAP.js.map +0 -1
- package/lib/commonjs/hooks/withIAPContext.js +0 -95
- package/lib/commonjs/hooks/withIAPContext.js.map +0 -1
- package/lib/commonjs/iap.js +0 -836
- package/lib/commonjs/iap.js.map +0 -1
- package/lib/commonjs/index.js +0 -105
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/internal/enhancedFetch.js +0 -26
- package/lib/commonjs/internal/enhancedFetch.js.map +0 -1
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js +0 -50
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js.map +0 -1
- package/lib/commonjs/internal/index.js +0 -39
- package/lib/commonjs/internal/index.js.map +0 -1
- package/lib/commonjs/internal/platform.js +0 -119
- package/lib/commonjs/internal/platform.js.map +0 -1
- package/lib/commonjs/modules/amazon.js +0 -50
- package/lib/commonjs/modules/amazon.js.map +0 -1
- package/lib/commonjs/modules/android.js +0 -92
- package/lib/commonjs/modules/android.js.map +0 -1
- package/lib/commonjs/modules/common.js +0 -2
- package/lib/commonjs/modules/index.js +0 -50
- package/lib/commonjs/modules/index.js.map +0 -1
- package/lib/commonjs/modules/ios.js +0 -160
- package/lib/commonjs/modules/ios.js.map +0 -1
- package/lib/commonjs/modules/iosSk2.js +0 -113
- package/lib/commonjs/modules/iosSk2.js.map +0 -1
- package/lib/commonjs/purchaseError.js +0 -170
- package/lib/commonjs/purchaseError.js.map +0 -1
- package/lib/commonjs/types/amazon.js +0 -2
- package/lib/commonjs/types/amazon.js.map +0 -1
- package/lib/commonjs/types/android.js +0 -67
- package/lib/commonjs/types/android.js.map +0 -1
- package/lib/commonjs/types/apple.js +0 -24
- package/lib/commonjs/types/apple.js.map +0 -1
- package/lib/commonjs/types/appleSk2.js +0 -137
- package/lib/commonjs/types/appleSk2.js.map +0 -1
- package/lib/commonjs/types/index.js +0 -67
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/utils/errorMapping.js +0 -83
- package/lib/commonjs/utils/errorMapping.js.map +0 -1
- package/lib/commonjs/utils/typeGuards.js +0 -74
- package/lib/commonjs/utils/typeGuards.js.map +0 -1
- package/lib/module/eventEmitter.js +0 -185
- package/lib/module/eventEmitter.js.map +0 -1
- package/lib/module/hooks/index.js +0 -2
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/withIAPContext.js +0 -86
- package/lib/module/hooks/withIAPContext.js.map +0 -1
- package/lib/module/iap.js +0 -805
- package/lib/module/iap.js.map +0 -1
- package/lib/module/internal/enhancedFetch.js +0 -19
- package/lib/module/internal/enhancedFetch.js.map +0 -1
- package/lib/module/internal/fillProductsWithAdditionalData.js +0 -43
- package/lib/module/internal/fillProductsWithAdditionalData.js.map +0 -1
- package/lib/module/internal/index.js +0 -4
- package/lib/module/internal/index.js.map +0 -1
- package/lib/module/internal/platform.js +0 -102
- package/lib/module/internal/platform.js.map +0 -1
- package/lib/module/modules/amazon.js +0 -42
- package/lib/module/modules/amazon.js.map +0 -1
- package/lib/module/modules/android.js +0 -81
- package/lib/module/modules/android.js.map +0 -1
- package/lib/module/modules/common.js +0 -2
- package/lib/module/modules/common.js.map +0 -1
- package/lib/module/modules/index.js +0 -5
- package/lib/module/modules/index.js.map +0 -1
- package/lib/module/modules/ios.js +0 -145
- package/lib/module/modules/ios.js.map +0 -1
- package/lib/module/modules/iosSk2.js +0 -96
- package/lib/module/modules/iosSk2.js.map +0 -1
- package/lib/module/purchaseError.js +0 -164
- package/lib/module/purchaseError.js.map +0 -1
- package/lib/module/types/amazon.js +0 -2
- package/lib/module/types/amazon.js.map +0 -1
- package/lib/module/types/android.js +0 -63
- package/lib/module/types/android.js.map +0 -1
- package/lib/module/types/apple.js +0 -17
- package/lib/module/types/apple.js.map +0 -1
- package/lib/module/types/appleSk2.js +0 -129
- package/lib/module/types/appleSk2.js.map +0 -1
- package/lib/module/types/index.js +0 -75
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/utils/errorMapping.js +0 -75
- package/lib/module/utils/errorMapping.js.map +0 -1
- package/lib/module/utils/typeGuards.js +0 -61
- package/lib/module/utils/typeGuards.js.map +0 -1
- package/lib/typescript/src/eventEmitter.d.ts +0 -151
- package/lib/typescript/src/eventEmitter.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -2
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/withIAPContext.d.ts +0 -27
- package/lib/typescript/src/hooks/withIAPContext.d.ts.map +0 -1
- package/lib/typescript/src/iap.d.ts +0 -503
- package/lib/typescript/src/iap.d.ts.map +0 -1
- package/lib/typescript/src/internal/enhancedFetch.d.ts +0 -6
- package/lib/typescript/src/internal/enhancedFetch.d.ts.map +0 -1
- package/lib/typescript/src/internal/fillProductsWithAdditionalData.d.ts +0 -7
- package/lib/typescript/src/internal/fillProductsWithAdditionalData.d.ts.map +0 -1
- package/lib/typescript/src/internal/index.d.ts +0 -4
- package/lib/typescript/src/internal/index.d.ts.map +0 -1
- package/lib/typescript/src/internal/platform.d.ts +0 -27
- package/lib/typescript/src/internal/platform.d.ts.map +0 -1
- package/lib/typescript/src/modules/amazon.d.ts +0 -55
- package/lib/typescript/src/modules/amazon.d.ts.map +0 -1
- package/lib/typescript/src/modules/android.d.ts +0 -74
- package/lib/typescript/src/modules/android.d.ts.map +0 -1
- package/lib/typescript/src/modules/common.d.ts +0 -14
- package/lib/typescript/src/modules/common.d.ts.map +0 -1
- package/lib/typescript/src/modules/index.d.ts +0 -5
- package/lib/typescript/src/modules/index.d.ts.map +0 -1
- package/lib/typescript/src/modules/ios.d.ts +0 -117
- package/lib/typescript/src/modules/ios.d.ts.map +0 -1
- package/lib/typescript/src/modules/iosSk2.d.ts +0 -140
- package/lib/typescript/src/modules/iosSk2.d.ts.map +0 -1
- package/lib/typescript/src/purchaseError.d.ts +0 -133
- package/lib/typescript/src/purchaseError.d.ts.map +0 -1
- package/lib/typescript/src/types/amazon.d.ts +0 -33
- package/lib/typescript/src/types/amazon.d.ts.map +0 -1
- package/lib/typescript/src/types/android.d.ts +0 -66
- package/lib/typescript/src/types/android.d.ts.map +0 -1
- package/lib/typescript/src/types/apple.d.ts +0 -27
- package/lib/typescript/src/types/apple.d.ts.map +0 -1
- package/lib/typescript/src/types/appleSk2.d.ts +0 -129
- package/lib/typescript/src/types/appleSk2.d.ts.map +0 -1
- package/lib/typescript/src/types/index.d.ts +0 -302
- package/lib/typescript/src/types/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/errorMapping.d.ts +0 -29
- package/lib/typescript/src/utils/errorMapping.d.ts.map +0 -1
- package/lib/typescript/src/utils/typeGuards.d.ts +0 -53
- package/lib/typescript/src/utils/typeGuards.d.ts.map +0 -1
- package/src/eventEmitter.ts +0 -212
- package/src/hooks/index.ts +0 -1
- package/src/hooks/withIAPContext.tsx +0 -179
- package/src/iap.ts +0 -1046
- package/src/internal/enhancedFetch.ts +0 -25
- package/src/internal/fillProductsWithAdditionalData.ts +0 -47
- package/src/internal/index.ts +0 -3
- package/src/internal/platform.ts +0 -135
- package/src/modules/amazon.ts +0 -94
- package/src/modules/android.ts +0 -179
- package/src/modules/common.ts +0 -16
- package/src/modules/index.ts +0 -4
- package/src/modules/ios.ts +0 -229
- package/src/modules/iosSk2.ts +0 -194
- package/src/purchaseError.ts +0 -196
- package/src/types/amazon.ts +0 -40
- package/src/types/android.ts +0 -89
- package/src/types/apple.ts +0 -44
- package/src/types/appleSk2.ts +0 -275
- package/src/types/index.ts +0 -379
- package/src/utils/errorMapping.ts +0 -88
- package/src/utils/typeGuards.ts +0 -90
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
export type ChangeEventPayload = {
|
|
2
|
+
value: string;
|
|
3
|
+
};
|
|
4
|
+
export type ProductType = 'inapp' | 'subs';
|
|
5
|
+
/**
|
|
6
|
+
* Base product information shared across all platforms
|
|
7
|
+
*/
|
|
8
|
+
export type ProductCommon = {
|
|
9
|
+
/** Product identifier (SKU) */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Product title displayed to users */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Product description */
|
|
14
|
+
description: string;
|
|
15
|
+
/** Product type: 'inapp' for one-time purchases (consumable/non-consumable), 'subs' for subscriptions */
|
|
16
|
+
type: ProductType;
|
|
17
|
+
/** Display name for the product */
|
|
18
|
+
displayName?: string;
|
|
19
|
+
/** Formatted price string for display (e.g., "$9.99") */
|
|
20
|
+
displayPrice: string;
|
|
21
|
+
/** Currency code (e.g., "USD", "EUR") */
|
|
22
|
+
currency: string;
|
|
23
|
+
/** Raw price value as number */
|
|
24
|
+
price?: number;
|
|
25
|
+
/** Debug description for development */
|
|
26
|
+
debugDescription?: string;
|
|
27
|
+
/** Platform identifier ('ios' or 'android') */
|
|
28
|
+
platform?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Base purchase information shared across all platforms
|
|
32
|
+
* Represents both consumables, non-consumables, and subscriptions
|
|
33
|
+
*/
|
|
34
|
+
export type PurchaseCommon = {
|
|
35
|
+
/** Transaction identifier - used by finishTransaction */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Product identifier - which product was purchased */
|
|
38
|
+
productId: string;
|
|
39
|
+
/** Product identifiers for purchases that include multiple products */
|
|
40
|
+
ids?: string[];
|
|
41
|
+
/** @deprecated - use id instead */
|
|
42
|
+
transactionId?: string;
|
|
43
|
+
/** Transaction timestamp in milliseconds */
|
|
44
|
+
transactionDate: number;
|
|
45
|
+
/** Transaction receipt for validation */
|
|
46
|
+
transactionReceipt: string;
|
|
47
|
+
/** Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android) */
|
|
48
|
+
purchaseToken?: string;
|
|
49
|
+
/** Platform identifier ('ios' or 'android') */
|
|
50
|
+
platform?: string;
|
|
51
|
+
};
|
|
52
|
+
export type ProductSubscriptionCommon = ProductCommon & {
|
|
53
|
+
type: 'subs';
|
|
54
|
+
};
|
|
55
|
+
export type IosPlatform = {
|
|
56
|
+
platform: 'ios';
|
|
57
|
+
};
|
|
58
|
+
export type AndroidPlatform = {
|
|
59
|
+
platform: 'android';
|
|
60
|
+
};
|
|
61
|
+
type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';
|
|
62
|
+
type PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
63
|
+
type SubscriptionOffer = {
|
|
64
|
+
displayPrice: string;
|
|
65
|
+
id: string;
|
|
66
|
+
paymentMode: PaymentMode;
|
|
67
|
+
period: {
|
|
68
|
+
unit: SubscriptionIosPeriod;
|
|
69
|
+
value: number;
|
|
70
|
+
};
|
|
71
|
+
periodCount: number;
|
|
72
|
+
price: number;
|
|
73
|
+
type: 'introductory' | 'promotional';
|
|
74
|
+
};
|
|
75
|
+
type SubscriptionInfo = {
|
|
76
|
+
introductoryOffer?: SubscriptionOffer;
|
|
77
|
+
promotionalOffers?: SubscriptionOffer[];
|
|
78
|
+
subscriptionGroupId: string;
|
|
79
|
+
subscriptionPeriod: {
|
|
80
|
+
unit: SubscriptionIosPeriod;
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export type Discount = {
|
|
85
|
+
identifier: string;
|
|
86
|
+
type: string;
|
|
87
|
+
numberOfPeriods: string;
|
|
88
|
+
price: string;
|
|
89
|
+
localizedPrice: string;
|
|
90
|
+
paymentMode: PaymentMode;
|
|
91
|
+
subscriptionPeriod: string;
|
|
92
|
+
};
|
|
93
|
+
export type ProductIOS = ProductCommon & {
|
|
94
|
+
displayNameIOS: string;
|
|
95
|
+
isFamilyShareableIOS: boolean;
|
|
96
|
+
jsonRepresentationIOS: string;
|
|
97
|
+
platform: 'ios';
|
|
98
|
+
subscriptionInfoIOS?: SubscriptionInfo;
|
|
99
|
+
displayName?: string;
|
|
100
|
+
isFamilyShareable?: boolean;
|
|
101
|
+
jsonRepresentation?: string;
|
|
102
|
+
subscription?: SubscriptionInfo;
|
|
103
|
+
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
104
|
+
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
105
|
+
};
|
|
106
|
+
export type ProductSubscriptionIOS = ProductIOS & {
|
|
107
|
+
discountsIOS?: Discount[];
|
|
108
|
+
introductoryPriceIOS?: string;
|
|
109
|
+
introductoryPriceAsAmountIOS?: string;
|
|
110
|
+
introductoryPricePaymentModeIOS?: PaymentMode;
|
|
111
|
+
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
112
|
+
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
113
|
+
platform: 'ios';
|
|
114
|
+
subscriptionPeriodNumberIOS?: string;
|
|
115
|
+
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;
|
|
116
|
+
discounts?: Discount[];
|
|
117
|
+
introductoryPrice?: string;
|
|
118
|
+
};
|
|
119
|
+
export type PurchaseIOS = PurchaseCommon & {
|
|
120
|
+
platform: 'ios';
|
|
121
|
+
quantityIOS?: number;
|
|
122
|
+
originalTransactionDateIOS?: number;
|
|
123
|
+
originalTransactionIdentifierIOS?: string;
|
|
124
|
+
appAccountToken?: string;
|
|
125
|
+
expirationDateIOS?: number;
|
|
126
|
+
webOrderLineItemIdIOS?: number;
|
|
127
|
+
environmentIOS?: string;
|
|
128
|
+
storefrontCountryCodeIOS?: string;
|
|
129
|
+
appBundleIdIOS?: string;
|
|
130
|
+
productTypeIOS?: string;
|
|
131
|
+
subscriptionGroupIdIOS?: string;
|
|
132
|
+
isUpgradedIOS?: boolean;
|
|
133
|
+
ownershipTypeIOS?: string;
|
|
134
|
+
reasonIOS?: string;
|
|
135
|
+
reasonStringRepresentationIOS?: string;
|
|
136
|
+
transactionReasonIOS?: 'PURCHASE' | 'RENEWAL' | string;
|
|
137
|
+
revocationDateIOS?: number;
|
|
138
|
+
revocationReasonIOS?: string;
|
|
139
|
+
offerIOS?: {
|
|
140
|
+
id: string;
|
|
141
|
+
type: string;
|
|
142
|
+
paymentMode: string;
|
|
143
|
+
};
|
|
144
|
+
currencyCodeIOS?: string;
|
|
145
|
+
currencySymbolIOS?: string;
|
|
146
|
+
countryCodeIOS?: string;
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
149
|
+
* iOS 15+ JWS representation is now available through the `purchaseToken` field.
|
|
150
|
+
*/
|
|
151
|
+
jwsRepresentationIOS?: string;
|
|
152
|
+
};
|
|
153
|
+
type ProductAndroidOneTimePurchaseOfferDetail = {
|
|
154
|
+
priceCurrencyCode: string;
|
|
155
|
+
formattedPrice: string;
|
|
156
|
+
priceAmountMicros: string;
|
|
157
|
+
};
|
|
158
|
+
type PricingPhaseAndroid = {
|
|
159
|
+
formattedPrice: string;
|
|
160
|
+
priceCurrencyCode: string;
|
|
161
|
+
billingPeriod: string;
|
|
162
|
+
billingCycleCount: number;
|
|
163
|
+
priceAmountMicros: string;
|
|
164
|
+
recurrenceMode: number;
|
|
165
|
+
};
|
|
166
|
+
type PricingPhasesAndroid = {
|
|
167
|
+
pricingPhaseList: PricingPhaseAndroid[];
|
|
168
|
+
};
|
|
169
|
+
type ProductSubscriptionAndroidOfferDetail = {
|
|
170
|
+
basePlanId: string;
|
|
171
|
+
offerId: string;
|
|
172
|
+
offerToken: string;
|
|
173
|
+
offerTags: string[];
|
|
174
|
+
pricingPhases: PricingPhasesAndroid;
|
|
175
|
+
};
|
|
176
|
+
type ProductSubscriptionAndroidOfferDetails = {
|
|
177
|
+
basePlanId: string;
|
|
178
|
+
offerId: string | null;
|
|
179
|
+
offerToken: string;
|
|
180
|
+
pricingPhases: PricingPhasesAndroid;
|
|
181
|
+
offerTags: string[];
|
|
182
|
+
};
|
|
183
|
+
export type ProductAndroid = ProductCommon & {
|
|
184
|
+
nameAndroid: string;
|
|
185
|
+
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
186
|
+
platform: 'android';
|
|
187
|
+
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[];
|
|
188
|
+
name?: string;
|
|
189
|
+
oneTimePurchaseOfferDetails?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
190
|
+
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetail[];
|
|
191
|
+
};
|
|
192
|
+
export type ProductSubscriptionAndroid = ProductAndroid & {
|
|
193
|
+
subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
|
|
194
|
+
subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetails[];
|
|
195
|
+
};
|
|
196
|
+
export declare enum PurchaseAndroidState {
|
|
197
|
+
UNSPECIFIED_STATE = 0,
|
|
198
|
+
PURCHASED = 1,
|
|
199
|
+
PENDING = 2
|
|
200
|
+
}
|
|
201
|
+
export type PurchaseAndroid = PurchaseCommon & {
|
|
202
|
+
platform: 'android';
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
205
|
+
*/
|
|
206
|
+
purchaseTokenAndroid?: string;
|
|
207
|
+
dataAndroid?: string;
|
|
208
|
+
signatureAndroid?: string;
|
|
209
|
+
autoRenewingAndroid?: boolean;
|
|
210
|
+
purchaseStateAndroid?: PurchaseAndroidState;
|
|
211
|
+
isAcknowledgedAndroid?: boolean;
|
|
212
|
+
packageNameAndroid?: string;
|
|
213
|
+
developerPayloadAndroid?: string;
|
|
214
|
+
obfuscatedAccountIdAndroid?: string;
|
|
215
|
+
obfuscatedProfileIdAndroid?: string;
|
|
216
|
+
};
|
|
217
|
+
export type ProductPurchaseIOS = PurchaseIOS;
|
|
218
|
+
export type ProductPurchaseAndroid = PurchaseAndroid;
|
|
219
|
+
export type SubscriptionProductIOS = ProductSubscriptionIOS;
|
|
220
|
+
export type SubscriptionProductAndroid = ProductSubscriptionAndroid;
|
|
221
|
+
export type Product = (ProductAndroid & AndroidPlatform) | (ProductIOS & IosPlatform);
|
|
222
|
+
export type SubscriptionProduct = (ProductSubscriptionAndroid & AndroidPlatform) | (ProductSubscriptionIOS & IosPlatform);
|
|
223
|
+
/**
|
|
224
|
+
* Regular product purchase (consumable or non-consumable)
|
|
225
|
+
* Both types appear in getAvailablePurchases until finishTransaction is called
|
|
226
|
+
*/
|
|
227
|
+
export type ProductPurchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
|
|
228
|
+
/**
|
|
229
|
+
* Active subscription purchase
|
|
230
|
+
* Appears in getAvailablePurchases while subscription is active
|
|
231
|
+
*/
|
|
232
|
+
export type SubscriptionPurchase = (PurchaseAndroid & AndroidPlatform & {
|
|
233
|
+
autoRenewingAndroid: boolean;
|
|
234
|
+
}) | (PurchaseIOS & IosPlatform);
|
|
235
|
+
/**
|
|
236
|
+
* Combined purchase type that includes all purchase types
|
|
237
|
+
* Used as return type for getAvailablePurchases
|
|
238
|
+
*/
|
|
239
|
+
export type Purchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
|
|
240
|
+
export interface RequestPurchaseIosProps {
|
|
241
|
+
readonly sku: string;
|
|
242
|
+
readonly andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
243
|
+
readonly appAccountToken?: string;
|
|
244
|
+
readonly quantity?: number;
|
|
245
|
+
readonly withOffer?: PaymentDiscount;
|
|
246
|
+
}
|
|
247
|
+
export interface RequestPurchaseAndroidProps {
|
|
248
|
+
readonly skus: string[];
|
|
249
|
+
readonly obfuscatedAccountIdAndroid?: string;
|
|
250
|
+
readonly obfuscatedProfileIdAndroid?: string;
|
|
251
|
+
readonly isOfferPersonalized?: boolean;
|
|
252
|
+
}
|
|
253
|
+
export interface RequestSubscriptionAndroidProps extends RequestPurchaseAndroidProps {
|
|
254
|
+
readonly purchaseTokenAndroid?: string;
|
|
255
|
+
readonly replacementModeAndroid?: number;
|
|
256
|
+
readonly subscriptionOffers: {
|
|
257
|
+
sku: string;
|
|
258
|
+
offerToken: string;
|
|
259
|
+
}[];
|
|
260
|
+
}
|
|
261
|
+
export interface RequestPurchasePropsByPlatforms {
|
|
262
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
263
|
+
readonly android?: RequestPurchaseAndroidProps;
|
|
264
|
+
}
|
|
265
|
+
export interface RequestSubscriptionPropsByPlatforms {
|
|
266
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
267
|
+
readonly android?: RequestSubscriptionAndroidProps;
|
|
268
|
+
}
|
|
269
|
+
export type RequestPurchaseProps = RequestPurchasePropsByPlatforms;
|
|
270
|
+
export type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;
|
|
271
|
+
export declare enum ErrorCode {
|
|
272
|
+
E_UNKNOWN = "E_UNKNOWN",
|
|
273
|
+
E_USER_CANCELLED = "E_USER_CANCELLED",
|
|
274
|
+
E_USER_ERROR = "E_USER_ERROR",
|
|
275
|
+
E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE",
|
|
276
|
+
E_REMOTE_ERROR = "E_REMOTE_ERROR",
|
|
277
|
+
E_NETWORK_ERROR = "E_NETWORK_ERROR",
|
|
278
|
+
E_SERVICE_ERROR = "E_SERVICE_ERROR",
|
|
279
|
+
E_RECEIPT_FAILED = "E_RECEIPT_FAILED",
|
|
280
|
+
E_RECEIPT_FINISHED_FAILED = "E_RECEIPT_FINISHED_FAILED",
|
|
281
|
+
E_NOT_PREPARED = "E_NOT_PREPARED",
|
|
282
|
+
E_NOT_ENDED = "E_NOT_ENDED",
|
|
283
|
+
E_ALREADY_OWNED = "E_ALREADY_OWNED",
|
|
284
|
+
E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR",
|
|
285
|
+
E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR",
|
|
286
|
+
E_DEFERRED_PAYMENT = "E_DEFERRED_PAYMENT",
|
|
287
|
+
E_INTERRUPTED = "E_INTERRUPTED",
|
|
288
|
+
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE",
|
|
289
|
+
E_PURCHASE_ERROR = "E_PURCHASE_ERROR",
|
|
290
|
+
E_SYNC_ERROR = "E_SYNC_ERROR",
|
|
291
|
+
E_TRANSACTION_VALIDATION_FAILED = "E_TRANSACTION_VALIDATION_FAILED",
|
|
292
|
+
E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE",
|
|
293
|
+
E_ALREADY_PREPARED = "E_ALREADY_PREPARED",
|
|
294
|
+
E_PENDING = "E_PENDING",
|
|
295
|
+
E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED",
|
|
296
|
+
E_INIT_CONNECTION = "E_INIT_CONNECTION",
|
|
297
|
+
E_SERVICE_DISCONNECTED = "E_SERVICE_DISCONNECTED",
|
|
298
|
+
E_QUERY_PRODUCT = "E_QUERY_PRODUCT",
|
|
299
|
+
E_SKU_NOT_FOUND = "E_SKU_NOT_FOUND",
|
|
300
|
+
E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH",
|
|
301
|
+
E_ITEM_NOT_OWNED = "E_ITEM_NOT_OWNED",
|
|
302
|
+
E_BILLING_UNAVAILABLE = "E_BILLING_UNAVAILABLE",
|
|
303
|
+
E_FEATURE_NOT_SUPPORTED = "E_FEATURE_NOT_SUPPORTED",
|
|
304
|
+
E_EMPTY_SKU_LIST = "E_EMPTY_SKU_LIST"
|
|
305
|
+
}
|
|
306
|
+
export type PurchaseResult = {
|
|
307
|
+
responseCode?: number;
|
|
308
|
+
debugMessage?: string;
|
|
309
|
+
code?: string;
|
|
310
|
+
message?: string;
|
|
311
|
+
/**
|
|
312
|
+
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
313
|
+
*/
|
|
314
|
+
purchaseTokenAndroid?: string;
|
|
315
|
+
purchaseToken?: string;
|
|
316
|
+
};
|
|
317
|
+
export type PaymentDiscount = {
|
|
318
|
+
identifier: string;
|
|
319
|
+
keyIdentifier: string;
|
|
320
|
+
nonce: string;
|
|
321
|
+
signature: string;
|
|
322
|
+
timestamp: number;
|
|
323
|
+
};
|
|
324
|
+
export type AppTransactionIOS = {
|
|
325
|
+
appTransactionId?: string;
|
|
326
|
+
originalPlatform?: string;
|
|
327
|
+
bundleId: string;
|
|
328
|
+
appVersion: string;
|
|
329
|
+
originalAppVersion: string;
|
|
330
|
+
originalPurchaseDate: number;
|
|
331
|
+
deviceVerification: string;
|
|
332
|
+
deviceVerificationNonce: string;
|
|
333
|
+
environment: string;
|
|
334
|
+
signedDate: number;
|
|
335
|
+
appId?: number;
|
|
336
|
+
appVersionId?: number;
|
|
337
|
+
preorderDate?: number;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Options for getAvailablePurchases methods
|
|
341
|
+
*/
|
|
342
|
+
export interface PurchaseOptions {
|
|
343
|
+
/**
|
|
344
|
+
* @deprecated Use alsoPublishToEventListenerIOS instead
|
|
345
|
+
* Whether to also publish purchases to event listener (iOS only)
|
|
346
|
+
*/
|
|
347
|
+
alsoPublishToEventListener?: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* @deprecated Use onlyIncludeActiveItemsIOS instead
|
|
350
|
+
* Whether to only include active items (iOS only)
|
|
351
|
+
*/
|
|
352
|
+
onlyIncludeActiveItems?: boolean;
|
|
353
|
+
/** Whether to also publish purchases to event listener (iOS only) */
|
|
354
|
+
alsoPublishToEventListenerIOS?: boolean;
|
|
355
|
+
/** Whether to only include active items (subscriptions that are still active) (iOS only) */
|
|
356
|
+
onlyIncludeActiveItemsIOS?: boolean;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Parameters for finishTransaction method
|
|
360
|
+
*/
|
|
361
|
+
export interface FinishTransactionParams {
|
|
362
|
+
/** The purchase to finish/consume */
|
|
363
|
+
purchase: Purchase;
|
|
364
|
+
/**
|
|
365
|
+
* Whether this is a consumable product that should be consumed.
|
|
366
|
+
* - Set to true for consumable products (e.g., "20 credits", "100 coins")
|
|
367
|
+
* - Set to false (or omit) for non-consumable products (e.g., "remove ads", "premium features")
|
|
368
|
+
* - Do NOT set to true for subscriptions - they are managed automatically
|
|
369
|
+
* Note: On iOS, this flag doesn't affect behavior as StoreKit handles this automatically.
|
|
370
|
+
* On Android, consumables must be consumed to allow repurchase.
|
|
371
|
+
*/
|
|
372
|
+
isConsumable?: boolean;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Main IAP context interface providing all in-app purchase functionality
|
|
376
|
+
*/
|
|
377
|
+
export interface IapContext {
|
|
378
|
+
/** Current list of available products */
|
|
379
|
+
products: Product[];
|
|
380
|
+
/** Current list of available subscription products */
|
|
381
|
+
subscriptions: SubscriptionProduct[];
|
|
382
|
+
/**
|
|
383
|
+
* List of available purchases (includes all types):
|
|
384
|
+
* - Consumables: Not yet consumed/finished
|
|
385
|
+
* - Non-consumables: Not yet finished
|
|
386
|
+
* - Subscriptions: Currently active
|
|
387
|
+
*/
|
|
388
|
+
availablePurchases: Purchase[];
|
|
389
|
+
/** Currently promoted product (iOS only) */
|
|
390
|
+
promotedProduct?: Product;
|
|
391
|
+
/** Current purchase being processed */
|
|
392
|
+
currentPurchase?: Purchase;
|
|
393
|
+
/** Purchase error if any */
|
|
394
|
+
purchaseError?: PurchaseError;
|
|
395
|
+
/** Initialize connection to the store */
|
|
396
|
+
initConnection(): Promise<boolean>;
|
|
397
|
+
/** End connection to the store */
|
|
398
|
+
endConnection(): Promise<void>;
|
|
399
|
+
/** Sync purchases (iOS only) */
|
|
400
|
+
sync(): Promise<void>;
|
|
401
|
+
/**
|
|
402
|
+
* Fetch products from the store
|
|
403
|
+
* @param params.skus - Array of product SKUs to fetch
|
|
404
|
+
* @param params.type - Type of products: 'inapp' for regular products or 'subs' for subscriptions
|
|
405
|
+
*/
|
|
406
|
+
fetchProducts(params: {
|
|
407
|
+
skus: string[];
|
|
408
|
+
type?: ProductType;
|
|
409
|
+
}): Promise<Product[] | SubscriptionProduct[]>;
|
|
410
|
+
/**
|
|
411
|
+
* Request a purchase for products or subscriptions
|
|
412
|
+
* @param params.request - Platform-specific purchase parameters
|
|
413
|
+
* @param params.type - Type of purchase: 'inapp' for products or 'subs' for subscriptions
|
|
414
|
+
*/
|
|
415
|
+
requestPurchase(params: {
|
|
416
|
+
request: RequestPurchaseProps | RequestSubscriptionProps;
|
|
417
|
+
type?: 'inapp' | 'subs';
|
|
418
|
+
}): Promise<Purchase | Purchase[] | void>;
|
|
419
|
+
/**
|
|
420
|
+
* Finish a transaction and consume if applicable.
|
|
421
|
+
* IMPORTANT: Every purchase must be finished to complete the transaction.
|
|
422
|
+
* - For consumables: Set isConsumable=true to allow repurchase
|
|
423
|
+
* - For non-consumables & subscriptions: Set isConsumable=false or omit
|
|
424
|
+
*/
|
|
425
|
+
finishTransaction(params: FinishTransactionParams): Promise<PurchaseResult | boolean>;
|
|
426
|
+
/**
|
|
427
|
+
* Get all available purchases for the current user.
|
|
428
|
+
* Returns:
|
|
429
|
+
* - Consumables that haven't been consumed (finished with isConsumable=true)
|
|
430
|
+
* - Non-consumables that haven't been finished
|
|
431
|
+
* - Active subscriptions
|
|
432
|
+
*/
|
|
433
|
+
getAvailablePurchases(options?: PurchaseOptions): Promise<Purchase[]>;
|
|
434
|
+
/** Validate a receipt (server-side validation recommended) */
|
|
435
|
+
validateReceipt(options: ValidateReceiptProps): Promise<ReceiptValidationResult>;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Purchase error type
|
|
439
|
+
*/
|
|
440
|
+
export interface PurchaseError {
|
|
441
|
+
/** Error code constant */
|
|
442
|
+
code: string;
|
|
443
|
+
/** Human-readable error message */
|
|
444
|
+
message: string;
|
|
445
|
+
/** Related product SKU */
|
|
446
|
+
productId?: string;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Validation options for receipt validation
|
|
450
|
+
*/
|
|
451
|
+
export interface ValidateReceiptProps {
|
|
452
|
+
/** Product SKU to validate */
|
|
453
|
+
sku: string;
|
|
454
|
+
/** Android-specific validation options */
|
|
455
|
+
androidOptions?: {
|
|
456
|
+
packageName: string;
|
|
457
|
+
productToken: string;
|
|
458
|
+
accessToken: string;
|
|
459
|
+
isSub?: boolean;
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* iOS receipt validation result
|
|
464
|
+
*/
|
|
465
|
+
export interface ReceiptIOS {
|
|
466
|
+
/** Whether the receipt is valid */
|
|
467
|
+
isValid: boolean;
|
|
468
|
+
/** Receipt data string */
|
|
469
|
+
receiptData: string;
|
|
470
|
+
/** JWS representation */
|
|
471
|
+
jwsRepresentation: string;
|
|
472
|
+
/** Latest transaction if available */
|
|
473
|
+
latestTransaction?: Purchase;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Android receipt validation result
|
|
477
|
+
*/
|
|
478
|
+
export interface ReceiptAndroid {
|
|
479
|
+
/** Whether the receipt is valid */
|
|
480
|
+
isValid: boolean;
|
|
481
|
+
/** Receipt data string */
|
|
482
|
+
receiptData: string;
|
|
483
|
+
/** JWS representation */
|
|
484
|
+
jwsRepresentation: string;
|
|
485
|
+
/** Latest transaction if available */
|
|
486
|
+
latestTransaction?: Purchase;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Receipt validation result from receipt validation
|
|
490
|
+
*/
|
|
491
|
+
export type ReceiptValidationResult = ReceiptAndroid | ReceiptIOS;
|
|
492
|
+
/**
|
|
493
|
+
* New iOS receipt validation result (matches user specification)
|
|
494
|
+
*/
|
|
495
|
+
export interface ReceiptValidationResultIOS {
|
|
496
|
+
isValid: boolean;
|
|
497
|
+
receiptData: string;
|
|
498
|
+
jwsRepresentation: string;
|
|
499
|
+
latestTransaction?: Purchase;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* New Android receipt validation result (matches user specification)
|
|
503
|
+
*/
|
|
504
|
+
export interface ReceiptValidationResultAndroid {
|
|
505
|
+
autoRenewing: boolean;
|
|
506
|
+
betaProduct: boolean;
|
|
507
|
+
cancelDate: number | null;
|
|
508
|
+
cancelReason: string;
|
|
509
|
+
deferredDate: number | null;
|
|
510
|
+
deferredSku: number | null;
|
|
511
|
+
freeTrialEndDate: number;
|
|
512
|
+
gracePeriodEndDate: number;
|
|
513
|
+
parentProductId: string;
|
|
514
|
+
productId: string;
|
|
515
|
+
productType: string;
|
|
516
|
+
purchaseDate: number;
|
|
517
|
+
quantity: number;
|
|
518
|
+
receiptId: string;
|
|
519
|
+
renewalDate: number;
|
|
520
|
+
term: string;
|
|
521
|
+
termSku: string;
|
|
522
|
+
testTransaction: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Represents an active subscription with platform-specific details
|
|
526
|
+
*/
|
|
527
|
+
export interface ActiveSubscription {
|
|
528
|
+
/** Product identifier (SKU) of the subscription */
|
|
529
|
+
productId: string;
|
|
530
|
+
/** Whether the subscription is currently active */
|
|
531
|
+
isActive: boolean;
|
|
532
|
+
/** iOS: Subscription expiration date */
|
|
533
|
+
expirationDateIOS?: Date;
|
|
534
|
+
/** Android: Whether the subscription auto-renews */
|
|
535
|
+
autoRenewingAndroid?: boolean;
|
|
536
|
+
/** iOS: Environment where the subscription was purchased (Production/Sandbox) */
|
|
537
|
+
environmentIOS?: string;
|
|
538
|
+
/** Whether the subscription will expire soon (typically within 7 days) */
|
|
539
|
+
willExpireSoon?: boolean;
|
|
540
|
+
/** iOS: Number of days until the subscription expires */
|
|
541
|
+
daysUntilExpirationIOS?: number;
|
|
542
|
+
}
|
|
543
|
+
export {};
|
|
544
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAM1C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,yGAAyG;IACzG,IAAI,EAAE,WAAW,CAAA;IACjB,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAA;IACV,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;IACd,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,yCAAyC;IACzC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,oFAAoF;IACpF,aAAa,CAAC,E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B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAA;IACjB,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,IAAI,CAAA;IACxB,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,yDAAyD;IACzD,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error utilities for parsing platform-specific error responses
|
|
3
|
+
*/
|
|
4
|
+
export interface IapError {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
responseCode?: number;
|
|
8
|
+
debugMessage?: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parses error string from native modules into a structured error object
|
|
14
|
+
*
|
|
15
|
+
* Native modules return errors in different formats:
|
|
16
|
+
* - Android: JSON string like '{"code":"E_USER_CANCELLED","message":"User cancelled the purchase","responseCode":1}'
|
|
17
|
+
* - iOS: JSON string or plain message
|
|
18
|
+
* - Legacy: "CODE: message" format
|
|
19
|
+
*
|
|
20
|
+
* @param errorString - The error string from native module
|
|
21
|
+
* @returns Parsed error object with code and message
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseErrorStringToJsonObj(errorString: string | Error | unknown): IapError;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if an error code indicates user cancellation
|
|
26
|
+
* @param error - Error object or string
|
|
27
|
+
* @returns true if the error is a user cancellation
|
|
28
|
+
*/
|
|
29
|
+
export declare function isUserCancelledError(error: IapError | string | Error | unknown): boolean;
|
|
30
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/utils/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GACpC,QAAQ,CAgDV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GACzC,OAAO,CAWT"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Bridge Utilities
|
|
3
|
+
*
|
|
4
|
+
* This file provides conversion utilities between Nitro types (simple primitives)
|
|
5
|
+
* and TypeScript union types (complex types.ts definitions).
|
|
6
|
+
*
|
|
7
|
+
* Purpose: Prevent type fragmentation between native (Nitro) and TypeScript sides
|
|
8
|
+
*/
|
|
9
|
+
import type { NitroProduct, NitroPurchase } from '../specs/RnIap.nitro';
|
|
10
|
+
import type { Product, Purchase, SubscriptionProduct } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* Convert NitroProduct (from native) to TypeScript Product (for library consumers)
|
|
13
|
+
* This ensures all fields are properly mapped and accessible
|
|
14
|
+
*/
|
|
15
|
+
export declare function convertNitroProductToProduct(nitroProduct: NitroProduct): Product;
|
|
16
|
+
/**
|
|
17
|
+
* Convert Product to SubscriptionProduct (type-safe casting)
|
|
18
|
+
*/
|
|
19
|
+
export declare function convertProductToSubscriptionProduct(product: Product): SubscriptionProduct;
|
|
20
|
+
/**
|
|
21
|
+
* Convert NitroPurchase (from native) to TypeScript Purchase (for library consumers)
|
|
22
|
+
*/
|
|
23
|
+
export declare function convertNitroPurchaseToPurchase(nitroPurchase: NitroPurchase): Purchase;
|
|
24
|
+
/**
|
|
25
|
+
* Validate that a NitroProduct has all required fields for conversion
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateNitroProduct(nitroProduct: NitroProduct): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Validate that a NitroPurchase has all required fields for conversion
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateNitroPurchase(nitroPurchase: NitroPurchase): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Check if Nitro types and TypeScript types are synchronized
|
|
34
|
+
* This function can be run in development to detect type mismatches
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkTypeSynchronization(): {
|
|
37
|
+
isSync: boolean;
|
|
38
|
+
issues: string[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=type-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../../../src/utils/type-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAOrE;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAuDhF;AAID;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,CASzF;AAMD;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,aAAa,GAAG,QAAQ,CAgCrF;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CASxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAS3E;AAMD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA4BA"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cxxNamespace": ["iap"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"iosModuleName": "NitroIap"
|
|
5
|
+
},
|
|
6
|
+
"android": {
|
|
7
|
+
"androidNamespace": ["iap"],
|
|
8
|
+
"androidCxxLibName": "NitroIap"
|
|
9
|
+
},
|
|
10
|
+
"autolinking": {
|
|
11
|
+
"RnIap": {
|
|
12
|
+
"swift": "HybridRnIap",
|
|
13
|
+
"kotlin": "HybridRnIap"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"ignorePaths": ["node_modules"]
|
|
17
|
+
}
|