diginext-utils 3.13.6 → 3.13.8

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.
@@ -28,10 +28,31 @@ const isFacebookWebview = () => {
28
28
  };
29
29
  exports.isFacebookWebview = isFacebookWebview;
30
30
  const isInAppWebview = () => {
31
- const rules = ["WebView", "(iPhone|iPod|iPad)(?!.*Safari/)", "Android.*(wv|.0.0.0)"];
32
- const regex = new RegExp(`(${rules.join("|")})`, "ig");
33
- if ((0, exports.ua)())
34
- return Boolean((0, exports.ua)().match(regex));
35
- return false;
31
+ try {
32
+ const ua = navigator.userAgent;
33
+ const vendor = navigator.vendor;
34
+ // Detect iOS WebView
35
+ const isIOSWebView = /(iPhone|iPod|iPad)(?!.*Safari\/)/i.test(ua);
36
+ // Detect iOS apps that use WKWebView
37
+ const isIOSWKWebView = /AppleWebKit/.test(ua) && /Mobile\/\w+/.test(ua) && !/(Cr|Fx|OP|OPR)\//.test(ua);
38
+ // Additional check for iOS in-app browsers, excluding Chrome
39
+ const isIOSInAppBrowser = isIOSWebView ||
40
+ (/(iPhone|iPod|iPad)/.test(ua) &&
41
+ !/Safari/.test(ua) &&
42
+ !/(CriOS|FxiOS|OPiOS)/.test(ua) &&
43
+ vendor === "Apple Computer, Inc.");
44
+ // Detect Android WebView
45
+ const isAndroidWebView = /Android.*wv|Android.*Version\/[0-9]\.0/.test(ua);
46
+ // Exclude Chrome, Firefox, and Samsung Internet on Android
47
+ const isAndroidStockBrowser = /Android.*Version\//.test(ua);
48
+ const isAndroidChrome = /Android.*Chrome\//.test(ua) && !/Version\//.test(ua);
49
+ const isAndroidFirefox = /Android.*Firefox\//.test(ua);
50
+ const isAndroidSamsung = /Android.*SamsungBrowser\//.test(ua);
51
+ return (isIOSInAppBrowser ||
52
+ (isAndroidWebView && !isAndroidStockBrowser && !isAndroidChrome && !isAndroidFirefox && !isAndroidSamsung));
53
+ }
54
+ catch (error) {
55
+ return true;
56
+ }
36
57
  };
37
58
  exports.isInAppWebview = isInAppWebview;
