@swype-org/deposit 0.3.23 → 0.3.31

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-iQf3f-_m.cjs';
2
- export { k as getDisplayMessage } from './types-iQf3f-_m.cjs';
1
+ import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-NMNL3Jut.cjs';
2
+ export { k as getDisplayMessage } from './types-NMNL3Jut.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-iQf3f-_m.js';
2
- export { k as getDisplayMessage } from './types-iQf3f-_m.js';
1
+ import { c as DepositConfig, D as DepositStatus, a as DepositResult, b as DepositError, d as DepositRequest } from './types-NMNL3Jut.js';
2
+ export { k as getDisplayMessage } from './types-NMNL3Jut.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-JD7GTL6D.js';
2
- export { DepositError, getDisplayMessage } from './chunk-JD7GTL6D.js';
1
+ import { Deposit, getDisplayMessage } from './chunk-HBW7IVRJ.js';
2
+ export { DepositError, getDisplayMessage } from './chunk-HBW7IVRJ.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
  *
@@ -109,6 +170,79 @@ interface DepositConfig {
109
170
  * @default 'fluid'
110
171
  */
111
172
  layout?: 'fluid' | 'fixed';
173
+ /**
174
+ * Visual appearance of the hosted payment UI. Nested `{ theme }` object,
175
+ * mirroring Privy's `appearance` config. `theme: 'light'` renders the light
176
+ * palette; `'dark'` renders the dark palette; `'system'` follows the user's
177
+ * OS `prefers-color-scheme`. Passed to the hosted flow as an `appearance`
178
+ * query param and carried through every Blink surface the flow opens
179
+ * (top-level setup tab, wallet authorization pages).
180
+ *
181
+ * When no theme is passed, the default follows the merchant page's own
182
+ * declared `color-scheme`: a page declaring `dark` defaults the flow to
183
+ * dark, a page declaring `light dark` defaults to `system`, and everything
184
+ * else defaults to light. Pass an explicit theme to override the detection
185
+ * (`theme: 'light'` pins light even on a dark page).
186
+ *
187
+ * @example
188
+ * new Deposit({ signer, appearance: { theme: 'dark' } })
189
+ */
190
+ appearance?: {
191
+ /**
192
+ * Color scheme of the hosted UI.
193
+ * @default detected from the merchant page's declared `color-scheme`,
194
+ * falling back to `'light'`
195
+ */
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
+ };
245
+ };
112
246
  /**
113
247
  * Warm up the hosted payment flow in a hidden iframe as soon as the
114
248
  * `Deposit` instance is constructed (deferred until the host page has
@@ -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
  *
@@ -109,6 +170,79 @@ interface DepositConfig {
109
170
  * @default 'fluid'
110
171
  */
111
172
  layout?: 'fluid' | 'fixed';
173
+ /**
174
+ * Visual appearance of the hosted payment UI. Nested `{ theme }` object,
175
+ * mirroring Privy's `appearance` config. `theme: 'light'` renders the light
176
+ * palette; `'dark'` renders the dark palette; `'system'` follows the user's
177
+ * OS `prefers-color-scheme`. Passed to the hosted flow as an `appearance`
178
+ * query param and carried through every Blink surface the flow opens
179
+ * (top-level setup tab, wallet authorization pages).
180
+ *
181
+ * When no theme is passed, the default follows the merchant page's own
182
+ * declared `color-scheme`: a page declaring `dark` defaults the flow to
183
+ * dark, a page declaring `light dark` defaults to `system`, and everything
184
+ * else defaults to light. Pass an explicit theme to override the detection
185
+ * (`theme: 'light'` pins light even on a dark page).
186
+ *
187
+ * @example
188
+ * new Deposit({ signer, appearance: { theme: 'dark' } })
189
+ */
190
+ appearance?: {
191
+ /**
192
+ * Color scheme of the hosted UI.
193
+ * @default detected from the merchant page's declared `color-scheme`,
194
+ * falling back to `'light'`
195
+ */
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
+ };
245
+ };
112
246
  /**
113
247
  * Warm up the hosted payment flow in a hidden iframe as soon as the
114
248
  * `Deposit` instance is constructed (deferred until the host page has
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swype-org/deposit",
3
- "version": "0.3.23",
3
+ "version": "0.3.31",
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",