@lifi/widget 1.32.8 → 2.0.0-alpha.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 (305) hide show
  1. package/App.js +3 -3
  2. package/AppDrawer.js +4 -3
  3. package/AppDrawer.style.d.ts +5 -5
  4. package/cjs/App.js +3 -3
  5. package/cjs/AppDrawer.js +4 -3
  6. package/cjs/AppDrawer.style.d.ts +5 -5
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  8. package/cjs/components/Card/CardIconButton.d.ts +29 -0
  9. package/cjs/components/Card/CardIconButton.js +17 -0
  10. package/cjs/components/Card/CardLabel.d.ts +26 -0
  11. package/cjs/components/Card/CardLabel.js +45 -0
  12. package/cjs/components/Card/CardTitle.d.ts +2 -2
  13. package/cjs/components/Card/index.d.ts +2 -0
  14. package/cjs/components/Card/index.js +2 -0
  15. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  16. package/cjs/components/GasMessage/FundsSufficiencyMessage.js +16 -0
  17. package/cjs/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  18. package/cjs/components/GasMessage/GasMessage.js +19 -0
  19. package/cjs/components/GasMessage/GasMessage.style.d.ts +34 -0
  20. package/cjs/components/GasMessage/GasMessage.style.js +48 -0
  21. package/cjs/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  22. package/cjs/components/GasMessage/GasRefuelMessage.js +26 -0
  23. package/cjs/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  24. package/cjs/components/GasMessage/GasSufficiencyMessage.js +21 -0
  25. package/cjs/components/GasMessage/index.d.ts +2 -0
  26. package/cjs/components/GasMessage/index.js +18 -0
  27. package/cjs/components/Header/Header.style.d.ts +5 -5
  28. package/cjs/components/Header/NavigationHeader.js +4 -4
  29. package/cjs/components/Header/WalletHeader.js +5 -5
  30. package/cjs/components/Insurance/Insurance.d.ts +3 -0
  31. package/cjs/components/Insurance/Insurance.js +11 -0
  32. package/cjs/components/Insurance/InsuranceCard.d.ts +3 -0
  33. package/cjs/components/Insurance/InsuranceCard.js +20 -0
  34. package/cjs/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  35. package/cjs/components/Insurance/InsuranceCollapsed.js +32 -0
  36. package/cjs/components/Insurance/index.d.ts +1 -0
  37. package/cjs/components/{GasSufficiencyMessage → Insurance}/index.js +1 -1
  38. package/cjs/components/Insurance/types.d.ts +14 -0
  39. package/cjs/components/Insurance/types.js +2 -0
  40. package/cjs/components/NFT/NFT.style.d.ts +1 -1
  41. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  42. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  43. package/cjs/components/SendToWallet/SendToWallet.js +31 -25
  44. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  45. package/cjs/components/SendToWallet/SendToWalletButton.js +3 -3
  46. package/cjs/components/SmallAvatar.d.ts +2 -2
  47. package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
  48. package/cjs/components/Step/DestinationWalletAddress.js +2 -2
  49. package/cjs/components/Step/GasStepProcess.js +2 -2
  50. package/cjs/components/Step/Step.js +7 -5
  51. package/cjs/components/Step/StepList.d.ts +1 -1
  52. package/cjs/components/Step/StepProcess.style.d.ts +3 -3
  53. package/cjs/components/StepActions/StepActions.d.ts +5 -0
  54. package/cjs/components/StepActions/StepActions.js +55 -17
  55. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  56. package/cjs/components/SwapButton/SwapButton.js +2 -2
  57. package/cjs/components/SwapButton/types.d.ts +1 -2
  58. package/cjs/components/SwapInput/SwapInput.style.d.ts +2 -2
  59. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  60. package/cjs/components/SwapInput/SwapInputEndAdornment.js +18 -1
  61. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  62. package/cjs/components/SwapRouteCard/SwapRouteCard.js +10 -26
  63. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  64. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  65. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  66. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +27 -0
  67. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  68. package/cjs/components/SwapRouteCard/types.d.ts +2 -2
  69. package/cjs/components/SwapRouteCard/utils.d.ts +5 -0
  70. package/cjs/components/SwapRouteCard/utils.js +32 -2
  71. package/cjs/components/SwapRoutes/SwapRoutes.js +3 -12
  72. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -5
  73. package/cjs/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  74. package/cjs/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  75. package/cjs/components/Switch.js +4 -4
  76. package/cjs/components/Token/Token.style.d.ts +2 -2
  77. package/cjs/config/theme.js +1 -1
  78. package/cjs/config/version.d.ts +1 -1
  79. package/cjs/config/version.js +1 -1
  80. package/cjs/hooks/index.d.ts +4 -0
  81. package/cjs/hooks/index.js +4 -0
  82. package/cjs/hooks/useChains.js +2 -2
  83. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  84. package/cjs/hooks/useFeaturedTokens.js +2 -2
  85. package/cjs/hooks/useFundsSufficiency.d.ts +5 -0
  86. package/cjs/hooks/useFundsSufficiency.js +73 -0
  87. package/cjs/hooks/useGasRecommendation.d.ts +2 -0
  88. package/cjs/hooks/useGasRecommendation.js +23 -0
  89. package/cjs/hooks/useGasRefuel.d.ts +7 -0
  90. package/cjs/hooks/useGasRefuel.js +61 -0
  91. package/cjs/hooks/useGasSufficiency.d.ts +2 -3
  92. package/cjs/hooks/useGasSufficiency.js +6 -37
  93. package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  94. package/cjs/hooks/useGetTokenBalancesWithRetry.js +33 -0
  95. package/cjs/hooks/useSwapRoutes.d.ts +7 -2
  96. package/cjs/hooks/useSwapRoutes.js +31 -11
  97. package/cjs/hooks/useTokenAddressBalance.js +4 -2
  98. package/cjs/hooks/useTokenBalance.js +4 -22
  99. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  100. package/cjs/hooks/useTokenSearch.js +2 -2
  101. package/cjs/hooks/useTokens.js +2 -3
  102. package/cjs/i18n/en.json +14 -7
  103. package/cjs/i18n/it.json +6 -2
  104. package/cjs/i18n/pt.json +234 -0
  105. package/cjs/i18n/uk.json +5 -1
  106. package/cjs/icons/InsuraceLogo.d.ts +2 -0
  107. package/cjs/icons/InsuraceLogo.js +11 -0
  108. package/cjs/icons/index.d.ts +1 -0
  109. package/cjs/icons/index.js +1 -0
  110. package/cjs/index.d.ts +0 -6
  111. package/cjs/index.js +1 -6
  112. package/cjs/pages/MainPage/MainGasMessage.d.ts +3 -0
  113. package/cjs/pages/MainPage/MainGasMessage.js +12 -0
  114. package/cjs/pages/MainPage/MainPage.js +3 -2
  115. package/cjs/pages/MainPage/MainSwapButton.js +1 -1
  116. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  117. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  118. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  119. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  120. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  121. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -14
  122. package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -2
  123. package/cjs/pages/SwapPage/StartSwapButton.js +14 -4
  124. package/cjs/pages/SwapPage/SwapPage.js +18 -7
  125. package/cjs/pages/SwapPage/types.d.ts +9 -0
  126. package/cjs/pages/SwapPage/types.js +2 -0
  127. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  128. package/cjs/providers/SDKProvider/SDKProvider.d.ts +2 -2
  129. package/cjs/providers/SDKProvider/SDKProvider.js +2 -1
  130. package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -3
  131. package/cjs/providers/WidgetProvider/WidgetProvider.js +17 -4
  132. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  133. package/cjs/providers/WidgetProvider/utils.js +2 -4
  134. package/cjs/stores/StoreProvider.js +1 -1
  135. package/cjs/stores/routes/createRouteExecutionStore.js +3 -2
  136. package/cjs/stores/routes/index.d.ts +0 -1
  137. package/cjs/stores/routes/index.js +0 -1
  138. package/cjs/stores/routes/types.d.ts +1 -5
  139. package/cjs/stores/routes/useSetExecutableRoute.d.ts +1 -1
  140. package/cjs/stores/settings/types.d.ts +1 -0
  141. package/cjs/stores/settings/useSettingsStore.js +1 -0
  142. package/cjs/types/widget.d.ts +5 -10
  143. package/cjs/utils/format.js +4 -1
  144. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  145. package/components/Card/CardIconButton.d.ts +29 -0
  146. package/components/Card/CardIconButton.js +14 -0
  147. package/components/Card/CardLabel.d.ts +26 -0
  148. package/components/Card/CardLabel.js +42 -0
  149. package/components/Card/CardTitle.d.ts +2 -2
  150. package/components/Card/index.d.ts +2 -0
  151. package/components/Card/index.js +2 -0
  152. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  153. package/components/GasMessage/FundsSufficiencyMessage.js +12 -0
  154. package/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  155. package/components/GasMessage/GasMessage.js +15 -0
  156. package/components/GasMessage/GasMessage.style.d.ts +34 -0
  157. package/components/GasMessage/GasMessage.style.js +45 -0
  158. package/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  159. package/components/GasMessage/GasRefuelMessage.js +22 -0
  160. package/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  161. package/components/GasMessage/GasSufficiencyMessage.js +17 -0
  162. package/components/GasMessage/index.d.ts +2 -0
  163. package/components/GasMessage/index.js +2 -0
  164. package/components/Header/Header.style.d.ts +5 -5
  165. package/components/Header/NavigationHeader.js +4 -4
  166. package/components/Header/WalletHeader.js +6 -6
  167. package/components/Insurance/Insurance.d.ts +3 -0
  168. package/components/Insurance/Insurance.js +7 -0
  169. package/components/Insurance/InsuranceCard.d.ts +3 -0
  170. package/components/Insurance/InsuranceCard.js +16 -0
  171. package/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  172. package/components/Insurance/InsuranceCollapsed.js +28 -0
  173. package/components/Insurance/index.d.ts +1 -0
  174. package/components/Insurance/index.js +1 -0
  175. package/components/Insurance/types.d.ts +14 -0
  176. package/components/Insurance/types.js +1 -0
  177. package/components/NFT/NFT.style.d.ts +1 -1
  178. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  179. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  180. package/components/SendToWallet/SendToWallet.js +34 -28
  181. package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  182. package/components/SendToWallet/SendToWalletButton.js +4 -4
  183. package/components/SmallAvatar.d.ts +2 -2
  184. package/components/Step/CircularProgress.style.d.ts +1 -1
  185. package/components/Step/DestinationWalletAddress.js +2 -2
  186. package/components/Step/GasStepProcess.js +2 -2
  187. package/components/Step/Step.js +7 -5
  188. package/components/Step/StepList.d.ts +1 -1
  189. package/components/Step/StepProcess.style.d.ts +3 -3
  190. package/components/StepActions/StepActions.d.ts +5 -0
  191. package/components/StepActions/StepActions.js +52 -16
  192. package/components/StepActions/StepActions.style.d.ts +1 -1
  193. package/components/SwapButton/SwapButton.js +2 -2
  194. package/components/SwapButton/types.d.ts +1 -2
  195. package/components/SwapInput/SwapInput.style.d.ts +2 -2
  196. package/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  197. package/components/SwapInput/SwapInputEndAdornment.js +19 -2
  198. package/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  199. package/components/SwapRouteCard/SwapRouteCard.js +11 -26
  200. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  201. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  202. package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  203. package/components/SwapRouteCard/SwapRouteCardEssentials.js +23 -0
  204. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  205. package/components/SwapRouteCard/types.d.ts +2 -2
  206. package/components/SwapRouteCard/utils.d.ts +5 -0
  207. package/components/SwapRouteCard/utils.js +30 -1
  208. package/components/SwapRoutes/SwapRoutes.js +5 -14
  209. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -4
  210. package/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  211. package/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  212. package/components/Switch.js +5 -5
  213. package/components/Token/Token.style.d.ts +2 -2
  214. package/config/theme.js +1 -1
  215. package/config/version.d.ts +1 -1
  216. package/config/version.js +1 -1
  217. package/hooks/index.d.ts +4 -0
  218. package/hooks/index.js +4 -0
  219. package/hooks/useChains.js +2 -2
  220. package/hooks/useFeaturedTokens.d.ts +1 -1
  221. package/hooks/useFeaturedTokens.js +2 -2
  222. package/hooks/useFundsSufficiency.d.ts +5 -0
  223. package/hooks/useFundsSufficiency.js +69 -0
  224. package/hooks/useGasRecommendation.d.ts +2 -0
  225. package/hooks/useGasRecommendation.js +19 -0
  226. package/hooks/useGasRefuel.d.ts +7 -0
  227. package/hooks/useGasRefuel.js +57 -0
  228. package/hooks/useGasSufficiency.d.ts +2 -3
  229. package/hooks/useGasSufficiency.js +7 -38
  230. package/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  231. package/hooks/useGetTokenBalancesWithRetry.js +29 -0
  232. package/hooks/useSwapRoutes.d.ts +7 -2
  233. package/hooks/useSwapRoutes.js +32 -12
  234. package/hooks/useTokenAddressBalance.js +4 -2
  235. package/hooks/useTokenBalance.js +5 -23
  236. package/hooks/useTokenBalances.d.ts +1 -1
  237. package/hooks/useTokenSearch.js +2 -2
  238. package/hooks/useTokens.js +2 -3
  239. package/i18n/en.json +14 -7
  240. package/i18n/it.json +6 -2
  241. package/i18n/pt.json +234 -0
  242. package/i18n/uk.json +5 -1
  243. package/icons/InsuraceLogo.d.ts +2 -0
  244. package/icons/InsuraceLogo.js +7 -0
  245. package/icons/index.d.ts +1 -0
  246. package/icons/index.js +1 -0
  247. package/index.d.ts +0 -6
  248. package/index.js +0 -5
  249. package/package.json +10 -10
  250. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -2
  251. package/pages/MainPage/MainGasMessage.d.ts +3 -0
  252. package/pages/MainPage/MainGasMessage.js +8 -0
  253. package/pages/MainPage/MainPage.js +3 -2
  254. package/pages/MainPage/MainSwapButton.js +1 -1
  255. package/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  256. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  257. package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  258. package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
  259. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  260. package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  261. package/pages/SwapPage/ExchangeRateBottomSheet.js +0 -12
  262. package/pages/SwapPage/StartSwapButton.d.ts +3 -2
  263. package/pages/SwapPage/StartSwapButton.js +13 -4
  264. package/pages/SwapPage/SwapPage.js +21 -10
  265. package/pages/SwapPage/types.d.ts +9 -0
  266. package/pages/SwapPage/types.js +1 -0
  267. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  268. package/providers/SDKProvider/SDKProvider.d.ts +2 -2
  269. package/providers/SDKProvider/SDKProvider.js +3 -2
  270. package/providers/SwapFormProvider/FormUpdater.js +2 -3
  271. package/providers/WidgetProvider/WidgetProvider.js +17 -4
  272. package/providers/WidgetProvider/utils.d.ts +1 -1
  273. package/providers/WidgetProvider/utils.js +2 -4
  274. package/stores/StoreProvider.js +2 -2
  275. package/stores/routes/createRouteExecutionStore.js +3 -2
  276. package/stores/routes/index.d.ts +0 -1
  277. package/stores/routes/index.js +0 -1
  278. package/stores/routes/types.d.ts +1 -5
  279. package/stores/routes/useSetExecutableRoute.d.ts +1 -1
  280. package/stores/settings/types.d.ts +1 -0
  281. package/stores/settings/useSettingsStore.js +1 -0
  282. package/tsconfig.cjs.tsbuildinfo +1 -1
  283. package/types/widget.d.ts +5 -10
  284. package/utils/format.js +4 -1
  285. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -31
  286. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  287. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -14
  288. package/cjs/components/GasSufficiencyMessage/index.d.ts +0 -1
  289. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  290. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +0 -13
  291. package/cjs/config/env.d.ts +0 -3
  292. package/cjs/config/env.js +0 -6
  293. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  294. package/cjs/stores/routes/useRecommendedRouteStore.js +0 -39
  295. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -27
  296. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  297. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -11
  298. package/components/GasSufficiencyMessage/index.d.ts +0 -1
  299. package/components/GasSufficiencyMessage/index.js +0 -1
  300. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  301. package/components/SwapRoutes/useSetRecommendedRoute.js +0 -9
  302. package/config/env.d.ts +0 -3
  303. package/config/env.js +0 -3
  304. package/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  305. package/stores/routes/useRecommendedRouteStore.js +0 -32
