idmission-web-sdk 1.0.150 → 1.0.152

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.
@@ -2,9 +2,10 @@ import { FC, PropsWithChildren, ReactNode } from 'react';
2
2
  import { ThemeInput } from '../../themes';
3
3
  import { LangOption } from '../../lib/locales';
4
4
  import { SubmissionRequest } from '../../contexts/SubmissionContext';
5
- import { DocumentCaptureWizardClassNames } from '../document_capture/DocumentCaptureWizard';
5
+ import { DocumentCaptureWizardClassNames, DocumentCaptureWizardVerbiage } from '../document_capture/DocumentCaptureWizard';
6
6
  import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
7
7
  export type DocumentCaptureClassNames = DocumentCaptureWizardClassNames;
8
+ export type DocumentCaptureVerbiage = DocumentCaptureWizardVerbiage;
8
9
  export interface DocumentCaptureProps extends PropsWithChildren {
9
10
  /** Language code to use. Supported values: 'auto' (detect based on user's OS), 'en' (English), 'es' (Spanish). Defaults to auto. */
10
11
  lang?: LangOption;
@@ -31,6 +32,8 @@ export interface DocumentCaptureProps extends PropsWithChildren {
31
32
  theme?: ThemeInput;
32
33
  /** Object containing any classNames for inner components. **/
33
34
  classNames?: DocumentCaptureClassNames;
35
+ /** Object containing any verbiage overrides. */
36
+ verbiage?: DocumentCaptureVerbiage;
34
37
  /** Boolean flag to indicate whether users should be prompted to share their location. Default is `true`. */
35
38
  geolocationEnabled?: boolean;
36
39
  /** Boolean flag to indicate whether users should be blocked from proceeding if they block location access. Default is `false`. */
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
3
+ import { CustomerSuppliedVerbiage } from '../../lib/locales';
3
4
  export type DocumentCaptureScreenClassNames = {
4
5
  container?: string;
5
6
  cameraFeedWrapper?: string;
@@ -17,12 +18,25 @@ export type DocumentCaptureScreenClassNames = {
17
18
  uploadProgressBtn?: string;
18
19
  captureBtn?: string;
19
20
  };
21
+ export type DocumentCaptureScreenVerbiage = {
22
+ headingText?: CustomerSuppliedVerbiage;
23
+ loadingBtnText?: CustomerSuppliedVerbiage;
24
+ retryCameraAccessBtnText?: CustomerSuppliedVerbiage;
25
+ captureBtnText?: CustomerSuppliedVerbiage;
26
+ capturingBtnText?: CustomerSuppliedVerbiage;
27
+ retryCaptureBtnText?: CustomerSuppliedVerbiage;
28
+ uploadBtnText?: CustomerSuppliedVerbiage;
29
+ uploadingBtnText?: CustomerSuppliedVerbiage;
30
+ retryUploadBtnText?: CustomerSuppliedVerbiage;
31
+ successBtnText?: CustomerSuppliedVerbiage;
32
+ };
20
33
  export type DocumentCaptureScreenProps = {
21
34
  aspectRatio?: number;
22
35
  cameraFeedMode?: CameraFeedMode;
23
- classNames?: DocumentCaptureScreenClassNames;
24
36
  instructions?: ReactNode;
25
37
  onCaptureClicked?: () => void;
26
38
  onSuccess?: (blob: Blob) => void;
39
+ classNames?: DocumentCaptureScreenClassNames;
40
+ verbiage?: DocumentCaptureScreenVerbiage;
27
41
  };
28
- export declare const DocumentCaptureScreen: ({ aspectRatio, cameraFeedMode, classNames, instructions, onCaptureClicked, onSuccess, }: DocumentCaptureScreenProps) => React.JSX.Element;
42
+ export declare const DocumentCaptureScreen: ({ aspectRatio, cameraFeedMode, instructions, onCaptureClicked, onSuccess, classNames, verbiage: rawVerbiage, }: DocumentCaptureScreenProps) => React.JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { DocumentCaptureScreenClassNames } from './DocumentCaptureScreen';
2
+ import { DocumentCaptureScreenClassNames, DocumentCaptureScreenVerbiage } from './DocumentCaptureScreen';
3
3
  import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
4
4
  export type DocumentCaptureWizardClassNames = DocumentCaptureScreenClassNames;
5
+ export type DocumentCaptureWizardVerbiage = DocumentCaptureScreenVerbiage;
5
6
  export type DocumentCaptureWizardProps = {
6
7
  onSuccess?: () => void;
7
8
  onExitCapture?: () => void;
@@ -10,5 +11,6 @@ export type DocumentCaptureWizardProps = {
10
11
  cameraFeedMode?: CameraFeedMode;
11
12
  instructions?: ReactNode;
12
13
  classNames?: DocumentCaptureWizardClassNames;
14
+ verbiage?: DocumentCaptureWizardVerbiage;
13
15
  };
14
- export declare const DocumentCaptureWizard: ({ onSuccess, aspectRatio, cameraFeedMode, instructions, classNames, }: DocumentCaptureWizardProps) => React.JSX.Element;
16
+ export declare const DocumentCaptureWizard: ({ onSuccess, aspectRatio, cameraFeedMode, instructions, classNames, verbiage, }: DocumentCaptureWizardProps) => React.JSX.Element;
@@ -56,5 +56,11 @@ declare const _default: {
56
56
  'Network unreachable': string;
57
57
  "We're having trouble reaching our services, please check your connection and try again.": string;
58
58
  "We're sorry, an unexpected error has occurred.": string;
59
+ 'Document Capture': string;
60
+ Capture: string;
61
+ 'Retry capture': string;
62
+ Upload: string;
63
+ 'Uploading...': string;
64
+ 'Upload succeeded!': string;
59
65
  };
60
66
  export default _default;
@@ -64,6 +64,12 @@ export declare const resources: {
64
64
  'Network unreachable': string;
65
65
  "We're having trouble reaching our services, please check your connection and try again.": string;
66
66
  "We're sorry, an unexpected error has occurred.": string;
67
+ 'Document Capture': string;
68
+ Capture: string;
69
+ 'Retry capture': string;
70
+ Upload: string;
71
+ 'Uploading...': string;
72
+ 'Upload succeeded!': string;
67
73
  };
68
74
  };
69
75
  };
@@ -47,7 +47,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
47
47
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
48
48
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
49
49
 
50
- var webSdkVersion = '1.0.150';
50
+ var webSdkVersion = '1.0.152';
51
51
 
52
52
  function getPlatform() {
53
53
  if (typeof window === 'undefined') return;
@@ -9610,7 +9610,13 @@ var esTranslation = {
9610
9610
  'Video signature has been successfully captured!': 'La video firma ha sido exitosa.',
9611
9611
  'Network unreachable': 'No hay conexión a internet.',
9612
9612
  "We're having trouble reaching our services, please check your connection and try again.": "Estamos teniendo problemas para alcanzar nuestros servicios, por favor verificar la conexi\xF3n a internet e intentar de nuevo.",
9613
- "We're sorry, an unexpected error has occurred.": "Lo sentimos, se ha producido un error inesperado."
9613
+ "We're sorry, an unexpected error has occurred.": "Lo sentimos, se ha producido un error inesperado.",
9614
+ 'Document Capture': 'Captura de documento',
9615
+ Capture: 'Capturar',
9616
+ 'Retry capture': 'Reintentar la captura',
9617
+ Upload: 'Adjuntar',
9618
+ 'Uploading...': 'Procesando...',
9619
+ 'Upload succeeded!': 'Proceso completo!'
9614
9620
  };
9615
9621
 
9616
9622
  var resources = {
@@ -13415,6 +13421,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13415
13421
  _g = _a.debugMode,
13416
13422
  debugMode = _g === void 0 ? false : _g;
13417
13423
  var _h = React.useContext(SubmissionContext),
13424
+ submit = _h.submit,
13418
13425
  selfieImage = _h.selfieImage,
13419
13426
  signatureVideoUrl = _h.signatureVideoUrl,
13420
13427
  setSelfieImage = _h.setSelfieImage,
@@ -13491,6 +13498,20 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13491
13498
  onExit();
13492
13499
  }, [onExit, onRetryClicked]);
13493
13500
  var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onComplete);
13501
+ var onDoneClick = React.useCallback(function () {
13502
+ return tslib.__awaiter(void 0, void 0, void 0, function () {
13503
+ return tslib.__generator(this, function (_a) {
13504
+ switch (_a.label) {
13505
+ case 0:
13506
+ return [4 /*yield*/, submit()];
13507
+ case 1:
13508
+ _a.sent();
13509
+ onComplete === null || onComplete === void 0 ? void 0 : onComplete();
13510
+ return [2 /*return*/];
13511
+ }
13512
+ });
13513
+ });
13514
+ }, [onComplete, submit]);
13494
13515
  return /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, {
13495
13516
  throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0
13496
13517
  }, captureState !== 'LOADING' && function () {
@@ -13518,7 +13539,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13518
13539
  if (!showSuccessScreen) return;
13519
13540
  return /*#__PURE__*/React__default['default'].createElement(VideoSignatureSuccess, {
13520
13541
  videoUrl: signatureVideoUrl !== null && signatureVideoUrl !== void 0 ? signatureVideoUrl : '',
13521
- onDoneClick: onComplete,
13542
+ onDoneClick: onDoneClick,
13522
13543
  onRetryClick: onRetry,
13523
13544
  classNames: classNames.success,
13524
13545
  colors: colors.success,
@@ -16986,32 +17007,46 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
16986
17007
  var aspectRatio = _a.aspectRatio,
16987
17008
  _f = _a.cameraFeedMode,
16988
17009
  cameraFeedMode = _f === void 0 ? 'snapToGuides' : _f,
16989
- _g = _a.classNames,
16990
- classNames = _g === void 0 ? {} : _g,
16991
17010
  instructions = _a.instructions,
16992
17011
  onCaptureClicked = _a.onCaptureClicked,
16993
- onSuccess = _a.onSuccess;
16994
- var _h = React.useContext(SubmissionContext),
16995
- submit = _h.submit,
16996
- uploadDocument = _h.uploadDocument;
16997
- var _j = useDocumentCaptureState(),
16998
- _k = _j[0],
16999
- rectX = _k.rectX,
17000
- rectY = _k.rectY,
17001
- rectWidth = _k.rectWidth,
17002
- rectHeight = _k.rectHeight,
17003
- rectOffsetTop = _k.rectOffsetTop,
17004
- capturing = _k.capturing,
17005
- imageUrl = _k.imageUrl,
17006
- imageBlob = _k.imageBlob,
17007
- uploadState = _k.uploadState,
17008
- dispatch = _j[1];
17009
- var _l = React.useContext(CameraStateContext),
17010
- cameraReady = _l.cameraReady,
17011
- cameraAccessDenied = _l.cameraAccessDenied,
17012
- retryCameraAccess = _l.retryCameraAccess;
17012
+ onSuccess = _a.onSuccess,
17013
+ _g = _a.classNames,
17014
+ classNames = _g === void 0 ? {} : _g,
17015
+ _h = _a.verbiage,
17016
+ rawVerbiage = _h === void 0 ? {} : _h;
17017
+ var _j = React.useContext(SubmissionContext),
17018
+ submit = _j.submit,
17019
+ uploadDocument = _j.uploadDocument;
17020
+ var _k = useDocumentCaptureState(),
17021
+ _l = _k[0],
17022
+ rectX = _l.rectX,
17023
+ rectY = _l.rectY,
17024
+ rectWidth = _l.rectWidth,
17025
+ rectHeight = _l.rectHeight,
17026
+ rectOffsetTop = _l.rectOffsetTop,
17027
+ capturing = _l.capturing,
17028
+ imageUrl = _l.imageUrl,
17029
+ imageBlob = _l.imageBlob,
17030
+ uploadState = _l.uploadState,
17031
+ dispatch = _k[1];
17032
+ var _m = React.useContext(CameraStateContext),
17033
+ cameraReady = _m.cameraReady,
17034
+ cameraAccessDenied = _m.cameraAccessDenied,
17035
+ retryCameraAccess = _m.retryCameraAccess;
17013
17036
  var theme = styled.useTheme();
17014
17037
  var maskColor = (_d = (_c = (_b = theme.documentCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.maskColor) !== null && _d !== void 0 ? _d : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
17038
+ var verbiage = useTranslations(rawVerbiage, {
17039
+ headingText: 'Document Capture',
17040
+ loadingBtnText: 'Camera initializing...',
17041
+ retryCameraAccessBtnText: 'Retry',
17042
+ captureBtnText: 'Capture',
17043
+ capturingBtnText: 'Capturing...',
17044
+ retryCaptureBtnText: 'Retry capture',
17045
+ uploadBtnText: 'Upload',
17046
+ uploadingBtnText: 'Uploading...',
17047
+ retryUploadBtnText: 'Retry',
17048
+ successBtnText: 'Upload succeeded!'
17049
+ });
17015
17050
  function onCaptureClick() {
17016
17051
  dispatch({
17017
17052
  type: 'captureRequested'
@@ -17072,7 +17107,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
17072
17107
  className: classNames.headingRow
17073
17108
  }, /*#__PURE__*/React__default['default'].createElement(Heading, {
17074
17109
  className: classNames.heading
17075
- }, "Comprobante de domicilio")), /*#__PURE__*/React__default['default'].createElement(DocumentCaptureGuideOverlay, {
17110
+ }, verbiage.headingText)), /*#__PURE__*/React__default['default'].createElement(DocumentCaptureGuideOverlay, {
17076
17111
  aspectRatio: aspectRatio,
17077
17112
  classNames: classNames,
17078
17113
  maskColor: maskColor
@@ -17088,7 +17123,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
17088
17123
  variant: "negative",
17089
17124
  finished: true,
17090
17125
  onClick: retryCameraAccess
17091
- }, "Retry camera access")) : imageUrl ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, uploadState === 'not_started' ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17126
+ }, verbiage.retryCameraAccessBtnText)) : imageUrl ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, uploadState === 'not_started' ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17092
17127
  className: classNames.retryCaptureBtn,
17093
17128
  finished: true,
17094
17129
  variant: "warning",
@@ -17097,23 +17132,24 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
17097
17132
  type: 'retryCapture'
17098
17133
  });
