@idmission/websdk-ui 0.2.0 → 0.6.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.
Files changed (200) hide show
  1. package/README.md +75 -4
  2. package/dist/DocumentCaptureView.d.ts +7 -5
  3. package/dist/DocumentCaptureView.d.ts.map +1 -1
  4. package/dist/DocumentCaptureView.js +30 -26
  5. package/dist/FaceLivenessView.d.ts +2 -2
  6. package/dist/FaceLivenessView.d.ts.map +1 -1
  7. package/dist/FaceLivenessView.js +47 -13
  8. package/dist/IdCaptureView.d.ts +27 -15
  9. package/dist/IdCaptureView.d.ts.map +1 -1
  10. package/dist/IdCaptureView.js +149 -26
  11. package/dist/SelfieCaptureView.d.ts +18 -1
  12. package/dist/SelfieCaptureView.d.ts.map +1 -1
  13. package/dist/SelfieCaptureView.js +13 -4
  14. package/dist/SignatureCaptureView.d.ts +18 -5
  15. package/dist/SignatureCaptureView.d.ts.map +1 -1
  16. package/dist/SignatureCaptureView.js +90 -15
  17. package/dist/VideoIdCaptureView.d.ts +14 -2
  18. package/dist/VideoIdCaptureView.d.ts.map +1 -1
  19. package/dist/VideoIdCaptureView.js +13 -6
  20. package/dist/bindings/useDocumentCapture.d.ts.map +1 -1
  21. package/dist/bindings/useDocumentCapture.js +2 -1
  22. package/dist/bindings/useIdCapture.d.ts.map +1 -1
  23. package/dist/bindings/useIdCapture.js +2 -1
  24. package/dist/bindings/useSelfieCapture.d.ts.map +1 -1
  25. package/dist/bindings/useSelfieCapture.js +2 -1
  26. package/dist/bindings/useSignatureCapture.d.ts.map +1 -1
  27. package/dist/bindings/useSignatureCapture.js +2 -1
  28. package/dist/bindings/useVideoIdCapture.d.ts.map +1 -1
  29. package/dist/bindings/useVideoIdCapture.js +2 -1
  30. package/dist/components/common/BrowserEdgeTint.d.ts +63 -0
  31. package/dist/components/common/BrowserEdgeTint.d.ts.map +1 -0
  32. package/dist/components/common/BrowserEdgeTint.js +111 -0
  33. package/dist/components/common/LoaderButton.d.ts +9 -0
  34. package/dist/components/common/LoaderButton.d.ts.map +1 -1
  35. package/dist/components/common/LoaderButton.js +44 -321
  36. package/dist/components/common/ScreenReaderStatus.d.ts +8 -0
  37. package/dist/components/common/ScreenReaderStatus.d.ts.map +1 -0
  38. package/dist/components/common/ScreenReaderStatus.js +18 -0
  39. package/dist/components/common/overlay.d.ts +6 -0
  40. package/dist/components/common/overlay.d.ts.map +1 -1
  41. package/dist/components/common/overlay.js +7 -1
  42. package/dist/components/debug/debug.d.ts +6 -0
  43. package/dist/components/debug/debug.d.ts.map +1 -1
  44. package/dist/components/debug/debug.js +5 -1
  45. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -1
  46. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +4 -5
  47. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -1
  48. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +40 -13
  49. package/dist/components/error/CameraAccessDeniedOverlay.d.ts +8 -1
  50. package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
  51. package/dist/components/error/useCameraAccessDeniedReport.d.ts +12 -0
  52. package/dist/components/error/useCameraAccessDeniedReport.d.ts.map +1 -0
  53. package/dist/components/error/useCameraAccessDeniedReport.js +31 -0
  54. package/dist/components/face_liveness/FaceLivenessFailure.d.ts +4 -1
  55. package/dist/components/face_liveness/FaceLivenessFailure.d.ts.map +1 -1
  56. package/dist/components/face_liveness/FaceLivenessFailure.js +4 -2
  57. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +4 -1
  58. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts.map +1 -1
  59. package/dist/components/face_liveness/FaceLivenessSuccess.js +6 -2
  60. package/dist/components/guides/IdCaptureFitGuide.d.ts +2 -0
  61. package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
  62. package/dist/components/guides/IdCaptureFitGuide.js +4 -1
  63. package/dist/components/guides/IdCaptureGuideOverlay.d.ts +2 -0
  64. package/dist/components/guides/IdCaptureGuideOverlay.d.ts.map +1 -1
  65. package/dist/components/guides/IdCaptureGuideOverlay.js +3 -1
  66. package/dist/components/guides/IdCaptureGuides.d.ts +14 -0
  67. package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
  68. package/dist/components/guides/IdCaptureGuides.js +22 -7
  69. package/dist/components/guides/IdCaptureGuidesCommon.d.ts.map +1 -1
  70. package/dist/components/guides/IdCaptureGuidesCommon.js +12 -7
  71. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts +9 -0
  72. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
  73. package/dist/components/loading/IdCaptureLoadingOverlayDefault.js +26 -4
  74. package/dist/components/loading/RingIntroScreen.d.ts.map +1 -1
  75. package/dist/components/loading/RingIntroScreen.js +4 -34
  76. package/dist/components/review/ReviewScreen.d.ts +10 -1
  77. package/dist/components/review/ReviewScreen.d.ts.map +1 -1
  78. package/dist/components/review/ReviewScreen.js +8 -8
  79. package/dist/components/review/SignatureCaptureDiagnostics.d.ts +5 -1
  80. package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -1
  81. package/dist/components/review/SignatureCaptureDiagnostics.js +4 -2
  82. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts +9 -2
  83. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts.map +1 -1
  84. package/dist/components/selfie/FaceCaptureGuideOverlay.js +10 -4
  85. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts +8 -1
  86. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts.map +1 -1
  87. package/dist/components/selfie/SelfieCaptureAnimatedMask.js +55 -21
  88. package/dist/components/selfie/SelfieCaptureSurface.d.ts +9 -2
  89. package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
  90. package/dist/components/selfie/SelfieCaptureSurface.js +77 -16
  91. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts +9 -0
  92. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
  93. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.js +26 -4
  94. package/dist/flows/AuthStateContext.d.ts.map +1 -1
  95. package/dist/flows/AuthStateContext.js +2 -1
  96. package/dist/flows/CaptureProgress.d.ts +14 -0
  97. package/dist/flows/CaptureProgress.d.ts.map +1 -0
  98. package/dist/flows/CaptureProgress.js +51 -0
  99. package/dist/flows/CompositeWizard.d.ts +7 -1
  100. package/dist/flows/CompositeWizard.d.ts.map +1 -1
  101. package/dist/flows/CompositeWizard.js +6 -2
  102. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +3 -3
  103. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
  104. package/dist/flows/CustomerBiometricsEnrollmentFlow.js +26 -4
  105. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +3 -3
  106. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
  107. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +45 -9
  108. package/dist/flows/DocumentCaptureFlow.d.ts +4 -3
  109. package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
  110. package/dist/flows/DocumentCaptureFlow.js +14 -8
  111. package/dist/flows/FaceValidationFlow.d.ts +2 -2
  112. package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
  113. package/dist/flows/FaceValidationFlow.js +7 -2
  114. package/dist/flows/FlowChassis.d.ts +19 -1
  115. package/dist/flows/FlowChassis.d.ts.map +1 -1
  116. package/dist/flows/FlowChassis.js +40 -4
  117. package/dist/flows/IdAndFaceValidationFlow.d.ts +3 -3
  118. package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
  119. package/dist/flows/IdAndFaceValidationFlow.js +33 -3
  120. package/dist/flows/IdValidationFlow.d.ts +10 -5
  121. package/dist/flows/IdValidationFlow.d.ts.map +1 -1
  122. package/dist/flows/IdValidationFlow.js +32 -5
  123. package/dist/flows/SignatureKYCFlow.d.ts +43 -7
  124. package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
  125. package/dist/flows/SignatureKYCFlow.js +154 -16
  126. package/dist/flows/SubmissionProvider.d.ts +12 -3
  127. package/dist/flows/SubmissionProvider.d.ts.map +1 -1
  128. package/dist/flows/SubmissionProvider.js +142 -16
  129. package/dist/flows/VideoIdValidationFlow.d.ts +3 -5
  130. package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
  131. package/dist/flows/VideoIdValidationFlow.js +38 -4
  132. package/dist/flows/additionalDocuments.d.ts.map +1 -1
  133. package/dist/flows/additionalDocuments.js +3 -6
  134. package/dist/flows/approval.d.ts +1 -14
  135. package/dist/flows/approval.d.ts.map +1 -1
  136. package/dist/flows/approval.js +1 -19
  137. package/dist/flows/artifacts.d.ts +1 -1
  138. package/dist/flows/artifacts.d.ts.map +1 -1
  139. package/dist/flows/artifacts.js +29 -9
  140. package/dist/flows/customerMatch/CustomerMatchCapture.d.ts +3 -2
  141. package/dist/flows/customerMatch/CustomerMatchCapture.d.ts.map +1 -1
  142. package/dist/flows/customerMatch/CustomerMatchCapture.js +3 -2
  143. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts +13 -4
  144. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
  145. package/dist/flows/customerMatch/CustomerMatchFlow.js +17 -12
  146. package/dist/flows/flowSettings.d.ts +11 -0
  147. package/dist/flows/flowSettings.d.ts.map +1 -0
  148. package/dist/flows/flowSettings.js +20 -0
  149. package/dist/flows/ringScreens.d.ts +1 -0
  150. package/dist/flows/ringScreens.d.ts.map +1 -1
  151. package/dist/flows/ringScreens.js +17 -2
  152. package/dist/flows/signatureStep.d.ts +6 -1
  153. package/dist/flows/signatureStep.d.ts.map +1 -1
  154. package/dist/flows/types.d.ts +120 -10
  155. package/dist/flows/types.d.ts.map +1 -1
  156. package/dist/flows/videoIdSteps.d.ts +2 -2
  157. package/dist/flows/videoIdSteps.d.ts.map +1 -1
  158. package/dist/guidance/selfieStrings.d.ts.map +1 -1
  159. package/dist/guidance/selfieStrings.js +8 -4
  160. package/dist/guidance/strings.d.ts +34 -1
  161. package/dist/guidance/strings.d.ts.map +1 -1
  162. package/dist/guidance/strings.js +39 -0
  163. package/dist/i18n/index.d.ts +5 -1
  164. package/dist/i18n/index.d.ts.map +1 -1
  165. package/dist/i18n/index.js +13 -2
  166. package/dist/i18n/locales/threeOh.d.ts.map +1 -1
  167. package/dist/i18n/locales/threeOh.js +56 -2
  168. package/dist/index.d.ts +9 -6
  169. package/dist/index.d.ts.map +1 -1
  170. package/dist/index.js +3 -0
  171. package/dist/testing/autoCaptureFrames.d.ts.map +1 -1
  172. package/dist/testing/autoCaptureFrames.js +10 -4
  173. package/dist/testing/buildSelfieState.d.ts.map +1 -1
  174. package/dist/testing/buildSelfieState.js +5 -0
  175. package/dist/testing/classNamesLeaves.js +1 -1
  176. package/dist/testing/fakeClient.d.ts +41 -2
  177. package/dist/testing/fakeClient.d.ts.map +1 -1
  178. package/dist/testing/fakeClient.js +71 -16
  179. package/dist/testing/fakeSelfieController.d.ts.map +1 -1
  180. package/dist/testing/fakeSelfieController.js +7 -0
  181. package/dist/testing/index.d.ts +1 -1
  182. package/dist/testing/index.d.ts.map +1 -1
  183. package/dist/testing/index.js +1 -1
  184. package/dist/theme/index.d.ts +10 -0
  185. package/dist/theme/index.d.ts.map +1 -1
  186. package/dist/useDocumentUpload.d.ts +63 -0
  187. package/dist/useDocumentUpload.d.ts.map +1 -0
  188. package/dist/useDocumentUpload.js +45 -0
  189. package/dist/useIdmissionClient.d.ts +24 -3
  190. package/dist/useIdmissionClient.d.ts.map +1 -1
  191. package/dist/useIdmissionClient.js +46 -0
  192. package/dist/utils/mountOnly.d.ts +25 -0
  193. package/dist/utils/mountOnly.d.ts.map +1 -0
  194. package/dist/utils/mountOnly.js +111 -0
  195. package/dist/version.d.ts +1 -1
  196. package/dist/version.js +1 -1
  197. package/package.json +10 -9
  198. package/dist/flows/autoCaptureMountGuard.d.ts +0 -22
  199. package/dist/flows/autoCaptureMountGuard.d.ts.map +0 -1
  200. package/dist/flows/autoCaptureMountGuard.js +0 -61
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCaptureProgressController, useDisplayedGuidance } from './flows/CaptureProgress';
2
3
  // Task 12: the phase-switched assembly. Everything Tasks 2-11 built (the
