diginext-utils 3.13.7 → 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.
- package/dist/device/browser.js +26 -5
- package/dist/string/random.js +7 -1
- package/esm/device/browser.js +26 -5
- package/esm/string/random.js +7 -1
- package/package.json +1 -1
package/dist/device/browser.js
CHANGED
|
@@ -28,10 +28,31 @@ const isFacebookWebview = () => {
|
|
|
28
28
|
};
|
|
29
29
|
exports.isFacebookWebview = isFacebookWebview;
|
|
30
30
|
const isInAppWebview = () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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;
|
package/dist/string/random.js
CHANGED
|
@@ -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 = {
|
|
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;
|
package/esm/device/browser.js
CHANGED
|
@@ -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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
};
|
package/esm/string/random.js
CHANGED
|
@@ -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 = {
|
|
35
|
+
const random = {
|
|
36
|
+
randAllCharacterByLength,
|
|
37
|
+
randomStringByLength,
|
|
38
|
+
randomStringAndNumberByLength,
|
|
39
|
+
uniqueSortByTime,
|
|
40
|
+
randomFileName,
|
|
41
|
+
};
|
|
36
42
|
export default random;
|