@userflow-tech/react-native 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +76 -0
- package/README.md +337 -0
- package/docs/anchoring.md +264 -0
- package/docs/deep-linking.md +271 -0
- package/docs/identity-verification.md +95 -0
- package/docs/theme-mapping.md +101 -0
- package/docs/troubleshooting.md +107 -0
- package/lib/commonjs/anchors/AnchorRegistry.js +72 -0
- package/lib/commonjs/anchors/AnchorRegistry.js.map +1 -0
- package/lib/commonjs/anchors/AutoAnchorRegistry.js +315 -0
- package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -0
- package/lib/commonjs/anchors/ScrollContainerRegistry.js +93 -0
- package/lib/commonjs/anchors/ScrollContainerRegistry.js.map +1 -0
- package/lib/commonjs/anchors/anchorChangeTicker.js +83 -0
- package/lib/commonjs/anchors/anchorChangeTicker.js.map +1 -0
- package/lib/commonjs/anchors/animationFrame.js +90 -0
- package/lib/commonjs/anchors/animationFrame.js.map +1 -0
- package/lib/commonjs/anchors/autoAnchor.js +253 -0
- package/lib/commonjs/anchors/autoAnchor.js.map +1 -0
- package/lib/commonjs/anchors/elementConditionEvaluator.js +82 -0
- package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -0
- package/lib/commonjs/anchors/fiber/FiberScanRoot.js +90 -0
- package/lib/commonjs/anchors/fiber/FiberScanRoot.js.map +1 -0
- package/lib/commonjs/anchors/fiber/fiberInternals.js +180 -0
- package/lib/commonjs/anchors/fiber/fiberInternals.js.map +1 -0
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js +214 -0
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js.map +1 -0
- package/lib/commonjs/anchors/fiber/findScrollAncestors.js +176 -0
- package/lib/commonjs/anchors/fiber/findScrollAncestors.js.map +1 -0
- package/lib/commonjs/anchors/fiber/measureHostFiber.js +75 -0
- package/lib/commonjs/anchors/fiber/measureHostFiber.js.map +1 -0
- package/lib/commonjs/anchors/fiber/visibleScreens.js +165 -0
- package/lib/commonjs/anchors/fiber/visibleScreens.js.map +1 -0
- package/lib/commonjs/anchors/hintsCodec.js +120 -0
- package/lib/commonjs/anchors/hintsCodec.js.map +1 -0
- package/lib/commonjs/anchors/resolveAnchorHost.js +112 -0
- package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -0
- package/lib/commonjs/anchors/resolveManualAnchorId.js +17 -0
- package/lib/commonjs/anchors/resolveManualAnchorId.js.map +1 -0
- package/lib/commonjs/anchors/scrollAnchorIntoView.js +227 -0
- package/lib/commonjs/anchors/scrollAnchorIntoView.js.map +1 -0
- package/lib/commonjs/anchors/scrollConfig.js +48 -0
- package/lib/commonjs/anchors/scrollConfig.js.map +1 -0
- package/lib/commonjs/anchors/targetPressMonitor.js +113 -0
- package/lib/commonjs/anchors/targetPressMonitor.js.map +1 -0
- package/lib/commonjs/anchors/useUserflowAnchor.js +91 -0
- package/lib/commonjs/anchors/useUserflowAnchor.js.map +1 -0
- package/lib/commonjs/anchors/useUserflowScrollContainer.js +76 -0
- package/lib/commonjs/anchors/useUserflowScrollContainer.js.map +1 -0
- package/lib/commonjs/anonymousId.js +42 -0
- package/lib/commonjs/anonymousId.js.map +1 -0
- package/lib/commonjs/content/RichContentRenderer.js +675 -0
- package/lib/commonjs/content/RichContentRenderer.js.map +1 -0
- package/lib/commonjs/content/StepButton.js +57 -0
- package/lib/commonjs/content/StepButton.js.map +1 -0
- package/lib/commonjs/content/buttonAppearance.js +18 -0
- package/lib/commonjs/content/buttonAppearance.js.map +1 -0
- package/lib/commonjs/content/deserialize.js +129 -0
- package/lib/commonjs/content/deserialize.js.map +1 -0
- package/lib/commonjs/content/imageLayout.js +24 -0
- package/lib/commonjs/content/imageLayout.js.map +1 -0
- package/lib/commonjs/content/migrateFlowBlocks.js +39 -0
- package/lib/commonjs/content/migrateFlowBlocks.js.map +1 -0
- package/lib/commonjs/content/openSafeUrl.js +37 -0
- package/lib/commonjs/content/openSafeUrl.js.map +1 -0
- package/lib/commonjs/content/resolveStepButtonChrome.js +95 -0
- package/lib/commonjs/content/resolveStepButtonChrome.js.map +1 -0
- package/lib/commonjs/content/themeColor.js +106 -0
- package/lib/commonjs/content/themeColor.js.map +1 -0
- package/lib/commonjs/content/types.js +2 -0
- package/lib/commonjs/content/types.js.map +1 -0
- package/lib/commonjs/deepLinking.js +162 -0
- package/lib/commonjs/deepLinking.js.map +1 -0
- package/lib/commonjs/expo-router/UserflowExpoRouterScreenTracker.js +13 -0
- package/lib/commonjs/expo-router/UserflowExpoRouterScreenTracker.js.map +1 -0
- package/lib/commonjs/expo-router/getExpoRouterScreenTracker.js +44 -0
- package/lib/commonjs/expo-router/getExpoRouterScreenTracker.js.map +1 -0
- package/lib/commonjs/expo-router/index.js +20 -0
- package/lib/commonjs/expo-router/index.js.map +1 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js +45 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js.map +1 -0
- package/lib/commonjs/index.js +356 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/lifecycle.js +200 -0
- package/lib/commonjs/lifecycle.js.map +1 -0
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js +69 -0
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js.map +1 -0
- package/lib/commonjs/navigation/chainCallbacks.js +16 -0
- package/lib/commonjs/navigation/chainCallbacks.js.map +1 -0
- package/lib/commonjs/navigation/getActiveRouteName.js +18 -0
- package/lib/commonjs/navigation/getActiveRouteName.js.map +1 -0
- package/lib/commonjs/navigation/index.js +50 -0
- package/lib/commonjs/navigation/index.js.map +1 -0
- package/lib/commonjs/navigation/openFlowNavigateUrl.js +110 -0
- package/lib/commonjs/navigation/openFlowNavigateUrl.js.map +1 -0
- package/lib/commonjs/network.js +90 -0
- package/lib/commonjs/network.js.map +1 -0
- package/lib/commonjs/pairing/PairingController.js +290 -0
- package/lib/commonjs/pairing/PairingController.js.map +1 -0
- package/lib/commonjs/pairing/PreviewModeBanner.js +118 -0
- package/lib/commonjs/pairing/PreviewModeBanner.js.map +1 -0
- package/lib/commonjs/pairing/deepLink.js +141 -0
- package/lib/commonjs/pairing/deepLink.js.map +1 -0
- package/lib/commonjs/pairing/diagnostics.js +115 -0
- package/lib/commonjs/pairing/diagnostics.js.map +1 -0
- package/lib/commonjs/pairing/index.js +58 -0
- package/lib/commonjs/pairing/index.js.map +1 -0
- package/lib/commonjs/pairing/pairingRuntime.js +85 -0
- package/lib/commonjs/pairing/pairingRuntime.js.map +1 -0
- package/lib/commonjs/pairing/tokenStorage.js +70 -0
- package/lib/commonjs/pairing/tokenStorage.js.map +1 -0
- package/lib/commonjs/pairing/usePairingState.js +40 -0
- package/lib/commonjs/pairing/usePairingState.js.map +1 -0
- package/lib/commonjs/runtime/FlowRenderer.js +57 -0
- package/lib/commonjs/runtime/FlowRenderer.js.map +1 -0
- package/lib/commonjs/runtime/FlowSurfaceFade.js +53 -0
- package/lib/commonjs/runtime/FlowSurfaceFade.js.map +1 -0
- package/lib/commonjs/runtime/TargetPressBridge.js +96 -0
- package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -0
- package/lib/commonjs/runtime/UserflowProvider.js +91 -0
- package/lib/commonjs/runtime/UserflowProvider.js.map +1 -0
- package/lib/commonjs/runtime/clientConditions.js +50 -0
- package/lib/commonjs/runtime/clientConditions.js.map +1 -0
- package/lib/commonjs/runtime/flowEngine.js +63 -0
- package/lib/commonjs/runtime/flowEngine.js.map +1 -0
- package/lib/commonjs/runtime/flowSessionViewState.js +48 -0
- package/lib/commonjs/runtime/flowSessionViewState.js.map +1 -0
- package/lib/commonjs/runtime/useFlowSessionState.js +25 -0
- package/lib/commonjs/runtime/useFlowSessionState.js.map +1 -0
- package/lib/commonjs/runtime/userflowCore.js +13 -0
- package/lib/commonjs/runtime/userflowCore.js.map +1 -0
- package/lib/commonjs/screenTracker.js +87 -0
- package/lib/commonjs/screenTracker.js.map +1 -0
- package/lib/commonjs/surfaces/CloseButton.js +52 -0
- package/lib/commonjs/surfaces/CloseButton.js.map +1 -0
- package/lib/commonjs/surfaces/MadeWithUserflow.js +90 -0
- package/lib/commonjs/surfaces/MadeWithUserflow.js.map +1 -0
- package/lib/commonjs/surfaces/ModalSurface.js +170 -0
- package/lib/commonjs/surfaces/ModalSurface.js.map +1 -0
- package/lib/commonjs/surfaces/ProgressBar.js +116 -0
- package/lib/commonjs/surfaces/ProgressBar.js.map +1 -0
- package/lib/commonjs/surfaces/TooltipSurface.js +638 -0
- package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -0
- package/lib/commonjs/surfaces/absoluteFill.js +29 -0
- package/lib/commonjs/surfaces/absoluteFill.js.map +1 -0
- package/lib/commonjs/surfaces/assets/png.d.js +2 -0
- package/lib/commonjs/surfaces/assets/png.d.js.map +1 -0
- package/lib/commonjs/surfaces/assets/userflow-logomark.png +0 -0
- package/lib/commonjs/surfaces/parseBackdropOpacity.js +20 -0
- package/lib/commonjs/surfaces/parseBackdropOpacity.js.map +1 -0
- package/lib/commonjs/surfaces/progress.js +35 -0
- package/lib/commonjs/surfaces/progress.js.map +1 -0
- package/lib/commonjs/surfaces/resolveCloseButtonColor.js +24 -0
- package/lib/commonjs/surfaces/resolveCloseButtonColor.js.map +1 -0
- package/lib/commonjs/surfaces/resolveModalLayout.js +67 -0
- package/lib/commonjs/surfaces/resolveModalLayout.js.map +1 -0
- package/lib/commonjs/surfaces/resolveTooltipLayout.js +64 -0
- package/lib/commonjs/surfaces/resolveTooltipLayout.js.map +1 -0
- package/lib/commonjs/surfaces/safeArea.js +46 -0
- package/lib/commonjs/surfaces/safeArea.js.map +1 -0
- package/lib/commonjs/surfaces/themeChrome.js +90 -0
- package/lib/commonjs/surfaces/themeChrome.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js +108 -0
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/TooltipCutout.js +103 -0
- package/lib/commonjs/surfaces/tooltip/TooltipCutout.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/TooltipNotch.js +64 -0
- package/lib/commonjs/surfaces/tooltip/TooltipNotch.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js +102 -0
- package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js +100 -0
- package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/parseBackdropPadding.js +15 -0
- package/lib/commonjs/surfaces/tooltip/parseBackdropPadding.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/rect.js +51 -0
- package/lib/commonjs/surfaces/tooltip/rect.js.map +1 -0
- package/lib/commonjs/useUserflowScreen.js +24 -0
- package/lib/commonjs/useUserflowScreen.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/anchors/AnchorRegistry.js +67 -0
- package/lib/module/anchors/AnchorRegistry.js.map +1 -0
- package/lib/module/anchors/AutoAnchorRegistry.js +309 -0
- package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -0
- package/lib/module/anchors/ScrollContainerRegistry.js +86 -0
- package/lib/module/anchors/ScrollContainerRegistry.js.map +1 -0
- package/lib/module/anchors/anchorChangeTicker.js +79 -0
- package/lib/module/anchors/anchorChangeTicker.js.map +1 -0
- package/lib/module/anchors/animationFrame.js +83 -0
- package/lib/module/anchors/animationFrame.js.map +1 -0
- package/lib/module/anchors/autoAnchor.js +248 -0
- package/lib/module/anchors/autoAnchor.js.map +1 -0
- package/lib/module/anchors/elementConditionEvaluator.js +79 -0
- package/lib/module/anchors/elementConditionEvaluator.js.map +1 -0
- package/lib/module/anchors/fiber/FiberScanRoot.js +84 -0
- package/lib/module/anchors/fiber/FiberScanRoot.js.map +1 -0
- package/lib/module/anchors/fiber/fiberInternals.js +164 -0
- package/lib/module/anchors/fiber/fiberInternals.js.map +1 -0
- package/lib/module/anchors/fiber/findAnchorFiber.js +210 -0
- package/lib/module/anchors/fiber/findAnchorFiber.js.map +1 -0
- package/lib/module/anchors/fiber/findScrollAncestors.js +172 -0
- package/lib/module/anchors/fiber/findScrollAncestors.js.map +1 -0
- package/lib/module/anchors/fiber/measureHostFiber.js +70 -0
- package/lib/module/anchors/fiber/measureHostFiber.js.map +1 -0
- package/lib/module/anchors/fiber/visibleScreens.js +159 -0
- package/lib/module/anchors/fiber/visibleScreens.js.map +1 -0
- package/lib/module/anchors/hintsCodec.js +111 -0
- package/lib/module/anchors/hintsCodec.js.map +1 -0
- package/lib/module/anchors/resolveAnchorHost.js +105 -0
- package/lib/module/anchors/resolveAnchorHost.js.map +1 -0
- package/lib/module/anchors/resolveManualAnchorId.js +13 -0
- package/lib/module/anchors/resolveManualAnchorId.js.map +1 -0
- package/lib/module/anchors/scrollAnchorIntoView.js +222 -0
- package/lib/module/anchors/scrollAnchorIntoView.js.map +1 -0
- package/lib/module/anchors/scrollConfig.js +40 -0
- package/lib/module/anchors/scrollConfig.js.map +1 -0
- package/lib/module/anchors/targetPressMonitor.js +105 -0
- package/lib/module/anchors/targetPressMonitor.js.map +1 -0
- package/lib/module/anchors/useUserflowAnchor.js +87 -0
- package/lib/module/anchors/useUserflowAnchor.js.map +1 -0
- package/lib/module/anchors/useUserflowScrollContainer.js +71 -0
- package/lib/module/anchors/useUserflowScrollContainer.js.map +1 -0
- package/lib/module/anonymousId.js +36 -0
- package/lib/module/anonymousId.js.map +1 -0
- package/lib/module/content/RichContentRenderer.js +670 -0
- package/lib/module/content/RichContentRenderer.js.map +1 -0
- package/lib/module/content/StepButton.js +52 -0
- package/lib/module/content/StepButton.js.map +1 -0
- package/lib/module/content/buttonAppearance.js +14 -0
- package/lib/module/content/buttonAppearance.js.map +1 -0
- package/lib/module/content/deserialize.js +116 -0
- package/lib/module/content/deserialize.js.map +1 -0
- package/lib/module/content/imageLayout.js +20 -0
- package/lib/module/content/imageLayout.js.map +1 -0
- package/lib/module/content/migrateFlowBlocks.js +35 -0
- package/lib/module/content/migrateFlowBlocks.js.map +1 -0
- package/lib/module/content/openSafeUrl.js +32 -0
- package/lib/module/content/openSafeUrl.js.map +1 -0
- package/lib/module/content/resolveStepButtonChrome.js +90 -0
- package/lib/module/content/resolveStepButtonChrome.js.map +1 -0
- package/lib/module/content/themeColor.js +99 -0
- package/lib/module/content/themeColor.js.map +1 -0
- package/lib/module/content/types.js +2 -0
- package/lib/module/content/types.js.map +1 -0
- package/lib/module/deepLinking.js +152 -0
- package/lib/module/deepLinking.js.map +1 -0
- package/lib/module/expo-router/UserflowExpoRouterScreenTracker.js +10 -0
- package/lib/module/expo-router/UserflowExpoRouterScreenTracker.js.map +1 -0
- package/lib/module/expo-router/getExpoRouterScreenTracker.js +39 -0
- package/lib/module/expo-router/getExpoRouterScreenTracker.js.map +1 -0
- package/lib/module/expo-router/index.js +5 -0
- package/lib/module/expo-router/index.js.map +1 -0
- package/lib/module/expo-router/useUserflowExpoRouter.js +42 -0
- package/lib/module/expo-router/useUserflowExpoRouter.js.map +1 -0
- package/lib/module/index.js +259 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/lifecycle.js +195 -0
- package/lib/module/lifecycle.js.map +1 -0
- package/lib/module/navigation/WithUserflowReactNavigation.js +65 -0
- package/lib/module/navigation/WithUserflowReactNavigation.js.map +1 -0
- package/lib/module/navigation/chainCallbacks.js +12 -0
- package/lib/module/navigation/chainCallbacks.js.map +1 -0
- package/lib/module/navigation/getActiveRouteName.js +14 -0
- package/lib/module/navigation/getActiveRouteName.js.map +1 -0
- package/lib/module/navigation/index.js +5 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/openFlowNavigateUrl.js +100 -0
- package/lib/module/navigation/openFlowNavigateUrl.js.map +1 -0
- package/lib/module/network.js +85 -0
- package/lib/module/network.js.map +1 -0
- package/lib/module/pairing/PairingController.js +286 -0
- package/lib/module/pairing/PairingController.js.map +1 -0
- package/lib/module/pairing/PreviewModeBanner.js +113 -0
- package/lib/module/pairing/PreviewModeBanner.js.map +1 -0
- package/lib/module/pairing/deepLink.js +134 -0
- package/lib/module/pairing/deepLink.js.map +1 -0
- package/lib/module/pairing/diagnostics.js +101 -0
- package/lib/module/pairing/diagnostics.js.map +1 -0
- package/lib/module/pairing/index.js +7 -0
- package/lib/module/pairing/index.js.map +1 -0
- package/lib/module/pairing/pairingRuntime.js +77 -0
- package/lib/module/pairing/pairingRuntime.js.map +1 -0
- package/lib/module/pairing/tokenStorage.js +65 -0
- package/lib/module/pairing/tokenStorage.js.map +1 -0
- package/lib/module/pairing/usePairingState.js +35 -0
- package/lib/module/pairing/usePairingState.js.map +1 -0
- package/lib/module/runtime/FlowRenderer.js +52 -0
- package/lib/module/runtime/FlowRenderer.js.map +1 -0
- package/lib/module/runtime/FlowSurfaceFade.js +48 -0
- package/lib/module/runtime/FlowSurfaceFade.js.map +1 -0
- package/lib/module/runtime/TargetPressBridge.js +91 -0
- package/lib/module/runtime/TargetPressBridge.js.map +1 -0
- package/lib/module/runtime/UserflowProvider.js +85 -0
- package/lib/module/runtime/UserflowProvider.js.map +1 -0
- package/lib/module/runtime/clientConditions.js +43 -0
- package/lib/module/runtime/clientConditions.js.map +1 -0
- package/lib/module/runtime/flowEngine.js +54 -0
- package/lib/module/runtime/flowEngine.js.map +1 -0
- package/lib/module/runtime/flowSessionViewState.js +42 -0
- package/lib/module/runtime/flowSessionViewState.js.map +1 -0
- package/lib/module/runtime/useFlowSessionState.js +21 -0
- package/lib/module/runtime/useFlowSessionState.js.map +1 -0
- package/lib/module/runtime/userflowCore.js +10 -0
- package/lib/module/runtime/userflowCore.js.map +1 -0
- package/lib/module/screenTracker.js +79 -0
- package/lib/module/screenTracker.js.map +1 -0
- package/lib/module/surfaces/CloseButton.js +47 -0
- package/lib/module/surfaces/CloseButton.js.map +1 -0
- package/lib/module/surfaces/MadeWithUserflow.js +83 -0
- package/lib/module/surfaces/MadeWithUserflow.js.map +1 -0
- package/lib/module/surfaces/ModalSurface.js +165 -0
- package/lib/module/surfaces/ModalSurface.js.map +1 -0
- package/lib/module/surfaces/ProgressBar.js +111 -0
- package/lib/module/surfaces/ProgressBar.js.map +1 -0
- package/lib/module/surfaces/TooltipSurface.js +633 -0
- package/lib/module/surfaces/TooltipSurface.js.map +1 -0
- package/lib/module/surfaces/absoluteFill.js +25 -0
- package/lib/module/surfaces/absoluteFill.js.map +1 -0
- package/lib/module/surfaces/assets/png.d.js +2 -0
- package/lib/module/surfaces/assets/png.d.js.map +1 -0
- package/lib/module/surfaces/assets/userflow-logomark.png +0 -0
- package/lib/module/surfaces/parseBackdropOpacity.js +16 -0
- package/lib/module/surfaces/parseBackdropOpacity.js.map +1 -0
- package/lib/module/surfaces/progress.js +31 -0
- package/lib/module/surfaces/progress.js.map +1 -0
- package/lib/module/surfaces/resolveCloseButtonColor.js +20 -0
- package/lib/module/surfaces/resolveCloseButtonColor.js.map +1 -0
- package/lib/module/surfaces/resolveModalLayout.js +59 -0
- package/lib/module/surfaces/resolveModalLayout.js.map +1 -0
- package/lib/module/surfaces/resolveTooltipLayout.js +57 -0
- package/lib/module/surfaces/resolveTooltipLayout.js.map +1 -0
- package/lib/module/surfaces/safeArea.js +41 -0
- package/lib/module/surfaces/safeArea.js.map +1 -0
- package/lib/module/surfaces/themeChrome.js +86 -0
- package/lib/module/surfaces/themeChrome.js.map +1 -0
- package/lib/module/surfaces/tooltip/TooltipBubble.js +103 -0
- package/lib/module/surfaces/tooltip/TooltipBubble.js.map +1 -0
- package/lib/module/surfaces/tooltip/TooltipCutout.js +98 -0
- package/lib/module/surfaces/tooltip/TooltipCutout.js.map +1 -0
- package/lib/module/surfaces/tooltip/TooltipNotch.js +55 -0
- package/lib/module/surfaces/tooltip/TooltipNotch.js.map +1 -0
- package/lib/module/surfaces/tooltip/computeTooltipPosition.js +97 -0
- package/lib/module/surfaces/tooltip/computeTooltipPosition.js.map +1 -0
- package/lib/module/surfaces/tooltip/inferTooltipPlacement.js +95 -0
- package/lib/module/surfaces/tooltip/inferTooltipPlacement.js.map +1 -0
- package/lib/module/surfaces/tooltip/parseBackdropPadding.js +11 -0
- package/lib/module/surfaces/tooltip/parseBackdropPadding.js.map +1 -0
- package/lib/module/surfaces/tooltip/rect.js +44 -0
- package/lib/module/surfaces/tooltip/rect.js.map +1 -0
- package/lib/module/useUserflowScreen.js +21 -0
- package/lib/module/useUserflowScreen.js.map +1 -0
- package/lib/module/version.js +5 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts +32 -0
- package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +113 -0
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/ScrollContainerRegistry.d.ts +46 -0
- package/lib/typescript/commonjs/src/anchors/ScrollContainerRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts +30 -0
- package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/animationFrame.d.ts +21 -0
- package/lib/typescript/commonjs/src/anchors/animationFrame.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/autoAnchor.d.ts +31 -0
- package/lib/typescript/commonjs/src/anchors/autoAnchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts +21 -0
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts +41 -0
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts +48 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts +33 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findScrollAncestors.d.ts +47 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findScrollAncestors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/measureHostFiber.d.ts +20 -0
- package/lib/typescript/commonjs/src/anchors/fiber/measureHostFiber.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts +42 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/hintsCodec.d.ts +40 -0
- package/lib/typescript/commonjs/src/anchors/hintsCodec.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +32 -0
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveManualAnchorId.d.ts +6 -0
- package/lib/typescript/commonjs/src/anchors/resolveManualAnchorId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/scrollAnchorIntoView.d.ts +59 -0
- package/lib/typescript/commonjs/src/anchors/scrollAnchorIntoView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/scrollConfig.d.ts +30 -0
- package/lib/typescript/commonjs/src/anchors/scrollConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts +64 -0
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/useUserflowAnchor.d.ts +30 -0
- package/lib/typescript/commonjs/src/anchors/useUserflowAnchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/useUserflowScrollContainer.d.ts +34 -0
- package/lib/typescript/commonjs/src/anchors/useUserflowScrollContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anonymousId.d.ts +5 -0
- package/lib/typescript/commonjs/src/anonymousId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts +21 -0
- package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/StepButton.d.ts +13 -0
- package/lib/typescript/commonjs/src/content/StepButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts +8 -0
- package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/deserialize.d.ts +27 -0
- package/lib/typescript/commonjs/src/content/deserialize.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/imageLayout.d.ts +13 -0
- package/lib/typescript/commonjs/src/content/imageLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/migrateFlowBlocks.d.ts +12 -0
- package/lib/typescript/commonjs/src/content/migrateFlowBlocks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/openSafeUrl.d.ts +12 -0
- package/lib/typescript/commonjs/src/content/openSafeUrl.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/resolveStepButtonChrome.d.ts +24 -0
- package/lib/typescript/commonjs/src/content/resolveStepButtonChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/themeColor.d.ts +43 -0
- package/lib/typescript/commonjs/src/content/themeColor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/types.d.ts +144 -0
- package/lib/typescript/commonjs/src/content/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/deepLinking.d.ts +54 -0
- package/lib/typescript/commonjs/src/deepLinking.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/UserflowExpoRouterScreenTracker.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-router/UserflowExpoRouterScreenTracker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/getExpoRouterScreenTracker.d.ts +13 -0
- package/lib/typescript/commonjs/src/expo-router/getExpoRouterScreenTracker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts +17 -0
- package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +112 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/lifecycle.d.ts +96 -0
- package/lib/typescript/commonjs/src/lifecycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/WithUserflowReactNavigation.d.ts +21 -0
- package/lib/typescript/commonjs/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/chainCallbacks.d.ts +3 -0
- package/lib/typescript/commonjs/src/navigation/chainCallbacks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/getActiveRouteName.d.ts +6 -0
- package/lib/typescript/commonjs/src/navigation/getActiveRouteName.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/navigation/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts +33 -0
- package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/network.d.ts +42 -0
- package/lib/typescript/commonjs/src/network.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +104 -0
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts +11 -0
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/deepLink.d.ts +53 -0
- package/lib/typescript/commonjs/src/pairing/deepLink.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts +52 -0
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/pairing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/pairingRuntime.d.ts +24 -0
- package/lib/typescript/commonjs/src/pairing/pairingRuntime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts +16 -0
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/usePairingState.d.ts +4 -0
- package/lib/typescript/commonjs/src/pairing/usePairingState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/FlowRenderer.d.ts +13 -0
- package/lib/typescript/commonjs/src/runtime/FlowRenderer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts +13 -0
- package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +16 -0
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts +32 -0
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/clientConditions.d.ts +10 -0
- package/lib/typescript/commonjs/src/runtime/clientConditions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts +17 -0
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts +18 -0
- package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts +10 -0
- package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/userflowCore.d.ts +3 -0
- package/lib/typescript/commonjs/src/runtime/userflowCore.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screenTracker.d.ts +28 -0
- package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts +8 -0
- package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts +28 -0
- package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts +23 -0
- package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/ProgressBar.d.ts +19 -0
- package/lib/typescript/commonjs/src/surfaces/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts +17 -0
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/absoluteFill.d.ts +18 -0
- package/lib/typescript/commonjs/src/surfaces/absoluteFill.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/parseBackdropOpacity.d.ts +5 -0
- package/lib/typescript/commonjs/src/surfaces/parseBackdropOpacity.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/progress.d.ts +14 -0
- package/lib/typescript/commonjs/src/surfaces/progress.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveCloseButtonColor.d.ts +9 -0
- package/lib/typescript/commonjs/src/surfaces/resolveCloseButtonColor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts +36 -0
- package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts +24 -0
- package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +11 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts +36 -0
- package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts +23 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts +31 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipNotch.d.ts +29 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipNotch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts +43 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts +34 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/parseBackdropPadding.d.ts +3 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/parseBackdropPadding.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts +29 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useUserflowScreen.d.ts +10 -0
- package/lib/typescript/commonjs/src/useUserflowScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +3 -0
- package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts +32 -0
- package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +113 -0
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/ScrollContainerRegistry.d.ts +46 -0
- package/lib/typescript/module/src/anchors/ScrollContainerRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts +30 -0
- package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/animationFrame.d.ts +21 -0
- package/lib/typescript/module/src/anchors/animationFrame.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/autoAnchor.d.ts +31 -0
- package/lib/typescript/module/src/anchors/autoAnchor.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts +21 -0
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts +41 -0
- package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts +48 -0
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts +33 -0
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/findScrollAncestors.d.ts +47 -0
- package/lib/typescript/module/src/anchors/fiber/findScrollAncestors.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/measureHostFiber.d.ts +20 -0
- package/lib/typescript/module/src/anchors/fiber/measureHostFiber.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts +42 -0
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/hintsCodec.d.ts +40 -0
- package/lib/typescript/module/src/anchors/hintsCodec.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +32 -0
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/resolveManualAnchorId.d.ts +6 -0
- package/lib/typescript/module/src/anchors/resolveManualAnchorId.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/scrollAnchorIntoView.d.ts +59 -0
- package/lib/typescript/module/src/anchors/scrollAnchorIntoView.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/scrollConfig.d.ts +30 -0
- package/lib/typescript/module/src/anchors/scrollConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts +64 -0
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/useUserflowAnchor.d.ts +30 -0
- package/lib/typescript/module/src/anchors/useUserflowAnchor.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/useUserflowScrollContainer.d.ts +34 -0
- package/lib/typescript/module/src/anchors/useUserflowScrollContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/anonymousId.d.ts +5 -0
- package/lib/typescript/module/src/anonymousId.d.ts.map +1 -0
- package/lib/typescript/module/src/content/RichContentRenderer.d.ts +21 -0
- package/lib/typescript/module/src/content/RichContentRenderer.d.ts.map +1 -0
- package/lib/typescript/module/src/content/StepButton.d.ts +13 -0
- package/lib/typescript/module/src/content/StepButton.d.ts.map +1 -0
- package/lib/typescript/module/src/content/buttonAppearance.d.ts +8 -0
- package/lib/typescript/module/src/content/buttonAppearance.d.ts.map +1 -0
- package/lib/typescript/module/src/content/deserialize.d.ts +27 -0
- package/lib/typescript/module/src/content/deserialize.d.ts.map +1 -0
- package/lib/typescript/module/src/content/imageLayout.d.ts +13 -0
- package/lib/typescript/module/src/content/imageLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/content/migrateFlowBlocks.d.ts +12 -0
- package/lib/typescript/module/src/content/migrateFlowBlocks.d.ts.map +1 -0
- package/lib/typescript/module/src/content/openSafeUrl.d.ts +12 -0
- package/lib/typescript/module/src/content/openSafeUrl.d.ts.map +1 -0
- package/lib/typescript/module/src/content/resolveStepButtonChrome.d.ts +24 -0
- package/lib/typescript/module/src/content/resolveStepButtonChrome.d.ts.map +1 -0
- package/lib/typescript/module/src/content/themeColor.d.ts +43 -0
- package/lib/typescript/module/src/content/themeColor.d.ts.map +1 -0
- package/lib/typescript/module/src/content/types.d.ts +144 -0
- package/lib/typescript/module/src/content/types.d.ts.map +1 -0
- package/lib/typescript/module/src/deepLinking.d.ts +54 -0
- package/lib/typescript/module/src/deepLinking.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/UserflowExpoRouterScreenTracker.d.ts +3 -0
- package/lib/typescript/module/src/expo-router/UserflowExpoRouterScreenTracker.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/getExpoRouterScreenTracker.d.ts +13 -0
- package/lib/typescript/module/src/expo-router/getExpoRouterScreenTracker.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/index.d.ts +3 -0
- package/lib/typescript/module/src/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts +17 -0
- package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +112 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/lifecycle.d.ts +96 -0
- package/lib/typescript/module/src/lifecycle.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/WithUserflowReactNavigation.d.ts +21 -0
- package/lib/typescript/module/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/chainCallbacks.d.ts +3 -0
- package/lib/typescript/module/src/navigation/chainCallbacks.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/getActiveRouteName.d.ts +6 -0
- package/lib/typescript/module/src/navigation/getActiveRouteName.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/index.d.ts +5 -0
- package/lib/typescript/module/src/navigation/index.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts +33 -0
- package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts.map +1 -0
- package/lib/typescript/module/src/network.d.ts +42 -0
- package/lib/typescript/module/src/network.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/PairingController.d.ts +104 -0
- package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts +11 -0
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/deepLink.d.ts +53 -0
- package/lib/typescript/module/src/pairing/deepLink.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/diagnostics.d.ts +52 -0
- package/lib/typescript/module/src/pairing/diagnostics.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/index.d.ts +10 -0
- package/lib/typescript/module/src/pairing/index.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/pairingRuntime.d.ts +24 -0
- package/lib/typescript/module/src/pairing/pairingRuntime.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts +16 -0
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/usePairingState.d.ts +4 -0
- package/lib/typescript/module/src/pairing/usePairingState.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/FlowRenderer.d.ts +13 -0
- package/lib/typescript/module/src/runtime/FlowRenderer.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts +13 -0
- package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +16 -0
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts +32 -0
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/clientConditions.d.ts +10 -0
- package/lib/typescript/module/src/runtime/clientConditions.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/flowEngine.d.ts +17 -0
- package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts +18 -0
- package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts +10 -0
- package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/userflowCore.d.ts +3 -0
- package/lib/typescript/module/src/runtime/userflowCore.d.ts.map +1 -0
- package/lib/typescript/module/src/screenTracker.d.ts +28 -0
- package/lib/typescript/module/src/screenTracker.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/CloseButton.d.ts +8 -0
- package/lib/typescript/module/src/surfaces/CloseButton.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts +28 -0
- package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/ModalSurface.d.ts +23 -0
- package/lib/typescript/module/src/surfaces/ModalSurface.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/ProgressBar.d.ts +19 -0
- package/lib/typescript/module/src/surfaces/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts +17 -0
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/absoluteFill.d.ts +18 -0
- package/lib/typescript/module/src/surfaces/absoluteFill.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/parseBackdropOpacity.d.ts +5 -0
- package/lib/typescript/module/src/surfaces/parseBackdropOpacity.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/progress.d.ts +14 -0
- package/lib/typescript/module/src/surfaces/progress.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveCloseButtonColor.d.ts +9 -0
- package/lib/typescript/module/src/surfaces/resolveCloseButtonColor.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts +36 -0
- package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts +24 -0
- package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts +11 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/themeChrome.d.ts +36 -0
- package/lib/typescript/module/src/surfaces/themeChrome.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts +23 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts +31 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipNotch.d.ts +29 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipNotch.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts +43 -0
- package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts +34 -0
- package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/parseBackdropPadding.d.ts +3 -0
- package/lib/typescript/module/src/surfaces/tooltip/parseBackdropPadding.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts +29 -0
- package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts.map +1 -0
- package/lib/typescript/module/src/useUserflowScreen.d.ts +10 -0
- package/lib/typescript/module/src/useUserflowScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +3 -0
- package/lib/typescript/module/src/version.d.ts.map +1 -0
- package/package.json +144 -0
- package/src/anchors/AnchorRegistry.ts +81 -0
- package/src/anchors/AutoAnchorRegistry.ts +439 -0
- package/src/anchors/ScrollContainerRegistry.ts +108 -0
- package/src/anchors/anchorChangeTicker.ts +84 -0
- package/src/anchors/animationFrame.ts +88 -0
- package/src/anchors/autoAnchor.ts +310 -0
- package/src/anchors/elementConditionEvaluator.ts +108 -0
- package/src/anchors/fiber/FiberScanRoot.tsx +98 -0
- package/src/anchors/fiber/fiberInternals.ts +181 -0
- package/src/anchors/fiber/findAnchorFiber.ts +225 -0
- package/src/anchors/fiber/findScrollAncestors.ts +229 -0
- package/src/anchors/fiber/measureHostFiber.ts +85 -0
- package/src/anchors/fiber/visibleScreens.ts +173 -0
- package/src/anchors/hintsCodec.ts +125 -0
- package/src/anchors/resolveAnchorHost.ts +102 -0
- package/src/anchors/resolveManualAnchorId.ts +10 -0
- package/src/anchors/scrollAnchorIntoView.ts +251 -0
- package/src/anchors/scrollConfig.ts +61 -0
- package/src/anchors/targetPressMonitor.ts +127 -0
- package/src/anchors/useUserflowAnchor.ts +88 -0
- package/src/anchors/useUserflowScrollContainer.ts +86 -0
- package/src/anonymousId.ts +38 -0
- package/src/content/RichContentRenderer.tsx +721 -0
- package/src/content/StepButton.tsx +70 -0
- package/src/content/buttonAppearance.ts +11 -0
- package/src/content/deserialize.ts +147 -0
- package/src/content/imageLayout.ts +29 -0
- package/src/content/migrateFlowBlocks.ts +39 -0
- package/src/content/openSafeUrl.ts +30 -0
- package/src/content/resolveStepButtonChrome.ts +122 -0
- package/src/content/themeColor.ts +98 -0
- package/src/content/types.ts +189 -0
- package/src/deepLinking.ts +182 -0
- package/src/expo-router/UserflowExpoRouterScreenTracker.tsx +7 -0
- package/src/expo-router/getExpoRouterScreenTracker.ts +49 -0
- package/src/expo-router/index.ts +2 -0
- package/src/expo-router/useUserflowExpoRouter.ts +40 -0
- package/src/index.ts +362 -0
- package/src/lifecycle.ts +253 -0
- package/src/navigation/WithUserflowReactNavigation.tsx +87 -0
- package/src/navigation/chainCallbacks.ts +12 -0
- package/src/navigation/getActiveRouteName.ts +18 -0
- package/src/navigation/index.ts +11 -0
- package/src/navigation/openFlowNavigateUrl.ts +113 -0
- package/src/network.ts +113 -0
- package/src/pairing/PairingController.ts +356 -0
- package/src/pairing/PreviewModeBanner.tsx +130 -0
- package/src/pairing/deepLink.ts +128 -0
- package/src/pairing/diagnostics.ts +135 -0
- package/src/pairing/index.ts +19 -0
- package/src/pairing/pairingRuntime.ts +76 -0
- package/src/pairing/tokenStorage.ts +76 -0
- package/src/pairing/usePairingState.ts +43 -0
- package/src/runtime/FlowRenderer.tsx +60 -0
- package/src/runtime/FlowSurfaceFade.tsx +55 -0
- package/src/runtime/TargetPressBridge.tsx +86 -0
- package/src/runtime/UserflowProvider.tsx +89 -0
- package/src/runtime/clientConditions.ts +42 -0
- package/src/runtime/flowEngine.ts +53 -0
- package/src/runtime/flowSessionViewState.ts +55 -0
- package/src/runtime/useFlowSessionState.ts +36 -0
- package/src/runtime/userflowCore.ts +8 -0
- package/src/screenTracker.ts +83 -0
- package/src/surfaces/CloseButton.tsx +41 -0
- package/src/surfaces/MadeWithUserflow.tsx +103 -0
- package/src/surfaces/ModalSurface.tsx +215 -0
- package/src/surfaces/ProgressBar.tsx +142 -0
- package/src/surfaces/TooltipSurface.tsx +743 -0
- package/src/surfaces/absoluteFill.ts +24 -0
- package/src/surfaces/assets/png.d.ts +4 -0
- package/src/surfaces/assets/userflow-logomark.png +0 -0
- package/src/surfaces/parseBackdropOpacity.ts +13 -0
- package/src/surfaces/progress.ts +37 -0
- package/src/surfaces/resolveCloseButtonColor.ts +23 -0
- package/src/surfaces/resolveModalLayout.ts +85 -0
- package/src/surfaces/resolveTooltipLayout.ts +73 -0
- package/src/surfaces/safeArea.ts +48 -0
- package/src/surfaces/themeChrome.ts +126 -0
- package/src/surfaces/tooltip/TooltipBubble.tsx +123 -0
- package/src/surfaces/tooltip/TooltipCutout.tsx +110 -0
- package/src/surfaces/tooltip/TooltipNotch.tsx +67 -0
- package/src/surfaces/tooltip/computeTooltipPosition.ts +125 -0
- package/src/surfaces/tooltip/inferTooltipPlacement.ts +109 -0
- package/src/surfaces/tooltip/parseBackdropPadding.ts +8 -0
- package/src/surfaces/tooltip/rect.ts +62 -0
- package/src/useUserflowScreen.ts +17 -0
- package/src/version.ts +2 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @userflow-tech/react-native — public API for the Userflow React Native SDK.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the `Userflow` singleton host apps import. Auth/identity and the
|
|
5
|
+
* transport live in `@userflow-tech/core`; this binding is a thin facade that
|
|
6
|
+
* delegates to the core engine, wires React Native app lifecycle
|
|
7
|
+
* (background/foreground + idle) to the connection, hosts the flow session
|
|
8
|
+
* engine + provider overlay for Phase 3 rendering, and tracks screen changes.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
UserflowAttributes,
|
|
13
|
+
UserflowConfig,
|
|
14
|
+
UserflowEventAttributes,
|
|
15
|
+
UserflowGroupOptions,
|
|
16
|
+
UserflowIdentifyOptions,
|
|
17
|
+
UserflowInitOptions,
|
|
18
|
+
UserflowTrackOptions,
|
|
19
|
+
} from '@userflow-tech/core';
|
|
20
|
+
|
|
21
|
+
import './anchors/autoAnchor';
|
|
22
|
+
import { anchorChangeTicker } from './anchors/anchorChangeTicker';
|
|
23
|
+
import { notifyAnchorScreenChange } from './anchors/resolveAnchorHost';
|
|
24
|
+
import {
|
|
25
|
+
setCustomScrollIntoView as setCustomScrollIntoViewConfig,
|
|
26
|
+
setScrollPadding as setScrollPaddingConfig,
|
|
27
|
+
type CustomScrollIntoView,
|
|
28
|
+
type ScrollPadding,
|
|
29
|
+
} from './anchors/scrollConfig';
|
|
30
|
+
import { clearAnonymousId, getOrCreateAnonymousId } from './anonymousId';
|
|
31
|
+
import {
|
|
32
|
+
didHandleURL,
|
|
33
|
+
flushPendingPreviewToken,
|
|
34
|
+
startDeepLinking,
|
|
35
|
+
stopDeepLinking,
|
|
36
|
+
} from './deepLinking';
|
|
37
|
+
import { LifecycleController } from './lifecycle';
|
|
38
|
+
import { setHostOnNavigate, type FlowNavigateHandler } from './navigation/openFlowNavigateUrl';
|
|
39
|
+
import { NetworkController } from './network';
|
|
40
|
+
import { getPairingController, installPairingController } from './pairing/pairingRuntime';
|
|
41
|
+
import {
|
|
42
|
+
attachClientConditionEngine,
|
|
43
|
+
resetClientConditionEngine,
|
|
44
|
+
} from './runtime/clientConditions';
|
|
45
|
+
import {
|
|
46
|
+
attachFlowSessionEngine,
|
|
47
|
+
clearFlowSessionEngineLocalSession,
|
|
48
|
+
getFlowSessionEngine,
|
|
49
|
+
hasActiveFlowSession,
|
|
50
|
+
resetFlowSessionEngine,
|
|
51
|
+
} from './runtime/flowEngine';
|
|
52
|
+
import { getUserflowCore } from './runtime/userflowCore';
|
|
53
|
+
import {
|
|
54
|
+
disableScreenTracking,
|
|
55
|
+
enableScreenTracking,
|
|
56
|
+
handleScreenChange,
|
|
57
|
+
setScreenChangeReporter,
|
|
58
|
+
} from './screenTracker';
|
|
59
|
+
|
|
60
|
+
export { SDK_VERSION } from './version';
|
|
61
|
+
export { UserflowProvider, useUserflow } from './runtime/UserflowProvider';
|
|
62
|
+
export type { UserflowProviderProps, UserflowContextValue } from './runtime/UserflowProvider';
|
|
63
|
+
export { useFlowSessionState } from './runtime/useFlowSessionState';
|
|
64
|
+
export type { FlowSessionState } from './runtime/useFlowSessionState';
|
|
65
|
+
export { useUserflowScreen } from './useUserflowScreen';
|
|
66
|
+
export { useUserflowAnchor } from './anchors/useUserflowAnchor';
|
|
67
|
+
export { __userflowAutoAnchor } from './anchors/autoAnchor';
|
|
68
|
+
export { useUserflowScrollContainer } from './anchors/useUserflowScrollContainer';
|
|
69
|
+
export type { UserflowScrollContainerProps } from './anchors/useUserflowScrollContainer';
|
|
70
|
+
export type {
|
|
71
|
+
CustomScrollIntoView,
|
|
72
|
+
ScrollIntoViewTarget,
|
|
73
|
+
ScrollPadding,
|
|
74
|
+
} from './anchors/scrollConfig';
|
|
75
|
+
export {
|
|
76
|
+
INACTIVITY_TIMEOUT_MS,
|
|
77
|
+
SESSION_STALE_AFTER_BACKGROUND_MS,
|
|
78
|
+
SUSPEND_GRACE_MS,
|
|
79
|
+
} from './lifecycle';
|
|
80
|
+
export {
|
|
81
|
+
inspectPairingDeepLink,
|
|
82
|
+
isPairingAttempt,
|
|
83
|
+
parsePairingDeepLink,
|
|
84
|
+
isUserflowPairingUrl,
|
|
85
|
+
PreviewModeBanner,
|
|
86
|
+
} from './pairing';
|
|
87
|
+
export type {
|
|
88
|
+
PairingAttemptRejection,
|
|
89
|
+
PairingDeepLink,
|
|
90
|
+
PairingDeepLinkRejection,
|
|
91
|
+
PairingDeepLinkResult,
|
|
92
|
+
} from './pairing';
|
|
93
|
+
|
|
94
|
+
/** Configuration passed to {@link Userflow.init}. */
|
|
95
|
+
export type UserflowInitConfig = UserflowInitOptions & {
|
|
96
|
+
/**
|
|
97
|
+
* Optional host handler for flow NAVIGATE actions. When set, wins over
|
|
98
|
+
* React Navigation / Expo Router / Linking.
|
|
99
|
+
*/
|
|
100
|
+
onNavigate?: FlowNavigateHandler;
|
|
101
|
+
/**
|
|
102
|
+
* Override the US-pinned Builder pairing websocket host (local/staging).
|
|
103
|
+
* Defaults to `https://e.userflow.com`.
|
|
104
|
+
*/
|
|
105
|
+
pairingEndpoint?: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type {
|
|
109
|
+
UserflowAttributes,
|
|
110
|
+
UserflowConfig,
|
|
111
|
+
UserflowEventAttributes,
|
|
112
|
+
UserflowGroupOptions,
|
|
113
|
+
UserflowIdentifyOptions,
|
|
114
|
+
UserflowInitOptions,
|
|
115
|
+
UserflowTrackOptions,
|
|
116
|
+
} from '@userflow-tech/core';
|
|
117
|
+
|
|
118
|
+
const core = getUserflowCore();
|
|
119
|
+
|
|
120
|
+
const lifecycle = new LifecycleController({
|
|
121
|
+
suspend: () => core.suspend(),
|
|
122
|
+
resume: () => {
|
|
123
|
+
core.resume();
|
|
124
|
+
// After reconnect, flush mid-flow client messages that failed while offline.
|
|
125
|
+
void getFlowSessionEngine(core).flushPendingSends();
|
|
126
|
+
},
|
|
127
|
+
clearLocalSession: () => {
|
|
128
|
+
clearFlowSessionEngineLocalSession();
|
|
129
|
+
// Engine may not exist yet; still clear any transport join resume id.
|
|
130
|
+
core.setFlowSessionId(null);
|
|
131
|
+
},
|
|
132
|
+
ensureAlive: () => core.ensureAlive(),
|
|
133
|
+
hasActiveSession: () => hasActiveFlowSession(),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const network = new NetworkController({
|
|
137
|
+
// Probe if still "connected" (half-open) or reconnect eagerly if already dropped.
|
|
138
|
+
ensureAlive: () => core.ensureAlive(),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
function wireScreenChangeReporter(): void {
|
|
142
|
+
setScreenChangeReporter((location) => {
|
|
143
|
+
lifecycle.reportActivity();
|
|
144
|
+
const screenKey = 'path' in location ? `path:${location.path}` : `screen:${location.screen}`;
|
|
145
|
+
notifyAnchorScreenChange(screenKey);
|
|
146
|
+
anchorChangeTicker.notify();
|
|
147
|
+
if (__DEV__) {
|
|
148
|
+
const identified = core.getUserId() != null;
|
|
149
|
+
// eslint-disable-next-line no-console -- intentional development diagnostic
|
|
150
|
+
console.log(
|
|
151
|
+
'[Userflow] updateScreen',
|
|
152
|
+
location,
|
|
153
|
+
identified ? '(push UpdateClientContext)' : '(buffered until identify)',
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
// Mirrors web: only pushes UpdateClientContext after identify; before that the
|
|
157
|
+
// location is remembered and included on the next end-user channel join.
|
|
158
|
+
void core.updateScreen(location).catch(() => {
|
|
159
|
+
// Screen updates are best-effort; connection drops / rate limits should not
|
|
160
|
+
// surface to the host app's navigation path.
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
wireScreenChangeReporter();
|
|
166
|
+
|
|
167
|
+
function wireDeepLinking(): void {
|
|
168
|
+
startDeepLinking({
|
|
169
|
+
isIdentified: () => core.getUserId() != null,
|
|
170
|
+
startFlowWithToken: (token) => core.startFlowWithToken(token),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function afterIdentify(): Promise<void> {
|
|
175
|
+
attachFlowSessionEngine(core);
|
|
176
|
+
attachClientConditionEngine(core);
|
|
177
|
+
getPairingController(core).notifyIdentified();
|
|
178
|
+
lifecycle.reportActivity();
|
|
179
|
+
try {
|
|
180
|
+
await flushPendingPreviewToken();
|
|
181
|
+
} catch {
|
|
182
|
+
// Preview start is best-effort; identify must still succeed for the host app.
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Public SDK entry point. Delegates to the platform-agnostic engine in
|
|
188
|
+
* `@userflow-tech/core` and manages the app-lifecycle subscription.
|
|
189
|
+
*/
|
|
190
|
+
export const Userflow = {
|
|
191
|
+
/** Validate credentials, store configuration, and wire app-lifecycle handling. */
|
|
192
|
+
init(config: UserflowInitConfig): Promise<UserflowConfig> {
|
|
193
|
+
setHostOnNavigate(config.onNavigate);
|
|
194
|
+
lifecycle.start();
|
|
195
|
+
network.start();
|
|
196
|
+
wireScreenChangeReporter();
|
|
197
|
+
wireDeepLinking();
|
|
198
|
+
// Builder pairing (QR deep links) — active in all builds.
|
|
199
|
+
//
|
|
200
|
+
// Listeners attach *before* core.init so an inbound QR link is captured even
|
|
201
|
+
// when init is still in flight or ends up rejecting. The OS launches the app
|
|
202
|
+
// from the deep link regardless of SDK state, so a listener installed only on
|
|
203
|
+
// the success path makes a failed init look like a broken deep link.
|
|
204
|
+
const pairing = installPairingController(core, {
|
|
205
|
+
...(config.pairingEndpoint !== undefined ? { pairingEndpoint: config.pairingEndpoint } : {}),
|
|
206
|
+
clearLocalSession: () => {
|
|
207
|
+
clearFlowSessionEngineLocalSession();
|
|
208
|
+
core.setFlowSessionId(null);
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
pairing.notifyInitStarted();
|
|
212
|
+
void pairing.start();
|
|
213
|
+
|
|
214
|
+
return core.init(config).then(
|
|
215
|
+
async (resolved) => {
|
|
216
|
+
enableScreenTracking();
|
|
217
|
+
await pairing.notifyInitialized();
|
|
218
|
+
return resolved;
|
|
219
|
+
},
|
|
220
|
+
(error: unknown) => {
|
|
221
|
+
pairing.notifyInitFailed(error);
|
|
222
|
+
throw error;
|
|
223
|
+
},
|
|
224
|
+
);
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* Forward a Userflow pairing deep link into the SDK.
|
|
228
|
+
* Prefer automatic Linking interception from {@link Userflow.init}; use this
|
|
229
|
+
* when the host app owns URL routing.
|
|
230
|
+
*/
|
|
231
|
+
handlePairingUrl(url: string): Promise<boolean> {
|
|
232
|
+
return getPairingController(core).handleUrl(url);
|
|
233
|
+
},
|
|
234
|
+
/** Exit Builder preview mode and disconnect the pairing websocket. */
|
|
235
|
+
exitPreview(): Promise<void> {
|
|
236
|
+
return getPairingController(core).exitPreview();
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Override or clear the host NAVIGATE handler (same as `init({ onNavigate })`).
|
|
240
|
+
* Wins over React Navigation / Expo Router / Linking when set.
|
|
241
|
+
*/
|
|
242
|
+
setOnNavigate(handler: FlowNavigateHandler | null | undefined): void {
|
|
243
|
+
setHostOnNavigate(handler);
|
|
244
|
+
},
|
|
245
|
+
/** Identify the current user and upsert their attributes. */
|
|
246
|
+
async identify(
|
|
247
|
+
userId: string,
|
|
248
|
+
attributes?: UserflowAttributes,
|
|
249
|
+
options?: UserflowIdentifyOptions,
|
|
250
|
+
): Promise<void> {
|
|
251
|
+
const previousId = core.getUserId();
|
|
252
|
+
// Clear before join so the new channel is not seeded with another user's
|
|
253
|
+
// client-condition snapshot.
|
|
254
|
+
if (previousId != null && previousId !== userId) {
|
|
255
|
+
resetClientConditionEngine();
|
|
256
|
+
core.setClientConditions([]);
|
|
257
|
+
await clearAnonymousId();
|
|
258
|
+
}
|
|
259
|
+
await core.identify(userId, attributes, options);
|
|
260
|
+
await afterIdentify();
|
|
261
|
+
},
|
|
262
|
+
/** Identify an anonymous user with a stable auto-generated id stored on device. */
|
|
263
|
+
async identifyAnonymous(
|
|
264
|
+
attributes?: UserflowAttributes,
|
|
265
|
+
options?: UserflowIdentifyOptions,
|
|
266
|
+
): Promise<void> {
|
|
267
|
+
const anonymousId = await getOrCreateAnonymousId();
|
|
268
|
+
const previousId = core.getUserId();
|
|
269
|
+
if (previousId != null && previousId !== anonymousId) {
|
|
270
|
+
resetClientConditionEngine();
|
|
271
|
+
core.setClientConditions([]);
|
|
272
|
+
}
|
|
273
|
+
await core.identify(anonymousId, attributes, options);
|
|
274
|
+
await afterIdentify();
|
|
275
|
+
},
|
|
276
|
+
/**
|
|
277
|
+
* Handle an inbound URL. Returns `true` when it was a Userflow preview deep
|
|
278
|
+
* link (`userflow-*://?token=...`).
|
|
279
|
+
* Prefer letting {@link init} auto-listen; call this when the host app already
|
|
280
|
+
* owns Linking.
|
|
281
|
+
*/
|
|
282
|
+
didHandleURL(url: string): Promise<boolean> {
|
|
283
|
+
return didHandleURL(url);
|
|
284
|
+
},
|
|
285
|
+
/** Associate the current user with a group and upsert group/membership attributes. */
|
|
286
|
+
group(
|
|
287
|
+
groupId: string | number,
|
|
288
|
+
attributes?: UserflowAttributes,
|
|
289
|
+
options?: UserflowGroupOptions,
|
|
290
|
+
): Promise<void> {
|
|
291
|
+
lifecycle.reportActivity();
|
|
292
|
+
return core.group(groupId, attributes, options);
|
|
293
|
+
},
|
|
294
|
+
/** Record a custom analytics event for the current user (and group, unless `userOnly`). */
|
|
295
|
+
track(
|
|
296
|
+
name: string,
|
|
297
|
+
attributes?: UserflowEventAttributes,
|
|
298
|
+
options?: UserflowTrackOptions,
|
|
299
|
+
): Promise<void> {
|
|
300
|
+
lifecycle.reportActivity();
|
|
301
|
+
return core.track(name, attributes, options);
|
|
302
|
+
},
|
|
303
|
+
/** The currently identified user id, or `null` before identify. */
|
|
304
|
+
getUserId(): string | null {
|
|
305
|
+
return core.getUserId();
|
|
306
|
+
},
|
|
307
|
+
/** A copy of the attributes recorded for the current user. */
|
|
308
|
+
getAttributes(): UserflowAttributes {
|
|
309
|
+
return core.getAttributes();
|
|
310
|
+
},
|
|
311
|
+
/** The flow session engine (created lazily; attach runs after identify). */
|
|
312
|
+
getFlowSessionEngine() {
|
|
313
|
+
return getFlowSessionEngine(core);
|
|
314
|
+
},
|
|
315
|
+
/** Clears the current user identity and disconnects from Userflow. */
|
|
316
|
+
async reset(): Promise<void> {
|
|
317
|
+
resetClientConditionEngine();
|
|
318
|
+
resetFlowSessionEngine();
|
|
319
|
+
core.reset();
|
|
320
|
+
await clearAnonymousId();
|
|
321
|
+
},
|
|
322
|
+
/** Remove app-lifecycle, network, and deep-link subscriptions (call on unmount / teardown). */
|
|
323
|
+
teardown(): void {
|
|
324
|
+
getPairingController(core).stop();
|
|
325
|
+
lifecycle.stop();
|
|
326
|
+
network.stop();
|
|
327
|
+
disableScreenTracking();
|
|
328
|
+
stopDeepLinking();
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* Signal user activity so the foreground idle timer resets and an
|
|
332
|
+
* idle-suspended socket reconnects. Prefer automatic signals from
|
|
333
|
+
* {@link updateScreen} / identify / group; call this for touch or other
|
|
334
|
+
* host-app activity the SDK does not observe.
|
|
335
|
+
*/
|
|
336
|
+
reportActivity(): void {
|
|
337
|
+
lifecycle.reportActivity();
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* Report the active React Navigation (or manual) screen name. Prefer
|
|
341
|
+
* {@link useUserflowScreen} in React trees; use this for imperative updates
|
|
342
|
+
* outside hooks. When a user is identified, pushes `UpdateClientContext`
|
|
343
|
+
* with `screen` set (Expo Router pathnames use `path` via the Expo helper).
|
|
344
|
+
*/
|
|
345
|
+
updateScreen(screenName: string | undefined): void {
|
|
346
|
+
handleScreenChange(screenName ? { screen: screenName } : undefined);
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* Sticky header/footer insets applied when scrolling tooltip targets into
|
|
350
|
+
* view (mirrors web `userflow.setScrollPadding`).
|
|
351
|
+
*/
|
|
352
|
+
setScrollPadding(padding: ScrollPadding | null | undefined): void {
|
|
353
|
+
setScrollPaddingConfig(padding);
|
|
354
|
+
},
|
|
355
|
+
/**
|
|
356
|
+
* Replace the SDK's scroll-into-view behavior. Pass `null` to restore the
|
|
357
|
+
* default fiber / registry path (mirrors web `userflow.setCustomScrollIntoView`).
|
|
358
|
+
*/
|
|
359
|
+
setCustomScrollIntoView(fn: CustomScrollIntoView | null | undefined): void {
|
|
360
|
+
setCustomScrollIntoViewConfig(fn);
|
|
361
|
+
},
|
|
362
|
+
};
|
package/src/lifecycle.ts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mobile connection lifecycle policy.
|
|
3
|
+
*
|
|
4
|
+
* - Background / inactive → arm a short grace timer, then suspend the socket.
|
|
5
|
+
* Returning to active before grace elapses avoids suspend/resume churn: resume
|
|
6
|
+
* if already idle-suspended, otherwise probe liveness (`ensureAlive`) so a
|
|
7
|
+
* silently-dead socket recovers without waiting for the next heartbeat.
|
|
8
|
+
* - Foreground after grace but < {@link SESSION_STALE_AFTER_BACKGROUND_MS}
|
|
9
|
+
* (5 min) → resume and keep the mid-flow session (short-background “resume”).
|
|
10
|
+
* - Foreground after ≥ 5 min → clear local flow session, then resume
|
|
11
|
+
* (long-background reconnect without stale mid-flow UI).
|
|
12
|
+
* - Foreground idle for 5 min → suspend (skip while any flow session is active).
|
|
13
|
+
* - Activity while foreground → reset idle timer and resume if idle-suspended.
|
|
14
|
+
*
|
|
15
|
+
* This 5-minute policy is the ticket meaning of FLOW_RENDERING_SPEC “resume”:
|
|
16
|
+
* short backgrounds continue the active flow; long backgrounds clear then reconnect.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { AppState } from 'react-native';
|
|
20
|
+
import type { AppStateStatus, NativeEventSubscription } from 'react-native';
|
|
21
|
+
|
|
22
|
+
/** Match web `INACTIVITY_TIMEOUT` — disconnect after this much idle time in foreground. */
|
|
23
|
+
export const INACTIVITY_TIMEOUT_MS = 5 * 60 * 1000;
|
|
24
|
+
|
|
25
|
+
/** Away this long → drop local mid-flow session before reconnecting. */
|
|
26
|
+
export const SESSION_STALE_AFTER_BACKGROUND_MS = 5 * 60 * 1000;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Delay before suspending on leave. Covers transient iOS `inactive` (Control
|
|
30
|
+
* Center, biometric prompts, app-switcher peek) and quick app-switches.
|
|
31
|
+
*/
|
|
32
|
+
export const SUSPEND_GRACE_MS = 3_000;
|
|
33
|
+
|
|
34
|
+
export type TimerHandle = ReturnType<typeof setTimeout>;
|
|
35
|
+
|
|
36
|
+
export interface LifecycleScheduler {
|
|
37
|
+
setTimeout(handler: () => void, ms: number): TimerHandle;
|
|
38
|
+
clearTimeout(handle: TimerHandle): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface LifecycleControllerDeps {
|
|
42
|
+
suspend: () => void;
|
|
43
|
+
resume: () => void;
|
|
44
|
+
clearLocalSession: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Verify the socket is alive without a full suspend/resume. Called on a quick
|
|
47
|
+
* foreground (blur under grace) when the socket was never lifecycle-suspended
|
|
48
|
+
* but may have died silently. No-op if the transport is not connected.
|
|
49
|
+
* Do not call while lifecycle-suspended — use {@link resume} instead.
|
|
50
|
+
*/
|
|
51
|
+
ensureAlive: () => void;
|
|
52
|
+
/** True while any mid-flow session (live or draft/preview) is on screen. */
|
|
53
|
+
hasActiveSession: () => boolean;
|
|
54
|
+
scheduler?: LifecycleScheduler;
|
|
55
|
+
now?: () => number;
|
|
56
|
+
/** Override for tests; defaults to {@link SUSPEND_GRACE_MS}. */
|
|
57
|
+
suspendGraceMs?: number;
|
|
58
|
+
/** Override for tests; defaults to React Native `AppState.currentState`. */
|
|
59
|
+
getCurrentAppState?: () => AppStateStatus;
|
|
60
|
+
/** Override for tests; defaults to React Native `AppState`. */
|
|
61
|
+
subscribeAppState?: (handler: (status: AppStateStatus) => void) => () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const defaultScheduler: LifecycleScheduler = {
|
|
65
|
+
setTimeout: (handler, ms) => setTimeout(handler, ms),
|
|
66
|
+
clearTimeout: (handle) => clearTimeout(handle),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function defaultSubscribeAppState(handler: (status: AppStateStatus) => void): () => void {
|
|
70
|
+
const subscription: NativeEventSubscription = AppState.addEventListener('change', handler);
|
|
71
|
+
return () => subscription.remove();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Owns AppState subscription, background duration tracking, and the foreground
|
|
76
|
+
* idle timer. Call {@link start} from `Userflow.init` and {@link stop} from
|
|
77
|
+
* `Userflow.teardown`.
|
|
78
|
+
*/
|
|
79
|
+
export class LifecycleController {
|
|
80
|
+
private readonly suspend: () => void;
|
|
81
|
+
private readonly resume: () => void;
|
|
82
|
+
private readonly clearLocalSession: () => void;
|
|
83
|
+
private readonly ensureAlive: () => void;
|
|
84
|
+
private readonly hasActiveSession: () => boolean;
|
|
85
|
+
private readonly scheduler: LifecycleScheduler;
|
|
86
|
+
private readonly now: () => number;
|
|
87
|
+
private readonly suspendGraceMs: number;
|
|
88
|
+
private readonly getCurrentAppState: () => AppStateStatus;
|
|
89
|
+
private readonly subscribeAppState: (handler: (status: AppStateStatus) => void) => () => void;
|
|
90
|
+
|
|
91
|
+
private unsubscribeAppState: (() => void) | null = null;
|
|
92
|
+
private idleTimer: TimerHandle | null = null;
|
|
93
|
+
private graceTimer: TimerHandle | null = null;
|
|
94
|
+
private backgroundedAt: number | null = null;
|
|
95
|
+
private appIsActive = true;
|
|
96
|
+
private started = false;
|
|
97
|
+
/** True once the grace timer has fired (or we suspended on long-away resume). */
|
|
98
|
+
private suspended = false;
|
|
99
|
+
|
|
100
|
+
constructor(deps: LifecycleControllerDeps) {
|
|
101
|
+
this.suspend = deps.suspend;
|
|
102
|
+
this.resume = deps.resume;
|
|
103
|
+
this.clearLocalSession = deps.clearLocalSession;
|
|
104
|
+
this.ensureAlive = deps.ensureAlive;
|
|
105
|
+
this.hasActiveSession = deps.hasActiveSession;
|
|
106
|
+
this.scheduler = deps.scheduler ?? defaultScheduler;
|
|
107
|
+
this.now = deps.now ?? (() => Date.now());
|
|
108
|
+
this.suspendGraceMs = deps.suspendGraceMs ?? SUSPEND_GRACE_MS;
|
|
109
|
+
this.getCurrentAppState = deps.getCurrentAppState ?? (() => AppState.currentState);
|
|
110
|
+
this.subscribeAppState = deps.subscribeAppState ?? defaultSubscribeAppState;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
start(): void {
|
|
114
|
+
if (this.started) return;
|
|
115
|
+
this.started = true;
|
|
116
|
+
this.appIsActive = this.getCurrentAppState() === 'active';
|
|
117
|
+
this.unsubscribeAppState = this.subscribeAppState((status) => {
|
|
118
|
+
this.handleAppStateChange(status);
|
|
119
|
+
});
|
|
120
|
+
if (this.appIsActive) {
|
|
121
|
+
this.scheduleIdleTimer();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
stop(): void {
|
|
126
|
+
if (!this.started) return;
|
|
127
|
+
this.started = false;
|
|
128
|
+
this.clearIdleTimer();
|
|
129
|
+
this.clearGraceTimer();
|
|
130
|
+
this.unsubscribeAppState?.();
|
|
131
|
+
this.unsubscribeAppState = null;
|
|
132
|
+
this.backgroundedAt = null;
|
|
133
|
+
this.suspended = false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Signal user/SDK activity while the app is foregrounded. Resets the idle
|
|
138
|
+
* timer and reconnects if the socket was idle-suspended.
|
|
139
|
+
*/
|
|
140
|
+
reportActivity(): void {
|
|
141
|
+
if (!this.started || !this.appIsActive) return;
|
|
142
|
+
this.resume();
|
|
143
|
+
this.suspended = false;
|
|
144
|
+
this.scheduleIdleTimer();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Visible for tests. */
|
|
148
|
+
handleAppStateChange(status: AppStateStatus): void {
|
|
149
|
+
if (!this.started) return;
|
|
150
|
+
|
|
151
|
+
if (status === 'active') {
|
|
152
|
+
this.onForeground();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (status === 'background' || status === 'inactive') {
|
|
157
|
+
this.onBackground();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private onBackground(): void {
|
|
162
|
+
// Already leaving (e.g. inactive → background): keep first timestamp; do not
|
|
163
|
+
// re-arm the grace timer.
|
|
164
|
+
if (!this.appIsActive && this.backgroundedAt != null) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.appIsActive) {
|
|
169
|
+
this.backgroundedAt = this.now();
|
|
170
|
+
} else if (this.backgroundedAt == null) {
|
|
171
|
+
this.backgroundedAt = this.now();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this.appIsActive = false;
|
|
175
|
+
this.clearIdleTimer();
|
|
176
|
+
this.scheduleGraceTimer();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private onForeground(): void {
|
|
180
|
+
const awayMs = this.backgroundedAt != null ? this.now() - this.backgroundedAt : 0;
|
|
181
|
+
this.backgroundedAt = null;
|
|
182
|
+
this.appIsActive = true;
|
|
183
|
+
this.clearGraceTimer();
|
|
184
|
+
|
|
185
|
+
if (awayMs < this.suspendGraceMs) {
|
|
186
|
+
// Transient blur / quick switch. If already idle-suspended, resume —
|
|
187
|
+
// ensureAlive is a no-op while the transport is lifecycle-suspended.
|
|
188
|
+
// Otherwise probe liveness so a silently-dead socket recovers fast.
|
|
189
|
+
if (this.suspended) {
|
|
190
|
+
this.resume();
|
|
191
|
+
this.suspended = false;
|
|
192
|
+
} else {
|
|
193
|
+
this.ensureAlive();
|
|
194
|
+
}
|
|
195
|
+
this.scheduleIdleTimer();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Away past grace: ensure a clean suspend (covers iOS freezing JS before
|
|
200
|
+
// the grace timer fired) then resume. Clear mid-flow session if stale.
|
|
201
|
+
if (!this.suspended) {
|
|
202
|
+
this.suspend();
|
|
203
|
+
this.suspended = true;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (awayMs >= SESSION_STALE_AFTER_BACKGROUND_MS) {
|
|
207
|
+
this.clearLocalSession();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.resume();
|
|
211
|
+
this.suspended = false;
|
|
212
|
+
this.scheduleIdleTimer();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private scheduleGraceTimer(): void {
|
|
216
|
+
this.clearGraceTimer();
|
|
217
|
+
this.graceTimer = this.scheduler.setTimeout(() => {
|
|
218
|
+
this.graceTimer = null;
|
|
219
|
+
if (this.appIsActive) return;
|
|
220
|
+
if (this.suspended) return;
|
|
221
|
+
this.suspend();
|
|
222
|
+
this.suspended = true;
|
|
223
|
+
}, this.suspendGraceMs);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
private clearGraceTimer(): void {
|
|
227
|
+
if (this.graceTimer != null) {
|
|
228
|
+
this.scheduler.clearTimeout(this.graceTimer);
|
|
229
|
+
this.graceTimer = null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private scheduleIdleTimer(): void {
|
|
234
|
+
this.clearIdleTimer();
|
|
235
|
+
this.idleTimer = this.scheduler.setTimeout(() => {
|
|
236
|
+
this.idleTimer = null;
|
|
237
|
+
if (!this.appIsActive) return;
|
|
238
|
+
if (this.hasActiveSession()) {
|
|
239
|
+
this.scheduleIdleTimer();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.suspend();
|
|
243
|
+
this.suspended = true;
|
|
244
|
+
}, INACTIVITY_TIMEOUT_MS);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private clearIdleTimer(): void {
|
|
248
|
+
if (this.idleTimer != null) {
|
|
249
|
+
this.scheduler.clearTimeout(this.idleTimer);
|
|
250
|
+
this.idleTimer = null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useNavigationContainerRef } from '@react-navigation/native';
|
|
2
|
+
import type {
|
|
3
|
+
NavigationContainerRef,
|
|
4
|
+
NavigationState,
|
|
5
|
+
ParamListBase,
|
|
6
|
+
} from '@react-navigation/native';
|
|
7
|
+
import { cloneElement, isValidElement, useCallback, useEffect } from 'react';
|
|
8
|
+
import type React from 'react';
|
|
9
|
+
|
|
10
|
+
import { handleScreenChange } from '../screenTracker';
|
|
11
|
+
|
|
12
|
+
import { chainCallbacks } from './chainCallbacks';
|
|
13
|
+
import { getActiveRouteName } from './getActiveRouteName';
|
|
14
|
+
import { setReactNavigationRef } from './openFlowNavigateUrl';
|
|
15
|
+
|
|
16
|
+
type NavigationContainerChildProps = {
|
|
17
|
+
ref?: React.Ref<NavigationContainerRef<ParamListBase>>;
|
|
18
|
+
onReady?: () => void;
|
|
19
|
+
onStateChange?: (state?: NavigationState) => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface WithUserflowReactNavigationProps {
|
|
23
|
+
children: React.ReactElement<NavigationContainerChildProps>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function assignRef<T>(ref: React.Ref<T> | undefined, value: T | null): void {
|
|
27
|
+
if (typeof ref === 'function') {
|
|
28
|
+
ref(value);
|
|
29
|
+
} else if (ref != null && typeof ref === 'object' && 'current' in ref) {
|
|
30
|
+
(ref as React.MutableRefObject<T | null>).current = value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function mergeRefs<T>(...refs: Array<React.Ref<T> | undefined>): React.RefCallback<T> {
|
|
35
|
+
return (value) => {
|
|
36
|
+
for (const ref of refs) {
|
|
37
|
+
assignRef(ref, value);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Wraps a React Navigation `NavigationContainer` to report screen changes to
|
|
44
|
+
* Userflow after {@link Userflow.init} has completed.
|
|
45
|
+
*
|
|
46
|
+
* Also registers the container ref for in-app NAVIGATE actions (path-like URLs).
|
|
47
|
+
* Screen tracking ≠ action routing — without this wrapper, NAVIGATE falls back to
|
|
48
|
+
* Linking / host `onNavigate`.
|
|
49
|
+
*/
|
|
50
|
+
export function WithUserflowReactNavigation({
|
|
51
|
+
children,
|
|
52
|
+
}: WithUserflowReactNavigationProps): React.ReactElement {
|
|
53
|
+
const navigationRef = useNavigationContainerRef<ParamListBase>();
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setReactNavigationRef(navigationRef);
|
|
57
|
+
return () => {
|
|
58
|
+
setReactNavigationRef(null);
|
|
59
|
+
};
|
|
60
|
+
}, [navigationRef]);
|
|
61
|
+
|
|
62
|
+
const handleReady = useCallback(() => {
|
|
63
|
+
setReactNavigationRef(navigationRef);
|
|
64
|
+
const name = getActiveRouteName(navigationRef.getRootState());
|
|
65
|
+
handleScreenChange(name ? { screen: name } : undefined);
|
|
66
|
+
}, [navigationRef]);
|
|
67
|
+
|
|
68
|
+
const handleStateChange = useCallback(
|
|
69
|
+
(state?: NavigationState) => {
|
|
70
|
+
const name = getActiveRouteName(state ?? navigationRef.getRootState());
|
|
71
|
+
handleScreenChange(name ? { screen: name } : undefined);
|
|
72
|
+
},
|
|
73
|
+
[navigationRef],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (!isValidElement(children)) {
|
|
77
|
+
throw new Error('WithUserflowReactNavigation expects a single React element child.');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const childProps = children.props;
|
|
81
|
+
|
|
82
|
+
return cloneElement(children, {
|
|
83
|
+
ref: mergeRefs(childProps.ref, navigationRef),
|
|
84
|
+
onReady: chainCallbacks(childProps.onReady, handleReady) ?? handleReady,
|
|
85
|
+
onStateChange: chainCallbacks(childProps.onStateChange, handleStateChange) ?? handleStateChange,
|
|
86
|
+
});
|
|
87
|
+
}
|