@moonpay/platform-protocol 1.0.2 → 1.4.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 +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 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 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":[]}
@@ -3,6 +3,8 @@ import { FrameTransaction } from '../models/transaction.cjs';
3
3
  import { FrameError } from '../protocol.cjs';
4
4
 
5
5
  interface MessageMap {
6
+ /** Frame's UI is rendered and ready to be shown. */
7
+ ready: void;
6
8
  complete: {
7
9
  transaction: FrameTransaction;
8
10
  };
@@ -3,6 +3,8 @@ import { FrameTransaction } from '../models/transaction.js';
3
3
  import { FrameError } from '../protocol.js';
4
4
 
5
5
  interface MessageMap {
6
+ /** Frame's UI is rendered and ready to be shown. */
7
+ ready: void;
6
8
  complete: {
7
9
  transaction: FrameTransaction;
8
10
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/models/transaction.ts"],"sourcesContent":["/**\n * Transaction shape as sent within frame postMessage payloads.\n * Two variants: happy path (`{ id, status }`) and explicit failed path with\n * `failureReason` for partner-facing diagnostics.\n */\nexport type FrameTransaction =\n | { id: string; status: string }\n | { id?: string; status: 'failed'; failureReason: string };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/models/transaction.ts"],"sourcesContent":["export type FrameTransactionStatus = 'pending' | 'completed' | 'failed';\n\nexport type FrameTransactionFailureCode =\n | 'applePayMerchantUnavailable'\n | 'authorizationDeclined'\n | 'serviceUnavailable'\n | 'transactionDeclined'\n | 'transactionNotAllowed'\n | 'unknown'\n | 'validationError';\n\n/**\n * Transaction shape as sent within frame postMessage payloads.\n * Two variants: happy path (`{ id, status }`) and explicit failed path with\n * `failureReason` for partner-facing diagnostics.\n */\nexport type FrameTransaction =\n | { id: string; status: FrameTransactionStatus }\n | {\n id?: string;\n status: 'failed';\n failureReason: string;\n failureCode: FrameTransactionFailureCode;\n };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,3 +1,5 @@
1
+ type FrameTransactionStatus = 'pending' | 'completed' | 'failed';
2
+ type FrameTransactionFailureCode = 'applePayMerchantUnavailable' | 'authorizationDeclined' | 'serviceUnavailable' | 'transactionDeclined' | 'transactionNotAllowed' | 'unknown' | 'validationError';
1
3
  /**
2
4
  * Transaction shape as sent within frame postMessage payloads.
3
5
  * Two variants: happy path (`{ id, status }`) and explicit failed path with
@@ -5,11 +7,12 @@
5
7
  */
6
8
  type FrameTransaction = {
7
9
  id: string;
8
- status: string;
10
+ status: FrameTransactionStatus;
9
11
  } | {
10
12
  id?: string;
11
13
  status: 'failed';
12
14
  failureReason: string;
15
+ failureCode: FrameTransactionFailureCode;
13
16
  };
14
17
 
15
- export type { FrameTransaction };
18
+ export type { FrameTransaction, FrameTransactionFailureCode, FrameTransactionStatus };
@@ -1,3 +1,5 @@
1
+ type FrameTransactionStatus = 'pending' | 'completed' | 'failed';
2
+ type FrameTransactionFailureCode = 'applePayMerchantUnavailable' | 'authorizationDeclined' | 'serviceUnavailable' | 'transactionDeclined' | 'transactionNotAllowed' | 'unknown' | 'validationError';
1
3
  /**
2
4
  * Transaction shape as sent within frame postMessage payloads.
3
5
  * Two variants: happy path (`{ id, status }`) and explicit failed path with
@@ -5,11 +7,12 @@
5
7
  */
6
8
  type FrameTransaction = {
7
9
  id: string;
8
- status: string;
10
+ status: FrameTransactionStatus;
9
11
  } | {
10
12
  id?: string;
11
13
  status: 'failed';
12
14
  failureReason: string;
15
+ failureCode: FrameTransactionFailureCode;
13
16
  };
14
17
 
15
- export type { FrameTransaction };
18
+ export type { FrameTransaction, FrameTransactionFailureCode, FrameTransactionStatus };
@@ -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: '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: '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":[]}
@@ -4,6 +4,8 @@ import '../models/transaction.cjs';
4
4
  import '../protocol.cjs';
5
5
 
6
6
  type Event = {
7
+ kind: 'ready';
8
+ } | {
7
9
  kind: 'complete';
8
10
  payload: MessageMap['complete'];
9
11
  } | {
@@ -4,6 +4,8 @@ import '../models/transaction.js';
4
4
  import '../protocol.js';
5
5
 
6
6
  type Event = {
7
+ kind: 'ready';
8
+ } | {
7
9
  kind: 'complete';
8
10
  payload: MessageMap['complete'];
9
11
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonpay/platform-protocol",
3
- "version": "1.0.2",
3
+ "version": "1.4.0",
4
4
  "description": "Shared protocol types for the MoonPay Developer Platform",
5
5
  "type": "module",
6
6
  "exports": {