@byhealth/data-reporter
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -24,4 +24,5 @@ 'use strict'; | ||
function _log(level, message, ...args) { | ||
var _a; | ||
if (config.DEBUG) { | ||
console[level]?.(message, ...args); | ||
(_a = console[level]) === null || _a === void 0 ? void 0 : _a.call(console, message, ...args); | ||
} | ||
@@ -48,10 +49,8 @@ } | ||
class Client { | ||
_hooks = {}; | ||
_metadata = {}; | ||
_captureQueue = []; | ||
_token = ''; | ||
_sending = false; | ||
_storage; | ||
_transport; | ||
constructor(options) { | ||
this._hooks = {}; | ||
this._metadata = {}; | ||
this._captureQueue = []; | ||
this._token = ''; | ||
this._sending = false; | ||
this._storage = options.storage; | ||
@@ -126,7 +125,7 @@ this._transport = options.transport; | ||
event, | ||
metadata: this.clone({ ...this._metadata, ...options?.metadata }), | ||
metadata: this.clone({ ...this._metadata, ...options === null || options === void 0 ? void 0 : options.metadata }), | ||
properties: this.clone(properties || {}), | ||
timestamp: this.getTime(), | ||
}; | ||
if (options?.timestamp) { | ||
if (options === null || options === void 0 ? void 0 : options.timestamp) { | ||
data.metadata.ctime = data.timestamp; | ||
@@ -137,3 +136,3 @@ data.timestamp = options.timestamp; | ||
this.send(data, { | ||
instant: !!options?.instant, | ||
instant: !!(options === null || options === void 0 ? void 0 : options.instant), | ||
}); | ||
@@ -216,3 +215,2 @@ } | ||
class BrowserStorage { | ||
_storage; | ||
constructor() { | ||
@@ -276,3 +274,4 @@ this._storage = window.localStorage; | ||
getOS() { | ||
const userAgent = window?.navigator?.userAgent || ''; | ||
var _a; | ||
const userAgent = ((_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) || ''; | ||
let os = ''; | ||
@@ -290,3 +289,4 @@ if (userAgent.indexOf('Win') != -1) | ||
getPlatform() { | ||
const userAgent = window?.navigator?.userAgent || ''; | ||
var _a; | ||
const userAgent = ((_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) || ''; | ||
let platform = ''; | ||
@@ -293,0 +293,0 @@ if (userAgent) |
@@ -22,4 +22,5 @@ import { nanoid } from 'nanoid'; | ||
function _log(level, message, ...args) { | ||
var _a; | ||
if (config.DEBUG) { | ||
console[level]?.(message, ...args); | ||
(_a = console[level]) === null || _a === void 0 ? void 0 : _a.call(console, message, ...args); | ||
} | ||
@@ -46,10 +47,8 @@ } | ||
class Client { | ||
_hooks = {}; | ||
_metadata = {}; | ||
_captureQueue = []; | ||
_token = ''; | ||
_sending = false; | ||
_storage; | ||
_transport; | ||
constructor(options) { | ||
this._hooks = {}; | ||
this._metadata = {}; | ||
this._captureQueue = []; | ||
this._token = ''; | ||
this._sending = false; | ||
this._storage = options.storage; | ||
@@ -124,7 +123,7 @@ this._transport = options.transport; | ||
event, | ||
metadata: this.clone({ ...this._metadata, ...options?.metadata }), | ||
metadata: this.clone({ ...this._metadata, ...options === null || options === void 0 ? void 0 : options.metadata }), | ||
properties: this.clone(properties || {}), | ||
timestamp: this.getTime(), | ||
}; | ||
if (options?.timestamp) { | ||
if (options === null || options === void 0 ? void 0 : options.timestamp) { | ||
data.metadata.ctime = data.timestamp; | ||
@@ -135,3 +134,3 @@ data.timestamp = options.timestamp; | ||
this.send(data, { | ||
instant: !!options?.instant, | ||
instant: !!(options === null || options === void 0 ? void 0 : options.instant), | ||
}); | ||
@@ -214,3 +213,2 @@ } | ||
class BrowserStorage { | ||
_storage; | ||
constructor() { | ||
@@ -274,3 +272,4 @@ this._storage = window.localStorage; | ||
getOS() { | ||
const userAgent = window?.navigator?.userAgent || ''; | ||
var _a; | ||
const userAgent = ((_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) || ''; | ||
let os = ''; | ||
@@ -288,3 +287,4 @@ if (userAgent.indexOf('Win') != -1) | ||
getPlatform() { | ||
const userAgent = window?.navigator?.userAgent || ''; | ||
var _a; | ||
const userAgent = ((_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) || ''; | ||
let platform = ''; | ||
@@ -291,0 +291,0 @@ if (userAgent) |
{ | ||
"name": "@byhealth/data-reporter", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53953