@plushanalytics/react-native-session-replay 3.0.0 → 3.0.2

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 (40) hide show
  1. package/README.md +55 -2
  2. package/android/src/main/java/com/posthogreactnativesessionreplay/PosthogReactNativeSessionReplayModule.kt +68 -27
  3. package/ios/PosthogReactNativeSessionReplay.mm +3 -0
  4. package/ios/PosthogReactNativeSessionReplay.swift +58 -31
  5. package/lib/commonjs/adapters/mobileReplayAdapter.js +55 -18
  6. package/lib/commonjs/adapters/mobileReplayAdapter.js.map +1 -1
  7. package/lib/commonjs/client.js +2 -1
  8. package/lib/commonjs/client.js.map +1 -1
  9. package/lib/commonjs/nativeBridge.js +5 -0
  10. package/lib/commonjs/nativeBridge.js.map +1 -1
  11. package/lib/module/adapters/mobileReplayAdapter.js +55 -18
  12. package/lib/module/adapters/mobileReplayAdapter.js.map +1 -1
  13. package/lib/module/client.js +2 -1
  14. package/lib/module/client.js.map +1 -1
  15. package/lib/module/nativeBridge.js +4 -0
  16. package/lib/module/nativeBridge.js.map +1 -1
  17. package/lib/typescript/commonjs/src/adapters/mobileReplayAdapter.d.ts +2 -1
  18. package/lib/typescript/commonjs/src/adapters/mobileReplayAdapter.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/src/client.d.ts.map +1 -1
  20. package/lib/typescript/commonjs/src/index.d.ts +1 -1
  21. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/src/nativeBridge.d.ts +2 -0
  23. package/lib/typescript/commonjs/src/nativeBridge.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/src/types.d.ts +16 -5
  25. package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
  26. package/lib/typescript/module/src/adapters/mobileReplayAdapter.d.ts +2 -1
  27. package/lib/typescript/module/src/adapters/mobileReplayAdapter.d.ts.map +1 -1
  28. package/lib/typescript/module/src/client.d.ts.map +1 -1
  29. package/lib/typescript/module/src/index.d.ts +1 -1
  30. package/lib/typescript/module/src/index.d.ts.map +1 -1
  31. package/lib/typescript/module/src/nativeBridge.d.ts +2 -0
  32. package/lib/typescript/module/src/nativeBridge.d.ts.map +1 -1
  33. package/lib/typescript/module/src/types.d.ts +16 -5
  34. package/lib/typescript/module/src/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/adapters/mobileReplayAdapter.ts +112 -19
  37. package/src/client.ts +2 -1
  38. package/src/index.tsx +2 -0
  39. package/src/nativeBridge.ts +8 -1
  40. package/src/types.ts +19 -5
@@ -40,6 +40,10 @@ export function endSession(): Promise<void> {
40
40
  return PosthogReactNativeSessionReplay.endSession();
41
41
  }
42
42
 
43
+ export function flush(): Promise<void> {
44
+ return PosthogReactNativeSessionReplay.flush();
45
+ }
46
+
43
47
  export function isEnabled(): Promise<boolean> {
44
48
  return PosthogReactNativeSessionReplay.isEnabled();
45
49
  }
@@ -56,13 +60,15 @@ export interface PostHogReactNativeSessionReplayModule {
56
60
  sessionId: string,
57
61
  sdkOptions: { [key: string]: any }, // options from SDK such as apiKey
58
62
  sdkReplayConfig: { [key: string]: any }, // config from SDK
59
- decideReplayConfig: { [key: string]: any } // config from Decide API
63
+ decideReplayConfig: { [key: string]: any } // replay runtime config
60
64
  ) => Promise<void>;
61
65
 
62
66
  startSession: (sessionId: string) => Promise<void>;
63
67
 
64
68
  endSession: () => Promise<void>;
65
69
 
70
+ flush: () => Promise<void>;
71
+
66
72
  isEnabled: () => Promise<boolean>;
67
73
 
68
74
  identify: (distinctId: string, anonymousId: string) => Promise<void>;
@@ -72,6 +78,7 @@ const PostHogReactNativeSessionReplay: PostHogReactNativeSessionReplayModule = {
72
78
  start,
73
79
  startSession,
74
80
  endSession,
81
+ flush,
75
82
  isEnabled,
76
83
  identify,
77
84
  };
package/src/types.ts CHANGED
@@ -18,15 +18,27 @@ import type {
18
18
  UnifiedBatchPayload
19
19
  } from "@plushanalytics/javascript";
20
20
 
21
- export type MobileReplayConfig = {
22
- maskAllTextInputs?: boolean;
23
- maskAllImages?: boolean;
24
- maskAllSandboxedViews?: boolean;
21
+ export type SessionReplayMaskingConfig = {
22
+ textInputs?: boolean;
23
+ images?: boolean;
24
+ sandboxedViews?: boolean;
25
+ };
26
+
27
+ export type SessionReplayConfig = {
28
+ enabled?: boolean;
29
+ masking?: SessionReplayMaskingConfig;
25
30
  captureLog?: boolean;
26
31
  captureNetworkTelemetry?: boolean;
27
32
  throttleDelayMs?: number;
28
33
  };
29
34
 
35
+ export type MobileReplayConfig = SessionReplayConfig & {
36
+ // Legacy flat options are still supported for backward compatibility.
37
+ maskAllTextInputs?: boolean;
38
+ maskAllImages?: boolean;
39
+ maskAllSandboxedViews?: boolean;
40
+ };
41
+
30
42
  export type SessionRecordingOptions = CoreSessionRecordingOptions & {
31
43
  // Used by the bundled replay adapter (optional, replay still works without these when you pass a custom recorder).
32
44
  replayHost?: string;
@@ -34,7 +46,9 @@ export type SessionRecordingOptions = CoreSessionRecordingOptions & {
34
46
  replayConfig?: MobileReplayConfig;
35
47
  };
36
48
 
37
- export type PlushAnalyticsConfig = CoreConfig;
49
+ export type PlushAnalyticsConfig = CoreConfig & {
50
+ sessionReplayConfig?: SessionReplayConfig;
51
+ };
38
52
 
39
53
  export type {
40
54
  EventEnvelope,