@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.
Files changed (212) hide show
  1. package/README.md +168 -56
  2. package/dist/DocumentCaptureView.d.ts +44 -5
  3. package/dist/DocumentCaptureView.d.ts.map +1 -1
  4. package/dist/DocumentCaptureView.js +517 -30
  5. package/dist/FaceLivenessView.d.ts +3 -3
  6. package/dist/FaceLivenessView.d.ts.map +1 -1
  7. package/dist/FaceLivenessView.js +82 -40
  8. package/dist/IdCaptureView.d.ts +33 -20
  9. package/dist/IdCaptureView.d.ts.map +1 -1
  10. package/dist/IdCaptureView.js +196 -33
  11. package/dist/SelfieCaptureView.d.ts +19 -2
  12. package/dist/SelfieCaptureView.d.ts.map +1 -1
  13. package/dist/SelfieCaptureView.js +17 -5
  14. package/dist/SignatureCaptureView.d.ts +23 -2
  15. package/dist/SignatureCaptureView.d.ts.map +1 -1
  16. package/dist/SignatureCaptureView.js +138 -22
  17. package/dist/VideoIdCaptureView.d.ts +15 -3
  18. package/dist/VideoIdCaptureView.d.ts.map +1 -1
  19. package/dist/VideoIdCaptureView.js +35 -8
  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/CameraFeed.d.ts +11 -3
  31. package/dist/components/CameraFeed.d.ts.map +1 -1
  32. package/dist/components/CameraFeed.js +24 -4
  33. package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
  34. package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
  35. package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
  36. package/dist/components/common/BrowserEdgeTint.d.ts +63 -0
  37. package/dist/components/common/BrowserEdgeTint.d.ts.map +1 -0
  38. package/dist/components/common/BrowserEdgeTint.js +111 -0
  39. package/dist/components/common/LoaderButton.d.ts +9 -0
  40. package/dist/components/common/LoaderButton.d.ts.map +1 -1
  41. package/dist/components/common/LoaderButton.js +44 -321
  42. package/dist/components/common/ScreenReaderStatus.d.ts +8 -0
  43. package/dist/components/common/ScreenReaderStatus.d.ts.map +1 -0
  44. package/dist/components/common/ScreenReaderStatus.js +18 -0
  45. package/dist/components/common/overlay.d.ts +6 -0
  46. package/dist/components/common/overlay.d.ts.map +1 -1
  47. package/dist/components/common/overlay.js +7 -1
  48. package/dist/components/debug/debug.d.ts +10 -4
  49. package/dist/components/debug/debug.d.ts.map +1 -1
  50. package/dist/components/debug/debug.js +5 -1
  51. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
  52. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
  53. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +273 -0
  54. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
  55. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
  56. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +128 -0
  57. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
  58. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
  59. package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
  60. package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
  61. package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
  62. package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
  63. package/dist/components/document/types.d.ts +25 -0
  64. package/dist/components/document/types.d.ts.map +1 -1
  65. package/dist/components/document/types.js +18 -1
  66. package/dist/components/error/CameraAccessDeniedOverlay.d.ts +8 -1
  67. package/dist/components/error/CameraAccessDeniedOverlay.d.ts.map +1 -1
  68. package/dist/components/error/useCameraAccessDeniedReport.d.ts +12 -0
  69. package/dist/components/error/useCameraAccessDeniedReport.d.ts.map +1 -0
  70. package/dist/components/error/useCameraAccessDeniedReport.js +31 -0
  71. package/dist/components/face_liveness/FaceLivenessFailure.d.ts +4 -1
  72. package/dist/components/face_liveness/FaceLivenessFailure.d.ts.map +1 -1
  73. package/dist/components/face_liveness/FaceLivenessFailure.js +4 -2
  74. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts +4 -1
  75. package/dist/components/face_liveness/FaceLivenessSuccess.d.ts.map +1 -1
  76. package/dist/components/face_liveness/FaceLivenessSuccess.js +6 -2
  77. package/dist/components/guides/IdCaptureFitGuide.d.ts +2 -0
  78. package/dist/components/guides/IdCaptureFitGuide.d.ts.map +1 -1
  79. package/dist/components/guides/IdCaptureFitGuide.js +4 -1
  80. package/dist/components/guides/IdCaptureGuideOverlay.d.ts +2 -0
  81. package/dist/components/guides/IdCaptureGuideOverlay.d.ts.map +1 -1
  82. package/dist/components/guides/IdCaptureGuideOverlay.js +3 -1
  83. package/dist/components/guides/IdCaptureGuides.d.ts +14 -0
  84. package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
  85. package/dist/components/guides/IdCaptureGuides.js +23 -9
  86. package/dist/components/guides/IdCaptureGuidesCommon.d.ts.map +1 -1
  87. package/dist/components/guides/IdCaptureGuidesCommon.js +12 -7
  88. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts +9 -0
  89. package/dist/components/loading/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
  90. package/dist/components/loading/IdCaptureLoadingOverlayDefault.js +26 -4
  91. package/dist/components/loading/RingIntroScreen.d.ts.map +1 -1
  92. package/dist/components/loading/RingIntroScreen.js +4 -34
  93. package/dist/components/review/ReviewScreen.d.ts +10 -1
  94. package/dist/components/review/ReviewScreen.d.ts.map +1 -1
  95. package/dist/components/review/ReviewScreen.js +8 -8
  96. package/dist/components/review/SignatureCaptureDiagnostics.d.ts +54 -0
  97. package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
  98. package/dist/components/review/SignatureCaptureDiagnostics.js +144 -0
  99. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts +9 -2
  100. package/dist/components/selfie/FaceCaptureGuideOverlay.d.ts.map +1 -1
  101. package/dist/components/selfie/FaceCaptureGuideOverlay.js +10 -4
  102. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts +8 -1
  103. package/dist/components/selfie/SelfieCaptureAnimatedMask.d.ts.map +1 -1
  104. package/dist/components/selfie/SelfieCaptureAnimatedMask.js +55 -21
  105. package/dist/components/selfie/SelfieCaptureSurface.d.ts +19 -3
  106. package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
  107. package/dist/components/selfie/SelfieCaptureSurface.js +78 -14
  108. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts +9 -0
  109. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
  110. package/dist/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.js +26 -4
  111. package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
  112. package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
  113. package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
  114. package/dist/flows/AuthStateContext.d.ts.map +1 -1
  115. package/dist/flows/AuthStateContext.js +2 -1
  116. package/dist/flows/CaptureProgress.d.ts +14 -0
  117. package/dist/flows/CaptureProgress.d.ts.map +1 -0
  118. package/dist/flows/CaptureProgress.js +51 -0
  119. package/dist/flows/CompositeWizard.d.ts +5 -0
  120. package/dist/flows/CompositeWizard.d.ts.map +1 -1
  121. package/dist/flows/CompositeWizard.js +6 -1
  122. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts +1 -1
  123. package/dist/flows/CustomerBiometricsEnrollmentFlow.d.ts.map +1 -1
  124. package/dist/flows/CustomerBiometricsEnrollmentFlow.js +6 -3
  125. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts +1 -1
  126. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.d.ts.map +1 -1
  127. package/dist/flows/CustomerIdAndBiometricsEnrollmentFlow.js +5 -2
  128. package/dist/flows/DocumentCaptureFlow.d.ts +2 -2
  129. package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
  130. package/dist/flows/DocumentCaptureFlow.js +6 -6
  131. package/dist/flows/FaceValidationFlow.d.ts +2 -2
  132. package/dist/flows/FaceValidationFlow.d.ts.map +1 -1
  133. package/dist/flows/FaceValidationFlow.js +2 -2
  134. package/dist/flows/FlowChassis.d.ts +3 -1
  135. package/dist/flows/FlowChassis.d.ts.map +1 -1
  136. package/dist/flows/FlowChassis.js +23 -4
  137. package/dist/flows/IdAndFaceValidationFlow.d.ts +1 -1
  138. package/dist/flows/IdAndFaceValidationFlow.d.ts.map +1 -1
  139. package/dist/flows/IdAndFaceValidationFlow.js +5 -2
  140. package/dist/flows/IdValidationFlow.d.ts +1 -1
  141. package/dist/flows/IdValidationFlow.d.ts.map +1 -1
  142. package/dist/flows/IdValidationFlow.js +18 -4
  143. package/dist/flows/SignatureKYCFlow.d.ts +18 -3
  144. package/dist/flows/SignatureKYCFlow.d.ts.map +1 -1
  145. package/dist/flows/SignatureKYCFlow.js +94 -11
  146. package/dist/flows/SubmissionProvider.d.ts.map +1 -1
  147. package/dist/flows/SubmissionProvider.js +10 -5
  148. package/dist/flows/VideoIdValidationFlow.d.ts +1 -1
  149. package/dist/flows/VideoIdValidationFlow.d.ts.map +1 -1
  150. package/dist/flows/VideoIdValidationFlow.js +6 -3
  151. package/dist/flows/additionalDocuments.d.ts.map +1 -1
  152. package/dist/flows/additionalDocuments.js +3 -6
  153. package/dist/flows/approval.d.ts +2 -0
  154. package/dist/flows/approval.d.ts.map +1 -0
  155. package/dist/flows/approval.js +1 -0
  156. package/dist/flows/artifacts.d.ts +1 -1
  157. package/dist/flows/artifacts.d.ts.map +1 -1
  158. package/dist/flows/artifacts.js +29 -9
  159. package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
  160. package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
  161. package/dist/flows/autoCaptureMountGuard.js +61 -0
  162. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts +1 -1
  163. package/dist/flows/customerMatch/CustomerMatchFlow.d.ts.map +1 -1
  164. package/dist/flows/customerMatch/CustomerMatchFlow.js +5 -6
  165. package/dist/flows/ringScreens.d.ts +1 -3
  166. package/dist/flows/ringScreens.d.ts.map +1 -1
  167. package/dist/flows/ringScreens.js +19 -5
  168. package/dist/flows/types.d.ts +17 -3
  169. package/dist/flows/types.d.ts.map +1 -1
  170. package/dist/guidance/selfieStrings.d.ts +9 -1
  171. package/dist/guidance/selfieStrings.d.ts.map +1 -1
  172. package/dist/guidance/selfieStrings.js +67 -24
  173. package/dist/guidance/strings.d.ts +34 -1
  174. package/dist/guidance/strings.d.ts.map +1 -1
  175. package/dist/guidance/strings.js +39 -0
  176. package/dist/i18n/index.d.ts +28 -1177
  177. package/dist/i18n/index.d.ts.map +1 -1
  178. package/dist/i18n/index.js +58 -22
  179. package/dist/i18n/locales/threeOh.d.ts +4 -0
  180. package/dist/i18n/locales/threeOh.d.ts.map +1 -0
  181. package/dist/i18n/locales/threeOh.js +159 -0
  182. package/dist/index.d.ts +12 -6
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +4 -0
  185. package/dist/testing/autoCaptureFrames.d.ts +23 -0
  186. package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
  187. package/dist/testing/autoCaptureFrames.js +193 -0
  188. package/dist/testing/buildSelfieState.d.ts.map +1 -1
  189. package/dist/testing/buildSelfieState.js +5 -0
  190. package/dist/testing/classNamesLeaves.js +1 -1
  191. package/dist/testing/fakeDocumentController.d.ts +7 -1
  192. package/dist/testing/fakeDocumentController.d.ts.map +1 -1
  193. package/dist/testing/fakeDocumentController.js +10 -2
  194. package/dist/testing/fakeSelfieController.d.ts.map +1 -1
  195. package/dist/testing/fakeSelfieController.js +7 -0
  196. package/dist/testing/index.d.ts +1 -0
  197. package/dist/testing/index.d.ts.map +1 -1
  198. package/dist/testing/index.js +1 -0
  199. package/dist/theme/index.d.ts +10 -0
  200. package/dist/theme/index.d.ts.map +1 -1
  201. package/dist/useDocumentUpload.d.ts +63 -0
  202. package/dist/useDocumentUpload.d.ts.map +1 -0
  203. package/dist/useDocumentUpload.js +45 -0
  204. package/dist/useIdmissionClient.d.ts +29 -0
  205. package/dist/useIdmissionClient.d.ts.map +1 -0
  206. package/dist/useIdmissionClient.js +44 -0
  207. package/dist/utils/canvas.d.ts.map +1 -1
  208. package/dist/utils/canvas.js +41 -0
  209. package/dist/version.d.ts +1 -1
  210. package/dist/version.d.ts.map +1 -1
  211. package/dist/version.js +1 -1
  212. package/package.json +9 -7
