@lifi/widget 2.0.0-beta.1 → 2.0.0-beta.10

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 (283) hide show
  1. package/App.d.ts +4 -3
  2. package/AppDrawer.d.ts +1 -1
  3. package/AppDrawer.js +2 -1
  4. package/AppProvider.js +1 -1
  5. package/README.md +11 -12
  6. package/cjs/App.d.ts +4 -3
  7. package/cjs/AppDrawer.d.ts +1 -1
  8. package/cjs/AppDrawer.js +2 -1
  9. package/cjs/AppProvider.js +1 -1
  10. package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -2
  11. package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
  12. package/cjs/components/ChainSelect/useChainSelect.js +6 -0
  13. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
  14. package/cjs/components/GasMessage/GasMessage.js +1 -6
  15. package/cjs/components/Header/Header.js +2 -2
  16. package/cjs/components/Header/Header.style.d.ts +10 -3
  17. package/cjs/components/Header/Header.style.js +3 -0
  18. package/cjs/components/Header/NavigationHeader.js +23 -7
  19. package/cjs/components/Header/NavigationTabs.d.ts +1 -0
  20. package/cjs/components/Header/NavigationTabs.js +26 -0
  21. package/cjs/components/Header/NavigationTabs.style.d.ts +34 -0
  22. package/cjs/components/Header/NavigationTabs.style.js +61 -0
  23. package/cjs/components/Header/WalletHeader.d.ts +1 -0
  24. package/cjs/components/Header/WalletHeader.js +16 -9
  25. package/cjs/components/Header/useHeaderActionStore.js +0 -1
  26. package/cjs/components/Insurance/Insurance.js +2 -2
  27. package/cjs/components/Insurance/InsuranceCard.js +34 -12
  28. package/cjs/components/Insurance/InsuranceCollapsed.js +9 -11
  29. package/cjs/components/Insurance/index.d.ts +1 -0
  30. package/cjs/components/Insurance/index.js +1 -0
  31. package/cjs/components/Insurance/types.d.ts +12 -9
  32. package/cjs/components/NFT/NFT.js +2 -2
  33. package/cjs/components/NFT/types.d.ts +1 -1
  34. package/cjs/components/PoweredBy/PoweredBy.js +2 -3
  35. package/cjs/components/SelectChainAndToken.js +8 -7
  36. package/cjs/components/SelectTokenButton/SelectTokenButton.js +6 -3
  37. package/cjs/components/SendToWallet/SendToWallet.js +2 -2
  38. package/cjs/components/SmallAvatar.d.ts +1 -1
  39. package/cjs/components/Step/CircularProgress.d.ts +1 -2
  40. package/cjs/components/Step/Step.js +15 -5
  41. package/cjs/components/Step/StepList.d.ts +1 -2
  42. package/cjs/components/StepActions/StepActions.js +4 -20
  43. package/cjs/components/SwapButton/SwapButton.js +16 -4
  44. package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
  45. package/cjs/components/SwapInput/SwapInput.js +2 -2
  46. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
  47. package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -2
  48. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -3
  49. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  50. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  51. package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
  52. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
  53. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  54. package/cjs/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
  55. package/cjs/components/Token/Token.js +1 -1
  56. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  57. package/cjs/components/TokenList/TokenList.js +9 -4
  58. package/cjs/components/TokenList/TokenList.style.d.ts +5 -2
  59. package/cjs/components/TokenList/TokenList.style.js +20 -1
  60. package/cjs/components/TokenList/TokenListItem.d.ts +1 -1
  61. package/cjs/components/TokenList/TokenListItem.js +28 -5
  62. package/cjs/components/TokenList/VirtualizedTokenList.js +3 -3
  63. package/cjs/components/TokenList/types.d.ts +6 -3
  64. package/cjs/config/theme.js +15 -3
  65. package/cjs/config/version.d.ts +1 -1
  66. package/cjs/config/version.js +1 -1
  67. package/cjs/hooks/index.d.ts +2 -1
  68. package/cjs/hooks/index.js +2 -1
  69. package/cjs/hooks/useContentHeight.js +3 -5
  70. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  71. package/cjs/hooks/useFundsSufficiency.js +2 -2
  72. package/cjs/hooks/useGasRefuel.d.ts +1 -1
  73. package/cjs/hooks/useGasRefuel.js +5 -15
  74. package/cjs/hooks/useGasSufficiency.js +12 -3
  75. package/cjs/hooks/useInitializer.js +0 -1
  76. package/cjs/hooks/useProcessMessage.d.ts +2 -1
  77. package/cjs/hooks/useProcessMessage.js +27 -9
  78. package/cjs/hooks/useRouteExecution.js +6 -5
  79. package/cjs/hooks/useSwapOnly.d.ts +1 -0
  80. package/cjs/hooks/useSwapOnly.js +9 -0
  81. package/cjs/hooks/useSwapRoutes.d.ts +1 -2
  82. package/cjs/hooks/useSwapRoutes.js +32 -18
  83. package/cjs/hooks/useToken.d.ts +1 -1
  84. package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
  85. package/cjs/hooks/useTokenBalance.js +6 -7
  86. package/cjs/hooks/useTokenBalances.d.ts +5 -5
  87. package/cjs/hooks/useTokenBalances.js +4 -19
  88. package/cjs/hooks/useTokenSearch.d.ts +2 -2
  89. package/cjs/hooks/useTokens.d.ts +2 -2
  90. package/cjs/i18n/bn.json +8 -0
  91. package/cjs/i18n/en.json +30 -5
  92. package/cjs/i18n/fr.json +8 -0
  93. package/cjs/i18n/id.json +22 -7
  94. package/cjs/i18n/ko.json +22 -7
  95. package/cjs/i18n/pt.json +32 -7
  96. package/cjs/i18n/th.json +21 -6
  97. package/cjs/i18n/uk.json +43 -18
  98. package/cjs/i18n/zh.json +23 -8
  99. package/cjs/icons/InsuraceLogo.d.ts +1 -1
  100. package/cjs/icons/LiFiFullLogo.d.ts +1 -1
  101. package/cjs/icons/LiFiLogo.d.ts +1 -1
  102. package/cjs/icons/LiFiToolLogo.d.ts +1 -1
  103. package/cjs/index.d.ts +1 -1
  104. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
  105. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
  106. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +3 -1
  107. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
  108. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
  109. package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
  110. package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -2
  111. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
  112. package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -2
  113. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
  114. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
  115. package/cjs/pages/SwapPage/StatusBottomSheet.js +15 -9
  116. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  117. package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
  118. package/cjs/pages/SwapPage/SwapPage.js +31 -10
  119. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +7 -12
  120. package/cjs/pages/SwapPage/utils.d.ts +2 -0
  121. package/cjs/pages/SwapPage/utils.js +10 -0
  122. package/cjs/providers/I18nProvider/I18nProvider.js +3 -3
  123. package/cjs/providers/SDKProvider/SDKProvider.js +2 -0
  124. package/cjs/providers/SwapFormProvider/FormUpdater.js +3 -0
  125. package/cjs/providers/WalletProvider/WalletProvider.js +77 -49
  126. package/cjs/providers/WalletProvider/types.d.ts +3 -5
  127. package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
  128. package/cjs/stores/StoreProvider.d.ts +2 -2
  129. package/cjs/stores/StoreProvider.js +3 -2
  130. package/cjs/stores/routes/RouteExecutionStore.d.ts +1 -1
  131. package/cjs/stores/routes/RouteExecutionStore.js +0 -1
  132. package/cjs/stores/settings/index.d.ts +1 -0
  133. package/cjs/stores/settings/index.js +1 -0
  134. package/cjs/stores/settings/types.d.ts +11 -0
  135. package/cjs/stores/settings/useSplitSubvariantStore.d.ts +7 -0
  136. package/cjs/stores/settings/useSplitSubvariantStore.js +44 -0
  137. package/cjs/types/events.d.ts +9 -1
  138. package/cjs/types/events.js +1 -0
  139. package/cjs/types/token.d.ts +2 -2
  140. package/cjs/types/widget.d.ts +13 -8
  141. package/cjs/types/widget.js +4 -2
  142. package/cjs/utils/format.d.ts +1 -1
  143. package/cjs/utils/format.js +7 -12
  144. package/cjs/utils/wallet.d.ts +1 -1
  145. package/cjs/utils/wallet.js +3 -3
  146. package/components/ChainSelect/ChainSelect.d.ts +1 -2
  147. package/components/ChainSelect/ChainSelect.style.js +1 -1
  148. package/components/ChainSelect/useChainSelect.js +7 -1
  149. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
  150. package/components/GasMessage/GasMessage.js +2 -7
  151. package/components/Header/Header.js +3 -3
  152. package/components/Header/Header.style.d.ts +10 -3
  153. package/components/Header/Header.style.js +3 -0
  154. package/components/Header/NavigationHeader.js +23 -7
  155. package/components/Header/NavigationTabs.d.ts +1 -0
  156. package/components/Header/NavigationTabs.js +22 -0
  157. package/components/Header/NavigationTabs.style.d.ts +34 -0
  158. package/components/Header/NavigationTabs.style.js +58 -0
  159. package/components/Header/WalletHeader.d.ts +1 -0
  160. package/components/Header/WalletHeader.js +14 -8
  161. package/components/Header/useHeaderActionStore.js +0 -1
  162. package/components/Insurance/Insurance.js +2 -2
  163. package/components/Insurance/InsuranceCard.js +37 -15
  164. package/components/Insurance/InsuranceCollapsed.js +9 -11
  165. package/components/Insurance/index.d.ts +1 -0
  166. package/components/Insurance/index.js +1 -0
  167. package/components/Insurance/types.d.ts +12 -9
  168. package/components/NFT/NFT.js +2 -2
  169. package/components/NFT/types.d.ts +1 -1
  170. package/components/PoweredBy/PoweredBy.js +2 -3
  171. package/components/SelectChainAndToken.js +9 -8
  172. package/components/SelectTokenButton/SelectTokenButton.js +7 -4
  173. package/components/SendToWallet/SendToWallet.js +2 -2
  174. package/components/SmallAvatar.d.ts +1 -1
  175. package/components/Step/CircularProgress.d.ts +1 -2
  176. package/components/Step/Step.js +16 -6
  177. package/components/Step/StepList.d.ts +1 -2
  178. package/components/StepActions/StepActions.js +4 -20
  179. package/components/SwapButton/SwapButton.js +16 -4
  180. package/components/SwapInput/FormPriceHelperText.js +2 -2
  181. package/components/SwapInput/SwapInput.js +3 -3
  182. package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
  183. package/components/SwapInput/SwapInputEndAdornment.js +2 -2
  184. package/components/SwapRouteCard/SwapRouteCard.js +21 -5
  185. package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  186. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  187. package/components/SwapRoutes/SwapRoutes.js +1 -1
  188. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
  189. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  190. package/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
  191. package/components/Token/Token.js +1 -1
  192. package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  193. package/components/TokenList/TokenList.js +10 -5
  194. package/components/TokenList/TokenList.style.d.ts +5 -2
  195. package/components/TokenList/TokenList.style.js +21 -2
  196. package/components/TokenList/TokenListItem.d.ts +1 -1
  197. package/components/TokenList/TokenListItem.js +32 -9
  198. package/components/TokenList/VirtualizedTokenList.js +3 -3
  199. package/components/TokenList/types.d.ts +6 -3
  200. package/config/theme.js +15 -3
  201. package/config/version.d.ts +1 -1
  202. package/config/version.js +1 -1
  203. package/hooks/index.d.ts +2 -1
  204. package/hooks/index.js +2 -1
  205. package/hooks/useContentHeight.js +4 -6
  206. package/hooks/useFeaturedTokens.d.ts +1 -1
  207. package/hooks/useFundsSufficiency.js +2 -2
  208. package/hooks/useGasRefuel.d.ts +1 -1
  209. package/hooks/useGasRefuel.js +5 -15
  210. package/hooks/useGasSufficiency.js +13 -4
  211. package/hooks/useInitializer.js +0 -1
  212. package/hooks/useProcessMessage.d.ts +2 -1
  213. package/hooks/useProcessMessage.js +27 -9
  214. package/hooks/useRouteExecution.js +6 -5
  215. package/hooks/useSwapOnly.d.ts +1 -0
  216. package/hooks/useSwapOnly.js +5 -0
  217. package/hooks/useSwapRoutes.d.ts +1 -2
  218. package/hooks/useSwapRoutes.js +32 -18
  219. package/hooks/useToken.d.ts +1 -1
  220. package/hooks/useTokenAddressBalance.d.ts +2 -2
  221. package/hooks/useTokenBalance.js +6 -7
  222. package/hooks/useTokenBalances.d.ts +5 -5
  223. package/hooks/useTokenBalances.js +4 -19
  224. package/hooks/useTokenSearch.d.ts +2 -2
  225. package/hooks/useTokens.d.ts +2 -2
  226. package/i18n/bn.json +8 -0
  227. package/i18n/en.json +30 -5
  228. package/i18n/fr.json +8 -0
  229. package/i18n/id.json +22 -7
  230. package/i18n/ko.json +22 -7
  231. package/i18n/pt.json +32 -7
  232. package/i18n/th.json +21 -6
  233. package/i18n/uk.json +43 -18
  234. package/i18n/zh.json +23 -8
  235. package/icons/InsuraceLogo.d.ts +1 -1
  236. package/icons/LiFiFullLogo.d.ts +1 -1
  237. package/icons/LiFiLogo.d.ts +1 -1
  238. package/icons/LiFiToolLogo.d.ts +1 -1
  239. package/index.d.ts +1 -1
  240. package/package.json +13 -13
  241. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
  242. package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
  243. package/pages/SelectTokenPage/SelectTokenPage.js +4 -2
  244. package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
  245. package/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
  246. package/pages/SettingsPage/LanguageSelect.js +1 -1
  247. package/pages/SettingsPage/SettingsPage.d.ts +1 -2
  248. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
  249. package/pages/SettingsPage/SlippageInput.d.ts +1 -2
  250. package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
  251. package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  252. package/pages/SwapPage/StatusBottomSheet.js +18 -12
  253. package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  254. package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
  255. package/pages/SwapPage/SwapPage.js +33 -12
  256. package/pages/SwapPage/TokenValueBottomSheet.js +8 -13
  257. package/pages/SwapPage/utils.d.ts +2 -0
  258. package/pages/SwapPage/utils.js +6 -0
  259. package/providers/I18nProvider/I18nProvider.js +3 -3
  260. package/providers/SDKProvider/SDKProvider.js +2 -0
  261. package/providers/SwapFormProvider/FormUpdater.js +3 -0
  262. package/providers/WalletProvider/WalletProvider.js +78 -50
  263. package/providers/WalletProvider/types.d.ts +3 -5
  264. package/providers/WidgetProvider/WidgetProvider.js +2 -2
  265. package/stores/StoreProvider.d.ts +2 -2
  266. package/stores/StoreProvider.js +3 -2
  267. package/stores/routes/RouteExecutionStore.d.ts +1 -1
  268. package/stores/routes/RouteExecutionStore.js +0 -1
  269. package/stores/settings/index.d.ts +1 -0
  270. package/stores/settings/index.js +1 -0
  271. package/stores/settings/types.d.ts +11 -0
  272. package/stores/settings/useSplitSubvariantStore.d.ts +7 -0
  273. package/stores/settings/useSplitSubvariantStore.js +37 -0
  274. package/tsconfig.cjs.tsbuildinfo +1 -1
  275. package/types/events.d.ts +9 -1
  276. package/types/events.js +1 -0
  277. package/types/token.d.ts +2 -2
  278. package/types/widget.d.ts +13 -8
  279. package/types/widget.js +4 -2
  280. package/utils/format.d.ts +1 -1
  281. package/utils/format.js +5 -10
  282. package/utils/wallet.d.ts +1 -1
  283. package/utils/wallet.js +1 -1
