@arkyc/types 1.0.0 → 1.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.
- package/LICENSE +21 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/project.d.mts +2 -0
- package/dist/project.d.mts.map +1 -1
- package/dist/providers.d.mts +64 -1
- package/dist/providers.d.mts.map +1 -1
- package/dist/verification.d.mts +2 -2
- package/dist/verification.d.mts.map +1 -1
- package/dist/webhook.d.mts +6 -1
- package/dist/webhook.d.mts.map +1 -1
- package/dist/widget.d.mts +1 -1
- package/dist/widget.d.mts.map +1 -1
- package/dist/workflow.d.mts +44 -3
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +42 -3
- package/dist/workflow.mjs.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Toneflix Technologies Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
CHANGED
|
@@ -6,11 +6,11 @@ import { CaptureModel, DEFAULT_GLOBAL_SETTINGS, GlobalSetting, GlobalSettings, R
|
|
|
6
6
|
import { DecisionReason, LivenessChallenge, LivenessMode, VerificationDecision, VerificationSession, VerificationStatus } from "./verification.mjs";
|
|
7
7
|
import { REALTIME_EVENT, RealtimeEventName, ReviewActionEvent, SessionTransitionEvent, parseRealtimeChannel, realtimeChannels } from "./realtime.mjs";
|
|
8
8
|
import { ApiKey, ApiKeyWithSecret, Project, ProjectBranding, ProjectContext, ProjectEnvironment, ProjectHandoffSettings, ProjectMember, ProjectSettings, ProjectStatus, VerificationThresholds } from "./project.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, AddressMethod, AddressOnFail, AddressStepConfig, DEFAULT_ADDRESS_CONFIG, DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, Workflow, WorkflowConfig, WorkflowOptions, WorkflowStep, WorkflowStepKey, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr } from "./workflow.mjs";
|
|
10
|
+
import { AddressMethodResult, AddressResultData, AddressVerification, DocumentCapture, DocumentPortrait, DocumentType, FaceMatchCheck, FaceMatchResultData, LivenessCheck, LivenessResultData, OcrAuthenticity, OcrFields, OcrResult, OcrResultData, PostalAddress, SpoofSignals } from "./providers.mjs";
|
|
11
11
|
import { Review, ReviewAction, ReviewNote } from "./review.mjs";
|
|
12
12
|
import { WebhookChecks, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointStatus, WebhookEvent, WebhookEventName } from "./webhook.mjs";
|
|
13
13
|
import { ActorType, AuditLog } from "./audit.mjs";
|
|
14
14
|
import { CreateSessionParams, SdkOptions, SessionResource } from "./sdk.mjs";
|
|
15
15
|
import { WidgetMode, WidgetOptions, WidgetResult, WidgetStep } from "./widget.mjs";
|
|
16
|
-
export { ActorType, AdminPermission, AdminPermissionGroup, AdminPermissionKey, AdminRoleSlug, AnyPermissionGroup, AnyPermissionKey, ApiKey, ApiKeyWithSecret, AuditLog, CaptureModel, CreateSessionParams, DEFAULT_GLOBAL_SETTINGS, DEFAULT_WORKFLOW_CONFIG, DecisionReason, DocumentCapture, DocumentPortrait, DocumentType, Entity, FaceMatchCheck, FaceMatchResultData, GlobalSetting, GlobalSettings, Id, InvitationStatus, IsoDate, IsoDateTime, LivenessChallenge, LivenessCheck, LivenessMode, LivenessResultData, MembershipStatus, Metadata, OcrAuthenticity, OcrFields, OcrResult, OcrResultData, Organization, OrganizationInvitation, OrganizationMember, OrganizationScoped, OrganizationSettings, Permission, PermissionGroup, PermissionKey, Project, ProjectBranding, ProjectContext, ProjectEnvironment, ProjectHandoffSettings, ProjectMember, ProjectScoped, ProjectSettings, ProjectStatus, PublicUser, REALTIME_EVENT, RealtimeEventName, RealtimeTransport, Review, ReviewAction, ReviewActionEvent, ReviewNote, Role, RolePermission, SdkOptions, SessionResource, SessionTransitionEvent, SpoofSignals, SystemRoleSlug, Timestamps, User, UserPermission, VerificationDecision, VerificationSession, VerificationStatus, VerificationThresholds, WORKFLOW_STEP_KEYS, WebhookChecks, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointStatus, WebhookEvent, WebhookEventName, WidgetMode, WidgetOptions, WidgetResult, WidgetStep, Workflow, WorkflowConfig, WorkflowOptions, WorkflowStep, WorkflowStepKey, parseRealtimeChannel, realtimeChannels, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
16
|
+
export { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, ActorType, AddressMethod, AddressMethodResult, AddressOnFail, AddressResultData, AddressStepConfig, AddressVerification, AdminPermission, AdminPermissionGroup, AdminPermissionKey, AdminRoleSlug, AnyPermissionGroup, AnyPermissionKey, ApiKey, ApiKeyWithSecret, AuditLog, CaptureModel, CreateSessionParams, DEFAULT_ADDRESS_CONFIG, DEFAULT_GLOBAL_SETTINGS, DEFAULT_WORKFLOW_CONFIG, DecisionReason, DocumentCapture, DocumentPortrait, DocumentType, Entity, FaceMatchCheck, FaceMatchResultData, GlobalSetting, GlobalSettings, Id, InvitationStatus, IsoDate, IsoDateTime, LivenessChallenge, LivenessCheck, LivenessMode, LivenessResultData, MembershipStatus, Metadata, OcrAuthenticity, OcrFields, OcrResult, OcrResultData, Organization, OrganizationInvitation, OrganizationMember, OrganizationScoped, OrganizationSettings, Permission, PermissionGroup, PermissionKey, PostalAddress, Project, ProjectBranding, ProjectContext, ProjectEnvironment, ProjectHandoffSettings, ProjectMember, ProjectScoped, ProjectSettings, ProjectStatus, PublicUser, REALTIME_EVENT, RealtimeEventName, RealtimeTransport, Review, ReviewAction, ReviewActionEvent, ReviewNote, Role, RolePermission, SdkOptions, SessionResource, SessionTransitionEvent, SpoofSignals, SystemRoleSlug, Timestamps, User, UserPermission, VerificationDecision, VerificationSession, VerificationStatus, VerificationThresholds, WORKFLOW_STEP_KEYS, WebhookChecks, WebhookDelivery, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointStatus, WebhookEvent, WebhookEventName, WidgetMode, WidgetOptions, WidgetResult, WidgetStep, Workflow, WorkflowConfig, WorkflowOptions, WorkflowStep, WorkflowStepKey, parseRealtimeChannel, realtimeChannels, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DEFAULT_GLOBAL_SETTINGS } from "./settings.mjs";
|
|
2
2
|
import { REALTIME_EVENT, parseRealtimeChannel, realtimeChannels } from "./realtime.mjs";
|
|
3
|
-
import { DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, workflowEnabledSteps, workflowEnables, workflowRunsOcr } from "./workflow.mjs";
|
|
4
|
-
export { DEFAULT_GLOBAL_SETTINGS, DEFAULT_WORKFLOW_CONFIG, REALTIME_EVENT, WORKFLOW_STEP_KEYS, parseRealtimeChannel, realtimeChannels, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
3
|
+
import { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, DEFAULT_ADDRESS_CONFIG, DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr } from "./workflow.mjs";
|
|
4
|
+
export { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, DEFAULT_ADDRESS_CONFIG, DEFAULT_GLOBAL_SETTINGS, DEFAULT_WORKFLOW_CONFIG, REALTIME_EVENT, WORKFLOW_STEP_KEYS, parseRealtimeChannel, realtimeChannels, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
package/dist/project.d.mts
CHANGED
|
@@ -16,6 +16,8 @@ interface VerificationThresholds {
|
|
|
16
16
|
ocrConfidenceThreshold: number;
|
|
17
17
|
livenessThreshold: number;
|
|
18
18
|
faceMatchThreshold: number;
|
|
19
|
+
/** Minimum address-verification confidence before flagging for review. */
|
|
20
|
+
addressThreshold: number;
|
|
19
21
|
}
|
|
20
22
|
/** Visual branding applied to the widget for a project. */
|
|
21
23
|
interface ProjectBranding {
|
package/dist/project.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.mts","names":[],"sources":["../src/project.ts"],"mappings":";;;;;;KAMY,kBAAA;AAAZ;AAAA,KAGY,aAAA;;;AAHkB;AAG9B;UAMiB,sBAAA;EACf,wBAAA;EACA,sBAAA;EACA,iBAAA;EACA,kBAAA;AAAA;;UAIe,eAAA;EACf,QAAA;EACA,aAAA;EACA,aAAA;EACA,KAAA;
|
|
1
|
+
{"version":3,"file":"project.d.mts","names":[],"sources":["../src/project.ts"],"mappings":";;;;;;KAMY,kBAAA;AAAZ;AAAA,KAGY,aAAA;;;AAHkB;AAG9B;UAMiB,sBAAA;EACf,wBAAA;EACA,sBAAA;EACA,iBAAA;EACA,kBAAA;EAJqC;EAMrC,gBAAA;AAAA;;UAIe,eAAA;EACf,QAAA;EACA,aAAA;EACA,aAAA;EACA,KAAA;EARgB;EAUhB,IAAA;EAN8B;;;;EAW9B,aAAA;AAAA;;;;;AAAa;UAQE,sBAAA;EAAsB;EAErC,OAAA;EAAA;AAKa;AAIf;;EAJE,aAAa;AAAA;;UAIE,eAAA,SAAwB,QAAA;EACvC,UAAA,GAAa,OAAA,CAAQ,sBAAA;EACrB,eAAA;EAF+C;EAI/C,WAAA;EAJuC;EAMvC,aAAA,GAAgB,YAAA;EALH;EAOb,OAAA,GAAU,sBAAA;AAAA;;;;;UAOK,OAAA,SAAgB,MAAA,EAAQ,kBAAA;EACvC,IAAA;EACA,IAAA;EACA,WAAA,EAAa,kBAAA;EACb,QAAA,EAAU,eAAA;EACV,QAAA,EAAU,eAAA;EACV,MAAA,EAAQ,aAAA;EACR,YAAA;AAAA;;UAIe,aAAA,SAAsB,MAAA,EAAQ,aAAA;EAC7C,OAAA,EAAS,EAAA;EACT,OAAA,EAAS,EAAA;EACT,MAAA,EAAQ,gBAAA;AAAA;;;;;UAOO,MAAA,SAAe,MAAA,EAAQ,aAAA;EACtC,IAAA;EACA,UAAA;EACA,QAAA;EACA,YAAA,EAAc,WAAA;EACd,UAAA,EAAY,WAAA;EACZ,UAAA,EAAY,WAAA;AAAA;;UAIG,gBAAA;EACf,OAAA,EAAS,MAAM;EArBc;EAuB7B,MAAA;AAAA;;UAIe,cAAA;EACf,eAAA,EAAiB,EAAA;EACjB,UAAA,EAAY,EAAA;EACZ,UAAA,GAAa,EAAA;AAAA"}
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Entity, Id, IsoDate, ProjectScoped } from "./common.mjs";
|
|
2
|
+
import { AddressMethod } from "./workflow.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/providers.d.ts
|
|
4
5
|
/** Supported identity document categories. */
|
|
@@ -70,6 +71,50 @@ interface FaceMatchResultData {
|
|
|
70
71
|
confidence: number;
|
|
71
72
|
raw?: unknown;
|
|
72
73
|
}
|
|
74
|
+
/** A normalized postal address. Any field may be absent depending on the source. */
|
|
75
|
+
interface PostalAddress {
|
|
76
|
+
line1?: string;
|
|
77
|
+
line2?: string;
|
|
78
|
+
city?: string;
|
|
79
|
+
/** State / province / region. */
|
|
80
|
+
region?: string;
|
|
81
|
+
postalCode?: string;
|
|
82
|
+
/** Country as resolved (ISO code or name). */
|
|
83
|
+
country?: string;
|
|
84
|
+
/** Geocoordinates, when a method resolves them. */
|
|
85
|
+
latitude?: number;
|
|
86
|
+
longitude?: number;
|
|
87
|
+
}
|
|
88
|
+
/** One method's contribution to address verification. */
|
|
89
|
+
interface AddressMethodResult {
|
|
90
|
+
method: AddressMethod;
|
|
91
|
+
/** Whether this method produced a usable, valid result. */
|
|
92
|
+
passed: boolean;
|
|
93
|
+
/** Method confidence in [0, 1]. */
|
|
94
|
+
confidence: number;
|
|
95
|
+
/** The address this method resolved/extracted, when any. */
|
|
96
|
+
resolved?: PostalAddress;
|
|
97
|
+
/**
|
|
98
|
+
* The provider's full, human-readable address string for the resolved hit —
|
|
99
|
+
* e.g. Nominatim's `display_name` or openrouteservice's `label`. Shown to
|
|
100
|
+
* reviewers so they see the exact place the provider detected.
|
|
101
|
+
*/
|
|
102
|
+
resolvedLabel?: string;
|
|
103
|
+
/** Human-readable note (e.g. why it failed). */
|
|
104
|
+
note?: string;
|
|
105
|
+
raw?: unknown;
|
|
106
|
+
}
|
|
107
|
+
/** The shape returned by an address verifier — the aggregate of its methods. */
|
|
108
|
+
interface AddressResultData {
|
|
109
|
+
passed: boolean;
|
|
110
|
+
/** Overall confidence in [0, 1]. */
|
|
111
|
+
score: number;
|
|
112
|
+
/** Per-method breakdown. */
|
|
113
|
+
methods: AddressMethodResult[];
|
|
114
|
+
/** Whether the methods agree (country/locality) when two or more ran. */
|
|
115
|
+
consistent: boolean;
|
|
116
|
+
raw?: unknown;
|
|
117
|
+
}
|
|
73
118
|
/** A captured identity document (front and optional back) for a session. */
|
|
74
119
|
interface DocumentCapture extends Entity, ProjectScoped {
|
|
75
120
|
session_id: Id;
|
|
@@ -116,6 +161,24 @@ interface FaceMatchCheck extends Entity, ProjectScoped {
|
|
|
116
161
|
provider: string;
|
|
117
162
|
raw_response: unknown;
|
|
118
163
|
}
|
|
164
|
+
/** Persisted address-verification result for a session. */
|
|
165
|
+
interface AddressVerification extends Entity, ProjectScoped {
|
|
166
|
+
session_id: Id;
|
|
167
|
+
/** The address the user claimed (typed in the widget), when provided. */
|
|
168
|
+
claimed_address: PostalAddress | null;
|
|
169
|
+
/** Proof-of-address document image, when the `poa_document` method ran. */
|
|
170
|
+
document_image_path: string | null;
|
|
171
|
+
/** Captured device coordinates, when the `device_location` method ran. */
|
|
172
|
+
latitude: number | null;
|
|
173
|
+
longitude: number | null;
|
|
174
|
+
passed: boolean;
|
|
175
|
+
/** Overall confidence in [0, 1]. */
|
|
176
|
+
score: number;
|
|
177
|
+
/** Per-method breakdown. */
|
|
178
|
+
methods: AddressMethodResult[];
|
|
179
|
+
provider: string;
|
|
180
|
+
raw_response: unknown;
|
|
181
|
+
}
|
|
119
182
|
//#endregion
|
|
120
|
-
export { DocumentCapture, DocumentPortrait, DocumentType, FaceMatchCheck, FaceMatchResultData, LivenessCheck, LivenessResultData, OcrAuthenticity, OcrFields, OcrResult, OcrResultData, SpoofSignals };
|
|
183
|
+
export { AddressMethodResult, AddressResultData, AddressVerification, DocumentCapture, DocumentPortrait, DocumentType, FaceMatchCheck, FaceMatchResultData, LivenessCheck, LivenessResultData, OcrAuthenticity, OcrFields, OcrResult, OcrResultData, PostalAddress, SpoofSignals };
|
|
121
184
|
//# sourceMappingURL=providers.d.mts.map
|
package/dist/providers.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.mts","names":[],"sources":["../src/providers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.d.mts","names":[],"sources":["../src/providers.ts"],"mappings":";;;;;KAIY,YAAA;AAAZ;AAAA,UAGiB,SAAA;EACf,SAAA;EACA,QAAA;EACA,QAAA;EACA,WAAA,GAAc,OAAA;EACd,cAAA;EACA,UAAA,GAAa,OAAO;EACpB,WAAA;AAAA;;;;;;UAQe,eAAA;EATF;EAWb,OAAA;EAVW;EAYX,UAAA;EAJe;EAMf,YAAA;;EAEA,SAAA;EANA;EAQA,gBAAA;EAJA;EAMA,iBAAA;EAFA;EAIA,YAAA;AAAA;;UAIe,aAAA;EACf,MAAA,EAAQ,SAAA;EADoB;EAG5B,UAAA;EAE8B;EAA9B,YAAA,GAAe,eAAe;EAJtB;EAMR,GAAA;AAAA;;UAIe,YAAA;EACf,YAAA;EACA,YAAA;EACA,YAAA;EACA,aAAA;EACA,eAAA;EACA,YAAA;AAAA;;UAIe,kBAAA;EACf,MAAA;EANA;EAQA,KAAA;EACA,YAAA,EAAc,YAAY;EAC1B,GAAA;AAAA;;UAIe,mBAAA;EACf,MAAA;EATA;EAWA,eAAA;EARA;EAUA,UAAA;EACA,GAAA;AAAA;AAVG;AAAA,UAcY,aAAA;EACf,KAAA;EACA,KAAA;EACA,IAAA;EAZA;EAcA,MAAA;EACA,UAAA;EAVA;EAYA,OAAA;EAZG;EAcH,QAAA;EACA,SAAA;AAAA;;UAIe,mBAAA;EACf,MAAA,EAAQ,aAAA;EAbR;EAeA,MAAA;EAZA;EAcA,UAAA;EAVA;EAYA,QAAA,GAAW,aAAa;EAXf;AAAA;AAIX;;;EAaE,aAAA;EAZA;EAcA,IAAA;EACA,GAAA;AAAA;;UAIe,iBAAA;EACf,MAAA;EANA;EAQA,KAAA;EAPG;EASH,OAAA,EAAS,mBAAmB;EALb;EAOf,UAAA;EACA,GAAA;AAAA;;UAIe,eAAA,SAAwB,MAAA,EAAQ,aAAA;EAC/C,UAAA,EAAY,EAAA;EACZ,OAAA;EACA,aAAA,EAAe,YAAA;EACf,gBAAA;EACA,eAAA;EACA,aAAA;AAAA;;UAIe,SAAA,SAAkB,MAAA,EAAQ,aAAA;EACzC,UAAA,EAAY,EAAA;EACZ,mBAAA,EAAqB,EAAA;EACrB,MAAA,EAAQ,SAAA;EACR,UAAA;EACA,YAAA;AAAA;;UAIe,gBAAA,SAAyB,MAAA,EAAQ,aAAA;EAChD,UAAA,EAAY,EAAA;EACZ,mBAAA,EAAqB,EAAA;EACrB,mBAAA;EACA,oBAAA;AAAA;;UAIe,aAAA,SAAsB,MAAA,EAAQ,aAAA;EAC7C,UAAA,EAAY,EAAA;EACZ,iBAAA;EACA,UAAA;EACA,KAAA;EACA,MAAA;EACA,aAAA,EAAe,YAAA;EACf,QAAA;EACA,YAAA;AAAA;;UAIe,cAAA,SAAuB,MAAA,EAAQ,aAAA;EAC9C,UAAA,EAAY,EAAA;EACZ,sBAAA;EACA,iBAAA;EACA,gBAAA;EACA,UAAA;EACA,MAAA;EACA,QAAA;EACA,YAAA;AAAA;;UAIe,mBAAA,SAA4B,MAAA,EAAQ,aAAA;EACnD,UAAA,EAAY,EAAA;EArCA;EAuCZ,eAAA,EAAiB,aAAA;EAnCF;EAqCf,mBAAA;;EAEA,QAAA;EACA,SAAA;EACA,MAAA;EAzCgD;EA2ChD,KAAA;EA3C6D;EA6C7D,OAAA,EAAS,mBAAA;EACT,QAAA;EACA,YAAA;AAAA"}
|
package/dist/verification.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { Entity, Id, IsoDateTime, Metadata, ProjectScoped } from "./common.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/verification.d.ts
|
|
4
4
|
/** The lifecycle state of a verification session. */
|
|
5
|
-
type VerificationStatus = 'pending' | 'started' | 'document_submitted' | 'liveness_submitted' | 'processing' | 'requires_review' | 'approved' | 'rejected' | 'expired' | 'cancelled';
|
|
5
|
+
type VerificationStatus = 'pending' | 'started' | 'document_submitted' | 'address_submitted' | 'liveness_submitted' | 'processing' | 'requires_review' | 'approved' | 'rejected' | 'expired' | 'cancelled';
|
|
6
6
|
/** The outcome of the decision engine (or a manual review). */
|
|
7
7
|
type VerificationDecision = 'approved' | 'requires_review' | 'rejected';
|
|
8
8
|
/** Whether liveness is checked passively (a selfie) or actively (a challenge video). */
|
|
@@ -14,7 +14,7 @@ type LivenessMode = 'passive' | 'active';
|
|
|
14
14
|
*/
|
|
15
15
|
type LivenessChallenge = 'turn_left' | 'turn_right' | 'blink' | 'smile' | 'nod' | 'move_closer';
|
|
16
16
|
/** Why a session reached its decision. */
|
|
17
|
-
type DecisionReason = 'AUTO_APPROVED' | 'LOW_DOCUMENT_QUALITY' | 'OCR_LOW_CONFIDENCE' | 'DOCUMENT_EXPIRED' | 'LIVENESS_FAILED' | 'LIVENESS_LOW_CONFIDENCE' | 'FACE_MATCH_FAILED' | 'FACE_MATCH_LOW_CONFIDENCE' | 'MULTIPLE_FACES_DETECTED' | 'MANUAL_APPROVAL' | 'MANUAL_REJECTION' | 'RETRY_REQUESTED';
|
|
17
|
+
type DecisionReason = 'AUTO_APPROVED' | 'LOW_DOCUMENT_QUALITY' | 'OCR_LOW_CONFIDENCE' | 'DOCUMENT_EXPIRED' | 'LIVENESS_FAILED' | 'LIVENESS_LOW_CONFIDENCE' | 'FACE_MATCH_FAILED' | 'FACE_MATCH_LOW_CONFIDENCE' | 'MULTIPLE_FACES_DETECTED' | 'ADDRESS_VERIFICATION_FAILED' | 'ADDRESS_LOW_CONFIDENCE' | 'MANUAL_APPROVAL' | 'MANUAL_REJECTION' | 'RETRY_REQUESTED';
|
|
18
18
|
/**
|
|
19
19
|
* A verification session: the full lifecycle of one verification flow, owned by
|
|
20
20
|
* a project (and organization). Created from an integrator's backend, driven by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.d.mts","names":[],"sources":["../src/verification.ts"],"mappings":";;;;KAGY,kBAAA;AAAZ;AAAA,
|
|
1
|
+
{"version":3,"file":"verification.d.mts","names":[],"sources":["../src/verification.ts"],"mappings":";;;;KAGY,kBAAA;AAAZ;AAAA,KAcY,oBAAA;;KAGA,YAAA;AAjBkB;AAc9B;;;;AAd8B,KAwBlB,iBAAA;AAPZ;AAAA,KAUY,cAAA;;;AAVY;AAOxB;;UAwBiB,mBAAA,SAA4B,MAAA,EAAQ,aAAA;EAxBxB;EA0B3B,cAAA;EAvBU;EAyBV,IAAA;EACA,MAAA,EAAQ,kBAAA;EACR,aAAA,EAAe,oBAAA;EACf,cAAA,EAAgB,oBAAA;EAChB,eAAA,EAAiB,cAAA;EARkB;EAUnC,UAAA;EALQ;EAOR,iBAAA;EACA,UAAA,EAAY,WAAA;EACZ,YAAA,EAAc,WAAA;EACd,WAAA,EAAa,WAAA;EACb,WAAA,EAAa,EAAA;EACb,QAAA,EAAU,QAAA;AAAA"}
|
package/dist/webhook.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { DecisionReason, VerificationStatus } from "./verification.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/webhook.d.ts
|
|
5
5
|
/** The set of webhook event names Arkyc can deliver. */
|
|
6
|
-
type WebhookEventName = 'verification.started' | 'verification.document_submitted' | 'verification.processing' | 'verification.requires_review' | 'verification.approved' | 'verification.rejected' | 'verification.completed' | 'verification.expired' | 'verification.cancelled';
|
|
6
|
+
type WebhookEventName = 'verification.started' | 'verification.document_submitted' | 'verification.address_submitted' | 'verification.processing' | 'verification.requires_review' | 'verification.approved' | 'verification.rejected' | 'verification.completed' | 'verification.expired' | 'verification.cancelled';
|
|
7
7
|
/** Per-check summary included in a webhook payload. */
|
|
8
8
|
interface WebhookChecks {
|
|
9
9
|
document?: {
|
|
@@ -20,6 +20,11 @@ interface WebhookChecks {
|
|
|
20
20
|
passed: boolean;
|
|
21
21
|
similarity_score: number;
|
|
22
22
|
};
|
|
23
|
+
address?: {
|
|
24
|
+
passed: boolean;
|
|
25
|
+
score: number; /** Which corroboration methods ran. */
|
|
26
|
+
methods: string[];
|
|
27
|
+
};
|
|
23
28
|
}
|
|
24
29
|
/** The JSON body delivered to a webhook endpoint. */
|
|
25
30
|
interface WebhookEvent {
|
package/dist/webhook.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.mts","names":[],"sources":["../src/webhook.ts"],"mappings":";;;;;KAIY,gBAAA;AAAZ;AAAA,
|
|
1
|
+
{"version":3,"file":"webhook.d.mts","names":[],"sources":["../src/webhook.ts"],"mappings":";;;;;KAIY,gBAAA;AAAZ;AAAA,UAaiB,aAAA;EACf,QAAA;IACE,aAAA;IACA,cAAA;IACA,OAAA,WAJ0B;IAM1B,eAAA;EAAA;EAEF,QAAA;IACE,MAAA;IACA,KAAA;EAAA;EAEF,UAAA;IACE,MAAA;IACA,gBAAA;EAAA;EAEF,OAAA;IACE,MAAA;IACA,KAAA,UAFF;IAIE,OAAA;EAAA;AAAA;;UAKa,YAAA;EACf,KAAA,EAAO,gBAAA;EACP,UAAA,EAAY,EAAA;EACZ,eAAA,EAAiB,EAAA;EACjB,UAAA,EAAY,EAAA;EACZ,cAAA;EACA,MAAA,EAAQ,kBAAA;EACR,MAAA,EAAQ,aAAA;EACR,eAAA,EAAiB,cAAA;EADT;EAGR,MAAA,EAAQ,MAAA;EACR,UAAA,EAAY,WAAA;AAAA;;KAIF,qBAAA;;UAGK,eAAA,SAAwB,MAAA,EAAQ,aAAA;EAC/C,GAAA;EAjBY;EAmBZ,WAAA;EACA,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,qBAAA;AAAA;;KAIE,qBAAA;;UAGK,eAAA,SAAwB,MAAA,EAAQ,aAAA;EAC/C,mBAAA,EAAqB,EAAA;EACrB,KAAA,EAAO,gBAAA;EACP,OAAA,EAAS,YAAA;EACT,MAAA,EAAQ,qBAAA;EACR,eAAA;EACA,aAAA;EACA,QAAA;EACA,aAAA,EAAe,WAAA;AAAA"}
|
package/dist/widget.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { ProjectBranding } from "./project.mjs";
|
|
|
5
5
|
/** How the widget mounts into the host page. */
|
|
6
6
|
type WidgetMode = 'overlay' | 'inline' | 'hosted';
|
|
7
7
|
/** The screens of the widget verification flow, in order. */
|
|
8
|
-
type WidgetStep = 'welcome' | 'document_selection' | 'front_capture' | 'back_capture' | 'ocr_processing' | 'active_liveness' | 'selfie_capture' | 'passive_liveness' | 'face_match' | 'processing' | 'result';
|
|
8
|
+
type WidgetStep = 'welcome' | 'document_selection' | 'front_capture' | 'back_capture' | 'ocr_processing' | 'address_entry' | 'address_processing' | 'active_liveness' | 'selfie_capture' | 'passive_liveness' | 'face_match' | 'processing' | 'result';
|
|
9
9
|
/** The result handed to the widget's `onComplete` callback. */
|
|
10
10
|
interface WidgetResult {
|
|
11
11
|
status: VerificationStatus;
|
package/dist/widget.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.mts","names":[],"sources":["../src/widget.ts"],"mappings":";;;;;KAIY,UAAA;AAAZ;AAAA,KAGY,UAAA;;
|
|
1
|
+
{"version":3,"file":"widget.d.mts","names":[],"sources":["../src/widget.ts"],"mappings":";;;;;KAIY,UAAA;AAAZ;AAAA,KAGY,UAAA;;UAgBK,YAAA;EACf,MAAA,EAAQ,kBAAA;EACR,QAAA,EAAU,oBAAoB;AAAA;;UAIf,aAAA;EAtBK;EAwBpB,KAAA;EACA,IAAA,GAAO,UAAA;;EAEP,SAAA,YAAqB,WAAA;EACrB,QAAA,GAAW,eAAA;EACX,OAAA;EACA,UAAA,IAAc,MAAA,EAAQ,YAAA;EACtB,OAAA,IAAW,KAAA,EAAO,KAAA;EAClB,OAAA;AAAA"}
|
package/dist/workflow.d.mts
CHANGED
|
@@ -12,13 +12,49 @@ import { Id, IsoDateTime } from "./common.mjs";
|
|
|
12
12
|
* disturbs sessions already in flight.
|
|
13
13
|
*/
|
|
14
14
|
/** A coarse verification stage a workflow can order and toggle. */
|
|
15
|
-
type WorkflowStepKey = 'document' | 'liveness' | 'face_match';
|
|
16
|
-
/**
|
|
15
|
+
type WorkflowStepKey = 'document' | 'address' | 'liveness' | 'face_match';
|
|
16
|
+
/**
|
|
17
|
+
* The default pipeline's stages, in canonical order — what runs when a session
|
|
18
|
+
* has no workflow. `address` is deliberately NOT here: it's an opt-in stage,
|
|
19
|
+
* available only on custom workflows.
|
|
20
|
+
*/
|
|
17
21
|
declare const WORKFLOW_STEP_KEYS: readonly WorkflowStepKey[];
|
|
22
|
+
/**
|
|
23
|
+
* Every stage a custom workflow may include, in canonical order. Used by the
|
|
24
|
+
* workflow editor and to validate/normalise stored steps — a superset of
|
|
25
|
+
* {@link WORKFLOW_STEP_KEYS} that adds the opt-in `address` stage.
|
|
26
|
+
*/
|
|
27
|
+
declare const AVAILABLE_WORKFLOW_STEP_KEYS: readonly WorkflowStepKey[];
|
|
28
|
+
/** A method the address stage uses to corroborate the user's address. */
|
|
29
|
+
type AddressMethod = 'poa_document' | 'device_location' | 'geocode_lookup';
|
|
30
|
+
/** Every selectable address-verification method, in display order. */
|
|
31
|
+
declare const ADDRESS_METHODS: readonly AddressMethod[];
|
|
32
|
+
/** What a failed/low-confidence address result does to the session. */
|
|
33
|
+
type AddressOnFail = 'review' | 'reject';
|
|
34
|
+
/** Configuration for the `address` stage, carried on its {@link WorkflowStep}. */
|
|
35
|
+
interface AddressStepConfig {
|
|
36
|
+
/** Methods to run; at least one when the stage is enabled. */
|
|
37
|
+
methods: AddressMethod[];
|
|
38
|
+
/**
|
|
39
|
+
* What a failed or low-confidence result does. `review` (default) flags the
|
|
40
|
+
* session for a human; `reject` fails it outright.
|
|
41
|
+
*/
|
|
42
|
+
on_fail: AddressOnFail;
|
|
43
|
+
/**
|
|
44
|
+
* Minimum address-verification confidence in [0, 1] to auto-verify the address.
|
|
45
|
+
* A passed address scoring below this is routed to manual review (the gate is
|
|
46
|
+
* never a rejection). Omitted falls back to the project `addressThreshold`.
|
|
47
|
+
*/
|
|
48
|
+
auto_approve_threshold?: number;
|
|
49
|
+
}
|
|
50
|
+
/** The default address config applied when the stage is enabled without one. */
|
|
51
|
+
declare const DEFAULT_ADDRESS_CONFIG: AddressStepConfig;
|
|
18
52
|
/** One stage within a workflow, in pipeline order, on or off. */
|
|
19
53
|
interface WorkflowStep {
|
|
20
54
|
key: WorkflowStepKey;
|
|
21
55
|
enabled: boolean;
|
|
56
|
+
/** Stage-specific configuration. Only the `address` stage uses this today. */
|
|
57
|
+
config?: AddressStepConfig;
|
|
22
58
|
}
|
|
23
59
|
/** Workflow-wide toggles. */
|
|
24
60
|
interface WorkflowOptions {
|
|
@@ -50,10 +86,15 @@ declare const DEFAULT_WORKFLOW_CONFIG: WorkflowConfig;
|
|
|
50
86
|
* absent or `enabled: false` does not run.
|
|
51
87
|
*/
|
|
52
88
|
declare function workflowEnables(config: WorkflowConfig | null | undefined, key: WorkflowStepKey): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The resolved address config for a session's workflow, or `null` when the
|
|
91
|
+
* address stage isn't enabled. Missing fields fall back to {@link DEFAULT_ADDRESS_CONFIG}.
|
|
92
|
+
*/
|
|
93
|
+
declare function workflowAddressConfig(config: WorkflowConfig | null | undefined): AddressStepConfig | null;
|
|
53
94
|
/** Whether OCR parsing should run: the document stage is on and `skip_ocr` is off. */
|
|
54
95
|
declare function workflowRunsOcr(config: WorkflowConfig | null | undefined): boolean;
|
|
55
96
|
/** The enabled stages in pipeline order (used by the widget to sequence its steps). */
|
|
56
97
|
declare function workflowEnabledSteps(config: WorkflowConfig | null | undefined): WorkflowStepKey[];
|
|
57
98
|
//#endregion
|
|
58
|
-
export { DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, Workflow, WorkflowConfig, WorkflowOptions, WorkflowStep, WorkflowStepKey, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
99
|
+
export { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, AddressMethod, AddressOnFail, AddressStepConfig, DEFAULT_ADDRESS_CONFIG, DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, Workflow, WorkflowConfig, WorkflowOptions, WorkflowStep, WorkflowStepKey, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
59
100
|
//# sourceMappingURL=workflow.d.mts.map
|
package/dist/workflow.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":";;;;;AAcA;;;;AAA2B;
|
|
1
|
+
{"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":";;;;;AAcA;;;;AAA2B;AAO3B;;;;KAPY,eAAA;AAcZ;;;;AAAmE;AAAnE,cAPa,kBAAA,WAA6B,eAAe;;;;AAehC;AAGzB;cAXa,4BAAA,WAAuC,eAAe;;KAQvD,aAAA;AAGwC;AAAA,cAAvC,eAAA,WAA0B,aAAa;;KAGxC,aAAA;;UAGK,iBAAA;EAAA;EAEf,OAAA,EAAS,aAAA;;;;;EAKT,OAAA,EAAS,aAAa;EAAb;;;AAMa;AAIxB;EAJE,sBAAA;AAAA;;cAIW,sBAAA,EAAwB,iBAGpC;AAGD;AAAA,UAAiB,YAAA;EACf,GAAA,EAAK,eAAA;EACL,OAAA;EADA;EAGA,MAAA,GAAS,iBAAiB;AAAA;;UAIX,eAAA;EAJW;AAAA;AAI5B;;;EAME,QAAQ;AAAA;AAIV;AAAA,UAAiB,cAAA;EACf,KAAA,EAAO,YAAA;EACP,OAAA,EAAS,eAAe;AAAA;;UAIT,QAAA,SAAiB,cAAA;EAChC,EAAA,EAAI,EAAA;EACJ,eAAA,EAAiB,EAAA;EACjB,IAAA;EACA,UAAA,EAAY,WAAA;EACZ,UAAA,EAAY,WAAA;AAAA;;cAID,uBAAA,EAAyB,cAOrC;;;;;;iBAOe,eAAA,CAAgB,MAAA,EAAQ,cAAA,qBAAmC,GAAA,EAAK,eAAe;;;;;iBAY/E,qBAAA,CAAsB,MAAA,EAAQ,cAAA,sBAAoC,iBAAiB;;iBASnF,eAAA,CAAgB,MAAyC,EAAjC,cAAc;;iBAOtC,oBAAA,CAAqB,MAAA,EAAQ,cAAA,sBAAoC,eAAe"}
|
package/dist/workflow.mjs
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
//#region src/workflow.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The default pipeline's stages, in canonical order — what runs when a session
|
|
4
|
+
* has no workflow. `address` is deliberately NOT here: it's an opt-in stage,
|
|
5
|
+
* available only on custom workflows.
|
|
6
|
+
*/
|
|
3
7
|
const WORKFLOW_STEP_KEYS = [
|
|
4
8
|
"document",
|
|
5
9
|
"liveness",
|
|
6
10
|
"face_match"
|
|
7
11
|
];
|
|
12
|
+
/**
|
|
13
|
+
* Every stage a custom workflow may include, in canonical order. Used by the
|
|
14
|
+
* workflow editor and to validate/normalise stored steps — a superset of
|
|
15
|
+
* {@link WORKFLOW_STEP_KEYS} that adds the opt-in `address` stage.
|
|
16
|
+
*/
|
|
17
|
+
const AVAILABLE_WORKFLOW_STEP_KEYS = [
|
|
18
|
+
"document",
|
|
19
|
+
"address",
|
|
20
|
+
"liveness",
|
|
21
|
+
"face_match"
|
|
22
|
+
];
|
|
23
|
+
/** Every selectable address-verification method, in display order. */
|
|
24
|
+
const ADDRESS_METHODS = [
|
|
25
|
+
"poa_document",
|
|
26
|
+
"device_location",
|
|
27
|
+
"geocode_lookup"
|
|
28
|
+
];
|
|
29
|
+
/** The default address config applied when the stage is enabled without one. */
|
|
30
|
+
const DEFAULT_ADDRESS_CONFIG = {
|
|
31
|
+
methods: ["geocode_lookup"],
|
|
32
|
+
on_fail: "review"
|
|
33
|
+
};
|
|
8
34
|
/** The default pipeline applied when a session has no workflow. */
|
|
9
35
|
const DEFAULT_WORKFLOW_CONFIG = {
|
|
10
36
|
steps: [
|
|
@@ -29,9 +55,22 @@ const DEFAULT_WORKFLOW_CONFIG = {
|
|
|
29
55
|
* absent or `enabled: false` does not run.
|
|
30
56
|
*/
|
|
31
57
|
function workflowEnables(config, key) {
|
|
32
|
-
if (!config) return
|
|
58
|
+
if (!config) return WORKFLOW_STEP_KEYS.includes(key);
|
|
33
59
|
return config.steps.some((step) => step.key === key && step.enabled);
|
|
34
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The resolved address config for a session's workflow, or `null` when the
|
|
63
|
+
* address stage isn't enabled. Missing fields fall back to {@link DEFAULT_ADDRESS_CONFIG}.
|
|
64
|
+
*/
|
|
65
|
+
function workflowAddressConfig(config) {
|
|
66
|
+
if (!config) return null;
|
|
67
|
+
const step = config.steps.find((s) => s.key === "address" && s.enabled);
|
|
68
|
+
if (!step) return null;
|
|
69
|
+
return {
|
|
70
|
+
...DEFAULT_ADDRESS_CONFIG,
|
|
71
|
+
...step.config ?? {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
35
74
|
/** Whether OCR parsing should run: the document stage is on and `skip_ocr` is off. */
|
|
36
75
|
function workflowRunsOcr(config) {
|
|
37
76
|
if (!config) return true;
|
|
@@ -43,6 +82,6 @@ function workflowEnabledSteps(config) {
|
|
|
43
82
|
return config.steps.filter((step) => step.enabled).map((step) => step.key);
|
|
44
83
|
}
|
|
45
84
|
//#endregion
|
|
46
|
-
export { DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
85
|
+
export { ADDRESS_METHODS, AVAILABLE_WORKFLOW_STEP_KEYS, DEFAULT_ADDRESS_CONFIG, DEFAULT_WORKFLOW_CONFIG, WORKFLOW_STEP_KEYS, workflowAddressConfig, workflowEnabledSteps, workflowEnables, workflowRunsOcr };
|
|
47
86
|
|
|
48
87
|
//# sourceMappingURL=workflow.mjs.map
|
package/dist/workflow.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import type { Id, IsoDateTime } from './common'\n\n/**\n * Workflows (Phase 19).\n *\n * An organization-scoped, reusable recipe that determines the order of the\n * coarse verification stages, lets each be turned off, and can skip OCR parsing\n * (capture-only). Workflows are optional: a session created without one runs the\n * default pipeline (document → liveness → face match, OCR on). A workflow's\n * config is snapshotted onto each session at creation, so editing it never\n * disturbs sessions already in flight.\n */\n\n/** A coarse verification stage a workflow can order and toggle. */\nexport type WorkflowStepKey = 'document' | 'liveness' | 'face_match'\n\n
|
|
1
|
+
{"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import type { Id, IsoDateTime } from './common'\n\n/**\n * Workflows (Phase 19).\n *\n * An organization-scoped, reusable recipe that determines the order of the\n * coarse verification stages, lets each be turned off, and can skip OCR parsing\n * (capture-only). Workflows are optional: a session created without one runs the\n * default pipeline (document → liveness → face match, OCR on). A workflow's\n * config is snapshotted onto each session at creation, so editing it never\n * disturbs sessions already in flight.\n */\n\n/** A coarse verification stage a workflow can order and toggle. */\nexport type WorkflowStepKey = 'document' | 'address' | 'liveness' | 'face_match'\n\n/**\n * The default pipeline's stages, in canonical order — what runs when a session\n * has no workflow. `address` is deliberately NOT here: it's an opt-in stage,\n * available only on custom workflows.\n */\nexport const WORKFLOW_STEP_KEYS: readonly WorkflowStepKey[] = ['document', 'liveness', 'face_match']\n\n/**\n * Every stage a custom workflow may include, in canonical order. Used by the\n * workflow editor and to validate/normalise stored steps — a superset of\n * {@link WORKFLOW_STEP_KEYS} that adds the opt-in `address` stage.\n */\nexport const AVAILABLE_WORKFLOW_STEP_KEYS: readonly WorkflowStepKey[] = [\n 'document',\n 'address',\n 'liveness',\n 'face_match',\n]\n\n/** A method the address stage uses to corroborate the user's address. */\nexport type AddressMethod = 'poa_document' | 'device_location' | 'geocode_lookup'\n\n/** Every selectable address-verification method, in display order. */\nexport const ADDRESS_METHODS: readonly AddressMethod[] = ['poa_document', 'device_location', 'geocode_lookup']\n\n/** What a failed/low-confidence address result does to the session. */\nexport type AddressOnFail = 'review' | 'reject'\n\n/** Configuration for the `address` stage, carried on its {@link WorkflowStep}. */\nexport interface AddressStepConfig {\n /** Methods to run; at least one when the stage is enabled. */\n methods: AddressMethod[]\n /**\n * What a failed or low-confidence result does. `review` (default) flags the\n * session for a human; `reject` fails it outright.\n */\n on_fail: AddressOnFail\n /**\n * Minimum address-verification confidence in [0, 1] to auto-verify the address.\n * A passed address scoring below this is routed to manual review (the gate is\n * never a rejection). Omitted falls back to the project `addressThreshold`.\n */\n auto_approve_threshold?: number\n}\n\n/** The default address config applied when the stage is enabled without one. */\nexport const DEFAULT_ADDRESS_CONFIG: AddressStepConfig = {\n methods: ['geocode_lookup'],\n on_fail: 'review',\n}\n\n/** One stage within a workflow, in pipeline order, on or off. */\nexport interface WorkflowStep {\n key: WorkflowStepKey\n enabled: boolean\n /** Stage-specific configuration. Only the `address` stage uses this today. */\n config?: AddressStepConfig\n}\n\n/** Workflow-wide toggles. */\nexport interface WorkflowOptions {\n /**\n * Skip OCR parsing — capture the document image but don't extract fields.\n * Useful when Arkyc is only used for data capture and the assets are handed\n * to a third party. Disables the document portrait too, so face match can't run.\n */\n skip_ocr: boolean\n}\n\n/** The portable config of a workflow: ordered stages + options. */\nexport interface WorkflowConfig {\n steps: WorkflowStep[]\n options: WorkflowOptions\n}\n\n/** A saved, organization-scoped workflow. */\nexport interface Workflow extends WorkflowConfig {\n id: Id\n organization_id: Id\n name: string\n created_at: IsoDateTime\n updated_at: IsoDateTime\n}\n\n/** The default pipeline applied when a session has no workflow. */\nexport const DEFAULT_WORKFLOW_CONFIG: WorkflowConfig = {\n steps: [\n { key: 'document', enabled: true },\n { key: 'liveness', enabled: true },\n { key: 'face_match', enabled: true },\n ],\n options: { skip_ocr: false },\n}\n\n/**\n * Whether a stage runs under a config. A `null` config means \"no workflow\" — the\n * default pipeline, where every stage runs. Within a real config, a stage that is\n * absent or `enabled: false` does not run.\n */\nexport function workflowEnables(config: WorkflowConfig | null | undefined, key: WorkflowStepKey): boolean {\n // No workflow runs the default pipeline only — opt-in stages (`address`) are\n // off unless a custom workflow turns them on.\n if (!config) return WORKFLOW_STEP_KEYS.includes(key)\n\n return config.steps.some((step) => step.key === key && step.enabled)\n}\n\n/**\n * The resolved address config for a session's workflow, or `null` when the\n * address stage isn't enabled. Missing fields fall back to {@link DEFAULT_ADDRESS_CONFIG}.\n */\nexport function workflowAddressConfig(config: WorkflowConfig | null | undefined): AddressStepConfig | null {\n if (!config) return null\n const step = config.steps.find((s) => s.key === 'address' && s.enabled)\n if (!step) return null\n\n return { ...DEFAULT_ADDRESS_CONFIG, ...(step.config ?? {}) }\n}\n\n/** Whether OCR parsing should run: the document stage is on and `skip_ocr` is off. */\nexport function workflowRunsOcr(config: WorkflowConfig | null | undefined): boolean {\n if (!config) return true\n\n return workflowEnables(config, 'document') && !config.options.skip_ocr\n}\n\n/** The enabled stages in pipeline order (used by the widget to sequence its steps). */\nexport function workflowEnabledSteps(config: WorkflowConfig | null | undefined): WorkflowStepKey[] {\n if (!config) return [...WORKFLOW_STEP_KEYS]\n\n return config.steps.filter((step) => step.enabled).map((step) => step.key)\n}\n"],"mappings":";;;;;;AAqBA,MAAa,qBAAiD;CAAC;CAAY;CAAY;AAAY;;;;;;AAOnG,MAAa,+BAA2D;CACtE;CACA;CACA;CACA;AACF;;AAMA,MAAa,kBAA4C;CAAC;CAAgB;CAAmB;AAAgB;;AAuB7G,MAAa,yBAA4C;CACvD,SAAS,CAAC,gBAAgB;CAC1B,SAAS;AACX;;AAoCA,MAAa,0BAA0C;CACrD,OAAO;EACL;GAAE,KAAK;GAAY,SAAS;EAAK;EACjC;GAAE,KAAK;GAAY,SAAS;EAAK;EACjC;GAAE,KAAK;GAAc,SAAS;EAAK;CACrC;CACA,SAAS,EAAE,UAAU,MAAM;AAC7B;;;;;;AAOA,SAAgB,gBAAgB,QAA2C,KAA+B;CAGxG,IAAI,CAAC,QAAQ,OAAO,mBAAmB,SAAS,GAAG;CAEnD,OAAO,OAAO,MAAM,MAAM,SAAS,KAAK,QAAQ,OAAO,KAAK,OAAO;AACrE;;;;;AAMA,SAAgB,sBAAsB,QAAqE;CACzG,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,OAAO,OAAO,MAAM,MAAM,MAAM,EAAE,QAAQ,aAAa,EAAE,OAAO;CACtE,IAAI,CAAC,MAAM,OAAO;CAElB,OAAO;EAAE,GAAG;EAAwB,GAAI,KAAK,UAAU,CAAC;CAAG;AAC7D;;AAGA,SAAgB,gBAAgB,QAAoD;CAClF,IAAI,CAAC,QAAQ,OAAO;CAEpB,OAAO,gBAAgB,QAAQ,UAAU,KAAK,CAAC,OAAO,QAAQ;AAChE;;AAGA,SAAgB,qBAAqB,QAA8D;CACjG,IAAI,CAAC,QAAQ,OAAO,CAAC,GAAG,kBAAkB;CAE1C,OAAO,OAAO,MAAM,QAAQ,SAAS,KAAK,OAAO,CAAC,CAAC,KAAK,SAAS,KAAK,GAAG;AAC3E"}
|