3
4
  // headless controller + bindings, layout contexts, camera feed, guidance
4
5
  // pills, guide router, loading overlay family, review/error screens) is
@@ -33,23 +34,33 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
33
34
  // (core's own `flipConfirmation: 'manual'` config knob is the
34
35
  // controller-side equivalent — see controller.ts). ExitCaptureButton only
35
36
  // renders when the host passes `onExit`; an inert X button would be worse
36
- // than none.
37
- import { useCallback, useEffect, useRef, useState, } from 'react';
38
- import { styled } from 'styled-components';
37
+ // than none. It is otherwise gated exactly as sdk2 gated it
38
+ // (`!customOverlayContent || overlayDismissed`) and, like sdk2's, its
39
+ // click tears the capture down before notifying the host — see
40
+ // `handleExit`. Both of those were dropped in the first port and are
41
+ // restored; the bind gate is the only intended divergence.
42
+ import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
43
+ import { styled, useTheme } from 'styled-components';
39
44
  import { useIdCapture } from './bindings/useIdCapture';
40
- import { SdkLanguageProvider, useLanguage, useSdkTranslation, } from './i18n';
45
+ import { SdkLanguageProvider, useLanguage, useVerbiage, } from './i18n';
41
46
  import { GuideLayoutProvider, useGuideLayout } from './layout/GuideLayoutContext';
