@volr/react-ui 0.1.93 → 0.1.95
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 +270 -161
- package/dist/index.cjs +914 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -4
- package/dist/index.d.ts +106 -4
- package/dist/index.js +806 -139
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React10 = require('react');
|
|
4
4
|
var reactDom = require('react-dom');
|
|
5
5
|
var react = require('@volr/react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -10,9 +10,347 @@ var qrcode_react = require('qrcode.react');
|
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var React10__default = /*#__PURE__*/_interopDefault(React10);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
+
var __esm = (fn, res) => function __init() {
|
|
17
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../node_modules/viem/_esm/constants/abis.js
|
|
21
|
+
var universalResolverErrors, erc20Abi;
|
|
22
|
+
var init_abis = __esm({
|
|
23
|
+
"../node_modules/viem/_esm/constants/abis.js"() {
|
|
24
|
+
universalResolverErrors = [
|
|
25
|
+
{
|
|
26
|
+
inputs: [
|
|
27
|
+
{
|
|
28
|
+
name: "dns",
|
|
29
|
+
type: "bytes"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
name: "DNSDecodingFailed",
|
|
33
|
+
type: "error"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
inputs: [
|
|
37
|
+
{
|
|
38
|
+
name: "ens",
|
|
39
|
+
type: "string"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
name: "DNSEncodingFailed",
|
|
43
|
+
type: "error"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
inputs: [],
|
|
47
|
+
name: "EmptyAddress",
|
|
48
|
+
type: "error"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
inputs: [
|
|
52
|
+
{
|
|
53
|
+
name: "status",
|
|
54
|
+
type: "uint16"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "message",
|
|
58
|
+
type: "string"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
name: "HttpError",
|
|
62
|
+
type: "error"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
inputs: [],
|
|
66
|
+
name: "InvalidBatchGatewayResponse",
|
|
67
|
+
type: "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
inputs: [
|
|
71
|
+
{
|
|
72
|
+
name: "errorData",
|
|
73
|
+
type: "bytes"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
name: "ResolverError",
|
|
77
|
+
type: "error"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
inputs: [
|
|
81
|
+
{
|
|
82
|
+
name: "name",
|
|
83
|
+
type: "bytes"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "resolver",
|
|
87
|
+
type: "address"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
name: "ResolverNotContract",
|
|
91
|
+
type: "error"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
inputs: [
|
|
95
|
+
{
|
|
96
|
+
name: "name",
|
|
97
|
+
type: "bytes"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
name: "ResolverNotFound",
|
|
101
|
+
type: "error"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
inputs: [
|
|
105
|
+
{
|
|
106
|
+
name: "primary",
|
|
107
|
+
type: "string"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "primaryAddress",
|
|
111
|
+
type: "bytes"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
name: "ReverseAddressMismatch",
|
|
115
|
+
type: "error"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
inputs: [
|
|
119
|
+
{
|
|
120
|
+
internalType: "bytes4",
|
|
121
|
+
name: "selector",
|
|
122
|
+
type: "bytes4"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
name: "UnsupportedResolverProfile",
|
|
126
|
+
type: "error"
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
[
|
|
130
|
+
...universalResolverErrors,
|
|
131
|
+
{
|
|
132
|
+
name: "resolveWithGateways",
|
|
133
|
+
type: "function",
|
|
134
|
+
stateMutability: "view",
|
|
135
|
+
inputs: [
|
|
136
|
+
{ name: "name", type: "bytes" },
|
|
137
|
+
{ name: "data", type: "bytes" },
|
|
138
|
+
{ name: "gateways", type: "string[]" }
|
|
139
|
+
],
|
|
140
|
+
outputs: [
|
|
141
|
+
{ name: "", type: "bytes" },
|
|
142
|
+
{ name: "address", type: "address" }
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
[
|
|
147
|
+
...universalResolverErrors,
|
|
148
|
+
{
|
|
149
|
+
name: "reverseWithGateways",
|
|
150
|
+
type: "function",
|
|
151
|
+
stateMutability: "view",
|
|
152
|
+
inputs: [
|
|
153
|
+
{ type: "bytes", name: "reverseName" },
|
|
154
|
+
{ type: "uint256", name: "coinType" },
|
|
155
|
+
{ type: "string[]", name: "gateways" }
|
|
156
|
+
],
|
|
157
|
+
outputs: [
|
|
158
|
+
{ type: "string", name: "resolvedName" },
|
|
159
|
+
{ type: "address", name: "resolver" },
|
|
160
|
+
{ type: "address", name: "reverseResolver" }
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
erc20Abi = [
|
|
165
|
+
{
|
|
166
|
+
type: "event",
|
|
167
|
+
name: "Approval",
|
|
168
|
+
inputs: [
|
|
169
|
+
{
|
|
170
|
+
indexed: true,
|
|
171
|
+
name: "owner",
|
|
172
|
+
type: "address"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
indexed: true,
|
|
176
|
+
name: "spender",
|
|
177
|
+
type: "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
indexed: false,
|
|
181
|
+
name: "value",
|
|
182
|
+
type: "uint256"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: "event",
|
|
188
|
+
name: "Transfer",
|
|
189
|
+
inputs: [
|
|
190
|
+
{
|
|
191
|
+
indexed: true,
|
|
192
|
+
name: "from",
|
|
193
|
+
type: "address"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
indexed: true,
|
|
197
|
+
name: "to",
|
|
198
|
+
type: "address"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
indexed: false,
|
|
202
|
+
name: "value",
|
|
203
|
+
type: "uint256"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: "function",
|
|
209
|
+
name: "allowance",
|
|
210
|
+
stateMutability: "view",
|
|
211
|
+
inputs: [
|
|
212
|
+
{
|
|
213
|
+
name: "owner",
|
|
214
|
+
type: "address"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "spender",
|
|
218
|
+
type: "address"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
outputs: [
|
|
222
|
+
{
|
|
223
|
+
type: "uint256"
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: "function",
|
|
229
|
+
name: "approve",
|
|
230
|
+
stateMutability: "nonpayable",
|
|
231
|
+
inputs: [
|
|
232
|
+
{
|
|
233
|
+
name: "spender",
|
|
234
|
+
type: "address"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "amount",
|
|
238
|
+
type: "uint256"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
outputs: [
|
|
242
|
+
{
|
|
243
|
+
type: "bool"
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "function",
|
|
249
|
+
name: "balanceOf",
|
|
250
|
+
stateMutability: "view",
|
|
251
|
+
inputs: [
|
|
252
|
+
{
|
|
253
|
+
name: "account",
|
|
254
|
+
type: "address"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
outputs: [
|
|
258
|
+
{
|
|
259
|
+
type: "uint256"
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
type: "function",
|
|
265
|
+
name: "decimals",
|
|
266
|
+
stateMutability: "view",
|
|
267
|
+
inputs: [],
|
|
268
|
+
outputs: [
|
|
269
|
+
{
|
|
270
|
+
type: "uint8"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
type: "function",
|
|
276
|
+
name: "name",
|
|
277
|
+
stateMutability: "view",
|
|
278
|
+
inputs: [],
|
|
279
|
+
outputs: [
|
|
280
|
+
{
|
|
281
|
+
type: "string"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: "function",
|
|
287
|
+
name: "symbol",
|
|
288
|
+
stateMutability: "view",
|
|
289
|
+
inputs: [],
|
|
290
|
+
outputs: [
|
|
291
|
+
{
|
|
292
|
+
type: "string"
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: "function",
|
|
298
|
+
name: "totalSupply",
|
|
299
|
+
stateMutability: "view",
|
|
300
|
+
inputs: [],
|
|
301
|
+
outputs: [
|
|
302
|
+
{
|
|
303
|
+
type: "uint256"
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: "function",
|
|
309
|
+
name: "transfer",
|
|
310
|
+
stateMutability: "nonpayable",
|
|
311
|
+
inputs: [
|
|
312
|
+
{
|
|
313
|
+
name: "recipient",
|
|
314
|
+
type: "address"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "amount",
|
|
318
|
+
type: "uint256"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
outputs: [
|
|
322
|
+
{
|
|
323
|
+
type: "bool"
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
type: "function",
|
|
329
|
+
name: "transferFrom",
|
|
330
|
+
stateMutability: "nonpayable",
|
|
331
|
+
inputs: [
|
|
332
|
+
{
|
|
333
|
+
name: "sender",
|
|
334
|
+
type: "address"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "recipient",
|
|
338
|
+
type: "address"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "amount",
|
|
342
|
+
type: "uint256"
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
outputs: [
|
|
346
|
+
{
|
|
347
|
+
type: "bool"
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
];
|
|
352
|
+
}
|
|
353
|
+
});
|
|
16
354
|
|
|
17
355
|
// src/i18n/locales/en.ts
|
|
18
356
|
var en = {
|
|
@@ -266,13 +604,13 @@ var translations = {
|
|
|
266
604
|
function getTranslations(locale = "en") {
|
|
267
605
|
return translations[locale] || translations.en;
|
|
268
606
|
}
|
|
269
|
-
var I18nContext =
|
|
607
|
+
var I18nContext = React10.createContext(null);
|
|
270
608
|
function interpolate(text, params) {
|
|
271
609
|
if (!params) return text;
|
|
272
610
|
return text.replace(/\{\{(\w+)\}\}/g, (_, key) => params[key] ?? `{{${key}}}`);
|
|
273
611
|
}
|
|
274
612
|
function useI18n() {
|
|
275
|
-
const context =
|
|
613
|
+
const context = React10.useContext(I18nContext);
|
|
276
614
|
if (!context) {
|
|
277
615
|
return {
|
|
278
616
|
locale: "en",
|
|
@@ -307,9 +645,9 @@ function detectLocale() {
|
|
|
307
645
|
return lang.startsWith("ko") ? "ko" : "en";
|
|
308
646
|
}
|
|
309
647
|
function I18nProvider({ children }) {
|
|
310
|
-
const [locale, setLocale] =
|
|
311
|
-
const translations2 =
|
|
312
|
-
const t =
|
|
648
|
+
const [locale, setLocale] = React10.useState(detectLocale());
|
|
649
|
+
const translations2 = React10.useMemo(() => getTranslations(locale), [locale]);
|
|
650
|
+
const t = React10.useMemo(() => {
|
|
313
651
|
return (key, params) => {
|
|
314
652
|
const keys = key.split(".");
|
|
315
653
|
let value2 = translations2;
|
|
@@ -326,7 +664,7 @@ function I18nProvider({ children }) {
|
|
|
326
664
|
return typeof value2 === "string" ? interpolate(value2, params) : key;
|
|
327
665
|
};
|
|
328
666
|
}, [translations2]);
|
|
329
|
-
const value =
|
|
667
|
+
const value = React10.useMemo(
|
|
330
668
|
() => ({
|
|
331
669
|
locale,
|
|
332
670
|
translations: translations2,
|
|
@@ -338,9 +676,9 @@ function I18nProvider({ children }) {
|
|
|
338
676
|
return /* @__PURE__ */ jsxRuntime.jsx(I18nContext.Provider, { value, children });
|
|
339
677
|
}
|
|
340
678
|
var useTranslation = useI18n;
|
|
341
|
-
var VolrModalContext =
|
|
679
|
+
var VolrModalContext = React10.createContext(null);
|
|
342
680
|
var useVolrModal = () => {
|
|
343
|
-
const context =
|
|
681
|
+
const context = React10.useContext(VolrModalContext);
|
|
344
682
|
if (!context) {
|
|
345
683
|
throw new Error("useVolrModal must be used within VolrUIProvider");
|
|
346
684
|
}
|
|
@@ -349,17 +687,17 @@ var useVolrModal = () => {
|
|
|
349
687
|
var VolrModalProvider = ({
|
|
350
688
|
children
|
|
351
689
|
}) => {
|
|
352
|
-
const [isOpen, setIsOpen] =
|
|
353
|
-
const [mode, setMode] =
|
|
354
|
-
const [asset, setAsset] =
|
|
355
|
-
const [paymentOptions, setPaymentOptions] =
|
|
356
|
-
const open =
|
|
690
|
+
const [isOpen, setIsOpen] = React10.useState(false);
|
|
691
|
+
const [mode, setMode] = React10.useState("account");
|
|
692
|
+
const [asset, setAsset] = React10.useState(null);
|
|
693
|
+
const [paymentOptions, setPaymentOptions] = React10.useState(null);
|
|
694
|
+
const open = React10.useCallback((options) => {
|
|
357
695
|
setMode(options?.mode ?? "account");
|
|
358
696
|
setAsset(options?.asset ?? null);
|
|
359
697
|
setPaymentOptions(options?.payment ?? null);
|
|
360
698
|
setIsOpen(true);
|
|
361
699
|
}, []);
|
|
362
|
-
const close =
|
|
700
|
+
const close = React10.useCallback(() => {
|
|
363
701
|
setIsOpen(false);
|
|
364
702
|
setAsset(null);
|
|
365
703
|
setPaymentOptions(null);
|
|
@@ -373,11 +711,11 @@ function cn(...inputs) {
|
|
|
373
711
|
return twMerge(clsx.clsx(inputs));
|
|
374
712
|
}
|
|
375
713
|
function useMediaQuery(query) {
|
|
376
|
-
const [matches, setMatches] =
|
|
714
|
+
const [matches, setMatches] = React10.useState(() => {
|
|
377
715
|
if (typeof window === "undefined") return false;
|
|
378
716
|
return window.matchMedia(query).matches;
|
|
379
717
|
});
|
|
380
|
-
|
|
718
|
+
React10.useEffect(() => {
|
|
381
719
|
if (typeof window === "undefined") return;
|
|
382
720
|
const mql = window.matchMedia(query);
|
|
383
721
|
const handler = (event) => setMatches(event.matches);
|
|
@@ -391,12 +729,12 @@ function useMediaQuery(query) {
|
|
|
391
729
|
// src/generated/volr-sdk-css.ts
|
|
392
730
|
var VOLR_SDK_CSS = '/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--volr-tw-translate-x:0;--volr-tw-translate-y:0;--volr-tw-translate-z:0;--volr-tw-space-y-reverse:0;--volr-tw-border-style:solid;--volr-tw-gradient-position:initial;--volr-tw-gradient-from:#0000;--volr-tw-gradient-via:#0000;--volr-tw-gradient-to:#0000;--volr-tw-gradient-stops:initial;--volr-tw-gradient-via-stops:initial;--volr-tw-gradient-from-position:0%;--volr-tw-gradient-via-position:50%;--volr-tw-gradient-to-position:100%;--volr-tw-leading:initial;--volr-tw-font-weight:initial;--volr-tw-shadow:0 0 #0000;--volr-tw-shadow-color:initial;--volr-tw-shadow-alpha:100%;--volr-tw-inset-shadow:0 0 #0000;--volr-tw-inset-shadow-color:initial;--volr-tw-inset-shadow-alpha:100%;--volr-tw-ring-color:initial;--volr-tw-ring-shadow:0 0 #0000;--volr-tw-inset-ring-color:initial;--volr-tw-inset-ring-shadow:0 0 #0000;--volr-tw-ring-inset:initial;--volr-tw-ring-offset-width:0px;--volr-tw-ring-offset-color:#fff;--volr-tw-ring-offset-shadow:0 0 #0000;--volr-tw-blur:initial;--volr-tw-brightness:initial;--volr-tw-contrast:initial;--volr-tw-grayscale:initial;--volr-tw-hue-rotate:initial;--volr-tw-invert:initial;--volr-tw-opacity:initial;--volr-tw-saturate:initial;--volr-tw-sepia:initial;--volr-tw-drop-shadow:initial;--volr-tw-drop-shadow-color:initial;--volr-tw-drop-shadow-alpha:100%;--volr-tw-drop-shadow-size:initial;--volr-tw-duration:initial;--volr-tw-ease:initial}}}@layer theme{:root,:host{--volr-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--volr-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--volr-color-red-50:oklch(97.1% .013 17.38);--volr-color-red-100:oklch(93.6% .032 17.717);--volr-color-red-200:oklch(88.5% .062 18.334);--volr-color-red-500:oklch(63.7% .237 25.331);--volr-color-red-600:oklch(57.7% .245 27.325);--volr-color-red-700:oklch(50.5% .213 27.518);--volr-color-green-100:oklch(96.2% .044 156.743);--volr-color-green-600:oklch(62.7% .194 149.214);--volr-color-emerald-300:oklch(84.5% .143 164.978);--volr-color-emerald-400:oklch(76.5% .177 163.223);--volr-color-emerald-500:oklch(69.6% .17 162.48);--volr-color-emerald-600:oklch(59.6% .145 163.225);--volr-color-teal-400:oklch(77.7% .152 181.912);--volr-color-teal-500:oklch(70.4% .14 182.503);--volr-color-cyan-400:oklch(78.9% .154 211.53);--volr-color-slate-50:oklch(98.4% .003 247.858);--volr-color-slate-100:oklch(96.8% .007 247.896);--volr-color-slate-200:oklch(92.9% .013 255.508);--volr-color-slate-300:oklch(86.9% .022 252.894);--volr-color-slate-400:oklch(70.4% .04 256.788);--volr-color-slate-500:oklch(55.4% .046 257.417);--volr-color-slate-600:oklch(44.6% .043 257.281);--volr-color-slate-900:oklch(20.8% .042 265.755);--volr-color-gray-500:oklch(55.1% .027 264.364);--volr-color-black:#000;--volr-color-white:#fff;--volr-spacing:.25rem;--volr-container-md:28rem;--volr-container-4xl:56rem;--volr-text-xs:.75rem;--volr-text-xs--line-height:calc(1/.75);--volr-text-sm:.875rem;--volr-text-sm--line-height:calc(1.25/.875);--volr-text-base:1rem;--volr-text-base--line-height:calc(1.5/1);--volr-text-lg:1.125rem;--volr-text-lg--line-height:calc(1.75/1.125);--volr-text-xl:1.25rem;--volr-text-xl--line-height:calc(1.75/1.25);--volr-text-2xl:1.5rem;--volr-text-2xl--line-height:calc(2/1.5);--volr-text-8xl:6rem;--volr-text-8xl--line-height:1;--volr-font-weight-medium:500;--volr-font-weight-semibold:600;--volr-font-weight-bold:700;--volr-leading-relaxed:1.625;--volr-radius-md:.375rem;--volr-radius-lg:.5rem;--volr-radius-xl:.75rem;--volr-radius-2xl:1rem;--volr-radius-3xl:1.5rem;--volr-ease-out:cubic-bezier(0,0,.2,1);--volr-animate-spin:spin 1s linear infinite;--volr-animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--volr-blur-2xl:40px;--volr-default-transition-duration:.15s;--volr-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--volr-default-font-family:var(--volr-font-sans);--volr-default-mono-font-family:var(--volr-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--volr-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--volr-default-font-feature-settings,normal);font-variation-settings:var(--volr-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--volr-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--volr-default-mono-font-feature-settings,normal);font-variation-settings:var(--volr-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:host{--volr-primary-color:var(--volr-accent-color,#303030);--volr-font-family:var(--volr-custom-font,inherit);--volr-bg:#fff;--volr-bg-secondary:#f8fafc;--volr-bg-tertiary:#f1f5f9;--volr-text:#0f172a;--volr-text-secondary:#475569;--volr-text-muted:#94a3b8;--volr-border:#e2e8f0;--volr-border-strong:#cbd5e1;--volr-hover-bg:#f8fafc;--volr-error-bg:#fef2f2;--volr-error-border:#fecaca;--volr-error-text:#991b1b}:host([data-theme=dark]){--volr-bg:#1c1c1e;--volr-bg-secondary:#2c2c2e;--volr-bg-tertiary:#3a3a3c;--volr-text:#f5f5f7;--volr-text-secondary:#c7c7cc;--volr-text-muted:#8e8e93;--volr-border:#3a3a3c;--volr-border-strong:#48484a;--volr-hover-bg:#2c2c2e;--volr-error-bg:#3c1f1f;--volr-error-border:#7f1d1d;--volr-error-text:#fca5a5}*,:before,:after{box-sizing:border-box}*{font-family:var(--volr-font-family);color:var(--volr-text)}button,input,select,textarea{color:var(--volr-text);background-color:#0000}button{cursor:pointer;background-color:#0000}input::placeholder{color:var(--volr-text-muted)}h1,h2,h3{color:var(--volr-text);margin:0;font-weight:700}h1{font-size:1.875rem;line-height:2.25rem}h2{font-size:1.5rem;line-height:2rem}h3{font-size:1.25rem;line-height:1.75rem}p{margin:0}}@layer components{.volr-dialog-overlay{inset:calc(var(--volr-spacing)*0);z-index:40;background-color:var(--volr-color-black);position:fixed}@supports (color:color-mix(in lab, red, red)){.volr-dialog-overlay{background-color:color-mix(in oklab,var(--volr-color-black)45%,transparent)}}.volr-dialog-content{z-index:50;border-radius:var(--volr-radius-2xl);border-style:var(--volr-tw-border-style);padding:calc(var(--volr-spacing)*7);--volr-tw-shadow:0 20px 25px -5px var(--volr-tw-shadow-color,#0000001a),0 8px 10px -6px var(--volr-tw-shadow-color,#0000001a);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow);background-color:var(--volr-bg);border-width:1px;border-color:var(--volr-border-strong);width:calc(100% - 2rem);max-width:28rem;max-height:85vh;position:fixed;top:50%;left:50%;overflow-y:auto;transform:translate(-50%,-50%)}@media (max-width:640px){.volr-dialog-content{top:auto;right:calc(var(--volr-spacing)*0);bottom:calc(var(--volr-spacing)*0);left:calc(var(--volr-spacing)*0);border-radius:1.25rem 1.25rem 0 0;width:100%;max-width:100%;margin:0 auto;transform:translateY(0)}}.volr-dialog-close{top:calc(var(--volr-spacing)*4);right:calc(var(--volr-spacing)*4);height:calc(var(--volr-spacing)*8);width:calc(var(--volr-spacing)*8);color:var(--volr-text-muted);cursor:pointer;background-color:#0000;border:none;border-radius:3.40282e38px;justify-content:center;align-items:center;display:inline-flex;position:absolute}.volr-dialog-close:hover{background-color:var(--volr-hover-bg);color:var(--volr-text-secondary)}.volr-dialog-close:focus-visible{box-shadow:0 0 0 2px var(--volr-border-strong);outline:none}.volr-dialog-close-icon{height:calc(var(--volr-spacing)*4);width:calc(var(--volr-spacing)*4)}.volr-email-input{border:1px solid var(--volr-border-strong);background-color:var(--volr-bg);width:100%;color:var(--volr-text);border-radius:.5rem;outline:none;padding:.75rem .75rem .75rem 2.75rem;font-size:1rem;line-height:1.5}.volr-email-input::placeholder{color:var(--volr-text-muted)}.volr-email-input:focus{border-color:var(--volr-border-strong);box-shadow:0 0 0 2px var(--volr-border-strong)}.volr-option-button{border:1px solid var(--volr-border);background-color:var(--volr-bg);width:100%;color:var(--volr-text);cursor:pointer;border-radius:.5rem;align-items:center;gap:.75rem;padding:.75rem;transition:background-color .15s ease-out,border-color .15s ease-out,box-shadow .15s ease-out;display:flex}.volr-option-button:hover{background-color:var(--volr-hover-bg);border-color:var(--volr-border)}.volr-option-button:focus-visible{box-shadow:0 0 0 2px var(--volr-border-strong);outline:none}}@layer utilities{.volr\\:pointer-events-auto{pointer-events:auto}.volr\\:pointer-events-none{pointer-events:none}.volr\\:sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.volr\\:absolute{position:absolute}.volr\\:fixed{position:fixed}.volr\\:relative{position:relative}.volr\\:inset-0{inset:calc(var(--volr-spacing)*0)}.volr\\:-top-3{top:calc(var(--volr-spacing)*-3)}.volr\\:top-1\\/2{top:50%}.volr\\:-right-3{right:calc(var(--volr-spacing)*-3)}.volr\\:-right-4{right:calc(var(--volr-spacing)*-4)}.volr\\:right-2{right:calc(var(--volr-spacing)*2)}.volr\\:bottom-0{bottom:calc(var(--volr-spacing)*0)}.volr\\:-left-4{left:calc(var(--volr-spacing)*-4)}.volr\\:left-3{left:calc(var(--volr-spacing)*3)}.volr\\:-z-10{z-index:calc(10*-1)}.volr\\:z-10{z-index:10}.volr\\:z-20{z-index:20}.volr\\:z-40{z-index:40}.volr\\:z-50{z-index:50}.volr\\:mx-auto{margin-inline:auto}.volr\\:my-6{margin-block:calc(var(--volr-spacing)*6)}.volr\\:mt-0\\.5{margin-top:calc(var(--volr-spacing)*.5)}.volr\\:mt-1{margin-top:calc(var(--volr-spacing)*1)}.volr\\:mt-2{margin-top:calc(var(--volr-spacing)*2)}.volr\\:mt-3{margin-top:calc(var(--volr-spacing)*3)}.volr\\:mt-4{margin-top:calc(var(--volr-spacing)*4)}.volr\\:mt-6{margin-top:calc(var(--volr-spacing)*6)}.volr\\:mt-8{margin-top:calc(var(--volr-spacing)*8)}.volr\\:mb-1{margin-bottom:calc(var(--volr-spacing)*1)}.volr\\:mb-2{margin-bottom:calc(var(--volr-spacing)*2)}.volr\\:mb-3{margin-bottom:calc(var(--volr-spacing)*3)}.volr\\:mb-4{margin-bottom:calc(var(--volr-spacing)*4)}.volr\\:mb-5{margin-bottom:calc(var(--volr-spacing)*5)}.volr\\:mb-6{margin-bottom:calc(var(--volr-spacing)*6)}.volr\\:mb-8{margin-bottom:calc(var(--volr-spacing)*8)}.volr\\:-ml-2{margin-left:calc(var(--volr-spacing)*-2)}.volr\\:line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.volr\\:flex{display:flex}.volr\\:grid{display:grid}.volr\\:inline-block{display:inline-block}.volr\\:inline-flex{display:inline-flex}.volr\\:h-1{height:calc(var(--volr-spacing)*1)}.volr\\:h-1\\.5{height:calc(var(--volr-spacing)*1.5)}.volr\\:h-2{height:calc(var(--volr-spacing)*2)}.volr\\:h-3{height:calc(var(--volr-spacing)*3)}.volr\\:h-3\\.5{height:calc(var(--volr-spacing)*3.5)}.volr\\:h-4{height:calc(var(--volr-spacing)*4)}.volr\\:h-5{height:calc(var(--volr-spacing)*5)}.volr\\:h-6{height:calc(var(--volr-spacing)*6)}.volr\\:h-7{height:calc(var(--volr-spacing)*7)}.volr\\:h-8{height:calc(var(--volr-spacing)*8)}.volr\\:h-10{height:calc(var(--volr-spacing)*10)}.volr\\:h-12{height:calc(var(--volr-spacing)*12)}.volr\\:h-14{height:calc(var(--volr-spacing)*14)}.volr\\:h-16{height:calc(var(--volr-spacing)*16)}.volr\\:h-24{height:calc(var(--volr-spacing)*24)}.volr\\:h-40{height:calc(var(--volr-spacing)*40)}.volr\\:h-44{height:calc(var(--volr-spacing)*44)}.volr\\:h-48{height:calc(var(--volr-spacing)*48)}.volr\\:h-\\[0\\.8em\\]{height:.8em}.volr\\:h-\\[200px\\]{height:200px}.volr\\:h-full{height:100%}.volr\\:h-px{height:1px}.volr\\:max-h-36{max-height:calc(var(--volr-spacing)*36)}.volr\\:max-h-96{max-height:calc(var(--volr-spacing)*96)}.volr\\:max-h-\\[85vh\\]{max-height:85vh}.volr\\:max-h-\\[90vh\\]{max-height:90vh}.volr\\:min-h-\\[120px\\]{min-height:120px}.volr\\:min-h-\\[500px\\]{min-height:500px}.volr\\:w-1\\.5{width:calc(var(--volr-spacing)*1.5)}.volr\\:w-2{width:calc(var(--volr-spacing)*2)}.volr\\:w-3\\.5{width:calc(var(--volr-spacing)*3.5)}.volr\\:w-4{width:calc(var(--volr-spacing)*4)}.volr\\:w-5{width:calc(var(--volr-spacing)*5)}.volr\\:w-6{width:calc(var(--volr-spacing)*6)}.volr\\:w-8{width:calc(var(--volr-spacing)*8)}.volr\\:w-10{width:calc(var(--volr-spacing)*10)}.volr\\:w-12{width:calc(var(--volr-spacing)*12)}.volr\\:w-16{width:calc(var(--volr-spacing)*16)}.volr\\:w-20{width:calc(var(--volr-spacing)*20)}.volr\\:w-24{width:calc(var(--volr-spacing)*24)}.volr\\:w-32{width:calc(var(--volr-spacing)*32)}.volr\\:w-36{width:calc(var(--volr-spacing)*36)}.volr\\:w-40{width:calc(var(--volr-spacing)*40)}.volr\\:w-44{width:calc(var(--volr-spacing)*44)}.volr\\:w-48{width:calc(var(--volr-spacing)*48)}.volr\\:w-\\[200px\\]{width:200px}.volr\\:w-auto{width:auto}.volr\\:w-full{width:100%}.volr\\:max-w-4xl{max-width:var(--volr-container-4xl)}.volr\\:max-w-full{max-width:100%}.volr\\:max-w-md{max-width:var(--volr-container-md)}.volr\\:max-w-none{max-width:none}.volr\\:min-w-0{min-width:calc(var(--volr-spacing)*0)}.volr\\:flex-1{flex:1}.volr\\:flex-shrink-0,.volr\\:shrink-0{flex-shrink:0}.volr\\:-translate-y-1\\/2{--volr-tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--volr-tw-translate-x)var(--volr-tw-translate-y)}.volr\\:animate-\\[volrFadeIn_0\\.2s_ease-out\\]{animation:.2s ease-out volrFadeIn}.volr\\:animate-pulse{animation:var(--volr-animate-pulse)}.volr\\:animate-spin{animation:var(--volr-animate-spin)}.volr\\:list-inside{list-style-position:inside}.volr\\:list-decimal{list-style-type:decimal}.volr\\:grid-cols-\\[minmax\\(0\\,1\\.1fr\\)_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}.volr\\:flex-col{flex-direction:column}.volr\\:items-baseline{align-items:baseline}.volr\\:items-center{align-items:center}.volr\\:items-end{align-items:flex-end}.volr\\:items-start{align-items:flex-start}.volr\\:justify-between{justify-content:space-between}.volr\\:justify-center{justify-content:center}.volr\\:gap-1{gap:calc(var(--volr-spacing)*1)}.volr\\:gap-1\\.5{gap:calc(var(--volr-spacing)*1.5)}.volr\\:gap-2{gap:calc(var(--volr-spacing)*2)}.volr\\:gap-3{gap:calc(var(--volr-spacing)*3)}.volr\\:gap-4{gap:calc(var(--volr-spacing)*4)}:where(.volr\\:space-y-1>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*1)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*1)*calc(1 - var(--volr-tw-space-y-reverse)))}:where(.volr\\:space-y-2>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*2)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*2)*calc(1 - var(--volr-tw-space-y-reverse)))}:where(.volr\\:space-y-3>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*3)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*3)*calc(1 - var(--volr-tw-space-y-reverse)))}:where(.volr\\:space-y-4>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*4)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*4)*calc(1 - var(--volr-tw-space-y-reverse)))}:where(.volr\\:space-y-6>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*6)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*6)*calc(1 - var(--volr-tw-space-y-reverse)))}:where(.volr\\:space-y-8>:not(:last-child)){--volr-tw-space-y-reverse:0;margin-block-start:calc(calc(var(--volr-spacing)*8)*var(--volr-tw-space-y-reverse));margin-block-end:calc(calc(var(--volr-spacing)*8)*calc(1 - var(--volr-tw-space-y-reverse)))}.volr\\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.volr\\:overflow-hidden{overflow:hidden}.volr\\:overflow-visible{overflow:visible}.volr\\:overflow-y-auto{overflow-y:auto}.volr\\:rounded{border-radius:.25rem}.volr\\:rounded-2xl{border-radius:var(--volr-radius-2xl)}.volr\\:rounded-full{border-radius:3.40282e38px}.volr\\:rounded-lg{border-radius:var(--volr-radius-lg)}.volr\\:rounded-md{border-radius:var(--volr-radius-md)}.volr\\:rounded-xl{border-radius:var(--volr-radius-xl)}.volr\\:rounded-t-2xl{border-top-left-radius:var(--volr-radius-2xl);border-top-right-radius:var(--volr-radius-2xl)}.volr\\:rounded-t-3xl{border-top-left-radius:var(--volr-radius-3xl);border-top-right-radius:var(--volr-radius-3xl)}.volr\\:border{border-style:var(--volr-tw-border-style);border-width:1px}.volr\\:border-2{border-style:var(--volr-tw-border-style);border-width:2px}.volr\\:border-4{border-style:var(--volr-tw-border-style);border-width:4px}.volr\\:border-t{border-top-style:var(--volr-tw-border-style);border-top-width:1px}.volr\\:border-t-2{border-top-style:var(--volr-tw-border-style);border-top-width:2px}.volr\\:border-red-200{border-color:var(--volr-color-red-200)}.volr\\:border-slate-200{border-color:var(--volr-color-slate-200)}.volr\\:border-slate-300{border-color:var(--volr-color-slate-300)}.volr\\:border-white{border-color:var(--volr-color-white)}.volr\\:border-t-slate-600{border-top-color:var(--volr-color-slate-600)}.volr\\:bg-black\\/45{background-color:var(--volr-color-black)}@supports (color:color-mix(in lab, red, red)){.volr\\:bg-black\\/45{background-color:color-mix(in oklab,var(--volr-color-black)45%,transparent)}}.volr\\:bg-cyan-400{background-color:var(--volr-color-cyan-400)}.volr\\:bg-emerald-300{background-color:var(--volr-color-emerald-300)}.volr\\:bg-emerald-400{background-color:var(--volr-color-emerald-400)}.volr\\:bg-green-100{background-color:var(--volr-color-green-100)}.volr\\:bg-red-50{background-color:var(--volr-color-red-50)}.volr\\:bg-red-100{background-color:var(--volr-color-red-100)}.volr\\:bg-slate-50{background-color:var(--volr-color-slate-50)}.volr\\:bg-slate-100{background-color:var(--volr-color-slate-100)}.volr\\:bg-slate-200{background-color:var(--volr-color-slate-200)}.volr\\:bg-slate-300{background-color:var(--volr-color-slate-300)}.volr\\:bg-slate-900{background-color:var(--volr-color-slate-900)}.volr\\:bg-teal-400{background-color:var(--volr-color-teal-400)}.volr\\:bg-white{background-color:var(--volr-color-white)}.volr\\:bg-linear-to-br{--volr-tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab, red, red)){.volr\\:bg-linear-to-br{--volr-tw-gradient-position:to bottom right in oklab}}.volr\\:bg-linear-to-br{background-image:linear-gradient(var(--volr-tw-gradient-stops))}.volr\\:from-emerald-400{--volr-tw-gradient-from:var(--volr-color-emerald-400);--volr-tw-gradient-stops:var(--volr-tw-gradient-via-stops,var(--volr-tw-gradient-position),var(--volr-tw-gradient-from)var(--volr-tw-gradient-from-position),var(--volr-tw-gradient-to)var(--volr-tw-gradient-to-position))}.volr\\:from-emerald-500{--volr-tw-gradient-from:var(--volr-color-emerald-500);--volr-tw-gradient-stops:var(--volr-tw-gradient-via-stops,var(--volr-tw-gradient-position),var(--volr-tw-gradient-from)var(--volr-tw-gradient-from-position),var(--volr-tw-gradient-to)var(--volr-tw-gradient-to-position))}.volr\\:to-teal-500{--volr-tw-gradient-to:var(--volr-color-teal-500);--volr-tw-gradient-stops:var(--volr-tw-gradient-via-stops,var(--volr-tw-gradient-position),var(--volr-tw-gradient-from)var(--volr-tw-gradient-from-position),var(--volr-tw-gradient-to)var(--volr-tw-gradient-to-position))}.volr\\:object-cover{object-fit:cover}.volr\\:p-1{padding:calc(var(--volr-spacing)*1)}.volr\\:p-2{padding:calc(var(--volr-spacing)*2)}.volr\\:p-3{padding:calc(var(--volr-spacing)*3)}.volr\\:p-4{padding:calc(var(--volr-spacing)*4)}.volr\\:p-5{padding:calc(var(--volr-spacing)*5)}.volr\\:p-6{padding:calc(var(--volr-spacing)*6)}.volr\\:p-8{padding:calc(var(--volr-spacing)*8)}.volr\\:px-2{padding-inline:calc(var(--volr-spacing)*2)}.volr\\:px-3{padding-inline:calc(var(--volr-spacing)*3)}.volr\\:px-4{padding-inline:calc(var(--volr-spacing)*4)}.volr\\:py-0\\.5{padding-block:calc(var(--volr-spacing)*.5)}.volr\\:py-1\\.5{padding-block:calc(var(--volr-spacing)*1.5)}.volr\\:py-2{padding-block:calc(var(--volr-spacing)*2)}.volr\\:py-2\\.5{padding-block:calc(var(--volr-spacing)*2.5)}.volr\\:py-3{padding-block:calc(var(--volr-spacing)*3)}.volr\\:py-4{padding-block:calc(var(--volr-spacing)*4)}.volr\\:py-6{padding-block:calc(var(--volr-spacing)*6)}.volr\\:py-8{padding-block:calc(var(--volr-spacing)*8)}.volr\\:py-12{padding-block:calc(var(--volr-spacing)*12)}.volr\\:pt-2{padding-top:calc(var(--volr-spacing)*2)}.volr\\:pt-3{padding-top:calc(var(--volr-spacing)*3)}.volr\\:pt-4{padding-top:calc(var(--volr-spacing)*4)}.volr\\:pr-3{padding-right:calc(var(--volr-spacing)*3)}.volr\\:pb-2{padding-bottom:calc(var(--volr-spacing)*2)}.volr\\:pb-4{padding-bottom:calc(var(--volr-spacing)*4)}.volr\\:pl-11{padding-left:calc(var(--volr-spacing)*11)}.volr\\:text-center{text-align:center}.volr\\:text-left{text-align:left}.volr\\:text-right{text-align:right}.volr\\:align-baseline{vertical-align:baseline}.volr\\:font-mono{font-family:var(--volr-font-mono)}.volr\\:text-2xl{font-size:var(--volr-text-2xl);line-height:var(--volr-tw-leading,var(--volr-text-2xl--line-height))}.volr\\:text-8xl{font-size:var(--volr-text-8xl);line-height:var(--volr-tw-leading,var(--volr-text-8xl--line-height))}.volr\\:text-base{font-size:var(--volr-text-base);line-height:var(--volr-tw-leading,var(--volr-text-base--line-height))}.volr\\:text-lg{font-size:var(--volr-text-lg);line-height:var(--volr-tw-leading,var(--volr-text-lg--line-height))}.volr\\:text-sm{font-size:var(--volr-text-sm);line-height:var(--volr-tw-leading,var(--volr-text-sm--line-height))}.volr\\:text-xl{font-size:var(--volr-text-xl);line-height:var(--volr-tw-leading,var(--volr-text-xl--line-height))}.volr\\:text-xs{font-size:var(--volr-text-xs);line-height:var(--volr-tw-leading,var(--volr-text-xs--line-height))}.volr\\:leading-relaxed{--volr-tw-leading:var(--volr-leading-relaxed);line-height:var(--volr-leading-relaxed)}.volr\\:font-bold{--volr-tw-font-weight:var(--volr-font-weight-bold);font-weight:var(--volr-font-weight-bold)}.volr\\:font-medium{--volr-tw-font-weight:var(--volr-font-weight-medium);font-weight:var(--volr-font-weight-medium)}.volr\\:font-semibold{--volr-tw-font-weight:var(--volr-font-weight-semibold);font-weight:var(--volr-font-weight-semibold)}.volr\\:break-all{word-break:break-all}.volr\\:text-emerald-600{color:var(--volr-color-emerald-600)}.volr\\:text-gray-500{color:var(--volr-color-gray-500)}.volr\\:text-green-600{color:var(--volr-color-green-600)}.volr\\:text-red-500{color:var(--volr-color-red-500)}.volr\\:text-red-600{color:var(--volr-color-red-600)}.volr\\:text-red-700{color:var(--volr-color-red-700)}.volr\\:text-slate-400{color:var(--volr-color-slate-400)}.volr\\:text-slate-500{color:var(--volr-color-slate-500)}.volr\\:text-slate-600{color:var(--volr-color-slate-600)}.volr\\:text-slate-900{color:var(--volr-color-slate-900)}.volr\\:text-white{color:var(--volr-color-white)}.volr\\:capitalize{text-transform:capitalize}.volr\\:underline{text-decoration-line:underline}.volr\\:opacity-0{opacity:0}.volr\\:opacity-25{opacity:.25}.volr\\:opacity-30{opacity:.3}.volr\\:opacity-75{opacity:.75}.volr\\:shadow-2xl{--volr-tw-shadow:0 25px 50px -12px var(--volr-tw-shadow-color,#00000040);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-\\[0_-8px_30px_rgba\\(0\\,0\\,0\\,0\\.2\\)\\]{--volr-tw-shadow:0 -8px 30px var(--volr-tw-shadow-color,#0003);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-lg{--volr-tw-shadow:0 10px 15px -3px var(--volr-tw-shadow-color,#0000001a),0 4px 6px -4px var(--volr-tw-shadow-color,#0000001a);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-md{--volr-tw-shadow:0 4px 6px -1px var(--volr-tw-shadow-color,#0000001a),0 2px 4px -2px var(--volr-tw-shadow-color,#0000001a);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-sm{--volr-tw-shadow:0 1px 3px 0 var(--volr-tw-shadow-color,#0000001a),0 1px 2px -1px var(--volr-tw-shadow-color,#0000001a);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-xl{--volr-tw-shadow:0 20px 25px -5px var(--volr-tw-shadow-color,#0000001a),0 8px 10px -6px var(--volr-tw-shadow-color,#0000001a);box-shadow:var(--volr-tw-inset-shadow),var(--volr-tw-inset-ring-shadow),var(--volr-tw-ring-offset-shadow),var(--volr-tw-ring-shadow),var(--volr-tw-shadow)}.volr\\:shadow-emerald-500\\/50{--volr-tw-shadow-color:var(--volr-color-emerald-500)}@supports (color:color-mix(in lab, red, red)){.volr\\:shadow-emerald-500\\/50{--volr-tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--volr-color-emerald-500)50%,transparent)var(--volr-tw-shadow-alpha),transparent)}}.volr\\:blur-2xl{--volr-tw-blur:blur(var(--volr-blur-2xl));filter:var(--volr-tw-blur,)var(--volr-tw-brightness,)var(--volr-tw-contrast,)var(--volr-tw-grayscale,)var(--volr-tw-hue-rotate,)var(--volr-tw-invert,)var(--volr-tw-saturate,)var(--volr-tw-sepia,)var(--volr-tw-drop-shadow,)}.volr\\:transition-all{transition-property:all;transition-timing-function:var(--volr-tw-ease,var(--volr-default-transition-timing-function));transition-duration:var(--volr-tw-duration,var(--volr-default-transition-duration))}.volr\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--volr-tw-gradient-from,--volr-tw-gradient-via,--volr-tw-gradient-to;transition-timing-function:var(--volr-tw-ease,var(--volr-default-transition-timing-function));transition-duration:var(--volr-tw-duration,var(--volr-default-transition-duration))}.volr\\:duration-300{--volr-tw-duration:.3s;transition-duration:.3s}.volr\\:duration-500{--volr-tw-duration:.5s;transition-duration:.5s}.volr\\:ease-out{--volr-tw-ease:var(--volr-ease-out);transition-timing-function:var(--volr-ease-out)}.volr\\:outline-none{--volr-tw-outline-style:none;outline-style:none}@media (hover:hover){.volr\\:hover\\:bg-slate-50:hover{background-color:var(--volr-color-slate-50)}}.volr\\:disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.volr\\:disabled\\:opacity-50:disabled{opacity:.5}.volr-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.volr-text-secondary{color:var(--volr-text-secondary)}.volr-text-muted{color:var(--volr-text-muted)}.volr-bg-secondary{background-color:var(--volr-bg-secondary)}.volr-bg-tertiary{background-color:var(--volr-bg-tertiary)}.volr-border{border-color:var(--volr-border)}.volr-border-strong{border-color:var(--volr-border-strong)}.volr-divider-line{background-color:var(--volr-border)}.volr-error{background-color:var(--volr-error-bg);border-color:var(--volr-error-border);color:var(--volr-error-text)}.volr-hover:hover{background-color:var(--volr-hover-bg)}.volr-surface{background-color:var(--volr-bg)}}@property --volr-tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --volr-tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --volr-tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --volr-tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --volr-tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --volr-tw-gradient-position{syntax:"*";inherits:false}@property --volr-tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --volr-tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --volr-tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --volr-tw-gradient-stops{syntax:"*";inherits:false}@property --volr-tw-gradient-via-stops{syntax:"*";inherits:false}@property --volr-tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --volr-tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --volr-tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --volr-tw-leading{syntax:"*";inherits:false}@property --volr-tw-font-weight{syntax:"*";inherits:false}@property --volr-tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --volr-tw-shadow-color{syntax:"*";inherits:false}@property --volr-tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --volr-tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --volr-tw-inset-shadow-color{syntax:"*";inherits:false}@property --volr-tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --volr-tw-ring-color{syntax:"*";inherits:false}@property --volr-tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --volr-tw-inset-ring-color{syntax:"*";inherits:false}@property --volr-tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --volr-tw-ring-inset{syntax:"*";inherits:false}@property --volr-tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --volr-tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --volr-tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --volr-tw-blur{syntax:"*";inherits:false}@property --volr-tw-brightness{syntax:"*";inherits:false}@property --volr-tw-contrast{syntax:"*";inherits:false}@property --volr-tw-grayscale{syntax:"*";inherits:false}@property --volr-tw-hue-rotate{syntax:"*";inherits:false}@property --volr-tw-invert{syntax:"*";inherits:false}@property --volr-tw-opacity{syntax:"*";inherits:false}@property --volr-tw-saturate{syntax:"*";inherits:false}@property --volr-tw-sepia{syntax:"*";inherits:false}@property --volr-tw-drop-shadow{syntax:"*";inherits:false}@property --volr-tw-drop-shadow-color{syntax:"*";inherits:false}@property --volr-tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --volr-tw-drop-shadow-size{syntax:"*";inherits:false}@property --volr-tw-duration{syntax:"*";inherits:false}@property --volr-tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}';
|
|
393
731
|
function useResolvedTheme(theme = "light") {
|
|
394
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
732
|
+
const [resolvedTheme, setResolvedTheme] = React10.useState(() => {
|
|
395
733
|
if (theme !== "system") return theme;
|
|
396
734
|
if (typeof window === "undefined") return "light";
|
|
397
735
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
398
736
|
});
|
|
399
|
-
|
|
737
|
+
React10.useEffect(() => {
|
|
400
738
|
if (theme !== "system") {
|
|
401
739
|
setResolvedTheme(theme);
|
|
402
740
|
return;
|
|
@@ -412,10 +750,10 @@ function useResolvedTheme(theme = "light") {
|
|
|
412
750
|
return resolvedTheme;
|
|
413
751
|
}
|
|
414
752
|
function ShadowPortal({ children, theme = "light" }) {
|
|
415
|
-
const [mountNode, setMountNode] =
|
|
416
|
-
const hostRef =
|
|
753
|
+
const [mountNode, setMountNode] = React10.useState(null);
|
|
754
|
+
const hostRef = React10.useRef(null);
|
|
417
755
|
const resolvedTheme = useResolvedTheme(theme);
|
|
418
|
-
|
|
756
|
+
React10.useEffect(() => {
|
|
419
757
|
const host = document.createElement("div");
|
|
420
758
|
host.id = "volr-shadow-portal";
|
|
421
759
|
host.style.position = "fixed";
|
|
@@ -439,7 +777,7 @@ function ShadowPortal({ children, theme = "light" }) {
|
|
|
439
777
|
hostRef.current = null;
|
|
440
778
|
};
|
|
441
779
|
}, []);
|
|
442
|
-
|
|
780
|
+
React10.useEffect(() => {
|
|
443
781
|
if (hostRef.current) {
|
|
444
782
|
hostRef.current.setAttribute("data-theme", resolvedTheme);
|
|
445
783
|
}
|
|
@@ -448,7 +786,7 @@ function ShadowPortal({ children, theme = "light" }) {
|
|
|
448
786
|
return reactDom.createPortal(children, mountNode);
|
|
449
787
|
}
|
|
450
788
|
function useFocusTrap(isActive, containerRef) {
|
|
451
|
-
const previousActiveElement =
|
|
789
|
+
const previousActiveElement = React10.useRef(null);
|
|
452
790
|
const focusableSelector = [
|
|
453
791
|
"button:not([disabled])",
|
|
454
792
|
"input:not([disabled])",
|
|
@@ -457,7 +795,7 @@ function useFocusTrap(isActive, containerRef) {
|
|
|
457
795
|
"a[href]",
|
|
458
796
|
'[tabindex]:not([tabindex="-1"])'
|
|
459
797
|
].join(", ");
|
|
460
|
-
const getFocusableElements =
|
|
798
|
+
const getFocusableElements = React10.useCallback(() => {
|
|
461
799
|
if (!containerRef.current) return [];
|
|
462
800
|
return Array.from(
|
|
463
801
|
containerRef.current.querySelectorAll(focusableSelector)
|
|
@@ -465,7 +803,7 @@ function useFocusTrap(isActive, containerRef) {
|
|
|
465
803
|
return el.offsetParent !== null;
|
|
466
804
|
});
|
|
467
805
|
}, [containerRef, focusableSelector]);
|
|
468
|
-
const handleKeyDown =
|
|
806
|
+
const handleKeyDown = React10.useCallback(
|
|
469
807
|
(event) => {
|
|
470
808
|
if (event.key !== "Tab") return;
|
|
471
809
|
const focusableElements = getFocusableElements();
|
|
@@ -486,7 +824,7 @@ function useFocusTrap(isActive, containerRef) {
|
|
|
486
824
|
},
|
|
487
825
|
[getFocusableElements]
|
|
488
826
|
);
|
|
489
|
-
|
|
827
|
+
React10.useEffect(() => {
|
|
490
828
|
if (!isActive) return;
|
|
491
829
|
previousActiveElement.current = document.activeElement;
|
|
492
830
|
const focusableElements = getFocusableElements();
|
|
@@ -517,12 +855,12 @@ var Modal = ({
|
|
|
517
855
|
}) => {
|
|
518
856
|
const isMobile2 = useMediaQuery("(max-width: 500px)");
|
|
519
857
|
const variant = explicitVariant ?? (isMobile2 ? "bottom-sheet" : "centered");
|
|
520
|
-
const dialogRef =
|
|
521
|
-
const dialogId =
|
|
858
|
+
const dialogRef = React10.useRef(null);
|
|
859
|
+
const dialogId = React10.useId();
|
|
522
860
|
const uiContext = useVolrUIOptional();
|
|
523
861
|
const theme = uiContext?.theme ?? "light";
|
|
524
862
|
useFocusTrap(open, dialogRef);
|
|
525
|
-
|
|
863
|
+
React10.useEffect(() => {
|
|
526
864
|
const handleEscape = (e) => {
|
|
527
865
|
if (e.key === "Escape" && open) {
|
|
528
866
|
if (onEscapeKeyDown) {
|
|
@@ -976,7 +1314,7 @@ var variantMap = {
|
|
|
976
1314
|
ghost: { backgroundColor: "transparent", color: "var(--volr-text-secondary)", border: "none" },
|
|
977
1315
|
outline: { backgroundColor: "transparent", color: "var(--volr-text-secondary)", border: "1px solid var(--volr-border)" }
|
|
978
1316
|
};
|
|
979
|
-
var Button =
|
|
1317
|
+
var Button = React10__default.default.forwardRef(
|
|
980
1318
|
({ variant = "primary", size = "md", fullWidth, className, style, disabled, children, ...props }, ref) => {
|
|
981
1319
|
const { accentColor } = useVolrUI();
|
|
982
1320
|
const sizeStyle = sizeMap[size];
|
|
@@ -1084,12 +1422,12 @@ function PasskeyEnrollView({
|
|
|
1084
1422
|
isEnrolling,
|
|
1085
1423
|
error: enrollmentError
|
|
1086
1424
|
} = react.usePasskeyEnrollment();
|
|
1087
|
-
const [hasStarted, setHasStarted] =
|
|
1088
|
-
const [errorMessage, setErrorMessage] =
|
|
1089
|
-
const [isRefreshing, setIsRefreshing] =
|
|
1425
|
+
const [hasStarted, setHasStarted] = React10.useState(false);
|
|
1426
|
+
const [errorMessage, setErrorMessage] = React10.useState(null);
|
|
1427
|
+
const [isRefreshing, setIsRefreshing] = React10.useState(false);
|
|
1090
1428
|
const biometricType = getBiometricType();
|
|
1091
1429
|
const hasPasskey = user?.keyStorageType === "passkey";
|
|
1092
|
-
|
|
1430
|
+
React10.useEffect(() => {
|
|
1093
1431
|
console.log("[PasskeyEnrollView] User state:", {
|
|
1094
1432
|
user,
|
|
1095
1433
|
keyStorageType: user?.keyStorageType,
|
|
@@ -1097,7 +1435,7 @@ function PasskeyEnrollView({
|
|
|
1097
1435
|
hasPasskey
|
|
1098
1436
|
});
|
|
1099
1437
|
}, [user, hasPasskey]);
|
|
1100
|
-
|
|
1438
|
+
React10.useEffect(() => {
|
|
1101
1439
|
if (hasPasskey && !user?.evmAddress && !isRefreshing) {
|
|
1102
1440
|
const refreshUserData = async () => {
|
|
1103
1441
|
try {
|
|
@@ -1128,7 +1466,7 @@ function PasskeyEnrollView({
|
|
|
1128
1466
|
refreshUserData();
|
|
1129
1467
|
}
|
|
1130
1468
|
}, [hasPasskey, user?.evmAddress, isRefreshing, client, setUser, user]);
|
|
1131
|
-
|
|
1469
|
+
React10.useEffect(() => {
|
|
1132
1470
|
if (!user?.id) {
|
|
1133
1471
|
const error = new Error("User ID is required for passkey enrollment");
|
|
1134
1472
|
setErrorMessage(getUserFriendlyError(error, t));
|
|
@@ -1137,7 +1475,7 @@ function PasskeyEnrollView({
|
|
|
1137
1475
|
}
|
|
1138
1476
|
}
|
|
1139
1477
|
}, [user, onError, t]);
|
|
1140
|
-
|
|
1478
|
+
React10.useEffect(() => {
|
|
1141
1479
|
if (enrollmentError) {
|
|
1142
1480
|
const friendlyMessage = getUserFriendlyError(enrollmentError, t);
|
|
1143
1481
|
setErrorMessage(friendlyMessage);
|
|
@@ -1294,8 +1632,8 @@ function MpcConnectView({
|
|
|
1294
1632
|
isConnecting,
|
|
1295
1633
|
error: connectionError
|
|
1296
1634
|
} = react.useMpcConnection();
|
|
1297
|
-
const [errorMessage, setErrorMessage] =
|
|
1298
|
-
|
|
1635
|
+
const [errorMessage, setErrorMessage] = React10.useState(null);
|
|
1636
|
+
React10.useEffect(() => {
|
|
1299
1637
|
if (connectionError) {
|
|
1300
1638
|
setErrorMessage(connectionError.message);
|
|
1301
1639
|
if (onError) {
|
|
@@ -1303,7 +1641,7 @@ function MpcConnectView({
|
|
|
1303
1641
|
}
|
|
1304
1642
|
}
|
|
1305
1643
|
}, [connectionError, onError]);
|
|
1306
|
-
|
|
1644
|
+
React10.useEffect(() => {
|
|
1307
1645
|
handleConnect();
|
|
1308
1646
|
}, []);
|
|
1309
1647
|
const handleConnect = async () => {
|
|
@@ -1364,7 +1702,7 @@ function MpcConnectView({
|
|
|
1364
1702
|
);
|
|
1365
1703
|
}
|
|
1366
1704
|
var CopyButton = ({ text, className, onCopy }) => {
|
|
1367
|
-
const [copied, setCopied] =
|
|
1705
|
+
const [copied, setCopied] = React10.useState(false);
|
|
1368
1706
|
const handleCopy = async () => {
|
|
1369
1707
|
try {
|
|
1370
1708
|
await navigator.clipboard.writeText(text);
|
|
@@ -1562,9 +1900,9 @@ function PoweredBy() {
|
|
|
1562
1900
|
}
|
|
1563
1901
|
function EmailInlineInput({ onSubmit, accentColor }) {
|
|
1564
1902
|
const { t } = useI18n();
|
|
1565
|
-
const [email, setEmail] =
|
|
1566
|
-
const [error, setError] =
|
|
1567
|
-
const [isLoading, setIsLoading] =
|
|
1903
|
+
const [email, setEmail] = React10.useState("");
|
|
1904
|
+
const [error, setError] = React10.useState(null);
|
|
1905
|
+
const [isLoading, setIsLoading] = React10.useState(false);
|
|
1568
1906
|
const handleSubmit = async (e) => {
|
|
1569
1907
|
e.preventDefault();
|
|
1570
1908
|
setError(null);
|
|
@@ -1688,14 +2026,14 @@ function SigninSelectScreen({
|
|
|
1688
2026
|
function CodeInputScreen({ email, onSubmit, onResend }) {
|
|
1689
2027
|
const { t } = useI18n();
|
|
1690
2028
|
const { accentColor } = useVolrUI();
|
|
1691
|
-
const [digits, setDigits] =
|
|
1692
|
-
const [error, setError] =
|
|
1693
|
-
const [isLoading, setIsLoading] =
|
|
1694
|
-
const inputRefs =
|
|
1695
|
-
|
|
2029
|
+
const [digits, setDigits] = React10.useState(Array(6).fill(""));
|
|
2030
|
+
const [error, setError] = React10.useState(null);
|
|
2031
|
+
const [isLoading, setIsLoading] = React10.useState(false);
|
|
2032
|
+
const inputRefs = React10.useRef([]);
|
|
2033
|
+
React10.useEffect(() => {
|
|
1696
2034
|
inputRefs.current[0]?.focus();
|
|
1697
2035
|
}, []);
|
|
1698
|
-
|
|
2036
|
+
React10.useEffect(() => {
|
|
1699
2037
|
const code = digits.join("");
|
|
1700
2038
|
if (code.length === 6 && !isLoading) {
|
|
1701
2039
|
handleSubmit(code);
|
|
@@ -1858,23 +2196,23 @@ function SiweLoginScreen({
|
|
|
1858
2196
|
checkSiweSession,
|
|
1859
2197
|
getSiweSignUrl
|
|
1860
2198
|
} = react.useVolrLogin();
|
|
1861
|
-
const [isLoading, setIsLoading] =
|
|
1862
|
-
const [loadingWallet, setLoadingWallet] =
|
|
1863
|
-
const [error, setError] =
|
|
1864
|
-
const [providers, setProviders] =
|
|
1865
|
-
const [isDetecting, setIsDetecting] =
|
|
1866
|
-
const [hasLegacyWallet, setHasLegacyWallet] =
|
|
1867
|
-
const [showOtherWallet, setShowOtherWallet] =
|
|
1868
|
-
const [sessionUrl, setSessionUrl] =
|
|
1869
|
-
const [isPolling, setIsPolling] =
|
|
1870
|
-
const pollingRef =
|
|
1871
|
-
const sessionCreatedRef =
|
|
1872
|
-
|
|
2199
|
+
const [isLoading, setIsLoading] = React10.useState(false);
|
|
2200
|
+
const [loadingWallet, setLoadingWallet] = React10.useState(null);
|
|
2201
|
+
const [error, setError] = React10.useState(null);
|
|
2202
|
+
const [providers, setProviders] = React10.useState([]);
|
|
2203
|
+
const [isDetecting, setIsDetecting] = React10.useState(true);
|
|
2204
|
+
const [hasLegacyWallet, setHasLegacyWallet] = React10.useState(false);
|
|
2205
|
+
const [showOtherWallet, setShowOtherWallet] = React10.useState(false);
|
|
2206
|
+
const [sessionUrl, setSessionUrl] = React10.useState(null);
|
|
2207
|
+
const [isPolling, setIsPolling] = React10.useState(false);
|
|
2208
|
+
const pollingRef = React10.useRef(null);
|
|
2209
|
+
const sessionCreatedRef = React10.useRef(false);
|
|
2210
|
+
React10.useEffect(() => {
|
|
1873
2211
|
return () => {
|
|
1874
2212
|
if (pollingRef.current) clearInterval(pollingRef.current);
|
|
1875
2213
|
};
|
|
1876
2214
|
}, []);
|
|
1877
|
-
|
|
2215
|
+
React10.useEffect(() => {
|
|
1878
2216
|
if (typeof window === "undefined") {
|
|
1879
2217
|
setIsDetecting(false);
|
|
1880
2218
|
return;
|
|
@@ -1900,7 +2238,7 @@ function SiweLoginScreen({
|
|
|
1900
2238
|
};
|
|
1901
2239
|
}, []);
|
|
1902
2240
|
const hasAnyWallet = providers.length > 0 || hasLegacyWallet;
|
|
1903
|
-
const createSession =
|
|
2241
|
+
const createSession = React10.useCallback(async () => {
|
|
1904
2242
|
if (sessionCreatedRef.current || sessionUrl) return;
|
|
1905
2243
|
sessionCreatedRef.current = true;
|
|
1906
2244
|
try {
|
|
@@ -1942,17 +2280,17 @@ function SiweLoginScreen({
|
|
|
1942
2280
|
onError(err instanceof Error ? err : new Error("Failed to create session"));
|
|
1943
2281
|
}
|
|
1944
2282
|
}, [createSiweSession, getSiweSignUrl, checkSiweSession, onSuccess, onError, t, sessionUrl]);
|
|
1945
|
-
|
|
2283
|
+
React10.useEffect(() => {
|
|
1946
2284
|
if (!isDetecting && !hasAnyWallet && !sessionUrl) {
|
|
1947
2285
|
createSession();
|
|
1948
2286
|
}
|
|
1949
2287
|
}, [isDetecting, hasAnyWallet, sessionUrl, createSession]);
|
|
1950
|
-
|
|
2288
|
+
React10.useEffect(() => {
|
|
1951
2289
|
if (showOtherWallet && !sessionUrl) {
|
|
1952
2290
|
createSession();
|
|
1953
2291
|
}
|
|
1954
2292
|
}, [showOtherWallet, sessionUrl, createSession]);
|
|
1955
|
-
const handleWalletClick =
|
|
2293
|
+
const handleWalletClick = React10.useCallback(async (provider, walletName) => {
|
|
1956
2294
|
setError(null);
|
|
1957
2295
|
setIsLoading(true);
|
|
1958
2296
|
setLoadingWallet(walletName);
|
|
@@ -1976,7 +2314,7 @@ function SiweLoginScreen({
|
|
|
1976
2314
|
setLoadingWallet(null);
|
|
1977
2315
|
}
|
|
1978
2316
|
}, [signWithWallet, onSuccess, onError]);
|
|
1979
|
-
const handleLegacyWalletClick =
|
|
2317
|
+
const handleLegacyWalletClick = React10.useCallback(async () => {
|
|
1980
2318
|
if (typeof window === "undefined" || !window.ethereum) return;
|
|
1981
2319
|
const ethereum = window.ethereum;
|
|
1982
2320
|
let walletName = "Wallet";
|
|
@@ -1985,7 +2323,7 @@ function SiweLoginScreen({
|
|
|
1985
2323
|
else if (ethereum.isRabby) walletName = "Rabby";
|
|
1986
2324
|
await handleWalletClick(ethereum, walletName);
|
|
1987
2325
|
}, [handleWalletClick]);
|
|
1988
|
-
const cancelOtherWallet =
|
|
2326
|
+
const cancelOtherWallet = React10.useCallback(() => {
|
|
1989
2327
|
if (pollingRef.current) {
|
|
1990
2328
|
clearInterval(pollingRef.current);
|
|
1991
2329
|
pollingRef.current = null;
|
|
@@ -2129,13 +2467,13 @@ function SigninModal({ isOpen, onClose, onError }) {
|
|
|
2129
2467
|
const { logout, user } = react.useVolrContext();
|
|
2130
2468
|
const { appName, branding } = useVolrUI();
|
|
2131
2469
|
const { requestEmailCode, verifyEmailCode, handleSocialLogin } = react.useVolrLogin();
|
|
2132
|
-
const [currentScreen, setCurrentScreen] =
|
|
2133
|
-
const [email, setEmail] =
|
|
2470
|
+
const [currentScreen, setCurrentScreen] = React10.useState("method-select");
|
|
2471
|
+
const [email, setEmail] = React10.useState("");
|
|
2134
2472
|
const hasPasskey = user?.keyStorageType === "passkey";
|
|
2135
2473
|
const isMobile2 = useMediaQuery("(max-width: 500px)");
|
|
2136
2474
|
const isWideViewport = useMediaQuery("(min-width: 864px)");
|
|
2137
2475
|
const shouldUseWideLayout = !isMobile2 && isWideViewport && Boolean(branding) && currentScreen === "method-select";
|
|
2138
|
-
|
|
2476
|
+
React10.useEffect(() => {
|
|
2139
2477
|
if (!isOpen) {
|
|
2140
2478
|
setCurrentScreen("method-select");
|
|
2141
2479
|
setEmail("");
|
|
@@ -2164,8 +2502,12 @@ function SigninModal({ isOpen, onClose, onError }) {
|
|
|
2164
2502
|
}
|
|
2165
2503
|
setCurrentScreen("passkey-setup");
|
|
2166
2504
|
};
|
|
2167
|
-
const handleSiweSuccess = (
|
|
2168
|
-
|
|
2505
|
+
const handleSiweSuccess = (data) => {
|
|
2506
|
+
if (data.keyStorageType) {
|
|
2507
|
+
onClose();
|
|
2508
|
+
return;
|
|
2509
|
+
}
|
|
2510
|
+
setCurrentScreen("passkey-setup");
|
|
2169
2511
|
};
|
|
2170
2512
|
const handlePasskeyComplete = () => {
|
|
2171
2513
|
onClose();
|
|
@@ -2292,7 +2634,7 @@ function SigninModal({ isOpen, onClose, onError }) {
|
|
|
2292
2634
|
function AccountModal({ isOpen, onClose, onError }) {
|
|
2293
2635
|
const { user, logout } = react.useVolrContext();
|
|
2294
2636
|
const { t } = useI18n();
|
|
2295
|
-
const [isLoggingOut, setIsLoggingOut] =
|
|
2637
|
+
const [isLoggingOut, setIsLoggingOut] = React10.useState(false);
|
|
2296
2638
|
if (!user) {
|
|
2297
2639
|
return /* @__PURE__ */ jsxRuntime.jsx(SigninModal, { isOpen, onClose, onError });
|
|
2298
2640
|
}
|
|
@@ -2426,7 +2768,7 @@ function AssetSelectView({
|
|
|
2426
2768
|
}) })
|
|
2427
2769
|
] });
|
|
2428
2770
|
}
|
|
2429
|
-
var TextLinkButton =
|
|
2771
|
+
var TextLinkButton = React10__default.default.forwardRef(({ showArrow = false, className, children, ...props }, ref) => {
|
|
2430
2772
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2431
2773
|
"button",
|
|
2432
2774
|
{
|
|
@@ -2685,7 +3027,7 @@ var DepositCompletedToast = ({
|
|
|
2685
3027
|
symbol
|
|
2686
3028
|
}) => {
|
|
2687
3029
|
const { t } = useI18n();
|
|
2688
|
-
const [expanded, setExpanded] =
|
|
3030
|
+
const [expanded, setExpanded] = React10.useState(false);
|
|
2689
3031
|
const formatAmount = (amount) => {
|
|
2690
3032
|
const divisor = BigInt(10 ** decimals);
|
|
2691
3033
|
const whole = amount / divisor;
|
|
@@ -2840,10 +3182,10 @@ function DepositQRView(props) {
|
|
|
2840
3182
|
const { t } = useI18n();
|
|
2841
3183
|
const { config } = react.useVolrContext();
|
|
2842
3184
|
const { client } = react.useInternalAuth();
|
|
2843
|
-
const [chainName, setChainName] =
|
|
2844
|
-
const [showOtherTokenModal, setShowOtherTokenModal] =
|
|
2845
|
-
const [showToast, setShowToast] =
|
|
2846
|
-
const [toastData, setToastData] =
|
|
3185
|
+
const [chainName, setChainName] = React10.useState(null);
|
|
3186
|
+
const [showOtherTokenModal, setShowOtherTokenModal] = React10.useState(false);
|
|
3187
|
+
const [showToast, setShowToast] = React10.useState(false);
|
|
3188
|
+
const [toastData, setToastData] = React10.useState(null);
|
|
2847
3189
|
const eip681 = `ethereum:${props.address}`;
|
|
2848
3190
|
const status = react.useDepositListener({
|
|
2849
3191
|
chainId: props.chainId,
|
|
@@ -2856,7 +3198,7 @@ function DepositQRView(props) {
|
|
|
2856
3198
|
},
|
|
2857
3199
|
address: props.address
|
|
2858
3200
|
});
|
|
2859
|
-
|
|
3201
|
+
React10.useEffect(() => {
|
|
2860
3202
|
if (status.state === "detected") {
|
|
2861
3203
|
setToastData({
|
|
2862
3204
|
previousBalance: status.previousBalance,
|
|
@@ -2866,11 +3208,11 @@ function DepositQRView(props) {
|
|
|
2866
3208
|
setShowToast(true);
|
|
2867
3209
|
}
|
|
2868
3210
|
}, [status]);
|
|
2869
|
-
const getNetworkInfo =
|
|
3211
|
+
const getNetworkInfo = React10.useCallback(
|
|
2870
3212
|
react.createGetNetworkInfo({ client, rpcOverrides: config.rpcOverrides }),
|
|
2871
3213
|
[client, config.rpcOverrides]
|
|
2872
3214
|
);
|
|
2873
|
-
|
|
3215
|
+
React10.useEffect(() => {
|
|
2874
3216
|
let cancelled = false;
|
|
2875
3217
|
const loadChainName = async () => {
|
|
2876
3218
|
try {
|
|
@@ -3037,11 +3379,11 @@ var DepositModal = ({
|
|
|
3037
3379
|
}) => {
|
|
3038
3380
|
const { user } = react.useVolrContext();
|
|
3039
3381
|
const { client } = react.useInternalAuth();
|
|
3040
|
-
const [depositAssets, setDepositAssets] =
|
|
3041
|
-
const [isLoading, setIsLoading] =
|
|
3042
|
-
const [error, setError] =
|
|
3043
|
-
const [selectedIdx, setSelectedIdx] =
|
|
3044
|
-
|
|
3382
|
+
const [depositAssets, setDepositAssets] = React10.useState([]);
|
|
3383
|
+
const [isLoading, setIsLoading] = React10.useState(true);
|
|
3384
|
+
const [error, setError] = React10.useState(null);
|
|
3385
|
+
const [selectedIdx, setSelectedIdx] = React10.useState(-1);
|
|
3386
|
+
React10.useEffect(() => {
|
|
3045
3387
|
if (!open) return;
|
|
3046
3388
|
setIsLoading(true);
|
|
3047
3389
|
setError(null);
|
|
@@ -3068,12 +3410,12 @@ var DepositModal = ({
|
|
|
3068
3410
|
if (depositAssets.length === 1) return 0;
|
|
3069
3411
|
return -1;
|
|
3070
3412
|
};
|
|
3071
|
-
|
|
3413
|
+
React10.useEffect(() => {
|
|
3072
3414
|
if (open && !isLoading && depositAssets.length > 0) {
|
|
3073
3415
|
setSelectedIdx(getInitialIndex());
|
|
3074
3416
|
}
|
|
3075
3417
|
}, [open, isLoading, depositAssets.length, asset]);
|
|
3076
|
-
|
|
3418
|
+
React10.useEffect(() => {
|
|
3077
3419
|
if (!open) {
|
|
3078
3420
|
setSelectedIdx(-1);
|
|
3079
3421
|
}
|
|
@@ -3102,6 +3444,302 @@ var DepositModal = ({
|
|
|
3102
3444
|
)
|
|
3103
3445
|
] });
|
|
3104
3446
|
};
|
|
3447
|
+
|
|
3448
|
+
// ../node_modules/viem/_esm/index.js
|
|
3449
|
+
init_abis();
|
|
3450
|
+
|
|
3451
|
+
// src/hooks/usePaymentModalState.ts
|
|
3452
|
+
var initialState = {
|
|
3453
|
+
step: "info",
|
|
3454
|
+
processingStep: "signing",
|
|
3455
|
+
balance: "0",
|
|
3456
|
+
isBalanceLoading: true,
|
|
3457
|
+
isPaying: false,
|
|
3458
|
+
currentPayment: null,
|
|
3459
|
+
txHash: void 0,
|
|
3460
|
+
error: void 0,
|
|
3461
|
+
logoUrl: void 0,
|
|
3462
|
+
receiverAddress: null,
|
|
3463
|
+
showDeposit: false
|
|
3464
|
+
};
|
|
3465
|
+
function paymentModalReducer(state, action) {
|
|
3466
|
+
switch (action.type) {
|
|
3467
|
+
case "RESET":
|
|
3468
|
+
return { ...initialState };
|
|
3469
|
+
case "INIT_PAYMENT":
|
|
3470
|
+
return {
|
|
3471
|
+
...initialState,
|
|
3472
|
+
currentPayment: action.payment,
|
|
3473
|
+
isBalanceLoading: true
|
|
3474
|
+
};
|
|
3475
|
+
case "SET_BALANCE":
|
|
3476
|
+
return { ...state, balance: action.balance };
|
|
3477
|
+
case "SET_BALANCE_LOADING":
|
|
3478
|
+
return { ...state, isBalanceLoading: action.loading };
|
|
3479
|
+
case "SET_LOGO_URL":
|
|
3480
|
+
return { ...state, logoUrl: action.logoUrl };
|
|
3481
|
+
case "SET_RECEIVER_ADDRESS":
|
|
3482
|
+
return { ...state, receiverAddress: action.receiverAddress };
|
|
3483
|
+
case "START_PAYMENT":
|
|
3484
|
+
return {
|
|
3485
|
+
...state,
|
|
3486
|
+
isPaying: true,
|
|
3487
|
+
step: "processing",
|
|
3488
|
+
processingStep: "signing",
|
|
3489
|
+
error: void 0
|
|
3490
|
+
};
|
|
3491
|
+
case "SET_PROCESSING_STEP":
|
|
3492
|
+
return { ...state, processingStep: action.step };
|
|
3493
|
+
case "SET_TX_HASH":
|
|
3494
|
+
return { ...state, txHash: action.txHash };
|
|
3495
|
+
case "PAYMENT_SUCCESS":
|
|
3496
|
+
return {
|
|
3497
|
+
...state,
|
|
3498
|
+
isPaying: false,
|
|
3499
|
+
step: "result",
|
|
3500
|
+
currentPayment: action.payment
|
|
3501
|
+
};
|
|
3502
|
+
case "PAYMENT_ERROR":
|
|
3503
|
+
return {
|
|
3504
|
+
...state,
|
|
3505
|
+
isPaying: false,
|
|
3506
|
+
step: "result",
|
|
3507
|
+
error: action.error
|
|
3508
|
+
};
|
|
3509
|
+
case "RETRY":
|
|
3510
|
+
return {
|
|
3511
|
+
...state,
|
|
3512
|
+
step: "info",
|
|
3513
|
+
error: void 0,
|
|
3514
|
+
isBalanceLoading: true
|
|
3515
|
+
};
|
|
3516
|
+
case "SHOW_DEPOSIT":
|
|
3517
|
+
return { ...state, showDeposit: true };
|
|
3518
|
+
case "HIDE_DEPOSIT":
|
|
3519
|
+
return { ...state, showDeposit: false, isBalanceLoading: true };
|
|
3520
|
+
default:
|
|
3521
|
+
return state;
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
function usePaymentModalState(open, onOpenChange) {
|
|
3525
|
+
const { user } = react.useVolrContext();
|
|
3526
|
+
const { client } = react.useInternalAuth();
|
|
3527
|
+
const { evm } = react.useVolr();
|
|
3528
|
+
const { paymentOptions } = useVolrModal();
|
|
3529
|
+
const { updatePaymentToProcessing, pollPaymentStatus } = react.useVolrPaymentApi();
|
|
3530
|
+
const [state, dispatch] = React10.useReducer(paymentModalReducer, initialState);
|
|
3531
|
+
const fetchBalance = React10.useCallback(
|
|
3532
|
+
async (payment) => {
|
|
3533
|
+
if (!user?.evmAddress) {
|
|
3534
|
+
dispatch({ type: "SET_BALANCE_LOADING", loading: false });
|
|
3535
|
+
return;
|
|
3536
|
+
}
|
|
3537
|
+
dispatch({ type: "SET_BALANCE_LOADING", loading: true });
|
|
3538
|
+
try {
|
|
3539
|
+
const evmClient = evm(payment.token.chainId);
|
|
3540
|
+
const tokenAddress = payment.token.id.split("_")[1];
|
|
3541
|
+
let balanceRaw;
|
|
3542
|
+
if (tokenAddress === "native") {
|
|
3543
|
+
balanceRaw = await evmClient.getBalance(user.evmAddress);
|
|
3544
|
+
} else {
|
|
3545
|
+
balanceRaw = await evmClient.readContract({
|
|
3546
|
+
address: tokenAddress,
|
|
3547
|
+
abi: erc20Abi,
|
|
3548
|
+
functionName: "balanceOf",
|
|
3549
|
+
args: [user.evmAddress]
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
const balanceNum = Number(balanceRaw) / Math.pow(10, payment.token.decimals);
|
|
3553
|
+
const formattedBalance = balanceNum.toLocaleString(void 0, {
|
|
3554
|
+
minimumFractionDigits: 0,
|
|
3555
|
+
maximumFractionDigits: payment.token.decimals > 6 ? 6 : payment.token.decimals
|
|
3556
|
+
});
|
|
3557
|
+
dispatch({ type: "SET_BALANCE", balance: formattedBalance });
|
|
3558
|
+
} catch (err) {
|
|
3559
|
+
console.error("Failed to fetch balance:", err);
|
|
3560
|
+
dispatch({ type: "SET_BALANCE", balance: "0" });
|
|
3561
|
+
} finally {
|
|
3562
|
+
dispatch({ type: "SET_BALANCE_LOADING", loading: false });
|
|
3563
|
+
}
|
|
3564
|
+
},
|
|
3565
|
+
[user, evm]
|
|
3566
|
+
);
|
|
3567
|
+
const fetchBranding = React10.useCallback(async () => {
|
|
3568
|
+
try {
|
|
3569
|
+
const response = await client.get("/auth/branding");
|
|
3570
|
+
dispatch({ type: "SET_LOGO_URL", logoUrl: response.logoUrl });
|
|
3571
|
+
} catch {
|
|
3572
|
+
}
|
|
3573
|
+
}, [client]);
|
|
3574
|
+
const fetchPaymentConfig = React10.useCallback(async () => {
|
|
3575
|
+
try {
|
|
3576
|
+
const response = await client.get(
|
|
3577
|
+
"/payments/config"
|
|
3578
|
+
);
|
|
3579
|
+
dispatch({
|
|
3580
|
+
type: "SET_RECEIVER_ADDRESS",
|
|
3581
|
+
receiverAddress: response.receiverAddress
|
|
3582
|
+
});
|
|
3583
|
+
} catch (err) {
|
|
3584
|
+
console.error("Failed to fetch payment config:", err);
|
|
3585
|
+
dispatch({ type: "SET_RECEIVER_ADDRESS", receiverAddress: null });
|
|
3586
|
+
}
|
|
3587
|
+
}, [client]);
|
|
3588
|
+
React10.useEffect(() => {
|
|
3589
|
+
if (open && paymentOptions) {
|
|
3590
|
+
dispatch({ type: "INIT_PAYMENT", payment: paymentOptions.payment });
|
|
3591
|
+
fetchBalance(paymentOptions.payment);
|
|
3592
|
+
fetchBranding();
|
|
3593
|
+
fetchPaymentConfig();
|
|
3594
|
+
} else if (!open) {
|
|
3595
|
+
dispatch({ type: "RESET" });
|
|
3596
|
+
}
|
|
3597
|
+
}, [open, paymentOptions, fetchBalance, fetchBranding, fetchPaymentConfig]);
|
|
3598
|
+
const handlePay = React10.useCallback(async () => {
|
|
3599
|
+
const { currentPayment, receiverAddress } = state;
|
|
3600
|
+
if (!currentPayment || !user?.evmAddress || !paymentOptions || !receiverAddress) {
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
dispatch({ type: "START_PAYMENT" });
|
|
3604
|
+
try {
|
|
3605
|
+
const evmClient = evm(currentPayment.token.chainId);
|
|
3606
|
+
const tokenAddress = currentPayment.token.id.split("_")[1];
|
|
3607
|
+
dispatch({ type: "SET_PROCESSING_STEP", step: "broadcasting" });
|
|
3608
|
+
let result;
|
|
3609
|
+
if (tokenAddress === "native") {
|
|
3610
|
+
result = await evmClient.sendTransaction({
|
|
3611
|
+
to: receiverAddress,
|
|
3612
|
+
data: "0x",
|
|
3613
|
+
value: BigInt(currentPayment.amount)
|
|
3614
|
+
});
|
|
3615
|
+
} else {
|
|
3616
|
+
result = await evmClient.sendBatch([
|
|
3617
|
+
{
|
|
3618
|
+
target: tokenAddress,
|
|
3619
|
+
abi: erc20Abi,
|
|
3620
|
+
functionName: "transfer",
|
|
3621
|
+
args: [
|
|
3622
|
+
receiverAddress,
|
|
3623
|
+
BigInt(currentPayment.amount)
|
|
3624
|
+
]
|
|
3625
|
+
}
|
|
3626
|
+
]);
|
|
3627
|
+
}
|
|
3628
|
+
dispatch({ type: "SET_TX_HASH", txHash: result.txHash ?? "" });
|
|
3629
|
+
dispatch({ type: "SET_PROCESSING_STEP", step: "confirming" });
|
|
3630
|
+
await updatePaymentToProcessing(currentPayment.id, result.txId);
|
|
3631
|
+
paymentOptions.onProcessing?.({
|
|
3632
|
+
...currentPayment,
|
|
3633
|
+
txHash: result.txHash ?? "",
|
|
3634
|
+
status: "PROCESSING"
|
|
3635
|
+
});
|
|
3636
|
+
const confirmedPayment = await pollPaymentStatus(currentPayment.id);
|
|
3637
|
+
dispatch({ type: "PAYMENT_SUCCESS", payment: confirmedPayment });
|
|
3638
|
+
if (confirmedPayment.status === "CONFIRMED") {
|
|
3639
|
+
paymentOptions.onComplete?.(confirmedPayment);
|
|
3640
|
+
} else if (confirmedPayment.status === "FAILED") {
|
|
3641
|
+
const failError = {
|
|
3642
|
+
code: "PAYMENT_FAILED",
|
|
3643
|
+
message: "Transaction failed on-chain"
|
|
3644
|
+
};
|
|
3645
|
+
dispatch({ type: "PAYMENT_ERROR", error: failError });
|
|
3646
|
+
paymentOptions.onError?.(failError);
|
|
3647
|
+
}
|
|
3648
|
+
} catch (err) {
|
|
3649
|
+
console.error("Payment failed:", err);
|
|
3650
|
+
const paymentError = {
|
|
3651
|
+
code: err.code || "PAYMENT_FAILED",
|
|
3652
|
+
message: err.message || "Payment failed. Please try again."
|
|
3653
|
+
};
|
|
3654
|
+
dispatch({ type: "PAYMENT_ERROR", error: paymentError });
|
|
3655
|
+
paymentOptions?.onError?.(paymentError);
|
|
3656
|
+
}
|
|
3657
|
+
}, [
|
|
3658
|
+
state,
|
|
3659
|
+
user,
|
|
3660
|
+
paymentOptions,
|
|
3661
|
+
evm,
|
|
3662
|
+
updatePaymentToProcessing,
|
|
3663
|
+
pollPaymentStatus
|
|
3664
|
+
]);
|
|
3665
|
+
const handleDeposit = React10.useCallback(() => {
|
|
3666
|
+
dispatch({ type: "SHOW_DEPOSIT" });
|
|
3667
|
+
}, []);
|
|
3668
|
+
const handleDepositClose = React10.useCallback(
|
|
3669
|
+
(depositOpen) => {
|
|
3670
|
+
if (!depositOpen) {
|
|
3671
|
+
dispatch({ type: "HIDE_DEPOSIT" });
|
|
3672
|
+
if (state.currentPayment) {
|
|
3673
|
+
fetchBalance(state.currentPayment);
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
},
|
|
3677
|
+
[state.currentPayment, fetchBalance]
|
|
3678
|
+
);
|
|
3679
|
+
const handleDone = React10.useCallback(() => {
|
|
3680
|
+
if (state.currentPayment?.status === "CONFIRMED") {
|
|
3681
|
+
paymentOptions?.onComplete?.(state.currentPayment);
|
|
3682
|
+
}
|
|
3683
|
+
onOpenChange(false);
|
|
3684
|
+
}, [state.currentPayment, paymentOptions, onOpenChange]);
|
|
3685
|
+
const handleRetry = React10.useCallback(() => {
|
|
3686
|
+
dispatch({ type: "RETRY" });
|
|
3687
|
+
if (state.currentPayment) {
|
|
3688
|
+
fetchBalance(state.currentPayment);
|
|
3689
|
+
}
|
|
3690
|
+
}, [state.currentPayment, fetchBalance]);
|
|
3691
|
+
const handleClose = React10.useCallback(() => {
|
|
3692
|
+
if (state.step === "processing") {
|
|
3693
|
+
return;
|
|
3694
|
+
}
|
|
3695
|
+
if (state.step === "info") {
|
|
3696
|
+
paymentOptions?.onCancel?.();
|
|
3697
|
+
}
|
|
3698
|
+
onOpenChange(false);
|
|
3699
|
+
}, [state.step, paymentOptions, onOpenChange]);
|
|
3700
|
+
const handleReport = React10.useCallback(async () => {
|
|
3701
|
+
const { currentPayment, error, step, txHash } = state;
|
|
3702
|
+
if (!currentPayment || !error) return;
|
|
3703
|
+
try {
|
|
3704
|
+
await client.post(`/payments/${currentPayment.id}/report`, {
|
|
3705
|
+
errorCode: error.code,
|
|
3706
|
+
errorMessage: error.message,
|
|
3707
|
+
platform: "web",
|
|
3708
|
+
context: {
|
|
3709
|
+
step,
|
|
3710
|
+
txHash,
|
|
3711
|
+
tokenId: currentPayment.token.id,
|
|
3712
|
+
chainId: currentPayment.token.chainId,
|
|
3713
|
+
amount: currentPayment.amount
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3716
|
+
alert("Error report submitted. Thank you for your feedback.");
|
|
3717
|
+
} catch (err) {
|
|
3718
|
+
console.error("Failed to submit error report:", err);
|
|
3719
|
+
alert(
|
|
3720
|
+
`Error Code: ${error.code}
|
|
3721
|
+
|
|
3722
|
+
Message: ${error.message}
|
|
3723
|
+
|
|
3724
|
+
Please contact support with this information.`
|
|
3725
|
+
);
|
|
3726
|
+
}
|
|
3727
|
+
}, [state, client]);
|
|
3728
|
+
const canClose = state.step !== "processing";
|
|
3729
|
+
const isConfigured = state.receiverAddress !== null;
|
|
3730
|
+
return {
|
|
3731
|
+
state,
|
|
3732
|
+
handlePay,
|
|
3733
|
+
handleDeposit,
|
|
3734
|
+
handleDepositClose,
|
|
3735
|
+
handleDone,
|
|
3736
|
+
handleRetry,
|
|
3737
|
+
handleClose,
|
|
3738
|
+
handleReport,
|
|
3739
|
+
canClose,
|
|
3740
|
+
isConfigured
|
|
3741
|
+
};
|
|
3742
|
+
}
|
|
3105
3743
|
var PaymentSkeleton = () => {
|
|
3106
3744
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:p-6 volr:space-y-6 volr:animate-pulse", children: [
|
|
3107
3745
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:flex volr:items-center volr:gap-4", children: [
|
|
@@ -3417,10 +4055,11 @@ var PaymentResultView = ({
|
|
|
3417
4055
|
payment,
|
|
3418
4056
|
error,
|
|
3419
4057
|
onDone,
|
|
3420
|
-
onRetry
|
|
4058
|
+
onRetry,
|
|
4059
|
+
onReport
|
|
3421
4060
|
}) => {
|
|
3422
4061
|
const isSuccess = payment.status === "CONFIRMED";
|
|
3423
|
-
payment.status === "FAILED" || !!error;
|
|
4062
|
+
const isFailed = payment.status === "FAILED" || !!error;
|
|
3424
4063
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:p-6 volr:space-y-6", children: [
|
|
3425
4064
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "volr:flex volr:justify-center volr:py-4", children: isSuccess ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "volr:w-16 volr:h-16 volr:rounded-full volr:bg-green-100 volr:flex volr:items-center volr:justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3426
4065
|
"svg",
|
|
@@ -3459,7 +4098,11 @@ var PaymentResultView = ({
|
|
|
3459
4098
|
) }) }),
|
|
3460
4099
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:text-center", children: [
|
|
3461
4100
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "volr:text-lg volr:font-semibold volr:text-slate-900", children: isSuccess ? "Payment Complete" : "Payment Failed" }),
|
|
3462
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "volr:text-sm volr:text-slate-500 volr:mt-1", children: isSuccess ? "Your transaction has been confirmed" : error?.message || "The transaction could not be completed" })
|
|
4101
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "volr:text-sm volr:text-slate-500 volr:mt-1", children: isSuccess ? "Your transaction has been confirmed" : error?.message || "The transaction could not be completed" }),
|
|
4102
|
+
isFailed && error?.code && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "volr:text-xs volr:text-slate-400 volr:mt-1 volr:font-mono", children: [
|
|
4103
|
+
"Error code: ",
|
|
4104
|
+
error.code
|
|
4105
|
+
] })
|
|
3463
4106
|
] }),
|
|
3464
4107
|
isSuccess && payment.txHash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:bg-slate-50 volr:rounded-lg volr:p-4 volr:space-y-2", children: [
|
|
3465
4108
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:flex volr:justify-between volr:text-sm", children: [
|
|
@@ -3488,7 +4131,10 @@ var PaymentResultView = ({
|
|
|
3488
4131
|
] }),
|
|
3489
4132
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "volr:space-y-3", children: isSuccess ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onDone, className: "volr:w-full", children: "Done" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3490
4133
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onRetry, className: "volr:w-full", children: "Try Again" }),
|
|
3491
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4134
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "volr:flex volr:gap-3", children: [
|
|
4135
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: onReport, className: "volr:flex-1", children: "Report Issue" }),
|
|
4136
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: onDone, className: "volr:flex-1", children: "Cancel" })
|
|
4137
|
+
] })
|
|
3492
4138
|
] }) })
|
|
3493
4139
|
] });
|
|
3494
4140
|
};
|
|
@@ -3496,139 +4142,61 @@ var PaymentModal = ({
|
|
|
3496
4142
|
open,
|
|
3497
4143
|
onOpenChange
|
|
3498
4144
|
}) => {
|
|
3499
|
-
const {
|
|
3500
|
-
const {
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
const response = await client.get(
|
|
3535
|
-
`/wallet/balance?chainId=${payment.token.chainId}&address=${user.evmAddress}&tokenId=${payment.token.id}`
|
|
3536
|
-
).catch(() => ({ balance: "0" }));
|
|
3537
|
-
const balanceNum = Number(response.balance) / Math.pow(10, payment.token.decimals);
|
|
3538
|
-
setBalance(balanceNum.toLocaleString(void 0, {
|
|
3539
|
-
minimumFractionDigits: 0,
|
|
3540
|
-
maximumFractionDigits: payment.token.decimals > 6 ? 6 : payment.token.decimals
|
|
3541
|
-
}));
|
|
3542
|
-
} catch (err) {
|
|
3543
|
-
console.error("Failed to fetch balance:", err);
|
|
3544
|
-
setBalance("0");
|
|
3545
|
-
} finally {
|
|
3546
|
-
setIsBalanceLoading(false);
|
|
3547
|
-
}
|
|
3548
|
-
};
|
|
3549
|
-
const fetchBranding = async () => {
|
|
3550
|
-
try {
|
|
3551
|
-
const response = await client.get("/auth/branding");
|
|
3552
|
-
setLogoUrl(response.logoUrl);
|
|
3553
|
-
} catch {
|
|
3554
|
-
}
|
|
3555
|
-
};
|
|
3556
|
-
const handlePay = React11.useCallback(async () => {
|
|
3557
|
-
if (!currentPayment || !user?.evmAddress || !paymentOptions) return;
|
|
3558
|
-
setIsPaying(true);
|
|
3559
|
-
setStep("processing");
|
|
3560
|
-
setProcessingStep("signing");
|
|
3561
|
-
setError(void 0);
|
|
3562
|
-
try {
|
|
3563
|
-
const configResponse = await client.get(
|
|
3564
|
-
`/payments/config`
|
|
3565
|
-
).catch(() => null);
|
|
3566
|
-
if (!configResponse?.receiverAddress) {
|
|
3567
|
-
throw new Error("Payment not configured. Please contact the app developer.");
|
|
4145
|
+
const { paymentOptions } = useVolrModal();
|
|
4146
|
+
const {
|
|
4147
|
+
state,
|
|
4148
|
+
handlePay,
|
|
4149
|
+
handleDeposit,
|
|
4150
|
+
handleDepositClose,
|
|
4151
|
+
handleDone,
|
|
4152
|
+
handleRetry,
|
|
4153
|
+
handleClose,
|
|
4154
|
+
handleReport,
|
|
4155
|
+
canClose,
|
|
4156
|
+
isConfigured
|
|
4157
|
+
} = usePaymentModalState(open, onOpenChange);
|
|
4158
|
+
const {
|
|
4159
|
+
step,
|
|
4160
|
+
processingStep,
|
|
4161
|
+
balance,
|
|
4162
|
+
isBalanceLoading,
|
|
4163
|
+
isPaying,
|
|
4164
|
+
currentPayment,
|
|
4165
|
+
txHash,
|
|
4166
|
+
error,
|
|
4167
|
+
logoUrl,
|
|
4168
|
+
showDeposit
|
|
4169
|
+
} = state;
|
|
4170
|
+
if (showDeposit && currentPayment) {
|
|
4171
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4172
|
+
DepositModal,
|
|
4173
|
+
{
|
|
4174
|
+
open: true,
|
|
4175
|
+
onOpenChange: handleDepositClose,
|
|
4176
|
+
asset: {
|
|
4177
|
+
chainId: currentPayment.token.chainId,
|
|
4178
|
+
symbol: currentPayment.token.symbol
|
|
4179
|
+
}
|
|
3568
4180
|
}
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
setTxHash(mockTxHash);
|
|
3572
|
-
setProcessingStep("confirming");
|
|
3573
|
-
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
3574
|
-
const finalPayment = {
|
|
3575
|
-
...currentPayment,
|
|
3576
|
-
status: "CONFIRMED",
|
|
3577
|
-
txHash: mockTxHash,
|
|
3578
|
-
confirmedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3579
|
-
};
|
|
3580
|
-
setCurrentPayment(finalPayment);
|
|
3581
|
-
setStep("result");
|
|
3582
|
-
paymentOptions.onComplete?.(finalPayment);
|
|
3583
|
-
} catch (err) {
|
|
3584
|
-
console.error("Payment failed:", err);
|
|
3585
|
-
const paymentError = {
|
|
3586
|
-
code: "PAYMENT_FAILED",
|
|
3587
|
-
message: err.message || "Payment failed. Please try again."
|
|
3588
|
-
};
|
|
3589
|
-
setError(paymentError);
|
|
3590
|
-
setStep("result");
|
|
3591
|
-
paymentOptions?.onError?.(paymentError);
|
|
3592
|
-
} finally {
|
|
3593
|
-
setIsPaying(false);
|
|
3594
|
-
}
|
|
3595
|
-
}, [currentPayment, user, paymentOptions, client, updatePaymentToProcessing]);
|
|
3596
|
-
const handleDeposit = React11.useCallback(() => {
|
|
3597
|
-
closeModal();
|
|
3598
|
-
}, [closeModal]);
|
|
3599
|
-
const handleDone = React11.useCallback(() => {
|
|
3600
|
-
if (currentPayment) {
|
|
3601
|
-
paymentOptions?.onComplete?.(currentPayment);
|
|
3602
|
-
}
|
|
3603
|
-
onOpenChange(false);
|
|
3604
|
-
}, [currentPayment, paymentOptions, onOpenChange]);
|
|
3605
|
-
const handleRetry = React11.useCallback(() => {
|
|
3606
|
-
setStep("info");
|
|
3607
|
-
setError(void 0);
|
|
3608
|
-
if (currentPayment) {
|
|
3609
|
-
fetchBalance(currentPayment);
|
|
3610
|
-
}
|
|
3611
|
-
}, [currentPayment]);
|
|
3612
|
-
const handleClose = React11.useCallback(() => {
|
|
3613
|
-
if (step === "processing") {
|
|
3614
|
-
return;
|
|
3615
|
-
}
|
|
3616
|
-
if (step === "info") {
|
|
3617
|
-
paymentOptions?.onCancel?.();
|
|
3618
|
-
}
|
|
3619
|
-
onOpenChange(false);
|
|
3620
|
-
}, [step, paymentOptions, onOpenChange]);
|
|
4181
|
+
);
|
|
4182
|
+
}
|
|
3621
4183
|
if (!paymentOptions || !currentPayment) {
|
|
3622
4184
|
return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open, onOpenChange, children: [
|
|
3623
4185
|
/* @__PURE__ */ jsxRuntime.jsx(ModalHeader, { onClose: () => onOpenChange(false) }),
|
|
3624
4186
|
/* @__PURE__ */ jsxRuntime.jsx(PaymentSkeleton, {})
|
|
3625
4187
|
] });
|
|
3626
4188
|
}
|
|
4189
|
+
if (!isConfigured && step === "info") {
|
|
4190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open, onOpenChange: handleClose, children: [
|
|
4191
|
+
/* @__PURE__ */ jsxRuntime.jsx(ModalHeader, { onClose: handleClose }),
|
|
4192
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "volr:p-6 volr:text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "volr:text-sm volr:text-red-600", children: "Payment not configured. Please contact the app developer." }) })
|
|
4193
|
+
] });
|
|
4194
|
+
}
|
|
3627
4195
|
return /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open, onOpenChange: handleClose, children: [
|
|
3628
4196
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3629
4197
|
ModalHeader,
|
|
3630
4198
|
{
|
|
3631
|
-
onClose:
|
|
4199
|
+
onClose: canClose ? handleClose : void 0,
|
|
3632
4200
|
title: step === "info" ? "Confirm Payment" : void 0
|
|
3633
4201
|
}
|
|
3634
4202
|
),
|
|
@@ -3651,21 +4219,22 @@ var PaymentModal = ({
|
|
|
3651
4219
|
payment: currentPayment,
|
|
3652
4220
|
error,
|
|
3653
4221
|
onDone: handleDone,
|
|
3654
|
-
onRetry: handleRetry
|
|
4222
|
+
onRetry: handleRetry,
|
|
4223
|
+
onReport: handleReport
|
|
3655
4224
|
}
|
|
3656
4225
|
)
|
|
3657
4226
|
] });
|
|
3658
4227
|
};
|
|
3659
|
-
var VolrUIContext =
|
|
4228
|
+
var VolrUIContext = React10__default.default.createContext(null);
|
|
3660
4229
|
var useVolrUI = () => {
|
|
3661
|
-
const context =
|
|
4230
|
+
const context = React10.useContext(VolrUIContext);
|
|
3662
4231
|
if (!context) {
|
|
3663
4232
|
throw new Error("useVolrUI must be used within VolrUIProvider");
|
|
3664
4233
|
}
|
|
3665
4234
|
return context;
|
|
3666
4235
|
};
|
|
3667
4236
|
var useVolrUIOptional = () => {
|
|
3668
|
-
return
|
|
4237
|
+
return React10.useContext(VolrUIContext);
|
|
3669
4238
|
};
|
|
3670
4239
|
function OnboardingFlow({
|
|
3671
4240
|
keyStorageType,
|
|
@@ -3721,11 +4290,11 @@ var VolrUIProvider = ({
|
|
|
3721
4290
|
const providerPolicy = config.providerPolicy ?? {
|
|
3722
4291
|
enforceOnFirstLogin: true
|
|
3723
4292
|
};
|
|
3724
|
-
const [showOnboarding, setShowOnboarding] =
|
|
3725
|
-
const [keyStorageTypeError, setKeyStorageTypeError] =
|
|
4293
|
+
const [showOnboarding, setShowOnboarding] = React10.useState(false);
|
|
4294
|
+
const [keyStorageTypeError, setKeyStorageTypeError] = React10.useState(
|
|
3726
4295
|
null
|
|
3727
4296
|
);
|
|
3728
|
-
|
|
4297
|
+
React10.useEffect(() => {
|
|
3729
4298
|
if (providerPolicy.enforceOnFirstLogin !== false && !keyStorageType) {
|
|
3730
4299
|
const errorMessage = "keyStorageType must be specified in VolrUIProvider props. Please set keyStorageType prop in VolrUIProvider.";
|
|
3731
4300
|
console.error(errorMessage);
|
|
@@ -3797,9 +4366,9 @@ var VolrUIProvider = ({
|
|
|
3797
4366
|
};
|
|
3798
4367
|
function AccountModalPortal() {
|
|
3799
4368
|
const { isOpen, mode, close } = useVolrModal();
|
|
3800
|
-
const [portalRoot, setPortalRoot] =
|
|
3801
|
-
const [error, setError] =
|
|
3802
|
-
|
|
4369
|
+
const [portalRoot, setPortalRoot] = React10.useState(null);
|
|
4370
|
+
const [error, setError] = React10.useState(null);
|
|
4371
|
+
React10.useEffect(() => {
|
|
3803
4372
|
if (typeof window === "undefined") return;
|
|
3804
4373
|
let root = document.getElementById("volr-modal-root");
|
|
3805
4374
|
if (!root) {
|
|
@@ -3858,9 +4427,9 @@ function AccountModalPortal() {
|
|
|
3858
4427
|
function DepositModalPortal() {
|
|
3859
4428
|
const { isOpen, mode, asset, close } = useVolrModal();
|
|
3860
4429
|
const { user } = react.useVolrContext();
|
|
3861
|
-
const [portalRoot, setPortalRoot] =
|
|
3862
|
-
const [showLogin, setShowLogin] =
|
|
3863
|
-
|
|
4430
|
+
const [portalRoot, setPortalRoot] = React10.useState(null);
|
|
4431
|
+
const [showLogin, setShowLogin] = React10.useState(false);
|
|
4432
|
+
React10.useEffect(() => {
|
|
3864
4433
|
if (typeof window === "undefined") return;
|
|
3865
4434
|
let root = document.getElementById("volr-modal-root");
|
|
3866
4435
|
if (!root) {
|
|
@@ -3875,7 +4444,7 @@ function DepositModalPortal() {
|
|
|
3875
4444
|
}
|
|
3876
4445
|
};
|
|
3877
4446
|
}, []);
|
|
3878
|
-
|
|
4447
|
+
React10.useEffect(() => {
|
|
3879
4448
|
if (isOpen && mode === "deposit" && !user) {
|
|
3880
4449
|
setShowLogin(true);
|
|
3881
4450
|
} else {
|
|
@@ -3909,8 +4478,8 @@ function DepositModalPortal() {
|
|
|
3909
4478
|
}
|
|
3910
4479
|
function PaymentModalPortal() {
|
|
3911
4480
|
const { isOpen, mode, close } = useVolrModal();
|
|
3912
|
-
const [portalRoot, setPortalRoot] =
|
|
3913
|
-
|
|
4481
|
+
const [portalRoot, setPortalRoot] = React10.useState(null);
|
|
4482
|
+
React10.useEffect(() => {
|
|
3914
4483
|
if (typeof window === "undefined") return;
|
|
3915
4484
|
let root = document.getElementById("volr-modal-root");
|
|
3916
4485
|
if (!root) {
|
|
@@ -3940,8 +4509,8 @@ function PaymentModalPortal() {
|
|
|
3940
4509
|
function OAuthCallbackHandler({
|
|
3941
4510
|
onShowOnboarding
|
|
3942
4511
|
}) {
|
|
3943
|
-
const [hasCode, setHasCode] =
|
|
3944
|
-
|
|
4512
|
+
const [hasCode, setHasCode] = React10.useState(false);
|
|
4513
|
+
React10.useEffect(() => {
|
|
3945
4514
|
if (typeof window === "undefined") return;
|
|
3946
4515
|
const params = new URLSearchParams(window.location.search);
|
|
3947
4516
|
const code = params.get("code");
|
|
@@ -3984,13 +4553,13 @@ function OnboardingChecker({
|
|
|
3984
4553
|
}) {
|
|
3985
4554
|
const { user, provider, isLoading } = react.useVolrContext();
|
|
3986
4555
|
const { isOpen: isModalOpen } = useVolrModal();
|
|
3987
|
-
const modalWasOpened =
|
|
3988
|
-
|
|
4556
|
+
const modalWasOpened = React10__default.default.useRef(false);
|
|
4557
|
+
React10.useEffect(() => {
|
|
3989
4558
|
if (isModalOpen) {
|
|
3990
4559
|
modalWasOpened.current = true;
|
|
3991
4560
|
}
|
|
3992
4561
|
}, [isModalOpen]);
|
|
3993
|
-
|
|
4562
|
+
React10.useEffect(() => {
|
|
3994
4563
|
if (isLoading) {
|
|
3995
4564
|
return;
|
|
3996
4565
|
}
|
|
@@ -4033,7 +4602,7 @@ function OnboardingChecker({
|
|
|
4033
4602
|
}
|
|
4034
4603
|
function useSwitchNetwork() {
|
|
4035
4604
|
const { client } = react.useInternalAuth();
|
|
4036
|
-
return
|
|
4605
|
+
return React10.useCallback(
|
|
4037
4606
|
async (chainId) => {
|
|
4038
4607
|
if (typeof window === "undefined" || !window.ethereum) {
|
|
4039
4608
|
throw new Error("No wallet found");
|
|
@@ -4093,6 +4662,104 @@ async function getCurrentChainId() {
|
|
|
4093
4662
|
});
|
|
4094
4663
|
return parseInt(chainIdHex, 16);
|
|
4095
4664
|
}
|
|
4665
|
+
var paymentPromiseResolvers = /* @__PURE__ */ new Map();
|
|
4666
|
+
function useVolrPay() {
|
|
4667
|
+
const { open: openModal } = useVolrModal();
|
|
4668
|
+
const { createPayment, checkPayment, getPaymentHistory, cancelPayment } = react.useVolrPaymentApi();
|
|
4669
|
+
const currentPaymentIdRef = React10.useRef(null);
|
|
4670
|
+
const pay = React10.useCallback(
|
|
4671
|
+
async (options) => {
|
|
4672
|
+
const payment = await createPayment({
|
|
4673
|
+
amount: options.amount,
|
|
4674
|
+
item: options.item,
|
|
4675
|
+
referenceId: options.referenceId,
|
|
4676
|
+
metadata: options.metadata,
|
|
4677
|
+
idempotencyKey: options.idempotencyKey,
|
|
4678
|
+
expiresInSec: options.expiresInSec
|
|
4679
|
+
});
|
|
4680
|
+
currentPaymentIdRef.current = payment.id;
|
|
4681
|
+
options.handlers?.onCreated?.({ id: payment.id });
|
|
4682
|
+
const waitPromise = new Promise((resolve, reject) => {
|
|
4683
|
+
paymentPromiseResolvers.set(payment.id, { resolve, reject });
|
|
4684
|
+
});
|
|
4685
|
+
const modalOptions = {
|
|
4686
|
+
payment,
|
|
4687
|
+
options: {
|
|
4688
|
+
amount: options.amount,
|
|
4689
|
+
item: options.item,
|
|
4690
|
+
referenceId: options.referenceId,
|
|
4691
|
+
metadata: options.metadata,
|
|
4692
|
+
idempotencyKey: options.idempotencyKey,
|
|
4693
|
+
expiresInSec: options.expiresInSec
|
|
4694
|
+
},
|
|
4695
|
+
onComplete: (result) => {
|
|
4696
|
+
currentPaymentIdRef.current = null;
|
|
4697
|
+
const resolver = paymentPromiseResolvers.get(payment.id);
|
|
4698
|
+
if (resolver) {
|
|
4699
|
+
resolver.resolve(result);
|
|
4700
|
+
paymentPromiseResolvers.delete(payment.id);
|
|
4701
|
+
}
|
|
4702
|
+
if (result.status === "CONFIRMED") {
|
|
4703
|
+
options.handlers?.onSuccess?.(result);
|
|
4704
|
+
}
|
|
4705
|
+
},
|
|
4706
|
+
onProcessing: (processingPayment) => {
|
|
4707
|
+
options.handlers?.onProcessing?.({
|
|
4708
|
+
id: processingPayment.id,
|
|
4709
|
+
txHash: processingPayment.txHash
|
|
4710
|
+
});
|
|
4711
|
+
},
|
|
4712
|
+
onError: (error) => {
|
|
4713
|
+
currentPaymentIdRef.current = null;
|
|
4714
|
+
const resolver = paymentPromiseResolvers.get(payment.id);
|
|
4715
|
+
if (resolver) {
|
|
4716
|
+
resolver.reject(new Error(error.message));
|
|
4717
|
+
paymentPromiseResolvers.delete(payment.id);
|
|
4718
|
+
}
|
|
4719
|
+
options.handlers?.onError?.(error);
|
|
4720
|
+
},
|
|
4721
|
+
onCancel: () => {
|
|
4722
|
+
currentPaymentIdRef.current = null;
|
|
4723
|
+
const resolver = paymentPromiseResolvers.get(payment.id);
|
|
4724
|
+
if (resolver) {
|
|
4725
|
+
resolver.resolve({
|
|
4726
|
+
...payment,
|
|
4727
|
+
status: "CANCELLED"
|
|
4728
|
+
});
|
|
4729
|
+
paymentPromiseResolvers.delete(payment.id);
|
|
4730
|
+
}
|
|
4731
|
+
options.handlers?.onCancel?.();
|
|
4732
|
+
}
|
|
4733
|
+
};
|
|
4734
|
+
openModal({ mode: "payment", payment: modalOptions });
|
|
4735
|
+
return {
|
|
4736
|
+
id: payment.id,
|
|
4737
|
+
status: payment.status,
|
|
4738
|
+
wait: () => waitPromise,
|
|
4739
|
+
cancel: async () => {
|
|
4740
|
+
await cancelPayment(payment.id);
|
|
4741
|
+
currentPaymentIdRef.current = null;
|
|
4742
|
+
const resolver = paymentPromiseResolvers.get(payment.id);
|
|
4743
|
+
if (resolver) {
|
|
4744
|
+
resolver.resolve({
|
|
4745
|
+
...payment,
|
|
4746
|
+
status: "CANCELLED"
|
|
4747
|
+
});
|
|
4748
|
+
paymentPromiseResolvers.delete(payment.id);
|
|
4749
|
+
}
|
|
4750
|
+
options.handlers?.onCancel?.();
|
|
4751
|
+
}
|
|
4752
|
+
};
|
|
4753
|
+
},
|
|
4754
|
+
[createPayment, cancelPayment, openModal]
|
|
4755
|
+
);
|
|
4756
|
+
return {
|
|
4757
|
+
pay,
|
|
4758
|
+
checkPayment,
|
|
4759
|
+
getPaymentHistory,
|
|
4760
|
+
isPaymentInProgress: currentPaymentIdRef.current !== null
|
|
4761
|
+
};
|
|
4762
|
+
}
|
|
4096
4763
|
|
|
4097
4764
|
Object.defineProperty(exports, "VolrProvider", {
|
|
4098
4765
|
enumerable: true,
|
|
@@ -4114,6 +4781,10 @@ Object.defineProperty(exports, "useVolrLogin", {
|
|
|
4114
4781
|
enumerable: true,
|
|
4115
4782
|
get: function () { return react.useVolrLogin; }
|
|
4116
4783
|
});
|
|
4784
|
+
Object.defineProperty(exports, "useVolrPaymentApi", {
|
|
4785
|
+
enumerable: true,
|
|
4786
|
+
get: function () { return react.useVolrPaymentApi; }
|
|
4787
|
+
});
|
|
4117
4788
|
exports.I18nContext = I18nContext;
|
|
4118
4789
|
exports.I18nProvider = I18nProvider;
|
|
4119
4790
|
exports.MpcConnectView = MpcConnectView;
|
|
@@ -4124,6 +4795,7 @@ exports.useI18n = useI18n;
|
|
|
4124
4795
|
exports.useSwitchNetwork = useSwitchNetwork;
|
|
4125
4796
|
exports.useTranslation = useTranslation;
|
|
4126
4797
|
exports.useVolrModal = useVolrModal;
|
|
4798
|
+
exports.useVolrPay = useVolrPay;
|
|
4127
4799
|
exports.useVolrUI = useVolrUI;
|
|
4128
4800
|
exports.useVolrUIOptional = useVolrUIOptional;
|
|
4129
4801
|
//# sourceMappingURL=index.cjs.map
|