@0xsquid/ui 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -2569,6 +2569,16 @@ function debounce(func, delay) {
2569
2569
  };
2570
2570
  return debounced;
2571
2571
  }
2572
+ const formatTime = (elapsedTime) => {
2573
+ const totalSeconds = Math.floor(elapsedTime / 1000);
2574
+ const minutes = Math.floor(totalSeconds / 60);
2575
+ // Show only seconds if total time is less than 1 minute
2576
+ if (minutes === 0) {
2577
+ return `${totalSeconds}s`;
2578
+ }
2579
+ // Show only minutes if total time is 1 minute or more
2580
+ return `${minutes}m`;
2581
+ };
2572
2582
 
2573
2583
  const badgeSizeClassMap = {
2574
2584
  sm: 'tw-w-4 tw-h-4',
@@ -2683,9 +2693,9 @@ const roundedClassMap = {
2683
2693
  lg: 'tw-rounded-squid-xxl',
2684
2694
  };
2685
2695
  const buttonVariantClassMap = {
2686
- primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
2687
- secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
2688
- tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
2696
+ primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100',
2697
+ secondary: 'tw-bg-grey-100 tw-text-grey-800',
2698
+ tertiary: 'tw-bg-grey-800 tw-text-grey-300',
2689
2699
  };
2690
2700
  // right now all variants have the same disabled styles
2691
2701
  // in the future, we can add more disabled styles for different variants
@@ -2699,7 +2709,7 @@ function Button(_a) {
2699
2709
  icon) : (
2700
2710
  // icon and label
2701
2711
  jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
2702
- const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], roundedClassMap[size],
2712
+ const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && 'hover:tw-border-material-light-average', roundedClassMap[size],
2703
2713
  // disabled styles
2704
2714
  disabled && buttonDisabledClass,
2705
2715
  // custom classes from props
@@ -2739,15 +2749,15 @@ function ChevronRightSmallIcon() {
2739
2749
  function ArrowLeftIcon({ className, size = '24', }) {
2740
2750
  return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2741
2751
  }
2742
- function ArrowRightUpCircleIcon() {
2743
- return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsxRuntime.jsx("path", { d: "M9 15L14.5 9.5M15 14V9H10M21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2744
- }
2745
2752
  function ChevronGrabberVerticalIcon({ size = '16', className, }) {
2746
2753
  return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2747
2754
  }
2748
2755
  function SquareArrowTopRight2Icon({ className, size = '16', }) {
2749
2756
  return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M6.00033 2.66663H4.80033C4.05359 2.66663 3.68022 2.66663 3.395 2.81195C3.14412 2.93978 2.94015 3.14376 2.81232 3.39464C2.66699 3.67985 2.66699 4.05322 2.66699 4.79996L2.66699 11.2C2.66699 11.9467 2.66699 12.3201 2.81232 12.6053C2.94015 12.8562 3.14412 13.0601 3.395 13.188C3.68022 13.3333 4.05359 13.3333 4.80033 13.3333L11.2003 13.3333C11.9471 13.3333 12.3204 13.3333 12.6056 13.188C12.8565 13.0601 13.0605 12.8562 13.1883 12.6053C13.3337 12.3201 13.3337 11.9467 13.3337 11.2V9.99996M9.33366 2.66663L13.3337 2.66663M13.3337 2.66663V6.66663M13.3337 2.66663L7.33366 8.66663", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
2750
2757
  }
2758
+ function ArrowsSwapIcon({ size = '24', className, }) {
2759
+ return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsxRuntime.jsx("path", { d: "M14 4L20 9.99998H4", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M10 20L4 14H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
2760
+ }
2751
2761
 
2752
2762
  function ArrowButton(_a) {
2753
2763
  var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
@@ -2859,16 +2869,26 @@ const CSS_VARS = {
2859
2869
  SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
2860
2870
  SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
2861
2871
  TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
2872
+ SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
2873
+ HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
2874
+ SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
2875
+ SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
2876
+ BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
2877
+ BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
2862
2878
  };
2863
2879
  const ANIMATION_DURATIONS = {
2864
2880
  SHOW_ROUTE: 300,
2865
2881
  HIDE_ROUTE: 300,
2866
2882
  CHANGE_SWAP_STEP: 300,
2883
+ SHOW_MODAL: 400,
2884
+ HIDE_MODAL: 400,
2867
2885
  };
2868
2886
  const ANIMATION_TIMINGS = {
2869
2887
  EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
2870
2888
  COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
2871
2889
  CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
2890
+ SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
2891
+ HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
2872
2892
  };
2873
2893
 
2874
2894
  function SearchIcon() {
@@ -3445,7 +3465,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
3445
3465
  .map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
3446
3466
  }
3447
3467
  else if (type === 'image') {
3448
- return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
3468
+ return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs" }, index));
3449
3469
  }
3450
3470
  return null;
3451
3471
  }) })] })] }));
