@metamask-previews/kyc-controller 0.3.0-preview-3e86f66f7 → 0.4.0-preview-9324e33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/KycController-method-action-types.d.ts +97 -195
  3. package/dist/KycController-method-action-types.d.ts.map +1 -1
  4. package/dist/KycController-method-action-types.js.map +1 -1
  5. package/dist/KycController.d.ts +93 -275
  6. package/dist/KycController.d.ts.map +1 -1
  7. package/dist/KycController.js +367 -1700
  8. package/dist/KycController.js.map +1 -1
  9. package/dist/KycService-method-action-types.d.ts +16 -26
  10. package/dist/KycService-method-action-types.d.ts.map +1 -1
  11. package/dist/KycService-method-action-types.js.map +1 -1
  12. package/dist/KycService.d.ts +12 -40
  13. package/dist/KycService.d.ts.map +1 -1
  14. package/dist/KycService.js +37 -73
  15. package/dist/KycService.js.map +1 -1
  16. package/dist/index.d.ts +9 -6
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/providers/sumsub.d.ts +90 -0
  21. package/dist/providers/sumsub.d.ts.map +1 -0
  22. package/dist/providers/sumsub.js +31 -0
  23. package/dist/providers/sumsub.js.map +1 -0
  24. package/dist/selectors.d.ts +7 -14
  25. package/dist/selectors.d.ts.map +1 -1
  26. package/dist/selectors.js +6 -15
  27. package/dist/selectors.js.map +1 -1
  28. package/dist/sessionDisclaimers.d.ts +18 -0
  29. package/dist/sessionDisclaimers.d.ts.map +1 -0
  30. package/dist/sessionDisclaimers.js +30 -0
  31. package/dist/sessionDisclaimers.js.map +1 -0
  32. package/dist/types.d.ts +20 -108
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/types.js +21 -1
  35. package/dist/types.js.map +1 -1
  36. package/dist/ukyc/jwtChain.d.ts +20 -0
  37. package/dist/ukyc/jwtChain.d.ts.map +1 -1
  38. package/dist/ukyc/jwtChain.js +15 -0
  39. package/dist/ukyc/jwtChain.js.map +1 -1
  40. package/dist/ukyc/localUserSecret.d.ts +26 -10
  41. package/dist/ukyc/localUserSecret.d.ts.map +1 -1
  42. package/dist/ukyc/localUserSecret.js +32 -0
  43. package/dist/ukyc/localUserSecret.js.map +1 -1
  44. package/dist/{vendorDisclaimerAcceptance.d.ts → vendorDisclaimers.d.ts} +23 -4
  45. package/dist/vendorDisclaimers.d.ts.map +1 -0
  46. package/dist/{vendorDisclaimerAcceptance.js → vendorDisclaimers.js} +30 -8
  47. package/dist/vendorDisclaimers.js.map +1 -0
  48. package/dist/vendors/MoonPayFrameHandler.d.ts.map +1 -1
  49. package/dist/vendors/MoonPayFrameHandler.js +0 -1
  50. package/dist/vendors/MoonPayFrameHandler.js.map +1 -1
  51. package/package.json +2 -3
  52. package/dist/logger.d.ts +0 -5
  53. package/dist/logger.d.ts.map +0 -1
  54. package/dist/logger.js +0 -6
  55. package/dist/logger.js.map +0 -1
  56. package/dist/ukyc/wrappedRelayPayload.d.ts +0 -35
  57. package/dist/ukyc/wrappedRelayPayload.d.ts.map +0 -1
  58. package/dist/ukyc/wrappedRelayPayload.js +0 -28
  59. package/dist/ukyc/wrappedRelayPayload.js.map +0 -1
  60. package/dist/vendorDisclaimerAcceptance.d.ts.map +0 -1
  61. package/dist/vendorDisclaimerAcceptance.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0]
