@moonpay/platform-protocol 1.24.2 → 1.25.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.
- package/dist/frames/buy-button.cjs.map +1 -1
- package/dist/frames/buy-button.d.cts +7 -1
- package/dist/frames/buy-button.d.ts +7 -1
- package/dist/frames/challenge.cjs.map +1 -1
- package/dist/frames/challenge.d.cts +15 -1
- package/dist/frames/challenge.d.ts +15 -1
- package/dist/sdks/buy-button.cjs.map +1 -1
- package/dist/sdks/buy-button.d.cts +3 -0
- package/dist/sdks/buy-button.d.ts +3 -0
- package/package.json +5 -1
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonpay/platform-protocol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Shared protocol types for the MoonPay Developer Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -332,6 +332,10 @@
|
|
|
332
332
|
},
|
|
333
333
|
"sideEffects": false,
|
|
334
334
|
"license": "MIT",
|
|
335
|
+
"repository": {
|
|
336
|
+
"type": "git",
|
|
337
|
+
"url": "git+https://github.com/moonpay/moonpay-platform-sdk.git"
|
|
338
|
+
},
|
|
335
339
|
"publishConfig": {
|
|
336
340
|
"access": "public"
|
|
337
341
|
}
|