@idmission/websdk-ui 0.2.0-rc.2 → 0.2.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 (101) hide show
  1. package/README.md +135 -56
  2. package/dist/DocumentCaptureView.d.ts +37 -0
  3. package/dist/DocumentCaptureView.d.ts.map +1 -1
  4. package/dist/DocumentCaptureView.js +489 -6
  5. package/dist/FaceLivenessView.d.ts +1 -1
  6. package/dist/FaceLivenessView.d.ts.map +1 -1
  7. package/dist/FaceLivenessView.js +37 -29
  8. package/dist/IdCaptureView.d.ts +6 -5
  9. package/dist/IdCaptureView.d.ts.map +1 -1
  10. package/dist/IdCaptureView.js +52 -12
  11. package/dist/SelfieCaptureView.d.ts +1 -1
  12. package/dist/SelfieCaptureView.d.ts.map +1 -1
  13. package/dist/SelfieCaptureView.js +6 -3
  14. package/dist/SignatureCaptureView.d.ts +9 -1
  15. package/dist/SignatureCaptureView.d.ts.map +1 -1
  16. package/dist/SignatureCaptureView.js +51 -10
  17. package/dist/VideoIdCaptureView.d.ts +1 -1
  18. package/dist/VideoIdCaptureView.d.ts.map +1 -1
  19. package/dist/VideoIdCaptureView.js +24 -4
  20. package/dist/components/CameraFeed.d.ts +11 -3
  21. package/dist/components/CameraFeed.d.ts.map +1 -1
  22. package/dist/components/CameraFeed.js +24 -4
  23. package/dist/components/barcode/BarcodeGuideOverlay.d.ts +7 -1
  24. package/dist/components/barcode/BarcodeGuideOverlay.d.ts.map +1 -1
  25. package/dist/components/barcode/BarcodeGuideOverlay.js +2 -2
  26. package/dist/components/debug/debug.d.ts +4 -4
  27. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts +29 -0
  28. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.d.ts.map +1 -0
  29. package/dist/components/document/DocumentCaptureAutoCaptureDebugLayer.js +274 -0
  30. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts +56 -0
  31. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.d.ts.map +1 -0
  32. package/dist/components/document/DocumentCaptureAutoCaptureGuidance.js +101 -0
  33. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts +31 -1
  34. package/dist/components/document/DocumentCaptureGuideOverlay.d.ts.map +1 -1
  35. package/dist/components/document/DocumentCaptureGuideOverlay.js +121 -2
  36. package/dist/components/document/DocumentCaptureReviewScreen.d.ts +44 -0
  37. package/dist/components/document/DocumentCaptureReviewScreen.d.ts.map +1 -0
  38. package/dist/components/document/DocumentCaptureReviewScreen.js +40 -0
  39. package/dist/components/document/types.d.ts +25 -0
  40. package/dist/components/document/types.d.ts.map +1 -1
  41. package/dist/components/document/types.js +18 -1
  42. package/dist/components/guides/IdCaptureGuides.d.ts.map +1 -1
  43. package/dist/components/guides/IdCaptureGuides.js +3 -4
  44. package/dist/components/review/ReviewScreen.d.ts.map +1 -1
  45. package/dist/components/review/ReviewScreen.js +1 -1
  46. package/dist/components/review/SignatureCaptureDiagnostics.d.ts +50 -0
  47. package/dist/components/review/SignatureCaptureDiagnostics.d.ts.map +1 -0
  48. package/dist/components/review/SignatureCaptureDiagnostics.js +142 -0
  49. package/dist/components/selfie/SelfieCaptureSurface.d.ts +11 -2
  50. package/dist/components/selfie/SelfieCaptureSurface.d.ts.map +1 -1
  51. package/dist/components/selfie/SelfieCaptureSurface.js +5 -2
  52. package/dist/components/videoId/VideoIdCaptureGuides.d.ts +4 -1
  53. package/dist/components/videoId/VideoIdCaptureGuides.d.ts.map +1 -1
  54. package/dist/components/videoId/VideoIdCaptureGuides.js +2 -2
  55. package/dist/flows/CompositeWizard.d.ts +5 -0
  56. package/dist/flows/CompositeWizard.d.ts.map +1 -1
  57. package/dist/flows/CompositeWizard.js +2 -1
  58. package/dist/flows/DocumentCaptureFlow.d.ts +1 -1
  59. package/dist/flows/DocumentCaptureFlow.d.ts.map +1 -1
  60. package/dist/flows/DocumentCaptureFlow.js +6 -6
  61. package/dist/flows/SubmissionProvider.d.ts.map +1 -1
  62. package/dist/flows/SubmissionProvider.js +2 -4
  63. package/dist/flows/approval.d.ts +15 -0
  64. package/dist/flows/approval.d.ts.map +1 -0
  65. package/dist/flows/approval.js +19 -0
  66. package/dist/flows/autoCaptureMountGuard.d.ts +22 -0
  67. package/dist/flows/autoCaptureMountGuard.d.ts.map +1 -0
  68. package/dist/flows/autoCaptureMountGuard.js +61 -0
  69. package/dist/flows/ringScreens.d.ts +0 -3
  70. package/dist/flows/ringScreens.d.ts.map +1 -1
  71. package/dist/flows/ringScreens.js +2 -3
  72. package/dist/guidance/selfieStrings.d.ts +9 -1
  73. package/dist/guidance/selfieStrings.d.ts.map +1 -1
  74. package/dist/guidance/selfieStrings.js +59 -20
  75. package/dist/i18n/index.d.ts +28 -1177
  76. package/dist/i18n/index.d.ts.map +1 -1
  77. package/dist/i18n/index.js +58 -22
  78. package/dist/i18n/locales/threeOh.d.ts +4 -0
  79. package/dist/i18n/locales/threeOh.d.ts.map +1 -0
  80. package/dist/i18n/locales/threeOh.js +105 -0
  81. package/dist/index.d.ts +3 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -0
  84. package/dist/testing/autoCaptureFrames.d.ts +23 -0
  85. package/dist/testing/autoCaptureFrames.d.ts.map +1 -0
  86. package/dist/testing/autoCaptureFrames.js +187 -0
  87. package/dist/testing/fakeDocumentController.d.ts +7 -1
  88. package/dist/testing/fakeDocumentController.d.ts.map +1 -1
  89. package/dist/testing/fakeDocumentController.js +10 -2
  90. package/dist/testing/index.d.ts +1 -0
  91. package/dist/testing/index.d.ts.map +1 -1
  92. package/dist/testing/index.js +1 -0
  93. package/dist/useIdmissionClient.d.ts +29 -0
  94. package/dist/useIdmissionClient.d.ts.map +1 -0
  95. package/dist/useIdmissionClient.js +44 -0
  96. package/dist/utils/canvas.d.ts.map +1 -1
  97. package/dist/utils/canvas.js +41 -0
  98. package/dist/version.d.ts +1 -1
  99. package/dist/version.d.ts.map +1 -1
  100. package/dist/version.js +1 -1
  101. package/package.json +3 -2
