@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.
Files changed (57) hide show
  1. package/README.md +43 -2
  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-YNNHLAV2.cjs → DepositModalReown-46LPVFB6.cjs} +16 -15
  6. package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-Q2JMLT47.mjs} +6 -5
  7. package/dist/WithdrawModal-5ICGD4HJ.mjs +12 -0
  8. package/dist/WithdrawModal-VP6PMIRO.cjs +12 -0
  9. package/dist/{chunk-GACIGCSN.cjs → chunk-6KG642KH.cjs} +1 -1
  10. package/dist/{chunk-RAADLTSW.cjs → chunk-7ICSHJFE.cjs} +179 -138
  11. package/dist/{chunk-COCBCQQC.mjs → chunk-7SR7ENVJ.mjs} +46 -5
  12. package/dist/{chunk-OLCD75JK.mjs → chunk-CFKC77SV.mjs} +451 -131
  13. package/dist/{chunk-EOMT5LKX.mjs → chunk-IN77XSWO.mjs} +526 -3
  14. package/dist/{chunk-FZ5FZFIG.mjs → chunk-K4H6TGBE.mjs} +1 -1
  15. package/dist/{chunk-DSIZNRWA.mjs → chunk-KTUVSKR4.mjs} +979 -360
  16. package/dist/{chunk-HOGZKHHY.cjs → chunk-LZFRL2AL.cjs} +3 -3
  17. package/dist/{chunk-7N77GIP4.cjs → chunk-MTFJSE52.cjs} +465 -171
  18. package/dist/{chunk-LTMMETAB.mjs → chunk-PKML3XVS.mjs} +404 -110
  19. package/dist/{chunk-ZMT4ATHR.cjs → chunk-V2OBGLJD.cjs} +564 -41
  20. package/dist/{chunk-XYJFEN5D.mjs → chunk-WUJIKCFU.mjs} +1 -1
  21. package/dist/{chunk-CVGNCUVU.cjs → chunk-X2IPAPXU.cjs} +22 -13
  22. package/dist/{chunk-2G2EIN4A.cjs → chunk-YCQZJQO6.cjs} +1272 -653
  23. package/dist/{chunk-5NUIKYSF.cjs → chunk-YWMWI7PZ.cjs} +458 -138
  24. package/dist/{chunk-YREVFB64.mjs → chunk-ZEO6ADM3.mjs} +16 -7
  25. package/dist/claim.cjs +6 -6
  26. package/dist/claim.d.cts +3 -3
  27. package/dist/claim.d.ts +3 -3
  28. package/dist/claim.mjs +5 -5
  29. package/dist/constants.cjs +2 -2
  30. package/dist/constants.d.cts +1 -1
  31. package/dist/constants.d.ts +1 -1
  32. package/dist/constants.mjs +1 -1
  33. package/dist/deposit.cjs +6 -6
  34. package/dist/deposit.d.cts +2 -2
  35. package/dist/deposit.d.ts +2 -2
  36. package/dist/deposit.mjs +5 -5
  37. package/dist/embed.cjs +310 -102
  38. package/dist/embed.d.cts +7 -1
  39. package/dist/embed.d.ts +7 -1
  40. package/dist/embed.mjs +285 -77
  41. package/dist/index.cjs +9 -9
  42. package/dist/index.d.cts +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.mjs +8 -8
  45. package/dist/types-Bho4OA03.d.ts +982 -0
  46. package/dist/types-DP_3KwlD.d.cts +982 -0
  47. package/dist/withdraw.cjs +5 -5
  48. package/dist/withdraw.d.cts +3 -3
  49. package/dist/withdraw.d.ts +3 -3
  50. package/dist/withdraw.mjs +4 -4
  51. package/package.json +28 -7
  52. package/dist/ClaimModal-CREZO27I.mjs +0 -11
  53. package/dist/ClaimModal-JRIA32U2.cjs +0 -11
  54. package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
  55. package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
  56. package/dist/types-B89I8_8H.d.ts +0 -638
  57. package/dist/types-nnDR4tqA.d.cts +0 -638