@@ -1,29 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapStepDetailsLabel = exports.CrossStepDetailsLabel = exports.CustomStepDetailsLabel = exports.StepDetailsContent = exports.StepActions = void 0;
3
+ exports.ProtocolStepDetailsLabel = exports.SwapStepDetailsLabel = exports.CrossStepDetailsLabel = exports.CustomStepDetailsLabel = exports.StepDetailsContent = exports.IncludedSteps = exports.StepActions = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ArrowForward_1 = require("@mui/icons-material/ArrowForward");
6
+ const ExpandLess_1 = require("@mui/icons-material/ExpandLess");
7
+ const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
6
8
  const material_1 = require("@mui/material");
9
+ const big_js_1 = require("big.js");
10
+ const react_1 = require("react");
7
11
  const react_i18next_1 = require("react-i18next");
8
12
  const hooks_1 = require("../../hooks");
9
13
  const icons_1 = require("../../icons");
10
14
  const providers_1 = require("../../providers");
11
15
  const utils_1 = require("../../utils");
16
+ const Card_1 = require("../Card");
12
17
  const SmallAvatar_1 = require("../SmallAvatar");
13
18
  const StepActions_style_1 = require("./StepActions.style");
14
19
  const StepActions = ({ step, dense, ...other }) => {
20
+ const { t } = (0, react_i18next_1.useTranslation)();
15
21
  const { variant, contractTool } = (0, providers_1.useWidgetConfig)();
16
- const StepDetailsLabel = step.tool === 'custom' && variant === 'nft'
17
- ? exports.CustomStepDetailsLabel
18
- : step.type === 'cross' ||
19
- (step.type === 'lifi' &&
20
- step.includedSteps.some((step) => step.type === 'cross'))
21
- ? exports.CrossStepDetailsLabel
22
- : exports.SwapStepDetailsLabel;
23
- const isFullView = !dense && step.includedSteps?.length > 1;
22
+ const [cardExpanded, setCardExpanded] = (0, react_1.useState)(false);
23
+ const handleExpand = (e) => {
24
+ e.stopPropagation();
25
+ setCardExpanded((expanded) => !expanded);
26
+ };
24
27
  const customStep = variant === 'nft'
25
28
  ? step.includedSteps?.find((step) => step.type === 'custom')
26
29
  : undefined;
30
+ const hasCollapsedSteps = dense && step.includedSteps?.length > 1;
27
31
  if (customStep && contractTool) {
28
32
  const toolDetails = {
29
33
  key: contractTool.name,
@@ -31,10 +35,16 @@ const StepActions = ({ step, dense, ...other }) => {
31
35
  logoURI: contractTool.logoURI,
32
36
  };
33
37
  customStep.toolDetails = toolDetails;
34
- if (!isFullView) {
38
+ if (dense) {
35
39
  step.toolDetails = toolDetails;
36
40
  }
37
41
  }
42
+ 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
+ tool: step.toolDetails.name,
44
+ }) }), 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 }))] }));
45
+ };
46
+ exports.StepActions = StepActions;
47
+ const IncludedSteps = ({ step, variant }) => {
38
48
  // eslint-disable-next-line react/no-unstable-nested-components
39
49
  const StepIconComponent = ({ icon }) => {
40
50
  const tool = step.includedSteps?.[Number(icon) - 1];
@@ -42,17 +52,36 @@ const StepActions = ({ step, dense, ...other }) => {
42
52
  boxSizing: 'content-box',
43
53
  }, children: tool.toolDetails.name[0] })) : null;
