@userflow-tech/react-native 0.1.0 → 0.2.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 (850) hide show
  1. package/README.md +114 -68
  2. package/app.plugin.js +13 -0
  3. package/babel-plugin/index.d.ts +43 -0
  4. package/babel-plugin/index.d.ts.map +1 -0
  5. package/babel-plugin/index.js +862 -0
  6. package/babel-plugin/index.js.map +1 -0
  7. package/babel-plugin.js +13 -0
  8. package/docs/anchoring.md +141 -13
  9. package/docs/deep-linking.md +20 -17
  10. package/docs/theme-mapping.md +44 -15
  11. package/docs/troubleshooting.md +37 -30
  12. package/expo-plugin/withUserflow.d.ts +17 -0
  13. package/expo-plugin/withUserflow.d.ts.map +1 -0
  14. package/expo-plugin/withUserflow.js +99 -0
  15. package/expo-plugin/withUserflow.js.map +1 -0
  16. package/lib/commonjs/anchors/AutoAnchorRegistry.js +125 -3
  17. package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -1
  18. package/lib/commonjs/anchors/anchorChangeTicker.js +10 -0
  19. package/lib/commonjs/anchors/anchorChangeTicker.js.map +1 -1
  20. package/lib/commonjs/anchors/autoAnchor.js +1 -1
  21. package/lib/commonjs/anchors/elementConditionEvaluator.js +25 -12
  22. package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -1
  23. package/lib/commonjs/anchors/fiber/FiberScanRoot.js +11 -47
  24. package/lib/commonjs/anchors/fiber/FiberScanRoot.js.map +1 -1
  25. package/lib/commonjs/anchors/fiber/FiberScanRootStore.js +50 -0
  26. package/lib/commonjs/anchors/fiber/FiberScanRootStore.js.map +1 -0
  27. package/lib/commonjs/anchors/fiber/fiberInternals.js +145 -3
  28. package/lib/commonjs/anchors/fiber/fiberInternals.js.map +1 -1
  29. package/lib/commonjs/anchors/fiber/indexHostFibers.js +129 -0
  30. package/lib/commonjs/anchors/fiber/indexHostFibers.js.map +1 -0
  31. package/lib/commonjs/anchors/fiber/readHostContent.js +131 -0
  32. package/lib/commonjs/anchors/fiber/readHostContent.js.map +1 -0
  33. package/lib/commonjs/anchors/fiberAnchorCache.js +50 -0
  34. package/lib/commonjs/anchors/fiberAnchorCache.js.map +1 -0
  35. package/lib/commonjs/anchors/hintsCodec.js +1 -1
  36. package/lib/commonjs/anchors/resolveAnchorHost.js +15 -21
  37. package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -1
  38. package/lib/commonjs/anchors/resolveAutoAnchorHost.js +171 -0
  39. package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -0
  40. package/lib/commonjs/anchors/semanticMatcher.js +285 -0
  41. package/lib/commonjs/anchors/semanticMatcher.js.map +1 -0
  42. package/lib/commonjs/authoring/ElementPickerOverlay.js +490 -0
  43. package/lib/commonjs/authoring/ElementPickerOverlay.js.map +1 -0
  44. package/lib/commonjs/authoring/capturePickerScreenshot.js +73 -0
  45. package/lib/commonjs/authoring/capturePickerScreenshot.js.map +1 -0
  46. package/lib/commonjs/authoring/chrome/ChromeBarTransition.js +94 -0
  47. package/lib/commonjs/authoring/chrome/ChromeBarTransition.js.map +1 -0
  48. package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js +64 -0
  49. package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js.map +1 -0
  50. package/lib/commonjs/authoring/chrome/ChromeButton.js +94 -0
  51. package/lib/commonjs/authoring/chrome/ChromeButton.js.map +1 -0
  52. package/lib/commonjs/authoring/chrome/ChromeDialog.js +131 -0
  53. package/lib/commonjs/authoring/chrome/ChromeDialog.js.map +1 -0
  54. package/lib/commonjs/authoring/chrome/ChromeIcon.js +39 -0
  55. package/lib/commonjs/authoring/chrome/ChromeIcon.js.map +1 -0
  56. package/lib/commonjs/authoring/chrome/ChromeTooltip.js +88 -0
  57. package/lib/commonjs/authoring/chrome/ChromeTooltip.js.map +1 -0
  58. package/lib/commonjs/authoring/chrome/ChromeTopBar.js +110 -0
  59. package/lib/commonjs/authoring/chrome/ChromeTopBar.js.map +1 -0
  60. package/lib/commonjs/authoring/chrome/DoubleTapBridge.js +57 -0
  61. package/lib/commonjs/authoring/chrome/DoubleTapBridge.js.map +1 -0
  62. package/lib/commonjs/authoring/chrome/doubleTapMonitor.js +80 -0
  63. package/lib/commonjs/authoring/chrome/doubleTapMonitor.js.map +1 -0
  64. package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
  65. package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
  66. package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
  67. package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left.png +0 -0
  68. package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
  69. package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
  70. package/lib/commonjs/authoring/chrome/icons/userflow-logomark.png +0 -0
  71. package/lib/commonjs/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
  72. package/lib/commonjs/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
  73. package/lib/commonjs/authoring/chrome/icons/xmark.png +0 -0
  74. package/lib/commonjs/authoring/chrome/icons/xmark@2x.png +0 -0
  75. package/lib/commonjs/authoring/chrome/icons/xmark@3x.png +0 -0
  76. package/lib/commonjs/authoring/chrome/tokens.js +150 -0
  77. package/lib/commonjs/authoring/chrome/tokens.js.map +1 -0
  78. package/lib/commonjs/authoring/doubleTap.js +23 -0
  79. package/lib/commonjs/authoring/doubleTap.js.map +1 -0
  80. package/lib/commonjs/authoring/elementPickerController.js +102 -0
  81. package/lib/commonjs/authoring/elementPickerController.js.map +1 -0
  82. package/lib/commonjs/authoring/fingerprintFromInstance.js +195 -0
  83. package/lib/commonjs/authoring/fingerprintFromInstance.js.map +1 -0
  84. package/lib/commonjs/authoring/hitTest.js +106 -0
  85. package/lib/commonjs/authoring/hitTest.js.map +1 -0
  86. package/lib/commonjs/content/RichContentRenderer.js +12 -2
  87. package/lib/commonjs/content/RichContentRenderer.js.map +1 -1
  88. package/lib/commonjs/content/StepButton.js +19 -4
  89. package/lib/commonjs/content/StepButton.js.map +1 -1
  90. package/lib/commonjs/content/resolveStepButtonChrome.js +8 -6
  91. package/lib/commonjs/content/resolveStepButtonChrome.js.map +1 -1
  92. package/lib/commonjs/content/themeColor.js +11 -0
  93. package/lib/commonjs/content/themeColor.js.map +1 -1
  94. package/lib/commonjs/deviceContext.js +158 -0
  95. package/lib/commonjs/deviceContext.js.map +1 -0
  96. package/lib/commonjs/expo-router/useUserflowExpoRouter.js +40 -4
  97. package/lib/commonjs/expo-router/useUserflowExpoRouter.js.map +1 -1
  98. package/lib/commonjs/hostAppVersion.js +242 -0
  99. package/lib/commonjs/hostAppVersion.js.map +1 -0
  100. package/lib/commonjs/index.js +118 -5
  101. package/lib/commonjs/index.js.map +1 -1
  102. package/lib/commonjs/lifecycle.js +2 -0
  103. package/lib/commonjs/lifecycle.js.map +1 -1
  104. package/lib/commonjs/navigation/WithUserflowReactNavigation.js +17 -8
  105. package/lib/commonjs/navigation/WithUserflowReactNavigation.js.map +1 -1
  106. package/lib/commonjs/navigation/isOverlayPresentation.js +64 -0
  107. package/lib/commonjs/navigation/isOverlayPresentation.js.map +1 -0
  108. package/lib/commonjs/pairing/PairingController.js +29 -2
  109. package/lib/commonjs/pairing/PairingController.js.map +1 -1
  110. package/lib/commonjs/pairing/PreviewModeBanner.js +211 -84
  111. package/lib/commonjs/pairing/PreviewModeBanner.js.map +1 -1
  112. package/lib/commonjs/pairing/diagnostics.js +11 -2
  113. package/lib/commonjs/pairing/diagnostics.js.map +1 -1
  114. package/lib/commonjs/pairing/elementPickerRelay.js +91 -0
  115. package/lib/commonjs/pairing/elementPickerRelay.js.map +1 -0
  116. package/lib/commonjs/pairing/resolvePreviewChrome.js +52 -0
  117. package/lib/commonjs/pairing/resolvePreviewChrome.js.map +1 -0
  118. package/lib/commonjs/pairing/tokenStorage.js +25 -2
  119. package/lib/commonjs/pairing/tokenStorage.js.map +1 -1
  120. package/lib/commonjs/pairing/usePairingState.js +3 -1
  121. package/lib/commonjs/pairing/usePairingState.js.map +1 -1
  122. package/lib/commonjs/runtime/FlowRenderer.js +45 -21
  123. package/lib/commonjs/runtime/FlowRenderer.js.map +1 -1
  124. package/lib/commonjs/runtime/FlowSurfaceFade.js +47 -24
  125. package/lib/commonjs/runtime/FlowSurfaceFade.js.map +1 -1
  126. package/lib/commonjs/runtime/TargetPressBridge.js +13 -44
  127. package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
  128. package/lib/commonjs/runtime/UserflowProvider.js +74 -20
  129. package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
  130. package/lib/commonjs/runtime/changedTouchPoints.js +48 -0
  131. package/lib/commonjs/runtime/changedTouchPoints.js.map +1 -0
  132. package/lib/commonjs/runtime/flowEngine.js +3 -1
  133. package/lib/commonjs/runtime/flowEngine.js.map +1 -1
  134. package/lib/commonjs/runtime/flowSessionViewState.js +32 -7
  135. package/lib/commonjs/runtime/flowSessionViewState.js.map +1 -1
  136. package/lib/commonjs/runtime/useFlowSessionState.js +2 -1
  137. package/lib/commonjs/runtime/useFlowSessionState.js.map +1 -1
  138. package/lib/commonjs/screenTracker.js +46 -4
  139. package/lib/commonjs/screenTracker.js.map +1 -1
  140. package/lib/commonjs/surfaces/CardFade.js +31 -0
  141. package/lib/commonjs/surfaces/CardFade.js.map +1 -0
  142. package/lib/commonjs/surfaces/CloseButton.js +11 -6
  143. package/lib/commonjs/surfaces/CloseButton.js.map +1 -1
  144. package/lib/commonjs/surfaces/ModalSurface.js +50 -34
  145. package/lib/commonjs/surfaces/ModalSurface.js.map +1 -1
  146. package/lib/commonjs/surfaces/TooltipSurface.js +366 -87
  147. package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -1
  148. package/lib/commonjs/surfaces/cardTransition.js +70 -0
  149. package/lib/commonjs/surfaces/cardTransition.js.map +1 -0
  150. package/lib/commonjs/surfaces/resolveHighlightChrome.js +109 -0
  151. package/lib/commonjs/surfaces/resolveHighlightChrome.js.map +1 -0
  152. package/lib/commonjs/surfaces/resolveModalLayout.js +7 -3
  153. package/lib/commonjs/surfaces/resolveModalLayout.js.map +1 -1
  154. package/lib/commonjs/surfaces/resolveTooltipLayout.js +0 -4
  155. package/lib/commonjs/surfaces/resolveTooltipLayout.js.map +1 -1
  156. package/lib/commonjs/surfaces/surfaceInteractionConfig.js +33 -0
  157. package/lib/commonjs/surfaces/surfaceInteractionConfig.js.map +1 -0
  158. package/lib/commonjs/surfaces/surfaceLayoutInsets.js +128 -0
  159. package/lib/commonjs/surfaces/surfaceLayoutInsets.js.map +1 -0
  160. package/lib/commonjs/surfaces/themeChrome.js +4 -1
  161. package/lib/commonjs/surfaces/themeChrome.js.map +1 -1
  162. package/lib/commonjs/surfaces/tooltip/TooltipBubble.js +142 -21
  163. package/lib/commonjs/surfaces/tooltip/TooltipBubble.js.map +1 -1
  164. package/lib/commonjs/surfaces/tooltip/TooltipCutout.js +100 -47
  165. package/lib/commonjs/surfaces/tooltip/TooltipCutout.js.map +1 -1
  166. package/lib/commonjs/surfaces/tooltip/TooltipHighlight.js +124 -0
  167. package/lib/commonjs/surfaces/tooltip/TooltipHighlight.js.map +1 -0
  168. package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js +67 -13
  169. package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js.map +1 -1
  170. package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js +88 -19
  171. package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js.map +1 -1
  172. package/lib/commonjs/surfaces/tooltip/placementDiagnostics.js +52 -0
  173. package/lib/commonjs/surfaces/tooltip/placementDiagnostics.js.map +1 -0
  174. package/lib/commonjs/surfaces/tooltip/rect.js +12 -0
  175. package/lib/commonjs/surfaces/tooltip/rect.js.map +1 -1
  176. package/lib/commonjs/surfaces/tooltip/resolveSideCardWidth.js +103 -0
  177. package/lib/commonjs/surfaces/tooltip/resolveSideCardWidth.js.map +1 -0
  178. package/lib/commonjs/version.js +1 -1
  179. package/lib/module/anchors/AutoAnchorRegistry.js +126 -3
  180. package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -1
  181. package/lib/module/anchors/anchorChangeTicker.js +10 -0
  182. package/lib/module/anchors/anchorChangeTicker.js.map +1 -1
  183. package/lib/module/anchors/autoAnchor.js +1 -1
  184. package/lib/module/anchors/elementConditionEvaluator.js +25 -12
  185. package/lib/module/anchors/elementConditionEvaluator.js.map +1 -1
  186. package/lib/module/anchors/fiber/FiberScanRoot.js +2 -43
  187. package/lib/module/anchors/fiber/FiberScanRoot.js.map +1 -1
  188. package/lib/module/anchors/fiber/FiberScanRootStore.js +46 -0
  189. package/lib/module/anchors/fiber/FiberScanRootStore.js.map +1 -0
  190. package/lib/module/anchors/fiber/fiberInternals.js +139 -3
  191. package/lib/module/anchors/fiber/fiberInternals.js.map +1 -1
  192. package/lib/module/anchors/fiber/indexHostFibers.js +122 -0
  193. package/lib/module/anchors/fiber/indexHostFibers.js.map +1 -0
  194. package/lib/module/anchors/fiber/readHostContent.js +127 -0
  195. package/lib/module/anchors/fiber/readHostContent.js.map +1 -0
  196. package/lib/module/anchors/fiberAnchorCache.js +40 -0
  197. package/lib/module/anchors/fiberAnchorCache.js.map +1 -0
  198. package/lib/module/anchors/hintsCodec.js +1 -1
  199. package/lib/module/anchors/resolveAnchorHost.js +15 -21
  200. package/lib/module/anchors/resolveAnchorHost.js.map +1 -1
  201. package/lib/module/anchors/resolveAutoAnchorHost.js +167 -0
  202. package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -0
  203. package/lib/module/anchors/semanticMatcher.js +280 -0
  204. package/lib/module/anchors/semanticMatcher.js.map +1 -0
  205. package/lib/module/authoring/ElementPickerOverlay.js +485 -0
  206. package/lib/module/authoring/ElementPickerOverlay.js.map +1 -0
  207. package/lib/module/authoring/capturePickerScreenshot.js +68 -0
  208. package/lib/module/authoring/capturePickerScreenshot.js.map +1 -0
  209. package/lib/module/authoring/chrome/ChromeBarTransition.js +88 -0
  210. package/lib/module/authoring/chrome/ChromeBarTransition.js.map +1 -0
  211. package/lib/module/authoring/chrome/ChromeBottomSheet.js +59 -0
  212. package/lib/module/authoring/chrome/ChromeBottomSheet.js.map +1 -0
  213. package/lib/module/authoring/chrome/ChromeButton.js +89 -0
  214. package/lib/module/authoring/chrome/ChromeButton.js.map +1 -0
  215. package/lib/module/authoring/chrome/ChromeDialog.js +126 -0
  216. package/lib/module/authoring/chrome/ChromeDialog.js.map +1 -0
  217. package/lib/module/authoring/chrome/ChromeIcon.js +33 -0
  218. package/lib/module/authoring/chrome/ChromeIcon.js.map +1 -0
  219. package/lib/module/authoring/chrome/ChromeTooltip.js +82 -0
  220. package/lib/module/authoring/chrome/ChromeTooltip.js.map +1 -0
  221. package/lib/module/authoring/chrome/ChromeTopBar.js +104 -0
  222. package/lib/module/authoring/chrome/ChromeTopBar.js.map +1 -0
  223. package/lib/module/authoring/chrome/DoubleTapBridge.js +52 -0
  224. package/lib/module/authoring/chrome/DoubleTapBridge.js.map +1 -0
  225. package/lib/module/authoring/chrome/doubleTapMonitor.js +75 -0
  226. package/lib/module/authoring/chrome/doubleTapMonitor.js.map +1 -0
  227. package/lib/module/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
  228. package/lib/module/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
  229. package/lib/module/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
  230. package/lib/module/authoring/chrome/icons/arrow-rotate-left.png +0 -0
  231. package/lib/module/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
  232. package/lib/module/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
  233. package/lib/module/authoring/chrome/icons/userflow-logomark.png +0 -0
  234. package/lib/module/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
  235. package/lib/module/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
  236. package/lib/module/authoring/chrome/icons/xmark.png +0 -0
  237. package/lib/module/authoring/chrome/icons/xmark@2x.png +0 -0
  238. package/lib/module/authoring/chrome/icons/xmark@3x.png +0 -0
  239. package/lib/module/authoring/chrome/tokens.js +146 -0
  240. package/lib/module/authoring/chrome/tokens.js.map +1 -0
  241. package/lib/module/authoring/doubleTap.js +18 -0
  242. package/lib/module/authoring/doubleTap.js.map +1 -0
  243. package/lib/module/authoring/elementPickerController.js +97 -0
  244. package/lib/module/authoring/elementPickerController.js.map +1 -0
  245. package/lib/module/authoring/fingerprintFromInstance.js +187 -0
  246. package/lib/module/authoring/fingerprintFromInstance.js.map +1 -0
  247. package/lib/module/authoring/hitTest.js +100 -0
  248. package/lib/module/authoring/hitTest.js.map +1 -0
  249. package/lib/module/content/RichContentRenderer.js +12 -2
  250. package/lib/module/content/RichContentRenderer.js.map +1 -1
  251. package/lib/module/content/StepButton.js +19 -4
  252. package/lib/module/content/StepButton.js.map +1 -1
  253. package/lib/module/content/resolveStepButtonChrome.js +8 -6
  254. package/lib/module/content/resolveStepButtonChrome.js.map +1 -1
  255. package/lib/module/content/themeColor.js +10 -0
  256. package/lib/module/content/themeColor.js.map +1 -1
  257. package/lib/module/deviceContext.js +142 -0
  258. package/lib/module/deviceContext.js.map +1 -0
  259. package/lib/module/expo-router/useUserflowExpoRouter.js +42 -6
  260. package/lib/module/expo-router/useUserflowExpoRouter.js.map +1 -1
  261. package/lib/module/hostAppVersion.js +225 -0
  262. package/lib/module/hostAppVersion.js.map +1 -0
  263. package/lib/module/index.js +119 -6
  264. package/lib/module/index.js.map +1 -1
  265. package/lib/module/lifecycle.js +2 -0
  266. package/lib/module/lifecycle.js.map +1 -1
  267. package/lib/module/navigation/WithUserflowReactNavigation.js +18 -9
  268. package/lib/module/navigation/WithUserflowReactNavigation.js.map +1 -1
  269. package/lib/module/navigation/isOverlayPresentation.js +58 -0
  270. package/lib/module/navigation/isOverlayPresentation.js.map +1 -0
  271. package/lib/module/pairing/PairingController.js +30 -3
  272. package/lib/module/pairing/PairingController.js.map +1 -1
  273. package/lib/module/pairing/PreviewModeBanner.js +212 -85
  274. package/lib/module/pairing/PreviewModeBanner.js.map +1 -1
  275. package/lib/module/pairing/diagnostics.js +10 -2
  276. package/lib/module/pairing/diagnostics.js.map +1 -1
  277. package/lib/module/pairing/elementPickerRelay.js +87 -0
  278. package/lib/module/pairing/elementPickerRelay.js.map +1 -0
  279. package/lib/module/pairing/resolvePreviewChrome.js +48 -0
  280. package/lib/module/pairing/resolvePreviewChrome.js.map +1 -0
  281. package/lib/module/pairing/tokenStorage.js +24 -2
  282. package/lib/module/pairing/tokenStorage.js.map +1 -1
  283. package/lib/module/pairing/usePairingState.js +3 -1
  284. package/lib/module/pairing/usePairingState.js.map +1 -1
  285. package/lib/module/runtime/FlowRenderer.js +45 -21
  286. package/lib/module/runtime/FlowRenderer.js.map +1 -1
  287. package/lib/module/runtime/FlowSurfaceFade.js +49 -26
  288. package/lib/module/runtime/FlowSurfaceFade.js.map +1 -1
  289. package/lib/module/runtime/TargetPressBridge.js +12 -43
  290. package/lib/module/runtime/TargetPressBridge.js.map +1 -1
  291. package/lib/module/runtime/UserflowProvider.js +74 -20
  292. package/lib/module/runtime/UserflowProvider.js.map +1 -1
  293. package/lib/module/runtime/changedTouchPoints.js +43 -0
  294. package/lib/module/runtime/changedTouchPoints.js.map +1 -0
  295. package/lib/module/runtime/flowEngine.js +3 -1
  296. package/lib/module/runtime/flowEngine.js.map +1 -1
  297. package/lib/module/runtime/flowSessionViewState.js +32 -7
  298. package/lib/module/runtime/flowSessionViewState.js.map +1 -1
  299. package/lib/module/runtime/useFlowSessionState.js +2 -1
  300. package/lib/module/runtime/useFlowSessionState.js.map +1 -1
  301. package/lib/module/screenTracker.js +42 -4
  302. package/lib/module/screenTracker.js.map +1 -1
  303. package/lib/module/surfaces/CardFade.js +26 -0
  304. package/lib/module/surfaces/CardFade.js.map +1 -0
  305. package/lib/module/surfaces/CloseButton.js +10 -6
  306. package/lib/module/surfaces/CloseButton.js.map +1 -1
  307. package/lib/module/surfaces/ModalSurface.js +52 -36
  308. package/lib/module/surfaces/ModalSurface.js.map +1 -1
  309. package/lib/module/surfaces/TooltipSurface.js +368 -90
  310. package/lib/module/surfaces/TooltipSurface.js.map +1 -1
  311. package/lib/module/surfaces/cardTransition.js +64 -0
  312. package/lib/module/surfaces/cardTransition.js.map +1 -0
  313. package/lib/module/surfaces/resolveHighlightChrome.js +102 -0
  314. package/lib/module/surfaces/resolveHighlightChrome.js.map +1 -0
  315. package/lib/module/surfaces/resolveModalLayout.js +7 -3
  316. package/lib/module/surfaces/resolveModalLayout.js.map +1 -1
  317. package/lib/module/surfaces/resolveTooltipLayout.js +1 -4
  318. package/lib/module/surfaces/resolveTooltipLayout.js.map +1 -1
  319. package/lib/module/surfaces/surfaceInteractionConfig.js +27 -0
  320. package/lib/module/surfaces/surfaceInteractionConfig.js.map +1 -0
  321. package/lib/module/surfaces/surfaceLayoutInsets.js +119 -0
  322. package/lib/module/surfaces/surfaceLayoutInsets.js.map +1 -0
  323. package/lib/module/surfaces/themeChrome.js +3 -1
  324. package/lib/module/surfaces/themeChrome.js.map +1 -1
  325. package/lib/module/surfaces/tooltip/TooltipBubble.js +143 -22
  326. package/lib/module/surfaces/tooltip/TooltipBubble.js.map +1 -1
  327. package/lib/module/surfaces/tooltip/TooltipCutout.js +100 -47
  328. package/lib/module/surfaces/tooltip/TooltipCutout.js.map +1 -1
  329. package/lib/module/surfaces/tooltip/TooltipHighlight.js +118 -0
  330. package/lib/module/surfaces/tooltip/TooltipHighlight.js.map +1 -0
  331. package/lib/module/surfaces/tooltip/computeTooltipPosition.js +67 -13
  332. package/lib/module/surfaces/tooltip/computeTooltipPosition.js.map +1 -1
  333. package/lib/module/surfaces/tooltip/inferTooltipPlacement.js +87 -19
  334. package/lib/module/surfaces/tooltip/inferTooltipPlacement.js.map +1 -1
  335. package/lib/module/surfaces/tooltip/placementDiagnostics.js +43 -0
  336. package/lib/module/surfaces/tooltip/placementDiagnostics.js.map +1 -0
  337. package/lib/module/surfaces/tooltip/rect.js +11 -0
  338. package/lib/module/surfaces/tooltip/rect.js.map +1 -1
  339. package/lib/module/surfaces/tooltip/resolveSideCardWidth.js +96 -0
  340. package/lib/module/surfaces/tooltip/resolveSideCardWidth.js.map +1 -0
  341. package/lib/module/version.js +1 -1
  342. package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +27 -1
  343. package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts +2 -0
  345. package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts.map +1 -1
  346. package/lib/typescript/commonjs/src/anchors/autoAnchor.d.ts +1 -1
  347. package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts +14 -10
  348. package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts +1 -20
  350. package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts +21 -0
  352. package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts +42 -1
  354. package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts +42 -0
  356. package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/src/anchors/fiber/readHostContent.d.ts +17 -0
  358. package/lib/typescript/commonjs/src/anchors/fiber/readHostContent.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts +20 -0
  360. package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/src/anchors/hintsCodec.d.ts +1 -1
  362. package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +5 -5
  363. package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -1
  364. package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts +38 -0
  365. package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -0
  366. package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts +48 -0
  367. package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts.map +1 -0
  368. package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts +7 -0
  369. package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts.map +1 -0
  370. package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts +11 -0
  371. package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts.map +1 -0
  372. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBarTransition.d.ts +32 -0
  373. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBarTransition.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts +13 -0
  375. package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -0
  376. package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts +20 -0
  377. package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/src/authoring/chrome/ChromeDialog.d.ts +14 -0
  379. package/lib/typescript/commonjs/src/authoring/chrome/ChromeDialog.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts +13 -0
  381. package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts.map +1 -0
  382. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTooltip.d.ts +17 -0
  383. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTooltip.d.ts.map +1 -0
  384. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts +25 -0
  385. package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -0
  386. package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts +12 -0
  387. package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -0
  388. package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts +26 -0
  389. package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -0
  390. package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts +141 -0
  391. package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts.map +1 -0
  392. package/lib/typescript/commonjs/src/authoring/doubleTap.d.ts +14 -0
  393. package/lib/typescript/commonjs/src/authoring/doubleTap.d.ts.map +1 -0
  394. package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts +59 -0
  395. package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts.map +1 -0
  396. package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts +26 -0
  397. package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts.map +1 -0
  398. package/lib/typescript/commonjs/src/authoring/hitTest.d.ts +31 -0
  399. package/lib/typescript/commonjs/src/authoring/hitTest.d.ts.map +1 -0
  400. package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts +6 -1
  401. package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts.map +1 -1
  402. package/lib/typescript/commonjs/src/content/StepButton.d.ts.map +1 -1
  403. package/lib/typescript/commonjs/src/content/resolveStepButtonChrome.d.ts.map +1 -1
  404. package/lib/typescript/commonjs/src/content/themeColor.d.ts +5 -0
  405. package/lib/typescript/commonjs/src/content/themeColor.d.ts.map +1 -1
  406. package/lib/typescript/commonjs/src/deviceContext.d.ts +66 -0
  407. package/lib/typescript/commonjs/src/deviceContext.d.ts.map +1 -0
  408. package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
  409. package/lib/typescript/commonjs/src/hostAppVersion.d.ts +69 -0
  410. package/lib/typescript/commonjs/src/hostAppVersion.d.ts.map +1 -0
  411. package/lib/typescript/commonjs/src/index.d.ts +53 -2
  412. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  413. package/lib/typescript/commonjs/src/lifecycle.d.ts +6 -0
  414. package/lib/typescript/commonjs/src/lifecycle.d.ts.map +1 -1
  415. package/lib/typescript/commonjs/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
  416. package/lib/typescript/commonjs/src/navigation/isOverlayPresentation.d.ts +14 -0
  417. package/lib/typescript/commonjs/src/navigation/isOverlayPresentation.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +7 -0
  419. package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -1
  420. package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts +6 -1
  421. package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts.map +1 -1
  422. package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts +5 -0
  423. package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts.map +1 -1
  424. package/lib/typescript/commonjs/src/pairing/elementPickerRelay.d.ts +11 -0
  425. package/lib/typescript/commonjs/src/pairing/elementPickerRelay.d.ts.map +1 -0
  426. package/lib/typescript/commonjs/src/pairing/resolvePreviewChrome.d.ts +16 -0
  427. package/lib/typescript/commonjs/src/pairing/resolvePreviewChrome.d.ts.map +1 -0
  428. package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts +2 -0
  429. package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -1
  430. package/lib/typescript/commonjs/src/pairing/usePairingState.d.ts.map +1 -1
  431. package/lib/typescript/commonjs/src/runtime/FlowRenderer.d.ts +6 -3
  432. package/lib/typescript/commonjs/src/runtime/FlowRenderer.d.ts.map +1 -1
  433. package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts +20 -7
  434. package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts.map +1 -1
  435. package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +5 -1
  436. package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
  437. package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts +6 -4
  438. package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
  439. package/lib/typescript/commonjs/src/runtime/changedTouchPoints.d.ts +10 -0
  440. package/lib/typescript/commonjs/src/runtime/changedTouchPoints.d.ts.map +1 -0
  441. package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -1
  442. package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts +12 -3
  443. package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts.map +1 -1
  444. package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts +1 -0
  445. package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts.map +1 -1
  446. package/lib/typescript/commonjs/src/screenTracker.d.ts +21 -3
  447. package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -1
  448. package/lib/typescript/commonjs/src/surfaces/CardFade.d.ts +12 -0
  449. package/lib/typescript/commonjs/src/surfaces/CardFade.d.ts.map +1 -0
  450. package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts +8 -2
  451. package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts.map +1 -1
  452. package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts +1 -1
  453. package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts +1 -1
  454. package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts.map +1 -1
  455. package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts +12 -1
  456. package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -1
  457. package/lib/typescript/commonjs/src/surfaces/cardTransition.d.ts +31 -0
  458. package/lib/typescript/commonjs/src/surfaces/cardTransition.d.ts.map +1 -0
  459. package/lib/typescript/commonjs/src/surfaces/resolveHighlightChrome.d.ts +44 -0
  460. package/lib/typescript/commonjs/src/surfaces/resolveHighlightChrome.d.ts.map +1 -0
  461. package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts +1 -1
  462. package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts.map +1 -1
  463. package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts +0 -7
  464. package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts.map +1 -1
  465. package/lib/typescript/commonjs/src/surfaces/surfaceInteractionConfig.d.ts +15 -0
  466. package/lib/typescript/commonjs/src/surfaces/surfaceInteractionConfig.d.ts.map +1 -0
  467. package/lib/typescript/commonjs/src/surfaces/surfaceLayoutInsets.d.ts +38 -0
  468. package/lib/typescript/commonjs/src/surfaces/surfaceLayoutInsets.d.ts.map +1 -0
  469. package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts +3 -1
  470. package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts.map +1 -1
  471. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts +21 -6
  472. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
  473. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts +18 -10
  474. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -1
  475. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipHighlight.d.ts +25 -0
  476. package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipHighlight.d.ts.map +1 -0
  477. package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts +23 -0
  478. package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -1
  479. package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts +47 -1
  480. package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -1
  481. package/lib/typescript/commonjs/src/surfaces/tooltip/placementDiagnostics.d.ts +39 -0
  482. package/lib/typescript/commonjs/src/surfaces/tooltip/placementDiagnostics.d.ts.map +1 -0
  483. package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts +2 -0
  484. package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts.map +1 -1
  485. package/lib/typescript/commonjs/src/surfaces/tooltip/resolveSideCardWidth.d.ts +76 -0
  486. package/lib/typescript/commonjs/src/surfaces/tooltip/resolveSideCardWidth.d.ts.map +1 -0
  487. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  488. package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +27 -1
  489. package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
  490. package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts +2 -0
  491. package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts.map +1 -1
  492. package/lib/typescript/module/src/anchors/autoAnchor.d.ts +1 -1
  493. package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts +14 -10
  494. package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
  495. package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts +1 -20
  496. package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -1
  497. package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts +21 -0
  498. package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -0
  499. package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts +42 -1
  500. package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
  501. package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts +42 -0
  502. package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts.map +1 -0
  503. package/lib/typescript/module/src/anchors/fiber/readHostContent.d.ts +17 -0
  504. package/lib/typescript/module/src/anchors/fiber/readHostContent.d.ts.map +1 -0
  505. package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts +20 -0
  506. package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts.map +1 -0
  507. package/lib/typescript/module/src/anchors/hintsCodec.d.ts +1 -1
  508. package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +5 -5
  509. package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -1
  510. package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts +38 -0
  511. package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -0
  512. package/lib/typescript/module/src/anchors/semanticMatcher.d.ts +48 -0
  513. package/lib/typescript/module/src/anchors/semanticMatcher.d.ts.map +1 -0
  514. package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts +7 -0
  515. package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts.map +1 -0
  516. package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts +11 -0
  517. package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts.map +1 -0
  518. package/lib/typescript/module/src/authoring/chrome/ChromeBarTransition.d.ts +32 -0
  519. package/lib/typescript/module/src/authoring/chrome/ChromeBarTransition.d.ts.map +1 -0
  520. package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts +13 -0
  521. package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -0
  522. package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts +20 -0
  523. package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts.map +1 -0
  524. package/lib/typescript/module/src/authoring/chrome/ChromeDialog.d.ts +14 -0
  525. package/lib/typescript/module/src/authoring/chrome/ChromeDialog.d.ts.map +1 -0
  526. package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts +13 -0
  527. package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts.map +1 -0
  528. package/lib/typescript/module/src/authoring/chrome/ChromeTooltip.d.ts +17 -0
  529. package/lib/typescript/module/src/authoring/chrome/ChromeTooltip.d.ts.map +1 -0
  530. package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts +25 -0
  531. package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -0
  532. package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts +12 -0
  533. package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -0
  534. package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts +26 -0
  535. package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -0
  536. package/lib/typescript/module/src/authoring/chrome/tokens.d.ts +141 -0
  537. package/lib/typescript/module/src/authoring/chrome/tokens.d.ts.map +1 -0
  538. package/lib/typescript/module/src/authoring/doubleTap.d.ts +14 -0
  539. package/lib/typescript/module/src/authoring/doubleTap.d.ts.map +1 -0
  540. package/lib/typescript/module/src/authoring/elementPickerController.d.ts +59 -0
  541. package/lib/typescript/module/src/authoring/elementPickerController.d.ts.map +1 -0
  542. package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts +26 -0
  543. package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts.map +1 -0
  544. package/lib/typescript/module/src/authoring/hitTest.d.ts +31 -0
  545. package/lib/typescript/module/src/authoring/hitTest.d.ts.map +1 -0
  546. package/lib/typescript/module/src/content/RichContentRenderer.d.ts +6 -1
  547. package/lib/typescript/module/src/content/RichContentRenderer.d.ts.map +1 -1
  548. package/lib/typescript/module/src/content/StepButton.d.ts.map +1 -1
  549. package/lib/typescript/module/src/content/resolveStepButtonChrome.d.ts.map +1 -1
  550. package/lib/typescript/module/src/content/themeColor.d.ts +5 -0
  551. package/lib/typescript/module/src/content/themeColor.d.ts.map +1 -1
  552. package/lib/typescript/module/src/deviceContext.d.ts +66 -0
  553. package/lib/typescript/module/src/deviceContext.d.ts.map +1 -0
  554. package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
  555. package/lib/typescript/module/src/hostAppVersion.d.ts +69 -0
  556. package/lib/typescript/module/src/hostAppVersion.d.ts.map +1 -0
  557. package/lib/typescript/module/src/index.d.ts +53 -2
  558. package/lib/typescript/module/src/index.d.ts.map +1 -1
  559. package/lib/typescript/module/src/lifecycle.d.ts +6 -0
  560. package/lib/typescript/module/src/lifecycle.d.ts.map +1 -1
  561. package/lib/typescript/module/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
  562. package/lib/typescript/module/src/navigation/isOverlayPresentation.d.ts +14 -0
  563. package/lib/typescript/module/src/navigation/isOverlayPresentation.d.ts.map +1 -0
  564. package/lib/typescript/module/src/pairing/PairingController.d.ts +7 -0
  565. package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -1
  566. package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts +6 -1
  567. package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts.map +1 -1
  568. package/lib/typescript/module/src/pairing/diagnostics.d.ts +5 -0
  569. package/lib/typescript/module/src/pairing/diagnostics.d.ts.map +1 -1
  570. package/lib/typescript/module/src/pairing/elementPickerRelay.d.ts +11 -0
  571. package/lib/typescript/module/src/pairing/elementPickerRelay.d.ts.map +1 -0
  572. package/lib/typescript/module/src/pairing/resolvePreviewChrome.d.ts +16 -0
  573. package/lib/typescript/module/src/pairing/resolvePreviewChrome.d.ts.map +1 -0
  574. package/lib/typescript/module/src/pairing/tokenStorage.d.ts +2 -0
  575. package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -1
  576. package/lib/typescript/module/src/pairing/usePairingState.d.ts.map +1 -1
  577. package/lib/typescript/module/src/runtime/FlowRenderer.d.ts +6 -3
  578. package/lib/typescript/module/src/runtime/FlowRenderer.d.ts.map +1 -1
  579. package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts +20 -7
  580. package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts.map +1 -1
  581. package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +5 -1
  582. package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
  583. package/lib/typescript/module/src/runtime/UserflowProvider.d.ts +6 -4
  584. package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
  585. package/lib/typescript/module/src/runtime/changedTouchPoints.d.ts +10 -0
  586. package/lib/typescript/module/src/runtime/changedTouchPoints.d.ts.map +1 -0
  587. package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -1
  588. package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts +12 -3
  589. package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts.map +1 -1
  590. package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts +1 -0
  591. package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts.map +1 -1
  592. package/lib/typescript/module/src/screenTracker.d.ts +21 -3
  593. package/lib/typescript/module/src/screenTracker.d.ts.map +1 -1
  594. package/lib/typescript/module/src/surfaces/CardFade.d.ts +12 -0
  595. package/lib/typescript/module/src/surfaces/CardFade.d.ts.map +1 -0
  596. package/lib/typescript/module/src/surfaces/CloseButton.d.ts +8 -2
  597. package/lib/typescript/module/src/surfaces/CloseButton.d.ts.map +1 -1
  598. package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts +1 -1
  599. package/lib/typescript/module/src/surfaces/ModalSurface.d.ts +1 -1
  600. package/lib/typescript/module/src/surfaces/ModalSurface.d.ts.map +1 -1
  601. package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts +12 -1
  602. package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -1
  603. package/lib/typescript/module/src/surfaces/cardTransition.d.ts +31 -0
  604. package/lib/typescript/module/src/surfaces/cardTransition.d.ts.map +1 -0
  605. package/lib/typescript/module/src/surfaces/resolveHighlightChrome.d.ts +44 -0
  606. package/lib/typescript/module/src/surfaces/resolveHighlightChrome.d.ts.map +1 -0
  607. package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts +1 -1
  608. package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts.map +1 -1
  609. package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts +0 -7
  610. package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts.map +1 -1
  611. package/lib/typescript/module/src/surfaces/surfaceInteractionConfig.d.ts +15 -0
  612. package/lib/typescript/module/src/surfaces/surfaceInteractionConfig.d.ts.map +1 -0
  613. package/lib/typescript/module/src/surfaces/surfaceLayoutInsets.d.ts +38 -0
  614. package/lib/typescript/module/src/surfaces/surfaceLayoutInsets.d.ts.map +1 -0
  615. package/lib/typescript/module/src/surfaces/themeChrome.d.ts +3 -1
  616. package/lib/typescript/module/src/surfaces/themeChrome.d.ts.map +1 -1
  617. package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts +21 -6
  618. package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
  619. package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts +18 -10
  620. package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -1
  621. package/lib/typescript/module/src/surfaces/tooltip/TooltipHighlight.d.ts +25 -0
  622. package/lib/typescript/module/src/surfaces/tooltip/TooltipHighlight.d.ts.map +1 -0
  623. package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts +23 -0
  624. package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -1
  625. package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts +47 -1
  626. package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -1
  627. package/lib/typescript/module/src/surfaces/tooltip/placementDiagnostics.d.ts +39 -0
  628. package/lib/typescript/module/src/surfaces/tooltip/placementDiagnostics.d.ts.map +1 -0
  629. package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts +2 -0
  630. package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts.map +1 -1
  631. package/lib/typescript/module/src/surfaces/tooltip/resolveSideCardWidth.d.ts +76 -0
  632. package/lib/typescript/module/src/surfaces/tooltip/resolveSideCardWidth.d.ts.map +1 -0
  633. package/lib/typescript/module/src/version.d.ts +1 -1
  634. package/package.json +32 -18
  635. package/src/anchors/AutoAnchorRegistry.ts +140 -3
  636. package/src/anchors/anchorChangeTicker.ts +10 -0
  637. package/src/anchors/autoAnchor.ts +1 -1
  638. package/src/anchors/elementConditionEvaluator.ts +29 -16
  639. package/src/anchors/fiber/FiberScanRoot.tsx +2 -50
  640. package/src/anchors/fiber/FiberScanRootStore.ts +51 -0
  641. package/src/anchors/fiber/fiberInternals.ts +166 -3
  642. package/src/anchors/fiber/indexHostFibers.ts +136 -0
  643. package/src/anchors/fiber/readHostContent.ts +146 -0
  644. package/src/anchors/fiberAnchorCache.ts +45 -0
  645. package/src/anchors/hintsCodec.ts +1 -1
  646. package/src/anchors/resolveAnchorHost.ts +23 -23
  647. package/src/anchors/resolveAutoAnchorHost.ts +180 -0
  648. package/src/anchors/semanticMatcher.ts +361 -0
  649. package/src/authoring/ElementPickerOverlay.tsx +553 -0
  650. package/src/authoring/capturePickerScreenshot.ts +90 -0
  651. package/src/authoring/chrome/ChromeBarTransition.tsx +106 -0
  652. package/src/authoring/chrome/ChromeBottomSheet.tsx +69 -0
  653. package/src/authoring/chrome/ChromeButton.tsx +103 -0
  654. package/src/authoring/chrome/ChromeDialog.tsx +121 -0
  655. package/src/authoring/chrome/ChromeIcon.tsx +40 -0
  656. package/src/authoring/chrome/ChromeTooltip.tsx +89 -0
  657. package/src/authoring/chrome/ChromeTopBar.tsx +126 -0
  658. package/src/authoring/chrome/DoubleTapBridge.tsx +60 -0
  659. package/src/authoring/chrome/doubleTapMonitor.ts +80 -0
  660. package/src/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
  661. package/src/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
  662. package/src/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
  663. package/src/authoring/chrome/icons/arrow-rotate-left.png +0 -0
  664. package/src/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
  665. package/src/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
  666. package/src/authoring/chrome/icons/userflow-logomark.png +0 -0
  667. package/src/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
  668. package/src/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
  669. package/src/authoring/chrome/icons/xmark.png +0 -0
  670. package/src/authoring/chrome/icons/xmark@2x.png +0 -0
  671. package/src/authoring/chrome/icons/xmark@3x.png +0 -0
  672. package/src/authoring/chrome/tokens.ts +106 -0
  673. package/src/authoring/doubleTap.ts +27 -0
  674. package/src/authoring/elementPickerController.ts +135 -0
  675. package/src/authoring/fingerprintFromInstance.ts +152 -0
  676. package/src/authoring/hitTest.ts +133 -0
  677. package/src/content/RichContentRenderer.tsx +22 -1
  678. package/src/content/StepButton.tsx +17 -2
  679. package/src/content/resolveStepButtonChrome.ts +12 -6
  680. package/src/content/themeColor.ts +10 -0
  681. package/src/deviceContext.ts +168 -0
  682. package/src/expo-router/useUserflowExpoRouter.ts +47 -4
  683. package/src/hostAppVersion.ts +258 -0
  684. package/src/index.ts +148 -4
  685. package/src/lifecycle.ts +8 -0
  686. package/src/navigation/WithUserflowReactNavigation.tsx +23 -7
  687. package/src/navigation/isOverlayPresentation.ts +76 -0
  688. package/src/pairing/PairingController.ts +32 -3
  689. package/src/pairing/PreviewModeBanner.tsx +250 -94
  690. package/src/pairing/diagnostics.ts +10 -2
  691. package/src/pairing/elementPickerRelay.ts +100 -0
  692. package/src/pairing/resolvePreviewChrome.ts +57 -0
  693. package/src/pairing/tokenStorage.ts +31 -2
  694. package/src/pairing/usePairingState.ts +2 -0
  695. package/src/runtime/FlowRenderer.tsx +55 -27
  696. package/src/runtime/FlowSurfaceFade.tsx +51 -30
  697. package/src/runtime/TargetPressBridge.tsx +14 -32
  698. package/src/runtime/UserflowProvider.tsx +76 -13
  699. package/src/runtime/changedTouchPoints.ts +34 -0
  700. package/src/runtime/flowEngine.ts +2 -0
  701. package/src/runtime/flowSessionViewState.ts +42 -4
  702. package/src/runtime/useFlowSessionState.ts +2 -0
  703. package/src/screenTracker.ts +46 -4
  704. package/src/surfaces/CardFade.tsx +18 -0
  705. package/src/surfaces/CloseButton.tsx +17 -7
  706. package/src/surfaces/MadeWithUserflow.tsx +1 -1
  707. package/src/surfaces/ModalSurface.tsx +48 -35
  708. package/src/surfaces/TooltipSurface.tsx +406 -86
  709. package/src/surfaces/cardTransition.ts +67 -0
  710. package/src/surfaces/resolveHighlightChrome.ts +139 -0
  711. package/src/surfaces/resolveModalLayout.ts +16 -8
  712. package/src/surfaces/resolveTooltipLayout.ts +1 -14
  713. package/src/surfaces/surfaceInteractionConfig.ts +25 -0
  714. package/src/surfaces/surfaceLayoutInsets.tsx +135 -0
  715. package/src/surfaces/themeChrome.ts +5 -3
  716. package/src/surfaces/tooltip/TooltipBubble.tsx +154 -19
  717. package/src/surfaces/tooltip/TooltipCutout.tsx +106 -49
  718. package/src/surfaces/tooltip/TooltipHighlight.tsx +144 -0
  719. package/src/surfaces/tooltip/computeTooltipPosition.ts +98 -12
  720. package/src/surfaces/tooltip/inferTooltipPlacement.ts +107 -18
  721. package/src/surfaces/tooltip/placementDiagnostics.ts +70 -0
  722. package/src/surfaces/tooltip/rect.ts +11 -0
  723. package/src/surfaces/tooltip/resolveSideCardWidth.ts +121 -0
  724. package/src/version.ts +1 -1
  725. package/vendor/core/LICENSE +76 -0
  726. package/vendor/core/README.md +9 -0
  727. package/vendor/core/dist/attributes.d.ts +15 -0
  728. package/vendor/core/dist/attributes.d.ts.map +1 -0
  729. package/vendor/core/dist/attributes.js +55 -0
  730. package/vendor/core/dist/attributes.js.map +1 -0
  731. package/vendor/core/dist/constants.d.ts +21 -0
  732. package/vendor/core/dist/constants.d.ts.map +1 -0
  733. package/vendor/core/dist/constants.js +21 -0
  734. package/vendor/core/dist/constants.js.map +1 -0
  735. package/vendor/core/dist/engine/ClientConditionEngine.d.ts +68 -0
  736. package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -0
  737. package/vendor/core/dist/engine/ClientConditionEngine.js +197 -0
  738. package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -0
  739. package/vendor/core/dist/engine/FlowSessionEngine.d.ts +160 -0
  740. package/vendor/core/dist/engine/FlowSessionEngine.d.ts.map +1 -0
  741. package/vendor/core/dist/engine/FlowSessionEngine.js +571 -0
  742. package/vendor/core/dist/engine/FlowSessionEngine.js.map +1 -0
  743. package/vendor/core/dist/engine/PairingEngine.d.ts +135 -0
  744. package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -0
  745. package/vendor/core/dist/engine/PairingEngine.js +396 -0
  746. package/vendor/core/dist/engine/PairingEngine.js.map +1 -0
  747. package/vendor/core/dist/engine/UserflowCore.d.ts +145 -0
  748. package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -0
  749. package/vendor/core/dist/engine/UserflowCore.js +329 -0
  750. package/vendor/core/dist/engine/UserflowCore.js.map +1 -0
  751. package/vendor/core/dist/engine/conditionOperators.d.ts +16 -0
  752. package/vendor/core/dist/engine/conditionOperators.d.ts.map +1 -0
  753. package/vendor/core/dist/engine/conditionOperators.js +168 -0
  754. package/vendor/core/dist/engine/conditionOperators.js.map +1 -0
  755. package/vendor/core/dist/engine/handleActions.d.ts +42 -0
  756. package/vendor/core/dist/engine/handleActions.d.ts.map +1 -0
  757. package/vendor/core/dist/engine/handleActions.js +198 -0
  758. package/vendor/core/dist/engine/handleActions.js.map +1 -0
  759. package/vendor/core/dist/engine/interpolateSessionData.d.ts +7 -0
  760. package/vendor/core/dist/engine/interpolateSessionData.d.ts.map +1 -0
  761. package/vendor/core/dist/engine/interpolateSessionData.js +29 -0
  762. package/vendor/core/dist/engine/interpolateSessionData.js.map +1 -0
  763. package/vendor/core/dist/engine/simpleObservable.d.ts +13 -0
  764. package/vendor/core/dist/engine/simpleObservable.d.ts.map +1 -0
  765. package/vendor/core/dist/engine/simpleObservable.js +29 -0
  766. package/vendor/core/dist/engine/simpleObservable.js.map +1 -0
  767. package/vendor/core/dist/engine/trackCondition.d.ts +25 -0
  768. package/vendor/core/dist/engine/trackCondition.d.ts.map +1 -0
  769. package/vendor/core/dist/engine/trackCondition.js +177 -0
  770. package/vendor/core/dist/engine/trackCondition.js.map +1 -0
  771. package/vendor/core/dist/engine/trackStepTriggers.d.ts +21 -0
  772. package/vendor/core/dist/engine/trackStepTriggers.d.ts.map +1 -0
  773. package/vendor/core/dist/engine/trackStepTriggers.js +49 -0
  774. package/vendor/core/dist/engine/trackStepTriggers.js.map +1 -0
  775. package/vendor/core/dist/errors.d.ts +9 -0
  776. package/vendor/core/dist/errors.d.ts.map +1 -0
  777. package/vendor/core/dist/errors.js +15 -0
  778. package/vendor/core/dist/errors.js.map +1 -0
  779. package/vendor/core/dist/eventAttributes.d.ts +7 -0
  780. package/vendor/core/dist/eventAttributes.d.ts.map +1 -0
  781. package/vendor/core/dist/eventAttributes.js +31 -0
  782. package/vendor/core/dist/eventAttributes.js.map +1 -0
  783. package/vendor/core/dist/index.d.ts +31 -0
  784. package/vendor/core/dist/index.d.ts.map +1 -0
  785. package/vendor/core/dist/index.js +22 -0
  786. package/vendor/core/dist/index.js.map +1 -0
  787. package/vendor/core/dist/normalizeAttributes.d.ts +8 -0
  788. package/vendor/core/dist/normalizeAttributes.d.ts.map +1 -0
  789. package/vendor/core/dist/normalizeAttributes.js +127 -0
  790. package/vendor/core/dist/normalizeAttributes.js.map +1 -0
  791. package/vendor/core/dist/transport/backoff.d.ts +11 -0
  792. package/vendor/core/dist/transport/backoff.d.ts.map +1 -0
  793. package/vendor/core/dist/transport/backoff.js +17 -0
  794. package/vendor/core/dist/transport/backoff.js.map +1 -0
  795. package/vendor/core/dist/transport/pairing.d.ts +121 -0
  796. package/vendor/core/dist/transport/pairing.d.ts.map +1 -0
  797. package/vendor/core/dist/transport/pairing.js +551 -0
  798. package/vendor/core/dist/transport/pairing.js.map +1 -0
  799. package/vendor/core/dist/transport/phoenix.d.ts +228 -0
  800. package/vendor/core/dist/transport/phoenix.d.ts.map +1 -0
  801. package/vendor/core/dist/transport/phoenix.js +811 -0
  802. package/vendor/core/dist/transport/phoenix.js.map +1 -0
  803. package/vendor/core/dist/transport/rateLimiter.d.ts +17 -0
  804. package/vendor/core/dist/transport/rateLimiter.d.ts.map +1 -0
  805. package/vendor/core/dist/transport/rateLimiter.js +30 -0
  806. package/vendor/core/dist/transport/rateLimiter.js.map +1 -0
  807. package/vendor/core/dist/transport/scheduler.d.ts +12 -0
  808. package/vendor/core/dist/transport/scheduler.d.ts.map +1 -0
  809. package/vendor/core/dist/transport/scheduler.js +11 -0
  810. package/vendor/core/dist/transport/scheduler.js.map +1 -0
  811. package/vendor/core/dist/types.d.ts +60 -0
  812. package/vendor/core/dist/types.d.ts.map +1 -0
  813. package/vendor/core/dist/types.js +2 -0
  814. package/vendor/core/dist/types.js.map +1 -0
  815. package/vendor/core/dist/version.d.ts +3 -0
  816. package/vendor/core/dist/version.d.ts.map +1 -0
  817. package/vendor/core/dist/version.js +3 -0
  818. package/vendor/core/dist/version.js.map +1 -0
  819. package/vendor/core/package.json +20 -0
  820. package/vendor/protocol/LICENSE +76 -0
  821. package/vendor/protocol/README.md +8 -0
  822. package/vendor/protocol/dist/attributes.d.ts +43 -0
  823. package/vendor/protocol/dist/attributes.d.ts.map +1 -0
  824. package/vendor/protocol/dist/attributes.js +15 -0
  825. package/vendor/protocol/dist/attributes.js.map +1 -0
  826. package/vendor/protocol/dist/autoData.d.ts +232 -0
  827. package/vendor/protocol/dist/autoData.d.ts.map +1 -0
  828. package/vendor/protocol/dist/autoData.js +78 -0
  829. package/vendor/protocol/dist/autoData.js.map +1 -0
  830. package/vendor/protocol/dist/events.d.ts +24 -0
  831. package/vendor/protocol/dist/events.d.ts.map +1 -0
  832. package/vendor/protocol/dist/events.js +8 -0
  833. package/vendor/protocol/dist/events.js.map +1 -0
  834. package/vendor/protocol/dist/flows.d.ts +360 -0
  835. package/vendor/protocol/dist/flows.d.ts.map +1 -0
  836. package/vendor/protocol/dist/flows.js +201 -0
  837. package/vendor/protocol/dist/flows.js.map +1 -0
  838. package/vendor/protocol/dist/index.d.ts +25 -0
  839. package/vendor/protocol/dist/index.d.ts.map +1 -0
  840. package/vendor/protocol/dist/index.js +17 -0
  841. package/vendor/protocol/dist/index.js.map +1 -0
  842. package/vendor/protocol/dist/messages.d.ts +187 -0
  843. package/vendor/protocol/dist/messages.d.ts.map +1 -0
  844. package/vendor/protocol/dist/messages.js +61 -0
  845. package/vendor/protocol/dist/messages.js.map +1 -0
  846. package/vendor/protocol/dist/pairing.d.ts +82 -0
  847. package/vendor/protocol/dist/pairing.d.ts.map +1 -0
  848. package/vendor/protocol/dist/pairing.js +146 -0
  849. package/vendor/protocol/dist/pairing.js.map +1 -0
  850. package/vendor/protocol/package.json +17 -0
