@rhinestone/deposit-modal 0.1.59 → 0.1.60

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-E4YPPHZF.mjs";
3
+ } from "./chunk-6SM3IQKZ.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkM4QDXLINcjs = require('./chunk-M4QDXLIN.cjs');
3
+ var _chunkHX7LLE2Vcjs = require('./chunk-HX7LLE2V.cjs');
4
4
 
5
5
 
6
6
 
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
32
32
  reown.disconnect();
33
33
  }, [reown.disconnect]);
34
34
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
- _chunkM4QDXLINcjs.DepositModalInner,
35
+ _chunkHX7LLE2Vcjs.DepositModalInner,
36
36
  {
37
37
  ...props,
38
38
  reownWallet: reownWithSolana,
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk3FEFGN7Hcjs = require('./chunk-3FEFGN7H.cjs');
3
+ var _chunk3CANBYBNcjs = require('./chunk-3CANBYBN.cjs');
4
4
 
5
5
 
6
6
 
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
20
20
  reown.disconnect();
21
21
  }, [reown.disconnect]);
22
22
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
23
- _chunk3FEFGN7Hcjs.WithdrawModalInner,
23
+ _chunk3CANBYBNcjs.WithdrawModalInner,
24
24
  {
25
25
  ...props,
26
26
  reownWallet: reown,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WithdrawModalInner
3
- } from "./chunk-3ESBSOB7.mjs";
3
+ } from "./chunk-JJMPCRKB.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
@@ -901,6 +901,7 @@ function WithdrawFlow({
901
901
  onWithdrawSubmitted,
902
902
  onWithdrawComplete,
903
903
  onWithdrawFailed,
904
+ onEvent,
904
905
  onError,
905
906
  debug
906
907
  }) {
@@ -1037,6 +1038,18 @@ function WithdrawFlow({
1037
1038
  _react.useEffect.call(void 0, () => {
1038
1039
  _optionalChain([onStepChange, 'optionalCall', _20 => _20(stepIndex, currentBackHandler)]);
1039
1040
  }, [stepIndex, currentBackHandler, onStepChange]);
1041
+ _react.useEffect.call(void 0, () => {
1042
+ if (step.type === "form") {
1043
+ const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1044
+ const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
1045
+ _optionalChain([onEvent, 'optionalCall', _21 => _21({
1046
+ type: "withdraw_modal_select_amount_open",
1047
+ pred_balance: totalBalanceUsd,
1048
+ default_token: tokenSymbol,
1049
+ default_chain: chainName
1050
+ })]);
1051
+ }
1052
+ }, [step.type, onEvent, totalBalanceUsd, targetChain, targetToken]);
1040
1053
  _react.useEffect.call(void 0, () => {
1041
1054
  logFlow("state:changed", {
1042
1055
  step: step.type,
@@ -1056,19 +1069,19 @@ function WithdrawFlow({
1056
1069
  targetToken
1057
1070
  ]);
1058
1071
  _react.useEffect.call(void 0, () => {
1059
- _optionalChain([onTotalBalanceChange, 'optionalCall', _21 => _21(totalBalanceUsd)]);
1072
+ _optionalChain([onTotalBalanceChange, 'optionalCall', _22 => _22(totalBalanceUsd)]);
1060
1073
  }, [totalBalanceUsd, onTotalBalanceChange]);
1061
1074
  const handleConnected = _react.useCallback.call(void 0,
1062
1075
  (addr, smartAccount) => {
1063
1076
  logFlow("setup:connected", { address: addr, smartAccount });
1064
- _optionalChain([onConnected, 'optionalCall', _22 => _22({ address: addr, smartAccount })]);
1077
+ _optionalChain([onConnected, 'optionalCall', _23 => _23({ address: addr, smartAccount })]);
1065
1078
  },
1066
1079
  [logFlow, onConnected]
1067
1080
  );
1068
1081
  const handleError = _react.useCallback.call(void 0,
1069
1082
  (message, code) => {
1070
1083
  logFlowError("flow:error", message, { code });
1071
- _optionalChain([onError, 'optionalCall', _23 => _23({ message, code })]);
1084
+ _optionalChain([onError, 'optionalCall', _24 => _24({ message, code })]);
1072
1085
  },
1073
1086
  [logFlowError, onError]
1074
1087
  );
@@ -1089,11 +1102,21 @@ function WithdrawFlow({
1089
1102
  }, []);
1090
1103
  const handleFormSubmit = _react.useCallback.call(void 0,
1091
1104
  async (recipient, amountValue) => {
1092
- const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _24 => _24.ownerAddress]);
1105
+ const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1106
+ const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
1107
+ _optionalChain([onEvent, 'optionalCall', _25 => _25({
1108
+ type: "withdraw_modal_select_amount_cta_click",
1109
+ pred_balance: totalBalanceUsd,
1110
+ selected_token: tokenSymbol,
1111
+ selected_chain: chainName,
1112
+ amount: amountValue,
1113
+ cta_name: "withdraw"
1114
+ })]);
1115
+ const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _26 => _26.ownerAddress]);
1093
1116
  if (!ownerAddress2) {
1094
1117
  throw new Error("Wallet not connected");
1095
1118
  }
1096
- if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _25 => _25.walletClient])) {
1119
+ if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _27 => _27.walletClient])) {
1097
1120
  throw new Error("Wallet not connected");
1098
1121
  }
