@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
@@ -14,8 +14,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  // type-imports `FaceGuideStatus` from face_liveness/FaceCaptureGuideOverlay.tsx
15
15
  // while this file value-imports back) — a type-only import erases at compile
16
16
  // time, so this never becomes a real runtime circular dependency.
17
+ import { memo } from 'react';
17
18
  import { styled } from 'styled-components';
18
- import { SelfieCaptureAnimatedMaskWithStatus } from './SelfieCaptureAnimatedMask';
19
+ import { SelfieCaptureAnimatedMaskWithStatus, } from './SelfieCaptureAnimatedMask';
19
20
  export const FaceCaptureGuideContainer = styled.div `
20
21
  position: absolute;
21
22
  z-index: 1000;
@@ -29,11 +30,16 @@ export const FaceCaptureGuideContainer = styled.div `
29
30
  justify-content: center;
30
31
  padding: 40px;
31
32
  box-sizing: border-box;
33
+ /* Keeps the spotlight dim inside the capture surface when the view is
34
+ embedded rather than full-screen. */
35
+ ${(props) => (props.$clip ? 'overflow: hidden;' : '')}
32
36
  `;
33
37
  const FaceCaptureGuideInner = styled.div `
34
38
  position: relative;
35
39
  height: 60%;
36
40
  `;
37
- export const FaceCaptureGuideOverlay = ({ classNames = {}, status = 'ready', borderWidth = 5, borderColor = 'white', borderOpacity = 0.8, }) => {
38
- return (_jsx(FaceCaptureGuideContainer, { className: classNames.container, children: _jsx(FaceCaptureGuideInner, { children: _jsx(SelfieCaptureAnimatedMaskWithStatus, { status: status, borderColor: borderColor, borderWidth: borderWidth, borderOpacity: borderOpacity, verticalAlign: "center" }) }) }));
39
- };
41
+ // Memoized: the capture surfaces re-render on every analyzed frame, but the
42
+ // guide's props only change when the mask status does.
43
+ export const FaceCaptureGuideOverlay = memo(function FaceCaptureGuideOverlay({ classNames = {}, status = 'ready', guideStyle, borderWidth = 5, borderColor, borderOpacity = 0.8, }) {
44
+ return (_jsx(FaceCaptureGuideContainer, { className: classNames.container, "$clip": guideStyle === 'spotlight', children: _jsx(FaceCaptureGuideInner, { children: _jsx(SelfieCaptureAnimatedMaskWithStatus, { status: status, guideStyle: guideStyle, borderColor: borderColor, borderWidth: borderWidth, borderOpacity: borderOpacity, verticalAlign: "center" }) }) }));
45
+ });
@@ -1,5 +1,7 @@
1
1
  import { type SVGProps } from 'react';
2
2
  import type { FaceGuideStatus } from './FaceCaptureGuideOverlay';
3
+ /** How the selfie guide prompts the user to put their head in the oval. */
4
+ export type FaceGuideStyle = 'pulse' | 'spotlight';
3
5
  export type SelfieCaptureAnimatedMaskProps = SVGProps<SVGSVGElement> & {
4
6
  frame?: number;
5
7
  borderWidth?: number;
@@ -7,8 +9,13 @@ export type SelfieCaptureAnimatedMaskProps = SVGProps<SVGSVGElement> & {
7
9
  borderOpacity?: number;
8
10
  verticalAlign?: 'center' | 'bottom';
9
11
  status?: FaceGuideStatus;
12
+ /** 'pulse' (default) animates waves out of the oval until a face is framed;
13
+ * 'spotlight' dims everything outside the oval instead, with no animation.
14
+ * The dim reaches the nearest clipping ancestor, so render the mask inside
15
+ * an `overflow: hidden` container (FaceCaptureGuideOverlay provides one). */
16
+ guideStyle?: FaceGuideStyle;
10
17
  };
11
- export declare function SelfieCaptureAnimatedMask({ frame, borderWidth, borderColor, borderOpacity, verticalAlign, status, ...props }: SelfieCaptureAnimatedMaskProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function SelfieCaptureAnimatedMask({ frame, borderWidth, borderColor, borderOpacity, verticalAlign, status, guideStyle, ...props }: SelfieCaptureAnimatedMaskProps): import("react/jsx-runtime").JSX.Element;
12
19
  export declare function SelfieCaptureAnimatedMaskWithStatus({ status, ...props }: SelfieCaptureAnimatedMaskProps & {
13
20
  status?: FaceGuideStatus;
14
21
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"SelfieCaptureAnimatedMask.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureAnimatedMask.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAiMhE,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAS,EACT,WAAe,EACf,WAAqB,EACrB,aAAmB,EACnB,aAAwB,EACxB,MAAgB,EAChB,GAAG,KAAK,EACT,EAAE,8BAA8B,2CAyMhC;AAED,wBAAgB,mCAAmC,CAAC,EAClD,MAAgB,EAChB,GAAG,KAAK,EACT,EAAE,8BAA8B,GAAG;IAClC,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB,2CAoBA"}
1
+ {"version":3,"file":"SelfieCaptureAnimatedMask.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureAnimatedMask.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAWhE,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,CAAA;AAyNlD,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB;;;iFAG6E;IAC7E,UAAU,CAAC,EAAE,cAAc,CAAA;CAC5B,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAS,EACT,WAAe,EACf,WAAW,EACX,aAAmB,EACnB,aAAwB,EACxB,MAAgB,EAChB,UAAU,EACV,GAAG,KAAK,EACT,EAAE,8BAA8B,2CA8MhC;AAED,wBAAgB,mCAAmC,CAAC,EAClD,MAAgB,EAChB,GAAG,KAAK,EACT,EAAE,8BAA8B,GAAG;IAClC,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB,2CAoBA"}
@@ -3,14 +3,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  // lines 305-730: `HeadGuideSvg`, `HeadGuide`, `SelfieCaptureAnimatedMask`, and
4
4
  // `SelfieCaptureAnimatedMaskWithStatus` (the file's other export, the
5
5
  // `SelfieCaptureLoadingGraphic` avatar animation, lives in the sibling
6
- // ./SelfieCaptureLoadingGraphic.tsx per the task-3 file split). SVG paths,
7
- // keyframes and timings (250ms frame cycle, 2s waves, 0.66s/1.33s stagger)
8
- // are kept byte-identical. Only sanctioned transforms applied:
6
+ // ./SelfieCaptureLoadingGraphic.tsx per the task-3 file split). SVG paths
7
+ // and the 250ms processing frame cycle are kept byte-identical; the ready-state
8
+ // waves deliberately diverge from sdk2 for GPU cost (see
9
+ // `headGuideWavesAnimation`). Otherwise only sanctioned transforms applied:
9
10
  // - unused `React` default import dropped (new JSX transform);
10
11
  // - `styled` repointed to a named import;
11
- // - `wavesAnimation` repointed to this package's existing
12
- // components/common/animation.ts (already ported in iteration 3 and used
13
- // by components/guides/IdCaptureGuidesCommon.tsx's own waves stack);
14
12
  // - `useResizeObserver` repointed to this package's layout/useResizeObserver;
15
13
  // - `FaceGuideStatus` type-only-imported from the sibling
16
14
  // ./FaceCaptureGuideOverlay.tsx (see that file's header comment for why
@@ -21,12 +19,34 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
21
19
  // guide_images/defaults.ts uses for its own CDN asset URLs — the resolved
22
20
  // URL string is unchanged.
23
21
  import { forwardRef, useEffect, useMemo, useRef, useState, } from 'react';
24
- import { styled, useTheme } from 'styled-components';
25
- import { wavesAnimation } from '../common/animation';
22
+ import { keyframes, styled, useTheme } from 'styled-components';
26
23
  import useResizeObserver from '../../layout/useResizeObserver';
27
24
  import { DEFAULT_CDN_URL } from '../../utils/cdn';
28
- const HeadGuideSvg = forwardRef(({ borderColor = 'white', borderOpacity = 0.8, borderWidth = 5, status = 'ready', ...props }, ref) => (_jsxs("svg", { ...props, ref: ref, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [_jsx("path", { d: "M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z", stroke: borderColor, strokeOpacity: borderOpacity, strokeWidth: borderWidth }), status === 'success' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("path", { d: "M504 440.5L512 448L531 427", stroke: "white", strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round" })] })), status === 'failure' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("image", { href: `${DEFAULT_CDN_URL}/x.svg`, x: "507", y: "427", width: "24", height: "24" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] })));
25
+ const HEAD_GUIDE_OVAL_PATH = 'M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z';
26
+ // A rectangle far larger than any screen with the oval cut out of it
27
+ // (evenodd), so one static path dims everything except the guide.
28
+ const SPOTLIGHT_PATH = `M-10000 -10000H10000V10000H-10000Z ${HEAD_GUIDE_OVAL_PATH}`;
29
+ const HeadGuideSvg = forwardRef(({ borderColor = 'white', borderOpacity = 0.8, borderWidth = 5, status = 'ready', ...props }, ref) => (_jsxs("svg", { ...props, ref: ref, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [_jsx("path", { d: HEAD_GUIDE_OVAL_PATH, stroke: borderColor, strokeOpacity: borderOpacity, strokeWidth: borderWidth }), status === 'success' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("path", { d: "M504 440.5L512 448L531 427", stroke: "white", strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round" })] })), status === 'failure' && (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "518.5", cy: "438.5", r: "25.5", fill: borderColor }), _jsx("image", { href: `${DEFAULT_CDN_URL}/x.svg`, x: "507", y: "427", width: "24", height: "24" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] })));
29
30
  HeadGuideSvg.displayName = 'HeadGuideSvg';
31
+ // One wave that grows to 1.3x and fades out, three times, then stops. sdk2
32
+ // stacked three copies growing to 2x on an infinite loop: three translucent
33
+ // layers up to 4x the guide's area, blended over the video at the display
34
+ // refresh rate for the whole capture, which low-end GPUs can't keep up with
35
+ // while also running the camera and face model. Waves only render while the
36
+ // status is 'ready', so the pulse replays each time the face leaves the guide.
37
+ const headGuideWavesAnimation = keyframes `
38
+ 0% {
39
+ opacity: 0;
40
+ transform: scale(1);
41
+ }
42
+ 60% {
43
+ opacity: 1;
44
+ }
45
+ 100% {
46
+ opacity: 0;
47
+ transform: scale(1.3);
48
+ }
49
+ `;
30
50
  const PulsingHeadGuideContainer = styled.div `
