@rhinestone/deposit-modal 0.0.0-dev-20260923170217 → 0.0.0-dev-20260924151520
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 +9 -10
- package/dist/{BankOnrampStep-7RKADD55.cjs → BankOnrampStep-IGM5MQIE.cjs} +47 -106
- package/dist/{BankOnrampStep-7KLRGLIK.mjs → BankOnrampStep-TM2QDKWB.mjs} +44 -103
- package/dist/{DepositModalReown-FSW7QECS.mjs → DepositModalReown-H7R765XZ.mjs} +3 -3
- package/dist/{DepositModalReown-O3FGTPSB.cjs → DepositModalReown-YD2XKWLH.cjs} +16 -16
- package/dist/WithdrawModal-FGRY6FA4.cjs +12 -0
- package/dist/{WithdrawModal-BYDTRTI6.mjs → WithdrawModal-R5MXRAPM.mjs} +3 -3
- package/dist/{chunk-7RZM44B5.mjs → chunk-3TNRNEI6.mjs} +29 -28
- package/dist/{chunk-KYWGMKXP.mjs → chunk-5DRAO6MA.mjs} +1 -1
- package/dist/{chunk-C3LZ5WA2.mjs → chunk-75QG7YT4.mjs} +1 -1
- package/dist/{chunk-7BTJYIB6.cjs → chunk-7BEGK6CC.cjs} +54 -54
- package/dist/{chunk-MIJGM6BI.cjs → chunk-AUBE55SV.cjs} +33 -33
- package/dist/{chunk-QPVJI3T7.mjs → chunk-CUPQBA6A.mjs} +1 -1
- package/dist/{chunk-TRDIY7S7.cjs → chunk-DITTMGS4.cjs} +2 -2
- package/dist/{chunk-EVVIDGHG.cjs → chunk-FVO2VIEP.cjs} +2 -2
- package/dist/{chunk-OZL6CFUA.cjs → chunk-LDXU7DFI.cjs} +243 -242
- package/dist/{chunk-NE2OP6HI.mjs → chunk-N3ZPFK7S.mjs} +1 -1
- package/dist/{chunk-6PTR3TBE.cjs → chunk-RHCSUAT2.cjs} +3 -3
- package/dist/{chunk-JBYUAECX.mjs → chunk-TU5VRC4L.mjs} +1 -1
- package/dist/{chunk-GDQBQBCR.mjs → chunk-X6C6FX3N.mjs} +1 -1
- package/dist/{chunk-YT42KOJA.cjs → chunk-YMQT4PJU.cjs} +1 -1
- package/dist/compliance.cjs +4 -4
- package/dist/compliance.mjs +3 -3
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/embed.cjs +14 -14
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/offramp.cjs +4 -4
- package/dist/offramp.mjs +2 -2
- package/dist/onramp.cjs +4 -4
- package/dist/onramp.mjs +3 -3
- package/dist/{types-DBbMympO.d.ts → types-C5ji17hM.d.ts} +2 -2
- package/dist/{types-D3EoU6Ux.d.cts → types-CsDcpr8t.d.cts} +2 -2
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +3 -2
- package/dist/WithdrawModal-HQ2NDHA7.cjs +0 -12
package/README.md
CHANGED
|
@@ -310,25 +310,24 @@ frame-src https://widget.swapped.com https://sandbox.swapped.com https://connect
|
|
|
310
310
|
|
|
311
311
|
### Bank transfer accounts (Noah)
|
|
312
312
|
|
|
313
|
-
> **Preview.**
|
|
314
|
-
> your integration: when hosted onboarding finishes, the provider redirects the
|
|
315
|
-
> frame to a confirmation page that does not exist yet, so the customer briefly
|
|
316
|
-
> sees a 404 inside the modal. Nothing is lost — the modal reads the outcome
|
|
317
|
-
> from the compliance status, not from the frame, so verification still
|
|
318
|
-
> completes and the flow continues.
|
|
319
|
-
>
|
|
320
|
-
> Your proxy must forward `POST /compliance/verification` on the customer
|
|
313
|
+
> **Preview.** Your proxy must forward `POST /compliance/verification` on the customer
|
|
321
314
|
> bearer; deploy it before shipping a modal that calls it, or first-time
|
|
322
315
|
> verification 404s at the proxy.
|
|
323
316
|
>
|
|
324
317
|
> The prop is opt-in and inert unless you pass it. Treat it as unstable until
|
|
325
318
|
> this note is removed.
|
|
326
319
|
|
|
327
|
-
Pass `bankOnramp` to
|
|
328
|
-
|
|
320
|
+
Pass `bankOnramp` to use reusable USD/EUR account details when Noah is provisioned
|
|
321
|
+
for your organization. Integrator KYB happens directly with Noah; Rhinestone
|
|
322
|
+
enables provisioning after Noah confirms it. Card and Apple Pay continue through Swapped. A customer who has
|
|
329
323
|
not been verified is taken through hosted verification first; an existing active
|
|
330
324
|
account is resumed; otherwise the selected currency is configured once.
|
|
331
325
|
|
|
326
|
+
The modal checks `GET /onramp/noah/options` before customer verification. A 404
|
|
327
|
+
(provisioning disabled or an older proxy) routes bank transfer through Swapped.
|
|
328
|
+
A successful response keeps Noah exclusive, even when no currencies are available.
|
|
329
|
+
Authentication and service errors show a retry instead of switching providers.
|
|
330
|
+
|
|
332
331
|
Payment status is shown under the bank details and polls while the account is on
|
|
333
332
|
screen, so a customer who transferred earlier sees where their money is on
|
|
334
333
|
reopening. `delivered` means the crypto has been confirmed on chain — not merely
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
var _chunkG264OM23cjs = require('./chunk-G264OM23.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkDITTMGS4cjs = require('./chunk-DITTMGS4.cjs');
|
|
10
10
|
require('./chunk-ADEWTBSN.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var _chunkRHCSUAT2cjs = require('./chunk-RHCSUAT2.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkFVO2VIEPcjs = require('./chunk-FVO2VIEP.cjs');
|
|
18
|
+
require('./chunk-YMQT4PJU.cjs');
|
|
17
19
|
|
|
18
20
|
// src/components/steps/BankOnrampStep.tsx
|
|
19
21
|
var _react = require('react');
|
|
@@ -135,13 +137,28 @@ var PAYMENT_POLL_MS = 15e3;
|
|
|
135
137
|
var VERIFICATION_POLL_MS = 5e3;
|
|
136
138
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
137
139
|
function BankOnrampStep({
|
|
140
|
+
unavailableFallback,
|
|
141
|
+
...props
|
|
142
|
+
}) {
|
|
143
|
+
const [unavailable, setUnavailable] = _react.useState.call(void 0, false);
|
|
144
|
+
const handleUnavailable = _react.useCallback.call(void 0, () => setUnavailable(true), []);
|
|
145
|
+
if (unavailable) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: unavailableFallback });
|
|
146
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
NoahOnrampStep,
|
|
148
|
+
{
|
|
149
|
+
...props,
|
|
150
|
+
onUnavailable: unavailableFallback ? handleUnavailable : void 0
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function NoahOnrampStep({
|
|
138
155
|
backendUrl,
|
|
139
156
|
smartAccount,
|
|
140
157
|
bankOnramp,
|
|
141
|
-
onGoBack,
|
|
142
158
|
onInternalBack,
|
|
143
159
|
onError,
|
|
144
|
-
openExternally
|
|
160
|
+
openExternally,
|
|
161
|
+
onUnavailable
|
|
145
162
|
}) {
|
|
146
163
|
const getSessionRef = _chunkG264OM23cjs.useLatestRef.call(void 0, bankOnramp.getSession);
|
|
147
164
|
const sessionOptions = _react.useMemo.call(void 0,
|
|
@@ -152,7 +169,7 @@ function BankOnrampStep({
|
|
|
152
169
|
[backendUrl, getSessionRef, smartAccount]
|
|
153
170
|
);
|
|
154
171
|
const service = _react.useMemo.call(void 0,
|
|
155
|
-
() =>
|
|
172
|
+
() => _chunkDITTMGS4cjs.createOnrampService.call(void 0, sessionOptions),
|
|
156
173
|
[sessionOptions]
|
|
157
174
|
);
|
|
158
175
|
const [options, setOptions] = _react.useState.call(void 0, []);
|
|
@@ -173,10 +190,10 @@ function BankOnrampStep({
|
|
|
173
190
|
[]
|
|
174
191
|
);
|
|
175
192
|
const ensureVerified = _react.useCallback.call(void 0, async () => {
|
|
176
|
-
const current = await
|
|
193
|
+
const current = await _chunkRHCSUAT2cjs.getComplianceStatus.call(void 0, sessionOptions);
|
|
177
194
|
if (current.status === "approved") return "approved";
|
|
178
195
|
if (current.status === "declined") return "declined";
|
|
179
|
-
const session = await
|
|
196
|
+
const session = await _chunkRHCSUAT2cjs.startComplianceVerification.call(void 0, sessionOptions, {
|
|
180
197
|
// Verification is per fiat currency. Without an explicit choice the US
|
|
181
198
|
// dollar journey is the one every configured country can complete.
|
|
182
199
|
currency: _nullishCoalesce(bankOnramp.currency, () => ( "USD"))
|
|
@@ -200,6 +217,18 @@ function BankOnrampStep({
|
|
|
200
217
|
setLoading(true);
|
|
201
218
|
setError(null);
|
|
202
219
|
try {
|
|
220
|
+
const available = await service.getOptions({
|
|
221
|
+
country: bankOnramp.country,
|
|
222
|
+
paymentMethod: "bank_transfer",
|
|
223
|
+
...bankOnramp.currency ? { currency: bankOnramp.currency } : {}
|
|
224
|
+
}).catch((error2) => {
|
|
225
|
+
if (error2 instanceof _chunkFVO2VIEPcjs.ScopedRequestError && error2.status === 404 && onUnavailable) {
|
|
226
|
+
if (isCurrentRequest(generation)) onUnavailable();
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
throw error2;
|
|
230
|
+
});
|
|
231
|
+
if (!available || !isCurrentRequest(generation)) return;
|
|
203
232
|
const verification = await ensureVerified();
|
|
204
233
|
if (!isCurrentRequest(generation)) return;
|
|
205
234
|
if (verification !== "approved") {
|
|
@@ -208,15 +237,7 @@ function BankOnrampStep({
|
|
|
208
237
|
}
|
|
209
238
|
setVerifying(null);
|
|
210
239
|
setExternalOpened(false);
|
|
211
|
-
const
|
|
212
|
-
country: bankOnramp.country,
|
|
213
|
-
paymentMethod: "bank_transfer",
|
|
214
|
-
...bankOnramp.currency ? { currency: bankOnramp.currency } : {}
|
|
215
|
-
};
|
|
216
|
-
const [available, existing] = await Promise.all([
|
|
217
|
-
service.getOptions(intent),
|
|
218
|
-
service.listAccounts()
|
|
219
|
-
]);
|
|
240
|
+
const existing = await service.listAccounts();
|
|
220
241
|
if (!isCurrentRequest(generation)) return;
|
|
221
242
|
setOptions(available.items);
|
|
222
243
|
setAccounts(existing.items);
|
|
@@ -233,6 +254,7 @@ function BankOnrampStep({
|
|
|
233
254
|
ensureVerified,
|
|
234
255
|
isCurrentRequest,
|
|
235
256
|
onError,
|
|
257
|
+
onUnavailable,
|
|
236
258
|
service
|
|
237
259
|
]);
|
|
238
260
|
_react.useEffect.call(void 0, () => {
|
|
@@ -346,7 +368,7 @@ function BankOnrampStep({
|
|
|
346
368
|
const timer = setInterval(() => {
|
|
347
369
|
void (async () => {
|
|
348
370
|
try {
|
|
349
|
-
const status = await
|
|
371
|
+
const status = await _chunkRHCSUAT2cjs.getComplianceStatus.call(void 0, sessionOptions);
|
|
350
372
|
if (!active) return;
|
|
351
373
|
if (status.status === "approved") {
|
|
352
374
|
setHostedUrl(null);
|
|
@@ -390,11 +412,6 @@ function BankOnrampStep({
|
|
|
390
412
|
if (timer) clearInterval(timer);
|
|
391
413
|
};
|
|
392
414
|
}, [selectedAccount, service]);
|
|
393
|
-
const leaveStep = _react.useCallback.call(void 0, () => {
|
|
394
|
-
requestGenerationRef.current += 1;
|
|
395
|
-
onGoBack();
|
|
396
|
-
}, [onGoBack]);
|
|
397
|
-
const retry = selectedAccount ? () => void openDetails(selectedAccount) : () => void loadAccounts();
|
|
398
415
|
const restartVerification = _react.useCallback.call(void 0, () => {
|
|
399
416
|
setVerificationExpired(false);
|
|
400
417
|
setVerificationExpiresAt(null);
|
|
@@ -427,66 +444,19 @@ function BankOnrampStep({
|
|
|
427
444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, {}),
|
|
428
445
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Preparing bank details\u2026" })
|
|
429
446
|
] }),
|
|
430
|
-
!loading && error && /* @__PURE__ */ _jsxruntime.
|
|
431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: error }),
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
433
|
-
"button",
|
|
434
|
-
{
|
|
435
|
-
type: "button",
|
|
436
|
-
className: "rs-button rs-button--default",
|
|
437
|
-
onClick: retry,
|
|
438
|
-
children: "Retry"
|
|
439
|
-
}
|
|
440
|
-
),
|
|
441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
442
|
-
"button",
|
|
443
|
-
{
|
|
444
|
-
type: "button",
|
|
445
|
-
className: "rs-button rs-button--default",
|
|
446
|
-
onClick: selectedAccount ? backToCurrencies : leaveStep,
|
|
447
|
-
children: "Back"
|
|
448
|
-
}
|
|
449
|
-
)
|
|
450
|
-
] }),
|
|
447
|
+
!loading && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: error }) }),
|
|
451
448
|
!loading && !error && verifying === "declined" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
452
449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Verification unsuccessful" }),
|
|
453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Your provider could not verify these details. Contact support to continue." })
|
|
454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
-
"button",
|
|
456
|
-
{
|
|
457
|
-
type: "button",
|
|
458
|
-
className: "rs-button rs-button--default",
|
|
459
|
-
onClick: leaveStep,
|
|
460
|
-
children: "Back"
|
|
461
|
-
}
|
|
462
|
-
)
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Your provider could not verify these details. Contact support to continue." })
|
|
463
451
|
] }),
|
|
464
452
|
!loading && !error && verifying === "reviewing" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
465
453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, {}),
|
|
466
454
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Checking your details" }),
|
|
467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This usually takes a moment. You can close this and come back." })
|
|
468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
469
|
-
"button",
|
|
470
|
-
{
|
|
471
|
-
type: "button",
|
|
472
|
-
className: "rs-button rs-button--default",
|
|
473
|
-
onClick: leaveStep,
|
|
474
|
-
children: "Back"
|
|
475
|
-
}
|
|
476
|
-
)
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This usually takes a moment. You can close this and come back." })
|
|
477
456
|
] }),
|
|
478
457
|
!loading && !error && verifying === "action_required" && externalOpened && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
479
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Verification opened" }),
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Finish verifying in your browser, then return here." })
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
482
|
-
"button",
|
|
483
|
-
{
|
|
484
|
-
type: "button",
|
|
485
|
-
className: "rs-button rs-button--default",
|
|
486
|
-
onClick: leaveStep,
|
|
487
|
-
children: "Back"
|
|
488
|
-
}
|
|
489
|
-
)
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Finish verifying in your browser, then return here." })
|
|
490
460
|
] }),
|
|
491
461
|
!loading && !error && verifying === "action_required" && verificationExpired && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
492
462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Verification expired" }),
|
|
@@ -541,18 +511,7 @@ function BankOnrampStep({
|
|
|
541
511
|
option.currency
|
|
542
512
|
);
|
|
543
513
|
}),
|
|
544
|
-
options.length === 0 && /* @__PURE__ */ _jsxruntime.
|
|
545
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "No bank transfer options are available." }),
|
|
546
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
-
"button",
|
|
548
|
-
{
|
|
549
|
-
type: "button",
|
|
550
|
-
className: "rs-button rs-button--default",
|
|
551
|
-
onClick: leaveStep,
|
|
552
|
-
children: "Back"
|
|
553
|
-
}
|
|
554
|
-
)
|
|
555
|
-
] })
|
|
514
|
+
options.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "No bank transfer options are available." }) })
|
|
556
515
|
] }),
|
|
557
516
|
!loading && !error && !verifying && hostedUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-bank-onramp-hosted", children: [
|
|
558
517
|
!iframeLoaded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-bank-onramp-frame-loading", "aria-live": "polite", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, {}) }),
|
|
@@ -572,25 +531,7 @@ function BankOnrampStep({
|
|
|
572
531
|
!loading && !error && !verifying && externalOpened && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
573
532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Bank details opened" }),
|
|
574
533
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Return here when you have finished." }),
|
|
575
|
-
paymentStatus
|
|
576
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
577
|
-
"button",
|
|
578
|
-
{
|
|
579
|
-
type: "button",
|
|
580
|
-
className: "rs-button rs-button--default",
|
|
581
|
-
onClick: retry,
|
|
582
|
-
children: "Retry"
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
|
-
"button",
|
|
587
|
-
{
|
|
588
|
-
type: "button",
|
|
589
|
-
className: "rs-button rs-button--default",
|
|
590
|
-
onClick: backToCurrencies,
|
|
591
|
-
children: "Back"
|
|
592
|
-
}
|
|
593
|
-
)
|
|
534
|
+
paymentStatus
|
|
594
535
|
] })
|
|
595
536
|
] }) });
|
|
596
537
|
}
|
|
@@ -6,14 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-YY4ZOAH5.mjs";
|
|
7
7
|
import {
|
|
8
8
|
createOnrampService
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X6C6FX3N.mjs";
|
|
10
10
|
import "./chunk-PP4QE32S.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getComplianceStatus,
|
|
13
13
|
startComplianceVerification
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import
|
|
16
|
-
|
|
14
|
+
} from "./chunk-CUPQBA6A.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ScopedRequestError
|
|
17
|
+
} from "./chunk-5DRAO6MA.mjs";
|
|
18
|
+
import "./chunk-N3ZPFK7S.mjs";
|
|
17
19
|
|
|
18
20
|
// src/components/steps/BankOnrampStep.tsx
|
|
19
21
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -128,20 +130,35 @@ function hostedSessionRemainingMs(expiresAt, now = Date.now()) {
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
// src/components/steps/BankOnrampStep.tsx
|
|
131
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
133
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
132
134
|
var SAFE_ERROR = "Bank details are unavailable. Try again.";
|
|
133
135
|
var OPTIONS_ERROR = "Bank transfer options are unavailable. Try again.";
|
|
134
136
|
var PAYMENT_POLL_MS = 15e3;
|
|
135
137
|
var VERIFICATION_POLL_MS = 5e3;
|
|
136
138
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
137
139
|
function BankOnrampStep({
|
|
140
|
+
unavailableFallback,
|
|
141
|
+
...props
|
|
142
|
+
}) {
|
|
143
|
+
const [unavailable, setUnavailable] = useState(false);
|
|
144
|
+
const handleUnavailable = useCallback(() => setUnavailable(true), []);
|
|
145
|
+
if (unavailable) return /* @__PURE__ */ jsx(Fragment, { children: unavailableFallback });
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
NoahOnrampStep,
|
|
148
|
+
{
|
|
149
|
+
...props,
|
|
150
|
+
onUnavailable: unavailableFallback ? handleUnavailable : void 0
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function NoahOnrampStep({
|
|
138
155
|
backendUrl,
|
|
139
156
|
smartAccount,
|
|
140
157
|
bankOnramp,
|
|
141
|
-
onGoBack,
|
|
142
158
|
onInternalBack,
|
|
143
159
|
onError,
|
|
144
|
-
openExternally
|
|
160
|
+
openExternally,
|
|
161
|
+
onUnavailable
|
|
145
162
|
}) {
|
|
146
163
|
const getSessionRef = useLatestRef(bankOnramp.getSession);
|
|
147
164
|
const sessionOptions = useMemo(
|
|
@@ -200,6 +217,18 @@ function BankOnrampStep({
|
|
|
200
217
|
setLoading(true);
|
|
201
218
|
setError(null);
|
|
202
219
|
try {
|
|
220
|
+
const available = await service.getOptions({
|
|
221
|
+
country: bankOnramp.country,
|
|
222
|
+
paymentMethod: "bank_transfer",
|
|
223
|
+
...bankOnramp.currency ? { currency: bankOnramp.currency } : {}
|
|
224
|
+
}).catch((error2) => {
|
|
225
|
+
if (error2 instanceof ScopedRequestError && error2.status === 404 && onUnavailable) {
|
|
226
|
+
if (isCurrentRequest(generation)) onUnavailable();
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
throw error2;
|
|
230
|
+
});
|
|
231
|
+
if (!available || !isCurrentRequest(generation)) return;
|
|
203
232
|
const verification = await ensureVerified();
|
|
204
233
|
if (!isCurrentRequest(generation)) return;
|
|
205
234
|
if (verification !== "approved") {
|
|
@@ -208,15 +237,7 @@ function BankOnrampStep({
|
|
|
208
237
|
}
|
|
209
238
|
setVerifying(null);
|
|
210
239
|
setExternalOpened(false);
|
|
211
|
-
const
|
|
212
|
-
country: bankOnramp.country,
|
|
213
|
-
paymentMethod: "bank_transfer",
|
|
214
|
-
...bankOnramp.currency ? { currency: bankOnramp.currency } : {}
|
|
215
|
-
};
|
|
216
|
-
const [available, existing] = await Promise.all([
|
|
217
|
-
service.getOptions(intent),
|
|
218
|
-
service.listAccounts()
|
|
219
|
-
]);
|
|
240
|
+
const existing = await service.listAccounts();
|
|
220
241
|
if (!isCurrentRequest(generation)) return;
|
|
221
242
|
setOptions(available.items);
|
|
222
243
|
setAccounts(existing.items);
|
|
@@ -233,6 +254,7 @@ function BankOnrampStep({
|
|
|
233
254
|
ensureVerified,
|
|
234
255
|
isCurrentRequest,
|
|
235
256
|
onError,
|
|
257
|
+
onUnavailable,
|
|
236
258
|
service
|
|
237
259
|
]);
|
|
238
260
|
useEffect(() => {
|
|
@@ -390,11 +412,6 @@ function BankOnrampStep({
|
|
|
390
412
|
if (timer) clearInterval(timer);
|
|
391
413
|
};
|
|
392
414
|
}, [selectedAccount, service]);
|
|
393
|
-
const leaveStep = useCallback(() => {
|
|
394
|
-
requestGenerationRef.current += 1;
|
|
395
|
-
onGoBack();
|
|
396
|
-
}, [onGoBack]);
|
|
397
|
-
const retry = selectedAccount ? () => void openDetails(selectedAccount) : () => void loadAccounts();
|
|
398
415
|
const restartVerification = useCallback(() => {
|
|
399
416
|
setVerificationExpired(false);
|
|
400
417
|
setVerificationExpiresAt(null);
|
|
@@ -427,66 +444,19 @@ function BankOnrampStep({
|
|
|
427
444
|
/* @__PURE__ */ jsx(Spinner, {}),
|
|
428
445
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Preparing bank details\u2026" })
|
|
429
446
|
] }),
|
|
430
|
-
!loading && error && /* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: error }),
|
|
432
|
-
/* @__PURE__ */ jsx(
|
|
433
|
-
"button",
|
|
434
|
-
{
|
|
435
|
-
type: "button",
|
|
436
|
-
className: "rs-button rs-button--default",
|
|
437
|
-
onClick: retry,
|
|
438
|
-
children: "Retry"
|
|
439
|
-
}
|
|
440
|
-
),
|
|
441
|
-
/* @__PURE__ */ jsx(
|
|
442
|
-
"button",
|
|
443
|
-
{
|
|
444
|
-
type: "button",
|
|
445
|
-
className: "rs-button rs-button--default",
|
|
446
|
-
onClick: selectedAccount ? backToCurrencies : leaveStep,
|
|
447
|
-
children: "Back"
|
|
448
|
-
}
|
|
449
|
-
)
|
|
450
|
-
] }),
|
|
447
|
+
!loading && error && /* @__PURE__ */ jsx("div", { className: "rs-loading-state", "aria-live": "polite", children: /* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: error }) }),
|
|
451
448
|
!loading && !error && verifying === "declined" && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
452
449
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Verification unsuccessful" }),
|
|
453
|
-
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "Your provider could not verify these details. Contact support to continue." })
|
|
454
|
-
/* @__PURE__ */ jsx(
|
|
455
|
-
"button",
|
|
456
|
-
{
|
|
457
|
-
type: "button",
|
|
458
|
-
className: "rs-button rs-button--default",
|
|
459
|
-
onClick: leaveStep,
|
|
460
|
-
children: "Back"
|
|
461
|
-
}
|
|
462
|
-
)
|
|
450
|
+
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "Your provider could not verify these details. Contact support to continue." })
|
|
463
451
|
] }),
|
|
464
452
|
!loading && !error && verifying === "reviewing" && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
465
453
|
/* @__PURE__ */ jsx(Spinner, {}),
|
|
466
454
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Checking your details" }),
|
|
467
|
-
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "This usually takes a moment. You can close this and come back." })
|
|
468
|
-
/* @__PURE__ */ jsx(
|
|
469
|
-
"button",
|
|
470
|
-
{
|
|
471
|
-
type: "button",
|
|
472
|
-
className: "rs-button rs-button--default",
|
|
473
|
-
onClick: leaveStep,
|
|
474
|
-
children: "Back"
|
|
475
|
-
}
|
|
476
|
-
)
|
|
455
|
+
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "This usually takes a moment. You can close this and come back." })
|
|
477
456
|
] }),
|
|
478
457
|
!loading && !error && verifying === "action_required" && externalOpened && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
479
458
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Verification opened" }),
|
|
480
|
-
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "Finish verifying in your browser, then return here." })
|
|
481
|
-
/* @__PURE__ */ jsx(
|
|
482
|
-
"button",
|
|
483
|
-
{
|
|
484
|
-
type: "button",
|
|
485
|
-
className: "rs-button rs-button--default",
|
|
486
|
-
onClick: leaveStep,
|
|
487
|
-
children: "Back"
|
|
488
|
-
}
|
|
489
|
-
)
|
|
459
|
+
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "Finish verifying in your browser, then return here." })
|
|
490
460
|
] }),
|
|
491
461
|
!loading && !error && verifying === "action_required" && verificationExpired && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
492
462
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Verification expired" }),
|
|
@@ -541,18 +511,7 @@ function BankOnrampStep({
|
|
|
541
511
|
option.currency
|
|
542
512
|
);
|
|
543
513
|
}),
|
|
544
|
-
options.length === 0 && /* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "No bank transfer options are available." }),
|
|
546
|
-
/* @__PURE__ */ jsx(
|
|
547
|
-
"button",
|
|
548
|
-
{
|
|
549
|
-
type: "button",
|
|
550
|
-
className: "rs-button rs-button--default",
|
|
551
|
-
onClick: leaveStep,
|
|
552
|
-
children: "Back"
|
|
553
|
-
}
|
|
554
|
-
)
|
|
555
|
-
] })
|
|
514
|
+
options.length === 0 && /* @__PURE__ */ jsx("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "No bank transfer options are available." }) })
|
|
556
515
|
] }),
|
|
557
516
|
!loading && !error && !verifying && hostedUrl && /* @__PURE__ */ jsxs("div", { className: "rs-bank-onramp-hosted", children: [
|
|
558
517
|
!iframeLoaded && /* @__PURE__ */ jsx("div", { className: "rs-bank-onramp-frame-loading", "aria-live": "polite", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
@@ -572,25 +531,7 @@ function BankOnrampStep({
|
|
|
572
531
|
!loading && !error && !verifying && externalOpened && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", "aria-live": "polite", children: [
|
|
573
532
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-title", children: "Bank details opened" }),
|
|
574
533
|
/* @__PURE__ */ jsx("div", { className: "rs-loading-subtitle", children: "Return here when you have finished." }),
|
|
575
|
-
paymentStatus
|
|
576
|
-
/* @__PURE__ */ jsx(
|
|
577
|
-
"button",
|
|
578
|
-
{
|
|
579
|
-
type: "button",
|
|
580
|
-
className: "rs-button rs-button--default",
|
|
581
|
-
onClick: retry,
|
|
582
|
-
children: "Retry"
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
/* @__PURE__ */ jsx(
|
|
586
|
-
"button",
|
|
587
|
-
{
|
|
588
|
-
type: "button",
|
|
589
|
-
className: "rs-button rs-button--default",
|
|
590
|
-
onClick: backToCurrencies,
|
|
591
|
-
children: "Back"
|
|
592
|
-
}
|
|
593
|
-
)
|
|
534
|
+
paymentStatus
|
|
594
535
|
] })
|
|
595
536
|
] }) });
|
|
596
537
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner,
|
|
3
3
|
getReownDependencies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3TNRNEI6.mjs";
|
|
5
5
|
import "./chunk-FTWKAJGN.mjs";
|
|
6
6
|
import {
|
|
7
7
|
followSystemAppearance,
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
resolveThemeMode,
|
|
12
12
|
rpcUrlFor,
|
|
13
13
|
useStableRpcUrls
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-75QG7YT4.mjs";
|
|
15
15
|
import {
|
|
16
16
|
SUPPORTED_CHAIN_IDS,
|
|
17
17
|
getChainName
|
|
18
18
|
} from "./chunk-EAGMY3QE.mjs";
|
|
19
19
|
import "./chunk-YY4ZOAH5.mjs";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-N3ZPFK7S.mjs";
|
|
21
21
|
|
|
22
22
|
// src/DepositModalReown.tsx
|
|
23
23
|
import { useCallback, useMemo as useMemo2 } from "react";
|