@@ -1,6 +1,7 @@
1
- import { SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
1
+ import { FaceMessageCode, SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
2
2
  import type { ChallengeRunnerSnapshot, LivenessMachineState } from '@idmission/websdk-core/selfieCapture';
3
3
  export declare function selfieGuidanceMessageKey(code: SelfieGuidanceCode): string;
4
+ export declare function faceMessageKey(code: FaceMessageCode): string;
4
5
  /**
5
6
  * sdk2's guidance-pill variant selection: `negative` (FAILED/ERROR/covering
6
7
  * states, supplied by the liveness view) always wins; otherwise `satisfied`
@@ -10,9 +11,16 @@ export declare function selfieGuidanceVariant({ satisfied, negative, }: {
10
11
  satisfied: boolean;
11
12
  negative: boolean;
12
13
  }): 'default' | 'positive' | 'negative';
14
+ export declare function challengePromptCode(snapshot: ChallengeRunnerSnapshot): {
15
+ code: FaceMessageCode;
16
+ blinkCount?: number;
17
+ } | null;
18
+ /** `challengePromptCode` resolved to its translation key. */
13
19
  export declare function challengePromptKey(snapshot: ChallengeRunnerSnapshot): {
14
20
  key: string;
15
21
  blinkCount?: number;
16
22
  } | null;
23
+ export declare function livenessStatusCode(state: LivenessMachineState): FaceMessageCode | null;
24
+ /** `livenessStatusCode` resolved to its translation key. */
17
25
  export declare function livenessStatusKey(state: LivenessMachineState): string | null;
18
26
  //# sourceMappingURL=selfieStrings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selfieStrings.d.ts","sourceRoot":"","sources":["../../src/guidance/selfieStrings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,sCAAsC,CAAA;AAqB7C,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,QAAQ,GACT,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,EAAE,oBAAoB,GAC1B,eAAe,GAAG,IAAI,CAgBxB;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI,CAG5E"}
@@ -1,4 +1,4 @@
1
- import { SelfieGuidanceCode } from '@idmission/websdk-core/selfieCapture';
1
+ import { FaceMessageCode, SelfieGuidanceCode, } from '@idmission/websdk-core/selfieCapture';
2
2
  // Byte-identical to sdk2's verbiage defaults
3
3
  // (SelfieCapture.tsx:273-284, FaceLivenessCapture.tsx:845-912). These
4
4
  // strings are i18n translation keys — any drift silently un-translates 8
@@ -19,6 +19,33 @@ export function selfieGuidanceMessageKey(code) {
19
19
  return '';
20
20
  return selfieGuidanceKeys[code];
21
21
  }
22
+ // The other half of the face pill's vocabulary: challenge prompts, the
23
+ // liveness status ladder, and the manual-capture prompt. Byte-identical to
24
+ // sdk2's verbiage defaults (FaceLivenessCapture.tsx:845-912), and — like every
25
+ // string in this file — these ARE the i18n translation keys, so any drift here
26
+ // silently un-translates 8 locales.
27
+ //
28
+ // Exhaustive by type: adding a `FaceMessageCode` without a string here is a
29
+ // compile error, which is the point. Strings may change freely; the codes they
30
+ // hang off may not (see FaceMessageCode's append-only note).
31
+ const faceMessageKeys = {
32
+ TURN_LEFT: 'Turn your head left',
33
+ TURN_RIGHT: 'Turn your head right',
34
+ RETURN_TO_CENTER: 'Return to center',
35
+ BLINK: 'Blink',
36
+ BLINK_TWICE: 'Blink twice',
37
+ REMOVE_EYE_COVERINGS: 'Please remove your eye coverings (sunglasses, eye patch, etc.)...',
38
+ REMOVE_HEAD_COVERINGS: 'Please remove your head coverings (hat, scarf, etc.)...',
39
+ REMOVE_MASK: 'Please remove your mask...',
40
+ CHALLENGE_TIMED_OUT: "Let's try that again — please follow the prompts.",
41
+ LIVENESS_CHECK_FAILED: 'Could not verify your face.',
42
+ LIVENESS_CHECK_ERROR: 'An error occurred while verifying your face.',
43
+ VALIDATING: 'Photo captured, verifying...',
44
+ MANUAL_CAPTURE: 'Position your face in the circle and click to capture.',
45
+ };
46
+ export function faceMessageKey(code) {
47
+ return faceMessageKeys[code];
48
+ }
22
49
  /**
23
50
  * sdk2's guidance-pill variant selection: `negative` (FAILED/ERROR/covering
24
51
  * states, supplied by the liveness view) always wins; otherwise `satisfied`
@@ -46,24 +73,33 @@ export function selfieGuidanceVariant({ satisfied, negative, }) {
46
73
  // The view is expected to render `` `${t(key)} ${blinkCount} times` `` to
47
74
  // match that exactly — sdk2 parity, not an oversight.
48
75
  const TURN_KINDS = new Set(['turn-left', 'turn-right']);
49
- export function challengePromptKey(snapshot) {
76
+ export function challengePromptCode(snapshot) {
50
77
  const { promptKind, promptCount, awaitingReturn } = snapshot;
51
78
  if (promptKind !== null && TURN_KINDS.has(promptKind) && awaitingReturn) {
52
- return { key: 'Return to center' };
79
+ return { code: FaceMessageCode.RETURN_TO_CENTER };
53
80
  }
54
81
  if (promptKind === 'turn-left')
55
- return { key: 'Turn your head left' };
82
+ return { code: FaceMessageCode.TURN_LEFT };
56
83
  if (promptKind === 'turn-right')
57
- return { key: 'Turn your head right' };
84
+ return { code: FaceMessageCode.TURN_RIGHT };
58
85
  if (promptKind === 'blink') {
59
86
  if (promptCount === 2)
60
- return { key: 'Blink twice' };
87
+ return { code: FaceMessageCode.BLINK_TWICE };
61
88
  if (promptCount > 2)
62
- return { key: 'Blink', blinkCount: promptCount };
63
- return { key: 'Blink' };
89
+ return { code: FaceMessageCode.BLINK, blinkCount: promptCount };
90
+ return { code: FaceMessageCode.BLINK };
64
91
  }
65
92
  return null;
66
93
  }
94
+ /** `challengePromptCode` resolved to its translation key. */
95
+ export function challengePromptKey(snapshot) {
96
+ const prompt = challengePromptCode(snapshot);
97
+ if (!prompt)
98
+ return null;
99
+ return prompt.blinkCount === undefined
100
+ ? { key: faceMessageKey(prompt.code) }
101
+ : { key: faceMessageKey(prompt.code), blinkCount: prompt.blinkCount };
102
+ }
67
103
  // Liveness-status ladder (FaceLivenessCapture.tsx:896-912's `guidanceMessage`
68
104
  // derivation, minus its leading `challengeMessage ? ... :` branch).
69
105
  // LivenessMachineState carries no promptKind/challenge fields — that's
@@ -73,25 +109,28 @@ export function challengePromptKey(snapshot) {
73
109
  // eye covering > head covering > mask > FAILED (challengeTimedOut ? "let's
74
110
  // try again" : "could not verify") > ERROR > CAPTURED|IN_PROGRESS
75
111
  // ("verifying...") > null (nothing to show).
76
- export function livenessStatusKey(state) {
77
- if (state.eyeCoveringDetected) {
78
- return 'Please remove your eye coverings (sunglasses, eye patch, etc.)...';
79
- }
80
- if (state.headCoveringDetected) {
81
- return 'Please remove your head coverings (hat, scarf, etc.)...';
82
- }
112
+ export function livenessStatusCode(state) {
113
+ if (state.eyeCoveringDetected)
114
+ return FaceMessageCode.REMOVE_EYE_COVERINGS;
115
+ if (state.headCoveringDetected)
116
+ return FaceMessageCode.REMOVE_HEAD_COVERINGS;
83
117
  if (state.maskDetected)
84
- return 'Please remove your mask...';
118
+ return FaceMessageCode.REMOVE_MASK;
85
119
  if (state.requestState === 'FAILED') {
86
120
  return state.challengeTimedOut
87
- ? "Let's try that again — please follow the prompts."
88
- : 'Could not verify your face.';
121
+ ? FaceMessageCode.CHALLENGE_TIMED_OUT
122
+ : FaceMessageCode.LIVENESS_CHECK_FAILED;
89
123
  }
90
124
  if (state.requestState === 'ERROR') {
91
- return 'An error occurred while verifying your face.';
125
+ return FaceMessageCode.LIVENESS_CHECK_ERROR;
92
126
  }
93
127
  if (state.requestState === 'CAPTURED' || state.requestState === 'IN_PROGRESS') {
94
- return 'Photo captured, verifying...';
128
+ return FaceMessageCode.VALIDATING;
95
129
  }
96
130
  return null;
97
131
  }
132
+ /** `livenessStatusCode` resolved to its translation key. */
133
+ export function livenessStatusKey(state) {
134
+ const code = livenessStatusCode(state);
135
+ return code === null ? null : faceMessageKey(code);
136
+ }