@voidhash/nitro-ui 0.0.0-stage → 0.4.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.
Files changed (442) hide show
  1. package/LICENSE.md +21 -0
  2. package/Package.swift +161 -0
  3. package/README.md +127 -2
  4. package/android/nitro-ui.gradle +35 -0
  5. package/android/src/main/java/com/margelo/nitro/voidhash/HybridVoidhashNativeClient.kt +53 -0
  6. package/android/src/main/java/com/margelo/nitro/voidhash/VoidhashNitroUIModule.kt +65 -0
  7. package/android/src/main/java/com/margelo/nitro/voidhash/client/LegacyStorageImporter.kt +526 -0
  8. package/android/src/main/java/com/margelo/nitro/voidhash/client/SdkBackedNativeClient.kt +1131 -0
  9. package/android/src/main/java/com/margelo/nitro/voidhash/client/StoreMapping.kt +257 -0
  10. package/android/src/main/java/com/margelo/nitro/voidhash/client/VoidhashFlowPermissionHandlers.kt +23 -0
  11. package/android/src/main/java/com/margelo/nitro/voidhash/flows/VoidhashFlowsCore.kt +93 -0
  12. package/build/chunk-Z6TDMZMZ.js +326 -0
  13. package/build/chunk-Z6TDMZMZ.js.map +1 -0
  14. package/build/index.d.ts +2866 -0
  15. package/build/index.js +4182 -0
  16. package/build/index.js.map +1 -0
  17. package/build/navigation.d.ts +66 -0
  18. package/build/navigation.js +72 -0
  19. package/build/navigation.js.map +1 -0
  20. package/ios/HybridVoidhashNativeClient.swift +427 -0
  21. package/ios/Shared/NativeClientMapping.swift +184 -0
  22. package/ios/Shared/NativeStoreJson.swift +126 -0
  23. package/ios/Shared/VoidhashCoreExports.swift +5 -0
  24. package/ios/Shared/VoidhashLegacyImporter.swift +686 -0
  25. package/ios/Shared/VoidhashNativeClientCore.swift +1400 -0
  26. package/nitro.json +8 -0
  27. package/nitrogen/generated/.gitattributes +1 -0
  28. package/nitrogen/generated/android/NitroVoidhash+autolinking.cmake +86 -0
  29. package/nitrogen/generated/android/NitroVoidhash+autolinking.gradle +10 -0
  30. package/nitrogen/generated/android/NitroVoidhashOnLoad.cpp +22 -0
  31. package/nitrogen/generated/android/c++/JCallback_Promise_std__string__std__string_std__string.cpp +57 -0
  32. package/nitrogen/generated/android/c++/JCallback_void_NativeClientEvent.cpp +55 -0
  33. package/nitrogen/generated/android/c++/JHybridVoidhashNativeClientSpec.cpp +387 -0
  34. package/nitrogen/generated/android/c++/JNativeAnalyticsConsent.cpp +55 -0
  35. package/nitrogen/generated/android/c++/JNativeAppStoreMessages.cpp +52 -0
  36. package/nitrogen/generated/android/c++/JNativeAppStorePurchaseOptions.cpp +36 -0
  37. package/nitrogen/generated/android/c++/JNativeAppStoreSubscriptionState.cpp +64 -0
  38. package/nitrogen/generated/android/c++/JNativeAppStoreSubscriptionStatus.cpp +38 -0
  39. package/nitrogen/generated/android/c++/JNativeClientConfiguration.cpp +75 -0
  40. package/nitrogen/generated/android/c++/JNativeClientEvent.cpp +52 -0
  41. package/nitrogen/generated/android/c++/JNativeClientEventType.cpp +70 -0
  42. package/nitrogen/generated/android/c++/JNativeDiagnostic.cpp +44 -0
  43. package/nitrogen/generated/android/c++/JNativeDiagnosticKind.cpp +67 -0
  44. package/nitrogen/generated/android/c++/JNativeEnvironment.cpp +61 -0
  45. package/nitrogen/generated/android/c++/JNativeFeatureFlag.cpp +41 -0
  46. package/nitrogen/generated/android/c++/JNativeFeatureFlagsResult.cpp +45 -0
  47. package/nitrogen/generated/android/c++/JNativeFlowCapability.cpp +58 -0
  48. package/nitrogen/generated/android/c++/JNativeFlowLoading.cpp +52 -0
  49. package/nitrogen/generated/android/c++/JNativeFlowPresentation.cpp +42 -0
  50. package/nitrogen/generated/android/c++/JNativeFlowRevision.cpp +37 -0
  51. package/nitrogen/generated/android/c++/JNativeFlowRuntime.cpp +52 -0
  52. package/nitrogen/generated/android/c++/JNativeFlushStatus.cpp +40 -0
  53. package/nitrogen/generated/android/c++/JNativeFreshnessReason.cpp +58 -0
  54. package/nitrogen/generated/android/c++/JNativeGooglePlayPurchaseOptions.cpp +40 -0
  55. package/nitrogen/generated/android/c++/JNativeIdentifyResult.cpp +40 -0
  56. package/nitrogen/generated/android/c++/JNativeIdentityChange.cpp +38 -0
  57. package/nitrogen/generated/android/c++/JNativeInAppMessageResult.cpp +38 -0
  58. package/nitrogen/generated/android/c++/JNativeInAppMessageStatus.cpp +52 -0
  59. package/nitrogen/generated/android/c++/JNativeOffer.cpp +44 -0
  60. package/nitrogen/generated/android/c++/JNativeOfferKind.cpp +61 -0
  61. package/nitrogen/generated/android/c++/JNativeOfferSelection.cpp +55 -0
  62. package/nitrogen/generated/android/c++/JNativePaymentMode.cpp +58 -0
  63. package/nitrogen/generated/android/c++/JNativePendingAnalytics.cpp +52 -0
  64. package/nitrogen/generated/android/c++/JNativePeriod.cpp +39 -0
  65. package/nitrogen/generated/android/c++/JNativePeriodUnit.cpp +61 -0
  66. package/nitrogen/generated/android/c++/JNativePersonState.cpp +44 -0
  67. package/nitrogen/generated/android/c++/JNativePersonWriteResult.cpp +38 -0
  68. package/nitrogen/generated/android/c++/JNativePrice.cpp +39 -0
  69. package/nitrogen/generated/android/c++/JNativePricingPhase.cpp +40 -0
  70. package/nitrogen/generated/android/c++/JNativeProduct.cpp +55 -0
  71. package/nitrogen/generated/android/c++/JNativeProductType.cpp +61 -0
  72. package/nitrogen/generated/android/c++/JNativePurchaseIntent.cpp +38 -0
  73. package/nitrogen/generated/android/c++/JNativePurchaseIntents.cpp +52 -0
  74. package/nitrogen/generated/android/c++/JNativePurchaseOptions.cpp +49 -0
  75. package/nitrogen/generated/android/c++/JNativePurchaseOutcome.cpp +55 -0
  76. package/nitrogen/generated/android/c++/JNativePurchaseResult.cpp +40 -0
  77. package/nitrogen/generated/android/c++/JNativeRefundRequestStatus.cpp +52 -0
  78. package/nitrogen/generated/android/c++/JNativeReportedPurchaseState.cpp +55 -0
  79. package/nitrogen/generated/android/c++/JNativeReportedTransaction.cpp +42 -0
  80. package/nitrogen/generated/android/c++/JNativeStore.cpp +58 -0
  81. package/nitrogen/generated/android/c++/JNativeStorePlatform.cpp +52 -0
  82. package/nitrogen/generated/android/c++/JNativeStorefront.cpp +37 -0
  83. package/nitrogen/generated/android/c++/JNativeSubscriptionInfo.cpp +45 -0
  84. package/nitrogen/generated/android/c++/JNativeSubscriptionReplacement.cpp +36 -0
  85. package/nitrogen/generated/android/c++/JNativeSubscriptionReplacementMode.cpp +61 -0
  86. package/nitrogen/generated/android/c++/JNativeTransaction.cpp +53 -0
  87. package/nitrogen/generated/android/c++/JNativeTransactionOffer.cpp +40 -0
  88. package/nitrogen/generated/android/c++/JNativeTransactionOfferKind.cpp +64 -0
  89. package/nitrogen/generated/android/c++/JNativeTransactionUpdate.cpp +36 -0
  90. package/nitrogen/generated/android/c++/JNativeWriteStatus.cpp +55 -0
  91. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JCallback_Promise_std__string__std__string_std__string.hpp +55 -0
  92. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JCallback_void_NativeClientEvent.hpp +54 -0
  93. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JHybridVoidhashNativeClientSpec.hpp +166 -0
  94. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JHybridVoidhashNativeClientSpecJavaPart.hpp +26 -0
  95. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAnalyticsConsent.hpp +77 -0
  96. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreMessages.hpp +72 -0
  97. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStorePurchaseOptions.hpp +51 -0
  98. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreSubscriptionState.hpp +92 -0
  99. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeAppStoreSubscriptionStatus.hpp +61 -0
  100. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientConfiguration.hpp +190 -0
  101. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientEvent.hpp +99 -0
  102. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeClientEventType.hpp +102 -0
  103. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeDiagnostic.hpp +79 -0
  104. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeDiagnosticKind.hpp +97 -0
  105. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeEnvironment.hpp +87 -0
  106. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFeatureFlag.hpp +68 -0
  107. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFeatureFlagsResult.hpp +76 -0
  108. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowCapability.hpp +82 -0
  109. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowLoading.hpp +72 -0
  110. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowPresentation.hpp +65 -0
  111. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowRevision.hpp +56 -0
  112. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlowRuntime.hpp +72 -0
  113. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFlushStatus.hpp +63 -0
  114. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeFreshnessReason.hpp +82 -0
  115. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeGooglePlayPurchaseOptions.hpp +63 -0
  116. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeIdentifyResult.hpp +63 -0
  117. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeIdentityChange.hpp +61 -0
  118. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeInAppMessageResult.hpp +57 -0
  119. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeInAppMessageStatus.hpp +72 -0
  120. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOffer.hpp +71 -0
  121. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOfferKind.hpp +87 -0
  122. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeOfferSelection.hpp +77 -0
  123. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePaymentMode.hpp +82 -0
  124. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePendingAnalytics.hpp +72 -0
  125. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePeriod.hpp +62 -0
  126. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePeriodUnit.hpp +87 -0
  127. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePersonState.hpp +79 -0
  128. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePersonWriteResult.hpp +57 -0
  129. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePrice.hpp +66 -0
  130. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePricingPhase.hpp +67 -0
  131. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeProduct.hpp +118 -0
  132. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeProductType.hpp +87 -0
  133. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseIntent.hpp +57 -0
  134. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseIntents.hpp +72 -0
  135. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseOptions.hpp +88 -0
  136. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseOutcome.hpp +77 -0
  137. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativePurchaseResult.hpp +63 -0
  138. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeRefundRequestStatus.hpp +72 -0
  139. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeReportedPurchaseState.hpp +77 -0
  140. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeReportedTransaction.hpp +73 -0
  141. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStore.hpp +82 -0
  142. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStorePlatform.hpp +72 -0
  143. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeStorefront.hpp +56 -0
  144. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionInfo.hpp +84 -0
  145. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionReplacement.hpp +55 -0
  146. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeSubscriptionReplacementMode.hpp +87 -0
  147. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransaction.hpp +116 -0
  148. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionOffer.hpp +63 -0
  149. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionOfferKind.hpp +92 -0
  150. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeTransactionUpdate.hpp +55 -0
  151. package/nitrogen/generated/android/c++/include/NitroVoidhash/private/JNativeWriteStatus.hpp +77 -0
  152. package/nitrogen/generated/android/include/NitroVoidhash/private/NitroVoidhashOnLoad.hpp +13 -0
  153. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/Callback_Promise_std__string__std__string_std__string.kt +69 -0
  154. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/Callback_void_NativeClientEvent.kt +69 -0
  155. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/HybridVoidhashNativeClientSpec.kt +278 -0
  156. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAnalyticsConsent.kt +49 -0
  157. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreMessages.kt +46 -0
  158. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStorePurchaseOptions.kt +46 -0
  159. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreSubscriptionState.kt +58 -0
  160. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeAppStoreSubscriptionStatus.kt +57 -0
  161. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientConfiguration.kt +172 -0
  162. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientEvent.kt +87 -0
  163. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeClientEventType.kt +64 -0
  164. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeDiagnostic.kt +72 -0
  165. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeDiagnosticKind.kt +61 -0
  166. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeEnvironment.kt +55 -0
  167. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFeatureFlag.kt +62 -0
  168. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFeatureFlagsResult.kt +67 -0
  169. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowCapability.kt +52 -0
  170. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowLoading.kt +46 -0
  171. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowPresentation.kt +57 -0
  172. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowRevision.kt +52 -0
  173. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlowRuntime.kt +46 -0
  174. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFlushStatus.kt +57 -0
  175. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeFreshnessReason.kt +52 -0
  176. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeGooglePlayPurchaseOptions.kt +57 -0
  177. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeIdentifyResult.kt +57 -0
  178. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeIdentityChange.kt +57 -0
  179. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeInAppMessageResult.kt +52 -0
  180. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeInAppMessageStatus.kt +46 -0
  181. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOffer.kt +62 -0
  182. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOfferKind.kt +55 -0
  183. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeOfferSelection.kt +49 -0
  184. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePaymentMode.kt +52 -0
  185. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePendingAnalytics.kt +46 -0
  186. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePeriod.kt +57 -0
  187. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePeriodUnit.kt +55 -0
  188. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePersonState.kt +72 -0
  189. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePersonWriteResult.kt +52 -0
  190. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePrice.kt +62 -0
  191. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePricingPhase.kt +62 -0
  192. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeProduct.kt +107 -0
  193. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeProductType.kt +55 -0
  194. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseIntent.kt +52 -0
  195. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseIntents.kt +46 -0
  196. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseOptions.kt +77 -0
  197. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseOutcome.kt +49 -0
  198. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativePurchaseResult.kt +57 -0
  199. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeRefundRequestStatus.kt +46 -0
  200. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeReportedPurchaseState.kt +49 -0
  201. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeReportedTransaction.kt +67 -0
  202. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStore.kt +52 -0
  203. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStorePlatform.kt +46 -0
  204. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeStorefront.kt +52 -0
  205. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionInfo.kt +77 -0
  206. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionReplacement.kt +52 -0
  207. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeSubscriptionReplacementMode.kt +55 -0
  208. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransaction.kt +107 -0
  209. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionOffer.kt +57 -0
  210. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionOfferKind.kt +58 -0
  211. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeTransactionUpdate.kt +52 -0
  212. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NativeWriteStatus.kt +49 -0
  213. package/nitrogen/generated/android/kotlin/com/margelo/nitro/voidhash/NitroVoidhashOnLoad.kt +22 -0
  214. package/nitrogen/generated/apple/NitroVoidhash-Swift-Cxx-Bridge.cpp +381 -0
  215. package/nitrogen/generated/apple/NitroVoidhashAppleCxx/NitroVoidhashAppleCxx.cpp +9 -0
  216. package/nitrogen/generated/apple/NitroVoidhashAppleCxx/include/NitroVoidhashAppleCxx/NitroVoidhashAppleCxx.h +265 -0
  217. package/nitrogen/generated/apple/NitroVoidhashAutolinking.cpp +20 -0
  218. package/nitrogen/generated/apple/NitroVoidhashAutolinking.mm +24 -0
  219. package/nitrogen/generated/apple/c++/HybridVoidhashNativeClientSpecSwift.cpp +555 -0
  220. package/nitrogen/generated/apple/c++/HybridVoidhashNativeClientSpec_cxx-Swift.cpp +28 -0
  221. package/nitrogen/generated/apple/c++/NativeAnalyticsConsent-Swift.cpp +49 -0
  222. package/nitrogen/generated/apple/c++/NativeAppStoreMessages-Swift.cpp +46 -0
  223. package/nitrogen/generated/apple/c++/NativeAppStorePurchaseOptions-Swift.cpp +32 -0
  224. package/nitrogen/generated/apple/c++/NativeAppStoreSubscriptionState-Swift.cpp +58 -0
  225. package/nitrogen/generated/apple/c++/NativeAppStoreSubscriptionStatus-Swift.cpp +34 -0
  226. package/nitrogen/generated/apple/c++/NativeClientConfiguration-Swift.cpp +57 -0
  227. package/nitrogen/generated/apple/c++/NativeClientEvent-Swift.cpp +40 -0
  228. package/nitrogen/generated/apple/c++/NativeClientEventType-Swift.cpp +64 -0
  229. package/nitrogen/generated/apple/c++/NativeDiagnostic-Swift.cpp +37 -0
  230. package/nitrogen/generated/apple/c++/NativeDiagnosticKind-Swift.cpp +61 -0
  231. package/nitrogen/generated/apple/c++/NativeEnvironment-Swift.cpp +55 -0
  232. package/nitrogen/generated/apple/c++/NativeFeatureFlag-Swift.cpp +35 -0
  233. package/nitrogen/generated/apple/c++/NativeFeatureFlagsResult-Swift.cpp +36 -0
  234. package/nitrogen/generated/apple/c++/NativeFlowCapability-Swift.cpp +52 -0
  235. package/nitrogen/generated/apple/c++/NativeFlowLoading-Swift.cpp +46 -0
  236. package/nitrogen/generated/apple/c++/NativeFlowPresentation-Swift.cpp +34 -0
  237. package/nitrogen/generated/apple/c++/NativeFlowRevision-Swift.cpp +33 -0
  238. package/nitrogen/generated/apple/c++/NativeFlowRuntime-Swift.cpp +46 -0
  239. package/nitrogen/generated/apple/c++/NativeFlushStatus-Swift.cpp +34 -0
  240. package/nitrogen/generated/apple/c++/NativeFreshnessReason-Swift.cpp +52 -0
  241. package/nitrogen/generated/apple/c++/NativeGooglePlayPurchaseOptions-Swift.cpp +34 -0
  242. package/nitrogen/generated/apple/c++/NativeIdentifyResult-Swift.cpp +34 -0
  243. package/nitrogen/generated/apple/c++/NativeIdentityChange-Swift.cpp +34 -0
  244. package/nitrogen/generated/apple/c++/NativeInAppMessageResult-Swift.cpp +33 -0
  245. package/nitrogen/generated/apple/c++/NativeInAppMessageStatus-Swift.cpp +46 -0
  246. package/nitrogen/generated/apple/c++/NativeOffer-Swift.cpp +35 -0
  247. package/nitrogen/generated/apple/c++/NativeOfferKind-Swift.cpp +55 -0
  248. package/nitrogen/generated/apple/c++/NativeOfferSelection-Swift.cpp +49 -0
  249. package/nitrogen/generated/apple/c++/NativePaymentMode-Swift.cpp +52 -0
  250. package/nitrogen/generated/apple/c++/NativePendingAnalytics-Swift.cpp +46 -0
  251. package/nitrogen/generated/apple/c++/NativePeriod-Swift.cpp +34 -0
  252. package/nitrogen/generated/apple/c++/NativePeriodUnit-Swift.cpp +55 -0
  253. package/nitrogen/generated/apple/c++/NativePersonState-Swift.cpp +37 -0
  254. package/nitrogen/generated/apple/c++/NativePersonWriteResult-Swift.cpp +33 -0
  255. package/nitrogen/generated/apple/c++/NativePrice-Swift.cpp +35 -0
  256. package/nitrogen/generated/apple/c++/NativePricingPhase-Swift.cpp +35 -0
  257. package/nitrogen/generated/apple/c++/NativeProduct-Swift.cpp +44 -0
  258. package/nitrogen/generated/apple/c++/NativeProductType-Swift.cpp +55 -0
  259. package/nitrogen/generated/apple/c++/NativePurchaseIntent-Swift.cpp +33 -0
  260. package/nitrogen/generated/apple/c++/NativePurchaseIntents-Swift.cpp +46 -0
  261. package/nitrogen/generated/apple/c++/NativePurchaseOptions-Swift.cpp +38 -0
  262. package/nitrogen/generated/apple/c++/NativePurchaseOutcome-Swift.cpp +49 -0
  263. package/nitrogen/generated/apple/c++/NativePurchaseResult-Swift.cpp +34 -0
  264. package/nitrogen/generated/apple/c++/NativeRefundRequestStatus-Swift.cpp +46 -0
  265. package/nitrogen/generated/apple/c++/NativeReportedPurchaseState-Swift.cpp +49 -0
  266. package/nitrogen/generated/apple/c++/NativeReportedTransaction-Swift.cpp +36 -0
  267. package/nitrogen/generated/apple/c++/NativeStore-Swift.cpp +52 -0
  268. package/nitrogen/generated/apple/c++/NativeStorePlatform-Swift.cpp +46 -0
  269. package/nitrogen/generated/apple/c++/NativeStorefront-Swift.cpp +33 -0
  270. package/nitrogen/generated/apple/c++/NativeSubscriptionInfo-Swift.cpp +38 -0
  271. package/nitrogen/generated/apple/c++/NativeSubscriptionReplacement-Swift.cpp +33 -0
  272. package/nitrogen/generated/apple/c++/NativeSubscriptionReplacementMode-Swift.cpp +55 -0
  273. package/nitrogen/generated/apple/c++/NativeTransaction-Swift.cpp +44 -0
  274. package/nitrogen/generated/apple/c++/NativeTransactionOffer-Swift.cpp +34 -0
  275. package/nitrogen/generated/apple/c++/NativeTransactionOfferKind-Swift.cpp +58 -0
  276. package/nitrogen/generated/apple/c++/NativeTransactionUpdate-Swift.cpp +33 -0
  277. package/nitrogen/generated/apple/c++/NativeWriteStatus-Swift.cpp +49 -0
  278. package/nitrogen/generated/apple/c++/Record_swift__String_bool-Swift.cpp +26 -0
  279. package/nitrogen/generated/apple/c++/Record_swift__String_swift__String-Swift.cpp +26 -0
  280. package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_-Swift.cpp +38 -0
  281. package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_-Swift.cpp +41 -0
  282. package/nitrogen/generated/apple/c++/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_-Swift.cpp +36 -0
  283. package/nitrogen/generated/apple/c++/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_-Swift.cpp +30 -0
  284. package/nitrogen/generated/apple/c++/include/NitroVoidhash/NitroVoidhashAutolinking.hpp +13 -0
  285. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/HybridVoidhashNativeClientSpecSwift.hpp +121 -0
  286. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/HybridVoidhashNativeClientSpec_cxx-Swift.hpp +23 -0
  287. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAnalyticsConsent-Swift.hpp +23 -0
  288. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreMessages-Swift.hpp +23 -0
  289. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStorePurchaseOptions-Swift.hpp +23 -0
  290. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreSubscriptionState-Swift.hpp +23 -0
  291. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeAppStoreSubscriptionStatus-Swift.hpp +23 -0
  292. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientConfiguration-Swift.hpp +23 -0
  293. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientEvent-Swift.hpp +23 -0
  294. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeClientEventType-Swift.hpp +23 -0
  295. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeDiagnostic-Swift.hpp +23 -0
  296. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeDiagnosticKind-Swift.hpp +23 -0
  297. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeEnvironment-Swift.hpp +23 -0
  298. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFeatureFlag-Swift.hpp +23 -0
  299. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFeatureFlagsResult-Swift.hpp +23 -0
  300. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowCapability-Swift.hpp +23 -0
  301. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowLoading-Swift.hpp +23 -0
  302. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowPresentation-Swift.hpp +23 -0
  303. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowRevision-Swift.hpp +23 -0
  304. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlowRuntime-Swift.hpp +23 -0
  305. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFlushStatus-Swift.hpp +23 -0
  306. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeFreshnessReason-Swift.hpp +23 -0
  307. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeGooglePlayPurchaseOptions-Swift.hpp +23 -0
  308. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeIdentifyResult-Swift.hpp +23 -0
  309. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeIdentityChange-Swift.hpp +23 -0
  310. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeInAppMessageResult-Swift.hpp +23 -0
  311. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeInAppMessageStatus-Swift.hpp +23 -0
  312. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOffer-Swift.hpp +23 -0
  313. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOfferKind-Swift.hpp +23 -0
  314. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeOfferSelection-Swift.hpp +23 -0
  315. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePaymentMode-Swift.hpp +23 -0
  316. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePendingAnalytics-Swift.hpp +23 -0
  317. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePeriod-Swift.hpp +23 -0
  318. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePeriodUnit-Swift.hpp +23 -0
  319. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePersonState-Swift.hpp +23 -0
  320. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePersonWriteResult-Swift.hpp +23 -0
  321. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePrice-Swift.hpp +23 -0
  322. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePricingPhase-Swift.hpp +23 -0
  323. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeProduct-Swift.hpp +23 -0
  324. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeProductType-Swift.hpp +23 -0
  325. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseIntent-Swift.hpp +23 -0
  326. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseIntents-Swift.hpp +23 -0
  327. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseOptions-Swift.hpp +23 -0
  328. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseOutcome-Swift.hpp +23 -0
  329. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativePurchaseResult-Swift.hpp +23 -0
  330. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeRefundRequestStatus-Swift.hpp +23 -0
  331. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeReportedPurchaseState-Swift.hpp +23 -0
  332. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeReportedTransaction-Swift.hpp +23 -0
  333. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStore-Swift.hpp +23 -0
  334. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStorePlatform-Swift.hpp +23 -0
  335. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeStorefront-Swift.hpp +23 -0
  336. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionInfo-Swift.hpp +23 -0
  337. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionReplacement-Swift.hpp +23 -0
  338. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeSubscriptionReplacementMode-Swift.hpp +23 -0
  339. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransaction-Swift.hpp +23 -0
  340. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionOffer-Swift.hpp +23 -0
  341. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionOfferKind-Swift.hpp +23 -0
  342. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeTransactionUpdate-Swift.hpp +23 -0
  343. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NativeWriteStatus-Swift.hpp +23 -0
  344. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/NitroVoidhash-Swift-Cxx-Umbrella.hpp +100 -0
  345. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/Record_swift__String_bool-Swift.hpp +23 -0
  346. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/Record_swift__String_swift__String-Swift.hpp +23 -0
  347. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_-Swift.hpp +23 -0
  348. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_-Swift.hpp +23 -0
  349. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_-Swift.hpp +23 -0
  350. package/nitrogen/generated/apple/c++/include/NitroVoidhash/private/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_-Swift.hpp +23 -0
  351. package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
  352. package/nitrogen/generated/apple/swift/Callback_Promise_swift__String__swift__String_swift__String.swift +73 -0
  353. package/nitrogen/generated/apple/swift/Callback_void___NitroVoidhash__NativeClientEvent.swift +66 -0
  354. package/nitrogen/generated/apple/swift/HybridVoidhashNativeClientSpec.swift +113 -0
  355. package/nitrogen/generated/apple/swift/HybridVoidhashNativeClientSpec_cxx.swift +629 -0
  356. package/nitrogen/generated/apple/swift/NativeAnalyticsConsent.swift +59 -0
  357. package/nitrogen/generated/apple/swift/NativeAppStoreMessages.swift +54 -0
  358. package/nitrogen/generated/apple/swift/NativeAppStorePurchaseOptions.swift +28 -0
  359. package/nitrogen/generated/apple/swift/NativeAppStoreSubscriptionState.swift +74 -0
  360. package/nitrogen/generated/apple/swift/NativeAppStoreSubscriptionStatus.swift +42 -0
  361. package/nitrogen/generated/apple/swift/NativeClientConfiguration.swift +203 -0
  362. package/nitrogen/generated/apple/swift/NativeClientEvent.swift +84 -0
  363. package/nitrogen/generated/apple/swift/NativeClientEventType.swift +84 -0
  364. package/nitrogen/generated/apple/swift/NativeDiagnostic.swift +63 -0
  365. package/nitrogen/generated/apple/swift/NativeDiagnosticKind.swift +79 -0
  366. package/nitrogen/generated/apple/swift/NativeEnvironment.swift +69 -0
  367. package/nitrogen/generated/apple/swift/NativeFeatureFlag.swift +49 -0
  368. package/nitrogen/generated/apple/swift/NativeFeatureFlagsResult.swift +56 -0
  369. package/nitrogen/generated/apple/swift/NativeFlowCapability.swift +64 -0
  370. package/nitrogen/generated/apple/swift/NativeFlowLoading.swift +54 -0
  371. package/nitrogen/generated/apple/swift/NativeFlowPresentation.swift +42 -0
  372. package/nitrogen/generated/apple/swift/NativeFlowRevision.swift +35 -0
  373. package/nitrogen/generated/apple/swift/NativeFlowRuntime.swift +54 -0
  374. package/nitrogen/generated/apple/swift/NativeFlushStatus.swift +42 -0
  375. package/nitrogen/generated/apple/swift/NativeFreshnessReason.swift +64 -0
  376. package/nitrogen/generated/apple/swift/NativeGooglePlayPurchaseOptions.swift +42 -0
  377. package/nitrogen/generated/apple/swift/NativeIdentifyResult.swift +42 -0
  378. package/nitrogen/generated/apple/swift/NativeIdentityChange.swift +42 -0
  379. package/nitrogen/generated/apple/swift/NativeInAppMessageResult.swift +35 -0
  380. package/nitrogen/generated/apple/swift/NativeInAppMessageStatus.swift +54 -0
  381. package/nitrogen/generated/apple/swift/NativeOffer.swift +49 -0
  382. package/nitrogen/generated/apple/swift/NativeOfferKind.swift +69 -0
  383. package/nitrogen/generated/apple/swift/NativeOfferSelection.swift +59 -0
  384. package/nitrogen/generated/apple/swift/NativePaymentMode.swift +64 -0
  385. package/nitrogen/generated/apple/swift/NativePendingAnalytics.swift +54 -0
  386. package/nitrogen/generated/apple/swift/NativePeriod.swift +42 -0
  387. package/nitrogen/generated/apple/swift/NativePeriodUnit.swift +69 -0
  388. package/nitrogen/generated/apple/swift/NativePersonState.swift +63 -0
  389. package/nitrogen/generated/apple/swift/NativePersonWriteResult.swift +35 -0
  390. package/nitrogen/generated/apple/swift/NativePrice.swift +49 -0
  391. package/nitrogen/generated/apple/swift/NativePricingPhase.swift +49 -0
  392. package/nitrogen/generated/apple/swift/NativeProduct.swift +112 -0
  393. package/nitrogen/generated/apple/swift/NativeProductType.swift +69 -0
  394. package/nitrogen/generated/apple/swift/NativePurchaseIntent.swift +35 -0
  395. package/nitrogen/generated/apple/swift/NativePurchaseIntents.swift +54 -0
  396. package/nitrogen/generated/apple/swift/NativePurchaseOptions.swift +70 -0
  397. package/nitrogen/generated/apple/swift/NativePurchaseOutcome.swift +59 -0
  398. package/nitrogen/generated/apple/swift/NativePurchaseResult.swift +42 -0
  399. package/nitrogen/generated/apple/swift/NativeRefundRequestStatus.swift +54 -0
  400. package/nitrogen/generated/apple/swift/NativeReportedPurchaseState.swift +59 -0
  401. package/nitrogen/generated/apple/swift/NativeReportedTransaction.swift +56 -0
  402. package/nitrogen/generated/apple/swift/NativeStore.swift +64 -0
  403. package/nitrogen/generated/apple/swift/NativeStorePlatform.swift +54 -0
  404. package/nitrogen/generated/apple/swift/NativeStorefront.swift +35 -0
  405. package/nitrogen/generated/apple/swift/NativeSubscriptionInfo.swift +70 -0
  406. package/nitrogen/generated/apple/swift/NativeSubscriptionReplacement.swift +35 -0
  407. package/nitrogen/generated/apple/swift/NativeSubscriptionReplacementMode.swift +69 -0
  408. package/nitrogen/generated/apple/swift/NativeTransaction.swift +112 -0
  409. package/nitrogen/generated/apple/swift/NativeTransactionOffer.swift +42 -0
  410. package/nitrogen/generated/apple/swift/NativeTransactionOfferKind.swift +74 -0
  411. package/nitrogen/generated/apple/swift/NativeTransactionUpdate.swift +35 -0
  412. package/nitrogen/generated/apple/swift/NativeWriteStatus.swift +59 -0
  413. package/nitrogen/generated/apple/swift/Promise_Promise_swift__String_.swift +100 -0
  414. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeFeatureFlagsResult.swift +102 -0
  415. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeFlushStatus.swift +102 -0
  416. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeIdentifyResult.swift +102 -0
  417. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeIdentityChange.swift +102 -0
  418. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeInAppMessageResult.swift +102 -0
  419. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePersonState.swift +102 -0
  420. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePersonWriteResult.swift +102 -0
  421. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativePurchaseResult.swift +102 -0
  422. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__NativeRefundRequestStatus.swift +102 -0
  423. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_.swift +102 -0
  424. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_.swift +102 -0
  425. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_.swift +102 -0
  426. package/nitrogen/generated/apple/swift/Promise___NitroVoidhash__SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_.swift +102 -0
  427. package/nitrogen/generated/apple/swift/Promise_bool.swift +100 -0
  428. package/nitrogen/generated/apple/swift/Promise_swift__String.swift +102 -0
  429. package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
  430. package/nitrogen/generated/apple/swift/Record_swift__String_bool.swift +48 -0
  431. package/nitrogen/generated/apple/swift/Record_swift__String_swift__String.swift +48 -0
  432. package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeAppStoreSubscriptionStatus_.swift +21 -0
  433. package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeProduct_.swift +21 -0
  434. package/nitrogen/generated/apple/swift/SwiftContainer_swift__Array___NitroVoidhash__NativeTransaction_.swift +21 -0
  435. package/nitrogen/generated/apple/swift/SwiftContainer_swift__Optional___NitroVoidhash__NativeStorefront_.swift +21 -0
  436. package/nitrogen/generated/hybrid-classes.json +19 -0
  437. package/nitrogen/generated/shared/c++/NitroVoidhashCxxModule.cpp +2 -0
  438. package/nitrogen/generated/shared/c++/include/NitroVoidhash/NitroVoidhashCxxModule.hpp +2 -0
  439. package/nitrogen/generated/shared/javascript/VoidhashNativeClient.cjs +19 -0
  440. package/nitrogen/generated/shared/javascript/VoidhashNativeClient.d.cts +9 -0
  441. package/package.json +103 -3
  442. package/src/specs/VoidhashNativeClient.nitro.ts +1162 -0
