@dossier-wiki/cloud-sdk 0.1.0 → 0.2.0-staging.3dda5e6

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 (120) hide show
  1. package/README.md +697 -46
  2. package/dist/cjs/api.js +34 -0
  3. package/dist/cjs/api.js.map +1 -0
  4. package/dist/cjs/error.js +29 -0
  5. package/dist/cjs/error.js.map +1 -0
  6. package/dist/cjs/http.js +75 -0
  7. package/dist/cjs/http.js.map +1 -0
  8. package/dist/cjs/index.js +48 -0
  9. package/dist/cjs/index.js.map +1 -0
  10. package/dist/cjs/resources/aml.js +88 -0
  11. package/dist/cjs/resources/aml.js.map +1 -0
  12. package/dist/cjs/resources/documents.js +170 -0
  13. package/dist/cjs/resources/documents.js.map +1 -0
  14. package/dist/cjs/resources/form-templates.js +117 -0
  15. package/dist/cjs/resources/form-templates.js.map +1 -0
  16. package/dist/cjs/resources/kyc/index.js +32 -0
  17. package/dist/cjs/resources/kyc/index.js.map +1 -0
  18. package/dist/cjs/resources/kyc/sessions.js +103 -0
  19. package/dist/cjs/resources/kyc/sessions.js.map +1 -0
  20. package/dist/cjs/resources/kyc/workflows.js +150 -0
  21. package/dist/cjs/resources/kyc/workflows.js.map +1 -0
  22. package/dist/cjs/resources/media.js +62 -0
  23. package/dist/cjs/resources/media.js.map +1 -0
  24. package/dist/cjs/schemas/index.js +9 -0
  25. package/dist/cjs/schemas/index.js.map +1 -0
  26. package/dist/cjs/schemas/kyc/workflow-steps.js +145 -0
  27. package/dist/cjs/schemas/kyc/workflow-steps.js.map +1 -0
  28. package/dist/cjs/service.js +132 -0
  29. package/dist/cjs/service.js.map +1 -0
  30. package/dist/cjs/session.js +379 -0
  31. package/dist/cjs/session.js.map +1 -0
  32. package/dist/cjs/types.js +36 -0
  33. package/dist/cjs/types.js.map +1 -0
  34. package/dist/cjs/webhooks.js +93 -0
  35. package/dist/cjs/webhooks.js.map +1 -0
  36. package/dist/esm/api.js +33 -0
  37. package/dist/esm/api.js.map +1 -0
  38. package/dist/esm/error.js +25 -0
  39. package/dist/esm/error.js.map +1 -0
  40. package/dist/esm/http.js +71 -0
  41. package/dist/esm/http.js.map +1 -0
  42. package/dist/esm/index.js +19 -0
  43. package/dist/esm/index.js.map +1 -0
  44. package/dist/esm/resources/aml.js +84 -0
  45. package/dist/esm/resources/aml.js.map +1 -0
  46. package/dist/esm/resources/documents.js +166 -0
  47. package/dist/esm/resources/documents.js.map +1 -0
  48. package/dist/esm/resources/form-templates.js +113 -0
  49. package/dist/esm/resources/form-templates.js.map +1 -0
  50. package/dist/esm/resources/kyc/index.js +26 -0
  51. package/dist/esm/resources/kyc/index.js.map +1 -0
  52. package/dist/esm/resources/kyc/sessions.js +99 -0
  53. package/dist/esm/resources/kyc/sessions.js.map +1 -0
  54. package/dist/esm/resources/kyc/workflows.js +146 -0
  55. package/dist/esm/resources/kyc/workflows.js.map +1 -0
  56. package/dist/esm/resources/media.js +58 -0
  57. package/dist/esm/resources/media.js.map +1 -0
  58. package/dist/esm/schemas/index.js +2 -0
  59. package/dist/esm/schemas/index.js.map +1 -0
  60. package/dist/esm/schemas/kyc/workflow-steps.js +142 -0
  61. package/dist/esm/schemas/kyc/workflow-steps.js.map +1 -0
  62. package/dist/esm/service.js +127 -0
  63. package/dist/esm/service.js.map +1 -0
  64. package/dist/esm/session.js +375 -0
  65. package/dist/esm/session.js.map +1 -0
  66. package/dist/{types.js → esm/types.js} +11 -27
  67. package/dist/esm/types.js.map +1 -0
  68. package/dist/{webhooks.js → esm/webhooks.js} +10 -11
  69. package/dist/esm/webhooks.js.map +1 -0
  70. package/dist/{api.d.ts → types/api.d.ts} +297 -166
  71. package/dist/types/api.d.ts.map +1 -0
  72. package/dist/types/error.d.ts +24 -0
  73. package/dist/types/error.d.ts.map +1 -0
  74. package/dist/types/http.d.ts +17 -0
  75. package/dist/types/http.d.ts.map +1 -0
  76. package/dist/types/index.d.ts +15 -0
  77. package/dist/types/index.d.ts.map +1 -0
  78. package/dist/types/resources/aml.d.ts +79 -0
  79. package/dist/types/resources/aml.d.ts.map +1 -0
  80. package/dist/types/resources/documents.d.ts +153 -0
  81. package/dist/types/resources/documents.d.ts.map +1 -0
  82. package/dist/types/resources/form-templates.d.ts +104 -0
  83. package/dist/types/resources/form-templates.d.ts.map +1 -0
  84. package/dist/types/resources/kyc/index.d.ts +34 -0
  85. package/dist/types/resources/kyc/index.d.ts.map +1 -0
  86. package/dist/types/resources/kyc/sessions.d.ts +92 -0
  87. package/dist/types/resources/kyc/sessions.d.ts.map +1 -0
  88. package/dist/types/resources/kyc/workflows.d.ts +135 -0
  89. package/dist/types/resources/kyc/workflows.d.ts.map +1 -0
  90. package/dist/types/resources/media.d.ts +56 -0
  91. package/dist/types/resources/media.d.ts.map +1 -0
  92. package/dist/types/schemas/index.d.ts +3 -0
  93. package/dist/types/schemas/index.d.ts.map +1 -0
  94. package/dist/types/schemas/kyc/workflow-steps.d.ts +5113 -0
  95. package/dist/types/schemas/kyc/workflow-steps.d.ts.map +1 -0
  96. package/dist/types/service.d.ts +143 -0
  97. package/dist/types/service.d.ts.map +1 -0
  98. package/dist/types/session.d.ts +176 -0
  99. package/dist/types/session.d.ts.map +1 -0
  100. package/dist/{types.d.ts → types/types.d.ts} +100 -2
  101. package/dist/types/types.d.ts.map +1 -0
  102. package/dist/{webhooks.d.ts → types/webhooks.d.ts} +5 -5
  103. package/dist/types/webhooks.d.ts.map +1 -0
  104. package/package.json +26 -32
  105. package/dist/api.d.ts.map +0 -1
  106. package/dist/api.js +0 -22
  107. package/dist/api.js.map +0 -1
  108. package/dist/index.d.ts +0 -6
  109. package/dist/index.d.ts.map +0 -1
  110. package/dist/index.js +0 -5
  111. package/dist/index.js.map +0 -1
  112. package/dist/service.d.ts +0 -39
  113. package/dist/service.d.ts.map +0 -1
  114. package/dist/service.js +0 -150
  115. package/dist/service.js.map +0 -1
  116. package/dist/types.d.ts.map +0 -1
  117. package/dist/types.js.map +0 -1
  118. package/dist/webhooks.d.ts.map +0 -1
  119. package/dist/webhooks.js.map +0 -1
  120. package/docs/REFERENCE.md +0 -114