@@ -2,6 +2,7 @@ import {
2
2
  ProcessingStep,
3
3
  SetupError,
4
4
  Tooltip,
5
+ analyticsTargetProperties,
5
6
  computeCacheKey,
6
7
  computeIsCacheable,
7
8
  computeRequestKey,
@@ -18,12 +19,13 @@ import {
18
19
  runAccountSetupDeduped,
19
20
  txRefsMatch,
20
21
  warnRemovedProps
21
- } from "./chunk-COCBCQQC.mjs";
22
+ } from "./chunk-7SR7ENVJ.mjs";
22
23
  import {
23
24
  ListRow
24
- } from "./chunk-XYJFEN5D.mjs";
25
+ } from "./chunk-WUJIKCFU.mjs";
25
26
  import {
26
27
  AlertTriangleIcon,
28
+ AnalyticsSession,
27
29
  AppleIcon,
28
30
  ArrowUpRightIcon,
29
31
  BankIcon,
@@ -79,13 +81,14 @@ import {
79
81
  useCatalogChain,
80
82
  useChainCatalog,
81
83
  useChainName,
84
+ useDepositAnalyticsEmitter,
82
85
  useDepositChainIds,
83
86
  useExplorerTxUrl,
84
87
  useIsDepositChain,
85
88
  useLatestRef,
86
89
  useRpcUrls,
87
90
  useStableRpcUrls
88
- } from "./chunk-EOMT5LKX.mjs";
91
+ } from "./chunk-IN77XSWO.mjs";
89
92
  import {
90
93
  MULTICALL3_ADDRESS,
91
94
  POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
@@ -103,6 +106,7 @@ import {
103
106
  HYPERCORE_MIN_DEPOSIT_USD,
104
107
  HYPERCORE_SPOT_CAIP2,
105
108
  NATIVE_TOKEN_ADDRESS,
109
+ SOLANA_MAINNET_CAIP2,
106
110
  SOLANA_TOKENS,
107
111
  SUPPORTED_CHAIN_IDS,
108
112
  cdnIconUrl,
@@ -125,12 +129,13 @@ import {
125
129
  isVirtualDestination,
126
130
  parseEvmChainId,
127
131
  publishShortlistTokens,
128
- targetChainToChainId
132
+ targetChainToChainId,
133
+ toEvmCaip2
129
134
  } from "./chunk-VUATPOWJ.mjs";
130
135
 
131
136
  // src/DepositModal.tsx
132
137
  import {
133
- useMemo as useMemo9,
138
+ useMemo as useMemo10,
134
139
  useEffect as useEffect13,
135
140
  useRef as useRef9,
136
141
  useState as useState15,
@@ -143,7 +148,7 @@ import {
143
148
  import {
144
149
  useState as useState13,
145
150
  useCallback as useCallback7,
146
- useMemo as useMemo7,
151
+ useMemo as useMemo8,
147
152
  useEffect as useEffect12,
148
153
  useLayoutEffect as useLayoutEffect2,
149
154
  useRef as useRef8
@@ -1882,7 +1887,8 @@ function ConfirmStep({
1882
1887
  targetChain,
1883
1888
  targetToken,
1884
1889
  directTransfer: false,
1885
- sourceTxHashPending: true
1890
+ sourceTxHashPending: true,
1891
+ depositId: submitted.depositId
1886
1892
  }
1887
1893
  );
1888
1894
  } catch (err) {
@@ -2290,7 +2296,7 @@ function DepositNotification({
2290
2296
  );
2291
2297
  const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
2292
2298
  const pollTimeoutRef = useRef4(null);
2293
- const completedRef = useRef4(directTransfer ?? false);
2299
+ const completedRef = useRef4(false);
2294
2300
  const depositContextRef = useLatestRef({
2295
2301
  amount,
2296
2302
  sourceChain,
@@ -2513,6 +2519,30 @@ function DepositNotification({
2513
2519
  );
2514
2520
  }
2515
2521
 
2522
+ // src/core/deposit-source-identity.ts
2523
+ var SOLANA_NATIVE_MINT = "11111111111111111111111111111111";
2524
+ var EVM_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2525
+ function sourceChainToCaip2(chain) {
2526
+ if (chain === "solana") return SOLANA_MAINNET_CAIP2;
2527
+ if (chain === "hypercore") return HYPERCORE_SPOT_CAIP2;
2528
+ return toEvmCaip2(chain);
2529
+ }
2530
+ function findAddress(tokens, symbol) {
2531
+ return tokens?.find((t) => t.symbol.toLowerCase() === symbol.toLowerCase())?.address;
2532
+ }
2533
+ function resolveSourceTokenIdentity(input) {
2534
+ const { chain, symbol, shortlist, catalogTokens } = input;
2535
+ if (!symbol) return void 0;
2536
+ const shortlistTokens = shortlist?.[String(chain)];
2537
+ const raw = shortlistTokens !== void 0 ? findAddress(shortlistTokens, symbol) : chain === "hypercore" || !Array.isArray(catalogTokens) ? void 0 : findAddress(catalogTokens, symbol);
2538
+ if (!raw) return void 0;
2539
+ if (chain === "solana") {
2540
+ const isNative = raw.toLowerCase() === "native" || raw.toLowerCase() === EVM_ZERO_ADDRESS;
2541
+ return isNative ? SOLANA_NATIVE_MINT : raw;
2542
+ }
2543
+ return raw.toLowerCase();
2544
+ }
2545
+
2516
2546
  // src/components/steps/DepositAddressStep.tsx
2517
2547
  import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2518
2548
  var QRCode = lazy(
@@ -2647,18 +2677,22 @@ function DepositAddressStep({
2647
2677
  onDepositSubmitted,
2648
2678
  onDepositComplete,
2649
2679
  onDepositFailed,
2680
+ onAddressShown,
2650
2681
  onCopyAddress,
2651
2682
  onReviewDeposit,
2652
2683
  onError
2653
2684
  }) {
2654
2685
  const hasSolana = Boolean(solanaDepositAddress);
2655
2686
  const [topTokens, setTopTokens] = useState7(null);
2687
+ const [topTokensSettled, setTopTokensSettled] = useState7(false);
2656
2688
  useEffect7(() => {
2657
2689
  let active = true;
2658
2690
  setTopTokens(null);
2691
+ setTopTokensSettled(false);
2659
2692
  service.getTopTokens().then((t) => {
2660
2693
  if (!active) return;
2661
2694
  setTopTokens(t);
2695
+ setTopTokensSettled(true);
2662
2696
  if (t) publishShortlistTokens(t);
2663
2697
  });
2664
2698
  return () => {
@@ -2693,11 +2727,11 @@ function DepositAddressStep({
2693
2727
  const pendingChainRef = useRef5(initialSource?.chainId);
2694
2728
  useEffect7(() => {
2695
2729
  if (chainOptions.length === 0) return;
2696
- const pendingChain = pendingChainRef.current;
2697
- if (pendingChain !== void 0) {
2698
- if (chainOptions.includes(pendingChain)) {
2730
+ const pendingChain2 = pendingChainRef.current;
2731
+ if (pendingChain2 !== void 0) {
2732
+ if (chainOptions.includes(pendingChain2)) {
2699
2733
  pendingChainRef.current = void 0;
2700
- setSourceChainId(pendingChain);
2734
+ setSourceChainId(pendingChain2);
2701
2735
  return;
2702
2736
  }
2703
2737
  if (catalogLoading || topTokens === null) return;
@@ -2744,6 +2778,32 @@ function DepositAddressStep({
2744
2778
  const baselineTxHashRef = useRef5(void 0);
2745
2779
  const notificationIdRef = useRef5(0);
2746
2780
  const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
2781
+ const sourceTokenIdentity = useMemo3(
2782
+ () => resolveSourceTokenIdentity({
2783
+ chain: sourceChainId,
2784
+ symbol: sourceTokenSymbol,
2785
+ shortlist: topTokens,
2786
+ catalogTokens: catalogFor(sourceChainId)?.supportedTokens
2787
+ }),
2788
+ [sourceChainId, sourceTokenSymbol, topTokens, catalogFor]
2789
+ );
2790
+ const pendingChain = pendingChainRef.current;
2791
+ const sourceSelectionSettled = !catalogLoading && topTokensSettled && chainOptions.length > 0 && (pendingChain === void 0 || pendingChain === sourceChainId) && (chainChosenByUser.current ? chainOptions.includes(sourceChainId) : sourceChainId === preferredChainId(chainOptions));
2792
+ useEffect7(() => {
2793
+ if (!sourceTokenIdentity) return;
2794
+ if (!sourceSelectionSettled) return;
2795
+ onAddressShown?.({
2796
+ address: displayAddress,
2797
+ sourceChainCaip2: sourceChainToCaip2(sourceChainId),
2798
+ sourceTokenIdentity
2799
+ });
2800
+ }, [
2801
+ displayAddress,
2802
+ onAddressShown,
2803
+ sourceChainId,
2804
+ sourceTokenIdentity,
2805
+ sourceSelectionSettled
2806
+ ]);
2747
2807
  useEffect7(() => {
2748
2808
  if (!chainDropdownOpen && !tokenDropdownOpen) return;
2749
2809
  function handlePointerDown(event) {
@@ -2763,10 +2823,10 @@ function DepositAddressStep({
2763
2823
  };
2764
2824
  }, [chainDropdownOpen, tokenDropdownOpen]);
2765
2825
  const handleCopy = useCallback2(async () => {
2766
- onCopyAddress?.();
2767
2826
  try {
2768
2827
  await navigator.clipboard.writeText(displayAddress);
2769
2828
  setCopied(true);
2829
+ onCopyAddress?.(true);
2770
2830
  setTimeout(() => setCopied(false), 2e3);
2771
2831
  } catch {
2772
2832
  const textarea = document.createElement("textarea");
@@ -2775,10 +2835,13 @@ function DepositAddressStep({
2775
2835
  textarea.style.opacity = "0";
2776
2836
  document.body.appendChild(textarea);
2777
2837
  textarea.select();
2778
- document.execCommand("copy");
2838
+ const copiedWithFallback = document.execCommand("copy");
2779
2839
  document.body.removeChild(textarea);
2780
- setCopied(true);
2781
- setTimeout(() => setCopied(false), 2e3);
2840
+ if (copiedWithFallback) {
2841
+ setCopied(true);
2842
+ setTimeout(() => setCopied(false), 2e3);
2843
+ }
2844
+ onCopyAddress?.(copiedWithFallback);
2782
2845
  }
2783
2846
  }, [displayAddress, onCopyAddress]);
2784
2847
  const handleSelectChain = useCallback2(
@@ -3329,6 +3392,10 @@ function SwappedProviderStep({
3329
3392
  onClose,
3330
3393
  onGoBack,
3331
3394
  onError,
3395
+ onAttemptConsumed,
3396
+ onProviderHandoff,
3397
+ onRetry,
3398
+ onCancelled,
3332
3399
  onImmersiveChange,
3333
3400
  openExternally
3334
3401
  }) {
@@ -3344,6 +3411,7 @@ function SwappedProviderStep({
3344
3411
  const [opening, setOpening] = useState8(false);
3345
3412
  const iframeRef = useRef6(null);
3346
3413
  const openedUrlRef = useRef6(null);
3414
+ const assignedIframeUrlRef = useRef6(null);
3347
3415
  const completeFiredRef = useRef6(false);
3348
3416
  const failedFiredRef = useRef6(false);
3349
3417
  const completeTimeoutRef = useRef6(null);
@@ -3364,6 +3432,8 @@ function SwappedProviderStep({
3364
3432
  onSwappedFailedRef.current = onSwappedFailed;
3365
3433
  const onErrorRef = useRef6(onError);
3366
3434
  onErrorRef.current = onError;
3435
+ const onProviderHandoffRef = useRef6(onProviderHandoff);
3436
+ onProviderHandoffRef.current = onProviderHandoff;
3367
3437
  const onGoBackRef = useRef6(onGoBack);
3368
3438
  onGoBackRef.current = onGoBack;
3369
3439
  const onImmersiveChangeRef = useRef6(onImmersiveChange);
@@ -3382,6 +3452,7 @@ function SwappedProviderStep({
3382
3452
  setHandoffOpened(false);
3383
3453
  setOpening(false);
3384
3454
  openedUrlRef.current = null;
3455
+ assignedIframeUrlRef.current = null;
3385
3456
  if (completeTimeoutRef.current !== null) {
3386
3457
  clearTimeout(completeTimeoutRef.current);
3387
3458
  completeTimeoutRef.current = null;
@@ -3402,6 +3473,7 @@ function SwappedProviderStep({
3402
3473
  }
3403
3474
  setWidgetUrl(res.url);
3404
3475
  expectedExternalCustomerIdRef.current = res.externalCustomerId;
3476
+ onAttemptConsumed?.(res.externalCustomerId);
3405
3477
  const sep = res.externalCustomerId.indexOf(":");
3406
3478
  expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
3407
3479
  }).catch((err) => {
@@ -3421,13 +3493,20 @@ function SwappedProviderStep({
3421
3493
  useEffect8(() => {
3422
3494
  if (openExternally || !widgetUrl || iframeLoaded || loadError) return;
3423
3495
  const timer = setTimeout(() => {
3424
- setLoadError("Iframe took too long to load.");
3496
+ const message = "Iframe took too long to load.";
3497
+ setLoadError(message);
3498
+ onErrorRef.current?.(message, "SWAPPED_IFRAME_TIMEOUT");
3425
3499
  }, IFRAME_LOAD_TIMEOUT_MS);
3426
3500
  return () => clearTimeout(timer);
3427
3501
  }, [openExternally, widgetUrl, iframeLoaded, loadError]);
3428
3502
  useEffect8(() => {
3429
3503
  if (openExternally) return;
3430
- setIframeSrc(widgetUrl && !loadError ? widgetUrl : null);
3504
+ const nextSrc = widgetUrl && !loadError ? widgetUrl : null;
3505
+ setIframeSrc(nextSrc);
3506
+ if (nextSrc && assignedIframeUrlRef.current !== nextSrc) {
3507
+ assignedIframeUrlRef.current = nextSrc;
3508
+ onProviderHandoffRef.current?.();
3509
+ }
3431
3510
  }, [openExternally, widgetUrl, loadError, retryToken]);
3432
3511
  const openPaymentPage = async (url) => {
3433
3512
  if (!openExternally) return;
@@ -3436,6 +3515,7 @@ function SwappedProviderStep({
3436
3515
  try {
3437
3516
  await openExternally(url);
3438
3517
  setHandoffOpened(true);
3518
+ onProviderHandoff?.();
3439
3519
  } catch (error) {
3440
3520
  openedUrlRef.current = null;
3441
3521
  setLoadError(OPEN_FAILED_MESSAGE);
@@ -3592,6 +3672,9 @@ function SwappedProviderStep({
3592
3672
  }
3593
3673
  return null;
3594
3674
  }, [latestEvent, orderState, bannerForStatus]);
3675
+ useEffect8(() => {
3676
+ if (orderState?.status === "order_cancelled") onCancelled?.();
3677
+ }, [onCancelled, orderState?.status]);
3595
3678
  useEffect8(() => {
3596
3679
  if (completeFiredRef.current || failedFiredRef.current) return;
3597
3680
  const t = latestEvent?.type;
@@ -3633,6 +3716,7 @@ function SwappedProviderStep({
3633
3716
  }, [immersive]);
3634
3717
  useEffect8(() => () => onImmersiveChangeRef.current?.(false), []);
3635
3718
  const handleRetry = () => {
3719
+ onRetry?.();
3636
3720
  setIframeSrc(null);
3637
3721
  setWidgetUrl(null);
3638
3722
  setIframeLoaded(false);
@@ -3802,6 +3886,10 @@ function FiatOnrampStep({
3802
3886
  onClose,
3803
3887
  onGoBack,
3804
3888
  onError,
3889
+ onAttemptConsumed,
3890
+ onProviderHandoff,
3891
+ onRetry,
3892
+ onCancelled,
3805
3893
  onImmersiveChange,
3806
3894
  openExternally
3807
3895
  }) {
@@ -3846,6 +3934,10 @@ function FiatOnrampStep({
3846
3934
  onClose,
3847
3935
  onGoBack,
3848
3936
  onError,
3937
+ onAttemptConsumed,
3938
+ onProviderHandoff,
3939
+ onRetry,
3940
+ onCancelled,
3849
3941
  onImmersiveChange,
3850
3942
  openExternally
3851
3943
  }
@@ -3895,6 +3987,10 @@ function ExchangeConnectStep({
3895
3987
  onClose,
3896
3988
  onGoBack,
3897
3989
  onError,
3990
+ onAttemptConsumed,
3991
+ onProviderHandoff,
3992
+ onRetry,
3993
+ onCancelled,
3898
3994
  onImmersiveChange,
3899
3995
  openExternally
3900
3996
  }) {
@@ -3922,6 +4018,10 @@ function ExchangeConnectStep({
3922
4018
  onClose,
3923
4019
  onGoBack,
3924
4020
  onError,
4021
+ onAttemptConsumed,
4022
+ onProviderHandoff,
4023
+ onRetry,
4024
+ onCancelled,
3925
4025
  onImmersiveChange,
3926
4026
  openExternally
3927
4027
  }
@@ -5659,8 +5759,297 @@ function bootRetryPlan(params) {
5659
5759
  };
5660
5760
  }
5661
5761
 
5762
+ // src/core/deposit-analytics.tsx
5763
+ import {
5764
+ createContext,
5765
+ useContext,
5766
+ useMemo as useMemo7
5767
+ } from "react";
5768
+ import { jsx as jsx27 } from "react/jsx-runtime";
5769
+ function fundingMethodForFlowMode(mode) {
5770
+ switch (mode) {
5771
+ case "wallet":
5772
+ case "solana-wallet":
5773
+ return "wallet";
5774
+ case "deposit-address":
5775
+ return "transfer";
5776
+ case "fiat-onramp":
5777
+ return "fiat_onramp";
5778
+ case "exchange-connect":
5779
+ return "exchange_connect";
5780
+ case "dapp-import":
5781
+ return "asset_migration";
5782
+ default:
5783
+ return null;
5784
+ }
5785
+ }
5786
+ function analyticsStepForFlowStep(method, step) {
5787
+ if (!method) {
5788
+ return step === "setup" ? "account_setup" : "funding_method_home";
5789
+ }
5790
+ switch (step) {
5791
+ case "connect":
5792
+ return method === "wallet" ? "wallet_connect" : "funding_method_home";
5793
+ case "setup":
5794
+ return "account_setup";
5795
+ case "select-asset":
5796
+ return "wallet_source_asset";
5797
+ case "solana-token-select":
5798
+ return "wallet_source_token";
5799
+ case "amount":
5800
+ case "solana-amount":
5801
+ return method === "asset_migration" ? "migration_amount" : "wallet_amount";
5802
+ case "confirm":
5803
+ case "solana-confirm":
5804
+ return method === "asset_migration" ? "migration_review" : "wallet_review";
5805
+ case "processing":
5806
+ return method === "asset_migration" ? "migration_processing" : method === "transfer" ? "transfer_tracking" : method === "fiat_onramp" ? "fiat_receipt" : method === "exchange_connect" ? "exchange_receipt" : "wallet_processing";
5807
+ case "deposit-address":
5808
+ return "transfer_address_shown";
5809
+ case "qr-amount":
5810
+ return "transfer_fee_amount";
5811
+ case "qr-review":
5812
+ return "transfer_fee_review";
5813
+ case "fiat-onramp":
5814
+ return "fiat_provider_handoff";
5815
+ case "exchange-select":
5816
+ return "exchange_selection";
5817
+ case "exchange-connect":
5818
+ return "exchange_provider_handoff";
5819
+ case "dapp-import-resolving":
5820
+ return "migration_boot_resolve";
5821
+ case "dapp-import-select":
5822
+ return "migration_provider_selection";
5823
+ case "dapp-import-asset-select":
5824
+ return "migration_asset_selection";
5825
+ default:
5826
+ return "funding_method_home";
5827
+ }
5828
+ }
5829
+ function failureReasonForCode(code, cause) {
5830
+ const normalized = `${code ?? ""} ${cause ?? ""}`.toLowerCase();
5831
+ if (normalized.includes("uncertain")) return "submission_uncertain";
5832
+ if (normalized.includes("reject") && (normalized.includes("sign") || normalized.includes("permit"))) {
5833
+ return "wallet_signature_rejected";
5834
+ }
5835
+ if (normalized.includes("permit")) {
5836
+ return "wallet_permit_preparation_unavailable";
5837
+ }
5838
+ if (normalized.includes("clipboard")) return "transfer_clipboard_failed";
5839
+ if (normalized.includes("switch") && normalized.includes("reject")) {
5840
+ return "wallet_chain_switch_rejected";
5841
+ }
5842
+ if (normalized.includes("reject")) return "submission_rejected";
5843
+ if (normalized.includes("switch")) return "wallet_chain_switch_failed";
5844
+ if (normalized.includes("quote")) return "quote_unavailable";
5845
+ if (normalized.includes("price")) return "quote_source_price_unavailable";
5846
+ if (normalized.includes("iframe_timeout")) return "swapped_iframe_timeout";
5847
+ if (normalized.includes("connect_exchanges") || normalized.includes("exchange_list")) {
5848
+ return "exchange_list_failed";
5849
+ }
5850
+ if (normalized.includes("browser")) return "swapped_browser_open_failed";
5851
+ if (normalized.includes("swapped") || normalized.includes("onramp")) {
5852
+ return "swapped_mint_failed";
5853
+ }
5854
+ if (normalized.includes("solana") || normalized.includes("transfer")) {
5855
+ return "submission_failed";
5856
+ }
5857
+ return "submission_failed";
5858
+ }
5859
+ function correlatorKey(correlator) {
5860
+ return `${correlator.type}:${correlator.value}`;
5861
+ }
5862
+ function createDepositAnalyticsController(emit) {
5863
+ let method = null;
5864
+ let step = null;
5865
+ let afterHandoff = false;
5866
+ let opened = false;
5867
+ let closed = false;
5868
+ const dedupe = /* @__PURE__ */ new Set();
5869
+ const emitOnce = (key, ...args) => {
5870
+ if (dedupe.has(key)) return;
5871
+ dedupe.add(key);
5872
+ emit(...args);
5873
+ };
5874
+ const controller = {
5875
+ emit,
5876
+ openSession() {
5877
+ if (opened) return;
5878
+ opened = true;
5879
+ emit({ type: "deposit_modal_open" }, null);
5880
+ },
5881
+ selectMethod(...args) {
5882
+ const [nextMethod, entrySource, identifiers] = args;
5883
+ controller.openSession();
5884
+ if (method && method !== nextMethod && !afterHandoff) {
5885
+ controller.abandon("method_replacement");
5886
+ }
5887
+ method = nextMethod;
5888
+ step = null;
5889
+ afterHandoff = false;
5890
+ emitOnce(
5891
+ `method:${nextMethod}:${entrySource}:${JSON.stringify(identifiers ?? {})}`,
5892
+ ...[
5893
+ {
5894
+ type: "deposit_modal_method_selected",
5895
+ entry_source: entrySource,
5896
+ ...identifiers ? { identifiers } : {}
5897
+ },
5898
+ nextMethod
5899
+ ]
5900
+ );
5901
+ },
5902
+ openStep(nextStep) {
5903
+ controller.openSession();
5904
+ if (step === nextStep) return;
5905
+ step = nextStep;
5906
+ emitOnce(
5907
+ `step-open:${method ?? "none"}:${nextStep}`,
5908
+ { type: "deposit_modal_step_open", step: nextStep },
5909
+ method
5910
+ );
5911
+ },
5912
+ completeStep(completedStep = step ?? void 0) {
5913
+ if (!completedStep) return;
5914
+ emitOnce(
5915
+ `step-complete:${method ?? "none"}:${completedStep}`,
5916
+ { type: "deposit_modal_step_complete", step: completedStep },
5917
+ method
5918
+ );
5919
+ },
5920
+ friction(reason, eventStep = step ?? void 0) {
5921
+ if (!eventStep) return;
5922
+ emitOnce(
5923
+ `friction:${method}:${eventStep}:${reason}`,
5924
+ {
5925
+ type: "deposit_modal_friction",
5926
+ step: eventStep,
5927
+ reason
5928
+ },
5929
+ method
5930
+ );
5931
+ },
5932
+ failure(reason, retryable, eventStep = step ?? void 0) {
5933
+ if (!eventStep) return;
5934
+ emitOnce(
5935
+ `failure:${method}:${eventStep}:${reason}`,
5936
+ {
5937
+ type: "deposit_modal_failure",
5938
+ step: eventStep,
5939
+ reason,
5940
+ retryable
5941
+ },
5942
+ method
5943
+ );
5944
+ },
5945
+ retry(reason, eventStep = step ?? void 0) {
5946
+ if (!eventStep) return;
5947
+ emit({ type: "deposit_modal_retry", step: eventStep, reason }, method);
5948
+ for (const key of [...dedupe]) {
5949
+ if (key.includes(`:${method}:${eventStep}:`)) dedupe.delete(key);
5950
+ }
5951
+ },
5952
+ handoff(...args) {
5953
+ const [handoffMethod, correlator, eventStep = step ?? void 0, identifiers] = args;
5954
+ if (!eventStep) return;
5955
+ if (step !== eventStep) controller.openStep(eventStep);
5956
+ afterHandoff = true;
5957
+ emitOnce(
5958
+ `handoff:${correlatorKey(correlator)}:${JSON.stringify(identifiers ?? {})}`,
5959
+ ...[
5960
+ {
5961
+ type: "deposit_modal_handoff",
5962
+ step: eventStep,
5963
+ correlator,
5964
+ ...identifiers ? { identifiers } : {}
5965
+ },
5966
+ handoffMethod
5967
+ ]
5968
+ );
5969
+ },
5970
+ observeCorrelator(correlator, eventStep = step ?? void 0) {
5971
+ if (!eventStep) return;
5972
+ const key = `correlator:${correlatorKey(correlator)}`;
5973
+ if (dedupe.has(key)) return;
5974
+ if (step !== eventStep) controller.openStep(eventStep);
5975
+ emitOnce(
5976
+ key,
5977
+ {
5978
+ type: "deposit_modal_correlator_observed",
5979
+ step: eventStep,
5980
+ correlator
5981
+ },
5982
+ method
5983
+ );
5984
+ },
5985
+ outcome(outcome) {
5986
+ if (!step) return;
5987
+ emitOnce(
5988
+ `outcome:${method}:${outcome}`,
5989
+ { type: "deposit_modal_ui_outcome", step, outcome },
5990
+ method
5991
+ );
5992
+ },
5993
+ abandon(reason) {
5994
+ if (!method || !step || afterHandoff) return;
5995
+ emitOnce(
5996
+ `abandon:${method}:${reason}`,
5997
+ { type: "deposit_modal_method_abandoned", step, reason },
5998
+ method
5999
+ );
6000
+ },
6001
+ close(source) {
6002
+ if (closed) return;
6003
+ closed = true;
6004
+ emit(
6005
+ {
6006
+ type: "deposit_modal_close",
6007
+ source,
6008
+ step,
6009
+ after_handoff: afterHandoff
6010
+ },
6011
+ method
6012
+ );
6013
+ },
6014
+ resetAttempt(nextMethod = null) {
6015
+ method = nextMethod;
6016
+ step = null;
6017
+ afterHandoff = false;
6018
+ dedupe.clear();
6019
+ },
6020
+ get method() {
6021
+ return method;
6022
+ },
6023
+ get step() {
6024
+ return step;
6025
+ },
6026
+ get afterHandoff() {
6027
+ return afterHandoff;
6028
+ }
6029
+ };
6030
+ return controller;
6031
+ }
6032
+ var DepositAnalyticsControllerContext = createContext(null);
6033
+ var noopController = createDepositAnalyticsController(() => {
6034
+ });
6035
+ function DepositAnalyticsControllerProvider({
6036
+ children,
6037
+ controllerRef
6038
+ }) {
6039
+ const emit = useDepositAnalyticsEmitter();
6040
+ const controller = useMemo7(
6041
+ () => createDepositAnalyticsController(emit),
6042
+ [emit]
6043
+ );
6044
+ if (controllerRef) controllerRef.current = controller;
6045
+ return /* @__PURE__ */ jsx27(DepositAnalyticsControllerContext.Provider, { value: controller, children });
6046
+ }
6047
+ function useDepositAnalyticsController() {
6048
+ return useContext(DepositAnalyticsControllerContext) ?? noopController;
6049
+ }
6050
+
5662
6051
  // src/store/index.ts
5663
- import { createContext, createElement, useContext } from "react";
6052
+ import { createContext as createContext2, createElement, useContext as useContext2 } from "react";
5664
6053
  import { useStore } from "zustand";
5665
6054
  import { createStore } from "zustand/vanilla";
5666
6055
 
@@ -6654,7 +7043,7 @@ function createDepositStore(overrides) {
6654
7043
  }
6655
7044
  };
6656
7045
  }
6657
- var DepositStoreContext = createContext(null);
7046
+ var DepositStoreContext = createContext2(null);
6658
7047
  function DepositStoreProvider({
6659
7048
  store,
6660
7049
  children
@@ -6666,7 +7055,7 @@ function DepositStoreProvider({
6666
7055
  );
6667
7056
  }
6668
7057
  function useDepositStoreApi() {
6669
- const store = useContext(DepositStoreContext);
7058
+ const store = useContext2(DepositStoreContext);
6670
7059
  if (!store) {
6671
7060
  throw new Error(
6672
7061
  "useDepositStore must be called inside <DepositStoreProvider>"
@@ -6680,7 +7069,7 @@ function useDepositStore(selector) {
6680
7069
  }
6681
7070
 
6682
7071
  // src/DepositFlow.tsx
6683
- import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
7072
+ import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
6684
7073
  function swappedWidgetPrefetchKey(method, methodSelectionSource) {
6685
7074
  return JSON.stringify([methodSelectionSource ?? null, method ?? null]);
6686
7075
  }
@@ -6689,17 +7078,17 @@ function AccountPreparingSkeleton({
6689
7078
  onRetry
6690
7079
  }) {
6691
7080
  return /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
6692
- /* @__PURE__ */ jsx27("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
6693
- /* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
6694
- /* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: errorMessage })
6695
- ] }) : /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
6696
- errorMessage && onRetry && /* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
7081
+ /* @__PURE__ */ jsx28("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx28("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx28("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
7082
+ /* @__PURE__ */ jsx28("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
7083
+ /* @__PURE__ */ jsx28("div", { className: "rs-loading-subtitle", children: errorMessage })
7084
+ ] }) : /* @__PURE__ */ jsx28("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
7085
+ errorMessage && onRetry && /* @__PURE__ */ jsx28("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx28(
6697
7086
  "button",
6698
7087
  {
6699
7088
  type: "button",
6700
7089
  className: "rs-button rs-button--default rs-button--full-width",
6701
7090
  onClick: onRetry,
6702
- children: /* @__PURE__ */ jsx27("span", { children: "Try again" })
7091
+ children: /* @__PURE__ */ jsx28("span", { children: "Try again" })
6703
7092
  }
6704
7093
  ) })
6705
7094
  ] });
@@ -6955,6 +7344,7 @@ function DepositFlow({
6955
7344
  fiatMethods,
6956
7345
  enableExchangeConnect = false,
6957
7346
  walletSession,
7347
+ walletIntegration,
6958
7348
  onConnect,
6959
7349
  onDisconnect,
6960
7350
  onRequestConnect,
@@ -6967,13 +7357,12 @@ function DepositFlow({
6967
7357
  onSubmittingChange,
6968
7358
  onClose,
6969
7359
  onLifecycle,
6970
- onEvent,
6971
7360
  onError,
6972
7361
  debug
6973
7362
  }) {
6974
7363
  const rpcUrls = useRpcUrls();
6975
7364
  const onStepChangeRef = useLatestRef(onStepChange);
6976
- const onEventRef = useLatestRef(onEvent);
7365
+ const analytics = useDepositAnalyticsController();
6977
7366
  const onLifecycleRef = useLatestRef(onLifecycle);
6978
7367
  const onErrorRef = useLatestRef(onError);
6979
7368
  const storeApi = useDepositStoreApi();
@@ -7021,14 +7410,14 @@ function DepositFlow({
7021
7410
  for (const link of links) link.remove();
7022
7411
  };
7023
7412
  }, [enableSwappedPreconnect]);
7024
- const dappSwitchChain = useMemo7(() => {
7413
+ const dappSwitchChain = useMemo8(() => {
7025
7414
  if (!walletClientProp?.switchChain) return void 0;
7026
7415
  return async (chainId) => {
7027
7416
  await walletClientProp.switchChain?.({ id: chainId });
7028
7417
  };
7029
7418
  }, [walletClientProp]);
7030
7419
  const connectedWalletAddress = walletClientProp?.account?.address ?? null;
7031
- const walletOptions = useMemo7(() => {
7420
+ const walletOptions = useMemo8(() => {
7032
7421
  const options = [];
7033
7422
  const seen = /* @__PURE__ */ new Set();
7034
7423
  if (connectedWalletAddress) {
@@ -7077,12 +7466,12 @@ function DepositFlow({
7077
7466
  walletSession?.solanaAddress,
7078
7467
  walletSession?.caipAddress
7079
7468
  ]);
7080
- const offeredFiatMethods = useMemo7(
7469
+ const offeredFiatMethods = useMemo8(
7081
7470
  () => fiatMethods ? FIAT_ONRAMP_METHODS.filter((m) => fiatMethods[m.method]) : FIAT_ONRAMP_METHODS,
7082
7471
  [fiatMethods]
7083
7472
  );
7084
7473
  const fiatEnabled = enableFiatOnramp && offeredFiatMethods.length > 0;
7085
- const enabledAssetMigrationIds = useMemo7(
7474
+ const enabledAssetMigrationIds = useMemo8(
7086
7475
  () => Object.entries(assetMigrations ?? {}).filter(([, on]) => on).map(([id]) => id),
7087
7476
  [assetMigrations]
7088
7477
  );
@@ -7105,7 +7494,7 @@ function DepositFlow({
7105
7494
  hasWalletClientProp && walletClientProp === void 0 || walletSession && !hasReownSession && !walletSession.isReady
7106
7495
  );
7107
7496
  const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
7108
- const walletSelectionKey = useMemo7(() => {
7497
+ const walletSelectionKey = useMemo8(() => {
7109
7498
  if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
7110
7499
  if (canAutoLock) {
7111
7500
  return getAddressKey(connectedWalletAddress);
@@ -7142,7 +7531,7 @@ function DepositFlow({
7142
7531
  cancelled = true;
7143
7532
  };
7144
7533
  }, [service, targetSymbol, isTargetStablecoin, targetChain, targetToken]);
7145
- const walletSignerContext = useMemo7(() => {
7534
+ const walletSignerContext = useMemo8(() => {
7146
7535
  if (flowMode === "deposit-address") {
7147
7536
  return null;
7148
7537
  }
@@ -7217,7 +7606,7 @@ function DepositFlow({
7217
7606
  stableWalletSignerRef.current = walletSignerContext;
7218
7607
  }
7219
7608
  }, [flowMode, walletSelectionKey, walletSignerContext]);
7220
- const signerContext = useMemo7(() => {
7609
+ const signerContext = useMemo8(() => {
7221
7610
  if (flowMode !== "wallet" && flowMode !== "dapp-import") {
7222
7611
  return null;
7223
7612
  }
@@ -7235,7 +7624,7 @@ function DepositFlow({
7235
7624
  walletSignerContext,
7236
7625
  walletSelectionKey
7237
7626
  ]);
7238
- const selectedEvmWalletOwner = useMemo7(() => {
7627
+ const selectedEvmWalletOwner = useMemo8(() => {
7239
7628
  if (!selectedWalletId) return null;
7240
7629
  const opt = walletOptions.find((o) => o.id === selectedWalletId);
7241
7630
  if (opt?.kind === "external" && opt.address) {
@@ -7246,7 +7635,7 @@ function DepositFlow({
7246
7635
  }
7247
7636
  return null;
7248
7637
  }, [selectedWalletId, walletOptions]);
7249
- const dappImportOwner = useMemo7(() => {
7638
+ const dappImportOwner = useMemo8(() => {
7250
7639
  if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
7251
7640
  if (walletSession?.address && walletSession.isConnected) {
7252
7641
  return walletSession.address;
@@ -7259,7 +7648,7 @@ function DepositFlow({
7259
7648
  walletSession?.isConnected,
7260
7649
  connectedWalletAddress
7261
7650
  ]);
7262
- const activeOwner = useMemo7(
7651
+ const activeOwner = useMemo8(
7263
7652
  () => resolveOwnerForMode(flowMode, {
7264
7653
  walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
7265
7654
  dappImportOwner
@@ -7324,7 +7713,7 @@ function DepositFlow({
7324
7713
  activeEntry.smartAccount,
7325
7714
  onLifecycleRef
7326
7715
  ]);
7327
- const effectiveStep = useMemo7(
7716
+ const effectiveStep = useMemo8(
7328
7717
  () => deriveStep(
7329
7718
  flowSlice,
7330
7719
  depositSlice,
@@ -7344,11 +7733,52 @@ function DepositFlow({
7344
7733
  );
7345
7734
  const step = effectiveStep;
7346
7735
  const handleBack = useCallback7(() => {
7736
+ if ([
7737
+ "deposit-address",
7738
+ "select-asset",
7739
+ "solana-token-select",
7740
+ "fiat-onramp",
7741
+ "exchange-select",
7742
+ "exchange-connect",
7743
+ "dapp-import-resolving",
7744
+ "dapp-import-select",
7745
+ "dapp-import-asset-select"
7746
+ ].includes(effectiveStep.type)) {
7747
+ analytics.abandon("back");
7748
+ analytics.resetAttempt(
7749
+ effectiveStep.type === "exchange-connect" ? "exchange_connect" : null
7750
+ );
7751
+ }
7752
+ storeApi.dispatch({
7753
+ type: "back/requested",
7754
+ hasWalletOptions: hasWalletOptions || Boolean(walletSession)
7755
+ });
7756
+ }, [
7757
+ analytics,
7758
+ effectiveStep.type,
7759
+ storeApi,
7760
+ hasWalletOptions,
7761
+ walletSession
7762
+ ]);
7763
+ const handleProviderBack = useCallback7(() => {
7764
+ analytics.abandon("provider_back");
7765
+ analytics.resetAttempt(
7766
+ flowMode === "exchange-connect" ? "exchange_connect" : null
7767
+ );
7768
+ storeApi.dispatch({
7769
+ type: "back/requested",
7770
+ hasWalletOptions: hasWalletOptions || Boolean(walletSession)
7771
+ });
7772
+ }, [analytics, flowMode, storeApi, hasWalletOptions, walletSession]);
7773
+ const handleWalletDisconnect = useCallback7(() => {
7774
+ analytics.abandon("wallet_disconnect");
7775
+ analytics.resetAttempt();
7776
+ onDisconnect?.();
7347
7777
  storeApi.dispatch({
7348
7778
  type: "back/requested",
7349
7779
  hasWalletOptions: hasWalletOptions || Boolean(walletSession)
7350
7780
  });
7351
- }, [storeApi, hasWalletOptions, walletSession]);
7781
+ }, [analytics, hasWalletOptions, onDisconnect, storeApi, walletSession]);
7352
7782
  const qrSourceAsset = effectiveStep.type === "qr-amount" ? effectiveStep.asset : null;
7353
7783
  const qrSourceKey = qrSourceAsset ? `${qrSourceAsset.chainId}:${qrSourceAsset.token}` : null;
7354
7784
  const [qrSourcePrice, setQrSourcePrice] = useState13({ resolved: false, usd: null });
@@ -7417,51 +7847,22 @@ function DepositFlow({
7417
7847
  });
7418
7848
  return () => cancelAnimationFrame(rafId);
7419
7849
  }, [stepPinKey]);
7420
- const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
7421
- const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
7422
- const lastStepOpenEventKeyRef = useRef8(null);
7850
+ const analyticsMethod = fundingMethodForFlowMode(flowMode);
7851
+ const analyticsStep = analyticsStepForFlowStep(
7852
+ analyticsMethod,
7853
+ showConnectStep ? "connect" : effectiveStep.type
7854
+ );
7423
7855
  useEffect12(() => {
7424
- if (!stepOpenEventKey) {
7425
- lastStepOpenEventKeyRef.current = null;
7426
- return;
7427
- }
7428
- if (lastStepOpenEventKeyRef.current === stepOpenEventKey) {
7429
- return;
7430
- }
7431
- lastStepOpenEventKeyRef.current = stepOpenEventKey;
7432
- if (effectiveStep.type === "select-asset") {
7433
- onEventRef.current?.({
7434
- type: "deposit_modal_connected_wallet_select_source_open",
7435
- total_balance_in_external_wallet: totalBalanceUsd,
7436
- pred_balance: totalBalanceUsd
7437
- });
7438
- } else if (effectiveStep.type === "deposit-address") {
7439
- const chainName = getChainName(targetChainId);
7440
- const tokenSymbol = getTargetTokenSymbol(targetToken, targetChainId);
7441
- onEventRef.current?.({
7442
- type: "deposit_modal_transfer_crypto_open",
7443
- default_chain: chainName,
7444
- default_token: tokenSymbol,
7445
- pred_balance: totalBalanceUsd
7446
- });
7447
- } else if (effectiveStep.type === "amount" && stepSendToken) {
7448
- const receiveSymbol = getTargetTokenSymbol(targetToken, targetChainId);
7449
- onEventRef.current?.({
7450
- type: "deposit_modal_connected_wallet_enter_value_open",
7451
- send_token: stepSendToken,
7452
- receive_token: receiveSymbol,
7453
- pred_balance: totalBalanceUsd
7454
- });
7856
+ analytics.openSession();
7857
+ analytics.openStep(analyticsStep);
7858
+ }, [analytics, analyticsStep]);
7859
+ useEffect12(() => {
7860
+ if (setupSlice.status === "loading") {
7861
+ analytics.friction("account_setup_pending", "account_setup");
7862
+ } else if (setupSlice.status === "error") {
7863
+ analytics.failure("account_setup_failed", true, "account_setup");
7455
7864
  }
7456
- }, [
7457
- effectiveStep.type,
7458
- stepOpenEventKey,
7459
- stepSendToken,
7460
- targetChain,
7461
- targetToken,
7462
- totalBalanceUsd,
7463
- onEventRef
7464
- ]);
7865
+ }, [analytics, setupSlice.status]);
7465
7866
  useEffect12(() => {
7466
7867
  logFlow("state:changed", {
7467
7868
  step: effectiveStep.type,
@@ -7490,30 +7891,35 @@ function DepositFlow({
7490
7891
  const isFiatOnrampMode = flowMode === "fiat-onramp";
7491
7892
  const isExchangeConnectMode = flowMode === "exchange-connect";
7492
7893
  const handleSelectTransferCrypto = useCallback7(() => {
7894
+ analytics.selectMethod("transfer", "user");
7493
7895
  storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
7494
- }, [storeApi]);
7896
+ }, [analytics, storeApi]);
7495
7897
  const handleConfirmWallet = useCallback7(
7496
7898
  (walletId) => {
7497
7899
  const selectedOption = walletOptions.find((o) => o.id === walletId);
7498
7900
  const mode = selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
7901
+ analytics.selectMethod("wallet", "user", {
7902
+ network: selectedOption?.kind === "solana" ? "solana" : "evm",
7903
+ integration: walletIntegration ?? "none"
7904
+ });
7499
7905
  storeApi.dispatch({
7500
7906
  type: "connect/wallet-confirmed",
7501
7907
  walletId,
7502
7908
  mode
7503
7909
  });
7504
7910
  },
7505
- [walletOptions, storeApi]
7911
+ [analytics, walletIntegration, walletOptions, storeApi]
7506
7912
  );
7507
7913
  const isSolanaWalletConnected = Boolean(
7508
7914
  walletSession?.isConnected && walletSession?.isSolana
7509
7915
  );
7510
7916
  const assetMigrationsKey = assetMigrations ? Object.keys(assetMigrations).filter((k) => assetMigrations[k]).sort().join(",") : "";
7511
- const enabledDappImportProviders = useMemo7(
7917
+ const enabledDappImportProviders = useMemo8(
7512
7918
  () => isSolanaWalletConnected ? [] : getEnabledProviders(assetMigrations),
7513
7919
  // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on assetMigrationsKey, not the assetMigrations object identity
7514
7920
  [assetMigrationsKey, isSolanaWalletConnected]
7515
7921
  );
7516
- const initialAssetMigrationProvider = useMemo7(
7922
+ const initialAssetMigrationProvider = useMemo8(
7517
7923
  () => initialAssetMigration ? enabledDappImportProviders.find((p) => p.id === initialAssetMigration) ?? null : null,
7518
7924
  [initialAssetMigration, enabledDappImportProviders]
7519
7925
  );
@@ -7531,12 +7937,15 @@ function DepositFlow({
7531
7937
  });
7532
7938
  }
7533
7939
  }
7940
+ analytics.selectMethod("asset_migration", "user", {
7941
+ provider: providerId
7942
+ });
7534
7943
  storeApi.dispatch({
7535
7944
  type: "dapp-import/provider-selected",
7536
7945
  providerId
7537
7946
  });
7538
7947
  },
7539
- [storeApi, walletOptions, dappImportOwner]
7948
+ [analytics, storeApi, walletOptions, dappImportOwner]
7540
7949
  );
7541
7950
  const handleDappImportAssetSelected = useCallback7(
7542
7951
  (asset) => {
@@ -7582,6 +7991,12 @@ function DepositFlow({
7582
7991
  });
7583
7992
  }).catch(() => {
7584
7993
  if (controller.signal.aborted) return;
7994
+ if (analytics.method === "asset_migration") {
7995
+ analytics.friction(
7996
+ "migration_availability_failed",
7997
+ "migration_provider_selection"
7998
+ );
7999
+ }
7585
8000
  storeApi.dispatch({
7586
8001
  type: "dapp-import/availability-failed",
7587
8002
  providerId: provider.id,
@@ -7591,6 +8006,7 @@ function DepositFlow({
7591
8006
  }
7592
8007
  return () => controller.abort();
7593
8008
  }, [
8009
+ analytics,
7594
8010
  dappImportOwner,
7595
8011
  enabledDappImportProviders,
7596
8012
  dappImportAttemptNonce,
@@ -7603,11 +8019,14 @@ function DepositFlow({
7603
8019
  if (flowSlice.step !== "connect" || flowSlice.mode !== null || flowSlice.isConnectSelectionConfirmed || flowSlice.hasNavigatedBack) {
7604
8020
  return;
7605
8021
  }
8022
+ analytics.selectMethod("asset_migration", "initial_config", {
8023
+ provider: initialAssetMigrationProvider.id
8024
+ });
7606
8025
  storeApi.dispatch({
7607
8026
  type: "dapp-import/boot-requested",
7608
8027
  providerId: initialAssetMigrationProvider.id
7609
8028
  });
7610
- }, [initialAssetMigrationProvider, flowSlice, storeApi]);
8029
+ }, [analytics, initialAssetMigrationProvider, flowSlice, storeApi]);
7611
8030
  const dappImportAvailability = useDepositStore((s) => s.dappImport.availability);
7612
8031
  const dappImportAvailabilityOwner = useDepositStore(
7613
8032
  (s) => s.dappImport.availabilityOwner
@@ -7616,7 +8035,7 @@ function DepositFlow({
7616
8035
  (s) => s.dappImport.activeProviderId
7617
8036
  );
7618
8037
  const dappImportBootError = useDepositStore((s) => s.dappImport.bootError);
7619
- const dappImportSelectRows = useMemo7(
8038
+ const dappImportSelectRows = useMemo8(
7620
8039
  () => enabledDappImportProviders.map((provider) => ({
7621
8040
  id: provider.id,
7622
8041
  status: computeDappImportStatus(provider.id, {
@@ -7634,7 +8053,7 @@ function DepositFlow({
7634
8053
  dappImportOwner
7635
8054
  ]
7636
8055
  );
7637
- const dappImportTotal = useMemo7(() => {
8056
+ const dappImportTotal = useMemo8(() => {
7638
8057
  let totalUsd = 0;
7639
8058
  let pending = false;
7640
8059
  for (const row of dappImportSelectRows) {
@@ -7648,13 +8067,13 @@ function DepositFlow({
7648
8067
  }
7649
8068
  return { status: pending ? "loading" : "ready", totalUsd };
7650
8069
  }, [dappImportSelectRows]);
7651
- const activeDappImportProvider = useMemo7(() => {
8070
+ const activeDappImportProvider = useMemo8(() => {
7652
8071
  if (!activeDappImportProviderId) return null;
7653
8072
  return enabledDappImportProviders.find(
7654
8073
  (p) => p.id === activeDappImportProviderId
7655
8074
  ) ?? null;
7656
8075
  }, [activeDappImportProviderId, enabledDappImportProviders]);
7657
- const activeDappImportAvailability = useMemo7(() => {
8076
+ const activeDappImportAvailability = useMemo8(() => {
7658
8077
  if (!activeDappImportProviderId) return null;
7659
8078
  if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
7660
8079
  return null;
@@ -7683,6 +8102,8 @@ function DepositFlow({
7683
8102
  const providerId = activeDappImportProviderId;
7684
8103
  if (!providerId) return;
7685
8104
  if (!enabledDappImportProviders.some((p) => p.id === providerId)) {
8105
+ analytics.abandon("initial_migration_fallback");
8106
+ analytics.resetAttempt();
7686
8107
  storeApi.dispatch({
7687
8108
  type: "dapp-import/boot-resolved",
7688
8109
  providerId,
@@ -7712,6 +8133,9 @@ function DepositFlow({
7712
8133
  type: "wallet/id-selected",
7713
8134
  walletId: pinnableWallet.id
7714
8135
  });
8136
+ } else if (outcome === "unavailable") {
8137
+ analytics.abandon("initial_migration_fallback");
8138
+ analytics.resetAttempt();
7715
8139
  }
7716
8140
  storeApi.dispatch({
7717
8141
  type: "dapp-import/boot-resolved",
@@ -7730,9 +8154,14 @@ function DepositFlow({
7730
8154
  hasResolveDeadlinePassed,
7731
8155
  isDappImportWalletHydrating,
7732
8156
  walletOptions,
8157
+ analytics,
7733
8158
  storeApi
7734
8159
  ]);
7735
8160
  const handleBootRetry = useCallback7(() => {
8161
+ analytics.retry(
8162
+ "migration_availability_failed",
8163
+ "migration_boot_resolve"
8164
+ );
7736
8165
  const snapshot = storeApi.getState();
7737
8166
  const providerId = snapshot.dappImport.activeProviderId;
7738
8167
  if (!providerId) return;
@@ -7754,20 +8183,45 @@ function DepositFlow({
7754
8183
  type: "dapp-import/boot-requested",
7755
8184
  providerId
7756
8185
  });
7757
- }, [storeApi, dappImportOwner]);
8186
+ }, [analytics, storeApi, dappImportOwner]);
7758
8187
  const handleSelectFiatMethod = useCallback7(
7759
8188
  (paymentMethod, methodSelectionSource) => {
8189
+ analytics.selectMethod("fiat_onramp", "user", {
8190
+ payment_method: paymentMethod,
8191
+ source: methodSelectionSource
8192
+ });
7760
8193
  storeApi.dispatch({
7761
8194
  type: "connect/fiat-onramp-selected",
7762
8195
  paymentMethod,
7763
8196
  methodSelectionSource
7764
8197
  });
7765
8198
  },
7766
- [storeApi]
8199
+ [analytics, storeApi]
7767
8200
  );
7768
8201
  const handleSelectExchange = useCallback7(() => {
8202
+ analytics.selectMethod("exchange_connect", "user");
7769
8203
  storeApi.dispatch({ type: "connect/exchange-selected" });
7770
- }, [storeApi]);
8204
+ }, [analytics, storeApi]);
8205
+ const swappedAnalyticsCorrelatorRef = useRef8(null);
8206
+ const handleSwappedAttemptConsumed = useCallback7((externalCustomerId) => {
8207
+ swappedAnalyticsCorrelatorRef.current = externalCustomerId;
8208
+ }, []);
8209
+ const handleSwappedProviderHandoff = useCallback7(() => {
8210
+ const externalCustomerId = swappedAnalyticsCorrelatorRef.current;
8211
+ if (!externalCustomerId) return;
8212
+ analytics.handoff(
8213
+ flowMode === "exchange-connect" ? "exchange_connect" : "fiat_onramp",
8214
+ { type: "swapped_external_customer_id", value: externalCustomerId },
8215
+ flowMode === "exchange-connect" ? "exchange_provider_handoff" : "fiat_provider_handoff"
8216
+ );
8217
+ }, [analytics, flowMode]);
8218
+ const handleSwappedRetry = useCallback7(() => {
8219
+ analytics.retry(
8220
+ "swapped_mint_failed",
8221
+ flowMode === "exchange-connect" ? "exchange_provider_mint" : "fiat_provider_mint"
8222
+ );
8223
+ swappedAnalyticsCorrelatorRef.current = null;
8224
+ }, [analytics, flowMode]);
7771
8225
  const swappedConnectUrlRef = useRef8(/* @__PURE__ */ new Map());
7772
8226
  const acknowledgedConnectFeeRef = useRef8(/* @__PURE__ */ new Map());
7773
8227
  const handleSelectExchangeConnection = useCallback7(
@@ -7808,13 +8262,16 @@ function DepositFlow({
7808
8262
  }
7809
8263
  swappedConnectUrlRef.current.set(key, entry);
7810
8264
  acknowledgedConnectFeeRef.current.set(key, actualFeeBps);
8265
+ analytics.selectMethod("exchange_connect", "user", {
8266
+ exchange: connection
8267
+ });
7811
8268
  storeApi.dispatch({
7812
8269
  type: "exchange/connection-selected",
7813
8270
  connection
7814
8271
  });
7815
8272
  return actualFeeBps;
7816
8273
  },
7817
- [service, setupSlice.status, setupSlice.smartAccount, storeApi]
8274
+ [analytics, service, setupSlice.status, setupSlice.smartAccount, storeApi]
7818
8275
  );
7819
8276
  const loadSwappedConnectUrl = useCallback7(
7820
8277
  async (smartAccount, connection) => {
@@ -7916,9 +8373,10 @@ function DepositFlow({
7916
8373
  recommendedMethod: null
7917
8374
  });
7918
8375
  let settled = false;
7919
- const showFallback = () => {
8376
+ const showFallback = (reason) => {
7920
8377
  if (cancelled || settled) return;
7921
8378
  settled = true;
8379
+ analytics.friction(reason, "fiat_regional_payment_method");
7922
8380
  setRegionalMethods({
7923
8381
  status: "error",
7924
8382
  country: null,
@@ -7926,7 +8384,10 @@ function DepositFlow({
7926
8384
  recommendedMethod: null
7927
8385
  });
7928
8386
  };
7929
- const timeoutTimer = setTimeout(showFallback, REGIONAL_METHODS_TIMEOUT_MS);
8387
+ const timeoutTimer = setTimeout(
8388
+ () => showFallback("regional_methods_timeout"),
8389
+ REGIONAL_METHODS_TIMEOUT_MS
8390
+ );
7930
8391
  service.getSwappedPaymentMethods().then((res) => {
7931
8392
  if (cancelled || settled) return;
7932
8393
  settled = true;
@@ -7935,14 +8396,14 @@ function DepositFlow({
7935
8396
  }).catch(() => {
7936
8397
  if (cancelled) return;
7937
8398
  clearTimeout(timeoutTimer);
7938
- showFallback();
8399
+ showFallback("regional_methods_failed");
7939
8400
  });
7940
8401
  return () => {
7941
8402
  cancelled = true;
7942
8403
  clearTimeout(timeoutTimer);
7943
8404
  };
7944
- }, [fiatEnabled, hasConfiguredFiatMethods, service]);
7945
- const cashDisplay = useMemo7(() => {
8405
+ }, [analytics, fiatEnabled, hasConfiguredFiatMethods, service]);
8406
+ const cashDisplay = useMemo8(() => {
7946
8407
  if (!fiatEnabled) return { kind: "hidden" };
7947
8408
  if (hasConfiguredFiatMethods) {
7948
8409
  return {
@@ -7960,45 +8421,26 @@ function DepositFlow({
7960
8421
  offeredFiatMethods,
7961
8422
  regionalMethods
7962
8423
  ]);
7963
- const lastFiatMethodsRenderedEventRef = useRef8(null);
7964
8424
  useEffect12(() => {
7965
- if (cashDisplay.kind !== "list") return;
7966
- const emit = onEventRef.current;
7967
- if (!emit) return;
7968
- const paymentMethods = cashDisplay.methods.map(({ method }) => method);
7969
- const eventKey = [
7970
- cashDisplay.source,
7971
- cashDisplay.country ?? "none",
7972
- ...paymentMethods
7973
- ].join(":");
7974
- if (lastFiatMethodsRenderedEventRef.current === eventKey) return;
7975
- lastFiatMethodsRenderedEventRef.current = eventKey;
7976
- emit({
7977
- type: "deposit_modal_fiat_methods_rendered",
7978
- country: cashDisplay.country,
7979
- payment_methods: paymentMethods,
7980
- source: cashDisplay.source
7981
- });
7982
- }, [cashDisplay, onEvent, onEventRef]);
8425
+ if (cashDisplay.kind === "hidden" && fiatEnabled) {
8426
+ analytics.friction(
8427
+ "regional_methods_empty",
8428
+ "fiat_regional_payment_method"
8429
+ );
8430
+ } else if (cashDisplay.kind === "list" && cashDisplay.source === "fallback" && !hasConfiguredFiatMethods) {
8431
+ analytics.friction(
8432
+ "regional_methods_fallback",
8433
+ "fiat_regional_payment_method"
8434
+ );
8435
+ }
8436
+ }, [analytics, cashDisplay, fiatEnabled, hasConfiguredFiatMethods]);
7983
8437
  const displayedFiatSource = cashDisplay.kind === "list" ? cashDisplay.source : void 0;
7984
- const displayedFiatCountry = cashDisplay.kind === "list" ? cashDisplay.country : null;
7985
8438
  const handleSelectDisplayedFiatMethod = useCallback7(
7986
8439
  (method) => {
7987
8440
  if (!displayedFiatSource) return;
7988
- onEventRef.current?.({
7989
- type: "deposit_modal_fiat_method_click",
7990
- country: displayedFiatCountry,
7991
- payment_method: method,
7992
- source: displayedFiatSource
7993
- });
7994
8441
  handleSelectFiatMethod(method, displayedFiatSource);
7995
8442
  },
7996
- [
7997
- displayedFiatCountry,
7998
- displayedFiatSource,
7999
- handleSelectFiatMethod,
8000
- onEventRef
8001
- ]
8443
+ [displayedFiatSource, handleSelectFiatMethod]
8002
8444
  );
8003
8445
  const handlePrefetchDisplayedFiatMethod = useCallback7(
8004
8446
  (method) => {
@@ -8008,6 +8450,8 @@ function DepositFlow({
8008
8450
  [displayedFiatSource, handlePrefetchFiatMethod]
8009
8451
  );
8010
8452
  const handleNewDeposit = useCallback7(() => {
8453
+ analytics.completeStep();
8454
+ analytics.resetAttempt();
8011
8455
  onLifecycleRef.current?.({
8012
8456
  type: "smart-account-changed",
8013
8457
  evm: null,
@@ -8020,8 +8464,8 @@ function DepositFlow({
8020
8464
  swappedConnectUrlRef.current.clear();
8021
8465
  acknowledgedConnectFeeRef.current.clear();
8022
8466
  lastSmartAccountLifecycleKeyRef.current = null;
8023
- }, [onLifecycleRef, storeApi]);
8024
- const setupInput = useMemo7(
8467
+ }, [analytics, onLifecycleRef, storeApi]);
8468
+ const setupInput = useMemo8(
8025
8469
  () => ({
8026
8470
  targetChain,
8027
8471
  targetToken,
@@ -8099,11 +8543,11 @@ function DepositFlow({
8099
8543
  }
8100
8544
  })();
8101
8545
  }, [setupInput, service, debug, storeApi, setupSlice]);
8102
- const walletOptionsKey = useMemo7(
8546
+ const walletOptionsKey = useMemo8(
8103
8547
  () => walletOptions.map((option) => option.id).join(","),
8104
8548
  [walletOptions]
8105
8549
  );
8106
- const desiredPortfolios = useMemo7(
8550
+ const desiredPortfolios = useMemo8(
8107
8551
  () => walletOptions.flatMap((option) => {
8108
8552
  const network = option.kind === "solana" ? "solana" : "evm";
8109
8553
  const address = option.kind === "solana" ? option.solanaAddress : option.address;
@@ -8159,9 +8603,13 @@ function DepositFlow({
8159
8603
  sourceChain: data.sourceChain,
8160
8604
  amount: data.amount
8161
8605
  });
8606
+ analytics.observeCorrelator(
8607
+ { type: "transaction_hash", value: data.txHash },
8608
+ "transfer_tracking"
8609
+ );
8162
8610
  onLifecycleRef.current?.({ type: "submitted", ...data });
8163
8611
  },
8164
- [logFlow, onLifecycleRef]
8612
+ [analytics, logFlow, onLifecycleRef]
8165
8613
  );
8166
8614
  const handleSolanaTokenContinue = useCallback7(
8167
8615
  (token, balance, balanceUsd) => {
@@ -8209,6 +8657,11 @@ function DepositFlow({
8209
8657
  amountUnits,
8210
8658
  token: tokenAtSubmit.symbol
8211
8659
  });
8660
+ analytics.handoff(
8661
+ "wallet",
8662
+ { type: "transaction_hash", value: txHash },
8663
+ "wallet_submit"
8664
+ );
8212
8665
  storeApi.dispatch({
8213
8666
  type: "deposit/submitted",
8214
8667
  txHash,
@@ -8232,25 +8685,18 @@ function DepositFlow({
8232
8685
  amountUsd
8233
8686
  });
8234
8687
  },
8235
- [logFlow, onLifecycleRef, storeApi]
8688
+ [analytics, logFlow, onLifecycleRef, storeApi]
8236
8689
  );
8237
8690
  const handleAssetContinue = useCallback7(
8238
8691
  (asset) => {
8239
- onEventRef.current?.({
8240
- type: "deposit_modal_connected_wallet_select_source_cta_click",
8241
- total_balance_in_external_wallet: totalBalanceUsd,
8242
- pred_balance: totalBalanceUsd,
8243
- cta_name: "token_selected",
8244
- token_name: asset.symbol,
8245
- token_balance: asset.balance ?? "0"
8246
- });
8692
+ analytics.completeStep("wallet_source_asset");
8247
8693
  storeApi.dispatch({
8248
8694
  type: "asset/selected",
8249
8695
  asset,
8250
8696
  seedAmount: defaultAmount
8251
8697
  });
8252
8698
  },
8253
- [defaultAmount, onEventRef, totalBalanceUsd, storeApi]
8699
+ [analytics, defaultAmount, storeApi]
8254
8700
  );
8255
8701
  const handleAmountContinue = useCallback7(
8256
8702
  (amount, targetAmount, balance) => {
@@ -8298,6 +8744,21 @@ function DepositFlow({
8298
8744
  });
8299
8745
  const depositAtSubmit = storeApi.getState().deposit;
8300
8746
  const asset = depositAtSubmit.selectedAsset;
8747
+ const handoffMethod = flowMode === "dapp-import" ? "asset_migration" : "wallet";
8748
+ const handoffStep = flowMode === "dapp-import" ? "migration_submit" : "wallet_submit";
8749
+ if (routed.depositId) {
8750
+ analytics.handoff(
8751
+ handoffMethod,
8752
+ { type: "deposit_id", value: routed.depositId },
8753
+ handoffStep
8754
+ );
8755
+ } else if (!routed.sourceTxHashPending) {
8756
+ analytics.handoff(
8757
+ handoffMethod,
8758
+ { type: "transaction_hash", value: txHash },
8759
+ handoffStep
8760
+ );
8761
+ }
8301
8762
  storeApi.dispatch({
8302
8763
  type: "deposit/submitted",
8303
8764
  txHash,
@@ -8317,7 +8778,7 @@ function DepositFlow({
8317
8778
  quote
8318
8779
  });
8319
8780
  },
8320
- [logFlow, storeApi]
8781
+ [analytics, flowMode, logFlow, storeApi]
8321
8782
  );
8322
8783
  const handleSwappedComplete = useCallback7(
8323
8784
  (info) => {
@@ -8393,6 +8854,10 @@ function DepositFlow({
8393
8854
  const handleDepositComplete = useCallback7(
8394
8855
  (txHash, destinationTxHash, context) => {
8395
8856
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
8857
+ analytics.openStep(
8858
+ analyticsStepForFlowStep(analyticsMethod, "processing")
8859
+ );
8860
+ analytics.outcome("completed");
8396
8861
  onLifecycleRef.current?.({
8397
8862
  type: "complete",
8398
8863
  txHash,
@@ -8400,21 +8865,40 @@ function DepositFlow({
8400
8865
  ...context
8401
8866
  });
8402
8867
  },
8403
- [logFlow, onLifecycleRef]
8868
+ [analytics, analyticsMethod, logFlow, onLifecycleRef]
8404
8869
  );
8405
8870
  const handleDepositFailed = useCallback7(
8406
8871
  (txHash, error) => {
8407
8872
  logFlowError("deposit:failed", error, { txHash });
8873
+ analytics.openStep(
8874
+ analyticsStepForFlowStep(analyticsMethod, "processing")
8875
+ );
8876
+ analytics.outcome("failed");
8877
+ analytics.failure("processor_failed", false);
8408
8878
  onLifecycleRef.current?.({ type: "failed", txHash, error });
8409
8879
  },
8410
- [logFlowError, onLifecycleRef]
8880
+ [analytics, analyticsMethod, logFlowError, onLifecycleRef]
8411
8881
  );
8412
8882
  const handleError = useCallback7(
8413
8883
  (message, code, cause) => {
8414
8884
  logFlowError("flow:error", cause ?? message, { code });
8885
+ if (code === "PROCESS_TIMEOUT") {
8886
+ analytics.friction("processor_status_poll_failed");
8887
+ } else {
8888
+ const reason = failureReasonForCode(
8889
+ code,
8890
+ `${message} ${cause ?? ""}`
8891
+ );
8892
+ const failureStep = code === "SWAPPED_URL_FAILED" ? "fiat_provider_mint" : code === "SWAPPED_CONNECT_URL_FAILED" ? "exchange_provider_mint" : void 0;
8893
+ analytics.failure(
8894
+ reason,
8895
+ reason !== "submission_uncertain",
8896
+ failureStep
8897
+ );
8898
+ }
8415
8899
  onErrorRef.current?.({ message, code, cause });
8416
8900
  },
8417
- [logFlowError, onErrorRef]
8901
+ [analytics, logFlowError, onErrorRef]
8418
8902
  );
8419
8903
  const handleTotalBalanceComputed = useCallback7((total) => {
8420
8904
  setTotalBalanceUsd(total);
@@ -8441,7 +8925,7 @@ function DepositFlow({
8441
8925
  signerContext,
8442
8926
  storeApi
8443
8927
  ]);
8444
- const walletRows = useMemo7(() => {
8928
+ const walletRows = useMemo8(() => {
8445
8929
  if (!enableWallet) return [];
8446
8930
  return walletOptions.map((option) => {
8447
8931
  const entry = setupSlice;
@@ -8470,10 +8954,11 @@ function DepositFlow({
8470
8954
  const transferCryptoEntry = setupSlice;
8471
8955
  const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
8472
8956
  const handleRetrySetup = useCallback7(() => {
8957
+ analytics.retry("account_setup_failed", "account_setup");
8473
8958
  storeApi.dispatch({ type: "setup/retry-requested" });
8474
- }, [storeApi]);
8959
+ }, [analytics, storeApi]);
8475
8960
  if (showConnectStep) {
8476
- return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27(
8961
+ return /* @__PURE__ */ jsx28("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx28(
8477
8962
  ConnectStep,
8478
8963
  {
8479
8964
  walletRows,
@@ -8518,7 +9003,10 @@ function DepositFlow({
8518
9003
  // hasn't landed must still surface the row and show it inside the
8519
9004
  // picker as "Coming soon" — keying this on implemented providers
8520
9005
  // hid the feature entirely for such a config.
8521
- enabledAssetMigrationIds.length > 0 ? () => storeApi.dispatch({ type: "dapp-import/picker-opened" }) : void 0
9006
+ enabledAssetMigrationIds.length > 0 ? () => {
9007
+ analytics.selectMethod("asset_migration", "user");
9008
+ storeApi.dispatch({ type: "dapp-import/picker-opened" });
9009
+ } : void 0
8522
9010
  ),
8523
9011
  migrateAssetsBalanceStatus: dappImportTotal.status,
8524
9012
  migrateAssetsBalanceUsd: dappImportTotal.totalUsd
@@ -8527,19 +9015,19 @@ function DepositFlow({
8527
9015
  }
8528
9016
  if (isDepositAddressMode) {
8529
9017
  return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8530
- effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx27(
9018
+ effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx28(
8531
9019
  AccountPreparingSkeleton,
8532
9020
  {
8533
9021
  errorMessage: activeEntry.message ?? void 0,
8534
9022
  onRetry: () => handleRetrySetup()
8535
9023
  }
8536
- ) : /* @__PURE__ */ jsx27(
9024
+ ) : /* @__PURE__ */ jsx28(
8537
9025
  DepositAddressSkeleton,
8538
9026
  {
8539
9027
  uiConfig
8540
9028
  }
8541
9029
  )),
8542
- effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx27(
9030
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx28(
8543
9031
  DepositAddressStep,
8544
9032
  {
8545
9033
  smartAccount: effectiveStep.smartAccount,
@@ -8552,23 +9040,38 @@ function DepositFlow({
8552
9040
  onDepositSubmitted: handleDepositAddressSubmitted,
8553
9041
  onDepositComplete: handleDepositComplete,
8554
9042
  onDepositFailed: handleDepositFailed,
8555
- onCopyAddress: () => {
8556
- const chainName = getChainName(targetChainId);
8557
- const tokenSymbol = getTargetTokenSymbol(targetToken, targetChainId);
8558
- onEvent?.({
8559
- type: "deposit_modal_transfer_crypto_cta_click",
8560
- default_chain: chainName,
8561
- default_token: tokenSymbol,
8562
- pred_balance: totalBalanceUsd,
8563
- cta_name: "copy"
8564
- });
9043
+ onAddressShown: ({
9044
+ address,
9045
+ sourceChainCaip2,
9046
+ sourceTokenIdentity
9047
+ }) => {
9048
+ analytics.handoff(
9049
+ "transfer",
9050
+ { type: "deposit_address", value: address },
9051
+ "transfer_address_shown",
9052
+ {
9053
+ source_chain: sourceChainCaip2,
9054
+ source_token: sourceTokenIdentity
9055
+ }
9056
+ );
9057
+ },
9058
+ onCopyAddress: (success) => {
9059
+ if (success) {
9060
+ analytics.completeStep("transfer_copy");
9061
+ } else {
9062
+ analytics.failure(
9063
+ "transfer_clipboard_failed",
9064
+ true,
9065
+ "transfer_copy"
9066
+ );
9067
+ }
8565
9068
  },
8566
9069
  onReviewDeposit: handleQrReviewRequested,
8567
9070
  onError: handleError,
8568
9071
  debug
8569
9072
  }
8570
9073
  ),
8571
- effectiveStep.type === "qr-amount" && /* @__PURE__ */ jsx27(
9074
+ effectiveStep.type === "qr-amount" && /* @__PURE__ */ jsx28(
8572
9075
  AmountStep,
8573
9076
  {
8574
9077
  asset: effectiveStep.asset,
@@ -8584,7 +9087,7 @@ function DepositFlow({
8584
9087
  onContinue: handleQrAmountContinue
8585
9088
  }
8586
9089
  ),
8587
- effectiveStep.type === "qr-review" && /* @__PURE__ */ jsx27(
9090
+ effectiveStep.type === "qr-review" && /* @__PURE__ */ jsx28(
8588
9091
  QrReviewStep,
8589
9092
  {
8590
9093
  smartAccount: effectiveStep.smartAccount,
@@ -8608,14 +9111,14 @@ function DepositFlow({
8608
9111
  "data-flow-mode": "fiat-onramp",
8609
9112
  "data-step-type": step.type,
8610
9113
  children: [
8611
- step.type === "setup" && /* @__PURE__ */ jsx27(
9114
+ step.type === "setup" && /* @__PURE__ */ jsx28(
8612
9115
  AccountPreparingSkeleton,
8613
9116
  {
8614
9117
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8615
9118
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8616
9119
  }
8617
9120
  ),
8618
- step.type === "fiat-onramp" && /* @__PURE__ */ jsx27(
9121
+ step.type === "fiat-onramp" && /* @__PURE__ */ jsx28(
8619
9122
  FiatOnrampStep,
8620
9123
  {
8621
9124
  smartAccount: step.smartAccount,
@@ -8625,15 +9128,20 @@ function DepositFlow({
8625
9128
  consumePrefetchedUrl: consumeSwappedWidgetUrlPrefetch,
8626
9129
  onSwappedComplete: handleSwappedComplete,
8627
9130
  onSwappedFailed: handleDepositFailed,
8628
- onClose: onClose ?? (() => {
8629
- }),
8630
- onGoBack: handleBack,
9131
+ onClose: () => onClose?.(
9132
+ openExternally ? "native_dismiss_request" : "header_button"
9133
+ ),
9134
+ onGoBack: handleProviderBack,
8631
9135
  onError: handleError,
9136
+ onAttemptConsumed: handleSwappedAttemptConsumed,
9137
+ onProviderHandoff: handleSwappedProviderHandoff,
9138
+ onRetry: handleSwappedRetry,
9139
+ onCancelled: () => analytics.outcome("cancelled"),
8632
9140
  onImmersiveChange: onSwappedImmersiveChange,
8633
9141
  openExternally
8634
9142
  }
8635
9143
  ),
8636
- step.type === "processing" && /* @__PURE__ */ jsx27(
9144
+ step.type === "processing" && /* @__PURE__ */ jsx28(
8637
9145
  ProcessingStep,
8638
9146
  {
8639
9147
  smartAccount: step.smartAccount,
@@ -8675,14 +9183,14 @@ function DepositFlow({
8675
9183
  "data-flow-mode": "exchange-connect",
8676
9184
  "data-step-type": step.type,
8677
9185
  children: [
8678
- step.type === "setup" && /* @__PURE__ */ jsx27(
9186
+ step.type === "setup" && /* @__PURE__ */ jsx28(
8679
9187
  AccountPreparingSkeleton,
8680
9188
  {
8681
9189
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8682
9190
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8683
9191
  }
8684
9192
  ),
8685
- step.type === "exchange-select" && /* @__PURE__ */ jsx27(
9193
+ step.type === "exchange-select" && /* @__PURE__ */ jsx28(
8686
9194
  ExchangeSelectStep,
8687
9195
  {
8688
9196
  service,
@@ -8690,7 +9198,7 @@ function DepositFlow({
8690
9198
  onError: handleError
8691
9199
  }
8692
9200
  ),
8693
- step.type === "exchange-connect" && /* @__PURE__ */ jsx27(
9201
+ step.type === "exchange-connect" && /* @__PURE__ */ jsx28(
8694
9202
  ExchangeConnectStep,
8695
9203
  {
8696
9204
  smartAccount: step.smartAccount,
@@ -8699,15 +9207,20 @@ function DepositFlow({
8699
9207
  loadUrl: () => loadSwappedConnectUrl(step.smartAccount, step.connection),
8700
9208
  onSwappedComplete: handleSwappedComplete,
8701
9209
  onSwappedFailed: handleDepositFailed,
8702
- onClose: onClose ?? (() => {
8703
- }),
8704
- onGoBack: handleBack,
9210
+ onClose: () => onClose?.(
9211
+ openExternally ? "native_dismiss_request" : "header_button"
9212
+ ),
9213
+ onGoBack: handleProviderBack,
8705
9214
  onError: handleError,
9215
+ onAttemptConsumed: handleSwappedAttemptConsumed,
9216
+ onProviderHandoff: handleSwappedProviderHandoff,
9217
+ onRetry: handleSwappedRetry,
9218
+ onCancelled: () => analytics.outcome("cancelled"),
8706
9219
  onImmersiveChange: onSwappedImmersiveChange,
8707
9220
  openExternally
8708
9221
  }
8709
9222
  ),
8710
- step.type === "processing" && /* @__PURE__ */ jsx27(
9223
+ step.type === "processing" && /* @__PURE__ */ jsx28(
8711
9224
  ProcessingStep,
8712
9225
  {
8713
9226
  smartAccount: step.smartAccount,
@@ -8745,28 +9258,25 @@ function DepositFlow({
8745
9258
  const solanaAddr = walletSession?.solanaAddress;
8746
9259
  const solanaProvider = walletSession?.solanaProvider;
8747
9260
  return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8748
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
9261
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx28(
8749
9262
  AccountPreparingSkeleton,
8750
9263
  {
8751
9264
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8752
9265
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8753
9266
  }
8754
9267
  ),
8755
- effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx27(
9268
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx28(
8756
9269
  SolanaTokenSelectStep,
8757
9270
  {
8758
9271
  solanaAddress: solanaAddr,
8759
9272
  service,
8760
9273
  onContinue: handleSolanaTokenContinue,
8761
9274
  onTotalBalanceComputed: handleTotalBalanceComputed,
8762
- onDisconnect: onDisconnect ? () => {
8763
- onDisconnect();
8764
- handleBack();
8765
- } : void 0,
9275
+ onDisconnect: onDisconnect ? handleWalletDisconnect : void 0,
8766
9276
  debug
8767
9277
  }
8768
9278
  ),
8769
- effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx27(
9279
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx28(
8770
9280
  SolanaAmountStep,
8771
9281
  {
8772
9282
  token: effectiveStep.token,
@@ -8782,7 +9292,7 @@ function DepositFlow({
8782
9292
  debug
8783
9293
  }
8784
9294
  ),
8785
- effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx27(
9295
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx28(
8786
9296
  SolanaConfirmStep,
8787
9297
  {
8788
9298
  smartAccount: effectiveStep.smartAccount,
@@ -8805,14 +9315,14 @@ function DepositFlow({
8805
9315
  }
8806
9316
  ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
8807
9317
  /* @__PURE__ */ jsxs23("div", { className: "rs-loading-state", children: [
8808
- /* @__PURE__ */ jsx27("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx27(
9318
+ /* @__PURE__ */ jsx28("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx28(
8809
9319
  "svg",
8810
9320
  {
8811
9321
  viewBox: "0 0 24 24",
8812
9322
  fill: "none",
8813
9323
  stroke: "currentColor",
8814
9324
  strokeWidth: "2",
8815
- children: /* @__PURE__ */ jsx27(
9325
+ children: /* @__PURE__ */ jsx28(
8816
9326
  "path",
8817
9327
  {
8818
9328
  strokeLinecap: "round",
@@ -8823,21 +9333,21 @@ function DepositFlow({
8823
9333
  }
8824
9334
  ) }),
8825
9335
  /* @__PURE__ */ jsxs23("div", { className: "rs-loading-text", children: [
8826
- /* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
8827
- /* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
9336
+ /* @__PURE__ */ jsx28("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
9337
+ /* @__PURE__ */ jsx28("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
8828
9338
  ] })
8829
9339
  ] }),
8830
- /* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
9340
+ /* @__PURE__ */ jsx28("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx28(
8831
9341
  "button",
8832
9342
  {
8833
9343
  type: "button",
8834
9344
  className: "rs-button rs-button--default rs-button--full-width",
8835
9345
  onClick: handleBack,
8836
- children: /* @__PURE__ */ jsx27("span", { children: "Go Back" })
9346
+ children: /* @__PURE__ */ jsx28("span", { children: "Go Back" })
8837
9347
  }
8838
9348
  ) })
8839
9349
  ] }) : null,
8840
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
9350
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx28(
8841
9351
  ProcessingStep,
8842
9352
  {
8843
9353
  smartAccount: effectiveStep.smartAccount,
@@ -8867,13 +9377,13 @@ function DepositFlow({
8867
9377
  ] });
8868
9378
  }
8869
9379
  if (isDappImportMode && effectiveStep.type === "dapp-import-resolving") {
8870
- return /* @__PURE__ */ jsx27(
9380
+ return /* @__PURE__ */ jsx28(
8871
9381
  "div",
8872
9382
  {
8873
9383
  className: "rs-modal-body",
8874
9384
  "data-flow-mode": "dapp-import",
8875
9385
  "data-step-type": effectiveStep.type,
8876
- children: /* @__PURE__ */ jsx27(
9386
+ children: /* @__PURE__ */ jsx28(
8877
9387
  DappImportAssetSelectSkeleton,
8878
9388
  {
8879
9389
  sourceLabel: activeDappImportProvider?.sourceLabel ?? "",
@@ -8885,13 +9395,13 @@ function DepositFlow({
8885
9395
  );
8886
9396
  }
8887
9397
  if (effectiveStep.type === "dapp-import-select") {
8888
- return /* @__PURE__ */ jsx27(
9398
+ return /* @__PURE__ */ jsx28(
8889
9399
  "div",
8890
9400
  {
8891
9401
  className: "rs-modal-body",
8892
9402
  "data-flow-mode": "dapp-import",
8893
9403
  "data-step-type": effectiveStep.type,
8894
- children: /* @__PURE__ */ jsx27(
9404
+ children: /* @__PURE__ */ jsx28(
8895
9405
  DappImportSelectStep,
8896
9406
  {
8897
9407
  enabledIds: enabledAssetMigrationIds,
@@ -8918,7 +9428,7 @@ function DepositFlow({
8918
9428
  );
8919
9429
  }
8920
9430
  if (!signerContext?.walletClient || !signerContext?.publicClient) {
8921
- return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27("div", { className: "rs-step", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
9431
+ return /* @__PURE__ */ jsx28("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx28("div", { className: "rs-step", children: /* @__PURE__ */ jsx28("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx28("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx28("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
8922
9432
  }
8923
9433
  const ownerAddress = signerContext.ownerAddress;
8924
9434
  const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
@@ -8929,14 +9439,14 @@ function DepositFlow({
8929
9439
  return getPublicClient(chainId, rpcUrls);
8930
9440
  };
8931
9441
  return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8932
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
9442
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx28(
8933
9443
  AccountPreparingSkeleton,
8934
9444
  {
8935
9445
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8936
9446
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8937
9447
  }
8938
9448
  ),
8939
- effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx27(
9449
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx28(
8940
9450
  AssetSelectStep,
8941
9451
  {
8942
9452
  address: ownerAddress,
@@ -8946,13 +9456,10 @@ function DepositFlow({
8946
9456
  service,
8947
9457
  onContinue: handleAssetContinue,
8948
9458
  onTotalBalanceComputed: handleTotalBalanceComputed,
8949
- onDisconnect: onDisconnect ? () => {
8950
- onDisconnect();
8951
- handleBack();
8952
- } : void 0
9459
+ onDisconnect: onDisconnect ? handleWalletDisconnect : void 0
8953
9460
  }
8954
9461
  ),
8955
- effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx27(
9462
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx28(
8956
9463
  DappImportAssetSelectStep,
8957
9464
  {
8958
9465
  sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.sourceLabel,
@@ -8961,7 +9468,7 @@ function DepositFlow({
8961
9468
  onSelect: handleDappImportAssetSelected
8962
9469
  }
8963
9470
  ),
8964
- effectiveStep.type === "amount" && /* @__PURE__ */ jsx27(
9471
+ effectiveStep.type === "amount" && /* @__PURE__ */ jsx28(
8965
9472
  AmountStep,
8966
9473
  {
8967
9474
  walletClient: signerContext.walletClient,
@@ -8978,18 +9485,11 @@ function DepositFlow({
8978
9485
  service,
8979
9486
  onContinue: handleAmountContinue,
8980
9487
  onCtaClick: (ctaName) => {
8981
- const receiveSymbol = getTargetTokenSymbol(targetToken, targetChainId);
8982
- onEvent?.({
8983
- type: "deposit_modal_connected_wallet_enter_value_cta_click",
8984
- send_token: effectiveStep.asset.symbol,
8985
- receive_token: receiveSymbol,
8986
- pred_balance: totalBalanceUsd,
8987
- cta_name: ctaName
8988
- });
9488
+ if (ctaName === "continue") analytics.completeStep();
8989
9489
  }
8990
9490
  }
8991
9491
  ),
8992
- effectiveStep.type === "confirm" && /* @__PURE__ */ jsx27(
9492
+ effectiveStep.type === "confirm" && /* @__PURE__ */ jsx28(
8993
9493
  ConfirmStep,
8994
9494
  {
8995
9495
  walletClient: signerContext.walletClient,
@@ -9038,7 +9538,7 @@ function DepositFlow({
9038
9538
  onError: handleError
9039
9539
  }
9040
9540
  ),
9041
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
9541
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx28(
9042
9542
  ProcessingStep,
9043
9543
  {
9044
9544
  smartAccount: effectiveStep.smartAccount,
@@ -9058,6 +9558,10 @@ function DepositFlow({
9058
9558
  initialEvent: effectiveStep.initialEvent,
9059
9559
  quote: effectiveStep.quote,
9060
9560
  uiConfig,
9561
+ onSourceTransactionObserved: (txHash) => analytics.observeCorrelator(
9562
+ { type: "transaction_hash", value: txHash },
9563
+ flowMode === "dapp-import" ? "migration_processing" : "wallet_processing"
9564
+ ),
9061
9565
  onClose,
9062
9566
  onNewDeposit: handleNewDeposit,
9063
9567
  onRetry: handleNewDeposit,
@@ -9071,8 +9575,8 @@ function DepositFlow({
9071
9575
  }
9072
9576
 
9073
9577
  // src/components/history/DepositHistoryPanel.tsx
9074
- import { useCallback as useCallback8, useMemo as useMemo8, useState as useState14 } from "react";
9075
- import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
9578
+ import { useCallback as useCallback8, useMemo as useMemo9, useState as useState14 } from "react";
9579
+ import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9076
9580
  function shortenHash(hash) {
9077
9581
  if (hash.length <= 14) return hash;
9078
9582
  return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
@@ -9188,7 +9692,7 @@ function DepositHistoryPanel({
9188
9692
  },
9189
9693
  [onClose]
9190
9694
  );
9191
- const visibleDeposits = useMemo8(() => {
9695
+ const visibleDeposits = useMemo9(() => {
9192
9696
  const sourceHashes = new Set(
9193
9697
  deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
9194
9698
  );
@@ -9205,54 +9709,54 @@ function DepositHistoryPanel({
9205
9709
  onKeyDown: handleKeyDown,
9206
9710
  children: [
9207
9711
  /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9208
- /* @__PURE__ */ jsx28("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx28(
9712
+ /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx29(
9209
9713
  "button",
9210
9714
  {
9211
9715
  type: "button",
9212
9716
  className: "rs-modal-header-back",
9213
9717
  "aria-label": "Back",
9214
9718
  onClick: onClose,
9215
- children: /* @__PURE__ */ jsx28(ChevronLeftIcon, {})
9719
+ children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
9216
9720
  }
9217
9721
  ) }),
9218
- /* @__PURE__ */ jsx28("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx28(
9722
+ /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx29(
9219
9723
  "button",
9220
9724
  {
9221
9725
  type: "button",
9222
9726
  className: "rs-modal-close",
9223
9727
  "aria-label": "Close",
9224
9728
  onClick: onCloseModal,
9225
- children: /* @__PURE__ */ jsx28(CloseIcon, {})
9729
+ children: /* @__PURE__ */ jsx29(CloseIcon, {})
9226
9730
  }
9227
9731
  ) })
9228
9732
  ] }),
9229
9733
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen", children: [
9230
9734
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen-body", children: [
9231
- /* @__PURE__ */ jsx28(BodyHeader, { icon: /* @__PURE__ */ jsx28(HistoryIcon, {}), title: "History" }),
9735
+ /* @__PURE__ */ jsx29(BodyHeader, { icon: /* @__PURE__ */ jsx29(HistoryIcon, {}), title: "History" }),
9232
9736
  isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9233
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }),
9737
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9234
9738
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9235
- /* @__PURE__ */ jsx28(Spinner, { className: "rs-spinner--sm" }),
9236
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
9739
+ /* @__PURE__ */ jsx29(Spinner, { className: "rs-spinner--sm" }),
9740
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
9237
9741
  ] })
9238
9742
  ] }),
9239
9743
  error && !isLoading && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9240
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(AlertTriangleIcon, {}) }),
9744
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(AlertTriangleIcon, {}) }),
9241
9745
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9242
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
9243
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: error })
9746
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
9747
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: error })
9244
9748
  ] })
9245
9749
  ] }),
9246
9750
  !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9247
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }),
9751
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9248
9752
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9249
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
9250
- /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
9753
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
9754
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
9251
9755
  ] })
9252
9756
  ] }),
9253
9757
  visibleDeposits.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-list", children: [
9254
- visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx28(HistoryCard, { deposit }, deposit.txHash || i)),
9255
- hasMore && /* @__PURE__ */ jsx28(
9758
+ visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx29(HistoryCard, { deposit }, deposit.txHash || i)),
9759
+ hasMore && /* @__PURE__ */ jsx29(
9256
9760
  "button",
9257
9761
  {
9258
9762
  type: "button",
@@ -9264,7 +9768,7 @@ function DepositHistoryPanel({
9264
9768
  )
9265
9769
  ] })
9266
9770
  ] }),
9267
- /* @__PURE__ */ jsx28(PoweredBy, {})
9771
+ /* @__PURE__ */ jsx29(PoweredBy, {})
9268
9772
  ] })
9269
9773
  ]
9270
9774
  }
@@ -9301,35 +9805,35 @@ function HistoryCard({ deposit }) {
9301
9805
  children: [
9302
9806
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-row", children: [
9303
9807
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-icons", children: [
9304
- /* @__PURE__ */ jsx28("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx28(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
9305
- sourceChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx28(CdnIcon, { src: sourceChainIcon }) })
9808
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx29(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
9809
+ sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9306
9810
  ] }),
9307
9811
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-text", children: [
9308
- /* @__PURE__ */ jsx28("span", { className: "rs-history-card-title", children: txTypeLabel }),
9309
- date && /* @__PURE__ */ jsx28("span", { className: "rs-history-card-date", children: date })
9812
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-card-title", children: txTypeLabel }),
9813
+ date && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-date", children: date })
9310
9814
  ] }),
9311
9815
  /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-side", children: [
9312
- /* @__PURE__ */ jsx28("span", { className: "rs-history-card-amount", children: displayAmount }),
9313
- /* @__PURE__ */ jsx28("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
9816
+ /* @__PURE__ */ jsx29("span", { className: "rs-history-card-amount", children: displayAmount }),
9817
+ /* @__PURE__ */ jsx29("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
9314
9818
  ] })
9315
9819
  ] }),
9316
- /* @__PURE__ */ jsx28("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx28("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-details", children: [
9820
+ /* @__PURE__ */ jsx29("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx29("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-details", children: [
9317
9821
  sourceChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9318
- /* @__PURE__ */ jsx28("span", { children: "Source chain" }),
9822
+ /* @__PURE__ */ jsx29("span", { children: "Source chain" }),
9319
9823
  /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9320
- /* @__PURE__ */ jsx28("span", { children: sourceChainName }),
9321
- sourceChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx28(CdnIcon, { src: sourceChainIcon }) })
9824
+ /* @__PURE__ */ jsx29("span", { children: sourceChainName }),
9825
+ sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9322
9826
  ] })
9323
9827
  ] }),
9324
9828
  targetChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9325
- /* @__PURE__ */ jsx28("span", { children: "Destination chain" }),
9829
+ /* @__PURE__ */ jsx29("span", { children: "Destination chain" }),
9326
9830
  /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9327
- /* @__PURE__ */ jsx28("span", { children: targetChainName }),
9328
- targetChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx28(CdnIcon, { src: targetChainIcon }) })
9831
+ /* @__PURE__ */ jsx29("span", { children: targetChainName }),
9832
+ targetChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: targetChainIcon }) })
9329
9833
  ] })
9330
9834
  ] }),
9331
9835
  srcTxUrl && srcTxHash && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9332
- /* @__PURE__ */ jsx28("span", { children: "Transaction details" }),
9836
+ /* @__PURE__ */ jsx29("span", { children: "Transaction details" }),
9333
9837
  /* @__PURE__ */ jsxs24(
9334
9838
  "a",
9335
9839
  {
@@ -9339,8 +9843,8 @@ function HistoryCard({ deposit }) {
9339
9843
  className: "rs-history-card-link",
9340
9844
  onClick: (e) => e.stopPropagation(),
9341
9845
  children: [
9342
- /* @__PURE__ */ jsx28("span", { children: shortenHash(srcTxHash) }),
9343
- /* @__PURE__ */ jsx28(ArrowUpRightIcon, {})
9846
+ /* @__PURE__ */ jsx29("span", { children: shortenHash(srcTxHash) }),
9847
+ /* @__PURE__ */ jsx29(ArrowUpRightIcon, {})
9344
9848
  ]
9345
9849
  }
9346
9850
  )
@@ -9353,9 +9857,9 @@ function HistoryCard({ deposit }) {
9353
9857
  DepositHistoryPanel.displayName = "DepositHistoryPanel";
9354
9858
 
9355
9859
  // src/DepositModal.tsx
9356
- import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
9860
+ import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
9357
9861
  var ReownDepositInner = lazy2(
9358
- () => import("./DepositModalReown-3H75G3XQ.mjs").then((m) => ({ default: m.DepositModalReown }))
9862
+ () => import("./DepositModalReown-Q2JMLT47.mjs").then((m) => ({ default: m.DepositModalReown }))
9359
9863
  );
9360
9864
  function sortByCreatedAtDesc(items) {
9361
9865
  return [...items].sort((a, b) => {
@@ -9364,6 +9868,55 @@ function sortByCreatedAtDesc(items) {
9364
9868
  return bt - at;
9365
9869
  });
9366
9870
  }
9871
+ function buildDepositAnalyticsSessionProperties({
9872
+ enableWallet = true,
9873
+ enableFiatOnramp = false,
9874
+ enableQrTransfer = true,
9875
+ enableGaslessDeposit = false,
9876
+ enableExchangeConnect = false,
9877
+ fiatMethods,
9878
+ assetMigrations,
9879
+ initialAssetMigration,
9880
+ inline = false,
9881
+ closeOnOverlayClick = false,
9882
+ sourceChain,
9883
+ sourceToken,
9884
+ defaultAmount,
9885
+ walletIntegration,
9886
+ targetChain,
9887
+ targetToken
9888
+ }) {
9889
+ const configuredFiatIdentifiers = fiatMethods ? Object.entries(fiatMethods).filter(([, enabled]) => enabled === true).map(([identifier]) => identifier).sort() : null;
9890
+ const migrationProviders = Object.entries(assetMigrations ?? {}).filter(([, enabled]) => enabled === true).map(([identifier]) => identifier).sort();
9891
+ const safeInitialMigration = initialAssetMigration && migrationProviders.includes(initialAssetMigration) ? initialAssetMigration : null;
9892
+ const enabledFundingMethods = [];
9893
+ if (enableWallet && walletIntegration !== "none") {
9894
+ enabledFundingMethods.push("wallet");
9895
+ }
9896
+ if (enableQrTransfer) enabledFundingMethods.push("transfer");
9897
+ if (enableFiatOnramp && configuredFiatIdentifiers?.length !== 0) {
9898
+ enabledFundingMethods.push("fiat_onramp");
9899
+ }
9900
+ if (enableExchangeConnect) enabledFundingMethods.push("exchange_connect");
9901
+ if (migrationProviders.length > 0) enabledFundingMethods.push("asset_migration");
9902
+ return {
9903
+ enabled_funding_methods: enabledFundingMethods,
9904
+ wallet_integration: walletIntegration,
9905
+ fiat_methods: configuredFiatIdentifiers === null ? { source: "backend_resolved" } : { source: "configured", identifiers: configuredFiatIdentifiers },
9906
+ asset_migration_providers: migrationProviders,
9907
+ initial_asset_migration: safeInitialMigration,
9908
+ gasless_wallet_flow_enabled: enableGaslessDeposit,
9909
+ presentation: inline ? "inline" : "overlay",
9910
+ overlay_close_enabled: !inline && closeOnOverlayClick,
9911
+ prefills: {
9912
+ source_chain: sourceChain !== void 0,
9913
+ source_token: sourceToken !== void 0,
9914
+ amount: defaultAmount !== void 0,
9915
+ initial_asset_migration: initialAssetMigration !== void 0
9916
+ },
9917
+ ...analyticsTargetProperties({ targetChain, targetToken })
9918
+ };
9919
+ }
9367
9920
  var WALLET_CLIENT_PROP = "walletClient";
9368
9921
  function hasSuppliedWalletClient(props) {
9369
9922
  return Object.prototype.hasOwnProperty.call(props, WALLET_CLIENT_PROP);
@@ -9374,7 +9927,7 @@ function DepositModal(props) {
9374
9927
  const needsReown = !!props.reownAppId;
9375
9928
  const hasWalletClientProp = hasSuppliedWalletClient(props);
9376
9929
  if (needsReown) {
9377
- return /* @__PURE__ */ jsx29(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx29(
9930
+ return /* @__PURE__ */ jsx30(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx30(
9378
9931
  ReownDepositInner,
9379
9932
  {
9380
9933
  ...props,
@@ -9382,7 +9935,7 @@ function DepositModal(props) {
9382
9935
  }
9383
9936
  ) });
9384
9937
  }
9385
- return /* @__PURE__ */ jsx29(
9938
+ return /* @__PURE__ */ jsx30(
9386
9939
  DepositModalInner,
9387
9940
  {
9388
9941
  ...props,
@@ -9430,11 +9983,16 @@ function DepositModalInner({
9430
9983
  onLifecycle,
9431
9984
  onEvent,
9432
9985
  onError,
9986
+ enableAnalyticsIngest,
9987
+ analyticsIngestUrl,
9433
9988
  onUiState,
9434
9989
  openExternally,
9990
+ walletIntegration: walletIntegrationProp,
9435
9991
  debug
9436
9992
  }) {
9437
9993
  const modalRef = useRef9(null);
9994
+ const analyticsControllerRef = useRef9(null);
9995
+ const previousOpenRef = useRef9(isOpen);
9438
9996
  const onReadyRef = useLatestRef(onReady);
9439
9997
  const onUiStateRef = useLatestRef(onUiState);
9440
9998
  const [currentScreen, setCurrentScreen] = useState15("connect");
@@ -9456,7 +10014,7 @@ function DepositModalInner({
9456
10014
  const targetChain = targetChainProp === "solana" || targetChainProp === HYPERCORE_SPOT_CAIP2 ? targetChainProp : getChainId(targetChainProp);
9457
10015
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
9458
10016
  const rpcUrls = useStableRpcUrls(rpcUrlsProp);
9459
- const service = useMemo9(
10017
+ const service = useMemo10(
9460
10018
  () => createDepositService(backendUrl, {
9461
10019
  debug,
9462
10020
  debugScope: "service:deposit"
@@ -9481,7 +10039,7 @@ function DepositModalInner({
9481
10039
  console.debug("[deposit] client setup config (not shown yet)", clientSetup);
9482
10040
  }
9483
10041
  }, [debug, clientSetup]);
9484
- const store = useMemo9(
10042
+ const store = useMemo10(
9485
10043
  () => createDepositStore({ targetChain, targetToken }),
9486
10044
  // eslint-disable-next-line react-hooks/exhaustive-deps
9487
10045
  []
@@ -9591,6 +10149,31 @@ function DepositModalInner({
9591
10149
  },
9592
10150
  [onLifecycleRef, markHistoryStale]
9593
10151
  );
10152
+ const closeWithSource = useCallback9(
10153
+ (source) => {
10154
+ const analytics = analyticsControllerRef.current;
10155
+ analytics?.abandon(source === "provider_back" ? "provider_back" : "modal_close");
10156
+ analytics?.close(source);
10157
+ onClose();
10158
+ },
10159
+ [onClose]
10160
+ );
10161
+ const handleModalDismiss = useCallback9(
10162
+ (reason) => {
10163
+ closeWithSource(
10164
+ reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
10165
+ );
10166
+ },
10167
+ [closeWithSource]
10168
+ );
10169
+ useEffect13(() => {
10170
+ if (previousOpenRef.current && !isOpen) {
10171
+ const analytics = analyticsControllerRef.current;
10172
+ analytics?.abandon("modal_close");
10173
+ analytics?.close("host_controlled");
10174
+ }
10175
+ previousOpenRef.current = isOpen;
10176
+ }, [isOpen]);
9594
10177
  useEffect13(() => {
9595
10178
  if (!isOpen) {
9596
10179
  setHistoryOpen(false);
@@ -9611,111 +10194,147 @@ function DepositModalInner({
9611
10194
  store.dispatch({ type: "flow/reset" });
9612
10195
  }
9613
10196
  }, [isOpen, store]);
10197
+ const walletIntegration = walletIntegrationProp ?? (hasWalletClientProp || walletSession || onRequestConnect ? "host_supplied" : "none");
10198
+ const analyticsSessionProperties = buildDepositAnalyticsSessionProperties({
10199
+ enableWallet,
10200
+ enableFiatOnramp,
10201
+ enableQrTransfer,
10202
+ enableGaslessDeposit,
10203
+ enableExchangeConnect,
10204
+ fiatMethods,
10205
+ assetMigrations,
10206
+ initialAssetMigration,
10207
+ inline,
10208
+ closeOnOverlayClick,
10209
+ sourceChain: sourceChainProp,
10210
+ sourceToken,
10211
+ defaultAmount,
10212
+ walletIntegration,
10213
+ targetChain,
10214
+ targetToken
10215
+ });
9614
10216
  const showBackButton = uiConfig?.showBackButton ?? true;
9615
10217
  const canGoBack = backHandler !== void 0;
9616
10218
  const hideHeaderChrome = swappedImmersive;
9617
10219
  const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
9618
- return /* @__PURE__ */ jsx29(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx29(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx29(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx29(
10220
+ return /* @__PURE__ */ jsx30(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx30(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx30(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx30(
9619
10221
  Modal,
9620
10222
  {
9621
10223
  isOpen,
9622
- onClose,
10224
+ onClose: handleModalDismiss,
9623
10225
  className,
9624
10226
  inline,
9625
10227
  closeOnOverlayClick,
9626
- children: /* @__PURE__ */ jsxs25("div", { ref: modalRef, className: modalClassName, children: [
9627
- !hideHeaderChrome && /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header--redesigned", children: [
9628
- /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx29(
9629
- "button",
10228
+ children: /* @__PURE__ */ jsx30(
10229
+ AnalyticsSession,
10230
+ {
10231
+ modal: "deposit",
10232
+ sessionProperties: analyticsSessionProperties,
10233
+ onEvent,
10234
+ backendUrl,
10235
+ enableIngest: enableAnalyticsIngest,
10236
+ ingestUrl: analyticsIngestUrl,
10237
+ children: /* @__PURE__ */ jsx30(
10238
+ DepositAnalyticsControllerProvider,
9630
10239
  {
9631
- type: "button",
9632
- className: "rs-modal-header-back",
9633
- "aria-label": "Go back",
9634
- onClick: backHandler,
9635
- children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
10240
+ controllerRef: analyticsControllerRef,
10241
+ children: /* @__PURE__ */ jsxs25("div", { ref: modalRef, className: modalClassName, children: [
10242
+ !hideHeaderChrome && /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header--redesigned", children: [
10243
+ /* @__PURE__ */ jsx30("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx30(
10244
+ "button",
10245
+ {
10246
+ type: "button",
10247
+ className: "rs-modal-header-back",
10248
+ "aria-label": "Go back",
10249
+ onClick: backHandler,
10250
+ children: /* @__PURE__ */ jsx30(ChevronLeftIcon, {})
10251
+ }
10252
+ ) }),
10253
+ /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header-nav-right", children: [
10254
+ historyButtonVisible && /* @__PURE__ */ jsx30(
10255
+ "button",
10256
+ {
10257
+ type: "button",
10258
+ className: "rs-modal-header-history",
10259
+ "aria-label": "Deposit history",
10260
+ onClick: handleHistoryOpen,
10261
+ disabled: !recipient,
10262
+ children: /* @__PURE__ */ jsx30(HistoryIcon, {})
10263
+ }
10264
+ ),
10265
+ /* @__PURE__ */ jsx30(
10266
+ "button",
10267
+ {
10268
+ type: "button",
10269
+ onClick: () => closeWithSource("header_button"),
10270
+ className: "rs-modal-close",
10271
+ "aria-label": "Close",
10272
+ children: /* @__PURE__ */ jsx30(CloseIcon, {})
10273
+ }
10274
+ )
10275
+ ] })
10276
+ ] }),
10277
+ /* @__PURE__ */ jsx30(
10278
+ DepositFlow,
10279
+ {
10280
+ walletClientProp,
10281
+ publicClientProp,
10282
+ hasWalletClientProp,
10283
+ targetChain,
10284
+ targetToken,
10285
+ service,
10286
+ sourceChain,
10287
+ sourceToken,
10288
+ amount: defaultAmount,
10289
+ recipient,
10290
+ appBalanceUsd,
10291
+ outputTokenRules,
10292
+ rejectUnmapped,
10293
+ forceRegister,
10294
+ assetMigrations,
10295
+ initialAssetMigration,
10296
+ enableFiatOnramp,
10297
+ enableQrTransfer,
10298
+ enableGaslessDeposit,
10299
+ fiatMethods,
10300
+ enableWallet,
10301
+ enableExchangeConnect,
10302
+ walletSession,
10303
+ walletIntegration,
10304
+ onConnect,
10305
+ onDisconnect,
10306
+ onRequestConnect,
10307
+ uiConfig,
10308
+ appFees: clientSetup?.appFees,
10309
+ appFeesResolved: clientSetup !== null,
10310
+ onStepChange: handleStepChange,
10311
+ onSwappedImmersiveChange: setSwappedImmersive,
10312
+ openExternally,
10313
+ onSubmittingChange: setSubmitting,
10314
+ onClose: (source) => closeWithSource(source ?? "header_button"),
10315
+ onLifecycle: handleLifecycle,
10316
+ onError,
10317
+ debug
10318
+ }
10319
+ ),
10320
+ historyOpen && /* @__PURE__ */ jsx30(
10321
+ DepositHistoryPanel,
10322
+ {
10323
+ deposits: historyDeposits,
10324
+ isLoading: historyLoading,
10325
+ error: historyError,
10326
+ hasMore: hasMoreHistory,
10327
+ isLoadingMore: historyLoadingMore,
10328
+ onLoadMore: handleHistoryLoadMore,
10329
+ onClose: handleHistoryClose,
10330
+ onCloseModal: () => closeWithSource("header_button")
10331
+ }
10332
+ )
10333
+ ] })
9636
10334
  }
9637
- ) }),
9638
- /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header-nav-right", children: [
9639
- historyButtonVisible && /* @__PURE__ */ jsx29(
9640
- "button",
9641
- {
9642
- type: "button",
9643
- className: "rs-modal-header-history",
9644
- "aria-label": "Deposit history",
9645
- onClick: handleHistoryOpen,
9646
- disabled: !recipient,
9647
- children: /* @__PURE__ */ jsx29(HistoryIcon, {})
9648
- }
9649
- ),
9650
- /* @__PURE__ */ jsx29(
9651
- "button",
9652
- {
9653
- type: "button",
9654
- onClick: onClose,
9655
- className: "rs-modal-close",
9656
- "aria-label": "Close",
9657
- children: /* @__PURE__ */ jsx29(CloseIcon, {})
9658
- }
9659
- )
9660
- ] })
9661
- ] }),
9662
- /* @__PURE__ */ jsx29(
9663
- DepositFlow,
9664
- {
9665
- walletClientProp,
9666
- publicClientProp,
9667
- hasWalletClientProp,
9668
- targetChain,
9669
- targetToken,
9670
- service,
9671
- sourceChain,
9672
- sourceToken,
9673
- amount: defaultAmount,
9674
- recipient,
9675
- appBalanceUsd,
9676
- outputTokenRules,
9677
- rejectUnmapped,
9678
- forceRegister,
9679
- assetMigrations,
9680
- initialAssetMigration,
9681
- enableFiatOnramp,
9682
- enableQrTransfer,
9683
- enableGaslessDeposit,
9684
- fiatMethods,
9685
- enableWallet,
9686
- enableExchangeConnect,
9687
- walletSession,
9688
- onConnect,
9689
- onDisconnect,
9690
- onRequestConnect,
9691
- uiConfig,
9692
- appFees: clientSetup?.appFees,
9693
- appFeesResolved: clientSetup !== null,
9694
- onStepChange: handleStepChange,
9695
- onSwappedImmersiveChange: setSwappedImmersive,
9696
- openExternally,
9697
- onSubmittingChange: setSubmitting,
9698
- onClose,
9699
- onLifecycle: handleLifecycle,
9700
- onEvent,
9701
- onError,
9702
- debug
9703
- }
9704
- ),
9705
- historyOpen && /* @__PURE__ */ jsx29(
9706
- DepositHistoryPanel,
9707
- {
9708
- deposits: historyDeposits,
9709
- isLoading: historyLoading,
9710
- error: historyError,
9711
- hasMore: hasMoreHistory,
9712
- isLoadingMore: historyLoadingMore,
9713
- onLoadMore: handleHistoryLoadMore,
9714
- onClose: handleHistoryClose,
9715
- onCloseModal: onClose
9716
- }
9717
- )
9718
- ] })
10335
+ )
10336
+ }
10337
+ )
9719
10338
  }
9720
10339
  ) }) }) });
9721
10340
  }