idmission-web-sdk 0.0.50 → 0.0.52

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/README.md CHANGED
@@ -90,14 +90,8 @@ Render a fullscreen ID capture component that instructs the user to photograph b
90
90
 
91
91
  **ID Capture Colors**
92
92
  <table>
93
- <tr><td><code>loadingContinueBtnBackgroundColor</code></td><td>Default: mint</td></tr>
94
- <tr><td><code>loadingContinueBtnTextColor</code></td><td>Default: white</td></tr>
95
93
  <tr><td><code>guideBoxUnsatisfiedColor</code></td><td>Default: white</td></tr>
96
94
  <tr><td><code>guideBoxSatisfiedColor</code></td><td>Default: green</td></tr>
97
- <tr><td><code>successDoneBtnBackgroundColor</code></td><td>Default: mint</td></tr>
98
- <tr><td><code>successDoneBtnTextColor</code></td><td>Default: white</td></tr>
99
- <tr><td><code>successRetryBtnBackgroundColor</code></td><td>Default: orange</td></tr>
100
- <tr><td><code>successRetryBtnTextColor</code></td><td>Default: white</td></tr>
101
95
  </table>
102
96
 
103
97
  **ID Capture Verbiage**
@@ -184,22 +178,12 @@ Render a fullscreen capture component that analyzes frames from the user's front
184
178
  **Face Liveness Colors**
185
179
 
186
180
  <table>
187
- <tr><td><code>loadingContinueBtnBackgroundColor</code></td><td>Default: mint</td></tr>
188
- <tr><td><code>loadingContinueBtnTextColor</code></td><td>Default: white</td></tr>
189
181
  <tr><td><code>guidesUnsatisfiedColor</code></td><td>Default: white</td></tr>
190
182
  <tr><td><code>guidesSatisfiedColor</code></td><td>Default: green</td></tr>
191
183
  <tr><td><code>guidanceMessagesSatisfiedBackgroundColor</code></td><td>Default: green</td></tr>
192
184
  <tr><td><code>guidanceMessagesUnsatisfiedBackgroundColor</code></td><td>Default: red</td></tr>
193
185
  <tr><td><code>guidanceMessagesSatisfiedTextColor</code></td><td>Default: white</td></tr>
194
186
  <tr><td><code>guidanceMessagesUnsatisfiedTextColor</code></td><td>Default: white</td></tr>
195
- <tr><td><code>successDoneBtnBackgroundColor</code></td><td>Default: mint</td></tr>
196
- <tr><td><code>successDoneBtnTextColor</code></td><td>Default: white</td></tr>
197
- <tr><td><code>successRetryBtnBackgroundColor</code></td><td>Default: orange</td></tr>
198
- <tr><td><code>successRetryBtnTextColor</code></td><td>Default: white</td></tr>
199
- <tr><td><code>failureRetryBtnBackgroundColor</code></td><td>Default: orange</td></tr>
200
- <tr><td><code>failureRetryBtnTextColor</code></td><td>Default: white</td></tr>
201
- <tr><td><code>failureExitBtnBackgroundColor</code></td><td>Default: darkgray</td></tr>
202
- <tr><td><code>failureExitBtnTextColor</code></td><td>Default: white</td></tr>
203
187
  </table>
204
188
 
205
189
  **Face Liveness Verbiage**
@@ -470,22 +454,12 @@ Render a fullscreen capture component that analyzes frames from the user's front
470
454
  **Customer Identification Colors**
471
455
 
472
456
  <table>
473
- <tr><td><code>loadingContinueBtnBackgroundColor</code></td><td>Default: mint</td></tr>
474
- <tr><td><code>loadingContinueBtnTextColor</code></td><td>Default: white</td></tr>
475
457
  <tr><td><code>guidesUnsatisfiedColor</code></td><td>Default: white</td></tr>
476
458
  <tr><td><code>guidesSatisfiedColor</code></td><td>Default: green</td></tr>
