@rabbitio/ui-kit 1.0.0-beta.6 → 1.0.0-beta.61
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 +14 -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 +17210 -0
- package/coverage/coverage-final.json +160 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +1241 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/ui-kit/index.html +116 -0
- package/coverage/ui-kit/index.js.html +88 -0
- package/coverage/ui-kit/src/assets/wrappedImages/arrowIcon.jsx.html +142 -0
- package/coverage/ui-kit/src/assets/wrappedImages/arrowTosca.jsx.html +145 -0
- package/coverage/ui-kit/src/assets/wrappedImages/arrowWhite.jsx.html +145 -0
- package/coverage/ui-kit/src/assets/wrappedImages/darkRectangle.jsx.html +139 -0
- package/coverage/ui-kit/src/assets/wrappedImages/determinedError.jsx.html +472 -0
- package/coverage/ui-kit/src/assets/wrappedImages/failedValidationIcon.jsx.html +244 -0
- package/coverage/ui-kit/src/assets/wrappedImages/index.html +251 -0
- package/coverage/ui-kit/src/assets/wrappedImages/infoIcon.jsx.html +151 -0
- package/coverage/ui-kit/src/assets/wrappedImages/noticeQuestionIcon.jsx.html +265 -0
- package/coverage/ui-kit/src/assets/wrappedImages/successfulValidationIcon.jsx.html +205 -0
- package/coverage/ui-kit/src/assets/wrappedImages/walletIcon.jsx.html +199 -0
- package/coverage/ui-kit/src/common/adapters/axiosAdapter.js.html +190 -0
- package/coverage/ui-kit/src/common/adapters/index.html +131 -0
- package/coverage/ui-kit/src/common/adapters/qrUtils.js.html +139 -0
- package/coverage/ui-kit/src/common/amountUtils.js.html +1393 -0
- package/coverage/ui-kit/src/common/errorUtils.js.html +211 -0
- package/coverage/ui-kit/src/common/external-apis/apiGroups.js.html +250 -0
- package/coverage/ui-kit/src/common/external-apis/index.html +131 -0
- package/coverage/ui-kit/src/common/external-apis/ipAddressProviders.js.html +499 -0
- package/coverage/ui-kit/src/common/fiatCurrenciesService.js.html +568 -0
- package/coverage/ui-kit/src/common/index.html +146 -0
- package/coverage/ui-kit/src/common/models/blockchain.js.html +115 -0
- package/coverage/ui-kit/src/common/models/coin.js.html +556 -0
- package/coverage/ui-kit/src/common/models/index.html +146 -0
- package/coverage/ui-kit/src/common/models/protocol.js.html +100 -0
- package/coverage/ui-kit/src/common/utils/cache.js.html +889 -0
- package/coverage/ui-kit/src/common/utils/emailAPI.js.html +139 -0
- package/coverage/ui-kit/src/common/utils/index.html +161 -0
- package/coverage/ui-kit/src/common/utils/logging/index.html +131 -0
- package/coverage/ui-kit/src/common/utils/logging/logger.js.html +229 -0
- package/coverage/ui-kit/src/common/utils/logging/logsStorage.js.html +268 -0
- package/coverage/ui-kit/src/common/utils/postponeExecution.js.html +118 -0
- package/coverage/ui-kit/src/common/utils/safeStringify.js.html +235 -0
- package/coverage/ui-kit/src/components/atoms/AssetIcon/AssetIcon.jsx.html +277 -0
- package/coverage/ui-kit/src/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/AssetSelection/AssetSelection.jsx.html +310 -0
- package/coverage/ui-kit/src/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +217 -0
- package/coverage/ui-kit/src/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/InformationMessage/InformationMessage.jsx.html +265 -0
- package/coverage/ui-kit/src/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Input/Input.jsx.html +679 -0
- package/coverage/ui-kit/src/components/atoms/Input/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/LoadingDots/LoadingDots.jsx.html +256 -0
- package/coverage/ui-kit/src/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/NoticeIcon/NoticeIcon.jsx.html +298 -0
- package/coverage/ui-kit/src/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/QrCode/QrCode.jsx.html +187 -0
- package/coverage/ui-kit/src/components/atoms/QrCode/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/RateSelector/RateSelector.jsx.html +196 -0
- package/coverage/ui-kit/src/components/atoms/RateSelector/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/SupportChat/SupportChat.jsx.html +229 -0
- package/coverage/ui-kit/src/components/atoms/SupportChat/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Textarea/Textarea.jsx.html +559 -0
- package/coverage/ui-kit/src/components/atoms/Textarea/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/TitleBox/TitleBox.jsx.html +577 -0
- package/coverage/ui-kit/src/components/atoms/TitleBox/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Tooltip/Tooltip.jsx.html +295 -0
- package/coverage/ui-kit/src/components/atoms/Tooltip/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +325 -0
- package/coverage/ui-kit/src/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/ui-kit/src/components/atoms/Validation/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Button/Button.jsx.html +802 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Close/Close.jsx.html +262 -0
- package/coverage/ui-kit/src/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/LinkButton.jsx.html +430 -0
- package/coverage/ui-kit/src/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +469 -0
- package/coverage/ui-kit/src/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/ui-kit/src/components/hooks/index.html +131 -0
- package/coverage/ui-kit/src/components/hooks/useCallHandlingErrors.js.html +163 -0
- package/coverage/ui-kit/src/components/hooks/useReferredState.js.html +157 -0
- package/coverage/ui-kit/src/components/molecules/AmountInput/AmountInput.jsx.html +1348 -0
- package/coverage/ui-kit/src/components/molecules/AmountInput/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/CoinPicker/CoinPicker.jsx.html +2011 -0
- package/coverage/ui-kit/src/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +205 -0
- package/coverage/ui-kit/src/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +175 -0
- package/coverage/ui-kit/src/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/ui-kit/src/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/Dialog.jsx.html +1630 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +451 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +2146 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/Dialog/index.html +116 -0
- package/coverage/ui-kit/src/components/organisms/SwapForm/SwapForm.jsx.html +3883 -0
- package/coverage/ui-kit/src/components/organisms/SwapForm/index.html +116 -0
- package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/ui-kit/src/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/ui-kit/src/components/utils/index.html +161 -0
- package/coverage/ui-kit/src/components/utils/inputValueProviders.js.html +259 -0
- package/coverage/ui-kit/src/components/utils/textUtils.js.html +139 -0
- package/coverage/ui-kit/src/components/utils/uiUtils.js.html +127 -0
- package/coverage/ui-kit/src/components/utils/urlQueryUtils.js.html +346 -0
- package/coverage/ui-kit/src/constants/atoms/Close/close.jsx.html +100 -0
- package/coverage/ui-kit/src/constants/atoms/Close/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/LinkButton/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/LinkButton/linkButton.jsx.html +103 -0
- package/coverage/ui-kit/src/constants/atoms/Tooltip/index.html +116 -0
- package/coverage/ui-kit/src/constants/atoms/Tooltip/tooltip.jsx.html +109 -0
- package/coverage/ui-kit/src/constants/globalConstants.jsx.html +97 -0
- package/coverage/ui-kit/src/constants/index.html +116 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/dialogStep.js.html +88 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/dialog.js.html +172 -0
- package/coverage/ui-kit/src/constants/organisms/dialog/index.html +116 -0
- package/coverage/ui-kit/src/index.html +116 -0
- package/coverage/ui-kit/src/index.js.html +367 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js.html +1762 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js.html +649 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/cancelProcessing.js.html +172 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js.html +394 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/externalApiProvider.js.html +553 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/externalServicesStatsCollector.js.html +331 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/index.html +206 -0
- package/coverage/ui-kit/src/robustExteranlApiCallerService/robustExternalAPICallerService.js.html +1249 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/index.html +131 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +727 -0
- package/coverage/ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +2899 -0
- package/coverage/ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +214 -0
- package/coverage/ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
- package/coverage/ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +487 -0
- package/coverage/ui-kit/src/swaps-lib/models/index.html +146 -0
- package/coverage/ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/ui-kit/src/swaps-lib/services/publicSwapService.js.html +2191 -0
- package/coverage/ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/ui-kit/src/swaps-lib/utils/swapUtils.js.html +742 -0
- package/coverage/ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/ui-kit/stories/atoms/buttons/Button.stories.jsx.html +946 -0
- package/coverage/ui-kit/stories/atoms/buttons/Close.stories.jsx.html +214 -0
- package/coverage/ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +295 -0
- package/coverage/ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/ui-kit/stories/atoms/index.html +191 -0
- package/coverage/ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/ui-kit/stories/molecules/index.html +131 -0
- package/coverage/ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +589 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/ui-kit/stories/stubs/index.html +116 -0
- package/coverage/ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +193 -0
- package/coverage/ui-kit/stories/templates/index.html +116 -0
- package/dist/index.cjs +9963 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +71409 -1641
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +7672 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +9883 -11
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +9954 -12
- package/dist/index.umd.js.map +1 -1
- package/index.js +1 -1
- package/package.json +27 -5
- package/src/assets/image/icons/arrow-tosca.svg +3 -0
- package/src/assets/wrappedImages/arrowIcon.jsx +19 -0
- package/src/assets/wrappedImages/arrowTosca.jsx +20 -0
- package/src/assets/wrappedImages/arrowWhite.jsx +20 -0
- package/src/assets/wrappedImages/darkRectangle.jsx +18 -0
- package/src/assets/wrappedImages/determinedError.jsx +129 -0
- package/src/assets/wrappedImages/failedValidationIcon.jsx +53 -0
- package/src/assets/wrappedImages/infoIcon.jsx +22 -0
- package/src/assets/wrappedImages/noticeQuestionIcon.jsx +60 -0
- package/src/assets/wrappedImages/successfulValidationIcon.jsx +40 -0
- package/src/assets/wrappedImages/walletIcon.jsx +38 -0
- package/src/common/adapters/axiosAdapter.js +35 -0
- package/src/common/adapters/qrUtils.js +18 -0
- package/src/common/amountUtils.js +436 -0
- package/src/common/errorUtils.js +42 -0
- package/src/common/external-apis/apiGroups.js +55 -0
- package/src/common/external-apis/ipAddressProviders.js +138 -0
- package/src/common/fiatCurrenciesService.js +161 -0
- package/src/common/models/blockchain.js +10 -0
- package/src/common/models/coin.js +157 -0
- package/src/common/models/protocol.js +5 -0
- package/src/common/tests/integration/external-apis/ipAddressProviders/getClientIpAddress.test.js +14 -0
- package/src/common/utils/cache.js +268 -0
- package/src/common/utils/emailAPI.js +18 -0
- package/src/common/utils/logging/logger.js +48 -0
- package/src/common/utils/logging/logsStorage.js +61 -0
- package/src/common/utils/postponeExecution.js +11 -0
- package/src/common/utils/safeStringify.js +50 -0
- package/src/components/atoms/AssetIcon/AssetIcon.jsx +64 -0
- package/src/components/atoms/AssetIcon/asset-icon.module.scss +42 -0
- package/src/components/atoms/AssetSelection/AssetSelection.jsx +75 -0
- package/src/components/atoms/AssetSelection/asset-selection.module.scss +55 -0
- package/src/components/atoms/BackgroundTitle/BackgroundTitle.jsx +44 -0
- package/src/components/atoms/BackgroundTitle/background-title.module.scss +52 -0
- package/src/components/atoms/InformationMessage/InformationMessage.jsx +60 -0
- package/src/components/atoms/InformationMessage/information-message.module.scss +36 -0
- package/src/components/atoms/Input/Input.jsx +198 -0
- package/src/components/atoms/Input/input.module.scss +107 -0
- package/{stories → src/components}/atoms/LoadingDots/LoadingDots.module.scss +1 -1
- package/src/components/atoms/NoticeIcon/NoticeIcon.jsx +71 -0
- package/src/components/atoms/NoticeIcon/notice-icon.module.scss +14 -0
- package/src/components/atoms/QrCode/QrCode.jsx +34 -0
- package/src/components/atoms/QrCode/qr-code.module.scss +9 -0
- package/src/components/atoms/RateSelector/RateSelector.jsx +37 -0
- package/src/components/atoms/RateSelector/rate-selector.module.scss +47 -0
- package/src/components/atoms/SupportChat/SupportChat.jsx +48 -0
- package/src/components/atoms/Textarea/Textarea.jsx +158 -0
- package/src/components/atoms/Textarea/textarea.module.scss +71 -0
- package/src/components/atoms/TitleBox/TitleBox.jsx +164 -0
- package/src/components/atoms/TitleBox/title-box.module.scss +30 -0
- package/src/components/atoms/Tooltip/Tooltip.jsx +70 -0
- package/src/components/atoms/Tooltip/tooltip.module.scss +237 -0
- package/src/components/atoms/TwoLinesOfText/LinesOfText.jsx +80 -0
- package/src/components/atoms/TwoLinesOfText/lines-of-text.module.scss +65 -0
- package/src/components/atoms/Validation/Validation.jsx +39 -0
- package/src/components/atoms/Validation/validation.module.scss +15 -0
- package/{stories → src/components}/atoms/buttons/Button/Button.jsx +5 -1
- package/{stories → src/components}/atoms/buttons/Button/Button.module.scss +1 -1
- package/src/components/atoms/buttons/Close/Close.jsx +59 -0
- package/src/components/atoms/buttons/Close/close.module.scss +75 -0
- package/src/components/atoms/buttons/LinkButton/LinkButton.jsx +115 -0
- package/src/components/atoms/buttons/LinkButton/link-button.module.scss +49 -0
- package/src/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx +128 -0
- package/src/components/atoms/buttons/RadioButtonWithText/radio-button-with-text.module.scss +86 -0
- package/src/components/hooks/useCallHandlingErrors.js +26 -0
- package/src/components/hooks/useReferredState.js +24 -0
- package/src/components/molecules/AmountInput/AmountInput.jsx +421 -0
- package/src/components/molecules/AmountInput/amount-input.module.scss +189 -0
- package/src/components/molecules/CoinPicker/CoinPicker.jsx +642 -0
- package/src/components/molecules/CoinPicker/coin-picker.module.scss +210 -0
- package/src/components/molecules/LineWithIconLink/LineWithIconLink.jsx +40 -0
- package/src/components/molecules/LineWithIconLink/line-with-icon-link.module.scss +25 -0
- package/src/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx +30 -0
- package/src/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx +66 -0
- package/src/components/organisms/Dialog/Dialog.jsx +515 -0
- package/src/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +122 -0
- package/src/components/organisms/Dialog/DialogButtons/dialog-buttons.module.scss +25 -0
- package/src/components/organisms/Dialog/DialogStep/DialogStep.jsx +687 -0
- package/src/components/organisms/Dialog/DialogStep/dialog-step.module.scss +383 -0
- package/src/components/organisms/Dialog/dialog.module.scss +226 -0
- package/src/components/organisms/SwapForm/SwapForm.jsx +1266 -0
- package/src/components/organisms/SwapForm/swap-form.module.scss +134 -0
- package/src/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx +77 -0
- package/src/components/tests/utils/inputValueProviders/provideFormatOfFloatValueByInputString.test.js +139 -0
- package/src/components/tests/utils/urlQueryUtils/getQueryParameterValues.test.js +71 -0
- package/src/components/tests/utils/urlQueryUtils/saveQueryParameterAndValues.test.js +144 -0
- package/src/components/utils/inputValueProviders.js +58 -0
- package/src/components/utils/textUtils.js +18 -0
- package/src/components/utils/uiUtils.js +14 -0
- package/src/components/utils/urlQueryUtils.js +87 -0
- package/src/constants/atoms/Close/close.jsx +5 -0
- package/src/constants/atoms/LinkButton/linkButton.jsx +6 -0
- package/src/constants/atoms/Tooltip/tooltip.jsx +8 -0
- package/src/constants/globalConstants.jsx +4 -0
- package/src/constants/organisms/dialog/DialogStep/dialogStep.js +1 -0
- package/src/constants/organisms/dialog/dialog.js +29 -0
- package/src/index.js +94 -0
- package/src/robustExteranlApiCallerService/cacheAndConcurrentRequestsResolver.js +559 -0
- package/src/robustExteranlApiCallerService/cachedRobustExternalApiCallerService.js +188 -0
- package/src/robustExteranlApiCallerService/cancelProcessing.js +29 -0
- package/src/robustExteranlApiCallerService/concurrentCalculationsMetadataHolder.js +103 -0
- package/src/robustExteranlApiCallerService/externalApiProvider.js +156 -0
- package/src/robustExteranlApiCallerService/externalServicesStatsCollector.js +82 -0
- package/src/robustExteranlApiCallerService/robustExternalAPICallerService.js +388 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/_performCallAttempt.test.js +787 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/callExternalAPI/callExternalAPI.test.js +745 -0
- package/src/robustExteranlApiCallerService/tests/robustExternalAPICallerService/robustExternalAPICallerService/constructor.test.js +31 -0
- package/src/swaps-lib/external-apis/swapProvider.js +214 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +938 -0
- package/src/swaps-lib/models/baseSwapCreationInfo.js +43 -0
- package/src/swaps-lib/models/existingSwap.js +73 -0
- package/src/swaps-lib/models/existingSwapWithFiatData.js +134 -0
- package/src/swaps-lib/services/publicSwapService.js +702 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/_fetchSupportedCurrenciesIfNeeded.test.js +506 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/createSwap.test.js +1311 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getAllSupportedCurrencies.test.js +76 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getDepositCurrencies.test.js +82 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getSwapInfo.test.js +1892 -0
- package/src/swaps-lib/test/external-apis/swapspaceSwapProvider/getWithdrawalCurrencies.test.js +111 -0
- package/src/swaps-lib/test/utils/swapUtils/safeHandleRequestsLimitExceeding.test.js +88 -0
- package/src/swaps-lib/utils/swapUtils.js +219 -0
- package/stories/stubs/exampleContent.jsx +20 -0
- package/styles/_placeholder.scss +1 -1
- 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 +1 -1
- package/styles/index.scss +5 -3
- package/stories/index.js +0 -2
- /package/{stories → src/components}/atoms/LoadingDots/LoadingDots.jsx +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@import "../../../../styles/index";
|
|
2
|
+
|
|
3
|
+
.swap-form {
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
&-inputs {
|
|
7
|
+
position: relative;
|
|
8
|
+
z-index: 2;
|
|
9
|
+
|
|
10
|
+
&-separator {
|
|
11
|
+
height: 4px;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
user-select: none;
|
|
16
|
+
|
|
17
|
+
img {
|
|
18
|
+
margin: -13px 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:not(.disabled) {
|
|
22
|
+
@extend %hover-state;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.disabled {
|
|
26
|
+
opacity: 0.7;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-information-field {
|
|
32
|
+
z-index: 1;
|
|
33
|
+
background-color: SolidColor("lightsmoke");
|
|
34
|
+
margin-top: 4px;
|
|
35
|
+
border-radius: 0 0 8px 8px;
|
|
36
|
+
padding: 10px 20px;
|
|
37
|
+
position: relative;
|
|
38
|
+
text-align: left;
|
|
39
|
+
|
|
40
|
+
.semi-transparent {
|
|
41
|
+
opacity: 0.5;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
p {
|
|
45
|
+
color: SolidColor("grey");
|
|
46
|
+
|
|
47
|
+
.interactable {
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
transition: 0.3s;
|
|
51
|
+
|
|
52
|
+
@media (hover: hover) {
|
|
53
|
+
&:hover {
|
|
54
|
+
opacity: 0.7;
|
|
55
|
+
transition: 0s;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:active {
|
|
60
|
+
text-decoration: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.red {
|
|
65
|
+
color: SolidColor("red");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&::before {
|
|
70
|
+
z-index: 0;
|
|
71
|
+
content: "";
|
|
72
|
+
position: absolute;
|
|
73
|
+
left: 0;
|
|
74
|
+
bottom: calc(100% + 4px);
|
|
75
|
+
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 20px;
|
|
78
|
+
border-radius: 8px;
|
|
79
|
+
background-color: transparent;
|
|
80
|
+
box-shadow:
|
|
81
|
+
0px 0px 0px 4px $white,
|
|
82
|
+
0px 10px 0px 0px SolidColor("lightsmoke");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-address-field {
|
|
87
|
+
margin-top: Margin("5");
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: Margin("3");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&-rate-selector {
|
|
94
|
+
margin-top: Margin("5");
|
|
95
|
+
display: block;
|
|
96
|
+
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&-validation-text {
|
|
100
|
+
margin-top: Margin("5");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&-button-container {
|
|
104
|
+
&-consent-text {
|
|
105
|
+
text-align: end;
|
|
106
|
+
color: SolidColor("grey");
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
font-style: italic;
|
|
109
|
+
|
|
110
|
+
@media (max-width: $phone-width) {
|
|
111
|
+
text-align: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&-link {
|
|
115
|
+
color: SolidColor("grey");
|
|
116
|
+
text-decoration: underline;
|
|
117
|
+
|
|
118
|
+
&:active {
|
|
119
|
+
text-decoration: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: flex-end;
|
|
126
|
+
align-items: center;
|
|
127
|
+
margin-top: Margin("10");
|
|
128
|
+
gap: Margin("3");
|
|
129
|
+
|
|
130
|
+
@media (max-width: $phone-width) {
|
|
131
|
+
flex-direction: column-reverse;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import { DialogStep } from "../../organisms/Dialog/DialogStep/DialogStep";
|
|
5
|
+
|
|
6
|
+
import determinedErrorImage from "../../../assets/wrappedImages/determinedError";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Template dialog step to display an error through the title and subtitle.
|
|
10
|
+
* You can insert it into any dialog windows and implement them into flows.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} props - Component props.
|
|
13
|
+
* @param {object} props.controls - Control elements for the dialog.
|
|
14
|
+
* @param {string} props.stepName - Name of the current step.
|
|
15
|
+
* @param {string} props.title - Title of the dialog.
|
|
16
|
+
* @param {string} props.subtitle - Subtitle of the dialog.
|
|
17
|
+
* @param {string} props.backButtonText - Text for the back button.
|
|
18
|
+
* @param {Function} props.backButtonClick - Handler for back button click.
|
|
19
|
+
* @param {string} props.backButtonLink - Link for the back button.
|
|
20
|
+
* @param {string} props.confirmButtonText - Text for the confirm button.
|
|
21
|
+
* @param {Function} props.confirmButtonClick - Handler for confirm button click.
|
|
22
|
+
* @param {string} props.confirmButtonLink - Link for the confirm button.
|
|
23
|
+
* @param {boolean} props.showCornerBackButton - Whether to show the corner back button.
|
|
24
|
+
* @returns {JSX.Element} React component
|
|
25
|
+
*/
|
|
26
|
+
export const DeterminedErrorDialogStep = ({
|
|
27
|
+
controls,
|
|
28
|
+
stepName,
|
|
29
|
+
title,
|
|
30
|
+
subtitle,
|
|
31
|
+
backButtonText,
|
|
32
|
+
backButtonClick,
|
|
33
|
+
backButtonLink,
|
|
34
|
+
confirmButtonText,
|
|
35
|
+
confirmButtonClick,
|
|
36
|
+
confirmButtonLink,
|
|
37
|
+
showCornerBackButton,
|
|
38
|
+
}) => {
|
|
39
|
+
return (
|
|
40
|
+
<DialogStep
|
|
41
|
+
controls={controls}
|
|
42
|
+
stepName={stepName}
|
|
43
|
+
ImageRaw={determinedErrorImage}
|
|
44
|
+
title={title}
|
|
45
|
+
subtitle={subtitle}
|
|
46
|
+
backButtonText={backButtonText}
|
|
47
|
+
backButtonClick={backButtonClick}
|
|
48
|
+
backButtonTo={backButtonLink}
|
|
49
|
+
confirmButtonText={confirmButtonText}
|
|
50
|
+
confirmButtonClick={confirmButtonClick}
|
|
51
|
+
confirmButtonLink={confirmButtonLink}
|
|
52
|
+
showCornerBackButton={showCornerBackButton}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
DeterminedErrorDialogStep.propTypes = {
|
|
58
|
+
controls: PropTypes.object,
|
|
59
|
+
stepName: PropTypes.string,
|
|
60
|
+
title: PropTypes.string.isRequired,
|
|
61
|
+
subtitle: PropTypes.string.isRequired,
|
|
62
|
+
backButtonText: PropTypes.string,
|
|
63
|
+
backButtonClick: PropTypes.func,
|
|
64
|
+
backButtonLink: PropTypes.string,
|
|
65
|
+
confirmButtonText: PropTypes.string,
|
|
66
|
+
confirmButtonClick: PropTypes.func,
|
|
67
|
+
confirmButtonLink: PropTypes.string,
|
|
68
|
+
showCornerBackButton: PropTypes.bool,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
DeterminedErrorDialogStep.defaultProps = {
|
|
72
|
+
backButtonText: "",
|
|
73
|
+
backButtonClick: null,
|
|
74
|
+
confirmButtonText: "",
|
|
75
|
+
confirmButtonClick: null,
|
|
76
|
+
showCornerBackButton: false,
|
|
77
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import should from "should";
|
|
2
|
+
|
|
3
|
+
import { describe, it } from "vitest";
|
|
4
|
+
import { InputValuesProviders } from "../../../utils/inputValueProviders.js";
|
|
5
|
+
|
|
6
|
+
describe("InputValueProviders", function () {
|
|
7
|
+
describe("#provideFormatOfFloatValueByInputString", function () {
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
max: null,
|
|
11
|
+
maxSuffix: 2,
|
|
12
|
+
test: "1989401950928592501985.3233",
|
|
13
|
+
expected: "1989401950928592501985.32",
|
|
14
|
+
message: "Should not touch prefix if max is null",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
max: 21000000,
|
|
18
|
+
maxSuffix: 2,
|
|
19
|
+
test: "1989401950928592501985.3243",
|
|
20
|
+
expected: "92501985.32",
|
|
21
|
+
message:
|
|
22
|
+
"Should left no more than max digits count for prefix - some prefix case",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
max: 3,
|
|
26
|
+
maxSuffix: 2,
|
|
27
|
+
test: "1989401950928592501985.3243",
|
|
28
|
+
expected: "5.32",
|
|
29
|
+
message:
|
|
30
|
+
"Should left no more than max digits count for prefix - min prefix case",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
max: 21000000,
|
|
34
|
+
maxSuffix: 1,
|
|
35
|
+
test: "232.1243",
|
|
36
|
+
expected: "232.1",
|
|
37
|
+
message:
|
|
38
|
+
"Should left no more than maxSuffix digits count in suffix - case maxSuffix is minimal = 1 and actual is londer",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
max: 21000000,
|
|
42
|
+
maxSuffix: 1,
|
|
43
|
+
test: "232.1",
|
|
44
|
+
expected: "232.1",
|
|
45
|
+
message:
|
|
46
|
+
"Should left no more than maxSuffix digits count in suffix - case maxSuffix is minimal = 1 and actual is the same length",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
max: 21000000,
|
|
50
|
+
maxSuffix: 8,
|
|
51
|
+
test: "232.1243909909",
|
|
52
|
+
expected: "232.12439099",
|
|
53
|
+
message:
|
|
54
|
+
"Should left no more than maxSuffix digits count in suffix - some maxSuffix case and actual suffix longer",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
max: 21000000,
|
|
58
|
+
maxSuffix: 8,
|
|
59
|
+
test: "232.1243",
|
|
60
|
+
expected: "232.1243",
|
|
61
|
+
message:
|
|
62
|
+
"Should left no more than maxSuffix digits count in suffix - some maxSuffix case and actual suffix shorter",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
max: null,
|
|
66
|
+
maxSuffix: 2,
|
|
67
|
+
test: "1323,23",
|
|
68
|
+
expected: "1323.23",
|
|
69
|
+
message: "Should replace comma with dot",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
max: null,
|
|
73
|
+
maxSuffix: 8,
|
|
74
|
+
test: "434,343,3423",
|
|
75
|
+
expected: "434.343",
|
|
76
|
+
message: "Should remove all after the second comma and itself",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
max: null,
|
|
80
|
+
maxSuffix: 8,
|
|
81
|
+
test: "434.343.3423",
|
|
82
|
+
expected: "434.343",
|
|
83
|
+
message: "Should remove all after the second dot and itself",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
max: null,
|
|
87
|
+
maxSuffix: 8,
|
|
88
|
+
test: "`3|49(3.3@43f",
|
|
89
|
+
expected: "3493.343",
|
|
90
|
+
message: "Should remove all non-digits and non-dot symbols",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
max: null,
|
|
94
|
+
maxSuffix: 8,
|
|
95
|
+
test: ".219",
|
|
96
|
+
expected: "0.219",
|
|
97
|
+
message: "Should add leading zero",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
max: null,
|
|
101
|
+
maxSuffix: 8,
|
|
102
|
+
test: "32..219",
|
|
103
|
+
expected: "32.219",
|
|
104
|
+
message: "Should replace the series of dots with the only",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
max: null,
|
|
108
|
+
maxSuffix: 8,
|
|
109
|
+
test: "32,,219",
|
|
110
|
+
expected: "32.219",
|
|
111
|
+
message: "Should replace the series of commas with the only",
|
|
112
|
+
},
|
|
113
|
+
].forEach((testData) => {
|
|
114
|
+
it(testData.message, function () {
|
|
115
|
+
InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
116
|
+
testData.test,
|
|
117
|
+
testData.maxSuffix,
|
|
118
|
+
testData.max
|
|
119
|
+
).should.be.equal(testData.expected);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("Should throw an error if passed suffix length less than 0", function () {
|
|
124
|
+
let error = null;
|
|
125
|
+
try {
|
|
126
|
+
InputValuesProviders.provideFormatOfFloatValueByInputString(
|
|
127
|
+
"23232",
|
|
128
|
+
-1
|
|
129
|
+
);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
error = e;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
(error?.message ?? "").should.startWith(
|
|
135
|
+
"Min suffix length is 0, got"
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import should from "should";
|
|
2
|
+
|
|
3
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
4
|
+
import { getQueryParameterValues } from "../../../utils/urlQueryUtils.js";
|
|
5
|
+
|
|
6
|
+
describe("urlQueryUtils", function () {
|
|
7
|
+
describe("#getQueryParameterValues", function () {
|
|
8
|
+
beforeEach(function () {});
|
|
9
|
+
|
|
10
|
+
afterEach(function () {
|
|
11
|
+
global.window = {};
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function setCustomQueryString(query) {
|
|
15
|
+
global.window = {
|
|
16
|
+
location: {
|
|
17
|
+
search: query,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
it("Should unescape parameter values", function () {
|
|
23
|
+
const parameterValuesWithSpecialSymbols = "#a@se /wer|*|##eee$";
|
|
24
|
+
setCustomQueryString(
|
|
25
|
+
`?a=${encodeURIComponent(parameterValuesWithSpecialSymbols)}`
|
|
26
|
+
);
|
|
27
|
+
const result = getQueryParameterValues("a");
|
|
28
|
+
|
|
29
|
+
result.should.be.deepEqual([
|
|
30
|
+
...parameterValuesWithSpecialSymbols.split("|*|"),
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("Should return empty array if there is no such parameter in the query", function () {
|
|
35
|
+
setCustomQueryString(`?a=val&b=val2`);
|
|
36
|
+
const result = getQueryParameterValues("c");
|
|
37
|
+
|
|
38
|
+
result.should.be.deepEqual([]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("Should return array with the only empty string element if the value of the parameter is empty", function () {
|
|
42
|
+
setCustomQueryString(`?a=`);
|
|
43
|
+
const result = getQueryParameterValues("a");
|
|
44
|
+
|
|
45
|
+
result.should.be.deepEqual([""]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("Should return array with one value", function () {
|
|
49
|
+
setCustomQueryString(`?a=val1`);
|
|
50
|
+
const result = getQueryParameterValues("a");
|
|
51
|
+
|
|
52
|
+
result.should.be.deepEqual(["val1"]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("Should return array with several values", function () {
|
|
56
|
+
setCustomQueryString(`?a=${encodeURIComponent("val1|*|val2")}`);
|
|
57
|
+
const result = getQueryParameterValues("a");
|
|
58
|
+
|
|
59
|
+
result.should.be.deepEqual(["val1", "val2"]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("Should return array of all values if parameter is defined several times in the query", function () {
|
|
63
|
+
setCustomQueryString(
|
|
64
|
+
`?a=${encodeURIComponent("val1|*|val2")}&a=val3`
|
|
65
|
+
);
|
|
66
|
+
const result = getQueryParameterValues("a");
|
|
67
|
+
|
|
68
|
+
result.should.be.deepEqual(["val1", "val2", "val3"]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import should from "should";
|
|
3
|
+
|
|
4
|
+
import { beforeEach, afterEach, describe, it } from "vitest";
|
|
5
|
+
import { saveQueryParameterAndValues } from "../../../utils/urlQueryUtils.js";
|
|
6
|
+
|
|
7
|
+
describe("urlQueryUtils", function () {
|
|
8
|
+
describe("#saveQueryParameterAndValues", function () {
|
|
9
|
+
let callbackStub;
|
|
10
|
+
beforeEach(function () {
|
|
11
|
+
callbackStub = sinon.stub();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(function () {
|
|
15
|
+
global.window = {};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function setCustomQueryString(query) {
|
|
19
|
+
global.window = {
|
|
20
|
+
location: {
|
|
21
|
+
search: query,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
it("Should escape parameter values", function () {
|
|
27
|
+
setCustomQueryString("");
|
|
28
|
+
const result = saveQueryParameterAndValues(
|
|
29
|
+
"a",
|
|
30
|
+
["e #e"],
|
|
31
|
+
callbackStub
|
|
32
|
+
);
|
|
33
|
+
result.should.be.equal(`?a=${encodeURIComponent("e #e")}`);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("Should call callback ones", function () {
|
|
37
|
+
setCustomQueryString("");
|
|
38
|
+
saveQueryParameterAndValues("a", ["1"], callbackStub);
|
|
39
|
+
callbackStub.callCount.should.be.equal(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("Should add parameter with no values - Case query is empty", function () {
|
|
43
|
+
setCustomQueryString("");
|
|
44
|
+
const result = saveQueryParameterAndValues("a", [], callbackStub);
|
|
45
|
+
result.should.be.equal("?a=");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("Should add parameter with no values - Case query contains one parameter", function () {
|
|
49
|
+
setCustomQueryString("?one=val");
|
|
50
|
+
const result = saveQueryParameterAndValues("a", [], callbackStub);
|
|
51
|
+
result.should.be.equal("?one=val&a=");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("Should add parameter with no values - Case query contains several parameters", function () {
|
|
55
|
+
setCustomQueryString("?one=val&err=week");
|
|
56
|
+
const result = saveQueryParameterAndValues("a", [], callbackStub);
|
|
57
|
+
result.should.be.equal("?one=val&err=week&a=");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("Should add parameter with one value - Case query is empty", function () {
|
|
61
|
+
setCustomQueryString("");
|
|
62
|
+
const result = saveQueryParameterAndValues(
|
|
63
|
+
"a",
|
|
64
|
+
["1"],
|
|
65
|
+
callbackStub
|
|
66
|
+
);
|
|
67
|
+
result.should.be.equal("?a=1");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("Should add parameter with one value - Case query contains one parameter", function () {
|
|
71
|
+
setCustomQueryString("?one=val");
|
|
72
|
+
const result = saveQueryParameterAndValues(
|
|
73
|
+
"a",
|
|
74
|
+
["1"],
|
|
75
|
+
callbackStub
|
|
76
|
+
);
|
|
77
|
+
result.should.be.equal("?one=val&a=1");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("Should add parameter with one value - Case query contains several parameters", function () {
|
|
81
|
+
setCustomQueryString("?one=val&err=week");
|
|
82
|
+
const result = saveQueryParameterAndValues(
|
|
83
|
+
"a",
|
|
84
|
+
["1"],
|
|
85
|
+
callbackStub
|
|
86
|
+
);
|
|
87
|
+
result.should.be.equal("?one=val&err=week&a=1");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("Should add parameter with several values using separator - Case query is empty", function () {
|
|
91
|
+
setCustomQueryString("");
|
|
92
|
+
const result = saveQueryParameterAndValues(
|
|
93
|
+
"a",
|
|
94
|
+
["1", "aa", "err"],
|
|
95
|
+
callbackStub
|
|
96
|
+
);
|
|
97
|
+
result.should.be.equal(`?a=${encodeURIComponent("1|*|aa|*|err")}`);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("Should add parameter with several values using separator - Case query contains one parameter", function () {
|
|
101
|
+
setCustomQueryString("?one=val");
|
|
102
|
+
const result = saveQueryParameterAndValues(
|
|
103
|
+
"a",
|
|
104
|
+
["1", "aa", "err"],
|
|
105
|
+
callbackStub
|
|
106
|
+
);
|
|
107
|
+
result.should.be.equal(
|
|
108
|
+
`?one=val&a=${encodeURIComponent("1|*|aa|*|err")}`
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("Should add parameter with several values using separator - Case query contains several parameters", function () {
|
|
113
|
+
setCustomQueryString("?one=val&err=week");
|
|
114
|
+
const result = saveQueryParameterAndValues(
|
|
115
|
+
"a",
|
|
116
|
+
["1", "aa", "err"],
|
|
117
|
+
callbackStub
|
|
118
|
+
);
|
|
119
|
+
result.should.be.equal(
|
|
120
|
+
`?one=val&err=week&a=${encodeURIComponent("1|*|aa|*|err")}`
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("Should replace existing parameter value - Case query contains one parameter", function () {
|
|
125
|
+
setCustomQueryString("?a=val");
|
|
126
|
+
const result = saveQueryParameterAndValues(
|
|
127
|
+
"a",
|
|
128
|
+
["1"],
|
|
129
|
+
callbackStub
|
|
130
|
+
);
|
|
131
|
+
result.should.be.equal("?a=1");
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("Should replace existing parameter value - Case query contains several parameters", function () {
|
|
135
|
+
setCustomQueryString("?one=val&a=week");
|
|
136
|
+
const result = saveQueryParameterAndValues(
|
|
137
|
+
"a",
|
|
138
|
+
["1"],
|
|
139
|
+
callbackStub
|
|
140
|
+
);
|
|
141
|
+
result.should.be.equal("?one=val&a=1");
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
|
|
3
|
+
export class InputValuesProviders {
|
|
4
|
+
/**
|
|
5
|
+
* Designed to be called onKeyUp event of html input field for float value
|
|
6
|
+
* Removes all prohibited stuff from the given float string and remains only allowed.
|
|
7
|
+
* Removes digits before and after the dot.
|
|
8
|
+
*
|
|
9
|
+
* @param inputString {string} string to be corrected
|
|
10
|
+
* @param maxValue {string} max value for the correcting float value
|
|
11
|
+
* @param digitsAfterDot {number} count of digits after the dot that this method should provide, min 0
|
|
12
|
+
* @return {string} corrected float value string
|
|
13
|
+
*/
|
|
14
|
+
static provideFormatOfFloatValueByInputString(
|
|
15
|
+
inputString,
|
|
16
|
+
digitsAfterDot = 2,
|
|
17
|
+
maxValue = null
|
|
18
|
+
) {
|
|
19
|
+
let value = inputString;
|
|
20
|
+
if (!value) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (digitsAfterDot < 0) {
|
|
25
|
+
throw new Error("Min suffix length is 0, got " + digitsAfterDot);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
value = value.replace(/[,]/g, "."); // replaces commas with dots
|
|
29
|
+
value = value.replace(/[^0-9.]/g, ""); // remove non digits/dots
|
|
30
|
+
value = value.replace(/^\./g, "0."); // adds leading zero
|
|
31
|
+
value = value.replace(/\.+/g, "."); // replaces series of dots with single dot
|
|
32
|
+
|
|
33
|
+
let parts = value.split(".");
|
|
34
|
+
if (parts.length > 2) {
|
|
35
|
+
// removes all after second dot and itself
|
|
36
|
+
parts = [parts[0], parts[1]];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (maxValue != null) {
|
|
40
|
+
const maxDigitsCountBeforeTheDot =
|
|
41
|
+
BigNumber(maxValue).toFixed(0).length;
|
|
42
|
+
if (parts[0]?.length > maxDigitsCountBeforeTheDot) {
|
|
43
|
+
// removes redundant prefix digits
|
|
44
|
+
parts[0] = parts[0].substring(
|
|
45
|
+
parts[0].length - maxDigitsCountBeforeTheDot,
|
|
46
|
+
parts[0].length
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (parts[1]?.length > digitsAfterDot) {
|
|
52
|
+
// removes redundant suffix digits
|
|
53
|
+
parts[1] = parts[1].substring(0, digitsAfterDot);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return parts.join(".");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import copy from "clipboard-copy";
|
|
2
|
+
|
|
3
|
+
import { improveAndRethrow } from "../../common/errorUtils.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copies given text to clipboard inside browser.
|
|
7
|
+
*
|
|
8
|
+
* @param text - text to be copied
|
|
9
|
+
*/
|
|
10
|
+
export function copyBrowserTextToClipboard(text) {
|
|
11
|
+
try {
|
|
12
|
+
if (!copy(text)) {
|
|
13
|
+
throw new Error("Failed to execute copy command.");
|
|
14
|
+
}
|
|
15
|
+
} catch (e) {
|
|
16
|
+
improveAndRethrow(e, "saveTextToFile");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const handleClickOutside = (exceptionsRefs, callback) => {
|
|
2
|
+
function handleClick(event) {
|
|
3
|
+
const isExceptionClicked = exceptionsRefs.find(
|
|
4
|
+
(ref) => ref?.current && ref.current.contains(event.target)
|
|
5
|
+
);
|
|
6
|
+
if (!isExceptionClicked) {
|
|
7
|
+
callback();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
document.addEventListener("click", handleClick);
|
|
12
|
+
|
|
13
|
+
return () => document.removeEventListener("click", handleClick);
|
|
14
|
+
};
|