@@ -1,13 +1,20 @@
1
1
  /// <reference types="react" />
2
- export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps, "classes" | "color" | "position"> & {
2
+ export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<{
3
3
  classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
4
4
  color?: import("@mui/types").OverridableStringUnion<"transparent" | import("@mui/material").PropTypes.Color, import("@mui/material").AppBarPropsColorOverrides> | undefined;
5
5
  enableColorOnDark?: boolean | undefined;
6
6
  position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
7
7
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
8
+ } & Omit<{
9
+ children?: import("react").ReactNode;
10
+ classes?: Partial<import("@mui/material").PaperClasses> | undefined;
11
+ elevation?: number | undefined;
12
+ square?: boolean | undefined;
13
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
14
+ variant?: import("@mui/types").OverridableStringUnion<"outlined" | "elevation", import("@mui/material").PaperPropsVariantOverrides> | undefined;
15
+ }, "classes" | "color" | "position"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
9
16
  ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
10
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "ref" | "key" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
17
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
11
18
  export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
12
19
  children?: import("react").ReactNode;
13
20
  component?: import("react").ElementType<any> | undefined;
@@ -39,4 +39,7 @@ export const WalletButton = styled(Button)(({ theme }) => ({
39
39
  [`.${buttonClasses.endIcon} > *:nth-of-type(1)`]: {
40
40
  fontSize: '24px',
41
41
  },
42
+ [`.${buttonClasses.startIcon} > *:nth-of-type(1)`]: {
43
+ fontSize: '24px',
44
+ },
42
45
  }));
@@ -7,12 +7,15 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Route, Routes, useLocation } from 'react-router-dom';
8
8
  import { useNavigateBack } from '../../hooks';
