@posthog/react-native-plugin 2.9.3 → 2.10.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/android/build.gradle +2 -2
- package/android/src/main/java/com/posthogreactnativeplugin/PosthogReactNativePluginModule.kt +78 -14
- package/ios/Package.swift +1 -1
- package/ios/PosthogReactNativePlugin.mm +6 -0
- package/ios/PosthogReactNativePlugin.swift +93 -19
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +17 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/vitest.config.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +17 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/vitest.config.d.ts.map +1 -1
- package/package.json +3 -2
- package/posthog-react-native-plugin.podspec +1 -1
- package/src/index.tsx +30 -0
package/android/build.gradle
CHANGED
|
@@ -91,8 +91,8 @@ dependencies {
|
|
|
91
91
|
//noinspection GradleDynamicVersion
|
|
92
92
|
implementation "com.facebook.react:react-native:+"
|
|
93
93
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
94
|
-
implementation "com.posthog:posthog-android:3.
|
|
94
|
+
implementation "com.posthog:posthog-android:3.66.0"
|
|
95
95
|
|
|
96
96
|
testImplementation "junit:junit:4.13.2"
|
|
97
|
+
testImplementation "org.json:json:20250517"
|
|
97
98
|
}
|
|
98
|
-
|
package/android/src/main/java/com/posthogreactnativeplugin/PosthogReactNativePluginModule.kt
CHANGED
|
@@ -11,6 +11,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
11
11
|
import com.facebook.react.bridge.ReactMethod
|
|
12
12
|
import com.facebook.react.bridge.ReadableMap
|
|
13
13
|
import com.facebook.react.bridge.UiThreadUtil
|
|
14
|
+
import com.facebook.react.bridge.WritableArray
|
|
15
|
+
import com.facebook.react.bridge.WritableMap
|
|
14
16
|
import com.facebook.react.common.JavascriptException
|
|
15
17
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
16
18
|
import com.posthog.PostHog
|
|
@@ -23,6 +25,11 @@ import com.posthog.internal.PostHogPreferences
|
|
|
23
25
|
import com.posthog.internal.PostHogPreferences.Companion.ANONYMOUS_ID
|
|
24
26
|
import com.posthog.internal.PostHogPreferences.Companion.DISTINCT_ID
|
|
25
27
|
import com.posthog.internal.PostHogSessionManager
|
|
28
|
+
import java.text.ParseException
|
|
29
|
+
import java.text.SimpleDateFormat
|
|
30
|
+
import java.util.Date
|
|
31
|
+
import java.util.Locale
|
|
32
|
+
import java.util.TimeZone
|
|
26
33
|
import java.util.UUID
|
|
27
34
|
|
|
28
35
|
class PosthogReactNativePluginModule(
|
|
@@ -139,6 +146,9 @@ class PosthogReactNativePluginModule(
|
|
|
139
146
|
PostHogAndroidConfig(apiKey, host).apply {
|
|
140
147
|
debug = debugValue
|
|
141
148
|
optOut = theOptOut
|
|
149
|
+
// JS owns consent: posthog-js core keeps its own store, so the value above is the
|
|
150
|
+
// answer, not a default the SDK may override from its own persisted copy.
|
|
151
|
+
persistOptOut = false
|
|
142
152
|
preloadFeatureFlags = thePreloadFeatureFlags
|
|
143
153
|
captureDeepLinks = false
|
|
144
154
|
captureApplicationLifecycleEvents = false
|
|
@@ -221,7 +231,7 @@ class PosthogReactNativePluginModule(
|
|
|
221
231
|
|
|
222
232
|
setIdentify(config.cachePreferences, distinctId, anonymousId)
|
|
223
233
|
|
|
224
|
-
captureColdStartPushOpenIfNeeded(config
|
|
234
|
+
captureColdStartPushOpenIfNeeded(config)
|
|
225
235
|
} catch (e: Throwable) {
|
|
226
236
|
logError(method, e)
|
|
227
237
|
} finally {
|
|
@@ -391,6 +401,54 @@ class PosthogReactNativePluginModule(
|
|
|
391
401
|
}
|
|
392
402
|
}
|
|
393
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Capture a fatal JavaScript exception through the native SDK.
|
|
406
|
+
*
|
|
407
|
+
* The JS layer has already run `before_send` and built the final payload; this only hands
|
|
408
|
+
* it to posthog-android. A `$exception` carrying `$exception_level: "fatal"` takes the
|
|
409
|
+
* SDK's fatal path, which writes the record to its own disk queue synchronously before
|
|
410
|
+
* returning — the durability the JS event queue cannot promise while AsyncStorage is still
|
|
411
|
+
* draining. Delivery, retry and the relaunch flush are then the native SDK's job.
|
|
412
|
+
*
|
|
413
|
+
* The JS side drops its own copy of the event when this path is taken, so this must not
|
|
414
|
+
* silently no-op: a rejection tells JS the capture did not happen.
|
|
415
|
+
*/
|
|
416
|
+
@ReactMethod
|
|
417
|
+
fun captureFatalException(
|
|
418
|
+
distinctId: String,
|
|
419
|
+
timestamp: String,
|
|
420
|
+
properties: ReadableMap,
|
|
421
|
+
promise: Promise,
|
|
422
|
+
) {
|
|
423
|
+
try {
|
|
424
|
+
val parsedTimestamp = parseIso8601(timestamp)
|
|
425
|
+
if (parsedTimestamp == null) {
|
|
426
|
+
promise.reject(FATAL_CAPTURE_ERROR_CODE, "captureFatalException: invalid timestamp '$timestamp'")
|
|
427
|
+
return
|
|
428
|
+
}
|
|
429
|
+
// capture() returns silently when the SDK was never set up. JS gives up its own copy of
|
|
430
|
+
// the event before calling this, so a false success would lose the crash without a
|
|
431
|
+
// trace; report it instead.
|
|
432
|
+
if (PostHog.getConfig<PostHogConfig>() == null) {
|
|
433
|
+
promise.reject(FATAL_CAPTURE_ERROR_CODE, "captureFatalException: the native SDK is not set up")
|
|
434
|
+
return
|
|
435
|
+
}
|
|
436
|
+
// ReadableMap.toHashMap() is HashMap<String, Any?>; the native API takes Map<String, Any>?.
|
|
437
|
+
@Suppress("UNCHECKED_CAST")
|
|
438
|
+
val nativeProperties = properties.toHashMap() as Map<String, Any>
|
|
439
|
+
PostHog.capture(
|
|
440
|
+
event = "\$exception",
|
|
441
|
+
distinctId = distinctId.takeIf { it.isNotEmpty() },
|
|
442
|
+
properties = nativeProperties,
|
|
443
|
+
timestamp = parsedTimestamp,
|
|
444
|
+
)
|
|
445
|
+
promise.resolve(null)
|
|
446
|
+
} catch (e: Throwable) {
|
|
447
|
+
logError("captureFatalException", e)
|
|
448
|
+
promise.reject(FATAL_CAPTURE_ERROR_CODE, e)
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
394
452
|
private fun getMap(
|
|
395
453
|
map: ReadableMap?,
|
|
396
454
|
key: String,
|
|
@@ -488,15 +546,7 @@ class PosthogReactNativePluginModule(
|
|
|
488
546
|
// cold-start tray tap it exists for is the one creation it can never observe here. Read
|
|
489
547
|
// the launch intent directly, then strip the marker so the integration (or a re-run)
|
|
490
548
|
// can't capture the same tap again from this intent object.
|
|
491
|
-
|
|
492
|
-
// jsOptedOut is the consent JS passed into this setup(). The native SDK lets the opt-out it
|
|
493
|
-
// persisted itself win over that value, so after an earlier launch opted in, config.optOut no
|
|
494
|
-
// longer says what JS said and native would capture. A tap JS considers denied is consumed
|
|
495
|
-
// here without being captured, so a later opt-in cannot resurrect it either.
|
|
496
|
-
private fun captureColdStartPushOpenIfNeeded(
|
|
497
|
-
config: PostHogAndroidConfig,
|
|
498
|
-
jsOptedOut: Boolean,
|
|
499
|
-
) {
|
|
549
|
+
private fun captureColdStartPushOpenIfNeeded(config: PostHogAndroidConfig) {
|
|
500
550
|
if (!config.capturePushNotificationOpened) {
|
|
501
551
|
return
|
|
502
552
|
}
|
|
@@ -508,10 +558,6 @@ class PosthogReactNativePluginModule(
|
|
|
508
558
|
}
|
|
509
559
|
try {
|
|
510
560
|
intent.getStringExtra(GOOGLE_MESSAGE_ID) ?: return
|
|
511
|
-
if (jsOptedOut) {
|
|
512
|
-
intent.removeExtra(GOOGLE_MESSAGE_ID)
|
|
513
|
-
return
|
|
514
|
-
}
|
|
515
561
|
// Unmarshalling extras throws BadParcelableException on a Parcelable class this
|
|
516
562
|
// classloader lacks; read before stripping the marker so a failed read leaves the
|
|
517
563
|
// intent as the native integration expects it.
|
|
@@ -579,6 +625,7 @@ class PosthogReactNativePluginModule(
|
|
|
579
625
|
const val DEFAULT_THROTTLE_DELAY_MS = 1000
|
|
580
626
|
|
|
581
627
|
private const val PUSH_ERROR_CODE = "PosthogReactNativePluginError"
|
|
628
|
+
private const val FATAL_CAPTURE_ERROR_CODE = "PosthogReactNativePluginFatalCaptureError"
|
|
582
629
|
private const val PUSH_IDENTITY_EVENT = "PostHogPushIdentityRequest"
|
|
583
630
|
private const val PUSH_IDENTITY_REPLY_TTL_MS = 15_000L
|
|
584
631
|
|
|
@@ -655,6 +702,23 @@ class PosthogReactNativePluginModule(
|
|
|
655
702
|
}
|
|
656
703
|
}
|
|
657
704
|
|
|
705
|
+
// The JS layer sends an ISO-8601 UTC timestamp (`Date#toISOString`). Parse it explicitly
|
|
706
|
+
// rather than trusting a locale-dependent default, and treat anything unparseable as a
|
|
707
|
+
// caller error: silently substituting "now" would attribute the crash to the wrong instant.
|
|
708
|
+
internal fun parseIso8601(value: String): Date? {
|
|
709
|
+
if (value.isEmpty()) {
|
|
710
|
+
return null
|
|
711
|
+
}
|
|
712
|
+
val format = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US)
|
|
713
|
+
format.timeZone = TimeZone.getTimeZone("UTC")
|
|
714
|
+
format.isLenient = false
|
|
715
|
+
return try {
|
|
716
|
+
format.parse(value)
|
|
717
|
+
} catch (_: ParseException) {
|
|
718
|
+
null
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
658
722
|
private fun hasKey(
|
|
659
723
|
map: ReadableMap?,
|
|
660
724
|
key: String,
|
package/ios/Package.swift
CHANGED
|
@@ -43,6 +43,12 @@ RCT_EXTERN_METHOD(addExceptionStep:(NSString)message
|
|
|
43
43
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
44
44
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
45
45
|
|
|
46
|
+
RCT_EXTERN_METHOD(captureFatalException:(NSString)distinctId
|
|
47
|
+
withTimestamp:(NSString)timestamp
|
|
48
|
+
withProperties:(NSDictionary)properties
|
|
49
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
50
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
51
|
+
|
|
46
52
|
RCT_EXTERN_METHOD(reset:(NSString)distinctId
|
|
47
53
|
withAnonymousId:(NSString)anonymousId
|
|
48
54
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PostHog
|
|
1
|
+
@_spi(PostHogInternal) import PostHog
|
|
2
2
|
import React
|
|
3
3
|
|
|
4
4
|
/// Meant for internally logging PostHog related things
|
|
@@ -27,6 +27,26 @@ private func containsFatalJsErrorMarker(_ text: String?) -> Bool {
|
|
|
27
27
|
return fatalJsErrorMarkers.contains { text.contains($0) }
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
private let fatalCaptureErrorCode = "PosthogReactNativePluginFatalCaptureError"
|
|
31
|
+
|
|
32
|
+
/// Holds the JS-approved properties for the thread on which the JS layer's own fatal capture
|
|
33
|
+
/// is running, so `beforeSend` can tell that capture apart from a native re-report of the same
|
|
34
|
+
/// crash — and can put back the values native's own enrichment would otherwise win.
|
|
35
|
+
private let jsFatalCaptureKey = "com.posthog.reactnative.jsFatalCapture"
|
|
36
|
+
|
|
37
|
+
private var jsFatalCaptureProperties: [String: Any]? {
|
|
38
|
+
Thread.current.threadDictionary[jsFatalCaptureKey] as? [String: Any]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// The JS layer sends an ISO-8601 UTC timestamp (`Date#toISOString`). Parse it explicitly so
|
|
42
|
+
/// an unparseable value is a caller error rather than a silent substitution of "now", which
|
|
43
|
+
/// would attribute the crash to the wrong instant.
|
|
44
|
+
private let iso8601Formatter: ISO8601DateFormatter = {
|
|
45
|
+
let formatter = ISO8601DateFormatter()
|
|
46
|
+
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
|
47
|
+
return formatter
|
|
48
|
+
}()
|
|
49
|
+
|
|
30
50
|
private func isReactNativeFatalJsError(_ event: PostHogEvent) -> Bool {
|
|
31
51
|
guard event.event == "$exception",
|
|
32
52
|
let exceptionList = event.properties["$exception_list"] as? [[String: Any]]
|
|
@@ -64,11 +84,9 @@ private func isReactNativeFatalJsError(_ event: PostHogEvent) -> Bool {
|
|
|
64
84
|
private final class SetupWindow {
|
|
65
85
|
private let lock = NSLock()
|
|
66
86
|
private var distinctId: String?
|
|
67
|
-
private var jsOptedOut: Bool
|
|
68
87
|
|
|
69
|
-
init(distinctId: String
|
|
88
|
+
init(distinctId: String) {
|
|
70
89
|
self.distinctId = distinctId.isEmpty ? nil : distinctId
|
|
71
|
-
self.jsOptedOut = jsOptedOut
|
|
72
90
|
}
|
|
73
91
|
|
|
74
92
|
var pendingDistinctId: String? {
|
|
@@ -77,17 +95,10 @@ private final class SetupWindow {
|
|
|
77
95
|
return distinctId
|
|
78
96
|
}
|
|
79
97
|
|
|
80
|
-
var dropsPushOpens: Bool {
|
|
81
|
-
lock.lock()
|
|
82
|
-
defer { lock.unlock() }
|
|
83
|
-
return jsOptedOut
|
|
84
|
-
}
|
|
85
|
-
|
|
86
98
|
func settled() {
|
|
87
99
|
lock.lock()
|
|
88
100
|
defer { lock.unlock() }
|
|
89
101
|
distinctId = nil
|
|
90
|
-
jsOptedOut = false
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
104
|
|
|
@@ -247,7 +258,7 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
247
258
|
let distinctId = sdkOptions["distinctId"] as? String ?? ""
|
|
248
259
|
let anonymousId = sdkOptions["anonymousId"] as? String ?? ""
|
|
249
260
|
let jsOptedOut = sdkOptions["optOut"] as? Bool ?? false
|
|
250
|
-
let setupWindow = SetupWindow(distinctId: distinctId
|
|
261
|
+
let setupWindow = SetupWindow(distinctId: distinctId)
|
|
251
262
|
// Every exit below is past the point where native storage carries the ids, or past a
|
|
252
263
|
// failure that left the SDK disabled, so no path can leave the window armed.
|
|
253
264
|
defer { setupWindow.settled() }
|
|
@@ -255,18 +266,29 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
255
266
|
// React Native rethrows fatal JS errors natively (RCTFatalException / ExceptionsManager).
|
|
256
267
|
// The JS layer already captured them, so drop the native duplicate.
|
|
257
268
|
config.setBeforeSend { event in
|
|
269
|
+
// The JS layer's own fatal capture is the event we want; only native re-reports
|
|
270
|
+
// of a crash JS already captured are duplicates. Matching the event name as well
|
|
271
|
+
// as the thread-local keeps anything else posthog-ios emits on this thread during
|
|
272
|
+
// the call from having this event's properties written over it.
|
|
273
|
+
if event.event == "$exception", let jsProperties = jsFatalCaptureProperties {
|
|
274
|
+
// `buildProperties` keeps its own value on a key clash (`{ current, _ in
|
|
275
|
+
// current }`), so native's enrichment silently wins over what JS decided —
|
|
276
|
+
// `$process_person_profile` from `personProfiles: 'never'`, or any value the
|
|
277
|
+
// app's `before_send` rewrote. Put the JS-approved values back. Android has
|
|
278
|
+
// the opposite precedence (`putAll` after its own context), so this keeps the
|
|
279
|
+
// two platforms agreeing.
|
|
280
|
+
for (key, value) in jsProperties {
|
|
281
|
+
event.properties[key] = value
|
|
282
|
+
}
|
|
283
|
+
return event
|
|
284
|
+
}
|
|
258
285
|
if isReactNativeFatalJsError(event) {
|
|
259
286
|
return nil
|
|
260
287
|
}
|
|
261
288
|
// Only the replayed tap. `setup()` also replays the previous launch's crash report,
|
|
262
289
|
// and that `$exception` carries the distinct id recorded at crash time, which stands.
|
|
263
|
-
if event.event == "$push_notification_opened" {
|
|
264
|
-
|
|
265
|
-
return nil
|
|
266
|
-
}
|
|
267
|
-
if let distinctId = setupWindow.pendingDistinctId {
|
|
268
|
-
event.distinctId = distinctId
|
|
269
|
-
}
|
|
290
|
+
if event.event == "$push_notification_opened", let distinctId = setupWindow.pendingDistinctId {
|
|
291
|
+
event.distinctId = distinctId
|
|
270
292
|
}
|
|
271
293
|
return event
|
|
272
294
|
}
|
|
@@ -326,6 +348,9 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
326
348
|
config.flushAt = flushAt
|
|
327
349
|
|
|
328
350
|
config.optOut = jsOptedOut
|
|
351
|
+
// JS owns consent: posthog-js core keeps its own store, so the value above is the answer,
|
|
352
|
+
// not a default the SDK may override from its own disk copy.
|
|
353
|
+
config.persistOptOut = false
|
|
329
354
|
// JS owns flags; it tells us when the native preload would be a duplicate. posthog-ios
|
|
330
355
|
// has no remoteConfig switch to mirror — it deprecated the option and always loads.
|
|
331
356
|
config.preloadFeatureFlags = sdkOptions["preloadFeatureFlags"] as? Bool ?? true
|
|
@@ -517,6 +542,55 @@ public class PosthogReactNativePlugin: RCTEventEmitter {
|
|
|
517
542
|
resolve(nil)
|
|
518
543
|
}
|
|
519
544
|
|
|
545
|
+
/// Capture a fatal JavaScript exception through the native SDK.
|
|
546
|
+
///
|
|
547
|
+
/// The JS layer has already run `before_send` and built the final payload; this only
|
|
548
|
+
/// hands it to posthog-ios, whose `capture` writes the record to its own disk queue
|
|
549
|
+
/// synchronously on the calling thread — the durability the JS event queue cannot
|
|
550
|
+
/// promise while AsyncStorage is still draining. Delivery, retry and the relaunch flush
|
|
551
|
+
/// are then the native SDK's job.
|
|
552
|
+
///
|
|
553
|
+
/// The JS side drops its own copy of the event when this path is taken, so this must not
|
|
554
|
+
/// silently no-op: a rejection tells JS the capture did not happen.
|
|
555
|
+
@objc(captureFatalException:withTimestamp:withProperties:withResolver:withRejecter:)
|
|
556
|
+
func captureFatalException(
|
|
557
|
+
distinctId: String, timestamp: String, properties: [String: Any],
|
|
558
|
+
resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock
|
|
559
|
+
) {
|
|
560
|
+
guard let date = iso8601Formatter.date(from: timestamp) else {
|
|
561
|
+
reject(
|
|
562
|
+
fatalCaptureErrorCode,
|
|
563
|
+
"captureFatalException: invalid timestamp '\(timestamp)'", nil
|
|
564
|
+
)
|
|
565
|
+
return
|
|
566
|
+
}
|
|
567
|
+
// capture() returns silently when the SDK is not capturing. `isOptOut()` is true both
|
|
568
|
+
// when it was never set up and when the user opted out; JS gates on both before
|
|
569
|
+
// calling, so either answer here means the event was dropped. It has already given up
|
|
570
|
+
// its own copy, so report the loss rather than resolving successfully.
|
|
571
|
+
guard !PostHogSDK.shared.isOptOut() else {
|
|
572
|
+
reject(
|
|
573
|
+
fatalCaptureErrorCode,
|
|
574
|
+
"captureFatalException: the native SDK is not capturing (not set up, or opted out)", nil
|
|
575
|
+
)
|
|
576
|
+
return
|
|
577
|
+
}
|
|
578
|
+
// `beforeSend` below drops native re-reports of fatal JS errors to avoid duplicating
|
|
579
|
+
// what JS already captured. This event *is* the JS capture, so hand the filter the
|
|
580
|
+
// JS-approved properties for the duration of the call: it passes the event through
|
|
581
|
+
// and restores those values over native's enrichment. A thread-local keeps a
|
|
582
|
+
// concurrent native crash report on another thread subject to the filter as usual.
|
|
583
|
+
Thread.current.threadDictionary[jsFatalCaptureKey] = properties
|
|
584
|
+
defer { Thread.current.threadDictionary.removeObject(forKey: jsFatalCaptureKey) }
|
|
585
|
+
PostHogSDK.shared.capture(
|
|
586
|
+
"$exception",
|
|
587
|
+
distinctId: distinctId.isEmpty ? nil : distinctId,
|
|
588
|
+
properties: properties,
|
|
589
|
+
timestamp: date
|
|
590
|
+
)
|
|
591
|
+
resolve(nil)
|
|
592
|
+
}
|
|
593
|
+
|
|
520
594
|
@objc(registerPushNotificationToken:withAppId:withResolver:withRejecter:)
|
|
521
595
|
func registerPushNotificationToken(
|
|
522
596
|
deviceToken: String, appId: String?, resolve: RCTPromiseResolveBlock,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addExceptionStep = addExceptionStep;
|
|
7
|
+
exports.captureFatalException = captureFatalException;
|
|
7
8
|
exports.capturePushNotificationOpened = capturePushNotificationOpened;
|
|
8
9
|
exports.default = void 0;
|
|
9
10
|
exports.endSession = endSession;
|
|
@@ -65,6 +66,25 @@ function stopRecording() {
|
|
|
65
66
|
function addExceptionStep(message, properties) {
|
|
66
67
|
return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {});
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Captures a fatal JS exception through the embedded native SDK.
|
|
72
|
+
*
|
|
73
|
+
* The JS layer has already run `before_send` and built the final payload. Native captures it
|
|
74
|
+
* as a `$exception` with `$exception_level: "fatal"`, which both native SDKs write to their
|
|
75
|
+
* own disk queue synchronously before returning — durability the JS event queue cannot offer
|
|
76
|
+
* while AsyncStorage is still draining. Native then owns delivery, retry and the relaunch
|
|
77
|
+
* flush, so nothing needs recovering on the next launch.
|
|
78
|
+
*
|
|
79
|
+
* `timestamp` is an ISO-8601 UTC string (`Date#toISOString`). The promise rejects if the
|
|
80
|
+
* capture did not happen, because the JS caller drops its own copy of the event when this
|
|
81
|
+
* path is taken.
|
|
82
|
+
*
|
|
83
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
84
|
+
*/
|
|
85
|
+
function captureFatalException(distinctId, timestamp, properties) {
|
|
86
|
+
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties);
|
|
87
|
+
}
|
|
68
88
|
function registerPushNotificationToken(deviceToken, appId) {
|
|
69
89
|
return PosthogReactNativePlugin.registerPushNotificationToken(deviceToken, appId);
|
|
70
90
|
}
|
|
@@ -133,6 +153,7 @@ const PostHogReactNativePlugin = {
|
|
|
133
153
|
startRecording,
|
|
134
154
|
stopRecording,
|
|
135
155
|
addExceptionStep,
|
|
156
|
+
captureFatalException,
|
|
136
157
|
registerPushNotificationToken,
|
|
137
158
|
unregisterPushNotificationToken,
|
|
138
159
|
setOptOut,
|
|
@@ -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","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":"
|
|
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","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,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,GAAG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,CAACK,OAAO,CAAC1B,UAAU,EAAE0B,OAAO,CAACb,KAAK,CAAC;MAChEc,KAAK,GAAG,OAAOC,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,IAAI;IACpD,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV;MACAC,OAAO,CAACC,IAAI,CAAC,yCAAyCF,CAAC,mDAAmD,CAAC;IAC7G;IACA,IAAI;MACF,MAAM7C,wBAAwB,CAACgD,wBAAwB,CAACN,OAAO,CAACO,SAAS,EAAEN,KAAK,CAAC;IACnF,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV;MACAC,OAAO,CAACC,IAAI,CAAC,8DAA8DF,CAAC,EAAE,CAAC;IACjF;EACF,CACF,CAAC;AACH;AAoDA,MAAMK,wBAAwD,GAAG;EAC/D7C,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,KAAK;EACLC,cAAc;EACdE,aAAa;EACbC,gBAAgB;EAChBG,qBAAqB;EACrBE,6BAA6B;EAC7BG,+BAA+B;EAC/BC,SAAS;EACTE,6BAA6B;EAC7BG;AACF,CAAC;AAAA,IAAAe,QAAA,GAAAC,OAAA,CAAArD,OAAA,GAEcmD,wBAAwB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -46,6 +46,25 @@ export function stopRecording() {
|
|
|
46
46
|
export function addExceptionStep(message, properties) {
|
|
47
47
|
return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {});
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Captures a fatal JS exception through the embedded native SDK.
|
|
52
|
+
*
|
|
53
|
+
* The JS layer has already run `before_send` and built the final payload. Native captures it
|
|
54
|
+
* as a `$exception` with `$exception_level: "fatal"`, which both native SDKs write to their
|
|
55
|
+
* own disk queue synchronously before returning — durability the JS event queue cannot offer
|
|
56
|
+
* while AsyncStorage is still draining. Native then owns delivery, retry and the relaunch
|
|
57
|
+
* flush, so nothing needs recovering on the next launch.
|
|
58
|
+
*
|
|
59
|
+
* `timestamp` is an ISO-8601 UTC string (`Date#toISOString`). The promise rejects if the
|
|
60
|
+
* capture did not happen, because the JS caller drops its own copy of the event when this
|
|
61
|
+
* path is taken.
|
|
62
|
+
*
|
|
63
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
64
|
+
*/
|
|
65
|
+
export function captureFatalException(distinctId, timestamp, properties) {
|
|
66
|
+
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties);
|
|
67
|
+
}
|
|
49
68
|
export function registerPushNotificationToken(deviceToken, appId) {
|
|
50
69
|
return PosthogReactNativePlugin.registerPushNotificationToken(deviceToken, appId);
|
|
51
70
|
}
|
|
@@ -114,6 +133,7 @@ const PostHogReactNativePlugin = {
|
|
|
114
133
|
startRecording,
|
|
115
134
|
stopRecording,
|
|
116
135
|
addExceptionStep,
|
|
136
|
+
captureFatalException,
|
|
117
137
|
registerPushNotificationToken,
|
|
118
138
|
unregisterPushNotificationToken,
|
|
119
139
|
setOptOut,
|
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","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,aA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B;EAC5E,OAAOhB,wBAAwB,CAACiB,KAAK,CAACF,UAAU,EAAEC,WAAW,CAAC;AAChE;AAEA,OAAO,SAASE,cAAcA,CAACC,aAAsB,EAAiB;EACpE,OAAOnB,wBAAwB,CAACkB,cAAc,CAACC,aAAa,CAAC;AAC/D;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAkB;EAC7C,OAAOpB,wBAAwB,CAACoB,aAAa,CAAC,CAAC;AACjD;AAEA,OAAO,SAASC,gBAAgBA,CAACC,OAAe,EAAEC,UAAwC,EAAiB;EACzG,OAAOvB,wBAAwB,CAACqB,gBAAgB,CAACC,OAAO,EAAEC,UAAU,IAAI,CAAC,CAAC,CAAC;AAC7E;
|
|
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","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,CAACM,wBAAwB,GACnEN,aAAa,CAACM,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF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B,EACnB,MAAOO,OAAiE,IAAK;IAC3E,IAAIC,KAAoB,GAAG,IAAI;IAC/B,IAAI;MACF,MAAMC,MAAM,GAAG,MAAMN,QAAQ,CAACI,OAAO,CAACzB,UAAU,EAAEyB,OAAO,CAACZ,KAAK,CAAC;MAChEa,KAAK,GAAG,OAAOC,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,IAAI;IACpD,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV;MACAC,OAAO,CAACC,IAAI,CAAC,yCAAyCF,CAAC,mDAAmD,CAAC;IAC7G;IACA,IAAI;MACF,MAAM3C,wBAAwB,CAAC8C,wBAAwB,CAACN,OAAO,CAACO,SAAS,EAAEN,KAAK,CAAC;IACnF,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV;MACAC,OAAO,CAACC,IAAI,CAAC,8DAA8DF,CAAC,EAAE,CAAC;IACjF;EACF,CACF,CAAC;AACH;AAoDA,MAAMK,wBAAwD,GAAG;EAC/D5C,KAAK;EACLI,KAAK;EACLG,YAAY;EACZC,UAAU;EACVC,SAAS;EACTC,QAAQ;EACRG,KAAK;EACLC,cAAc;EACdE,aAAa;EACbC,gBAAgB;EAChBG,qBAAqB;EACrBE,6BAA6B;EAC7BG,+BAA+B;EAC/BC,SAAS;EACTE,6BAA6B;EAC7BG;AACF,CAAC;AAED,eAAea,wBAAwB","ignoreList":[]}
|
|
@@ -52,6 +52,22 @@ export declare function reset(distinctId: string, anonymousId: string): Promise<
|
|
|
52
52
|
export declare function startRecording(resumeCurrent: boolean): Promise<void>;
|
|
53
53
|
export declare function stopRecording(): Promise<void>;
|
|
54
54
|
export declare function addExceptionStep(message: string, properties?: PostHogReactNativePluginMap): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Captures a fatal JS exception through the embedded native SDK.
|
|
57
|
+
*
|
|
58
|
+
* The JS layer has already run `before_send` and built the final payload. Native captures it
|
|
59
|
+
* as a `$exception` with `$exception_level: "fatal"`, which both native SDKs write to their
|
|
60
|
+
* own disk queue synchronously before returning — durability the JS event queue cannot offer
|
|
61
|
+
* while AsyncStorage is still draining. Native then owns delivery, retry and the relaunch
|
|
62
|
+
* flush, so nothing needs recovering on the next launch.
|
|
63
|
+
*
|
|
64
|
+
* `timestamp` is an ISO-8601 UTC string (`Date#toISOString`). The promise rejects if the
|
|
65
|
+
* capture did not happen, because the JS caller drops its own copy of the event when this
|
|
66
|
+
* path is taken.
|
|
67
|
+
*
|
|
68
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
69
|
+
*/
|
|
70
|
+
export declare function captureFatalException(distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap): Promise<void>;
|
|
55
71
|
export declare function registerPushNotificationToken(deviceToken: string, appId: string | null): Promise<void>;
|
|
56
72
|
export declare function unregisterPushNotificationToken(): Promise<void>;
|
|
57
73
|
/**
|
|
@@ -89,6 +105,7 @@ export interface PostHogReactNativePluginModule {
|
|
|
89
105
|
startRecording: (resumeCurrent: boolean) => Promise<void>;
|
|
90
106
|
stopRecording: () => Promise<void>;
|
|
91
107
|
addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
|
|
108
|
+
captureFatalException: (distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap) => Promise<void>;
|
|
92
109
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>;
|
|
93
110
|
unregisterPushNotificationToken: () => Promise<void>;
|
|
94
111
|
setOptOut: (optOut: boolean) => 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,kB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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,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,8BAiB/B,CAAA;eAEc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":""}
|
|
@@ -52,6 +52,22 @@ export declare function reset(distinctId: string, anonymousId: string): Promise<
|
|
|
52
52
|
export declare function startRecording(resumeCurrent: boolean): Promise<void>;
|
|
53
53
|
export declare function stopRecording(): Promise<void>;
|
|
54
54
|
export declare function addExceptionStep(message: string, properties?: PostHogReactNativePluginMap): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Captures a fatal JS exception through the embedded native SDK.
|
|
57
|
+
*
|
|
58
|
+
* The JS layer has already run `before_send` and built the final payload. Native captures it
|
|
59
|
+
* as a `$exception` with `$exception_level: "fatal"`, which both native SDKs write to their
|
|
60
|
+
* own disk queue synchronously before returning — durability the JS event queue cannot offer
|
|
61
|
+
* while AsyncStorage is still draining. Native then owns delivery, retry and the relaunch
|
|
62
|
+
* flush, so nothing needs recovering on the next launch.
|
|
63
|
+
*
|
|
64
|
+
* `timestamp` is an ISO-8601 UTC string (`Date#toISOString`). The promise rejects if the
|
|
65
|
+
* capture did not happen, because the JS caller drops its own copy of the event when this
|
|
66
|
+
* path is taken.
|
|
67
|
+
*
|
|
68
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
69
|
+
*/
|
|
70
|
+
export declare function captureFatalException(distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap): Promise<void>;
|
|
55
71
|
export declare function registerPushNotificationToken(deviceToken: string, appId: string | null): Promise<void>;
|
|
56
72
|
export declare function unregisterPushNotificationToken(): Promise<void>;
|
|
57
73
|
/**
|
|
@@ -89,6 +105,7 @@ export interface PostHogReactNativePluginModule {
|
|
|
89
105
|
startRecording: (resumeCurrent: boolean) => Promise<void>;
|
|
90
106
|
stopRecording: () => Promise<void>;
|
|
91
107
|
addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>;
|
|
108
|
+
captureFatalException: (distinctId: string, timestamp: string, properties: PostHogReactNativePluginMap) => Promise<void>;
|
|
92
109
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>;
|
|
93
110
|
unregisterPushNotificationToken: () => Promise<void>;
|
|
94
111
|
setOptOut: (optOut: boolean) => 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,O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AE,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;IAE9F,qBAAqB,EAAE,CACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,2BAA2B,KACpC,OAAO,CAAC,IAAI,CAAC,CAAA;IAElB,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,8BAiB/B,CAAA;eAEc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"react": "18.3.1",
|
|
63
63
|
"react-native": "0.75.3",
|
|
64
64
|
"react-native-builder-bob": "^0.30.2",
|
|
65
|
-
"typescript": "
|
|
65
|
+
"typescript": "7.0.2",
|
|
66
66
|
"vitest": "^1.6.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"scripts": {
|
|
98
|
+
"check-types": "pnpm typecheck",
|
|
98
99
|
"clean": "del-cli android/build lib",
|
|
99
100
|
"lint": "oxlint --report-unused-disable-directives-severity error .",
|
|
100
101
|
"lint:fix": "oxlint --report-unused-disable-directives-severity error . --fix",
|
|
@@ -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.
|
|
9
|
+
posthog_ios_version = '3.76.0'
|
|
10
10
|
|
|
11
11
|
Pod::Spec.new do |s|
|
|
12
12
|
s.name = "posthog-react-native-plugin"
|
package/src/index.tsx
CHANGED
|
@@ -116,6 +116,29 @@ export function addExceptionStep(message: string, properties?: PostHogReactNativ
|
|
|
116
116
|
return PosthogReactNativePlugin.addExceptionStep(message, properties ?? {})
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Captures a fatal JS exception through the embedded native SDK.
|
|
121
|
+
*
|
|
122
|
+
* The JS layer has already run `before_send` and built the final payload. Native captures it
|
|
123
|
+
* as a `$exception` with `$exception_level: "fatal"`, which both native SDKs write to their
|
|
124
|
+
* own disk queue synchronously before returning — durability the JS event queue cannot offer
|
|
125
|
+
* while AsyncStorage is still draining. Native then owns delivery, retry and the relaunch
|
|
126
|
+
* flush, so nothing needs recovering on the next launch.
|
|
127
|
+
*
|
|
128
|
+
* `timestamp` is an ISO-8601 UTC string (`Date#toISOString`). The promise rejects if the
|
|
129
|
+
* capture did not happen, because the JS caller drops its own copy of the event when this
|
|
130
|
+
* path is taken.
|
|
131
|
+
*
|
|
132
|
+
* @internal Used by `posthog-react-native`'s fatal handler. Not part of the public API.
|
|
133
|
+
*/
|
|
134
|
+
export function captureFatalException(
|
|
135
|
+
distinctId: string,
|
|
136
|
+
timestamp: string,
|
|
137
|
+
properties: PostHogReactNativePluginMap
|
|
138
|
+
): Promise<void> {
|
|
139
|
+
return PosthogReactNativePlugin.captureFatalException(distinctId, timestamp, properties)
|
|
140
|
+
}
|
|
141
|
+
|
|
119
142
|
export function registerPushNotificationToken(deviceToken: string, appId: string | null): Promise<void> {
|
|
120
143
|
return PosthogReactNativePlugin.registerPushNotificationToken(deviceToken, appId)
|
|
121
144
|
}
|
|
@@ -214,6 +237,12 @@ export interface PostHogReactNativePluginModule {
|
|
|
214
237
|
|
|
215
238
|
addExceptionStep: (message: string, properties?: PostHogReactNativePluginMap) => Promise<void>
|
|
216
239
|
|
|
240
|
+
captureFatalException: (
|
|
241
|
+
distinctId: string,
|
|
242
|
+
timestamp: string,
|
|
243
|
+
properties: PostHogReactNativePluginMap
|
|
244
|
+
) => Promise<void>
|
|
245
|
+
|
|
217
246
|
registerPushNotificationToken: (deviceToken: string, appId: string | null) => Promise<void>
|
|
218
247
|
|
|
219
248
|
unregisterPushNotificationToken: () => Promise<void>
|
|
@@ -236,6 +265,7 @@ const PostHogReactNativePlugin: PostHogReactNativePluginModule = {
|
|
|
236
265
|
startRecording,
|
|
237
266
|
stopRecording,
|
|
238
267
|
addExceptionStep,
|
|
268
|
+
captureFatalException,
|
|
239
269
|
registerPushNotificationToken,
|
|
240
270
|
unregisterPushNotificationToken,
|
|
241
271
|
setOptOut,
|