@aws-amplify/ui-react-liveness 3.0.12 → 3.0.14

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.
Files changed (23) hide show
  1. package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +3 -10
  2. package/dist/esm/components/FaceLivenessDetector/service/machine/index.mjs +144 -158
  3. package/dist/esm/components/FaceLivenessDetector/service/utils/CustomWebSocketFetchHandler.mjs +3 -4
  4. package/dist/esm/components/FaceLivenessDetector/service/utils/liveness.mjs +62 -67
  5. package/dist/esm/components/FaceLivenessDetector/service/utils/streamProvider.mjs +6 -5
  6. package/dist/esm/components/FaceLivenessDetector/service/utils/videoRecorder.mjs +1 -2
  7. package/dist/esm/components/FaceLivenessDetector/types/classNames.mjs +0 -5
  8. package/dist/esm/version.mjs +1 -1
  9. package/dist/index.js +218 -250
  10. package/dist/styles.css +6 -2
  11. package/dist/types/components/FaceLivenessDetector/hooks/useLivenessActor.d.ts +1 -1
  12. package/dist/types/components/FaceLivenessDetector/service/machine/index.d.ts +3 -4
  13. package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +17 -18
  14. package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +7 -9
  15. package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +3 -10
  16. package/dist/types/components/FaceLivenessDetector/service/utils/videoRecorder.d.ts +1 -7
  17. package/dist/types/components/FaceLivenessDetector/shared/index.d.ts +0 -3
  18. package/dist/types/components/FaceLivenessDetector/types/classNames.d.ts +0 -5
  19. package/dist/types/version.d.ts +1 -1
  20. package/package.json +3 -3
  21. package/dist/types/components/FaceLivenessDetector/shared/GoodFitIllustration.d.ts +0 -7
  22. package/dist/types/components/FaceLivenessDetector/shared/StartScreenFigure.d.ts +0 -8
  23. package/dist/types/components/FaceLivenessDetector/shared/TooFarIllustration.d.ts +0 -7
package/dist/styles.css CHANGED
@@ -512,6 +512,7 @@
512
512
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
513
513
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
514
514
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
515
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
515
516
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
516
517
  --amplify-components-checkboxfield-align-items: flex-start;
517
518
  --amplify-components-checkboxfield-align-content: center;
@@ -3668,7 +3669,10 @@ strong.amplify-text {
3668
3669
  }
3669
3670
 
3670
3671
  .amplify-checkbox__label {
3671
- color: inherit;
3672
+ color: var(--amplify-components-checkbox-label-color);
3673
+ }
3674
+ .amplify-checkbox__label--disabled {
3675
+ color: var(--amplify-components-checkbox-label-disabled-color);
3672
3676
  }
3673
3677
 