@@ -23,84 +23,50 @@ export interface SanctionSearchInput {
23
23
  idNumbers?: string[];
24
24
  }
25
25
  export interface IdDocument {
26
- /** Document type (e.g. `passport`, `national_id`). */
27
26
  documentType?: string;
28
- /** ISO 3166-1 alpha-2 country code of issuance. */
29
27
  countryOfIssue?: string;
30
- /** Document number or identifier. */
31
28
  idNumber?: string;
32
- /** Date of issue (format varies by source). */
33
29
  dateOfIssue?: string;
34
- /** Date of expiry (format varies by source). */
35
30
  dateOfExpiry?: string;
36
- /** Free-form supplementary details from the source list. */
37
31
  additionalInfo?: string;
38
32
  }
39
33
  export interface Sanction {
40
- /** Subject classification (e.g. `individual`, `entity`). */
41
34
  entityType: string;
42
- /** Primary name as published on the sanctions list. */
43
35
  name: string;
44
- /** Honorifics or titles (e.g. `Mr.`, `Dr.`). */
45
36
  titles?: string[];
46
- /** Official designations (e.g. `Minister`, `General`). */
47
37
  designations?: string[];
48
- /** Dates of birth as published — may include multiple entries when sources disagree. */
49
38
  dateOfBirth?: string[];
50
- /** Places of birth as published. */
51
39
  placeOfBirth?: string[];
52
- /** Free-form remarks from the source list. */
53
40
  comments?: string;
54
41
  identificationDocuments?: IdDocument[];
55
- /** Addresses as published. */
56
42
  address?: string[];
57
- /** Date the subject was first listed on the source. */
58
43
  listedDate?: string;
59
- /** Sanctions program codes (e.g. `SDGT`, `Security Council Resolution 1267`). */
60
44
  sanctionsProgramme: string[];
61
- /** Citizenship(s) as published. */
62
45
  citizenship?: string[];
63
46
  aliases?: string[];
64
- /** Nationality as published. */
65
47
  nationality?: string;
66
- /** Associated countries (ISO 3166-1 alpha-2 where available). */
67
48
  country?: string[];
68
- /** URLs of associated images. */
69
49
  image?: string[];
70
- /** Originating sanctions list. */
71
50
  source: SanctionSource;
72
- /** External ID from the originating source. */
73
51
  extId: string;
74
- /** Source-specific extra fields not modeled above. */
75
52
  additionalData?: Record<string, unknown>;
76
- /** Verbatim original record from the source, when retained. */
77
53
  originalData?: string;
78
- /** Pagination cursor returned by the upstream search engine. */
79
54
  sort?: [number, number];
80
55
  }