@@ -10,14 +10,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
10
10
  // - `requestCameraAccess()` is the controller's `actions.requestCamera()`;
11
11
  // the auto-request effect keeps sdk2's condition (:83-96) verbatim.
12
12
  import { useEffect, useRef } from 'react';
13
- import { styled, useTheme } from 'styled-components';
13
+ import { keyframes, styled, useTheme } from 'styled-components';
14
14
  import { useDocumentCapture } from './bindings/useDocumentCapture';
15
15
  import { CameraFeedWrapper, CameraVideoTag, } from './components/CameraFeed';
16
16
  import { ButtonsRow } from './components/common/ButtonsRow';
17
17
  import { LoaderButton } from './components/common/LoaderButton';
18
+ import { DocumentCaptureAutoCaptureDebugLayer } from './components/document/DocumentCaptureAutoCaptureDebugLayer';
19
+ import { DocumentCaptureAutoCaptureGuidance, DocumentCaptureManualCaptureHint, } from './components/document/DocumentCaptureAutoCaptureGuidance';
20
+ import { DocumentCaptureReviewScreen } from './components/document/DocumentCaptureReviewScreen';
21
+ import { BrowserEdgeTint, opaqueColor, } from './components/common/BrowserEdgeTint';
22
+ import { GRAY_OVERLAY_BACKGROUND } from './components/common/overlay';
18
23
  import { DocumentCaptureGuideOverlay, } from './components/document/DocumentCaptureGuideOverlay';
24
+ import { useCameraAccessDeniedReport } from './components/error/useCameraAccessDeniedReport';
19
25
  import { GuideLayoutProvider, useGuideLayout } from './layout/GuideLayoutContext';
20
- import { useLanguage, useTranslations, } from './i18n';
26
+ import { SdkLanguageProvider, useLanguage, useTranslations, } from './i18n';
21
27
  import { useSessionReady } from './flows/AuthStateContext';
