@rhinestone/deposit-modal 0.12.2 → 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.
Files changed (68) hide show
  1. package/README.md +73 -18
  2. package/bridge-transcript.json +653 -0
  3. package/dist/ClaimModal-IKTJU43Y.cjs +13 -0
  4. package/dist/ClaimModal-SEKNWRMA.mjs +13 -0
  5. package/dist/{DepositModalReown-VG66OTIU.cjs → DepositModalReown-46LPVFB6.cjs} +58 -35
  6. package/dist/{DepositModalReown-TEC3MEZ4.mjs → DepositModalReown-Q2JMLT47.mjs} +45 -22
  7. package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
  8. package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
  9. package/dist/WithdrawModal-5ICGD4HJ.mjs +12 -0
  10. package/dist/WithdrawModal-VP6PMIRO.cjs +12 -0
  11. package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
  12. package/dist/chunk-6KG642KH.cjs +31 -0
  13. package/dist/{chunk-PWLEBV5V.cjs → chunk-7ICSHJFE.cjs} +296 -220
  14. package/dist/{chunk-J46WDSRD.mjs → chunk-7SR7ENVJ.mjs} +165 -89
  15. package/dist/{chunk-2TPSF77V.mjs → chunk-CFKC77SV.mjs} +455 -261
  16. package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
  17. package/dist/{chunk-FXXUIK4E.mjs → chunk-IN77XSWO.mjs} +899 -153
  18. package/dist/chunk-K4H6TGBE.mjs +31 -0
  19. package/dist/{chunk-SDSKIJC7.mjs → chunk-KTUVSKR4.mjs} +2410 -1177
  20. package/dist/{chunk-HL5NUKZW.cjs → chunk-LZFRL2AL.cjs} +3 -3
  21. package/dist/{chunk-UQIJU6HV.cjs → chunk-MTFJSE52.cjs} +499 -191
  22. package/dist/{chunk-FLVLYO64.mjs → chunk-PKML3XVS.mjs} +430 -122
  23. package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
  24. package/dist/{chunk-BRYNGLDM.cjs → chunk-V2OBGLJD.cjs} +961 -215
  25. package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
  26. package/dist/{chunk-JE4R5VA3.mjs → chunk-WUJIKCFU.mjs} +1 -1
  27. package/dist/chunk-X2IPAPXU.cjs +163 -0
  28. package/dist/{chunk-OIN4CXCP.cjs → chunk-YCQZJQO6.cjs} +2343 -1110
  29. package/dist/{chunk-TM7VGHAG.cjs → chunk-YWMWI7PZ.cjs} +462 -268
  30. package/dist/chunk-ZEO6ADM3.mjs +163 -0
  31. package/dist/claim.cjs +7 -6
  32. package/dist/claim.d.cts +11 -3
  33. package/dist/claim.d.ts +11 -3
  34. package/dist/claim.mjs +6 -5
  35. package/dist/{constants-FuzG3h4m.d.cts → constants-DBrWhJWE.d.cts} +12 -7
  36. package/dist/{constants-FuzG3h4m.d.ts → constants-DBrWhJWE.d.ts} +12 -7
  37. package/dist/constants.cjs +3 -9
  38. package/dist/constants.d.cts +2 -3
  39. package/dist/constants.d.ts +2 -3
  40. package/dist/constants.mjs +4 -10
  41. package/dist/deposit.cjs +8 -8
  42. package/dist/deposit.d.cts +2 -2
  43. package/dist/deposit.d.ts +2 -2
  44. package/dist/deposit.mjs +7 -7
  45. package/dist/embed.cjs +1476 -0
  46. package/dist/embed.d.cts +183 -0
  47. package/dist/embed.d.ts +183 -0
  48. package/dist/embed.mjs +1476 -0
  49. package/dist/index.cjs +11 -16
  50. package/dist/index.d.cts +3 -3
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.mjs +14 -19
  53. package/dist/modal-ui-state-OD1RmKkK.d.cts +30 -0
  54. package/dist/modal-ui-state-OD1RmKkK.d.ts +30 -0
  55. package/dist/polymarket.cjs +17 -7
  56. package/dist/polymarket.mjs +13 -3
  57. package/dist/styles.css +124 -98
  58. package/dist/types-Bho4OA03.d.ts +982 -0
  59. package/dist/types-DP_3KwlD.d.cts +982 -0
  60. package/dist/withdraw.cjs +6 -6
  61. package/dist/withdraw.d.cts +11 -3
  62. package/dist/withdraw.d.ts +11 -3
  63. package/dist/withdraw.mjs +5 -5
  64. package/package.json +59 -6
  65. package/dist/chunk-IAGFDSNC.mjs +0 -11
  66. package/dist/chunk-L32UI7LA.cjs +0 -11
  67. package/dist/types-BO4iP6fG.d.cts +0 -612
  68. package/dist/types-oFblf65g.d.ts +0 -612
@@ -3,9 +3,9 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkPWLEBV5Vcjs = require('./chunk-PWLEBV5V.cjs');
7
6
 
8
7
 
8
+ var _chunk7ICSHJFEcjs = require('./chunk-7ICSHJFE.cjs');
9
9
 
10
10
 
11
11
 
@@ -37,16 +37,20 @@ var _chunkPWLEBV5Vcjs = require('./chunk-PWLEBV5V.cjs');
37
37
 
38
38
 
39
39
 
40
- var _chunkBRYNGLDMcjs = require('./chunk-BRYNGLDM.cjs');
41
40
 
42
41
 
43
42
 
44
43
 
44
+ var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
45
45
 
46
46
 
47
47
 
48
48
 
49
- var _chunkO7BCVQ6Lcjs = require('./chunk-O7BCVQ6L.cjs');
49
+
50
+
51
+
52
+
53
+ var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
50
54
 
51
55
  // src/WithdrawModal.tsx
52
56
  var _react = require('react');
