@blipit/react-native 0.4.0 → 0.5.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.
@@ -0,0 +1,23 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "BlipitReactNative"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+ s.platforms = { :ios => "13.4" }
13
+ s.source = { :git => "https://github.com/blipit-io/blipit.git", :tag => "react-native-v#{s.version}" }
14
+ s.source_files = "ios/*.{h,m,swift}"
15
+ s.resource_bundles = { "BlipitReactNativePrivacy" => ["ios/PrivacyInfo.xcprivacy"] }
16
+ s.swift_version = "5.9"
17
+ s.dependency "React-Core"
18
+ if defined?(spm_dependency)
19
+ spm_dependency(s, url: "https://github.com/blipit-io/blipit-swift", requirement: { kind: "upToNextMinorVersion", minimumVersion: "0.5.0" }, products: ["BlipitSwift"])
20
+ else
21
+ s.dependency "BlipitSwift", "~> 0.5.0"
22
+ end
23
+ end
package/CHANGELOG.md CHANGED
@@ -1,16 +1,14 @@
1
- ## 0.4.0
1
+ ## 0.5.0
2
+
3
+ - Runs on blipit-nuggets, Blipit's own capture core. `@sentry/react-native` is no longer a dependency; uninstall it. Events go to Blipit's own `POST /api/v1/events` with the `X-Blipit-Key` header, sessions to `/api/v1/sessions`.
4
+ - Captured on their own: uncaught JavaScript errors (fatal ones are saved to disk before the app closes and sent on the next launch), unhandled promise rejections on Hermes, and native crashes through Blipit's own Android and iOS SDKs, started by the new `BlipitNuggets` native module.
5
+ - Breadcrumbs for `console.warn` and `console.error`, every `fetch` and `XMLHttpRequest` call (no query, headers or bodies), and React Navigation screens with `trackNavigation(ref)`.
6
+ - Offline queue of up to 30 events kept on the device; 429 answers pause sending for the time the server asks for.
7
+ - `ErrorBoundary` with a fallback; `wrap` reports render errors and passes them on.
8
+ - `setEnabled(false)` turns Blipit off and deletes queued events, for consent screens; `setReplayConsent` and `hasReplayConsent` reach the Android SDK.
9
+ - Stuck screens and flows (`waitForReady`, `reportReady`, `startFlow`, `flowStep`, `endFlow`) keep working and their reports now go through the same on-device queue, 429 handling and `setEnabled` switch as errors.
10
+ - Native crashes need blipit-android v0.5.0 (JitPack) and blipit-swift 0.5.0, Blipit's own native cores.
11
+ - Release defaults to `<bundle id>@<version>+<build>`.
12
+ - iOS privacy manifest bundled with the pod. README has App Store, Google Play and AppGallery checklists.
13
+ - Removed: `dsn()` and `withIdentity()`. Options of the old wrapped library are no longer read. `tracesSampleRate` is accepted but performance traces are not sent in this version.
2
14
 
3
- - Stuck screens and flows: `waitForReady` with `Blipit.reportReady()`, and `startFlow`, `flowStep` and `endFlow`. When the app never reaches its first usable screen, or a flow such as sign-in never finishes, Blipit opens a Stuck issue with the last step and the steps before it. Only time on screen counts; the time limits come from Blipit.
4
-
5
- ## 0.3.0
6
-
7
- - `<BlipitReporter showButton>` around your app and `showReport()` from your own menu open the bug reporter: Take a screenshot or Skip, then a full-screen editor with the tools above and below the image, pinch, two-finger pan and double-tap zoom up to 5x, pen, box and arrow marks, then a title, what happened and an optional email, and Send. Screenshots need `react-native-view-shot` (optional peer dependency); without it the report is sent as text.
8
-
9
- ## 0.2.1
10
-
11
- - Events carry the `npm:@blipit/react-native` package and version, so the dashboard can show when this app runs an old Blipit SDK. A `beforeSend` you pass still runs after it. `VERSION` is exported.
12
- - No development console notice: events leave through the native transport, which does not expose response headers, and swapping it for the fetch transport in development would change how events are queued offline. The dashboard banner covers updates instead.
13
-
14
- ## 0.2.0
15
-
16
- - `init` with an empty key or project id logs a warning, returns false and leaves Blipit off instead of throwing. It returns true when started.
package/README.md CHANGED
@@ -2,14 +2,18 @@
2
2
 