31
51
  display: flex;
32
52
  position: relative;
@@ -35,29 +55,36 @@ const PulsingHeadGuideContainer = styled.div `
35
55
 
36
56
  & > .idmSdkWaves {
37
57
  position: absolute;
38
- animation: ${wavesAnimation} 2s ease-out infinite;
39
- transform-style: preserve-3d;
58
+ opacity: 0;
59
+ animation: ${headGuideWavesAnimation} 2s ease-out 3;
40
60
 
41
- &:nth-child(2) {
42
- animation-delay: 0.66s;
61
+ @media (prefers-reduced-motion: reduce) {
62
+ display: none;
43
63
  }
64
+ }
44
65
 
45
- &:nth-child(3) {
46
- animation-delay: 1.33s;
47
- }
66
+ /* Paints far past its box; the nearest clipping ancestor bounds it
67
+ (FaceCaptureGuideOverlay clips to the capture surface). */
68
+ & > .idmSdkSpotlight {
69
+ position: absolute;
70
+ overflow: visible;
71
+ pointer-events: none;
48
72
  }
49
73
 
50
74
  & > .idmSdkWavesOrigin {
51
75
  position: relative;
52
76
  }
53
77
  `;
54
- function HeadGuide({ status = 'ready', ...props }) {
78
+ function HeadGuide({ status = 'ready', guideStyle = 'pulse', ...props }) {
55
79
  const ref = useRef(null);
56
80
  const { ref: parentRef, height: parentHeight } = useResizeObserver();
57
81
  const [contentAspectRatio, setContentAspectRatio] = useState();
58
82
  const theme = useTheme();
59
83
  const wavesDisabled = theme.selfieCapture?.guides?.wavesDisabled ?? false;
60
84
  const wavesColor = theme.selfieCapture?.guides?.wavesColor ?? '#287ec6';
85
+ const spotlightColor = guideStyle === 'spotlight'
86
+ ? (theme.selfieCapture?.guides?.spotlightColor ?? 'rgba(0, 0, 0, 0.55)')
87
+ : undefined;
61
88
  useEffect(() => {
62
89
  if (!ref.current)
63
90
  return;
@@ -65,7 +92,11 @@ function HeadGuide({ status = 'ready', ...props }) {
65
92
  setContentAspectRatio((bbox.x + bbox.width + bbox.x) / (bbox.y + bbox.height + bbox.y));
66
93
  }, []);
67
94
  const scaledWidth = useMemo(() => contentAspectRatio && parentHeight && parentHeight / contentAspectRatio, [contentAspectRatio, parentHeight]);
68
- return (_jsxs(PulsingHeadGuideContainer, { ref: parentRef, children: [status === 'ready' && !wavesDisabled && (_jsxs(_Fragment, { children: [_jsx(HeadGuideSvg, { ...props, className: "idmSdkWaves", borderOpacity: 0.25, borderColor: wavesColor, width: scaledWidth, height: parentHeight }), _jsx(HeadGuideSvg, { ...props, className: "idmSdkWaves", borderOpacity: 0.25, borderColor: wavesColor, width: scaledWidth, height: parentHeight }), _jsx(HeadGuideSvg, { ...props, className: "idmSdkWaves", borderOpacity: 0.25, borderColor: wavesColor, width: scaledWidth, height: parentHeight })] })), _jsx(HeadGuideSvg, { ...props, ref: ref, borderOpacity: 1, className: `idmSdkWavesOrigin ${props.className ?? ''}`, status: status, width: scaledWidth, height: parentHeight })] }));
95
+ return (_jsxs(PulsingHeadGuideContainer, { ref: parentRef, children: [spotlightColor && (
96
+ // Its own svg, so the origin's getBBox() (which sizes the guide) never
97
+ // sees the huge rectangle. Painted before the origin so the outline
98
+ // and status badges stay on top.
99
+ _jsx("svg", { className: "idmSdkSpotlight", viewBox: "271 92 297 406", width: scaledWidth, height: parentHeight, "aria-hidden": true, children: _jsx("path", { d: SPOTLIGHT_PATH, fill: spotlightColor, fillRule: "evenodd" }) })), status === 'ready' && guideStyle === 'pulse' && !wavesDisabled && (_jsx(HeadGuideSvg, { ...props, className: "idmSdkWaves", borderOpacity: 0.25, borderColor: wavesColor, width: scaledWidth, height: parentHeight })), _jsx(HeadGuideSvg, { ...props, ref: ref, borderOpacity: 1, className: `idmSdkWavesOrigin ${props.className ?? ''}`, status: status, width: scaledWidth, height: parentHeight })] }));
69
100
  }
70
101
  const AbsoluteSvg = styled.svg `
71
102
  position: absolute;
@@ -80,8 +111,11 @@ const RelativeSvgContainer = styled.div `
80
111
  display: flex;
81
112
  align-items: ${(props) => props.$verticalAlign === 'bottom' ? 'flex-end' : 'center'};
82
113
  `;
83
- export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderColor = 'white', borderOpacity = 0.8, verticalAlign = 'center', status = 'ready', ...props }) {
114
+ export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderColor, borderOpacity = 0.8, verticalAlign = 'center', status = 'ready', guideStyle, ...props }) {
84
115
  const theme = useTheme();
116
+ // The outline while no face is framed yet. An explicit `borderColor` wins,
117
+ // as the video-ID guides pass their own.
118
+ const unsatisfiedColor = borderColor ?? theme.selfieCapture?.guides?.unsatisfiedColor ?? 'white';
85
119
  const satisfiedColor = theme.selfieCapture?.guides?.satisfiedColor ??
86
120
  'var(--idm-color-positive-600)';
87
121
  const negativeColor = theme.selfieCapture?.guides?.failureColor ?? 'var(--idm-color-negative-600)';
@@ -89,8 +123,8 @@ export function SelfieCaptureAnimatedMask({ frame = 0, borderWidth = 5, borderCo
89
123
  ? negativeColor
90
124
  : status === 'success'
91
125
  ? satisfiedColor
92
- : borderColor;
93
- return (_jsxs(RelativeSvgContainer, { "$verticalAlign": verticalAlign, children: [_jsx(HeadGuide, { borderOpacity: borderOpacity, borderWidth: borderWidth, borderColor: statusBorderColor, status: status, ...props }), status === 'processing' && (_jsxs(AbsoluteSvg, { ...props, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [frame > 1 && (_jsxs(_Fragment, { children: [frame > 2 && (_jsxs(_Fragment, { children: [frame > 3 && (_jsxs(_Fragment, { children: [frame > 4 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M298.5 182.5L419 164.5L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "419", cy: "165", r: "7", fill: "white" })] })), _jsx("path", { d: "M299.939 262.805L419 478.5L538.5 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L418.871 230.054L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L299.939 262.805", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M540.001 182L538.501 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "299.914", cy: "182", r: "7", fill: "white" }), _jsx("circle", { cx: "540", cy: "182", r: "7", fill: "white" })] })), _jsx("path", { d: "M418.828 230L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263.001L419 342.501", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.5 409L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M536.5 410L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "229.971", r: "7", fill: "white" }), _jsx("circle", { cx: "419", cy: "342.4", r: "7", fill: "white" })] })), _jsx("path", { d: "M538.5 261.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("path", { d: "M419 478.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("circle", { cx: "537", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "537", cy: "409", r: "7", fill: "white" })] })), frame > 0 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M301.501 409L300.001 263", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.501 409L419.001 478.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "477.576", r: "7", fill: "white" }), _jsx("circle", { cx: "301.914", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "301.444", cy: "409", r: "7", fill: "white" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] }))] }));
126
+ : unsatisfiedColor;
127
+ return (_jsxs(RelativeSvgContainer, { "$verticalAlign": verticalAlign, children: [_jsx(HeadGuide, { borderOpacity: borderOpacity, borderWidth: borderWidth, borderColor: statusBorderColor, status: status, guideStyle: guideStyle, ...props }), status === 'processing' && (_jsxs(AbsoluteSvg, { ...props, viewBox: "271 92 297 406", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("g", { clipPath: "url(#clip0_428_1188)", children: [frame > 1 && (_jsxs(_Fragment, { children: [frame > 2 && (_jsxs(_Fragment, { children: [frame > 3 && (_jsxs(_Fragment, { children: [frame > 4 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M298.5 182.5L419 164.5L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "419", cy: "165", r: "7", fill: "white" })] })), _jsx("path", { d: "M299.939 262.805L419 478.5L538.5 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L418.871 230.054L540 182", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M298.5 182.5L299.939 262.805", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M540.001 182L538.501 261.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "299.914", cy: "182", r: "7", fill: "white" }), _jsx("circle", { cx: "540", cy: "182", r: "7", fill: "white" })] })), _jsx("path", { d: "M418.828 230L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263.001L419 342.501", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.5 409L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M536.5 410L419 342.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M300 263L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M538.5 261.5L419 230", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "229.971", r: "7", fill: "white" }), _jsx("circle", { cx: "419", cy: "342.4", r: "7", fill: "white" })] })), _jsx("path", { d: "M538.5 261.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("path", { d: "M419 478.5L536.5 410", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 3 && frame < 7 ? 0.3 : 1 }), _jsx("circle", { cx: "537", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "537", cy: "409", r: "7", fill: "white" })] })), frame > 0 && (_jsxs(_Fragment, { children: [_jsx("path", { d: "M301.501 409L300.001 263", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("path", { d: "M301.501 409L419.001 478.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: frame > 1 && frame < 6 ? 0.3 : 1 }), _jsx("circle", { cx: "419", cy: "477.576", r: "7", fill: "white" }), _jsx("circle", { cx: "301.914", cy: "263", r: "7", fill: "white" }), _jsx("circle", { cx: "301.444", cy: "409", r: "7", fill: "white" })] }))] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_428_1188", children: _jsx("rect", { width: "840", height: "740", fill: "white" }) }) })] }))] }));
94
128
  }
95
129
  export function SelfieCaptureAnimatedMaskWithStatus({ status = 'ready', ...props }) {
96
130
  const [frame, setFrame] = useState(1);
@@ -1,9 +1,12 @@
1
1
  import { ReactElement, ReactNode, type RefObject } from 'react';
2
- import type { SelfieCaptureController, SelfieCaptureControllerState } from '@idmission/websdk-core/selfieCapture';
2
+ import { FaceMessageCode } from '@idmission/websdk-core/selfieCapture';
3
+ import type { SelfieCaptureController, SelfieCaptureControllerState, SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
3
4
  import { type FaceCaptureGuideOverlayClassNames, type FaceGuideStatus } from './FaceCaptureGuideOverlay';
5
+ import type { FaceGuideStyle } from './SelfieCaptureAnimatedMask';
4
6
  import { type GuidanceMessageVariant } from '../GuidanceMessage';
5
7
  import { type SelfieCaptureLoadingOverlayAssets, type SelfieCaptureLoadingOverlayClassNames, type SelfieCaptureLoadingOverlayColors, type SelfieCaptureLoadingOverlayMode, type SelfieCaptureLoadingOverlayVerbiage } from '../selfie_loading/SelfieCaptureLoadingOverlay';
6
8
  import { type ErrorScreenClassNames, type ErrorScreenVerbiage } from '../error/ErrorScreen';
9
+ import type { CameraAccessDeniedReason } from '../error/CameraAccessDeniedOverlay';
7
10
  import { type SelfieCaptureFallbackClassNames, type SelfieCaptureFallbackColors, type SelfieCaptureFallbackVerbiage } from '../fallback/SelfieCaptureFallback';
8
11
  export type SelfieCaptureSurfaceClassNames = {
9
12
  cameraFeed?: string;
@@ -49,7 +52,9 @@ export type SelfieCaptureSurfaceProps = {
49
52
  onLoadingCompleted?: () => void;
50
53
  onLoadingFailed?: (error?: Error) => void;
51
54
  onLoadingOverlayDismissed?: () => void;
52
- onCameraAccessDenied?: () => void;
55
+ /** Fires once per camera failure, with whether permission was refused or
56
+ * the camera could not be started. */
57
+ onCameraAccessDenied?: (reason: CameraAccessDeniedReason) => void;
53
58
  /** sdk2's `onModelError` / `onSelfieCaptureModelError`: fires once with the
54
59
  * Error when a selfie model fails to load or times out. `onLoadingFailed`
55
60
  * carries the same event but is the loading overlay's own lifecycle
@@ -81,12 +86,15 @@ export type SelfieCaptureSurfaceProps = {
81
86
  silentFallback?: boolean;
82
87
  manualCaptureText?: ReactNode;
83
88
  manualCaptureButtonText?: ReactNode;
89
+ recoveryCaptureText?: ReactNode;
90
+ recoveryCaptureButtonText?: ReactNode;
84
91
  /** An existing, persistently mounted video element owned by a parent flow. */
85
92
  videoRef?: RefObject<HTMLVideoElement | null>;
86
93
  /** False when a parent flow owns the shared camera feed element. */
87
94
  renderCameraFeed?: boolean;
88
95
  /** False when a parent flow owns the face-guide composition. */
89
96
  renderFaceGuide?: boolean;
97
+ faceGuideStyle?: FaceGuideStyle;
90
98
  /** Whether the mask/guidance-pill layer renders at all -- the calling
91
99
  * view's own phase-set decision (plain vs. liveness disagree). */
92
100
  showCaptureSurface: boolean;
@@ -94,6 +102,14 @@ export type SelfieCaptureSurfaceProps = {
94
102
  showGuidancePill: boolean;
95
103
  guidanceText: ReactNode;
96
104
  guidanceVariant: GuidanceMessageVariant;
105
+ /**
106
+ * Stable identifier for the message currently in the pill, emitted as
107
+ * `data-guidance-code` so customers can target one message from their own
108
+ * stylesheet. `MANUAL_CAPTURE` is substituted here rather than by the callers
109
+ * because the manual-capture prompt REPLACES guidance in the same pill, so
110
+ * the code has to follow whichever text actually rendered.
111
+ */
112
+ guidanceCode?: FaceMessageCode | SelfieGuidanceCode;
97
113
  /** Renders sdk2's face-detection debug overlay (box + keypoints/mesh +
98
114
  * sample points) and DebugStatsPane readout -- sdk2 SelfieCapture.tsx:
99
115
  * 346-453. Default false; both SelfieCaptureView and FaceLivenessView
@@ -122,5 +138,5 @@ export type SelfieCaptureSurfaceProps = {
122
138
  colors?: SelfieCaptureSurfaceColors;
123
139
  assets?: SelfieCaptureSurfaceAssets;
124
140
  };
125
- export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
141
+ export declare function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError, fallbackCapture, silentFallback, manualCaptureText, manualCaptureButtonText, recoveryCaptureText, recoveryCaptureButtonText, videoRef, renderCameraFeed, renderFaceGuide, faceGuideStyle, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode, showFaceLandmarks, debugShowSamplePoints, verbiage, classNames, colors, assets, }: SelfieCaptureSurfaceProps): ReactElement;
126
142
  //# sourceMappingURL=SelfieCaptureSurface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"AA8BA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACzC,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EACnC,MAAM,mCAAmC,CAAA;AAS1C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,iCAAiC,CAAA;IAC1C,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,qCAAqC,CAAA;IACtD,KAAK,CAAC,EAAE,qBAAqB,CAAA;IAC7B,QAAQ,CAAC,EAA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MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,sCAA8C,EAC9C,eAAsB,EACtB,cAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,QAAQ,EACR,gBAAuB,EACvB,eAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,SAAiB,EACjB,iBAAyB,EACzB,qBAA4B,EAC5B,QAAa,EACb,UAAe,EACf,MAAW,EACX,MAAW,GACZ,EAAE,yBAAyB,GAAG,YAAY,CA8Z1C"}
1
+ {"version":3,"file":"SelfieCaptureSurface.d.ts","sourceRoot":"","sources":["../../../src/components/selfie/SelfieCaptureSurface.tsx"],"names":[],"mappings":"AA+BA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,EAGL,eAAe,EAChB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,sCAAsC,CAAA;AAM7C,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACzC,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,wBAAwB,E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import { useCaptureProgressController, useDisplayedGuidance } from '../../flows/CaptureProgress';
2
3
  // Internal shared render surface extracted from SelfieCaptureView (task-7)
3
4
  // so FaceLivenessView (task-8) can compose the exact same
4
5
  // feed/mask/pill/loading-overlay/error wiring without duplicating it. NOT
@@ -31,6 +32,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
31
32
  // `state.capturedSelfie`/`state.liveness`.
32
33
  import { useCallback, useEffect, useRef, useState, } from 'react';
33
34
  import { styled } from 'styled-components';
35
+ import { EAR_CALIBRATION_MS, EYES_OPEN_WINDOW_MS, FaceMessageCode, } from '@idmission/websdk-core/selfieCapture';
36
+ import { BLINK_OPEN_FRACTION, computeEARPerEye, } from '@idmission/websdk-core/liveness';
34
37
  import { SelfieCameraFeed } from './SelfieCameraFeed';
35
38
  import { FaceCaptureGuideOverlay, } from './FaceCaptureGuideOverlay';
36
39
  import { GuidanceMessage, GuidanceMessageContainer, } from '../GuidanceMessage';
@@ -38,9 +41,10 @@ import { ExitCaptureButton } from '../ExitCaptureButton';
38
41
  import { LoaderButton } from '../common/LoaderButton';
39
42
  import { SelfieCaptureLoadingOverlay, } from '../selfie_loading/SelfieCaptureLoadingOverlay';
40
43
  import { ErrorScreen, } from '../error/ErrorScreen';
44
+ import { useCameraAccessDeniedReport } from '../error/useCameraAccessDeniedReport';
41
45
  import { SelfieCaptureFallback, } from '../fallback/SelfieCaptureFallback';
42
- import { DebugStatsPane, FaceDetectionKeypointMarker, ObjectDetectionDebugOverlayDiv, SelfieCaptureFaceDebugBox, useDebugScalingDetails, } from '../debug/debug';
43
- export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
46
+ import { CameraDebugStatus, DebugStatsPane, FaceDetectionKeypointMarker, ObjectDetectionDebugOverlayDiv, SelfieCaptureFaceDebugBox, useDebugScalingDetails, } from '../debug/debug';
47
+ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, sessionReady, autoContinueAfterLoading, showIntroScreen, transitionFromIdCapture, onExit, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onLoadingOverlayDismissed, onCameraAccessDenied, onModelError, onCameraTamperingDetected, onExitAfterTamperSealPopped, onUserCancel, customOverlayContent, allowManualSelfieCaptureOnLoadingError = false, fallbackCapture = true, silentFallback = false, manualCaptureText, manualCaptureButtonText, recoveryCaptureText, recoveryCaptureButtonText, videoRef, renderCameraFeed = true, renderFaceGuide = true, faceGuideStyle, showCaptureSurface, maskStatus, showGuidancePill, guidanceText, guidanceVariant, guidanceCode, debugMode = false, showFaceLandmarks = false, debugShowSamplePoints = true, verbiage = {}, classNames = {}, colors = {}, assets = {}, }) {
44
48
  // Same ref-callback + effect-keyed-only-on-[controller] pattern as
45
49
  // IdCaptureView/SelfieCaptureView (see SelfieCaptureView.tsx's header
46
50
  // comment for the full rationale).
@@ -122,6 +126,7 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
122
126
  videoWidth: videoDims.videoWidth,
123
127
  videoHeight: videoDims.videoHeight,
124
128
  });
129
+ useCaptureProgressController(controller);
125
130
  const manualFallbackAvailable = allowManualSelfieCaptureOnLoadingError &&
126
131
  state.error?.code === 'MODEL_LOAD_FAILED';
127
132
  // The two halves of sdk2's fork are mutually exclusive: with the flag set
@@ -132,6 +137,8 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
132
137
  const manualCaptureEnabled = allowManualSelfieCaptureOnLoadingError &&
133
138
  state.phase === 'capturing' &&
134
139
  state.models.loadState === 'error';
140
+ const showCaptureRecovery = showCaptureSurface && state.phase === 'capturing' &&
141
+ state.captureRecovery?.manualCaptureAvailable && !manualCaptureEnabled;
135
142
  const showLoadingOverlay = state.phase === 'initializing' ||
136
143
  state.phase === 'loading' ||
137
144
  manualFallbackAvailable;
@@ -149,8 +156,15 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
149
156
  },
150
157
  }
151
158
  : state;
159
+ const displayedCode = manualCaptureEnabled ? FaceMessageCode.MANUAL_CAPTURE : guidanceCode;
160
+ const displayedText = manualCaptureEnabled ? manualCaptureText : guidanceText;
161
+ const isFaceMessageCode = (code) => Object.values(FaceMessageCode).some(value => value === code);
162
+ useDisplayedGuidance((showGuidancePill || manualCaptureEnabled) && displayedText && displayedCode && displayedCode !== 'NONE'
163
+ ? isFaceMessageCode(displayedCode)
164
+ ? { kind: 'displayed', message: { family: 'face', code: displayedCode } }
165
+ : { kind: 'displayed', message: { family: 'selfie', code: displayedCode } }
166
+ : { kind: 'no-prompt' });
152
167
  const reportedModelErrorRef = useRef(null);
153
- const cameraDeniedReportedRef = useRef(false);
154
168
  const tamperReportedRef = useRef(false);
155
169
  useEffect(() => {
156
170
  const modelError = state.models.error;
@@ -161,13 +175,6 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
161
175
  }
162
176
  if (!modelError)
163
177
  reportedModelErrorRef.current = null;
164
- const cameraDenied = state.error?.code === 'CAMERA_PERMISSION_DENIED';
165
- if (cameraDenied && !cameraDeniedReportedRef.current) {
166
- cameraDeniedReportedRef.current = true;
167
- onCameraAccessDenied?.();
168
- }
169
- if (!cameraDenied)
170
- cameraDeniedReportedRef.current = false;
171
178
  // Same one-shot latch as IdCaptureView's: the host counts detections, not
172
179
  // renders, and a cleared-then-re-detected tamper is a second detection.
173
180
  const tampered = state.error?.code === 'CAMERA_TAMPERING_SUSPECTED';
@@ -178,17 +185,24 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
178
185
  if (!tampered)
179
186
  tamperReportedRef.current = false;
180
187
  }, [
181
- onCameraAccessDenied,
182
188
  onCameraTamperingDetected,
183
189
  onLoadingFailed,
184
190
  onModelError,
185
191
  state.error?.code,
186
192
  state.models.error,
187
193
  ]);
194
+ useCameraAccessDeniedReport(controller, state.error?.code, onCameraAccessDenied);
188
195
  const handleLoadingContinue = useCallback(() => {
189
196
  void controller.actions.start();
190
197
  onLoadingOverlayDismissed?.();
191
198
  }, [controller, onLoadingOverlayDismissed]);
199
+ // Back to the instructions BEFORE telling the host, as sdk2 did
200
+ // (FaceLivenessWizard.tsx:394): handing `onExit` to the button raw left the
201
+ // capture running behind a host that expected the loading screen.
202
+ const handleExit = useCallback(() => {
203
+ controller.actions.exitCapture();
204
+ onExit?.();
205
+ }, [controller, onExit]);
192
206
  // plan-3 ruling: camera-acquisition errors recover via requestCamera()
193
207
  // (retry() explicitly excludes them, controller.ts), everything else via
194
208
  // retry(). Applies unconditionally across every loadingOverlayMode.
@@ -201,7 +215,9 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
201
215
  controller.actions.retry();
202
216
  }
203
217
  }, [controller, state.error]);
204
- return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage, children: manualCaptureEnabled ? manualCaptureText : guidanceText }) })), manualCaptureEnabled && (_jsx(ManualCaptureButtonContainer, { className: classNames.manualCaptureBtnContainer, children: _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: manualCaptureButtonText }) })), (debugMode || showFaceLandmarks) &&
218
+ return (_jsxs(_Fragment, { children: [renderCameraFeed ? (_jsx(SelfieCameraFeed, { videoRef: setVideoRef, isRearFacing: state.camera.isRearFacing, className: classNames.cameraFeed })) : null, renderFaceGuide && showCaptureSurface && (_jsx(FaceCaptureGuideOverlay, { status: maskStatus, guideStyle: faceGuideStyle, classNames: classNames.guides })), (showGuidancePill || manualCaptureEnabled) && (_jsx(GuidanceMessageContainer, { "$top": "12px", className: classNames.guidanceMessageContainer, children: _jsx(GuidanceMessage, { "$variant": guidanceVariant, className: classNames.guidanceMessage, "data-guidance-code": manualCaptureEnabled
219
+ ? FaceMessageCode.MANUAL_CAPTURE
220
+ : guidanceCode, children: manualCaptureEnabled ? manualCaptureText : guidanceText }) })), manualCaptureEnabled && (_jsx(ManualCaptureButtonContainer, { className: classNames.manualCaptureBtnContainer, children: _jsx(LoaderButton, { variant: "positive", finished: true, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: manualCaptureButtonText }) })), showCaptureRecovery && (_jsxs(CaptureRecoveryActions, { className: classNames.manualCaptureBtnContainer, children: [_jsx("p", { children: recoveryCaptureText }), _jsx(LoaderButton, { variant: "positive", finished: true, disabled: !state.captureRecovery?.manualCaptureReady, className: classNames.manualCaptureBtn, onClick: () => controller.actions.captureNow(), children: recoveryCaptureButtonText })] })), (debugMode || showFaceLandmarks) &&
205
221
  showCaptureSurface &&
206
222
  state.prediction?.face && (_jsxs(ObjectDetectionDebugOverlayDiv, { children: [_jsx(SelfieCaptureFaceDebugBox, { face: state.prediction.face, scaling: debugScaling, color: state.prediction.faceReady ? 'green' : 'red', showBoundingBox: debugMode, showLandmarks: debugMode || showFaceLandmarks }), debugMode &&
207
223
  debugShowSamplePoints &&
@@ -216,14 +232,19 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
216
232
  ? (pt.y / videoHeight) * pageHeight
217
233
  : (pt.y / videoHeight) * scaledHeight - yOffset;
218
234
  return (_jsx(FaceDetectionKeypointMarker, { style: { left: left - 2, top: top - 2 } }, i));
219
- })] })), debugMode && showCaptureSurface && (_jsxs(DebugStatsPane, { children: [state.camera.ready ? '✅ Camera ready' : '❌ Camera not ready', _jsx("br", {}), !state.prediction?.faceNotDetected ? '✅' : '❌', " Face Detected", _jsx("br", {}), !state.prediction?.faceNotCentered ? '✅' : '❌', " Face Centered", _jsx("br", {}), !state.prediction?.faceTooClose && !state.prediction?.faceTooFar
235
+ })] })), debugMode && showCaptureSurface && (_jsxs(DebugStatsPane, { children: [_jsx(CameraDebugStatus, { ready: state.camera.ready, width: videoDims.videoWidth, height: videoDims.videoHeight }), _jsx("br", {}), !state.prediction?.faceNotDetected ? '✅' : '❌', " Face Detected", _jsx("br", {}), !state.prediction?.faceNotCentered ? '✅' : '❌', " Face Centered", _jsx("br", {}), !state.prediction?.faceTooClose && !state.prediction?.faceTooFar
220
236
  ? '✅'
221
237
  : '❌', ' ', "Face", ' ', state.prediction?.faceTooClose
222
238
  ? 'Too Close'
223
239
  : state.prediction?.faceTooFar
224
240
  ? 'Too Far'
225
241
  : 'Distance Correct', _jsx("br", {}), !state.prediction?.faceLookingAway ? '✅' : '❌', " Face Looking Forward", _jsx("br", {}), !state.prediction?.faceIsStable ? '✅' : '❌', " Face Is Stable", _jsx("br", {}), !state.prediction?.noseIsStable ? '✅' : '❌', " Nose Is Stable", _jsx("br", {}), state.prediction?.faceVisibilityTooLow ? '❌' : '✅', " Visibility", state.thresholds.minCaptureBrightnessThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Brightness:", ' ', state.prediction?.brightness?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureBrightnessThreshold, ")"] })), state.thresholds.minCaptureRangeThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Range: ", state.prediction?.range?.toFixed(1) ??
226
- '—', ' ', "(min: ", state.thresholds.minCaptureRangeThreshold, ")"] })), state.thresholds.minCaptureVarianceThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Variance:", ' ', state.prediction?.variance?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureVarianceThreshold, ")"] }))] })), onExit != null && (_jsx(ExitCaptureButton, { onClick: onExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(SelfieCaptureLoadingOverlay, { state: loadingOverlayState, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, customOverlayContent: customOverlayContent, onContinue: handleLoadingContinue, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onUserCancel: onUserCancel, onRequestCamera: () => controller.actions.requestCamera() })), showStockCameraFallback && (_jsx(SelfieCaptureFallback, { silentFallback: silentFallback, onFinished: (imageDataUrl) => controller.actions.captureManually(imageDataUrl), classNames: classNames.fallback, colors: colors.fallback, verbiage: verbiage.fallback })), state.phase === 'error' &&
242
+ '—', ' ', "(min: ", state.thresholds.minCaptureRangeThreshold, ")"] })), state.thresholds.minCaptureVarianceThreshold !== undefined && (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0Variance:", ' ', state.prediction?.variance?.toFixed(1) ?? '—', " (min:", ' ', state.thresholds.minCaptureVarianceThreshold, ")"] })), _jsx("br", {}), _jsx(EyesOpenDebugLines, { state: state }), state.handOverFace.status !== 'off' && (_jsxs(_Fragment, { children: [_jsx("br", {}), state.handOverFace.lastCheck
243
+ ? state.handOverFace.lastCheck.handOverFace
244
+ ? '❌'
245
+ : '✅'
246
+ : '➖', ' ', "Hand Off Face (", state.handOverFace.status, state.handOverFace.lastCheck &&
247
+ `, last check ${state.handOverFace.lastCheck.coverage.toFixed(2)} covered in ${Math.round(state.handOverFace.lastCheck.inferenceMs)} ms`, ")"] }))] })), onExit != null && (_jsx(ExitCaptureButton, { onClick: handleExit, className: classNames.exitBtn })), showLoadingOverlay && (_jsx(SelfieCaptureLoadingOverlay, { state: loadingOverlayState, mode: loadingOverlayMode, sessionReady: sessionReady, autoContinueAfterLoading: autoContinueAfterLoading, showIntroScreen: showIntroScreen, transitionFromIdCapture: transitionFromIdCapture, assets: assets.loadingOverlay, classNames: classNames.loadingOverlay, colors: colors.loadingOverlay, verbiage: verbiage.loadingOverlay, customOverlayContent: customOverlayContent, onContinue: handleLoadingContinue, onLoadingStarted: onLoadingStarted, onLoadingProgress: onLoadingProgress, onLoadingCompleted: onLoadingCompleted, onLoadingFailed: onLoadingFailed, onUserCancel: onUserCancel, onRequestCamera: () => controller.actions.requestCamera() })), showStockCameraFallback && (_jsx(SelfieCaptureFallback, { silentFallback: silentFallback, onFinished: (imageDataUrl) => controller.actions.captureManually(imageDataUrl), classNames: classNames.fallback, colors: colors.fallback, verbiage: verbiage.fallback })), state.phase === 'error' &&
227
248
  state.error !== null &&
228
249
  !manualFallbackAvailable &&
229
250
  !showStockCameraFallback && (_jsx(ErrorScreen, { error: state.error, onRetry: handleRetry, onExit: state.error.code === 'CAMERA_TAMPERING_SUSPECTED'
@@ -239,6 +260,33 @@ export function SelfieCaptureSurface({ controller, state, loadingOverlayMode, se
239
260
  verbiage: verbiage.loadingOverlay?.cameraAccessDenied,
240
261
  } }))] }));
241
262
  }
263
+ /**
264
+ * Debug readout for the eyes-open gate: each eye's EAR on this frame beside
265
+ * its calibrated open-eye baseline and the open threshold derived from it.
266
+ * Eyes are labelled by mesh landmark side, which is not necessarily the side
267
+ * of the screen they appear on.
268
+ */
269
+ function EyesOpenDebugLines({ state, }) {
270
+ const ear = computeEARPerEye(state.prediction?.face?.meshLandmarks);
271
+ if (!ear)
272
+ return _jsx(_Fragment, { children: "\u2796 Eyes Open (no face mesh: gate off)" });
273
+ const { earBaseline, earCalibrationMs, eyeReadings } = state.tracking;
274
+ const calibration = (ms) => ms >= EAR_CALIBRATION_MS
275
+ ? 'calibrated'
276
+ : `calibrating ${Math.round(ms)}/${EAR_CALIBRATION_MS} ms`;
277
+ const eye = (label, value, baseline, calibratedMs) => (_jsxs(_Fragment, { children: [_jsx("br", {}), "\u00A0\u00A0", label, ": ", value?.toFixed(3) ?? '—', ' ', baseline === null
278
+ ? '(no baseline yet)'
279
+ : `(baseline ${baseline.toFixed(3)}, open > ${(baseline * BLINK_OPEN_FRACTION).toFixed(3)}, ${calibration(calibratedMs)})`] }));
280
+ const openReadings = eyeReadings.filter((r) => r.open).length;
281
+ const verdict = state.prediction?.eyesClosed
282
+ ? '❌'
283
+ : state.prediction?.eyesCalibrating
284
+ ? '⏳'
285
+ : '✅';
286
+ return (_jsxs(_Fragment, { children: [verdict, " Eyes Open", state.thresholds.requireEyesOpen
287
+ ? ` (${openReadings}/${eyeReadings.length} frames open in the last ${EYES_OPEN_WINDOW_MS} ms)`
288
+ : ' (gate off)', eye('Mesh-left eye', ear.left, earBaseline.left, earCalibrationMs.left), eye('Mesh-right eye', ear.right, earBaseline.right, earCalibrationMs.right)] }));
289
+ }
242
290
  const ManualCaptureButtonContainer = styled.div `
243
291
  position: absolute;
244
292
  z-index: 4;
@@ -246,3 +294,19 @@ const ManualCaptureButtonContainer = styled.div `
246
294
  bottom: 24px;
247
295
  transform: translateX(-50%);
248
296
  `;
297
+ // A footer below the camera keeps the lighting guidance visible above it.
298
+ const CaptureRecoveryActions = styled.div `
299
+ position: absolute;
300
+ z-index: 10001;
301
+ inset: auto 0 0;
302
+ padding: 16px 24px max(16px, env(safe-area-inset-bottom));
303
+ background: white;
304
+ color: #333;
305
+ text-align: center;
306
+ display: grid;
307
+ justify-items: center;
308
+ gap: 12px;
309
+
310
+ p { margin: 0; font-size: 14px; line-height: 1.4; }
311
+ button { width: 100%; max-width: 320px; }
312
+ `;
@@ -1,3 +1,12 @@
1
+ import { type DefaultTheme } from 'styled-components';
1
2
  import type { SelfieCaptureLoadingOverlayProps } from './SelfieCaptureLoadingOverlay';
2
3
  export declare const SelfieCaptureLoadingOverlayDefault: ({ state, sessionReady, now, onContinue, onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onUserCancel, customOverlayContent, autoContinueAfterLoading, assets, classNames, colors, verbiage: rawVerbiage, }: SelfieCaptureLoadingOverlayProps) => import("react/jsx-runtime").JSX.Element;
4
+ /** The overlay's background when the theme does not set one. */
5
+ export declare const SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT = "#ecedf3";
6
+ /**
7
+ * The colour this overlay paints along the viewport's bottom edge, for
8
+ * `BrowserEdgeTint`. That edge is the progress row, not the background, and the
9
+ * bar is full once the models are ready.
10
+ */
11
+ export declare function selfieLoadingOverlayBottomEdgeColor(theme: DefaultTheme, modelsReady: boolean): string;
3
12
  //# sourceMappingURL=SelfieCaptureLoadingOverlayDefault.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelfieCaptureLoadingOverlayDefault.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.tsx"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAA;AAuBrF,eAAO,MAAM,kCAAkC,GAAI,sOAgBhD,gCAAgC,4CA6LlC,CAAA"}
1
+ {"version":3,"file":"SelfieCaptureLoadingOverlayDefault.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_loading/SelfieCaptureLoadingOverlayDefault.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAwBvE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAA;AAuBrF,eAAO,MAAM,kCAAkC,GAAI,sOAgBhD,gCAAgC,4CA6LlC,CAAA;AAqED,gEAAgE;AAChE,eAAO,MAAM,yCAAyC,YAAY,CAAA;AAKlE;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,OAAO,GACnB,MAAM,CAWR"}
@@ -45,6 +45,7 @@ import { styled, useTheme } from 'styled-components';
45
45
  import { LoadingOverlayButtonsRow, LoadingOverlayContinueButtonContainer, LoadingOverlayCustomLoadingGraphic, LoadingOverlayGuidanceMessage, LoadingOverlayHeader, LoadingOverlayImageContainer, LoadingOverlayInner, LoadingOverlayLoadingList, LoadingOverlayLoadingListContainer, LoadingOverlayLoadingListItem, LoadingOverlayProgressBar, LoadingOverlayProgressBarBackground, LoadingOverlayProgressContainer, LoadingOverlayProgressIndicator, OverlayContainer, } from '../common/overlay';
46
46
  import { DEFAULT_CDN_URL } from '../../utils/cdn';
47
47
  import { LoaderButton } from '../common/LoaderButton';
48
+ import { progressRowEdgeColor } from '../common/BrowserEdgeTint';
48
49
  import { downloadingLabel } from '../common/downloadingLabel';
49
50
  import { useTranslations } from '../../i18n';
50
51
  import { ExitCaptureButton } from '../ExitCaptureButton';
@@ -132,7 +133,8 @@ export const SelfieCaptureLoadingOverlayDefault = ({ state, sessionReady = true,
132
133
  ?.displayDisabledContinueBtn) && (_jsx(ContinueButton, { autoFocus: true, finished: ready, disabled: !ready, className: classNames.continueBtn, variant: "positive", colors: colors.continueBtn, onClick: handleContinue, children: ready ? verbiage.continueText : verbiage.pleaseWaitText })) })] })] }) }));
