@rhinestone/deposit-modal 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +12 -12
  2. package/bridge-transcript.json +14 -0
  3. package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
  4. package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
  5. package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-KOJ7VEY7.mjs} +30 -29
  6. package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-R37SSHUF.cjs} +79 -78
  7. package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
  8. package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
  9. package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
  10. package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
  11. package/dist/{chunk-V2OBGLJD.cjs → chunk-3OOY67VJ.cjs} +1103 -253
  12. package/dist/{chunk-6KG642KH.cjs → chunk-5P2PVLS4.cjs} +1 -1
  13. package/dist/{chunk-IN77XSWO.mjs → chunk-5VONFVQN.mjs} +976 -126
  14. package/dist/chunk-6HUHVXCY.cjs +704 -0
  15. package/dist/{chunk-PKML3XVS.mjs → chunk-7UQ6OUEE.mjs} +166 -45
  16. package/dist/{chunk-K4H6TGBE.mjs → chunk-CXBMIZUF.mjs} +1 -1
  17. package/dist/{chunk-MTFJSE52.cjs → chunk-DTVZUBHI.cjs} +236 -115
  18. package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
  19. package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
  20. package/dist/{chunk-KTUVSKR4.mjs → chunk-IKUYZA7A.mjs} +265 -523
  21. package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
  22. package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
  23. package/dist/chunk-QJ7RCCU7.mjs +704 -0
  24. package/dist/chunk-UCBUCX2W.mjs +3169 -0
  25. package/dist/{chunk-YCQZJQO6.cjs → chunk-VPDCGD2D.cjs} +622 -880
  26. package/dist/{chunk-7ICSHJFE.cjs → chunk-X4D52IZK.cjs} +1501 -176
  27. package/dist/claim.cjs +5 -7
  28. package/dist/claim.d.cts +3 -3
  29. package/dist/claim.d.ts +3 -3
  30. package/dist/claim.mjs +4 -6
  31. package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
  32. package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
  33. package/dist/constants.cjs +3 -3
  34. package/dist/constants.d.cts +3 -3
  35. package/dist/constants.d.ts +3 -3
  36. package/dist/constants.mjs +2 -2
  37. package/dist/deposit.cjs +7 -8
  38. package/dist/deposit.d.cts +3 -3
  39. package/dist/deposit.d.ts +3 -3
  40. package/dist/deposit.mjs +6 -7
  41. package/dist/embed.cjs +135 -44
  42. package/dist/embed.d.cts +2 -2
  43. package/dist/embed.d.ts +2 -2
  44. package/dist/embed.mjs +116 -25
  45. package/dist/index.cjs +13 -11
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.mjs +12 -10
  49. package/dist/polymarket.cjs +6 -6
  50. package/dist/polymarket.mjs +2 -2
  51. package/dist/styles.css +132 -100
  52. package/dist/{types-Bho4OA03.d.ts → types-CQ0NHqCy.d.ts} +146 -11
  53. package/dist/{types-DP_3KwlD.d.cts → types-CxiLX5sv.d.cts} +146 -11
  54. package/dist/withdraw.cjs +6 -6
  55. package/dist/withdraw.d.cts +4 -4
  56. package/dist/withdraw.d.ts +4 -4
  57. package/dist/withdraw.mjs +5 -5
  58. package/package.json +7 -6
  59. package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
  60. package/dist/ClaimModal-SEKNWRMA.mjs +0 -13
  61. package/dist/WithdrawModal-5ICGD4HJ.mjs +0 -12
  62. package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
  63. package/dist/chunk-7SR7ENVJ.mjs +0 -1844
  64. package/dist/chunk-CFKC77SV.mjs +0 -1062
  65. package/dist/chunk-LZFRL2AL.cjs +0 -81
  66. package/dist/chunk-WUJIKCFU.mjs +0 -81
  67. package/dist/chunk-X2IPAPXU.cjs +0 -163
  68. package/dist/chunk-YWMWI7PZ.cjs +0 -1062
  69. package/dist/chunk-ZEO6ADM3.mjs +0 -163
