New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@therms/web-js

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@therms/web-js - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.3.0](http://bitbucket.org/thermsio/web-js/compare/v1.2.0...v1.3.0) (2021-11-28)
### Features
* device getDevice() with permissions for domain ([afc69de](http://bitbucket.org/thermsio/web-js/commits/afc69debe314c552953667f43d1da4aa7f239123))
# [1.2.0](http://bitbucket.org/thermsio/web-js/compare/v1.1.3...v1.2.0) (2021-11-21)

@@ -2,0 +9,0 @@

@@ -7,2 +7,3 @@ 'use strict';

var dayjs = require('dayjs');
var Browser = require('browser');

@@ -13,2 +14,3 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
var Browser__default = /*#__PURE__*/_interopDefaultLegacy(Browser);

@@ -329,2 +331,40 @@ document.hasFocus();

const permissionsState = {
backgroundSync: 'prompt',
bluetooth: 'prompt',
camera: 'prompt',
geolocation: 'prompt',
backgroundGeolocation: 'prompt',
microphone: 'prompt',
nfc: 'prompt',
notifications: 'prompt',
};
const getDevice = async () => {
const { browser, os, platform } = Browser__default["default"].parse(window?.navigator?.userAgent);
const device = {
name: `${browser.name} ${browser.version}`,
os: `${os.name} ${os.versionName} (${platform.type})`,
permissions: {
backgroundSync: permissionsState.backgroundSync === 'granted',
bluetooth: permissionsState.bluetooth === 'granted',
camera: permissionsState.camera === 'granted',
geolocation: permissionsState.geolocation === 'granted',
backgroundGeolocation: permissionsState.backgroundGeolocation === 'granted',
microphone: permissionsState.microphone === 'granted',
notifications: permissionsState.notifications === 'granted',
},
type: 'browser',
uuid: '',
};
const deviceUUID = localStorage.getItem('device-uuid');
if (deviceUUID) {
device.uuid = deviceUUID;
}
else {
const newDeviceUUID = new Date().getTime().toString();
device.uuid = newDeviceUUID;
localStorage.setItem('device-uuid', newDeviceUUID);
}
return device;
};
const isMobileDevice = (userAgent) => {

@@ -372,2 +412,3 @@ const ua = userAgent || navigator.userAgent;

exports.getCookie = getCookie;
exports.getDevice = getDevice;
exports.getNumberWithOrdinal = getNumberWithOrdinal;

@@ -374,0 +415,0 @@ exports.globalVent = globalVent;

41

dist/index.js
import Cookie from 'js-cookie';
import dayjs from 'dayjs';
import Browser from 'browser';

@@ -318,2 +319,40 @@ document.hasFocus();

const permissionsState = {
backgroundSync: 'prompt',
bluetooth: 'prompt',
camera: 'prompt',
geolocation: 'prompt',
backgroundGeolocation: 'prompt',
microphone: 'prompt',
nfc: 'prompt',
notifications: 'prompt',
};
const getDevice = async () => {
const { browser, os, platform } = Browser.parse(window?.navigator?.userAgent);
const device = {
name: `${browser.name} ${browser.version}`,
os: `${os.name} ${os.versionName} (${platform.type})`,
permissions: {
backgroundSync: permissionsState.backgroundSync === 'granted',
bluetooth: permissionsState.bluetooth === 'granted',
camera: permissionsState.camera === 'granted',
geolocation: permissionsState.geolocation === 'granted',
backgroundGeolocation: permissionsState.backgroundGeolocation === 'granted',
microphone: permissionsState.microphone === 'granted',
notifications: permissionsState.notifications === 'granted',
},
type: 'browser',
uuid: '',
};
const deviceUUID = localStorage.getItem('device-uuid');
if (deviceUUID) {
device.uuid = deviceUUID;
}
else {
const newDeviceUUID = new Date().getTime().toString();
device.uuid = newDeviceUUID;
localStorage.setItem('device-uuid', newDeviceUUID);
}
return device;
};
const isMobileDevice = (userAgent) => {

@@ -354,3 +393,3 @@ const ua = userAgent || navigator.userAgent;

export { Vent, b2bComms, checkIsBrowserVisible, deleteCookie, flashBrowserTitle, getColorContrast, getCookie, getNumberWithOrdinal, globalVent, humanizeMillis, humanizeMinutes, isMobileDevice, isPlural, onBrowserFocusChange, retryPromise, roundToNearestMin, setBrowserTitle, setCookie, setLocaleFirstDayOfWeek, sleep };
export { Vent, b2bComms, checkIsBrowserVisible, deleteCookie, flashBrowserTitle, getColorContrast, getCookie, getDevice, getNumberWithOrdinal, globalVent, humanizeMillis, humanizeMinutes, isMobileDevice, isPlural, onBrowserFocusChange, retryPromise, roundToNearestMin, setBrowserTitle, setCookie, setLocaleFirstDayOfWeek, sleep };
//# sourceMappingURL=index.js.map

3

package.json
{
"name": "@therms/web-js",
"version": "1.2.0",
"version": "1.3.0",
"description": "Common web/JS tools & utilities",

@@ -41,2 +41,3 @@ "main": "dist/cjs.js",

"dependencies": {
"browser": "^0.2.6",
"dayjs": "^1.10.4",

@@ -43,0 +44,0 @@ "fast-memoize": "^2.5.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc