@rhinestone/deposit-modal 0.13.0 → 0.14.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.
- package/README.md +43 -2
- package/bridge-transcript.json +653 -0
- package/dist/ClaimModal-IKTJU43Y.cjs +13 -0
- package/dist/ClaimModal-SEKNWRMA.mjs +13 -0
- package/dist/{DepositModalReown-YNNHLAV2.cjs → DepositModalReown-46LPVFB6.cjs} +16 -15
- package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-Q2JMLT47.mjs} +6 -5
- package/dist/WithdrawModal-5ICGD4HJ.mjs +12 -0
- package/dist/WithdrawModal-VP6PMIRO.cjs +12 -0
- package/dist/{chunk-GACIGCSN.cjs → chunk-6KG642KH.cjs} +1 -1
- package/dist/{chunk-RAADLTSW.cjs → chunk-7ICSHJFE.cjs} +179 -138
- package/dist/{chunk-COCBCQQC.mjs → chunk-7SR7ENVJ.mjs} +46 -5
- package/dist/{chunk-OLCD75JK.mjs → chunk-CFKC77SV.mjs} +451 -131
- package/dist/{chunk-EOMT5LKX.mjs → chunk-IN77XSWO.mjs} +526 -3
- package/dist/{chunk-FZ5FZFIG.mjs → chunk-K4H6TGBE.mjs} +1 -1
- package/dist/{chunk-DSIZNRWA.mjs → chunk-KTUVSKR4.mjs} +979 -360
- package/dist/{chunk-HOGZKHHY.cjs → chunk-LZFRL2AL.cjs} +3 -3
- package/dist/{chunk-7N77GIP4.cjs → chunk-MTFJSE52.cjs} +465 -171
- package/dist/{chunk-LTMMETAB.mjs → chunk-PKML3XVS.mjs} +404 -110
- package/dist/{chunk-ZMT4ATHR.cjs → chunk-V2OBGLJD.cjs} +564 -41
- package/dist/{chunk-XYJFEN5D.mjs → chunk-WUJIKCFU.mjs} +1 -1
- package/dist/{chunk-CVGNCUVU.cjs → chunk-X2IPAPXU.cjs} +22 -13
- package/dist/{chunk-2G2EIN4A.cjs → chunk-YCQZJQO6.cjs} +1272 -653
- package/dist/{chunk-5NUIKYSF.cjs → chunk-YWMWI7PZ.cjs} +458 -138
- package/dist/{chunk-YREVFB64.mjs → chunk-ZEO6ADM3.mjs} +16 -7
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +310 -102
- package/dist/embed.d.cts +7 -1
- package/dist/embed.d.ts +7 -1
- package/dist/embed.mjs +285 -77
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -8
- package/dist/types-Bho4OA03.d.ts +982 -0
- package/dist/types-DP_3KwlD.d.cts +982 -0
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +4 -4
- package/package.json +28 -7
- package/dist/ClaimModal-CREZO27I.mjs +0 -11
- package/dist/ClaimModal-JRIA32U2.cjs +0 -11
- package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
- package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
- package/dist/types-B89I8_8H.d.ts +0 -638
- package/dist/types-nnDR4tqA.d.cts +0 -638
|
@@ -1,10 +1,10 @@
|
|
|
1
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
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkX2IPAPXUcjs = require('./chunk-X2IPAPXU.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkLZFRL2ALcjs = require('./chunk-LZFRL2AL.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -30,7 +30,9 @@ var _chunkHOGZKHHYcjs = require('./chunk-HOGZKHHY.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
|
|
@@ -67,7 +69,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
67
69
|
}
|
|
68
70
|
),
|
|
69
71
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
70
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
72
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
71
73
|
error
|
|
72
74
|
] })
|
|
73
75
|
] });
|
|
@@ -75,6 +77,191 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
75
77
|
);
|
|
76
78
|
Input.displayName = "Input";
|
|
77
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
|
+
|
|
78
265
|
// src/ClaimModal.tsx
|
|
79
266
|
|
|
80
267
|
function evmChainIdFromCaip2(chain) {
|
|
@@ -91,7 +278,7 @@ function describeDeposit(row) {
|
|
|
91
278
|
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, row.token, chainId);
|
|
92
279
|
const raw = BigInt(_nullishCoalesce(_nullishCoalesce(row.sourceAmount, () => ( row.amount)), () => ( "0")));
|
|
93
280
|
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
94
|
-
const amount = _nullishCoalesce(
|
|
281
|
+
const amount = _nullishCoalesce(_chunkV2OBGLJDcjs.formatTokenAmount.call(void 0, human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
95
282
|
return {
|
|
96
283
|
chainId,
|
|
97
284
|
symbol,
|
|
@@ -169,6 +356,27 @@ function claimReducer(state, action) {
|
|
|
169
356
|
return state;
|
|
170
357
|
}
|
|
171
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
|
+
}
|
|
172
380
|
function ClaimModal({
|
|
173
381
|
signRecovery,
|
|
174
382
|
isOpen,
|
|
@@ -186,18 +394,22 @@ function ClaimModal({
|
|
|
186
394
|
onLifecycle,
|
|
187
395
|
onEvent,
|
|
188
396
|
onError,
|
|
397
|
+
enableAnalyticsIngest,
|
|
398
|
+
analyticsIngestUrl,
|
|
189
399
|
debug,
|
|
190
400
|
onUiState
|
|
191
401
|
}) {
|
|
192
|
-
|
|
402
|
+
_chunkV2OBGLJDcjs.checkBackendUrl.call(void 0, "ClaimModal", backendUrl);
|
|
193
403
|
const modalRef = _react.useRef.call(void 0, null);
|
|
194
|
-
const onReadyRef =
|
|
195
|
-
const onLifecycleRef =
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
const
|
|
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);
|
|
199
411
|
const service = _react.useMemo.call(void 0,
|
|
200
|
-
() =>
|
|
412
|
+
() => _chunkV2OBGLJDcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:claim" }),
|
|
201
413
|
[backendUrl, debug]
|
|
202
414
|
);
|
|
203
415
|
const [state, dispatch] = _react.useReducer.call(void 0, claimReducer, INITIAL_STATE);
|
|
@@ -206,88 +418,143 @@ function ClaimModal({
|
|
|
206
418
|
isOpenRef.current = isOpen;
|
|
207
419
|
_react.useEffect.call(void 0, () => {
|
|
208
420
|
if (!isOpen || !modalRef.current) return;
|
|
209
|
-
return
|
|
421
|
+
return _chunkV2OBGLJDcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
210
422
|
}, [isOpen, theme]);
|
|
211
423
|
_react.useEffect.call(void 0, () => {
|
|
212
424
|
if (isOpen) {
|
|
213
425
|
_optionalChain([onReadyRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4()]);
|
|
214
|
-
_optionalChain([onEventRef, 'access', _5 => _5.current, 'optionalCall', _6 => _6({ type: "claim_modal_open" })]);
|
|
215
426
|
}
|
|
216
|
-
}, [isOpen, onReadyRef
|
|
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]);
|
|
217
436
|
_react.useEffect.call(void 0, () => {
|
|
218
437
|
if (!isOpen) {
|
|
219
438
|
operationEpochRef.current += 1;
|
|
220
439
|
dispatch({ type: "reset" });
|
|
221
440
|
}
|
|
222
441
|
}, [isOpen]);
|
|
223
|
-
const
|
|
224
|
-
|
|
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)]);
|
|
225
451
|
operationEpochRef.current += 1;
|
|
226
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")]);
|
|
227
476
|
}
|
|
228
|
-
|
|
477
|
+
dispatch({ type: "back" });
|
|
478
|
+
}, [state.step]);
|
|
229
479
|
const canGoBack = state.step === "select" || state.step === "review" || state.step === "failed";
|
|
230
|
-
const onUiStateRef =
|
|
480
|
+
const onUiStateRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onUiState);
|
|
231
481
|
_react.useEffect.call(void 0, () => {
|
|
232
|
-
_optionalChain([onUiStateRef, 'access',
|
|
482
|
+
_optionalChain([onUiStateRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({
|
|
233
483
|
screen: state.step,
|
|
234
|
-
back: canGoBack ?
|
|
484
|
+
back: canGoBack ? goBack : void 0,
|
|
235
485
|
submitting: state.step === "processing"
|
|
236
486
|
})]);
|
|
237
|
-
}, [state.step, canGoBack, onUiStateRef]);
|
|
238
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
239
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
-
|
|
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,
|
|
241
491
|
{
|
|
242
492
|
isOpen,
|
|
243
|
-
onClose:
|
|
493
|
+
onClose: handleModalDismiss,
|
|
244
494
|
className,
|
|
245
495
|
inline,
|
|
246
496
|
closeOnOverlayClick,
|
|
247
|
-
children: /* @__PURE__ */ _jsxruntime.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"aria-label": "Go back",
|
|
255
|
-
onClick: () => dispatch({ type: "back" }),
|
|
256
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.ChevronLeftIcon, {})
|
|
257
|
-
}
|
|
258
|
-
) }),
|
|
259
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
260
|
-
"button",
|
|
261
|
-
{
|
|
262
|
-
type: "button",
|
|
263
|
-
onClick: handleClose,
|
|
264
|
-
disabled: state.step === "processing",
|
|
265
|
-
className: "rs-modal-close",
|
|
266
|
-
"aria-label": "Close",
|
|
267
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZMT4ATHRcjs.CloseIcon, {})
|
|
268
|
-
}
|
|
269
|
-
) })
|
|
270
|
-
] }),
|
|
271
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
272
|
-
ClaimBody,
|
|
273
|
-
{
|
|
274
|
-
state,
|
|
275
|
-
dispatch,
|
|
276
|
-
service,
|
|
277
|
-
signRecovery,
|
|
278
|
-
backendUrl,
|
|
279
|
-
debug,
|
|
497
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
498
|
+
_chunkV2OBGLJDcjs.AnalyticsSession,
|
|
499
|
+
{
|
|
500
|
+
modal: "claim",
|
|
501
|
+
sessionProperties: buildClaimAnalyticsSessionProperties({
|
|
502
|
+
inline,
|
|
503
|
+
closeOnOverlayClick,
|
|
280
504
|
defaultTxHash,
|
|
281
|
-
defaultRefundDestination
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
+
)
|
|
291
558
|
}
|
|
292
559
|
) }) });
|
|
293
560
|
}
|
|
@@ -301,12 +568,18 @@ function ClaimBody({
|
|
|
301
568
|
defaultTxHash,
|
|
302
569
|
defaultRefundDestination,
|
|
303
570
|
onClose,
|
|
571
|
+
onBack,
|
|
304
572
|
operationEpochRef,
|
|
305
573
|
isOpenRef,
|
|
574
|
+
lastSubmitFailureRef,
|
|
306
575
|
onLifecycleRef,
|
|
307
|
-
onEventRef,
|
|
308
576
|
onErrorRef
|
|
309
577
|
}) {
|
|
578
|
+
const analytics = useClaimAnalyticsController();
|
|
579
|
+
_react.useEffect.call(void 0, () => {
|
|
580
|
+
analytics.openSession();
|
|
581
|
+
analytics.openStep(analyticsStepForClaimStep(state.step));
|
|
582
|
+
}, [analytics, state.step]);
|
|
310
583
|
switch (state.step) {
|
|
311
584
|
case "lookup":
|
|
312
585
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -319,10 +592,11 @@ function ClaimBody({
|
|
|
319
592
|
onResults: (deposits) => {
|
|
320
593
|
const eligible = deposits.filter(isEligible);
|
|
321
594
|
const autoSelect = deposits.length === 1 && eligible.length === 1 ? deposits[0] : null;
|
|
595
|
+
analytics.completeStep("lookup");
|
|
596
|
+
if (autoSelect) reportSelection(autoSelect, true);
|
|
322
597
|
dispatch({ type: "lookup/results", deposits, autoSelect });
|
|
323
598
|
},
|
|
324
599
|
onLifecycleRef,
|
|
325
|
-
onEventRef,
|
|
326
600
|
onErrorRef
|
|
327
601
|
}
|
|
328
602
|
);
|
|
@@ -331,7 +605,11 @@ function ClaimBody({
|
|
|
331
605
|
SelectStep,
|
|
332
606
|
{
|
|
333
607
|
deposits: state.deposits,
|
|
334
|
-
onSelect: (deposit) =>
|
|
608
|
+
onSelect: (deposit) => {
|
|
609
|
+
analytics.completeStep("select");
|
|
610
|
+
reportSelection(deposit, false);
|
|
611
|
+
dispatch({ type: "select", deposit });
|
|
612
|
+
}
|
|
335
613
|
}
|
|
336
614
|
);
|
|
337
615
|
case "review":
|
|
@@ -346,27 +624,51 @@ function ClaimBody({
|
|
|
346
624
|
}
|
|
347
625
|
);
|
|
348
626
|
case "complete":
|
|
349
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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
|
+
);
|
|
350
638
|
case "failed":
|
|
351
639
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
352
640
|
ResultStep,
|
|
353
641
|
{
|
|
354
642
|
error: state.error,
|
|
355
|
-
onClose,
|
|
356
|
-
onRetry: state.retryable ?
|
|
643
|
+
onClose: () => onClose("failure_cancel"),
|
|
644
|
+
onRetry: state.retryable ? onBack : void 0
|
|
357
645
|
}
|
|
358
646
|
);
|
|
359
647
|
default:
|
|
360
648
|
return null;
|
|
361
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
|
+
}
|
|
362
658
|
async function submitRecoveryRequest(destination) {
|
|
363
659
|
const deposit = state.selected;
|
|
364
660
|
if (!deposit) return;
|
|
365
661
|
const sourceChainId = evmChainIdFromCaip2(deposit.chain);
|
|
366
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");
|
|
367
665
|
dispatch({
|
|
368
666
|
type: "failed",
|
|
369
|
-
error: "Deposit is missing data required to recover it."
|
|
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
|
|
370
672
|
});
|
|
371
673
|
return;
|
|
372
674
|
}
|
|
@@ -375,19 +677,17 @@ function ClaimBody({
|
|
|
375
677
|
const token = deposit.token;
|
|
376
678
|
const operationEpoch = operationEpochRef.current;
|
|
377
679
|
const isCurrentOperation = () => isOpenRef.current && operationEpochRef.current === operationEpoch;
|
|
680
|
+
analytics.completeStep("review");
|
|
681
|
+
analytics.openStep("submit");
|
|
378
682
|
dispatch({ type: "submit" });
|
|
379
|
-
_optionalChain([
|
|
380
|
-
type: "claim_modal_refund_click",
|
|
381
|
-
chain: `eip155:${sourceChainId}`
|
|
382
|
-
})]);
|
|
383
|
-
_optionalChain([onLifecycleRef, 'access', _12 => _12.current, 'optionalCall', _13 => _13({
|
|
683
|
+
_optionalChain([onLifecycleRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26({
|
|
384
684
|
type: "refund_requested",
|
|
385
685
|
account,
|
|
386
686
|
destination,
|
|
387
687
|
chain: sourceChainId
|
|
388
688
|
})]);
|
|
389
689
|
try {
|
|
390
|
-
const result = await
|
|
690
|
+
const result = await _chunkX2IPAPXUcjs.submitSignedRecovery.call(void 0, {
|
|
391
691
|
backendUrl,
|
|
392
692
|
chainId: sourceChainId,
|
|
393
693
|
depositId: deposit.id,
|
|
@@ -403,7 +703,7 @@ function ClaimBody({
|
|
|
403
703
|
const refundedRaw = BigInt(
|
|
404
704
|
_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(result.amount, () => ( deposit.sourceAmount)), () => ( deposit.amount)), () => ( "0"))
|
|
405
705
|
);
|
|
406
|
-
const amountDisplay = _nullishCoalesce(
|
|
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)));
|
|
407
707
|
dispatch({
|
|
408
708
|
type: "complete",
|
|
409
709
|
txHash: result.transactionHash,
|
|
@@ -413,11 +713,17 @@ function ClaimBody({
|
|
|
413
713
|
destination: paidTo,
|
|
414
714
|
chain: sourceChainId
|
|
415
715
|
});
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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({
|
|
421
727
|
type: "complete",
|
|
422
728
|
txHash: result.transactionHash,
|
|
423
729
|
account,
|
|
@@ -428,23 +734,23 @@ function ClaimBody({
|
|
|
428
734
|
})]);
|
|
429
735
|
} catch (err) {
|
|
430
736
|
if (!isCurrentOperation()) return;
|
|
431
|
-
const recoveryError = err instanceof
|
|
432
|
-
const status = _optionalChain([recoveryError, 'optionalAccess',
|
|
433
|
-
const message = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
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,
|
|
434
740
|
err instanceof Error ? err.message : "Recovery failed"
|
|
435
741
|
)));
|
|
742
|
+
const retryable = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _31 => _31.retryable]), () => ( true));
|
|
436
743
|
dispatch({
|
|
437
744
|
type: "failed",
|
|
438
745
|
error: message,
|
|
439
|
-
retryable
|
|
746
|
+
retryable
|
|
440
747
|
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
})]);
|
|
446
|
-
_optionalChain([
|
|
447
|
-
_optionalChain([onErrorRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26({ message, code: "CLAIM_FAILED" })]);
|
|
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" })]);
|
|
448
754
|
}
|
|
449
755
|
}
|
|
450
756
|
}
|
|
@@ -455,38 +761,44 @@ function LookupStep({
|
|
|
455
761
|
isOpenRef,
|
|
456
762
|
onResults,
|
|
457
763
|
onLifecycleRef,
|
|
458
|
-
onEventRef,
|
|
459
764
|
onErrorRef
|
|
460
765
|
}) {
|
|
766
|
+
const analytics = useClaimAnalyticsController();
|
|
461
767
|
const [txHash, setTxHash] = _react.useState.call(void 0, _nullishCoalesce(defaultTxHash, () => ( "")));
|
|
462
768
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
463
769
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
464
770
|
const trimmed = txHash.trim();
|
|
465
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]);
|
|
466
777
|
const handleLookup = _react.useCallback.call(void 0, async () => {
|
|
467
778
|
const operationEpoch = operationEpochRef.current;
|
|
468
779
|
const isCurrentOperation = () => isOpenRef.current && operationEpochRef.current === operationEpoch;
|
|
469
780
|
setError(null);
|
|
470
781
|
setLoading(true);
|
|
782
|
+
analytics.rearmStep("lookup");
|
|
471
783
|
try {
|
|
472
784
|
const deposits = await service.lookupRecoverableDeposits({
|
|
473
785
|
txHash: trimmed
|
|
474
786
|
});
|
|
475
787
|
if (!isCurrentOperation()) return;
|
|
476
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
788
|
+
_optionalChain([onLifecycleRef, 'access', _36 => _36.current, 'optionalCall', _37 => _37({
|
|
477
789
|
type: "lookup",
|
|
478
790
|
txHash: trimmed,
|
|
479
791
|
matches: deposits.length
|
|
480
792
|
})]);
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
matches: deposits.length
|
|
484
|
-
})]);
|
|
793
|
+
const eligible = deposits.filter(isEligible);
|
|
794
|
+
analytics.lookupResult(deposits.length, eligible.length);
|
|
485
795
|
if (deposits.length === 0) {
|
|
796
|
+
analytics.friction("lookup_no_deposits_found", "lookup");
|
|
486
797
|
setError("No deposits found for this transaction.");
|
|
487
798
|
return;
|
|
488
799
|
}
|
|
489
|
-
if (
|
|
800
|
+
if (eligible.length === 0) {
|
|
801
|
+
analytics.friction("lookup_no_eligible_deposits", "lookup");
|
|
490
802
|
setError(
|
|
491
803
|
"This transaction has no failed or rejected deposits available to recover."
|
|
492
804
|
);
|
|
@@ -495,30 +807,31 @@ function LookupStep({
|
|
|
495
807
|
onResults(deposits);
|
|
496
808
|
} catch (err) {
|
|
497
809
|
if (!isCurrentOperation()) return;
|
|
498
|
-
const message =
|
|
810
|
+
const message = _chunkV2OBGLJDcjs.formatUserError.call(void 0,
|
|
499
811
|
err instanceof Error ? err.message : "Lookup failed"
|
|
500
812
|
);
|
|
813
|
+
analytics.failure("lookup_failed", true, "lookup");
|
|
501
814
|
setError(message);
|
|
502
|
-
_optionalChain([onErrorRef, 'access',
|
|
815
|
+
_optionalChain([onErrorRef, 'access', _38 => _38.current, 'optionalCall', _39 => _39({ message, code: "CLAIM_LOOKUP_FAILED" })]);
|
|
503
816
|
} finally {
|
|
504
817
|
if (isCurrentOperation()) setLoading(false);
|
|
505
818
|
}
|
|
506
819
|
}, [
|
|
820
|
+
analytics,
|
|
507
821
|
trimmed,
|
|
508
822
|
service,
|
|
509
823
|
operationEpochRef,
|
|
510
824
|
isOpenRef,
|
|
511
825
|
onResults,
|
|
512
826
|
onLifecycleRef,
|
|
513
|
-
onEventRef,
|
|
514
827
|
onErrorRef
|
|
515
828
|
]);
|
|
516
829
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
517
830
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
518
831
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
519
|
-
|
|
832
|
+
_chunkV2OBGLJDcjs.BodyHeader,
|
|
520
833
|
{
|
|
521
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.HandCoinsIcon, {}),
|
|
522
835
|
title: "Claim a deposit",
|
|
523
836
|
subtitle: "Get funds from a failed deposit sent back to you on the source chain."
|
|
524
837
|
}
|
|
@@ -533,9 +846,9 @@ function LookupStep({
|
|
|
533
846
|
error: trimmed.length > 0 && !validTxHash ? "Enter a valid transaction hash" : void 0
|
|
534
847
|
}
|
|
535
848
|
),
|
|
536
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
849
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
|
|
537
850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
538
|
-
|
|
851
|
+
_chunkV2OBGLJDcjs.Button,
|
|
539
852
|
{
|
|
540
853
|
onClick: handleLookup,
|
|
541
854
|
loading,
|
|
@@ -546,7 +859,7 @@ function LookupStep({
|
|
|
546
859
|
}
|
|
547
860
|
)
|
|
548
861
|
] }),
|
|
549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
862
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
550
863
|
] });
|
|
551
864
|
}
|
|
552
865
|
function SelectStep({
|
|
@@ -556,9 +869,9 @@ function SelectStep({
|
|
|
556
869
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
557
870
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
558
871
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
559
|
-
|
|
872
|
+
_chunkV2OBGLJDcjs.BodyHeader,
|
|
560
873
|
{
|
|
561
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
874
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CoinsIcon, {}),
|
|
562
875
|
title: "Select a deposit",
|
|
563
876
|
subtitle: "This transaction produced multiple deposits. Choose the one to claim."
|
|
564
877
|
}
|
|
@@ -567,7 +880,7 @@ function SelectStep({
|
|
|
567
880
|
const { symbol, amount, chainName } = describeDeposit(row);
|
|
568
881
|
const eligible = isEligible(row);
|
|
569
882
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
570
|
-
|
|
883
|
+
_chunkLZFRL2ALcjs.ListRow,
|
|
571
884
|
{
|
|
572
885
|
leadingMedia: _chunk4KCSH4T3cjs.tokenIconUrl.call(void 0, symbol),
|
|
573
886
|
title: `${amount} ${symbol}`,
|
|
@@ -580,7 +893,7 @@ function SelectStep({
|
|
|
580
893
|
);
|
|
581
894
|
}) })
|
|
582
895
|
] }),
|
|
583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
896
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
584
897
|
] });
|
|
585
898
|
}
|
|
586
899
|
function ReviewStep({
|
|
@@ -589,16 +902,22 @@ function ReviewStep({
|
|
|
589
902
|
defaultRefundDestination,
|
|
590
903
|
onSubmit
|
|
591
904
|
}) {
|
|
905
|
+
const analytics = useClaimAnalyticsController();
|
|
592
906
|
const { chainId, symbol, amount, chainName, chainIcon } = describeDeposit(deposit);
|
|
593
|
-
const explorerTxUrl =
|
|
907
|
+
const explorerTxUrl = _chunkV2OBGLJDcjs.useExplorerTxUrl.call(void 0, );
|
|
594
908
|
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultRefundDestination, () => ( "")));
|
|
595
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]);
|
|
596
915
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
597
916
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
598
917
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
599
|
-
|
|
918
|
+
_chunkV2OBGLJDcjs.BodyHeader,
|
|
600
919
|
{
|
|
601
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
920
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.HandCoinsIcon, {}),
|
|
602
921
|
title: "Review refund",
|
|
603
922
|
subtitle: "This returns the funds on the source chain. It does not retry the original bridge."
|
|
604
923
|
}
|
|
@@ -612,14 +931,14 @@ function ReviewStep({
|
|
|
612
931
|
" ",
|
|
613
932
|
symbol
|
|
614
933
|
] }),
|
|
615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol }) })
|
|
616
935
|
] })
|
|
617
936
|
] }),
|
|
618
937
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
619
938
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
620
939
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
621
940
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
622
|
-
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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 }) })
|
|
623
942
|
] })
|
|
624
943
|
] }),
|
|
625
944
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -636,7 +955,7 @@ function ReviewStep({
|
|
|
636
955
|
rel: "noreferrer",
|
|
637
956
|
children: [
|
|
638
957
|
short,
|
|
639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ExternalLinkIcon, {})
|
|
640
959
|
]
|
|
641
960
|
}
|
|
642
961
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
@@ -654,7 +973,7 @@ function ReviewStep({
|
|
|
654
973
|
}
|
|
655
974
|
),
|
|
656
975
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
-
|
|
976
|
+
_chunkV2OBGLJDcjs.Button,
|
|
658
977
|
{
|
|
659
978
|
onClick: () => destinationValid && onSubmit(destination),
|
|
660
979
|
loading: submitting,
|
|
@@ -665,7 +984,7 @@ function ReviewStep({
|
|
|
665
984
|
}
|
|
666
985
|
)
|
|
667
986
|
] }),
|
|
668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
987
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
669
988
|
] });
|
|
670
989
|
}
|
|
671
990
|
function ResultStep({
|
|
@@ -676,13 +995,13 @@ function ResultStep({
|
|
|
676
995
|
onRetry
|
|
677
996
|
}) {
|
|
678
997
|
const success = !!result;
|
|
679
|
-
const explorerTxUrl =
|
|
998
|
+
const explorerTxUrl = _chunkV2OBGLJDcjs.useExplorerTxUrl.call(void 0, );
|
|
680
999
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
681
1000
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
682
1001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
683
|
-
|
|
1002
|
+
_chunkV2OBGLJDcjs.BodyHeader,
|
|
684
1003
|
{
|
|
685
|
-
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1004
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.AlertTriangleIcon, {}),
|
|
686
1005
|
variant: success ? "success" : "error",
|
|
687
1006
|
title: success ? "Refund submitted" : "Refund failed",
|
|
688
1007
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -697,7 +1016,7 @@ function ResultStep({
|
|
|
697
1016
|
" ",
|
|
698
1017
|
result.symbol
|
|
699
1018
|
] }),
|
|
700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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 }) })
|
|
701
1020
|
] })
|
|
702
1021
|
] }),
|
|
703
1022
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -718,25 +1037,26 @@ function ResultStep({
|
|
|
718
1037
|
rel: "noreferrer",
|
|
719
1038
|
children: [
|
|
720
1039
|
short,
|
|
721
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1040
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ExternalLinkIcon, {})
|
|
722
1041
|
]
|
|
723
1042
|
}
|
|
724
1043
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: short });
|
|
725
1044
|
})()
|
|
726
1045
|
] })
|
|
727
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1046
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
|
|
728
1047
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children: success ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
729
|
-
onReset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
730
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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" })
|
|
731
1050
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
732
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
-
onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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" })
|
|
734
1053
|
] }) })
|
|
735
1054
|
] }),
|
|
736
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
737
1056
|
] });
|
|
738
1057
|
}
|
|
739
1058
|
|
|
740
1059
|
|
|
741
1060
|
|
|
742
|
-
|
|
1061
|
+
|
|
1062
|
+
exports.buildClaimAnalyticsSessionProperties = buildClaimAnalyticsSessionProperties; exports.ClaimModal = ClaimModal;
|