@lifi/widget 1.22.1 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
  2. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  3. package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -2
  4. package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
  5. package/cjs/components/StepActions/StepActions.js +2 -2
  6. package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
  7. package/cjs/components/SwapInput/SwapInput.js +1 -1
  8. package/cjs/components/SwapRouteCard/SwapRouteCard.js +2 -1
  9. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
  10. package/cjs/components/Token/Token.d.ts +5 -2
  11. package/cjs/components/Token/Token.js +11 -7
  12. package/cjs/components/Token/Token.style.d.ts +1 -0
  13. package/cjs/components/Token/Token.style.js +3 -3
  14. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +3 -0
  15. package/cjs/components/TokenAvatar/TokenAvatar.js +6 -1
  16. package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
  17. package/cjs/components/TokenAvatar/TokenAvatar.style.js +14 -1
  18. package/cjs/components/TokenList/TokenList.style.d.ts +7 -1
  19. package/cjs/config/version.d.ts +1 -1
  20. package/cjs/config/version.js +1 -1
  21. package/cjs/hooks/useGasSufficiency.js +0 -2
  22. package/cjs/hooks/useSwapRoutes.js +0 -1
  23. package/cjs/hooks/useTokenBalance.js +0 -1
  24. package/cjs/hooks/useTokenBalances.js +0 -1
  25. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
  26. package/cjs/pages/SwapPage/StatusBottomSheet.js +1 -1
  27. package/cjs/pages/SwapPage/SwapPage.js +6 -4
  28. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
  29. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  30. package/components/SelectTokenButton/SelectTokenButton.js +2 -3
  31. package/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
  32. package/components/StepActions/StepActions.js +2 -2
  33. package/components/SwapInput/FormPriceHelperText.js +1 -1
  34. package/components/SwapInput/SwapInput.js +2 -2
  35. package/components/SwapRouteCard/SwapRouteCard.js +2 -1
  36. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
  37. package/components/Token/Token.d.ts +5 -2
  38. package/components/Token/Token.js +14 -10
  39. package/components/Token/Token.style.d.ts +1 -0
  40. package/components/Token/Token.style.js +3 -3
  41. package/components/TokenAvatar/TokenAvatar.d.ts +3 -0
  42. package/components/TokenAvatar/TokenAvatar.js +4 -0
  43. package/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
  44. package/components/TokenAvatar/TokenAvatar.style.js +14 -1
  45. package/components/TokenList/TokenList.style.d.ts +7 -1
  46. package/config/version.d.ts +1 -1
  47. package/config/version.js +1 -1
  48. package/hooks/useGasSufficiency.js +0 -2
  49. package/hooks/useSwapRoutes.js +0 -1
  50. package/hooks/useTokenBalance.js +0 -1
  51. package/hooks/useTokenBalances.js +0 -1
  52. package/package.json +7 -7
  53. package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
  54. package/pages/SwapPage/StatusBottomSheet.js +1 -1
  55. package/pages/SwapPage/SwapPage.js +6 -4
  56. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -40,12 +40,12 @@ export const StepActions = (_a) => {
40
40
  : step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
41
41
  };
42
42
  export const StepDetailsContent = ({ step }) => {
43
- var _a, _b;
43
+ var _a, _b, _c, _d, _e;
44
44
  const { t } = useTranslation();
45
45
  return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
46
46
  value: formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals),
47
47
  }), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
48
- value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, step.action.toToken.decimals),
48
+ value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
49
49
  }), ' ', step.action.toToken.symbol] })));
50
50
  };
51
51
  export const CrossStepDetailsLabel = ({ step }) => {
@@ -16,7 +16,7 @@ export const FormPriceHelperText = ({ formType, selected }) => {
16
16
  });
17
17
  const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
18
18
  const fromAmountTokenPrice = formatTokenPrice(amount, token === null || token === void 0 ? void 0 : token.priceUSD);