@@ -0,0 +1,2866 @@
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 SHA-256 hash of the package's bytes, as hex; verify the download against it.
986
+ */
987
+ readonly sha256: string;
988
+ /**
989
+ * Where to download the package; its content never changes, so cache it by `sha256`.
990
+ */
991
+ readonly url: string;
992
+ /**
993
+ * 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.
994
+ */
995
+ readonly runtime: {
996
+ /**
997
+ * 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.
998
+ */
999
+ readonly version: string;
1000
+ /**
1001
+ * The SHA-256 hash of the runtime module's bytes, as hex; verify the download against it.
1002
+ */
1003
+ readonly sha256: string;
1004
+ /**
1005
+ * Where to download the runtime module; its content never changes, so cache it by `sha256`.
1006
+ */
1007
+ readonly url: string;
1008
+ /**
1009
+ * 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.
1010
+ */
1011
+ readonly signature: string;
1012
+ } | null;
1013
+ };
1014
+ /**
1015
+ * When the release was published, as an ISO 8601 timestamp; null when it was not.
1016
+ */
1017
+ readonly publishedAt: string | null;
1018
+ /**
1019
+ * The release's id.
1020
+ */
1021
+ readonly releaseId: string;
1022
+ /**
1023
+ * The release's version number within its paywall.
1024
+ */
1025
+ readonly version: number | "Infinity" | "-Infinity" | "NaN";
1026
+ } | null;
1027
+ /**
1028
+ * The id of the paywall release shown.
1029
+ */
1030
+ readonly paywallReleaseId: string | null;
1031
+ /**
1032
+ * When the location started showing it, as an ISO 8601 timestamp.
1033
+ */
1034
+ readonly startedAt: string;
1035
+ /**
1036
+ * How the showing was chosen: always `paywall_release`, also when an experiment picked the release.
1037
+ */
1038
+ readonly type: SdkResolvedPaywallShowingJsonEncodingType;
1039
+ /**
1040
+ * 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.
1041
+ */
1042
+ readonly exposureToken?: string | null | undefined;
1043
+ }
1044
+ interface SdkResolvedPaywallJsonEncoding {
1045
+ /**
1046
+ * The location the paywall is shown at.
1047
+ */
1048
+ readonly location: {
1049
+ /**
1050
+ * The location's id.
1051
+ */
1052
+ readonly id: string;
1053
+ readonly interfaceRevision: number | SdkResolvedPaywallJsonEncodingLocationInterfaceRevisionEnum;
1054
+ /**
1055
+ * The location's display name.
1056
+ */
1057
+ readonly name: string;
1058
+ /**
1059
+ * The location's slug, which the app shows paywalls by.
1060
+ */
1061
+ readonly slug: string;
1062
+ };
1063
+ readonly showing: SdkResolvedPaywallShowingJsonEncoding;
1064
+ /**
1065
+ * 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.
1066
+ */
1067
+ readonly withdrawnPackages?: ReadonlyArray<string> | null | undefined;
1068
+ }
1069
+
1070
+ /** One evaluated flag. Plain JSON values, as the Voidhash API answers them. */
1071
+ interface SdkFeatureFlag {
1072
+ readonly enabled: boolean;
1073
+ readonly key: string;
1074
+ /** The selected variant's payload; untyped JSON, `null` when there is none. */
1075
+ readonly payload: unknown;
1076
+ /** The selected variant's key, `null` for a flag without variants. */
1077
+ readonly variantKey: string | null;
1078
+ }
1079
+ interface FeatureFlagsResult {
1080
+ /** Each flag's enabled state, variant key (`null` without a variant) and payload. */
1081
+ readonly flags: ReadonlyArray<SdkFeatureFlag>;
1082
+ /**
1083
+ * The evaluation was served from cache past its refresh window, or no
1084
+ * evaluation has ever succeeded. Flags are still safe to act on — they are
1085
+ * simply not guaranteed to reflect the latest dashboard state.
1086
+ */
1087
+ readonly isStale?: boolean;
1088
+ }
1089
+ /**
1090
+ * Developer-facing person attributes. `email` and `name` are reserved keys
1091
+ * mapped to the dedicated server fields; any other key is a custom trait,
1092
+ * whose value must be a string, a number, a boolean or `null`.
1093
+ */
1094
+ interface PersonAttributes {
1095
+ email?: string;
1096
+ name?: string;
1097
+ [k: string]: unknown;
1098
+ }
1099
+ /** A group property's value: text, a number or a boolean. */
1100
+ type GroupPropertyValue = string | number | boolean;
1101
+ /** A group's properties, such as a company's `name`, `plan` or `seats`. */
1102
+ type GroupProperties = Readonly<Record<string, GroupPropertyValue>>;
1103
+ /** A group for `setGroups()`: its id, and any properties of the group beside it. */
1104
+ type Group = {
1105
+ readonly id: string | number;
1106
+ } & GroupProperties;
1107
+ /**
1108
+ * The groups `setGroups()` puts the end user in, by group type: each an id or
1109
+ * a {@link Group}. A type that is `null` or `undefined` is not in the set.
1110
+ */
1111
+ type Groups = Readonly<Record<string, Group | string | number | null | undefined>>;
1112
+ /**
1113
+ * What the server assigns to a location, passed through untouched: the
1114
+ * showing and its release with the flow package, or `null` when nothing is
1115
+ * assigned.
1116
+ */
1117
+ type ResolvedPaywall = SdkResolvedPaywallJsonEncoding | null;
1118
+
1119
+ /**
1120
+ * Stable, machine-matchable error codes surfaced on every {@link VoidhashError}
1121
+ * via `error.code`. Match on these when recovery differs; report the full error
1122
+ * for everything else.
1123
+ */
1124
+ 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_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"];
1125
+ type VoidhashErrorCode = (typeof VOIDHASH_ERROR_CODES)[number];
1126
+ /**
1127
+ * Why a purchase failed, when the store said:
1128
+ *
1129
+ * - `paymentDeclined`: Google Play only. The payment method was declined,
1130
+ * such as for insufficient funds; StoreKit reports no declined payment.
1131
+ * - `ineligibleForOffer`: the store account cannot get the offer, such as a
1132
+ * free trial it already used on Google Play, or a promotional or win-back
1133
+ * offer the App Store refuses it. Nothing was bought; the products reload
1134
+ * without it, and buying again charges the regular price.
1135
+ */
1136
+ type VoidhashErrorReason = "paymentDeclined" | "ineligibleForOffer";
1137
+ declare class VoidhashError extends Error {
1138
+ readonly code: VoidhashErrorCode;
1139
+ /** Why it failed, when the store said; see {@link VoidhashErrorReason}. */
1140
+ readonly reason?: VoidhashErrorReason;
1141
+ constructor(code: VoidhashErrorCode, message?: string, options?: {
1142
+ cause?: unknown;
1143
+ reason?: VoidhashErrorReason;
1144
+ });
1145
+ }
1146
+
1147
+ /**
1148
+ * What an app lets its flows do, granted at SDK setup. Purchases, restores,
1149
+ * closing and analytics need no grant; an action needing a capability the
1150
+ * app did not grant is dropped with a warning.
1151
+ *
1152
+ * - `notifications`: ask the user to allow notifications.
1153
+ * - `tracking`: ask the user to allow tracking (App Tracking Transparency on iOS).
1154
+ * - `attributes`: set attributes on the current person.
1155
+ * - `links`: open links outside the app.
1156
+ */
1157
+ type FlowCapability = "notifications" | "tracking" | "attributes" | "links";
1158
+ /**
1159
+ * Which flow runtime draws flows, for the whole app process.
1160
+ *
1161
+ * - `linked`: the runtime built into the SDK (the default).
1162
+ * - `module`: the flow runtime module each flow names, which the SDK
1163
+ * downloads once, verifies and caches, so flows can use flow editor
1164
+ * features newer than the SDK. Not yet recommended for production.
1165
+ */
1166
+ type FlowRuntime = "linked" | "module";
1167
+ /**
1168
+ * What a paywall shows while it waits for the network: `standard` (the default),
1169
+ * the native SDK's loading screen 0.4 seconds after `presentFlow`, which the end
1170
+ * user can close; `none`, the app's screen as it is until the paywall is shown.
1171
+ */
1172
+ type FlowLoading = "standard" | "none";
1173
+ /** Capabilities granted when `flowCapabilities` is not set. */
1174
+ declare const DEFAULT_FLOW_CAPABILITIES: ReadonlyArray<FlowCapability>;
1175
+ /** Codes of the errors a failed flow presentation carries. */
1176
+ type FlowErrorCode = Extract<VoidhashErrorCode, `FLOW_${string}`>;
1177
+ /**
1178
+ * How a presented flow ended.
1179
+ *
1180
+ * - `outcome`: `purchased` when a purchase ended the flow, `restored` when a
1181
+ * restore did, `dismissed` when the user or the app closed it or another
1182
+ * flow replaced it; otherwise the outcome the flow finished with.
1183
+ * - `output`: the flow's outputs by name; empty when it declares none.
1184
+ * - `productId`: the store product bought, when the outcome is `purchased`.
1185
+ *
1186
+ * A flow that could not be presented is not a result: `presentFlow()` rejects.
1187
+ */
1188
+ interface FlowResult<L extends string = string> {
1189
+ readonly outcome: FlowOutcome<L>;
1190
+ readonly output: FlowOutput<L>;
1191
+ readonly productId?: string;
1192
+ /**
1193
+ * `false` when the presentation ended before the paywall reached the screen,
1194
+ * with the outcome `dismissed`: the end user closed the loading screen, or the
1195
+ * app dismissed it or presented another paywall while it loaded. Absent from
1196
+ * native SDKs that do not report it; read absent as `true`.
1197
+ */
1198
+ readonly wasShown?: boolean;
1199
+ }
1200
+ type RequiredWhenNotEmpty<Key extends string, Value> = Record<never, never> extends Value ? {
1201
+ readonly [K in Key]?: Value;
1202
+ } : {
1203
+ readonly [K in Key]: Value;
1204
+ };
1205
+ /**
1206
+ * What an app passes to one presentation of the flow at location `L`.
1207
+ *
1208
+ * - `input`: the flow's inputs by name.
1209
+ * - `actions`: a handler per app action the flow can call.
1210
+ * - `revision`: the interface revision the app was built against. Leave it
1211
+ * out to use the one set for the location in the `flowRevisions` option.
1212
+ */
1213
+ type PresentFlowOptions<L extends string = string> = {
1214
+ readonly revision?: number;
1215
+ } & RequiredWhenNotEmpty<"input", FlowInput<L>> & RequiredWhenNotEmpty<"actions", FlowActions<L>>;
1216
+ /**
1217
+ * The arguments of a presentation after its location: the options are
1218
+ * required when the location's flow has required inputs or app actions.
1219
+ */
1220
+ type PresentFlowArguments<L extends string = string> = Record<never, never> extends PresentFlowOptions<L> ? [options?: PresentFlowOptions<L>] : [options: PresentFlowOptions<L>];
1221
+
1222
+ /**
1223
+ * Product durations the server sends today. Decoded definitions accept any
1224
+ * string in their `duration` fields, so a duration added by a newer server
1225
+ * keeps its product readable; code that relies on the duration treats a
1226
+ * value outside this list as no duration.
1227
+ */
1228
+ declare const RuntimeProductDuration: Schema.Literals<readonly ["weekly", "monthly", "quarterly", "semi-annual", "annual"]>;
1229
+ type RuntimeProductDuration = typeof RuntimeProductDuration.Type;
1230
+ /**
1231
+ * An offer of a product on one store: `id` is how paywalls and apps name it
1232
+ * (the same on every store), `offerId` the store's identifier.
1233
+ */
1234
+ declare const RuntimeStoreOffer: Schema.Struct<{
1235
+ readonly id: Schema.String;
1236
+ readonly offerId: Schema.String;
1237
+ }>;
1238
+ type RuntimeStoreOffer = typeof RuntimeStoreOffer.Type;
1239
+ declare const RuntimeAppleAppStoreProductConfiguration: Schema.Struct<{
1240
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1241
+ readonly id: Schema.String;
1242
+ readonly offerId: Schema.String;
1243
+ }>>>;
1244
+ readonly productId: Schema.String;
1245
+ }>;
1246
+ type RuntimeAppleAppStoreProductConfiguration = typeof RuntimeAppleAppStoreProductConfiguration.Type;
1247
+ declare const RuntimeGooglePlayProductConfiguration: Schema.Struct<{
1248
+ readonly basePlanId: Schema.optional<Schema.String>;
1249
+ /** Developer offers on the base plan. */
1250
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1251
+ readonly id: Schema.String;
1252
+ readonly offerId: Schema.String;
1253
+ }>>>;
1254
+ readonly productId: Schema.String;
1255
+ }>;
1256
+ type RuntimeGooglePlayProductConfiguration = typeof RuntimeGooglePlayProductConfiguration.Type;
1257
+ /**
1258
+ * Development-mode pricing. `currencyCode` and `period` are plain strings so
1259
+ * a currency or period added by a newer server keeps the product readable.
1260
+ */
1261
+ declare const RuntimeDevelopmentProductConfiguration: Schema.Struct<{
1262
+ readonly currencyCode: Schema.String;
1263
+ readonly duration: Schema.OptionFromNullOr<Schema.String>;
1264
+ readonly period: Schema.String;
1265
+ readonly periodCount: Schema.Number;
1266
+ readonly price: Schema.Number;
1267
+ readonly priceInMinorUnits: Schema.Number;
1268
+ readonly productId: Schema.String;
1269
+ readonly warning: Schema.OptionFromNullOr<Schema.String>;
1270
+ }>;
1271
+ type RuntimeDevelopmentProductConfiguration = typeof RuntimeDevelopmentProductConfiguration.Type;
1272
+ declare const RuntimeProductProviders: Schema.Struct<{
1273
+ readonly appleAppStore: Schema.optional<Schema.Struct<{
1274
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1275
+ readonly id: Schema.String;
1276
+ readonly offerId: Schema.String;
1277
+ }>>>;
1278
+ readonly productId: Schema.String;
1279
+ }>>;
1280
+ readonly development: Schema.optional<Schema.Struct<{
1281
+ readonly currencyCode: Schema.String;
1282
+ readonly duration: Schema.OptionFromNullOr<Schema.String>;
1283
+ readonly period: Schema.String;
1284
+ readonly periodCount: Schema.Number;
1285
+ readonly price: Schema.Number;
1286
+ readonly priceInMinorUnits: Schema.Number;
1287
+ readonly productId: Schema.String;
1288
+ readonly warning: Schema.OptionFromNullOr<Schema.String>;
1289
+ }>>;
1290
+ readonly googlePlay: Schema.optional<Schema.Struct<{
1291
+ readonly basePlanId: Schema.optional<Schema.String>;
1292
+ /** Developer offers on the base plan. */
1293
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1294
+ readonly id: Schema.String;
1295
+ readonly offerId: Schema.String;
1296
+ }>>>;
1297
+ readonly productId: Schema.String;
1298
+ }>>;
1299
+ }>;
1300
+ type RuntimeProductProviders = typeof RuntimeProductProviders.Type;
1301
+ /**
1302
+ * One product. `type` is a plain string (the server sends `subscription`,
1303
+ * `one-time` or `one-time-consumable` today) so a product type added by a
1304
+ * newer server keeps the product readable: only `one-time-consumable` is
1305
+ * ever consumed, anything else is finished as a non-consumable.
1306
+ */
1307
+ declare const RuntimeProductDefinition: Schema.Struct<{
1308
+ readonly configuration: Schema.Struct<{
1309
+ readonly perks: Schema.$Record<Schema.String, Schema.Literal<true>>;
1310
+ readonly providers: Schema.Struct<{
1311
+ readonly appleAppStore: Schema.optional<Schema.Struct<{
1312
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1313
+ readonly id: Schema.String;
1314
+ readonly offerId: Schema.String;
1315
+ }>>>;
1316
+ readonly productId: Schema.String;
1317
+ }>>;
1318
+ readonly development: Schema.optional<Schema.Struct<{
1319
+ readonly currencyCode: Schema.String;
1320
+ readonly duration: Schema.OptionFromNullOr<Schema.String>;
1321
+ readonly period: Schema.String;
1322
+ readonly periodCount: Schema.Number;
1323
+ readonly price: Schema.Number;
1324
+ readonly priceInMinorUnits: Schema.Number;
1325
+ readonly productId: Schema.String;
1326
+ readonly warning: Schema.OptionFromNullOr<Schema.String>;
1327
+ }>>;
1328
+ readonly googlePlay: Schema.optional<Schema.Struct<{
1329
+ readonly basePlanId: Schema.optional<Schema.String>;
1330
+ /** Developer offers on the base plan. */
1331
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1332
+ readonly id: Schema.String;
1333
+ readonly offerId: Schema.String;
1334
+ }>>>;
1335
+ readonly productId: Schema.String;
1336
+ }>>;
1337
+ }>;
1338
+ }>;
1339
+ readonly duration: Schema.optional<Schema.OptionFromNullOr<Schema.String>>;
1340
+ readonly id: Schema.optional<Schema.String>;
1341
+ readonly properties: Schema.Struct<{
1342
+ readonly name: Schema.String;
1343
+ }>;
1344
+ readonly slug: Schema.String;
1345
+ readonly type: Schema.String;
1346
+ }>;
1347
+ type RuntimeProductDefinition = typeof RuntimeProductDefinition.Type;
1348
+ declare const RuntimePaywallLocationDefinition: Schema.Struct<{
1349
+ readonly description: Schema.withDecodingDefaultTypeKey<Schema.OptionFromNullOr<Schema.String>, never>;
1350
+ readonly name: Schema.String;
1351
+ readonly slug: Schema.String;
1352
+ }>;
1353
+ type RuntimePaywallLocationDefinition = typeof RuntimePaywallLocationDefinition.Type;
1354
+ declare const RuntimePerkDefinition: Schema.Struct<{
1355
+ readonly name: Schema.String;
1356
+ readonly slug: Schema.String;
1357
+ }>;
1358
+ type RuntimePerkDefinition = typeof RuntimePerkDefinition.Type;
1359
+ /**
1360
+ * The full schema fetched from the server, decoded so nullable wire fields
1361
+ * are represented as `Option` inside the SDK.
1362
+ */
1363
+ declare const RuntimeSchemaValue: Schema.Struct<{
1364
+ readonly locations: Schema.$Record<Schema.String, Schema.Struct<{
1365
+ readonly description: Schema.withDecodingDefaultTypeKey<Schema.OptionFromNullOr<Schema.String>, never>;
1366
+ readonly name: Schema.String;
1367
+ readonly slug: Schema.String;
1368
+ }>>;
1369
+ readonly perks: Schema.$Record<Schema.String, Schema.Struct<{
1370
+ readonly name: Schema.String;
1371
+ readonly slug: Schema.String;
1372
+ }>>;
1373
+ readonly products: Schema.$Record<Schema.String, Schema.Struct<{
1374
+ readonly configuration: Schema.Struct<{
1375
+ readonly perks: Schema.$Record<Schema.String, Schema.Literal<true>>;
1376
+ readonly providers: Schema.Struct<{
1377
+ readonly appleAppStore: Schema.optional<Schema.Struct<{
1378
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1379
+ readonly id: Schema.String;
1380
+ readonly offerId: Schema.String;
1381
+ }>>>;
1382
+ readonly productId: Schema.String;
1383
+ }>>;
1384
+ readonly development: Schema.optional<Schema.Struct<{
1385
+ readonly currencyCode: Schema.String;
1386
+ readonly duration: Schema.OptionFromNullOr<Schema.String>;
1387
+ readonly period: Schema.String;
1388
+ readonly periodCount: Schema.Number;
1389
+ readonly price: Schema.Number;
1390
+ readonly priceInMinorUnits: Schema.Number;
1391
+ readonly productId: Schema.String;
1392
+ readonly warning: Schema.OptionFromNullOr<Schema.String>;
1393
+ }>>;
1394
+ readonly googlePlay: Schema.optional<Schema.Struct<{
1395
+ readonly basePlanId: Schema.optional<Schema.String>;
1396
+ /** Developer offers on the base plan. */
1397
+ readonly offers: Schema.optional<Schema.$Array<Schema.Struct<{
1398
+ readonly id: Schema.String;
1399
+ readonly offerId: Schema.String;
1400
+ }>>>;
1401
+ readonly productId: Schema.String;
1402
+ }>>;
1403
+ }>;
1404
+ }>;
1405
+ readonly duration: Schema.optional<Schema.OptionFromNullOr<Schema.String>>;
1406
+ readonly id: Schema.optional<Schema.String>;
1407
+ readonly properties: Schema.Struct<{
1408
+ readonly name: Schema.String;
1409
+ }>;
1410
+ readonly slug: Schema.String;
1411
+ readonly type: Schema.String;
1412
+ }>>;
1413
+ readonly version: Schema.String;
1414
+ }>;
1415
+ type RuntimeSchemaValue = typeof RuntimeSchemaValue.Type;
1416
+ type RuntimeSchema = RuntimeSchemaValue;
1417
+ type RuntimeSchemaEncoded = typeof RuntimeSchemaValue.Encoded;
1418
+ declare const createEmptyRuntimeSchema: () => RuntimeSchema;
1419
+
1420
+ /** Integration that observed a screen transition. */
1421
+ type ScreenSource = "expo-router" | "react-navigation" | "nitro-ui-navigation" | "uikit" | "swiftui" | "android-activity" | "android-fragment" | "compose-navigation" | "manual";
1422
+ /** One screen the user arrived on, as reported by an integration. */
1423
+ interface ScreenView {
1424
+ /**
1425
+ * Router-owned token identifying this screen instance (route key, pathname,
1426
+ * controller instance). Two views with the same identity are the same screen
1427
+ * and only the first one emits.
1428
+ */
1429
+ identity: string;
1430
+ /** Stable, low-cardinality screen identity. Never contains ids. */
1431
+ name: string;
1432
+ /** Concrete location, with dynamic segment values filled in. */
1433
+ path: string;
1434
+ /** Human title when the platform exposes one. */
1435
+ title?: string;
1436
+ /** Route params. Only forwarded when `includeParams` is on. */
1437
+ params?: Record<string, unknown>;
1438
+ source: ScreenSource;
1439
+ }
1440
+
1441
+ /**
1442
+ * Whether the end user agreed to usage analytics. `denied` and `pending` act
1443
+ * the same: nothing analytics-related is captured, stored or sent. Purchases,
1444
+ * restores, entitlements, identity, flags and paywalls are unaffected.
1445
+ */
1446
+ type AnalyticsConsent = "granted" | "denied" | "pending";
1447
+ /** What happens to analytics captured while consent is `"pending"`. */
1448
+ type AnalyticsWhilePending = "drop" | "buffer";
1449
+
1450
+ /**
1451
+ * The native flow module as earlier releases drove it from JavaScript.
1452
+ * @deprecated No longer used: the native client presents flows itself. Kept
1453
+ * so code that imports the type still compiles; removed in a future release.
1454
+ */
1455
+ interface VoidhashFlowsPort {
1456
+ readonly isRendererAvailable: boolean;
1457
+ engineCapabilities?(): string;
1458
+ 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>;
1459
+ preload(requestJson: string): Promise<void>;
1460
+ dismiss(): Promise<void>;
1461
+ }
1462
+ /**
1463
+ * A reachability source as the `connectivity` option took it: a subscribe
1464
+ * function returning an unsubscribe callback.
1465
+ */
1466
+ interface ConnectivityPort {
1467
+ readonly subscribe: (listener: (online: boolean) => void) => () => void;
1468
+ }
1469
+ /** Controls the built-in `$screen` event. */
1470
+ interface ScreenTrackingOptions {
1471
+ /** Default `true`. `false` makes every integration and `screen()` a no-op. */
1472
+ enabled?: boolean;
1473
+ /** Default `false`. Adds `$screen_params` (route params, string-coerced, max 20 keys). */
1474
+ includeParams?: boolean;
1475
+ /**
1476
+ * Rewrites or drops a screen before capture. Return `null` to skip it. A
1477
+ * throw, or a result whose `identity`, `name` or `path` is not a string,
1478
+ * tracks the screen unmapped and is reported as `HOST_CALLBACK_FAILED`.
1479
+ */
1480
+ mapScreen?: (view: ScreenView) => ScreenView | null;
1481
+ }
1482
+ /** How feature flag reads behave before Voidhash has answered them. */
1483
+ interface FeatureFlagsOptions {
1484
+ /**
1485
+ * What a flag reads as while it has no evaluated value: before its first
1486
+ * evaluation arrives, and when Voidhash cannot be reached and nothing is
1487
+ * cached. `useFeatureFlags().isEnabled()` answers it, on a disabled client
1488
+ * too, and `getFeatureFlags()` answers each requested key that has one as
1489
+ * a flag without a variant. Flags without a default read as `false`. Use
1490
+ * `true` for a flag whose feature must stay on when Voidhash is unreachable.
1491
+ */
1492
+ readonly defaults?: Readonly<Record<string, boolean>>;
1493
+ /**
1494
+ * How long a flag read with nothing cached waits for Voidhash before it
1495
+ * answers with no flags, in milliseconds (default 2000). The evaluation
1496
+ * carries on in the background, and the hooks update when it lands. A
1497
+ * cached value never waits more than 500 ms. A request gives up after 10
1498
+ * seconds, so a longer wait ends there.
1499
+ */
1500
+ readonly maxWaitMs?: number;
1501
+ }
1502
+ interface VoidhashClientOptions {
1503
+ /**
1504
+ * The end user's consent to usage analytics (default `"granted"`). While it
1505
+ * is `"denied"` or `"pending"` the SDK captures, stores and sends no
1506
+ * analytics: no custom events, screens, lifecycle or install events or
1507
+ * paywall impressions. What the app says about the end user is not
1508
+ * analytics: `identify()`, person attributes and groups are sent whatever
1509
+ * the consent, and purchases, restores, entitlements, feature flags and
1510
+ * paywalls work as usual.
1511
+ * A consent set later with `client.setAnalyticsConsent()` is stored on the
1512
+ * device and takes precedence over this option on the next launch.
1513
+ */
1514
+ analyticsConsent?: AnalyticsConsent;
1515
+ /**
1516
+ * What happens to analytics captured while consent is `"pending"` (default
1517
+ * `"drop"`). `"buffer"` holds up to 100 events in memory, with the time
1518
+ * each happened, and records them once consent is granted; a denial
1519
+ * discards them. Nothing is sent or stored while they are held. Person
1520
+ * attributes and groups are never held: they are sent whatever the consent.
1521
+ */
1522
+ analyticsWhilePending?: AnalyticsWhilePending;
1523
+ /**
1524
+ * `true` makes `identify()` grant a `"pending"` consent, for apps whose
1525
+ * sign-in accepts their terms (default `false`). A `"denied"` consent is
1526
+ * never overridden. `signOut()` and `reset()` send what was recorded and
1527
+ * return that consent to `"pending"`; a consent set with
1528
+ * `setAnalyticsConsent()` is the app's own decision and stays.
1529
+ */
1530
+ grantConsentOnIdentify?: boolean;
1531
+ /**
1532
+ * Captures `$app_installed`, `$app_updated`, `$app_opened`,
1533
+ * `$app_backgrounded`, `$app_became_active`, `$app_crashed` and `$sign_out`
1534
+ * automatically (default `true`). Turn it off when the app reports these
1535
+ * events itself.
1536
+ */
1537
+ automaticLifecycleEvents?: boolean;
1538
+ baseUrl?: string;
1539
+ debug?: boolean;
1540
+ /** Enables isolated test purchases in debug builds. Release builds always ignore this option. */
1541
+ dev?: boolean;
1542
+ distinctId?: string;
1543
+ /**
1544
+ * Reads which ad brought this install and records it on the person as a
1545
+ * touch (default `true`): Apple Ads on iOS, the Google Play install referrer
1546
+ * and, with `metaAppId`, Meta's apps on Android. Runs once per install, in
1547
+ * the background, only with analytics consent. An install that predates this
1548
+ * option is not read.
1549
+ */
1550
+ installAttribution?: boolean;
1551
+ /**
1552
+ * The app's Meta (Facebook) app id. On Android, `installAttribution` then also
1553
+ * asks the Facebook, Instagram and Facebook Lite apps on the device for the ad
1554
+ * behind the install, which is preferred over the Play referrer. iOS ignores it.
1555
+ */
1556
+ metaAppId?: string;
1557
+ /**
1558
+ * When StoreKit shows its own messages, such as a price increase to agree
1559
+ * to or a billing issue (default `"deferWhileFlowPresented"`): at once
1560
+ * (`"automatic"`), or held while a Voidhash flow is on screen and shown once
1561
+ * it closes. Google Play ignores it.
1562
+ */
1563
+ appStoreMessages?: "automatic" | "deferWhileFlowPresented";
1564
+ /**
1565
+ * What happens to a purchase the end user starts on the App Store, such as
1566
+ * a promoted in-app purchase or a win-back offer (default
1567
+ * `"purchaseWhenReady"`). `"purchaseWhenReady"` buys it once `init()` has
1568
+ * finished, never before. `"manual"` hands it to the listeners of
1569
+ * `client.appStore.addPurchaseIntentListener()`, to complete with
1570
+ * `purchase()` when the app is ready; one that arrives before a listener
1571
+ * is added waits for the first. Google Play ignores it.
1572
+ */
1573
+ purchaseIntents?: "purchaseWhenReady" | "manual";
1574
+ /**
1575
+ * Ships the SDK fully disabled (default `true`). A disabled client never
1576
+ * connects to the native store, never talks to the network and never
1577
+ * registers listeners: `init()` and every side-effect method resolve as
1578
+ * no-ops, and reads answer with their empty shape. Intended for
1579
+ * feature-flagged rollouts, where mounting the provider unconditionally
1580
+ * avoids hook-order violations.
1581
+ *
1582
+ * Fixed at construction. Enabling the SDK later means creating a new client
1583
+ * — cheap, because a disabled client never builds its Effect runtime and so
1584
+ * holds no store connection, timers or listeners.
1585
+ */
1586
+ enabled?: boolean;
1587
+ /**
1588
+ * What flows may do in this app (default `["links"]`). Purchases, restores,
1589
+ * closing and analytics need no grant. `notifications` and `tracking` let a
1590
+ * flow ask for those system permissions, `attributes` lets it set person
1591
+ * attributes and `links` lets it open links outside the app. A flow action
1592
+ * needing a capability that is not granted is ignored.
1593
+ */
1594
+ flowCapabilities?: ReadonlyArray<FlowCapability>;
1595
+ /**
1596
+ * Which flow runtime draws flows (default `linked`, the one built into the
1597
+ * SDK). `module` draws them with the flow runtime module each flow names,
1598
+ * downloaded once, verified and cached. It applies to the whole app process
1599
+ * from the first `init()`, on iOS and Android, and needs the native flow
1600
+ * renderer; `linked` leaves the renderer as native code set it.
1601
+ */
1602
+ flowRuntime?: FlowRuntime;
1603
+ /**
1604
+ * What a paywall shows while it waits for the network (default `standard`):
1605
+ * the native SDK's loading screen, shown 0.4 seconds after `presentFlow` until
1606
+ * the paywall takes its place, which the end user can close (`presentFlow`
1607
+ * then resolves with the outcome `dismissed` and `wasShown: false`). `none`
1608
+ * keeps the app's screen as it is until the paywall is shown. A paywall
1609
+ * already on the device appears before then either way.
1610
+ */
1611
+ flowLoading?: FlowLoading;
1612
+ /** How feature flag reads behave before Voidhash has answered them; see {@link FeatureFlagsOptions}. */
1613
+ featureFlags?: FeatureFlagsOptions;
1614
+ ingestUrl?: string;
1615
+ /**
1616
+ * @deprecated No longer needed: the SDK observes reachability and the app
1617
+ * lifecycle natively and recovers on its own when the device comes back
1618
+ * online or to the foreground. Still accepted, and ignored.
1619
+ */
1620
+ connectivity?: ConnectivityPort;
1621
+ /**
1622
+ * Called for every non-fatal event the SDK handled itself — a request that
1623
+ * failed and will be retried, an event evicted from a full queue, a rejected
1624
+ * publishable key. Purely informational; exceptions thrown here are
1625
+ * swallowed. Prefer this over `unstable_swallowErrors`.
1626
+ */
1627
+ onDiagnostic?: VoidhashDiagnosticHandler;
1628
+ /**
1629
+ * Locations whose flows are downloaded at boot, so their first
1630
+ * `presentFlow()` shows without a round trip. Locations the device has
1631
+ * presented before are preloaded anyway. Nothing is preloaded when the app
1632
+ * does not include the flow renderer.
1633
+ */
1634
+ preloadLocations?: string[];
1635
+ /**
1636
+ * The interface revision the app was built against, by location slug. Pass
1637
+ * the `flowRevisions` constant of the generated declarations: a location's
1638
+ * revision is then used to preload its flow and by every `presentFlow()`
1639
+ * that names none. A location that is not listed counts as revision 0.
1640
+ */
1641
+ flowRevisions?: Readonly<Record<string, number>>;
1642
+ /**
1643
+ * Starts the SDK in observer mode: transactions are reported to Voidhash but
1644
+ * never finished/acknowledged with the store, and purchases are blocked, so
1645
+ * another billing integration can own them. Off by default. Can be flipped
1646
+ * later with `client.setReadOnly()`.
1647
+ */
1648
+ readOnly?: boolean;
1649
+ scheme?: string;
1650
+ /**
1651
+ * Automatic screen tracking (`$screen`). On by default; the Expo Router and
1652
+ * React Navigation integrations under `@voidhash/react-native/expo-router`
1653
+ * and `@voidhash/react-native/react-navigation` feed it, as does
1654
+ * `client.screen()`.
1655
+ */
1656
+ screenTracking?: ScreenTrackingOptions;
1657
+ /**
1658
+ * @deprecated Transport failures no longer surface as errors, so there is
1659
+ * nothing left for this to swallow. Use `onDiagnostic` to observe recovered
1660
+ * failures instead. Removed in a future release.
1661
+ */
1662
+ unstable_swallowErrors?: boolean;
1663
+ /**
1664
+ * Test/internal escape hatch — inject a known runtime schema instead of
1665
+ * letting the SDK fetch from the server on init. Not part of the public
1666
+ * API; production code should rely on the server-side schema endpoint.
1667
+ */
1668
+ unstable_internalSchema?: RuntimeSchema;
1669
+ /**
1670
+ * @deprecated No longer has an effect: the SDK always runs on its native client.
1671
+ * Still accepted; development builds log a one-time notice when it is set.
1672
+ */
1673
+ unstable_nativeEngine?: boolean;
1674
+ }
1675
+ /**
1676
+ * How a {@link VoidhashClient.purchase} call ended. Every failure is the
1677
+ * `Err` of the returned `Result`.
1678
+ *
1679
+ * - `purchased`: the store charged. `synced` is `true` once Voidhash
1680
+ * accepted the receipt; `false` while it waits on the device, sent again
1681
+ * at launch, in the foreground and when the device is back online, and
1682
+ * access arrives once it lands. Either way the purchase is done: do not
1683
+ * offer it again.
1684
+ * - `pending`: the store needs outside action first, such as Ask to Buy
1685
+ * approval or a pending payment. It completes later, as a transaction
1686
+ * update (`addTransactionListener()`), and access arrives with it.
1687
+ * - `cancelled`: the end user dismissed the store sheet.
1688
+ * - `disabled`: the client was created with `enabled: false`; nothing was bought.
1689
+ */
1690
+ type PurchaseResult = {
1691
+ readonly status: "purchased";
1692
+ readonly transaction: Transaction;
1693
+ readonly synced: boolean;
1694
+ } | {
1695
+ readonly status: "pending";
1696
+ } | {
1697
+ readonly status: "cancelled";
1698
+ } | {
1699
+ readonly status: "disabled";
1700
+ };
1701
+ /**
1702
+ * Which offer a purchase buys:
1703
+ *
1704
+ * - `"automatic"` (default): a subscription's `introOffer` when the end user
1705
+ * is eligible for one, otherwise the regular price.
1706
+ * - `"none"`: the regular price. The App Store may still apply an
1707
+ * introductory offer the end user is eligible for.
1708
+ * - an `Offer` from `product.offers` or `product.subscription.introOffer`.
1709
+ * - an offer's `id`, looked up in the same offers.
1710
+ *
1711
+ * An offer that cannot be bought fails the purchase with `OFFER_UNAVAILABLE`;
1712
+ * the product is never bought at its regular price instead.
1713
+ */
1714
+ type OfferSelection = "automatic" | "none" | Offer | (string & Record<never, never>);
1715
+ /** What a {@link VoidhashClient.purchase} call may ask for beyond the product. */
1716
+ interface PurchaseOptions {
1717
+ /** The offer to buy; see {@link OfferSelection}. Default `"automatic"`. */
1718
+ readonly offer?: OfferSelection;
1719
+ /**
1720
+ * How many to buy, default 1. Only App Store consumables can be bought
1721
+ * several at once; on Google Play the end user picks the quantity in the
1722
+ * store's sheet. Anything but 1 elsewhere is an `INVALID_ARGUMENT` error.
1723
+ * The transaction reports the quantity the store charged.
1724
+ */
1725
+ readonly quantity?: number;
1726
+ /**
1727
+ * The subscription the user has now, which this purchase replaces: an
1728
+ * upgrade, a downgrade or a change of plan. Google Play only. Without it,
1729
+ * buying another subscription product there adds a second subscription
1730
+ * next to the first, and Google Play bills both.
1731
+ *
1732
+ * Nothing is bought when the replacement cannot be made. The purchase
1733
+ * fails with `REPLACED_SUBSCRIPTION_NOT_OWNED` when the signed-in Google
1734
+ * Play account does not own the named subscription, with
1735
+ * `INVALID_ARGUMENT` when either product is not a subscription, both are
1736
+ * the same product, or the option names no product or an unknown mode, and
1737
+ * with `SUBSCRIPTION_REPLACEMENT_REFUSED` when Google Play rejects the
1738
+ * replacement before its sheet opens.
1739
+ *
1740
+ * Ignored on iOS, where the App Store moves a subscriber between the
1741
+ * products of one subscription group by itself.
1742
+ */
1743
+ readonly replacing?: SubscriptionReplacement;
1744
+ /** App Store options; Google Play ignores them. */
1745
+ readonly appStore?: {
1746
+ /** Simulates Ask to Buy in the sandbox, so the purchase ends `pending`. */
1747
+ readonly simulatesAskToBuyInSandbox?: boolean;
1748
+ };
1749
+ /** Google Play options; the App Store ignores them. */
1750
+ readonly googlePlay?: {
1751
+ /** Tells Google Play the price was personalized for the end user (an EU disclosure). */
1752
+ readonly isOfferPersonalized?: boolean;
1753
+ /** Google Play's obfuscated profile id, for apps with several profiles per account. */
1754
+ readonly obfuscatedProfileId?: string;
1755
+ /**
1756
+ * Buys exactly this Google Play offer token, from
1757
+ * `product.googlePlay.subscriptionOffers` or `oneTimeOffers`, instead of
1758
+ * what `offer` selects.
1759
+ */
1760
+ readonly offerToken?: string;
1761
+ };
1762
+ }
1763
+ /** The storefront the end user buys from. */
1764
+ interface Storefront {
1765
+ /** ISO 3166-1 alpha-2 country code, such as `US`. */
1766
+ readonly countryCode: string;
1767
+ /** ISO 4217 currency code, when the store says. */
1768
+ readonly currencyCode?: string;
1769
+ }
1770
+ /** Outcome of an identity switch reported by {@link VoidhashClient.identifySync}. */
1771
+ type IdentifyResult = {
1772
+ /** The server confirmed the identity and returned the person. */
1773
+ status: "confirmed";
1774
+ person: Person;
1775
+ } | {
1776
+ /**
1777
+ * The server has not confirmed the switch yet (it was unreachable, or
1778
+ * the key was rejected). The device already runs under the new distinct
1779
+ * id, and the link from the previous identity is queued on the device
1780
+ * and delivered once the server can be reached.
1781
+ */
1782
+ status: "deferred";
1783
+ person: Person | null;
1784
+ } | {
1785
+ /** The client was created with `enabled: false`, so nothing was recorded. */
1786
+ status: "disabled";
1787
+ person: null;
1788
+ };
1789
+ /** Answer to an entitlement check for one perk. */
1790
+ interface HasPerkResult {
1791
+ /** The active grant behind `hasAccess`, when one exists. */
1792
+ grant?: EntitlementGrant;
1793
+ hasAccess: boolean;
1794
+ /**
1795
+ * The answer came from a cached snapshot that is past its refresh window,
1796
+ * either because a refresh is still running or because the server could not
1797
+ * be reached.
1798
+ */
1799
+ isStale: boolean;
1800
+ /**
1801
+ * The cached snapshot is past its two-day TTL. Access is still reported as
1802
+ * the snapshot recorded it; apps gating high-value content can decide to
1803
+ * treat this as untrusted.
1804
+ */
1805
+ isExpired: boolean;
1806
+ /**
1807
+ * Why the answer has the freshness it has.
1808
+ *
1809
+ * - `fresh`: confirmed by the server just now.
1810
+ * - `refresh-in-flight`: served from cache while a refresh is still running;
1811
+ * its result lands for the next read.
1812
+ * - `refresh-failed`: served from cache because the refresh could not
1813
+ * complete.
1814
+ * - `no-cache`: the SDK has never seen a snapshot for this identity, so
1815
+ * `hasAccess` is `false` for lack of evidence rather than because access
1816
+ * was denied.
1817
+ */
1818
+ reason: "fresh" | "refresh-in-flight" | "refresh-failed" | "no-cache";
1819
+ }
1820
+ /** Person snapshot together with how much to trust it. */
1821
+ interface CurrentPersonResult {
1822
+ /** The snapshot, or `null` before the SDK has ever seen one. */
1823
+ person: Person | null;
1824
+ /** Served from cache past its refresh window. */
1825
+ isStale: boolean;
1826
+ /** Served from cache past its TTL. */
1827
+ isExpired: boolean;
1828
+ /** Why the snapshot has the freshness it has; see {@link HasPerkResult.reason}. */
1829
+ reason: "fresh" | "refresh-in-flight" | "refresh-failed" | "no-cache";
1830
+ }
1831
+ /** Outcome of a synchronous person-attribute update. */
1832
+ type SetPersonAttributesResult = {
1833
+ /** The server accepted and returned the updated snapshot. */
1834
+ status: "confirmed";
1835
+ person: Person;
1836
+ } | {
1837
+ /** The server was unreachable; the update is queued and will be retried. */
1838
+ status: "deferred";
1839
+ person: Person | null;
1840
+ } | {
1841
+ /** The client was created with `enabled: false`, so nothing was recorded. */
1842
+ status: "disabled";
1843
+ person: null;
1844
+ } | {
1845
+ /**
1846
+ * Nothing was left to write: the only attribute was an agreement to ad
1847
+ * data sharing, which waits for analytics consent.
1848
+ */
1849
+ status: "skipped";
1850
+ person: null;
1851
+ };
1852
+ /** Outcome of an analytics flush. */
1853
+ interface FlushResult {
1854
+ /** Events the server accepted during this flush. */
1855
+ flushed: number;
1856
+ /** Events still queued, waiting for their next attempt. */
1857
+ pending: number;
1858
+ /** The failure that stopped the flush, when one did. */
1859
+ lastError?: VoidhashError;
1860
+ }
1861
+ /**
1862
+ * App Store actions, on `client.appStore`. On any other platform each one
1863
+ * answers `UNSUPPORTED_PLATFORM`. While the client is disabled the reads
1864
+ * answer empty and `beginRefundRequest()` and `appTransaction()`, which have
1865
+ * no empty answer, `VOIDHASH_CLIENT_NOT_INITIALIZED`.
1866
+ */
1867
+ interface AppStoreActions {
1868
+ /**
1869
+ * Shows Apple's refund request sheet for a transaction, by its App Store
1870
+ * transaction id (`transaction.id`). `success` means Apple received the
1871
+ * request, not that it refunded anything: a refund arrives later and
1872
+ * reaches the person's subscriptions and entitlements.
1873
+ */
1874
+ readonly beginRefundRequest: (transactionId: string) => Promise<Result<RefundRequestStatus, VoidhashError>>;
1875
+ /**
1876
+ * Every status the Apple account has in an App Store subscription group
1877
+ * (`subscription.groupId`), as StoreKit reports them on this device: state,
1878
+ * latest transaction and renewal info. The current person's comes first (the
1879
+ * one bought for them), then the account's others, ones shared through
1880
+ * Family Sharing included. For what the person can use, read their
1881
+ * entitlements; the server knows subscriptions across devices and stores,
1882
+ * see `useSubscriptions()`.
1883
+ */
1884
+ readonly subscriptionStatus: (groupId: string) => Promise<Result<ReadonlyArray<AppStoreSubscriptionStatus>, VoidhashError>>;
1885
+ /** StoreKit's verified current entitlements on this device. */
1886
+ readonly currentEntitlements: () => Promise<Result<ReadonlyArray<Transaction>, VoidhashError>>;
1887
+ /** How the end user got the app: StoreKit's verified `AppTransaction`. */
1888
+ readonly appTransaction: () => Promise<Result<AppTransaction, VoidhashError>>;
1889
+ /**
1890
+ * Calls `listener` with each purchase the end user starts on the App Store
1891
+ * (a promoted in-app purchase, a win-back offer) while the
1892
+ * `purchaseIntents` option is `"manual"`; complete it with `purchase()`.
1893
+ * Intents that arrived while no listener was registered (they can arrive
1894
+ * as soon as `init()` starts) are held, the 10 latest, and handed to the
1895
+ * first listener added, at once. Returns the function that removes the
1896
+ * listener. Never called on another platform.
1897
+ */
1898
+ readonly addPurchaseIntentListener: (listener: (intent: AppStorePurchaseIntent) => void) => () => void;
1899
+ }
1900
+ /**
1901
+ * Google Play actions, on `client.googlePlay`. On any other platform each one
1902
+ * answers `UNSUPPORTED_PLATFORM`. While the client is disabled each answers
1903
+ * empty: `noActionNeeded`, no purchases, `false`.
1904
+ */
1905
+ interface GooglePlayActions {
1906
+ /**
1907
+ * Shows Google Play's in-app messages for the end user's subscriptions,
1908
+ * such as a prompt to fix a declined payment. When they fixed it, the
1909
+ * answer names the purchase token, and the SDK has synced purchases and
1910
+ * refreshed the person.
1911
+ */
1912
+ readonly showInAppMessages: () => Promise<Result<GooglePlayInAppMessageResult, VoidhashError>>;
1913
+ /**
1914
+ * The Google Play account's purchases on this device, suspended
1915
+ * subscriptions included unless `includeSuspended` is `false`
1916
+ * (`transaction.googlePlay.isSuspended`). For what the person can use, read
1917
+ * their entitlements.
1918
+ */
1919
+ readonly queryPurchases: (options?: {
1920
+ readonly includeSuspended?: boolean;
1921
+ }) => Promise<Result<ReadonlyArray<Transaction>, VoidhashError>>;
1922
+ /** Whether Google Play supports a billing feature on this device. */
1923
+ readonly isFeatureSupported: (feature: GooglePlayBillingFeature) => Promise<Result<boolean, VoidhashError>>;
1924
+ }
1925
+ /**
1926
+ * The Voidhash client: the public facade over the native Voidhash client.
1927
+ * Every method answers with a `Result` carrying a coded `VoidhashError`
1928
+ * instead of throwing, and a client created with `enabled: false` never
1929
+ * touches the native client and answers every read with its empty shape.
1930
+ */
1931
+ declare class VoidhashClient {
1932
+ private readonly setup;
1933
+ private readonly atomRegistry;
1934
+ private readonly namespace;
1935
+ /** What this client holds in `liveClients` while it runs: its namespace, or the process. */
1936
+ private readonly slot;
1937
+ private readonly emitDiagnostic;
1938
+ private readonly screenTracker;
1939
+ private manualScreenCounter;
1940
+ /** The send id `trackPushOpened()` reported last. */
1941
+ private lastPushOpenedSendId;
1942
+ /** The native client and its adapter, made on first use. */
1943
+ private native;
1944
+ /** Seeds the first `init()` of the process; cleared once applied or by an identity change. */
1945
+ private initialDistinctId;
1946
+ /** The consent in effect, mirrored from the native client once it runs. */
1947
+ private analyticsConsent;
1948
+ /** A consent `setAnalyticsConsent()` chose before `init()`; it wins over the stored one. */
1949
+ private chosenAnalyticsConsent;
1950
+ private analyticsConsentDeniedReported;
1951
+ private readOnly;
1952
+ private _isInitialized;
1953
+ /** Set by `end()` until the next `init()`. */
1954
+ private ended;
1955
+ /**
1956
+ * The `init()` or `end()` called last, until it settles. A call for the
1957
+ * same transition joins it and a call for the other one runs after it, so
1958
+ * the client ends up in the state asked for last.
1959
+ */
1960
+ private transition;
1961
+ private flushInFlight;
1962
+ /** The purchase this client runs, until it settles; a second one fails `PURCHASE_IN_PROGRESS`. */
1963
+ private purchaseInFlight;
1964
+ private identityChangeTail;
1965
+ /**
1966
+ * The `identify()`, `reset()` and `signOut()` calls made, and how many of
1967
+ * them, in call order, have switched the identity or settled without doing
1968
+ * so. An event, a screen or a purchase report waits for the ones called
1969
+ * before it, so it is recorded for the person the app switched to; see
1970
+ * {@link identityChangeSwitched}.
1971
+ */
1972
+ private identityChangesCalled;
1973
+ private identityChangesSwitched;
1974
+ /** The identity change the native client is running now, by its number among those called. */
1975
+ private identityChangeRunning;
1976
+ private readonly eventsHeldForIdentity;
1977
+ private readonly reportsHeldForIdentity;
1978
+ /**
1979
+ * One entry per `addTransactionListener()` call, each its own function, so
1980
+ * adding a listener twice calls it twice.
1981
+ */
1982
+ private readonly transactionListeners;
1983
+ private readonly purchaseIntentListeners;
1984
+ /**
1985
+ * Purchase intents that arrived while no listener was registered (they
1986
+ * arrive from `init()` on, before the app may have added one), oldest
1987
+ * first, for the first listener the app adds.
1988
+ */
1989
+ private heldPurchaseIntents;
1990
+ /** The adapter over this client's native client, created on first use. */
1991
+ private nativeClient;
1992
+ /** The configuration the next `start()` runs with. */
1993
+ private configuration;
1994
+ /**
1995
+ * The answer of a side-effect call, unless `unstable_swallowErrors` asks for
1996
+ * failures to be logged and answered as success.
1997
+ */
1998
+ private swallowed;
1999
+ /** The started adapter, or `NOT_INITIALIZED`. */
2000
+ private started;
2001
+ /**
2002
+ * Joins an `init()` in progress or starts one — after `end()` and behind an
2003
+ * `end()` still running too — the way identity calls do, so a purchase
2004
+ * reported during launch or teardown is not refused.
2005
+ */
2006
+ private whenInitialized;
2007
+ /** Runs an `init()` or `end()` as the transition called last. */
2008
+ private runTransition;
2009
+ /**
2010
+ * The client that took over this client's storage namespace while this one
2011
+ * is not running. Identity and purchase calls on a replaced instance go to
2012
+ * it: starting this instance again would end the live one. A live client of
2013
+ * another project is never a replacement: nothing made for one project is
2014
+ * handed to another.
2015
+ */
2016
+ private replacement;
2017
+ /**
2018
+ * Runs an identity change in call order. Events, screens and purchase
2019
+ * reports made after it wait until it switched the identity, which the
2020
+ * native client announces at once, before it waits for Voidhash. A change
2021
+ * that switches nothing lets them go on when it starts (an `identify()` of
2022
+ * `target`, already the identity) or when it settles.
2023
+ */
2024
+ private enqueueIdentityChange;
2025
+ /**
2026
+ * Identity change number `change` switched the identity, or will not: sends
2027
+ * the events and screens held for it and lets the purchase reports go on.
2028
+ * Changes run one at a time, so the ones before it have switched too.
2029
+ */
2030
+ private identityChangeSwitched;
2031
+ /** Whether an identity change called before now has not switched the identity yet. */
2032
+ private awaitsIdentityChange;
2033
+ /**
2034
+ * Keeps an event or a screen until the identity changes called before it
2035
+ * switched the identity, then calls `send` with the time it was captured
2036
+ * at. In memory, as the native client holds events before it starts: past
2037
+ * {@link MAX_EVENTS_HELD_FOR_IDENTITY} the oldest is dropped and reported.
2038
+ */
2039
+ private holdEventForIdentity;
2040
+ /** Resolves once the identity changes called before now switched the identity. */
2041
+ private afterIdentityChanges;
2042
+ /**
2043
+ * Runs `operation` once `init()` has settled, after every identity change
2044
+ * and group call made before it.
2045
+ */
2046
+ private enqueueInIdentityOrder;
2047
+ /**
2048
+ * Starts the native client from local state: identity, caches and queues
2049
+ * are loaded without waiting for the network, and the refreshes, store
2050
+ * observation and delivery continue in the background. Resolves
2051
+ * immediately without touching the native client when the client was
2052
+ * created with `enabled: false`.
2053
+ *
2054
+ * An app launched in the background before the device has been unlocked
2055
+ * since it started (on Android, only an app with a `directBootAware`
2056
+ * component) cannot read anything the SDK stored, so this waits for that
2057
+ * first unlock; events captured meanwhile are kept.
2058
+ *
2059
+ * Idempotent: a call that overlaps a running `init()` joins it, and a call
2060
+ * on an initialized client resolves at once. A call made while `end()` is
2061
+ * still running waits for it and then starts the client again, unless
2062
+ * another client took over its storage meanwhile: then this one stays ended
2063
+ * and the call answers `VOIDHASH_CLIENT_NOT_INITIALIZED`.
2064
+ */
2065
+ init(): Promise<Result<void, VoidhashError>>;
2066
+ private runInit;
2067
+ /**
2068
+ * Makes this client the owner of its storage namespace (of the process,
2069
+ * where it runs one native client), ending the client that owned it until
2070
+ * now. It is the owner before that client has ended, so identity and
2071
+ * purchase calls made on a replaced client of the same namespace meanwhile
2072
+ * already go to this one instead of starting the replaced one again.
2073
+ */
2074
+ private claimNamespace;
2075
+ /** Gives up this client's storage namespace, if it still owns it. */
2076
+ private releaseNamespace;
2077
+ /**
2078
+ * Ends the client: flushes for at most about two seconds, persists what is
2079
+ * still queued and stops every observer, timer and listener. Whatever was
2080
+ * not delivered goes out after the next `init()`. An `init()` still running
2081
+ * is waited for first. The client stops being initialized as soon as the
2082
+ * teardown begins: reads answer `VOIDHASH_CLIENT_NOT_INITIALIZED` from then
2083
+ * on. Afterwards `capture()` drops events with a diagnostic and `init()`
2084
+ * starts the client again. Overlapping calls share one teardown. No-ops on
2085
+ * a disabled client.
2086
+ */
2087
+ end(): Promise<Result<void, VoidhashError>>;
2088
+ /** Whether the client is initialized. Always false while the client is disabled. */
2089
+ get isInitialized(): boolean;
2090
+ /** Whether this client does anything at all, fixed at construction by the `enabled` option. */
2091
+ get isEnabled(): boolean;
2092
+ /** Whether the SDK currently runs in observer ("read-only") mode. */
2093
+ get isReadOnly(): boolean;
2094
+ /**
2095
+ * Switches observer mode at runtime, so an app migrating onto Voidhash can
2096
+ * flip from watching another SDK's purchases to owning them without
2097
+ * recreating the client. A purchase that already started keeps the mode it
2098
+ * started with. No-ops in effect on a disabled client.
2099
+ */
2100
+ setReadOnly(readOnly: boolean): void;
2101
+ /**
2102
+ * The end user's analytics consent in effect: the last
2103
+ * {@link setAnalyticsConsent} value, else (once `init()` has read it) the
2104
+ * stored one, else the `analyticsConsent` option.
2105
+ */
2106
+ getAnalyticsConsent(): AnalyticsConsent;
2107
+ /**
2108
+ * Records whether the end user consents to usage analytics. Takes effect
2109
+ * immediately and is stored on the device, where it takes precedence over
2110
+ * the `analyticsConsent` option on later launches; `reset()` and
2111
+ * `signOut()` keep it.
2112
+ *
2113
+ * `"denied"` and `"pending"` stop all analytics: events, screens, lifecycle
2114
+ * and install events and paywall impressions are dropped, and every event
2115
+ * still queued on the device is discarded together with the analytics
2116
+ * session. Purchases, restores, entitlements, `identify()`, person
2117
+ * attributes, groups, feature flags and paywalls are unaffected. `"granted"`
2118
+ * resumes analytics for what is captured from then on.
2119
+ *
2120
+ * Called before `init()` the consent applies at once and is stored when
2121
+ * `init()` runs. An `Err` with `FAILED_TO_SET_ANALYTICS_CONSENT` means the
2122
+ * consent applies to this process but could not be stored; an invalid value
2123
+ * is an `INVALID_ARGUMENT` error and changes nothing.
2124
+ */
2125
+ setAnalyticsConsent(consent: AnalyticsConsent): Promise<Result<void, VoidhashError>>;
2126
+ /**
2127
+ * Returns the current person snapshot together with how much to trust it.
2128
+ * The answer comes from cache whenever one exists — a stale entry is served
2129
+ * while a refresh runs behind the read — so this never waits long on the
2130
+ * network and never fails because the server is unreachable. Pass
2131
+ * `{ forceFetch: true }` to prefer the server. Answers an empty snapshot
2132
+ * while disabled.
2133
+ */
2134
+ getCurrentPerson(options?: {
2135
+ forceFetch?: boolean;
2136
+ }): Promise<Result<CurrentPersonResult, VoidhashError>>;
2137
+ /**
2138
+ * Checks whether the current person holds an active grant for a perk.
2139
+ *
2140
+ * Cache-first: a fresh snapshot answers immediately, a stale one is served
2141
+ * while a refresh runs behind the read, and an entitlement granted before
2142
+ * the device went offline keeps answering `true`. The result always says how
2143
+ * fresh it is (`isStale`, `isExpired`, `reason`) — it never fails because
2144
+ * the server is unreachable. Pass `{ forceFetch: true }` to prefer the
2145
+ * server.
2146
+ */
2147
+ hasPerk(perkSlug: PerkSlug, options?: {
2148
+ /**
2149
+ * @deprecated No longer read. A stale answer beats no answer, so the
2150
+ * cached grant is always served. Branch on `isStale`/`isExpired` in the
2151
+ * result instead. Removed in a future release.
2152
+ */
2153
+ allowStale?: boolean;
2154
+ /** Prefer the server, waiting for it before answering. */
2155
+ forceFetch?: boolean;
2156
+ }): Promise<Result<HasPerkResult, VoidhashError>>;
2157
+ /**
2158
+ * Sets person attributes without waiting on the network. Reserved
2159
+ * `email`/`name` keys map to the dedicated server fields (strings); any
2160
+ * other key is a custom trait whose value must be a string, a number, a
2161
+ * boolean or `null`. Anything else is an `INVALID_ARGUMENT` error and
2162
+ * nothing is written. The update is stored on the device and sent right
2163
+ * away, then retried until the server applies it; `flush()` waits for it.
2164
+ * Attributes are written whatever the analytics consent, except that the
2165
+ * native SDK leaves `$ad_data_sharing` set to anything but `false` out until
2166
+ * it is granted: see {@link setAdDataSharing}.
2167
+ *
2168
+ * Like identity calls, it waits for initialization and runs in call order
2169
+ * with `identify()`, `reset()` and `signOut()`, so the attributes belong to
2170
+ * the person identified when this was called. Called right after an
2171
+ * `identify()` that wasn't awaited, it resolves once that identify settles.
2172
+ */
2173
+ setPersonAttributes(attributes: PersonAttributes): Promise<Result<void, VoidhashError>>;
2174
+ /**
2175
+ * Records whether the end user agreed to you sharing their purchases with ad
2176
+ * platforms, as the person trait `$ad_data_sharing`. Voidhash sends a
2177
+ * person's purchases to a Conversions API you turned on only when it is
2178
+ * `true`.
2179
+ *
2180
+ * `true` needs analytics consent: it does nothing while that is not
2181
+ * granted. Once written, it also drops a revocation
2182
+ * still queued for the person. `false` is a revocation, which analytics
2183
+ * consent neither blocks nor discards: the native SDK stores it on the device
2184
+ * and retries it until Voidhash has written it, or for 48 hours while Voidhash
2185
+ * has no such person, and it records no analytics. When someone rejects
2186
+ * everything, call it next to `setAnalyticsConsent("denied")`. Withdrawing
2187
+ * analytics consent does not take this back by itself.
2188
+ *
2189
+ * Waits for initialization and runs in call order with identity changes, as
2190
+ * {@link setPersonAttributes} does.
2191
+ */
2192
+ setAdDataSharing(granted: boolean): Promise<Result<void, VoidhashError>>;
2193
+ /**
2194
+ * Sets person attributes and reports whether the server confirmed them.
2195
+ * When the server cannot confirm the update now (it is unreachable, the key
2196
+ * was rejected, or an earlier write for this person is still queued) the
2197
+ * update is queued and the result is `deferred` with the last known
2198
+ * snapshot, rather than an error. Values, ordering and observer mode follow
2199
+ * {@link setPersonAttributes}: attributes are written whatever the analytics
2200
+ * consent and whether or not the client is read-only. The result is
2201
+ * `skipped` only when the one attribute was an agreement to ad data sharing
2202
+ * made without analytics consent: see {@link setAdDataSharing}.
2203
+ */
2204
+ setPersonAttributesSync(attributes: PersonAttributes): Promise<Result<SetPersonAttributesResult, VoidhashError>>;
2205
+ /**
2206
+ * Returns the active analytics session id, or `undefined` before `init()`,
2207
+ * while disabled, or once the session has been idle past the inactivity
2208
+ * timeout. Reading does not extend the session.
2209
+ */
2210
+ getSessionId(): string | undefined;
2211
+ /** Returns the current distinct id, or `Ok(null)` while disabled. */
2212
+ getDistinctId(): Promise<Result<string | null, VoidhashError>>;
2213
+ /**
2214
+ * Identifies the user by switching the current distinct id. The switch
2215
+ * happens locally first, and the link from the previous (anonymous)
2216
+ * identity is stored on the device before it is sent; when the server
2217
+ * cannot confirm it now, the link is retried until it lands rather than
2218
+ * failing, and an anonymous purchaser keeps their cached access meanwhile.
2219
+ * Use {@link identifySync} to learn which of the two happened. Identity
2220
+ * calls wait for initialization and run in invocation order. Repeating the
2221
+ * same ID without profile changes preserves the session and cached state.
2222
+ * A blank ID is an `INVALID_ARGUMENT` error and leaves the identity alone.
2223
+ */
2224
+ identify(externalUserId: string, options?: {
2225
+ email?: string;
2226
+ name?: string;
2227
+ }): Promise<Result<void, VoidhashError>>;
2228
+ /**
2229
+ * Identifies the user and reports whether the server confirmed the switch
2230
+ * (`confirmed`, with the person) or the device switched locally and queued
2231
+ * the link for later delivery (`deferred`, with the last known snapshot
2232
+ * for that identity, if any). Only a verdict the Voidhash API will not
2233
+ * change — which also restores the previous identity — or a blank ID
2234
+ * (`INVALID_ARGUMENT`) is an `Err`.
2235
+ */
2236
+ identifySync(externalUserId: string, options?: {
2237
+ email?: string;
2238
+ name?: string;
2239
+ }): Promise<Result<IdentifyResult, VoidhashError>>;
2240
+ /**
2241
+ * Starts a fresh visitor: a new anonymous distinct id and analytics session,
2242
+ * with no groups. When someone is signed in this is exactly `signOut()`;
2243
+ * when nobody is, `signOut()` does nothing and this still starts over, with
2244
+ * no event recorded. Use it for a shared device, or a guest starting over.
2245
+ */
2246
+ reset(): Promise<Result<void, VoidhashError>>;
2247
+ /**
2248
+ * Signs the current user out: captures the built-in `$sign_out` event
2249
+ * (unless automatic lifecycle events are off or analytics consent is not
2250
+ * granted), flushes it under the signing-out identity, then resets to a
2251
+ * fresh anonymous distinct id and starts a new analytics session. Does
2252
+ * nothing when nobody is signed in, so it is safe to call whenever the app
2253
+ * finds no session; `reset()` is the call for a fresh anonymous visitor.
2254
+ */
2255
+ signOut(): Promise<Result<void, VoidhashError>>;
2256
+ /**
2257
+ * Puts the end user in a group, such as the company or workspace they use
2258
+ * your app as part of. Every event captured after the returned promise
2259
+ * resolves carries it in `$groups`, until `resetGroups()`, `reset()` or
2260
+ * `signOut()`; the native SDK stores it on the device with the distinct id,
2261
+ * one group per type.
2262
+ *
2263
+ * `properties` set the group's own properties, such as its `name` and
2264
+ * `plan`: strings, numbers or booleans. They are sent as a `$groupidentify`
2265
+ * event when given, or when the end user's group of that type changed.
2266
+ * Groups and their properties are sent whatever the analytics consent;
2267
+ * without it the `$groupidentify` goes out at once, on its own, and is not
2268
+ * retried if it fails.
2269
+ *
2270
+ * A group type is a lower-case letter followed by up to 63 lower-case
2271
+ * letters, digits or underscores, such as `company`, and a key has 1 to 256
2272
+ * characters; a number is kept as text. Any other is an `INVALID_ARGUMENT`
2273
+ * error. `null` properties count as none. Like identity calls, it waits for initialization and runs in call
2274
+ * order with `identify()`, `reset()` and `signOut()`.
2275
+ */
2276
+ group(groupType: string, groupKey: string | number, properties?: GroupProperties | null): Promise<Result<void, VoidhashError>>;
2277
+ /**
2278
+ * Replaces every group the end user is in, in one call: the groups to be in
2279
+ * by type, each an id or `{ id, ...properties }`. A type left out, or given
2280
+ * as `null` or `undefined`, is dropped. Safe to call whenever the groups
2281
+ * might have changed: a `$groupidentify` is sent only for a group whose id
2282
+ * or properties differ from what was last sent, so repeating a call sends
2283
+ * nothing. An empty object behaves like `resetGroups()`.
2284
+ *
2285
+ * An id is a string or a finite number. A group given with any other id, or
2286
+ * with none, is an `INVALID_ARGUMENT` error for the whole call, and nothing
2287
+ * changes. Types and ids otherwise follow the rules of `group()`: a group
2288
+ * whose type or id those refuse is left out. Runs in call order with `identify()`, `reset()` and `signOut()`.
2289
+ */
2290
+ setGroups(groups: Groups): Promise<Result<void, VoidhashError>>;
2291
+ /** Takes the end user out of every group; later events carry no `$groups`. */
2292
+ resetGroups(): Promise<Result<void, VoidhashError>>;
2293
+ /**
2294
+ * The groups the end user belongs to, by group type, as `group()` set them:
2295
+ * `{}` before `init()` resolves, while disabled, and when they belong to none.
2296
+ */
2297
+ getGroups(): Readonly<Record<string, string>>;
2298
+ /**
2299
+ * Evaluates feature flags for the current person, cache-first: `flagKeys`
2300
+ * (every flag when omitted), each with its enabled state, variant key
2301
+ * (`null` without a variant) and payload. Returns no flags while disabled.
2302
+ */
2303
+ getFeatureFlags(flagKeys?: ReadonlyArray<FeatureFlagKey>): Promise<Result<FeatureFlagsResult, VoidhashError>>;
2304
+ /**
2305
+ * The value of the variant flag `key` selected for the current person: the
2306
+ * variant's value when the flag is enabled and evaluated, `null` when it is
2307
+ * off, has no variant (or one whose value is not text), is unknown, or was
2308
+ * not evaluated within `featureFlags.maxWaitMs`. Evaluates `key`
2309
+ * cache-first, as `getFeatureFlags([key])` does. Answers `Ok(null)` while
2310
+ * disabled. Typed by the variant values `voidhash.gen.d.ts` lists for the
2311
+ * flag; a variant added since generation is not in that union.
2312
+ */
2313
+ getVariantValue<K extends FeatureFlagKey>(key: K): Promise<Result<FeatureFlagValue<K> | null, VoidhashError>>;
2314
+ /**
2315
+ * Resolves the currently assigned paywall showing for a location slug.
2316
+ * Answers `Ok(null)` while disabled.
2317
+ */
2318
+ getPaywallForLocation(locationSlug: LocationSlug): Promise<Result<ResolvedPaywall, VoidhashError>>;
2319
+ /**
2320
+ * The products the store sells this end user, sorted by slug, with the
2321
+ * offers they can buy them with. With `slugs`, the products those slugs
2322
+ * name, in that order: `undefined` where the store has none, which the
2323
+ * `onDiagnostic` handler hears about as `PRODUCT_NOT_FOUND`. With the types
2324
+ * `voidhash-cli types generate` writes, each is typed by its slug, so a
2325
+ * subscription's slug is a `SubscriptionProduct`.
2326
+ *
2327
+ * One load serves every caller and every `useProducts()`; it runs again
2328
+ * after an identity change, a completed purchase or new product
2329
+ * definitions. Answers no products while disabled.
2330
+ */
2331
+ getProducts(): Promise<Result<ReadonlyArray<Product>, VoidhashError>>;
2332
+ getProducts<const Slugs extends ReadonlyArray<ProductSlug>>(slugs: Slugs): Promise<Result<ProductsForSlugs<Slugs>, VoidhashError>>;
2333
+ /**
2334
+ * Buys a product from `getProducts()` or `useProducts()`. By default a
2335
+ * subscription comes with the free trial or introductory price the end
2336
+ * user is eligible for; `options.offer` picks another offer or the regular
2337
+ * price. Resolves to a `Result`: `purchased`, `pending` and `cancelled` are
2338
+ * outcomes, every failure is an `Err` carrying a coded
2339
+ * {@link VoidhashError}. Answers `Ok({ status: "disabled" })` while
2340
+ * disabled.
2341
+ *
2342
+ * Waits for `init()`. One purchase runs at a time: another started while
2343
+ * it runs fails with `PURCHASE_IN_PROGRESS` and buys nothing. Blocked in
2344
+ * observer mode; the mode in effect when the purchase starts decides, so a
2345
+ * `setReadOnly()` landing later doesn't abandon it. Options no store could
2346
+ * honour are an `INVALID_ARGUMENT` error, and nothing is bought.
2347
+ */
2348
+ purchase(product: Product, options?: PurchaseOptions): Promise<Result<PurchaseResult, VoidhashError>>;
2349
+ /**
2350
+ * Revalidates restorable purchases for the user who requested the restore,
2351
+ * and answers the refreshed person, `null` when there is none, so a
2352
+ * "nothing to restore" needs no second read: check the person's
2353
+ * entitlements. Call from a user action: iOS may prompt for App Store
2354
+ * authentication. Known consumables are excluded. Waits for `init()`;
2355
+ * answers `Ok(null)` while disabled.
2356
+ */
2357
+ restorePurchases(): Promise<Result<Person | null, VoidhashError>>;
2358
+ /**
2359
+ * Calls `listener` with each purchase that completes outside `purchase()`:
2360
+ * an approved Ask to Buy, a pending payment that went through, a redeemed
2361
+ * offer code, a promoted purchase, and on iOS a renewal seen on the device
2362
+ * (`transaction.isRenewal`; Google Play does not report renewals to the
2363
+ * device). A purchase or restore made in a flow is not one: `presentFlow()`
2364
+ * answers it. It is called once the SDK handled the purchase; `synced`
2365
+ * says whether Voidhash already accepted it. A signal for the UI, not a
2366
+ * delivery guarantee: access always comes from the person's entitlements,
2367
+ * which hooks re-render with. Returns the function that removes the
2368
+ * listener. Never called while disabled.
2369
+ */
2370
+ addTransactionListener(listener: (update: TransactionUpdate) => void): () => void;
2371
+ /**
2372
+ * Opens the store's subscription management: the App Store's sheet (for
2373
+ * `product`'s subscription group, on iOS 17 and later) or Google Play's
2374
+ * subscriptions page (for `product`, when given). No-op while disabled.
2375
+ */
2376
+ showManageSubscriptions(product?: Product): Promise<Result<void, VoidhashError>>;
2377
+ /**
2378
+ * Lets the end user redeem an offer code: Apple's redemption sheet (where
2379
+ * they type the code; `code` is ignored), or Google Play's redeem page
2380
+ * filled in with `code`. A redeemed code arrives as a transaction update.
2381
+ * No-op while disabled.
2382
+ */
2383
+ presentCodeRedemption(code?: string): Promise<Result<void, VoidhashError>>;
2384
+ /**
2385
+ * The storefront the end user buys from: its ISO 3166-1 alpha-2 country,
2386
+ * and currency where the store says. `undefined` when the store has none to
2387
+ * give, and while disabled.
2388
+ */
2389
+ getStorefront(): Promise<Result<Storefront | undefined, VoidhashError>>;
2390
+ /**
2391
+ * Whether this device can make purchases: payments are not restricted (App
2392
+ * Store) and billing is available (Google Play). `false` while disabled.
2393
+ */
2394
+ canMakePayments(): Promise<Result<boolean, VoidhashError>>;
2395
+ /**
2396
+ * Hands a purchase intent to the listeners, or holds it for the first one
2397
+ * while there is none: the native client sends intents from `init()` on,
2398
+ * possibly before the app added its listener.
2399
+ */
2400
+ private receivePurchaseIntent;
2401
+ /** App Store actions; see {@link AppStoreActions}. */
2402
+ readonly appStore: AppStoreActions;
2403
+ /** Google Play actions; see {@link GooglePlayActions}. */
2404
+ readonly googlePlay: GooglePlayActions;
2405
+ /**
2406
+ * Runs an action of one store: `UNSUPPORTED_PLATFORM` on the other
2407
+ * platform, `whileDisabled` on a disabled client, and
2408
+ * `VOIDHASH_CLIENT_NOT_INITIALIZED` before `init()`.
2409
+ */
2410
+ private storeAction;
2411
+ /** Calls every listener with `value`; one that throws is reported and the others still run. */
2412
+ private notify;
2413
+ /**
2414
+ * Presents the flow assigned to a location and resolves once it ends, with
2415
+ * its `outcome` (`purchased`, `restored`, `dismissed`, or the outcome the
2416
+ * flow finished with), its `output` and the `productId` of a purchase.
2417
+ *
2418
+ * `options.input` are the flow's inputs and `options.actions` a handler per
2419
+ * app action the flow can call; a handler that throws or rejects makes the
2420
+ * flow run that action's failure path. `options.revision` is the interface
2421
+ * revision the app was built against, by default the one the
2422
+ * `flowRevisions` option sets for the location.
2423
+ *
2424
+ * Rejects with a {@link VoidhashError} when the flow cannot be shown; its
2425
+ * `code` says why (`FLOW_NOT_ASSIGNED`, `FLOW_UNAVAILABLE`,
2426
+ * `FLOW_RENDERER_MISSING`, …).
2427
+ *
2428
+ * The location's assignment is served from cache when the server cannot be
2429
+ * reached. Purchases started from the flow go through the SDK's purchase
2430
+ * path, so observer mode blocks them and the flow shows the failure. A flow
2431
+ * already on screen is closed first and resolves as `dismissed`.
2432
+ */
2433
+ presentFlow<const L extends LocationSlug>(location: L, ...args: PresentFlowArguments<L>): Promise<FlowResult<L>>;
2434
+ /**
2435
+ * Changes inputs of the flow on screen; inputs that are not named keep
2436
+ * their values. No-op when no flow is shown and while disabled.
2437
+ */
2438
+ updateFlowInput<L extends string = string>(values: Partial<FlowInput<L>>): Promise<void>;
2439
+ /**
2440
+ * Closes the flow on screen, if any; its `presentFlow()` resolves as
2441
+ * `dismissed`. No-op while disabled.
2442
+ */
2443
+ dismissFlow(): Promise<void>;
2444
+ /**
2445
+ * Reports a purchase your own billing integration completed: its Apple
2446
+ * transaction (ID or JWS) or its Google Play token. Other purchase metadata
2447
+ * is optional and discarded. On iOS, a JWS is sent as the device's proof of
2448
+ * the purchase; with an ID only, the native SDK reads the JWS from the
2449
+ * device's purchase history.
2450
+ *
2451
+ * The report is a purchase the user just made: it goes to the current
2452
+ * user, even when an earlier purchase of the Apple Account or Google account
2453
+ * belongs to another user. Voidhash moves a purchase only when the store
2454
+ * shows it was made in the last 24 hours, and on iOS only with the JWS;
2455
+ * otherwise it is recorded for its current owner. A purchase is claimed
2456
+ * once from a device: reporting it again, also after another user signed
2457
+ * in, cannot move it.
2458
+ *
2459
+ * A report made after an `identify()`, `reset()` or `signOut()` that was
2460
+ * not awaited goes to the user that call switches to: it waits until the
2461
+ * device has switched, not for Voidhash to answer.
2462
+ *
2463
+ * Does not query, finish, acknowledge or consume the purchase. Pending
2464
+ * Android purchases are ignored; report them again when purchased.
2465
+ * Delivery failures remain queued for retry, so success does not imply
2466
+ * server acceptance.
2467
+ */
2468
+ reportTransaction(transaction: StoreTransaction, options?: {
2469
+ /**
2470
+ * Reports a transaction your own restore flow returned after the user
2471
+ * asked to restore purchases. It is sent as an explicit restore, like
2472
+ * `restorePurchases()`, even when Voidhash accepted it before, and
2473
+ * keeps that intent across retries and relaunches: the project's paid
2474
+ * access sharing setting then decides whether a purchase another user
2475
+ * has is shared, moved or kept.
2476
+ */
2477
+ readonly isRestore?: boolean;
2478
+ }): Promise<Result<void, VoidhashError>>;
2479
+ /**
2480
+ * Reports pending purchases and current store entitlements to Voidhash.
2481
+ * Recovery fallback when a host callback exposes no transaction values. Prefer
2482
+ * reportTransaction for purchase results, especially consumables already finalized.
2483
+ * In observer mode transactions are never finished. Delivery failures stay
2484
+ * queued and emit diagnostics; success does not imply server acceptance.
2485
+ */
2486
+ syncPurchases(): Promise<Result<void, VoidhashError>>;
2487
+ /**
2488
+ * Captures a product analytics event.
2489
+ * Events are batched and delivered on size/time thresholds. Dropped — not
2490
+ * buffered — while disabled or while analytics consent is not granted
2491
+ * (unless `analyticsWhilePending` holds them for a pending one).
2492
+ * Events captured before `init()` resolves are kept and sent once it has,
2493
+ * provided the analytics consent `init()` settles on (the one chosen with
2494
+ * `setAnalyticsConsent()`, else the stored one, else the option) is
2495
+ * `"granted"`; a consent other than `"granted"` chosen meanwhile discards them.
2496
+ *
2497
+ * An event captured after an `identify()`, `reset()` or `signOut()` that
2498
+ * was not awaited is recorded for the person that call switches to: it
2499
+ * waits, in memory, until the device has switched, not for Voidhash to
2500
+ * answer, and keeps the time it was captured at. That is a moment after
2501
+ * `identify()`, and up to about two seconds after a `signOut()` or
2502
+ * `reset()` of a signed-in user, whose last events are sent first. An
2503
+ * identity call runs after the identity, group and person calls made
2504
+ * before it have settled, so behind several of those the wait is as long
2505
+ * as they take, which on a slow network is seconds each. Past 100 events
2506
+ * waiting, the oldest is dropped and reported as `ANALYTICS_EVENT_DROPPED`;
2507
+ * `end()` hands the waiting ones over as they are.
2508
+ *
2509
+ * Property values are copied as the event is captured, into what JSON can
2510
+ * hold: a `bigint` is sent as its decimal string, a `Date` as its ISO
2511
+ * string, a non-finite number as `null`, and functions, symbols,
2512
+ * `undefined` and circular references are left out. An event whose
2513
+ * properties cannot be copied at all (more than 10,000 values, or a getter
2514
+ * that throws) is dropped and reported as `ANALYTICS_EVENT_DROPPED`. Never
2515
+ * throws.
2516
+ */
2517
+ capture(eventName: string, properties?: Record<string, unknown>): void;
2518
+ /**
2519
+ * Reports that the end user opened a notification, as `$push_opened` naming
2520
+ * its send. Call it from your notification library's opened-notification
2521
+ * handler, with the notification's data: the SDK has no notification handling
2522
+ * of its own. A notification not sent through Voidhash is ignored, and so is
2523
+ * one reported again right after its first report, as a handler that reads
2524
+ * the last opened notification on every mount does. Dropped while disabled or
2525
+ * while analytics consent is not granted. Never throws.
2526
+ */
2527
+ trackPushOpened(data?: Readonly<Record<string, unknown>>): void;
2528
+ /**
2529
+ * The native client an event for `name` can be handed to, or `None` when it
2530
+ * is dropped: without consent (reported once) unless the native client
2531
+ * holds it for a pending one, after `end()`, or without
2532
+ * the native module (each reported).
2533
+ *
2534
+ * Before the client has started only the native client can know the consent
2535
+ * stored on the device, so the event is handed over for it to keep or
2536
+ * discard at start, whatever the `analyticsConsent` option says. A consent
2537
+ * `setAnalyticsConsent()` chose in this process is the exception: it wins
2538
+ * over the stored one, so it decides here already.
2539
+ */
2540
+ private analyticsIntake;
2541
+ /**
2542
+ * Captures a `$screen` event for a screen the SDK cannot observe itself
2543
+ * (custom navigation, onboarding steps, pager pages). Every call is a new
2544
+ * screen instance, so calling it twice with the same name emits twice.
2545
+ * No-op while disabled or when `screenTracking.enabled` is `false`. Never
2546
+ * throws: a screen whose name is not a string, or that cannot be read, is
2547
+ * dropped and reported as `ANALYTICS_EVENT_DROPPED`.
2548
+ */
2549
+ screen(name: string, properties?: Record<string, unknown>): void;
2550
+ /**
2551
+ * Sends everything queued now: person writes (`identify()` links and
2552
+ * attributes) first, then store receipts and analytics events, and reports
2553
+ * the analytics outcome. Waits at most about two seconds; delivery goes on
2554
+ * past that. Events still waiting for an identity change to switch the
2555
+ * person are sent too: the flush starts once it has. Nothing is ever queued
2556
+ * while disabled, so this no-ops.
2557
+ */
2558
+ flush(): Promise<Result<FlushResult, VoidhashError>>;
2559
+ /** Clears the cached person snapshot. The next read refetches from the server. */
2560
+ resetCache(): Promise<Result<void, VoidhashError>>;
2561
+ /**
2562
+ * Internal surface used by the SDK's React bindings.
2563
+ * Not part of the public API — may change or disappear at any time.
2564
+ */
2565
+ readonly internal: {
2566
+ getAtomRegistry: () => AtomRegistry.AtomRegistry;
2567
+ /** What flag `key` reads as while it has no evaluated value: its `featureFlags.defaults` entry, or `false`. */
2568
+ isFeatureEnabledByDefault: (key: string) => boolean;
2569
+ /**
2570
+ * What a purchase of `product` with `options` buys, as text: two
2571
+ * purchases with the same key buy the same product the same way. `None`
2572
+ * for options `purchase()` refuses.
2573
+ */
2574
+ purchaseKey: (product: Product, options: PurchaseOptions) => Option.Option<string>;
2575
+ getSchema: () => Option.Option<RuntimeSchema>;
2576
+ getSuccessCallbackBaseUrl: () => string;
2577
+ getErrorCallbackBaseUrl: () => string;
2578
+ reportHostCallbackFailure: (operation: string, error: unknown) => void;
2579
+ };
2580
+ /** Reports an exception a callback the app supplied threw; the SDK carried on without it. */
2581
+ private reportHostCallbackFailure;
2582
+ /**
2583
+ * Reports, once until consent is granted again, that analytics work was
2584
+ * skipped for lack of consent.
2585
+ */
2586
+ private reportAnalyticsConsentDenied;
2587
+ }
2588
+
2589
+ /**
2590
+ * Whether a distinct id is one the SDK made for an anonymous end user: `vh_anon_<uuid>`, or the
2591
+ * `vh:anon:` form a device may still hold from an earlier SDK build. Use it instead of checking a
2592
+ * prefix, for example to sign out only an identified person.
2593
+ */
2594
+ declare const isAnonymousDistinctId: (distinctId: string) => boolean;
2595
+
2596
+ declare class Perk {
2597
+ }
2598
+
2599
+ /**
2600
+ * Lifecycle phase of the SDK client owned by `VoidhashProvider`.
2601
+ *
2602
+ * `"disabled"` is terminal: the client was created with `enabled: false`, so
2603
+ * no `init()` is ever attempted and `retryInit()` does nothing.
2604
+ */
2605
+ type VoidhashInitStatus = "disabled" | "failed" | "initializing" | "ready";
2606
+ declare const VoidhashInitError_base: Schema.Class<VoidhashInitError, Schema.TaggedStruct<"VoidhashInitError", {
2607
+ readonly message: Schema.String;
2608
+ readonly cause: Schema.Unknown;
2609
+ }>, effect_Cause.YieldableError>;
2610
+ /** Normalizes an unknown rejection value into an `Error`. */
2611
+ declare class VoidhashInitError extends VoidhashInitError_base {
2612
+ }
2613
+
2614
+ interface VoidhashProviderBaseProps {
2615
+ children: ReactNode;
2616
+ }
2617
+ interface VoidhashContext {
2618
+ client: VoidhashClient;
2619
+ /** The error that failed `init()`. `null` unless `status` is `"failed"`. */
2620
+ initError: VoidhashInitError | null;
2621
+ /** Compatibility alias for `status === "ready"`. Stays false while disabled. */
2622
+ isInitialized: boolean;
2623
+ /**
2624
+ * Re-runs `init()` after a failure. No-op while initializing, ready or
2625
+ * disabled.
2626
+ */
2627
+ retryInit: () => void;
2628
+ /** `"disabled"` when the client was created with `enabled: false`. */
2629
+ status: VoidhashInitStatus;
2630
+ }
2631
+ /**
2632
+ * Builds the provider, context and `useVoidhash` hook of one client. Every
2633
+ * provider instance shares the client's lifecycle, so an app with several
2634
+ * React roots can mount one provider per root: the client initializes with
2635
+ * the first and ends with the last.
2636
+ */
2637
+ declare function voidhashProviderFactory(initialClient: VoidhashClient): {
2638
+ context: React.Context<Option.Option<VoidhashContext>>;
2639
+ provider: ({ children }: VoidhashProviderBaseProps) => react_jsx_runtime.JSX.Element;
2640
+ useVoidhash: () => VoidhashContext;
2641
+ };
2642
+
2643
+ /** How the products load is going, the same for every `useProducts()`. */
2644
+ interface ProductsLoad {
2645
+ /** The error that stopped the last load, or `null`. */
2646
+ readonly error: VoidhashError | null;
2647
+ /**
2648
+ * `true` while the provider initializes and until the products have
2649
+ * loaded; `false` while disabled.
2650
+ */
2651
+ readonly isLoading: boolean;
2652
+ /** Loads the products again. */
2653
+ readonly refetch: () => Promise<void>;
2654
+ }
2655
+ /** What `useProducts()` answers: every product. */
2656
+ interface UseProductsResult extends ProductsLoad {
2657
+ /** Every product the store sells this end user, sorted by slug; empty until loaded. */
2658
+ readonly products: ReadonlyArray<Product>;
2659
+ readonly data: {
2660
+ /** Each product by its slug; a slug the store has no product for is absent. */
2661
+ readonly bySlug: {
2662
+ readonly [Slug in ProductSlug]?: ProductForSlug<Slug>;
2663
+ };
2664
+ /** The product a slug names, or `undefined` when the store has none. */
2665
+ readonly get: <Slug extends ProductSlug>(slug: Slug) => ProductForSlug<Slug> | undefined;
2666
+ /** Every product, as `products`. */
2667
+ readonly toList: () => ReadonlyArray<Product>;
2668
+ };
2669
+ }
2670
+ /** What `useProducts(slugs)` answers: the products those slugs name, in their order. */
2671
+ interface UseProductsBySlugsResult<Slugs extends ReadonlyArray<ProductSlug>> extends ProductsLoad {
2672
+ /**
2673
+ * The product of each slug, in the order given: `undefined` until loaded
2674
+ * and where the store has none. With generated types each is typed by its
2675
+ * slug, so a subscription's slug is a `SubscriptionProduct`.
2676
+ */
2677
+ readonly products: ProductsForSlugs<Slugs>;
2678
+ }
2679
+
2680
+ /** A purchase the store charged for, as `onSuccess` receives it. */
2681
+ type CompletedPurchase = Extract<PurchaseResult, {
2682
+ status: "purchased";
2683
+ }>;
2684
+ /**
2685
+ * Callbacks for a purchase's outcome. An exception a callback throws (or a
2686
+ * promise it returns that rejects) is reported through `onDiagnostic` as
2687
+ * `HOST_CALLBACK_FAILED` and never affects the purchase or the hook's state.
2688
+ */
2689
+ interface UsePurchaseOptions {
2690
+ /**
2691
+ * Runs when the store charged (`purchased`), whether or not Voidhash has
2692
+ * accepted the receipt yet (`synced`): the purchase is done either way.
2693
+ */
2694
+ onSuccess?: (result: CompletedPurchase) => void;
2695
+ onError?: (error: VoidhashError) => void;
2696
+ onSettled?: (result: Result<PurchaseResult, VoidhashError>) => void;
2697
+ }
2698
+ /**
2699
+ * What one `purchase()` call of the hook takes: its own callbacks, and the
2700
+ * purchase options `client.purchase()` takes.
2701
+ */
2702
+ interface UsePurchaseCallOptions extends UsePurchaseOptions, PurchaseOptions {
2703
+ }
2704
+
2705
+ /**
2706
+ * Callbacks for a restore's outcome. An exception a callback throws (or a
2707
+ * promise it returns that rejects) is reported through `onDiagnostic` as
2708
+ * `HOST_CALLBACK_FAILED` and never affects the restore or the hook's state.
2709
+ */
2710
+ interface UseRestorePurchasesOptions {
2711
+ /**
2712
+ * Runs when the restore finished, with the refreshed person (`null` when
2713
+ * there is none). It does not mean the person has access: check their
2714
+ * entitlements, which mounted `useHasPerk` hooks already re-render with.
2715
+ */
2716
+ onSuccess?: (person: Person | null) => void;
2717
+ onError?: (error: VoidhashError) => void;
2718
+ onSettled?: (result: Result<Person | null, VoidhashError>) => void;
2719
+ }
2720
+
2721
+ interface UseCurrentPersonResult {
2722
+ /** The person, or `null` until the first snapshot loads and while the client is disabled. */
2723
+ readonly data: Person | null;
2724
+ /** The error that stopped the last read, or `null`. */
2725
+ readonly error: VoidhashError | null;
2726
+ /** `true` while the provider initializes and until this hook's first read has answered. */
2727
+ readonly isLoading: boolean;
2728
+ /**
2729
+ * `true` while the person comes from a snapshot the server has not
2730
+ * confirmed recently: a cached one past its refresh window or TTL, or none
2731
+ * at all yet. Clears as soon as a refresh lands.
2732
+ */
2733
+ readonly isStale: boolean;
2734
+ readonly refetch: () => Promise<void>;
2735
+ }
2736
+
2737
+ interface UseSubscriptionsResult extends Omit<UseCurrentPersonResult, "data"> {
2738
+ /**
2739
+ * Every subscription of the person that has not ended, including ones in a
2740
+ * grace period, in billing retry, on hold or paused: what a "manage
2741
+ * subscription" screen lists. Empty until the person loads. Access comes
2742
+ * from entitlements (`useHasPerk`), never from this list.
2743
+ */
2744
+ readonly all: ReadonlyArray<Subscription>;
2745
+ /** The subscription that matters most now, or `undefined` when there is none. */
2746
+ readonly current: Subscription | undefined;
2747
+ }
2748
+
2749
+ interface UseHasPerkResult {
2750
+ /** The active grant behind `hasAccess`, or `null` when there is none. */
2751
+ grant: EntitlementGrant | null;
2752
+ hasAccess: boolean;
2753
+ /**
2754
+ * `true` while the provider initializes and until this hook's first check
2755
+ * has answered, so `hasAccess: false` is never reported before the SDK has
2756
+ * looked. `false` for a disabled client.
2757
+ */
2758
+ isLoading: boolean;
2759
+ /**
2760
+ * True while `hasAccess` is answered from a snapshot the server has not
2761
+ * confirmed recently: a cached one past its refresh window or TTL, or none
2762
+ * at all yet. Clears as soon as a refresh lands, even one that runs in the
2763
+ * background. Pair with `error` to decide whether to fail open or closed.
2764
+ */
2765
+ isStale: boolean;
2766
+ /** The error that stopped the last check, or `null`. */
2767
+ error: VoidhashError | null;
2768
+ refetch: () => Promise<void>;
2769
+ }
2770
+
2771
+ /** One flag's evaluation as {@link UseFeatureFlagsResult.getVariant} reports it. */
2772
+ interface FeatureFlagVariant {
2773
+ enabled: boolean;
2774
+ /** The selected variant's key, or `null` for a flag without variants. */
2775
+ variantKey: string | null;
2776
+ /** The selected variant's payload: untyped JSON, `null` when it has none. Validate before use. */
2777
+ payload: unknown;
2778
+ }
2779
+ interface UseFeatureFlagsResult {
2780
+ data: {
2781
+ /** Every flag evaluated for the requested keys (all flags when none were passed). */
2782
+ flags: ReadonlyArray<SdkFeatureFlag>;
2783
+ };
2784
+ /** The error that stopped the last evaluation, or `null`. */
2785
+ error: VoidhashError | null;
2786
+ /** The flag's variant, or `null` while it is loading or unknown. */
2787
+ getVariant: (key: FeatureFlagKey) => FeatureFlagVariant | null;
2788
+ /**
2789
+ * The value of the variant the flag selected, while the flag is enabled:
2790
+ * `null` while loading (`isLoading`), and once loaded when the flag is
2791
+ * off, has no variant (or one whose value is not text) or is unknown.
2792
+ * Typed by the variant values `voidhash.gen.d.ts` lists for the flag; a
2793
+ * variant added since generation is not in that union.
2794
+ */
2795
+ getVariantValue: <K extends FeatureFlagKey>(key: K) => FeatureFlagValue<K> | null;
2796
+ /**
2797
+ * Whether the flag is enabled. A flag without an evaluated value (while
2798
+ * loading, unknown, or on a disabled client) reads as its
2799
+ * `featureFlags.defaults` entry, or `false`.
2800
+ */
2801
+ isEnabled: (key: FeatureFlagKey) => boolean;
2802
+ /** `true` while the provider initializes and until this hook's evaluation has answered. */
2803
+ isLoading: boolean;
2804
+ refetch: () => Promise<void>;
2805
+ }
2806
+
2807
+ /**
2808
+ * Bootstrap the Voidhash SDK for a NitroUI app.
2809
+ *
2810
+ * - There is no schema argument. The schema lives on the server and is
2811
+ * fetched on `Provider` mount.
2812
+ * - Type safety for product / location / perk slugs comes from the generated
2813
+ * `voidhash.gen.d.ts` (run `voidhash-cli types generate`).
2814
+ * - No `publishableKey` (`null`, `undefined` or blank), or
2815
+ * `options.enabled: false` returns a fully inert client: the provider and
2816
+ * every hook still mount (so hook order never changes), but nothing
2817
+ * initializes.
2818
+ * - An `analyticsConsent` other than `"granted"`, `"denied"` or `"pending"`
2819
+ * throws an `INVALID_ARGUMENT` error in development builds; release builds
2820
+ * use `"granted"` and report `INVALID_CONFIGURATION`.
2821
+ * - A `featureFlags.maxWaitMs` that is not zero or a positive integer, or a
2822
+ * `featureFlags.defaults` entry that is not a boolean, throws an
2823
+ * `INVALID_ARGUMENT` error in development builds; release builds ignore it
2824
+ * and report `INVALID_CONFIGURATION`.
2825
+ * - A blank `distinctId`, `baseUrl` or `ingestUrl` counts as absent, and
2826
+ * whitespace around a `baseUrl` or `ingestUrl` is removed. A
2827
+ * `baseUrl` or `ingestUrl` that is not an absolute `http(s)` URL throws an
2828
+ * `INVALID_ARGUMENT` error in development builds; release builds use the
2829
+ * default origin and report `INVALID_CONFIGURATION` through `onDiagnostic`.
2830
+ * - A build without this package's native module (a JavaScript update onto
2831
+ * an app binary built before the package was added) loads normally;
2832
+ * `init()` then fails with `FAILED_TO_INITIALIZE_VOIDHASH_CLIENT`.
2833
+ */
2834
+ declare function createVoidhashClient(publishableKey: string | null | undefined, options?: VoidhashClientOptions): {
2835
+ Provider: ({ children }: VoidhashProviderBaseProps) => react_jsx_runtime.JSX.Element;
2836
+ appStore: AppStoreActions;
2837
+ client: VoidhashClient;
2838
+ googlePlay: GooglePlayActions;
2839
+ useCurrentPerson: () => UseCurrentPersonResult;
2840
+ useFeatureFlags: (flagKeys?: ReadonlyArray<FeatureFlagKey>) => UseFeatureFlagsResult;
2841
+ useHasPerk: (perkSlug: PerkSlug) => UseHasPerkResult;
2842
+ usePresentFlow: <const L extends LocationSlug>(location: L) => {
2843
+ isPresenting: boolean;
2844
+ present: (...args: PresentFlowArguments<L>) => Promise<FlowResult<L>>;
2845
+ updateInput: (values: Partial<FlowInput<L>>) => Promise<void>;
2846
+ };
2847
+ useProducts: {
2848
+ (): UseProductsResult;
2849
+ <const Slugs extends ReadonlyArray<ProductSlug>>(slugs: Slugs): UseProductsBySlugsResult<Slugs>;
2850
+ };
2851
+ usePurchase: (hookOptions?: UsePurchaseOptions) => {
2852
+ error: VoidhashError | null;
2853
+ isLoading: boolean;
2854
+ pendingProduct: Product | undefined;
2855
+ purchase: (product: Product, options?: UsePurchaseCallOptions) => Promise<better_result.Result<PurchaseResult, VoidhashError>>;
2856
+ };
2857
+ useRestorePurchases: (hookOptions?: UseRestorePurchasesOptions) => {
2858
+ error: VoidhashError | null;
2859
+ isLoading: boolean;
2860
+ restore: () => Promise<better_result.Result<Person | null, VoidhashError>>;
2861
+ };
2862
+ useSubscriptions: () => UseSubscriptionsResult;
2863
+ useVoidhash: () => VoidhashContext;
2864
+ };
2865
+
2866
+ 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 };