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

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
package/App.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { WidgetProps } from './types';
3
- export declare const App: React.FC<WidgetProps>;
4
- export declare const AppDefault: () => JSX.Element;
2
+ import type { WidgetDrawer } from './AppDrawer';
3
+ import type { WidgetConfig } from './types';
4
+ export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
5
+ export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
package/AppDrawer.d.ts CHANGED
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
9
9
  export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
10
10
  export declare const DrawerButtonText: ({ open }: {
11
11
  open: boolean;
12
- }) => JSX.Element;
12
+ }) => import("react/jsx-runtime").JSX.Element;
package/AppDrawer.js CHANGED
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { AppDefault } from './App';
8
8
  import { DrawerButton, DrawerButtonTypography } from './AppDrawer.style';
9
9
  import { AppProvider } from './AppProvider';
10
+ import { HiddenUI } from './types';
10
11
  export const AppDrawer = forwardRef(({ elementRef, open, integrator, config }, ref) => {
11
12
  const openRef = useRef(open);
12
13
  const [drawerOpen, setDrawerOpen] = useState(Boolean(open));
@@ -33,7 +34,7 @@ export const AppDrawer = forwardRef(({ elementRef, open, integrator, config }, r
33
34
  height: '100%',
34
35
  },
35
36
  }), [config, integrator]);
36
- return (_jsxs(AppProvider, { config: widgetConfig, children: [_jsxs(DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? _jsx(KeyboardArrowRightIcon, {}) : _jsx(KeyboardArrowLeftIcon, {}), _jsx(DrawerButtonText, { open: drawerOpen })] }), _jsx(Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
37
+ return (_jsxs(AppProvider, { config: widgetConfig, children: [!widgetConfig.hiddenUI?.includes(HiddenUI.DrawerButton) ? (_jsxs(DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (_jsx(KeyboardArrowRightIcon, {})) : (_jsx(KeyboardArrowLeftIcon, {})), _jsx(DrawerButtonText, { open: drawerOpen })] })) : null, _jsx(Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
37
38
  sx: {
38
39
  backgroundColor: 'rgb(0 0 0 / 48%)',
39
40
  backdropFilter: 'blur(3px)',
package/AppProvider.js CHANGED
@@ -6,7 +6,7 @@ import { queryClient } from './config/queryClient';
6
6
  import { I18nProvider, SDKProvider, SwapFormProvider, ThemeProvider, URLSearchParamsBuilder, WalletProvider, WidgetProvider, useWidgetConfig, } from './providers';
7
7
  import { StoreProvider } from './stores';
8
8
  export const AppProvider = ({ children, config, }) => {
9
- return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(StoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: _jsx(WidgetProvider, { config: config, children: _jsx(SDKProvider, { children: _jsx(ThemeProvider, { children: _jsx(I18nProvider, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: _jsx(AppRouter, { children: children }) }) }) }) }) }) }) }) }));
9
+ return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(StoreProvider, { config: config, children: _jsx(WidgetProvider, { config: config, children: _jsx(SDKProvider, { children: _jsx(ThemeProvider, { children: _jsx(I18nProvider, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: _jsx(AppRouter, { children: children }) }) }) }) }) }) }) }) }));
10
10
  };