19
- return (_jsxs(FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [_jsx(Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: selected ? 8 : 2, lineHeight: 1.3334, flex: 1, sx: {
19
+ return (_jsxs(FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [_jsx(Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: 8, lineHeight: 1.3334, flex: 1, sx: {
20
20
  wordBreak: 'break-word',
21
21
  overflowWrap: 'break-word',
22
22
  } }, { children: t(`format.currency`, {
@@ -7,7 +7,7 @@ import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
7
7
  import { DisabledUI } from '../../types';
8
8
  import { fitInputText, formatAmount } from '../../utils';
9
9
  import { Card, CardTitle } from '../Card';
10
- import { TokenAvatar } from '../TokenAvatar';
10
+ import { TokenAvatar, TokenAvatarSkeleton } from '../TokenAvatar';
11
11
  import { FormPriceHelperText } from './FormPriceHelperText';
12
12
  import { FormControl, Input, maxInputFontSize, minInputFontSize, } from './SwapInput.style';
13
13
  import { SwapInputAdornment } from './SwapInputAdornment';
@@ -43,7 +43,7 @@ export const SwapInput = ({ formType }) => {
43
43
  fitInputText(maxInputFontSize, minInputFontSize, ref.current);
44
44
  }, [amount]);
45
45
  const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromAmount);
46
- return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : null, endAdornment: !disabled ? _jsx(SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
46
+ return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : (_jsx(TokenAvatarSkeleton, { sx: { marginLeft: 2 } })), endAdornment: !disabled ? _jsx(SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
47
47
  inputMode: 'decimal',
48
48
  }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, disabled: disabled, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
49
49
  };
@@ -34,7 +34,8 @@ export const SwapRouteCard = (_a) => {
34
34
  e.stopPropagation();
35
35
  setCardExpanded((expanded) => !expanded);
36
36
  };
37
- return (_jsxs(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] }))) : null, _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
37
+ const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] }))) : null, _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
38
+ return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: cardContent })));
38
39
  };
39
40
  export const SwapRouteCardEssentials = ({ route, dense }) => {
40
41
  var _a;
@@ -16,5 +16,6 @@ import { Card } from '../Card';
16
16
  export const SwapRouteCardSkeleton = (_a) => {
17
17
  var { variant } = _a, other = __rest(_a, ["variant"]);
18
18
  const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
19
- return (_jsxs(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, _jsxs(Box, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
19
+ const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, _jsxs(Box, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
20
+ return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: cardContent })));
20
21
  };
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { Step, TokenAmount } from '@lifi/sdk';
3
3
  import type { BoxProps } from '@mui/material';
4
- export declare const Token: React.FC<{
4
+ interface TokenProps {
5
5
  token: TokenAmount;
6
6
  connected?: boolean;
7
7
  step?: Step;
8
- } & BoxProps>;
8
+ disableDescription?: boolean;
9
+ }
10
+ export declare const Token: React.FC<TokenProps & BoxProps>;
11
+ export {};
@@ -9,28 +9,32 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { Box, Typography } from '@mui/material';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Box } from '@mui/material';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useChain } from '../../hooks';
16
- import { formatTokenAmount } from '../../utils';
16
+ import { formatTokenAmount, formatTokenPrice } from '../../utils';
17
17
  import { SmallAvatar } from '../SmallAvatar';
18
18
  import { TextFitter } from '../TextFitter';
19
19
  import { TokenAvatar } from '../TokenAvatar';
20
20
  import { TextSecondary, TextSecondaryContainer } from './Token.style';
21
21
  export const Token = (_a) => {
22
- var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
22
+ var { token, connected, step, disableDescription } = _a, other = __rest(_a, ["token", "connected", "step", "disableDescription"]);
23
23
  const { t } = useTranslation();
24
24
  const { chain } = useChain(token.chainId);
25
+ const formattedTokenAmount = formatTokenAmount(token.amount, token.decimals);
26
+ const formattedTokenPrice = formatTokenPrice(formattedTokenAmount, token.priceUSD);
25
27
  return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
26
28
  fontWeight: 700,
27
29
  } }, { children: t('format.number', {
28
- value: formatTokenAmount(token.amount, token.decimals),
29
- }) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
30
+ value: formattedTokenAmount,
31
+ }) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`format.currency`, {
32
+ value: formattedTokenPrice,
33
+ }) })), !disableDescription ? (_jsx(TextSecondary, Object.assign({ connected: connected, px: 0.5, dot: true }, { children: "\u2022" }))) : null, !step && !disableDescription ? (_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
30
34
  tokenSymbol: token.symbol,
31
35
  chainName: chain === null || chain === void 0 ? void 0 : chain.name,
32
- }) })), step ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), _jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
33
- border: 0,
34
- marginBottom: -0.25,
35
- } }, { children: step.toolDetails.name[0] })) })), _jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))] })) : null] }))] })));
36
+ }) }))) : null, step ? (_jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
37
+ border: 0,
38
+ marginBottom: -0.25,
39
+ } }, { children: step.toolDetails.name[0] })) })), _jsx(TextSecondary, Object.assign({ connected: true }, { children: step.toolDetails.name }))] }))) : null] }))] })));
36
40
  };
@@ -23,6 +23,7 @@ export declare const TextSecondary: import("@emotion/styled").StyledComponent<im
23
23
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
24
24
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
25
25
  connected?: boolean | undefined;
26
+ dot?: boolean | undefined;
26
27
  }, {}, {}>;
27
28
  export declare const TokenDivider: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
28
29
  children?: import("react").ReactNode;
