react-notify-sdk 1.0.29 → 1.0.30

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.
@@ -1,11 +1,14 @@
1
1
  import { useState, useEffect } from 'react';
2
+ import { UAParser } from 'ua-parser-js';
2
3
  const useDeviceDetection = () => {
3
4
  const [device, setDevice] = useState('');
4
5
  useEffect(() => {
5
6
  const handleDeviceDetection = () => {
6
- const userAgent = navigator.userAgent.toLowerCase();
7
- const isMobile = /iphone|ipad|ipod|android|blackberry|windows phone/g.test(userAgent);
8
- const isTablet = /(ipad|tablet|playbook|silk)|(android(?!.*mobile))/g.test(userAgent);
7
+ const parser = new UAParser(navigator.userAgent);
8
+ const parsedDevice = parser.getDevice();
9
+ const isMobile = parsedDevice.type === 'mobile';
10
+ const isTablet = parsedDevice.type === 'tablet';
11
+ const isDesktop = !isMobile && !isTablet;
9
12
  if (isMobile) {
10
13
  setDevice('Mobile');
11
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "SDK for displaying real-time route-specific messages in React apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,8 @@
18
18
  "@supabase/supabase-js": "^2.50.0",
19
19
  "clsx": "^2.1.1",
20
20
  "goober": "^2.1.16",
21
- "lucide-react": "^0.541.0"
21
+ "lucide-react": "^0.541.0",
22
+ "ua-parser-js": "^2.0.4"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/react": "^19.1.8",