133
134
  };
134
135
  const OverlayInner = styled(LoadingOverlayInner) `
135
- background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.backgroundColor ?? '#ecedf3'};
136
+ background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.backgroundColor ??
137
+ SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT};
136
138
  color: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.textColor ?? 'black'};
137
139
  `;
138
140
  const ButtonsRow = styled(LoadingOverlayButtonsRow) `
@@ -144,13 +146,13 @@ const ButtonsRow = styled(LoadingOverlayButtonsRow) `
144
146
  `;
145
147
  const ProgressBarBackground = styled(LoadingOverlayProgressBarBackground) `
146
148
  background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarBackgroundColor ??
147
- 'var(--idm-color-positive-600)'};
149
+ PROGRESS_TRACK_DEFAULT};
148
150
  opacity: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarBackgroundOpacity ??
149
- 0.75};
151
+ PROGRESS_TRACK_OPACITY_DEFAULT};
150
152
  `;
151
153
  const ProgressIndicator = styled(LoadingOverlayProgressIndicator) `
152
154
  background: ${(props) => props.theme?.selfieCapture?.loadingOverlay?.progressBarIndicatorColor ??
153
- 'var(--idm-color-positive-600)'};
155
+ PROGRESS_INDICATOR_DEFAULT};
154
156
  `;
155
157
  const ContinueButton = styled(LoaderButton) `
