@userflow-tech/react-native 0.2.0 → 0.3.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 (852) hide show
  1. package/README.md +116 -77
  2. package/app.plugin.js +11 -3
  3. package/babel-plugin/index.d.ts.map +1 -1
  4. package/babel-plugin/index.js +53 -6
  5. package/babel-plugin/index.js.map +1 -1
  6. package/babel-plugin.js +11 -3
  7. package/docs/deep-linking.md +70 -33
  8. package/docs/isolation.md +75 -0
  9. package/docs/troubleshooting.md +40 -17
  10. package/docs/webview-custom-banner-poc.md +64 -0
  11. package/expo-plugin/withUserflow.d.ts +3 -2
  12. package/expo-plugin/withUserflow.d.ts.map +1 -1
  13. package/expo-plugin/withUserflow.js +14 -8
  14. package/expo-plugin/withUserflow.js.map +1 -1
  15. package/lib/commonjs/anchors/AutoAnchorRegistry.js +37 -11
  16. package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -1
  17. package/lib/commonjs/anchors/fiber/fiberPath.js +122 -0
  18. package/lib/commonjs/anchors/fiber/fiberPath.js.map +1 -0
  19. package/lib/commonjs/anchors/fiber/findAnchorFiber.js +60 -50
  20. package/lib/commonjs/anchors/fiber/findAnchorFiber.js.map +1 -1
  21. package/lib/commonjs/anchors/fiber/resolveFiberPath.js +220 -0
  22. package/lib/commonjs/anchors/fiber/resolveFiberPath.js.map +1 -0
  23. package/lib/commonjs/anchors/fiber/visibleRect.js +147 -0
  24. package/lib/commonjs/anchors/fiber/visibleRect.js.map +1 -0
  25. package/lib/commonjs/anchors/fiber/visibleScreens.js +73 -36
  26. package/lib/commonjs/anchors/fiber/visibleScreens.js.map +1 -1
  27. package/lib/commonjs/anchors/fiber/walkVisibleFibers.js +66 -0
  28. package/lib/commonjs/anchors/fiber/walkVisibleFibers.js.map +1 -0
  29. package/lib/commonjs/anchors/isInstanceOnVisibleScreen.js +51 -0
  30. package/lib/commonjs/anchors/isInstanceOnVisibleScreen.js.map +1 -0
  31. package/lib/commonjs/anchors/resolveAutoAnchorHost.js +22 -15
  32. package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -1
  33. package/lib/commonjs/anchors/semanticMatcher.js +26 -8
  34. package/lib/commonjs/anchors/semanticMatcher.js.map +1 -1
  35. package/lib/commonjs/anonymousId.js +4 -1
  36. package/lib/commonjs/anonymousId.js.map +1 -1
  37. package/lib/commonjs/authoring/ElementPickerOverlay.js +126 -50
  38. package/lib/commonjs/authoring/ElementPickerOverlay.js.map +1 -1
  39. package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js +32 -10
  40. package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js.map +1 -1
  41. package/lib/commonjs/authoring/chrome/ChromeButton.js +8 -3
  42. package/lib/commonjs/authoring/chrome/ChromeButton.js.map +1 -1
  43. package/lib/commonjs/authoring/chrome/ChromeIcon.js +4 -0
  44. package/lib/commonjs/authoring/chrome/ChromeIcon.js.map +1 -1
  45. package/lib/commonjs/authoring/chrome/ChromeTopBar.js +23 -10
  46. package/lib/commonjs/authoring/chrome/ChromeTopBar.js.map +1 -1
  47. package/lib/commonjs/authoring/chrome/DoubleTapBridge.js +19 -12
  48. package/lib/commonjs/authoring/chrome/DoubleTapBridge.js.map +1 -1
  49. package/lib/commonjs/authoring/chrome/doubleTapMonitor.js +10 -0
  50. package/lib/commonjs/authoring/chrome/doubleTapMonitor.js.map +1 -1
  51. package/lib/commonjs/authoring/chrome/icons/circle-exclamation.png +0 -0
  52. package/lib/commonjs/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
  53. package/lib/commonjs/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
  54. package/lib/commonjs/authoring/chrome/icons/triangle-exclamation.png +0 -0
  55. package/lib/commonjs/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
  56. package/lib/commonjs/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
  57. package/lib/commonjs/authoring/chrome/tokens.js +7 -6
  58. package/lib/commonjs/authoring/chrome/tokens.js.map +1 -1
  59. package/lib/commonjs/authoring/elementPickerController.js.map +1 -1
  60. package/lib/commonjs/authoring/fingerprintFromInstance.js +204 -4
  61. package/lib/commonjs/authoring/fingerprintFromInstance.js.map +1 -1
  62. package/lib/commonjs/authoring/hitTest.js +264 -16
  63. package/lib/commonjs/authoring/hitTest.js.map +1 -1
  64. package/lib/commonjs/authoring/hostAtPoint.js +204 -0
  65. package/lib/commonjs/authoring/hostAtPoint.js.map +1 -0
  66. package/lib/commonjs/content/BannerStepButton.js +68 -0
  67. package/lib/commonjs/content/BannerStepButton.js.map +1 -0
  68. package/lib/commonjs/content/buttonAppearance.js +16 -0
  69. package/lib/commonjs/content/buttonAppearance.js.map +1 -1
  70. package/lib/commonjs/content/resolveBannerButtonChrome.js +44 -0
  71. package/lib/commonjs/content/resolveBannerButtonChrome.js.map +1 -0
  72. package/lib/commonjs/content/themeColor.js +15 -0
  73. package/lib/commonjs/content/themeColor.js.map +1 -1
  74. package/lib/commonjs/deepLinking.js +4 -4
  75. package/lib/commonjs/evalJs/EvalJsHost.js +244 -0
  76. package/lib/commonjs/evalJs/EvalJsHost.js.map +1 -0
  77. package/lib/commonjs/evalJs/bootstrap.js +84 -0
  78. package/lib/commonjs/evalJs/bootstrap.js.map +1 -0
  79. package/lib/commonjs/evalJs/bridgeMessages.js +143 -0
  80. package/lib/commonjs/evalJs/bridgeMessages.js.map +1 -0
  81. package/lib/commonjs/evalJs/evalJsBridge.js +31 -0
  82. package/lib/commonjs/evalJs/evalJsBridge.js.map +1 -0
  83. package/lib/commonjs/evalJs/evalJsController.js +124 -0
  84. package/lib/commonjs/evalJs/evalJsController.js.map +1 -0
  85. package/lib/commonjs/evalJs/getWebView.js +81 -0
  86. package/lib/commonjs/evalJs/getWebView.js.map +1 -0
  87. package/lib/commonjs/evalJs/injectEvalPending.js +19 -0
  88. package/lib/commonjs/evalJs/injectEvalPending.js.map +1 -0
  89. package/lib/commonjs/evalJs/types.js +2 -0
  90. package/lib/commonjs/evalJs/types.js.map +1 -0
  91. package/lib/commonjs/evalJs/useEvalJsWebViewInjection.js +40 -0
  92. package/lib/commonjs/evalJs/useEvalJsWebViewInjection.js.map +1 -0
  93. package/lib/commonjs/expo-router/index.js +19 -0
  94. package/lib/commonjs/expo-router/index.js.map +1 -1
  95. package/lib/commonjs/expo-router/redirectSystemPath.js +75 -0
  96. package/lib/commonjs/expo-router/redirectSystemPath.js.map +1 -0
  97. package/lib/commonjs/expo-router/useUserflowExpoRouter.js +2 -2
  98. package/lib/commonjs/index.js +118 -43
  99. package/lib/commonjs/index.js.map +1 -1
  100. package/lib/commonjs/lifecycle.js.map +1 -1
  101. package/lib/commonjs/navigation/WithUserflowReactNavigation.js +14 -11
  102. package/lib/commonjs/navigation/WithUserflowReactNavigation.js.map +1 -1
  103. package/lib/commonjs/navigation/openFlowNavigateUrl.js +12 -5
  104. package/lib/commonjs/navigation/openFlowNavigateUrl.js.map +1 -1
  105. package/lib/commonjs/pairing/PairingController.js +245 -27
  106. package/lib/commonjs/pairing/PairingController.js.map +1 -1
  107. package/lib/commonjs/pairing/PreviewModeBanner.js +55 -16
  108. package/lib/commonjs/pairing/PreviewModeBanner.js.map +1 -1
  109. package/lib/commonjs/pairing/deepLink.js +22 -5
  110. package/lib/commonjs/pairing/deepLink.js.map +1 -1
  111. package/lib/commonjs/pairing/deviceId.js +47 -0
  112. package/lib/commonjs/pairing/deviceId.js.map +1 -0
  113. package/lib/commonjs/pairing/diagnostics.js +5 -4
  114. package/lib/commonjs/pairing/diagnostics.js.map +1 -1
  115. package/lib/commonjs/pairing/tokenStorage.js +47 -7
  116. package/lib/commonjs/pairing/tokenStorage.js.map +1 -1
  117. package/lib/commonjs/pairing/usePairingState.js +3 -1
  118. package/lib/commonjs/pairing/usePairingState.js.map +1 -1
  119. package/lib/commonjs/pairing/usePreviewBarHold.js +139 -0
  120. package/lib/commonjs/pairing/usePreviewBarHold.js.map +1 -0
  121. package/lib/commonjs/runtime/BannerHost.js +96 -0
  122. package/lib/commonjs/runtime/BannerHost.js.map +1 -0
  123. package/lib/commonjs/runtime/EmbedBannerPlaceholder.js +99 -0
  124. package/lib/commonjs/runtime/EmbedBannerPlaceholder.js.map +1 -0
  125. package/lib/commonjs/runtime/SdkErrorBoundary.js +61 -0
  126. package/lib/commonjs/runtime/SdkErrorBoundary.js.map +1 -0
  127. package/lib/commonjs/runtime/TargetPressBridge.js +19 -12
  128. package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
  129. package/lib/commonjs/runtime/UserflowOverlay.js +97 -0
  130. package/lib/commonjs/runtime/UserflowOverlay.js.map +1 -0
  131. package/lib/commonjs/runtime/UserflowProvider.js +135 -65
  132. package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
  133. package/lib/commonjs/runtime/bannerEngine.js +63 -0
  134. package/lib/commonjs/runtime/bannerEngine.js.map +1 -0
  135. package/lib/commonjs/runtime/bannerEngineContext.js +11 -0
  136. package/lib/commonjs/runtime/bannerEngineContext.js.map +1 -0
  137. package/lib/commonjs/runtime/bannerPlacement.js +37 -0
  138. package/lib/commonjs/runtime/bannerPlacement.js.map +1 -0
  139. package/lib/commonjs/runtime/embedBannerRegistry.js +30 -0
  140. package/lib/commonjs/runtime/embedBannerRegistry.js.map +1 -0
  141. package/lib/commonjs/runtime/flowEngine.js +75 -3
  142. package/lib/commonjs/runtime/flowEngine.js.map +1 -1
  143. package/lib/commonjs/runtime/isolateCall.js +48 -0
  144. package/lib/commonjs/runtime/isolateCall.js.map +1 -0
  145. package/lib/commonjs/runtime/reportSdkError.js +19 -0
  146. package/lib/commonjs/runtime/reportSdkError.js.map +1 -0
  147. package/lib/commonjs/runtime/useBannerSession.js +37 -0
  148. package/lib/commonjs/runtime/useBannerSession.js.map +1 -0
  149. package/lib/commonjs/screenTracker.js +34 -9
  150. package/lib/commonjs/screenTracker.js.map +1 -1
  151. package/lib/commonjs/surfaces/BannerBar.js +160 -0
  152. package/lib/commonjs/surfaces/BannerBar.js.map +1 -0
  153. package/lib/commonjs/surfaces/BannerSurface.js +78 -0
  154. package/lib/commonjs/surfaces/BannerSurface.js.map +1 -0
  155. package/lib/commonjs/surfaces/MadeWithUserflow.js +12 -8
  156. package/lib/commonjs/surfaces/MadeWithUserflow.js.map +1 -1
  157. package/lib/commonjs/surfaces/ModalSurface.js +1 -1
  158. package/lib/commonjs/surfaces/ModalSurface.js.map +1 -1
  159. package/lib/commonjs/surfaces/TooltipSurface.js +17 -1
  160. package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -1
  161. package/lib/commonjs/surfaces/bannerBarLayout.js +88 -0
  162. package/lib/commonjs/surfaces/bannerBarLayout.js.map +1 -0
  163. package/lib/commonjs/surfaces/bannerBarTokens.js +42 -0
  164. package/lib/commonjs/surfaces/bannerBarTokens.js.map +1 -0
  165. package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js +277 -0
  166. package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -0
  167. package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunEvalJs.js +46 -0
  168. package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunEvalJs.js.map +1 -0
  169. package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunSession.js +26 -0
  170. package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunSession.js.map +1 -0
  171. package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js +41 -0
  172. package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -0
  173. package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js +74 -0
  174. package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -0
  175. package/lib/commonjs/surfaces/bannerWebView/bannerWebFrameCss.js +152 -0
  176. package/lib/commonjs/surfaces/bannerWebView/bannerWebFrameCss.js.map +1 -0
  177. package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js +148 -0
  178. package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -0
  179. package/lib/commonjs/surfaces/bannerWebView/buttonClassName.js +13 -0
  180. package/lib/commonjs/surfaces/bannerWebView/buttonClassName.js.map +1 -0
  181. package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js +49 -0
  182. package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js.map +1 -0
  183. package/lib/commonjs/surfaces/bannerWebView/richContentDocToHtml.js +83 -0
  184. package/lib/commonjs/surfaces/bannerWebView/richContentDocToHtml.js.map +1 -0
  185. package/lib/commonjs/surfaces/resolveBannerTheme.js +22 -0
  186. package/lib/commonjs/surfaces/resolveBannerTheme.js.map +1 -0
  187. package/lib/commonjs/surfaces/safeArea.js +23 -0
  188. package/lib/commonjs/surfaces/safeArea.js.map +1 -1
  189. package/lib/commonjs/version.js +1 -1
  190. package/lib/module/anchors/AutoAnchorRegistry.js +37 -11
  191. package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -1
  192. package/lib/module/anchors/fiber/fiberPath.js +118 -0
  193. package/lib/module/anchors/fiber/fiberPath.js.map +1 -0
  194. package/lib/module/anchors/fiber/findAnchorFiber.js +60 -50
  195. package/lib/module/anchors/fiber/findAnchorFiber.js.map +1 -1
  196. package/lib/module/anchors/fiber/resolveFiberPath.js +215 -0
  197. package/lib/module/anchors/fiber/resolveFiberPath.js.map +1 -0
  198. package/lib/module/anchors/fiber/visibleRect.js +139 -0
  199. package/lib/module/anchors/fiber/visibleRect.js.map +1 -0
  200. package/lib/module/anchors/fiber/visibleScreens.js +73 -37
  201. package/lib/module/anchors/fiber/visibleScreens.js.map +1 -1
  202. package/lib/module/anchors/fiber/walkVisibleFibers.js +61 -0
  203. package/lib/module/anchors/fiber/walkVisibleFibers.js.map +1 -0
  204. package/lib/module/anchors/isInstanceOnVisibleScreen.js +46 -0
  205. package/lib/module/anchors/isInstanceOnVisibleScreen.js.map +1 -0
  206. package/lib/module/anchors/resolveAutoAnchorHost.js +22 -15
  207. package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -1
  208. package/lib/module/anchors/semanticMatcher.js +26 -9
  209. package/lib/module/anchors/semanticMatcher.js.map +1 -1
  210. package/lib/module/anonymousId.js +4 -2
  211. package/lib/module/anonymousId.js.map +1 -1
  212. package/lib/module/authoring/ElementPickerOverlay.js +128 -52
  213. package/lib/module/authoring/ElementPickerOverlay.js.map +1 -1
  214. package/lib/module/authoring/chrome/ChromeBottomSheet.js +32 -10
  215. package/lib/module/authoring/chrome/ChromeBottomSheet.js.map +1 -1
  216. package/lib/module/authoring/chrome/ChromeButton.js +8 -3
  217. package/lib/module/authoring/chrome/ChromeButton.js.map +1 -1
  218. package/lib/module/authoring/chrome/ChromeIcon.js +4 -0
  219. package/lib/module/authoring/chrome/ChromeIcon.js.map +1 -1
  220. package/lib/module/authoring/chrome/ChromeTopBar.js +23 -10
  221. package/lib/module/authoring/chrome/ChromeTopBar.js.map +1 -1
  222. package/lib/module/authoring/chrome/DoubleTapBridge.js +19 -12
  223. package/lib/module/authoring/chrome/DoubleTapBridge.js.map +1 -1
  224. package/lib/module/authoring/chrome/doubleTapMonitor.js +10 -0
  225. package/lib/module/authoring/chrome/doubleTapMonitor.js.map +1 -1
  226. package/lib/module/authoring/chrome/icons/circle-exclamation.png +0 -0
  227. package/lib/module/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
  228. package/lib/module/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
  229. package/lib/module/authoring/chrome/icons/triangle-exclamation.png +0 -0
  230. package/lib/module/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
  231. package/lib/module/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
  232. package/lib/module/authoring/chrome/tokens.js +7 -6
  233. package/lib/module/authoring/chrome/tokens.js.map +1 -1
  234. package/lib/module/authoring/elementPickerController.js.map +1 -1
  235. package/lib/module/authoring/fingerprintFromInstance.js +198 -4
  236. package/lib/module/authoring/fingerprintFromInstance.js.map +1 -1
  237. package/lib/module/authoring/hitTest.js +264 -18
  238. package/lib/module/authoring/hitTest.js.map +1 -1
  239. package/lib/module/authoring/hostAtPoint.js +199 -0
  240. package/lib/module/authoring/hostAtPoint.js.map +1 -0
  241. package/lib/module/content/BannerStepButton.js +63 -0
  242. package/lib/module/content/BannerStepButton.js.map +1 -0
  243. package/lib/module/content/buttonAppearance.js +14 -0
  244. package/lib/module/content/buttonAppearance.js.map +1 -1
  245. package/lib/module/content/resolveBannerButtonChrome.js +41 -0
  246. package/lib/module/content/resolveBannerButtonChrome.js.map +1 -0
  247. package/lib/module/content/themeColor.js +14 -0
  248. package/lib/module/content/themeColor.js.map +1 -1
  249. package/lib/module/deepLinking.js +4 -4
  250. package/lib/module/evalJs/EvalJsHost.js +239 -0
  251. package/lib/module/evalJs/EvalJsHost.js.map +1 -0
  252. package/lib/module/evalJs/bootstrap.js +76 -0
  253. package/lib/module/evalJs/bootstrap.js.map +1 -0
  254. package/lib/module/evalJs/bridgeMessages.js +139 -0
  255. package/lib/module/evalJs/bridgeMessages.js.map +1 -0
  256. package/lib/module/evalJs/evalJsBridge.js +25 -0
  257. package/lib/module/evalJs/evalJsBridge.js.map +1 -0
  258. package/lib/module/evalJs/evalJsController.js +119 -0
  259. package/lib/module/evalJs/evalJsController.js.map +1 -0
  260. package/lib/module/evalJs/getWebView.js +76 -0
  261. package/lib/module/evalJs/getWebView.js.map +1 -0
  262. package/lib/module/evalJs/injectEvalPending.js +15 -0
  263. package/lib/module/evalJs/injectEvalPending.js.map +1 -0
  264. package/lib/module/evalJs/types.js +2 -0
  265. package/lib/module/evalJs/types.js.map +1 -0
  266. package/lib/module/evalJs/useEvalJsWebViewInjection.js +35 -0
  267. package/lib/module/evalJs/useEvalJsWebViewInjection.js.map +1 -0
  268. package/lib/module/expo-router/index.js +1 -0
  269. package/lib/module/expo-router/index.js.map +1 -1
  270. package/lib/module/expo-router/redirectSystemPath.js +70 -0
  271. package/lib/module/expo-router/redirectSystemPath.js.map +1 -0
  272. package/lib/module/expo-router/useUserflowExpoRouter.js +2 -2
  273. package/lib/module/index.js +114 -45
  274. package/lib/module/index.js.map +1 -1
  275. package/lib/module/lifecycle.js.map +1 -1
  276. package/lib/module/navigation/WithUserflowReactNavigation.js +14 -11
  277. package/lib/module/navigation/WithUserflowReactNavigation.js.map +1 -1
  278. package/lib/module/navigation/openFlowNavigateUrl.js +12 -5
  279. package/lib/module/navigation/openFlowNavigateUrl.js.map +1 -1
  280. package/lib/module/pairing/PairingController.js +245 -27
  281. package/lib/module/pairing/PairingController.js.map +1 -1
  282. package/lib/module/pairing/PreviewModeBanner.js +54 -16
  283. package/lib/module/pairing/PreviewModeBanner.js.map +1 -1
  284. package/lib/module/pairing/deepLink.js +21 -5
  285. package/lib/module/pairing/deepLink.js.map +1 -1
  286. package/lib/module/pairing/deviceId.js +41 -0
  287. package/lib/module/pairing/deviceId.js.map +1 -0
  288. package/lib/module/pairing/diagnostics.js +5 -4
  289. package/lib/module/pairing/diagnostics.js.map +1 -1
  290. package/lib/module/pairing/tokenStorage.js +47 -7
  291. package/lib/module/pairing/tokenStorage.js.map +1 -1
  292. package/lib/module/pairing/usePairingState.js +3 -1
  293. package/lib/module/pairing/usePairingState.js.map +1 -1
  294. package/lib/module/pairing/usePreviewBarHold.js +134 -0
  295. package/lib/module/pairing/usePreviewBarHold.js.map +1 -0
  296. package/lib/module/runtime/BannerHost.js +92 -0
  297. package/lib/module/runtime/BannerHost.js.map +1 -0
  298. package/lib/module/runtime/EmbedBannerPlaceholder.js +94 -0
  299. package/lib/module/runtime/EmbedBannerPlaceholder.js.map +1 -0
  300. package/lib/module/runtime/SdkErrorBoundary.js +55 -0
  301. package/lib/module/runtime/SdkErrorBoundary.js.map +1 -0
  302. package/lib/module/runtime/TargetPressBridge.js +19 -12
  303. package/lib/module/runtime/TargetPressBridge.js.map +1 -1
  304. package/lib/module/runtime/UserflowOverlay.js +92 -0
  305. package/lib/module/runtime/UserflowOverlay.js.map +1 -0
  306. package/lib/module/runtime/UserflowProvider.js +136 -66
  307. package/lib/module/runtime/UserflowProvider.js.map +1 -1
  308. package/lib/module/runtime/bannerEngine.js +55 -0
  309. package/lib/module/runtime/bannerEngine.js.map +1 -0
  310. package/lib/module/runtime/bannerEngineContext.js +7 -0
  311. package/lib/module/runtime/bannerEngineContext.js.map +1 -0
  312. package/lib/module/runtime/bannerPlacement.js +30 -0
  313. package/lib/module/runtime/bannerPlacement.js.map +1 -0
  314. package/lib/module/runtime/embedBannerRegistry.js +24 -0
  315. package/lib/module/runtime/embedBannerRegistry.js.map +1 -0
  316. package/lib/module/runtime/flowEngine.js +72 -3
  317. package/lib/module/runtime/flowEngine.js.map +1 -1
  318. package/lib/module/runtime/isolateCall.js +43 -0
  319. package/lib/module/runtime/isolateCall.js.map +1 -0
  320. package/lib/module/runtime/reportSdkError.js +15 -0
  321. package/lib/module/runtime/reportSdkError.js.map +1 -0
  322. package/lib/module/runtime/useBannerSession.js +33 -0
  323. package/lib/module/runtime/useBannerSession.js.map +1 -0
  324. package/lib/module/screenTracker.js +33 -9
  325. package/lib/module/screenTracker.js.map +1 -1
  326. package/lib/module/surfaces/BannerBar.js +155 -0
  327. package/lib/module/surfaces/BannerBar.js.map +1 -0
  328. package/lib/module/surfaces/BannerSurface.js +72 -0
  329. package/lib/module/surfaces/BannerSurface.js.map +1 -0
  330. package/lib/module/surfaces/MadeWithUserflow.js +11 -7
  331. package/lib/module/surfaces/MadeWithUserflow.js.map +1 -1
  332. package/lib/module/surfaces/ModalSurface.js +1 -1
  333. package/lib/module/surfaces/ModalSurface.js.map +1 -1
  334. package/lib/module/surfaces/TooltipSurface.js +17 -1
  335. package/lib/module/surfaces/TooltipSurface.js.map +1 -1
  336. package/lib/module/surfaces/bannerBarLayout.js +69 -0
  337. package/lib/module/surfaces/bannerBarLayout.js.map +1 -0
  338. package/lib/module/surfaces/bannerBarTokens.js +37 -0
  339. package/lib/module/surfaces/bannerBarTokens.js.map +1 -0
  340. package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js +272 -0
  341. package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -0
  342. package/lib/module/surfaces/bannerWebView/bannerAutoRunEvalJs.js +42 -0
  343. package/lib/module/surfaces/bannerWebView/bannerAutoRunEvalJs.js.map +1 -0
  344. package/lib/module/surfaces/bannerWebView/bannerAutoRunSession.js +19 -0
  345. package/lib/module/surfaces/bannerWebView/bannerAutoRunSession.js.map +1 -0
  346. package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js +35 -0
  347. package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -0
  348. package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js +69 -0
  349. package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -0
  350. package/lib/module/surfaces/bannerWebView/bannerWebFrameCss.js +148 -0
  351. package/lib/module/surfaces/bannerWebView/bannerWebFrameCss.js.map +1 -0
  352. package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js +143 -0
  353. package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -0
  354. package/lib/module/surfaces/bannerWebView/buttonClassName.js +9 -0
  355. package/lib/module/surfaces/bannerWebView/buttonClassName.js.map +1 -0
  356. package/lib/module/surfaces/bannerWebView/resolveCdnHost.js +42 -0
  357. package/lib/module/surfaces/bannerWebView/resolveCdnHost.js.map +1 -0
  358. package/lib/module/surfaces/bannerWebView/richContentDocToHtml.js +79 -0
  359. package/lib/module/surfaces/bannerWebView/richContentDocToHtml.js.map +1 -0
  360. package/lib/module/surfaces/resolveBannerTheme.js +16 -0
  361. package/lib/module/surfaces/resolveBannerTheme.js.map +1 -0
  362. package/lib/module/surfaces/safeArea.js +22 -0
  363. package/lib/module/surfaces/safeArea.js.map +1 -1
  364. package/lib/module/version.js +1 -1
  365. package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +14 -0
  366. package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
  367. package/lib/typescript/commonjs/src/anchors/fiber/fiberPath.d.ts +12 -0
  368. package/lib/typescript/commonjs/src/anchors/fiber/fiberPath.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts +5 -4
  370. package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
  371. package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts +24 -0
  372. package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -0
  373. package/lib/typescript/commonjs/src/anchors/fiber/visibleRect.d.ts +32 -0
  374. package/lib/typescript/commonjs/src/anchors/fiber/visibleRect.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts +6 -1
  376. package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
  377. package/lib/typescript/commonjs/src/anchors/fiber/walkVisibleFibers.d.ts +20 -0
  378. package/lib/typescript/commonjs/src/anchors/fiber/walkVisibleFibers.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/src/anchors/isInstanceOnVisibleScreen.d.ts +19 -0
  380. package/lib/typescript/commonjs/src/anchors/isInstanceOnVisibleScreen.d.ts.map +1 -0
  381. package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
  382. package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts +6 -4
  383. package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts.map +1 -1
  384. package/lib/typescript/commonjs/src/anonymousId.d.ts +1 -0
  385. package/lib/typescript/commonjs/src/anonymousId.d.ts.map +1 -1
  386. package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts +1 -0
  387. package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts.map +1 -1
  388. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts +14 -3
  389. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts.map +1 -1
  391. package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts +1 -1
  392. package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts +12 -4
  394. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -1
  396. package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts +5 -0
  397. package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -1
  398. package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts +7 -6
  399. package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts.map +1 -1
  400. package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts +2 -3
  401. package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts.map +1 -1
  402. package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts +57 -2
  403. package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
  404. package/lib/typescript/commonjs/src/authoring/hitTest.d.ts +47 -3
  405. package/lib/typescript/commonjs/src/authoring/hitTest.d.ts.map +1 -1
  406. package/lib/typescript/commonjs/src/authoring/hostAtPoint.d.ts +7 -0
  407. package/lib/typescript/commonjs/src/authoring/hostAtPoint.d.ts.map +1 -0
  408. package/lib/typescript/commonjs/src/content/BannerStepButton.d.ts +14 -0
  409. package/lib/typescript/commonjs/src/content/BannerStepButton.d.ts.map +1 -0
  410. package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts +4 -0
  411. package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts.map +1 -1
  412. package/lib/typescript/commonjs/src/content/resolveBannerButtonChrome.d.ts +8 -0
  413. package/lib/typescript/commonjs/src/content/resolveBannerButtonChrome.d.ts.map +1 -0
  414. package/lib/typescript/commonjs/src/content/themeColor.d.ts +2 -0
  415. package/lib/typescript/commonjs/src/content/themeColor.d.ts.map +1 -1
  416. package/lib/typescript/commonjs/src/content/types.d.ts +1 -0
  417. package/lib/typescript/commonjs/src/content/types.d.ts.map +1 -1
  418. package/lib/typescript/commonjs/src/deepLinking.d.ts +4 -4
  419. package/lib/typescript/commonjs/src/evalJs/EvalJsHost.d.ts +14 -0
  420. package/lib/typescript/commonjs/src/evalJs/EvalJsHost.d.ts.map +1 -0
  421. package/lib/typescript/commonjs/src/evalJs/bootstrap.d.ts +18 -0
  422. package/lib/typescript/commonjs/src/evalJs/bootstrap.d.ts.map +1 -0
  423. package/lib/typescript/commonjs/src/evalJs/bridgeMessages.d.ts +37 -0
  424. package/lib/typescript/commonjs/src/evalJs/bridgeMessages.d.ts.map +1 -0
  425. package/lib/typescript/commonjs/src/evalJs/evalJsBridge.d.ts +16 -0
  426. package/lib/typescript/commonjs/src/evalJs/evalJsBridge.d.ts.map +1 -0
  427. package/lib/typescript/commonjs/src/evalJs/evalJsController.d.ts +24 -0
  428. package/lib/typescript/commonjs/src/evalJs/evalJsController.d.ts.map +1 -0
  429. package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts +64 -0
  430. package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts.map +1 -0
  431. package/lib/typescript/commonjs/src/evalJs/injectEvalPending.d.ts +4 -0
  432. package/lib/typescript/commonjs/src/evalJs/injectEvalPending.d.ts.map +1 -0
  433. package/lib/typescript/commonjs/src/evalJs/types.d.ts +53 -0
  434. package/lib/typescript/commonjs/src/evalJs/types.d.ts.map +1 -0
  435. package/lib/typescript/commonjs/src/evalJs/useEvalJsWebViewInjection.d.ts +12 -0
  436. package/lib/typescript/commonjs/src/evalJs/useEvalJsWebViewInjection.d.ts.map +1 -0
  437. package/lib/typescript/commonjs/src/expo-router/index.d.ts +1 -0
  438. package/lib/typescript/commonjs/src/expo-router/index.d.ts.map +1 -1
  439. package/lib/typescript/commonjs/src/expo-router/redirectSystemPath.d.ts +50 -0
  440. package/lib/typescript/commonjs/src/expo-router/redirectSystemPath.d.ts.map +1 -0
  441. package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts +2 -2
  442. package/lib/typescript/commonjs/src/index.d.ts +16 -1
  443. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  444. package/lib/typescript/commonjs/src/lifecycle.d.ts +4 -1
  445. package/lib/typescript/commonjs/src/lifecycle.d.ts.map +1 -1
  446. package/lib/typescript/commonjs/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
  447. package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
  448. package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +71 -4
  449. package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -1
  450. package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts +9 -1
  451. package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts.map +1 -1
  452. package/lib/typescript/commonjs/src/pairing/deepLink.d.ts +6 -2
  453. package/lib/typescript/commonjs/src/pairing/deepLink.d.ts.map +1 -1
  454. package/lib/typescript/commonjs/src/pairing/deviceId.d.ts +12 -0
  455. package/lib/typescript/commonjs/src/pairing/deviceId.d.ts.map +1 -0
  456. package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts +3 -2
  457. package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts.map +1 -1
  458. package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts +14 -2
  459. package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -1
  460. package/lib/typescript/commonjs/src/pairing/usePairingState.d.ts.map +1 -1
  461. package/lib/typescript/commonjs/src/pairing/usePreviewBarHold.d.ts +19 -0
  462. package/lib/typescript/commonjs/src/pairing/usePreviewBarHold.d.ts.map +1 -0
  463. package/lib/typescript/commonjs/src/runtime/BannerHost.d.ts +16 -0
  464. package/lib/typescript/commonjs/src/runtime/BannerHost.d.ts.map +1 -0
  465. package/lib/typescript/commonjs/src/runtime/EmbedBannerPlaceholder.d.ts +18 -0
  466. package/lib/typescript/commonjs/src/runtime/EmbedBannerPlaceholder.d.ts.map +1 -0
  467. package/lib/typescript/commonjs/src/runtime/SdkErrorBoundary.d.ts +34 -0
  468. package/lib/typescript/commonjs/src/runtime/SdkErrorBoundary.d.ts.map +1 -0
  469. package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
  470. package/lib/typescript/commonjs/src/runtime/UserflowOverlay.d.ts +15 -0
  471. package/lib/typescript/commonjs/src/runtime/UserflowOverlay.d.ts.map +1 -0
  472. package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts +9 -3
  473. package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
  474. package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts +12 -0
  475. package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts.map +1 -0
  476. package/lib/typescript/commonjs/src/runtime/bannerEngineContext.d.ts +5 -0
  477. package/lib/typescript/commonjs/src/runtime/bannerEngineContext.d.ts.map +1 -0
  478. package/lib/typescript/commonjs/src/runtime/bannerPlacement.d.ts +12 -0
  479. package/lib/typescript/commonjs/src/runtime/bannerPlacement.d.ts.map +1 -0
  480. package/lib/typescript/commonjs/src/runtime/embedBannerRegistry.d.ts +5 -0
  481. package/lib/typescript/commonjs/src/runtime/embedBannerRegistry.d.ts.map +1 -0
  482. package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts +25 -1
  483. package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -1
  484. package/lib/typescript/commonjs/src/runtime/isolateCall.d.ts +20 -0
  485. package/lib/typescript/commonjs/src/runtime/isolateCall.d.ts.map +1 -0
  486. package/lib/typescript/commonjs/src/runtime/reportSdkError.d.ts +10 -0
  487. package/lib/typescript/commonjs/src/runtime/reportSdkError.d.ts.map +1 -0
  488. package/lib/typescript/commonjs/src/runtime/useBannerSession.d.ts +5 -0
  489. package/lib/typescript/commonjs/src/runtime/useBannerSession.d.ts.map +1 -0
  490. package/lib/typescript/commonjs/src/screenTracker.d.ts +7 -3
  491. package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -1
  492. package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts +14 -0
  493. package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts.map +1 -0
  494. package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts +15 -0
  495. package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts.map +1 -0
  496. package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts +10 -6
  497. package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts.map +1 -1
  498. package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -1
  499. package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts +15 -0
  500. package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts.map +1 -0
  501. package/lib/typescript/commonjs/src/surfaces/bannerBarTokens.d.ts +20 -0
  502. package/lib/typescript/commonjs/src/surfaces/bannerBarTokens.d.ts.map +1 -0
  503. package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +10 -0
  504. package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -0
  505. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts +7 -0
  506. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts.map +1 -0
  507. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts +6 -0
  508. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts.map +1 -0
  509. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +13 -0
  510. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -0
  511. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerThemeStyles.d.ts +5 -0
  512. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -0
  513. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts +6 -0
  514. package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts.map +1 -0
  515. package/lib/typescript/commonjs/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts +9 -0
  516. package/lib/typescript/commonjs/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -0
  517. package/lib/typescript/commonjs/src/surfaces/bannerWebView/buttonClassName.d.ts +3 -0
  518. package/lib/typescript/commonjs/src/surfaces/bannerWebView/buttonClassName.d.ts.map +1 -0
  519. package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts +10 -0
  520. package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -0
  521. package/lib/typescript/commonjs/src/surfaces/bannerWebView/richContentDocToHtml.d.ts +3 -0
  522. package/lib/typescript/commonjs/src/surfaces/bannerWebView/richContentDocToHtml.d.ts.map +1 -0
  523. package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts +7 -0
  524. package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts.map +1 -0
  525. package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +6 -0
  526. package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -1
  527. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  528. package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +14 -0
  529. package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
  530. package/lib/typescript/module/src/anchors/fiber/fiberPath.d.ts +12 -0
  531. package/lib/typescript/module/src/anchors/fiber/fiberPath.d.ts.map +1 -0
  532. package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts +5 -4
  533. package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
  534. package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts +24 -0
  535. package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -0
  536. package/lib/typescript/module/src/anchors/fiber/visibleRect.d.ts +32 -0
  537. package/lib/typescript/module/src/anchors/fiber/visibleRect.d.ts.map +1 -0
  538. package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts +6 -1
  539. package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
  540. package/lib/typescript/module/src/anchors/fiber/walkVisibleFibers.d.ts +20 -0
  541. package/lib/typescript/module/src/anchors/fiber/walkVisibleFibers.d.ts.map +1 -0
  542. package/lib/typescript/module/src/anchors/isInstanceOnVisibleScreen.d.ts +19 -0
  543. package/lib/typescript/module/src/anchors/isInstanceOnVisibleScreen.d.ts.map +1 -0
  544. package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
  545. package/lib/typescript/module/src/anchors/semanticMatcher.d.ts +6 -4
  546. package/lib/typescript/module/src/anchors/semanticMatcher.d.ts.map +1 -1
  547. package/lib/typescript/module/src/anonymousId.d.ts +1 -0
  548. package/lib/typescript/module/src/anonymousId.d.ts.map +1 -1
  549. package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts +1 -0
  550. package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts.map +1 -1
  551. package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts +14 -3
  552. package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -1
  553. package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts.map +1 -1
  554. package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts +1 -1
  555. package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts.map +1 -1
  556. package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts +12 -4
  557. package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -1
  558. package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -1
  559. package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts +5 -0
  560. package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -1
  561. package/lib/typescript/module/src/authoring/chrome/tokens.d.ts +7 -6
  562. package/lib/typescript/module/src/authoring/chrome/tokens.d.ts.map +1 -1
  563. package/lib/typescript/module/src/authoring/elementPickerController.d.ts +2 -3
  564. package/lib/typescript/module/src/authoring/elementPickerController.d.ts.map +1 -1
  565. package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts +57 -2
  566. package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
  567. package/lib/typescript/module/src/authoring/hitTest.d.ts +47 -3
  568. package/lib/typescript/module/src/authoring/hitTest.d.ts.map +1 -1
  569. package/lib/typescript/module/src/authoring/hostAtPoint.d.ts +7 -0
  570. package/lib/typescript/module/src/authoring/hostAtPoint.d.ts.map +1 -0
  571. package/lib/typescript/module/src/content/BannerStepButton.d.ts +14 -0
  572. package/lib/typescript/module/src/content/BannerStepButton.d.ts.map +1 -0
  573. package/lib/typescript/module/src/content/buttonAppearance.d.ts +4 -0
  574. package/lib/typescript/module/src/content/buttonAppearance.d.ts.map +1 -1
  575. package/lib/typescript/module/src/content/resolveBannerButtonChrome.d.ts +8 -0
  576. package/lib/typescript/module/src/content/resolveBannerButtonChrome.d.ts.map +1 -0
  577. package/lib/typescript/module/src/content/themeColor.d.ts +2 -0
  578. package/lib/typescript/module/src/content/themeColor.d.ts.map +1 -1
  579. package/lib/typescript/module/src/content/types.d.ts +1 -0
  580. package/lib/typescript/module/src/content/types.d.ts.map +1 -1
  581. package/lib/typescript/module/src/deepLinking.d.ts +4 -4
  582. package/lib/typescript/module/src/evalJs/EvalJsHost.d.ts +14 -0
  583. package/lib/typescript/module/src/evalJs/EvalJsHost.d.ts.map +1 -0
  584. package/lib/typescript/module/src/evalJs/bootstrap.d.ts +18 -0
  585. package/lib/typescript/module/src/evalJs/bootstrap.d.ts.map +1 -0
  586. package/lib/typescript/module/src/evalJs/bridgeMessages.d.ts +37 -0
  587. package/lib/typescript/module/src/evalJs/bridgeMessages.d.ts.map +1 -0
  588. package/lib/typescript/module/src/evalJs/evalJsBridge.d.ts +16 -0
  589. package/lib/typescript/module/src/evalJs/evalJsBridge.d.ts.map +1 -0
  590. package/lib/typescript/module/src/evalJs/evalJsController.d.ts +24 -0
  591. package/lib/typescript/module/src/evalJs/evalJsController.d.ts.map +1 -0
  592. package/lib/typescript/module/src/evalJs/getWebView.d.ts +64 -0
  593. package/lib/typescript/module/src/evalJs/getWebView.d.ts.map +1 -0
  594. package/lib/typescript/module/src/evalJs/injectEvalPending.d.ts +4 -0
  595. package/lib/typescript/module/src/evalJs/injectEvalPending.d.ts.map +1 -0
  596. package/lib/typescript/module/src/evalJs/types.d.ts +53 -0
  597. package/lib/typescript/module/src/evalJs/types.d.ts.map +1 -0
  598. package/lib/typescript/module/src/evalJs/useEvalJsWebViewInjection.d.ts +12 -0
  599. package/lib/typescript/module/src/evalJs/useEvalJsWebViewInjection.d.ts.map +1 -0
  600. package/lib/typescript/module/src/expo-router/index.d.ts +1 -0
  601. package/lib/typescript/module/src/expo-router/index.d.ts.map +1 -1
  602. package/lib/typescript/module/src/expo-router/redirectSystemPath.d.ts +50 -0
  603. package/lib/typescript/module/src/expo-router/redirectSystemPath.d.ts.map +1 -0
  604. package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts +2 -2
  605. package/lib/typescript/module/src/index.d.ts +16 -1
  606. package/lib/typescript/module/src/index.d.ts.map +1 -1
  607. package/lib/typescript/module/src/lifecycle.d.ts +4 -1
  608. package/lib/typescript/module/src/lifecycle.d.ts.map +1 -1
  609. package/lib/typescript/module/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
  610. package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
  611. package/lib/typescript/module/src/pairing/PairingController.d.ts +71 -4
  612. package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -1
  613. package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts +9 -1
  614. package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts.map +1 -1
  615. package/lib/typescript/module/src/pairing/deepLink.d.ts +6 -2
  616. package/lib/typescript/module/src/pairing/deepLink.d.ts.map +1 -1
  617. package/lib/typescript/module/src/pairing/deviceId.d.ts +12 -0
  618. package/lib/typescript/module/src/pairing/deviceId.d.ts.map +1 -0
  619. package/lib/typescript/module/src/pairing/diagnostics.d.ts +3 -2
  620. package/lib/typescript/module/src/pairing/diagnostics.d.ts.map +1 -1
  621. package/lib/typescript/module/src/pairing/tokenStorage.d.ts +14 -2
  622. package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -1
  623. package/lib/typescript/module/src/pairing/usePairingState.d.ts.map +1 -1
  624. package/lib/typescript/module/src/pairing/usePreviewBarHold.d.ts +19 -0
  625. package/lib/typescript/module/src/pairing/usePreviewBarHold.d.ts.map +1 -0
  626. package/lib/typescript/module/src/runtime/BannerHost.d.ts +16 -0
  627. package/lib/typescript/module/src/runtime/BannerHost.d.ts.map +1 -0
  628. package/lib/typescript/module/src/runtime/EmbedBannerPlaceholder.d.ts +18 -0
  629. package/lib/typescript/module/src/runtime/EmbedBannerPlaceholder.d.ts.map +1 -0
  630. package/lib/typescript/module/src/runtime/SdkErrorBoundary.d.ts +34 -0
  631. package/lib/typescript/module/src/runtime/SdkErrorBoundary.d.ts.map +1 -0
  632. package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
  633. package/lib/typescript/module/src/runtime/UserflowOverlay.d.ts +15 -0
  634. package/lib/typescript/module/src/runtime/UserflowOverlay.d.ts.map +1 -0
  635. package/lib/typescript/module/src/runtime/UserflowProvider.d.ts +9 -3
  636. package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
  637. package/lib/typescript/module/src/runtime/bannerEngine.d.ts +12 -0
  638. package/lib/typescript/module/src/runtime/bannerEngine.d.ts.map +1 -0
  639. package/lib/typescript/module/src/runtime/bannerEngineContext.d.ts +5 -0
  640. package/lib/typescript/module/src/runtime/bannerEngineContext.d.ts.map +1 -0
  641. package/lib/typescript/module/src/runtime/bannerPlacement.d.ts +12 -0
  642. package/lib/typescript/module/src/runtime/bannerPlacement.d.ts.map +1 -0
  643. package/lib/typescript/module/src/runtime/embedBannerRegistry.d.ts +5 -0
  644. package/lib/typescript/module/src/runtime/embedBannerRegistry.d.ts.map +1 -0
  645. package/lib/typescript/module/src/runtime/flowEngine.d.ts +25 -1
  646. package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -1
  647. package/lib/typescript/module/src/runtime/isolateCall.d.ts +20 -0
  648. package/lib/typescript/module/src/runtime/isolateCall.d.ts.map +1 -0
  649. package/lib/typescript/module/src/runtime/reportSdkError.d.ts +10 -0
  650. package/lib/typescript/module/src/runtime/reportSdkError.d.ts.map +1 -0
  651. package/lib/typescript/module/src/runtime/useBannerSession.d.ts +5 -0
  652. package/lib/typescript/module/src/runtime/useBannerSession.d.ts.map +1 -0
  653. package/lib/typescript/module/src/screenTracker.d.ts +7 -3
  654. package/lib/typescript/module/src/screenTracker.d.ts.map +1 -1
  655. package/lib/typescript/module/src/surfaces/BannerBar.d.ts +14 -0
  656. package/lib/typescript/module/src/surfaces/BannerBar.d.ts.map +1 -0
  657. package/lib/typescript/module/src/surfaces/BannerSurface.d.ts +15 -0
  658. package/lib/typescript/module/src/surfaces/BannerSurface.d.ts.map +1 -0
  659. package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts +10 -6
  660. package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts.map +1 -1
  661. package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -1
  662. package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts +15 -0
  663. package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts.map +1 -0
  664. package/lib/typescript/module/src/surfaces/bannerBarTokens.d.ts +20 -0
  665. package/lib/typescript/module/src/surfaces/bannerBarTokens.d.ts.map +1 -0
  666. package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +10 -0
  667. package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -0
  668. package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts +7 -0
  669. package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts.map +1 -0
  670. package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts +6 -0
  671. package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts.map +1 -0
  672. package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +13 -0
  673. package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -0
  674. package/lib/typescript/module/src/surfaces/bannerWebView/bannerThemeStyles.d.ts +5 -0
  675. package/lib/typescript/module/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -0
  676. package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts +6 -0
  677. package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts.map +1 -0
  678. package/lib/typescript/module/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts +9 -0
  679. package/lib/typescript/module/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -0
  680. package/lib/typescript/module/src/surfaces/bannerWebView/buttonClassName.d.ts +3 -0
  681. package/lib/typescript/module/src/surfaces/bannerWebView/buttonClassName.d.ts.map +1 -0
  682. package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts +10 -0
  683. package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -0
  684. package/lib/typescript/module/src/surfaces/bannerWebView/richContentDocToHtml.d.ts +3 -0
  685. package/lib/typescript/module/src/surfaces/bannerWebView/richContentDocToHtml.d.ts.map +1 -0
  686. package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts +7 -0
  687. package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts.map +1 -0
  688. package/lib/typescript/module/src/surfaces/safeArea.d.ts +6 -0
  689. package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -1
  690. package/lib/typescript/module/src/version.d.ts +1 -1
  691. package/package.json +4 -3
  692. package/src/anchors/AutoAnchorRegistry.ts +41 -11
  693. package/src/anchors/fiber/fiberPath.ts +117 -0
  694. package/src/anchors/fiber/findAnchorFiber.ts +57 -47
  695. package/src/anchors/fiber/resolveFiberPath.ts +215 -0
  696. package/src/anchors/fiber/visibleRect.ts +153 -0
  697. package/src/anchors/fiber/visibleScreens.ts +74 -36
  698. package/src/anchors/fiber/walkVisibleFibers.ts +65 -0
  699. package/src/anchors/isInstanceOnVisibleScreen.ts +55 -0
  700. package/src/anchors/resolveAutoAnchorHost.ts +17 -15
  701. package/src/anchors/semanticMatcher.ts +38 -14
  702. package/src/anonymousId.ts +2 -1
  703. package/src/authoring/ElementPickerOverlay.tsx +168 -59
  704. package/src/authoring/chrome/ChromeBottomSheet.tsx +49 -8
  705. package/src/authoring/chrome/ChromeButton.tsx +9 -4
  706. package/src/authoring/chrome/ChromeIcon.tsx +10 -1
  707. package/src/authoring/chrome/ChromeTopBar.tsx +39 -15
  708. package/src/authoring/chrome/DoubleTapBridge.tsx +19 -12
  709. package/src/authoring/chrome/doubleTapMonitor.ts +10 -0
  710. package/src/authoring/chrome/icons/circle-exclamation.png +0 -0
  711. package/src/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
  712. package/src/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
  713. package/src/authoring/chrome/icons/triangle-exclamation.png +0 -0
  714. package/src/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
  715. package/src/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
  716. package/src/authoring/chrome/tokens.ts +7 -2
  717. package/src/authoring/elementPickerController.ts +2 -4
  718. package/src/authoring/fingerprintFromInstance.ts +170 -4
  719. package/src/authoring/hitTest.ts +324 -16
  720. package/src/authoring/hostAtPoint.ts +247 -0
  721. package/src/content/BannerStepButton.tsx +91 -0
  722. package/src/content/buttonAppearance.ts +16 -0
  723. package/src/content/resolveBannerButtonChrome.ts +49 -0
  724. package/src/content/themeColor.ts +15 -0
  725. package/src/content/types.ts +1 -0
  726. package/src/deepLinking.ts +4 -4
  727. package/src/evalJs/EvalJsHost.tsx +255 -0
  728. package/src/evalJs/bootstrap.ts +83 -0
  729. package/src/evalJs/bridgeMessages.ts +134 -0
  730. package/src/evalJs/evalJsBridge.ts +42 -0
  731. package/src/evalJs/evalJsController.ts +127 -0
  732. package/src/evalJs/getWebView.ts +124 -0
  733. package/src/evalJs/injectEvalPending.ts +14 -0
  734. package/src/evalJs/types.ts +56 -0
  735. package/src/evalJs/useEvalJsWebViewInjection.ts +37 -0
  736. package/src/expo-router/index.ts +8 -0
  737. package/src/expo-router/redirectSystemPath.ts +86 -0
  738. package/src/expo-router/useUserflowExpoRouter.ts +2 -2
  739. package/src/index.ts +129 -45
  740. package/src/lifecycle.ts +4 -1
  741. package/src/navigation/WithUserflowReactNavigation.tsx +13 -10
  742. package/src/navigation/openFlowNavigateUrl.ts +12 -5
  743. package/src/pairing/PairingController.ts +283 -29
  744. package/src/pairing/PreviewModeBanner.tsx +71 -14
  745. package/src/pairing/deepLink.ts +23 -5
  746. package/src/pairing/deviceId.ts +43 -0
  747. package/src/pairing/diagnostics.ts +6 -4
  748. package/src/pairing/tokenStorage.ts +60 -7
  749. package/src/pairing/usePairingState.ts +2 -0
  750. package/src/pairing/usePreviewBarHold.ts +160 -0
  751. package/src/runtime/BannerHost.tsx +102 -0
  752. package/src/runtime/EmbedBannerPlaceholder.tsx +115 -0
  753. package/src/runtime/SdkErrorBoundary.tsx +77 -0
  754. package/src/runtime/TargetPressBridge.tsx +19 -12
  755. package/src/runtime/UserflowOverlay.tsx +118 -0
  756. package/src/runtime/UserflowProvider.tsx +139 -64
  757. package/src/runtime/bannerEngine.ts +55 -0
  758. package/src/runtime/bannerEngineContext.ts +5 -0
  759. package/src/runtime/bannerPlacement.ts +36 -0
  760. package/src/runtime/embedBannerRegistry.ts +28 -0
  761. package/src/runtime/flowEngine.ts +76 -3
  762. package/src/runtime/isolateCall.ts +53 -0
  763. package/src/runtime/reportSdkError.ts +12 -0
  764. package/src/runtime/useBannerSession.ts +35 -0
  765. package/src/screenTracker.ts +34 -8
  766. package/src/surfaces/BannerBar.tsx +176 -0
  767. package/src/surfaces/BannerSurface.tsx +82 -0
  768. package/src/surfaces/MadeWithUserflow.tsx +15 -10
  769. package/src/surfaces/ModalSurface.tsx +1 -1
  770. package/src/surfaces/TooltipSurface.tsx +17 -1
  771. package/src/surfaces/bannerBarLayout.ts +74 -0
  772. package/src/surfaces/bannerBarTokens.ts +34 -0
  773. package/src/surfaces/bannerWebView/BannerWebViewBar.tsx +312 -0
  774. package/src/surfaces/bannerWebView/bannerAutoRunEvalJs.ts +44 -0
  775. package/src/surfaces/bannerWebView/bannerAutoRunSession.ts +19 -0
  776. package/src/surfaces/bannerWebView/bannerNeedsWebView.ts +38 -0
  777. package/src/surfaces/bannerWebView/bannerThemeStyles.ts +91 -0
  778. package/src/surfaces/bannerWebView/bannerWebFrameCss.ts +145 -0
  779. package/src/surfaces/bannerWebView/buildCustomBannerHtml.ts +178 -0
  780. package/src/surfaces/bannerWebView/buttonClassName.ts +15 -0
  781. package/src/surfaces/bannerWebView/resolveCdnHost.ts +47 -0
  782. package/src/surfaces/bannerWebView/richContentDocToHtml.ts +99 -0
  783. package/src/surfaces/resolveBannerTheme.ts +18 -0
  784. package/src/surfaces/safeArea.ts +29 -0
  785. package/src/version.ts +1 -1
  786. package/vendor/core/dist/attributes.d.ts.map +1 -1
  787. package/vendor/core/dist/attributes.js +4 -4
  788. package/vendor/core/dist/attributes.js.map +1 -1
  789. package/vendor/core/dist/engine/BannerSessionEngine.d.ts +73 -0
  790. package/vendor/core/dist/engine/BannerSessionEngine.d.ts.map +1 -0
  791. package/vendor/core/dist/engine/BannerSessionEngine.js +236 -0
  792. package/vendor/core/dist/engine/BannerSessionEngine.js.map +1 -0
  793. package/vendor/core/dist/engine/FlowSessionEngine.d.ts +41 -1
  794. package/vendor/core/dist/engine/FlowSessionEngine.d.ts.map +1 -1
  795. package/vendor/core/dist/engine/FlowSessionEngine.js +167 -28
  796. package/vendor/core/dist/engine/FlowSessionEngine.js.map +1 -1
  797. package/vendor/core/dist/engine/PairingEngine.d.ts +38 -2
  798. package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -1
  799. package/vendor/core/dist/engine/PairingEngine.js +19 -2
  800. package/vendor/core/dist/engine/PairingEngine.js.map +1 -1
  801. package/vendor/core/dist/engine/UserflowCore.d.ts +10 -1
  802. package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -1
  803. package/vendor/core/dist/engine/UserflowCore.js +47 -27
  804. package/vendor/core/dist/engine/UserflowCore.js.map +1 -1
  805. package/vendor/core/dist/engine/handleActions.d.ts +17 -3
  806. package/vendor/core/dist/engine/handleActions.d.ts.map +1 -1
  807. package/vendor/core/dist/engine/handleActions.js +17 -14
  808. package/vendor/core/dist/engine/handleActions.js.map +1 -1
  809. package/vendor/core/dist/engine/trackCondition.d.ts +2 -0
  810. package/vendor/core/dist/engine/trackCondition.d.ts.map +1 -1
  811. package/vendor/core/dist/engine/trackCondition.js +4 -2
  812. package/vendor/core/dist/engine/trackCondition.js.map +1 -1
  813. package/vendor/core/dist/engine/trackStepTriggers.d.ts +11 -1
  814. package/vendor/core/dist/engine/trackStepTriggers.d.ts.map +1 -1
  815. package/vendor/core/dist/engine/trackStepTriggers.js +42 -16
  816. package/vendor/core/dist/engine/trackStepTriggers.js.map +1 -1
  817. package/vendor/core/dist/errors.d.ts +11 -1
  818. package/vendor/core/dist/errors.d.ts.map +1 -1
  819. package/vendor/core/dist/errors.js +2 -1
  820. package/vendor/core/dist/errors.js.map +1 -1
  821. package/vendor/core/dist/eventAttributes.d.ts.map +1 -1
  822. package/vendor/core/dist/eventAttributes.js +4 -2
  823. package/vendor/core/dist/eventAttributes.js.map +1 -1
  824. package/vendor/core/dist/index.d.ts +4 -1
  825. package/vendor/core/dist/index.d.ts.map +1 -1
  826. package/vendor/core/dist/index.js +1 -0
  827. package/vendor/core/dist/index.js.map +1 -1
  828. package/vendor/core/dist/normalizeAttributes.js +9 -7
  829. package/vendor/core/dist/normalizeAttributes.js.map +1 -1
  830. package/vendor/core/dist/transport/pairing.d.ts +5 -0
  831. package/vendor/core/dist/transport/pairing.d.ts.map +1 -1
  832. package/vendor/core/dist/transport/pairing.js +69 -2
  833. package/vendor/core/dist/transport/pairing.js.map +1 -1
  834. package/vendor/core/dist/transport/phoenix.d.ts +8 -0
  835. package/vendor/core/dist/transport/phoenix.d.ts.map +1 -1
  836. package/vendor/core/dist/transport/phoenix.js +16 -2
  837. package/vendor/core/dist/transport/phoenix.js.map +1 -1
  838. package/vendor/core/dist/version.d.ts +1 -1
  839. package/vendor/core/dist/version.js +1 -1
  840. package/vendor/core/package.json +1 -1
  841. package/vendor/protocol/dist/autoData.d.ts +8 -15
  842. package/vendor/protocol/dist/autoData.d.ts.map +1 -1
  843. package/vendor/protocol/dist/autoData.js.map +1 -1
  844. package/vendor/protocol/dist/flows.d.ts +58 -2
  845. package/vendor/protocol/dist/flows.d.ts.map +1 -1
  846. package/vendor/protocol/dist/flows.js +20 -2
  847. package/vendor/protocol/dist/flows.js.map +1 -1
  848. package/vendor/protocol/dist/messages.d.ts +22 -12
  849. package/vendor/protocol/dist/messages.d.ts.map +1 -1
  850. package/vendor/protocol/dist/messages.js +5 -2
  851. package/vendor/protocol/dist/messages.js.map +1 -1
  852. package/vendor/protocol/package.json +1 -1