@@ -19,12 +19,12 @@ export const TextSecondaryContainer = styled(Box, {
19
19
  flexWrap: 'wrap',
20
20
  }));
21
21
  export const TextSecondary = styled(Typography, {
22
- shouldForwardProp: (prop) => prop !== 'connected',
23
- })(({ theme, connected }) => ({
22
+ shouldForwardProp: (prop) => !['connected', 'dot'].includes(prop),
23
+ })(({ theme, connected, dot }) => ({
24
24
  fontSize: 12,
25
25
  lineHeight: 1,
26
26
  fontWeight: 500,
27
- color: theme.palette.text.secondary,
27
+ color: dot ? theme.palette.grey[400] : theme.palette.text.secondary,
28
28
  marginTop: connected ? 0 : theme.spacing(0.5),
29
29
  }));
30
30
  export const TokenDivider = styled(Box)(({ theme }) => ({
@@ -15,3 +15,6 @@ export declare const TokenAvatar: React.FC<{
15
15
  chain?: Chain;
16
16
  sx?: SxProps<Theme>;
17
17
  }>;
18
+ export declare const TokenAvatarSkeleton: React.FC<{
19
+ sx?: SxProps<Theme>;
20
+ }>;
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Avatar, Badge } from '@mui/material';
3
3
  import { useChain, useToken } from '../../hooks';
4
4
  import { SmallAvatar } from '../SmallAvatar';
5
+ import { AvatarSkeleton, AvatarSkeletonContainer } from './TokenAvatar.style';
5
6
  export const TokenAvatarFallback = ({ token, sx }) => {
6
7
  const { chain } = useChain(token.chainId);
7
8
  const { token: chainToken } = useToken(token.chainId, token.address);
@@ -16,3 +17,6 @@ export const TokenAvatar = ({ token, chain, sx }) => {
16
17
  }
17
18
  return _jsx(TokenAvatarBase, { token: token, chain: chain, sx: sx });
18
19
  };
20
+ export const TokenAvatarSkeleton = ({ sx }) => {
21
+ return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(AvatarSkeleton, { width: 16, height: 16 }), sx: sx }, { children: _jsx(AvatarSkeletonContainer, { children: _jsx(AvatarSkeleton, { width: 28, height: 28 }) }) })));
22
+ };
@@ -1 +1,18 @@
1
+ /// <reference types="react" />
1
2
  export declare const TokenAvatarGroup: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
3
+ export declare const AvatarSkeleton: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
4
+ children?: import("react").ReactNode;
5
+ component?: import("react").ElementType<any> | undefined;
6
+ ref?: import("react").Ref<unknown> | undefined;
7
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
9
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
10
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
11
+ export declare const AvatarSkeletonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
12
+ children?: import("react").ReactNode;
13
+ component?: import("react").ElementType<any> | undefined;
14
+ ref?: import("react").Ref<unknown> | undefined;
15
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
16
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
17
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
18
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,4 +1,4 @@
1
- import { AvatarGroup } from '@mui/material';
1
+ import { AvatarGroup, Box } from '@mui/material';
2
2
  import { avatarClasses } from '@mui/material/Avatar';
3
3
  import { badgeClasses } from '@mui/material/Badge';
4
4
  import { styled } from '@mui/material/styles';
@@ -11,3 +11,16 @@ export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
11
11
  marginLeft: theme.spacing(1),
12
12
  },
13
13
  }));
14
+ export const AvatarSkeleton = styled(Box)(({ theme }) => ({
15
+ background: theme.palette.mode === 'light'
16
+ ? theme.palette.grey[300]
17
+ : theme.palette.grey[800],
18
+ border: `2px solid ${theme.palette.background.paper}`,
19
+ borderRadius: '50%',
20
+ }));
21
+ export const AvatarSkeletonContainer = styled(Box)(({ theme }) => ({
22
+ border: `2px solid ${theme.palette.mode === 'light'
23
+ ? theme.palette.grey[300]
24
+ : theme.palette.grey[800]}`,
25
+ borderRadius: '50%',
26
+ }));
@@ -27,6 +27,12 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
27
27
  componentsProps?: {
28
28
  root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
29
29
  } | undefined;
30
+ slotProps?: {
31
+ root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
32
+ } | undefined;
33
+ slots?: {
34
+ root?: import("react").ElementType<any> | undefined;
35
+ } | undefined;
30
36
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
31
37
  ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