156
158
  margin: auto;
@@ -179,3 +181,23 @@ const ContinueButton = styled(LoaderButton) `
179
181
  box-shadow: none;
180
182
  }
181
183
  `;
184
+ /** The overlay's background when the theme does not set one. */
185
+ export const SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT = '#ecedf3';
186
+ const PROGRESS_TRACK_DEFAULT = 'var(--idm-color-positive-600)';
187
+ const PROGRESS_TRACK_OPACITY_DEFAULT = 0.75;
188
+ const PROGRESS_INDICATOR_DEFAULT = 'var(--idm-color-positive-600)';
189
+ /**
190
+ * The colour this overlay paints along the viewport's bottom edge, for
191
+ * `BrowserEdgeTint`. That edge is the progress row, not the background, and the
192
+ * bar is full once the models are ready.
193
+ */
194
+ export function selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) {
195
+ const overlay = theme.selfieCapture?.loadingOverlay;
196
+ return progressRowEdgeColor({
197
+ full: modelsReady,
198
+ indicator: overlay?.progressBarIndicatorColor ?? PROGRESS_INDICATOR_DEFAULT,
199
+ track: overlay?.progressBarBackgroundColor ?? PROGRESS_TRACK_DEFAULT,
200
+ trackOpacity: overlay?.progressBarBackgroundOpacity ?? PROGRESS_TRACK_OPACITY_DEFAULT,
201
+ background: overlay?.backgroundColor ?? SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT,
202
+ });
203
+ }