11
11
  export const AppRouter = ({ children }) => {
12
12
  const { buildSwapUrl } = useWidgetConfig();
package/README.md CHANGED
@@ -54,21 +54,20 @@ yarn add @lifi/wallet-management
54
54
 
55
55
  Here is an example of a basic app using LI.FI Widget:
56
56
 
57
- ```jsx
57
+ ```tsx
58
58
  import { LiFiWidget, WidgetConfig } from '@lifi/widget';
59
- import { useMemo } from 'react';
59
+
60
+ const widgetConfig: WidgetConfig = {
61
+ containerStyle: {
62
+ border: '1px solid rgb(234, 234, 234)',
63
+ borderRadius: '16px',
64
+ },
65
+ };
60
66
 
61
67
  export const WidgetPage = () => {
62
- const widgetConfig: WidgetConfig = useMemo(() => {
63
- return {
64
- containerStyle: {
65
- border: '1px solid rgb(234, 234, 234)',
66
- borderRadius: '16px',
67
- },
68
- };
69
- }, []);
70
-
71
- return <LiFiWidget config={widgetConfig} />;
68
+ return (
69
+ <LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
70
+ );
72
71
  };
73
72
  ```
74
73
 
package/cjs/App.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { WidgetProps } from './types';
3
- export declare const App: React.FC<WidgetProps>;
4
- export declare const AppDefault: () => JSX.Element;
2
+ import type { WidgetDrawer } from './AppDrawer';
3
+ import type { WidgetConfig } from './types';
4
+ export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
5
+ export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
9
9
  export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
10
10
  export declare const DrawerButtonText: ({ open }: {
11
11
  open: boolean;
12
- }) => JSX.Element;
12
+ }) => import("react/jsx-runtime").JSX.Element;
package/cjs/AppDrawer.js CHANGED
@@ -10,6 +10,7 @@ const react_i18next_1 = require("react-i18next");
10
10
  const App_1 = require("./App");
11
11
  const AppDrawer_style_1 = require("./AppDrawer.style");
12
12
  const AppProvider_1 = require("./AppProvider");
13
+ const types_1 = require("./types");
13
14
  exports.AppDrawer = (0, react_1.forwardRef)(({ elementRef, open, integrator, config }, ref) => {
14
15
  const openRef = (0, react_1.useRef)(open);
15
16
  const [drawerOpen, setDrawerOpen] = (0, react_1.useState)(Boolean(open));
@@ -36,7 +37,7 @@ exports.AppDrawer = (0, react_1.forwardRef)(({ elementRef, open, integrator, con
36
37
  height: '100%',
37
38
  },
38
39
  }), [config, integrator]);
39
- return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: widgetConfig, children: [(0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {}) : (0, jsx_runtime_1.jsx)(KeyboardArrowLeft_1.default, {}), (0, jsx_runtime_1.jsx)(exports.DrawerButtonText, { open: drawerOpen })] }), (0, jsx_runtime_1.jsx)(material_1.Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
40
+ return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: widgetConfig, children: [!widgetConfig.hiddenUI?.includes(types_1.HiddenUI.DrawerButton) ? ((0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? ((0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {})) : ((0, jsx_runtime_1.jsx)(KeyboardArrowLeft_1.default, {})), (0, jsx_runtime_1.jsx)(exports.DrawerButtonText, { open: drawerOpen })] })) : null, (0, jsx_runtime_1.jsx)(material_1.Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
40
41
  sx: {
41
42
  backgroundColor: 'rgb(0 0 0 / 48%)',
42
43
  backdropFilter: 'blur(3px)',
@@ -9,7 +9,7 @@ const queryClient_1 = require("./config/queryClient");
9
9
  const providers_1 = require("./providers");
10
10
  const stores_1 = require("./stores");
11
11
  const AppProvider = ({ children, config, }) => {
12
- return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient_1.queryClient, children: (0, jsx_runtime_1.jsx)(stores_1.StoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: (0, jsx_runtime_1.jsx)(providers_1.WidgetProvider, { config: config, children: (0, jsx_runtime_1.jsx)(providers_1.SDKProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.I18nProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.WalletProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.SwapFormProvider, { children: (0, jsx_runtime_1.jsx)(exports.AppRouter, { children: children }) }) }) }) }) }) }) }) }));
12
+ return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient_1.queryClient, children: (0, jsx_runtime_1.jsx)(stores_1.StoreProvider, { config: config, children: (0, jsx_runtime_1.jsx)(providers_1.WidgetProvider, { config: config, children: (0, jsx_runtime_1.jsx)(providers_1.SDKProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.I18nProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.WalletProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.SwapFormProvider, { children: (0, jsx_runtime_1.jsx)(exports.AppRouter, { children: children }) }) }) }) }) }) }) }) }));
13
13
  };
14
14
  exports.AppProvider = AppProvider;
15
15
  const AppRouter = ({ children }) => {
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { SwapFormTypeProps } from '../../providers';
3
- export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
2
+ export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,7 @@ exports.ChainCard = (0, styles_1.styled)(Card_1.Card)({
12
12
  });
13
13
  exports.ChainContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
14
14
  display: 'grid',
15
- gridTemplateColumns: 'repeat(5, 1fr)',
15
+ gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
16
16
  gridAutoRows: '56px',
17
17
  justifyContent: 'space-between',
18
18
  gap: theme.spacing(1.5),
@@ -11,6 +11,7 @@ const useChainSelect = (formType) => {
11
11
  const { setValue } = (0, react_hook_form_1.useFormContext)();
12
12
  const { chains, isLoading } = (0, hooks_1.useChains)();
13
13
  const [chainOrder, setChainOrder] = (0, stores_1.useChainOrder)();
14
+ const swapOnly = (0, hooks_1.useSwapOnly)();
14
15
  const getChains = () => {
15
16
  if (!chains) {
16
17
  return [];
@@ -23,6 +24,11 @@ const useChainSelect = (formType) => {
23
24
  const setCurrentChain = (chainId) => {
24
25
  onChange(chainId);
25
26
  onBlur();
27
+ if (swapOnly) {
28
+ setValue(providers_1.SwapFormKeyHelper.getChainKey('to'), chainId, {
29
+ shouldTouch: true,
30
+ });
31
+ }
26
32
  setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), '');
27
33
  setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
28
34
  setValue(providers_1.SwapFormKey.TokenSearchFilter, '');
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const FundsSufficiencyMessage: () => JSX.Element;
1
+ export declare const FundsSufficiencyMessage: () => import("react/jsx-runtime").JSX.Element;
@@ -4,16 +4,11 @@ exports.GasMessage = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const hooks_1 = require("../../hooks");
7
- const stores_1 = require("../../stores");
8
7
  const FundsSufficiencyMessage_1 = require("./FundsSufficiencyMessage");
9
8
  const GasSufficiencyMessage_1 = require("./GasSufficiencyMessage");
10
9
  const GasMessage = ({ route, ...props }) => {
11
10
  const { insufficientGas } = (0, hooks_1.useGasSufficiency)(route);
12
11
  const { insufficientFunds } = (0, hooks_1.useFundsSufficiency)(route);
13
- const { enabledAutoRefuel } = (0, stores_1.useSettings)(['enabledAutoRefuel']);
14
- const { enabled, isLoading: isRefuelLoading } = (0, hooks_1.useGasRefuel)();
15
- const enabledRefuel = enabled && enabledAutoRefuel;
16
- const showGasSufficiencyMessage = insufficientGas?.length && !isRefuelLoading && !enabledRefuel;
17
- return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || showGasSufficiencyMessage), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : showGasSufficiencyMessage ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
12
+ return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : insufficientGas?.length ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
18
13
  };
19
14
  exports.GasMessage = GasMessage;
@@ -16,7 +16,7 @@ const HeaderContainer = ({ children }) => {
16
16
  };
17
17
  exports.HeaderContainer = HeaderContainer;
18
18
  const Header = () => {
19
- const { walletManagement } = (0, providers_1.useWidgetConfig)();
20
- return ((0, jsx_runtime_1.jsxs)(exports.HeaderContainer, { children: [!walletManagement ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
19
+ const { walletManagement, subvariant } = (0, providers_1.useWidgetConfig)();
20
+ return ((0, jsx_runtime_1.jsxs)(exports.HeaderContainer, { children: [!walletManagement && subvariant !== 'split' ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
21
21
  };
22
22
  exports.Header = Header;
@@ -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;
@@ -42,4 +42,7 @@ exports.WalletButton = (0, styles_1.styled)(material_1.Button)(({ theme }) => ({
42
42
  [`.${Button_1.buttonClasses.endIcon} > *:nth-of-type(1)`]: {
43
43
  fontSize: '24px',
44
44
  },
45
+ [`.${Button_1.buttonClasses.startIcon} > *:nth-of-type(1)`]: {
46
+ fontSize: '24px',
47
+ },
45
48
  }));
@@ -10,12 +10,15 @@ const react_i18next_1 = require("react-i18next");
10
10
  const react_router_dom_1 = require("react-router-dom");
11
11
  const hooks_1 = require("../../hooks");
12
12
  const providers_1 = require("../../providers");
13
+ const types_1 = require("../../types");
13
14
  const utils_1 = require("../../utils");
14
15
  const Header_style_1 = require("./Header.style");
16
+ const NavigationTabs_1 = require("./NavigationTabs");
17
+ const WalletHeader_1 = require("./WalletHeader");
15
18
  const useHeaderActionStore_1 = require("./useHeaderActionStore");
16
19
  const NavigationHeader = () => {
17
20
  const { t } = (0, react_i18next_1.useTranslation)();
18
- const { variant } = (0, providers_1.useWidgetConfig)();
21
+ const { variant, subvariant, hiddenUI } = (0, providers_1.useWidgetConfig)();
19
22
  const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
20
23
  const { account } = (0, providers_1.useWallet)();
21
24
  const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
@@ -25,6 +28,7 @@ const NavigationHeader = () => {
25
28
  : pathname;
26
29
  const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
27
30
  const hasPath = utils_1.navigationRoutesValues.includes(path);
31
+ const splitSubvariant = subvariant === 'split' && !hasPath;
28
32
  const handleHeaderTitle = () => {
29
33
  switch (path) {
30
34
  case utils_1.navigationRoutes.selectWallet:
@@ -37,8 +41,12 @@ const NavigationHeader = () => {
37
41
  return t(`settings.enabledExchanges`);
38
42
  case utils_1.navigationRoutes.swapHistory:
39
43
  return t(`header.swapHistory`);
40
- case utils_1.navigationRoutes.fromToken:
44
+ case utils_1.navigationRoutes.fromToken: {
45
+ if (variant === 'nft') {
46
+ return t(`header.payWith`);
47
+ }
41
48
  return t(`header.from`);
49
+ }
42
50
  case utils_1.navigationRoutes.toToken:
43
51
  return t(`header.to`);
44
52
  case utils_1.navigationRoutes.fromChain:
@@ -49,10 +57,18 @@ const NavigationHeader = () => {
49
57
  return t(`header.routes`);
50
58
  case utils_1.navigationRoutes.activeSwaps:
51
59
  return t(`header.activeSwaps`);
52
- case utils_1.navigationRoutes.swapExecution:
60
+ case utils_1.navigationRoutes.swapExecution: {
61
+ if (variant === 'nft') {
62
+ return t(`header.purchase`);
63
+ }
53
64
  return t(`header.swap`);
54
- case utils_1.navigationRoutes.swapDetails:
65
+ }
66
+ case utils_1.navigationRoutes.swapDetails: {
67
+ if (variant === 'nft') {
68
+ return t(`header.purchaseDetails`);
69
+ }
55
70
  return t(`header.swapDetails`);
71
+ }
56
72
  default: {
57
73
  switch (variant) {
58
74
  case 'nft':
@@ -65,8 +81,8 @@ const NavigationHeader = () => {
65
81
  }
66
82
  }
67
83
  };
68
- return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
69
- marginRight: -1.25,
70
- }, children: (0, jsx_runtime_1.jsx)(Settings_1.default, {}) }) })] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] }));
84
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, splitSubvariant ? ((0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1, children: !hiddenUI?.includes(types_1.HiddenUI.WalletMenu) ? ((0, jsx_runtime_1.jsx)(WalletHeader_1.WalletMenuButton, {})) : null })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive && !hiddenUI?.includes(types_1.HiddenUI.History) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
85
+ marginRight: -1.25,
86
+ }, children: (0, jsx_runtime_1.jsx)(Settings_1.default, {}) }) })] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] }), splitSubvariant ? (0, jsx_runtime_1.jsx)(NavigationTabs_1.NavigationTabs, {}) : null] }));
71
87
  };
72
88
  exports.NavigationHeader = NavigationHeader;
@@ -0,0 +1 @@
1
+ export declare const NavigationTabs: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationTabs = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_hook_form_1 = require("react-hook-form");
6
+ const react_i18next_1 = require("react-i18next");
7
+ const providers_1 = require("../../providers");
8
+ const stores_1 = require("../../stores");
9
+ const Header_style_1 = require("./Header.style");
10
+ const NavigationTabs_style_1 = require("./NavigationTabs.style");
11
+ const NavigationTabs = () => {
12
+ const { t } = (0, react_i18next_1.useTranslation)();
13
+ const [state, setState] = (0, stores_1.useSplitSubvariantStore)((state) => [
14
+ state.state,
15
+ state.setState,
16
+ ]);
17
+ const { setValue } = (0, react_hook_form_1.useFormContext)();
18
+ const handleChange = (_, value) => {
19
+ setValue(providers_1.SwapFormKey.FromAmount, '');
20
+ setValue(providers_1.SwapFormKey.FromToken, '');
21
+ setValue(providers_1.SwapFormKey.ToToken, '');
22
+ setState(value === 0 ? 'swap' : 'bridge');
23
+ };
24
+ return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { py: 1 }, children: (0, jsx_runtime_1.jsxs)(NavigationTabs_style_1.NavbarTabs, { value: state === 'swap' ? 0 : 1, onChange: handleChange, "aria-label": "tabs", indicatorColor: "primary", children: [(0, jsx_runtime_1.jsx)(NavigationTabs_style_1.NavbarTab, { label: t('header.swap'), disableRipple: true }), (0, jsx_runtime_1.jsx)(NavigationTabs_style_1.NavbarTab, { label: t('header.bridge'), disableRipple: true })] }) }));
25
+ };
26
+ exports.NavigationTabs = NavigationTabs;
@@ -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,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavbarTab = exports.NavbarTabs = void 0;
4
+ const material_1 = require("@mui/material");
5
+ const styles_1 = require("@mui/material/styles");
6
+ exports.NavbarTabs = (0, styles_1.styled)(material_1.Tabs)(({ theme }) => ({
7
+ backgroundColor: theme.palette.mode === 'dark'
8
+ ? theme.palette.common.white
9
+ : (0, styles_1.alpha)(theme.palette.common.black, 0.04),
10
+ borderRadius: Math.max(theme.shape.borderRadius, theme.shape.borderRadiusSecondary),
11
+ padding: theme.spacing(0.5),
12
+ flex: 1,
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ height: 56,
16
+ [`.${material_1.tabsClasses.flexContainer}`]: {
17
+ alignItems: 'center',
18
+ },
19
+ [`.${material_1.tabsClasses.scroller}`]: {
20
+ overflow: 'initial !important',
21
+ },
22
+ [`.${material_1.tabsClasses.indicator}`]: {
23
+ position: 'absolute',
24
+ top: '50%',
25
+ transform: 'translateY(-50%)',
26
+ height: 48,
27
+ backgroundColor: theme.palette.mode === 'dark'
28
+ ? theme.palette.common.black
29
+ : theme.palette.common.white,
30
+ borderRadius: theme.shape.borderRadiusSecondary,
31
+ boxShadow: `0px 2px 4px ${(0, styles_1.alpha)(theme.palette.common.black, 0.04)}`,
32
+ },
33
+ }));
34
+ exports.NavbarTab = (0, styles_1.styled)(material_1.Tab, {
35
+ shouldForwardProp: (prop) => prop !== 'isDarkMode',
36
+ })(({ theme }) => ({
37
+ zIndex: 1,
38
+ display: 'flex',
39
+ flex: 1,
40
+ justifyContent: 'center',
41
+ alignItems: 'center',
42
+ flexDirection: 'row',
43
+ textTransform: 'none',
44
+ height: 48,
45
+ minHeight: 48,
46
+ fontSize: '1rem',
47
+ fontWeight: 700,
48
+ color: theme.palette.mode === 'dark'
49
+ ? theme.palette.common.white
50
+ : theme.palette.common.black,
51
+ textDecoration: 'none',
52
+ [`&.${material_1.tabClasses.selected}`]: {
53
+ color: theme.palette.mode === 'dark'
54
+ ? theme.palette.common.white
55
+ : theme.palette.common.black,
56
+ backgroundColor: 'transparent',
57
+ },
58
+ [`.${material_1.tabClasses.iconWrapper}`]: {
59
+ margin: theme.spacing(0, 1, 0, 0),
60
+ },
61
+ }));
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const WalletHeader: React.FC;
3
+ export declare const WalletMenuButton: React.FC;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WalletHeader = void 0;
3
+ exports.WalletMenuButton = exports.WalletHeader = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ContentCopyRounded_1 = require("@mui/icons-material/ContentCopyRounded");
6
6
  const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
@@ -17,31 +17,37 @@ const utils_1 = require("../../utils");
17
17
  const Header_style_1 = require("./Header.style");
18
18
  const WalletMenu_1 = require("./WalletMenu");
19
19
  const WalletHeader = () => {
20
- const { account } = (0, providers_1.useWallet)();
21
- return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: account.isActive ? (0, jsx_runtime_1.jsx)(ConnectedButton, {}) : (0, jsx_runtime_1.jsx)(ConnectButton, {}) }));
20
+ return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(exports.WalletMenuButton, {}) }));
22
21
  };
23
22
  exports.WalletHeader = WalletHeader;
23
+ const WalletMenuButton = () => {
24
+ const { account } = (0, providers_1.useWallet)();
25
+ return account.isActive ? (0, jsx_runtime_1.jsx)(ConnectedButton, {}) : (0, jsx_runtime_1.jsx)(ConnectButton, {});
26
+ };
27
+ exports.WalletMenuButton = WalletMenuButton;
24
28
  const ConnectButton = () => {
25
29
  const { t } = (0, react_i18next_1.useTranslation)();
26
30
  const { pathname } = (0, react_router_dom_1.useLocation)();
27
- const config = (0, providers_1.useWidgetConfig)();
31
+ const { walletManagement, subvariant } = (0, providers_1.useWidgetConfig)();
28
32
  const { connect: connectWallet } = (0, providers_1.useWallet)();
29
33
  const navigate = (0, react_router_dom_1.useNavigate)();
30
34
  const connect = async () => {
31
- if (config.walletManagement) {
35
+ if (walletManagement) {
32
36
  await connectWallet();
33
37
  return;
34
38
  }
35
39
  navigate(utils_1.navigationRoutes.selectWallet);
36
40
  };
37
- return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(Wallet_1.default, {}), onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined, sx: {
38
- marginRight: -1.25,
41
+ return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: subvariant !== 'split' ? (0, jsx_runtime_1.jsx)(Wallet_1.default, {}) : undefined, startIcon: subvariant === 'split' ? (0, jsx_runtime_1.jsx)(Wallet_1.default, {}) : undefined, onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined, sx: {
42
+ marginRight: subvariant === 'split' ? 0 : -1.25,
43
+ marginLeft: subvariant === 'split' ? -1.25 : 0,
39
44
  }, children: t(`button.connectWallet`) }));
40
45
  };
41
46
  const ConnectedButton = () => {
42
47
  const { t } = (0, react_i18next_1.useTranslation)();
48
+ const { subvariant } = (0, providers_1.useWidgetConfig)();
43
49
  const { account, disconnect } = (0, providers_1.useWallet)();
44
- const walletAddress = (0, utils_1.shortenWalletAddress)(account.address);
50
+ const walletAddress = (0, utils_1.shortenAddress)(account.address);
45
51
  const { chain } = (0, hooks_1.useChain)(account.chainId);
46
52
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
47
53
  const handleClick = (event) => {
@@ -59,7 +65,8 @@ const ConnectedButton = () => {
59
65
  handleClose();
60
66
  };
61
67
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}), startIcon: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
62
- marginRight: -1.25,
68
+ marginRight: subvariant === 'split' ? 0 : -1.25,
69
+ marginLeft: subvariant === 'split' ? -1 : 0,
63
70
  }, onClick: handleClick, children: walletAddress }), (0, jsx_runtime_1.jsxs)(WalletMenu_1.WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, {}), t(`button.copyAddress`)] }), (0, jsx_runtime_1.jsxs)(material_1.MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [(0, jsx_runtime_1.jsx)(OpenInNewRounded_1.default, {}), t(`button.viewOnExplorer`)] }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleDisconnect, fullWidth: true, startIcon: (0, jsx_runtime_1.jsx)(PowerSettingsNewRounded_1.default, {}), sx: {
64
71
  marginTop: 1,
65
72
  }, children: t(`button.disconnect`) })] })] }));
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useHeaderActionStore = void 0;
4
- /* eslint-disable no-underscore-dangle */
5
4
  const zustand_1 = require("zustand");
6
5
  exports.useHeaderActionStore = (0, zustand_1.create)((set, get) => ({
7
6
  setAction: (element) => {
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const stores_1 = require("../../stores");
6
6
  const InsuranceCard_1 = require("./InsuranceCard");
7
7
  const InsuranceCollapsed_1 = require("./InsuranceCollapsed");
8
- const Insurance = ({ status, insurableRouteId, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
9
- return status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InsuranceCollapsed_1.InsuranceCollapsed, { insurableRouteId: insurableRouteId, feeAmountUsd: feeAmountUsd, insuranceCoverageId: insuranceCoverageId, status: status, onChange: onChange, ...props })) : ((0, jsx_runtime_1.jsx)(InsuranceCard_1.InsuranceCard, { feeAmountUsd: feeAmountUsd, status: status, insuranceCoverageId: insuranceCoverageId, ...props }));
8
+ const Insurance = ({ status, insurableRouteId, onChange, ...props }) => {
9
+ return status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InsuranceCollapsed_1.InsuranceCollapsed, { status: status, insurableRouteId: insurableRouteId, onChange: onChange, ...props })) : ((0, jsx_runtime_1.jsx)(InsuranceCard_1.InsuranceCard, { status: status, ...props }));
10
10
  };
11
11
  exports.Insurance = Insurance;