@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.cjs
CHANGED
|
@@ -147,13 +147,14 @@ function parseWidthHint(key, value) {
|
|
|
147
147
|
function buildRevealMessage() {
|
|
148
148
|
return { type: "blink:reveal" };
|
|
149
149
|
}
|
|
150
|
-
function buildSignedPayloadMessage(merchantId, payload, signature, balance) {
|
|
150
|
+
function buildSignedPayloadMessage(merchantId, payload, signature, balance, minimumDeposit) {
|
|
151
151
|
return {
|
|
152
152
|
type: "blink:signed-payload",
|
|
153
153
|
merchantId,
|
|
154
154
|
payload,
|
|
155
155
|
signature,
|
|
156
|
-
...balance === void 0 ? {} : { balance }
|
|
156
|
+
...balance === void 0 ? {} : { balance },
|
|
157
|
+
...minimumDeposit === void 0 ? {} : { minimumDeposit }
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
|
|
@@ -184,6 +185,16 @@ function normalizeDisplayBalance(value) {
|
|
|
184
185
|
return (cents / 100).toFixed(2);
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
// src/minimumDepositParam.ts
|
|
189
|
+
var MAX_MINIMUM_DEPOSIT_USD = 1e6;
|
|
190
|
+
function normalizeMinimumDeposit(value) {
|
|
191
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
192
|
+
if (value <= 0 || value >= MAX_MINIMUM_DEPOSIT_USD) return null;
|
|
193
|
+
const cents = Math.ceil(Number((value * 100).toPrecision(15)));
|
|
194
|
+
if (cents <= 0 || cents >= MAX_MINIMUM_DEPOSIT_USD * 100) return null;
|
|
195
|
+
return (cents / 100).toFixed(2);
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
// src/walletBridge/discover.ts
|
|
188
199
|
function createWalletDiscoverer() {
|
|
189
200
|
if (typeof window === "undefined") {
|
|
@@ -1610,6 +1621,27 @@ var Deposit = class {
|
|
|
1610
1621
|
}
|
|
1611
1622
|
return normalized;
|
|
1612
1623
|
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Normalizes {@link DepositRequest.minimumDeposit} for the wire, or returns
|
|
1626
|
+
* `undefined` to omit it everywhere. Same additive discipline and same
|
|
1627
|
+
* console-complaint rationale as {@link normalizeRequestBalance}.
|
|
1628
|
+
*
|
|
1629
|
+
* A rejected minimum never blocks the deposit — the flow proceeds on
|
|
1630
|
+
* Blink's own per-route floor, which is the safe direction to fail: the
|
|
1631
|
+
* merchant loses their higher floor, nobody is locked out of depositing.
|
|
1632
|
+
*/
|
|
1633
|
+
normalizeRequestMinimumDeposit(minimumDeposit) {
|
|
1634
|
+
if (minimumDeposit === void 0 || minimumDeposit === null) return void 0;
|
|
1635
|
+
const normalized = normalizeMinimumDeposit(minimumDeposit);
|
|
1636
|
+
if (normalized === null) {
|
|
1637
|
+
const received = typeof minimumDeposit === "number" ? String(minimumDeposit) : JSON.stringify(minimumDeposit) ?? String(minimumDeposit);
|
|
1638
|
+
console.error(
|
|
1639
|
+
`[blink] minimumDeposit must be a finite number > 0 and < 1e6 (USD); received ${received}. Ignoring it.`
|
|
1640
|
+
);
|
|
1641
|
+
return void 0;
|
|
1642
|
+
}
|
|
1643
|
+
return normalized;
|
|
1644
|
+
}
|
|
1613
1645
|
/**
|
|
1614
1646
|
* Fluid is the default; `layout: 'fixed'` opts back into the legacy
|
|
1615
1647
|
* container. Embedded is a separate presentation and never fluid — the
|
|
@@ -1669,6 +1701,7 @@ var Deposit = class {
|
|
|
1669
1701
|
});
|
|
1670
1702
|
const signerRequest = buildSignerRequest(request, webviewBaseUrl);
|
|
1671
1703
|
const displayBalance = this.normalizeRequestBalance(request.balance);
|
|
1704
|
+
const minimumDeposit = this.normalizeRequestMinimumDeposit(request.minimumDeposit);
|
|
1672
1705
|
let preloadIframe;
|
|
1673
1706
|
let iframeReadyPromise;
|
|
1674
1707
|
const warm = this.takeWarmIframe();
|
|
@@ -1722,7 +1755,8 @@ var Deposit = class {
|
|
|
1722
1755
|
signerResponse.merchantId,
|
|
1723
1756
|
signerResponse.payload,
|
|
1724
1757
|
signerResponse.signature,
|
|
1725
|
-
displayBalance
|
|
1758
|
+
displayBalance,
|
|
1759
|
+
minimumDeposit
|
|
1726
1760
|
),
|
|
1727
1761
|
this.hostedOrigin
|
|
1728
1762
|
);
|
|
@@ -1739,6 +1773,9 @@ var Deposit = class {
|
|
|
1739
1773
|
if (displayBalance !== void 0) {
|
|
1740
1774
|
hostedUrl.searchParams.set("balance", displayBalance);
|
|
1741
1775
|
}
|
|
1776
|
+
if (minimumDeposit !== void 0) {
|
|
1777
|
+
hostedUrl.searchParams.set("minDeposit", minimumDeposit);
|
|
1778
|
+
}
|
|
1742
1779
|
this.applyFullWidgetParam(hostedUrl);
|
|
1743
1780
|
if (this.isEmbedded()) {
|
|
1744
1781
|
this.applyLayoutParam(hostedUrl);
|