9
9
  import { useWallet, useWidgetConfig } from '../../providers';
10
+ import { HiddenUI } from '../../types';
10
11
  import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
11
12
  import { HeaderAppBar } from './Header.style';
13
+ import { NavigationTabs } from './NavigationTabs';
14
+ import { WalletMenuButton } from './WalletHeader';
12
15
  import { useHeaderActionStore } from './useHeaderActionStore';
13
16
  export const NavigationHeader = () => {
14
17
  const { t } = useTranslation();
15
- const { variant } = useWidgetConfig();
18
+ const { variant, subvariant, hiddenUI } = useWidgetConfig();
16
19
  const { navigate, navigateBack } = useNavigateBack();
17
20
  const { account } = useWallet();
18
21
  const { element } = useHeaderActionStore();
@@ -22,6 +25,7 @@ export const NavigationHeader = () => {
22
25
  : pathname;
23
26
  const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
24
27
  const hasPath = navigationRoutesValues.includes(path);
28
+ const splitSubvariant = subvariant === 'split' && !hasPath;
25
29
  const handleHeaderTitle = () => {
26
30
  switch (path) {
27
31
  case navigationRoutes.selectWallet:
@@ -34,8 +38,12 @@ export const NavigationHeader = () => {
34
38
  return t(`settings.enabledExchanges`);
35
39
  case navigationRoutes.swapHistory:
36
40
  return t(`header.swapHistory`);
37
- case navigationRoutes.fromToken:
41
+ case navigationRoutes.fromToken: {
42
+ if (variant === 'nft') {
43
+ return t(`header.payWith`);
44
+ }
38
45
  return t(`header.from`);
46
+ }
39
47
  case navigationRoutes.toToken:
40
48
  return t(`header.to`);
41
49
  case navigationRoutes.fromChain:
@@ -46,10 +54,18 @@ export const NavigationHeader = () => {
46
54
  return t(`header.routes`);
47
55
  case navigationRoutes.activeSwaps:
48
56
  return t(`header.activeSwaps`);
49
- case navigationRoutes.swapExecution:
57
+ case navigationRoutes.swapExecution: {
58
+ if (variant === 'nft') {
59
+ return t(`header.purchase`);
60
+ }
50
61
  return t(`header.swap`);
51
- case navigationRoutes.swapDetails:
62
+ }
63
+ case navigationRoutes.swapDetails: {
64
+ if (variant === 'nft') {
65
+ return t(`header.purchaseDetails`);
66
+ }
52
67
  return t(`header.swapDetails`);
68
+ }
53
69
  default: {
54
70
  switch (variant) {
55
71
  case 'nft':
@@ -62,7 +78,7 @@ export const NavigationHeader = () => {
62
78
  }
63
79
  }
64
80
  };
65
- return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
66
- marginRight: -1.25,
67
- }, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }));
81
+ return (_jsxs(_Fragment, { children: [_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, splitSubvariant ? (_jsx(Box, { flex: 1, children: !hiddenUI?.includes(HiddenUI.WalletMenu) ? (_jsx(WalletMenuButton, {})) : null })) : (_jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive && !hiddenUI?.includes(HiddenUI.History) ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
82
+ marginRight: -1.25,
83
+ }, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }), splitSubvariant ? _jsx(NavigationTabs, {}) : null] }));
68
84
  };
