@lifi/widget 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/App.js +2 -1
  2. package/AppDrawer.d.ts +1 -1
  3. package/AppProvider.d.ts +1 -1
  4. package/AppProvider.js +7 -2
  5. package/components/Header/Header.js +1 -1
  6. package/components/Header/NavigationHeader.js +5 -3
  7. package/components/Header/WalletHeader.js +1 -1
  8. package/components/Initializer.d.ts +2 -0
  9. package/components/Initializer.js +5 -0
  10. package/components/StepToken.js +1 -1
  11. package/components/SwapButton/SwapButton.js +5 -2
  12. package/components/SwapInProgress/SwapInProgress.js +1 -1
  13. package/components/SwapRoutes/SwapRoutes.js +2 -1
  14. package/components/TextFitter/TextFitter.js +9 -5
  15. package/fonts/Inter-Black.woff +0 -0
  16. package/fonts/Inter-Black.woff2 +0 -0
  17. package/fonts/Inter-BlackItalic.woff +0 -0
  18. package/fonts/Inter-BlackItalic.woff2 +0 -0
  19. package/fonts/Inter-Bold.woff +0 -0
  20. package/fonts/Inter-Bold.woff2 +0 -0
  21. package/fonts/Inter-BoldItalic.woff +0 -0
  22. package/fonts/Inter-BoldItalic.woff2 +0 -0
  23. package/fonts/Inter-ExtraBold.woff +0 -0
  24. package/fonts/Inter-ExtraBold.woff2 +0 -0
  25. package/fonts/Inter-ExtraBoldItalic.woff +0 -0
  26. package/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
  27. package/fonts/Inter-ExtraLight.woff +0 -0
  28. package/fonts/Inter-ExtraLight.woff2 +0 -0
  29. package/fonts/Inter-ExtraLightItalic.woff +0 -0
  30. package/fonts/Inter-ExtraLightItalic.woff2 +0 -0
  31. package/fonts/Inter-Italic.woff +0 -0
  32. package/fonts/Inter-Italic.woff2 +0 -0
  33. package/fonts/Inter-Light.woff +0 -0
  34. package/fonts/Inter-Light.woff2 +0 -0
  35. package/fonts/Inter-LightItalic.woff +0 -0
  36. package/fonts/Inter-LightItalic.woff2 +0 -0
  37. package/fonts/Inter-Medium.woff +0 -0
  38. package/fonts/Inter-Medium.woff2 +0 -0
  39. package/fonts/Inter-MediumItalic.woff +0 -0
  40. package/fonts/Inter-MediumItalic.woff2 +0 -0
  41. package/fonts/Inter-Regular.woff +0 -0
  42. package/fonts/Inter-Regular.woff2 +0 -0
  43. package/fonts/Inter-SemiBold.woff +0 -0
  44. package/fonts/Inter-SemiBold.woff2 +0 -0
  45. package/fonts/Inter-SemiBoldItalic.woff +0 -0
  46. package/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  47. package/fonts/Inter-Thin.woff +0 -0
  48. package/fonts/Inter-Thin.woff2 +0 -0
  49. package/fonts/Inter-ThinItalic.woff +0 -0
  50. package/fonts/Inter-ThinItalic.woff2 +0 -0
  51. package/fonts/Inter-italic.var.woff2 +0 -0
  52. package/fonts/Inter-roman.var.woff2 +0 -0
  53. package/fonts/Inter.var.woff2 +0 -0
  54. package/fonts/inter.css +200 -0
  55. package/hooks/index.d.ts +1 -3
  56. package/hooks/index.js +1 -3
  57. package/hooks/useContentHeight.js +18 -10
  58. package/hooks/useHasSufficientBalance.js +1 -1
  59. package/hooks/useInitializer.d.ts +1 -0
  60. package/hooks/useInitializer.js +5 -0
  61. package/hooks/{useRouteExecution/useRouteExecution.d.ts → useRouteExecution.d.ts} +1 -1
  62. package/hooks/{useRouteExecution/useRouteExecution.js → useRouteExecution.js} +5 -5
  63. package/hooks/useSwapRoutes.js +9 -7
  64. package/hooks/useTools.d.ts +1 -0
  65. package/hooks/useTools.js +14 -0
  66. package/i18n/en/translation.json +134 -136
  67. package/i18n/index.d.ts +0 -2
  68. package/icons/LiFiFullLogo.svg +10 -0
  69. package/icons/LiFiLogo.svg +5 -0
  70. package/package.json +7 -6
  71. package/pages/SelectTokenPage/ChainSelect.js +1 -1
  72. package/pages/SettingsPage/AdvancedPreferences.js +5 -4
  73. package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
  74. package/pages/SettingsPage/EnabledBridgesSelect.js +11 -6
  75. package/pages/SettingsPage/EnabledExchangesSelect.js +10 -6
  76. package/pages/SettingsPage/GasPriceSelect.js +4 -4
  77. package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
  78. package/pages/SettingsPage/SlippageInput.js +7 -10
  79. package/pages/SwapPage/ExecutionItem.js +1 -1
  80. package/pages/SwapPage/StatusBottomSheet.d.ts +1 -1
  81. package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  82. package/pages/SwapPage/StepItem.js +1 -1
  83. package/pages/SwapPage/StepTimer.js +3 -2
  84. package/pages/SwapRoutesPage/SwapRoutesPage.js +2 -1
  85. package/providers/SwapFormProvider/SwapFormProvider.d.ts +0 -3
  86. package/providers/SwapFormProvider/SwapFormProvider.js +0 -3
  87. package/providers/SwapFormProvider/types.d.ts +0 -19
  88. package/providers/SwapFormProvider/types.js +0 -9
  89. package/providers/ThemeProvider/ThemeProvider.js +1 -1
  90. package/providers/WidgetProvider/WidgetProvider.js +3 -5
  91. package/providers/WidgetProvider/types.d.ts +3 -3
  92. package/stores/index.d.ts +2 -0
  93. package/stores/index.js +2 -0
  94. package/stores/route/index.d.ts +5 -0
  95. package/stores/route/index.js +5 -0
  96. package/{hooks/useRouteExecution → stores/route}/types.d.ts +0 -0
  97. package/{hooks/useRouteExecution → stores/route}/types.js +0 -0
  98. package/stores/route/useCurrentRoute.d.ts +2 -0
  99. package/stores/route/useCurrentRoute.js +5 -0
  100. package/stores/route/useExecutingRoutes.d.ts +1 -0
  101. package/stores/route/useExecutingRoutes.js +4 -0
  102. package/{hooks/useRouteExecution → stores/route}/useRouteStore.d.ts +3 -5
  103. package/{hooks/useRouteExecution → stores/route}/useRouteStore.js +16 -26
  104. package/stores/route/useSetExecutableRoute.d.ts +1 -0
  105. package/stores/route/useSetExecutableRoute.js +4 -0
  106. package/stores/settings/index.d.ts +5 -0
  107. package/stores/settings/index.js +5 -0
  108. package/stores/settings/types.d.ts +23 -0
  109. package/stores/settings/types.js +1 -0
  110. package/stores/settings/useAppearance.d.ts +2 -0
  111. package/stores/settings/useAppearance.js +7 -0
  112. package/stores/settings/useSetSettings.d.ts +5 -0
  113. package/stores/settings/useSetSettings.js +5 -0
  114. package/stores/settings/useSettings.d.ts +2 -0
  115. package/stores/settings/useSettings.js +8 -0
  116. package/stores/settings/useSettingsStore.d.ts +25 -0
  117. package/stores/settings/useSettingsStore.js +84 -0
  118. package/types/widget.d.ts +31 -23
  119. package/utils/format.d.ts +1 -1
  120. package/utils/format.js +1 -1
  121. package/utils/routes.d.ts +1 -0
  122. package/utils/routes.js +7 -6
  123. package/hooks/useBridges.d.ts +0 -1
  124. package/hooks/useBridges.js +0 -12
  125. package/hooks/useExchanges.d.ts +0 -1
  126. package/hooks/useExchanges.js +0 -12
  127. package/hooks/useRouteExecution/index.d.ts +0 -3
  128. package/hooks/useRouteExecution/index.js +0 -3
  129. package/hooks/useSettings/index.d.ts +0 -2
  130. package/hooks/useSettings/index.js +0 -2
  131. package/hooks/useSettings/types.d.ts +0 -5
  132. package/hooks/useSettings/types.js +0 -1
  133. package/hooks/useSettings/useSettingsStore.d.ts +0 -13
  134. package/hooks/useSettings/useSettingsStore.js +0 -22
  135. package/i18n/react-i18next.d.ts +0 -9
  136. package/pages/MainPage/SendToRecipientForm.d.ts +0 -2
  137. package/pages/MainPage/SendToRecipientForm.js +0 -20
  138. package/react-app-env.d.ts +0 -1
