@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,242 @@
|
|
|
1
|
+
import { improveAndRethrow } from "./errorUtils.js";
|
|
2
|
+
import { Logger } from "./logging/logger.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TODO: [tests, critical] Ued by payments logic
|
|
6
|
+
*
|
|
7
|
+
* Simple cache based on Map.
|
|
8
|
+
* Provides ability to store event-dependent data.
|
|
9
|
+
*/
|
|
10
|
+
export class Cache {
|
|
11
|
+
/**
|
|
12
|
+
* @param [eventBus=null] {EventBus} EventBus.js lib instance if you plan to use Cache with events handling
|
|
13
|
+
* @param [noSessionEvents=[]] {string[]} array of events that will be treated as "no session", you should pass EventBus to make it work
|
|
14
|
+
*/
|
|
15
|
+
constructor(eventBus = null, noSessionEvents = []) {
|
|
16
|
+
this._cache = new Map();
|
|
17
|
+
this._eventDependentDataKeys = [];
|
|
18
|
+
this._noSessionEvents = noSessionEvents;
|
|
19
|
+
this._eventBus = eventBus;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_setupIntervalClearingExpired() {
|
|
23
|
+
let cleaner = function () {
|
|
24
|
+
try {
|
|
25
|
+
for (const key of this._cache.keys()) {
|
|
26
|
+
const item = this._cache.get(key);
|
|
27
|
+
if (item && item.ttlMs && item.addedMsTimestamp + item.ttlMs < Date.now()) {
|
|
28
|
+
this._cache.delete(key);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} catch (e) {
|
|
32
|
+
improveAndRethrow(e, "_intervalClearingExpiredCache");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
cleaner = cleaner.bind(this);
|
|
37
|
+
|
|
38
|
+
setInterval(cleaner, 1000);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Puts data to cache
|
|
43
|
+
*
|
|
44
|
+
* @param key {string} string key for this data
|
|
45
|
+
* @param data {any} any data
|
|
46
|
+
* @param ttlMs {number|null} optional milliseconds number for cache lifetime
|
|
47
|
+
* @throws {Error} when the data is null/undefined because these values for data are reserved for internal logic
|
|
48
|
+
*/
|
|
49
|
+
put(key, data, ttlMs = null) {
|
|
50
|
+
try {
|
|
51
|
+
if (typeof key !== "string" || data == null) {
|
|
52
|
+
throw new Error(`Trying to cache corrupted data: ${key}, ${data}`);
|
|
53
|
+
}
|
|
54
|
+
this._cache.set(key, {
|
|
55
|
+
data: data,
|
|
56
|
+
addedMsTimestamp: Date.now(),
|
|
57
|
+
ttlMs: ttlMs,
|
|
58
|
+
});
|
|
59
|
+
} catch (e) {
|
|
60
|
+
improveAndRethrow(e, "cache.put");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
putSessionDependentData(key, data, ttlMs = null) {
|
|
65
|
+
this._putEventDependentData(key, data, this._noSessionEvents, ttlMs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Puts data to cache and adds its key to list of keys that should be related by each of given events.
|
|
70
|
+
*
|
|
71
|
+
* @param key {string} key for cache
|
|
72
|
+
* @param data {any} any caching data
|
|
73
|
+
* @param events {string[]} list of events forcing putting data to be removed when triggered
|
|
74
|
+
* @param ttlMs {|null} optional time to live for this cache item
|
|
75
|
+
* @throws {Error} when the data is null/undefined because these values for data are reserved for internal logic
|
|
76
|
+
*/
|
|
77
|
+
putEventDependentData(key, data, events, ttlMs = null) {
|
|
78
|
+
this._putEventDependentData(key, data, events, ttlMs);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_putEventDependentData(key, data, events, ttlMs = null) {
|
|
82
|
+
try {
|
|
83
|
+
if (typeof key !== "string" || data == null) {
|
|
84
|
+
throw new Error(`Trying to cache corrupted data: ${key}, ${data}`);
|
|
85
|
+
}
|
|
86
|
+
this._cache.set(key, {
|
|
87
|
+
data: data,
|
|
88
|
+
addedMsTimestamp: Date.now(),
|
|
89
|
+
ttlMs: ttlMs,
|
|
90
|
+
});
|
|
91
|
+
for (let event of events) {
|
|
92
|
+
const eventAndKeys = this._eventDependentDataKeys.find(item => item[0] === event);
|
|
93
|
+
if (eventAndKeys) {
|
|
94
|
+
eventAndKeys.push(key);
|
|
95
|
+
} else if (this._eventBus) {
|
|
96
|
+
this._eventDependentDataKeys.push([event, key]);
|
|
97
|
+
this._eventBus.addEventListener(event, () => {
|
|
98
|
+
try {
|
|
99
|
+
const keys = this._eventDependentDataKeys.find(item => item[0] === event);
|
|
100
|
+
(keys ?? [event]).slice(1).forEach(key => this._cache.delete(key));
|
|
101
|
+
} catch (e) {
|
|
102
|
+
Logger.logError(e, "cache.removing-for-event", `Event: ${event}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
improveAndRethrow(e, "cache.putEventDependentData");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// TODO: [feature, low] add clearing of expired data by schedule
|
|
113
|
+
get(key) {
|
|
114
|
+
try {
|
|
115
|
+
const item = this._cache.get(key);
|
|
116
|
+
if (item) {
|
|
117
|
+
if (item.addedMsTimestamp && item.ttlMs !== null && item.addedMsTimestamp + item.ttlMs < Date.now()) {
|
|
118
|
+
this._cache.delete(key);
|
|
119
|
+
return null;
|
|
120
|
+
} else {
|
|
121
|
+
return item.data;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return null;
|
|
126
|
+
} catch (e) {
|
|
127
|
+
improveAndRethrow(e, "cache.get");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getLastUpdateTimestamp(key) {
|
|
132
|
+
return this._cache.get(key)?.addedMsTimestamp ?? null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Updates the timestamp of the last update for specified key to the provided value.
|
|
137
|
+
* Can be useful when TTL is controlled outside this class.
|
|
138
|
+
*
|
|
139
|
+
* @param key {string}
|
|
140
|
+
* @param timestamp {number}
|
|
141
|
+
* @return {boolean}
|
|
142
|
+
*/
|
|
143
|
+
setLastUpdateTimestamp(key, timestamp) {
|
|
144
|
+
try {
|
|
145
|
+
const item = this._cache.get(key);
|
|
146
|
+
if (item != null && typeof timestamp === "number") {
|
|
147
|
+
this._cache.set(key, { ...item, addedTimestampMs: timestamp });
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
improveAndRethrow("cache.setLastUpdateTimestamp");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
invalidate(key) {
|
|
157
|
+
try {
|
|
158
|
+
this._cache.delete(key);
|
|
159
|
+
} catch (e) {
|
|
160
|
+
improveAndRethrow(e, "cache.invalidate");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
invalidateContaining(keyPart) {
|
|
165
|
+
if (typeof keyPart !== "string" || keyPart === "") {
|
|
166
|
+
throw new Error("Trying to invalidate containing wrong key or empty key: " + keyPart);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
const matchedKeys = Array.from(this._cache.keys()).filter(
|
|
171
|
+
key => typeof key === "string" && new RegExp(keyPart).test(key)
|
|
172
|
+
);
|
|
173
|
+
for (let i = 0; i < matchedKeys.length; ++i) {
|
|
174
|
+
this._cache.delete(matchedKeys[i]);
|
|
175
|
+
}
|
|
176
|
+
} catch (e) {
|
|
177
|
+
improveAndRethrow(e, "invalidateContaining");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
clear() {
|
|
182
|
+
this._cache.clear();
|
|
183
|
+
this._sessionDependentDataKeys = [];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Saves given data string to persistent cache.
|
|
188
|
+
* NOTE: we have no TTL here, implement if needed.
|
|
189
|
+
*
|
|
190
|
+
* WARNING: use only when really needed and don't store big data as we use localStorage
|
|
191
|
+
* under the hood and its capacity is restricted.
|
|
192
|
+
*
|
|
193
|
+
* @param uniqueKey {string} the key should be unique
|
|
194
|
+
* @param data {string} only string data allowed
|
|
195
|
+
*/
|
|
196
|
+
putClientPersistentData(uniqueKey, data) {
|
|
197
|
+
try {
|
|
198
|
+
if (typeof window !== "undefined") {
|
|
199
|
+
localStorage.setItem(uniqueKey, data);
|
|
200
|
+
}
|
|
201
|
+
} catch (e) {
|
|
202
|
+
improveAndRethrow(e, "cache.putClientPersistentData");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @param uniqueKey {string}
|
|
208
|
+
* @return {string|null}
|
|
209
|
+
*/
|
|
210
|
+
getClientPersistentData(uniqueKey) {
|
|
211
|
+
try {
|
|
212
|
+
if (typeof window !== "undefined") {
|
|
213
|
+
return localStorage.getItem(uniqueKey);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
} catch (e) {
|
|
217
|
+
improveAndRethrow(e, "cache.getClientPersistentData");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Only makes effect if the TTL is not null.
|
|
223
|
+
*
|
|
224
|
+
* @param key {string}
|
|
225
|
+
* @param ttlMs {number|null}
|
|
226
|
+
*/
|
|
227
|
+
markCacheItemAsExpiredButDontRemove(key, ttlMs = null) {
|
|
228
|
+
try {
|
|
229
|
+
const item = this._cache.get(key);
|
|
230
|
+
const ttlFinalMs = ttlMs ?? item?.ttlMs;
|
|
231
|
+
if (item != null && ttlFinalMs) {
|
|
232
|
+
this._cache.set(key, {
|
|
233
|
+
data: item.data,
|
|
234
|
+
addedMsTimestamp: Date.now() - ttlFinalMs - 1,
|
|
235
|
+
ttlMs: ttlFinalMs,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
} catch (e) {
|
|
239
|
+
improveAndRethrow(e, "cache.markCacheItemAsExpiredButDontRemove");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Logger } from "./logging/logger.js";
|
|
2
|
+
import { safeStringify } from "./safeStringify.js";
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* This function improves the passed error object (its message) by adding the passed function name
|
|
3
6
|
* and additional message to it.
|
|
@@ -25,3 +28,15 @@ function improvedErrorMessage(e, settingFunction, additionalMessage) {
|
|
|
25
28
|
|
|
26
29
|
return message;
|
|
27
30
|
}
|
|
31
|
+
|
|
32
|
+
export function logErrorOrOutputToConsole(e) {
|
|
33
|
+
try {
|
|
34
|
+
// TODO: [dev] remove this after few weeks of testing output in real life
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.log("BEFORE SAFE", e);
|
|
37
|
+
Logger.log("logErrorOrOutputToConsole", safeStringify(e));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.log("logErrorOrOutputToConsole", e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LogsStorage } from "./logsStorage.js";
|
|
2
|
+
import { safeStringify } from "../safeStringify.js";
|
|
3
|
+
|
|
4
|
+
export class Logger {
|
|
5
|
+
/**
|
|
6
|
+
* Logs to client logs storage.
|
|
7
|
+
*
|
|
8
|
+
* WARNING! this method should ce used carefully for critical logging as we have the restriction for storing logs
|
|
9
|
+
* on client side as we store them inside the local storage. Please see details inside storage.js
|
|
10
|
+
* @param logString {string} log string
|
|
11
|
+
* @param source {string} source of the log entry
|
|
12
|
+
*/
|
|
13
|
+
static log(logString, source) {
|
|
14
|
+
const timestamp = new Date().toISOString();
|
|
15
|
+
LogsStorage.saveLog(`${timestamp}|${source}:${logString}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static logError(e, settingFunction, additionalMessage = "", onlyToConsole = false) {
|
|
19
|
+
let message = `\nFunction call ${settingFunction ?? ""} failed. Error message: ${
|
|
20
|
+
e?.message
|
|
21
|
+
}. ${additionalMessage} `;
|
|
22
|
+
message +=
|
|
23
|
+
`${e?.errorDescription ?? ""}${e?.howToFix ?? ""}` +
|
|
24
|
+
(e?.httpStatus === 403 ? "Authentication has expired or was lost. " : "");
|
|
25
|
+
|
|
26
|
+
if (e?.response) {
|
|
27
|
+
try {
|
|
28
|
+
const responseData = safeStringify({ response: e.response });
|
|
29
|
+
responseData && (message += `\n${responseData}. `);
|
|
30
|
+
} catch (e) {}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const finalErrorText = message + ". " + safeStringify(e);
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.error(finalErrorText, e);
|
|
36
|
+
|
|
37
|
+
if (!onlyToConsole) {
|
|
38
|
+
this.log(finalErrorText, "logError");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export class LogsStorage {
|
|
2
|
+
static _inMemoryStorage = [];
|
|
3
|
+
static _logsStorageId = "clietnLogs_j203fj2D0n-d1";
|
|
4
|
+
|
|
5
|
+
static saveLog(log) {
|
|
6
|
+
this._inMemoryStorage.push(log);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static getInMemoryLogs() {
|
|
10
|
+
return this._inMemoryStorage;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getAllLogs() {
|
|
14
|
+
let storedLogs = "";
|
|
15
|
+
if (typeof window !== "undefined") {
|
|
16
|
+
storedLogs = localStorage.getItem(this._logsStorageId);
|
|
17
|
+
}
|
|
18
|
+
return `${storedLogs}\n${this._inMemoryStorage.join("\n")}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param logger {Logger}
|
|
23
|
+
*/
|
|
24
|
+
static saveToTheDisk(logger) {
|
|
25
|
+
try {
|
|
26
|
+
const MAX_LOCAL_STORAGE_VOLUME_BYTES = 5 * 1024 * 1024;
|
|
27
|
+
const MAX_LOGS_STORAGE_BYTES = MAX_LOCAL_STORAGE_VOLUME_BYTES * 0.65;
|
|
28
|
+
if (typeof window !== "undefined") {
|
|
29
|
+
const existingLogs = localStorage.getItem(this._logsStorageId);
|
|
30
|
+
const logsString = `${existingLogs}\n${this._inMemoryStorage.join("\n")}`;
|
|
31
|
+
const lettersCountToRemove = logsString.length - Math.round(MAX_LOGS_STORAGE_BYTES / 2);
|
|
32
|
+
if (lettersCountToRemove > 0) {
|
|
33
|
+
localStorage.setItem(
|
|
34
|
+
this._logsStorageId,
|
|
35
|
+
logsString.slice(lettersCountToRemove, logsString.length)
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
localStorage.setItem(this._logsStorageId, logsString);
|
|
39
|
+
}
|
|
40
|
+
this._inMemoryStorage = [];
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
logger?.logError(e, "saveToTheDisk", "Failed to save logs to disk");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static removeAllClientLogs() {
|
|
48
|
+
if (typeof window !== "undefined") {
|
|
49
|
+
if (localStorage.getItem("doNotRemoveClientLogsWhenSignedOut") !== "true") {
|
|
50
|
+
localStorage.removeItem(this._logsStorageId);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this._inMemoryStorage = [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static setDoNotRemoveClientLogsWhenSignedOut(value) {
|
|
57
|
+
if (typeof window !== "undefined") {
|
|
58
|
+
localStorage.setItem("doNotRemoveClientLogsWhenSignedOut", value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Major point of rabbit ticker format definition.
|
|
3
|
+
* Our asset ticker format is just stick standard (printable) ticker with protocol code.
|
|
4
|
+
* If protocol code is the same as asset ticker than it is not added.
|
|
5
|
+
* Examples:
|
|
6
|
+
* SHIBERC20 - shiba inu on ethereum,
|
|
7
|
+
* TON - Ton coin on ton blockchain,
|
|
8
|
+
* BTC - Bitcoin in BTC mainnet,
|
|
9
|
+
* NOTTON - Notcoin in Ton blockchain
|
|
10
|
+
*
|
|
11
|
+
* @param standardPrintableTicker {string}
|
|
12
|
+
* @param protocolOrNetworkCode {string}
|
|
13
|
+
* @return {string}
|
|
14
|
+
*/
|
|
15
|
+
export function toRabbitTicker(standardPrintableTicker, protocolOrNetworkCode) {
|
|
16
|
+
if (
|
|
17
|
+
typeof standardPrintableTicker !== "string" ||
|
|
18
|
+
(typeof protocolOrNetworkCode !== "string" && protocolOrNetworkCode != null)
|
|
19
|
+
)
|
|
20
|
+
throw new Error("Wrong ticker/protocol passed: " + standardPrintableTicker + ", " + protocolOrNetworkCode);
|
|
21
|
+
const upperTicker = standardPrintableTicker.toUpperCase();
|
|
22
|
+
const upperCode = (protocolOrNetworkCode ?? "").toUpperCase();
|
|
23
|
+
return `${upperTicker}${upperCode === upperTicker ? "" : upperCode}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stringify given object by use of JSON.stringify but handles circular structures and "response", "request" properties
|
|
3
|
+
* to avoid stringing redundant data when printing errors containing request/response objects.
|
|
4
|
+
*
|
|
5
|
+
* @param object - object to be stringed
|
|
6
|
+
* @param indent - custom indentation
|
|
7
|
+
* @return {string} - stringed object
|
|
8
|
+
*/
|
|
9
|
+
export function safeStringify(object, indent = 2) {
|
|
10
|
+
let cache = [];
|
|
11
|
+
if (
|
|
12
|
+
typeof object === "string" ||
|
|
13
|
+
typeof object === "function" ||
|
|
14
|
+
typeof object === "number" ||
|
|
15
|
+
typeof object === "undefined" ||
|
|
16
|
+
typeof object === "boolean"
|
|
17
|
+
) {
|
|
18
|
+
return String(object);
|
|
19
|
+
}
|
|
20
|
+
const retVal = JSON.stringify(
|
|
21
|
+
object,
|
|
22
|
+
(key, value) => {
|
|
23
|
+
if (key.toLowerCase().includes("request")) {
|
|
24
|
+
return JSON.stringify({
|
|
25
|
+
body: value?.body,
|
|
26
|
+
query: value?.query,
|
|
27
|
+
headers: value?.headers,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (key.toLowerCase().includes("response")) {
|
|
32
|
+
return JSON.stringify({
|
|
33
|
+
statusText: value?.statusText,
|
|
34
|
+
status: value?.status,
|
|
35
|
+
data: value?.data,
|
|
36
|
+
headers: value?.headers,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return typeof value === "object" && value !== null
|
|
41
|
+
? cache.includes(value)
|
|
42
|
+
? "duplicated reference" // Duplicated references were found, discarding this key
|
|
43
|
+
: cache.push(value) && value // Store value in our collection
|
|
44
|
+
: value;
|
|
45
|
+
},
|
|
46
|
+
indent
|
|
47
|
+
);
|
|
48
|
+
cache = null;
|
|
49
|
+
return retVal;
|
|
50
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,97 @@
|
|
|
1
1
|
// UI-KIT components
|
|
2
|
-
export { Button } from "./components/atoms/buttons/Button/Button.jsx";
|
|
3
|
-
export { LoadingDots } from "./components/atoms/LoadingDots/LoadingDots.jsx";
|
|
4
|
-
export { SupportChat } from "./components/atoms/SupportChat/SupportChat.jsx";
|
|
5
|
-
export { AssetIcon } from "./components/atoms/AssetIcon/AssetIcon.jsx";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
2
|
+
export { Button } from "./ui-kit/components/atoms/buttons/Button/Button.jsx";
|
|
3
|
+
export { LoadingDots } from "./ui-kit/components/atoms/LoadingDots/LoadingDots.jsx";
|
|
4
|
+
export { SupportChat } from "./ui-kit/components/atoms/SupportChat/SupportChat.jsx";
|
|
5
|
+
export { AssetIcon } from "./ui-kit/components/atoms/AssetIcon/AssetIcon.jsx";
|
|
6
|
+
export { LinkButton, ICON_ROTATE_OPTIONS } from "./ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx";
|
|
7
|
+
export { DialogButtons } from "./ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx";
|
|
8
|
+
export { BackgroundTitle } from "./ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx";
|
|
9
|
+
export { Close, CLOSE_COLORS } from "./ui-kit/components/atoms/buttons/Close/Close.jsx";
|
|
10
|
+
export { Validation } from "./ui-kit/components/atoms/Validation/Validation.jsx";
|
|
11
|
+
export { Dialog, DIALOG_SIZES, DIALOG_TRANSITION_STEP_DURATION } from "./ui-kit/components/organisms/Dialog/Dialog.jsx";
|
|
12
|
+
export { DialogStep, DIALOG_STEP_CLASS } from "./ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx";
|
|
13
|
+
export { AssetSelection } from "./ui-kit/components/atoms/AssetSelection/AssetSelection.jsx";
|
|
14
|
+
export { Tooltip, TOOLTIP_POSITIONS } from "./ui-kit/components/atoms/Tooltip/Tooltip.jsx";
|
|
15
|
+
export { NoticeIcon } from "./ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx";
|
|
16
|
+
export { TitleBox } from "./ui-kit/components/atoms/TitleBox/TitleBox.jsx";
|
|
17
|
+
export { AmountInput } from "./ui-kit/components/molecules/AmountInput/AmountInput.jsx";
|
|
18
|
+
export { SwapForm } from "./ui-kit/components/organisms/SwapForm/SwapForm.jsx";
|
|
19
|
+
export { Textarea } from "./ui-kit/components/atoms/Textarea/Textarea.jsx";
|
|
20
|
+
export { QrCode } from "./ui-kit/components/atoms/QrCode/QrCode.jsx";
|
|
21
|
+
export { LinesOfText } from "./ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx";
|
|
22
|
+
export { LineWithIconLink } from "./ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx";
|
|
23
|
+
export { DeterminedErrorDialogStep } from "./ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx";
|
|
24
|
+
export { TitledLineWithIconLink } from "./ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx";
|
|
25
|
+
export { RadioButtonWithText } from "./ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx";
|
|
26
|
+
export { InformationMessage } from "./ui-kit/components/atoms/InformationMessage/InformationMessage.jsx";
|
|
27
|
+
export { Input } from "./ui-kit/components/atoms/Input/Input.jsx";
|
|
28
|
+
export { COIN_PICKER_MODES, CoinPicker } from "./ui-kit/components/molecules/CoinPicker/CoinPicker.jsx";
|
|
29
|
+
export { CoinPickerDialogStep } from "./ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx";
|
|
30
|
+
export { SearchableCoinsList } from "./ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx";
|
|
31
|
+
export { ColoredNotice } from "./ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx";
|
|
32
|
+
export { WaitlistSubscription } from "./ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx";
|
|
33
|
+
export { LogoCarousel } from "./ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx";
|
|
34
|
+
|
|
35
|
+
// UI-KIT constants
|
|
36
|
+
export { FALLBACK_ASSET_ICON_URL, DEFAULT_CRYPTO_DECIMAL_COUNT } from "./common-apis/globalConstants.jsx";
|
|
37
|
+
|
|
38
|
+
export { useCallHandlingErrors } from "./ui-kit/hooks/useCallHandlingErrors.js";
|
|
39
|
+
export { useReferredState } from "./ui-kit/hooks/useReferredState.js";
|
|
40
|
+
export { handleClickOutside } from "./ui-kit/utils/uiUtils.js";
|
|
41
|
+
export { InputValuesProviders } from "./ui-kit/utils/inputValueProviders.js";
|
|
42
|
+
export { copyBrowserTextToClipboard } from "./ui-kit/utils/textUtils.js";
|
|
43
|
+
export { useIsHydrated } from "./ui-kit/hooks/useIsHydrated.js";
|
|
44
|
+
|
|
45
|
+
export { saveQueryParameterAndValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
46
|
+
export { removeQueryParameterAndValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
47
|
+
export { getQueryParameterSingleValue } from "./ui-kit/utils/urlQueryUtils.js";
|
|
48
|
+
export { getQueryParameterValues } from "./ui-kit/utils/urlQueryUtils.js";
|
|
49
|
+
|
|
50
|
+
// Common code lib (to be extracted later to dedicated lib)
|
|
51
|
+
export { improveAndRethrow } from "./common-apis/utils/errorUtils.js";
|
|
52
|
+
export { logErrorOrOutputToConsole } from "./common-apis/utils/errorUtils.js";
|
|
53
|
+
export { FiatCurrenciesService } from "./common-apis/services/fiatCurrenciesService.js";
|
|
54
|
+
export { AmountUtils } from "./common-apis/utils/amountUtils.js";
|
|
55
|
+
export { toRabbitTicker } from "./common-apis/utils/rabbitTicker.js";
|
|
56
|
+
|
|
57
|
+
export { Blockchain } from "./common-apis/models/blockchain.js";
|
|
58
|
+
export { Protocol } from "./common-apis/models/protocol.js";
|
|
59
|
+
export { Coin } from "./common-apis/models/coin.js";
|
|
60
|
+
|
|
61
|
+
export { Cache } from "./common-apis/utils/cache.js";
|
|
62
|
+
export { safeStringify } from "./common-apis/utils/safeStringify.js";
|
|
63
|
+
export { LogsStorage } from "./common-apis/utils/logging/logsStorage.js";
|
|
64
|
+
export { Logger } from "./common-apis/utils/logging/logger.js";
|
|
65
|
+
export { postponeExecution } from "./common-apis/utils/postponeExecution.js";
|
|
66
|
+
export { AxiosAdapter } from "./common-apis/adapters/axiosAdapter.js";
|
|
67
|
+
|
|
68
|
+
export { EmailsApi } from "./common-apis/external-apis/emailAPI.js";
|
|
69
|
+
export { IpAddressProvider } from "./common-apis/external-apis/ipAddressProviders.js";
|
|
70
|
+
|
|
71
|
+
export { GoogleAnalyticsAdapter } from "./common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js";
|
|
72
|
+
export { MixpanelAdapter } from "./common-apis/adapters/analyticsAdapters/mixpanelAdapter.js";
|
|
73
|
+
export { MetrikaAdapter } from "./common-apis/adapters/analyticsAdapters/metrikaAdapter.js";
|
|
74
|
+
|
|
75
|
+
// Robust data retriever service and related APIs (to be extracted later to dedicated lib)
|
|
76
|
+
export { CacheAndConcurrentRequestsResolver } from "./robust-api-caller/cacheAndConcurrentRequestsResolver.js";
|
|
77
|
+
export { CachedRobustExternalApiCallerService } from "./robust-api-caller/cachedRobustExternalApiCallerService.js";
|
|
78
|
+
export { CancelProcessing } from "./robust-api-caller/cancelProcessing.js";
|
|
79
|
+
export { ExternalApiProvider } from "./robust-api-caller/externalApiProvider.js";
|
|
80
|
+
export { RobustExternalAPICallerService } from "./robust-api-caller/robustExternalAPICallerService.js";
|
|
81
|
+
export { ConcurrentCalculationsMetadataHolder } from "./robust-api-caller/concurrentCalculationsMetadataHolder.js";
|
|
82
|
+
|
|
83
|
+
export { ApiGroups } from "./common-apis/external-apis/apiGroups.js";
|
|
84
|
+
export { ApiGroup } from "./common-apis/external-apis/apiGroups.js";
|
|
85
|
+
|
|
86
|
+
// Swaps lib (to be extracted later to dedicated lib)
|
|
87
|
+
export { ExistingSwap } from "./swaps-lib/models/existingSwap.js";
|
|
88
|
+
export { ExistingSwapWithFiatData } from "./swaps-lib/models/existingSwapWithFiatData.js";
|
|
89
|
+
export { BaseSwapCreationInfo } from "./swaps-lib/models/baseSwapCreationInfo.js";
|
|
90
|
+
export { SwapProviderCoinInfo } from "./swaps-lib/models/swapProviderCoinInfo.js";
|
|
91
|
+
export { SwapProvider } from "./swaps-lib/external-apis/swapProvider.js";
|
|
92
|
+
export { SwapspaceSwapProvider } from "./swaps-lib/external-apis/swapspaceSwapProvider.js";
|
|
93
|
+
export { LetsExchangeSwapProvider } from "./swaps-lib/external-apis/letsExchangeSwapProvider.js";
|
|
94
|
+
export { ExolixSwapProvider } from "./swaps-lib/external-apis/exolixSwapProvider.js";
|
|
95
|
+
export { SwapUtils } from "./swaps-lib/utils/swapUtils.js";
|
|
96
|
+
export { PublicSwapService } from "./swaps-lib/services/publicSwapService.js";
|
|
97
|
+
export { Partner, KYC_LEVELS } from "./swaps-lib/models/partner.js";
|