@moonpay/platform-protocol 1.23.0 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frames/auth.cjs.map +1 -1
- package/dist/frames/auth.d.cts +2 -2
- package/dist/frames/auth.d.ts +2 -2
- package/dist/frames/challenge.cjs.map +1 -1
- package/dist/frames/challenge.d.cts +8 -0
- package/dist/frames/challenge.d.ts +8 -0
- package/dist/models/connection.cjs.map +1 -1
- package/dist/models/connection.d.cts +9 -0
- package/dist/models/connection.d.ts +9 -0
- package/dist/models/connection.js.map +1 -1
- package/dist/sdks/challenge.cjs.map +1 -1
- package/dist/sdks/challenge.d.cts +2 -0
- package/dist/sdks/challenge.d.ts +2 -0
- package/package.json +1 -1
package/dist/frames/auth.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/frames/auth.ts"],"sourcesContent":["import type {\n ActiveConnection,\n ConnectionError,\n TermsAcceptanceRequiredConnection,\n} from '../models/connection.js';\n\n/**\n * The auth frame is the lighter-weight counterpart to the connect frame:\n * partners (typically headless / Identity-API integrations) drive the\n * customer through email/OTP authentication only, then receive the\n * encrypted credentials.\n */\nexport interface MessageMap {\n ready: void;\n error: ConnectionError;\n complete: ActiveConnection | TermsAcceptanceRequiredConnection;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/frames/auth.ts"],"sourcesContent":["import type {\n ActiveConnection,\n ConnectionError,\n PendingConnection,\n TermsAcceptanceRequiredConnection,\n} from '../models/connection.js';\n\n/**\n * The auth frame is the lighter-weight counterpart to the connect frame:\n * partners (typically headless / Identity-API integrations) drive the\n * customer through email/OTP authentication only, then receive the\n * encrypted credentials.\n */\nexport interface MessageMap {\n ready: void;\n error: ConnectionError;\n complete: ActiveConnection | PendingConnection | TermsAcceptanceRequiredConnection;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/frames/auth.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionError, ActiveConnection, TermsAcceptanceRequiredConnection } from '../models/connection.cjs';
|
|
1
|
+
import { ConnectionError, ActiveConnection, PendingConnection, TermsAcceptanceRequiredConnection } from '../models/connection.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The auth frame is the lighter-weight counterpart to the connect frame:
|
|
@@ -9,7 +9,7 @@ import { ConnectionError, ActiveConnection, TermsAcceptanceRequiredConnection }
|
|
|
9
9
|
interface MessageMap {
|
|
10
10
|
ready: void;
|
|
11
11
|
error: ConnectionError;
|
|
12
|
-
complete: ActiveConnection | TermsAcceptanceRequiredConnection;
|
|
12
|
+
complete: ActiveConnection | PendingConnection | TermsAcceptanceRequiredConnection;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type { MessageMap };
|
package/dist/frames/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionError, ActiveConnection, TermsAcceptanceRequiredConnection } from '../models/connection.js';
|
|
1
|
+
import { ConnectionError, ActiveConnection, PendingConnection, TermsAcceptanceRequiredConnection } from '../models/connection.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The auth frame is the lighter-weight counterpart to the connect frame:
|
|
@@ -9,7 +9,7 @@ import { ConnectionError, ActiveConnection, TermsAcceptanceRequiredConnection }
|
|
|
9
9
|
interface MessageMap {
|
|
10
10
|
ready: void;
|
|
11
11
|
error: ConnectionError;
|
|
12
|
-
complete: ActiveConnection | TermsAcceptanceRequiredConnection;
|
|
12
|
+
complete: ActiveConnection | PendingConnection | TermsAcceptanceRequiredConnection;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type { MessageMap };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/frames/challenge.ts"],"sourcesContent":["import type { FrameTransaction } from '../models/transaction.js';\nimport type { FrameError } from '../protocol.js';\n\n/**\n * Mirrors the MoonPay API's `GuestCheckoutLimitUpgradeStatus` — a durable,\n * poll-any-time-later fact rather than a short-lived value: `upgraded` and\n * `rejected` reflect a persisted review outcome, not a transient in-progress signal.\n */\nexport type GuestCheckoutLimitUpgradeStatus = 'pending' | 'upgraded' | 'rejected';\n\nexport type CompleteResult = (\n | { flow: 'buy'; transaction: FrameTransaction }\n | { flow: 'identity'; identityId: string }\n | { flow: 'guest_checkout_limit_upgrade'; status: GuestCheckoutLimitUpgradeStatus }\n) & {\n sessionUpgraded?: true;\n};\n\nexport type Cancellation =\n | { flow: 'buy'; transactionId?: string; challengeToken?: string }\n | { flow: 'identity' }\n | { flow: 'guest_checkout_limit_upgrade' };\n\n/**\n * The challenge frame is fully self-contained — it is driven by the\n * `challengeToken` URL param. There is no parent → child message map.\n */\nexport interface MessageMap {\n ready: void;\n complete: CompleteResult;\n /** User dismissed the challenge. Carry `transactionId` / `challengeToken` to resume. */\n cancelled: Cancellation;\n error: FrameError;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/frames/challenge.ts"],"sourcesContent":["import type { FrameTransaction } from '../models/transaction.js';\nimport type { FrameError } from '../protocol.js';\n\n/**\n * Mirrors the MoonPay API's `GuestCheckoutLimitUpgradeStatus` — a durable,\n * poll-any-time-later fact rather than a short-lived value: `upgraded` and\n * `rejected` reflect a persisted review outcome, not a transient in-progress signal.\n */\nexport type GuestCheckoutLimitUpgradeStatus = 'pending' | 'upgraded' | 'rejected';\n\nexport type CompleteResult = (\n | { flow: 'buy'; transaction: FrameTransaction }\n | { flow: 'identity'; identityId: string }\n | { flow: 'guest_checkout_limit_upgrade'; status: GuestCheckoutLimitUpgradeStatus }\n) & {\n sessionUpgraded?: true;\n};\n\nexport type Cancellation =\n | { flow: 'buy'; transactionId?: string; challengeToken?: string }\n | { flow: 'identity' }\n | { flow: 'guest_checkout_limit_upgrade' };\n\n/**\n * The challenge frame is fully self-contained — it is driven by the\n * `challengeToken` URL param. There is no parent → child message map.\n */\nexport interface MessageMap {\n ready: void;\n /**\n * Fired the instant the user taps the native pay button inside the challenge\n * frame's payment sheet (Apple Pay / Google Pay), BEFORE the OS payment sheet\n * is presented. This is an intent-to-buy / tap signal, distinct from\n * `complete` (the purchase outcome). It fires unconditionally on tap, even if\n * the user later cancels the sheet.\n */\n buttonPressed: void;\n complete: CompleteResult;\n /** User dismissed the challenge. Carry `transactionId` / `challengeToken` to resume. */\n cancelled: Cancellation;\n error: FrameError;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -34,6 +34,14 @@ type Cancellation = {
|
|
|
34
34
|
*/
|
|
35
35
|
interface MessageMap {
|
|
36
36
|
ready: void;
|
|
37
|
+
/**
|
|
38
|
+
* Fired the instant the user taps the native pay button inside the challenge
|
|
39
|
+
* frame's payment sheet (Apple Pay / Google Pay), BEFORE the OS payment sheet
|
|
40
|
+
* is presented. This is an intent-to-buy / tap signal, distinct from
|
|
41
|
+
* `complete` (the purchase outcome). It fires unconditionally on tap, even if
|
|
42
|
+
* the user later cancels the sheet.
|
|
43
|
+
*/
|
|
44
|
+
buttonPressed: void;
|
|
37
45
|
complete: CompleteResult;
|
|
38
46
|
/** User dismissed the challenge. Carry `transactionId` / `challengeToken` to resume. */
|
|
39
47
|
cancelled: Cancellation;
|
|
@@ -34,6 +34,14 @@ type Cancellation = {
|
|
|
34
34
|
*/
|
|
35
35
|
interface MessageMap {
|
|
36
36
|
ready: void;
|
|
37
|
+
/**
|
|
38
|
+
* Fired the instant the user taps the native pay button inside the challenge
|
|
39
|
+
* frame's payment sheet (Apple Pay / Google Pay), BEFORE the OS payment sheet
|
|
40
|
+
* is presented. This is an intent-to-buy / tap signal, distinct from
|
|
41
|
+
* `complete` (the purchase outcome). It fires unconditionally on tap, even if
|
|
42
|
+
* the user later cancels the sheet.
|
|
43
|
+
*/
|
|
44
|
+
buttonPressed: void;
|
|
37
45
|
complete: CompleteResult;
|
|
38
46
|
/** User dismissed the challenge. Carry `transactionId` / `challengeToken` to resume. */
|
|
39
47
|
cancelled: Cancellation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/connection.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Connection statuses\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionStatus {\n /**\n * New or expired user — needs the full connect flow.\n */\n connectionRequired = 'connectionRequired',\n\n /**\n * Valid connection — encrypted credentials are included.\n */\n active = 'active',\n\n /**\n * Restricted location — connection cannot be used.\n */\n unavailable = 'unavailable',\n\n /**\n * KYC decision delayed — may resolve on a subsequent visit.\n */\n pending = 'pending',\n\n /**\n * Terminal failure — KYC fail, rejection, etc.\n */\n failed = 'failed',\n\n /**\n * Customer has no valid Terms of Use attestation on file (headless/Identity API partners).\n * Display Terms of Use in your own UI, capture acceptance, call\n * `POST /platform/v1/terms/attestations`, then retry the connection.\n */\n termsAcceptanceRequired = 'termsAcceptanceRequired',\n}\n\nexport interface ConnectionRequired {\n status: ConnectionStatus.connectionRequired;\n /**\n * Base64-encoded, X25519+AES-GCM encrypted anonymous token payload.\n * These are frame-internal tokens used by the connect frame — they cannot be\n * used to call MoonPay APIs directly. Decrypt via `decryptCredentials()` only\n * if you need the `clientToken` to bootstrap the connect frame manually.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements available before authentication, if any.\n * Present when guest checkout is enabled for the partner.\n */\n capabilities?: CustomerCapabilities;\n /**\n * Set when the session's email and phone number resolve to two different\n * MoonPay customers (a conflict). Partners should route the customer\n * through Connect proactively before rendering payment UI (e.g. Apple Pay or Google Pay).\n *\n * Note: the check-connection frame does not emit this field yet — treat\n * it as absent until frame support ships.\n */\n mismatch?: boolean;\n}\n\nexport interface ActiveConnection {\n status: ConnectionStatus.active;\n /** The authenticated MoonPay customer. */\n customer: {\n /** The MoonPay customer ID. */\n id: string;\n /** ISO 3166-1 alpha-3 country code for the customer's jurisdiction. */\n country?: string;\n /** State or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). Present when the customer is in a regulated area. */\n area?: string;\n };\n /**\n * Base64-encoded, X25519+AES-GCM encrypted JSON containing:\n * ```json\n * {\n * \"accessToken\": \"<token>\",\n * \"clientToken\": \"<token>\",\n * \"expiresAt\": \"<iso8601>\"\n * }\n * ```\n *\n * - `accessToken`: A token that can be used to make API requests from the client.\n * - `clientToken`: A token that can be used to initialize sensitive frames such as Apple Pay or Google Pay.\n * - `expiresAt`: An ISO 8601 formatted string indicating when the tokens expire.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\n capabilities: CustomerCapabilities;\n}\n\nexport interface UnavailableConnection {\n status: ConnectionStatus.unavailable;\n}\n\nexport interface PendingConnection {\n status: ConnectionStatus.pending;\n}\n\nexport interface FailedConnection {\n status: ConnectionStatus.failed;\n reason: string;\n}\n\nexport interface TermsAcceptanceRequiredConnection {\n status: ConnectionStatus.termsAcceptanceRequired;\n}\n\n/** Discriminated union of all connection result statuses. */\nexport type Connection =\n | ConnectionRequired\n | ActiveConnection\n | UnavailableConnection\n | PendingConnection\n | FailedConnection\n | TermsAcceptanceRequiredConnection;\n\n// ---------------------------------------------------------------------------\n// Decrypted credentials (what the SDK exposes after decryption)\n// ---------------------------------------------------------------------------\n\nexport interface DecryptedCredentials {\n accessToken: string;\n clientToken: string;\n expiresAt: string;\n}\n\n// ---------------------------------------------------------------------------\n// Customer capabilities\n// ---------------------------------------------------------------------------\n\n/**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\nexport interface CustomerCapabilities {\n /** Capabilities for the ramps (buy and sell) product. */\n ramps?: RampsCapability;\n /** Capabilities for the guest checkout flow. Present when guest checkout is enabled for the partner and the session is a guest-checkout session. */\n guestCheckout?: RampsCapability;\n}\n\n/**\n * Capabilities and requirements for the ramps (buy and sell) product.\n */\nexport interface RampsCapability {\n /** Regulatory requirements for ramps operations in the customer's jurisdiction. */\n requirements: RampsRequirements;\n}\n\n/**\n * Regulatory requirements that apply to ramps operations for the customer.\n */\nexport interface RampsRequirements {\n /**\n * Present when the customer's jurisdiction requires payment disclosures\n * before a ramps transaction. Omitted when no disclosures are required.\n *\n * @deprecated Use `customer.country`, `customer.administrativeArea`, and `customer.area`\n * from the active connection instead. This field will be removed in a future release.\n */\n paymentDisclosures?: PaymentDisclosuresRequirement;\n}\n\n/**\n * A jurisdiction that requires payment disclosures before a ramps transaction.\n */\nexport interface PaymentDisclosuresRequirement {\n /** The ISO 3166-1 alpha-3 country code for the jurisdiction. */\n country: string;\n /** The state or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). */\n area?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Connection errors\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionErrorCode {\n validationError = 'validationError',\n /** Wire value is `'generic'`. */\n connectionFailedGeneric = 'generic',\n}\n\nexport interface ConfigValidationFieldError {\n code: 'invalidSessionToken' | 'invalidClientToken' | 'invalidPublicKey';\n message: string;\n}\n\nexport type ConnectionError =\n | {\n code: ConnectionErrorCode.validationError;\n errors: ConfigValidationFieldError[];\n }\n | {\n code: ConnectionErrorCode.connectionFailedGeneric;\n message?: string;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAK,mBAAL,kBAAKA,sBAAL;AAIL,EAAAA,kBAAA,wBAAqB;AAKrB,EAAAA,kBAAA,YAAS;AAKT,EAAAA,kBAAA,iBAAc;AAKd,EAAAA,kBAAA,aAAU;AAKV,EAAAA,kBAAA,YAAS;AAOT,EAAAA,kBAAA,6BAA0B;AA/BhB,SAAAA;AAAA,GAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/models/connection.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Connection statuses\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionStatus {\n /**\n * New or expired user — needs the full connect flow.\n */\n connectionRequired = 'connectionRequired',\n\n /**\n * Valid connection — encrypted credentials are included.\n */\n active = 'active',\n\n /**\n * Restricted location — connection cannot be used.\n */\n unavailable = 'unavailable',\n\n /**\n * KYC decision delayed — may resolve on a subsequent visit.\n */\n pending = 'pending',\n\n /**\n * Terminal failure — KYC fail, rejection, etc.\n */\n failed = 'failed',\n\n /**\n * Customer has no valid Terms of Use attestation on file (headless/Identity API partners).\n * Display Terms of Use in your own UI, capture acceptance, call\n * `POST /platform/v1/terms/attestations`, then retry the connection.\n */\n termsAcceptanceRequired = 'termsAcceptanceRequired',\n}\n\nexport interface ConnectionRequired {\n status: ConnectionStatus.connectionRequired;\n /**\n * Base64-encoded, X25519+AES-GCM encrypted anonymous token payload.\n * These are frame-internal tokens used by the connect frame — they cannot be\n * used to call MoonPay APIs directly. Decrypt via `decryptCredentials()` only\n * if you need the `clientToken` to bootstrap the connect frame manually.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements available before authentication, if any.\n * Present when guest checkout is enabled for the partner.\n */\n capabilities?: CustomerCapabilities;\n /**\n * Set when the session's email and phone number resolve to two different\n * MoonPay customers (a conflict). Partners should route the customer\n * through Connect proactively before rendering payment UI (e.g. Apple Pay or Google Pay).\n *\n * Note: the check-connection frame does not emit this field yet — treat\n * it as absent until frame support ships.\n */\n mismatch?: boolean;\n}\n\nexport interface ActiveConnection {\n status: ConnectionStatus.active;\n /** The authenticated MoonPay customer. */\n customer: {\n /** The MoonPay customer ID. */\n id: string;\n /** ISO 3166-1 alpha-3 country code for the customer's jurisdiction. */\n country?: string;\n /** State or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). Present when the customer is in a regulated area. */\n area?: string;\n };\n /**\n * Base64-encoded, X25519+AES-GCM encrypted JSON containing:\n * ```json\n * {\n * \"accessToken\": \"<token>\",\n * \"clientToken\": \"<token>\",\n * \"expiresAt\": \"<iso8601>\"\n * }\n * ```\n *\n * - `accessToken`: A token that can be used to make API requests from the client.\n * - `clientToken`: A token that can be used to initialize sensitive frames such as Apple Pay or Google Pay.\n * - `expiresAt`: An ISO 8601 formatted string indicating when the tokens expire.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\n capabilities: CustomerCapabilities;\n}\n\nexport interface UnavailableConnection {\n status: ConnectionStatus.unavailable;\n}\n\nexport interface PendingConnection {\n status: ConnectionStatus.pending;\n /** The MoonPay customer. Use `customer.id` to poll `GET /platform/v1/customers/{id}` until KYC resolves. */\n customer?: ActiveConnection['customer'];\n /**\n * Encrypted credentials, same format as {@link ActiveConnection.credentials}.\n * They allow quotes and KYC status polling while the connection is pending.\n */\n credentials?: string;\n /** Capabilities for the customer; `ramps.status` is `pending`. */\n capabilities?: CustomerCapabilities;\n}\n\nexport interface FailedConnection {\n status: ConnectionStatus.failed;\n reason: string;\n}\n\nexport interface TermsAcceptanceRequiredConnection {\n status: ConnectionStatus.termsAcceptanceRequired;\n}\n\n/** Discriminated union of all connection result statuses. */\nexport type Connection =\n | ConnectionRequired\n | ActiveConnection\n | UnavailableConnection\n | PendingConnection\n | FailedConnection\n | TermsAcceptanceRequiredConnection;\n\n// ---------------------------------------------------------------------------\n// Decrypted credentials (what the SDK exposes after decryption)\n// ---------------------------------------------------------------------------\n\nexport interface DecryptedCredentials {\n accessToken: string;\n clientToken: string;\n expiresAt: string;\n}\n\n// ---------------------------------------------------------------------------\n// Customer capabilities\n// ---------------------------------------------------------------------------\n\n/**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\nexport interface CustomerCapabilities {\n /** Capabilities for the ramps (buy and sell) product. */\n ramps?: RampsCapability;\n /** Capabilities for the guest checkout flow. Present when guest checkout is enabled for the partner and the session is a guest-checkout session. */\n guestCheckout?: RampsCapability;\n}\n\n/**\n * Capabilities and requirements for the ramps (buy and sell) product.\n */\nexport interface RampsCapability {\n /** Regulatory requirements for ramps operations in the customer's jurisdiction. */\n requirements: RampsRequirements;\n}\n\n/**\n * Regulatory requirements that apply to ramps operations for the customer.\n */\nexport interface RampsRequirements {\n /**\n * Present when the customer's jurisdiction requires payment disclosures\n * before a ramps transaction. Omitted when no disclosures are required.\n *\n * @deprecated Use `customer.country`, `customer.administrativeArea`, and `customer.area`\n * from the active connection instead. This field will be removed in a future release.\n */\n paymentDisclosures?: PaymentDisclosuresRequirement;\n}\n\n/**\n * A jurisdiction that requires payment disclosures before a ramps transaction.\n */\nexport interface PaymentDisclosuresRequirement {\n /** The ISO 3166-1 alpha-3 country code for the jurisdiction. */\n country: string;\n /** The state or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). */\n area?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Connection errors\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionErrorCode {\n validationError = 'validationError',\n /** Wire value is `'generic'`. */\n connectionFailedGeneric = 'generic',\n}\n\nexport interface ConfigValidationFieldError {\n code: 'invalidSessionToken' | 'invalidClientToken' | 'invalidPublicKey';\n message: string;\n}\n\nexport type ConnectionError =\n | {\n code: ConnectionErrorCode.validationError;\n errors: ConfigValidationFieldError[];\n }\n | {\n code: ConnectionErrorCode.connectionFailedGeneric;\n message?: string;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAK,mBAAL,kBAAKA,sBAAL;AAIL,EAAAA,kBAAA,wBAAqB;AAKrB,EAAAA,kBAAA,YAAS;AAKT,EAAAA,kBAAA,iBAAc;AAKd,EAAAA,kBAAA,aAAU;AAKV,EAAAA,kBAAA,YAAS;AAOT,EAAAA,kBAAA,6BAA0B;AA/BhB,SAAAA;AAAA,GAAA;AA8LL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,qBAAkB;AAElB,EAAAA,qBAAA,6BAA0B;AAHhB,SAAAA;AAAA,GAAA;","names":["ConnectionStatus","ConnectionErrorCode"]}
|
|
@@ -88,6 +88,15 @@ interface UnavailableConnection {
|
|
|
88
88
|
}
|
|
89
89
|
interface PendingConnection {
|
|
90
90
|
status: ConnectionStatus.pending;
|
|
91
|
+
/** The MoonPay customer. Use `customer.id` to poll `GET /platform/v1/customers/{id}` until KYC resolves. */
|
|
92
|
+
customer?: ActiveConnection['customer'];
|
|
93
|
+
/**
|
|
94
|
+
* Encrypted credentials, same format as {@link ActiveConnection.credentials}.
|
|
95
|
+
* They allow quotes and KYC status polling while the connection is pending.
|
|
96
|
+
*/
|
|
97
|
+
credentials?: string;
|
|
98
|
+
/** Capabilities for the customer; `ramps.status` is `pending`. */
|
|
99
|
+
capabilities?: CustomerCapabilities;
|
|
91
100
|
}
|
|
92
101
|
interface FailedConnection {
|
|
93
102
|
status: ConnectionStatus.failed;
|
|
@@ -88,6 +88,15 @@ interface UnavailableConnection {
|
|
|
88
88
|
}
|
|
89
89
|
interface PendingConnection {
|
|
90
90
|
status: ConnectionStatus.pending;
|
|
91
|
+
/** The MoonPay customer. Use `customer.id` to poll `GET /platform/v1/customers/{id}` until KYC resolves. */
|
|
92
|
+
customer?: ActiveConnection['customer'];
|
|
93
|
+
/**
|
|
94
|
+
* Encrypted credentials, same format as {@link ActiveConnection.credentials}.
|
|
95
|
+
* They allow quotes and KYC status polling while the connection is pending.
|
|
96
|
+
*/
|
|
97
|
+
credentials?: string;
|
|
98
|
+
/** Capabilities for the customer; `ramps.status` is `pending`. */
|
|
99
|
+
capabilities?: CustomerCapabilities;
|
|
91
100
|
}
|
|
92
101
|
interface FailedConnection {
|
|
93
102
|
status: ConnectionStatus.failed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/connection.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Connection statuses\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionStatus {\n /**\n * New or expired user — needs the full connect flow.\n */\n connectionRequired = 'connectionRequired',\n\n /**\n * Valid connection — encrypted credentials are included.\n */\n active = 'active',\n\n /**\n * Restricted location — connection cannot be used.\n */\n unavailable = 'unavailable',\n\n /**\n * KYC decision delayed — may resolve on a subsequent visit.\n */\n pending = 'pending',\n\n /**\n * Terminal failure — KYC fail, rejection, etc.\n */\n failed = 'failed',\n\n /**\n * Customer has no valid Terms of Use attestation on file (headless/Identity API partners).\n * Display Terms of Use in your own UI, capture acceptance, call\n * `POST /platform/v1/terms/attestations`, then retry the connection.\n */\n termsAcceptanceRequired = 'termsAcceptanceRequired',\n}\n\nexport interface ConnectionRequired {\n status: ConnectionStatus.connectionRequired;\n /**\n * Base64-encoded, X25519+AES-GCM encrypted anonymous token payload.\n * These are frame-internal tokens used by the connect frame — they cannot be\n * used to call MoonPay APIs directly. Decrypt via `decryptCredentials()` only\n * if you need the `clientToken` to bootstrap the connect frame manually.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements available before authentication, if any.\n * Present when guest checkout is enabled for the partner.\n */\n capabilities?: CustomerCapabilities;\n /**\n * Set when the session's email and phone number resolve to two different\n * MoonPay customers (a conflict). Partners should route the customer\n * through Connect proactively before rendering payment UI (e.g. Apple Pay or Google Pay).\n *\n * Note: the check-connection frame does not emit this field yet — treat\n * it as absent until frame support ships.\n */\n mismatch?: boolean;\n}\n\nexport interface ActiveConnection {\n status: ConnectionStatus.active;\n /** The authenticated MoonPay customer. */\n customer: {\n /** The MoonPay customer ID. */\n id: string;\n /** ISO 3166-1 alpha-3 country code for the customer's jurisdiction. */\n country?: string;\n /** State or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). Present when the customer is in a regulated area. */\n area?: string;\n };\n /**\n * Base64-encoded, X25519+AES-GCM encrypted JSON containing:\n * ```json\n * {\n * \"accessToken\": \"<token>\",\n * \"clientToken\": \"<token>\",\n * \"expiresAt\": \"<iso8601>\"\n * }\n * ```\n *\n * - `accessToken`: A token that can be used to make API requests from the client.\n * - `clientToken`: A token that can be used to initialize sensitive frames such as Apple Pay or Google Pay.\n * - `expiresAt`: An ISO 8601 formatted string indicating when the tokens expire.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\n capabilities: CustomerCapabilities;\n}\n\nexport interface UnavailableConnection {\n status: ConnectionStatus.unavailable;\n}\n\nexport interface PendingConnection {\n status: ConnectionStatus.pending;\n}\n\nexport interface FailedConnection {\n status: ConnectionStatus.failed;\n reason: string;\n}\n\nexport interface TermsAcceptanceRequiredConnection {\n status: ConnectionStatus.termsAcceptanceRequired;\n}\n\n/** Discriminated union of all connection result statuses. */\nexport type Connection =\n | ConnectionRequired\n | ActiveConnection\n | UnavailableConnection\n | PendingConnection\n | FailedConnection\n | TermsAcceptanceRequiredConnection;\n\n// ---------------------------------------------------------------------------\n// Decrypted credentials (what the SDK exposes after decryption)\n// ---------------------------------------------------------------------------\n\nexport interface DecryptedCredentials {\n accessToken: string;\n clientToken: string;\n expiresAt: string;\n}\n\n// ---------------------------------------------------------------------------\n// Customer capabilities\n// ---------------------------------------------------------------------------\n\n/**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\nexport interface CustomerCapabilities {\n /** Capabilities for the ramps (buy and sell) product. */\n ramps?: RampsCapability;\n /** Capabilities for the guest checkout flow. Present when guest checkout is enabled for the partner and the session is a guest-checkout session. */\n guestCheckout?: RampsCapability;\n}\n\n/**\n * Capabilities and requirements for the ramps (buy and sell) product.\n */\nexport interface RampsCapability {\n /** Regulatory requirements for ramps operations in the customer's jurisdiction. */\n requirements: RampsRequirements;\n}\n\n/**\n * Regulatory requirements that apply to ramps operations for the customer.\n */\nexport interface RampsRequirements {\n /**\n * Present when the customer's jurisdiction requires payment disclosures\n * before a ramps transaction. Omitted when no disclosures are required.\n *\n * @deprecated Use `customer.country`, `customer.administrativeArea`, and `customer.area`\n * from the active connection instead. This field will be removed in a future release.\n */\n paymentDisclosures?: PaymentDisclosuresRequirement;\n}\n\n/**\n * A jurisdiction that requires payment disclosures before a ramps transaction.\n */\nexport interface PaymentDisclosuresRequirement {\n /** The ISO 3166-1 alpha-3 country code for the jurisdiction. */\n country: string;\n /** The state or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). */\n area?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Connection errors\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionErrorCode {\n validationError = 'validationError',\n /** Wire value is `'generic'`. */\n connectionFailedGeneric = 'generic',\n}\n\nexport interface ConfigValidationFieldError {\n code: 'invalidSessionToken' | 'invalidClientToken' | 'invalidPublicKey';\n message: string;\n}\n\nexport type ConnectionError =\n | {\n code: ConnectionErrorCode.validationError;\n errors: ConfigValidationFieldError[];\n }\n | {\n code: ConnectionErrorCode.connectionFailedGeneric;\n message?: string;\n };\n"],"mappings":";AAIO,IAAK,mBAAL,kBAAKA,sBAAL;AAIL,EAAAA,kBAAA,wBAAqB;AAKrB,EAAAA,kBAAA,YAAS;AAKT,EAAAA,kBAAA,iBAAc;AAKd,EAAAA,kBAAA,aAAU;AAKV,EAAAA,kBAAA,YAAS;AAOT,EAAAA,kBAAA,6BAA0B;AA/BhB,SAAAA;AAAA,GAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/models/connection.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Connection statuses\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionStatus {\n /**\n * New or expired user — needs the full connect flow.\n */\n connectionRequired = 'connectionRequired',\n\n /**\n * Valid connection — encrypted credentials are included.\n */\n active = 'active',\n\n /**\n * Restricted location — connection cannot be used.\n */\n unavailable = 'unavailable',\n\n /**\n * KYC decision delayed — may resolve on a subsequent visit.\n */\n pending = 'pending',\n\n /**\n * Terminal failure — KYC fail, rejection, etc.\n */\n failed = 'failed',\n\n /**\n * Customer has no valid Terms of Use attestation on file (headless/Identity API partners).\n * Display Terms of Use in your own UI, capture acceptance, call\n * `POST /platform/v1/terms/attestations`, then retry the connection.\n */\n termsAcceptanceRequired = 'termsAcceptanceRequired',\n}\n\nexport interface ConnectionRequired {\n status: ConnectionStatus.connectionRequired;\n /**\n * Base64-encoded, X25519+AES-GCM encrypted anonymous token payload.\n * These are frame-internal tokens used by the connect frame — they cannot be\n * used to call MoonPay APIs directly. Decrypt via `decryptCredentials()` only\n * if you need the `clientToken` to bootstrap the connect frame manually.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements available before authentication, if any.\n * Present when guest checkout is enabled for the partner.\n */\n capabilities?: CustomerCapabilities;\n /**\n * Set when the session's email and phone number resolve to two different\n * MoonPay customers (a conflict). Partners should route the customer\n * through Connect proactively before rendering payment UI (e.g. Apple Pay or Google Pay).\n *\n * Note: the check-connection frame does not emit this field yet — treat\n * it as absent until frame support ships.\n */\n mismatch?: boolean;\n}\n\nexport interface ActiveConnection {\n status: ConnectionStatus.active;\n /** The authenticated MoonPay customer. */\n customer: {\n /** The MoonPay customer ID. */\n id: string;\n /** ISO 3166-1 alpha-3 country code for the customer's jurisdiction. */\n country?: string;\n /** State or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). Present when the customer is in a regulated area. */\n area?: string;\n };\n /**\n * Base64-encoded, X25519+AES-GCM encrypted JSON containing:\n * ```json\n * {\n * \"accessToken\": \"<token>\",\n * \"clientToken\": \"<token>\",\n * \"expiresAt\": \"<iso8601>\"\n * }\n * ```\n *\n * - `accessToken`: A token that can be used to make API requests from the client.\n * - `clientToken`: A token that can be used to initialize sensitive frames such as Apple Pay or Google Pay.\n * - `expiresAt`: An ISO 8601 formatted string indicating when the tokens expire.\n */\n credentials: string;\n /**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\n capabilities: CustomerCapabilities;\n}\n\nexport interface UnavailableConnection {\n status: ConnectionStatus.unavailable;\n}\n\nexport interface PendingConnection {\n status: ConnectionStatus.pending;\n /** The MoonPay customer. Use `customer.id` to poll `GET /platform/v1/customers/{id}` until KYC resolves. */\n customer?: ActiveConnection['customer'];\n /**\n * Encrypted credentials, same format as {@link ActiveConnection.credentials}.\n * They allow quotes and KYC status polling while the connection is pending.\n */\n credentials?: string;\n /** Capabilities for the customer; `ramps.status` is `pending`. */\n capabilities?: CustomerCapabilities;\n}\n\nexport interface FailedConnection {\n status: ConnectionStatus.failed;\n reason: string;\n}\n\nexport interface TermsAcceptanceRequiredConnection {\n status: ConnectionStatus.termsAcceptanceRequired;\n}\n\n/** Discriminated union of all connection result statuses. */\nexport type Connection =\n | ConnectionRequired\n | ActiveConnection\n | UnavailableConnection\n | PendingConnection\n | FailedConnection\n | TermsAcceptanceRequiredConnection;\n\n// ---------------------------------------------------------------------------\n// Decrypted credentials (what the SDK exposes after decryption)\n// ---------------------------------------------------------------------------\n\nexport interface DecryptedCredentials {\n accessToken: string;\n clientToken: string;\n expiresAt: string;\n}\n\n// ---------------------------------------------------------------------------\n// Customer capabilities\n// ---------------------------------------------------------------------------\n\n/**\n * Capabilities and regulatory requirements for the authenticated customer.\n */\nexport interface CustomerCapabilities {\n /** Capabilities for the ramps (buy and sell) product. */\n ramps?: RampsCapability;\n /** Capabilities for the guest checkout flow. Present when guest checkout is enabled for the partner and the session is a guest-checkout session. */\n guestCheckout?: RampsCapability;\n}\n\n/**\n * Capabilities and requirements for the ramps (buy and sell) product.\n */\nexport interface RampsCapability {\n /** Regulatory requirements for ramps operations in the customer's jurisdiction. */\n requirements: RampsRequirements;\n}\n\n/**\n * Regulatory requirements that apply to ramps operations for the customer.\n */\nexport interface RampsRequirements {\n /**\n * Present when the customer's jurisdiction requires payment disclosures\n * before a ramps transaction. Omitted when no disclosures are required.\n *\n * @deprecated Use `customer.country`, `customer.administrativeArea`, and `customer.area`\n * from the active connection instead. This field will be removed in a future release.\n */\n paymentDisclosures?: PaymentDisclosuresRequirement;\n}\n\n/**\n * A jurisdiction that requires payment disclosures before a ramps transaction.\n */\nexport interface PaymentDisclosuresRequirement {\n /** The ISO 3166-1 alpha-3 country code for the jurisdiction. */\n country: string;\n /** The state or province code within the country (e.g. `'NY'` for New York). Present for US customers only. */\n administrativeArea?: string;\n /** Supra-national regulatory area code (e.g. `'EEA'`, `'EFTA'`). */\n area?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Connection errors\n// ---------------------------------------------------------------------------\n\nexport enum ConnectionErrorCode {\n validationError = 'validationError',\n /** Wire value is `'generic'`. */\n connectionFailedGeneric = 'generic',\n}\n\nexport interface ConfigValidationFieldError {\n code: 'invalidSessionToken' | 'invalidClientToken' | 'invalidPublicKey';\n message: string;\n}\n\nexport type ConnectionError =\n | {\n code: ConnectionErrorCode.validationError;\n errors: ConfigValidationFieldError[];\n }\n | {\n code: ConnectionErrorCode.connectionFailedGeneric;\n message?: string;\n };\n"],"mappings":";AAIO,IAAK,mBAAL,kBAAKA,sBAAL;AAIL,EAAAA,kBAAA,wBAAqB;AAKrB,EAAAA,kBAAA,YAAS;AAKT,EAAAA,kBAAA,iBAAc;AAKd,EAAAA,kBAAA,aAAU;AAKV,EAAAA,kBAAA,YAAS;AAOT,EAAAA,kBAAA,6BAA0B;AA/BhB,SAAAA;AAAA,GAAA;AA8LL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,qBAAkB;AAElB,EAAAA,qBAAA,6BAA0B;AAHhB,SAAAA;AAAA,GAAA;","names":["ConnectionStatus","ConnectionErrorCode"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sdks/challenge.ts"],"sourcesContent":["import type * as ChallengeFrame from '../frames/challenge.js';\n\nexport type Event =\n | { kind: 'ready' }\n | { kind: 'complete'; payload: ChallengeFrame.CompleteResult }\n | { kind: 'cancelled'; payload: ChallengeFrame.Cancellation }\n | { kind: 'error'; payload: ChallengeFrame.MessageMap['error'] };\n\nexport interface SetupError {\n kind: 'configurationError' | 'genericError';\n message: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/sdks/challenge.ts"],"sourcesContent":["import type * as ChallengeFrame from '../frames/challenge.js';\n\nexport type Event =\n | { kind: 'ready' }\n | { kind: 'buttonPressed' }\n | { kind: 'complete'; payload: ChallengeFrame.CompleteResult }\n | { kind: 'cancelled'; payload: ChallengeFrame.Cancellation }\n | { kind: 'error'; payload: ChallengeFrame.MessageMap['error'] };\n\nexport interface SetupError {\n kind: 'configurationError' | 'genericError';\n message: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/sdks/challenge.d.ts
CHANGED