@@ -1,1062 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _chunkX2IPAPXUcjs = require('./chunk-X2IPAPXU.cjs');
5
-
6
-
7
- var _chunkLZFRL2ALcjs = require('./chunk-LZFRL2AL.cjs');
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
- var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
36
-
37
-
38
-
39
-
40
-
41
-
42
- var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
43
-
44
- // src/ClaimModal.tsx
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
- var _react = require('react');
53
- var _viem = require('viem');
54
-
55
- // src/components/ui/Input.tsx
56
-
57
- var _jsxruntime = require('react/jsx-runtime');
58
- var Input = _react.forwardRef.call(void 0,
59
- ({ label, error, variant, className = "", ...props }, ref) => {
60
- const inputVariant = error ? "error" : variant || "default";
61
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-input-wrapper", children: [
62
- label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "rs-input-label", children: label }),
63
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
64
- "input",
65
- {
66
- ref,
67
- className: `rs-input rs-input--${inputVariant} ${className}`,
68
- ...props
69
- }
70
- ),
71
- error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
72
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
73
- error
74
- ] })
75
- ] });
76
- }
77
- );
78
- Input.displayName = "Input";
79
-
80
- // src/core/claim-analytics.tsx
81
-
82
-
83
-
84
-
85
-
86
-
87
- function claimFailureReasonForError(error) {
88
- if (!(error instanceof _chunkX2IPAPXUcjs.RecoveryError)) return "refund_failed";
89
- switch (error.code) {
90
- case "SIGNATURE_INVALID":
91
- return "signature_invalid";
92
- case "DEPOSIT_NOT_RECOVERABLE":
93
- return "recovery_deposit_not_recoverable";
94
- case "RECOVERY_UNSUPPORTED":
95
- return "recovery_unsupported";
96
- case "VERIFICATION_UNAVAILABLE":
97
- return "signature_verification_unavailable";
98
- case "REFUND_RECONCILIATION_REQUIRED":
99
- return "refund_reconciliation_required";
100
- case "REFUND_FAILED":
101
- return "refund_failed";
102
- default:
103
- if (error.phase === "signature") return "signature_rejected";
104
- if (error.phase === "request") return "refund_service_unreachable";
105
- return "refund_failed";
106
- }
107
- }
108
- function createClaimAnalyticsController(emit) {
109
- let step = null;
110
- let afterHandoff = false;
111
- let opened = false;
112
- let closed = false;
113
- const dedupe = /* @__PURE__ */ new Set();
114
- const send = (payload) => {
115
- controller.openSession();
116
- emit(payload);
117
- };
118
- const emitOnce = (key, payload) => {
119
- if (dedupe.has(key)) return;
120
- dedupe.add(key);
121
- send(payload);
122
- };
123
- const rearmStep = (rearmed) => {
124
- for (const key of [...dedupe]) {
125
- if (key.includes(`:${rearmed}:`)) dedupe.delete(key);
126
- }
127
- };
128
- const controller = {
129
- openSession() {
130
- if (opened) return;
131
- opened = true;
132
- emit({ type: "claim_modal_open" });
133
- },
134
- openStep(nextStep) {
135
- controller.openSession();
136
- if (step === nextStep) return;
137
- step = nextStep;
138
- emitOnce(`step-open:${nextStep}`, {
139
- type: "claim_modal_step_open",
140
- step: nextStep
141
- });
142
- },
143
- completeStep(completedStep = _nullishCoalesce(step, () => ( void 0))) {
144
- if (!completedStep) return;
145
- emitOnce(`step-complete:${completedStep}`, {
146
- type: "claim_modal_step_complete",
147
- step: completedStep
148
- });
149
- },
150
- rearmStep(rearmed) {
151
- rearmStep(rearmed);
152
- },
153
- // One per submitted search, never deduplicated: the searched hash is
154
- // deliberately not in the stream, so collapsing two searches that returned
155
- // the same counts would make the second one unrecoverable.
156
- lookupResult(matches, eligible) {
157
- send({
158
- type: "claim_modal_lookup_result",
159
- matches,
160
- eligible
161
- });
162
- },
163
- selectDeposit({ depositId, transactionHash, autoSelected }) {
164
- emitOnce(`deposit-selected:${depositId}`, {
165
- type: "claim_modal_deposit_selected",
166
- deposit_id: depositId,
167
- transaction_hash: transactionHash,
168
- auto_selected: autoSelected
169
- });
170
- },
171
- friction(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
172
- if (!eventStep) return;
173
- emitOnce(`friction:${eventStep}:${reason}`, {
174
- type: "claim_modal_friction",
175
- step: eventStep,
176
- reason
177
- });
178
- },
179
- failure(reason, retryable, eventStep = _nullishCoalesce(step, () => ( void 0))) {
180
- if (!eventStep) return;
181
- emitOnce(`failure:${eventStep}:${reason}`, {
182
- type: "claim_modal_failure",
183
- step: eventStep,
184
- reason,
185
- retryable
186
- });
187
- },
188
- retry(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
189
- if (!eventStep) return;
190
- send({ type: "claim_modal_retry", step: eventStep, reason });
191
- rearmStep(eventStep);
192
- },
193
- handoff({ depositId, transactionHash, refundTransactionHash }, eventStep) {
194
- const handoffStep = _nullishCoalesce(_nullishCoalesce(eventStep, () => ( step)), () => ( "submit"));
195
- if (step !== handoffStep) controller.openStep(handoffStep);
196
- afterHandoff = true;
197
- emitOnce(`handoff:${refundTransactionHash}`, {
198
- type: "claim_modal_handoff",
199
- step: handoffStep,
200
- deposit_id: depositId,
201
- transaction_hash: transactionHash,
202
- refund_transaction_hash: refundTransactionHash
203
- });
204
- },
205
- // Keyed by step so a retry re-arms it: a second failed submit is a second
206
- // terminal outcome, not a duplicate of the first.
207
- outcome(outcome) {
208
- if (!step) return;
209
- emitOnce(`outcome:${step}:${outcome}`, {
210
- type: "claim_modal_ui_outcome",
211
- step,
212
- outcome
213
- });
214
- },
215
- abandon(reason) {
216
- if (!step || afterHandoff) return;
217
- emitOnce(`abandon:${step}:${reason}`, {
218
- type: "claim_modal_abandoned",
219
- step,
220
- reason
221
- });
222
- },
223
- close(source) {
224
- if (closed) return;
225
- closed = true;
226
- send({
227
- type: "claim_modal_close",
228
- source,
229
- step,
230
- after_handoff: afterHandoff
231
- });
232
- },
233
- /** "Claim another deposit" on the success screen: a fresh attempt in the
234
- * same session, so the envelope and its session id stay. */
235
- resetAttempt() {
236
- step = null;
237
- afterHandoff = false;
238
- dedupe.clear();
239
- },
240
- get step() {
241
- return step;
242
- },
243
- get afterHandoff() {
244
- return afterHandoff;
245
- }
246
- };
247
- return controller;
248
- }
249
- var ClaimAnalyticsControllerContext = _react.createContext.call(void 0, null);
250
- var noopController = createClaimAnalyticsController(() => {
251
- });
252
- function ClaimAnalyticsControllerProvider({
253
- children,
254
- controllerRef
255
- }) {
256
- const emit = _chunkV2OBGLJDcjs.useClaimAnalyticsEmitter.call(void 0, );
257
- const controller = _react.useMemo.call(void 0, () => createClaimAnalyticsController(emit), [emit]);
258
- if (controllerRef) controllerRef.current = controller;
259
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClaimAnalyticsControllerContext.Provider, { value: controller, children });
260
- }
261
- function useClaimAnalyticsController() {
262
- return _nullishCoalesce(_react.useContext.call(void 0, ClaimAnalyticsControllerContext), () => ( noopController));
263
- }
264
-
265
- // src/ClaimModal.tsx
266
-
267
- function evmChainIdFromCaip2(chain) {
268
- if (!_optionalChain([chain, 'optionalAccess', _ => _.startsWith, 'call', _2 => _2("eip155:")])) return null;
269
- const id = Number.parseInt(chain.slice("eip155:".length), 10);
270
- return Number.isFinite(id) ? id : null;
271
- }
272
- function isEligible(row) {
273
- return row.status === "failed" || row.status === "rejected";
274
- }
275
- function describeDeposit(row) {
276
- const chainId = _nullishCoalesce(evmChainIdFromCaip2(row.chain), () => ( 0));
277
- const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, row.token, chainId);
278
- const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, row.token, chainId);
279
- const raw = BigInt(_nullishCoalesce(_nullishCoalesce(row.sourceAmount, () => ( row.amount)), () => ( "0")));
280
- const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
281
- const amount = _nullishCoalesce(_chunkV2OBGLJDcjs.formatTokenAmount.call(void 0, human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
282
- return {
283
- chainId,
284
- symbol,
285
- amount,
286
- chainName: _chunk4KCSH4T3cjs.getChainName.call(void 0, chainId),
287
- chainIcon: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, chainId)
288
- };
289
- }
290
- function shortenHash(hash) {
291
- return `${hash.slice(0, 10)}\u2026${hash.slice(-8)}`;
292
- }
293
- function shortenAddress(addr) {
294
- return addr.length > 12 ? `${addr.slice(0, 6)}\u2026${addr.slice(-4)}` : addr;
295
- }
296
- function humanizeStatus(status) {
297
- if (!status) return void 0;
298
- const spaced = status.replace(/[_-]+/g, " ").trim();
299
- return spaced.charAt(0).toUpperCase() + spaced.slice(1);
300
- }
301
- var INITIAL_STATE = {
302
- step: "lookup",
303
- deposits: [],
304
- selected: null,
305
- result: null,
306
- error: null,
307
- retryable: true
308
- };
309
- function claimReducer(state, action) {
310
- switch (action.type) {
311
- case "lookup/results":
312
- return {
313
- ...state,
314
- deposits: action.deposits,
315
- selected: action.autoSelect,
316
- step: action.autoSelect ? "review" : "select",
317
- error: null
318
- };
319
- case "select":
320
- return { ...state, selected: action.deposit, step: "review", error: null };
321
- case "back":
322
- if (state.step === "failed") return { ...state, step: "review", error: null };
323
- if (state.step === "review")
324
- return {
325
- ...state,
326
- step: state.deposits.length > 1 ? "select" : "lookup",
327
- error: null
328
- };
329
- if (state.step === "select") return { ...INITIAL_STATE };
330
- return state;
331
- case "submit":
332
- return { ...state, step: "processing", error: null };
333
- case "complete":
334
- return {
335
- ...state,
336
- step: "complete",
337
- result: {
338
- txHash: action.txHash,
339
- amount: action.amount,
340
- amountDisplay: action.amountDisplay,
341
- symbol: action.symbol,
342
- destination: action.destination,
343
- chain: action.chain
344
- }
345
- };
346
- case "failed":
347
- return {
348
- ...state,
349
- step: "failed",
350
- error: action.error,
351
- retryable: _nullishCoalesce(action.retryable, () => ( true))
352
- };
353
- case "reset":
354
- return { ...INITIAL_STATE };
355
- default:
356
- return state;
357
- }
358
- }
359
- function buildClaimAnalyticsSessionProperties({
360
- inline = false,
361
- closeOnOverlayClick = false,
362
- defaultTxHash,
363
- defaultRefundDestination
364
- }) {
365
- return {
366
- presentation: inline ? "inline" : "overlay",
367
- overlay_close_enabled: !inline && closeOnOverlayClick,
368
- prefills: {
369
- transaction_hash: defaultTxHash !== void 0,
370
- refund_destination: defaultRefundDestination !== void 0
371
- }
372
- };
373
- }
374
- function analyticsStepForClaimStep(step) {
375
- if (step === "lookup") return "lookup";
376
- if (step === "select") return "select";
377
- if (step === "review") return "review";
378
- return "submit";
379
- }
380
- function ClaimModal({
381
- signRecovery,
382
- isOpen,
383
- onClose,
384
- inline,
385
- closeOnOverlayClick,
386
- backendUrl,
387
- rpcUrls: rpcUrlsProp,
388
- defaultTxHash,
389
- defaultRefundDestination,
390
- theme,
391
- uiConfig,
392
- className,
393
- onReady,
394
- onLifecycle,
395
- onEvent,
396
- onError,
397
- enableAnalyticsIngest,
398
- analyticsIngestUrl,
399
- debug,
400
- onUiState
401
- }) {
402
- _chunkV2OBGLJDcjs.checkBackendUrl.call(void 0, "ClaimModal", backendUrl);
403
- const modalRef = _react.useRef.call(void 0, null);
404
- const onReadyRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onReady);
405
- const onLifecycleRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onLifecycle);
406
- const onErrorRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onError);
407
- const analyticsControllerRef = _react.useRef.call(void 0, null);
408
- const lastSubmitFailureRef = _react.useRef.call(void 0, null);
409
- const previousOpenRef = _react.useRef.call(void 0, isOpen);
410
- const rpcUrls = _chunkV2OBGLJDcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
411
- const service = _react.useMemo.call(void 0,
412
- () => _chunkV2OBGLJDcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:claim" }),
413
- [backendUrl, debug]
414
- );
415
- const [state, dispatch] = _react.useReducer.call(void 0, claimReducer, INITIAL_STATE);
416
- const operationEpochRef = _react.useRef.call(void 0, 0);
417
- const isOpenRef = _react.useRef.call(void 0, isOpen);
418
- isOpenRef.current = isOpen;
419
- _react.useEffect.call(void 0, () => {
420
- if (!isOpen || !modalRef.current) return;
421
- return _chunkV2OBGLJDcjs.applyTheme.call(void 0, modalRef.current, theme);
422
- }, [isOpen, theme]);
423
- _react.useEffect.call(void 0, () => {
424
- if (isOpen) {
425
- _optionalChain([onReadyRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4()]);
426
- }
427
- }, [isOpen, onReadyRef]);
428
- _react.useEffect.call(void 0, () => {
429
- if (previousOpenRef.current && !isOpen) {
430
- const analytics = analyticsControllerRef.current;
431
- _optionalChain([analytics, 'optionalAccess', _5 => _5.abandon, 'call', _6 => _6("modal_close")]);
432
- _optionalChain([analytics, 'optionalAccess', _7 => _7.close, 'call', _8 => _8("host_controlled")]);
433
- }
434
- previousOpenRef.current = isOpen;
435
- }, [isOpen]);
436
- _react.useEffect.call(void 0, () => {
437
- if (!isOpen) {
438
- operationEpochRef.current += 1;
439
- dispatch({ type: "reset" });
440
- }
441
- }, [isOpen]);
442
- const closeWithSource = _react.useCallback.call(void 0,
443
- (source) => {
444
- const analytics = analyticsControllerRef.current;
445
- if (state.step === "processing") {
446
- _optionalChain([analytics, 'optionalAccess', _9 => _9.friction, 'call', _10 => _10("modal_close_refused_in_flight", "submit")]);
447
- return;
448
- }
449
- _optionalChain([analytics, 'optionalAccess', _11 => _11.abandon, 'call', _12 => _12("modal_close")]);
450
- _optionalChain([analytics, 'optionalAccess', _13 => _13.close, 'call', _14 => _14(source)]);
451
- operationEpochRef.current += 1;
452
- onClose();
453
- },
454
- [state.step, onClose]
455
- );
456
- const handleModalDismiss = _react.useCallback.call(void 0,
457
- (reason) => {
458
- closeWithSource(
459
- reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
460
- );
461
- },
462
- [closeWithSource]
463
- );
464
- const goBack = _react.useCallback.call(void 0, () => {
465
- const analytics = analyticsControllerRef.current;
466
- const previousFailure = lastSubmitFailureRef.current;
467
- if (state.step === "failed" && _optionalChain([previousFailure, 'optionalAccess', _15 => _15.retryable])) {
468
- lastSubmitFailureRef.current = null;
469
- _optionalChain([analytics, 'optionalAccess', _16 => _16.retry, 'call', _17 => _17(previousFailure.reason, "submit")]);
470
- } else {
471
- if (state.step === "failed") {
472
- lastSubmitFailureRef.current = null;
473
- _optionalChain([analytics, 'optionalAccess', _18 => _18.rearmStep, 'call', _19 => _19("submit")]);
474
- }
475
- _optionalChain([analytics, 'optionalAccess', _20 => _20.abandon, 'call', _21 => _21("back")]);
476
- }
477
- dispatch({ type: "back" });
478
- }, [state.step]);
479
- const canGoBack = state.step === "select" || state.step === "review" || state.step === "failed";
480
- const onUiStateRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onUiState);
481
- _react.useEffect.call(void 0, () => {
482
- _optionalChain([onUiStateRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({
483
- screen: state.step,
484
- back: canGoBack ? goBack : void 0,
485
- submitting: state.step === "processing"
486
- })]);
487
- }, [state.step, canGoBack, goBack, onUiStateRef]);
488
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _24 => _24.showBackButton]), () => ( true));
489
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
490
- _chunkV2OBGLJDcjs.Modal,
491
- {
492
- isOpen,
493
- onClose: handleModalDismiss,
494
- className,
495
- inline,
496
- closeOnOverlayClick,
497
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
498
- _chunkV2OBGLJDcjs.AnalyticsSession,
499
- {
500
- modal: "claim",
501
- sessionProperties: buildClaimAnalyticsSessionProperties({
502
- inline,
503
- closeOnOverlayClick,
504
- defaultTxHash,
505
- defaultRefundDestination
506
- }),
507
- onEvent,
508
- backendUrl,
509
- enableIngest: enableAnalyticsIngest,
510
- ingestUrl: analyticsIngestUrl,
511
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClaimAnalyticsControllerProvider, { controllerRef: analyticsControllerRef, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: modalRef, className: "rs-modal", children: [
512
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
513
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
514
- "button",
515
- {
516
- type: "button",
517
- className: "rs-modal-header-back",
518
- "aria-label": "Go back",
519
- onClick: goBack,
520
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ChevronLeftIcon, {})
521
- }
522
- ) }),
523
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
524
- "button",
525
- {
526
- type: "button",
527
- onClick: () => closeWithSource("header_button"),
528
- disabled: state.step === "processing",
529
- className: "rs-modal-close",
530
- "aria-label": "Close",
531
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CloseIcon, {})
532
- }
533
- ) })
534
- ] }),
535
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
536
- ClaimBody,
537
- {
538
- state,
539
- dispatch,
540
- service,
541
- signRecovery,
542
- backendUrl,
543
- debug,
544
- defaultTxHash,
545
- defaultRefundDestination,
546
- onClose: closeWithSource,
547
- onBack: goBack,
548
- operationEpochRef,
549
- isOpenRef,
550
- lastSubmitFailureRef,
551
- onLifecycleRef,
552
- onErrorRef
553
- }
554
- ) })
555
- ] }) })
556
- }
557
- )
558
- }
559
- ) }) });
560
- }
561
- function ClaimBody({
562
- state,
563
- dispatch,
564
- service,
565
- signRecovery,
566
- backendUrl,
567
- debug,
568
- defaultTxHash,
569
- defaultRefundDestination,
570
- onClose,
571
- onBack,
572
- operationEpochRef,
573
- isOpenRef,
574
- lastSubmitFailureRef,
575
- onLifecycleRef,
576
- onErrorRef
577
- }) {
578
- const analytics = useClaimAnalyticsController();
579
- _react.useEffect.call(void 0, () => {
580
- analytics.openSession();
581
- analytics.openStep(analyticsStepForClaimStep(state.step));
582
- }, [analytics, state.step]);
583
- switch (state.step) {
584
- case "lookup":
585
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
586
- LookupStep,
587
- {
588
- service,
589
- defaultTxHash,
590
- operationEpochRef,
591
- isOpenRef,
592
- onResults: (deposits) => {
593
- const eligible = deposits.filter(isEligible);
594
- const autoSelect = deposits.length === 1 && eligible.length === 1 ? deposits[0] : null;
595
- analytics.completeStep("lookup");
596
- if (autoSelect) reportSelection(autoSelect, true);
597
- dispatch({ type: "lookup/results", deposits, autoSelect });
598
- },
599
- onLifecycleRef,
600
- onErrorRef
601
- }
602
- );
603
- case "select":
604
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
605
- SelectStep,
606
- {
607
- deposits: state.deposits,
608
- onSelect: (deposit) => {
609
- analytics.completeStep("select");
610
- reportSelection(deposit, false);
611
- dispatch({ type: "select", deposit });
612
- }
613
- }
614
- );
615
- case "review":
616
- case "processing":
617
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
618
- ReviewStep,
619
- {
620
- deposit: state.selected,
621
- submitting: state.step === "processing",
622
- defaultRefundDestination,
623
- onSubmit: (destination) => submitRecoveryRequest(destination)
624
- }
625
- );
626
- case "complete":
627
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
628
- ResultStep,
629
- {
630
- result: state.result,
631
- onClose: () => onClose("success_done"),
632
- onReset: () => {
633
- analytics.resetAttempt();
634
- dispatch({ type: "reset" });
635
- }
636
- }
637
- );
638
- case "failed":
639
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
640
- ResultStep,
641
- {
642
- error: state.error,
643
- onClose: () => onClose("failure_cancel"),
644
- onRetry: state.retryable ? onBack : void 0
645
- }
646
- );
647
- default:
648
- return null;
649
- }
650
- function reportSelection(deposit, autoSelected) {
651
- if (!deposit.id) return;
652
- analytics.selectDeposit({
653
- depositId: deposit.id,
654
- transactionHash: _nullishCoalesce(deposit.txHash, () => ( null)),
655
- autoSelected
656
- });
657
- }
658
- async function submitRecoveryRequest(destination) {
659
- const deposit = state.selected;
660
- if (!deposit) return;
661
- const sourceChainId = evmChainIdFromCaip2(deposit.chain);
662
- if (sourceChainId == null || !deposit.id || !deposit.recipient || !deposit.depositAddress || !deposit.token || !deposit.chain) {
663
- analytics.failure("recovery_deposit_data_incomplete", false, "review");
664
- analytics.outcome("failed");
665
- dispatch({
666
- type: "failed",
667
- error: "Deposit is missing data required to recover it.",
668
- // The missing fields come off the backend row already in memory, so a
669
- // retry re-reads nothing and fails identically. Offering one would be a
670
- // dead end, and would also contradict the `retryable` reported above.
671
- retryable: false
672
- });
673
- return;
674
- }
675
- const signer = deposit.recipient;
676
- const account = deposit.depositAddress;
677
- const token = deposit.token;
678
- const operationEpoch = operationEpochRef.current;
679
- const isCurrentOperation = () => isOpenRef.current && operationEpochRef.current === operationEpoch;
680
- analytics.completeStep("review");
681
- analytics.openStep("submit");
682
- dispatch({ type: "submit" });
683
- _optionalChain([onLifecycleRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26({
684
- type: "refund_requested",
685
- account,
686
- destination,
687
- chain: sourceChainId
688
- })]);
689
- try {
690
- const result = await _chunkX2IPAPXUcjs.submitSignedRecovery.call(void 0, {
691
- backendUrl,
692
- chainId: sourceChainId,
693
- depositId: deposit.id,
694
- signer,
695
- destination,
696
- signRecovery,
697
- debug
698
- });
699
- if (!isCurrentOperation()) return;
700
- const paidTo = destination;
701
- const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, token, sourceChainId);
702
- const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, token, sourceChainId);
703
- const refundedRaw = BigInt(
704
- _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(result.amount, () => ( deposit.sourceAmount)), () => ( deposit.amount)), () => ( "0"))
705
- );
706
- const amountDisplay = _nullishCoalesce(_chunkV2OBGLJDcjs.formatTokenAmount.call(void 0, Number(_viem.formatUnits.call(void 0, refundedRaw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, refundedRaw, decimals)));
707
- dispatch({
708
- type: "complete",
709
- txHash: result.transactionHash,
710
- amount: result.amount,
711
- amountDisplay,
712
- symbol,
713
- destination: paidTo,
714
- chain: sourceChainId
715
- });
716
- analytics.handoff(
717
- {
718
- depositId: deposit.id,
719
- transactionHash: _nullishCoalesce(deposit.txHash, () => ( null)),
720
- refundTransactionHash: result.transactionHash
721
- },
722
- "submit"
723
- );
724
- analytics.completeStep("submit");
725
- analytics.outcome("completed");
726
- _optionalChain([onLifecycleRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28({
727
- type: "complete",
728
- txHash: result.transactionHash,
729
- account,
730
- destination: paidTo,
731
- chain: sourceChainId,
732
- token,
733
- amount: result.amount
734
- })]);
735
- } catch (err) {
736
- if (!isCurrentOperation()) return;
737
- const recoveryError = err instanceof _chunkX2IPAPXUcjs.RecoveryError ? err : void 0;
738
- const status = _optionalChain([recoveryError, 'optionalAccess', _29 => _29.status]);
739
- const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _30 => _30.message]), () => ( _chunkV2OBGLJDcjs.formatUserError.call(void 0,
740
- err instanceof Error ? err.message : "Recovery failed"
741
- )));
742
- const retryable = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _31 => _31.retryable]), () => ( true));
743
- dispatch({
744
- type: "failed",
745
- error: message,
746
- retryable
747
- });
748
- const reason = claimFailureReasonForError(err);
749
- lastSubmitFailureRef.current = { reason, retryable };
750
- analytics.failure(reason, retryable, "submit");
751
- analytics.outcome("failed");
752
- _optionalChain([onLifecycleRef, 'access', _32 => _32.current, 'optionalCall', _33 => _33({ type: "failed", status, error: message })]);
753
- _optionalChain([onErrorRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35({ message, code: "CLAIM_FAILED" })]);
754
- }
755
- }
756
- }
757
- function LookupStep({
758
- service,
759
- defaultTxHash,
760
- operationEpochRef,
761
- isOpenRef,
762
- onResults,
763
- onLifecycleRef,
764
- onErrorRef
765
- }) {
766
- const analytics = useClaimAnalyticsController();
767
- const [txHash, setTxHash] = _react.useState.call(void 0, _nullishCoalesce(defaultTxHash, () => ( "")));
768
- const [loading, setLoading] = _react.useState.call(void 0, false);
769
- const [error, setError] = _react.useState.call(void 0, null);
770
- const trimmed = txHash.trim();
771
- const validTxHash = /^0x[a-fA-F0-9]{64}$/.test(trimmed);
772
- _react.useEffect.call(void 0, () => {
773
- if (trimmed.length > 0 && !validTxHash) {
774
- analytics.friction("lookup_transaction_hash_invalid", "lookup");
775
- }
776
- }, [analytics, trimmed, validTxHash]);
777
- const handleLookup = _react.useCallback.call(void 0, async () => {
778
- const operationEpoch = operationEpochRef.current;
779
- const isCurrentOperation = () => isOpenRef.current && operationEpochRef.current === operationEpoch;
780
- setError(null);
781
- setLoading(true);
782
- analytics.rearmStep("lookup");
783
- try {
784
- const deposits = await service.lookupRecoverableDeposits({
785
- txHash: trimmed
786
- });
787
- if (!isCurrentOperation()) return;
788
- _optionalChain([onLifecycleRef, 'access', _36 => _36.current, 'optionalCall', _37 => _37({
789
- type: "lookup",
790
- txHash: trimmed,
791
- matches: deposits.length
792
- })]);
793
- const eligible = deposits.filter(isEligible);
794
- analytics.lookupResult(deposits.length, eligible.length);
795
- if (deposits.length === 0) {
796
- analytics.friction("lookup_no_deposits_found", "lookup");
797
- setError("No deposits found for this transaction.");
798
- return;
799
- }
800
- if (eligible.length === 0) {
801
- analytics.friction("lookup_no_eligible_deposits", "lookup");
802
- setError(
803
- "This transaction has no failed or rejected deposits available to recover."
804
- );
805
- return;
806
- }
807
- onResults(deposits);
808
- } catch (err) {
809
- if (!isCurrentOperation()) return;
810
- const message = _chunkV2OBGLJDcjs.formatUserError.call(void 0,
811
- err instanceof Error ? err.message : "Lookup failed"
812
- );
813
- analytics.failure("lookup_failed", true, "lookup");
814
- setError(message);
815
- _optionalChain([onErrorRef, 'access', _38 => _38.current, 'optionalCall', _39 => _39({ message, code: "CLAIM_LOOKUP_FAILED" })]);
816
- } finally {
817
- if (isCurrentOperation()) setLoading(false);
818
- }
819
- }, [
820
- analytics,
821
- trimmed,
822
- service,
823
- operationEpochRef,
824
- isOpenRef,
825
- onResults,
826
- onLifecycleRef,
827
- onErrorRef
828
- ]);
829
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
830
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
831
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
832
- _chunkV2OBGLJDcjs.BodyHeader,
833
- {
834
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.HandCoinsIcon, {}),
835
- title: "Claim a deposit",
836
- subtitle: "Get funds from a failed deposit sent back to you on the source chain."
837
- }
838
- ),
839
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
840
- Input,
841
- {
842
- label: "Transaction hash",
843
- placeholder: "0x\u2026",
844
- value: txHash,
845
- onChange: (e) => setTxHash(e.target.value),
846
- error: trimmed.length > 0 && !validTxHash ? "Enter a valid transaction hash" : void 0
847
- }
848
- ),
849
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
850
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
851
- _chunkV2OBGLJDcjs.Button,
852
- {
853
- onClick: handleLookup,
854
- loading,
855
- loadingText: "Searching\u2026",
856
- disabled: !validTxHash,
857
- fullWidth: true,
858
- children: "Find deposit"
859
- }
860
- )
861
- ] }),
862
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
863
- ] });
864
- }
865
- function SelectStep({
866
- deposits,
867
- onSelect
868
- }) {
869
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
870
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
871
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
872
- _chunkV2OBGLJDcjs.BodyHeader,
873
- {
874
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CoinsIcon, {}),
875
- title: "Select a deposit",
876
- subtitle: "This transaction produced multiple deposits. Choose the one to claim."
877
- }
878
- ),
879
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: deposits.map((row) => {
880
- const { symbol, amount, chainName } = describeDeposit(row);
881
- const eligible = isEligible(row);
882
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
883
- _chunkLZFRL2ALcjs.ListRow,
884
- {
885
- leadingMedia: _chunk4KCSH4T3cjs.tokenIconUrl.call(void 0, symbol),
886
- title: `${amount} ${symbol}`,
887
- subtitle: chainName,
888
- meta: eligible ? void 0 : humanizeStatus(row.status),
889
- disabled: !eligible,
890
- onClick: () => eligible && onSelect(row)
891
- },
892
- _nullishCoalesce(row.id, () => ( `${row.depositAddress}:${row.token}`))
893
- );
894
- }) })
895
- ] }),
896
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
897
- ] });
898
- }
899
- function ReviewStep({
900
- deposit,
901
- submitting,
902
- defaultRefundDestination,
903
- onSubmit
904
- }) {
905
- const analytics = useClaimAnalyticsController();
906
- const { chainId, symbol, amount, chainName, chainIcon } = describeDeposit(deposit);
907
- const explorerTxUrl = _chunkV2OBGLJDcjs.useExplorerTxUrl.call(void 0, );
908
- const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultRefundDestination, () => ( "")));
909
- const destinationValid = _viem.isAddress.call(void 0, destination);
910
- _react.useEffect.call(void 0, () => {
911
- if (destination.length > 0 && !destinationValid) {
912
- analytics.friction("refund_destination_invalid", "review");
913
- }
914
- }, [analytics, destination, destinationValid]);
915
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
916
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
917
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
918
- _chunkV2OBGLJDcjs.BodyHeader,
919
- {
920
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.HandCoinsIcon, {}),
921
- title: "Review refund",
922
- subtitle: "This returns the funds on the source chain. It does not retry the original bridge."
923
- }
924
- ),
925
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
926
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
927
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
928
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
929
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
930
- amount,
931
- " ",
932
- symbol
933
- ] }),
934
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol }) })
935
- ] })
936
- ] }),
937
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
938
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
939
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
940
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
941
- chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CdnIcon, { src: chainIcon }) })
942
- ] })
943
- ] }),
944
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
945
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposit transaction" }),
946
- (() => {
947
- const url = deposit.txHash ? explorerTxUrl(chainId, deposit.txHash) : null;
948
- const short = deposit.txHash ? shortenHash(deposit.txHash) : "\u2014";
949
- return url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
950
- "a",
951
- {
952
- className: "rs-review-detail-value rs-link",
953
- href: url,
954
- target: "_blank",
955
- rel: "noreferrer",
956
- children: [
957
- short,
958
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ExternalLinkIcon, {})
959
- ]
960
- }
961
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
962
- })()
963
- ] })
964
- ] }),
965
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
966
- Input,
967
- {
968
- label: "Send to",
969
- placeholder: "0x\u2026",
970
- value: destination,
971
- onChange: (e) => setDestination(e.target.value),
972
- error: destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
973
- }
974
- ),
975
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
976
- _chunkV2OBGLJDcjs.Button,
977
- {
978
- onClick: () => destinationValid && onSubmit(destination),
979
- loading: submitting,
980
- loadingText: "Refunding\u2026",
981
- disabled: !destinationValid,
982
- fullWidth: true,
983
- children: "Claim refund"
984
- }
985
- )
986
- ] }),
987
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
988
- ] });
989
- }
990
- function ResultStep({
991
- result,
992
- error,
993
- onClose,
994
- onReset,
995
- onRetry
996
- }) {
997
- const success = !!result;
998
- const explorerTxUrl = _chunkV2OBGLJDcjs.useExplorerTxUrl.call(void 0, );
999
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
1000
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1001
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1002
- _chunkV2OBGLJDcjs.BodyHeader,
1003
- {
1004
- icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.AlertTriangleIcon, {}),
1005
- variant: success ? "success" : "error",
1006
- title: success ? "Refund submitted" : "Refund failed",
1007
- subtitle: success ? "Your funds are being returned on the source chain." : void 0
1008
- }
1009
- ),
1010
- success ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
1011
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
1012
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
1013
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
1014
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
1015
- result.amountDisplay,
1016
- " ",
1017
- result.symbol
1018
- ] }),
1019
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol: result.symbol }) })
1020
- ] })
1021
- ] }),
1022
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
1023
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Sent to" }),
1024
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenAddress(result.destination) })
1025
- ] }),
1026
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
1027
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Transaction" }),
1028
- (() => {
1029
- const url = explorerTxUrl(result.chain, result.txHash);
1030
- const short = shortenHash(result.txHash);
1031
- return url ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1032
- "a",
1033
- {
1034
- className: "rs-review-detail-value rs-link",
1035
- href: url,
1036
- target: "_blank",
1037
- rel: "noreferrer",
1038
- children: [
1039
- short,
1040
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ExternalLinkIcon, {})
1041
- ]
1042
- }
1043
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
1044
- })()
1045
- ] })
1046
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
1047
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children: success ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1048
- onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Button, { variant: "outline", onClick: onReset, fullWidth: true, children: "Claim another deposit" }),
1049
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Button, { onClick: onClose, fullWidth: true, children: "Done" })
1050
- ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1051
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
1052
- onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Button, { onClick: onRetry, fullWidth: true, children: "Try again" })
1053
- ] }) })
1054
- ] }),
1055
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
1056
- ] });
1057
- }
1058
-
1059
-
1060
-
1061
-
1062
- exports.buildClaimAnalyticsSessionProperties = buildClaimAnalyticsSessionProperties; exports.ClaimModal = ClaimModal;