@rhinestone/deposit-modal 0.1.50 → 0.1.52

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.
@@ -1349,7 +1349,38 @@ function txRefsMatch(a, b) {
1349
1349
  var INITIAL_POLL_INTERVAL = 3e3;
1350
1350
  var MAX_POLL_INTERVAL = 3e4;
1351
1351
  var BACKOFF_MULTIPLIER = 1.5;
1352
- var PROCESS_TIMEOUT_MS = 10 * 60 * 1e3;
1352
+ var ESCALATED_DELAY_MS = 10 * 60 * 1e3;
1353
+ var SOFT_DELAY_MS = {
1354
+ confirming: 90 * 1e3,
1355
+ received: 90 * 1e3,
1356
+ bridging: 4 * 60 * 1e3
1357
+ };
1358
+ var PHASE_TIMINGS_PREFIX = "rhinestone:phase-timings";
1359
+ function loadPhaseTimings(txHash) {
1360
+ if (typeof window === "undefined") return null;
1361
+ try {
1362
+ const raw = window.localStorage.getItem(`${PHASE_TIMINGS_PREFIX}:${txHash}`);
1363
+ if (!raw) return null;
1364
+ const parsed = JSON.parse(raw);
1365
+ if (typeof parsed.startedAt !== "number") return null;
1366
+ return parsed;
1367
+ } catch (e3) {
1368
+ return null;
1369
+ }
1370
+ }
1371
+ function savePhaseTimings(txHash, timings) {
1372
+ if (typeof window === "undefined") return;
1373
+ try {
1374
+ window.localStorage.setItem(
1375
+ `${PHASE_TIMINGS_PREFIX}:${txHash}`,
1376
+ JSON.stringify(timings)
1377
+ );
1378
+ } catch (e4) {
1379
+ }
1380
+ }
1381
+ function truncateHash(hash) {
1382
+ return `${hash.slice(0, 10)}...${hash.slice(-8)}`;
1383
+ }
1353
1384
  function isEventForTx(event, txHash) {
1354
1385
  const eventTxHash = getEventTxHash(event);
1355
1386
  if (!eventTxHash) return false;
@@ -1387,6 +1418,61 @@ function formatBridgeFailedMessage(event) {
1387
1418
  }
1388
1419
  return { message: "Bridge failed" };
1389
1420
  }
1421
+ function parseWebhookTimestamp(event) {
1422
+ if (typeof _optionalChain([event, 'optionalAccess', _84 => _84.time]) !== "string") return void 0;
1423
+ const timestamp = Date.parse(event.time);
1424
+ return Number.isFinite(timestamp) ? timestamp : void 0;
1425
+ }
1426
+ function syncPhaseTimings(previous, event) {
1427
+ if (!_optionalChain([event, 'optionalAccess', _85 => _85.type])) return previous;
1428
+ const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
1429
+ const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") && previous.receivedAt === void 0;
1430
+ const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
1431
+ const setCompleted = event.type === "bridge-complete" && previous.completedAt === void 0;
1432
+ if (!setReceived && !setBridging && !setCompleted) return previous;
1433
+ return {
1434
+ ...previous,
1435
+ ...setReceived && { receivedAt: timestamp },
1436
+ ...setBridging && { bridgingAt: timestamp },
1437
+ ...setCompleted && { completedAt: timestamp }
1438
+ };
1439
+ }
1440
+ function getDurationSeconds(startMs, endMs) {
1441
+ if (startMs === void 0 || endMs === void 0) return void 0;
1442
+ return Math.max(0, Math.floor((endMs - startMs) / 1e3));
1443
+ }
1444
+ function formatElapsedTime(seconds) {
1445
+ if (seconds < 60) return `${seconds} second${seconds !== 1 ? "s" : ""}`;
1446
+ const mins = Math.floor(seconds / 60);
1447
+ const secs = seconds % 60;
1448
+ return `${mins}m ${secs}s`;
1449
+ }
1450
+ function getPhaseStartTime(phaseId, phaseTimings) {
1451
+ if (phaseId === "confirming") return phaseTimings.startedAt;
1452
+ if (phaseId === "received") {
1453
+ return _nullishCoalesce(phaseTimings.receivedAt, () => ( phaseTimings.startedAt));
1454
+ }
1455
+ return _nullishCoalesce(_nullishCoalesce(phaseTimings.bridgingAt, () => ( phaseTimings.receivedAt)), () => ( phaseTimings.startedAt));
1456
+ }
1457
+ function getFailedPhaseId(phaseTimings) {
1458
+ if (phaseTimings.bridgingAt !== void 0) return "bridging";
1459
+ if (phaseTimings.receivedAt !== void 0) return "received";
1460
+ return "confirming";
1461
+ }
1462
+ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
1463
+ if (state.type === "failed") {
1464
+ return getFailedPhaseId(phaseTimings);
1465
+ }
1466
+ if (isEarlyComplete) {
1467
+ return "bridging";
1468
+ }
1469
+ if (state.type === "complete") {
1470
+ return void 0;
1471
+ }
1472
+ if (_optionalChain([state, 'access', _86 => _86.lastEvent, 'optionalAccess', _87 => _87.type]) === "bridge-started") return "bridging";
1473
+ if (_optionalChain([state, 'access', _88 => _88.lastEvent, 'optionalAccess', _89 => _89.type]) === "deposit-received") return "received";
1474
+ return "confirming";
1475
+ }
1390
1476
  function ProcessingStep({
1391
1477
  smartAccount,
1392
1478
  txHash,
@@ -1401,49 +1487,87 @@ function ProcessingStep({
1401
1487
  directTransfer,
1402
1488
  flowLabel = "deposit",
1403
1489
  debug,
1490
+ targetToken,
1404
1491
  onClose,
1405
1492
  onNewDeposit,
1406
1493
  onDepositComplete,
1407
1494
  onDepositFailed,
1408
1495
  onError
1409
1496
  }) {
1497
+ const startTimeRef = _react.useRef.call(void 0, Date.now());
1498
+ const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
1499
+ const pollTimeoutRef = _react.useRef.call(void 0, null);
1500
+ const escalatedDelayRef = _react.useRef.call(void 0, false);
1410
1501
  const [state, setState] = _react.useState.call(void 0,
1411
1502
  directTransfer ? { type: "complete" } : { type: "processing" }
1412
1503
  );
1413
1504
  const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0, 0);
1414
- const startTimeRef = _react.useRef.call(void 0, Date.now());
1415
- const intervalRef = _react.useRef.call(void 0, null);
1416
- _react.useEffect.call(void 0, () => {
1417
- if (directTransfer) {
1418
- debugLog(debug, "processing", "direct-transfer:complete", {
1419
- txHash,
1420
- flowLabel
1421
- });
1422
- _optionalChain([onDepositComplete, 'optionalCall', _84 => _84(txHash)]);
1423
- return;
1505
+ const [phaseTimings, setPhaseTimings] = _react.useState.call(void 0, () => {
1506
+ const saved = loadPhaseTimings(txHash);
1507
+ if (saved) {
1508
+ startTimeRef.current = saved.startedAt;
1509
+ return saved;
1424
1510
  }
1425
- }, [debug, directTransfer, flowLabel, txHash, onDepositComplete]);
1511
+ return { startedAt: startTimeRef.current };
1512
+ });
1513
+ const [hasEscalatedDelay, setHasEscalatedDelay] = _react.useState.call(void 0, false);
1426
1514
  _react.useEffect.call(void 0, () => {
1427
- if (directTransfer) return;
1428
- startTimeRef.current = Date.now();
1429
- intervalRef.current = setInterval(() => {
1430
- setElapsedSeconds(Math.floor((Date.now() - startTimeRef.current) / 1e3));
1431
- }, 1e3);
1432
- return () => {
1433
- if (intervalRef.current) clearInterval(intervalRef.current);
1515
+ if (!directTransfer) return;
1516
+ const completedAt = Date.now();
1517
+ setPhaseTimings({
1518
+ startedAt: startTimeRef.current,
1519
+ completedAt,
1520
+ endedAt: completedAt
1521
+ });
1522
+ debugLog(debug, "processing", "direct-transfer:complete", {
1523
+ txHash,
1524
+ flowLabel
1525
+ });
1526
+ _optionalChain([onDepositComplete, 'optionalCall', _90 => _90(txHash, void 0, {
1527
+ amount,
1528
+ sourceChain,
1529
+ sourceToken,
1530
+ targetChain,
1531
+ targetToken
1532
+ })]);
1533
+ }, [
1534
+ amount,
1535
+ debug,
1536
+ directTransfer,
1537
+ flowLabel,
1538
+ onDepositComplete,
1539
+ sourceChain,
1540
+ sourceToken,
1541
+ targetChain,
1542
+ targetToken,
1543
+ txHash
1544
+ ]);
1545
+ _react.useEffect.call(void 0, () => {
1546
+ if (directTransfer || state.type !== "processing") return;
1547
+ const updateElapsed = () => {
1548
+ setElapsedSeconds(
1549
+ Math.floor((Date.now() - startTimeRef.current) / 1e3)
1550
+ );
1434
1551
  };
1435
- }, [directTransfer]);
1552
+ updateElapsed();
1553
+ const intervalId = setInterval(updateElapsed, 1e3);
1554
+ return () => clearInterval(intervalId);
1555
+ }, [directTransfer, state.type]);
1436
1556
  _react.useEffect.call(void 0, () => {
1437
- if (state.type === "complete" || state.type === "failed" || state.type === "error") {
1438
- if (intervalRef.current) {
1439
- clearInterval(intervalRef.current);
1440
- intervalRef.current = null;
1441
- }
1442
- }
1443
- }, [state.type]);
1444
- const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
1445
- const pollTimeoutRef = _react.useRef.call(void 0, null);
1446
- const processTimeoutRef = _react.useRef.call(void 0, null);
1557
+ if (state.type === "processing") return;
1558
+ const endedAt = state.type === "complete" ? _nullishCoalesce(phaseTimings.completedAt, () => ( Date.now())) : Date.now();
1559
+ setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
1560
+ setPhaseTimings(
1561
+ (previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
1562
+ );
1563
+ }, [phaseTimings.completedAt, state.type]);
1564
+ _react.useEffect.call(void 0, () => {
1565
+ if (!state.lastEvent) return;
1566
+ setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
1567
+ }, [_optionalChain([state, 'access', _91 => _91.lastEvent, 'optionalAccess', _92 => _92.time]), _optionalChain([state, 'access', _93 => _93.lastEvent, 'optionalAccess', _94 => _94.type])]);
1568
+ _react.useEffect.call(void 0, () => {
1569
+ savePhaseTimings(txHash, phaseTimings);
1570
+ }, [txHash, phaseTimings]);
1447
1571
  _react.useEffect.call(void 0, () => {
1448
1572
  if (directTransfer) return;
1449
1573
  if (state.type !== "processing") {
@@ -1467,31 +1591,43 @@ function ProcessingStep({
1467
1591
  debugLog(debug, "processing", "poll:event", {
1468
1592
  type: lastEvent2.type,
1469
1593
  matchesTx: eventMatchesTx,
1470
- intentId: _optionalChain([eventData, 'optionalAccess', _85 => _85.intentId])
1594
+ intentId: _optionalChain([eventData, 'optionalAccess', _95 => _95.intentId])
1471
1595
  });
1472
1596
  }
1473
1597
  if (!isMounted) return;
1474
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _86 => _86.type]) === "bridge-complete") {
1598
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _96 => _96.type]) === "bridge-complete") {
1475
1599
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1476
- const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _87 => _87.data, 'optionalAccess', _88 => _88.destination, 'optionalAccess', _89 => _89.transactionHash]);
1600
+ const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _97 => _97.data, 'optionalAccess', _98 => _98.destination, 'optionalAccess', _99 => _99.transactionHash]);
1477
1601
  debugLog(debug, "processing", "state:complete", {
1478
1602
  txHash,
1479
1603
  destinationTxHash: destinationTxHash2,
1480
1604
  event: eventForCurrentTx.type
1481
1605
  });
