diginext-utils 3.13.4 → 3.13.6
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/device/camera.js +9 -2
- package/dist/device/index.d.ts +3 -3
- package/dist/device/index.js +13 -8
- package/dist/string/padNumberWithLeadingZeros.d.ts +1 -0
- package/dist/string/padNumberWithLeadingZeros.js +12 -0
- package/esm/device/camera.js +9 -2
- package/esm/device/index.d.ts +3 -3
- package/esm/device/index.js +12 -7
- package/esm/string/padNumberWithLeadingZeros.d.ts +1 -0
- package/esm/string/padNumberWithLeadingZeros.js +9 -0
- package/package.json +1 -1
package/dist/device/camera.js
CHANGED
|
@@ -55,7 +55,7 @@ function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
55
55
|
let cams = "";
|
|
56
56
|
let backCamera;
|
|
57
57
|
inputCameras.map((cam, index) => {
|
|
58
|
-
cams += `[${cam.deviceId}] ${cam.kind} | ${cam.label}\n`;
|
|
58
|
+
cams += `[${cam === null || cam === void 0 ? void 0 : cam.deviceId}] ${cam === null || cam === void 0 ? void 0 : cam.kind} | ${cam === null || cam === void 0 ? void 0 : cam.label}\n`;
|
|
59
59
|
// console.log(cam);
|
|
60
60
|
let label = cam.label.toLowerCase();
|
|
61
61
|
if (label.indexOf("back") > -1 || label.indexOf("facetime") > -1) {
|
|
@@ -66,6 +66,10 @@ function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
66
66
|
if (backCameras.length > 1) {
|
|
67
67
|
backCamera = backCameras[backCameras.length - 1];
|
|
68
68
|
}
|
|
69
|
+
if (backCameras.length == 0) {
|
|
70
|
+
backCamera = inputCameras[0];
|
|
71
|
+
backCameras.push(backCamera);
|
|
72
|
+
}
|
|
69
73
|
console.log(`[Camera.js] All input sources:`, cams);
|
|
70
74
|
console.log(`[Camera.js] This device has ${backCameras.length} back camera${backCameras.length > 1 ? "s" : ""}.`);
|
|
71
75
|
console.log("[Camera.js] backCameras:", JSON.stringify(backCameras));
|
|
@@ -95,7 +99,10 @@ function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
101
|
else {
|
|
98
|
-
navigator.mediaDevices
|
|
102
|
+
navigator.mediaDevices
|
|
103
|
+
.getUserMedia(requestedMediaConstraints)
|
|
104
|
+
.then(onStreamReceived)
|
|
105
|
+
.catch(handleError);
|
|
99
106
|
// if (scope.onGotDevicesFailed) scope.onGotDevicesFailed();
|
|
100
107
|
}
|
|
101
108
|
}
|
package/dist/device/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const isIos: () => boolean
|
|
2
|
-
export declare const isAndroid: () => boolean
|
|
1
|
+
export declare const isIos: () => boolean;
|
|
2
|
+
export declare const isAndroid: () => boolean;
|
|
3
3
|
export declare const isTablet: () => boolean | null;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const isMobile: () => boolean | null;
|
|
5
5
|
export declare const checkOS: () => any;
|
package/dist/device/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const isIos = () => {
|
|
|
6
6
|
if (deviceInfo)
|
|
7
7
|
return deviceInfo.os.toLowerCase() == "ios";
|
|
8
8
|
console.log("Can't check OS");
|
|
9
|
-
return
|
|
9
|
+
return false;
|
|
10
10
|
};
|
|
11
11
|
exports.isIos = isIos;
|
|
12
12
|
const isAndroid = () => {
|
|
@@ -14,23 +14,28 @@ const isAndroid = () => {
|
|
|
14
14
|
if (deviceInfo)
|
|
15
15
|
return deviceInfo.os.toLowerCase() == "android";
|
|
16
16
|
console.log("Can't check OS");
|
|
17
|
-
return
|
|
17
|
+
return false;
|
|
18
18
|
};
|
|
19
19
|
exports.isAndroid = isAndroid;
|
|
20
20
|
const isTablet = () => {
|
|
21
21
|
if (typeof navigator == "undefined")
|
|
22
|
-
return
|
|
22
|
+
return false;
|
|
23
23
|
if (typeof window == "undefined")
|
|
24
|
-
return
|
|
25
|
-
return isMobile() && window.innerWidth > 599 && window.innerHeight > 599;
|
|
24
|
+
return false;
|
|
25
|
+
return (0, exports.isMobile)() && window.innerWidth > 599 && window.innerHeight > 599;
|
|
26
26
|
};
|
|
27
27
|
exports.isTablet = isTablet;
|
|
28
|
-
|
|
28
|
+
const isMobile = () => {
|
|
29
|
+
if (typeof window == "undefined")
|
|
30
|
+
return null;
|
|
29
31
|
if (typeof navigator === "undefined")
|
|
30
32
|
return false;
|
|
31
33
|
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
// Check if the device is running iPadOS
|
|
35
|
+
const isIPadOS = /Macintosh/.test(userAgent) && "ontouchend" in document;
|
|
36
|
+
return (isIPadOS ||
|
|
37
|
+
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|windows phone/i.test(userAgent.toLowerCase()));
|
|
38
|
+
};
|
|
34
39
|
exports.isMobile = isMobile;
|
|
35
40
|
/**
|
|
36
41
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function padNumberWithLeadingZeros(number: number, length: number): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function padNumberWithLeadingZeros(number, length) {
|
|
4
|
+
//
|
|
5
|
+
try {
|
|
6
|
+
return number.toString().padStart(length, "0");
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
throw new Error(`padNumberWithLeadingZeros failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = padNumberWithLeadingZeros;
|
package/esm/device/camera.js
CHANGED
|
@@ -52,7 +52,7 @@ export function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
52
52
|
let cams = "";
|
|
53
53
|
let backCamera;
|
|
54
54
|
inputCameras.map((cam, index) => {
|
|
55
|
-
cams += `[${cam.deviceId}] ${cam.kind} | ${cam.label}\n`;
|
|
55
|
+
cams += `[${cam === null || cam === void 0 ? void 0 : cam.deviceId}] ${cam === null || cam === void 0 ? void 0 : cam.kind} | ${cam === null || cam === void 0 ? void 0 : cam.label}\n`;
|
|
56
56
|
// console.log(cam);
|
|
57
57
|
let label = cam.label.toLowerCase();
|
|
58
58
|
if (label.indexOf("back") > -1 || label.indexOf("facetime") > -1) {
|
|
@@ -63,6 +63,10 @@ export function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
63
63
|
if (backCameras.length > 1) {
|
|
64
64
|
backCamera = backCameras[backCameras.length - 1];
|
|
65
65
|
}
|
|
66
|
+
if (backCameras.length == 0) {
|
|
67
|
+
backCamera = inputCameras[0];
|
|
68
|
+
backCameras.push(backCamera);
|
|
69
|
+
}
|
|
66
70
|
console.log(`[Camera.js] All input sources:`, cams);
|
|
67
71
|
console.log(`[Camera.js] This device has ${backCameras.length} back camera${backCameras.length > 1 ? "s" : ""}.`);
|
|
68
72
|
console.log("[Camera.js] backCameras:", JSON.stringify(backCameras));
|
|
@@ -92,7 +96,10 @@ export function getWebcam(params = { facingMode: "environment", audio: true }) {
|
|
|
92
96
|
});
|
|
93
97
|
}
|
|
94
98
|
else {
|
|
95
|
-
navigator.mediaDevices
|
|
99
|
+
navigator.mediaDevices
|
|
100
|
+
.getUserMedia(requestedMediaConstraints)
|
|
101
|
+
.then(onStreamReceived)
|
|
102
|
+
.catch(handleError);
|
|
96
103
|
// if (scope.onGotDevicesFailed) scope.onGotDevicesFailed();
|
|
97
104
|
}
|
|
98
105
|
}
|
package/esm/device/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const isIos: () => boolean
|
|
2
|
-
export declare const isAndroid: () => boolean
|
|
1
|
+
export declare const isIos: () => boolean;
|
|
2
|
+
export declare const isAndroid: () => boolean;
|
|
3
3
|
export declare const isTablet: () => boolean | null;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const isMobile: () => boolean | null;
|
|
5
5
|
export declare const checkOS: () => any;
|
package/esm/device/index.js
CHANGED
|
@@ -3,28 +3,33 @@ export const isIos = () => {
|
|
|
3
3
|
if (deviceInfo)
|
|
4
4
|
return deviceInfo.os.toLowerCase() == "ios";
|
|
5
5
|
console.log("Can't check OS");
|
|
6
|
-
return
|
|
6
|
+
return false;
|
|
7
7
|
};
|
|
8
8
|
export const isAndroid = () => {
|
|
9
9
|
const deviceInfo = checkOS();
|
|
10
10
|
if (deviceInfo)
|
|
11
11
|
return deviceInfo.os.toLowerCase() == "android";
|
|
12
12
|
console.log("Can't check OS");
|
|
13
|
-
return
|
|
13
|
+
return false;
|
|
14
14
|
};
|
|
15
15
|
export const isTablet = () => {
|
|
16
16
|
if (typeof navigator == "undefined")
|
|
17
|
-
return
|
|
17
|
+
return false;
|
|
18
18
|
if (typeof window == "undefined")
|
|
19
|
-
return
|
|
19
|
+
return false;
|
|
20
20
|
return isMobile() && window.innerWidth > 599 && window.innerHeight > 599;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export const isMobile = () => {
|
|
23
|
+
if (typeof window == "undefined")
|
|
24
|
+
return null;
|
|
23
25
|
if (typeof navigator === "undefined")
|
|
24
26
|
return false;
|
|
25
27
|
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// Check if the device is running iPadOS
|
|
29
|
+
const isIPadOS = /Macintosh/.test(userAgent) && "ontouchend" in document;
|
|
30
|
+
return (isIPadOS ||
|
|
31
|
+
/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|windows phone/i.test(userAgent.toLowerCase()));
|
|
32
|
+
};
|
|
28
33
|
/**
|
|
29
34
|
*
|
|
30
35
|
* @returns {{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function padNumberWithLeadingZeros(number: number, length: number): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default function padNumberWithLeadingZeros(number, length) {
|
|
2
|
+
//
|
|
3
|
+
try {
|
|
4
|
+
return number.toString().padStart(length, "0");
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
throw new Error(`padNumberWithLeadingZeros failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
8
|
+
}
|
|
9
|
+
}
|