22
28
  /** The verbiage fallbacks, exported so the i18n parity test reads the real
23
29
  * literals rather than a second copy that could drift from them. */
@@ -34,6 +40,43 @@ export const DOCUMENT_CAPTURE_FALLBACK_VERBIAGE = {
34
40
  uploadingBtnText: 'Uploading...',
35
41
  retryUploadBtnText: 'Retry',
36
42
  successBtnText: 'Upload succeeded!',
43
+ // Only three of these eight are NEW strings; the rest are already translated
44
+ // in all eight locales and are adopted verbatim. `documentCaptureStrings.test.ts`
45
+ // iterates this object and asserts each value is a key in every locale, so
46
+ // the new members are covered with no test edit at all — the strongest
47
+ // reason the verbiage route wins over `guidanceMessageKey`.
48
+ autoCaptureNoDocumentText: 'Document not detected',
49
+ autoCaptureTooCloseText: 'Move back, make sure all 4 edges of the page are visible.',
50
+ autoCaptureTooFarText: 'Move closer, fill the frame with the whole page.',
51
+ autoCaptureNotStableText: 'Please hold still...',
52
+ // Shares notStable's string on purpose. #345's ladder ordering rests on a
53
+ // focus failure BEING a motion failure on paper; if "hold still" is correct
54
+ // for both, a second sentence saying the same thing differently is a
55
+ // distinction the applicant cannot act on. The CODES stay distinct for the
56
+ // overlay and the metadata; only the rendered string is shared. This
57
+ // declines the already-translated 'Document out of focus - try improving the
58
+ // lighting', which would have been free: it prescribes LIGHTING, and the
59
+ // cause is motion. A free translation is not worth wrong advice.
60
+ autoCaptureOutOfFocusText: 'Please hold still...',
61
+ // A free orphan: translated in all eight locales and emitted by NOTHING in
62
+ // packages/ or sdk2/src, because `documentTypeDisplayNames` has no
63
+ // `Document` member and `guidanceMessageKey`'s HOLD_STILL interpolation
64
+ // therefore cannot produce it. POA's satisfied code adopts it.
65
+ autoCaptureHoldStillText: 'Document detected, hold still...',
66
+ // Says what happened and what to do, in that order, because the button
67
+ // appears unannounced and the applicant's first question is why. Not a
68
+ // question itself: the old wording asked "Having trouble? Would you like to
69
+ // take the photo yourself?" over two buttons, which made someone confirm a
70
+ // permission they already had. It refers to "the button" rather than naming
71
+ // it, since `Capture` renders differently in every locale
72
+ // (Capturar/Erfassen/Acquisisci/撮影/Съемка/拍攝).
73
+ manualCaptureHintText: 'Automatic capture is having trouble. Tap the button to take the photo yourself.',
74
+ reviewHeadingText: 'Document captured',
75
+ // Deliberately the SAME English source string as the heading: source strings
76
+ // are the translation keys, so reusing this one is already translated into
77
+ // all eight locales and adds no locale-parity surface. A distinct phrase
78
+ // would read better and would also be eight untranslated strings.
79
+ reviewImageAltText: 'Document captured',
37
80
  };
38
81
  /**
39
82
  * Owns its own `GuideLayoutProvider`, matching IdCaptureView (:364). The guide
@@ -49,9 +92,9 @@ export const DOCUMENT_CAPTURE_FALLBACK_VERBIAGE = {
49
92
  * the overlay and the feed sit under it.
50
93
  */
51
94
  export function DocumentCaptureView(props) {
52
- return (_jsx(GuideLayoutProvider, { children: _jsx(DocumentCaptureSurface, { ...props }) }));
95
+ return (_jsx(SdkLanguageProvider, { lang: props.lang ?? 'auto', children: _jsx(GuideLayoutProvider, { children: _jsx(DocumentCaptureSurface, { ...props }) }) }));
53
96
  }
54
- function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessionReadyProp, onCompleted, onCameraAccessDenied, onCameraTamperingDetected, onExitAfterTamperSealPopped, documents, cameraFeedMode, aspectRatio, instructions, classNames = {}, verbiage: rawVerbiage = {}, }) {
97
+ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessionReadyProp, onCompleted, onCameraAccessDenied, onCameraTamperingDetected, onExitAfterTamperSealPopped, documents, cameraFeedMode, aspectRatio, instructions, debugMode = false, classNames = {}, verbiage: rawVerbiage = {}, }) {
55
98
  // Omitted means "follow the session": mounted inside a flow this view now
56
99
  // renders during session validation, so its own loading overlay is the one
57
100
  // loading surface (2.x behaviour — see useSessionReady). An explicit prop
@@ -124,6 +167,161 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
124
167
  return;
125
168
  void controller.actions.requestCamera();
126
169
  }, [cameraAccessNeeded, controller]);
