@swype-org/react-sdk 0.1.8 → 0.1.9
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/index.cjs +17 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2217,6 +2217,23 @@ function SwypePayment({
|
|
|
2217
2217
|
effectiveSourceId = activeWallet.id;
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
2220
|
+
const isActiveWallet = effectiveSourceType === "walletId" && accounts.some(
|
|
2221
|
+
(a) => a.wallets.some((w) => w.id === effectiveSourceId && w.status === "ACTIVE")
|
|
2222
|
+
);
|
|
2223
|
+
if (!isActiveWallet) {
|
|
2224
|
+
let found = false;
|
|
2225
|
+
for (const acct of accounts) {
|
|
2226
|
+
for (const wallet of acct.wallets) {
|
|
2227
|
+
if (wallet.status === "ACTIVE" && wallet.sources.some((s) => s.balance.available.amount >= parsedAmount)) {
|
|
2228
|
+
effectiveSourceType = "walletId";
|
|
2229
|
+
effectiveSourceId = wallet.id;
|
|
2230
|
+
found = true;
|
|
2231
|
+
break;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
if (found) break;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2220
2237
|
const t = await createTransfer(apiBaseUrl, token, {
|
|
2221
2238
|
sourceType: effectiveSourceType,
|
|
2222
2239
|
sourceId: effectiveSourceId,
|