@moonpay/platform-sdk-core 1.29.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.cjs CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  getPaymentMethods: () => getPaymentMethods,
44
44
  getQuote: () => getQuote,
45
45
  getTransaction: () => getTransaction,
46
+ isAuthResult: () => isAuthResult,
46
47
  isSecureRandomAvailable: () => isSecureRandomAvailable,
47
48
  isTrustedFrameOrigin: () => isTrustedFrameOrigin,
48
49
  isTrustedFrameUrl: () => isTrustedFrameUrl,
@@ -1624,6 +1625,19 @@ function isSecureRandomAvailable() {
1624
1625
  return typeof globalThis.crypto?.getRandomValues === "function";
1625
1626
  }
1626
1627
 
1628
+ // src/frames/auth-result.ts
1629
+ var import_connection = require("@moonpay/platform-protocol/models/connection");
1630
+ var AUTH_RESULT_STATUSES = /* @__PURE__ */ new Set([
1631
+ import_connection.ConnectionStatus.active,
1632
+ import_connection.ConnectionStatus.pending,
1633
+ import_connection.ConnectionStatus.termsAcceptanceRequired,
1634
+ import_connection.ConnectionStatus.unavailable,
1635
+ import_connection.ConnectionStatus.failed
1636
+ ]);
1637
+ function isAuthResult(connection) {
1638
+ return AUTH_RESULT_STATUSES.has(connection.status);
1639
+ }
1640
+
1627
1641
  // src/frames/frame-orchestrator.ts
1628
1642
  var import_protocol = require("@moonpay/platform-protocol/protocol");
1629
1643
  function createFrameOrchestrator(options) {
@@ -1736,13 +1750,20 @@ function buildFrameUrl(path, query = {}, options = {}) {
1736
1750
  return url.href;
1737
1751
  }
1738
1752
  function themeParams(theme) {
1739
- return theme?.appearance ? { theme: theme.appearance } : {};
1753
+ const params = {};
1754
+ if (theme?.appearance) params.theme = theme.appearance;
1755
+ if (theme?.brandColor) params.brandColor = theme.brandColor;
1756
+ if (theme?.customTheme) params.customTheme = JSON.stringify(theme.customTheme);
1757
+ return params;
1740
1758
  }
1741
1759
  function applyThemeParam(url, theme) {
1742
- if (!theme?.appearance) return url;
1760
+ const params = Object.entries(themeParams(theme));
1761
+ if (params.length === 0) return url;
1743
1762
  const parsed = new URL(url);
1744
- if (!parsed.searchParams.has("theme")) {
1745
- parsed.searchParams.set("theme", theme.appearance);
1763
+ for (const [key, value] of params) {
1764
+ if (!parsed.searchParams.has(key)) {
1765
+ parsed.searchParams.set(key, value);
1766
+ }
1746
1767
  }
1747
1768
  return parsed.href;
1748
1769
  }