@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 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
- // debug: true,
12
+ debug: true,
11
13
  })
12
14
  } else {
13
15
  console.info("ℹ️ Not initializing sentry in development")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.262.0",
3
+ "version": "0.264.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "scripts": {
@@ -1,2 +1,3 @@
1
1
  export * from "./useThrottledMeasure"
2
2
  export * from "./useApplyScroll"
3
+ export * from "./useMediaQuery"
@@ -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
+ }