@lifi/widget 2.0.0-beta.3 → 2.0.0-beta.5

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 (137) hide show
  1. package/README.md +11 -12
  2. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  3. package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
  4. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
  5. package/cjs/components/Header/NavigationHeader.js +18 -5
  6. package/cjs/components/Insurance/InsuranceCard.js +10 -5
  7. package/cjs/components/Insurance/InsuranceCollapsed.js +1 -1
  8. package/cjs/components/Insurance/types.d.ts +1 -2
  9. package/cjs/components/NFT/NFT.js +2 -2
  10. package/cjs/components/NFT/types.d.ts +1 -1
  11. package/cjs/components/PoweredBy/PoweredBy.js +2 -3
  12. package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -1
  13. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  14. package/cjs/components/Step/Step.js +14 -4
  15. package/cjs/components/Step/StepList.d.ts +0 -1
  16. package/cjs/components/StepActions/StepActions.js +2 -19
  17. package/cjs/components/SwapButton/SwapButton.js +16 -4
  18. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  19. package/cjs/components/SwapRouteCard/SwapRouteCard.js +15 -3
  20. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  21. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  22. package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
  23. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  24. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  25. package/cjs/components/Token/Token.js +1 -1
  26. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  27. package/cjs/components/TokenList/TokenList.js +4 -2
  28. package/cjs/components/TokenList/types.d.ts +2 -3
  29. package/cjs/config/theme.js +14 -1
  30. package/cjs/config/version.d.ts +1 -1
  31. package/cjs/config/version.js +1 -1
  32. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  33. package/cjs/hooks/useProcessMessage.d.ts +2 -1
  34. package/cjs/hooks/useProcessMessage.js +23 -9
  35. package/cjs/hooks/useSwapRoutes.js +24 -11
  36. package/cjs/hooks/useToken.d.ts +1 -1
  37. package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
  38. package/cjs/hooks/useTokenBalances.d.ts +5 -5
  39. package/cjs/hooks/useTokenBalances.js +3 -14
  40. package/cjs/hooks/useTokenSearch.d.ts +2 -2
  41. package/cjs/hooks/useTokens.d.ts +2 -2
  42. package/cjs/i18n/bn.json +8 -0
  43. package/cjs/i18n/en.json +17 -2
  44. package/cjs/i18n/fr.json +8 -0
  45. package/cjs/i18n/id.json +22 -7
  46. package/cjs/i18n/ko.json +22 -7
  47. package/cjs/i18n/pt.json +8 -0
  48. package/cjs/i18n/th.json +21 -6
  49. package/cjs/i18n/uk.json +20 -12
  50. package/cjs/i18n/zh.json +8 -0
  51. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  52. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  53. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  54. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  55. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  56. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  57. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  58. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
  59. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
  60. package/cjs/pages/SwapPage/StatusBottomSheet.js +9 -3
  61. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  62. package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
  63. package/cjs/pages/SwapPage/SwapPage.js +16 -7
  64. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  65. package/cjs/providers/WalletProvider/types.d.ts +2 -2
  66. package/cjs/types/token.d.ts +2 -2
  67. package/cjs/types/widget.d.ts +7 -6
  68. package/cjs/types/widget.js +1 -0
  69. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  70. package/components/ChainSelect/ChainSelect.style.js +1 -1
  71. package/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
  72. package/components/Header/NavigationHeader.js +18 -5
  73. package/components/Insurance/InsuranceCard.js +10 -5
  74. package/components/Insurance/InsuranceCollapsed.js +1 -1
  75. package/components/Insurance/types.d.ts +1 -2
  76. package/components/NFT/NFT.js +2 -2
  77. package/components/NFT/types.d.ts +1 -1
  78. package/components/PoweredBy/PoweredBy.js +2 -3
  79. package/components/SelectTokenButton/SelectTokenButton.js +1 -1
  80. package/components/Step/CircularProgress.d.ts +0 -1
  81. package/components/Step/Step.js +14 -4
  82. package/components/Step/StepList.d.ts +0 -1
  83. package/components/StepActions/StepActions.js +2 -19
  84. package/components/SwapButton/SwapButton.js +16 -4
  85. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  86. package/components/SwapRouteCard/SwapRouteCard.js +17 -5
  87. package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  88. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  89. package/components/SwapRoutes/SwapRoutes.js +1 -1
  90. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  91. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  92. package/components/Token/Token.js +1 -1
  93. package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  94. package/components/TokenList/TokenList.js +4 -2
  95. package/components/TokenList/types.d.ts +2 -3
  96. package/config/theme.js +14 -1
  97. package/config/version.d.ts +1 -1
  98. package/config/version.js +1 -1
  99. package/hooks/useFeaturedTokens.d.ts +1 -1
  100. package/hooks/useProcessMessage.d.ts +2 -1
  101. package/hooks/useProcessMessage.js +23 -9
  102. package/hooks/useSwapRoutes.js +24 -11
  103. package/hooks/useToken.d.ts +1 -1
  104. package/hooks/useTokenAddressBalance.d.ts +2 -2
  105. package/hooks/useTokenBalances.d.ts +5 -5
  106. package/hooks/useTokenBalances.js +3 -14
  107. package/hooks/useTokenSearch.d.ts +2 -2
  108. package/hooks/useTokens.d.ts +2 -2
  109. package/i18n/bn.json +8 -0
  110. package/i18n/en.json +17 -2
  111. package/i18n/fr.json +8 -0
  112. package/i18n/id.json +22 -7
  113. package/i18n/ko.json +22 -7
  114. package/i18n/pt.json +8 -0
  115. package/i18n/th.json +21 -6
  116. package/i18n/uk.json +20 -12
  117. package/i18n/zh.json +8 -0
  118. package/package.json +9 -9
  119. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  120. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  121. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  122. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  123. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  124. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  125. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  126. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
  127. package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  128. package/pages/SwapPage/StatusBottomSheet.js +11 -5
  129. package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  130. package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
  131. package/pages/SwapPage/SwapPage.js +16 -7
  132. package/pages/SwapPage/TokenValueBottomSheet.js +2 -2
  133. package/providers/WalletProvider/types.d.ts +2 -2
  134. package/tsconfig.cjs.tsbuildinfo +1 -1
  135. package/types/token.d.ts +2 -2
  136. package/types/widget.d.ts +7 -6
  137. package/types/widget.js +1 -0