3
3
  Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.
4
4
 
5
+ Runs on blipit-nuggets, Blipit's own capture core. No third-party monitoring SDK is installed with it.
6
+
5
7
  ## Install
6
8
 
7
9
  ```sh
8
- npm install @blipit/react-native @sentry/react-native
10
+ npm install @blipit/react-native
9
11
  npx pod-install
10
12
  ```
11
13
 
12
- Expo projects add the `@sentry/react-native/expo` config plugin to `app.json` as usual; the Blipit key and project id go in code.
14
+ The package links a small native module, `BlipitNuggets`, that starts Blipit's own native SDKs for native crashes: `blipit-android` (JitPack, `com.github.blipit-io:blipit-android:v0.5.0`) and `blipit-swift` (`https://github.com/blipit-io/blipit-swift`, 0.5.0 or newer). The module's Gradle file adds the JitPack repository on its own. If your `settings.gradle` uses `RepositoriesMode.FAIL_ON_PROJECT_REPOS`, add `maven { url "https://jitpack.io" }` there. On iOS, React Native 0.75 and newer pull `blipit-swift` through Swift Package Manager from the podspec; older versions use the `BlipitSwift` 0.5.0 pod.
15
+
16
+ Expo: run `npx expo prebuild` (or use a development build). Expo Go has no custom native code, so JavaScript errors are still reported there but native crashes are not.
13
17
 
14
18
  ## Quick start
15
19
 