@@ -218,7 +222,7 @@ function WithdrawFormStep({
218
222
  registrationError = null,
219
223
  onRecipientChange,
220
224
  onSubmit,
221
- onBalanceUsdChange
225
+ onFriction
222
226
  }) {
223
227
  const [recipient, setRecipient] = _react.useState.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
224
228
  const [amount, setAmount] = _react.useState.call(void 0, _nullishCoalesce(defaultAmount, () => ( "")));
@@ -231,10 +235,11 @@ function WithdrawFormStep({
231
235
  const chainDropdownRef = _react.useRef.call(void 0, null);
232
236
  const tokenDropdownRef = _react.useRef.call(void 0, null);
233
237
  const publicClientChainId = _optionalChain([publicClient, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]);
238
+ const onFrictionRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onFriction);
234
239
  useClickOutside(chainDropdownRef, () => setShowChainDropdown(false));
235
240
  useClickOutside(tokenDropdownRef, () => setShowTokenDropdown(false));
236
- const targetSymbol = _chunkO7BCVQ6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
237
- const targetChainName = _chunkO7BCVQ6Lcjs.getChainName.call(void 0, targetChain);
241
+ const targetSymbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
242
+ const targetChainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, targetChain);
238
243
  const isBusy = submitting || isSubmitting;
239
244
  const seededRecipientRef = _react.useRef.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
240
245
  _react.useEffect.call(void 0, () => {
@@ -258,7 +263,7 @@ function WithdrawFormStep({
258
263
  return;
259
264
  }
260
265
  try {
261
- const bal = _chunkBRYNGLDMcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: accountAddress }) : await publicClient.readContract({
266
+ const bal = _chunkV2OBGLJDcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: accountAddress }) : await publicClient.readContract({
262
267
  address: asset.token,
263
268
  abi: _viem.erc20Abi,
264
269
  functionName: "balanceOf",
@@ -271,6 +276,7 @@ function WithdrawFormStep({
271
276
  } catch (e2) {
272
277
  if (active) {
273
278
  setBalance(null);
279
+ _optionalChain([onFrictionRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4("wallet_balance_unavailable")]);
274
280
  timeoutId = setTimeout(fetchBalance, retryDelayMs);
275
281
  retryDelayMs = Math.min(Math.round(retryDelayMs * 1.5), 3e4);
276
282
  }
@@ -285,7 +291,7 @@ function WithdrawFormStep({
285
291
  clearTimeout(timeoutId);
286
292
  }
287
293
  };
288
- }, [accountAddress, publicClient, publicClientChainId, asset]);
294
+ }, [accountAddress, publicClient, publicClientChainId, asset, onFrictionRef]);
289
295
  const formattedBalance = _react.useMemo.call(void 0, () => {
290
296
  if (balance === null) return "...";
291
297
  try {
@@ -300,18 +306,9 @@ function WithdrawFormStep({
300
306
  }
301
307
  }, [balance, asset.decimals]);
302
308
  _react.useEffect.call(void 0, () => {
303
- if (balance === null) return;
304
- const sym = asset.symbol.toUpperCase();
305
- if (sym !== "USDC" && sym !== "USDT" && sym !== "USDT0") return;
306
- try {
307
- const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
308
- const numeric = Number(raw);
309
- if (!Number.isFinite(numeric)) return;
310
- _optionalChain([onBalanceUsdChange, 'optionalCall', _3 => _3(numeric)]);
311
- } catch (e4) {
312
- return;
313
- }
314
- }, [balance, asset.decimals, asset.symbol, onBalanceUsdChange]);
309
+ if (targetTokenOptions.length > 0 || !recipient || !amount) return;
310
+ _optionalChain([onFrictionRef, 'access', _5 => _5.current, 'optionalCall', _6 => _6("route_target_tokens_unavailable")]);
311
+ }, [targetTokenOptions.length, recipient, amount, onFrictionRef]);
315
312
  const amountUsd = _react.useMemo.call(void 0, () => {
316
313
  if (!amount) return null;
317
314
  const parsed = Number(amount);
@@ -331,18 +328,21 @@ function WithdrawFormStep({
331
328
  const handleWithdraw = _react.useCallback.call(void 0, async () => {
332
329
  if (!recipient || !/^0x[a-fA-F0-9]{40}$/.test(recipient)) {
333
330
  setError("Enter a valid recipient address");
331
+ _optionalChain([onFriction, 'optionalCall', _7 => _7("recipient_invalid")]);
334
332
  return;
335
333
  }
336
334
  const lowerRecipient = recipient.toLowerCase();
337
- if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess', _4 => _4.toLowerCase, 'call', _5 => _5()])) {
335
+ if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9()])) {
338
336
  setError(
339
337
  "Recipient can't be your own account. Send to a different wallet."
340
338
  );
339
+ _optionalChain([onFriction, 'optionalCall', _10 => _10("recipient_not_allowed")]);
341
340
  return;
342
341
  }
343
342
  const parsed = Number(amount);
344
343
  if (!amount || !Number.isFinite(parsed) || parsed <= 0) {
345
344
  setError("Enter a valid amount");
345
+ _optionalChain([onFriction, 'optionalCall', _11 => _11("amount_invalid")]);
346
346
  return;
347
347
  }
348
348
  if (balance !== null) {
@@ -350,10 +350,12 @@ function WithdrawFormStep({
350
350
  const amountInUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
351
351
  if (amountInUnits > balance) {
352
352
  setError("Insufficient balance");
353
+ _optionalChain([onFriction, 'optionalCall', _12 => _12("amount_insufficient_balance")]);
353
354
  return;
354
355
  }
355
- } catch (e5) {
356
+ } catch (e4) {
356
357
  setError("Invalid amount");
358
+ _optionalChain([onFriction, 'optionalCall', _13 => _13("amount_invalid")]);
357
359
  return;
358
360
  }
359
361
  }
@@ -363,7 +365,7 @@ function WithdrawFormStep({
363
365
  await onSubmit(recipient, amount);
364
366
  } catch (err) {
365
367
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
366
- setError(_chunkBRYNGLDMcjs.formatUserError.call(void 0, raw));
368
+ setError(_chunkV2OBGLJDcjs.formatUserError.call(void 0, raw));
367
369
  } finally {
368
370
  setIsSubmitting(false);
369
371
  }
@@ -374,21 +376,22 @@ function WithdrawFormStep({
374
376
  asset.decimals,
375
377
  accountAddress,
376
378
  depositAddress,
377
- onSubmit
379
+ onSubmit,
380
+ onFriction
378
381
  ]);
379
382
  if (isBalanceLoading) {
380
383
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
381
384
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-withdraw-loading", children: [
382
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.Spinner, { className: "rs-spinner--lg" }),
385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Spinner, { className: "rs-spinner--lg" }),
383
386
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
384
387
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: "Please wait before withdrawing." })
385
388
  ] }),
386
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.PoweredBy, {})
389
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
387
390
  ] });
388
391
  }
389
392
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
390
393
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
391
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
394
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
392
395
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
393
396
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
394
397
  "label",
@@ -409,7 +412,7 @@ function WithdrawFormStep({
409
412
  onChange: (e) => {
410
413
  const next = e.target.value.trim();
411
414
  setRecipient(next);
412
- _optionalChain([onRecipientChange, 'optionalCall', _6 => _6(next)]);
415
+ _optionalChain([onRecipientChange, 'optionalCall', _14 => _14(next)]);
413
416
  if (error) setError(null);
414
417
  }
415
418
  }
@@ -448,7 +451,7 @@ function WithdrawFormStep({
448
451
  ) })
449
452
  ] }),
450
453
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
451
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${_chunkBRYNGLDMcjs.currencyFormatter.format(amountUsd)}` : "$0.00" }),
454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${_chunkV2OBGLJDcjs.currencyFormatter.format(amountUsd)}` : "$0.00" }),
452
455
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
453
456
  "Balance: ",
454
457
  formattedBalance,
@@ -479,9 +482,9 @@ function WithdrawFormStep({
479
482
  children: [
480
483
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
481
484
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
482
- _chunkBRYNGLDMcjs.CdnIcon,
485
+ _chunkV2OBGLJDcjs.CdnIcon,
483
486
  {
484
- src: _chunkO7BCVQ6Lcjs.getChainIcon.call(void 0, targetChain),
487
+ src: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, targetChain),
485
488
  alt: targetChainName,
486
489
  className: "rs-withdraw-dropdown-icon"
487
490
  }
@@ -489,7 +492,7 @@ function WithdrawFormStep({
489
492
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName })
490
493
  ] }),
491
494
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
492
- _chunkBRYNGLDMcjs.ChevronDownIcon,
495
+ _chunkV2OBGLJDcjs.ChevronDownIcon,
493
496
  {
494
497
  className: "rs-withdraw-dropdown-arrow",
495
498
  style: {
@@ -511,9 +514,9 @@ function WithdrawFormStep({
511
514
  },
512
515
  children: [
513
516
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
514
- _chunkBRYNGLDMcjs.CdnIcon,
517
+ _chunkV2OBGLJDcjs.CdnIcon,
515
518
  {
516
- src: _chunkO7BCVQ6Lcjs.getChainIcon.call(void 0, chain.id),
519
+ src: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, chain.id),
517
520
  alt: chain.name,
518
521
  className: "rs-withdraw-dropdown-icon"
519
522
  }
@@ -548,7 +551,7 @@ function WithdrawFormStep({
548
551
  children: [
549
552
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
550
553
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
551
- _chunkBRYNGLDMcjs.TokenIcon,
554
+ _chunkV2OBGLJDcjs.TokenIcon,
552
555
  {
553
556
  symbol: targetSymbol,
554
557
  className: "rs-withdraw-dropdown-icon"
@@ -557,7 +560,7 @@ function WithdrawFormStep({
557
560
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetSymbol })
558
561
  ] }),
559
562
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
560
- _chunkBRYNGLDMcjs.ChevronDownIcon,
563
+ _chunkV2OBGLJDcjs.ChevronDownIcon,
561
564
  {
562
565
  className: "rs-withdraw-dropdown-arrow",
563
566
  style: {
@@ -579,7 +582,7 @@ function WithdrawFormStep({
579
582
  },
580
583
  children: [
581
584
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
582
- _chunkBRYNGLDMcjs.TokenIcon,
585
+ _chunkV2OBGLJDcjs.TokenIcon,
583
586
  {
584
587
  symbol: option.symbol,
585
588
  className: "rs-withdraw-dropdown-icon"
@@ -595,10 +598,10 @@ function WithdrawFormStep({
595
598
  )
596
599
  ] })
597
600
  ] }),
598
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.Callout, { variant: "error", children: error }),
599
- !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.Callout, { variant: "error", children: registrationError }),
601
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
602
+ !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: registrationError }),
600
603
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
601
- _chunkBRYNGLDMcjs.Button,
604
+ _chunkV2OBGLJDcjs.Button,
602
605
  {
603
606
  onClick: handleWithdraw,
604
607
  fullWidth: true,
@@ -613,7 +616,7 @@ function WithdrawFormStep({
613
616
  }
614
617
  )
615
618
  ] }),
