@guidelytech/react-native 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,12 +85,77 @@ tasks).
85
85
  | `useChecklistProgress(key)`, `useGuideState(key)`, `useActiveGuide()` | Live state |
86
86
  | `<GuidelyTarget id>`, `useGuidelyTarget(id)` | Guide targets |
87
87
  | `<GuidelyScreenScope name>`, `guidelyScreenLayout` | Screen scoping for targets |
88
+ | `<GuidelyMask>` | Keeps its children's text out of tap analytics |
88
89
 
89
90
  Provider props: `projectId`, `apiUrl`, `environment`, `storage`, `user`, `debug`, `analytics`,
90
91
  `consent` (`granted` / `pending` / `denied`), `appVersion` (for *App version* rules), `theme`,
91
92
  `configRefreshMs`, `onNavigate`, `onError`, `showChecklistLauncher` (default `true`),
92
93
  `showResourceCenterLauncher` (default `false`), `showMessengerLauncher` (default `true`), `insets`,
93
- `launcherOffset` (default 72).
94
+ `launcherOffset` (default 72), `autocapture`, `appBuild`.
95
+
96
+ ## Product analytics (autocapture)
97
+
98
+ The SDK records the same product-analytics events as the web SDK, so taps, time on screen and
99
+ heatmaps show up in Pages, Heatmaps, Features, Funnels and Paths next to web clicks. Each capability
100
+ runs when the project turns it on (Settings → Product analytics) and analytics are allowed
101
+ (`analytics`, `consent`). The `autocapture` prop can only turn things off:
102
+
103
+ ```tsx
104
+ <GuidelyProvider autocapture={{ clicks: false, heatmaps: false }} appVersion={version} appBuild={build} …>
105
+ // autocapture={false} turns everything off, including screen page views, and removes the wrapper view
106
+ ```
107
+
108
+ | Event | When | Properties |
109
+ |---|---|---|
110
+ | `click` | A tap on an interactive element | `selector`, `tag`, `text?`, `x`, `y`, `platform` |
111
+ | `rage_click` | 3+ taps within 1 s and 30 pt | the `click` properties of the tapped (or hit) view + `count` |
112
+ | `heatmap` | Every 40 taps, on screen change and when the app goes to the background | `path?`, `viewportWidth`, `viewportHeight`, `pageHeight`, `platform`, `points` |
113
+ | `page_leave` | The screen changes or the app goes to the background | `path?`, `screen`, `durationMs`, `scrollDepth: 100`, `platform` |
114
+ | `page_view` | `screen()` with a new name; after returning to the foreground with `resumed: true` | `path`, `screen`, `platform` |
115
+ | `app_install` / `app_update` | First launch / a launch with a new `appVersion` or `appBuild` | `appVersion`, `build`, `previousVersion`, `previousBuild` |
116
+ | `app_open` / `app_background` | Cold start and return to the foreground / background | `coldStart` / `foregroundMs` |
117
+
118
+ **Taps.** The provider wraps your app in a full-size `View` (`flex: 1`) with capture-phase touch
119
+ handlers that only observe: they never claim the responder, stop propagation or delay anything. A
120
+ tap is a single-finger touch that moves ≤ 10 pt and lasts < 1 s. Guidely's own UI (guide cards,
121
+ launchers, messenger) is rendered outside the wrapper and never captured.
122
+
123
+ **Selectors**, first match wins:
124
+
125
+ 1. A `<GuidelyTarget id>` / `useGuidelyTarget(id)` whose frame contains the tap (the smallest one) → `#<id>`.
126
+ The same id works in guides, Features and on the web (`data-guidely-id`), so this is the
127
+ recommended way to name what matters.
128
+ 2. The `nativeID` → `[nativeID="…"]`, then `testID` → `[testID="…"]` of the tapped interactive element.
129
+ 3. A short component path, innermost last: `Row:nth-of-type(3) > Pressable`.
130
+
131
+ The interactive element is the innermost component with `onPress` / `onLongPress` (`Pressable`,
132
+ `Touchable*`, `Button`, `Text onPress`, React Navigation buttons), else one with an interactive
133
+ `accessibilityRole` / `role` (`button`, `link`, `tab`, `switch`, …). `tag` is its component name and
134
+ `text` its visible text (else its accessibility label), whitespace collapsed, ≤ 100 characters.
135
+ Taps on anything else record no `click` (they still count for rage taps and heatmaps). Text is
136
+ never taken from a `TextInput`, and is left out inside `<GuidelyMask>` and when the project masks
137
+ all text in replays:
138
+
139
+ ```tsx
140
+ import { GuidelyMask } from "@guidelytech/react-native";
141
+ <GuidelyMask><Pressable onPress={showCard}><Text>{cardNumber}</Text></Pressable></GuidelyMask>
142
+ ```
143
+
144
+ **App lifecycle.** `app_install` / `app_update` need the `appVersion` prop (e.g.
145
+ `Application.nativeApplicationVersion` from `expo-application`; `appBuild` from
146
+ `nativeBuildVersion`) and `storage`; the last version is stored per public key. An app that already
147
+ had Guidely installed stores its version silently on the first launch with this release.
148
+
149
+ **Limitations.** React Native has no public API for "which component is under this point", so
150
+ element resolution (steps 2 and 3, `tag`, `text`) reads React's internal component tree of the touch
151
+ event. It is best-effort and guarded: when it is unavailable the tap still counts (heatmaps, rage
152
+ taps, `#<id>` targets), and nothing ever throws into your app. Component names come from
153
+ `displayName` / function names; Metro keeps function names by default, but a custom minifier that
154
+ mangles them makes paths less readable — use `GuidelyTarget`, `nativeID` or `testID` for stable
155
+ names. Taps handled entirely by native gesture recognizers (`react-native-gesture-handler` buttons,
156
+ native-stack headers, some third-party native views) may not reach JavaScript touch handlers and are
157
+ then not captured. Coordinates are relative to the React Native root view (the window in a
158
+ full-screen app).
94
159
 
95
160
  ## Feature flags
96
161
 
@@ -150,4 +215,15 @@ the foreground; guides keep working offline. Events are queued, batched and retr
150
215
  session starts after the project's inactivity timeout. The SDK never throws into your app — errors
151
216
  go to `onError` and, with `debug`, the console.
152
217
 
218
+ ## Outages
219
+
220
+ If Guidely is slow or down, your app keeps working. With a cached config the SDK waits at most
221
+ 1.5 s for the server at launch (config, then identify), starts from the cache, and applies the
222
+ fresh answer when it arrives. Events, survey answers, guide completions/dismissals and checklist
223
+ progress are queued and retried until the server takes them. After repeated failures the SDK backs
224
+ off (5 s up to 5 min, or the server's `Retry-After`) and skips config refreshes until the API
225
+ answers again. Scout replies give up when nothing arrives for 30 s, or when the stream goes quiet
226
+ for 60 s. Pass `storage` (AsyncStorage) so queued events and answers survive an app restart;
227
+ without it they are lost if the app is closed during an outage.
228
+
153
229
  Full guide: [docs/mobile.md](../../docs/mobile.md). Example app: `mobile/react-native/example`.