42
47
  import GuideOrientationContextProvider from './layout/GuideOrientationContext';
43
48
  import { isCameraFeedHidden, ScalingCameraFeed, } from './components/CameraFeed';
44
- import { DebugBoundingBoxOverlay, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
49
+ import { DebugBoundingBoxOverlay, CameraDebugStatus, DebugStatsPane, IdCaptureDetectedObjectDebugBox, useDebugScalingDetails, } from './components/debug/debug';
50
+ import { BrowserEdgeTint, opaqueColor, } from './components/common/BrowserEdgeTint';
51
+ import { GRAY_OVERLAY_BACKGROUND } from './components/common/overlay';
52
+ import { FIT_GUIDE_MASK_DEFAULT } from './components/guides/IdCaptureFitGuide';
53
+ import { OVERLAY_GUIDE_MASK_DEFAULT } from './components/guides/IdCaptureGuideOverlay';
54
+ import { LOADING_OVERLAY_BACKGROUND_DEFAULT, loadingOverlayBottomEdgeColor, } from './components/loading/IdCaptureLoadingOverlayDefault';
45
55
  import { IdCaptureGuides, } from './components/guides/IdCaptureGuides';
46
56
  import { PlacedGuidanceMessageContainer, GuidanceMessage, } from './components/GuidanceMessage';
47
- import { guidanceMessageKey } from './guidance/strings';
57
+ import { guidanceMessageKey, guidanceVerbiage, } from './guidance/strings';
48
58
  import { ExitCaptureButton } from './components/ExitCaptureButton';
49
59
  import { OverrideWrongDocumentTypeDialog, } from './components/OverrideWrongDocumentTypeDialog';
50
60
  import { IdCaptureLoadingOverlay, } from './components/loading/IdCaptureLoadingOverlay';
51
61
  import { ReviewScreen, } from './components/review/ReviewScreen';
52
62
  import { ErrorScreen, } from './components/error/ErrorScreen';
63
+ import { useCameraAccessDeniedReport } from './components/error/useCameraAccessDeniedReport';
53
64
  import { IdCaptureFallback, } from './components/fallback/IdCaptureFallback';
54
65
  import { IdCaptureOrUploadScreen, } from './components/fallback/IdCaptureOrUploadScreen';
55
66
  import { useShowSuccessScreen, } from './flows/useShowSuccessScreen';
@@ -88,7 +99,7 @@ const REVIEW_PHASES = new Set([
88
99
  export function IdCaptureView(props) {
89
100
  return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(IdCaptureViewContent, { ...props }) }));
90
101
  }
91
- function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMode = 'default', cameraFeedMode = 'snapToGuides', guideBoxDisabled = false, forceFallbackMode = false, silentFallback = false, allowUploadingDocumentsFromStorage = false, portraitGuidesOnMobile = true, rotateLoadingOverlayImageWhenPortrait = true, guideBoxFollowsMask = false, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, guidanceMessagePlacement = 'viewport', guidanceMessageGap = 8, flipReview = false, sessionReady: sessionReadyProp, skipSuccessScreen = false, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, debugMode = false, onExit, onUserCancel, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, customOverlayContent, instructions, onCameraTamperingDetected, onCameraAccessDenied, onModelError, onExitAfterTamperSealPopped, onDocumentStored, onRetry, onSubmitted, onCollected, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
102
+ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMode = 'default', cameraFeedMode = 'snapToGuides', guideBoxDisabled = false, forceFallbackMode = false, silentFallback = false, allowUploadingDocumentsFromStorage = false, portraitGuidesOnMobile = true, rotateLoadingOverlayImageWhenPortrait = true, guideBoxFollowsMask = false, guideBoxBorderRadius, guideBoxMaxWidth, guideBoxMaxHeight, guidanceMessagePlacement = 'viewport', guidanceMessageGap = 8, flipReview = false, showBarcodeImage = true, sessionReady: sessionReadyProp, skipSuccessScreen = false, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, debugMode = false, onExit, onUserCancel, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, customOverlayContent, instructions, onCameraTamperingDetected, onCameraAccessDenied, onModelError, onExitAfterTamperSealPopped, onDocumentStored, onRetry, onSubmitted, onCollected, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
92
103
  // Omitted means "follow the session": mounted inside a flow this view now
93
104
  // renders during session validation, so its own loading overlay is the one
94
105
  // loading surface (2.x behaviour — see useSessionReady). An explicit prop
@@ -96,8 +107,9 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
96
107
  const sessionFromContext = useSessionReady();
97
108
  const sessionReady = sessionReadyProp ?? sessionFromContext;
98
109
  useLanguage(lang);
99
- const { t } = useSdkTranslation();
100
110
  const state = useIdCapture(controller);
111
+ useCaptureProgressController(controller);
112
+ const theme = useTheme();
101
113
  // Ref-callback + an effect keyed only on [controller]: the ref callback
102
114
  // (fired during React's commit phase, before effects) populates
103
115
  // `videoElRef` synchronously; by the time this effect body runs the video
@@ -167,6 +179,46 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
167
179
  controller.actions.start();
168
180
  onLoadingOverlayDismissed?.();
169
181
  }, [controller, onLoadingOverlayDismissed]);
182
+ /** Bumped on every exit to remount the loading overlay; see `handleExit`. */
183
+ const [exitAttempt, setExitAttempt] = useState(0);
184
+ /**
185
+ * Exit has to TEAR THE CAPTURE DOWN before it tells the host, which the port
186
+ * dropped: `onExit` was handed to ExitCaptureButton raw, so the X notified
187
+ * the host and left the session exactly as it was — camera live, pipeline
188
+ * running, overlay still dismissed. Hosts that reset their own chrome and
189
+ * expect to land back on the instructions (portal-2's `onExitCapture` is
190
+ * one) got a host reset behind a capture that never stopped, and the
191
+ * applicant could not get out.
192
+ *
193
+ * sdk2 did the teardown inside the wizard (IdCaptureWizard.tsx:1130-1137):
194
+ * reset the wizard, put the loading overlay back up, then call the host.
195
+ * Same three steps here, with `retake()` standing in for sdk2's bare
196
+ * `dispatchIdCaptureAction({ type: 'resetWizard' })` — it is that dispatch
197
+ * plus `pipeline.resetBestFrame()`, which is what stops a half-captured
198
+ * frame surviving the exit.
199
+ *
200
+ * sdk2's `key={`loading${attempt}`}` remount IS needed, and `exitAttempt`
201
+ * is it. Clearing this component's `overlayDismissed` is not enough on its
202
+ * own: the overlay variants keep their OWN `dismissed` state and self-hide
203
+ * on it (IdCaptureLoadingOverlayDefault.tsx:186), and `showLoadingOverlay`
204
+ * does not necessarily go false in between — while `state.phase` is still
205
+ * 'initializing' it stays true and the overlay is never unmounted, so its
206
+ * internal flag survives and it renders empty forever. Remounting is what
207
+ * resets that flag, and the auto-continue guard along with it.
208
+ *
209
+ * sdk2's camera cycle (`releaseCameraAccess()` / `requestCameraAccess()`)
210
+ * is the one step not ported: that was wizard-owned camera management the
211
+ * controller now owns, and re-acquiring here risks a second permission
212
+ * prompt.
213
+ */
214
+ const handleExit = useCallback(() => {
215
+ if (onExit == null)
216
+ return;
217
+ controller.actions.retake();
218
+ setOverlayDismissed(false);
219
+ setExitAttempt((n) => n + 1);
220
+ onExit();
221
+ }, [controller, onExit]);
170
222
  // Per-document progress, ported from sdk2's onDocumentStored effect