477
459
  <tr><td><code>guidanceMessagesSatisfiedBackgroundColor</code></td><td>Default: green</td></tr>
478
460
  <tr><td><code>guidanceMessagesUnsatisfiedBackgroundColor</code></td><td>Default: red</td></tr>
479
461
  <tr><td><code>guidanceMessagesSatisfiedTextColor</code></td><td>Default: white</td></tr>
480
462
  <tr><td><code>guidanceMessagesUnsatisfiedTextColor</code></td><td>Default: white</td></tr>
481
- <tr><td><code>successDoneBtnBackgroundColor</code></td><td>Default: mint</td></tr>
482
- <tr><td><code>successDoneBtnTextColor</code></td><td>Default: white</td></tr>
483
- <tr><td><code>successRetryBtnBackgroundColor</code></td><td>Default: orange</td></tr>
484
- <tr><td><code>successRetryBtnTextColor</code></td><td>Default: white</td></tr>
485
- <tr><td><code>failureRetryBtnBackgroundColor</code></td><td>Default: orange</td></tr>
486
- <tr><td><code>failureRetryBtnTextColor</code></td><td>Default: white</td></tr>
487
- <tr><td><code>failureExitBtnBackgroundColor</code></td><td>Default: darkgray</td></tr>
488
- <tr><td><code>failureExitBtnTextColor</code></td><td>Default: white</td></tr>
489
463
  </table>
490
464
 
491
465
  **Customer Identification Verbiage**
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const SelfieProgressPreview: ({ imageUrl }: {
3
+ imageUrl: string;
4
+ }) => JSX.Element;
@@ -17,6 +17,3 @@ export type FaceLivenessCaptureProps = {
17
17
  debugMode?: boolean;
18
18
  };
19
19
  export declare const FaceLivenessCapture: ({ onCapture, onSuccess, onTimeout, onExit, timeoutDurationMs, colors, verbiage, debugMode, }: FaceLivenessCaptureProps) => ReactElement;
20
- export declare const SelfieProgressPreview: ({ imageUrl }: {
21
- imageUrl: string;
22
- }) => JSX.Element;
@@ -6,11 +6,8 @@ export type IdCaptureLoadingOverlayProps = {
6
6
  cameraInitializingText?: string;
7
7
  cameraAccessBlockedText?: string;
8
8
  continueText?: string;
9
- continueBtnDisabledBackgroundColor?: string;
10
- continueBtnBackgroundColor?: string;
11
- continueBtnTextColor?: string;
12
9
  instructionImageUrl?: string;
13
10
  accessBlockedImageUrl?: string;
14
11
  onDismissed?: () => void;
15
12
  };