@@ -1,12 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useQuery } from 'react-query';
3
- import { LiFi } from '../lifi';
4
- export const useBridges = () => {
5
- const { data } = useQuery(['bridges'], ({ signal }) => LiFi.getPossibilities({ include: ['bridges'] }, { signal }));
6
- const bridges = useMemo(() => {
7
- var _a;
8
- const bridges = (_a = data === null || data === void 0 ? void 0 : data.bridges) === null || _a === void 0 ? void 0 : _a.map((bridge) => bridge.tool).map((bridegTool) => bridegTool.split('-')[0]);
9
- return Array.from(new Set(bridges));
10
- }, [data === null || data === void 0 ? void 0 : data.bridges]);
11
- return bridges;
12
- };
@@ -1 +0,0 @@
1
- export declare const useExchanges: () => string[];
@@ -1,12 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useQuery } from 'react-query';
3
- import { LiFi } from '../lifi';
4
- export const useExchanges = () => {
5
- const { data } = useQuery(['exchanges'], ({ signal }) => LiFi.getPossibilities({ include: ['exchanges'] }, { signal }));
6
- const exchanges = useMemo(() => {
7
- var _a;
8
- const exchanges = (_a = data === null || data === void 0 ? void 0 : data.exchanges) === null || _a === void 0 ? void 0 : _a.map((exchange) => exchange.tool).map((exchangeTool) => exchangeTool.split('-')[0]);
9
- return Array.from(new Set(exchanges));
10
- }, [data === null || data === void 0 ? void 0 : data.exchanges]);
11
- return exchanges;
12
- };
@@ -1,3 +0,0 @@
1
- export * from './types';
2
- export * from './useRouteExecution';
3
- export * from './useRouteStore';
@@ -1,3 +0,0 @@
1
- export * from './types';
2
- export * from './useRouteExecution';
3
- export * from './useRouteStore';
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './useSettingsStore';
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './useSettingsStore';
@@ -1,5 +0,0 @@
1
- import { Appearance } from '../../types';
2
- export interface SettingsStore {
3
- appearance: Appearance;
4
- setAppearance(appearance: Appearance): void;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import { Appearance } from '../../types';
2
- import { SettingsStore } from './types';
3
- export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SettingsStore>, "persist"> & {
4
- persist: {
5
- setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SettingsStore, Partial<SettingsStore>>>) => void;
6
- clearStorage: () => void;
7
- rehydrate: () => Promise<void>;
8
- hasHydrated: () => boolean;
9
- onHydrate: (fn: (state: SettingsStore) => void) => () => void;
10
- onFinishHydration: (fn: (state: SettingsStore) => void) => () => void;
11
- };
12
- }>;
13
- export declare const useAppearance: () => [Appearance, (appearance: Appearance) => void];
@@ -1,22 +0,0 @@
1
- import produce from 'immer';
2
- import create from 'zustand';
3
- import { persist } from 'zustand/middleware';
4
- import shallow from 'zustand/shallow';
5
- export const useSettingsStore = create()(persist((set) => ({
6
- appearance: 'auto',
7
- setAppearance: (appearance) => set(produce((state) => {
8
- state.appearance = appearance;
9
- })),
10
- }), {
11
- name: 'li.fi-widget-settings',
12
- version: 1,
13
- migrate: (persistedState, version) => {
14
- if (version === 0 && persistedState.appearance === 'system') {
15
- persistedState.appearance = 'auto';
16
- }
17
- return persistedState;
18
- },
19
- }));
20
- export const useAppearance = () => {
21
- return useSettingsStore((state) => [state.appearance, state.setAppearance], shallow);
22
- };
@@ -1,9 +0,0 @@
1
- import 'react-i18next';
2
- import { defaultNS, resources } from '.';
3
-
4
- declare module 'react-i18next' {
5
- interface CustomTypeOptions {
6
- defaultNS: typeof defaultNS;
7
- resources: typeof resources['en'];
8
- }
9
- }
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const SendToRecipientForm: React.FC;
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { HelpOutline as HelpOutlineIcon } from '@mui/icons-material';
3
- import { Box, Checkbox, FormControl, FormControlLabel, Typography, } from '@mui/material';
4
- import { useFormContext, useWatch } from 'react-hook-form';
5
- import { useTranslation } from 'react-i18next';
6
- import { Input } from '../../components/Input';
7
- import { Switch } from '../../components/Switch';
8
- import { SwapFormKey } from '../../providers/SwapFormProvider';
9
- export const SendToRecipientForm = () => {
10
- const { t } = useTranslation();
11
- const { register } = useFormContext();
12
- const sendToRecipientChecked = useWatch({
13
- name: SwapFormKey.IsSendToRecipient,
14
- });
15
- return (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ mb: 2, sx: {
16
- display: 'flex',
17
- justifyContent: 'space-between',
18
- alignItems: 'center',
19
- } }, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(HelpOutlineIcon, { sx: { color: 'grey.500' } }), _jsx(Typography, Object.assign({ lineHeight: "normal", variant: "subtitle1", color: "text.primary", ml: 1 }, { children: t(`swap.sendToRecipient`) }))] })), _jsx(Switch, Object.assign({}, register(SwapFormKey.IsSendToRecipient)))] })), sendToRecipientChecked ? (_jsxs(_Fragment, { children: [_jsx(FormControl, Object.assign({ variant: "standard", fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`swap.recipientsAddress`, { chain: 'ETH' }), required: true, inputProps: Object.assign({}, register(SwapFormKey.RecipientsAddress)) }) })), _jsx(Box, Object.assign({ mt: 0.5, mb: 1 }, { children: _jsx(FormControlLabel, { control: _jsx(Checkbox, Object.assign({ required: true }, register(SwapFormKey.IsAddressConfirmed))), label: t(`swap.addressConfirmation`), componentsProps: { typography: { variant: 'body2' } } }) }))] })) : null] }));
20
- };
@@ -1 +0,0 @@
1
- /// <reference types="react-scripts" />