@swype-org/deposit 0.3.32 → 0.3.34
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/{chunk-MJSD7JWR.js → chunk-24WCJE4H.js} +42 -5
- package/dist/chunk-24WCJE4H.js.map +1 -0
- package/dist/index.cjs +40 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +1 -1
- package/dist/react.cjs +40 -3
- 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-QRkKxsoP.d.cts → types-Bwy_1TQT.d.cts} +15 -0
- package/dist/{types-QRkKxsoP.d.ts → types-Bwy_1TQT.d.ts} +15 -0
- package/package.json +1 -1
- package/dist/chunk-MJSD7JWR.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-Bwy_1TQT.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-Bwy_1TQT.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";
|
|
@@ -239,6 +239,16 @@ declare class Deposit {
|
|
|
239
239
|
* without the subtitle.
|
|
240
240
|
*/
|
|
241
241
|
private normalizeRequestBalance;
|
|
242
|
+
/**
|
|
243
|
+
* Normalizes {@link DepositRequest.minimumDeposit} for the wire, or returns
|
|
244
|
+
* `undefined` to omit it everywhere. Same additive discipline and same
|
|
245
|
+
* console-complaint rationale as {@link normalizeRequestBalance}.
|
|
246
|
+
*
|
|
247
|
+
* A rejected minimum never blocks the deposit — the flow proceeds on
|
|
248
|
+
* Blink's own per-route floor, which is the safe direction to fail: the
|
|
249
|
+
* merchant loses their higher floor, nobody is locked out of depositing.
|
|
250
|
+
*/
|
|
251
|
+
private normalizeRequestMinimumDeposit;
|
|
242
252
|
/**
|
|
243
253
|
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
244
254
|
* container. Embedded is a separate presentation and never fluid — the
|
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-Bwy_1TQT.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-Bwy_1TQT.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";
|
|
@@ -239,6 +239,16 @@ declare class Deposit {
|
|
|
239
239
|
* without the subtitle.
|
|
240
240
|
*/
|
|
241
241
|
private normalizeRequestBalance;
|
|
242
|
+
/**
|
|
243
|
+
* Normalizes {@link DepositRequest.minimumDeposit} for the wire, or returns
|
|
244
|
+
* `undefined` to omit it everywhere. Same additive discipline and same
|
|
245
|
+
* console-complaint rationale as {@link normalizeRequestBalance}.
|
|
246
|
+
*
|
|
247
|
+
* A rejected minimum never blocks the deposit — the flow proceeds on
|
|
248
|
+
* Blink's own per-route floor, which is the safe direction to fail: the
|
|
249
|
+
* merchant loses their higher floor, nobody is locked out of depositing.
|
|
250
|
+
*/
|
|
251
|
+
private normalizeRequestMinimumDeposit;
|
|
242
252
|
/**
|
|
243
253
|
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
244
254
|
* container. Embedded is a separate presentation and never fluid — the
|
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-
|
|
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-24WCJE4H.js';
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
var VERSION = "0.3.32";
|
package/dist/react.cjs
CHANGED
|
@@ -150,13 +150,14 @@ function parseWidthHint(key, value) {
|
|
|
150
150
|
function buildRevealMessage() {
|
|
151
151
|
return { type: "blink:reveal" };
|
|
152
152
|
}
|
|
153
|
-
function buildSignedPayloadMessage(merchantId, payload, signature, balance) {
|
|
153
|
+
function buildSignedPayloadMessage(merchantId, payload, signature, balance, minimumDeposit) {
|
|
154
154
|
return {
|
|
155
155
|
type: "blink:signed-payload",
|
|
156
156
|
merchantId,
|
|
157
157
|
payload,
|
|
158
158
|
signature,
|
|
159
|
-
...balance === void 0 ? {} : { balance }
|
|
159
|
+
...balance === void 0 ? {} : { balance },
|
|
160
|
+
...minimumDeposit === void 0 ? {} : { minimumDeposit }
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
|
|
@@ -187,6 +188,16 @@ function normalizeDisplayBalance(value) {
|
|
|
187
188
|
return (cents / 100).toFixed(2);
|
|
188
189
|
}
|
|
189
190
|
|
|
191
|
+
// src/minimumDepositParam.ts
|
|
192
|
+
var MAX_MINIMUM_DEPOSIT_USD = 1e6;
|
|
193
|
+
function normalizeMinimumDeposit(value) {
|
|
194
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
195
|
+
if (value <= 0 || value >= MAX_MINIMUM_DEPOSIT_USD) return null;
|
|
196
|
+
const cents = Math.ceil(Number((value * 100).toPrecision(15)));
|
|
197
|
+
if (cents <= 0 || cents >= MAX_MINIMUM_DEPOSIT_USD * 100) return null;
|
|
198
|
+
return (cents / 100).toFixed(2);
|
|
199
|
+
}
|
|
200
|
+
|
|
190
201
|
// src/walletBridge/discover.ts
|
|
191
202
|
function createWalletDiscoverer() {
|
|
192
203
|
if (typeof window === "undefined") {
|
|
@@ -1613,6 +1624,27 @@ var Deposit = class {
|
|
|
1613
1624
|
}
|
|
1614
1625
|
return normalized;
|
|
1615
1626
|
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Normalizes {@link DepositRequest.minimumDeposit} for the wire, or returns
|
|
1629
|
+
* `undefined` to omit it everywhere. Same additive discipline and same
|
|
1630
|
+
* console-complaint rationale as {@link normalizeRequestBalance}.
|
|
1631
|
+
*
|
|
1632
|
+
* A rejected minimum never blocks the deposit — the flow proceeds on
|
|
1633
|
+
* Blink's own per-route floor, which is the safe direction to fail: the
|
|
1634
|
+
* merchant loses their higher floor, nobody is locked out of depositing.
|
|
1635
|
+
*/
|
|
1636
|
+
normalizeRequestMinimumDeposit(minimumDeposit) {
|
|
1637
|
+
if (minimumDeposit === void 0 || minimumDeposit === null) return void 0;
|
|
1638
|
+
const normalized = normalizeMinimumDeposit(minimumDeposit);
|
|
1639
|
+
if (normalized === null) {
|
|
1640
|
+
const received = typeof minimumDeposit === "number" ? String(minimumDeposit) : JSON.stringify(minimumDeposit) ?? String(minimumDeposit);
|
|
1641
|
+
console.error(
|
|
1642
|
+
`[blink] minimumDeposit must be a finite number > 0 and < 1e6 (USD); received ${received}. Ignoring it.`
|
|
1643
|
+
);
|
|
1644
|
+
return void 0;
|
|
1645
|
+
}
|
|
1646
|
+
return normalized;
|
|
1647
|
+
}
|
|
1616
1648
|
/**
|
|
1617
1649
|
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
1618
1650
|
* container. Embedded is a separate presentation and never fluid — the
|
|
@@ -1672,6 +1704,7 @@ var Deposit = class {
|
|
|
1672
1704
|
});
|
|
1673
1705
|
const signerRequest = buildSignerRequest(request, webviewBaseUrl);
|
|
1674
1706
|
const displayBalance = this.normalizeRequestBalance(request.balance);
|
|
1707
|
+
const minimumDeposit = this.normalizeRequestMinimumDeposit(request.minimumDeposit);
|
|
1675
1708
|
let preloadIframe;
|
|
1676
1709
|
let iframeReadyPromise;
|
|
1677
1710
|
const warm = this.takeWarmIframe();
|
|
@@ -1725,7 +1758,8 @@ var Deposit = class {
|
|
|
1725
1758
|
signerResponse.merchantId,
|
|
1726
1759
|
signerResponse.payload,
|
|
1727
1760
|
signerResponse.signature,
|
|
1728
|
-
displayBalance
|
|
1761
|
+
displayBalance,
|
|
1762
|
+
minimumDeposit
|
|
1729
1763
|
),
|
|
1730
1764
|
this.hostedOrigin
|
|
1731
1765
|
);
|
|
@@ -1742,6 +1776,9 @@ var Deposit = class {
|
|
|
1742
1776
|
if (displayBalance !== void 0) {
|
|
1743
1777
|
hostedUrl.searchParams.set("balance", displayBalance);
|
|
1744
1778
|
}
|
|
1779
|
+
if (minimumDeposit !== void 0) {
|
|
1780
|
+
hostedUrl.searchParams.set("minDeposit", minimumDeposit);
|
|
1781
|
+
}
|
|
1745
1782
|
this.applyFullWidgetParam(hostedUrl);
|
|
1746
1783
|
if (this.isEmbedded()) {
|
|
1747
1784
|
this.applyLayoutParam(hostedUrl);
|