16
- export declare const IdCaptureLoadingOverlay: ({ headingText, useContinuityCameraText, modelsWarmingUpText, cameraInitializingText, cameraAccessBlockedText, continueText, continueBtnDisabledBackgroundColor, continueBtnBackgroundColor, continueBtnTextColor, instructionImageUrl, accessBlockedImageUrl, onDismissed, }: IdCaptureLoadingOverlayProps) => ReactElement;
13
+ export declare const IdCaptureLoadingOverlay: ({ headingText, useContinuityCameraText, modelsWarmingUpText, cameraInitializingText, cameraAccessBlockedText, continueText, instructionImageUrl, accessBlockedImageUrl, onDismissed, }: IdCaptureLoadingOverlayProps) => ReactElement;
@@ -1,4 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
+ import { IdCaptureColors } from './IdCapture';
2
3
  export type IdCaptureAssets = {
3
4
  documentDetectionModelUrl?: string;
4
5
  focusModelUrl?: string;
@@ -10,16 +11,6 @@ export type IdCaptureAssets = {
10
11
  passportPortraitGuidesImageUrl?: string;
11
12
  passportLandscapeGuidesImageUrl?: string;
12
13
  };
13
- export type IdCaptureColors = {
14
- loadingContinueBtnBackgroundColor?: string;
15
- loadingContinueBtnTextColor?: string;
16
- guideBoxUnsatisfiedColor?: string;
17
- guideBoxSatisfiedColor?: string;
18
- successDoneBtnBackgroundColor?: string;
19
- successDoneBtnTextColor?: string;
20
- successRetryBtnBackgroundColor?: string;
21
- successRetryBtnTextColor?: string;
22
- };
23
14
  export type IdCaptureVerbiage = {
24
15
  loadingOverlayHeadingText?: string;
25
16
  loadingOverlayUseContinuityCameraText?: string;
@@ -0,0 +1,4 @@
1
+ export declare const useTimeout: (durationMs?: number, onTimeout?: () => void, timeoutAverted?: boolean, shouldWaitLonger?: boolean) => {
2
+ timedOut: boolean;
3
+ timeoutStartedAt: Date | null | undefined;
4
+ };
@@ -8855,9 +8855,6 @@ var IdCaptureLoadingOverlay = function IdCaptureLoadingOverlay(_a) {
8855
8855
  cameraInitializingText = _a.cameraInitializingText,
8856
8856
  cameraAccessBlockedText = _a.cameraAccessBlockedText,
8857
8857
  continueText = _a.continueText,
8858
- continueBtnDisabledBackgroundColor = _a.continueBtnDisabledBackgroundColor,
8859
- continueBtnBackgroundColor = _a.continueBtnBackgroundColor,
8860
- continueBtnTextColor = _a.continueBtnTextColor,
8861
8858
  _b = _a.instructionImageUrl,
8862
8859
  instructionImageUrl = _b === void 0 ? DEFAULT_CDN_URL + '/WebSDK-Instruction-DL-Capture-3-Portrait.png' : _b,
8863
8860
  _c = _a.accessBlockedImageUrl,
@@ -8875,15 +8872,6 @@ var IdCaptureLoadingOverlay = function IdCaptureLoadingOverlay(_a) {
8875
8872
  var _e = React.useState(false),
8876
8873
  dismissed = _e[0],
8877
8874
  setDismissed = _e[1];
8878
- headingText || (headingText = t('Use your device camera to capture your ID'));
8879
- useContinuityCameraText || (useContinuityCameraText = t('Use your iPhone as a webcam'));
8880
- modelsWarmingUpText || (modelsWarmingUpText = t('Models warming up...'));
8881
- cameraInitializingText || (cameraInitializingText = t('Camera initializing...'));
8882
- cameraAccessBlockedText || (cameraAccessBlockedText = t('Camera access blocked'));
8883
- continueText || (continueText = t('Continue'));
8884
- continueBtnDisabledBackgroundColor || (continueBtnDisabledBackgroundColor = 'gray');
8885
- continueBtnBackgroundColor || (continueBtnBackgroundColor = 'mint');
8886
- continueBtnTextColor || (continueBtnTextColor = 'white');
8887
8875
  React.useEffect(function () {
8888
8876
  if (!buttonRef.current) return;
8889
8877
  laddaRef.current = Ladda__namespace.create(buttonRef.current);
@@ -8922,6 +8910,12 @@ var IdCaptureLoadingOverlay = function IdCaptureLoadingOverlay(_a) {
8922
8910
  accessBlockedImageUrl: accessBlockedImageUrl
8923
8911
  });
8924
8912
  }
8913
+ headingText = headingText || t('Use your device camera to capture your ID');
8914
+ useContinuityCameraText = useContinuityCameraText || t('Use your iPhone as a webcam');
8915
+ modelsWarmingUpText = modelsWarmingUpText || t('Models warming up...');
8916
+ cameraInitializingText = cameraInitializingText || t('Camera initializing...');
8917
+ cameraAccessBlockedText = cameraAccessBlockedText || t('Camera access blocked');
8918
+ continueText = continueText || t('Continue');
8925
8919
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner, null, /*#__PURE__*/React__default['default'].createElement("h3", null, headingText), /*#__PURE__*/React__default['default'].createElement(OverlayImageWrapper, {
8926
8920
  style: {
8927
8921
  pointerEvents: 'none'
@@ -8945,14 +8939,11 @@ var IdCaptureLoadingOverlay = function IdCaptureLoadingOverlay(_a) {
8945
8939
  }), /*#__PURE__*/React__default['default'].createElement("label", {
8946
8940
  htmlFor: "use-continuity-camera"
8947
8941
  }, useContinuityCameraText))), /*#__PURE__*/React__default['default'].createElement("button", {
8948
- ref: buttonRef,
8949
8942
  className: "ladda-button",
8950
8943
  "data-style": "expand-right",
8944
+ "data-color": "mint",
8951
8945
  disabled: !cameraReady || !modelsReady,
8952
- style: {
8953
- color: continueBtnTextColor,
8954
- backgroundColor: !cameraReady || !modelsReady ? continueBtnDisabledBackgroundColor : continueBtnBackgroundColor
8955
- },
8946
+ ref: buttonRef,
8956
8947
  onClick: function onClick() {
8957
8948
  setDismissed(true);
8958
8949
  onDismissed === null || onDismissed === void 0 ? void 0 : onDismissed();
@@ -9636,8 +9627,6 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
9636
9627
  cameraInitializingText: verbiage.loadingOverlayCameraInitializingText,
9637
9628
  cameraAccessBlockedText: verbiage.loadingOverlayCameraAccessBlockedText,
9638
9629
  continueText: verbiage.loadingOverlayContinueText,
9639
- continueBtnBackgroundColor: colors.loadingContinueBtnBackgroundColor,
9640
- continueBtnTextColor: colors.loadingContinueBtnTextColor,
9641
9630
  instructionImageUrl: assets.loadingOverlayInstructionImageUrl,
9642
9631
  onDismissed: function onDismissed() {
9643
9632
  setOverlayDismissed(true);
@@ -9945,6 +9934,42 @@ var GuidanceMessage = styled__default['default'].div(templateObject_2$2 || (temp
9945
9934
  });
9946
9935
  var templateObject_1$4, templateObject_2$2;
9947
9936
 
9937
+ var useTimeout = function useTimeout(durationMs, onTimeout, timeoutAverted, shouldWaitLonger) {
9938
+ var _a = React.useState(false),
9939
+ timedOut = _a[0],
9940
+ setTimedOut = _a[1];
9941
+ var _b = React.useState(),
9942
+ timeoutStartedAt = _b[0],
9943
+ setTimeoutStartedAt = _b[1];
9944
+ React.useEffect(function () {
9945
+ if (!durationMs) return;
9946
+ setTimeoutStartedAt(new Date());
9947
+ var timer = setTimeout(function () {
9948
+ setTimedOut(true);
9949
+ }, durationMs);
9950
+ return function () {
9951
+ if (timer) clearTimeout(timer);
9952
+ };
9953
+ }, [durationMs]);
9954
+ React.useEffect(function () {
9955
+ if (!timedOut || timeoutAverted) return;
9956
+ if (!shouldWaitLonger) {
9957
+ onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
9958
+ return;
9959
+ }
9960
+ var t = setTimeout(function () {
9961
+ onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
9962
+ }, 10000);
9963
+ return function () {
9964
+ clearTimeout(t);
9965
+ };
9966
+ }, [onTimeout, shouldWaitLonger, timedOut, timeoutAverted]);
9967
+ return {
9968
+ timedOut: timedOut,
9969
+ timeoutStartedAt: timeoutStartedAt
9970
+ };
9971
+ };
9972
+
9948
9973
  var initialState$3 = {
9949
9974
  videoWidth: 0,
9950
9975
  videoHeight: 0,
@@ -10136,25 +10161,9 @@ var SelfieCapture = function SelfieCapture(_a) {
10136
10161
  });
10137
10162
  })();
10138
10163
  }, [captureReady, onSelfieCaptured, state.faces, takePhoto]);
10139
- var _p = React.useState(),
10140
- timeoutStartedAt = _p[0],
10141
- setTimeoutStartedAt = _p[1];
10142
- var _q = React.useState(false),
10143
- timedOut = _q[0],
10144
- setTimedOut = _q[1];
10145
- React.useEffect(function () {
10146
- if (!timeoutDurationMs) return;
10147
- setTimeoutStartedAt(new Date());
10148
- var timer = setTimeout(function () {
10149
- setTimedOut(true);
10150
- }, timeoutDurationMs);
10151
- return function () {
10152
- if (timer) clearTimeout(timer);
10153
- };
10154
- }, [timeoutDurationMs]);
10155
- React.useEffect(function () {
10156
- if (timedOut) onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
10157
- }, [onTimeout, timedOut]);
10164
+ var _p = useTimeout(timeoutDurationMs, onTimeout),
10165
+ timedOut = _p.timedOut,
10166
+ timeoutStartedAt = _p.timeoutStartedAt;
10158
10167
  var debugScalingDetails = useDebugScalingDetails({
10159
10168
  enabled: debugMode,
10160
10169
  pageWidth: width,
@@ -10227,6 +10236,28 @@ var Spinner = styled__default['default'].div(templateObject_1$3 || (templateObje
10227
10236
  });
10228
10237
  var templateObject_1$3;
10229
10238
 
10239
+ var SelfieProgressPreview = function SelfieProgressPreview(_a) {
10240
+ var imageUrl = _a.imageUrl;
10241
+ return /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreviewWrapper, null, /*#__PURE__*/React__default['default'].createElement(SelfieProgressText, null, /*#__PURE__*/React__default['default'].createElement(Spinner, {
10242
+ "$size": 24,
10243
+ "$color": "white",
10244
+ "$thickness": 3,
10245
+ style: {
10246
+ position: 'relative',
10247
+ top: 4,
10248
+ left: -3,
10249
+ margin: '0 3px 0 -12px'
10250
+ }
10251
+ }), "Processing..."), /*#__PURE__*/React__default['default'].createElement(SelfiePreviewImageWrapper, null, /*#__PURE__*/React__default['default'].createElement("img", {
10252
+ src: imageUrl,
10253
+ alt: ""
10254
+ })));
10255
+ };
10256
+ var SelfieProgressPreviewWrapper = styled__default['default'].div(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
10257
+ var SelfieProgressText = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
10258
+ var SelfiePreviewImageWrapper = styled__default['default'].div(templateObject_3$1 || (templateObject_3$1 = tslib.__makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
10259
+ var templateObject_1$2, templateObject_2$1, templateObject_3$1;
10260
+
10230
10261
  var initialState$2 = {
10231
10262
  frame: null,
10232
10263
  face: null,
@@ -10396,31 +10427,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
10396
10427
  onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
10397
10428
  }
10398
10429
  }, [onTimeout, state.timesLivenessCheckFailed]);
10399
- var _g = React.useState(false),
10400
- timedOut = _g[0],
10401
- setTimedOut = _g[1];
10402
- React.useEffect(function () {
10403
- if (!timeoutDurationMs) return;
10404
- var timer = setTimeout(function () {
10405
- setTimedOut(true);
10406
- }, timeoutDurationMs);
10407
- return function () {
10408
- if (timer) clearTimeout(timer);
10409
- };
10410
- }, [timeoutDurationMs]);
10411
- React.useEffect(function () {
10412
- if (!timedOut || state.requestState === 'PASSED') return;
10413
- if (state.requestState !== 'IN_PROGRESS') {
10414
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
10415
- return;
10416
- }
10417
- var t = setTimeout(function () {
10418
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
10419
- }, 10000);
10420
- return function () {
10421
- clearTimeout(t);
10422
- };
10423
- }, [onTimeout, state.requestState, timedOut]);
10430
+ useTimeout(timeoutDurationMs, onTimeout, state.requestState === 'PASSED', state.requestState === 'IN_PROGRESS');
10424
10431
  verbiage.guidanceRemoveEyeCoveringsText || (verbiage.guidanceRemoveEyeCoveringsText = t('Please remove your eye coverings (sunglasses, eye patch, etc.)...'));
10425
10432
  verbiage.guidanceRemoveHeadCoveringsText || (verbiage.guidanceRemoveHeadCoveringsText = t('Please remove your head coverings (hat, scarf, etc.)...'));
10426
10433
  verbiage.guidanceRemoveMaskText || (verbiage.guidanceRemoveMaskText = t('Please remove your mask...'));
@@ -10437,27 +10444,6 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
10437
10444
  imageUrl: imageUrl
10438
10445
  }));
10439
10446
  };
10440
- var SelfieProgressPreview = function SelfieProgressPreview(_a) {
10441
- var imageUrl = _a.imageUrl;
10442
- return /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreviewWrapper, null, /*#__PURE__*/React__default['default'].createElement(SelfieProgressText, null, /*#__PURE__*/React__default['default'].createElement(Spinner, {
10443
- "$size": 24,
10444
- "$color": "white",
10445
- "$thickness": 3,
10446
- style: {
10447
- position: 'relative',
10448
- top: 4,
10449
- left: -3,
10450
- margin: '0 3px 0 -12px'
10451
- }
10452
- }), "Processing..."), /*#__PURE__*/React__default['default'].createElement(SelfiePreviewImageWrapper, null, /*#__PURE__*/React__default['default'].createElement("img", {
10453
- src: imageUrl,
10454
- alt: ""
10455
- })));
10456
- };
10457
- var SelfieProgressPreviewWrapper = styled__default['default'].div(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
10458
- var SelfieProgressText = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
10459
- var SelfiePreviewImageWrapper = styled__default['default'].div(templateObject_3$1 || (templateObject_3$1 = tslib.__makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
10460
- var templateObject_1$2, templateObject_2$1, templateObject_3$1;
10461
10447
 
10462
10448
  var SelfieCaptureLoadingOverlay = function SelfieCaptureLoadingOverlay(_a) {
10463
10449
  var headingText = _a.headingText,
@@ -12669,6 +12655,9 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12669
12655
  submissionResponse = _f.submissionResponse,
12670
12656
  selfieImage = _f.selfieImage,
12671
12657
  setSelfieImage = _f.setSelfieImage;
12658
+ var _g = React.useState(null),
12659
+ imageUrl = _g[0],
12660
+ setImageUrl = _g[1];
12672
12661
  var onSelfieCaptured = React.useCallback(function (frame, face) {
12673
12662
  dispatch({
12674
12663
  type: 'verificationReady',
@@ -12681,8 +12670,9 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12681
12670
  var isReady = state.requestState === 'READY';
12682
12671
  React.useEffect(function () {
12683
12672
  if (!frame || !face) return;
12684
- dataUrlToBase64(cropToShoulders(frame, face)).then(function (img) {
12685
- console.log('setting selfie image', img);
12673
+ var imageUrl = cropToShoulders(frame, face);
12674
+ setImageUrl(imageUrl);
12675
+ dataUrlToBase64(imageUrl).then(function (img) {
12686
12676
  setSelfieImage(img);
12687
12677
  });
12688
12678
  }, [face, frame, setSelfieImage]);
@@ -12736,15 +12726,17 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12736
12726
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
12737
12727
  }
12738
12728
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
12739
- return /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
12729
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
12730
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
12740
12731
  onSelfieCaptured: onSelfieCaptured,
12741
- onTimeout: onCaptureGuidanceTimeout,
12742
12732
  onExit: onExit,
12743
12733
  timeoutDurationMs: captureGuidanceTimeoutDurationMs,
12744
12734
  colors: colors,
12745
12735
  verbiage: verbiage,
12746
12736
  debugMode: debugMode
12747
- });
12737
+ }), imageUrl && /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreview, {
12738
+ imageUrl: imageUrl
12739
+ }));
12748
12740
  };
12749
12741
 
12750
12742
  var CustomerVerificationSuccess = function CustomerVerificationSuccess(_a) {
@@ -12861,7 +12853,6 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12861
12853
  var _f = React.useContext(SubmissionContext),
12862
12854
  submissionResponse = _f.submissionResponse,
12863
12855
  selfieImage = _f.selfieImage;
12864
- var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
12865
12856
  var _g = React.useState('LOADING'),
12866
12857
  captureState = _g[0],
12867
12858
  setCaptureState = _g[1];
@@ -12869,33 +12860,24 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12869
12860
  return tslib.__awaiter(void 0, void 0, void 0, function () {
12870
12861
  return tslib.__generator(this, function (_a) {
12871
12862
  setCaptureState('MATCHED');
12872
- releaseCameraAccess();
12873
- setTimeout(function () {
12874
- onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
12875
- }, 0);
12863
+ onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
12876
12864
  return [2];
12877
12865
  });
12878
12866
  });
12879
- }, [onCustomerMatched, releaseCameraAccess]);
12867
+ }, [onCustomerMatched]);
12880
12868
  var onCustomerNotMatchedCallback = React.useCallback(function (response) {
12881
12869
  return tslib.__awaiter(void 0, void 0, void 0, function () {
12882
12870
  return tslib.__generator(this, function (_a) {
12883
12871
  setCaptureState('NOT_MATCHED');
12884
- releaseCameraAccess();
12885
- setTimeout(function () {
12886
- onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
12887
- }, 0);
12872
+ onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
12888
12873
  return [2];
12889
12874
  });
12890
12875
  });
12891
- }, [onCustomerNotMatched, releaseCameraAccess]);
12876
+ }, [onCustomerNotMatched]);
12892
12877
  var onCaptureGuidanceTimeoutCallback = React.useCallback(function () {
12893
12878
  setCaptureState('FAILED');
12894
- releaseCameraAccess();
12895
- setTimeout(function () {
12896
- onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
12897
- }, 0);
12898
- }, [onCaptureGuidanceTimeout, releaseCameraAccess]);
12879
+ onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
12880
+ }, [onCaptureGuidanceTimeout]);
12899
12881
  var _h = React.useState(0),
