@metamask-previews/kyc-controller 0.0.0-preview-7cfd8be → 0.0.0-preview-a3cea003b

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 (42) hide show
  1. package/CHANGELOG.md +29 -3
  2. package/dist/KycController-method-action-types.cjs.map +1 -1
  3. package/dist/KycController-method-action-types.d.cts +48 -2
  4. package/dist/KycController-method-action-types.d.cts.map +1 -1
  5. package/dist/KycController-method-action-types.d.mts +48 -2
  6. package/dist/KycController-method-action-types.d.mts.map +1 -1
  7. package/dist/KycController-method-action-types.mjs.map +1 -1
  8. package/dist/KycController.cjs +469 -12
  9. package/dist/KycController.cjs.map +1 -1
  10. package/dist/KycController.d.cts +109 -5
  11. package/dist/KycController.d.cts.map +1 -1
  12. package/dist/KycController.d.mts +109 -5
  13. package/dist/KycController.d.mts.map +1 -1
  14. package/dist/KycController.mjs +469 -12
  15. package/dist/KycController.mjs.map +1 -1
  16. package/dist/KycService-method-action-types.cjs.map +1 -1
  17. package/dist/KycService-method-action-types.d.cts +38 -2
  18. package/dist/KycService-method-action-types.d.cts.map +1 -1
  19. package/dist/KycService-method-action-types.d.mts +38 -2
  20. package/dist/KycService-method-action-types.d.mts.map +1 -1
  21. package/dist/KycService-method-action-types.mjs.map +1 -1
  22. package/dist/KycService.cjs +177 -22
  23. package/dist/KycService.cjs.map +1 -1
  24. package/dist/KycService.d.cts +97 -12
  25. package/dist/KycService.d.cts.map +1 -1
  26. package/dist/KycService.d.mts +97 -12
  27. package/dist/KycService.d.mts.map +1 -1
  28. package/dist/KycService.mjs +178 -23
  29. package/dist/KycService.mjs.map +1 -1
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +5 -5
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +5 -5
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/types.cjs.map +1 -1
  37. package/dist/types.d.cts +49 -10
  38. package/dist/types.d.cts.map +1 -1
  39. package/dist/types.d.mts +49 -10
  40. package/dist/types.d.mts.map +1 -1
  41. package/dist/types.mjs.map +1 -1
  42. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,8 +9,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
