@swype-org/deposit 0.3.26 → 0.3.32

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/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-BjnQ2ux2.cjs';
2
- export { k as getDisplayMessage } from './types-BjnQ2ux2.cjs';
1
+ import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-QRkKxsoP.cjs';
2
+ export { k as getDisplayMessage } from './types-QRkKxsoP.cjs';
3
3
  import { ReactElement } from 'react';
4
4
 
5
5
  interface BlinkDepositButtonProps {
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-BjnQ2ux2.js';
2
- export { k as getDisplayMessage } from './types-BjnQ2ux2.js';
1
+ import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-QRkKxsoP.js';
2
+ export { k as getDisplayMessage } from './types-QRkKxsoP.js';
3
3
  import { ReactElement } from 'react';
4
4
 
5
5
  interface BlinkDepositButtonProps {
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Deposit, getDisplayMessage } from './chunk-S3SPMEXQ.js';
2
- export { DepositError, getDisplayMessage } from './chunk-S3SPMEXQ.js';
1
+ import { Deposit, getDisplayMessage } from './chunk-MJSD7JWR.js';
2
+ export { DepositError, getDisplayMessage } from './chunk-MJSD7JWR.js';
3
3
  import { useState, createElement, useRef, useEffect, useCallback } from 'react';
4
4
 
5
5
  function svgToDataUri(svg) {
@@ -70,11 +70,72 @@ interface DepositConfig {
70
70
  */
71
71
  hostedFlowOrigin?: string;
72
72
  /**
73
- * DOM element to mount the iframe overlay into.
73
+ * DOM element the iframe is mounted into.
74
+ *
75
+ * In the default `presentation: 'overlay'` this only changes the overlay's
76
+ * append parent — the overlay is still `position: fixed; inset: 0` and
77
+ * covers the viewport regardless of where it hangs in the tree.
78
+ *
79
+ * In `presentation: 'embedded'` it is the real mount point: the iframe
80
+ * renders inline inside this element, and the option is **required**. The
81
+ * element must be stable across re-renders — moving an iframe in the DOM
82
+ * reloads it, discarding the warmed-up document and the user's session.
83
+ * (On mobile, where an embedded flow presents as an overlay instead, this
84
+ * element is left untouched and the overlay mounts on `document.body` — a
85
+ * `position: fixed` overlay inside a host's animated dialog would position
86
+ * against that dialog rather than the viewport.)
74
87
  *
75
88
  * @default document.body
76
89
  */
77
90
  containerElement?: HTMLElement;
91
+ /**
92
+ * How the hosted flow is presented on the host page.
93
+ *
94
+ * `'overlay'` (the default) is the classic modal: a full-viewport dim +
95
+ * blur backdrop with the payment card centered on top, dismissable by
96
+ * backdrop click or Escape.
97
+ *
98
+ * `'embedded'` mounts the iframe **inline** inside {@link containerElement}
99
+ * — for a payment-method aggregator that lists Blink as one option inside
100
+ * its own widget. There is no backdrop, no body scroll lock, and no
101
+ * backdrop/Escape dismissal (the host owns all of that); the flow renders
102
+ * chrome-less so the host's own panel provides the radius, background and
103
+ * shadow. The iframe's height follows the flow's content, reported through
104
+ * the {@link Deposit.on | `resize`} event.
105
+ *
106
+ * Requires {@link containerElement}.
107
+ *
108
+ * **Desktop only.** On mobile an embedded flow presents as the overlay: a
109
+ * phone-sized method panel cannot hold a payment journey with a keypad,
110
+ * wallet lists and a QR code, and the overlay is what a phone user gets from
111
+ * every other Blink integration. Read the resolved value from
112
+ * {@link Deposit.presentation} — on `'overlay'` no `resize` event ever fires,
113
+ * so a panel sized from those reports should be collapsed or skipped.
114
+ *
115
+ * Nothing else downgrades it. A *failure* never reaches the overlay (an
116
+ * older webview keeps the inline presenter), because dropping a full-screen
117
+ * modal over an aggregator's widget unannounced is worse than the flow not
118
+ * starting; the mobile choice is deliberate and made before anything renders.
119
+ *
120
+ * @default 'overlay'
121
+ */
122
+ presentation?: 'overlay' | 'embedded';
123
+ /**
124
+ * Embedded presentation only: hard cap on the inline iframe's height, in
125
+ * CSS pixels. Ignored on mobile, where the flow presents as an overlay and
126
+ * sizes itself against the real viewport.
127
+ *
128
+ * Two jobs. It bounds the iframe element, so a tall screen scrolls
129
+ * internally instead of pushing the host's page around. And it is the
130
+ * basis viewport-derived sizing inside the flow resolves against — which
131
+ * is why it must be a budget the host decides, never a measurement of what
132
+ * the iframe currently is. (An inline iframe sized from its own content
133
+ * makes `dvh` self-referential; feeding the measured height back in would
134
+ * make every decorative band inflate to its ceiling.)
135
+ *
136
+ * @default Math.round(window.innerHeight * 0.9)
137
+ */
138
+ embedMaxHeightPx?: number;
78
139
  /**
79
140
  * Maximum time in milliseconds to wait for the signer endpoint to respond.
80
141
  *
@@ -133,6 +194,54 @@ interface DepositConfig {
133
194
  * falling back to `'light'`
134
195
  */
135
196
  theme?: 'light' | 'dark' | 'system';
197
+ /**
198
+ * Brand colors for the hosted UI. Blink derives its whole palette from
199
+ * these — surfaces, the recessed/hover steps, the text ramp, borders, the
200
+ * button hover and label, the tinted semantic surfaces — so the flow reads
201
+ * as part of your product rather than a foreign panel inside it. Most
202
+ * valuable in the embedded presentation, where Blink sits in your own
203
+ * dialog, but applied on every surface.
204
+ *
205
+ * **Opaque hex only** (`#rgb` or `#rrggbb`). Anything else — `rgb()`, a CSS
206
+ * color name, 8-digit hex with alpha — is dropped with a console error
207
+ * naming the key: a solid card cannot honour translucency, and a color that
208
+ * cannot be parsed cannot be contrast-checked.
209
+ *
210
+ * Contrast is enforced. Where a derived pair would fall below WCAG AA the
211
+ * *derived* value is substituted (never your input) and the substitution is
212
+ * reported in the hosted flow's console. A `colorPrimary` too mid-toned for
213
+ * either a black or a white label is reported and left alone — only you can
214
+ * fix that one.
215
+ *
216
+ * The scale (sizes, weights, radii) and Blink's own brand marks, semantic
217
+ * hues and authorization states are not themeable.
218
+ *
219
+ * @example
220
+ * appearance: {
221
+ * theme: 'light',
222
+ * variables: {
223
+ * colorPrimary: '#0f62fe',
224
+ * colorBackground: '#ffffff',
225
+ * colorText: '#111111',
226
+ * },
227
+ * }
228
+ */
229
+ variables?: {
230
+ /** Primary button fill, focus ring, selected states. */
231
+ colorPrimary?: string;
232
+ /**
233
+ * The card surface. Its luminance also picks the light or dark base for
234
+ * everything not themeable — shadows, the backdrop scrim, semantic hues —
235
+ * so a dark surface stays coherent even with `theme: 'light'`.
236
+ */
237
+ colorBackground?: string;
238
+ /** Body text. The secondary/muted/tertiary ramp is derived from it. */
239
+ colorText?: string;
240
+ /** Error text and the error surface tint. */
241
+ colorDanger?: string;
242
+ /** Hairline borders. Derived from surface + text when omitted. */
243
+ colorBorder?: string;
244
+ };
136
245
  };
137
246
  /**
138
247
  * Warm up the hosted payment flow in a hidden iframe as soon as the
@@ -192,6 +301,24 @@ interface DepositRequest {
192
301
  reference?: string;
193
302
  /** Arbitrary key-value pairs forwarded to the signer endpoint. */
194
303
  metadata?: Record<string, string>;
304
+ /**
305
+ * The user's current balance on YOUR platform, in USD — display only.
306
+ *
307
+ * When provided, the hosted flow shows it under the deposit header as
308
+ * "{Merchant} balance: $X.XX" so the user tops up with their platform
309
+ * balance in view. It is never part of the signed payload and is never
310
+ * sent to your signer, so passing it requires no signer changes — and it
311
+ * cannot influence the transfer amount or destination.
312
+ *
313
+ * Must be a finite number, `>= 0` and below `1e12`. The SDK floors it to
314
+ * whole cents before sending (`20.789` renders as `$20.78`); anything else
315
+ * is dropped with a `console.error` naming the field, and the deposit
316
+ * proceeds without the subtitle. The hosted flow independently re-validates
317
+ * whatever it receives, so the value is purely cosmetic. When omitted, the
318
+ * hosted flow may fall back to showing the destination wallet's on-chain
319
+ * balance instead.
320
+ */
321
+ balance?: number;
195
322
  }
196
323
  /** Result returned when a deposit completes successfully. */
197
324
  interface DepositResult {
@@ -70,11 +70,72 @@ interface DepositConfig {
70
70
  */
71
71
  hostedFlowOrigin?: string;
72
72
  /**
73
- * DOM element to mount the iframe overlay into.
73
+ * DOM element the iframe is mounted into.
74
+ *
75
+ * In the default `presentation: 'overlay'` this only changes the overlay's
76
+ * append parent — the overlay is still `position: fixed; inset: 0` and
77
+ * covers the viewport regardless of where it hangs in the tree.
78
+ *
79
+ * In `presentation: 'embedded'` it is the real mount point: the iframe
80
+ * renders inline inside this element, and the option is **required**. The
81
+ * element must be stable across re-renders — moving an iframe in the DOM
82
+ * reloads it, discarding the warmed-up document and the user's session.
83
+ * (On mobile, where an embedded flow presents as an overlay instead, this
84
+ * element is left untouched and the overlay mounts on `document.body` — a
85
+ * `position: fixed` overlay inside a host's animated dialog would position
86
+ * against that dialog rather than the viewport.)
74
87
  *
75
88
  * @default document.body
76
89
  */
77
90
  containerElement?: HTMLElement;
91
+ /**
92
+ * How the hosted flow is presented on the host page.
93
+ *
94
+ * `'overlay'` (the default) is the classic modal: a full-viewport dim +
95
+ * blur backdrop with the payment card centered on top, dismissable by
96
+ * backdrop click or Escape.
97
+ *
98
+ * `'embedded'` mounts the iframe **inline** inside {@link containerElement}
99
+ * — for a payment-method aggregator that lists Blink as one option inside
100
+ * its own widget. There is no backdrop, no body scroll lock, and no
101
+ * backdrop/Escape dismissal (the host owns all of that); the flow renders
102
+ * chrome-less so the host's own panel provides the radius, background and
103
+ * shadow. The iframe's height follows the flow's content, reported through
104
+ * the {@link Deposit.on | `resize`} event.
105
+ *
106
+ * Requires {@link containerElement}.
107
+ *
108
+ * **Desktop only.** On mobile an embedded flow presents as the overlay: a
109
+ * phone-sized method panel cannot hold a payment journey with a keypad,
110
+ * wallet lists and a QR code, and the overlay is what a phone user gets from
111
+ * every other Blink integration. Read the resolved value from
112
+ * {@link Deposit.presentation} — on `'overlay'` no `resize` event ever fires,
113
+ * so a panel sized from those reports should be collapsed or skipped.
114
+ *
115
+ * Nothing else downgrades it. A *failure* never reaches the overlay (an
116
+ * older webview keeps the inline presenter), because dropping a full-screen
117
+ * modal over an aggregator's widget unannounced is worse than the flow not
118
+ * starting; the mobile choice is deliberate and made before anything renders.
119
+ *
120
+ * @default 'overlay'
121
+ */
122
+ presentation?: 'overlay' | 'embedded';
123
+ /**
124
+ * Embedded presentation only: hard cap on the inline iframe's height, in
125
+ * CSS pixels. Ignored on mobile, where the flow presents as an overlay and
126
+ * sizes itself against the real viewport.
127
+ *
128
+ * Two jobs. It bounds the iframe element, so a tall screen scrolls
129
+ * internally instead of pushing the host's page around. And it is the
130
+ * basis viewport-derived sizing inside the flow resolves against — which
131
+ * is why it must be a budget the host decides, never a measurement of what
132
+ * the iframe currently is. (An inline iframe sized from its own content
133
+ * makes `dvh` self-referential; feeding the measured height back in would
134
+ * make every decorative band inflate to its ceiling.)
135
+ *
136
+ * @default Math.round(window.innerHeight * 0.9)
137
+ */
138
+ embedMaxHeightPx?: number;
78
139
  /**
79
140
  * Maximum time in milliseconds to wait for the signer endpoint to respond.
80
141
  *
@@ -133,6 +194,54 @@ interface DepositConfig {
133
194
  * falling back to `'light'`
134
195
  */
135
196
  theme?: 'light' | 'dark' | 'system';
197
+ /**
198
+ * Brand colors for the hosted UI. Blink derives its whole palette from
199
+ * these — surfaces, the recessed/hover steps, the text ramp, borders, the
200
+ * button hover and label, the tinted semantic surfaces — so the flow reads
201
+ * as part of your product rather than a foreign panel inside it. Most
202
+ * valuable in the embedded presentation, where Blink sits in your own
203
+ * dialog, but applied on every surface.
204
+ *
205
+ * **Opaque hex only** (`#rgb` or `#rrggbb`). Anything else — `rgb()`, a CSS
206
+ * color name, 8-digit hex with alpha — is dropped with a console error
207
+ * naming the key: a solid card cannot honour translucency, and a color that
208
+ * cannot be parsed cannot be contrast-checked.
209
+ *
210
+ * Contrast is enforced. Where a derived pair would fall below WCAG AA the
211
+ * *derived* value is substituted (never your input) and the substitution is
212
+ * reported in the hosted flow's console. A `colorPrimary` too mid-toned for
213
+ * either a black or a white label is reported and left alone — only you can
214
+ * fix that one.
215
+ *
216
+ * The scale (sizes, weights, radii) and Blink's own brand marks, semantic
217
+ * hues and authorization states are not themeable.
218
+ *
219
+ * @example
220
+ * appearance: {
221
+ * theme: 'light',
222
+ * variables: {
223
+ * colorPrimary: '#0f62fe',
224
+ * colorBackground: '#ffffff',
225
+ * colorText: '#111111',
226
+ * },
227
+ * }
228
+ */
229
+ variables?: {
230
+ /** Primary button fill, focus ring, selected states. */
231
+ colorPrimary?: string;
232
+ /**
233
+ * The card surface. Its luminance also picks the light or dark base for
234
+ * everything not themeable — shadows, the backdrop scrim, semantic hues —
235
+ * so a dark surface stays coherent even with `theme: 'light'`.
236
+ */
237
+ colorBackground?: string;
238
+ /** Body text. The secondary/muted/tertiary ramp is derived from it. */
239
+ colorText?: string;
240
+ /** Error text and the error surface tint. */
241
+ colorDanger?: string;
242
+ /** Hairline borders. Derived from surface + text when omitted. */
243
+ colorBorder?: string;
244
+ };
136
245
  };
137
246
  /**
138
247
  * Warm up the hosted payment flow in a hidden iframe as soon as the
@@ -192,6 +301,24 @@ interface DepositRequest {
192
301
  reference?: string;
193
302
  /** Arbitrary key-value pairs forwarded to the signer endpoint. */
194
303
  metadata?: Record<string, string>;
304
+ /**
305
+ * The user's current balance on YOUR platform, in USD — display only.
306
+ *
307
+ * When provided, the hosted flow shows it under the deposit header as
308
+ * "{Merchant} balance: $X.XX" so the user tops up with their platform
309
+ * balance in view. It is never part of the signed payload and is never
310
+ * sent to your signer, so passing it requires no signer changes — and it
311
+ * cannot influence the transfer amount or destination.
312
+ *
313
+ * Must be a finite number, `>= 0` and below `1e12`. The SDK floors it to
314
+ * whole cents before sending (`20.789` renders as `$20.78`); anything else
315
+ * is dropped with a `console.error` naming the field, and the deposit
316
+ * proceeds without the subtitle. The hosted flow independently re-validates
317
+ * whatever it receives, so the value is purely cosmetic. When omitted, the
318
+ * hosted flow may fall back to showing the destination wallet's on-chain
319
+ * balance instead.
320
+ */
321
+ balance?: number;
195
322
  }
196
323
  /** Result returned when a deposit completes successfully. */
197
324
  interface DepositResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swype-org/deposit",
3
- "version": "0.3.26",
3
+ "version": "0.3.32",
4
4
  "description": "Lightweight merchant deposit SDK — open a hosted payment flow, handle completion, zero dependencies",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",