@metamask-previews/kyc-controller 0.0.0-preview-6b4bcdab3 → 0.0.0-preview-0b5bfc2
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/CHANGELOG.md +3 -42
- package/dist/KycController-method-action-types.cjs.map +1 -1
- package/dist/KycController-method-action-types.d.cts +2 -48
- package/dist/KycController-method-action-types.d.cts.map +1 -1
- package/dist/KycController-method-action-types.d.mts +2 -48
- package/dist/KycController-method-action-types.d.mts.map +1 -1
- package/dist/KycController-method-action-types.mjs.map +1 -1
- package/dist/KycController.cjs +13 -472
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts +5 -109
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts +5 -109
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +13 -472
- package/dist/KycController.mjs.map +1 -1
- package/dist/KycService-method-action-types.cjs.map +1 -1
- package/dist/KycService-method-action-types.d.cts +2 -38
- package/dist/KycService-method-action-types.d.cts.map +1 -1
- package/dist/KycService-method-action-types.d.mts +2 -38
- package/dist/KycService-method-action-types.d.mts.map +1 -1
- package/dist/KycService-method-action-types.mjs.map +1 -1
- package/dist/KycService.cjs +29 -184
- package/dist/KycService.cjs.map +1 -1
- package/dist/KycService.d.cts +14 -99
- package/dist/KycService.d.cts.map +1 -1
- package/dist/KycService.d.mts +14 -99
- package/dist/KycService.d.mts.map +1 -1
- package/dist/KycService.mjs +30 -185
- package/dist/KycService.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +10 -49
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +10 -49
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +2 -2
package/dist/KycController.cjs
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _KycController_instances, _KycController_sumsubLauncher, _KycController_keypair, _KycController_authClientToken, _KycController_generation, _KycController_sessionStatusPollIntervalMs, _KycController_pollTimer, _KycController_pollToken,
|
|
13
|
+
var _KycController_instances, _KycController_sumsubLauncher, _KycController_keypair, _KycController_authClientToken, _KycController_generation, _KycController_sessionStatusPollIntervalMs, _KycController_pollTimer, _KycController_pollToken, _KycController_localUserSecretStore, _KycController_createSession, _KycController_clearAcceptedTerms, _KycController_handleCheckOutcome, _KycController_handleAuthOutcome, _KycController_continueAfterAuthentication, _KycController_requireTermsReacceptance, _KycController_startSessionStatusPolling, _KycController_pollSessionStatusOnce, _KycController_stopPolling, _KycController_updateIfCurrent, _KycController_applyUpdate, _KycController_fail;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.KycController = exports.getDefaultKycControllerState = exports.controllerName = void 0;
|
|
16
16
|
const base_controller_1 = require("@metamask/base-controller");
|
|
@@ -87,12 +87,6 @@ const SUCCESSFUL_SESSION_STATUSES = new Set([
|
|
|
87
87
|
// to do, so the sub-flow stops before launching the SDK and surfaces this
|
|
88
88
|
// message.
|
|
89
89
|
const VENDOR_PROCESSING_MESSAGE = 'Your KYC has been submitted and is being processed by the vendor.';
|
|
90
|
-
// UKYC / relay error indicating the applicant already finished KYC. Mapped to
|
|
91
|
-
// the simplified `completed` user status for the Money toast surface.
|
|
92
|
-
const SESSION_NOT_IN_VALID_STATE = 'session_not_in_valid_state';
|
|
93
|
-
// How often to refresh the user-keyed `GET /kyc/status` while the simplified
|
|
94
|
-
// status is still `pending`. Overridable via the constructor.
|
|
95
|
-
const DEFAULT_USER_STATUS_POLL_INTERVAL_MS = 15000;
|
|
96
90
|
const kycControllerMetadata = {
|
|
97
91
|
phase: {
|
|
98
92
|
includeInDebugSnapshot: true,
|
|
@@ -130,24 +124,6 @@ const kycControllerMetadata = {
|
|
|
130
124
|
persist: true,
|
|
131
125
|
usedInUi: false,
|
|
132
126
|
},
|
|
133
|
-
termsAcceptedVendor: {
|
|
134
|
-
includeInDebugSnapshot: true,
|
|
135
|
-
includeInStateLogs: true,
|
|
136
|
-
persist: true,
|
|
137
|
-
usedInUi: false,
|
|
138
|
-
},
|
|
139
|
-
sumsubTncAccepted: {
|
|
140
|
-
includeInDebugSnapshot: true,
|
|
141
|
-
includeInStateLogs: true,
|
|
142
|
-
persist: true,
|
|
143
|
-
usedInUi: false,
|
|
144
|
-
},
|
|
145
|
-
idosTncAccepted: {
|
|
146
|
-
includeInDebugSnapshot: true,
|
|
147
|
-
includeInStateLogs: true,
|
|
148
|
-
persist: true,
|
|
149
|
-
usedInUi: false,
|
|
150
|
-
},
|
|
151
127
|
disclaimers: {
|
|
152
128
|
includeInDebugSnapshot: false,
|
|
153
129
|
includeInStateLogs: false,
|
|
@@ -184,12 +160,6 @@ const kycControllerMetadata = {
|
|
|
184
160
|
persist: false,
|
|
185
161
|
usedInUi: false,
|
|
186
162
|
},
|
|
187
|
-
activeVendor: {
|
|
188
|
-
includeInDebugSnapshot: true,
|
|
189
|
-
includeInStateLogs: true,
|
|
190
|
-
persist: false,
|
|
191
|
-
usedInUi: true,
|
|
192
|
-
},
|
|
193
163
|
activeProduct: {
|
|
194
164
|
includeInDebugSnapshot: true,
|
|
195
165
|
includeInStateLogs: true,
|
|
@@ -208,24 +178,6 @@ const kycControllerMetadata = {
|
|
|
208
178
|
persist: true,
|
|
209
179
|
usedInUi: false,
|
|
210
180
|
},
|
|
211
|
-
userStatus: {
|
|
212
|
-
includeInDebugSnapshot: true,
|
|
213
|
-
includeInStateLogs: true,
|
|
214
|
-
persist: true,
|
|
215
|
-
usedInUi: true,
|
|
216
|
-
},
|
|
217
|
-
userStatusSumsubSessionId: {
|
|
218
|
-
includeInDebugSnapshot: false,
|
|
219
|
-
includeInStateLogs: false,
|
|
220
|
-
persist: true,
|
|
221
|
-
usedInUi: true,
|
|
222
|
-
},
|
|
223
|
-
userStatusErrorCode: {
|
|
224
|
-
includeInDebugSnapshot: true,
|
|
225
|
-
includeInStateLogs: true,
|
|
226
|
-
persist: true,
|
|
227
|
-
usedInUi: true,
|
|
228
|
-
},
|
|
229
181
|
sumsub: {
|
|
230
182
|
includeInDebugSnapshot: false,
|
|
231
183
|
includeInStateLogs: false,
|
|
@@ -246,22 +198,15 @@ function getDefaultKycControllerState() {
|
|
|
246
198
|
email: null,
|
|
247
199
|
termsAcceptedAt: null,
|
|
248
200
|
acceptedDisclaimerIds: [],
|
|
249
|
-
termsAcceptedVendor: null,
|
|
250
|
-
sumsubTncAccepted: null,
|
|
251
|
-
idosTncAccepted: null,
|
|
252
201
|
disclaimers: [],
|
|
253
202
|
disclaimersError: null,
|
|
254
203
|
geoCountry: null,
|
|
255
204
|
sessionToken: null,
|
|
256
205
|
accessToken: null,
|
|
257
206
|
moonpayCustomerId: null,
|
|
258
|
-
activeVendor: 'moonpay',
|
|
259
207
|
activeProduct: null,
|
|
260
208
|
kycRequiredByProduct: {},
|
|
261
209
|
lastCheckedAt: null,
|
|
262
|
-
userStatus: null,
|
|
263
|
-
userStatusSumsubSessionId: null,
|
|
264
|
-
userStatusErrorCode: null,
|
|
265
210
|
sumsub: {
|
|
266
211
|
status: 'idle',
|
|
267
212
|
result: null,
|
|
@@ -272,34 +217,11 @@ function getDefaultKycControllerState() {
|
|
|
272
217
|
};
|
|
273
218
|
}
|
|
274
219
|
exports.getDefaultKycControllerState = getDefaultKycControllerState;
|
|
275
|
-
/**
|
|
276
|
-
* Whether an error indicates the applicant already finished KYC — the UKYC /
|
|
277
|
-
* relay `session_not_in_valid_state` signal — which the controller maps to the
|
|
278
|
-
* simplified `completed` user status.
|
|
279
|
-
*
|
|
280
|
-
* @param error - The caught error.
|
|
281
|
-
* @returns `true` when the error carries the `session_not_in_valid_state`
|
|
282
|
-
* marker.
|
|
283
|
-
*/
|
|
284
|
-
function isSessionAlreadyCompletedError(error) {
|
|
285
|
-
return String(error).includes(SESSION_NOT_IN_VALID_STATE);
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Vendors other than MoonPay skip Check/Auth frames and use the empty-shell
|
|
289
|
-
* customer + consents path instead.
|
|
290
|
-
*
|
|
291
|
-
* @param vendor - The identity vendor for the current flow.
|
|
292
|
-
* @returns `true` when the vendor uses the consents session path.
|
|
293
|
-
*/
|
|
294
|
-
function usesConsentsFlow(vendor) {
|
|
295
|
-
return vendor !== 'moonpay';
|
|
296
|
-
}
|
|
297
220
|
// === MESSENGER ===
|
|
298
221
|
const MESSENGER_EXPOSED_METHODS = [
|
|
299
222
|
'initialize',
|
|
300
223
|
'loadDisclaimers',
|
|
301
224
|
'acceptTermsAndStartSession',
|
|
302
|
-
'createVendorCustomer',
|
|
303
225
|
'clearSavedTerms',
|
|
304
226
|
'handleFrameMessage',
|
|
305
227
|
'buildCheckFrameUrl',
|
|
@@ -307,8 +229,6 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
307
229
|
'buildResetFrameUrl',
|
|
308
230
|
'checkKycRequired',
|
|
309
231
|
'getKycStatus',
|
|
310
|
-
'getCustomerIdentity',
|
|
311
|
-
'refreshKycStatus',
|
|
312
232
|
'startSumSub',
|
|
313
233
|
'getSessionStatus',
|
|
314
234
|
'reset',
|
|
@@ -331,10 +251,8 @@ class KycController extends base_controller_1.BaseController {
|
|
|
331
251
|
* @param options.sumsubLauncher - The platform SumSub launcher adapter.
|
|
332
252
|
* @param options.sessionStatusPollIntervalMs - How often to poll the UKYC
|
|
333
253
|
* session status after the SumSub SDK completes.
|
|
334
|
-
* @param options.userStatusPollIntervalMs - How often to refresh the
|
|
335
|
-
* user-keyed KYC status while it is still `pending`.
|
|
336
254
|
*/
|
|
337
|
-
constructor({ messenger, state, sumsubLauncher, sessionStatusPollIntervalMs = DEFAULT_SESSION_STATUS_POLL_INTERVAL_MS,
|
|
255
|
+
constructor({ messenger, state, sumsubLauncher, sessionStatusPollIntervalMs = DEFAULT_SESSION_STATUS_POLL_INTERVAL_MS, }) {
|
|
338
256
|
super({
|
|
339
257
|
messenger,
|
|
340
258
|
metadata: kycControllerMetadata,
|
|
@@ -365,23 +283,8 @@ class KycController extends base_controller_1.BaseController {
|
|
|
365
283
|
* let an already-awaiting request finish and reschedule.
|
|
366
284
|
*/
|
|
367
285
|
_KycController_pollToken.set(this, 0);
|
|
368
|
-
/** Interval, in milliseconds, between user-keyed status polls. */
|
|
369
|
-
_KycController_userStatusPollIntervalMs.set(this, void 0);
|
|
370
|
-
/** Handle for the scheduled next user-status poll, or `null`. */
|
|
371
|
-
_KycController_userStatusPollTimer.set(this, null);
|
|
372
|
-
/**
|
|
373
|
-
* Whether a user-status poll loop is currently active. Tracked separately
|
|
374
|
-
* from {@link #userStatusPollTimer} because a scheduled tick clears the timer
|
|
375
|
-
* handle before awaiting `fetchKycStatus`; relying on the handle alone would
|
|
376
|
-
* let a concurrent {@link refreshKycStatus} start a second loop on the same
|
|
377
|
-
* token during that in-flight window.
|
|
378
|
-
*/
|
|
379
|
-
_KycController_userStatusPolling.set(this, false);
|
|
380
|
-
/** Monotonic token for the user-status poll loop (see `#pollToken`). */
|
|
381
|
-
_KycController_userStatusPollToken.set(this, 0);
|
|
382
286
|
__classPrivateFieldSet(this, _KycController_sumsubLauncher, sumsubLauncher, "f");
|
|
383
287
|
__classPrivateFieldSet(this, _KycController_sessionStatusPollIntervalMs, sessionStatusPollIntervalMs, "f");
|
|
384
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollIntervalMs, userStatusPollIntervalMs, "f");
|
|
385
288
|
__classPrivateFieldSet(this, _KycController_keypair, (0, crypto_js_1.generateKeyPair)(), "f");
|
|
386
289
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
387
290
|
}
|
|
@@ -396,8 +299,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
396
299
|
* authentication completes (and chains into document verification when KYC
|
|
397
300
|
* is required). When omitted, the flow stops at `form` and the consumer must
|
|
398
301
|
* call `checkKycRequired` manually.
|
|
399
|
-
* @param params.vendor - Identity vendor for this flow. Non-MoonPay vendors
|
|
400
|
-
* skip Check/Auth frames and use the consents path. Defaults to `moonpay`.
|
|
401
302
|
*/
|
|
402
303
|
async initialize(params) {
|
|
403
304
|
// A repeat `initialize` while a session flow is already in progress must
|
|
@@ -408,7 +309,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
408
309
|
if (IN_PROGRESS_PHASES.includes(this.state.phase)) {
|
|
409
310
|
return;
|
|
410
311
|
}
|
|
411
|
-
const vendor = params?.vendor ?? 'moonpay';
|
|
412
312
|
// `initialize` starts a fresh flow, so `activeProduct` is always reset to
|
|
413
313
|
// this call's product (or `null`). Otherwise a prior run's product could
|
|
414
314
|
// linger and cause `#continueAfterAuthentication` to auto-run the check /
|
|
@@ -417,19 +317,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
417
317
|
if (params?.email) {
|
|
418
318
|
state.email = params.email;
|
|
419
319
|
}
|
|
420
|
-
// Terms acceptance is vendor-scoped: reusing another vendor's saved
|
|
421
|
-
// acceptance would skip loading this vendor's disclaimers and submit its
|
|
422
|
-
// ids to the wrong vendor.
|
|
423
|
-
if (!__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_hasTermsForVendor).call(this, vendor)) {
|
|
424
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_clearAcceptedTerms).call(this, state);
|
|
425
|
-
}
|
|
426
|
-
state.activeVendor = vendor;
|
|
427
|
-
// `moonpayCustomerId` is only ever issued by the MoonPay Check / Auth
|
|
428
|
-
// frames. Leaving it set while the flow switches to another vendor would
|
|
429
|
-
// make `getCustomerIdentity` report a MoonPay id under the wrong vendor.
|
|
430
|
-
if (vendor !== 'moonpay') {
|
|
431
|
-
state.moonpayCustomerId = null;
|
|
432
|
-
}
|
|
433
320
|
state.activeProduct = params?.product ?? null;
|
|
434
321
|
});
|
|
435
322
|
// Capture the flow generation so a `reset()` landing while the async
|
|
@@ -446,48 +333,10 @@ class KycController extends base_controller_1.BaseController {
|
|
|
446
333
|
catch {
|
|
447
334
|
// Ignore; disclaimers loading will surface a country error if needed.
|
|
448
335
|
}
|
|
449
|
-
if (usesConsentsFlow(vendor) && this.state.email) {
|
|
450
|
-
try {
|
|
451
|
-
await this.messenger.call('KycService:createVendorCustomer', {
|
|
452
|
-
vendor,
|
|
453
|
-
email: this.state.email,
|
|
454
|
-
});
|
|
455
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
catch (error) {
|
|
460
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fail).call(this, `Vendor customer creation failed: ${String(error)}`);
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
336
|
const hasTerms = Boolean(this.state.termsAcceptedAt) &&
|
|
468
337
|
this.state.acceptedDisclaimerIds.length > 0;
|
|
469
338
|
if (hasTerms && this.state.email) {
|
|
470
|
-
|
|
471
|
-
// Consents-path vendors require T&C2 flags; if they weren't persisted
|
|
472
|
-
// (i.e. null from pre-migration state), require reacceptance.
|
|
473
|
-
const sumsubTncSigned = this.state.sumsubTncAccepted;
|
|
474
|
-
const idosTncSigned = this.state.idosTncAccepted;
|
|
475
|
-
if (sumsubTncSigned === null || idosTncSigned === null) {
|
|
476
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
477
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_clearAcceptedTerms).call(this, state);
|
|
478
|
-
state.phase = 'terms';
|
|
479
|
-
});
|
|
480
|
-
await this.loadDisclaimers();
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_startConsentsSession).call(this, {
|
|
484
|
-
sumsubTncSigned,
|
|
485
|
-
idosTncSigned,
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_createSession).call(this);
|
|
490
|
-
}
|
|
339
|
+
await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_createSession).call(this);
|
|
491
340
|
return;
|
|
492
341
|
}
|
|
493
342
|
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
@@ -495,43 +344,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
495
344
|
});
|
|
496
345
|
await this.loadDisclaimers();
|
|
497
346
|
}
|
|
498
|
-
/**
|
|
499
|
-
* Creates (or resumes) an empty-shell customer for the given identity
|
|
500
|
-
* vendor. Exposed so a consumer can ensure the customer exists before
|
|
501
|
-
* showing T&C screens independently of {@link initialize}.
|
|
502
|
-
*
|
|
503
|
-
* @param params - The parameters.
|
|
504
|
-
* @param params.vendor - Identity vendor for the customer.
|
|
505
|
-
* @param params.email - Email for the vendor customer.
|
|
506
|
-
*/
|
|
507
|
-
async createVendorCustomer(params) {
|
|
508
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
509
|
-
state.email = params.email;
|
|
510
|
-
// See `initialize`: acceptance recorded for another vendor cannot carry
|
|
511
|
-
// over, and a MoonPay-issued customer id must not survive a switch to
|
|
512
|
-
// another vendor or `getCustomerIdentity` reports the wrong vendor.
|
|
513
|
-
if (!__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_hasTermsForVendor).call(this, params.vendor)) {
|
|
514
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_clearAcceptedTerms).call(this, state);
|
|
515
|
-
}
|
|
516
|
-
state.activeVendor = params.vendor;
|
|
517
|
-
if (params.vendor !== 'moonpay') {
|
|
518
|
-
state.moonpayCustomerId = null;
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
const generation = __classPrivateFieldGet(this, _KycController_generation, "f");
|
|
522
|
-
try {
|
|
523
|
-
await this.messenger.call('KycService:createVendorCustomer', {
|
|
524
|
-
vendor: params.vendor,
|
|
525
|
-
email: params.email,
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
catch (error) {
|
|
529
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fail).call(this, `Vendor customer creation failed: ${String(error)}`);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
347
|
/**
|
|
536
348
|
* Loads the disclaimers for the resolved (or provided) country.
|
|
537
349
|
*
|
|
@@ -552,10 +364,7 @@ class KycController extends base_controller_1.BaseController {
|
|
|
552
364
|
state.geoCountry = country;
|
|
553
365
|
});
|
|
554
366
|
}
|
|
555
|
-
const disclaimers = await this.messenger.call('KycService:fetchDisclaimers', {
|
|
556
|
-
vendor: this.state.activeVendor,
|
|
557
|
-
country,
|
|
558
|
-
});
|
|
367
|
+
const disclaimers = await this.messenger.call('KycService:fetchDisclaimers', { country });
|
|
559
368
|
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
|
|
560
369
|
state.disclaimers = disclaimers;
|
|
561
370
|
state.disclaimersError = null;
|
|
@@ -571,43 +380,25 @@ class KycController extends base_controller_1.BaseController {
|
|
|
571
380
|
* Captures terms acceptance for the currently loaded disclaimers and creates
|
|
572
381
|
* a session.
|
|
573
382
|
*
|
|
574
|
-
* @param params -
|
|
383
|
+
* @param params - Optional parameters.
|
|
575
384
|
* @param params.email - The account email to associate with the session.
|
|
576
385
|
* @param params.product - The consuming feature the flow runs for. See
|
|
577
386
|
* {@link initialize} for how the product drives the automatic post
|
|
578
387
|
* authentication continuation.
|
|
579
|
-
* @param params.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).
|
|
580
|
-
* Required for every vendor so callers explicitly declare acceptance.
|
|
581
|
-
* @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).
|
|
582
|
-
* Required for every vendor so callers explicitly declare acceptance.
|
|
583
388
|
*/
|
|
584
389
|
async acceptTermsAndStartSession(params) {
|
|
585
|
-
const sumsubTncSigned = params?.sumsubTncSigned;
|
|
586
|
-
const idosTncSigned = params?.idosTncSigned;
|
|
587
|
-
if (typeof sumsubTncSigned !== 'boolean' ||
|
|
588
|
-
typeof idosTncSigned !== 'boolean') {
|
|
589
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fail).call(this, 'Missing T&C2 acceptance flags.');
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
390
|
const termsAcceptedAt = new Date().toISOString();
|
|
593
391
|
const disclaimerIds = this.state.disclaimers.map((disclaimer) => disclaimer.id);
|
|
594
392
|
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
595
|
-
if (params
|
|
393
|
+
if (params?.email) {
|
|
596
394
|
state.email = params.email;
|
|
597
395
|
}
|
|
598
|
-
if (params
|
|
396
|
+
if (params?.product) {
|
|
599
397
|
state.activeProduct = params.product;
|
|
600
398
|
}
|
|
601
399
|
state.termsAcceptedAt = termsAcceptedAt;
|
|
602
400
|
state.acceptedDisclaimerIds = disclaimerIds;
|
|
603
|
-
state.termsAcceptedVendor = state.activeVendor;
|
|
604
|
-
state.sumsubTncAccepted = sumsubTncSigned;
|
|
605
|
-
state.idosTncAccepted = idosTncSigned;
|
|
606
401
|
});
|
|
607
|
-
if (usesConsentsFlow(this.state.activeVendor)) {
|
|
608
|
-
await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_startConsentsSession).call(this, { sumsubTncSigned, idosTncSigned });
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
402
|
await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_createSession).call(this);
|
|
612
403
|
}
|
|
613
404
|
/**
|
|
@@ -789,25 +580,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
789
580
|
getKycStatus(params) {
|
|
790
581
|
return this.state.kycRequiredByProduct[params.product];
|
|
791
582
|
}
|
|
792
|
-
/**
|
|
793
|
-
* Returns the vendor-scoped identity for the currently authenticated
|
|
794
|
-
* customer, or `null` when the flow has not yet captured a vendor customer
|
|
795
|
-
* id (before authentication or after {@link reset}).
|
|
796
|
-
*
|
|
797
|
-
* Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor
|
|
798
|
-
* customer id to downstream calls without reading the full KYC state, which
|
|
799
|
-
* also holds session/access tokens. The id is session-scoped and never
|
|
800
|
-
* persisted.
|
|
801
|
-
*
|
|
802
|
-
* @returns The current {@link KycCustomerIdentity}, or `null`.
|
|
803
|
-
*/
|
|
804
|
-
getCustomerIdentity() {
|
|
805
|
-
const { moonpayCustomerId, activeVendor } = this.state;
|
|
806
|
-
if (!moonpayCustomerId) {
|
|
807
|
-
return null;
|
|
808
|
-
}
|
|
809
|
-
return { vendor: activeVendor, id: moonpayCustomerId };
|
|
810
|
-
}
|
|
811
583
|
/**
|
|
812
584
|
* Runs the SumSub document-verification sub-flow end to end:
|
|
813
585
|
*
|
|
@@ -888,7 +660,10 @@ class KycController extends base_controller_1.BaseController {
|
|
|
888
660
|
});
|
|
889
661
|
const { sessionId, kycStatus, finalStatus } = await this.messenger.call('KycService:createUkycSession', {
|
|
890
662
|
jwtToken,
|
|
891
|
-
|
|
663
|
+
vendorMetadata: {
|
|
664
|
+
moonPayAccessToken: this.state.accessToken,
|
|
665
|
+
moonPayUserId: this.state.moonpayCustomerId,
|
|
666
|
+
},
|
|
892
667
|
wrappedEncryptionKey,
|
|
893
668
|
ukycCapabilityToken,
|
|
894
669
|
});
|
|
@@ -978,28 +753,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
978
753
|
return result;
|
|
979
754
|
}
|
|
980
755
|
catch (error) {
|
|
981
|
-
// Applicant already finished KYC — treat as completed for Money toast.
|
|
982
|
-
if (isSessionAlreadyCompletedError(error)) {
|
|
983
|
-
// A reset() may have landed while `launch` was in flight; forcing
|
|
984
|
-
// `completed` (and publishing `statusChanged`) on an idle controller
|
|
985
|
-
// would resurrect a flow the consumer already tore down.
|
|
986
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
987
|
-
return { alreadyCompleted: true };
|
|
988
|
-
}
|
|
989
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUserStatus).call(this, {
|
|
990
|
-
status: 'completed',
|
|
991
|
-
sumsubSessionId: null,
|
|
992
|
-
errorCode: null,
|
|
993
|
-
});
|
|
994
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
|
|
995
|
-
state.sumsub.status = 'complete';
|
|
996
|
-
state.sumsub.result = { alreadyCompleted: true };
|
|
997
|
-
state.statusMessage = 'KYC already completed.';
|
|
998
|
-
state.phase = 'done';
|
|
999
|
-
state.error = null;
|
|
1000
|
-
});
|
|
1001
|
-
return { alreadyCompleted: true };
|
|
1002
|
-
}
|
|
1003
756
|
const result = { error: String(error) };
|
|
1004
757
|
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
|
|
1005
758
|
state.sumsub.status = 'failed';
|
|
@@ -1008,31 +761,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
1008
761
|
return result;
|
|
1009
762
|
}
|
|
1010
763
|
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
|
|
1013
|
-
* stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
|
|
1014
|
-
* schedules short-interval polling while the status is `pending`.
|
|
1015
|
-
*
|
|
1016
|
-
* @returns The latest status payload.
|
|
1017
|
-
*/
|
|
1018
|
-
async refreshKycStatus() {
|
|
1019
|
-
const generation = __classPrivateFieldGet(this, _KycController_generation, "f");
|
|
1020
|
-
const payload = await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fetchAndApplyUserStatus).call(this);
|
|
1021
|
-
// A `reset()` landing while the request was in flight already stopped
|
|
1022
|
-
// polling and left the flow idle, and the payload above is the pre-reset
|
|
1023
|
-
// cached status. Starting a loop from it would poll — and publish
|
|
1024
|
-
// `statusChanged` — on a torn-down flow.
|
|
1025
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1026
|
-
return payload;
|
|
1027
|
-
}
|
|
1028
|
-
if (payload.status === 'pending') {
|
|
1029
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_ensureUserStatusPolling).call(this);
|
|
1030
|
-
}
|
|
1031
|
-
else {
|
|
1032
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_stopUserStatusPolling).call(this);
|
|
1033
|
-
}
|
|
1034
|
-
return payload;
|
|
1035
|
-
}
|
|
1036
764
|
/**
|
|
1037
765
|
* Fetches the current UKYC session status for the active sub-flow and records
|
|
1038
766
|
* it on state. Useful for a one-off refresh outside the automatic polling
|
|
@@ -1064,7 +792,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
1064
792
|
// Stop any session-status polling so a late poll cannot write onto the
|
|
1065
793
|
// now-idle controller.
|
|
1066
794
|
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_stopPolling).call(this);
|
|
1067
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_stopUserStatusPolling).call(this);
|
|
1068
795
|
// Invalidate any in-flight async work started before this reset so its
|
|
1069
796
|
// results are discarded rather than written onto the now-idle controller.
|
|
1070
797
|
__classPrivateFieldSet(this, _KycController_generation, __classPrivateFieldGet(this, _KycController_generation, "f") + 1, "f");
|
|
@@ -1077,7 +804,6 @@ class KycController extends base_controller_1.BaseController {
|
|
|
1077
804
|
state.sessionToken = null;
|
|
1078
805
|
state.accessToken = null;
|
|
1079
806
|
state.moonpayCustomerId = null;
|
|
1080
|
-
state.activeVendor = 'moonpay';
|
|
1081
807
|
state.activeProduct = null;
|
|
1082
808
|
state.sumsub = {
|
|
1083
809
|
status: 'idle',
|
|
@@ -1090,91 +816,11 @@ class KycController extends base_controller_1.BaseController {
|
|
|
1090
816
|
}
|
|
1091
817
|
}
|
|
1092
818
|
exports.KycController = KycController;
|
|
1093
|
-
_KycController_sumsubLauncher = new WeakMap(), _KycController_keypair = new WeakMap(), _KycController_authClientToken = new WeakMap(), _KycController_generation = new WeakMap(), _KycController_sessionStatusPollIntervalMs = new WeakMap(), _KycController_pollTimer = new WeakMap(), _KycController_pollToken = new WeakMap(),
|
|
819
|
+
_KycController_sumsubLauncher = new WeakMap(), _KycController_keypair = new WeakMap(), _KycController_authClientToken = new WeakMap(), _KycController_generation = new WeakMap(), _KycController_sessionStatusPollIntervalMs = new WeakMap(), _KycController_pollTimer = new WeakMap(), _KycController_pollToken = new WeakMap(), _KycController_instances = new WeakSet(), _KycController_localUserSecretStore = function _KycController_localUserSecretStore() {
|
|
1094
820
|
return {
|
|
1095
821
|
get: async (path, entropySourceId) => this.messenger.call('UserStorageController:performGetStorage', path, entropySourceId),
|
|
1096
822
|
set: async (path, value, entropySourceId) => this.messenger.call('UserStorageController:performSetStorage', path, value, entropySourceId),
|
|
1097
823
|
};
|
|
1098
|
-
}, _KycController_startConsentsSession =
|
|
1099
|
-
/**
|
|
1100
|
-
* Consents-path vendors: post vendor signings + Sumsub/idOS ack, then
|
|
1101
|
-
* launch SumSub — skipping MoonPay Check/Auth frames.
|
|
1102
|
-
*
|
|
1103
|
-
* @param consents - T&C2 boolean flags.
|
|
1104
|
-
* @param consents.sumsubTncSigned - Whether Sumsub T&C were accepted.
|
|
1105
|
-
* @param consents.idosTncSigned - Whether idOS T&C were accepted.
|
|
1106
|
-
*/
|
|
1107
|
-
async function _KycController_startConsentsSession(consents) {
|
|
1108
|
-
const { email, acceptedDisclaimerIds } = this.state;
|
|
1109
|
-
if (!email) {
|
|
1110
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fail).call(this, 'Missing email for consents session.');
|
|
1111
|
-
return;
|
|
1112
|
-
}
|
|
1113
|
-
if (acceptedDisclaimerIds.length === 0) {
|
|
1114
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fail).call(this, 'Missing disclaimer acceptance.');
|
|
1115
|
-
return;
|
|
1116
|
-
}
|
|
1117
|
-
const generation = __classPrivateFieldGet(this, _KycController_generation, "f");
|
|
1118
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
1119
|
-
state.error = null;
|
|
1120
|
-
state.phase = 'session';
|
|
1121
|
-
state.statusMessage = 'Submitting consents...';
|
|
1122
|
-
// Consents-path vendors have no MoonPay session/access tokens.
|
|
1123
|
-
state.sessionToken = null;
|
|
1124
|
-
state.accessToken = null;
|
|
1125
|
-
});
|
|
1126
|
-
try {
|
|
1127
|
-
await this.messenger.call('KycService:submitConsents', {
|
|
1128
|
-
disclaimerIds: acceptedDisclaimerIds,
|
|
1129
|
-
sumsubTncSigned: consents.sumsubTncSigned,
|
|
1130
|
-
idosTncSigned: consents.idosTncSigned,
|
|
1131
|
-
});
|
|
1132
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
1136
|
-
state.phase = 'submit';
|
|
1137
|
-
state.statusMessage = 'Starting document verification...';
|
|
1138
|
-
});
|
|
1139
|
-
const sumsubResult = await this.startSumSub();
|
|
1140
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1141
|
-
return;
|
|
1142
|
-
}
|
|
1143
|
-
const sumsubError = sumsubResult?.error;
|
|
1144
|
-
if (typeof sumsubError === 'string') {
|
|
1145
|
-
throw new Error(sumsubError);
|
|
1146
|
-
}
|
|
1147
|
-
// After SumSub, refresh user-keyed status for the Money toast and start
|
|
1148
|
-
// polling while still pending. Soft-fail: toast refresh must not rewind
|
|
1149
|
-
// the consent / SumSub outcome.
|
|
1150
|
-
try {
|
|
1151
|
-
await this.refreshKycStatus();
|
|
1152
|
-
}
|
|
1153
|
-
catch (statusError) {
|
|
1154
|
-
console.error('KYC status refresh failed:', statusError);
|
|
1155
|
-
}
|
|
1156
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_updateIfCurrent).call(this, generation, (state) => {
|
|
1157
|
-
if (state.phase !== 'error' && state.phase !== 'done') {
|
|
1158
|
-
state.phase = 'done';
|
|
1159
|
-
state.statusMessage = 'KYC submitted.';
|
|
1160
|
-
}
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
catch (error) {
|
|
1164
|
-
console.error('Consents session failed:', error);
|
|
1165
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
1169
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_clearAcceptedTerms).call(this, state);
|
|
1170
|
-
state.activeProduct = null;
|
|
1171
|
-
state.error = `Consents session failed: ${String(error)}`;
|
|
1172
|
-
state.statusMessage =
|
|
1173
|
-
'Consent / verification failed — accept the terms to try again.';
|
|
1174
|
-
state.phase = 'terms';
|
|
1175
|
-
});
|
|
1176
|
-
await this.loadDisclaimers();
|
|
1177
|
-
}
|
|
1178
824
|
}, _KycController_createSession =
|
|
1179
825
|
/**
|
|
1180
826
|
* Creates a vendor session from the currently stored terms + email.
|
|
@@ -1243,14 +889,6 @@ async function _KycController_createSession() {
|
|
|
1243
889
|
}, _KycController_clearAcceptedTerms = function _KycController_clearAcceptedTerms(state) {
|
|
1244
890
|
state.termsAcceptedAt = null;
|
|
1245
891
|
state.acceptedDisclaimerIds = [];
|
|
1246
|
-
state.termsAcceptedVendor = null;
|
|
1247
|
-
state.sumsubTncAccepted = null;
|
|
1248
|
-
state.idosTncAccepted = null;
|
|
1249
|
-
}, _KycController_hasTermsForVendor = function _KycController_hasTermsForVendor(vendor) {
|
|
1250
|
-
if (this.state.termsAcceptedVendor === null) {
|
|
1251
|
-
return false;
|
|
1252
|
-
}
|
|
1253
|
-
return this.state.termsAcceptedVendor === vendor;
|
|
1254
892
|
}, _KycController_handleCheckOutcome =
|
|
1255
893
|
/**
|
|
1256
894
|
* Applies a Check-frame outcome.
|
|
@@ -1348,101 +986,6 @@ async function _KycController_continueAfterAuthentication() {
|
|
|
1348
986
|
state.statusMessage =
|
|
1349
987
|
'The vendor updated its Terms of Use — please re-accept.';
|
|
1350
988
|
});
|
|
1351
|
-
}, _KycController_buildUkycSessionVendorFields = function _KycController_buildUkycSessionVendorFields() {
|
|
1352
|
-
if (this.state.activeVendor === 'moonpay') {
|
|
1353
|
-
return {
|
|
1354
|
-
vendor: 'moonpay',
|
|
1355
|
-
vendorMetadata: {
|
|
1356
|
-
moonPayAccessToken: this.state.accessToken,
|
|
1357
|
-
moonPayUserId: this.state.moonpayCustomerId,
|
|
1358
|
-
},
|
|
1359
|
-
};
|
|
1360
|
-
}
|
|
1361
|
-
return { vendor: this.state.activeVendor };
|
|
1362
|
-
}, _KycController_fetchAndApplyUserStatus =
|
|
1363
|
-
/**
|
|
1364
|
-
* Fetches `GET /kyc/status` and applies it to state without managing the
|
|
1365
|
-
* poll loop (used by both {@link refreshKycStatus} and the poll tick).
|
|
1366
|
-
*
|
|
1367
|
-
* @returns The latest status payload.
|
|
1368
|
-
*/
|
|
1369
|
-
async function _KycController_fetchAndApplyUserStatus() {
|
|
1370
|
-
const generation = __classPrivateFieldGet(this, _KycController_generation, "f");
|
|
1371
|
-
const response = await this.messenger.call('KycService:fetchKycStatus');
|
|
1372
|
-
if (__classPrivateFieldGet(this, _KycController_generation, "f") !== generation) {
|
|
1373
|
-
return {
|
|
1374
|
-
status: this.state.userStatus ?? 'not-started',
|
|
1375
|
-
sumsubSessionId: this.state.userStatusSumsubSessionId,
|
|
1376
|
-
errorCode: this.state.userStatusErrorCode,
|
|
1377
|
-
};
|
|
1378
|
-
}
|
|
1379
|
-
const payload = {
|
|
1380
|
-
status: response.status,
|
|
1381
|
-
sumsubSessionId: response.sumsubSessionId ?? null,
|
|
1382
|
-
errorCode: response.errorCode ?? null,
|
|
1383
|
-
};
|
|
1384
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUserStatus).call(this, payload);
|
|
1385
|
-
return payload;
|
|
1386
|
-
}, _KycController_applyUserStatus = function _KycController_applyUserStatus(payload) {
|
|
1387
|
-
const previous = this.state.userStatus;
|
|
1388
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_applyUpdate).call(this, (state) => {
|
|
1389
|
-
state.userStatus = payload.status;
|
|
1390
|
-
state.userStatusSumsubSessionId = payload.sumsubSessionId;
|
|
1391
|
-
state.userStatusErrorCode = payload.errorCode;
|
|
1392
|
-
});
|
|
1393
|
-
if (previous !== payload.status) {
|
|
1394
|
-
this.messenger.publish(`${exports.controllerName}:statusChanged`, payload);
|
|
1395
|
-
}
|
|
1396
|
-
}, _KycController_ensureUserStatusPolling = function _KycController_ensureUserStatusPolling() {
|
|
1397
|
-
if (__classPrivateFieldGet(this, _KycController_userStatusPolling, "f")) {
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
__classPrivateFieldSet(this, _KycController_userStatusPolling, true, "f");
|
|
1401
|
-
const token = __classPrivateFieldGet(this, _KycController_userStatusPollToken, "f");
|
|
1402
|
-
const tick = async () => {
|
|
1403
|
-
try {
|
|
1404
|
-
const payload = await __classPrivateFieldGet(this, _KycController_instances, "m", _KycController_fetchAndApplyUserStatus).call(this);
|
|
1405
|
-
// Race with `reset()` / `#stopUserStatusPolling` while the request was
|
|
1406
|
-
// in flight — do not reschedule onto an idle controller.
|
|
1407
|
-
/* istanbul ignore next */
|
|
1408
|
-
if (__classPrivateFieldGet(this, _KycController_userStatusPollToken, "f") !== token) {
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
if (payload.status !== 'pending') {
|
|
1412
|
-
__classPrivateFieldGet(this, _KycController_instances, "m", _KycController_stopUserStatusPolling).call(this);
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
catch {
|
|
1417
|
-
// Keep polling on transient errors, unless the loop was superseded.
|
|
1418
|
-
/* istanbul ignore next */
|
|
1419
|
-
if (__classPrivateFieldGet(this, _KycController_userStatusPollToken, "f") !== token) {
|
|
1420
|
-
return;
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollTimer, setTimeout(() => {
|
|
1424
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollTimer, null, "f");
|
|
1425
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1426
|
-
tick();
|
|
1427
|
-
}, __classPrivateFieldGet(this, _KycController_userStatusPollIntervalMs, "f")), "f");
|
|
1428
|
-
// Allow the process to exit while a pending-status poll is scheduled.
|
|
1429
|
-
// React Native / browser timers are numbers with no `unref`, hence the
|
|
1430
|
-
// optional call.
|
|
1431
|
-
__classPrivateFieldGet(this, _KycController_userStatusPollTimer, "f").unref?.();
|
|
1432
|
-
};
|
|
1433
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollTimer, setTimeout(() => {
|
|
1434
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollTimer, null, "f");
|
|
1435
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1436
|
-
tick();
|
|
1437
|
-
}, __classPrivateFieldGet(this, _KycController_userStatusPollIntervalMs, "f")), "f");
|
|
1438
|
-
__classPrivateFieldGet(this, _KycController_userStatusPollTimer, "f").unref?.();
|
|
1439
|
-
}, _KycController_stopUserStatusPolling = function _KycController_stopUserStatusPolling() {
|
|
1440
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollToken, __classPrivateFieldGet(this, _KycController_userStatusPollToken, "f") + 1, "f");
|
|
1441
|
-
__classPrivateFieldSet(this, _KycController_userStatusPolling, false, "f");
|
|
1442
|
-
if (__classPrivateFieldGet(this, _KycController_userStatusPollTimer, "f") !== null) {
|
|
1443
|
-
clearTimeout(__classPrivateFieldGet(this, _KycController_userStatusPollTimer, "f"));
|
|
1444
|
-
__classPrivateFieldSet(this, _KycController_userStatusPollTimer, null, "f");
|
|
1445
|
-
}
|
|
1446
989
|
}, _KycController_startSessionStatusPolling =
|
|
1447
990
|
/**
|
|
1448
991
|
* Begins polling the UKYC session status until a terminal decision is
|
|
@@ -1528,9 +1071,7 @@ async function _KycController_pollSessionStatusOnce(sessionId, token) {
|
|
|
1528
1071
|
return true;
|
|
1529
1072
|
}, _KycController_applyUpdate = function _KycController_applyUpdate(updater) {
|
|
1530
1073
|
this.update((state) => {
|
|
1531
|
-
//
|
|
1532
|
-
// TS2589, so the directive is unused and fails the build.
|
|
1533
|
-
// type issue only happens at the IDE level.
|
|
1074
|
+
// @ts-expect-error Avoid "type instantiation is excessively deep".
|
|
1534
1075
|
updater(state);
|
|
1535
1076
|
});
|
|
1536
1077
|
}, _KycController_fail = function _KycController_fail(message) {
|