package/README.md CHANGED
@@ -54,21 +54,20 @@ yarn add @lifi/wallet-management
54
54
 
55
55
  Here is an example of a basic app using LI.FI Widget:
56
56
 
57
- ```jsx
57
+ ```tsx
58
58
  import { LiFiWidget, WidgetConfig } from '@lifi/widget';
59
- import { useMemo } from 'react';
59
+
60
+ const widgetConfig: WidgetConfig = {
61
+ containerStyle: {
62
+ border: '1px solid rgb(234, 234, 234)',
63
+ borderRadius: '16px',
64
+ },
65
+ };
60
66
 
61
67
  export const WidgetPage = () => {
62
- const widgetConfig: WidgetConfig = useMemo(() => {
63
- return {
64
- containerStyle: {
65
- border: '1px solid rgb(234, 234, 234)',
66
- borderRadius: '16px',
67
- },
68
- };
69
- }, []);
70
-
71
- return <LiFiWidget config={widgetConfig} />;
68
+ return (
69
+ <LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
70
+ );
72
71
  };
73
72
  ```
74
73
 
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SwapFormTypeProps } from '../../providers';
3
2
  export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -12,7 +12,7 @@ exports.ChainCard = (0, styles_1.styled)(Card_1.Card)({
12
12
  });
13
13
  exports.ChainContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
14
14
  display: 'grid',
15
- gridTemplateColumns: 'repeat(5, 1fr)',
15
+ gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
16
16
  gridAutoRows: '56px',
17
17
  justifyContent: 'space-between',
18
18
  gap: theme.spacing(1.5),
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const FundsSufficiencyMessage: () => JSX.Element;
@@ -10,12 +10,13 @@ const react_i18next_1 = require("react-i18next");
10
10
  const react_router_dom_1 = require("react-router-dom");
11
11
  const hooks_1 = require("../../hooks");
12
12
  const providers_1 = require("../../providers");
13
+ const types_1 = require("../../types");
13
14
  const utils_1 = require("../../utils");
14
15
  const Header_style_1 = require("./Header.style");
15
16
  const useHeaderActionStore_1 = require("./useHeaderActionStore");
16
17
  const NavigationHeader = () => {
17
18
  const { t } = (0, react_i18next_1.useTranslation)();
18
- const { variant } = (0, providers_1.useWidgetConfig)();
19
+ const { variant, hiddenUI } = (0, providers_1.useWidgetConfig)();
19
20
  const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
20
21
  const { account } = (0, providers_1.useWallet)();
21
22
  const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
@@ -37,8 +38,12 @@ const NavigationHeader = () => {
37
38
  return t(`settings.enabledExchanges`);
38
39
  case utils_1.navigationRoutes.swapHistory:
39
40
  return t(`header.swapHistory`);
40
- case utils_1.navigationRoutes.fromToken:
41
+ case utils_1.navigationRoutes.fromToken: {
42
+ if (variant === 'nft') {
43
+ return t(`header.payWith`);
44
+ }
41
45
  return t(`header.from`);
46
+ }
42
47
  case utils_1.navigationRoutes.toToken:
43
48
  return t(`header.to`);
44
49
  case utils_1.navigationRoutes.fromChain:
@@ -49,10 +54,18 @@ const NavigationHeader = () => {
49
54
  return t(`header.routes`);
50
55
  case utils_1.navigationRoutes.activeSwaps:
51
56
  return t(`header.activeSwaps`);
52
- case utils_1.navigationRoutes.swapExecution:
57
+ case utils_1.navigationRoutes.swapExecution: {
58
+ if (variant === 'nft') {
59
+ return t(`header.purchase`);
60
+ }
53
61
  return t(`header.swap`);
54
- case utils_1.navigationRoutes.swapDetails:
62
+ }
63
+ case utils_1.navigationRoutes.swapDetails: {
64
+ if (variant === 'nft') {
65
+ return t(`header.purchaseDetails`);
66
+ }
55
67
  return t(`header.swapDetails`);
68
+ }
56
69
  default: {
57
70
  switch (variant) {
58
71
  case 'nft':
@@ -65,7 +78,7 @@ const NavigationHeader = () => {
65
78
  }
66
79
  }
67
80
  };
68
- return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
81
+ return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive && !hiddenUI?.includes(types_1.HiddenUI.History) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
69
82
  marginRight: -1.25,
70
83
  }, children: (0, jsx_runtime_1.jsx)(Settings_1.default, {}) }) })] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] }));
71
84
  };
@@ -14,21 +14,26 @@ const Card_1 = require("../Card");
14
14
  const Switch_1 = require("../Switch");
15
15
  const InsuranceCard = ({ status, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
16
16
  const { t } = (0, react_i18next_1.useTranslation)();
17
+ const [enabled, setEnabled] = (0, react_1.useState)(false);
17
18
  const [cardExpanded, setCardExpanded] = (0, react_1.useState)(status === stores_1.RouteExecutionStatus.Idle);
18
19
  const handleExpand = (e) => {
19
20
  e.stopPropagation();
20
21
  setCardExpanded((expanded) => !expanded);
21
22
  };
23
+ const handleSwitch = (_, checked) => {
24
+ setEnabled(checked);
25
+ onChange?.(checked);
26
+ };
22
27
  return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { selectionColor: "secondary", indented: true, ...props, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsxs)(Card_1.CardLabel, { type: 'insurance', children: [(0, jsx_runtime_1.jsx)(VerifiedUser_1.default, { fontSize: "inherit" }), (0, jsx_runtime_1.jsx)(Card_1.CardLabelTypography, { type: "icon", children: status === stores_1.RouteExecutionStatus.Idle
23
28
  ? t('swap.tags.insurance')
24
- : t('swap.tags.insured') })] }), status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(Switch_1.Switch, { onChange: onChange })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { my: -0.5, children: (0, jsx_runtime_1.jsx)(Card_1.CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }) }))] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 24, fontWeight: 700, lineHeight: 1, children: t('format.currency', {
29
+ : t('swap.tags.insured') })] }), status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(Switch_1.Switch, { onChange: handleSwitch, value: enabled })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { my: -0.5, children: (0, jsx_runtime_1.jsx)(Card_1.CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }) }))] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 24, fontWeight: 700, lineHeight: 1, children: t('format.currency', {
25
30
  value: feeAmountUsd,
26
31
  }) }), (0, jsx_runtime_1.jsx)(icons_1.InsuraceLogo, {})] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, children: status === stores_1.RouteExecutionStatus.Idle
27
32
  ? t('swap.insurance.insure')
28
- : t('swap.insurance.insured') }), status !== stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
29
- listStyleType: 'disc',
30
- pl: 2,
31
- }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.bridgeExploits') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.slippageError') })] })) : null, (0, jsx_runtime_1.jsx)(material_1.Link, { href: status === stores_1.RouteExecutionStatus.Idle
33
+ : t('swap.insurance.insured') }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: enabled || status !== stores_1.RouteExecutionStatus.Idle, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
34
+ listStyleType: 'disc',
35
+ pl: 2,
36
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.bridgeExploits') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.slippageError') })] }) }), (0, jsx_runtime_1.jsx)(material_1.Link, { href: status === stores_1.RouteExecutionStatus.Idle
32
37
  ? 'https://docs.insurace.io/landing-page/documentation/cover-products/bridge-cover/li.fi'
33
38
  : `https://app.insurace.io/bridge-cover?search=${insuranceCoverageId}`, target: "_blank", underline: "none", color: "text.primary", children: (0, jsx_runtime_1.jsx)(material_1.Typography, { pt: 0.5, color: "primary", fontSize: 14, fontWeight: 600, children: status === stores_1.RouteExecutionStatus.Idle