17099
17134
  }
17100
- }, "Retry Capture"), /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17135
+ }, verbiage.retryCaptureBtnText), /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17101
17136
  className: classNames.uploadBtn,
17102
17137
  finished: true,
17103
17138
  variant: "positive",
17104
17139
  onClick: onSubmitClick
17105
- }, "Upload"))) : ( /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17140
+ }, verbiage.uploadBtnText))) : ( /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17106
17141
  className: classNames.uploadProgressBtn,
17107
17142
  finished: uploadState !== 'in_progress',
17108
17143
  variant: uploadState === 'failed' ? 'negative' : 'positive',
17109
- onClick: onSubmitClick
17110
- }, uploadState === 'succeeded' ? 'Upload Succeeded!' : uploadState === 'failed' ? 'Retry Upload' : 'Uploading...')))) : ( /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17144
+ onClick: onSubmitClick,
17145
+ disabled: ['in_progress', 'succeeded'].includes(uploadState)
17146
+ }, uploadState === 'succeeded' ? verbiage.successBtnText : uploadState === 'failed' ? verbiage.retryUploadBtnText : verbiage.uploadingBtnText)))) : ( /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
17111
17147
  className: classNames.captureBtn,
17112
17148
  finished: cameraReady,
17113
17149
  variant: "primary",
17114
17150
  onClick: onCaptureClick,
17115
17151
  disabled: !cameraReady || capturing
17116
- }, !cameraReady ? 'Preparing...' : capturing ? 'Capturing...' : 'Capture'))))));
17152
+ }, !cameraReady ? verbiage.loadingBtnText : capturing ? verbiage.capturingBtnText : verbiage.captureBtnText))))));
17117
17153
  };