1099
1122
  setIsSubmitting(true);
@@ -1161,7 +1184,7 @@ function WithdrawFlow({
1161
1184
  }
1162
1185
  handleConnected(ownerAddress2, smartAccount);
1163
1186
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1164
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, sourceChain)));
1187
+ const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _28 => _28.publicClient]), () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, sourceChain)));
1165
1188
  let result;
1166
1189
  if (onSignTransaction) {
1167
1190
  const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
@@ -1220,7 +1243,7 @@ function WithdrawFlow({
1220
1243
  sourceChain,
1221
1244
  sourceToken
1222
1245
  });
1223
- _optionalChain([onWithdrawSubmitted, 'optionalCall', _27 => _27({
1246
+ _optionalChain([onWithdrawSubmitted, 'optionalCall', _29 => _29({
1224
1247
  txHash: result.txHash,
1225
1248
  sourceChain,
1226
1249
  amount: amountUnits.toString(),
@@ -1267,13 +1290,15 @@ function WithdrawFlow({
1267
1290
  isSourceNative,
1268
1291
  handleError,
1269
1292
  logFlow,
1270
- logFlowError
1293
+ logFlowError,
1294
+ onEvent,
1295
+ totalBalanceUsd
1271
1296
  ]
1272
1297
  );
1273
1298
  const handleWithdrawComplete = _react.useCallback.call(void 0,
1274
1299
  (txHash, destinationTxHash, context) => {
1275
1300
  logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
1276
- _optionalChain([onWithdrawComplete, 'optionalCall', _28 => _28({
1301
+ _optionalChain([onWithdrawComplete, 'optionalCall', _30 => _30({
1277
1302
  txHash,
1278
1303
  destinationTxHash,
1279
1304
  amount: context.amount,
@@ -1288,17 +1313,17 @@ function WithdrawFlow({
1288
1313
  const handleWithdrawFailed = _react.useCallback.call(void 0,
1289
1314
  (txHash, error) => {
1290
1315
  logFlowError("withdraw:failed", error, { txHash });
1291
- _optionalChain([onWithdrawFailed, 'optionalCall', _29 => _29({ txHash, error })]);
1316
+ _optionalChain([onWithdrawFailed, 'optionalCall', _31 => _31({ txHash, error })]);
1292
1317
  },
1293
1318
  [logFlowError, onWithdrawFailed]
1294
1319
  );
1295
1320
  const allowedChainSet = _react.useMemo.call(void 0,
1296
- () => _optionalChain([allowedRoutes, 'optionalAccess', _30 => _30.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
1297
- [_optionalChain([allowedRoutes, 'optionalAccess', _31 => _31.sourceChains])]
1321
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _32 => _32.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
1322
+ [_optionalChain([allowedRoutes, 'optionalAccess', _33 => _33.sourceChains])]
1298
1323
  );
1299
1324
  const allowedTokenSet = _react.useMemo.call(void 0,
1300
- () => _optionalChain([allowedRoutes, 'optionalAccess', _32 => _32.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1301
- [_optionalChain([allowedRoutes, 'optionalAccess', _33 => _33.sourceTokens])]
1325
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _34 => _34.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1326
+ [_optionalChain([allowedRoutes, 'optionalAccess', _35 => _35.sourceTokens])]
1302
1327
  );
1303
1328
  const targetChainOptions = _react.useMemo.call(void 0, () => {
1304
1329
  return _chunkR6U6BHCVcjs.SOURCE_CHAINS.filter((chain) => {
@@ -1367,14 +1392,14 @@ function WithdrawFlow({
1367
1392
  setIsConnectSelectionConfirmed(false);
1368
1393
  }
1369
1394
  }, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
1370
- const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _34 => _34.ownerAddress]);
1395
+ const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _36 => _36.ownerAddress]);
1371
1396
  const selectedWalletIcon = _react.useMemo.call(void 0, () => {
1372
- if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess', _35 => _35.icon]);
1397
+ if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess', _37 => _37.icon]);
1373
1398
  const selected = walletOptions.find(
1374
- (o) => _optionalChain([o, 'access', _36 => _36.address, 'optionalAccess', _37 => _37.toLowerCase, 'call', _38 => _38()]) === ownerAddress.toLowerCase()
1399
+ (o) => _optionalChain([o, 'access', _38 => _38.address, 'optionalAccess', _39 => _39.toLowerCase, 'call', _40 => _40()]) === ownerAddress.toLowerCase()
1375
1400
  );
1376
- return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _39 => _39.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _40 => _40.icon])));
1377
- }, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _41 => _41.icon])]);
1401
+ return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _41 => _41.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _42 => _42.icon])));
1402
+ }, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _43 => _43.icon])]);
1378
1403
  if (showConnectStep) {
1379
1404
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1380
1405
  _chunkTQ6IIGRScjs.ConnectStep,
@@ -1398,7 +1423,7 @@ function WithdrawFlow({
1398
1423
  if (!signerContext) return null;
1399
1424
  if (!onSignTransaction && !signerContext.walletClient) return null;
1400
1425
  const resolvedOwnerAddress = signerContext.ownerAddress;
1401
- const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _42 => _42.walletClient, 'optionalAccess', _43 => _43.account, 'optionalAccess', _44 => _44.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _45 => _45.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _46 => _46.account, 'optionalAccess', _47 => _47.address]))), () => ( resolvedOwnerAddress));
1426
+ const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _44 => _44.walletClient, 'optionalAccess', _45 => _45.account, 'optionalAccess', _46 => _46.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _47 => _47.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _48 => _48.account, 'optionalAccess', _49 => _49.address]))), () => ( resolvedOwnerAddress));
1402
1427
  const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
1403
1428
  const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, sourceChain)));