34
39
  ? t('button.learnMore')
@@ -19,7 +19,7 @@ const InsuranceCollapsed = ({ status, insurableRouteId, insuranceCoverageId, fee
19
19
  }
20
20
  },
21
21
  });
22
- const toggleInsurance = (_, checked) => {
22
+ const toggleInsurance = (checked) => {
23
23
  if (insuredRoute) {
24
24
  if (checked) {
25
25
  setExecutableRoute(insuredRoute, insurableRouteId);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import type { RouteExecutionStatus } from '../../stores';
4
3
  export interface InsuranceProps extends Omit<BoxProps, 'onChange'> {
@@ -12,5 +11,5 @@ export interface InsuranceCardProps {
12
11
  feeAmountUsd?: string;
13
12
  status?: RouteExecutionStatus;
14
13
  insuranceCoverageId?: string;
15
- onChange?: (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
14
+ onChange?: (checked: boolean) => void;
16
15
  }
@@ -9,7 +9,7 @@ const react_i18next_1 = require("react-i18next");
9
9
  const providers_1 = require("../../providers");
10
10
  const Token_1 = require("../Token");
11
11
  const NFT_style_1 = require("./NFT.style");
12
- const NFT = ({ imageUrl, isLoading, collectonName, assetName, owner, token, contract, ...props }) => {
12
+ const NFT = ({ imageUrl, isLoading, collectionName, assetName, owner, token, contract, ...props }) => {
13
13
  const { t } = (0, react_i18next_1.useTranslation)();
14
14
  const { setValue } = (0, react_hook_form_1.useFormContext)();
15
15
  (0, react_1.useEffect)(() => {
@@ -24,6 +24,6 @@ const NFT = ({ imageUrl, isLoading, collectonName, assetName, owner, token, cont
24
24
  setValue(providers_1.SwapFormKey.ToContractGasLimit, contract.gasLimit);
25
25
  }
26
26
  }, [contract, setValue, token]);
27
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", children: [isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 96, height: 96, variant: "rectangular", sx: { borderRadius: 1 } })) : ((0, jsx_runtime_1.jsx)(NFT_style_1.PreviewAvatar, { src: imageUrl })), (0, jsx_runtime_1.jsxs)(material_1.Box, { ml: 2, children: [isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 144, height: 21, variant: "text" })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", children: collectonName })), isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 112, height: 27, variant: "text" })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: 600, children: assetName })), isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 128, height: 21, variant: "text" })) : owner ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 14, color: "text.secondary", children: [t('swap.ownedBy'), ' ', (0, jsx_runtime_1.jsx)(material_1.Link, { href: owner.url, target: "_blank", underline: "none", color: "primary", children: owner.name })] })) : null] })] }), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, isLoading: isLoading, mt: 2 })] }));
27
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", children: [isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 96, height: 96, variant: "rectangular", sx: { borderRadius: 1 } })) : ((0, jsx_runtime_1.jsx)(NFT_style_1.PreviewAvatar, { src: imageUrl })), (0, jsx_runtime_1.jsxs)(material_1.Box, { ml: 2, children: [isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 144, height: 21, variant: "text" })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.secondary", children: collectionName })), isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 112, height: 27, variant: "text" })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: 600, children: assetName })), isLoading ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 128, height: 21, variant: "text" })) : owner ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 14, color: "text.secondary", children: [t('swap.ownedBy'), ' ', (0, jsx_runtime_1.jsx)(material_1.Link, { href: owner.url, target: "_blank", underline: "none", color: "primary", children: owner.name })] })) : null] })] }), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, isLoading: isLoading, mt: 2 })] }));
28
28
  };
