@userflow-tech/react-native 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +81 -22
  2. package/docs/troubleshooting.md +28 -26
  3. package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js +10 -16
  4. package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js.map +1 -1
  5. package/lib/commonjs/version.js +1 -1
  6. package/lib/module/surfaces/bannerWebView/resolveCdnHost.js +10 -16
  7. package/lib/module/surfaces/bannerWebView/resolveCdnHost.js.map +1 -1
  8. package/lib/module/version.js +1 -1
  9. package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts +4 -2
  10. package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -1
  11. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  12. package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts +4 -2
  13. package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -1
  14. package/lib/typescript/module/src/version.d.ts +1 -1
  15. package/package.json +1 -1
  16. package/src/surfaces/bannerWebView/resolveCdnHost.ts +14 -16
  17. package/src/version.ts +1 -1
  18. package/vendor/core/dist/constants.d.ts +6 -3
  19. package/vendor/core/dist/constants.d.ts.map +1 -1
  20. package/vendor/core/dist/constants.js +6 -3
  21. package/vendor/core/dist/constants.js.map +1 -1
  22. package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -1
  23. package/vendor/core/dist/engine/UserflowCore.js +4 -18
  24. package/vendor/core/dist/engine/UserflowCore.js.map +1 -1
  25. package/vendor/core/dist/index.d.ts +1 -0
  26. package/vendor/core/dist/index.d.ts.map +1 -1
  27. package/vendor/core/dist/index.js +1 -0
  28. package/vendor/core/dist/index.js.map +1 -1
  29. package/vendor/core/dist/serverEndpoint.d.ts +7 -0
  30. package/vendor/core/dist/serverEndpoint.d.ts.map +1 -0
  31. package/vendor/core/dist/serverEndpoint.js +15 -0
  32. package/vendor/core/dist/serverEndpoint.js.map +1 -0
  33. package/vendor/core/dist/types.d.ts +3 -2
  34. package/vendor/core/dist/types.d.ts.map +1 -1
  35. package/vendor/core/dist/version.d.ts +1 -1
  36. package/vendor/core/dist/version.js +1 -1
  37. package/vendor/core/package.json +1 -1
  38. package/vendor/protocol/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,17 @@
1
- # `@userflow-tech/react-native`
1
+ # Userflow React Native SDK
2
2
 
3
- Official Userflow SDK for React Native and Expo. Deliver guided flows, tooltips,
4
- modals, and banners authored in the Userflow dashboard — without shipping a new
5
- app release for every content change.
3
+ > ⚠️ This SDK is under active development and evolving quickly.
6
4
 
