@rhinestone/deposit-modal 0.18.0 → 0.20.0

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.
Files changed (83) hide show
  1. package/README.md +179 -48
  2. package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
  3. package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
  4. package/dist/{DepositModalReown-VCY65DJX.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
  5. package/dist/{DepositModalReown-TVO3ZQQK.cjs → DepositModalReown-ALVWADG7.cjs} +21 -20
  6. package/dist/WithdrawModal-5YWFJSYY.cjs +12 -0
  7. package/dist/WithdrawModal-LL4Z5WZP.mjs +12 -0
  8. package/dist/{bearer-transport-CVHNBgoV.d.cts → bearer-transport-DZyeDG64.d.cts} +5 -1
  9. package/dist/{bearer-transport-CVHNBgoV.d.ts → bearer-transport-DZyeDG64.d.ts} +5 -1
  10. package/dist/{caip-BMi-9t09.d.cts → caip-nwFFL46o.d.cts} +2 -2
  11. package/dist/{caip-BMi-9t09.d.ts → caip-nwFFL46o.d.ts} +2 -2
  12. package/dist/{chunk-EKC2IRQG.mjs → chunk-247GJH57.mjs} +687 -299
  13. package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
  14. package/dist/{chunk-AIZKGFVA.mjs → chunk-32ERBFMO.mjs} +1499 -978
  15. package/dist/chunk-5QUWEFD4.mjs +19 -0
  16. package/dist/chunk-6CTJFR3T.mjs +113 -0
  17. package/dist/{chunk-3TEVMP76.mjs → chunk-B2LZQIGB.mjs} +1 -1
  18. package/dist/{chunk-34JVJZEZ.cjs → chunk-BTEG2VNZ.cjs} +171 -130
  19. package/dist/{chunk-N3AAT6BS.cjs → chunk-CXRH5MKO.cjs} +1556 -1035
  20. package/dist/chunk-E7IMWVMN.mjs +346 -0
  21. package/dist/{chunk-N6JJG57R.cjs → chunk-EKFXUF5A.cjs} +1 -1
  22. package/dist/chunk-FKJ6EJHH.cjs +346 -0
  23. package/dist/chunk-FMUSY563.cjs +19 -0
  24. package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
  25. package/dist/chunk-G264OM23.cjs +224 -0
  26. package/dist/{chunk-R2B6VD4E.mjs → chunk-HP7S7AD6.mjs} +73 -32
  27. package/dist/{chunk-O4JZKKCZ.cjs → chunk-OPT5EW6L.cjs} +10 -5
  28. package/dist/chunk-PYRXOP2Y.cjs +113 -0
  29. package/dist/{chunk-X4EUXBHJ.mjs → chunk-XBJCZYBX.mjs} +8 -3
  30. package/dist/chunk-YY4ZOAH5.mjs +224 -0
  31. package/dist/{chunk-JV5OGG53.cjs → chunk-Z4RBTNKX.cjs} +1202 -814
  32. package/dist/compliance.cjs +4 -7
  33. package/dist/compliance.d.cts +26 -3
  34. package/dist/compliance.d.ts +26 -3
  35. package/dist/compliance.mjs +6 -9
  36. package/dist/constants-BQDxVNgr.d.cts +29 -0
  37. package/dist/constants-DjGQW5N5.d.ts +29 -0
  38. package/dist/constants.cjs +3 -37
  39. package/dist/constants.d.cts +4 -20
  40. package/dist/constants.d.ts +4 -20
  41. package/dist/constants.mjs +4 -38
  42. package/dist/deposit.cjs +7 -6
  43. package/dist/deposit.d.cts +5 -3
  44. package/dist/deposit.d.ts +5 -3
  45. package/dist/deposit.mjs +6 -5
  46. package/dist/embed.cjs +21 -20
  47. package/dist/embed.d.cts +3 -2
  48. package/dist/embed.d.ts +3 -2
  49. package/dist/embed.mjs +7 -6
  50. package/dist/index.cjs +8 -35
  51. package/dist/index.d.cts +5 -3
  52. package/dist/index.d.ts +5 -3
  53. package/dist/index.mjs +9 -36
  54. package/dist/onramp.cjs +4 -20
  55. package/dist/onramp.d.cts +59 -23
  56. package/dist/onramp.d.ts +59 -23
  57. package/dist/onramp.mjs +5 -21
  58. package/dist/polymarket.cjs +6 -6
  59. package/dist/polymarket.mjs +2 -2
  60. package/dist/ramp-types-HYWd7CW0.d.cts +108 -0
  61. package/dist/ramp-types-HYWd7CW0.d.ts +108 -0
  62. package/dist/styles.css +280 -0
  63. package/dist/{types-CbUs4boj.d.cts → types-BxSrazbq.d.ts} +56 -3
  64. package/dist/{types-CZYypODQ.d.ts → types-CixUBhrM.d.cts} +56 -3
  65. package/dist/withdraw.cjs +6 -5
  66. package/dist/withdraw.d.cts +4 -3
  67. package/dist/withdraw.d.ts +4 -3
  68. package/dist/withdraw.mjs +5 -4
  69. package/package.json +9 -17
  70. package/dist/WithdrawModal-GR3HLYXU.cjs +0 -11
  71. package/dist/WithdrawModal-RMCYJJ4S.mjs +0 -11
  72. package/dist/chunk-ADEWTBSN.cjs +0 -19
  73. package/dist/chunk-EAGMY3QE.mjs +0 -962
  74. package/dist/chunk-OY5N3E6L.cjs +0 -962
  75. package/dist/chunk-PP4QE32S.mjs +0 -19
  76. package/dist/constants-BT4ctuHo.d.cts +0 -64
  77. package/dist/constants-D21ZdNOP.d.ts +0 -64
  78. package/dist/offramp.cjs +0 -25
  79. package/dist/offramp.d.cts +0 -28
  80. package/dist/offramp.d.ts +0 -28
  81. package/dist/offramp.mjs +0 -25
  82. package/dist/ramp-types-C6aUz4SZ.d.cts +0 -43
  83. package/dist/ramp-types-C6aUz4SZ.d.ts +0 -43
@@ -0,0 +1,435 @@
1
+ import {
2
+ BankIcon,
3
+ BodyHeader,
4
+ CheckIcon,
5
+ CopyIcon,
6
+ Spinner,
7
+ useLatestRef
8
+ } from "./chunk-YY4ZOAH5.mjs";
9
+ import {
10
+ createOnrampService
11
+ } from "./chunk-6CTJFR3T.mjs";
12
+ import {
13
+ getComplianceStatus,
14
+ startComplianceVerification
15
+ } from "./chunk-5QUWEFD4.mjs";
16
+ import {
17
+ ScopedRequestError
18
+ } from "./chunk-XBJCZYBX.mjs";
19
+ import "./chunk-B2LZQIGB.mjs";
20
+
21
+ // src/components/steps/BankOnrampStep.tsx
22
+ import { useCallback, useEffect, useMemo, useRef, useState as useState2 } from "react";
23
+
24
+ // src/core/noah-hosted.ts
25
+ var NOAH_HOSTED_ORIGINS = [
26
+ "https://checkout.noah.com",
27
+ "https://checkout.sandbox.noah.com"
28
+ ];
29
+ function isTrustedNoahHostedUrl(url) {
30
+ let parsed;
31
+ try {
32
+ parsed = new URL(url);
33
+ } catch {
34
+ return false;
35
+ }
36
+ return NOAH_HOSTED_ORIGINS.includes(parsed.origin);
37
+ }
38
+ function hostedSessionRemainingMs(expiresAt, now = Date.now()) {
39
+ if (!expiresAt) return null;
40
+ const expiry = Date.parse(expiresAt);
41
+ if (!Number.isFinite(expiry)) return null;
42
+ return Math.max(0, expiry - now);
43
+ }
44
+
45
+ // src/components/steps/BankDetailsView.tsx
46
+ import { useState } from "react";
47
+ import { jsx, jsxs } from "react/jsx-runtime";
48
+ var RAILS = { BankAch: "ACH", BankFedwire: "Wire", BankSwift: "SWIFT", BankSepa: "SEPA" };
49
+ function Detail({ label, value }) {
50
+ const [copied, setCopied] = useState(false);
51
+ const [failed, setFailed] = useState(false);
52
+ if (!value) return null;
53
+ async function copy() {
54
+ try {
55
+ await navigator.clipboard.writeText(value);
56
+ setCopied(true);
57
+ setFailed(false);
58
+ } catch {
59
+ setFailed(true);
60
+ }
61
+ }
62
+ return /* @__PURE__ */ jsxs("div", { className: "rs-bank-detail", children: [
63
+ /* @__PURE__ */ jsxs("div", { className: "rs-bank-detail-text", children: [
64
+ /* @__PURE__ */ jsx("div", { className: "rs-bank-detail-label", children: label }),
65
+ /* @__PURE__ */ jsx("div", { className: "rs-bank-detail-value", children: value }),
66
+ failed && /* @__PURE__ */ jsx("span", { role: "status", className: "rs-bank-detail-label", children: "Could not copy. Select the value to copy it." })
67
+ ] }),
68
+ /* @__PURE__ */ jsx("button", { type: "button", className: "rs-bank-copy", "aria-label": `Copy ${label.toLowerCase()}`, onClick: () => void copy(), children: copied ? /* @__PURE__ */ jsx(CheckIcon, { size: 16 }) : /* @__PURE__ */ jsx(CopyIcon, { size: 16 }) })
69
+ ] });
70
+ }
71
+ function BankDetailsView({ details }) {
72
+ const [selected, setSelected] = useState(0);
73
+ const rail = details.rails[selected] ?? details.rails[0];
74
+ const address = details.bankAddress;
75
+ const bankAddress = address && [address.street, address.street2, address.city, address.state, address.postCode, address.country].filter(Boolean).join(", ");
76
+ return /* @__PURE__ */ jsxs("div", { className: "rs-bank-native", children: [
77
+ /* @__PURE__ */ jsx("div", { className: "rs-bank-rails", role: "group", "aria-label": "Transfer method", children: details.rails.map((item, index) => /* @__PURE__ */ jsx(
78
+ "button",
79
+ {
80
+ type: "button",
81
+ className: "rs-bank-rail",
82
+ "aria-pressed": index === selected,
83
+ onClick: () => setSelected(index),
84
+ children: RAILS[item.type]
85
+ },
86
+ item.type
87
+ )) }),
88
+ /* @__PURE__ */ jsxs("p", { className: "rs-bank-detail-label", children: [
89
+ "Send ",
90
+ details.currency,
91
+ " using the selected transfer method."
92
+ ] }),
93
+ /* @__PURE__ */ jsxs("div", { className: "rs-bank-fields", children: [
94
+ /* @__PURE__ */ jsx(Detail, { label: "Account holder", value: details.accountHolderName }),
95
+ /* @__PURE__ */ jsx(Detail, { label: rail.type === "BankSepa" ? "IBAN" : "Account number", value: rail.accountNumber }),
96
+ /* @__PURE__ */ jsx(Detail, { label: rail.type === "BankAch" || rail.type === "BankFedwire" ? "Routing number" : "SWIFT / BIC", value: rail.bankCode }),
97
+ /* @__PURE__ */ jsx(Detail, { label: "Bank name", value: details.bankName }),
98
+ /* @__PURE__ */ jsx(Detail, { label: "Bank address", value: bankAddress }),
99
+ /* @__PURE__ */ jsx(Detail, { label: "Payment reference", value: details.reference })
100
+ ] }, rail.type),
101
+ details.reference && /* @__PURE__ */ jsx("p", { className: "rs-bank-detail-label", children: "Include this payment reference with your transfer." }),
102
+ /* @__PURE__ */ jsxs("div", { className: "rs-bank-fee", children: [
103
+ /* @__PURE__ */ jsxs("div", { className: "rs-bank-detail-label", children: [
104
+ "Last quoted fee \xB7 ",
105
+ new Date(details.capturedAt).toLocaleDateString()
106
+ ] }),
107
+ /* @__PURE__ */ jsxs("div", { children: [
108
+ rail.fee.base,
109
+ " ",
110
+ rail.fee.currency,
111
+ " + ",
112
+ rail.fee.percent,
113
+ "% \xB7 minimum ",
114
+ rail.fee.minimum,
115
+ " ",
116
+ rail.fee.currency
117
+ ] }),
118
+ /* @__PURE__ */ jsx("p", { className: "rs-bank-detail-label", children: "Fees may change before your transfer arrives." })
119
+ ] })
120
+ ] });
121
+ }
122
+
123
+ // src/components/steps/BankOnrampStep.tsx
124
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
125
+ var SAFE_ERROR = "Bank details are unavailable. Try again.";
126
+ var PENDING_ERROR = "Bank details are not ready yet. Check back shortly.";
127
+ var OPTIONS_ERROR = "Bank transfer options are unavailable. Try again.";
128
+ var VERIFICATION_POLL_MS = 5e3;
129
+ var MAX_TIMEOUT_MS = 2147483647;
130
+ function BankOnrampStep({
131
+ backendUrl,
132
+ smartAccount,
133
+ bankOnramp,
134
+ onError,
135
+ openExternally,
136
+ onUnavailable,
137
+ onJourney
138
+ }) {
139
+ const getSessionRef = useLatestRef(bankOnramp.getSession);
140
+ const sessionOptions = useMemo(
141
+ () => ({
142
+ backendUrl,
143
+ getSession: () => getSessionRef.current(smartAccount)
144
+ }),
145
+ [backendUrl, getSessionRef, smartAccount]
146
+ );
147
+ const service = useMemo(
148
+ () => createOnrampService(sessionOptions),
149
+ [sessionOptions]
150
+ );
151
+ const [availableForHistory, setAvailableForHistory] = useState2(false);
152
+ useEffect(() => {
153
+ onJourney?.({ source: availableForHistory ? service : null });
154
+ return () => onJourney?.(null);
155
+ }, [service, onJourney, availableForHistory]);
156
+ const [noOptions, setNoOptions] = useState2(false);
157
+ const [loading, setLoading] = useState2(true);
158
+ const [selectedAccount, setSelectedAccount] = useState2(
159
+ null
160
+ );
161
+ const [hostedUrl, setHostedUrl] = useState2(null);
162
+ const [bankDetails, setBankDetails] = useState2(
163
+ null
164
+ );
165
+ const [verificationExpired, setVerificationExpired] = useState2(false);
166
+ const [verificationExpiresAt, setVerificationExpiresAt] = useState2(null);
167
+ const [iframeLoaded, setIframeLoaded] = useState2(false);
168
+ const [externalOpened, setExternalOpened] = useState2(false);
169
+ const [error, setError] = useState2(null);
170
+ const [verifying, setVerifying] = useState2(null);
171
+ const requestGenerationRef = useRef(0);
172
+ const verificationResumedRef = useRef(false);
173
+ const isCurrentRequest = useCallback(
174
+ (generation) => requestGenerationRef.current === generation,
175
+ []
176
+ );
177
+ const startVerification = useCallback(async () => {
178
+ const session = await startComplianceVerification(sessionOptions);
179
+ if (session.status === "failed") return "declined";
180
+ if (!session.nextAction) return "reviewing";
181
+ if (!isTrustedNoahHostedUrl(session.nextAction.url)) return "reviewing";
182
+ if (openExternally) {
183
+ await openExternally(session.nextAction.url);
184
+ setExternalOpened(true);
185
+ return "action_required";
186
+ }
187
+ setHostedUrl(session.nextAction.url);
188
+ setVerificationExpiresAt(session.expiresAt);
189
+ setVerificationExpired(false);
190
+ setIframeLoaded(false);
191
+ return "action_required";
192
+ }, [openExternally, sessionOptions]);
193
+ const ensureVerified = useCallback(async () => {
194
+ const current = await getComplianceStatus(sessionOptions);
195
+ if (current.status === "approved") return "approved";
196
+ if (current.status === "declined") return "declined";
197
+ return startVerification();
198
+ }, [sessionOptions, startVerification]);
199
+ const loadAccounts = useCallback(async () => {
200
+ const generation = ++requestGenerationRef.current;
201
+ setLoading(true);
202
+ setError(null);
203
+ setNoOptions(false);
204
+ try {
205
+ const discover = () => service.getOptions().catch((error2) => {
206
+ if (error2 instanceof ScopedRequestError && error2.status === 404 && onUnavailable) {
207
+ if (isCurrentRequest(generation)) onUnavailable();
208
+ return null;
209
+ }
210
+ throw error2;
211
+ });
212
+ const available = await discover();
213
+ if (!available || !isCurrentRequest(generation)) return;
214
+ setAvailableForHistory(true);
215
+ const verification = await ensureVerified();
216
+ if (!isCurrentRequest(generation)) return;
217
+ if (verification !== "approved") {
218
+ setVerifying(verification);
219
+ return;
220
+ }
221
+ setVerifying(null);
222
+ setExternalOpened(false);
223
+ const [current, existing] = await Promise.all([
224
+ discover(),
225
+ service.listAccounts()
226
+ ]);
227
+ if (!current || !isCurrentRequest(generation)) return;
228
+ const [option] = current.options;
229
+ if (!option) {
230
+ setNoOptions(true);
231
+ return;
232
+ }
233
+ void selectOptionRef.current(
234
+ option,
235
+ existing.items.find(
236
+ (account) => account.status === "active" && account.currency === option.currency
237
+ )
238
+ );
239
+ } catch {
240
+ if (!isCurrentRequest(generation)) return;
241
+ setError(OPTIONS_ERROR);
242
+ onError?.(OPTIONS_ERROR, "BANK_ONRAMP_OPTIONS_FAILED");
243
+ } finally {
244
+ if (isCurrentRequest(generation)) setLoading(false);
245
+ }
246
+ }, [ensureVerified, isCurrentRequest, onError, onUnavailable, service]);
247
+ useEffect(() => {
248
+ setSelectedAccount(null);
249
+ setBankDetails(null);
250
+ setHostedUrl(null);
251
+ setExternalOpened(false);
252
+ void loadAccounts();
253
+ return () => {
254
+ requestGenerationRef.current += 1;
255
+ };
256
+ }, [loadAccounts]);
257
+ const openDetails = useCallback(
258
+ async (account) => {
259
+ const generation = ++requestGenerationRef.current;
260
+ setLoading(true);
261
+ setError(null);
262
+ setBankDetails(null);
263
+ try {
264
+ const { bankDetails: details } = await service.getAccountDetails(
265
+ account.id
266
+ );
267
+ if (!isCurrentRequest(generation)) return;
268
+ if (details.currency !== account.currency)
269
+ throw new Error("Bank currency mismatch");
270
+ setBankDetails(details);
271
+ } catch (error2) {
272
+ if (!isCurrentRequest(generation)) return;
273
+ const pending = error2 instanceof ScopedRequestError && error2.status === 409;
274
+ const message = pending ? PENDING_ERROR : SAFE_ERROR;
275
+ setError(message);
276
+ onError?.(
277
+ message,
278
+ pending ? "BANK_ONRAMP_DETAILS_PENDING" : "BANK_ONRAMP_DETAILS_FAILED"
279
+ );
280
+ } finally {
281
+ if (isCurrentRequest(generation)) setLoading(false);
282
+ }
283
+ },
284
+ [isCurrentRequest, onError, service]
285
+ );
286
+ const selectOption = useCallback(
287
+ async (option, account) => {
288
+ if (account) {
289
+ setSelectedAccount(account);
290
+ await openDetails(account);
291
+ return;
292
+ }
293
+ const generation = ++requestGenerationRef.current;
294
+ setLoading(true);
295
+ setError(null);
296
+ try {
297
+ const request = {
298
+ currency: option.currency,
299
+ optionId: option.optionId
300
+ };
301
+ const nextAccount = (await service.createAccount(request)).account;
302
+ if (!isCurrentRequest(generation)) return;
303
+ setSelectedAccount(nextAccount);
304
+ await openDetails(nextAccount);
305
+ } catch (error2) {
306
+ if (!isCurrentRequest(generation)) return;
307
+ if (error2 instanceof ScopedRequestError && error2.status === 409 && error2.code === "VERIFICATION_REQUIRED" && !verificationResumedRef.current) {
308
+ verificationResumedRef.current = true;
309
+ try {
310
+ const verification = await startVerification();
311
+ if (!isCurrentRequest(generation)) return;
312
+ setVerifying(verification);
313
+ setLoading(false);
314
+ return;
315
+ } catch {
316
+ if (!isCurrentRequest(generation)) return;
317
+ }
318
+ }
319
+ setError(SAFE_ERROR);
320
+ onError?.(SAFE_ERROR, "BANK_ONRAMP_SETUP_FAILED");
321
+ setLoading(false);
322
+ }
323
+ },
324
+ [isCurrentRequest, onError, openDetails, service, startVerification]
325
+ );
326
+ const selectOptionRef = useLatestRef(selectOption);
327
+ useEffect(() => {
328
+ if (verifying !== "action_required" || !hostedUrl) return;
329
+ const remaining = hostedSessionRemainingMs(
330
+ verificationExpiresAt ?? void 0
331
+ );
332
+ if (remaining === null) return;
333
+ if (remaining > MAX_TIMEOUT_MS) return;
334
+ const timer = setTimeout(() => setVerificationExpired(true), remaining);
335
+ return () => clearTimeout(timer);
336
+ }, [hostedUrl, verificationExpiresAt, verifying]);
337
+ useEffect(() => {
338
+ if (verifying !== "action_required" && verifying !== "reviewing") return;
339
+ let active = true;
340
+ const timer = setInterval(() => {
341
+ void (async () => {
342
+ try {
343
+ const status = await getComplianceStatus(sessionOptions);
344
+ if (!active) return;
345
+ if (status.status === "approved") {
346
+ setHostedUrl(null);
347
+ void loadAccounts();
348
+ } else if (status.status === "declined") {
349
+ setVerifying("declined");
350
+ }
351
+ } catch {
352
+ }
353
+ })();
354
+ }, VERIFICATION_POLL_MS);
355
+ return () => {
356
+ active = false;
357
+ clearInterval(timer);
358
+ };
359
+ }, [verifying, sessionOptions, loadAccounts]);
360
+ const restartVerification = useCallback(() => {
361
+ setVerificationExpired(false);
362
+ setVerificationExpiresAt(null);
363
+ setHostedUrl(null);
364
+ void loadAccounts();
365
+ }, [loadAccounts]);
366
+ const hostedFrameMounted = Boolean(hostedUrl) && !verificationExpired;
367
+ return /* @__PURE__ */ jsx2("div", { className: "rs-screen rs-bank-onramp", children: /* @__PURE__ */ jsxs2("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
368
+ !hostedFrameMounted && /* @__PURE__ */ jsx2(
369
+ BodyHeader,
370
+ {
371
+ icon: /* @__PURE__ */ jsx2(BankIcon, {}),
372
+ title: "Bank transfer",
373
+ subtitle: "Your bank transfer details"
374
+ }
375
+ ),
376
+ loading && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", "aria-live": "polite", children: [
377
+ /* @__PURE__ */ jsx2(Spinner, {}),
378
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "Preparing bank details\u2026" })
379
+ ] }),
380
+ !loading && error && /* @__PURE__ */ jsx2("div", { className: "rs-loading-state", "aria-live": "polite", children: /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: error }) }),
381
+ !loading && !error && verifying === "declined" && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", "aria-live": "polite", children: [
382
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "Verification unsuccessful" }),
383
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-subtitle", children: "Your provider could not verify these details. Contact support to continue." })
384
+ ] }),
385
+ !loading && !error && verifying === "reviewing" && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", "aria-live": "polite", children: [
386
+ /* @__PURE__ */ jsx2(Spinner, {}),
387
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "Checking your details" }),
388
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-subtitle", children: "This usually takes a moment. You can close this and come back." })
389
+ ] }),
390
+ !loading && !error && verifying === "action_required" && externalOpened && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", "aria-live": "polite", children: [
391
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "Verification opened" }),
392
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-subtitle", children: "Finish verifying in your browser, then return here." })
393
+ ] }),
394
+ !loading && !error && verifying === "action_required" && verificationExpired && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", "aria-live": "polite", children: [
395
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "Verification expired" }),
396
+ /* @__PURE__ */ jsx2("div", { className: "rs-loading-subtitle", children: "That verification session timed out. Start a new one to pick up where you left off." }),
397
+ /* @__PURE__ */ jsx2("div", { className: "rs-screen-button-row", children: /* @__PURE__ */ jsx2(
398
+ "button",
399
+ {
400
+ type: "button",
401
+ className: "rs-button rs-button--primary",
402
+ onClick: restartVerification,
403
+ children: "Start again"
404
+ }
405
+ ) })
406
+ ] }),
407
+ !loading && !error && verifying === "action_required" && !verificationExpired && hostedUrl && /* @__PURE__ */ jsxs2("div", { className: "rs-bank-onramp-hosted", children: [
408
+ !iframeLoaded && /* @__PURE__ */ jsx2(
409
+ "div",
410
+ {
411
+ className: "rs-bank-onramp-frame-loading",
412
+ "aria-live": "polite",
413
+ children: /* @__PURE__ */ jsx2(Spinner, {})
414
+ }
415
+ ),
416
+ /* @__PURE__ */ jsx2(
417
+ "iframe",
418
+ {
419
+ title: "Verify your details",
420
+ src: hostedUrl,
421
+ sandbox: "allow-forms allow-scripts allow-same-origin",
422
+ referrerPolicy: "no-referrer",
423
+ allow: "camera; microphone; clipboard-write",
424
+ onLoad: () => setIframeLoaded(true)
425
+ }
426
+ )
427
+ ] }),
428
+ !loading && !error && !verifying && noOptions && /* @__PURE__ */ jsx2("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx2("div", { className: "rs-loading-title", children: "No bank transfer options are available." }) }),
429
+ !loading && !error && !verifying && selectedAccount && bankDetails && /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(BankDetailsView, { details: bankDetails }, selectedAccount.id) })
430
+ ] }) });
431
+ }
432
+ BankOnrampStep.displayName = "BankOnrampStep";
433
+ export {
434
+ BankOnrampStep
435
+ };