idmission-web-sdk 0.0.1

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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +398 -0
  3. package/dist/components/CompositeWizard.d.ts +27 -0
  4. package/dist/components/Example.d.ts +2 -0
  5. package/dist/components/GuideOrientationProvider.d.ts +4 -0
  6. package/dist/components/additional_document_capture/AdditionalDocumentCapture.d.ts +17 -0
  7. package/dist/components/additional_document_capture/AdditionalDocumentCaptureWizard.d.ts +16 -0
  8. package/dist/components/additional_document_capture/CapturedDocuments.d.ts +8 -0
  9. package/dist/components/camera/CameraAccessDeniedOverlay.d.ts +4 -0
  10. package/dist/components/camera/CameraProvider.d.ts +9 -0
  11. package/dist/components/camera/CameraVideoTag.d.ts +5 -0
  12. package/dist/components/common/Page.d.ts +12 -0
  13. package/dist/components/common/cdn.d.ts +1 -0
  14. package/dist/components/common/overlay.d.ts +790 -0
  15. package/dist/components/common/spinner.d.ts +261 -0
  16. package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts +29 -0
  17. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +37 -0
  18. package/dist/components/customer_flows/CustomerIdentification.d.ts +23 -0
  19. package/dist/components/customer_flows/CustomerVerification.d.ts +22 -0
  20. package/dist/components/customer_flows/FaceValidation.d.ts +21 -0
  21. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +36 -0
  22. package/dist/components/customer_flows/IdValidation.d.ts +33 -0
  23. package/dist/components/customer_flows/SignatureKYC.d.ts +14 -0
  24. package/dist/components/customer_identification/CustomerIdentificationCapture.d.ts +13 -0
  25. package/dist/components/customer_identification/CustomerIdentificationFailure.d.ts +11 -0
  26. package/dist/components/customer_identification/CustomerIdentificationSuccess.d.ts +10 -0
  27. package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts +33 -0
  28. package/dist/components/customer_verification/CustomerVerificationCapture.d.ts +13 -0
  29. package/dist/components/customer_verification/CustomerVerificationFailure.d.ts +11 -0
  30. package/dist/components/customer_verification/CustomerVerificationSuccess.d.ts +10 -0
  31. package/dist/components/customer_verification/CustomerVerificationWizard.d.ts +33 -0
  32. package/dist/components/face_liveness/FaceCaptureGuideOverlay.d.ts +6 -0
  33. package/dist/components/face_liveness/FaceLivenessCapture.d.ts +16 -0
  34. package/dist/components/face_liveness/FaceLivenessFailure.d.ts +11 -0
  35. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +10 -0
  36. package/dist/components/face_liveness/FaceLivenessWizard.d.ts +33 -0
  37. package/dist/components/id_capture/DocumentCaptureGuideOverlay.d.ts +14 -0
  38. package/dist/components/id_capture/FlipIdPrompt.d.ts +9 -0
  39. package/dist/components/id_capture/IdCapture.d.ts +46 -0
  40. package/dist/components/id_capture/IdCaptureLoadingOverlay.d.ts +13 -0
  41. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +7 -0
  42. package/dist/components/id_capture/IdCaptureSubmitBtn.d.ts +7 -0
  43. package/dist/components/id_capture/IdCaptureSuccess.d.ts +18 -0
  44. package/dist/components/id_capture/IdCaptureWizard.d.ts +56 -0
  45. package/dist/components/selfie_capture/HighPerformanceSelfieGuidanceModelsProvider.d.ts +34 -0
  46. package/dist/components/selfie_capture/SelfieCapture.d.ts +20 -0
  47. package/dist/components/selfie_capture/SelfieCaptureLoadingOverlay.d.ts +12 -0
  48. package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +5 -0
  49. package/dist/components/signature_capture/SignatureCapture.d.ts +18 -0
  50. package/dist/components/signature_capture/VideoSignatureCapture.d.ts +9 -0
  51. package/dist/components/signature_capture/data.d.ts +9 -0
  52. package/dist/components/signature_kyc/SignatureKYCLoadingOverlay.d.ts +12 -0
  53. package/dist/components/signature_kyc/SignatureKYCWizard.d.ts +5 -0
  54. package/dist/components/submission/GeolocationAccessDeniedOverlay.d.ts +5 -0
  55. package/dist/components/submission/SubmissionProvider.d.ts +16 -0
  56. package/dist/components/submission/SubmissionSuccess.d.ts +2 -0
  57. package/dist/contexts/CameraStateContext.d.ts +18 -0
  58. package/dist/contexts/GuideOrientationContext.d.ts +15 -0
  59. package/dist/contexts/IdCaptureModelsContext.d.ts +11 -0
  60. package/dist/contexts/SelfieGuidanceModelsContext.d.ts +14 -0
  61. package/dist/contexts/SubmissionContext.d.ts +156 -0
  62. package/dist/index.d.ts +32 -0
  63. package/dist/index.js +7 -0
  64. package/dist/lib/barcode/Native.d.ts +1 -0
  65. package/dist/lib/barcode/Parse.d.ts +53 -0
  66. package/dist/lib/barcode/Scan.d.ts +3 -0
  67. package/dist/lib/barcode/ZXing.d.ts +1 -0
  68. package/dist/lib/camera/Camera.d.ts +59 -0
  69. package/dist/lib/camera/hooks.d.ts +9 -0
  70. package/dist/lib/camera/useVideoRecorder.d.ts +7 -0
  71. package/dist/lib/locales/en/translation.d.ts +2 -0
  72. package/dist/lib/locales/es/translation.d.ts +50 -0
  73. package/dist/lib/locales/index.d.ts +60 -0
  74. package/dist/lib/models/DocumentDetection.d.ts +27 -0
  75. package/dist/lib/models/FaceDetection.d.ts +5 -0
  76. package/dist/lib/models/Focus.d.ts +7 -0
  77. package/dist/lib/models/preloadModels.d.ts +5 -0
  78. package/dist/lib/tfworker/Actions.d.ts +29 -0
  79. package/dist/lib/tfworker/Client.d.ts +14 -0
  80. package/dist/lib/tfworker/TfWorker.d.ts +8 -0
  81. package/dist/lib/utils/OffscreenCanvasPolyfill.d.ts +0 -0
  82. package/dist/lib/utils/cropToShoulders.d.ts +2 -0
  83. package/dist/lib/utils/dataUrlToBase64.d.ts +3 -0
  84. package/dist/lib/utils/deviceDetection.d.ts +2 -0
  85. package/dist/lib/utils/getBlobDimensions.d.ts +1 -0
  86. package/dist/sdk2.cjs.development.js +13219 -0
  87. package/dist/sdk2.cjs.development.js.map +1 -0
  88. package/dist/sdk2.cjs.production.js +2 -0
  89. package/dist/sdk2.cjs.production.js.map +1 -0
  90. package/dist/sdk2.esm.js +13167 -0
  91. package/dist/sdk2.esm.js.map +1 -0
  92. package/dist/sdk2.umd.development.js +17456 -0
  93. package/dist/sdk2.umd.development.js.map +1 -0
  94. package/dist/sdk2.umd.production.js +2 -0
  95. package/dist/sdk2.umd.production.js.map +1 -0
  96. package/dist/stories/AdditionalDocumentCapture/AdditionalDocumentCapture.stories.d.ts +18 -0
  97. package/dist/stories/BarcodeReader.stories.d.ts +7 -0
  98. package/dist/stories/Camera.stories.d.ts +7 -0
  99. package/dist/stories/CompositeWizard/FaceLivenessAndIdCapture.stories.d.ts +24 -0
  100. package/dist/stories/CompositeWizard/IdCaptureAndFaceLiveness.stories.d.ts +24 -0
  101. package/dist/stories/CustomerFlows/CustomerBiometricsEnrollment.stories.d.ts +30 -0
  102. package/dist/stories/CustomerFlows/CustomerIdAndBiometricsEnrollment.stories.d.ts +29 -0
  103. package/dist/stories/CustomerFlows/CustomerIdentification.stories.d.ts +28 -0
  104. package/dist/stories/CustomerFlows/CustomerVerification.stories.d.ts +29 -0
  105. package/dist/stories/CustomerFlows/FaceValidation.stories.d.ts +29 -0
  106. package/dist/stories/CustomerFlows/IdAndFaceValidation.stories.d.ts +28 -0
  107. package/dist/stories/CustomerFlows/IdValidation.stories.d.ts +30 -0
  108. package/dist/stories/CustomerFlows/SignatureKYC.stories.d.ts +28 -0
  109. package/dist/stories/DocumentCaptureGuideOverlay/LicenseBack.stories.d.ts +14 -0
  110. package/dist/stories/DocumentCaptureGuideOverlay/LicenseFront.stories.d.ts +15 -0
  111. package/dist/stories/DocumentCaptureGuideOverlay/Passport.stories.d.ts +15 -0
  112. package/dist/stories/FaceLiveness/Capture.stories.d.ts +21 -0
  113. package/dist/stories/FaceLiveness/Wizard.stories.d.ts +23 -0
  114. package/dist/stories/FlipIdPrompt.stories.d.ts +15 -0
  115. package/dist/stories/FrameLoop.stories.d.ts +7 -0
  116. package/dist/stories/IdCapture/LicenseBackCapture.stories.d.ts +65 -0
  117. package/dist/stories/IdCapture/LicenseFrontCapture.stories.d.ts +65 -0
  118. package/dist/stories/IdCapture/PassportCapture.stories.d.ts +65 -0
  119. package/dist/stories/IdCapture/Wizard.stories.d.ts +89 -0
  120. package/dist/stories/MultiCamera.stories.d.ts +7 -0
  121. package/dist/stories/SignatureCapture/SignatureCapture.stories.d.ts +7 -0
  122. package/dist/stories/SignatureCapture/VideoSignatureCapture.stories.d.ts +7 -0
  123. package/dist/stories/TokenGeneration.stories.d.ts +7 -0
  124. package/dist/stories/VideoCapture.stories.d.ts +7 -0
  125. package/dist/stories/WebSdkExample.stories.d.ts +7 -0
  126. package/dist/stories/WebWorker.stories.d.ts +7 -0
  127. package/dist/stories/models/DocumentDetection.stories.d.ts +7 -0
  128. package/dist/stories/models/FaceDetection.stories.d.ts +9 -0
  129. package/dist/stories/models/FocusModel.stories.d.ts +7 -0
  130. package/dist/stories/models/HighPerformanceFaceDetectionMinimal.stories.d.ts +12 -0
  131. package/dist/stories/models/HighPerformanceFaceDetectionOriginal.stories.d.ts +7 -0
  132. package/dist/stories/utils/cdnUrl.d.ts +1 -0
  133. package/dist/stories/utils/getToken.d.ts +8 -0
  134. package/dist/stories/utils/makeRandomString.d.ts +1 -0
  135. package/package.json +130 -0