81
- /** Response from `POST /sanctions/search`. Costs 5 credits per request. */
82
56
  export interface SanctionSearchResponse {
83
57
  totalHits: number;
84
- /** Echoed (normalized, lowercased) query terms used for the search. */
85
58
  searchingFor: string[];
86
59
  documents: Sanction[];
87
60
  }
88
61
  export interface DossierSearchInput {
89
- /** Full name of the individual to search for. */
90
62
  fullName: string;
91
- /** When true, bypasses cached results and runs a fresh search. Default: false. */
92
63
  noCache?: boolean;
93
- /** When true, only returns high-risk profiles (PEP, sanctioned, adverse media). Default: true. */
94
64
  onlyShowHighRiskProfiles?: boolean;
95
65
  }
96
66
  export interface PersonIdentificationDocument {
97
- /** Document type (e.g. `passport`, `national_id`). */
98
67
  type: string;
99
- /** Document number or identifier. */
100
68
  number: string;
101
- /** Additional details about the document. */
102
69
  description: string;
103
- /** IDs of source documents referencing this identification. */
104
70
  referenceDocumentIds: string[];
105
71
  }
106
72
  export interface AssociatesAndRelatives {
@@ -122,7 +88,7 @@ export interface DocumentMatch {
122
88
  matchingQueries: string[];
123
89
  matchingChunk: string;
124
90
  }
125
- export interface Document {
91
+ export interface DossierDocument {
126
92
  id: string;
127
93
  originalUrl: string;
128
94
  title: string;
@@ -130,21 +96,14 @@ export interface Document {
130
96
  matches: DocumentMatch;
131
97
  }
132
98
  export interface PEPScorecard {
133
- /** PEP likelihood score from 0.0 (unlikely) to 1.0 (certain). */
134
99
  pepLikelihoodScore: number;
135
- /** PEP category (e.g. "Head of State", "Senior Government Official"). */
136
100
  category: string;
137
- /** Step-by-step reasoning explaining how the PEP score was derived. */
138
101
  reasoningSteps: string[];
139
102
  }
140
103
  export interface RiskScorecard {
141
- /** PEP-specific scoring breakdown (present when PEP indicators are found). */
142
104
  pepScorecard?: PEPScorecard;
143
- /** Overall risk score from 0.0 (low risk) to 1.0 (high risk). */
144
105
  overallRiskScore: number;
145
- /** Narrative explanation of the risk assessment. */
146
106
  riskReasoning: string;
147
- /** Risk category (e.g. `high`, `medium`, `low`). */
148
107
  riskCategory: string;
149
108
  }
150
109
  export interface IndividualDossier {
@@ -160,115 +119,106 @@ export interface IndividualDossier {
160
119
  keywords: string[];
161
120
  positionsHeld: PositionsHeld[];
162
121
  documentIds?: string[];
163
- documents?: Document[];
122
+ documents?: DossierDocument[];
164
123
  individualSummary: string;
165
124
  riskScorecard?: RiskScorecard;
166
125
  cachedResult?: boolean;
167
- /** ISO 8601 timestamp. */
168
126
  createdAt: string;
169
127
  }
170
128
  export type DossierSearchResponse = IndividualDossier[];
171
129
  export interface IdentificationDocumentInput {
172
- /** Document type (e.g. `passport`, `national_id`, `drivers_license`). */
173
130
  type?: string;
174
- /** Document number or identifier. */
175
131
  number?: string;
176
- /** ISO 3166-1 alpha-2 country code of the issuing country. */
177
132
  country?: string;
178
133
  }
179
134
  export interface CreateScreeningRequestDto {
180
- /** Full name of the individual to screen. */
181
135
  fullName: string;
182
- /** Your own reference ID (e.g. customer ID, case number). */
183
136
  externalId?: string;
184
- /** Identification document details to improve match accuracy. */
185
137
  identificationDocument?: IdentificationDocumentInput;
186
- /** Date of birth in `YYYY-MM-DD` format. */
187
138
  dateOfBirth?: string;
188
- /** ISO 3166-1 alpha-2 country code. */
189
139
  country?: string;
190
140
  }
191
141
  export interface CreateScreeningRequestResponseDto {
192
- /** Unique ID of the created screening request. */
193
142
  requestId: string;
194
143
  }
195
- export type KycSessionState = 'home' | 'permission-granting' | 'dv-get-started' | 'dv-document-selection' | 'dv-document-upload' | 'dv-positioning-front' | 'dv-capturing-front' | 'dv-flip-prompt' | 'dv-positioning-back' | 'dv-capturing-back' | 'dv-complete' | 'lv-get-started' | 'lv-initializing' | 'lv-aligning' | 'lv-countdown' | 'lv-complete' | 'lv-timeout';
196
- export type KycDocumentVerificationStatus = 'pending' | 'running' | 'completed' | 'failed';
197
- export interface CreateKycSessionDTO {
198
- /** External reference ID used to correlate the session with your records. */
144
+ export type KycSessionCheckpoint = 'home' | 'permission-granting' | 'dv-document-selection' | 'dv-capture-tips' | 'dv-document-upload' | 'dv-positioning-front' | 'dv-capturing-front' | 'dv-flip-prompt' | 'dv-positioning-back' | 'dv-capturing-back' | 'dv-complete' | 'aadhaar-get-started' | 'aadhaar-otp-sent' | 'aadhaar-verified' | 'lv-get-started' | 'lv-initializing' | 'lv-capture' | 'lv-complete' | 'lv-timeout' | 'fc-active' | 'verification-results' | 'document-verification' | 'liveness-verification' | 'form-submission' | 'signature-submission' | 'results' | 'completion';
145
+ export type KycSessionStatus = 'not-started' | 'in-progress' | 'complete' | 'approved' | 'rejected';
146
+ export type KycStepSubmissionStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
147
+ export interface KycCustomerDTO {
199
148
  externalId?: string;
200
- /** Session expiry duration in milliseconds. Defaults to 1 hour. */
201
- expiresInMs?: number;
202
- /** Customer email — when set alongside `customerName`, an invitation email is sent. */
203
- customerEmail?: string;
204
- /** Customer display name, used in the invitation email greeting. */
205
- customerName?: string;
206
- }
207
- export interface KycSessionDataOutputDTO {
208
- /** Selected country code. */
209
- country?: string;
210
- /** Selected document type. */
211
- documentType?: string;
212
- /** Document aspect ratio (width / height). */
213
- documentRatio?: number;
214
- /** Whether the document has both front and back sides. */
215
- isDoubleSided?: boolean;
149
+ name?: string;
150
+ email?: string;
216
151
  }
217
- export interface KycDocumentVerificationDTO {
218
- instanceId: string;
219
- processorId: string;
220
- status: KycDocumentVerificationStatus;
221
- statusLabel?: string | null;
222
- documentTypeId?: string | null;
223
- /** Unix ms when verification was triggered. */
224
- triggeredAt: number;
225
- /** Unix ms when verification completed; `null` while in progress. */
226
- completedAt?: number | null;
227
- error?: string | null;
228
- /** Full processing result (validation, extraction, post-processing). */
229
- result?: Record<string, unknown> | null;
230
- /** Per-stage progress entries. */
231
- stageProgress?: string[] | null;
232
- /** Chronological processing log with timestamps. */
233
- processingLog?: string[] | null;
234
- /** References to original, cropped, and detected face images. */
235
- files?: string[] | null;
236
- }
237
- export interface KycFaceVerificationDTO {
238
- /** Whether the face on the document matches the liveness frame. */
239
- verified: boolean;
240
- /** Distance between the two face embeddings (lower = more similar). */
241
- distance: number;
242
- /** Distance threshold used for the verification decision. */
243
- threshold: number;
244
- /** Face recognition model used. */
245
- model: string;
246
- /** Unix ms when the verification was performed. */
247
- performedAt: number;
152
+ export interface KycResultMediaDTO {
153
+ label: string;
154
+ key: string;
155
+ mediaType: string;
156
+ type?: string | null;
157
+ url?: string | null;
158
+ metadata?: Record<string, unknown> | null;
159
+ }
160
+ export interface KycStepSubmissionDTO {
161
+ attemptId?: string | null;
162
+ status: KycStepSubmissionStatus;
163
+ input?: Record<string, unknown> | null;
164
+ output?: Record<string, unknown> | null;
165
+ processorInstanceId?: string | null;
248
166
  error?: string | null;
167
+ /** Unix ms when the submission started. */
168
+ startedAt: number;
169
+ /** Unix ms when the submission completed; `null` while in progress. */
170
+ completedAt?: number | null;
171
+ media: KycResultMediaDTO[];
172
+ }
173
+ export interface KycSessionResultStepDTO {
174
+ stepId: string;
175
+ type: string;
176
+ status: KycStepSubmissionStatus;
177
+ submissions: KycStepSubmissionDTO[];
178
+ summary?: KycStepSubmissionDTO | null;
179
+ }
180
+ export interface KycSessionResultDTO {
181
+ steps: KycSessionResultStepDTO[];
182
+ rollup: Record<string, unknown>;
183
+ }
184
+ export interface KycSessionSuspiciousDTO {
185
+ isSuspicious: boolean;
186
+ reason?: string | null;
249
187
  }
250
188
  export interface KycSessionOutputDTO {
251
189
  id: string;
252
- organizationId: string;
253
- externalId?: string;
254
- customerName?: string;
255
- customerEmail?: string;
256
- state: KycSessionState;
257
- data: KycSessionDataOutputDTO;
190
+ customer: KycCustomerDTO;
191
+ userProgress: {
192
+ checkpoint: string;
193
+ attempts: Record<string, unknown>[];
194
+ };
195
+ status: KycSessionStatus;
258
196
  isInvalid: boolean;
259
- isComplete: boolean;
260
- /** Unix ms. */
197
+ suspicious: KycSessionSuspiciousDTO;
198
+ currentUser?: string | null;
199
+ /** Unix ms when created. */
261
200
  createdAt: number;
262
- /** Unix ms. `null` after completion. */
201
+ /** Unix ms. `null` if no expiry. */
263
202
  expiresAt?: number | null;
264
- /** Unix ms. `null` if not yet completed. */
203
+ /** Unix ms. `null` while in progress. */
265
204
  completedAt?: number | null;
266
- documentVerification?: KycDocumentVerificationDTO | null;
267
- faceVerification?: KycFaceVerificationDTO | null;
205
+ workflowSnapshot: Record<string, unknown>;
206
+ flowConfig?: Record<string, unknown> | null;
207
+ stepPreviewData?: Record<string, unknown> | null;
208
+ result: KycSessionResultDTO;
209
+ adminDecision?: Record<string, unknown> | null;
210
+ }
211
+ export interface CreateKycSessionDTO {
212
+ customer?: KycCustomerDTO;
213
+ /** Session expiry duration in milliseconds. Defaults to 1 hour (3,600,000 ms). */
214
+ expiresInMs?: number;
215
+ /** Optional Workflow ID. If omitted, the organization default is used. */
216
+ workflowId?: string;
217
+ flowConfig?: Record<string, unknown>;
268
218
  }
269
219
  export interface CreateKycSessionOutputDTO {
270
220
  session: KycSessionOutputDTO;
271
- /** Short-lived JWT token for customer access to the session. */
221
+ /** Short-lived JWT for customer access to the session. */
272
222
  token: string;
273
223
  /** Full URL the customer should visit to complete KYC verification. */
274
224
  sessionUrl: string;
@@ -280,9 +230,8 @@ export interface DateRange {
280
230
  end?: string;
281
231
  }
282
232
  export interface KycSessionFiltersDTO {
283
- /** Free-text search across session ID, external ID, customer name, and email. */
284
233
  searchQuery?: string;
285
- state?: KycSessionState;
234
+ checkpoint?: KycSessionCheckpoint;
286
235
  isComplete?: boolean;
287
236
  isInvalid?: boolean;
288
237
  createdAt?: DateRange;
@@ -295,12 +244,140 @@ export interface KycSessionFiltersDTO {
295
244
  }
296
245
  export interface PaginatedKycSessionsDTO {
297
246
  sessions: KycSessionOutputDTO[];
298
- /** Total before pagination. */
299
247
  totalCount: number;
300
248
  }
301
249
  export interface DeleteSessionOutputDTO {
302
250
  success: boolean;
303
251
  }
252
+ export type KycWorkflowStepType = 'id_verification' | 'document_collection' | 'liveness' | 'form_collection' | 'esignature' | 'action';
253
+ export interface WorkflowCondition {
254
+ variable: string;
255
+ operator: 'gt' | 'lt' | 'eq' | 'neq';
256
+ value: unknown;
257
+ targetStepId: string;
258
+ }
259
+ export interface WorkflowRules {
260
+ /** Target step ID or `'COMPLETE_SESSION'`. */
261
+ onSuccess: string;
262
+ /** Target step ID or `'FAIL_SESSION'`. */
263
+ onFailure: string;
264
+ conditions?: WorkflowCondition[];
265
+ }
266
+ export interface WorkflowInputMapping {
267
+ /** Key under which the resolved value is placed in this step's input. */
268
+ target: string;
269
+ /** stepId of an earlier step whose output supplies the value. */
270
+ sourceStepId: string;
271
+ /** Dot path into the source step's output, e.g. `formData.nic_id`. */
272
+ sourcePath: string;
273
+ }
274
+ export interface KycWorkflowStep {
275
+ stepId: string;
276
+ type: KycWorkflowStepType;
277
+ input: {
278
+ config?: Record<string, unknown>;
279
+ mapping?: WorkflowInputMapping[];
280
+ };
281
+ output: {
282
+ schema?: Record<string, unknown>;
283
+ };
284
+ rules: WorkflowRules;
285
+ skippable?: boolean;
286
+ locales?: Record<string, Record<string, unknown>>;
287
+ }
288
+ export interface CreateKycWorkflowInput {
289
+ name: string;
290
+ description?: string;
291
+ isPublic?: boolean;
292
+ allowedOrganizations?: string[];
293
+ defaultConfig?: Record<string, unknown>;
294
+ steps: KycWorkflowStep[];
295
+ }
296
+ export type UpdateKycWorkflowInput = Partial<CreateKycWorkflowInput>;
297
+ export interface KycWorkflow {
298
+ id: string;
299
+ name: string;
300
+ description?: string;
301
+ organizationId?: string;
302
+ allowedOrganizations?: string[];
303
+ isPublic: boolean;
304
+ version: number;
305
+ defaultConfig?: Record<string, unknown>;
306
+ steps: KycWorkflowStep[];
307
+ createdAt?: string;
308
+ updatedAt?: string;
309
+ }
310
+ export interface WorkflowStepDefault {
311
+ type: KycWorkflowStepType;
312
+ label: string;
313
+ description: string;
314
+ defaultStepId: string;
315
+ defaultInput: Record<string, unknown>;
316
+ defaultRules: Record<string, unknown>;
317
+ defaultLocales: Record<string, Record<string, unknown>>;
318
+ schema: Record<string, unknown>;
319
+ skippable: boolean;
320
+ group: string;
321
+ }
322
+ export type FormFieldType = 'text' | 'long_text' | 'number' | 'currency' | 'country' | 'language' | 'email' | 'phone' | 'date' | 'select' | 'multi_select' | 'dropdown' | 'toggle' | 'boolean' | 'file' | 'heading' | 'paragraph' | 'description' | 'divider';
323
+ export interface FormFieldOption {
324
+ value: string;
325
+ label: string;
326
+ }
327
+ export interface FormFieldValidation {
328
+ minLength?: number;
329
+ maxLength?: number;
330
+ min?: number;
331
+ max?: number;
332
+ pattern?: string;
333
+ currencyCode?: string;
334
+ accept?: string[];
335
+ maxSizeMb?: number;
336
+ }
337
+ export interface FormField {
338
+ id: string;
339
+ type: FormFieldType;
340
+ label: string;
341
+ placeholder?: string;
342
+ helpText?: string;
343
+ required: boolean;
344
+ defaultValue?: unknown;
345
+ content?: string;
346
+ consentText?: string;
347
+ options?: FormFieldOption[];
348
+ validation?: FormFieldValidation;
349
+ dateFormat?: string;
350
+ }
351
+ export interface CreateFormTemplateInput {
352
+ name: string;
353
+ description?: string;
354
+ isPublic?: boolean;
355
+ allowedOrganizations?: string[];
356
+ fields: FormField[];
357
+ }
358
+ export type UpdateFormTemplateInput = Partial<CreateFormTemplateInput>;
359
+ export interface FormTemplateListItem {
360
+ id: string;
361
+ name: string;
362
+ description?: string;
363
+ fieldCount: number;
364
+ createdAt?: string;
365
+ updatedAt?: string;
366
+ }
367
+ export interface FormTemplate extends FormTemplateListItem {
368
+ isPublic?: boolean;
369
+ allowedOrganizations?: string[];
370
+ fields: FormField[];
371
+ }
372
+ export interface ListFormTemplatesResponse {
373
+ templates: FormTemplateListItem[];
374
+ totalCount: number;
375
+ }
376
+ export interface ListFormTemplatesQuery {
377
+ searchQuery?: string;
378
+ limit?: number;
379
+ offset?: number;
380
+ }
304
381
  export type DocumentProcessorId = 'INVOICE' | 'SRI_LANKA_ID' | 'SRI_LANKA_FORM1_COMPANY_REGISTRATION' | 'SRI_LANKA_FORM15_ANNUAL_RETURN';
305
382
  export type DocumentProcessingInstanceStatus = 'pending' | 'running' | 'completed' | 'failed' | 'error';
306
383
  /**
@@ -311,20 +388,12 @@ export type DocumentProcessingInstanceStatus = 'pending' | 'running' | 'complete
311
388
  * SRI_LANKA_ID: `name`, `dateOfBirth` (YYYY-MM-DD), `idNumber`, `address`
312
389
  */
313
390
  export type DocumentProcessingInputData = Record<string, string | number | boolean | null>;
314
- /**
315
- * Open key/value bag stored on a document processing instance. Persisted as
316
- * provided on the input and echoed back on every response shape. Not sent to
317
- * the AI — useful for syncing with external systems (e.g. customer IDs).
318
- *
319
- * Example: `{ externalCustomerId: "testing-123" }`
320
- */
391
+ /** Open key/value bag stored on the instance; not sent to the AI. */
321
392
  export type DocumentProcessingMetadata = Record<string, unknown>;
322
393
  export interface InitiateDocumentProcessingInput {
323
394
  processorId: DocumentProcessorId;
324
395
  files: FileInput[];
325
- /** Cross-check context for the AI (per-processor keys; see `DocumentProcessingInputData`). */
326
396
  inputData?: DocumentProcessingInputData;
327
- /** Arbitrary metadata stored on the instance but not sent to the AI. */
328
397
  metadata?: DocumentProcessingMetadata;
329
398
  /** Default `true`. Crop document images before validation/extraction. */
330
399
  shouldCropImages?: boolean;
@@ -338,11 +407,9 @@ export interface ListDocumentProcessingInstancesQuery {
338
407
  offset?: number;
339
408
  includeFileUrls?: boolean;
340
409
  }
341
- /** Stage IDs emitted by the standard document processing pipeline. */
342
410
  export type DocumentProcessingStageId = 'crop_and_detect_faces' | 'pre_validate_and_extract' | 'post_validation' | (string & {});
343
411
  export type DocumentProcessingStageStatus = 'pending' | 'running' | 'success' | 'completed' | 'failed';
344
412
  export interface DocumentProcessingFileObject {
345
- /** Storage key for the file. */
346
413
  key: string;
347
414
  filename: string;
348
415
  mimeType: string;
@@ -350,21 +417,12 @@ export interface DocumentProcessingFileObject {
350
417
  size: number;
351
418
  /** Signed URL with ~5-minute expiry. */
352
419
  url: string;
353
- /** ISO 8601 expiry of `url`. */
354
420
  urlExpiresAt?: string;
355
- /** ISO 8601 upload timestamp. */
356
421
  uploadedAt?: string;
357
422
  }
358
- /**
359
- * One uploaded source document. The processor cropped each image (when crop
360
- * is enabled) and ran face detection — both surfaced as separate variants.
361
- */
362
423
  export interface DocumentProcessingFile {
363
- /** Reference to the original uploaded file. Always present. */
364
424
  original: DocumentProcessingFileObject;
365
- /** Reference to the cropped variant. Absent when cropping was skipped. */
366
425
  cropped?: DocumentProcessingFileObject;
367
- /** Faces detected on the document, one entry per face. */
368
426
  detectedFaces?: DocumentProcessingFileObject[];
369
427
  }
370
428
  export interface DocumentProcessingValidationRule {
@@ -389,10 +447,6 @@ export interface DocumentProcessingExtractedField<T = unknown> {
389
447
  originalTextConfidence?: number;
390
448
  isOriginalTextHandwritten?: boolean;
391
449
  }
392
- /**
393
- * Multilingual variant — emitted for fields like `name`, `address`, `placeOfBirth`
394
- * on documents printed in multiple scripts (e.g. LKA NIC in Sinhala/Tamil/English).
395
- */
396
450
  export interface DocumentProcessingTransliteratedField {
397
451
  enTransliterations: Array<{
398
452
  transliteratedText: string;
@@ -407,7 +461,6 @@ export interface DocumentProcessingTransliteratedField {
407
461
  }>;
408
462
  }
409
463
  export type DocumentProcessingSchemaField = DocumentProcessingExtractedField | DocumentProcessingTransliteratedField;
410
- /** Extracted document schema is processor-specific; default to a permissive map. */
411
464
  export type DocumentProcessingExtractedSchema = Record<string, DocumentProcessingSchemaField>;
412
465
  export interface DocumentProcessingPostProcessingRuleResult {
413
466
  id: string;
@@ -436,15 +489,11 @@ export interface DocumentProcessingResult<TSchema extends DocumentProcessingExtr
436
489
  validation: DocumentProcessingValidation;
437
490
  extraction: DocumentProcessingValidation;
438
491
  schema: TSchema;
439
- /**
440
- * Flattened, English-normalised mirror of `schema`. Keys are processor-specific
441
- * (e.g. `name`, `idNumber`, `nicNumber`, `dateOfBirth`, `issuingCountry`).
442
- */
492
+ /** Flattened, English-normalised mirror of `schema`. */
443
493
  normalizedData?: Record<string, string | number | null> | null;
444
494
  postProcessing: DocumentProcessingPostProcessing;
445
495
  stages: DocumentProcessingStageRef[];
446
496
  }
447
- /** Subject (extracted name/identifier) surfaced on the list endpoint. */
448
497
  export interface DocumentProcessingInstanceSubject {
449
498
  name: string;
450
499
  identifier: string;
@@ -456,13 +505,9 @@ export interface DocumentProcessingInstanceSummary {
456
505
  subject?: DocumentProcessingInstanceSubject;
457
506
  status: DocumentProcessingInstanceStatus;
458
507
  statusLabel: string;
459
- /** ISO 8601. */
460
508
  createdAt: string;
461
- /** ISO 8601. */
462
509
  updatedAt: string;
463
- /** ISO 8601, null while still processing. */
464
510
  completedAt: string | null;
465
- /** Open key/value bag set at instance creation (e.g. `{ externalCustomerId: "..." }`). */
466
511
  metadata?: DocumentProcessingMetadata | null;
467
512
  }
468
513
  /** Full instance returned by `POST /document-processing` and `GET /document-processing/{id}`. */
@@ -471,15 +516,10 @@ export interface DocumentProcessingInstance<TSchema extends DocumentProcessingEx
471
516
  processorId: DocumentProcessorId;
472
517
  status: DocumentProcessingInstanceStatus;
473
518
  statusLabel: string;
474
- /** ISO 8601. */
475
519
  createdAt: string;
476
- /** ISO 8601. */
477
520
  updatedAt: string;
478
- /** ISO 8601, null while still processing. */
479
521
  completedAt?: string | null;
480
- /** Open key/value bag set at instance creation (e.g. `{ externalCustomerId: "..." }`). */
481
522
  metadata?: DocumentProcessingMetadata | null;
482
- /** Full processing result. Null until processing completes. */
483
523
  result: DocumentProcessingResult<TSchema> | null;
484
524
  files: DocumentProcessingFile[];
485
525
  }
@@ -501,11 +541,6 @@ export interface DocumentProcessingDeleteResponse {
501
541
  success: boolean;
502
542
  message: string;
503
543
  }
504
- /**
505
- * Processor descriptor returned by `GET /document-processing/processors`.
506
- * The exact schema isn't published; we narrow `id` to the known enum and
507
- * keep additional fields permissive.
508
- */
509
544
  export interface DocumentProcessorTypeDTO {
510
545
  id: DocumentProcessorId;
511
546
  label?: string;
@@ -520,10 +555,106 @@ export interface DocumentProcessingEvent {
520
555
  instanceId: string;
521
556
  stageId: DocumentProcessingStageId;
522
557
  status: DocumentProcessingStageStatus;
523
- /** ISO 8601 timestamp of the stage transition. */
524
558
  timestamp?: string;
525
559
  error?: string | null;
526
- /** Stage-specific payload, mirrors `DocumentProcessingStageData` when present. */
527
560
  data?: DocumentProcessingStageData | null;
528
561
  }
562
+ /** Media type for uploaded verification artifacts. */
563
+ export type KycMediaType = 'document-front' | 'document-back' | 'liveness-video' | 'random-frame' | 'form-data' | 'signature';
564
+ /** Full session state returned by the customer-facing `GET /api/session/:id`. */
565
+ export interface KycSessionOnboardingState {
566
+ id: string;
567
+ status: string;
568
+ isInvalid: boolean;
569
+ userProgress: {
570
+ checkpoint: string;
571
+ };
572
+ createdAt: number;
573
+ expiresAt: number | null;
574
+ completedAt: number | null;
575
+ currentUser: string | null;
576
+ externalReason: string | null;
577
+ workflowSnapshot: {
578
+ name: string;
579
+ defaultConfig?: Record<string, unknown> | null;
580
+ steps: {
581
+ stepId: string;
582
+ type: string;
583
+ }[];
584
+ };
585
+ flowConfig?: Record<string, unknown> | null;
586
+ stepPreviewData: Record<string, unknown> | null;
587
+ }
588
+ /** Response from `GET /api/session/:id/status` — lightweight polling endpoint. */
589
+ export interface KycSessionStatusResponse {
590
+ currentUser: string | null;
591
+ isInvalid: boolean;
592
+ completedAt: number | null;
593
+ expiresAt: number | null;
594
+ status: string;
595
+ externalReason: string | null;
596
+ }
597
+ /** Response from `GET /api/session/:id/owner`. */
598
+ export interface KycSessionOwnerResponse {
599
+ currentUser: string | null;
600
+ }
601
+ /** Single telemetry event logged to an attempt. */
602
+ export interface KycAttemptEvent {
603
+ eventCategory?: string;
604
+ description?: string;
605
+ eventTimestamp?: number;
606
+ currentState?: string;
607
+ }
608
+ /** A media file associated with an attempt. */
609
+ export interface KycAttemptMedia {
610
+ mediaType: KycMediaType;
611
+ key: string;
612
+ filename: string;
613
+ mimeType: string;
614
+ /** File size in bytes. */
615
+ size: number;
616
+ /** Unix ms when the file was uploaded. */
617
+ uploadedAt: number;
618
+ metadata?: Record<string, unknown>;
619
+ }
620
+ /** Full attempt record returned by `createAttempt()` and `appendEvents()`. */
621
+ export interface KycAttemptOutput {
622
+ id: string;
623
+ createdAt: number;
624
+ events: KycAttemptEvent[];
625
+ media: KycAttemptMedia[];
626
+ endedAt?: number;
627
+ browserId: string;
628
+ linkedId: string;
629
+ requestId: string;
630
+ }
631
+ /** Input for `DossiersKycSession.uploadMedia()`. */
632
+ export interface KycMediaUploadInput {
633
+ /** The file to upload (Blob or File). */
634
+ file: Blob | File;
635
+ /** Type of media artifact being uploaded. */
636
+ mediaType: KycMediaType;
637
+ /** MIME type, e.g. `'image/jpeg'`, `'video/webm'`. */
638
+ mimeType: string;
639
+ /** Filename for the uploaded entry. */
640
+ filename: string;
641
+ /** Document type selected by the user (document collection steps only). */
642
+ selectedDocumentTypeId?: string;
643
+ /** Workflow step ID this upload is associated with. */
644
+ stepId?: string;
645
+ /** Additional capture-quality metadata (e.g. liveness scores). */
646
+ metadata?: Record<string, unknown>;
647
+ }
648
+ /** Response from `POST /api/session/:id/aadhaar/generate-otp`. */
649
+ export interface AadhaarOtpResponse {
650
+ referenceId: string;
651
+ message: string;
652
+ }
653
+ /** Response from `POST /api/session/:id/aadhaar/verify-otp`. */
654
+ export interface AadhaarVerifyResponse {
655
+ status: string;
656
+ name: string;
657
+ gender: string;
658
+ dateOfBirth: string;
659
+ }
529
660
  //# sourceMappingURL=api.d.ts.map