@moonpay/platform-sdk-core 1.30.0 → 1.31.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/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 {
@@ -395,6 +396,13 @@ declare function generateKeyPair(): KeyPair;
395
396
  */
396
397
  declare function isSecureRandomAvailable(): boolean;
397
398
 
399
+ /**
400
+ * Whether an auth frame `complete` payload is a sign-in result to forward to
401
+ * the partner. `connectionRequired` is excluded: the customer has just
402
+ * authenticated, so it is never a valid outcome of the auth frame.
403
+ */
404
+ declare function isAuthResult(connection: Connection): connection is AuthFrame.MessageMap['complete'];
405
+
398
406
  interface FrameOrchestratorOptions {
399
407
  transport: FrameTransport;
400
408
  channelId: string;
@@ -449,4 +457,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
449
457
  */
450
458
  declare function isTrustedFrameUrl(value: string): boolean;
451
459
 
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 };
460
+ 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 {
@@ -395,6 +396,13 @@ declare function generateKeyPair(): KeyPair;
395
396
  */
396
397
  declare function isSecureRandomAvailable(): boolean;
397
398
 
399
+ /**
400
+ * Whether an auth frame `complete` payload is a sign-in result to forward to
401
+ * the partner. `connectionRequired` is excluded: the customer has just
402
+ * authenticated, so it is never a valid outcome of the auth frame.
403
+ */
404
+ declare function isAuthResult(connection: Connection): connection is AuthFrame.MessageMap['complete'];
405
+
398
406
  interface FrameOrchestratorOptions {
399
407
  transport: FrameTransport;
400
408
  channelId: string;
@@ -449,4 +457,4 @@ declare function isTrustedFrameOrigin(origin: string): boolean;
449
457
  */
450
458
  declare function isTrustedFrameUrl(value: string): boolean;
451
459
 
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 };
460
+ 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,