@facesignai/api 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +345 -0
- package/build/package.json +1 -1
- package/build/src/types/nodes.d.ts +76 -0
- package/build/src/types/nodes.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,3 +27,348 @@ const facesignClient = new Client({
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Make a request to any Facesign API endpoint.
|
|
30
|
+
|
|
31
|
+
## Flow & Nodes
|
|
32
|
+
|
|
33
|
+
A flow is a directed graph of nodes that defines a session. Sessions can serve different purposes — identity verification, data collection, authorization, analysis, or any combination. Every flow must start with a **START** node and end with one or more **END** nodes. Nodes connect to each other via **outcomes** — each outcome points to the `id` of the next node. All defined outcomes must be connected to other nodes; no outcome can be left unlinked.
|
|
34
|
+
|
|
35
|
+
### START Node
|
|
36
|
+
|
|
37
|
+
The entry point of every flow. Each flow must have exactly one START node. It has a single `outcome` that points to the first node in the flow.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
{
|
|
41
|
+
id: "start",
|
|
42
|
+
type: "start",
|
|
43
|
+
outcome: "next-node-id"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### END Node
|
|
48
|
+
|
|
49
|
+
The terminal node of a flow. A flow can have multiple END nodes (e.g., one for success path, one for failure path). It has no outcomes.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
{
|
|
53
|
+
id: "end-success",
|
|
54
|
+
type: "end"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### CONVERSATION Node
|
|
59
|
+
|
|
60
|
+
The avatar speaks to the user using the `prompt` text and routes the flow based on the user's response. The session stays on this node until one of the outcome conditions matches the user's response, so a single conversation node can facilitate a multi-turn dialog with the user until the desired information is gathered.
|
|
61
|
+
|
|
62
|
+
The `prompt` field supports two modes:
|
|
63
|
+
|
|
64
|
+
1. **Direct speech** — Tell the avatar exactly what to say:
|
|
65
|
+
`"Say: Hi, how are you doing?"`
|
|
66
|
+
|
|
67
|
+
2. **Goal-driven behavior** — Describe what the avatar should achieve during the conversation:
|
|
68
|
+
`"Chat with the user and find out how well they understand medicine."`
|
|
69
|
+
|
|
70
|
+
When using goal-driven prompts, always include realistic exit conditions in the outcomes, since the dialog could otherwise continue indefinitely. Examples of exit conditions:
|
|
71
|
+
- User didn't respond after 3 attempts
|
|
72
|
+
- The dialog has reached 6 exchanges and no condition was met
|
|
73
|
+
- User refuses to answer
|
|
74
|
+
|
|
75
|
+
Uses conditional outcomes — each outcome has a `condition` (a natural language description of what the user's response should match) and a `targetNodeId` pointing to the next node.
|
|
76
|
+
|
|
77
|
+
Set `doesNotRequireReply: true` for nodes at the end of the flow where the avatar delivers a final message and no user response is needed (e.g., "Thank you for the conversation, goodbye!"). Typically used before an END node.
|
|
78
|
+
|
|
79
|
+
**Outcomes** use `FSConditionalOutcome`:
|
|
80
|
+
- `id` — unique identifier for the outcome
|
|
81
|
+
- `targetNodeId` — the node to navigate to
|
|
82
|
+
- `condition` — natural language description of the matching criteria
|
|
83
|
+
|
|
84
|
+
**Direct speech example:**
|
|
85
|
+
```typescript
|
|
86
|
+
{
|
|
87
|
+
id: "greeting",
|
|
88
|
+
type: "conversation",
|
|
89
|
+
prompt: "Say: Hello! What would you like to do today?",
|
|
90
|
+
outcomes: [
|
|
91
|
+
{ id: "verify", targetNodeId: "liveness-node", condition: "User wants to verify their identity" },
|
|
92
|
+
{ id: "info", targetNodeId: "info-node", condition: "User wants more information" }
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Goal-driven example:**
|
|
98
|
+
```typescript
|
|
99
|
+
{
|
|
100
|
+
id: "medical-assessment",
|
|
101
|
+
type: "conversation",
|
|
102
|
+
prompt: "Chat with the user and assess their level of medical knowledge.",
|
|
103
|
+
outcomes: [
|
|
104
|
+
{ id: "high", targetNodeId: "advanced-path", condition: "User demonstrates strong medical knowledge" },
|
|
105
|
+
{ id: "low", targetNodeId: "basic-path", condition: "User has limited medical knowledge" },
|
|
106
|
+
{ id: "no-response", targetNodeId: "end-fail", condition: "User didn't respond after 3 attempts" },
|
|
107
|
+
{ id: "timeout", targetNodeId: "end-fail", condition: "Dialog reached 6 exchanges with no condition met" },
|
|
108
|
+
{ id: "refused", targetNodeId: "end-fail", condition: "User refuses to answer" }
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**End-of-flow example:**
|
|
114
|
+
```typescript
|
|
115
|
+
{
|
|
116
|
+
id: "goodbye",
|
|
117
|
+
type: "conversation",
|
|
118
|
+
prompt: "Thank you for the conversation, goodbye!",
|
|
119
|
+
doesNotRequireReply: true,
|
|
120
|
+
outcomes: [
|
|
121
|
+
{ id: "done", targetNodeId: "end", condition: "" }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### PERMISSIONS Node
|
|
127
|
+
|
|
128
|
+
Requests camera and/or microphone permissions from the user before proceeding. Use this node when you need to display a custom prompt explaining why permissions are needed, or when you want to handle the denied case with a specific flow path.
|
|
129
|
+
|
|
130
|
+
If the flow does not contain any PERMISSIONS node, permissions will be requested automatically.
|
|
131
|
+
|
|
132
|
+
- `permissions.camera` — request camera access
|
|
133
|
+
- `permissions.microphone` — request microphone access
|
|
134
|
+
- `prompt` — optional message the avatar will say (uses direct speech mode, e.g., `"Say: Could you please enable your microphone so I can hear you."`). If the site already has permanent permissions granted, the avatar will not say this phrase and the flow will continue directly via the `permissionsGranted` outcome.
|
|
135
|
+
|
|
136
|
+
**Outcomes:**
|
|
137
|
+
- `permissionsGranted` — user granted the requested permissions (or they were already granted)
|
|
138
|
+
- `permissionsDenied` — user denied the permissions
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
{
|
|
142
|
+
id: "request-permissions",
|
|
143
|
+
type: "permissions",
|
|
144
|
+
prompt: "Say: Could you please enable your camera and microphone so we can proceed.",
|
|
145
|
+
permissions: {
|
|
146
|
+
camera: true,
|
|
147
|
+
microphone: true
|
|
148
|
+
},
|
|
149
|
+
outcomes: {
|
|
150
|
+
permissionsGranted: "next-node-id",
|
|
151
|
+
permissionsDenied: "end-denied"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### LIVENESS_DETECTION Node
|
|
157
|
+
|
|
158
|
+
Checks whether the user in front of the camera is a real person or a deepfake. The node analyzes the video feed to perform liveness detection.
|
|
159
|
+
|
|
160
|
+
**Prerequisites:** The user must have camera access granted before this node. Additionally, liveness detection requires several seconds of video recording for analysis. Do not place this node immediately after a PERMISSIONS node — instead, add a CONVERSATION node in between to give the system time to accumulate video data for analysis.
|
|
161
|
+
|
|
162
|
+
**Recommended flow order:**
|
|
163
|
+
`PERMISSIONS → CONVERSATION → LIVENESS_DETECTION`
|
|
164
|
+
|
|
165
|
+
**Outcomes:**
|
|
166
|
+
- `livenessDetected` — the user is a real person
|
|
167
|
+
- `deepfakeDetected` — a deepfake or spoofing attempt was detected
|
|
168
|
+
- `noFace` — no face was detected in the camera feed
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
{
|
|
172
|
+
id: "liveness-check",
|
|
173
|
+
type: "liveness_detection",
|
|
174
|
+
outcomes: {
|
|
175
|
+
livenessDetected: "next-node-id",
|
|
176
|
+
deepfakeDetected: "end-fail",
|
|
177
|
+
noFace: "end-fail"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### ENTER_EMAIL Node
|
|
183
|
+
|
|
184
|
+
Displays a UI for the user to enter their email address. The collected email can be used later in the flow for two-factor authentication or data collection purposes.
|
|
185
|
+
|
|
186
|
+
**Outcomes:**
|
|
187
|
+
- `emailEntered` — user submitted their email
|
|
188
|
+
- `canceled` — user canceled the email entry
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
{
|
|
192
|
+
id: "collect-email",
|
|
193
|
+
type: "enter_email",
|
|
194
|
+
outcomes: {
|
|
195
|
+
emailEntered: "next-node-id",
|
|
196
|
+
canceled: "end-canceled"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### DATA_VALIDATION Node
|
|
202
|
+
|
|
203
|
+
Validates data collected during the session and routes the flow based on the result. Uses a `validation` object to specify which field to check, what action to perform, and an optional expected value.
|
|
204
|
+
|
|
205
|
+
- `validation.field` — the data field to validate
|
|
206
|
+
- `validation.action` — the validation action to perform
|
|
207
|
+
- `validation.value` — optional expected value for comparison
|
|
208
|
+
|
|
209
|
+
Uses conditional outcomes (same as CONVERSATION node) to branch the flow based on the validation result.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
{
|
|
213
|
+
id: "check-email-domain",
|
|
214
|
+
type: "data_validation",
|
|
215
|
+
validation: {
|
|
216
|
+
field: "email",
|
|
217
|
+
action: "contains",
|
|
218
|
+
value: "@company.com"
|
|
219
|
+
},
|
|
220
|
+
outcomes: [
|
|
221
|
+
{ id: "valid", targetNodeId: "next-node-id", condition: "Validation passed" },
|
|
222
|
+
{ id: "invalid", targetNodeId: "end-fail", condition: "Validation failed" }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### DOCUMENT_SCAN Node
|
|
228
|
+
|
|
229
|
+
Opens a document scanning UI powered by Microblink. The user can scan identity documents using their camera. Extracted data (name, date of birth, document number, etc.) becomes available in the session report.
|
|
230
|
+
|
|
231
|
+
- `scanningMode` — determines how to scan the document:
|
|
232
|
+
- `"single"` — scan only one side of the document
|
|
233
|
+
- `"automatic"` — automatically determine how many sides need to be scanned
|
|
234
|
+
- `allowedDocumentTypes` — array of document types the user can scan (e.g., `"passport"`, `"id"`, `"dl"`, `"residence-permit"`, `"visa"`, etc.)
|
|
235
|
+
- `showTorchButton` — show flashlight toggle (default: true)
|
|
236
|
+
- `showCameraSwitch` — show front/back camera toggle (default: true)
|
|
237
|
+
- `showMirrorCameraButton` — show mirror camera button (default: true)
|
|
238
|
+
|
|
239
|
+
**Outcomes:**
|
|
240
|
+
- `scanSuccess` — document was scanned successfully
|
|
241
|
+
- `userCancelled` — user canceled the scan
|
|
242
|
+
- `scanTimeout` — scan timed out
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
{
|
|
246
|
+
id: "scan-id",
|
|
247
|
+
type: "document_scan",
|
|
248
|
+
scanningMode: "automatic",
|
|
249
|
+
allowedDocumentTypes: ["passport", "id", "dl"],
|
|
250
|
+
outcomes: {
|
|
251
|
+
scanSuccess: "next-node-id",
|
|
252
|
+
userCancelled: "end-canceled",
|
|
253
|
+
scanTimeout: "end-fail"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### RECOGNITION Node
|
|
259
|
+
|
|
260
|
+
Performs biometric face recognition to identify the user. Compares the user's face against previously registered faces to determine if they are a known or new user.
|
|
261
|
+
|
|
262
|
+
**Prerequisites:** Requires camera access. Like LIVENESS_DETECTION, needs several seconds of video for analysis — do not place immediately after a PERMISSIONS node. Add a CONVERSATION node in between to accumulate video data.
|
|
263
|
+
|
|
264
|
+
**Outcomes:**
|
|
265
|
+
- `recognized` — the user was matched to a known face
|
|
266
|
+
- `newUser` — the user's face was not found in the database (new user)
|
|
267
|
+
- `noFace` — no face was detected in the camera feed
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
{
|
|
271
|
+
id: "recognize-user",
|
|
272
|
+
type: "recognition",
|
|
273
|
+
outcomes: {
|
|
274
|
+
recognized: "welcome-back",
|
|
275
|
+
newUser: "registration-flow",
|
|
276
|
+
noFace: "end-fail"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### FACE_SCAN Node
|
|
282
|
+
|
|
283
|
+
Performs 1:1 biometric face matching. Captures the user's face and compares it against a reference image to verify their identity.
|
|
284
|
+
|
|
285
|
+
**Prerequisites:** Requires camera access. Like LIVENESS_DETECTION, needs several seconds of video — do not place immediately after a PERMISSIONS node.
|
|
286
|
+
|
|
287
|
+
- `captureInstructions` — optional text instructions shown to the user during capture
|
|
288
|
+
- `requireLivenessChallenge` — require an active liveness challenge during capture
|
|
289
|
+
- `requireAILivenessCheck` — require AI-based liveness verification
|
|
290
|
+
- `referenceImageKey` — key identifying the reference image to compare against
|
|
291
|
+
- `similarityThreshold` — minimum similarity score (0–1) required for a match
|
|
292
|
+
- `enableSound` — enable audio feedback (default: true)
|
|
293
|
+
- `enableHaptics` — enable haptic feedback (default: true)
|
|
294
|
+
|
|
295
|
+
**Outcomes:**
|
|
296
|
+
- `passed` — face matched the reference image
|
|
297
|
+
- `notPassed` — face did not match
|
|
298
|
+
- `cancelled` — user canceled the scan
|
|
299
|
+
- `error` — an error occurred during scanning
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
{
|
|
303
|
+
id: "face-verify",
|
|
304
|
+
type: "face_scan",
|
|
305
|
+
referenceImageKey: "document_photo",
|
|
306
|
+
similarityThreshold: 0.8,
|
|
307
|
+
requireAILivenessCheck: true,
|
|
308
|
+
outcomes: {
|
|
309
|
+
passed: "next-node-id",
|
|
310
|
+
notPassed: "end-fail",
|
|
311
|
+
cancelled: "end-canceled",
|
|
312
|
+
error: "end-error"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### TWO_FACTOR_EMAIL Node
|
|
318
|
+
|
|
319
|
+
Sends a one-time password (OTP) to the user's email address and verifies the code they enter. If no email was provided via `providedData` or collected by a previous node (e.g., ENTER_EMAIL), the email will be requested automatically during this node.
|
|
320
|
+
|
|
321
|
+
- `otpLength` — number of digits in the OTP (4–8, default: 6)
|
|
322
|
+
- `expirySeconds` — how long the OTP is valid (default: 300 / 5 minutes)
|
|
323
|
+
- `maxAttempts` — maximum verification attempts (default: 3)
|
|
324
|
+
- `resendAfterSeconds` — minimum delay before "Resend" button is enabled
|
|
325
|
+
- `showUI` — show on-screen toast notification (default: true)
|
|
326
|
+
- `emailTemplate` — optional custom email template
|
|
327
|
+
|
|
328
|
+
**Outcomes:**
|
|
329
|
+
- `verified` — user entered the correct OTP
|
|
330
|
+
- `delivery_failed` — OTP could not be delivered
|
|
331
|
+
- `failed_unverified` — user exhausted all attempts without verifying
|
|
332
|
+
- `cancelled` — user canceled the verification
|
|
333
|
+
- `error` — an error occurred
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
{
|
|
337
|
+
id: "email-2fa",
|
|
338
|
+
type: "two_factor_email",
|
|
339
|
+
otpLength: 6,
|
|
340
|
+
expirySeconds: 300,
|
|
341
|
+
maxAttempts: 3,
|
|
342
|
+
outcomes: {
|
|
343
|
+
verified: "next-node-id",
|
|
344
|
+
delivery_failed: "end-fail",
|
|
345
|
+
failed_unverified: "end-fail",
|
|
346
|
+
cancelled: "end-canceled",
|
|
347
|
+
error: "end-error"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### TWO_FACTOR_SMS Node
|
|
353
|
+
|
|
354
|
+
Same as TWO_FACTOR_EMAIL but sends the OTP via SMS. If no phone number was provided via `providedData` or collected by a previous node, the phone number will be requested automatically during this node.
|
|
355
|
+
|
|
356
|
+
- Same configuration options as TWO_FACTOR_EMAIL
|
|
357
|
+
- `smsTemplate` — optional custom SMS template (instead of `emailTemplate`)
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
{
|
|
361
|
+
id: "sms-2fa",
|
|
362
|
+
type: "two_factor_sms",
|
|
363
|
+
otpLength: 6,
|
|
364
|
+
expirySeconds: 300,
|
|
365
|
+
maxAttempts: 3,
|
|
366
|
+
outcomes: {
|
|
367
|
+
verified: "next-node-id",
|
|
368
|
+
delivery_failed: "end-fail",
|
|
369
|
+
failed_unverified: "end-fail",
|
|
370
|
+
cancelled: "end-canceled",
|
|
371
|
+
error: "end-error"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
package/build/package.json
CHANGED
|
@@ -19,6 +19,10 @@ export interface FSNodeBase {
|
|
|
19
19
|
type: FSNodeType;
|
|
20
20
|
}
|
|
21
21
|
export type FSNodeId = string;
|
|
22
|
+
/**
|
|
23
|
+
* The entry point of every flow. Each flow must have exactly one START node.
|
|
24
|
+
* It has a single `outcome` that points to the first node in the flow.
|
|
25
|
+
*/
|
|
22
26
|
export interface FSStartNode extends FSNodeBase {
|
|
23
27
|
type: FSNodeType.START;
|
|
24
28
|
outcome: FSNodeId;
|
|
@@ -28,6 +32,19 @@ export interface FSConditionalOutcome {
|
|
|
28
32
|
targetNodeId: string;
|
|
29
33
|
condition: string;
|
|
30
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The avatar speaks to the user using the `prompt` text and routes the flow based on the user's response.
|
|
37
|
+
* The session stays on this node until one of the outcome conditions matches, enabling multi-turn dialog.
|
|
38
|
+
*
|
|
39
|
+
* The `prompt` supports two modes:
|
|
40
|
+
* - Direct speech: "Say: Hi, how are you doing?"
|
|
41
|
+
* - Goal-driven behavior: "Chat with the user and assess their medical knowledge."
|
|
42
|
+
*
|
|
43
|
+
* When using goal-driven prompts, always include realistic exit conditions in the outcomes
|
|
44
|
+
* (e.g., user didn't respond after 3 attempts, dialog reached N exchanges, user refuses to answer).
|
|
45
|
+
*
|
|
46
|
+
* Set `doesNotRequireReply: true` for final messages before an END node where no user response is needed.
|
|
47
|
+
*/
|
|
31
48
|
export interface FSConversationNode extends FSNodeBase {
|
|
32
49
|
type: FSNodeType.CONVERSATION;
|
|
33
50
|
prompt: string;
|
|
@@ -39,6 +56,15 @@ export declare enum FSLivenessDetectionOutcome {
|
|
|
39
56
|
DEEPFAKE_DETECTED = "deepfakeDetected",
|
|
40
57
|
NO_FACE = "noFace"
|
|
41
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether the user is a real person or a deepfake by analyzing the video feed.
|
|
61
|
+
*
|
|
62
|
+
* Requires camera access. Needs several seconds of video for analysis —
|
|
63
|
+
* do not place immediately after a PERMISSIONS node. Add a CONVERSATION node
|
|
64
|
+
* in between to accumulate video data.
|
|
65
|
+
*
|
|
66
|
+
* Recommended flow order: PERMISSIONS → CONVERSATION → LIVENESS_DETECTION
|
|
67
|
+
*/
|
|
42
68
|
export interface FSLivenessDetectionNode extends FSNodeBase {
|
|
43
69
|
type: FSNodeType.LIVENESS_DETECTION;
|
|
44
70
|
outcomes: Record<FSLivenessDetectionOutcome, FSNodeId>;
|
|
@@ -47,10 +73,19 @@ export declare enum FSEnterEmailOutcome {
|
|
|
47
73
|
EMAIL_ENTERED = "emailEntered",
|
|
48
74
|
CANCELED = "canceled"
|
|
49
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Displays a UI for the user to enter their email address.
|
|
78
|
+
* The collected email can be used later in the flow for two-factor authentication or data collection.
|
|
79
|
+
*/
|
|
50
80
|
export interface FSEnterEmailNode extends FSNodeBase {
|
|
51
81
|
type: FSNodeType.ENTER_EMAIL;
|
|
52
82
|
outcomes: Record<FSEnterEmailOutcome, FSNodeId>;
|
|
53
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Validates data collected during the session and routes the flow based on the result.
|
|
86
|
+
* Uses a `validation` object to specify which field to check, what action to perform,
|
|
87
|
+
* and an optional expected value. Uses conditional outcomes to branch the flow.
|
|
88
|
+
*/
|
|
54
89
|
export interface FSDataValidationNode extends FSNodeBase {
|
|
55
90
|
type: FSNodeType.DATA_VALIDATION;
|
|
56
91
|
outcomes: NonEmptyArray<FSConditionalOutcome>;
|
|
@@ -65,6 +100,13 @@ export declare enum FSRecognitionOutcome {
|
|
|
65
100
|
NEW_USER = "newUser",
|
|
66
101
|
NO_FACE = "noFace"
|
|
67
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Performs biometric face recognition to identify the user.
|
|
105
|
+
* Compares the user's face against previously registered faces.
|
|
106
|
+
*
|
|
107
|
+
* Requires camera access. Like LIVENESS_DETECTION, needs several seconds of video —
|
|
108
|
+
* do not place immediately after a PERMISSIONS node. Add a CONVERSATION node in between.
|
|
109
|
+
*/
|
|
68
110
|
export interface FSRecognitionNode extends FSNodeBase {
|
|
69
111
|
type: FSNodeType.RECOGNITION;
|
|
70
112
|
outcomes: Record<FSRecognitionOutcome, FSNodeId>;
|
|
@@ -76,6 +118,14 @@ export declare enum FSDocumentScanOutcome {
|
|
|
76
118
|
TIMEOUT = "scanTimeout"
|
|
77
119
|
}
|
|
78
120
|
export type FSDocumentScanMode = ScanningMode;
|
|
121
|
+
/**
|
|
122
|
+
* Opens a document scanning UI powered by Microblink. The user can scan identity documents
|
|
123
|
+
* using their camera. Extracted data becomes available in the session report.
|
|
124
|
+
*
|
|
125
|
+
* `scanningMode`:
|
|
126
|
+
* - "single" — scan only one side of the document
|
|
127
|
+
* - "automatic" — automatically determine how many sides need to be scanned
|
|
128
|
+
*/
|
|
79
129
|
export interface FSDocumentScanNode extends FSNodeBase {
|
|
80
130
|
type: FSNodeType.DOCUMENT_SCAN;
|
|
81
131
|
scanningMode: FSDocumentScanMode;
|
|
@@ -85,6 +135,10 @@ export interface FSDocumentScanNode extends FSNodeBase {
|
|
|
85
135
|
showCameraSwitch?: boolean;
|
|
86
136
|
showMirrorCameraButton?: boolean;
|
|
87
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The terminal node of a flow. A flow can have multiple END nodes
|
|
140
|
+
* (e.g., one for success path, one for failure path). It has no outcomes.
|
|
141
|
+
*/
|
|
88
142
|
export interface FSEndNode extends FSNodeBase {
|
|
89
143
|
type: FSNodeType.END;
|
|
90
144
|
}
|
|
@@ -94,6 +148,13 @@ export declare enum FSFaceScanOutcome {
|
|
|
94
148
|
CANCELLED = "cancelled",
|
|
95
149
|
ERROR = "error"
|
|
96
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Performs 1:1 biometric face matching. Captures the user's face and compares it
|
|
153
|
+
* against a reference image to verify their identity.
|
|
154
|
+
*
|
|
155
|
+
* Requires camera access. Like LIVENESS_DETECTION, needs several seconds of video —
|
|
156
|
+
* do not place immediately after a PERMISSIONS node.
|
|
157
|
+
*/
|
|
97
158
|
export interface FSFaceScanNode extends FSNodeBase {
|
|
98
159
|
type: FSNodeType.FACE_SCAN;
|
|
99
160
|
outcomes: Record<FSFaceScanOutcome, FSNodeId>;
|
|
@@ -116,6 +177,12 @@ export declare enum FSTwoFactorOutcome {
|
|
|
116
177
|
CANCELLED = "cancelled",
|
|
117
178
|
ERROR = "error"
|
|
118
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Base interface for two-factor authentication nodes (email and SMS).
|
|
182
|
+
* Sends a one-time password (OTP) and verifies the code the user enters.
|
|
183
|
+
* If the required contact info (email or phone) was not provided via `providedData`
|
|
184
|
+
* or collected by a previous node, it will be requested automatically during this node.
|
|
185
|
+
*/
|
|
119
186
|
export interface FSTwoFactorNode extends FSNodeBase {
|
|
120
187
|
outcomes: Record<FSTwoFactorOutcome, FSNodeId>;
|
|
121
188
|
otpLength?: number;
|
|
@@ -132,6 +199,15 @@ export interface FSTwoFactorNodeSMS extends FSTwoFactorNode {
|
|
|
132
199
|
type: FSNodeType.TWO_FACTOR_SMS;
|
|
133
200
|
smsTemplate?: string;
|
|
134
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Requests camera and/or microphone permissions from the user.
|
|
204
|
+
* Use when you need a custom prompt or want to handle the denied case with a specific flow path.
|
|
205
|
+
* If the flow has no PERMISSIONS node, permissions are requested automatically.
|
|
206
|
+
*
|
|
207
|
+
* The `prompt` uses direct speech mode (e.g., "Say: Could you please enable your microphone so I can hear you.").
|
|
208
|
+
* If the site already has permanent permissions granted, the avatar will not say this phrase
|
|
209
|
+
* and the flow continues directly via the `permissionsGranted` outcome.
|
|
210
|
+
*/
|
|
135
211
|
export interface FSPermissionsNode extends FSNodeBase {
|
|
136
212
|
prompt?: string;
|
|
137
213
|
type: FSNodeType.PERMISSIONS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/C,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,YAAY,iBAAiB;IAC7B,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;IAC3B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAC7B,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,IAAI,EAAE,UAAU,CAAC,KAAK,CAAA;IACtB,OAAO,EAAE,QAAQ,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,IAAI,EAAE,UAAU,CAAC,YAAY,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC7C,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED,oBAAY,0BAA0B;IACpC,iBAAiB,qBAAqB;IACtC,iBAAiB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