@@ -3466,7 +3486,7 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
3466
3486
  return setIsOpen(true);
3467
3487
  const timeoutId = setTimeout(() => {
3468
3488
  setIsOpen(false);
3469
- }, 300);
3489
+ }, ANIMATION_DURATIONS.HIDE_MODAL);
3470
3490
  return () => {
3471
3491
  clearTimeout(timeoutId);
3472
3492
  };
@@ -3479,7 +3499,13 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
3479
3499
  onBackdropClick();
3480
3500
  }
3481
3501
  }
3482
- : undefined, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
3502
+ : undefined, style: {
3503
+ [CSS_VARS.BLUR_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
3504
+ [CSS_VARS.BLUR_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
3505
+ }, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { style: {
3506
+ [CSS_VARS.SLIDE_TO_TOP_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
3507
+ [CSS_VARS.SLIDE_TO_BOTTOM_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
3508
+ }, className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
3483
3509
  }
3484
3510
 
3485
3511
  const borderTypeClassMap = {
@@ -3592,15 +3618,18 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
3592
3618
  onOpen === null || onOpen === void 0 ? void 0 : onOpen();
3593
3619
  }
3594
3620
  };
3595
- return (jsxRuntime.jsx("div", { className: "tw-relative tw-h-[60px] tw-w-[400px]", children: jsxRuntime.jsxs("div", { className: cn('tw-absolute tw-bottom-0 tw-z-20 tw-flex tw-w-full tw-max-w-[400px] tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l', isRouteVisible ? 'tw-h-[536px]' : 'tw-h-[60px]'), children: [jsxRuntime.jsx("div", { style: {
3621
+ return (jsxRuntime.jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children: jsxRuntime.jsxs("div", { className: cn('tw-absolute tw-bottom-0 tw-z-10 tw-flex tw-w-full tw-max-w-[400px] tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l', isRouteVisible ? 'tw-h-[535px]' : 'tw-h-[60px]'), children: [!isRouteVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] })), jsxRuntime.jsx("div", { style: {
3596
3622
  [CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
3597
3623
  [CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
3598
- }, className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10') }), jsxRuntime.jsx("div", { onClick: isShowRouteAnimationRunning ? undefined : handleToggleRouteSteps, style: {
3624
+ }, className: cn('tw-absolute tw-top-0 tw-h-[535px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10') }), jsxRuntime.jsx("div", { style: {
3625
+ zIndex: 20,
3626
+ display: isRouteVisible ? 'none' : 'block',
3627
+ }, onClick: handleToggleRouteSteps, className: "tw-absolute tw-inset-0 tw-h-[60px] tw-cursor-pointer tw-rounded-squid-l tw-border tw-border-material-light-thin" }), jsxRuntime.jsx("div", { onClick: isShowRouteAnimationRunning ? undefined : handleToggleRouteSteps, style: {
3599
3628
  [CSS_VARS.COLLAPSE_ROUTE_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
3600
3629
  [CSS_VARS.EXPAND_ROUTE_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
3601
- }, className: cn('tw-h-[60px] tw-max-h-[536px] tw-w-full tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
3630
+ }, className: cn('tw-relative tw-h-[60px] tw-max-h-[535px] tw-w-full tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
3602
3631
  ? 'tw-animate-expand-route'
3603
- : 'tw-animate-collapse-route'), children: jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col tw-gap-squid-xxs", style: {
3632
+ : 'tw-animate-collapse-route'), children: jsxRuntime.jsxs("div", { className: "tw-flex tw-h-[535px] tw-flex-col tw-gap-squid-xxs", style: {
3604
3633
  transition: isShowRouteAnimationRunning
3605
3634
  ? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
3606
3635
  : isRouteVisible
@@ -3608,12 +3637,15 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
3608
3637
  : `transform ${ANIMATION_DURATIONS.CHANGE_SWAP_STEP}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`,
3609
3638
  transform: isShowRouteAnimationRunning
3610
3639
  ? 'translateY(0)'
3611
- : `translateY(-${536 - 50 - (newStepIndex + 1) * 50 - 20}px)`,
3612
- }, children: [jsxRuntime.jsx("div", { className: cn('tw-bg-red- tw-absolute tw-z-10 tw-flex tw-h-[52px] tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-transparent tw-p-squid-xs'), children: jsxRuntime.jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { className: "tw-relative tw-flex tw-min-h-[460px] tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1), link: step.link, status: newStepIndex < index
3640
+ : `translateY(-${535 - 50 - (newStepIndex + 1) * 50 - 30}px)`,
3641
+ }, children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-flex tw-h-[52px] tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-transparent tw-p-squid-xs'), children: jsxRuntime.jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { style: {
3642
+ zIndex: isRouteVisible ? 0 : -10,
3643
+ scrollbarWidth: 'none',
3644
+ }, className: "tw-relative tw-top-[52px] tw-flex tw-max-h-[413px] tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs tw-py-[15px]", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1), link: step.link, status: newStepIndex < index
3613
3645
  ? 'pending'
3614
3646
  : newStepIndex > index
3615
3647
  ? 'executed'
3616
- : 'progress' }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }) })] }) }));
3648
+ : 'progress' }, index))) }), jsxRuntime.jsx("footer", { className: "tw-absolute tw-bottom-0 tw-flex tw-w-full tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }) })] }) }));
3617
3649
  }
3618
3650
 
3619
3651
  function TokenPair({ firstToken, secondToken }) {
@@ -38500,14 +38532,6 @@ const transactionRejectedAnimation = TransactionRejectedAnimation;
38500
38532
  const useTimer = ({ immediateStart = true, }) => {
38501
38533
  const [timer, setTimer] = React.useState('0s');
38502
38534
  const intervalRef = React.useRef(null);
38503
- const formatTime = (elapsedTime) => {
38504
- const totalSeconds = Math.floor(elapsedTime / 1000);
38505
- const minutes = Math.floor(totalSeconds / 60);
38506
- const seconds = totalSeconds % 60;
38507
- const formattedMinutes = minutes > 0 ? `${minutes}m` : '';
38508
- const formattedSeconds = seconds > 0 ? `${seconds}s` : '';
38509
- return `${formattedMinutes}${formattedSeconds}`.trim();
38510
- };
38511
38535
  const startTimer = () => {
38512
38536
  if (intervalRef.current !== null)
38513
38537
  return; // Prevent multiple intervals
@@ -38534,26 +38558,34 @@ const useTimer = ({ immediateStart = true, }) => {
38534
38558
  return { timer, stopTimer, startTimer };
38535
38559
  };
38536
38560
 
38537
- var TransactionStatus;
38538
- (function (TransactionStatus) {
38539
- // Submitted transaction, returned by squid axelar
38540
- TransactionStatus["SUCCESS"] = "success";
38541
- TransactionStatus["NEEDS_GAS"] = "needs_gas";
38542
- TransactionStatus["ONGOING"] = "ongoing";
38543
- TransactionStatus["PARTIAL_SUCCESS"] = "partial_success";
38544
- TransactionStatus["NOT_FOUND"] = "not_found";
38545
- // Unsubmitted Transaction, can be status from wallet
38546
- TransactionStatus["INITIAL_LOADING"] = "initialLoading";
38547
- TransactionStatus["ERROR"] = "error";
38548
- TransactionStatus["WARNING"] = "warning";
38549
- TransactionStatus["PENDING"] = "pending";
38550
- TransactionStatus["REJECTED"] = "rejected";
38551
- })(TransactionStatus || (TransactionStatus = {}));
38561
+ var SwapState;
38562
+ (function (SwapState) {
38563
+ // user needs to sign the transaction in their wallet
38564
+ SwapState[SwapState["CONFIRM"] = 0] = "CONFIRM";
38565
+ // transaction is ongoing
38566
+ SwapState[SwapState["PROGRESS"] = 1] = "PROGRESS";
38567
+ // transaction is successful
38568
+ SwapState[SwapState["COMPLETED"] = 2] = "COMPLETED";
38569
+ // transaction failed
38570
+ SwapState[SwapState["ERROR"] = 3] = "ERROR";
38571
+ // transaction failed halfway and user received fallback tokens
38572
+ SwapState[SwapState["PARTIAL_SUCCESS"] = 4] = "PARTIAL_SUCCESS";
38573
+ // user hasn't signed the transaction in their wallet after some time
38574
+ SwapState[SwapState["CONFIRMATION_TOO_LONG"] = 5] = "CONFIRMATION_TOO_LONG";
38575
+ // user rejected the transaction in their wallet
38576
+ SwapState[SwapState["CONFIRMATION_REJECTED"] = 6] = "CONFIRMATION_REJECTED";
38577
+ // user needs to add gas to the transaction to complete its execution
38578
+ SwapState[SwapState["NEEDS_GAS"] = 7] = "NEEDS_GAS";
38579
+ })(SwapState || (SwapState = {}));
38552
38580
 
38553
38581
  function ChainLink({ size = '16', strokeWidth = '2', }) {
38554
38582
  return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M6.66667 3.66667L7.16763 3.17225C8.73063 1.60925 11.2648 1.60925 12.8278 3.17225C14.3907 4.73525 14.3907 7.26937 12.8278 8.83237L12.3333 9.33333M3.66667 6.66667L3.17225 7.16763C1.60925 8.73063 1.60925 11.2648 3.17225 12.8278C4.73525 14.3907 7.26937 14.3907 8.83237 12.8278L9.33333 12.3333M6.66667 9.33333L9.33333 6.66667", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }) }));
38555
38583
  }
38556
38584
 
38585
+ function TimeFliesIcon({ size = '24', className, }) {
38586
+ return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsxRuntime.jsx("circle", { cx: "15", cy: "12", r: "7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M2 12H4M3 16H5M3 8H5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M15 9V12L16.5 13.5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
38587
+ }
38588
+
38557
38589
  function XSocial({ className, size = '24', }) {
38558
38590
  return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M17.4033 3.5H20.2852L13.989 10.701L21.396 20.5H15.5964L11.054 14.557L5.85637 20.5H2.97269L9.70709 12.7977L2.60156 3.5H8.54839L12.6544 8.93215L17.4033 3.5ZM16.3918 18.7738H17.9887L7.68067 5.13549H5.96702L16.3918 18.7738Z", fill: "currentColor" }) }));
38559
38591
  }
@@ -38601,68 +38633,79 @@ const AnimationWrapper = ({ lottieJsonFile, animReplacement, hideAnimations = fa
38601
38633
  };
38602
38634
 
38603
38635
  const swapProgressAnimations = {
38604
- confirm: transactionPendingAnimation,
38605
- error: transactionErrorPauseAnimation,
38606
- partialSuccess: transactionHalfSuccessAnimation,
38607
- progress: transactionProcessinganimation,
38608
- completed: transactionSuccessAnimation,
38609
- confirmationTooLong: transactionPendingAnimation,
38610
- confirmationRejected: transactionRejectedAnimation,
38611
- needsGas: transactionErrorPauseAnimation,
38636
+ [SwapState.CONFIRM]: transactionPendingAnimation,
38637
+ [SwapState.ERROR]: transactionErrorPauseAnimation,
38638
+ [SwapState.PARTIAL_SUCCESS]: transactionHalfSuccessAnimation,
38639
+ [SwapState.PROGRESS]: transactionProcessinganimation,
38640
+ [SwapState.COMPLETED]: transactionSuccessAnimation,
38641
+ [SwapState.CONFIRMATION_TOO_LONG]: transactionPendingAnimation,
38642
+ [SwapState.CONFIRMATION_REJECTED]: transactionRejectedAnimation,
38643
+ [SwapState.NEEDS_GAS]: transactionErrorPauseAnimation,
38612
38644
  };
38613
- const swapProgressTitles = {
38614
- confirm: 'Confirm swap',
38615
- progress: 'Swapping tokens',
38616
- completed: 'Swap complete',
38617
- error: 'Swap failed',
38618
- confirmationTooLong: 'Confirmation taking too long',
38619
- confirmationRejected: 'Swap rejected',
38620
- partialSuccess: 'Swap failed halfway',
38621
- // means that the user needs to add gas to the transaction in the destination chain
38622
- // in order to complete the swap
38623
- needsGas: 'Needs gas on destination',
38645
+ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
38646
+ switch (swapState) {
38647
+ case SwapState.CONFIRM:
38648
+ return 'Confirm swap';
38649
+ case SwapState.PROGRESS:
38650
+ return `Swap ${fromToken.symbol} to ${toToken.symbol}`;
38651
+ case SwapState.COMPLETED:
38652
+ return 'Swap complete';
38653
+ case SwapState.ERROR:
38654
+ return 'Swap failed';
38655
+ case SwapState.CONFIRMATION_TOO_LONG:
38656
+ return 'Confirmation taking too long';
38657
+ case SwapState.CONFIRMATION_REJECTED:
38658
+ return 'Swap rejected';
38659
+ case SwapState.PARTIAL_SUCCESS:
38660
+ return 'Swap failed halfway';
38661
+ case SwapState.NEEDS_GAS:
38662
+ return 'Needs gas on destination';
38663
+ }
38624
38664
  };
38625
- const getSwapProgressDescriptions = ({ state, toAmount, toChain, toToken, }) => {
38626
- switch (state) {
38627
- case 'confirm': {
38665
+ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, }) => {
38666
+ switch (swapState) {
38667
+ case SwapState.CONFIRM: {
38628
38668
  return 'Authenticate the transaction in your wallet.';
38629
38669
  }
38630
- case 'progress': {
38670
+ case SwapState.PROGRESS: {
38631
38671
  return 'Feel free to dismiss this dialog, we’ll notify you when the swap is complete.';
38632
38672
  }
38633
- case 'completed': {
38673
+ case SwapState.COMPLETED: {
38634
38674
  return `You received ${toAmount} ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
38635
38675
  }
38636
- case 'error': {
38676
+ case SwapState.ERROR: {
38637
38677
  return 'Your tokens were safely returned to your wallet.';
38638
38678
  }
38639
- case 'confirmationTooLong': {
38679
+ case SwapState.CONFIRMATION_TOO_LONG: {
38640
38680
  return 'Please go back and get a new quote.';
38641
38681
  }
38642
- case 'confirmationRejected': {
38682
+ case SwapState.CONFIRMATION_REJECTED: {
38643
38683
  return 'You declined the transaction in your wallet.';
38644
38684
  }
38645
- case 'partialSuccess': {
38685
+ case SwapState.PARTIAL_SUCCESS: {
38646
38686
  return `You received a refund of axlUSDC on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
38647
38687
  }
38648
- case 'needsGas': {
38688
+ case SwapState.NEEDS_GAS: {
38649
38689
  return 'Add gas to the transaction via Axelarscan to complete the swap';
38650
38690
  }
38651
38691
  }
38652
38692
  };
38653
38693
  const swapProgressButtonTexts = {
38654
- confirm: 'Cancel',
38655
- progress: 'Ok, done',
38656
- completed: 'Ok, done',
38657
- error: 'Ok, go back',
38658
- confirmationTooLong: 'Cancel',
38659
- confirmationRejected: 'Ok, go back',
38660
- partialSuccess: 'Ok, done',
38661
- needsGas: 'Go to Axelarscan',
38694
+ [SwapState.CONFIRM]: 'Cancel',
38695
+ [SwapState.PROGRESS]: 'Ok, done',
38696
+ [SwapState.COMPLETED]: 'Ok, done',
38697
+ [SwapState.ERROR]: 'Ok, go back',
38698
+ [SwapState.CONFIRMATION_TOO_LONG]: 'Cancel',
38699
+ [SwapState.CONFIRMATION_REJECTED]: 'Ok, go back',
38700
+ [SwapState.PARTIAL_SUCCESS]: 'Ok, done',
38701
+ [SwapState.NEEDS_GAS]: 'Go to Axelarscan',
38662
38702
  };
38663
- function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, txStatus, }) {
38703
+ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
38664
38704
  const [showSwapInfoSection, setShowSwapInfoSection] = React.useState(true);
38665
38705
  const isFirstRenderRef = React.useRef(true);
38706
+ const { timer, stopTimer, startTimer } = useTimer({
38707
+ immediateStart: false,
38708
+ });
38666
38709
  const handleRouteStepsOpen = React.useCallback(() => {
38667
38710
  if (isFirstRenderRef.current) {
38668
38711
  isFirstRenderRef.current = false;
@@ -38675,28 +38718,23 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
38675
38718
  }
38676
38719
  setShowSwapInfoSection(true);
38677
38720
  }, []);
38678
- const animationProgressState = React.useMemo(() => {
38679
- switch (txStatus) {
38680
- case 'warning':
38681
- return 'confirmationTooLong';
38682
- case 'partial_success':
38683
- return 'partialSuccess';
38684
- case 'needs_gas':
38685
- return 'needsGas';
38686
- case 'error':
38687
- return 'error';
38688
- case 'rejected':
38689
- return 'confirmationRejected';
38690
- case 'success':
38691
- return 'completed';
38692
- case 'ongoing':
38693
- case 'initialLoading':
38694
- return 'progress';
38695
- case 'pending':
38696
- default:
38697
- return 'confirm';
38698
- }
38699
- }, [txStatus]);
38721
+ const { headerDescription, headerTitle } = React.useMemo(() => {
38722
+ const headerTitle = getSwapProgressTitle({
38723
+ swapState: swapState,
38724
+ fromToken,
38725
+ toToken,
38726
+ });
38727
+ const headerDescription = getSwapProgressDescriptions({
38728
+ swapState: swapState,
38729
+ toAmount,
38730
+ toChain,
38731
+ toToken,
38732
+ });
38733
+ return {
38734
+ headerTitle,
38735
+ headerDescription,
38736
+ };
38737
+ }, [swapState, fromToken, toToken, toAmount, toChain]);
38700
38738
  return (jsxRuntime.jsxs(Modal, { isOpen: isOpen, onBackdropClick: handleClose, children: [jsxRuntime.jsxs(ModalContent, { style: {
38701
38739
  [CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
38702
38740
  [CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
@@ -38709,26 +38747,18 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
38709
38747
  : 'tw-animate-scale-and-fade-down'), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-[160px] tw-w-full tw-items-center tw-justify-center tw-rounded-tl-squid-l tw-rounded-tr-squid-l tw-bg-royal-500 tw-text-material-light-thin", style: {
38710
38748
  // box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
38711
38749
  boxShadow: '0 1px 0 currentColor',
38712
- }, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[animationProgressState], hideAnimations: false, animReplacement: jsxRuntime.jsx(Loader, { size: "60" }) }) }) }), jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: animationProgressState === 'completed' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(CircleCheckIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", icon: jsxRuntime.jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : animationProgressState === 'error' ||
38713
- animationProgressState === 'partialSuccess' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(EmojiSadFilledIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsxRuntime.jsx(TokenPair, { firstToken: {
38750
+ }, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsxRuntime.jsx(Loader, { size: "60" }) }) }) }), jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(CircleCheckIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", icon: jsxRuntime.jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : swapState === SwapState.ERROR ||
38751
+ swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(EmojiSadFilledIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsxRuntime.jsx(TokenPair, { firstToken: {
38714
38752
  bgColor: fromToken.bgColor,
38715
38753
  imageUrl: fromToken.logoUrl,
38716
38754
  }, secondToken: {
38717
38755
  bgColor: toToken.bgColor,
38718
38756
  imageUrl: toToken.logoUrl,
38719
- } })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: swapProgressTitles[animationProgressState], description: getSwapProgressDescriptions({
38720
- state: animationProgressState,
38721
- toAmount,
38722
- toChain,
38723
- toToken,
38724
- }) }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowRightUpCircleIcon, {}), label: `Swap ${fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol}`, detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), animationProgressState === 'error' ? (jsxRuntime.jsx(CaptionText, { children: "0" })) : (fromAmount)] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx("span", { className: "tw-inline-block tw-rotate-90", children: jsxRuntime.jsx(ArrowRightUpCircleIcon, {}) }), label: `Receive ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol}`, detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), animationProgressState === 'error' ? (jsxRuntime.jsx(CaptionText, { children: "0" })) : (toAmount)] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName }), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(CaptionText, { children: fromAddressFormatted }), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toAddressFormatted })] }) })] })] }), jsxRuntime.jsx(TrackTransactionView, { rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, txStatus: txStatus }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[animationProgressState], onClick: handleClose, className: "tw-min-h-button" })] }));
38757
+ } })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete }) })] })] }), jsxRuntime.jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" })] }));
38725
38758
  }