29
29
  exports.NFT = NFT;
@@ -2,7 +2,7 @@ import type { TokenAmount } from '@lifi/sdk';
2
2
  import type { WidgetContract } from '../../types';
3
3
  export interface NFTProps {
4
4
  imageUrl?: string;
5
- collectonName?: string;
5
+ collectionName?: string;
6
6
  assetName?: string;
7
7
  isLoading?: boolean;
8
8
  owner?: NFTOwner;
@@ -8,7 +8,6 @@ const version_1 = require("../../config/version");
8
8
  const providers_1 = require("../../providers");
9
9
  const types_1 = require("../../types");
10
10
  const utils_1 = require("../../utils");
11
- const LiFiLogo_1 = require("../LiFiLogo");
12
11
  const PoweredBy_style_1 = require("./PoweredBy.style");
13
12
  const PoweredBy = () => {
14
13
  const { hiddenUI } = (0, providers_1.useWidgetConfig)();
@@ -17,10 +16,10 @@ const PoweredBy = () => {
17
16
  pathname.includes(utils_1.navigationRoutes.toToken)) {
18
17
  return null;
19
18
  }
20
- return ((0, jsx_runtime_1.jsx)(material_1.Box, { px: 3, py: hiddenUI?.includes(types_1.HiddenUI.PoweredBy) ? 1 : 2, sx: {
19
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { px: 3, pt: 1, pb: hiddenUI?.includes(types_1.HiddenUI.PoweredBy) ? 1 : 2, sx: {
21
20
  display: 'flex',
22
21
  alignItems: 'flex-end',
23
22
  justifyContent: 'flex-end',
24
- }, children: !hiddenUI?.includes(types_1.HiddenUI.PoweredBy) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: `v${version_1.version}`, placement: "top", enterDelay: 3000, arrow: true, children: (0, jsx_runtime_1.jsxs)(PoweredBy_style_1.Link, { href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.secondary", fontSize: 12, px: 0.5, children: "Powered by" }), (0, jsx_runtime_1.jsx)(LiFiLogo_1.LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] }) })) : null }));
23
+ }, children: !hiddenUI?.includes(types_1.HiddenUI.PoweredBy) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: `v${version_1.version}`, placement: "top", enterDelay: 1000, arrow: true, children: (0, jsx_runtime_1.jsxs)(PoweredBy_style_1.Link, { href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.secondary", fontSize: 12, fontWeight: 500, px: 0.5, children: "Powered by" }), (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "text.primary", fontSize: 12, fontWeight: 500, children: "LI.FI" })] }) })) : null }));
25
24
  };
26
25
  exports.PoweredBy = PoweredBy;
@@ -35,7 +35,7 @@ const SelectTokenButton = ({ formType, compact }) => {
35
35
  ? t(`header.selectChain`)
36
36
  : t(`swap.selectChainAndToken`);
37
37
  const cardTitle = formType === 'from' && variant === 'nft'
38
- ? t(`swap.payWith`)
38
+ ? t(`header.payWith`)
39
39
  : t(`swap.${formType}`);
40
40
  return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { flex: 1, onClick: onClick, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: cardTitle }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? ((0, jsx_runtime_1.jsx)(SelectTokenButton_style_1.SelectTokenCardHeader, { avatar: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }), title: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 64, height: 24 }), subheader: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : ((0, jsx_runtime_1.jsx)(SelectTokenButton_style_1.SelectTokenCardHeader, { avatar: isSelected ? ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, chain: chain })) : ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatarDefault, {})), title: isSelected ? token.symbol : defaultPlaceholder, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] }));
41
41
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Process } from '@lifi/sdk';
3
2
  export declare function CircularProgress({ process }: {
4
3
  process: Process;
@@ -8,6 +8,7 @@ const Card_1 = require("../../components/Card");
8
8
  const StepActions_1 = require("../../components/StepActions");
9
9
  const Token_1 = require("../../components/Token");
10
10
  const hooks_1 = require("../../hooks");
11
+ const providers_1 = require("../../providers");
11
12
  const utils_1 = require("../../utils");
12
13
  const DestinationWalletAddress_1 = require("./DestinationWalletAddress");
13
14
  const GasStepProcess_1 = require("./GasStepProcess");
@@ -16,6 +17,7 @@ const StepTimer_1 = require("./StepTimer");
16
17
  const Step = ({ step, fromToken, toToken, toAddress }) => {
17
18
  const { t } = (0, react_i18next_1.useTranslation)();
18
19
  const { getChainById } = (0, hooks_1.useChains)();
20
+ const { variant } = (0, providers_1.useWidgetConfig)();
19
21
  const stepHasError = step.execution?.process.some((process) => process.status === 'FAILED');
20
22
  const getCardTitle = () => {
21
23
  switch (step.type) {
@@ -23,14 +25,22 @@ const Step = ({ step, fromToken, toToken, toAddress }) => {
23
25
  const hasCrossStep = step.includedSteps.some((step) => step.type === 'cross');
24
26
  const hasSwapStep = step.includedSteps.some((step) => step.type === 'swap');
25
27
  if (hasCrossStep && hasSwapStep) {
26
- return t('swap.stepSwapAndBridge');
28
+ return variant === 'nft'
29
+ ? t('swap.stepBridgeAndBuy')
30
+ : t('swap.stepSwapAndBridge');
27
31
  }
28
32
  if (hasCrossStep) {
29
- return t('swap.stepBridge');
33
+ return variant === 'nft'
34
+ ? t('swap.stepBridgeAndBuy')
35
+ : t('swap.stepBridge');
30
36
  }
31
- return t('swap.stepSwap');
37
+ return variant === 'nft'
38
+ ? t('swap.stepSwapAndBuy')
39
+ : t('swap.stepSwap');
32
40
  default:
33
- return t('swap.stepSwap');
41
+ return variant === 'nft'
42
+ ? t('swap.stepSwapAndBuy')
43
+ : t('swap.stepSwap');
34
44
  }
35
45
  };
36
46
  const formattedToAddress = (0, utils_1.shortenWalletAddress)(toAddress);
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { Route } from '@lifi/sdk';
3
2
  export declare const getStepList: (route?: Route) => JSX.Element[] | undefined;
@@ -18,27 +18,13 @@ const SmallAvatar_1 = require("../SmallAvatar");
18
18
  const StepActions_style_1 = require("./StepActions.style");
19
19
  const StepActions = ({ step, dense, ...other }) => {
20
20
  const { t } = (0, react_i18next_1.useTranslation)();
21
- const { variant, contractTool } = (0, providers_1.useWidgetConfig)();
21
+ const { variant } = (0, providers_1.useWidgetConfig)();
22
22
  const [cardExpanded, setCardExpanded] = (0, react_1.useState)(false);
23
23
  const handleExpand = (e) => {
24
24
  e.stopPropagation();
25
25
  setCardExpanded((expanded) => !expanded);
26
26
  };
27
- const customStep = variant === 'nft'
28
- ? step.includedSteps?.find((step) => step.type === 'custom')
29
- : undefined;
30
27
  const hasCollapsedSteps = dense && step.includedSteps?.length > 1;
31
- if (customStep && contractTool) {
32
- const toolDetails = {
33
- key: contractTool.name,
34
- name: contractTool.name,
35
- logoURI: contractTool.logoURI,
36
- };
37
- customStep.toolDetails = toolDetails;
38
- if (dense) {
39
- step.toolDetails = toolDetails;
40
- }
41
- }
42
28
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ...other, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, { children: (0, jsx_runtime_1.jsx)(icons_1.LiFiToolLogo, {}) }), children: (0, jsx_runtime_1.jsx)(StepActions_style_1.StepAvatar, { variant: "circular", src: step.toolDetails.logoURI, alt: step.toolDetails.name, children: step.toolDetails.name[0] }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { ml: 2, fontSize: 18, fontWeight: "500", flex: 1, children: t(`swap.stepDetails`, {
43
29
  tool: step.toolDetails.name,
44
30
  }) }), hasCollapsedSteps ? ((0, jsx_runtime_1.jsx)(Card_1.CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) })) : null] }), hasCollapsedSteps ? ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(exports.IncludedSteps, { step: step, variant: variant }) })) : ((0, jsx_runtime_1.jsx)(exports.IncludedSteps, { step: step, variant: variant }))] }));
