@cuemath/web-utils 1.0.7-santosh1.1 → 1.0.7
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.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
- package/src/index.ts +0 -1
- package/dist/device-details/index.d.ts +0 -11
- package/dist/device-details/index.js +0 -47
- package/dist/device-details/index.js.map +0 -1
- package/src/device-details/index.ts +0 -55
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,5 +21,4 @@ __exportStar(require("./date-time-helper"), exports);
|
|
|
21
21
|
__exportStar(require("./object"), exports);
|
|
22
22
|
__exportStar(require("./growth-source"), exports);
|
|
23
23
|
__exportStar(require("./e-cna"), exports);
|
|
24
|
-
__exportStar(require("./device-details"), exports);
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,kDAAgC;AAChC,qDAAmC;AACnC,2CAAyB;AACzB,kDAAgC;AAChC,0CAAwB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,kDAAgC;AAChC,qDAAmC;AACnC,2CAAyB;AACzB,kDAAgC;AAChC,0CAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuemath/web-utils",
|
|
3
|
-
"version": "1.0.7
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Shared web utils package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,8 +41,6 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node": "^18.11.18",
|
|
44
|
-
"
|
|
45
|
-
"dayjs": "^1.11.7",
|
|
46
|
-
"ua-parser-js": "^1.0.35"
|
|
44
|
+
"dayjs": "^1.11.7"
|
|
47
45
|
}
|
|
48
46
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import UAParser from 'ua-parser-js';
|
|
2
|
-
type Connection = Record<'effectiveType' | 'rtt' | 'downlink', string>;
|
|
3
|
-
interface DetailedDeviceInformation extends UAParser.IResult, Partial<Connection> {
|
|
4
|
-
screenHeight?: number;
|
|
5
|
-
screenWidth?: number;
|
|
6
|
-
viewportHeight?: number;
|
|
7
|
-
viewportWidth?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare const getDeviceInformation: () => UAParser.IResult | null;
|
|
10
|
-
export declare const getDetailedDeviceInformation: () => DetailedDeviceInformation | null;
|
|
11
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDetailedDeviceInformation = exports.getDeviceInformation = void 0;
|
|
7
|
-
const ua_parser_js_1 = __importDefault(require("ua-parser-js"));
|
|
8
|
-
const getDeviceInformation = () => {
|
|
9
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent) {
|
|
10
|
-
const parser = new ua_parser_js_1.default(navigator.userAgent).getResult();
|
|
11
|
-
return parser;
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
};
|
|
15
|
-
exports.getDeviceInformation = getDeviceInformation;
|
|
16
|
-
const getConnectionDetails = () => {
|
|
17
|
-
if (typeof navigator === 'undefined' || typeof window === 'undefined')
|
|
18
|
-
return null;
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
-
// @ts-expect-error
|
|
21
|
-
const { downlink, effectiveType, rtt } = navigator.connection || {};
|
|
22
|
-
return {
|
|
23
|
-
downlink,
|
|
24
|
-
effectiveType,
|
|
25
|
-
rtt,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const getDetailedDeviceInformation = () => {
|
|
29
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent) {
|
|
30
|
-
const parser = new ua_parser_js_1.default(navigator.userAgent).getResult();
|
|
31
|
-
const screenHeight = window.screen.height;
|
|
32
|
-
const screenWidth = window.screen.width;
|
|
33
|
-
const viewportHeight = window.innerHeight;
|
|
34
|
-
const viewportWidth = window.innerWidth;
|
|
35
|
-
return {
|
|
36
|
-
...parser,
|
|
37
|
-
...getConnectionDetails(),
|
|
38
|
-
screenHeight,
|
|
39
|
-
screenWidth,
|
|
40
|
-
viewportHeight,
|
|
41
|
-
viewportWidth,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
exports.getDetailedDeviceInformation = getDetailedDeviceInformation;
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/device-details/index.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAoC;AAW7B,MAAM,oBAAoB,GAAG,GAA4B,EAAE;IAChE,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,EAAE;QAC3D,MAAM,MAAM,GAAqB,IAAI,sBAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC;QAE/E,OAAO,MAAM,CAAC;KACf;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AARW,QAAA,oBAAoB,wBAQ/B;AAEF,MAAM,oBAAoB,GAAG,GAAsB,EAAE;IACnD,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAEnF,6DAA6D;IAC7D,mBAAmB;IACnB,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC;IAEpE,OAAO;QACL,QAAQ;QACR,aAAa;QACb,GAAG;KACJ,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,4BAA4B,GAAG,GAAqC,EAAE;IACjF,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,SAAS,EAAE;QAC3D,MAAM,MAAM,GAAqB,IAAI,sBAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC;QAC/E,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC1C,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;QAC1C,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC;QAExC,OAAO;YACL,GAAG,MAAM;YACT,GAAG,oBAAoB,EAAE;YACzB,YAAY;YACZ,WAAW;YACX,cAAc;YACd,aAAa;SACd,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAnBW,QAAA,4BAA4B,gCAmBvC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import UAParser from 'ua-parser-js';
|
|
2
|
-
|
|
3
|
-
type Connection = Record<'effectiveType' | 'rtt' | 'downlink', string>;
|
|
4
|
-
|
|
5
|
-
interface DetailedDeviceInformation extends UAParser.IResult, Partial<Connection> {
|
|
6
|
-
screenHeight?: number;
|
|
7
|
-
screenWidth?: number;
|
|
8
|
-
viewportHeight?: number;
|
|
9
|
-
viewportWidth?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const getDeviceInformation = (): UAParser.IResult | null => {
|
|
13
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent) {
|
|
14
|
-
const parser: UAParser.IResult = new UAParser(navigator.userAgent).getResult();
|
|
15
|
-
|
|
16
|
-
return parser;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getConnectionDetails = (): Connection | null => {
|
|
23
|
-
if (typeof navigator === 'undefined' || typeof window === 'undefined') return null;
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
const { downlink, effectiveType, rtt } = navigator.connection || {};
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
downlink,
|
|
31
|
-
effectiveType,
|
|
32
|
-
rtt,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const getDetailedDeviceInformation = (): DetailedDeviceInformation | null => {
|
|
37
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent) {
|
|
38
|
-
const parser: UAParser.IResult = new UAParser(navigator.userAgent).getResult();
|
|
39
|
-
const screenHeight = window.screen.height;
|
|
40
|
-
const screenWidth = window.screen.width;
|
|
41
|
-
const viewportHeight = window.innerHeight;
|
|
42
|
-
const viewportWidth = window.innerWidth;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
...parser,
|
|
46
|
-
...getConnectionDetails(),
|
|
47
|
-
screenHeight,
|
|
48
|
-
screenWidth,
|
|
49
|
-
viewportHeight,
|
|
50
|
-
viewportWidth,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return null;
|
|
55
|
-
};
|