@moonpay/platform-protocol 1.5.0 → 1.7.0

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.
@@ -40,6 +40,15 @@ interface ConnectionRequired {
40
40
  * Present when guest checkout is enabled for the partner.
41
41
  */
42
42
  capabilities?: CustomerCapabilities;
43
+ /**
44
+ * Set when the session's email and phone number resolve to two different
45
+ * MoonPay customers (a conflict). Partners should route the customer
46
+ * through Connect proactively before rendering payment UI (e.g. Apple Pay).
47
+ *
48
+ * Note: the check-connection frame does not emit this field yet — treat
49
+ * it as absent until frame support ships.
50
+ */
51
+ mismatch?: boolean;
43
52
  }
44
53
  interface ActiveConnection {
45
54
  status: ConnectionStatus.active;
@@ -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\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.\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;AA4KL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,qBAAkB;AAElB,EAAAA,qBAAA,6BAA0B;AAHhB,SAAAA;AAAA,GAAA;","names":["ConnectionStatus","ConnectionErrorCode"]}
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).\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.\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;AAqLL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,qBAAkB;AAElB,EAAAA,qBAAA,6BAA0B;AAHhB,SAAAA;AAAA,GAAA;","names":["ConnectionStatus","ConnectionErrorCode"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/sdks/customer-export.ts
17
+ var customer_export_exports = {};
18
+ module.exports = __toCommonJS(customer_export_exports);
19
+ //# sourceMappingURL=customer-export.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/sdks/customer-export.ts"],"sourcesContent":["import type * as CustomerExportFrame from '../frames/customer-export.js';\n\nexport type Event =\n | { kind: 'ready' }\n | { kind: 'complete'; payload: CustomerExportFrame.MessageMap['complete'] }\n | { kind: 'error'; payload: CustomerExportFrame.MessageMap['error'] }\n | { kind: 'close' };\n\nexport interface SetupError {\n kind: 'configurationError' | 'genericError';\n message: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { MessageMap } from '../frames/customer-export.cjs';
2
+ import '../models/connection.cjs';
3
+
4
+ type Event = {
5
+ kind: 'ready';
6
+ } | {
7
+ kind: 'complete';
8
+ payload: MessageMap['complete'];
9
+ } | {
10
+ kind: 'error';
11
+ payload: MessageMap['error'];
12
+ } | {
13
+ kind: 'close';
14
+ };
15
+ interface SetupError {
16
+ kind: 'configurationError' | 'genericError';
17
+ message: string;
18
+ }
19
+
20
+ export type { Event, SetupError };
@@ -0,0 +1,20 @@
1
+ import { MessageMap } from '../frames/customer-export.js';
2
+ import '../models/connection.js';
3
+
4
+ type Event = {
5
+ kind: 'ready';
6
+ } | {
7
+ kind: 'complete';
8
+ payload: MessageMap['complete'];
9
+ } | {
10
+ kind: 'error';
11
+ payload: MessageMap['error'];
12
+ } | {
13
+ kind: 'close';
14
+ };
15
+ interface SetupError {
16
+ kind: 'configurationError' | 'genericError';
17
+ message: string;
18
+ }
19
+
20
+ export type { Event, SetupError };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=customer-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonpay/platform-protocol",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Shared protocol types for the MoonPay Developer Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -124,6 +124,16 @@
124
124
  "default": "./dist/frames/reset.cjs"
125
125
  }
126
126
  },
127
+ "./frames/customer-export": {
128
+ "import": {
129
+ "types": "./dist/frames/customer-export.d.ts",
130
+ "default": "./dist/frames/customer-export.js"
131
+ },
132
+ "require": {
133
+ "types": "./dist/frames/customer-export.d.cts",
134
+ "default": "./dist/frames/customer-export.cjs"
135
+ }
136
+ },
127
137
  "./models/connection": {
128
138
  "import": {
129
139
  "types": "./dist/models/connection.d.ts",
@@ -174,6 +184,16 @@
174
184
  "default": "./dist/api/identity.cjs"
175
185
  }
176
186
  },
187
+ "./api/customer": {
188
+ "import": {
189
+ "types": "./dist/api/customer.d.ts",
190
+ "default": "./dist/api/customer.js"
191
+ },
192
+ "require": {
193
+ "types": "./dist/api/customer.d.cts",
194
+ "default": "./dist/api/customer.cjs"
195
+ }
196
+ },
177
197
  "./api/errors": {
178
198
  "import": {
179
199
  "types": "./dist/api/errors.d.ts",
@@ -283,6 +303,16 @@
283
303
  "types": "./dist/sdks/reset.d.cts",
284
304
  "default": "./dist/sdks/reset.cjs"
285
305
  }
306
+ },
307
+ "./sdks/customer-export": {
308
+ "import": {
309
+ "types": "./dist/sdks/customer-export.d.ts",
310
+ "default": "./dist/sdks/customer-export.js"
311
+ },
312
+ "require": {
313
+ "types": "./dist/sdks/customer-export.d.cts",
314
+ "default": "./dist/sdks/customer-export.cjs"
315
+ }
286
316
  }
287
317
  },
288
318
  "files": [
@@ -296,8 +326,8 @@
296
326
  "openapi": "openapi-ts -i https://api.moonpay.com/platform/openapi.json -o src/api/gen -p @hey-api/typescript"
297
327
  },
298
328
  "devDependencies": {
299
- "@hey-api/openapi-ts": "0.64.0",
300
- "tsup": "8.0.0",
329
+ "@hey-api/openapi-ts": "0.97.3",
330
+ "tsup": "8.3.5",
301
331
  "typescript": "5.7.3"
302
332
  },
303
333
  "sideEffects": false,