@@ -0,0 +1,236 @@
1
+ import { handleActions } from './handleActions.js';
2
+ /** Cap for in-memory client-message retry after transport failure. */
3
+ const MAX_PENDING_SENDS = 20;
4
+ function isValidBannerSession(session) {
5
+ if (session == null || typeof session !== 'object')
6
+ return false;
7
+ const candidate = session;
8
+ if (typeof candidate.id !== 'string' || candidate.id.length === 0)
9
+ return false;
10
+ if (candidate.flow == null || typeof candidate.flow.id !== 'string')
11
+ return false;
12
+ if (candidate.kind != null && candidate.kind !== 'banner')
13
+ return false;
14
+ const banner = candidate.version?.banner;
15
+ if (banner == null || typeof banner !== 'object')
16
+ return false;
17
+ if (typeof banner.embedMode !== 'string')
18
+ return false;
19
+ if (!Array.isArray(banner.buttons))
20
+ return false;
21
+ return true;
22
+ }
23
+ function normalize(session) {
24
+ return {
25
+ ...session,
26
+ kind: 'banner',
27
+ draftMode: session.draftMode === true,
28
+ data: Array.isArray(session.data) ? session.data : [],
29
+ version: {
30
+ ...session.version,
31
+ steps: Array.isArray(session.version.steps) ? session.version.steps : [],
32
+ },
33
+ };
34
+ }
35
+ /**
36
+ * One banner session, independent of the tour. Web banners have no session
37
+ * clock: a later Set replaces the current bar, and Unset clears only a
38
+ * matching id.
39
+ */
40
+ export class BannerSessionEngine {
41
+ constructor(deps) {
42
+ this.listeners = new Set();
43
+ this.pendingSends = [];
44
+ this.session = null;
45
+ this.unsubscribe = null;
46
+ this.flushingPending = false;
47
+ this.transport = deps.transport;
48
+ this.flowActions = deps.flowActions;
49
+ this.onOpenExternalUrl = deps.onOpenExternalUrl;
50
+ this.onEvalJs = deps.onEvalJs;
51
+ this.updateUserImpl = deps.updateUser;
52
+ this.updateGroupImpl = deps.updateGroup;
53
+ this.warn = deps.warn ?? ((message) => console.warn(message));
54
+ }
55
+ attach() {
56
+ if (this.unsubscribe)
57
+ return;
58
+ this.unsubscribe = this.transport.onServerMessage((message) => {
59
+ this.handleServerMessage(message);
60
+ });
61
+ }
62
+ detach() {
63
+ this.unsubscribe?.();
64
+ this.unsubscribe = null;
65
+ }
66
+ on(listener) {
67
+ this.listeners.add(listener);
68
+ return () => {
69
+ this.listeners.delete(listener);
70
+ };
71
+ }
72
+ getBannerSession() {
73
+ return this.session;
74
+ }
75
+ handleServerMessage(message) {
76
+ switch (message.kind) {
77
+ case 'SetBannerSession': {
78
+ if (!isValidBannerSession(message.session)) {
79
+ this.warn('Userflow: ignoring malformed SetBannerSession (missing version.banner)');
80
+ return;
81
+ }
82
+ this.setSession(normalize(message.session));
83
+ return;
84
+ }
85
+ case 'UnsetBannerSession': {
86
+ if (this.session?.id === message.sessionId) {
87
+ this.setSession(null);
88
+ }
89
+ return;
90
+ }
91
+ default:
92
+ return;
93
+ }
94
+ }
95
+ /** Dismiss the banner. Does not touch a tour session held elsewhere. */
96
+ async endBanner(endReason) {
97
+ const current = this.session;
98
+ if (!current)
99
+ return;
100
+ const sessionId = current.id;
101
+ this.setSession(null);
102
+ await this.sendTracked({
103
+ kind: 'EndFlow',
104
+ sessionId,
105
+ endReason,
106
+ });
107
+ }
108
+ endFlow(endReason) {
109
+ return this.endBanner(endReason);
110
+ }
111
+ handleActions(actions) {
112
+ const session = this.session;
113
+ if (!session || actions.length === 0)
114
+ return Promise.resolve();
115
+ return handleActions(session, actions, this.actionDeps()).catch((error) => {
116
+ const detail = error instanceof Error ? error.message : String(error);
117
+ this.warn(`Userflow: banner actions failed: ${detail}`);
118
+ });
119
+ }
120
+ /** Drop the local banner without detaching from transport (preview / user switch). */
121
+ clearLocalSession() {
122
+ this.setSession(null);
123
+ }
124
+ reset() {
125
+ this.detach();
126
+ this.pendingSends.length = 0;
127
+ this.setSession(null);
128
+ }
129
+ async flushPendingSends() {
130
+ if (this.flushingPending || this.pendingSends.length === 0)
131
+ return;
132
+ this.flushingPending = true;
133
+ try {
134
+ while (this.pendingSends.length > 0) {
135
+ const message = this.pendingSends[0];
136
+ try {
137
+ await this.transport.send(message);
138
+ this.pendingSends.shift();
139
+ }
140
+ catch {
141
+ return;
142
+ }
143
+ }
144
+ }
145
+ finally {
146
+ this.flushingPending = false;
147
+ }
148
+ }
149
+ actionDeps() {
150
+ return {
151
+ engine: this.actionRunner(),
152
+ ...(this.onOpenExternalUrl !== undefined
153
+ ? { onOpenExternalUrl: this.onOpenExternalUrl }
154
+ : {}),
155
+ ...(this.onEvalJs !== undefined ? { onEvalJs: this.onEvalJs } : {}),
156
+ warn: this.warn,
157
+ };
158
+ }
159
+ setSession(session) {
160
+ this.session = session;
161
+ this.transport.setBannerSessionId(session?.id ?? null);
162
+ for (const listener of this.listeners) {
163
+ listener();
164
+ }
165
+ }
166
+ /**
167
+ * Banner `CLOSE_FLOW` ends this session. Other actions delegate to the tour
168
+ * engine when one was provided, so `START_FLOW` replaces the tour.
169
+ */
170
+ actionRunner() {
171
+ const delegated = this.flowActions?.();
172
+ return {
173
+ goToStep: async () => {
174
+ // Banners have no steps. handleActions already no-ops GO_TO_STEP.
175
+ },
176
+ endFlow: (endReason) => this.endBanner(endReason),
177
+ trackButtonEvent: (eventName, token, stepCvid, sessionId) => delegated
178
+ ? delegated.trackButtonEvent(eventName, token, stepCvid, sessionId)
179
+ : this.trackButtonEvent(eventName, token, stepCvid, sessionId),
180
+ startFlow: (options) => (delegated ? delegated.startFlow(options) : this.startFlow(options)),
181
+ updateUser: (attributes) => delegated ? delegated.updateUser(attributes) : this.updateUser(attributes),
182
+ updateGroup: (attributes, options) => delegated
183
+ ? delegated.updateGroup(attributes, options)
184
+ : this.updateGroup(attributes, options),
185
+ beginBatch: () => (delegated ? delegated.beginBatch() : this.beginBatch()),
186
+ endBatch: () => (delegated ? delegated.endBatch() : this.endBatch()),
187
+ };
188
+ }
189
+ async trackButtonEvent(eventName, token, stepCvid, sessionId) {
190
+ await this.sendTracked({
191
+ kind: 'TrackButtonEvent',
192
+ eventName,
193
+ token,
194
+ stepCvid,
195
+ sessionId,
196
+ });
197
+ }
198
+ async startFlow(options) {
199
+ await this.sendTracked({
200
+ kind: 'StartFlow',
201
+ flowId: options.flowId,
202
+ stepCvid: options.stepCvid,
203
+ startReason: options.startReason,
204
+ once: false,
205
+ });
206
+ }
207
+ async updateUser(attributes) {
208
+ await this.updateUserImpl?.(attributes);
209
+ }
210
+ async updateGroup(attributes, options) {
211
+ await this.updateGroupImpl?.(attributes, options);
212
+ }
213
+ async beginBatch() {
214
+ await this.sendTracked({ kind: 'BeginBatch' });
215
+ }
216
+ async endBatch() {
217
+ await this.sendTracked({ kind: 'EndBatch' });
218
+ }
219
+ enqueuePendingSend(message) {
220
+ if (this.pendingSends.length >= MAX_PENDING_SENDS) {
221
+ this.pendingSends.shift();
222
+ }
223
+ this.pendingSends.push(message);
224
+ }
225
+ async sendTracked(message) {
226
+ try {
227
+ await this.transport.send(message);
228
+ void this.flushPendingSends();
229
+ }
230
+ catch {
231
+ this.enqueuePendingSend(message);
232
+ this.warn(`Userflow: failed to send ${message.kind}; queued for retry on reconnect`);
233
+ }
234
+ }
235
+ }
236
+ //# sourceMappingURL=BannerSessionEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerSessionEngine.js","sourceRoot":"","sources":["../../src/engine/BannerSessionEngine.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,sEAAsE;AACtE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AA0B7B,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACjE,MAAM,SAAS,GAAG,OAAyC,CAAC;IAC5D,IAAI,OAAO,SAAS,CAAC,EAAE,KAAK,QAAQ,IAAI,SAAS,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAChF,IAAI,SAAS,CAAC,IAAI,IAAI,IAAI,IAAI,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClF,IAAI,SAAS,CAAC,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CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,QAAQ;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/C,CAAC;IAEO,kBAAkB,CAAC,OAAsB;QAC/C,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,iBAAiB,EAAE,CAAC;YAClD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,OAAsB;QAC9C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnC,KAAK,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,4BAA4B,OAAO,CAAC,IAAI,iCAAiC,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;CACF"}
@@ -2,6 +2,7 @@ import type { ClientMessage, FlowActionFragment, FlowSessionFragment, FlowStepFr
2
2
  import { EndFlowReasonInput } from '@userflow-tech/protocol';
3
3
  import { type Scheduler } from '../transport/scheduler.js';
4
4
  import type { PublicAttributes } from '../types.js';
5
+ import { type HandleActionsDeps } from './handleActions.js';
5
6
  /** Narrow transport surface the flow session engine depends on. */
6
7
  export interface FlowTransport {
7
8
  send(message: ClientMessage): Promise<void>;
@@ -25,6 +26,8 @@ export interface FlowSessionEngineDeps {
25
26
  transport: FlowTransport;
26
27
  /** Open a URL for NAVIGATE actions (both SAME_TAB and NEW_TAB on mobile). */
27
28
  onOpenExternalUrl?: (url: string) => void;
29
+ /** Run Evaluate JavaScript (React Native WebView). Omitted until the host wires it. */
30
+ onEvalJs?: HandleActionsDeps['onEvalJs'];
28
31
  /** Persist user attributes (SET_ATTRIBUTE on the user scope). */
29
32
  updateUser?: (attributes: PublicAttributes) => Promise<void>;
30
33
  /** Persist group / membership attributes (SET_ATTRIBUTE on group scopes). */
@@ -33,6 +36,8 @@ export interface FlowSessionEngineDeps {
33
36
  }) => Promise<void>;
34
37
  warn?: (message: string) => void;
35
38
  scheduler?: Scheduler;
39
+ /** Clock for Temporarily Hide TIME conditions. Tests inject a controllable now. */
40
+ now?: () => number;
36
41
  }
37
42
  /**
38
43
  * Framework-agnostic flow session state machine (Phase 3 WS2).
@@ -43,10 +48,12 @@ export interface FlowSessionEngineDeps {
43
48
  export declare class FlowSessionEngine {
44
49
  private readonly transport;
45
50
  private readonly onOpenExternalUrl;
51
+ private readonly onEvalJs;
46
52
  private readonly updateUserImpl;
47
53
  private readonly updateGroupImpl;
48
54
  private readonly warn;
49
55
  private readonly scheduler;
56
+ private readonly now;
50
57
  private clientClock;
51
58
  private serverClock;
52
59
  private flowSessionClock;
@@ -64,7 +71,9 @@ export declare class FlowSessionEngine {
64
71
  /** Step whose triggers are currently tracked (may differ from currentStep on ForceGoToStep). */
65
72
  private displayedStepId;
66
73
  private triggerTrackingKey;
67
- private triggerUntrack;
74
+ private triggerSubscription;
75
+ /** While true, step triggers stay tracked but do not run or mark themselves fired. */
76
+ private triggersPaused;
68
77
  private applyingTriggers;
69
78
  private triggersDirty;
70
79
  private triggerSessionData;
@@ -72,6 +81,13 @@ export declare class FlowSessionEngine {
72
81
  private triggerCycleVisited;
73
82
  /** >0 while a step trigger's handleActions is in flight (including awaits). */
74
83
  private triggerActionDepth;
84
+ /** True while a Temporarily Hide condition matches. The session is kept. */
85
+ private hiddenByCondition;
86
+ private hiddenUntrack;
87
+ private hiddenTrackingKey;
88
+ private hiddenSessionData;
89
+ /** >0 while {@link setFlowSession} is applying, so a sync hide callback does not emit early. */
90
+ private sessionApplyDepth;
75
91
  constructor(deps: FlowSessionEngineDeps);
76
92
  /** Subscribe to inbound server messages. Must be called after identify. */
77
93
  attach(): () => void;
@@ -83,12 +99,26 @@ export declare class FlowSessionEngine {
83
99
  detach(): void;
84
100
  on(listener: FlowSessionEngineListener): () => void;
85
101
  getFlowSession(): FlowSessionFragment | null;
102
+ /**
103
+ * The session held for join and idle, including one Temporarily Hide is
104
+ * suppressing. {@link getFlowSession} is null in that case; callers that
105
+ * end or resume the session need this one.
106
+ */
107
+ getHeldFlowSession(): FlowSessionFragment | null;
108
+ /**
109
+ * True while a flow session is held for join and idle, including one that
110
+ * Temporarily Hide is suppressing. The overlay uses {@link getFlowSession},
111
+ * which is null in that case, so foreground idle must not use it or it will
112
+ * suspend the socket that attribute-driven unhide depends on.
113
+ */
114
+ hasHeldFlowSession(): boolean;
86
115
  getCurrentStep(): FlowStepFragment | null;
87
116
  /** Visible for tests / advanced callers; prefer {@link attach}. */
88
117
  handleServerMessage(message: ServerMessage): void;
89
118
  goToStep(step: FlowStepFragment): Promise<void>;
90
119
  endFlow(endReason: EndFlowReasonInput): Promise<void>;
91
120
  reportTooltipTargetMissing(stepId: string): Promise<void>;
121
+ private actionDeps;
92
122
  handleActions(actions: FlowActionFragment[]): Promise<void>;
93
123
  trackButtonEvent(eventName: string, token: string, stepCvid: string | null, sessionId: string | null): Promise<void>;
94
124
  updateUser(attributes: PublicAttributes): Promise<void>;
@@ -134,6 +164,16 @@ export declare class FlowSessionEngine {
134
164
  */
135
165
  private syncStepTriggers;
136
166
  private untrackStepTriggers;
167
+ /**
168
+ * Track the version's Temporarily Hide condition. A match suppresses the
169
+ * visible session only — the held session and join id stay so the same
170
+ * session can be shown again, matching server UnsetFlowSession / SetFlowSession.
171
+ */
172
+ private syncHiddenCondition;
173
+ private applyHiddenCondition;
174
+ private untrackHiddenCondition;
175
+ /** Keep the resumed step when a hide ends after ForceGoToStep. */
176
+ private alignDisplayedStep;
137
177
  /**
138
178
  * Open a server batch. Nested / overlapping callers share one BeginBatch;
139
179
  * `check_sessions` stays deferred until the matching {@link endBatch} at
@@ -1 +1 @@
1
- {"version":3,"file":"FlowSessionEngine.d.ts","sourceRoot":"","sources":["../../src/engine/FlowSessionEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EAEb,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAA0B,MAAM,yBAAyB,CAAC;AAGrF,OAAO,EAAoB,KAAK,SAAS,EAAoB,MAAM,2BAA2B,CAAC;AAC/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AASpD,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,eAAe,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACvE,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAEhF,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,aAAa,CAAC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AC,kBAAkB;YAOZ,WAAW;IAazB,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,IAAI;CASb"}
@@ -3,6 +3,7 @@ import { UserflowAuthError, UserflowRateLimitError } from '../errors.js';
3
3
  import { defaultScheduler } from '../transport/scheduler.js';
4
4
  import { handleActions } from './handleActions.js';
5
5
  import { SimpleObservable } from './simpleObservable.js';
6
+ import { trackCondition } from './trackCondition.js';
6
7
  import { trackStepTriggers } from './trackStepTriggers.js';
7
8
  /** Cap for in-memory client-message retry after transport failure. */
8
9
  const MAX_PENDING_SENDS = 20;
@@ -48,7 +49,9 @@ export class FlowSessionEngine {
48
49
  /** Step whose triggers are currently tracked (may differ from currentStep on ForceGoToStep). */
49
50
  this.displayedStepId = null;
50
51
  this.triggerTrackingKey = null;
51
- this.triggerUntrack = null;
52
+ this.triggerSubscription = null;
53
+ /** While true, step triggers stay tracked but do not run or mark themselves fired. */
54
+ this.triggersPaused = false;
52
55
  this.applyingTriggers = false;
53
56
  this.triggersDirty = false;
54
57
  this.triggerSessionData = null;
@@ -56,12 +59,21 @@ export class FlowSessionEngine {
56
59
  this.triggerCycleVisited = new Set();
57
60
  /** >0 while a step trigger's handleActions is in flight (including awaits). */
58
61
  this.triggerActionDepth = 0;
62
+ /** True while a Temporarily Hide condition matches. The session is kept. */
63
+ this.hiddenByCondition = false;
64
+ this.hiddenUntrack = null;
65
+ this.hiddenTrackingKey = null;
66
+ this.hiddenSessionData = null;
67
+ /** >0 while {@link setFlowSession} is applying, so a sync hide callback does not emit early. */
68
+ this.sessionApplyDepth = 0;
59
69
  this.transport = deps.transport;
60
70
  this.onOpenExternalUrl = deps.onOpenExternalUrl;
71
+ this.onEvalJs = deps.onEvalJs;
61
72
  this.updateUserImpl = deps.updateUser;
62
73
  this.updateGroupImpl = deps.updateGroup;
63
74
  this.warn = deps.warn ?? ((message) => console.warn(message));
64
75
  this.scheduler = deps.scheduler ?? defaultScheduler;
76
+ this.now = deps.now ?? Date.now;
65
77
  }
66
78
  /** Subscribe to inbound server messages. Must be called after identify. */
67
79
  attach() {
@@ -89,9 +101,30 @@ export class FlowSessionEngine {
89
101
  };
90
102
  }
91
103
  getFlowSession() {
104
+ if (this.hiddenByCondition)
105
+ return null;
92
106
  return this.flowSession;
93
107
  }
108
+ /**
109
+ * The session held for join and idle, including one Temporarily Hide is
110
+ * suppressing. {@link getFlowSession} is null in that case; callers that
111
+ * end or resume the session need this one.
112
+ */
113
+ getHeldFlowSession() {
114
+ return this.flowSession;
115
+ }
116
+ /**
117
+ * True while a flow session is held for join and idle, including one that
118
+ * Temporarily Hide is suppressing. The overlay uses {@link getFlowSession},
119
+ * which is null in that case, so foreground idle must not use it or it will
120
+ * suspend the socket that attribute-driven unhide depends on.
121
+ */
122
+ hasHeldFlowSession() {
123
+ return this.flowSession != null;
124
+ }
94
125
  getCurrentStep() {
126
+ if (this.hiddenByCondition)
127
+ return null;
95
128
  const session = this.flowSession;
96
129
  if (!session)
97
130
  return null;
@@ -130,6 +163,12 @@ export class FlowSessionEngine {
130
163
  return;
131
164
  if (this.flowSession?.id === message.sessionId) {
132
165
  this.displayedStepId = message.stepId;
166
+ if (this.hiddenByCondition) {
167
+ // Rebind triggers to this step, but keep them paused so they do not
168
+ // run for a step the overlay is not showing.
169
+ this.syncStepTriggers();
170
+ return;
171
+ }
133
172
  this.emit({
134
173
  type: 'goToStep',
135
174
  sessionId: message.sessionId,
@@ -151,6 +190,10 @@ export class FlowSessionEngine {
151
190
  case 'UntrackClientCondition':
152
191
  // Handled by ClientConditionEngine (separate subscriber).
153
192
  return;
193
+ case 'SetBannerSession':
194
+ case 'UnsetBannerSession':
195
+ // Handled by BannerSessionEngine (separate subscriber).
196
+ return;
154
197
  }
155
198
  }
156
199
  async goToStep(step) {
@@ -198,15 +241,19 @@ export class FlowSessionEngine {
198
241
  await this.endFlow(EndFlowReasonInput.TOOLTIP_TARGET_MISSING);
199
242
  }
200
243
  }
201
- handleActions(actions) {
202
- const session = this.requireFlowSession();
203
- return handleActions(session, actions, {
244
+ actionDeps() {
245
+ return {
204
246
  engine: this,
205
247
  ...(this.onOpenExternalUrl !== undefined
206
248
  ? { onOpenExternalUrl: this.onOpenExternalUrl }
207
249
  : {}),
250
+ ...(this.onEvalJs !== undefined ? { onEvalJs: this.onEvalJs } : {}),
208
251
  warn: this.warn,
209
- }).catch((error) => {
252
+ };
253
+ }
254
+ handleActions(actions) {
255
+ const session = this.requireFlowSession();
256
+ return handleActions(session, actions, this.actionDeps()).catch((error) => {
210
257
  const detail = error instanceof Error ? error.message : String(error);
211
258
  this.warn(`Userflow: flow actions failed: ${detail}`);
212
259
  });
@@ -287,14 +334,15 @@ export class FlowSessionEngine {
287
334
  this.clearConditionWaitTimers();
288
335
  this.displayedStepId = null;
289
336
  this.untrackStepTriggers();
290
- if (this.flowSession !== null) {
291
- this.flowSession = null;
292
- this.transport.setFlowSessionId(null);
337
+ this.triggersPaused = false;
338
+ this.untrackHiddenCondition();
339
+ const hadSession = this.flowSession !== null;
340
+ this.flowSession = null;
341
+ this.hiddenByCondition = false;
342
+ this.transport.setFlowSessionId(null);
343
+ if (hadSession) {
293
344
  this.emit({ type: 'sessionChange', session: null });
294
345
  }
295
- else {
296
- this.transport.setFlowSessionId(null);
297
- }
298
346
  }
299
347
  /** Clear session, clocks, timers, pending sends, and join resume id; detach from transport. */
300
348
  reset() {
@@ -341,15 +389,39 @@ export class FlowSessionEngine {
341
389
  return this.pendingSends.length + (this.pendingEndBatch ? 1 : 0);
342
390
  }
343
391
  setFlowSession(session, clock) {
344
- const applied = this.applyLocalStepToSession(session);
345
- this.flowSession = applied;
346
- this.flowSessionClock = clock;
347
- this.transport.setFlowSessionId(applied?.id ?? null);
348
- this.displayedStepId = applied?.currentStep?.id ?? null;
349
- // Track triggers before sessionChange so ALWAYS_TRUE go-to-next can
350
- // advance currentStep before the first UI paint (web useLayoutEffect).
351
- this.syncStepTriggers();
352
- this.emit({ type: 'sessionChange', session: this.flowSession });
392
+ this.sessionApplyDepth += 1;
393
+ try {
394
+ const applied = this.applyLocalStepToSession(session);
395
+ this.flowSession = applied;
396
+ this.flowSessionClock = clock;
397
+ this.transport.setFlowSessionId(applied?.id ?? null);
398
+ this.displayedStepId = applied?.currentStep?.id ?? null;
399
+ // Evaluate Temporarily Hide before the first sessionChange so a condition
400
+ // that is already true does not paint a frame. A match keeps the session
401
+ // and the join id; it does not end the flow.
402
+ this.syncHiddenCondition();
403
+ if (this.hiddenByCondition) {
404
+ // Rebind when the session or step changed. Stay paused so a one-shot
405
+ // trigger does not run until the overlay is shown again, and so untrack
406
+ // during that rebind cannot mark the new step as live.
407
+ this.triggersPaused = true;
408
+ this.syncStepTriggers();
409
+ }
410
+ else {
411
+ this.triggersPaused = false;
412
+ // Track triggers before sessionChange so ALWAYS_TRUE go-to-next can
413
+ // advance currentStep before the first UI paint (web useLayoutEffect).
414
+ this.syncStepTriggers();
415
+ this.triggerSubscription?.flushPaused();
416
+ }
417
+ this.emit({
418
+ type: 'sessionChange',
419
+ session: this.hiddenByCondition ? null : this.flowSession,
420
+ });
421
+ }
422
+ finally {
423
+ this.sessionApplyDepth -= 1;
424
+ }
353
425
  }
354
426
  /**
355
427
  * Same-session SetFlowSession must not wipe a local goToStep. Tracking a
@@ -426,21 +498,18 @@ export class FlowSessionEngine {
426
498
  break;
427
499
  }
428
500
  this.triggerSessionData = new SimpleObservable(session.data);
429
- this.triggerUntrack = trackStepTriggers(step.triggers ?? [], session, {
430
- engine: this,
501
+ this.triggerSubscription = trackStepTriggers(step.triggers ?? [], session, {
502
+ ...this.actionDeps(),
431
503
  scheduler: this.scheduler,
432
504
  sessionData: this.triggerSessionData,
433
505
  getSession: () => this.flowSession,
506
+ isPaused: () => this.triggersPaused,
434
507
  enterTriggerActions: () => {
435
508
  this.triggerActionDepth += 1;
436
509
  },
437
510
  leaveTriggerActions: () => {
438
511
  this.triggerActionDepth = Math.max(0, this.triggerActionDepth - 1);
439
512
  },
440
- ...(this.onOpenExternalUrl !== undefined
441
- ? { onOpenExternalUrl: this.onOpenExternalUrl }
442
- : {}),
443
- warn: this.warn,
444
513
  });
445
514
  } while (this.triggersDirty);
446
515
  }
@@ -449,11 +518,81 @@ export class FlowSessionEngine {
449
518
  }
450
519
  }
451
520
  untrackStepTriggers() {
452
- this.triggerUntrack?.();
453
- this.triggerUntrack = null;
521
+ this.triggerSubscription?.untrack();
522
+ this.triggerSubscription = null;
454
523
  this.triggerTrackingKey = null;
455
524
  this.triggerSessionData = null;
456
525
  }
526
+ /**
527
+ * Track the version's Temporarily Hide condition. A match suppresses the
528
+ * visible session only — the held session and join id stay so the same
529
+ * session can be shown again, matching server UnsetFlowSession / SetFlowSession.
530
+ */
531
+ syncHiddenCondition() {
532
+ const session = this.flowSession;
533
+ const condition = session?.version.hiddenCondition ?? null;
534
+ if (!session || condition == null) {
535
+ this.untrackHiddenCondition();
536
+ this.hiddenByCondition = false;
537
+ return;
538
+ }
539
+ const key = `${session.id}:${JSON.stringify(condition)}`;
540
+ if (key === this.hiddenTrackingKey) {
541
+ this.hiddenSessionData?.update(session.data);
542
+ return;
543
+ }
544
+ this.untrackHiddenCondition();
545
+ this.hiddenTrackingKey = key;
546
+ this.hiddenSessionData = new SimpleObservable(session.data);
547
+ this.hiddenUntrack = trackCondition({
548
+ condition,
549
+ scheduler: this.scheduler,
550
+ now: this.now,
551
+ sessionData: this.hiddenSessionData,
552
+ warn: this.warn,
553
+ context: 'temporarily hide conditions',
554
+ callback: (isTrue) => {
555
+ this.applyHiddenCondition(isTrue);
556
+ },
557
+ });
558
+ }
559
+ applyHiddenCondition(isTrue) {
560
+ if (isTrue === this.hiddenByCondition)
561
+ return;
562
+ this.hiddenByCondition = isTrue;
563
+ if (this.sessionApplyDepth > 0)
564
+ return;
565
+ if (isTrue) {
566
+ this.triggersPaused = true;
567
+ }
568
+ else {
569
+ this.triggersPaused = false;
570
+ this.alignDisplayedStep();
571
+ this.syncStepTriggers();
572
+ this.triggerSubscription?.flushPaused();
573
+ }
574
+ this.emit({
575
+ type: 'sessionChange',
576
+ session: this.hiddenByCondition ? null : this.flowSession,
577
+ });
578
+ }
579
+ untrackHiddenCondition() {
580
+ this.hiddenUntrack?.();
581
+ this.hiddenUntrack = null;
582
+ this.hiddenTrackingKey = null;
583
+ this.hiddenSessionData = null;
584
+ }
585
+ /** Keep the resumed step when a hide ends after ForceGoToStep. */
586
+ alignDisplayedStep() {
587
+ const session = this.flowSession;
588
+ const stepId = this.displayedStepId;
589
+ if (!session || !stepId || session.currentStep?.id === stepId)
590
+ return;
591
+ const step = session.version.steps.find((candidate) => candidate.id === stepId);
592
+ if (!step)
593
+ return;
594
+ session.currentStep = { id: step.id, crossVersionId: step.crossVersionId };
595
+ }
457
596
  /**
458
597
  * Open a server batch. Nested / overlapping callers share one BeginBatch;
459
598
  * `check_sessions` stays deferred until the matching {@link endBatch} at