@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/README.md +171 -0
- package/dist/{chunk-S3SPMEXQ.js → chunk-MJSD7JWR.js} +534 -98
- package/dist/chunk-MJSD7JWR.js.map +1 -0
- package/dist/index.cjs +533 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -5
- package/dist/index.d.ts +142 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +532 -96
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/dist/{types-BjnQ2ux2.d.cts → types-QRkKxsoP.d.cts} +128 -1
- package/dist/{types-BjnQ2ux2.d.ts → types-QRkKxsoP.d.ts} +128 -1
- package/package.json +1 -1
- package/dist/chunk-S3SPMEXQ.js.map +0 -1
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-
|
|
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-
|
|
1
|
+
import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-QRkKxsoP.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-QRkKxsoP.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";
|
|
@@ -8,6 +8,25 @@ type EventMap = {
|
|
|
8
8
|
error: (error: DepositError) => void;
|
|
9
9
|
close: () => void;
|
|
10
10
|
'status-change': (status: DepositStatus) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Embedded presentation only: the hosted flow's rendered height changed and
|
|
13
|
+
* the inline iframe has already been resized to match. Hosts that size their
|
|
14
|
+
* own panel around the iframe follow it from here.
|
|
15
|
+
*
|
|
16
|
+
* `heightPx` fires on every frame of the flow's own height transition —
|
|
17
|
+
* apply it directly, with NO CSS transition on the host side, or two
|
|
18
|
+
* independent animations of the same quantity fight each other and the panel
|
|
19
|
+
* keeps moving after the content has settled.
|
|
20
|
+
*
|
|
21
|
+
* `preferredWidthPx` / `minWidthPx` are constants describing the flow's
|
|
22
|
+
* design envelope, so a host that wants its panel to fit the flow in both
|
|
23
|
+
* axes can size the width once rather than guessing.
|
|
24
|
+
*/
|
|
25
|
+
resize: (info: {
|
|
26
|
+
heightPx: number;
|
|
27
|
+
preferredWidthPx?: number;
|
|
28
|
+
minWidthPx?: number;
|
|
29
|
+
}) => void;
|
|
11
30
|
};
|
|
12
31
|
type EventName = keyof EventMap;
|
|
13
32
|
/**
|
|
@@ -40,6 +59,14 @@ declare class Deposit {
|
|
|
40
59
|
private warmIframe;
|
|
41
60
|
private warmIframeReady;
|
|
42
61
|
private warmIframeReadyCancel;
|
|
62
|
+
/** Resolved embedded-vs-overlay decision; see {@link Deposit.isEmbedded}. */
|
|
63
|
+
private embeddedResolved;
|
|
64
|
+
/**
|
|
65
|
+
* Settles the in-flight `requestDeposit()` as a dismissal. Non-null exactly
|
|
66
|
+
* while a flow is in progress, so {@link Deposit.close} can reject the promise
|
|
67
|
+
* the caller is awaiting instead of tearing the frame down under it.
|
|
68
|
+
*/
|
|
69
|
+
private dismissActiveFlow;
|
|
43
70
|
private listeners;
|
|
44
71
|
/** Current phase of the deposit flow. */
|
|
45
72
|
get status(): DepositStatus;
|
|
@@ -49,6 +76,20 @@ declare class Deposit {
|
|
|
49
76
|
get error(): DepositError | null;
|
|
50
77
|
/** Whether a deposit flow is currently in progress (signer loading or iframe open). */
|
|
51
78
|
get isActive(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* How this instance will actually present: `'embedded'` renders inline in
|
|
81
|
+
* `containerElement`, `'overlay'` covers the page.
|
|
82
|
+
*
|
|
83
|
+
* Not simply an echo of the config — a host that asked for `'embedded'` gets
|
|
84
|
+
* `'overlay'` on mobile, where a phone-sized method panel cannot hold the
|
|
85
|
+
* flow (see {@link Deposit.isEmbedded}). Read it when laying out the panel:
|
|
86
|
+
* on `'overlay'` no `resize` event ever fires, so a panel sized from those
|
|
87
|
+
* reports would sit empty behind the overlay — collapse or skip it.
|
|
88
|
+
*
|
|
89
|
+
* Live until the SDK builds its first (warm-up) frame and fixed from then on,
|
|
90
|
+
* so re-read it on resize rather than caching it at mount.
|
|
91
|
+
*/
|
|
92
|
+
get presentation(): 'overlay' | 'embedded';
|
|
52
93
|
constructor(config: DepositConfig);
|
|
53
94
|
/**
|
|
54
95
|
* Warm up the hosted payment flow in a hidden iframe so `requestDeposit`
|
|
@@ -62,6 +103,50 @@ declare class Deposit {
|
|
|
62
103
|
*/
|
|
63
104
|
preload(): void;
|
|
64
105
|
private schedulePreload;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the flow renders inline in the host's element rather than as an
|
|
108
|
+
* overlay.
|
|
109
|
+
*
|
|
110
|
+
* `presentation: 'embedded'` is a request, not a guarantee: **on mobile the
|
|
111
|
+
* flow presents as the normal overlay** even for an embedded host. An
|
|
112
|
+
* aggregator's method panel is a narrow, short column on a phone, and the
|
|
113
|
+
* flow inside it is a payment journey with a keypad, wallet lists and a QR
|
|
114
|
+
* code — it needs the screen. The overlay is exactly what a phone user gets
|
|
115
|
+
* from every other Blink integration, and the host's own dialog stays behind
|
|
116
|
+
* it. Desktop keeps the inline card, where the panel has room.
|
|
117
|
+
*
|
|
118
|
+
* **The decision lives with the frame.** Read live until a frame is built,
|
|
119
|
+
* then committed for good ({@link Deposit.createPresentedIframe}) — `preload()`
|
|
120
|
+
* warms a frame from these same predicates and the flow that later adopts it
|
|
121
|
+
* must agree, because a frame warmed at `layout=embed` handed to the overlay
|
|
122
|
+
* presenter (or the reverse) is a blank modal. Committing at frame creation
|
|
123
|
+
* rather than at construction matters: a host that constructs `Deposit` before
|
|
124
|
+
* layout settles — a widget mounting inside a transition, a background or
|
|
125
|
+
* prerendered tab — reports a zero-width viewport, and `(max-width: 640px)`
|
|
126
|
+
* matches at zero, so caching then would lock a desktop user into the overlay
|
|
127
|
+
* over a viewport that never existed. The warm-up already waits for `load`
|
|
128
|
+
* plus an idle callback, so by the time it commits the measurement is real.
|
|
129
|
+
*/
|
|
130
|
+
private isEmbedded;
|
|
131
|
+
/**
|
|
132
|
+
* The host's height budget for the inline iframe. Explicit config wins;
|
|
133
|
+
* otherwise most of the host viewport, which keeps a tall flow from
|
|
134
|
+
* outgrowing the page it is embedded in.
|
|
135
|
+
*/
|
|
136
|
+
private resolveEmbedMaxHeightPx;
|
|
137
|
+
/** Build the iframe for the configured presentation. */
|
|
138
|
+
private createPresentedIframe;
|
|
139
|
+
/**
|
|
140
|
+
* Where the overlay mounts. `containerElement` means two different things by
|
|
141
|
+
* presentation: an overlay mount point (`presentation: 'overlay'`) or the
|
|
142
|
+
* aggregator's inline panel slot (`'embedded'`). When an embedded flow
|
|
143
|
+
* presents as an overlay on mobile, that slot must NOT be the mount point —
|
|
144
|
+
* `position: fixed` resolves against the nearest transformed/filtered/
|
|
145
|
+
* contained ancestor, and an aggregator's animated dialog is exactly that, so
|
|
146
|
+
* the "full-screen" overlay would end up positioned inside their panel.
|
|
147
|
+
* Falls through to `document.body`.
|
|
148
|
+
*/
|
|
149
|
+
private overlayMountTarget;
|
|
65
150
|
private buildPreloadUrl;
|
|
66
151
|
/**
|
|
67
152
|
* Detach the warm iframe for use by a starting flow. Returns null (and
|
|
@@ -82,7 +167,24 @@ declare class Deposit {
|
|
|
82
167
|
off<K extends EventName>(event: K, handler: EventMap[K]): this;
|
|
83
168
|
/** No-op — retained for API compatibility with the popup-based SDK. */
|
|
84
169
|
focus(): void;
|
|
85
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Close the deposit iframe without waiting for completion — the host's own
|
|
172
|
+
* back button or dialog chrome.
|
|
173
|
+
*
|
|
174
|
+
* This **settles a flow in progress** by rejecting its `requestDeposit()`
|
|
175
|
+
* promise with `DEPOSIT_DISMISSED`, exactly as the flow's own close control
|
|
176
|
+
* does. It has to: `cleanup()` destroys the frame through `destroy()`, which
|
|
177
|
+
* drops the handle's close callback on purpose, so without this the caller's
|
|
178
|
+
* `await` never returns. An aggregator whose back button awaited that promise
|
|
179
|
+
* to restore its method list was left showing an empty panel — the flow gone,
|
|
180
|
+
* its own list still not rendered, and no error to explain why.
|
|
181
|
+
*
|
|
182
|
+
* The rejection code is the same `DEPOSIT_DISMISSED` the in-flow control
|
|
183
|
+
* produces, so a host writes one dismissal branch rather than one per
|
|
184
|
+
* affordance. What it deliberately does not do is report an error: no `error`
|
|
185
|
+
* event, and `status` lands on 'idle' as it always has, because the host
|
|
186
|
+
* initiated this. With no flow in progress it is a plain teardown, unchanged.
|
|
187
|
+
*/
|
|
86
188
|
close(): void;
|
|
87
189
|
/** Tear down the instance and release all resources. */
|
|
88
190
|
destroy(): void;
|
|
@@ -106,7 +208,42 @@ declare class Deposit {
|
|
|
106
208
|
* every hosted/preload URL.
|
|
107
209
|
*/
|
|
108
210
|
private applyAppearanceParam;
|
|
109
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* Appends the merchant's brand colors as `brand=p-0f62fe.bg-ffffff…`.
|
|
213
|
+
*
|
|
214
|
+
* On the URL rather than a message because the hosted flow's loading shell
|
|
215
|
+
* paints from its entry chunk, hundreds of ms before React mounts: a palette
|
|
216
|
+
* that arrived by `postMessage` would show Blink's own card color first and
|
|
217
|
+
* then become the merchant's. Unreserved characters only, so the param costs
|
|
218
|
+
* ~50 bytes of the URL budget rather than triple that in percent-encoding.
|
|
219
|
+
*
|
|
220
|
+
* Validated here purely so the merchant sees the complaint in their OWN
|
|
221
|
+
* console — the hosted flow re-validates everything it decodes, since the URL
|
|
222
|
+
* is host-controlled input that ends up in a stylesheet. Silence would be the
|
|
223
|
+
* worst outcome: a dropped color that nobody is told about looks like the SDK
|
|
224
|
+
* ignoring the config.
|
|
225
|
+
*/
|
|
226
|
+
private applyBrandParam;
|
|
227
|
+
/**
|
|
228
|
+
* Normalizes the display-only {@link DepositRequest.balance} for the wire,
|
|
229
|
+
* or returns `undefined` to omit it everywhere — the `blink:signed-payload`
|
|
230
|
+
* sibling field and the legacy fallback URL param alike. Additive wire
|
|
231
|
+
* discipline: an unset or rejected balance leaves both channels
|
|
232
|
+
* byte-for-byte what they always were, and old webviews ignore the field
|
|
233
|
+
* by construction.
|
|
234
|
+
*
|
|
235
|
+
* Validated here purely so the merchant sees the complaint in their OWN
|
|
236
|
+
* console (same rationale as {@link applyBrandParam}); the hosted flow
|
|
237
|
+
* re-validates whatever arrives, since both channels are host-controlled
|
|
238
|
+
* input. A rejected balance never blocks the deposit — the flow proceeds
|
|
239
|
+
* without the subtitle.
|
|
240
|
+
*/
|
|
241
|
+
private normalizeRequestBalance;
|
|
242
|
+
/**
|
|
243
|
+
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
244
|
+
* container. Embedded is a separate presentation and never fluid — the
|
|
245
|
+
* constructor rejects the combination outright.
|
|
246
|
+
*/
|
|
110
247
|
private isFluidLayout;
|
|
111
248
|
/**
|
|
112
249
|
* Marks the hosted-flow URL as fluid-layout: the iframe spans the full
|
|
@@ -297,6 +434,6 @@ interface RpcHostOptions {
|
|
|
297
434
|
*/
|
|
298
435
|
declare function attachRpcHost(options: RpcHostOptions): RpcHostHandle;
|
|
299
436
|
|
|
300
|
-
declare const VERSION = "0.3.
|
|
437
|
+
declare const VERSION = "0.3.32";
|
|
301
438
|
|
|
302
439
|
export { ALLOWED_RPC_METHODS, type AdvertisedWallet, BRIDGE_PROTOCOL_VERSION, type EIP1193Provider as BridgeEIP1193Provider, type BridgeHelloMessage, type BridgeMessage, Checkout, DEFAULT_WEBVIEW_BASE_URL, Deposit, DepositConfig, DepositError, DepositRequest, DepositResult, DepositStatus, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type RegisteredProvider, type RpcEventMessage, type RpcHostHandle, type RpcHostOptions, type RpcRequestMessage, type RpcResponseMessage, SANDBOX_WEBVIEW_BASE_URL, VERSION, type WalletDiscovererHandle, type WalletsAdvertisedMessage, attachRpcHost, createWalletDiscoverer, parseBridgeMessage };
|
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-
|
|
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-
|
|
1
|
+
import { D as DepositStatus, a as DepositResult, b as DepositError, c as DepositConfig, d as DepositRequest } from './types-QRkKxsoP.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-QRkKxsoP.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";
|
|
@@ -8,6 +8,25 @@ type EventMap = {
|
|
|
8
8
|
error: (error: DepositError) => void;
|
|
9
9
|
close: () => void;
|
|
10
10
|
'status-change': (status: DepositStatus) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Embedded presentation only: the hosted flow's rendered height changed and
|
|
13
|
+
* the inline iframe has already been resized to match. Hosts that size their
|
|
14
|
+
* own panel around the iframe follow it from here.
|
|
15
|
+
*
|
|
16
|
+
* `heightPx` fires on every frame of the flow's own height transition —
|
|
17
|
+
* apply it directly, with NO CSS transition on the host side, or two
|
|
18
|
+
* independent animations of the same quantity fight each other and the panel
|
|
19
|
+
* keeps moving after the content has settled.
|
|
20
|
+
*
|
|
21
|
+
* `preferredWidthPx` / `minWidthPx` are constants describing the flow's
|
|
22
|
+
* design envelope, so a host that wants its panel to fit the flow in both
|
|
23
|
+
* axes can size the width once rather than guessing.
|
|
24
|
+
*/
|
|
25
|
+
resize: (info: {
|
|
26
|
+
heightPx: number;
|
|
27
|
+
preferredWidthPx?: number;
|
|
28
|
+
minWidthPx?: number;
|
|
29
|
+
}) => void;
|
|
11
30
|
};
|
|
12
31
|
type EventName = keyof EventMap;
|
|
13
32
|
/**
|
|
@@ -40,6 +59,14 @@ declare class Deposit {
|
|
|
40
59
|
private warmIframe;
|
|
41
60
|
private warmIframeReady;
|
|
42
61
|
private warmIframeReadyCancel;
|
|
62
|
+
/** Resolved embedded-vs-overlay decision; see {@link Deposit.isEmbedded}. */
|
|
63
|
+
private embeddedResolved;
|
|
64
|
+
/**
|
|
65
|
+
* Settles the in-flight `requestDeposit()` as a dismissal. Non-null exactly
|
|
66
|
+
* while a flow is in progress, so {@link Deposit.close} can reject the promise
|
|
67
|
+
* the caller is awaiting instead of tearing the frame down under it.
|
|
68
|
+
*/
|
|
69
|
+
private dismissActiveFlow;
|
|
43
70
|
private listeners;
|
|
44
71
|
/** Current phase of the deposit flow. */
|
|
45
72
|
get status(): DepositStatus;
|
|
@@ -49,6 +76,20 @@ declare class Deposit {
|
|
|
49
76
|
get error(): DepositError | null;
|
|
50
77
|
/** Whether a deposit flow is currently in progress (signer loading or iframe open). */
|
|
51
78
|
get isActive(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* How this instance will actually present: `'embedded'` renders inline in
|
|
81
|
+
* `containerElement`, `'overlay'` covers the page.
|
|
82
|
+
*
|
|
83
|
+
* Not simply an echo of the config — a host that asked for `'embedded'` gets
|
|
84
|
+
* `'overlay'` on mobile, where a phone-sized method panel cannot hold the
|
|
85
|
+
* flow (see {@link Deposit.isEmbedded}). Read it when laying out the panel:
|
|
86
|
+
* on `'overlay'` no `resize` event ever fires, so a panel sized from those
|
|
87
|
+
* reports would sit empty behind the overlay — collapse or skip it.
|
|
88
|
+
*
|
|
89
|
+
* Live until the SDK builds its first (warm-up) frame and fixed from then on,
|
|
90
|
+
* so re-read it on resize rather than caching it at mount.
|
|
91
|
+
*/
|
|
92
|
+
get presentation(): 'overlay' | 'embedded';
|
|
52
93
|
constructor(config: DepositConfig);
|
|
53
94
|
/**
|
|
54
95
|
* Warm up the hosted payment flow in a hidden iframe so `requestDeposit`
|
|
@@ -62,6 +103,50 @@ declare class Deposit {
|
|
|
62
103
|
*/
|
|
63
104
|
preload(): void;
|
|
64
105
|
private schedulePreload;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the flow renders inline in the host's element rather than as an
|
|
108
|
+
* overlay.
|
|
109
|
+
*
|
|
110
|
+
* `presentation: 'embedded'` is a request, not a guarantee: **on mobile the
|
|
111
|
+
* flow presents as the normal overlay** even for an embedded host. An
|
|
112
|
+
* aggregator's method panel is a narrow, short column on a phone, and the
|
|
113
|
+
* flow inside it is a payment journey with a keypad, wallet lists and a QR
|
|
114
|
+
* code — it needs the screen. The overlay is exactly what a phone user gets
|
|
115
|
+
* from every other Blink integration, and the host's own dialog stays behind
|
|
116
|
+
* it. Desktop keeps the inline card, where the panel has room.
|
|
117
|
+
*
|
|
118
|
+
* **The decision lives with the frame.** Read live until a frame is built,
|
|
119
|
+
* then committed for good ({@link Deposit.createPresentedIframe}) — `preload()`
|
|
120
|
+
* warms a frame from these same predicates and the flow that later adopts it
|
|
121
|
+
* must agree, because a frame warmed at `layout=embed` handed to the overlay
|
|
122
|
+
* presenter (or the reverse) is a blank modal. Committing at frame creation
|
|
123
|
+
* rather than at construction matters: a host that constructs `Deposit` before
|
|
124
|
+
* layout settles — a widget mounting inside a transition, a background or
|
|
125
|
+
* prerendered tab — reports a zero-width viewport, and `(max-width: 640px)`
|
|
126
|
+
* matches at zero, so caching then would lock a desktop user into the overlay
|
|
127
|
+
* over a viewport that never existed. The warm-up already waits for `load`
|
|
128
|
+
* plus an idle callback, so by the time it commits the measurement is real.
|
|
129
|
+
*/
|
|
130
|
+
private isEmbedded;
|
|
131
|
+
/**
|
|
132
|
+
* The host's height budget for the inline iframe. Explicit config wins;
|
|
133
|
+
* otherwise most of the host viewport, which keeps a tall flow from
|
|
134
|
+
* outgrowing the page it is embedded in.
|
|
135
|
+
*/
|
|
136
|
+
private resolveEmbedMaxHeightPx;
|
|
137
|
+
/** Build the iframe for the configured presentation. */
|
|
138
|
+
private createPresentedIframe;
|
|
139
|
+
/**
|
|
140
|
+
* Where the overlay mounts. `containerElement` means two different things by
|
|
141
|
+
* presentation: an overlay mount point (`presentation: 'overlay'`) or the
|
|
142
|
+
* aggregator's inline panel slot (`'embedded'`). When an embedded flow
|
|
143
|
+
* presents as an overlay on mobile, that slot must NOT be the mount point —
|
|
144
|
+
* `position: fixed` resolves against the nearest transformed/filtered/
|
|
145
|
+
* contained ancestor, and an aggregator's animated dialog is exactly that, so
|
|
146
|
+
* the "full-screen" overlay would end up positioned inside their panel.
|
|
147
|
+
* Falls through to `document.body`.
|
|
148
|
+
*/
|
|
149
|
+
private overlayMountTarget;
|
|
65
150
|
private buildPreloadUrl;
|
|
66
151
|
/**
|
|
67
152
|
* Detach the warm iframe for use by a starting flow. Returns null (and
|
|
@@ -82,7 +167,24 @@ declare class Deposit {
|
|
|
82
167
|
off<K extends EventName>(event: K, handler: EventMap[K]): this;
|
|
83
168
|
/** No-op — retained for API compatibility with the popup-based SDK. */
|
|
84
169
|
focus(): void;
|
|
85
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Close the deposit iframe without waiting for completion — the host's own
|
|
172
|
+
* back button or dialog chrome.
|
|
173
|
+
*
|
|
174
|
+
* This **settles a flow in progress** by rejecting its `requestDeposit()`
|
|
175
|
+
* promise with `DEPOSIT_DISMISSED`, exactly as the flow's own close control
|
|
176
|
+
* does. It has to: `cleanup()` destroys the frame through `destroy()`, which
|
|
177
|
+
* drops the handle's close callback on purpose, so without this the caller's
|
|
178
|
+
* `await` never returns. An aggregator whose back button awaited that promise
|
|
179
|
+
* to restore its method list was left showing an empty panel — the flow gone,
|
|
180
|
+
* its own list still not rendered, and no error to explain why.
|
|
181
|
+
*
|
|
182
|
+
* The rejection code is the same `DEPOSIT_DISMISSED` the in-flow control
|
|
183
|
+
* produces, so a host writes one dismissal branch rather than one per
|
|
184
|
+
* affordance. What it deliberately does not do is report an error: no `error`
|
|
185
|
+
* event, and `status` lands on 'idle' as it always has, because the host
|
|
186
|
+
* initiated this. With no flow in progress it is a plain teardown, unchanged.
|
|
187
|
+
*/
|
|
86
188
|
close(): void;
|
|
87
189
|
/** Tear down the instance and release all resources. */
|
|
88
190
|
destroy(): void;
|
|
@@ -106,7 +208,42 @@ declare class Deposit {
|
|
|
106
208
|
* every hosted/preload URL.
|
|
107
209
|
*/
|
|
108
210
|
private applyAppearanceParam;
|
|
109
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* Appends the merchant's brand colors as `brand=p-0f62fe.bg-ffffff…`.
|
|
213
|
+
*
|
|
214
|
+
* On the URL rather than a message because the hosted flow's loading shell
|
|
215
|
+
* paints from its entry chunk, hundreds of ms before React mounts: a palette
|
|
216
|
+
* that arrived by `postMessage` would show Blink's own card color first and
|
|
217
|
+
* then become the merchant's. Unreserved characters only, so the param costs
|
|
218
|
+
* ~50 bytes of the URL budget rather than triple that in percent-encoding.
|
|
219
|
+
*
|
|
220
|
+
* Validated here purely so the merchant sees the complaint in their OWN
|
|
221
|
+
* console — the hosted flow re-validates everything it decodes, since the URL
|
|
222
|
+
* is host-controlled input that ends up in a stylesheet. Silence would be the
|
|
223
|
+
* worst outcome: a dropped color that nobody is told about looks like the SDK
|
|
224
|
+
* ignoring the config.
|
|
225
|
+
*/
|
|
226
|
+
private applyBrandParam;
|
|
227
|
+
/**
|
|
228
|
+
* Normalizes the display-only {@link DepositRequest.balance} for the wire,
|
|
229
|
+
* or returns `undefined` to omit it everywhere — the `blink:signed-payload`
|
|
230
|
+
* sibling field and the legacy fallback URL param alike. Additive wire
|
|
231
|
+
* discipline: an unset or rejected balance leaves both channels
|
|
232
|
+
* byte-for-byte what they always were, and old webviews ignore the field
|
|
233
|
+
* by construction.
|
|
234
|
+
*
|
|
235
|
+
* Validated here purely so the merchant sees the complaint in their OWN
|
|
236
|
+
* console (same rationale as {@link applyBrandParam}); the hosted flow
|
|
237
|
+
* re-validates whatever arrives, since both channels are host-controlled
|
|
238
|
+
* input. A rejected balance never blocks the deposit — the flow proceeds
|
|
239
|
+
* without the subtitle.
|
|
240
|
+
*/
|
|
241
|
+
private normalizeRequestBalance;
|
|
242
|
+
/**
|
|
243
|
+
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
244
|
+
* container. Embedded is a separate presentation and never fluid — the
|
|
245
|
+
* constructor rejects the combination outright.
|
|
246
|
+
*/
|
|
110
247
|
private isFluidLayout;
|
|
111
248
|
/**
|
|
112
249
|
* Marks the hosted-flow URL as fluid-layout: the iframe spans the full
|
|
@@ -297,6 +434,6 @@ interface RpcHostOptions {
|
|
|
297
434
|
*/
|
|
298
435
|
declare function attachRpcHost(options: RpcHostOptions): RpcHostHandle;
|
|
299
436
|
|
|
300
|
-
declare const VERSION = "0.3.
|
|
437
|
+
declare const VERSION = "0.3.32";
|
|
301
438
|
|
|
302
439
|
export { ALLOWED_RPC_METHODS, type AdvertisedWallet, BRIDGE_PROTOCOL_VERSION, type EIP1193Provider as BridgeEIP1193Provider, type BridgeHelloMessage, type BridgeMessage, Checkout, DEFAULT_WEBVIEW_BASE_URL, Deposit, DepositConfig, DepositError, DepositRequest, DepositResult, DepositStatus, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type RegisteredProvider, type RpcEventMessage, type RpcHostHandle, type RpcHostOptions, type RpcRequestMessage, type RpcResponseMessage, SANDBOX_WEBVIEW_BASE_URL, VERSION, type WalletDiscovererHandle, type WalletsAdvertisedMessage, attachRpcHost, createWalletDiscoverer, parseBridgeMessage };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-MJSD7JWR.js';
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
var VERSION = "0.3.
|
|
4
|
+
var VERSION = "0.3.32";
|
|
5
5
|
|
|
6
6
|
export { VERSION };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA2CO,IAAM,OAAA,GAAU","file":"index.js","sourcesContent":["export { Deposit, Checkout, DEFAULT_WEBVIEW_BASE_URL, SANDBOX_WEBVIEW_BASE_URL } from './checkout.ts';\nexport { DepositError, CheckoutError, getDisplayMessage } from './errors.ts';\nexport type { DepositErrorCode, CheckoutErrorCode } from './errors.ts';\nexport type {\n DepositConfig,\n CheckoutConfig,\n DepositStatus,\n CheckoutStatus,\n DepositRequest,\n DepositResult,\n SignerFunction,\n SignerRequest,\n SignerResponse,\n TransferSummary,\n} from './types.ts';\n\n// ── Wallet bridge (advanced) ──────────────────────────────────────────\n// Internal building blocks for the top-frame → iframe wallet bridge.\n// Default merchant integrations don't need these — `createIframe()` wires\n// them automatically. Re-exported so monorepo tests and any merchant\n// custom-iframe wrapper can poke at the protocol shapes.\nexport { createWalletDiscoverer } from './walletBridge/discover.ts';\nexport type { WalletDiscovererHandle, RegisteredProvider } from './walletBridge/discover.ts';\nexport { attachRpcHost } from './walletBridge/rpcHost.ts';\nexport type { RpcHostHandle, RpcHostOptions } from './walletBridge/rpcHost.ts';\nexport {\n ALLOWED_RPC_METHODS,\n BRIDGE_PROTOCOL_VERSION,\n parseBridgeMessage,\n} from './walletBridge/protocol.ts';\nexport type {\n AdvertisedWallet,\n BridgeMessage,\n BridgeHelloMessage,\n WalletsAdvertisedMessage,\n RpcRequestMessage,\n RpcResponseMessage,\n RpcEventMessage,\n EIP1193Provider as BridgeEIP1193Provider,\n EIP6963ProviderInfo,\n EIP6963ProviderDetail,\n} from './walletBridge/protocol.ts';\n\nexport const VERSION = '0.3.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA2CO,IAAM,OAAA,GAAU","file":"index.js","sourcesContent":["export { Deposit, Checkout, DEFAULT_WEBVIEW_BASE_URL, SANDBOX_WEBVIEW_BASE_URL } from './checkout.ts';\nexport { DepositError, CheckoutError, getDisplayMessage } from './errors.ts';\nexport type { DepositErrorCode, CheckoutErrorCode } from './errors.ts';\nexport type {\n DepositConfig,\n CheckoutConfig,\n DepositStatus,\n CheckoutStatus,\n DepositRequest,\n DepositResult,\n SignerFunction,\n SignerRequest,\n SignerResponse,\n TransferSummary,\n} from './types.ts';\n\n// ── Wallet bridge (advanced) ──────────────────────────────────────────\n// Internal building blocks for the top-frame → iframe wallet bridge.\n// Default merchant integrations don't need these — `createIframe()` wires\n// them automatically. Re-exported so monorepo tests and any merchant\n// custom-iframe wrapper can poke at the protocol shapes.\nexport { createWalletDiscoverer } from './walletBridge/discover.ts';\nexport type { WalletDiscovererHandle, RegisteredProvider } from './walletBridge/discover.ts';\nexport { attachRpcHost } from './walletBridge/rpcHost.ts';\nexport type { RpcHostHandle, RpcHostOptions } from './walletBridge/rpcHost.ts';\nexport {\n ALLOWED_RPC_METHODS,\n BRIDGE_PROTOCOL_VERSION,\n parseBridgeMessage,\n} from './walletBridge/protocol.ts';\nexport type {\n AdvertisedWallet,\n BridgeMessage,\n BridgeHelloMessage,\n WalletsAdvertisedMessage,\n RpcRequestMessage,\n RpcResponseMessage,\n RpcEventMessage,\n EIP1193Provider as BridgeEIP1193Provider,\n EIP6963ProviderInfo,\n EIP6963ProviderDetail,\n} from './walletBridge/protocol.ts';\n\nexport const VERSION = '0.3.32';\n"]}
|