44
54
  };
45
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ...other, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1.5 : 0, children: [(0, jsx_runtime_1.jsx)(StepActions_style_1.StepAvatar, { variant: "circular", src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name, children: step.type === 'lifi' ? (0, jsx_runtime_1.jsx)(icons_1.LiFiToolLogo, {}) : step.toolDetails.name[0] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize", children: step.type === 'lifi'
46
- ? 'LI.FI Smart Contract'
47
- : step.toolDetails.name })] }), isFullView ? ((0, jsx_runtime_1.jsx)(material_1.Stepper, { orientation: "vertical", connector: (0, jsx_runtime_1.jsx)(StepActions_style_1.StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => ((0, jsx_runtime_1.jsxs)(material_1.Step, { expanded: true, children: [(0, jsx_runtime_1.jsx)(StepActions_style_1.StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' && variant === 'nft' ? ((0, jsx_runtime_1.jsx)(exports.CustomStepDetailsLabel, { step: step, variant: variant })) : step.type === 'cross' || step.type === 'lifi' ? ((0, jsx_runtime_1.jsx)(exports.CrossStepDetailsLabel, { step: step })) : ((0, jsx_runtime_1.jsx)(exports.SwapStepDetailsLabel, { step: step })) }), (0, jsx_runtime_1.jsx)(StepActions_style_1.StepContent, { children: (0, jsx_runtime_1.jsx)(exports.StepDetailsContent, { step: step, variant: variant }) })] }, step.id))) })) : ((0, jsx_runtime_1.jsxs)(material_1.Box, { ml: 6, children: [(0, jsx_runtime_1.jsx)(StepDetailsLabel, { step: step, variant: variant === 'nft' ? variant : undefined }), (0, jsx_runtime_1.jsx)(exports.StepDetailsContent, { step: step, variant: variant })] }))] }));
55
+ const StepDetailsLabel = step.tool === 'custom' && variant === 'nft'
56
+ ? exports.CustomStepDetailsLabel
57
+ : step.type === 'cross' ||
58
+ (step.type === 'lifi' &&
59
+ step.includedSteps.some((step) => step.type === 'cross'))
60
+ ? exports.CrossStepDetailsLabel
61
+ : exports.SwapStepDetailsLabel;
62
+ return step.includedSteps.length > 1 ? ((0, jsx_runtime_1.jsx)(material_1.Box, { mt: 1.5, children: (0, jsx_runtime_1.jsx)(material_1.Stepper, { orientation: "vertical", connector: (0, jsx_runtime_1.jsx)(StepActions_style_1.StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => ((0, jsx_runtime_1.jsxs)(material_1.Step, { expanded: true, children: [(0, jsx_runtime_1.jsx)(StepActions_style_1.StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' && variant === 'nft' ? ((0, jsx_runtime_1.jsx)(exports.CustomStepDetailsLabel, { step: step, variant: variant })) : step.type === 'cross' || step.type === 'lifi' ? ((0, jsx_runtime_1.jsx)(exports.CrossStepDetailsLabel, { step: step })) : step.type === 'protocol' ? ((0, jsx_runtime_1.jsx)(exports.ProtocolStepDetailsLabel, { step: step })) : ((0, jsx_runtime_1.jsx)(exports.SwapStepDetailsLabel, { step: step })) }), (0, jsx_runtime_1.jsx)(StepActions_style_1.StepContent, { children: (0, jsx_runtime_1.jsx)(exports.StepDetailsContent, { step: step, variant: variant }) })] }, step.id))) }) })) : ((0, jsx_runtime_1.jsxs)(material_1.Box, { ml: 6, children: [(0, jsx_runtime_1.jsx)(StepDetailsLabel, { step: step, variant: variant === 'nft' ? variant : undefined }), (0, jsx_runtime_1.jsx)(exports.StepDetailsContent, { step: step, variant: variant })] }));
48
63
  };
49
- exports.StepActions = StepActions;
64
+ exports.IncludedSteps = IncludedSteps;
50
65
  const StepDetailsContent = ({ step, variant }) => {
51
66
  const { t } = (0, react_i18next_1.useTranslation)();
67
+ const sameTokenProtocolStep = step.action.fromToken.chainId === step.action.toToken.chainId &&
68
+ step.action.fromToken.address === step.action.toToken.address;
69
+ let fromAmount;
70
+ if (sameTokenProtocolStep) {
71
+ fromAmount = (0, big_js_1.default)(step.estimate.fromAmount)
72
+ .div(10 ** step.action.fromToken.decimals)
73
+ .minus((0, big_js_1.default)(step.estimate.toAmount).div(10 ** step.action.toToken.decimals));
74
+ }
75
+ else {
76
+ fromAmount = (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals);
77
+ }
78
+ const showToAmount = step.type !== 'custom' &&
79
+ step.tool !== 'custom' &&
80
+ variant !== 'nft' &&
81
+ !sameTokenProtocolStep;
52
82
  return ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex", children: [t('format.number', {
53
- value: (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals),
54
- }), ' ', step.action.fromToken.symbol, !((step.type === 'custom' || step.tool === 'custom') &&
55
- variant === 'nft') ? ((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', {
83
+ value: fromAmount,
84
+ }), ' ', 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', {
56
85
  value: (0, utils_1.formatTokenAmount)(step.execution?.toAmount ?? step.estimate.toAmount, step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
57
86
  }), ' ', step.execution?.toToken?.symbol ?? step.action.toToken.symbol] })) : null] }));
58
87
  };
@@ -86,3 +115,12 @@ const SwapStepDetailsLabel = ({ step }) => {
86
115
  }) }));
87
116
  };
88
117
  exports.SwapStepDetailsLabel = SwapStepDetailsLabel;
118
+ const ProtocolStepDetailsLabel = ({ step }) => {
119
+ const { t } = (0, react_i18next_1.useTranslation)();
120
+ return ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: step.toolDetails.key === 'lifuelProtocol'
121
+ ? t('swap.refuelStepDetails', {
122
+ tool: step.toolDetails.name,
123
+ })
124
+ : step.toolDetails.name }));
125
+ };
126
+ exports.ProtocolStepDetailsLabel = ProtocolStepDetailsLabel;
@@ -14,7 +14,7 @@ export declare const StepAvatar: import("@emotion/styled").StyledComponent<{
14
14
  src?: string | undefined;
15
15
  srcSet?: string | undefined;
16
16
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
- variant?: "square" | "circular" | "rounded" | undefined;
17
+ variant?: import("@mui/types").OverridableStringUnion<"square" | "circular" | "rounded", import("@mui/material").AvatarPropsVariantOverrides> | undefined;
18
18
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
20
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -7,7 +7,7 @@ const react_i18next_1 = require("react-i18next");
7
7
  const react_router_dom_1 = require("react-router-dom");
8
8
  const providers_1 = require("../../providers");
9
9
  const utils_1 = require("../../utils");
10
- const SwapButton = ({ onClick, currentRoute, text, disabled, loading, }) => {
10
+ const SwapButton = ({ onClick, hasRoute, text, disabled, loading, }) => {
11
11
  const { t } = (0, react_i18next_1.useTranslation)();
12
12
  const navigate = (0, react_router_dom_1.useNavigate)();
13
13
  const { variant, walletManagement } = (0, providers_1.useWidgetConfig)();
@@ -27,7 +27,7 @@ const SwapButton = ({ onClick, currentRoute, text, disabled, loading, }) => {
27
27
  };
28
28
  const getButtonText = () => {
29
29
  if (account.isActive) {
30
- if (!currentRoute) {
30
+ if (!hasRoute) {
31
31
  return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
32
32
  }
33
33
  if (text) {
@@ -1,7 +1,6 @@
1
- import type { Route } from '@lifi/sdk';
2
1
  export interface SwapButtonProps {
3
2
  onClick?(): void;
4
- currentRoute?: Route;
3
+ hasRoute?: boolean;
5
4
  text?: string;
6
5
  disabled?: boolean;
7
6
  loading?: boolean;
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
4
4
  export declare const FormControl: import("@emotion/styled").StyledComponent<{
5
5
  children?: import("react").ReactNode;
6
6
  classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
7
- color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
7
+ color?: import("@mui/types").OverridableStringUnion<"success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").FormControlPropsColorOverrides> | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  error?: boolean | undefined;
10
10
  fullWidth?: boolean | undefined;
@@ -12,7 +12,7 @@ export declare const FormControl: import("@emotion/styled").StyledComponent<{
12
12
  hiddenLabel?: boolean | undefined;
13
13
  margin?: "normal" | "none" | "dense" | undefined;
14
14
  required?: boolean | undefined;
15
- size?: "small" | "medium" | undefined;
15
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium", import("@mui/material").FormControlPropsSizeOverrides> | undefined;
16
16
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
17
  variant?: "outlined" | "filled" | "standard" | undefined;
18
18
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -2,17 +2,17 @@
2
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
5
- color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
5
+ color?: import("@mui/types").OverridableStringUnion<"inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").ButtonPropsColorOverrides> | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableElevation?: boolean | undefined;
8
8
  disableFocusRipple?: boolean | undefined;
9
9
  endIcon?: import("react").ReactNode;
10
10
  fullWidth?: boolean | undefined;
11
11
  href?: string | undefined;
12
- size?: "small" | "medium" | "large" | undefined;
12
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").ButtonPropsSizeOverrides> | undefined;
13
13
  startIcon?: import("react").ReactNode;
14
14
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
- variant?: "text" | "outlined" | "contained" | undefined;
15
+ variant?: import("@mui/types").OverridableStringUnion<"text" | "outlined" | "contained", import("@mui/material").ButtonPropsVariantOverrides> | undefined;
16
16
  } & Omit<{
17
17
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
18
18
  centerRipple?: boolean | undefined;
@@ -3,23 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SwapInputEndAdornment = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
+ const big_js_1 = require("big.js");
6
7
  const react_hook_form_1 = require("react-hook-form");
7
8
  const react_i18next_1 = require("react-i18next");
8
9
  const hooks_1 = require("../../hooks");
9
10
  const providers_1 = require("../../providers");
11
+ const utils_1 = require("../../utils");
10
12
  const SwapInputAdornment_style_1 = require("./SwapInputAdornment.style");
11
13
  const SwapInputEndAdornment = ({ formType }) => {
12
14
  const { t } = (0, react_i18next_1.useTranslation)();
13
15
  const { setValue } = (0, react_hook_form_1.useFormContext)();
16
+ const { getChainById } = (0, hooks_1.useChains)();
14
17
  const [chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
15
18
  name: [
16
19
  providers_1.SwapFormKeyHelper.getChainKey(formType),
17
20
  providers_1.SwapFormKeyHelper.getTokenKey(formType),
18
21
  ],
19
22
  });
23
+ const { data } = (0, hooks_1.useGasRecommendation)(chainId);
20
24
  const { token, isLoading } = (0, hooks_1.useTokenAddressBalance)(chainId, tokenAddress);
21
25
  const handleMax = () => {
22
- setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), token?.amount ?? '', {
26
+ const chain = getChainById(chainId);
27
+ let maxAmount;
28
+ if (chain?.nativeToken.address === tokenAddress &&
29
+ data?.available &&
30
+ data?.recommended) {
31
+ const tokenAmount = (0, big_js_1.default)(token?.amount ?? 0);
32
+ const recommendedAmount = (0, big_js_1.default)(data.recommended.amount)
33
+ .div(10 ** data.recommended.token.decimals)
34
+ .div(2);
35
+ if (tokenAmount.gt(recommendedAmount)) {
36
+ maxAmount = (0, utils_1.formatTokenAmount)(tokenAmount.minus(recommendedAmount).toString());
37
+ }
38
+ }
39
+ setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), maxAmount || token?.amount || '', {
23
40
  shouldTouch: true,
24
41
  });
25
42
  };
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { CardProps } from '../Card';
3
- import type { SwapRouteCardEssentialsProps, SwapRouteCardProps } from './types';
3
+ import type { SwapRouteCardProps } from './types';
4
4
  export declare const SwapRouteCard: React.FC<SwapRouteCardProps & Omit<CardProps, 'variant'>>;
5
- export declare const SwapRouteCardEssentials: React.FC<SwapRouteCardEssentialsProps>;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapRouteCardEssentials = exports.SwapRouteCard = void 0;
3
+ exports.SwapRouteCard = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const AccessTime_1 = require("@mui/icons-material/AccessTime");
6
- const EvStationOutlined_1 = require("@mui/icons-material/EvStationOutlined");
7
5
  const ExpandLess_1 = require("@mui/icons-material/ExpandLess");
8
6
  const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
9
- const LayersOutlined_1 = require("@mui/icons-material/LayersOutlined");
7
+ const VerifiedUser_1 = require("@mui/icons-material/VerifiedUser");
10
8
  const material_1 = require("@mui/material");
11
9
  const react_1 = require("react");
12
10
  const react_i18next_1 = require("react-i18next");
@@ -14,16 +12,12 @@ const providers_1 = require("../../providers");
14
12
  const Card_1 = require("../Card");
15
13
  const StepActions_1 = require("../StepActions");
16
14
  const Token_1 = require("../Token");
17
- const SwapRouteCard_style_1 = require("./SwapRouteCard.style");
18
- const utils_1 = require("./utils");
15
+ const SwapRouteCardEssentials_1 = require("./SwapRouteCardEssentials");
19
16
  const SwapRouteCard = ({ route, active, variant = 'default', expanded, ...other }) => {
20
17
  const { t } = (0, react_i18next_1.useTranslation)();
21
- const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
22
- const [cardExpanded, setCardExpanded] = (0, react_1.useState)(variant === 'default' || expanded);
23
- const alternativeTag = t(`swap.tags.ALTERNATIVE`);
24
- const label = route.tags?.length
25
- ? t(`swap.tags.${route.tags[0]}`)
26
- : alternativeTag;
18
+ const { variant: widgetVariant } = (0, providers_1.useWidgetConfig)();
19
+ const [cardExpanded, setCardExpanded] = (0, react_1.useState)(expanded);
20
+ const insurable = route.insurance?.state === 'INSURABLE';
27
21
  const handleExpand = (e) => {
28
22
  e.stopPropagation();
29
23
  setCardExpanded((expanded) => !expanded);
@@ -31,19 +25,9 @@ const SwapRouteCard = ({ route, active, variant = 'default', expanded, ...other
31
25
  const token = widgetVariant === 'nft'
32
26
  ? { ...route.fromToken, amount: route.fromAmount }
33
27
  : { ...route.toToken, amount: route.toAmount };
34
- const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, { active: active ?? label !== alternativeTag, children: label }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, { 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))) }), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] }));
35
- return widgetVariant === 'refuel' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true, ...other, children: cardContent }));
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 })] }));
31
+ 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 }));
36
32
  };