@@ -0,0 +1,156 @@
1
+ /// <reference types="react" />
2
+ import { UploadedDocument } from '../components/additional_document_capture/AdditionalDocumentCapture';
3
+ import { SignatureData } from '../components/signature_capture/data';
4
+ export declare enum SubmissionAction {
5
+ NONE = "NONE",
6
+ ENROLL = "ENROLL",
7
+ IDENTIFY = "IDENTIFY",
8
+ VALIDATE = "VALIDATE",
9
+ VERIFY = "VERIFY"
10
+ }
11
+ export declare enum SubmissionStatus {
12
+ READY = "READY",
13
+ SUBMITTING = "SUBMITTING",
14
+ SUBMITTED = "SUBMITTED",
15
+ FAILED = "FAILED"
16
+ }
17
+ export type SubmissionEnvironment = 'prod' | 'demo';
18
+ export declare const submissionHosts: {
19
+ prod: string;
20
+ demo: string;
21
+ };
22
+ export type SubmissionRequest = {
23
+ securityData: {
24
+ userName: string;
25
+ password: string;
26
+ merchantId: number;
27
+ };
28
+ customerData: {
29
+ idData: {
30
+ idImageFront?: string;
31
+ idImageBack?: string;
32
+ idType: 'NSP';
33
+ idCountry: 'NSP';
34
+ idState: '';
35
+ };
36
+ personalData?: {
37
+ uniqueNumber?: string;
38
+ };
39
+ biometricData?: {
40
+ selfie?: string;
41
+ };
42
+ signatureData?: {
43
+ signatureImage?: string;
44
+ };
45
+ additionalDocuments?: UploadedDocument[];
46
+ };
47
+ biometricData?: {
48
+ selfie?: string;
49
+ };
50
+ additionalData: {
51
+ uniqueRequestId: string;
52
+ manualReviewRequired: 'Y' | 'N';
53
+ bypassAgeValidation: 'Y' | 'N';
54
+ deDuplicationRequired: 'Y' | 'N';
55
+ bypassNameMatching: 'Y' | 'N';
56
+ postDataAPIRequired: 'Y' | 'N';
57
+ sendInputImagesInPost: 'Y' | 'N';
58
+ sendProcessedImagesInPost: 'Y' | 'N';
59
+ needImmediateResponse: 'Y' | 'N';
60
+ deduplicationSynchronous: 'Y' | 'N';
61
+ verifyDataWithHost: 'Y' | 'N';
62
+ idBackImageRequired: 'Y' | 'N';
63
+ stripSpecialCharacters: 'Y' | 'N';
64
+ idImageResolutionCheck: 'Y' | 'N';
65
+ metadata?: string;
66
+ };
67
+ employee?: {
68
+ companyId?: number;
69
+ };
70
+ };
71
+ export type CaptureAttemptMetadata = {
72
+ autoCapture: 'Y' | 'N';
73
+ captureTime: number;
74
+ operationTime?: number;
75
+ };
76
+ export type SubmissionMetadata = {
77
+ selfie: CaptureAttemptMetadata[];
78
+ back: CaptureAttemptMetadata[];
79
+ front: CaptureAttemptMetadata[];
80
+ sdkVersion: 'WebSDK_9.5.13.2.0';
81
+ isRealIDCheckRequired: 'true' | 'false';
82
+ os?: string;
83
+ osVersion?: string;
84
+ browserVersion?: string;
85
+ Resolution?: string;
86
+ GeoLocation?: string;
87
+ };
88
+ export type SubmissionResponse = {
89
+ status: {
90
+ statusCode: string;
91
+ statusMessage?: string;
92
+ errorData?: string;
93
+ };
94
+ resultData: Record<string, unknown>;
95
+ };
96
+ export type LivenessCheckRequest = {
97
+ securityData: {
98
+ userName: string;
99
+ password: string;
100
+ merchantId: number;
101
+ };
102
+ customerData: {
103
+ biometricData: {
104
+ selfie: string;
105
+ };
106
+ };
107
+ additionalData: {
108
+ uniqueRequestId: string;
109
+ stripSpecialCharacters: 'Y' | 'N';
110
+ estimateAge: 'Y' | 'N';
111
+ predictGender: 'Y' | 'N';
112
+ };
113
+ };
114
+ export type LiveCheckResponse = {
115
+ status: {
116
+ statusCode: string;
117
+ statusMessage: string;
118
+ errorData: string;
119
+ };
120
+ resultData: {
121
+ verificationResult: string;
122
+ eyeCovering: 'true' | 'false';
123
+ faceMask: 'true' | 'false';
124
+ headCovering: 'true' | 'false';
125
+ cellPhone: 'true' | 'false';
126
+ };
127
+ };
128
+ export type SubmissionState = {
129
+ submit: () => Promise<SubmissionResponse | null>;
130
+ submissionStatus: SubmissionStatus;
131
+ submissionRequest: SubmissionRequest | null;
132
+ submissionResponse: SubmissionResponse | null;
133
+ submissionEnvironment: SubmissionEnvironment;
134
+ idFrontImage: string | null;
135
+ idBackImage: string | null;
136
+ passportImage: string | null;
137
+ selfieImage: string | null;
138
+ signatureData: SignatureData | null;
139
+ additionalDocuments: UploadedDocument[] | null;
140
+ setIdFrontImage: (image: string) => void;
141
+ setIdBackImage: (image: string) => void;
142
+ setPassportImage: (image: string) => void;
143
+ setSelfieImage: (image: string) => void;
144
+ setSignatureData: (signatureData: SignatureData) => void;
145
+ setAdditionalDocuments: (uploadedDocuments: UploadedDocument[]) => void;
146
+ logIdFrontCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
147
+ logIdBackCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
148
+ logSelfieCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
149
+ checkLiveness: (imageDataUrl: string) => Promise<LiveCheckResponse>;
150
+ retryLocationAccess: () => void;
151
+ };
152
+ export declare const SubmissionContext: import("react").Context<SubmissionState>;
153
+ export declare function determineSubmissionHost(environment: SubmissionEnvironment, token?: string): string;
154
+ export declare function determineSubmissionEndpoint(action: SubmissionAction, hasId: boolean, hasSelfie: boolean, hasToken: boolean): string;
155
+ export declare function liveCheckEndpoint(hasToken: boolean): string;
156
+ export declare function apiHeaders(token?: string): HeadersInit;
@@ -0,0 +1,32 @@
1
+ import { IdValidation, IdValidationProps } from './components/customer_flows/IdValidation';
2
+ import { FaceValidation, FaceValidationProps } from './components/customer_flows/FaceValidation';
3
+ import { IdAndFaceValidation, IdAndFaceValidationProps } from './components/customer_flows/IdAndFaceValidation';
4
+ import { CustomerIdAndBiometricsEnrollment, CustomerEnrollmentProps } from './components/customer_flows/CustomerIdAndBiometricsEnrollment';
5
+ import { CustomerVerification, CustomerVerificationProps } from './components/customer_flows/CustomerVerification';
6
+ import { CustomerIdentification, CustomerIdentificationProps } from './components/customer_flows/CustomerIdentification';
7
+ import { preloadModels } from './lib/models/preloadModels';
8
+ import { CustomerBiometricsEnrollment } from './components/customer_flows/CustomerBiometricsEnrollment';
9
+ import { SignatureKYC, SignatureKYCProps } from './components/customer_flows/SignatureKYC';
10
+ export declare const renderIdValidation: (targetElement: Element | DocumentFragment | string, options: IdValidationProps, fullscreen?: boolean) => void;
11
+ export declare const renderFaceValidation: (targetElement: Element | DocumentFragment | string, options: FaceValidationProps, fullscreen?: boolean) => void;
12
+ export declare const renderIdAndFaceValidation: (targetElement: Element | DocumentFragment | string, options: IdAndFaceValidationProps, fullscreen?: boolean) => void;
13
+ export declare const renderCustomerIdAndBiometricsEnrollment: (targetElement: Element | DocumentFragment | string, options: CustomerEnrollmentProps, fullscreen?: boolean) => void;
14
+ export declare const renderCustomerBiometricsEnrollment: (targetElement: Element | DocumentFragment | string, options: CustomerEnrollmentProps, fullscreen?: boolean) => void;
15
+ export declare const renderCustomerVerification: (targetElement: Element | DocumentFragment | string, options: CustomerVerificationProps, fullscreen?: boolean) => void;
16
+ export declare const renderCustomerIdentification: (targetElement: Element | DocumentFragment | string, options: CustomerIdentificationProps, fullscreen?: boolean) => void;
17
+ export declare const renderSignatureKYC: (targetElement: Element | DocumentFragment | string, options: SignatureKYCProps, fullscreen?: boolean) => void;
18
+ export type IDmissionSDK = {
19
+ renderIdValidation: typeof renderIdValidation;
20
+ renderFaceValidation: typeof renderFaceValidation;
21
+ renderIdAndFaceValidation: typeof renderIdAndFaceValidation;
22
+ renderCustomerIdAndBiometricsEnrollment: typeof renderCustomerIdAndBiometricsEnrollment;
23
+ renderCustomerBiometricsEnrollment: typeof renderCustomerBiometricsEnrollment;
24
+ renderCustomerVerification: typeof renderCustomerVerification;
25
+ renderCustomerIdentification: typeof renderCustomerIdentification;
26
+ renderSignatureKYC: typeof renderSignatureKYC;
27
+ preloadModels: typeof preloadModels;
28
+ };
29
+ declare global {
30
+ var IDmissionSDK: IDmissionSDK;
31
+ }
32
+ export { preloadModels, IdValidation, FaceValidation, IdAndFaceValidation, CustomerIdAndBiometricsEnrollment, CustomerBiometricsEnrollment, CustomerVerification, CustomerIdentification, SignatureKYC, };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./sdk2.cjs.production.js')
5
+ } else {
6
+ module.exports = require('./sdk2.cjs.development.js')
7
+ }
@@ -0,0 +1 @@
1
+ export function getNativeBarcodeReaderResult(image: any): Promise<any>;
@@ -0,0 +1,53 @@
1
+ declare function processBarcode(rawValue: string): Promise<unknown>;
2
+ declare const companyXSLTData: {
3
+ code: string;
4
+ match_pattern: string;
5
+ xslt_template: string;
6
+ is_disabled: string;
7
+ Country: string;
8
+ State: string;
9
+ DocumentType: string;
10
+ Side: string;
11
+ barcode_type: string;
12
+ }[];
13
+ declare function isBarcodePresentForSelectedCriteria(idSide: string): Promise<{
14
+ code: string;
15
+ match_pattern: string;
16
+ xslt_template: string;
17
+ is_disabled: string;
18
+ Country: string;
19
+ State: string;
20
+ DocumentType: string;
21
+ Side: string;
22
+ barcode_type: string;
23
+ } | null>;
24
+ type XSLTResponse = {
25
+ data: {
26
+ data: {
27
+ response: {
28
+ status: {
29
+ code: string;
30
+ };
31
+ listData: {
32
+ fieldValues: string[];
33
+ };
34
+ };
35
+ };
36
+ };
37
+ };
38
+ declare function getCompanyXSLTData(serviceParams: {
39
+ baseUrl: string;
40
+ tokenId: string;
41
+ }): Promise<void>;
42
+ declare function getXSLTDataHandler(resp: XSLTResponse | null): void;
43
+ declare function transformBarcodeUsingXSLT(barcodeScanResult: string, xsl: string): Promise<unknown>;
44
+ declare class Transformation {
45
+ xml: string;
46
+ xmlDoc: any;
47
+ xslt: any;
48
+ xsltDoc: any;
49
+ setXml(x: string): this;
50
+ setXslt(x: string): this;
51
+ transform(): Promise<unknown>;
52
+ }
53
+ declare function browserSupportsXSLT(): boolean;
@@ -0,0 +1,3 @@
1
+ import { PDF417DetectionResult } from './Native';
2
+ export declare function supportsNativeBarcodeScanning(): boolean;
3
+ export declare function scanBarcode(blob: Blob, bbox?: number[]): Promise<PDF417DetectionResult | null>;
@@ -0,0 +1 @@
1
+ export function getZxingBarcodeReaderResult(image: any, rotate?: boolean): Promise<any>;
@@ -0,0 +1,59 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="w3c-image-capture" />
3
+ export type Camera = {
4
+ stream: MediaStream;
5
+ isRearFacing: boolean;
6
+ release: () => void;
7
+ width: number;
8
+ height: number;
9
+ };
10
+ export type CameraResolution = 'LOW' | 'MID' | 'MAX';
11
+ export declare function selectAndOpenCamera(resolution?: CameraResolution): Promise<Camera>;
12
+ export declare function drawFrameToCanvas(videoElement: HTMLVideoElement, canvasElement: HTMLCanvasElement): CanvasRenderingContext2D | null;
13
+ export declare function getFrameFromVideo(videoElement: HTMLVideoElement, canvasElement: HTMLCanvasElement | null): ImageData | null;
14
+ export declare function getVideoDeviceMaxDimensions(deviceInfo: MediaDeviceInfo): Promise<{
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ type Resolution = {
19
+ label: string;
20
+ width: number;
21
+ height: number;
22
+ ratio: string;
23
+ };
24
+ export declare const quickScan: Resolution[];
25
+ export declare const useHighestResCaptureDevice: ({ preferFrontFacingCamera, preferContinuityCamera, requestMicrophoneAccess, }?: {
26
+ preferFrontFacingCamera: boolean;
27
+ preferContinuityCamera: boolean;
28
+ requestMicrophoneAccess: boolean;
29
+ }) => {
30
+ videoRef: import("react").MutableRefObject<HTMLVideoElement | null>;
31
+ videoDevice: MediaDeviceInfo | null;
32
+ videoLoaded: boolean;
33
+ setVideoLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
34
+ cameraRef: import("react").MutableRefObject<Camera | null>;
35
+ cameraAccessDenied: boolean;
36
+ retryCameraAccess: () => void;
37
+ releaseCameraAccess: () => void;
38
+ iphoneContinuityCameraAvailable: boolean;
39
+ iphoneContinuityCameraAllowed: boolean;
40
+ setIphoneContinuityCameraAllowed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
41
+ captureDevice: ImageCapture | null;
42
+ grabFrame: () => Promise<ImageBitmap | null>;
43
+ takePhoto: () => Promise<Blob | null>;
44
+ };
45
+ export declare const useDualResCaptureDevice: () => {
46
+ minVideoRef: import("react").MutableRefObject<HTMLVideoElement | null>;
47
+ maxVideoRef: import("react").MutableRefObject<HTMLVideoElement | null>;
48
+ minCamera: Camera | null;
49
+ maxCamera: Camera | null;
50
+ minVideoLoaded: boolean;
51
+ maxVideoLoaded: boolean;
52
+ setMinVideoLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
53
+ setMaxVideoLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
54
+ minCaptureDevice: ImageCapture | null;
55
+ maxCaptureDevice: ImageCapture | null;
56
+ grabLowResFrame: () => Promise<ImageBitmap | undefined>;
57
+ takeFullResPhoto: () => Promise<Blob | null>;
58
+ };
59
+ export {};
@@ -0,0 +1,9 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Camera, CameraResolution } from './Camera';
3
+ export declare const useCamera: (resolution?: CameraResolution) => {
4
+ camera: Camera | null;
5
+ videoRef: MutableRefObject<HTMLVideoElement | null>;
6
+ videoLoaded: boolean;
7
+ setVideoLoaded: (is: boolean) => void;
8
+ };
9
+ export declare const useWindowFocus: () => boolean;
@@ -0,0 +1,7 @@
1
+ import { Camera } from './Camera';
2
+ export declare const useVideoRecorder: (camera: Camera | null) => {
3
+ isRecording: boolean;
4
+ startRecording: () => void;
5
+ stopRecording: () => void;
6
+ videoUrl: string | null;
7
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,50 @@
1
+ declare const _default: {
2
+ 'Use your device camera to capture your ID': string;
3
+ 'Use your iPhone as a webcam': string;
4
+ 'Models warming up...': string;
5
+ 'Camera initializing...': string;
6
+ 'Camera access blocked': string;
7
+ 'Location access blocked': string;
8
+ Continue: string;
9
+ 'Your camera permission is disabled': string;
10
+ 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions, you must go to settings and provide camera access to the current browser.': string;
11
+ 'Your location permission is disabled': string;
12
+ 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions, you must go to settings and provide location access to the current browser.': string;
13
+ Retry: string;
14
+ 'Scan the front of ID': string;
15
+ 'Scan the back of ID': string;
16
+ 'Scan the ID page of passport': string;
17
+ 'ID Card Front': string;
18
+ 'ID Card Back': string;
19
+ Passport: string;
20
+ 'Capturing...': string;
21
+ 'Capture failed!': string;
22
+ 'Please flip your ID card...': string;
23
+ 'ID Capture Successful': string;
24
+ 'Verify the entire ID was captured clearly with no glare.': string;
25
+ Submit: string;
26
+ 'Submitting...': string;
27
+ 'Use your device camera to capture your face': string;
28
+ 'Remove Sunglasses & Hat': string;
29
+ 'Avoid Excessive Backlighting': string;
30
+ 'Hold still for a few seconds...': string;
31
+ 'Look straight into the camera...': string;
32
+ 'Move back...': string;
33
+ 'Move forward...': string;
34
+ 'Move to the center...': string;
35
+ 'Please remove your eye coverings (sunglasses, eye patch, etc.)...': string;
36
+ 'Please remove your head coverings (hat, scarf, etc.)...': string;
37
+ 'Please remove your mask...': string;
38
+ 'Live face not detected, please try again': string;
39
+ Exit: string;
40
+ 'Face liveness has been verified!': string;
41
+ Done: string;
42
+ 'Customer has been identified!': string;
43
+ 'Customer not found': string;
44
+ 'Additional document capture': string;
45
+ Next: string;
46
+ 'Please sign the box below': string;
47
+ Accept: string;
48
+ Clear: string;
49
+ };
50
+ export default _default;
@@ -0,0 +1,60 @@
1
+ export declare const ALL_LANGUAGES: readonly ["auto", "en", "es"];
2
+ export type LangOptions = typeof ALL_LANGUAGES;
3
+ export type LangOption = LangOptions[number];
4
+ export declare const resources: {
5
+ en: {
6
+ translation: {};
7
+ };
8
+ es: {
9
+ translation: {
10
+ 'Use your device camera to capture your ID': string;
11
+ 'Use your iPhone as a webcam': string;
12
+ 'Models warming up...': string;
13
+ 'Camera initializing...': string;
14
+ 'Camera access blocked': string;
15
+ 'Location access blocked': string;
16
+ Continue: string;
17
+ 'Your camera permission is disabled': string;
18
+ 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions, you must go to settings and provide camera access to the current browser.': string;
19
+ 'Your location permission is disabled': string;
20
+ 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions, you must go to settings and provide location access to the current browser.': string;
21
+ Retry: string;
22
+ 'Scan the front of ID': string;
23
+ 'Scan the back of ID': string;
24
+ 'Scan the ID page of passport': string;
25
+ 'ID Card Front': string;
26
+ 'ID Card Back': string;
27
+ Passport: string;
28
+ 'Capturing...': string;
29
+ 'Capture failed!': string;
30
+ 'Please flip your ID card...': string;
31
+ 'ID Capture Successful': string;
32
+ 'Verify the entire ID was captured clearly with no glare.': string;
33
+ Submit: string;
34
+ 'Submitting...': string;
35
+ 'Use your device camera to capture your face': string;
36
+ 'Remove Sunglasses & Hat': string;
37
+ 'Avoid Excessive Backlighting': string;
38
+ 'Hold still for a few seconds...': string;
39
+ 'Look straight into the camera...': string;
40
+ 'Move back...': string;
41
+ 'Move forward...': string;
42
+ 'Move to the center...': string;
43
+ 'Please remove your eye coverings (sunglasses, eye patch, etc.)...': string;
44
+ 'Please remove your head coverings (hat, scarf, etc.)...': string;
45
+ 'Please remove your mask...': string;
46
+ 'Live face not detected, please try again': string;
47
+ Exit: string;
48
+ 'Face liveness has been verified!': string;
49
+ Done: string;
50
+ 'Customer has been identified!': string;
51
+ 'Customer not found': string;
52
+ 'Additional document capture': string;
53
+ Next: string;
54
+ 'Please sign the box below': string;
55
+ Accept: string;
56
+ Clear: string;
57
+ };
58
+ };
59
+ };
60
+ export declare const useLanguage: (lang: LangOption) => void;
@@ -0,0 +1,27 @@
1
+ import * as tf from '@tensorflow/tfjs';
2
+ export declare enum DocumentType {
3
+ NONE = "NONE",
4
+ ID_CARD = "ID_CARD",
5
+ ID_CARD_FRONT = "ID_CARD_FRONT",
6
+ ID_CARD_BACK = "ID_CARD_BACK",
7
+ PASSPORT = "PASSPORT"
8
+ }
9
+ export declare function loadDocumentDetectionModel(url: string): Promise<tf.GraphModel>;
10
+ export type RawEdgeDetectionResult = tf.Tensor<tf.Rank>[];
11
+ export declare function makeDocumentDetectionPredictions(model: tf.GraphModel, image: ImageBitmap | ImageData | HTMLImageElement): Promise<[RawEdgeDetectionResult, () => void]>;
12
+ export type DocumentDetectionResults = {
13
+ boxes: number[][];
14
+ scores: number[];
15
+ labels: number[];
16
+ };
17
+ export declare const labelMap: {
18
+ [id: number]: Label;
19
+ };
20
+ export type Label = 'Document' | 'MRZ' | 'PDF417' | 'Primary face' | 'Secondary face' | 'Glare' | 'Punch Hole' | 'Passport Page';
21
+ export declare function runDocumentDetection(model: tf.GraphModel, image: ImageBitmap | ImageData | HTMLImageElement): Promise<DocumentDetectionResults>;
22
+ export type DetectedObject = {
23
+ score: number;
24
+ bbox: number[];
25
+ label: Label;
26
+ };
27
+ export declare function bboxToDetectedObjectUnscaled(box: number[], score: number, label: number): DetectedObject;
@@ -0,0 +1,5 @@
1
+ import * as faceDetection from '@tensorflow-models/face-detection';
2
+ import '@mediapipe/face_detection';
3
+ export type FaceDetectionModel = faceDetection.FaceDetector;
4
+ export declare function loadFaceDetectionModel(): Promise<FaceDetectionModel>;
5
+ export declare function makeFaceDetectionPrediction(model: FaceDetectionModel, imageData: ImageBitmap | HTMLCanvasElement): Promise<[faceDetection.Face[], number]>;
@@ -0,0 +1,7 @@
1
+ import * as tf from '@tensorflow/tfjs';
2
+ export declare function loadFocusModel(url: string): Promise<tf.LayersModel>;
3
+ type BlurScore = number;
4
+ type FocusScore = number;
5
+ export type FocusPrediction = [BlurScore, FocusScore];
6
+ export declare function makeFocusPrediction(model: tf.LayersModel, imageData: ImageBitmap | ImageData): Promise<[FocusPrediction, () => void]>;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const preloadModels: ({ documentDetectionModel, focusModel, skipFaceDetectionModel, }: {
2
+ documentDetectionModel?: string | false | undefined;
3
+ focusModel?: string | false | undefined;
4
+ skipFaceDetectionModel?: boolean | undefined;
5
+ }) => Promise<void>;
@@ -0,0 +1,29 @@
1
+ import { DocumentDetectionResults } from '../models/DocumentDetection';
2
+ import { FocusPrediction } from '../models/Focus';
3
+ export type Action = {
4
+ type: 'loadModel';
5
+ payload: {
6
+ name: 'documentDetection' | 'focus';
7
+ url: string;
8
+ };
9
+ } | {
10
+ type: 'modelLoaded';
11
+ payload: {
12
+ name: 'documentDetection' | 'focus';
13
+ };
14
+ } | {
15
+ type: 'makePrediction';
16
+ payload: {
17
+ image: ImageBitmap;
18
+ };
19
+ } | {
20
+ type: 'predictionMade';
21
+ payload: {
22
+ prediction: Prediction;
23
+ };
24
+ };
25
+ export type Prediction = {
26
+ image: ImageBitmap;
27
+ documentDetection: DocumentDetectionResults;
28
+ focus: FocusPrediction;
29
+ };
@@ -0,0 +1,14 @@
1
+ import { Action, Prediction } from './Actions';
2
+ export declare class WorkerClient {
3
+ worker: Worker;
4
+ documentDetectionModelLoaded: boolean;
5
+ focusModelLoaded: boolean;
6
+ constructor();
7
+ onMessage(handler: (message: MessageEvent) => void): void;
8
+ postMessage(message: Action): void;
9
+ loadDocumentDetectionModel(url: string): Promise<void>;
10
+ loadFocusModel(url: string): Promise<void>;
11
+ loadModels(documentDetectionModelUrl: string, focusModelUrl: string): Promise<void>;
12
+ makePrediction(image: ImageBitmap): void;
13
+ onPrediction(handler: (prediction: Prediction) => void): void;
14
+ }
@@ -0,0 +1,8 @@
1
+ declare function makeDocumentDetectionPredictions(model: any, image: any): Promise<{
2
+ boxes: any;
3
+ scores: any;
4
+ labels: any;
5
+ }>;
6
+ declare function makeFocusPrediction(model: any, imageData: any): Promise<any>;
7
+ declare let documentDetectionModel: any;
8
+ declare let focusModel: any;
File without changes
@@ -0,0 +1,2 @@
1
+ import { Face } from '@tensorflow-models/face-detection';
2
+ export declare function cropToShoulders(frame: ImageBitmap, face: Face): string;
@@ -0,0 +1,3 @@
1
+ export declare function dataUrlToBase64(url: string): Promise<string>;
2
+ export declare function dataUrlToBase64Sync(url: string): string;
3
+ export declare function contentDispositionFromDataUrl(url: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function iOS(): boolean;
2
+ export declare function wideAngleIsBetter(): boolean;
@@ -0,0 +1 @@
1
+ export declare function getBlobDimensions(blob: Blob): Promise<[number, number]>;