38726
- const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
38727
- const { timer, stopTimer, startTimer } = useTimer({
38728
- immediateStart: false,
38729
- });
38759
+ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }) => {
38730
38760
  const { currentStepIndex, steps } = React.useMemo(() => {
38731
- if (rawSteps.every((s) => s.status === TransactionStatus.SUCCESS)) {
38761
+ if (rawSteps.every((s) => s.status === SwapState.COMPLETED)) {
38732
38762
  return {
38733
38763
  steps: rawSteps,
38734
38764
  currentStepIndex: rawSteps.length - 1,
@@ -38737,9 +38767,9 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
38737
38767
  // TODO: Fix this
38738
38768
  // Vercel build throws an error for findLastIndex, probably related to the Node version being used
38739
38769
  // @ts-ignore
38740
- const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === TransactionStatus.SUCCESS);
38741
- if (txStatus === TransactionStatus.ONGOING) {
38742
- startTimer();
38770
+ const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === SwapState.COMPLETED);
38771
+ if (swapState === SwapState.PROGRESS) {
38772
+ onTxStart();
38743
38773
  const noSuccessfulStep = lastSuccessfulStepIndex < 0;
38744
38774
  // If no successful step, but transaction is ongoing, this means user signed the tx in their wallet,
38745
38775
  // so we show the second step, because the first step is "waiting for confirmation"
@@ -38747,13 +38777,13 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
38747
38777
  const currentOngoingStepIndex = noSuccessfulStep
38748
38778
  ? 1
38749
38779
  : lastSuccessfulStepIndex + 1;
38750
- // If current step is not the last one, show the timer
38780
+ // If current step is not the last one, show the loader
38751
38781
  if (currentOngoingStepIndex < rawSteps.length) {
38752
- // Show the timer in the current ongoing step
38782
+ // Show loader in the current ongoing step
38753
38783
  // @ts-ignore Vercel build error - TODO: Fix this
38754
- const stepsWithTimer = rawSteps.with(currentOngoingStepIndex, Object.assign(Object.assign({}, rawSteps[currentOngoingStepIndex]), { chipContent: timer }));
38784
+ const stepsWithLoader = rawSteps.with(currentOngoingStepIndex, Object.assign(Object.assign({}, rawSteps[currentOngoingStepIndex]), { chipContent: jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "2" }) }));
38755
38785
  return {
38756
- steps: stepsWithTimer,
38786
+ steps: stepsWithLoader,
38757
38787
  currentStepIndex: currentOngoingStepIndex,
38758
38788
  };
38759
38789
  }
@@ -38762,8 +38792,8 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
38762
38792
  currentStepIndex: rawSteps.length - 1,
38763
38793
  };
38764
38794
  }
38765
- else if (txStatus === TransactionStatus.SUCCESS) {
38766
- stopTimer();
38795
+ else if (swapState === SwapState.COMPLETED) {
38796
+ onTxEnd();
38767
38797
  return {
38768
38798
  steps: rawSteps,
38769
38799
  currentStepIndex: rawSteps.length - 1,
@@ -38773,9 +38803,12 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
38773
38803
  steps: rawSteps,
38774
38804
  currentStepIndex: 0,
38775
38805
  };
38776
- }, [txStatus, rawSteps, timer]);
38806
+ }, [swapState, rawSteps]);
38777
38807
  return rawSteps.length > 0 ? (jsxRuntime.jsx(SwapStepsCollapsed, { steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen })) : null;
