@lifi/widget 2.5.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/cjs/AppDrawer.style.d.ts +1 -1
  3. package/cjs/components/BaseTransactionButton/BaseTransactionButton.d.ts +3 -0
  4. package/cjs/components/{DefaultTransactionButton/DefaultTransactionButton.js → BaseTransactionButton/BaseTransactionButton.js} +3 -3
  5. package/cjs/components/BaseTransactionButton/index.d.ts +2 -0
  6. package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/index.js +3 -3
  7. package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/types.d.ts +1 -1
  8. package/cjs/components/Card/CardLabel.d.ts +1 -1
  9. package/cjs/components/Card/CardTitle.d.ts +1 -1
  10. package/cjs/components/RouteCard/RouteCard.style.d.ts +1 -1
  11. package/cjs/components/Step/CircularProgress.style.js +33 -31
  12. package/cjs/components/Token/Token.style.d.ts +1 -1
  13. package/cjs/config/theme.js +9 -9
  14. package/cjs/config/version.d.ts +1 -1
  15. package/cjs/config/version.js +1 -1
  16. package/cjs/hooks/useNavigateBack.js +2 -0
  17. package/cjs/i18n/de.json +2 -1
  18. package/cjs/i18n/fr.json +2 -1
  19. package/cjs/i18n/zh.json +2 -1
  20. package/cjs/pages/MainPage/ReviewButton.js +2 -2
  21. package/cjs/pages/TransactionPage/StartTransactionButton.js +2 -2
  22. package/cjs/pages/TransactionPage/TransactionPage.js +7 -0
  23. package/cjs/pages/TransactionPage/types.d.ts +2 -2
  24. package/cjs/types/events.d.ts +3 -1
  25. package/cjs/types/events.js +1 -0
  26. package/components/BaseTransactionButton/BaseTransactionButton.d.ts +3 -0
  27. package/components/{DefaultTransactionButton/DefaultTransactionButton.js → BaseTransactionButton/BaseTransactionButton.js} +1 -1
  28. package/components/BaseTransactionButton/index.d.ts +2 -0
  29. package/components/BaseTransactionButton/index.js +2 -0
  30. package/components/{DefaultTransactionButton → BaseTransactionButton}/types.d.ts +1 -1
  31. package/components/Card/CardLabel.d.ts +1 -1
  32. package/components/Card/CardTitle.d.ts +1 -1
  33. package/components/RouteCard/RouteCard.style.d.ts +1 -1
  34. package/components/Step/CircularProgress.style.js +33 -31
  35. package/components/Token/Token.style.d.ts +1 -1
  36. package/config/theme.js +10 -10
  37. package/config/version.d.ts +1 -1
  38. package/config/version.js +1 -1
  39. package/hooks/useNavigateBack.js +2 -0
  40. package/i18n/de.json +2 -1
  41. package/i18n/fr.json +2 -1
  42. package/i18n/zh.json +2 -1
  43. package/package.json +9 -9
  44. package/pages/MainPage/ReviewButton.js +2 -2
  45. package/pages/TransactionPage/StartTransactionButton.js +2 -2
  46. package/pages/TransactionPage/TransactionPage.js +7 -0
  47. package/pages/TransactionPage/types.d.ts +2 -2
  48. package/tsconfig.cjs.tsbuildinfo +1 -1
  49. package/types/events.d.ts +3 -1
  50. package/types/events.js +1 -0
  51. package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +0 -3
  52. package/cjs/components/DefaultTransactionButton/index.d.ts +0 -2
  53. package/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +0 -3
  54. package/components/DefaultTransactionButton/index.d.ts +0 -2
  55. package/components/DefaultTransactionButton/index.js +0 -2
  56. /package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/types.js +0 -0
  57. /package/components/{DefaultTransactionButton → BaseTransactionButton}/types.js +0 -0
@@ -6,7 +6,7 @@ export declare const TextSecondaryContainer: import("@emotion/styled").StyledCom
6
6
  }, {}, {}>;
7
7
  export declare const TextSecondary: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
8
8
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
9
- }, "className" | "style" | "classes" | "children" | "sx" | "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" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
9
+ }, "className" | "style" | "classes" | "children" | "sx" | "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" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "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" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
10
  connected?: boolean | undefined;
11
11
  dot?: boolean | undefined;
12
12
  }, {}, {}>;
