@lifi/widget 3.0.0-alpha.33 → 3.0.0-alpha.35

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 (328) hide show
  1. package/App.tsx +6 -3
  2. package/AppDefault.tsx +3 -3
  3. package/AppDrawer.tsx +3 -5
  4. package/_esm/App.js +6 -3
  5. package/_esm/App.js.map +1 -1
  6. package/_esm/AppDefault.js +3 -3
  7. package/_esm/AppDefault.js.map +1 -1
  8. package/_esm/AppDrawer.js +3 -3
  9. package/_esm/AppDrawer.js.map +1 -1
  10. package/_esm/components/ActiveTransactions/ActiveTransactions.d.ts +2 -2
  11. package/_esm/components/ActiveTransactions/ActiveTransactions.js +1 -1
  12. package/_esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
  13. package/_esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +1 -1
  14. package/_esm/components/AmountInput/AmountInput.d.ts +3 -3
  15. package/_esm/components/AmountInput/AmountInput.js +2 -2
  16. package/_esm/components/AmountInput/AmountInput.js.map +1 -1
  17. package/_esm/components/AppContainer.js +3 -2
  18. package/_esm/components/AppContainer.js.map +1 -1
  19. package/_esm/components/Avatar/AccountAvatar.d.ts +3 -1
  20. package/_esm/components/Avatar/AccountAvatar.js +3 -3
  21. package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
  22. package/_esm/components/Avatar/utils.d.ts +1 -1
  23. package/_esm/components/Avatar/utils.js +1 -1
  24. package/_esm/components/Avatar/utils.js.map +1 -1
  25. package/_esm/components/Card/Card.d.ts +7 -19
  26. package/_esm/components/Card/Card.js +36 -42
  27. package/_esm/components/Card/Card.js.map +1 -1
  28. package/_esm/components/Card/CardLabel.js +5 -3
  29. package/_esm/components/Card/CardLabel.js.map +1 -1
  30. package/_esm/components/Card/InputCard.d.ts +4 -0
  31. package/_esm/components/Card/InputCard.js +7 -0
  32. package/_esm/components/Card/InputCard.js.map +1 -0
  33. package/_esm/components/ChainSelect/ChainSelect.js +1 -1
  34. package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
  35. package/_esm/components/ChainSelect/ChainSelect.style.d.ts +2 -10
  36. package/_esm/components/ContractComponent/ContractComponent.d.ts +2 -2
  37. package/_esm/components/ContractComponent/ContractComponent.js.map +1 -1
  38. package/_esm/components/ContractComponent/ItemPrice.d.ts +8 -0
  39. package/_esm/components/ContractComponent/ItemPrice.js +23 -0
  40. package/_esm/components/ContractComponent/ItemPrice.js.map +1 -0
  41. package/_esm/components/{NFT → ContractComponent/NFT}/NFT.js +5 -11
  42. package/_esm/components/ContractComponent/NFT/NFT.js.map +1 -0
  43. package/_esm/components/ContractComponent/NFT/NFT.style.js.map +1 -0
  44. package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.js +1 -1
  45. package/_esm/components/ContractComponent/NFT/NFTBase.js.map +1 -0
  46. package/_esm/components/{NFT → ContractComponent/NFT}/types.d.ts +2 -3
  47. package/_esm/components/ContractComponent/NFT/types.js.map +1 -0
  48. package/_esm/components/Dialog.d.ts +2 -9
  49. package/_esm/components/Dialog.js +1 -0
  50. package/_esm/components/Dialog.js.map +1 -1
  51. package/_esm/components/Header/BackButton.d.ts +3 -0
  52. package/_esm/components/Header/BackButton.js +8 -0
  53. package/_esm/components/Header/BackButton.js.map +1 -0
  54. package/_esm/components/Header/CloseDrawerButton.d.ts +5 -1
  55. package/_esm/components/Header/CloseDrawerButton.js +8 -2
  56. package/_esm/components/Header/CloseDrawerButton.js.map +1 -1
  57. package/_esm/components/Header/Header.style.d.ts +4 -1
  58. package/_esm/components/Header/Header.style.js +24 -16
  59. package/_esm/components/Header/Header.style.js.map +1 -1
  60. package/_esm/components/Header/NavigationHeader.js +8 -9
  61. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  62. package/_esm/components/Header/NavigationTabs.js +1 -1
  63. package/_esm/components/Header/NavigationTabs.js.map +1 -1
  64. package/_esm/components/Header/SettingsButton.style.d.ts +1 -1
  65. package/_esm/components/Header/TransactionHistoryButton.js +1 -1
  66. package/_esm/components/Header/TransactionHistoryButton.js.map +1 -1
  67. package/_esm/components/Header/WalletHeader.js +4 -11
  68. package/_esm/components/Header/WalletHeader.js.map +1 -1
  69. package/_esm/components/Header/WalletMenu.js +2 -2
  70. package/_esm/components/Header/WalletMenu.js.map +1 -1
  71. package/_esm/components/Insurance/types.d.ts +3 -3
  72. package/_esm/components/ListItem/ListItem.d.ts +1 -1
  73. package/_esm/components/PageContainer.d.ts +2 -1
  74. package/_esm/components/PageContainer.js +3 -3
  75. package/_esm/components/PageContainer.js.map +1 -1
  76. package/_esm/components/ReverseTokensButton/ReverseTokensButton.js +2 -2
  77. package/_esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
  78. package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +9 -3
  79. package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js +24 -14
  80. package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
  81. package/_esm/components/RouteCard/RouteCard.js +2 -2
  82. package/_esm/components/RouteCard/RouteCard.js.map +1 -1
  83. package/_esm/components/RouteCard/RouteCardSkeleton.d.ts +2 -2
  84. package/_esm/components/RouteCard/RouteCardSkeleton.js +1 -1
  85. package/_esm/components/RouteCard/RouteCardSkeleton.js.map +1 -1
  86. package/_esm/components/Routes/Routes.d.ts +2 -2
  87. package/_esm/components/Routes/Routes.js +1 -1
  88. package/_esm/components/Routes/Routes.js.map +1 -1
  89. package/_esm/components/Routes/RoutesExpanded.js +9 -3
  90. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  91. package/_esm/components/Routes/RoutesExpanded.style.js +1 -0
  92. package/_esm/components/Routes/RoutesExpanded.style.js.map +1 -1
  93. package/_esm/components/SelectChainAndToken.js +3 -6
  94. package/_esm/components/SelectChainAndToken.js.map +1 -1
  95. package/_esm/components/SelectTokenButton/SelectTokenButton.js +9 -10
  96. package/_esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
  97. package/_esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +10 -0
  98. package/_esm/components/SelectTokenButton/SelectTokenButton.style.js +41 -1
  99. package/_esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
  100. package/_esm/components/SendToWallet/SendToWalletButton.d.ts +2 -2
  101. package/_esm/components/SendToWallet/SendToWalletButton.js +2 -2
  102. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  103. package/_esm/components/Step/Step.js +8 -8
  104. package/_esm/components/Step/Step.js.map +1 -1
  105. package/_esm/components/Step/StepList.js +1 -1
  106. package/_esm/components/Step/StepList.js.map +1 -1
  107. package/_esm/components/StepActions/StepActions.d.ts +4 -9
  108. package/_esm/components/StepActions/StepActions.js +13 -12
  109. package/_esm/components/StepActions/StepActions.js.map +1 -1
  110. package/_esm/components/StepActions/types.d.ts +8 -2
  111. package/_esm/components/TokenList/TokenList.js +4 -1
  112. package/_esm/components/TokenList/TokenList.js.map +1 -1
  113. package/_esm/components/TokenList/TokenList.style.d.ts +1 -1
  114. package/_esm/components/TokenList/TokenList.style.js +1 -1
  115. package/_esm/components/TokenList/TokenList.style.js.map +1 -1
  116. package/_esm/components/TokenList/VirtualizedTokenList.js +19 -18
  117. package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  118. package/_esm/components/TokenList/useTokenSelect.js +1 -1
  119. package/_esm/components/TokenList/useTokenSelect.js.map +1 -1
  120. package/_esm/components/TokenList/utils.d.ts +2 -0
  121. package/_esm/components/TokenList/utils.js +35 -0
  122. package/_esm/components/TokenList/utils.js.map +1 -0
  123. package/_esm/config/version.d.ts +1 -1
  124. package/_esm/config/version.js +1 -1
  125. package/_esm/hooks/useAddressValidation.d.ts +1 -1
  126. package/_esm/hooks/useGasRecommendation.d.ts +1 -1
  127. package/_esm/hooks/useProcessMessage.d.ts +2 -2
  128. package/_esm/hooks/useProcessMessage.js +16 -12
  129. package/_esm/hooks/useProcessMessage.js.map +1 -1
  130. package/_esm/hooks/useRoutes.d.ts +2 -2
  131. package/_esm/hooks/useRoutes.js +11 -20
  132. package/_esm/hooks/useRoutes.js.map +1 -1
  133. package/_esm/hooks/useTokenAddressBalance.d.ts +1 -1
  134. package/_esm/hooks/useTokenBalance.d.ts +1 -1
  135. package/_esm/hooks/useTokenBalances.d.ts +1 -1
  136. package/_esm/hooks/useWideVariant.d.ts +1 -0
  137. package/_esm/hooks/{useExpandableVariant.js → useWideVariant.js} +3 -3
  138. package/_esm/hooks/useWideVariant.js.map +1 -0
  139. package/_esm/i18n/en.json +9 -5
  140. package/_esm/i18n/index.js +14 -14
  141. package/_esm/i18n/index.js.map +1 -1
  142. package/_esm/index.d.ts +6 -3
  143. package/_esm/index.js +6 -3
  144. package/_esm/index.js.map +1 -1
  145. package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +9 -2
  146. package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
  147. package/_esm/pages/LanguagesPage.js +1 -0
  148. package/_esm/pages/LanguagesPage.js.map +1 -1
  149. package/_esm/pages/MainPage/MainPage.js +4 -4
  150. package/_esm/pages/MainPage/MainPage.js.map +1 -1
  151. package/_esm/pages/MainPage/ReviewButton.js +2 -2
  152. package/_esm/pages/MainPage/ReviewButton.js.map +1 -1
  153. package/_esm/pages/RoutesPage/RoutesPage.js +1 -8
  154. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  155. package/_esm/pages/RoutesPage/RoutesPage.style.js +1 -1
  156. package/_esm/pages/SelectChainPage/SelectChainPage.js +1 -0
  157. package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
  158. package/_esm/pages/SelectEnabledToolsPage.js +4 -2
  159. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  160. package/_esm/pages/SelectNativeTokenPage.js +1 -0
  161. package/_esm/pages/SelectNativeTokenPage.js.map +1 -1
  162. package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  163. package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  164. package/_esm/pages/SelectTokenPage/SelectTokenPage.js +1 -1
  165. package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
  166. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +1 -0
  167. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
  168. package/_esm/pages/SendToWallet/BookmarkAddressSheet.js +1 -1
  169. package/_esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
  170. package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js +1 -1
  171. package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
  172. package/_esm/pages/SendToWallet/SendToWalletPage.js +3 -1
  173. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  174. package/_esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -10
  175. package/_esm/pages/SendToWallet/SendToWalletPage.style.js +3 -2
  176. package/_esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
  177. package/_esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
  178. package/_esm/pages/SettingsPage/SettingsPage.js +1 -1
  179. package/_esm/pages/SettingsPage/SettingsPage.js.map +1 -1
  180. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +3 -3
  181. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  182. package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js +1 -1
  183. package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
  184. package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +6 -3
  185. package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
  186. package/_esm/pages/TransactionPage/StatusBottomSheet.d.ts +5 -0
  187. package/_esm/pages/TransactionPage/StatusBottomSheet.js +33 -21
  188. package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
  189. package/_esm/pages/TransactionPage/TransactionPage.js +7 -7
  190. package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
  191. package/_esm/providers/ThemeProvider/ThemeProvider.js +1 -1
  192. package/_esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
  193. package/_esm/stores/StoreProvider.js +1 -1
  194. package/_esm/stores/StoreProvider.js.map +1 -1
  195. package/_esm/stores/form/createFormStore.js +1 -6
  196. package/_esm/stores/form/createFormStore.js.map +1 -1
  197. package/_esm/stores/form/types.d.ts +4 -6
  198. package/_esm/stores/form/types.js.map +1 -1
  199. package/_esm/stores/form/useFieldController.d.ts +1 -1
  200. package/_esm/stores/form/useFieldValues.js +1 -1
  201. package/_esm/stores/form/useFieldValues.js.map +1 -1
  202. package/_esm/stores/form/useTouchedFields.d.ts +1 -4
  203. package/_esm/stores/settings/types.d.ts +4 -4
  204. package/_esm/stores/settings/useSettings.d.ts +1 -1
  205. package/_esm/themes/createTheme.d.ts +3 -0
  206. package/_esm/themes/createTheme.js +356 -0
  207. package/_esm/themes/createTheme.js.map +1 -0
  208. package/_esm/themes/jumper.d.ts +2 -0
  209. package/_esm/themes/jumper.js +36 -0
  210. package/_esm/themes/jumper.js.map +1 -0
  211. package/_esm/themes/types.d.ts +49 -0
  212. package/_esm/themes/types.js +2 -0
  213. package/_esm/{components/NFT → themes}/types.js.map +1 -1
  214. package/_esm/themes/utils.d.ts +4 -0
  215. package/_esm/themes/utils.js +9 -0
  216. package/_esm/themes/utils.js.map +1 -0
  217. package/_esm/themes/windows95.d.ts +2 -0
  218. package/_esm/themes/windows95.js +92 -0
  219. package/_esm/themes/windows95.js.map +1 -0
  220. package/_esm/types/events.d.ts +3 -1
  221. package/_esm/types/events.js +1 -0
  222. package/_esm/types/events.js.map +1 -1
  223. package/_esm/types/widget.d.ts +40 -27
  224. package/_esm/types/widget.js.map +1 -1
  225. package/_esm/utils/item.d.ts +1 -1
  226. package/components/ActiveTransactions/ActiveTransactions.tsx +3 -3
  227. package/components/AmountInput/AmountInput.tsx +6 -6
  228. package/components/AppContainer.tsx +2 -2
  229. package/components/Avatar/AccountAvatar.tsx +21 -17
  230. package/components/Avatar/utils.ts +1 -1
  231. package/components/Card/Card.tsx +45 -74
  232. package/components/Card/CardLabel.tsx +15 -3
  233. package/components/Card/InputCard.tsx +7 -0
  234. package/components/ChainSelect/ChainSelect.tsx +6 -2
  235. package/components/ContractComponent/ContractComponent.tsx +2 -2
  236. package/components/ContractComponent/ItemPrice.tsx +33 -0
  237. package/components/{NFT → ContractComponent/NFT}/NFT.tsx +5 -11
  238. package/components/{NFT → ContractComponent/NFT}/NFTBase.tsx +1 -1
  239. package/components/{NFT → ContractComponent/NFT}/types.ts +2 -3
  240. package/components/Dialog.tsx +3 -2
  241. package/components/Header/BackButton.tsx +17 -0
  242. package/components/Header/CloseDrawerButton.tsx +16 -3
  243. package/components/Header/Header.style.ts +25 -16
  244. package/components/Header/NavigationHeader.tsx +8 -11
  245. package/components/Header/NavigationTabs.tsx +1 -1
  246. package/components/Header/TransactionHistoryButton.tsx +0 -1
  247. package/components/Header/WalletHeader.tsx +5 -12
  248. package/components/Header/WalletMenu.tsx +2 -2
  249. package/components/Insurance/types.ts +3 -3
  250. package/components/PageContainer.ts +6 -5
  251. package/components/ReverseTokensButton/ReverseTokensButton.style.tsx +26 -21
  252. package/components/ReverseTokensButton/ReverseTokensButton.tsx +10 -8
  253. package/components/RouteCard/RouteCard.tsx +2 -2
  254. package/components/RouteCard/RouteCardSkeleton.tsx +5 -6
  255. package/components/Routes/Routes.tsx +3 -3
  256. package/components/Routes/RoutesExpanded.style.ts +1 -0
  257. package/components/Routes/RoutesExpanded.tsx +11 -4
  258. package/components/SelectChainAndToken.tsx +7 -13
  259. package/components/SelectTokenButton/SelectTokenButton.style.tsx +51 -1
  260. package/components/SelectTokenButton/SelectTokenButton.tsx +43 -38
  261. package/components/SendToWallet/SendToWalletButton.tsx +8 -8
  262. package/components/Step/Step.tsx +8 -8
  263. package/components/Step/StepList.tsx +1 -1
  264. package/components/StepActions/StepActions.tsx +40 -21
  265. package/components/StepActions/types.ts +12 -2
  266. package/components/TokenList/TokenList.style.tsx +1 -1
  267. package/components/TokenList/TokenList.tsx +9 -6
  268. package/components/TokenList/VirtualizedTokenList.tsx +26 -20
  269. package/components/TokenList/useTokenSelect.ts +1 -1
  270. package/components/TokenList/utils.ts +42 -0
  271. package/config/version.ts +1 -1
  272. package/hooks/useProcessMessage.ts +38 -15
  273. package/hooks/useRoutes.ts +13 -30
  274. package/hooks/{useExpandableVariant.ts → useWideVariant.ts} +2 -2
  275. package/i18n/en.json +9 -5
  276. package/i18n/index.ts +14 -14
  277. package/index.ts +6 -3
  278. package/package.json +15 -15
  279. package/pages/ActiveTransactionsPage/ActiveTransactionsPage.tsx +20 -5
  280. package/pages/LanguagesPage.tsx +1 -0
  281. package/pages/MainPage/MainPage.tsx +12 -10
  282. package/pages/MainPage/ReviewButton.tsx +2 -2
  283. package/pages/RoutesPage/RoutesPage.style.ts +1 -1
  284. package/pages/RoutesPage/RoutesPage.tsx +1 -9
  285. package/pages/SelectChainPage/SelectChainPage.tsx +1 -0
  286. package/pages/SelectEnabledToolsPage.tsx +8 -1
  287. package/pages/SelectNativeTokenPage.tsx +1 -0
  288. package/pages/SelectTokenPage/SearchTokenInput.tsx +3 -3
  289. package/pages/SelectTokenPage/SelectTokenPage.tsx +1 -1
  290. package/pages/SelectWalletPage/SelectWalletPage.tsx +1 -0
  291. package/pages/SendToWallet/BookmarkAddressSheet.tsx +2 -4
  292. package/pages/SendToWallet/SendToConfiguredWalletPage.tsx +1 -0
  293. package/pages/SendToWallet/SendToWalletPage.style.tsx +3 -2
  294. package/pages/SendToWallet/SendToWalletPage.tsx +7 -2
  295. package/pages/SettingsPage/SettingsPage.tsx +1 -1
  296. package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -8
  297. package/pages/TransactionDetailsPage/TransactionDetailsSkeleton.tsx +1 -1
  298. package/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +19 -16
  299. package/pages/TransactionPage/StatusBottomSheet.tsx +101 -78
  300. package/pages/TransactionPage/TransactionPage.tsx +12 -16
  301. package/providers/ThemeProvider/ThemeProvider.tsx +1 -1
  302. package/stores/StoreProvider.tsx +1 -1
  303. package/stores/form/createFormStore.ts +1 -6
  304. package/stores/form/types.ts +4 -6
  305. package/stores/form/useFieldValues.ts +1 -1
  306. package/stores/settings/types.ts +4 -4
  307. package/themes/createTheme.ts +416 -0
  308. package/themes/jumper.ts +37 -0
  309. package/themes/types.ts +63 -0
  310. package/themes/utils.ts +18 -0
  311. package/themes/windows95.ts +98 -0
  312. package/types/events.ts +2 -0
  313. package/types/widget.ts +54 -32
  314. package/_esm/components/NFT/NFT.js.map +0 -1
  315. package/_esm/components/NFT/NFT.style.js.map +0 -1
  316. package/_esm/components/NFT/NFTBase.js.map +0 -1
  317. package/_esm/config/theme.d.ts +0 -27
  318. package/_esm/config/theme.js +0 -250
  319. package/_esm/config/theme.js.map +0 -1
  320. package/_esm/hooks/useExpandableVariant.d.ts +0 -1
  321. package/_esm/hooks/useExpandableVariant.js.map +0 -1
  322. package/config/theme.ts +0 -321
  323. /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.d.ts +0 -0
  324. /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.d.ts +0 -0
  325. /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.js +0 -0
  326. /package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.d.ts +0 -0
  327. /package/_esm/components/{NFT → ContractComponent/NFT}/types.js +0 -0
  328. /package/components/{NFT → ContractComponent/NFT}/NFT.style.ts +0 -0