1482
- _optionalChain([onDepositComplete, 'optionalCall', _90 => _90(txHash, destinationTxHash2)]);
1606
+ _optionalChain([onDepositComplete, 'optionalCall', _100 => _100(txHash, destinationTxHash2, {
1607
+ amount,
1608
+ sourceChain,
1609
+ sourceToken,
1610
+ targetChain,
1611
+ targetToken
1612
+ })]);
1483
1613
  return;
1484
1614
  }
1485
- if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _91 => _91.type]) === "bridge-started") {
1615
+ if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _101 => _101.type]) === "bridge-started") {
1486
1616
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1487
1617
  debugLog(debug, "processing", "state:early-complete", {
1488
1618
  txHash,
1489
1619
  event: eventForCurrentTx.type
1490
1620
  });
1491
- _optionalChain([onDepositComplete, 'optionalCall', _92 => _92(txHash)]);
1621
+ _optionalChain([onDepositComplete, 'optionalCall', _102 => _102(txHash, void 0, {
1622
+ amount,
1623
+ sourceChain,
1624
+ sourceToken,
1625
+ targetChain,
1626
+ targetToken
1627
+ })]);
1492
1628
  return;
1493
1629
  }
1494
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _93 => _93.type]) === "bridge-failed") {
1630
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _103 => _103.type]) === "bridge-failed") {
1495
1631
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1496
1632
  setState({
1497
1633
  type: "failed",
@@ -1503,11 +1639,11 @@ function ProcessingStep({
1503
1639
  message: formatted.message,
1504
1640
  code: formatted.code
1505
1641
  });
1506
- _optionalChain([onDepositFailed, 'optionalCall', _94 => _94(txHash, formatted.message)]);
1642
+ _optionalChain([onDepositFailed, 'optionalCall', _104 => _104(txHash, formatted.message)]);
1507
1643
  return;
1508
1644
  }
1509
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _95 => _95.type]) === "error") {
1510
- const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _96 => _96.data, 'optionalAccess', _97 => _97.message]), () => ( "Unknown error"));
1645
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _105 => _105.type]) === "error") {
1646
+ const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _106 => _106.data, 'optionalAccess', _107 => _107.message]), () => ( "Unknown error"));
1511
1647
  setState({
1512
1648
  type: "failed",
1513
1649
  message: errorMessage,
@@ -1517,10 +1653,13 @@ function ProcessingStep({
1517
1653
  txHash,
1518
1654
  message: errorMessage
1519
1655
  });
1520
- _optionalChain([onDepositFailed, 'optionalCall', _98 => _98(txHash, errorMessage)]);
1656
+ _optionalChain([onDepositFailed, 'optionalCall', _108 => _108(txHash, errorMessage)]);
1521
1657
  return;
1522
1658
  }
1523
- setState({ type: "processing", lastEvent: eventForCurrentTx });
1659
+ setState((previous) => ({
1660
+ type: "processing",
1661
+ lastEvent: _nullishCoalesce(eventForCurrentTx, () => ( previous.lastEvent))
1662
+ }));
1524
1663
  scheduleNextPoll();
1525
1664
  } catch (error) {
1526
1665
  debugError(debug, "processing", "poll:failure", error, {
@@ -1552,255 +1691,371 @@ function ProcessingStep({
1552
1691
  }
1553
1692
  };
1554
1693
  }, [
1694
+ amount,
1555
1695
  debug,
1556
1696
  directTransfer,
1557
- state.type,
1697
+ onDepositComplete,
1698
+ onDepositFailed,
1699
+ service,
1558
1700
  smartAccount,
1701
+ sourceChain,
1702
+ sourceToken,
1703
+ state.type,
1704
+ targetChain,
1705
+ targetToken,
1559
1706
  txHash,
1560
- service,
1561
- waitForFinalTx,
1562
- onDepositComplete,
1563
- onDepositFailed
1707
+ waitForFinalTx
1564
1708
  ]);
1565
1709
  _react.useEffect.call(void 0, () => {
1566
- if (directTransfer) return;
1567
- if (state.type !== "processing") {
1568
- if (processTimeoutRef.current) {
1569
- clearTimeout(processTimeoutRef.current);
1570
- processTimeoutRef.current = null;
1571
- }
1572
- return;
1573
- }
1574
- processTimeoutRef.current = setTimeout(() => {
1575
- const message = "Transfer is taking longer than expected. Your funds are safe and our team has been notified.";
1576
- debugLog(debug, "processing", "state:timeout", {
1710
+ if (directTransfer || state.type !== "processing") return;
1711
+ const timeoutId = setTimeout(() => {
1712
+ if (escalatedDelayRef.current) return;
1713
+ escalatedDelayRef.current = true;
1714
+ setHasEscalatedDelay(true);
1715
+ const message = "Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.";
1716
+ debugLog(debug, "processing", "state:delay-escalated", {
1577
1717
  txHash,
1578
- timeoutMs: PROCESS_TIMEOUT_MS
1718
+ timeoutMs: ESCALATED_DELAY_MS
1579
1719
  });
1580
- setState({ type: "error", message });
1581
- _optionalChain([onError, 'optionalCall', _99 => _99(message, "PROCESS_TIMEOUT")]);
1582
- }, PROCESS_TIMEOUT_MS);
1583
- return () => {
1584
- if (processTimeoutRef.current) {
1585
- clearTimeout(processTimeoutRef.current);
1586
- processTimeoutRef.current = null;
1587
- }
1588
- };
1589
- }, [debug, directTransfer, state.type, txHash, onError]);
1590
- const isDelayed = state.type === "error" || state.type === "failed";
1720
+ _optionalChain([onError, 'optionalCall', _109 => _109(message, "PROCESS_TIMEOUT")]);
1721
+ }, ESCALATED_DELAY_MS);
1722
+ return () => clearTimeout(timeoutId);
1723
+ }, [debug, directTransfer, onError, state.type, txHash]);
1591
1724
  const isComplete = state.type === "complete";
1725
+ const isFailed = state.type === "failed";
1592
1726
  const isProcessing = state.type === "processing";
1593
- const lastEvent = state.type === "processing" || state.type === "complete" || state.type === "failed" ? state.lastEvent : void 0;
1594
- const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _100 => _100.type]) === "bridge-started";
1727
+ const lastEvent = state.lastEvent;
1728
+ const failureMessage = state.type === "failed" ? state.message : void 0;
1729
+ const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _110 => _110.type]) === "bridge-started";
1730
+ const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
1595
1731
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
1596
1732
  const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
