@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.
@@ -1,569 +1 @@
1
- /**
2
- * A fiat currency or crypto token
3
- */
4
- type Asset = {
5
- /**
6
- * A fiat or crypto currency code.
7
- *
8
- * **Fiat**
9
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
10
- *
11
- * Currently only `USD` is supported.
12
- *
13
- * **Crypto**
14
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
15
- *
16
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
17
- */
18
- code: string;
19
- /**
20
- * The human-readable name
21
- */
22
- name?: string;
23
- /**
24
- * The number of supported decimal places
25
- */
26
- precision?: number;
27
- };
28
- type AssetBase = {
29
- /**
30
- * A fiat or crypto currency code.
31
- *
32
- * **Fiat**
33
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
34
- *
35
- * Currently only `USD` is supported.
36
- *
37
- * **Crypto**
38
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
39
- *
40
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
41
- */
42
- code: string;
43
- };
44
- /**
45
- * Current status flags for an asset.
46
- */
47
- type AssetStatus = {
48
- /**
49
- * Reviewed and approved by MoonPay. DeFi tokens are returned with `verified: false`.
50
- */
51
- verified: boolean;
52
- /**
53
- * Temporarily unavailable for trading.
54
- */
55
- suspended: boolean;
56
- /**
57
- * Disabled for trading.
58
- */
59
- disabled: boolean;
60
- };
61
- /**
62
- * Destination crypto asset. Identify it by `code` for CeFi assets, or by `caip19` (the CAIP-19 identifier from the assets listing) for DeFi tokens, whose `code` is not unique. Provide exactly one; `caip19` takes precedence if both are sent.
63
- */
64
- type BuyQuoteDestinationAsset = {
65
- /**
66
- * CeFi currency code, e.g. `BTC` or `ETH`. Use for centralised assets.
67
- */
68
- code?: string;
69
- /**
70
- * CAIP-19 asset identifier from the assets listing. Required for DeFi tokens.
71
- */
72
- caip19?: string;
73
- };
74
- type CreateSessionTokenRequestBody = {
75
- /**
76
- * A unique identifier for the customer from your system.
77
- */
78
- externalCustomerId?: string;
79
- /**
80
- * The IP address of the user's device to ensure the integrity of the session. Both IPv4 and IPv6 values are supported.
81
- */
82
- deviceIp: IPv4Address | IPv6Address;
83
- /**
84
- * The customer's email address. Must be a valid email. If provided, enables email OTP authentication.
85
- */
86
- email?: string;
87
- /**
88
- * The customer's phone number in E.164 format. If both email and phone are provided, enables phone OTP authentication for returning customers.
89
- */
90
- phoneNumber?: string;
91
- /**
92
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the customer accepted MoonPay's Terms of Use. Send this when you capture Terms of Use acceptance in your own UI. The value can be at most 60 seconds ahead of server time, with no past limit. MoonPay records the terms version live at this timestamp and binds the acceptance to the customer when the session is authorized.
93
- */
94
- termsAcceptedAt?: string;
95
- };
96
- type CreateSessionTokenResponse = {
97
- /**
98
- * An opaque session token used to set up a connection on your frontend. This token is single-use and must be generated each time the customer visits your app.
99
- *
100
- * Token expires 24 hours after issuance.
101
- */
102
- sessionToken: string;
103
- };
104
- type Fees = {
105
- /**
106
- * Network fees (in fiat) for the transaction.
107
- */
108
- network?: MonetaryFeeAmount;
109
- /**
110
- * MoonPay fees (in fiat) for the transaction.
111
- */
112
- moonpay?: MonetaryFeeAmount;
113
- /**
114
- * Ecosystem fees (in fiat) for the transaction, if applicable.
115
- */
116
- ecosystem?: MonetaryFeeAmount;
117
- /**
118
- * DeFi swap fee (in fiat) for the transaction, converted to the quote's base currency like the other fees. Present only for DeFi swaps that carry an itemized swap fee; when the fee is taken on-chain it is reflected in `destination.amount` instead.
119
- */
120
- defi?: MonetaryFeeAmount;
121
- /**
122
- * Partner fees (in fiat) for the transaction, if applicable. Deprecated: use `fees.ecosystem` instead. This field will be removed in a future release.
123
- * @deprecated
124
- */
125
- partner?: MonetaryFeeAmount;
126
- };
127
- type GetQuoteBody = {
128
- /**
129
- * Source asset in fiat. Amount can be set in `source` or `destination`.
130
- */
131
- source: {
132
- /**
133
- * The currency or token being spent
134
- */
135
- asset: AssetBase;
136
- /**
137
- * A stringified amount, which can include decimals.
138
- */
139
- amount?: string;
140
- };
141
- /**
142
- * Destination asset in crypto. Amount can be set in `destination` or `source`. For DeFi tokens, identify the asset by `caip19` and set the amount on `source` only (quoting by destination token amount is not supported).
143
- */
144
- destination: {
145
- asset: BuyQuoteDestinationAsset;
146
- /**
147
- * The amount being received, if known
148
- */
149
- amount?: string;
150
- };
151
- /**
152
- * Wallet address and optional tag where the crypto will be sent. Required for the quote to be executable.
153
- */
154
- wallet?: Wallet;
155
- /**
156
- * Payment method for the transaction. Required for the quote to be executable.
157
- */
158
- paymentMethod?: QuotePaymentMethod;
159
- };
160
- /**
161
- * Quote for a fiat-to-crypto buy. Contains locked rate, fees, expiry, and signature for payment execution.
162
- */
163
- type GetQuoteResponse = {
164
- /**
165
- * Source side of the quote: amount and asset (fiat currency) you send.
166
- */
167
- source: {
168
- /**
169
- * A stringified amount, which can include decimals.
170
- */
171
- amount: string;
172
- /**
173
- * The currency or token being spent
174
- */
175
- asset: Asset;
176
- };
177
- /**
178
- * Destination side of the quote: amount and asset (cryptocurrency) the customer receives.
179
- */
180
- destination: {
181
- /**
182
- * A stringified amount, which can include decimals.
183
- */
184
- amount: string;
185
- asset: QuoteDestinationAsset;
186
- };
187
- /**
188
- * Breakdown of network, MoonPay, and ecosystem fees.
189
- */
190
- fees: Fees;
191
- /**
192
- * Wallet address and optional tag where the crypto will be sent. Null when not provided.
193
- */
194
- wallet: Wallet | null;
195
- /**
196
- * The payment method used for the quote.
197
- */
198
- paymentMethod: QuotePaymentMethod | null;
199
- limits: QuoteLimits | null;
200
- /**
201
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the quote expires.
202
- */
203
- expiresAt: string;
204
- /**
205
- * Whether the quote can be executed. Only `executable` quotes can be used to initiate payment frames.
206
- */
207
- executable: boolean;
208
- /**
209
- * The rate used to convert fiat <-> crypto, expressed as the fiat value of one unit of crypto (e.g. `1 SOL = {exchangeRate} USD`).
210
- */
211
- exchangeRate: string;
212
- /**
213
- * Slippage tolerance applied to the DeFi swap, in basis points (e.g. `50` = 0.5%). Only present when the destination is a DeFi token.
214
- */
215
- slippageBps?: number;
216
- /**
217
- * Disclosures the partner must render verbatim before the customer can complete the transaction. Empty when no disclosure is required for the customer's geography, payment method, and asset combination.
218
- */
219
- paymentDisclosures: Array<PaymentDisclosure>;
220
- /**
221
- * An opaque token representing the quote to initiate payment frames.
222
- */
223
- signature: string;
224
- };
225
- type IPv4Address = string;
226
- type IPv6Address = string;
227
- type LimitWithAsset = {
228
- /**
229
- * A stringified amount, which can include decimals.
230
- */
231
- amount: string;
232
- asset: AssetBase;
233
- };
234
- type MonetaryFeeAmount = {
235
- /**
236
- * The amount of fees in fiat.
237
- */
238
- amount: string;
239
- /**
240
- * The fiat currency used to pay the fees.
241
- */
242
- asset: AssetBase;
243
- };
244
- type MoonPayCorePaginationInfo = {
245
- /**
246
- * The cursor to use as the starting point for the next page of results.
247
- */
248
- nextCursor: string | null;
249
- };
250
- /**
251
- * The card network brand.
252
- */
253
- type MoonPayPaymentsCardBrand = 'visa' | 'mastercard' | 'maestro' | 'american_express' | 'other';
254
- /**
255
- * The type of card: credit, debit, or unknown.
256
- */
257
- type MoonPayPaymentsCardType = 'credit' | 'debit' | 'unknown';
258
- type MoonPayPaymentsListPaymentMethodsResponse = {
259
- /**
260
- * List of available payment method configurations
261
- */
262
- paymentMethodConfigs?: Array<MoonPayPaymentsPaymentMethod>;
263
- /**
264
- * List of stored payment methods available for the customer
265
- */
266
- paymentMethods?: Array<MoonPayPaymentsStoredPaymentMethod>;
267
- };
268
- type MoonPayPaymentsPaymentMethod = {
269
- type: PaymentMethodType;
270
- /**
271
- * Details of how the payment method can be used.
272
- */
273
- capabilities: MoonPayPaymentsPaymentMethodCapabilities;
274
- availability: MoonPayPaymentsPaymentMethodAvailability;
275
- };
276
- type MoonPayPaymentsPaymentMethodAvailability = {
277
- /**
278
- * Whether the payment method is available
279
- */
280
- active: boolean;
281
- /**
282
- * If the payment method is not available, reasons explaining why.
283
- */
284
- reasons?: Array<string>;
285
- };
286
- type MoonPayPaymentsPaymentMethodCapabilities = {
287
- /**
288
- * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes of fiat currencies supported by this payment method.
289
- */
290
- supportedCurrencies: Array<string>;
291
- /**
292
- * Transaction types supported by this payment method.
293
- */
294
- supportedTransactionTypes: Array<string>;
295
- /**
296
- * Whether this payment method can be deleted.
297
- */
298
- allowsDeletion: boolean;
299
- /**
300
- * Whether this payment method requires the MoonPay widget to complete the payment flow.
301
- */
302
- requiresWidget: boolean;
303
- };
304
- type MoonPayPaymentsStoredCardPaymentMethod = MoonPayPaymentsStoredPaymentMethodBase & {
305
- cardType: MoonPayPaymentsCardType;
306
- /**
307
- * The card network brand
308
- */
309
- brand: MoonPayPaymentsCardBrand;
310
- /**
311
- * Last 4 digits of the card number
312
- */
313
- last4: string;
314
- /**
315
- * Expiration month as 2-digit string
316
- */
317
- expirationMonth: string;
318
- /**
319
- * Expiration year as 4-digit string
320
- */
321
- expirationYear: string;
322
- /**
323
- * Current availability of this stored card
324
- */
325
- availability: MoonPayPaymentsPaymentMethodAvailability;
326
- };
327
- /**
328
- * A stored payment method.
329
- */
330
- type MoonPayPaymentsStoredPaymentMethod = MoonPayPaymentsStoredPaymentMethodBase | MoonPayPaymentsStoredCardPaymentMethod;
331
- type MoonPayPaymentsStoredPaymentMethodBase = {
332
- /**
333
- * Unique identifier for the stored payment method
334
- */
335
- id: string;
336
- type: PaymentMethodType;
337
- };
338
- /**
339
- * A payment disclosure that the partner must render verbatim before the customer can complete the transaction.
340
- */
341
- type PaymentDisclosure = {
342
- /**
343
- * Stable identifier of the disclosure. Each id maps to one specific piece of text. The full list of ids and their canonical text is published in the developer documentation.
344
- */
345
- id: string;
346
- /**
347
- * Version of the disclosure text. Bumped whenever the canonical wording for this `id` changes. Partners that receive an unknown `(id, version)` pair should fall back to a conservative disclosure and alert their integration team.
348
- */
349
- version: string;
350
- };
351
- type PaymentMethodType = 'apple_pay' | 'card' | 'ach' | 'fps' | 'fps_open_banking' | 'google_pay' | 'sepa' | 'sepa_open_banking' | 'pix' | 'paypal' | 'venmo' | 'revolut_pay' | 'moonpay_balance' | 'interac';
352
- /**
353
- * A crypto asset available for purchase through MoonPay.
354
- */
355
- type PlatformAsset = {
356
- /**
357
- * The CAIP-19 asset identifier (encodes chain and contract). Use this value when creating quotes for unverified tokens.
358
- */
359
- caip19: string;
360
- /**
361
- * The asset code. Use this value when creating quotes for verified tokens.
362
- */
363
- code: string;
364
- /**
365
- * The human-readable name of the asset.
366
- */
367
- name: string;
368
- /**
369
- * The blockchain network code this asset belongs to.
370
- */
371
- network: string;
372
- /**
373
- * The on-chain contract address. Null for native gas tokens.
374
- */
375
- contractAddress: string | null;
376
- /**
377
- * The number of decimal places used on-chain, or null if unknown.
378
- */
379
- decimals: number | null;
380
- /**
381
- * The maximum decimal places MoonPay supports for trading this asset, or null if unknown.
382
- */
383
- precision: number | null;
384
- status: AssetStatus;
385
- };
386
- /**
387
- * Destination crypto asset returned on the quote. Adds the resolved network and, for DeFi tokens, the CAIP-19 identifier on top of the base asset fields.
388
- */
389
- type QuoteDestinationAsset = {
390
- /**
391
- * A fiat or crypto currency code.
392
- *
393
- * **Fiat**
394
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
395
- *
396
- * Currently only `USD` is supported.
397
- *
398
- * **Crypto**
399
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
400
- *
401
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
402
- */
403
- code: string;
404
- /**
405
- * The human-readable name
406
- */
407
- name?: string;
408
- /**
409
- * The number of supported decimal places
410
- */
411
- precision?: number;
412
- /**
413
- * The CAIP-19 asset identifier (encodes chain and contract). Present for DeFi tokens.
414
- */
415
- caip19?: string;
416
- };
417
- type QuoteLimitEntry = {
418
- /**
419
- * The maximum amount.
420
- */
421
- limit: LimitWithAsset;
422
- /**
423
- * The remaining amount.
424
- */
425
- remaining: LimitWithAsset;
426
- };
427
- /**
428
- * Limits applicable to the quote.
429
- */
430
- type QuoteLimits = {
431
- /**
432
- * The daily limit.
433
- */
434
- daily?: QuoteLimitEntry;
435
- /**
436
- * The monthly limit.
437
- */
438
- monthly?: QuoteLimitEntry;
439
- /**
440
- * The yearly limit.
441
- */
442
- yearly?: QuoteLimitEntry;
443
- };
444
- type QuotePaymentMethod = {
445
- type: PaymentMethodType;
446
- /**
447
- * Unique identifier of the payment method. Used to identify the specific card when type is card.
448
- */
449
- id?: string;
450
- };
451
- /**
452
- * A stage in the transaction lifecycle
453
- */
454
- type Stage = {
455
- kind?: StageKind;
456
- /**
457
- * The human-readable name of the stage.
458
- */
459
- name?: string;
460
- status?: StageStatus;
461
- /**
462
- * A developer-friendly message if the status is `failed`
463
- */
464
- failureReason?: string | null;
465
- };
466
- /**
467
- * The stages in a transaction lifecycle.
468
- */
469
- type StageKind = 'ordering' | 'waiting_payment' | 'waiting_authentication' | 'verification' | 'processing' | 'delivery' | 'crypto_hold';
470
- /**
471
- * The status of a transaction stage.
472
- */
473
- type StageStatus = 'not_started' | 'in_progress' | 'success' | 'failed';
474
- type Transaction = {
475
- /**
476
- * The MoonPay ID of the transaction.
477
- */
478
- id: string;
479
- /**
480
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the transaction was created.
481
- */
482
- createdAt: string;
483
- /**
484
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the transaction was last updated.
485
- */
486
- updatedAt: string;
487
- status: TransactionStatus;
488
- /**
489
- * Source amount and asset (fiat currency) the customer paid.
490
- */
491
- source: {
492
- /**
493
- * A stringified amount, which can include decimals.
494
- */
495
- amount: string;
496
- /**
497
- * The currency or token being spent
498
- */
499
- asset: AssetBase;
500
- };
501
- /**
502
- * Destination amount and asset (cryptocurrency) the customer receives.
503
- */
504
- destination: {
505
- /**
506
- * A stringified amount, which can include decimals.
507
- */
508
- amount: string;
509
- asset: AssetBase;
510
- };
511
- /**
512
- * Details of fees for the transaction.
513
- */
514
- fees: Fees;
515
- /**
516
- * The wallet used for the transaction.
517
- */
518
- wallet: Wallet;
519
- customer: TransactionCustomer;
520
- paymentMethod?: TransactionPaymentMethod;
521
- };
522
- type TransactionCustomer = {
523
- /**
524
- * The MoonPay ID of the customer associated with the transaction.
525
- */
526
- id: string;
527
- };
528
- type TransactionPaymentMethod = {
529
- type: PaymentMethodType;
530
- };
531
- /**
532
- * The status of a transaction.
533
- *
534
- * - `completed`: The transaction is finalized and assets were delivered.
535
- * - `failed`: The transaction failed. No payment was executed and funds were not transferred.
536
- * - `pending`: The transaction was created and payment is accepted. The transfer is in progress.
537
- */
538
- type TransactionStatus = 'completed' | 'failed' | 'pending';
539
- /**
540
- * Transaction with lifecycle stages showing step-by-step progress.
541
- */
542
- type TransactionWithStages = Transaction & {
543
- /**
544
- * Details of the stages in the transaction lifecycle.
545
- */
546
- stages?: Array<Stage>;
547
- };
548
- type Wallet = {
549
- /**
550
- * The wallet address used for the transaction.
551
- */
552
- address: string;
553
- /**
554
- * An optional memo or destination tag (used by some blockchains such as XRP or XLM).
555
- */
556
- tag?: string;
557
- };
558
- type AssetControllerListAssetsResponses = {
559
- /**
560
- * The request has succeeded.
561
- */
562
- 200: {
563
- data: Array<PlatformAsset>;
564
- pageInfo: MoonPayCorePaginationInfo;
565
- };
566
- };
567
- type AssetControllerListAssetsResponse = AssetControllerListAssetsResponses[keyof AssetControllerListAssetsResponses];
568
-
569
- export type { Asset, AssetBase, AssetStatus, CreateSessionTokenRequestBody, CreateSessionTokenResponse as CreateSessionTokenReturnType, Fees, GetQuoteBody as GetQuoteParams, LimitWithAsset, AssetControllerListAssetsResponse as ListAssetsResponse, MoonPayPaymentsListPaymentMethodsResponse as ListPaymentMethodsResponse, MonetaryFeeAmount, MoonPayCorePaginationInfo as PaginationInfo, MoonPayPaymentsPaymentMethodAvailability as PaymentMethodAvailability, MoonPayPaymentsPaymentMethodCapabilities as PaymentMethodCapabilities, MoonPayPaymentsPaymentMethod as PaymentMethodConfig, PaymentMethodType, PlatformAsset, GetQuoteResponse as Quote, QuoteLimitEntry, QuoteLimits, QuotePaymentMethod, Stage, StageKind, StageStatus, MoonPayPaymentsStoredCardPaymentMethod as StoredCardPaymentMethod, MoonPayPaymentsStoredPaymentMethod as StoredPaymentMethod, Transaction, TransactionCustomer, TransactionPaymentMethod, TransactionStatus, TransactionWithStages, Wallet };
1
+ export { A as Asset, y as AssetBase, z as AssetStatus, B as CreateSessionTokenRequestBody, D as CreateSessionTokenReturnType, F as Fees, G as GetQuoteParams, L as LimitWithAsset, E as ListAssetsResponse, M as ListPaymentMethodsResponse, H as MonetaryFeeAmount, J as PaginationInfo, K as PaymentMethodAvailability, N as PaymentMethodCapabilities, O as PaymentMethodConfig, P as PaymentMethodType, Q as PlatformAsset, T as Quote, V as QuoteLimitEntry, W as QuoteLimits, X as QuotePaymentMethod, Y as Stage, Z as StageKind, _ as StageStatus, $ as StoredCardPaymentMethod, a0 as StoredPaymentMethod, a1 as Transaction, a2 as TransactionCustomer, a3 as TransactionPaymentMethod, a4 as TransactionStatus, a5 as TransactionWithStages, a6 as Wallet } from './customer.js';
@@ -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/frames/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/frames/customer-export.ts"],"sourcesContent":["import type { ConnectionError } from '../models/connection.js';\n\nexport interface MessageMap {\n ready: void;\n error: ConnectionError;\n /**\n * The customer authorized the export. Forward `token` to your backend and\n * call `exportCustomer` (node SDK) before `tokenExpiresAt`.\n */\n complete: { token: string; tokenExpiresAt: string };\n close: void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { ConnectionError } from '../models/connection.cjs';
2
+
3
+ interface MessageMap {
4
+ ready: void;
5
+ error: ConnectionError;
6
+ /**
7
+ * The customer authorized the export. Forward `token` to your backend and
8
+ * call `exportCustomer` (node SDK) before `tokenExpiresAt`.
9
+ */
10
+ complete: {
11
+ token: string;
12
+ tokenExpiresAt: string;
13
+ };
14
+ close: void;
15
+ }
16
+
17
+ export type { MessageMap };
@@ -0,0 +1,17 @@
1
+ import { ConnectionError } from '../models/connection.js';
2
+
3
+ interface MessageMap {
4
+ ready: void;
5
+ error: ConnectionError;
6
+ /**
7
+ * The customer authorized the export. Forward `token` to your backend and
8
+ * call `exportCustomer` (node SDK) before `tokenExpiresAt`.
9
+ */
10
+ complete: {
11
+ token: string;
12
+ tokenExpiresAt: string;
13
+ };
14
+ close: void;
15
+ }
16
+
17
+ export type { MessageMap };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=customer-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -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":";;;;;;;;;;;;;;;;;;;;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;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":";;;;;;;;;;;;;;;;;;;;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;AAqLL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,qBAAkB;AAElB,EAAAA,qBAAA,6BAA0B;AAHhB,SAAAA;AAAA,GAAA;","names":["ConnectionStatus","ConnectionErrorCode"]}
@@ -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;