@moonpay/platform-sdk-core 1.30.0 → 1.31.1
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/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,8 @@ import { IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentity
|
|
|
4
4
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
5
5
|
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsQuery, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
6
6
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
7
|
-
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
7
|
+
import { DecryptedCredentials, Connection } from '@moonpay/platform-protocol/models/connection';
|
|
8
|
+
import * as AuthFrame from '@moonpay/platform-protocol/frames/auth';
|
|
8
9
|
|
|
9
10
|
/** Internal state container for authenticated API access. */
|
|
10
11
|
interface ClientContext {
|
|
@@ -201,10 +202,9 @@ interface CustomTheme {
|
|
|
201
202
|
/**
|
|
202
203
|
* Theming options for visible MoonPay frames.
|
|
203
204
|
*
|
|
204
|
-
* `appearance` is honoured by every visible frame
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* the connect, add card, challenge and reset frames ignore them for now.
|
|
205
|
+
* `appearance` is honoured by every visible frame except the widget, which
|
|
206
|
+
* embeds the buy page without it. `brandColor` and `customTheme` are only
|
|
207
|
+
* shown by the auth frame for now; other frames receive them and ignore them.
|
|
208
208
|
*/
|
|
209
209
|
interface ThemeOptions {
|
|
210
210
|
/**
|
|
@@ -395,6 +395,13 @@ declare function generateKeyPair(): KeyPair;
|
|
|
395
395
|
*/
|
|
396
396
|
declare function isSecureRandomAvailable(): boolean;
|
|
397
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Whether an auth frame `complete` payload is a sign-in result to forward to
|
|
400
|
+
* the partner. `connectionRequired` is excluded: the customer has just
|
|
401
|
+
* authenticated, so it is never a valid outcome of the auth frame.
|
|
402
|
+
*/
|
|
403
|
+
declare function isAuthResult(connection: Connection): connection is AuthFrame.MessageMap['complete'];
|
|
404
|
+
|
|
398
405
|
interface FrameOrchestratorOptions {
|
|
399
406
|
transport: FrameTransport;
|
|
400
407
|
channelId: string;
|
|
@@ -449,4 +456,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
|
|
|
449
456
|
*/
|
|
450
457
|
declare function isTrustedFrameUrl(value: string): boolean;
|
|
451
458
|
|
|
452
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, type CustomTheme, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type HexColor, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyResumeParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
459
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, type CustomTheme, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type HexColor, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyResumeParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isAuthResult, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentity
|
|
|
4
4
|
import { Result } from '@moonpay/platform-protocol/result';
|
|
5
5
|
import { ListAssetsResponse, GetQuoteParams, Quote, TransactionWithStages, Transaction, PaginationInfo, ListPaymentMethodsQuery, ListPaymentMethodsResponse, SimulateBankTransferParams } from '@moonpay/platform-protocol/api';
|
|
6
6
|
import { ProtocolMessage } from '@moonpay/platform-protocol/protocol';
|
|
7
|
-
import { DecryptedCredentials } from '@moonpay/platform-protocol/models/connection';
|
|
7
|
+
import { DecryptedCredentials, Connection } from '@moonpay/platform-protocol/models/connection';
|
|
8
|
+
import * as AuthFrame from '@moonpay/platform-protocol/frames/auth';
|
|
8
9
|
|
|
9
10
|
/** Internal state container for authenticated API access. */
|
|
10
11
|
interface ClientContext {
|
|
@@ -201,10 +202,9 @@ interface CustomTheme {
|
|
|
201
202
|
/**
|
|
202
203
|
* Theming options for visible MoonPay frames.
|
|
203
204
|
*
|
|
204
|
-
* `appearance` is honoured by every visible frame
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* the connect, add card, challenge and reset frames ignore them for now.
|
|
205
|
+
* `appearance` is honoured by every visible frame except the widget, which
|
|
206
|
+
* embeds the buy page without it. `brandColor` and `customTheme` are only
|
|
207
|
+
* shown by the auth frame for now; other frames receive them and ignore them.
|
|
208
208
|
*/
|
|
209
209
|
interface ThemeOptions {
|
|
210
210
|
/**
|
|
@@ -395,6 +395,13 @@ declare function generateKeyPair(): KeyPair;
|
|
|
395
395
|
*/
|
|
396
396
|
declare function isSecureRandomAvailable(): boolean;
|
|
397
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Whether an auth frame `complete` payload is a sign-in result to forward to
|
|
400
|
+
* the partner. `connectionRequired` is excluded: the customer has just
|
|
401
|
+
* authenticated, so it is never a valid outcome of the auth frame.
|
|
402
|
+
*/
|
|
403
|
+
declare function isAuthResult(connection: Connection): connection is AuthFrame.MessageMap['complete'];
|
|
404
|
+
|
|
398
405
|
interface FrameOrchestratorOptions {
|
|
399
406
|
transport: FrameTransport;
|
|
400
407
|
channelId: string;
|
|
@@ -449,4 +456,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
|
|
|
449
456
|
*/
|
|
450
457
|
declare function isTrustedFrameUrl(value: string): boolean;
|
|
451
458
|
|
|
452
|
-
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, type CustomTheme, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type HexColor, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyResumeParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
|
459
|
+
export { type ClientContext, type ClientContextOptions, type CoreClient, type CoreClientOptions, type Credentials, type CustomTheme, FRAME_PATHS, type FrameHandle, type FrameOptions, type FrameOrchestratorOptions, type FrameTransport, type GetCredentialsError, type GetPaymentMethodsParams, type HexColor, type KeyPair, type ListAssetsParams, type ListTransactionsParams, type PresentationMode, TRUSTED_FRAME_ORIGIN_PATTERNS, type ThemeOptions, type UrlBuilderOptions, apiFetch, applyClientTokenParam, applyPresentationParam, applyResumeParam, applyThemeParam, buildFrameUrl, createClientContext, createClientCore, createFrameOrchestrator, createIdentity, decryptCredentials, deletePaymentMethod, generateKeyPair, getAssets, getCustomer, getCustomerUploadUrl, getIdentity, getIdentityUploadUrl, getPaymentMethods, getQuote, getTransaction, isAuthResult, isSecureRandomAvailable, isTrustedFrameOrigin, isTrustedFrameUrl, listTransactions, presentationParams, simulateBankTransfer, submitCustomerFiles, submitCustomerKyc, submitIdentityFiles, themeParams, updateIdentity, verifyIdentity };
|
package/dist/index.js
CHANGED
|
@@ -1564,6 +1564,19 @@ function isSecureRandomAvailable() {
|
|
|
1564
1564
|
return typeof globalThis.crypto?.getRandomValues === "function";
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
|
+
// src/frames/auth-result.ts
|
|
1568
|
+
import { ConnectionStatus } from "@moonpay/platform-protocol/models/connection";
|
|
1569
|
+
var AUTH_RESULT_STATUSES = /* @__PURE__ */ new Set([
|
|
1570
|
+
ConnectionStatus.active,
|
|
1571
|
+
ConnectionStatus.pending,
|
|
1572
|
+
ConnectionStatus.termsAcceptanceRequired,
|
|
1573
|
+
ConnectionStatus.unavailable,
|
|
1574
|
+
ConnectionStatus.failed
|
|
1575
|
+
]);
|
|
1576
|
+
function isAuthResult(connection) {
|
|
1577
|
+
return AUTH_RESULT_STATUSES.has(connection.status);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1567
1580
|
// src/frames/frame-orchestrator.ts
|
|
1568
1581
|
import {
|
|
1569
1582
|
HANDSHAKE_ACK_KIND,
|
|
@@ -1747,6 +1760,7 @@ export {
|
|
|
1747
1760
|
getPaymentMethods,
|
|
1748
1761
|
getQuote,
|
|
1749
1762
|
getTransaction,
|
|
1763
|
+
isAuthResult,
|
|
1750
1764
|
isSecureRandomAvailable,
|
|
1751
1765
|
isTrustedFrameOrigin,
|
|
1752
1766
|
isTrustedFrameUrl,
|