@idmission/websdk-ui 0.2.0-rc.2 → 0.5.0
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 +168 -56
- package/dist/DocumentCaptureView.d.ts +44 -5
- package/dist/DocumentCaptureView.d.ts.map +1 -1
- package/dist/DocumentCaptureView.js +517 -30
- package/dist/FaceLivenessView.d.ts +3 -3
- package/dist/FaceLivenessView.d.ts.map +1 -1
- package/dist/FaceLivenessView.js +82 -40
- package/dist/IdCaptureView.d.ts +33 -20
- package/dist/IdCaptureView.d.ts.map +1 -1
- package/dist/IdCaptureView.js +196 -33
- package/dist/SelfieCaptureView.d.ts +19 -2
- package/dist/SelfieCaptureView.d.ts.map +1 -1
- package/dist/SelfieCaptureView.js +17 -5
- package/dist/SignatureCaptureView.d.ts +23 -2
- package/dist/SignatureCaptureView.d.ts.map +1 -1
- package/dist/SignatureCaptureView.js +138 -22
- package/dist/VideoIdCaptureView.d.ts +15 -3
- package/dist/VideoIdCaptureView.d.ts.map +1 -1
- package/dist/VideoIdCaptureView.js +35 -8
- package/dist/bindings/useDocumentCapture.d.ts.map +1 -1
- package/dist/bindings/useDocumentCapture.js +2 -1
- package/dist/bindings/useIdCapture.d.ts.map +1 -1
- package/dist/bindings/useIdCapture.js +2 -1
- package/dist/bindings/useSelfieCapture.d.ts.map +1 -1
- package/dist/bindings/useSelfieCapture.js +2 -1
- package/dist/bindings/useSignatureCapture.d.ts.map +1 -1
- package/dist/bindings/useSignatureCapture.js +2 -1
- package/dist/bindings/useVideoIdCapture.d.ts.map +1 -1
- package/dist/bindings/useVideoIdCapture.js +2 -1
- package/dist/components/CameraFeed.d.ts +11 -3
- package/dist/components/CameraFeed.d.ts.map +1 -1
- package/dist/components/CameraFeed.js +24 -4
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
- package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
- package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
- package/dist/components/common/BrowserEdgeTint.d.ts +63 -0
- package/dist/components/common/BrowserEdgeTint.d.ts.map +1 -0
- package/dist/components/common/BrowserEdgeTint.js +111 -0
- package/dist/components/common/LoaderButton.d.ts +9 -0
- package/dist/components/common/LoaderButton.d.ts.map +1 -1
- package/dist/components/common/LoaderButton.js +44 -321
- package/dist/components/common/ScreenReaderStatus.d.ts +8 -0
- package/dist/components/common/ScreenReaderStatus.d.ts.map +1 -0
- package/dist/components/common/ScreenReaderStatus.js +18 -0
- package/dist/components/common/overlay.d.ts +6 -0
- package/dist/components/common/overlay.d.ts.map +1 -1
- package/dist/components/common/overlay.js +7 -1
- package/dist/components/debug/debug.d.ts +10 -4
- package/dist/components/debug/debug.d.ts.map +1 -1
- package/dist/components/debug/debug.js +5 -1
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +273 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +128 -0
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
- package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
- package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
- package/dist/components/document/types.d.ts +25 -0
- package/dist/components/document/types.d.ts.map +1 -1
- package/dist/components/document/types.js +18 -1
- package/dist/components/error/CameraAccessDeniedOverlay.d.ts +8 -1
- package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
- package/dist/components/error/useCameraAccessDeniedReport.d.ts +12 -0
- package/dist/components/error/useCameraAccessDeniedReport.d.ts.map +1 -0
- package/dist/components/error/useCameraAccessDeniedReport.js +31 -0
- package/dist/components/face_liveness/FaceLivenessFailure.d.ts +4 -1
- package/dist/components/face_liveness/FaceLivenessFailure.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessFailure.js +4 -2
- package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +4 -1
- package/dist/components/face_liveness/FaceLivenessSuccess.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessSuccess.js +6 -2
- package/dist/components/guides/IdCaptureFitGuide.d.ts +2 -0
- package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureFitGuide.js +4 -1
- package/dist/components/guides/IdCaptureGuideOverlay.d.ts +2 -0
- package/dist/components/guides/IdCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuideOverlay.js +3 -1
- package/dist/components/guides/IdCaptureGuides.d.ts +14 -0
- package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuides.js +23 -9
- package/dist/components/guides/IdCaptureGuidesCommon.d.ts.map +1 -1
- package/dist/components/guides/IdCaptureGuidesCommon.js +12 -7
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts +9 -0
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/loading/IdCaptureLoadingOverlayDefault.js +26 -4
- package/dist/components/loading/RingIntroScreen.d.ts.map +1 -1
- package/dist/components/loading/RingIntroScreen.js +4 -34
- package/dist/components/review/ReviewScreen.d.ts +10 -1
- package/dist/components/review/ReviewScreen.d.ts.map +1 -1
- package/dist/components/review/ReviewScreen.js +8 -8
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts +54 -0
- package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
- package/dist/components/review/SignatureCaptureDiagnostics.js +144 -0
- package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts +9 -2
- package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/selfie/FaceCaptureGuideOverlay.js +10 -4
- package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts +8 -1
- package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureAnimatedMask.js +55 -21
- package/dist/components/selfie/SelfieCaptureSurface.d.ts +19 -3
- package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
- package/dist/components/selfie/SelfieCaptureSurface.js +78 -14
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts +9 -0
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.js +26 -4
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
- package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
- package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
- package/dist/flows/AuthStateContext.d.ts.map +1 -1
- package/dist/flows/AuthStateContext.js +2 -1
- package/dist/flows/CaptureProgress.d.ts +14 -0
- package/dist/flows/CaptureProgress.d.ts.map +1 -0
- package/dist/flows/CaptureProgress.js +51 -0
- package/dist/flows/CompositeWizard.d.ts +5 -0
- package/dist/flows/CompositeWizard.d.ts.map +1 -1
- package/dist/flows/CompositeWizard.js +6 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +1 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerBiometricsEnrollmentFlow.js +6 -3
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +1 -1
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
- package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +5 -2
- package/dist/flows/DocumentCaptureFlow.d.ts +2 -2
- package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
- package/dist/flows/DocumentCaptureFlow.js +6 -6
- package/dist/flows/FaceValidationFlow.d.ts +2 -2
- package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/FaceValidationFlow.js +2 -2
- package/dist/flows/FlowChassis.d.ts +3 -1
- package/dist/flows/FlowChassis.d.ts.map +1 -1
- package/dist/flows/FlowChassis.js +23 -4
- package/dist/flows/IdAndFaceValidationFlow.d.ts +1 -1
- package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdAndFaceValidationFlow.js +5 -2
- package/dist/flows/IdValidationFlow.d.ts +1 -1
- package/dist/flows/IdValidationFlow.d.ts.map +1 -1
- package/dist/flows/IdValidationFlow.js +18 -4
- package/dist/flows/SignatureKYCFlow.d.ts +18 -3
- package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
- package/dist/flows/SignatureKYCFlow.js +94 -11
- package/dist/flows/SubmissionProvider.d.ts.map +1 -1
- package/dist/flows/SubmissionProvider.js +10 -5
- package/dist/flows/VideoIdValidationFlow.d.ts +1 -1
- package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
- package/dist/flows/VideoIdValidationFlow.js +6 -3
- package/dist/flows/additionalDocuments.d.ts.map +1 -1
- package/dist/flows/additionalDocuments.js +3 -6
- package/dist/flows/approval.d.ts +2 -0
- package/dist/flows/approval.d.ts.map +1 -0
- package/dist/flows/approval.js +1 -0
- package/dist/flows/artifacts.d.ts +1 -1
- package/dist/flows/artifacts.d.ts.map +1 -1
- package/dist/flows/artifacts.js +29 -9
- package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
- package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
- package/dist/flows/autoCaptureMountGuard.js +61 -0
- package/dist/flows/customerMatch/CustomerMatchFlow.d.ts +1 -1
- package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
- package/dist/flows/customerMatch/CustomerMatchFlow.js +5 -6
- package/dist/flows/ringScreens.d.ts +1 -3
- package/dist/flows/ringScreens.d.ts.map +1 -1
- package/dist/flows/ringScreens.js +19 -5
- package/dist/flows/types.d.ts +17 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.d.ts +9 -1
- package/dist/guidance/selfieStrings.d.ts.map +1 -1
- package/dist/guidance/selfieStrings.js +67 -24
- package/dist/guidance/strings.d.ts +34 -1
- package/dist/guidance/strings.d.ts.map +1 -1
- package/dist/guidance/strings.js +39 -0
- package/dist/i18n/index.d.ts +28 -1177
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +58 -22
- package/dist/i18n/locales/threeOh.d.ts +4 -0
- package/dist/i18n/locales/threeOh.d.ts.map +1 -0
- package/dist/i18n/locales/threeOh.js +159 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/testing/autoCaptureFrames.d.ts +23 -0
- package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
- package/dist/testing/autoCaptureFrames.js +193 -0
- package/dist/testing/buildSelfieState.d.ts.map +1 -1
- package/dist/testing/buildSelfieState.js +5 -0
- package/dist/testing/classNamesLeaves.js +1 -1
- package/dist/testing/fakeDocumentController.d.ts +7 -1
- package/dist/testing/fakeDocumentController.d.ts.map +1 -1
- package/dist/testing/fakeDocumentController.js +10 -2
- package/dist/testing/fakeSelfieController.d.ts.map +1 -1
- package/dist/testing/fakeSelfieController.js +7 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/useDocumentUpload.d.ts +63 -0
- package/dist/useDocumentUpload.d.ts.map +1 -0
- package/dist/useDocumentUpload.js +45 -0
- package/dist/useIdmissionClient.d.ts +29 -0
- package/dist/useIdmissionClient.d.ts.map +1 -0
- package/dist/useIdmissionClient.js +44 -0
- package/dist/utils/canvas.d.ts.map +1 -1
- package/dist/utils/canvas.js +41 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -7
|
@@ -18,7 +18,7 @@ const EMPTY_SIGNATURE_CAPTURE = {};
|
|
|
18
18
|
const EMPTY_ID_VIEW = {};
|
|
19
19
|
const EMPTY_SUBMISSION = {};
|
|
20
20
|
const EMPTY_ARTIFACTS = {};
|
|
21
|
-
export function IdValidationFlow({ client, controller, capture = EMPTY_ID_CAPTURE, view = EMPTY_ID_VIEW, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, captureOnly = false, signatureController, signatureCapture = EMPTY_SIGNATURE_CAPTURE, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, ringScreenClassNames, onCaptured, onSubmitted, children, ...callbacks }) {
|
|
21
|
+
export function IdValidationFlow({ client, controller, capture = EMPTY_ID_CAPTURE, view = EMPTY_ID_VIEW, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, captureOnly = false, signatureController, signatureCapture = EMPTY_SIGNATURE_CAPTURE, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, additionalDocumentVerbiage, ringScreenClassNames, ringScreenVerbiage, onCaptured, onSubmitted, children, ...callbacks }) {
|
|
22
22
|
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
23
23
|
const latestCapture = useLatestCallbacks(capture);
|
|
24
24
|
const latestSignatureCapture = useLatestCallbacks(signatureCapture);
|
|
@@ -68,7 +68,18 @@ export function IdValidationFlow({ client, controller, capture = EMPTY_ID_CAPTUR
|
|
|
68
68
|
const result = [
|
|
69
69
|
{
|
|
70
70
|
id: 'id-capture',
|
|
71
|
-
render: (complete) => (_jsx(IdCaptureView, { ...view,
|
|
71
|
+
render: (complete) => (_jsx(IdCaptureView, { ...view,
|
|
72
|
+
// The ring intro's overlay defaults describe the two-step ID →
|
|
73
|
+
// selfie journey; this flow has no selfie, so it defaults to
|
|
74
|
+
// one-step copy (sdk2 IdValidation.tsx). Integrator verbiage wins.
|
|
75
|
+
verbiage: {
|
|
76
|
+
...view.verbiage,
|
|
77
|
+
loadingOverlay: {
|
|
78
|
+
introSubtitleText: 'Just one quick step — about 10 seconds.',
|
|
79
|
+
introStep2Text: '',
|
|
80
|
+
...view.verbiage?.loadingOverlay,
|
|
81
|
+
},
|
|
82
|
+
}, autoContinueAfterLoading: impliedAutoContinueAfterLoading(view.autoContinueAfterLoading, introActive), skipSuccessScreen: impliedSkipSuccessScreen(view.skipSuccessScreen, introActive), controller: resolvedController, onCollected: complete })),
|
|
72
83
|
},
|
|
73
84
|
];
|
|
74
85
|
if (resolvedSignatureController) {
|
|
@@ -81,12 +92,13 @@ export function IdValidationFlow({ client, controller, capture = EMPTY_ID_CAPTUR
|
|
|
81
92
|
if (signature)
|
|
82
93
|
result.push(signature);
|
|
83
94
|
}
|
|
84
|
-
const additionalDocuments = buildAdditionalDocumentsStep(captureAdditionalDocuments, additionalDocumentClassNames);
|
|
95
|
+
const additionalDocuments = buildAdditionalDocumentsStep(captureAdditionalDocuments, additionalDocumentClassNames, additionalDocumentVerbiage);
|
|
85
96
|
if (additionalDocuments)
|
|
86
97
|
result.push(additionalDocuments);
|
|
87
98
|
return result;
|
|
88
99
|
}, [
|
|
89
100
|
additionalDocumentClassNames,
|
|
101
|
+
additionalDocumentVerbiage,
|
|
90
102
|
captureAdditionalDocuments,
|
|
91
103
|
captureSignature,
|
|
92
104
|
captureSignatureVideo,
|
|
@@ -102,8 +114,10 @@ export function IdValidationFlow({ client, controller, capture = EMPTY_ID_CAPTUR
|
|
|
102
114
|
const ringScreens = buildRingScreenProps({
|
|
103
115
|
finishingClassNames: ringScreenClassNames?.finishingScreen,
|
|
104
116
|
successClassNames: ringScreenClassNames?.successScreen,
|
|
117
|
+
finishingOverrides: ringScreenVerbiage?.finishingScreen,
|
|
118
|
+
successOverrides: ringScreenVerbiage?.successScreen,
|
|
105
119
|
ringMode: view.loadingOverlayMode === 'ring',
|
|
106
|
-
finishingVerbiage: { finishingStage1Text: 'Uploading your ID', finishingStage2Text: 'Confirming your identity data' },
|
|
120
|
+
finishingVerbiage: { finishingStage1Text: 'Uploading your ID', finishingStage2Text: 'Confirming your identity data', finishingStage3Text: '' },
|
|
107
121
|
successVerbiage: { successTitleText: 'ID verified! 🎉', successSubtitleText: '', successIssuerValueText: 'Identity data', successIssuerCaptionText: 'confirmed' },
|
|
108
122
|
});
|
|
109
123
|
return (_jsxs(FlowChassis, { client: client, action: SubmissionAction.VALIDATE, submission: submission, theme: theme, className: className, ...callbacks, children: [_jsx(CompositeWizard, { ...ringScreens, steps: steps, initialArtifacts: initialArtifacts, captureOnly: captureOnly, showSuccessScreen: showSuccessScreen, showDiagnostics: showDiagnostics, onArtifactsCollected: onCaptured, onSubmitted: onSubmitted }), children] }));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type SubmissionArtifacts } from '@idmission/websdk-core/client';
|
|
2
2
|
import { type SelfieCaptureController, type SelfieCaptureThresholds, type SelfieLivenessConfig } from '@idmission/websdk-core/selfieCapture';
|
|
3
3
|
import { type SignatureCaptureController, type SignatureCaptureControllerConfig } from '@idmission/websdk-core/signatureCapture';
|
|
4
|
+
import { type SelfieCaptureViewClassNames } from '../SelfieCaptureView';
|
|
4
5
|
import { type SignatureCaptureViewProps } from '../SignatureCaptureView';
|
|
5
6
|
import type { CommonFlowProps, FaceLivenessFlowConfig, FaceLivenessFlowViewProps, FlowResultCallbacks } from './types';
|
|
6
|
-
export type SignatureKYCFlowProps = Omit<CommonFlowProps, keyof FlowResultCallbacks | 'children' | 'showSuccessScreen' | 'showDiagnostics' | 'captureAdditionalDocuments'> & {
|
|
7
|
+
export type SignatureKYCFlowProps = Omit<CommonFlowProps, keyof FlowResultCallbacks | 'children' | 'showSuccessScreen' | 'showDiagnostics' | 'captureAdditionalDocuments' | 'additionalDocumentVerbiage' | 'ringScreenVerbiage'> & {
|
|
7
8
|
selfieController?: SelfieCaptureController;
|
|
8
9
|
signatureController?: SignatureCaptureController;
|
|
9
10
|
/**
|
|
@@ -21,12 +22,26 @@ export type SignatureKYCFlowProps = Omit<CommonFlowProps, keyof FlowResultCallba
|
|
|
21
22
|
* render, so the whole object can be written inline.
|
|
22
23
|
*/
|
|
23
24
|
signatureCapture?: SignatureCaptureControllerConfig;
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Under `skipLivenessValidation` these drive a plain `SelfieCaptureView`,
|
|
27
|
+
* which also shows the stock-camera fallback, hence its classes.
|
|
28
|
+
*/
|
|
29
|
+
faceView?: FaceLivenessFlowViewProps & {
|
|
30
|
+
classNames?: Pick<SelfieCaptureViewClassNames, 'fallback'>;
|
|
31
|
+
};
|
|
25
32
|
signatureView?: Omit<SignatureCaptureViewProps, 'controller' | 'sessionReady' | 'onCompleted'>;
|
|
26
33
|
/** One-prop challenge-response opt-in for the liveness step. */
|
|
27
34
|
challengeResponse?: NonNullable<SelfieLivenessConfig['challenge']>;
|
|
28
35
|
/** Passed to both camera acquisitions; defaults to false in core. */
|
|
29
36
|
allowVirtualCameras?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Allows the flow-owned shared front camera above the default 1280×720 cap.
|
|
39
|
+
* Defaults to false. True preserves normal camera selection and any explicit
|
|
40
|
+
* `faceCapture.camera` / `signatureCapture.camera` maximum. Read once at mount;
|
|
41
|
+
* remount to change it. Higher resolutions can reduce signing responsiveness
|
|
42
|
+
* on slower devices. Supplied controllers manage their own cameras.
|
|
43
|
+
*/
|
|
44
|
+
allowHigherCameraResolutions?: boolean;
|
|
30
45
|
/** Captures a selfie without calling the liveness endpoint, matching 2.x. */
|
|
31
46
|
skipLivenessValidation?: boolean;
|
|
32
47
|
allowManualSelfieCaptureOnLoadingError?: boolean;
|
|
@@ -60,5 +75,5 @@ export type SignatureKYCFlowProps = Omit<CommonFlowProps, keyof FlowResultCallba
|
|
|
60
75
|
* `thresholds` outrank both.
|
|
61
76
|
*/
|
|
62
77
|
export declare function faceThresholdsForLayout(legacyVideoLayout: boolean, thresholds: SelfieCaptureThresholds | undefined): SelfieCaptureThresholds | undefined;
|
|
63
|
-
export declare function SignatureKYCFlow({ client, selfieController, signatureController, faceCapture, signatureCapture, faceView, signatureView, challengeResponse, allowVirtualCameras, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, allowSignatureAfterLivenessCheckFailure, showFaceGuideThenSignaturePad, skipSuccessScreen, submission, initialArtifacts, theme, className, geolocationEnabled, geolocationRequired, remoteDiagnostics, loadingSpinner, onCaptured, onCaptureError, }: SignatureKYCFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare function SignatureKYCFlow({ client, selfieController, signatureController, faceCapture, signatureCapture, faceView, signatureView, challengeResponse, allowVirtualCameras, allowHigherCameraResolutions, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, allowSignatureAfterLivenessCheckFailure, showFaceGuideThenSignaturePad, skipSuccessScreen, submission, initialArtifacts, theme, className, geolocationEnabled, geolocationRequired, captureProgress, remoteDiagnostics, loadingSpinner, onCaptured, onCaptureError, }: SignatureKYCFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
64
79
|
//# sourceMappingURL=SignatureKYCFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureKYCFlow.d.ts","sourceRoot":"","sources":["../../src/flows/SignatureKYCFlow.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KA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C/C,6BAAqC,EACrC,iBAAiB,EACjB,UAA6B,EAC7B,gBAAkC,EAClC,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE,qBAAqB,2CA+XvB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { styled } from 'styled-components';
|
|
3
|
+
import { styled, useTheme } from 'styled-components';
|
|
4
4
|
import { acquireCamera } from '@idmission/websdk-core/camera';
|
|
5
5
|
import { SubmissionAction, } from '@idmission/websdk-core/client';
|
|
6
6
|
import { createSelfieCaptureController, } from '@idmission/websdk-core/selfieCapture';
|
|
@@ -8,10 +8,14 @@ import { createSignatureCaptureController, } from '@idmission/websdk-core/signat
|
|
|
8
8
|
import { FaceLivenessView } from '../FaceLivenessView';
|
|
9
9
|
import { SelfieCaptureView } from '../SelfieCaptureView';
|
|
10
10
|
import { useSelfieCapture } from '../bindings/useSelfieCapture';
|
|
11
|
+
import { useSignatureCapture } from '../bindings/useSignatureCapture';
|
|
12
|
+
import { BrowserEdgeTint, opaqueColor } from '../components/common/BrowserEdgeTint';
|
|
13
|
+
import { SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT, selfieLoadingOverlayBottomEdgeColor, } from '../components/selfie_loading/SelfieCaptureLoadingOverlayDefault';
|
|
11
14
|
import { impliedAutoContinueAfterLoading, impliedSkipSuccessScreen, isRingIntroActive, } from './ringIntroImplications';
|
|
12
15
|
import { SignatureCaptureView, } from '../SignatureCaptureView';
|
|
13
16
|
import { buildSelfieArtifacts, mergeSubmissionArtifacts } from './artifacts';
|
|
14
17
|
import { FlowChassis } from './FlowChassis';
|
|
18
|
+
import { CaptureProgressCompletion } from './CaptureProgress';
|
|
15
19
|
import { useLatestCallbacks } from './latestCallbacks';
|
|
16
20
|
import { createSharedCameraAcquirer, withVirtualCameras, } from './sharedCamera';
|
|
17
21
|
/**
|
|
@@ -49,7 +53,7 @@ const EMPTY_FACE_VIEW = {};
|
|
|
49
53
|
const EMPTY_SIGNATURE_VIEW = {};
|
|
50
54
|
const EMPTY_SUBMISSION = {};
|
|
51
55
|
const EMPTY_ARTIFACTS = {};
|
|
52
|
-
export function SignatureKYCFlow({ client, selfieController, signatureController, faceCapture = EMPTY_FACE_CAPTURE, signatureCapture = EMPTY_SIGNATURE_CAPTURE, faceView = EMPTY_FACE_VIEW, signatureView = EMPTY_SIGNATURE_VIEW, challengeResponse, allowVirtualCameras, skipLivenessValidation = false, allowManualSelfieCaptureOnLoadingError = false, headTrackingDisabled = false, headTrackingBoundaryPercentage = 0.01, headTrackingBoundaryType = 'head', allowSignatureAfterLivenessCheckFailure = false, showFaceGuideThenSignaturePad = false, skipSuccessScreen, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, theme, className, geolocationEnabled, geolocationRequired, remoteDiagnostics, loadingSpinner, onCaptured, onCaptureError, }) {
|
|
56
|
+
export function SignatureKYCFlow({ client, selfieController, signatureController, faceCapture = EMPTY_FACE_CAPTURE, signatureCapture = EMPTY_SIGNATURE_CAPTURE, faceView = EMPTY_FACE_VIEW, signatureView = EMPTY_SIGNATURE_VIEW, challengeResponse, allowVirtualCameras, allowHigherCameraResolutions = false, skipLivenessValidation = false, allowManualSelfieCaptureOnLoadingError = false, headTrackingDisabled = false, headTrackingBoundaryPercentage = 0.01, headTrackingBoundaryType = 'head', allowSignatureAfterLivenessCheckFailure = false, showFaceGuideThenSignaturePad = false, skipSuccessScreen, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, theme, className, geolocationEnabled, geolocationRequired, captureProgress, remoteDiagnostics, loadingSpinner, onCaptured, onCaptureError, }) {
|
|
53
57
|
const { checkLivenessOptions, ...selfieCaptureConfig } = faceCapture;
|
|
54
58
|
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
55
59
|
const latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
|
|
@@ -67,9 +71,22 @@ export function SignatureKYCFlow({ client, selfieController, signatureController
|
|
|
67
71
|
useEffect(() => {
|
|
68
72
|
checkLivenessOptionsRef.current = checkLivenessOptions;
|
|
69
73
|
}, [checkLivenessOptions]);
|
|
70
|
-
const [sharedAcquireCamera] = useState(() =>
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
const [sharedAcquireCamera] = useState(() => {
|
|
75
|
+
const baseAcquire = selfieCaptureConfig.io?.acquireCamera ??
|
|
76
|
+
signatureCapture.io?.acquireCamera ??
|
|
77
|
+
acquireCamera;
|
|
78
|
+
// Both stages share the first stream. Unless the host opts into higher
|
|
79
|
+
// resolutions, cap acquisition before selfie guidance and direct signing.
|
|
80
|
+
return createSharedCameraAcquirer((video, options) => baseAcquire(video, {
|
|
81
|
+
...options,
|
|
82
|
+
...(!allowHigherCameraResolutions && options?.preferFrontFacingCamera && {
|
|
83
|
+
maxVideoResolution: {
|
|
84
|
+
width: Math.min(options.maxVideoResolution?.width ?? 1280, 1280),
|
|
85
|
+
height: Math.min(options.maxVideoResolution?.height ?? 720, 720),
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
73
90
|
const [resolvedSelfieController] = useState(() => selfieController ??
|
|
74
91
|
createSelfieCaptureController({
|
|
75
92
|
...latestSelfieCapture,
|
|
@@ -101,6 +118,7 @@ export function SignatureKYCFlow({ client, selfieController, signatureController
|
|
|
101
118
|
},
|
|
102
119
|
}));
|
|
103
120
|
const selfieState = useSelfieCapture(resolvedSelfieController);
|
|
121
|
+
const signatureState = useSignatureCapture(resolvedSignatureController);
|
|
104
122
|
const hasPrecapturedSelfie = Boolean(initialArtifacts.face?.selfieImage);
|
|
105
123
|
const [stage, setStage] = useState(hasPrecapturedSelfie ? 'signature-capture' : 'face-liveness');
|
|
106
124
|
/**
|
|
@@ -128,11 +146,37 @@ export function SignatureKYCFlow({ client, selfieController, signatureController
|
|
|
128
146
|
!awaitingRestartSelfie
|
|
129
147
|
? 'signature-capture'
|
|
130
148
|
: stage;
|
|
149
|
+
// What is touching the viewport edges, for iOS Safari's bars (FlowEdgeTint).
|
|
150
|
+
// The face stage's loading overlay is dismissed inside its view, so the view
|
|
151
|
+
// reports it; only the default overlay paints one flat colour.
|
|
152
|
+
const [faceOverlayDismissed, setFaceOverlayDismissed] = useState(false);
|
|
153
|
+
const handleFaceOverlayDismissed = useCallback(() => {
|
|
154
|
+
setFaceOverlayDismissed(true);
|
|
155
|
+
faceView.onLoadingOverlayDismissed?.();
|
|
156
|
+
}, [faceView]);
|
|
157
|
+
const edgeSurface = renderedStage === 'face-liveness' && !faceOverlayDismissed
|
|
158
|
+
? (faceView.loadingOverlayMode ?? 'default') === 'default'
|
|
159
|
+
? 'overlay'
|
|
160
|
+
: null
|
|
161
|
+
: renderedStage === 'signature-capture' &&
|
|
162
|
+
(signatureState.phase === 'reviewing' ||
|
|
163
|
+
signatureState.phase === 'completed' ||
|
|
164
|
+
signatureState.phase === 'error')
|
|
165
|
+
? 'panel'
|
|
166
|
+
: renderedStage === 'face-liveness' ||
|
|
167
|
+
signatureState.captureMode === 'video'
|
|
168
|
+
? 'camera'
|
|
169
|
+
: 'panel';
|
|
131
170
|
useEffect(() => {
|
|
132
171
|
if (stage !== 'signature-capture' ||
|
|
133
|
-
headTrackingDisabled ||
|
|
134
172
|
!selfieState.models.ready)
|
|
135
173
|
return;
|
|
174
|
+
if (headTrackingDisabled) {
|
|
175
|
+
// Without liveness validation, the selfie remains in processing and its
|
|
176
|
+
// overlay prediction loop is still running behind the signature pad.
|
|
177
|
+
resolvedSelfieController.actions.stopTracking();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
136
180
|
resolvedSelfieController.actions.startTracking();
|
|
137
181
|
return () => resolvedSelfieController.actions.stopTracking();
|
|
138
182
|
}, [
|
|
@@ -232,11 +276,50 @@ export function SignatureKYCFlow({ client, selfieController, signatureController
|
|
|
232
276
|
handleLivenessDone,
|
|
233
277
|
onExitAfterLivenessFailure,
|
|
234
278
|
]);
|
|
235
|
-
return (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
279
|
+
return (_jsxs(FlowChassis, { client: client, action: SubmissionAction.NONE, submission: submission, theme: theme, className: className, geolocationEnabled: geolocationEnabled, geolocationRequired: geolocationRequired, captureProgress: captureProgress, remoteDiagnostics: remoteDiagnostics, loadingSpinner: loadingSpinner, children: [_jsx(CaptureProgressCompletion, { completed: stage === 'complete' }), stage !== 'complete' ? (_jsxs(HandoffRoot, { children: [_jsx(SignatureCaptureView, { ...signatureView, skipSuccessScreen: impliedSkipSuccessScreen(skipSuccessScreen ?? signatureView.skipSuccessScreen, isRingIntroActive(faceView)), controller: resolvedSignatureController, sessionReady: renderedStage === 'signature-capture', videoRef: sharedVideoRef, onVideoElementChange: setSharedVideoNode, forceCameraFeed: renderedStage === 'face-liveness', headTrackingSatisfied: headTrackingSatisfied, headTrackingStatus: headTrackingDisabled || !selfieState.models.ready
|
|
280
|
+
? 'off'
|
|
281
|
+
: selfieState.prediction === null
|
|
282
|
+
? 'pending'
|
|
283
|
+
: headTrackingSatisfied
|
|
284
|
+
? 'satisfied'
|
|
285
|
+
: 'unsatisfied', showFaceGuideThenSignaturePad: showFaceGuideThenSignaturePad, faceGuideStatus: faceGuideStatus, onCompleted: handleSignatureCompleted, onRestartRequested: hasPrecapturedSelfie ? undefined : handleInterruptedRestart }), hasPrecapturedSelfie && !headTrackingDisabled ? (_jsx(SelfieTrackerAttachment, { controller: resolvedSelfieController, video: sharedVideoNode })) : null, !hasPrecapturedSelfie ? (_jsx(FaceStage, { "$visible": renderedStage === 'face-liveness', children: skipLivenessValidation ? (_jsx(SelfieCaptureView, { ...faceView, onLoadingOverlayDismissed: handleFaceOverlayDismissed, autoContinueAfterLoading: impliedAutoContinueAfterLoading(faceView.autoContinueAfterLoading, isRingIntroActive(faceView)), controller: resolvedSelfieController, videoRef: sharedVideoRef, renderCameraFeed: false, renderFaceGuide: !legacyVideoLayout, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, onCaptured: handleLivenessDone })) : (_jsx(FaceLivenessView, { ...faceView, onLoadingOverlayDismissed: handleFaceOverlayDismissed, autoContinueAfterLoading: impliedAutoContinueAfterLoading(faceView.autoContinueAfterLoading, isRingIntroActive(faceView)), controller: resolvedSelfieController,
|
|
286
|
+
// Always: this stage is an overlay that must hand the shared
|
|
287
|
+
// camera straight back to the signature view, so there is no
|
|
288
|
+
// point in the wizard at which a review screen could render.
|
|
289
|
+
skipSuccessScreen: true, videoRef: sharedVideoRef, renderCameraFeed: false, renderFaceGuide: !legacyVideoLayout, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, onExitAfterFailure: handleLivenessFailureExit, onDone: handleLivenessDone })) })) : null, _jsx(FlowEdgeTint, { surface: edgeSurface, modelsReady: selfieState.models.ready })] })) : null] }));
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Black, so iOS Safari's bars read as letterboxing around the camera feed
|
|
293
|
+
* rather than as one more colour a theme has to choose.
|
|
294
|
+
*/
|
|
295
|
+
const CAMERA_EDGE_COLOR = '#000';
|
|
296
|
+
/**
|
|
297
|
+
* Tints iOS Safari's bars to whatever this flow has on screen — see
|
|
298
|
+
* `BrowserEdgeTint`. It follows every screen, not only the camera: Safari keeps
|
|
299
|
+
* the last strip colour when the strips leave while a full-viewport surface is
|
|
300
|
+
* still up, so dropping them after the camera would leave black bars over a
|
|
301
|
+
* light panel. Rendered under the flow's theme, which is where `isFullscreen`
|
|
302
|
+
* lives; an embedded flow leaves the host's chrome alone.
|
|
303
|
+
*
|
|
304
|
+
* The loading overlay ends in its progress row, part filled while it loads, so
|
|
305
|
+
* no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
|
|
306
|
+
* as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
|
|
307
|
+
*/
|
|
308
|
+
function FlowEdgeTint({ surface, modelsReady, }) {
|
|
309
|
+
const theme = useTheme();
|
|
310
|
+
if (theme.isFullscreen === false || surface === null)
|
|
311
|
+
return null;
|
|
312
|
+
const color = opaqueColor(surface === 'camera'
|
|
313
|
+
? CAMERA_EDGE_COLOR
|
|
314
|
+
: surface === 'overlay'
|
|
315
|
+
? (theme.selfieCapture?.loadingOverlay?.backgroundColor ??
|
|
316
|
+
SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT)
|
|
317
|
+
: (theme.background ?? '#fff'));
|
|
318
|
+
if (!color)
|
|
319
|
+
return null;
|
|
320
|
+
return (_jsx(BrowserEdgeTint, { color: color, hiddenBottomColor: surface === 'overlay'
|
|
321
|
+
? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady)
|
|
322
|
+
: undefined }));
|
|
240
323
|
}
|
|
241
324
|
function SelfieTrackerAttachment({ controller, video, }) {
|
|
242
325
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmissionProvider.d.ts","sourceRoot":"","sources":["../../src/flows/SubmissionProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubmissionProvider.d.ts","sourceRoot":"","sources":["../../src/flows/SubmissionProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAEd,OAAO,EACL,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAA;AAItC,YAAY,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAExE,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,gBAAgB,CAAA;IACxB;+DAC2D;IAC3D,MAAM,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAA;IAC9E,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAC7C,eAAe,EAAE,KAAK,GAAG,IAAI,CAAA;IAC7B,qBAAqB,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC/C;iFAC6E;IAC7E,qBAAqB,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC/C,QAAQ,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAA;CACvC,CAAA;AAKD,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC1D,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACxC,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,MAAM,EACN,OAAkC,EAClC,WAAkB,EAClB,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,GACjB,EAAE,uBAAuB,2CAiJzB;AAED,wBAAgB,aAAa,IAAI,sBAAsB,CAMtD"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCaptureObserver } from './CaptureProgress';
|
|
3
|
+
import { bindSubmissionObserver } from '@idmission/websdk-core/captureProgress/internal';
|
|
4
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState, } from 'react';
|
|
5
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
3
6
|
import { SubmissionStatus, } from '@idmission/websdk-core/client';
|
|
4
7
|
import { useAuthState } from './AuthStateContext';
|
|
8
|
+
import { isApprovedResponse } from './approval';
|
|
5
9
|
const SubmissionContext = createContext(null);
|
|
6
10
|
const EMPTY_SUBMISSION_OPTIONS = {};
|
|
7
|
-
function isApproved(response) {
|
|
8
|
-
return response.resultData.verificationResult === 'Approved';
|
|
9
|
-
}
|
|
10
11
|
export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_OPTIONS, geolocation = null, children, onSubmissionStarted, onComplete, onApproved, onDenied, onRequestFailure, }) {
|
|
12
|
+
const progress = useCaptureObserver();
|
|
11
13
|
const clientState = useSyncExternalStore(client.subscribe, client.getState, client.getState);
|
|
12
14
|
const { state: authState } = useAuthState();
|
|
13
15
|
const [submissionResponse, setSubmissionResponse] = useState(null);
|
|
@@ -31,6 +33,7 @@ export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_
|
|
|
31
33
|
setSubmissionResponse(null);
|
|
32
34
|
setLocalError(null);
|
|
33
35
|
onSubmissionStarted?.(artifacts);
|
|
36
|
+
const unbindProgress = bindSubmissionObserver(artifacts, progress);
|
|
34
37
|
const promise = client
|
|
35
38
|
.submit(artifacts, { ...options, action })
|
|
36
39
|
.then((response) => {
|
|
@@ -43,7 +46,7 @@ export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_
|
|
|
43
46
|
return null;
|
|
44
47
|
setSubmissionResponse(response);
|
|
45
48
|
onComplete?.(response);
|
|
46
|
-
if (
|
|
49
|
+
if (isApprovedResponse(action, response))
|
|
47
50
|
onApproved?.(response);
|
|
48
51
|
else
|
|
49
52
|
onDenied?.(response);
|
|
@@ -56,6 +59,7 @@ export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_
|
|
|
56
59
|
throw error;
|
|
57
60
|
})
|
|
58
61
|
.finally(() => {
|
|
62
|
+
unbindProgress();
|
|
59
63
|
submitInFlightRef.current = null;
|
|
60
64
|
setResubmitting(false);
|
|
61
65
|
});
|
|
@@ -71,6 +75,7 @@ export function SubmissionProvider({ client, action, options = EMPTY_SUBMISSION_
|
|
|
71
75
|
onRequestFailure,
|
|
72
76
|
onSubmissionStarted,
|
|
73
77
|
options,
|
|
78
|
+
progress,
|
|
74
79
|
]);
|
|
75
80
|
const resubmit = useMemo(() => {
|
|
76
81
|
if (!authState.session.canRefreshSession)
|
|
@@ -81,5 +81,5 @@ export type VideoIdValidationFlowProps = CommonFlowProps & {
|
|
|
81
81
|
/** Fires when microphone access is refused. sdk2's callback of the same name. */
|
|
82
82
|
onMicrophoneAccessDenied?: () => void;
|
|
83
83
|
};
|
|
84
|
-
export declare function VideoIdValidationFlow({ client, idController, selfieController, controller, idCapture, faceCapture, capture, idView, faceView, view, submission, initialArtifacts, captureOnly, signatureController, signatureCapture, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, skipIdCapture, matchOnly, readTextPrompt, onMicrophoneAccessDenied, theme, className, showSuccessScreen, showDiagnostics, captureAdditionalDocuments, additionalDocumentClassNames, ringScreenClassNames, onCaptured, onSubmitted, onCaptureError, children, ...callbacks }: VideoIdValidationFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
export declare function VideoIdValidationFlow({ client, idController, selfieController, controller, idCapture, faceCapture, capture, idView, faceView, view, submission, initialArtifacts, captureOnly, signatureController, signatureCapture, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, skipIdCapture, matchOnly, readTextPrompt, onMicrophoneAccessDenied, theme, className, showSuccessScreen, showDiagnostics, captureAdditionalDocuments, additionalDocumentClassNames, additionalDocumentVerbiage, ringScreenClassNames, ringScreenVerbiage, onCaptured, onSubmitted, onCaptureError, children, ...callbacks }: VideoIdValidationFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
85
85
|
//# sourceMappingURL=VideoIdValidationFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoIdValidationFlow.d.ts","sourceRoot":"","sources":["../../src/flows/VideoIdValidationFlow.tsx"],"names":[],"mappings":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G;IACH,gBAAgB,CAAC,EAAE,gCAAgC,CAAA;IACnD,aAAa,CAAC,EAAE,sBAAsB,CAAA;IACtC,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;IACzC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAA;IAC9C,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;IACvD,iFAAiF;IACjF,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAA;CACtC,CAAA;AAYD,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAA4B,EAC5B,WAAgC,EAChC,OAA6B,EAC7B,MAAsB,EACtB,QAA0B,EAC1B,IAAuB,EACvB,UAA6B,EAC7B,gBAAkC,EAClC,WAAmB,EACnB,mBAAmB,EACnB,gBAA0C,EAC1C,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,aAAqB,EACrB,SAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,KAAK,EACL,SAAS,EACT,iBAAyB,EACzB,eAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"VideoIdValidationFlow.d.ts","sourceRoot":"","sources":["../../src/flows/VideoIdValidationFlow.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAA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AE,sBAAsB,CAAA;IACzC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAA;IAC9C,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;IACvD,iFAAiF;IACjF,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAA;CACtC,CAAA;AAYD,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAA4B,EAC5B,WAAgC,EAChC,OAA6B,EAC7B,MAAsB,EACtB,QAA0B,EAC1B,IAAuB,EACvB,UAA6B,EAC7B,gBAAkC,EAClC,WAAmB,EACnB,mBAAmB,EACnB,gBAA0C,EAC1C,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,aAAqB,EACrB,SAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,KAAK,EACL,SAAS,EACT,iBAAyB,EACzB,eAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,0BAA0B,2CA4N5B"}
|
|
@@ -24,7 +24,7 @@ const EMPTY_FACE_VIEW = {};
|
|
|
24
24
|
const EMPTY_VIDEO_VIEW = {};
|
|
25
25
|
const EMPTY_SUBMISSION = {};
|
|
26
26
|
const EMPTY_ARTIFACTS = {};
|
|
27
|
-
export function VideoIdValidationFlow({ client, idController, selfieController, controller, idCapture = EMPTY_ID_CAPTURE, faceCapture = EMPTY_FACE_CAPTURE, capture = EMPTY_VIDEO_CAPTURE, idView = EMPTY_ID_VIEW, faceView = EMPTY_FACE_VIEW, view = EMPTY_VIDEO_VIEW, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, captureOnly = false, signatureController, signatureCapture = EMPTY_SIGNATURE_CAPTURE, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, skipIdCapture = false, matchOnly = false, readTextPrompt, onMicrophoneAccessDenied, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, ringScreenClassNames, onCaptured, onSubmitted, onCaptureError, children, ...callbacks }) {
|
|
27
|
+
export function VideoIdValidationFlow({ client, idController, selfieController, controller, idCapture = EMPTY_ID_CAPTURE, faceCapture = EMPTY_FACE_CAPTURE, capture = EMPTY_VIDEO_CAPTURE, idView = EMPTY_ID_VIEW, faceView = EMPTY_FACE_VIEW, view = EMPTY_VIDEO_VIEW, submission = EMPTY_SUBMISSION, initialArtifacts = EMPTY_ARTIFACTS, captureOnly = false, signatureController, signatureCapture = EMPTY_SIGNATURE_CAPTURE, signatureView, captureSignature, captureSignatureVideo, allowVirtualCameras, skipIdCapture = false, matchOnly = false, readTextPrompt, onMicrophoneAccessDenied, theme, className, showSuccessScreen = false, showDiagnostics = false, captureAdditionalDocuments, additionalDocumentClassNames, additionalDocumentVerbiage, ringScreenClassNames, ringScreenVerbiage, onCaptured, onSubmitted, onCaptureError, children, ...callbacks }) {
|
|
28
28
|
const { checkLivenessOptions, ...selfieCaptureConfig } = faceCapture;
|
|
29
29
|
// Config callbacks follow the latest render; see useLatestCallbacks.
|
|
30
30
|
const latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
|
|
@@ -135,12 +135,13 @@ export function VideoIdValidationFlow({ client, idController, selfieController,
|
|
|
135
135
|
if (signature)
|
|
136
136
|
result.push(signature);
|
|
137
137
|
}
|
|
138
|
-
const additionalDocuments = buildAdditionalDocumentsStep(captureAdditionalDocuments, additionalDocumentClassNames);
|
|
138
|
+
const additionalDocuments = buildAdditionalDocumentsStep(captureAdditionalDocuments, additionalDocumentClassNames, additionalDocumentVerbiage);
|
|
139
139
|
if (additionalDocuments)
|
|
140
140
|
result.push(additionalDocuments);
|
|
141
141
|
return result;
|
|
142
142
|
}, [
|
|
143
143
|
additionalDocumentClassNames,
|
|
144
|
+
additionalDocumentVerbiage,
|
|
144
145
|
captureAdditionalDocuments,
|
|
145
146
|
captureSignature,
|
|
146
147
|
captureSignatureVideo,
|
|
@@ -170,8 +171,10 @@ export function VideoIdValidationFlow({ client, idController, selfieController,
|
|
|
170
171
|
const ringScreens = buildRingScreenProps({
|
|
171
172
|
finishingClassNames: ringScreenClassNames?.finishingScreen,
|
|
172
173
|
successClassNames: ringScreenClassNames?.successScreen,
|
|
174
|
+
finishingOverrides: ringScreenVerbiage?.finishingScreen,
|
|
175
|
+
successOverrides: ringScreenVerbiage?.successScreen,
|
|
173
176
|
ringMode: isRingModeActive(idView) || videoIdSequenceIsRing,
|
|
174
|
-
finishingVerbiage: { finishingStage1Text: 'Uploading your captures', finishingStage2Text: 'Checking your ID details' },
|
|
177
|
+
finishingVerbiage: { finishingStage1Text: 'Uploading your captures', finishingStage2Text: 'Checking your ID details', finishingStage3Text: 'Reviewing your video' },
|
|
175
178
|
successVerbiage: { successSubtitleText: '', successIssuerValueText: 'Identity data', successIssuerCaptionText: 'confirmed' },
|
|
176
179
|
});
|
|
177
180
|
return (_jsxs(FlowChassis, { client: client, action: action, submission: submission, theme: theme, className: className, ...callbacks, children: [_jsx(CompositeWizard, { ...ringScreens, steps: steps, initialArtifacts: initialArtifacts, captureOnly: captureOnly, showSuccessScreen: showSuccessScreen, showDiagnostics: showDiagnostics, onArtifactsCollected: onCaptured, onSubmitted: onSubmitted }), children] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"additionalDocuments.d.ts","sourceRoot":"","sources":["../../src/flows/additionalDocuments.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,yCAAyC,EAC9C,KAAK,uCAAuC,EAC7C,MAAM,oEAAoE,CAAA;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"additionalDocuments.d.ts","sourceRoot":"","sources":["../../src/flows/additionalDocuments.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,yCAAyC,EAC9C,KAAK,uCAAuC,EAC7C,MAAM,oEAAoE,CAAA;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,EAIpD,UAAU,CAAC,EAAE,yCAAyC,EACtD,QAAQ,CAAC,EAAE,uCAAuC,GACjD,mBAAmB,GAAG,IAAI,CAgB5B"}
|
|
@@ -10,12 +10,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
10
10
|
// divergence. Do not "fix" it back.
|
|
11
11
|
import { AdditionalDocumentCaptureWizard, } from '../components/additional_documents/AdditionalDocumentCaptureWizard';
|
|
12
12
|
export function buildAdditionalDocumentsStep(documents,
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// (workstream 06's sdk2 compat façade) plumbs sdk2's
|
|
17
|
-
// `classNames.additionalDocumentCapture` / `verbiage.additionalDocumentCapture`
|
|
18
|
-
// into; see the divergence ledger. Do not remove them as "unused."
|
|
13
|
+
// The flow's `additionalDocumentClassNames` / `additionalDocumentVerbiage`,
|
|
14
|
+
// which the compat façade fills from sdk2's
|
|
15
|
+
// `classNames.additionalDocumentCapture` / `verbiage.additionalDocumentCapture`.
|
|
19
16
|
classNames, verbiage) {
|
|
20
17
|
if (!documents?.length)
|
|
21
18
|
return null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/flows/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isApprovedResponse } from "@idmission/websdk-core/client";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SubmissionArtifacts } from '@idmission/websdk-core/client';
|
|
2
2
|
/**
|
|
3
3
|
* Merges artifacts produced by consecutive flow stages without discarding
|
|
4
4
|
* capture-attempt metadata collected by an earlier stage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/flows/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/flows/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAA;AAwDtC;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,mBAAmB,GAC5B,mBAAmB,CA+CrB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,IAAI,EAChB,eAAe,EACX,WAAW,CACT,WAAW,CACT,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAC5D,CAAC,QAAQ,CAAC,CACZ,CAAC,MAAM,CAAC,GACT,IAAI,GACP,mBAAmB,CAgBrB"}
|
package/dist/flows/artifacts.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { captureAttemptFileMetadata, } from '@idmission/websdk-core/client';
|
|
1
2
|
function mergeCaptureAttempts(current, incoming) {
|
|
2
3
|
if (!current && !incoming)
|
|
3
4
|
return undefined;
|
|
@@ -16,6 +17,29 @@ function mergeCaptureAttempts(current, incoming) {
|
|
|
16
17
|
: {}),
|
|
17
18
|
};
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Merges per-image upload metadata. An incoming image without its own entry
|
|
22
|
+
* drops the earlier one, which described the image it replaces.
|
|
23
|
+
*/
|
|
24
|
+
function mergeDocumentFileMetadata(current, incoming) {
|
|
25
|
+
const currentMap = current.documents?.documentFileMetadata;
|
|
26
|
+
const incomingMap = incoming.documents?.documentFileMetadata;
|
|
27
|
+
if (!currentMap && !incomingMap)
|
|
28
|
+
return undefined;
|
|
29
|
+
const merged = { ...currentMap };
|
|
30
|
+
const replaced = {
|
|
31
|
+
idFrontImage: incoming.id?.frontImage,
|
|
32
|
+
idBackImage: incoming.id?.backImage,
|
|
33
|
+
passportImage: incoming.id?.passportImage,
|
|
34
|
+
idBarcodeImage: incoming.id?.barcodeImage,
|
|
35
|
+
selfieImage: incoming.face?.selfieImage,
|
|
36
|
+
};
|
|
37
|
+
for (const [key, image] of Object.entries(replaced)) {
|
|
38
|
+
if (image)
|
|
39
|
+
delete merged[key];
|
|
40
|
+
}
|
|
41
|
+
return { ...merged, ...incomingMap };
|
|
42
|
+
}
|
|
19
43
|
/**
|
|
20
44
|
* Merges artifacts produced by consecutive flow stages without discarding
|
|
21
45
|
* capture-attempt metadata collected by an earlier stage.
|
|
@@ -31,19 +55,12 @@ export function mergeSubmissionArtifacts(current, incoming) {
|
|
|
31
55
|
const signature = current.signature || incoming.signature
|
|
32
56
|
? { ...current.signature, ...incoming.signature }
|
|
33
57
|
: undefined;
|
|
58
|
+
const documentFileMetadata = mergeDocumentFileMetadata(current, incoming);
|
|
34
59
|
const documents = current.documents || incoming.documents
|
|
35
60
|
? {
|
|
36
61
|
...current.documents,
|
|
37
62
|
...incoming.documents,
|
|
38
|
-
...(
|
|
39
|
-
incoming.documents?.documentFileMetadata
|
|
40
|
-
? {
|
|
41
|
-
documentFileMetadata: {
|
|
42
|
-
...current.documents?.documentFileMetadata,
|
|
43
|
-
...incoming.documents?.documentFileMetadata,
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
: {}),
|
|
63
|
+
...(documentFileMetadata ? { documentFileMetadata } : {}),
|
|
47
64
|
}
|
|
48
65
|
: undefined;
|
|
49
66
|
const captureAttempts = mergeCaptureAttempts(current.meta?.captureAttempts, incoming.meta?.captureAttempts);
|
|
@@ -66,6 +83,8 @@ export function mergeSubmissionArtifacts(current, incoming) {
|
|
|
66
83
|
};
|
|
67
84
|
}
|
|
68
85
|
export function buildSelfieArtifacts(imageUrl, capturedAt, capturedAttempt) {
|
|
86
|
+
const selfieImage = capturedAttempt &&
|
|
87
|
+
captureAttemptFileMetadata('selfie', 'selfieImage', capturedAttempt);
|
|
69
88
|
return {
|
|
70
89
|
face: {
|
|
71
90
|
selfieImage: imageUrl.split(',')[1] ?? imageUrl,
|
|
@@ -76,5 +95,6 @@ export function buildSelfieArtifacts(imageUrl, capturedAt, capturedAttempt) {
|
|
|
76
95
|
selfie: capturedAttempt ? [capturedAttempt] : [],
|
|
77
96
|
},
|
|
78
97
|
},
|
|
98
|
+
...(selfieImage ? { documents: { documentFileMetadata: { selfieImage } } } : {}),
|
|
79
99
|
};
|
|
80
100
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DocumentCapturePrompt } from '../components/document/types';
|
|
2
|
+
/**
|
|
3
|
+
* A comparable summary of what auto-capture each document asked for.
|
|
4
|
+
*
|
|
5
|
+
* Resolved rather than compared raw, so a caller who re-spreads an equivalent
|
|
6
|
+
* bag every render (`autoCapture: {}`, or `{ minScore: undefined }`) does not
|
|
7
|
+
* trip the warning — only a change that would actually have configured the
|
|
8
|
+
* engine differently does.
|
|
9
|
+
*
|
|
10
|
+
* PRESENCE is preserved as `null` rather than folded into the resolved
|
|
11
|
+
* defaults, because `undefined` -> `{}` is precisely the late-flag race this
|
|
12
|
+
* exists to catch, and resolving both would make them identical.
|
|
13
|
+
*/
|
|
14
|
+
export declare function autoCaptureSignature(documents: readonly DocumentCapturePrompt[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Warn once if `documents`' auto-capture configuration changes after mount.
|
|
17
|
+
*
|
|
18
|
+
* Warns rather than reconfigures: the change genuinely has no effect, and a
|
|
19
|
+
* caller who cannot see that is the failure mode.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAutoCaptureMountGuard(documents: readonly DocumentCapturePrompt[]): void;
|
|
22
|
+
//# sourceMappingURL=autoCaptureMountGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoCaptureMountGuard.d.ts","sourceRoot":"","sources":["../../src/flows/autoCaptureMountGuard.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,IAAI,CAoBN"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Makes the mount-time-only `autoCapture` contract audible (#351).
|
|
2
|
+
//
|
|
3
|
+
// `DocumentCaptureFlow` builds its controller inside `useState(() => …)` from
|
|
4
|
+
// `documentsRef.current`, and `documentCapture/controller.ts` has no
|
|
5
|
+
// reconfigure path — so `autoCapture` is read once, at mount, and every later
|
|
6
|
+
// change is ignored. A reconfigure path was ruled against: it is real surface
|
|
7
|
+
// on a controller that has none today, bought to serve a race the consumer can
|
|
8
|
+
// simply not have (AMEX's `DocumentCaptureScreen` should gate on `flagsLoaded`,
|
|
9
|
+
// not just `sessionLoaded`).
|
|
10
|
+
//
|
|
11
|
+
// The SILENCE is the expensive half. All four of this repo's cascade-default
|
|
12
|
+
// incidents were "the value was quietly wrong and nothing said so", and this
|
|
13
|
+
// one has the same shape: a capture screen that mounts before the flags land
|
|
14
|
+
// has auto-capture off for that applicant's whole session, with no error and
|
|
15
|
+
// no log. The field-visible half of the same ruling is
|
|
16
|
+
// `autoCaptureStatus: 'disabled:lateFlag'` on the capture metadata.
|
|
17
|
+
import { useEffect, useRef } from 'react';
|
|
18
|
+
import { resolveAutoCapture } from '@idmission/websdk-core/documentCapture';
|
|
19
|
+
import { warn } from '../utils/logger';
|
|
20
|
+
/**
|
|
21
|
+
* A comparable summary of what auto-capture each document asked for.
|
|
22
|
+
*
|
|
23
|
+
* Resolved rather than compared raw, so a caller who re-spreads an equivalent
|
|
24
|
+
* bag every render (`autoCapture: {}`, or `{ minScore: undefined }`) does not
|
|
25
|
+
* trip the warning — only a change that would actually have configured the
|
|
26
|
+
* engine differently does.
|
|
27
|
+
*
|
|
28
|
+
* PRESENCE is preserved as `null` rather than folded into the resolved
|
|
29
|
+
* defaults, because `undefined` -> `{}` is precisely the late-flag race this
|
|
30
|
+
* exists to catch, and resolving both would make them identical.
|
|
31
|
+
*/
|
|
32
|
+
export function autoCaptureSignature(documents) {
|
|
33
|
+
return JSON.stringify(documents.map((document) => document.autoCapture
|
|
34
|
+
? resolveAutoCapture(document.autoCapture, undefined)
|
|
35
|
+
: null));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Warn once if `documents`' auto-capture configuration changes after mount.
|
|
39
|
+
*
|
|
40
|
+
* Warns rather than reconfigures: the change genuinely has no effect, and a
|
|
41
|
+
* caller who cannot see that is the failure mode.
|
|
42
|
+
*/
|
|
43
|
+
export function useAutoCaptureMountGuard(documents) {
|
|
44
|
+
const mounted = useRef(null);
|
|
45
|
+
const warned = useRef(false);
|
|
46
|
+
const signature = autoCaptureSignature(documents);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (mounted.current === null) {
|
|
49
|
+
mounted.current = signature;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (warned.current || signature === mounted.current)
|
|
53
|
+
return;
|
|
54
|
+
warned.current = true;
|
|
55
|
+
warn('[DocumentCaptureFlow] `autoCapture` changed after mount and has been ' +
|
|
56
|
+
'ignored: the controller is built once and has no reconfigure path. ' +
|
|
57
|
+
'Mount this flow only once the value is known — if it comes from a ' +
|
|
58
|
+
'feature flag, gate the screen on the flags having loaded, not just ' +
|
|
59
|
+
'the session.');
|
|
60
|
+
}, [signature]);
|
|
61
|
+
}
|