idmission-web-sdk 1.0.317 → 1.0.319

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.
@@ -35,6 +35,7 @@ export type SubmissionState = {
35
35
  setIdCaptureVideoIdBackImage: (image: string) => void;
36
36
  setIdCaptureVideoAudioUrl: (videoDataUrl: string) => void;
37
37
  setIdCaptureVideoAudioStartsAt: (value: number) => void;
38
+ setExpectedAudioText: (value: string) => void;
38
39
  setAdditionalDocuments: (uploadedDocuments: UploadedDocument[]) => void;
39
40
  uploadDocument: (blob: Blob) => Promise<string>;
40
41
  logIdFrontCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
@@ -79,5 +80,6 @@ export type SubmissionProviderProps = {
79
80
  onBeforeLivenessCheck?: (req: LivenessCheckRequest) => Promise<LivenessCheckRequest>;
80
81
  onResponseReceived?: (res: SubmissionResponse, req: SubmissionRequest) => void;
81
82
  onRequestFailure?: (err: Error) => void;
83
+ readTextPrompt?: string;
82
84
  };
83
85
  export declare const SubmissionProvider: ({ action, children, url, environment, token, companyId, enrollmentId, personalData, cardData, bypassAgeValidation, bypassNameMatching, needImmediateResponse, manualReviewRequired, idBackImageRequired, idImageResolutionCheck, verifyIdWithExternalDatabases, deduplicationEnabled, deduplicationSynchronous, geolocationEnabled, geolocationRequired, webhooksEnabled, webhooksClientTraceId, webhooksStripSpecialCharacters, webhooksSendInputImages, webhooksSendProcessedImages, webhooksFireOnReview, precapturedDocuments, documentServiceUrl, onSubmit, onBeforeSubmit, onBeforeLivenessCheck, onResponseReceived, onRequestFailure, }: SubmissionProviderProps) => ReactElement;
@@ -39,7 +39,8 @@ export type SubmissionRequest = {
39
39
  selfie?: string;
40
40
  videoData?: string;
41
41
  voiceData?: string;
42
- voiceStartsAt?: number;
42
+ voiceStartTime?: number;
43
+ expectedAudioText?: string;
43
44
  };
44
45
  signatureData?: {
45
46
  signatureImage?: string;
@@ -50,7 +50,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
50
50
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
51
51
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
52
 
53
- var webSdkVersion = '1.0.317';
53
+ var webSdkVersion = '1.0.319';
54
54
 
55
55
  function getPlatform() {
56
56
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -678,6 +678,9 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
678
678
  setIdCaptureVideoAudioStartsAt: function setIdCaptureVideoAudioStartsAt() {
679
679
  return null;
680
680
  },
681
+ setExpectedAudioText: function setExpectedAudioText() {
682
+ return null;
683
+ },
681
684
  setAdditionalDocuments: function setAdditionalDocuments() {
682
685
  return null;
683
686
  },
@@ -808,26 +811,29 @@ var SubmissionProvider = function SubmissionProvider(_a) {
808
811
  idCaptureVideoAudioStartsAt = _11[0],
809
812
  setIdCaptureVideoAudioStartsAt = _11[1];
810
813
  var _12 = React.useState(null),
811
- additionalDocuments = _12[0],
812
- setAdditionalDocuments = _12[1];
814
+ expectedAudioText = _12[0],
815
+ setExpectedAudioText = _12[1];
813
816
  var _13 = React.useState(null),
814
- geolocationResult = _13[0],
815
- setGeolocationResult = _13[1];
816
- var _14 = React.useState(0),
817
- geolocationAttempts = _14[0],
818
- setGeolocationAttempts = _14[1];
819
- var _15 = React.useState(false),
820
- geolocationBlocked = _15[0],
821
- setGeolocationBlocked = _15[1];
822
- var _16 = React.useState([]),
823
- idFrontCaptureAttempts = _16[0],
824
- setIdFrontCaptureAttempts = _16[1];
817
+ additionalDocuments = _13[0],
818
+ setAdditionalDocuments = _13[1];
819
+ var _14 = React.useState(null),
820
+ geolocationResult = _14[0],
821
+ setGeolocationResult = _14[1];
822
+ var _15 = React.useState(0),
823
+ geolocationAttempts = _15[0],
824
+ setGeolocationAttempts = _15[1];
825
+ var _16 = React.useState(false),
826
+ geolocationBlocked = _16[0],
827
+ setGeolocationBlocked = _16[1];
825
828
  var _17 = React.useState([]),
826
- idBackCaptureAttempts = _17[0],
827
- setIdBackCaptureAttempts = _17[1];
829
+ idFrontCaptureAttempts = _17[0],
830
+ setIdFrontCaptureAttempts = _17[1];
828
831
  var _18 = React.useState([]),
829
- selfieCaptureAttempts = _18[0],
830
- setSelfieCaptureAttempts = _18[1];
832
+ idBackCaptureAttempts = _18[0],
833
+ setIdBackCaptureAttempts = _18[1];
834
+ var _19 = React.useState([]),
835
+ selfieCaptureAttempts = _19[0],
836
+ setSelfieCaptureAttempts = _19[1];
831
837
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
832
838
  setIdFrontCaptureAttempts(function (attempts) {
833
839
  return tslib.__spreadArray(tslib.__spreadArray([], attempts, true), [attempt], false);
@@ -958,7 +964,8 @@ var SubmissionProvider = function SubmissionProvider(_a) {
958
964
  return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoAudioUrl)];
959
965
  case 5:
960
966
  _c.voiceData = _g.sent();
961
- submissionRequest.customerData.biometricData.voiceStartsAt = idCaptureVideoAudioStartsAt !== null && idCaptureVideoAudioStartsAt !== void 0 ? idCaptureVideoAudioStartsAt : undefined;
967
+ submissionRequest.customerData.biometricData.voiceStartTime = idCaptureVideoAudioStartsAt !== null && idCaptureVideoAudioStartsAt !== void 0 ? idCaptureVideoAudioStartsAt : undefined;
968
+ submissionRequest.customerData.biometricData.expectedAudioText = expectedAudioText !== null && expectedAudioText !== void 0 ? expectedAudioText : undefined;
962
969
  _g.label = 6;
963
970
  case 6:
964
971
  if (idCaptureVideoIdFrontImage) {
@@ -1197,12 +1204,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1197
1204
  setSubmissionStatus(SubmissionStatus.READY);
1198
1205
  retrySubmission();
1199
1206
  }, [retrySubmission]);
1200
- var _19 = React.useState('NOT_PARSED'),
1201
- tokenState = _19[0],
1202
- setTokenState = _19[1];
1203
- var _20 = React.useState(null),
1204
- tokenError = _20[0],
1205
- setTokenError = _20[1];
1207
+ var _20 = React.useState('NOT_PARSED'),
1208
+ tokenState = _20[0],
1209
+ setTokenState = _20[1];
1210
+ var _21 = React.useState(null),
1211
+ tokenError = _21[0],
1212
+ setTokenError = _21[1];
1206
1213
  React.useEffect(function () {
1207
1214
  if (typeof window === 'undefined') return;
1208
1215
  (function () {
@@ -1346,6 +1353,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1346
1353
  setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
1347
1354
  setIdCaptureVideoAudioUrl: setIdCaptureVideoAudioUrl,
1348
1355
  setIdCaptureVideoAudioStartsAt: setIdCaptureVideoAudioStartsAt,
1356
+ setExpectedAudioText: setExpectedAudioText,
1349
1357
  setAdditionalDocuments: setAdditionalDocuments,
1350
1358
  uploadDocument: uploadDocument,
1351
1359
  logIdFrontCaptureAttempt: logIdFrontCaptureAttempt,
@@ -10361,7 +10369,7 @@ var esTranslation = {
10361
10369
  'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
10362
10370
  '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.': 'Esta aplicación requiere el acceso a la cámara para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos, entonces hay que dirigirse a Configuración y otorgar el permiso a la cámara en el explorador actual.',
10363
10371
  'Your microphone permission is disabled': 'El permiso de la micrófono está desactivado',
10364
- 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions, you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere el acceso a la micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos, entonces hay que dirigirse a Configuración y otorgar el permiso a la micrófono en el explorador actual.',
10372
+ 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions, you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere tener acceso al micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos, entonces hay que dirigirse a Configuración y otorgar el permiso al micrófono en el explorador actual.',
10365
10373
  'Your location permission is disabled': 'El permiso de la localización está desactivado',
10366
10374
  '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.': 'Esta aplicación requiere el acceso a la localización para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos, entonces hay que dirigirse a Configuración y otorgar el permiso a la localización en el explorador actual.',
10367
10375
  Retry: 'Reintentar',
@@ -16207,16 +16215,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16207
16215
  var _17 = React.useState(null),
16208
16216
  videoStartsAt = _17[0],
16209
16217
  setVideoStartsAt = _17[1];
16210
- var setIdCaptureVideoAudioStartsAt = React.useContext(SubmissionContext).setIdCaptureVideoAudioStartsAt;
16218
+ var _18 = React.useContext(SubmissionContext),
16219
+ setIdCaptureVideoAudioStartsAt = _18.setIdCaptureVideoAudioStartsAt,
16220
+ setExpectedAudioText = _18.setExpectedAudioText;
16211
16221
  var onSelfiePredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
16212
- var _18 = useVideoRecorder(cameraRef.current, audioStream),
16213
- isRecordingVideo = _18.isRecordingVideo,
16214
- startRecordingVideo = _18.startRecordingVideo,
16215
- startRecordingAudio = _18.startRecordingAudio,
16216
- stopRecordingVideo = _18.stopRecordingVideo,
16217
- stopRecordingAudio = _18.stopRecordingAudio,
16218
- videoUrl = _18.videoUrl,
16219
- audioUrl = _18.audioUrl;
16222
+ var _19 = useVideoRecorder(cameraRef.current, audioStream),
16223
+ isRecordingVideo = _19.isRecordingVideo,
16224
+ startRecordingVideo = _19.startRecordingVideo,
16225
+ startRecordingAudio = _19.startRecordingAudio,
16226
+ stopRecordingVideo = _19.stopRecordingVideo,
16227
+ stopRecordingAudio = _19.stopRecordingAudio,
16228
+ videoUrl = _19.videoUrl,
16229
+ audioUrl = _19.audioUrl;
16220
16230
  React.useEffect(function () {
16221
16231
  if (!isRecordingVideo && !videoUrl) {
16222
16232
  startRecordingVideo();
@@ -16232,9 +16242,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16232
16242
  React.useEffect(function () {
16233
16243
  shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && (!readTextPrompt || microphoneReady);
16234
16244
  }, [cameraReady, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
16235
- var _19 = React.useState('SHOW_ID_FRONT'),
16236
- requestedAction = _19[0],
16237
- setRequestedAction = _19[1];
16245
+ var _20 = React.useState('SHOW_ID_FRONT'),
16246
+ requestedAction = _20[0],
16247
+ setRequestedAction = _20[1];
16238
16248
  React.useEffect(function () {
16239
16249
  if (requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
16240
16250
  if (!idCaptureModelsEnabled || !idModelsReady || !cameraReady || !videoLoaded) return;
@@ -16262,15 +16272,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16262
16272
  }
16263
16273
  });
16264
16274
  }, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
16265
- var _20 = React.useState(0),
16266
- currentDetectionScore = _20[0],
16267
- setCurrentDetectionScore = _20[1];
16268
16275
  var _21 = React.useState(0),
16269
- currentFocusScore = _21[0],
16270
- setCurrentFocusScore = _21[1];
16276
+ currentDetectionScore = _21[0],
16277
+ setCurrentDetectionScore = _21[1];
16271
16278
  var _22 = React.useState(0),
16272
- goodFramesCount = _22[0],
16273
- setGoodFramesCount = _22[1];
16279
+ currentFocusScore = _22[0],
16280
+ setCurrentFocusScore = _22[1];
16281
+ var _23 = React.useState(0),
16282
+ goodFramesCount = _23[0],
16283
+ setGoodFramesCount = _23[1];
16274
16284
  var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
16275
16285
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
16276
16286
  React.useEffect(function () {
@@ -16288,9 +16298,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16288
16298
  }
16289
16299
  });
16290
16300
  }, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade]);
16291
- var _23 = React.useState(null),
16292
- idFrontCaptureStartedAt = _23[0],
16293
- setFirstGoodFrameTime = _23[1];
16301
+ var _24 = React.useState(null),
16302
+ idFrontCaptureStartedAt = _24[0],
16303
+ setFirstGoodFrameTime = _24[1];
16294
16304
  React.useEffect(function () {
16295
16305
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
16296
16306
  }, [goodFramesCount]);
@@ -16301,6 +16311,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16301
16311
  setRequestedAction('READ_TEXT');
16302
16312
  startRecordingAudio();
16303
16313
  setIdCaptureVideoAudioStartsAt(new Date().getTime() - ((_a = videoStartsAt === null || videoStartsAt === void 0 ? void 0 : videoStartsAt.getTime()) !== null && _a !== void 0 ? _a : 0));
16314
+ setExpectedAudioText(readTextPrompt);
16304
16315
  } else {
16305
16316
  stopRecordingVideo();
16306
16317
  }
@@ -16309,9 +16320,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16309
16320
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
16310
16321
  var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
16311
16322
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
16312
- var _24 = React.useState(),
16313
- countdownStartedAt = _24[0],
16314
- setCountdownStartedAt = _24[1];
16323
+ var _25 = React.useState(),
16324
+ countdownStartedAt = _25[0],
16325
+ setCountdownStartedAt = _25[1];
16315
16326
  var frameLock = React.useRef(false);
16316
16327
  var captureFrame = React.useCallback(function () {
16317
16328
  return tslib.__awaiter(void 0, void 0, void 0, function () {
@@ -16409,9 +16420,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16409
16420
  };
16410
16421
  }, [captureCountdownSeconds, captureFrame, countdownStartedAt]);
16411
16422
  var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
16412
- var _25 = React.useState(0),
16413
- numFramesWithoutFaces = _25[0],
16414
- setNumFramesWithoutFaces = _25[1];
16423
+ var _26 = React.useState(0),
16424
+ numFramesWithoutFaces = _26[0],
16425
+ setNumFramesWithoutFaces = _26[1];
16415
16426
  React.useEffect(function () {
16416
16427
  onSelfiePredictionMade(function (faces) {
16417
16428
  setFaces(faces);
@@ -16426,14 +16437,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
16426
16437
  }
16427
16438
  }, [numFramesWithoutFaces, onFaceNotDetected]);
16428
16439
  var theme = styled.useTheme();
16429
- var _26 = useTranslations(rawVerbiage, {
16440
+ var _27 = useTranslations(rawVerbiage, {
16430
16441
  faceNotCenteredText: 'Please move your face to the center...',
16431
16442
  searchingForIdCardText: 'Searching for ID card...',
16432
16443
  captureBtnText: 'Capture'
16433
16444
  }),
16434
- captureBtnText = _26.captureBtnText,
16435
- faceNotCenteredText = _26.faceNotCenteredText,
16436
- searchingForIdCardText = _26.searchingForIdCardText;
16445
+ captureBtnText = _27.captureBtnText,
16446
+ faceNotCenteredText = _27.faceNotCenteredText,
16447
+ searchingForIdCardText = _27.searchingForIdCardText;
16437
16448
  var debugScalingDetails = useDebugScalingDetails({
16438
16449
  enabled: debugMode,
16439
16450
  pageWidth: width,