@@ -66,7 +66,7 @@ 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) {
69
+ else if (backCameras.length == 0) {
70
70
  backCamera = inputCameras[0];
71
71
  backCameras.push(backCamera);
72
72
  }
package/dist/object.js CHANGED
@@ -2,8 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEqual = exports.isObject = exports.iterate = exports.objectToArray = exports.toArray = exports.toFloat = exports.toInt = exports.toBool = exports.isNull = void 0;
4
4
  const isNull = (object) => {
5
- if (object instanceof File)
6
- return false;
5
+ try {
6
+ if (object instanceof File)
7
+ return false;
8
+ }
9
+ catch (error) { }
7
10
  if (typeof object == "undefined")
8
11
  return true;
9
12
  if (object == "")
@@ -40,5 +40,11 @@ const randomFileName = (start = "file", length = 4) => {
40
40
  return `${start}-${+new Date()}-${(0, exports.randomStringAndNumberByLength)(length)}`;
41
41
  };
42
42
  exports.randomFileName = randomFileName;
43
- const random = { randAllCharacterByLength: exports.randAllCharacterByLength, randomStringByLength: exports.randomStringByLength, randomStringAndNumberByLength: exports.randomStringAndNumberByLength, uniqueSortByTime: exports.uniqueSortByTime, randomFileName: exports.randomFileName };
43
+ const random = {
44
+ randAllCharacterByLength: exports.randAllCharacterByLength,
45
+ randomStringByLength: exports.randomStringByLength,
46
+ randomStringAndNumberByLength: exports.randomStringAndNumberByLength,
47
+ uniqueSortByTime: exports.uniqueSortByTime,
48
+ randomFileName: exports.randomFileName,
49
+ };
44
50
  exports.default = random;
@@ -21,9 +21,30 @@ export const isFacebookWebview = () => {
21
21
  return _ua.indexOf("FBAN") > -1 || _ua.indexOf("FBAV") > -1;
22
22
  };
23
23
  export const isInAppWebview = () => {
24
- const rules = ["WebView", "(iPhone|iPod|iPad)(?!.*Safari/)", "Android.*(wv|.0.0.0)"];
25
- const regex = new RegExp(`(${rules.join("|")})`, "ig");
26
- if (ua())
27
- return Boolean(ua().match(regex));
28
- return false;
24
+ try {
25
+ const ua = navigator.userAgent;
26
+ const vendor = navigator.vendor;
27
+ // Detect iOS WebView
28
+ const isIOSWebView = /(iPhone|iPod|iPad)(?!.*Safari\/)/i.test(ua);
29
+ // Detect iOS apps that use WKWebView
30
+ const isIOSWKWebView = /AppleWebKit/.test(ua) && /Mobile\/\w+/.test(ua) && !/(Cr|Fx|OP|OPR)\//.test(ua);
31
+ // Additional check for iOS in-app browsers, excluding Chrome
32
+ const isIOSInAppBrowser = isIOSWebView ||
33
+ (/(iPhone|iPod|iPad)/.test(ua) &&
34
+ !/Safari/.test(ua) &&
35
+ !/(CriOS|FxiOS|OPiOS)/.test(ua) &&
36
+ vendor === "Apple Computer, Inc.");
37
+ // Detect Android WebView
38
+ const isAndroidWebView = /Android.*wv|Android.*Version\/[0-9]\.0/.test(ua);
39
+ // Exclude Chrome, Firefox, and Samsung Internet on Android
40
+ const isAndroidStockBrowser = /Android.*Version\//.test(ua);
41
+ const isAndroidChrome = /Android.*Chrome\//.test(ua) && !/Version\//.test(ua);
42
+ const isAndroidFirefox = /Android.*Firefox\//.test(ua);
43
+ const isAndroidSamsung = /Android.*SamsungBrowser\//.test(ua);
44
+ return (isIOSInAppBrowser ||
45
+ (isAndroidWebView && !isAndroidStockBrowser && !isAndroidChrome && !isAndroidFirefox && !isAndroidSamsung));
46
+ }
47
+ catch (error) {
48
+ return true;
49
+ }
29
50
  };
@@ -63,7 +63,7 @@ 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) {
66
+ else if (backCameras.length == 0) {
67
67
  backCamera = inputCameras[0];
68
68
  backCameras.push(backCamera);
69
69
  }
package/esm/object.js CHANGED
@@ -1,6 +1,9 @@
1
1
  export const isNull = (object) => {
2
- if (object instanceof File)
3
- return false;
2
+ try {
3
+ if (object instanceof File)
4
+ return false;
5
+ }
6
+ catch (error) { }
4
7
  if (typeof object == "undefined")
5
8
  return true;
6
9
  if (object == "")
@@ -32,5 +32,11 @@ export const uniqueSortByTime = (length = 6, str = `${textLowCase}${numeric}`) =
32
32
  export const randomFileName = (start = "file", length = 4) => {
33
33
  return `${start}-${+new Date()}-${randomStringAndNumberByLength(length)}`;
34
34
  };
35
- const random = { randAllCharacterByLength, randomStringByLength, randomStringAndNumberByLength, uniqueSortByTime, randomFileName };
35
+ const random = {
36
+ randAllCharacterByLength,
37
+ randomStringByLength,
38
+ randomStringAndNumberByLength,
39
+ uniqueSortByTime,
40
+ randomFileName,
41
+ };
36
42
  export default random;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginext-utils",
3
- "version": "3.13.6",
3
+ "version": "3.13.8",
4
4
  "sideEffects": false,
5
5
  "readme": "README.md",
6
6
  "homepage": "https://wearetopgroup.com",