@@ -11,9 +11,12 @@ import { useFieldValues } from '../../stores/form/useFieldValues.js';
11
11
  import { navigationRoutes } from '../../utils/navigationRoutes.js';
12
12
  import { AvatarBadgedDefault, AvatarBadgedSkeleton } from '../Avatar/Avatar.js';
13
13
  import { TokenAvatar } from '../Avatar/TokenAvatar.js';
14
- import { Card } from '../Card/Card.js';
15
14
  import { CardTitle } from '../Card/CardTitle.js';
16
- import { SelectTokenCardHeader } from './SelectTokenButton.style.js';
15
+ import {
16
+ CardContent,
17
+ SelectTokenCard,
18
+ SelectTokenCardHeader,
19
+ } from './SelectTokenButton.style.js';
17
20
 
18
21
  export const SelectTokenButton: React.FC<
19
22
  FormTypeProps & {
@@ -51,44 +54,46 @@ export const SelectTokenButton: React.FC<
51
54
  ? t('main.selectToken')
52
55
  : t('main.selectChainAndToken');
53
56
  const cardTitle: string =
54
- formType === 'from' && subvariant === 'nft'
57
+ formType === 'from' && subvariant === 'custom'
55
58
  ? t(`header.payWith`)
56
59
  : t(`main.${formType}`);
57
60
  return (
58
- <Card component="button" flex={1} onClick={onClick}>
59
- <CardTitle>{cardTitle}</CardTitle>
60
- {chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (
61
- <SelectTokenCardHeader
62
- avatar={<AvatarBadgedSkeleton />}
63
- title={<Skeleton variant="text" width={64} height={24} />}
64
- subheader={<Skeleton variant="text" width={72} height={16} />}
65
- compact={compact}
66
- />
67
- ) : (
68
- <SelectTokenCardHeader
69
- avatar={
70
- isSelected ? (
71
- <TokenAvatar token={token} chain={chain} />
72
- ) : (
73
- <AvatarBadgedDefault />
74
- )
75
- }
76
- title={isSelected ? token.symbol : defaultPlaceholder}
77
- titleTypographyProps={{
78
- title: isSelected ? token.symbol : defaultPlaceholder,
79
- }}
80
- subheader={isSelected ? chain.name : null}
81
- subheaderTypographyProps={
82
- isSelected
83
- ? {
84
- title: chain.name,
85
- }
86
- : undefined
87
- }
88
- selected={isSelected}
89
- compact={compact}
90
- />
91
- )}
92
- </Card>
61
+ <SelectTokenCard component="button" onClick={onClick}>
62
+ <CardContent formType={formType} compact={compact}>
63
+ <CardTitle>{cardTitle}</CardTitle>
64
+ {chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (
65
+ <SelectTokenCardHeader
66
+ avatar={<AvatarBadgedSkeleton />}
67
+ title={<Skeleton variant="text" width={64} height={24} />}
68
+ subheader={<Skeleton variant="text" width={72} height={16} />}
69
+ compact={compact}
70
+ />
71
+ ) : (
72
+ <SelectTokenCardHeader
73
+ avatar={
74
+ isSelected ? (
75
+ <TokenAvatar token={token} chain={chain} />
76
+ ) : (
77
+ <AvatarBadgedDefault />
78
+ )
79
+ }
80
+ title={isSelected ? token.symbol : defaultPlaceholder}
81
+ titleTypographyProps={{
82
+ title: isSelected ? token.symbol : defaultPlaceholder,
83
+ }}
84
+ subheader={isSelected ? chain.name : null}
85
+ subheaderTypographyProps={
86
+ isSelected
87
+ ? {
88
+ title: chain.name,
89
+ }
90
+ : undefined
91
+ }
92
+ selected={isSelected}
93
+ compact={compact}
94
+ />
95
+ )}
96
+ </CardContent>
97
+ </SelectTokenCard>
93
98
  );
94
99
  };
