@userflow-tech/react-native 0.1.0 → 0.1.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 +24 -14
- package/app.plugin.js +3 -0
- package/babel-plugin/index.d.ts +43 -0
- package/babel-plugin/index.d.ts.map +1 -0
- package/babel-plugin/index.js +854 -0
- package/babel-plugin/index.js.map +1 -0
- package/docs/deep-linking.md +2 -2
- package/docs/troubleshooting.md +2 -2
- package/expo-plugin/withUserflow.d.ts +17 -0
- package/expo-plugin/withUserflow.d.ts.map +1 -0
- package/expo-plugin/withUserflow.js +99 -0
- package/expo-plugin/withUserflow.js.map +1 -0
- package/lib/commonjs/anchors/AutoAnchorRegistry.js +1 -1
- package/lib/commonjs/anchors/autoAnchor.js +1 -1
- package/lib/commonjs/anchors/hintsCodec.js +1 -1
- package/lib/commonjs/pairing/diagnostics.js +2 -2
- package/lib/commonjs/pairing/diagnostics.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/anchors/AutoAnchorRegistry.js +1 -1
- package/lib/module/anchors/autoAnchor.js +1 -1
- package/lib/module/anchors/hintsCodec.js +1 -1
- package/lib/module/pairing/diagnostics.js +2 -2
- package/lib/module/pairing/diagnostics.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +1 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/autoAnchor.d.ts +1 -1
- package/lib/typescript/commonjs/src/anchors/hintsCodec.d.ts +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/autoAnchor.d.ts +1 -1
- package/lib/typescript/module/src/anchors/hintsCodec.d.ts +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +15 -7
- package/src/anchors/AutoAnchorRegistry.ts +1 -1
- package/src/anchors/autoAnchor.ts +1 -1
- package/src/anchors/hintsCodec.ts +1 -1
- package/src/pairing/diagnostics.ts +2 -2
- package/src/version.ts +1 -1
- package/vendor/core/LICENSE +76 -0
- package/vendor/core/README.md +9 -0
- package/vendor/core/dist/attributes.d.ts +16 -0
- package/vendor/core/dist/attributes.d.ts.map +1 -0
- package/vendor/core/dist/attributes.js +55 -0
- package/vendor/core/dist/attributes.js.map +1 -0
- package/vendor/core/dist/constants.d.ts +21 -0
- package/vendor/core/dist/constants.d.ts.map +1 -0
- package/vendor/core/dist/constants.js +21 -0
- package/vendor/core/dist/constants.js.map +1 -0
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts +68 -0
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/ClientConditionEngine.js +197 -0
- package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -0
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts +92 -0
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/FlowSessionEngine.js +310 -0
- package/vendor/core/dist/engine/FlowSessionEngine.js.map +1 -0
- package/vendor/core/dist/engine/PairingEngine.d.ts +92 -0
- package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/PairingEngine.js +302 -0
- package/vendor/core/dist/engine/PairingEngine.js.map +1 -0
- package/vendor/core/dist/engine/UserflowCore.d.ts +126 -0
- package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -0
- package/vendor/core/dist/engine/UserflowCore.js +266 -0
- package/vendor/core/dist/engine/UserflowCore.js.map +1 -0
- package/vendor/core/dist/engine/handleActions.d.ts +19 -0
- package/vendor/core/dist/engine/handleActions.d.ts.map +1 -0
- package/vendor/core/dist/engine/handleActions.js +71 -0
- package/vendor/core/dist/engine/handleActions.js.map +1 -0
- package/vendor/core/dist/engine/interpolateSessionData.d.ts +7 -0
- package/vendor/core/dist/engine/interpolateSessionData.d.ts.map +1 -0
- package/vendor/core/dist/engine/interpolateSessionData.js +29 -0
- package/vendor/core/dist/engine/interpolateSessionData.js.map +1 -0
- package/vendor/core/dist/errors.d.ts +9 -0
- package/vendor/core/dist/errors.d.ts.map +1 -0
- package/vendor/core/dist/errors.js +15 -0
- package/vendor/core/dist/errors.js.map +1 -0
- package/vendor/core/dist/eventAttributes.d.ts +7 -0
- package/vendor/core/dist/eventAttributes.d.ts.map +1 -0
- package/vendor/core/dist/eventAttributes.js +31 -0
- package/vendor/core/dist/eventAttributes.js.map +1 -0
- package/vendor/core/dist/index.d.ts +30 -0
- package/vendor/core/dist/index.d.ts.map +1 -0
- package/vendor/core/dist/index.js +21 -0
- package/vendor/core/dist/index.js.map +1 -0
- package/vendor/core/dist/transport/backoff.d.ts +11 -0
- package/vendor/core/dist/transport/backoff.d.ts.map +1 -0
- package/vendor/core/dist/transport/backoff.js +17 -0
- package/vendor/core/dist/transport/backoff.js.map +1 -0
- package/vendor/core/dist/transport/pairing.d.ts +121 -0
- package/vendor/core/dist/transport/pairing.d.ts.map +1 -0
- package/vendor/core/dist/transport/pairing.js +551 -0
- package/vendor/core/dist/transport/pairing.js.map +1 -0
- package/vendor/core/dist/transport/phoenix.d.ts +223 -0
- package/vendor/core/dist/transport/phoenix.d.ts.map +1 -0
- package/vendor/core/dist/transport/phoenix.js +757 -0
- package/vendor/core/dist/transport/phoenix.js.map +1 -0
- package/vendor/core/dist/transport/rateLimiter.d.ts +17 -0
- package/vendor/core/dist/transport/rateLimiter.d.ts.map +1 -0
- package/vendor/core/dist/transport/rateLimiter.js +30 -0
- package/vendor/core/dist/transport/rateLimiter.js.map +1 -0
- package/vendor/core/dist/transport/scheduler.d.ts +12 -0
- package/vendor/core/dist/transport/scheduler.d.ts.map +1 -0
- package/vendor/core/dist/transport/scheduler.js +11 -0
- package/vendor/core/dist/transport/scheduler.js.map +1 -0
- package/vendor/core/dist/types.d.ts +35 -0
- package/vendor/core/dist/types.d.ts.map +1 -0
- package/vendor/core/dist/types.js +2 -0
- package/vendor/core/dist/types.js.map +1 -0
- package/vendor/core/dist/version.d.ts +3 -0
- package/vendor/core/dist/version.d.ts.map +1 -0
- package/vendor/core/dist/version.js +3 -0
- package/vendor/core/dist/version.js.map +1 -0
- package/vendor/core/package.json +20 -0
- package/vendor/protocol/LICENSE +76 -0
- package/vendor/protocol/README.md +8 -0
- package/vendor/protocol/dist/autoData.d.ts +232 -0
- package/vendor/protocol/dist/autoData.d.ts.map +1 -0
- package/vendor/protocol/dist/autoData.js +78 -0
- package/vendor/protocol/dist/autoData.js.map +1 -0
- package/vendor/protocol/dist/events.d.ts +16 -0
- package/vendor/protocol/dist/events.d.ts.map +1 -0
- package/vendor/protocol/dist/events.js +8 -0
- package/vendor/protocol/dist/events.js.map +1 -0
- package/vendor/protocol/dist/flows.d.ts +298 -0
- package/vendor/protocol/dist/flows.d.ts.map +1 -0
- package/vendor/protocol/dist/flows.js +154 -0
- package/vendor/protocol/dist/flows.js.map +1 -0
- package/vendor/protocol/dist/index.d.ts +24 -0
- package/vendor/protocol/dist/index.d.ts.map +1 -0
- package/vendor/protocol/dist/index.js +16 -0
- package/vendor/protocol/dist/index.js.map +1 -0
- package/vendor/protocol/dist/messages.d.ts +166 -0
- package/vendor/protocol/dist/messages.d.ts.map +1 -0
- package/vendor/protocol/dist/messages.js +57 -0
- package/vendor/protocol/dist/messages.js.map +1 -0
- package/vendor/protocol/dist/pairing.d.ts +56 -0
- package/vendor/protocol/dist/pairing.d.ts.map +1 -0
- package/vendor/protocol/dist/pairing.js +146 -0
- package/vendor/protocol/dist/pairing.js.map +1 -0
- package/vendor/protocol/package.json +17 -0
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@ release for every content change.
|
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
12
|
-
| Peer dependency
|
|
12
|
+
| Peer / dependency | Required? | Why |
|
|
13
13
|
| ------------------------------------------- | --------- | ------------------------------------------------------------- |
|
|
14
14
|
| `react`, `react-native` | Yes | Host runtime. |
|
|
15
|
-
| `@react-native-async-storage/async-storage` | Yes
|
|
15
|
+
| `@react-native-async-storage/async-storage` | Yes (dep) | Persists the anonymous user id. Installed with this package. |
|
|
16
16
|
| `react-native-safe-area-context` | Optional | Correct insets for modal/tooltip surfaces. |
|
|
17
17
|
| `@react-navigation/native` | Optional | Screen tracking + NAVIGATE routing (React Navigation). |
|
|
18
18
|
| `expo-router` | Optional | Screen tracking + NAVIGATE routing (Expo Router). |
|
|
@@ -29,15 +29,28 @@ compatible with Expo Go.
|
|
|
29
29
|
|
|
30
30
|
## Install
|
|
31
31
|
|
|
32
|
+
Packages publish to the private `@userflow-tech` npm org. Create a **granular
|
|
33
|
+
access token** on npm (Read-only, limited to `@userflow-tech`) and put it in
|
|
34
|
+
the host app’s `.npmrc` via an env var — do not commit the token:
|
|
35
|
+
|
|
36
|
+
```ini
|
|
37
|
+
@userflow-tech:registry=https://registry.npmjs.org/
|
|
38
|
+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
39
|
+
```
|
|
40
|
+
|
|
32
41
|
```bash
|
|
33
|
-
# Expo (dev build)
|
|
34
|
-
npx expo install @userflow-tech/react-native
|
|
42
|
+
# Expo (dev build)
|
|
43
|
+
npx expo install @userflow-tech/react-native
|
|
35
44
|
|
|
36
45
|
# Bare React Native
|
|
37
|
-
npm install @userflow-tech/react-native
|
|
46
|
+
npm install @userflow-tech/react-native
|
|
38
47
|
cd ios && pod install
|
|
39
48
|
```
|
|
40
49
|
|
|
50
|
+
`@react-native-async-storage/async-storage` is a dependency of this package and
|
|
51
|
+
is installed automatically. If autolinking misses it, run
|
|
52
|
+
`npx expo install @react-native-async-storage/async-storage`.
|
|
53
|
+
|
|
41
54
|
Optional peers as needed:
|
|
42
55
|
|
|
43
56
|
```bash
|
|
@@ -45,11 +58,8 @@ npx expo install react-native-safe-area-context @react-native-community/netinfo
|
|
|
45
58
|
# and either expo-router or @react-navigation/native, depending on your router
|
|
46
59
|
```
|
|
47
60
|
|
|
48
|
-
For local tarball installs from this monorepo
|
|
49
|
-
|
|
50
|
-
tarballs together — a single `@userflow-tech/react-native` tarball alone will fail
|
|
51
|
-
because `@userflow-tech/core@0.1.0` is not on the public registry, and Expo hosts
|
|
52
|
-
need `@userflow-tech/expo` for scheme registration. Steps:
|
|
61
|
+
For local tarball installs from this monorepo, pack with `pnpm pack:all` at the
|
|
62
|
+
repo root and install the single `@userflow-tech/react-native` tarball. Steps:
|
|
53
63
|
`docs/local-testing.md` in the monorepo.
|
|
54
64
|
|
|
55
65
|
## Quick start
|
|
@@ -196,9 +206,9 @@ Full contract, prop priority, missing-target behavior, and duplicate-id rules:
|
|
|
196
206
|
To preview draft flows from the Userflow builder onto a device (QR / deep link):
|
|
197
207
|
|
|
198
208
|
1. Register the environment's **`scheme_id`** (e.g. `userflow-257587` — **not**
|
|
199
|
-
the env UUID) with the `@userflow-tech/
|
|
200
|
-
native** (`npx expo prebuild` / a new development client). Metro
|
|
201
|
-
not enough.
|
|
209
|
+
the env UUID) with the `@userflow-tech/react-native` config plugin, then
|
|
210
|
+
**rebuild native** (`npx expo prebuild` / a new development client). Metro
|
|
211
|
+
reload is not enough.
|
|
202
212
|
2. Call `Userflow.init` (optionally with `pairingEndpoint` / `serverEndpoint`
|
|
203
213
|
for staging or local stacks) and wrap the tree in `UserflowProvider`.
|
|
204
214
|
3. Open the builder Preview dialog → **Pair a device** → scan/open the QR. The
|
|
@@ -208,7 +218,7 @@ To preview draft flows from the Userflow builder onto a device (QR / deep link):
|
|
|
208
218
|
```json
|
|
209
219
|
{
|
|
210
220
|
"expo": {
|
|
211
|
-
"plugins": [["@userflow-tech/
|
|
221
|
+
"plugins": [["@userflow-tech/react-native", { "schemeId": "userflow-257587" }]]
|
|
212
222
|
}
|
|
213
223
|
}
|
|
214
224
|
```
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PluginObj, PluginPass, types as BabelTypes } from '@babel/core';
|
|
2
|
+
export interface UserflowBabelPluginOptions {
|
|
3
|
+
rootDir?: string;
|
|
4
|
+
allowlist?: string[];
|
|
5
|
+
injectUfidProp?: boolean;
|
|
6
|
+
exclude?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* When true (the default), only stamp `nativeID` (and `collapsable={false}`
|
|
9
|
+
* when needed). Skips the SDK import, `__ufRef` helper, ref wrapping, hints,
|
|
10
|
+
* and scope capture. Use this against the current official SDK, which
|
|
11
|
+
* resolves anchors via fiber `nativeID` matching and does not yet export
|
|
12
|
+
* `__userflowAutoAnchor`.
|
|
13
|
+
*
|
|
14
|
+
* Set to `false` only when the host SDK provides `__userflowAutoAnchor`
|
|
15
|
+
* (full auto-register mode). Enabling full mode without that export will
|
|
16
|
+
* inject a broken import into every stamped module.
|
|
17
|
+
*/
|
|
18
|
+
stampOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface PluginState extends PluginPass {
|
|
21
|
+
ufStamped?: boolean;
|
|
22
|
+
ufCallSiteCounters?: Map<string, Map<string, number>>;
|
|
23
|
+
/**
|
|
24
|
+
* Parent-scoped ordinals precomputed against the pristine JSX tree, keyed by
|
|
25
|
+
* opening-element node. Populated in `Program.enter` before `@babel/preset-react`
|
|
26
|
+
* rewrites `<El>` into `_jsx(El, …)` — otherwise earlier same-type siblings are
|
|
27
|
+
* already gone by the time we visit a later one and every element mis-reads as
|
|
28
|
+
* `#0`, colliding their `uf_<hash>` ids.
|
|
29
|
+
*/
|
|
30
|
+
ufOrdinals?: WeakMap<BabelTypes.Node, {
|
|
31
|
+
ordinal: number;
|
|
32
|
+
siblingIndex: number;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export default function userflowAutoStamp(api: {
|
|
36
|
+
types: typeof BabelTypes;
|
|
37
|
+
template: {
|
|
38
|
+
statement: (tpl: string) => (replacements?: Record<string, unknown>) => BabelTypes.Statement;
|
|
39
|
+
};
|
|
40
|
+
env?: (name?: string) => boolean;
|
|
41
|
+
}): PluginObj<PluginState>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,SAAS,EAAE,UAAU,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AAyiBxF,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,WAAY,SAAQ,UAAU;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClF;AA8GD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,GAAG,EAAE;IAC7C,KAAK,EAAE,OAAO,UAAU,CAAC;IACzB,QAAQ,EAAE;QACR,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,UAAU,CAAC,SAAS,CAAC;KAC9F,CAAC;IACF,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CAClC,GAAG,SAAS,CAAC,WAAW,CAAC,CA+TzB"}
|