idmission-web-sdk 2.3.123 → 2.3.124
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/components/video_id/IdVideoCaptureSuccess.d.ts.map +1 -1
- package/dist/lib/camera/Camera.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/lib/utils/logger.d.ts +6 -6
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +65 -57
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +65 -57
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +65 -57
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.3.
|
|
214
|
+
var webSdkVersion = '2.3.124';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1127,38 +1127,35 @@
|
|
|
1127
1127
|
function useDebugLogging(enabled) {
|
|
1128
1128
|
useLogLevel(enabled ? LogLevel.Debug : logLevel);
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1130
|
+
var noop$1 = function noop() {};
|
|
1131
|
+
var debug = function debug() {
|
|
1132
|
+
var args = [];
|
|
1132
1133
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1133
|
-
|
|
1134
|
+
args[_i] = arguments[_i];
|
|
1134
1135
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
var parts = [];
|
|
1136
|
+
return (logLevel >= LogLevel.Debug ? console.debug : noop$1).apply(void 0, args);
|
|
1137
|
+
}; // eslint-disable-line no-console
|
|
1138
|
+
var log = function log() {
|
|
1139
|
+
var args = [];
|
|
1140
1140
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1141
|
-
|
|
1141
|
+
args[_i] = arguments[_i];
|
|
1142
1142
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
var parts = [];
|
|
1143
|
+
return (logLevel >= LogLevel.Info ? console.log : noop$1).apply(void 0, args);
|
|
1144
|
+
}; // eslint-disable-line no-console
|
|
1145
|
+
var warn = function warn() {
|
|
1146
|
+
var args = [];
|
|
1148
1147
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1149
|
-
|
|
1148
|
+
args[_i] = arguments[_i];
|
|
1150
1149
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
var parts = [];
|
|
1150
|
+
return (logLevel >= LogLevel.Warn ? console.warn : noop$1).apply(void 0, args);
|
|
1151
|
+
}; // eslint-disable-line no-console
|
|
1152
|
+
var error = function error() {
|
|
1153
|
+
var args = [];
|
|
1156
1154
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1157
|
-
|
|
1155
|
+
args[_i] = arguments[_i];
|
|
1158
1156
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1157
|
+
return (logLevel >= LogLevel.Error ? console.error : noop$1).apply(void 0, args);
|
|
1158
|
+
}; // eslint-disable-line no-console
|
|
1162
1159
|
|
|
1163
1160
|
exports.defaultAuthUrl = 'https://portal-api.idmission.com';
|
|
1164
1161
|
var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
|
|
@@ -9108,6 +9105,7 @@
|
|
|
9108
9105
|
return createImpl;
|
|
9109
9106
|
};
|
|
9110
9107
|
|
|
9108
|
+
var LOG_TAG$1 = 'camera:Camera';
|
|
9111
9109
|
function listAvailableCameras(facingMode_1) {
|
|
9112
9110
|
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
9113
9111
|
var cameraEnumerationStream, allDevices, allowedVideoDevices;
|
|
@@ -9170,21 +9168,24 @@
|
|
|
9170
9168
|
var currentCamera;
|
|
9171
9169
|
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
9172
9170
|
releaseCameraAccess();
|
|
9173
|
-
log(
|
|
9171
|
+
log("".concat(LOG_TAG$1, " obtaining camera access..."));
|
|
9174
9172
|
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
9175
9173
|
width = _a.width,
|
|
9176
9174
|
height = _a.height;
|
|
9177
|
-
log(
|
|
9175
|
+
log("".concat(LOG_TAG$1, " camera dimensions"), width, height);
|
|
9178
9176
|
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
9179
|
-
log(
|
|
9177
|
+
log("".concat(LOG_TAG$1, " camera label"), label);
|
|
9180
9178
|
var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
|
|
9181
|
-
log(
|
|
9179
|
+
log("".concat(LOG_TAG$1, " is rear facing?"), isRearFacing);
|
|
9182
9180
|
var release = function release() {
|
|
9181
|
+
debug("".concat(LOG_TAG$1, " camera releasing stream"), stream);
|
|
9183
9182
|
stream.getTracks().forEach(function (track) {
|
|
9184
9183
|
track.enabled = false;
|
|
9184
|
+
debug("".concat(LOG_TAG$1, " camera stopping stream track"), track);
|
|
9185
9185
|
track.stop();
|
|
9186
9186
|
});
|
|
9187
9187
|
if (video) {
|
|
9188
|
+
debug("".concat(LOG_TAG$1, " camera releasing video element"), video);
|
|
9188
9189
|
video.pause();
|
|
9189
9190
|
video.srcObject = null;
|
|
9190
9191
|
video.src = '';
|
|
@@ -9200,14 +9201,14 @@
|
|
|
9200
9201
|
isRearFacing: isRearFacing,
|
|
9201
9202
|
release: release
|
|
9202
9203
|
};
|
|
9203
|
-
log(
|
|
9204
|
+
log("".concat(LOG_TAG$1, " camera access granted"), currentCamera);
|
|
9204
9205
|
// if (video) video.srcObject = stream
|
|
9205
9206
|
// log('video source initialized')
|
|
9206
9207
|
return currentCamera;
|
|
9207
9208
|
}
|
|
9208
9209
|
function releaseCameraAccess() {
|
|
9209
9210
|
if (!currentCamera) return;
|
|
9210
|
-
log(
|
|
9211
|
+
log("".concat(LOG_TAG$1, " releasing camera access..."));
|
|
9211
9212
|
currentCamera.release();
|
|
9212
9213
|
currentCamera = undefined;
|
|
9213
9214
|
}
|
|
@@ -13149,6 +13150,7 @@
|
|
|
13149
13150
|
}, [fallbacks, i18n.language, t, verbiage]);
|
|
13150
13151
|
}
|
|
13151
13152
|
|
|
13153
|
+
var LOG_TAG = 'camera:store';
|
|
13152
13154
|
var camera = null;
|
|
13153
13155
|
var videoStream = null;
|
|
13154
13156
|
var audioStream = null;
|
|
@@ -13174,7 +13176,8 @@
|
|
|
13174
13176
|
var store = createStore(function (set, get) {
|
|
13175
13177
|
return _assign(_assign(_assign({}, initialState$6), config), {
|
|
13176
13178
|
reset: function reset() {
|
|
13177
|
-
|
|
13179
|
+
debug("".concat(LOG_TAG, " reset"));
|
|
13180
|
+
set(_assign(_assign({}, initialState$6), config));
|
|
13178
13181
|
},
|
|
13179
13182
|
setConfig: function setConfig(config) {
|
|
13180
13183
|
return set(config);
|
|
@@ -13205,6 +13208,7 @@
|
|
|
13205
13208
|
return __generator(this, function (_f) {
|
|
13206
13209
|
switch (_f.label) {
|
|
13207
13210
|
case 0:
|
|
13211
|
+
debug("".concat(LOG_TAG, " requestCameraAccess"), new Error().stack);
|
|
13208
13212
|
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
13209
13213
|
releaseCameraAccess();
|
|
13210
13214
|
_f.label = 1;
|
|
@@ -13214,9 +13218,9 @@
|
|
|
13214
13218
|
case 2:
|
|
13215
13219
|
availableCameras = _f.sent();
|
|
13216
13220
|
selectedCamera = void 0;
|
|
13217
|
-
debug(
|
|
13221
|
+
debug("".concat(LOG_TAG, " availableCameras"), availableCameras);
|
|
13218
13222
|
platform_1 = getPlatform();
|
|
13219
|
-
debug(
|
|
13223
|
+
debug("".concat(LOG_TAG, " platformDetails"), platform_1);
|
|
13220
13224
|
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
13221
13225
|
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
13222
13226
|
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
@@ -13233,7 +13237,7 @@
|
|
|
13233
13237
|
availableCameras = availableCameras.sort(function (a, b) {
|
|
13234
13238
|
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
13235
13239
|
});
|
|
13236
|
-
debug(
|
|
13240
|
+
debug("".concat(LOG_TAG, " cameras have been sorted"), availableCameras);
|
|
13237
13241
|
}
|
|
13238
13242
|
if (preferFrontFacingCamera) {
|
|
13239
13243
|
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
@@ -13257,7 +13261,7 @@
|
|
|
13257
13261
|
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
13258
13262
|
}
|
|
13259
13263
|
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
13260
|
-
debug(
|
|
13264
|
+
debug("".concat(LOG_TAG, " selectedCamera"), selectedCamera);
|
|
13261
13265
|
set({
|
|
13262
13266
|
videoDevice: selectedCamera
|
|
13263
13267
|
});
|
|
@@ -13285,7 +13289,7 @@
|
|
|
13285
13289
|
_f.label = 3;
|
|
13286
13290
|
case 3:
|
|
13287
13291
|
_f.trys.push([3, 5,, 6]);
|
|
13288
|
-
debug(
|
|
13292
|
+
debug("".concat(LOG_TAG, " obtaining camera access with constraints"), constraints);
|
|
13289
13293
|
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
13290
13294
|
case 4:
|
|
13291
13295
|
stream_1 = _f.sent();
|
|
@@ -13317,21 +13321,21 @@
|
|
|
13317
13321
|
})];
|
|
13318
13322
|
case 8:
|
|
13319
13323
|
stream_1 = _f.sent();
|
|
13320
|
-
debug(
|
|
13324
|
+
debug("".concat(LOG_TAG, " opened stream with no width and height constraints"));
|
|
13321
13325
|
return [3 /*break*/, 10];
|
|
13322
13326
|
case 9:
|
|
13323
13327
|
e_2 = _f.sent();
|
|
13324
|
-
debug(
|
|
13328
|
+
debug("".concat(LOG_TAG, " cannot open stream at all"), e_2);
|
|
13325
13329
|
return [3 /*break*/, 10];
|
|
13326
13330
|
case 10:
|
|
13327
13331
|
if (!stream_1) {
|
|
13328
|
-
error(
|
|
13332
|
+
error("".concat(LOG_TAG, " failed to open camera"));
|
|
13329
13333
|
throw new Error('failed to open camera: ');
|
|
13330
13334
|
}
|
|
13331
|
-
debug(
|
|
13335
|
+
debug("".concat(LOG_TAG, " camera access requested with constraints"), constraints);
|
|
13332
13336
|
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
13333
13337
|
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
13334
|
-
debug(
|
|
13338
|
+
debug("".concat(LOG_TAG, " someone unplugged the continuity camera"), camera);
|
|
13335
13339
|
videoStream = null;
|
|
13336
13340
|
set({
|
|
13337
13341
|
videoDevice: null,
|
|
@@ -13339,10 +13343,8 @@
|
|
|
13339
13343
|
iphoneContinuityCameraAvailable: false,
|
|
13340
13344
|
iphoneContinuityCameraDenied: true
|
|
13341
13345
|
});
|
|
13342
|
-
get().requestCameraAccess();
|
|
13343
13346
|
} else {
|
|
13344
|
-
debug(
|
|
13345
|
-
get().releaseCameraAccess();
|
|
13347
|
+
debug("".concat(LOG_TAG, " someone unplugged the webcam"), camera);
|
|
13346
13348
|
videoStream = null;
|
|
13347
13349
|
set({
|
|
13348
13350
|
videoDevice: null,
|
|
@@ -13352,16 +13354,25 @@
|
|
|
13352
13354
|
});
|
|
13353
13355
|
}
|
|
13354
13356
|
};
|
|
13355
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended',
|
|
13357
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', function () {
|
|
13358
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded HTMLVideoElement ended event"));
|
|
13359
|
+
handleStreamEnded_1();
|
|
13360
|
+
});
|
|
13356
13361
|
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
13357
|
-
videoTrack_1.onended =
|
|
13362
|
+
videoTrack_1.onended = function () {
|
|
13363
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded MediaStreamTrack onended"), 'videoStream', videoStream, 'videoTrack', videoTrack_1, 'camera', camera);
|
|
13364
|
+
handleStreamEnded_1();
|
|
13365
|
+
};
|
|
13358
13366
|
camera = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
13359
13367
|
setTimeout(function () {
|
|
13360
13368
|
var _a;
|
|
13361
13369
|
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
13362
13370
|
// when the camera access is being requested. This delay is a workaround for that.
|
|
13363
13371
|
videoTrack_1.onmute = function () {
|
|
13364
|
-
if (videoTrack_1.readyState !== 'live')
|
|
13372
|
+
if (videoTrack_1.readyState !== 'live') {
|
|
13373
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded MediaStreamTrack onmute"), 'videoStream', videoStream, 'videoTrack', videoTrack_1);
|
|
13374
|
+
handleStreamEnded_1();
|
|
13375
|
+
}
|
|
13365
13376
|
};
|
|
13366
13377
|
videoStream = stream_1;
|
|
13367
13378
|
var isRearFacing = (_a = camera === null || camera === void 0 ? void 0 : camera.isRearFacing) !== null && _a !== void 0 ? _a : false;
|
|
@@ -13375,12 +13386,12 @@
|
|
|
13375
13386
|
case 11:
|
|
13376
13387
|
e_3 = _f.sent();
|
|
13377
13388
|
if (e_3.name === 'NotAllowedError' || ((_e = e_3.message) === null || _e === void 0 ? void 0 : _e.includes('Could not start video source'))) {
|
|
13378
|
-
error(
|
|
13389
|
+
error("".concat(LOG_TAG, " camera access has been blocked by the user"), e_3);
|
|
13379
13390
|
set({
|
|
13380
13391
|
cameraAccessDenied: true
|
|
13381
13392
|
});
|
|
13382
13393
|
} else {
|
|
13383
|
-
error(
|
|
13394
|
+
error("".concat(LOG_TAG, " camera access encountered some other error"), e_3);
|
|
13384
13395
|
throw e_3;
|
|
13385
13396
|
}
|
|
13386
13397
|
return [3 /*break*/, 12];
|
|
@@ -13393,12 +13404,10 @@
|
|
|
13393
13404
|
releaseCameraAccess: function releaseCameraAccess() {
|
|
13394
13405
|
return __awaiter(this, void 0, void 0, function () {
|
|
13395
13406
|
return __generator(this, function (_a) {
|
|
13407
|
+
debug("".concat(LOG_TAG, " release camera access"), 'camera', camera, 'videoStream', videoStream);
|
|
13396
13408
|
if (!camera) return [2 /*return*/];
|
|
13397
|
-
camera.release();
|
|
13409
|
+
camera.release(); // NOTE calls stop Camera tracks internally as noted above
|
|
13398
13410
|
camera = null;
|
|
13399
|
-
videoStream === null || videoStream === void 0 ? void 0 : videoStream.getTracks().forEach(function (track) {
|
|
13400
|
-
track.stop();
|
|
13401
|
-
});
|
|
13402
13411
|
videoStream = null;
|
|
13403
13412
|
set({
|
|
13404
13413
|
cameraReady: false,
|
|
@@ -13453,7 +13462,7 @@
|
|
|
13453
13462
|
return [3 /*break*/, 4];
|
|
13454
13463
|
case 3:
|
|
13455
13464
|
e_4 = _a.sent();
|
|
13456
|
-
debug(
|
|
13465
|
+
debug("".concat(LOG_TAG, " failed to open microphone"), e_4);
|
|
13457
13466
|
set({
|
|
13458
13467
|
microphoneAccessDenied: true
|
|
13459
13468
|
});
|
|
@@ -13480,6 +13489,7 @@
|
|
|
13480
13489
|
});
|
|
13481
13490
|
});
|
|
13482
13491
|
if (config.requestAccessAutomatically) {
|
|
13492
|
+
debug("".concat(LOG_TAG, " requesting camera access automatically"));
|
|
13483
13493
|
void store.getState().requestCameraAccess();
|
|
13484
13494
|
}
|
|
13485
13495
|
return _assign(_assign({}, store), {
|
|
@@ -26506,7 +26516,6 @@
|
|
|
26506
26516
|
idFrontText: 'ID Front Image',
|
|
26507
26517
|
idBackText: 'ID Back Image'
|
|
26508
26518
|
});
|
|
26509
|
-
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
26510
26519
|
return /*#__PURE__*/React.createElement(OverlayContainer, {
|
|
26511
26520
|
className: classNames.container
|
|
26512
26521
|
}, /*#__PURE__*/React.createElement(OverlayInner$2, {
|
|
@@ -26565,7 +26574,6 @@
|
|
|
26565
26574
|
variant: "warning",
|
|
26566
26575
|
className: classNames.retryBtn,
|
|
26567
26576
|
onClick: function onClick() {
|
|
26568
|
-
void requestCameraAccess();
|
|
26569
26577
|
return onRetryClick === null || onRetryClick === void 0 ? void 0 : onRetryClick();
|
|
26570
26578
|
},
|
|
26571
26579
|
colors: colors.retryBtn,
|