616
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.PoweredBy, {})
619
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
617
620
  ] });
618
621
  }
619
622
  WithdrawFormStep.displayName = "WithdrawFormStep";
@@ -641,25 +644,26 @@ function WithdrawReviewStep({
641
644
  }) {
642
645
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
643
646
  const [error, setError] = _react.useState.call(void 0, null);
644
- const sourceChainName = _chunkO7BCVQ6Lcjs.getChainName.call(void 0, sourceChain);
645
- const sourceChainIcon = _chunkO7BCVQ6Lcjs.getChainIcon.call(void 0, sourceChain);
646
- const targetSymbol = _chunkO7BCVQ6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
647
- const targetChainName = _chunkO7BCVQ6Lcjs.getChainName.call(void 0, targetChain);
648
- const targetChainIcon = _chunkO7BCVQ6Lcjs.getChainIcon.call(void 0, targetChain);
647
+ const sourceChainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, sourceChain);
648
+ const sourceChainIcon = _chunk4KCSH4T3cjs.getChainIcon.call(void 0, sourceChain);
649
+ const targetSymbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
650
+ const targetChainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, targetChain);
651
+ const targetChainIcon = _chunk4KCSH4T3cjs.getChainIcon.call(void 0, targetChain);
649
652
  const amountNumber = Number(amount);
650
- const formattedSendAmount = _nullishCoalesce(_chunkBRYNGLDMcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
651
- const prices = _chunkPWLEBV5Vcjs.useTokenPrices.call(void 0, service, [
653
+ const formattedSendAmount = _nullishCoalesce(_chunkV2OBGLJDcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
654
+ const prices = _chunk7ICSHJFEcjs.useTokenPrices.call(void 0, service, [
652
655
  { chainId: sourceChain, address: sourceToken, symbol: sourceSymbol },
653
656
  { chainId: targetChain, address: targetToken, symbol: targetSymbol }
654
657
  ]);
655
- const receiveDisplay = _nullishCoalesce(_chunkBRYNGLDMcjs.formatReceiveEstimate.call(void 0, {
658
+ const receiveDisplay = _nullishCoalesce(_chunkV2OBGLJDcjs.formatReceiveEstimate.call(void 0, {
656
659
  sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
657
660
  sourceSymbol,
658
661
  targetSymbol,
659
- sourceTrusted: _chunkBRYNGLDMcjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
662
+ sourceTrusted: _chunkV2OBGLJDcjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
660
663
  prices
661
664
  }), () => ( // No price for the target token — an honest dash beats a wrong number.
662
665
  "\u2014"));
666
+ const [submissionUncertain, setSubmissionUncertain] = _react.useState.call(void 0, false);
663
667
  const handleConfirm = async () => {
664
668
  setError(null);
665
669
  setIsSubmitting(true);
@@ -667,20 +671,22 @@ function WithdrawReviewStep({
667
671
  await onConfirm();
668
672
  } catch (err) {
669
673
  const raw = err instanceof Error ? err.message : "Withdraw failed";
670
- const message = _chunkBRYNGLDMcjs.formatUserError.call(void 0, raw);
674
+ const uncertain = _chunk7ICSHJFEcjs.isSubmissionUncertain.call(void 0, err);
675
+ const message = uncertain ? "Withdrawal status is uncertain. Check your activity before trying again." : _chunkV2OBGLJDcjs.formatUserError.call(void 0, raw);
676
+ if (uncertain) setSubmissionUncertain(true);
671
677
  setError(message);
672
- _optionalChain([onError, 'optionalCall', _7 => _7(message, "WITHDRAW_REVIEW_ERROR", raw)]);
678
+ _optionalChain([onError, 'optionalCall', _15 => _15(message, "WITHDRAW_REVIEW_ERROR", raw)]);
673
679
  } finally {
674
680
  setIsSubmitting(false);
675
681
  }
676
682
  };
677
- const disabled = isSubmitting || registrationPending || Boolean(registrationError);
683
+ const disabled = isSubmitting || submissionUncertain || registrationPending || Boolean(registrationError);
678
684
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
679
685
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
680
686
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
681
- _chunkBRYNGLDMcjs.BodyHeader,
687
+ _chunkV2OBGLJDcjs.BodyHeader,
682
688
  {
683
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.CircleArrowOutUpLeftIcon, {}),
689
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CircleArrowOutUpLeftIcon, {}),
684
690
  title: "Review withdrawal"
685
691
  }
686
692
  ),
@@ -693,14 +699,14 @@ function WithdrawReviewStep({
693
699
  " ",
694
700
  sourceSymbol
695
701
  ] }),
696
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.TokenIcon, { symbol: sourceSymbol }) })
702
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol: sourceSymbol }) })
697
703
  ] })
698
704
  ] }),
699
705
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
700
706
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
701
707
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
702
708
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
703
- sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.CdnIcon, { src: sourceChainIcon }) })
709
+ sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CdnIcon, { src: sourceChainIcon }) })
704
710
  ] })
705
711
  ] }),
706
712
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
@@ -711,14 +717,14 @@ function WithdrawReviewStep({
711
717
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
712
718
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
713
719
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
714
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.TokenIcon, { symbol: targetSymbol }) })
720
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol: targetSymbol }) })
715
721
  ] })
716
722
  ] }),
717
723
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
718
724
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
719
725
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
720
726
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
721
- targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.CdnIcon, { src: targetChainIcon }) })
727
+ targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CdnIcon, { src: targetChainIcon }) })
722
728
  ] })
723
729
  ] }),
724
730
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
@@ -726,10 +732,10 @@ function WithdrawReviewStep({
726
732
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
727
733
  ] })
728
734
  ] }),
729
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.Callout, { variant: "error", children: error }),
730
- !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.Callout, { variant: "error", children: registrationError }),
735
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
736
+ !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: registrationError }),
731
737
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
732
- _chunkBRYNGLDMcjs.Button,
738
+ _chunkV2OBGLJDcjs.Button,
733
739
  {
734
740
  onClick: handleConfirm,
735
741
  loading: isSubmitting,
@@ -740,7 +746,7 @@ function WithdrawReviewStep({
740
746
  }
741
747
  )
742
748
  ] }),
743
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.PoweredBy, {})
749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
744
750
  ] });
745
751
  }
746
752
  WithdrawReviewStep.displayName = "WithdrawReviewStep";
@@ -748,12 +754,176 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
748
754
  // src/WithdrawFlow.tsx
749
755
 
750
756
 
