@mixpanel/react-native-session-replay 1.3.0 → 1.4.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.
Files changed (25) hide show
  1. package/MixpanelReactNativeSessionReplay.podspec +1 -1
  2. package/README.md +1 -1
  3. package/android/build.gradle +10 -3
  4. package/android/src/main/java/com/mixpanelreactnativesessionreplay/MixpanelReactNativeSessionReplayModule.kt +54 -0
  5. package/android/src/main/java/com/mixpanelreactnativesessionreplay/MixpanelSessionReplayView.kt +56 -0
  6. package/android/src/main/java/com/mixpanelreactnativesessionreplay/MixpanelSessionReplayViewManager.kt +5 -0
  7. package/android/src/test/java/com/mixpanelreactnativesessionreplay/WireframeTextDeclarationTest.kt +41 -0
  8. package/ios/MixpanelReactNativeSessionReplay.h +7 -2
  9. package/ios/MixpanelReactNativeSessionReplay.mm +35 -2
  10. package/ios/MixpanelSessionReplayViewManager.mm +9 -0
  11. package/ios/MixpanelSwiftSessionReplay.swift +43 -1
  12. package/lib/module/MixpanelSessionReplayView.js.map +1 -1
  13. package/lib/module/NativeMixpanelReactNativeSessionReplay.js.map +1 -1
  14. package/lib/module/index.js +468 -23
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/MixpanelSessionReplayView.d.ts +32 -0
  17. package/lib/typescript/src/MixpanelSessionReplayView.d.ts.map +1 -1
  18. package/lib/typescript/src/NativeMixpanelReactNativeSessionReplay.d.ts +2 -0
  19. package/lib/typescript/src/NativeMixpanelReactNativeSessionReplay.d.ts.map +1 -1
  20. package/lib/typescript/src/index.d.ts +259 -10
  21. package/lib/typescript/src/index.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/src/MixpanelSessionReplayView.tsx +33 -0
  24. package/src/NativeMixpanelReactNativeSessionReplay.ts +7 -0
  25. package/src/index.tsx +515 -22
@@ -1,6 +1,38 @@
1
1
  import { type ViewProps } from 'react-native';
2
2
  interface MixpanelSessionReplayViewProps extends ViewProps {
3
+ /**
4
+ * Masks everything inside this view in the replay video, and drops the text of every
5
+ * wireframe element under it.
6
+ *
7
+ * Controls pixels. Orthogonal to {@link wireframeText}, which controls what the
8
+ * wireframe *says*; the two compose.
9
+ */
3
10
  sensitive?: boolean;
11
+ /**
12
+ * Declares the text recorded for this view in the wireframe.
13
+ *
14
+ * **Beta.** Wireframes are in beta; see `MPWireframesOptions` for what to check before
15
+ * shipping to production.
16
+ *
17
+ * Use it to describe content the SDK can't read — custom-drawn views, charts, canvases —
18
+ * or to attach an analytical label. Declared text wins over the view's own visible text
19
+ * and over its accessibility label.
20
+ *
21
+ * **It is sent even when the view is masked.** Masking hides the pixels while the
22
+ * declared text still describes the view for the summary. Because you authored it rather
23
+ * than the SDK scraping it off the screen, making sure the text is not itself sensitive
24
+ * is up to you — if it could be, leave it off.
25
+ *
26
+ * ```tsx
27
+ * <MPSessionReplayView sensitive wireframeText="Card number">
28
+ * <CardNumberField />
29
+ * </MPSessionReplayView>
30
+ * ```
31
+ *
32
+ * Requires `wireframesOptions` on the config; without it no wireframes are captured and
33
+ * this prop does nothing. Blank strings are ignored.
34
+ */
35
+ wireframeText?: string;
4
36
  }
5
37
  export declare const MPSessionReplayView: import("react-native").HostComponent<MixpanelSessionReplayViewProps>;
