@posthog/react-native-plugin 2.12.5 → 2.12.6
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/android/src/main/java/com/posthogreactnativeplugin/PosthogReactNativePluginModule.kt +86 -2
- package/ios/PosthogReactNativePlugin.mm +4 -0
- package/ios/PosthogReactNativePlugin.swift +137 -19
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +18 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +15 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +15 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +25 -0
package/android/src/main/java/com/posthogreactnativeplugin/PosthogReactNativePluginModule.kt
CHANGED
|
@@ -79,6 +79,7 @@ class PosthogReactNativePluginModule(
|
|
|
79
79
|
decideReplayConfig = getMap(sessionReplayConfig, "decideReplayConfig"),
|
|
80
80
|
nativeErrorTrackingAutocapture = getBoolean(errorTrackingConfig, "nativeAutocapture", false),
|
|
81
81
|
androidNdkCrashes = getBoolean(errorTrackingConfig, "androidNdkCrashes", false),
|
|
82
|
+
fatalExceptionMarker = getBoolean(errorTrackingConfig, "fatalExceptionMarker", false),
|
|
82
83
|
exceptionStepsConfig = getMap(errorTrackingConfig, "exceptionSteps"),
|
|
83
84
|
pushConfig = getMap(pluginConfig, "push"),
|
|
84
85
|
promise = promise,
|
|
@@ -102,6 +103,7 @@ class PosthogReactNativePluginModule(
|
|
|
102
103
|
decideReplayConfig = decideReplayConfig,
|
|
103
104
|
nativeErrorTrackingAutocapture = false,
|
|
104
105
|
androidNdkCrashes = false,
|
|
106
|
+
fatalExceptionMarker = false,
|
|
105
107
|
exceptionStepsConfig = null,
|
|
106
108
|
pushConfig = null,
|
|
107
109
|
promise = promise,
|
|
@@ -117,6 +119,7 @@ class PosthogReactNativePluginModule(
|
|
|
117
119
|
decideReplayConfig: ReadableMap?,
|
|
118
120
|
nativeErrorTrackingAutocapture: Boolean,
|
|
119
121
|
androidNdkCrashes: Boolean,
|
|
122
|
+
fatalExceptionMarker: Boolean,
|
|
120
123
|
exceptionStepsConfig: ReadableMap?,
|
|
121
124
|
pushConfig: ReadableMap?,
|
|
122
125
|
promise: Promise,
|
|
@@ -170,8 +173,14 @@ class PosthogReactNativePluginModule(
|
|
|
170
173
|
getInt(exceptionStepsConfig, "maxBytes", errorTrackingConfig.exceptionSteps.maxBytes)
|
|
171
174
|
|
|
172
175
|
// React Native rethrows fatal JS errors natively as JavascriptException.
|
|
173
|
-
//
|
|
174
|
-
|
|
176
|
+
// Drop it only when the JS layer saw the crash. Fatals that bypass the JS handler,
|
|
177
|
+
// such as React render errors, have no marker and are reported natively instead.
|
|
178
|
+
// A JS layer that sends no flag marks nothing, so every JavascriptException is dropped.
|
|
179
|
+
if (fatalExceptionMarker) {
|
|
180
|
+
addBeforeSend { dropJsHandledFatalCrash(it) }
|
|
181
|
+
} else {
|
|
182
|
+
errorTrackingConfig.ignoredExceptionTypes.add(JavascriptException::class.java)
|
|
183
|
+
}
|
|
175
184
|
addBeforeSend { restoreJsFatalCaptureProperties(it) }
|
|
176
185
|
|
|
177
186
|
// Always apply the session replay configuration so that recording started later
|
|
@@ -473,6 +482,19 @@ class PosthogReactNativePluginModule(
|
|
|
473
482
|
}
|
|
474
483
|
}
|
|
475
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Records that the JS fatal handler saw a crash, so the JavascriptException React Native
|
|
487
|
+
* throws for it next is dropped as a duplicate when its message is [message].
|
|
488
|
+
*/
|
|
489
|
+
@ReactMethod
|
|
490
|
+
fun markFatalExceptionHandled(
|
|
491
|
+
message: String?,
|
|
492
|
+
promise: Promise,
|
|
493
|
+
) {
|
|
494
|
+
markJsFatalHandled(message ?: "")
|
|
495
|
+
promise.resolve(null)
|
|
496
|
+
}
|
|
497
|
+
|
|
476
498
|
private fun getMap(
|
|
477
499
|
map: ReadableMap?,
|
|
478
500
|
key: String,
|
|
@@ -769,6 +791,68 @@ internal fun restoreJsFatalCaptureProperties(event: PostHogEvent): PostHogEvent
|
|
|
769
791
|
return event
|
|
770
792
|
}
|
|
771
793
|
|
|
794
|
+
// The starts of the messages of the fatals the JS fatal handler saw. The JavascriptException
|
|
795
|
+
// React Native throws for one of them is captured in this process, so memory is enough. The next
|
|
796
|
+
// JavascriptException consumes them all and is dropped only when it carries one of them, so a
|
|
797
|
+
// marked fatal the host app recovers from cannot hide a later, different crash.
|
|
798
|
+
private val jsHandledFatalMessages = mutableListOf<String>()
|
|
799
|
+
|
|
800
|
+
// More fatals than this before the crash keep only the most recent ones.
|
|
801
|
+
private const val MAX_JS_HANDLED_FATAL_MESSAGES = 10
|
|
802
|
+
|
|
803
|
+
// Must match FATAL_MESSAGE_KEY_LENGTH in posthog-react-native's error tracking.
|
|
804
|
+
private const val JS_FATAL_MESSAGE_KEY_LENGTH = 80
|
|
805
|
+
|
|
806
|
+
internal fun markJsFatalHandled(message: String) {
|
|
807
|
+
synchronized(jsHandledFatalMessages) {
|
|
808
|
+
jsHandledFatalMessages.add(message)
|
|
809
|
+
if (jsHandledFatalMessages.size > MAX_JS_HANDLED_FATAL_MESSAGES) {
|
|
810
|
+
jsHandledFatalMessages.removeAt(0)
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
internal fun dropJsHandledFatalCrash(event: PostHogEvent): PostHogEvent? {
|
|
816
|
+
if (event.event != "\$exception") {
|
|
817
|
+
return event
|
|
818
|
+
}
|
|
819
|
+
val exception = javascriptException(event.properties) ?: return event
|
|
820
|
+
val messages =
|
|
821
|
+
synchronized(jsHandledFatalMessages) {
|
|
822
|
+
jsHandledFatalMessages.toList().also { jsHandledFatalMessages.clear() }
|
|
823
|
+
}
|
|
824
|
+
val value = exception["value"] as? String ?: return event
|
|
825
|
+
return if (messages.any { isJsFatalReportOf(value, it) }) null else event
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// React Native's report starts with the JS message and continues with ", js engine: …, stack:"
|
|
829
|
+
// (or ", stack:") for handler fatals, or a newline. A shorter message must end where the report's
|
|
830
|
+
// message ends, so a marked "Error: " does not match "Error: something else".
|
|
831
|
+
private fun isJsFatalReportOf(
|
|
832
|
+
value: String,
|
|
833
|
+
message: String,
|
|
834
|
+
): Boolean {
|
|
835
|
+
if (!value.startsWith(message)) {
|
|
836
|
+
return false
|
|
837
|
+
}
|
|
838
|
+
if (message.codePointCount(0, message.length) >= JS_FATAL_MESSAGE_KEY_LENGTH || value.length == message.length) {
|
|
839
|
+
return true
|
|
840
|
+
}
|
|
841
|
+
return value[message.length] == ',' || value[message.length] == '\n'
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
private fun javascriptException(properties: Map<String, Any>?): Map<*, *>? {
|
|
845
|
+
val exceptionList = properties?.get("\$exception_list") as? List<*> ?: return null
|
|
846
|
+
return exceptionList.firstNotNullOfOrNull { entry ->
|
|
847
|
+
val exception = entry as? Map<*, *> ?: return@firstNotNullOfOrNull null
|
|
848
|
+
val type = exception["type"] as? String ?: return@firstNotNullOfOrNull null
|
|
849
|
+
val module = exception["module"] as? String
|
|
850
|
+
// posthog-android splits the class name into module and type.
|
|
851
|
+
val className = if (module.isNullOrEmpty()) type else "$module.$type"
|
|
852
|
+
if (className == JavascriptException::class.java.name) exception else null
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
772
856
|
// The JS layer sends an ISO-8601 UTC timestamp (`Date#toISOString`). Parse it explicitly
|
|
773
857
|
// rather than trusting a locale-dependent default, and treat anything unparseable as a
|
|
774
858
|
// caller error: silently substituting "now" would attribute the crash to the wrong instant.
|
|
@@ -52,6 +52,10 @@ RCT_EXTERN_METHOD(captureFatalException:(NSString)distinctId
|
|
|
52
52
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
53
53
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
54
54
|
|
|
55
|
+
RCT_EXTERN_METHOD(markFatalExceptionHandled:(NSString)message
|
|
56
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
57
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
58
|
+
|
|
55
59
|
RCT_EXTERN_METHOD(reset:(NSString)distinctId
|
|
56
60
|
withAnonymousId:(NSString)anonymousId
|
|
57
61
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
@@ -38,6 +38,97 @@ private var jsFatalCaptureProperties: [String: Any]? {
|
|
|
38
38
|
Thread.current.threadDictionary[jsFatalCaptureKey] as? [String: Any]
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/// One file per launch for the fatal JS marker protocol. posthog-ios reports a crash only on the
|
|
42
|
+
/// next launch, so the state has to survive the crash. The file exists when the launch's JS layer
|
|
43
|
+
/// marks the fatals it sees; `messages` holds the starts of the most recent ones it marked.
|
|
44
|
+
private let jsFatalStateURL: URL? = FileManager.default
|
|
45
|
+
.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?
|
|
46
|
+
.appendingPathComponent(Bundle.main.bundleIdentifier ?? "", isDirectory: true)
|
|
47
|
+
.appendingPathComponent("posthog-react-native-js-fatal-state.json")
|
|
48
|
+
|
|
49
|
+
private let jsFatalMessagesKey = "messages"
|
|
50
|
+
|
|
51
|
+
/// More fatals than this before the crash keep only the most recent ones.
|
|
52
|
+
private let maxJsFatalMessages = 10
|
|
53
|
+
|
|
54
|
+
/// Holds the previous launch's marker state, read and removed the first time this process uses
|
|
55
|
+
/// it — before `setup` or `markFatalExceptionHandled` can write this launch's state over it.
|
|
56
|
+
private final class JsFatalMarkers {
|
|
57
|
+
static let shared = JsFatalMarkers()
|
|
58
|
+
|
|
59
|
+
private let lock = NSLock()
|
|
60
|
+
/// `nil` when the previous launch did not use the marker protocol.
|
|
61
|
+
private var previousLaunch: [String: Any]?
|
|
62
|
+
private var currentLaunch: [String: Any]?
|
|
63
|
+
|
|
64
|
+
private init() {
|
|
65
|
+
guard let url = jsFatalStateURL else { return }
|
|
66
|
+
if let data = try? Data(contentsOf: url) {
|
|
67
|
+
previousLaunch = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any] ?? [:]
|
|
68
|
+
}
|
|
69
|
+
try? FileManager.default.removeItem(at: url)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// Records that this launch's JS layer marks the fatals it sees.
|
|
73
|
+
func useMarkers() throws {
|
|
74
|
+
try updateCurrentLaunch { _ in }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Records the start of the message of a fatal this launch's JS layer saw.
|
|
78
|
+
func markFatalHandled(message: String) throws {
|
|
79
|
+
try updateCurrentLaunch { state in
|
|
80
|
+
let messages = (state[jsFatalMessagesKey] as? [String] ?? []) + [message]
|
|
81
|
+
state[jsFatalMessagesKey] = Array(messages.suffix(maxJsFatalMessages))
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private func updateCurrentLaunch(_ change: (inout [String: Any]) -> Void) throws {
|
|
86
|
+
guard let url = jsFatalStateURL else {
|
|
87
|
+
throw NSError(domain: fatalCaptureErrorCode, code: 0, userInfo: [
|
|
88
|
+
NSLocalizedDescriptionKey: "no application support directory",
|
|
89
|
+
])
|
|
90
|
+
}
|
|
91
|
+
lock.lock()
|
|
92
|
+
defer { lock.unlock() }
|
|
93
|
+
var state = currentLaunch ?? [:]
|
|
94
|
+
change(&state)
|
|
95
|
+
try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
|
|
96
|
+
try JSONSerialization.data(withJSONObject: state).write(to: url, options: .atomic)
|
|
97
|
+
currentLaunch = state
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// Whether a native report of a fatal JS error duplicates a crash the JS layer captured.
|
|
101
|
+
/// Reports from a launch without the protocol are always dropped, since that launch's JS layer
|
|
102
|
+
/// captured every fatal its handler saw. Otherwise the first report consumes the markers and is
|
|
103
|
+
/// dropped only when one of `texts` reports one of the marked messages.
|
|
104
|
+
func isJsHandledFatal(_ texts: [String]) -> Bool {
|
|
105
|
+
lock.lock()
|
|
106
|
+
defer { lock.unlock() }
|
|
107
|
+
guard let previous = previousLaunch else { return true }
|
|
108
|
+
previousLaunch = [:]
|
|
109
|
+
let messages = previous[jsFatalMessagesKey] as? [String] ?? []
|
|
110
|
+
return messages.contains { message in texts.contains { isJsFatalReport($0, of: message) } }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// Must match FATAL_MESSAGE_KEY_LENGTH in posthog-react-native's error tracking.
|
|
115
|
+
private let jsFatalMessageKeyLength = 80
|
|
116
|
+
|
|
117
|
+
/// Whether `text`, one field of a native fatal JS error report, reports the JS error whose message
|
|
118
|
+
/// starts with `message`. React Native writes `Unhandled JS Exception: <message>`, then `, stack:`
|
|
119
|
+
/// or the end of the field. A shorter message must end where the report's message ends, so a
|
|
120
|
+
/// marked `Error: ` does not match `Error: something else`.
|
|
121
|
+
private func isJsFatalReport(_ text: String, of message: String) -> Bool {
|
|
122
|
+
guard let prefix = text.range(of: "Unhandled JS Exception: ") else { return false }
|
|
123
|
+
// Unicode scalars, as JS truncates the message by code point and may split a character.
|
|
124
|
+
let reported = text[prefix.upperBound...].unicodeScalars
|
|
125
|
+
let marked = message.unicodeScalars
|
|
126
|
+
guard reported.starts(with: marked) else { return false }
|
|
127
|
+
if marked.count >= jsFatalMessageKeyLength { return true }
|
|
128
|
+
let next = reported.dropFirst(marked.count).first
|
|
129
|
+
return next == nil || next == "," || next == "\n"
|
|
130
|
+
}
|
|
131
|
+
|
|
41
132
|
/// The JS layer sends an ISO-8601 UTC timestamp (`Date#toISOString`). Parse it explicitly so
|
|
42
133
|
/// an unparseable value is a caller error rather than a silent substitution of "now", which
|
|
43
134
|
/// would attribute the crash to the wrong instant.
|
|
@@ -47,24 +138,23 @@ private let iso8601Formatter: ISO8601DateFormatter = {
|
|
|
47
138
|
return formatter
|
|
48
139
|
}()
|
|
49
140
|
|
|
50
|
-
|
|
141
|
+
/// The fields of an exception that can carry React Native's fatal JS error text.
|
|
142
|
+
private func fatalJsErrorTexts(_ exception: [String: Any]) -> [String] {
|
|
143
|
+
// New-architecture RN rethrows fatal JS errors as a C++ jsi::JSError (SIGABRT);
|
|
144
|
+
// the JS-error text only survives in the signal's crash-info message.
|
|
145
|
+
let mechanism = exception["mechanism"] as? [String: Any]
|
|
146
|
+
let meta = mechanism?["meta"] as? [String: Any]
|
|
147
|
+
let signal = meta?["signal"] as? [String: Any]
|
|
148
|
+
return [exception["type"], exception["value"], signal?["crash_info_message"]].compactMap { $0 as? String }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// The error texts of `event` when it is a native report of a fatal JS error, otherwise `nil`.
|
|
152
|
+
private func reactNativeFatalJsErrorTexts(_ event: PostHogEvent) -> [String]? {
|
|
51
153
|
guard event.event == "$exception",
|
|
52
154
|
let exceptionList = event.properties["$exception_list"] as? [[String: Any]]
|
|
53
|
-
else { return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return true
|
|
57
|
-
}
|
|
58
|
-
if containsFatalJsErrorMarker(exception["value"] as? String) {
|
|
59
|
-
return true
|
|
60
|
-
}
|
|
61
|
-
// New-architecture RN rethrows fatal JS errors as a C++ jsi::JSError (SIGABRT);
|
|
62
|
-
// the JS-error text only survives in the signal's crash-info message.
|
|
63
|
-
let mechanism = exception["mechanism"] as? [String: Any]
|
|
64
|
-
let meta = mechanism?["meta"] as? [String: Any]
|
|
65
|
-
let signal = meta?["signal"] as? [String: Any]
|
|
66
|
-
return containsFatalJsErrorMarker(signal?["crash_info_message"] as? String)
|
|
67
|
-
}
|
|
155
|
+
else { return nil }
|
|
156
|
+
let texts = exceptionList.flatMap(fatalJsErrorTexts)
|
|
157
|
+
return texts.contains { containsFatalJsErrorMarker($0) } ? texts : nil
|
|
68
158
|
}
|
|
69
159
|
|
|
70
160
|
/// Carries the distinct id and consent JS holds into `beforeSend` for the length of
|
|
@@ -170,6 +260,7 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
170
260
|
sdkReplayConfig: sessionReplayConfig["sdkReplayConfig"] as? [String: Any] ?? [:],
|
|
171
261
|
decideReplayConfig: sessionReplayConfig["decideReplayConfig"] as? [String: Any] ?? [:],
|
|
172
262
|
nativeErrorTrackingAutocapture: errorTrackingConfig["nativeAutocapture"] as? Bool ?? false,
|
|
263
|
+
fatalExceptionMarker: errorTrackingConfig["fatalExceptionMarker"] as? Bool ?? false,
|
|
173
264
|
exceptionStepsConfig: exceptionStepsConfig,
|
|
174
265
|
pushConfig: pluginConfig["push"] as? [String: Any] ?? [:],
|
|
175
266
|
rageClickConfig: pluginConfig["rageClick"] as? [String: Any] ?? [:],
|
|
@@ -191,6 +282,7 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
191
282
|
sdkReplayConfig: sdkReplayConfig,
|
|
192
283
|
decideReplayConfig: decideReplayConfig,
|
|
193
284
|
nativeErrorTrackingAutocapture: false,
|
|
285
|
+
fatalExceptionMarker: false,
|
|
194
286
|
exceptionStepsConfig: [:],
|
|
195
287
|
pushConfig: [:],
|
|
196
288
|
rageClickConfig: [:],
|
|
@@ -206,6 +298,7 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
206
298
|
sdkReplayConfig: [String: Any],
|
|
207
299
|
decideReplayConfig: [String: Any],
|
|
208
300
|
nativeErrorTrackingAutocapture: Bool,
|
|
301
|
+
fatalExceptionMarker: Bool,
|
|
209
302
|
exceptionStepsConfig: [String: Any],
|
|
210
303
|
pushConfig: [String: Any],
|
|
211
304
|
rageClickConfig: [String: Any],
|
|
@@ -264,7 +357,17 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
264
357
|
defer { setupWindow.settled() }
|
|
265
358
|
|
|
266
359
|
// React Native rethrows fatal JS errors natively (RCTFatalException / ExceptionsManager).
|
|
267
|
-
//
|
|
360
|
+
// Drop that report only when the JS layer saw the crash. Fatals that bypass the JS handler,
|
|
361
|
+
// such as React render errors, have no marker and are reported natively instead.
|
|
362
|
+
// A JS layer that sends no flag marks nothing, so its launch's reports are always dropped.
|
|
363
|
+
let jsFatalMarkers = JsFatalMarkers.shared
|
|
364
|
+
if fatalExceptionMarker {
|
|
365
|
+
do {
|
|
366
|
+
try jsFatalMarkers.useMarkers()
|
|
367
|
+
} catch {
|
|
368
|
+
hedgeLog("Failed to record the fatal JS marker state: \(error.localizedDescription)")
|
|
369
|
+
}
|
|
370
|
+
}
|
|
268
371
|
config.setBeforeSend { event in
|
|
269
372
|
// The JS layer's own fatal capture is the event we want; only native re-reports
|
|
270
373
|
// of a crash JS already captured are duplicates. Matching the event name as well
|
|
@@ -282,8 +385,8 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
282
385
|
}
|
|
283
386
|
return event
|
|
284
387
|
}
|
|
285
|
-
if
|
|
286
|
-
return nil
|
|
388
|
+
if let texts = reactNativeFatalJsErrorTexts(event) {
|
|
389
|
+
return jsFatalMarkers.isJsHandledFatal(texts) ? nil : event
|
|
287
390
|
}
|
|
288
391
|
// Only the replayed tap. `setup()` also replays the previous launch's crash report,
|
|
289
392
|
// and that `$exception` carries the distinct id recorded at crash time, which stands.
|
|
@@ -601,6 +704,21 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
601
704
|
resolve(nil)
|
|
602
705
|
}
|
|
603
706
|
|
|
707
|
+
/// Records that the JS fatal handler saw a crash, so the native report of that crash on the
|
|
708
|
+
/// next launch is dropped as a duplicate when it contains `message`. Resolves only after the
|
|
709
|
+
/// marker is on disk.
|
|
710
|
+
@objc(markFatalExceptionHandled:withResolver:withRejecter:)
|
|
711
|
+
func markFatalExceptionHandled(
|
|
712
|
+
message: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock
|
|
713
|
+
) {
|
|
714
|
+
do {
|
|
715
|
+
try JsFatalMarkers.shared.markFatalHandled(message: message)
|
|
716
|
+
resolve(nil)
|
|
717
|
+
} catch {
|
|
718
|
+
reject(fatalCaptureErrorCode, "markFatalExceptionHandled: \(error.localizedDescription)", error)
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
604
722
|
@objc(registerPushNotificationToken:withAppId:withResolver:withRejecter:)
|
|
605
723
|
func registerPushNotificationToken(
|
|
606
724
|
deviceToken: String, appId: String?, resolve: RCTPromiseResolveBlock,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.endSession = endSession;
|
|
|
11
11
|
exports.getSessionReplayDebugProperties = getSessionReplayDebugProperties;
|
|
12
12
|
exports.identify = identify;
|
|
13
13
|
exports.isEnabled = isEnabled;
|
|
14
|
+
exports.markFatalExceptionHandled = markFatalExceptionHandled;
|
|
14
15
|
exports.registerPushNotificationToken = registerPushNotificationToken;
|
|
15
16
|
exports.reset = reset;
|
|
16
17
|
exports.setOptOut = setOptOut;
|
|
@@ -87,6 +88,23 @@ function captureFatalException(distinctId, timestamp, properties) {
|
|
|
87
88
|
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties);
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Records that the JS fatal handler saw a crash before React Native turns it into a native one.
|
|
93
|
+
* Native error tracking drops its own report of a fatal JS error only when the report's message
|
|
94
|
+
* is `message` (the first 80 characters of the `<name>: <message>` text React Native reports), so
|
|
95
|
+
* fatals that never reach the JS handler (such as React render errors) are still reported.
|
|
96
|
+
*
|
|
97
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
98
|
+
*/
|
|
99
|
+
function markFatalExceptionHandled(message) {
|
|
100
|
+
// An OTA-updated JS bundle can run on a native build that predates this method. That build
|
|
101
|
+
// drops every fatal JS report natively, so there is nothing to mark.
|
|
102
|
+
if (typeof PosthogReactNativePlugin.markFatalExceptionHandled !== 'function') {
|
|
103
|
+
return Promise.resolve();
|
|
104
|
+
}
|
|
105
|
+
return PosthogReactNativePlugin.markFatalExceptionHandled(message);
|
|
106
|
+
}
|
|
107
|
+
|
|
90
108
|
/**
|
|
91
109
|
* Returns the native SDK's session-replay debug map (`$recording_status`, `$sdk_debug_replay_*`).
|
|
92
110
|
*
|
|
@@ -169,6 +187,7 @@ const PostHogReactNativePlugin = {
|
|
|
169
187
|
stopRecording,
|
|
170
188
|
addExceptionStep,
|
|
171
189
|
captureFatalException,
|
|
190
|
+
markFatalExceptionHandled,
|
|
172
191
|
getSessionReplayDebugProperties,
|
|
173
192
|
registerPushNotificationToken,
|
|
174
193
|
unregisterPushNotificationToken,
|
|
@@ -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","reset","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","captureFatalException","timestamp","
|
|
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","reset","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","captureFatalException","timestamp","markFatalExceptionHandled","Promise","resolve","getSessionReplayDebugProperties","registerPushNotificationToken","deviceToken","appId","unregisterPushNotificationToken","setOptOut","optOut","capturePushNotificationOpened","PUSH_IDENTITY_EVENT","pushIdentitySubscription","setPushIdentityProvider","provider","remove","emitter","NativeEventEmitter","addListener","request","token","minted","e","console","warn","providePushIdentityToken","requestId","PostHogReactNativePlugin","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,MAAMC,aAAa,GACjB,uF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CACF,CAAC;AACH;AAwDA,MAAMK,wBAAwD,GAAG;EAC/DjD,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,KAAK;EACLC,cAAc;EACdE,aAAa;EACbC,gBAAgB;EAChBG,qBAAqB;EACrBE,yBAAyB;EACzBG,+BAA+B;EAC/BC,6BAA6B;EAC7BG,+BAA+B;EAC/BC,SAAS;EACTE,6BAA6B;EAC7BG;AACF,CAAC;AAAA,IAAAe,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEcuD,wBAAwB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -66,6 +66,23 @@ export function captureFatalException(distinctId, timestamp, properties) {
|
|
|
66
66
|
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Records that the JS fatal handler saw a crash before React Native turns it into a native one.
|
|
71
|
+
* Native error tracking drops its own report of a fatal JS error only when the report's message
|
|
72
|
+
* is `message` (the first 80 characters of the `<name>: <message>` text React Native reports), so
|
|
73
|
+
* fatals that never reach the JS handler (such as React render errors) are still reported.
|
|
74
|
+
*
|
|
75
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
76
|
+
*/
|
|
77
|
+
export function markFatalExceptionHandled(message) {
|
|
78
|
+
// An OTA-updated JS bundle can run on a native build that predates this method. That build
|
|
79
|
+
// drops every fatal JS report natively, so there is nothing to mark.
|
|
80
|
+
if (typeof PosthogReactNativePlugin.markFatalExceptionHandled !== 'function') {
|
|
81
|
+
return Promise.resolve();
|
|
82
|
+
}
|
|
83
|
+
return PosthogReactNativePlugin.markFatalExceptionHandled(message);
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
/**
|
|
70
87
|
* Returns the native SDK's session-replay debug map (`$recording_status`, `$sdk_debug_replay_*`).
|
|
71
88
|
*
|
|
@@ -148,6 +165,7 @@ const PostHogReactNativePlugin = {
|
|
|
148
165
|
stopRecording,
|
|
149
166
|
addExceptionStep,
|
|
150
167
|
captureFatalException,
|
|
168
|
+
markFatalExceptionHandled,
|
|
151
169
|
getSessionReplayDebugProperties,
|
|
152
170
|
registerPushNotificationToken,
|
|
153
171
|
unregisterPushNotificationToken,
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","PosthogReactNativePlugin","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","reset","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","captureFatalException","timestamp","
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","PosthogReactNativePlugin","Proxy","get","Error","setup","sessionId","sdkOptions","pluginConfig","start","sdkReplayConfig","decideReplayConfig","startSession","endSession","isEnabled","identify","distinctId","anonymousId","reset","startRecording","resumeCurrent","stopRecording","addExceptionStep","message","properties","captureFatalException","timestamp","markFatalExceptionHandled","Promise","resolve","getSessionReplayDebugProperties","registerPushNotificationToken","deviceToken","appId","unregisterPushNotificationToken","setOptOut","optOut","capturePushNotificationOpened","PUSH_IDENTITY_EVENT","pushIdentitySubscription","setPushIdentityProvider","provider","remove","emitter","addListener","request","token","minted","e","console","warn","providePushIdentityToken","requestId","PostHogReactNativePlugin"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAG1E,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,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EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,KAAK;EACLC,cAAc;EACdE,aAAa;EACbC,gBAAgB;EAChBG,qBAAqB;EACrBE,yBAAyB;EACzBG,+BAA+B;EAC/BC,6BAA6B;EAC7BG,+BAA+B;EAC/BC,SAAS;EACTE,6BAA6B;EAC7BG;AACF,CAAC;AAED,eAAea,wBAAwB","ignoreList":[]}
|
|
@@ -14,6 +14,11 @@ export interface PostHogReactNativePluginErrorTrackingConfig {
|
|
|
14
14
|
nativeAutocapture?: boolean;
|
|
15
15
|
androidNdkCrashes?: boolean;
|
|
16
16
|
exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Native drops its report of a fatal JS crash only after {@link markFatalExceptionHandled}
|
|
19
|
+
* marked it. When absent, native drops every fatal JS crash report.
|
|
20
|
+
*/
|
|
21
|
+
fatalExceptionMarker?: boolean;
|
|
17
22
|
}
|
|
18
23
|
export interface PostHogReactNativePluginPushConfig {
|
|
19
24
|
capturePushNotificationSubscriptions?: boolean;
|
|
@@ -69,6 +74,15 @@ export declare function addExceptionStep(message: string, properties?: PostHogRe
|
|
|
69
74
|
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
70
75
|
*/
|
|
71
76
|
export declare function captureFatalException(distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Records that the JS fatal handler saw a crash before React Native turns it into a native one.
|
|
79
|
+
* Native error tracking drops its own report of a fatal JS error only when the report's message
|
|
80
|
+
* is `message` (the first 80 characters of the `<name>: <message>` text React Native reports), so
|
|
81
|
+
* fatals that never reach the JS handler (such as React render errors) are still reported.
|
|
82
|
+
*
|
|
83
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
84
|
+
*/
|
|
85
|
+
export declare function markFatalExceptionHandled(message: string): Promise<void>;
|
|
72
86
|
/**
|
|
73
87
|
* Returns the native SDK's session-replay debug map (`$recording_status`, `$sdk_debug_replay_*`).
|
|
74
88
|
*
|
|
@@ -113,6 +127,7 @@ export interface PostHogReactNativePluginModule {
|
|
|
113
127
|
stopRecording: () => Promise<void>;
|
|
114
128
|
addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
|
|
115
129
|
captureFatalException: (distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap) => Promise<void>;
|
|
130
|
+
markFatalExceptionHandled: (message: string) => Promise<void>;
|
|
116
131
|
getSessionReplayDebugProperties: () => Promise<PostHogReactNativePluginMap>;
|
|
117
132
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>;
|
|
118
133
|
unregisterPushNotificationToken: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAoBA,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,4CAA4C;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,2CAA2C;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,cAAc,CAAC,EAAE,4CAA4C,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAoBA,MAAM,MAAM,2BAA2B,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CA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,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;IAE9F,qBAAqB,EAAE,CACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,2BAA2B,KACpC,OAAO,CAAC,IAAI,CAAC,CAAA;IAElB,yBAAyB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7D,+BAA+B,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,CAAA;IAE3E,6BAA6B,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3F,+BAA+B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpD,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7C,6BAA6B,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzF,uBAAuB,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACzE;AAED,QAAA,MAAM,wBAAwB,EAAE,8BAmB/B,CAAA;eAEc,wBAAwB"}
|
|
@@ -14,6 +14,11 @@ export interface PostHogReactNativePluginErrorTrackingConfig {
|
|
|
14
14
|
nativeAutocapture?: boolean;
|
|
15
15
|
androidNdkCrashes?: boolean;
|
|
16
16
|
exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Native drops its report of a fatal JS crash only after {@link markFatalExceptionHandled}
|
|
19
|
+
* marked it. When absent, native drops every fatal JS crash report.
|
|
20
|
+
*/
|
|
21
|
+
fatalExceptionMarker?: boolean;
|
|
17
22
|
}
|
|
18
23
|
export interface PostHogReactNativePluginPushConfig {
|
|
19
24
|
capturePushNotificationSubscriptions?: boolean;
|
|
@@ -69,6 +74,15 @@ export declare function addExceptionStep(message: string, properties?: PostHogRe
|
|
|
69
74
|
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
70
75
|
*/
|
|
71
76
|
export declare function captureFatalException(distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Records that the JS fatal handler saw a crash before React Native turns it into a native one.
|
|
79
|
+
* Native error tracking drops its own report of a fatal JS error only when the report's message
|
|
80
|
+
* is `message` (the first 80 characters of the `<name>: <message>` text React Native reports), so
|
|
81
|
+
* fatals that never reach the JS handler (such as React render errors) are still reported.
|
|
82
|
+
*
|
|
83
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
84
|
+
*/
|
|
85
|
+
export declare function markFatalExceptionHandled(message: string): Promise<void>;
|
|
72
86
|
/**
|
|
73
87
|
* Returns the native SDK's session-replay debug map (`$recording_status`, `$sdk_debug_replay_*`).
|
|
74
88
|
*
|
|
@@ -113,6 +127,7 @@ export interface PostHogReactNativePluginModule {
|
|
|
113
127
|
stopRecording: () => Promise<void>;
|
|
114
128
|
addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
|
|
115
129
|
captureFatalException: (distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap) => Promise<void>;
|
|
130
|
+
markFatalExceptionHandled: (message: string) => Promise<void>;
|
|
116
131
|
getSessionReplayDebugProperties: () => Promise<PostHogReactNativePluginMap>;
|
|
117
132
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>;
|
|
118
133
|
unregisterPushNotificationToken: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],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IAE3F,+BAA+B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpD,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7C,6BAA6B,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzF,uBAAuB,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACzE;AAED,QAAA,MAAM,wBAAwB,EAAE,8BAmB/B,CAAA;eAEc,wBAAwB"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -35,6 +35,11 @@ export interface PostHogReactNativePluginErrorTrackingConfig {
|
|
|
35
35
|
nativeAutocapture?: boolean
|
|
36
36
|
androidNdkCrashes?: boolean
|
|
37
37
|
exceptionSteps?: PostHogReactNativePluginExceptionStepsConfig
|
|
38
|
+
/**
|
|
39
|
+
* Native drops its report of a fatal JS crash only after {@link markFatalExceptionHandled}
|
|
40
|
+
* marked it. When absent, native drops every fatal JS crash report.
|
|
41
|
+
*/
|
|
42
|
+
fatalExceptionMarker?: boolean
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export interface PostHogReactNativePluginPushConfig {
|
|
@@ -140,6 +145,23 @@ export function captureFatalException(
|
|
|
140
145
|
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties)
|
|
141
146
|
}
|
|
142
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Records that the JS fatal handler saw a crash before React Native turns it into a native one.
|
|
150
|
+
* Native error tracking drops its own report of a fatal JS error only when the report's message
|
|
151
|
+
* is `message` (the first 80 characters of the `<name>: <message>` text React Native reports), so
|
|
152
|
+
* fatals that never reach the JS handler (such as React render errors) are still reported.
|
|
153
|
+
*
|
|
154
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
155
|
+
*/
|
|
156
|
+
export function markFatalExceptionHandled(message: string): Promise<void> {
|
|
157
|
+
// An OTA-updated JS bundle can run on a native build that predates this method. That build
|
|
158
|
+
// drops every fatal JS report natively, so there is nothing to mark.
|
|
159
|
+
if (typeof PosthogReactNativePlugin.markFatalExceptionHandled !== 'function') {
|
|
160
|
+
return Promise.resolve()
|
|
161
|
+
}
|
|
162
|
+
return PosthogReactNativePlugin.markFatalExceptionHandled(message)
|
|
163
|
+
}
|
|
164
|
+
|
|
143
165
|
/**
|
|
144
166
|
* Returns the native SDK's session-replay debug map (`$recording_status`, `$sdk_debug_replay_*`).
|
|
145
167
|
*
|
|
@@ -258,6 +280,8 @@ export interface PostHogReactNativePluginModule {
|
|
|
258
280
|
properties: PostHogReactNativePluginMap
|
|
259
281
|
) => Promise<void>
|
|
260
282
|
|
|
283
|
+
markFatalExceptionHandled: (message: string) => Promise<void>
|
|
284
|
+
|
|
261
285
|
getSessionReplayDebugProperties: () => Promise<PostHogReactNativePluginMap>
|
|
262
286
|
|
|
263
287
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>
|
|
@@ -283,6 +307,7 @@ const PostHogReactNativePlugin: PostHogReactNativePluginModule = {
|
|
|
283
307
|
stopRecording,
|
|
284
308
|
addExceptionStep,
|
|
285
309
|
captureFatalException,
|
|
310
|
+
markFatalExceptionHandled,
|
|
286
311
|
getSessionReplayDebugProperties,
|
|
287
312
|
registerPushNotificationToken,
|
|
288
313
|
unregisterPushNotificationToken,
|