7
- > Early development. APIs may change.
5
+ Release notes are tracked in the [Userflow React Native SDK Guide](https://app.notion.com/p/Userflow-React-Native-SDK-Guide-3fba9809ce89800682c3ea9078b0f210?source=copy_link).
6
+
7
+ `@userflow-tech/react-native` is the official Userflow SDK for React Native and
8
+ Expo. Deliver guided flows, tooltips, modals, and banners authored in the
9
+ Userflow dashboard — without shipping a new app release for every content
10
+ change.
11
+
12
+ The SDK connects to the Userflow backend using the same protocol as
13
+ userflow.js, so flows built in the Userflow dashboard work across web and
14
+ mobile from a single place.
8
15
 
9
16
  ## Requirements
10
17
 
@@ -12,7 +19,9 @@ Declared minimums: React `>=18.2.0`, React Native `>=0.76.0`. React Native
12
19
  0.74 and 0.75 cannot install this SDK: `react-native-view-shot` 5.x, which
13
20
  Builder element selection needs, requires React Native 0.76 or later. The SDK
14
21
  is tested on React Native 0.81 / React 19.1 and on Expo SDK 57 / React Native
15
- 0.86. Expo Go is not supported.
22
+ 0.86. Expo SDK 58 is not supported yet: it bundles `react-native-webview` 14
23
+ and `react-native-view-shot` 6, which are outside the peer ranges below. Expo
24
+ Go is not supported.
16
25
 
17
26
  `@react-native-async-storage/async-storage` is the only native module this
18
27
  package depends on, so npm installs it. `react-native-webview` and
@@ -70,15 +79,22 @@ needed with any package manager.
70
79
  npx expo install @userflow-tech/react-native @react-native-async-storage/async-storage react-native-webview react-native-view-shot@^5.0.0
71
80
 
72
81
  # Bare React Native
73
- npm install @userflow-tech/react-native @react-native-async-storage/async-storage react-native-device-info react-native-webview react-native-view-shot@^5.0.0
82
+ npm install @userflow-tech/react-native '@react-native-async-storage/async-storage@^2' 'react-native-device-info@<16' 'react-native-webview@>=13.8.0 <14' 'react-native-view-shot@^5.0.0'
74
83
  cd ios && pod install
75
84
  ```
76
85
 
86
+ Keep the version ranges in the bare command. Unpinned, npm picks the latest
87
+ majors. `react-native-webview` 14 is outside the peer range, and npm only warns
88
+ `ERESOLVE overriding peer dependency` and installs it anyway. AsyncStorage 3
89
+ sits next to the SDK's own 2.x copy, which leaves two copies of one native
90
+ module. `npx expo install` picks Expo's bundled versions, which fit the ranges
91
+ on Expo SDK 53–57.
92
+
77
93
  `react-native-webview` and `react-native-view-shot` (`^5.0.0`) are **required
78
94
  peers**. npm 7+ and pnpm install them. Yarn 1 and
79
95
  `npm install --legacy-peer-deps` do not, so the commands above install them in
80
96
  the app. Both are native modules — rebuild after install (a Metro reload is not
81
- enough). On Expo SDK 54,
97
+ enough). On Expo SDK 55 and older,
82
98
  unpinned `npx expo install react-native-view-shot` resolves **4.0.3**, which
83
99
  does not satisfy the peer. Pin `^5.0.0` as in the command above. If the app
84
100
  already depends on 4.0.3, that same command is what fixes it: installing the
@@ -112,6 +128,9 @@ Optional peers as needed:
112
128
  ```bash
113
129
  npx expo install react-native-safe-area-context @react-native-community/netinfo expo-secure-store
114
130
  # and either expo-router or @react-navigation/native, depending on your router
131
+
132
+ # Bare React Native
133
+ npm install 'react-native-safe-area-context@<6' '@react-native-community/netinfo@<13'
115
134
  ```
116
135
 
117
136
  ### Install with an AI agent
@@ -146,12 +165,13 @@ the app to change those.
146
165
 
147
166
  ### `init` options
148
167
 
149
- | Option | Default | Description |
150
- | ------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------ |
151
- | `clientToken` | — | **Required.** The `ct_…` client token from Settings → Environments. |
152
- | `onNavigate` | — | Handler for flow NAVIGATE actions. Wins over React Navigation, Expo Router, and Linking. See NAVIGATE below. |
153
- | `appVersion` | Read from the native app | Override the host app version sent as `app_version`. |
154
- | `appBuild` | Read from the native app | Build number sent as `app_build`, paired with `appVersion`. |
168
+ | Option | Default | Description |
169
+ | ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
170
+ | `clientToken` | — | **Required.** The `ct_…` client token from Settings → Environments. |
171
+ | `serverEndpoint` | Picked from the client token | Optional. The region is picked automatically from the client token; only set this for a proxy or a non-production stack. |
172
+ | `onNavigate` | — | Handler for flow NAVIGATE actions. Wins over React Navigation, Expo Router, and Linking. See NAVIGATE below. |
173
+ | `appVersion` | Read from the native app | Override the host app version sent as `app_version`. |
174
+ | `appBuild` | Read from the native app | Build number sent as `app_build`, paired with `appVersion`. |
155
175
 
156
176
  ### Where to put `init`, `identify`, and `UserflowProvider`
157
177
 
@@ -399,6 +419,12 @@ To preview draft flows from the Userflow builder onto a device (QR / deep link):
399
419
  }
400
420
  ```
401
421
 
422
+ `schemeId` is the env's `scheme_id` from the dashboard, copied exactly. It is
423
+ `userflow-` followed by an opaque id. Do not rely on its shape. Preview links
424
+ (`…://?token=…`) and pairing links (`…://?pairing_token=…`) both ride that one
425
+ scheme. Expo Router needs no extra host files for these root-form URLs, and
426
+ pairing works in every build, including release.
427
+
402
428
  Deep-link / pairing helpers:
403
429
 
404
430
  | Member | Description |
@@ -414,7 +440,20 @@ Full scheme registration, Linking ownership, and verify commands:
414
440
 
415
441
  ## Connection resilience
416
442
 
417
- Recovery from a dropped or silently-dead socket works out of the box:
443
+ After `Userflow.init`, the SDK suspends the socket when the app leaves the
444
+ foreground (after a short grace window) and resumes on return:
445
+
446
+ | Away duration | Behavior |
447
+ | --------------------- | ---------------------------------------------------- |
448
+ | &lt; 3 seconds | No suspend/resume (transient blur / quick switch) |
449
+ | 3 seconds – 5 minutes | Reconnect and **keep** the mid-flow session |
450
+ | ≥ 5 minutes | **Clear** the local mid-flow session, then reconnect |
451
+
452
+ Foreground idle for 5 minutes also suspends (skipped while any mid-flow session
453
+ is active).
454
+
455
+ Recovery from a dropped or silently-dead socket works out of the box, with no
456
+ extra dependencies or host setup:
418
457
 
419
458
  1. Reconnect ladder on socket `close` / `error`
420
459
  2. Adaptive heartbeat with a short reply deadline
@@ -516,16 +555,38 @@ These guides also ship in the package, under
516
555
  | [docs/identity-verification.md](https://unpkg.com/@userflow-tech/react-native/docs/identity-verification.md) | HMAC signature on your backend |
517
556
  | [docs/troubleshooting.md](https://unpkg.com/@userflow-tech/react-native/docs/troubleshooting.md) | Symptom → cause for common integration failures |
518
557
 
519
- ## Experimental
558
+ ## Current status
559
+
560
+ ### Shipped
561
+
562
+ - Flow rendering — tooltips and modals
563
+ - Manual element targeting (`userflowId` / `testID` / `nativeID`, or `useUserflowAnchor`)
564
+ - Screen tracking — Expo Router (`UserflowExpoRouterScreenTracker`) and React
565
+ Navigation (`WithUserflowReactNavigation`); must be mounted by the host
566
+ - User & group attributes (`identify`, `identifyAnonymous`, `group`) and custom events (`track`)
567
+ - Embed banners (overlay and inline `EmbedBannerPlaceholder`)
568
+ - Client conditions — `ELEMENT` PRESENT / NOT_PRESENT on manual anchors and
569
+ AUTO selectors (guarded: weak evidence stays unknown)
570
+ - Connection lifecycle — suspend/resume, reconnect, optional NetInfo
571
+
572
+ ### Experimental
520
573
 
521
574
  - AUTO / codeless element targeting (exact-id fast path + scored matcher;
522
575
  scored path needs Babel full mode to populate the auto-anchor registry).
523
576
  See [docs/anchoring.md](https://unpkg.com/@userflow-tech/react-native/docs/anchoring.md).
524
- - Build-time stamping with `@userflow-tech/react-native/babel-plugin`. Jest
577
+ - Build-time stamping with `@userflow-tech/react-native/babel-plugin`
578
+ (`stampOnly: true` stamps `nativeID` only; full mode is the default). Jest
525
579
  runs the plugin too, which changes snapshots. Read
526
580
  [Babel plugin and snapshot tests](#babel-plugin-and-snapshot-tests) before
527
581
  enabling it.
528
582
 
583
+ ### Not available yet
584
+
585
+ - `INPUT_VALUE` / `FILLED_IN_INPUT` client conditions
586
+
587
+ Flows gated on unsupported client conditions stay unknown and **never start**.
588
+ See [docs/troubleshooting.md](https://unpkg.com/@userflow-tech/react-native/docs/troubleshooting.md).
589
+
529
590
  ## Install diagnostics
530
591
 
531
592
  In development, the first `Userflow.init` checks native module registration and
@@ -667,9 +728,7 @@ instead. Snapshots then gain only `nativeID` and `collapsable`, and stamped file
667
728
  skip the SDK import. The plugin's `exclude` option does not help here: it skips
668
729
  the files it lists, not the components a test renders.
669
730
 
670
- ## What is not available yet
671
-
672
- - `INPUT_VALUE` / `FILLED_IN_INPUT` client conditions
731
+ ## Related
673
732
 
674
- Flows gated on unsupported client conditions stay unknown and **never start**.
675
- See [docs/troubleshooting.md](https://unpkg.com/@userflow-tech/react-native/docs/troubleshooting.md).
733
+ - [Userflow](https://userflow.com)
734
+ - [userflow.js](https://github.com/userflow/userflow.js) — Web SDK
@@ -5,31 +5,32 @@ Messages are quoted exactly so you can search logs for them.
5
5
 
6
6
  ## Install
7
7
 
8
- | Symptom / log message | Likely cause | Fix |
9
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
- | `expo doctor` reports `react-native-view-shot` | The app pins `^5.0.0` and Expo SDK 54's expected version is 4.0.3. | Keep the pin. Add `"react-native-view-shot"` to `expo.install.exclude`. |
11
- | `Unable to resolve module` for an optional peer (`netinfo`, `expo-secure-store`, `expo-router`, safe-area, navigation) | A custom Metro config does not extend `getDefaultConfig`, so `allowOptionalDependencies` is off. | Extend `getDefaultConfig` from `expo/metro-config` or `@react-native/metro-config`. |
12
- | `ERESOLVE` while installing `@userflow-tech/react-native` | The app already has a version outside a peer range: view-shot 4.0.3 (what unpinned `npx expo install` installs on Expo SDK 54), NetInfo 9.x, safe-area-context 3.x, WebView 13.6.x or 14.x, or React Native older than 0.76. | Move that package into the range in the package README. For view-shot, npm prints `Found: react-native-view-shot@4.0.3` and `peer react-native-view-shot@"^5.0.0" from @userflow-tech/react-native`. Install the SDK and `react-native-view-shot@^5.0.0` in one command, then add `"react-native-view-shot"` to `expo.install.exclude` on Expo SDK 54. Do not retry with `--force` or `--legacy-peer-deps`; that leaves 4.0.3 installed. Raise React Native to 0.76 or later when that is the conflict. |
13
- | Yarn 1 or `npm install --legacy-peer-deps` succeeded, but `react-native-webview` or `react-native-view-shot` is not installed | Those installs do not fetch peers. WebView and view-shot are required peers, not dependencies. | Install `react-native-webview` and `react-native-view-shot@^5.0.0` in the app, then rebuild native. |
14
- | Banners, flow cards, or Builder bars draw under the status bar, notch, or home indicator. Development logs `[Userflow] react-native-safe-area-context is not installed, so banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | `react-native-safe-area-context` is not installed, so insets are zero. | Install the package and wrap the tree in `<SafeAreaProvider>`. |
15
- | `Uncaught Error` / `NativeModule.RNCNetInfo is null` as soon as `Userflow.init` runs | On SDK 0.3.1 and earlier, NetInfo's JavaScript was loaded while its native module was not in the binary. Debug builds show a red screen. Dismissing it leaves the app running; a release build can crash. | Link `@react-native-community/netinfo` and rebuild, or remove it. Current versions skip NetInfo when `RNCNetInfo` is not registered and log one dev warning instead. |
16
- | `[@userflow-tech/react-native] schemeId "…" looks like an environment id. Pass the scheme_id value that starts with userflow- (an opaque id from the dashboard), not the environment UUID.` | The config plugin received the environment UUID. | Pass the `scheme_id` (`userflow-…`) from the dashboard. |
17
- | `No schemeId was passed, so the plugin left the native config unchanged. Builder preview and pairing links will not open this app. Pass the environment scheme_id (userflow-...) from the Userflow dashboard as the plugin schemeId.` | `expo prebuild` ran the plugin without `schemeId`. | Add `{ "schemeId": "userflow-…" }` and rebuild native. |
18
- | react-native-view-shot is not a direct dependency. Builder element selection needs >=5.0.0. On Expo SDK 54, an unpinned `npx expo install react-native-view-shot` resolves 4.0.3. Pin ^5.0.0. If expo doctor reports a version mismatch, add "react-native-view-shot" to expo.install.exclude. | Prebuild did not find view-shot in the app `package.json`. | `npx expo install react-native-view-shot@^5.0.0` and rebuild. |
19
- | `react-native-safe-area-context is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Without the native module, banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it in the app (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | Expo SDK older than 54, and safe-area-context is not a direct dependency, so its native module is not autolinked. | `npx expo install react-native-safe-area-context` and wrap the tree in `<SafeAreaProvider>`. |
20
- | `[Userflow] react-native-view-shot@4.0.3 is older than 5.0.0, so Builder element selection may not get a screenshot.` The installed version is filled in. The warning also says not to retry with `--force` or `--legacy-peer-deps`. | view-shot 4.x is installed, usually because an `ERESOLVE` was retried with `--force` or `--legacy-peer-deps`, or Expo SDK 54's default 4.0.3 was left in place. | Install `react-native-view-shot@^5.0.0` in the same command as the SDK and rebuild. On Expo SDK 54, add `"react-native-view-shot"` to `expo.install.exclude`. |
21
- | `react-native-view-shot@4.0.3 is older than 5.0.0. Expo SDK 54's default is 4.0.3, which does not work with this SDK. Pin ^5.0.0 and add "react-native-view-shot" to expo.install.exclude if expo doctor complains.` | The app has view-shot 4.x. | Pin `^5.0.0` and rebuild. |
22
- | `@react-native-async-storage/async-storage is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Install it in the app (npx expo install @react-native-async-storage/async-storage) and rebuild.` | Expo SDK older than 54, and AsyncStorage is only a transitive dependency. The WebView line is the same shape with `react-native-webview`. | Install that package in the app and rebuild. |
23
- | `[Userflow] Native setup is incomplete. Flows may not run until you fix the following, then rebuild the app (a Metro reload is not enough):` | Dev-only check on the first `Userflow.init`. Following lines name each missing native module. A missing safe-area package is a separate warning, because flows still run. | Install the named packages and rebuild. The footer is `See node_modules/@userflow-tech/react-native/docs/troubleshooting.md.` |
24
- | `- @react-native-async-storage/async-storage is not linked. Anonymous users and Builder pairing will not persist. Add it to the app package.json (npx expo install @react-native-async-storage/async-storage), run pod install on iOS, and rebuild.` | AsyncStorage's native module is not in this binary. | Add it to the app `package.json`, run `pod install` on iOS, and rebuild. |
25
- | `- react-native-view-shot is not linked, so Builder element selection gets no screenshot. Install react-native-view-shot@^5.0.0 and rebuild. On Expo SDK 54, pin ^5.0.0; an unpinned npx expo install resolves 4.0.3.` | `RNViewShot` is not registered. | Install `react-native-view-shot@^5.0.0` and rebuild. |
26
- | `- react-native-webview is not linked. Evaluate JavaScript and WebView banners will not run. Install it (npx expo install react-native-webview) and rebuild.` | The WebView native module is not registered. | Install `react-native-webview` and rebuild. |
27
- | `- react-native-device-info is not linked, so app_version and app_build are not sent. npm install react-native-device-info, then rebuild.` | Bare React Native, and `RNDeviceInfo` is not registered. Expo apps that have `expo-constants` do not log this line. | `npm install react-native-device-info` and rebuild. |
28
- | `[Userflow] This app is running in Expo Go, which cannot load the SDK native modules. Builder preview links will not open the app. Use a development build (npx expo run:ios / npx expo run:android).` | The app is the Expo Go store client. | Use a development build. |
29
- | `[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.` | `UserflowProvider` has no `SafeAreaProvider` ancestor. The app does not crash. Cards use `initialWindowMetrics`, or zero insets when those are unavailable. | Wrap the tree in `SafeAreaProvider`. |
30
- | `Userflow.identifyAnonymous() needs @react-native-async-storage/async-storage, which is not linked in this native build. Add it to your app's package.json, run pod install, and rebuild.` | `identifyAnonymous()` ran without a linked AsyncStorage native module. | Install and rebuild, then call it again. |
31
- | `clientToken is an environment secret key (esk_...). That key must never ship in the app. Pass the client token (ct_...) from Settings → Environments instead.` | `init` was given an `esk_` secret key. | Pass the `ct_…` client token. |
32
- | `[Userflow] Userflow.init() already ran with different options. The new clientToken, serverEndpoint, and pairingEndpoint are ignored because init runs once per process. Userflow.reset() does not apply new credentials. Restart the app to change them.` | A later `init` passed a different token or endpoint while a previous `init` is in flight or has succeeded. | Restart the app after a successful init. `reset()` clears the user and does not apply new credentials. If the previous `init` rejected, call `init` again with the corrected token or endpoint. |
8
+ | Symptom / log message | Likely cause | Fix |
9
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | `expo doctor` reports `react-native-view-shot` | The app pins `^5.0.0` and Expo SDK 55 and older expect 4.0.3. | Keep the pin. Add `"react-native-view-shot"` to `expo.install.exclude`. |
11
+ | `Unable to resolve module` for an optional peer (`netinfo`, `expo-secure-store`, `expo-router`, safe-area, navigation) | A custom Metro config does not extend `getDefaultConfig`, so `allowOptionalDependencies` is off. | Extend `getDefaultConfig` from `expo/metro-config` or `@react-native/metro-config`. |
12
+ | `ERESOLVE` while installing `@userflow-tech/react-native` | The app already has a version outside a peer range: view-shot 4.0.3 (what unpinned `npx expo install` installs on Expo SDK 55 and older), NetInfo 9.x, safe-area-context 3.x, WebView 13.6.x or 14.x, or React Native older than 0.76. | Move that package into the range in the package README. For view-shot, npm prints `Found: react-native-view-shot@4.0.3` and `peer react-native-view-shot@"^5.0.0" from @userflow-tech/react-native`. Install the SDK and `react-native-view-shot@^5.0.0` in one command, then add `"react-native-view-shot"` to `expo.install.exclude` on Expo SDK 55 and older. Do not retry with `--force` or `--legacy-peer-deps`; that leaves 4.0.3 installed. Raise React Native to 0.76 or later when that is the conflict. |
13
+ | `npm warn ERESOLVE overriding peer dependency` naming `react-native-webview`, or `npm ls` lists two versions of `@react-native-async-storage/async-storage` | An unpinned bare install picked WebView 14 (outside `>=13.8.0 <14`) or AsyncStorage 3 (the SDK keeps its own 2.x copy). npm only warns and installs the invalid tree. | Reinstall with the ranges from the bare command in the package README: `'@react-native-async-storage/async-storage@^2'` and `'react-native-webview@>=13.8.0 <14'`. Then run `pod install` and rebuild. |
14
+ | Yarn 1 or `npm install --legacy-peer-deps` succeeded, but `react-native-webview` or `react-native-view-shot` is not installed | Those installs do not fetch peers. WebView and view-shot are required peers, not dependencies. | Install `react-native-webview` and `react-native-view-shot@^5.0.0` in the app, then rebuild native. |
15
+ | Banners, flow cards, or Builder bars draw under the status bar, notch, or home indicator. Development logs `[Userflow] react-native-safe-area-context is not installed, so banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | `react-native-safe-area-context` is not installed, so insets are zero. | Install the package and wrap the tree in `<SafeAreaProvider>`. |
16
+ | `Uncaught Error` / `NativeModule.RNCNetInfo is null` as soon as `Userflow.init` runs | On SDK 0.3.1 and earlier, NetInfo's JavaScript was loaded while its native module was not in the binary. Debug builds show a red screen. Dismissing it leaves the app running; a release build can crash. | Link `@react-native-community/netinfo` and rebuild, or remove it. Current versions skip NetInfo when `RNCNetInfo` is not registered and log one dev warning instead. |
17
+ | `[@userflow-tech/react-native] schemeId "…" looks like an environment id. Pass the scheme_id value that starts with userflow- (an opaque id from the dashboard), not the environment UUID.` | The config plugin received the environment UUID. | Pass the `scheme_id` (`userflow-…`) from the dashboard. |
18
+ | `No schemeId was passed, so the plugin left the native config unchanged. Builder preview and pairing links will not open this app. Pass the environment scheme_id (userflow-...) from the Userflow dashboard as the plugin schemeId.` | `expo prebuild` ran the plugin without `schemeId`. | Add `{ "schemeId": "userflow-…" }` and rebuild native. |
19
+ | react-native-view-shot is not a direct dependency. Builder element selection needs >=5.0.0. On Expo SDK 54, an unpinned `npx expo install react-native-view-shot` resolves 4.0.3. Pin ^5.0.0. If expo doctor reports a version mismatch, add "react-native-view-shot" to expo.install.exclude. | Prebuild did not find view-shot in the app `package.json`. | `npx expo install react-native-view-shot@^5.0.0` and rebuild. |
20
+ | `react-native-safe-area-context is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Without the native module, banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it in the app (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | Expo SDK older than 54, and safe-area-context is not a direct dependency, so its native module is not autolinked. | `npx expo install react-native-safe-area-context` and wrap the tree in `<SafeAreaProvider>`. |
21
+ | `[Userflow] react-native-view-shot@4.0.3 is older than 5.0.0, so Builder element selection may not get a screenshot.` The installed version is filled in. The warning also says not to retry with `--force` or `--legacy-peer-deps`. | view-shot 4.x is installed, usually because an `ERESOLVE` was retried with `--force` or `--legacy-peer-deps`, or the 4.0.3 default on Expo SDK 55 and older was left in place. | Install `react-native-view-shot@^5.0.0` in the same command as the SDK and rebuild. On Expo SDK 55 and older, add `"react-native-view-shot"` to `expo.install.exclude`. |
22
+ | `react-native-view-shot@4.0.3 is older than 5.0.0. Expo SDK 54's default is 4.0.3, which does not work with this SDK. Pin ^5.0.0 and add "react-native-view-shot" to expo.install.exclude if expo doctor complains.` | The app has view-shot 4.x. | Pin `^5.0.0` and rebuild. |
23
+ | `@react-native-async-storage/async-storage is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Install it in the app (npx expo install @react-native-async-storage/async-storage) and rebuild.` | Expo SDK older than 54, and AsyncStorage is only a transitive dependency. The WebView line is the same shape with `react-native-webview`. | Install that package in the app and rebuild. |
24
+ | `[Userflow] Native setup is incomplete. Flows may not run until you fix the following, then rebuild the app (a Metro reload is not enough):` | Dev-only check on the first `Userflow.init`. Following lines name each missing native module. A missing safe-area package is a separate warning, because flows still run. | Install the named packages and rebuild. The footer is `See node_modules/@userflow-tech/react-native/docs/troubleshooting.md.` |
25
+ | `- @react-native-async-storage/async-storage is not linked. Anonymous users and Builder pairing will not persist. Add it to the app package.json (npx expo install @react-native-async-storage/async-storage), run pod install on iOS, and rebuild.` | AsyncStorage's native module is not in this binary. | Add it to the app `package.json`, run `pod install` on iOS, and rebuild. |
26
+ | `- react-native-view-shot is not linked, so Builder element selection gets no screenshot. Install react-native-view-shot@^5.0.0 and rebuild. On Expo SDK 54, pin ^5.0.0; an unpinned npx expo install resolves 4.0.3.` | `RNViewShot` is not registered. | Install `react-native-view-shot@^5.0.0` and rebuild. |
27
+ | `- react-native-webview is not linked. Evaluate JavaScript and WebView banners will not run. Install it (npx expo install react-native-webview) and rebuild.` | The WebView native module is not registered. | Install `react-native-webview` and rebuild. |
28
+ | `- react-native-device-info is not linked, so app_version and app_build are not sent. npm install react-native-device-info, then rebuild.` | Bare React Native, and `RNDeviceInfo` is not registered. Expo apps that have `expo-constants` do not log this line. | `npm install react-native-device-info` and rebuild. |
29
+ | `[Userflow] This app is running in Expo Go, which cannot load the SDK native modules. Builder preview links will not open the app. Use a development build (npx expo run:ios / npx expo run:android).` | The app is the Expo Go store client. | Use a development build. |
30
+ | `[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.` | `UserflowProvider` has no `SafeAreaProvider` ancestor. The app does not crash. Cards use `initialWindowMetrics`, or zero insets when those are unavailable. | Wrap the tree in `SafeAreaProvider`. |
31
+ | `Userflow.identifyAnonymous() needs @react-native-async-storage/async-storage, which is not linked in this native build. Add it to your app's package.json, run pod install, and rebuild.` | `identifyAnonymous()` ran without a linked AsyncStorage native module. | Install and rebuild, then call it again. |
32
+ | `clientToken is an environment secret key (esk_...). That key must never ship in the app. Pass the client token (ct_...) from Settings → Environments instead.` | `init` was given an `esk_` secret key. | Pass the `ct_…` client token. |
33
+ | `[Userflow] Userflow.init() already ran with different options. The new clientToken, serverEndpoint, and pairingEndpoint are ignored because init runs once per process. Userflow.reset() does not apply new credentials. Restart the app to change them.` | A later `init` passed a different token or endpoint while a previous `init` is in flight or has succeeded. | Restart the app after a successful init. `reset()` clears the user and does not apply new credentials. If the previous `init` rejected, call `init` again with the corrected token or endpoint. |
33
34
 
34
35
  ## Init / identify / group
35
36
 
@@ -43,6 +44,7 @@ Messages are quoted exactly so you can search logs for them.
43
44
  | `Call Userflow.group() before updateGroup()` | `updateGroup` or a group-scoped button attribute before `group()` | Call `Userflow.group(...)` first |
44
45
  | `Missing clientToken` | Empty / whitespace token | Pass the `ct_...` value from the dashboard |
45
46
  | `… invalid_client_token: Invalid Userflow.js Token: …` | Wrong token or deactivated env | Copy the token from the matching environment. |
47
+ | `… region_mismatch: This token was provisioned in the EU region but is being used in the US region…` | `serverEndpoint` points at a host in a different region than the environment | Remove `serverEndpoint` so the SDK picks the host from the client token, or point it at the environment's region. |
46
48
  | `… user_signature_required: …` | Env requires identity verification; no `signature` | Compute HMAC on your backend — [identity-verification.md](identity-verification.md) |
47
49
  | `… incorrect_user_signature: …` | Signature does not match HMAC-SHA256(secret, userId) | Sign the **same** id string; use `esk_...`, not `ct_...` |
48
50
  | `… group_signature_required` / `incorrect_group_signature` | Same rules for `group()` | Sign the group id with the env secret key |
@@ -123,7 +125,7 @@ Full setup: [deep-linking.md](deep-linking.md). Pairing is available in all buil
123
125
  | Builder says “A device was paired earlier…” and Preview closes immediately after a brief spinner | Stale pairing session still present; a ghost device acks | Pair again on the device you are watching, or clear the env's pairing session and re-QR |
124
126
  | Preview succeeds on the server but the phone stays idle | App is not the paired instance (no **Preview mode** top bar) | Confirm the top bar before hitting Preview; re-open the pairing QR on this install |
125
127
  | QR / `https://…/pair/<jwt>` does nothing in the app | SDK only parses the **scheme** form after the backend redirect | Open via the OS (scan QR) or forward `{schemeId}://?pairing_token=…` with `handlePairingUrl` |
126
- | Builder selector has no screenshot after Confirm | Missing / unlinked `react-native-view-shot`, or Expo SDK 54 pinned 4.x | Install `react-native-view-shot@^5.0.0` and **rebuild native**. At init, look for `- react-native-view-shot is not linked, so Builder element selection gets no screenshot`. When confirming a pick, look for `[Userflow] Required peer react-native-view-shot is not installed; skipping picker screenshot.` |
128
+ | Builder selector has no screenshot after Confirm | Missing / unlinked `react-native-view-shot`, or 4.0.3 from Expo SDK 55 and older | Install `react-native-view-shot@^5.0.0` and **rebuild native**. At init, look for `- react-native-view-shot is not linked, so Builder element selection gets no screenshot`. When confirming a pick, look for `[Userflow] Required peer react-native-view-shot is not installed; skipping picker screenshot.` |
127
129
 
128
130
  ## Expo
129
131
 
@@ -7,25 +7,19 @@ exports.resolveCdnHost = resolveCdnHost;
7
7
  exports.resolveCustomStylesheetUrl = resolveCustomStylesheetUrl;
8
8
  exports.themeHasPublishedCustomCss = themeHasPublishedCustomCss;
9
9
  exports.themePublishedCssVersion = themePublishedCssVersion;
10
+ /** Backend hosts that serve a theme CDN at `cdn.<host>`. */
11
+ const CDN_BACKEND_HOSTS = ['userflow.com', 'userflowtoolz.com'];
12
+
10
13
  /**
11
- * Map the end-user websocket host to the theme stylesheet CDN host
12
- * (same convention as web userflow.js).
14
+ * Map the end-user websocket host to the theme stylesheet CDN host. Like web
15
+ * userflow.js this is always `cdn.<backendHost>`: there is no regional CDN
16
+ * (theme CSS is served from the control plane), so `e.eu.` hosts use the US
17
+ * CDN. Local stacks, proxies and unknown hosts fall back to `cdn.userflow.com`.
13
18
  */
14
19
  function resolveCdnHost(serverEndpoint) {
15
- const trimmed = serverEndpoint.replace(/\/$/, '');
16
- let host = trimmed;
17
- if (host.startsWith('https://')) {
18
- host = host.slice('https://'.length);
19
- } else if (host.startsWith('http://')) {
20
- host = host.slice('http://'.length);
21
- }
22
- if (host.startsWith('e.')) {
23
- return `cdn.${host.slice(2)}`;
24
- }
25
- if (host.includes('localhost') || host.includes('127.0.0.1')) {
26
- return 'cdn.userflow.com';
27
- }
28
- return `cdn.${host}`;
20
+ const host = serverEndpoint.trim().replace(/^[a-z][a-z\d+.-]*:\/\//i, '').split(/[:/?#]/)[0] ?? '';
21
+ const backendHost = host.replace(/^e\./, '').replace(/^eu\./, '');
22
+ return CDN_BACKEND_HOSTS.includes(backendHost) ? `cdn.${backendHost}` : 'cdn.userflow.com';
29
23
  }
30
24
  function themePublishedCssVersion(theme) {
31
25
  const cssVersion = theme.cssVersion;
@@ -1 +1 @@
1
- {"version":3,"names":["resolveCdnHost","serverEndpoint","trimmed","replace","host","startsWith","slice","length","includes","themePublishedCssVersion","theme","cssVersion","version","String","themeHasPublishedCustomCss","resolveCustomStylesheetUrl","cdnHost","id"],"sourceRoot":"../../../../src","sources":["surfaces/bannerWebView/resolveCdnHost.ts"],"mappings":";;;;;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,cAAsB,EAAU;EAC7D,MAAMC,OAAO,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EACjD,IAAIC,IAAI,GAAGF,OAAO;EAClB,IAAIE,IAAI,CAACC,UAAU,CAAC,UAAU,CAAC,EAAE;IAC/BD,IAAI,GAAGA,IAAI,CAACE,KAAK,CAAC,UAAU,CAACC,MAAM,CAAC;EACtC,CAAC,MAAM,IAAIH,IAAI,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;IACrCD,IAAI,GAAGA,IAAI,CAACE,KAAK,CAAC,SAAS,CAACC,MAAM,CAAC;EACrC;EACA,IAAIH,IAAI,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;IACzB,OAAO,OAAOD,IAAI,CAACE,KAAK,CAAC,CAAC,CAAC,EAAE;EAC/B;EACA,IAAIF,IAAI,CAACI,QAAQ,CAAC,WAAW,CAAC,IAAIJ,IAAI,CAACI,QAAQ,CAAC,WAAW,CAAC,EAAE;IAC5D,OAAO,kBAAkB;EAC3B;EACA,OAAO,OAAOJ,IAAI,EAAE;AACtB;AAEO,SAASK,wBAAwBA,CAACC,KAAoB,EAAiB;EAC5E,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU;EACnC,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACpE,OAAO,IAAI;EACb;EACA,MAAMC,OAAO,GAAGC,MAAM,CAACF,UAAU,CAAC;EAClC,OAAOC,OAAO,GAAGA,OAAO,GAAG,IAAI;AACjC;AAEO,SAASE,0BAA0BA,CAACJ,KAAoB,EAAW;EACxE,OAAOD,wBAAwB,CAACC,KAAK,CAAC,IAAI,IAAI;AAChD;AAEO,SAASK,0BAA0BA,CACxCd,cAAsB,EACtBS,KAAoB,EACL;EACf,MAAME,OAAO,GAAGH,wBAAwB,CAACC,KAAK,CAAC;EAC/C,IAAI,CAACE,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,MAAMI,OAAO,GAAGhB,cAAc,CAACC,cAAc,CAAC;EAC9C,OAAO,WAAWe,OAAO,WAAWN,KAAK,CAACO,EAAE,gBAAgBL,OAAO,aAAa;AAClF","ignoreList":[]}
1
+ {"version":3,"names":["CDN_BACKEND_HOSTS","resolveCdnHost","serverEndpoint","host","trim","replace","split","backendHost","includes","themePublishedCssVersion","theme","cssVersion","version","String","themeHasPublishedCustomCss","resolveCustomStylesheetUrl","cdnHost","id"],"sourceRoot":"../../../../src","sources":["surfaces/bannerWebView/resolveCdnHost.ts"],"mappings":";;;;;;;;;AAEA;AACA,MAAMA,iBAAiB,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,cAAsB,EAAU;EAC7D,MAAMC,IAAI,GACRD,cAAc,CACXE,IAAI,CAAC,CAAC,CACNC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CACtCC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;EAC7B,MAAMC,WAAW,GAAGJ,IAAI,CAACE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;EACjE,OAAOL,iBAAiB,CAACQ,QAAQ,CAACD,WAAW,CAAC,GAAG,OAAOA,WAAW,EAAE,GAAG,kBAAkB;AAC5F;AAEO,SAASE,wBAAwBA,CAACC,KAAoB,EAAiB;EAC5E,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU;EACnC,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACpE,OAAO,IAAI;EACb;EACA,MAAMC,OAAO,GAAGC,MAAM,CAACF,UAAU,CAAC;EAClC,OAAOC,OAAO,GAAGA,OAAO,GAAG,IAAI;AACjC;AAEO,SAASE,0BAA0BA,CAACJ,KAAoB,EAAW;EACxE,OAAOD,wBAAwB,CAACC,KAAK,CAAC,IAAI,IAAI;AAChD;AAEO,SAASK,0BAA0BA,CACxCb,cAAsB,EACtBQ,KAAoB,EACL;EACf,MAAME,OAAO,GAAGH,wBAAwB,CAACC,KAAK,CAAC;EAC/C,IAAI,CAACE,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,MAAMI,OAAO,GAAGf,cAAc,CAACC,cAAc,CAAC;EAC9C,OAAO,WAAWc,OAAO,WAAWN,KAAK,CAACO,EAAE,gBAAgBL,OAAO,aAAa;AAClF","ignoreList":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SDK_VERSION = void 0;
7
7
  /** Generated by scripts/write-version.mjs — do not edit. */
8
- const SDK_VERSION = exports.SDK_VERSION = '0.4.2';
8
+ const SDK_VERSION = exports.SDK_VERSION = '0.4.4';
9
9
  //# sourceMappingURL=version.js.map
@@ -1,24 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ /** Backend hosts that serve a theme CDN at `cdn.<host>`. */
4
+ const CDN_BACKEND_HOSTS = ['userflow.com', 'userflowtoolz.com'];
5
+
3
6
  /**
4
- * Map the end-user websocket host to the theme stylesheet CDN host
5
- * (same convention as web userflow.js).
7
+ * Map the end-user websocket host to the theme stylesheet CDN host. Like web
8
+ * userflow.js this is always `cdn.<backendHost>`: there is no regional CDN
9
+ * (theme CSS is served from the control plane), so `e.eu.` hosts use the US
10
+ * CDN. Local stacks, proxies and unknown hosts fall back to `cdn.userflow.com`.
6
11
  */
7
12
  export function resolveCdnHost(serverEndpoint) {
8
- const trimmed = serverEndpoint.replace(/\/$/, '');
9
- let host = trimmed;
10
- if (host.startsWith('https://')) {
11
- host = host.slice('https://'.length);
12
- } else if (host.startsWith('http://')) {
13
- host = host.slice('http://'.length);
14
- }
15
- if (host.startsWith('e.')) {
16
- return `cdn.${host.slice(2)}`;
17
- }
18
- if (host.includes('localhost') || host.includes('127.0.0.1')) {
19
- return 'cdn.userflow.com';
20
- }
21
- return `cdn.${host}`;
13
+ const host = serverEndpoint.trim().replace(/^[a-z][a-z\d+.-]*:\/\//i, '').split(/[:/?#]/)[0] ?? '';
14
+ const backendHost = host.replace(/^e\./, '').replace(/^eu\./, '');
15
+ return CDN_BACKEND_HOSTS.includes(backendHost) ? `cdn.${backendHost}` : 'cdn.userflow.com';
22
16
  }
23
17
  export function themePublishedCssVersion(theme) {
24
18
  const cssVersion = theme.cssVersion;
@@ -1 +1 @@
1
- {"version":3,"names":["resolveCdnHost","serverEndpoint","trimmed","replace","host","startsWith","slice","length","includes","themePublishedCssVersion","theme","cssVersion","version","String","themeHasPublishedCustomCss","resolveCustomStylesheetUrl","cdnHost","id"],"sourceRoot":"../../../../src","sources":["surfaces/bannerWebView/resolveCdnHost.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAACC,cAAsB,EAAU;EAC7D,MAAMC,OAAO,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EACjD,IAAIC,IAAI,GAAGF,OAAO;EAClB,IAAIE,IAAI,CAACC,UAAU,CAAC,UAAU,CAAC,EAAE;IAC/BD,IAAI,GAAGA,IAAI,CAACE,KAAK,CAAC,UAAU,CAACC,MAAM,CAAC;EACtC,CAAC,MAAM,IAAIH,IAAI,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;IACrCD,IAAI,GAAGA,IAAI,CAACE,KAAK,CAAC,SAAS,CAACC,MAAM,CAAC;EACrC;EACA,IAAIH,IAAI,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;IACzB,OAAO,OAAOD,IAAI,CAACE,KAAK,CAAC,CAAC,CAAC,EAAE;EAC/B;EACA,IAAIF,IAAI,CAACI,QAAQ,CAAC,WAAW,CAAC,IAAIJ,IAAI,CAACI,QAAQ,CAAC,WAAW,CAAC,EAAE;IAC5D,OAAO,kBAAkB;EAC3B;EACA,OAAO,OAAOJ,IAAI,EAAE;AACtB;AAEA,OAAO,SAASK,wBAAwBA,CAACC,KAAoB,EAAiB;EAC5E,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU;EACnC,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACpE,OAAO,IAAI;EACb;EACA,MAAMC,OAAO,GAAGC,MAAM,CAACF,UAAU,CAAC;EAClC,OAAOC,OAAO,GAAGA,OAAO,GAAG,IAAI;AACjC;AAEA,OAAO,SAASE,0BAA0BA,CAACJ,KAAoB,EAAW;EACxE,OAAOD,wBAAwB,CAACC,KAAK,CAAC,IAAI,IAAI;AAChD;AAEA,OAAO,SAASK,0BAA0BA,CACxCd,cAAsB,EACtBS,KAAoB,EACL;EACf,MAAME,OAAO,GAAGH,wBAAwB,CAACC,KAAK,CAAC;EAC/C,IAAI,CAACE,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,MAAMI,OAAO,GAAGhB,cAAc,CAACC,cAAc,CAAC;EAC9C,OAAO,WAAWe,OAAO,WAAWN,KAAK,CAACO,EAAE,gBAAgBL,OAAO,aAAa;AAClF","ignoreList":[]}
1
+ {"version":3,"names":["CDN_BACKEND_HOSTS","resolveCdnHost","serverEndpoint","host","trim","replace","split","backendHost","includes","themePublishedCssVersion","theme","cssVersion","version","String","themeHasPublishedCustomCss","resolveCustomStylesheetUrl","cdnHost","id"],"sourceRoot":"../../../../src","sources":["surfaces/bannerWebView/resolveCdnHost.ts"],"mappings":";;AAEA;AACA,MAAMA,iBAAiB,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,cAAsB,EAAU;EAC7D,MAAMC,IAAI,GACRD,cAAc,CACXE,IAAI,CAAC,CAAC,CACNC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CACtCC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;EAC7B,MAAMC,WAAW,GAAGJ,IAAI,CAACE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;EACjE,OAAOL,iBAAiB,CAACQ,QAAQ,CAACD,WAAW,CAAC,GAAG,OAAOA,WAAW,EAAE,GAAG,kBAAkB;AAC5F;AAEA,OAAO,SAASE,wBAAwBA,CAACC,KAAoB,EAAiB;EAC5E,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU;EACnC,IAAI,OAAOA,UAAU,KAAK,QAAQ,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACpE,OAAO,IAAI;EACb;EACA,MAAMC,OAAO,GAAGC,MAAM,CAACF,UAAU,CAAC;EAClC,OAAOC,OAAO,GAAGA,OAAO,GAAG,IAAI;AACjC;AAEA,OAAO,SAASE,0BAA0BA,CAACJ,KAAoB,EAAW;EACxE,OAAOD,wBAAwB,CAACC,KAAK,CAAC,IAAI,IAAI;AAChD;AAEA,OAAO,SAASK,0BAA0BA,CACxCb,cAAsB,EACtBQ,KAAoB,EACL;EACf,MAAME,OAAO,GAAGH,wBAAwB,CAACC,KAAK,CAAC;EAC/C,IAAI,CAACE,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,MAAMI,OAAO,GAAGf,cAAc,CAACC,cAAc,CAAC;EAC9C,OAAO,WAAWc,OAAO,WAAWN,KAAK,CAACO,EAAE,gBAAgBL,OAAO,aAAa;AAClF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  /** Generated by scripts/write-version.mjs — do not edit. */
4
- export const SDK_VERSION = '0.4.2';
4
+ export const SDK_VERSION = '0.4.4';
5
5
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,9 @@
1
1
  import type { ThemeFragment } from '@userflow-tech/protocol';
2
2
  /**
3
- * Map the end-user websocket host to the theme stylesheet CDN host
4
- * (same convention as web userflow.js).
3
+ * Map the end-user websocket host to the theme stylesheet CDN host. Like web
4
+ * userflow.js this is always `cdn.<backendHost>`: there is no regional CDN
5
+ * (theme CSS is served from the control plane), so `e.eu.` hosts use the US
6
+ * CDN. Local stacks, proxies and unknown hosts fall back to `cdn.userflow.com`.
5
7
  */
6
8
  export declare function resolveCdnHost(serverEndpoint: string): string;
7
9
  export declare function themePublishedCssVersion(theme: ThemeFragment): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"resolveCdnHost.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/bannerWebView/resolveCdnHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAe7D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAO5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,aAAa,GACnB,MAAM,GAAG,IAAI,CAOf"}
1
+ {"version":3,"file":"resolveCdnHost.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/bannerWebView/resolveCdnHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAO5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,aAAa,GACnB,MAAM,GAAG,IAAI,CAOf"}
@@ -1,3 +1,3 @@
1
1
  /** Generated by scripts/write-version.mjs — do not edit. */
2
- export declare const SDK_VERSION = "0.4.2";
2
+ export declare const SDK_VERSION = "0.4.4";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,9 @@
1
1
  import type { ThemeFragment } from '@userflow-tech/protocol';
2
2
  /**
3
- * Map the end-user websocket host to the theme stylesheet CDN host
4
- * (same convention as web userflow.js).
3
+ * Map the end-user websocket host to the theme stylesheet CDN host. Like web
4
+ * userflow.js this is always `cdn.<backendHost>`: there is no regional CDN
5
+ * (theme CSS is served from the control plane), so `e.eu.` hosts use the US
6
+ * CDN. Local stacks, proxies and unknown hosts fall back to `cdn.userflow.com`.
5
7
  */
6
8
  export declare function resolveCdnHost(serverEndpoint: string): string;
7
9
  export declare function themePublishedCssVersion(theme: ThemeFragment): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"resolveCdnHost.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/bannerWebView/resolveCdnHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAe7D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAO5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,aAAa,GACnB,MAAM,GAAG,IAAI,CAOf"}
1
+ {"version":3,"file":"resolveCdnHost.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/bannerWebView/resolveCdnHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAO5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,aAAa,GACnB,MAAM,GAAG,IAAI,CAOf"}
@@ -1,3 +1,3 @@
1
1
  /** Generated by scripts/write-version.mjs — do not edit. */
2
- export declare const SDK_VERSION = "0.4.2";
2
+ export declare const SDK_VERSION = "0.4.4";
3
3
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userflow-tech/react-native",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Userflow SDK for React Native — onboarding flows, tooltips, and modals.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "main": "./lib/commonjs/index.js",
@@ -1,24 +1,22 @@
1
1
  import type { ThemeFragment } from '@userflow-tech/protocol';
2
2
 
3
+ /** Backend hosts that serve a theme CDN at `cdn.<host>`. */
4
+ const CDN_BACKEND_HOSTS = ['userflow.com', 'userflowtoolz.com'];
5
+
3
6
  /**
4
- * Map the end-user websocket host to the theme stylesheet CDN host
5
- * (same convention as web userflow.js).
7
+ * Map the end-user websocket host to the theme stylesheet CDN host. Like web
8
+ * userflow.js this is always `cdn.<backendHost>`: there is no regional CDN
9
+ * (theme CSS is served from the control plane), so `e.eu.` hosts use the US
10
+ * CDN. Local stacks, proxies and unknown hosts fall back to `cdn.userflow.com`.
6
11
  */
7
12
  export function resolveCdnHost(serverEndpoint: string): string {
8
- const trimmed = serverEndpoint.replace(/\/$/, '');
9
- let host = trimmed;
10
- if (host.startsWith('https://')) {
11
- host = host.slice('https://'.length);
12
- } else if (host.startsWith('http://')) {
13
- host = host.slice('http://'.length);
14
- }
15
- if (host.startsWith('e.')) {
16
- return `cdn.${host.slice(2)}`;
17
- }
18
- if (host.includes('localhost') || host.includes('127.0.0.1')) {
19
- return 'cdn.userflow.com';
20
- }
21
- return `cdn.${host}`;
13
+ const host =
14
+ serverEndpoint
15
+ .trim()
16
+ .replace(/^[a-z][a-z\d+.-]*:\/\//i, '')
17
+ .split(/[:/?#]/)[0] ?? '';
18
+ const backendHost = host.replace(/^e\./, '').replace(/^eu\./, '');
19
+ return CDN_BACKEND_HOSTS.includes(backendHost) ? `cdn.${backendHost}` : 'cdn.userflow.com';
22
20
  }
23
21
 
24
22
  export function themePublishedCssVersion(theme: ThemeFragment): string | null {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Generated by scripts/write-version.mjs — do not edit. */
2
- export const SDK_VERSION = '0.4.2';
2
+ export const SDK_VERSION = '0.4.4';
@@ -1,12 +1,15 @@
1
1
  /**
2
- * Default backend endpoint used when a host app does not pass an explicit
3
- * `serverEndpoint` to `init()`. Points at Userflow production.
2
+ * US production end-user host, used when `init()` gets no `serverEndpoint` and
3
+ * the client token is not an EU token (see `resolveServerEndpoint`).
4
4
  *
5
5
  * For local development against the Userflow dev stack, pass the local endpoint
6
6
  * explicitly, e.g. `init({ ..., serverEndpoint: 'http://localhost:40401' })`.
7
7
  */
8
8
  export declare const DEFAULT_SERVER_ENDPOINT = "https://e.userflow.com";
9
- /** End-user socket for EU-hosted environments. Pairing stays on the US host. */
9
+ /**
10
+ * EU production end-user host, picked for `ct_eu<shard>_…` client tokens when
11
+ * `init()` gets no `serverEndpoint`. Pairing stays on the US host.
12
+ */
10
13
  export declare const EU_SERVER_ENDPOINT = "https://e.eu.userflow.com";
11
14
  /**
12
15
  * US-pinned host for the Builder pairing websocket (`/socket/pairing`).
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,2BAA2B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,2BAA2B,CAAC"}
@@ -1,12 +1,15 @@
1
1
  /**
2
- * Default backend endpoint used when a host app does not pass an explicit
3
- * `serverEndpoint` to `init()`. Points at Userflow production.
2
+ * US production end-user host, used when `init()` gets no `serverEndpoint` and
3
+ * the client token is not an EU token (see `resolveServerEndpoint`).
4
4
  *
5
5
  * For local development against the Userflow dev stack, pass the local endpoint
6
6
  * explicitly, e.g. `init({ ..., serverEndpoint: 'http://localhost:40401' })`.
7
7
  */
8
8
  export const DEFAULT_SERVER_ENDPOINT = 'https://e.userflow.com';
9
- /** End-user socket for EU-hosted environments. Pairing stays on the US host. */
9
+ /**
10
+ * EU production end-user host, picked for `ct_eu<shard>_…` client tokens when
11
+ * `init()` gets no `serverEndpoint`. Pairing stays on the US host.
12
+ */
10
13
  export const EU_SERVER_ENDPOINT = 'https://e.eu.userflow.com';
11
14
  /**
12
15
  * US-pinned host for the Builder pairing websocket (`/socket/pairing`).
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAEhE,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserflowCore.d.ts","sourceRoot":"","sources":["../../src/engine/UserflowCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAQrB,sFAAsF;AACtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAED,MAAM,WA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EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAStE;;;OAGG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpD;;;OAGG;IACH,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIxD;;;OAGG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,0BAA0B,EAAE,GAAG,IAAI;IAIzE;;;;;;;;;OASG;IACG,YAAY,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjE,sEAAsE;IACtE,KAAK,IAAI,IAAI;IAWb,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,mBAAmB;YAOb,MAAM;IAyBpB,OAAO,CAAC,iBAAiB;YAQX,UAAU;YA4BV,OAAO;IA6BrB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,YAAY;YAUN,YAAY;YAeZ,aAAa;YAyBb,OAAO;CAwBtB"}
@@ -1,8 +1,8 @@
1
1
  import { assertValidAttributeNames, assertValidEventName } from '../attributes.js';
2
- import { DEFAULT_SERVER_ENDPOINT, EU_SERVER_ENDPOINT } from '../constants.js';
3
2
  import { UserflowAuthError } from '../errors.js';
4
3
  import { normalizeTrackEventAttributes } from '../eventAttributes.js';
5
4
  import { normalizeAttributes } from '../normalizeAttributes.js';
5
+ import { resolveServerEndpoint } from '../serverEndpoint.js';
6
6
  import { PhoenixConnection, validateCredentials } from '../transport/phoenix.js';
7
7
  const DEFAULT_CLIENT_CONTEXT = {
8
8
  pageUrl: '',
@@ -229,23 +229,9 @@ export class UserflowCore {
229
229
  throw new UserflowAuthError('clientToken is an environment secret key (esk_...). That key must never ship in the app. ' +
230
230
  'Pass the client token (ct_...) from Settings → Environments instead.', { isHostContract: true });
231
231
  }
232
- const usedDefaultEndpoint = options.serverEndpoint == null || options.serverEndpoint.trim() === '';
233
- const serverEndpoint = (options.serverEndpoint ?? DEFAULT_SERVER_ENDPOINT).replace(/\/$/, '');
234
- try {
235
- await this.validate(clientToken, serverEndpoint);
236
- }
237
- catch (error) {
238
- if (usedDefaultEndpoint &&
239
- error instanceof Error &&
240
- error.message.includes('invalid_client_token')) {
241
- const hinted = `${error.message}. For EU-hosted environments pass ` +
242
- `serverEndpoint: '${EU_SERVER_ENDPOINT}'.`;
243
- throw new UserflowAuthError(hinted, {
244
- isHostContract: error instanceof UserflowAuthError && error.isHostContract,
245
- });
246
- }
247
- throw error;
248
- }
232
+ const serverEndpoint = resolveServerEndpoint(clientToken, options.serverEndpoint);
233
+ // Join errors (`invalid_client_token`, `region_mismatch`, …) pass through as-is.
234
+ await this.validate(clientToken, serverEndpoint);
249
235
  this.connection?.disconnect();
250
236
  this.connection = null;
251
237
  this.config = { clientToken, serverEndpoint };
@@ -1 +1 @@
1
- {"version":3,"file":"UserflowCore.js","sourceRoot":"","sources":["../../src/engine/UserflowCore.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAajF,MAAM,sBAAsB,GAAkB;IAC5C,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,GAAG;IAClB,cAAc,EAAE,GAAG;CACpB,CAAC;AAmDF,SAAS,YAAY,CAAC,KAAyB,EAAE,IAAY;IAC3D,MAAM,OAAO,GAAG,KA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,CAAC;CACF"}
@@ -10,6 +10,7 @@ export type { UserflowAttributes, UserflowAttributeValue } from '@userflow-tech/
10
10
  export { assertValidAttributeNames, assertValidEventName, isAttributeNameSoftValid, MAX_ATTRIBUTE_NAME_LENGTH, MAX_EVENT_NAME_LENGTH, validateAttributeName, } from './attributes.js';
11
11
  export type { AttributeScope } from './attributes.js';
12
12
  export { DEFAULT_PAIRING_ENDPOINT, DEFAULT_SERVER_ENDPOINT } from './constants.js';
13
+ export { resolveServerEndpoint } from './serverEndpoint.js';
13
14
  export { UserflowAuthError, UserflowRateLimitError } from './errors.js';
14
15
  export type { UserflowAuthErrorOptions } from './errors.js';
15
16
  export { BannerSessionEngine } from './engine/BannerSessionEngine.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACxE,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,sBAA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iB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -8,6 +8,7 @@
8
8
  export { PROTOCOL_VERSION } from '@userflow-tech/protocol';
9
9
  export { assertValidAttributeNames, assertValidEventName, isAttributeNameSoftValid, MAX_ATTRIBUTE_NAME_LENGTH, MAX_EVENT_NAME_LENGTH, validateAttributeName, } from './attributes.js';
10
10
  export { DEFAULT_PAIRING_ENDPOINT, DEFAULT_SERVER_ENDPOINT } from './constants.js';
11
+ export { resolveServerEndpoint } from './serverEndpoint.js';
11
12
  export { UserflowAuthError, UserflowRateLimitError } from './errors.js';
12
13
  export { BannerSessionEngine } from './engine/BannerSessionEngine.js';
13
14
  export { FlowSessionEngine } from './engine/FlowSessionEngine.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAOlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAS1E,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAUnF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOxD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ5F,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAkB9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAOlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAS1E,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAUnF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOxD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ5F,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAkB9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Picks the end-user host. A non-empty `serverEndpoint` always wins (trimmed,
3
+ * one trailing `/` removed); otherwise the region comes from the client token,
4
+ * matching web userflow.js. The backend never supplies a host.
5
+ */
6
+ export declare function resolveServerEndpoint(clientToken: string, serverEndpoint: string | null | undefined): string;
7
+ //# sourceMappingURL=serverEndpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverEndpoint.d.ts","sourceRoot":"","sources":["../src/serverEndpoint.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACxC,MAAM,CAIR"}
@@ -0,0 +1,15 @@
1
+ import { DEFAULT_SERVER_ENDPOINT, EU_SERVER_ENDPOINT } from './constants.js';
2
+ /** Client tokens provisioned on an EU shard (`ct_eu0_…`), as userflow.js matches them. */
3
+ const EU_CLIENT_TOKEN = /^ct_eu\d+_.+$/;
4
+ /**
5
+ * Picks the end-user host. A non-empty `serverEndpoint` always wins (trimmed,
6
+ * one trailing `/` removed); otherwise the region comes from the client token,
7
+ * matching web userflow.js. The backend never supplies a host.
8
+ */
9
+ export function resolveServerEndpoint(clientToken, serverEndpoint) {
10
+ const explicit = serverEndpoint?.trim();
11
+ if (explicit)
12
+ return explicit.replace(/\/$/, '');
13
+ return EU_CLIENT_TOKEN.test(clientToken) ? EU_SERVER_ENDPOINT : DEFAULT_SERVER_ENDPOINT;
14
+ }
15
+ //# sourceMappingURL=serverEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverEndpoint.js","sourceRoot":"","sources":["../src/serverEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,0FAA0F;AAC1F,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAmB,EACnB,cAAyC;IAEzC,MAAM,QAAQ,GAAG,cAAc,EAAE,IAAI,EAAE,CAAC;IACxC,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,OAAO,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,uBAAuB,CAAC;AAC1F,CAAC"}
@@ -23,8 +23,9 @@ export interface UserflowCredentials {
23
23
  /** Environment client token from the Userflow dashboard (the `ct_...` value). */
24
24
  clientToken: string;
25
25
  }
26
- /** Options accepted by `init()`. `serverEndpoint` defaults to Userflow
27
- * production; pass it explicitly to target a local dev stack. */
26
+ /** Options accepted by `init()`. When `serverEndpoint` is empty or omitted, the
27
+ * host is picked from the client token's region (`ct_eu0_…` → EU, otherwise
28
+ * US). Set it only for a proxy or a non-production stack. */
28
29
  export type UserflowInitOptions = UserflowCredentials & {
29
30
  serverEndpoint?: string;
30
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,sBAAsB,CAAC;IAC7B,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,QAAQ,CAAC,EAAE,uBAAuB,GAAG,iBAAiB,GAAG,IAAI,CAAC;CAC/D;AAED,KAAK,uBAA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M,WAAW,oBAAoB;IACnC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,mEAAmE;AACnE,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG;IACjD,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** Generated by scripts/write-version.mjs — do not edit. */
2
- export declare const CORE_VERSION = "0.2.1";
2
+ export declare const CORE_VERSION = "0.2.2";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** Generated by scripts/write-version.mjs — do not edit. */
2
- export const CORE_VERSION = '0.2.1';
2
+ export const CORE_VERSION = '0.2.2';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userflow-tech/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Userflow React Native SDK core — platform-agnostic engine and protocol client.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userflow-tech/protocol",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Userflow React Native SDK protocol — wire contracts and shared types.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",