@posthog/react-native-plugin 2.0.0 → 2.1.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/LICENSE CHANGED
@@ -324,3 +324,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
324
324
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
325
325
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
326
326
  SOFTWARE.
327
+
328
+ ---
329
+
330
+ Some files in this codebase contain code from MCPCat/mcpcat-typescript-sdk.
331
+ In such cases it is explicitly stated in the file header. This license only applies to the relevant code in such cases.
332
+
333
+ MIT License
334
+
335
+ Copyright (c) 2025 MCPcat
336
+
337
+ Permission is hereby granted, free of charge, to any person obtaining a copy
338
+ of this software and associated documentation files (the "Software"), to deal
339
+ in the Software without restriction, including without limitation the rights
340
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
341
+ copies of the Software, and to permit persons to whom the Software is
342
+ furnished to do so, subject to the following conditions:
343
+
344
+ The above copyright notice and this permission notice shall be included in all
345
+ copies or substantial portions of the Software.
346
+
347
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
348
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
349
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
350
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
351
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
352
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
353
+ SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,9 @@
1
- # @posthog/react-native-plugin
1
+ # PostHog React Native example
2
2
 
3
- PostHog React Native plugin for iOS and Android integrations.
3
+ Please see the main [PostHog docs](https://posthog.com/docs).
4
4
 
5
- This package bridges React Native to the native PostHog SDKs, enabling session replay and native error tracking. It is consumed automatically by [`posthog-react-native`](https://github.com/PostHog/posthog-js/tree/main/packages/react-native) when installed you do not call it directly.
5
+ SDK usage examples and code snippets live in the official documentation so they stay up to date.
6
6
 
7
- ## Installation
7
+ ## Documentation
8
8
 
9
- ```sh
10
- npm install posthog-react-native @posthog/react-native-plugin
11
- # or
12
- yarn add posthog-react-native @posthog/react-native-plugin
13
- ```
14
-
15
- iOS requires a pod install:
16
-
17
- ```sh
18
- cd ios && pod install
19
- ```
20
-
21
- ## Native error tracking
22
-
23
- Native error tracking is controlled by the React Native SDK option:
24
-
25
- ```ts
26
- new PostHog('<ph_project_api_key>', {
27
- errorTracking: {
28
- nativeAutocapture: true,
29
- },
30
- })
31
- ```
9
+ - [React Native library docs](https://posthog.com/docs/libraries/react-native)
@@ -85,6 +85,6 @@ dependencies {
85
85
  //noinspection GradleDynamicVersion
86
86
  implementation "com.facebook.react:react-native:+"
87
87
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
88
- implementation "com.posthog:posthog-android:3.40.2"
88
+ implementation "com.posthog:posthog-android:3.51.0"
89
89
  }
90
90
 
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.ReadableMap
9
9
  import com.facebook.react.bridge.UiThreadUtil
10
10
  import com.posthog.PostHog
11
11
  import com.posthog.PostHogConfig
12
+ import com.posthog.PostHogEvent
12
13
  import com.posthog.android.PostHogAndroid
13
14
  import com.posthog.android.PostHogAndroidConfig
14
15
  import com.posthog.internal.PostHogPreferences
@@ -40,6 +41,7 @@ class PosthogReactNativePluginModule(
40
41
  sdkReplayConfig = getMap(sessionReplayConfig, "sdkReplayConfig"),
41
42
  decideReplayConfig = getMap(sessionReplayConfig, "decideReplayConfig"),
42
43
  nativeErrorTrackingAutocapture = getBoolean(errorTrackingConfig, "nativeAutocapture", false),
44
+ exceptionStepsConfig = getMap(errorTrackingConfig, "exceptionSteps"),
43
45
  promise = promise,
44
46
  )
45
47
  }
@@ -60,6 +62,7 @@ class PosthogReactNativePluginModule(
60
62
  sdkReplayConfig = sdkReplayConfig,
61
63
  decideReplayConfig = decideReplayConfig,
62
64
  nativeErrorTrackingAutocapture = false,
65
+ exceptionStepsConfig = null,
63
66
  promise = promise,
64
67
  )
65
68
  }
@@ -72,6 +75,7 @@ class PosthogReactNativePluginModule(
72
75
  sdkReplayConfig: ReadableMap?,
73
76
  decideReplayConfig: ReadableMap?,
74
77
  nativeErrorTrackingAutocapture: Boolean,
78
+ exceptionStepsConfig: ReadableMap?,
75
79
  promise: Promise,
76
80
  ) {
77
81
  val initRunnable =
@@ -98,31 +102,41 @@ class PosthogReactNativePluginModule(
98
102
  flushAt = theFlushAt
99
103
  errorTrackingConfig.autoCapture = nativeErrorTrackingAutocapture
100
104
 
101
- if (sessionReplayEnabled) {
102
- val maskAllTextInputs = getBoolean(sdkReplayConfig, "maskAllTextInputs", DEFAULT_MASK_ALL_TEXT_INPUTS)
103
- val maskAllImages = getBoolean(sdkReplayConfig, "maskAllImages", DEFAULT_MASK_ALL_IMAGES)
104
- val captureLog = getBoolean(sdkReplayConfig, "captureLog", DEFAULT_CAPTURE_LOG)
105
-
106
- // read throttleDelayMs and use androidDebouncerDelayMs as a fallback for back compatibility
107
- val throttleDelayMs =
108
- when {
109
- hasKey(sdkReplayConfig, "throttleDelayMs") -> getInt(sdkReplayConfig, "throttleDelayMs", DEFAULT_THROTTLE_DELAY_MS)
110
- hasKey(sdkReplayConfig, "androidDebouncerDelayMs") -> getInt(sdkReplayConfig, "androidDebouncerDelayMs", DEFAULT_THROTTLE_DELAY_MS)
111
- else -> DEFAULT_THROTTLE_DELAY_MS
112
- }
113
-
114
- sessionReplay = true
115
- sessionReplayConfig.screenshot = true
116
- sessionReplayConfig.captureLogcat = captureLog
117
- sessionReplayConfig.throttleDelayMs = throttleDelayMs.toLong()
118
- sessionReplayConfig.maskAllImages = maskAllImages
119
- sessionReplayConfig.maskAllTextInputs = maskAllTextInputs
120
- sessionReplayConfig.sampleRate = getDoubleOrNull(sdkReplayConfig, "sampleRate")
121
-
122
- val endpoint = getString(decideReplayConfig, "endpoint", "")
123
- if (endpoint.isNotEmpty()) {
124
- snapshotEndpoint = endpoint
105
+ // Keep the native exception-steps buffer aligned with the JS layer (one logical buffer).
106
+ // Absent keys fall back to the native defaults the helpers receive.
107
+ errorTrackingConfig.exceptionSteps.enabled = getBoolean(exceptionStepsConfig, "enabled", errorTrackingConfig.exceptionSteps.enabled)
108
+ errorTrackingConfig.exceptionSteps.maxBytes = getInt(exceptionStepsConfig, "maxBytes", errorTrackingConfig.exceptionSteps.maxBytes)
109
+
110
+ // React Native rethrows fatal JS errors natively as JavascriptException.
111
+ // The JS layer already captured them, so drop the native duplicate.
112
+ addBeforeSend { event -> if (isReactNativeFatalJsError(event)) null else event }
113
+
114
+ // Always apply the session replay configuration so that recording started later
115
+ // (e.g. startRecording or a linked feature flag) uses the right mode and masking;
116
+ // sessionReplayEnabled only controls whether recording starts at setup.
117
+ val maskAllTextInputs = getBoolean(sdkReplayConfig, "maskAllTextInputs", DEFAULT_MASK_ALL_TEXT_INPUTS)
118
+ val maskAllImages = getBoolean(sdkReplayConfig, "maskAllImages", DEFAULT_MASK_ALL_IMAGES)
119
+ val captureLog = getBoolean(sdkReplayConfig, "captureLog", DEFAULT_CAPTURE_LOG)
120
+
121
+ // read throttleDelayMs and use androidDebouncerDelayMs as a fallback for back compatibility
122
+ val throttleDelayMs =
123
+ when {
124
+ hasKey(sdkReplayConfig, "throttleDelayMs") -> getInt(sdkReplayConfig, "throttleDelayMs", DEFAULT_THROTTLE_DELAY_MS)
125
+ hasKey(sdkReplayConfig, "androidDebouncerDelayMs") -> getInt(sdkReplayConfig, "androidDebouncerDelayMs", DEFAULT_THROTTLE_DELAY_MS)
126
+ else -> DEFAULT_THROTTLE_DELAY_MS
125
127
  }
128
+
129
+ sessionReplay = sessionReplayEnabled
130
+ sessionReplayConfig.screenshot = true
131
+ sessionReplayConfig.captureLogcat = captureLog
132
+ sessionReplayConfig.throttleDelayMs = throttleDelayMs.toLong()
133
+ sessionReplayConfig.maskAllImages = maskAllImages
134
+ sessionReplayConfig.maskAllTextInputs = maskAllTextInputs
135
+ sessionReplayConfig.sampleRate = getDoubleOrNull(sdkReplayConfig, "sampleRate")
136
+
137
+ val endpoint = getString(decideReplayConfig, "endpoint", "")
138
+ if (endpoint.isNotEmpty()) {
139
+ snapshotEndpoint = endpoint
126
140
  }
127
141
 
128
142
  if (theSdkVersion.isNotEmpty()) {
@@ -240,6 +254,24 @@ class PosthogReactNativePluginModule(
240
254
  }
241
255
  }
242
256
 
257
+ @ReactMethod
258
+ fun addExceptionStep(
259
+ message: String,
260
+ properties: ReadableMap?,
261
+ promise: Promise,
262
+ ) {
263
+ try {
264
+ // ReadableMap.toHashMap() is HashMap<String, Any?>; the native API takes Map<String, Any>?.
265
+ @Suppress("UNCHECKED_CAST")
266
+ val nativeProperties = properties?.toHashMap() as Map<String, Any>?
267
+ PostHog.addExceptionStep(message, nativeProperties)
268
+ } catch (e: Throwable) {
269
+ logError("addExceptionStep", e)
270
+ } finally {
271
+ promise.resolve(null)
272
+ }
273
+ }
274
+
243
275
  private fun getMap(
244
276
  map: ReadableMap?,
245
277
  key: String,
@@ -280,6 +312,16 @@ class PosthogReactNativePluginModule(
280
312
  key: String,
281
313
  ): Double? = runCatching { if (hasKey(map, key)) map?.getDouble(key) else null }.getOrNull()
282
314
 
315
+ private fun isReactNativeFatalJsError(event: PostHogEvent): Boolean {
316
+ if (event.event != "\$exception") return false
317
+ val exceptionList = event.properties?.get("\$exception_list") as? List<*> ?: return false
318
+ return exceptionList.any { item ->
319
+ val exception = item as? Map<*, *> ?: return@any false
320
+ exception["type"] == "JavascriptException" &&
321
+ (exception["module"] as? String)?.startsWith("com.facebook.react") == true
322
+ }
323
+ }
324
+
283
325
  private fun logError(
284
326
  method: String,
285
327
  error: Throwable,
@@ -37,6 +37,11 @@ RCT_EXTERN_METHOD(startRecording:(BOOL)resumeCurrent
37
37
  RCT_EXTERN_METHOD(stopRecording:(RCTPromiseResolveBlock)resolve
38
38
  withRejecter:(RCTPromiseRejectBlock)reject)
39
39
 
40
+ RCT_EXTERN_METHOD(addExceptionStep:(NSString)message
41
+ withProperties:(NSDictionary)properties
42
+ withResolver:(RCTPromiseResolveBlock)resolve
43
+ withRejecter:(RCTPromiseRejectBlock)reject)
44
+
40
45
  + (BOOL)requiresMainQueueSetup
41
46
  {
42
47
  return NO;
@@ -5,6 +5,36 @@ private func hedgeLog(_ message: String) {
5
5
  print("[PostHog] \(message)")
6
6
  }
7
7
 
8
+ // Deduplication works on Android (both architectures) and iOS (old architecture only).
9
+ // On the iOS new architecture, fatal JS exception events surface as a generic SIGABRT
10
+ // crash event with no JS-error text in any field, so they currently cannot be filtered.
11
+ private let fatalJsErrorMarkers = ["Unhandled JS Exception", "ExceptionsManager.reportException", "facebook::jsi::JSError"]
12
+
13
+ private func containsFatalJsErrorMarker(_ text: String?) -> Bool {
14
+ guard let text else { return false }
15
+ return fatalJsErrorMarkers.contains { text.contains($0) }
16
+ }
17
+
18
+ private func isReactNativeFatalJsError(_ event: PostHogEvent) -> Bool {
19
+ guard event.event == "$exception",
20
+ let exceptionList = event.properties["$exception_list"] as? [[String: Any]]
21
+ else { return false }
22
+ return exceptionList.contains { exception in
23
+ if containsFatalJsErrorMarker(exception["type"] as? String) {
24
+ return true
25
+ }
26
+ if containsFatalJsErrorMarker(exception["value"] as? String) {
27
+ return true
28
+ }
29
+ // New-architecture RN rethrows fatal JS errors as a C++ jsi::JSError (SIGABRT);
30
+ // the JS-error text only survives in the signal's crash-info message.
31
+ let mechanism = exception["mechanism"] as? [String: Any]
32
+ let meta = mechanism?["meta"] as? [String: Any]
33
+ let signal = meta?["signal"] as? [String: Any]
34
+ return containsFatalJsErrorMarker(signal?["crash_info_message"] as? String)
35
+ }
36
+ }
37
+
8
38
  @objc(PosthogReactNativePlugin)
9
39
  class PosthogReactNativePlugin: NSObject {
10
40
  private var config: PostHogConfig?
@@ -16,6 +46,7 @@ class PosthogReactNativePlugin: NSObject {
16
46
  ) {
17
47
  let sessionReplayConfig = pluginConfig["sessionReplay"] as? [String: Any] ?? [:]
18
48
  let errorTrackingConfig = pluginConfig["errorTracking"] as? [String: Any] ?? [:]
49
+ let exceptionStepsConfig = errorTrackingConfig["exceptionSteps"] as? [String: Any] ?? [:]
19
50
 
20
51
  setupNativeSdk(
21
52
  method: "setup",
@@ -25,6 +56,7 @@ class PosthogReactNativePlugin: NSObject {
25
56
  sdkReplayConfig: sessionReplayConfig["sdkReplayConfig"] as? [String: Any] ?? [:],
26
57
  decideReplayConfig: sessionReplayConfig["decideReplayConfig"] as? [String: Any] ?? [:],
27
58
  nativeErrorTrackingAutocapture: errorTrackingConfig["nativeAutocapture"] as? Bool ?? false,
59
+ exceptionStepsConfig: exceptionStepsConfig,
28
60
  resolve: resolve
29
61
  )
30
62
  }
@@ -43,6 +75,7 @@ class PosthogReactNativePlugin: NSObject {
43
75
  sdkReplayConfig: sdkReplayConfig,
44
76
  decideReplayConfig: decideReplayConfig,
45
77
  nativeErrorTrackingAutocapture: false,
78
+ exceptionStepsConfig: [:],
46
79
  resolve: resolve
47
80
  )
48
81
  }
@@ -55,6 +88,7 @@ class PosthogReactNativePlugin: NSObject {
55
88
  sdkReplayConfig: [String: Any],
56
89
  decideReplayConfig: [String: Any],
57
90
  nativeErrorTrackingAutocapture: Bool,
91
+ exceptionStepsConfig: [String: Any],
58
92
  resolve: RCTPromiseResolveBlock
59
93
  ) {
60
94
  if sessionId.isEmpty {
@@ -78,47 +112,62 @@ class PosthogReactNativePlugin: NSObject {
78
112
  config.debug = debug
79
113
  config.errorTrackingConfig.autoCapture = nativeErrorTrackingAutocapture
80
114
 
115
+ // Keep the native exception-steps buffer aligned with the JS layer (one logical buffer).
116
+ if let enabled = exceptionStepsConfig["enabled"] as? Bool {
117
+ config.errorTrackingConfig.exceptionSteps.enabled = enabled
118
+ }
119
+ if let maxBytes = exceptionStepsConfig["maxBytes"] as? Int {
120
+ config.errorTrackingConfig.exceptionSteps.maxBytes = maxBytes
121
+ }
122
+
123
+ // React Native rethrows fatal JS errors natively (RCTFatalException / ExceptionsManager).
124
+ // The JS layer already captured them, so drop the native duplicate.
125
+ config.setBeforeSend { event in
126
+ isReactNativeFatalJsError(event) ? nil : event
127
+ }
128
+
81
129
  if #available(iOS 15.0, *) {
82
130
  config.surveys = false
83
131
  }
84
132
 
85
- if sessionReplayEnabled {
86
- config.sessionReplay = true
87
- config.sessionReplayConfig.screenshotMode = true
133
+ // Always apply the session replay configuration so that recording started later
134
+ // (e.g. startRecording or a linked feature flag) uses the right mode and masking;
135
+ // sessionReplayEnabled only controls whether recording starts at setup.
136
+ config.sessionReplay = sessionReplayEnabled
137
+ config.sessionReplayConfig.screenshotMode = true
88
138
 
89
- let maskAllTextInputs = sdkReplayConfig["maskAllTextInputs"] as? Bool ?? true
90
- config.sessionReplayConfig.maskAllTextInputs = maskAllTextInputs
139
+ let maskAllTextInputs = sdkReplayConfig["maskAllTextInputs"] as? Bool ?? true
140
+ config.sessionReplayConfig.maskAllTextInputs = maskAllTextInputs
91
141
 
92
- let maskAllImages = sdkReplayConfig["maskAllImages"] as? Bool ?? true
93
- config.sessionReplayConfig.maskAllImages = maskAllImages
142
+ let maskAllImages = sdkReplayConfig["maskAllImages"] as? Bool ?? true
143
+ config.sessionReplayConfig.maskAllImages = maskAllImages
94
144
 
95
- let maskAllSandboxedViews = sdkReplayConfig["maskAllSandboxedViews"] as? Bool ?? true
96
- config.sessionReplayConfig.maskAllSandboxedViews = maskAllSandboxedViews
145
+ let maskAllSandboxedViews = sdkReplayConfig["maskAllSandboxedViews"] as? Bool ?? true
146
+ config.sessionReplayConfig.maskAllSandboxedViews = maskAllSandboxedViews
97
147
 
98
- // read throttleDelayMs and use iOSdebouncerDelayMs as a fallback for back compatibility
99
- let throttleDelayMs =
100
- (sdkReplayConfig["throttleDelayMs"] as? Int)
101
- ?? (sdkReplayConfig["iOSdebouncerDelayMs"] as? Int)
102
- ?? 1000
148
+ // read throttleDelayMs and use iOSdebouncerDelayMs as a fallback for back compatibility
149
+ let throttleDelayMs =
150
+ (sdkReplayConfig["throttleDelayMs"] as? Int)
151
+ ?? (sdkReplayConfig["iOSdebouncerDelayMs"] as? Int)
152
+ ?? 1000
103
153
 
104
- let timeInterval: TimeInterval = Double(throttleDelayMs) / 1000.0
105
- config.sessionReplayConfig.throttleDelay = timeInterval
154
+ let timeInterval: TimeInterval = Double(throttleDelayMs) / 1000.0
155
+ config.sessionReplayConfig.throttleDelay = timeInterval
106
156
 
107
- let captureNetworkTelemetry = sdkReplayConfig["captureNetworkTelemetry"] as? Bool ?? true
108
- config.sessionReplayConfig.captureNetworkTelemetry = captureNetworkTelemetry
157
+ let captureNetworkTelemetry = sdkReplayConfig["captureNetworkTelemetry"] as? Bool ?? true
158
+ config.sessionReplayConfig.captureNetworkTelemetry = captureNetworkTelemetry
109
159
 
110
- let captureLog = sdkReplayConfig["captureLog"] as? Bool ?? true
111
- config.sessionReplayConfig.captureLogs = captureLog
160
+ let captureLog = sdkReplayConfig["captureLog"] as? Bool ?? true
161
+ config.sessionReplayConfig.captureLogs = captureLog
112
162
 
113
- config.sessionReplayConfig.sampleRate = sdkReplayConfig["sampleRate"] as? NSNumber
163
+ config.sessionReplayConfig.sampleRate = sdkReplayConfig["sampleRate"] as? NSNumber
114
164
 
115
- let screenshotModeBackgroundCapture = sdkReplayConfig["screenshotModeBackgroundCapture"] as? Bool ?? false
116
- config.sessionReplayConfig.screenshotModeBackgroundCapture = screenshotModeBackgroundCapture
165
+ let screenshotModeBackgroundCapture = sdkReplayConfig["screenshotModeBackgroundCapture"] as? Bool ?? false
166
+ config.sessionReplayConfig.screenshotModeBackgroundCapture = screenshotModeBackgroundCapture
117
167
 
118
- let endpoint = decideReplayConfig["endpoint"] as? String ?? ""
119
- if !endpoint.isEmpty {
120
- config.snapshotEndpoint = endpoint
121
- }
168
+ let endpoint = decideReplayConfig["endpoint"] as? String ?? ""
169
+ if !endpoint.isEmpty {
170
+ config.snapshotEndpoint = endpoint
122
171
  }
123
172
 
124
173
  let distinctId = sdkOptions["distinctId"] as? String ?? ""
@@ -214,4 +263,13 @@ class PosthogReactNativePlugin: NSObject {
214
263
  PostHogSDK.shared.stopSessionRecording()
215
264
  resolve(nil)
216
265
  }
266
+
267
+ @objc(addExceptionStep:withProperties:withResolver:withRejecter:)
268
+ func addExceptionStep(
269
+ message: String, properties: [String: Any]?, resolve: RCTPromiseResolveBlock,
270
+ reject _: RCTPromiseRejectBlock
271
+ ) {
272
+ PostHogSDK.shared.addExceptionStep(message, properties: properties)
273
+ resolve(nil)
274
+ }
217
275
  }
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addExceptionStep = addExceptionStep;
6
7
  exports.default = void 0;
7
8
  exports.endSession = endSession;
8
9
  exports.identify = identify;
@@ -46,6 +47,9 @@ function startRecording(resumeCurrent) {
46
47
  function stopRecording() {
47
48
  return PosthogReactNativePlugin.stopRecording();
48
49
  }
50
+ function addExceptionStep(message, properties) {
51
+ return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {});
52
+ }
49
53
  const PostHogReactNativePlugin = {
50
54
  setup,
51
55
  start,
@@ -54,7 +58,8 @@ const PostHogReactNativePlugin = {
54
58
  isEnabled,
55
59
  identify,
56
60
  startRecording,
57
- stopRecording
61
+ stopRecording,
62
+ addExceptionStep
58
63
  };
59
64
  var _default = exports.default = PostHogReactNativePlugin;
60
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","PosthogReactNativePlugin","NativeModules","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","startRecording","resumeCurrent","stopRecording","PostHogReactNativePlugin","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,uFAAuF,GACvFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGC,0BAAa,CAACD,wBAAwB,GACnEC,0BAAa,CAACD,wBAAwB,GACtC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAmBE,SAASU,KAAKA,CACnBC,SAAiB,EACjBC,UAAuC,EACvCC,YAA4C,GAAG,CAAC,CAAC,EAClC;EACf,OAAOR,wBAAwB,CAACK,KAAK,CAACC,SAAS,EAAEC,UAAU,EAAEC,YAAY,CAAC;AAC5E;AAEO,SAASC,KAAKA,CACnBH,SAAiB,EACjBC,UAAuC,EACvCG,eAA4C,EAC5CC,kBAA+C,EAChC;EACf,OAAOX,wBAAwB,CAACS,KAAK,CAACH,SAAS,EAAEC,UAAU,EAAEG,eAAe,EAAEC,kBAAkB,CAAC;AACnG;AAEO,SAASC,YAAYA,CAACN,SAAiB,EAAiB;EAC7D,OAAON,wBAAwB,CAACY,YAAY,CAACN,SAAS,CAAC;AACzD;AAEO,SAASO,UAAUA,CAAA,EAAkB;EAC1C,OAAOb,wBAAwB,CAACa,UAAU,CAAC,CAAC;AAC9C;AAEO,SAASC,SAASA,CAAA,EAAqB;EAC5C,OAAOd,wBAAwB,CAACc,SAAS,CAAC,CAAC;AAC7C;AAEO,SAASC,QAAQA,CAACC,UAAkB,EAAEC,WAAmB,EAAiB;EAC/E,OAAOjB,wBAAwB,CAACe,QAAQ,CAACC,UAAU,EAAEC,WAAW,CAAC;AACnE;AAEO,SAASC,cAAcA,CAACC,aAAsB,EAAiB;EACpE,OAAOnB,wBAAwB,CAACkB,cAAc,CAACC,aAAa,CAAC;AAC/D;AAEO,SAASC,aAAaA,CAAA,EAAkB;EAC7C,OAAOpB,wBAAwB,CAACoB,aAAa,CAAC,CAAC;AACjD;AAgCA,MAAMC,wBAAwD,GAAG;EAC/DhB,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,cAAc;EACdE;AACF,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEcsB,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","PosthogReactNativePlugin","NativeModules","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","PostHogReactNativePlugin","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,uFAAuF,GACvFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGC,0BAAa,CAACD,wBAAwB,GACnEC,0BAAa,CAACD,wBAAwB,GACtC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAyBE,SAASU,KAAKA,CACnBC,SAAiB,EACjBC,UAAuC,EACvCC,YAA4C,GAAG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wB","ignoreList":[]}
@@ -34,6 +34,9 @@ export function startRecording(resumeCurrent) {
34
34
  export function stopRecording() {
35
35
  return PosthogReactNativePlugin.stopRecording();
36
36
  }
37
+ export function addExceptionStep(message, properties) {
38
+ return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {});
39
+ }
37
40
  const PostHogReactNativePlugin = {
38
41
  setup,
39
42
  start,
@@ -42,7 +45,8 @@ const PostHogReactNativePlugin = {
42
45
  isEnabled,
43
46
  identify,
44
47
  startRecording,
45
- stopRecording
48
+ stopRecording,
49
+ addExceptionStep
46
50
  };
47
51
  export default PostHogReactNativePlugin;
48
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","PosthogReactNativePlugin","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","startRecording","resumeCurrent","stopRecording","PostHogReactNativePlugin"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,uFAAuF,GACvFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGN,aAAa,CAACM,wBAAwB,GACnEN,aAAa,CAACM,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAmBL,OAAO,SAASQ,KAAKA,CACnBC,SAAiB,EACjBC,UAAuC,EACvCC,YAA4C,GAAG,CAAC,CAAC,EAClC;EACf,OAAOP,wBAAwB,CAACI,KAAK,CAACC,SAAS,EAAEC,UAAU,EAAEC,YAAY,CAAC;AAC5E;AAEA,OAAO,SAASC,KAAKA,CACnBH,SAAiB,EACjBC,UAAuC,EACvCG,eAA4C,EAC5CC,kBAA+C,EAChC;EACf,OAAOV,wBAAwB,CAACQ,KAAK,CAACH,SAAS,EAAEC,UAAU,EAAEG,eAAe,EAAEC,kBAAkB,CAAC;AACnG;AAEA,OAAO,SAASC,YAAYA,CAACN,SAAiB,EAAiB;EAC7D,OAAOL,wBAAwB,CAACW,YAAY,CAACN,SAAS,CAAC;AACzD;AAEA,OAAO,SAASO,UAAUA,CAAA,EAAkB;EAC1C,OAAOZ,wBAAwB,CAACY,UAAU,CAAC,CAAC;AAC9C;AAEA,OAAO,SAASC,SAASA,CAAA,EAAqB;EAC5C,OAAOb,wBAAwB,CAACa,SAAS,CAAC,CAAC;AAC7C;AAEA,OAAO,SAASC,QAAQA,CAACC,UAAkB,EAAEC,WAAmB,EAAiB;EAC/E,OAAOhB,wBAAwB,CAACc,QAAQ,CAACC,UAAU,EAAEC,WAAW,CAAC;AACnE;AAEA,OAAO,SAASC,cAAcA,CAACC,aAAsB,EAAiB;EACpE,OAAOlB,wBAAwB,CAACiB,cAAc,CAACC,aAAa,CAAC;AAC/D;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAkB;EAC7C,OAAOnB,wBAAwB,CAACmB,aAAa,CAAC,CAAC;AACjD;AAgCA,MAAMC,wBAAwD,GAAG;EAC/DhB,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,cAAc;EACdE;AACF,CAAC;AAED,eAAeC,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","PosthogReactNativePlugin","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","PostHogReactNativePlugin"],"sour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,CAAC;AACnE;AAEA,OAAO,SAASC,cAAcA,CAACC,aAAsB,EAAiB;EACpE,OAAOlB,wBAAwB,CAACiB,cAAc,CAACC,aAAa,CAAC;AAC/D;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAkB;EAC7C,OAAOnB,wBAAwB,CAACmB,aAAa,CAAC,CAAC;AACjD;AAEA,OAAO,SAASC,gBAAgBA,CAACC,OAAe,EAAEC,UAAwC,EAAiB;EACzG,OAAOtB,wBAAwB,CAACoB,gBAAgB,CAACC,OAAO,EAAEC,UAAU,IAAI,CAAC,CAAC,CAAC;AAC7E;AAkCA,MAAMC,wBAAwD,GAAG;EAC/DnB,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,cAAc;EACdE,aAAa;EACbC;AACF,CAAC;AAED,eAAeG,wBAAwB","ignoreList":[]}
@@ -6,8 +6,13 @@ export interface PostHogReactNativePluginSessionReplayConfig {
6
6
  sdkReplayConfig?: PostHogReactNativePluginMap;
7
7
  decideReplayConfig?: PostHogReactNativePluginMap;
8
8
  }
9
+ export interface PostHogReactNativePluginExceptionStepsConfig {
10
+ enabled?: boolean;
11
+ maxBytes?: number;
12
+ }
9
13
  export interface PostHogReactNativePluginErrorTrackingConfig {
10
14
  nativeAutocapture?: boolean;
15
+ exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig;
11
16
  }
12
17
  export interface PostHogReactNativePluginConfig {
13
18
  sessionReplay?: PostHogReactNativePluginSessionReplayConfig;
@@ -21,6 +26,7 @@ export declare function isEnabled(): Promise<boolean>;
21
26
  export declare function identify(distinctId: string, anonymousId: string): Promise<void>;
22
27
  export declare function startRecording(resumeCurrent: boolean): Promise<void>;
23
28
  export declare function stopRecording(): Promise<void>;
29
+ export declare function addExceptionStep(message: string, properties?: PostHogReactNativePluginMap): Promise<void>;
24
30
  export interface PostHogReactNativePluginModule {
25
31
  setup: (sessionId: string, sdkOptions: PostHogReactNativePluginMap, pluginConfig?: PostHogReactNativePluginConfig) => Promise<void>;
26
32
  /**
@@ -33,6 +39,7 @@ export interface PostHogReactNativePluginModule {
33
39
  identify: (distinctId: string, anonymousId: string) => Promise<void>;
34
40
  startRecording: (resumeCurrent: boolean) => Promise<void>;
35
41
  stopRecording: () => Promise<void>;
42
+ addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
36
43
  }
37
44
  declare const PostHogReactNativePlugin: PostHogReactNativePluginModule;
38
45
  export default PostHogReactNativePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,MAAM,2BAA2B,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAEhE,MAAM,WAAW,2CAA2C;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,2BAA2B,CAAA;IAC7C,kBAAkB,CAAC,EAAE,2BAA2B,CAAA;CACjD;AAED,MAAM,WAAW,2CAA2C;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,CAAC,EAAE,2CAA2C,CAAA;IAC3D,aAAa,CAAC,EAAE,2CAA2C,CAAA;CAC5D;AAED,wBAAgB,KAAK,CACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,2BAA2B,EACvC,YAAY,GAAE,8BAAmC,GAChD,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,KAAK,CACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,2BAA2B,EACvC,eAAe,EAAE,2BAA2B,EAC5C,kBAAkB,EAAE,2BAA2B,GAC9C,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED,wBAAgB,UAAU,IAAI,O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ogReactNativePluginMap;
7
7
  decideReplayConfig?: PostHogReactNativePluginMap;
8
8
  }
9
+ export interface PostHogReactNativePluginExceptionStepsConfig {
10
+ enabled?: boolean;
11
+ maxBytes?: number;
12
+ }
9
13
  export interface PostHogReactNativePluginErrorTrackingConfig {
10
14
  nativeAutocapture?: boolean;
15
+ exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig;
11
16
  }
12
17
  export interface PostHogReactNativePluginConfig {
13
18
  sessionReplay?: PostHogReactNativePluginSessionReplayConfig;
@@ -21,6 +26,7 @@ export declare function isEnabled(): Promise<boolean>;
21
26
  export declare function identify(distinctId: string, anonymousId: string): Promise<void>;
22
27
  export declare function startRecording(resumeCurrent: boolean): Promise<void>;
23
28
  export declare function stopRecording(): Promise<void>;
29
+ export declare function addExceptionStep(message: string, properties?: PostHogReactNativePluginMap): Promise<void>;
24
30
  export interface PostHogReactNativePluginModule {
25
31
  setup: (sessionId: string, sdkOptions: PostHogReactNativePluginMap, pluginConfig?: PostHogReactNativePluginConfig) => Promise<void>;
26
32
  /**
@@ -33,6 +39,7 @@ export interface PostHogReactNativePluginModule {
33
39
  identify: (distinctId: string, anonymousId: string) => Promise<void>;
34
40
  startRecording: (resumeCurrent: boolean) => Promise<void>;
35
41
  stopRecording: () => Promise<void>;
42
+ addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
36
43
  }
37
44
  declare const PostHogReactNativePlugin: PostHogReactNativePluginModule;
38
45
  export default PostHogReactNativePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,MAAM,2BAA2B,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAEhE,MAAM,WAAW,2CAA2C;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,2BAA2B,CAAA;IAC7C,kBAAkB,CAAC,EAA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,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/B,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IAEjC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpE,cAAc,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzD,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAElC,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,2BAA2B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC/F;AAED,QAAA,MAAM,wBAAwB,EAAE,8BAU/B,CAAA;AAED,eAAe,wBAAwB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/react-native-plugin",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "PostHog React Native plugin for iOS and Android integrations",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -6,7 +6,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
6
6
  # Single source of truth for the posthog-ios native dependency version.
7
7
  # Used by both the SPM and CocoaPods resolution paths below; bump this
8
8
  # line when picking up a new posthog-ios release.
9
- posthog_ios_version = '3.58.1'
9
+ posthog_ios_version = '3.61.0'
10
10
 
11
11
  Pod::Spec.new do |s|
12
12
  s.name = "posthog-react-native-plugin"
package/src/index.tsx CHANGED
@@ -25,8 +25,14 @@ export interface PostHogReactNativePluginSessionReplayConfig {
25
25
  decideReplayConfig?: PostHogReactNativePluginMap
26
26
  }
27
27
 
28
+ export interface PostHogReactNativePluginExceptionStepsConfig {
29
+ enabled?: boolean
30
+ maxBytes?: number
31
+ }
32
+
28
33
  export interface PostHogReactNativePluginErrorTrackingConfig {
29
34
  nativeAutocapture?: boolean
35
+ exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig
30
36
  }
31
37
 
32
38
  export interface PostHogReactNativePluginConfig {
@@ -75,6 +81,10 @@ export function stopRecording(): Promise<void> {
75
81
  return PosthogReactNativePlugin.stopRecording()
76
82
  }
77
83
 
84
+ export function addExceptionStep(message: string, properties?: PostHogReactNativePluginMap): Promise<void> {
85
+ return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {})
86
+ }
87
+
78
88
  export interface PostHogReactNativePluginModule {
79
89
  setup: (
80
90
  sessionId: string,
@@ -103,6 +113,8 @@ export interface PostHogReactNativePluginModule {
103
113
  startRecording: (resumeCurrent: boolean) => Promise<void>
104
114
 
105
115
  stopRecording: () => Promise<void>
116
+
117
+ addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>
106
118
  }
107
119
 
108
120
  const PostHogReactNativePlugin: PostHogReactNativePluginModule = {
@@ -114,6 +126,7 @@ const PostHogReactNativePlugin: PostHogReactNativePluginModule = {
114
126
  identify,
115
127
  startRecording,
116
128
  stopRecording,
129
+ addExceptionStep,
117
130
  }
118
131
 
119
132
  export default PostHogReactNativePlugin