@@ -0,0 +1 @@
1
+ export declare const NavigationTabs: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFormContext } from 'react-hook-form';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { SwapFormKey } from '../../providers';
5
+ import { useSplitSubvariantStore } from '../../stores';
6
+ import { HeaderAppBar } from './Header.style';
7
+ import { NavbarTab, NavbarTabs } from './NavigationTabs.style';
8
+ export const NavigationTabs = () => {
9
+ const { t } = useTranslation();
10
+ const [state, setState] = useSplitSubvariantStore((state) => [
11
+ state.state,
12
+ state.setState,
13
+ ]);
14
+ const { setValue } = useFormContext();
15
+ const handleChange = (_, value) => {
16
+ setValue(SwapFormKey.FromAmount, '');
17
+ setValue(SwapFormKey.FromToken, '');
18
+ setValue(SwapFormKey.ToToken, '');
19
+ setState(value === 0 ? 'swap' : 'bridge');
20
+ };
21
+ return (_jsx(HeaderAppBar, { elevation: 0, sx: { py: 1 }, children: _jsxs(NavbarTabs, { value: state === 'swap' ? 0 : 1, onChange: handleChange, "aria-label": "tabs", indicatorColor: "primary", children: [_jsx(NavbarTab, { label: t('header.swap'), disableRipple: true }), _jsx(NavbarTab, { label: t('header.bridge'), disableRipple: true })] }) }));
22
+ };
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ import type { StyledComponent } from '@emotion/styled';
3
+ import type { TabsProps } from '@mui/material';
4
+ export declare const NavbarTabs: StyledComponent<TabsProps>;
5
+ export declare const NavbarTab: StyledComponent<{
6
+ children?: null | undefined;
7
+ classes?: Partial<import("@mui/material").TabClasses> | undefined;
8
+ disabled?: boolean | undefined;
9
+ disableFocusRipple?: boolean | undefined;
10
+ icon?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
11
+ iconPosition?: "bottom" | "top" | "end" | "start" | undefined;
12
+ label?: import("react").ReactNode;
13
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
14
+ value?: any;
15
+ wrapped?: boolean | undefined;
16
+ } & Omit<{
17
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
18
+ centerRipple?: boolean | undefined;
19
+ children?: import("react").ReactNode;
20
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
21
+ disabled?: boolean | undefined;
22
+ disableRipple?: boolean | undefined;
23
+ disableTouchRipple?: boolean | undefined;
24
+ focusRipple?: boolean | undefined;
25
+ focusVisibleClassName?: string | undefined;
26
+ LinkComponent?: import("react").ElementType<any> | undefined;
27
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
28
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
29
+ tabIndex?: number | undefined;
30
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
31
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
32
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
33
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
34
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "value" | "icon" | "iconPosition" | "wrapped"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,58 @@
1
+ import { Tab, Tabs, tabClasses, tabsClasses } from '@mui/material';
2
+ import { alpha, styled } from '@mui/material/styles';
3
+ export const NavbarTabs = styled(Tabs)(({ theme }) => ({
4
+ backgroundColor: theme.palette.mode === 'dark'
5
+ ? theme.palette.common.white
6
+ : alpha(theme.palette.common.black, 0.04),
7
+ borderRadius: theme.shape.borderRadius,
8
+ padding: theme.spacing(0.5),
9
+ flex: 1,
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ height: 56,
13
+ [`.${tabsClasses.flexContainer}`]: {
14
+ alignItems: 'center',
15
+ },
16
+ [`.${tabsClasses.scroller}`]: {
17
+ overflow: 'initial !important',
18
+ },
19
+ [`.${tabsClasses.indicator}`]: {
20
+ position: 'absolute',
21
+ top: '50%',
22
+ transform: 'translateY(-50%)',
23
+ height: 48,
24
+ backgroundColor: theme.palette.mode === 'dark'
25
+ ? theme.palette.common.black
26
+ : theme.palette.common.white,
27
+ borderRadius: theme.shape.borderRadiusSecondary,
28
+ boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
29
+ },
30
+ }));
31
+ export const NavbarTab = styled(Tab, {
32
+ shouldForwardProp: (prop) => prop !== 'isDarkMode',
33
+ })(({ theme }) => ({
34
+ zIndex: 1,
35
+ display: 'flex',
36
+ flex: 1,
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ flexDirection: 'row',
40
+ textTransform: 'none',
41
+ height: 48,
42
+ minHeight: 48,
43
+ fontSize: '1rem',
44
+ fontWeight: 700,
45
+ color: theme.palette.mode === 'dark'
46
+ ? theme.palette.common.white
47
+ : theme.palette.common.black,
48
+ textDecoration: 'none',
49
+ [`&.${tabClasses.selected}`]: {
50
+ color: theme.palette.mode === 'dark'
51
+ ? theme.palette.common.white
52
+ : theme.palette.common.black,
53
+ backgroundColor: 'transparent',
54
+ },
55
+ [`.${tabClasses.iconWrapper}`]: {
56
+ margin: theme.spacing(0, 1, 0, 0),
57
+ },
58
+ }));
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const WalletHeader: React.FC;
3
+ export declare const WalletMenuButton: React.FC;
@@ -10,34 +10,39 @@ import { useTranslation } from 'react-i18next';
10
10
  import { useLocation, useNavigate } from 'react-router-dom';
11
11
  import { useChain } from '../../hooks';
12
12
  import { useWallet, useWidgetConfig } from '../../providers';
13
- import { navigationRoutes, shortenWalletAddress } from '../../utils';
13
+ import { navigationRoutes, shortenAddress } from '../../utils';
14
14
  import { HeaderAppBar, WalletButton } from './Header.style';
15
15
  import { WalletMenu } from './WalletMenu';
16
16
  export const WalletHeader = () => {
17
+ return (_jsx(HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: _jsx(WalletMenuButton, {}) }));
18
+ };
19
+ export const WalletMenuButton = () => {
17
20
  const { account } = useWallet();
18
- return (_jsx(HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: account.isActive ? _jsx(ConnectedButton, {}) : _jsx(ConnectButton, {}) }));
21
+ return account.isActive ? _jsx(ConnectedButton, {}) : _jsx(ConnectButton, {});
19
22
  };
