@authme/util 2.4.8 → 2.4.10
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/index.cjs +42 -27
- package/index.js +42 -27
- package/package.json +1 -1
- package/src/lib/common/index.d.ts +1 -1
package/index.cjs
CHANGED
|
@@ -11,13 +11,13 @@ require('core-js/modules/es.typed-array.sort.js');
|
|
|
11
11
|
require('core-js/modules/es.typed-array.to-locale-string.js');
|
|
12
12
|
require('core-js/modules/es.promise.js');
|
|
13
13
|
require('core-js/modules/es.regexp.exec.js');
|
|
14
|
-
require('core-js/modules/es.string.match.js');
|
|
15
|
-
require('core-js/modules/es.string.replace.js');
|
|
16
14
|
require('core-js/modules/es.regexp.to-string.js');
|
|
17
15
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
18
16
|
require('core-js/modules/es.object.assign.js');
|
|
19
17
|
require('core-js/modules/es.number.parse-int.js');
|
|
20
18
|
var jwt_decode = require('jwt-decode');
|
|
19
|
+
require('core-js/modules/es.string.match.js');
|
|
20
|
+
require('core-js/modules/es.string.replace.js');
|
|
21
21
|
require('core-js/modules/web.url-search-params.js');
|
|
22
22
|
require('core-js/modules/es.string.search.js');
|
|
23
23
|
require('core-js/modules/es.typed-array.uint32-array.js');
|
|
@@ -388,6 +388,9 @@ function retryPromiseWithCondition(promiseFactory, conditionFactory) {
|
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
+
function getUserAgent() {
|
|
392
|
+
return `platform: ${navigator === null || navigator === void 0 ? void 0 : navigator.platform}`;
|
|
393
|
+
}
|
|
391
394
|
function isMobileOrTablet() {
|
|
392
395
|
return function (a) {
|
|
393
396
|
return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || navigator.maxTouchPoints && navigator.maxTouchPoints > 2);
|
|
@@ -398,25 +401,6 @@ function isMobile() {
|
|
|
398
401
|
return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
|
|
399
402
|
}(navigator.userAgent || navigator.vendor || window.opera);
|
|
400
403
|
}
|
|
401
|
-
function osVersion() {
|
|
402
|
-
let version = '';
|
|
403
|
-
const android = navigator.userAgent.match(/Android\s+([\d\\.]+)/i);
|
|
404
|
-
if (android) {
|
|
405
|
-
version = android[0];
|
|
406
|
-
}
|
|
407
|
-
const ios = navigator.userAgent.match(/OS\s+([\d\\_]+)/i);
|
|
408
|
-
if (ios) {
|
|
409
|
-
version = ios[0].replace('OS ', 'iOS');
|
|
410
|
-
}
|
|
411
|
-
const win = navigator.userAgent.match(/Windows NT (\d+\.\d+)/);
|
|
412
|
-
if (win) {
|
|
413
|
-
version = win[0];
|
|
414
|
-
}
|
|
415
|
-
if (!version) {
|
|
416
|
-
version = navigator.platform;
|
|
417
|
-
}
|
|
418
|
-
return version;
|
|
419
|
-
}
|
|
420
404
|
function splitResult(result) {
|
|
421
405
|
if (result.address) {
|
|
422
406
|
const originAddress = result.address;
|
|
@@ -1371,6 +1355,9 @@ function isOverconstrainedError(error) {
|
|
|
1371
1355
|
}
|
|
1372
1356
|
return 'constraint' in error;
|
|
1373
1357
|
}
|
|
1358
|
+
function sleep(ms) {
|
|
1359
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
1360
|
+
}
|
|
1374
1361
|
function requestCamera({
|
|
1375
1362
|
video,
|
|
1376
1363
|
facingMode,
|
|
@@ -1379,7 +1366,29 @@ function requestCamera({
|
|
|
1379
1366
|
}) {
|
|
1380
1367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1381
1368
|
try {
|
|
1382
|
-
|
|
1369
|
+
let perm = yield navigator.permissions.query({
|
|
1370
|
+
name: 'camera'
|
|
1371
|
+
});
|
|
1372
|
+
if (perm.state == 'prompt') {
|
|
1373
|
+
for (let i = 0; i < 5; ++i) {
|
|
1374
|
+
try {
|
|
1375
|
+
//for ios 17.4.1 hack, if you call getUserMedia too early will only get not allowed.
|
|
1376
|
+
yield sleep(1000);
|
|
1377
|
+
return yield _requestCamera(video, facingMode);
|
|
1378
|
+
} catch (error) {
|
|
1379
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === BROWSER_CAMERA_ERRORS.NOT_ALLOWED_ERROR) {
|
|
1380
|
+
perm = yield navigator.permissions.query({
|
|
1381
|
+
name: 'camera'
|
|
1382
|
+
});
|
|
1383
|
+
} else {
|
|
1384
|
+
throw error;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
return yield _requestCamera(video, facingMode);
|
|
1389
|
+
} else {
|
|
1390
|
+
return yield _requestCamera(video, facingMode);
|
|
1391
|
+
}
|
|
1383
1392
|
} catch (error) {
|
|
1384
1393
|
if (error === BROWSER_CAMERA_ERRORS.NOT_SUPPORT) {
|
|
1385
1394
|
showMessage(translate('camera.error.notFound'));
|
|
@@ -2424,13 +2433,19 @@ window.ononline = () => {
|
|
|
2424
2433
|
});
|
|
2425
2434
|
};
|
|
2426
2435
|
|
|
2427
|
-
var name = "authme/
|
|
2428
|
-
var version$1 = "2.4.
|
|
2429
|
-
var
|
|
2436
|
+
var name = "@authme/util";
|
|
2437
|
+
var version$1 = "2.4.10";
|
|
2438
|
+
var peerDependencies = {
|
|
2439
|
+
"core-js": "^3.6.0"
|
|
2440
|
+
};
|
|
2441
|
+
var devDependencies = {
|
|
2442
|
+
"@types/file-saver": "^2.0.5"
|
|
2443
|
+
};
|
|
2430
2444
|
var packageInfo = {
|
|
2431
2445
|
name: name,
|
|
2432
2446
|
version: version$1,
|
|
2433
|
-
|
|
2447
|
+
peerDependencies: peerDependencies,
|
|
2448
|
+
devDependencies: devDependencies
|
|
2434
2449
|
};
|
|
2435
2450
|
|
|
2436
2451
|
var _a;
|
|
@@ -2462,6 +2477,7 @@ exports.getCssVariable = getCssVariable;
|
|
|
2462
2477
|
exports.getDeviceInfo = getDeviceInfo;
|
|
2463
2478
|
exports.getImageData = getImageData;
|
|
2464
2479
|
exports.getSystemInfo = getSystemInfo;
|
|
2480
|
+
exports.getUserAgent = getUserAgent;
|
|
2465
2481
|
exports.hexToRGB = hexToRGB;
|
|
2466
2482
|
exports.hideElement = hideElement;
|
|
2467
2483
|
exports.hideErrorMessage = hideErrorMessage;
|
|
@@ -2469,7 +2485,6 @@ exports.hidePopup = hidePopup;
|
|
|
2469
2485
|
exports.isIphone14proOrProMax = isIphone14proOrProMax;
|
|
2470
2486
|
exports.isMobile = isMobile;
|
|
2471
2487
|
exports.isMobileOrTablet = isMobileOrTablet;
|
|
2472
|
-
exports.osVersion = osVersion;
|
|
2473
2488
|
exports.requestCamera = requestCamera;
|
|
2474
2489
|
exports.resize = resize;
|
|
2475
2490
|
exports.retryPromiseWithCondition = retryPromiseWithCondition;
|
package/index.js
CHANGED
|
@@ -7,13 +7,13 @@ import 'core-js/modules/es.typed-array.sort.js';
|
|
|
7
7
|
import 'core-js/modules/es.typed-array.to-locale-string.js';
|
|
8
8
|
import 'core-js/modules/es.promise.js';
|
|
9
9
|
import 'core-js/modules/es.regexp.exec.js';
|
|
10
|
-
import 'core-js/modules/es.string.match.js';
|
|
11
|
-
import 'core-js/modules/es.string.replace.js';
|
|
12
10
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
13
11
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
14
12
|
import 'core-js/modules/es.object.assign.js';
|
|
15
13
|
import 'core-js/modules/es.number.parse-int.js';
|
|
16
14
|
import jwt_decode from 'jwt-decode';
|
|
15
|
+
import 'core-js/modules/es.string.match.js';
|
|
16
|
+
import 'core-js/modules/es.string.replace.js';
|
|
17
17
|
import 'core-js/modules/web.url-search-params.js';
|
|
18
18
|
import 'core-js/modules/es.string.search.js';
|
|
19
19
|
import 'core-js/modules/es.typed-array.uint32-array.js';
|
|
@@ -378,6 +378,9 @@ function retryPromiseWithCondition(promiseFactory, conditionFactory) {
|
|
|
378
378
|
}
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
+
function getUserAgent() {
|
|
382
|
+
return `platform: ${navigator === null || navigator === void 0 ? void 0 : navigator.platform}`;
|
|
383
|
+
}
|
|
381
384
|
function isMobileOrTablet() {
|
|
382
385
|
return function (a) {
|
|
383
386
|
return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || navigator.maxTouchPoints && navigator.maxTouchPoints > 2);
|
|
@@ -388,25 +391,6 @@ function isMobile() {
|
|
|
388
391
|
return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
|
|
389
392
|
}(navigator.userAgent || navigator.vendor || window.opera);
|
|
390
393
|
}
|
|
391
|
-
function osVersion() {
|
|
392
|
-
let version = '';
|
|
393
|
-
const android = navigator.userAgent.match(/Android\s+([\d\\.]+)/i);
|
|
394
|
-
if (android) {
|
|
395
|
-
version = android[0];
|
|
396
|
-
}
|
|
397
|
-
const ios = navigator.userAgent.match(/OS\s+([\d\\_]+)/i);
|
|
398
|
-
if (ios) {
|
|
399
|
-
version = ios[0].replace('OS ', 'iOS');
|
|
400
|
-
}
|
|
401
|
-
const win = navigator.userAgent.match(/Windows NT (\d+\.\d+)/);
|
|
402
|
-
if (win) {
|
|
403
|
-
version = win[0];
|
|
404
|
-
}
|
|
405
|
-
if (!version) {
|
|
406
|
-
version = navigator.platform;
|
|
407
|
-
}
|
|
408
|
-
return version;
|
|
409
|
-
}
|
|
410
394
|
function splitResult(result) {
|
|
411
395
|
if (result.address) {
|
|
412
396
|
const originAddress = result.address;
|
|
@@ -1361,6 +1345,9 @@ function isOverconstrainedError(error) {
|
|
|
1361
1345
|
}
|
|
1362
1346
|
return 'constraint' in error;
|
|
1363
1347
|
}
|
|
1348
|
+
function sleep(ms) {
|
|
1349
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
1350
|
+
}
|
|
1364
1351
|
function requestCamera({
|
|
1365
1352
|
video,
|
|
1366
1353
|
facingMode,
|
|
@@ -1369,7 +1356,29 @@ function requestCamera({
|
|
|
1369
1356
|
}) {
|
|
1370
1357
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1371
1358
|
try {
|
|
1372
|
-
|
|
1359
|
+
let perm = yield navigator.permissions.query({
|
|
1360
|
+
name: 'camera'
|
|
1361
|
+
});
|
|
1362
|
+
if (perm.state == 'prompt') {
|
|
1363
|
+
for (let i = 0; i < 5; ++i) {
|
|
1364
|
+
try {
|
|
1365
|
+
//for ios 17.4.1 hack, if you call getUserMedia too early will only get not allowed.
|
|
1366
|
+
yield sleep(1000);
|
|
1367
|
+
return yield _requestCamera(video, facingMode);
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === BROWSER_CAMERA_ERRORS.NOT_ALLOWED_ERROR) {
|
|
1370
|
+
perm = yield navigator.permissions.query({
|
|
1371
|
+
name: 'camera'
|
|
1372
|
+
});
|
|
1373
|
+
} else {
|
|
1374
|
+
throw error;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
return yield _requestCamera(video, facingMode);
|
|
1379
|
+
} else {
|
|
1380
|
+
return yield _requestCamera(video, facingMode);
|
|
1381
|
+
}
|
|
1373
1382
|
} catch (error) {
|
|
1374
1383
|
if (error === BROWSER_CAMERA_ERRORS.NOT_SUPPORT) {
|
|
1375
1384
|
showMessage(translate('camera.error.notFound'));
|
|
@@ -2414,13 +2423,19 @@ window.ononline = () => {
|
|
|
2414
2423
|
});
|
|
2415
2424
|
};
|
|
2416
2425
|
|
|
2417
|
-
var name = "authme/
|
|
2418
|
-
var version$1 = "2.4.
|
|
2419
|
-
var
|
|
2426
|
+
var name = "@authme/util";
|
|
2427
|
+
var version$1 = "2.4.10";
|
|
2428
|
+
var peerDependencies = {
|
|
2429
|
+
"core-js": "^3.6.0"
|
|
2430
|
+
};
|
|
2431
|
+
var devDependencies = {
|
|
2432
|
+
"@types/file-saver": "^2.0.5"
|
|
2433
|
+
};
|
|
2420
2434
|
var packageInfo = {
|
|
2421
2435
|
name: name,
|
|
2422
2436
|
version: version$1,
|
|
2423
|
-
|
|
2437
|
+
peerDependencies: peerDependencies,
|
|
2438
|
+
devDependencies: devDependencies
|
|
2424
2439
|
};
|
|
2425
2440
|
|
|
2426
2441
|
var _a;
|
|
@@ -2429,4 +2444,4 @@ const version = packageInfo.version;
|
|
|
2429
2444
|
(_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
|
|
2430
2445
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
2431
2446
|
|
|
2432
|
-
export { AuthmeError, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet,
|
|
2447
|
+
export { AuthmeError, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, getUserAgent, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showErrorMessageEventName, showPopup, splitResult, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, switchCamera, useState, version, videoConstraintsFactory, waitTime };
|
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@ export declare function dataURItoBlob(dataURI: string): Blob;
|
|
|
5
5
|
export declare function UintArrayToBlob(width: number, height: number, data: Uint8Array | Uint8ClampedArray, canvasEle?: HTMLCanvasElement, imageFormat?: 'jpg' | 'png'): Blob;
|
|
6
6
|
export declare function waitTime(ms: number): Promise<void>;
|
|
7
7
|
export declare function retryPromiseWithCondition<T>(promiseFactory: () => Promise<T>, conditionFactory: (...args: any[]) => Promise<any>): Promise<T>;
|
|
8
|
+
export declare function getUserAgent(): string;
|
|
8
9
|
export declare function isMobileOrTablet(): boolean;
|
|
9
10
|
export declare function isMobile(): boolean;
|
|
10
|
-
export declare function osVersion(): string;
|
|
11
11
|
export declare function splitResult(result: any): any;
|
|
12
12
|
export declare function combineResult(result: any): any;
|
|
13
13
|
export declare const isIphone14proOrProMax: () => boolean;
|