package/config/theme.js CHANGED
@@ -2,7 +2,7 @@ import { loadingButtonClasses } from '@mui/lab/LoadingButton';
2
2
  import { touchRippleClasses } from '@mui/material/ButtonBase';
3
3
  import { dialogActionsClasses } from '@mui/material/DialogActions';
4
4
  import { common } from '@mui/material/colors';
5
- import { alpha, createTheme as createMuiTheme, darken, getContrastRatio, keyframes, lighten, } from '@mui/material/styles';
5
+ import { alpha, createTheme as createMuiTheme, css, darken, getContrastRatio, keyframes, lighten, } from '@mui/material/styles';
6
6
  const palette = {
7
7
  primary: {
8
8
  main: '#3F49E1',
@@ -117,15 +117,15 @@ export const createTheme = (mode, theme = {}) => {
117
117
  },
118
118
  MuiButtonBase: {
119
119
  styleOverrides: {
120
- root: {
121
- [`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
122
- animationName: `${enterKeyframe}`,
123
- },
124
- [`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
125
- opacity: 0.1,
126
- animationName: `${enterKeyframe}`,
127
- },
128
- },
120
+ // This `css()` function invokes keyframes. `styled-components` only supports keyframes
121
+ // in string templates. Do not convert these styles in JS object as it will break.
122
+ root: css `
123
+ &
124
+ .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible} {
125
+ opacity: 0.1;
126
+ animation-name: ${enterKeyframe};
127
+ }
128
+ `,
129
129
  },
130
130
  },
131
131
  MuiButton: {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "2.5.1";
2
+ export declare const version = "2.6.1";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '2.5.1';
2
+ export const version = '2.6.1';
@@ -3,7 +3,9 @@ import { useNavigate } from 'react-router-dom';
3
3
  export const useNavigateBack = () => {
4
4
  const navigate = useNavigate();
5
5
  const navigateBack = useCallback(() => {
6
+ // TODO: find a better router with nested memory routers support
6
7
  // https://github.com/remix-run/react-router/pull/9112
8
+ // https://github.com/remix-run/react-router/discussions/9601
7
9
  //
8
10
  // if (window.history.length > 2) {
9
11
  navigate(-1);
package/i18n/de.json CHANGED
@@ -255,7 +255,8 @@
255
255
  },
256
256
  "routePriority": "Routenpriorität",
257
257
  "showDestinationWallet": "Ziel Wallet anzeigen",
258
- "slippage": "Slippage"
258
+ "slippage": "Slippage",
259
+ "resetSettings": "Sie verwenden benutzerdefinierte Einstellungen, die die Anzahl der verfügbaren Routen begrenzen."
259
260
  },
260
261
  "wallet": {
261
262
  "extensionNotFound": "Bitte stellen Sie sicher, dass nur die Browsererweiterung {{name}} aktiv ist, bevor Sie dieses Wallet auswählen."
package/i18n/fr.json CHANGED
@@ -255,7 +255,8 @@
255
255
  },
256
256
  "routePriority": "Priorité de l'itinéraire",
257
257
  "showDestinationWallet": "Afficher le portefeuille de destination",
258
- "slippage": "Effet de glissement"
258
+ "slippage": "Effet de glissement",
259
+ "resetSettings": "Vous utilisez des paramètres personnalisés limitant le nombre de routes disponibles."
259
260
  },
260
261
  "wallet": {
261
262
  "extensionNotFound": "Veuillez vous assurer que seule l'extension de navigateur {{name}} est active avant de choisir ce portefeuille."
package/i18n/zh.json CHANGED
@@ -255,7 +255,8 @@
255
255
  },
256
256
  "routePriority": "路由优先级",
257
257
  "showDestinationWallet": "显示收款钱包",
258
- "slippage": "滑点"
258
+ "slippage": "滑点",
259
+ "resetSettings": "您正在使用自定义设置过滤可用路由。"
259
260
  },
260
261
  "wallet": {
261
262
  "extensionNotFound": "在选择钱包之前,请确保只有{{name}} 浏览器的扩展应用处于激活状态。"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "2.5.1",
3
+ "version": "2.6.1",
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",
@@ -43,13 +43,13 @@
43
43
  "@ethersproject/address": "^5.7.0",
44
44
  "@ethersproject/experimental": "^5.7.0",
45
45
  "@ethersproject/providers": "^5.7.2",
46
- "@lifi/sdk": "^2.4.1",
47
- "@lifi/wallet-management": "^2.3.6",
48
- "@mui/icons-material": "^5.14.11",
49
- "@mui/lab": "^5.0.0-alpha.146",
50
- "@mui/material": "^5.14.11",
51
- "@tanstack/react-query": "^4.35.7",
52
- "@tanstack/react-virtual": "^3.0.0-beta.61",
46
+ "@lifi/sdk": "^2.4.3",
47
+ "@lifi/wallet-management": "^2.3.7",
48
+ "@mui/icons-material": "^5.14.13",
49
+ "@mui/lab": "^5.0.0-alpha.148",
50
+ "@mui/material": "^5.14.13",
51
+ "@tanstack/react-query": "^4.36.1",
52
+ "@tanstack/react-virtual": "^3.0.0-beta.65",
53
53
  "big.js": "^6.2.1",
54
54
  "i18next": "^23.5.1",
55
55
  "i18next-browser-languagedetector": "^7.1.0",
@@ -63,7 +63,7 @@
63
63
  "react-router-dom": "^6.16.0",
64
64
  "react-timer-hook": "^3.0.7",
65
65
  "uuid": "^9.0.1",
66
- "zustand": "^4.4.2"
66
+ "zustand": "^4.4.3"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@types/react": "^18.0.0",
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useFormState } from 'react-hook-form';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useNavigate } from 'react-router-dom';
5
- import { DefaultTransactionButton } from '../../components/DefaultTransactionButton';
5
+ import { BaseTransactionButton } from '../../components/BaseTransactionButton';
6
6
  import { useRoutes } from '../../hooks';
7
7
  import { useWidgetConfig } from '../../providers';
8
8
  import { useSetExecutableRoute, useSplitSubvariantStore } from '../../stores';
@@ -54,5 +54,5 @@ export const ReviewButton = () => {
54
54
  }
55
55
  }