20
23
  const ConnectButton = () => {
21
24
  const { t } = useTranslation();
22
25
  const { pathname } = useLocation();
23
- const config = useWidgetConfig();
26
+ const { walletManagement, subvariant } = useWidgetConfig();
24
27
  const { connect: connectWallet } = useWallet();
25
28
  const navigate = useNavigate();
26
29
  const connect = async () => {
27
- if (config.walletManagement) {
30
+ if (walletManagement) {
28
31
  await connectWallet();
29
32
  return;
30
33
  }
31
34
  navigate(navigationRoutes.selectWallet);
32
35
  };
33
- return (_jsx(WalletButton, { endIcon: _jsx(WalletIcon, {}), onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined, sx: {
34
- marginRight: -1.25,
36
+ return (_jsx(WalletButton, { endIcon: subvariant !== 'split' ? _jsx(WalletIcon, {}) : undefined, startIcon: subvariant === 'split' ? _jsx(WalletIcon, {}) : undefined, onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined, sx: {
37
+ marginRight: subvariant === 'split' ? 0 : -1.25,
38
+ marginLeft: subvariant === 'split' ? -1.25 : 0,
35
39
  }, children: t(`button.connectWallet`) }));
36
40
  };
37
41
  const ConnectedButton = () => {
38
42
  const { t } = useTranslation();
43
+ const { subvariant } = useWidgetConfig();
39
44
  const { account, disconnect } = useWallet();
40
- const walletAddress = shortenWalletAddress(account.address);
45
+ const walletAddress = shortenAddress(account.address);
41
46
  const { chain } = useChain(account.chainId);
42
47
  const [anchorEl, setAnchorEl] = useState(null);
43
48
  const handleClick = (event) => {
@@ -55,7 +60,8 @@ const ConnectedButton = () => {
55
60
  handleClose();
56
61
  };
57
62
  return (_jsxs(_Fragment, { children: [_jsx(WalletButton, { endIcon: _jsx(ExpandMoreIcon, {}), startIcon: _jsx(Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
58
- marginRight: -1.25,
63
+ marginRight: subvariant === 'split' ? 0 : -1.25,
64
+ marginLeft: subvariant === 'split' ? -1 : 0,
59
65
  }, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress, children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] }), _jsxs(MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [_jsx(OpenInNewIcon, {}), t(`button.viewOnExplorer`)] }), _jsx(Button, { onClick: handleDisconnect, fullWidth: true, startIcon: _jsx(PowerSettingsNewIcon, {}), sx: {
60
66
  marginTop: 1,
61
67
  }, children: t(`button.disconnect`) })] })] }));
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-underscore-dangle */
2
1
  import { create } from 'zustand';
3
2
  export const useHeaderActionStore = create((set, get) => ({
4
3
  setAction: (element) => {
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RouteExecutionStatus } from '../../stores';
3
3
  import { InsuranceCard } from './InsuranceCard';
4
4
  import { InsuranceCollapsed } from './InsuranceCollapsed';
5
- export const Insurance = ({ status, insurableRouteId, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
6
- return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, { insurableRouteId: insurableRouteId, feeAmountUsd: feeAmountUsd, insuranceCoverageId: insuranceCoverageId, status: status, onChange: onChange, ...props })) : (_jsx(InsuranceCard, { feeAmountUsd: feeAmountUsd, status: status, insuranceCoverageId: insuranceCoverageId, ...props }));
5
+ export const Insurance = ({ status, insurableRouteId, onChange, ...props }) => {
6
+ return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, { status: status, insurableRouteId: insurableRouteId, onChange: onChange, ...props })) : (_jsx(InsuranceCard, { status: status, ...props }));
7
7
  };
@@ -1,22 +1,44 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ExpandLessIcon from '@mui/icons-material/ExpandLess';
3
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
2
4
  import VerifiedUserIcon from '@mui/icons-material/VerifiedUser';
3
- import { Box, Link, Typography } from '@mui/material';
4
- import { useTranslation } from 'react-i18next';
5
+ import { Box, Collapse, Link, Typography } from '@mui/material';
6
+ import { useState } from 'react';
7
+ import { Trans, useTranslation } from 'react-i18next';
5
8
  import { InsuraceLogo } from '../../icons';
6
9
  import { RouteExecutionStatus } from '../../stores';
7
- import { Card, CardLabel, CardLabelTypography } from '../Card';
10
+ import { Card, CardIconButton, CardLabel, CardLabelTypography } from '../Card';
8
11
  import { Switch } from '../Switch';
9
- export const InsuranceCard = ({ status, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
12
+ export const InsuranceCard = ({ status, feeAmountUsd, insuredAmount, insuredTokenSymbol, insuranceCoverageId, onChange, ...props }) => {
10
13
  const { t } = useTranslation();
11
- return (_jsxs(Card, { selectionColor: "secondary", indented: true, ...props, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [_jsxs(CardLabel, { type: 'insurance', children: [_jsx(VerifiedUserIcon, { fontSize: "inherit" }), _jsx(CardLabelTypography, { type: "icon", children: status === RouteExecutionStatus.Idle
12
- ? t(`swap.tags.insurance`)
13
- : t(`swap.tags.insured`) })] }), _jsx(InsuraceLogo, {})] }), _jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [_jsx(Typography, { fontSize: 24, fontWeight: 700, lineHeight: 1, children: t('format.currency', {
14
- value: feeAmountUsd,
15
- }) }), status === RouteExecutionStatus.Idle ? (_jsx(Switch, { onChange: onChange })) : null] }), _jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Typography, { fontSize: 12, children: status === RouteExecutionStatus.Idle
16
- ? 'Get 100% coverage for lost tokens.'
17
- : '100% coverage for lost tokens.' }), _jsx(Link, { href: status === RouteExecutionStatus.Idle
18
- ? 'https://docs.insurace.io/landing-page/documentation/cover-products/bridge-cover/li.fi'
19
- : `https://app.insurace.io/bridge-cover?search=${insuranceCoverageId}`, target: "_blank", underline: "none", color: "text.primary", children: _jsx(Typography, { px: 0.5, color: "primary", fontSize: 12, fontWeight: 600, children: status === RouteExecutionStatus.Idle
20
- ? 'Learn more'
21
- : 'View coverage' }) })] })] }));
14
+ const [enabled, setEnabled] = useState(false);
15
+ const [cardExpanded, setCardExpanded] = useState(status === RouteExecutionStatus.Idle);
16
+ const handleExpand = (e) => {
17
+ e.stopPropagation();
18
+ setCardExpanded((expanded) => !expanded);
19
+ };
20
+ const handleSwitch = (_, checked) => {
21
+ setEnabled(checked);
22
+ onChange?.(checked);
23
+ };
24
+ return (_jsxs(Card, { selectionColor: "secondary", indented: true, ...props, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [_jsxs(CardLabel, { type: 'insurance', children: [_jsx(VerifiedUserIcon, { fontSize: "inherit" }), _jsx(CardLabelTypography, { type: "icon", children: status === RouteExecutionStatus.Idle
25
+ ? t('swap.tags.insurance')
26
+ : t('swap.tags.insured') })] }), status === RouteExecutionStatus.Idle ? (_jsx(Switch, { onChange: handleSwitch, value: enabled })) : (_jsx(Box, { my: -0.5, children: _jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }) }))] }), _jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Box, { mt: 2, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [_jsx(Typography, { fontSize: 24, fontWeight: 700, lineHeight: 1, children: t('format.currency', {
27
+ value: feeAmountUsd,
28
+ }) }), _jsx(InsuraceLogo, {})] }), _jsxs(Box, { children: [_jsx(Typography, { fontSize: 14, children: _jsx(Trans, { children: status === RouteExecutionStatus.Idle
29
+ ? t('swap.insurance.insure', {
30
+ amount: insuredAmount,
31
+ tokenSymbol: insuredTokenSymbol,
32
+ })
33
+ : t('swap.insurance.insured', {
34
+ amount: insuredAmount,
35
+ tokenSymbol: insuredTokenSymbol,
36
+ }) }) }), _jsx(Collapse, { timeout: 225, in: enabled || status !== RouteExecutionStatus.Idle, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Box, { sx: {
37
+ listStyleType: 'disc',
38
+ pl: 2,
39
+ }, children: [_jsx(Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.bridgeExploits') }), _jsx(Typography, { fontSize: 14, display: "list-item", children: t('swap.insurance.slippageError') })] }) }), _jsx(Link, { href: status === RouteExecutionStatus.Idle
40
+ ? 'https://docs.insurace.io/landing-page/documentation/cover-products/bridge-cover/li.fi'
41
+ : `https://app.insurace.io/bridge-cover?search=${insuranceCoverageId}`, target: "_blank", underline: "none", color: "text.primary", children: _jsx(Typography, { pt: 0.5, color: "primary", fontSize: 14, fontWeight: 600, children: status === RouteExecutionStatus.Idle
42
+ ? t('button.learnMore')
43
+ : t('button.viewCoverage') }) })] })] }) })] }));
22
44
  };