38778
38808
  };
38809
+ const SwapDetailItemValues = ({ fromContent, toContent, }) => {
38810
+ return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: fromContent })) : (fromContent), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: toContent })) : (toContent)] }));
38811
+ };
38779
38812
 
38780
38813
  const lightTheme = {
38781
38814
  // content
@@ -41,3 +41,7 @@ export declare function ReorderIcon({ size, className, }: {
41
41
  size?: string;
42
42
  className?: string;
43
43
  }): import("react/jsx-runtime").JSX.Element;
44
+ export declare function ArrowsSwapIcon({ size, className, }: {
45
+ size?: string;
46
+ className?: string;
47
+ }): import("react/jsx-runtime").JSX.Element;
@@ -14,3 +14,7 @@ export declare const ExplosionIcon: ({ size, className, }: {
14
14
  className?: string;
15
15
  size?: string;
16
16
  }) => import("react/jsx-runtime").JSX.Element;
17
+ export declare function TimeFliesIcon({ size, className, }: {
18
+ size?: string;
19
+ className?: string;
20
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { SwapStep, TransactionStatus } from '../../types/components';
1
+ import { SwapState, SwapStep } from '../../types/components';
2
2
  type ChainData = {
3
3
  networkName: string;
4
4
  logoUrl: string;
@@ -9,7 +9,7 @@ type Token = {
9
9
  logoUrl: string;
10
10
  bgColor: string;
11
11
  };
12
- export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, txStatus, }: {
12
+ export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
13
13
  steps: SwapStep[];
14
14
  handleClose?: () => void;
15
15
  isOpen?: boolean;
@@ -23,13 +23,16 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, socialLin
23
23
  toChain: ChainData;
24
24
  fromAddressFormatted: string;
25
25
  toAddressFormatted: string;
26
- txStatus: TransactionStatus;
26
+ swapState: SwapState;
27
+ estimatedTimeToComplete?: string;
27
28
  }): import("react/jsx-runtime").JSX.Element;
28
29
  interface Props {
29
30
  rawSteps: SwapStep[];
30
- txStatus?: TransactionStatus;
31
+ swapState?: SwapState;
31
32
  onOpen?: () => void;
32
33
  onClose?: () => void;
34
+ onTxStart: () => void;
35
+ onTxEnd: () => void;
33
36
  }
34
- export declare const TrackTransactionView: ({ txStatus, rawSteps, onOpen, onClose, }: Props) => import("react/jsx-runtime").JSX.Element | null;
37
+ export declare const TrackTransactionView: ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }: Props) => import("react/jsx-runtime").JSX.Element | null;
35
38
  export {};