3674
3678
  .amplify-checkboxfield {
@@ -4201,7 +4205,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4201
4205
 
4202
4206
  .amplify-liveness-landscape-error-modal {
4203
4207
  background-color: var(--amplify-colors-background-primary);
4204
- direction: column;
4208
+ flex-direction: column;
4205
4209
  text-align: center;
4206
4210
  align-items: center;
4207
4211
  justify-content: center;
@@ -1 +1 @@
1
- export declare function useLivenessActor(): [import("xstate").State<Partial<import("../service").HydratedLivenessContext>, import("../service").LivenessEvent, any, any, any>, (event: import("xstate").SingleOrArray<import("xstate").Event<import("../service").LivenessEvent>> | import("xstate").SCXML.Event<import("../service").LivenessEvent>, payload?: import("xstate").EventData | undefined) => import("xstate").State<Partial<import("../service").HydratedLivenessContext>, import("../service").LivenessEvent, any, any, any>];
1
+ export declare function useLivenessActor(): [import("xstate").State<import("../service").LivenessContext, import("../service").LivenessEvent, any, any, any>, (event: import("xstate").SingleOrArray<import("xstate").Event<import("../service").LivenessEvent>> | import("xstate").SCXML.Event<import("../service").LivenessEvent>, payload?: import("xstate").EventData | undefined) => import("xstate").State<import("../service").LivenessContext, import("../service").LivenessEvent, any, any, any>];
@@ -1,6 +1,5 @@
1
- import { LivenessEvent } from '../types';
2
- export declare const MIN_FACE_MATCH_TIME = 1000;
3
- export declare const livenessMachine: import("xstate").StateMachine<Partial<import("../types").HydratedLivenessContext>, any, LivenessEvent, {
1
+ import { LivenessContext, LivenessEvent } from '../types';
2
+ export declare const livenessMachine: import("xstate").StateMachine<LivenessContext, any, LivenessEvent, {
4
3
  value: any;
5
- context: Partial<import("../types").HydratedLivenessContext>;
4
+ context: LivenessContext;
6
5
  }, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, LivenessEvent, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
@@ -36,24 +36,23 @@ export interface VideoAssociatedParams {
36
36
  selectedDeviceId?: string;
37
37
  selectableDevices?: MediaDeviceInfo[];
38
38
  }
39
- export type LivenessContext = Partial<HydratedLivenessContext>;
40
- export interface HydratedLivenessContext {
41
- maxFailedAttempts: number;
42
- failedAttempts: number;
43
- componentProps: FaceLivenessDetectorCoreProps;
44
- serverSessionInformation: SessionInformation;
45
- challengeId: string;
46
- videoAssociatedParams: VideoAssociatedParams;
47
- ovalAssociatedParams: OvalAssociatedParams;
48
- faceMatchAssociatedParams: FaceMatchAssociatedParams;
49
- freshnessColorAssociatedParams: FreshnessColorAssociatedParams;
50
- errorState: ErrorState;
51
- livenessStreamProvider: LivenessStreamProvider;
52
- responseStreamActorRef: ActorRef<any>;
53
- shouldDisconnect: boolean;
54
- faceMatchStateBeforeStart: FaceMatchState;
55
- isFaceFarEnoughBeforeRecording: boolean;
56
- isRecordingStopped: boolean;
39
+ export interface LivenessContext {
40
+ challengeId?: string;
41
+ componentProps?: FaceLivenessDetectorCoreProps;
42
+ errorState?: ErrorState;
43
+ faceMatchAssociatedParams?: FaceMatchAssociatedParams;
44
+ faceMatchStateBeforeStart?: FaceMatchState;
45
+ failedAttempts?: number;
46
+ freshnessColorAssociatedParams?: FreshnessColorAssociatedParams;
47
+ isFaceFarEnoughBeforeRecording?: boolean;
48
+ isRecordingStopped?: boolean;
49
+ livenessStreamProvider?: LivenessStreamProvider;
50
+ maxFailedAttempts?: number;
51
+ ovalAssociatedParams?: OvalAssociatedParams;
52
+ responseStreamActorRef?: ActorRef<any>;
53
+ serverSessionInformation?: SessionInformation;
54
+ shouldDisconnect?: boolean;
55
+ videoAssociatedParams?: VideoAssociatedParams;
57
56
  }
58
57
  export type LivenessEventTypes = 'BEGIN' | 'START_RECORDING' | 'TIMEOUT' | 'ERROR' | 'CANCEL' | 'SET_SESSION_INFO' | 'DISCONNECT_EVENT' | 'SET_DOM_AND_CAMERA_DETAILS' | 'UPDATE_DEVICE_AND_STREAM' | 'SERVER_ERROR' | 'RUNTIME_ERROR' | 'RETRY_CAMERA_CHECK' | 'MOBILE_LANDSCAPE_WARNING';
59
58
  export type LivenessEventData = Record<PropertyKey, any>;
@@ -1,7 +1,7 @@
1
1
  import { LivenessOvalDetails, IlluminationState, Face, FaceMatchState, BoundingBox, ErrorState } from '../types';
2
2
  import { FaceDetection } from '../types/faceDetection';
3
3
  import { ClientFreshnessColorSequence } from '../types/service';
4
- import { ColorSequence, SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
4
+ import { SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
5
5
  interface OvalBoundingBox {
6
6
  ovalBoundingBox: BoundingBox;
7
7
  minOvalX: number;
@@ -36,7 +36,6 @@ export declare function getStaticLivenessOvalDetails({ width, height, widthSeed,
36
36
  centerYSeed?: number;
37
37
  ratioMultiplier?: number;
38
38
  }): LivenessOvalDetails;
39
- export declare function drawStaticOval(canvasEl: HTMLCanvasElement, videoEl: HTMLVideoElement, videoMediaStream: MediaStream): void;
40
39
  /**
41
40
  * Draws the provided liveness oval on the canvas.
42
41
  */
@@ -47,18 +46,18 @@ export declare function drawLivenessOvalInCanvas({ canvas, oval, scaleFactor, vi
47
46
  videoEl: HTMLVideoElement;
48
47
  isStartScreen?: boolean;
49
48
  }): void;
49
+ export declare function drawStaticOval(canvasEl: HTMLCanvasElement, videoEl: HTMLVideoElement, videoMediaStream: MediaStream): void;
50
50
  export declare function clearOvalCanvas({ canvas, }: {
51
51
  canvas: HTMLCanvasElement;
52
52
  }): void;
53
- interface FaceMatchStateInLivenessOval {
54
- faceMatchState: FaceMatchState;
55
- faceMatchPercentage: number;
56
- }
53
+ export declare function generateBboxFromLandmarks(face: Face, oval: LivenessOvalDetails): BoundingBox;
57
54
  /**
58
55
  * Returns the state of the provided face with respect to the provided liveness oval.
59
56
  */
60
- export declare function getFaceMatchStateInLivenessOval(face: Face, ovalDetails: LivenessOvalDetails, initialFaceIntersection: number, sessionInformation: SessionInformation): FaceMatchStateInLivenessOval;
61
- export declare function generateBboxFromLandmarks(face: Face, oval: LivenessOvalDetails): BoundingBox;
57
+ export declare function getFaceMatchStateInLivenessOval(face: Face, ovalDetails: LivenessOvalDetails, initialFaceIntersection: number, sessionInformation: SessionInformation): {
58
+ faceMatchState: FaceMatchState;
59
+ faceMatchPercentage: number;
60
+ };
62
61
  /**
63
62
  * Returns the illumination state in the provided video frame.
64
63
  */
@@ -79,7 +78,6 @@ export declare const LivenessErrorStateStringMap: {
79
78
  MOBILE_LANDSCAPE_ERROR: string;
80
79
  FRESHNESS_TIMEOUT: string;
81
80
  };
82
- export declare const MOCK_COLOR_SEQUENCES: ColorSequence[];
83
81
  interface FillOverlayCanvasFractionalInput {
84
82
  overlayCanvas: HTMLCanvasElement;
85
83
  prevColor: string;
@@ -4,24 +4,16 @@ import { AwsCredentialProvider } from '../types';
4
4
  export interface StartLivenessStreamInput {
5
5
  sessionId: string;
6
6
  }
7
- export interface StartLivenessStreamOutput {
8
- sessionId: string;
7
+ export interface StartLivenessStreamOutput extends StartLivenessStreamInput {
9
8
  stream: WebSocket;
10
9
  }
11
- export interface Credentials {
12
- accessKeyId: string;
13
- secretAccessKey: string;
14
- sessionToken: string;
15
- }
16
- export interface StreamProviderArgs {
17
- sessionId: string;
10
+ interface StreamProviderArgs extends StartLivenessStreamInput {
18
11
  region: string;
19
12
  stream: MediaStream;
20
13
  videoEl: HTMLVideoElement;
21
14
  credentialProvider?: AwsCredentialProvider;
22
15
  endpointOverride?: string;
23
16
  }
24
- export declare const TIME_SLICE = 1000;
25
17
  export declare class LivenessStreamProvider {
26
18
  sessionId: string;
27
19
  region: string;
@@ -45,3 +37,4 @@ export declare class LivenessStreamProvider {
45
37
  private getAsyncGeneratorFromReadableStream;
46
38
  private startLivenessVideoConnection;
47
39
  }
40
+ export {};
@@ -1,8 +1,3 @@
1
- /**
2
- * The options for the video recorder.
3
- */
4
- export interface VideoRecorderOptions {
5
- }
6
1
  /**
7
2
  * Helper wrapper class over the native MediaRecorder.
8
3
  */
@@ -18,10 +13,9 @@ export declare class VideoRecorder {
18
13
  recorderStarted: Promise<void>;
19
14
  private _recorder;
20
15
  private _stream;
21
- private _options;
22
16
  private _chunks;
23
17
  private _recorderStopped;
24
- constructor(stream: MediaStream, options?: VideoRecorderOptions);
18
+ constructor(stream: MediaStream);
25
19
  getState(): string | undefined;
26
20
  start(timeSlice?: number): void;
27
21
  stop(): Promise<void>;
@@ -3,6 +3,3 @@ export * from './Hint';
3
3
  export * from './MatchIndicator';
4
4
  export * from './Overlay';
5
5
  export * from './RecordingIcon';
6
- export * from './StartScreenFigure';
7
- export * from './GoodFitIllustration';
8
- export * from './TooFarIllustration';
@@ -13,11 +13,6 @@ export declare enum LivenessClassNames {
13
13
  FreshnessCanvas = "amplify-liveness-freshness-canvas",
14
14
  InstructionList = "amplify-liveness-instruction-list",
15
15
  InstructionOverlay = "amplify-liveness-instruction-overlay",
16
- Figure = "amplify-liveness-figure",
17
- FigureCaption = "amplify-liveness-figure__caption",
18
- FigureIcon = "amplify-liveness-figure__icon",
19
- FigureImage = "amplify-liveness-figure__image",
20
- Figures = "amplify-liveness-figures",
21
16
  Hint = "amplify-liveness-hint",
22
17
  HintText = "amplify-liveness-hint__text",
23
18
  LandscapeErrorModal = "amplify-liveness-landscape-error-modal",
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.12";
1
+ export declare const VERSION = "3.0.14";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-liveness",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -47,8 +47,8 @@
47
47
  "react-dom": "^16.14.0 || ^17.0 || ^18.0"
48
48
  },
49
49
  "dependencies": {
50
- "@aws-amplify/ui": "6.0.10",
51
- "@aws-amplify/ui-react": "6.1.4",
50
+ "@aws-amplify/ui": "6.0.12",
51
+ "@aws-amplify/ui-react": "6.1.6",
52
52
  "@aws-sdk/client-rekognitionstreaming": "3.398.0",
53
53
  "@aws-sdk/util-format-url": "^3.410.0",
54
54
  "@smithy/eventstream-serde-browser": "^2.0.4",
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface GoodFitIllustrationProps {
3
- title: string;
4
- testId?: string;
5
- }
6
- export declare const GoodFitIllustration: React.FC<GoodFitIllustrationProps>;
7
- export {};
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { FlexProps } from '@aws-amplify/ui-react';
3
- interface StartScreenFigureProps extends FlexProps {
4
- caption: string;
5
- variation?: 'defaut' | 'error' | 'success';
6
- }
7
- export declare const StartScreenFigure: React.FC<StartScreenFigureProps>;
8
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface TooFarIllustrationProps {
3
- title: string;
4
- testId?: string;
5
- }
6
- export declare const TooFarIllustration: React.FC<TooFarIllustrationProps>;
7
- export {};