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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroReceiptValidationResultAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <optional>
|
|
24
|
+
#include <string>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A struct which can be represented as a JavaScript object (NitroReceiptValidationResultAndroid).
|
|
30
|
+
*/
|
|
31
|
+
struct NitroReceiptValidationResultAndroid {
|
|
32
|
+
public:
|
|
33
|
+
bool autoRenewing SWIFT_PRIVATE;
|
|
34
|
+
bool betaProduct SWIFT_PRIVATE;
|
|
35
|
+
std::optional<double> cancelDate SWIFT_PRIVATE;
|
|
36
|
+
std::string cancelReason SWIFT_PRIVATE;
|
|
37
|
+
std::optional<double> deferredDate SWIFT_PRIVATE;
|
|
38
|
+
std::optional<double> deferredSku SWIFT_PRIVATE;
|
|
39
|
+
double freeTrialEndDate SWIFT_PRIVATE;
|
|
40
|
+
double gracePeriodEndDate SWIFT_PRIVATE;
|
|
41
|
+
std::string parentProductId SWIFT_PRIVATE;
|
|
42
|
+
std::string productId SWIFT_PRIVATE;
|
|
43
|
+
std::string productType SWIFT_PRIVATE;
|
|
44
|
+
double purchaseDate SWIFT_PRIVATE;
|
|
45
|
+
double quantity SWIFT_PRIVATE;
|
|
46
|
+
std::string receiptId SWIFT_PRIVATE;
|
|
47
|
+
double renewalDate SWIFT_PRIVATE;
|
|
48
|
+
std::string term SWIFT_PRIVATE;
|
|
49
|
+
std::string termSku SWIFT_PRIVATE;
|
|
50
|
+
bool testTransaction SWIFT_PRIVATE;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
NitroReceiptValidationResultAndroid() = default;
|
|
54
|
+
explicit NitroReceiptValidationResultAndroid(bool autoRenewing, bool betaProduct, std::optional<double> cancelDate, std::string cancelReason, std::optional<double> deferredDate, std::optional<double> deferredSku, double freeTrialEndDate, double gracePeriodEndDate, std::string parentProductId, std::string productId, std::string productType, double purchaseDate, double quantity, std::string receiptId, double renewalDate, std::string term, std::string termSku, bool testTransaction): autoRenewing(autoRenewing), betaProduct(betaProduct), cancelDate(cancelDate), cancelReason(cancelReason), deferredDate(deferredDate), deferredSku(deferredSku), freeTrialEndDate(freeTrialEndDate), gracePeriodEndDate(gracePeriodEndDate), parentProductId(parentProductId), productId(productId), productType(productType), purchaseDate(purchaseDate), quantity(quantity), receiptId(receiptId), renewalDate(renewalDate), term(term), termSku(termSku), testTransaction(testTransaction) {}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::iap
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ NitroReceiptValidationResultAndroid <> JS NitroReceiptValidationResultAndroid (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::iap::NitroReceiptValidationResultAndroid> final {
|
|
64
|
+
static inline margelo::nitro::iap::NitroReceiptValidationResultAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::iap::NitroReceiptValidationResultAndroid(
|
|
67
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "autoRenewing")),
|
|
68
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "betaProduct")),
|
|
69
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "cancelDate")),
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "cancelReason")),
|
|
71
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "deferredDate")),
|
|
72
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "deferredSku")),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "freeTrialEndDate")),
|
|
74
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "gracePeriodEndDate")),
|
|
75
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "parentProductId")),
|
|
76
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "productId")),
|
|
77
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "productType")),
|
|
78
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "purchaseDate")),
|
|
79
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
80
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "receiptId")),
|
|
81
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "renewalDate")),
|
|
82
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "term")),
|
|
83
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "termSku")),
|
|
84
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "testTransaction"))
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroReceiptValidationResultAndroid& arg) {
|
|
88
|
+
jsi::Object obj(runtime);
|
|
89
|
+
obj.setProperty(runtime, "autoRenewing", JSIConverter<bool>::toJSI(runtime, arg.autoRenewing));
|
|
90
|
+
obj.setProperty(runtime, "betaProduct", JSIConverter<bool>::toJSI(runtime, arg.betaProduct));
|
|
91
|
+
obj.setProperty(runtime, "cancelDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.cancelDate));
|
|
92
|
+
obj.setProperty(runtime, "cancelReason", JSIConverter<std::string>::toJSI(runtime, arg.cancelReason));
|
|
93
|
+
obj.setProperty(runtime, "deferredDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.deferredDate));
|
|
94
|
+
obj.setProperty(runtime, "deferredSku", JSIConverter<std::optional<double>>::toJSI(runtime, arg.deferredSku));
|
|
95
|
+
obj.setProperty(runtime, "freeTrialEndDate", JSIConverter<double>::toJSI(runtime, arg.freeTrialEndDate));
|
|
96
|
+
obj.setProperty(runtime, "gracePeriodEndDate", JSIConverter<double>::toJSI(runtime, arg.gracePeriodEndDate));
|
|
97
|
+
obj.setProperty(runtime, "parentProductId", JSIConverter<std::string>::toJSI(runtime, arg.parentProductId));
|
|
98
|
+
obj.setProperty(runtime, "productId", JSIConverter<std::string>::toJSI(runtime, arg.productId));
|
|
99
|
+
obj.setProperty(runtime, "productType", JSIConverter<std::string>::toJSI(runtime, arg.productType));
|
|
100
|
+
obj.setProperty(runtime, "purchaseDate", JSIConverter<double>::toJSI(runtime, arg.purchaseDate));
|
|
101
|
+
obj.setProperty(runtime, "quantity", JSIConverter<double>::toJSI(runtime, arg.quantity));
|
|
102
|
+
obj.setProperty(runtime, "receiptId", JSIConverter<std::string>::toJSI(runtime, arg.receiptId));
|
|
103
|
+
obj.setProperty(runtime, "renewalDate", JSIConverter<double>::toJSI(runtime, arg.renewalDate));
|
|
104
|
+
obj.setProperty(runtime, "term", JSIConverter<std::string>::toJSI(runtime, arg.term));
|
|
105
|
+
obj.setProperty(runtime, "termSku", JSIConverter<std::string>::toJSI(runtime, arg.termSku));
|
|
106
|
+
obj.setProperty(runtime, "testTransaction", JSIConverter<bool>::toJSI(runtime, arg.testTransaction));
|
|
107
|
+
return obj;
|
|
108
|
+
}
|
|
109
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
110
|
+
if (!value.isObject()) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
jsi::Object obj = value.getObject(runtime);
|
|
114
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "autoRenewing"))) return false;
|
|
115
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "betaProduct"))) return false;
|
|
116
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "cancelDate"))) return false;
|
|
117
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "cancelReason"))) return false;
|
|
118
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "deferredDate"))) return false;
|
|
119
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "deferredSku"))) return false;
|
|
120
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "freeTrialEndDate"))) return false;
|
|
121
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "gracePeriodEndDate"))) return false;
|
|
122
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "parentProductId"))) return false;
|
|
123
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "productId"))) return false;
|
|
124
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "productType"))) return false;
|
|
125
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "purchaseDate"))) return false;
|
|
126
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
127
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "receiptId"))) return false;
|
|
128
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "renewalDate"))) return false;
|
|
129
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "term"))) return false;
|
|
130
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "termSku"))) return false;
|
|
131
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "testTransaction"))) return false;
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroReceiptValidationResultIOS.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `NitroPurchase` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::iap { struct NitroPurchase; }
|
|
23
|
+
|
|
24
|
+
#include <string>
|
|
25
|
+
#include "NitroPurchase.hpp"
|
|
26
|
+
#include <optional>
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::iap {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A struct which can be represented as a JavaScript object (NitroReceiptValidationResultIOS).
|
|
32
|
+
*/
|
|
33
|
+
struct NitroReceiptValidationResultIOS {
|
|
34
|
+
public:
|
|
35
|
+
bool isValid SWIFT_PRIVATE;
|
|
36
|
+
std::string receiptData SWIFT_PRIVATE;
|
|
37
|
+
std::string jwsRepresentation SWIFT_PRIVATE;
|
|
38
|
+
std::optional<NitroPurchase> latestTransaction SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroReceiptValidationResultIOS() = default;
|
|
42
|
+
explicit NitroReceiptValidationResultIOS(bool isValid, std::string receiptData, std::string jwsRepresentation, std::optional<NitroPurchase> latestTransaction): isValid(isValid), receiptData(receiptData), jwsRepresentation(jwsRepresentation), latestTransaction(latestTransaction) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroReceiptValidationResultIOS <> JS NitroReceiptValidationResultIOS (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroReceiptValidationResultIOS> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroReceiptValidationResultIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroReceiptValidationResultIOS(
|
|
55
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isValid")),
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "receiptData")),
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "jwsRepresentation")),
|
|
58
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroPurchase>>::fromJSI(runtime, obj.getProperty(runtime, "latestTransaction"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroReceiptValidationResultIOS& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "isValid", JSIConverter<bool>::toJSI(runtime, arg.isValid));
|
|
64
|
+
obj.setProperty(runtime, "receiptData", JSIConverter<std::string>::toJSI(runtime, arg.receiptData));
|
|
65
|
+
obj.setProperty(runtime, "jwsRepresentation", JSIConverter<std::string>::toJSI(runtime, arg.jwsRepresentation));
|
|
66
|
+
obj.setProperty(runtime, "latestTransaction", JSIConverter<std::optional<margelo::nitro::iap::NitroPurchase>>::toJSI(runtime, arg.latestTransaction));
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
70
|
+
if (!value.isObject()) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
jsi::Object obj = value.getObject(runtime);
|
|
74
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isValid"))) return false;
|
|
75
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "receiptData"))) return false;
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "jwsRepresentation"))) return false;
|
|
77
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroPurchase>>::canConvert(runtime, obj.getProperty(runtime, "latestTransaction"))) return false;
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroRequestPurchaseAndroid.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `NitroSubscriptionOffer` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::iap { struct NitroSubscriptionOffer; }
|
|
23
|
+
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <vector>
|
|
26
|
+
#include <optional>
|
|
27
|
+
#include "NitroSubscriptionOffer.hpp"
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::iap {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A struct which can be represented as a JavaScript object (NitroRequestPurchaseAndroid).
|
|
33
|
+
*/
|
|
34
|
+
struct NitroRequestPurchaseAndroid {
|
|
35
|
+
public:
|
|
36
|
+
std::vector<std::string> skus SWIFT_PRIVATE;
|
|
37
|
+
std::optional<std::string> obfuscatedAccountIdAndroid SWIFT_PRIVATE;
|
|
38
|
+
std::optional<std::string> obfuscatedProfileIdAndroid SWIFT_PRIVATE;
|
|
39
|
+
std::optional<bool> isOfferPersonalized SWIFT_PRIVATE;
|
|
40
|
+
std::optional<std::vector<NitroSubscriptionOffer>> subscriptionOffers SWIFT_PRIVATE;
|
|
41
|
+
std::optional<double> replacementModeAndroid SWIFT_PRIVATE;
|
|
42
|
+
std::optional<std::string> purchaseTokenAndroid SWIFT_PRIVATE;
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
NitroRequestPurchaseAndroid() = default;
|
|
46
|
+
explicit NitroRequestPurchaseAndroid(std::vector<std::string> skus, std::optional<std::string> obfuscatedAccountIdAndroid, std::optional<std::string> obfuscatedProfileIdAndroid, std::optional<bool> isOfferPersonalized, std::optional<std::vector<NitroSubscriptionOffer>> subscriptionOffers, std::optional<double> replacementModeAndroid, std::optional<std::string> purchaseTokenAndroid): skus(skus), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), isOfferPersonalized(isOfferPersonalized), subscriptionOffers(subscriptionOffers), replacementModeAndroid(replacementModeAndroid), purchaseTokenAndroid(purchaseTokenAndroid) {}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::iap
|
|
50
|
+
|
|
51
|
+
namespace margelo::nitro {
|
|
52
|
+
|
|
53
|
+
// C++ NitroRequestPurchaseAndroid <> JS NitroRequestPurchaseAndroid (object)
|
|
54
|
+
template <>
|
|
55
|
+
struct JSIConverter<margelo::nitro::iap::NitroRequestPurchaseAndroid> final {
|
|
56
|
+
static inline margelo::nitro::iap::NitroRequestPurchaseAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
+
return margelo::nitro::iap::NitroRequestPurchaseAndroid(
|
|
59
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "skus")),
|
|
60
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid")),
|
|
61
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid")),
|
|
62
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "isOfferPersonalized")),
|
|
63
|
+
JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroSubscriptionOffer>>>::fromJSI(runtime, obj.getProperty(runtime, "subscriptionOffers")),
|
|
64
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "replacementModeAndroid")),
|
|
65
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purchaseTokenAndroid"))
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRequestPurchaseAndroid& arg) {
|
|
69
|
+
jsi::Object obj(runtime);
|
|
70
|
+
obj.setProperty(runtime, "skus", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.skus));
|
|
71
|
+
obj.setProperty(runtime, "obfuscatedAccountIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedAccountIdAndroid));
|
|
72
|
+
obj.setProperty(runtime, "obfuscatedProfileIdAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.obfuscatedProfileIdAndroid));
|
|
73
|
+
obj.setProperty(runtime, "isOfferPersonalized", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isOfferPersonalized));
|
|
74
|
+
obj.setProperty(runtime, "subscriptionOffers", JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroSubscriptionOffer>>>::toJSI(runtime, arg.subscriptionOffers));
|
|
75
|
+
obj.setProperty(runtime, "replacementModeAndroid", JSIConverter<std::optional<double>>::toJSI(runtime, arg.replacementModeAndroid));
|
|
76
|
+
obj.setProperty(runtime, "purchaseTokenAndroid", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purchaseTokenAndroid));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "skus"))) return false;
|
|
85
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedAccountIdAndroid"))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "obfuscatedProfileIdAndroid"))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "isOfferPersonalized"))) return false;
|
|
88
|
+
if (!JSIConverter<std::optional<std::vector<margelo::nitro::iap::NitroSubscriptionOffer>>>::canConvert(runtime, obj.getProperty(runtime, "subscriptionOffers"))) return false;
|
|
89
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "replacementModeAndroid"))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purchaseTokenAndroid"))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroRequestPurchaseIos.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <optional>
|
|
25
|
+
#include <unordered_map>
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::iap {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A struct which can be represented as a JavaScript object (NitroRequestPurchaseIos).
|
|
31
|
+
*/
|
|
32
|
+
struct NitroRequestPurchaseIos {
|
|
33
|
+
public:
|
|
34
|
+
std::string sku SWIFT_PRIVATE;
|
|
35
|
+
std::optional<bool> andDangerouslyFinishTransactionAutomatically SWIFT_PRIVATE;
|
|
36
|
+
std::optional<std::string> appAccountToken SWIFT_PRIVATE;
|
|
37
|
+
std::optional<double> quantity SWIFT_PRIVATE;
|
|
38
|
+
std::optional<std::unordered_map<std::string, std::string>> withOffer SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroRequestPurchaseIos() = default;
|
|
42
|
+
explicit NitroRequestPurchaseIos(std::string sku, std::optional<bool> andDangerouslyFinishTransactionAutomatically, std::optional<std::string> appAccountToken, std::optional<double> quantity, std::optional<std::unordered_map<std::string, std::string>> withOffer): sku(sku), andDangerouslyFinishTransactionAutomatically(andDangerouslyFinishTransactionAutomatically), appAccountToken(appAccountToken), quantity(quantity), withOffer(withOffer) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroRequestPurchaseIos <> JS NitroRequestPurchaseIos (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroRequestPurchaseIos> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroRequestPurchaseIos fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroRequestPurchaseIos(
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "sku")),
|
|
56
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "andDangerouslyFinishTransactionAutomatically")),
|
|
57
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "appAccountToken")),
|
|
58
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
|
|
59
|
+
JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "withOffer"))
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroRequestPurchaseIos& arg) {
|
|
63
|
+
jsi::Object obj(runtime);
|
|
64
|
+
obj.setProperty(runtime, "sku", JSIConverter<std::string>::toJSI(runtime, arg.sku));
|
|
65
|
+
obj.setProperty(runtime, "andDangerouslyFinishTransactionAutomatically", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.andDangerouslyFinishTransactionAutomatically));
|
|
66
|
+
obj.setProperty(runtime, "appAccountToken", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.appAccountToken));
|
|
67
|
+
obj.setProperty(runtime, "quantity", JSIConverter<std::optional<double>>::toJSI(runtime, arg.quantity));
|
|
68
|
+
obj.setProperty(runtime, "withOffer", JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::toJSI(runtime, arg.withOffer));
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
72
|
+
if (!value.isObject()) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
jsi::Object obj = value.getObject(runtime);
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "sku"))) return false;
|
|
77
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "andDangerouslyFinishTransactionAutomatically"))) return false;
|
|
78
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "appAccountToken"))) return false;
|
|
79
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
|
|
80
|
+
if (!JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::canConvert(runtime, obj.getProperty(runtime, "withOffer"))) return false;
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSubscriptionOffer.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::iap {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (NitroSubscriptionOffer).
|
|
29
|
+
*/
|
|
30
|
+
struct NitroSubscriptionOffer {
|
|
31
|
+
public:
|
|
32
|
+
std::string sku SWIFT_PRIVATE;
|
|
33
|
+
std::string offerToken SWIFT_PRIVATE;
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
NitroSubscriptionOffer() = default;
|
|
37
|
+
explicit NitroSubscriptionOffer(std::string sku, std::string offerToken): sku(sku), offerToken(offerToken) {}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
} // namespace margelo::nitro::iap
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro {
|
|
43
|
+
|
|
44
|
+
// C++ NitroSubscriptionOffer <> JS NitroSubscriptionOffer (object)
|
|
45
|
+
template <>
|
|
46
|
+
struct JSIConverter<margelo::nitro::iap::NitroSubscriptionOffer> final {
|
|
47
|
+
static inline margelo::nitro::iap::NitroSubscriptionOffer fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
49
|
+
return margelo::nitro::iap::NitroSubscriptionOffer(
|
|
50
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "sku")),
|
|
51
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "offerToken"))
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroSubscriptionOffer& arg) {
|
|
55
|
+
jsi::Object obj(runtime);
|
|
56
|
+
obj.setProperty(runtime, "sku", JSIConverter<std::string>::toJSI(runtime, arg.sku));
|
|
57
|
+
obj.setProperty(runtime, "offerToken", JSIConverter<std::string>::toJSI(runtime, arg.offerToken));
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
61
|
+
if (!value.isObject()) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
jsi::Object obj = value.getObject(runtime);
|
|
65
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "sku"))) return false;
|
|
66
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "offerToken"))) return false;
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSubscriptionRenewalInfo.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <optional>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::iap {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A struct which can be represented as a JavaScript object (NitroSubscriptionRenewalInfo).
|
|
30
|
+
*/
|
|
31
|
+
struct NitroSubscriptionRenewalInfo {
|
|
32
|
+
public:
|
|
33
|
+
bool autoRenewStatus SWIFT_PRIVATE;
|
|
34
|
+
std::optional<std::string> autoRenewPreference SWIFT_PRIVATE;
|
|
35
|
+
std::optional<double> expirationReason SWIFT_PRIVATE;
|
|
36
|
+
std::optional<double> gracePeriodExpirationDate SWIFT_PRIVATE;
|
|
37
|
+
std::optional<std::string> currentProductID SWIFT_PRIVATE;
|
|
38
|
+
std::string platform SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
NitroSubscriptionRenewalInfo() = default;
|
|
42
|
+
explicit NitroSubscriptionRenewalInfo(bool autoRenewStatus, std::optional<std::string> autoRenewPreference, std::optional<double> expirationReason, std::optional<double> gracePeriodExpirationDate, std::optional<std::string> currentProductID, std::string platform): autoRenewStatus(autoRenewStatus), autoRenewPreference(autoRenewPreference), expirationReason(expirationReason), gracePeriodExpirationDate(gracePeriodExpirationDate), currentProductID(currentProductID), platform(platform) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::iap
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
// C++ NitroSubscriptionRenewalInfo <> JS NitroSubscriptionRenewalInfo (object)
|
|
50
|
+
template <>
|
|
51
|
+
struct JSIConverter<margelo::nitro::iap::NitroSubscriptionRenewalInfo> final {
|
|
52
|
+
static inline margelo::nitro::iap::NitroSubscriptionRenewalInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
+
return margelo::nitro::iap::NitroSubscriptionRenewalInfo(
|
|
55
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "autoRenewStatus")),
|
|
56
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "autoRenewPreference")),
|
|
57
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "expirationReason")),
|
|
58
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "gracePeriodExpirationDate")),
|
|
59
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "currentProductID")),
|
|
60
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "platform"))
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroSubscriptionRenewalInfo& arg) {
|
|
64
|
+
jsi::Object obj(runtime);
|
|
65
|
+
obj.setProperty(runtime, "autoRenewStatus", JSIConverter<bool>::toJSI(runtime, arg.autoRenewStatus));
|
|
66
|
+
obj.setProperty(runtime, "autoRenewPreference", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.autoRenewPreference));
|
|
67
|
+
obj.setProperty(runtime, "expirationReason", JSIConverter<std::optional<double>>::toJSI(runtime, arg.expirationReason));
|
|
68
|
+
obj.setProperty(runtime, "gracePeriodExpirationDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.gracePeriodExpirationDate));
|
|
69
|
+
obj.setProperty(runtime, "currentProductID", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currentProductID));
|
|
70
|
+
obj.setProperty(runtime, "platform", JSIConverter<std::string>::toJSI(runtime, arg.platform));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "autoRenewStatus"))) return false;
|
|
79
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "autoRenewPreference"))) return false;
|
|
80
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "expirationReason"))) return false;
|
|
81
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "gracePeriodExpirationDate"))) return false;
|
|
82
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "currentProductID"))) return false;
|
|
83
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSubscriptionStatus.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration of `NitroSubscriptionRenewalInfo` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::iap { struct NitroSubscriptionRenewalInfo; }
|
|
23
|
+
|
|
24
|
+
#include <string>
|
|
25
|
+
#include "NitroSubscriptionRenewalInfo.hpp"
|
|
26
|
+
#include <optional>
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::iap {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A struct which can be represented as a JavaScript object (NitroSubscriptionStatus).
|
|
32
|
+
*/
|
|
33
|
+
struct NitroSubscriptionStatus {
|
|
34
|
+
public:
|
|
35
|
+
double state SWIFT_PRIVATE;
|
|
36
|
+
std::string platform SWIFT_PRIVATE;
|
|
37
|
+
std::optional<NitroSubscriptionRenewalInfo> renewalInfo SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
NitroSubscriptionStatus() = default;
|
|
41
|
+
explicit NitroSubscriptionStatus(double state, std::string platform, std::optional<NitroSubscriptionRenewalInfo> renewalInfo): state(state), platform(platform), renewalInfo(renewalInfo) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::iap
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ NitroSubscriptionStatus <> JS NitroSubscriptionStatus (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::iap::NitroSubscriptionStatus> final {
|
|
51
|
+
static inline margelo::nitro::iap::NitroSubscriptionStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::iap::NitroSubscriptionStatus(
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "state")),
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "platform")),
|
|
56
|
+
JSIConverter<std::optional<margelo::nitro::iap::NitroSubscriptionRenewalInfo>>::fromJSI(runtime, obj.getProperty(runtime, "renewalInfo"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroSubscriptionStatus& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "state", JSIConverter<double>::toJSI(runtime, arg.state));
|
|
62
|
+
obj.setProperty(runtime, "platform", JSIConverter<std::string>::toJSI(runtime, arg.platform));
|
|
63
|
+
obj.setProperty(runtime, "renewalInfo", JSIConverter<std::optional<margelo::nitro::iap::NitroSubscriptionRenewalInfo>>::toJSI(runtime, arg.renewalInfo));
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
67
|
+
if (!value.isObject()) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
jsi::Object obj = value.getObject(runtime);
|
|
71
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
|
|
72
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "platform"))) return false;
|
|
73
|
+
if (!JSIConverter<std::optional<margelo::nitro::iap::NitroSubscriptionRenewalInfo>>::canConvert(runtime, obj.getProperty(runtime, "renewalInfo"))) return false;
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro
|