1597
- const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _101 => _101.data, 'optionalAccess', _102 => _102.destination, 'optionalAccess', _103 => _103.transactionHash]) || null;
1733
+ const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _111 => _111.data, 'optionalAccess', _112 => _112.destination, 'optionalAccess', _113 => _113.transactionHash]) || null;
1598
1734
  const sourceDetails = getEventSourceDetails(lastEvent);
1599
1735
  const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
1600
1736
  const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
1601
1737
  const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
1602
1738
  const sourceExplorerUrl = _chunkNELAYNA3cjs.getExplorerTxUrl.call(void 0, displaySourceChain, txHash);
1603
1739
  const destExplorerUrl = destinationTxHash ? _chunkNELAYNA3cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
1604
- const truncateHash = (hash) => `${hash.slice(0, 10)}...${hash.slice(-8)}`;
1605
- const formatElapsedTime = (seconds) => {
1606
- if (seconds < 60) return `${seconds} second${seconds !== 1 ? "s" : ""}`;
1607
- const mins = Math.floor(seconds / 60);
1608
- const secs = seconds % 60;
1609
- return `${mins}m ${secs}s`;
1610
- };
1611
1740
  const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
1612
1741
  const sourceSymbol = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceSymbol, () => ( "SOL")) : isEvmSourceToken ? _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, displaySourceToken, displaySourceChain) : _nullishCoalesce(providedSourceSymbol, () => ( "Token"));