@@ -23,7 +27,43 @@ Blipit.init({ key: "<public key>", project: <project id>, environment: "producti
23
27
  export default Blipit.wrap(App);
24
28
  ```
25
29
 
26
- Both values are on the project's Keys page at app.blipit.io. If the key or project id is empty, `init` logs a warning, returns `false` and Blipit stays off; it never throws, so a missing key cannot crash the app at launch. Unhandled JavaScript errors and native crashes are reported on their own.
30
+ Both values are on the project's Keys page at app.blipit.io. If the key or project id is empty, `init` logs a warning, returns `false` and Blipit stays off; it never throws, so a missing key cannot crash the app at launch.
31
+
32
+ Without `release`, the release is read from the app: `<bundle id>@<version>+<build>`.
33
+
34
+ What is reported on its own:
35
+
36
+ - Uncaught JavaScript errors, through React Native's global error handler. Fatal ones are written to disk before the app closes and sent on the next launch.
37
+ - Unhandled promise rejections (Hermes, the default engine).
38
+ - Native crashes on Android and iOS, by Blipit's own native SDKs.
39
+ - Sessions (crash-free rate), when a release is known. Turn off with `autoSessionTracking: false`.
40
+
41
+ Breadcrumbs, kept in a ring of 50 and sent with the next error: `console.warn` and `console.error`, every `fetch` and `XMLHttpRequest` call (method, URL without its query, status, duration; never headers or bodies), and screen changes when you connect React Navigation:
42
+
43
+ ```tsx
44
+ const navigation = useNavigationContainerRef();
45
+ <NavigationContainer ref={navigation} onReady={() => Blipit.trackNavigation(navigation)}>
46
+ ```
47
+
48
+ Events wait in a queue of up to 30, stored on the device, so errors seen offline are sent later. When Blipit answers 429 the SDK waits for the time the server asks for and keeps the events.
49
+
50
+ ## Options
51
+
52
+ | Option | Default | |
53
+ | --- | --- | --- |
54
+ | `key` / `publicKey` | | The project's public key |
55
+ | `project` | | The project id |
56
+ | `endpoint` | `https://in.blipit.io` | |
57
+ | `environment` | `production` | |
58
+ | `release` | from the app | |
59
+ | `sampleRate` | `1` | Share of errors to send |
60
+ | `maxBreadcrumbs` | `50` | At most 100 |
61
+ | `ignoreErrors` | `[]` | Strings or regular expressions |
62
+ | `beforeSend` | | Change or drop an event; return `null` to drop |
63
+ | `enabled` | `true` | `false` starts with Blipit off |
64
+ | `autoSessionTracking` | `true` | |
65
+ | `enableNative` | `true` | `false` if you start blipit-android or blipit-swift yourself |
66
+ | `waitForReady` | `false` | Watch startup until `reportReady()` |
27
67
 
28
68
  ## Manual capture
29
69
 
@@ -32,11 +72,28 @@ Blipit.captureException(err);
32
72
  Blipit.captureMessage("cache miss rate above 50%", "warning");
33
73
  Blipit.setUser({ id: "42", email: "ana@example.com" });
34
74
  Blipit.setTag("region", "ap-southeast-1");
35
- Blipit.addBreadcrumb({ category: "ui", message: "opened checkout" });
75
+ Blipit.addBreadcrumb({ category: "custom", message: "opened checkout" });
36
76
  Blipit.captureSecurity("login_failed", "ana@example.com", { ip: "10.0.0.1" });
37
77
  await Blipit.flush();
38
78
  ```
39
79
 
80
+ `<Blipit.ErrorBoundary fallback={...}>` reports render errors in a part of the tree and shows the fallback. Without a fallback the error is reported and passed on, as before.
81
+
82
+ ## Consent and turning Blipit off
83
+
84
+ ```ts
85
+ Blipit.setEnabled(false);
86
+ Blipit.setEnabled(true);
87
+ Blipit.isEnabled();
88
+ ```
89
+
90
+ `setEnabled(false)` stops capture at once and deletes queued events and breadcrumbs from the device. Use it as the switch behind your own consent screen, or start with `enabled: false` and call `setEnabled(true)` once the person agrees. Session replay on Android needs its own consent, passed to the native SDK:
91
+
92
+ ```ts
93
+ Blipit.setReplayConsent(true);
94
+ Blipit.hasReplayConsent();
95
+ ```
96
+
40
97
  ## Bug reports
41
98
 
42
99
  Install `react-native-view-shot` for screenshots, wrap your app in `BlipitReporter` (`showButton` adds the floating Report a bug button) and call `showReport()` from your own menu:
@@ -75,17 +132,37 @@ If one does not finish in time, Blipit opens a **Stuck** issue with the flow, th
75
132
 
76
133
  Call `startFlow` when the person starts the action (taps Continue with Google), not when the screen opens. `endFlow` covers every way out, including the person cancelling. Flow and step names are sent as you write them: use fixed names such as `sign-in` or `google-picker`, never emails, phone numbers or other personal data.
77
134
 
78
- ## Store declarations
135
+ Stuck reports go through the same on-device queue as errors, so they survive going offline and respect `setEnabled(false)`.
136
+
137
+ ## Store checklists
138
+
139
+ What the SDK collects: error type, message and stack, breadcrumbs listed above, OS name and version, device model, screen size, app release, and the user id, email or username only if you call `setUser`. No advertising identifier, no IDFA, no Android advertising ID, no location, no contacts. The SDK does not track people across apps or websites.
140
+
141
+ ### Apple App Store
142
+
143
+ - The pod bundles `PrivacyInfo.xcprivacy`: `NSPrivacyTracking` false, no tracking domains, collected types Crash Data and Other Diagnostic Data, not linked, purpose App Functionality. It uses no required-reason API.
144
+ - App Privacy answers in App Store Connect: Diagnostics, Crash Data and Other Diagnostic Data, not used for tracking. If you call `setUser`, also declare User ID and, if you pass it, Email Address, linked to the user, purpose App Functionality.
145
+ - No App Tracking Transparency prompt is needed: the SDK never reads the IDFA and links no AdSupport or AppTrackingTransparency framework.
146
+ - blipit-swift ships its own privacy manifest; Xcode merges both into the app's privacy report.
147
+
148
+ ### Google Play
149
+
150
+ - The module adds no permissions to the manifest. `INTERNET` comes from React Native itself.
151
+ - Data safety form: Crash logs and Diagnostics, collected, not shared, encrypted in transit (HTTPS), purpose App functionality. Add User IDs and Email address if you call `setUser`.
152
+ - No advertising ID, no device identifiers beyond the model name; nothing that Play's Families policy forbids. For child-directed apps keep `setUser` to an internal id.
153
+ - Queued events are stored in the app's no-backup folder, so they are not copied by Android backups.
79
154
 
80
- What to declare when you ship an app with Blipit:
155
+ ### Huawei AppGallery
81
156
 
82
- - **Apple App Store**: the native crash library inside the package ships its own privacy manifest, and Blipit's JavaScript code uses no required-reason APIs. In App Store Connect, App Privacy, declare crash data, performance data and other diagnostic data under App Functionality, not linked, no tracking. Blipit uses no IDFA, no App Tracking Transparency prompt and no background modes. If you call `setUser` with an id or email, declare those as linked to the person.
83
- - **Google Play**: in the Data safety form declare App info and performance, Crash logs and Diagnostics: collected, not shared, processed in transit with encryption, not optional, for App functionality and Analytics. Blipit adds no permissions, reads no Android ID, IMEI or advertising id, and starts no WorkManager job or foreground service. If you call `setUser`, also declare User IDs or Email address.
84
- - **Huawei AppGallery**: the Android path needs neither Google Play services nor HMS Core. In your privacy statement, list crash and diagnostic data sent to Blipit (Louward Labs FZC LLC) for app stability, and the same items in the AppGallery Connect privacy section.
157
+ - No Google Mobile Services: the module and blipit-android depend on no `com.google.android.gms` or Firebase library, so the app runs on HarmonyOS and Huawei phones without GMS.
158
+ - In your privacy statement and the AppGallery Connect privacy section, list crash and diagnostic data sent to Blipit (Louward Labs FZC LLC) for app stability, the same items as the Google Play Data safety form above.
85
159
 
86
- ## Performance
160
+ ## Moving from 0.4
87
161
 
88
- Pass `tracesSampleRate: 0.2` to `init` and screen loads and requests show up on the Performance page.
162
+ - Uninstall `@sentry/react-native`; it is no longer used. Remove its Expo config plugin from `app.json` if you added it for Blipit.
163
+ - `dsn()` and `withIdentity()` are gone; events go to `POST /api/v1/events` with the `X-Blipit-Key` header.
164
+ - `init` takes the options in the table above. Options that belonged to the old wrapped library are no longer read.
165
+ - `tracesSampleRate` is accepted but performance traces are not sent by this version.
89
166
 
90
167
  Docs: https://docs.blipit.io/mobile
91
168
 
@@ -0,0 +1,32 @@
1
+ def safeExtGet(prop, fallback) {
2
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3
+ }
4
+
5
+ apply plugin: "com.android.library"
6
+ apply plugin: "kotlin-android"
7
+
8
+ android {
9
+ namespace "io.blipit.reactnative"
10
+ compileSdkVersion safeExtGet("compileSdkVersion", 35)
11
+
12
+ defaultConfig {
13
+ minSdkVersion safeExtGet("minSdkVersion", 24)
14
+ targetSdkVersion safeExtGet("targetSdkVersion", 35)
15
+ }
16
+
17
+ compileOptions {
18
+ sourceCompatibility JavaVersion.VERSION_17
19
+ targetCompatibility JavaVersion.VERSION_17
20
+ }
21
+ }
22
+
23
+ repositories {
24
+ google()
25
+ mavenCentral()
26
+ maven { url "https://jitpack.io" }
27
+ }
28
+
29
+ dependencies {
30
+ implementation "com.facebook.react:react-android"
31
+ implementation "com.github.blipit-io:blipit-android:v0.5.0"
32
+ }
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1,79 @@
1
+ package io.blipit.reactnative
2
+
3
+ import android.os.Build
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
6
+ import com.facebook.react.bridge.ReactMethod
7
+ import io.blipit.android.Blipit
8
+ import io.blipit.android.BlipitOptions
9
+ import java.io.File
10
+
11
+ class BlipitNuggetsModule(private val context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
12
+ override fun getName() = "BlipitNuggets"
13
+
14
+ private val queue: File get() = File(context.noBackupFilesDir, "blipit-nuggets/queue.json")
15
+
16
+ override fun getConstants(): Map<String, Any?> {
17
+ val info = runCatching { context.packageManager.getPackageInfo(context.packageName, 0) }.getOrNull()
18
+ val build = info?.let { if (Build.VERSION.SDK_INT >= 28) it.longVersionCode else @Suppress("DEPRECATION") it.versionCode.toLong() }
19
+ return mapOf(
20
+ "appId" to context.packageName,
21
+ "appVersion" to info?.versionName,
22
+ "appBuild" to build?.toString(),
23
+ "model" to Build.MODEL,
24
+ "osVersion" to Build.VERSION.RELEASE,
25
+ )
26
+ }
27
+
28
+ @ReactMethod
29
+ fun start(key: String, project: String, environment: String?, release: String?, endpoint: String) {
30
+ synchronized(BlipitNuggetsModule::class.java) {
31
+ if (started) return
32
+ runCatching {
33
+ Blipit.init(context.applicationContext, BlipitOptions().apply {
34
+ this.key = key
35
+ this.project = project
36
+ this.environment = environment
37
+ this.release = release
38
+ this.endpoint = endpoint
39
+ })
40
+ started = true
41
+ }
42
+ }
43
+ }
44
+
45
+ @ReactMethod
46
+ fun setUser(id: String?, email: String?, username: String?) {
47
+ if (started) runCatching { Blipit.setUser(id, email, username) }
48
+ }
49
+
50
+ @ReactMethod
51
+ fun setTag(key: String, value: String) {
52
+ if (started) runCatching { Blipit.setTag(key, value) }
53
+ }
54
+
55
+ @ReactMethod
56
+ fun setReplayConsent(granted: Boolean) {
57
+ runCatching { Blipit.setReplayConsent(granted) }
58
+ }
59
+
60
+ @ReactMethod(isBlockingSynchronousMethod = true)
61
+ fun hasReplayConsent(): Boolean = runCatching { Blipit.hasReplayConsent() }.getOrDefault(false)
62
+
63
+ @ReactMethod(isBlockingSynchronousMethod = true)
64
+ fun save(data: String): Boolean = runCatching {
65
+ val target = queue
66
+ target.parentFile?.mkdirs()
67
+ val tmp = File(target.parentFile, "queue.json.tmp")
68
+ tmp.writeText(data)
69
+ tmp.renameTo(target)
70
+ }.getOrDefault(false)
71
+
72
+ @ReactMethod(isBlockingSynchronousMethod = true)
73
+ fun load(): String? = runCatching { queue.takeIf { it.exists() }?.readText() }.getOrNull()
74
+
75
+ companion object {
76
+ @Volatile
77
+ private var started = false
78
+ }
79
+ }
@@ -0,0 +1,12 @@
1
+ package io.blipit.reactnative
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+ class BlipitNuggetsPackage : ReactPackage {
9
+ override fun createNativeModules(context: ReactApplicationContext): List<NativeModule> = listOf(BlipitNuggetsModule(context))
10
+
11
+ override fun createViewManagers(context: ReactApplicationContext): List<ViewManager<*, *>> = emptyList()
12
+ }