@@ -0,0 +1,168 @@
1
+ import { FlowConditionOperator } from '@userflow-tech/protocol';
2
+ import { interpolateSessionData } from './interpolateSessionData.js';
3
+ /**
4
+ * ATTRIBUTE comparison operators, ported from web
5
+ * `userflowjs/util/flow-condition-operators.ts` without date-fns.
6
+ */
7
+ export const conditionOperators = {
8
+ [FlowConditionOperator.ABSOLUTE_EQ]: ({ condition, value }) => {
9
+ const actual = parseDateValue(value);
10
+ const start = parseAbsoluteDateValue(condition.value, '00:00:00.000');
11
+ const end = parseAbsoluteDateValue(condition.value, '23:59:59.999');
12
+ return (actual != null &&
13
+ start != null &&
14
+ end != null &&
15
+ !isBefore(actual, start) &&
16
+ !isAfter(actual, end));
17
+ },
18
+ [FlowConditionOperator.ABSOLUTE_GT]: ({ condition, value }) => {
19
+ const actual = parseDateValue(value);
20
+ const end = parseAbsoluteDateValue(condition.value, '23:59:59.999');
21
+ return actual != null && end != null && isAfter(actual, end);
22
+ },
23
+ [FlowConditionOperator.ABSOLUTE_LT]: ({ condition, value }) => {
24
+ const actual = parseDateValue(value);
25
+ const start = parseAbsoluteDateValue(condition.value, '00:00:00.000');
26
+ return actual != null && start != null && isBefore(actual, start);
27
+ },
28
+ [FlowConditionOperator.AND]: () => false,
29
+ [FlowConditionOperator.BETWEEN]: ({ condition, value }) => !!value &&
30
+ !!condition.value &&
31
+ !!condition.value2 &&
32
+ parseFloat(valueToString(value)) >= parseFloat(condition.value) &&
33
+ parseFloat(valueToString(value)) <= parseFloat(condition.value2),
34
+ [FlowConditionOperator.CONTAINS]: ({ sessionData, condition, value }) => !!value &&
35
+ valueToString(value)
36
+ .toLowerCase()
37
+ .includes(interpolateSessionData(condition.value || '', sessionData).toLowerCase()),
38
+ [FlowConditionOperator.EMPTY]: ({ value }) => value == null || value === '' || (Array.isArray(value) && value.length === 0),
39
+ [FlowConditionOperator.ENDS_WITH]: ({ sessionData, condition, value }) => !!value &&
40
+ valueToString(value)
41
+ .toLowerCase()
42
+ .endsWith(interpolateSessionData(condition.value || '', sessionData).toLowerCase()),
43
+ [FlowConditionOperator.EQ]: ({ sessionData, condition, value }) => interpolateSessionData(condition.value || '', sessionData) === valueToString(value),
44
+ [FlowConditionOperator.EXCLUDES_ALL]: ({ condition, value }) => {
45
+ const valueSet = new Set(valueToList(value));
46
+ return !(condition.values || []).some((item) => valueSet.has(item));
47
+ },
48
+ [FlowConditionOperator.EXCLUDES_ANY]: ({ condition, value }) => {
49
+ const valueSet = new Set(valueToList(value));
50
+ return !(condition.values || []).every((item) => valueSet.has(item));
51
+ },
52
+ [FlowConditionOperator.FALSE]: ({ value }) => valueToString(value).toLowerCase() === 'false',
53
+ [FlowConditionOperator.GT]: ({ condition, value }) => !!value && !!condition.value && parseFloat(valueToString(value)) > parseFloat(condition.value),
54
+ [FlowConditionOperator.GTE]: ({ condition, value }) => !!value && !!condition.value && parseFloat(valueToString(value)) >= parseFloat(condition.value),
55
+ [FlowConditionOperator.INCLUDES_ALL]: ({ condition, value }) => {
56
+ const valueSet = new Set(valueToList(value));
57
+ return (condition.values || []).every((item) => valueSet.has(item));
58
+ },
59
+ [FlowConditionOperator.INCLUDES_ANY]: ({ condition, value }) => {
60
+ const valueSet = new Set(valueToList(value));
61
+ return (condition.values || []).some((item) => valueSet.has(item));
62
+ },
63
+ [FlowConditionOperator.LT]: ({ condition, value }) => !!value && !!condition.value && parseFloat(valueToString(value)) < parseFloat(condition.value),
64
+ [FlowConditionOperator.LTE]: ({ condition, value }) => !!value && !!condition.value && parseFloat(valueToString(value)) <= parseFloat(condition.value),
65
+ [FlowConditionOperator.NE]: ({ sessionData, condition, value }) => interpolateSessionData(condition.value || '', sessionData) !== valueToString(value),
66
+ [FlowConditionOperator.NOT_CONTAINS]: ({ sessionData, condition, value }) => !value ||
67
+ !valueToString(value)
68
+ .toLowerCase()
69
+ .includes(interpolateSessionData(condition.value || '', sessionData).toLowerCase()),
70
+ [FlowConditionOperator.NOT_EMPTY]: ({ value }) => value != null && value !== '' && (!Array.isArray(value) || value.length > 0),
71
+ [FlowConditionOperator.NOT_REGEX]: ({ condition, value }) => !compareRegex(condition, value),
72
+ [FlowConditionOperator.OR]: () => false,
73
+ [FlowConditionOperator.REGEX]: ({ condition, value }) => compareRegex(condition, value),
74
+ [FlowConditionOperator.RELATIVE_EQ]: ({ condition, value, now = Date.now }) => {
75
+ const actual = parseDateValue(value);
76
+ const target = parseRelativeDate(condition.value, now);
77
+ if (actual == null || target == null) {
78
+ return false;
79
+ }
80
+ return !isBefore(actual, target) && isBefore(actual, addUtcDays(target, 1));
81
+ },
82
+ [FlowConditionOperator.RELATIVE_GT]: ({ condition, value, now = Date.now }) => {
83
+ const actual = parseDateValue(value);
84
+ const target = parseRelativeDate(condition.value, now);
85
+ if (actual == null || target == null) {
86
+ return false;
87
+ }
88
+ return isAfter(actual, target);
89
+ },
90
+ [FlowConditionOperator.RELATIVE_LT]: ({ condition, value, now = Date.now }) => {
91
+ const actual = parseDateValue(value);
92
+ const target = parseRelativeDate(condition.value, now);
93
+ if (actual == null || target == null) {
94
+ return false;
95
+ }
96
+ return isBefore(actual, target);
97
+ },
98
+ [FlowConditionOperator.STARTS_WITH]: ({ sessionData, condition, value }) => !!value &&
99
+ valueToString(value)
100
+ .toLowerCase()
101
+ .startsWith(interpolateSessionData(condition.value || '', sessionData).toLowerCase()),
102
+ [FlowConditionOperator.TRUE]: ({ value }) => valueToString(value).toLowerCase() === 'true',
103
+ [FlowConditionOperator.URL]: () => false,
104
+ };
105
+ function parseDateValue(dateString) {
106
+ if (Array.isArray(dateString)) {
107
+ dateString = dateString[0] ?? null;
108
+ }
109
+ if (!dateString) {
110
+ return null;
111
+ }
112
+ if (/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
113
+ dateString += 'T00:00:00.000Z';
114
+ }
115
+ else if (!/(Z|([+-]\d\d:\d\d))$/i.test(dateString)) {
116
+ dateString += 'Z';
117
+ }
118
+ const parsed = new Date(dateString);
119
+ return Number.isNaN(parsed.valueOf()) ? null : parsed;
120
+ }
121
+ function parseAbsoluteDateValue(dateString, time) {
122
+ if (!dateString) {
123
+ return null;
124
+ }
125
+ const parsed = new Date(`${dateString}T${time}Z`);
126
+ return Number.isNaN(parsed.valueOf()) ? null : parsed;
127
+ }
128
+ function parseRelativeDate(daysString, now) {
129
+ if (!daysString) {
130
+ return null;
131
+ }
132
+ const days = parseInt(daysString, 10);
133
+ if (Number.isNaN(days)) {
134
+ return null;
135
+ }
136
+ const date = new Date(now());
137
+ date.setUTCDate(date.getUTCDate() - days);
138
+ return date;
139
+ }
140
+ function addUtcDays(date, days) {
141
+ const next = new Date(date.getTime());
142
+ next.setUTCDate(next.getUTCDate() + days);
143
+ return next;
144
+ }
145
+ function isBefore(left, right) {
146
+ return left.getTime() < right.getTime();
147
+ }
148
+ function isAfter(left, right) {
149
+ return left.getTime() > right.getTime();
150
+ }
151
+ function compareRegex(condition, value) {
152
+ if (!condition.value) {
153
+ return false;
154
+ }
155
+ try {
156
+ return new RegExp(condition.value).test(valueToString(value));
157
+ }
158
+ catch {
159
+ return false;
160
+ }
161
+ }
162
+ function valueToString(value) {
163
+ return Array.isArray(value) ? (value[0] ?? '') : value == null ? '' : value;
164
+ }
165
+ function valueToList(value) {
166
+ return Array.isArray(value) ? value : value === '' || value == null ? [] : [value];
167
+ }
168
+ //# sourceMappingURL=conditionOperators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionOperators.js","sourceRoot":"","sources":["../../src/engine/conditionOperators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAWrE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA6C;IAC1E,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACpE,OAAO,CACL,MAAM,IAAI,IAAI;YACd,KAAK,IAAI,IAAI;YACb,GAAG,IAAI,IAAI;YACX,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;YACxB,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACtB,CAAC;IACJ,CAAC;IAED,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC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AAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { FlowActionFragment, FlowSessionFragment, FlowStepFragment } from '@userflow-tech/protocol';
2
+ import { EndFlowReasonInput, StartFlowReasonInput } from '@userflow-tech/protocol';
3
+ import type { PublicAttributes } from '../types.js';
4
+ /** Narrow surface handleActions needs from FlowSessionEngine (avoids a circular import). */
5
+ export interface FlowActionRunner {
6
+ goToStep(step: FlowStepFragment): Promise<void>;
7
+ endFlow(endReason: EndFlowReasonInput): Promise<void>;
8
+ trackButtonEvent(eventName: string, token: string, stepCvid: string | null, sessionId: string | null): Promise<void>;
9
+ startFlow(options: {
10
+ flowId: string;
11
+ stepCvid: string | null;
12
+ startReason: StartFlowReasonInput;
13
+ replaceCurrent: boolean;
14
+ }): Promise<void>;
15
+ updateUser(attributes: PublicAttributes): Promise<void>;
16
+ updateGroup(attributes: PublicAttributes, options?: {
17
+ membership?: PublicAttributes;
18
+ }): Promise<void>;
19
+ /**
20
+ * Open a server batch so `check_sessions` is deferred until {@link endBatch}.
21
+ * Web `trackButtonEvent` sends `{batch: true}` for the same reason.
22
+ */
23
+ beginBatch(): Promise<void>;
24
+ endBatch(): Promise<void>;
25
+ }
26
+ export interface HandleActionsDeps {
27
+ engine: FlowActionRunner;
28
+ onOpenExternalUrl?: (url: string) => void;
29
+ warn?: (message: string) => void;
30
+ }
31
+ /**
32
+ * MVP port of web `handleActions`: GO_TO_STEP, CLOSE_FLOW, NAVIGATE,
33
+ * TRACK_BUTTON_EVENT, START_FLOW, SET_ATTRIBUTE. Ordering: NEW_TAB navigate
34
+ * first (before BeginBatch), then track-button + other actions in one
35
+ * `Promise.all` (web `regularActions`), SAME_TAB navigate last.
36
+ *
37
+ * Track-button events open a server batch (web `{batch: true}`). Awaiting
38
+ * track *before* GO_TO_STEP lets that event's `check_sessions` unset or
39
+ * restart the session, so go-to-step never emits and the flow looks stuck.
40
+ */
41
+ export declare function handleActions(session: FlowSessionFragment, actions: FlowActionFragment[], deps: HandleActionsDeps): Promise<void>;
42
+ //# sourceMappingURL=handleActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleActions.d.ts","sourceRoot":"","sources":["../../src/engine/handleActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAIlB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI3E,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,SAAS,CAAC,OAAO,EAAE;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,WAAW,EAAE,oBAAoB,CAAC;QAClC,cAAc,EAAE,OAAO,CAAC;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,UAAU,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,CACT,UAAU,EAAE,gBAAgB,EAC5B,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAE,GAC1C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AA0BD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,kBAAkB,EAAE,EAC7B,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,IAAI,CAAC,CA8Cf"}
@@ -0,0 +1,198 @@
1
+ import { EndFlowReasonInput, FlowActionAttributeOperation, FlowActionNavigateTarget, FlowActionType, StartFlowReasonInput, } from '@userflow-tech/protocol';
2
+ import { interpolateSessionData } from './interpolateSessionData.js';
3
+ function readNonEmptyString(value) {
4
+ return typeof value === 'string' && value.length > 0 ? value : null;
5
+ }
6
+ /**
7
+ * Wire `buttonEvent` as sent by the end-user protocol. Accepts camelCase
8
+ * (normal) and snake_case (if a payload skipped camelize).
9
+ */
10
+ function buttonEventFromAction(action) {
11
+ const raw = action.buttonEvent ?? action.button_event;
12
+ if (raw == null || typeof raw !== 'object') {
13
+ return null;
14
+ }
15
+ const record = raw;
16
+ const eventName = readNonEmptyString(record.eventName) ?? readNonEmptyString(record.event_name);
17
+ const token = readNonEmptyString(record.token);
18
+ if (eventName == null || token == null) {
19
+ return null;
20
+ }
21
+ return { eventName, token };
22
+ }
23
+ /**
24
+ * MVP port of web `handleActions`: GO_TO_STEP, CLOSE_FLOW, NAVIGATE,
25
+ * TRACK_BUTTON_EVENT, START_FLOW, SET_ATTRIBUTE. Ordering: NEW_TAB navigate
26
+ * first (before BeginBatch), then track-button + other actions in one
27
+ * `Promise.all` (web `regularActions`), SAME_TAB navigate last.
28
+ *
29
+ * Track-button events open a server batch (web `{batch: true}`). Awaiting
30
+ * track *before* GO_TO_STEP lets that event's `check_sessions` unset or
31
+ * restart the session, so go-to-step never emits and the flow looks stuck.
32
+ */
33
+ export async function handleActions(session, actions, deps) {
34
+ const syncActions = [];
35
+ const trackActions = [];
36
+ const regularActions = [];
37
+ const postActions = [];
38
+ for (const action of actions) {
39
+ if (action.type === FlowActionType.TRACK_BUTTON_EVENT) {
40
+ trackActions.push(action);
41
+ }
42
+ else if (action.type === FlowActionType.NAVIGATE) {
43
+ if (action.navigateTarget === FlowActionNavigateTarget.NEW_TAB) {
44
+ syncActions.push(action);
45
+ }
46
+ else {
47
+ postActions.push(action);
48
+ }
49
+ }
50
+ else {
51
+ regularActions.push(action);
52
+ }
53
+ }
54
+ // NEW_TAB navigate is local (open URL). Run it before BeginBatch so a
55
+ // slow/failed transport send cannot delay the URL — web runs these first
56
+ // and only batches TrackButtonEvent + sibling server actions.
57
+ for (const action of syncActions) {
58
+ await handleAction(session, action, deps);
59
+ }
60
+ const shouldBatch = trackActions.length > 0;
61
+ if (shouldBatch) {
62
+ await deps.engine.beginBatch();
63
+ }
64
+ try {
65
+ // Track first in the array so it reads `currentStep` before GO_TO_STEP
66
+ // mutates it. Both start in the same tick — do not await track first.
67
+ await Promise.all([...trackActions, ...regularActions].map((action) => handleAction(session, action, deps)));
68
+ for (const action of postActions) {
69
+ await handleAction(session, action, deps);
70
+ }
71
+ }
72
+ finally {
73
+ if (shouldBatch) {
74
+ await deps.engine.endBatch();
75
+ }
76
+ }
77
+ }
78
+ async function handleAction(session, action, deps) {
79
+ const { engine, onOpenExternalUrl, warn = console.warn } = deps;
80
+ switch (action.type) {
81
+ case FlowActionType.CLOSE_FLOW:
82
+ if (session.kind === 'flow') {
83
+ await engine.endFlow(EndFlowReasonInput.ACTION);
84
+ }
85
+ return;
86
+ case FlowActionType.GO_TO_STEP: {
87
+ if (session.kind !== 'flow')
88
+ return;
89
+ const stepCvid = readNonEmptyString(action.stepCvid) ??
90
+ readNonEmptyString(action.step_cvid);
91
+ const step = session.version.steps.find(({ crossVersionId }) => crossVersionId === stepCvid);
92
+ if (!step) {
93
+ throw new Error(`Action points to unknown step: ${stepCvid}`);
94
+ }
95
+ await engine.goToStep(step);
96
+ return;
97
+ }
98
+ case FlowActionType.NAVIGATE: {
99
+ if (!action.url) {
100
+ warn('Userflow: NAVIGATE action is missing url property');
101
+ return;
102
+ }
103
+ const url = interpolateSessionData(action.url, session.data);
104
+ onOpenExternalUrl?.(url);
105
+ return;
106
+ }
107
+ case FlowActionType.TRACK_BUTTON_EVENT: {
108
+ const buttonEvent = buttonEventFromAction(action);
109
+ if (!buttonEvent) {
110
+ warn('Userflow: TRACK_BUTTON_EVENT action is missing buttonEvent');
111
+ return;
112
+ }
113
+ const stepCvid = session.currentStep?.crossVersionId ?? null;
114
+ await engine.trackButtonEvent(buttonEvent.eventName, buttonEvent.token, stepCvid, session.id);
115
+ return;
116
+ }
117
+ case FlowActionType.START_FLOW: {
118
+ if (!action.otherFlow) {
119
+ warn('Userflow: START_FLOW action is missing other flow');
120
+ return;
121
+ }
122
+ await engine.startFlow({
123
+ flowId: action.otherFlow.id,
124
+ stepCvid: action.otherFlowStepCvid,
125
+ startReason: session.draftMode ? StartFlowReasonInput.DRAFT : StartFlowReasonInput.ACTION,
126
+ replaceCurrent: true,
127
+ });
128
+ return;
129
+ }
130
+ case FlowActionType.SET_ATTRIBUTE:
131
+ await applySetAttribute(action, engine);
132
+ return;
133
+ case FlowActionType.EVAL_JS:
134
+ case FlowActionType.SNOOZE:
135
+ warn(`Userflow: action type ${action.type} is not supported on mobile yet`);
136
+ return;
137
+ default:
138
+ warn(`Userflow: unknown action type ${action.type}`);
139
+ }
140
+ }
141
+ /**
142
+ * Map a SET_ATTRIBUTE action to `updateUser` / `updateGroup`, matching web
143
+ * `handleAction` in userflowjs/util/actions.ts.
144
+ */
145
+ async function applySetAttribute(action, engine) {
146
+ const change = attributeChangeFromAction(action);
147
+ if (!change) {
148
+ return;
149
+ }
150
+ const fqn = action.attributeFqn?.trim() ?? '';
151
+ if (!fqn) {
152
+ return;
153
+ }
154
+ const parts = fqn.split('/');
155
+ if (parts.length === 1) {
156
+ await engine.updateUser({ [fqn]: change });
157
+ return;
158
+ }
159
+ const name = parts[1];
160
+ if (!name) {
161
+ return;
162
+ }
163
+ if (parts[0] === 'group') {
164
+ await engine.updateGroup({ [name]: change });
165
+ return;
166
+ }
167
+ if (parts[0] === 'group_membership') {
168
+ await engine.updateGroup({}, { membership: { [name]: change } });
169
+ }
170
+ }
171
+ function attributeChangeFromAction(action) {
172
+ const value = action.attributeValue || '';
173
+ switch (action.attributeOperation) {
174
+ case FlowActionAttributeOperation.SET:
175
+ return { set: value };
176
+ case FlowActionAttributeOperation.SET_DATETIME:
177
+ return { set: new Date().toISOString(), data_type: 'datetime' };
178
+ case FlowActionAttributeOperation.SET_DATETIME_ONCE:
179
+ return { set_once: new Date().toISOString(), data_type: 'datetime' };
180
+ case FlowActionAttributeOperation.SET_ONCE:
181
+ return { set_once: value };
182
+ case FlowActionAttributeOperation.ADD:
183
+ return { add: value };
184
+ case FlowActionAttributeOperation.SUBTRACT:
185
+ return { subtract: value };
186
+ case FlowActionAttributeOperation.APPEND:
187
+ return { append: value };
188
+ case FlowActionAttributeOperation.PREPEND:
189
+ return { prepend: value };
190
+ case FlowActionAttributeOperation.REMOVE:
191
+ return { remove: value };
192
+ case FlowActionAttributeOperation.UNSET:
193
+ return { set: null };
194
+ default:
195
+ return null;
196
+ }
197
+ }
198
+ //# sourceMappingURL=handleActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleActions.js","sourceRoot":"","sources":["../../src/engine/handleActions.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EAC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,CAAC;IAC1C,QAAQ,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAClC,KAAK,4BAA4B,CAAC,GAAG;YACnC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QACxB,KAAK,4BAA4B,CAAC,YAAY;YAC5C,OAAO,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;QAClE,KAAK,4BAA4B,CAAC,iBAAiB;YACjD,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;QACvE,KAAK,4BAA4B,CAAC,QAAQ;YACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAC7B,KAAK,4BAA4B,CAAC,GAAG;YACnC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QACxB,KAAK,4BAA4B,CAAC,QAAQ;YACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAC7B,KAAK,4BAA4B,CAAC,MAAM;YACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC3B,KAAK,4BAA4B,CAAC,OAAO;YACvC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,KAAK,4BAA4B,CAAC,MAAM;YACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC3B,KAAK,4BAA4B,CAAC,KAAK;YACrC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QACvB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { SessionDataFragment } from '@userflow-tech/protocol';
2
+ /** Port of web `interpolateVariables` for `{{attribute}}` templates. */
3
+ export declare function interpolateVariables(content: string, lookup: (name: string) => string | null): string;
4
+ export declare function genSessionDataLookup(data: SessionDataFragment[]): (fqn: string) => string | null;
5
+ /** Resolve `{{name}}` placeholders against flow session data. */
6
+ export declare function interpolateSessionData(content: string, data: SessionDataFragment[]): string;
7
+ //# sourceMappingURL=interpolateSessionData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolateSessionData.d.ts","sourceRoot":"","sources":["../../src/engine/interpolateSessionData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAInE,wEAAwE;AACxE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GACtC,MAAM,CAWR;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAWhG;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAG3F"}
@@ -0,0 +1,29 @@
1
+ const VARIABLE_REGEX = /(\\*)\{\{([a-zA-Z0-9_.\\/]+)\}\}/g;
2
+ /** Port of web `interpolateVariables` for `{{attribute}}` templates. */
3
+ export function interpolateVariables(content, lookup) {
4
+ return (content || '').replace(VARIABLE_REGEX, (_fullMatch, backslashes, name) => {
5
+ const backslashCount = backslashes.length;
6
+ if (backslashCount % 2 === 0) {
7
+ return '\\'.repeat(backslashCount / 2) + (lookup(name) || '');
8
+ }
9
+ return '\\'.repeat((backslashCount - 1) / 2) + '{{' + name + '}}';
10
+ });
11
+ }
12
+ export function genSessionDataLookup(data) {
13
+ let dataMap = null;
14
+ return (fqn) => {
15
+ if (!dataMap) {
16
+ dataMap = new Map();
17
+ for (const { name, value } of data) {
18
+ dataMap.set(name, Array.isArray(value) ? (value[0] ?? '') : value);
19
+ }
20
+ }
21
+ return dataMap.get(fqn) || null;
22
+ };
23
+ }
24
+ /** Resolve `{{name}}` placeholders against flow session data. */
25
+ export function interpolateSessionData(content, data) {
26
+ const lookup = genSessionDataLookup(data);
27
+ return interpolateVariables(content, (name) => lookup(name));
28
+ }
29
+ //# sourceMappingURL=interpolateSessionData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolateSessionData.js","sourceRoot":"","sources":["../../src/engine/interpolateSessionData.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAE3D,wEAAwE;AACxE,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,MAAuC;IAEvC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAC5B,cAAc,EACd,CAAC,UAAU,EAAE,WAAmB,EAAE,IAAY,EAAE,EAAE;QAChD,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC;QAC1C,IAAI,cAAc,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACpE,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAA2B;IAC9D,IAAI,OAAO,GAA+B,IAAI,CAAC;IAC/C,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,sBAAsB,CAAC,OAAe,EAAE,IAA2B;IACjF,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,oBAAoB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A value wrapper that notifies observers when {@link update} replaces it.
3
+ * Port of web `userflowjs/util/simple-observable.ts`.
4
+ */
5
+ export declare class SimpleObservable<TValue> {
6
+ private current;
7
+ private readonly observers;
8
+ constructor(initialValue: TValue);
9
+ get value(): TValue;
10
+ update(value: TValue): void;
11
+ observe(observer: () => void): () => void;
12
+ }
13
+ //# sourceMappingURL=simpleObservable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleObservable.d.ts","sourceRoot":"","sources":["../../src/engine/simpleObservable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,gBAAgB,CAAC,MAAM;IAClC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;gBAEvC,YAAY,EAAE,MAAM;IAIhC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAU3B,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CAM1C"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A value wrapper that notifies observers when {@link update} replaces it.
3
+ * Port of web `userflowjs/util/simple-observable.ts`.
4
+ */
5
+ export class SimpleObservable {
6
+ constructor(initialValue) {
7
+ this.observers = new Set();
8
+ this.current = initialValue;
9
+ }
10
+ get value() {
11
+ return this.current;
12
+ }
13
+ update(value) {
14
+ if (value === this.current) {
15
+ return;
16
+ }
17
+ this.current = value;
18
+ for (const observer of this.observers) {
19
+ observer();
20
+ }
21
+ }
22
+ observe(observer) {
23
+ this.observers.add(observer);
24
+ return () => {
25
+ this.observers.delete(observer);
26
+ };
27
+ }
28
+ }
29
+ //# sourceMappingURL=simpleObservable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleObservable.js","sourceRoot":"","sources":["../../src/engine/simpleObservable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAI3B,YAAY,YAAoB;QAFf,cAAS,GAAG,IAAI,GAAG,EAAc,CAAC;QAGjD,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,CAAC,QAAoB;QAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import type { FlowConditionFragment, SessionDataFragment } from '@userflow-tech/protocol';
2
+ import type { Scheduler } from '../transport/scheduler.js';
3
+ import type { SimpleObservable } from './simpleObservable.js';
4
+ export interface TrackConditionOpts {
5
+ condition: FlowConditionFragment;
6
+ callback: (isTrue: boolean) => void;
7
+ scheduler: Scheduler;
8
+ warn?: (message: string) => void;
9
+ /** Clock for TIME / relative ATTRIBUTE operators. Tests inject a controllable now. */
10
+ now?: () => number;
11
+ sessionData?: SimpleObservable<SessionDataFragment[]>;
12
+ }
13
+ type Untrack = () => void;
14
+ /**
15
+ * Client-side condition tracking for step triggers, ported from web
16
+ * `userflowjs/util/flow-condition-types.ts`.
17
+ *
18
+ * Step triggers are evaluated locally (not via TrackClientCondition). The
19
+ * builder's trigger palette for flows is ALWAYS_TRUE ("Water is wet"), TIME
20
+ * ("Current time"), ATTRIBUTE, and CLAUSE (logic group + wait). Types we cannot
21
+ * evaluate yet stay false and warn.
22
+ */
23
+ export declare function trackCondition(opts: TrackConditionOpts): Untrack;
24
+ export {};
25
+ //# sourceMappingURL=trackCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackCondition.d.ts","sourceRoot":"","sources":["../../src/engine/trackCondition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG1F,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,2BAA2B,CAAC;AAGxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,qBAAqB,CAAC;IACjC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAC;CACvD;AAED,KAAK,OAAO,GAAG,MAAM,IAAI,CAAC;AAI1B;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAUhE"}