37
33
  exports.SwapRouteCard = SwapRouteCard;
38
- const SwapRouteCardEssentials = ({ route, dense }) => {
39
- const { t } = (0, react_i18next_1.useTranslation)();
40
- const executionTimeMinutes = Math.ceil(route.steps
41
- .map((step) => step.estimate.executionDuration)
42
- .reduce((duration, x) => duration + x, 0) / 60);
43
- const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
44
- const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
45
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0, 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) => ((0, jsx_runtime_1.jsxs)(material_1.Typography, { fontSize: 11, children: [gas.amount?.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }, `${gas.token.address}${gas.token.symbol}`)))] }), 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)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(EvStationOutlined_1.default, { fontSize: dense ? 'medium' : '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: 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)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(AccessTime_1.default, { fontSize: dense ? 'medium' : 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: t('swap.estimatedTime', {
46
- value: executionTimeMinutes,
47
- }) })] }) }), !dense ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { lineHeight: 0, mr: 0.5, color: "grey.500", children: (0, jsx_runtime_1.jsx)(LayersOutlined_1.default, { fontSize: dense ? 'medium' : 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })) : null] }));
48
- };
49
- exports.SwapRouteCardEssentials = SwapRouteCardEssentials;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
2
+ export declare const IconTypography: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
3
  align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