@@ -74,10 +60,7 @@ const StepDetailsContent = ({ step, variant }) => {
74
60
  else {
75
61
  fromAmount = (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals);
76
62
  }
77
- const showToAmount = step.type !== 'custom' &&
78
- step.tool !== 'custom' &&
79
- variant !== 'nft' &&
80
- !sameTokenProtocolStep;
63
+ const showToAmount = step.type !== 'custom' && step.tool !== 'custom' && !sameTokenProtocolStep;
81
64
  return ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex", children: [t('format.number', {
82
65
  value: fromAmount,
83
66
  }), ' ', step.action.fromToken.symbol, showToAmount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ArrowForward_1.default, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
@@ -28,14 +28,26 @@ const SwapButton = ({ onClick, hasRoute, text, disabled, loading, }) => {
28
28
  const getButtonText = () => {
29
29
  if (account.isActive) {
30
30
  if (!hasRoute) {
31
- return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
31
+ switch (variant) {
32
+ case 'nft':
33
+ return t(`button.buy`);
34
+ case 'refuel':
35
+ return t(`button.getGas`);
36
+ default:
37
+ return t(`button.swap`);
38
+ }
32
39
  }
33
40
  if (text) {
34
41
  return text;
35
42
  }
36
- return variant !== 'refuel'
37
- ? t(`button.reviewSwap`)
38
- : t(`button.reviewGasSwap`);
43
+ switch (variant) {
44
+ case 'nft':
45
+ return t(`button.reviewPurchase`);
46
+ case 'refuel':
47
+ return t(`button.reviewGasSwap`);
48
+ default:
49
+ return t(`button.reviewSwap`);
50
+ }
39
51
  }
40
52
  return t(`button.connectWallet`);
41
53
  };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SwapFormTypeProps } from '../../providers';