1613
- const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ? _chunkNELAYNA3cjs.getTokenDecimalsByAddress.call(void 0, displaySourceToken, displaySourceChain) : _nullishCoalesce(providedSourceDecimals, () => ( 18));
1742
+ const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ? _chunkNELAYNA3cjs.getTokenDecimalsByAddress.call(void 0,
1743
+ displaySourceToken,
1744
+ displaySourceChain
1745
+ ) : _nullishCoalesce(providedSourceDecimals, () => ( 18));
1614
1746
  const formattedReceivedAmount = (() => {
1615
1747
  try {
1616
1748
  const raw = _viem.formatUnits.call(void 0, BigInt(displayAmount), sourceDecimals);
1617
1749
  const numeric = Number(raw);
1618
1750
  if (!Number.isFinite(numeric)) return raw;
1619
1751
  return numeric.toLocaleString("en-US", { maximumFractionDigits: 6 });
1620
- } catch (e3) {
1752
+ } catch (e5) {
1621
1753
  return Number(displayAmount).toLocaleString("en-US", {
1622
1754
  maximumFractionDigits: 6
1623
1755
  });
1624
1756
  }
1625
1757
  })();
1626
- if (isComplete) {
1627
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1628
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", children: [
1629
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-success-state", children: [
1630
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-success-checkmark", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1631
- "svg",
1632
- {
1633
- viewBox: "0 0 24 24",
1634
- fill: "none",
1635
- stroke: "currentColor",
1636
- strokeWidth: "2.5",
1637
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1638
- "path",
1639
- {
1640
- strokeLinecap: "round",
1641
- strokeLinejoin: "round",
1642
- d: "M5 12l5 5L20 7"
1643
- }
1644
- )
1645
- }
1646
- ) }),
1647
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-success-title", children: isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` }),
1648
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-success-subtitle", children: directTransfer ? "Your transfer is complete." : isEarlyComplete ? "Your transfer has been confirmed and funds will arrive shortly." : "Your funds have been successfully bridged." })
1649
- ] }),
1650
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
1651
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1652
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Status" }),
1758
+ const detectionDurationSeconds = getDurationSeconds(
1759
+ phaseTimings.startedAt,
1760
+ phaseTimings.receivedAt
1761
+ );
1762
+ const queueDurationSeconds = getDurationSeconds(
1763
+ phaseTimings.receivedAt,
1764
+ phaseTimings.bridgingAt
1765
+ );
1766
+ const bridgeDurationSeconds = getDurationSeconds(
1767
+ phaseTimings.bridgingAt,
1768
+ phaseTimings.completedAt
1769
+ );
1770
+ const currentPhaseId = getCurrentPhaseId(state, phaseTimings, isEarlyComplete);
1771
+ const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
1772
+ const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
1773
+ const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
1774
+ const statusLabel = isComplete ? isEarlyComplete ? "Confirmed" : "Successful" : isFailed ? "Failed" : delayPhaseId || hasEscalatedDelay ? "Taking longer" : "In progress";
1775
+ const phaseRows = directTransfer ? [] : [
1776
+ {
1777
+ id: "confirming",
1778
+ title: `Confirming ${flowNoun}`,
1779
+ description: phaseTimings.receivedAt !== void 0 ? `${flowCapitalized} detected on ${_chunkNELAYNA3cjs.getChainName.call(void 0, displaySourceChain)}.` : "Waiting for your source-chain transaction to be detected.",
1780
+ tone: phaseTimings.receivedAt !== void 0 ? "complete" : isFailed && currentPhaseId === "confirming" ? "failed" : delayPhaseId === "confirming" ? "warning" : currentPhaseId === "confirming" ? "active" : "pending",
1781
+ statusLabel: phaseTimings.receivedAt !== void 0 ? "Done" : delayPhaseId === "confirming" ? "Delayed" : currentPhaseId === "confirming" ? "Active" : "Pending",
1782
+ timerLabel: phaseTimings.receivedAt !== void 0 ? formatElapsedTime(_nullishCoalesce(detectionDurationSeconds, () => ( 0))) : currentPhaseId === "confirming" ? formatElapsedTime(
1783
+ _nullishCoalesce(getDurationSeconds(
1784
+ getPhaseStartTime("confirming", phaseTimings),
1785
+ timelineNowMs
1786
+ ), () => ( 0))
1787
+ ) : "\u2013"
1788
+ },
1789
+ {
1790
+ id: "received",
1791
+ title: `${flowCapitalized} received`,
1792
+ description: phaseTimings.bridgingAt !== void 0 ? "Funds were handed off for bridge execution." : currentPhaseId === "received" || delayPhaseId === "received" ? "Funds are in. Preparing the bridge transaction." : "Starts once the source transaction has been detected.",
1793
+ tone: phaseTimings.bridgingAt !== void 0 ? "complete" : isFailed && currentPhaseId === "received" ? "failed" : delayPhaseId === "received" ? "warning" : currentPhaseId === "received" ? "active" : "pending",
1794
+ statusLabel: phaseTimings.bridgingAt !== void 0 ? "Done" : delayPhaseId === "received" ? "Delayed" : currentPhaseId === "received" ? "Active" : "Pending",
1795
+ timerLabel: phaseTimings.bridgingAt !== void 0 ? formatElapsedTime(_nullishCoalesce(queueDurationSeconds, () => ( 0))) : currentPhaseId === "received" ? formatElapsedTime(
1796
+ _nullishCoalesce(getDurationSeconds(
1797
+ getPhaseStartTime("received", phaseTimings),
1798
+ timelineNowMs
1799
+ ), () => ( 0))
1800
+ ) : phaseTimings.receivedAt !== void 0 ? "Queued" : "\u2013"
1801
+ },
1802
+ {
1803
+ id: "bridging",
1804
+ title: "Bridging",
1805
+ description: isComplete && !isEarlyComplete ? `Funds landed on ${_chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)}.` : isEarlyComplete ? "Bridge started successfully and will finish in the background." : currentPhaseId === "bridging" || delayPhaseId === "bridging" ? `Sending funds to ${_chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)}.` : "Begins after the bridge transaction is submitted.",
1806
+ tone: isComplete && !isEarlyComplete ? "complete" : isFailed && currentPhaseId === "bridging" ? "failed" : delayPhaseId === "bridging" ? "warning" : currentPhaseId === "bridging" ? "active" : "pending",
1807
+ statusLabel: isComplete && !isEarlyComplete ? "Done" : isEarlyComplete ? "In flight" : delayPhaseId === "bridging" ? "Delayed" : currentPhaseId === "bridging" ? "Active" : "Pending",
1808
+ timerLabel: isComplete && !isEarlyComplete ? formatElapsedTime(_nullishCoalesce(bridgeDurationSeconds, () => ( 0))) : currentPhaseId === "bridging" ? formatElapsedTime(
1809
+ _nullishCoalesce(getDurationSeconds(
1810
+ getPhaseStartTime("bridging", phaseTimings),
1811
+ _nullishCoalesce(_nullishCoalesce(phaseTimings.completedAt, () => ( phaseTimings.endedAt)), () => ( timelineNowMs))
1812
+ ), () => ( 0))
1813
+ ) : phaseTimings.bridgingAt !== void 0 ? "In flight" : "\u2013"
1814
+ }
1815
+ ];
1816
+ const phaseBoardTitle = `${_chunkNELAYNA3cjs.getChainName.call(void 0, displaySourceChain)} to ${_chunkNELAYNA3cjs.getChainName.call(void 0,
1817
+ targetChain
1818
+ )}`;
1819
+ const highlightedMetricLabel = isEarlyComplete ? "Bridge handoff" : bridgeDurationSeconds !== void 0 ? "Bridge time" : "Total time";
1820
+ const highlightedMetricValue = isEarlyComplete ? "In flight" : bridgeDurationSeconds !== void 0 ? formatElapsedTime(bridgeDurationSeconds) : formatElapsedTime(elapsedSeconds);
1821
+ const headerTitle = isFailed ? `${flowCapitalized} could not be completed` : isComplete ? isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` : delayPhaseId === "received" ? "Bridge pending" : delayPhaseId === "bridging" ? "Bridge delayed" : delayPhaseId === "confirming" ? `Confirming ${flowNoun}` : `Processing ${flowNoun}`;
1822
+ const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds have been successfully bridged." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _114 => _114.lastEvent, 'optionalAccess', _115 => _115.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _116 => _116.lastEvent, 'optionalAccess', _117 => _117.type]) === "bridge-started" ? `Bridge started. Sending funds to ${_chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)}.` : `Waiting for your ${flowNoun} to be detected and routed.`;
1823
+ const infoAlertTone = isFailed ? "error" : isComplete ? isEarlyComplete ? "info" : "success" : delayPhaseId || hasEscalatedDelay ? "warning" : "info";
1824
+ const infoAlertMessage = isFailed ? _nullishCoalesce(failureMessage, () => ( `Your ${flowNoun} could not be completed.`)) : isComplete ? directTransfer ? "This route did not require bridging." : isEarlyComplete ? "The bridge has started successfully and will finish in the background." : "Funds arrived successfully on the destination chain." : hasEscalatedDelay ? "This transfer is taking longer than expected. You can close the window and it will keep processing in the background." : delayPhaseId ? "This phase is moving slower than usual, but it is still being processed automatically." : `You can safely close this window. Your ${flowNoun} will continue in the background.`;
1825
+ const renderPhaseBoard = () => directTransfer ? null : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-board", children: [
1826
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-board-header", children: [
1827
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1828
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-board-kicker", children: "Transfer phases" }),
1829
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-board-route", children: phaseBoardTitle })
1830
+ ] }),
1831
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-board-total", children: [
1832
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total elapsed" }),
1833
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: formatElapsedTime(elapsedSeconds) })
1834
+ ] })
1835
+ ] }),
1836
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-list", children: phaseRows.map((phase) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1837
+ "div",
1838
+ {
1839
+ className: `rs-phase-row rs-phase-row--${phase.tone}`,
1840
+ children: [
1841
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-rail", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-phase-dot" }) }),
1842
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-copy", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-row-header", children: [
1843
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-title-block", children: [
1844
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-title", children: phase.title }),
1845
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-phase-description", children: phase.description })
1846
+ ] }),
1847
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-phase-meta", children: [
1848
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-phase-status", children: phase.statusLabel }),
1849
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-phase-timer", children: phase.timerLabel })
1850
+ ] })
1851
+ ] }) })
1852
+ ]
1853
+ },
1854
+ phase.id
1855
+ )) })
1856
+ ] });
1857
+ const renderPrimarySummaryCard = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
1858
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1859
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Status" }),
1860
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1861
+ "span",
1862
+ {
1863
+ className: "rs-card-value",
1864
+ style: {
1865
+ color: isFailed ? "var(--rs-error)" : isComplete ? "var(--rs-success)" : delayPhaseId || hasEscalatedDelay ? "var(--color-amber8, #e2a336)" : void 0
1866
+ },
1867
+ children: statusLabel
1868
+ }
1869
+ )
1870
+ ] }),
1871
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1872
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: highlightedMetricLabel }),
1873
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: highlightedMetricValue })
1874
+ ] }),
1875
+ !isProcessing && bridgeDurationSeconds !== void 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1876
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Total time" }),
1877
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: formatElapsedTime(elapsedSeconds) })
1878
+ ] }),
1879
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1880
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You sent" }),
1881
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-card-value", children: [
1882
+ formattedReceivedAmount,
1883
+ " ",
1884
+ sourceSymbol
1885
+ ] })
1886
+ ] })
1887
+ ] });
1888
+ const renderRouteCard = () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
1889
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1890
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Source" }),
1891
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1892
+ "span",
1893
+ {
1894
+ className: "rs-card-value",
1895
+ style: { display: "flex", alignItems: "center", gap: 6 },
1896
+ children: [
1897
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1898
+ "img",
1899
+ {
1900
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain),
1901
+ alt: "",
1902
+ style: { width: 14, height: 14, borderRadius: "50%" }
1903
+ }
1904
+ ),
1905
+ _chunkNELAYNA3cjs.getChainName.call(void 0, displaySourceChain)
1906
+ ]
1907
+ }
1908
+ )
1909
+ ] }),
1910
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1911
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination" }),
1912
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1913
+ "span",
1914
+ {
1915
+ className: "rs-card-value",
1916
+ style: { display: "flex", alignItems: "center", gap: 6 },
1917
+ children: [
1918
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1919
+ "img",
1920
+ {
1921
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain),
1922
+ alt: "",
1923
+ style: { width: 14, height: 14, borderRadius: "50%" }
1924
+ }
1925
+ ),
1926
+ _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)
1927
+ ]
1928
+ }
1929
+ )
1930
+ ] }),
1931
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1932
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Transaction" }),
1933
+ sourceExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1934
+ "a",
1935
+ {
1936
+ href: sourceExplorerUrl,
1937
+ target: "_blank",
1938
+ rel: "noopener noreferrer",
1939
+ className: "rs-link rs-link-external rs-font-mono rs-text-xs",
1940
+ children: [
1941
+ truncateHash(txHash),
1653
1942
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1654
- "span",
1943
+ "svg",
1655
1944
  {
1656
- className: "rs-card-value",
1657
- style: { color: "var(--rs-success)" },
1658
- children: isEarlyComplete ? "Confirmed" : "Successful"
1945
+ viewBox: "0 0 24 24",
1946
+ fill: "none",
1947
+ stroke: "currentColor",
1948
+ strokeWidth: "2.5",
1949
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1950
+ "path",
1951
+ {
1952
+ strokeLinecap: "round",
1953
+ strokeLinejoin: "round",
1954
+ d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
1955
+ }
1956
+ )
1659
1957
  }
1660
1958
  )
1661
- ] }),
1662
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1663
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Total time" }),
1664
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: formatElapsedTime(elapsedSeconds) })
1665
- ] }),
1666
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1667
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You sent" }),
1668
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-card-value", children: [
1669
- formattedReceivedAmount,
1670
- " ",
1671
- sourceSymbol
1672
- ] })
1673
- ] })
1674
- ] }),
1675
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
1676
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1677
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Source" }),
1678
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1679
- "span",
1959
+ ]
1960
+ }
1961
+ ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value rs-card-value--mono", children: truncateHash(txHash) })
1962
+ ] }),
1963
+ destinationTxHash && destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1964
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination tx" }),
1965
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1966
+ "a",
1967
+ {
1968
+ href: destExplorerUrl,
1969
+ target: "_blank",
1970
+ rel: "noopener noreferrer",
1971
+ className: "rs-link rs-link-external rs-font-mono rs-text-xs",
1972
+ children: [
1973
+ truncateHash(destinationTxHash),
1974
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1975
+ "svg",
1680
1976
  {
1681
- className: "rs-card-value",
1682
- style: { display: "flex", alignItems: "center", gap: 6 },
1683
- children: [
1684
- _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1685
- "img",
1686
- {
1687
- src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain),
1688
- alt: "",
1689
- style: { width: 14, height: 14, borderRadius: "50%" }
1690
- }
1691
- ),
1692
- _chunkNELAYNA3cjs.getChainName.call(void 0, displaySourceChain)
1693
- ]
1977
+ viewBox: "0 0 24 24",
1978
+ fill: "none",
1979
+ stroke: "currentColor",
1980
+ strokeWidth: "2.5",
1981
+ style: { width: 12, height: 12 },
1982
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1983
+ "path",
1984
+ {
1985
+ strokeLinecap: "round",
1986
+ strokeLinejoin: "round",
1987
+ d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
1988
+ }
1989
+ )
1694
1990
  }
1695
1991
  )
1696
- ] }),
1697
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1698
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination" }),
1699
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1700
- "span",
1992
+ ]
1993
+ }
1994
+ )
1995
+ ] })
1996
+ ] });
1997
+ const renderFooter = () => {
1998
+ if (!isComplete && !isFailed) {
1999
+ return null;
2000
+ }
2001
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-footer", style: { gap: 8, display: "flex" }, children: [
2002
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Close" }),
2003
+ onNewDeposit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Button, { onClick: onNewDeposit, fullWidth: true, children: [
2004
+ "New ",
2005
+ flowNoun
2006
+ ] })
2007
+ ] });
2008
+ };
2009
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
2010
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-header", children: [
2011
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-header-row", children: [
2012
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2013
+ "div",
2014
+ {
2015
+ className: `rs-step-icon ${isFailed ? "rs-step-icon--error" : delayPhaseId || hasEscalatedDelay ? "rs-step-icon--warning" : isComplete ? "rs-step-icon--success" : "rs-step-icon--accent"}`,
2016
+ children: isFailed ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2017
+ "svg",
1701
2018
  {
1702
- className: "rs-card-value",
1703
- style: { display: "flex", alignItems: "center", gap: 6 },
2019
+ viewBox: "0 0 24 24",
2020
+ fill: "none",
2021
+ stroke: "currentColor",
2022
+ strokeWidth: "2",
1704
2023
  children: [
1705
- _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1706
- "img",
2024
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2025
+ "path",
1707
2026
  {
1708
- src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain),
1709
- alt: "",
1710
- style: { width: 14, height: 14, borderRadius: "50%" }
2027
+ strokeLinecap: "round",
2028
+ strokeLinejoin: "round",
2029
+ d: "M12 9v3.75m0 3.75h.008v.008H12v-.008z"
1711
2030
  }
1712
2031
  ),
1713
- _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)
1714
- ]
1715
- }
1716
- )
1717
- ] }),
1718
- sourceExplorerUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1719
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Transaction" }),
1720
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1721
- "a",
1722
- {
1723
- href: sourceExplorerUrl,
1724
- target: "_blank",
1725
- rel: "noopener noreferrer",
1726
- className: "rs-link rs-link-external rs-font-mono rs-text-xs",
1727
- children: [
1728
- truncateHash(txHash),
1729
2032
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1730
- "svg",
2033
+ "path",
1731
2034
  {
1732
- viewBox: "0 0 24 24",
1733
- fill: "none",
1734
- stroke: "currentColor",
1735
- strokeWidth: "2.5",
1736
- style: { width: 12, height: 12 },
1737
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1738
- "path",
1739
- {
1740
- strokeLinecap: "round",
1741
- strokeLinejoin: "round",
1742
- d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
1743
- }
1744
- )
2035
+ strokeLinecap: "round",
2036
+ strokeLinejoin: "round",
2037
+ d: "M10.29 3.86L1.82 18a2.25 2.25 0 001.93 3.37h16.5A2.25 2.25 0 0022.18 18L13.71 3.86a2.25 2.25 0 00-3.42 0z"
1745
2038
  }
1746
2039
  )
1747
2040
  ]
1748
2041
  }
1749
- )
1750
- ] }),
1751
- destinationTxHash && destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1752
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination tx" }),
1753
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1754
- "a",
2042
+ ) : isComplete ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2043
+ "svg",
1755
2044
  {
1756
- href: destExplorerUrl,
1757
- target: "_blank",
1758
- rel: "noopener noreferrer",
1759
- className: "rs-link rs-link-external rs-font-mono rs-text-xs",
1760
- children: [
1761
- truncateHash(destinationTxHash),
1762
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1763
- "svg",
1764
- {
1765
- viewBox: "0 0 24 24",
1766
- fill: "none",
1767
- stroke: "currentColor",
1768
- strokeWidth: "2.5",
1769
- style: { width: 12, height: 12 },
1770
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1771
- "path",
1772
- {
1773
- strokeLinecap: "round",
1774
- strokeLinejoin: "round",
1775
- d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
1776
- }
1777
- )
1778
- }
1779
- )
1780
- ]
2045
+ viewBox: "0 0 24 24",
2046
+ fill: "none",
2047
+ stroke: "currentColor",
2048
+ strokeWidth: "2.5",
2049
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2050
+ "path",
2051
+ {
2052
+ strokeLinecap: "round",
2053
+ strokeLinejoin: "round",
2054
+ d: "M5 12l5 5L20 7"
2055
+ }
2056
+ )
1781
2057
  }
1782
- )
1783
- ] })
1784
- ] })
1785
- ] }),
1786
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-footer", style: { gap: 8, display: "flex" }, children: [
1787
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Close" }),
1788
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Button, { onClick: onNewDeposit, fullWidth: true, children: [
1789
- "New ",
1790
- flowNoun
1791
- ] })
1792
- ] }),
1793
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
1794
- ] });
1795
- }
1796
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1797
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-header", children: [
1798
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-header-row", children: [
1799
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1800
- "div",
1801
- {
1802
- className: `rs-step-icon ${isDelayed ? "rs-step-icon--warning" : "rs-step-icon--accent"}`,
1803
- children: isDelayed ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2058
+ ) : delayPhaseId || hasEscalatedDelay ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1804
2059
  "svg",
1805
2060
  {
1806
2061
  viewBox: "0 0 24 24",
@@ -1819,54 +2074,13 @@ function ProcessingStep({
1819
2074
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, {})
1820
2075
  }
1821
2076
  ),
1822
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: isDelayed ? `${flowCapitalized} taking longer than expected` : `Bridging ${flowCapitalized}` })
2077
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: headerTitle })
1823
2078
  ] }),
1824
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-description rs-text-secondary", children: [
1825
- state.type === "processing" && (_optionalChain([lastEvent, 'optionalAccess', _104 => _104.type]) === "deposit-received" ? "Transfer received. Preparing bridge..." : _optionalChain([lastEvent, 'optionalAccess', _105 => _105.type]) === "bridge-started" ? "Transfer confirmed. Funds arriving shortly..." : `Bridging your ${flowNoun} to ${_chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)}.`),
1826
- (state.type === "failed" || state.type === "error") && "Your funds are safe. Our team has been notified and is working to complete your transfer."
1827
- ] })
2079
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-description rs-text-secondary", children: headerDescription })
1828
2080
  ] }),
1829
2081
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", children: [
1830
- isProcessing && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1831
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-progress-bar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-progress-bar-fill rs-progress-bar-fill--indeterminate" }) }),
1832
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--info", children: [
1833
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1834
- "svg",
1835
- {
1836
- className: "rs-alert-icon",
1837
- viewBox: "0 0 24 24",
1838
- fill: "none",
1839
- stroke: "currentColor",
1840
- strokeWidth: "2",
1841
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1842
- "path",
1843
- {
1844
- strokeLinecap: "round",
1845
- strokeLinejoin: "round",
1846
- d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"
1847
- }
1848
- )
1849
- }
1850
- ),
1851
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-alert-text", children: [
1852
- "You can safely close this window. Your ",
1853
- flowNoun,
1854
- " will complete in the background."
1855
- ] })
1856
- ] }),
1857
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1858
- "div",
1859
- {
1860
- className: "rs-text-sm rs-text-tertiary",
1861
- style: { textAlign: "center" },
1862
- children: [
1863
- "Elapsed: ",
1864
- formatElapsedTime(elapsedSeconds)
1865
- ]
1866
- }
1867
- )
1868
- ] }),
1869
- isDelayed && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--info", children: [
2082
+ renderPhaseBoard(),
2083
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `rs-alert rs-alert--${infoAlertTone}`, children: [
1870
2084
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1871
2085
  "svg",
1872
2086
  {
@@ -1885,97 +2099,12 @@ function ProcessingStep({
1885
2099
  )
1886
2100
  }
1887
2101
  ),
1888
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-alert-text", children: "You can safely close this window. Your funds are secure and the transfer will be completed automatically." })
2102
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-alert-text", children: infoAlertMessage })
1889
2103
  ] }),
1890
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
1891
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1892
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Status" }),
1893
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1894
- "span",
1895
- {
1896
- className: "rs-card-value",
1897
- style: { color: isDelayed ? "var(--color-amber8, #e2a336)" : void 0 },
1898
- children: isDelayed ? "Processing" : "In progress"
1899
- }
1900
- )
1901
- ] }),
1902
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1903
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Source" }),
1904
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1905
- "span",
1906
- {
1907
- className: "rs-card-value",
1908
- style: { display: "flex", alignItems: "center", gap: 8 },
1909
- children: [
1910
- _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1911
- "img",
1912
- {
1913
- src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, displaySourceChain),
1914
- alt: "",
1915
- style: { width: 16, height: 16, borderRadius: "50%" }
1916
- }
1917
- ),
1918
- _chunkNELAYNA3cjs.getChainName.call(void 0, displaySourceChain)
1919
- ]
1920
- }
1921
- )
1922
- ] }),
1923
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1924
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination" }),
1925
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1926
- "span",
1927
- {
1928
- className: "rs-card-value",
1929
- style: { display: "flex", alignItems: "center", gap: 8 },
1930
- children: [
1931
- _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1932
- "img",
1933
- {
1934
- src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain),
1935
- alt: "",
1936
- style: { width: 16, height: 16, borderRadius: "50%" }
1937
- }
1938
- ),
1939
- _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)
1940
- ]
1941
- }
1942
- )
1943
- ] }),
1944
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1945
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Transaction" }),
1946
- sourceExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1947
- "a",
1948
- {
1949
- href: sourceExplorerUrl,
1950
- target: "_blank",
1951
- rel: "noopener noreferrer",
1952
- className: "rs-link rs-link-external rs-font-mono rs-text-xs",
1953
- children: [
1954
- truncateHash(txHash),
1955
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1956
- "svg",
1957
- {
1958
- viewBox: "0 0 24 24",
1959
- fill: "none",
1960
- stroke: "currentColor",
1961
- strokeWidth: "2.5",
1962
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1963
- "path",
1964
- {
1965
- strokeLinecap: "round",
1966
- strokeLinejoin: "round",
1967
- d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
1968
- }
1969
- )
1970
- }
1971
- )
1972
- ]
1973
- }
1974
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value rs-card-value--mono", children: truncateHash(txHash) })
1975
- ] })
1976
- ] })
2104
+ renderPrimarySummaryCard(),
2105
+ renderRouteCard()
1977
2106
  ] }),
1978
- isDelayed && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { onClick: onClose, fullWidth: true, children: "Close" }) }),
2107
+ renderFooter(),
1979
2108
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
1980
2109
  ] });
1981
2110
  }