4
4
  children?: import("react").ReactNode;
5
5
  classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
@@ -7,40 +7,8 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
7
7
  noWrap?: boolean | undefined;
8
8
  paragraph?: boolean | undefined;
9
9
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
10
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
11
- variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
10
+ variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
11
+ variantMapping?: Partial<Record<import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides>, string>> | undefined;
12
12
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
13
13
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
14
- }, 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> & {
15
- active?: boolean | undefined;
16
- }, {}, {}>;
17
- export declare const IconButton: import("@emotion/styled").StyledComponent<{
18
- children?: import("react").ReactNode;
19
- classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
20
- color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
21
- disabled?: boolean | undefined;
22
- disableFocusRipple?: boolean | undefined;
23
- edge?: false | "end" | "start" | undefined;
24
- size?: "small" | "medium" | "large" | undefined;
25
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
26
- } & Omit<{
27
- action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
28
- centerRipple?: boolean | undefined;
29
- children?: import("react").ReactNode;
30
- classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
31
- disabled?: boolean | undefined;
32
- disableRipple?: boolean | undefined;
33
- disableTouchRipple?: boolean | undefined;
34
- focusRipple?: boolean | undefined;
35
- focusVisibleClassName?: string | undefined;
36
- LinkComponent?: import("react").ElementType<any> | undefined;
37
- onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
38
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
39
- tabIndex?: number | undefined;
40
- TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
41
- touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
42
- }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
43
- ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
44
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
45
- active?: boolean | undefined;
46
- }, {}, {}>;
14
+ }, 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>, {}, {}>;
@@ -1,43 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IconButton = exports.Label = void 0;
3
+ exports.IconTypography = void 0;
4
4
  const material_1 = require("@mui/material");