3
2
  export declare const SwapInputEndAdornment: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -25,9 +25,21 @@ const SwapRouteCard = ({ route, active, variant = 'default', expanded, ...other
25
25
  const token = widgetVariant === 'nft'
26
26
  ? { ...route.fromToken, amount: route.fromAmount }
27
27
  : { ...route.toToken, amount: route.toAmount };
28
- const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && (insurable || route.tags?.length) ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mb: 2, children: [insurable ? ((0, jsx_runtime_1.jsxs)(Card_1.CardLabel, { type: route.tags?.length && !cardExpanded
29
- ? 'insurance-icon'
30
- : 'insurance', children: [(0, jsx_runtime_1.jsx)(VerifiedUser_1.default, { fontSize: "inherit" }), cardExpanded || !route.tags?.length ? ((0, jsx_runtime_1.jsx)(Card_1.CardLabelTypography, { type: "icon", children: t(`swap.tags.insurable`) })) : null] })) : null, route.tags?.length ? ((0, jsx_runtime_1.jsx)(Card_1.CardLabel, { type: active ? 'active' : undefined, children: (0, jsx_runtime_1.jsx)(Card_1.CardLabelTypography, { children: t(`swap.tags.${route.tags[0].toLowerCase()}`) }) })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, step: !cardExpanded ? route.steps[0] : undefined }), !expanded ? ((0, jsx_runtime_1.jsx)(Card_1.CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) }), (0, jsx_runtime_1.jsx)(SwapRouteCardEssentials_1.SwapRouteCardEssentials, { route: route })] }));
28
+ const RecommendedTagTooltip = route.tags?.[0] === 'RECOMMENDED' ? RecommendedTooltip : react_1.Fragment;
29
+ const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && (insurable || route.tags?.length) ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mb: 2, children: [insurable ? ((0, jsx_runtime_1.jsx)(InsuranceTooltip, { children: (0, jsx_runtime_1.jsxs)(Card_1.CardLabel, { type: route.tags?.length && !cardExpanded
30
+ ? 'insurance-icon'
31
+ : 'insurance', children: [(0, jsx_runtime_1.jsx)(VerifiedUser_1.default, { fontSize: "inherit" }), cardExpanded || !route.tags?.length ? ((0, jsx_runtime_1.jsx)(Card_1.CardLabelTypography, { type: "icon", children: t(`swap.tags.insurable`) })) : null] }) })) : null, route.tags?.length ? ((0, jsx_runtime_1.jsx)(RecommendedTagTooltip, { children: (0, jsx_runtime_1.jsx)(Card_1.CardLabel, { type: active ? 'active' : undefined, children: (0, jsx_runtime_1.jsx)(Card_1.CardLabelTypography, { children: t(`swap.tags.${route.tags[0].toLowerCase()}`) }) }) })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, step: !cardExpanded ? route.steps[0] : undefined }), !expanded ? ((0, jsx_runtime_1.jsx)(Card_1.CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? (0, jsx_runtime_1.jsx)(ExpandLess_1.default, {}) : (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) }), (0, jsx_runtime_1.jsx)(SwapRouteCardEssentials_1.SwapRouteCardEssentials, { route: route })] }));
31
32
  return widgetVariant === 'refuel' || variant === 'cardless' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
32
33
  };
33
34
  exports.SwapRouteCard = SwapRouteCard;