@@ -1,22 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Collapse } from '@mui/material';
3
- import { useState } from 'react';
4
3
  import { useSwapRoutes } from '../../hooks';
5
4
  import { RouteExecutionStatus, useRouteExecutionStore, useSetExecutableRoute, } from '../../stores';
5
+ import { formatTokenAmount } from '../../utils';
6
6
  import { InsuranceCard } from './InsuranceCard';
7
- export const InsuranceCollapsed = ({ status, insurableRouteId, insuranceCoverageId, feeAmountUsd, onChange, ...props }) => {
8
- const [insuredRoute, setInsuredRoute] = useState();
7
+ export const InsuranceCollapsed = ({ status, insurableRouteId, onChange, ...props }) => {
9
8
  const setExecutableRoute = useSetExecutableRoute();
10
9
  const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
11
- useSwapRoutes({
10
+ const { routes } = useSwapRoutes({
12
11
  insurableRoute: routeExecution?.route,
13
- onSettled(data) {
14
- if (data?.routes?.[0]) {
15
- setInsuredRoute(data.routes[0]);
16
- }
17
- },
18
12
  });
19
- const toggleInsurance = (_, checked) => {
13
+ const insuredRoute = routes?.[0];
14
+ const toggleInsurance = (checked) => {
20
15
  if (insuredRoute) {
21
16
  if (checked) {
22
17
  setExecutableRoute(insuredRoute, insurableRouteId);
@@ -24,5 +19,8 @@ export const InsuranceCollapsed = ({ status, insurableRouteId, insuranceCoverage
24
19
  onChange?.(checked ? insuredRoute.id : insurableRouteId);
25
20
  }
26
21
  };
27
- return (_jsx(Collapse, { timeout: 225, in: insuredRoute?.insurance?.state === 'INSURED', unmountOnExit: true, mountOnEnter: true, appear: status === RouteExecutionStatus.Idle, children: _jsx(InsuranceCard, { feeAmountUsd: feeAmountUsd, status: status, insuranceCoverageId: insuranceCoverageId, onChange: toggleInsurance, ...props }) }));
22
+ if (!insuredRoute) {
23
+ return null;
24
+ }
25
+ return (_jsx(Collapse, { timeout: 225, in: insuredRoute.insurance.state === 'INSURED', unmountOnExit: true, mountOnEnter: true, appear: status === RouteExecutionStatus.Idle, children: _jsx(InsuranceCard, { ...props, status: status, insuredAmount: formatTokenAmount(insuredRoute.toAmountMin, insuredRoute.toToken.decimals), insuredTokenSymbol: insuredRoute.toToken.symbol, onChange: toggleInsurance }) }));
28
26
  };
@@ -1 +1,2 @@
1
1
  export * from './Insurance';
2
+ export * from './types';
@@ -1 +1,2 @@
1
1
  export * from './Insurance';
2
+ export * from './types';
@@ -1,16 +1,19 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import type { RouteExecutionStatus } from '../../stores';
4
- export interface InsuranceProps extends Omit<BoxProps, 'onChange'> {
5
- insurableRouteId: string;
6
- feeAmountUsd?: string;
3
+ export interface InsuredAmount {
4
+ insuredAmount: string;
5
+ insuredTokenSymbol: string;
6
+ }
7
+ interface Insurance extends InsuredAmount {
8
+ feeAmountUsd: string;
7
9
  insuranceCoverageId?: string;
8
10
  status?: RouteExecutionStatus;
11
+ }
12
+ export interface InsuranceProps extends Insurance, Omit<BoxProps, 'onChange'> {
13
+ insurableRouteId: string;
9
14
  onChange?: (routeId: string) => void;
10
15
  }
11
- export interface InsuranceCardProps {
12
- feeAmountUsd?: string;
13
- status?: RouteExecutionStatus;
14
- insuranceCoverageId?: string;
15
- onChange?: (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
16
+ export interface InsuranceCardProps extends Insurance, Omit<BoxProps, 'onChange'> {
17
+ onChange?: (checked: boolean) => void;
16
18
  }
19
+ export {};
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import { SwapFormKey } from '../../providers';
7
7
  import { Token } from '../Token';
8
8
  import { PreviewAvatar } from './NFT.style';
9
- export const NFT = ({ imageUrl, isLoading, collectonName, assetName, owner, token, contract, ...props }) => {
9
+ export const NFT = ({ imageUrl, isLoading, collectionName, assetName, owner, token, contract, ...props }) => {
10
10
  const { t } = useTranslation();
11
11
  const { setValue } = useFormContext();
12
12
  useEffect(() => {
@@ -21,5 +21,5 @@ export const NFT = ({ imageUrl, isLoading, collectonName, assetName, owner, toke
21
21
  setValue(SwapFormKey.ToContractGasLimit, contract.gasLimit);
22
22
  }
23
23
  }, [contract, setValue, token]);
24
- return (_jsxs(Box, { p: 2, children: [_jsxs(Box, { display: "flex", children: [isLoading ? (_jsx(Skeleton, { width: 96, height: 96, variant: "rectangular", sx: { borderRadius: 1 } })) : (_jsx(PreviewAvatar, { src: imageUrl })), _jsxs(Box, { ml: 2, children: [isLoading ? (_jsx(Skeleton, { width: 144, height: 21, variant: "text" })) : (_jsx(Typography, { fontSize: 14, color: "text.secondary", children: collectonName })), isLoading ? (_jsx(Skeleton, { width: 112, height: 27, variant: "text" })) : (_jsx(Typography, { fontSize: 18, fontWeight: 600, children: assetName })), isLoading ? (_jsx(Skeleton, { width: 128, height: 21, variant: "text" })) : owner ? (_jsxs(Typography, { fontSize: 14, color: "text.secondary", children: [t('swap.ownedBy'), ' ', _jsx(Link, { href: owner.url, target: "_blank", underline: "none", color: "primary", children: owner.name })] })) : null] })] }), _jsx(Token, { token: token, isLoading: isLoading, mt: 2 })] }));
24
+ return (_jsxs(Box, { p: 2, children: [_jsxs(Box, { display: "flex", children: [isLoading ? (_jsx(Skeleton, { width: 96, height: 96, variant: "rectangular", sx: { borderRadius: 1 } })) : (_jsx(PreviewAvatar, { src: imageUrl })), _jsxs(Box, { ml: 2, children: [isLoading ? (_jsx(Skeleton, { width: 144, height: 21, variant: "text" })) : (_jsx(Typography, { fontSize: 14, color: "text.secondary", children: collectionName })), isLoading ? (_jsx(Skeleton, { width: 112, height: 27, variant: "text" })) : (_jsx(Typography, { fontSize: 18, fontWeight: 600, children: assetName })), isLoading ? (_jsx(Skeleton, { width: 128, height: 21, variant: "text" })) : owner ? (_jsxs(Typography, { fontSize: 14, color: "text.secondary", children: [t('swap.ownedBy'), ' ', _jsx(Link, { href: owner.url, target: "_blank", underline: "none", color: "primary", children: owner.name })] })) : null] })] }), _jsx(Token, { token: token, isLoading: isLoading, mt: 2 })] }));
25
25
  };
@@ -2,7 +2,7 @@ import type { TokenAmount } from '@lifi/sdk';
2
2
  import type { WidgetContract } from '../../types';
3
3
  export interface NFTProps {
4
4
  imageUrl?: string;
5
- collectonName?: string;
5
+ collectionName?: string;
6
6
  assetName?: string;
7
7
  isLoading?: boolean;
8
8
  owner?: NFTOwner;
@@ -5,7 +5,6 @@ import { version } from '../../config/version';
5
5
  import { useWidgetConfig } from '../../providers';
6
6
  import { HiddenUI } from '../../types';
7
7
  import { navigationRoutes } from '../../utils';
8
- import { LiFiLogo } from '../LiFiLogo';
9
8
  import { Link } from './PoweredBy.style';
10
9
  export const PoweredBy = () => {
11
10
  const { hiddenUI } = useWidgetConfig();
@@ -14,9 +13,9 @@ export const PoweredBy = () => {
14
13
  pathname.includes(navigationRoutes.toToken)) {
15
14
  return null;
16
15
  }
17
- return (_jsx(Box, { px: 3, py: hiddenUI?.includes(HiddenUI.PoweredBy) ? 1 : 2, sx: {
16
+ return (_jsx(Box, { px: 3, pt: 1, pb: hiddenUI?.includes(HiddenUI.PoweredBy) ? 1 : 2, sx: {
18
17
  display: 'flex',
19
18
  alignItems: 'flex-end',
20
19
  justifyContent: 'flex-end',
21
- }, children: !hiddenUI?.includes(HiddenUI.PoweredBy) ? (_jsx(Tooltip, { title: `v${version}`, placement: "top", enterDelay: 3000, arrow: true, children: _jsxs(Link, { href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary", children: [_jsx(Typography, { color: "text.secondary", fontSize: 12, px: 0.5, children: "Powered by" }), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] }) })) : null }));
20
+ }, children: !hiddenUI?.includes(HiddenUI.PoweredBy) ? (_jsx(Tooltip, { title: `v${version}`, placement: "top", enterDelay: 1000, arrow: true, children: _jsxs(Link, { href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary", children: [_jsx(Typography, { color: "text.secondary", fontSize: 12, fontWeight: 500, px: 0.5, children: "Powered by" }), _jsx(Typography, { color: "text.primary", fontSize: 12, fontWeight: 500, children: "LI.FI" })] }) })) : null }));
22
21
  };
@@ -4,10 +4,10 @@ import { useWatch } from 'react-hook-form';
4
4
  import { ReverseTokensButton } from '../components/ReverseTokensButton';
5
5
  import { SelectTokenButton } from '../components/SelectTokenButton';
6
6
  import { SwapFormKey, useWidgetConfig } from '../providers';
7
- import { DisabledUI } from '../types';
7
+ import { DisabledUI, HiddenUI } from '../types';
8
8
  export const SelectChainAndToken = (props) => {
9
9
  const prefersNarrowView = useMediaQuery((theme) => theme.breakpoints.down('sm'));
10
- const { disabledUI, variant } = useWidgetConfig();
10
+ const { disabledUI, hiddenUI, variant } = useWidgetConfig();
11
11
  const [fromChain, toChain, fromToken, toToken] = useWatch({
12
12
  name: [
13
13
  SwapFormKey.FromChain,
@@ -16,19 +16,20 @@ export const SelectChainAndToken = (props) => {
16
16
  SwapFormKey.ToToken,
17
17
  ],
18
18
  });
19
- const disabledReverse = variant === 'refuel' ||
19
+ const hiddenReverse = variant === 'refuel' ||
20
20
  disabledUI?.includes(DisabledUI.FromToken) ||
21
- disabledUI?.includes(DisabledUI.ToToken);
22
- const nftVariant = variant === 'nft';
21
+ disabledUI?.includes(DisabledUI.ToToken) ||
22
+ hiddenUI?.includes(HiddenUI.ToToken);
23
+ const hiddenToToken = variant === 'nft' || hiddenUI?.includes(HiddenUI.ToToken);
23
24
  const isCompact = fromChain &&
24
25
  toChain &&
25
26
  fromToken &&
26
27
  toToken &&
27
28
  !prefersNarrowView &&
28
- !nftVariant;
29
- return (_jsxs(Box, { sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' }, ...props, children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), !nftVariant ? (_jsx(Box, { sx: {
29
+ !hiddenToToken;
30
+ return (_jsxs(Box, { sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' }, ...props, children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), !hiddenToToken ? (_jsx(Box, { sx: {
30
31
  display: 'flex',
31
32
  justifyContent: 'center',
32
33
  alignItems: 'center',
33
- }, m: !disabledReverse ? -1.125 : 1, children: !disabledReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null })) : null, !nftVariant ? (_jsx(SelectTokenButton, { formType: "to", compact: isCompact })) : null] }));
34
+ }, m: !hiddenReverse ? -1.125 : 1, children: !hiddenReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null })) : null, !hiddenToToken ? (_jsx(SelectTokenButton, { formType: "to", compact: isCompact })) : null] }));
34
35
  };
@@ -3,7 +3,7 @@ import { Skeleton } from '@mui/material';
3
3
  import { useWatch } from 'react-hook-form';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useNavigate } from 'react-router-dom';
6
- import { useChain, useToken } from '../../hooks';
6
+ import { useChain, useSwapOnly, useToken } from '../../hooks';
7
7
  import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
8
8
  import { navigationRoutes } from '../../utils';
9
9
  import { Card, CardTitle } from '../Card';
@@ -13,6 +13,7 @@ export const SelectTokenButton = ({ formType, compact }) => {
13
13
  const { t } = useTranslation();
14
14
  const navigate = useNavigate();
15
15
  const { disabledUI, variant } = useWidgetConfig();
16
+ const swapOnly = useSwapOnly();
16
17
  const tokenKey = SwapFormKeyHelper.getTokenKey(formType);
17
18
  const [chainId, tokenAddress] = useWatch({
18
19
  name: [SwapFormKeyHelper.getChainKey(formType), tokenKey],
@@ -29,10 +30,12 @@ export const SelectTokenButton = ({ formType, compact }) => {
29
30
  const isSelected = !!(chain && token);
30
31
  const onClick = !disabledUI?.includes(tokenKey) ? handleClick : undefined;
31
32
  const defaultPlaceholder = formType === 'to' && variant === 'refuel'
32
- ? t(`header.selectChain`)
33
- : t(`swap.selectChainAndToken`);
33
+ ? t('swap.selectChain')
34
+ : formType === 'to' && swapOnly
35
+ ? t('swap.selectToken')
36
+ : t('swap.selectChainAndToken');
34
37
  const cardTitle = formType === 'from' && variant === 'nft'
35
- ? t(`swap.payWith`)
38
+ ? t(`header.payWith`)
36
39
  : t(`swap.${formType}`);
37
40
  return (_jsxs(Card, { flex: 1, onClick: onClick, children: [_jsx(CardTitle, { children: cardTitle }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(TokenAvatarDefault, {})), title: isSelected ? token.symbol : defaultPlaceholder, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] }));
38
41
  };
@@ -12,7 +12,7 @@ import { FormControl, Input } from './SendToWallet.style';
12
12
  export const SendToWallet = forwardRef((props, ref) => {
13
13
  const { t } = useTranslation();
14
14
  const { trigger, getValues, clearErrors } = useFormContext();
15
- const { account, provider } = useWallet();
15
+ const { account } = useWallet();
16
16
  const { disabledUI, hiddenUI, requiredUI, toAddress } = useWidgetConfig();
17
17
  const { showSendToWallet, showSendToWalletDirty, setSendToWallet } = useSendToWalletStore();
18
18
  const { showDestinationWallet } = useSettings(['showDestinationWallet']);
@@ -30,7 +30,7 @@ export const SendToWallet = forwardRef((props, ref) => {
30
30
  if (!value) {
31
31
  return true;
32
32
  }
33
- const address = await provider?.resolveName(value);
33
+ const address = await account.signer?.provider?.resolveName(value);
34
34
  return (isAddress(address || value) ||
35
35
  t('swap.error.title.walletAddressInvalid'));
36
36
  }