@incodetech/core 2.4.1-agentic.2 → 2.4.1-agentic.3
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/dist/{FaceDetectionProvider-D9PlON49.esm.js → FaceDetectionProvider-CV1N6-wL.esm.js} +4 -4
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-gNfsp99I.esm.js → apiError-Cp00d-5I.esm.js} +1 -1
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-BtN4CHOR.esm.js → authenticationManager-Dydkvex4.esm.js} +3 -3
- package/dist/{authenticationStateMachine-DdcnWnBT.esm.js → authenticationStateMachine-B952RLuf.esm.js} +2 -2
- package/dist/certificate-issuance.esm.js +2 -2
- package/dist/{certificateIssuanceManager-C1nETQos.esm.js → certificateIssuanceManager-IRO_1Ug6.esm.js} +1 -1
- package/dist/{certificateIssuanceStateMachine-DThXMDqr.esm.js → certificateIssuanceStateMachine-CjxTBZuH.esm.js} +1 -1
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-bjfVXO7p.d.ts → consentManager-_q9yJUku.d.ts} +9 -9
- package/dist/{deepsightLoader-Crsj_u0c.esm.js → deepsightLoader-CeliAqIy.esm.js} +3 -3
- package/dist/document-capture.d.ts +1 -1
- package/dist/{documentCaptureManager-DDfviFg0.d.ts → documentCaptureManager-CD5iQiUI.d.ts} +1 -1
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-CwqgwLa5.esm.js → dynamicFormsManager-Br2x_hfQ.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-CBdnpD95.esm.js → dynamicFormsStateMachine-Dt7h3yOZ.esm.js} +1 -1
- package/dist/ekyb.esm.js +2 -2
- package/dist/{ekybManager-BVTqTHd3.esm.js → ekybManager-bpbuBguD.esm.js} +1 -1
- package/dist/{ekybStateMachine-BmZHuZE1.esm.js → ekybStateMachine-CkqT0Un2.esm.js} +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-Bt_tCIdI.esm.js → electronicSignatureManager-qCul2Oix.esm.js} +2 -2
- package/dist/extensibility.d.ts +4 -4
- package/dist/extensibility.esm.js +13 -13
- package/dist/{externalFetch-CQY41QT1.esm.js → externalFetch-cUjJYyXj.esm.js} +1 -1
- package/dist/{faceCaptureManagerFactory-BWOB3ZeZ.esm.js → faceCaptureManagerFactory-CAUH7R1T.esm.js} +1 -1
- package/dist/{faceCaptureSetup-D0w1UBlO.esm.js → faceCaptureSetup-DimauotJ.esm.js} +3 -3
- package/dist/{feature-management-DBh1nqp8.esm.js → feature-management-CvdrPdpa.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-Dv7zoVWe.esm.js → flowCompletionService-BUv4Reay.esm.js} +1 -1
- package/dist/{flowServices-C5-oamoC.esm.js → flowServices-CeSh3IZR.esm.js} +4 -4
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-BFTxgOZG.esm.js → geolocationManager-D1gQ5fwB.esm.js} +1 -1
- package/dist/{geolocationStateMachine-v729Lz_0.esm.js → geolocationStateMachine-CVJaQ3ec.esm.js} +1 -1
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-selfie-flow.esm.js +6 -6
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureManager-BVfqpIjM.esm.js → idCaptureManager-BqVaQpfJ.esm.js} +3 -3
- package/dist/{idCaptureServices-CwG9Xp_n.esm.js → idCaptureServices-DUw2flBX.esm.js} +2 -2
- package/dist/{idCaptureStateMachine-DUm3a_Mt.esm.js → idCaptureStateMachine-hI7mQYWl.esm.js} +9 -9
- package/dist/{idOcrManager-BTdHlJ9D.d.ts → idOcrManager-DT3kPIB3.d.ts} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/kyb-checks.esm.js +2 -2
- package/dist/{kybChecksManager-D2BEaUzK.esm.js → kybChecksManager-D99QhLQ4.esm.js} +1 -1
- package/dist/{kybChecksStateMachine-Cy-MsmKZ.esm.js → kybChecksStateMachine-BY_36-hd.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +1 -1
- package/dist/{mandatoryConsentManager-B88Sm5nd.d.ts → mandatoryConsentManager-CNDoNxm3.d.ts} +5 -5
- package/dist/qe-signature.esm.js +1 -1
- package/dist/redirect-to-mobile.esm.js +2 -2
- package/dist/{redirectToMobileManager-CgGaT2NP.esm.js → redirectToMobileManager-CCSNyi19.esm.js} +1 -1
- package/dist/{redirectToMobileStateMachine-CbhN8uVN.esm.js → redirectToMobileStateMachine-BKyOdAUe.esm.js} +1 -1
- package/dist/{runChildModule-BG46reQE.esm.js → runChildModule-DY7Gxw3g.esm.js} +1 -1
- package/dist/{sdkVersion-DJCo6uSb.esm.js → sdkVersion-sD_Jpwep.esm.js} +1 -1
- package/dist/selfie.esm.js +6 -6
- package/dist/{selfieErrorUtils-DNbVqz2B.esm.js → selfieErrorUtils-DiUk0Spe.esm.js} +1 -1
- package/dist/{selfieManager-1_TQP4-x.esm.js → selfieManager-BrUM1zP0.esm.js} +3 -3
- package/dist/{selfieStateMachine-BUnZmMRY.esm.js → selfieStateMachine-BzR8y4pn.esm.js} +3 -3
- package/dist/{session-DdnAM9fZ.esm.js → session-CkCdOGrY.esm.js} +3 -3
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-CwJACl13.esm.js → sessionInitializer-DaX5j_g9.esm.js} +4 -4
- package/dist/{setup-D26WdmvA.esm.js → setup-CR-3VM37.esm.js} +5 -5
- package/dist/step-up.d.ts +387 -0
- package/dist/step-up.esm.js +648 -0
- package/dist/{tri-C9SvtzuQ.esm.js → tri-__fK_lJT.esm.js} +1 -1
- package/dist/tri.esm.js +1 -1
- package/dist/{trueSightService-OZl8wQu7.esm.js → trueSightService-C96uqLaj.esm.js} +1 -1
- package/dist/{urlUtils-eYiyWjh0.esm.js → urlUtils-B2wagB5v.esm.js} +14 -1
- package/dist/video-selfie.esm.js +3 -3
- package/dist/{videoSelfieCameraWarmer-Bhi70pSN.esm.js → videoSelfieCameraWarmer-B9FzTNcx.esm.js} +3 -3
- package/dist/wasm.esm.js +1 -1
- package/dist/workflow.esm.js +16 -16
- package/package.json +8 -3
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { t as Manager } from "./Manager-C9T5amUN.js";
|
|
2
|
+
import "./Actor-DpTj5PFb.js";
|
|
3
|
+
import { n as FinishStatus } from "./flowCompletionService-BlAHsKyv.js";
|
|
4
|
+
//#region src/modules/step-up/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* One scope the agent class asks for, as shown on the permissions screen.
|
|
7
|
+
*/
|
|
8
|
+
type StepUpScope = {
|
|
9
|
+
/** Machine name sent back in `approvedScopes`, e.g. `tx.read`. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Human label, e.g. `Read transactions`. Falls back to `name`. */
|
|
12
|
+
displayName: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the permissions screen starts with this scope ticked (contract
|
|
16
|
+
* v0.5). Incode sets it from the agent class: the scope that triggered the
|
|
17
|
+
* step-up and `auto-select` scopes are ticked, `dynamic-select` ones only
|
|
18
|
+
* when suggested; missing means unticked.
|
|
19
|
+
*/
|
|
20
|
+
autoSelect?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* `auto-select`: always part of the approval, so the screen shows it ticked
|
|
23
|
+
* and locked. `dynamic-select`: the person may untick it. Missing reads as
|
|
24
|
+
* `dynamic-select`.
|
|
25
|
+
*/
|
|
26
|
+
selectionMode?: 'auto-select' | 'dynamic-select';
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The permissions block of a step-up, exactly as the Decision API start
|
|
30
|
+
* response returns it (contract v0.2 §6.1: camelCase everywhere).
|
|
31
|
+
*/
|
|
32
|
+
type StepUpPermissions = {
|
|
33
|
+
agentClassId?: string;
|
|
34
|
+
purpose?: string;
|
|
35
|
+
scopes: StepUpScope[];
|
|
36
|
+
/** Limits keyed by scope name; only scopes that have one are listed. */
|
|
37
|
+
limits?: Record<string, StepUpLimit>;
|
|
38
|
+
/**
|
|
39
|
+
* How long the approval lasts, in seconds. The Decision API omits it when it
|
|
40
|
+
* has none; the permissions screen then shows no duration.
|
|
41
|
+
*/
|
|
42
|
+
durationSeconds?: number;
|
|
43
|
+
};
|
|
44
|
+
/** The agent class's limit on one scope. Amounts carry no currency. */
|
|
45
|
+
type StepUpLimit = {
|
|
46
|
+
budgetLimit?: number;
|
|
47
|
+
usageLimit?: number;
|
|
48
|
+
/** What one use is called, e.g. `reads`. */
|
|
49
|
+
usageLimitLabel?: string;
|
|
50
|
+
};
|
|
51
|
+
/** When the SDK's permissions screen shows, relative to the face check. */
|
|
52
|
+
type StepUpPermissionsOrder = 'afterFaceCheck' | 'beforeFaceCheck';
|
|
53
|
+
/**
|
|
54
|
+
* The Decision API's step-up modes: `embedded` runs the workflow in this page,
|
|
55
|
+
* `hosted` frames Incode's hosted page at `onboardingUrl`.
|
|
56
|
+
*/
|
|
57
|
+
type StepUpMode = 'embedded' | 'hosted';
|
|
58
|
+
type StepUpPermissionsUi = 'sdk' | 'none';
|
|
59
|
+
/**
|
|
60
|
+
* What `onFinish` receives. A hint only: the bank server's status read
|
|
61
|
+
* (`GET /step-ups/{id}`) is what checks the face check and activates the
|
|
62
|
+
* mandate.
|
|
63
|
+
*/
|
|
64
|
+
type StepUpResult = {
|
|
65
|
+
stepUpId: string;
|
|
66
|
+
approvedScopes: string[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Error codes on {@link StepUpError.code} (contract v0.2 §6.3). Public API:
|
|
70
|
+
* hosts branch on them.
|
|
71
|
+
*
|
|
72
|
+
* - `INVALID_OPTIONS` — `renderStepUp` was called with bad options (thrown).
|
|
73
|
+
* - `USER_DENIED` — the user pressed Deny on the permissions screen.
|
|
74
|
+
* - `FACE_CHECK_FAILED` — the face check ran and failed: the workflow finished
|
|
75
|
+
* `rejected` or with score `FAIL` / `MANUAL_FAIL`, or the hosted page
|
|
76
|
+
* reported `FACE_CHECK_FAILED`.
|
|
77
|
+
* - `VERIFICATION_PENDING` — the workflow ended without a result yet (async
|
|
78
|
+
* resolution, e.g. manual review), or the hosted page reported
|
|
79
|
+
* `VERIFICATION_PENDING`. The bank server's status read answers `pending`
|
|
80
|
+
* until Incode decides.
|
|
81
|
+
* - `VERIFICATION_ERROR` — the verification could not finish: network,
|
|
82
|
+
* expired token, camera denied, any other workflow or hosted-page error, a
|
|
83
|
+
* hosted result that approved none of the agent class's scopes, a hosted
|
|
84
|
+
* page that never sent `ready` (`detail.code` `READY_TIMEOUT`), or an
|
|
85
|
+
* `onPermissionsApproved` that rejected (`detail.code`
|
|
86
|
+
* `PERMISSIONS_NOT_SAVED`).
|
|
87
|
+
* {@link StepUpError.detail} carries the original code and message.
|
|
88
|
+
* - `IFRAME_ORIGIN_MISMATCH` — the step-up iframe posted from an origin other
|
|
89
|
+
* than `onboardingUrl`'s (for example it was redirected elsewhere).
|
|
90
|
+
*/
|
|
91
|
+
type StepUpErrorCode = 'INVALID_OPTIONS' | 'USER_DENIED' | 'FACE_CHECK_FAILED' | 'VERIFICATION_PENDING' | 'VERIFICATION_ERROR' | 'IFRAME_ORIGIN_MISMATCH';
|
|
92
|
+
/** The codes the verification step (workflow or hosted page) can end with. */
|
|
93
|
+
type StepUpVerificationErrorCode = Extract<StepUpErrorCode, 'FACE_CHECK_FAILED' | 'VERIFICATION_PENDING' | 'VERIFICATION_ERROR'>;
|
|
94
|
+
/**
|
|
95
|
+
* What the workflow or hosted page reported underneath a step-up error, as
|
|
96
|
+
* given (for logs and support; not stable API).
|
|
97
|
+
*/
|
|
98
|
+
type StepUpErrorDetail = {
|
|
99
|
+
/** E.g. a workflow module error code, an HTTP status, or a hosted code. */
|
|
100
|
+
code?: string;
|
|
101
|
+
message?: string;
|
|
102
|
+
};
|
|
103
|
+
/** Options validated by core. The DOM container is checked by the UI layer. */
|
|
104
|
+
type StepUpOptionsInput = {
|
|
105
|
+
stepUpId: string;
|
|
106
|
+
sessionToken: string;
|
|
107
|
+
interviewId?: string;
|
|
108
|
+
permissions: StepUpPermissions;
|
|
109
|
+
mode?: StepUpMode;
|
|
110
|
+
onboardingUrl?: string;
|
|
111
|
+
permissionsUi?: StepUpPermissionsUi;
|
|
112
|
+
/**
|
|
113
|
+
* Embedded mode: show the permissions screen before the face check
|
|
114
|
+
* (default) or after it. Ignored with `permissionsUi: 'none'`.
|
|
115
|
+
*
|
|
116
|
+
* `'afterFaceCheck'` with `onPermissionsApproved` needs Incode to accept the
|
|
117
|
+
* scope choice after the face check, which it does not yet: the bank gets
|
|
118
|
+
* 409 `STEP_UP_NOT_PENDING`, so the step-up ends with `VERIFICATION_ERROR`
|
|
119
|
+
* (`detail.code` `PERMISSIONS_NOT_SAVED`).
|
|
120
|
+
*/
|
|
121
|
+
permissionsOrder?: StepUpPermissionsOrder;
|
|
122
|
+
/**
|
|
123
|
+
* Embedded mode: called when the person approves, with the scopes they kept.
|
|
124
|
+
* The step-up waits for the returned promise, then runs the face check (or
|
|
125
|
+
* finishes, after it). Use it to record the choice on the bank server
|
|
126
|
+
* before the interview finishes. A rejection ends the step-up with
|
|
127
|
+
* `VERIFICATION_ERROR`, `detail.code` `PERMISSIONS_NOT_SAVED`.
|
|
128
|
+
*/
|
|
129
|
+
onPermissionsApproved?: (result: StepUpResult) => void | Promise<unknown>;
|
|
130
|
+
/**
|
|
131
|
+
* Hosted mode: how long to wait for the hosted page's `ready` before
|
|
132
|
+
* failing with `VERIFICATION_ERROR` (`detail.code` `READY_TIMEOUT`).
|
|
133
|
+
* Default 15000.
|
|
134
|
+
*/
|
|
135
|
+
readyTimeoutMs?: number;
|
|
136
|
+
/** Default language, as `<incode-workflow lang>`. Embedded mode. */
|
|
137
|
+
lang?: string;
|
|
138
|
+
/** Skips the tenant's dashboard theme, as on `<incode-workflow>`. Embedded mode. */
|
|
139
|
+
disableDashboardTheme?: boolean;
|
|
140
|
+
onFinish: (result: StepUpResult) => void;
|
|
141
|
+
onError?: (error: Error) => void;
|
|
142
|
+
};
|
|
143
|
+
/** Options after validation: defaults filled in, permissions normalized. */
|
|
144
|
+
type NormalizedStepUpOptions = {
|
|
145
|
+
stepUpId: string;
|
|
146
|
+
sessionToken: string;
|
|
147
|
+
interviewId?: string;
|
|
148
|
+
permissions: StepUpPermissions;
|
|
149
|
+
mode: StepUpMode;
|
|
150
|
+
onboardingUrl?: string;
|
|
151
|
+
/** Exact origin of `onboardingUrl` (hosted mode only). */
|
|
152
|
+
onboardingOrigin?: string;
|
|
153
|
+
permissionsUi: StepUpPermissionsUi;
|
|
154
|
+
permissionsOrder: StepUpPermissionsOrder;
|
|
155
|
+
readyTimeoutMs: number;
|
|
156
|
+
lang?: string;
|
|
157
|
+
disableDashboardTheme: boolean;
|
|
158
|
+
onPermissionsApproved?: (result: StepUpResult) => void | Promise<unknown>;
|
|
159
|
+
onFinish: (result: StepUpResult) => void;
|
|
160
|
+
onError?: (error: Error) => void;
|
|
161
|
+
};
|
|
162
|
+
/** Duration in the largest whole unit, for the i18n layer to phrase. */
|
|
163
|
+
type StepUpDuration = {
|
|
164
|
+
unit: 'days' | 'hours' | 'minutes' | 'seconds';
|
|
165
|
+
count: number;
|
|
166
|
+
};
|
|
167
|
+
/** What a message from the hosted onboarding page means to the step-up. */
|
|
168
|
+
type HostedPageMessage = {
|
|
169
|
+
kind: 'ready';
|
|
170
|
+
} | {
|
|
171
|
+
kind: 'finished';
|
|
172
|
+
approvedScopes: string[];
|
|
173
|
+
} | {
|
|
174
|
+
kind: 'error';
|
|
175
|
+
code: string;
|
|
176
|
+
message?: string;
|
|
177
|
+
} | {
|
|
178
|
+
kind: 'originMismatch';
|
|
179
|
+
} | {
|
|
180
|
+
kind: 'ignored';
|
|
181
|
+
};
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/modules/step-up/stepUpStateMachine.d.ts
|
|
184
|
+
type StepUpInput = {
|
|
185
|
+
stepUpId: string;
|
|
186
|
+
permissions: StepUpPermissions;
|
|
187
|
+
permissionsUi: StepUpPermissionsUi;
|
|
188
|
+
permissionsOrder: StepUpPermissionsOrder;
|
|
189
|
+
/** The host saves the approved scopes before the step-up goes on. */
|
|
190
|
+
hostSavesPermissions: boolean;
|
|
191
|
+
};
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/modules/step-up/stepUpActor.d.ts
|
|
194
|
+
type CreateStepUpActorOptions = StepUpInput;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/modules/step-up/stepUpManager.d.ts
|
|
197
|
+
type StepUpVerifyingState = {
|
|
198
|
+
status: 'verifying';
|
|
199
|
+
};
|
|
200
|
+
type StepUpPermissionsState = {
|
|
201
|
+
status: 'permissions';
|
|
202
|
+
purpose?: string;
|
|
203
|
+
/** `locked`: an `auto-select` scope, always approved and not toggleable. */
|
|
204
|
+
scopes: Array<StepUpScope & {
|
|
205
|
+
checked: boolean;
|
|
206
|
+
locked: boolean;
|
|
207
|
+
limit?: StepUpLimit;
|
|
208
|
+
}>;
|
|
209
|
+
/** Missing when the step-up has no `durationSeconds`. */
|
|
210
|
+
duration?: StepUpDuration;
|
|
211
|
+
/** False when no scope is checked: Approve needs at least one. */
|
|
212
|
+
canApprove: boolean;
|
|
213
|
+
/** Approved; the host is saving the choice before the step-up goes on. */
|
|
214
|
+
saving: boolean;
|
|
215
|
+
};
|
|
216
|
+
type StepUpFinishedState = {
|
|
217
|
+
status: 'finished';
|
|
218
|
+
result: StepUpResult;
|
|
219
|
+
};
|
|
220
|
+
type StepUpClosedState = {
|
|
221
|
+
status: 'closed';
|
|
222
|
+
};
|
|
223
|
+
type StepUpErrorState = {
|
|
224
|
+
status: 'error';
|
|
225
|
+
/** The `StepUpError` code to report. */
|
|
226
|
+
code: StepUpVerificationErrorCode;
|
|
227
|
+
error: string;
|
|
228
|
+
detail?: StepUpErrorDetail;
|
|
229
|
+
};
|
|
230
|
+
/** The parts of the workflow's `FinishStatus` the step-up reads. */
|
|
231
|
+
type StepUpWorkflowResult = Pick<FinishStatus, 'action' | 'scoreStatus'>;
|
|
232
|
+
/**
|
|
233
|
+
* What the workflow's `onFinish` result means for the step-up:
|
|
234
|
+
* - `failed` — `action: 'rejected'`, or score `FAIL` / `MANUAL_FAIL`.
|
|
235
|
+
* - `pending` — no result (the workflow went to async resolution).
|
|
236
|
+
* - `passed` — anything else, `WARN` and `UNKNOWN` included. That is only a
|
|
237
|
+
* UI hint: Incode passes the face check only on `OK` / `MANUAL_OK`, so
|
|
238
|
+
* `onFinish` is never an approval.
|
|
239
|
+
*/
|
|
240
|
+
declare function readWorkflowResult(result: StepUpWorkflowResult | undefined): 'passed' | 'failed' | 'pending';
|
|
241
|
+
type StepUpState = StepUpVerifyingState | StepUpPermissionsState | StepUpFinishedState | StepUpClosedState | StepUpErrorState;
|
|
242
|
+
type CreateStepUpManagerOptions = {
|
|
243
|
+
stepUpId: string;
|
|
244
|
+
permissions: StepUpPermissions;
|
|
245
|
+
permissionsUi?: CreateStepUpActorOptions['permissionsUi'];
|
|
246
|
+
permissionsOrder?: CreateStepUpActorOptions['permissionsOrder'];
|
|
247
|
+
/** Approve waits for `permissionsSaved()` before going on. */
|
|
248
|
+
hostSavesPermissions?: boolean;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Creates the step-up manager. Pass permissions already normalized by
|
|
252
|
+
* `validateStepUpOptions` / `normalizeStepUpPermissions`.
|
|
253
|
+
*/
|
|
254
|
+
declare function createStepUpManager(options: CreateStepUpManagerOptions): Manager<StepUpState> & {
|
|
255
|
+
/** Verification passed: show the permissions (or finish, `'none'`). */
|
|
256
|
+
verificationFinished(): void;
|
|
257
|
+
/**
|
|
258
|
+
* The workflow's `onFinish`, with its result. A failed face check goes to
|
|
259
|
+
* `error` (`FACE_CHECK_FAILED`) and no result to `error`
|
|
260
|
+
* (`VERIFICATION_PENDING`); neither shows the permissions.
|
|
261
|
+
*/
|
|
262
|
+
workflowFinished(result?: StepUpWorkflowResult): void;
|
|
263
|
+
/**
|
|
264
|
+
* The workflow or hosted page ended without a passed check. `code`
|
|
265
|
+
* defaults to `VERIFICATION_ERROR` (could not finish); pass
|
|
266
|
+
* `FACE_CHECK_FAILED` only for a check that ran and failed.
|
|
267
|
+
*/
|
|
268
|
+
verificationFailed(error: string, code?: StepUpVerificationErrorCode, detail?: StepUpErrorDetail): void;
|
|
269
|
+
/** Hosted mode: the hosted page finished, with the scopes it approved. */
|
|
270
|
+
hostedFinished(approvedScopes: string[]): void;
|
|
271
|
+
/** Hosted mode: the user denied on the hosted page. */
|
|
272
|
+
hostedDenied(): void;
|
|
273
|
+
toggleScope(name: string): void;
|
|
274
|
+
/** Ignored while no scope is checked. */
|
|
275
|
+
approve(): void;
|
|
276
|
+
deny(): void;
|
|
277
|
+
/** The host saved the approved scopes: go on to the face check or finish. */
|
|
278
|
+
permissionsSaved(): void;
|
|
279
|
+
/** The host could not save them: the step-up ends in error. */
|
|
280
|
+
permissionsSaveFailed(error: string): void;
|
|
281
|
+
};
|
|
282
|
+
type StepUpManager = ReturnType<typeof createStepUpManager>;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/modules/step-up/stepUpError.d.ts
|
|
285
|
+
/**
|
|
286
|
+
* Error passed to the step-up `onError` callback (and thrown for invalid
|
|
287
|
+
* options). `code` is stable; `message` is for developers, not end users.
|
|
288
|
+
* `detail` is what the workflow or hosted page reported underneath (set for
|
|
289
|
+
* `VERIFICATION_ERROR`, and for `FACE_CHECK_FAILED` from the workflow).
|
|
290
|
+
*/
|
|
291
|
+
declare class StepUpError extends Error {
|
|
292
|
+
readonly code: StepUpErrorCode;
|
|
293
|
+
readonly stepUpId?: string;
|
|
294
|
+
readonly detail?: StepUpErrorDetail;
|
|
295
|
+
constructor(code: StepUpErrorCode, message: string, stepUpId?: string, detail?: StepUpErrorDetail);
|
|
296
|
+
}
|
|
297
|
+
declare function isStepUpError(error: unknown): error is StepUpError;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/modules/step-up/stepUpOptions.d.ts
|
|
300
|
+
/**
|
|
301
|
+
* Checks the permissions block from the start response and fills in
|
|
302
|
+
* `displayName` (falls back to the scope name). Keeps each scope's boolean
|
|
303
|
+
* `autoSelect` and known `selectionMode`, and the valid limits of known
|
|
304
|
+
* scopes. A missing or `null` `durationSeconds` is left out. Throws
|
|
305
|
+
* `INVALID_OPTIONS` when a required field is missing, or `durationSeconds` is
|
|
306
|
+
* given but not a positive number.
|
|
307
|
+
*/
|
|
308
|
+
declare function normalizeStepUpPermissions(raw: unknown): StepUpPermissions;
|
|
309
|
+
/**
|
|
310
|
+
* Exact origin (`scheme://host[:port]`) of an absolute http(s) URL, or
|
|
311
|
+
* `undefined` when the URL is not one.
|
|
312
|
+
*/
|
|
313
|
+
declare function getUrlOrigin(url: string): string | undefined;
|
|
314
|
+
/**
|
|
315
|
+
* Validates the `renderStepUp` options (everything except the DOM container,
|
|
316
|
+
* which the UI layer checks) and fills in defaults:
|
|
317
|
+
* `mode: 'embedded'`, `permissionsUi: 'sdk'`,
|
|
318
|
+
* `permissionsOrder: 'beforeFaceCheck'` (`'afterFaceCheck'` in hosted mode),
|
|
319
|
+
* `readyTimeoutMs: DEFAULT_STEP_UP_READY_TIMEOUT_MS` (15 s),
|
|
320
|
+
* `disableDashboardTheme: false`.
|
|
321
|
+
*
|
|
322
|
+
* Throws {@link StepUpError} with code `INVALID_OPTIONS`.
|
|
323
|
+
*/
|
|
324
|
+
declare function validateStepUpOptions(raw: unknown): NormalizedStepUpOptions;
|
|
325
|
+
/**
|
|
326
|
+
* Picks the largest unit that divides the duration exactly, so
|
|
327
|
+
* 36000 s → 10 hours, 5400 s → 90 minutes. A duration that is not a whole
|
|
328
|
+
* number of minutes is rounded up to minutes (never shown shorter than it is),
|
|
329
|
+
* and anything under a minute stays in seconds. No duration gives `undefined`.
|
|
330
|
+
*/
|
|
331
|
+
declare function describeStepUpDuration(durationSeconds: number | undefined): StepUpDuration | undefined;
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/modules/step-up/stepUpHostedMessage.d.ts
|
|
334
|
+
/**
|
|
335
|
+
* Tag on every step-up `postMessage`, both directions. Matches the local
|
|
336
|
+
* step-up mock's hosted page (contract P4.7 §6.6 reference implementation).
|
|
337
|
+
*/
|
|
338
|
+
declare const STEP_UP_MESSAGE_SOURCE = "incode-step-up";
|
|
339
|
+
/**
|
|
340
|
+
* The parts of a browser `MessageEvent` the check needs. Kept structural so
|
|
341
|
+
* core never touches DOM types.
|
|
342
|
+
*/
|
|
343
|
+
type HostedMessageEventLike = {
|
|
344
|
+
origin: string;
|
|
345
|
+
data: unknown;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* True only when the message came from exactly `expectedOrigin`
|
|
349
|
+
* (scheme, host and port). No suffix or prefix matching:
|
|
350
|
+
* `https://onboarding.incode.com.evil.com` does not match
|
|
351
|
+
* `https://onboarding.incode.com`.
|
|
352
|
+
*/
|
|
353
|
+
declare function isTrustedHostedOrigin(origin: string, expectedOrigin: string): boolean;
|
|
354
|
+
/**
|
|
355
|
+
* Reads a `postMessage` from the hosted step-up page.
|
|
356
|
+
*
|
|
357
|
+
* Pass only messages whose `source` is the step-up iframe's own window. The
|
|
358
|
+
* page tags messages `{ source: 'incode-step-up', type, ... }`:
|
|
359
|
+
* - `ready` — loaded; the parent answers with {@link createStepUpInitMessage}.
|
|
360
|
+
* - `finish` — `{ stepUpId, approvedScopes }`; the hosted page ran the face
|
|
361
|
+
* check and its own permissions screen. Read only when `stepUpId` is
|
|
362
|
+
* exactly `expectedStepUpId`; otherwise (missing or another step-up's)
|
|
363
|
+
* it is ignored, not relayed.
|
|
364
|
+
* - `error` — `{ code, message? }`, e.g. `USER_DENIED` or
|
|
365
|
+
* `FACE_CHECK_FAILED`. Ignored when it names another `stepUpId`.
|
|
366
|
+
*
|
|
367
|
+
* A tagged message from another origin returns `originMismatch` (the frame
|
|
368
|
+
* left the onboarding origin, for example after a redirect). Untagged
|
|
369
|
+
* messages are ignored.
|
|
370
|
+
*/
|
|
371
|
+
declare function readHostedPageMessage(event: HostedMessageEventLike, expectedOrigin: string, expectedStepUpId: string): HostedPageMessage;
|
|
372
|
+
/** Message the parent posts to the hosted page after its `ready`. */
|
|
373
|
+
type StepUpInitMessage = {
|
|
374
|
+
source: typeof STEP_UP_MESSAGE_SOURCE;
|
|
375
|
+
type: 'init';
|
|
376
|
+
permissions: StepUpPermissions;
|
|
377
|
+
parentOrigin: string;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Builds the `init` message that hands the hosted page the permissions and
|
|
381
|
+
* the parent's origin (contract v0.2 §6.6; the page checks `parentOrigin`
|
|
382
|
+
* against its `returnOrigin`). The caller posts it with `targetOrigin` set to
|
|
383
|
+
* the exact onboarding origin, never `'*'`.
|
|
384
|
+
*/
|
|
385
|
+
declare function createStepUpInitMessage(permissions: StepUpPermissions, parentOrigin: string): StepUpInitMessage;
|
|
386
|
+
//#endregion
|
|
387
|
+
export { type CreateStepUpManagerOptions, type HostedMessageEventLike, type HostedPageMessage, type NormalizedStepUpOptions, STEP_UP_MESSAGE_SOURCE, type StepUpClosedState, type StepUpDuration, StepUpError, type StepUpErrorCode, type StepUpErrorDetail, type StepUpErrorState, type StepUpFinishedState, type StepUpInitMessage, type StepUpLimit, type StepUpManager, type StepUpMode, type StepUpOptionsInput, type StepUpPermissions, type StepUpPermissionsOrder, type StepUpPermissionsState, type StepUpPermissionsUi, type StepUpResult, type StepUpScope, type StepUpState, type StepUpVerificationErrorCode, type StepUpVerifyingState, type StepUpWorkflowResult, createStepUpInitMessage, createStepUpManager, describeStepUpDuration, getUrlOrigin, isStepUpError, isTrustedHostedOrigin, normalizeStepUpPermissions, readHostedPageMessage, readWorkflowResult, validateStepUpOptions };
|