@voidhash/nitro-ui 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/Package.swift +161 -0
- package/README.md +127 -2
- package/android/nitro-ui.gradle +35 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/HybridVoidhashNativeClient.kt +53 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/VoidhashNitroUIModule.kt +65 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/client/LegacyStorageImporter.kt +526 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/client/SdkBackedNativeClient.kt +1131 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/client/StoreMapping.kt +257 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/client/VoidhashFlowPermissionHandlers.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/voidhash/flows/VoidhashFlowsCore.kt +93 -0
- package/build/chunk-5LFKYB24.js +331 -0
- package/build/chunk-5LFKYB24.js.map +1 -0
- package/build/index.d.ts +2870 -0
- package/build/index.js +4183 -0
- package/build/index.js.map +1 -0
- package/build/navigation.d.ts +66 -0
- package/build/navigation.js +72 -0
- package/build/navigation.js.map +1 -0
- package/ios/HybridVoidhashNativeClient.swift +427 -0
- package/ios/Shared/NativeClientMapping.swift +184 -0
- package/ios/Shared/NativeStoreJson.swift +126 -0
- package/ios/Shared/VoidhashCoreExports.swift +5 -0
- package/ios/Shared/VoidhashLegacyImporter.swift +686 -0
- package/ios/Shared/VoidhashNativeClientCore.swift +1401 -0
- package/nitro.json +8 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroVoidhash+autolinking.cmake +86 -0
- package/nitrogen/generated/android/NitroVoidhash+autolinking.gradle +10 -0
- package/nitrogen/generated/android/NitroVoidhashOnLoad.cpp +22 -0
- package/nitrogen/generated/android/c++/JCallback_Promise_std__string__std__string_std__string.cpp +57 -0
- package/nitrogen/generated/android/c++/JCallback_void_NativeClientEvent.cpp +55 -0
- package/nitrogen/generated/android/c++/JHybridVoidhashNativeClientSpec.cpp +387 -0
- package/nitrogen/generated/android/c++/JNativeAnalyticsConsent.cpp +55 -0
- package/nitrogen/generated/android/c++/JNativeAppStoreMessages.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeAppStorePurchaseOptions.cpp +36 -0
- package/nitrogen/generated/android/c++/JNativeAppStoreSubscriptionState.cpp +64 -0
- package/nitrogen/generated/android/c++/JNativeAppStoreSubscriptionStatus.cpp +38 -0
- package/nitrogen/generated/android/c++/JNativeClientConfiguration.cpp +75 -0
- package/nitrogen/generated/android/c++/JNativeClientEvent.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeClientEventType.cpp +70 -0
- package/nitrogen/generated/android/c++/JNativeDiagnostic.cpp +44 -0
- package/nitrogen/generated/android/c++/JNativeDiagnosticKind.cpp +67 -0
- package/nitrogen/generated/android/c++/JNativeEnvironment.cpp +61 -0
- package/nitrogen/generated/android/c++/JNativeFeatureFlag.cpp +41 -0
- package/nitrogen/generated/android/c++/JNativeFeatureFlagsResult.cpp +45 -0
- package/nitrogen/generated/android/c++/JNativeFlowCapability.cpp +58 -0
- package/nitrogen/generated/android/c++/JNativeFlowLoading.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeFlowPresentation.cpp +42 -0
- package/nitrogen/generated/android/c++/JNativeFlowRevision.cpp +37 -0
- package/nitrogen/generated/android/c++/JNativeFlowRuntime.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeFlushStatus.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeFreshnessReason.cpp +58 -0
- package/nitrogen/generated/android/c++/JNativeGooglePlayPurchaseOptions.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeIdentifyResult.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeIdentityChange.cpp +38 -0
- package/nitrogen/generated/android/c++/JNativeInAppMessageResult.cpp +38 -0
- package/nitrogen/generated/android/c++/JNativeInAppMessageStatus.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeOffer.cpp +44 -0
- package/nitrogen/generated/android/c++/JNativeOfferKind.cpp +61 -0
- package/nitrogen/generated/android/c++/JNativeOfferSelection.cpp +55 -0
- package/nitrogen/generated/android/c++/JNativePaymentMode.cpp +58 -0
- package/nitrogen/generated/android/c++/JNativePendingAnalytics.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativePeriod.cpp +39 -0
- package/nitrogen/generated/android/c++/JNativePeriodUnit.cpp +61 -0
- package/nitrogen/generated/android/c++/JNativePersonState.cpp +44 -0
- package/nitrogen/generated/android/c++/JNativePersonWriteResult.cpp +38 -0
- package/nitrogen/generated/android/c++/JNativePrice.cpp +39 -0
- package/nitrogen/generated/android/c++/JNativePricingPhase.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeProduct.cpp +55 -0
- package/nitrogen/generated/android/c++/JNativeProductType.cpp +61 -0
- package/nitrogen/generated/android/c++/JNativePurchaseIntent.cpp +38 -0
- package/nitrogen/generated/android/c++/JNativePurchaseIntents.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativePurchaseOptions.cpp +49 -0
- package/nitrogen/generated/android/c++/JNativePurchaseOutcome.cpp +55 -0
- package/nitrogen/generated/android/c++/JNativePurchaseResult.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeRefundRequestStatus.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeReportedPurchaseState.cpp +55 -0
- package/nitrogen/generated/android/c++/JNativeReportedTransaction.cpp +42 -0
- package/nitrogen/generated/android/c++/JNativeStore.cpp +58 -0
- package/nitrogen/generated/android/c++/JNativeStorePlatform.cpp +52 -0
- package/nitrogen/generated/android/c++/JNativeStorefront.cpp +37 -0
- package/nitrogen/generated/android/c++/JNativeSubscriptionInfo.cpp +45 -0
- package/nitrogen/generated/android/c++/JNativeSubscriptionReplacement.cpp +36 -0
- package/nitrogen/generated/android/c++/JNativeSubscriptionReplacementMode.cpp +61 -0
- package/nitrogen/generated/android/c++/JNativeTransaction.cpp +53 -0
- package/nitrogen/generated/android/c++/JNativeTransactionOffer.cpp +40 -0
- package/nitrogen/generated/android/c++/JNativeTransactionOfferKind.cpp +64 -0
- package/nitrogen/generated/android/c++/JNativeTransactionUpdate.cpp +36 -0
- package/nitrogen/generated/android/c++/JNativeWriteStatus.cpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JCallback_Promise_std__string__std__string_std__string.hpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JCallback_void_NativeClientEvent.hpp +54 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JHybridVoidhashNativeClientSpec.hpp +166 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JHybridVoidhashNativeClientSpecJavaPart.hpp +26 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAnalyticsConsent.hpp +77 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreMessages.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStorePurchaseOptions.hpp +51 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreSubscriptionState.hpp +92 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreSubscriptionStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientConfiguration.hpp +190 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientEvent.hpp +99 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientEventType.hpp +102 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeDiagnostic.hpp +79 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeDiagnosticKind.hpp +97 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeEnvironment.hpp +87 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFeatureFlag.hpp +68 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFeatureFlagsResult.hpp +76 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowCapability.hpp +82 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowLoading.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowPresentation.hpp +65 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowRevision.hpp +56 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowRuntime.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlushStatus.hpp +63 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFreshnessReason.hpp +82 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeGooglePlayPurchaseOptions.hpp +63 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeIdentifyResult.hpp +63 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeIdentityChange.hpp +61 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeInAppMessageResult.hpp +57 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeInAppMessageStatus.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOffer.hpp +71 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOfferKind.hpp +87 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOfferSelection.hpp +77 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePaymentMode.hpp +82 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePendingAnalytics.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePeriod.hpp +62 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePeriodUnit.hpp +87 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePersonState.hpp +79 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePersonWriteResult.hpp +57 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePrice.hpp +66 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePricingPhase.hpp +67 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeProduct.hpp +118 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeProductType.hpp +87 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseIntent.hpp +57 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseIntents.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseOptions.hpp +88 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseOutcome.hpp +77 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseResult.hpp +63 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeRefundRequestStatus.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeReportedPurchaseState.hpp +77 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeReportedTransaction.hpp +73 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStore.hpp +82 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStorePlatform.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStorefront.hpp +56 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionInfo.hpp +84 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionReplacement.hpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionReplacementMode.hpp +87 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransaction.hpp +116 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionOffer.hpp +63 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionOfferKind.hpp +92 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionUpdate.hpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeWriteStatus.hpp +77 -0
- package/nitrogen/generated/android/include/NitroVoidhash/private/NitroVoidhashOnLoad.hpp +13 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/Callback_Promise_std__string__std__string_std__string.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/Callback_void_NativeClientEvent.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/HybridVoidhashNativeClientSpec.kt +278 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAnalyticsConsent.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreMessages.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStorePurchaseOptions.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreSubscriptionState.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreSubscriptionStatus.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientConfiguration.kt +172 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientEvent.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientEventType.kt +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeDiagnostic.kt +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeDiagnosticKind.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeEnvironment.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFeatureFlag.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFeatureFlagsResult.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowCapability.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowLoading.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowPresentation.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowRevision.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowRuntime.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlushStatus.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFreshnessReason.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeGooglePlayPurchaseOptions.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeIdentifyResult.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeIdentityChange.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeInAppMessageResult.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeInAppMessageStatus.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOffer.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOfferKind.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOfferSelection.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePaymentMode.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePendingAnalytics.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePeriod.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePeriodUnit.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePersonState.kt +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePersonWriteResult.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePrice.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePricingPhase.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeProduct.kt +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeProductType.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseIntent.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseIntents.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseOptions.kt +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseOutcome.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseResult.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeRefundRequestStatus.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeReportedPurchaseState.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeReportedTransaction.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStore.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStorePlatform.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStorefront.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionInfo.kt +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionReplacement.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionReplacementMode.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransaction.kt +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionOffer.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionOfferKind.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionUpdate.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeWriteStatus.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NitroVoidhashOnLoad.kt +22 -0
- package/nitrogen/generated/apple/NitroVoidhash-Swift-Cxx-Bridge.cpp +381 -0
- package/nitrogen/generated/apple/NitroVoidhashAppleCxx/NitroVoidhashAppleCxx.cpp +9 -0
- package/nitrogen/generated/apple/NitroVoidhashAppleCxx/include/NitroVoidhashAppleCxx/NitroVoidhashAppleCxx.h +265 -0
- package/nitrogen/generated/apple/NitroVoidhashAutolinking.cpp +20 -0
- package/nitrogen/generated/apple/NitroVoidhashAutolinking.mm +24 -0
- package/nitrogen/generated/apple/c++/HybridVoidhashNativeClientSpecSwift.cpp +555 -0
- package/nitrogen/generated/apple/c++/HybridVoidhashNativeClientSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/NativeAnalyticsConsent-Swift.cpp +49 -0
- package/nitrogen/generated/apple/c++/NativeAppStoreMessages-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeAppStorePurchaseOptions-Swift.cpp +32 -0
- package/nitrogen/generated/apple/c++/NativeAppStoreSubscriptionState-Swift.cpp +58 -0
- package/nitrogen/generated/apple/c++/NativeAppStoreSubscriptionStatus-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeClientConfiguration-Swift.cpp +57 -0
- package/nitrogen/generated/apple/c++/NativeClientEvent-Swift.cpp +40 -0
- package/nitrogen/generated/apple/c++/NativeClientEventType-Swift.cpp +64 -0
- package/nitrogen/generated/apple/c++/NativeDiagnostic-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/NativeDiagnosticKind-Swift.cpp +61 -0
- package/nitrogen/generated/apple/c++/NativeEnvironment-Swift.cpp +55 -0
- package/nitrogen/generated/apple/c++/NativeFeatureFlag-Swift.cpp +35 -0
- package/nitrogen/generated/apple/c++/NativeFeatureFlagsResult-Swift.cpp +36 -0
- package/nitrogen/generated/apple/c++/NativeFlowCapability-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/NativeFlowLoading-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeFlowPresentation-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeFlowRevision-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativeFlowRuntime-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeFlushStatus-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeFreshnessReason-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/NativeGooglePlayPurchaseOptions-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeIdentifyResult-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeIdentityChange-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeInAppMessageResult-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativeInAppMessageStatus-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeOffer-Swift.cpp +35 -0
- package/nitrogen/generated/apple/c++/NativeOfferKind-Swift.cpp +55 -0
- package/nitrogen/generated/apple/c++/NativeOfferSelection-Swift.cpp +49 -0
- package/nitrogen/generated/apple/c++/NativePaymentMode-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/NativePendingAnalytics-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativePeriod-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativePeriodUnit-Swift.cpp +55 -0
- package/nitrogen/generated/apple/c++/NativePersonState-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/NativePersonWriteResult-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativePrice-Swift.cpp +35 -0
- package/nitrogen/generated/apple/c++/NativePricingPhase-Swift.cpp +35 -0
- package/nitrogen/generated/apple/c++/NativeProduct-Swift.cpp +44 -0
- package/nitrogen/generated/apple/c++/NativeProductType-Swift.cpp +55 -0
- package/nitrogen/generated/apple/c++/NativePurchaseIntent-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativePurchaseIntents-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativePurchaseOptions-Swift.cpp +38 -0
- package/nitrogen/generated/apple/c++/NativePurchaseOutcome-Swift.cpp +49 -0
- package/nitrogen/generated/apple/c++/NativePurchaseResult-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeRefundRequestStatus-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeReportedPurchaseState-Swift.cpp +49 -0
- package/nitrogen/generated/apple/c++/NativeReportedTransaction-Swift.cpp +36 -0
- package/nitrogen/generated/apple/c++/NativeStore-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/NativeStorePlatform-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/NativeStorefront-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativeSubscriptionInfo-Swift.cpp +38 -0
- package/nitrogen/generated/apple/c++/NativeSubscriptionReplacement-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativeSubscriptionReplacementMode-Swift.cpp +55 -0
- package/nitrogen/generated/apple/c++/NativeTransaction-Swift.cpp +44 -0
- package/nitrogen/generated/apple/c++/NativeTransactionOffer-Swift.cpp +34 -0
- package/nitrogen/generated/apple/c++/NativeTransactionOfferKind-Swift.cpp +58 -0
- package/nitrogen/generated/apple/c++/NativeTransactionUpdate-Swift.cpp +33 -0
- package/nitrogen/generated/apple/c++/NativeWriteStatus-Swift.cpp +49 -0
- package/nitrogen/generated/apple/c++/Record_swift__String_bool-Swift.cpp +26 -0
- package/nitrogen/generated/apple/c++/Record_swift__String_swift__String-Swift.cpp +26 -0
- package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_-Swift.cpp +38 -0
- package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_-Swift.cpp +41 -0
- package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_-Swift.cpp +36 -0
- package/nitrogen/generated/apple/c++/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_-Swift.cpp +30 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/NitroVoidhashAutolinking.hpp +13 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/HybridVoidhashNativeClientSpecSwift.hpp +121 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/HybridVoidhashNativeClientSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAnalyticsConsent-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreMessages-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStorePurchaseOptions-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreSubscriptionState-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreSubscriptionStatus-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientConfiguration-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientEvent-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientEventType-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeDiagnostic-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeDiagnosticKind-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeEnvironment-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFeatureFlag-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFeatureFlagsResult-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowCapability-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowLoading-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowPresentation-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowRevision-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowRuntime-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlushStatus-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFreshnessReason-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeGooglePlayPurchaseOptions-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeIdentifyResult-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeIdentityChange-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeInAppMessageResult-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeInAppMessageStatus-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOffer-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOfferKind-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOfferSelection-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePaymentMode-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePendingAnalytics-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePeriod-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePeriodUnit-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePersonState-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePersonWriteResult-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePrice-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePricingPhase-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeProduct-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeProductType-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseIntent-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseIntents-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseOptions-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseOutcome-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseResult-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeRefundRequestStatus-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeReportedPurchaseState-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeReportedTransaction-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStore-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStorePlatform-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStorefront-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionInfo-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionReplacement-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionReplacementMode-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransaction-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionOffer-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionOfferKind-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionUpdate-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeWriteStatus-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NitroVoidhash-Swift-Cxx-Umbrella.hpp +100 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/Record_swift__String_bool-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/Record_swift__String_swift__String-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
- package/nitrogen/generated/apple/swift/Callback_Promise_swift__String__swift__String_swift__String.swift +73 -0
- package/nitrogen/generated/apple/swift/Callback_void___NitroVoidhash__NativeClientEvent.swift +66 -0
- package/nitrogen/generated/apple/swift/HybridVoidhashNativeClientSpec.swift +113 -0
- package/nitrogen/generated/apple/swift/HybridVoidhashNativeClientSpec_cxx.swift +629 -0
- package/nitrogen/generated/apple/swift/NativeAnalyticsConsent.swift +59 -0
- package/nitrogen/generated/apple/swift/NativeAppStoreMessages.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeAppStorePurchaseOptions.swift +28 -0
- package/nitrogen/generated/apple/swift/NativeAppStoreSubscriptionState.swift +74 -0
- package/nitrogen/generated/apple/swift/NativeAppStoreSubscriptionStatus.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeClientConfiguration.swift +203 -0
- package/nitrogen/generated/apple/swift/NativeClientEvent.swift +84 -0
- package/nitrogen/generated/apple/swift/NativeClientEventType.swift +84 -0
- package/nitrogen/generated/apple/swift/NativeDiagnostic.swift +63 -0
- package/nitrogen/generated/apple/swift/NativeDiagnosticKind.swift +79 -0
- package/nitrogen/generated/apple/swift/NativeEnvironment.swift +69 -0
- package/nitrogen/generated/apple/swift/NativeFeatureFlag.swift +49 -0
- package/nitrogen/generated/apple/swift/NativeFeatureFlagsResult.swift +56 -0
- package/nitrogen/generated/apple/swift/NativeFlowCapability.swift +64 -0
- package/nitrogen/generated/apple/swift/NativeFlowLoading.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeFlowPresentation.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeFlowRevision.swift +35 -0
- package/nitrogen/generated/apple/swift/NativeFlowRuntime.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeFlushStatus.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeFreshnessReason.swift +64 -0
- package/nitrogen/generated/apple/swift/NativeGooglePlayPurchaseOptions.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeIdentifyResult.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeIdentityChange.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeInAppMessageResult.swift +35 -0
- package/nitrogen/generated/apple/swift/NativeInAppMessageStatus.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeOffer.swift +49 -0
- package/nitrogen/generated/apple/swift/NativeOfferKind.swift +69 -0
- package/nitrogen/generated/apple/swift/NativeOfferSelection.swift +59 -0
- package/nitrogen/generated/apple/swift/NativePaymentMode.swift +64 -0
- package/nitrogen/generated/apple/swift/NativePendingAnalytics.swift +54 -0
- package/nitrogen/generated/apple/swift/NativePeriod.swift +42 -0
- package/nitrogen/generated/apple/swift/NativePeriodUnit.swift +69 -0
- package/nitrogen/generated/apple/swift/NativePersonState.swift +63 -0
- package/nitrogen/generated/apple/swift/NativePersonWriteResult.swift +35 -0
- package/nitrogen/generated/apple/swift/NativePrice.swift +49 -0
- package/nitrogen/generated/apple/swift/NativePricingPhase.swift +49 -0
- package/nitrogen/generated/apple/swift/NativeProduct.swift +112 -0
- package/nitrogen/generated/apple/swift/NativeProductType.swift +69 -0
- package/nitrogen/generated/apple/swift/NativePurchaseIntent.swift +35 -0
- package/nitrogen/generated/apple/swift/NativePurchaseIntents.swift +54 -0
- package/nitrogen/generated/apple/swift/NativePurchaseOptions.swift +70 -0
- package/nitrogen/generated/apple/swift/NativePurchaseOutcome.swift +59 -0
- package/nitrogen/generated/apple/swift/NativePurchaseResult.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeRefundRequestStatus.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeReportedPurchaseState.swift +59 -0
- package/nitrogen/generated/apple/swift/NativeReportedTransaction.swift +56 -0
- package/nitrogen/generated/apple/swift/NativeStore.swift +64 -0
- package/nitrogen/generated/apple/swift/NativeStorePlatform.swift +54 -0
- package/nitrogen/generated/apple/swift/NativeStorefront.swift +35 -0
- package/nitrogen/generated/apple/swift/NativeSubscriptionInfo.swift +70 -0
- package/nitrogen/generated/apple/swift/NativeSubscriptionReplacement.swift +35 -0
- package/nitrogen/generated/apple/swift/NativeSubscriptionReplacementMode.swift +69 -0
- package/nitrogen/generated/apple/swift/NativeTransaction.swift +112 -0
- package/nitrogen/generated/apple/swift/NativeTransactionOffer.swift +42 -0
- package/nitrogen/generated/apple/swift/NativeTransactionOfferKind.swift +74 -0
- package/nitrogen/generated/apple/swift/NativeTransactionUpdate.swift +35 -0
- package/nitrogen/generated/apple/swift/NativeWriteStatus.swift +59 -0
- package/nitrogen/generated/apple/swift/Promise_Promise_swift__String_.swift +100 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeFeatureFlagsResult.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeFlushStatus.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeIdentifyResult.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeIdentityChange.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeInAppMessageResult.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePersonState.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePersonWriteResult.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePurchaseResult.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeRefundRequestStatus.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise_bool.swift +100 -0
- package/nitrogen/generated/apple/swift/Promise_swift__String.swift +102 -0
- package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
- package/nitrogen/generated/apple/swift/Record_swift__String_bool.swift +48 -0
- package/nitrogen/generated/apple/swift/Record_swift__String_swift__String.swift +48 -0
- package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_.swift +21 -0
- package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_.swift +21 -0
- package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_.swift +21 -0
- package/nitrogen/generated/apple/swift/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_.swift +21 -0
- package/nitrogen/generated/hybrid-classes.json +19 -0
- package/nitrogen/generated/shared/c++/NitroVoidhashCxxModule.cpp +2 -0
- package/nitrogen/generated/shared/c++/include/NitroVoidhash/NitroVoidhashCxxModule.hpp +2 -0
- package/nitrogen/generated/shared/javascript/VoidhashNativeClient.cjs +19 -0
- package/nitrogen/generated/shared/javascript/VoidhashNativeClient.d.cts +9 -0
- package/package.json +103 -3
- package/src/specs/VoidhashNativeClient.nitro.ts +1162 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,2870 @@
|
|
|
1
|
+
import * as better_result from 'better-result';
|
|
2
|
+
import { Result } from 'better-result';
|
|
3
|
+
import * as Option from 'effect/Option';
|
|
4
|
+
import { AtomRegistry } from 'effect/reactivity';
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
import * as effect_Cause from 'effect/Cause';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Coarse category of a diagnostic, so hosts can route to logging versus
|
|
12
|
+
* alerting without matching on individual codes.
|
|
13
|
+
*/
|
|
14
|
+
type VoidhashDiagnosticKind = "transport" | "eviction" | "breaker" | "auth" | "cache" | "configuration" | "consent";
|
|
15
|
+
/**
|
|
16
|
+
* A non-fatal event the SDK handled on its own. Diagnostics are informational:
|
|
17
|
+
* every one of them describes a situation the SDK already recovered from
|
|
18
|
+
* (retry scheduled, cache served, event evicted). They never require the host
|
|
19
|
+
* app to act.
|
|
20
|
+
*/
|
|
21
|
+
interface VoidhashDiagnostic {
|
|
22
|
+
/** Category used for routing (logging vs. alerting). */
|
|
23
|
+
readonly kind: VoidhashDiagnosticKind;
|
|
24
|
+
/** Stable, machine-matchable identifier — see {@link DIAGNOSTIC_CODES}. */
|
|
25
|
+
readonly code: string;
|
|
26
|
+
/** SDK operation that produced the diagnostic (`capture`, `getPerson`, …). */
|
|
27
|
+
readonly operation: string;
|
|
28
|
+
/** Whether the SDK will try the same work again on its own. */
|
|
29
|
+
readonly retryable: boolean;
|
|
30
|
+
/** HTTP status behind the diagnostic, when there was a response. */
|
|
31
|
+
readonly httpStatus?: number;
|
|
32
|
+
/** Human-readable detail. Not stable; do not parse. */
|
|
33
|
+
readonly message?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Stable diagnostic codes emitted by the SDK. */
|
|
36
|
+
declare const DIAGNOSTIC_CODES: {
|
|
37
|
+
/**
|
|
38
|
+
* An analytics event was dropped: evicted because the queue hit its cap,
|
|
39
|
+
* refused by the ingest API with a verdict re-sending cannot change, or
|
|
40
|
+
* captured with properties that could not be copied into JSON.
|
|
41
|
+
*/
|
|
42
|
+
readonly ANALYTICS_EVENT_DROPPED: "ANALYTICS_EVENT_DROPPED";
|
|
43
|
+
/**
|
|
44
|
+
* Analytics work (an event, a screen, an opened notification) was skipped
|
|
45
|
+
* because analytics consent is not granted. Reported once until consent is
|
|
46
|
+
* granted again.
|
|
47
|
+
*/
|
|
48
|
+
readonly ANALYTICS_CONSENT_DENIED: "ANALYTICS_CONSENT_DENIED";
|
|
49
|
+
/** The publishable key was rejected; outbound traffic is paused. */
|
|
50
|
+
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
|
|
51
|
+
/** The store could not say which ad brought the install yet; a later launch asks again. */
|
|
52
|
+
readonly INSTALL_ATTRIBUTION_DEFERRED: "INSTALL_ATTRIBUTION_DEFERRED";
|
|
53
|
+
/** The SDK stopped asking the store which ad brought the install, without an answer. */
|
|
54
|
+
readonly INSTALL_ATTRIBUTION_ABANDONED: "INSTALL_ATTRIBUTION_ABANDONED";
|
|
55
|
+
/**
|
|
56
|
+
* Device storage could not be read, or a stored entry could not be decoded.
|
|
57
|
+
* An unreadable value counts as unknown, never as absent: the SDK does not
|
|
58
|
+
* overwrite it. A corrupt entry is discarded and treated as a miss.
|
|
59
|
+
*/
|
|
60
|
+
readonly CACHE_READ_FAILED: "CACHE_READ_FAILED";
|
|
61
|
+
/** A write to device storage failed; the value is still held in memory. */
|
|
62
|
+
readonly CACHE_WRITE_FAILED: "CACHE_WRITE_FAILED";
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated No longer emitted: the SDK has no pre-namespace entries to
|
|
65
|
+
* migrate. Kept so handlers that match on it still compile.
|
|
66
|
+
*/
|
|
67
|
+
readonly CACHE_MIGRATION_FAILED: "CACHE_MIGRATION_FAILED";
|
|
68
|
+
/** The breaker for a host is open, so the request was skipped. */
|
|
69
|
+
readonly CIRCUIT_OPEN: "CIRCUIT_OPEN";
|
|
70
|
+
/**
|
|
71
|
+
* A callback the app handed the SDK threw (a `usePurchase` callback,
|
|
72
|
+
* `screenTracking.mapScreen`, the `connectivity` source). The SDK carried on
|
|
73
|
+
* without it: the purchase kept its result, the screen was tracked unmapped.
|
|
74
|
+
*/
|
|
75
|
+
readonly HOST_CALLBACK_FAILED: "HOST_CALLBACK_FAILED";
|
|
76
|
+
/** A client option was invalid and the SDK fell back to its default (release builds only). */
|
|
77
|
+
readonly INVALID_CONFIGURATION: "INVALID_CONFIGURATION";
|
|
78
|
+
/** A request failed and the SDK fell back to cache or a retry. */
|
|
79
|
+
readonly REQUEST_FAILED: "REQUEST_FAILED";
|
|
80
|
+
/** A request exceeded the per-attempt timeout. */
|
|
81
|
+
readonly REQUEST_TIMEOUT: "REQUEST_TIMEOUT";
|
|
82
|
+
/** A background task the SDK owns failed outright. */
|
|
83
|
+
readonly BACKGROUND_TASK_FAILED: "BACKGROUND_TASK_FAILED";
|
|
84
|
+
/**
|
|
85
|
+
* A product, perk or paywall location in the project schema could not be
|
|
86
|
+
* read by this SDK version and was left out. Every other entry is still
|
|
87
|
+
* served; updating the SDK makes the entry available.
|
|
88
|
+
*/
|
|
89
|
+
readonly SCHEMA_ENTRY_SKIPPED: "SCHEMA_ENTRY_SKIPPED";
|
|
90
|
+
/**
|
|
91
|
+
* A queued `identify` or person-attribute write was dropped because the
|
|
92
|
+
* Voidhash API refused it with a verdict re-sending cannot change.
|
|
93
|
+
*/
|
|
94
|
+
readonly PERSON_WRITE_REJECTED: "PERSON_WRITE_REJECTED";
|
|
95
|
+
/**
|
|
96
|
+
* A product the project defines was not returned by the store, so
|
|
97
|
+
* `getProducts()` and `useProducts()` leave it out. Reported once per
|
|
98
|
+
* product per load; the message names its slug and the store's reason.
|
|
99
|
+
* Check the store product id in Studio and the product's state in App Store
|
|
100
|
+
* Connect or the Play Console.
|
|
101
|
+
*/
|
|
102
|
+
readonly PRODUCT_NOT_FOUND: "PRODUCT_NOT_FOUND";
|
|
103
|
+
/**
|
|
104
|
+
* The store sells a product as another type than Studio, such as a Studio
|
|
105
|
+
* subscription the App Store sells as a non-renewing one or Google Play as
|
|
106
|
+
* an in-app product, so `getProducts()` and `useProducts()` leave it out.
|
|
107
|
+
* The message names its slug and both types.
|
|
108
|
+
*/
|
|
109
|
+
readonly PRODUCT_TYPE_MISMATCH: "PRODUCT_TYPE_MISMATCH";
|
|
110
|
+
/**
|
|
111
|
+
* iOS, with `purchaseIntents: "manual"`: more App Store purchase intents
|
|
112
|
+
* arrived before any `appStore.addPurchaseIntentListener()` than the SDK
|
|
113
|
+
* holds for it (10), so the oldest was dropped. The end user can start that
|
|
114
|
+
* purchase again on the App Store.
|
|
115
|
+
*/
|
|
116
|
+
readonly PURCHASE_INTENT_DROPPED: "PURCHASE_INTENT_DROPPED";
|
|
117
|
+
/** A queued transaction receipt was discarded as unsendable. */
|
|
118
|
+
readonly TRANSACTION_RECEIPT_DROPPED: "TRANSACTION_RECEIPT_DROPPED";
|
|
119
|
+
/**
|
|
120
|
+
* The Voidhash API refused a store receipt with a verdict re-sending cannot
|
|
121
|
+
* change on its own: the store is not configured for this app, or the
|
|
122
|
+
* transaction is unknown or belongs to another environment. The receipt
|
|
123
|
+
* stays queued and is sent again at the next launch or after six hours.
|
|
124
|
+
* Reported once per receipt.
|
|
125
|
+
*/
|
|
126
|
+
readonly TRANSACTION_REJECTED: "TRANSACTION_REJECTED";
|
|
127
|
+
/**
|
|
128
|
+
* Android: a purchase the SDK started was still not recorded by Voidhash 48
|
|
129
|
+
* hours after its payment went through, so the background check acknowledged
|
|
130
|
+
* it on the device before Google Play refunds it. The SDK still holds the
|
|
131
|
+
* receipt and delivers it.
|
|
132
|
+
*/
|
|
133
|
+
readonly PURCHASE_FINISHED_BEFORE_SYNC: "PURCHASE_FINISHED_BEFORE_SYNC";
|
|
134
|
+
/** A transaction receipt is waiting in the outbox for a successful sync. */
|
|
135
|
+
readonly TRANSACTION_SYNC_DEFERRED: "TRANSACTION_SYNC_DEFERRED";
|
|
136
|
+
/**
|
|
137
|
+
* iOS: what an earlier release of this package stored on the device was not
|
|
138
|
+
* carried over, because the storage it was kept under doesn't match the
|
|
139
|
+
* configured base URL. Reported once per start.
|
|
140
|
+
*/
|
|
141
|
+
readonly LEGACY_IMPORT_SKIPPED: "LEGACY_IMPORT_SKIPPED";
|
|
142
|
+
};
|
|
143
|
+
/** Handler supplied through the `onDiagnostic` client option. */
|
|
144
|
+
type VoidhashDiagnosticHandler = (diagnostic: VoidhashDiagnostic) => void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Schema registry — the mechanism by which a generated `voidhash.gen.d.ts`
|
|
148
|
+
* teaches the SDK about the project-specific schema (product slugs, paywall
|
|
149
|
+
* location slugs, perk slugs, feature flag keys and their variant values)
|
|
150
|
+
* defined on the server, and about the interface of the flow shown at each
|
|
151
|
+
* location (its inputs, outputs, outcomes and app actions).
|
|
152
|
+
*
|
|
153
|
+
* Usage in user code: the user runs `voidhash-cli types generate`, which writes a
|
|
154
|
+
* declaration file augmenting this interface. Once that file is part of the
|
|
155
|
+
* project's TypeScript compilation, hooks like `usePresentFlow(slug)`
|
|
156
|
+
* autocomplete the literal union of valid slugs, and `presentFlow(slug, …)`
|
|
157
|
+
* checks the inputs and handlers a location's flow takes and types its result.
|
|
158
|
+
*
|
|
159
|
+
* When no augmentation is present (e.g. before the first generate, or in
|
|
160
|
+
* isolated tests), the resolved types degrade gracefully to `string`, and a
|
|
161
|
+
* location without a declared interface takes and returns plain dictionaries.
|
|
162
|
+
*/
|
|
163
|
+
interface VoidhashRegister {
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A value a flow takes as an input, reports as an output, or exchanges with
|
|
167
|
+
* an app action. A list is an array of strings without repeats.
|
|
168
|
+
*/
|
|
169
|
+
type FlowValue = string | number | boolean | readonly string[];
|
|
170
|
+
/** Flow values by name. */
|
|
171
|
+
type FlowValues = Readonly<Record<string, FlowValue>>;
|
|
172
|
+
/**
|
|
173
|
+
* Runs an app action a flow calls: receives the action's arguments and
|
|
174
|
+
* returns its reply, or nothing when the action replies with no fields. A
|
|
175
|
+
* handler that throws or rejects makes the flow run the action's failure path.
|
|
176
|
+
*/
|
|
177
|
+
type FlowActionHandler = (args: FlowValues) => Promise<FlowValues | void> | FlowValues | void;
|
|
178
|
+
/**
|
|
179
|
+
* The interface of the flow shown at one location, as generated code declares
|
|
180
|
+
* it. `outcome` lists the outcomes the flow finishes with; the built-in
|
|
181
|
+
* `purchased`, `restored` and `dismissed` are added by the SDK.
|
|
182
|
+
*/
|
|
183
|
+
interface VoidhashFlowShape {
|
|
184
|
+
input: object;
|
|
185
|
+
output: object;
|
|
186
|
+
outcome: string;
|
|
187
|
+
actions: object;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Shape required of the augmented schema. Generated `voidhash.gen.d.ts`
|
|
191
|
+
* declares `interface VoidhashRegister { schema: { products: ...; locations: ...; perks: ...; flags: ... }; productTypes: { ... }; flagValues: { ... } }`,
|
|
192
|
+
* and `flows: { [location slug]: { input; output; outcome; actions } }` for
|
|
193
|
+
* the locations that have an interface. Files generated before `flags` and
|
|
194
|
+
* `flagValues` existed leave them out; flag keys and variant values are then
|
|
195
|
+
* typed as `string`.
|
|
196
|
+
*/
|
|
197
|
+
interface VoidhashRegisterShape {
|
|
198
|
+
schema: {
|
|
199
|
+
products: string;
|
|
200
|
+
locations: string;
|
|
201
|
+
perks: string;
|
|
202
|
+
flags: string;
|
|
203
|
+
};
|
|
204
|
+
flows?: Record<string, VoidhashFlowShape>;
|
|
205
|
+
/**
|
|
206
|
+
* Each product slug's Studio type. Files generated before it existed leave
|
|
207
|
+
* it out; their products are then typed as any `Product`.
|
|
208
|
+
*/
|
|
209
|
+
productTypes: Readonly<Record<string, "subscription" | "consumable" | "nonConsumable">>;
|
|
210
|
+
/** The text values of each flag's variants, for the flags whose variants have them. */
|
|
211
|
+
flagValues: Readonly<Record<string, string>>;
|
|
212
|
+
}
|
|
213
|
+
type Resolve<K extends keyof VoidhashRegisterShape["schema"]> = VoidhashRegister extends {
|
|
214
|
+
schema: {
|
|
215
|
+
[P in K]: infer V extends string;
|
|
216
|
+
};
|
|
217
|
+
} ? [
|
|
218
|
+
V
|
|
219
|
+
] extends [never] ? string : V : string;
|
|
220
|
+
/** Resolves to the literal union of product slugs declared on the server, or `string` when the .d.ts isn't loaded. */
|
|
221
|
+
type ProductSlug = Resolve<"products">;
|
|
222
|
+
/** Resolves to the literal union of paywall location slugs declared on the server, or `string` when the .d.ts isn't loaded. */
|
|
223
|
+
type LocationSlug = Resolve<"locations">;
|
|
224
|
+
/** Resolves to the literal union of perk slugs declared on the server, or `string` when the .d.ts isn't loaded. */
|
|
225
|
+
type PerkSlug = Resolve<"perks">;
|
|
226
|
+
/** The outcomes every flow can end with, whatever its own interface declares. */
|
|
227
|
+
type BuiltInFlowOutcome = "purchased" | "restored" | "dismissed";
|
|
228
|
+
type RegisteredFlows = VoidhashRegister extends {
|
|
229
|
+
flows: infer Flows;
|
|
230
|
+
} ? Flows : object;
|
|
231
|
+
type RegisteredFlowPart<L extends string, Part extends keyof VoidhashFlowShape, Fallback> = L extends keyof RegisteredFlows ? RegisteredFlows[L] extends {
|
|
232
|
+
[P in Part]: infer Declared;
|
|
233
|
+
} ? Declared : Fallback : Fallback;
|
|
234
|
+
/** The inputs the flow at location `L` takes, or a dictionary when its interface isn't declared. */
|
|
235
|
+
type FlowInput<L extends string = string> = RegisteredFlowPart<L, "input", FlowValues>;
|
|
236
|
+
/** The outputs the flow at location `L` reports, or a dictionary when its interface isn't declared. */
|
|
237
|
+
type FlowOutput<L extends string = string> = RegisteredFlowPart<L, "output", FlowValues>;
|
|
238
|
+
/**
|
|
239
|
+
* How the flow at location `L` can end: the outcomes its interface declares
|
|
240
|
+
* plus the built-in ones, or `string` when its interface isn't declared.
|
|
241
|
+
*/
|
|
242
|
+
type FlowOutcome<L extends string = string> = RegisteredFlowPart<L, "outcome", string> | BuiltInFlowOutcome;
|
|
243
|
+
/** The app action handlers the flow at location `L` calls, or handlers by name when its interface isn't declared. */
|
|
244
|
+
type FlowActions<L extends string = string> = RegisteredFlowPart<L, "actions", Readonly<Record<string, FlowActionHandler>>>;
|
|
245
|
+
/**
|
|
246
|
+
* Each product slug's Studio type as the generated `voidhash.gen.d.ts`
|
|
247
|
+
* declares it (`subscription`, `consumable` or `nonConsumable`), or `{}`
|
|
248
|
+
* without it. `useProducts(slugs)` types each product by it.
|
|
249
|
+
*/
|
|
250
|
+
type RegisteredProductTypes = VoidhashRegister extends {
|
|
251
|
+
productTypes: infer Types;
|
|
252
|
+
} ? Types : Record<never, never>;
|
|
253
|
+
/** Resolves to the literal union of the project's feature flag keys (archived ones left out), or `string` when the .d.ts isn't loaded. */
|
|
254
|
+
type FeatureFlagKey = Resolve<"flags">;
|
|
255
|
+
/**
|
|
256
|
+
* The text values flag `K`'s variants had when `voidhash.gen.d.ts` was
|
|
257
|
+
* generated, which editors suggest, or any other text: a variant added since
|
|
258
|
+
* is not in the file until it is generated again, so code that matches on the
|
|
259
|
+
* value keeps a branch for other values. Any text when the .d.ts isn't loaded
|
|
260
|
+
* or the flag's variants had none.
|
|
261
|
+
*/
|
|
262
|
+
type FeatureFlagValue<K extends string> = ListedFlagValue<K> | (string & Record<never, never>);
|
|
263
|
+
/** The text values `voidhash.gen.d.ts` lists for flag `K`; none without them. */
|
|
264
|
+
type ListedFlagValue<K extends string> = VoidhashRegister extends {
|
|
265
|
+
flagValues: infer Values;
|
|
266
|
+
} ? K extends keyof Values ? Values[K] : never : never;
|
|
267
|
+
|
|
268
|
+
/** Play Billing's `ProductType`: `subs` for subscriptions, `inapp` for one-time products. */
|
|
269
|
+
type GooglePlayProductType = "subs" | "inapp" | "unknown";
|
|
270
|
+
/** Play Billing's `RecurrenceMode` of a pricing phase. */
|
|
271
|
+
type GooglePlayRecurrenceMode = "infinite" | "finite" | "nonRecurring" | "unknown";
|
|
272
|
+
/** A Play Billing `PricingPhase`. */
|
|
273
|
+
interface GooglePlayPricingPhase {
|
|
274
|
+
readonly formattedPrice: string;
|
|
275
|
+
readonly priceAmountMicros: number;
|
|
276
|
+
readonly priceCurrencyCode: string;
|
|
277
|
+
/** ISO 8601 duration, such as `P1M`. */
|
|
278
|
+
readonly billingPeriod: string;
|
|
279
|
+
readonly billingCycleCount: number;
|
|
280
|
+
readonly recurrenceMode: GooglePlayRecurrenceMode;
|
|
281
|
+
}
|
|
282
|
+
/** A Play Billing installment plan of a subscription offer. */
|
|
283
|
+
interface GooglePlayInstallmentPlan {
|
|
284
|
+
readonly commitmentPaymentsCount: number;
|
|
285
|
+
readonly subsequentCommitmentPaymentsCount: number;
|
|
286
|
+
}
|
|
287
|
+
/** A Play Billing `SubscriptionOfferDetails`: a base plan, or an offer on one. */
|
|
288
|
+
interface GooglePlaySubscriptionOffer {
|
|
289
|
+
readonly basePlanId: string;
|
|
290
|
+
/** Absent for the base plan itself. */
|
|
291
|
+
readonly offerId?: string;
|
|
292
|
+
/** Pass it as `googlePlay.offerToken` to buy exactly this offer. */
|
|
293
|
+
readonly offerToken: string;
|
|
294
|
+
readonly offerTags: ReadonlyArray<string>;
|
|
295
|
+
readonly pricingPhases: ReadonlyArray<GooglePlayPricingPhase>;
|
|
296
|
+
readonly installmentPlan?: GooglePlayInstallmentPlan;
|
|
297
|
+
}
|
|
298
|
+
/** A Play Billing `OneTimePurchaseOfferDetails`. */
|
|
299
|
+
interface GooglePlayOneTimeOffer {
|
|
300
|
+
readonly purchaseOptionId?: string;
|
|
301
|
+
readonly offerId?: string;
|
|
302
|
+
/** Pass it as `googlePlay.offerToken` to buy exactly this offer. */
|
|
303
|
+
readonly offerToken: string;
|
|
304
|
+
readonly offerTags: ReadonlyArray<string>;
|
|
305
|
+
readonly price: Price;
|
|
306
|
+
/** The price before the discount. */
|
|
307
|
+
readonly fullPrice?: Price;
|
|
308
|
+
readonly discountPercentage?: number;
|
|
309
|
+
readonly limitedQuantity?: {
|
|
310
|
+
readonly maximumQuantity: number;
|
|
311
|
+
readonly remainingQuantity: number;
|
|
312
|
+
};
|
|
313
|
+
/** When the offer can be bought; an open end is absent. */
|
|
314
|
+
readonly validTimeWindow?: {
|
|
315
|
+
readonly startTimeMillis?: number;
|
|
316
|
+
readonly endTimeMillis?: number;
|
|
317
|
+
};
|
|
318
|
+
readonly preorder?: {
|
|
319
|
+
readonly releaseTimeMillis: number;
|
|
320
|
+
readonly presaleEndTimeMillis: number;
|
|
321
|
+
};
|
|
322
|
+
readonly rental?: {
|
|
323
|
+
readonly rentalPeriod: string;
|
|
324
|
+
readonly rentalExpirationPeriod?: string;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/** A Play Billing `ProductDetails` as Google Play reports it. */
|
|
328
|
+
interface GooglePlayProductInfo {
|
|
329
|
+
/** The Google Play product id. */
|
|
330
|
+
readonly productId: string;
|
|
331
|
+
readonly productType: GooglePlayProductType;
|
|
332
|
+
/** The base plan this product is bound to in Studio. */
|
|
333
|
+
readonly basePlanId?: string;
|
|
334
|
+
/** Every offer Google Play returned, on every base plan. */
|
|
335
|
+
readonly subscriptionOffers: ReadonlyArray<GooglePlaySubscriptionOffer>;
|
|
336
|
+
readonly oneTimeOffers: ReadonlyArray<GooglePlayOneTimeOffer>;
|
|
337
|
+
}
|
|
338
|
+
/** Play Billing's `Purchase.PurchaseState`. */
|
|
339
|
+
type GooglePlayPurchaseState = "purchased" | "pending" | "unknown";
|
|
340
|
+
/** A Play Billing `Purchase` as Google Play reports it. */
|
|
341
|
+
interface GooglePlayTransactionInfo {
|
|
342
|
+
readonly orderId?: string;
|
|
343
|
+
readonly purchaseToken: string;
|
|
344
|
+
readonly productIds: ReadonlyArray<string>;
|
|
345
|
+
readonly purchaseState: GooglePlayPurchaseState;
|
|
346
|
+
readonly isAcknowledged: boolean;
|
|
347
|
+
readonly isAutoRenewing?: boolean;
|
|
348
|
+
/** The account id the purchase was made with: the end user's Voidhash identity. */
|
|
349
|
+
readonly obfuscatedAccountId?: string;
|
|
350
|
+
readonly obfuscatedProfileId?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Whether Google Play suspended the subscription (its payment method
|
|
353
|
+
* failed). A suspended purchase grants nothing.
|
|
354
|
+
*/
|
|
355
|
+
readonly isSuspended: boolean;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* How `showInAppMessages()` ended: nothing to do, or the end user fixed their
|
|
359
|
+
* payment method for the subscription whose purchase token it names.
|
|
360
|
+
*/
|
|
361
|
+
type GooglePlayInAppMessageResult = {
|
|
362
|
+
readonly status: "noActionNeeded";
|
|
363
|
+
} | {
|
|
364
|
+
readonly status: "subscriptionStatusUpdated";
|
|
365
|
+
readonly purchaseToken: string;
|
|
366
|
+
};
|
|
367
|
+
/** A Play Billing feature `isFeatureSupported()` asks about, by `BillingClient.FeatureType`. */
|
|
368
|
+
type GooglePlayBillingFeature = "subscriptions" | "subscriptionsUpdate" | "inAppMessaging" | "productDetails" | "billingConfig" | "alternativeBillingOnly" | "externalOffer";
|
|
369
|
+
/** Reads a product's Google Play part; `None` when it is not one. */
|
|
370
|
+
declare const decodeGooglePlayProduct: (json: string) => Option.Option<GooglePlayProductInfo>;
|
|
371
|
+
/** Reads a transaction's Google Play part; `None` when it is not one. */
|
|
372
|
+
declare const decodeGooglePlayTransaction: (json: string) => Option.Option<GooglePlayTransactionInfo>;
|
|
373
|
+
|
|
374
|
+
/** An amount of money as the store sells it. */
|
|
375
|
+
interface Price {
|
|
376
|
+
/** The amount in the currency's units, such as `9.99`. */
|
|
377
|
+
readonly amount: number;
|
|
378
|
+
/** `amount` × 1,000,000, exact: use it to compare or add prices. */
|
|
379
|
+
readonly amountMicros: number;
|
|
380
|
+
/** ISO 4217 currency code, such as `USD`. */
|
|
381
|
+
readonly currencyCode: string;
|
|
382
|
+
/** The store's localized price, such as `$9.99`: show it as it is. */
|
|
383
|
+
readonly formatted: string;
|
|
384
|
+
}
|
|
385
|
+
/** The unit of a {@link Period}. `unknown` is a unit this SDK version cannot read. */
|
|
386
|
+
type PeriodUnit = "day" | "week" | "month" | "year" | "unknown";
|
|
387
|
+
/** A length of time, such as a billing period or a free trial. */
|
|
388
|
+
interface Period {
|
|
389
|
+
readonly unit: PeriodUnit;
|
|
390
|
+
/** How many units, at least 1. Seven days are reported as one week. */
|
|
391
|
+
readonly count: number;
|
|
392
|
+
/** ISO 8601 duration, such as `P1W`, `P3M` or `P1Y`. */
|
|
393
|
+
readonly iso8601: string;
|
|
394
|
+
}
|
|
395
|
+
/** How a {@link PricingPhase} is paid. */
|
|
396
|
+
type PaymentMode = "freeTrial" | "payAsYouGo" | "payUpFront" | "unknown";
|
|
397
|
+
/** One phase of an offer: a price that applies for a number of billing cycles. */
|
|
398
|
+
interface PricingPhase {
|
|
399
|
+
readonly paymentMode: PaymentMode;
|
|
400
|
+
/** What one cycle costs; zero for a free trial. */
|
|
401
|
+
readonly price: Price;
|
|
402
|
+
/** The length of one cycle. */
|
|
403
|
+
readonly period: Period;
|
|
404
|
+
/** How many cycles the phase lasts, at least 1. */
|
|
405
|
+
readonly cycles: number;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* What an offer is:
|
|
409
|
+
*
|
|
410
|
+
* - `introductory`: a free trial or introductory price for new subscribers.
|
|
411
|
+
* - `promotional`: a discount for current or former subscribers, or one you
|
|
412
|
+
* configured in Studio.
|
|
413
|
+
* - `winBack`: an App Store offer to win back a former subscriber.
|
|
414
|
+
* - `oneTime`: a discounted price of a one-time product on Google Play.
|
|
415
|
+
*/
|
|
416
|
+
type OfferKind = "introductory" | "promotional" | "winBack" | "oneTime" | "unknown";
|
|
417
|
+
/** A discount the end user can buy a product with. */
|
|
418
|
+
interface Offer {
|
|
419
|
+
/**
|
|
420
|
+
* On Google Play, the offer's id in Studio when it is configured there,
|
|
421
|
+
* otherwise Google Play's offer id. On the App Store, a promotional offer's
|
|
422
|
+
* Studio id (only offers configured in Studio are listed), a win-back
|
|
423
|
+
* offer's App Store id, and `""` for the introductory offer, which has none.
|
|
424
|
+
* Not unique on its own: key a list by `kind` and `id` together.
|
|
425
|
+
*/
|
|
426
|
+
readonly id: string;
|
|
427
|
+
readonly kind: OfferKind;
|
|
428
|
+
/**
|
|
429
|
+
* For a subscription offer, its phases before the regular price starts, in
|
|
430
|
+
* order. Empty for a `oneTime` offer.
|
|
431
|
+
*/
|
|
432
|
+
readonly phases: ReadonlyArray<PricingPhase>;
|
|
433
|
+
/** For a `oneTime` offer, what the product costs with it; absent for subscription offers. */
|
|
434
|
+
readonly price?: Price;
|
|
435
|
+
}
|
|
436
|
+
/** What a subscription product renews at. */
|
|
437
|
+
interface SubscriptionInfo {
|
|
438
|
+
/** The length of one billing period. */
|
|
439
|
+
readonly period: Period;
|
|
440
|
+
/**
|
|
441
|
+
* The App Store subscription group id; on Google Play, the subscription's
|
|
442
|
+
* product id; in development mode, the development product id.
|
|
443
|
+
*/
|
|
444
|
+
readonly groupId: string;
|
|
445
|
+
/**
|
|
446
|
+
* The free trial or introductory price this end user can get right now;
|
|
447
|
+
* absent when they are not eligible for one. A purchase applies it by
|
|
448
|
+
* default.
|
|
449
|
+
*/
|
|
450
|
+
readonly introOffer?: Offer;
|
|
451
|
+
/** The regular price per day, rounded to the currency's minor units. */
|
|
452
|
+
readonly pricePerDay: Price;
|
|
453
|
+
/** The regular price per week. */
|
|
454
|
+
readonly pricePerWeek: Price;
|
|
455
|
+
/** The regular price per month. */
|
|
456
|
+
readonly pricePerMonth: Price;
|
|
457
|
+
/** The regular price per year. */
|
|
458
|
+
readonly pricePerYear: Price;
|
|
459
|
+
}
|
|
460
|
+
/** The store that sells a product; `development` for test purchases in development mode. */
|
|
461
|
+
type Store = "appStore" | "googlePlay" | "development" | "unknown";
|
|
462
|
+
/**
|
|
463
|
+
* What kind of product it is: a `subscription`, a `consumable` that can be
|
|
464
|
+
* bought again and again, a `nonConsumable` bought once, or (App Store only) a
|
|
465
|
+
* `nonRenewingSubscription`.
|
|
466
|
+
*/
|
|
467
|
+
type ProductType = "subscription" | "consumable" | "nonConsumable" | "nonRenewingSubscription" | "unknown";
|
|
468
|
+
/** What every product has, whatever its type. */
|
|
469
|
+
interface ProductFields {
|
|
470
|
+
/** The product's id in Voidhash, as `Subscription.productId` names it. */
|
|
471
|
+
readonly productId: string;
|
|
472
|
+
/** The product's slug in Studio. */
|
|
473
|
+
readonly slug: ProductSlug;
|
|
474
|
+
readonly store: Store;
|
|
475
|
+
/** The product's id in the store: the App Store product id or the Google Play product id. */
|
|
476
|
+
readonly storeProductId: string;
|
|
477
|
+
/** The product's name in Studio. */
|
|
478
|
+
readonly name: string;
|
|
479
|
+
/** The product's title in the store, localized for the end user. */
|
|
480
|
+
readonly displayName: string;
|
|
481
|
+
/** The product's description in the store, localized for the end user. */
|
|
482
|
+
readonly description: string;
|
|
483
|
+
/** The regular price; on Google Play, the recurring price of the product's base plan. */
|
|
484
|
+
readonly price: Price;
|
|
485
|
+
/**
|
|
486
|
+
* The offers this end user can buy the product with, besides the
|
|
487
|
+
* introductory offer in `subscription.introOffer`.
|
|
488
|
+
*/
|
|
489
|
+
readonly offers: ReadonlyArray<Offer>;
|
|
490
|
+
/** The App Store's own view of the product; present when `store` is `appStore`. */
|
|
491
|
+
readonly appStore?: AppStoreProductInfo;
|
|
492
|
+
/** Google Play's own view of the product; present when `store` is `googlePlay`. */
|
|
493
|
+
readonly googlePlay?: GooglePlayProductInfo;
|
|
494
|
+
}
|
|
495
|
+
/** A product that renews until it is canceled. */
|
|
496
|
+
interface SubscriptionProduct extends ProductFields {
|
|
497
|
+
readonly type: "subscription";
|
|
498
|
+
readonly subscription: SubscriptionInfo;
|
|
499
|
+
}
|
|
500
|
+
/** A product that can be bought again and again, such as coins. */
|
|
501
|
+
interface ConsumableProduct extends ProductFields {
|
|
502
|
+
readonly type: "consumable";
|
|
503
|
+
readonly subscription?: undefined;
|
|
504
|
+
}
|
|
505
|
+
/** A product bought once that stays bought, such as a lifetime unlock. */
|
|
506
|
+
interface NonConsumableProduct extends ProductFields {
|
|
507
|
+
readonly type: "nonConsumable";
|
|
508
|
+
readonly subscription?: undefined;
|
|
509
|
+
}
|
|
510
|
+
/** An App Store subscription that does not renew by itself. */
|
|
511
|
+
interface NonRenewingSubscriptionProduct extends ProductFields {
|
|
512
|
+
readonly type: "nonRenewingSubscription";
|
|
513
|
+
readonly subscription?: undefined;
|
|
514
|
+
}
|
|
515
|
+
/** A product of a type this SDK version cannot read. */
|
|
516
|
+
interface UnknownTypeProduct extends ProductFields {
|
|
517
|
+
readonly type: "unknown";
|
|
518
|
+
readonly subscription?: SubscriptionInfo;
|
|
519
|
+
}
|
|
520
|
+
/** A product as the store sells it to this end user; narrow it on `type`. */
|
|
521
|
+
type Product = SubscriptionProduct | ConsumableProduct | NonConsumableProduct | NonRenewingSubscriptionProduct | UnknownTypeProduct;
|
|
522
|
+
/**
|
|
523
|
+
* The product a slug of a Studio product type is, as the register of
|
|
524
|
+
* `voidhash-cli types generate` names the type: a `subscription` is a
|
|
525
|
+
* {@link SubscriptionProduct}, a `consumable` (Studio's one-time consumable)
|
|
526
|
+
* a {@link ConsumableProduct}, and a `nonConsumable` (Studio's one-time) a
|
|
527
|
+
* {@link NonConsumableProduct} or, when the App Store sells it as one, a
|
|
528
|
+
* {@link NonRenewingSubscriptionProduct}. The SDK leaves out a product the
|
|
529
|
+
* store sells as another type, reporting it, so a slug's product is of its
|
|
530
|
+
* type or missing.
|
|
531
|
+
*/
|
|
532
|
+
type ProductOfType<Type> = Type extends "subscription" ? SubscriptionProduct : Type extends "consumable" ? ConsumableProduct : Type extends "nonConsumable" ? NonConsumableProduct | NonRenewingSubscriptionProduct : Product;
|
|
533
|
+
/** The product `slug` names, by the product types in `Types`. */
|
|
534
|
+
type ProductForSlugIn<Types, Slug> = Slug extends keyof Types ? ProductOfType<Types[Slug]> : Product;
|
|
535
|
+
/**
|
|
536
|
+
* The product a slug names. With the types `voidhash-cli types generate`
|
|
537
|
+
* writes, it is typed by its slug's Studio type (see {@link ProductOfType}),
|
|
538
|
+
* so a subscription's slug is a {@link SubscriptionProduct}; without them,
|
|
539
|
+
* any {@link Product}.
|
|
540
|
+
*/
|
|
541
|
+
type ProductForSlug<Slug> = ProductForSlugIn<RegisteredProductTypes, Slug>;
|
|
542
|
+
/** The products `slugs` name, in their order; `undefined` where the store has none. */
|
|
543
|
+
type ProductsForSlugsIn<Types, Slugs extends ReadonlyArray<unknown>> = {
|
|
544
|
+
-readonly [Index in keyof Slugs]: ProductForSlugIn<Types, Slugs[Index]> | undefined;
|
|
545
|
+
};
|
|
546
|
+
/** The products `slugs` name, typed per slug; see {@link ProductForSlug}. */
|
|
547
|
+
type ProductsForSlugs<Slugs extends ReadonlyArray<unknown>> = ProductsForSlugsIn<RegisteredProductTypes, Slugs>;
|
|
548
|
+
/**
|
|
549
|
+
* How Google Play moves a subscriber from the subscription a purchase
|
|
550
|
+
* replaces to the one it buys.
|
|
551
|
+
*
|
|
552
|
+
* - `withTimeProration`: nothing is charged now. The time left on the old
|
|
553
|
+
* subscription is converted, by price, into time on the new one, which
|
|
554
|
+
* moves the next billing date. The default; it suits upgrades and
|
|
555
|
+
* downgrades alike.
|
|
556
|
+
* - `chargeProratedPrice`: the billing date stays, and the price difference
|
|
557
|
+
* for the rest of the period is charged now. Google Play accepts it only
|
|
558
|
+
* for an upgrade, a subscription that costs more per unit of time.
|
|
559
|
+
* - `chargeFullPrice`: the full price of the new subscription is charged now,
|
|
560
|
+
* and what was left of the old one is credited to it.
|
|
561
|
+
* - `withoutProration`: the billing date stays, and the new price is first
|
|
562
|
+
* charged on it.
|
|
563
|
+
* - `deferred`: the old subscription runs until its next renewal, which
|
|
564
|
+
* renews into the new one. Until then the purchase's transaction names the
|
|
565
|
+
* old product, and the subscription reports the change as
|
|
566
|
+
* `renewsToProductSlug`.
|
|
567
|
+
*/
|
|
568
|
+
type SubscriptionReplacementMode = "withTimeProration" | "chargeProratedPrice" | "chargeFullPrice" | "withoutProration" | "deferred";
|
|
569
|
+
/**
|
|
570
|
+
* The subscription a purchase replaces on Google Play: an upgrade, a
|
|
571
|
+
* downgrade or a change of plan, instead of a second subscription next to the
|
|
572
|
+
* first.
|
|
573
|
+
*/
|
|
574
|
+
interface SubscriptionReplacement {
|
|
575
|
+
/** The subscription product the end user has now and the purchase ends. */
|
|
576
|
+
readonly product: Product;
|
|
577
|
+
/** What Google Play charges when. Default `"withTimeProration"`. */
|
|
578
|
+
readonly mode?: SubscriptionReplacementMode;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Where a purchase was made: the stores' `production` and `sandbox`, Xcode's
|
|
583
|
+
* StoreKit testing (`xcode`), or Voidhash's development mode (`development`).
|
|
584
|
+
*/
|
|
585
|
+
type Environment = "production" | "sandbox" | "xcode" | "development" | "unknown";
|
|
586
|
+
/**
|
|
587
|
+
* The offer a transaction was bought with: an `introductory`, `promotional`,
|
|
588
|
+
* `winBack` or `oneTime` offer, or an offer `code` the end user redeemed.
|
|
589
|
+
*/
|
|
590
|
+
type TransactionOfferKind = "introductory" | "promotional" | "winBack" | "oneTime" | "code" | "unknown";
|
|
591
|
+
/** The offer a transaction was bought with. */
|
|
592
|
+
interface TransactionOffer {
|
|
593
|
+
readonly id?: string;
|
|
594
|
+
readonly kind?: TransactionOfferKind;
|
|
595
|
+
readonly paymentMode?: PaymentMode;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* A purchase as the store completed it on this device. Access never comes
|
|
599
|
+
* from a transaction: check the person's entitlements.
|
|
600
|
+
*/
|
|
601
|
+
interface Transaction {
|
|
602
|
+
/**
|
|
603
|
+
* The store's id: the App Store transaction id, or the Google Play purchase
|
|
604
|
+
* token. The same while a purchase goes from pending to purchased.
|
|
605
|
+
*/
|
|
606
|
+
readonly id: string;
|
|
607
|
+
/** The App Store original transaction id; absent on Google Play. */
|
|
608
|
+
readonly originalId?: string;
|
|
609
|
+
/** The slug of the product bought; absent when the project does not know the store product. */
|
|
610
|
+
readonly productSlug?: ProductSlug;
|
|
611
|
+
readonly storeProductId: string;
|
|
612
|
+
readonly store: Store;
|
|
613
|
+
/** When it was bought, in milliseconds since the epoch. */
|
|
614
|
+
readonly purchasedAt: number;
|
|
615
|
+
/** When a subscription period it paid for ends, in milliseconds since the epoch. */
|
|
616
|
+
readonly expiresAt?: number;
|
|
617
|
+
/** How many were bought; what the store charged for. */
|
|
618
|
+
readonly quantity: number;
|
|
619
|
+
/** Whether it renews a subscription; absent where the store does not say (Google Play). */
|
|
620
|
+
readonly isRenewal?: boolean;
|
|
621
|
+
readonly offer?: TransactionOffer;
|
|
622
|
+
readonly environment: Environment;
|
|
623
|
+
/** The App Store's own view of the transaction; present when `store` is `appStore`. */
|
|
624
|
+
readonly appStore?: AppStoreTransactionInfo;
|
|
625
|
+
/** Google Play's own view of the purchase; present when `store` is `googlePlay`. */
|
|
626
|
+
readonly googlePlay?: GooglePlayTransactionInfo;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* A purchase that completed outside `purchase()`: an approved Ask to Buy, a
|
|
630
|
+
* pending Google Play payment that went through, a renewal seen on the
|
|
631
|
+
* device, a redeemed offer code or a promoted purchase. Reported once the SDK
|
|
632
|
+
* handled it: Voidhash accepted it (`synced`) or its receipt waits on the
|
|
633
|
+
* device to be sent. It tells the UI something happened; access always comes
|
|
634
|
+
* from the person's entitlements.
|
|
635
|
+
*/
|
|
636
|
+
interface TransactionUpdate {
|
|
637
|
+
readonly transaction: Transaction;
|
|
638
|
+
readonly synced: boolean;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/** StoreKit's `Product.ProductType`. */
|
|
642
|
+
type AppStoreProductType = "consumable" | "nonConsumable" | "autoRenewable" | "nonRenewable" | "unknown";
|
|
643
|
+
/** StoreKit's `Product.SubscriptionOffer.OfferType`. */
|
|
644
|
+
type AppStoreOfferType = "introductory" | "promotional" | "winBack" | "unknown";
|
|
645
|
+
/** A StoreKit `Product.SubscriptionOffer`, whether or not this end user can buy it. */
|
|
646
|
+
interface AppStoreOffer {
|
|
647
|
+
/** The offer's id in App Store Connect; absent for the introductory offer. */
|
|
648
|
+
readonly id?: string;
|
|
649
|
+
readonly type: AppStoreOfferType;
|
|
650
|
+
readonly paymentMode: PaymentMode;
|
|
651
|
+
/** The length of one period of the offer. */
|
|
652
|
+
readonly period: Period;
|
|
653
|
+
/** How many periods the offer lasts. */
|
|
654
|
+
readonly periodCount: number;
|
|
655
|
+
/** What one period costs; zero for a free trial. */
|
|
656
|
+
readonly price: Price;
|
|
657
|
+
}
|
|
658
|
+
/** A StoreKit `Product` as the App Store reports it. */
|
|
659
|
+
interface AppStoreProductInfo {
|
|
660
|
+
readonly subscriptionGroupId?: string;
|
|
661
|
+
/** The product's level in its subscription group (iOS 16.4 and later). */
|
|
662
|
+
readonly subscriptionGroupLevel?: number;
|
|
663
|
+
/** The subscription group's name (iOS 16.4 and later). */
|
|
664
|
+
readonly subscriptionGroupDisplayName?: string;
|
|
665
|
+
readonly isFamilyShareable: boolean;
|
|
666
|
+
readonly productType: AppStoreProductType;
|
|
667
|
+
/** The introductory offer, whether or not this end user is eligible for it. */
|
|
668
|
+
readonly introductoryOffer?: AppStoreOffer;
|
|
669
|
+
readonly promotionalOffers: ReadonlyArray<AppStoreOffer>;
|
|
670
|
+
/** Win-back offers (iOS 18 and later). */
|
|
671
|
+
readonly winBackOffers: ReadonlyArray<AppStoreOffer>;
|
|
672
|
+
/** Whether this end user can get the group's introductory offer; absent when unknown. */
|
|
673
|
+
readonly isEligibleForIntroOffer?: boolean;
|
|
674
|
+
}
|
|
675
|
+
/** StoreKit's `Transaction.OwnershipType`. */
|
|
676
|
+
type AppStoreOwnershipType = "purchased" | "familyShared" | "unknown";
|
|
677
|
+
/** StoreKit's `Transaction.RevocationReason`. */
|
|
678
|
+
type AppStoreRevocationReason = "developerIssue" | "other" | "unknown";
|
|
679
|
+
/** A StoreKit `Transaction` as the App Store reports it. */
|
|
680
|
+
interface AppStoreTransactionInfo {
|
|
681
|
+
readonly ownershipType: AppStoreOwnershipType;
|
|
682
|
+
/** The ISO 3166-1 alpha-2 country of the storefront it was bought in. */
|
|
683
|
+
readonly storefrontCountryCode?: string;
|
|
684
|
+
/** Whether the end user upgraded to another subscription in the group. */
|
|
685
|
+
readonly isUpgraded: boolean;
|
|
686
|
+
/** When the App Store refunded or revoked it, in milliseconds since the epoch. */
|
|
687
|
+
readonly revocationDate?: number;
|
|
688
|
+
readonly revocationReason?: AppStoreRevocationReason;
|
|
689
|
+
readonly appTransactionId?: string;
|
|
690
|
+
/** The transaction's signed JWS, for your own server to verify. */
|
|
691
|
+
readonly jwsRepresentation: string;
|
|
692
|
+
}
|
|
693
|
+
/** StoreKit's `Product.SubscriptionInfo.RenewalState`. */
|
|
694
|
+
type AppStoreSubscriptionState = "subscribed" | "expired" | "inBillingRetryPeriod" | "inGracePeriod" | "revoked" | "unknown";
|
|
695
|
+
/** StoreKit's `RenewalInfo.ExpirationReason`. */
|
|
696
|
+
type AppStoreExpirationReason = "autoRenewDisabled" | "billingError" | "didNotConsentToPriceIncrease" | "productUnavailable" | "unknown";
|
|
697
|
+
/** StoreKit's `RenewalInfo.PriceIncreaseStatus`. */
|
|
698
|
+
type AppStorePriceIncreaseStatus = "noIncreasePending" | "pending" | "agreed" | "unknown";
|
|
699
|
+
/** A StoreKit `Product.SubscriptionInfo.RenewalInfo`. */
|
|
700
|
+
interface AppStoreRenewalInfo {
|
|
701
|
+
readonly willAutoRenew: boolean;
|
|
702
|
+
/** The product the subscription renews into. */
|
|
703
|
+
readonly autoRenewProductId?: string;
|
|
704
|
+
readonly expirationReason?: AppStoreExpirationReason;
|
|
705
|
+
/** When the billing grace period ends, in milliseconds since the epoch. */
|
|
706
|
+
readonly gracePeriodExpiresAt?: number;
|
|
707
|
+
readonly isInBillingRetry: boolean;
|
|
708
|
+
readonly priceIncreaseStatus?: AppStorePriceIncreaseStatus;
|
|
709
|
+
/** What the next renewal costs. */
|
|
710
|
+
readonly renewalPrice?: Price;
|
|
711
|
+
readonly eligibleWinBackOfferIds: ReadonlyArray<string>;
|
|
712
|
+
}
|
|
713
|
+
/** One of a subscription group's statuses on this device: the end user's own. */
|
|
714
|
+
interface AppStoreSubscriptionStatus {
|
|
715
|
+
readonly state: AppStoreSubscriptionState;
|
|
716
|
+
/** The subscription's latest transaction. */
|
|
717
|
+
readonly transaction: Transaction;
|
|
718
|
+
readonly renewalInfo: AppStoreRenewalInfo;
|
|
719
|
+
}
|
|
720
|
+
/** StoreKit's `AppStore.Platform`. */
|
|
721
|
+
type AppStorePlatform = "iOS" | "macOS" | "tvOS" | "visionOS" | "unknown";
|
|
722
|
+
/** StoreKit's `AppTransaction`: how the end user got the app. */
|
|
723
|
+
interface AppTransaction {
|
|
724
|
+
/** The app version the end user first got. */
|
|
725
|
+
readonly originalAppVersion: string;
|
|
726
|
+
/** When the end user first got the app, in milliseconds since the epoch. */
|
|
727
|
+
readonly originalPurchaseDate: number;
|
|
728
|
+
readonly environment: Environment;
|
|
729
|
+
readonly appTransactionId?: string;
|
|
730
|
+
readonly originalPlatform?: AppStorePlatform;
|
|
731
|
+
/** The app transaction's signed JWS, for your own server to verify. */
|
|
732
|
+
readonly jwsRepresentation: string;
|
|
733
|
+
}
|
|
734
|
+
/** How `beginRefundRequest()` ended: Apple received the request, or the end user closed the sheet. */
|
|
735
|
+
type RefundRequestStatus = "success" | "userCancelled";
|
|
736
|
+
/**
|
|
737
|
+
* A purchase the end user started outside the app, such as a promoted
|
|
738
|
+
* in-app purchase or a win-back offer on the App Store. Complete it with
|
|
739
|
+
* `purchase()`.
|
|
740
|
+
*/
|
|
741
|
+
interface AppStorePurchaseIntent {
|
|
742
|
+
readonly productSlug: ProductSlug;
|
|
743
|
+
/** The offer the end user chose, when they chose one. */
|
|
744
|
+
readonly offer?: Offer;
|
|
745
|
+
}
|
|
746
|
+
/** Reads a product's App Store part; `None` when it is not one. */
|
|
747
|
+
declare const decodeAppStoreProduct: (json: string) => Option.Option<AppStoreProductInfo>;
|
|
748
|
+
/** Reads a transaction's App Store part; `None` when it is not one. */
|
|
749
|
+
declare const decodeAppStoreTransaction: (json: string) => Option.Option<AppStoreTransactionInfo>;
|
|
750
|
+
/** Reads a subscription status's renewal info; `None` when it is not one. */
|
|
751
|
+
declare const decodeAppStoreRenewalInfo: (json: string) => Option.Option<AppStoreRenewalInfo>;
|
|
752
|
+
/** Reads the app transaction; `None` when it is not one. */
|
|
753
|
+
declare const decodeAppTransaction: (json: string) => Option.Option<AppTransaction>;
|
|
754
|
+
|
|
755
|
+
/** Where a subscription or grant comes from. */
|
|
756
|
+
type PersonStore = "appStore" | "googlePlay" | "stripe" | "other" | "unknown";
|
|
757
|
+
/** A perk the person has or had. */
|
|
758
|
+
interface EntitlementGrant {
|
|
759
|
+
readonly perkId: string;
|
|
760
|
+
/** The perk's slug, which access is checked by; absent when the perk was deleted. */
|
|
761
|
+
readonly perkSlug?: PerkSlug;
|
|
762
|
+
/** `active` while the person has access, `expired` once it ended. */
|
|
763
|
+
readonly status: "active" | "expired" | "unknown";
|
|
764
|
+
/** What granted it: a `subscription`, a one-time `purchase`, or a `manual` grant. */
|
|
765
|
+
readonly source: "subscription" | "purchase" | "manual" | "unknown";
|
|
766
|
+
/** The id of the subscription or purchase that granted it; absent for a manual grant. */
|
|
767
|
+
readonly sourceId?: string;
|
|
768
|
+
/** The person who owns it: this person, one merged into them, or one sharing it with them. */
|
|
769
|
+
readonly sourcePersonId: string;
|
|
770
|
+
/** When the access ends, in milliseconds since the epoch; absent when it does not end. */
|
|
771
|
+
readonly expiresAt?: number;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* A subscription's state:
|
|
775
|
+
*
|
|
776
|
+
* - `active`: paid and renewing (or canceled, running until it ends).
|
|
777
|
+
* - `trialing`: in a free trial.
|
|
778
|
+
* - `inGracePeriod`: a renewal payment failed and the store keeps access
|
|
779
|
+
* until `gracePeriodExpiresAt` while it retries.
|
|
780
|
+
* - `inBillingRetry`: a renewal payment failed and the store is retrying it.
|
|
781
|
+
* - `onHold`: Google Play account hold: payment failed and access is paused.
|
|
782
|
+
* - `paused`: the end user paused it on Google Play until `resumesAt`.
|
|
783
|
+
* - `expired`: it ended.
|
|
784
|
+
* - `revoked`: the store withdrew it, such as after a refund.
|
|
785
|
+
*/
|
|
786
|
+
type SubscriptionStatus = "active" | "trialing" | "inGracePeriod" | "inBillingRetry" | "onHold" | "paused" | "expired" | "revoked" | "unknown";
|
|
787
|
+
/** Which price period a subscription is in: a free `trial`, an `intro` price, or the `regular` price. */
|
|
788
|
+
type SubscriptionPeriodType = "trial" | "intro" | "regular" | "unknown";
|
|
789
|
+
/** A price change the store announced for a subscription's next renewals. */
|
|
790
|
+
interface SubscriptionPendingPrice {
|
|
791
|
+
readonly amountMicros: number;
|
|
792
|
+
/** ISO 4217 currency code. */
|
|
793
|
+
readonly currency: string;
|
|
794
|
+
/** When the new price takes effect, in milliseconds since the epoch. */
|
|
795
|
+
readonly effectiveAt?: number;
|
|
796
|
+
/** Whether the end user agreed to it, where the store asks; absent where it does not. */
|
|
797
|
+
readonly consent?: "pending" | "accepted" | "unknown";
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* A subscription that has not ended, as the server knows it across devices
|
|
801
|
+
* and stores. Timestamps are milliseconds since the epoch. What the person
|
|
802
|
+
* can use always comes from their entitlements, never from this.
|
|
803
|
+
*/
|
|
804
|
+
interface Subscription {
|
|
805
|
+
readonly subscriptionId: string;
|
|
806
|
+
/** The Voidhash product id; absent when its store product is not linked to one. */
|
|
807
|
+
readonly productId?: string;
|
|
808
|
+
readonly productSlug?: ProductSlug;
|
|
809
|
+
readonly store: PersonStore;
|
|
810
|
+
/** Where it was bought; `development` for development-mode purchases. */
|
|
811
|
+
readonly environment: Environment;
|
|
812
|
+
readonly status: SubscriptionStatus;
|
|
813
|
+
readonly periodType: SubscriptionPeriodType;
|
|
814
|
+
readonly startsAt?: number;
|
|
815
|
+
/** When the current period ends. */
|
|
816
|
+
readonly expiresAt?: number;
|
|
817
|
+
/** Whether it renews at `expiresAt`. */
|
|
818
|
+
readonly willRenew: boolean;
|
|
819
|
+
/** When auto-renewal was turned off or it was canceled. */
|
|
820
|
+
readonly canceledAt?: number;
|
|
821
|
+
/** The product it renews into at `expiresAt`: a downgrade or plan change waiting for renewal. */
|
|
822
|
+
readonly renewsToProductSlug?: ProductSlug;
|
|
823
|
+
readonly gracePeriodExpiresAt?: number;
|
|
824
|
+
/** When the store first failed to charge the renewal. */
|
|
825
|
+
readonly billingIssueDetectedAt?: number;
|
|
826
|
+
/** When a paused subscription resumes (Google Play). */
|
|
827
|
+
readonly resumesAt?: number;
|
|
828
|
+
readonly pendingPrice?: SubscriptionPendingPrice;
|
|
829
|
+
/** The offer it was bought with. */
|
|
830
|
+
readonly offerId?: string;
|
|
831
|
+
/** Whether the person has it through App Store Family Sharing. */
|
|
832
|
+
readonly isFamilyShared: boolean;
|
|
833
|
+
readonly refundedAt?: number;
|
|
834
|
+
readonly revokedAt?: number;
|
|
835
|
+
}
|
|
836
|
+
/** One subscription the person owns or shares, ended or not. */
|
|
837
|
+
interface SubscriptionHistoryEntry {
|
|
838
|
+
readonly subscriptionId: string;
|
|
839
|
+
readonly productId?: string;
|
|
840
|
+
readonly productSlug?: ProductSlug;
|
|
841
|
+
readonly store: PersonStore;
|
|
842
|
+
readonly status: SubscriptionStatus;
|
|
843
|
+
readonly isTrial: boolean;
|
|
844
|
+
readonly startsAt?: number;
|
|
845
|
+
readonly expiresAt?: number;
|
|
846
|
+
readonly canceledAt?: number;
|
|
847
|
+
readonly refundedAt?: number;
|
|
848
|
+
readonly sourcePersonId: string;
|
|
849
|
+
}
|
|
850
|
+
/** One purchase the person owns or shares, one per store transaction. */
|
|
851
|
+
interface PurchaseHistoryEntry {
|
|
852
|
+
readonly purchaseId: string;
|
|
853
|
+
readonly productId?: string;
|
|
854
|
+
readonly productSlug?: ProductSlug;
|
|
855
|
+
/** The store's id for the transaction, such as an App Store transaction id. */
|
|
856
|
+
readonly providerKey: string;
|
|
857
|
+
readonly type: "oneTime" | "consumable" | "subscription" | "unknown";
|
|
858
|
+
/** When it was recorded. */
|
|
859
|
+
readonly createdAt?: number;
|
|
860
|
+
readonly refundedAt?: number;
|
|
861
|
+
readonly revokedAt?: number;
|
|
862
|
+
readonly sourcePersonId: string;
|
|
863
|
+
}
|
|
864
|
+
/** The end user as Voidhash knows them: who they are, what they can use and what they bought. */
|
|
865
|
+
interface Person {
|
|
866
|
+
readonly personId: string;
|
|
867
|
+
readonly distinctId: string;
|
|
868
|
+
readonly email?: string;
|
|
869
|
+
readonly name?: string;
|
|
870
|
+
readonly entitlements: {
|
|
871
|
+
/** The perks the person has or had, one per perk. */
|
|
872
|
+
readonly grants: ReadonlyArray<EntitlementGrant>;
|
|
873
|
+
};
|
|
874
|
+
readonly subscriptions: {
|
|
875
|
+
/**
|
|
876
|
+
* The subscription that matters most now, of the ones that have not
|
|
877
|
+
* ended: active first, then trialing, in a grace period, in billing
|
|
878
|
+
* retry, on hold, paused.
|
|
879
|
+
*/
|
|
880
|
+
readonly current?: Subscription;
|
|
881
|
+
/**
|
|
882
|
+
* Every subscription that has not ended, including ones in a grace
|
|
883
|
+
* period, in billing retry, on hold or paused: what a "manage
|
|
884
|
+
* subscription" screen lists. Access comes from entitlements, never from
|
|
885
|
+
* this list.
|
|
886
|
+
*/
|
|
887
|
+
readonly all: ReadonlyArray<Subscription>;
|
|
888
|
+
readonly history: ReadonlyArray<SubscriptionHistoryEntry>;
|
|
889
|
+
};
|
|
890
|
+
readonly purchases: {
|
|
891
|
+
readonly history: ReadonlyArray<PurchaseHistoryEntry>;
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Reads a person snapshot the native client sent as JSON; `None` when it is
|
|
896
|
+
* not one. Only `distinctId` is required: a snapshot that lacks something
|
|
897
|
+
* else still answers the access it records.
|
|
898
|
+
*/
|
|
899
|
+
declare const decodePerson: (json: string) => Option.Option<Person>;
|
|
900
|
+
|
|
901
|
+
/** Only the store identifier is required. Legacy metadata is accepted but discarded. */
|
|
902
|
+
type ReportedTransaction = {
|
|
903
|
+
productId?: string;
|
|
904
|
+
purchaseDate?: number;
|
|
905
|
+
quantity?: number;
|
|
906
|
+
receipt?: string;
|
|
907
|
+
appAccountToken?: string;
|
|
908
|
+
} & ({
|
|
909
|
+
platform: "ios";
|
|
910
|
+
transactionId: string;
|
|
911
|
+
} | {
|
|
912
|
+
platform: "android";
|
|
913
|
+
purchaseToken: string;
|
|
914
|
+
transactionId?: string;
|
|
915
|
+
/** If supplied, pending/unspecified purchases are ignored until reported as purchased. */
|
|
916
|
+
purchaseState?: "purchased" | "pending" | "unspecified";
|
|
917
|
+
});
|
|
918
|
+
/** Original bridge data accepted as a convenience; only the token and state are read. */
|
|
919
|
+
interface GooglePlayPurchaseData {
|
|
920
|
+
readonly originalJson: string;
|
|
921
|
+
readonly signature?: string;
|
|
922
|
+
}
|
|
923
|
+
/** Minimal store identifiers, or original store data from which the SDK extracts them. */
|
|
924
|
+
type StoreTransaction = ReportedTransaction | string | GooglePlayPurchaseData;
|
|
925
|
+
|
|
926
|
+
type SdkResolvedPaywallJsonEncodingLocationInterfaceRevisionEnum = "Infinity" | "-Infinity" | "NaN";
|
|
927
|
+
/**
|
|
928
|
+
* How the showing was chosen: always `paywall_release`, also when an experiment picked the release.
|
|
929
|
+
*/
|
|
930
|
+
type SdkResolvedPaywallShowingJsonEncodingType = "paywall_release" | "feature_flag";
|
|
931
|
+
/**
|
|
932
|
+
* What the location shows the person now.
|
|
933
|
+
*/
|
|
934
|
+
interface SdkResolvedPaywallShowingJsonEncoding {
|
|
935
|
+
/**
|
|
936
|
+
* The showing's id; send it as `paywallContext.showingId` with a purchase made on this paywall.
|
|
937
|
+
*/
|
|
938
|
+
readonly id: string;
|
|
939
|
+
/**
|
|
940
|
+
* The paywall shown.
|
|
941
|
+
*/
|
|
942
|
+
readonly paywall: {
|
|
943
|
+
/**
|
|
944
|
+
* The paywall's id.
|
|
945
|
+
*/
|
|
946
|
+
readonly id: string;
|
|
947
|
+
/**
|
|
948
|
+
* The paywall's name.
|
|
949
|
+
*/
|
|
950
|
+
readonly name: string;
|
|
951
|
+
/**
|
|
952
|
+
* The paywall's slug.
|
|
953
|
+
*/
|
|
954
|
+
readonly slug: string;
|
|
955
|
+
} | null;
|
|
956
|
+
/**
|
|
957
|
+
* The id of the paywall shown.
|
|
958
|
+
*/
|
|
959
|
+
readonly paywallId: string | null;
|
|
960
|
+
/**
|
|
961
|
+
* The paywall release shown.
|
|
962
|
+
*/
|
|
963
|
+
readonly paywallRelease: {
|
|
964
|
+
/**
|
|
965
|
+
* The release's compiled flow package.
|
|
966
|
+
*/
|
|
967
|
+
readonly flowPackage: {
|
|
968
|
+
/**
|
|
969
|
+
* The package's format version.
|
|
970
|
+
*/
|
|
971
|
+
readonly abiVersion: number | "Infinity" | "-Infinity" | "NaN";
|
|
972
|
+
/**
|
|
973
|
+
* What the flow is for, such as `paywall` or `onboarding`.
|
|
974
|
+
*/
|
|
975
|
+
readonly kind: string;
|
|
976
|
+
/**
|
|
977
|
+
* The store product ids the package can offer, for prefetching their prices.
|
|
978
|
+
*/
|
|
979
|
+
readonly productIds: ReadonlyArray<string>;
|
|
980
|
+
/**
|
|
981
|
+
* Whether a successful purchase closes the flow, as on a paywall, rather than letting it continue, as in onboarding.
|
|
982
|
+
*/
|
|
983
|
+
readonly shouldEndFlowOnPurchase: boolean;
|
|
984
|
+
/**
|
|
985
|
+
* The screens an end user cannot leave without buying, by the index the flow reports a screen by: show a close button of your own on them. Empty when every screen has a way out, or when the paywall is meant to keep people until they buy. Absent for releases built before it was recorded; read that as empty.
|
|
986
|
+
*/
|
|
987
|
+
readonly screensWithoutExit?: ReadonlyArray<number> | null | undefined;
|
|
988
|
+
/**
|
|
989
|
+
* The SHA-256 hash of the package's bytes, as hex; verify the download against it.
|
|
990
|
+
*/
|
|
991
|
+
readonly sha256: string;
|
|
992
|
+
/**
|
|
993
|
+
* Where to download the package; its content never changes, so cache it by `sha256`.
|
|
994
|
+
*/
|
|
995
|
+
readonly url: string;
|
|
996
|
+
/**
|
|
997
|
+
* The flow runtime module the release needs, for SDKs that run the flow runtime as a downloaded module; null when none is offered for it. Other SDKs ignore it.
|
|
998
|
+
*/
|
|
999
|
+
readonly runtime: {
|
|
1000
|
+
/**
|
|
1001
|
+
* The flow runtime version the release was built for, as `major.minor.patch`; a runtime module of the same major version and not older also runs it.
|
|
1002
|
+
*/
|
|
1003
|
+
readonly version: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* The SHA-256 hash of the runtime module's bytes, as hex; verify the download against it.
|
|
1006
|
+
*/
|
|
1007
|
+
readonly sha256: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* Where to download the runtime module; its content never changes, so cache it by `sha256`.
|
|
1010
|
+
*/
|
|
1011
|
+
readonly url: string;
|
|
1012
|
+
/**
|
|
1013
|
+
* The runtime module's signature, as hex; empty for a module too old to be offered for download. SDKs run a downloaded module only when this signature verifies under a key built into the SDK, and otherwise show the flow with the runtime built into the SDK when it can.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly signature: string;
|
|
1016
|
+
} | null;
|
|
1017
|
+
};
|
|
1018
|
+
/**
|
|
1019
|
+
* When the release was published, as an ISO 8601 timestamp; null when it was not.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly publishedAt: string | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* The release's id.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly releaseId: string;
|
|
1026
|
+
/**
|
|
1027
|
+
* The release's version number within its paywall.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly version: number | "Infinity" | "-Infinity" | "NaN";
|
|
1030
|
+
} | null;
|
|
1031
|
+
/**
|
|
1032
|
+
* The id of the paywall release shown.
|
|
1033
|
+
*/
|
|
1034
|
+
readonly paywallReleaseId: string | null;
|
|
1035
|
+
/**
|
|
1036
|
+
* When the location started showing it, as an ISO 8601 timestamp.
|
|
1037
|
+
*/
|
|
1038
|
+
readonly startedAt: string;
|
|
1039
|
+
/**
|
|
1040
|
+
* How the showing was chosen: always `paywall_release`, also when an experiment picked the release.
|
|
1041
|
+
*/
|
|
1042
|
+
readonly type: SdkResolvedPaywallShowingJsonEncodingType;
|
|
1043
|
+
/**
|
|
1044
|
+
* Present when an A/B test chose what is shown and the request set `reportsExposure`: an opaque value to send unchanged as the `exposureToken` property of the first event of every presentation of this answer, whether the flow is shown (`$paywall_viewed`), fails (`$paywall_load_failed`) or is cancelled (`$paywall_load_cancelled`) before its first frame, and of `$paywall_handed_off` each time the SDK hands this answer to the app's own interface. Never send it for a prefetch. Sending it again, later or offline is safe; the person is counted once. It expires 30 days after the answer; an event carrying an expired token is stored and counts nobody.
|
|
1045
|
+
*/
|
|
1046
|
+
readonly exposureToken?: string | null | undefined;
|
|
1047
|
+
}
|
|
1048
|
+
interface SdkResolvedPaywallJsonEncoding {
|
|
1049
|
+
/**
|
|
1050
|
+
* The location the paywall is shown at.
|
|
1051
|
+
*/
|
|
1052
|
+
readonly location: {
|
|
1053
|
+
/**
|
|
1054
|
+
* The location's id.
|
|
1055
|
+
*/
|
|
1056
|
+
readonly id: string;
|
|
1057
|
+
readonly interfaceRevision: number | SdkResolvedPaywallJsonEncodingLocationInterfaceRevisionEnum;
|
|
1058
|
+
/**
|
|
1059
|
+
* The location's display name.
|
|
1060
|
+
*/
|
|
1061
|
+
readonly name: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* The location's slug, which the app shows paywalls by.
|
|
1064
|
+
*/
|
|
1065
|
+
readonly slug: string;
|
|
1066
|
+
};
|
|
1067
|
+
readonly showing: SdkResolvedPaywallShowingJsonEncoding;
|
|
1068
|
+
/**
|
|
1069
|
+
* The SHA-256 hashes, as hex, of flow packages withdrawn as bad that the app may hold for this location: never show one of them, not even as the package last shown here when the served one cannot be downloaded. At most 20, the most recently withdrawn of the flows read here; never the served package's hash. Left out when none is, as most answers are, and by servers that predate withdrawals.
|
|
1070
|
+
*/
|
|
1071
|
+
readonly withdrawnPackages?: ReadonlyArray<string> | null | undefined;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/** One evaluated flag. Plain JSON values, as the Voidhash API answers them. */
|
|
1075
|
+
interface SdkFeatureFlag {
|
|
1076
|
+
readonly enabled: boolean;
|
|
1077
|
+
readonly key: string;
|
|
1078
|
+
/** The selected variant's payload; untyped JSON, `null` when there is none. */
|
|
1079
|
+
readonly payload: unknown;
|
|
1080
|
+
/** The selected variant's key, `null` for a flag without variants. */
|
|
1081
|
+
readonly variantKey: string | null;
|
|
1082
|
+
}
|
|
1083
|
+
interface FeatureFlagsResult {
|
|
1084
|
+
/** Each flag's enabled state, variant key (`null` without a variant) and payload. */
|
|
1085
|
+
readonly flags: ReadonlyArray<SdkFeatureFlag>;
|
|
1086
|
+
/**
|
|
1087
|
+
* The evaluation was served from cache past its refresh window, or no
|
|
1088
|
+
* evaluation has ever succeeded. Flags are still safe to act on — they are
|
|
1089
|
+
* simply not guaranteed to reflect the latest dashboard state.
|
|
1090
|
+
*/
|
|
1091
|
+
readonly isStale?: boolean;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Developer-facing person attributes. `email` and `name` are reserved keys
|
|
1095
|
+
* mapped to the dedicated server fields; any other key is a custom trait,
|
|
1096
|
+
* whose value must be a string, a number, a boolean or `null`.
|
|
1097
|
+
*/
|
|
1098
|
+
interface PersonAttributes {
|
|
1099
|
+
email?: string;
|
|
1100
|
+
name?: string;
|
|
1101
|
+
[k: string]: unknown;
|
|
1102
|
+
}
|
|
1103
|
+
/** A group property's value: text, a number or a boolean. */
|
|
1104
|
+
type GroupPropertyValue = string | number | boolean;
|
|
1105
|
+
/** A group's properties, such as a company's `name`, `plan` or `seats`. */
|
|
1106
|
+
type GroupProperties = Readonly<Record<string, GroupPropertyValue>>;
|
|
1107
|
+
/** A group for `setGroups()`: its id, and any properties of the group beside it. */
|
|
1108
|
+
type Group = {
|
|
1109
|
+
readonly id: string | number;
|
|
1110
|
+
} & GroupProperties;
|
|
1111
|
+
/**
|
|
1112
|
+
* The groups `setGroups()` puts the end user in, by group type: each an id or
|
|
1113
|
+
* a {@link Group}. A type that is `null` or `undefined` is not in the set.
|
|
1114
|
+
*/
|
|
1115
|
+
type Groups = Readonly<Record<string, Group | string | number | null | undefined>>;
|
|
1116
|
+
/**
|
|
1117
|
+
* What the server assigns to a location, passed through untouched: the
|
|
1118
|
+
* showing and its release with the flow package, or `null` when nothing is
|
|
1119
|
+
* assigned.
|
|
1120
|
+
*/
|
|
1121
|
+
type ResolvedPaywall = SdkResolvedPaywallJsonEncoding | null;
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Stable, machine-matchable error codes surfaced on every {@link VoidhashError}
|
|
1125
|
+
* via `error.code`. Match on these when recovery differs; report the full error
|
|
1126
|
+
* for everything else.
|
|
1127
|
+
*/
|
|
1128
|
+
declare const VOIDHASH_ERROR_CODES: readonly ["FAILED_TO_INITIALIZE_VOIDHASH_CLIENT", "FAILED_TO_CAPTURE_STARTUP_EVENTS", "FAILED_TO_TRANSFER_ANALYTICS_EVENTS", "FAILED_TO_SETUP_LIFECYCLE_EVENTS", "FAILED_TO_END_VOIDHASH_CLIENT", "FAILED_TO_FETCH_SCHEMA", "FAILED_TO_GET_CURRENT_PERSON", "FAILED_TO_SET_PERSON_ATTRIBUTES", "FAILED_TO_SET_PERSON_ATTRIBUTES_SYNC", "FAILED_TO_RESET_PERSON_CACHE", "FAILED_TO_GET_DISTINCT_ID", "FAILED_TO_IDENTIFY", "FAILED_TO_RESET", "FAILED_TO_SIGN_OUT", "FAILED_TO_SET_GROUP", "FAILED_TO_RESET_GROUPS", "FAILED_TO_GET_FEATURE_FLAGS", "FAILED_TO_GET_PAYWALL_FOR_LOCATION", "PAYWALL_UNAVAILABLE", "FLOW_DISABLED", "FLOW_NOT_ASSIGNED", "FLOW_UNAVAILABLE", "FLOW_RENDERER_MISSING", "FLOW_UNSUPPORTED_PACKAGE", "FLOW_PRODUCTS_UNAVAILABLE", "FLOW_PRESENTATION_FAILED", "AUTHENTICATION_FAILED", "FAILED_TO_GET_PRODUCTS", "FAILED_TO_PURCHASE", "PURCHASE_IN_PROGRESS", "OFFER_UNAVAILABLE", "REPLACED_SUBSCRIPTION_NOT_OWNED", "SUBSCRIPTION_REPLACEMENT_REFUSED", "FAILED_TO_RESTORE_PURCHASES", "FAILED_TO_SYNC_PURCHASES", "FAILED_TO_REPORT_TRANSACTION", "FAILED_TO_FLUSH_ANALYTICS", "FAILED_TO_SET_ANALYTICS_CONSENT", "FAILED_TO_PRESENT_CODE_REDEMPTION", "FAILED_TO_SHOW_MANAGE_SUBSCRIPTIONS", "FAILED_TO_GET_STOREFRONT", "FAILED_TO_CHECK_CAN_MAKE_PAYMENTS", "FAILED_TO_BEGIN_REFUND_REQUEST", "FAILED_TO_GET_SUBSCRIPTION_STATUS", "FAILED_TO_GET_CURRENT_ENTITLEMENTS", "FAILED_TO_GET_APP_TRANSACTION", "FAILED_TO_SHOW_IN_APP_MESSAGES", "FAILED_TO_QUERY_PURCHASES", "FAILED_TO_CHECK_FEATURE_SUPPORT", "INVALID_ARGUMENT", "VOIDHASH_CLIENT_NOT_INITIALIZED", "READ_ONLY_PURCHASE_NOT_ALLOWED", "SCHEME_NOT_SET", "UNSUPPORTED_PLATFORM", "UNKNOWN"];
|
|
1129
|
+
type VoidhashErrorCode = (typeof VOIDHASH_ERROR_CODES)[number];
|
|
1130
|
+
/**
|
|
1131
|
+
* Why a purchase failed, when the store said:
|
|
1132
|
+
*
|
|
1133
|
+
* - `paymentDeclined`: Google Play only. The payment method was declined,
|
|
1134
|
+
* such as for insufficient funds; StoreKit reports no declined payment.
|
|
1135
|
+
* - `ineligibleForOffer`: the store account cannot get the offer, such as a
|
|
1136
|
+
* free trial it already used on Google Play, or a promotional or win-back
|
|
1137
|
+
* offer the App Store refuses it. Nothing was bought; the products reload
|
|
1138
|
+
* without it, and buying again charges the regular price.
|
|
1139
|
+
*/
|
|
1140
|
+
type VoidhashErrorReason = "paymentDeclined" | "ineligibleForOffer";
|
|
1141
|
+
declare class VoidhashError extends Error {
|
|
1142
|
+
readonly code: VoidhashErrorCode;
|
|
1143
|
+
/** Why it failed, when the store said; see {@link VoidhashErrorReason}. */
|
|
1144
|
+
readonly reason?: VoidhashErrorReason;
|
|
1145
|
+
constructor(code: VoidhashErrorCode, message?: string, options?: {
|
|
1146
|
+
cause?: unknown;
|
|
1147
|
+
reason?: VoidhashErrorReason;
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* What an app lets its flows do, granted at SDK setup. Purchases, restores,
|
|
1153
|
+
* closing and analytics need no grant; an action needing a capability the
|
|
1154
|
+
* app did not grant is dropped with a warning.
|
|
1155
|
+
*
|
|
1156
|
+
* - `notifications`: ask the user to allow notifications.
|
|
1157
|
+
* - `tracking`: ask the user to allow tracking (App Tracking Transparency on iOS).
|
|
1158
|
+
* - `attributes`: set attributes on the current person.
|
|
1159
|
+
* - `links`: open links outside the app.
|
|
1160
|
+
*/
|
|
1161
|
+
type FlowCapability = "notifications" | "tracking" | "attributes" | "links";
|
|
1162
|
+
/**
|
|
1163
|
+
* Which flow runtime draws flows, for the whole app process.
|
|
1164
|
+
*
|
|
1165
|
+
* - `linked`: the runtime built into the SDK (the default).
|
|
1166
|
+
* - `module`: the flow runtime module each flow names, which the SDK
|
|
1167
|
+
* downloads once, verifies and caches, so flows can use flow editor
|
|
1168
|
+
* features newer than the SDK. Not yet recommended for production.
|
|
1169
|
+
*/
|
|
1170
|
+
type FlowRuntime = "linked" | "module";
|
|
1171
|
+
/**
|
|
1172
|
+
* What a paywall shows while it waits for the network: `standard` (the default),
|
|
1173
|
+
* the native SDK's loading screen 0.4 seconds after `presentFlow`, which the end
|
|
1174
|
+
* user can close; `none`, the app's screen as it is until the paywall is shown.
|
|
1175
|
+
*/
|
|
1176
|
+
type FlowLoading = "standard" | "none";
|
|
1177
|
+
/** Capabilities granted when `flowCapabilities` is not set. */
|
|
1178
|
+
declare const DEFAULT_FLOW_CAPABILITIES: ReadonlyArray<FlowCapability>;
|
|
1179
|
+
/** Codes of the errors a failed flow presentation carries. */
|
|
1180
|
+
type FlowErrorCode = Extract<VoidhashErrorCode, `FLOW_${string}`>;
|
|
1181
|
+
/**
|
|
1182
|
+
* How a presented flow ended.
|
|
1183
|
+
*
|
|
1184
|
+
* - `outcome`: `purchased` when a purchase ended the flow, `restored` when a
|
|
1185
|
+
* restore did, `dismissed` when the user or the app closed it or another
|
|
1186
|
+
* flow replaced it; otherwise the outcome the flow finished with.
|
|
1187
|
+
* - `output`: the flow's outputs by name; empty when it declares none.
|
|
1188
|
+
* - `productId`: the store product bought, when the outcome is `purchased`.
|
|
1189
|
+
*
|
|
1190
|
+
* A flow that could not be presented is not a result: `presentFlow()` rejects.
|
|
1191
|
+
*/
|
|
1192
|
+
interface FlowResult<L extends string = string> {
|
|
1193
|
+
readonly outcome: FlowOutcome<L>;
|
|
1194
|
+
readonly output: FlowOutput<L>;
|
|
1195
|
+
readonly productId?: string;
|
|
1196
|
+
/**
|
|
1197
|
+
* `false` when the presentation ended before the paywall reached the screen,
|
|
1198
|
+
* with the outcome `dismissed`: the end user closed the loading screen, or the
|
|
1199
|
+
* app dismissed it or presented another paywall while it loaded. Absent from
|
|
1200
|
+
* native SDKs that do not report it; read absent as `true`.
|
|
1201
|
+
*/
|
|
1202
|
+
readonly wasShown?: boolean;
|
|
1203
|
+
}
|
|
1204
|
+
type RequiredWhenNotEmpty<Key extends string, Value> = Record<never, never> extends Value ? {
|
|
1205
|
+
readonly [K in Key]?: Value;
|
|
1206
|
+
} : {
|
|
1207
|
+
readonly [K in Key]: Value;
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* What an app passes to one presentation of the flow at location `L`.
|
|
1211
|
+
*
|
|
1212
|
+
* - `input`: the flow's inputs by name.
|
|
1213
|
+
* - `actions`: a handler per app action the flow can call.
|
|
1214
|
+
* - `revision`: the interface revision the app was built against. Leave it
|
|
1215
|
+
* out to use the one set for the location in the `flowRevisions` option.
|
|
1216
|
+
*/
|
|
1217
|
+
type PresentFlowOptions<L extends string = string> = {
|
|
1218
|
+
readonly revision?: number;
|
|
1219
|
+
} & RequiredWhenNotEmpty<"input", FlowInput<L>> & RequiredWhenNotEmpty<"actions", FlowActions<L>>;
|
|
1220
|
+
/**
|
|
1221
|
+
* The arguments of a presentation after its location: the options are
|
|
1222
|
+
* required when the location's flow has required inputs or app actions.
|
|
1223
|
+
*/
|
|
1224
|
+
type PresentFlowArguments<L extends string = string> = Record<never, never> extends PresentFlowOptions<L> ? [options?: PresentFlowOptions<L>] : [options: PresentFlowOptions<L>];
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Product durations the server sends today. Decoded definitions accept any
|
|
1228
|
+
* string in their `duration` fields, so a duration added by a newer server
|
|
1229
|
+
* keeps its product readable; code that relies on the duration treats a
|
|
1230
|
+
* value outside this list as no duration.
|
|
1231
|
+
*/
|
|
1232
|
+
declare const RuntimeProductDuration: Schema.Literals<readonly ["weekly", "monthly", "quarterly", "semi-annual", "annual"]>;
|
|
1233
|
+
type RuntimeProductDuration = typeof RuntimeProductDuration.Type;
|
|
1234
|
+
/**
|
|
1235
|
+
* An offer of a product on one store: `id` is how paywalls and apps name it
|
|
1236
|
+
* (the same on every store), `offerId` the store's identifier.
|
|
1237
|
+
*/
|
|
1238
|
+
declare const RuntimeStoreOffer: Schema.Struct<{
|
|
1239
|
+
readonly id: Schema.String;
|
|
1240
|
+
readonly offerId: Schema.String;
|
|
1241
|
+
}>;
|
|
1242
|
+
type RuntimeStoreOffer = typeof RuntimeStoreOffer.Type;
|
|
1243
|
+
declare const RuntimeAppleAppStoreProductConfiguration: Schema.Struct<{
|
|
1244
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1245
|
+
readonly id: Schema.String;
|
|
1246
|
+
readonly offerId: Schema.String;
|
|
1247
|
+
}>>>;
|
|
1248
|
+
readonly productId: Schema.String;
|
|
1249
|
+
}>;
|
|
1250
|
+
type RuntimeAppleAppStoreProductConfiguration = typeof RuntimeAppleAppStoreProductConfiguration.Type;
|
|
1251
|
+
declare const RuntimeGooglePlayProductConfiguration: Schema.Struct<{
|
|
1252
|
+
readonly basePlanId: Schema.optional<Schema.String>;
|
|
1253
|
+
/** Developer offers on the base plan. */
|
|
1254
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1255
|
+
readonly id: Schema.String;
|
|
1256
|
+
readonly offerId: Schema.String;
|
|
1257
|
+
}>>>;
|
|
1258
|
+
readonly productId: Schema.String;
|
|
1259
|
+
}>;
|
|
1260
|
+
type RuntimeGooglePlayProductConfiguration = typeof RuntimeGooglePlayProductConfiguration.Type;
|
|
1261
|
+
/**
|
|
1262
|
+
* Development-mode pricing. `currencyCode` and `period` are plain strings so
|
|
1263
|
+
* a currency or period added by a newer server keeps the product readable.
|
|
1264
|
+
*/
|
|
1265
|
+
declare const RuntimeDevelopmentProductConfiguration: Schema.Struct<{
|
|
1266
|
+
readonly currencyCode: Schema.String;
|
|
1267
|
+
readonly duration: Schema.OptionFromNullOr<Schema.String>;
|
|
1268
|
+
readonly period: Schema.String;
|
|
1269
|
+
readonly periodCount: Schema.Number;
|
|
1270
|
+
readonly price: Schema.Number;
|
|
1271
|
+
readonly priceInMinorUnits: Schema.Number;
|
|
1272
|
+
readonly productId: Schema.String;
|
|
1273
|
+
readonly warning: Schema.OptionFromNullOr<Schema.String>;
|
|
1274
|
+
}>;
|
|
1275
|
+
type RuntimeDevelopmentProductConfiguration = typeof RuntimeDevelopmentProductConfiguration.Type;
|
|
1276
|
+
declare const RuntimeProductProviders: Schema.Struct<{
|
|
1277
|
+
readonly appleAppStore: Schema.optional<Schema.Struct<{
|
|
1278
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1279
|
+
readonly id: Schema.String;
|
|
1280
|
+
readonly offerId: Schema.String;
|
|
1281
|
+
}>>>;
|
|
1282
|
+
readonly productId: Schema.String;
|
|
1283
|
+
}>>;
|
|
1284
|
+
readonly development: Schema.optional<Schema.Struct<{
|
|
1285
|
+
readonly currencyCode: Schema.String;
|
|
1286
|
+
readonly duration: Schema.OptionFromNullOr<Schema.String>;
|
|
1287
|
+
readonly period: Schema.String;
|
|
1288
|
+
readonly periodCount: Schema.Number;
|
|
1289
|
+
readonly price: Schema.Number;
|
|
1290
|
+
readonly priceInMinorUnits: Schema.Number;
|
|
1291
|
+
readonly productId: Schema.String;
|
|
1292
|
+
readonly warning: Schema.OptionFromNullOr<Schema.String>;
|
|
1293
|
+
}>>;
|
|
1294
|
+
readonly googlePlay: Schema.optional<Schema.Struct<{
|
|
1295
|
+
readonly basePlanId: Schema.optional<Schema.String>;
|
|
1296
|
+
/** Developer offers on the base plan. */
|
|
1297
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1298
|
+
readonly id: Schema.String;
|
|
1299
|
+
readonly offerId: Schema.String;
|
|
1300
|
+
}>>>;
|
|
1301
|
+
readonly productId: Schema.String;
|
|
1302
|
+
}>>;
|
|
1303
|
+
}>;
|
|
1304
|
+
type RuntimeProductProviders = typeof RuntimeProductProviders.Type;
|
|
1305
|
+
/**
|
|
1306
|
+
* One product. `type` is a plain string (the server sends `subscription`,
|
|
1307
|
+
* `one-time` or `one-time-consumable` today) so a product type added by a
|
|
1308
|
+
* newer server keeps the product readable: only `one-time-consumable` is
|
|
1309
|
+
* ever consumed, anything else is finished as a non-consumable.
|
|
1310
|
+
*/
|
|
1311
|
+
declare const RuntimeProductDefinition: Schema.Struct<{
|
|
1312
|
+
readonly configuration: Schema.Struct<{
|
|
1313
|
+
readonly perks: Schema.$Record<Schema.String, Schema.Literal<true>>;
|
|
1314
|
+
readonly providers: Schema.Struct<{
|
|
1315
|
+
readonly appleAppStore: Schema.optional<Schema.Struct<{
|
|
1316
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1317
|
+
readonly id: Schema.String;
|
|
1318
|
+
readonly offerId: Schema.String;
|
|
1319
|
+
}>>>;
|
|
1320
|
+
readonly productId: Schema.String;
|
|
1321
|
+
}>>;
|
|
1322
|
+
readonly development: Schema.optional<Schema.Struct<{
|
|
1323
|
+
readonly currencyCode: Schema.String;
|
|
1324
|
+
readonly duration: Schema.OptionFromNullOr<Schema.String>;
|
|
1325
|
+
readonly period: Schema.String;
|
|
1326
|
+
readonly periodCount: Schema.Number;
|
|
1327
|
+
readonly price: Schema.Number;
|
|
1328
|
+
readonly priceInMinorUnits: Schema.Number;
|
|
1329
|
+
readonly productId: Schema.String;
|
|
1330
|
+
readonly warning: Schema.OptionFromNullOr<Schema.String>;
|
|
1331
|
+
}>>;
|
|
1332
|
+
readonly googlePlay: Schema.optional<Schema.Struct<{
|
|
1333
|
+
readonly basePlanId: Schema.optional<Schema.String>;
|
|
1334
|
+
/** Developer offers on the base plan. */
|
|
1335
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1336
|
+
readonly id: Schema.String;
|
|
1337
|
+
readonly offerId: Schema.String;
|
|
1338
|
+
}>>>;
|
|
1339
|
+
readonly productId: Schema.String;
|
|
1340
|
+
}>>;
|
|
1341
|
+
}>;
|
|
1342
|
+
}>;
|
|
1343
|
+
readonly duration: Schema.optional<Schema.OptionFromNullOr<Schema.String>>;
|
|
1344
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1345
|
+
readonly properties: Schema.Struct<{
|
|
1346
|
+
readonly name: Schema.String;
|
|
1347
|
+
}>;
|
|
1348
|
+
readonly slug: Schema.String;
|
|
1349
|
+
readonly type: Schema.String;
|
|
1350
|
+
}>;
|
|
1351
|
+
type RuntimeProductDefinition = typeof RuntimeProductDefinition.Type;
|
|
1352
|
+
declare const RuntimePaywallLocationDefinition: Schema.Struct<{
|
|
1353
|
+
readonly description: Schema.withDecodingDefaultTypeKey<Schema.OptionFromNullOr<Schema.String>, never>;
|
|
1354
|
+
readonly name: Schema.String;
|
|
1355
|
+
readonly slug: Schema.String;
|
|
1356
|
+
}>;
|
|
1357
|
+
type RuntimePaywallLocationDefinition = typeof RuntimePaywallLocationDefinition.Type;
|
|
1358
|
+
declare const RuntimePerkDefinition: Schema.Struct<{
|
|
1359
|
+
readonly name: Schema.String;
|
|
1360
|
+
readonly slug: Schema.String;
|
|
1361
|
+
}>;
|
|
1362
|
+
type RuntimePerkDefinition = typeof RuntimePerkDefinition.Type;
|
|
1363
|
+
/**
|
|
1364
|
+
* The full schema fetched from the server, decoded so nullable wire fields
|
|
1365
|
+
* are represented as `Option` inside the SDK.
|
|
1366
|
+
*/
|
|
1367
|
+
declare const RuntimeSchemaValue: Schema.Struct<{
|
|
1368
|
+
readonly locations: Schema.$Record<Schema.String, Schema.Struct<{
|
|
1369
|
+
readonly description: Schema.withDecodingDefaultTypeKey<Schema.OptionFromNullOr<Schema.String>, never>;
|
|
1370
|
+
readonly name: Schema.String;
|
|
1371
|
+
readonly slug: Schema.String;
|
|
1372
|
+
}>>;
|
|
1373
|
+
readonly perks: Schema.$Record<Schema.String, Schema.Struct<{
|
|
1374
|
+
readonly name: Schema.String;
|
|
1375
|
+
readonly slug: Schema.String;
|
|
1376
|
+
}>>;
|
|
1377
|
+
readonly products: Schema.$Record<Schema.String, Schema.Struct<{
|
|
1378
|
+
readonly configuration: Schema.Struct<{
|
|
1379
|
+
readonly perks: Schema.$Record<Schema.String, Schema.Literal<true>>;
|
|
1380
|
+
readonly providers: Schema.Struct<{
|
|
1381
|
+
readonly appleAppStore: Schema.optional<Schema.Struct<{
|
|
1382
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1383
|
+
readonly id: Schema.String;
|
|
1384
|
+
readonly offerId: Schema.String;
|
|
1385
|
+
}>>>;
|
|
1386
|
+
readonly productId: Schema.String;
|
|
1387
|
+
}>>;
|
|
1388
|
+
readonly development: Schema.optional<Schema.Struct<{
|
|
1389
|
+
readonly currencyCode: Schema.String;
|
|
1390
|
+
readonly duration: Schema.OptionFromNullOr<Schema.String>;
|
|
1391
|
+
readonly period: Schema.String;
|
|
1392
|
+
readonly periodCount: Schema.Number;
|
|
1393
|
+
readonly price: Schema.Number;
|
|
1394
|
+
readonly priceInMinorUnits: Schema.Number;
|
|
1395
|
+
readonly productId: Schema.String;
|
|
1396
|
+
readonly warning: Schema.OptionFromNullOr<Schema.String>;
|
|
1397
|
+
}>>;
|
|
1398
|
+
readonly googlePlay: Schema.optional<Schema.Struct<{
|
|
1399
|
+
readonly basePlanId: Schema.optional<Schema.String>;
|
|
1400
|
+
/** Developer offers on the base plan. */
|
|
1401
|
+
readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1402
|
+
readonly id: Schema.String;
|
|
1403
|
+
readonly offerId: Schema.String;
|
|
1404
|
+
}>>>;
|
|
1405
|
+
readonly productId: Schema.String;
|
|
1406
|
+
}>>;
|
|
1407
|
+
}>;
|
|
1408
|
+
}>;
|
|
1409
|
+
readonly duration: Schema.optional<Schema.OptionFromNullOr<Schema.String>>;
|
|
1410
|
+
readonly id: Schema.optional<Schema.String>;
|
|
1411
|
+
readonly properties: Schema.Struct<{
|
|
1412
|
+
readonly name: Schema.String;
|
|
1413
|
+
}>;
|
|
1414
|
+
readonly slug: Schema.String;
|
|
1415
|
+
readonly type: Schema.String;
|
|
1416
|
+
}>>;
|
|
1417
|
+
readonly version: Schema.String;
|
|
1418
|
+
}>;
|
|
1419
|
+
type RuntimeSchemaValue = typeof RuntimeSchemaValue.Type;
|
|
1420
|
+
type RuntimeSchema = RuntimeSchemaValue;
|
|
1421
|
+
type RuntimeSchemaEncoded = typeof RuntimeSchemaValue.Encoded;
|
|
1422
|
+
declare const createEmptyRuntimeSchema: () => RuntimeSchema;
|
|
1423
|
+
|
|
1424
|
+
/** Integration that observed a screen transition. */
|
|
1425
|
+
type ScreenSource = "expo-router" | "react-navigation" | "nitro-ui-navigation" | "uikit" | "swiftui" | "android-activity" | "android-fragment" | "compose-navigation" | "manual";
|
|
1426
|
+
/** One screen the user arrived on, as reported by an integration. */
|
|
1427
|
+
interface ScreenView {
|
|
1428
|
+
/**
|
|
1429
|
+
* Router-owned token identifying this screen instance (route key, pathname,
|
|
1430
|
+
* controller instance). Two views with the same identity are the same screen
|
|
1431
|
+
* and only the first one emits.
|
|
1432
|
+
*/
|
|
1433
|
+
identity: string;
|
|
1434
|
+
/** Stable, low-cardinality screen identity. Never contains ids. */
|
|
1435
|
+
name: string;
|
|
1436
|
+
/** Concrete location, with dynamic segment values filled in. */
|
|
1437
|
+
path: string;
|
|
1438
|
+
/** Human title when the platform exposes one. */
|
|
1439
|
+
title?: string;
|
|
1440
|
+
/** Route params. Only forwarded when `includeParams` is on. */
|
|
1441
|
+
params?: Record<string, unknown>;
|
|
1442
|
+
source: ScreenSource;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Whether the end user agreed to usage analytics. `denied` and `pending` act
|
|
1447
|
+
* the same: nothing analytics-related is captured, stored or sent. Purchases,
|
|
1448
|
+
* restores, entitlements, identity, flags and paywalls are unaffected.
|
|
1449
|
+
*/
|
|
1450
|
+
type AnalyticsConsent = "granted" | "denied" | "pending";
|
|
1451
|
+
/** What happens to analytics captured while consent is `"pending"`. */
|
|
1452
|
+
type AnalyticsWhilePending = "drop" | "buffer";
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* The native flow module as earlier releases drove it from JavaScript.
|
|
1456
|
+
* @deprecated No longer used: the native client presents flows itself. Kept
|
|
1457
|
+
* so code that imports the type still compiles; removed in a future release.
|
|
1458
|
+
*/
|
|
1459
|
+
interface VoidhashFlowsPort {
|
|
1460
|
+
readonly isRendererAvailable: boolean;
|
|
1461
|
+
engineCapabilities?(): string;
|
|
1462
|
+
present(requestJson: string, purchase: (productId: string, offerId: string) => Promise<void>, restore: () => Promise<void>, setAttribute: (name: string, valueJson: string) => Promise<void>, loadState: (key: string) => Promise<string>, saveState: (key: string, variablesJson: string) => Promise<void>, clearState: (key: string) => Promise<void>, track: (name: string, propertiesJson: string) => void, screen: (name: string, propertiesJson: string) => void): Promise<string>;
|
|
1463
|
+
preload(requestJson: string): Promise<void>;
|
|
1464
|
+
dismiss(): Promise<void>;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* A reachability source as the `connectivity` option took it: a subscribe
|
|
1468
|
+
* function returning an unsubscribe callback.
|
|
1469
|
+
*/
|
|
1470
|
+
interface ConnectivityPort {
|
|
1471
|
+
readonly subscribe: (listener: (online: boolean) => void) => () => void;
|
|
1472
|
+
}
|
|
1473
|
+
/** Controls the built-in `$screen` event. */
|
|
1474
|
+
interface ScreenTrackingOptions {
|
|
1475
|
+
/** Default `true`. `false` makes every integration and `screen()` a no-op. */
|
|
1476
|
+
enabled?: boolean;
|
|
1477
|
+
/** Default `false`. Adds `$screen_params` (route params, string-coerced, max 20 keys). */
|
|
1478
|
+
includeParams?: boolean;
|
|
1479
|
+
/**
|
|
1480
|
+
* Rewrites or drops a screen before capture. Return `null` to skip it. A
|
|
1481
|
+
* throw, or a result whose `identity`, `name` or `path` is not a string,
|
|
1482
|
+
* tracks the screen unmapped and is reported as `HOST_CALLBACK_FAILED`.
|
|
1483
|
+
*/
|
|
1484
|
+
mapScreen?: (view: ScreenView) => ScreenView | null;
|
|
1485
|
+
}
|
|
1486
|
+
/** How feature flag reads behave before Voidhash has answered them. */
|
|
1487
|
+
interface FeatureFlagsOptions {
|
|
1488
|
+
/**
|
|
1489
|
+
* What a flag reads as while it has no evaluated value: before its first
|
|
1490
|
+
* evaluation arrives, and when Voidhash cannot be reached and nothing is
|
|
1491
|
+
* cached. `useFeatureFlags().isEnabled()` answers it, on a disabled client
|
|
1492
|
+
* too, and `getFeatureFlags()` answers each requested key that has one as
|
|
1493
|
+
* a flag without a variant. Flags without a default read as `false`. Use
|
|
1494
|
+
* `true` for a flag whose feature must stay on when Voidhash is unreachable.
|
|
1495
|
+
*/
|
|
1496
|
+
readonly defaults?: Readonly<Record<string, boolean>>;
|
|
1497
|
+
/**
|
|
1498
|
+
* How long a flag read with nothing cached waits for Voidhash before it
|
|
1499
|
+
* answers with no flags, in milliseconds (default 2000). The evaluation
|
|
1500
|
+
* carries on in the background, and the hooks update when it lands. A
|
|
1501
|
+
* cached value never waits more than 500 ms. A request gives up after 10
|
|
1502
|
+
* seconds, so a longer wait ends there.
|
|
1503
|
+
*/
|
|
1504
|
+
readonly maxWaitMs?: number;
|
|
1505
|
+
}
|
|
1506
|
+
interface VoidhashClientOptions {
|
|
1507
|
+
/**
|
|
1508
|
+
* The end user's consent to usage analytics (default `"granted"`). While it
|
|
1509
|
+
* is `"denied"` or `"pending"` the SDK captures, stores and sends no
|
|
1510
|
+
* analytics: no custom events, screens, lifecycle or install events or
|
|
1511
|
+
* paywall impressions. What the app says about the end user is not
|
|
1512
|
+
* analytics: `identify()`, person attributes and groups are sent whatever
|
|
1513
|
+
* the consent, and purchases, restores, entitlements, feature flags and
|
|
1514
|
+
* paywalls work as usual.
|
|
1515
|
+
* A consent set later with `client.setAnalyticsConsent()` is stored on the
|
|
1516
|
+
* device and takes precedence over this option on the next launch.
|
|
1517
|
+
*/
|
|
1518
|
+
analyticsConsent?: AnalyticsConsent;
|
|
1519
|
+
/**
|
|
1520
|
+
* What happens to analytics captured while consent is `"pending"` (default
|
|
1521
|
+
* `"drop"`). `"buffer"` holds up to 100 events in memory, with the time
|
|
1522
|
+
* each happened, and records them once consent is granted; a denial
|
|
1523
|
+
* discards them. Nothing is sent or stored while they are held. Person
|
|
1524
|
+
* attributes and groups are never held: they are sent whatever the consent.
|
|
1525
|
+
*/
|
|
1526
|
+
analyticsWhilePending?: AnalyticsWhilePending;
|
|
1527
|
+
/**
|
|
1528
|
+
* `true` makes `identify()` grant a `"pending"` consent, for apps whose
|
|
1529
|
+
* sign-in accepts their terms (default `false`). A `"denied"` consent is
|
|
1530
|
+
* never overridden. `signOut()` and `reset()` send what was recorded and
|
|
1531
|
+
* return that consent to `"pending"`; a consent set with
|
|
1532
|
+
* `setAnalyticsConsent()` is the app's own decision and stays.
|
|
1533
|
+
*/
|
|
1534
|
+
grantConsentOnIdentify?: boolean;
|
|
1535
|
+
/**
|
|
1536
|
+
* Captures `$app_installed`, `$app_updated`, `$app_opened`,
|
|
1537
|
+
* `$app_backgrounded`, `$app_became_active`, `$app_crashed` and `$sign_out`
|
|
1538
|
+
* automatically (default `true`). Turn it off when the app reports these
|
|
1539
|
+
* events itself.
|
|
1540
|
+
*/
|
|
1541
|
+
automaticLifecycleEvents?: boolean;
|
|
1542
|
+
baseUrl?: string;
|
|
1543
|
+
debug?: boolean;
|
|
1544
|
+
/** Enables isolated test purchases in debug builds. Release builds always ignore this option. */
|
|
1545
|
+
dev?: boolean;
|
|
1546
|
+
distinctId?: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* Reads which ad brought this install and records it on the person as a
|
|
1549
|
+
* touch (default `true`): Apple Ads on iOS, the Google Play install referrer
|
|
1550
|
+
* and, with `metaAppId`, Meta's apps on Android. Runs once per install, in
|
|
1551
|
+
* the background, only with analytics consent. An install that predates this
|
|
1552
|
+
* option is not read.
|
|
1553
|
+
*/
|
|
1554
|
+
installAttribution?: boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* The app's Meta (Facebook) app id. On Android, `installAttribution` then also
|
|
1557
|
+
* asks the Facebook, Instagram and Facebook Lite apps on the device for the ad
|
|
1558
|
+
* behind the install, which is preferred over the Play referrer. iOS ignores it.
|
|
1559
|
+
*/
|
|
1560
|
+
metaAppId?: string;
|
|
1561
|
+
/**
|
|
1562
|
+
* When StoreKit shows its own messages, such as a price increase to agree
|
|
1563
|
+
* to or a billing issue (default `"deferWhileFlowPresented"`): at once
|
|
1564
|
+
* (`"automatic"`), or held while a Voidhash flow is on screen and shown once
|
|
1565
|
+
* it closes. Google Play ignores it.
|
|
1566
|
+
*/
|
|
1567
|
+
appStoreMessages?: "automatic" | "deferWhileFlowPresented";
|
|
1568
|
+
/**
|
|
1569
|
+
* What happens to a purchase the end user starts on the App Store, such as
|
|
1570
|
+
* a promoted in-app purchase or a win-back offer (default
|
|
1571
|
+
* `"purchaseWhenReady"`). `"purchaseWhenReady"` buys it once `init()` has
|
|
1572
|
+
* finished, never before. `"manual"` hands it to the listeners of
|
|
1573
|
+
* `client.appStore.addPurchaseIntentListener()`, to complete with
|
|
1574
|
+
* `purchase()` when the app is ready; one that arrives before a listener
|
|
1575
|
+
* is added waits for the first. Google Play ignores it.
|
|
1576
|
+
*/
|
|
1577
|
+
purchaseIntents?: "purchaseWhenReady" | "manual";
|
|
1578
|
+
/**
|
|
1579
|
+
* Ships the SDK fully disabled (default `true`). A disabled client never
|
|
1580
|
+
* connects to the native store, never talks to the network and never
|
|
1581
|
+
* registers listeners: `init()` and every side-effect method resolve as
|
|
1582
|
+
* no-ops, and reads answer with their empty shape. Intended for
|
|
1583
|
+
* feature-flagged rollouts, where mounting the provider unconditionally
|
|
1584
|
+
* avoids hook-order violations.
|
|
1585
|
+
*
|
|
1586
|
+
* Fixed at construction. Enabling the SDK later means creating a new client
|
|
1587
|
+
* — cheap, because a disabled client never builds its Effect runtime and so
|
|
1588
|
+
* holds no store connection, timers or listeners.
|
|
1589
|
+
*/
|
|
1590
|
+
enabled?: boolean;
|
|
1591
|
+
/**
|
|
1592
|
+
* What flows may do in this app (default `["links"]`). Purchases, restores,
|
|
1593
|
+
* closing and analytics need no grant. `notifications` and `tracking` let a
|
|
1594
|
+
* flow ask for those system permissions, `attributes` lets it set person
|
|
1595
|
+
* attributes and `links` lets it open links outside the app. A flow action
|
|
1596
|
+
* needing a capability that is not granted is ignored.
|
|
1597
|
+
*/
|
|
1598
|
+
flowCapabilities?: ReadonlyArray<FlowCapability>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Which flow runtime draws flows (default `linked`, the one built into the
|
|
1601
|
+
* SDK). `module` draws them with the flow runtime module each flow names,
|
|
1602
|
+
* downloaded once, verified and cached. It applies to the whole app process
|
|
1603
|
+
* from the first `init()`, on iOS and Android, and needs the native flow
|
|
1604
|
+
* renderer; `linked` leaves the renderer as native code set it.
|
|
1605
|
+
*/
|
|
1606
|
+
flowRuntime?: FlowRuntime;
|
|
1607
|
+
/**
|
|
1608
|
+
* What a paywall shows while it waits for the network (default `standard`):
|
|
1609
|
+
* the native SDK's loading screen, shown 0.4 seconds after `presentFlow` until
|
|
1610
|
+
* the paywall takes its place, which the end user can close (`presentFlow`
|
|
1611
|
+
* then resolves with the outcome `dismissed` and `wasShown: false`). `none`
|
|
1612
|
+
* keeps the app's screen as it is until the paywall is shown. A paywall
|
|
1613
|
+
* already on the device appears before then either way.
|
|
1614
|
+
*/
|
|
1615
|
+
flowLoading?: FlowLoading;
|
|
1616
|
+
/** How feature flag reads behave before Voidhash has answered them; see {@link FeatureFlagsOptions}. */
|
|
1617
|
+
featureFlags?: FeatureFlagsOptions;
|
|
1618
|
+
ingestUrl?: string;
|
|
1619
|
+
/**
|
|
1620
|
+
* @deprecated No longer needed: the SDK observes reachability and the app
|
|
1621
|
+
* lifecycle natively and recovers on its own when the device comes back
|
|
1622
|
+
* online or to the foreground. Still accepted, and ignored.
|
|
1623
|
+
*/
|
|
1624
|
+
connectivity?: ConnectivityPort;
|
|
1625
|
+
/**
|
|
1626
|
+
* Called for every non-fatal event the SDK handled itself — a request that
|
|
1627
|
+
* failed and will be retried, an event evicted from a full queue, a rejected
|
|
1628
|
+
* publishable key. Purely informational; exceptions thrown here are
|
|
1629
|
+
* swallowed. Prefer this over `unstable_swallowErrors`.
|
|
1630
|
+
*/
|
|
1631
|
+
onDiagnostic?: VoidhashDiagnosticHandler;
|
|
1632
|
+
/**
|
|
1633
|
+
* Locations whose flows are downloaded at boot, so their first
|
|
1634
|
+
* `presentFlow()` shows without a round trip. Locations the device has
|
|
1635
|
+
* presented before are preloaded anyway. Nothing is preloaded when the app
|
|
1636
|
+
* does not include the flow renderer.
|
|
1637
|
+
*/
|
|
1638
|
+
preloadLocations?: string[];
|
|
1639
|
+
/**
|
|
1640
|
+
* The interface revision the app was built against, by location slug. Pass
|
|
1641
|
+
* the `flowRevisions` constant of the generated declarations: a location's
|
|
1642
|
+
* revision is then used to preload its flow and by every `presentFlow()`
|
|
1643
|
+
* that names none. A location that is not listed counts as revision 0.
|
|
1644
|
+
*/
|
|
1645
|
+
flowRevisions?: Readonly<Record<string, number>>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Starts the SDK in observer mode: transactions are reported to Voidhash but
|
|
1648
|
+
* never finished/acknowledged with the store, and purchases are blocked, so
|
|
1649
|
+
* another billing integration can own them. Off by default. Can be flipped
|
|
1650
|
+
* later with `client.setReadOnly()`.
|
|
1651
|
+
*/
|
|
1652
|
+
readOnly?: boolean;
|
|
1653
|
+
scheme?: string;
|
|
1654
|
+
/**
|
|
1655
|
+
* Automatic screen tracking (`$screen`). On by default; the Expo Router and
|
|
1656
|
+
* React Navigation integrations under `@voidhash/react-native/expo-router`
|
|
1657
|
+
* and `@voidhash/react-native/react-navigation` feed it, as does
|
|
1658
|
+
* `client.screen()`.
|
|
1659
|
+
*/
|
|
1660
|
+
screenTracking?: ScreenTrackingOptions;
|
|
1661
|
+
/**
|
|
1662
|
+
* @deprecated Transport failures no longer surface as errors, so there is
|
|
1663
|
+
* nothing left for this to swallow. Use `onDiagnostic` to observe recovered
|
|
1664
|
+
* failures instead. Removed in a future release.
|
|
1665
|
+
*/
|
|
1666
|
+
unstable_swallowErrors?: boolean;
|
|
1667
|
+
/**
|
|
1668
|
+
* Test/internal escape hatch — inject a known runtime schema instead of
|
|
1669
|
+
* letting the SDK fetch from the server on init. Not part of the public
|
|
1670
|
+
* API; production code should rely on the server-side schema endpoint.
|
|
1671
|
+
*/
|
|
1672
|
+
unstable_internalSchema?: RuntimeSchema;
|
|
1673
|
+
/**
|
|
1674
|
+
* @deprecated No longer has an effect: the SDK always runs on its native client.
|
|
1675
|
+
* Still accepted; development builds log a one-time notice when it is set.
|
|
1676
|
+
*/
|
|
1677
|
+
unstable_nativeEngine?: boolean;
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* How a {@link VoidhashClient.purchase} call ended. Every failure is the
|
|
1681
|
+
* `Err` of the returned `Result`.
|
|
1682
|
+
*
|
|
1683
|
+
* - `purchased`: the store charged. `synced` is `true` once Voidhash
|
|
1684
|
+
* accepted the receipt; `false` while it waits on the device, sent again
|
|
1685
|
+
* at launch, in the foreground and when the device is back online, and
|
|
1686
|
+
* access arrives once it lands. Either way the purchase is done: do not
|
|
1687
|
+
* offer it again.
|
|
1688
|
+
* - `pending`: the store needs outside action first, such as Ask to Buy
|
|
1689
|
+
* approval or a pending payment. It completes later, as a transaction
|
|
1690
|
+
* update (`addTransactionListener()`), and access arrives with it.
|
|
1691
|
+
* - `cancelled`: the end user dismissed the store sheet.
|
|
1692
|
+
* - `disabled`: the client was created with `enabled: false`; nothing was bought.
|
|
1693
|
+
*/
|
|
1694
|
+
type PurchaseResult = {
|
|
1695
|
+
readonly status: "purchased";
|
|
1696
|
+
readonly transaction: Transaction;
|
|
1697
|
+
readonly synced: boolean;
|
|
1698
|
+
} | {
|
|
1699
|
+
readonly status: "pending";
|
|
1700
|
+
} | {
|
|
1701
|
+
readonly status: "cancelled";
|
|
1702
|
+
} | {
|
|
1703
|
+
readonly status: "disabled";
|
|
1704
|
+
};
|
|
1705
|
+
/**
|
|
1706
|
+
* Which offer a purchase buys:
|
|
1707
|
+
*
|
|
1708
|
+
* - `"automatic"` (default): a subscription's `introOffer` when the end user
|
|
1709
|
+
* is eligible for one, otherwise the regular price.
|
|
1710
|
+
* - `"none"`: the regular price. The App Store may still apply an
|
|
1711
|
+
* introductory offer the end user is eligible for.
|
|
1712
|
+
* - an `Offer` from `product.offers` or `product.subscription.introOffer`.
|
|
1713
|
+
* - an offer's `id`, looked up in the same offers.
|
|
1714
|
+
*
|
|
1715
|
+
* An offer that cannot be bought fails the purchase with `OFFER_UNAVAILABLE`;
|
|
1716
|
+
* the product is never bought at its regular price instead.
|
|
1717
|
+
*/
|
|
1718
|
+
type OfferSelection = "automatic" | "none" | Offer | (string & Record<never, never>);
|
|
1719
|
+
/** What a {@link VoidhashClient.purchase} call may ask for beyond the product. */
|
|
1720
|
+
interface PurchaseOptions {
|
|
1721
|
+
/** The offer to buy; see {@link OfferSelection}. Default `"automatic"`. */
|
|
1722
|
+
readonly offer?: OfferSelection;
|
|
1723
|
+
/**
|
|
1724
|
+
* How many to buy, default 1. Only App Store consumables can be bought
|
|
1725
|
+
* several at once; on Google Play the end user picks the quantity in the
|
|
1726
|
+
* store's sheet. Anything but 1 elsewhere is an `INVALID_ARGUMENT` error.
|
|
1727
|
+
* The transaction reports the quantity the store charged.
|
|
1728
|
+
*/
|
|
1729
|
+
readonly quantity?: number;
|
|
1730
|
+
/**
|
|
1731
|
+
* The subscription the user has now, which this purchase replaces: an
|
|
1732
|
+
* upgrade, a downgrade or a change of plan. Google Play only. Without it,
|
|
1733
|
+
* buying another subscription product there adds a second subscription
|
|
1734
|
+
* next to the first, and Google Play bills both.
|
|
1735
|
+
*
|
|
1736
|
+
* Nothing is bought when the replacement cannot be made. The purchase
|
|
1737
|
+
* fails with `REPLACED_SUBSCRIPTION_NOT_OWNED` when the signed-in Google
|
|
1738
|
+
* Play account does not own the named subscription, with
|
|
1739
|
+
* `INVALID_ARGUMENT` when either product is not a subscription, both are
|
|
1740
|
+
* the same product, or the option names no product or an unknown mode, and
|
|
1741
|
+
* with `SUBSCRIPTION_REPLACEMENT_REFUSED` when Google Play rejects the
|
|
1742
|
+
* replacement before its sheet opens.
|
|
1743
|
+
*
|
|
1744
|
+
* Ignored on iOS, where the App Store moves a subscriber between the
|
|
1745
|
+
* products of one subscription group by itself.
|
|
1746
|
+
*/
|
|
1747
|
+
readonly replacing?: SubscriptionReplacement;
|
|
1748
|
+
/** App Store options; Google Play ignores them. */
|
|
1749
|
+
readonly appStore?: {
|
|
1750
|
+
/** Simulates Ask to Buy in the sandbox, so the purchase ends `pending`. */
|
|
1751
|
+
readonly simulatesAskToBuyInSandbox?: boolean;
|
|
1752
|
+
};
|
|
1753
|
+
/** Google Play options; the App Store ignores them. */
|
|
1754
|
+
readonly googlePlay?: {
|
|
1755
|
+
/** Tells Google Play the price was personalized for the end user (an EU disclosure). */
|
|
1756
|
+
readonly isOfferPersonalized?: boolean;
|
|
1757
|
+
/** Google Play's obfuscated profile id, for apps with several profiles per account. */
|
|
1758
|
+
readonly obfuscatedProfileId?: string;
|
|
1759
|
+
/**
|
|
1760
|
+
* Buys exactly this Google Play offer token, from
|
|
1761
|
+
* `product.googlePlay.subscriptionOffers` or `oneTimeOffers`, instead of
|
|
1762
|
+
* what `offer` selects.
|
|
1763
|
+
*/
|
|
1764
|
+
readonly offerToken?: string;
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
/** The storefront the end user buys from. */
|
|
1768
|
+
interface Storefront {
|
|
1769
|
+
/** ISO 3166-1 alpha-2 country code, such as `US`. */
|
|
1770
|
+
readonly countryCode: string;
|
|
1771
|
+
/** ISO 4217 currency code, when the store says. */
|
|
1772
|
+
readonly currencyCode?: string;
|
|
1773
|
+
}
|
|
1774
|
+
/** Outcome of an identity switch reported by {@link VoidhashClient.identifySync}. */
|
|
1775
|
+
type IdentifyResult = {
|
|
1776
|
+
/** The server confirmed the identity and returned the person. */
|
|
1777
|
+
status: "confirmed";
|
|
1778
|
+
person: Person;
|
|
1779
|
+
} | {
|
|
1780
|
+
/**
|
|
1781
|
+
* The server has not confirmed the switch yet (it was unreachable, or
|
|
1782
|
+
* the key was rejected). The device already runs under the new distinct
|
|
1783
|
+
* id, and the link from the previous identity is queued on the device
|
|
1784
|
+
* and delivered once the server can be reached.
|
|
1785
|
+
*/
|
|
1786
|
+
status: "deferred";
|
|
1787
|
+
person: Person | null;
|
|
1788
|
+
} | {
|
|
1789
|
+
/** The client was created with `enabled: false`, so nothing was recorded. */
|
|
1790
|
+
status: "disabled";
|
|
1791
|
+
person: null;
|
|
1792
|
+
};
|
|
1793
|
+
/** Answer to an entitlement check for one perk. */
|
|
1794
|
+
interface HasPerkResult {
|
|
1795
|
+
/** The active grant behind `hasAccess`, when one exists. */
|
|
1796
|
+
grant?: EntitlementGrant;
|
|
1797
|
+
hasAccess: boolean;
|
|
1798
|
+
/**
|
|
1799
|
+
* The answer came from a cached snapshot that is past its refresh window,
|
|
1800
|
+
* either because a refresh is still running or because the server could not
|
|
1801
|
+
* be reached.
|
|
1802
|
+
*/
|
|
1803
|
+
isStale: boolean;
|
|
1804
|
+
/**
|
|
1805
|
+
* The cached snapshot is past its two-day TTL. Access is still reported as
|
|
1806
|
+
* the snapshot recorded it; apps gating high-value content can decide to
|
|
1807
|
+
* treat this as untrusted.
|
|
1808
|
+
*/
|
|
1809
|
+
isExpired: boolean;
|
|
1810
|
+
/**
|
|
1811
|
+
* Why the answer has the freshness it has.
|
|
1812
|
+
*
|
|
1813
|
+
* - `fresh`: confirmed by the server just now.
|
|
1814
|
+
* - `refresh-in-flight`: served from cache while a refresh is still running;
|
|
1815
|
+
* its result lands for the next read.
|
|
1816
|
+
* - `refresh-failed`: served from cache because the refresh could not
|
|
1817
|
+
* complete.
|
|
1818
|
+
* - `no-cache`: the SDK has never seen a snapshot for this identity, so
|
|
1819
|
+
* `hasAccess` is `false` for lack of evidence rather than because access
|
|
1820
|
+
* was denied.
|
|
1821
|
+
*/
|
|
1822
|
+
reason: "fresh" | "refresh-in-flight" | "refresh-failed" | "no-cache";
|
|
1823
|
+
}
|
|
1824
|
+
/** Person snapshot together with how much to trust it. */
|
|
1825
|
+
interface CurrentPersonResult {
|
|
1826
|
+
/** The snapshot, or `null` before the SDK has ever seen one. */
|
|
1827
|
+
person: Person | null;
|
|
1828
|
+
/** Served from cache past its refresh window. */
|
|
1829
|
+
isStale: boolean;
|
|
1830
|
+
/** Served from cache past its TTL. */
|
|
1831
|
+
isExpired: boolean;
|
|
1832
|
+
/** Why the snapshot has the freshness it has; see {@link HasPerkResult.reason}. */
|
|
1833
|
+
reason: "fresh" | "refresh-in-flight" | "refresh-failed" | "no-cache";
|
|
1834
|
+
}
|
|
1835
|
+
/** Outcome of a synchronous person-attribute update. */
|
|
1836
|
+
type SetPersonAttributesResult = {
|
|
1837
|
+
/** The server accepted and returned the updated snapshot. */
|
|
1838
|
+
status: "confirmed";
|
|
1839
|
+
person: Person;
|
|
1840
|
+
} | {
|
|
1841
|
+
/** The server was unreachable; the update is queued and will be retried. */
|
|
1842
|
+
status: "deferred";
|
|
1843
|
+
person: Person | null;
|
|
1844
|
+
} | {
|
|
1845
|
+
/** The client was created with `enabled: false`, so nothing was recorded. */
|
|
1846
|
+
status: "disabled";
|
|
1847
|
+
person: null;
|
|
1848
|
+
} | {
|
|
1849
|
+
/**
|
|
1850
|
+
* Nothing was left to write: the only attribute was an agreement to ad
|
|
1851
|
+
* data sharing, which waits for analytics consent.
|
|
1852
|
+
*/
|
|
1853
|
+
status: "skipped";
|
|
1854
|
+
person: null;
|
|
1855
|
+
};
|
|
1856
|
+
/** Outcome of an analytics flush. */
|
|
1857
|
+
interface FlushResult {
|
|
1858
|
+
/** Events the server accepted during this flush. */
|
|
1859
|
+
flushed: number;
|
|
1860
|
+
/** Events still queued, waiting for their next attempt. */
|
|
1861
|
+
pending: number;
|
|
1862
|
+
/** The failure that stopped the flush, when one did. */
|
|
1863
|
+
lastError?: VoidhashError;
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* App Store actions, on `client.appStore`. On any other platform each one
|
|
1867
|
+
* answers `UNSUPPORTED_PLATFORM`. While the client is disabled the reads
|
|
1868
|
+
* answer empty and `beginRefundRequest()` and `appTransaction()`, which have
|
|
1869
|
+
* no empty answer, `VOIDHASH_CLIENT_NOT_INITIALIZED`.
|
|
1870
|
+
*/
|
|
1871
|
+
interface AppStoreActions {
|
|
1872
|
+
/**
|
|
1873
|
+
* Shows Apple's refund request sheet for a transaction, by its App Store
|
|
1874
|
+
* transaction id (`transaction.id`). `success` means Apple received the
|
|
1875
|
+
* request, not that it refunded anything: a refund arrives later and
|
|
1876
|
+
* reaches the person's subscriptions and entitlements.
|
|
1877
|
+
*/
|
|
1878
|
+
readonly beginRefundRequest: (transactionId: string) => Promise<Result<RefundRequestStatus, VoidhashError>>;
|
|
1879
|
+
/**
|
|
1880
|
+
* Every status the Apple account has in an App Store subscription group
|
|
1881
|
+
* (`subscription.groupId`), as StoreKit reports them on this device: state,
|
|
1882
|
+
* latest transaction and renewal info. The current person's comes first (the
|
|
1883
|
+
* one bought for them), then the account's others, ones shared through
|
|
1884
|
+
* Family Sharing included. For what the person can use, read their
|
|
1885
|
+
* entitlements; the server knows subscriptions across devices and stores,
|
|
1886
|
+
* see `useSubscriptions()`.
|
|
1887
|
+
*/
|
|
1888
|
+
readonly subscriptionStatus: (groupId: string) => Promise<Result<ReadonlyArray<AppStoreSubscriptionStatus>, VoidhashError>>;
|
|
1889
|
+
/** StoreKit's verified current entitlements on this device. */
|
|
1890
|
+
readonly currentEntitlements: () => Promise<Result<ReadonlyArray<Transaction>, VoidhashError>>;
|
|
1891
|
+
/** How the end user got the app: StoreKit's verified `AppTransaction`. */
|
|
1892
|
+
readonly appTransaction: () => Promise<Result<AppTransaction, VoidhashError>>;
|
|
1893
|
+
/**
|
|
1894
|
+
* Calls `listener` with each purchase the end user starts on the App Store
|
|
1895
|
+
* (a promoted in-app purchase, a win-back offer) while the
|
|
1896
|
+
* `purchaseIntents` option is `"manual"`; complete it with `purchase()`.
|
|
1897
|
+
* Intents that arrived while no listener was registered (they can arrive
|
|
1898
|
+
* as soon as `init()` starts) are held, the 10 latest, and handed to the
|
|
1899
|
+
* first listener added, at once. Returns the function that removes the
|
|
1900
|
+
* listener. Never called on another platform.
|
|
1901
|
+
*/
|
|
1902
|
+
readonly addPurchaseIntentListener: (listener: (intent: AppStorePurchaseIntent) => void) => () => void;
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Google Play actions, on `client.googlePlay`. On any other platform each one
|
|
1906
|
+
* answers `UNSUPPORTED_PLATFORM`. While the client is disabled each answers
|
|
1907
|
+
* empty: `noActionNeeded`, no purchases, `false`.
|
|
1908
|
+
*/
|
|
1909
|
+
interface GooglePlayActions {
|
|
1910
|
+
/**
|
|
1911
|
+
* Shows Google Play's in-app messages for the end user's subscriptions,
|
|
1912
|
+
* such as a prompt to fix a declined payment. When they fixed it, the
|
|
1913
|
+
* answer names the purchase token, and the SDK has synced purchases and
|
|
1914
|
+
* refreshed the person.
|
|
1915
|
+
*/
|
|
1916
|
+
readonly showInAppMessages: () => Promise<Result<GooglePlayInAppMessageResult, VoidhashError>>;
|
|
1917
|
+
/**
|
|
1918
|
+
* The Google Play account's purchases on this device, suspended
|
|
1919
|
+
* subscriptions included unless `includeSuspended` is `false`
|
|
1920
|
+
* (`transaction.googlePlay.isSuspended`). For what the person can use, read
|
|
1921
|
+
* their entitlements.
|
|
1922
|
+
*/
|
|
1923
|
+
readonly queryPurchases: (options?: {
|
|
1924
|
+
readonly includeSuspended?: boolean;
|
|
1925
|
+
}) => Promise<Result<ReadonlyArray<Transaction>, VoidhashError>>;
|
|
1926
|
+
/** Whether Google Play supports a billing feature on this device. */
|
|
1927
|
+
readonly isFeatureSupported: (feature: GooglePlayBillingFeature) => Promise<Result<boolean, VoidhashError>>;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* The Voidhash client: the public facade over the native Voidhash client.
|
|
1931
|
+
* Every method answers with a `Result` carrying a coded `VoidhashError`
|
|
1932
|
+
* instead of throwing, and a client created with `enabled: false` never
|
|
1933
|
+
* touches the native client and answers every read with its empty shape.
|
|
1934
|
+
*/
|
|
1935
|
+
declare class VoidhashClient {
|
|
1936
|
+
private readonly setup;
|
|
1937
|
+
private readonly atomRegistry;
|
|
1938
|
+
private readonly namespace;
|
|
1939
|
+
/** What this client holds in `liveClients` while it runs: its namespace, or the process. */
|
|
1940
|
+
private readonly slot;
|
|
1941
|
+
private readonly emitDiagnostic;
|
|
1942
|
+
private readonly screenTracker;
|
|
1943
|
+
private manualScreenCounter;
|
|
1944
|
+
/** The send id `trackPushOpened()` reported last. */
|
|
1945
|
+
private lastPushOpenedSendId;
|
|
1946
|
+
/** The native client and its adapter, made on first use. */
|
|
1947
|
+
private native;
|
|
1948
|
+
/** Seeds the first `init()` of the process; cleared once applied or by an identity change. */
|
|
1949
|
+
private initialDistinctId;
|
|
1950
|
+
/** The consent in effect, mirrored from the native client once it runs. */
|
|
1951
|
+
private analyticsConsent;
|
|
1952
|
+
/** A consent `setAnalyticsConsent()` chose before `init()`; it wins over the stored one. */
|
|
1953
|
+
private chosenAnalyticsConsent;
|
|
1954
|
+
private analyticsConsentDeniedReported;
|
|
1955
|
+
private readOnly;
|
|
1956
|
+
private _isInitialized;
|
|
1957
|
+
/** Set by `end()` until the next `init()`. */
|
|
1958
|
+
private ended;
|
|
1959
|
+
/**
|
|
1960
|
+
* The `init()` or `end()` called last, until it settles. A call for the
|
|
1961
|
+
* same transition joins it and a call for the other one runs after it, so
|
|
1962
|
+
* the client ends up in the state asked for last.
|
|
1963
|
+
*/
|
|
1964
|
+
private transition;
|
|
1965
|
+
private flushInFlight;
|
|
1966
|
+
/** The purchase this client runs, until it settles; a second one fails `PURCHASE_IN_PROGRESS`. */
|
|
1967
|
+
private purchaseInFlight;
|
|
1968
|
+
private identityChangeTail;
|
|
1969
|
+
/**
|
|
1970
|
+
* The `identify()`, `reset()` and `signOut()` calls made, and how many of
|
|
1971
|
+
* them, in call order, have switched the identity or settled without doing
|
|
1972
|
+
* so. An event, a screen or a purchase report waits for the ones called
|
|
1973
|
+
* before it, so it is recorded for the person the app switched to; see
|
|
1974
|
+
* {@link identityChangeSwitched}.
|
|
1975
|
+
*/
|
|
1976
|
+
private identityChangesCalled;
|
|
1977
|
+
private identityChangesSwitched;
|
|
1978
|
+
/** The identity change the native client is running now, by its number among those called. */
|
|
1979
|
+
private identityChangeRunning;
|
|
1980
|
+
private readonly eventsHeldForIdentity;
|
|
1981
|
+
private readonly reportsHeldForIdentity;
|
|
1982
|
+
/**
|
|
1983
|
+
* One entry per `addTransactionListener()` call, each its own function, so
|
|
1984
|
+
* adding a listener twice calls it twice.
|
|
1985
|
+
*/
|
|
1986
|
+
private readonly transactionListeners;
|
|
1987
|
+
private readonly purchaseIntentListeners;
|
|
1988
|
+
/**
|
|
1989
|
+
* Purchase intents that arrived while no listener was registered (they
|
|
1990
|
+
* arrive from `init()` on, before the app may have added one), oldest
|
|
1991
|
+
* first, for the first listener the app adds.
|
|
1992
|
+
*/
|
|
1993
|
+
private heldPurchaseIntents;
|
|
1994
|
+
/** The adapter over this client's native client, created on first use. */
|
|
1995
|
+
private nativeClient;
|
|
1996
|
+
/** The configuration the next `start()` runs with. */
|
|
1997
|
+
private configuration;
|
|
1998
|
+
/**
|
|
1999
|
+
* The answer of a side-effect call, unless `unstable_swallowErrors` asks for
|
|
2000
|
+
* failures to be logged and answered as success.
|
|
2001
|
+
*/
|
|
2002
|
+
private swallowed;
|
|
2003
|
+
/** The started adapter, or `NOT_INITIALIZED`. */
|
|
2004
|
+
private started;
|
|
2005
|
+
/**
|
|
2006
|
+
* Joins an `init()` in progress or starts one — after `end()` and behind an
|
|
2007
|
+
* `end()` still running too — the way identity calls do, so a purchase
|
|
2008
|
+
* reported during launch or teardown is not refused.
|
|
2009
|
+
*/
|
|
2010
|
+
private whenInitialized;
|
|
2011
|
+
/** Runs an `init()` or `end()` as the transition called last. */
|
|
2012
|
+
private runTransition;
|
|
2013
|
+
/**
|
|
2014
|
+
* The client that took over this client's storage namespace while this one
|
|
2015
|
+
* is not running. Identity and purchase calls on a replaced instance go to
|
|
2016
|
+
* it: starting this instance again would end the live one. A live client of
|
|
2017
|
+
* another project is never a replacement: nothing made for one project is
|
|
2018
|
+
* handed to another.
|
|
2019
|
+
*/
|
|
2020
|
+
private replacement;
|
|
2021
|
+
/**
|
|
2022
|
+
* Runs an identity change in call order. Events, screens and purchase
|
|
2023
|
+
* reports made after it wait until it switched the identity, which the
|
|
2024
|
+
* native client announces at once, before it waits for Voidhash. A change
|
|
2025
|
+
* that switches nothing lets them go on when it starts (an `identify()` of
|
|
2026
|
+
* `target`, already the identity) or when it settles.
|
|
2027
|
+
*/
|
|
2028
|
+
private enqueueIdentityChange;
|
|
2029
|
+
/**
|
|
2030
|
+
* Identity change number `change` switched the identity, or will not: sends
|
|
2031
|
+
* the events and screens held for it and lets the purchase reports go on.
|
|
2032
|
+
* Changes run one at a time, so the ones before it have switched too.
|
|
2033
|
+
*/
|
|
2034
|
+
private identityChangeSwitched;
|
|
2035
|
+
/** Whether an identity change called before now has not switched the identity yet. */
|
|
2036
|
+
private awaitsIdentityChange;
|
|
2037
|
+
/**
|
|
2038
|
+
* Keeps an event or a screen until the identity changes called before it
|
|
2039
|
+
* switched the identity, then calls `send` with the time it was captured
|
|
2040
|
+
* at. In memory, as the native client holds events before it starts: past
|
|
2041
|
+
* {@link MAX_EVENTS_HELD_FOR_IDENTITY} the oldest is dropped and reported.
|
|
2042
|
+
*/
|
|
2043
|
+
private holdEventForIdentity;
|
|
2044
|
+
/** Resolves once the identity changes called before now switched the identity. */
|
|
2045
|
+
private afterIdentityChanges;
|
|
2046
|
+
/**
|
|
2047
|
+
* Runs `operation` once `init()` has settled, after every identity change
|
|
2048
|
+
* and group call made before it.
|
|
2049
|
+
*/
|
|
2050
|
+
private enqueueInIdentityOrder;
|
|
2051
|
+
/**
|
|
2052
|
+
* Starts the native client from local state: identity, caches and queues
|
|
2053
|
+
* are loaded without waiting for the network, and the refreshes, store
|
|
2054
|
+
* observation and delivery continue in the background. Resolves
|
|
2055
|
+
* immediately without touching the native client when the client was
|
|
2056
|
+
* created with `enabled: false`.
|
|
2057
|
+
*
|
|
2058
|
+
* An app launched in the background before the device has been unlocked
|
|
2059
|
+
* since it started (on Android, only an app with a `directBootAware`
|
|
2060
|
+
* component) cannot read anything the SDK stored, so this waits for that
|
|
2061
|
+
* first unlock; events captured meanwhile are kept.
|
|
2062
|
+
*
|
|
2063
|
+
* Idempotent: a call that overlaps a running `init()` joins it, and a call
|
|
2064
|
+
* on an initialized client resolves at once. A call made while `end()` is
|
|
2065
|
+
* still running waits for it and then starts the client again, unless
|
|
2066
|
+
* another client took over its storage meanwhile: then this one stays ended
|
|
2067
|
+
* and the call answers `VOIDHASH_CLIENT_NOT_INITIALIZED`.
|
|
2068
|
+
*/
|
|
2069
|
+
init(): Promise<Result<void, VoidhashError>>;
|
|
2070
|
+
private runInit;
|
|
2071
|
+
/**
|
|
2072
|
+
* Makes this client the owner of its storage namespace (of the process,
|
|
2073
|
+
* where it runs one native client), ending the client that owned it until
|
|
2074
|
+
* now. It is the owner before that client has ended, so identity and
|
|
2075
|
+
* purchase calls made on a replaced client of the same namespace meanwhile
|
|
2076
|
+
* already go to this one instead of starting the replaced one again.
|
|
2077
|
+
*/
|
|
2078
|
+
private claimNamespace;
|
|
2079
|
+
/** Gives up this client's storage namespace, if it still owns it. */
|
|
2080
|
+
private releaseNamespace;
|
|
2081
|
+
/**
|
|
2082
|
+
* Ends the client: flushes for at most about two seconds, persists what is
|
|
2083
|
+
* still queued and stops every observer, timer and listener. Whatever was
|
|
2084
|
+
* not delivered goes out after the next `init()`. An `init()` still running
|
|
2085
|
+
* is waited for first. The client stops being initialized as soon as the
|
|
2086
|
+
* teardown begins: reads answer `VOIDHASH_CLIENT_NOT_INITIALIZED` from then
|
|
2087
|
+
* on. Afterwards `capture()` drops events with a diagnostic and `init()`
|
|
2088
|
+
* starts the client again. Overlapping calls share one teardown. No-ops on
|
|
2089
|
+
* a disabled client.
|
|
2090
|
+
*/
|
|
2091
|
+
end(): Promise<Result<void, VoidhashError>>;
|
|
2092
|
+
/** Whether the client is initialized. Always false while the client is disabled. */
|
|
2093
|
+
get isInitialized(): boolean;
|
|
2094
|
+
/** Whether this client does anything at all, fixed at construction by the `enabled` option. */
|
|
2095
|
+
get isEnabled(): boolean;
|
|
2096
|
+
/** Whether the SDK currently runs in observer ("read-only") mode. */
|
|
2097
|
+
get isReadOnly(): boolean;
|
|
2098
|
+
/**
|
|
2099
|
+
* Switches observer mode at runtime, so an app migrating onto Voidhash can
|
|
2100
|
+
* flip from watching another SDK's purchases to owning them without
|
|
2101
|
+
* recreating the client. A purchase that already started keeps the mode it
|
|
2102
|
+
* started with. No-ops in effect on a disabled client.
|
|
2103
|
+
*/
|
|
2104
|
+
setReadOnly(readOnly: boolean): void;
|
|
2105
|
+
/**
|
|
2106
|
+
* The end user's analytics consent in effect: the last
|
|
2107
|
+
* {@link setAnalyticsConsent} value, else (once `init()` has read it) the
|
|
2108
|
+
* stored one, else the `analyticsConsent` option.
|
|
2109
|
+
*/
|
|
2110
|
+
getAnalyticsConsent(): AnalyticsConsent;
|
|
2111
|
+
/**
|
|
2112
|
+
* Records whether the end user consents to usage analytics. Takes effect
|
|
2113
|
+
* immediately and is stored on the device, where it takes precedence over
|
|
2114
|
+
* the `analyticsConsent` option on later launches; `reset()` and
|
|
2115
|
+
* `signOut()` keep it.
|
|
2116
|
+
*
|
|
2117
|
+
* `"denied"` and `"pending"` stop all analytics: events, screens, lifecycle
|
|
2118
|
+
* and install events and paywall impressions are dropped, and every event
|
|
2119
|
+
* still queued on the device is discarded together with the analytics
|
|
2120
|
+
* session. Purchases, restores, entitlements, `identify()`, person
|
|
2121
|
+
* attributes, groups, feature flags and paywalls are unaffected. `"granted"`
|
|
2122
|
+
* resumes analytics for what is captured from then on.
|
|
2123
|
+
*
|
|
2124
|
+
* Called before `init()` the consent applies at once and is stored when
|
|
2125
|
+
* `init()` runs. An `Err` with `FAILED_TO_SET_ANALYTICS_CONSENT` means the
|
|
2126
|
+
* consent applies to this process but could not be stored; an invalid value
|
|
2127
|
+
* is an `INVALID_ARGUMENT` error and changes nothing.
|
|
2128
|
+
*/
|
|
2129
|
+
setAnalyticsConsent(consent: AnalyticsConsent): Promise<Result<void, VoidhashError>>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Returns the current person snapshot together with how much to trust it.
|
|
2132
|
+
* The answer comes from cache whenever one exists — a stale entry is served
|
|
2133
|
+
* while a refresh runs behind the read — so this never waits long on the
|
|
2134
|
+
* network and never fails because the server is unreachable. Pass
|
|
2135
|
+
* `{ forceFetch: true }` to prefer the server. Answers an empty snapshot
|
|
2136
|
+
* while disabled.
|
|
2137
|
+
*/
|
|
2138
|
+
getCurrentPerson(options?: {
|
|
2139
|
+
forceFetch?: boolean;
|
|
2140
|
+
}): Promise<Result<CurrentPersonResult, VoidhashError>>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Checks whether the current person holds an active grant for a perk.
|
|
2143
|
+
*
|
|
2144
|
+
* Cache-first: a fresh snapshot answers immediately, a stale one is served
|
|
2145
|
+
* while a refresh runs behind the read, and an entitlement granted before
|
|
2146
|
+
* the device went offline keeps answering `true`. The result always says how
|
|
2147
|
+
* fresh it is (`isStale`, `isExpired`, `reason`) — it never fails because
|
|
2148
|
+
* the server is unreachable. Pass `{ forceFetch: true }` to prefer the
|
|
2149
|
+
* server.
|
|
2150
|
+
*/
|
|
2151
|
+
hasPerk(perkSlug: PerkSlug, options?: {
|
|
2152
|
+
/**
|
|
2153
|
+
* @deprecated No longer read. A stale answer beats no answer, so the
|
|
2154
|
+
* cached grant is always served. Branch on `isStale`/`isExpired` in the
|
|
2155
|
+
* result instead. Removed in a future release.
|
|
2156
|
+
*/
|
|
2157
|
+
allowStale?: boolean;
|
|
2158
|
+
/** Prefer the server, waiting for it before answering. */
|
|
2159
|
+
forceFetch?: boolean;
|
|
2160
|
+
}): Promise<Result<HasPerkResult, VoidhashError>>;
|
|
2161
|
+
/**
|
|
2162
|
+
* Sets person attributes without waiting on the network. Reserved
|
|
2163
|
+
* `email`/`name` keys map to the dedicated server fields (strings); any
|
|
2164
|
+
* other key is a custom trait whose value must be a string, a number, a
|
|
2165
|
+
* boolean or `null`. Anything else is an `INVALID_ARGUMENT` error and
|
|
2166
|
+
* nothing is written. The update is stored on the device and sent right
|
|
2167
|
+
* away, then retried until the server applies it; `flush()` waits for it.
|
|
2168
|
+
* Attributes are written whatever the analytics consent, except that the
|
|
2169
|
+
* native SDK leaves `$ad_data_sharing` set to anything but `false` out until
|
|
2170
|
+
* it is granted: see {@link setAdDataSharing}.
|
|
2171
|
+
*
|
|
2172
|
+
* Like identity calls, it waits for initialization and runs in call order
|
|
2173
|
+
* with `identify()`, `reset()` and `signOut()`, so the attributes belong to
|
|
2174
|
+
* the person identified when this was called. Called right after an
|
|
2175
|
+
* `identify()` that wasn't awaited, it resolves once that identify settles.
|
|
2176
|
+
*/
|
|
2177
|
+
setPersonAttributes(attributes: PersonAttributes): Promise<Result<void, VoidhashError>>;
|
|
2178
|
+
/**
|
|
2179
|
+
* Records whether the end user agreed to you sharing their purchases with ad
|
|
2180
|
+
* platforms, as the person trait `$ad_data_sharing`. Voidhash sends a
|
|
2181
|
+
* person's purchases to a Conversions API you turned on only when it is
|
|
2182
|
+
* `true`.
|
|
2183
|
+
*
|
|
2184
|
+
* `true` needs analytics consent: it does nothing while that is not
|
|
2185
|
+
* granted. Once written, it also drops a revocation
|
|
2186
|
+
* still queued for the person. `false` is a revocation, which analytics
|
|
2187
|
+
* consent neither blocks nor discards: the native SDK stores it on the device
|
|
2188
|
+
* and retries it until Voidhash has written it, or for 48 hours while Voidhash
|
|
2189
|
+
* has no such person, and it records no analytics. When someone rejects
|
|
2190
|
+
* everything, call it next to `setAnalyticsConsent("denied")`. Withdrawing
|
|
2191
|
+
* analytics consent does not take this back by itself.
|
|
2192
|
+
*
|
|
2193
|
+
* Waits for initialization and runs in call order with identity changes, as
|
|
2194
|
+
* {@link setPersonAttributes} does.
|
|
2195
|
+
*/
|
|
2196
|
+
setAdDataSharing(granted: boolean): Promise<Result<void, VoidhashError>>;
|
|
2197
|
+
/**
|
|
2198
|
+
* Sets person attributes and reports whether the server confirmed them.
|
|
2199
|
+
* When the server cannot confirm the update now (it is unreachable, the key
|
|
2200
|
+
* was rejected, or an earlier write for this person is still queued) the
|
|
2201
|
+
* update is queued and the result is `deferred` with the last known
|
|
2202
|
+
* snapshot, rather than an error. Values, ordering and observer mode follow
|
|
2203
|
+
* {@link setPersonAttributes}: attributes are written whatever the analytics
|
|
2204
|
+
* consent and whether or not the client is read-only. The result is
|
|
2205
|
+
* `skipped` only when the one attribute was an agreement to ad data sharing
|
|
2206
|
+
* made without analytics consent: see {@link setAdDataSharing}.
|
|
2207
|
+
*/
|
|
2208
|
+
setPersonAttributesSync(attributes: PersonAttributes): Promise<Result<SetPersonAttributesResult, VoidhashError>>;
|
|
2209
|
+
/**
|
|
2210
|
+
* Returns the active analytics session id, or `undefined` before `init()`,
|
|
2211
|
+
* while disabled, or once the session has been idle past the inactivity
|
|
2212
|
+
* timeout. Reading does not extend the session.
|
|
2213
|
+
*/
|
|
2214
|
+
getSessionId(): string | undefined;
|
|
2215
|
+
/** Returns the current distinct id, or `Ok(null)` while disabled. */
|
|
2216
|
+
getDistinctId(): Promise<Result<string | null, VoidhashError>>;
|
|
2217
|
+
/**
|
|
2218
|
+
* Identifies the user by switching the current distinct id. The switch
|
|
2219
|
+
* happens locally first, and the link from the previous (anonymous)
|
|
2220
|
+
* identity is stored on the device before it is sent; when the server
|
|
2221
|
+
* cannot confirm it now, the link is retried until it lands rather than
|
|
2222
|
+
* failing, and an anonymous purchaser keeps their cached access meanwhile.
|
|
2223
|
+
* Use {@link identifySync} to learn which of the two happened. Identity
|
|
2224
|
+
* calls wait for initialization and run in invocation order. Repeating the
|
|
2225
|
+
* same ID without profile changes preserves the session and cached state.
|
|
2226
|
+
* A blank ID is an `INVALID_ARGUMENT` error and leaves the identity alone.
|
|
2227
|
+
*/
|
|
2228
|
+
identify(externalUserId: string, options?: {
|
|
2229
|
+
email?: string;
|
|
2230
|
+
name?: string;
|
|
2231
|
+
}): Promise<Result<void, VoidhashError>>;
|
|
2232
|
+
/**
|
|
2233
|
+
* Identifies the user and reports whether the server confirmed the switch
|
|
2234
|
+
* (`confirmed`, with the person) or the device switched locally and queued
|
|
2235
|
+
* the link for later delivery (`deferred`, with the last known snapshot
|
|
2236
|
+
* for that identity, if any). Only a verdict the Voidhash API will not
|
|
2237
|
+
* change — which also restores the previous identity — or a blank ID
|
|
2238
|
+
* (`INVALID_ARGUMENT`) is an `Err`.
|
|
2239
|
+
*/
|
|
2240
|
+
identifySync(externalUserId: string, options?: {
|
|
2241
|
+
email?: string;
|
|
2242
|
+
name?: string;
|
|
2243
|
+
}): Promise<Result<IdentifyResult, VoidhashError>>;
|
|
2244
|
+
/**
|
|
2245
|
+
* Starts a fresh visitor: a new anonymous distinct id and analytics session,
|
|
2246
|
+
* with no groups. When someone is signed in this is exactly `signOut()`;
|
|
2247
|
+
* when nobody is, `signOut()` does nothing and this still starts over, with
|
|
2248
|
+
* no event recorded. Use it for a shared device, or a guest starting over.
|
|
2249
|
+
*/
|
|
2250
|
+
reset(): Promise<Result<void, VoidhashError>>;
|
|
2251
|
+
/**
|
|
2252
|
+
* Signs the current user out: captures the built-in `$sign_out` event
|
|
2253
|
+
* (unless automatic lifecycle events are off or analytics consent is not
|
|
2254
|
+
* granted), flushes it under the signing-out identity, then resets to a
|
|
2255
|
+
* fresh anonymous distinct id and starts a new analytics session. Does
|
|
2256
|
+
* nothing when nobody is signed in, so it is safe to call whenever the app
|
|
2257
|
+
* finds no session; `reset()` is the call for a fresh anonymous visitor.
|
|
2258
|
+
*/
|
|
2259
|
+
signOut(): Promise<Result<void, VoidhashError>>;
|
|
2260
|
+
/**
|
|
2261
|
+
* Puts the end user in a group, such as the company or workspace they use
|
|
2262
|
+
* your app as part of. Every event captured after the returned promise
|
|
2263
|
+
* resolves carries it in `$groups`, until `resetGroups()`, `reset()` or
|
|
2264
|
+
* `signOut()`; the native SDK stores it on the device with the distinct id,
|
|
2265
|
+
* one group per type.
|
|
2266
|
+
*
|
|
2267
|
+
* `properties` set the group's own properties, such as its `name` and
|
|
2268
|
+
* `plan`: strings, numbers or booleans. They are sent as a `$groupidentify`
|
|
2269
|
+
* event when given, or when the end user's group of that type changed.
|
|
2270
|
+
* Groups and their properties are sent whatever the analytics consent;
|
|
2271
|
+
* without it the `$groupidentify` goes out at once, on its own, and is not
|
|
2272
|
+
* retried if it fails.
|
|
2273
|
+
*
|
|
2274
|
+
* A group type is a lower-case letter followed by up to 63 lower-case
|
|
2275
|
+
* letters, digits or underscores, such as `company`, and a key has 1 to 256
|
|
2276
|
+
* characters; a number is kept as text. Any other is an `INVALID_ARGUMENT`
|
|
2277
|
+
* error. `null` properties count as none. Like identity calls, it waits for initialization and runs in call
|
|
2278
|
+
* order with `identify()`, `reset()` and `signOut()`.
|
|
2279
|
+
*/
|
|
2280
|
+
group(groupType: string, groupKey: string | number, properties?: GroupProperties | null): Promise<Result<void, VoidhashError>>;
|
|
2281
|
+
/**
|
|
2282
|
+
* Replaces every group the end user is in, in one call: the groups to be in
|
|
2283
|
+
* by type, each an id or `{ id, ...properties }`. A type left out, or given
|
|
2284
|
+
* as `null` or `undefined`, is dropped. Safe to call whenever the groups
|
|
2285
|
+
* might have changed: a `$groupidentify` is sent only for a group whose id
|
|
2286
|
+
* or properties differ from what was last sent, so repeating a call sends
|
|
2287
|
+
* nothing. An empty object behaves like `resetGroups()`.
|
|
2288
|
+
*
|
|
2289
|
+
* An id is a string or a finite number. A group given with any other id, or
|
|
2290
|
+
* with none, is an `INVALID_ARGUMENT` error for the whole call, and nothing
|
|
2291
|
+
* changes. Types and ids otherwise follow the rules of `group()`: a group
|
|
2292
|
+
* whose type or id those refuse is left out. Runs in call order with `identify()`, `reset()` and `signOut()`.
|
|
2293
|
+
*/
|
|
2294
|
+
setGroups(groups: Groups): Promise<Result<void, VoidhashError>>;
|
|
2295
|
+
/** Takes the end user out of every group; later events carry no `$groups`. */
|
|
2296
|
+
resetGroups(): Promise<Result<void, VoidhashError>>;
|
|
2297
|
+
/**
|
|
2298
|
+
* The groups the end user belongs to, by group type, as `group()` set them:
|
|
2299
|
+
* `{}` before `init()` resolves, while disabled, and when they belong to none.
|
|
2300
|
+
*/
|
|
2301
|
+
getGroups(): Readonly<Record<string, string>>;
|
|
2302
|
+
/**
|
|
2303
|
+
* Evaluates feature flags for the current person, cache-first: `flagKeys`
|
|
2304
|
+
* (every flag when omitted), each with its enabled state, variant key
|
|
2305
|
+
* (`null` without a variant) and payload. Returns no flags while disabled.
|
|
2306
|
+
*/
|
|
2307
|
+
getFeatureFlags(flagKeys?: ReadonlyArray<FeatureFlagKey>): Promise<Result<FeatureFlagsResult, VoidhashError>>;
|
|
2308
|
+
/**
|
|
2309
|
+
* The value of the variant flag `key` selected for the current person: the
|
|
2310
|
+
* variant's value when the flag is enabled and evaluated, `null` when it is
|
|
2311
|
+
* off, has no variant (or one whose value is not text), is unknown, or was
|
|
2312
|
+
* not evaluated within `featureFlags.maxWaitMs`. Evaluates `key`
|
|
2313
|
+
* cache-first, as `getFeatureFlags([key])` does. Answers `Ok(null)` while
|
|
2314
|
+
* disabled. Typed by the variant values `voidhash.gen.d.ts` lists for the
|
|
2315
|
+
* flag; a variant added since generation is not in that union.
|
|
2316
|
+
*/
|
|
2317
|
+
getVariantValue<K extends FeatureFlagKey>(key: K): Promise<Result<FeatureFlagValue<K> | null, VoidhashError>>;
|
|
2318
|
+
/**
|
|
2319
|
+
* Resolves the currently assigned paywall showing for a location slug.
|
|
2320
|
+
* Answers `Ok(null)` while disabled.
|
|
2321
|
+
*/
|
|
2322
|
+
getPaywallForLocation(locationSlug: LocationSlug): Promise<Result<ResolvedPaywall, VoidhashError>>;
|
|
2323
|
+
/**
|
|
2324
|
+
* The products the store sells this end user, sorted by slug, with the
|
|
2325
|
+
* offers they can buy them with. With `slugs`, the products those slugs
|
|
2326
|
+
* name, in that order: `undefined` where the store has none, which the
|
|
2327
|
+
* `onDiagnostic` handler hears about as `PRODUCT_NOT_FOUND`. With the types
|
|
2328
|
+
* `voidhash-cli types generate` writes, each is typed by its slug, so a
|
|
2329
|
+
* subscription's slug is a `SubscriptionProduct`.
|
|
2330
|
+
*
|
|
2331
|
+
* One load serves every caller and every `useProducts()`; it runs again
|
|
2332
|
+
* after an identity change, a completed purchase or new product
|
|
2333
|
+
* definitions. Answers no products while disabled.
|
|
2334
|
+
*/
|
|
2335
|
+
getProducts(): Promise<Result<ReadonlyArray<Product>, VoidhashError>>;
|
|
2336
|
+
getProducts<const Slugs extends ReadonlyArray<ProductSlug>>(slugs: Slugs): Promise<Result<ProductsForSlugs<Slugs>, VoidhashError>>;
|
|
2337
|
+
/**
|
|
2338
|
+
* Buys a product from `getProducts()` or `useProducts()`. By default a
|
|
2339
|
+
* subscription comes with the free trial or introductory price the end
|
|
2340
|
+
* user is eligible for; `options.offer` picks another offer or the regular
|
|
2341
|
+
* price. Resolves to a `Result`: `purchased`, `pending` and `cancelled` are
|
|
2342
|
+
* outcomes, every failure is an `Err` carrying a coded
|
|
2343
|
+
* {@link VoidhashError}. Answers `Ok({ status: "disabled" })` while
|
|
2344
|
+
* disabled.
|
|
2345
|
+
*
|
|
2346
|
+
* Waits for `init()`. One purchase runs at a time: another started while
|
|
2347
|
+
* it runs fails with `PURCHASE_IN_PROGRESS` and buys nothing. Blocked in
|
|
2348
|
+
* observer mode; the mode in effect when the purchase starts decides, so a
|
|
2349
|
+
* `setReadOnly()` landing later doesn't abandon it. Options no store could
|
|
2350
|
+
* honour are an `INVALID_ARGUMENT` error, and nothing is bought.
|
|
2351
|
+
*/
|
|
2352
|
+
purchase(product: Product, options?: PurchaseOptions): Promise<Result<PurchaseResult, VoidhashError>>;
|
|
2353
|
+
/**
|
|
2354
|
+
* Revalidates restorable purchases for the user who requested the restore,
|
|
2355
|
+
* and answers the refreshed person, `null` when there is none, so a
|
|
2356
|
+
* "nothing to restore" needs no second read: check the person's
|
|
2357
|
+
* entitlements. Call from a user action: iOS may prompt for App Store
|
|
2358
|
+
* authentication. Known consumables are excluded. Waits for `init()`;
|
|
2359
|
+
* answers `Ok(null)` while disabled.
|
|
2360
|
+
*/
|
|
2361
|
+
restorePurchases(): Promise<Result<Person | null, VoidhashError>>;
|
|
2362
|
+
/**
|
|
2363
|
+
* Calls `listener` with each purchase that completes outside `purchase()`:
|
|
2364
|
+
* an approved Ask to Buy, a pending payment that went through, a redeemed
|
|
2365
|
+
* offer code, a promoted purchase, and on iOS a renewal seen on the device
|
|
2366
|
+
* (`transaction.isRenewal`; Google Play does not report renewals to the
|
|
2367
|
+
* device). A purchase or restore made in a flow is not one: `presentFlow()`
|
|
2368
|
+
* answers it. It is called once the SDK handled the purchase; `synced`
|
|
2369
|
+
* says whether Voidhash already accepted it. A signal for the UI, not a
|
|
2370
|
+
* delivery guarantee: access always comes from the person's entitlements,
|
|
2371
|
+
* which hooks re-render with. Returns the function that removes the
|
|
2372
|
+
* listener. Never called while disabled.
|
|
2373
|
+
*/
|
|
2374
|
+
addTransactionListener(listener: (update: TransactionUpdate) => void): () => void;
|
|
2375
|
+
/**
|
|
2376
|
+
* Opens the store's subscription management: the App Store's sheet (for
|
|
2377
|
+
* `product`'s subscription group, on iOS 17 and later) or Google Play's
|
|
2378
|
+
* subscriptions page (for `product`, when given). No-op while disabled.
|
|
2379
|
+
*/
|
|
2380
|
+
showManageSubscriptions(product?: Product): Promise<Result<void, VoidhashError>>;
|
|
2381
|
+
/**
|
|
2382
|
+
* Lets the end user redeem an offer code: Apple's redemption sheet (where
|
|
2383
|
+
* they type the code; `code` is ignored), or Google Play's redeem page
|
|
2384
|
+
* filled in with `code`. A redeemed code arrives as a transaction update.
|
|
2385
|
+
* No-op while disabled.
|
|
2386
|
+
*/
|
|
2387
|
+
presentCodeRedemption(code?: string): Promise<Result<void, VoidhashError>>;
|
|
2388
|
+
/**
|
|
2389
|
+
* The storefront the end user buys from: its ISO 3166-1 alpha-2 country,
|
|
2390
|
+
* and currency where the store says. `undefined` when the store has none to
|
|
2391
|
+
* give, and while disabled.
|
|
2392
|
+
*/
|
|
2393
|
+
getStorefront(): Promise<Result<Storefront | undefined, VoidhashError>>;
|
|
2394
|
+
/**
|
|
2395
|
+
* Whether this device can make purchases: payments are not restricted (App
|
|
2396
|
+
* Store) and billing is available (Google Play). `false` while disabled.
|
|
2397
|
+
*/
|
|
2398
|
+
canMakePayments(): Promise<Result<boolean, VoidhashError>>;
|
|
2399
|
+
/**
|
|
2400
|
+
* Hands a purchase intent to the listeners, or holds it for the first one
|
|
2401
|
+
* while there is none: the native client sends intents from `init()` on,
|
|
2402
|
+
* possibly before the app added its listener.
|
|
2403
|
+
*/
|
|
2404
|
+
private receivePurchaseIntent;
|
|
2405
|
+
/** App Store actions; see {@link AppStoreActions}. */
|
|
2406
|
+
readonly appStore: AppStoreActions;
|
|
2407
|
+
/** Google Play actions; see {@link GooglePlayActions}. */
|
|
2408
|
+
readonly googlePlay: GooglePlayActions;
|
|
2409
|
+
/**
|
|
2410
|
+
* Runs an action of one store: `UNSUPPORTED_PLATFORM` on the other
|
|
2411
|
+
* platform, `whileDisabled` on a disabled client, and
|
|
2412
|
+
* `VOIDHASH_CLIENT_NOT_INITIALIZED` before `init()`.
|
|
2413
|
+
*/
|
|
2414
|
+
private storeAction;
|
|
2415
|
+
/** Calls every listener with `value`; one that throws is reported and the others still run. */
|
|
2416
|
+
private notify;
|
|
2417
|
+
/**
|
|
2418
|
+
* Presents the flow assigned to a location and resolves once it ends, with
|
|
2419
|
+
* its `outcome` (`purchased`, `restored`, `dismissed`, or the outcome the
|
|
2420
|
+
* flow finished with), its `output` and the `productId` of a purchase.
|
|
2421
|
+
*
|
|
2422
|
+
* `options.input` are the flow's inputs and `options.actions` a handler per
|
|
2423
|
+
* app action the flow can call; a handler that throws or rejects makes the
|
|
2424
|
+
* flow run that action's failure path. `options.revision` is the interface
|
|
2425
|
+
* revision the app was built against, by default the one the
|
|
2426
|
+
* `flowRevisions` option sets for the location.
|
|
2427
|
+
*
|
|
2428
|
+
* Rejects with a {@link VoidhashError} when the flow cannot be shown; its
|
|
2429
|
+
* `code` says why (`FLOW_NOT_ASSIGNED`, `FLOW_UNAVAILABLE`,
|
|
2430
|
+
* `FLOW_RENDERER_MISSING`, …).
|
|
2431
|
+
*
|
|
2432
|
+
* The location's assignment is served from cache when the server cannot be
|
|
2433
|
+
* reached. Purchases started from the flow go through the SDK's purchase
|
|
2434
|
+
* path, so observer mode blocks them and the flow shows the failure. A flow
|
|
2435
|
+
* already on screen is closed first and resolves as `dismissed`.
|
|
2436
|
+
*/
|
|
2437
|
+
presentFlow<const L extends LocationSlug>(location: L, ...args: PresentFlowArguments<L>): Promise<FlowResult<L>>;
|
|
2438
|
+
/**
|
|
2439
|
+
* Changes inputs of the flow on screen; inputs that are not named keep
|
|
2440
|
+
* their values. No-op when no flow is shown and while disabled.
|
|
2441
|
+
*/
|
|
2442
|
+
updateFlowInput<L extends string = string>(values: Partial<FlowInput<L>>): Promise<void>;
|
|
2443
|
+
/**
|
|
2444
|
+
* Closes the flow on screen, if any; its `presentFlow()` resolves as
|
|
2445
|
+
* `dismissed`. No-op while disabled.
|
|
2446
|
+
*/
|
|
2447
|
+
dismissFlow(): Promise<void>;
|
|
2448
|
+
/**
|
|
2449
|
+
* Reports a purchase your own billing integration completed: its Apple
|
|
2450
|
+
* transaction (ID or JWS) or its Google Play token. Other purchase metadata
|
|
2451
|
+
* is optional and discarded. On iOS, a JWS is sent as the device's proof of
|
|
2452
|
+
* the purchase; with an ID only, the native SDK reads the JWS from the
|
|
2453
|
+
* device's purchase history.
|
|
2454
|
+
*
|
|
2455
|
+
* The report is a purchase the user just made: it goes to the current
|
|
2456
|
+
* user, even when an earlier purchase of the Apple Account or Google account
|
|
2457
|
+
* belongs to another user. Voidhash moves a purchase only when the store
|
|
2458
|
+
* shows it was made in the last 24 hours, and on iOS only with the JWS;
|
|
2459
|
+
* otherwise it is recorded for its current owner. A purchase is claimed
|
|
2460
|
+
* once from a device: reporting it again, also after another user signed
|
|
2461
|
+
* in, cannot move it.
|
|
2462
|
+
*
|
|
2463
|
+
* A report made after an `identify()`, `reset()` or `signOut()` that was
|
|
2464
|
+
* not awaited goes to the user that call switches to: it waits until the
|
|
2465
|
+
* device has switched, not for Voidhash to answer.
|
|
2466
|
+
*
|
|
2467
|
+
* Does not query, finish, acknowledge or consume the purchase. Pending
|
|
2468
|
+
* Android purchases are ignored; report them again when purchased.
|
|
2469
|
+
* Delivery failures remain queued for retry, so success does not imply
|
|
2470
|
+
* server acceptance.
|
|
2471
|
+
*/
|
|
2472
|
+
reportTransaction(transaction: StoreTransaction, options?: {
|
|
2473
|
+
/**
|
|
2474
|
+
* Reports a transaction your own restore flow returned after the user
|
|
2475
|
+
* asked to restore purchases. It is sent as an explicit restore, like
|
|
2476
|
+
* `restorePurchases()`, even when Voidhash accepted it before, and
|
|
2477
|
+
* keeps that intent across retries and relaunches: the project's paid
|
|
2478
|
+
* access sharing setting then decides whether a purchase another user
|
|
2479
|
+
* has is shared, moved or kept.
|
|
2480
|
+
*/
|
|
2481
|
+
readonly isRestore?: boolean;
|
|
2482
|
+
}): Promise<Result<void, VoidhashError>>;
|
|
2483
|
+
/**
|
|
2484
|
+
* Reports pending purchases and current store entitlements to Voidhash.
|
|
2485
|
+
* Recovery fallback when a host callback exposes no transaction values. Prefer
|
|
2486
|
+
* reportTransaction for purchase results, especially consumables already finalized.
|
|
2487
|
+
* In observer mode transactions are never finished. Delivery failures stay
|
|
2488
|
+
* queued and emit diagnostics; success does not imply server acceptance.
|
|
2489
|
+
*/
|
|
2490
|
+
syncPurchases(): Promise<Result<void, VoidhashError>>;
|
|
2491
|
+
/**
|
|
2492
|
+
* Captures a product analytics event.
|
|
2493
|
+
* Events are batched and delivered on size/time thresholds. Dropped — not
|
|
2494
|
+
* buffered — while disabled or while analytics consent is not granted
|
|
2495
|
+
* (unless `analyticsWhilePending` holds them for a pending one).
|
|
2496
|
+
* Events captured before `init()` resolves are kept and sent once it has,
|
|
2497
|
+
* provided the analytics consent `init()` settles on (the one chosen with
|
|
2498
|
+
* `setAnalyticsConsent()`, else the stored one, else the option) is
|
|
2499
|
+
* `"granted"`; a consent other than `"granted"` chosen meanwhile discards them.
|
|
2500
|
+
*
|
|
2501
|
+
* An event captured after an `identify()`, `reset()` or `signOut()` that
|
|
2502
|
+
* was not awaited is recorded for the person that call switches to: it
|
|
2503
|
+
* waits, in memory, until the device has switched, not for Voidhash to
|
|
2504
|
+
* answer, and keeps the time it was captured at. That is a moment after
|
|
2505
|
+
* `identify()`, and up to about two seconds after a `signOut()` or
|
|
2506
|
+
* `reset()` of a signed-in user, whose last events are sent first. An
|
|
2507
|
+
* identity call runs after the identity, group and person calls made
|
|
2508
|
+
* before it have settled, so behind several of those the wait is as long
|
|
2509
|
+
* as they take, which on a slow network is seconds each. Past 100 events
|
|
2510
|
+
* waiting, the oldest is dropped and reported as `ANALYTICS_EVENT_DROPPED`;
|
|
2511
|
+
* `end()` hands the waiting ones over as they are.
|
|
2512
|
+
*
|
|
2513
|
+
* Property values are copied as the event is captured, into what JSON can
|
|
2514
|
+
* hold: a `bigint` is sent as its decimal string, a `Date` as its ISO
|
|
2515
|
+
* string, a non-finite number as `null`, and functions, symbols,
|
|
2516
|
+
* `undefined` and circular references are left out. An event whose
|
|
2517
|
+
* properties cannot be copied at all (more than 10,000 values, or a getter
|
|
2518
|
+
* that throws) is dropped and reported as `ANALYTICS_EVENT_DROPPED`. Never
|
|
2519
|
+
* throws.
|
|
2520
|
+
*/
|
|
2521
|
+
capture(eventName: string, properties?: Record<string, unknown>): void;
|
|
2522
|
+
/**
|
|
2523
|
+
* Reports that the end user opened a notification, as `$push_opened` naming
|
|
2524
|
+
* its send. Call it from your notification library's opened-notification
|
|
2525
|
+
* handler, with the notification's data: the SDK has no notification handling
|
|
2526
|
+
* of its own. A notification not sent through Voidhash is ignored, and so is
|
|
2527
|
+
* one reported again right after its first report, as a handler that reads
|
|
2528
|
+
* the last opened notification on every mount does. Dropped while disabled or
|
|
2529
|
+
* while analytics consent is not granted. Never throws.
|
|
2530
|
+
*/
|
|
2531
|
+
trackPushOpened(data?: Readonly<Record<string, unknown>>): void;
|
|
2532
|
+
/**
|
|
2533
|
+
* The native client an event for `name` can be handed to, or `None` when it
|
|
2534
|
+
* is dropped: without consent (reported once) unless the native client
|
|
2535
|
+
* holds it for a pending one, after `end()`, or without
|
|
2536
|
+
* the native module (each reported).
|
|
2537
|
+
*
|
|
2538
|
+
* Before the client has started only the native client can know the consent
|
|
2539
|
+
* stored on the device, so the event is handed over for it to keep or
|
|
2540
|
+
* discard at start, whatever the `analyticsConsent` option says. A consent
|
|
2541
|
+
* `setAnalyticsConsent()` chose in this process is the exception: it wins
|
|
2542
|
+
* over the stored one, so it decides here already.
|
|
2543
|
+
*/
|
|
2544
|
+
private analyticsIntake;
|
|
2545
|
+
/**
|
|
2546
|
+
* Captures a `$screen` event for a screen the SDK cannot observe itself
|
|
2547
|
+
* (custom navigation, onboarding steps, pager pages). Every call is a new
|
|
2548
|
+
* screen instance, so calling it twice with the same name emits twice.
|
|
2549
|
+
* No-op while disabled or when `screenTracking.enabled` is `false`. Never
|
|
2550
|
+
* throws: a screen whose name is not a string, or that cannot be read, is
|
|
2551
|
+
* dropped and reported as `ANALYTICS_EVENT_DROPPED`.
|
|
2552
|
+
*/
|
|
2553
|
+
screen(name: string, properties?: Record<string, unknown>): void;
|
|
2554
|
+
/**
|
|
2555
|
+
* Sends everything queued now: person writes (`identify()` links and
|
|
2556
|
+
* attributes) first, then store receipts and analytics events, and reports
|
|
2557
|
+
* the analytics outcome. Waits at most about two seconds; delivery goes on
|
|
2558
|
+
* past that. Events still waiting for an identity change to switch the
|
|
2559
|
+
* person are sent too: the flush starts once it has. Nothing is ever queued
|
|
2560
|
+
* while disabled, so this no-ops.
|
|
2561
|
+
*/
|
|
2562
|
+
flush(): Promise<Result<FlushResult, VoidhashError>>;
|
|
2563
|
+
/** Clears the cached person snapshot. The next read refetches from the server. */
|
|
2564
|
+
resetCache(): Promise<Result<void, VoidhashError>>;
|
|
2565
|
+
/**
|
|
2566
|
+
* Internal surface used by the SDK's React bindings.
|
|
2567
|
+
* Not part of the public API — may change or disappear at any time.
|
|
2568
|
+
*/
|
|
2569
|
+
readonly internal: {
|
|
2570
|
+
getAtomRegistry: () => AtomRegistry.AtomRegistry;
|
|
2571
|
+
/** What flag `key` reads as while it has no evaluated value: its `featureFlags.defaults` entry, or `false`. */
|
|
2572
|
+
isFeatureEnabledByDefault: (key: string) => boolean;
|
|
2573
|
+
/**
|
|
2574
|
+
* What a purchase of `product` with `options` buys, as text: two
|
|
2575
|
+
* purchases with the same key buy the same product the same way. `None`
|
|
2576
|
+
* for options `purchase()` refuses.
|
|
2577
|
+
*/
|
|
2578
|
+
purchaseKey: (product: Product, options: PurchaseOptions) => Option.Option<string>;
|
|
2579
|
+
getSchema: () => Option.Option<RuntimeSchema>;
|
|
2580
|
+
getSuccessCallbackBaseUrl: () => string;
|
|
2581
|
+
getErrorCallbackBaseUrl: () => string;
|
|
2582
|
+
reportHostCallbackFailure: (operation: string, error: unknown) => void;
|
|
2583
|
+
};
|
|
2584
|
+
/** Reports an exception a callback the app supplied threw; the SDK carried on without it. */
|
|
2585
|
+
private reportHostCallbackFailure;
|
|
2586
|
+
/**
|
|
2587
|
+
* Reports, once until consent is granted again, that analytics work was
|
|
2588
|
+
* skipped for lack of consent.
|
|
2589
|
+
*/
|
|
2590
|
+
private reportAnalyticsConsentDenied;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Whether a distinct id is one the SDK made for an anonymous end user: `vh_anon_<uuid>`, or the
|
|
2595
|
+
* `vh:anon:` form a device may still hold from an earlier SDK build. Use it instead of checking a
|
|
2596
|
+
* prefix, for example to sign out only an identified person.
|
|
2597
|
+
*/
|
|
2598
|
+
declare const isAnonymousDistinctId: (distinctId: string) => boolean;
|
|
2599
|
+
|
|
2600
|
+
declare class Perk {
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Lifecycle phase of the SDK client owned by `VoidhashProvider`.
|
|
2605
|
+
*
|
|
2606
|
+
* `"disabled"` is terminal: the client was created with `enabled: false`, so
|
|
2607
|
+
* no `init()` is ever attempted and `retryInit()` does nothing.
|
|
2608
|
+
*/
|
|
2609
|
+
type VoidhashInitStatus = "disabled" | "failed" | "initializing" | "ready";
|
|
2610
|
+
declare const VoidhashInitError_base: Schema.Class<VoidhashInitError, Schema.TaggedStruct<"VoidhashInitError", {
|
|
2611
|
+
readonly message: Schema.String;
|
|
2612
|
+
readonly cause: Schema.Unknown;
|
|
2613
|
+
}>, effect_Cause.YieldableError>;
|
|
2614
|
+
/** Normalizes an unknown rejection value into an `Error`. */
|
|
2615
|
+
declare class VoidhashInitError extends VoidhashInitError_base {
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
interface VoidhashProviderBaseProps {
|
|
2619
|
+
children: ReactNode;
|
|
2620
|
+
}
|
|
2621
|
+
interface VoidhashContext {
|
|
2622
|
+
client: VoidhashClient;
|
|
2623
|
+
/** The error that failed `init()`. `null` unless `status` is `"failed"`. */
|
|
2624
|
+
initError: VoidhashInitError | null;
|
|
2625
|
+
/** Compatibility alias for `status === "ready"`. Stays false while disabled. */
|
|
2626
|
+
isInitialized: boolean;
|
|
2627
|
+
/**
|
|
2628
|
+
* Re-runs `init()` after a failure. No-op while initializing, ready or
|
|
2629
|
+
* disabled.
|
|
2630
|
+
*/
|
|
2631
|
+
retryInit: () => void;
|
|
2632
|
+
/** `"disabled"` when the client was created with `enabled: false`. */
|
|
2633
|
+
status: VoidhashInitStatus;
|
|
2634
|
+
}
|
|
2635
|
+
/**
|
|
2636
|
+
* Builds the provider, context and `useVoidhash` hook of one client. Every
|
|
2637
|
+
* provider instance shares the client's lifecycle, so an app with several
|
|
2638
|
+
* React roots can mount one provider per root: the client initializes with
|
|
2639
|
+
* the first and ends with the last.
|
|
2640
|
+
*/
|
|
2641
|
+
declare function voidhashProviderFactory(initialClient: VoidhashClient): {
|
|
2642
|
+
context: React.Context<Option.Option<VoidhashContext>>;
|
|
2643
|
+
provider: ({ children }: VoidhashProviderBaseProps) => react_jsx_runtime.JSX.Element;
|
|
2644
|
+
useVoidhash: () => VoidhashContext;
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2647
|
+
/** How the products load is going, the same for every `useProducts()`. */
|
|
2648
|
+
interface ProductsLoad {
|
|
2649
|
+
/** The error that stopped the last load, or `null`. */
|
|
2650
|
+
readonly error: VoidhashError | null;
|
|
2651
|
+
/**
|
|
2652
|
+
* `true` while the provider initializes and until the products have
|
|
2653
|
+
* loaded; `false` while disabled.
|
|
2654
|
+
*/
|
|
2655
|
+
readonly isLoading: boolean;
|
|
2656
|
+
/** Loads the products again. */
|
|
2657
|
+
readonly refetch: () => Promise<void>;
|
|
2658
|
+
}
|
|
2659
|
+
/** What `useProducts()` answers: every product. */
|
|
2660
|
+
interface UseProductsResult extends ProductsLoad {
|
|
2661
|
+
/** Every product the store sells this end user, sorted by slug; empty until loaded. */
|
|
2662
|
+
readonly products: ReadonlyArray<Product>;
|
|
2663
|
+
readonly data: {
|
|
2664
|
+
/** Each product by its slug; a slug the store has no product for is absent. */
|
|
2665
|
+
readonly bySlug: {
|
|
2666
|
+
readonly [Slug in ProductSlug]?: ProductForSlug<Slug>;
|
|
2667
|
+
};
|
|
2668
|
+
/** The product a slug names, or `undefined` when the store has none. */
|
|
2669
|
+
readonly get: <Slug extends ProductSlug>(slug: Slug) => ProductForSlug<Slug> | undefined;
|
|
2670
|
+
/** Every product, as `products`. */
|
|
2671
|
+
readonly toList: () => ReadonlyArray<Product>;
|
|
2672
|
+
};
|
|
2673
|
+
}
|
|
2674
|
+
/** What `useProducts(slugs)` answers: the products those slugs name, in their order. */
|
|
2675
|
+
interface UseProductsBySlugsResult<Slugs extends ReadonlyArray<ProductSlug>> extends ProductsLoad {
|
|
2676
|
+
/**
|
|
2677
|
+
* The product of each slug, in the order given: `undefined` until loaded
|
|
2678
|
+
* and where the store has none. With generated types each is typed by its
|
|
2679
|
+
* slug, so a subscription's slug is a `SubscriptionProduct`.
|
|
2680
|
+
*/
|
|
2681
|
+
readonly products: ProductsForSlugs<Slugs>;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
/** A purchase the store charged for, as `onSuccess` receives it. */
|
|
2685
|
+
type CompletedPurchase = Extract<PurchaseResult, {
|
|
2686
|
+
status: "purchased";
|
|
2687
|
+
}>;
|
|
2688
|
+
/**
|
|
2689
|
+
* Callbacks for a purchase's outcome. An exception a callback throws (or a
|
|
2690
|
+
* promise it returns that rejects) is reported through `onDiagnostic` as
|
|
2691
|
+
* `HOST_CALLBACK_FAILED` and never affects the purchase or the hook's state.
|
|
2692
|
+
*/
|
|
2693
|
+
interface UsePurchaseOptions {
|
|
2694
|
+
/**
|
|
2695
|
+
* Runs when the store charged (`purchased`), whether or not Voidhash has
|
|
2696
|
+
* accepted the receipt yet (`synced`): the purchase is done either way.
|
|
2697
|
+
*/
|
|
2698
|
+
onSuccess?: (result: CompletedPurchase) => void;
|
|
2699
|
+
onError?: (error: VoidhashError) => void;
|
|
2700
|
+
onSettled?: (result: Result<PurchaseResult, VoidhashError>) => void;
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* What one `purchase()` call of the hook takes: its own callbacks, and the
|
|
2704
|
+
* purchase options `client.purchase()` takes.
|
|
2705
|
+
*/
|
|
2706
|
+
interface UsePurchaseCallOptions extends UsePurchaseOptions, PurchaseOptions {
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* Callbacks for a restore's outcome. An exception a callback throws (or a
|
|
2711
|
+
* promise it returns that rejects) is reported through `onDiagnostic` as
|
|
2712
|
+
* `HOST_CALLBACK_FAILED` and never affects the restore or the hook's state.
|
|
2713
|
+
*/
|
|
2714
|
+
interface UseRestorePurchasesOptions {
|
|
2715
|
+
/**
|
|
2716
|
+
* Runs when the restore finished, with the refreshed person (`null` when
|
|
2717
|
+
* there is none). It does not mean the person has access: check their
|
|
2718
|
+
* entitlements, which mounted `useHasPerk` hooks already re-render with.
|
|
2719
|
+
*/
|
|
2720
|
+
onSuccess?: (person: Person | null) => void;
|
|
2721
|
+
onError?: (error: VoidhashError) => void;
|
|
2722
|
+
onSettled?: (result: Result<Person | null, VoidhashError>) => void;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
interface UseCurrentPersonResult {
|
|
2726
|
+
/** The person, or `null` until the first snapshot loads and while the client is disabled. */
|
|
2727
|
+
readonly data: Person | null;
|
|
2728
|
+
/** The error that stopped the last read, or `null`. */
|
|
2729
|
+
readonly error: VoidhashError | null;
|
|
2730
|
+
/** `true` while the provider initializes and until this hook's first read has answered. */
|
|
2731
|
+
readonly isLoading: boolean;
|
|
2732
|
+
/**
|
|
2733
|
+
* `true` while the person comes from a snapshot the server has not
|
|
2734
|
+
* confirmed recently: a cached one past its refresh window or TTL, or none
|
|
2735
|
+
* at all yet. Clears as soon as a refresh lands.
|
|
2736
|
+
*/
|
|
2737
|
+
readonly isStale: boolean;
|
|
2738
|
+
readonly refetch: () => Promise<void>;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
interface UseSubscriptionsResult extends Omit<UseCurrentPersonResult, "data"> {
|
|
2742
|
+
/**
|
|
2743
|
+
* Every subscription of the person that has not ended, including ones in a
|
|
2744
|
+
* grace period, in billing retry, on hold or paused: what a "manage
|
|
2745
|
+
* subscription" screen lists. Empty until the person loads. Access comes
|
|
2746
|
+
* from entitlements (`useHasPerk`), never from this list.
|
|
2747
|
+
*/
|
|
2748
|
+
readonly all: ReadonlyArray<Subscription>;
|
|
2749
|
+
/** The subscription that matters most now, or `undefined` when there is none. */
|
|
2750
|
+
readonly current: Subscription | undefined;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
interface UseHasPerkResult {
|
|
2754
|
+
/** The active grant behind `hasAccess`, or `null` when there is none. */
|
|
2755
|
+
grant: EntitlementGrant | null;
|
|
2756
|
+
hasAccess: boolean;
|
|
2757
|
+
/**
|
|
2758
|
+
* `true` while the provider initializes and until this hook's first check
|
|
2759
|
+
* has answered, so `hasAccess: false` is never reported before the SDK has
|
|
2760
|
+
* looked. `false` for a disabled client.
|
|
2761
|
+
*/
|
|
2762
|
+
isLoading: boolean;
|
|
2763
|
+
/**
|
|
2764
|
+
* True while `hasAccess` is answered from a snapshot the server has not
|
|
2765
|
+
* confirmed recently: a cached one past its refresh window or TTL, or none
|
|
2766
|
+
* at all yet. Clears as soon as a refresh lands, even one that runs in the
|
|
2767
|
+
* background. Pair with `error` to decide whether to fail open or closed.
|
|
2768
|
+
*/
|
|
2769
|
+
isStale: boolean;
|
|
2770
|
+
/** The error that stopped the last check, or `null`. */
|
|
2771
|
+
error: VoidhashError | null;
|
|
2772
|
+
refetch: () => Promise<void>;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
/** One flag's evaluation as {@link UseFeatureFlagsResult.getVariant} reports it. */
|
|
2776
|
+
interface FeatureFlagVariant {
|
|
2777
|
+
enabled: boolean;
|
|
2778
|
+
/** The selected variant's key, or `null` for a flag without variants. */
|
|
2779
|
+
variantKey: string | null;
|
|
2780
|
+
/** The selected variant's payload: untyped JSON, `null` when it has none. Validate before use. */
|
|
2781
|
+
payload: unknown;
|
|
2782
|
+
}
|
|
2783
|
+
interface UseFeatureFlagsResult {
|
|
2784
|
+
data: {
|
|
2785
|
+
/** Every flag evaluated for the requested keys (all flags when none were passed). */
|
|
2786
|
+
flags: ReadonlyArray<SdkFeatureFlag>;
|
|
2787
|
+
};
|
|
2788
|
+
/** The error that stopped the last evaluation, or `null`. */
|
|
2789
|
+
error: VoidhashError | null;
|
|
2790
|
+
/** The flag's variant, or `null` while it is loading or unknown. */
|
|
2791
|
+
getVariant: (key: FeatureFlagKey) => FeatureFlagVariant | null;
|
|
2792
|
+
/**
|
|
2793
|
+
* The value of the variant the flag selected, while the flag is enabled:
|
|
2794
|
+
* `null` while loading (`isLoading`), and once loaded when the flag is
|
|
2795
|
+
* off, has no variant (or one whose value is not text) or is unknown.
|
|
2796
|
+
* Typed by the variant values `voidhash.gen.d.ts` lists for the flag; a
|
|
2797
|
+
* variant added since generation is not in that union.
|
|
2798
|
+
*/
|
|
2799
|
+
getVariantValue: <K extends FeatureFlagKey>(key: K) => FeatureFlagValue<K> | null;
|
|
2800
|
+
/**
|
|
2801
|
+
* Whether the flag is enabled. A flag without an evaluated value (while
|
|
2802
|
+
* loading, unknown, or on a disabled client) reads as its
|
|
2803
|
+
* `featureFlags.defaults` entry, or `false`.
|
|
2804
|
+
*/
|
|
2805
|
+
isEnabled: (key: FeatureFlagKey) => boolean;
|
|
2806
|
+
/** `true` while the provider initializes and until this hook's evaluation has answered. */
|
|
2807
|
+
isLoading: boolean;
|
|
2808
|
+
refetch: () => Promise<void>;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
/**
|
|
2812
|
+
* Bootstrap the Voidhash SDK for a NitroUI app.
|
|
2813
|
+
*
|
|
2814
|
+
* - There is no schema argument. The schema lives on the server and is
|
|
2815
|
+
* fetched on `Provider` mount.
|
|
2816
|
+
* - Type safety for product / location / perk slugs comes from the generated
|
|
2817
|
+
* `voidhash.gen.d.ts` (run `voidhash-cli types generate`).
|
|
2818
|
+
* - No `publishableKey` (`null`, `undefined` or blank), or
|
|
2819
|
+
* `options.enabled: false` returns a fully inert client: the provider and
|
|
2820
|
+
* every hook still mount (so hook order never changes), but nothing
|
|
2821
|
+
* initializes.
|
|
2822
|
+
* - An `analyticsConsent` other than `"granted"`, `"denied"` or `"pending"`
|
|
2823
|
+
* throws an `INVALID_ARGUMENT` error in development builds; release builds
|
|
2824
|
+
* use `"granted"` and report `INVALID_CONFIGURATION`.
|
|
2825
|
+
* - A `featureFlags.maxWaitMs` that is not zero or a positive integer, or a
|
|
2826
|
+
* `featureFlags.defaults` entry that is not a boolean, throws an
|
|
2827
|
+
* `INVALID_ARGUMENT` error in development builds; release builds ignore it
|
|
2828
|
+
* and report `INVALID_CONFIGURATION`.
|
|
2829
|
+
* - A blank `distinctId`, `baseUrl` or `ingestUrl` counts as absent, and
|
|
2830
|
+
* whitespace around a `baseUrl` or `ingestUrl` is removed. A
|
|
2831
|
+
* `baseUrl` or `ingestUrl` that is not an absolute `http(s)` URL throws an
|
|
2832
|
+
* `INVALID_ARGUMENT` error in development builds; release builds use the
|
|
2833
|
+
* default origin and report `INVALID_CONFIGURATION` through `onDiagnostic`.
|
|
2834
|
+
* - A build without this package's native module (a JavaScript update onto
|
|
2835
|
+
* an app binary built before the package was added) loads normally;
|
|
2836
|
+
* `init()` then fails with `FAILED_TO_INITIALIZE_VOIDHASH_CLIENT`.
|
|
2837
|
+
*/
|
|
2838
|
+
declare function createVoidhashClient(publishableKey: string | null | undefined, options?: VoidhashClientOptions): {
|
|
2839
|
+
Provider: ({ children }: VoidhashProviderBaseProps) => react_jsx_runtime.JSX.Element;
|
|
2840
|
+
appStore: AppStoreActions;
|
|
2841
|
+
client: VoidhashClient;
|
|
2842
|
+
googlePlay: GooglePlayActions;
|
|
2843
|
+
useCurrentPerson: () => UseCurrentPersonResult;
|
|
2844
|
+
useFeatureFlags: (flagKeys?: ReadonlyArray<FeatureFlagKey>) => UseFeatureFlagsResult;
|
|
2845
|
+
useHasPerk: (perkSlug: PerkSlug) => UseHasPerkResult;
|
|
2846
|
+
usePresentFlow: <const L extends LocationSlug>(location: L) => {
|
|
2847
|
+
isPresenting: boolean;
|
|
2848
|
+
present: (...args: PresentFlowArguments<L>) => Promise<FlowResult<L>>;
|
|
2849
|
+
updateInput: (values: Partial<FlowInput<L>>) => Promise<void>;
|
|
2850
|
+
};
|
|
2851
|
+
useProducts: {
|
|
2852
|
+
(): UseProductsResult;
|
|
2853
|
+
<const Slugs extends ReadonlyArray<ProductSlug>>(slugs: Slugs): UseProductsBySlugsResult<Slugs>;
|
|
2854
|
+
};
|
|
2855
|
+
usePurchase: (hookOptions?: UsePurchaseOptions) => {
|
|
2856
|
+
error: VoidhashError | null;
|
|
2857
|
+
isLoading: boolean;
|
|
2858
|
+
pendingProduct: Product | undefined;
|
|
2859
|
+
purchase: (product: Product, options?: UsePurchaseCallOptions) => Promise<better_result.Result<PurchaseResult, VoidhashError>>;
|
|
2860
|
+
};
|
|
2861
|
+
useRestorePurchases: (hookOptions?: UseRestorePurchasesOptions) => {
|
|
2862
|
+
error: VoidhashError | null;
|
|
2863
|
+
isLoading: boolean;
|
|
2864
|
+
restore: () => Promise<better_result.Result<Person | null, VoidhashError>>;
|
|
2865
|
+
};
|
|
2866
|
+
useSubscriptions: () => UseSubscriptionsResult;
|
|
2867
|
+
useVoidhash: () => VoidhashContext;
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
export { type AnalyticsConsent, type AppStoreActions, type AppStoreExpirationReason, type AppStoreOffer, type AppStoreOfferType, type AppStoreOwnershipType, type AppStorePlatform, type AppStorePriceIncreaseStatus, type AppStoreProductInfo, type AppStoreProductType, type AppStorePurchaseIntent, type AppStoreRenewalInfo, type AppStoreRevocationReason, type AppStoreSubscriptionState, type AppStoreSubscriptionStatus, type AppStoreTransactionInfo, type AppTransaction, type BuiltInFlowOutcome, type CompletedPurchase, type ConnectivityPort, type ConsumableProduct, type CurrentPersonResult, DEFAULT_FLOW_CAPABILITIES, DIAGNOSTIC_CODES, type EntitlementGrant, type Environment, type FeatureFlagKey, type FeatureFlagValue, type FeatureFlagsOptions, type FeatureFlagsResult, type FlowActionHandler, type FlowActions, type FlowCapability, type FlowErrorCode, type FlowInput, type FlowLoading, type FlowOutcome, type FlowOutput, type FlowResult, type FlowRuntime, type FlowValue, type FlowValues, type FlushResult, type GooglePlayActions, type GooglePlayBillingFeature, type GooglePlayInAppMessageResult, type GooglePlayInstallmentPlan, type GooglePlayOneTimeOffer, type GooglePlayPricingPhase, type GooglePlayProductInfo, type GooglePlayProductType, type GooglePlayPurchaseData, type GooglePlayPurchaseState, type GooglePlayRecurrenceMode, type GooglePlaySubscriptionOffer, type GooglePlayTransactionInfo, type Group, type GroupProperties, type GroupPropertyValue, type Groups, type HasPerkResult, type IdentifyResult, type LocationSlug, type NonConsumableProduct, type NonRenewingSubscriptionProduct, type Offer, type OfferKind, type OfferSelection, type PaymentMode, type Period, type PeriodUnit, Perk, type PerkSlug, type Person, type PersonAttributes, type PersonStore, type PresentFlowArguments, type PresentFlowOptions, type Price, type PricingPhase, type Product, type ProductForSlug, type ProductForSlugIn, type ProductOfType, type ProductSlug, type ProductType, type ProductsForSlugs, type ProductsForSlugsIn, type PurchaseHistoryEntry, type PurchaseOptions, type PurchaseResult, type RefundRequestStatus, type RegisteredProductTypes, type ReportedTransaction, type ResolvedPaywall, RuntimeAppleAppStoreProductConfiguration, RuntimeDevelopmentProductConfiguration, RuntimeGooglePlayProductConfiguration, RuntimePaywallLocationDefinition, RuntimePerkDefinition, RuntimeProductDefinition, RuntimeProductDuration, RuntimeProductProviders, type RuntimeSchema, type RuntimeSchemaEncoded, RuntimeSchemaValue, RuntimeStoreOffer, type ScreenTrackingOptions, type SetPersonAttributesResult, type Store, type StoreTransaction, type Storefront, type Subscription, type SubscriptionHistoryEntry, type SubscriptionInfo, type SubscriptionPendingPrice, type SubscriptionPeriodType, type SubscriptionProduct, type SubscriptionReplacement, type SubscriptionReplacementMode, type SubscriptionStatus, type Transaction, type TransactionOffer, type TransactionOfferKind, type TransactionUpdate, type UnknownTypeProduct, type UseCurrentPersonResult, type UseProductsBySlugsResult, type UseProductsResult, type UsePurchaseCallOptions, type UsePurchaseOptions, type UseRestorePurchasesOptions, type UseSubscriptionsResult, VOIDHASH_ERROR_CODES, VoidhashClient, type VoidhashClientOptions, type VoidhashContext, type VoidhashDiagnostic, type VoidhashDiagnosticHandler, type VoidhashDiagnosticKind, VoidhashError, type VoidhashErrorCode, type VoidhashErrorReason, type VoidhashFlowShape, type VoidhashFlowsPort, VoidhashInitError, type VoidhashInitStatus, type VoidhashProviderBaseProps, type VoidhashRegister, type VoidhashRegisterShape, createEmptyRuntimeSchema, createVoidhashClient, decodeAppStoreProduct, decodeAppStoreRenewalInfo, decodeAppStoreTransaction, decodeAppTransaction, decodeGooglePlayProduct, decodeGooglePlayTransaction, decodePerson, isAnonymousDistinctId, voidhashProviderFactory };
|