@@ -8,14 +8,24 @@ export declare const CSS_VARS: {
8
8
  SCALE_AND_FADE_UP_DURATION: string;
9
9
  SCALE_AND_FADE_DOWN_DURATION: string;
10
10
  TRANSLATE_TOP_OR_BOTTOM: string;
11
+ SHOW_MODAL_DURATION: string;
12
+ HIDE_MODAL_DURATION: string;
13
+ SLIDE_TO_TOP_DURATION: string;
14
+ SLIDE_TO_BOTTOM_DURATION: string;
15
+ BLUR_IN_DURATION: string;
16
+ BLUR_OUT_DURATION: string;
11
17
  };
12
18
  export declare const ANIMATION_DURATIONS: {
13
19
  SHOW_ROUTE: number;
14
20
  HIDE_ROUTE: number;
15
21
  CHANGE_SWAP_STEP: number;
22
+ SHOW_MODAL: number;
23
+ HIDE_MODAL: number;
16
24
  };
17
25
  export declare const ANIMATION_TIMINGS: {
18
26
  EXPAND_ROUTE: string;
19
27
  COLLAPSE_ROUTE: string;
20
28
  CHANGE_SWAP_STEP: string;
29
+ SHOW_ROUTE: string;
30
+ HIDE_ROUTE: string;
21
31
  };
