@rpcbase/client 0.262.0 → 0.264.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/instrument.ts +3 -1
- package/package.json +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useMediaQuery.ts +31 -0
package/instrument.ts
CHANGED
|
@@ -4,10 +4,12 @@ import posthog from "posthog-js"
|
|
|
4
4
|
const isProduction = import.meta.env.MODE === "production"
|
|
5
5
|
|
|
6
6
|
if (isProduction) {
|
|
7
|
+
console.log("Initializing Sentry with dsn:", import.meta.env.RB_PUBLIC_SENTRY_DSN)
|
|
7
8
|
Sentry.init({
|
|
8
9
|
dsn: import.meta.env.RB_PUBLIC_SENTRY_DSN,
|
|
10
|
+
sendDefaultPii: true,
|
|
9
11
|
tracesSampleRate: 1.0,
|
|
10
|
-
|
|
12
|
+
debug: true,
|
|
11
13
|
})
|
|
12
14
|
} else {
|
|
13
15
|
console.info("ℹ️ Not initializing sentry in development")
|
package/package.json
CHANGED
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const emptyUnsubscribe = () => {}
|
|
5
|
+
|
|
6
|
+
export const useMediaQuery = (query: string): boolean => {
|
|
7
|
+
const isServer = typeof window === "undefined"
|
|
8
|
+
|
|
9
|
+
const subscribe = (callback: () => void) => {
|
|
10
|
+
if (isServer) return emptyUnsubscribe
|
|
11
|
+
|
|
12
|
+
const mql = window.matchMedia(query)
|
|
13
|
+
|
|
14
|
+
// Modern browsers
|
|
15
|
+
if (mql.addEventListener) {
|
|
16
|
+
mql.addEventListener("change", callback)
|
|
17
|
+
return () => mql.removeEventListener("change", callback)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Legacy fallback
|
|
21
|
+
mql.addListener(callback)
|
|
22
|
+
return () => mql.removeListener(callback)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getSnapshot = () => {
|
|
26
|
+
if (isServer) return false
|
|
27
|
+
return window.matchMedia(query).matches
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return useSyncExternalStore(subscribe, getSnapshot, () => false)
|
|
31
|
+
}
|