17118
17154
  var CaptureContainer = styled__default['default'].div(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"], ["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"])));
17119
17155
  var HeadingRow = styled__default['default'].div(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n background: ", ";\n text-align: center;\n color: white;\n"], ["\n background: ", ";\n text-align: center;\n color: white;\n"])), function (props) {
@@ -17137,13 +17173,16 @@ var DocumentCaptureWizard = function DocumentCaptureWizard(_a) {
17137
17173
  cameraFeedMode = _a.cameraFeedMode,
17138
17174
  instructions = _a.instructions,
17139
17175
  _b = _a.classNames,
17140
- classNames = _b === void 0 ? {} : _b;
17176
+ classNames = _b === void 0 ? {} : _b,
17177
+ _c = _a.verbiage,
17178
+ verbiage = _c === void 0 ? {} : _c;
17141
17179
  return /*#__PURE__*/React__default['default'].createElement(DocumentCaptureStateProvider, null, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureScreen, {
17142
17180
  aspectRatio: aspectRatio,
17143
17181
  cameraFeedMode: cameraFeedMode,
17144
- classNames: classNames,
17145
17182
  instructions: instructions,
17146
- onSuccess: onSuccess
17183
+ onSuccess: onSuccess,
17184
+ classNames: classNames,
17185
+ verbiage: verbiage
17147
17186
  }));
17148
17187
  };
17149
17188
 
@@ -17168,10 +17207,12 @@ var DocumentCapture = function DocumentCapture(_a) {
17168
17207
  theme = _c === void 0 ? 'default' : _c,
17169
17208
  _d = _a.classNames,
17170
17209
  classNames = _d === void 0 ? {} : _d,
17171
- _e = _a.geolocationEnabled,
17172
- geolocationEnabled = _e === void 0 ? true : _e,
17173
- _f = _a.geolocationRequired,
17174
- geolocationRequired = _f === void 0 ? false : _f;
17210
+ _e = _a.verbiage,
17211
+ verbiage = _e === void 0 ? {} : _e,
17212
+ _f = _a.geolocationEnabled,
17213
+ geolocationEnabled = _f === void 0 ? true : _f,
17214
+ _g = _a.geolocationRequired,
17215
+ geolocationRequired = _g === void 0 ? false : _g;
17175
17216
  useLanguage(lang);
17176
17217
  return /*#__PURE__*/React__default['default'].createElement(ThemeProvider, {
17177
17218
  theme: theme
@@ -17192,8 +17233,9 @@ var DocumentCapture = function DocumentCapture(_a) {
17192
17233
  onUserCancel: onUserCancel,
17193
17234
  aspectRatio: aspectRatio,
17194
17235
  cameraFeedMode: cameraFeedMode,
17236
+ instructions: instructions,
17195
17237
  classNames: classNames,
17196
- instructions: instructions
17238
+ verbiage: verbiage
17197
17239
  }))));
17198
17240
  };
17199
17241