@checktiv/sdk-web 1.9.0 → 1.12.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/README.md +16 -1
- package/dist/agents/AGENTS.md +8 -0
- package/dist/agents/manifest.json +24 -0
- package/dist/capture-ui.d.ts +4 -4
- package/dist/capture-ui.js +7 -6
- package/dist/capture.d.ts +3 -3
- package/dist/capture.js +4 -3
- package/dist/challenge.js +2 -2
- package/dist/chunk-3KEVZCCZ.js +3 -0
- package/dist/chunk-4HIQN4KL.js +3 -0
- package/dist/chunk-C7GRMEYT.js +3 -0
- package/dist/chunk-CAI3JWWU.js +12 -0
- package/dist/chunk-EOTGVXW6.js +7 -0
- package/dist/{chunk-HV2QKVJX.js → chunk-FQSJUWRP.js} +1 -1
- package/dist/{chunk-FL2GCRSI.js → chunk-HWABVMID.js} +4 -4
- package/dist/{chunk-MCYAWMYQ.js → chunk-KYV5BPCD.js} +2 -2
- package/dist/chunk-MLQ2HMTS.js +3 -0
- package/dist/chunk-O3JECGW2.js +3 -0
- package/dist/chunk-PB2THQ3P.js +8 -0
- package/dist/chunk-TKK5CTVG.js +59 -0
- package/dist/chunk-UVTAPUGQ.js +3 -0
- package/dist/chunk-VMWTID63.js +3 -0
- package/dist/{chunk-WC6TLR42.js → chunk-WALPQ6TH.js} +2 -1
- package/dist/chunk-YE2LWN74.js +9 -0
- package/dist/{chunk-XSSM5ZB7.js → chunk-ZU4L3NDZ.js} +1 -1
- package/dist/collect-user-info.d.ts +4 -4
- package/dist/collect-user-info.js +5 -5
- package/dist/{controller-Ta5RgFZ4.d.ts → controller-Dh-rSrot.d.ts} +3 -2
- package/dist/{copy-CEILzVXc.d.ts → copy-Bsb1n1Wv.d.ts} +1 -1
- package/dist/credit-history.d.ts +4 -0
- package/dist/credit-history.js +12 -0
- package/dist/cross-device.js +2 -2
- package/dist/custom-form.css +1 -1
- package/dist/custom-form.d.ts +3 -3
- package/dist/custom-form.js +7 -8
- package/dist/esign/ceremony-runtime.js +7 -0
- package/dist/esign.d.ts +16 -0
- package/dist/esign.js +427 -0
- package/dist/fraud.d.ts +3 -3
- package/dist/fraud.js +5 -6
- package/dist/idv/cross-device.d.ts +7 -7
- package/dist/idv/cross-device.js +4 -5
- package/dist/idv.d.ts +3 -3
- package/dist/idv.js +13 -13
- package/dist/index-CGH7LlPH.d.ts +736 -0
- package/dist/{index-G5mVvjNZ.d.ts → index-CZt19Km4.d.ts} +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -8
- package/dist/{machine-BhPiYmOR.d.ts → machine-EePe2ERe.d.ts} +49 -2
- package/dist/react.d.ts +4 -4
- package/dist/react.js +11 -11
- package/dist/workspace.d.ts +3 -3
- package/dist/workspace.js +2 -1
- package/package.json +35 -9
- package/dist/api-BrQqQbGK.d.ts +0 -342
- package/dist/chunk-523TT3PD.js +0 -7
- package/dist/chunk-7GP5REM7.js +0 -3
- package/dist/chunk-BBO2X73Y.js +0 -9
- package/dist/chunk-GFHNOZVO.js +0 -3
- package/dist/chunk-NHNGQ5BB.js +0 -66
- package/dist/chunk-S2OOEDJS.js +0 -3
- package/dist/chunk-T4R5TTE5.js +0 -7
- package/dist/chunk-WPMO4FQ2.js +0 -13
- package/dist/chunk-XOGHMNBX.js +0 -3
package/dist/api-BrQqQbGK.d.ts
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { C as CaptureLayout, a as CaptureBehaviorMessage, j as SelfiePromptMap, k as SelfieChromeCopy, b as CoachingKind } from './machine-BhPiYmOR.js';
|
|
2
|
-
import { M as MountCopy } from './copy-CEILzVXc.js';
|
|
3
|
-
import { C as CrossDeviceCopy } from './copy-DCeQ4JKx.js';
|
|
4
|
-
|
|
5
|
-
declare const SystemModes: readonly ["live", "test"];
|
|
6
|
-
type SystemMode = (typeof SystemModes)[number];
|
|
7
|
-
declare const DataRegions: readonly ["us", "eu"];
|
|
8
|
-
type DataRegion = (typeof DataRegions)[number];
|
|
9
|
-
|
|
10
|
-
type ChecktivKnownErrorCode = 'origin_not_allowed' | 'token_expired' | 'session_expired' | 'wrong_token_type' | 'protocol_mismatch' | 'camera_denied' | 'camera_policy_blocked' | 'camera_unsupported' | 'cv_gate_failed' | 'upload_failed' | 'submit_failed' | 'sdk_load_failed' | 'biometric_unsupported' | 'isolation_required';
|
|
11
|
-
type ChecktivErrorCode = ChecktivKnownErrorCode | (string & {});
|
|
12
|
-
declare const CHECKTIV_RECOVERY_STRATEGIES: readonly ["retry", "cross_device", "refresh_session", "contact_operator"];
|
|
13
|
-
type ChecktivRecovery = (typeof CHECKTIV_RECOVERY_STRATEGIES)[number];
|
|
14
|
-
interface ChecktivError {
|
|
15
|
-
code: ChecktivErrorCode;
|
|
16
|
-
recoverable: boolean;
|
|
17
|
-
recovery: ChecktivRecovery;
|
|
18
|
-
message: string;
|
|
19
|
-
}
|
|
20
|
-
declare const CHECKTIV_ERROR_CODES: readonly ChecktivKnownErrorCode[];
|
|
21
|
-
declare function createChecktivError(code: ChecktivKnownErrorCode): ChecktivError;
|
|
22
|
-
|
|
23
|
-
interface TokenManager {
|
|
24
|
-
get(): Promise<string>;
|
|
25
|
-
refresh(reason: 'expired' | '401'): Promise<string>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface SyntheticIdvScript {
|
|
29
|
-
injectError?: ChecktivKnownErrorCode;
|
|
30
|
-
stepDelayMs?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type CrossDeviceHandoffHook = () => Promise<{
|
|
34
|
-
kind: 'ok';
|
|
35
|
-
url: string;
|
|
36
|
-
} | {
|
|
37
|
-
kind: 'unavailable';
|
|
38
|
-
}>;
|
|
39
|
-
interface IdvMountOptions {
|
|
40
|
-
target: HTMLElement | string;
|
|
41
|
-
onEvent?: (e: ChecktivIdvEvent) => void;
|
|
42
|
-
copy?: MountCopy;
|
|
43
|
-
layout?: CaptureLayout;
|
|
44
|
-
maxWidth?: string;
|
|
45
|
-
onBeforeSubmit?: () => Promise<void>;
|
|
46
|
-
onBehaviorSegment?: (segment: Pick<CaptureBehaviorMessage, 'steps' | 'traits'>) => void;
|
|
47
|
-
fetchImpl?: typeof fetch;
|
|
48
|
-
synthetic?: SyntheticIdvScript;
|
|
49
|
-
onOpenCrossDevice?: CrossDeviceHandoffHook;
|
|
50
|
-
crossDeviceCopy?: CrossDeviceCopy;
|
|
51
|
-
}
|
|
52
|
-
interface IdvHandle {
|
|
53
|
-
destroy(): void;
|
|
54
|
-
unmount(): void;
|
|
55
|
-
openCrossDevice?(): void;
|
|
56
|
-
}
|
|
57
|
-
declare const REMINT_READY_TIMEOUT_MS = 15000;
|
|
58
|
-
declare function createIdv(ctx: SubstrateContext, opts: IdvMountOptions): IdvHandle;
|
|
59
|
-
|
|
60
|
-
declare const FORM_FIELD_TYPES: readonly ["short_text", "long_text", "number", "email", "phone", "date", "single_select", "multi_select", "boolean", "file_upload", "content_heading", "content_paragraph"];
|
|
61
|
-
type FormFieldType = (typeof FORM_FIELD_TYPES)[number];
|
|
62
|
-
|
|
63
|
-
type CustomFormApplicantLabel = Record<string, string>;
|
|
64
|
-
interface CustomFormApplicantFieldValidation {
|
|
65
|
-
minLength?: number;
|
|
66
|
-
maxLength?: number;
|
|
67
|
-
min?: number;
|
|
68
|
-
max?: number;
|
|
69
|
-
minSelections?: number;
|
|
70
|
-
maxSelections?: number;
|
|
71
|
-
}
|
|
72
|
-
interface CustomFormApplicantFieldOption {
|
|
73
|
-
value: string;
|
|
74
|
-
label: CustomFormApplicantLabel;
|
|
75
|
-
}
|
|
76
|
-
interface CustomFormApplicantField {
|
|
77
|
-
id: string;
|
|
78
|
-
type: FormFieldType;
|
|
79
|
-
label: CustomFormApplicantLabel;
|
|
80
|
-
helpText?: CustomFormApplicantLabel;
|
|
81
|
-
required: boolean;
|
|
82
|
-
validation?: CustomFormApplicantFieldValidation;
|
|
83
|
-
options?: CustomFormApplicantFieldOption[];
|
|
84
|
-
}
|
|
85
|
-
type CustomFormApplicantConfig = {
|
|
86
|
-
supportedLocales: string[];
|
|
87
|
-
fields: CustomFormApplicantField[];
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
interface CustomFormFieldCopy {
|
|
91
|
-
readonly label?: string;
|
|
92
|
-
readonly helpText?: string;
|
|
93
|
-
readonly options?: Readonly<Record<string, string>>;
|
|
94
|
-
}
|
|
95
|
-
interface CustomFormCopy {
|
|
96
|
-
readonly fields?: Readonly<Record<string, CustomFormFieldCopy>>;
|
|
97
|
-
readonly submit?: string;
|
|
98
|
-
readonly requiredError?: string;
|
|
99
|
-
readonly invalidPhoneError?: string;
|
|
100
|
-
readonly invalidEmailError?: string;
|
|
101
|
-
readonly invalidDateError?: string;
|
|
102
|
-
readonly invalidOptionError?: string;
|
|
103
|
-
readonly outOfRangeError?: string;
|
|
104
|
-
readonly invalidFormatError?: string;
|
|
105
|
-
readonly invalidError?: string;
|
|
106
|
-
readonly validationError?: string;
|
|
107
|
-
readonly uploadError?: string;
|
|
108
|
-
readonly submitError?: string;
|
|
109
|
-
readonly booleanYes?: string;
|
|
110
|
-
readonly booleanNo?: string;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
type ChecktivCustomFormEvent = {
|
|
114
|
-
type: 'checktiv.custom_form.ready';
|
|
115
|
-
} | {
|
|
116
|
-
type: 'checktiv.custom_form.submitted';
|
|
117
|
-
sessionId: string;
|
|
118
|
-
} | {
|
|
119
|
-
type: 'checktiv.custom_form.error';
|
|
120
|
-
error: ChecktivError;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
interface CustomFormMountOptions {
|
|
124
|
-
target: HTMLElement | string;
|
|
125
|
-
config: CustomFormApplicantConfig;
|
|
126
|
-
copy?: CustomFormCopy;
|
|
127
|
-
onEvent?: (e: ChecktivCustomFormEvent) => void;
|
|
128
|
-
session?: {
|
|
129
|
-
sessionId: string;
|
|
130
|
-
stepId: string;
|
|
131
|
-
};
|
|
132
|
-
fetchImpl?: typeof fetch;
|
|
133
|
-
preview?: boolean;
|
|
134
|
-
}
|
|
135
|
-
interface CustomFormHandle {
|
|
136
|
-
destroy(): void;
|
|
137
|
-
}
|
|
138
|
-
declare function createCustomForm(ctx: SubstrateContext, opts: CustomFormMountOptions): CustomFormHandle;
|
|
139
|
-
|
|
140
|
-
interface ProvisionedHandle {
|
|
141
|
-
destroy(): void;
|
|
142
|
-
openCrossDevice?(): void;
|
|
143
|
-
}
|
|
144
|
-
interface MountProvisionedOptions {
|
|
145
|
-
target: HTMLElement | string;
|
|
146
|
-
onEvent?: (e: ChecktivEvent) => void;
|
|
147
|
-
onConsent?: () => boolean | Promise<boolean>;
|
|
148
|
-
copy?: MountCopy;
|
|
149
|
-
layout?: CaptureLayout;
|
|
150
|
-
maxWidth?: string;
|
|
151
|
-
onBeforeSubmit?: () => Promise<void>;
|
|
152
|
-
onBehaviorSegment?: (segment: Pick<CaptureBehaviorMessage, 'steps' | 'traits'>) => void;
|
|
153
|
-
fetchImpl?: typeof fetch;
|
|
154
|
-
synthetic?: IdvMountOptions['synthetic'];
|
|
155
|
-
customFormConfig?: CustomFormApplicantConfig;
|
|
156
|
-
customFormCopy?: CustomFormCopy;
|
|
157
|
-
crossDeviceCopy?: CrossDeviceCopy;
|
|
158
|
-
onOpenCrossDevice?: CrossDeviceHandoffHook;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface GetSessionTokenContext {
|
|
162
|
-
sessionId: string;
|
|
163
|
-
reason: 'initial' | 'expired' | '401';
|
|
164
|
-
}
|
|
165
|
-
type GetSessionToken = string | ((ctx: GetSessionTokenContext) => Promise<string>);
|
|
166
|
-
interface ChecktivInitOptionsBase {
|
|
167
|
-
getSessionToken: GetSessionToken;
|
|
168
|
-
theme?: {
|
|
169
|
-
primaryColor?: string;
|
|
170
|
-
};
|
|
171
|
-
locale?: string;
|
|
172
|
-
apiBase?: string;
|
|
173
|
-
betas?: string[];
|
|
174
|
-
selfiePromptMap?: SelfiePromptMap;
|
|
175
|
-
selfieChromeCopy?: SelfieChromeCopy;
|
|
176
|
-
}
|
|
177
|
-
type ChecktivInitScope = {
|
|
178
|
-
publishableKey: string;
|
|
179
|
-
} | {
|
|
180
|
-
region: SdkRegion;
|
|
181
|
-
mode: SdkMode;
|
|
182
|
-
};
|
|
183
|
-
type ChecktivInitOptions = ChecktivInitOptionsBase & ChecktivInitScope;
|
|
184
|
-
interface ChecktivClient {
|
|
185
|
-
mountProvisioned(opts: MountProvisionedOptions): ProvisionedHandle;
|
|
186
|
-
mount(module: 'idv', opts: IdvMountOptions): IdvHandle;
|
|
187
|
-
mount(module: 'fraud', opts: FraudMountOptions): FraudHandle;
|
|
188
|
-
mount(module: 'custom_form', opts: CustomFormMountOptions): CustomFormHandle;
|
|
189
|
-
}
|
|
190
|
-
interface SubstrateContext {
|
|
191
|
-
readonly region: SdkRegion;
|
|
192
|
-
readonly mode: SdkMode;
|
|
193
|
-
readonly publishableKey: string | undefined;
|
|
194
|
-
readonly apiBaseOrigin: string;
|
|
195
|
-
readonly theme?: ChecktivInitOptions['theme'];
|
|
196
|
-
readonly locale: string;
|
|
197
|
-
readonly betas: readonly string[];
|
|
198
|
-
readonly selfiePromptMap?: SelfiePromptMap;
|
|
199
|
-
readonly selfieChromeCopy?: SelfieChromeCopy;
|
|
200
|
-
readonly tokens: TokenManager;
|
|
201
|
-
getSessionId(): string;
|
|
202
|
-
setSessionId(id: string): void;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
type ChecktivFraudEvent = {
|
|
206
|
-
type: 'checktiv.fraud.started';
|
|
207
|
-
} | {
|
|
208
|
-
type: 'checktiv.fraud.error';
|
|
209
|
-
error: ChecktivError;
|
|
210
|
-
};
|
|
211
|
-
interface FraudMountOptions {
|
|
212
|
-
onConsent: () => boolean | Promise<boolean>;
|
|
213
|
-
onEvent?: (e: ChecktivFraudEvent) => void;
|
|
214
|
-
fetchImpl?: typeof fetch;
|
|
215
|
-
}
|
|
216
|
-
interface FraudHandle {
|
|
217
|
-
destroy(): void;
|
|
218
|
-
}
|
|
219
|
-
declare function createFraud(ctx: SubstrateContext, opts: FraudMountOptions): FraudHandle;
|
|
220
|
-
|
|
221
|
-
type IdvCoachingHint = CoachingKind;
|
|
222
|
-
interface ResolvedIdvConfig {
|
|
223
|
-
documentTypes: readonly string[];
|
|
224
|
-
biometricMode: 'selfie' | 'liveness' | 'none';
|
|
225
|
-
}
|
|
226
|
-
type ChecktivIdvEvent = {
|
|
227
|
-
type: 'checktiv.idv.ready';
|
|
228
|
-
config: ResolvedIdvConfig;
|
|
229
|
-
} | {
|
|
230
|
-
type: 'checktiv.idv.phase';
|
|
231
|
-
phase: string;
|
|
232
|
-
} | {
|
|
233
|
-
type: 'checktiv.idv.coaching';
|
|
234
|
-
hint: IdvCoachingHint;
|
|
235
|
-
} | {
|
|
236
|
-
type: 'checktiv.idv.submitted';
|
|
237
|
-
sessionId: string;
|
|
238
|
-
} | {
|
|
239
|
-
type: 'checktiv.idv.processing';
|
|
240
|
-
reason?: 'signal_pending' | 'no_renderable_step';
|
|
241
|
-
} | {
|
|
242
|
-
type: 'checktiv.idv.capture_superseded';
|
|
243
|
-
} | {
|
|
244
|
-
type: 'checktiv.idv.error';
|
|
245
|
-
error: ChecktivError;
|
|
246
|
-
} | {
|
|
247
|
-
type: 'checktiv.idv.cross_device_opened';
|
|
248
|
-
} | {
|
|
249
|
-
type: 'checktiv.idv.cross_device_unavailable';
|
|
250
|
-
} | {
|
|
251
|
-
type: 'checktiv.idv.cross_device_capped';
|
|
252
|
-
} | {
|
|
253
|
-
type: 'checktiv.idv.cross_device_closed';
|
|
254
|
-
};
|
|
255
|
-
type ChecktivEvent = ChecktivIdvEvent | ChecktivFraudEvent | {
|
|
256
|
-
type: `checktiv.${string}`;
|
|
257
|
-
[k: string]: unknown;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
type SdkRegion = DataRegion;
|
|
261
|
-
type SdkMode = SystemMode;
|
|
262
|
-
interface InitOptions {
|
|
263
|
-
readonly publishableKey: string;
|
|
264
|
-
readonly applicantLinkToken?: string;
|
|
265
|
-
readonly target?: HTMLElement;
|
|
266
|
-
readonly onComplete?: (payload: unknown) => void;
|
|
267
|
-
}
|
|
268
|
-
interface MountCompleteResult {
|
|
269
|
-
readonly sessionId: string;
|
|
270
|
-
}
|
|
271
|
-
type MountScope = {
|
|
272
|
-
readonly publishableKey: string;
|
|
273
|
-
} | {
|
|
274
|
-
readonly region: SdkRegion;
|
|
275
|
-
readonly mode: SdkMode;
|
|
276
|
-
};
|
|
277
|
-
type MountOptions = MountScope & {
|
|
278
|
-
readonly fetchToken: () => Promise<string>;
|
|
279
|
-
readonly onComplete?: (result: MountCompleteResult) => void;
|
|
280
|
-
readonly onEvent?: (e: ChecktivEvent) => void;
|
|
281
|
-
readonly onError?: (e: ChecktivError) => void;
|
|
282
|
-
readonly onConsent?: () => boolean | Promise<boolean>;
|
|
283
|
-
readonly apiBase?: string;
|
|
284
|
-
readonly fetchImpl?: typeof fetch;
|
|
285
|
-
readonly resumeKey?: string;
|
|
286
|
-
readonly shortCode?: string;
|
|
287
|
-
readonly layout?: CaptureLayout;
|
|
288
|
-
readonly maxWidth?: string;
|
|
289
|
-
readonly theme?: {
|
|
290
|
-
readonly primaryColor?: string;
|
|
291
|
-
};
|
|
292
|
-
readonly copy?: MountCopy;
|
|
293
|
-
readonly crossDeviceCopy?: CrossDeviceCopy;
|
|
294
|
-
readonly onOpenCrossDevice?: CrossDeviceHandoffHook;
|
|
295
|
-
};
|
|
296
|
-
interface SessionsCreateApplicantAddress {
|
|
297
|
-
readonly line1: string;
|
|
298
|
-
readonly line2?: string;
|
|
299
|
-
readonly city: string;
|
|
300
|
-
readonly region?: string;
|
|
301
|
-
readonly postalCode?: string;
|
|
302
|
-
readonly country: string;
|
|
303
|
-
readonly placeId?: string;
|
|
304
|
-
readonly formatted?: string;
|
|
305
|
-
}
|
|
306
|
-
interface SessionsCreateApplicant {
|
|
307
|
-
readonly externalId?: string;
|
|
308
|
-
readonly email?: string;
|
|
309
|
-
readonly phone?: string;
|
|
310
|
-
readonly familyName?: string;
|
|
311
|
-
readonly givenNames?: readonly string[];
|
|
312
|
-
readonly nameSuffix?: string;
|
|
313
|
-
readonly dateOfBirth?: string;
|
|
314
|
-
readonly address?: SessionsCreateApplicantAddress;
|
|
315
|
-
readonly referenceName?: string;
|
|
316
|
-
}
|
|
317
|
-
interface SessionsCreateInput {
|
|
318
|
-
readonly templateId: string;
|
|
319
|
-
readonly applicant: SessionsCreateApplicant;
|
|
320
|
-
}
|
|
321
|
-
interface SessionsCreateOptions {
|
|
322
|
-
readonly apiBase: string;
|
|
323
|
-
readonly secretKey: string;
|
|
324
|
-
readonly idempotencyKey?: string;
|
|
325
|
-
readonly fetchImpl?: typeof fetch;
|
|
326
|
-
}
|
|
327
|
-
interface SessionsCreateResult {
|
|
328
|
-
readonly clientToken: string;
|
|
329
|
-
}
|
|
330
|
-
interface ChecktivSessions {
|
|
331
|
-
create(input: SessionsCreateInput, options: SessionsCreateOptions): Promise<SessionsCreateResult>;
|
|
332
|
-
}
|
|
333
|
-
interface ParsedPublishableKey {
|
|
334
|
-
readonly region: SdkRegion;
|
|
335
|
-
readonly mode: SdkMode;
|
|
336
|
-
}
|
|
337
|
-
declare class InvalidPublishableKeyError extends Error {
|
|
338
|
-
constructor(message: string);
|
|
339
|
-
}
|
|
340
|
-
declare function parsePublishableKey(key: string): ParsedPublishableKey;
|
|
341
|
-
|
|
342
|
-
export { type SessionsCreateResult as A, type SyntheticIdvScript as B, type ChecktivInitOptions as C, createChecktivError as D, parsePublishableKey as E, type FraudHandle as F, type GetSessionToken as G, type ChecktivInitScope as H, type InitOptions as I, type SubstrateContext as J, REMINT_READY_TIMEOUT_MS as K, createIdv as L, type MountOptions as M, type ChecktivCustomFormEvent as N, type CustomFormCopy as O, type ProvisionedHandle as P, type CustomFormFieldCopy as Q, type ResolvedIdvConfig as R, type SdkRegion as S, type TokenManager as T, type CustomFormHandle as U, type CustomFormMountOptions as V, createCustomForm as W, createFraud as X, type ChecktivClient as a, type ChecktivSessions as b, CHECKTIV_ERROR_CODES as c, type ChecktivError as d, type ChecktivErrorCode as e, type ChecktivEvent as f, type ChecktivFraudEvent as g, type ChecktivIdvEvent as h, type ChecktivKnownErrorCode as i, type ChecktivRecovery as j, type CrossDeviceHandoffHook as k, type FraudMountOptions as l, type GetSessionTokenContext as m, type IdvCoachingHint as n, type IdvHandle as o, type IdvMountOptions as p, InvalidPublishableKeyError as q, type MountCompleteResult as r, type MountProvisionedOptions as s, type MountScope as t, type ParsedPublishableKey as u, type SdkMode as v, type SessionsCreateApplicant as w, type SessionsCreateApplicantAddress as x, type SessionsCreateInput as y, type SessionsCreateOptions as z };
|
package/dist/chunk-523TT3PD.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { withTokenRetry } from './chunk-S2OOEDJS.js';
|
|
2
|
-
import { sdkPublicSettings, SESSIONS_ME_PATH, dataPlaneHeaders } from './chunk-HFQJYEGZ.js';
|
|
3
|
-
import { IDV_DOCUMENT_TYPES } from './chunk-IQKHRPJR.js';
|
|
4
|
-
|
|
5
|
-
var SDK_MODULES=["idv","fraud","custom_form"];var BIOMETRIC_MODES=["none","selfie","liveness"];var DOCUMENT_TYPES=IDV_DOCUMENT_TYPES;var SDK_MODES=["live","test"];var DATA_REGIONS=Object.keys(sdkPublicSettings.regions);var COLLECT_USER_INFO_FIELD_VALUES=["email","phone","dob","address"];var COLLECT_USER_INFO_NAME_COMPONENTS_VALUES=["required","requested","optional"];function isRecord(v){return typeof v==="object"&&v!==null}function isNonEmptyString(v){return typeof v==="string"&&v.length>0}function isSdkModule(v){return typeof v==="string"&&SDK_MODULES.includes(v)}function isBiometricMode(v){return typeof v==="string"&&BIOMETRIC_MODES.includes(v)}function isSdkMode(v){return typeof v==="string"&&SDK_MODES.includes(v)}function isSdkRegion(v){return typeof v==="string"&&DATA_REGIONS.includes(v)}function isDocumentType(v){return typeof v==="string"&&DOCUMENT_TYPES.includes(v)}function isCollectUserInfoField(v){return typeof v==="string"&&COLLECT_USER_INFO_FIELD_VALUES.includes(v)}function isNameComponents(v){return typeof v==="string"&&COLLECT_USER_INFO_NAME_COMPONENTS_VALUES.includes(v)}function parseCollectUserInfoConfig(value){if(!isRecord(value))return null;const fields=value.fields;const captureStructuredName=value.capture_structured_name;const nameComponents=value.name_components;if(!Array.isArray(fields))return null;const parsedFields=[];for(const f of fields){if(!isCollectUserInfoField(f))return null;parsedFields.push(f);}if(typeof captureStructuredName!=="boolean")return null;if(!isNameComponents(nameComponents))return null;return {fields:parsedFields,nameComponents,captureStructuredName}}function parseIdvConfig(value){if(!isRecord(value))return null;const documentTypes=value.document_types;const biometricMode=value.biometric_mode;const minAge=value.min_age;if(!Array.isArray(documentTypes)||documentTypes.length<1)return null;const types=[];for(const t of documentTypes){if(!isDocumentType(t))return null;types.push(t);}if(!isBiometricMode(biometricMode))return null;if(minAge!==void 0&&typeof minAge!=="number")return null;const config={documentTypes:types,biometricMode};if(typeof minAge==="number")config.minAge=minAge;return config}function parseSessionData(body){if(!isRecord(body)||!isRecord(body.data))return null;const d=body.data;const sessionId=d.session_id;const stepId=d.step_id;const stepType=d.step_type;if(!isNonEmptyString(sessionId)||!isNonEmptyString(stepId)||!isNonEmptyString(stepType)||!isSdkMode(d.mode)||!isSdkRegion(d.region)){return null}if(!Array.isArray(d.modules)||!d.modules.every(isSdkModule))return null;const modules=d.modules;const wantsIdv=stepType==="id_verification";let config=null;if(wantsIdv){config=parseIdvConfig(d.config);if(config===null)return null}const collectUserInfoConfig=stepType==="collect_user_info"?parseCollectUserInfoConfig(d.config)??void 0:void 0;return {sessionId,stepId,stepType,config,mode:d.mode,region:d.region,modules,...collectUserInfoConfig!==void 0?{collectUserInfoConfig}:{}}}function isJourneyPlaneBody(body){if(!isRecord(body)||!isRecord(body.data))return false;const d=body.data;if("session_id"in d)return false;return isRecord(d.session)||isRecord(d.snapshot)}function isNonRenderableMarker(body){if(!isRecord(body)||!isRecord(body.data))return false;return body.data.renderable===false}function warnWrongTokenPlane(){console.warn("[Checktiv] The session token reached the wrong data plane. For the zero-lifecycle APIs (Checktiv.mount() or collectUserInfo), fetchToken must return your durable client token, which the SDK exchanges for a working token. For a customer-embed Checktiv.init(), getSessionToken must return a browser token.");}async function resolveSession(ctx,fetchImpl){const origin=ctx.apiBaseOrigin;let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(origin+SESSIONS_ME_PATH,{method:"GET",headers:dataPlaneHeaders(ctx,token)}),result=>result?.status===401);}catch{return {kind:"unresolved"}}if(!res.ok)return {kind:"unresolved"};let body;try{body=await res.json();}catch{return {kind:"unresolved"}}if(isNonRenderableMarker(body))return {kind:"nothing_to_render"};const data=parseSessionData(body);if(data!==null){ctx.setSessionId(data.sessionId);return {kind:"ok",session:data}}if(isJourneyPlaneBody(body))return {kind:"wrong_token"};return {kind:"unresolved"}}
|
|
6
|
-
|
|
7
|
-
export { isJourneyPlaneBody, isRecord, resolveSession, warnWrongTokenPlane };
|
package/dist/chunk-7GP5REM7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var CHECKTIV_RECOVERY_STRATEGIES=["retry","cross_device","refresh_session","contact_operator"];var ERROR_TABLE={origin_not_allowed:{recoverable:false,recovery:"contact_operator",message:"This origin is not allowed for the publishable key. Add it to the allowed origins list in the Checktiv console."},token_expired:{recoverable:true,recovery:"retry",message:"The session token expired. The SDK is refreshing it; if this persists, mint a new token from your backend."},session_expired:{recoverable:false,recovery:"refresh_session",message:"The verification session is no longer valid. Start a new verification from your backend."},wrong_token_type:{recoverable:false,recovery:"contact_operator",message:"This verification could not start. Contact the site operator."},protocol_mismatch:{recoverable:false,recovery:"contact_operator",message:"The SDK version is out of date. Update to the latest published version."},camera_denied:{recoverable:true,recovery:"cross_device",message:"Camera access was blocked. Allow camera access, or continue on another device."},camera_policy_blocked:{recoverable:false,recovery:"contact_operator",message:"This page does not allow camera access. Contact the site operator."},camera_unsupported:{recoverable:true,recovery:"cross_device",message:"Your camera does not meet the minimum resolution needed for capture. Try another device, or continue on your phone."},cv_gate_failed:{recoverable:true,recovery:"retry",message:"We could not read the image clearly. Try again with better lighting and a steady hand."},upload_failed:{recoverable:true,recovery:"retry",message:"The upload did not complete. Check the connection and try again."},submit_failed:{recoverable:true,recovery:"retry",message:"The submission did not complete. Your captured images are saved. Check the connection and try again."},sdk_load_failed:{recoverable:true,recovery:"cross_device",message:"Verification could not start on this device. Try again, or continue on another device."},biometric_unsupported:{recoverable:false,recovery:"contact_operator",message:"This capture is not supported on this page. Contact the site operator."},isolation_required:{recoverable:false,recovery:"contact_operator",message:"This page configuration is not supported. Contact the site operator."}};var CHECKTIV_ERROR_CODES=Object.keys(ERROR_TABLE).filter(key=>key in ERROR_TABLE);function createChecktivError(code){const entry=ERROR_TABLE[code];return {code,...entry}}function mapHttpStatusToError(status){if(status===401)return "token_expired";if(status===403)return "origin_not_allowed";if(status===429)return "upload_failed";if(status>=500)return "upload_failed";return "session_expired"}function isChecktivErrorCode(value){return CHECKTIV_ERROR_CODES.some(code=>code===value)}function isChecktivRecovery(value){return CHECKTIV_RECOVERY_STRATEGIES.some(recovery=>recovery===value)}function isChecktivError(value){if(typeof value!=="object"||value===null)return false;if(!("code"in value)||!("message"in value)||!("recoverable"in value)||!("recovery"in value)){return false}const{code,message,recoverable,recovery}=value;return typeof code==="string"&&isChecktivErrorCode(code)&&typeof message==="string"&&typeof recoverable==="boolean"&&typeof recovery==="string"&&isChecktivRecovery(recovery)}
|
|
2
|
-
|
|
3
|
-
export { CHECKTIV_ERROR_CODES, createChecktivError, isChecktivError, mapHttpStatusToError };
|
package/dist/chunk-BBO2X73Y.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { parsePublishableKey, createWorkingTokenSource, createWorkingTokenManager } from './chunk-WC6TLR42.js';
|
|
2
|
-
import { resolveSession, warnWrongTokenPlane } from './chunk-523TT3PD.js';
|
|
3
|
-
import { assertNever } from './chunk-UBQTPS5J.js';
|
|
4
|
-
import { withTokenRetry } from './chunk-S2OOEDJS.js';
|
|
5
|
-
import { stepSubmitPath, dataPlaneHeaders, resolveApiBaseOrigin } from './chunk-HFQJYEGZ.js';
|
|
6
|
-
|
|
7
|
-
var NAME_COMPONENTS_REQUIRED_ERROR_CODE="name_components_required";var ERROR_MESSAGES={not_collect_step:"The current step does not collect user info. Mount the verification journey to continue.",validation_failed:"The submitted information was rejected. Check the required fields and try again.",[NAME_COMPONENTS_REQUIRED_ERROR_CODE]:"This verification needs the name in separate parts. Enter the family name and the given names, then try again.",token_expired:"The verification session expired. Create a new session so fetchToken returns a fresh client token, then try again.",origin_not_allowed:"This origin is not allowed for the publishable key. Add it to the allowed origins list in the Checktiv console.",rate_limited:"Too many requests. Wait a moment and try again.",service_unavailable:"The service is temporarily unavailable. Try again in a few seconds.",session_expired:"The verification session is no longer valid. Start a new verification from your backend.",wrong_token_type:"This verification could not start. Make sure fetchToken returns the client token, the same one you pass to Checktiv.mount().",network_error:"The request could not be completed. Check the connection and try again."};function fail(code){return {ok:false,code,message:ERROR_MESSAGES[code]}}function mapSubmitStatus(status){if(status===400||status===422)return "validation_failed";if(status===401)return "token_expired";if(status===403)return "origin_not_allowed";if(status===404)return "session_expired";if(status===429)return "rate_limited";if(status>=500)return "service_unavailable";return "session_expired"}async function mapSubmitFailure(res){const fallback=mapSubmitStatus(res.status);if(res.status!==400&&res.status!==422)return fallback;let body;try{body=await res.json();}catch{return fallback}if(typeof body!=="object"||body===null)return fallback;const error=body.error;if(typeof error!=="object"||error===null)return fallback;const code=error.code;return code===NAME_COMPONENTS_REQUIRED_ERROR_CODE?NAME_COMPONENTS_REQUIRED_ERROR_CODE:fallback}var WIRE_KEYS=["legalName","familyName","givenNames","nameSuffix","email","phone","dateOfBirth","address"];var IDENTIFIER_KEY=/^[A-Za-z_$][\w$]{0,39}$/;function buildSubmitBody(input){const body={};for(const key of WIRE_KEYS){const value=input[key];if(value!==void 0)body[key]=value;}const dropped=Object.keys(input).filter(key=>!WIRE_KEYS.some(wire=>wire===key));if(dropped.length>0){const safe=dropped.filter(key=>IDENTIFIER_KEY.test(key)).join(", ");console.warn(`[Checktiv] collectUserInfo dropped ${dropped.length} unknown key(s)${safe&&`: ${safe}`}. Known: ${WIRE_KEYS.join(", ")}.`);}return body}function buildContext(session,fetchImpl){const scope="publishableKey"in session?{...parsePublishableKey(session.publishableKey),publishableKey:session.publishableKey}:{region:session.region,mode:session.mode,publishableKey:void 0};const apiBaseOrigin=resolveApiBaseOrigin(session.apiBase,scope.region,scope.mode);let clientTokenPromise=null;const getClientToken=()=>{if(clientTokenPromise!==null)return clientTokenPromise;const p=session.fetchToken();clientTokenPromise=p;void p.catch(()=>{if(clientTokenPromise===p)clientTokenPromise=null;});return p};const mintWorkingToken=createWorkingTokenSource(apiBaseOrigin,getClientToken,scope.publishableKey,fetchImpl);const tokens=createWorkingTokenManager(mintWorkingToken);let sessionId="";const ctx={region:scope.region,mode:scope.mode,publishableKey:scope.publishableKey,apiBaseOrigin,locale:"en",betas:[],tokens,getSessionId:()=>sessionId,setSessionId:id=>{sessionId=id;}};return {ctx,tokens}}function collectUserInfo(opts){const{session}=opts;const fetchImpl=session.fetchImpl??fetch;const{ctx,tokens}=buildContext(session,fetchImpl);return {async submit(input){try{const resolution=await resolveSession(ctx,fetchImpl);switch(resolution.kind){case "wrong_token":warnWrongTokenPlane();return fail("wrong_token_type");case "unresolved":return fail("session_expired");case "nothing_to_render":return fail("not_collect_step");case "ok":break;default:return assertNever(resolution)}const resolved=resolution.session;if(resolved.stepType!=="collect_user_info"){return fail("not_collect_step")}const body=buildSubmitBody(input);let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(ctx.apiBaseOrigin+stepSubmitPath(resolved.sessionId,resolved.stepId),{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify(body)}),result=>result?.status===401);}catch{return fail("network_error")}if(res.ok)return {ok:true};return fail(await mapSubmitFailure(res))}finally{tokens.stop();}},async describe(){const fresh=buildContext(session,fetchImpl);try{const resolution=await resolveSession(fresh.ctx,fetchImpl);switch(resolution.kind){case "wrong_token":warnWrongTokenPlane();return {ok:false,code:"wrong_token_type"};case "unresolved":return {ok:false,code:"session_expired"};case "nothing_to_render":return {ok:false,code:"not_collect_step"};case "ok":break;default:return assertNever(resolution)}const resolved=resolution.session;if(resolved.stepType!=="collect_user_info"){return {ok:false,code:"not_collect_step"}}const config=resolved.collectUserInfoConfig;if(config===void 0){return {ok:true,fields:[],nameComponents:"requested",captureStructuredName:false}}return {ok:true,fields:config.fields,nameComponents:config.nameComponents,captureStructuredName:config.captureStructuredName}}finally{fresh.tokens.stop();}}}}
|
|
8
|
-
|
|
9
|
-
export { collectUserInfo };
|
package/dist/chunk-GFHNOZVO.js
DELETED