757
+ // src/core/withdraw-analytics.tsx
758
+
759
+
760
+
761
+
762
+
763
+
764
+ function withdrawFailureReasonForError(error) {
765
+ if (_chunk7ICSHJFEcjs.isSubmissionUncertain.call(void 0, error)) return "submission_uncertain";
766
+ const message = (error instanceof Error ? error.message : String(_nullishCoalesce(error, () => ( "")))).toLowerCase();
767
+ if (message.includes("changed before submission")) {
768
+ return "registration_target_changed";
769
+ }
770
+ if (message.includes("did not return a txhash")) {
771
+ return "submission_missing_hash";
772
+ }
773
+ if (message.includes("reject") || message.includes("denied")) {
774
+ return "submission_rejected";
775
+ }
776
+ return "submission_failed";
777
+ }
778
+ function createWithdrawAnalyticsController(emit) {
779
+ let step = null;
780
+ let afterHandoff = false;
781
+ let sameRoute = null;
782
+ let opened = false;
783
+ let closed = false;
784
+ const dedupe = /* @__PURE__ */ new Set();
785
+ const stamp = (payload) => sameRoute === null ? payload : { ...payload, same_route: sameRoute };
786
+ const send = (payload) => {
787
+ controller.openSession();
788
+ emit(stamp(payload));
789
+ };
790
+ const emitOnce = (key, payload) => {
791
+ if (dedupe.has(key)) return;
792
+ dedupe.add(key);
793
+ send(payload);
794
+ };
795
+ const controller = {
796
+ openSession() {
797
+ if (opened) return;
798
+ opened = true;
799
+ emit({ type: "withdraw_modal_open" });
800
+ },
801
+ openStep(nextStep) {
802
+ controller.openSession();
803
+ if (step === nextStep) return;
804
+ step = nextStep;
805
+ emitOnce(`step-open:${nextStep}`, {
806
+ type: "withdraw_modal_step_open",
807
+ step: nextStep
808
+ });
809
+ },
810
+ completeStep(completedStep = _nullishCoalesce(step, () => ( void 0))) {
811
+ if (!completedStep) return;
812
+ emitOnce(`step-complete:${completedStep}`, {
813
+ type: "withdraw_modal_step_complete",
814
+ step: completedStep
815
+ });
816
+ },
817
+ friction(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
818
+ if (!eventStep) return;
819
+ emitOnce(`friction:${eventStep}:${reason}`, {
820
+ type: "withdraw_modal_friction",
821
+ step: eventStep,
822
+ reason
823
+ });
824
+ },
825
+ failure(reason, retryable, eventStep = _nullishCoalesce(step, () => ( void 0))) {
826
+ if (!eventStep) return;
827
+ emitOnce(`failure:${eventStep}:${reason}`, {
828
+ type: "withdraw_modal_failure",
829
+ step: eventStep,
830
+ reason,
831
+ retryable
832
+ });
833
+ },
834
+ retry(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
835
+ if (!eventStep) return;
836
+ send({ type: "withdraw_modal_retry", step: eventStep, reason });
837
+ for (const key of [...dedupe]) {
838
+ if (key.includes(`:${eventStep}:`)) dedupe.delete(key);
839
+ }
840
+ },
841
+ handoff({ transactionHash, managedAccount, sameRoute: route }, eventStep) {
842
+ const handoffStep = _nullishCoalesce(_nullishCoalesce(eventStep, () => ( step)), () => ( "submit"));
843
+ if (step !== handoffStep) controller.openStep(handoffStep);
844
+ sameRoute = route;
845
+ afterHandoff = true;
846
+ emitOnce(`handoff:${transactionHash}`, {
847
+ type: "withdraw_modal_handoff",
848
+ step: handoffStep,
849
+ transaction_hash: transactionHash,
850
+ managed_account: managedAccount,
851
+ same_route: route
852
+ });
853
+ },
854
+ outcome(outcome) {
855
+ if (!step) return;
856
+ emitOnce(`outcome:${outcome}`, {
857
+ type: "withdraw_modal_ui_outcome",
858
+ step,
859
+ outcome
860
+ });
861
+ },
862
+ abandon(reason) {
863
+ if (!step || afterHandoff) return;
864
+ emitOnce(`abandon:${step}:${reason}`, {
865
+ type: "withdraw_modal_abandoned",
866
+ step,
867
+ reason
868
+ });
869
+ },
870
+ close(source) {
871
+ if (closed) return;
872
+ closed = true;
873
+ send({
874
+ type: "withdraw_modal_close",
875
+ source,
876
+ step,
877
+ after_handoff: afterHandoff
878
+ });
879
+ },
880
+ /** "New withdrawal" on the terminal screen: a fresh attempt in the same
881
+ * session, so the envelope and its session id stay. */
882
+ resetAttempt() {
883
+ step = null;
884
+ afterHandoff = false;
885
+ sameRoute = null;
886
+ dedupe.clear();
887
+ },
888
+ get step() {
889
+ return step;
890
+ },
891
+ get afterHandoff() {
892
+ return afterHandoff;
893
+ },
894
+ get sameRoute() {
895
+ return sameRoute;
896
+ }
897
+ };
898
+ return controller;
899
+ }
900
+ var WithdrawAnalyticsControllerContext = _react.createContext.call(void 0, null);
901
+ var noopController = createWithdrawAnalyticsController(() => {
902
+ });
903
+ function WithdrawAnalyticsControllerProvider({
904
+ children,
905
+ controllerRef
906
+ }) {
907
+ const emit = _chunkV2OBGLJDcjs.useWithdrawAnalyticsEmitter.call(void 0, );
908
+ const controller = _react.useMemo.call(void 0,
909
+ () => createWithdrawAnalyticsController(emit),
910
+ [emit]
911
+ );
912
+ if (controllerRef) controllerRef.current = controller;
913
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawAnalyticsControllerContext.Provider, { value: controller, children });
914
+ }
915
+ function useWithdrawAnalyticsController() {
916
+ return _nullishCoalesce(_react.useContext.call(void 0, WithdrawAnalyticsControllerContext), () => ( noopController));
917
+ }
918
+
919
+ // src/WithdrawFlow.tsx
920
+
751
921
  var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
752
922
  var REGISTRATION_DEBOUNCE_MS = 600;
753
923
  var WITHDRAW_INDEXING_DELAY_MS = 2e3;
754
924
  function targetsEqual(a, b) {
755
925
  if (!a) return false;
756
- return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _8 => _8.recipient, 'optionalAccess', _9 => _9.toLowerCase, 'call', _10 => _10()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _11 => _11.recipient, 'optionalAccess', _12 => _12.toLowerCase, 'call', _13 => _13()]), () => ( "")));
926
+ return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _16 => _16.recipient, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _19 => _19.recipient, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( "")));
757
927
  }
758
928
  function WithdrawFlow({
759
929
  accountAddress,
@@ -769,17 +939,19 @@ function WithdrawFlow({
769
939
  onStepChange,
770
940
  onClose,
771
941
  onLifecycle,
772
- onEvent,
773
942
  onError,
774
943
  debug
775
944
  }) {
776
- const rpcUrls = _chunkBRYNGLDMcjs.useRpcUrls.call(void 0, );
777
- const onStepChangeRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onStepChange);
778
- const onEventRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onEvent);
779
- const onLifecycleRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onLifecycle);
780
- const onErrorRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onError);
945
+ const rpcUrls = _chunkV2OBGLJDcjs.useRpcUrls.call(void 0, );
946
+ const onStepChangeRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onStepChange);
947
+ const analytics = useWithdrawAnalyticsController();
948
+ const onLifecycleRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onLifecycle);
949
+ const onErrorRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onError);
781
950
  const isFlowActiveRef = _react.useRef.call(void 0, true);
782
951
  const submitGenerationRef = _react.useRef.call(void 0, 0);