32
- }, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
38
+ }, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "slotProps" | "slots" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.22.1";
2
+ export declare const version = "1.23.0";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.22.1';
2
+ export const version = '1.23.0';
@@ -69,7 +69,6 @@ export const useGasSufficiency = (route) => {
69
69
  return gasCostResult;
70
70
  }), {
71
71
  enabled: Boolean(account.address && route),
72
- refetchIntervalInBackground: true,
73
72
  refetchInterval,
74
73
  staleTime: refetchInterval,
75
74
  cacheTime: refetchInterval,
@@ -99,7 +98,6 @@ export const useGasSufficiency = (route) => {
99
98
  return insufficientFunds;
100
99
  }), {
101
100
  enabled: Boolean(account.address && route && fromToken),
102
- refetchIntervalInBackground: true,
103
101
  refetchInterval,
104
102
  staleTime: refetchInterval,
105
103
  cacheTime: refetchInterval,
@@ -101,7 +101,6 @@ export const useSwapRoutes = () => {
101
101
  }, { signal });
102
102
  }), {
103
103
  enabled: isEnabled,
104
- refetchIntervalInBackground: true,
105
104
  refetchInterval,
106
105
  staleTime: refetchTime,
107
106
  cacheTime: refetchTime,
@@ -70,7 +70,6 @@ export const useTokenBalance = (token, accountAddress) => {
70
70
  return Object.assign(Object.assign({}, tokenBalances[0]), { amount: formattedAmount });
71
71
  }), {
72
72
  enabled: Boolean(walletAddress && token),
73
- refetchIntervalInBackground: true,
74
73
  refetchInterval: defaultRefetchInterval,
75
74
  staleTime: defaultRefetchInterval,
76
75
  });
@@ -59,7 +59,6 @@ export const useTokenBalances = (selectedChainId) => {
59
59
  return result;
60
60
  }), {
61
61
  enabled: isBalanceLoadingEnabled,
62
- refetchIntervalInBackground: true,
63
62
  refetchInterval,
64
63
  staleTime: refetchInterval,
65
64
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.22.1",
3
+ "version": "1.23.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -45,13 +45,13 @@
45
45
  "@lifi/sdk": "^1.6.3",
46
46
  "@lifi/wallet-management": "^1.1.12",
47
47
  "@mui/icons-material": "^5.10.9",
48
- "@mui/lab": "^5.0.0-alpha.106",
49
- "@mui/material": "^5.10.12",
50
- "@sentry/integrations": "^7.17.4",
51
- "@sentry/react": "^7.17.4",
52
- "@sentry/tracing": "^7.17.4",
48
+ "@mui/lab": "^5.0.0-alpha.107",
49
+ "@mui/material": "^5.10.13",
50
+ "@sentry/integrations": "^7.18.0",
51
+ "@sentry/react": "^7.18.0",
52
+ "@sentry/tracing": "^7.18.0",
53
53
  "@tanstack/react-query": "^4.14.5",
54
- "@tanstack/react-virtual": "^3.0.0-beta.18",
54
+ "@tanstack/react-virtual": "^3.0.0-beta.22",
55
55
  "big.js": "^6.2.1",
56
56
  "i18next": "^22.0.4",
57
57
  "i18next-browser-languagedetector": "^7.0.1",
@@ -53,10 +53,12 @@ export const SwapDetailsPage = () => {
53
53
  }, pb: 1 }, { children: [_jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), _jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
54
54
  timeStyle: 'short',
55
55
  }).format(startedAt) }))] })), routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.map((step, index, steps) => {
56
- var _a, _b;
57
- return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: index === 0
58
- ? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
59
- ? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
56
+ var _a, _b, _c, _d, _e;
57
+ const fromToken = index === 0
58
+ ? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
59
+ const toToken = index === steps.length - 1
60
+ ? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
61
+ return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
60
62
  }), _jsxs(Card, Object.assign({ mt: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
61
63
  display: 'flex',
62
64
  flex: 1,
@@ -76,5 +76,5 @@ export const StatusBottomSheet = ({ status, route, }) => {
76
76
  (_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
77
77
  }
78
78
  }, [refetch, refetchNewBalance, status]);
79
- return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
79
+ return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1, disableDescription: true })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
80
80
  };
@@ -68,10 +68,12 @@ export const SwapPage = () => {
68
68
  }
69
69
  };
70
70
  return (_jsxs(Container, { children: [route === null || route === void 0 ? void 0 : route.steps.map((step, index, steps) => {
71
- var _a, _b;
72
- return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: index === 0
73
- ? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
74
- ? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
71
+ var _a, _b, _c, _d, _e;
72
+ const fromToken = index === 0
73
+ ? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
74
+ const toToken = index === steps.length - 1
75
+ ? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
76
+ return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
75
77
  }), status === 'idle' || status === 'error' ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, Object.assign({ mt: 2, display: "flex" }, { children: [_jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route,
76
78
  // disable={status === 'idle' && (isValidating || !isValid)}
77
79
  enableLoading: true }), status === 'error' ? (_jsx(Tooltip, Object.assign({ title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ onClick: handleRemoveRoute, sx: {