@aws-amplify/ui-react-liveness 3.6.4 → 3.6.5
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.
|
@@ -810,9 +810,12 @@ const livenessMachine = createMachine({
|
|
|
810
810
|
const { videoConstraints } = context.videoAssociatedParams;
|
|
811
811
|
const { componentProps } = context;
|
|
812
812
|
let targetDeviceId;
|
|
813
|
+
// Determine if the deviceId was explicitly provided via props (strict match)
|
|
814
|
+
// or retrieved from localStorage (preferred but not required)
|
|
815
|
+
const isExplicitDeviceId = !!componentProps?.config?.deviceId;
|
|
813
816
|
let cameraNotFound = false;
|
|
814
|
-
if (
|
|
815
|
-
targetDeviceId = componentProps
|
|
817
|
+
if (isExplicitDeviceId) {
|
|
818
|
+
targetDeviceId = componentProps?.config?.deviceId;
|
|
816
819
|
}
|
|
817
820
|
else {
|
|
818
821
|
targetDeviceId = getLastSelectedCameraId() ?? undefined;
|
|
@@ -822,7 +825,11 @@ const livenessMachine = createMachine({
|
|
|
822
825
|
video: {
|
|
823
826
|
...videoConstraints,
|
|
824
827
|
...(targetDeviceId
|
|
825
|
-
? {
|
|
828
|
+
? {
|
|
829
|
+
deviceId: isExplicitDeviceId
|
|
830
|
+
? { exact: targetDeviceId }
|
|
831
|
+
: { ideal: targetDeviceId },
|
|
832
|
+
}
|
|
826
833
|
: {}),
|
|
827
834
|
},
|
|
828
835
|
audio: false,
|
|
@@ -881,9 +888,15 @@ const livenessMachine = createMachine({
|
|
|
881
888
|
selectedDeviceId: initialStreamDeviceId,
|
|
882
889
|
selectableDevices: realVideoDevices,
|
|
883
890
|
};
|
|
884
|
-
// If a
|
|
891
|
+
// If a previously-saved camera was not found, clear the stale ID and continue.
|
|
892
|
+
// Only throw an error if the deviceId was explicitly provided via props.
|
|
885
893
|
if (cameraNotFound) {
|
|
886
|
-
|
|
894
|
+
if (isExplicitDeviceId) {
|
|
895
|
+
throw new Error(LivenessErrorState.DEFAULT_CAMERA_NOT_FOUND_ERROR);
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
localStorage.removeItem(CAMERA_ID_KEY);
|
|
899
|
+
}
|
|
887
900
|
}
|
|
888
901
|
return result;
|
|
889
902
|
},
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1227,7 +1227,7 @@ function createRequestStreamGenerator(stream) {
|
|
|
1227
1227
|
};
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
const VERSION = '3.6.
|
|
1230
|
+
const VERSION = '3.6.5';
|
|
1231
1231
|
|
|
1232
1232
|
const BASE_USER_AGENT = `ui-react-liveness/${VERSION}`;
|
|
1233
1233
|
const getLivenessUserAgent = () => {
|
|
@@ -2572,9 +2572,12 @@ const livenessMachine = xstate.createMachine({
|
|
|
2572
2572
|
const { videoConstraints } = context.videoAssociatedParams;
|
|
2573
2573
|
const { componentProps } = context;
|
|
2574
2574
|
let targetDeviceId;
|
|
2575
|
+
// Determine if the deviceId was explicitly provided via props (strict match)
|
|
2576
|
+
// or retrieved from localStorage (preferred but not required)
|
|
2577
|
+
const isExplicitDeviceId = !!componentProps?.config?.deviceId;
|
|
2575
2578
|
let cameraNotFound = false;
|
|
2576
|
-
if (
|
|
2577
|
-
targetDeviceId = componentProps
|
|
2579
|
+
if (isExplicitDeviceId) {
|
|
2580
|
+
targetDeviceId = componentProps?.config?.deviceId;
|
|
2578
2581
|
}
|
|
2579
2582
|
else {
|
|
2580
2583
|
targetDeviceId = getLastSelectedCameraId() ?? undefined;
|
|
@@ -2584,7 +2587,11 @@ const livenessMachine = xstate.createMachine({
|
|
|
2584
2587
|
video: {
|
|
2585
2588
|
...videoConstraints,
|
|
2586
2589
|
...(targetDeviceId
|
|
2587
|
-
? {
|
|
2590
|
+
? {
|
|
2591
|
+
deviceId: isExplicitDeviceId
|
|
2592
|
+
? { exact: targetDeviceId }
|
|
2593
|
+
: { ideal: targetDeviceId },
|
|
2594
|
+
}
|
|
2588
2595
|
: {}),
|
|
2589
2596
|
},
|
|
2590
2597
|
audio: false,
|
|
@@ -2643,9 +2650,15 @@ const livenessMachine = xstate.createMachine({
|
|
|
2643
2650
|
selectedDeviceId: initialStreamDeviceId,
|
|
2644
2651
|
selectableDevices: realVideoDevices,
|
|
2645
2652
|
};
|
|
2646
|
-
// If a
|
|
2653
|
+
// If a previously-saved camera was not found, clear the stale ID and continue.
|
|
2654
|
+
// Only throw an error if the deviceId was explicitly provided via props.
|
|
2647
2655
|
if (cameraNotFound) {
|
|
2648
|
-
|
|
2656
|
+
if (isExplicitDeviceId) {
|
|
2657
|
+
throw new Error(LivenessErrorState.DEFAULT_CAMERA_NOT_FOUND_ERROR);
|
|
2658
|
+
}
|
|
2659
|
+
else {
|
|
2660
|
+
localStorage.removeItem(CAMERA_ID_KEY);
|
|
2661
|
+
}
|
|
2649
2662
|
}
|
|
2650
2663
|
return result;
|
|
2651
2664
|
},
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.6.
|
|
1
|
+
export declare const VERSION = "3.6.5";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-liveness",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"react-dom": "^16.14 || ^17 || ^18 || ^19"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@aws-amplify/ui": "6.15.
|
|
53
|
-
"@aws-amplify/ui-react": "6.15.
|
|
52
|
+
"@aws-amplify/ui": "6.15.4",
|
|
53
|
+
"@aws-amplify/ui-react": "6.15.4",
|
|
54
54
|
"@aws-sdk/client-rekognitionstreaming": "3.967.0",
|
|
55
55
|
"@aws-sdk/util-format-url": "3.965.0",
|
|
56
56
|
"@smithy/eventstream-serde-browser": "^4.0.4",
|