171
223
  // (IdCaptureWizard.tsx:342-372). Diffs capturedDocuments against what has
172
224
  // already been announced, comparing by IDENTITY rather than presence: a
@@ -182,7 +234,6 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
182
234
  const pendingPrecapturedRef = useRef(new Set());
183
235
  const seenPrecapturedRef = useRef(new Set());
184
236
  const tamperReportedRef = useRef(false);
185
- const cameraDeniedReportedRef = useRef(false);
186
237
  const reportedModelErrorRef = useRef(null);
187
238
  // A new controller is a new session, so every notification latch below has
188
239
  // to start over — the same reasoning as the attach and overlay-dismissal
@@ -200,7 +251,6 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
200
251
  pendingPrecapturedRef.current = new Set();
201
252
  seenPrecapturedRef.current = new Set();
202
253
  tamperReportedRef.current = false;
203
- cameraDeniedReportedRef.current = false;
204
254
  reportedModelErrorRef.current = null;
205
255
  }, [controller]);
206
256
  useEffect(() => {
@@ -260,17 +310,7 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
260
310
  // controller's typed error, which is where core lands a denied camera and a
261
311
  // failed model load alike (dual-truth contract: the same failure is already
262
312
  // on screen, so these are notifications, not the error UI).
263
- const cameraDenied = state.error?.code === 'CAMERA_PERMISSION_DENIED';
264
- useEffect(() => {
265
- if (!cameraDenied) {
266
- cameraDeniedReportedRef.current = false;
267
- return;
268
- }
269
- if (cameraDeniedReportedRef.current)
270
- return;
271
- cameraDeniedReportedRef.current = true;
272
- onCameraAccessDenied?.();
273
- }, [controller, cameraDenied, onCameraAccessDenied]);
313
+ useCameraAccessDeniedReport(controller, state.error?.code, onCameraAccessDenied);
274
314
  // Keyed on the ERROR OBJECT's identity, not on its cause: a MODEL_LOAD_FAILED
275
315
  // with no cause attached is still a model failure the host asked to hear
276
316
  // about, and keying on the cause skipped those entirely. A second, different
@@ -336,8 +376,18 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
336
376
  // '' (guidanceMessageKey maps the held NONE code to ''). Text and variant
337
377
  // both read the same held event, so the pill's background always describes
338
378
  // the message it is showing.
379
+ //
380
+ // The per-document bag is chosen the way sdk2's wizard chose it
381
+ // (IdCaptureWizard.tsx:1183-1190): the requested document, except during
382
+ // barcode recapture, which is always the back of the card.
383
+ const documentVerbiage = documentVerbiageFor(verbiage, state.phase === 'requestingBetterBarcode'
384
+ ? 'idCardBack'
385
+ : state.requestedDocumentType);
339
386
  const guidanceKey = guidanceMessageKey(state.guidance);
340
- const showGuidancePill = overlayDismissed && state.phase === 'capturing' && guidanceKey !== '';
387
+ const guidanceText = useVerbiage(guidanceKey === '' ? undefined : guidanceVerbiage(documentVerbiage, state.guidance.code), guidanceKey);
388
+ const showGuidancePill = overlayDismissed && state.phase === 'capturing' && guidanceText !== '';
389
+ useDisplayedGuidance(showGuidancePill && !screenTakeover && state.guidance.code !== 'NONE' ? { kind: 'displayed', message: { family: 'id', code: state.guidance.code } } : { kind: 'no-prompt' });
390
+ const guidesVerbiage = useMemo(() => withDocumentInstructions(verbiage.guides, documentVerbiage), [verbiage.guides, documentVerbiage]);
341
391
  // The overlay stacks on top of the capture/guide screen exactly like
342
392
  // sdk2's wizard (never simultaneously with review/error) — plus phase
343
393
  // 'initializing' forces it regardless (nothing to dismiss into yet).
@@ -367,6 +417,54 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
367
417
  const showReview = !screenTakeover &&
368
418
  (isFlipInterstitial ||
369
419
  (REVIEW_PHASES.has(state.phase) && showSuccessScreen));
420
+ /**
421
+ * The colours touching the viewport edges, for iOS Safari to tint its own
422
+ * bars with — see `BrowserEdgeTint`. The camera surround, the loading
423
+ * overlay and the review are different colours on one route to the host, so
424
+ * only this view knows which is up.
425
+ *
426
+ * It follows EVERY screen while the view owns the viewport, not just the
427
+ * camera: Safari keeps the last strip colour when the strips leave while a
428
+ * full-viewport surface stays up, so dropping them on exit would leave the
429
+ * camera's dark bars over the light loading overlay. Null when embedded
430
+ * (`isFullscreen: false`), so a host's page chrome stays the host's, and for
431
+ * the ring overlay, whose gradient no single colour matches.
432
+ *
433
+ * The default loading overlay is the one screen whose edges differ: it ends
434
+ * in its progress row, part filled while it loads, so no flat strip can sit
435
+ * on it unseen. Its bottom strip carries the row's colour for Safari but is
436
+ * drawn invisibly — opaque, it covered the bottom 12px of the bar.
437
+ */
438
+ const browserEdge = (() => {
439
+ if (theme.isFullscreen === false)
440
+ return null;
441
+ if (screenTakeover)
442
+ return { color: theme.background ?? '#fff' };
443
+ if (showReview || (state.phase === 'error' && state.error !== null)) {
444
+ return { color: GRAY_OVERLAY_BACKGROUND };
445
+ }
446
+ if (showLoadingOverlay) {
447
+ if (loadingOverlayMode === 'ring')
448
+ return null;
449
+ return {
450
+ color: theme.idCapture?.loadingOverlay?.backgroundColor ??
451
+ LOADING_OVERLAY_BACKGROUND_DEFAULT,
452
+ hiddenBottomColor: loadingOverlayMode === 'default'
453
+ ? loadingOverlayBottomEdgeColor(theme, state.models.ready)
454
+ : undefined,
455
+ };
456
+ }
457
+ if (showGuides) {
458
+ // The mask can be translucent (the overlay guide's default scrim) and
459
+ // the strips must not be. Same hue, alpha dropped.
460
+ const color = opaqueColor(theme.idCapture?.guideOverlay?.backgroundColor ??
461
+ (guideType === 'fit'
462
+ ? FIT_GUIDE_MASK_DEFAULT
463
+ : OVERLAY_GUIDE_MASK_DEFAULT));
464
+ return color ? { color } : null;
465
+ }
466
+ return null;
467
+ })();
370
468
  const handleConfirmFlip = useCallback(() => {
371
469
  controller.actions.confirmFlip();
372
470
  }, [controller]);
@@ -413,7 +511,11 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
413
511
  return (_jsx(FontCarrier, { children: _jsx(GuideOrientationContextProvider, { children: _jsxs(GuideLayoutProvider, { children: [_jsx(ScalingCameraFeed, { videoRef: setVideoRef, phase: state.phase, isRearFacing: state.camera.isRearFacing, cameraFeedMode: cameraFeedMode, className: classNames.cameraFeed }), inFallbackMode && (_jsx(IdCaptureFallback, { captureRequirement: state.captureRequirement, idCardBackCaptureRequired: state.idCardBackCaptureRequired, silentFallback: silentFallback, onCapture: handleManualImages('Manual'), onFinished: () => setFallbackFinished(true), classNames: classNames.fallback, colors: colors.fallback, verbiage: verbiage.fallback })), showUploadChoice && (_jsx(IdCaptureOrUploadScreen, { captureRequirement: state.captureRequirement, idCardBackCaptureRequired: state.idCardBackCaptureRequired, onCaptureWithCamera: () => {
414
512
  setUploadChoiceMade(true);
415
513
  void controller.actions.requestCamera().catch(() => { });
416
- }, onUpload: handleManualImages('Upload'), onFinished: () => setUploadChoiceMade(true), classNames: classNames.uploadOrCaptureScreen, colors: colors.uploadOrCaptureScreen, verbiage: verbiage.uploadOrCaptureScreen })), showGuides && (_jsx(IdCaptureGuides, { state: state, isRearFacing: state.camera.isRearFacing, guideType: guideType, guideBoxDisabled: guideBoxDisabled, portraitGuidesOnMobile: portraitGuidesOnMobile, guideBoxFollowsMask: guideBoxFollowsMask, guideBoxBorderRadius: guideBoxBorderRadius, guideBoxMaxWidth: guideBoxMaxWidth, guideBoxMaxHeight: guideBoxMaxHeight, cameraFeedMode: cameraFeedMode, images: assets.guideImages, classNames: classNames.guides, verbiage: verbiage.guides, status: !overlayDismissed ? 'disabled' : undefined })), showGuidancePill && (_jsx(PlacedGuidanceMessageContainer, { placement: guidanceMessagePlacement, gap: guidanceMessageGap, className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": state.guidance.satisfied ? 'positive' : 'default', className: classNames.guidanceMessage, "data-guidance-code": state.guidance.code, children: t(guidanceKey) }) })), state.phase !== 'complete' && _jsx("div", { id: "idmission-above-guides-content" }), debugMode && overlayDismissed && showGuides && (_jsx(IdCaptureDebugLayer, { state: state })), onExit != null && (_jsx(ExitCaptureButton, { onClick: onExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(IdCaptureLoadingOverlay, { state: state, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, rotateImage: rotateOverlayImage, onUserCancel: onUserCancel, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onDismissed: handleLoadingOverlayDismissed, customOverlayContent: customOverlayContent, instructions: instructions, onRequestCamera: () => controller.actions.requestCamera() })), _jsx(OverrideWrongDocumentTypeDialog, { visible: state.allowOverrideWrongDocumentTypeGuidance, onOverride: handleOverride, classNames: classNames.overrideWrongDocumentType, verbiage: verbiage.overrideWrongDocumentType }), showReview && (_jsx(ReviewScreen, { capturedDocuments: state.capturedDocuments, submission: isFlipInterstitial ? 'idle' : state.submission, sessionReady: sessionReady, diagnostics: debugMode && !isFlipInterstitial
514
+ }, onUpload: handleManualImages('Upload'), onFinished: () => setUploadChoiceMade(true), classNames: classNames.uploadOrCaptureScreen, colors: colors.uploadOrCaptureScreen, verbiage: verbiage.uploadOrCaptureScreen })), showGuides && (_jsx(IdCaptureGuides, { state: state, isRearFacing: state.camera.isRearFacing, guideType: guideType, guideBoxDisabled: guideBoxDisabled, portraitGuidesOnMobile: portraitGuidesOnMobile, guideBoxFollowsMask: guideBoxFollowsMask, guideBoxBorderRadius: guideBoxBorderRadius, guideBoxMaxWidth: guideBoxMaxWidth, guideBoxMaxHeight: guideBoxMaxHeight, cameraFeedMode: cameraFeedMode, images: assets.guideImages, classNames: classNames.guides, verbiage: guidesVerbiage, status: !overlayDismissed ? 'disabled' : undefined })), showGuidancePill && (_jsx(PlacedGuidanceMessageContainer, { placement: guidanceMessagePlacement, gap: guidanceMessageGap, className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": state.guidance.satisfied ? 'positive' : 'default', className: classNames.guidanceMessage, "data-guidance-code": state.guidance.code, children: guidanceText }) })), state.phase !== 'complete' && _jsx("div", { id: "idmission-above-guides-content" }), debugMode && overlayDismissed && showGuides && (_jsx(IdCaptureDebugLayer, { state: state })), onExit != null && (!customOverlayContent || overlayDismissed) && (_jsx(ExitCaptureButton, { onClick: handleExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(IdCaptureLoadingOverlay
515
+ // sdk2's `key={`loading${attempt}`}` (IdCaptureWizard.tsx:1625):
516
+ // forces a fresh overlay after an exit so its internal
517
+ // `dismissed` flag cannot survive into the new attempt.
518
+ , { state: state, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, rotateImage: rotateOverlayImage, onUserCancel: onUserCancel, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onDismissed: handleLoadingOverlayDismissed, customOverlayContent: customOverlayContent, instructions: instructions, onRequestCamera: () => controller.actions.requestCamera() }, `loading${exitAttempt}`)), _jsx(OverrideWrongDocumentTypeDialog, { visible: state.allowOverrideWrongDocumentTypeGuidance, onOverride: handleOverride, classNames: classNames.overrideWrongDocumentType, verbiage: verbiage.overrideWrongDocumentType }), showReview && (_jsx(ReviewScreen, { capturedDocuments: state.capturedDocuments, showBarcodeImage: showBarcodeImage, submission: isFlipInterstitial ? 'idle' : state.submission, sessionReady: sessionReady, diagnostics: debugMode && !isFlipInterstitial
417
519
  ? {
418
520
  initialBarcodeScore: state.recaptureBarcodeScore !== null
419
521
  ? state.initialBarcodeScore
@@ -428,7 +530,7 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
428
530
  pdf417LowScoreCount: state.pdf417LowScoreCount,
429
531
  zxingParseAttemptCount: state.zxingParseAttemptCount,
430
532
  }
431
- : undefined, onSubmit: isFlipInterstitial ? handleConfirmFlip : handleSubmit, onRetry: handleRetake, verbiage: isFlipInterstitial ? reviewFlipVerbiage : verbiage.review, classNames: classNames.review })), !screenTakeover && state.phase === 'error' && state.error !== null && (_jsx(ErrorScreen, { error: state.error, onRetry: handleRetry, onExit: state.error.code === 'CAMERA_TAMPERING_SUSPECTED'
533
+ : undefined, onSubmit: isFlipInterstitial ? handleConfirmFlip : handleSubmit, onRetry: handleRetake, verbiage: isFlipInterstitial ? reviewFlipVerbiage : verbiage.review, classNames: classNames.review, colors: colors.review })), !screenTakeover && state.phase === 'error' && state.error !== null && (_jsx(ErrorScreen, { error: state.error, onRetry: handleRetry, onExit: state.error.code === 'CAMERA_TAMPERING_SUSPECTED'
432
534
  ? onExitAfterTamperSealPopped
433
535
  : undefined, verbiage: verbiage.error, classNames: classNames.error,
434
536
  // 2.x styled/translated the camera-denied screen through the
@@ -439,7 +541,28 @@ function IdCaptureViewContent({ controller, guideType = 'fit', loadingOverlayMod
439
541
  classNames: classNames.loadingOverlay?.cameraAccessDenied,
440
542
  colors: colors.loadingOverlay?.cameraAccessDenied,
441
543
  verbiage: verbiage.loadingOverlay?.cameraAccessDenied,
442
- } }))] }) }) }));
544
+ } })), browserEdge && _jsx(BrowserEdgeTint, { ...browserEdge })] }) }) }));
545
+ }
546
+ function documentVerbiageFor(verbiage, documentType) {
547
+ if (documentType === 'idCardFront')
548
+ return verbiage.idCardFront;
549
+ if (documentType === 'idCardBack')
550
+ return verbiage.idCardBack;
551
+ if (documentType === 'passport')
552
+ return verbiage.passport;
553
+ return undefined;
554
+ }
555
+ /** The guides' bag with the document's instruction copy laid over it. A key
556
+ * the document leaves unset keeps whatever `guides` says. */
557
+ function withDocumentInstructions(guides, document) {
558
+ if (!document)
559
+ return guides;
560
+ const merged = { ...guides };
561
+ for (const key of ['instructionText', 'capturingText', 'captureFailedText']) {
562
+ if (document[key] !== undefined)
563
+ merged[key] = document[key];
564
+ }
565
+ return merged;
443
566
  }
