@aws-amplify/ui-react-liveness 0.0.0-next-43a297e-20230410194306
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/esm/components/FaceLivenessDetector/FaceLivenessDetector.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/StartLiveness/StartLiveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/StartLiveness/helpers.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/displayText.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useLivenessActor.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useLivenessSelector.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useMediaStreamInVideo.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/providers/FaceLivenessDetectorProvider.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/machine/index.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/types/faceDetection.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/types/liveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/constants.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/eventUtils.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/freshnessColorDisplay.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/liveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/streamProvider.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/support.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/videoRecorder.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/CancelButton.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/GoodFitIllustration.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Hint.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/LandscapeErrorModal.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/LivenessIconWithPopover.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/MatchIndicator.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Overlay.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/RecordingIcon.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/StartScreenFigure.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Toast.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/TooFarIllustration.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/types/classNames.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/utils/device.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/utils/getDisplayText.mjs +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/node_modules/tslib/tslib.es6.mjs +1 -0
- package/dist/index.js +1 -0
- package/dist/styles.css +5028 -0
- package/dist/styles.js +2 -0
- package/dist/types/components/FaceLivenessDetector/FaceLivenessDetector.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.d.ts +18 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.d.ts +15 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/StartLiveness.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/helpers.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/displayText.d.ts +62 -0
- package/dist/types/components/FaceLivenessDetector/hooks/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useLivenessActor.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useLivenessSelector.d.ts +4 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useMediaStreamInVideo.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/providers/FaceLivenessDetectorProvider.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/providers/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/service/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/machine/index.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/service/types/faceDetection.d.ts +36 -0
- package/dist/types/components/FaceLivenessDetector/service/types/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/types/liveness.d.ts +98 -0
- package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +102 -0
- package/dist/types/components/FaceLivenessDetector/service/types/service.d.ts +74 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.d.ts +18 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/constants.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/eventUtils.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/freshnessColorDisplay.d.ts +22 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/index.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +101 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +37 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/support.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/videoRecorder.d.ts +30 -0
- package/dist/types/components/FaceLivenessDetector/shared/CancelButton.d.ts +5 -0
- package/dist/types/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.d.ts +27 -0
- package/dist/types/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.d.ts +29 -0
- package/dist/types/components/FaceLivenessDetector/shared/GoodFitIllustration.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/shared/Hint.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/shared/LandscapeErrorModal.d.ts +10 -0
- package/dist/types/components/FaceLivenessDetector/shared/LivenessIconWithPopover.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/shared/MatchIndicator.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/shared/Overlay.d.ts +11 -0
- package/dist/types/components/FaceLivenessDetector/shared/RecordingIcon.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/shared/StartScreenFigure.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/shared/Toast.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/shared/TooFarIllustration.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/shared/index.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/types/classNames.d.ts +27 -0
- package/dist/types/components/FaceLivenessDetector/utils/device.d.ts +10 -0
- package/dist/types/components/FaceLivenessDetector/utils/getDisplayText.d.ts +17 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { LivenessOvalDetails, IlluminationState, Face, FaceMatchState, BoundingBox, LivenessErrorState } from '../types';
|
|
2
|
+
import { FaceDetection } from '../types/faceDetection';
|
|
3
|
+
import { ClientFreshnessColorSequence } from '../types/service';
|
|
4
|
+
import { ColorSequence, SessionInformation } from '@aws-sdk/client-rekognitionstreaming';
|
|
5
|
+
interface OvalBoundingBox {
|
|
6
|
+
ovalBoundingBox: BoundingBox;
|
|
7
|
+
minOvalX: number;
|
|
8
|
+
maxOvalX: number;
|
|
9
|
+
minOvalY: number;
|
|
10
|
+
maxOvalY: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the bounding box details from an oval
|
|
14
|
+
*/
|
|
15
|
+
export declare function getOvalBoundingBox(ovalDetails: LivenessOvalDetails): OvalBoundingBox;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the ratio of intersection and union of two bounding boxes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getIntersectionOverUnion(box1: BoundingBox, box2: BoundingBox): number;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the details of a randomly generated liveness oval
|
|
22
|
+
* from SDK
|
|
23
|
+
*/
|
|
24
|
+
export declare function getOvalDetailsFromSessionInformation({ sessionInformation, videoWidth, }: {
|
|
25
|
+
sessionInformation: SessionInformation;
|
|
26
|
+
videoWidth: number;
|
|
27
|
+
}): LivenessOvalDetails;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the details of a statically generated liveness oval based on the video dimensions
|
|
30
|
+
*/
|
|
31
|
+
export declare function getStaticLivenessOvalDetails({ width, height, widthSeed, centerXSeed, centerYSeed, }: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
widthSeed?: number;
|
|
35
|
+
centerXSeed?: number;
|
|
36
|
+
centerYSeed?: number;
|
|
37
|
+
}): LivenessOvalDetails;
|
|
38
|
+
/**
|
|
39
|
+
* Draws the provided liveness oval on the canvas.
|
|
40
|
+
*/
|
|
41
|
+
export declare function drawLivenessOvalInCanvas({ canvas, oval, scaleFactor, videoEl, }: {
|
|
42
|
+
canvas: HTMLCanvasElement;
|
|
43
|
+
oval: LivenessOvalDetails;
|
|
44
|
+
scaleFactor: number;
|
|
45
|
+
videoEl: HTMLVideoElement;
|
|
46
|
+
}): void;
|
|
47
|
+
interface FaceMatchStateInLivenessOval {
|
|
48
|
+
faceMatchState: FaceMatchState;
|
|
49
|
+
faceMatchPercentage: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the state of the provided face with respect to the provided liveness oval.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getFaceMatchStateInLivenessOval(face: Face, ovalDetails: LivenessOvalDetails, initialFaceIntersection: number, sessionInformation: SessionInformation): FaceMatchStateInLivenessOval;
|
|
55
|
+
export declare function generateBboxFromLandmarks(face: Face, oval: LivenessOvalDetails): BoundingBox;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the illumination state in the provided video frame.
|
|
58
|
+
*/
|
|
59
|
+
export declare function estimateIllumination(videoEl: HTMLVideoElement): IlluminationState | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if the provided media device is a virtual camera.
|
|
62
|
+
* @param device
|
|
63
|
+
*/
|
|
64
|
+
export declare function isCameraDeviceVirtual(device: MediaDeviceInfo): boolean;
|
|
65
|
+
export declare const LivenessErrorStateStringMap: Record<LivenessErrorState, string>;
|
|
66
|
+
export declare const MOCK_COLOR_SEQUENCES: ColorSequence[];
|
|
67
|
+
interface FillOverlayCanvasFractionalInput {
|
|
68
|
+
overlayCanvas: HTMLCanvasElement;
|
|
69
|
+
prevColor: string;
|
|
70
|
+
nextColor: string;
|
|
71
|
+
videoEl: HTMLVideoElement;
|
|
72
|
+
ovalDetails: LivenessOvalDetails;
|
|
73
|
+
heightFraction: number;
|
|
74
|
+
scaleFactor: number;
|
|
75
|
+
}
|
|
76
|
+
export declare function fillOverlayCanvasFractional({ overlayCanvas, prevColor, nextColor, videoEl, ovalDetails, heightFraction, scaleFactor, }: FillOverlayCanvasFractionalInput): void;
|
|
77
|
+
export declare const isClientFreshnessColorSequence: (obj: ClientFreshnessColorSequence | undefined) => obj is ClientFreshnessColorSequence;
|
|
78
|
+
export declare function getColorsSequencesFromSessionInformation(sessionInformation: SessionInformation): ClientFreshnessColorSequence[];
|
|
79
|
+
export declare function getRGBArrayFromColorString(colorStr: string): number[];
|
|
80
|
+
export declare function getFaceMatchState(faceDetector: FaceDetection, videoEl: HTMLVideoElement): Promise<FaceMatchState>;
|
|
81
|
+
export declare function isFaceDistanceBelowThreshold({ faceDetector, videoEl, ovalDetails, reduceThreshold, isMobile, }: {
|
|
82
|
+
faceDetector: FaceDetection;
|
|
83
|
+
videoEl: HTMLVideoElement;
|
|
84
|
+
ovalDetails?: LivenessOvalDetails;
|
|
85
|
+
reduceThreshold?: boolean;
|
|
86
|
+
isMobile?: boolean;
|
|
87
|
+
}): Promise<boolean>;
|
|
88
|
+
export declare function getBoundingBox({ deviceHeight, deviceWidth, height, width, top, left, }: {
|
|
89
|
+
deviceHeight: number;
|
|
90
|
+
deviceWidth: number;
|
|
91
|
+
height: number;
|
|
92
|
+
width: number;
|
|
93
|
+
top: number;
|
|
94
|
+
left: number;
|
|
95
|
+
}): {
|
|
96
|
+
Height: number;
|
|
97
|
+
Width: number;
|
|
98
|
+
Top: number;
|
|
99
|
+
Left: number;
|
|
100
|
+
};
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AmazonAIInterpretPredictionsProvider } from '@aws-amplify/predictions';
|
|
2
|
+
import { ClientSessionInformationEvent, LivenessResponseStream } from '@aws-sdk/client-rekognitionstreaming';
|
|
3
|
+
import { VideoRecorder } from './videoRecorder';
|
|
4
|
+
export interface StartLivenessStreamInput {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface StartLivenessStreamOutput {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
stream: WebSocket;
|
|
10
|
+
}
|
|
11
|
+
export interface Credentials {
|
|
12
|
+
accessKeyId: string;
|
|
13
|
+
secretAccessKey: string;
|
|
14
|
+
sessionToken: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const TIME_SLICE = 1000;
|
|
17
|
+
export declare class LivenessStreamProvider extends AmazonAIInterpretPredictionsProvider {
|
|
18
|
+
sessionId: string;
|
|
19
|
+
region: string;
|
|
20
|
+
videoRecorder: VideoRecorder;
|
|
21
|
+
responseStream: AsyncIterable<LivenessResponseStream>;
|
|
22
|
+
private _reader;
|
|
23
|
+
private videoEl;
|
|
24
|
+
private _client;
|
|
25
|
+
private _stream;
|
|
26
|
+
private initPromise;
|
|
27
|
+
constructor(sessionId: string, region: string, stream: MediaStream, videoEl: HTMLVideoElement);
|
|
28
|
+
getResponseStream(): Promise<AsyncIterable<LivenessResponseStream>>;
|
|
29
|
+
startRecordingLivenessVideo(): void;
|
|
30
|
+
sendClientInfo(clientInfo: ClientSessionInformationEvent): void;
|
|
31
|
+
stopVideo(): Promise<void>;
|
|
32
|
+
dispatchStopVideoEvent(): void;
|
|
33
|
+
endStream(): Promise<undefined>;
|
|
34
|
+
private init;
|
|
35
|
+
private getAsyncGeneratorFromReadableStream;
|
|
36
|
+
private startLivenessVideoConnection;
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether WebAssembly is supported in the current environment.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isWebAssemblySupported(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Checks whether WebGL is supported in the current environment.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isWebGLSupported(): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options for the video recorder.
|
|
3
|
+
*/
|
|
4
|
+
export interface VideoRecorderOptions {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Helper wrapper class over the native MediaRecorder.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VideoRecorder {
|
|
10
|
+
videoStream: ReadableStream<Blob | string>;
|
|
11
|
+
recordingStartApiTimestamp: number | undefined;
|
|
12
|
+
recorderStartTimestamp: number | undefined;
|
|
13
|
+
recorderEndTimestamp: number | undefined;
|
|
14
|
+
firstChunkTimestamp: number | undefined;
|
|
15
|
+
recorderStarted: Promise<void>;
|
|
16
|
+
private _recorder;
|
|
17
|
+
private _stream;
|
|
18
|
+
private _options;
|
|
19
|
+
private _chunks;
|
|
20
|
+
private _recorderStopped;
|
|
21
|
+
constructor(stream: MediaStream, options?: VideoRecorderOptions);
|
|
22
|
+
getState(): string | undefined;
|
|
23
|
+
start(timeSlice?: number): void;
|
|
24
|
+
stop(): Promise<void>;
|
|
25
|
+
pause(): void;
|
|
26
|
+
clearRecordedData(): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
dispatch(event: Event): void;
|
|
29
|
+
private _setupCallbacks;
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface StartScreenComponents {
|
|
3
|
+
Header?: React.ComponentType;
|
|
4
|
+
PhotosensitiveWarning?: React.ComponentType;
|
|
5
|
+
Instructions?: React.ComponentType;
|
|
6
|
+
}
|
|
7
|
+
interface DefaultHeaderProps {
|
|
8
|
+
headingText: string;
|
|
9
|
+
bodyText: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DefaultHeader: ({ headingText, bodyText, }: DefaultHeaderProps) => JSX.Element;
|
|
12
|
+
interface DefaultPhotosensitiveWarningProps {
|
|
13
|
+
headingText: string;
|
|
14
|
+
bodyText: string;
|
|
15
|
+
infoText: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const DefaultPhotosensitiveWarning: ({ headingText, bodyText, infoText, }: DefaultPhotosensitiveWarningProps) => JSX.Element;
|
|
18
|
+
interface DefaultInstructionsProps {
|
|
19
|
+
headingText: string;
|
|
20
|
+
goodFitCaptionText: string;
|
|
21
|
+
goodFitAltText: string;
|
|
22
|
+
tooFarCaptionText: string;
|
|
23
|
+
tooFarAltText: string;
|
|
24
|
+
steps: string[];
|
|
25
|
+
}
|
|
26
|
+
export declare const DefaultInstructions: ({ headingText, goodFitCaptionText, goodFitAltText, tooFarCaptionText, tooFarAltText, steps, }: DefaultInstructionsProps) => JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LivenessErrorState } from '../service';
|
|
3
|
+
import { ErrorDisplayText } from '../displayText';
|
|
4
|
+
export interface CheckScreenComponents {
|
|
5
|
+
ErrorView?: React.ComponentType<FaceLivenessErrorModalProps>;
|
|
6
|
+
}
|
|
7
|
+
export interface FaceLivenessErrorModalProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
displayText?: Partial<ErrorDisplayText>;
|
|
10
|
+
onRetry: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const renderErrorModal: ({ errorState, overrideErrorDisplayText }: {
|
|
13
|
+
errorState: LivenessErrorState;
|
|
14
|
+
overrideErrorDisplayText?: Partial<{
|
|
15
|
+
timeoutHeaderText: string;
|
|
16
|
+
timeoutMessageText: string;
|
|
17
|
+
faceDistanceHeaderText: string;
|
|
18
|
+
faceDistanceMessageText: string;
|
|
19
|
+
clientHeaderText: string;
|
|
20
|
+
clientMessageText: string;
|
|
21
|
+
serverHeaderText: string;
|
|
22
|
+
serverMessageText: string;
|
|
23
|
+
landscapeHeaderText: string;
|
|
24
|
+
landscapeMessageText: string;
|
|
25
|
+
portraitMessageText: string;
|
|
26
|
+
tryAgainText: string;
|
|
27
|
+
}> | undefined;
|
|
28
|
+
}) => JSX.Element | null;
|
|
29
|
+
export declare const FaceLivenessErrorModal: React.FC<FaceLivenessErrorModalProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IlluminationState, FaceMatchState } from '../service';
|
|
3
|
+
import { HintDisplayText } from '../displayText';
|
|
4
|
+
export declare const selectErrorState: import("../hooks").LivenessSelectorFn<import("../service").LivenessErrorState | null>;
|
|
5
|
+
export declare const selectFaceMatchState: import("../hooks").LivenessSelectorFn<FaceMatchState>;
|
|
6
|
+
export declare const selectIlluminationState: import("../hooks").LivenessSelectorFn<IlluminationState>;
|
|
7
|
+
export declare const selectIsFaceFarEnoughBeforeRecording: import("../hooks").LivenessSelectorFn<boolean>;
|
|
8
|
+
export declare const selectFaceMatchStateBeforeStart: import("../hooks").LivenessSelectorFn<FaceMatchState>;
|
|
9
|
+
export interface HintProps {
|
|
10
|
+
hintDisplayText: Required<HintDisplayText>;
|
|
11
|
+
}
|
|
12
|
+
export declare const Hint: React.FC<HintProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface LandscapeErrorModalProps {
|
|
3
|
+
onRetry: () => void;
|
|
4
|
+
header: string;
|
|
5
|
+
portraitMessage: string;
|
|
6
|
+
landscapeMessage: string;
|
|
7
|
+
tryAgainText: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const LandscapeErrorModal: React.FC<LandscapeErrorModalProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from src/primitives/Alert/AlertIcon.tsx because we want to re-use the icon but it is not currently expored by AlertIcon.
|
|
3
|
+
* We currently don't want to make a change to the AlertIcon primitive itself and may expose the icon in the future but for now so as not to introduce cross component dependencies we have duplicated it.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
export interface LivenessIconWithPopoverProps {
|
|
7
|
+
children: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const LivenessIconWithPopover: React.FC<LivenessIconWithPopoverProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FlexProps } from '@aws-amplify/ui-react';
|
|
3
|
+
interface AnchorOrigin {
|
|
4
|
+
horizontal: 'start' | 'center' | 'end';
|
|
5
|
+
vertical: 'start' | 'center' | 'end' | 'space-between';
|
|
6
|
+
}
|
|
7
|
+
interface OverlayProps extends FlexProps {
|
|
8
|
+
anchorOrigin?: AnchorOrigin;
|
|
9
|
+
}
|
|
10
|
+
export declare const Overlay: React.FC<OverlayProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ViewProps } from '@aws-amplify/ui-react';
|
|
3
|
+
interface ToastProps extends ViewProps {
|
|
4
|
+
variation?: 'default' | 'primary' | 'error';
|
|
5
|
+
size?: 'medium' | 'large';
|
|
6
|
+
heading?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Toast: React.FC<ToastProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './CancelButton';
|
|
2
|
+
export * from './Hint';
|
|
3
|
+
export * from './MatchIndicator';
|
|
4
|
+
export * from './Overlay';
|
|
5
|
+
export * from './RecordingIcon';
|
|
6
|
+
export * from './StartScreenFigure';
|
|
7
|
+
export * from './GoodFitIllustration';
|
|
8
|
+
export * from './TooFarIllustration';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum LivenessClassNames {
|
|
2
|
+
CameraModule = "amplify-liveness-camera-module",
|
|
3
|
+
CancelContainer = "amplify-liveness-cancel-container",
|
|
4
|
+
CancelButton = "amplify-liveness-cancel-button",
|
|
5
|
+
CountdownContainer = "amplify-liveness-countdown-container",
|
|
6
|
+
DescriptionBullet = "amplify-liveness-description-bullet",
|
|
7
|
+
DescriptionBulletIndex = "amplify-liveness-description-bullet__index",
|
|
8
|
+
DescriptionBulletIndexText = "amplify-liveness-description-bullet__index__text",
|
|
9
|
+
DescriptionBulletMessage = "amplify-liveness-description-bullet__message",
|
|
10
|
+
FadeOut = "amplify-liveness-fade-out",
|
|
11
|
+
FreshnessCanvas = "amplify-liveness-freshness-canvas",
|
|
12
|
+
InstructionList = "amplify-liveness-instruction-list",
|
|
13
|
+
InstructionOverlay = "amplify-liveness-instruction-overlay",
|
|
14
|
+
Figure = "amplify-liveness-figure",
|
|
15
|
+
FigureCaption = "amplify-liveness-figure__caption",
|
|
16
|
+
FigureIcon = "amplify-liveness-figure__icon",
|
|
17
|
+
FigureImage = "amplify-liveness-figure__image",
|
|
18
|
+
Figures = "amplify-liveness-figures",
|
|
19
|
+
Loader = "amplify-liveness-loader",
|
|
20
|
+
MatchIndicator = "amplify-liveness-match-indicator",
|
|
21
|
+
OvalCanvas = "amplify-liveness-oval-canvas",
|
|
22
|
+
RecordingIconContainer = "amplify-liveness-recording-icon-container",
|
|
23
|
+
RecordingIcon = "amplify-liveness-recording-icon",
|
|
24
|
+
Toast = "amplify-liveness-toast",
|
|
25
|
+
Video = "amplify-liveness-video",
|
|
26
|
+
VideoAnchor = "amplify-liveness-video-anchor"
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function isMobileScreen(): boolean;
|
|
2
|
+
export declare function isIOS(): boolean;
|
|
3
|
+
export declare function isPortrait(): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Use window.matchMedia to direct landscape orientation
|
|
6
|
+
* screen.orientation is not supported in Safari so we will use
|
|
7
|
+
* media query detection to listen for changes instead.
|
|
8
|
+
* @returns MediaQueryList object
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLandscapeMediaQuery(): MediaQueryList;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LivenessDisplayText, HintDisplayText, CameraDisplayText, InstructionDisplayText, StreamDisplayText, ErrorDisplayText } from '../displayText';
|
|
2
|
+
interface LivenessDisplayTextInterface {
|
|
3
|
+
hintDisplayText: Required<HintDisplayText>;
|
|
4
|
+
cameraDisplayText: Required<CameraDisplayText>;
|
|
5
|
+
instructionDisplayText: Required<InstructionDisplayText>;
|
|
6
|
+
streamDisplayText: Required<StreamDisplayText>;
|
|
7
|
+
errorDisplayText: Required<ErrorDisplayText>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Merges optional displayText prop with
|
|
11
|
+
* defaultLivenessDisplayText and returns more bite size portions to pass
|
|
12
|
+
* down to child components of FaceLivenessDetector.
|
|
13
|
+
* @param overrideDisplayText
|
|
14
|
+
* @returns hintDisplayText, cameraDisplayText, instructionDisplayText, cancelLivenessCheckText
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDisplayText(overrideDisplayText: LivenessDisplayText | undefined): LivenessDisplayTextInterface;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FaceLivenessDetector';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FaceLivenessDetector, FaceLivenessDetectorProps } from './components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './styles.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.0-liveness-20d2db2-20230302053408";
|
package/package.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-amplify/ui-react-liveness",
|
|
3
|
+
"version": "0.0.0-next-43a297e-20230410194306",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/esm/index.mjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"import": "./dist/esm/index.mjs",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./styles.css": "./dist/styles.css"
|
|
13
|
+
},
|
|
14
|
+
"browser": {
|
|
15
|
+
"./styles.css": "./dist/styles.css"
|
|
16
|
+
},
|
|
17
|
+
"types": "dist/types/index.d.ts",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"dist/**/*.css"
|
|
20
|
+
],
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/aws-amplify/amplify-ui",
|
|
25
|
+
"directory": "packages/react-liveness"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "yarn build:rollup",
|
|
33
|
+
"build:rollup": "rollup --config",
|
|
34
|
+
"check:esm": "node --input-type=module --eval 'import \"@aws-amplify/ui-react-liveness\"'",
|
|
35
|
+
"clean": "rimraf dist node_modules",
|
|
36
|
+
"dev": "yarn build:rollup --watch",
|
|
37
|
+
"lint": "yarn typecheck && eslint src",
|
|
38
|
+
"prebuild": "rimraf dist",
|
|
39
|
+
"size": "yarn size-limit",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"test:ci": "yarn test && yarn check:esm",
|
|
42
|
+
"test:watch": "yarn test --watch",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"aws-amplify": ">= 5.0.1",
|
|
47
|
+
"react": ">= 16.14.0",
|
|
48
|
+
"react-dom": ">= 16.14.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@aws-amplify/ui": "0.0.0-next-43a297e-20230410194306",
|
|
52
|
+
"@aws-amplify/ui-react": "0.0.0-next-43a297e-20230410194306",
|
|
53
|
+
"@aws-sdk/client-rekognitionstreaming": "3.309.0",
|
|
54
|
+
"@tensorflow-models/blazeface": "0.0.7",
|
|
55
|
+
"@tensorflow/tfjs-backend-cpu": "3.11.0",
|
|
56
|
+
"@tensorflow/tfjs-backend-wasm": "3.11.0",
|
|
57
|
+
"@tensorflow/tfjs-converter": "3.11.0",
|
|
58
|
+
"@tensorflow/tfjs-core": "3.11.0",
|
|
59
|
+
"@xstate/react": "3.0.0",
|
|
60
|
+
"classnames": "2.3.1",
|
|
61
|
+
"nanoid": "3.1.31",
|
|
62
|
+
"react-countdown-circle-timer": "^2.5.4",
|
|
63
|
+
"xstate": "^4.33.6"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
67
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
68
|
+
"@size-limit/preset-big-lib": "^7.0.8",
|
|
69
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
70
|
+
"@testing-library/react": "^12.0.0",
|
|
71
|
+
"@testing-library/react-hooks": "^7.0.1",
|
|
72
|
+
"@testing-library/user-event": "^13.2.1",
|
|
73
|
+
"@types/jest": "^26.0.23",
|
|
74
|
+
"@types/jest-when": "^3.5.0",
|
|
75
|
+
"@types/react": "^17.0.2",
|
|
76
|
+
"blob-polyfill": "^7.0.20220408",
|
|
77
|
+
"eslint": "^8.13.0",
|
|
78
|
+
"eslint-config-amplify-ui": "0.0.0",
|
|
79
|
+
"jest": "^27.0.4",
|
|
80
|
+
"jest-canvas-mock": "^2.4.0",
|
|
81
|
+
"jest-when": "^3.5.1",
|
|
82
|
+
"react": "^17.0.2",
|
|
83
|
+
"react-dom": "^17.0.2",
|
|
84
|
+
"rimraf": "^3.0.2",
|
|
85
|
+
"rollup": "^2.70.0",
|
|
86
|
+
"rollup-plugin-node-externals": "^4.1.1",
|
|
87
|
+
"rollup-plugin-styles": "^4.0.0",
|
|
88
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
89
|
+
"size-limit": "^7.0.8",
|
|
90
|
+
"ts-jest": "^27.0.3",
|
|
91
|
+
"web-streams-polyfill": "^3.2.1"
|
|
92
|
+
},
|
|
93
|
+
"size-limit": [
|
|
94
|
+
{
|
|
95
|
+
"name": "FaceLivenessDetector",
|
|
96
|
+
"path": "dist/esm/index.mjs",
|
|
97
|
+
"import": "{ FaceLivenessDetector }",
|
|
98
|
+
"limit": "275 kB"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|