170
+ /**
171
+ * Whether auto-capture is currently doing the guiding — #345's three-row
172
+ * table, in one expression.
173
+ *
174
+ * | condition | screen |
175
+ * |---------------------------------------------|----------------------------|
176
+ * | opted in, models loading or loaded | guided; nothing to tap |
177
+ * | opted in, detector MODEL_LOAD_FAILED | today's screen, button live|
178
+ * | not opted in (flag off, control arm) | today's screen, button live|
179
+ *
180
+ * `idCapture` needs a whole takeover screen (`IdCaptureFallback`) on a model
181
+ * failure because it has no manual mode otherwise. `documentCapture`'s manual
182
+ * mode IS its current screen, so the same rule ports with zero new UI —
183
+ * falling out of `autoCaptureGuiding` restores exactly what shipped before.
184
+ *
185
+ * THE CAPTURE BUTTON APPEARING IS NOT AN EXIT FROM THE TREATMENT. Reaching
186
+ * #345's escape used to drop the whole guided screen — brackets, dark
187
+ * surround, floating header and pill all reverted to the 2.x bars mid
188
+ * capture, which read as a different screen rather than as gaining a button.
189
+ * It also contradicted `autoCaptureShutter.ts`, which says guidance and
190
+ * measurement continue precisely BECAUSE the pill is the most valuable thing
191
+ * on screen for someone about to hand-frame a POA.
192
+ *
193
+ * So the treatment survives it, and `manualShutterOnScreen` below is the
194
+ * narrower question of whether a Capture button belongs on screen. Keeping
195
+ * the header out of flow across that transition also removes the layout
196
+ * swap that pushed the footer past the fold.
197
+ *
198
+ * `!entry.content` is load-bearing and NOT the same test as
199
+ * `cameraCaptureRequired`. That one asks "was this document pre-supplied?",
200
+ * which stays false for a document the applicant captures — so without this
201
+ * the guidance pill survives its own shutter and sits over the frozen
202
+ * preview still saying "hold still", which reads as a hung screen.
203
+ */
204
+ const autoCaptureGuiding = !!entry?.item.autoCapture &&
205
+ cameraCaptureRequired &&
206
+ !entry.content &&
207
+ state.models.state !== 'error';
208
+ /**
209
+ * Whether the Capture button is on screen.
210
+ *
211
+ * Granted by the shutter reducer once auto-capture has struggled for a full
212
+ * budget — no dialog, no accept step. It is an ADDITION: auto-capture stays
213
+ * armed behind it and can still fire.
214
+ */
215
+ const manualShutterOnScreen = autoCaptureGuiding && !!state.autoCaptureShutter?.manualShutterAvailable;
216
+ /**
217
+ * How long the burst window a tap just opened will run for, or null.
218
+ *
219
+ * Pressing a phone's screen moves the phone, so the tap opens a short window
220
+ * and the sharpest frame in it is what gets saved. That is a few hundred
221
+ * milliseconds during which the applicant has tapped and no photo has
222
+ * appeared — long enough that without feedback they learn to tap it twice,
223
+ * and the second tap is another jostle.
224
+ */
225
+ const manualBurstMs = state.autoCaptureShutter?.manualBurstMs ?? null;
226
+ /**
227
+ * Where the shutter's centre sits: on the guide box's bottom edge.
228
+ *
229
+ * `null` until the overlay has published a rect, which is also the case for
230
+ * a caller who supplies no `aspectRatio` — the dock falls back to the bottom
231
+ * of the surface there, since there is no edge to straddle.
232
+ */
233
+ const shutterCentreY = guideRect && guideRect.height > 0 ? guideRect.y + guideRect.height : null;
234
+ /**
235
+ * The full-screen review takes over once the applicant has CAPTURED a frame.
236
+ *
237
+ * Keyed on the entry's OWN `captureMode`, not on `cameraCaptureRequired`.
238
+ * That looks like the same question and is not: `cameraCaptureRequired` reads
239
+ * the view's OPTIONAL `documents` prop, so a caller who drives the controller
240
+ * directly and never passes it — legal, and what this view's own tests do —
241
+ * would get "Document captured / Retry capture" over a gallery blob that
242
+ * never touched a camera, offering a retry that opens a camera that path
243
+ * never used. `captureMode` records what actually happened: `'Upload'` for a
244
+ * caller-supplied blob, `'Auto'`/`'Manual'` for a frame this flow took.
245
+ *
246
+ * It LAYERS over the capture surface rather than replacing it, and that is
247
+ * not a style choice. `attach()` binds `srcObject` exactly once against the
248
+ * element it was handed, and the camera stays acquired through a capture —
249
+ * only the detection loop stops. Returning the review INSTEAD of the capture
250
+ * tree unmounts the <video>, so the retry re-mounts a fresh element with no
251
+ * stream: the feed goes black and `captureFrame` keeps grabbing the orphaned
252
+ * element's last frame, silently re-uploading the image the applicant just
253
+ * rejected. `DocumentCaptureView.test.tsx` pins this; it is why the preview
254
+ * has always been layered rather than swapped.
255
+ */
256
+ /**
257
+ * Whether the pill is currently showing the satisfied code.
258
+ *
259
+ * Read from `guidance.displayed`, NOT from `satisfied`, so the brackets and
260
+ * the pill change together. Driving the brackets off the raw per-frame
261
+ * verdict would flip them green on 1-3 frame excursions the stabilizer
262
+ * deliberately swallows — the visual equivalent of re-opening #383.
263
+ */
264
+ const satisfiedOnScreen = state.autoCapture?.guidance.displayed === 'holdStill';
265
+ /**
266
+ * The surround outside the guide box.
267
+ *
268
+ * OPAQUE under `snapToGuides`, and that is a correctness fix rather than a
269
+ * taste one: in that mode the feed is sized to the guide box, so outside it
270
+ * there is no camera for a translucent scrim to be translucent OVER — it
271
+ * composites against the host page instead. `rgba(10,14,19,0.62)` over a
272
+ * white page resolves to `rgb(103,106,109)`, a flat mid-grey, which is what
273
+ * made the screen look washed out and unfinished.
274
+ *
275
+ * Opaque also gives the notch/Dynamic Island and both safe areas a deliberate
276
+ * colour instead of whatever the host happens to paint.
277
+ *
278
+ * Under `fullscreen` the feed IS edge to edge, so translucency shows the
279
+ * surroundings and is worth keeping.
280
+ */
281
+ const guidedMaskColor = theme.documentCapture?.guideBox?.maskColor ??
282
+ (resolvedFeedMode === 'snapToGuides'
283
+ ? GUIDED_SURROUND_COLOR
284
+ : 'rgba(10, 14, 19, 0.62)');
285
+ // `guideBox` has no themed border colour today, so this is the one place a
286
+ // value is picked rather than inherited. White reads on any feed.
287
+ const bracketColor = '#ffffff';
288
+ const bracketSatisfiedColor = theme.colors?.positive?.[600] ?? 'var(--idm-color-positive-600)';
289
+ // The review image's accessible name. `title` is the integrator's own string
290
+ // and already in their language; the fallback is translated. A verbiage
291
+ // entry replaced by a component cannot be an alt attribute, so that case
292
+ // falls through to the untranslated source string rather than to no name at
293
+ // all — an unnamed image is the worse failure.
294
+ const reviewImageAlt = entry?.item.title ??
295
+ (typeof verbiage.reviewImageAltText === 'string'
296
+ ? verbiage.reviewImageAltText
297
+ : 'Document captured');
298
+ const capturedMode = entry?.captureMetadata?.captureMode ?? null;
299
+ // GATED ON THE OPT-IN, not on the capture mode alone. Every capture carries
300
+ // metadata now — that is #377's whole point, so a rollout has a control arm —
301
+ // which meant keying on `captureMode` handed the new full-screen review card
302
+ // to every 2.x integrator who never asked for any of this. Presence of
303
+ // `autoCapture` is the opt-in for the SCREEN as much as for the shutter.
304
+ const showReview = !!contentUrl &&
305
+ !!entry?.item.autoCapture &&
306
+ (capturedMode === 'Auto' || capturedMode === 'Manual');
307
+ /**
308
+ * The colour touching both viewport edges, for the browser to tint its own
309
+ * bars with — see `BrowserEdgeTint`. Null outside the guided treatment, so a
310
+ * 2.x integrator's page chrome stays theirs.
311
+ *
312
+ * The capture screen and the review are the SAME route to a host, which is
313
+ * why this has to come from here: only the view knows it just swapped a
314
+ * near-black camera surface for a light card. Left to the host, iOS 26 Safari
315
+ * showed a white toolbar under the camera and kept the camera's dark top bar
316
+ * over the review.
317
+ */
318
+ const browserEdgeColor = showReview
319
+ ? GRAY_OVERLAY_BACKGROUND
320
+ : autoCaptureGuiding
321
+ ? // The mask can be translucent — `fullscreen`'s scrim, or a theme's —
322
+ // and the strips must not be. Same hue, alpha dropped.
323
+ (opaqueColor(guidedMaskColor) ?? GUIDED_SURROUND_COLOR)
324
+ : null;
127
325
  // Completion is derived rather than event-driven so it survives a remount:
128
326
  // the ref only stops it firing twice within one mount.
129
327
  const everyUploaded = state.documents.length > 0 &&
@@ -135,21 +333,14 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
135
333
  completedRef.current = true;
136
334
  onCompleted?.();
137
335
  }, [everyUploaded, onCompleted]);