444
567
  // Debug overlay + stats pane, sourced from sdk2 IdCapture.tsx:333-353
445
568
  // (per-detected-object boxes, anchored to the guide rect via
@@ -480,7 +603,7 @@ function IdCaptureDebugLayer({ state, }) {
480
603
  const isBarcode = obj.label === 'PDF417';
481
604
  const color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
482
605
  return (_jsx(IdCaptureDetectedObjectDebugBox, { obj: obj, scaling: scaling, flipX: !isRearFacing, color: color }, i));
483
- }) }), _jsxs(DebugStatsPane, { children: [state.camera.ready ? (_jsxs(_Fragment, { children: ["\u2705 Camera ready (", state.videoWidth, "x", state.videoHeight, ")"] })) : ('❌ Camera not ready'), _jsx("br", {}), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, " fps", _jsx("br", {}), state.models.ready ? (_jsxs(_Fragment, { children: [state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type:", ' ', state.detectedDocumentType, _jsx("br", {}), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), _jsx("br", {}), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), _jsx("br", {}), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score:", ' ', state.passportDetectionScore.toFixed(3), _jsx("br", {}), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), _jsx("br", {}), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), _jsx("br", {}), state.enableFingerOcclusionGuidance && (_jsxs(_Fragment, { children: [state.fingersOccludingDocument ? '❌' : '✅', " Max Finger Score:", ' ', Math.max(0, ...state.detectedObjects
606
+ }) }), _jsxs(DebugStatsPane, { children: [_jsx(CameraDebugStatus, { ready: state.camera.ready, width: state.videoWidth, height: state.videoHeight }), _jsx("br", {}), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, " fps", _jsx("br", {}), state.models.ready ? (_jsxs(_Fragment, { children: [state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type:", ' ', state.detectedDocumentType, _jsx("br", {}), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), _jsx("br", {}), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), _jsx("br", {}), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score:", ' ', state.passportDetectionScore.toFixed(3), _jsx("br", {}), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), _jsx("br", {}), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), _jsx("br", {}), state.enableFingerOcclusionGuidance && (_jsxs(_Fragment, { children: [state.fingersOccludingDocument ? '❌' : '✅', " Max Finger Score:", ' ', Math.max(0, ...state.detectedObjects
484
607
  .filter((o) => o.label === 'Finger')
485
608
  .map((o) => o.score)).toFixed(3), _jsx("br", {})] })), state.enableGlareOcclusionGuidance && (_jsxs(_Fragment, { children: [state.glareOccludingDocument ? '❌' : '✅', " Max Glare Score:", ' ', Math.max(0, ...state.detectedObjects
486
609
  .filter((o) => o.label === 'Glare')
@@ -3,11 +3,16 @@ import { SelfieGuidanceCode, type SelfieCaptureController } from '@idmission/web
3
3
  import { type CustomerSuppliedVerbiage, type LangOption } from './i18n';
4
4
  import { type SelfieCaptureSurfaceColors } from './components/selfie/SelfieCaptureSurface';
5
5
  import { type FaceCaptureGuideOverlayClassNames } from './components/selfie/FaceCaptureGuideOverlay';
6
+ import type { FaceGuideStyle } from './components/selfie/SelfieCaptureAnimatedMask';
6
7
  import { type SelfieCaptureLoadingOverlayAssets, type SelfieCaptureLoadingOverlayClassNames, type SelfieCaptureLoadingOverlayMode, type SelfieCaptureLoadingOverlayVerbiage } from './components/selfie_loading/SelfieCaptureLoadingOverlay';
7
8
  import { type ErrorScreenClassNames, type ErrorScreenVerbiage } from './components/error/ErrorScreen';
9
+ import type { CameraAccessDeniedReason } from './components/error/CameraAccessDeniedOverlay';
10
+ import type { SelfieCaptureFallbackClassNames } from './components/fallback/SelfieCaptureFallback';
8
11
  export type SelfieGuidanceVerbiage = {
9
12
  guidanceHoldStillText?: CustomerSuppliedVerbiage;
13
+ guidanceHandOverFaceText?: CustomerSuppliedVerbiage;
10
14
  guidanceLookStraightText?: CustomerSuppliedVerbiage;
15
+ guidanceEyesClosedText?: CustomerSuppliedVerbiage;
11
16
  guidanceMoveBackText?: CustomerSuppliedVerbiage;
12
17
  guidanceMoveForwardText?: CustomerSuppliedVerbiage;
13
18
  guidanceMoveToCenterText?: CustomerSuppliedVerbiage;
@@ -16,6 +21,8 @@ export type SelfieGuidanceVerbiage = {
16
21
  guidanceNotStableText?: CustomerSuppliedVerbiage;
17
22
  guidanceManualCaptureText?: CustomerSuppliedVerbiage;
18
23
  manualCaptureBtnText?: CustomerSuppliedVerbiage;
24
+ guidanceRecoveryCaptureText?: CustomerSuppliedVerbiage;
25
+ recoveryCaptureBtnText?: CustomerSuppliedVerbiage;
19
26
  };
20
27
  export declare const GUIDANCE_VERBIAGE_FIELD: Record<Exclude<SelfieGuidanceCode, 'NONE'>, keyof SelfieGuidanceVerbiage>;
21
28
  export type SelfieCaptureViewVerbiage = {
@@ -34,6 +41,8 @@ export type SelfieCaptureViewClassNames = {
34
41
  exitBtn?: string;
35
42
  manualCaptureBtnContainer?: string;
36
43
  manualCaptureBtn?: string;
44
+ /** The stock-camera fallback screen, shown when guidance fails to load. */
45
+ fallback?: SelfieCaptureFallbackClassNames;
37
46
  };
38
47
  export type SelfieCaptureViewColors = SelfieCaptureSurfaceColors;
39
48
  export type SelfieCaptureViewAssets = {
@@ -79,7 +88,9 @@ export type SelfieCaptureViewProps = {
79
88
  onLoadingCompleted?: () => void;
80
89
  onLoadingFailed?: (error?: Error) => void;
81
90
  onLoadingOverlayDismissed?: () => void;
82
- onCameraAccessDenied?: () => void;
91
+ /** Fires once per camera failure, with whether permission was refused or
92
+ * the camera could not be started. */
93
+ onCameraAccessDenied?: (reason: CameraAccessDeniedReason) => void;
83
94
  /** sdk2's `onModelError` / `onSelfieCaptureModelError`: fires once with the
84
95
  * Error when a selfie model fails to load or times out. */
85
96
  onModelError?: (error: Error) => void;
@@ -105,6 +116,12 @@ export type SelfieCaptureViewProps = {
105
116
  renderCameraFeed?: boolean;
106
117
  /** False when a parent multi-stage flow renders the shared face guide. */
107
118
  renderFaceGuide?: boolean;
119
+ /** How the face guide prompts the user to put their head in the oval:
120
+ * 'pulse' (default) animates a wave out of the oval until a face is framed;
121
+ * 'spotlight' dims everything outside the oval instead, with no animation,
122
+ * which is much cheaper on low-end phones. Dim color:
123
+ * `theme.selfieCapture.guides.spotlightColor`. */
124
+ faceGuideStyle?: FaceGuideStyle;
108
125
  onExit?: () => void;
109
126
  /** Fires once per new `state.capturedSelfie` (compared by `capturedAt`),
110
127
  * passing its `dataUrl`. The selfie controller has no submit() action —
@@ -1 +1 @@
1
- {"version":3,"file":"SelfieCaptureView.d.ts","sourceRoot":"","sources":["../src/SelfieCaptureView.tsx"],"names":[],"mappings":"AAgDA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,OAAO,CAAA;AAE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E,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;sDAIkD;IAClD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB;;iEAE6D;IAC7D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;IACpC,UAAU,CAAC,EAAE,2BAA2B,CAAA;IACxC,MAAM,CAAC,EAAE,uBAAuB,CAAA;IAChC,MAAM,CAAC,EAAE,uBAAuB,CAAA;CACjC,CAAA;AAeD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAM7E"}
@@ -63,7 +63,9 @@ import { useSessionReady } from './flows/AuthStateContext';
63
63
  // this exact map rather than duplicating it.
64
64
  export const GUIDANCE_VERBIAGE_FIELD = {
65
65
  [SelfieGuidanceCode.HOLD_STILL]: 'guidanceHoldStillText',
66
+ [SelfieGuidanceCode.HAND_OVER_FACE]: 'guidanceHandOverFaceText',
66
67
  [SelfieGuidanceCode.LOOK_STRAIGHT]: 'guidanceLookStraightText',
68
+ [SelfieGuidanceCode.EYES_CLOSED]: 'guidanceEyesClosedText',
67
69
  [SelfieGuidanceCode.MOVE_BACK]: 'guidanceMoveBackText',
68
70
  [SelfieGuidanceCode.MOVE_FORWARD]: 'guidanceMoveForwardText',
69
71
  [SelfieGuidanceCode.MOVE_TO_CENTER]: 'guidanceMoveToCenterText',
@@ -102,7 +104,7 @@ const Container = styled.div `
102
104
  export function SelfieCaptureView(props) {
103
105
  return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(SelfieCaptureViewContent, { ...props }) }));
104
106
  }
105
- function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default', sessionReady: sessionReadyProp, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, transitionFromIdCapture = false, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, videoRef, renderCameraFeed = true, renderFaceGuide = true, onExit, onCaptured, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
107
+ function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default', sessionReady: sessionReadyProp, lang = 'auto', autoContinueAfterLoading = false, showIntroScreen = false, transitionFromIdCapture = false, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, videoRef, renderCameraFeed = true, renderFaceGuide = true, faceGuideStyle, onExit, onCaptured, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
106
108
  // Omitted means "follow the session": mounted inside a flow this view now
107
109
  // renders during session validation, so its own loading overlay is the one
108
110
  // loading surface (2.x behaviour — see useSessionReady). An explicit prop
@@ -127,7 +129,12 @@ function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default',
127
129
  // request, making a working flow look frozen. FaceLivenessView has always
128
130
  // had this via its own CAPTURED/IN_PROGRESS mapping; the plain view needs
129
131
  // the phase instead, having no liveness machine to read.
130
- const maskStatus = state.phase === 'processing' || state.prediction?.faceReady
132
+ // The hand-over-face check holds the shutter at fire time, on one frame,
133
+ // without touching `faceReady` — so the pill and the guides have to read
134
+ // its hold as well, or a held capture still reads as satisfied.
135
+ const handOverFace = state.guidance.code === SelfieGuidanceCode.HAND_OVER_FACE;
136
+ const maskStatus = (state.phase === 'processing' || state.prediction?.faceReady) &&
137
+ !handOverFace
131
138
  ? 'processing'
132
139
  : 'ready';
133
140
  const guidanceKey = selfieGuidanceMessageKey(state.guidance.code);
@@ -142,9 +149,11 @@ function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default',
142
149
  const guidanceText = useVerbiage(guidanceOverride, guidanceKey);
143
150
  const manualCaptureText = useVerbiage(verbiage.guidance?.guidanceManualCaptureText, 'Position your face in the circle and click to capture.');
144
151
  const manualCaptureButtonText = useVerbiage(verbiage.guidance?.manualCaptureBtnText, 'Capture');
152
+ const recoveryCaptureText = useVerbiage(verbiage.guidance?.guidanceRecoveryCaptureText, 'We’re having trouble checking the lighting. Keep your face centered and hold still—we’ll still check your positioning.');
153
+ const recoveryCaptureButtonText = useVerbiage(verbiage.guidance?.recoveryCaptureBtnText, 'Continue with current lighting');
145
154
  const showGuidancePill = showCaptureSurface && guidanceKey !== '';
146
155
  const guidanceVariant = selfieGuidanceVariant({
147
- satisfied: Boolean(state.prediction?.faceReady),
156
+ satisfied: Boolean(state.prediction?.faceReady) && !handOverFace,
148
157
  negative: false,
149
158
  });
150
159
  // Fires onCaptured once per new capturedSelfie, identified by `capturedAt`
@@ -167,5 +176,5 @@ function SelfieCaptureViewContent({ controller, loadingOverlayMode = 'default',
167
176
  lastCapturedAtRef.current = capturedAtMs;
168
177
  onCaptured?.(captured.dataUrl);
169
178
  }, [state.capturedSelfie, onCaptured]);
170
- return (_jsx(Container, { className: classNames.container, children: _jsx(SelfieCaptureSurface, { controller: controller, state: state, loadingOverlayMode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, onExit: onExit, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onLoadingOverlayDismissed: onLoadingOverlayDismissed, onCameraAccessDenied: onCameraAccessDenied, onModelError: onModelError, onCameraTamperingDetected: onCameraTamperingDetected, onExitAfterTamperSealPopped: onExitAfterTamperSealPopped, onUserCancel: onUserCancel, customOverlayContent: customOverlayContent, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, fallbackCapture: fallbackCapture, silentFallback: silentFallback, manualCaptureText: manualCaptureText, manualCaptureButtonText: manualCaptureButtonText, videoRef: videoRef, renderCameraFeed: renderCameraFeed, renderFaceGuide: renderFaceGuide, showCaptureSurface: showCaptureSurface, maskStatus: maskStatus, showGuidancePill: showGuidancePill, guidanceText: guidanceText, guidanceVariant: guidanceVariant, guidanceCode: state.guidance.code, debugMode: debugMode, showFaceLandmarks: showFaceLandmarks, debugShowSamplePoints: debugShowSamplePoints, verbiage: verbiage, classNames: classNames, colors: colors, assets: assets }) }));
179
+ return (_jsx(Container, { className: classNames.container, children: _jsx(SelfieCaptureSurface, { controller: controller, state: state, loadingOverlayMode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, onExit: onExit, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onLoadingOverlayDismissed: onLoadingOverlayDismissed, onCameraAccessDenied: onCameraAccessDenied, onModelError: onModelError, onCameraTamperingDetected: onCameraTamperingDetected, onExitAfterTamperSealPopped: onExitAfterTamperSealPopped, onUserCancel: onUserCancel, customOverlayContent: customOverlayContent, allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError, fallbackCapture: fallbackCapture, silentFallback: silentFallback, manualCaptureText: manualCaptureText, manualCaptureButtonText: manualCaptureButtonText, recoveryCaptureText: recoveryCaptureText, recoveryCaptureButtonText: recoveryCaptureButtonText, videoRef: videoRef, renderCameraFeed: renderCameraFeed, renderFaceGuide: renderFaceGuide, faceGuideStyle: faceGuideStyle, showCaptureSurface: showCaptureSurface, maskStatus: maskStatus, showGuidancePill: showGuidancePill, guidanceText: guidanceText, guidanceVariant: guidanceVariant, guidanceCode: state.guidance.code, debugMode: debugMode, showFaceLandmarks: showFaceLandmarks, debugShowSamplePoints: debugShowSamplePoints, verbiage: verbiage, classNames: classNames, colors: colors, assets: assets }) }));
171
180
  }
@@ -1,9 +1,10 @@
1
1
  import { type ComponentType, type RefObject } from "react";
2
2
  import { type SignatureCaptureController } from "@idmission/websdk-core/signatureCapture";
3
+ import { type LoaderButtonColors } from "./components/common/LoaderButton";
3
4
  import { type FaceGuideStatus } from "./components/selfie/FaceCaptureGuideOverlay";
4
5
  import { type CustomerSuppliedVerbiage, type LangOption } from "./i18n";
5
6
  import { type SkipSuccessScreen } from "./flows/useShowSuccessScreen";
6
- import { type FlowOverlayClassNames, type FlowOverlayVerbiage } from "./flows/overlays";
7
+ import { type FlowOverlayClassNames, type FlowOverlayColors, type FlowOverlayVerbiage } from "./flows/overlays";
7
8
  export type SignatureCaptureViewVerbiage = {
8
9
  headingText?: CustomerSuppliedVerbiage;
9
10
  signHereText?: CustomerSuppliedVerbiage;
@@ -89,6 +90,16 @@ export type RecordingInterruptedScreenProps = {
89
90
  export type SignatureCaptureViewAssets = {
90
91
  successIcon?: string;
91
92
  };
93
+ /** Colours for this view's own elements, keyed like its `classNames`. */
94
+ export type SignatureCaptureViewColors = {
95
+ /** The heading over the pad. Defaults to the theme's guidance message. */
96
+ headingBackgroundColor?: string;
97
+ headingTextColor?: string;
98
+ /** The review screen's buttons. */
99
+ retryBtn?: LoaderButtonColors;
100
+ doneBtn?: LoaderButtonColors;
101
+ microphoneAccessDenied?: FlowOverlayColors;
102
+ };
92
103
  export type SignatureCaptureViewProps = {
93
104
  controller: SignatureCaptureController;
94
105
  sessionReady?: boolean;
@@ -100,6 +111,7 @@ export type SignatureCaptureViewProps = {
100
111
  onCompleted?: (artifacts: ReturnType<SignatureCaptureController["collectArtifacts"]>) => void;
101
112
  verbiage?: SignatureCaptureViewVerbiage;
102
113
  classNames?: SignatureCaptureViewClassNames;
114
+ colors?: SignatureCaptureViewColors;
103
115
  assets?: SignatureCaptureViewAssets;
104
116
  /** Reuses a video element across consecutive capture stages. */
105
117
  videoRef?: RefObject<HTMLVideoElement | null>;
@@ -109,15 +121,16 @@ export type SignatureCaptureViewProps = {
109
121
  forceCameraFeed?: boolean;
110
122
  /** Whether the live face is inside the legacy signature-stage boundary. */
111
123
  headTrackingSatisfied?: boolean;
124
+ /** Debug status only; signing eligibility remains `headTrackingSatisfied`. */
125
+ headTrackingStatus?: "off" | "pending" | "satisfied" | "unsatisfied";
112
126
  /** Shows the face guide first, then reveals the signature pad. */
113
127
  showFaceGuideThenSignaturePad?: boolean;
114
128
  /** Uses the sdk2 video-signature guide geometry and theme contract. */
115
129
  legacyVideoLayout?: boolean;
116
130
  /**
117
- * Renders the capture's timing marks, the trim window they imply, and the
118
- * recording diagnostics under the review video, so a human can spot-check a
119
- * capture against what the backend will do with it. Debug affordance: off by
120
- * default, and never shown to an end user.
131
+ * Shows live camera, recording, and head-tracking status during video signing,
132
+ * plus timing marks, the trim window, and recording diagnostics under the
133
+ * review video. Debug affordance: off by default.
121
134
  */
122
135
  showCaptureDiagnostics?: boolean;
123
136
  /** Live status for the sdk2-compatible face guide. */
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureCaptureView.d.ts","sourceRoot":"","sources":["../src/SignatureCaptureView.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,0BAA0B,EAEhC,MAAM,yCAAyC,CAAC;AAOjD,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAChB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAE1B,M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