6
38
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"MixpanelSessionReplayView.d.ts","sourceRoot":"","sources":["../../../src/MixpanelSessionReplayView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,8BAA+B,SAAQ,SAAS;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,mBAAmB,sEAG7B,CAAC"}
1
+ {"version":3,"file":"MixpanelSessionReplayView.d.ts","sourceRoot":"","sources":["../../../src/MixpanelSessionReplayView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,8BAA+B,SAAQ,SAAS;IACxD;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,sEAG7B,CAAC"}
@@ -7,6 +7,8 @@ export interface Spec extends TurboModule {
7
7
  identify(distinctId: string): Promise<void>;
8
8
  getReplayId(): Promise<string | null>;
9
9
  flush(): Promise<void>;
10
+ addListener(eventName: string): void;
11
+ removeListeners(count: number): void;
10
12
  }
11
13
  declare global {
12
14
  var __turboModuleProxy: unknown | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeMixpanelReactNativeSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/NativeMixpanelReactNativeSessionReplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CACR,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,cAAc,CAAC,wBAAwB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;wBAyCkD,IAAI;AAAvD,wBAAwD"}
1
+ {"version":3,"file":"NativeMixpanelReactNativeSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/NativeMixpanelReactNativeSessionReplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CACR,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,cAAc,CAAC,wBAAwB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAMvB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;wBAyCkD,IAAI;AAAvD,wBAAwD"}
@@ -18,6 +18,59 @@ export declare enum MPSessionReplayRemoteSettingsMode {
18
18
  * to send traffic through a custom endpoint (for example, a corporate proxy).
19
19
  */
20
20
  export declare const MPDataResidency: Readonly<Record<'US' | 'EU' | 'IN', string>>;
21
+ /**
22
+ * Why a wireframe element's text was kept, rewritten, or dropped.
23
+ *
24
+ * Reported through {@link MPDebugOptions.wireframeEmitter} for local inspection only.
25
+ * These are the same `SCREAMING_SNAKE_CASE` tokens Android, iOS and Flutter report, so
26
+ * the same decision reads identically on every platform.
27
+ *
28
+ * ⚠️ **Not a stable contract.** Values may be added or renamed; treat an unrecognized
29
+ * one as "some kind of masking" rather than matching exhaustively. That is also why
30
+ * {@link MPWireframeElement.maskDecision} is typed `string` rather than a closed union —
31
+ * a new native value should not become a type error.
32
+ */
33
+ export declare const MPMaskDecision: {
34
+ /** Text emitted as-is. */
35
+ readonly None: "NONE";
36
+ /** Text you declared with the `wireframeText` prop. Sent even when masked. */
37
+ readonly Declared: "DECLARED";
38
+ /** Explicitly masked — `<MPSessionReplayView sensitive>` or a registered class. */
39
+ readonly Explicit: "EXPLICIT";
40
+ /** Auto-masked by an `autoMaskedViews` category. */
41
+ readonly Auto: "AUTO";
42
+ /** A text-entry field. Always masked, cannot be overridden. */
43
+ readonly TextEntry: "TEXT_ENTRY";
44
+ /** Bounds intersected a mask rect the screenshot painted over. */
45
+ readonly Geometric: "GEOMETRIC";
46
+ /** Matched a strip rule; text was dropped. */
47
+ readonly RuleStrip: "RULE_STRIP";
48
+ /** Matched a redact rule; text was rewritten. */
49
+ readonly RuleRedact: "RULE_REDACT";
50
+ };
51
+ /** One element of a captured wireframe. See {@link MPWireframeSnapshot}. */
52
+ export interface MPWireframeElement {
53
+ /** `text`, `button`, `input` or `image`. */
54
+ role: string;
55
+ /** The text this element ships with, or `null` for a textless shell. */
56
+ text: string | null;
57
+ /** `[x, y, width, height]`, in the same units the wireframe event carries. */
58
+ bounds: number[];
59
+ /** One of {@link MPMaskDecision}'s values — see the note there about matching. */
60
+ maskDecision: string;
61
+ }
62
+ /**
63
+ * One captured wireframe, exactly as the SDK built it.
64
+ *
65
+ * ⚠️ **Not a stable contract** — a debugging aid, not a schema to build tooling on.
66
+ */
67
+ export interface MPWireframeSnapshot {
68
+ /** Capture instant in milliseconds, matching the screenshot it accompanies. */
69
+ timestamp: number;
70
+ /** `[width, height]` of the captured viewport. */
71
+ viewport: number[];
72
+ elements: MPWireframeElement[];
73
+ }
21
74
  /**
22
75
  * Color configuration for the on-device debug mask overlay.
23
76
  *
@@ -26,8 +79,8 @@ export declare const MPDataResidency: Readonly<Record<'US' | 'EU' | 'IN', string
26
79
  * Setting any of `maskColor`, `autoMaskColor`, or `unmaskColor` to `null` hides that
27
80
  * category from the overlay.
28
81
  *
29
- * The overlay only renders when `__DEV__` is `true` — `debugOptions` is ignored in
30
- * production bundles regardless of what is passed.
82
+ * The overlay only renders in a debuggable build. That is enforced by the native SDKs
83
+ * themselves, so it is safe to leave `overlayColors` set unconditionally.
31
84
  */
32
85
  export declare class MPDebugOverlayColors {
33
86
  /**
@@ -67,9 +120,10 @@ export declare class MPDebugOverlayColors {
67
120
  * `overlayColors` to `null` to disable the overlay while keeping `MPDebugOptions`
68
121
  * available for future debug features.
69
122
  *
70
- * Debug features only render when `__DEV__` is `true`. In production bundles
71
- * (`__DEV__ === false`), `debugOptions` is dropped before reaching the native SDK so
72
- * the overlay never ships to end users.
123
+ * `debugOptions` reaches the native SDK in every bundle, exactly as it would if you
124
+ * configured it natively. Each feature decides for itself what a release build may do:
125
+ * the overlay is restricted to debuggable builds by the native SDKs, while
126
+ * {@link MPDebugOptions.wireframeEmitter} runs wherever you configure it.
73
127
  */
74
128
  export declare class MPDebugOptions {
75
129
  /**
@@ -78,7 +132,185 @@ export declare class MPDebugOptions {
78
132
  * - **Default:** `new MPDebugOverlayColors()` (overlay enabled with default colors)
79
133
  */
80
134
  overlayColors: MPDebugOverlayColors | null;
81
- constructor({ overlayColors, }?: Partial<MPDebugOptions>);
135
+ /**
136
+ * Hands each captured wireframe back to JavaScript as it is captured, so you can check
137
+ * what you are sending while you develop.
138
+ *
139
+ * You get exactly the elements that go to Mixpanel, plus the reason each one's text was
140
+ * kept or removed. Nothing delivered here leaves the device.
141
+ *
142
+ * This *observes* wireframe capture; it does not enable it. Wireframes are only captured
143
+ * when {@link MPSessionReplayConfig.wireframesOptions} is set, so a callback on its own is
144
+ * harmless but never fires.
145
+ *
146
+ * It runs in whichever bundle you configure it in, matching the native SDKs. Nothing it
147
+ * delivers leaves the device, but building each snapshot is work the SDK otherwise skips
148
+ * and every frame crosses the bridge — so leave it unset once you are done checking.
149
+ *
150
+ * Configuration only, and deliberately so: declaring the callback is what turns snapshot
151
+ * building on, so there is no way to pay for the work with nothing listening. Set it before
152
+ * {@link MPSessionReplay.initialize}, which is where the destination is attached — a later
153
+ * `initialize` replaces it, and there is no runtime subscribe.
154
+ *
155
+ * Snapshots arrive on a background thread natively and are delivered one per frame, so a
156
+ * slow callback queues work on the bridge. Keep it cheap.
157
+ *
158
+ * ```ts
159
+ * config.debugOptions = new MPDebugOptions({
160
+ * wireframeEmitter: (frame) => {
161
+ * const withText = frame.elements.filter((e) => e.text !== null).length;
162
+ * console.log(`[wireframe] ${frame.elements.length} elements, ${withText} with text`);
163
+ * },
164
+ * });
165
+ * ```
166
+ *
167
+ * - **Default:** `null` (no snapshots are built)
168
+ */
169
+ wireframeEmitter: ((snapshot: MPWireframeSnapshot) => void) | null;
170
+ constructor({ overlayColors, wireframeEmitter, }?: Partial<MPDebugOptions>);
171
+ }
172
+ /**
173
+ * A rule that rewrites or drops the text of a wireframe element when it matches.
174
+ *
175
+ * Build rules with the {@link MPSensitiveRule} factories rather than by hand — the object
176
+ * shape below is the wire format the native SDKs decode, not an API to write literals
177
+ * against.
178
+ *
179
+ * Rules run in the order you list them in {@link MPWireframesOptions.sensitiveRules},
180
+ * after the SDK's own masking, over whatever text is left — including text you declared
181
+ * with the `wireframeText` prop on {@link MPSessionReplayView}. A matching strip rule
182
+ * drops the text and stops immediately; a matching redact rule rewrites the text, and any
183
+ * rule after it sees the rewritten value.
184
+ */
185
+ export type MPSensitiveRule = {
186
+ type: 'redact';
187
+ text: string;
188
+ replacement: string;
189
+ } | {
190
+ type: 'strip';
191
+ text: string;
192
+ } | {
193
+ type: 'redactRegex';
194
+ regex: RegExp;
195
+ replacement: string;
196
+ } | {
197
+ type: 'stripRegex';
198
+ regex: RegExp;
199
+ };
200
+ /** Replacement used by the redact rules when you do not supply one. */
201
+ export declare const MP_DEFAULT_REPLACEMENT = "[REDACTED]";
202
+ /**
203
+ * Factories for the four {@link MPSensitiveRule} variants.
204
+ *
205
+ * ```ts
206
+ * new MPWireframesOptions({
207
+ * sensitiveRules: [
208
+ * MPSensitiveRule.strip('password'),
209
+ * MPSensitiveRule.redactRegex(/[\w.+-]+@[\w-]+\.[\w.]+/g, '[EMAIL]'),
210
+ * ],
211
+ * });
212
+ * ```
213
+ */
214
+ export declare const MPSensitiveRule: {
215
+ /**
216
+ * Replaces case-insensitive substring matches of `text` with `replacement`, leaving the
217
+ * surrounding text intact.
218
+ */
219
+ redact(text: string, replacement?: string): MPSensitiveRule;
220
+ /** Drops the element's text entirely if it contains `text` (case-insensitive). */
221
+ strip(text: string): MPSensitiveRule;
222
+ /**
223
+ * Replaces matches of `regex` with `replacement`, leaving surrounding text intact.
224
+ *
225
+ * Only the `i`, `m` and `s` flags carry over to native; see
226
+ * {@link MPWireframesOptions} for what the regex itself is subject to.
227
+ */
228
+ redactRegex(regex: RegExp, replacement?: string): MPSensitiveRule;
229
+ /** Drops the element's text entirely if `regex` finds a match anywhere in the text. */
230
+ stripRegex(regex: RegExp): MPSensitiveRule;
231
+ };
232
+ /**
233
+ * Enables wireframe capture for Session Replay.
234
+ *
235
+ * **Beta.** Wireframes are in beta. Before shipping to production, inspect the wireframes
236
+ * your app produces with {@link MPDebugOptions.wireframeEmitter} and confirm that no
237
+ * sensitive information is captured.
238
+ *
239
+ * A wireframe is a lightweight text outline of a screen: the visible elements, what kind
240
+ * each one is (text, button, input, image), what it says, and where it sits. One is
241
+ * captured alongside each screenshot, which lets Mixpanel summarize what your users saw
242
+ * and did without anyone having to watch the replay.
243
+ *
244
+ * Pass one to {@link MPSessionReplayConfig.wireframesOptions} to turn wireframes on.
245
+ * Leave it `null` — the default — and none are captured.
246
+ *
247
+ * Mixpanel can also turn wireframe capture off for a project from the server. The native
248
+ * SDKs honor that switch: the rest of session replay keeps recording, only the wireframe
249
+ * payload is dropped, and the reason is logged at init.
250
+ *
251
+ * ### Your masking settings are respected
252
+ *
253
+ * Anything hidden in the replay video is also removed from the wireframe. The element is
254
+ * still listed so the shape of the screen is preserved, but its text is dropped. That
255
+ * includes anything inside a `<MPSessionReplayView sensitive>`, anything covered by
256
+ * {@link MPSessionReplayConfig.autoMaskedViews}, every `TextInput`, and anything sitting
257
+ * underneath a masked area even if it was never marked sensitive itself.
258
+ *
259
+ * Note what this means for the defaults: `autoMaskedViews` masks `Text` out of the box, so
260
+ * with the default configuration every element ships as a textless shell. Narrow
261
+ * `autoMaskedViews` (and mask what matters with `<MPSessionReplayView sensitive>`) for
262
+ * wireframes to carry readable copy.
263
+ *
264
+ * ### Describing an element yourself
265
+ *
266
+ * The `wireframeText` prop on {@link MPSessionReplayView} supplies the text for an element
267
+ * — useful for custom-drawn content, or anywhere the text picked up automatically isn't
268
+ * meaningful. Because you authored it rather than the SDK scraping it off the screen, it is
269
+ * sent even for an element you've masked in the video.
270
+ *
271
+ * ### Catching sensitive content by pattern
272
+ *
273
+ * {@link sensitiveRules} match on the text itself and run last, over everything above,
274
+ * including text you supplied with `wireframeText`.
275
+ */
276
+ export declare class MPWireframesOptions {
277
+ /**
278
+ * Rules applied to each element's text before it is sent, in the order you declare them.
279
+ * Elements are always kept; only their text is affected.
280
+ *
281
+ * - A matching strip rule drops the text and stops — no later rule runs.
282
+ * - Redact rules build on one another: a rule declared later sees the result of the ones
283
+ * before it, not the original text.
284
+ *
285
+ * A `RegExp` is compiled by the platform's own engine — `java.util.regex` on Android,
286
+ * ICU on iOS — not by JavaScript. A pattern that is valid JS may behave differently, or
287
+ * be rejected outright, on one of them; a rejected pattern fails `initialize` rather
288
+ * than silently matching nothing. Only the `i`, `m` and `s` flags cross the bridge (they
289
+ * are the three that mean the same thing in all three engines); `g` is implied, since
290
+ * every match is replaced, and any other flag is ignored with a warning. Replacement
291
+ * strings are literal — `$1` is emitted verbatim, not as a back-reference.
292
+ *
293
+ * - **Default:** `[]`
294
+ */
295
+ sensitiveRules: MPSensitiveRule[];
296
+ /**
297
+ * Whether an element with no text of its own may fall back to its accessibility label
298
+ * (React Native's `accessibilityLabel` prop). Off by default: a label is not drawn on
299
+ * screen, so unlike visible text you cannot confirm what it contains by watching the
300
+ * replay, and labels sometimes hold more than what is shown.
301
+ *
302
+ * Turn it on if you want icons and image buttons named. For an icon-only control the
303
+ * label is usually the only description of what the element is for, and with the fallback
304
+ * off it is sent as a bare shell instead — `wireframeText` is then the only way to
305
+ * describe it.
306
+ *
307
+ * The label is only ever a fallback. Text you set with `wireframeText` wins over it, an
308
+ * element's own visible text wins over it, and a masked element stays textless either way.
309
+ *
310
+ * - **Default:** `false`
311
+ */
312
+ useAccessibilityLabelFallback: boolean;
313
+ constructor({ sensitiveRules, useAccessibilityLabelFallback, }?: Partial<MPWireframesOptions>);
82
314
  }
83
315
  export declare class MPSessionReplayConfig {
84
316
  /**
@@ -161,9 +393,10 @@ export declare class MPSessionReplayConfig {
161
393
  * masking coverage during development. Pass `new MPDebugOptions()` to enable the
162
394
  * overlay with default colors, or customize via `MPDebugOverlayColors`.
163
395
  *
164
- * `debugOptions` is only honored when `__DEV__` is `true`. In production bundles
165
- * it is dropped before reaching the native SDK, so it is safe to leave the option
166
- * set unconditionally — the overlay will not render for end users.
396
+ * The overlay only renders in a debuggable build — the native SDKs enforce that, so it
397
+ * is safe to leave the option set unconditionally and the overlay will not reach end
398
+ * users. {@link MPDebugOptions.wireframeEmitter}, the other member, has no such
399
+ * restriction and runs wherever you configure it.
167
400
  *
168
401
  * - **Default:** `null` (disabled)
169
402
  */
@@ -183,7 +416,23 @@ export declare class MPSessionReplayConfig {
183
416
  * - **Default:** `MPDataResidency.US` (`https://api.mixpanel.com`)
184
417
  */
185
418
  serverURL: string;
186
- constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, remoteSettingsMode, debugOptions, serverURL, }?: Partial<MPSessionReplayConfig>);
419
+ /**
420
+ * Enables wireframe capture: a text outline of each captured screen — the visible
421
+ * elements, what they say, and where they sit — recorded alongside the replay so
422
+ * sessions can be summarized without watching them.
423
+ *
424
+ * Pass `new MPWireframesOptions()` to turn it on with the defaults, or customize the
425
+ * content rules and the accessibility-label fallback. Your masking settings apply to
426
+ * it; see {@link MPWireframesOptions}.
427
+ *
428
+ * **Beta.** Wireframes are in beta. Before shipping to production, inspect the wireframes
429
+ * your app produces and confirm that no sensitive information is captured; see
430
+ * {@link MPWireframesOptions}.
431
+ *
432
+ * - **Default:** `null` (wireframe capture disabled)
433
+ */
434
+ wireframesOptions: MPWireframesOptions | null;
435
+ constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, remoteSettingsMode, debugOptions, serverURL, wireframesOptions, }?: Partial<MPSessionReplayConfig>);
187
436
  private transformMaskValueForPlatform;
188
437
  toJSON(): string;
189
438
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAGvE,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,oBAAY,iCAAiC;IAC3C,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,MAAM,CAAC,CAOxE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBAAa,oBAAoB;IAC/B;;;;;OAKG;IACH,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,EAAE,UAAU,GAAG,IAAI,CAAC;IAEjC;;;;;OAKG;IACH,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,KAAK,EAA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1,6 @@
1
1
  {
2
2
  "name": "@mixpanel/react-native-session-replay",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Official React Native turbo module for Mixpanel Session Replay",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -1,7 +1,40 @@
1
1
  import { requireNativeComponent, type ViewProps } from 'react-native';
2
2
 
3
3
  interface MixpanelSessionReplayViewProps extends ViewProps {
4
+ /**
5
+ * Masks everything inside this view in the replay video, and drops the text of every
6
+ * wireframe element under it.
7
+ *
8
+ * Controls pixels. Orthogonal to {@link wireframeText}, which controls what the
9
+ * wireframe *says*; the two compose.
10
+ */
4
11
  sensitive?: boolean;
12
+
13
+ /**
14
+ * Declares the text recorded for this view in the wireframe.
15
+ *
16
+ * **Beta.** Wireframes are in beta; see `MPWireframesOptions` for what to check before
17
+ * shipping to production.
18
+ *
19
+ * Use it to describe content the SDK can't read — custom-drawn views, charts, canvases —
20
+ * or to attach an analytical label. Declared text wins over the view's own visible text
21
+ * and over its accessibility label.
22
+ *
23
+ * **It is sent even when the view is masked.** Masking hides the pixels while the
24
+ * declared text still describes the view for the summary. Because you authored it rather
25
+ * than the SDK scraping it off the screen, making sure the text is not itself sensitive
26
+ * is up to you — if it could be, leave it off.
27
+ *
28
+ * ```tsx
29
+ * <MPSessionReplayView sensitive wireframeText="Card number">
30
+ * <CardNumberField />
31
+ * </MPSessionReplayView>
32
+ * ```
33
+ *
34
+ * Requires `wireframesOptions` on the config; without it no wireframes are captured and
35
+ * this prop does nothing. Blank strings are ignored.
36
+ */
37
+ wireframeText?: string;
5
38
  }
6
39
 
7
40
  export const MPSessionReplayView =
@@ -14,6 +14,13 @@ export interface Spec extends TurboModule {
14
14
  identify(distinctId: string): Promise<void>;
15
15
  getReplayId(): Promise<string | null>;
16
16
  flush(): Promise<void>;
17
+
18
+ // Event-emitter plumbing for the wireframe debug channel. `NativeEventEmitter`
19
+ // requires both on a TurboModule; on iOS they are inherited from `RCTEventEmitter`,
20
+ // and on Android they are no-ops because events go out over `RCTDeviceEventEmitter`,
21
+ // which needs no per-listener registration.
22
+ addListener(eventName: string): void;
23
+ removeListeners(count: number): void;
17
24
  }
18
25
 
19
26
  // Type declaration for global to include __turboModuleProxy