web-manager 4.1.0 → 4.1.1

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/dist/index.js CHANGED
@@ -361,6 +361,9 @@ class Manager {
361
361
  // Set platform (OS) - windows, mac, linux, ios, android, chromeos, unknown
362
362
  $html.dataset.platform = this._utilities.getPlatform();
363
363
 
364
+ // Set browser - chrome, firefox, safari, edge, opera, brave
365
+ $html.dataset.browser = this._utilities.getBrowser();
366
+
364
367
  // Set runtime - web, browser-extension, electron, node
365
368
  $html.dataset.runtime = this._utilities.getRuntime();
366
369
 
@@ -128,6 +128,40 @@ class Utilities {
128
128
  return 'unknown';
129
129
  }
130
130
 
131
+ // Get browser name
132
+ getBrowser() {
133
+ const ua = navigator.userAgent;
134
+
135
+ // Order matters - check more specific browsers first
136
+ // Edge before Chrome (Edge includes "Chrome" in UA)
137
+ if (/edg/i.test(ua)) {
138
+ return 'edge';
139
+ }
140
+ // Opera before Chrome (Opera includes "Chrome" in UA)
141
+ if (/opera|opr/i.test(ua)) {
142
+ return 'opera';
143
+ }
144
+ // Brave before Chrome (Brave includes "Chrome" in UA)
145
+ if (navigator.brave || /brave/i.test(ua)) {
146
+ return 'brave';
147
+ }
148
+ // Chrome (including Chromium-based browsers)
149
+ if (/chrome|chromium|crios/i.test(ua)) {
150
+ return 'chrome';
151
+ }
152
+ // Firefox
153
+ if (/firefox|fxios/i.test(ua)) {
154
+ return 'firefox';
155
+ }
156
+ // Safari last (most browsers include "Safari" in UA)
157
+ if (/safari/i.test(ua)) {
158
+ return 'safari';
159
+ }
160
+
161
+ // Fallback
162
+ return null;
163
+ }
164
+
131
165
  // Get runtime environment
132
166
  getRuntime() {
133
167
  // Use config runtime if provided
@@ -195,12 +229,19 @@ class Utilities {
195
229
  mobile: this.isMobile(),
196
230
  deviceType: this.getDeviceType(),
197
231
  platform: this.getPlatform(),
232
+ browser: this.getBrowser(),
233
+ vendor: navigator.vendor,
198
234
  runtime: this.getRuntime(),
199
235
  userAgent: navigator.userAgent,
200
236
  url: window.location.href,
201
237
  },
202
- browser: {
203
- vendor: navigator.vendor,
238
+ geolocation: {
239
+ ip: null,
240
+ country: null,
241
+ region: null,
242
+ city: null,
243
+ latitude: null,
244
+ longitude: null,
204
245
  },
205
246
  };
206
247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",