952
+ const lastSubmitFailureRef = _react.useRef.call(void 0,
953
+ null
954
+ );
783
955
  _react.useEffect.call(void 0, () => {
784
956
  isFlowActiveRef.current = true;
785
957
  return () => {
@@ -788,13 +960,13 @@ function WithdrawFlow({
788
960
  }, []);
789
961
  const logFlow = _react.useCallback.call(void 0,
790
962
  (message, data) => {
791
- _chunkBRYNGLDMcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
963
+ _chunkV2OBGLJDcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
792
964
  },
793
965
  [debug]
794
966
  );
795
967
  const logFlowError = _react.useCallback.call(void 0,
796
968
  (message, error, data) => {
797
- _chunkBRYNGLDMcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
969
+ _chunkV2OBGLJDcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
798
970
  },
799
971
  [debug]
800
972
  );
@@ -803,7 +975,6 @@ function WithdrawFlow({
803
975
  const [recipientInput, setRecipientInput] = _react.useState.call(void 0,
804
976
  _nullishCoalesce(defaultRecipient, () => ( ""))
805
977
  );
806
- const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
807
978
  _react.useEffect.call(void 0, () => {
808
979
  setTargetChain(targetChainProp);
809
980
  }, [targetChainProp]);
@@ -817,10 +988,7 @@ function WithdrawFlow({
817
988
  const registration = useWithdrawStore((s) => s.registration);
818
989
  const flowStep = useWithdrawStore((s) => s.step);
819
990
  const reviewedRecipient = useWithdrawStore((s) => s.recipient);
820
- const publicClient = _react.useMemo.call(void 0,
821
- () => _chunkBRYNGLDMcjs.getPublicClient.call(void 0, sourceChain, rpcUrls),
822
- [sourceChain, rpcUrls]
823
- );
991
+ const publicClient = _chunkV2OBGLJDcjs.useReadClient.call(void 0, sourceChain, rpcUrls);
824
992
  const recipientForRegistration = _react.useMemo.call(void 0, () => {
825
993
  if (!recipientInput) return void 0;
826
994
  return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
@@ -846,7 +1014,7 @@ function WithdrawFlow({
846
1014
  targetToken,
847
1015
  recipient: recipientForRegistration
848
1016
  });
849
- const salt = _chunkPWLEBV5Vcjs.deriveAccountSalt.call(void 0, {
1017
+ const salt = _chunk7ICSHJFEcjs.deriveAccountSalt.call(void 0, {
850
1018
  recipient: recipientForRegistration,
851
1019
  targetChain,
852
1020
  targetToken
@@ -854,7 +1022,7 @@ function WithdrawFlow({
854
1022
  const { evmDepositAddress } = await service.registerManagedAccount({
855
1023
  salt,
856
1024
  target: {
857
- chain: _chunkO7BCVQ6Lcjs.targetChainToCaip2.call(void 0, targetChain),
1025
+ chain: _chunk4KCSH4T3cjs.targetChainToCaip2.call(void 0, targetChain),
858
1026
  token: targetToken,
859
1027
  recipient: recipientForRegistration
860
1028
  }
@@ -868,7 +1036,7 @@ function WithdrawFlow({
868
1036
  smartAccount: evmDepositAddress,
869
1037
  registeredTarget: desiredTarget
870
1038
  });
871
- _optionalChain([onLifecycleRef, 'access', _14 => _14.current, 'optionalCall', _15 => _15({
1039
+ _optionalChain([onLifecycleRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({
872
1040
  type: "connected",
873
1041
  address: accountAddress,
874
1042
  smartAccount: evmDepositAddress
@@ -876,7 +1044,7 @@ function WithdrawFlow({
876
1044
  } catch (err) {
877
1045
  if (cancelled) return;
878
1046
  const raw = err instanceof Error ? err.message : "Registration failed";
879
- const message = _chunkBRYNGLDMcjs.formatUserError.call(void 0, raw);
1047
+ const message = _chunkV2OBGLJDcjs.formatUserError.call(void 0, raw);
880
1048
  logFlowError("auto-register:failed", err, {
881
1049
  accountAddress,
882
1050
  targetChain,
@@ -886,7 +1054,7 @@ function WithdrawFlow({
886
1054
  type: "registration/failed",
887
1055
  error: message
888
1056
  });
889
- _optionalChain([onErrorRef, 'access', _16 => _16.current, 'optionalCall', _17 => _17({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
1057
+ _optionalChain([onErrorRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
890
1058
  }
891
1059
  }, REGISTRATION_DEBOUNCE_MS);
892
1060
  return () => {
@@ -907,10 +1075,10 @@ function WithdrawFlow({
907
1075
  onErrorRef
908
1076
  ]);
909
1077
  const asset = _react.useMemo.call(void 0, () => {
910
- const symbol = _chunkO7BCVQ6Lcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
911
- const decimals = _chunkO7BCVQ6Lcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1078
+ const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
1079
+ const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
912
1080
  return {
913
- id: _chunkBRYNGLDMcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1081
+ id: _chunkV2OBGLJDcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
914
1082
  chainId: sourceChain,
915
1083
  token: sourceToken,
916
1084
  symbol,
@@ -918,7 +1086,7 @@ function WithdrawFlow({
918
1086
  decimals
919
1087
  };
920
1088
  }, [sourceChain, sourceToken]);
921
- const isSourceNative = sourceToken.toLowerCase() === _chunkO7BCVQ6Lcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
1089
+ const isSourceNative = sourceToken.toLowerCase() === _chunk4KCSH4T3cjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
922
1090
  const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
923
1091
  const reviewedTarget = reviewedRecipient ? {
924
1092
  chain: targetChain,
@@ -926,32 +1094,35 @@ function WithdrawFlow({
926
1094
  recipient: reviewedRecipient
927
1095
  } : null;
928
1096
  const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
1097
+ _react.useEffect.call(void 0, () => {
1098
+ if (flowStep !== "review") return;
1099
+ if (registration.kind !== "ready" || isReviewedTargetReady) return;
1100
+ analytics.friction("registration_stale", "review");
1101
+ }, [analytics, flowStep, registration.kind, isReviewedTargetReady]);
929
1102
  const reviewBackHandler = _react.useCallback.call(void 0, () => {
930
1103
  submitGenerationRef.current += 1;
1104
+ analytics.abandon("back");
931
1105
  storeApi.dispatch({ type: "review/back" });
932
- }, [storeApi]);
1106
+ }, [analytics, storeApi]);
933
1107
  _react.useEffect.call(void 0, () => {
934
- _optionalChain([onStepChangeRef, 'access', _18 => _18.current, 'optionalCall', _19 => _19(
935
- flowStep === "review" ? reviewBackHandler : void 0
1108
+ _optionalChain([onStepChangeRef, 'access', _26 => _26.current, 'optionalCall', _27 => _27(
1109
+ flowStep === "review" ? reviewBackHandler : void 0,
1110
+ flowStep
936
1111
  )]);
937
1112
  }, [flowStep, reviewBackHandler, onStepChangeRef]);
938
- const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
939
1113
  _react.useEffect.call(void 0, () => {
940
- if (flowStep !== "form") {
941
- lastStepOpenEventKeyRef.current = null;
942
- return;
1114
+ analytics.openSession();
1115
+ analytics.openStep(analyticsStepForFlowStep(flowStep));
1116
+ }, [analytics, flowStep]);
1117
+ _react.useEffect.call(void 0, () => {
1118
+ if (registration.kind === "pending") {
1119
+ analytics.friction("registration_pending");
1120
+ } else if (registration.kind === "stale") {
1121
+ analytics.friction("registration_stale");
1122
+ } else if (registration.kind === "failed") {
1123
+ analytics.failure("registration_failed", true);
943
1124
  }
944
- if (lastStepOpenEventKeyRef.current === "form") return;
945
- lastStepOpenEventKeyRef.current = "form";
946
- const tokenSymbol = _chunkO7BCVQ6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
947
- const chainName = _chunkO7BCVQ6Lcjs.getChainName.call(void 0, targetChain);
948
- _optionalChain([onEventRef, 'access', _20 => _20.current, 'optionalCall', _21 => _21({
949
- type: "withdraw_modal_select_amount_open",
950
- pred_balance: totalBalanceUsd,
951
- default_token: tokenSymbol,
952
- default_chain: chainName
953
- })]);
954
- }, [flowStep, targetToken, targetChain, totalBalanceUsd, onEventRef]);
1125
+ }, [analytics, registration.kind]);
955
1126
  _react.useEffect.call(void 0, () => {
956
1127
  logFlow("state:changed", {
957
1128
  step: flowStep,
@@ -972,33 +1143,34 @@ function WithdrawFlow({
972
1143
  ]);
973
1144
  const handleError = _react.useCallback.call(void 0,
974
1145
  (message, code, cause) => {
1146
+ if (code === "PROCESS_TIMEOUT") {
1147
+ analytics.friction("processor_status_poll_failed", "processing");
1148
+ }
975
1149
  logFlowError("flow:error", _nullishCoalesce(cause, () => ( message)), { code });
976
- _optionalChain([onErrorRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({ message, code, cause })]);
1150
+ _optionalChain([onErrorRef, 'access', _28 => _28.current, 'optionalCall', _29 => _29({ message, code, cause })]);
977
1151
  },
978
- [logFlowError, onErrorRef]
1152
+ [analytics, logFlowError, onErrorRef]
979
1153
  );
980
1154
  const handleFormContinue = _react.useCallback.call(void 0,
981
1155
  (recipient, amountValue) => {
982
- const tokenSymbol = _chunkO7BCVQ6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
983
- const chainName = _chunkO7BCVQ6Lcjs.getChainName.call(void 0, targetChain);
984
- _optionalChain([onEventRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25({
985
- type: "withdraw_modal_select_amount_cta_click",
986
- pred_balance: totalBalanceUsd,
987
- selected_token: tokenSymbol,
988
- selected_chain: chainName,
989
- amount: amountValue,
990
- cta_name: "withdraw"
991
- })]);
1156
+ analytics.completeStep("form");
992
1157
  storeApi.dispatch({
993
1158
  type: "form/continue",
994
1159
  amount: amountValue,
995
1160
  recipient
996
1161
  });
997
1162
  },
998
- [targetToken, targetChain, totalBalanceUsd, onEventRef, storeApi]
1163
+ [analytics, storeApi]
999
1164
  );
1000
1165
  const handleReviewConfirm = _react.useCallback.call(void 0,
1001
1166
  async () => {
1167
+ const previousFailure = lastSubmitFailureRef.current;
1168
+ if (previousFailure) {
1169
+ lastSubmitFailureRef.current = null;
1170
+ analytics.retry(previousFailure, "submit");
1171
+ }
1172
+ analytics.completeStep("review");
1173
+ analytics.openStep("submit");
1002
1174
  const state = storeApi.getState();
1003
1175
  const recipient = state.recipient;
1004
1176
  const amountValue = state.amount;
@@ -1016,11 +1188,13 @@ function WithdrawFlow({
1016
1188
  };
1017
1189
  const matchingRegistration = getMatchingRegistration();
1018
1190
  if (!matchingRegistration) {
1191
+ analytics.failure("registration_target_changed", true, "submit");
1019
1192
  throw new Error("Withdrawal target is still being prepared");
1020
1193
  }
1021
1194
  const smartAccount = matchingRegistration.smartAccount;
1022
1195
  const lowerRecipient = recipient.toLowerCase();
1023
1196
  if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === smartAccount.toLowerCase()) {
1197
+ analytics.failure("recipient_not_allowed", false, "submit");
1024
1198
  throw new Error(
1025
1199
  "Recipient can't be your own account. Send to a different wallet."
1026
1200
  );
@@ -1055,9 +1229,18 @@ function WithdrawFlow({
1055
1229
  if (!getMatchingRegistration()) {
1056
1230
  throw new Error("Withdrawal target changed before submission");
1057
1231
  }
1058
- if (!_optionalChain([result, 'optionalAccess', _26 => _26.txHash])) {
1232
+ if (!_optionalChain([result, 'optionalAccess', _30 => _30.txHash])) {
1059
1233
  throw new Error("onSendTransaction did not return a txHash");
1060
1234
  }
1235
+ analytics.handoff(
1236
+ {
1237
+ transactionHash: result.txHash,
1238
+ managedAccount: smartAccount,
1239
+ sameRoute: isSameRoute
1240
+ },
1241
+ "submit"
1242
+ );
1243
+ analytics.completeStep("submit");
1061
1244
  logFlow("withdraw:submitted", {
1062
1245
  txHash: result.txHash,
1063
1246
  smartAccount,
@@ -1065,7 +1248,7 @@ function WithdrawFlow({
1065
1248
  sourceChain,
1066
1249
  sourceToken
1067
1250
  });
1068
- _optionalChain([onLifecycleRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28({
1251
+ _optionalChain([onLifecycleRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32({
1069
1252
  type: "submitted",
1070
1253
  txHash: result.txHash,
1071
1254
  sourceChain,
@@ -1084,17 +1267,21 @@ function WithdrawFlow({
1084
1267
  });
1085
1268
  } catch (err) {
1086
1269
  const raw = err instanceof Error ? err.message : "Withdraw failed";
1270
+ const reason = withdrawFailureReasonForError(err);
1271
+ lastSubmitFailureRef.current = reason;
1272
+ analytics.failure(reason, reason !== "submission_uncertain", "submit");
1087
1273
  logFlowError("submit:failed", err, {
1088
1274
  sourceChain,
1089
1275
  sourceToken,
1090
1276
  targetChain,
1091
1277
  targetToken
1092
1278
  });
1093
- handleError(_chunkBRYNGLDMcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1279
+ handleError(_chunkV2OBGLJDcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1094
1280
  throw err;
1095
1281
  }
1096
1282
  },
1097
1283
  [
1284
+ analytics,
1098
1285
  targetChain,
1099
1286
  targetToken,
1100
1287
  asset.decimals,
@@ -1112,8 +1299,10 @@ function WithdrawFlow({
1112
1299
  );
1113
1300
  const handleWithdrawComplete = _react.useCallback.call(void 0,
1114
1301
  (txHash, destinationTxHash, context) => {
1302
+ analytics.openStep("processing");
1303
+ analytics.outcome("completed");
1115
1304
  logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
1116
- _optionalChain([onLifecycleRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30({
1305
+ _optionalChain([onLifecycleRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34({
1117
1306
  type: "complete",
1118
1307
  txHash,
1119
1308
  destinationTxHash,
@@ -1129,22 +1318,25 @@ function WithdrawFlow({
1129
1318
  })]);
1130
1319
  storeApi.dispatch({ type: "withdraw/complete" });
1131
1320
  },
1132
- [logFlow, onLifecycleRef, storeApi]
1321
+ [analytics, logFlow, onLifecycleRef, storeApi]
1133
1322
  );
1134
1323
  const handleWithdrawFailed = _react.useCallback.call(void 0,
1135
1324
  (txHash, error) => {
1325
+ analytics.openStep("processing");
1326
+ analytics.outcome("failed");
1327
+ analytics.failure("processor_failed", false, "processing");
1136
1328
  logFlowError("withdraw:failed", error, { txHash });
1137
- _optionalChain([onLifecycleRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32({
1329
+ _optionalChain([onLifecycleRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36({
1138
1330
  type: "failed",
1139
1331
  txHash,
1140
1332
  error
1141
1333
  })]);
1142
1334
  storeApi.dispatch({ type: "withdraw/failed" });
1143
1335
  },
1144
- [logFlowError, onLifecycleRef, storeApi]
1336
+ [analytics, logFlowError, onLifecycleRef, storeApi]
1145
1337
  );
1146
- const targetChainOptions = _chunkBRYNGLDMcjs.useDestinationChains.call(void 0, );
1147
- const targetTokensFor = _chunkBRYNGLDMcjs.useTargetTokens.call(void 0, );
1338
+ const targetChainOptions = _chunkV2OBGLJDcjs.useDestinationChains.call(void 0, );
1339
+ const targetTokensFor = _chunkV2OBGLJDcjs.useTargetTokens.call(void 0, );
1148
1340
  const targetTokenOptions = _react.useMemo.call(void 0,
1149
1341
  () => targetTokensFor(targetChain),
1150
1342
  [targetChain, targetTokensFor]
@@ -1173,6 +1365,12 @@ function WithdrawFlow({
1173
1365
  const handleTargetTokenChange = _react.useCallback.call(void 0, (token) => {
1174
1366
  setTargetToken(token);
1175
1367
  }, []);
1368
+ const handleFormFriction = _react.useCallback.call(void 0,
1369
+ (reason) => {
1370
+ analytics.friction(reason, "form");
1371
+ },
1372
+ [analytics]
1373
+ );
1176
1374
  const depositAddress = registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : void 0;
1177
1375
  const stepView = deriveStepView(flowStep, registration);
1178
1376
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
@@ -1195,7 +1393,7 @@ function WithdrawFlow({
1195
1393
  registrationError: registration.kind === "failed" ? registration.error : null,
1196
1394
  onRecipientChange: setRecipientInput,
1197
1395
  onSubmit: async (r, a) => handleFormContinue(r, a),
1198
- onBalanceUsdChange: setTotalBalanceUsd
1396
+ onFriction: handleFormFriction
1199
1397
  }
1200
1398
  ),
1201
1399
  stepView === "review" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1216,7 +1414,7 @@ function WithdrawFlow({
1216
1414
  }
1217
1415
  ),
1218
1416
  stepView === "processing" && registration.kind !== "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1219
- _chunkPWLEBV5Vcjs.ProcessingStep,
1417
+ _chunk7ICSHJFEcjs.ProcessingStep,
1220
1418
  {
1221
1419
  smartAccount: _nullishCoalesce(storeApi.getState().processingSmartAccount, () => ( (registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0"))),
1222
1420
  txHash: _nullishCoalesce(storeApi.getState().txHash, () => ( "0x0")),
@@ -1231,7 +1429,10 @@ function WithdrawFlow({
1231
1429
  service,
1232
1430
  flowLabel: "withdraw",
1233
1431
  onClose,
1234
- onNewDeposit: () => storeApi.dispatch({ type: "flow/reset" }),
1432
+ onNewDeposit: () => {
1433
+ analytics.resetAttempt();
1434
+ storeApi.dispatch({ type: "flow/reset" });
1435
+ },
1235
1436
  onDepositComplete: handleWithdrawComplete,
1236
1437
  onDepositFailed: handleWithdrawFailed,
1237
1438
  onError: handleError,
@@ -1243,10 +1444,17 @@ function WithdrawFlow({
1243
1444
  function toBaseUnits(amount, decimals) {
1244
1445
  try {
1245
1446
  return _viem.parseUnits.call(void 0, amount, decimals).toString();
1246
- } catch (e6) {
1447
+ } catch (e5) {
1247
1448
  return "0";
1248
1449
  }
1249
1450
  }
1451
+ function analyticsStepForFlowStep(step) {
1452
+ if (step === "review") return "review";
1453
+ if (step === "processing" || step === "complete" || step === "failed") {
1454
+ return "processing";
1455
+ }
1456
+ return "form";
1457
+ }
1250
1458
  function deriveStepView(step, _registration) {
1251
1459
  if (step === "review") return "review";
1252
1460
  if (step === "processing" || step === "complete" || step === "failed") {
@@ -1257,6 +1465,31 @@ function deriveStepView(step, _registration) {
1257
1465
 
1258
1466
  // src/WithdrawModal.tsx
1259
1467
 
1468
+ function buildWithdrawAnalyticsSessionProperties({
1469
+ inline = false,
1470
+ closeOnOverlayClick = false,
1471
+ targetChain,
1472
+ targetToken,
1473
+ recipient,
1474
+ defaultAmount,
1475
+ seedTargetChain,
1476
+ seedTargetToken
1477
+ }) {
1478
+ return {
1479
+ presentation: inline ? "inline" : "overlay",
1480
+ overlay_close_enabled: !inline && closeOnOverlayClick,
1481
+ prefills: {
1482
+ target_chain: targetChain !== void 0,
1483
+ target_token: targetToken !== void 0,
1484
+ recipient: recipient !== void 0,
1485
+ amount: defaultAmount !== void 0
1486
+ },
1487
+ ..._chunk7ICSHJFEcjs.analyticsTargetProperties.call(void 0, {
1488
+ targetChain: seedTargetChain,
1489
+ targetToken: seedTargetToken
1490
+ })
1491
+ };
1492
+ }
1260
1493
  function WithdrawModal({
1261
1494
  accountAddress,
1262
1495
  sourceChain: sourceChainProp,
@@ -1280,44 +1513,84 @@ function WithdrawModal({
1280
1513
  onLifecycle,
1281
1514
  onEvent,
1282
1515
  onError,
1516
+ enableAnalyticsIngest,
1517
+ analyticsIngestUrl,
1283
1518
  debug,
1284
1519
  // Every prop 0.9.0 removed lands here, since none of them is named above.
1285
1520
  // `uiConfig` is destructured, so its removed nested key isn't scanned — that
1286
1521
  // one only ever applied to the deposit flow.
1522
+ // Before the rest element, or it lands in `removedProps` and gets warned
1523
+ // about as a prop 0.9.0 removed.
1524
+ onUiState,
1287
1525
  ...removedProps
1288
1526
  }) {
1289
- _chunkPWLEBV5Vcjs.warnRemovedProps.call(void 0, "WithdrawModal", removedProps);
1290
- _chunkBRYNGLDMcjs.checkBackendUrl.call(void 0, "WithdrawModal", backendUrl);
1527
+ _chunk7ICSHJFEcjs.warnRemovedProps.call(void 0, "WithdrawModal", removedProps);
1528
+ _chunkV2OBGLJDcjs.checkBackendUrl.call(void 0, "WithdrawModal", backendUrl);
1291
1529
  const modalRef = _react.useRef.call(void 0, null);
1292
- const onReadyRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onReady);
1530
+ const onReadyRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onReady);
1531
+ const analyticsControllerRef = _react.useRef.call(void 0,
1532
+ null
1533
+ );
1534
+ const previousOpenRef = _react.useRef.call(void 0, isOpen);
1293
1535
  const [backHandler, setBackHandler] = _react.useState.call(void 0,
1294
1536
  void 0
1295
1537
  );
1296
- const targetChain = _chunkO7BCVQ6Lcjs.getChainId.call(void 0, _nullishCoalesce(targetChainProp, () => ( sourceChainProp)));
1297
- const sourceChain = _chunkO7BCVQ6Lcjs.getChainId.call(void 0, sourceChainProp);
1298
- const rpcUrls = _chunkBRYNGLDMcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
1538
+ const [screen, setScreen] = _react.useState.call(void 0, "form");
1539
+ const onUiStateRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onUiState);
1540
+ const targetChain = _chunk4KCSH4T3cjs.getChainId.call(void 0, _nullishCoalesce(targetChainProp, () => ( sourceChainProp)));
1541
+ const sourceChain = _chunk4KCSH4T3cjs.getChainId.call(void 0, sourceChainProp);
1542
+ const rpcUrls = _chunkV2OBGLJDcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
1299
1543
  const service = _react.useMemo.call(void 0,
1300
- () => _chunkBRYNGLDMcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1544
+ () => _chunkV2OBGLJDcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1301
1545
  [backendUrl, debug]
1302
1546
  );
1303
1547
  const store = _react.useMemo.call(void 0, () => createWithdrawStore(), []);
1304
- const onErrorRef = _chunkBRYNGLDMcjs.useLatestRef.call(void 0, onError);
1548
+ const onErrorRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onError);
1305
1549
  _react.useEffect.call(void 0, () => {
1306
1550
  if (isOpen && typeof onSendTransaction !== "function") {
1307
- _optionalChain([onErrorRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34({
1551
+ _optionalChain([onErrorRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38({
1308
1552
  message: "WithdrawModal requires an `onSendTransaction` function.",
1309
1553
  code: "WITHDRAW_MISSING_SEND_TRANSACTION"
1310
1554
  })]);
1555
+ _optionalChain([analyticsControllerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.failure, 'call', _41 => _41(
1556
+ "submission_handler_missing",
1557
+ false,
1558
+ "form"
1559
+ )]);
1311
1560
  }
1312
1561
  }, [isOpen, onSendTransaction, onErrorRef]);
1562
+ const closeWithSource = _react.useCallback.call(void 0,
1563
+ (source) => {
1564
+ const analytics = analyticsControllerRef.current;
1565
+ _optionalChain([analytics, 'optionalAccess', _42 => _42.abandon, 'call', _43 => _43("modal_close")]);
1566
+ _optionalChain([analytics, 'optionalAccess', _44 => _44.close, 'call', _45 => _45(source)]);
1567
+ onClose();
1568
+ },
1569
+ [onClose]
1570
+ );
1571
+ const handleModalDismiss = _react.useCallback.call(void 0,
1572
+ (reason) => {
1573
+ closeWithSource(
1574
+ reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
1575
+ );
1576
+ },
1577
+ [closeWithSource]
1578
+ );
1313
1579
  _react.useEffect.call(void 0, () => {
1314
- if (isOpen && modalRef.current) {
1315
- _chunkBRYNGLDMcjs.applyTheme.call(void 0, modalRef.current, theme);
1580
+ if (previousOpenRef.current && !isOpen) {
1581
+ const analytics = analyticsControllerRef.current;
1582
+ _optionalChain([analytics, 'optionalAccess', _46 => _46.abandon, 'call', _47 => _47("modal_close")]);
1583
+ _optionalChain([analytics, 'optionalAccess', _48 => _48.close, 'call', _49 => _49("host_controlled")]);
1316
1584
  }
1585
+ previousOpenRef.current = isOpen;
1586
+ }, [isOpen]);
1587
+ _react.useEffect.call(void 0, () => {
1588
+ if (!isOpen || !modalRef.current) return;
1589
+ return _chunkV2OBGLJDcjs.applyTheme.call(void 0, modalRef.current, theme);
1317
1590
  }, [isOpen, theme]);
1318
1591
  _react.useEffect.call(void 0, () => {
1319
1592
  if (isOpen) {
1320
- _optionalChain([onReadyRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36()]);
1593
+ _optionalChain([onReadyRef, 'access', _50 => _50.current, 'optionalCall', _51 => _51()]);
1321
1594
  }
1322
1595
  }, [isOpen, onReadyRef]);
1323
1596
  _react.useEffect.call(void 0, () => {
@@ -1325,68 +1598,103 @@ function WithdrawModal({
1325
1598
  store.dispatch({ type: "modal/reset" });
1326
1599
  }
1327
1600
  }, [isOpen, store]);
1328
- const handleStepChange = _react.useCallback.call(void 0, (onBack) => {
1601
+ const handleStepChange = _react.useCallback.call(void 0, (onBack, next) => {
1329
1602
  setBackHandler(() => onBack);
1603
+ if (next) setScreen(next);
1330
1604
  }, []);
1331
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _37 => _37.showBackButton]), () => ( true));
1605
+ _react.useEffect.call(void 0, () => {
1606
+ _optionalChain([onUiStateRef, 'access', _52 => _52.current, 'optionalCall', _53 => _53({
1607
+ screen,
1608
+ back: backHandler,
1609
+ submitting: false
1610
+ })]);
1611
+ }, [screen, backHandler, onUiStateRef]);
1612
+ const analyticsSessionProperties = buildWithdrawAnalyticsSessionProperties({
1613
+ inline,
1614
+ closeOnOverlayClick,
1615
+ targetChain: targetChainProp,
1616
+ targetToken,
1617
+ recipient,
1618
+ defaultAmount,
1619
+ seedTargetChain: targetChain,
1620
+ seedTargetToken: _nullishCoalesce(targetToken, () => ( sourceToken))
1621
+ });
1622
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _54 => _54.showBackButton]), () => ( true));
1332
1623
  const canGoBack = backHandler !== void 0;
1333
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1334
- _chunkBRYNGLDMcjs.Modal,
1624
+ 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, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1625
+ _chunkV2OBGLJDcjs.Modal,
1335
1626
  {
1336
1627
  isOpen,
1337
- onClose,
1628
+ onClose: handleModalDismiss,
1338
1629
  className,
1339
1630
  inline,
1340
1631
  closeOnOverlayClick,
1341
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: modalRef, className: "rs-modal", children: [
1342
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
1343
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1344
- "button",
1345
- {
1346
- type: "button",
1347
- className: "rs-modal-header-back",
1348
- "aria-label": "Go back",
1349
- onClick: backHandler,
1350
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.ChevronLeftIcon, {})
1351
- }
1352
- ) }),
1353
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1354
- "button",
1632
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1633
+ _chunkV2OBGLJDcjs.AnalyticsSession,
1634
+ {
1635
+ modal: "withdraw",
1636
+ sessionProperties: analyticsSessionProperties,
1637
+ onEvent,
1638
+ backendUrl,
1639
+ enableIngest: enableAnalyticsIngest,
1640
+ ingestUrl: analyticsIngestUrl,
1641
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1642
+ WithdrawAnalyticsControllerProvider,
1355
1643
  {
1356
- type: "button",
1357
- onClick: onClose,
1358
- className: "rs-modal-close",
1359
- "aria-label": "Close",
1360
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBRYNGLDMcjs.CloseIcon, {})
1644
+ controllerRef: analyticsControllerRef,
1645
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: modalRef, className: "rs-modal", children: [
1646
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
1647
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1648
+ "button",
1649
+ {
1650
+ type: "button",
1651
+ className: "rs-modal-header-back",
1652
+ "aria-label": "Go back",
1653
+ onClick: backHandler,
1654
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ChevronLeftIcon, {})
1655
+ }
1656
+ ) }),
1657
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1658
+ "button",
1659
+ {
1660
+ type: "button",
1661
+ onClick: () => closeWithSource("header_button"),
1662
+ className: "rs-modal-close",
1663
+ "aria-label": "Close",
1664
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CloseIcon, {})
1665
+ }
1666
+ ) })
1667
+ ] }),
1668
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1669
+ WithdrawFlow,
1670
+ {
1671
+ accountAddress,
1672
+ sourceChain,
1673
+ sourceToken,
1674
+ targetChain,
1675
+ targetToken: _nullishCoalesce(targetToken, () => ( sourceToken)),
1676
+ recipient,
1677
+ amount: defaultAmount,
1678
+ service,
1679
+ forceRegister,
1680
+ onSendTransaction,
1681
+ onStepChange: handleStepChange,
1682
+ onClose: closeWithSource,
1683
+ onLifecycle,
1684
+ onError,
1685
+ debug
1686
+ }
1687
+ )
1688
+ ] })
1361
1689
  }
1362
- ) })
1363
- ] }),
1364
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1365
- WithdrawFlow,
1366
- {
1367
- accountAddress,
1368
- sourceChain,
1369
- sourceToken,
1370
- targetChain,
1371
- targetToken: _nullishCoalesce(targetToken, () => ( sourceToken)),
1372
- recipient,
1373
- amount: defaultAmount,
1374
- service,
1375
- forceRegister,
1376
- onSendTransaction,
1377
- onStepChange: handleStepChange,
1378
- onClose,
1379
- onLifecycle,
1380
- onEvent,
1381
- onError,
1382
- debug
1383
- }
1384
- )
1385
- ] })
1690
+ )
1691
+ }
1692
+ )
1386
1693
  }
1387
1694
  ) }) }) });
1388
1695
  }
1389
1696
 
1390
1697
 
1391
1698
 
1392
- exports.WithdrawModal = WithdrawModal;
1699
+
1700
+ exports.buildWithdrawAnalyticsSessionProperties = buildWithdrawAnalyticsSessionProperties; exports.WithdrawModal = WithdrawModal;