1404
1429
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
@@ -1453,7 +1478,7 @@ function WithdrawFlow({
1453
1478
  // src/WithdrawModal.tsx
1454
1479
 
1455
1480
  var ReownWithdrawInner = _react.lazy.call(void 0,
1456
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-TUBSUJQ6.cjs"))).then((m) => ({
1481
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-7JLR264N.cjs"))).then((m) => ({
1457
1482
  default: m.WithdrawModalReown
1458
1483
  }))
1459
1484
  );
@@ -1501,6 +1526,7 @@ function WithdrawModalInner({
1501
1526
  onWithdrawSubmitted,
1502
1527
  onWithdrawComplete,
1503
1528
  onWithdrawFailed,
1529
+ onEvent,
1504
1530
  onError,
1505
1531
  debug
1506
1532
  }) {
@@ -1523,7 +1549,7 @@ function WithdrawModalInner({
1523
1549
  _react.useEffect.call(void 0, () => {
1524
1550
  if (isOpen && !hasCalledReady.current) {
1525
1551
  hasCalledReady.current = true;
1526
- _optionalChain([onReady, 'optionalCall', _48 => _48()]);
1552
+ _optionalChain([onReady, 'optionalCall', _50 => _50()]);
1527
1553
  }
1528
1554
  }, [isOpen, onReady]);
1529
1555
  _react.useEffect.call(void 0, () => {
@@ -1542,14 +1568,14 @@ function WithdrawModalInner({
1542
1568
  setTotalBalanceUsd(balance2);
1543
1569
  }, []);
1544
1570
  const handleBack = _react.useCallback.call(void 0, () => {
1545
- _optionalChain([backHandlerRef, 'access', _49 => _49.current, 'optionalCall', _50 => _50()]);
1571
+ _optionalChain([backHandlerRef, 'access', _51 => _51.current, 'optionalCall', _52 => _52()]);
1546
1572
  }, []);
1547
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _51 => _51.showLogo]), () => ( false));
1548
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _52 => _52.showStepper]), () => ( false));
1549
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _53 => _53.showBackButton]), () => ( true));
1550
- const balance = _optionalChain([uiConfig, 'optionalAccess', _54 => _54.balance]);
1551
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _55 => _55.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1552
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _56 => _56.title]), () => ( "Withdraw"));
1573
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _53 => _53.showLogo]), () => ( false));
1574
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _54 => _54.showStepper]), () => ( false));
1575
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _55 => _55.showBackButton]), () => ( true));
1576
+ const balance = _optionalChain([uiConfig, 'optionalAccess', _56 => _56.balance]);
1577
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _57 => _57.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1578
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _58 => _58.title]), () => ( "Withdraw"));
1553
1579
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
1554
1580
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1555
1581
  _chunkTQ6IIGRScjs.Modal,