11
+
12
+ ### Added
13
+
14
+ - Export `MoonPayFrameHandler`, `MoonPayFrameHandlerOptions`, and `clearMoonPaySession` so clients can own MoonPay Check/Auth frames after those methods left `KycController` ([#10293](https://github.com/MetaMask/core/pull/10293))
15
+ - Add `sessionStatus` (`KycSessionStatus | null`) to `KycControllerState` ([#10293](https://github.com/MetaMask/core/pull/10293))
16
+ - Add `KycService.getSessionStatusForVendor`, which fetches `GET /sessions/latest/status/{vendor}` and returns `KycSessionStatus` or `null` ([#10293](https://github.com/MetaMask/core/pull/10293))
17
+ - Add `KycController.fetchVendorDisclaimers`, which loads vendor T&Cs via `KycService.fetchVendorDisclaimers` ([#10293](https://github.com/MetaMask/core/pull/10293))
18
+ - Add `KycController.hasCompletedVendorDisclaimers`, which fetches the vendor T&C catalog and returns whether persisted `vendorDisclaimersAccepted` covers every fetched disclaimer ([#10293](https://github.com/MetaMask/core/pull/10293))
19
+ - Add `KycController.recordVendorDisclaimers`, which records vendor T&Cs via `KycService.submitVendorDisclaimers` and persists accepted ids on state ([#10293](https://github.com/MetaMask/core/pull/10293))
20
+ - Add `KycController.startSession`, which reuses the latest vendor session when one exists and otherwise creates the vendor customer and a UKYC session ([#10293](https://github.com/MetaMask/core/pull/10293))
21
+ - Add `KycController.launchProviderFlow`, which presents the identity-provider (SumSub) verification UI ([#10293](https://github.com/MetaMask/core/pull/10293))
22
+ - Add `KycController.startSessionStatusPolling`, which polls `GET /sessions/{id}/status` for `state.sessionStatus.id` until `finalStatus` is `approved`, `rejected`, or `retry` ([#10293](https://github.com/MetaMask/core/pull/10293))
23
+ - Expose current `KycController` methods as messenger actions: `startSession`, `reset`, `clearState`, `getSessionStatusForVendor`, `refreshSessionStatus`, `startSessionStatusPolling`, `fetchSessionDisclaimers`, `recordSessionDisclaimers`, `hasCompletedSessionDisclaimers`, `fetchVendorDisclaimers`, `recordVendorDisclaimers`, `hasCompletedVendorDisclaimers`, and `launchProviderFlow` ([#10293](https://github.com/MetaMask/core/pull/10293))
24
+
25
+ ### Changed
26
+
27
+ - **BREAKING:** Add required `id` to `KycSessionStatus` ([#10293](https://github.com/MetaMask/core/pull/10293))
28
+ - **BREAKING:** Rename `CreateSessionParams` to `CreateMoonpaySessionParams`, and `KycService.createSession` / `KycService:createSession` to `createMoonpaySession` / `KycService:createMoonpaySession` ([#10293](https://github.com/MetaMask/core/pull/10293))
29
+ - `MoonPayFrameHandler.buildCheckFrameUrl` no longer sets the `skipKyc` query parameter ([#10293](https://github.com/MetaMask/core/pull/10293))
30
+ - Bump `@metamask/profile-sync-controller` from `^32.1.0` to `^32.1.1` ([#10220](https://github.com/MetaMask/core/pull/10220))
31
+
32
+ ### Removed
33
+
34
+ - **BREAKING:** Remove unused `KycCustomerIdentity` ([#10293](https://github.com/MetaMask/core/pull/10293))
35
+ - **BREAKING:** Remove `sessionStatusPollIntervalMs` and `userStatusPollIntervalMs` from `KycControllerOptions`, and stop automatic session-status and user-status polling. Session-status polling is now opt-in through `startSessionStatusPolling` or `refreshSessionStatus` ([#10293](https://github.com/MetaMask/core/pull/10293))
36
+ - **BREAKING:** Remove the `reselect` dependency ([#10293](https://github.com/MetaMask/core/pull/10293))
37
+ - **BREAKING:** Remove the `polling` value from `KycSumSubStatus` ([#10293](https://github.com/MetaMask/core/pull/10293))
38
+ - **BREAKING:** Remove MoonPay Check/Auth frame methods from `KycController`: `handleFrameMessage`, `buildCheckFrameUrl`, `buildAuthFrameUrl`, and `buildResetFrameUrl`. Use `MoonPayFrameHandler` directly for frame protocol, URLs, and message handling ([#10293](https://github.com/MetaMask/core/pull/10293))
39
+ - **BREAKING:** Remove `KycService.checkKycRequired`, `CheckKycRequiredParams`, and the `KycService:checkKycRequired` messenger action ([#10293](https://github.com/MetaMask/core/pull/10293))
40
+ - **BREAKING:** Remove `KycService.fetchKycStatus`, `KycService:fetchKycStatus`, `KycController.refreshKycStatus`, `KycController:refreshKycStatus`, `KycUserStatus`, `KycUserStatusResponse`, and `KycController:statusChanged` (`KycControllerStatusChangedEvent`) ([#10293](https://github.com/MetaMask/core/pull/10293))
41
+ - **BREAKING:** Replace the previous `KycController` messenger method actions. Removed: `initialize`, `createVendorCustomer`, `loadDisclaimers`, `acceptTermsAndStartSession`, `clearSavedTerms`, `checkKycRequired`, `getKycStatus`, `getCustomerIdentity`, `startSumSub`, and `getSessionStatus` ([#10293](https://github.com/MetaMask/core/pull/10293))
42
+ - **BREAKING:** Replace `selectKycPhase`, `selectKycSumSub`, and `selectIsKycRequiredForProduct` with `selectKycVendor` and `selectKycSessionStatus` ([#10293](https://github.com/MetaMask/core/pull/10293))
43
+
10
44
  ## [0.3.0]
11
45
 
12
46
  ### Added
@@ -46,7 +80,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
46
80
 
47
81
  - Initial Release ([#10145](https://github.com/MetaMask/core/pull/10145))
48
82
 
49
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/kyc-controller@0.3.0...HEAD
83
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/kyc-controller@0.4.0...HEAD
84
+ [0.4.0]: https://github.com/MetaMask/core/compare/@metamask/kyc-controller@0.3.0...@metamask/kyc-controller@0.4.0
50
85
  [0.3.0]: https://github.com/MetaMask/core/compare/@metamask/kyc-controller@0.2.0...@metamask/kyc-controller@0.3.0
51
86
  [0.2.0]: https://github.com/MetaMask/core/compare/@metamask/kyc-controller@0.1.0...@metamask/kyc-controller@0.2.0
52
87
  [0.1.0]: https://github.com/MetaMask/core/releases/tag/@metamask/kyc-controller@0.1.0
@@ -4,49 +4,65 @@
4
4
  */
5
5
  import type { KycController } from './KycController.js';
6
6
  /**
7
- * Resolves persisted terms + geolocation, and auto-creates a session when
8
- * terms are already accepted and an email is available.
7
+ * Starts a KYC session for the given vendor and email. Reuses a latest
8
+ * vendor session when one exists; otherwise creates a UKYC session.
9
9
  *
10
- * @param params - Optional parameters.
11
- * @param params.email - The account email to associate with the session.
12
- * @param params.product - The consuming feature the flow runs for. When
13
- * provided, the controller automatically runs the KYC-required check once
14
- * authentication completes (and chains into document verification when KYC
15
- * is required). When omitted, the flow stops at `form` and the consumer must
16
- * call `checkKycRequired` manually.
17
- * @param params.vendor - Identity vendor for this flow. Non-MoonPay vendors
18
- * skip Check/Auth frames and use the consents path. Defaults to `moonpay`.
10
+ * @param params - The session parameters.
11
+ * @param params.vendor - Identity vendor for the session.
12
+ * @param params.email - Account email associated with the session.
13
+ * @returns The current or newly created session status.
19
14
  */
20
- export type KycControllerInitializeAction = {
21
- type: `KycController:initialize`;
22
- handler: KycController['initialize'];
15
+ export type KycControllerStartSessionAction = {
16
+ type: `KycController:startSession`;
17
+ handler: KycController['startSession'];
23
18
  };
24
19
  /**
25
- * Creates (or resumes) an empty-shell customer for the given identity
26
- * vendor. Exposed so a consumer can ensure the customer exists before
27
- * showing T&C screens independently of {@link initialize}.
20
+ * Stops session-status polling and restores default controller state.
21
+ */
22
+ export type KycControllerResetAction = {
23
+ type: `KycController:reset`;
24
+ handler: KycController['reset'];
25
+ };
26
+ /**
27
+ * Restores the controller to its default state.
28
+ */
29
+ export type KycControllerClearStateAction = {
30
+ type: `KycController:clearState`;
31
+ handler: KycController['clearState'];
32
+ };
33
+ /**
34
+ * Fetches the latest UKYC session status for a vendor.
28
35
  *
29
- * A call while a session flow is already in progress is a no-op — matching
30
- * {@link initialize} so a vendor switch cannot leave Check/Auth frames
31
- * attached to the wrong vendor. Call {@link reset} first to start over.
36
+ * @param vendor - Identity vendor whose latest session should be queried.
37
+ * @returns The session status, or `null` when none exists.
38
+ */
39
+ export type KycControllerGetSessionStatusForVendorAction = {
40
+ type: `KycController:getSessionStatusForVendor`;
41
+ handler: KycController['getSessionStatusForVendor'];
42
+ };
43
+ /**
44
+ * Returns the current session status and starts polling when it is not yet
45
+ * terminal.
32
46
  *
33
- * @param params - The parameters.
34
- * @param params.vendor - Identity vendor for the customer.
35
- * @param params.email - Email for the vendor customer.
47
+ * @returns The current session status.
48
+ * @throws If there is no session on state.
36
49
  */
37
- export type KycControllerCreateVendorCustomerAction = {
38
- type: `KycController:createVendorCustomer`;
39
- handler: KycController['createVendorCustomer'];
50
+ export type KycControllerRefreshSessionStatusAction = {
51
+ type: `KycController:refreshSessionStatus`;
52
+ handler: KycController['refreshSessionStatus'];
40
53
  };
41
54
  /**
42
- * Loads the disclaimers for the resolved (or provided) country.
55
+ * Starts polling `GET /sessions/{id}/status` for
56
+ * {@link KycControllerState.sessionStatus}'s current `id`. Each tick writes
57
+ * the result onto state only when the payload changed. The loop stops once
58
+ * `finalStatus` is `approved`, `rejected`, or `retry`, or when
59
+ * {@link reset} / {@link clearState} runs.
43
60
  *
44
- * @param params - Optional parameters.
45
- * @param params.country - ISO 3166-1 alpha-3 country code override.
61
+ * @throws If there is no current session id to poll.
46
62
  */
47
- export type KycControllerLoadDisclaimersAction = {
48
- type: `KycController:loadDisclaimers`;
49
- handler: KycController['loadDisclaimers'];
63
+ export type KycControllerStartSessionStatusPollingAction = {
64
+ type: `KycController:startSessionStatusPolling`;
65
+ handler: KycController['startSessionStatusPolling'];
50
66
  };
51
67
  /**
52
68
  * Fetches the idOS + KYC-provider disclaimer catalog. Pass exactly one of
@@ -71,197 +87,83 @@ export type KycControllerFetchSessionDisclaimersAction = {
71
87
  handler: KycController['fetchSessionDisclaimers'];
72
88
  };
73
89
  /**
74
- * Captures terms acceptance for the currently loaded disclaimers and creates
75
- * a session.
90
+ * Fetches the session-scoped disclaimer catalog and records consents
91
+ * derived from the T&C2 flags. Already-consented catalog rows are omitted
92
+ * from the POST. A 409 is re-checked with a GET: continue only when every
93
+ * accepted document is now consented, otherwise fail closed.
76
94
  *
77
- * @param params - The parameters.
78
- * @param params.email - The account email to associate with the session.
79
- * @param params.product - The consuming feature the flow runs for. See
80
- * {@link initialize} for how the product drives the automatic post
81
- * authentication continuation.
82
- * @param params.providerDisclaimersAccepted - Sumsub disclaimer documents the
83
- * customer accepted (`{ key, version }` records). Required for every vendor
84
- * so callers explicitly declare acceptance.
85
- * @param params.idosDisclaimersAccepted - idOS disclaimer documents the
86
- * customer accepted (`{ key, version }` records). Required for every vendor
87
- * so callers explicitly declare acceptance.
88
- * @param params.credentialReusabilityConsentGiven - Whether the customer
89
- * consented to reuse existing idOS credentials. Used when recording
90
- * session-scoped disclaimers on the consents path. Defaults to `false`.
91
- */
92
- export type KycControllerAcceptTermsAndStartSessionAction = {
93
- type: `KycController:acceptTermsAndStartSession`;
94
- handler: KycController['acceptTermsAndStartSession'];
95
- };
96
- /**
97
- * Clears the persisted terms acceptance.
95
+ * @param params - Accepted session-disclaimer records.
96
+ * @param params.providerDisclaimersAccepted - Accepted Sumsub disclaimer records.
97
+ * @param params.idosDisclaimersAccepted - Accepted idOS disclaimer records.
98
+ * @param params.credentialReusabilityConsentGiven - Whether credential
99
+ * reuse was accepted.
98
100
  */
99
- export type KycControllerClearSavedTermsAction = {
100
- type: `KycController:clearSavedTerms`;
101
- handler: KycController['clearSavedTerms'];
101
+ export type KycControllerRecordSessionDisclaimersAction = {
102
+ type: `KycController:recordSessionDisclaimers`;
103
+ handler: KycController['recordSessionDisclaimers'];
102
104
  };
103
105
  /**
104
- * Handles a message posted by a Check/Auth frame and advances the flow.
106
+ * Fetches session-scoped disclaimers and reports whether every document is
107
+ * consented and credential reuse was accepted.
105
108
  *
106
- * The transport-agnostic caller (WebView on mobile, iframe on web) forwards
107
- * the raw message and injects the returned `reply` back into the frame.
108
- *
109
- * @param params - The parameters.
110
- * @param params.message - The raw message posted by the frame.
111
- * @returns An object whose optional `reply` should be posted back.
109
+ * @returns Whether session disclaimers are complete.
110
+ * @throws If there is no session on state.
112
111
  */
113
- export type KycControllerHandleFrameMessageAction = {
114
- type: `KycController:handleFrameMessage`;
115
- handler: KycController['handleFrameMessage'];
112
+ export type KycControllerHasCompletedSessionDisclaimersAction = {
113
+ type: `KycController:hasCompletedSessionDisclaimers`;
114
+ handler: KycController['hasCompletedSessionDisclaimers'];
116
115
  };
117
116
  /**
118
- * Builds the Check-frame URL, or `null` when no session exists yet.
119
- *
120
- * @returns The Check-frame URL or `null`.
121
- */
122
- export type KycControllerBuildCheckFrameUrlAction = {
123
- type: `KycController:buildCheckFrameUrl`;
124
- handler: KycController['buildCheckFrameUrl'];
125
- };
126
- /**
127
- * Builds the Auth-frame URL, or `null` when no client token is available.
128
- *
129
- * @returns The Auth-frame URL or `null`.
130
- */
131
- export type KycControllerBuildAuthFrameUrlAction = {
132
- type: `KycController:buildAuthFrameUrl`;
133
- handler: KycController['buildAuthFrameUrl'];
134
- };
135
- /**
136
- * Builds the Reset-frame URL.
137
- *
138
- * @returns The Reset-frame URL.
139
- */
140
- export type KycControllerBuildResetFrameUrlAction = {
141
- type: `KycController:buildResetFrameUrl`;
142
- handler: KycController['buildResetFrameUrl'];
143
- };
144
- /**
145
- * Checks whether KYC is required for a product and caches the result.
117
+ * Fetches the vendor T&Cs the customer must accept before a session is
118
+ * created (`GET /vendors/{vendor}/disclaimers?country=`).
146
119
  *
147
120
  * @param params - The parameters.
148
- * @param params.product - The consuming feature.
149
- * @param params.country - Optional alpha-3 country override.
150
- * @returns Whether KYC is required.
121
+ * @param params.vendor - Identity vendor. Defaults to `moonpay`.
122
+ * @param params.country - ISO 3166-1 alpha-3 country code.
123
+ * @returns The disclaimers.
151
124
  */
152
- export type KycControllerCheckKycRequiredAction = {
153
- type: `KycController:checkKycRequired`;
154
- handler: KycController['checkKycRequired'];
125
+ export type KycControllerFetchVendorDisclaimersAction = {
126
+ type: `KycController:fetchVendorDisclaimers`;
127
+ handler: KycController['fetchVendorDisclaimers'];
155
128
  };
156
129
  /**
157
- * Reads the cached "is KYC required" result for a product.
130
+ * Records vendor T&C acceptance via {@link KycService.submitVendorDisclaimers}
131
+ * and persists the accepted ids on state.
158
132
  *
159
133
  * @param params - The parameters.
160
- * @param params.product - The consuming feature.
161
- * @returns The cached value, or `undefined` if not yet checked.
134
+ * @param params.disclaimerIds - Accepted vendor T&C ids.
135
+ * @returns The vendor signing records.
136
+ * @throws If `vendor` is missing from state.
162
137
  */
163
- export type KycControllerGetKycStatusAction = {
164
- type: `KycController:getKycStatus`;
165
- handler: KycController['getKycStatus'];
138
+ export type KycControllerRecordVendorDisclaimersAction = {
139
+ type: `KycController:recordVendorDisclaimers`;
140
+ handler: KycController['recordVendorDisclaimers'];
166
141
  };
167
142
  /**
168
- * Returns the vendor-scoped identity for the currently authenticated
169
- * customer, or `null` when the flow has not yet captured a vendor customer
170
- * id (before authentication or after {@link reset}), or when a MoonPay id
171
- * is present under a different `activeVendor`.
143
+ * Fetches the current vendor T&C catalog and returns whether every document
144
+ * is already recorded in {@link KycControllerState.vendorDisclaimersAccepted}.
172
145
  *
173
- * Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor
174
- * customer id to downstream calls without reading the full KYC state, which
175
- * also holds session/access tokens. The id is session-scoped and never
176
- * persisted.
177
- *
178
- * @returns The current {@link KycCustomerIdentity}, or `null`.
146
+ * @returns Whether persisted acceptance covers the fetched catalog.
147
+ * @throws If `vendor` or `geoCountry` is missing from state.
179
148
  */
180
- export type KycControllerGetCustomerIdentityAction = {
181
- type: `KycController:getCustomerIdentity`;
182
- handler: KycController['getCustomerIdentity'];
149
+ export type KycControllerHasCompletedVendorDisclaimersAction = {
150
+ type: `KycController:hasCompletedVendorDisclaimers`;
151
+ handler: KycController['hasCompletedVendorDisclaimers'];
183
152
  };
184
153
  /**
185
- * Runs the SumSub document-verification sub-flow end to end:
186
- *
187
- * 1. creates a UKYC session, receiving per-secret encryption schemas;
188
- * 2. verifies the `encryptionDataKey` schema's `jwtChain` against the
189
- * idOS enclave JWKS and the `ukycCapabilityToken` schema's `jwtChain` against
190
- * the idOS relay JWKS, then confirms each attested session server public
191
- * key;
192
- * 3. derives the `data_encryption_key` from the wallet's UKYC
193
- * `local_user_secret` and wraps it for the session server;
194
- * 4. mints a client-signed, read-only `ukyc_capability_token`, wraps it the
195
- * same way as the encryption key, and submits both via authorizations;
196
- * 5. fetches the SumSub applicant access token; and
197
- * 6. presents the SDK via the injected launcher.
198
- *
199
- * If a UKYC session already exists (the consents path creates it before
200
- * recording session disclaimers), steps 1–4 are skipped.
201
- *
202
- * If authorizations report the applicant is already approved on the relay
203
- * while the vendor is still finalizing (`kycStatus: approved`,
204
- * `finalStatus: pending`), the sub-flow stops at step 4 with a
205
- * `vendorProcessing` status and a message rather than launching the SDK.
154
+ * Presents the identity-provider verification UI. Currently launches SumSub.
206
155
  *
207
- * @param params - Optional parameters.
156
+ * @param params - Optional SDK presentation options.
208
157
  * @param params.locale - BCP-47 locale for the SDK UI.
209
158
  * @param params.debug - Enables SDK debug logging.
210
- * @returns The SDK result.
211
- */
212
- export type KycControllerStartSumSubAction = {
213
- type: `KycController:startSumSub`;
214
- handler: KycController['startSumSub'];
215
- };
216
- /**
217
- * Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
218
- * stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
219
- * schedules short-interval polling while the status is `pending`.
220
- *
221
- * Skipped when `userStatus` is already `completed`: a follow-up
222
- * `GET /kyc/status` can still read a stale `pending` (for example after
223
- * `session_not_in_valid_state`) and must not undo that decision.
224
- *
225
- * @returns The latest status payload.
226
- */
227
- export type KycControllerRefreshKycStatusAction = {
228
- type: `KycController:refreshKycStatus`;
229
- handler: KycController['refreshKycStatus'];
230
- };
231
- /**
232
- * Fetches the current UKYC session status for the active sub-flow and records
233
- * it on state. Useful for a one-off refresh outside the automatic polling
234
- * loop that {@link startSumSub} runs.
235
- *
236
- * @returns The fetched session status.
237
- * @throws If there is no active SumSub session to query.
238
- */
239
- export type KycControllerGetSessionStatusAction = {
240
- type: `KycController:getSessionStatus`;
241
- handler: KycController['getSessionStatus'];
242
- };
243
- /**
244
- * Resets the flow to idle, clearing session tokens and sub-flow state while
245
- * preserving persisted terms acceptance and the per-product cache.
159
+ * @returns A promise that settles when the provider flow finishes.
246
160
  */
247
- export type KycControllerResetAction = {
248
- type: `KycController:reset`;
249
- handler: KycController['reset'];
250
- };
251
- /**
252
- * Restores the controller to its default state, discarding everything
253
- * {@link reset} deliberately keeps: the session email, the persisted terms
254
- * acceptance, the per-product KYC-required cache and the user-keyed status.
255
- *
256
- * Intended for a full wallet reset, where no trace of the previous
257
- * customer may survive into the next wallet.
258
- */
259
- export type KycControllerClearStateAction = {
260
- type: `KycController:clearState`;
261
- handler: KycController['clearState'];
161
+ export type KycControllerLaunchProviderFlowAction = {
162
+ type: `KycController:launchProviderFlow`;
163
+ handler: KycController['launchProviderFlow'];
262
164
  };
263
165
  /**
264
166
  * Union of all KycController action types.
265
167
  */
266
- export type KycControllerMethodActions = KycControllerInitializeAction | KycControllerCreateVendorCustomerAction | KycControllerLoadDisclaimersAction | KycControllerFetchSessionDisclaimersAction | KycControllerAcceptTermsAndStartSessionAction | KycControllerClearSavedTermsAction | KycControllerHandleFrameMessageAction | KycControllerBuildCheckFrameUrlAction | KycControllerBuildAuthFrameUrlAction | KycControllerBuildResetFrameUrlAction | KycControllerCheckKycRequiredAction | KycControllerGetKycStatusAction | KycControllerGetCustomerIdentityAction | KycControllerStartSumSubAction | KycControllerRefreshKycStatusAction | KycControllerGetSessionStatusAction | KycControllerResetAction | KycControllerClearStateAction;
168
+ export type KycControllerMethodActions = KycControllerStartSessionAction | KycControllerResetAction | KycControllerClearStateAction | KycControllerGetSessionStatusForVendorAction | KycControllerRefreshSessionStatusAction | KycControllerStartSessionStatusPollingAction | KycControllerFetchSessionDisclaimersAction | KycControllerRecordSessionDisclaimersAction | KycControllerHasCompletedSessionDisclaimersAction | KycControllerFetchVendorDisclaimersAction | KycControllerRecordVendorDisclaimersAction | KycControllerHasCompletedVendorDisclaimersAction | KycControllerLaunchProviderFlowAction;
267
169
  //# sourceMappingURL=KycController-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.d.ts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CA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AA6B,GAC7B,uCAAuC,GACvC,kCAAkC,GAClC,0CAA0C,GAC1C,6CAA6C,GAC7C,kCAAkC,GAClC,qCAAqC,GACrC,qCAAqC,GACrC,oCAAoC,GACpC,qCAAqC,GACrC,mCAAmC,GACnC,+BAA+B,GAC/B,sCAAsC,GACtC,8BAA8B,GAC9B,mCAAmC,GACnC,mCAAmC,GACnC,wBAAwB,GACxB,6BAA6B,CAAC"}
1
+ {"version":3,"file":"KycController-method-action-types.d.ts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAA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AA0C,GAC1C,2CAA2C,GAC3C,iDAAiD,GACjD,yCAAyC,GACzC,0CAA0C,GAC1C,gDAAgD,GAChD,qCAAqC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.js","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycController } from './KycController.js';\n\n/**\n * Resolves persisted terms + geolocation, and auto-creates a session when\n * terms are already accepted and an email is available.\n *\n * @param params - Optional parameters.\n * @param params.email - The account email to associate with the session.\n * @param params.product - The consuming feature the flow runs for. When\n * provided, the controller automatically runs the KYC-required check once\n * authentication completes (and chains into document verification when KYC\n * is required). When omitted, the flow stops at `form` and the consumer must\n * call `checkKycRequired` manually.\n * @param params.vendor - Identity vendor for this flow. Non-MoonPay vendors\n * skip Check/Auth frames and use the consents path. Defaults to `moonpay`.\n */\nexport type KycControllerInitializeAction = {\n type: `KycController:initialize`;\n handler: KycController['initialize'];\n};\n\n/**\n * Creates (or resumes) an empty-shell customer for the given identity\n * vendor. Exposed so a consumer can ensure the customer exists before\n * showing T&C screens independently of {@link initialize}.\n *\n * A call while a session flow is already in progress is a no-op — matching\n * {@link initialize} — so a vendor switch cannot leave Check/Auth frames\n * attached to the wrong vendor. Call {@link reset} first to start over.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor for the customer.\n * @param params.email - Email for the vendor customer.\n */\nexport type KycControllerCreateVendorCustomerAction = {\n type: `KycController:createVendorCustomer`;\n handler: KycController['createVendorCustomer'];\n};\n\n/**\n * Loads the disclaimers for the resolved (or provided) country.\n *\n * @param params - Optional parameters.\n * @param params.country - ISO 3166-1 alpha-3 country code override.\n */\nexport type KycControllerLoadDisclaimersAction = {\n type: `KycController:loadDisclaimers`;\n handler: KycController['loadDisclaimers'];\n};\n\n/**\n * Fetches the idOS + KYC-provider disclaimer catalog. Pass exactly one of\n * `sessionId` or `country`:\n *\n * - `{ sessionId }` → {@link KycService.fetchSessionDisclaimersBySessionId}\n * (`GET /sessions/{sessionId}/disclaimers`)\n * - `{ country }` → {@link KycService.fetchSessionDisclaimersByCountry}\n * (`GET /disclaimers?country=`)\n *\n * A session-id fetch also writes the catalog to `sessionDisclaimers`.\n *\n * @param params - The parameters. Provide exactly one of `sessionId` or\n * `country`.\n * @param params.sessionId - The UKYC session id.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The catalog. Session fetches include consent state; country\n * fetches do not.\n */\nexport type KycControllerFetchSessionDisclaimersAction = {\n type: `KycController:fetchSessionDisclaimers`;\n handler: KycController['fetchSessionDisclaimers'];\n};\n\n/**\n * Captures terms acceptance for the currently loaded disclaimers and creates\n * a session.\n *\n * @param params - The parameters.\n * @param params.email - The account email to associate with the session.\n * @param params.product - The consuming feature the flow runs for. See\n * {@link initialize} for how the product drives the automatic post\n * authentication continuation.\n * @param params.providerDisclaimersAccepted - Sumsub disclaimer documents the\n * customer accepted (`{ key, version }` records). Required for every vendor\n * so callers explicitly declare acceptance.\n * @param params.idosDisclaimersAccepted - idOS disclaimer documents the\n * customer accepted (`{ key, version }` records). Required for every vendor\n * so callers explicitly declare acceptance.\n * @param params.credentialReusabilityConsentGiven - Whether the customer\n * consented to reuse existing idOS credentials. Used when recording\n * session-scoped disclaimers on the consents path. Defaults to `false`.\n */\nexport type KycControllerAcceptTermsAndStartSessionAction = {\n type: `KycController:acceptTermsAndStartSession`;\n handler: KycController['acceptTermsAndStartSession'];\n};\n\n/**\n * Clears the persisted terms acceptance.\n */\nexport type KycControllerClearSavedTermsAction = {\n type: `KycController:clearSavedTerms`;\n handler: KycController['clearSavedTerms'];\n};\n\n/**\n * Handles a message posted by a Check/Auth frame and advances the flow.\n *\n * The transport-agnostic caller (WebView on mobile, iframe on web) forwards\n * the raw message and injects the returned `reply` back into the frame.\n *\n * @param params - The parameters.\n * @param params.message - The raw message posted by the frame.\n * @returns An object whose optional `reply` should be posted back.\n */\nexport type KycControllerHandleFrameMessageAction = {\n type: `KycController:handleFrameMessage`;\n handler: KycController['handleFrameMessage'];\n};\n\n/**\n * Builds the Check-frame URL, or `null` when no session exists yet.\n *\n * @returns The Check-frame URL or `null`.\n */\nexport type KycControllerBuildCheckFrameUrlAction = {\n type: `KycController:buildCheckFrameUrl`;\n handler: KycController['buildCheckFrameUrl'];\n};\n\n/**\n * Builds the Auth-frame URL, or `null` when no client token is available.\n *\n * @returns The Auth-frame URL or `null`.\n */\nexport type KycControllerBuildAuthFrameUrlAction = {\n type: `KycController:buildAuthFrameUrl`;\n handler: KycController['buildAuthFrameUrl'];\n};\n\n/**\n * Builds the Reset-frame URL.\n *\n * @returns The Reset-frame URL.\n */\nexport type KycControllerBuildResetFrameUrlAction = {\n type: `KycController:buildResetFrameUrl`;\n handler: KycController['buildResetFrameUrl'];\n};\n\n/**\n * Checks whether KYC is required for a product and caches the result.\n *\n * @param params - The parameters.\n * @param params.product - The consuming feature.\n * @param params.country - Optional alpha-3 country override.\n * @returns Whether KYC is required.\n */\nexport type KycControllerCheckKycRequiredAction = {\n type: `KycController:checkKycRequired`;\n handler: KycController['checkKycRequired'];\n};\n\n/**\n * Reads the cached \"is KYC required\" result for a product.\n *\n * @param params - The parameters.\n * @param params.product - The consuming feature.\n * @returns The cached value, or `undefined` if not yet checked.\n */\nexport type KycControllerGetKycStatusAction = {\n type: `KycController:getKycStatus`;\n handler: KycController['getKycStatus'];\n};\n\n/**\n * Returns the vendor-scoped identity for the currently authenticated\n * customer, or `null` when the flow has not yet captured a vendor customer\n * id (before authentication or after {@link reset}), or when a MoonPay id\n * is present under a different `activeVendor`.\n *\n * Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor\n * customer id to downstream calls without reading the full KYC state, which\n * also holds session/access tokens. The id is session-scoped and never\n * persisted.\n *\n * @returns The current {@link KycCustomerIdentity}, or `null`.\n */\nexport type KycControllerGetCustomerIdentityAction = {\n type: `KycController:getCustomerIdentity`;\n handler: KycController['getCustomerIdentity'];\n};\n\n/**\n * Runs the SumSub document-verification sub-flow end to end:\n *\n * 1. creates a UKYC session, receiving per-secret encryption schemas;\n * 2. verifies the `encryptionDataKey` schema's `jwtChain` against the\n * idOS enclave JWKS and the `ukycCapabilityToken` schema's `jwtChain` against\n * the idOS relay JWKS, then confirms each attested session server public\n * key;\n * 3. derives the `data_encryption_key` from the wallet's UKYC\n * `local_user_secret` and wraps it for the session server;\n * 4. mints a client-signed, read-only `ukyc_capability_token`, wraps it the\n * same way as the encryption key, and submits both via authorizations;\n * 5. fetches the SumSub applicant access token; and\n * 6. presents the SDK via the injected launcher.\n *\n * If a UKYC session already exists (the consents path creates it before\n * recording session disclaimers), steps 1–4 are skipped.\n *\n * If authorizations report the applicant is already approved on the relay\n * while the vendor is still finalizing (`kycStatus: approved`,\n * `finalStatus: pending`), the sub-flow stops at step 4 with a\n * `vendorProcessing` status and a message rather than launching the SDK.\n *\n * @param params - Optional parameters.\n * @param params.locale - BCP-47 locale for the SDK UI.\n * @param params.debug - Enables SDK debug logging.\n * @returns The SDK result.\n */\nexport type KycControllerStartSumSubAction = {\n type: `KycController:startSumSub`;\n handler: KycController['startSumSub'];\n};\n\n/**\n * Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,\n * stores it on state, publishes {@link KycControllerStatusChangedEvent}, and\n * schedules short-interval polling while the status is `pending`.\n *\n * Skipped when `userStatus` is already `completed`: a follow-up\n * `GET /kyc/status` can still read a stale `pending` (for example after\n * `session_not_in_valid_state`) and must not undo that decision.\n *\n * @returns The latest status payload.\n */\nexport type KycControllerRefreshKycStatusAction = {\n type: `KycController:refreshKycStatus`;\n handler: KycController['refreshKycStatus'];\n};\n\n/**\n * Fetches the current UKYC session status for the active sub-flow and records\n * it on state. Useful for a one-off refresh outside the automatic polling\n * loop that {@link startSumSub} runs.\n *\n * @returns The fetched session status.\n * @throws If there is no active SumSub session to query.\n */\nexport type KycControllerGetSessionStatusAction = {\n type: `KycController:getSessionStatus`;\n handler: KycController['getSessionStatus'];\n};\n\n/**\n * Resets the flow to idle, clearing session tokens and sub-flow state while\n * preserving persisted terms acceptance and the per-product cache.\n */\nexport type KycControllerResetAction = {\n type: `KycController:reset`;\n handler: KycController['reset'];\n};\n\n/**\n * Restores the controller to its default state, discarding everything\n * {@link reset} deliberately keeps: the session email, the persisted terms\n * acceptance, the per-product KYC-required cache and the user-keyed status.\n *\n * Intended for a full wallet reset, where no trace of the previous\n * customer may survive into the next wallet.\n */\nexport type KycControllerClearStateAction = {\n type: `KycController:clearState`;\n handler: KycController['clearState'];\n};\n\n/**\n * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerInitializeAction\n | KycControllerCreateVendorCustomerAction\n | KycControllerLoadDisclaimersAction\n | KycControllerFetchSessionDisclaimersAction\n | KycControllerAcceptTermsAndStartSessionAction\n | KycControllerClearSavedTermsAction\n | KycControllerHandleFrameMessageAction\n | KycControllerBuildCheckFrameUrlAction\n | KycControllerBuildAuthFrameUrlAction\n | KycControllerBuildResetFrameUrlAction\n | KycControllerCheckKycRequiredAction\n | KycControllerGetKycStatusAction\n | KycControllerGetCustomerIdentityAction\n | KycControllerStartSumSubAction\n | KycControllerRefreshKycStatusAction\n | KycControllerGetSessionStatusAction\n | KycControllerResetAction\n | KycControllerClearStateAction;\n"]}
1
+ {"version":3,"file":"KycController-method-action-types.js","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycController } from './KycController.js';\n\n/**\n * Starts a KYC session for the given vendor and email. Reuses a latest\n * vendor session when one exists; otherwise creates a UKYC session.\n *\n * @param params - The session parameters.\n * @param params.vendor - Identity vendor for the session.\n * @param params.email - Account email associated with the session.\n * @returns The current or newly created session status.\n */\nexport type KycControllerStartSessionAction = {\n type: `KycController:startSession`;\n handler: KycController['startSession'];\n};\n\n/**\n * Stops session-status polling and restores default controller state.\n */\nexport type KycControllerResetAction = {\n type: `KycController:reset`;\n handler: KycController['reset'];\n};\n\n/**\n * Restores the controller to its default state.\n */\nexport type KycControllerClearStateAction = {\n type: `KycController:clearState`;\n handler: KycController['clearState'];\n};\n\n/**\n * Fetches the latest UKYC session status for a vendor.\n *\n * @param vendor - Identity vendor whose latest session should be queried.\n * @returns The session status, or `null` when none exists.\n */\nexport type KycControllerGetSessionStatusForVendorAction = {\n type: `KycController:getSessionStatusForVendor`;\n handler: KycController['getSessionStatusForVendor'];\n};\n\n/**\n * Returns the current session status and starts polling when it is not yet\n * terminal.\n *\n * @returns The current session status.\n * @throws If there is no session on state.\n */\nexport type KycControllerRefreshSessionStatusAction = {\n type: `KycController:refreshSessionStatus`;\n handler: KycController['refreshSessionStatus'];\n};\n\n/**\n * Starts polling `GET /sessions/{id}/status` for\n * {@link KycControllerState.sessionStatus}'s current `id`. Each tick writes\n * the result onto state only when the payload changed. The loop stops once\n * `finalStatus` is `approved`, `rejected`, or `retry`, or when\n * {@link reset} / {@link clearState} runs.\n *\n * @throws If there is no current session id to poll.\n */\nexport type KycControllerStartSessionStatusPollingAction = {\n type: `KycController:startSessionStatusPolling`;\n handler: KycController['startSessionStatusPolling'];\n};\n\n/**\n * Fetches the idOS + KYC-provider disclaimer catalog. Pass exactly one of\n * `sessionId` or `country`:\n *\n * - `{ sessionId }` → {@link KycService.fetchSessionDisclaimersBySessionId}\n * (`GET /sessions/{sessionId}/disclaimers`)\n * - `{ country }` → {@link KycService.fetchSessionDisclaimersByCountry}\n * (`GET /disclaimers?country=`)\n *\n * A session-id fetch also writes the catalog to `sessionDisclaimers`.\n *\n * @param params - The parameters. Provide exactly one of `sessionId` or\n * `country`.\n * @param params.sessionId - The UKYC session id.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The catalog. Session fetches include consent state; country\n * fetches do not.\n */\nexport type KycControllerFetchSessionDisclaimersAction = {\n type: `KycController:fetchSessionDisclaimers`;\n handler: KycController['fetchSessionDisclaimers'];\n};\n\n/**\n * Fetches the session-scoped disclaimer catalog and records consents\n * derived from the T&C2 flags. Already-consented catalog rows are omitted\n * from the POST. A 409 is re-checked with a GET: continue only when every\n * accepted document is now consented, otherwise fail closed.\n *\n * @param params - Accepted session-disclaimer records.\n * @param params.providerDisclaimersAccepted - Accepted Sumsub disclaimer records.\n * @param params.idosDisclaimersAccepted - Accepted idOS disclaimer records.\n * @param params.credentialReusabilityConsentGiven - Whether credential\n * reuse was accepted.\n */\nexport type KycControllerRecordSessionDisclaimersAction = {\n type: `KycController:recordSessionDisclaimers`;\n handler: KycController['recordSessionDisclaimers'];\n};\n\n/**\n * Fetches session-scoped disclaimers and reports whether every document is\n * consented and credential reuse was accepted.\n *\n * @returns Whether session disclaimers are complete.\n * @throws If there is no session on state.\n */\nexport type KycControllerHasCompletedSessionDisclaimersAction = {\n type: `KycController:hasCompletedSessionDisclaimers`;\n handler: KycController['hasCompletedSessionDisclaimers'];\n};\n\n/**\n * Fetches the vendor T&Cs the customer must accept before a session is\n * created (`GET /vendors/{vendor}/disclaimers?country=`).\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor. Defaults to `moonpay`.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\nexport type KycControllerFetchVendorDisclaimersAction = {\n type: `KycController:fetchVendorDisclaimers`;\n handler: KycController['fetchVendorDisclaimers'];\n};\n\n/**\n * Records vendor T&C acceptance via {@link KycService.submitVendorDisclaimers}\n * and persists the accepted ids on state.\n *\n * @param params - The parameters.\n * @param params.disclaimerIds - Accepted vendor T&C ids.\n * @returns The vendor signing records.\n * @throws If `vendor` is missing from state.\n */\nexport type KycControllerRecordVendorDisclaimersAction = {\n type: `KycController:recordVendorDisclaimers`;\n handler: KycController['recordVendorDisclaimers'];\n};\n\n/**\n * Fetches the current vendor T&C catalog and returns whether every document\n * is already recorded in {@link KycControllerState.vendorDisclaimersAccepted}.\n *\n * @returns Whether persisted acceptance covers the fetched catalog.\n * @throws If `vendor` or `geoCountry` is missing from state.\n */\nexport type KycControllerHasCompletedVendorDisclaimersAction = {\n type: `KycController:hasCompletedVendorDisclaimers`;\n handler: KycController['hasCompletedVendorDisclaimers'];\n};\n\n/**\n * Presents the identity-provider verification UI. Currently launches SumSub.\n *\n * @param params - Optional SDK presentation options.\n * @param params.locale - BCP-47 locale for the SDK UI.\n * @param params.debug - Enables SDK debug logging.\n * @returns A promise that settles when the provider flow finishes.\n */\nexport type KycControllerLaunchProviderFlowAction = {\n type: `KycController:launchProviderFlow`;\n handler: KycController['launchProviderFlow'];\n};\n\n/**\n * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerStartSessionAction\n | KycControllerResetAction\n | KycControllerClearStateAction\n | KycControllerGetSessionStatusForVendorAction\n | KycControllerRefreshSessionStatusAction\n | KycControllerStartSessionStatusPollingAction\n | KycControllerFetchSessionDisclaimersAction\n | KycControllerRecordSessionDisclaimersAction\n | KycControllerHasCompletedSessionDisclaimersAction\n | KycControllerFetchVendorDisclaimersAction\n | KycControllerRecordVendorDisclaimersAction\n | KycControllerHasCompletedVendorDisclaimersAction\n | KycControllerLaunchProviderFlowAction;\n"]}