5
5
  const styles_1 = require("@mui/material/styles");
6
- const utils_1 = require("../../utils");
7
- exports.Label = (0, styles_1.styled)(material_1.Typography, {
8
- shouldForwardProp: (prop) => prop !== 'active',
9
- })(({ theme, active }) => ({
10
- backgroundColor: active ? theme.palette.secondary.main : 'transparent',
11
- border: '1px solid',
12
- borderColor: active
13
- ? theme.palette.secondary.main
14
- : theme.palette.mode === 'light'
15
- ? theme.palette.grey[300]
16
- : theme.palette.grey[800],
17
- borderRadius: theme.shape.borderRadiusSecondary,
18
- color: active
19
- ? (0, utils_1.getContrastTextColor)(theme, theme.palette.secondary.main)
20
- : theme.palette.text.secondary,
21
- padding: theme.spacing(0.75),
22
- fontSize: 12,
23
- lineHeight: 1,
24
- fontWeight: '600',
25
- height: 24,
26
- letterSpacing: '0.05rem',
27
- textTransform: 'uppercase',
28
- display: 'inline-flex',
29
- userSelect: 'none',
6
+ exports.IconTypography = (0, styles_1.styled)(material_1.Typography)(({ theme }) => ({
7
+ color: theme.palette.mode === 'light'
8
+ ? (0, styles_1.alpha)(theme.palette.common.black, 0.24)
9
+ : (0, styles_1.alpha)(theme.palette.common.white, 0.32),
10
+ lineHeight: 0,
11
+ marginRight: theme.spacing(0.5),
30
12
  }));
31
- exports.IconButton = (0, styles_1.styled)(material_1.IconButton, {
32
- shouldForwardProp: (prop) => prop !== 'active',
33
- })(({ theme, active }) => {
34
- const backgroundColor = theme.palette.mode === 'light'
35
- ? theme.palette.common.black
36
- : theme.palette.common.white;
37
- return {
38
- backgroundColor: (0, styles_1.alpha)(backgroundColor, 0.04),
39
- '&:hover': {
40
- backgroundColor: (0, styles_1.alpha)(backgroundColor, 0.08),
41
- },
42
- };
43
- });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { SwapRouteCardEssentialsProps } from './types';
3
+ export declare const SwapRouteCardEssentials: React.FC<SwapRouteCardEssentialsProps>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwapRouteCardEssentials = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const AccessTimeFilled_1 = require("@mui/icons-material/AccessTimeFilled");
6
+ const EvStation_1 = require("@mui/icons-material/EvStation");
7
+ const Layers_1 = require("@mui/icons-material/Layers");
8
+ const MonetizationOn_1 = require("@mui/icons-material/MonetizationOn");
9
+ const material_1 = require("@mui/material");
10
+ const react_i18next_1 = require("react-i18next");
11
+ const SwapRouteCard_style_1 = require("./SwapRouteCard.style");
12
+ const utils_1 = require("./utils");
13
+ const SwapRouteCardEssentials = ({ route, dense }) => {
14
+ const { t } = (0, react_i18next_1.useTranslation)();
15
+ const executionTimeMinutes = Math.ceil(route.steps
16
+ .map((step) => step.estimate.executionDuration)
17
+ .reduce((duration, x) => duration + x, 0) / 60);
18
+ const gasCostUSD = parseFloat(route.gasCostUSD ?? '') || 0.01;
19
+ const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
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`, {
22
+ value: feeCosts.reduce((sum, feeCost) => sum + feeCost.amountUSD, 0),
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
+ value: executionTimeMinutes,
25
+ }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconTypography, { children: (0, jsx_runtime_1.jsx)(Layers_1.default, { fontSize: "small" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1, children: route.steps.length })] }) })] }));
26
+ };
27
+ exports.SwapRouteCardEssentials = SwapRouteCardEssentials;
@@ -6,10 +6,10 @@ const material_1 = require("@mui/material");
6
6
  const providers_1 = require("../../providers");
7
7
  const Card_1 = require("../Card");
8
8
  const SwapRouteCardSkeleton = ({ variant, ...other }) => {
9
- const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
10
- const cardContent = ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: (theme) => ({
11
- borderRadius: `${theme.shape.borderRadiusSecondary}px`,
12
- }) }), variant === 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] })) : null] })) : 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, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] })] }), variant !== 'stretched' ? ((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: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] })) : null] }));
13
- return widgetVariant === 'refuel' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { indented: true, ...other, children: cardContent }));
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) => ({
11
+ borderRadius: `${theme.shape.borderRadius}px`,
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
+ return widgetVariant === 'refuel' || variant === 'cardless' ? (cardContent) : ((0, jsx_runtime_1.jsx)(Card_1.Card, { indented: true, ...other, children: cardContent }));
14
14
  };
15
15
  exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
@@ -1,7 +1,7 @@
1
1
  import type { Route } from '@lifi/sdk';
2
2
  export interface SwapRouteCardProps {
3
3
  route: Route;
4
- variant?: 'default' | 'stretched' | 'dense';
4
+ variant?: 'default' | 'cardless';
5
5
  active?: boolean;
6
6
  expanded?: boolean;
7
7
  }
@@ -10,5 +10,5 @@ export interface SwapRouteCardEssentialsProps {
10
10
  dense?: boolean;
11
11
  }
12
12
  export interface SwapRouteCardSkeletonProps {
13
- variant?: 'default' | 'stretched' | 'dense';
13
+ variant?: 'default' | 'cardless';
14
14
  }
@@ -5,3 +5,8 @@ export declare const getGasCostsBreakdown: (route: Route) => {
5
5
  amountUSD: number;
6
6
  token: Token;
7
7
  }[];
8
+ export declare const getFeeCostsBreakdown: (route: Route, included?: boolean) => {
9
+ amount: Big;
10
+ amountUSD: number;
11
+ token: Token;
12
+ }[];
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGasCostsBreakdown = void 0;
3
+ exports.getFeeCostsBreakdown = exports.getGasCostsBreakdown = void 0;
4
4
  const big_js_1 = require("big.js");
5
5
  const getGasCostsBreakdown = (route) => {
6
6
  return Object.values(route.steps.reduce((groupedGasCosts, step) => {
7
- if (step.estimate.gasCosts) {
7
+ if (step.estimate.gasCosts?.length) {
8
8
  const { token } = step.estimate.gasCosts[0];
9
9
  const gasCostAmount = step.estimate.gasCosts
10
10
  .reduce((amount, gasCost) => amount.plus((0, big_js_1.default)(gasCost.amount || 0)), (0, big_js_1.default)(0))
@@ -28,3 +28,33 @@ const getGasCostsBreakdown = (route) => {
28
28
  }, {}));
29
29
  };
30
30
  exports.getGasCostsBreakdown = getGasCostsBreakdown;
31
+ const getFeeCostsBreakdown = (route, included) => {
32
+ return Object.values(route.steps.reduce((groupedFeeCosts, step) => {
33
+ let feeCosts = step.estimate.feeCosts;
34
+ if (typeof included === 'boolean') {
35
+ feeCosts = feeCosts?.filter((feeCost) => feeCost.included === included);
36
+ }
37
+ if (feeCosts?.length) {
38
+ const { token } = feeCosts[0];
39
+ const feeCostAmount = feeCosts
40
+ .reduce((amount, feeCost) => amount.plus((0, big_js_1.default)(feeCost.amount || 0)), (0, big_js_1.default)(0))
41
+ .div(10 ** token.decimals);
42
+ const feeCostAmountUSD = feeCosts.reduce((amount, feeCost) => amount + parseFloat(feeCost.amountUSD || '0'), 0);
43
+ const groupedFeeCost = groupedFeeCosts[token.chainId];
44
+ const amount = groupedFeeCost
45
+ ? groupedFeeCost.amount.plus(feeCostAmount)
46
+ : feeCostAmount;
47
+ const amountUSD = groupedFeeCost
48
+ ? groupedFeeCost.amountUSD + feeCostAmountUSD
49
+ : feeCostAmountUSD;
50
+ groupedFeeCosts[token.chainId] = {
51
+ amount,
52
+ amountUSD,
53
+ token,
54
+ };
55
+ return groupedFeeCosts;
56
+ }
57
+ return groupedFeeCosts;
58
+ }, {}));
59
+ };
60
+ exports.getFeeCostsBreakdown = getFeeCostsBreakdown;