@@ -14,4 +14,5 @@ interface DebouncedFunction<F extends AnyFunction> {
14
14
  cancel: () => void;
15
15
  }
16
16
  export declare function debounce<F extends AnyFunction>(func: F, delay: number): DebouncedFunction<F>;
17
+ export declare const formatTime: (elapsedTime: number) => string;
17
18
  export {};
@@ -13,21 +13,18 @@ export type SwapStep = {
13
13
  descriptionBlocks: SwapStepDescriptionBlock[];
14
14
  chipContent: React.ReactNode;
15
15
  link?: string;
16
- status: TransactionStatus;
16
+ status: SwapState;
17
17
  };
18
- export type SwapProgressState = 'confirm' | 'progress' | 'completed' | 'error' | 'partialSuccess' | 'confirmationTooLong' | 'confirmationRejected' | 'needsGas';
18
+ export declare enum SwapState {
19
+ CONFIRM = 0,
20
+ PROGRESS = 1,
21
+ COMPLETED = 2,
22
+ ERROR = 3,
23
+ PARTIAL_SUCCESS = 4,
24
+ CONFIRMATION_TOO_LONG = 5,
25
+ CONFIRMATION_REJECTED = 6,
26
+ NEEDS_GAS = 7
27
+ }
19
28
  export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
20
29
  export type ThemeType = 'light' | 'dark';
21
30
  export type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
22
- export declare enum TransactionStatus {
23
- SUCCESS = "success",
24
- NEEDS_GAS = "needs_gas",
25
- ONGOING = "ongoing",
26
- PARTIAL_SUCCESS = "partial_success",
27
- NOT_FOUND = "not_found",
28
- INITIAL_LOADING = "initialLoading",
29
- ERROR = "error",
30
- WARNING = "warning",
31
- PENDING = "pending",
32
- REJECTED = "rejected"
33
- }
@@ -1 +1,2 @@
1
1
  export type { SquidTheme } from './config';
2
+ export type { SwapState, ThemeType, SwapStep } from './components';