@rabbitio/ui-kit 1.0.0-beta.9 → 1.0.0-beta.91
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/.gitlab-ci.yml +29 -0
- package/.husky/commit-msg +19 -0
- package/.husky/pre-push +1 -0
- package/CHANGELOG.md +0 -0
- package/README.md +27 -18
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +16765 -0
- package/coverage/coverage-final.json +116 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1001 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rabbit-ui-kit/index.html +116 -0
- package/coverage/rabbit-ui-kit/index.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +148 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js.html +169 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/common-apis/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +829 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +191 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/rabbitTicker.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +376 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/exolixSwapProvider.js.html +1825 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1618 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1819 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1861 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +514 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +529 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +166 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +331 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +1555 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1429 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +307 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +496 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4207 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/molecules/AmountInput.stories.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +322 -0
- package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +235 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/global.css +197 -0
- package/dist/global.css.map +1 -0
- package/dist/index.cjs +12451 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2339 -8491
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +9597 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +12357 -27
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +12442 -29
- package/dist/index.umd.js.map +1 -1
- package/package.json +35 -9
- package/raw +1000 -0
- package/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js +21 -0
- package/src/common-apis/adapters/analyticsAdapters/metrikaAdapter.js +28 -0
- package/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js +38 -0
- package/src/common-apis/adapters/axiosAdapter.js +35 -0
- package/src/common-apis/adapters/qrUtils.js +18 -0
- package/src/common-apis/external-apis/apiGroups.js +55 -0
- package/src/common-apis/external-apis/emailAPI.js +16 -0
- package/src/common-apis/external-apis/ipAddressProviders.js +89 -0
- package/src/common-apis/globalConstants.jsx +3 -0
- package/src/common-apis/models/blockchain.js +10 -0
- package/src/common-apis/models/coin.js +248 -0
- package/src/common-apis/models/protocol.js +5 -0
- package/src/{common → common-apis/services}/fiatCurrenciesService.js +4 -12
- package/src/common-apis/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +12 -0
- package/src/common-apis/tests/units/utils/amountUtils/composeRateText.test.js +152 -0
- package/src/{common → common-apis/utils}/amountUtils.js +72 -136
- package/src/common-apis/utils/cache.js +242 -0
- package/src/{common → common-apis/utils}/errorUtils.js +15 -0
- package/src/common-apis/utils/logging/logger.js +41 -0
- package/src/common-apis/utils/logging/logsStorage.js +61 -0
- package/src/common-apis/utils/postponeExecution.js +11 -0
- package/src/common-apis/utils/rabbitTicker.js +24 -0
- package/src/common-apis/utils/safeStringify.js +50 -0
- package/src/index.js +96 -9
- package/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js +495 -0
- package/src/robust-api-caller/cachedRobustExternalApiCallerService.js +147 -0
- package/src/robust-api-caller/cancelProcessing.js +29 -0
- package/src/robust-api-caller/concurrentCalculationsMetadataHolder.js +75 -0
- package/src/robust-api-caller/externalApiProvider.js +156 -0
- package/src/robust-api-caller/externalServicesStatsCollector.js +78 -0
- package/src/robust-api-caller/robustExternalAPICallerService.js +304 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +533 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +532 -0
- package/src/robust-api-caller/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +19 -0
- package/src/swaps-lib/external-apis/exolixSwapProvider.js +580 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +511 -0
- package/src/swaps-lib/external-apis/swapProvider.js +578 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +592 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +78 -0
- package/src/swaps-lib/models/existingSwap.js +143 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +148 -0
- package/src/swaps-lib/models/partner.js +27 -0
- package/src/swaps-lib/models/swapProviderCoinInfo.js +82 -0
- package/src/swaps-lib/services/publicSwapService.js +490 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +34 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/createSwap.test.js +1043 -0
- package/src/swaps-lib/test/external-apis/exolixSwapProvider/getSwapInfo.test.js +611 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getAllSupportedCurrencies.test.js +63 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getDepositCurrencies.test.js +73 -0
- package/src/swaps-lib/test/external-apis/swapProvider/getWithdrawalCurrencies.test.js +102 -0
- package/src/swaps-lib/test/external-apis/swapProvider/removeProtocolNameFromCoinName.test.js +152 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +536 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1214 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1707 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +80 -0
- package/src/swaps-lib/utils/swapUtils.js +195 -0
- package/{styles → src/ui-kit/assets/styles}/_functions.scss +5 -0
- package/{styles → src/ui-kit/assets/styles}/_mixins.scss +2 -2
- package/{styles → src/ui-kit/assets/styles}/_placeholder.scss +3 -3
- package/{styles → src/ui-kit/assets/styles}/_variables.scss +17 -15
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/src/ui-kit/assets/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/src/ui-kit/assets/styles/global.scss +171 -0
- package/src/ui-kit/assets/styles/index.scss +10 -0
- package/src/ui-kit/assets/wrappedImages/arrowIcon.jsx +13 -0
- package/src/ui-kit/assets/wrappedImages/arrowTosca.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/arrowWhite.jsx +14 -0
- package/src/ui-kit/assets/wrappedImages/darkRectangle.jsx +7 -0
- package/src/ui-kit/assets/wrappedImages/determinedError.jsx +118 -0
- package/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx +39 -0
- package/src/ui-kit/assets/wrappedImages/infoIcon.jsx +16 -0
- package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
- package/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx +54 -0
- package/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx +26 -0
- package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
- package/src/ui-kit/assets/wrappedImages/walletIcon.jsx +22 -0
- package/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx +57 -0
- package/src/{components → ui-kit/components}/atoms/AssetIcon/asset-icon.module.scss +1 -1
- package/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx +68 -0
- package/src/ui-kit/components/atoms/AssetSelection/asset-selection.module.scss +56 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx +34 -0
- package/src/ui-kit/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx +51 -0
- package/src/ui-kit/components/atoms/InformationMessage/information-message.module.scss +38 -0
- package/src/ui-kit/components/atoms/Input/Input.jsx +183 -0
- package/src/ui-kit/components/atoms/Input/input.module.scss +107 -0
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.jsx +8 -28
- package/src/{components → ui-kit/components}/atoms/LoadingDots/LoadingDots.module.scss +3 -2
- package/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx +64 -0
- package/src/ui-kit/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/ui-kit/components/atoms/QrCode/QrCode.jsx +44 -0
- package/src/ui-kit/components/atoms/QrCode/qr-code.module.scss +15 -0
- package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +30 -0
- package/src/ui-kit/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/{components → ui-kit/components}/atoms/SupportChat/SupportChat.jsx +5 -1
- package/src/ui-kit/components/atoms/Textarea/Textarea.jsx +148 -0
- package/src/ui-kit/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx +141 -0
- package/src/ui-kit/components/atoms/TitleBox/title-box.module.scss +32 -0
- package/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx +77 -0
- package/src/ui-kit/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx +76 -0
- package/src/ui-kit/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/ui-kit/components/atoms/Validation/Validation.jsx +39 -0
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +19 -0
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.jsx +24 -50
- package/src/{components → ui-kit/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/ui-kit/components/atoms/buttons/Close/Close.jsx +58 -0
- package/src/ui-kit/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx +112 -0
- package/src/ui-kit/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +110 -0
- package/src/ui-kit/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +448 -0
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +233 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +463 -0
- package/src/ui-kit/components/molecules/CoinPicker/coin-picker.module.scss +207 -0
- package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +42 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx +35 -0
- package/src/ui-kit/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +74 -0
- package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +106 -0
- package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +137 -0
- package/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +32 -0
- package/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/ui-kit/components/organisms/Dialog/Dialog.jsx +494 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +132 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +554 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/dialog-step.module.scss +381 -0
- package/src/ui-kit/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +1374 -0
- package/src/ui-kit/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
- package/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/ui-kit/hooks/useCallHandlingErrors.js +22 -0
- package/src/ui-kit/hooks/useIsHydrated.js +12 -0
- package/src/ui-kit/hooks/useReferredState.js +24 -0
- package/src/ui-kit/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +146 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +65 -0
- package/src/ui-kit/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +104 -0
- package/src/ui-kit/utils/inputValueProviders.js +50 -0
- package/src/ui-kit/utils/textUtils.js +18 -0
- package/src/ui-kit/utils/uiUtils.js +12 -0
- package/src/ui-kit/utils/urlQueryUtils.js +62 -0
- package/stories/font.scss +40 -0
- package/stories/stubs/coins.jsx +2266 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +0 -55
- package/styles/_global-classes.scss +0 -433
- package/styles/fonts/NunitoSans-Bold.ttf +0 -0
- package/styles/fonts/NunitoSans-ExtraBold.ttf +0 -0
- package/styles/fonts/NunitoSans-Light.ttf +0 -0
- package/styles/fonts/NunitoSans-Regular.ttf +0 -0
- package/styles/fonts/NunitoSans-SemiBold.ttf +0 -0
- package/styles/global-styles-index.scss +0 -74
- package/styles/index.scss +0 -33
- /package/{styles → src/ui-kit/assets/styles}/colors/_light-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/colors/_solid-colors.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_margin-size.scss +0 -0
- /package/{styles → src/ui-kit/assets/styles}/size/_padding-size.scss +0 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./coin-picker.module.scss";
|
|
5
|
+
import ArrowIcon from "../../../assets/wrappedImages/arrowIcon.jsx";
|
|
6
|
+
|
|
7
|
+
import { useReferredState } from "../../../hooks/useReferredState.js";
|
|
8
|
+
import { useCallHandlingErrors } from "../../../hooks/useCallHandlingErrors.js";
|
|
9
|
+
import { logErrorOrOutputToConsole } from "../../../../common-apis/utils/errorUtils.js";
|
|
10
|
+
|
|
11
|
+
import { RadioButtonWithText } from "../../atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
|
|
12
|
+
import { Input } from "../../atoms/Input/Input.jsx";
|
|
13
|
+
import { InformationMessage } from "../../atoms/InformationMessage/InformationMessage.jsx";
|
|
14
|
+
import { FALLBACK_ASSET_ICON_URL } from "../../../../common-apis/globalConstants.jsx";
|
|
15
|
+
import { AssetIcon } from "../../atoms/AssetIcon/AssetIcon.jsx";
|
|
16
|
+
import { Button } from "../../atoms/buttons/Button/Button.jsx";
|
|
17
|
+
import { LoadingDots } from "../../atoms/LoadingDots/LoadingDots.jsx";
|
|
18
|
+
import { SearchableCoinsList } from "../SearchableCoinsList/SearchableCoinsList.jsx";
|
|
19
|
+
|
|
20
|
+
export const COIN_PICKER_MODES = {
|
|
21
|
+
BUTTON: "BUTTON",
|
|
22
|
+
CHECKBOX: "CHECKBOX",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const defaultTexts = {
|
|
26
|
+
searchPlaceholder: "Search..",
|
|
27
|
+
noAssetsMessage: "No matching assets found",
|
|
28
|
+
loadMoreButton: "Load more",
|
|
29
|
+
assetSuggestionMessage: {
|
|
30
|
+
part1: "Need more?",
|
|
31
|
+
part2: "Let us know",
|
|
32
|
+
part3: "which coin to add next.",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Component that can be used either for one-time selection of an asset, or
|
|
38
|
+
* for a multi-selection in a CHECKBOX format.
|
|
39
|
+
* CoinPicker can show all assets with a subtitle.
|
|
40
|
+
*
|
|
41
|
+
* Usage rules:
|
|
42
|
+
* 1. for CHECKBOX mode
|
|
43
|
+
* - you MUST pass allCoins, initiallyEnabledCoinsList and setCoinPickerValue
|
|
44
|
+
* 2. for BUTTON mode
|
|
45
|
+
* - you MUST NOT pass setCoinPickerValue (it will be ignored)
|
|
46
|
+
* - if you don't pass loadCoinsAndContent function, you MUST pass allCoins
|
|
47
|
+
*
|
|
48
|
+
* @component
|
|
49
|
+
* @param {Object} props - The props object.
|
|
50
|
+
* @param {string} [props.mode] - One-time button selection or multi-selection via toggles, available options are located in COIN_PICKER_MODES.
|
|
51
|
+
* @param {Coin[]} [props.allCoins] - All coins despite their enabled/disabled status. Pass this list if you use CHECKBOX mode or you don't pass the loadCoinsAndContent function.
|
|
52
|
+
* @param {Coin[]} [props.initiallyEnabledCoinsList] - Pass this when using CHECKBOX mode.
|
|
53
|
+
* @param {function} [props.handleClick] - Handler function for the event when an asset is clicked.
|
|
54
|
+
* @param {number|undefined} [props.triggerToReloadData] - Trigger to reload the component when some related data changes.
|
|
55
|
+
* @param {boolean} [props.search=false] - Whether to show the search bar above the assets list, when enabled overrides searchAdaptive and locks the list height.
|
|
56
|
+
* @param {boolean} [props.searchAdaptive=true] - Show search bar only after six assets in the list.
|
|
57
|
+
* @param {function} [props.setCoinPickerValue] - Called with the only parameter (final enabled tickers list) when closing/confirming dialog in CHECKBOX mode.
|
|
58
|
+
* @param {function} [props.setCoinPickerListChanged] - Called with the only parameter (flag signaling that the list of enabled coins was changed - true, or was not changed - false) when closing/confirming dialog in CHECKBOX mode.
|
|
59
|
+
* @param {function} [props.loadCoinsAndContent] - Optional, you can provide it if you need custom logic for coins list composing or custom subtitles. Expected return format:
|
|
60
|
+
* {
|
|
61
|
+
* coins: Coin[],
|
|
62
|
+
* content: { coin: Coin, subtitle: string }[],
|
|
63
|
+
* isCoinsDataReloadable: boolean
|
|
64
|
+
* }
|
|
65
|
+
* @param {boolean} [props.showRequestMissingCoinsInfoMessage=true] - Whether to show message about advising missing coins.
|
|
66
|
+
* @param {string} [props.supportUrl] - Needed when showRequestMissingCoinsInfoMessage=true.
|
|
67
|
+
* @param {function} props.coinToIconPaths - Function to map coins to their icon paths.
|
|
68
|
+
* @param {boolean} [props.partialLoadingEnabled=true] - Enables only partialLoadingIncrement items to be shown by default, with the user able to show more by clicking the load-more button.
|
|
69
|
+
* @param {number} [props.partialLoadingIncrement=100] - The number of items to incrementally load when partial loading is enabled.
|
|
70
|
+
* @param {object} [props.texts] - Texts translated to the desired locale; default texts use English locale.
|
|
71
|
+
*/
|
|
72
|
+
export const CoinPicker = ({
|
|
73
|
+
mode = COIN_PICKER_MODES.BUTTON,
|
|
74
|
+
allCoins,
|
|
75
|
+
initiallyEnabledCoinsList,
|
|
76
|
+
handleClick = ticker => {},
|
|
77
|
+
triggerToReloadData,
|
|
78
|
+
search = false,
|
|
79
|
+
searchAdaptive = true,
|
|
80
|
+
setCoinPickerValue = () => {},
|
|
81
|
+
setCoinPickerListChanged = () => {},
|
|
82
|
+
loadCoinsAndContent = null,
|
|
83
|
+
showRequestMissingCoinsInfoMessage = true,
|
|
84
|
+
supportUrl = null,
|
|
85
|
+
coinToIconPaths = coin => ({
|
|
86
|
+
assetIconSrc: undefined,
|
|
87
|
+
assetIconProtocolSrc: undefined,
|
|
88
|
+
}),
|
|
89
|
+
partialLoadingEnabled = true,
|
|
90
|
+
partialLoadingIncrement = 100,
|
|
91
|
+
texts = defaultTexts,
|
|
92
|
+
}) => {
|
|
93
|
+
const handleError = useCallHandlingErrors();
|
|
94
|
+
|
|
95
|
+
const [coins, setCoins] = useState(null);
|
|
96
|
+
const [initiallyEnabledCoins, setInitiallyEnabledCoins] = useReferredState({});
|
|
97
|
+
const [currentlyEnabledCoins, setCurrentlyEnabledCoins] = useReferredState({});
|
|
98
|
+
const [searchFieldValue, setSearchFieldValue] = useState("");
|
|
99
|
+
const [scrollWrapperClass, setScrollWrapperClass] = useState("");
|
|
100
|
+
|
|
101
|
+
const [searchEnabled, setSearchEnabled] = useState(false);
|
|
102
|
+
const [coinsContent, setCoinsContent] = useState(null);
|
|
103
|
+
const [isCoinsDataReloadable, setIsCoinsDataReloadable] = useState(false);
|
|
104
|
+
|
|
105
|
+
const [isListFull, setIsListFull] = useState(true);
|
|
106
|
+
const [isSearchResultEmpty, setIsSearchResultEmpty] = useState(false);
|
|
107
|
+
const [triggerLoadMoreCoins, setTriggerLoadMoreCoins] = useState(0);
|
|
108
|
+
|
|
109
|
+
const searchRef = useRef();
|
|
110
|
+
const scrollContainerRef = useRef();
|
|
111
|
+
const skeletonItemsCount =
|
|
112
|
+
initiallyEnabledCoinsList?.length || (partialLoadingEnabled ? partialLoadingIncrement : 6);
|
|
113
|
+
|
|
114
|
+
const defaultLoadCoinsAndContent = async () => {
|
|
115
|
+
const allCoinsSorted = sortCoinsArrayByAlphabet(allCoins, composeEnabledCoinsObject(allCoins));
|
|
116
|
+
return {
|
|
117
|
+
coins: allCoinsSorted,
|
|
118
|
+
content: allCoinsSorted.map(c => ({
|
|
119
|
+
coin: c,
|
|
120
|
+
subtitle: c.blockchain?.name,
|
|
121
|
+
})),
|
|
122
|
+
isCoinsDataReloadable: false,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const sortCoinsArrayByAlphabet = (coinsToSort, enabledCoinsObject) => {
|
|
127
|
+
return [
|
|
128
|
+
...coinsToSort
|
|
129
|
+
.filter(coin => enabledCoinsObject[coin.ticker])
|
|
130
|
+
.sort((a, b) => a.latinName.toUpperCase() > b.latinName.toUpperCase()),
|
|
131
|
+
...coinsToSort
|
|
132
|
+
.filter(coin => !enabledCoinsObject[coin.ticker])
|
|
133
|
+
.sort((a, b) => a.latinName.toUpperCase() > b.latinName.toUpperCase()),
|
|
134
|
+
];
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const composeEnabledCoinsObject = coins => {
|
|
138
|
+
if (mode === COIN_PICKER_MODES.CHECKBOX) {
|
|
139
|
+
return coins.reduce((prev, coin) => {
|
|
140
|
+
return {
|
|
141
|
+
...prev,
|
|
142
|
+
[coin.ticker]: !!initiallyEnabledCoinsList.find(enabledCoin => enabledCoin.ticker === coin.ticker),
|
|
143
|
+
};
|
|
144
|
+
}, {});
|
|
145
|
+
}
|
|
146
|
+
return {};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const handleToggleClick = (ticker, resetButtonLoader = () => {}) => {
|
|
150
|
+
resetButtonLoader && resetButtonLoader();
|
|
151
|
+
setCurrentlyEnabledCoins(prev => {
|
|
152
|
+
return { ...prev, [ticker]: !prev[ticker] };
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const handleCoinClick = coin => {
|
|
157
|
+
if (mode === COIN_PICKER_MODES.CHECKBOX) handleToggleClick(coin.ticker);
|
|
158
|
+
handleClick(coin.ticker);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const loadCoinsAndSaveToState = () => {
|
|
162
|
+
(async () => {
|
|
163
|
+
try {
|
|
164
|
+
const data = loadCoinsAndContent ? await loadCoinsAndContent() : await defaultLoadCoinsAndContent();
|
|
165
|
+
setCoins(data.coins);
|
|
166
|
+
setCoinsContent(data.content);
|
|
167
|
+
setIsCoinsDataReloadable(!!data.isCoinsDataReloadable);
|
|
168
|
+
} catch (e) {
|
|
169
|
+
logErrorOrOutputToConsole(e);
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Initializes enabled coins logic if the mode is CHECKBOX
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (mode === COIN_PICKER_MODES.CHECKBOX) {
|
|
177
|
+
const enabledCoinsObject = composeEnabledCoinsObject(allCoins);
|
|
178
|
+
setInitiallyEnabledCoins(enabledCoinsObject);
|
|
179
|
+
setCurrentlyEnabledCoins(enabledCoinsObject);
|
|
180
|
+
}
|
|
181
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
|
+
}, [mode]);
|
|
183
|
+
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
loadCoinsAndSaveToState();
|
|
186
|
+
if (isCoinsDataReloadable) {
|
|
187
|
+
const intervalId = setInterval(loadCoinsAndSaveToState, 60000);
|
|
188
|
+
return () => clearInterval(intervalId);
|
|
189
|
+
}
|
|
190
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
+
}, [triggerToReloadData]);
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
const enabled = currentlyEnabledCoins.current;
|
|
195
|
+
if (enabled) {
|
|
196
|
+
const enabledCoinsTickers = Object.keys(enabled).filter(ticker => enabled[ticker]);
|
|
197
|
+
setCoinPickerValue(enabledCoinsTickers);
|
|
198
|
+
setCoinPickerListChanged(
|
|
199
|
+
JSON.stringify(initiallyEnabledCoins.current) !== JSON.stringify(currentlyEnabledCoins.current)
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
203
|
+
}, [currentlyEnabledCoins.current]);
|
|
204
|
+
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
setSearchEnabled(
|
|
207
|
+
search ? true : searchAdaptive && initiallyEnabledCoinsList ? initiallyEnabledCoinsList.length > 6 : false
|
|
208
|
+
);
|
|
209
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
210
|
+
}, [search, searchAdaptive, coins]);
|
|
211
|
+
|
|
212
|
+
const skeleton = () => {
|
|
213
|
+
let skeletonItems = [];
|
|
214
|
+
for (let i = 0; i < skeletonItemsCount; i++) {
|
|
215
|
+
skeletonItems.push(
|
|
216
|
+
<div className={s["item"]} key={"coin-picker-skeleton-" + i}>
|
|
217
|
+
<div className={s["link"] + " " + s["loading"]}>
|
|
218
|
+
<div className={s["icon"] + " " + "skeleton-dark"}></div>
|
|
219
|
+
<div className={s["content"]}>
|
|
220
|
+
<div className={s["name"] + " " + "skeleton-dark"}></div>
|
|
221
|
+
<div className={s["amount"] + " " + "skeleton-dark"}></div>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
return skeletonItems;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const handleScroll = () => {
|
|
231
|
+
if (scrollWrapperClass !== "") setScrollWrapperClass("");
|
|
232
|
+
|
|
233
|
+
if (scrollContainerRef.current?.scrollTop === 0)
|
|
234
|
+
setScrollWrapperClass(
|
|
235
|
+
s["reached-top"] +
|
|
236
|
+
(scrollContainerRef.current?.scrollHeight - scrollContainerRef.current?.clientHeight === 0
|
|
237
|
+
? " " + s["reached-bottom"]
|
|
238
|
+
: "")
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
if (
|
|
242
|
+
scrollContainerRef.current?.scrollTop > 0 &&
|
|
243
|
+
scrollContainerRef.current?.scrollTop ===
|
|
244
|
+
scrollContainerRef.current?.scrollHeight - scrollContainerRef.current?.clientHeight
|
|
245
|
+
)
|
|
246
|
+
setScrollWrapperClass(s["reached-bottom"]);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const displayMoreCoins = () => setTriggerLoadMoreCoins(prev => prev + 1);
|
|
250
|
+
|
|
251
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
252
|
+
useEffect(handleScroll, []);
|
|
253
|
+
|
|
254
|
+
const shouldShowSkeleton = coins == null;
|
|
255
|
+
|
|
256
|
+
return coins ? (
|
|
257
|
+
<>
|
|
258
|
+
<div className={s["coin-picker"] + (shouldShowSkeleton ? " " + s["loading"] : "")}>
|
|
259
|
+
{searchEnabled ? (
|
|
260
|
+
<div className={s["coin-picker-search"]}>
|
|
261
|
+
<Input
|
|
262
|
+
value={searchFieldValue}
|
|
263
|
+
onChange={e => {
|
|
264
|
+
setSearchFieldValue(e.target.value);
|
|
265
|
+
handleScroll();
|
|
266
|
+
}}
|
|
267
|
+
placeholder={texts.searchPlaceholder}
|
|
268
|
+
isSmallHeight={true}
|
|
269
|
+
clearButton
|
|
270
|
+
ref={searchRef}
|
|
271
|
+
disabled={shouldShowSkeleton}
|
|
272
|
+
/>
|
|
273
|
+
</div>
|
|
274
|
+
) : (
|
|
275
|
+
""
|
|
276
|
+
)}
|
|
277
|
+
<div
|
|
278
|
+
className={
|
|
279
|
+
s["coin-picker-wrapper"] +
|
|
280
|
+
" " +
|
|
281
|
+
scrollWrapperClass +
|
|
282
|
+
(searchEnabled ? " " + s["fixed-height"] : "")
|
|
283
|
+
}
|
|
284
|
+
>
|
|
285
|
+
<div
|
|
286
|
+
className={s["coin-picker-wrapper-content"] + (searchEnabled ? " " + s["fixed-height"] : "")}
|
|
287
|
+
ref={scrollContainerRef}
|
|
288
|
+
onScroll={handleScroll}
|
|
289
|
+
>
|
|
290
|
+
<div className={s["coin-picker-wrapper-content-assets"]}>
|
|
291
|
+
{shouldShowSkeleton ? (
|
|
292
|
+
skeleton()
|
|
293
|
+
) : (
|
|
294
|
+
<SearchableCoinsList
|
|
295
|
+
searchQuery={searchFieldValue}
|
|
296
|
+
onListUpdated={() => handleScroll()}
|
|
297
|
+
setIsListFull={setIsListFull}
|
|
298
|
+
setIsSearchResultEmpty={setIsSearchResultEmpty}
|
|
299
|
+
triggerLoadMoreCoins={triggerLoadMoreCoins}
|
|
300
|
+
coinsList={coins}
|
|
301
|
+
coinsBundle={coins?.map((coin, index) => {
|
|
302
|
+
return {
|
|
303
|
+
ticker: coin.ticker,
|
|
304
|
+
component: () => {
|
|
305
|
+
const { assetIconSrc, assetIconProtocolSrc } = coinToIconPaths(coin);
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<div
|
|
309
|
+
className={s["item"]}
|
|
310
|
+
key={`picker-${coin.ticker}-${index}`}
|
|
311
|
+
onClick={e => handleError(() => handleCoinClick(coin), e)}
|
|
312
|
+
>
|
|
313
|
+
<div
|
|
314
|
+
className={
|
|
315
|
+
s["link"] +
|
|
316
|
+
(currentlyEnabledCoins.current[coin.ticker] !==
|
|
317
|
+
initiallyEnabledCoins.current[coin.ticker]
|
|
318
|
+
? " " + s["outline"]
|
|
319
|
+
: "")
|
|
320
|
+
}
|
|
321
|
+
>
|
|
322
|
+
<AssetIcon
|
|
323
|
+
assetIconSrc={assetIconSrc}
|
|
324
|
+
assetIconProtocolSrc={assetIconProtocolSrc}
|
|
325
|
+
fallbackSrc={FALLBACK_ASSET_ICON_URL}
|
|
326
|
+
/>
|
|
327
|
+
<div className={s["content"]} key={coin.ticker}>
|
|
328
|
+
<p className={s["name"]}>{coin.latinName}</p>
|
|
329
|
+
<p className={s["amount"]}>
|
|
330
|
+
{coinsContent?.find(i => i.coin === coin)
|
|
331
|
+
?.subtitle ?? ""}
|
|
332
|
+
</p>
|
|
333
|
+
</div>
|
|
334
|
+
{mode === COIN_PICKER_MODES.BUTTON ? (
|
|
335
|
+
<div className={s["arrow"]}>
|
|
336
|
+
<ArrowIcon />
|
|
337
|
+
</div>
|
|
338
|
+
) : mode === COIN_PICKER_MODES.CHECKBOX ? (
|
|
339
|
+
<div className={s["toggle-container"]}>
|
|
340
|
+
<RadioButtonWithText
|
|
341
|
+
onStateChange={resetButtonLoader =>
|
|
342
|
+
handleToggleClick(
|
|
343
|
+
coin.ticker,
|
|
344
|
+
resetButtonLoader
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
isSwitchedOn={
|
|
348
|
+
currentlyEnabledCoins.current[coin.ticker]
|
|
349
|
+
}
|
|
350
|
+
id={index}
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
) : (
|
|
354
|
+
""
|
|
355
|
+
)}
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
);
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
})}
|
|
362
|
+
/>
|
|
363
|
+
)}
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
{isSearchResultEmpty ? (
|
|
367
|
+
<div className={s["coin-picker-wrapper-content-asset-not-found"]}>
|
|
368
|
+
<h6>{texts.noAssetsMessage}</h6>
|
|
369
|
+
</div>
|
|
370
|
+
) : (
|
|
371
|
+
""
|
|
372
|
+
)}
|
|
373
|
+
{partialLoadingEnabled && !isListFull ? (
|
|
374
|
+
<div className={s["coin-picker-wrapper-content-load-more-button"]}>
|
|
375
|
+
<Button
|
|
376
|
+
mode="primary-transparent"
|
|
377
|
+
size="sm"
|
|
378
|
+
loader={false}
|
|
379
|
+
content={texts.loadMoreButton}
|
|
380
|
+
onClick={() => displayMoreCoins()}
|
|
381
|
+
handleError={handleError}
|
|
382
|
+
/>
|
|
383
|
+
</div>
|
|
384
|
+
) : (
|
|
385
|
+
""
|
|
386
|
+
)}
|
|
387
|
+
{searchEnabled && showRequestMissingCoinsInfoMessage ? (
|
|
388
|
+
<div className={s["coin-picker-wrapper-content-bottom-message"]}>
|
|
389
|
+
<InformationMessage
|
|
390
|
+
text={
|
|
391
|
+
<>
|
|
392
|
+
{texts.assetSuggestionMessage.part1}
|
|
393
|
+
<a
|
|
394
|
+
target="_blank"
|
|
395
|
+
rel="noreferrer"
|
|
396
|
+
href={supportUrl}
|
|
397
|
+
className={s["coin-picker-wrapper-content-bottom-message-link"]}
|
|
398
|
+
>
|
|
399
|
+
{" " + texts.assetSuggestionMessage.part2 + " "}
|
|
400
|
+
</a>
|
|
401
|
+
{texts.assetSuggestionMessage.part3}
|
|
402
|
+
</>
|
|
403
|
+
}
|
|
404
|
+
/>
|
|
405
|
+
</div>
|
|
406
|
+
) : (
|
|
407
|
+
""
|
|
408
|
+
)}
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
</>
|
|
413
|
+
) : (
|
|
414
|
+
<LoadingDots />
|
|
415
|
+
);
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
CoinPicker.propTypes = {
|
|
419
|
+
mode: PropTypes.oneOf([COIN_PICKER_MODES.BUTTON, COIN_PICKER_MODES.CHECKBOX]),
|
|
420
|
+
allCoins: PropTypes.array,
|
|
421
|
+
initiallyEnabledCoinsList: PropTypes.array,
|
|
422
|
+
handleClick: PropTypes.func,
|
|
423
|
+
triggerToReloadData: PropTypes.number,
|
|
424
|
+
search: PropTypes.bool,
|
|
425
|
+
searchAdaptive: PropTypes.bool,
|
|
426
|
+
setCoinPickerValue: PropTypes.func,
|
|
427
|
+
setCoinPickerListChanged: PropTypes.func,
|
|
428
|
+
loadCoinsAndContent: PropTypes.func,
|
|
429
|
+
showRequestMissingCoinsInfoMessage: PropTypes.bool,
|
|
430
|
+
supportUrl: PropTypes.string,
|
|
431
|
+
coinToIconPaths: PropTypes.func,
|
|
432
|
+
partialLoadingEnabled: PropTypes.bool,
|
|
433
|
+
partialLoadingIncrement: PropTypes.number,
|
|
434
|
+
texts: PropTypes.shape({
|
|
435
|
+
searchPlaceholder: PropTypes.string,
|
|
436
|
+
noAssetsMessage: PropTypes.string,
|
|
437
|
+
loadMoreButton: PropTypes.string,
|
|
438
|
+
assetSuggestionMessage: PropTypes.shape({
|
|
439
|
+
part1: PropTypes.string,
|
|
440
|
+
part2: PropTypes.string,
|
|
441
|
+
part3: PropTypes.string,
|
|
442
|
+
}),
|
|
443
|
+
}),
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
CoinPicker.defaultProps = {
|
|
447
|
+
mode: COIN_PICKER_MODES.BUTTON,
|
|
448
|
+
handleClick: ticker => {},
|
|
449
|
+
search: false,
|
|
450
|
+
searchAdaptive: true,
|
|
451
|
+
setCoinPickerValue: () => {},
|
|
452
|
+
setCoinPickerListChanged: () => {},
|
|
453
|
+
loadCoinsAndContent: null,
|
|
454
|
+
showRequestMissingCoinsInfoMessage: true,
|
|
455
|
+
supportUrl: null,
|
|
456
|
+
coinToIconPaths: coin => ({
|
|
457
|
+
assetIconSrc: undefined,
|
|
458
|
+
assetIconProtocolSrc: undefined,
|
|
459
|
+
}),
|
|
460
|
+
partialLoadingEnabled: true,
|
|
461
|
+
partialLoadingIncrement: 100,
|
|
462
|
+
texts: defaultTexts,
|
|
463
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
@use "../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
.coin-picker {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: flex-start;
|
|
7
|
+
align-items: center;
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
@media (max-width: $phone-width) {
|
|
11
|
+
max-width: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-search {
|
|
15
|
+
width: 100%;
|
|
16
|
+
margin-bottom: Margin("2");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-wrapper {
|
|
20
|
+
width: 100%;
|
|
21
|
+
position: relative;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
|
|
25
|
+
&.fixed-height {
|
|
26
|
+
@media (min-width: $tablet-width) {
|
|
27
|
+
height: 370px;
|
|
28
|
+
|
|
29
|
+
&::after,
|
|
30
|
+
&::before {
|
|
31
|
+
content: "";
|
|
32
|
+
position: absolute;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 20px;
|
|
35
|
+
background: linear-gradient(rgba(SolidColor("dark"), 0.05), rgba(255, 255, 255, 0));
|
|
36
|
+
left: 0;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
transition: 0.2s opacity ease;
|
|
39
|
+
pointer-events: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.reached-top::after,
|
|
43
|
+
&.reached-bottom::before {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transition: 0.2s opacity ease;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&::after {
|
|
49
|
+
top: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&::before {
|
|
53
|
+
bottom: 0;
|
|
54
|
+
transform: rotate(180deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-content {
|
|
60
|
+
&.fixed-height {
|
|
61
|
+
@media (min-width: $tablet-width) {
|
|
62
|
+
overflow: auto;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&-bottom-message {
|
|
68
|
+
margin: Margin("5") 0;
|
|
69
|
+
&-link {
|
|
70
|
+
color: SolidColor("tosca");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&-assets {
|
|
75
|
+
display: grid;
|
|
76
|
+
// TODO: Fix the limitation of 300px width on mobile devices below
|
|
77
|
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
78
|
+
gap: Margin("2");
|
|
79
|
+
&:has(*) {
|
|
80
|
+
margin-bottom: Margin("5");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.item {
|
|
84
|
+
position: relative;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: stretch;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
width: 100%;
|
|
89
|
+
|
|
90
|
+
.link {
|
|
91
|
+
background: SolidColor("lightsmoke");
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
text-decoration: none;
|
|
95
|
+
width: 100%;
|
|
96
|
+
padding: Padding("4") Padding("5");
|
|
97
|
+
border-radius: 8px;
|
|
98
|
+
|
|
99
|
+
transition: 0.2s all ease;
|
|
100
|
+
box-shadow: $shadowOutlineStatic;
|
|
101
|
+
|
|
102
|
+
&.outline {
|
|
103
|
+
box-shadow: $shadowOutlineActive;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media (hover: hover) {
|
|
107
|
+
&:hover {
|
|
108
|
+
&:not(.outline):not(.disabled):not(.loading) {
|
|
109
|
+
box-shadow: $shadowOutlineHover;
|
|
110
|
+
transition: 0.02s all ease;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.icon {
|
|
116
|
+
height: 34px;
|
|
117
|
+
}
|
|
118
|
+
.toggle-container {
|
|
119
|
+
margin-left: auto;
|
|
120
|
+
padding-left: Padding("2");
|
|
121
|
+
}
|
|
122
|
+
.content {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
align-items: flex-start;
|
|
127
|
+
margin-left: Margin("4");
|
|
128
|
+
color: SolidColor("dark");
|
|
129
|
+
min-width: 0;
|
|
130
|
+
line-height: 20px;
|
|
131
|
+
|
|
132
|
+
.name,
|
|
133
|
+
.amount {
|
|
134
|
+
color: inherit;
|
|
135
|
+
line-height: inherit;
|
|
136
|
+
user-select: none;
|
|
137
|
+
text-align: left;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.name {
|
|
141
|
+
font-weight: $bold;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.amount {
|
|
145
|
+
font-weight: $semi-bold;
|
|
146
|
+
opacity: 0.5;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.arrow {
|
|
151
|
+
height: 20px;
|
|
152
|
+
transform: rotate(-90deg);
|
|
153
|
+
margin-left: auto;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&-load-more-button {
|
|
160
|
+
width: 100%;
|
|
161
|
+
display: flex;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&-asset-not-found {
|
|
166
|
+
height: 72px;
|
|
167
|
+
display: flex;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
align-items: center;
|
|
170
|
+
background: SolidColor("lightsmoke");
|
|
171
|
+
border-radius: 8px;
|
|
172
|
+
|
|
173
|
+
h6 {
|
|
174
|
+
color: SolidColor("grey");
|
|
175
|
+
font-weight: $semi-bold;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.coin-picker.loading {
|
|
183
|
+
.item {
|
|
184
|
+
.link {
|
|
185
|
+
&:hover {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
cursor: default;
|
|
188
|
+
}
|
|
189
|
+
.icon {
|
|
190
|
+
@extend %skeleton-icon;
|
|
191
|
+
height: 34px;
|
|
192
|
+
width: 34px;
|
|
193
|
+
}
|
|
194
|
+
.content {
|
|
195
|
+
.name {
|
|
196
|
+
@extend %skeleton-text;
|
|
197
|
+
width: 65px;
|
|
198
|
+
margin-bottom: Margin("2");
|
|
199
|
+
}
|
|
200
|
+
.amount {
|
|
201
|
+
@extend %skeleton-text;
|
|
202
|
+
width: 110px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|