35
+ const InsuranceTooltip = ({ children, }) => {
36
+ const { t } = (0, react_i18next_1.useTranslation)();
37
+ return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, fontWeight: "500", children: t('swap.insurance.insure') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
38
+ listStyleType: 'disc',
39
+ pl: 2,
40
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, fontWeight: "500", display: "list-item", children: t('swap.insurance.bridgeExploits') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, fontWeight: "500", display: "list-item", children: t('swap.insurance.slippageError') })] })] }), placement: "top", enterDelay: 400, arrow: true, children: children }));
41
+ };
42
+ const RecommendedTooltip = ({ children, }) => {
43
+ const { t } = (0, react_i18next_1.useTranslation)();
44
+ return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('tooltip.recommended'), placement: "top", enterDelay: 400, arrow: true, children: children }));
45
+ };
@@ -18,7 +18,7 @@ const SwapRouteCardEssentials = ({ route, dense }) => {
18
18
  const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
19
19
  const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
20
20
  const feeCosts = (0, utils_1.getFeeCostsBreakdown)(route, false);
21
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: 'space-between', flex: 1, mt: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas, index) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 11, children: [gas.amount?.toFixed(9), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(EvStation_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.additionalProviderFee`), feeCosts.map((fee, index) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 11, children: [fee.amount?.toFixed(9), " ", fee.token.symbol, " (", t(`format.currency`, { value: fee.amountUSD }), ")"] }, `${fee.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(MonetizationOn_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, {
21
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: 'space-between', flex: 1, mt: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas, index) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 12, fontWeight: "500", children: [gas.amount?.toFixed(9), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(EvStation_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, { value: gasCostUSD }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "span", children: [t(`tooltip.additionalProviderFee`), feeCosts.map((fee, index) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 12, fontWeight: "500", children: [fee.amount?.toFixed(9), " ", fee.token.symbol, " (", t(`format.currency`, { value: fee.amountUSD }), ")"] }, `${fee.token.address}${index}`)))] }), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(MonetizationOn_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t(`format.currency`, {
22
22
  value: feeCosts.reduce((sum, feeCost) => sum + feeCost.amountUSD, 0),
23
23
  }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", mr: dense ? 0 : 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(AccessTimeFilled_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
24
24
  value: executionTimeMinutes,
@@ -7,7 +7,7 @@ const providers_1 = require("../../providers");
7
7
  const Card_1 = require("../Card");
8
8
  const SwapRouteCardSkeleton = ({ variant, ...other }) => {
9
9
  const { variant: widgetVariant } = (0, providers_1.useWidgetConfig)();
10
- const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' ? ((0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", alignItems: "center", mb: 2, children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 112, height: 24, sx: (theme) => ({
10
+ const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && widgetVariant !== 'nft' ? ((0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", alignItems: "center", mb: 2, children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 112, height: 24, sx: (theme) => ({
11
11
  borderRadius: `${theme.shape.borderRadius}px`,
12
12
  }) }) })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { mr: 2, children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { ml: 6, display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, display: "flex", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 64, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 64, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 20 })] })] }));
13
13
  return widgetVariant === 'refuel' || variant === 'cardless' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { indented: true, ...other, children: cardContent }));
