@moonpay/platform-protocol 1.24.3 → 1.26.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.
@@ -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/api/enterprise.ts
17
+ var enterprise_exports = {};
18
+ module.exports = __toCommonJS(enterprise_exports);
19
+ //# sourceMappingURL=enterprise.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/enterprise.ts"],"sourcesContent":["/**\n * Enterprise quote type, aliased from the generated Enterprise OpenAPI types.\n * The rest of the Enterprise API is server-to-server and intentionally not\n * part of the SDK.\n *\n * Quotes are created from your server (`POST /enterprise/v1/quotes`); pass the\n * resulting `signature` to the enterprise frames as `quote`.\n */\nexport type { CreateTransferQuoteResponse as EnterpriseQuote } from './gen/enterprise/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,42 @@
1
+ type CreateTransferQuoteResponse = {
2
+ kind: MoonPayDevPlatformTransferKind;
3
+ source: QuoteFiatLeg | QuoteCryptoLeg;
4
+ destination: QuoteFiatLeg | QuoteWalletLeg;
5
+ mode: ExchangeRateMode;
6
+ feeBehavior: FeeBehavior;
7
+ expiresAt?: string;
8
+ exchangeRate: string;
9
+ signature: string;
10
+ };
11
+ type CryptoAsset = {
12
+ code: string;
13
+ caip19?: string;
14
+ };
15
+ type ExchangeRateMode = 'fixed' | 'floating';
16
+ type FeeBehavior = 'inclusive' | 'exclusive';
17
+ type FiatAsset = {
18
+ code: string;
19
+ };
20
+ type MoonPayDevPlatformTransferKind = 'buy' | 'sell';
21
+ type QuoteCryptoLeg = {
22
+ amount?: string;
23
+ asset: CryptoAsset;
24
+ };
25
+ type QuoteFiatLeg = {
26
+ amount?: string;
27
+ asset: FiatAsset;
28
+ };
29
+ type QuoteWalletLeg = {
30
+ amount?: string;
31
+ asset: CryptoAsset;
32
+ /**
33
+ * Wallet address that receives the crypto. When set, it is signed into the quote and the transfer must use the same address.
34
+ */
35
+ address?: string;
36
+ /**
37
+ * Destination tag or memo, for networks that need one.
38
+ */
39
+ tag?: string;
40
+ };
41
+
42
+ export type { CreateTransferQuoteResponse as EnterpriseQuote };
@@ -0,0 +1,42 @@
1
+ type CreateTransferQuoteResponse = {
2
+ kind: MoonPayDevPlatformTransferKind;
3
+ source: QuoteFiatLeg | QuoteCryptoLeg;
4
+ destination: QuoteFiatLeg | QuoteWalletLeg;
5
+ mode: ExchangeRateMode;
6
+ feeBehavior: FeeBehavior;
7
+ expiresAt?: string;
8
+ exchangeRate: string;
9
+ signature: string;
10
+ };
11
+ type CryptoAsset = {
12
+ code: string;
13
+ caip19?: string;
14
+ };
15
+ type ExchangeRateMode = 'fixed' | 'floating';
16
+ type FeeBehavior = 'inclusive' | 'exclusive';
17
+ type FiatAsset = {
18
+ code: string;
19
+ };
20
+ type MoonPayDevPlatformTransferKind = 'buy' | 'sell';
21
+ type QuoteCryptoLeg = {
22
+ amount?: string;
23
+ asset: CryptoAsset;
24
+ };
25
+ type QuoteFiatLeg = {
26
+ amount?: string;
27
+ asset: FiatAsset;
28
+ };
29
+ type QuoteWalletLeg = {
30
+ amount?: string;
31
+ asset: CryptoAsset;
32
+ /**
33
+ * Wallet address that receives the crypto. When set, it is signed into the quote and the transfer must use the same address.
34
+ */
35
+ address?: string;
36
+ /**
37
+ * Destination tag or memo, for networks that need one.
38
+ */
39
+ tag?: string;
40
+ };
41
+
42
+ export type { CreateTransferQuoteResponse as EnterpriseQuote };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=enterprise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/frames/buy-button.ts"],"sourcesContent":["import type { ChallengeRequired } from '../models/challenge.js';\nimport type { FrameTransaction } from '../models/transaction.js';\nimport type { FrameError } from '../protocol.js';\n\nexport interface MessageMap {\n /** Frame's UI is rendered and ready to be shown. */\n ready: void;\n /**\n * Fired the instant the user taps the native wallet-pay button (Apple Pay /\n * Google Pay) rendered by the buy button frame, BEFORE the OS payment sheet is\n * presented. This is an intent-to-buy / tap signal, distinct from `complete`\n * (the purchase outcome). It fires unconditionally on tap, even if the user\n * later cancels the sheet.\n */\n buttonPressed: void;\n complete: { transaction: FrameTransaction };\n /** Signals that the pipeline requires a challenge step. Load `url` in a challenge frame. */\n challenge: ChallengeRequired;\n error: FrameError;\n}\n\nexport interface OutboundMessageMap {\n setQuote: { quote: { signature: string } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/frames/buy-button.ts"],"sourcesContent":["import type { ChallengeRequired } from '../models/challenge.js';\nimport type { FrameTransaction } from '../models/transaction.js';\nimport type { FrameError } from '../protocol.js';\n\nexport interface MessageMap {\n /** Frame's UI is rendered and ready to be shown. */\n ready: void;\n /**\n * Fired the instant the user taps the native wallet-pay button (Apple Pay /\n * Google Pay) rendered by the buy button frame, BEFORE the OS payment sheet is\n * presented. This is an intent-to-buy / tap signal, distinct from `complete`\n * (the purchase outcome). It fires unconditionally on tap, even if the user\n * later cancels the sheet.\n */\n buttonPressed: void;\n complete: { transaction: FrameTransaction };\n /** Signals that the pipeline requires a challenge step. Load `url` in a challenge frame. */\n challenge: ChallengeRequired;\n /**\n * Fired when the user dismisses the Apple Pay / Google Pay payment sheet\n * without completing the purchase. Not a failure: the flow can be re-initiated.\n */\n cancelled: FrameError<'payment_sheet_dismissed'>;\n /** `unsupportedPaymentMethod`: the quote's payment method has no button in this frame. */\n error: FrameError<\n | 'configurationError'\n | 'invalidQuote'\n | 'quoteExpired'\n | 'applePayUnavailable'\n | 'googlePayUnavailable'\n | 'unsupportedPaymentMethod'\n | 'generic'\n >;\n}\n\nexport interface OutboundMessageMap {\n setQuote: { quote: { signature: string } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -18,7 +18,13 @@ interface MessageMap {
18
18
  };
19
19
  /** Signals that the pipeline requires a challenge step. Load `url` in a challenge frame. */
20
20
  challenge: ChallengeRequired;
21
- error: FrameError;
21
+ /**
22
+ * Fired when the user dismisses the Apple Pay / Google Pay payment sheet
23
+ * without completing the purchase. Not a failure: the flow can be re-initiated.
24
+ */
25
+ cancelled: FrameError<'payment_sheet_dismissed'>;
26
+ /** `unsupportedPaymentMethod`: the quote's payment method has no button in this frame. */
27
+ error: FrameError<'configurationError' | 'invalidQuote' | 'quoteExpired' | 'applePayUnavailable' | 'googlePayUnavailable' | 'unsupportedPaymentMethod' | 'generic'>;
22
28
  }
23
29
  interface OutboundMessageMap {
24
30
  setQuote: {
@@ -18,7 +18,13 @@ interface MessageMap {
18
18
  };
19
19
  /** Signals that the pipeline requires a challenge step. Load `url` in a challenge frame. */
20
20
  challenge: ChallengeRequired;
21
- error: FrameError;
21
+ /**
22
+ * Fired when the user dismisses the Apple Pay / Google Pay payment sheet
23
+ * without completing the purchase. Not a failure: the flow can be re-initiated.
24
+ */
25
+ cancelled: FrameError<'payment_sheet_dismissed'>;
26
+ /** `unsupportedPaymentMethod`: the quote's payment method has no button in this frame. */
27
+ error: FrameError<'configurationError' | 'invalidQuote' | 'quoteExpired' | 'applePayUnavailable' | 'googlePayUnavailable' | 'unsupportedPaymentMethod' | 'generic'>;
22
28
  }
23
29
  interface OutboundMessageMap {
24
30
  setQuote: {
@@ -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 /**\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":[]}
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\n/**\n * Set on an identity `complete` when the customer cannot be verified yet\n * (`pending`, the same wording as the connect frame) or at all (`unavailable`).\n * Absent when verification finished.\n */\nexport type IdentityChallengeStatus = 'pending' | 'unavailable';\n\nexport type CompleteResult = (\n | { flow: 'buy'; transaction: FrameTransaction }\n | { flow: 'identity'; identityId: string; status?: IdentityChallengeStatus }\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 * Known `error` codes. `error.code` stays `string` because the identity flow\n * forwards the identity API's own codes, so treat this list as non-exhaustive.\n * The snake_case codes are already published and keep their spelling.\n * A failed payment is a `complete` with a failed transaction, not an `error`.\n */\nexport type ErrorCode =\n | 'configurationError'\n | 'generic'\n | 'invalid_token'\n | 'invalid_challenge'\n | 'unsupported_flow'\n | 'missing_quote'\n | 'quoteExpired'\n | 'unsupportedPaymentMethod'\n | 'applePayUnavailable'\n | 'googlePayUnavailable'\n | 'customer_status_pending'\n | 'customer_status_unavailable';\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":[]}
@@ -7,12 +7,19 @@ import { FrameError } from '../protocol.cjs';
7
7
  * `rejected` reflect a persisted review outcome, not a transient in-progress signal.
8
8
  */
9
9
  type GuestCheckoutLimitUpgradeStatus = 'pending' | 'upgraded' | 'rejected';
10
+ /**
11
+ * Set on an identity `complete` when the customer cannot be verified yet
12
+ * (`pending`, the same wording as the connect frame) or at all (`unavailable`).
13
+ * Absent when verification finished.
14
+ */
15
+ type IdentityChallengeStatus = 'pending' | 'unavailable';
10
16
  type CompleteResult = ({
11
17
  flow: 'buy';
12
18
  transaction: FrameTransaction;
13
19
  } | {
14
20
  flow: 'identity';
15
21
  identityId: string;
22
+ status?: IdentityChallengeStatus;
16
23
  } | {
17
24
  flow: 'guest_checkout_limit_upgrade';
18
25
  status: GuestCheckoutLimitUpgradeStatus;
@@ -28,6 +35,13 @@ type Cancellation = {
28
35
  } | {
29
36
  flow: 'guest_checkout_limit_upgrade';
30
37
  };
38
+ /**
39
+ * Known `error` codes. `error.code` stays `string` because the identity flow
40
+ * forwards the identity API's own codes, so treat this list as non-exhaustive.
41
+ * The snake_case codes are already published and keep their spelling.
42
+ * A failed payment is a `complete` with a failed transaction, not an `error`.
43
+ */
44
+ type ErrorCode = 'configurationError' | 'generic' | 'invalid_token' | 'invalid_challenge' | 'unsupported_flow' | 'missing_quote' | 'quoteExpired' | 'unsupportedPaymentMethod' | 'applePayUnavailable' | 'googlePayUnavailable' | 'customer_status_pending' | 'customer_status_unavailable';
31
45
  /**
32
46
  * The challenge frame is fully self-contained — it is driven by the
33
47
  * `challengeToken` URL param. There is no parent → child message map.
@@ -48,4 +62,4 @@ interface MessageMap {
48
62
  error: FrameError;
49
63
  }
50
64
 
51
- export type { Cancellation, CompleteResult, GuestCheckoutLimitUpgradeStatus, MessageMap };
65
+ export type { Cancellation, CompleteResult, ErrorCode, GuestCheckoutLimitUpgradeStatus, IdentityChallengeStatus, MessageMap };
@@ -7,12 +7,19 @@ import { FrameError } from '../protocol.js';
7
7
  * `rejected` reflect a persisted review outcome, not a transient in-progress signal.
8
8
  */
9
9
  type GuestCheckoutLimitUpgradeStatus = 'pending' | 'upgraded' | 'rejected';
10
+ /**
11
+ * Set on an identity `complete` when the customer cannot be verified yet
12
+ * (`pending`, the same wording as the connect frame) or at all (`unavailable`).
13
+ * Absent when verification finished.
14
+ */
15
+ type IdentityChallengeStatus = 'pending' | 'unavailable';
10
16
  type CompleteResult = ({
11
17
  flow: 'buy';
12
18
  transaction: FrameTransaction;
13
19
  } | {
14
20
  flow: 'identity';
15
21
  identityId: string;
22
+ status?: IdentityChallengeStatus;
16
23
  } | {
17
24
  flow: 'guest_checkout_limit_upgrade';
18
25
  status: GuestCheckoutLimitUpgradeStatus;
@@ -28,6 +35,13 @@ type Cancellation = {
28
35
  } | {
29
36
  flow: 'guest_checkout_limit_upgrade';
30
37
  };
38
+ /**
39
+ * Known `error` codes. `error.code` stays `string` because the identity flow
40
+ * forwards the identity API's own codes, so treat this list as non-exhaustive.
41
+ * The snake_case codes are already published and keep their spelling.
42
+ * A failed payment is a `complete` with a failed transaction, not an `error`.
43
+ */
44
+ type ErrorCode = 'configurationError' | 'generic' | 'invalid_token' | 'invalid_challenge' | 'unsupported_flow' | 'missing_quote' | 'quoteExpired' | 'unsupportedPaymentMethod' | 'applePayUnavailable' | 'googlePayUnavailable' | 'customer_status_pending' | 'customer_status_unavailable';
31
45
  /**
32
46
  * The challenge frame is fully self-contained — it is driven by the
33
47
  * `challengeToken` URL param. There is no parent → child message map.
@@ -48,4 +62,4 @@ interface MessageMap {
48
62
  error: FrameError;
49
63
  }
50
64
 
51
- export type { Cancellation, CompleteResult, GuestCheckoutLimitUpgradeStatus, MessageMap };
65
+ export type { Cancellation, CompleteResult, ErrorCode, GuestCheckoutLimitUpgradeStatus, IdentityChallengeStatus, MessageMap };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/sdks/buy-button.ts"],"sourcesContent":["import type * as BuyButtonFrame from '../frames/buy-button.js';\n\nexport type Event =\n | { kind: 'ready' }\n | { kind: 'buttonPressed' }\n | { kind: 'complete'; payload: BuyButtonFrame.MessageMap['complete'] }\n | { kind: 'challenge'; payload: BuyButtonFrame.MessageMap['challenge'] }\n | { kind: 'error'; payload: BuyButtonFrame.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/buy-button.ts"],"sourcesContent":["import type * as BuyButtonFrame from '../frames/buy-button.js';\n\nexport type Event =\n | { kind: 'ready' }\n | { kind: 'buttonPressed' }\n | { kind: 'complete'; payload: BuyButtonFrame.MessageMap['complete'] }\n | { kind: 'challenge'; payload: BuyButtonFrame.MessageMap['challenge'] }\n | { kind: 'cancelled'; payload: BuyButtonFrame.MessageMap['cancelled'] }\n | { kind: 'error'; payload: BuyButtonFrame.MessageMap['error'] };\n\nexport interface SetupError {\n kind: 'configurationError' | 'genericError';\n message: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -13,6 +13,9 @@ type Event = {
13
13
  } | {
14
14
  kind: 'challenge';
15
15
  payload: MessageMap['challenge'];
16
+ } | {
17
+ kind: 'cancelled';
18
+ payload: MessageMap['cancelled'];
16
19
  } | {
17
20
  kind: 'error';
18
21
  payload: MessageMap['error'];
@@ -13,6 +13,9 @@ type Event = {
13
13
  } | {
14
14
  kind: 'challenge';
15
15
  payload: MessageMap['challenge'];
16
+ } | {
17
+ kind: 'cancelled';
18
+ payload: MessageMap['cancelled'];
16
19
  } | {
17
20
  kind: 'error';
18
21
  payload: MessageMap['error'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonpay/platform-protocol",
3
- "version": "1.24.3",
3
+ "version": "1.26.0",
4
4
  "description": "Shared protocol types for the MoonPay Developer Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -194,6 +194,16 @@
194
194
  "default": "./dist/api/customer.cjs"
195
195
  }
196
196
  },
197
+ "./api/enterprise": {
198
+ "import": {
199
+ "types": "./dist/api/enterprise.d.ts",
200
+ "default": "./dist/api/enterprise.js"
201
+ },
202
+ "require": {
203
+ "types": "./dist/api/enterprise.d.cts",
204
+ "default": "./dist/api/enterprise.cjs"
205
+ }
206
+ },
197
207
  "./api/errors": {
198
208
  "import": {
199
209
  "types": "./dist/api/errors.d.ts",
@@ -323,7 +333,7 @@
323
333
  "dev": "tsup --watch --config tsup.config.dev.ts",
324
334
  "typecheck": "tsc --noEmit",
325
335
  "clean": "rm -rf dist",
326
- "openapi": "openapi-ts -i https://api.moonpay.com/platform/openapi.json -o src/api/gen -p @hey-api/typescript"
336
+ "openapi": "openapi-ts -i https://api.moonpay.com/platform/openapi.json -o src/api/gen -p @hey-api/typescript && openapi-ts -i https://api.moonpay.com/enterprise/openapi.json -o src/api/gen/enterprise -p @hey-api/typescript"
327
337
  },
328
338
  "devDependencies": {
329
339
  "@hey-api/openapi-ts": "0.97.3",