@userflow-tech/react-native 0.3.0 → 0.3.1
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/README.md +325 -63
- package/docs/anchoring.md +58 -42
- package/docs/troubleshooting.md +63 -27
- package/expo-plugin/hostDependencyWarnings.d.ts +18 -0
- package/expo-plugin/hostDependencyWarnings.d.ts.map +1 -0
- package/expo-plugin/hostDependencyWarnings.js +91 -0
- package/expo-plugin/hostDependencyWarnings.js.map +1 -0
- package/expo-plugin/withUserflow.d.ts.map +1 -1
- package/expo-plugin/withUserflow.js +16 -0
- package/expo-plugin/withUserflow.js.map +1 -1
- package/lib/commonjs/anchors/AnchorRegistry.js +7 -0
- package/lib/commonjs/anchors/AnchorRegistry.js.map +1 -1
- package/lib/commonjs/anchors/elementConditionEvaluator.js +189 -55
- package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/commonjs/anchors/elementTapMonitor.js +92 -0
- package/lib/commonjs/anchors/elementTapMonitor.js.map +1 -0
- package/lib/commonjs/anchors/elementTargetMatch.js +85 -0
- package/lib/commonjs/anchors/elementTargetMatch.js.map +1 -0
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js +64 -39
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js.map +1 -1
- package/lib/commonjs/anchors/fiber/touchTargetFiber.js +105 -0
- package/lib/commonjs/anchors/fiber/touchTargetFiber.js.map +1 -0
- package/lib/commonjs/anchors/resolveAnchorHost.js +2 -1
- package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js +4 -2
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/resolveElementTargets.js +158 -0
- package/lib/commonjs/anchors/resolveElementTargets.js.map +1 -0
- package/lib/commonjs/anchors/targetPressMonitor.js +9 -3
- package/lib/commonjs/anchors/targetPressMonitor.js.map +1 -1
- package/lib/commonjs/anchors/useUserflowAnchor.js +1 -0
- package/lib/commonjs/anchors/useUserflowAnchor.js.map +1 -1
- package/lib/commonjs/anonymousId.js +16 -7
- package/lib/commonjs/anonymousId.js.map +1 -1
- package/lib/commonjs/index.js +5 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/installCheck.js +151 -0
- package/lib/commonjs/installCheck.js.map +1 -0
- package/lib/commonjs/pairing/deviceId.js +14 -11
- package/lib/commonjs/pairing/deviceId.js.map +1 -1
- package/lib/commonjs/runtime/TargetPressBridge.js +12 -1
- package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
- package/lib/commonjs/runtime/UserflowProvider.js +6 -3
- package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
- package/lib/commonjs/storage/asyncStorage.js +67 -0
- package/lib/commonjs/storage/asyncStorage.js.map +1 -0
- package/lib/commonjs/surfaces/safeArea.js +68 -28
- package/lib/commonjs/surfaces/safeArea.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/anchors/AnchorRegistry.js +7 -0
- package/lib/module/anchors/AnchorRegistry.js.map +1 -1
- package/lib/module/anchors/elementConditionEvaluator.js +189 -55
- package/lib/module/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/module/anchors/elementTapMonitor.js +87 -0
- package/lib/module/anchors/elementTapMonitor.js.map +1 -0
- package/lib/module/anchors/elementTargetMatch.js +78 -0
- package/lib/module/anchors/elementTargetMatch.js.map +1 -0
- package/lib/module/anchors/fiber/findAnchorFiber.js +62 -39
- package/lib/module/anchors/fiber/findAnchorFiber.js.map +1 -1
- package/lib/module/anchors/fiber/touchTargetFiber.js +100 -0
- package/lib/module/anchors/fiber/touchTargetFiber.js.map +1 -0
- package/lib/module/anchors/resolveAnchorHost.js +2 -1
- package/lib/module/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/module/anchors/resolveAutoAnchorHost.js +3 -3
- package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/module/anchors/resolveElementTargets.js +152 -0
- package/lib/module/anchors/resolveElementTargets.js.map +1 -0
- package/lib/module/anchors/targetPressMonitor.js +8 -3
- package/lib/module/anchors/targetPressMonitor.js.map +1 -1
- package/lib/module/anchors/useUserflowAnchor.js +1 -0
- package/lib/module/anchors/useUserflowAnchor.js.map +1 -1
- package/lib/module/anonymousId.js +15 -5
- package/lib/module/anonymousId.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/installCheck.js +139 -0
- package/lib/module/installCheck.js.map +1 -0
- package/lib/module/pairing/deviceId.js +14 -10
- package/lib/module/pairing/deviceId.js.map +1 -1
- package/lib/module/runtime/TargetPressBridge.js +12 -1
- package/lib/module/runtime/TargetPressBridge.js.map +1 -1
- package/lib/module/runtime/UserflowProvider.js +7 -4
- package/lib/module/runtime/UserflowProvider.js.map +1 -1
- package/lib/module/storage/asyncStorage.js +61 -0
- package/lib/module/storage/asyncStorage.js.map +1 -0
- package/lib/module/surfaces/safeArea.js +65 -28
- package/lib/module/surfaces/safeArea.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts +7 -0
- package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts +12 -16
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts +36 -0
- package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts +20 -0
- package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts +17 -5
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/touchTargetFiber.d.ts +24 -0
- package/lib/typescript/commonjs/src/anchors/fiber/touchTargetFiber.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +2 -1
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts +10 -1
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveElementTargets.d.ts +39 -0
- package/lib/typescript/commonjs/src/anchors/resolveElementTargets.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts +2 -0
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/useUserflowAnchor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anonymousId.d.ts +2 -0
- package/lib/typescript/commonjs/src/anonymousId.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/installCheck.d.ts +33 -0
- package/lib/typescript/commonjs/src/installCheck.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/deviceId.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +2 -1
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/storage/asyncStorage.d.ts +15 -0
- package/lib/typescript/commonjs/src/storage/asyncStorage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +4 -2
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts +7 -0
- package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts +12 -16
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts +36 -0
- package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts +20 -0
- package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts +17 -5
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/touchTargetFiber.d.ts +24 -0
- package/lib/typescript/module/src/anchors/fiber/touchTargetFiber.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +2 -1
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts +10 -1
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/resolveElementTargets.d.ts +39 -0
- package/lib/typescript/module/src/anchors/resolveElementTargets.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts +2 -0
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/useUserflowAnchor.d.ts.map +1 -1
- package/lib/typescript/module/src/anonymousId.d.ts +2 -0
- package/lib/typescript/module/src/anonymousId.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/installCheck.d.ts +33 -0
- package/lib/typescript/module/src/installCheck.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/deviceId.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +2 -1
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/storage/asyncStorage.d.ts +15 -0
- package/lib/typescript/module/src/storage/asyncStorage.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts +4 -2
- package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +13 -1
- package/src/anchors/AnchorRegistry.ts +12 -0
- package/src/anchors/elementConditionEvaluator.ts +235 -70
- package/src/anchors/elementTapMonitor.ts +95 -0
- package/src/anchors/elementTargetMatch.ts +90 -0
- package/src/anchors/fiber/findAnchorFiber.ts +66 -35
- package/src/anchors/fiber/touchTargetFiber.ts +125 -0
- package/src/anchors/resolveAnchorHost.ts +2 -1
- package/src/anchors/resolveAutoAnchorHost.ts +3 -3
- package/src/anchors/resolveElementTargets.ts +165 -0
- package/src/anchors/targetPressMonitor.ts +12 -3
- package/src/anchors/useUserflowAnchor.ts +1 -0
- package/src/anonymousId.ts +19 -8
- package/src/index.ts +10 -0
- package/src/installCheck.ts +191 -0
- package/src/pairing/deviceId.ts +14 -11
- package/src/runtime/TargetPressBridge.tsx +17 -1
- package/src/runtime/UserflowProvider.tsx +11 -4
- package/src/storage/asyncStorage.ts +88 -0
- package/src/surfaces/safeArea.ts +80 -40
- package/src/version.ts +1 -1
- package/vendor/core/dist/constants.d.ts +2 -0
- package/vendor/core/dist/constants.d.ts.map +1 -1
- package/vendor/core/dist/constants.js +2 -0
- package/vendor/core/dist/constants.js.map +1 -1
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts +20 -1
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/ClientConditionEngine.js +13 -10
- package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -1
- package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -1
- package/vendor/core/dist/engine/UserflowCore.js +21 -2
- package/vendor/core/dist/engine/UserflowCore.js.map +1 -1
- package/vendor/core/dist/index.d.ts +1 -1
- package/vendor/core/dist/index.d.ts.map +1 -1
- package/vendor/core/dist/index.js.map +1 -1
- package/vendor/core/dist/version.d.ts +1 -1
- package/vendor/core/dist/version.js +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/protocol/package.json +1 -1
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { elementTapMonitor } from "../anchors/elementTapMonitor.js";
|
|
6
|
+
import { touchBelongsToEvent, touchTargetFiber } from "../anchors/fiber/touchTargetFiber.js";
|
|
5
7
|
import { targetPressMonitor } from "../anchors/targetPressMonitor.js";
|
|
6
8
|
import { changedTouchPoints, forEachChangedTouch } from "./changedTouchPoints.js";
|
|
7
9
|
import { isolateSync } from "./isolateCall.js";
|
|
@@ -13,7 +15,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
15
|
*
|
|
14
16
|
* The Userflow overlay is a sibling above the app, so hole Pressables would
|
|
15
17
|
* intercept presses. Instead we hit-test bubbled `onTouchStart` / `onTouchEnd`
|
|
16
|
-
* against the rect registered by {@link TooltipSurface}
|
|
18
|
+
* against the rect registered by {@link TooltipSurface}, and — while an
|
|
19
|
+
* element click condition is tracked — against the fiber under the finger.
|
|
17
20
|
*
|
|
18
21
|
* Preview-chrome double taps are observed by `DoubleTapBridge` around the
|
|
19
22
|
* whole provider tree — this bridge never sees overlay touches.
|
|
@@ -25,15 +28,21 @@ export function TargetPressBridge({
|
|
|
25
28
|
}) {
|
|
26
29
|
const onTouchStart = React.useCallback(event => {
|
|
27
30
|
isolateSync('target-press', () => {
|
|
31
|
+
const observingTaps = elementTapMonitor.subscriberCount > 0;
|
|
28
32
|
forEachChangedTouch(event, (identifier, pageX, pageY) => {
|
|
29
33
|
targetPressMonitor.handleTouchStart(identifier, pageX, pageY);
|
|
34
|
+
if (!observingTaps || !touchBelongsToEvent(event, identifier)) return;
|
|
35
|
+
elementTapMonitor.handleTouchStart(identifier, pageX, pageY, touchTargetFiber(event, identifier));
|
|
30
36
|
});
|
|
31
37
|
});
|
|
32
38
|
}, []);
|
|
33
39
|
const onTouchEnd = React.useCallback(event => {
|
|
34
40
|
isolateSync('target-press', () => {
|
|
41
|
+
const observingTaps = elementTapMonitor.subscriberCount > 0;
|
|
35
42
|
forEachChangedTouch(event, (identifier, pageX, pageY) => {
|
|
36
43
|
targetPressMonitor.handleTouchEnd(identifier, pageX, pageY);
|
|
44
|
+
if (!observingTaps) return;
|
|
45
|
+
elementTapMonitor.handleTouchEnd(identifier, pageX, pageY);
|
|
37
46
|
});
|
|
38
47
|
});
|
|
39
48
|
}, []);
|
|
@@ -42,10 +51,12 @@ export function TargetPressBridge({
|
|
|
42
51
|
const points = changedTouchPoints(event);
|
|
43
52
|
if (points.length === 0) {
|
|
44
53
|
targetPressMonitor.cancelTouch();
|
|
54
|
+
elementTapMonitor.cancelTouch();
|
|
45
55
|
return;
|
|
46
56
|
}
|
|
47
57
|
for (const touch of points) {
|
|
48
58
|
targetPressMonitor.cancelTouch(touch.identifier);
|
|
59
|
+
elementTapMonitor.cancelTouch(touch.identifier);
|
|
49
60
|
}
|
|
50
61
|
});
|
|
51
62
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","targetPressMonitor","changedTouchPoints","forEachChangedTouch","isolateSync","jsx","_jsx","TargetPressBridge","children","onTouchStart","useCallback","event","identifier","pageX","pageY","handleTouchStart","onTouchEnd","handleTouchEnd","onTouchCancel","points","length","cancelTouch","touch","style","styles","root","collapsable","testID","create","flex"],"sourceRoot":"../../../src","sources":["runtime/TargetPressBridge.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,QAAoC,cAAc;AAE3E,SAASC,kBAAkB,QAAQ,kCAA+B;AAElE,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,yBAAsB;AAC9E,SAASC,WAAW,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAC;EAAEC;AAAiC,CAAC,EAAsB;EAC1F,MAAMC,YAAY,
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","elementTapMonitor","touchBelongsToEvent","touchTargetFiber","targetPressMonitor","changedTouchPoints","forEachChangedTouch","isolateSync","jsx","_jsx","TargetPressBridge","children","onTouchStart","useCallback","event","observingTaps","subscriberCount","identifier","pageX","pageY","handleTouchStart","onTouchEnd","handleTouchEnd","onTouchCancel","points","length","cancelTouch","touch","style","styles","root","collapsable","testID","create","flex"],"sourceRoot":"../../../src","sources":["runtime/TargetPressBridge.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,QAAoC,cAAc;AAE3E,SAASC,iBAAiB,QAAQ,iCAA8B;AAChE,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,sCAAmC;AACzF,SAASC,kBAAkB,QAAQ,kCAA+B;AAElE,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,yBAAsB;AAC9E,SAASC,WAAW,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAC;EAAEC;AAAiC,CAAC,EAAsB;EAC1F,MAAMC,YAAY,GAAGd,KAAK,CAACe,WAAW,CAAEC,KAA4B,IAAK;IACvEP,WAAW,CAAC,cAAc,EAAE,MAAM;MAChC,MAAMQ,aAAa,GAAGd,iBAAiB,CAACe,eAAe,GAAG,CAAC;MAC3DV,mBAAmB,CAACQ,KAAK,EAAE,CAACG,UAAU,EAAEC,KAAK,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WAAW,CAACC,KAAK,CAACV,UAAU,CAAC;QAChDhB,iBAAiB,CAACyB,WAAW,CAACC,KAAK,CAACV,UAAU,CAAC;MACjD;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,oBACER,IAAA,CAACT,IAAI;IACH4B,KAAK,EAAEC,MAAM,CAACC,IAAK;IACnBC,WAAW,EAAE,KAAM;IACnBnB,YAAY,EAAEA,YAAa;IAC3BS,UAAU,EAAEA,UAAW;IACvBE,aAAa,EAAEA,aAAc;IAC7BS,MAAM,EAAC,8BAA8B;IAAArB,QAAA,EAEpCA;EAAQ,CACL,CAAC;AAEX;AAEA,MAAMkB,MAAM,GAAG9B,UAAU,CAACkC,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import { FiberScanRoot } from "../anchors/fiber/FiberScanRoot.js";
|
|
|
6
6
|
import { DoubleTapBridge } from "../authoring/chrome/DoubleTapBridge.js";
|
|
7
7
|
import { elementPickerController } from "../authoring/elementPickerController.js";
|
|
8
8
|
import { ABSOLUTE_FILL } from "../surfaces/absoluteFill.js";
|
|
9
|
-
import { getSafeAreaInsetsContext, useUserflowSafeAreaInsets } from "../surfaces/safeArea.js";
|
|
9
|
+
import { getSafeAreaInsetsContext, useParentSafeAreaInsets, useUserflowSafeAreaInsets } from "../surfaces/safeArea.js";
|
|
10
10
|
import { SurfaceLayoutInsetsProvider } from "../surfaces/surfaceLayoutInsets.js";
|
|
11
11
|
import { BannerHost } from "./BannerHost.js";
|
|
12
12
|
import { SdkErrorBoundary } from "./SdkErrorBoundary.js";
|
|
@@ -175,14 +175,17 @@ function HostSafeArea({
|
|
|
175
175
|
children
|
|
176
176
|
}) {
|
|
177
177
|
const Context = getSafeAreaInsetsContext();
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
// Re-provide only when a parent already supplied insets, or when a banner
|
|
179
|
+
// override applies. Supplying a value with no parent would hide the host's
|
|
180
|
+
// own missing SafeAreaProvider from its useSafeAreaInsets() calls.
|
|
181
|
+
const parent = useParentSafeAreaInsets();
|
|
182
|
+
if (!Context || insets == null && parent == null) {
|
|
180
183
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
181
184
|
children: children
|
|
182
185
|
});
|
|
183
186
|
}
|
|
184
187
|
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
185
|
-
value: insets ??
|
|
188
|
+
value: insets ?? parent,
|
|
186
189
|
children: children
|
|
187
190
|
});
|
|
188
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","FiberScanRoot","DoubleTapBridge","elementPickerController","ABSOLUTE_FILL","getSafeAreaInsetsContext","useUserflowSafeAreaInsets","SurfaceLayoutInsetsProvider","BannerHost","SdkErrorBoundary","TargetPressBridge","UserflowOverlay","getBannerSessionEngine","BannerEngineContext","bannerEdge","getFlowSessionEngine","isolateSync","useBannerSession","getUserflowCore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","UserflowContext","createContext","overlayResetKeyFromEngine","engine","session","getFlowSession","id","getCurrentStep","useOverlayErrorBoundaryResetKey","resetKey","setResetKey","useState","useEffect","apply","next","on","UserflowProvider","children","engineProp","bannerEngine","bannerEngineProp","contextValue","useMemo","overlayResetKey","trapHostAccessibility","setTrapHostAccessibility","onTrapChange","useCallback","trap","onOverlayError","bannerSession","safeInsets","pickerActive","setPickerActive","getState","active","subscribe","banner","version","flowEdge","overlay","embedMode","hostInsets","top","bottom","appContent","style","styles","testID","importantForAccessibility","undefined","accessibilityElementsHidden","Provider","value","root","collapsable","placement","edge","hidden","HostSafeArea","insets","pointerEvents","scope","onError","Context","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","FiberScanRoot","DoubleTapBridge","elementPickerController","ABSOLUTE_FILL","getSafeAreaInsetsContext","useParentSafeAreaInsets","useUserflowSafeAreaInsets","SurfaceLayoutInsetsProvider","BannerHost","SdkErrorBoundary","TargetPressBridge","UserflowOverlay","getBannerSessionEngine","BannerEngineContext","bannerEdge","getFlowSessionEngine","isolateSync","useBannerSession","getUserflowCore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","UserflowContext","createContext","overlayResetKeyFromEngine","engine","session","getFlowSession","id","getCurrentStep","useOverlayErrorBoundaryResetKey","resetKey","setResetKey","useState","useEffect","apply","next","on","UserflowProvider","children","engineProp","bannerEngine","bannerEngineProp","contextValue","useMemo","overlayResetKey","trapHostAccessibility","setTrapHostAccessibility","onTrapChange","useCallback","trap","onOverlayError","bannerSession","safeInsets","pickerActive","setPickerActive","getState","active","subscribe","banner","version","flowEdge","overlay","embedMode","hostInsets","top","bottom","appContent","style","styles","testID","importantForAccessibility","undefined","accessibilityElementsHidden","Provider","value","root","collapsable","placement","edge","hidden","HostSafeArea","insets","pointerEvents","scope","onError","Context","parent","useUserflow","ctx","useContext","Error","create","flex"],"sourceRoot":"../../../src","sources":["runtime/UserflowProvider.tsx"],"mappings":";;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,eAAe,QAAQ,wCAAqC;AACrE,SAASC,uBAAuB,QAAQ,yCAAsC;AAC9E,SAASC,aAAa,QAAQ,6BAA0B;AACxD,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,yBAAyB,QACpB,yBAAsB;AAE7B,SAASC,2BAA2B,QAAQ,oCAAiC;AAE7E,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,sBAAsB,QAAQ,mBAAgB;AACvD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,UAAU,QAAQ,sBAAmB;AAC9C,SAASC,oBAAoB,Q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I,CAACoF,OAAO,IAAKJ,MAAM,IAAI,IAAI,IAAIK,MAAM,IAAI,IAAK,EAAE;IAClD,oBAAOtE,IAAA,CAAAI,SAAA;MAAAkB,QAAA,EAAGA;IAAQ,CAAG,CAAC;EACxB;EACA,oBAAOtB,IAAA,CAACqE,OAAO,CAACZ,QAAQ;IAACC,KAAK,EAAEO,MAAM,IAAIK,MAAO;IAAAhD,QAAA,EAAEA;EAAQ,CAAmB,CAAC;AACjF;;AAEA;AACA,OAAO,SAASiD,WAAWA,CAAA,EAAyB;EAClD,MAAMC,GAAG,GAAG/F,KAAK,CAACgG,UAAU,CAACpE,eAAe,CAAC;EAC7C,IAAI,CAACmE,GAAG,EAAE;IACR,MAAM,IAAIE,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EACA,OAAOF,GAAG;AACZ;AAEA,MAAMpB,MAAM,GAAG1E,UAAU,CAACiG,MAAM,CAAC;EAC/BhB,IAAI,EAAE;IACJiB,IAAI,EAAE;EACR,CAAC;EACD1B,UAAU,EAAE;IACV0B,IAAI,EAAE;EACR,CAAC;EACD/B,OAAO,EAAE;IACP,GAAG9D;EACL;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const ASYNC_STORAGE_NATIVE_MODULES = ['RNAsyncStorage', 'RNCAsyncStorage', 'RNC_AsyncSQLiteDBStorage', 'PlatformLocalStorage', 'AsyncSQLiteDBStorage', 'AsyncLocalStorage'];
|
|
4
|
+
let cached;
|
|
5
|
+
function loadReactNative() {
|
|
6
|
+
try {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
8
|
+
return require('react-native');
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function nativeModuleRegistered(name, reactNative) {
|
|
14
|
+
try {
|
|
15
|
+
const turbo = reactNative.TurboModuleRegistry;
|
|
16
|
+
if (typeof turbo?.get === 'function' && turbo.get(name) != null) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
// A missing turbo registry is not a failed link check.
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
return reactNative.NativeModules?.[name] != null;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** True when some AsyncStorage native binary is in this build. */
|
|
30
|
+
export function isAsyncStorageLinked() {
|
|
31
|
+
const reactNative = loadReactNative();
|
|
32
|
+
if (!reactNative) return false;
|
|
33
|
+
return ASYNC_STORAGE_NATIVE_MODULES.some(name => nativeModuleRegistered(name, reactNative));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The AsyncStorage JS API, or `null` when the package or its native module is
|
|
38
|
+
* missing. Never requires the package until the native module is registered.
|
|
39
|
+
*/
|
|
40
|
+
export function getAsyncStorage() {
|
|
41
|
+
if (cached !== undefined) return cached;
|
|
42
|
+
if (typeof require !== 'function' || !isAsyncStorageLinked()) {
|
|
43
|
+
cached = null;
|
|
44
|
+
return cached;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
48
|
+
const mod = require('@react-native-async-storage/async-storage');
|
|
49
|
+
const storage = mod?.default ?? mod;
|
|
50
|
+
cached = typeof storage?.getItem === 'function' && typeof storage.setItem === 'function' && typeof storage.removeItem === 'function' ? storage : null;
|
|
51
|
+
} catch {
|
|
52
|
+
cached = null;
|
|
53
|
+
}
|
|
54
|
+
return cached;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export function resetAsyncStorageCacheForTests() {
|
|
59
|
+
cached = undefined;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=asyncStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ASYNC_STORAGE_NATIVE_MODULES","cached","loadReactNative","require","nativeModuleRegistered","name","reactNative","turbo","TurboModuleRegistry","get","NativeModules","isAsyncStorageLinked","some","getAsyncStorage","undefined","mod","storage","default","getItem","setItem","removeItem","resetAsyncStorageCacheForTests"],"sourceRoot":"../../../src","sources":["storage/asyncStorage.ts"],"mappings":";;AAIA,MAAMA,4BAA4B,GAAG,CACnC,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,CACX;AAQV,IAAIC,MAA2C;AAE/C,SAASC,eAAeA,CAAA,EAAmC;EACzD,IAAI;IACF;IACA,OAAOC,OAAO,CAAC,cAAc,CAAC;EAChC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,SAASC,sBAAsBA,CAACC,IAAY,EAAEC,WAAoC,EAAW;EAC3F,IAAI;IACF,MAAMC,KAAK,GAAGD,WAAW,CAACE,mBAAmB;IAC7C,IAAI,OAAOD,KAAK,EAAEE,GAAG,KAAK,UAAU,IAAIF,KAAK,CAACE,GAAG,CAACJ,IAAI,CAAC,IAAI,IAAI,EAAE;MAC/D,OAAO,IAAI;IACb;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAEF,IAAI;IACF,OAAOC,WAAW,CAACI,aAAa,GAAGL,IAAI,CAAC,IAAI,IAAI;EAClD,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF;;AAEA;AACA,OAAO,SAASM,oBAAoBA,CAAA,EAAY;EAC9C,MAAML,WAAW,GAAGJ,eAAe,CAAC,CAAC;EACrC,IAAI,CAACI,WAAW,EAAE,OAAO,KAAK;EAC9B,OAAON,4BAA4B,CAACY,IAAI,CAAEP,IAAI,IAAKD,sBAAsB,CAACC,IAAI,EAAEC,WAAW,CAAC,CAAC;AAC/F;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASO,eAAeA,CAAA,EAA4B;EACzD,IAAIZ,MAAM,KAAKa,SAAS,EAAE,OAAOb,MAAM;EAEvC,IAAI,OAAOE,OAAO,KAAK,UAAU,IAAI,CAACQ,oBAAoB,CAAC,CAAC,EAAE;IAC5DV,MAAM,GAAG,IAAI;IACb,OAAOA,MAAM;EACf;EAEA,IAAI;IACF;IACA,MAAMc,GAAG,GAAGZ,OAAO,CAAC,2CAA2C,CAElC;IAC7B,MAAMa,OAAO,GAAGD,GAAG,EAAEE,OAAO,IAAIF,GAAG;IACnCd,MAAM,GACJ,OAAOe,OAAO,EAAEE,OAAO,KAAK,UAAU,IACtC,OAAOF,OAAO,CAACG,OAAO,KAAK,UAAU,IACrC,OAAOH,OAAO,CAACI,UAAU,KAAK,UAAU,GACnCJ,OAAO,GACR,IAAI;EACZ,CAAC,CAAC,MAAM;IACNf,MAAM,GAAG,IAAI;EACf;EAEA,OAAOA,MAAM;AACf;;AAEA;AACA,OAAO,SAASoB,8BAA8BA,CAAA,EAAS;EACrDpB,MAAM,GAAGa,SAAS;AACpB","ignoreList":[]}
|
|
@@ -1,38 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import React from 'react';
|
|
3
4
|
const ZERO_INSETS = {
|
|
4
5
|
top: 0,
|
|
5
6
|
right: 0,
|
|
6
7
|
bottom: 0,
|
|
7
8
|
left: 0
|
|
8
9
|
};
|
|
9
|
-
let cachedHook;
|
|
10
|
-
let cachedInsetsContext;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Used only when `react-native-safe-area-context` is not installed, so
|
|
13
|
+
* {@link useUserflowSafeAreaInsets} can call `useContext` unconditionally.
|
|
15
14
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const FallbackInsetsContext = /*#__PURE__*/React.createContext(null);
|
|
16
|
+
export const MISSING_SAFE_AREA_PROVIDER_WARNING = '[Userflow] UserflowProvider is not inside a <SafeAreaProvider>, so flow cards use the ' + "device's initial safe-area insets. Wrap your app in <SafeAreaProvider> from " + 'react-native-safe-area-context.';
|
|
17
|
+
let cachedModule;
|
|
18
|
+
let warnedMissingProvider = false;
|
|
19
|
+
function loadSafeAreaModule() {
|
|
20
|
+
if (cachedModule !== undefined) return cachedModule;
|
|
18
21
|
if (typeof require !== 'function') {
|
|
19
|
-
|
|
20
|
-
return
|
|
22
|
+
cachedModule = null;
|
|
23
|
+
return null;
|
|
21
24
|
}
|
|
22
25
|
try {
|
|
23
26
|
// Optional peer — Expo / React Navigation apps usually have it.
|
|
24
27
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
28
|
const mod = require('react-native-safe-area-context');
|
|
26
|
-
|
|
29
|
+
cachedModule = mod?.SafeAreaInsetsContext ? mod : null;
|
|
27
30
|
} catch {
|
|
28
|
-
|
|
31
|
+
cachedModule = null;
|
|
29
32
|
}
|
|
30
|
-
return
|
|
33
|
+
return cachedModule;
|
|
34
|
+
}
|
|
35
|
+
function copyInsets(insets) {
|
|
36
|
+
if (!insets) return null;
|
|
37
|
+
const top = insets.top;
|
|
38
|
+
const right = insets.right;
|
|
39
|
+
const bottom = insets.bottom;
|
|
40
|
+
const left = insets.left;
|
|
41
|
+
if (typeof top !== 'number' || typeof right !== 'number' || typeof bottom !== 'number' || typeof left !== 'number') {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
top,
|
|
46
|
+
right,
|
|
47
|
+
bottom,
|
|
48
|
+
left
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Device insets from the optional peer, before any provider has measured. */
|
|
53
|
+
function readInitialInsets() {
|
|
54
|
+
return copyInsets(loadSafeAreaModule()?.initialWindowMetrics?.insets);
|
|
55
|
+
}
|
|
56
|
+
function warnMissingProvider() {
|
|
57
|
+
if (warnedMissingProvider || !__DEV__) return;
|
|
58
|
+
warnedMissingProvider = true;
|
|
59
|
+
// eslint-disable-next-line no-console -- intentional missing-provider diagnostic
|
|
60
|
+
console.warn(MISSING_SAFE_AREA_PROVIDER_WARNING);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Safe-area insets for flow chrome.
|
|
65
|
+
*
|
|
66
|
+
* Reads `SafeAreaInsetsContext` directly. `useSafeAreaInsets()` throws when the
|
|
67
|
+
* peer is installed but no `SafeAreaProvider` is mounted, which would take down
|
|
68
|
+
* the host tree. A missing provider falls back to `initialWindowMetrics`, then
|
|
69
|
+
* zero, and warns once in development.
|
|
70
|
+
*/
|
|
71
|
+
function insetsContext() {
|
|
72
|
+
return loadSafeAreaModule()?.SafeAreaInsetsContext ?? FallbackInsetsContext;
|
|
31
73
|
}
|
|
32
74
|
|
|
33
|
-
/**
|
|
75
|
+
/** Value from the nearest provider, or `null` when the peer or provider is absent. */
|
|
76
|
+
export function useParentSafeAreaInsets() {
|
|
77
|
+
return copyInsets(React.useContext(insetsContext()));
|
|
78
|
+
}
|
|
34
79
|
export function useUserflowSafeAreaInsets() {
|
|
35
|
-
|
|
80
|
+
const fromProvider = useParentSafeAreaInsets();
|
|
81
|
+
if (fromProvider) return fromProvider;
|
|
82
|
+
if (!loadSafeAreaModule()) return ZERO_INSETS;
|
|
83
|
+
warnMissingProvider();
|
|
84
|
+
return readInitialInsets() ?? ZERO_INSETS;
|
|
36
85
|
}
|
|
37
86
|
|
|
38
87
|
/**
|
|
@@ -40,24 +89,12 @@ export function useUserflowSafeAreaInsets() {
|
|
|
40
89
|
* In-flow banners override this so host screens do not add the inset the banner already consumed.
|
|
41
90
|
*/
|
|
42
91
|
export function getSafeAreaInsetsContext() {
|
|
43
|
-
|
|
44
|
-
if (typeof require !== 'function') {
|
|
45
|
-
cachedInsetsContext = null;
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
50
|
-
const mod = require('react-native-safe-area-context');
|
|
51
|
-
cachedInsetsContext = mod.SafeAreaInsetsContext ?? null;
|
|
52
|
-
} catch {
|
|
53
|
-
cachedInsetsContext = null;
|
|
54
|
-
}
|
|
55
|
-
return cachedInsetsContext;
|
|
92
|
+
return loadSafeAreaModule()?.SafeAreaInsetsContext ?? null;
|
|
56
93
|
}
|
|
57
94
|
|
|
58
95
|
/** @internal */
|
|
59
96
|
export function resetSafeAreaInsetsCacheForTests() {
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
cachedModule = undefined;
|
|
98
|
+
warnedMissingProvider = false;
|
|
62
99
|
}
|
|
63
100
|
//# sourceMappingURL=safeArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ZERO_INSETS","top","right","bottom","left","
|
|
1
|
+
{"version":3,"names":["React","ZERO_INSETS","top","right","bottom","left","FallbackInsetsContext","createContext","MISSING_SAFE_AREA_PROVIDER_WARNING","cachedModule","warnedMissingProvider","loadSafeAreaModule","undefined","require","mod","SafeAreaInsetsContext","copyInsets","insets","readInitialInsets","initialWindowMetrics","warnMissingProvider","__DEV__","console","warn","insetsContext","useParentSafeAreaInsets","useContext","useUserflowSafeAreaInsets","fromProvider","getSafeAreaInsetsContext","resetSafeAreaInsetsCacheForTests"],"sourceRoot":"../../../src","sources":["surfaces/safeArea.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAwB,OAAO;AAS3C,MAAMC,WAAuB,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,KAAK,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,IAAI,EAAE;AAAE,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,gBAAGN,KAAK,CAACO,aAAa,CAAoB,IAAI,CAAC;AAE1E,OAAO,MAAMC,kCAAkC,GAC7C,wFAAwF,GACxF,8EAA8E,GAC9E,iCAAiC;AAOnC,IAAIC,YAA+C;AACnD,IAAIC,qBAAqB,GAAG,KAAK;AAEjC,SAASC,kBAAkBA,CAAA,EAA0B;EACn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+B;EACnD,OAAOb,kBAAkB,CAAC,CAAC,EAAEI,qBAAqB,IAAIT,qBAAqB;AAC7E;;AAEA;AACA,OAAO,SAASmB,uBAAuBA,CAAA,EAAsB;EAC3D,OAAOT,UAAU,CAAChB,KAAK,CAAC0B,UAAU,CAACF,aAAa,CAAC,CAAC,CAAC,CAAC;AACtD;AAEA,OAAO,SAASG,yBAAyBA,CAAA,EAAe;EACtD,MAAMC,YAAY,GAAGH,uBAAuB,CAAC,CAAC;EAC9C,IAAIG,YAAY,EAAE,OAAOA,YAAY;EACrC,IAAI,CAACjB,kBAAkB,CAAC,CAAC,EAAE,OAAOV,WAAW;EAC7CmB,mBAAmB,CAAC,CAAC;EACrB,OAAOF,iBAAiB,CAAC,CAAC,IAAIjB,WAAW;AAC3C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAS4B,wBAAwBA,CAAA,EAAsC;EAC5E,OAAOlB,kBAAkB,CAAC,CAAC,EAAEI,qBAAqB,IAAI,IAAI;AAC5D;;AAEA;AACA,OAAO,SAASe,gCAAgCA,CAAA,EAAS;EACvDrB,YAAY,GAAGG,SAAS;EACxBF,qBAAqB,GAAG,KAAK;AAC/B","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -6,6 +6,11 @@ export interface AnchorHost {
|
|
|
6
6
|
* Called when the measured rect is not fully visible (bounded retries per step).
|
|
7
7
|
*/
|
|
8
8
|
scrollIntoView?: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Public instance this host was registered from, when known. Element click
|
|
11
|
+
* conditions use it to match a tap to this anchor.
|
|
12
|
+
*/
|
|
13
|
+
node?: object | null;
|
|
9
14
|
}
|
|
10
15
|
type Listener = () => void;
|
|
11
16
|
/**
|
|
@@ -19,6 +24,8 @@ export declare class AnchorRegistry {
|
|
|
19
24
|
register(id: string, host: AnchorHost): void;
|
|
20
25
|
unregister(id: string, host: AnchorHost): void;
|
|
21
26
|
get(id: string): AnchorHost | null;
|
|
27
|
+
/** Every host registered for `id`, in registration order. */
|
|
28
|
+
getAll(id: string): AnchorHost[];
|
|
22
29
|
/** True when more than one host is registered for the same id. */
|
|
23
30
|
isAmbiguous(id: string): boolean;
|
|
24
31
|
subscribe(listener: Listener): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchorRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/AnchorRegistry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;IACV;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"AnchorRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/AnchorRegistry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;IACV;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuB;IAEjD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAW5C,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAU9C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAUlC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE;IAMhC,kEAAkE;IAClE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIhC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI;IAOzC,uCAAuC;IACvC,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,IAAI;CAKb;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import type { ConditionEvaluator } from '@userflow-tech/core';
|
|
2
2
|
/**
|
|
3
3
|
* Evaluate ELEMENT client conditions against manual anchors, fiber-resolved
|
|
4
|
-
* `testID` / `nativeID` / `accessibilityLabel` targets, and AUTO
|
|
5
|
-
* selectors.
|
|
4
|
+
* `userflowId` / `testID` / `nativeID` / `accessibilityLabel` targets, and AUTO
|
|
5
|
+
* (codeless) selectors.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* just because the auto-anchor registry is empty. Web-interaction states
|
|
11
|
-
* (CLICK, DISABLED, …) still report unknown.
|
|
7
|
+
* PRESENT / NOT_PRESENT: any uniquely-or-not host on a visible navigator screen
|
|
8
|
+
* counts (web parity — duplicates are present). A measured 0×0 host counts as
|
|
9
|
+
* absent. AUTO `unknown` / `ambiguous` stay `null`.
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* ScrollView, opacity 0, etc.) would need async `measureInWindow` and is out
|
|
18
|
-
* of scope.
|
|
11
|
+
* CLICK / NOT_CLICK: latch from the first matching tap, including a tap on a
|
|
12
|
+
* descendant. The latch survives re-attach via `previousIsTrue` and is cleared
|
|
13
|
+
* when the server untracks. Disabled hosts are ignored. Until it latches, an
|
|
14
|
+
* AUTO selector that does not resolve reports `null`, like presence.
|
|
19
15
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* Element states are compared as string literals rather than protocol enums so
|
|
17
|
+
* the wire values stay obvious next to the branches. They match
|
|
18
|
+
* `FlowConditionElementState`.
|
|
23
19
|
*/
|
|
24
20
|
export declare function createElementConditionEvaluator(warn?: (message: string) => void): ConditionEvaluator;
|
|
25
21
|
//# sourceMappingURL=elementConditionEvaluator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elementConditionEvaluator.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/elementConditionEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"elementConditionEvaluator.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/elementConditionEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAmB7B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAK1B,GACA,kBAAkB,CA2BpB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pass-through tap observation for ELEMENT CLICK / NOT_CLICK conditions.
|
|
3
|
+
*
|
|
4
|
+
* Many conditions can subscribe at once. Touch start/end are paired per finger
|
|
5
|
+
* and a tap is emitted only when movement stays within the same slop the
|
|
6
|
+
* tooltip target-press monitor uses. The host fiber is the one captured at
|
|
7
|
+
* touch start, before the press's setState commits a new tree.
|
|
8
|
+
*
|
|
9
|
+
* With no subscribers the monitor stores nothing, so the bridge can skip the
|
|
10
|
+
* fiber lookup entirely.
|
|
11
|
+
*/
|
|
12
|
+
import type { AnyFiber } from './fiber/fiberInternals';
|
|
13
|
+
import { type TouchIdentifier } from './targetPressMonitor';
|
|
14
|
+
export interface ElementTap {
|
|
15
|
+
targetFiber: AnyFiber;
|
|
16
|
+
}
|
|
17
|
+
export type ElementTapListener = (tap: ElementTap) => void;
|
|
18
|
+
export declare class ElementTapMonitor {
|
|
19
|
+
private readonly listeners;
|
|
20
|
+
private readonly touchStarts;
|
|
21
|
+
get subscriberCount(): number;
|
|
22
|
+
subscribe(listener: ElementTapListener): () => void;
|
|
23
|
+
handleTouchStart(identifier: TouchIdentifier, pageX: number, pageY: number, targetFiber: AnyFiber | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* Emit a tap when this finger started and ended within slop on a resolved
|
|
26
|
+
* host. Never claims the responder.
|
|
27
|
+
*/
|
|
28
|
+
handleTouchEnd(identifier: TouchIdentifier, pageX: number, pageY: number): void;
|
|
29
|
+
/** Drop in-progress gesture(s). Omit `identifier` to clear every finger. */
|
|
30
|
+
cancelTouch(identifier?: TouchIdentifier): void;
|
|
31
|
+
/** Test helper. */
|
|
32
|
+
resetForTests(): void;
|
|
33
|
+
}
|
|
34
|
+
/** Shared singleton used by TargetPressBridge and the element-condition evaluator. */
|
|
35
|
+
export declare const elementTapMonitor: ElementTapMonitor;
|
|
36
|
+
//# sourceMappingURL=elementTapMonitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementTapMonitor.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/elementTapMonitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,eAAe,EAAkC,MAAM,sBAAsB,CAAC;AAE5F,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,QAAQ,CAAC;CACvB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;AAM3D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;IAEtE,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,SAAS,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAUnD,gBAAgB,CACd,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,QAAQ,GAAG,IAAI,GAC3B,IAAI;IAQP;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAkB/E,4EAA4E;IAC5E,WAAW,CAAC,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI;IAQ/C,mBAAmB;IACnB,aAAa,IAAI,IAAI;CAItB;AAED,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare a touch-start fiber with a host resolved later, tolerating the
|
|
3
|
+
* alternate swap a Pressable `pressed` re-render does mid-gesture.
|
|
4
|
+
*/
|
|
5
|
+
import type { ElementTap } from './elementTapMonitor';
|
|
6
|
+
import { type AnyFiber } from './fiber/fiberInternals';
|
|
7
|
+
/**
|
|
8
|
+
* Anchor ids on the tapped fiber and its ancestors, built once per tap and
|
|
9
|
+
* shared by every click condition it is delivered to.
|
|
10
|
+
*/
|
|
11
|
+
export declare function anchorIdsAboveTap(tap: ElementTap): ReadonlySet<string>;
|
|
12
|
+
export declare function sameFiber(a: AnyFiber, b: AnyFiber): boolean;
|
|
13
|
+
/** True when `node` is `host` or a descendant of it. */
|
|
14
|
+
export declare function fiberIsUnder(node: AnyFiber, host: AnyFiber): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True when the tapped fiber, the matched host, or a fiber between them is
|
|
17
|
+
* disabled. Browsers do not fire `click` on a disabled control.
|
|
18
|
+
*/
|
|
19
|
+
export declare function tapPathDisabled(tapped: AnyFiber, host: AnyFiber): boolean;
|
|
20
|
+
//# sourceMappingURL=elementTargetMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementTargetMatch.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/elementTargetMatch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,KAAK,QAAQ,EAMd,MAAM,wBAAwB,CAAC;AAKhC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAkBtE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAM3D;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAOpE;AAoBD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAQzE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type AnyFiber } from './fiberInternals';
|
|
2
|
-
export type AnchorPropTier = 'testID' | 'nativeID' | 'accessibilityLabel';
|
|
2
|
+
export type AnchorPropTier = 'userflowId' | 'testID' | 'nativeID' | 'accessibilityLabel';
|
|
3
|
+
/** Props an anchor id can sit on, strongest first. */
|
|
4
|
+
export declare const ANCHOR_PROP_TIERS: readonly AnchorPropTier[];
|
|
3
5
|
export type FindAnchorFiberResult = {
|
|
4
6
|
status: 'found';
|
|
5
7
|
fiber: AnyFiber;
|
|
@@ -10,21 +12,31 @@ export type FindAnchorFiberResult = {
|
|
|
10
12
|
} | {
|
|
11
13
|
status: 'missing';
|
|
12
14
|
};
|
|
15
|
+
/** Every collapsed host of the winning tier. Duplicates stay in the list. */
|
|
16
|
+
export type FindAnchorFibersResult = {
|
|
17
|
+
status: 'found';
|
|
18
|
+
fibers: AnyFiber[];
|
|
19
|
+
tier: AnchorPropTier;
|
|
20
|
+
} | {
|
|
21
|
+
status: 'missing';
|
|
22
|
+
};
|
|
13
23
|
/**
|
|
14
24
|
* Bounded DFS under `rootFiber` looking for fibers whose memoizedProps match
|
|
15
|
-
* `id` on testID, then nativeID, then accessibilityLabel.
|
|
16
|
-
* tier that has any match so a testID hit is never made
|
|
17
|
-
* unrelated accessibilityLabel.
|
|
25
|
+
* `id` on userflowId, then testID, then nativeID, then accessibilityLabel.
|
|
26
|
+
* Uses the highest tier that has any match so a testID hit is never made
|
|
27
|
+
* ambiguous by an unrelated accessibilityLabel.
|
|
18
28
|
*
|
|
19
29
|
* A composite match resolves to the host beneath it that carries the same id
|
|
20
30
|
* (e.g. a tab item that wraps its button in a View and forwards testID to the
|
|
21
31
|
* button), else to its shallowest host descendant. Multiple matches on a single
|
|
22
32
|
* root-to-leaf chain (e.g. Pressable forwarding testID to its inner View)
|
|
23
|
-
* collapse to the outermost host. Disjoint matches
|
|
33
|
+
* collapse to the outermost host. Disjoint matches stay in the list returned by
|
|
34
|
+
* {@link findAnchorFibers}; {@link findAnchorFiber} fails closed on those.
|
|
24
35
|
*
|
|
25
36
|
* The walk never follows `rootFiber.sibling` so the Userflow overlay (a sibling
|
|
26
37
|
* of {@link FiberScanRoot} in UserflowProvider) cannot self-match SDK testIDs.
|
|
27
38
|
*/
|
|
39
|
+
export declare function findAnchorFibers(rootFiber: AnyFiber, id: string): FindAnchorFibersResult;
|
|
28
40
|
export declare function findAnchorFiber(rootFiber: AnyFiber, id: string): FindAnchorFiberResult;
|
|
29
41
|
/**
|
|
30
42
|
* BFS under `fiber` for the shallowest host descendant. Returns `fiber` itself
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findAnchorFiber.d.ts","sourceRoot":"","sources":["../../../../../../src/anchors/fiber/findA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AAQ,GAAG,IAAI,CAkBxF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host fiber under a touch, resolved synchronously from the responder event.
|
|
3
|
+
*
|
|
4
|
+
* Feature-detected and never throws. A renderer that does not expose any of
|
|
5
|
+
* these pointers degrades to "no target", so a click condition simply does not
|
|
6
|
+
* latch.
|
|
7
|
+
*
|
|
8
|
+
* Order:
|
|
9
|
+
* 1. `event._targetInst` (React's fiber for the touched component)
|
|
10
|
+
* 2. `event.target` public instance via {@link lookupHostFiber}
|
|
11
|
+
* 3. The touch's native tag (`changedTouches[].target`, else `nativeEvent.target`)
|
|
12
|
+
* via the scan-root host index
|
|
13
|
+
*/
|
|
14
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
15
|
+
import { type AnyFiber } from './fiberInternals';
|
|
16
|
+
export declare function touchTargetFiber(event: GestureResponderEvent, identifier?: number | string): AnyFiber | null;
|
|
17
|
+
/**
|
|
18
|
+
* Fabric sends one touch event per touched view, and each lists every finger
|
|
19
|
+
* that changed. True when `identifier`'s finger is on this event's own view,
|
|
20
|
+
* so a caller can record each finger once, from its own event, instead of
|
|
21
|
+
* overwriting it from another finger's. Unreadable tags count as this event's.
|
|
22
|
+
*/
|
|
23
|
+
export declare function touchBelongsToEvent(event: GestureResponderEvent, identifier: number | string): boolean;
|
|
24
|
+
//# sourceMappingURL=touchTargetFiber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchTargetFiber.d.ts","sourceRoot":"","sources":["../../../../../../src/anchors/fiber/touchTargetFiber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EACL,KAAK,QAAQ,EAKd,MAAM,kBAAkB,CAAC;AAI1B,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,EAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAC3B,QAAQ,GAAG,IAAI,CAiBjB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,qBAAqB,EAC5B,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,CAST"}
|
|
@@ -23,7 +23,8 @@ export declare function invalidateFiberAnchor(id: string): void;
|
|
|
23
23
|
*
|
|
24
24
|
* Tier 0: {@link anchorRegistry} (`useUserflowAnchor`) — higher priority, fails
|
|
25
25
|
* closed on ambiguous registry keys.
|
|
26
|
-
* Tier 1+: fiber scan for `testID`, then `nativeID`, then
|
|
26
|
+
* Tier 1+: fiber scan for `userflowId`, then `testID`, then `nativeID`, then
|
|
27
|
+
* `accessibilityLabel`.
|
|
27
28
|
*
|
|
28
29
|
* Synchronous (the walk is pure JS; only measurement is async via the returned
|
|
29
30
|
* host). Caches the resolved fiber per id and revalidates cheaply before reuse.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAnchorHost.d.ts","sourceRoot":"","sources":["../../../../../src/anchors/resolveAnchorHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAevD,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;CAAE,GACvD;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAE1B,wEAAwE;AACxE,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEvE;AAED,0CAA0C;AAC1C,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MA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