@rpcbase/client 0.238.0 → 0.240.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.
Files changed (2) hide show
  1. package/instrument.ts +32 -0
  2. package/package.json +2 -1
package/instrument.ts ADDED
@@ -0,0 +1,32 @@
1
+ import * as Sentry from "@sentry/react"
2
+ import posthog from "posthog-js"
3
+
4
+
5
+ const isProduction = import.meta.env.MODE === "production"
6
+
7
+
8
+ if (isProduction) {
9
+ Sentry.init({
10
+ dsn: import.meta.env.RB_PUBLIC_SENTRY_DSN,
11
+ integrations: [],
12
+ // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
13
+ // tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
14
+ })
15
+ } else {
16
+ console.info("ℹ️ Not initializing sentry in development")
17
+ }
18
+
19
+ console.log("ENV", import.meta.env)
20
+
21
+ // setup posthog
22
+ posthog.init(import.meta.env.RB_PUBLIC_POSTHOG_KEY, {
23
+ api_host: "/ingest",
24
+ ui_host: "https://eu.posthog.com",
25
+ person_profiles: "always",
26
+ session_recording: {
27
+ maskAllInputs: false
28
+ },
29
+ capture_pageview: isProduction,
30
+ autocapture: isProduction,
31
+ disable_session_recording: !isProduction,
32
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.238.0",
3
+ "version": "0.240.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "scripts": {
@@ -13,6 +13,7 @@
13
13
  "dependencies": [],
14
14
  "files": [
15
15
  "package.json",
16
+ "./instrument.ts",
16
17
  "src/**/*"
17
18
  ],
18
19
  "output": [],