12900
12882
  attempt = _h[0],
12901
12883
  setAttempt = _h[1];
@@ -13000,9 +12982,9 @@ var CustomerVerification = function CustomerVerification(_a) {
13000
12982
  onBeforeSubmit: onBeforeSubmit,
13001
12983
  geolocationEnabled: geolocationEnabled,
13002
12984
  geolocationRequired: geolocationRequired
13003
- }, /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, null, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
12985
+ }, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
13004
12986
  preferFrontFacingCamera: true
13005
- }, /*#__PURE__*/React__default['default'].createElement(CustomerVerificationWizard, {
12987
+ }, /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, null, /*#__PURE__*/React__default['default'].createElement(CustomerVerificationWizard, {
13006
12988
  onComplete: onComplete,
13007
12989
  onCustomerMatched: onCustomerMatched,
13008
12990
  onCustomerNotMatched: onCustomerNotMatched,
@@ -13102,6 +13084,9 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13102
13084
  submissionResponse = _f.submissionResponse,
13103
13085
  selfieImage = _f.selfieImage,
13104
13086
  setSelfieImage = _f.setSelfieImage;
13087
+ var _g = React.useState(null),
13088
+ imageUrl = _g[0],
13089
+ setImageUrl = _g[1];
13105
13090
  var onSelfieCaptured = React.useCallback(function (frame, face) {
13106
13091
  dispatch({
13107
13092
  type: 'identificationReady',
@@ -13116,8 +13101,9 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13116
13101
  var isReady = state.requestState === 'READY';
13117
13102
  React.useEffect(function () {
13118
13103
  if (!frame || !face) return;
13119
- dataUrlToBase64(cropToShoulders(frame, face)).then(function (img) {
13120
- console.log('setting selfie image', img);
13104
+ var imageUrl = cropToShoulders(frame, face);
13105
+ setImageUrl(imageUrl);
13106
+ dataUrlToBase64(imageUrl).then(function (img) {
13121
13107
  setSelfieImage(img);
13122
13108
  });
13123
13109
  }, [face, frame, setSelfieImage]);
@@ -13171,15 +13157,17 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13171
13157
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
13172
13158
  }
13173
13159
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
13174
- return /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
13160
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
13161
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
13175
13162
  onSelfieCaptured: onSelfieCaptured,
13176
- onTimeout: onCaptureGuidanceTimeout,
13177
13163
  onExit: onExit,
13178
13164
  timeoutDurationMs: captureGuidanceTimeoutDurationMs,
13179
13165
  colors: colors,
13180
13166
  verbiage: verbiage,
13181
13167
  debugMode: debugMode
13182
- });
13168
+ }), imageUrl && /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreview, {
13169
+ imageUrl: imageUrl
13170
+ }));
13183
13171
  };
13184
13172
 
13185
13173
  var CustomerIdentificationSuccess = function CustomerIdentificationSuccess(_a) {
@@ -13296,7 +13284,6 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13296
13284
  var _f = React.useContext(SubmissionContext),
13297
13285
  submissionResponse = _f.submissionResponse,
13298
13286
  selfieImage = _f.selfieImage;
13299
- var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
13300
13287
  var _g = React.useState('LOADING'),
13301
13288
  captureState = _g[0],
13302
13289
  setCaptureState = _g[1];
@@ -13304,33 +13291,24 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13304
13291
  return tslib.__awaiter(void 0, void 0, void 0, function () {
13305
13292
  return tslib.__generator(this, function (_a) {
13306
13293
  setCaptureState('FOUND');
13307
- releaseCameraAccess();
13308
- setTimeout(function () {
13309
- onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
13310
- }, 0);
13294
+ onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
13311
13295
  return [2];
13312
13296
  });
13313
13297
  });
13314
- }, [onCustomerMatched, releaseCameraAccess]);
13298
+ }, [onCustomerMatched]);
13315
13299
  var onCustomerNotMatchedCallback = React.useCallback(function (response) {
13316
13300
  return tslib.__awaiter(void 0, void 0, void 0, function () {
13317
13301
  return tslib.__generator(this, function (_a) {
13318
13302
  setCaptureState('NOT_FOUND');
13319
- releaseCameraAccess();
13320
- setTimeout(function () {
13321
- onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
13322
- }, 0);
13303
+ onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
13323
13304
  return [2];
13324
13305
  });
13325
13306
  });
13326
- }, [onCustomerNotMatched, releaseCameraAccess]);
13307
+ }, [onCustomerNotMatched]);
13327
13308
  var onCaptureGuidanceTimeoutCallback = React.useCallback(function () {
13328
13309
  setCaptureState('FAILED');
13329
- releaseCameraAccess();
13330
- setTimeout(function () {
13331
- onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
13332
- }, 0);
13333
- }, [onCaptureGuidanceTimeout, releaseCameraAccess]);
13310
+ onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
13311
+ }, [onCaptureGuidanceTimeout]);
13334
13312
  var _h = React.useState(0),
13335
13313
  attempt = _h[0],
13336
13314
  setAttempt = _h[1];