56
56
  };
57
- return (_jsx(DefaultTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
57
+ return (_jsx(BaseTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
58
58
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { DefaultTransactionButton } from '../../components/DefaultTransactionButton';
2
+ import { BaseTransactionButton } from '../../components/BaseTransactionButton';
3
3
  import { useFromTokenSufficiency, useGasSufficiency, useRoutes, } from '../../hooks';
4
4
  import { useWidgetConfig } from '../../providers';
5
5
  import { useRouteExecutionStore } from '../../stores';
@@ -9,7 +9,7 @@ export const StartTransactionButton = ({ onClick, route, text, loading, }) => {
9
9
  const { insufficientGas, isInitialLoading: isGasSufficiencyLoading } = useGasSufficiency(route);
10
10
  const { insufficientFromToken, isInitialLoading: isFromTokenSufficiencyLoading, } = useFromTokenSufficiency(route);
11
11
  const shouldDisableButton = !isMultisigSigner && (insufficientFromToken || !!insufficientGas?.length);
12
- return (_jsx(DefaultTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
12
+ return (_jsx(BaseTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
13
13
  };
14
14
  export const StartInsurableTransactionButton = ({ onClick, text, route, loading, disabled, insurableRouteId }) => {
15
15
  const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
@@ -49,6 +49,13 @@ export const TransactionPage = () => {
49
49
  : t(`header.${transactionType.toLowerCase()}`));
50
50
  }
51
51
  }, [headerStoreContext, route, status, subvariant, t]);
52
+ useEffect(() => {
53
+ if (status === RouteExecutionStatus.Idle) {
54
+ emitter.emit(WidgetEvent.ReviewTransactionPageEntered, route);
55
+ }
56
+ // We want to emit event only when the page is mounted
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ }, []);
52
59
  if (!route) {
53
60
  return null;
54
61
  }
@@ -1,6 +1,6 @@
1
1
  import type { Route } from '@lifi/sdk';
2
- import type { DefaultTransactionButtonProps } from '../../components/DefaultTransactionButton';
3
- export interface StartTransactionButtonProps extends DefaultTransactionButtonProps {
2
+ import type { BaseTransactionButtonProps } from '../../components/BaseTransactionButton';
3
+ export interface StartTransactionButtonProps extends BaseTransactionButtonProps {
4
4
  route?: Route;
5
5
  insurableRouteId: string;
6
6
  }