@lifi/widget 1.31.1 → 1.32.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.
- package/App.js +4 -16
- package/AppDrawer.js +13 -7
- package/AppDrawer.style.d.ts +2 -2
- package/AppDrawer.style.js +1 -1
- package/AppProvider.js +1 -1
- package/AppRoutes.js +9 -0
- package/cjs/App.js +4 -16
- package/cjs/AppDrawer.js +13 -7
- package/cjs/AppDrawer.style.d.ts +2 -2
- package/cjs/AppDrawer.style.js +1 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/AppRoutes.js +9 -0
- package/cjs/components/ActiveSwaps/ActiveSwapItem.js +9 -7
- package/cjs/components/ActiveSwaps/ActiveSwaps.js +3 -3
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
- package/cjs/components/AppContainer.d.ts +2 -2
- package/cjs/components/AppContainer.js +1 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/BottomSheet/BottomSheet.js +2 -2
- package/cjs/components/Card/Card.d.ts +2 -2
- package/cjs/components/Card/CardHeader.d.ts +1 -1
- package/cjs/components/Card/CardTitle.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/ChainSelect/ChainSelect.js +3 -4
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/cjs/components/ContractComponent/ContractComponent.js +1 -1
- package/cjs/components/Dialog.js +1 -1
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
- package/cjs/components/Header/Header.js +1 -1
- package/cjs/components/Header/Header.style.d.ts +3 -3
- package/cjs/components/Header/NavigationHeader.js +6 -2
- package/cjs/components/Header/WalletHeader.js +12 -22
- package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
- package/cjs/{pages/SelectWalletPage/SelectWalletPage.style.js → components/ListItemButton.js} +2 -8
- package/cjs/components/ListItemText.d.ts +2 -0
- package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js → components/ListItemText.js} +1 -10
- package/cjs/components/NFT/NFT.js +2 -14
- package/cjs/components/NFT/NFT.style.d.ts +1 -1
- package/cjs/components/NotFound.js +2 -2
- package/cjs/components/PoweredBy/PoweredBy.js +2 -2
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/Select.js +1 -0
- package/cjs/components/SelectChainAndToken.js +4 -4
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +2 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +9 -19
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +5 -5
- package/cjs/components/SmallAvatar.d.ts +3 -3
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/Step/CircularProgress.js +2 -2
- package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
- package/cjs/components/Step/DestinationWalletAddress.js +6 -7
- package/cjs/components/Step/GasStepProcess.js +8 -8
- package/cjs/components/Step/Step.js +4 -5
- package/cjs/components/Step/StepList.d.ts +0 -1
- package/cjs/components/Step/StepList.js +8 -4
- package/cjs/components/Step/StepProcess.js +3 -3
- package/cjs/components/Step/StepProcess.style.d.ts +2 -2
- package/cjs/components/Step/StepTimer.js +4 -8
- package/cjs/components/StepActions/StepActions.js +20 -37
- package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
- package/cjs/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +5 -14
- package/cjs/components/SwapInput/FormPriceHelperText.js +6 -6
- package/cjs/components/SwapInput/SwapInput.js +4 -16
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -3
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +9 -25
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
- package/cjs/components/SwapRouteCard/utils.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
- package/cjs/components/TextFitter/TextFitter.js +3 -3
- package/cjs/components/Token/Token.js +19 -33
- package/cjs/components/Token/Token.style.d.ts +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.js +6 -7
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.js +3 -4
- package/cjs/components/TokenList/TokenList.style.d.ts +2 -2
- package/cjs/components/TokenList/TokenList.style.js +2 -6
- package/cjs/components/TokenList/TokenListItem.js +9 -9
- package/cjs/components/TokenList/TokenNotFound.js +4 -5
- package/cjs/components/TokenList/VirtualizedTokenList.js +10 -11
- package/cjs/components/TokenList/useTokenSelect.js +2 -2
- package/cjs/config/env.js +1 -1
- package/cjs/config/sentry.js +3 -12
- package/cjs/config/theme.js +44 -16
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChain.js +1 -1
- package/cjs/hooks/useChains.js +5 -14
- package/cjs/hooks/useContentHeight.js +1 -2
- package/cjs/hooks/useFeaturedTokens.js +1 -4
- package/cjs/hooks/useGasSufficiency.js +28 -34
- package/cjs/hooks/useProcessMessage.js +7 -11
- package/cjs/hooks/useRouteExecution.js +16 -26
- package/cjs/hooks/useSwapRoutes.js +16 -26
- package/cjs/hooks/useToken.js +2 -2
- package/cjs/hooks/useTokenAddressBalance.js +1 -2
- package/cjs/hooks/useTokenBalance.js +24 -27
- package/cjs/hooks/useTokenBalances.d.ts +1 -1
- package/cjs/hooks/useTokenBalances.js +8 -20
- package/cjs/hooks/useTokenSearch.d.ts +1 -1
- package/cjs/hooks/useTokenSearch.js +12 -21
- package/cjs/hooks/useTokens.d.ts +1 -1
- package/cjs/hooks/useTokens.js +36 -38
- package/cjs/hooks/useTools.d.ts +2 -11
- package/cjs/hooks/useTools.js +10 -19
- package/cjs/i18n/en.json +8 -4
- package/cjs/icons/LiFiFullLogo.js +1 -1
- package/cjs/icons/LiFiLogo.js +1 -1
- package/cjs/icons/LiFiToolLogo.js +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
- package/cjs/pages/MainPage/MainPage.js +1 -1
- package/cjs/pages/MainPage/MainPage.style.d.ts +1 -1
- package/cjs/pages/MainPage/MainSwapButton.js +3 -12
- package/cjs/pages/SelectChainPage/SelectChainPage.js +6 -14
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +51 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +8 -0
- package/cjs/pages/SelectEnabledToolsPage/index.d.ts +1 -0
- package/cjs/pages/SelectEnabledToolsPage/index.js +17 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +4 -1
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -3
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +13 -19
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
- package/cjs/pages/SettingsPage/EnabledToolsButton.js +25 -0
- package/cjs/pages/{SelectChainPage/SelectChainPage.style.d.ts → SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
- package/cjs/pages/{SelectChainPage/SelectChainPage.style.js → SettingsPage/EnabledToolsButton.style.js} +7 -10
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.js +5 -6
- package/cjs/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
- package/cjs/pages/SettingsPage/ResetSettingsButton.js +27 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +4 -4
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/SettingsPage.js +3 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +3 -3
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.js +3 -3
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
- package/cjs/pages/SwapPage/StartSwapButton.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +21 -19
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
- package/cjs/pages/SwapPage/SwapPage.js +9 -21
- package/cjs/pages/SwapPage/SwapPage.style.d.ts +1 -1
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +8 -9
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
- package/cjs/providers/I18nProvider/I18nProvider.js +7 -8
- package/cjs/providers/SDKProvider/SDKProvider.js +15 -4
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +12 -6
- package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
- package/cjs/providers/TelemetryProvider/TelemetryProvider.js +1 -1
- package/cjs/providers/ThemeProvider/ThemeProvider.js +2 -2
- package/cjs/providers/WalletProvider/WalletProvider.js +30 -39
- package/cjs/providers/WidgetProvider/WidgetProvider.js +18 -23
- package/cjs/providers/WidgetProvider/utils.js +2 -3
- package/cjs/stores/StoreProvider.js +2 -2
- package/cjs/stores/chains/ChainOrderStore.js +2 -14
- package/cjs/stores/routes/RouteExecutionStore.js +2 -14
- package/cjs/stores/routes/createRouteExecutionStore.js +27 -16
- package/cjs/stores/routes/useExecutingRoutesIds.js +2 -5
- package/cjs/stores/routes/useSwapHistory.js +3 -6
- package/cjs/stores/routes/utils.js +4 -4
- package/cjs/stores/settings/SettingsStore.js +10 -20
- package/cjs/stores/settings/createSettingsStore.js +29 -25
- package/cjs/stores/settings/types.d.ts +6 -6
- package/cjs/utils/colors.js +1 -1
- package/cjs/utils/format.js +3 -3
- package/cjs/utils/navigationRoutes.d.ts +2 -0
- package/cjs/utils/navigationRoutes.js +6 -0
- package/components/ActiveSwaps/ActiveSwapItem.js +9 -7
- package/components/ActiveSwaps/ActiveSwaps.js +3 -3
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
- package/components/AppContainer.d.ts +2 -2
- package/components/AppContainer.js +1 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.js +2 -2
- package/components/Card/Card.d.ts +2 -2
- package/components/Card/CardHeader.d.ts +1 -1
- package/components/Card/CardTitle.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/ChainSelect/ChainSelect.js +3 -4
- package/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/components/ContractComponent/ContractComponent.js +1 -1
- package/components/Dialog.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.d.ts +3 -3
- package/components/Header/NavigationHeader.js +6 -2
- package/components/Header/WalletHeader.js +12 -22
- package/{pages/SelectChainPage/SelectChainPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
- package/components/ListItemButton.js +11 -0
- package/components/ListItemText.d.ts +2 -0
- package/components/ListItemText.js +8 -0
- package/components/NFT/NFT.js +2 -14
- package/components/NFT/NFT.style.d.ts +1 -1
- package/components/NotFound.js +2 -2
- package/components/PoweredBy/PoweredBy.js +2 -2
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
- package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/Select.js +1 -0
- package/components/SelectChainAndToken.js +4 -4
- package/components/SelectTokenButton/SelectTokenButton.js +2 -2
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.js +9 -19
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +5 -5
- package/components/SmallAvatar.d.ts +3 -3
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/Step/CircularProgress.js +2 -2
- package/components/Step/CircularProgress.style.d.ts +1 -1
- package/components/Step/DestinationWalletAddress.js +6 -7
- package/components/Step/GasStepProcess.js +8 -8
- package/components/Step/Step.js +4 -5
- package/components/Step/StepList.d.ts +0 -1
- package/components/Step/StepList.js +8 -4
- package/components/Step/StepProcess.js +3 -3
- package/components/Step/StepProcess.style.d.ts +2 -2
- package/components/Step/StepTimer.js +4 -8
- package/components/StepActions/StepActions.js +20 -37
- package/components/StepActions/StepActions.style.d.ts +1 -1
- package/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +5 -14
- package/components/SwapInput/FormPriceHelperText.js +6 -6
- package/components/SwapInput/SwapInput.js +4 -16
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/components/SwapInput/SwapInputEndAdornment.js +2 -3
- package/components/SwapRouteCard/SwapRouteCard.js +9 -25
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
- package/components/SwapRouteCard/utils.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +4 -4
- package/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
- package/components/TextFitter/TextFitter.js +3 -3
- package/components/Token/Token.js +19 -33
- package/components/Token/Token.style.d.ts +3 -3
- package/components/TokenAvatar/TokenAvatar.js +6 -7
- package/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/components/TokenList/TokenList.js +3 -4
- package/components/TokenList/TokenList.style.d.ts +2 -2
- package/components/TokenList/TokenList.style.js +3 -7
- package/components/TokenList/TokenListItem.js +9 -9
- package/components/TokenList/TokenNotFound.js +4 -5
- package/components/TokenList/VirtualizedTokenList.js +10 -11
- package/components/TokenList/useTokenSelect.js +2 -2
- package/config/env.js +1 -1
- package/config/sentry.js +3 -12
- package/config/theme.js +44 -16
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChain.js +1 -1
- package/hooks/useChains.js +5 -14
- package/hooks/useContentHeight.js +1 -2
- package/hooks/useFeaturedTokens.js +1 -4
- package/hooks/useGasSufficiency.js +28 -34
- package/hooks/useProcessMessage.js +7 -11
- package/hooks/useRouteExecution.js +16 -26
- package/hooks/useSwapRoutes.js +16 -26
- package/hooks/useToken.js +2 -2
- package/hooks/useTokenAddressBalance.js +1 -2
- package/hooks/useTokenBalance.js +24 -27
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenBalances.js +8 -20
- package/hooks/useTokenSearch.d.ts +1 -1
- package/hooks/useTokenSearch.js +12 -21
- package/hooks/useTokens.d.ts +1 -1
- package/hooks/useTokens.js +36 -38
- package/hooks/useTools.d.ts +2 -11
- package/hooks/useTools.js +10 -19
- package/i18n/en.json +8 -4
- package/icons/LiFiFullLogo.js +1 -1
- package/icons/LiFiLogo.js +1 -1
- package/icons/LiFiToolLogo.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +7 -7
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
- package/pages/MainPage/MainPage.js +1 -1
- package/pages/MainPage/MainPage.style.d.ts +1 -1
- package/pages/MainPage/MainSwapButton.js +3 -12
- package/pages/SelectChainPage/SelectChainPage.js +6 -14
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +47 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +5 -0
- package/pages/SelectEnabledToolsPage/index.d.ts +1 -0
- package/pages/SelectEnabledToolsPage/index.js +1 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectTokenPage/SearchTokenInput.js +4 -1
- package/pages/SelectTokenPage/SelectTokenPage.js +2 -3
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.js +13 -19
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
- package/pages/SettingsPage/EnabledToolsButton.js +21 -0
- package/{cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts → pages/SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
- package/pages/SettingsPage/EnabledToolsButton.style.js +14 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/GasPriceSelect.js +1 -1
- package/pages/SettingsPage/LanguageSelect.js +5 -6
- package/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
- package/pages/SettingsPage/ResetSettingsButton.js +23 -0
- package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.js +3 -2
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/pages/SettingsPage/ShowDestinationWallet.js +3 -3
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.js +3 -3
- package/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
- package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
- package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
- package/pages/SwapPage/StartSwapButton.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.js +21 -19
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
- package/pages/SwapPage/SwapPage.js +9 -21
- package/pages/SwapPage/SwapPage.style.d.ts +1 -1
- package/pages/SwapPage/TokenValueBottomSheet.js +8 -9
- package/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
- package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
- package/providers/I18nProvider/I18nProvider.js +7 -8
- package/providers/SDKProvider/SDKProvider.js +15 -4
- package/providers/SwapFormProvider/SwapFormProvider.js +12 -6
- package/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
- package/providers/TelemetryProvider/TelemetryProvider.js +1 -1
- package/providers/ThemeProvider/ThemeProvider.js +2 -2
- package/providers/WalletProvider/WalletProvider.js +30 -39
- package/providers/WidgetProvider/WidgetProvider.js +18 -23
- package/providers/WidgetProvider/utils.js +2 -3
- package/stores/StoreProvider.js +2 -2
- package/stores/chains/ChainOrderStore.js +2 -14
- package/stores/routes/RouteExecutionStore.js +2 -14
- package/stores/routes/createRouteExecutionStore.js +27 -16
- package/stores/routes/useExecutingRoutesIds.js +2 -5
- package/stores/routes/useSwapHistory.js +3 -6
- package/stores/routes/utils.js +4 -4
- package/stores/settings/SettingsStore.js +10 -20
- package/stores/settings/createSettingsStore.js +29 -25
- package/stores/settings/types.d.ts +6 -6
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/colors.js +1 -1
- package/utils/format.js +3 -3
- package/utils/navigationRoutes.d.ts +2 -0
- package/utils/navigationRoutes.js +6 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +0 -24
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +0 -24
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +0 -24
- package/pages/SelectChainPage/SelectChainPage.style.js +0 -17
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +0 -21
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +0 -17
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +0 -21
- package/pages/SelectWalletPage/SelectWalletPage.style.js +0 -17
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
- package/pages/SettingsPage/AdvancedPreferences.js +0 -20
- package/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
- package/pages/SettingsPage/EnabledBridgesSelect.js +0 -20
- package/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
- package/pages/SettingsPage/EnabledExchangesSelect.js +0 -20
|
@@ -6,7 +6,6 @@ import { Card } from '../../components/Card';
|
|
|
6
6
|
import { Token, TokenDivider } from '../../components/Token';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
8
|
export const SwapHistoryItem = ({ route }) => {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10
9
|
const { i18n } = useTranslation();
|
|
11
10
|
const navigate = useNavigate();
|
|
12
11
|
const handleClick = () => {
|
|
@@ -14,14 +13,17 @@ export const SwapHistoryItem = ({ route }) => {
|
|
|
14
13
|
state: { routeId: route.id },
|
|
15
14
|
});
|
|
16
15
|
};
|
|
17
|
-
const startedAt = new Date(
|
|
18
|
-
const fromToken =
|
|
19
|
-
const toToken =
|
|
20
|
-
|
|
16
|
+
const startedAt = new Date(route.steps[0].execution?.process[0].startedAt ?? 0);
|
|
17
|
+
const fromToken = { ...route.fromToken, amount: route.fromAmount };
|
|
18
|
+
const toToken = {
|
|
19
|
+
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
20
|
+
amount: route.steps.at(-1)?.execution?.toAmount ?? route.toAmount,
|
|
21
|
+
};
|
|
22
|
+
return (_jsxs(Card, { onClick: handleClick, children: [_jsxs(Box, { sx: {
|
|
21
23
|
display: 'flex',
|
|
22
24
|
flex: 1,
|
|
23
25
|
justifyContent: 'space-between',
|
|
24
|
-
}, pt: 1.75, px: 2
|
|
26
|
+
}, pt: 1.75, px: 2, children: [_jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), _jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
|
|
25
27
|
timeStyle: 'short',
|
|
26
|
-
}).format(startedAt) })
|
|
28
|
+
}).format(startedAt) })] }), _jsxs(Box, { py: 1, children: [_jsx(Token, { token: fromToken, px: 2, pt: 1, connected: true }), _jsx(TokenDivider, {}), _jsx(Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] })] }));
|
|
27
29
|
};
|
|
@@ -22,11 +22,11 @@ export const SwapHistoryPage = () => {
|
|
|
22
22
|
}, []);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
if (swaps.length) {
|
|
25
|
-
return useHeaderActionStore.getState().setAction(_jsx(IconButton,
|
|
25
|
+
return useHeaderActionStore.getState().setAction(_jsx(IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: _jsx(DeleteIcon, {}) }));
|
|
26
26
|
}
|
|
27
27
|
}, [swaps.length, toggleDialog]);
|
|
28
28
|
if (!swaps.length) {
|
|
29
29
|
return _jsx(SwapHistoryEmpty, {});
|
|
30
30
|
}
|
|
31
|
-
return (_jsxs(Container, { children: [_jsx(Stack,
|
|
31
|
+
return (_jsxs(Container, { children: [_jsx(Stack, { spacing: 2, mt: 1, children: swaps.length ? (swaps.map(({ route }) => (_jsx(SwapHistoryItem, { route: route }, route.id)))) : (_jsx(SwapHistoryEmpty, {})) }), _jsxs(Dialog, { open: open, onClose: toggleDialog, children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: toggleDialog, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
32
32
|
};
|
|
@@ -13,60 +13,55 @@ export const ExchangeRateBottomSheet = forwardRef(({ onContinue, onCancel }, ref
|
|
|
13
13
|
const bottomSheetRef = useRef(null);
|
|
14
14
|
const resolverRef = useRef();
|
|
15
15
|
const handleContinue = () => {
|
|
16
|
-
|
|
17
|
-
(
|
|
18
|
-
onContinue === null || onContinue === void 0 ? void 0 : onContinue();
|
|
16
|
+
ref.current?.close(true);
|
|
17
|
+
onContinue?.();
|
|
19
18
|
};
|
|
20
19
|
const handleCancel = useCallback(() => {
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
20
|
+
ref.current?.close(false);
|
|
21
|
+
onCancel?.();
|
|
24
22
|
}, [onCancel, ref]);
|
|
25
23
|
const handleClose = useCallback(() => {
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
24
|
+
ref.current?.close(false, false);
|
|
25
|
+
onCancel?.();
|
|
29
26
|
}, [onCancel, ref]);
|
|
30
27
|
useImperativeHandle(ref, () => ({
|
|
31
|
-
isOpen: () =>
|
|
28
|
+
isOpen: () => bottomSheetRef.current?.isOpen(),
|
|
32
29
|
open: (resolver, data) => {
|
|
33
|
-
var _a;
|
|
34
30
|
setData(data);
|
|
35
31
|
resolverRef.current = resolver;
|
|
36
|
-
|
|
32
|
+
bottomSheetRef.current?.open();
|
|
37
33
|
},
|
|
38
34
|
close: (value = false, bottomSheetClose = true) => {
|
|
39
|
-
|
|
40
|
-
(_a = resolverRef.current) === null || _a === void 0 ? void 0 : _a.call(resolverRef, value);
|
|
35
|
+
resolverRef.current?.(value);
|
|
41
36
|
if (bottomSheetClose) {
|
|
42
|
-
|
|
37
|
+
bottomSheetRef.current?.close();
|
|
43
38
|
}
|
|
44
39
|
},
|
|
45
40
|
}), []);
|
|
46
|
-
return (_jsx(BottomSheet,
|
|
41
|
+
return (_jsx(BottomSheet, { ref: bottomSheetRef, onClose: handleClose, children: _jsx(ExchangeRateBottomSheetContent, { data: data, onContinue: handleContinue, onCancel: handleCancel }) }));
|
|
47
42
|
});
|
|
48
43
|
const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
49
44
|
const { t } = useTranslation();
|
|
50
45
|
const ref = useRef();
|
|
51
46
|
useSetContentHeight(ref);
|
|
52
|
-
return (_jsxs(Box,
|
|
53
|
-
value: formatTokenAmount(data
|
|
54
|
-
}), ' ', data
|
|
55
|
-
value: formatTokenAmount(data
|
|
56
|
-
}), ' ', data
|
|
57
|
-
.div(Big(
|
|
47
|
+
return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
|
|
48
|
+
value: formatTokenAmount(data?.oldToAmount, data?.toToken.decimals, 5),
|
|
49
|
+
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
|
|
50
|
+
value: formatTokenAmount(data?.newToAmount, data?.toToken.decimals, 5),
|
|
51
|
+
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.rateChange') }), _jsxs(Typography, { fontWeight: 600, children: [Big(data?.newToAmount || 0)
|
|
52
|
+
.div(Big(data?.oldToAmount || 0))
|
|
58
53
|
.minus(1)
|
|
59
54
|
.mul(100)
|
|
60
55
|
.round(2, Big.roundUp)
|
|
61
|
-
.toString(), "%"] })
|
|
56
|
+
.toString(), "%"] })] }), _jsxs(Box, { display: "flex", mt: 3, children: [_jsx(Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
62
57
|
};
|
|
63
58
|
export const getTokenValueLossThreshold = (route) => {
|
|
64
59
|
if (!route) {
|
|
65
60
|
return false;
|
|
66
61
|
}
|
|
67
|
-
const fromAmountUSD = Big(
|
|
68
|
-
const toAmountUSD = Big(
|
|
69
|
-
const gasCostUSD = Big(
|
|
62
|
+
const fromAmountUSD = Big(route?.fromAmountUSD || 0);
|
|
63
|
+
const toAmountUSD = Big(route?.toAmountUSD || 0);
|
|
64
|
+
const gasCostUSD = Big(route?.gasCostUSD || 0);
|
|
70
65
|
if (fromAmountUSD.eq(0) && toAmountUSD.eq(0)) {
|
|
71
66
|
return false;
|
|
72
67
|
}
|
|
@@ -3,5 +3,5 @@ import { SwapButton } from '../../components/SwapButton';
|
|
|
3
3
|
import { useGasSufficiency } from '../../hooks';
|
|
4
4
|
export const StartSwapButton = ({ onClick, currentRoute, text, }) => {
|
|
5
5
|
const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
|
|
6
|
-
return (_jsx(SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!
|
|
6
|
+
return (_jsx(SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!insufficientGas?.length, loading: isGasSufficiencyLoading }));
|
|
7
7
|
};
|
|
@@ -13,13 +13,17 @@ import { RouteExecutionStatus } from '../../stores';
|
|
|
13
13
|
import { formatTokenAmount, hasEnumFlag, navigationRoutes, shortenWalletAddress, } from '../../utils';
|
|
14
14
|
import { IconCircle, IconContainer } from './StatusBottomSheet.style';
|
|
15
15
|
export const StatusBottomSheet = ({ status, route, }) => {
|
|
16
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
17
16
|
const { t } = useTranslation();
|
|
18
17
|
const { navigateBack, navigate } = useNavigateBack();
|
|
19
18
|
const ref = useRef(null);
|
|
20
19
|
const { getChainById } = useChains();
|
|
21
20
|
const { setValue } = useFormContext();
|
|
22
|
-
const toToken =
|
|
21
|
+
const toToken = {
|
|
22
|
+
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
23
|
+
amount: route.steps.at(-1)?.execution?.toAmount ??
|
|
24
|
+
route.steps.at(-1)?.estimate.toAmount ??
|
|
25
|
+
route.toAmount,
|
|
26
|
+
};
|
|
23
27
|
const { token, refetch, refetchNewBalance, refetchAllBalances } = useTokenBalance(toToken, route.toAddress);
|
|
24
28
|
const clearFromAmount = () => {
|
|
25
29
|
refetchAllBalances();
|
|
@@ -46,9 +50,8 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
46
50
|
navigateBack();
|
|
47
51
|
};
|
|
48
52
|
const handleClose = () => {
|
|
49
|
-
var _a;
|
|
50
53
|
clearFromAmount();
|
|
51
|
-
|
|
54
|
+
ref.current?.close();
|
|
52
55
|
};
|
|
53
56
|
const handleSeeDetails = () => {
|
|
54
57
|
handleClose();
|
|
@@ -68,7 +71,7 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
68
71
|
primaryMessage = t('swap.success.message.swapSuccessful', {
|
|
69
72
|
amount: token.amount,
|
|
70
73
|
tokenSymbol: token.symbol,
|
|
71
|
-
chainName:
|
|
74
|
+
chainName: getChainById(token.chainId)?.name,
|
|
72
75
|
walletAddress: shortenWalletAddress(route.toAddress),
|
|
73
76
|
});
|
|
74
77
|
}
|
|
@@ -78,14 +81,14 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
78
81
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Partial: {
|
|
79
82
|
title = t('swap.success.title.swapPartiallySuccessful');
|
|
80
83
|
primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
|
|
81
|
-
tool:
|
|
82
|
-
tokenSymbol:
|
|
84
|
+
tool: route.steps.at(-1)?.toolDetails.name,
|
|
85
|
+
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
83
86
|
});
|
|
84
87
|
if (token) {
|
|
85
88
|
secondaryMessage = t('swap.success.message.swapSuccessful', {
|
|
86
89
|
amount: token.amount,
|
|
87
90
|
tokenSymbol: token.symbol,
|
|
88
|
-
chainName:
|
|
91
|
+
chainName: getChainById(token.chainId)?.name,
|
|
89
92
|
walletAddress: shortenWalletAddress(route.toAddress),
|
|
90
93
|
});
|
|
91
94
|
}
|
|
@@ -95,22 +98,22 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
95
98
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Refunded: {
|
|
96
99
|
title = t('swap.success.title.refundIssued');
|
|
97
100
|
primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
|
|
98
|
-
tool:
|
|
99
|
-
tokenSymbol:
|
|
101
|
+
tool: route.steps.at(-1)?.toolDetails.name,
|
|
102
|
+
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
100
103
|
});
|
|
101
104
|
if (token) {
|
|
102
105
|
secondaryMessage = t('swap.success.message.swapSuccessful', {
|
|
103
106
|
amount: token.amount,
|
|
104
107
|
tokenSymbol: token.symbol,
|
|
105
|
-
chainName:
|
|
108
|
+
chainName: getChainById(token.chainId)?.name,
|
|
106
109
|
walletAddress: shortenWalletAddress(route.toAddress),
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
112
|
break;
|
|
110
113
|
}
|
|
111
114
|
case RouteExecutionStatus.Failed: {
|
|
112
|
-
const step = route.steps.find((step) =>
|
|
113
|
-
const process =
|
|
115
|
+
const step = route.steps.find((step) => step.execution?.status === 'FAILED');
|
|
116
|
+
const process = step?.execution?.process.find((process) => process.status === 'FAILED');
|
|
114
117
|
if (!step || !process) {
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
@@ -124,21 +127,20 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
124
127
|
break;
|
|
125
128
|
}
|
|
126
129
|
useEffect(() => {
|
|
127
|
-
var _a, _b;
|
|
128
130
|
const hasSuccessFlag = hasEnumFlag(status, RouteExecutionStatus.Done);
|
|
129
131
|
if ((hasSuccessFlag || hasEnumFlag(status, RouteExecutionStatus.Failed)) &&
|
|
130
|
-
!
|
|
132
|
+
!ref.current?.isOpen()) {
|
|
131
133
|
if (hasSuccessFlag) {
|
|
132
134
|
refetchNewBalance();
|
|
133
135
|
refetch();
|
|
134
136
|
}
|
|
135
|
-
|
|
137
|
+
ref.current?.open();
|
|
136
138
|
}
|
|
137
139
|
}, [refetch, refetchNewBalance, status]);
|
|
138
|
-
return (_jsx(BottomSheet,
|
|
139
|
-
hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorIcon, { color: "error" })) : null] })
|
|
140
|
+
return (_jsx(BottomSheet, { ref: ref, children: _jsxs(Box, { p: 3, children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, { status: status, mb: 1, children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
|
|
141
|
+
hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorIcon, { color: "error" })) : null] }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null] }), _jsx(Typography, { py: 1, children: primaryMessage }), secondaryMessage ? (_jsx(Typography, { py: 1, children: secondaryMessage })) : null, _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
|
|
140
142
|
? t('button.done')
|
|
141
143
|
: null, status === RouteExecutionStatus.Failed
|
|
142
144
|
? t('button.seeDetails')
|
|
143
|
-
: null] })
|
|
145
|
+
: null] }) }), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Box, { mt: 2, children: _jsx(Button, { variant: "text", onClick: handleSeeDetails, fullWidth: true, children: t('button.seeDetails') }) })) : null] }) }));
|
|
144
146
|
};
|
|
@@ -7,7 +7,7 @@ export declare const IconContainer: import("@emotion/styled").StyledComponent<im
|
|
|
7
7
|
component?: import("react").ElementType<any> | undefined;
|
|
8
8
|
ref?: import("react").Ref<unknown> | undefined;
|
|
9
9
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
10
|
-
} & Omit<
|
|
10
|
+
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
11
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
12
12
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
13
13
|
export declare const IconCircle: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
@@ -15,7 +15,7 @@ export declare const IconCircle: import("@emotion/styled").StyledComponent<impor
|
|
|
15
15
|
component?: import("react").ElementType<any> | undefined;
|
|
16
16
|
ref?: import("react").Ref<unknown> | undefined;
|
|
17
17
|
sx?: import("@mui/material").SxProps<Theme> | undefined;
|
|
18
|
-
} & Omit<
|
|
18
|
+
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
19
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
20
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
21
21
|
status: StatusColor;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
2
|
import { Delete as DeleteIcon } from '@mui/icons-material';
|
|
12
3
|
import { Box, Button, Tooltip } from '@mui/material';
|
|
@@ -25,7 +16,6 @@ import { StatusBottomSheet } from './StatusBottomSheet';
|
|
|
25
16
|
import { Container } from './SwapPage.style';
|
|
26
17
|
import { getTokenValueLossThreshold, TokenValueBottomSheet, } from './TokenValueBottomSheet';
|
|
27
18
|
export const SwapPage = () => {
|
|
28
|
-
var _a;
|
|
29
19
|
const { t } = useTranslation();
|
|
30
20
|
const { variant } = useWidgetConfig();
|
|
31
21
|
const { state } = useLocation();
|
|
@@ -34,23 +24,21 @@ export const SwapPage = () => {
|
|
|
34
24
|
const exchangeRateBottomSheetRef = useRef(null);
|
|
35
25
|
const { setValue } = useFormContext();
|
|
36
26
|
const { route, status, executeRoute, restartRoute, deleteRoute } = useRouteExecution({
|
|
37
|
-
routeId: state
|
|
38
|
-
onAcceptExchangeRateUpdate:
|
|
27
|
+
routeId: state?.routeId,
|
|
28
|
+
onAcceptExchangeRateUpdate: exchangeRateBottomSheetRef.current?.open,
|
|
39
29
|
});
|
|
40
30
|
const handleExecuteRoute = useCallback(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(_b = tokenValueBottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
31
|
+
if (tokenValueBottomSheetRef.current?.isOpen()) {
|
|
32
|
+
tokenValueBottomSheetRef.current?.close();
|
|
44
33
|
}
|
|
45
34
|
executeRoute();
|
|
46
35
|
setValue(SwapFormKey.FromAmount, '');
|
|
47
36
|
}, [executeRoute, setValue]);
|
|
48
|
-
const handleSwapClick = () =>
|
|
49
|
-
var _b;
|
|
37
|
+
const handleSwapClick = async () => {
|
|
50
38
|
if (status === RouteExecutionStatus.Idle) {
|
|
51
39
|
const thresholdExceeded = getTokenValueLossThreshold(route);
|
|
52
40
|
if (thresholdExceeded) {
|
|
53
|
-
|
|
41
|
+
tokenValueBottomSheetRef.current?.open();
|
|
54
42
|
}
|
|
55
43
|
else {
|
|
56
44
|
handleExecuteRoute();
|
|
@@ -59,7 +47,7 @@ export const SwapPage = () => {
|
|
|
59
47
|
if (status === RouteExecutionStatus.Failed) {
|
|
60
48
|
restartRoute();
|
|
61
49
|
}
|
|
62
|
-
}
|
|
50
|
+
};
|
|
63
51
|
const handleRemoveRoute = () => {
|
|
64
52
|
navigateBack();
|
|
65
53
|
deleteRoute();
|
|
@@ -77,8 +65,8 @@ export const SwapPage = () => {
|
|
|
77
65
|
}
|
|
78
66
|
};
|
|
79
67
|
return (_jsxs(Container, { children: [getStepList(route), status === RouteExecutionStatus.Idle ||
|
|
80
|
-
status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box,
|
|
68
|
+
status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, { mt: 2, display: "flex", children: [_jsx(StartSwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
|
|
81
69
|
minWidth: 48,
|
|
82
70
|
marginLeft: 1,
|
|
83
|
-
}
|
|
71
|
+
}, children: _jsx(DeleteIcon, {}) }) })) : null] })] })) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null, route ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (_jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
|
|
84
72
|
};
|
|
@@ -6,6 +6,6 @@ export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
|
6
6
|
fixed?: boolean | undefined;
|
|
7
7
|
maxWidth?: false | import("@mui/material").Breakpoint | undefined;
|
|
8
8
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
11
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -9,30 +9,29 @@ import { useSetContentHeight } from '../../hooks';
|
|
|
9
9
|
import { IconCircle, IconContainer } from './StatusBottomSheet.style';
|
|
10
10
|
export const TokenValueBottomSheet = forwardRef(({ route, onContinue, onCancel }, ref) => {
|
|
11
11
|
const handleCancel = () => {
|
|
12
|
-
|
|
13
|
-
(
|
|
14
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
12
|
+
ref.current?.close();
|
|
13
|
+
onCancel?.();
|
|
15
14
|
};
|
|
16
|
-
return (_jsx(BottomSheet,
|
|
15
|
+
return (_jsx(BottomSheet, { ref: ref, onClose: onCancel, children: _jsx(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) }));
|
|
17
16
|
});
|
|
18
17
|
const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
19
18
|
const { t } = useTranslation();
|
|
20
19
|
const ref = useRef();
|
|
21
20
|
useSetContentHeight(ref);
|
|
22
|
-
return (_jsxs(Box,
|
|
21
|
+
return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.highValueLoss') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.highValueLoss') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.swapping') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.gasCost') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.receiving') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.valueLoss') }), _jsxs(Typography, { fontWeight: 600, children: [Big(route.toAmountUSD || 0)
|
|
23
22
|
.div(Big(route.fromAmountUSD || 0).plus(Big(route.gasCostUSD || 0)))
|
|
24
23
|
.minus(1)
|
|
25
24
|
.mul(100)
|
|
26
25
|
.round(2, Big.roundUp)
|
|
27
|
-
.toString(), "%"] })
|
|
26
|
+
.toString(), "%"] })] }), _jsxs(Box, { display: "flex", mt: 3, children: [_jsx(Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
28
27
|
};
|
|
29
28
|
export const getTokenValueLossThreshold = (route) => {
|
|
30
29
|
if (!route) {
|
|
31
30
|
return false;
|
|
32
31
|
}
|
|
33
|
-
const fromAmountUSD = Big(
|
|
34
|
-
const toAmountUSD = Big(
|
|
35
|
-
const gasCostUSD = Big(
|
|
32
|
+
const fromAmountUSD = Big(route?.fromAmountUSD || 0);
|
|
33
|
+
const toAmountUSD = Big(route?.toAmountUSD || 0);
|
|
34
|
+
const gasCostUSD = Big(route?.gasCostUSD || 0);
|
|
36
35
|
if (fromAmountUSD.eq(0) && toAmountUSD.eq(0)) {
|
|
37
36
|
return false;
|
|
38
37
|
}
|
|
@@ -18,7 +18,7 @@ export const SwapRoutesPage = () => {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
if (!
|
|
21
|
+
if (!swapRoutes?.length && !isLoading && !isFetching) {
|
|
22
22
|
navigateBack();
|
|
23
23
|
}
|
|
24
24
|
// redirect to the home page if no routes are found on page reload
|
|
@@ -29,6 +29,6 @@ export const SwapRoutesPage = () => {
|
|
|
29
29
|
.getState()
|
|
30
30
|
.setAction(_jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
|
|
31
31
|
}, [dataUpdatedAt, isFetching, refetch, refetchTime]);
|
|
32
|
-
const routeNotFound = !
|
|
33
|
-
return (_jsx(Stack,
|
|
32
|
+
const routeNotFound = !swapRoutes?.length && !isLoading && !isFetching;
|
|
33
|
+
return (_jsx(Stack, { direction: "column", spacing: 2, flex: 1, children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes?.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) }));
|
|
34
34
|
};
|
|
@@ -6,6 +6,6 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
|
|
|
6
6
|
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
7
|
divider?: import("react").ReactNode;
|
|
8
8
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
10
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
11
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -11,12 +11,11 @@ export const I18nProvider = ({ children, }) => {
|
|
|
11
11
|
const { languageResources, languages, disableI18n } = useWidgetConfig();
|
|
12
12
|
const { language } = useSettings(['language']);
|
|
13
13
|
const i18n = useMemo(() => {
|
|
14
|
-
var _a, _b;
|
|
15
14
|
let resources = Object.keys(supportedLanguages)
|
|
16
15
|
.filter((lng) => isItemAllowed(lng, languages))
|
|
17
16
|
.reduce((resources, lng) => {
|
|
18
17
|
resources[lng] = {
|
|
19
|
-
translation:
|
|
18
|
+
translation: languageResources?.[lng]
|
|
20
19
|
? deepMerge(supportedLanguages[lng], languageResources[lng])
|
|
21
20
|
: supportedLanguages[lng],
|
|
22
21
|
};
|
|
@@ -33,12 +32,12 @@ export const I18nProvider = ({ children, }) => {
|
|
|
33
32
|
}, resources);
|
|
34
33
|
}
|
|
35
34
|
let i18n = i18next.createInstance({
|
|
36
|
-
lng:
|
|
35
|
+
lng: languages?.default || language,
|
|
37
36
|
fallbackLng: resources.en
|
|
38
37
|
? 'en'
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
: languages?.default ||
|
|
39
|
+
languages?.allow?.[0] ||
|
|
40
|
+
Object.keys(resources)?.[0],
|
|
42
41
|
lowerCaseLng: true,
|
|
43
42
|
interpolation: {
|
|
44
43
|
escapeValue: false,
|
|
@@ -48,11 +47,11 @@ export const I18nProvider = ({ children, }) => {
|
|
|
48
47
|
caches: [],
|
|
49
48
|
},
|
|
50
49
|
});
|
|
51
|
-
if (!language && !
|
|
50
|
+
if (!language && !languages?.default && !disableI18n) {
|
|
52
51
|
i18n = i18n.use(LanguageDetector);
|
|
53
52
|
}
|
|
54
53
|
i18n.use(initReactI18next).init();
|
|
55
54
|
return i18n;
|
|
56
55
|
}, [disableI18n, language, languageResources, languages]);
|
|
57
|
-
return _jsx(I18nextProvider,
|
|
56
|
+
return _jsx(I18nextProvider, { i18n: i18n, children: children });
|
|
58
57
|
};
|
|
@@ -8,14 +8,25 @@ export const useLiFi = () => useContext(SDKContext);
|
|
|
8
8
|
export const SDKProvider = ({ children, }) => {
|
|
9
9
|
const { sdkConfig, fee, integrator, referrer, routePriority, slippage } = useWidgetConfig();
|
|
10
10
|
const value = useMemo(() => {
|
|
11
|
-
const config =
|
|
11
|
+
const config = {
|
|
12
|
+
...sdkConfig,
|
|
13
|
+
defaultRouteOptions: {
|
|
14
|
+
fee,
|
|
15
|
+
integrator: integrator ?? window.location.hostname,
|
|
16
|
+
referrer,
|
|
12
17
|
routePriority,
|
|
13
|
-
slippage
|
|
18
|
+
slippage,
|
|
19
|
+
...sdkConfig?.defaultRouteOptions,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
14
22
|
if (!lifi) {
|
|
15
|
-
lifi = new LIFI(
|
|
23
|
+
lifi = new LIFI({
|
|
24
|
+
disableVersionCheck: true,
|
|
25
|
+
...config,
|
|
26
|
+
});
|
|
16
27
|
}
|
|
17
28
|
lifi.setConfig(config);
|
|
18
29
|
return lifi;
|
|
19
30
|
}, [fee, integrator, referrer, routePriority, sdkConfig, slippage]);
|
|
20
|
-
return _jsx(SDKContext.Provider,
|
|
31
|
+
return _jsx(SDKContext.Provider, { value: value, children: children });
|
|
21
32
|
};
|
|
@@ -17,14 +17,20 @@ export const formDefaultValues = {
|
|
|
17
17
|
};
|
|
18
18
|
export const SwapFormProvider = ({ children, }) => {
|
|
19
19
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress, buildSwapUrl, } = useWidgetConfig();
|
|
20
|
-
const defaultValues = useMemo(() => (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const defaultValues = useMemo(() => ({
|
|
21
|
+
...formDefaultValues,
|
|
22
|
+
fromChain,
|
|
23
|
+
fromToken,
|
|
24
|
+
fromAmount: (typeof fromAmount === 'number'
|
|
25
|
+
? fromAmount?.toPrecision()
|
|
26
|
+
: fromAmount) || formDefaultValues.fromAmount,
|
|
27
|
+
toChain,
|
|
28
|
+
toToken,
|
|
29
|
+
toAddress: toAddress || formDefaultValues.toAddress,
|
|
30
|
+
}), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
|
|
25
31
|
const methods = useForm({
|
|
26
32
|
// values,
|
|
27
33
|
defaultValues,
|
|
28
34
|
});
|
|
29
|
-
return (_jsxs(FormProvider,
|
|
35
|
+
return (_jsxs(FormProvider, { ...methods, children: [_jsx(FormUpdater, { defaultValues: defaultValues }), buildSwapUrl ? _jsx(URLSearchParamsBuilder, {}) : null, children] }));
|
|
30
36
|
};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import { useEffect } from 'react';
|
|
13
2
|
import { useFormState, useWatch } from 'react-hook-form';
|
|
14
3
|
import { useLocation } from 'react-router-dom';
|
|
@@ -23,7 +12,9 @@ const formValueKeys = [
|
|
|
23
12
|
];
|
|
24
13
|
export const URLSearchParamsBuilder = () => {
|
|
25
14
|
const { pathname } = useLocation();
|
|
26
|
-
const
|
|
15
|
+
const {
|
|
16
|
+
// Have to use touchedFields, because default values are not considered dirty
|
|
17
|
+
touchedFields: { ...touchedFields }, } = useFormState();
|
|
27
18
|
const values = useWatch({ name: formValueKeys });
|
|
28
19
|
useEffect(() => {
|
|
29
20
|
const url = new URL(window.location);
|
|
@@ -2,6 +2,6 @@ import { useWidgetConfig } from '..';
|
|
|
2
2
|
import { useTelemetry } from '../../hooks';
|
|
3
3
|
export const TelemetryProvider = ({ children }) => {
|
|
4
4
|
const config = useWidgetConfig();
|
|
5
|
-
useTelemetry(config
|
|
5
|
+
useTelemetry(config?.disableTelemetry);
|
|
6
6
|
return children;
|
|
7
7
|
};
|