138
- const cameraAccessDenied = state.error?.code === 'CAMERA_PERMISSION_DENIED';
336
+ // Either camera failure leaves the capture button stuck on "Loading", so
337
+ // both get the retry button.
338
+ const cameraFailed = state.error?.code === 'CAMERA_PERMISSION_DENIED' ||
339
+ state.error?.code === 'CAMERA_UNAVAILABLE';
139
340
  const cameraTampered = state.error?.code === 'CAMERA_TAMPERING_SUSPECTED';
140
- // Latched like the completion effect above: a notification per denial or
141
- // detection, not per render.
142
- const deniedReportedRef = useRef(false);
143
- useEffect(() => {
144
- if (!cameraAccessDenied) {
145
- deniedReportedRef.current = false;
146
- return;
147
- }
148
- if (deniedReportedRef.current)
149
- return;
150
- deniedReportedRef.current = true;
151
- onCameraAccessDenied?.();
152
- }, [cameraAccessDenied, onCameraAccessDenied]);
341
+ // Latched like the completion effect above: a notification per camera
342
+ // failure or detection, not per render.
343
+ useCameraAccessDeniedReport(controller, state.error?.code, onCameraAccessDenied);
153
344
  const tamperReportedRef = useRef(false);
154
345
  useEffect(() => {
155
346
  if (!cameraTampered) {
@@ -161,27 +352,56 @@ function DocumentCaptureSurface({ controller, lang = 'auto', sessionReady: sessi
161
352
  tamperReportedRef.current = true;
162
353
  onCameraTamperingDetected?.();
163
354
  }, [cameraTampered, onCameraTamperingDetected]);
164
- return (_jsxs(_Fragment, { children: [_jsxs(CameraFeedWrapper, { className: classNames.cameraFeedWrapper, "$mode": resolvedFeedMode, "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, children: [_jsx(CameraVideoTag, { ref: videoRef, className: classNames.cameraFeed, isRearFacing: state.camera.isRearFacing }), contentUrl && (_jsx(PreviewImage, { alt: "", src: contentUrl, className: classNames.previewImage }))] }), _jsxs(CaptureContainer, { className: classNames.captureContainer, children: [_jsx(HeadingRow, { "$maskColor": maskColor, className: classNames.headingRow, children: _jsx(Heading, { className: classNames.heading, children: verbiage.headingText }) }), _jsx(DocumentCaptureGuideOverlay, { aspectRatio: resolvedAspectRatio, maskColor: maskColor, classNames: classNames.guideOverlay }), _jsxs(FooterRow, { "$maskColor": maskColor, className: classNames.footerRow, children: [resolvedInstructions && (_jsx(Instructions, { className: classNames.instructions, children: resolvedInstructions })), cameraTampered && (_jsx(Instructions, { className: classNames.tamperMessage, children: verbiage.tamperingText })), _jsx(StyledButtonsRow, { className: classNames.buttonsRow, children: cameraTampered ? (onExitAfterTamperSealPopped ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: onExitAfterTamperSealPopped, children: verbiage.exitBtnText })) : null) : cameraAccessDenied ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: () => void controller.actions.requestCamera(), children: verbiage.retryCameraAccessBtnText })) : contentUrl ? (uploadState === 'not_started' ? (_jsxs(_Fragment, { children: [_jsx(LoaderButton, { className: classNames.retryCaptureBtn, finished: true, variant: "warning", onClick: () => controller.actions.retry(), children: verbiage.retryCaptureBtnText }), _jsx(LoaderButton, { className: classNames.uploadBtn, finished: true, variant: "positive", onClick: () => void controller.actions.upload(), children: verbiage.uploadBtnText })] })) : (_jsx(LoaderButton, { className: classNames.uploadProgressBtn, finished: uploadState !== 'in_progress', variant: uploadState === 'failed' ? 'negative' : 'positive', onClick: () => void controller.actions.upload(), disabled: uploadState === 'in_progress' ||
355
+ return (_jsxs(_Fragment, { children: [_jsxs(CameraFeedWrapper, { className: classNames.cameraFeedWrapper, "$mode": resolvedFeedMode, "$x": guideRect?.x ?? 0, "$y": guideRect?.y ?? 0, "$w": guideRect?.width ?? 0, "$h": guideRect?.height ?? 0, children: [_jsx(CameraVideoTag, { ref: videoRef, className: classNames.cameraFeed, isRearFacing: state.camera.isRearFacing }), contentUrl && !showReview && (_jsx(PreviewImage, { alt: "", src: contentUrl, className: classNames.previewImage }))] }), _jsxs(CaptureContainer, { className: classNames.captureContainer, "data-testid": "document-capture-surface", children: [autoCaptureGuiding ? (_jsxs(GuidedHeader, { "$maskColor": guidedMaskColor, className: classNames.headingRow, "data-testid": "document-capture-guided-header", children: [_jsx(GuidedHeading, { className: classNames.heading, children: verbiage.headingText }), resolvedInstructions && (_jsx(GuidedInstructions, { className: classNames.instructions, tabIndex: 0, role: "note", children: resolvedInstructions }))] })) : (_jsx(HeadingRow, { "$maskColor": maskColor, className: classNames.headingRow, children: _jsx(Heading, { className: classNames.heading, children: verbiage.headingText }) })), _jsx(DocumentCaptureGuideOverlay, { aspectRatio: resolvedAspectRatio, maskColor: autoCaptureGuiding ? guidedMaskColor : maskColor, cornerBrackets: autoCaptureGuiding,
356
+ // Breathing room, and not cosmetic: floating the header took it out
357
+ // of flow, so the overlay grew into the space the bar used to hold
358
+ // and the box ran flush to every edge. Brackets in the viewport's
359
+ // own corners stop reading as the document's corners, and the
360
+ // bottom pair collided with the guidance pill.
361
+ padding: autoCaptureGuiding ? GUIDED_GUIDE_PADDING : undefined, borderColor: autoCaptureGuiding
362
+ ? satisfiedOnScreen
363
+ ? bracketSatisfiedColor
364
+ : bracketColor
365
+ : undefined, borderWidth: autoCaptureGuiding ? 3 : undefined, classNames: classNames.guideOverlay }), debugMode && entry?.item.autoCapture && (_jsx(DocumentCaptureAutoCaptureDebugLayer, { state: state, getLog: controller.getAutoCaptureLog,
366
+ // Collapsed while the review card is up: the shared pane outranks
367
+ // it and would cover the captured image, which is the one thing
368
+ // the operator is there to look at.
369
+ compact: showReview })), autoCaptureGuiding && (_jsxs(GuidedBottomStack, { "$centreY": shutterCentreY, "$aboveShutter": manualShutterOnScreen, children: [manualShutterOnScreen && (_jsx(DocumentCaptureManualCaptureHint, { message: verbiage.manualCaptureHintText, className: classNames.manualCaptureHint })), _jsx(DocumentCaptureAutoCaptureGuidance, { code: state.autoCapture?.guidance.displayed ?? 'none', messages: verbiage, className: classNames.autoCaptureGuidance })] })), manualShutterOnScreen && (_jsx(GuidedShutterDock, { "$centreY": shutterCentreY, "data-testid": "document-capture-shutter-dock", children: _jsxs(GuidedShutterWell, { children: [_jsx(GuidedShutter, { type: "button", className: classNames.captureBtn, "aria-label": typeof verbiage.captureBtnText === 'string'
370
+ ? verbiage.captureBtnText
371
+ : 'Capture', "data-testid": "document-capture-shutter", "$pending": manualBurstMs !== null, onClick: () => {
372
+ if (!state.camera.ready || state.capturing)
373
+ return;
374
+ void controller.actions.capture();
375
+ }, disabled: !state.camera.ready ||
376
+ state.capturing ||
377
+ manualBurstMs !== null }), manualBurstMs !== null && (_jsx(GuidedShutterSweep, { "$durationMs": manualBurstMs, viewBox: `0 0 ${SHUTTER_RING_BOX_PX} ${SHUTTER_RING_BOX_PX}`, "aria-hidden": "true", "data-testid": "document-capture-shutter-sweep", children: _jsx("circle", { cx: SHUTTER_RING_BOX_PX / 2, cy: SHUTTER_RING_BOX_PX / 2, r: SHUTTER_RING_RADIUS_PX }) }))] }) })), browserEdgeColor && _jsx(BrowserEdgeTint, { color: browserEdgeColor }), showReview && contentUrl && (_jsx(DocumentCaptureReviewScreen, { contentUrl: contentUrl, headingText: verbiage.reviewHeadingText, retryText: verbiage.retryCaptureBtnText, uploadText: verbiage.uploadBtnText, uploadingText: verbiage.uploadingBtnText, retryUploadText: verbiage.retryUploadBtnText, successText: verbiage.successBtnText, uploadState: uploadState, onRetry: () => controller.actions.retry(), onUpload: () => void controller.actions.upload(), classNames: classNames, alt: reviewImageAlt })), _jsxs(FooterRow, { "$maskColor": autoCaptureGuiding ? guidedMaskColor : maskColor, className: classNames.footerRow, "data-testid": "document-capture-footer", children: [resolvedInstructions && !autoCaptureGuiding && (_jsx(Instructions, { className: classNames.instructions, children: resolvedInstructions })), cameraTampered && (_jsx(Instructions, { className: classNames.tamperMessage, children: verbiage.tamperingText })), _jsx(StyledButtonsRow, { className: classNames.buttonsRow, children: cameraTampered ? (onExitAfterTamperSealPopped ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: onExitAfterTamperSealPopped, children: verbiage.exitBtnText })) : null) : cameraFailed ? (_jsx(LoaderButton, { className: classNames.retryCameraAccessBtn, variant: "negative", finished: true, onClick: () => void controller.actions.requestCamera(), children: verbiage.retryCameraAccessBtnText })) : showReview ? (
378
+ // The review card owns these controls now. Rendering them here
379
+ // too would put two "Retry capture" buttons on screen at once.
380
+ null) : contentUrl ? (uploadState === 'not_started' ? (_jsxs(_Fragment, { children: [_jsx(LoaderButton, { className: classNames.retryCaptureBtn, finished: true, variant: "warning", onClick: () => controller.actions.retry(), children: verbiage.retryCaptureBtnText }), _jsx(LoaderButton, { className: classNames.uploadBtn, finished: true, variant: "positive", onClick: () => void controller.actions.upload(), children: verbiage.uploadBtnText })] })) : (_jsx(LoaderButton, { className: classNames.uploadProgressBtn, finished: uploadState !== 'in_progress', variant: uploadState === 'failed' ? 'negative' : 'positive', onClick: () => void controller.actions.upload(), disabled: uploadState === 'in_progress' ||
165
381
  uploadState === 'succeeded', children: uploadState === 'succeeded'
166
382
  ? verbiage.successBtnText
167
383
  : uploadState === 'failed'
168
384
  ? verbiage.retryUploadBtnText
169
- : verbiage.uploadingBtnText }))) : (_jsx(LoaderButton, { className: classNames.captureBtn, finished: state.camera.ready, variant: "primary",
170
- // Guarded rather than relying on `disabled` alone: with
171
- // `finished` false, LoaderButton hands the element to ladda,
172
- // which manipulates its disabled state imperatively
173
- // (LoaderButton.tsx:63-79). The button can therefore be
174
- // clickable mid-animation, which CI caught.
175
- onClick: () => {
176
- if (!state.camera.ready || state.capturing)
177
- return;
178
- void controller.actions.capture();
179
- }, disabled: !state.camera.ready || state.capturing, children: !state.camera.ready
385
+ : verbiage.uploadingBtnText }))) : autoCaptureGuiding ? null : (_jsx(LoaderButton, { className: classNames.captureBtn, finished: state.camera.ready, variant: "primary", onClick: () => void controller.actions.capture(), disabled: !state.camera.ready || state.capturing, children: !state.camera.ready
180
386
  ? verbiage.loadingBtnText
181
387
  : state.capturing
182
388
  ? verbiage.capturingBtnText
183
389
  : verbiage.captureBtnText })) })] })] })] }));
184
390
  }
391
+ /**
392
+ * MUST STAY TRANSPARENT.
393
+ *
394
+ * This is a SIBLING of `CameraFeedWrapper`, not an ancestor — the <video> is
395
+ * in the preceding sibling, and this is `position: absolute` over the top of
396
+ * it. Any opaque background here is a solid sheet across the camera feed, and
397
+ * nothing downstream can punch back through it. Painting it is what broke the
398
+ * feed once already; `DocumentCaptureView.test.tsx` pins it.
399
+ *
400
+ * The guided surround is the guide overlay's job and is already covered: its
401
+ * `CanvasWrapper` is `flex-grow: 1` and `GuidedHeader` is absolutely
402
+ * positioned, so the canvas fills this container and paints `maskColor`
403
+ * everywhere except the hole it punches for the guide box.
404
+ */
185
405
  const CaptureContainer = styled.div `
186
406
  display: flex;
187
407
  flex-direction: column;
@@ -191,6 +411,273 @@ const CaptureContainer = styled.div `
191
411
  width: 100%;
192
412
  height: 100%;
193
413
  `;
414
+ /**
415
+ * Inset of the guide box from the capture surface, on the guided screen.
416
+ *
417
+ * Has to clear the floated header above and the guidance pill below, both of
418
+ * which are absolutely positioned and therefore invisible to the flex layout
419
+ * the guide box is sized by.
420
+ */
421
+ const GUIDED_GUIDE_PADDING = 16;
422
+ /** The shutter disc, and how far its ring extends past it. */
423
+ const GUIDED_SHUTTER_SIZE_PX = 62;
424
+ const GUIDED_SHUTTER_RING_PX = 7;
425
+ const GUIDED_SHUTTER_RING_WIDTH_PX = 2.5;
426
+ /** The square the ring is drawn in, and the circle inside it. */
427
+ const SHUTTER_RING_BOX_PX = GUIDED_SHUTTER_SIZE_PX + GUIDED_SHUTTER_RING_PX * 2;
428
+ const SHUTTER_RING_RADIUS_PX = (SHUTTER_RING_BOX_PX - GUIDED_SHUTTER_RING_WIDTH_PX) / 2;
429
+ const SHUTTER_RING_CIRCUMFERENCE_PX = 2 * Math.PI * SHUTTER_RING_RADIUS_PX;
430
+ /** Outermost radius of the shutter, ring included. */
431
+ const GUIDED_SHUTTER_RADIUS_PX = GUIDED_SHUTTER_SIZE_PX / 2 + GUIDED_SHUTTER_RING_PX;
432
+ /** Breathing room between the shutter's ring and the text above it. */
433
+ const GUIDED_STACK_GAP_PX = 12;
434
+ /**
435
+ * The guided screen's bottom band: caption, pill, and nothing else.
436
+ *
437
+ * IT ANCHORS OFF THE SHUTTER, not off the surface. The pill used to take a
438
+ * fixed lift sized for a button row, which was correct only while the button
439
+ * sat in a row at the bottom — once the shutter moved onto the guide box's
440
+ * bottom edge the two were computing different bottoms, and on a letterboxed
441
+ * desktop the disc landed squarely on the pill. Deriving both from the same
442
+ * `centreY` is what makes that unrepresentable rather than merely fixed.
443
+ *
444
+ * `pointer-events: none` because nothing in here is tappable and the shutter
445
+ * is centred directly below it.
446
+ */
447
+ const GuidedBottomStack = styled.div `
448
+ position: absolute;
449
+ left: 0;
450
+ right: 0;
451
+ z-index: 10001;
452
+ display: flex;
453
+ flex-direction: column;
454
+ align-items: center;
455
+ gap: 8px;
456
+ pointer-events: none;
457
+
458
+ ${({ $centreY, $aboveShutter }) => {
459
+ if (!$aboveShutter) {
460
+ // No shutter yet: the band is the applicant's alone, so sit where a
461
+ // caption belongs — just clear of the bottom edge.
462
+ return 'bottom: max(26px, env(safe-area-inset-bottom));';
463
+ }
464
+ if ($centreY === null) {
465
+ // No published guide rect, so the dock fell back to the surface bottom
466
+ // too. Clear it by the shutter's full height plus the gap.
467
+ return `bottom: calc(max(20px, env(safe-area-inset-bottom)) + ${GUIDED_SHUTTER_RADIUS_PX * 2 + GUIDED_STACK_GAP_PX}px);`;
468
+ }
469
+ // Sit the stack's BOTTOM edge just above the shutter's ring. Measuring
470
+ // down from the top and pulling back by its own height is what keeps this
471
+ // correct when the caption wraps to two lines on a narrow phone.
472
+ return `top: ${$centreY - GUIDED_SHUTTER_RADIUS_PX - GUIDED_STACK_GAP_PX}px; transform: translateY(-100%);`;
473
+ }}
474
+ `;
475
+ /**
476
+ * The handed-back shutter, floating over the bottom band.
477
+ *
478
+ * ABSOLUTE, and that is the whole point. In flow it grew the footer the moment
479
+ * it appeared, which stole height from the `flex-grow` guide canvas above it —
480
+ * so the button arriving visibly resized the guide box and the feed under the
481
+ * applicant. Floating, it costs the layout nothing and nothing moves.
482
+ *
483
+ * It carries no state of its own: no ready/not-ready, no gate ring. It exists
484
+ * only once auto-capture has conceded, so a progress ring would be reporting
485
+ * the mechanism that just gave up, and a disabled-looking disc would refuse a
486
+ * tap the applicant is entitled to make.
487
+ */
488
+ const GuidedShutterDock = styled.div `
489
+ position: absolute;
490
+ left: 0;
491
+ right: 0;
492
+ z-index: 10001;
493
+ display: flex;
494
+ justify-content: center;
495
+ pointer-events: none;
496
+
497
+ /* Straddling the guide box's bottom edge EXACTLY, when we know where that
498
+ edge is. Anchoring to the surface bottom instead left it wherever the
499
+ letterboxing happened to put it — near the edge on a phone, floating well
500
+ below it on a desktop, and half-overlapping at sizes in between, which
501
+ reads as a mistake rather than a choice.
502
+
503
+ Centred on the edge is a decision the geometry can state: the disc sits
504
+ half on the frame and half on the surround, at every viewport. */
505
+ ${({ $centreY }) => $centreY === null
506
+ ? 'bottom: max(20px, env(safe-area-inset-bottom));'
507
+ : `top: ${$centreY}px; transform: translateY(-50%);`}
508
+ `;
509
+ const GuidedShutter = styled.button `
510
+ pointer-events: auto;
511
+ position: relative;
512
+ width: ${GUIDED_SHUTTER_SIZE_PX}px;
513
+ height: ${GUIDED_SHUTTER_SIZE_PX}px;
514
+ border: 0;
515
+ border-radius: 50%;
516
+ background: #fff;
517
+ cursor: pointer;
518
+ padding: 0;
519
+
520
+ /* The camera app's ring, drawn outside the disc so the tappable area is the
521
+ disc itself and the ring cannot swallow an edge tap. */
522
+ /* The camera app's ring, drawn outside the disc so the tappable area is the
523
+ disc itself and the ring cannot swallow an edge tap. It dims to a TRACK
524
+ while a tap is pending, so the sweep drawn over it reads as filling. */
525
+ &::after {
526
+ content: '';
527
+ position: absolute;
528
+ inset: -${GUIDED_SHUTTER_RING_PX}px;
529
+ border: ${GUIDED_SHUTTER_RING_WIDTH_PX}px solid
530
+ ${({ $pending }) => $pending ? 'rgba(255, 255, 255, 0.25)' : 'rgba(255, 255, 255, 0.9)'};
531
+ border-radius: 50%;
532
+ }
533
+
534
+ &:active {
535
+ transform: scale(0.94);
536
+ }
537
+
538
+ /* Held down for the length of the burst window. A one-shot state change, not
539
+ an animation: a spinner or a pulse here would repaint every frame on top
540
+ of live video for the exact interval the applicant is holding still. */
541
+ ${({ $pending }) => ($pending ? 'transform: scale(0.94);' : '')}
542
+
543
+ &:disabled {
544
+ cursor: default;
545
+ /* A pending shutter is working, not refusing. Only the not-yet-ready case
546
+ is dimmed far enough to read as unavailable. */
547
+ opacity: ${({ $pending }) => ($pending ? 0.8 : 0.4)};
548
+ }
549
+ `;
550
+ const shutterSweep = keyframes `
551
+ from { stroke-dashoffset: ${SHUTTER_RING_CIRCUMFERENCE_PX}; }
552
+ to { stroke-dashoffset: 0; }
553
+ `;
554
+ /** Holds the ring's square so the sweep can sit exactly on the disc. */
555
+ const GuidedShutterWell = styled.div `
556
+ position: relative;
557
+ width: ${SHUTTER_RING_BOX_PX}px;
558
+ height: ${SHUTTER_RING_BOX_PX}px;
559
+ display: grid;
560
+ place-items: center;
561
+ `;
562
+ /**
563
+ * The ring filling once, over exactly as long as the tap has to wait.
564
+ *
565
+ * DETERMINATE, and that is the point. An indeterminate spinner would be
566
+ * telling the applicant less than the SDK knows: the window's length is fixed
567
+ * the moment it opens, published as `manualBurstMs`, and a ring that arrives
568
+ * at full when the shutter fires says "this long" rather than "who knows".
569
+ *
570
+ * It is also the only animation on this screen, and it is bounded: ONE run of
571
+ * a few hundred milliseconds per tap, `forwards` so it holds rather than
572
+ * loops. A spinner here would repaint on top of live video for as long as it
573
+ * was on screen, which is the cost this whole flow has been avoiding.
574
+ *
575
+ * Reduced motion gets the finished ring immediately. The affordance is "the
576
+ * tap landed"; the sweep is how long, and someone who has asked for less
577
+ * motion can do without the second half.
578
+ */
579
+ const GuidedShutterSweep = styled.svg `
580
+ position: absolute;
581
+ inset: 0;
582
+ width: 100%;
583
+ height: 100%;
584
+ pointer-events: none;
585
+ /* Start at twelve o'clock rather than three. */
586
+ transform: rotate(-90deg);
587
+
588
+ circle {
589
+ fill: none;
590
+ stroke: #fff;
591
+ stroke-width: ${GUIDED_SHUTTER_RING_WIDTH_PX}px;
592
+ stroke-linecap: round;
593
+ stroke-dasharray: ${SHUTTER_RING_CIRCUMFERENCE_PX};
594
+ stroke-dashoffset: ${SHUTTER_RING_CIRCUMFERENCE_PX};
595
+ animation: ${shutterSweep} ${({ $durationMs }) => $durationMs}ms linear
596
+ forwards;
597
+ }
598
+
599
+ @media (prefers-reduced-motion: reduce) {
600
+ circle {
601
+ animation: none;
602
+ stroke-dashoffset: 0;
603
+ }
604
+ }
605
+ `;
606
+ /**
607
+ * The guided screen's surround.
608
+ *
609
+ * Near-black rather than pure black so the guide box's white brackets and the
610
+ * page inside it still read as the brightest things on screen, and so an OLED
611
+ * panel does not show a hard seam where the surround meets a dark camera feed.
612
+ */
613
+ const GUIDED_SURROUND_COLOR = '#0a0e13';
614
+ /**
615
+ * Title + instructions, floated over the feed instead of sitting in a bar.
616
+ *
617
+ * `pointer-events: none` so it can overlap the guide box without stealing a
618
+ * tap, and a top-down gradient rather than a solid fill so the feed reads as
619
+ * continuous behind it. No `backdrop-filter` — it repaints per frame over live
620
+ * video, which is exactly the GPU cost this screen cannot afford.
621
+ */
622
+ /**
623
+ * A ruled bar the title OWNS, rather than a caption floating over the feed.
624
+ *
625
+ * The floating version needed a gradient behind it purely to stay legible
626
+ * against whatever the camera happened to be pointed at, which is a tell that
627
+ * it was in the wrong place. Under `snapToGuides` the feed is letterboxed to
628
+ * the guide box, so the band above it is dead space — this gives it a job.
629
+ *
630
+ * IN FLOW, deliberately. It is a fixed height that never changes, so it costs
631
+ * the guide box the same room on every frame; the thing that must never be in
632
+ * flow is the shutter, which appears mid-session. See `GuidedShutterDock`.
633
+ */
634
+ const GuidedHeader = styled.div `
635
+ flex: none;
636
+ /* MUST BE PAINTED. Moving this into flow put it above the guide overlay's
637
+ canvas, and the mask only covers the canvas — so an unpainted header is a
638
+ transparent strip showing the HOST page through the top of the SDK. On a
639
+ white host that is white text on white.
640
+
641
+ Exactly the failure FooterRow had at the other end, recreated here the
642
+ moment the header stopped floating over the feed. Both strips now take the
643
+ surround colour from the same place the mask does.
644
+
645
+ No backticks in this comment: it is inside a styled-components template
646
+ literal, where one ends the template. That has now cost three debugging
647
+ rounds in this file. */
648
+ background: ${(props) => props.$maskColor};
649
+ padding: max(14px, env(safe-area-inset-top)) 20px 11px;
650
+ color: #fff;
651
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
652
+ `;
653
+ const GuidedHeading = styled.h1 `
654
+ margin: 0;
655
+ font-size: 14px;
656
+ font-weight: 640;
657
+ letter-spacing: -0.01em;
658
+ `;
659
+ const GuidedInstructions = styled.div `
660
+ margin: 6px auto 0;
661
+ max-width: 34ch;
662
+ font-size: 12.5px;
663
+ line-height: 1.45;
664
+ color: rgba(255, 255, 255, 0.88);
665
+ text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
666
+ /* Bounded like the bar version was: a long instruction must not grow until
667
+ it covers the guide box it is describing. */
668
+ max-height: 4.5rem;
669
+ overflow-y: auto;
670
+ /* The header is pointer-events:none so it cannot steal a tap over the guide
671
+ box — but that also kills touch and wheel scrolling on the one child that
672
+ can overflow. Re-enable it here only, and make the region focusable so the
673
+ overflow is reachable by keyboard too. */
674
+ pointer-events: auto;
675
+ overscroll-behavior: contain;
676
+ &:focus-visible {
677
+ outline: 2px solid rgba(255, 255, 255, 0.8);
678
+ outline-offset: 2px;
679
+ }
680
+ `;
194
681
  const HeadingRow = styled.div `
195
682
  background: ${(props) => props.$maskColor};
196
683
  text-align: center;
@@ -22,7 +22,7 @@ export type FaceLivenessViewVerbiage = SelfieCaptureViewVerbiage & {
22
22
  success?: FaceLivenessSuccessVerbiage;
23
23
  failure?: FaceLivenessFailureVerbiage;
24
24
  };
25
- export type FaceLivenessViewClassNames = SelfieCaptureViewClassNames & {
25
+ export type FaceLivenessViewClassNames = Omit<SelfieCaptureViewClassNames, 'fallback'> & {
26
26
  success?: FaceLivenessSuccessClassNames;
27
27
  failure?: FaceLivenessFailureClassNames;
28
28
  };
@@ -34,7 +34,7 @@ export type FaceLivenessViewColors = SelfieCaptureViewColors & {
34
34
  success?: FaceLivenessSuccessColors;
35
35
  failure?: FaceLivenessFailureColors;
36
36
  };
37
- export type FaceLivenessViewProps = Omit<SelfieCaptureViewProps, 'onCaptured'> & {
37
+ export type FaceLivenessViewProps = Omit<SelfieCaptureViewProps, 'onCaptured' | 'classNames'> & {
38
38
  /** Fires with the final (liveness-checked) image URL when the user clicks
39
39
  * Done on the success screen -- or immediately on entering 'completed',
40
40
  * exactly once, when `skipSuccessScreen` is true. */
@@ -84,5 +84,5 @@ export type FaceLivenessViewProps = Omit<SelfieCaptureViewProps, 'onCaptured'> &
84
84
  classNames?: FaceLivenessViewClassNames;
85
85
  assets?: FaceLivenessViewAssets;
86
86
  };
87
- export declare function FaceLivenessView({ controller, loadingOverlayMode, sessionReady: sessionReadyProp, lang, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, debugMode, showFaceLandmarks, debugShowSamplePoints, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, onExit, onExitAfterFailure, onRetry, onDone, skipSuccessScreen, maxRetries, allowLivenessFailure, videoRef, renderCameraFeed, renderFaceGuide, verbiage, classNames, colors, assets, }: FaceLivenessViewProps): ReactElement;
87
+ export declare function FaceLivenessView(props: FaceLivenessViewProps): ReactElement;
88
88
  //# sourceMappingURL=FaceLivenessView.d.ts.map