@@ -28,7 +28,7 @@ const SwapRoutes = (props) => {
28
28
  const routeNotFound = !currentRoute && !isLoading && !isFetching;
29
29
  const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
30
30
  const showAll = !onlyRecommendedRoute && !routeNotFound && (routes?.length ?? 0) > 1;
31
- return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { ...props, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
31
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { ...props, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: variant === 'nft' ? t('swap.fromAmount') : t('header.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
32
32
  position: 'absolute',
33
33
  top: 8,
34
34
  right: 8,
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  export declare const SwapRoutesExpanded: () => JSX.Element;
3
2
  export declare const SwapRoutesExpandedElement: () => JSX.Element;
@@ -23,7 +23,7 @@ const SwapRoutesExpandedElement = () => {
23
23
  const { t } = (0, react_i18next_1.useTranslation)();
24
24
  const navigate = (0, react_router_dom_1.useNavigate)();
25
25
  const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
26
- const { containerStyle } = (0, providers_1.useWidgetConfig)();
26
+ const { variant, containerStyle } = (0, providers_1.useWidgetConfig)();
27
27
  const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
28
28
  const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
29
29
  const currentRoute = routes?.[0];
@@ -37,6 +37,6 @@ const SwapRoutesExpandedElement = () => {
37
37
  };
38
38
  const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched);
39
39
  const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
40
- return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: timeout.enter, in: expanded, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(material_1.Grow, { timeout: timeout.enter, in: expanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(SwapRoutesExpanded_style_1.Container, { sx: containerStyle, enableColorScheme: true, children: (0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: "700", flex: 1, noWrap: true, children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || (isFetching && !routes?.length) ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (routes?.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: routes?.length <= 2 }, route.id)))) })] }) }) }) }));
40
+ return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: timeout.enter, in: expanded, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(material_1.Grow, { timeout: timeout.enter, in: expanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(SwapRoutesExpanded_style_1.Container, { sx: containerStyle, enableColorScheme: true, children: (0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: "700", flex: 1, noWrap: true, children: variant === 'nft' ? t('swap.fromAmount') : t('header.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || (isFetching && !routes?.length) ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (routes?.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: routes?.length <= 2 }, route.id)))) })] }) }) }) }));
41
41
  };
42
42
  exports.SwapRoutesExpandedElement = SwapRoutesExpandedElement;
@@ -17,7 +17,7 @@ const Token = ({ token, ...other }) => {
17
17
  return (0, jsx_runtime_1.jsx)(exports.TokenBase, { token: token, ...other });
18
18
  };
19
19
  exports.Token = Token;
20
- const TokenFallback = ({ token, connected, step, disableDescription, isLoading, ...other }) => {
20
+ const TokenFallback = ({ token, isLoading, ...other }) => {
21
21
  const { token: chainToken, isLoading: isLoadingToken } = (0, hooks_1.useToken)(token?.chainId, token?.address);
22
22
  return ((0, jsx_runtime_1.jsx)(exports.TokenBase, { token: { ...token, ...chainToken }, isLoading: isLoading || isLoadingToken, ...other }));
23
23
  };
@@ -1,19 +1,19 @@
1
1
  /// <reference types="react" />
2
- import type { Chain, Token } from '@lifi/sdk';
2
+ import type { Chain, StaticToken } from '@lifi/sdk';
3
3
  import type { SxProps, Theme } from '@mui/material';
4
4
  export declare const TokenAvatarFallback: React.FC<{
5
- token?: Token;
5
+ token?: StaticToken;
6
6
  isLoading?: boolean;
7
7
  sx?: SxProps<Theme>;
8
8
  }>;
9
9
  export declare const TokenAvatarBase: React.FC<{
10
- token?: Token;
10
+ token?: StaticToken;
11
11
  chain?: Chain;
12
12
  isLoading?: boolean;
13
13
  sx?: SxProps<Theme>;
14
14
  }>;
15
15
  export declare const TokenAvatar: React.FC<{
16
- token?: Token;
16
+ token?: StaticToken;
17
17
  chain?: Chain;
18
18
  isLoading?: boolean;
19
19
  sx?: SxProps<Theme>;
@@ -8,8 +8,8 @@ const react_hook_form_1 = require("react-hook-form");
8
8
  const hooks_1 = require("../../hooks");
9
9
  const providers_1 = require("../../providers");
10
10
  const TokenNotFound_1 = require("./TokenNotFound");
11
- const useTokenSelect_1 = require("./useTokenSelect");
12
11
  const VirtualizedTokenList_1 = require("./VirtualizedTokenList");
12
+ const useTokenSelect_1 = require("./useTokenSelect");
13
13
  const TokenList = ({ formType, height, onClick, }) => {
14
14
  const parentRef = (0, react_1.useRef)(null);
15
15
  const { account } = (0, providers_1.useWallet)();
@@ -18,7 +18,9 @@ const TokenList = ({ formType, height, onClick, }) => {
18
18
  });
19
19
  const [tokenSearchFilter] = (0, hooks_1.useDebouncedWatch)([providers_1.SwapFormKey.TokenSearchFilter], 320);
20
20
  const { tokens: chainTokens, tokensWithBalance, isLoading: isTokensLoading, isBalanceLoading, featuredTokens, } = (0, hooks_1.useTokenBalances)(selectedChainId);
21
- let filteredTokens = (tokensWithBalance ?? chainTokens ?? []);
21
+ let filteredTokens = (tokensWithBalance ??
22
+ chainTokens ??
23
+ []);
22
24
  const searchFilter = tokenSearchFilter?.toUpperCase() ?? '';
23
25
  filteredTokens = tokenSearchFilter
24
26
  ? filteredTokens.filter((token) => token.name.toUpperCase().includes(searchFilter) ||
@@ -1,14 +1,13 @@
1
- import type { TokenAmount } from '@lifi/sdk';
2
1
  import type { MutableRefObject } from 'react';
3
2
  import type { SwapFormType } from '../../providers';
4
- import type { Token } from '../../types';
3
+ import type { TokenAmount } from '../../types';
5
4
  export interface TokenListProps {
6
5
  formType: SwapFormType;
7
6
  height: number;
8
7
  onClick?(): void;
9
8
  }
10
9
  export interface VirtualizedTokenListProps {
11
- tokens: Token[];
10
+ tokens: TokenAmount[];
12
11
  featuredTokensLength?: number;
13
12
  scrollElementRef: MutableRefObject<HTMLElement | null>;
14
13
  isLoading: boolean;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTheme = void 0;
4
4
  const LoadingButton_1 = require("@mui/lab/LoadingButton");
5
5
  const ButtonBase_1 = require("@mui/material/ButtonBase");
6
- const colors_1 = require("@mui/material/colors");
7
6
  const DialogActions_1 = require("@mui/material/DialogActions");
7
+ const colors_1 = require("@mui/material/colors");
8
8
  const styles_1 = require("@mui/material/styles");
9
9
  const system_1 = require("@mui/system");
10
10
  const palette = {
@@ -226,6 +226,19 @@ const createTheme = (mode, theme = {}) => {
226
226
  }),
227
227
  },
228
228
  },
229
+ MuiTooltip: {
230
+ styleOverrides: {
231
+ tooltip: ({ theme }) => ({
232
+ backgroundColor: 'rgb(0 0 0 / 64%)',
233
+ backdropFilter: 'blur(3px)',
234
+ fontSize: '0.75rem',
235
+ padding: theme.spacing(1, 1.5),
236
+ }),
237
+ arrow: {
238
+ color: 'rgb(0 0 0 / 64%)',
239
+ },
240
+ },
241
+ },
229
242
  },
230
243
  });
231
244
  };
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "2.0.0-beta.3";
2
+ export declare const version = "2.0.0-beta.5";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '2.0.0-beta.3';
5
+ exports.version = '2.0.0-beta.5';
@@ -1 +1 @@
1
- export declare const useFeaturedTokens: (selectedChainId?: number) => import("@lifi/types").Token[] | undefined;
1
+ export declare const useFeaturedTokens: (selectedChainId?: number) => import("@lifi/types").StaticToken[] | undefined;