@@ -1673,6 +1699,7 @@ function WithdrawModalInner({
1673
1699
  onWithdrawSubmitted,
1674
1700
  onWithdrawComplete,
1675
1701
  onWithdrawFailed,
1702
+ onEvent,
1676
1703
  onError,
1677
1704
  debug
1678
1705
  }
@@ -554,7 +554,8 @@ function AmountStep({
554
554
  uiConfig,
555
555
  tokenPriceUsdOverride,
556
556
  onBalanceUsdChange,
557
- onContinue
557
+ onContinue,
558
+ onCtaClick
558
559
  }) {
559
560
  const [amount, setAmount] = useState3("");
560
561
  const [balance, setBalance] = useState3(null);
@@ -658,6 +659,8 @@ function AmountStep({
658
659
  }, [balance, asset.decimals]);
659
660
  const handlePresetClick = (percentage) => {
660
661
  if (balance === null) return;
662
+ const ctaName = percentage === 100 ? "Max" : `${percentage}%`;
663
+ onCtaClick?.(ctaName);
661
664
  try {
662
665
  const balanceUnits = Number(formatUnits2(balance, asset.decimals));
663
666
  if (!Number.isFinite(balanceUnits)) return;
@@ -716,6 +719,7 @@ function AmountStep({
716
719
  return;
717
720
  }
718
721
  setError(null);
722
+ onCtaClick?.("continue");
719
723
  onContinue(tokenAmountStr, amount, balance ?? void 0);
720
724
  };
721
725
  return /* @__PURE__ */ jsxs3("div", { className: "rs-step", children: [
@@ -1458,6 +1462,7 @@ function DepositAddressStep({
1458
1462
  service,
1459
1463
  allowedRoutes,
1460
1464
  onDepositDetected,
1465
+ onCopyAddress,
1461
1466
  onError
1462
1467
  }) {
1463
1468
  const hasSolana = Boolean(solanaDepositAddress);
@@ -1542,6 +1547,7 @@ function DepositAddressStep({
1542
1547
  };
1543
1548
  }, [chainDropdownOpen, tokenDropdownOpen]);
1544
1549
  const handleCopy = useCallback2(async () => {
1550
+ onCopyAddress?.();
1545
1551
  try {
1546
1552
  await navigator.clipboard.writeText(displayAddress);
1547
1553
  setCopied(true);
@@ -1558,7 +1564,7 @@ function DepositAddressStep({
1558
1564
  setCopied(true);
1559
1565
  setTimeout(() => setCopied(false), 2e3);
1560
1566
  }
1561
- }, [displayAddress]);
1567
+ }, [displayAddress, onCopyAddress]);
1562
1568
  useEffect6(() => {
1563
1569
  setCopied(false);
1564
1570
  setChainDropdownOpen(false);
@@ -2582,6 +2588,7 @@ function DepositFlow({
2582
2588
  onDepositSubmitted,
2583
2589
  onDepositComplete,
2584
2590
  onDepositFailed,
2591
+ onEvent,
2585
2592
  onError,
2586
2593
  debug
2587
2594
  }) {
@@ -2911,6 +2918,32 @@ function DepositFlow({
2911
2918
  useEffect9(() => {
2912
2919
  onStepChange?.(stepIndex, currentBackHandler);
2913
2920
  }, [stepIndex, currentBackHandler, onStepChange]);
2921
+ useEffect9(() => {
2922
+ if (step.type === "select-asset") {
2923
+ onEvent?.({
2924
+ type: "deposit_modal_connected_wallet_select_source_open",
2925
+ total_balance_in_external_wallet: totalBalanceUsd,
2926
+ pred_balance: totalBalanceUsd
2927
+ });
2928
+ } else if (step.type === "deposit-address") {
2929
+ const chainName = getChainName(targetChain);
2930
+ const tokenSymbol = getTokenSymbol(targetToken, targetChain);
2931
+ onEvent?.({
2932
+ type: "deposit_modal_transfer_crypto_open",
2933
+ default_chain: chainName,
2934
+ default_token: tokenSymbol,
2935
+ pred_balance: totalBalanceUsd
2936
+ });
2937
+ } else if (step.type === "amount") {
2938
+ const receiveSymbol = getTokenSymbol(targetToken, targetChain);
2939
+ onEvent?.({
2940
+ type: "deposit_modal_connected_wallet_enter_value_open",
2941
+ send_token: step.asset.symbol,
2942
+ receive_token: receiveSymbol,
2943
+ pred_balance: totalBalanceUsd
2944
+ });
2945
+ }
2946
+ }, [step, onEvent, totalBalanceUsd, targetChain, targetToken]);
2914
2947
  useEffect9(() => {
2915
2948
  logFlow("state:changed", {
2916
2949
  step: step.type,
@@ -3093,6 +3126,14 @@ function DepositFlow({
3093
3126
  );
3094
3127
  const handleAssetContinue = useCallback3(
3095
3128
  (asset) => {
3129
+ onEvent?.({
3130
+ type: "deposit_modal_connected_wallet_select_source_cta_click",
3131
+ total_balance_in_external_wallet: totalBalanceUsd,
3132
+ pred_balance: totalBalanceUsd,
3133
+ cta_name: "token_selected",
3134
+ token_name: asset.symbol,
3135
+ token_balance: asset.balance ?? "0"
3136
+ });
3096
3137
  setStep((prev) => {
3097
3138
  if (prev.type !== "select-asset") return prev;
3098
3139
  return {
@@ -3103,7 +3144,7 @@ function DepositFlow({
3103
3144
  };
3104
3145
  });
3105
3146
  },
3106
- [defaultAmount]
3147
+ [defaultAmount, onEvent, totalBalanceUsd]
3107
3148
  );
3108
3149
  const handleAmountContinue = useCallback3(
3109
3150
  (amount, targetAmount, balance) => {
@@ -3317,6 +3358,17 @@ function DepositFlow({
3317
3358
  service,
3318
3359
  allowedRoutes,
3319
3360
  onDepositDetected: handleDepositAddressDetected,
3361
+ onCopyAddress: () => {
3362
+ const chainName = getChainName(targetChain);
3363
+ const tokenSymbol = getTokenSymbol(targetToken, targetChain);
3364
+ onEvent?.({
3365
+ type: "deposit_modal_transfer_crypto_cta_click",
3366
+ default_chain: chainName,
3367
+ default_token: tokenSymbol,
3368
+ pred_balance: totalBalanceUsd,
3369
+ cta_name: "copy"
3370
+ });
3371
+ },
3320
3372
  onError: handleError
3321
3373
  }
3322
3374
  ),
@@ -3525,7 +3577,17 @@ function DepositFlow({
3525
3577
  targetChain,
3526
3578
  targetToken,
3527
3579
  uiConfig,
3528
- onContinue: handleAmountContinue
3580
+ onContinue: handleAmountContinue,
3581
+ onCtaClick: (ctaName) => {
3582
+ const receiveSymbol = getTokenSymbol(targetToken, targetChain);
3583
+ onEvent?.({
3584
+ type: "deposit_modal_connected_wallet_enter_value_cta_click",
3585
+ send_token: step.asset.symbol,
3586
+ receive_token: receiveSymbol,
3587
+ pred_balance: totalBalanceUsd,
3588
+ cta_name: ctaName
3589
+ });
3590
+ }
3529
3591
  }
3530
3592
  ),
3531
3593
  step.type === "confirm" && /* @__PURE__ */ jsx10(
@@ -3577,7 +3639,7 @@ function DepositFlow({
3577
3639
  // src/DepositModal.tsx
3578
3640
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3579
3641
  var ReownDepositInner = lazy(
3580
- () => import("./DepositModalReown-X3XPNZNZ.mjs").then((m) => ({ default: m.DepositModalReown }))
3642
+ () => import("./DepositModalReown-S24YS35X.mjs").then((m) => ({ default: m.DepositModalReown }))
3581
3643
  );
3582
3644
  function DepositModal(props) {
3583
3645
  const needsReown = !!props.reownAppId;
@@ -3641,6 +3703,7 @@ function DepositModalInner({
3641
3703
  onDepositSubmitted,
3642
3704
  onDepositComplete,
3643
3705
  onDepositFailed,
3706
+ onEvent,
3644
3707
  onError,
3645
3708
  debug
3646
3709
  }) {
@@ -3855,6 +3918,7 @@ function DepositModalInner({
3855
3918
  onDepositSubmitted,
3856
3919
  onDepositComplete,
3857
3920
  onDepositFailed,
3921
+ onEvent,
3858
3922
  onError,
3859
3923
  debug
3860
3924
  }