react-native-iap 13.0.4 → 14.0.0-rc.2
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 +144 -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
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import type { AmazonModuleProps, AndroidModuleProps, IosModuleProps } from '../modules';
|
|
2
|
-
import type { IosModulePropsSk2 } from '../modules/iosSk2';
|
|
3
|
-
import type * as Apple from './apple';
|
|
4
|
-
export type Sku = string;
|
|
5
|
-
export type IosPlatform = {
|
|
6
|
-
platform: 'ios';
|
|
7
|
-
};
|
|
8
|
-
export type AndroidPlatform = {
|
|
9
|
-
platform: 'android';
|
|
10
|
-
};
|
|
11
|
-
export type AmazonPlatform = {
|
|
12
|
-
platform: 'amazon';
|
|
13
|
-
};
|
|
14
|
-
export type ProrationModesAmazon = '' | 'DEFERRED' | 'IMMEDIATE';
|
|
15
|
-
export declare enum ReplacementModesAndroid {
|
|
16
|
-
UNKNOWN_REPLACEMENT_MODE = 0,
|
|
17
|
-
WITH_TIME_PRORATION = 1,
|
|
18
|
-
CHARGE_PRORATED_PRICE = 2,
|
|
19
|
-
WITHOUT_PRORATION = 3,
|
|
20
|
-
CHARGE_FULL_PRICE = 5,
|
|
21
|
-
DEFERRED = 6
|
|
22
|
-
}
|
|
23
|
-
export declare enum PurchaseStateAndroid {
|
|
24
|
-
UNSPECIFIED_STATE = 0,
|
|
25
|
-
PURCHASED = 1,
|
|
26
|
-
PENDING = 2
|
|
27
|
-
}
|
|
28
|
-
export declare const PROMOTED_PRODUCT = "iap-promoted-product";
|
|
29
|
-
export declare enum InstallSourceAndroid {
|
|
30
|
-
NOT_SET = 0,
|
|
31
|
-
GOOGLE_PLAY = 1,
|
|
32
|
-
AMAZON = 2
|
|
33
|
-
}
|
|
34
|
-
export declare enum ProductType {
|
|
35
|
-
/** Subscription */
|
|
36
|
-
subs = "subs",
|
|
37
|
-
/** Subscription */
|
|
38
|
-
sub = "sub",
|
|
39
|
-
/** Consumable */
|
|
40
|
-
inapp = "inapp",
|
|
41
|
-
/** Consumable */
|
|
42
|
-
iap = "iap"
|
|
43
|
-
}
|
|
44
|
-
export declare enum TransactionReason {
|
|
45
|
-
PURCHASE = "PURCHASE",
|
|
46
|
-
RENEWAL = "RENEWAL"
|
|
47
|
-
}
|
|
48
|
-
export interface ProductCommon {
|
|
49
|
-
type: 'subs' | 'sub' | 'inapp' | 'iap';
|
|
50
|
-
productId: string;
|
|
51
|
-
id?: string;
|
|
52
|
-
productIds?: string[];
|
|
53
|
-
title: string;
|
|
54
|
-
description: string;
|
|
55
|
-
price: string;
|
|
56
|
-
currency: string;
|
|
57
|
-
localizedPrice: string;
|
|
58
|
-
displayPrice?: string;
|
|
59
|
-
originalPrice?: string;
|
|
60
|
-
countryCode?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface ProductPurchase {
|
|
63
|
-
productId: string;
|
|
64
|
-
id?: string;
|
|
65
|
-
ids?: string[];
|
|
66
|
-
transactionId?: string;
|
|
67
|
-
transactionDate: number;
|
|
68
|
-
transactionReceipt: string;
|
|
69
|
-
purchaseToken?: string;
|
|
70
|
-
quantityIOS?: number;
|
|
71
|
-
originalTransactionDateIOS?: number;
|
|
72
|
-
originalTransactionIdentifierIOS?: string;
|
|
73
|
-
verificationResultIOS?: string;
|
|
74
|
-
appAccountToken?: string;
|
|
75
|
-
jwsRepresentationIos?: string;
|
|
76
|
-
environmentIos?: string;
|
|
77
|
-
storefrontCountryCodeIos?: string;
|
|
78
|
-
reasonIos?: string;
|
|
79
|
-
offerIos?: {
|
|
80
|
-
id: string;
|
|
81
|
-
type: string;
|
|
82
|
-
paymentMode: string;
|
|
83
|
-
};
|
|
84
|
-
priceIos?: number;
|
|
85
|
-
currencyIos?: string;
|
|
86
|
-
expirationDateIos?: number;
|
|
87
|
-
webOrderLineItemIdIos?: number;
|
|
88
|
-
appBundleIdIos?: string;
|
|
89
|
-
productTypeIos?: string;
|
|
90
|
-
subscriptionGroupIdIos?: string;
|
|
91
|
-
isUpgradedIos?: boolean;
|
|
92
|
-
ownershipTypeIos?: string;
|
|
93
|
-
reasonStringRepresentationIos?: string;
|
|
94
|
-
transactionReasonIOS?: TransactionReason | string;
|
|
95
|
-
revocationDateIos?: number;
|
|
96
|
-
revocationReasonIos?: string;
|
|
97
|
-
productIds?: string[];
|
|
98
|
-
dataAndroid?: string;
|
|
99
|
-
signatureAndroid?: string;
|
|
100
|
-
autoRenewingAndroid?: boolean;
|
|
101
|
-
purchaseStateAndroid?: PurchaseStateAndroid;
|
|
102
|
-
isAcknowledgedAndroid?: boolean;
|
|
103
|
-
packageNameAndroid?: string;
|
|
104
|
-
developerPayloadAndroid?: string;
|
|
105
|
-
obfuscatedAccountIdAndroid?: string;
|
|
106
|
-
obfuscatedProfileIdAndroid?: string;
|
|
107
|
-
userIdAmazon?: string;
|
|
108
|
-
userMarketplaceAmazon?: string;
|
|
109
|
-
userJsonAmazon?: string;
|
|
110
|
-
isCanceledAmazon?: boolean;
|
|
111
|
-
}
|
|
112
|
-
export type AppTransaction = {
|
|
113
|
-
appTransactionID?: string;
|
|
114
|
-
originalPlatform?: string;
|
|
115
|
-
originalAppVersion: string;
|
|
116
|
-
originalPurchaseDate: number;
|
|
117
|
-
deviceVerification: string;
|
|
118
|
-
deviceVerificationNonce: string;
|
|
119
|
-
appVersion: string;
|
|
120
|
-
signedDate: number;
|
|
121
|
-
environment: string;
|
|
122
|
-
};
|
|
123
|
-
export interface PurchaseResult {
|
|
124
|
-
responseCode?: number;
|
|
125
|
-
debugMessage?: string;
|
|
126
|
-
code?: string;
|
|
127
|
-
message?: string;
|
|
128
|
-
purchaseToken?: string;
|
|
129
|
-
}
|
|
130
|
-
export interface SubscriptionPurchase extends ProductPurchase {
|
|
131
|
-
autoRenewingAndroid?: boolean;
|
|
132
|
-
originalTransactionDateIOS?: number;
|
|
133
|
-
originalTransactionIdentifierIOS?: string;
|
|
134
|
-
verificationResultIOS?: string;
|
|
135
|
-
transactionReasonIOS?: TransactionReason | string;
|
|
136
|
-
}
|
|
137
|
-
export type PurchaseWithPlatform = ((ProductPurchase & {
|
|
138
|
-
productIds?: string[];
|
|
139
|
-
}) & AndroidPlatform) | ((ProductPurchase & {
|
|
140
|
-
quantityIOS?: number;
|
|
141
|
-
}) & IosPlatform) | ((ProductPurchase & {
|
|
142
|
-
userIdAmazon?: string;
|
|
143
|
-
}) & AmazonPlatform) | SubscriptionPurchase;
|
|
144
|
-
export type Purchase = ProductPurchase | SubscriptionPurchase;
|
|
145
|
-
export interface Discount {
|
|
146
|
-
identifier: string;
|
|
147
|
-
type: string;
|
|
148
|
-
numberOfPeriods: string;
|
|
149
|
-
price: string;
|
|
150
|
-
localizedPrice: string;
|
|
151
|
-
paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
152
|
-
subscriptionPeriod: string;
|
|
153
|
-
}
|
|
154
|
-
export interface ProductAndroid extends ProductCommon {
|
|
155
|
-
type: 'inapp' | 'iap';
|
|
156
|
-
name?: string;
|
|
157
|
-
oneTimePurchaseOfferDetails?: {
|
|
158
|
-
priceCurrencyCode: string;
|
|
159
|
-
formattedPrice: string;
|
|
160
|
-
priceAmountMicros: string;
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
export interface ProductIOS extends ProductCommon {
|
|
164
|
-
type: 'inapp' | 'iap';
|
|
165
|
-
displayName?: string;
|
|
166
|
-
isFamilyShareable?: boolean;
|
|
167
|
-
jsonRepresentation?: string;
|
|
168
|
-
subscription?: any;
|
|
169
|
-
}
|
|
170
|
-
export type ProductLegacy = ProductAndroid & ProductIOS;
|
|
171
|
-
export type ProductWithPlatform = (ProductAndroid & AndroidPlatform) | (ProductIOS & IosPlatform);
|
|
172
|
-
export type Product = ProductAndroid & ProductIOS;
|
|
173
|
-
/**
|
|
174
|
-
* Can be used to distinguish the different platforms' subscription information
|
|
175
|
-
*/
|
|
176
|
-
export declare enum SubscriptionPlatform {
|
|
177
|
-
android = "android",
|
|
178
|
-
amazon = "amazon",
|
|
179
|
-
ios = "ios"
|
|
180
|
-
}
|
|
181
|
-
/** Android Billing v5 type */
|
|
182
|
-
export interface SubscriptionAndroid {
|
|
183
|
-
platform: SubscriptionPlatform.android;
|
|
184
|
-
productType: 'subs';
|
|
185
|
-
name: string;
|
|
186
|
-
title: string;
|
|
187
|
-
description: string;
|
|
188
|
-
productId: string;
|
|
189
|
-
subscriptionOfferDetails: SubscriptionOfferAndroid[];
|
|
190
|
-
}
|
|
191
|
-
export interface SubscriptionOfferAndroid {
|
|
192
|
-
basePlanId: string;
|
|
193
|
-
offerId: string | null;
|
|
194
|
-
offerToken: string;
|
|
195
|
-
pricingPhases: {
|
|
196
|
-
pricingPhaseList: PricingPhaseAndroid[];
|
|
197
|
-
};
|
|
198
|
-
offerTags: string[];
|
|
199
|
-
}
|
|
200
|
-
export interface PricingPhaseAndroid {
|
|
201
|
-
formattedPrice: string;
|
|
202
|
-
priceCurrencyCode: string;
|
|
203
|
-
/**
|
|
204
|
-
* P1W, P1M, P1Y
|
|
205
|
-
*/
|
|
206
|
-
billingPeriod: string;
|
|
207
|
-
billingCycleCount: number;
|
|
208
|
-
priceAmountMicros: string;
|
|
209
|
-
recurrenceMode: number;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* TODO: As of 2022-10-10, this typing is not verified against the real
|
|
213
|
-
* Amazon API. Please update this if you have a more accurate type.
|
|
214
|
-
*/
|
|
215
|
-
export interface SubscriptionAmazon extends ProductCommon {
|
|
216
|
-
platform: SubscriptionPlatform.amazon;
|
|
217
|
-
type: 'subs';
|
|
218
|
-
productType?: string;
|
|
219
|
-
name?: string;
|
|
220
|
-
}
|
|
221
|
-
export type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';
|
|
222
|
-
export interface SubscriptionIOS extends ProductCommon {
|
|
223
|
-
platform: SubscriptionPlatform.ios;
|
|
224
|
-
type: 'subs';
|
|
225
|
-
discounts?: Discount[];
|
|
226
|
-
introductoryPrice?: string;
|
|
227
|
-
introductoryPriceAsAmountIOS?: string;
|
|
228
|
-
introductoryPricePaymentModeIOS?: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
229
|
-
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
230
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
231
|
-
subscriptionPeriodNumberIOS?: string;
|
|
232
|
-
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;
|
|
233
|
-
}
|
|
234
|
-
export type Subscription = SubscriptionAndroid | SubscriptionAmazon | SubscriptionIOS;
|
|
235
|
-
export interface RequestPurchaseBaseAndroid {
|
|
236
|
-
obfuscatedAccountIdAndroid?: string;
|
|
237
|
-
obfuscatedProfileIdAndroid?: string;
|
|
238
|
-
isOfferPersonalized?: boolean;
|
|
239
|
-
}
|
|
240
|
-
export interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {
|
|
241
|
-
skus: Sku[];
|
|
242
|
-
}
|
|
243
|
-
export interface RequestPurchaseIOS {
|
|
244
|
-
sku: Sku;
|
|
245
|
-
andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;
|
|
246
|
-
/**
|
|
247
|
-
* UUID representing user account
|
|
248
|
-
*/
|
|
249
|
-
appAccountToken?: string;
|
|
250
|
-
quantity?: number;
|
|
251
|
-
withOffer?: Apple.PaymentDiscount;
|
|
252
|
-
}
|
|
253
|
-
/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */
|
|
254
|
-
export type RequestPurchaseAmazon = RequestPurchaseIOS;
|
|
255
|
-
export type RequestPurchase = RequestPurchaseAndroid | RequestPurchaseAmazon | RequestPurchaseIOS;
|
|
256
|
-
/**
|
|
257
|
-
* In order to purchase a new subscription, every sku must have a selected offerToken
|
|
258
|
-
* @see SubscriptionAndroid.subscriptionOfferDetails.offerToken
|
|
259
|
-
*/
|
|
260
|
-
export interface SubscriptionOffer {
|
|
261
|
-
sku: Sku;
|
|
262
|
-
offerToken: string;
|
|
263
|
-
}
|
|
264
|
-
export interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {
|
|
265
|
-
purchaseTokenAndroid?: string;
|
|
266
|
-
replacementModeAndroid?: ReplacementModesAndroid;
|
|
267
|
-
subscriptionOffers: SubscriptionOffer[];
|
|
268
|
-
}
|
|
269
|
-
export type RequestSubscriptionIOS = RequestPurchaseIOS;
|
|
270
|
-
/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */
|
|
271
|
-
export interface RequestSubscriptionAmazon extends RequestSubscriptionIOS {
|
|
272
|
-
prorationModeAmazon?: ProrationModesAmazon;
|
|
273
|
-
}
|
|
274
|
-
export type RequestSubscription = RequestSubscriptionAndroid | RequestSubscriptionAmazon | RequestSubscriptionIOS;
|
|
275
|
-
export interface UnifiedRequestPurchaseProps {
|
|
276
|
-
readonly sku?: string;
|
|
277
|
-
readonly skus?: string[];
|
|
278
|
-
readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;
|
|
279
|
-
readonly appAccountToken?: string;
|
|
280
|
-
readonly quantity?: number;
|
|
281
|
-
readonly withOffer?: Apple.PaymentDiscount;
|
|
282
|
-
readonly obfuscatedAccountIdAndroid?: string;
|
|
283
|
-
readonly obfuscatedProfileIdAndroid?: string;
|
|
284
|
-
readonly isOfferPersonalized?: boolean;
|
|
285
|
-
}
|
|
286
|
-
export interface UnifiedRequestSubscriptionProps extends UnifiedRequestPurchaseProps {
|
|
287
|
-
readonly purchaseTokenAndroid?: string;
|
|
288
|
-
readonly replacementModeAndroid?: number;
|
|
289
|
-
readonly subscriptionOffers?: {
|
|
290
|
-
sku: string;
|
|
291
|
-
offerToken: string;
|
|
292
|
-
}[];
|
|
293
|
-
}
|
|
294
|
-
declare module 'react-native' {
|
|
295
|
-
interface NativeModulesStatic {
|
|
296
|
-
RNIapIos: IosModuleProps;
|
|
297
|
-
RNIapIosSk2: IosModulePropsSk2;
|
|
298
|
-
RNIapModule: AndroidModuleProps;
|
|
299
|
-
RNIapAmazonModule: AmazonModuleProps;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AAGzB,MAAM,MAAM,WAAW,GAAG;IAAC,QAAQ,EAAE,KAAK,CAAA;CAAC,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAC,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,EAAE,GAAG,UAAU,GAAG,WAAW,CAAC;AAEjE,oBAAY,uBAAuB;IACjC,wBAAwB,IAAI;IAC5B,mBAAmB,IAAI;IACvB,qBAAqB,IAAI;IACzB,iBAAiB,IAAI;IACrB,iBAAiB,IAAI;IACrB,QAAQ,IAAI;CACb;AAED,oBAAY,oBAAoB;IAC9B,iBAAiB,IAAI;IACrB,SAAS,IAAI;IACb,OAAO,IAAI;CACZ;AAED,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAEvD,oBAAY,oBAAoB;IAC9B,OAAO,IAAI;IACX,WAAW,IAAI;IACf,MAAM,IAAI;CACX;AAED,oBAAY,WAAW;IACrB,mBAAmB;IACnB,IAAI,SAAS;IAEb,mBAAmB;IACnB,GAAG,QAAQ;IAEX,iBAAiB;IACjB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,WAAW,2BAA2B;IAE1C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAGzB,QAAQ,CAAC,+CAA+C,CAAC,EAAE,OAAO,CAAC;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC;IAG3C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,+BACf,SAAQ,2BAA2B;IAEnC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;QAC5B,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,mBAAmB;QAC3B,QAAQ,EAAE,cAAc,CAAC;QACzB,WAAW,EAAE,iBAAiB,CAAC;QAC/B,WAAW,EAAE,kBAAkB,CAAC;QAChC,iBAAiB,EAAE,iBAAiB,CAAC;KACtC;CACF"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error mapping utilities for react-native-iap
|
|
3
|
-
* Provides helper functions for handling platform-specific errors
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Checks if an error is a user cancellation
|
|
7
|
-
* @param error Error object or error code
|
|
8
|
-
* @returns True if the error represents user cancellation
|
|
9
|
-
*/
|
|
10
|
-
export declare function isUserCancelledError(error: any): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Checks if an error is related to network connectivity
|
|
13
|
-
* @param error Error object or error code
|
|
14
|
-
* @returns True if the error is network-related
|
|
15
|
-
*/
|
|
16
|
-
export declare function isNetworkError(error: any): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Checks if an error is recoverable (user can retry)
|
|
19
|
-
* @param error Error object or error code
|
|
20
|
-
* @returns True if the error is potentially recoverable
|
|
21
|
-
*/
|
|
22
|
-
export declare function isRecoverableError(error: any): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Gets a user-friendly error message for display
|
|
25
|
-
* @param error Error object or error code
|
|
26
|
-
* @returns User-friendly error message
|
|
27
|
-
*/
|
|
28
|
-
export declare function getUserFriendlyErrorMessage(error: any): string;
|
|
29
|
-
//# sourceMappingURL=errorMapping.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorMapping.d.ts","sourceRoot":"","sources":["../../../../src/utils/errorMapping.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAUxD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CASlD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAUtD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAyB9D"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type guard functions for react-native-iap
|
|
3
|
-
*/
|
|
4
|
-
import type { Product, ProductPurchase, ProductWithPlatform, Purchase, PurchaseWithPlatform } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* Type guard to check if a product is from iOS
|
|
7
|
-
*/
|
|
8
|
-
export declare function isProductIos(product: Product | ProductWithPlatform): product is Product & {
|
|
9
|
-
platform?: 'ios';
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Type guard to check if a product is from Android
|
|
13
|
-
*/
|
|
14
|
-
export declare function isProductAndroid(product: Product | ProductWithPlatform): product is Product & {
|
|
15
|
-
platform?: 'android';
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Type guard to check if a purchase is from iOS
|
|
19
|
-
*/
|
|
20
|
-
export declare function isPurchaseIos(purchase: Purchase | PurchaseWithPlatform): purchase is Purchase & {
|
|
21
|
-
platform?: 'ios';
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Type guard to check if a purchase is from Android
|
|
25
|
-
*/
|
|
26
|
-
export declare function isPurchaseAndroid(purchase: Purchase | PurchaseWithPlatform): purchase is Purchase & {
|
|
27
|
-
platform?: 'android';
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Type guard to check if a purchase is from Amazon
|
|
31
|
-
*/
|
|
32
|
-
export declare function isPurchaseAmazon(purchase: Purchase | PurchaseWithPlatform): purchase is Purchase & {
|
|
33
|
-
platform?: 'amazon';
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Type guard to check if an item is a ProductPurchase
|
|
37
|
-
*/
|
|
38
|
-
export declare function isProductPurchase(item: unknown): item is ProductPurchase;
|
|
39
|
-
/**
|
|
40
|
-
* Helper to get the product ID from either field name
|
|
41
|
-
*/
|
|
42
|
-
export declare function getProductId(item: {
|
|
43
|
-
productId?: string;
|
|
44
|
-
id?: string;
|
|
45
|
-
}): string;
|
|
46
|
-
/**
|
|
47
|
-
* Helper to get the display price from either field name
|
|
48
|
-
*/
|
|
49
|
-
export declare function getDisplayPrice(item: {
|
|
50
|
-
localizedPrice?: string;
|
|
51
|
-
displayPrice?: string;
|
|
52
|
-
}): string;
|
|
53
|
-
//# sourceMappingURL=typeGuards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.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AI,EAAE;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAET"}
|
package/src/eventEmitter.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import {EmitterSubscription, NativeEventEmitter} from 'react-native';
|
|
2
|
-
|
|
3
|
-
import {TransactionEvent, transactionSk2ToPurchaseMap} from './types/appleSk2';
|
|
4
|
-
import {isIosStorekit2} from './iap';
|
|
5
|
-
import {
|
|
6
|
-
getAndroidModule,
|
|
7
|
-
getIosModule,
|
|
8
|
-
getNativeModule,
|
|
9
|
-
isAndroid,
|
|
10
|
-
isIos,
|
|
11
|
-
} from './internal';
|
|
12
|
-
import type {PurchaseError} from './purchaseError';
|
|
13
|
-
import type {Purchase} from './types';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Add IAP purchase event
|
|
17
|
-
* Register a callback that gets called when the store has any updates to purchases that have not yet been finished, consumed or acknowledged. Returns a React Native `EmitterSubscription` on which you can call `.remove()` to stop receiving updates. Register you listener as soon as possible and react to updates at all times.
|
|
18
|
-
|
|
19
|
-
## Signature
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
purchaseUpdatedListener((purchase: Purchase) => {});
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
import React, {useEffect} from 'react';
|
|
29
|
-
import {View} from 'react-native';
|
|
30
|
-
import {purchaseUpdatedListener} from 'react-native-iap';
|
|
31
|
-
|
|
32
|
-
const App = () => {
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const subscription = purchaseUpdatedListener((purchase: Purchase) => {
|
|
35
|
-
console.log(purchase);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return () => {
|
|
39
|
-
subscription.remove();
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
return <View />;
|
|
44
|
-
};
|
|
45
|
-
```
|
|
46
|
-
*/
|
|
47
|
-
export const purchaseUpdatedListener = (
|
|
48
|
-
listener: (event: Purchase) => void,
|
|
49
|
-
errorCallback?: (error: unknown) => void,
|
|
50
|
-
) => {
|
|
51
|
-
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
52
|
-
const proxyListener = isIosStorekit2()
|
|
53
|
-
? (event: Purchase) => {
|
|
54
|
-
listener(transactionSk2ToPurchaseMap(event as any));
|
|
55
|
-
}
|
|
56
|
-
: listener;
|
|
57
|
-
const emitterSubscription = eventEmitter.addListener(
|
|
58
|
-
'purchase-updated',
|
|
59
|
-
proxyListener,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
if (isAndroid) {
|
|
63
|
-
getAndroidModule()
|
|
64
|
-
.startListening()
|
|
65
|
-
.catch((error: unknown) => {
|
|
66
|
-
if (errorCallback) {
|
|
67
|
-
errorCallback(error);
|
|
68
|
-
} else {
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return emitterSubscription;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Add IAP purchase error event
|
|
79
|
-
* Register a callback that gets called when there has been an error with a purchase. Returns a React Native `EmitterSubscription` on which you can call `.remove()` to stop receiving updates.
|
|
80
|
-
|
|
81
|
-
## Signature
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
purchaseErrorListener((error: PurchaseError) => {});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Usage
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
import React, {useEffect} from 'react';
|
|
91
|
-
import {View} from 'react-native';
|
|
92
|
-
import {purchaseErrorListener} from 'react-native-iap';
|
|
93
|
-
|
|
94
|
-
const App = () => {
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
const subscription = purchaseErrorListener((error: PurchaseError) => {
|
|
97
|
-
console.log(error);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return () => {
|
|
101
|
-
subscription.remove();
|
|
102
|
-
};
|
|
103
|
-
}, []);
|
|
104
|
-
|
|
105
|
-
return <View />;
|
|
106
|
-
};
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
export const purchaseErrorListener = (
|
|
111
|
-
listener: (error: PurchaseError) => void,
|
|
112
|
-
): EmitterSubscription => {
|
|
113
|
-
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
114
|
-
return eventEmitter.addListener('purchase-error', listener);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Add IAP promoted subscription event
|
|
119
|
-
* Add IAP promoted subscription event.
|
|
120
|
-
|
|
121
|
-
## Signature
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
promotedProductListener((productId?: string) => {});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Usage
|
|
128
|
-
|
|
129
|
-
```tsx
|
|
130
|
-
import React, {useEffect} from 'react';
|
|
131
|
-
import {View} from 'react-native';
|
|
132
|
-
import {promotedProductListener} from 'react-native-iap';
|
|
133
|
-
|
|
134
|
-
const App = () => {
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
const subscription = promotedProductListener((productId) => {
|
|
137
|
-
console.log(productId);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return () => {
|
|
141
|
-
subscription.remove();
|
|
142
|
-
};
|
|
143
|
-
}, []);
|
|
144
|
-
|
|
145
|
-
return <View />;
|
|
146
|
-
};
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
* @platform iOS
|
|
151
|
-
*/
|
|
152
|
-
export const promotedProductListener = (listener: () => void) => {
|
|
153
|
-
if (isIos && !isIosStorekit2()) {
|
|
154
|
-
const eventEmitter = new NativeEventEmitter(getIosModule());
|
|
155
|
-
return eventEmitter.addListener('iap-promoted-product', listener);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return null;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Updated transactions for iOS Sk2
|
|
163
|
-
* Register a callback that gets called when the store has any updates to transactions related to purchases that have not yet been finished, consumed or acknowledged.
|
|
164
|
-
* Returns a React Native `EmitterSubscription` on which you can call `.remove()` to stop receiving updates. Register you listener as soon as possible and react to updates at all times.
|
|
165
|
-
|
|
166
|
-
**Warning**
|
|
167
|
-
This is only available for iOS 15 and higher and Storekit 2 is activated
|
|
168
|
-
|
|
169
|
-
## Signature
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
purchaseUpdatedListener((transactionOrError: TransactionOrError) => {});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Usage
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
import React, {useEffect} from 'react';
|
|
179
|
-
import {View} from 'react-native';
|
|
180
|
-
import {purchaseUpdatedListener} from 'react-native-iap';
|
|
181
|
-
|
|
182
|
-
const App = () => {
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
const subscription = purchaseUpdatedListener((transactionOrError: TransactionOrError) => {
|
|
185
|
-
if(transactionOrError.transaction){
|
|
186
|
-
console.log("There's an update to a transaction", transactionOrError.transaction);
|
|
187
|
-
}else{
|
|
188
|
-
console.log("There's been an error with a received transaction")
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
return () => {
|
|
193
|
-
subscription.remove();
|
|
194
|
-
};
|
|
195
|
-
}, []);
|
|
196
|
-
|
|
197
|
-
return <View />;
|
|
198
|
-
};
|
|
199
|
-
```
|
|
200
|
-
*
|
|
201
|
-
* @platform iOS (Sk2)
|
|
202
|
-
*/
|
|
203
|
-
export const transactionListener = (
|
|
204
|
-
listener: (event: TransactionEvent) => void,
|
|
205
|
-
) => {
|
|
206
|
-
if (isIos && isIosStorekit2()) {
|
|
207
|
-
const eventEmitter = new NativeEventEmitter(getIosModule());
|
|
208
|
-
return eventEmitter.addListener('iap-transaction-updated', listener);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return null;
|
|
212
|
-
};
|
package/src/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useIAP';
|