@swype-org/deposit 0.3.23 → 0.3.26

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
@@ -1,5 +1,5 @@
1
- import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-iQf3f-_m.cjs';
2
- export { C as CheckoutConfig, e as CheckoutError, f as CheckoutErrorCode, g as CheckoutStatus, h as DepositErrorCode, S as SignerFunction, i as SignerRequest, j as SignerResponse, T as TransferSummary, k as getDisplayMessage } from './types-iQf3f-_m.cjs';
1
+ import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-BjnQ2ux2.cjs';
2
+ export { C as CheckoutConfig, e as CheckoutError, f as CheckoutErrorCode, g as CheckoutStatus, h as DepositErrorCode, S as SignerFunction, i as SignerRequest, j as SignerResponse, T as TransferSummary, k as getDisplayMessage } from './types-BjnQ2ux2.cjs';
3
3
 
4
4
  declare const DEFAULT_WEBVIEW_BASE_URL = "https://pay.blink.cash";
5
5
  declare const SANDBOX_WEBVIEW_BASE_URL = "https://pay-sandbox.blink.cash";
@@ -94,6 +94,18 @@ declare class Deposit {
94
94
  * config, so the full widget renders only when both allow it.
95
95
  */
96
96
  private applyFullWidgetParam;
97
+ /**
98
+ * Appends `appearance=dark` (or `appearance=system`) to the hosted-flow URL.
99
+ * An explicit `appearance: { theme }` config always wins — including
100
+ * `theme: 'light'`, which pins light regardless of the merchant page. When
101
+ * the merchant passes no theme, the default follows the merchant page's own
102
+ * declared color scheme (see {@link detectMerchantColorScheme}) so the flow
103
+ * doesn't render a light modal on a page that says it is dark. Absence of
104
+ * the param means light. The hosted flow resolves `system` against the
105
+ * user's `prefers-color-scheme`. Applied alongside the full-widget param on
106
+ * every hosted/preload URL.
107
+ */
108
+ private applyAppearanceParam;
97
109
  /** Fluid is the default; `layout: 'fixed'` opts back into the legacy container. */
98
110
  private isFluidLayout;
99
111
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-iQf3f-_m.js';
2
- export { C as CheckoutConfig, e as CheckoutError, f as CheckoutErrorCode, g as CheckoutStatus, h as DepositErrorCode, S as SignerFunction, i as SignerRequest, j as SignerResponse, T as TransferSummary, k as getDisplayMessage } from './types-iQf3f-_m.js';
1
+ import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-BjnQ2ux2.js';
2
+ export { C as CheckoutConfig, e as CheckoutError, f as CheckoutErrorCode, g as CheckoutStatus, h as DepositErrorCode, S as SignerFunction, i as SignerRequest, j as SignerResponse, T as TransferSummary, k as getDisplayMessage } from './types-BjnQ2ux2.js';
3
3
 
4
4
  declare const DEFAULT_WEBVIEW_BASE_URL = "https://pay.blink.cash";
5
5
  declare const SANDBOX_WEBVIEW_BASE_URL = "https://pay-sandbox.blink.cash";
@@ -94,6 +94,18 @@ declare class Deposit {
94
94
  * config, so the full widget renders only when both allow it.
95
95
  */
96
96
  private applyFullWidgetParam;
97
+ /**
98
+ * Appends `appearance=dark` (or `appearance=system`) to the hosted-flow URL.
99
+ * An explicit `appearance: { theme }` config always wins — including
100
+ * `theme: 'light'`, which pins light regardless of the merchant page. When
101
+ * the merchant passes no theme, the default follows the merchant page's own
102
+ * declared color scheme (see {@link detectMerchantColorScheme}) so the flow
103
+ * doesn't render a light modal on a page that says it is dark. Absence of
104
+ * the param means light. The hosted flow resolves `system` against the
105
+ * user's `prefers-color-scheme`. Applied alongside the full-widget param on
106
+ * every hosted/preload URL.
107
+ */
108
+ private applyAppearanceParam;
97
109
  /** Fluid is the default; `layout: 'fixed'` opts back into the legacy container. */
98
110
  private isFluidLayout;
99
111
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ALLOWED_RPC_METHODS, BRIDGE_PROTOCOL_VERSION, Checkout, CheckoutError, DEFAULT_WEBVIEW_BASE_URL, Deposit, DepositError, SANDBOX_WEBVIEW_BASE_URL, attachRpcHost, createWalletDiscoverer, getDisplayMessage, parseBridgeMessage } from './chunk-JD7GTL6D.js';
1
+ export { ALLOWED_RPC_METHODS, BRIDGE_PROTOCOL_VERSION, Checkout, CheckoutError, DEFAULT_WEBVIEW_BASE_URL, Deposit, DepositError, SANDBOX_WEBVIEW_BASE_URL, attachRpcHost, createWalletDiscoverer, getDisplayMessage, parseBridgeMessage } from './chunk-S3SPMEXQ.js';
2
2
 
3
3
  // src/index.ts
4
4
  var VERSION = "0.3.0";
package/dist/react.cjs CHANGED
@@ -571,7 +571,7 @@ var STYLES = `
571
571
  [data-blink-overlay][data-blink-mobile-sheet]{align-items:flex-end;touch-action:none;overscroll-behavior:contain}
572
572
  [data-blink-container]{width:min(420px,92vw);height:min(600px,85vh);border-radius:24px;overflow:hidden;box-shadow:0 24px 80px rgba(0,0,0,.4);animation:blink-slide-up .25s ease-out;display:flex;flex-direction:column;background:transparent}
573
573
  [data-blink-overlay][data-blink-closing] [data-blink-container]{opacity:0;transition:opacity ${CLOSE_DURATION_MS}ms ease-in}
574
- [data-blink-container] iframe{width:100%;flex:1;border:none;display:block;background:transparent;color-scheme:normal;border-radius:inherit}
574
+ [data-blink-container] iframe{width:100%;flex:1;border:none;display:block;background:transparent;color-scheme:light;border-radius:inherit}
575
575
  [data-blink-overlay][data-blink-mobile-sheet] [data-blink-container]{width:100%;max-width:100%;height:79vh;border-radius:24px 24px 0 0;box-shadow:0 -8px 40px rgba(0,0,0,.25);animation:blink-slide-up-full .35s cubic-bezier(.32,.72,0,1);padding-bottom:env(safe-area-inset-bottom,0px)}
576
576
  [data-blink-overlay][data-blink-mobile-sheet][data-blink-closing] [data-blink-container]{opacity:1;animation:blink-slide-down-full ${CLOSE_DURATION_MS}ms ease-in forwards}
577
577
  @media(max-width:${MOBILE_SHEET_MAX_VIEWPORT_PX}px){[data-blink-overlay]{align-items:flex-end;touch-action:none;overscroll-behavior:contain}[data-blink-container]{width:100%;max-width:100%;height:79vh;border-radius:24px 24px 0 0;box-shadow:0 -8px 40px rgba(0,0,0,.25);animation:blink-slide-up-full .35s cubic-bezier(.32,.72,0,1);padding-bottom:env(safe-area-inset-bottom,0px)}[data-blink-overlay][data-blink-closing] [data-blink-container]{opacity:1;animation:blink-slide-down-full ${CLOSE_DURATION_MS}ms ease-in forwards}}
@@ -1178,6 +1178,24 @@ var Deposit = class {
1178
1178
  if (this.config.enableFullWidget === false) {
1179
1179
  url.searchParams.set("enableFullWidget", "false");
1180
1180
  }
1181
+ this.applyAppearanceParam(url);
1182
+ }
1183
+ /**
1184
+ * Appends `appearance=dark` (or `appearance=system`) to the hosted-flow URL.
1185
+ * An explicit `appearance: { theme }` config always wins — including
1186
+ * `theme: 'light'`, which pins light regardless of the merchant page. When
1187
+ * the merchant passes no theme, the default follows the merchant page's own
1188
+ * declared color scheme (see {@link detectMerchantColorScheme}) so the flow
1189
+ * doesn't render a light modal on a page that says it is dark. Absence of
1190
+ * the param means light. The hosted flow resolves `system` against the
1191
+ * user's `prefers-color-scheme`. Applied alongside the full-widget param on
1192
+ * every hosted/preload URL.
1193
+ */
1194
+ applyAppearanceParam(url) {
1195
+ const theme = this.config.appearance?.theme ?? detectMerchantColorScheme();
1196
+ if (theme === "dark" || theme === "system") {
1197
+ url.searchParams.set("appearance", theme);
1198
+ }
1181
1199
  }
1182
1200
  /** Fluid is the default; `layout: 'fixed'` opts back into the legacy container. */
1183
1201
  isFluidLayout() {
@@ -1440,6 +1458,23 @@ var Deposit = class {
1440
1458
  }
1441
1459
  }
1442
1460
  };
1461
+ function detectMerchantColorScheme() {
1462
+ if (typeof window === "undefined" || typeof document === "undefined") return null;
1463
+ const root = document.documentElement;
1464
+ if (!root || typeof window.getComputedStyle !== "function") return null;
1465
+ let value;
1466
+ try {
1467
+ value = window.getComputedStyle(root).colorScheme ?? "";
1468
+ } catch {
1469
+ return null;
1470
+ }
1471
+ const tokens = value.toLowerCase().split(/\s+/);
1472
+ const dark = tokens.includes("dark");
1473
+ const light = tokens.includes("light");
1474
+ if (dark && light) return "system";
1475
+ if (dark) return "dark";
1476
+ return null;
1477
+ }
1443
1478
  function svgToDataUri(svg) {
1444
1479
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
1445
1480
  }