@@ -1,5 +1,4 @@
1
1
  import { CloseRounded } from '@mui/icons-material';
2
- import type { BoxProps } from '@mui/material';
3
2
  import { Box, Collapse } from '@mui/material';
4
3
  import type { MouseEventHandler } from 'react';
5
4
  import { useTranslation } from 'react-i18next';
@@ -20,12 +19,13 @@ import {
20
19
  import { navigationRoutes } from '../../utils/navigationRoutes.js';
21
20
  import { shortenAddress } from '../../utils/wallet.js';
22
21
  import { AccountAvatar } from '../Avatar/AccountAvatar.js';
22
+ import type { CardProps } from '../Card/Card.js';
23
23
  import { Card } from '../Card/Card.js';
24
24
  import { CardIconButton } from '../Card/CardIconButton.js';
25
25
  import { CardTitle } from '../Card/CardTitle.js';
26
26
  import { SendToWalletCardHeader } from './SendToWallet.style.js';
27
27
 
28
- export const SendToWalletButton: React.FC<BoxProps> = (props) => {
28
+ export const SendToWalletButton: React.FC<CardProps> = (props) => {
29
29
  const { t } = useTranslation();
30
30
  const navigate = useNavigate();
31
31
  const { disabledUI, hiddenUI, toAddress, toAddresses } = useWidgetConfig();
@@ -86,10 +86,10 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
86
86
  const headerSubheader =
87
87
  isConnectedAccount || bookmarkName || connectedAccountName ? address : null;
88
88
 
89
- const isSelected = !!toAddressFieldValue && !(toAddress && disabledToAddress);
90
-
91
89
  const disabledForChanges = Boolean(toAddress) && disabledToAddress;
92
90
 
91
+ const isSelected = !!toAddressFieldValue && !disabledForChanges;
92
+
93
93
  const handleOnClick = () => {
94
94
  navigate(
95
95
  toAddresses?.length
@@ -114,8 +114,7 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
114
114
  <Card
115
115
  component="button"
116
116
  onClick={disabledForChanges ? undefined : handleOnClick}
117
- width="100%"
118
- {...props}
117
+ sx={{ width: '100%', ...props.sx }}
119
118
  >
120
119
  <CardTitle required={requiredToAddress}>
121
120
  {t('header.sendToWallet')}
@@ -126,14 +125,15 @@ export const SendToWalletButton: React.FC<BoxProps> = (props) => {
126
125
  <AccountAvatar
127
126
  chainId={chainId}
128
127
  account={matchingConnectedAccount}
128
+ toAddress={toAddress}
129
129
  empty={!toAddressFieldValue}
130
130
  />
131
131
  }
132
132
  title={headerTitle}
133
133
  subheader={headerSubheader}
134
- selected={isSelected}
134
+ selected={isSelected || disabledForChanges}
135
135
  action={
136
- isSelected && !disabledForChanges ? (
136
+ isSelected ? (
137
137
  <CardIconButton onClick={clearSelectedBookmark} size="small">
138
138
  <CloseRounded fontSize="inherit" />
139
139
  </CardIconButton>
@@ -30,27 +30,27 @@ export const Step: React.FC<{
30
30
  const getCardTitle = () => {
31
31
  switch (step.type) {
32
32
  case 'lifi':
33
- const hasCrossStep = step.includedSteps.some(
33
+ const hasBridgeStep = step.includedSteps.some(
34
34
  (step) => step.type === 'cross',
35
35
  );
36
36
  const hasSwapStep = step.includedSteps.some(
37
37
  (step) => step.type === 'swap',
38
38
  );
39
- if (hasCrossStep && hasSwapStep) {
40
- return subvariant === 'nft'
39
+ if (hasBridgeStep && hasSwapStep) {
40
+ return subvariant === 'custom'
41
41
  ? t('main.stepBridgeAndBuy')
42
42
  : t('main.stepSwapAndBridge');
43
43
  }
44
- if (hasCrossStep) {
45
- return subvariant === 'nft'
44
+ if (hasBridgeStep) {
45
+ return subvariant === 'custom'
46
46
  ? t('main.stepBridgeAndBuy')
47
47
  : t('main.stepBridge');
48
48
  }
49
- return subvariant === 'nft'
49
+ return subvariant === 'custom'
50
50
  ? t('main.stepSwapAndBuy')
51
51
  : t('main.stepSwap');
52
52
  default:
53
- return subvariant === 'nft'
53
+ return subvariant === 'custom'
54
54
  ? t('main.stepSwapAndBuy')
55
55
  : t('main.stepSwap');
56
56
  }
@@ -64,7 +64,7 @@ export const Step: React.FC<{
64
64
  : undefined;
65
65
 
66
66
  return (
67
- <Card variant={stepHasError ? 'error' : 'default'}>
67
+ <Card type={stepHasError ? 'error' : 'default'}>
68
68
  <Box
69
69
  sx={{
70
70
  display: 'flex',
@@ -20,7 +20,7 @@ export const getStepList = (
20
20
  ...(step.execution?.toToken ?? step.action?.toToken),
21
21
  amount: step.execution?.toAmount
22
22
  ? BigInt(step.execution.toAmount)
23
- : subvariant === 'nft'
23
+ : subvariant === 'custom'
24
24
  ? BigInt(route.toAmount)
25
25
  : BigInt(step.estimate.toAmount),
26
26
  }
@@ -16,7 +16,6 @@ import { formatUnits } from 'viem';
16
16
  import { useAvailableChains } from '../../hooks/useAvailableChains.js';
17
17
  import { LiFiToolLogo } from '../../icons/lifi.js';
18
18
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
19
- import type { WidgetSubvariant } from '../../types/widget.js';
20
19
  import { formatTokenAmount } from '../../utils/format.js';
21
20
  import { CardIconButton } from '../Card/CardIconButton.js';
22
21
  import { SmallAvatar } from '../SmallAvatar.js';
@@ -29,7 +28,11 @@ import {
29
28
  } from './StepActions.style.js';
30
29
  import { StepFeeBreakdown } from './StepFeeBreakdown.js';
31
30
  import { StepFees } from './StepFees.js';
32
- import type { StepActionsProps, StepDetailsLabelProps } from './types.js';
31
+ import type {
32
+ IncludedStepsProps,
33
+ StepActionsProps,
34
+ StepDetailsLabelProps,
35
+ } from './types.js';
33
36
 
34
37
  export const StepActions: React.FC<StepActionsProps> = ({
35
38
  step,
@@ -37,7 +40,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
37
40
  ...other
38
41
  }) => {
39
42
  const { t } = useTranslation();
40
- const { subvariant } = useWidgetConfig();
43
+ const { subvariant, subvariantOptions } = useWidgetConfig();
41
44
  const [cardExpanded, setCardExpanded] = useState(false);
42
45
 
43
46
  const handleExpand: MouseEventHandler<HTMLButtonElement> = (e) => {
@@ -47,7 +50,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
47
50
 
48
51
  // FIXME: step transaction request overrides step tool details, but not included step tool details
49
52
  const toolDetails =
50
- subvariant === 'nft'
53
+ subvariant === 'custom'
51
54
  ? step.includedSteps.find(
52
55
  (step) => step.tool === 'custom' && step.toolDetails.key !== 'custom',
53
56
  )?.toolDetails || step.toolDetails
@@ -70,7 +73,7 @@ export const StepActions: React.FC<StepActionsProps> = ({
70
73
  </StepAvatar>
71
74
  </Badge>
72
75
  <Box flex={1}>
73
- <Typography fontSize={18} fontWeight="500" lineHeight={1.3334} ml={2}>
76
+ <Typography fontSize={18} fontWeight={600} lineHeight={1.3334} ml={2}>
74
77
  {t(`main.stepDetails`, {
75
78
  tool: toolDetails.name,
76
79
  })}
@@ -92,20 +95,29 @@ export const StepActions: React.FC<StepActionsProps> = ({
92
95
  </Box>
93
96
  {dense ? (
94
97
  <Collapse timeout={225} in={cardExpanded} mountOnEnter unmountOnExit>
95
- <IncludedSteps step={step} subvariant={subvariant} />
98
+ <IncludedSteps
99
+ step={step}
100
+ subvariant={subvariant}
101
+ subvariantOptions={subvariantOptions}
102
+ />
96
103
  <StepFeeBreakdown step={step} />
97
104
  </Collapse>
98
105
  ) : (
99
- <IncludedSteps step={step} subvariant={subvariant} />
106
+ <IncludedSteps
107
+ step={step}
108
+ subvariant={subvariant}
109
+ subvariantOptions={subvariantOptions}
110
+ />
100
111
  )}
101
112
  </Box>
102
113
  );
103
114
  };
104
115
 
105
- export const IncludedSteps: React.FC<{
106
- step: LiFiStep;
107
- subvariant?: WidgetSubvariant;
108
- }> = ({ step, subvariant }) => {
116
+ export const IncludedSteps: React.FC<IncludedStepsProps> = ({
117
+ step,
118
+ subvariant,
119
+ subvariantOptions,
120
+ }) => {
109
121
  // eslint-disable-next-line react/no-unstable-nested-components
110
122
  const StepIconComponent = ({ icon }: StepIconProps) => {
111
123
  const tool = step.includedSteps?.[Number(icon) - 1];
@@ -129,10 +141,14 @@ export const IncludedSteps: React.FC<{
129
141
  {step.includedSteps.map((step, i, includedSteps) => (
130
142
  <MuiStep key={step.id} expanded>
131
143
  <StepLabel StepIconComponent={StepIconComponent}>
132
- {step.type === 'custom' && subvariant === 'nft' ? (
133
- <CustomStepDetailsLabel step={step} subvariant={subvariant} />
144
+ {step.type === 'custom' && subvariant === 'custom' ? (
145
+ <CustomStepDetailsLabel
146
+ step={step}
147
+ subvariant={subvariant}
148
+ subvariantOptions={subvariantOptions}
149
+ />
134
150
  ) : step.type === 'cross' ? (
135
- <CrossStepDetailsLabel step={step} />
151
+ <BridgeStepDetailsLabel step={step} />
136
152
  ) : step.type === 'protocol' ? (
137
153
  <ProtocolStepDetailsLabel step={step} />
138
154
  ) : (
@@ -140,7 +156,7 @@ export const IncludedSteps: React.FC<{
140
156
  )}
141
157
  </StepLabel>
142
158
  <StepContent last={i === includedSteps.length - 1}>
143
- <StepDetailsContent step={step} subvariant={subvariant} />
159
+ <StepDetailsContent step={step} />
144
160
  </StepContent>
145
161
  </MuiStep>
146
162
  ))}
@@ -151,8 +167,7 @@ export const IncludedSteps: React.FC<{
151
167
 
152
168
  export const StepDetailsContent: React.FC<{
153
169
  step: StepExtended;
154
- subvariant?: WidgetSubvariant;
155
- }> = ({ step, subvariant }) => {
170
+ }> = ({ step }) => {
156
171
  const { t } = useTranslation();
157
172
 
158
173
  const sameTokenProtocolStep =
@@ -228,6 +243,7 @@ export const StepDetailsContent: React.FC<{
228
243
  export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
229
244
  step,
230
245
  subvariant,
246
+ subvariantOptions,
231
247
  }) => {
232
248
  const { t } = useTranslation();
233
249
 
@@ -237,30 +253,33 @@ export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
237
253
 
238
254
  // FIXME: step transaction request overrides step tool details, but not included step tool details
239
255
  const toolDetails =
240
- subvariant === 'nft' &&
256
+ subvariant === 'custom' &&
241
257
  (step as unknown as LiFiStep).includedSteps?.length > 0
242
258
  ? (step as unknown as LiFiStep).includedSteps.find(
243
259
  (step) => step.tool === 'custom' && step.toolDetails.key !== 'custom',
244
260
  )?.toolDetails || step.toolDetails
245
261
  : step.toolDetails;
246
262
 
263
+ const stepDetailsKey =
264
+ (subvariant === 'custom' && subvariantOptions?.custom) || 'checkout';
265
+
247
266
  return (
248
267
  <StepLabelTypography>
249
- {t(`main.${subvariant}StepDetails`, {
268
+ {t(`main.${stepDetailsKey}StepDetails`, {
250
269
  tool: toolDetails.name,
251
270
  })}
252
271
  </StepLabelTypography>
253
272
  );
254
273
  };
255
274
 
256
- export const CrossStepDetailsLabel: React.FC<
275
+ export const BridgeStepDetailsLabel: React.FC<
257
276
  Omit<StepDetailsLabelProps, 'variant'>
258
277
  > = ({ step }) => {
259
278
  const { t } = useTranslation();
260
279
  const { getChainById } = useAvailableChains();
261
280
  return (
262
281
  <StepLabelTypography>
263
- {t('main.crossStepDetails', {
282
+ {t('main.bridgeStepDetails', {
264
283
  from: getChainById(step.action.fromChainId)?.name,
265
284
  to: getChainById(step.action.toChainId)?.name,
266
285
  tool: step.toolDetails.name,
@@ -1,6 +1,9 @@
1
1
  import type { LiFiStep, Step } from '@lifi/sdk';
2
2
  import type { BoxProps } from '@mui/material';
3
- import type { WidgetSubvariant } from '../../types/widget.js';
3
+ import type {
4
+ SubvariantOptions,
5
+ WidgetSubvariant,
6
+ } from '../../types/widget.js';
4
7
 
5
8
  export interface StepActionsProps extends BoxProps {
6
9
  step: LiFiStep;
@@ -9,5 +12,12 @@ export interface StepActionsProps extends BoxProps {
9
12
 
10
13
  export interface StepDetailsLabelProps {
11
14
  step: Step;
12
- subvariant?: Extract<WidgetSubvariant, 'nft'>;
15
+ subvariant?: Extract<WidgetSubvariant, 'custom'>;
16
+ subvariantOptions?: SubvariantOptions;
17
+ }
18
+
19
+ export interface IncludedStepsProps {
20
+ step: LiFiStep;
21
+ subvariant?: WidgetSubvariant;
22
+ subvariantOptions?: SubvariantOptions;
13
23
  }
@@ -19,7 +19,7 @@ export const IconButton = styled(MuiIconButton)<IconButtonProps & LinkProps>(
19
19
  color: 'inherit',
20
20
  backgroundColor: 'unset',
21
21
  minWidth: 'unset',
22
- borderRadius: '50%',
22
+ borderRadius: theme.shape.borderRadiusTertiary,
23
23
  '&:hover': {
24
24
  backgroundColor: getContrastAlphaColor(theme, 0.04),
25
25
  },
@@ -13,6 +13,7 @@ import { TokenNotFound } from './TokenNotFound.js';
13
13
  import { VirtualizedTokenList } from './VirtualizedTokenList.js';
14
14
  import type { TokenListProps } from './types.js';
15
15
  import { useTokenSelect } from './useTokenSelect.js';
16
+ import { filteredTokensComparator } from './utils.js';
16
17
 
17
18
  export const TokenList: FC<TokenListProps> = ({
18
19
  formType,
@@ -45,12 +46,14 @@ export const TokenList: FC<TokenListProps> = ({
45
46
  const searchFilter = normalizedSearchFilter?.toUpperCase() ?? '';
46
47
 
47
48
  filteredTokens = tokenSearchFilter
48
- ? filteredTokens.filter(
49
- (token) =>
50
- token.name?.toUpperCase().includes(searchFilter) ||
51
- token.symbol.toUpperCase().includes(searchFilter) ||
52
- token.address.toUpperCase().includes(searchFilter),
53
- )
49
+ ? filteredTokens
50
+ .filter(
51
+ (token) =>
52
+ token.name?.toUpperCase().includes(searchFilter) ||
53
+ token.symbol.toUpperCase().includes(searchFilter) ||
54
+ token.address.toUpperCase().includes(searchFilter),
55
+ )
56
+ .sort(filteredTokensComparator(searchFilter))
54
57
  : filteredTokens;
55
58
 
56
59
  const tokenSearchEnabled =
@@ -81,36 +81,42 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
81
81
  const previousToken: TokenAmount | undefined = tokens[item.index - 1];
82
82
 
83
83
  const isFirstFeaturedToken = currentToken.featured && item.index === 0;
84
+
84
85
  const isTransitionFromFeaturedTokens =
85
86
  previousToken?.featured && !currentToken.featured;
87
+
86
88
  const isTransitionFromMyTokens =
87
89
  previousToken?.amount && !currentToken.amount;
90
+
88
91
  const isTransitionToMyTokens =
89
92
  isTransitionFromFeaturedTokens && currentToken.amount;
93
+
90
94
  const isTransitionToPopularTokens =
91
95
  (isTransitionFromFeaturedTokens || isTransitionFromMyTokens) &&
92
96
  currentToken.popular;
97
+
93
98
  const shouldShowAllTokensCategory =
94
- (isTransitionFromMyTokens ||
95
- isTransitionFromFeaturedTokens ||
96
- (previousToken?.popular && !currentToken.popular)) &&
97
- showCategories;
98
-
99
- const startAdornmentLabel = (() => {
100
- if (isFirstFeaturedToken) {
101
- return t('main.featuredTokens');
102
- }
103
- if (isTransitionToMyTokens) {
104
- return t('main.myTokens');
105
- }
106
- if (isTransitionToPopularTokens) {
107
- return t('main.popularTokens');
108
- }
109
- if (shouldShowAllTokensCategory) {
110
- return t('main.allTokens');
111
- }
112
- return null;
113
- })();
99
+ isTransitionFromMyTokens ||
100
+ isTransitionFromFeaturedTokens ||
101
+ (previousToken?.popular && !currentToken.popular);
102
+
103
+ const startAdornmentLabel = showCategories
104
+ ? (() => {
105
+ if (isFirstFeaturedToken) {
106
+ return t('main.featuredTokens');
107
+ }
108
+ if (isTransitionToMyTokens) {
109
+ return t('main.myTokens');
110
+ }
111
+ if (isTransitionToPopularTokens) {
112
+ return t('main.popularTokens');
113
+ }
114
+ if (shouldShowAllTokensCategory) {
115
+ return t('main.allTokens');
116
+ }
117
+ return null;
118
+ })()
119
+ : null;
114
120
 
115
121
  return (
116
122
  <TokenListItem
@@ -33,7 +33,7 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => {
33
33
  if (
34
34
  selectedOppositeToken === tokenAddress &&
35
35
  selectedOppositeChainId === selectedChainId &&
36
- subvariant !== 'nft'
36
+ subvariant !== 'custom'
37
37
  ) {
38
38
  setFieldValue(FormKeyHelper.getTokenKey(oppositeFormType), '', {
39
39
  isDirty: true,
@@ -0,0 +1,42 @@
1
+ import type { TokenAmount } from '../../types/token.js';
2
+
3
+ export const filteredTokensComparator = (searchFilter: string) => {
4
+ const isExactMatch = (token: TokenAmount) => {
5
+ return (
6
+ token.name?.toUpperCase() === searchFilter ||
7
+ token.symbol.toUpperCase() === searchFilter ||
8
+ token.address.toUpperCase() === searchFilter
9
+ );
10
+ };
11
+ return (tokenA: TokenAmount, tokenB: TokenAmount) => {
12
+ const isExactMatchA = isExactMatch(tokenA);
13
+ const isExactMatchB = isExactMatch(tokenB);
14
+
15
+ // Exact match with logo
16
+ if (isExactMatchB && tokenB.logoURI) {
17
+ return 1;
18
+ }
19
+ if (isExactMatchA && tokenA.logoURI) {
20
+ return -1;
21
+ }
22
+
23
+ // Any token with a logo (exact match or not)
24
+ if (tokenB.logoURI && !tokenA.logoURI) {
25
+ return 1;
26
+ }
27
+ if (tokenA.logoURI && !tokenB.logoURI) {
28
+ return -1;
29
+ }
30
+
31
+ // Exact match without logo
32
+ if (isExactMatchB && !tokenB.logoURI) {
33
+ return 1;
34
+ }
35
+ if (isExactMatchA && !tokenA.logoURI) {
36
+ return -1;
37
+ }
38
+
39
+ // All other tokens are considered equal in sorting priority
40
+ return 0;
41
+ };
42
+ };
package/config/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '3.0.0-alpha.33';
2
+ export const version = '3.0.0-alpha.35';
@@ -11,24 +11,38 @@ import { LiFiErrorCode } from '@lifi/sdk';
11
11
  import type { TFunction } from 'i18next';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
14
- import type { WidgetSubvariant } from '../types/widget.js';
14
+ import type { SubvariantOptions, WidgetSubvariant } from '../types/widget.js';
15
15
  import { formatTokenAmount } from '../utils/format.js';
16
16
  import { useAvailableChains } from './useAvailableChains.js';
17
17
 
18
18
  export const useProcessMessage = (step?: LiFiStep, process?: Process) => {
19
- const { subvariant } = useWidgetConfig();
19
+ const { subvariant, subvariantOptions } = useWidgetConfig();
20
20
  const { t } = useTranslation();
21
21
  const { getChainById } = useAvailableChains();
22
22
  if (!step || !process) {
23
23
  return {};
24
24
  }
25
- return getProcessMessage(t, getChainById, step, process, subvariant);
25
+ return getProcessMessage(
26
+ t,
27
+ getChainById,
28
+ step,
29
+ process,
30
+ subvariant,
31
+ subvariantOptions,
32
+ );
26
33
  };
27
34
 
28
35
  const processStatusMessages: Record<
29
36
  ProcessType,
30
37
  Partial<
31
- Record<Status, (t: TFunction, subvariant?: WidgetSubvariant) => string>
38
+ Record<
39
+ Status,
40
+ (
41
+ t: TFunction,
42
+ subvariant?: WidgetSubvariant,
43
+ subvariantOptions?: SubvariantOptions,
44
+ ) => string
45
+ >
32
46
  >
33
47
  > = {
34
48
  TOKEN_ALLOWANCE: {
@@ -45,22 +59,26 @@ const processStatusMessages: Record<
45
59
  STARTED: (t) => t(`main.process.swap.started`),
46
60
  ACTION_REQUIRED: (t) => t(`main.process.swap.actionRequired`),
47
61
  PENDING: (t) => t(`main.process.swap.pending`),
48
- DONE: (t, subvariant) =>
49
- subvariant === 'nft'
50
- ? t(`main.process.nft.done`)
62
+ DONE: (t, subvariant, subvariantOptions) =>
63
+ subvariant === 'custom'
64
+ ? subvariantOptions?.custom
65
+ ? t(`main.process.${subvariantOptions?.custom}.done`)
66
+ : t(`main.process.checkout.done`)
51
67
  : t(`main.process.swap.done`),
52
68
  },
53
69
  CROSS_CHAIN: {
54
- STARTED: (t) => t(`main.process.crossChain.started`),
55
- ACTION_REQUIRED: (t) => t(`main.process.crossChain.actionRequired`),
56
- PENDING: (t) => t(`main.process.crossChain.pending`),
57
- DONE: (t) => t(`main.process.crossChain.done`),
70
+ STARTED: (t) => t(`main.process.bridge.started`),
71
+ ACTION_REQUIRED: (t) => t(`main.process.bridge.actionRequired`),
72
+ PENDING: (t) => t(`main.process.bridge.pending`),
73
+ DONE: (t) => t(`main.process.bridge.done`),
58
74
  },
59
75
  RECEIVING_CHAIN: {
60
76
  PENDING: (t) => t(`main.process.receivingChain.pending`),
61
- DONE: (t, subvariant) =>
62
- subvariant === 'nft'
63
- ? t(`main.process.nft.done`)
77
+ DONE: (t, subvariant, subvariantOptions) =>
78
+ subvariant === 'custom'
79
+ ? subvariantOptions?.custom
80
+ ? t(`main.process.${subvariantOptions?.custom}.done`)
81
+ : t(`main.process.checkout.done`)
64
82
  : t(`main.process.receivingChain.done`),
65
83
  },
66
84
  TRANSACTION: {},
@@ -102,6 +120,7 @@ export function getProcessMessage(
102
120
  step: LiFiStep,
103
121
  process: Process,
104
122
  subvariant?: WidgetSubvariant,
123
+ subvariantOptions?: SubvariantOptions,
105
124
  ): {
106
125
  title?: string;
107
126
  message?: string;
@@ -197,6 +216,10 @@ export function getProcessMessage(
197
216
  processSubstatusMessages[process.status as StatusMessage]?.[
198
217
  process.substatus!
199
218
  ]?.(t) ??
200
- processStatusMessages[process.type]?.[process.status]?.(t, subvariant);
219
+ processStatusMessages[process.type]?.[process.status]?.(
220
+ t,
221
+ subvariant,
222
+ subvariantOptions,
223
+ );
201
224
  return { title };
202
225
  }