- - Initial release of the `@metamask/kyc-controller` package: a platform-agnostic controller and data service for orchestrating KYC / identity verification across MetaMask clients ([#9615](https://github.com/MetaMask/core/pull/9615), [#9712](https://github.com/MetaMask/core/pull/9712))
13
- - `KycController` owns the end-to-end flow: the KYC state machine, the MoonPay Check/Auth hosted-frame message protocol, X25519 credential decryption, and SumSub orchestration through an injected `KycSumSubLauncher` adapter (keeping the controller SDK-free). It performs the authenticated Universal KYC (UKYC) HTTP calls (disclaimers, sessions, kyc-required, wrapping-key, JWKS, UKYC session/journey/status polling) with `superstruct` response validation and `createServicePolicy` resilience, sourcing the bearer token and geolocation through the messenger.
14
- - Passing an optional `product` (`ramps` or `card`) makes the controller automatically run the KYC-required check and chain into the SumSub sub-flow after authentication, with generation/phase guards so `reset()` and stale frame messages cannot corrupt state.
12
+ - Parameterize Universal KYC vendor HTTP on `KycService` so identity vendors share one client surface instead of vendor-branded methods ([#9908](https://github.com/MetaMask/core/pull/9908)):
13
+ - `fetchDisclaimers({ vendor, country })` and `checkKycRequired({ vendor, ... })` call `/vendors/{vendor}/disclaimers` and `/vendors/{vendor}/kyc-required` (`vendor` defaults to `moonpay`)
14
+ - `createVendorCustomer({ vendor, email })` calls `POST /vendors/{vendor}/customers`
15
+ - `submitConsents({ disclaimerIds, ... })` posts `POST /consents` (wire body still uses `ironDisclaimerIds`)
16
+ - `fetchKycStatus()` reads `GET /kyc/status`
17
+ - Add a consents-path KYC flow on `KycController` for non-MoonPay vendors (currently `iron`): empty-shell customer → disclaimers → consents → SumSub, skipping MoonPay Check/Auth frames. `initialize({ vendor })` and `createVendorCustomer({ vendor, email })` drive the path; `acceptTermsAndStartSession` requires `sumsubTncSigned` / `idosTncSigned`. ([#9908](https://github.com/MetaMask/core/pull/9908))
18
+ - Add `KycController.refreshKycStatus()` and the `KycController:statusChanged` event so consumers can poll user-keyed KYC status for toast / banner surfaces. ([#9908](https://github.com/MetaMask/core/pull/9908))
19
+ - Add `KycController.getCustomerIdentity()` (and `KycCustomerIdentity`) returning the vendor-scoped `{ vendor, id }` for the current session, or `null` before authentication and after `reset()`. ([#9908](https://github.com/MetaMask/core/pull/9908))
20
+ - Extend `KycProduct` with `'money'` and `KycVendor` with `'iron'`. ([#9908](https://github.com/MetaMask/core/pull/9908))
21
+ - Add `KycUserStatus` / `KycUserStatusResponse` types for the simplified `GET /kyc/status` payload. ([#9908](https://github.com/MetaMask/core/pull/9908))
22
+ - Add persisted `termsAcceptedVendor` state recording which vendor's disclaimers `acceptedDisclaimerIds` belong to, so stored acceptance is only reused for that vendor. ([#9908](https://github.com/MetaMask/core/pull/9908))
23
+ - Add persisted `sumsubTncAccepted` and `idosTncAccepted` state so T&C2 flags can be validated when resuming a consents-path session. ([#9908](https://github.com/MetaMask/core/pull/9908))
24
+
25
+ ### Changed
26
+
27
+ - Make the `fetch` option on the `KycService` constructor optional; it now defaults to the runtime's native `fetch` (browser, React Native, Node 18+), so consumers no longer need to inject one. ([#9908](https://github.com/MetaMask/core/pull/9908))
28
+ - **BREAKING:** Invalidate terms acceptance when `termsAcceptedVendor` is `null` (pre-migration state), forcing reacceptance after the multi-vendor upgrade to ensure users review current vendor terms. ([#9908](https://github.com/MetaMask/core/pull/9908))
29
+ - **BREAKING:** Require `sumsubTncSigned` and `idosTncSigned` on `acceptTermsAndStartSession` for every vendor, so callers explicitly declare T&C2 acceptance. Zero-argument calls and omitted flags fail instead of defaulting to `true`. ([#9908](https://github.com/MetaMask/core/pull/9908))
30
+ - Rename `CreateUkycSessionParams.vendorId` to `vendor` for consistency with other service methods. ([#9908](https://github.com/MetaMask/core/pull/9908))
31
+
32
+ ### Fixed
33
+
34
+ - Clear `moonpayCustomerId` when the active vendor is not MoonPay, so `getCustomerIdentity()` cannot report a MoonPay customer id under another vendor. ([#9908](https://github.com/MetaMask/core/pull/9908))
35
+ - Call `unref()` on the user-status poll timer only when it exists. React Native and browser timers are numbers, so an unconditional `unref()` threw when status polling started outside Node. ([#9908](https://github.com/MetaMask/core/pull/9908))
36
+ - Skip the `session_not_in_valid_state` completion write when a `reset()` superseded the SumSub flow, so a late vendor response can no longer force `userStatus` to `completed` (and publish `statusChanged`) on an idle controller. ([#9908](https://github.com/MetaMask/core/pull/9908))
37
+ - Validate that `accessToken` and `country` are provided when calling `checkKycRequired` with vendor `moonpay`, failing fast with a clear error instead of posting `undefined` values to the API. ([#9908](https://github.com/MetaMask/core/pull/9908))
38
+ - Check for global `fetch` availability before binding in `KycService` constructor, throwing a descriptive error if `fetch` is neither provided nor globally available (e.g. older Node environments). ([#9908](https://github.com/MetaMask/core/pull/9908))
39
+ - Check for null bearer token before calling `assert()` in `#requestJson`, ensuring the custom "wallet signed in" error message is shown instead of a generic superstruct error. ([#9908](https://github.com/MetaMask/core/pull/9908))
40
+ - Require reacceptance of consents-path terms when `sumsubTncAccepted` or `idosTncAccepted` are `null` (pre-migration state), preventing invalid T&C2 flag submission on session resume. ([#9908](https://github.com/MetaMask/core/pull/9908))
15
41
 
16
42
  [Unreleased]: https://github.com/MetaMask/core/
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.cjs","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 */\nexport type KycControllerInitializeAction = {\n type: `KycController:initialize`;\n handler: KycController['initialize'];\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 * Captures terms acceptance for the currently loaded disclaimers and creates\n * a session.\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. See\n * {@link initialize} for how the product drives the automatic post\n * authentication continuation.\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 * Runs the SumSub document-verification sub-flow end to end:\n *\n * 1. requests a per-session wrapping key from the UKYC backend;\n * 2. verifies its `jwtChain` against the Fractal JWKS and confirms the\n * attested session server public 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` and creates\n * the UKYC session (handing over the wrapped key and the token);\n * 5. fetches the SumSub applicant access token; and\n * 6. presents the SDK via the injected launcher.\n *\n * If session creation reports 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 * 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 * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerInitializeAction\n | KycControllerLoadDisclaimersAction\n | KycControllerAcceptTermsAndStartSessionAction\n | KycControllerClearSavedTermsAction\n | KycControllerHandleFrameMessageAction\n | KycControllerBuildCheckFrameUrlAction\n | KycControllerBuildAuthFrameUrlAction\n | KycControllerBuildResetFrameUrlAction\n | KycControllerCheckKycRequiredAction\n | KycControllerGetKycStatusAction\n | KycControllerStartSumSubAction\n | KycControllerGetSessionStatusAction\n | KycControllerResetAction;\n"]}
1
+ {"version":3,"file":"KycController-method-action-types.cjs","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 * @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 * 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.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).\n * Required for every vendor so callers explicitly declare acceptance.\n * @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).\n * Required for every vendor so callers explicitly declare acceptance.\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}).\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. requests a per-session wrapping key from the UKYC backend;\n * 2. verifies its `jwtChain` against the Fractal JWKS and confirms the\n * attested session server public 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` and creates\n * the UKYC session (handing over the wrapped key and the token);\n * 5. fetches the SumSub applicant access token; and\n * 6. presents the SDK via the injected launcher.\n *\n * If session creation reports 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 * @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 * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerInitializeAction\n | KycControllerCreateVendorCustomerAction\n | KycControllerLoadDisclaimersAction\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"]}
@@ -14,11 +14,26 @@ import type { KycController } from "./KycController.cjs";
14
14
  * authentication completes (and chains into document verification when KYC
15
15
  * is required). When omitted, the flow stops at `form` and the consumer must
16
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`.
17
19
  */
18
20
  export type KycControllerInitializeAction = {
19
21
  type: `KycController:initialize`;
20
22
  handler: KycController['initialize'];
21
23
  };
24
+ /**
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}.
28
+ *
29
+ * @param params - The parameters.
30
+ * @param params.vendor - Identity vendor for the customer.
31
+ * @param params.email - Email for the vendor customer.
32
+ */
33
+ export type KycControllerCreateVendorCustomerAction = {
34
+ type: `KycController:createVendorCustomer`;
35
+ handler: KycController['createVendorCustomer'];
36
+ };
22
37
  /**
23
38
  * Loads the disclaimers for the resolved (or provided) country.
24
39
  *
@@ -33,11 +48,15 @@ export type KycControllerLoadDisclaimersAction = {
33
48
  * Captures terms acceptance for the currently loaded disclaimers and creates
34
49
  * a session.
35
50
  *
36
- * @param params - Optional parameters.
51
+ * @param params - The parameters.
37
52
  * @param params.email - The account email to associate with the session.
38
53
  * @param params.product - The consuming feature the flow runs for. See
39
54
  * {@link initialize} for how the product drives the automatic post
40
55
  * authentication continuation.
56
+ * @param params.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).
57
+ * Required for every vendor so callers explicitly declare acceptance.
58
+ * @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).
59
+ * Required for every vendor so callers explicitly declare acceptance.
41
60
  */
42
61
  export type KycControllerAcceptTermsAndStartSessionAction = {
43
62
  type: `KycController:acceptTermsAndStartSession`;
@@ -114,6 +133,22 @@ export type KycControllerGetKycStatusAction = {
114
133
  type: `KycController:getKycStatus`;
115
134
  handler: KycController['getKycStatus'];
116
135
  };
136
+ /**
137
+ * Returns the vendor-scoped identity for the currently authenticated
138
+ * customer, or `null` when the flow has not yet captured a vendor customer
139
+ * id (before authentication or after {@link reset}).
140
+ *
141
+ * Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor
142
+ * customer id to downstream calls without reading the full KYC state, which
143
+ * also holds session/access tokens. The id is session-scoped and never
144
+ * persisted.
145
+ *
146
+ * @returns The current {@link KycCustomerIdentity}, or `null`.
147
+ */
148
+ export type KycControllerGetCustomerIdentityAction = {
149
+ type: `KycController:getCustomerIdentity`;
150
+ handler: KycController['getCustomerIdentity'];
151
+ };
117
152
  /**
118
153
  * Runs the SumSub document-verification sub-flow end to end:
119
154
  *
@@ -141,6 +176,17 @@ export type KycControllerStartSumSubAction = {
141
176
  type: `KycController:startSumSub`;
142
177
  handler: KycController['startSumSub'];
143
178
  };
179
+ /**
180
+ * Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
181
+ * stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
182
+ * schedules short-interval polling while the status is `pending`.
183
+ *
184
+ * @returns The latest status payload.
185
+ */
186
+ export type KycControllerRefreshKycStatusAction = {
187
+ type: `KycController:refreshKycStatus`;
188
+ handler: KycController['refreshKycStatus'];
189
+ };
144
190
  /**
145
191
  * Fetches the current UKYC session status for the active sub-flow and records
146
192
  * it on state. Useful for a one-off refresh outside the automatic polling
@@ -164,5 +210,5 @@ export type KycControllerResetAction = {
164
210
  /**
165
211
  * Union of all KycController action types.
166
212
  */
167
- export type KycControllerMethodActions = KycControllerInitializeAction | KycControllerLoadDisclaimersAction | KycControllerAcceptTermsAndStartSessionAction | KycControllerClearSavedTermsAction | KycControllerHandleFrameMessageAction | KycControllerBuildCheckFrameUrlAction | KycControllerBuildAuthFrameUrlAction | KycControllerBuildResetFrameUrlAction | KycControllerCheckKycRequiredAction | KycControllerGetKycStatusAction | KycControllerStartSumSubAction | KycControllerGetSessionStatusAction | KycControllerResetAction;
213
+ export type KycControllerMethodActions = KycControllerInitializeAction | KycControllerCreateVendorCustomerAction | KycControllerLoadDisclaimersAction | KycControllerAcceptTermsAndStartSessionAction | KycControllerClearSavedTermsAction | KycControllerHandleFrameMessageAction | KycControllerBuildCheckFrameUrlAction | KycControllerBuildAuthFrameUrlAction | KycControllerBuildResetFrameUrlAction | KycControllerCheckKycRequiredAction | KycControllerGetKycStatusAction | KycControllerGetCustomerIdentityAction | KycControllerStartSumSubAction | KycControllerRefreshKycStatusAction | KycControllerGetSessionStatusAction | KycControllerResetAction;
168
214
  //# sourceMappingURL=KycController-method-action-types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.d.cts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,4BAA2B;AAExD;;;;;;;;;;;GAWG;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,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qCAAqC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C,qCAAqC,GACrC,qCAAqC,GACrC,oCAAoC,GACpC,qCAAqC,GACrC,mCAAmC,GACnC,+BAA+B,GAC/B,8BAA8B,GAC9B,mCAAmC,GACnC,wBAAwB,CAAC"}
1
+ {"version":3,"file":"KycController-method-action-types.d.cts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,4BAA2B;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAA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kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;GAGG;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,0BAA0B,GAClC,6BAA6B,GAC7B,uCAAuC,GACvC,kCAAkC,GAClC,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,CAAC"}
@@ -14,11 +14,26 @@ import type { KycController } from "./KycController.mjs";
14
14
  * authentication completes (and chains into document verification when KYC
15
15
  * is required). When omitted, the flow stops at `form` and the consumer must
16
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`.
17
19
  */
18
20
  export type KycControllerInitializeAction = {
19
21
  type: `KycController:initialize`;
20
22
  handler: KycController['initialize'];
21
23
  };
24
+ /**
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}.
28
+ *
29
+ * @param params - The parameters.
30
+ * @param params.vendor - Identity vendor for the customer.
31
+ * @param params.email - Email for the vendor customer.
32
+ */
33
+ export type KycControllerCreateVendorCustomerAction = {
34
+ type: `KycController:createVendorCustomer`;
35
+ handler: KycController['createVendorCustomer'];
36
+ };
22
37
  /**
23
38
  * Loads the disclaimers for the resolved (or provided) country.
24
39
  *
@@ -33,11 +48,15 @@ export type KycControllerLoadDisclaimersAction = {
33
48
  * Captures terms acceptance for the currently loaded disclaimers and creates
34
49
  * a session.
35
50
  *
36
- * @param params - Optional parameters.
51
+ * @param params - The parameters.
37
52
  * @param params.email - The account email to associate with the session.
38
53
  * @param params.product - The consuming feature the flow runs for. See
39
54
  * {@link initialize} for how the product drives the automatic post
40
55
  * authentication continuation.
56
+ * @param params.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).
57
+ * Required for every vendor so callers explicitly declare acceptance.
58
+ * @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).
59
+ * Required for every vendor so callers explicitly declare acceptance.
41
60
  */
42
61
  export type KycControllerAcceptTermsAndStartSessionAction = {
43
62
  type: `KycController:acceptTermsAndStartSession`;
@@ -114,6 +133,22 @@ export type KycControllerGetKycStatusAction = {
114
133
  type: `KycController:getKycStatus`;
115
134
  handler: KycController['getKycStatus'];
116
135
  };
136
+ /**
137
+ * Returns the vendor-scoped identity for the currently authenticated
138
+ * customer, or `null` when the flow has not yet captured a vendor customer
139
+ * id (before authentication or after {@link reset}).
140
+ *
141
+ * Exposed so consumers (e.g. ramps autoramp creation) can attach the vendor
142
+ * customer id to downstream calls without reading the full KYC state, which
143
+ * also holds session/access tokens. The id is session-scoped and never
144
+ * persisted.
145
+ *
146
+ * @returns The current {@link KycCustomerIdentity}, or `null`.
147
+ */
148
+ export type KycControllerGetCustomerIdentityAction = {
149
+ type: `KycController:getCustomerIdentity`;
150
+ handler: KycController['getCustomerIdentity'];
151
+ };
117
152
  /**
118
153
  * Runs the SumSub document-verification sub-flow end to end:
119
154
  *
@@ -141,6 +176,17 @@ export type KycControllerStartSumSubAction = {
141
176
  type: `KycController:startSumSub`;
142
177
  handler: KycController['startSumSub'];
143
178
  };
179
+ /**
180
+ * Refreshes the user-keyed simplified KYC status from `GET /kyc/status`,
181
+ * stores it on state, publishes {@link KycControllerStatusChangedEvent}, and
182
+ * schedules short-interval polling while the status is `pending`.
183
+ *
184
+ * @returns The latest status payload.
185
+ */
186
+ export type KycControllerRefreshKycStatusAction = {
187
+ type: `KycController:refreshKycStatus`;
188
+ handler: KycController['refreshKycStatus'];
189
+ };
144
190
  /**
145
191
  * Fetches the current UKYC session status for the active sub-flow and records
146
192
  * it on state. Useful for a one-off refresh outside the automatic polling
@@ -164,5 +210,5 @@ export type KycControllerResetAction = {
164
210
  /**
165
211
  * Union of all KycController action types.
166
212
  */
167
- export type KycControllerMethodActions = KycControllerInitializeAction | KycControllerLoadDisclaimersAction | KycControllerAcceptTermsAndStartSessionAction | KycControllerClearSavedTermsAction | KycControllerHandleFrameMessageAction | KycControllerBuildCheckFrameUrlAction | KycControllerBuildAuthFrameUrlAction | KycControllerBuildResetFrameUrlAction | KycControllerCheckKycRequiredAction | KycControllerGetKycStatusAction | KycControllerStartSumSubAction | KycControllerGetSessionStatusAction | KycControllerResetAction;
213
+ export type KycControllerMethodActions = KycControllerInitializeAction | KycControllerCreateVendorCustomerAction | KycControllerLoadDisclaimersAction | KycControllerAcceptTermsAndStartSessionAction | KycControllerClearSavedTermsAction | KycControllerHandleFrameMessageAction | KycControllerBuildCheckFrameUrlAction | KycControllerBuildAuthFrameUrlAction | KycControllerBuildResetFrameUrlAction | KycControllerCheckKycRequiredAction | KycControllerGetKycStatusAction | KycControllerGetCustomerIdentityAction | KycControllerStartSumSubAction | KycControllerRefreshKycStatusAction | KycControllerGetSessionStatusAction | KycControllerResetAction;
168
214
  //# sourceMappingURL=KycController-method-action-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.d.mts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,4BAA2B;AAExD;;;;;;;;;;;GAWG;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,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAA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M,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;GAGG;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,0BAA0B,GAClC,6BAA6B,GAC7B,kCAAkC,GAClC,6CAA6C,GAC7C,kCAAkC,GAClC,qCAAqC,GACrC,qCAAqC,GACrC,oCAAoC,GACpC,qCAAqC,GACrC,mCAAmC,GACnC,+BAA+B,GAC/B,8BAA8B,GAC9B,mCAAmC,GACnC,wBAAwB,CAAC"}
1
+ {"version":3,"file":"KycController-method-action-types.d.mts","sourceRoot":"","sources":["../src/KycController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,4BAA2B;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC3C,CAAC;AAEF;;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AAmC,CAAC;IAC1C,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAC5C,CAAC;AAEF;;;GAGG;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,0BAA0B,GAClC,6BAA6B,GAC7B,uCAAuC,GACvC,kCAAkC,GAClC,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,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"KycController-method-action-types.mjs","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 */\nexport type KycControllerInitializeAction = {\n type: `KycController:initialize`;\n handler: KycController['initialize'];\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 * Captures terms acceptance for the currently loaded disclaimers and creates\n * a session.\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. See\n * {@link initialize} for how the product drives the automatic post\n * authentication continuation.\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 * Runs the SumSub document-verification sub-flow end to end:\n *\n * 1. requests a per-session wrapping key from the UKYC backend;\n * 2. verifies its `jwtChain` against the Fractal JWKS and confirms the\n * attested session server public 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` and creates\n * the UKYC session (handing over the wrapped key and the token);\n * 5. fetches the SumSub applicant access token; and\n * 6. presents the SDK via the injected launcher.\n *\n * If session creation reports 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 * 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 * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerInitializeAction\n | KycControllerLoadDisclaimersAction\n | KycControllerAcceptTermsAndStartSessionAction\n | KycControllerClearSavedTermsAction\n | KycControllerHandleFrameMessageAction\n | KycControllerBuildCheckFrameUrlAction\n | KycControllerBuildAuthFrameUrlAction\n | KycControllerBuildResetFrameUrlAction\n | KycControllerCheckKycRequiredAction\n | KycControllerGetKycStatusAction\n | KycControllerStartSumSubAction\n | KycControllerGetSessionStatusAction\n | KycControllerResetAction;\n"]}
1
+ {"version":3,"file":"KycController-method-action-types.mjs","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 * @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 * 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.sumsubTncSigned - Whether Sumsub T&C were accepted (T&C2).\n * Required for every vendor so callers explicitly declare acceptance.\n * @param params.idosTncSigned - Whether idOS T&C were accepted (T&C2).\n * Required for every vendor so callers explicitly declare acceptance.\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}).\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. requests a per-session wrapping key from the UKYC backend;\n * 2. verifies its `jwtChain` against the Fractal JWKS and confirms the\n * attested session server public 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` and creates\n * the UKYC session (handing over the wrapped key and the token);\n * 5. fetches the SumSub applicant access token; and\n * 6. presents the SDK via the injected launcher.\n *\n * If session creation reports 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 * @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 * Union of all KycController action types.\n */\nexport type KycControllerMethodActions =\n | KycControllerInitializeAction\n | KycControllerCreateVendorCustomerAction\n | KycControllerLoadDisclaimersAction\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"]}